i3c: Allow OF-alias-based persistent bus numbering
authorJeremy Kerr <jk@codeconstruct.com.au>
Wed, 5 Apr 2023 09:41:49 +0000 (17:41 +0800)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Fri, 28 Apr 2023 06:19:01 +0000 (08:19 +0200)
commit7dc2e0a875645a79f5c1c063019397e8e94008f5
treecadca558dab0a9384a8a715379a2209dd52868e4
parent5844564143575a8dbcbcece0084da059faeca5df
i3c: Allow OF-alias-based persistent bus numbering

Parse the /aliases node to assign any fixed bus numbers, as is done with
the i2c subsystem. Numbering for non-aliased busses will start after the
highest fixed bus number.

This allows an alias node such as:

    aliases {
        i3c0 = &bus_a,
i3c4 = &bus_b,
    };

to set the numbering for a set of i3c controllers:

    /* fixed-numbered bus, assigned "i3c-0" */
    bus_a: i3c-master {
    };

    /* another fixed-numbered bus, assigned "i3c-4" */
    bus_b: i3c-master {
    };

    /* dynamic-numbered bus, likely assigned "i3c-5" */
    bus_c: i3c-master {
    };

If no i3c device aliases are present, the numbering will stay as-is,
starting from 0.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://lore.kernel.org/r/20230405094149.1513209-1-jk@codeconstruct.com.au
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/i3c/master.c