[PATCH] spi: zynqmp_gqspi: Simplify baud_rate_val calculation

Michal Simek monstr at monstr.eu
Tue Mar 30 09:28:57 CEST 2021


pá 12. 3. 2021 v 14:53 odesílatel Michal Simek <michal.simek at xilinx.com> napsal:
>
> Condition to setup GQSPI_DFLT_BAUD_RATE_VAL(number 2) in case when
> baud_rate_val is more then 7 is wrong. There should be really the biggest
> possible value which is 7. This can be achieve in easier way by enabling
> calculation till GQSPI_MAX_BAUD_RATE_VAL.
>
> Signed-off-by: Michal Simek <michal.simek at xilinx.com>
> ---
>
>  drivers/spi/zynqmp_gqspi.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
> index f8d13d193e30..900cb2610c7f 100644
> --- a/drivers/spi/zynqmp_gqspi.c
> +++ b/drivers/spi/zynqmp_gqspi.c
> @@ -324,14 +324,10 @@ static int zynqmp_qspi_set_speed(struct udevice *bus, uint speed)
>         if (plat->speed_hz != speed) {
>                 /* Set the clock frequency */
>                 /* If speed == 0, default to lowest speed */
> -               while ((baud_rate_val < 8) &&
> -                      ((plat->frequency /
> -                      (2 << baud_rate_val)) > speed))
> +               while (baud_rate_val < GQSPI_MAX_BAUD_RATE_VAL &&
> +                      (plat->frequency / (2 << baud_rate_val)) > speed)
>                         baud_rate_val++;
>
> -               if (baud_rate_val > GQSPI_MAX_BAUD_RATE_VAL)
> -                       baud_rate_val = GQSPI_DFLT_BAUD_RATE_VAL;
> -
>                 plat->speed_hz = plat->frequency / (2 << baud_rate_val);
>
>                 confr = readl(&regs->confr);
> --
> 2.30.1
>

Please ignore this patch because it needs to be changed.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs


More information about the U-Boot mailing list