All of lore.kernel.org
 help / color / mirror / Atom feed
* Kirkwood dts spi-gpio
@ 2016-03-09 10:05 a.lombardinilo
  2016-03-09 13:12 ` a.lombardinilo
  0 siblings, 1 reply; 4+ messages in thread
From: a.lombardinilo @ 2016-03-09 10:05 UTC (permalink / raw)
  To: linux-arm-kernel

My platform is based on the Marvell kirkwood 88e6281.
I'm updating the kernel from version 3.3.8 to version 3.18.27.
I'm new in dts and I have some problem on the configuration in the spi-gpio.
I'm using the spi-gpio for can interface (MCP2510).

Can anyone provide an example of configuration/settings?

The hardware connection is the following:
?- CAN_SPI_CS -> MPP39
?-?CAN_SPI_SCK -> MPP39
?-?CAN_SPI_MISO -> MPP39
?-?CAN_SPI_MOSI -> MPP39
?-?CAN_SPI_IRQ -> MPP39
?-?CAN_SPI_RST -> MPP39

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Kirkwood dts spi-gpio
  2016-03-09 10:05 Kirkwood dts spi-gpio a.lombardinilo
@ 2016-03-09 13:12 ` a.lombardinilo
  2016-03-09 14:30   ` Andrew Lunn
  0 siblings, 1 reply; 4+ messages in thread
From: a.lombardinilo @ 2016-03-09 13:12 UTC (permalink / raw)
  To: linux-arm-kernel

I added dts files in the following section:

??????? spi_gpio {
??????????????? #address-cells = <1>;
??????????????? #size-cells = <1>;

??????????????? compatible = "spi-gpio";

??????????????? status = "okay";
??????????????? gpio-sck = <&gpio1 40 GPIO_ACTIVE_LOW>;
??????????????? gpio-miso = <&gpio1 41 GPIO_ACTIVE_LOW>;
??????????????? gpio-mosi = <&gpio1 42 GPIO_ACTIVE_LOW>;
??????????????? cs-gpios = <&gpio1 39 GPIO_ACTIVE_LOW>;
??????????????? num-chipselects = <1>;

??????????????? can0: can at 0 {
??????????????????????? compatible = "microchip,mcp2515";
??????????????????????? reg = <0>;
??????????????????????? interrupts = <&gpio1 43 GPIO_ACTIVE_LOW>;
??????????????????????? spi-max-frequency = <10000000>;
??????????????? };
??????? };

 and I see the kernel message:

# dmesg | grep spi
[??? 1.068019] spi_gpio spi_gpio: gpio-sck property not found
[??? 1.073537] spi_gpio: probe of spi_gpio failed with error -22

 thank you

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Kirkwood dts spi-gpio
  2016-03-09 13:12 ` a.lombardinilo
