Messages in this thread | | | From | Andy Shevchenko <> | Date | Fri, 12 Nov 2021 23:37:36 +0200 | Subject | Re: [PATCH 4/4] spi: dw: Add Synopsys Component version reading and parsing |
| |
On Fri, Nov 12, 2021 at 11:27 PM Andy Shevchenko <andy.shevchenko@gmail.com> wrote: > On Fri, Nov 12, 2021 at 10:52 PM Serge Semin > <Sergey.Semin@baikalelectronics.ru> 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
| |