mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>,
	"Pavel Machek" <pavel@ucw.cz>
Cc: Dan Murphy <dmurphy@ti.com>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] leds: bcm6328: improve write and read functions
Date: Tue, 23 Feb 2021 09:00:16 -0800	[thread overview]
Message-ID: <a2da8ee6-a941-de04-3d45-56fb6cae596a@gmail.com> (raw)
In-Reply-To: <F349F1C2-4D4F-4BF7-9ADC-6E879197405B@gmail.com>



On 2/23/2021 1:05 AM, Álvaro Fernández Rojas wrote:
> 
> 
>> El 23 feb 2021, a las 9:58, Pavel Machek <pavel@ucw.cz> escribió:
>>
>> Hi!
>>
>>>>> 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
>>>
>>
>> Yeah, but ideally you should not be copying comments; there should be
>> one central place which does it and does it right.
> 
> I’m open to suggestions :).
> Which central place would be a good place for you?

I did consider creating an include/linux/brcm/brcm_io.h header or
something like that but I am really not sure what the benefit would be.

As far as using _relaxed() this is absolutely correct because the bus
logic that connects the CPU to its on-chip registers is non re-ordering
non posted. That is true on the MIPS BE/LE and ARM when configured in LE
or BE.

We need the swapping for ARM because when running in ARM BE32, the data
is going to be in the host CPU endian, but the register bus is hard
wired to little endian.
-- 
Florian

  reply	other threads:[~2021-02-23 17:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-23  8:17 [PATCH 0/2] leds: bcm63x8: improve read and write functions Álvaro Fernández Rojas
2021-02-23  8:17 ` [PATCH 1/2] leds: bcm6328: improve write and read functions Álvaro Fernández Rojas
2021-02-23  8:34   ` Pavel Machek
2021-02-23  8:42     ` Álvaro Fernández Rojas
2021-02-23  8:58       ` Pavel Machek
2021-02-23  9:05         ` Álvaro Fernández Rojas
2021-02-23 17:00           ` Florian Fainelli [this message]
2021-02-24 17:36             ` Pavel Machek
2021-02-24 17:45               ` Florian Fainelli
2021-02-24 21:45                 ` Pavel Machek
2021-02-23  8:17 ` [PATCH 2/2] leds: bcm6358: " Álvaro Fernández Rojas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a2da8ee6-a941-de04-3d45-56fb6cae596a@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=dmurphy@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=noltari@gmail.com \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome