On s4, the devicetree clocks are the direct inputs to the PWMs, so we don't need to configure the clocks in the driver. Instead, we just need to grab one clock from the devicetree for each PWM.
The PWM LED isn't working on my VIM1S, but I don't have time to look into this further. I'm posting this as RFC if anyone else would like to pick up where I left off. Signed-off-by: Sean Anderson <[email protected]> --- drivers/pwm/pwm-meson.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/pwm/pwm-meson.c b/drivers/pwm/pwm-meson.c index caa7af085fa..654b138d224 100644 --- a/drivers/pwm/pwm-meson.c +++ b/drivers/pwm/pwm-meson.c @@ -273,6 +273,13 @@ static int meson_pwm_probe(struct udevice *dev) struct meson_pwm_channel *channel = &priv->channels[i]; struct meson_pwm_channel_data *channel_data = &meson_pwm_per_channel_data[i]; + if (!data->parent_ids) { + err = clk_get_by_index(dev, i, &channel->clk); + if (err) + return err; + continue; + } + snprintf(name, sizeof(name), "clkin%u", i); err = clk_get_by_name(dev, name, &channel->clk); @@ -488,6 +495,11 @@ static const struct meson_pwm_data pwm_g12a_ee_data = { .num_parents = ARRAY_SIZE(pwm_g12a_ee_parent_ids), }; +static const struct meson_pwm_data pwm_s4_data = { + .parent_ids = NULL, + .num_parents = 0, +}; + static const struct udevice_id meson_pwm_ids[] = { { .compatible = "amlogic,meson-gxbb-pwm", @@ -517,6 +529,11 @@ static const struct udevice_id meson_pwm_ids[] = { .compatible = "amlogic,meson-g12a-ao-pwm-cd", .data = (ulong)&pwm_g12a_ao_cd_data }, + { + .compatible = "amlogic,meson-s4-pwm", + .data = (ulong)&pwm_s4_data + }, + { }, }; U_BOOT_DRIVER(meson_pwm) = { --- base-commit: 2b8902913c19eb581fb0d567201c09b8fa46ac74 branch: s4_pwm -- 2.53.0
