Re: [PATCH 4/4] spi: dw: Add Synopsys Component version reading and parsing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 12, 2021 at 11:27 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
> On Fri, Nov 12, 2021 at 10:52 PM Serge Semin
> <Sergey.Semin@xxxxxxxxxxxxxxxxxxxx> wrote:

> > +       /*
> > +        * Retrieve the Synopsys component version if it hasn't been specified
> > +        * by the platform. Note the CoreKit version ID is encoded as a 4bytes
> > +        * ASCII string enclosed with '*' symbol.
> > +        */
> > +       if (!dws->ver) {
> > +               u32 comp;
> > +
> > +               comp = dw_readl(dws, DW_SPI_VERSION);
> > +               dws->ver = (DW_SPI_GET_BYTE(comp, 3) - '0') * 100;
> > +               dws->ver += (DW_SPI_GET_BYTE(comp, 2) - '0') * 10;
> > +               dws->ver += (DW_SPI_GET_BYTE(comp, 1) - '0');
> > +
> > +               dev_dbg(dev, "Synopsys DWC%sSSI v%u.%02u\n",
> > +                       (dws->caps & DW_SPI_CAP_DWC_HSSI) ? " " : " APB ",
> > +                       dws->ver / 100, dws->ver % 100);
>
> Oh là là, first you multiply then you divide in the same piece of code!
> What's wrong with fourcc (and thus keep it in ver filed as is) ? (Also
> we have %p4cc)
>
> > +       }

Have you seen this, btw?

https://elixir.bootlin.com/linux/latest/source/drivers/tty/serial/8250/8250_dwlib.c#L93


-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux