[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <3826ACDE-EFF2-4CC5-82EE-2DBC991CF996@gmail.com>
Date: Tue, 23 Feb 2021 09:42:21 +0100
From: Álvaro Fernández Rojas <noltari@...il.com>
To: Pavel Machek <pavel@....cz>
Cc: Florian Fainelli <f.fainelli@...il.com>,
Dan Murphy <dmurphy@...com>, linux-leds@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] leds: bcm6328: improve write and read functions
Hi Pavel,
> El 23 feb 2021, a las 9:34, Pavel Machek <pavel@....cz> escribió:
>
> On Tue 2021-02-23 09:17:31, Álvaro Fernández Rojas wrote:
>> This is proven to work in BMIPS BE/LE and ARM BE/LE, as used in bcm2835-rng
>> and bcmgenet drivers.
>> Both should also be inline functions.
>
>
>
>> -#ifdef CONFIG_CPU_BIG_ENDIAN
>> - iowrite32be(data, reg);
>> -#else
>> - writel(data, reg);
>> -#endif
>> + /* MIPS chips strapped for BE will automagically configure the
>> + * peripheral registers for CPU-native byte order.
>> + */
>
> Bad comment style.
I just wanted to copy the same comment as the one in bcm2835-rng and bcmgenet…
https://github.com/torvalds/linux/blob/3b9cdafb5358eb9f3790de2f728f765fef100731/drivers/char/hw_random/bcm2835-rng.c#L42-L60
https://github.com/torvalds/linux/blob/3b9cdafb5358eb9f3790de2f728f765fef100731/drivers/net/ethernet/broadcom/genet/bcmgenet.c#L71-L88
>
>> + if (IS_ENABLED(CONFIG_MIPS) && IS_ENABLED(CONFIG_CPU_BIG_ENDIAN))
>> + __raw_writel(data, reg);
>> + else
>> + writel_relaxed(data, reg);
>> }
>
> Code does not match comment (still need to do conversion on
> non-MIPS?), and it certainly should not be here (do all mipsen behave
> like that?!), and it really should not be converting to _relaxed at
> the same time.
I think it's because non-MIPS BE exposes that as little endian, but Florian can probably help us with that…
>
> Best regards,
> Pavel
> --
> http://www.livejournal.com/~pavelmachek
Best regards,
Álvaro.
Powered by blists - more mailing lists