linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/8 v2] leds: add device tree bindings for register bit LEDs
Date: Mon, 8 Sep 2014 13:25:51 +0200	[thread overview]
Message-ID: <CACRpkdarXzrprA=1=oT-1K8X3y-QPH+gkteHCpZDcCA3pBZMOQ@mail.gmail.com> (raw)
In-Reply-To: <5686741.QjIvGO0Jfo@wuerfel>

On Tue, Sep 2, 2014 at 2:24 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> On Tuesday 02 September 2014 14:02:28 Linus Walleij wrote:
>> +LED sub-node properties:
>> +
>> +Required properties:
>> +- compatible : must be "register-bit-led"
>> +- offset : register offset to the register controlling this LED
>> +- mask : bit mask for the bit controlling this LED in the register
>> +  typically 0x01, 0x02, 0x04 ...
>>
>
> How does the driver know whether to do byte or word sized accesses?

Like with all other bindings based on
Documentation/devicetree/bindings/mfd/syscon.txt
it is implicit that the access size is 32 bit words. Just grep
for syscon in the bindings and you will see none define the access
width.

If this should be fixed, the parent syscon binding should be
altered to cover access width for all children as this is a property
of the entire register range.

So for example:

gpr: iomuxc-gpr at 020e0000 {
        compatible = "fsl,imx6q-iomuxc-gpr", "syscon";
        reg = <0x020e0000 0x38>;
        register-width = <32>;
        register-valid = <32>;
        register-stride = <4>;
};

So as to indicate that this register range is made up of 32 bit
words, all 32 bits are valid in each word, and the stride between
words i 4 bytes (i.e. tightly packed).

As mentioned by Rob, the "syscon" driver should be renamed
"register-range" and "syscon" deprecated as binding, as it is
Linux terminology.

I guess this adds up to the conclusion that the "syscon" binding
was badly reviewed and merged, and now we're suffering from it.

----

Not that anyone should care when reviewing device tree bindings,
but as it happens, the Linux driver
drivers/mfd/syscon.c
explicitly assumes all sycons are 32bit:

static struct regmap_config syscon_regmap_config = {
        .reg_bits = 32,
        .val_bits = 32,
        .reg_stride = 4,
};

If one happens to work on Linux (we would never assume such a
thing, but if one by infinitesimal chance would still happen to do that)
we can leave a note in this posting that the syscon driver would need to
be altered to marshall it's regmap differently on stumbling onto this
new property.

Yours,
Linus Walleij

  reply	other threads:[~2014-09-08 11:25 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-02 12:02 [PATCH 0/8] ARM RealView DeviceTree support v5 Linus Walleij
2014-09-02 12:02 ` [PATCH 1/8 v2] leds: add a driver for syscon-based LEDs Linus Walleij
2014-09-02 12:02 ` [PATCH 2/8 v2] leds: add device tree bindings for register bit LEDs Linus Walleij
2014-09-02 12:24   ` Arnd Bergmann
2014-09-08 11:25     ` Linus Walleij [this message]
2014-09-02 14:22   ` Geert Uytterhoeven
2014-09-08 11:14     ` Linus Walleij
2014-09-02 12:02 ` [PATCH 3/8 v2] power: reset: driver for the Versatile syscon reboot Linus Walleij
2014-09-02 12:32   ` Arnd Bergmann
2014-09-02 12:02 ` [PATCH 4/8] soc: add driver for the ARM RealView Linus Walleij
2014-09-02 12:02 ` [PATCH 5/8] ARM: l2x0: move DT parsing for cache props Linus Walleij
2014-09-02 12:43   ` Russell King - ARM Linux
2014-09-05 11:10     ` Linus Walleij
2014-09-02 12:02 ` [PATCH 6/8] ARM: l2c: parse 'cache-size' and 'cache-sets' properties Linus Walleij
2014-09-02 12:02 ` [PATCH 7/8] ARM: l2x0: support associativity from DT Linus Walleij
2014-09-02 13:17   ` Russell King - ARM Linux
2014-09-02 12:02 ` [PATCH 8/8 v5] ARM: realview: basic device tree implementation Linus Walleij
2014-09-02 12:37   ` Arnd Bergmann

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='CACRpkdarXzrprA=1=oT-1K8X3y-QPH+gkteHCpZDcCA3pBZMOQ@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).