devicetree: bcm2835:

Martin Sperl kernel at martin.sperl.org
Mon Aug 10 01:41:02 PDT 2015


Hi!

When adding a gpio section to enable the auxiliar spi device pins
with the correct mode to the bcm2835 device treesimilar to this:
         /* SPI1 pins */
         spi1_pins: spi1_pins {
                 brcm,pins = <19 20 21>;
                 brcm,function = <BCM2835_FSEL_ALT4>
         };
         /* SPI1 GPIO-chipselects */
         spi1_cs_pins: spi1_cs_pins {
                 brcm,pins = <18 17 16>;
                 brcm,function = <BCM2835_FSEL_OUT>;
         };

         /* SPI2 pins */
         spi2_pins: spi2_pins {
                 brcm,pins = <40 41 42>;
                 brcm,function = <BCM2835_FSEL_ALT4>;
         };
         /* SPI2 GPIO-chipselects */
         spi2_cs_pins: spi2_cs_pins {
                 brcm,pins = <43 44 45>;
                 brcm,function = <BCM2835_FSEL_OUT>
         };

and reference them inside the spi devices, then I get the following
messages in dmesg:
[   54.970048] pinctrl-bcm2835 20200000.gpio: pin gpio21 already 
requested by 20200000.gpio; cannot claim for 20215080.spi
[   54.970088] pinctrl-bcm2835 20200000.gpio: pin-21 (20215080.spi) 
status -22
[   54.970111] pinctrl-bcm2835 20200000.gpio: could not request pin 21 
(gpio21) from group gpio21  on device pinctrl-bcm2835
[   54.977495] pinctrl-bcm2835 20200000.gpio: pin gpio40 already 
requested by 20200000.gpio; cannot claim for 202150c0.spi
[   54.977543] pinctrl-bcm2835 20200000.gpio: pin-40 (202150c0.spi) 
status -22
[   54.977568] pinctrl-bcm2835 20200000.gpio: could not request pin 40 
(gpio40) from group gpio40  on device pinctrl-bcm2835


Looking into it it is related to the fact that we also have the
following definitions in arch/arm/boot/dts/bcm2835-rpi-b-plus.dts:
&gpio {
...
         /* I2S interface */
         i2s_alt0: i2s_alt0 {
                 brcm,pins = <18 19 20 21>;
                 brcm,function = <BCM2835_FSEL_ALT0>;
         };
...
};
and in arch/arm/boot/dts/bcm2835-rpi.dtsi:
&gpio {
...
         alt0: alt0 {
                 brcm,pins = <0 1 2 3 4 5 7 8 9 10 11 14 15 40 45>;
                 brcm,function = <BCM2835_FSEL_ALT0>;
         };
...
};

There are GPIO pins (18, 19, 20, 21, 40) defined in multiple GPIO
sections with different functions (ALT0, ALT4 and OUT).

Obviously there is an issue when both i2s and spi drivers are loaded,
but if only one is loaded it should work, but the framework does not
allow it.

So I wonder how we can solve this in a sensible way allowing for either
of those devices to be enabled - do we need to go the
"device-tree-overlay" route?

Thanks,
         Martin



More information about the linux-rpi-kernel mailing list