[PATCH v2] driver: pwm: pwm-imx: fix probing on imx6

Heiko Schocher hs at denx.de
Wed Aug 14 06:10:44 CEST 2024


Hello Fabio,

On 13.08.24 22:12, Fabio Estevam wrote:
> Hi Heiko,
> 
> On Tue, Aug 13, 2024 at 10:58 AM Heiko Schocher <hs at denx.de> wrote:
> 
>> Should we revert this patch?
>>
>> I just can say for the aristianetos2 board, that I readded exactly this
>> define in my work for the port to currentmainline ... and with my patch,
>> pwm and so bootlogo works again ...
> 
> What about the change below on top of your patch?
> 
> --- a/drivers/pwm/pwm-imx.c
> +++ b/drivers/pwm/pwm-imx.c
> @@ -14,6 +14,8 @@
>   #include <asm/io.h>
>   #include <clk.h>
> 
> +#define IMX6_PWM_PER_CLK       66000000
> +
>   int pwm_config_internal(struct pwm_regs *pwm, unsigned long period_cycles,
>                          unsigned long duty_cycles, unsigned long prescale)
>   {
> @@ -75,7 +77,7 @@ int pwm_imx_get_parms(int period_ns, int duty_ns,
> unsigned long *period_c,
>           * value here as a define. Replace it when we have the clock
>           * framework.
>           */
> -       c = CFG_IMX6_PWM_PER_CLK;
> +       c = IMX6_PWM_PER_CLK;
>          c = c * period_ns;
>          do_div(c, 1000000000);
>          *period_c = c;
> @@ -162,7 +164,7 @@ int pwm_dm_imx_get_parms(struct imx_pwm_priv
> *priv, int period_ns,
>          if (CONFIG_IS_ENABLED(CLK))
>                  c = clk_get_rate(&priv->per_clk);
>          else
> -               c = CFG_IMX6_PWM_PER_CLK;
> +               c = IMX6_PWM_PER_CLK;
> 
>          c = c * period_ns;
>          do_div(c, 1000000000);

Hmm.. yes, setting a default value is a good option, so I would add
a check, if define is not set yet?

And we should simply let the name "CFG_IMX6_PWM_PER_CLK" ?

If okay, I can make a v3 if you want?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de


More information about the U-Boot mailing list