[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <651a9064-cfe5-19ea-e6db-90d959ff1c54@gmail.com>
Date: Mon, 22 Feb 2021 19:58:48 -0800
From: Florian Fainelli <f.fainelli@...il.com>
To: Guenter Roeck <linux@...ck-us.net>,
Álvaro Fernández Rojas <noltari@...il.com>
Cc: Wim Van Sebroeck <wim@...ux-watchdog.org>,
linux-watchdog@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] watchdog: bcm7038_wdt: add big endian support
On 2/22/2021 7:41 PM, Florian Fainelli wrote:
>
>
> On 2/22/2021 2:24 PM, Guenter Roeck wrote:
>> On Mon, Feb 22, 2021 at 10:48:09PM +0100, Álvaro Fernández Rojas wrote:
>>> Hi Guenter,
>>>
>>>> El 22 feb 2021, a las 22:24, Guenter Roeck <linux@...ck-us.net> escribió:
>>>>
>>>> On 2/22/21 12:03 PM, Álvaro Fernández Rojas wrote:
>>>>> bcm7038_wdt can be used on bmips (bcm63xx) devices too.
>>>>>
>>>> It might make sense to actually enable it for BCM63XX.
>>>
>>> bcm63xx SoCs are supported in bcm63xx and bmips.
>>> bcm63xx doesn’t have device tree support, but bmips does and this watchdog is already enabled for bmips.
>>>
>>
>> Maybe add a note saying that this will only be supported for devicetree
>> based systems.
>>
>>>>
>>>>> Signed-off-by: Álvaro Fernández Rojas <noltari@...il.com>
>>>>> ---
>>>>> drivers/watchdog/bcm7038_wdt.c | 30 ++++++++++++++++++++++++------
>>>>> 1 file changed, 24 insertions(+), 6 deletions(-)
>>>>>
>>>>> diff --git a/drivers/watchdog/bcm7038_wdt.c b/drivers/watchdog/bcm7038_wdt.c
>>>>> index 979caa18d3c8..62494da1ac57 100644
>>>>> --- a/drivers/watchdog/bcm7038_wdt.c
>>>>> +++ b/drivers/watchdog/bcm7038_wdt.c
>>>>> @@ -34,6 +34,24 @@ struct bcm7038_watchdog {
>>>>>
>>>>> static bool nowayout = WATCHDOG_NOWAYOUT;
>>>>>
>>>>> +static inline void bcm7038_wdt_write(unsigned long data, void __iomem *reg)
>>>>> +{
>>>>> +#ifdef CONFIG_CPU_BIG_ENDIAN
>>>>> + __raw_writel(data, reg);
>>>>> +#else
>>>>> + writel(data, reg);
>>>>> +#endif
>>>>> +}
>>>>> +
>>>>> +static inline unsigned long bcm7038_wdt_read(void __iomem *reg)
>>>>> +{
>>>>> +#ifdef CONFIG_CPU_BIG_ENDIAN
>>>>> + return __raw_readl(reg);
>>>>> +#else
>>>>> + return readl(reg);
>>>>> +#endif
>>>>> +}
>>>>> +
>>>>
>>>> This needs further explanation. Why not just use __raw_writel() and
>>>> __raw_readl() unconditionally ? Also, is it known for sure that,
>>>> say, bmips_be_defconfig otherwise uses the wrong endianness
>>>> (vs. bmips_stb_defconfig which is a little endian configuration) ?
>>>
>>> Because __raw_writel() doesn’t have memory barriers and writel() does.
>>> Those configs use the correct endiannes, so I don’t know what you mean...
>>>
>> So are you saying that it already works with bmips_stb_defconfig
>> (because it is little endian), that bmips_stb_defconfig needs memory
>> barriers, and that bmips_be_defconfig doesn't need memory barriers ?
>> Odd, but I'll take you by your word. And other code does something
>> similar, so I guess there must be a reason for it.
>
> It would be so nice to copy people, and the author of that driver who
> could give you such an answer. Neither bmips_be_defconfig nor
> bmips_stb_defconfig require barrier because the bus interface towards
> registers that is used on those SoCs is non-reordering non-buffered.
I should mention though that using __raw_writel() with an ARM big-endian
would not work which is why {read,write}l_relaxed() should be preferred
such that all combinations work. A good example that has been proven to
work on BMIPS BE/LE and ARM BE/LE is bcmgenet.c
--
Florian
Powered by blists - more mailing lists