brcm63xx: backport and enable DT spi-gpio no CS support
authorJonas Gorski <jogo@openwrt.org>
Fri, 27 Feb 2015 23:48:48 +0000 (23:48 +0000)
committerJonas Gorski <jogo@openwrt.org>
Fri, 27 Feb 2015 23:48:48 +0000 (23:48 +0000)
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
SVN-Revision: 44570

target/linux/brcm63xx/config-3.14
target/linux/brcm63xx/config-3.18
target/linux/brcm63xx/dts/ct-6373.dts
target/linux/brcm63xx/dts/nb4-fxc-r1.dts
target/linux/brcm63xx/dts/nb4-ser-r0.dts
target/linux/brcm63xx/patches-3.14/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch [new file with mode: 0644]
target/linux/brcm63xx/patches-3.18/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch [new file with mode: 0644]

index 390d4ecc8b5ce598ca77504b2c1c5f4187461673..eaf9774a8f61476c97a21aac53e466307c0ff69f 100644 (file)
@@ -76,6 +76,7 @@ CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_74X164=y
 CONFIG_GPIO_BCM63XX=y
 CONFIG_GPIO_DEVRES=y
 CONFIG_GPIO_GENERIC=y
index 5087033cb11e83f6c1e1e0d8b2f83734ddb1a9cc..912dd7dd4bf1b16ea271219f8a6b7d907c544f38 100644 (file)
@@ -80,6 +80,7 @@ CONFIG_GENERIC_IRQ_SHOW=y
 CONFIG_GENERIC_PCI_IOMAP=y
 CONFIG_GENERIC_SMP_IDLE_THREAD=y
 CONFIG_GPIOLIB=y
+CONFIG_GPIO_74X164=y
 CONFIG_GPIO_BCM63XX=y
 CONFIG_GPIO_DEVRES=y
 CONFIG_GPIO_GENERIC=y
index 3a4079b9b665d307a72b2b7f3b0835607ce2a76f..b8be39dd15980d0e32287afd999e9c409cdf73bb 100644 (file)
@@ -5,7 +5,7 @@
 / {
        model = "Comtrend CT-6373";
        compatible = "comtrend,ct-6373", "brcm,bcm6358";
-/*
+
        spi-gpio {
                #address-cells = <1>;
                #size-cells = <1>;
@@ -25,7 +25,7 @@
                        #gpio-cells = <2>;
                };
        };
-*/
+
        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                #address-cells = <1>;
@@ -56,7 +56,6 @@
                        label = "CT6373-1:green:wlan";
                        gpios = <&gpio0 9 1>;
                };
-/*
                dsl_green {
                        label = "CT6373-1:green:adsl";
                        gpios = <&hc595 0 1>;
@@ -73,7 +72,6 @@
                        label = "CT6373-1:green:fxs2";
                        gpios = <&hc595 3 1>;
                };
-*/
        };
 };
 
index e984f53cccf68207c3c09980db342c8010ee8292..0e9cc24986643c4219a75f9eaa09df20e8bbdce4 100644 (file)
@@ -5,7 +5,7 @@
 / {
        model = "SFR Neuf Box 4 (Foxconn)";
        compatible = "sfr,nb4-fxc-r1", "brcm,bcm6358";
-/*
+
        spi-gpio {
                #address-cells = <1>;
                #size-cells = <1>;
@@ -25,7 +25,7 @@
                        #gpio-cells = <2>;
                };
        };
-*/
+
        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                #address-cells = <1>;
@@ -78,7 +78,6 @@
                        label = "NB4-FXC-r1:green:service";
                        gpios = <&gpio0 30 0>;
                };
-/*
                alarm_white {
                        label = "NB4-FXC-r1:white:alarm";
                        gpios = <&hc595 0 1>;
@@ -95,6 +94,5 @@
                        label = "NB4-FXC-r0:white:adsl";
                        gpios = <&hc595 4 1>;
                };
-*/
        };
 };
index 1bacaeb4d20ee3ff482b489ad144ff5a6c5d8d4a..d7abbf1ab8d86be68e2765729914e4a43419fadd 100644 (file)
@@ -5,7 +5,7 @@
 / {
        model = "SFR Neuf Box 4 (Sercomm)";
        compatible = "sfr,nb4-ser-r0", "brcm,bcm6358";
-/*
+
        spi-gpio {
                #address-cells = <1>;
                #size-cells = <1>;
@@ -25,7 +25,7 @@
                        #gpio-cells = <2>;
                };
        };
-*/
+
        gpio-keys-polled {
                compatible = "gpio-keys-polled";
                #address-cells = <1>;
@@ -78,7 +78,6 @@
                        label = "NB4-SER-r0:green:service";
                        gpios = <&gpio0 30 1>;
                };
-/*
                alarm_white {
                        label = "NB4-SER-r0:white:alarm";
                        gpios = <&hc595 0 1>;
@@ -95,6 +94,5 @@
                        label = "NB4-SER-r0:white:adsl";
                        gpios = <&hc595 4 1>;
                };
-*/
        };
 };
