[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcXia53YMyL8uZtHsNRYW9QzrbD9Cy31c4CW8jW-iNitA@mail.gmail.com>
Date: Fri, 12 Nov 2021 23:37:36 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Serge Semin <Sergey.Semin@...kalelectronics.ru>
Cc: Serge Semin <fancer.lancer@...il.com>,
Mark Brown <broonie@...nel.org>,
Nandhini Srikandan <nandhini.srikandan@...el.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Andy Shevchenko <andy@...nel.org>,
linux-spi <linux-spi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
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@...il.com> wrote:
> On Fri, Nov 12, 2021 at 10:52 PM Serge Semin
> <Sergey.Semin@...kalelectronics.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
Powered by blists - more mailing lists