@ 2016-03-09 14:30   ` Andrew Lunn
  2016-03-09 15:45     ` a.lombardinilo
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2016-03-09 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 09, 2016 at 02:12:07PM +0100, a.lombardinilo wrote:
> I added dts files in the following section:
> 
> ??????? spi_gpio {
> ??????????????? #address-cells = <1>;
> ??????????????? #size-cells = <1>;
> 
> ??????????????? compatible = "spi-gpio";
> 
> ??????????????? status = "okay";
> ??????????????? gpio-sck = <&gpio1 40 GPIO_ACTIVE_LOW>;

40 is invalid. It should be in the range 0-31.

Try gpio-sck = <&gpio1 8 GPIO_ACTIVE_LOW>;

Also, why are you doing spi-gpio?

Looking at the pinctrl driver, these pins can be used by a real SPI
core:

        MPP_MODE(39,
                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
                MPP_VAR_FUNCTION(0x1, "ts", "mp3",       V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs0",  V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x4, "audio", "bclk",   V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0xb, "lcd", "d19",      V(0, 0, 0, 0, 1, 0))),
        MPP_MODE(40,
                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
                MPP_VAR_FUNCTION(0x1, "ts", "mp4",       V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x2, "tdm", "spi-sck",  V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x4, "audio", "sdo",    V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0xb, "lcd", "d20",      V(0, 0, 0, 0, 1, 0))),
        MPP_MODE(41,
                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
                MPP_VAR_FUNCTION(0x1, "ts", "mp5",       V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x2, "tdm", "spi-miso", V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x4, "audio", "lrclk",  V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0xb, "lcd", "d21",      V(0, 0, 0, 0, 1, 0))),
        MPP_MODE(42,
                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
                MPP_VAR_FUNCTION(0x1, "ts", "mp6",       V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x2, "tdm", "spi-mosi", V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0x4, "audio", "mclk",   V(0, 0, 0, 1, 1, 0)),
                MPP_VAR_FUNCTION(0xb, "lcd", "d22",      V(0, 0, 0, 0, 1, 0))),

Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Kirkwood dts spi-gpio
  2016-03-09 14:30   ` Andrew Lunn
@ 2016-03-09 15:45     ` a.lombardinilo
  0 siblings, 0 replies; 4+ messages in thread
From: a.lombardinilo @ 2016-03-09 15:45 UTC (permalink / raw)
  To: linux-arm-kernel

I modified the dts as follows:

  ocp at f1000000 {
    pinctrl: pin-controller at 10000 {
      pmx_spi_gpio: pmx-spi-gpio {
        marvell,pins = "mpp39", "mpp40", "mpp41", "mpp42", "mpp43", "mpp44";
        marvell,function = "gpio";
      };
??? ??serial at 12000 {
??? ??  status = "okay";
??? ??};
  };

??spi_gpio {
????? #address-cells = <1>;
????? #size-cells = <1>;
????? pinctrl-0 = <&pmx_spi_gpio>;
????? pinctrl-names = "default";

????? compatible = "spi-gpio";
? ??? status = "okay";
? ??? gpio-sck = <&gpio1 8 GPIO_ACTIVE_LOW>;
? ??? gpio-miso = <&gpio1 9 GPIO_ACTIVE_LOW>;
? ??? gpio-mosi = <&gpio1 10 GPIO_ACTIVE_LOW>;
? ??? cs-gpios = <&gpio1 7 GPIO_ACTIVE_LOW>;
? ??? num-chipselects = <1>;

? ??? can0: can at 0 {
? ??? ??? compatible = "microchip,mcp2515";
? ??? ??? reg = <0>;
? ??? ??? interrupts = <&gpio1 11 GPIO_ACTIVE_LOW>;
? ??? ??? spi-max-frequency = <10000000>;
? ??? };
  };

and I see the following kernel messages:
root at gropius:/# dmesg | grep gpio
[    0.187002] gpiochip_add: registered GPIOs 0 to 31 on device: f1010100.gpio
[    0.187454] gpiochip_add: registered GPIOs 32 to 49 on device: f1010140.gpio
[    0.187815] of_get_named_gpiod_flags: can't parse 'reset-gpios' property of node '/mbus/pcie-controll'
[    1.046456] of_get_named_gpiod_flags: parsed 'gpio-sck' property of node '/spi_gpio[0]' - status (0)
[    1.046472] of_get_named_gpiod_flags: parsed 'gpio-miso' property of node '/spi_gpio[0]' - status (0)
[    1.046486] of_get_named_gpiod_flags: parsed 'gpio-mosi' property of node '/spi_gpio[0]' - status (0)
[    1.046545] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi_gpio[0]' - status (0)
[    1.046564] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi_gpio[0]' - status (0)
[    1.046651] spi_gpio spi_gpio: registered master spi32766 (dynamic)
[    1.072575] spi_gpio spi_gpio: registered child spi32766.0
root at gropius:/# 
root at gropius:/# 
root at gropius:/# dmesg | grep spi
[    1.046456] of_get_named_gpiod_flags: parsed 'gpio-sck' property of node '/spi_gpio[0]' - status (0)
[    1.046472] of_get_named_gpiod_flags: parsed 'gpio-miso' property of node '/spi_gpio[0]' - status (0)
[    1.046486] of_get_named_gpiod_flags: parsed 'gpio-mosi' property of node '/spi_gpio[0]' - status (0)
[    1.046545] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi_gpio[0]' - status (0)
[    1.046564] of_get_named_gpiod_flags: parsed 'cs-gpios' property of node '/spi_gpio[0]' - status (0)
[    1.046651] spi_gpio spi_gpio: registered master spi32766 (dynamic)
[    1.072461] spi spi32766.0: spi_bitbang_setup, 100 nsec/bit
[    1.072481] spi spi32766.0: setup mode 0, 8 bits/w, 10000000 Hz max --> 0
[    1.072575] spi_gpio spi_gpio: registered child spi32766.0
[    1.076614] mcp251x: probe of spi32766.0 failed with error -2
root at gropius:/# 
root at gropius:/# 
root at gropius:/# dmesg | grep mcp
[    1.076614] mcp251x: probe of spi32766.0 failed with error -2
root at gropius:/# 

I now understand why mcp2510 probe fail.
I try also to use the real spi

>40 is invalid. It should be in the range 0-31.
>?
>Try gpio-sck = <&gpio1 8 GPIO_ACTIVE_LOW>;
>?
>Also, why are you doing spi-gpio?
>?
>Looking at the pinctrl driver, these pins can be used by a real SPI core:
>?
>        MPP_MODE(39,
>                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
>                MPP_VAR_FUNCTION(0x1, "ts", "mp3",       V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x2, "tdm", "spi-cs0",  V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x4, "audio", "bclk",   V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0xb, "lcd", "d19",      V(0, 0, 0, 0, 1, 0))),
>        MPP_MODE(40,
>                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
>                MPP_VAR_FUNCTION(0x1, "ts", "mp4",       V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x2, "tdm", "spi-sck",  V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x4, "audio", "sdo",    V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0xb, "lcd", "d20",      V(0, 0, 0, 0, 1, 0))),
>        MPP_MODE(41,
>                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
>                MPP_VAR_FUNCTION(0x1, "ts", "mp5",       V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x2, "tdm", "spi-miso", V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x4, "audio", "lrclk",  V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0xb, "lcd", "d21",      V(0, 0, 0, 0, 1, 0))),
>        MPP_MODE(42,
>                MPP_VAR_FUNCTION(0x0, "gpio", NULL,      V(0, 0, 0, 1, 1, 1)),
>                MPP_VAR_FUNCTION(0x1, "ts", "mp6",       V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x2, "tdm", "spi-mosi", V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0x4, "audio", "mclk",   V(0, 0, 0, 1, 1, 0)),
>                MPP_VAR_FUNCTION(0xb, "lcd", "d22",      V(0, 0, 0, 0, 1, 0))),
>
>Andrew

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-03-09 15:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-09 10:05 Kirkwood dts spi-gpio a.lombardinilo
2016-03-09 13:12 ` a.lombardinilo
2016-03-09 14:30   ` Andrew Lunn
2016-03-09 15:45     ` a.lombardinilo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.