Re: [PATCH net-next] net: ethernet: ti: davinci_mdio: switch to readl/writel_relaxed()

From: Arnd Bergmann
Date: Thu Mar 28 2019 - 21:01:10 EST


On Fri, Mar 29, 2019 at 1:10 AM Grygorii Strashko
<grygorii.strashko@xxxxxx> wrote:
>
> Switch to readl/writel_relaxed() APIs, because this is recommended
> API and the MDIO block is reused on Keystone 2 SoCs
> where LE/BE modes are supported.
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@xxxxxx>

In general, my recommendation would be to use readl/writel instead of
readl_relaxed/writel_relaxed everywhere, because they have much
more predictible behavior. If you want to use the _relaxed version
in the fast-path for data traffic, that is usually fine, but then I would
add a comment next to it to explain why it is safe there without extra
barriers to serialize with spinlocks and DMA.

Changing away from __raw_*() to enable big-endian mode is of
course a good idea as well.

Arnd