diff --git a/target/linux/brcm63xx/patches-3.14/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch b/target/linux/brcm63xx/patches-3.14/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch
new file mode 100644 (file)
index 0000000..d4a36e8
--- /dev/null
@@ -0,0 +1,91 @@
+From d1d81802522ade84128a2c66c0d500e372474dca Mon Sep 17 00:00:00 2001
+From: Torsten Fleischer <torfl6749@gmail.com>
+Date: Mon, 3 Nov 2014 17:17:55 +0100
+Subject: [PATCH] spi: spi-gpio: Add dt support for a single device with no
+ chip select
+
+In order to describe a single slave device that has no chip select line
+the 'num-chipselects' property has to be <0> and the 'cs-gpios' property
+doesn't need to be set.
+
+Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+---
+ Documentation/devicetree/bindings/spi/spi-gpio.txt |  6 ++++--
+ drivers/spi/spi-gpio.c                             | 21 +++++++++++++++------
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+--- a/Documentation/devicetree/bindings/spi/spi-gpio.txt
++++ b/Documentation/devicetree/bindings/spi/spi-gpio.txt
+@@ -8,8 +8,10 @@ Required properties:
+  - gpio-sck: GPIO spec for the SCK line to use
+  - gpio-miso: GPIO spec for the MISO line to use
+  - gpio-mosi: GPIO spec for the MOSI line to use
+- - cs-gpios: GPIOs to use for chipselect lines
+- - num-chipselects: number of chipselect lines
++ - cs-gpios: GPIOs to use for chipselect lines.
++             Not needed if num-chipselects = <0>.
++ - num-chipselects: Number of chipselect lines. Should be <0> if a single device
++                    with no chip select is connected.
+ Example:
+--- a/drivers/spi/spi-gpio.c
++++ b/drivers/spi/spi-gpio.c
+@@ -425,6 +425,7 @@ static int spi_gpio_probe(struct platfor
+       struct spi_gpio_platform_data   *pdata;
+       u16 master_flags = 0;
+       bool use_of = 0;
++      int num_devices;
+       status = spi_gpio_probe_dt(pdev);
+       if (status < 0)
+@@ -434,16 +435,21 @@ static int spi_gpio_probe(struct platfor
+       pdata = dev_get_platdata(&pdev->dev);
+ #ifdef GENERIC_BITBANG
+-      if (!pdata || !pdata->num_chipselect)
++      if (!pdata || (!use_of && !pdata->num_chipselect))
+               return -ENODEV;
+ #endif
++      if (use_of && !SPI_N_CHIPSEL)
++              num_devices = 1;
++      else
++              num_devices = SPI_N_CHIPSEL;
++
+       status = spi_gpio_request(pdata, dev_name(&pdev->dev), &master_flags);
+       if (status < 0)
+               return status;
+       master = spi_alloc_master(&pdev->dev, sizeof(*spi_gpio) +
+-                                      (sizeof(int) * SPI_N_CHIPSEL));
++                                      (sizeof(int) * num_devices));
+       if (!master) {
+               status = -ENOMEM;
+               goto gpio_free;
+@@ -458,7 +464,7 @@ static int spi_gpio_probe(struct platfor
+       master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
+       master->flags = master_flags;
+       master->bus_num = pdev->id;
+-      master->num_chipselect = SPI_N_CHIPSEL;
++      master->num_chipselect = num_devices;
+       master->setup = spi_gpio_setup;
+       master->cleanup = spi_gpio_cleanup;
+ #ifdef CONFIG_OF
+@@ -473,9 +479,12 @@ static int spi_gpio_probe(struct platfor
+                * property of the node.
+                */
+-              for (i = 0; i < SPI_N_CHIPSEL; i++)
+-                      spi_gpio->cs_gpios[i] =
+-                              of_get_named_gpio(np, "cs-gpios", i);
++              if (!SPI_N_CHIPSEL)
++                      spi_gpio->cs_gpios[0] = SPI_GPIO_NO_CHIPSELECT;
++              else
++                      for (i = 0; i < SPI_N_CHIPSEL; i++)
++                              spi_gpio->cs_gpios[i] =
++                                      of_get_named_gpio(np, "cs-gpios", i);
+       }
+ #endif
diff --git a/target/linux/brcm63xx/patches-3.18/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch b/target/linux/brcm63xx/patches-3.18/001-spi-spi-gpio-Add-dt-support-for-a-single-device-with.patch
new file mode 100644 (file)
index 0000000..437448f
--- /dev/null
@@ -0,0 +1,91 @@
+From d1d81802522ade84128a2c66c0d500e372474dca Mon Sep 17 00:00:00 2001
+From: Torsten Fleischer <torfl6749@gmail.com>
+Date: Mon, 3 Nov 2014 17:17:55 +0100
+Subject: [PATCH] spi: spi-gpio: Add dt support for a single device with no
+ chip select
+
+In order to describe a single slave device that has no chip select line
+the 'num-chipselects' property has to be <0> and the 'cs-gpios' property
+doesn't need to be set.
+
+Signed-off-by: Torsten Fleischer <torfl6749@gmail.com>
+Signed-off-by: Mark Brown <broonie@kernel.org>
+---
+ Documentation/devicetree/bindings/spi/spi-gpio.txt |  6 ++++--
+ drivers/spi/spi-gpio.c                             | 21 +++++++++++++++------
+ 2 files changed, 19 insertions(+), 8 deletions(-)
+
+--- a/Documentation/devicetree/bindings/spi/spi-gpio.txt
++++ b/Documentation/devicetree/bindings/spi/spi-gpio.txt
+@@ -8,8 +8,10 @@ Required properties:
+  - gpio-sck: GPIO spec for the SCK line to use
+  - gpio-miso: GPIO spec for the MISO line to use
+  - gpio-mosi: GPIO spec for the MOSI line to use
+- - cs-gpios: GPIOs to use for chipselect lines
+- - num-chipselects: number of chipselect lines
++ - cs-gpios: GPIOs to use for chipselect lines.
++             Not needed if num-chipselects = <0>.
++ - num-chipselects: Number of chipselect lines. Should be <0> if a single device
++                    with no chip select is connected.
+ Example:
+--- a/drivers/spi/spi-gpio.c
++++ b/drivers/spi/spi-gpio.c
+@@ -424,6 +424,7 @@ static int spi_gpio_probe(struct platfor
+       struct spi_gpio_platform_data   *pdata;
+       u16 master_flags = 0;
+       bool use_of = 0;
++      int num_devices;
+       status = spi_gpio_probe_dt(pdev);
+       if (status < 0)
+@@ -433,16 +434,21 @@ static int spi_gpio_probe(struct platfor
+       pdata = dev_get_platdata(&pdev->dev);
+ #ifdef GENERIC_BITBANG
+-      if (!pdata || !pdata->num_chipselect)
++      if (!pdata || (!use_of && !pdata->num_chipselect))
+               return -ENODEV;
+ #endif
++      if (use_of && !SPI_N_CHIPSEL)
++              num_devices = 1;
++      else
++              num_devices = SPI_N_CHIPSEL;
++
+       status = spi_gpio_request(pdata, dev_name(&pdev->dev), &master_flags);
+       if (status < 0)
+               return status;
+       master = spi_alloc_master(&pdev->dev, sizeof(*spi_gpio) +
+-                                      (sizeof(int) * SPI_N_CHIPSEL));
++                                      (sizeof(int) * num_devices));
+       if (!master) {
+               status = -ENOMEM;
+               goto gpio_free;
+@@ -457,7 +463,7 @@ static int spi_gpio_probe(struct platfor
+       master->bits_per_word_mask = SPI_BPW_RANGE_MASK(1, 32);
+       master->flags = master_flags;
+       master->bus_num = pdev->id;
+-      master->num_chipselect = SPI_N_CHIPSEL;
++      master->num_chipselect = num_devices;
+       master->setup = spi_gpio_setup;
+       master->cleanup = spi_gpio_cleanup;
+ #ifdef CONFIG_OF
+@@ -472,9 +478,12 @@ static int spi_gpio_probe(struct platfor
+                * property of the node.
+                */
+-              for (i = 0; i < SPI_N_CHIPSEL; i++)
+-                      spi_gpio->cs_gpios[i] =
+-                              of_get_named_gpio(np, "cs-gpios", i);
++              if (!SPI_N_CHIPSEL)
++                      spi_gpio->cs_gpios[0] = SPI_GPIO_NO_CHIPSELECT;
++              else
++                      for (i = 0; i < SPI_N_CHIPSEL; i++)
++                              spi_gpio->cs_gpios[i] =
++                                      of_get_named_gpio(np, "cs-gpios", i);
+       }
+ #endif