ARM: dts: gemini: add pin control set-up for the SoC
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 5 Jul 2017 14:59:33 +0000 (16:59 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 8 Aug 2017 12:20:00 +0000 (14:20 +0200)
This adds the basic pin control muliplexing settings for the
Gemini SoC: parallel (NOR) flash, SATA, optional IDE, PCI and
UART.

We also select the right GPIO groups on all applicable systems
so that GPIO keys/LEDs work smoothly.

We can then build upon this for more complex systems.

Acked-by: Hans Ulli Kroll <ulli.kroll@googlemail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/boot/dts/gemini-dlink-dir-685.dts
arch/arm/boot/dts/gemini-nas4220b.dts
arch/arm/boot/dts/gemini-rut1xx.dts
arch/arm/boot/dts/gemini-sq201.dts
arch/arm/boot/dts/gemini-wbd111.dts
arch/arm/boot/dts/gemini-wbd222.dts
arch/arm/boot/dts/gemini.dtsi

index 10ab4d878513e27e831722e81692c96bb50e0ae7..e75e2d44371cdd7bf719ab8ac2504717f1a742b3 100644 (file)
@@ -32,6 +32,7 @@
                        wakeup-source;
                        linux,code = <KEY_ESC>;
                        label = "reset";
+                       /* Collides with LPC_LAD[0], UART DCD, SSP 97RST */
                        gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
                };
                button-eject {
@@ -39,6 +40,7 @@
                        wakeup-source;
                        linux,code = <KEY_EJECTCD>;
                        label = "unmount";
+                       /* Collides with LPC LFRAME, UART RTS, SSP TXD */
                        gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
                };
        };
@@ -47,6 +49,7 @@
                compatible = "gpio-leds";
                led-wps {
                        label = "dir685:blue:WPS";
+                       /* Collides with ICE */
                        gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                 */
                led-blue-hd {
                        label = "dir685:blue:HD";
+                       /* Collides with LPC_SERIRQ, UART DTR, SSP FSC pins */
                        gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led-orange-hd {
                        label = "dir685:orange:HD";
+                       /* Collides with LPC_LAD[2], UART DSR, SSP ECLK pins */
                        gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
@@ -81,6 +86,7 @@
         */
        gpio-fan {
                compatible = "gpio-fan";
+               /* Collides with IDE */
                gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
                gpio-fan,speed-map = <0 0>, <10000 1>;
                #cooling-cells = <2>;
@@ -92,6 +98,7 @@
         */
        gpio-i2c {
                compatible = "i2c-gpio";
+               /* Collides with ICE */
                gpios = <&gpio0 5 0>, /* SDA */
                        <&gpio0 6 0>; /* SCL */
                #address-cells = <1>;
                        compatible = "dlink,dir685-touchkeys";
                        reg = <0x26>;
                        interrupt-parent = <&gpio0>;
+                       /* Collides with NAND flash */
                        interrupts = <17 IRQ_TYPE_EDGE_FALLING>;
                };
        };
                        };
                };
 
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio0bgrp cover line 5, 6 used by TK I2C
+                                * gpio0bgrp cover line 7 used by WPS LED
+                                * gpio0cgrp cover line 8, 13 used by keys
+                                *           and 11, 12 used by the HD LEDs
+                                * gpio0egrp cover line 16 used by VDISP
+                                * gpio0fgrp cover line 17 used by TK IRQ
+                                * gpio0ggrp cover line 20 used by panel CS
+                                * gpio0hgrp cover line 21,22 used by RTL8366RB
+                                */
+                               gpio0_default_pins: pinctrl-gpio0 {
+                                       mux {
+                                               function = "gpio0";
+                                               groups = "gpio0bgrp",
+                                               "gpio0cgrp",
+                                               "gpio0egrp",
+                                               "gpio0fgrp",
+                                               "gpio0ggrp",
+                                               "gpio0hgrp";
+                                       };
+                               };
+                               /*
+                                * gpio1bgrp cover line 5,8,7 used by panel SPI
+                                * also line 6 used by the fan
+                                *
+                                */
+                               gpio1_default_pins: pinctrl-gpio1 {
+                                       mux {
+                                               function = "gpio1";
+                                               groups = "gpio1bgrp";
+                                       };
+                               };
+                       };
+               };
+
                sata: sata@46000000 {
                        cortina,gemini-ata-muxmode = <0>;
                        cortina,gemini-enable-sata-bridge;
                        status = "okay";
                };
 
+               gpio0: gpio@4d000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio0_default_pins>;
+               };
+
+               gpio1: gpio@4e000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio1_default_pins>;
+               };
+
                pci@50000000 {
                        status = "okay";
                        interrupt-map-mask = <0xf800 0 0 7>;
index 55f6a4f1f8016754274af65ed6895b7e8ab47a3f..b4fc58c8cf8d7b855a5a686beb2dfedede1add50 100644 (file)
@@ -33,6 +33,7 @@
                        wakeup-source;
                        linux,code = <KEY_SETUP>;
                        label = "Backup button";
+                       /* Conflict with TVC */
                        gpios = <&gpio1 29 GPIO_ACTIVE_LOW>;
                };
                button@31 {
@@ -40,6 +41,7 @@
                        wakeup-source;
                        linux,code = <KEY_RESTART>;
                        label = "Softreset button";
+                       /* Conflict with TVC */
                        gpios = <&gpio1 31 GPIO_ACTIVE_LOW>;
                };
        };
                compatible = "gpio-leds";
                led@28 {
                        label = "nas4220b:orange:hdd";
+                       /* Conflict with TVC */
                        gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                };
                led@30 {
                        label = "nas4220b:green:os";
+                       /* Conflict with TVC */
                        gpios = <&gpio1 30 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                        };
                };
 
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio1dgrp cover line 28-31 otherwise used
+                                * by TVC.
+                                */
+                               gpio1_default_pins: pinctrl-gpio1 {
+                                       mux {
+                                               function = "gpio1";
+                                               groups = "gpio1dgrp";
+                                       };
+                               };
+                       };
+               };
+
                sata: sata@46000000 {
                        cortina,gemini-ata-muxmode = <0>;
                        cortina,gemini-enable-sata-bridge;
                        status = "okay";
                };
 
+               gpio1: gpio@4e000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio1_default_pins>;
+               };
+
                ata@63000000 {
                        status = "okay";
                };
index 7b920bfbda32cfcf01b63e022c8787cff60cdcba..3613b264f45faff79459cb5d9daf76f158406e08 100644 (file)
@@ -33,6 +33,7 @@
                        wakeup-source;
                        linux,code = <KEY_SETUP>;
                        label = "Reset to defaults";
+                       /* Conflict with TVC */
                        gpios = <&gpio1 28 GPIO_ACTIVE_LOW>;
                };
        };
                led@7 {
                        /* FIXME: add the LED color */
                        label = "rut1xx::gsm";
+                       /* Conflict with ICE */
                        gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                };
                led@31 {
                        /* FIXME: add the LED color */
                        label = "rut1xx::power";
+                       /* Conflict with NAND CE0 */
                        gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                        linux,default-trigger = "heartbeat";
                        reg = <0x30000000 0x00800000>;
                        /* TODO: add flash partitions here */
                };
+
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio0bgrp cover line 7 used by GSM LED
+                                * gpio0fgrp cover line 17 used by power LED
+                                */
+                               gpio0_default_pins: pinctrl-gpio0 {
+                                       mux {
+                                               function = "gpio0";
+                                               groups = "gpio0bgrp",
+                                               "gpio0fgrp";
+                                       };
+                               };
+                               /*
+                                * gpio1dgrp cover line 28-31 otherwise used
+                                * by TVC.
+                                */
+                               gpio1_default_pins: pinctrl-gpio1 {
+                                       mux {
+                                               function = "gpio1";
+                                               groups = "gpio1dgrp";
+                                       };
+                               };
+                       };
+               };
+
+               gpio0: gpio@4d000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio0_default_pins>;
+               };
+
+               gpio1: gpio@4e000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio1_default_pins>;
+               };
        };
 };
index 4d200f0bcd451ac780b23ec1f181c056befcc057..7cfa9caf47d4e642031a2315bd41f743ace7a75b 100644 (file)
@@ -33,6 +33,7 @@
                        wakeup-source;
                        linux,code = <KEY_SETUP>;
                        label = "factory reset";
+                       /* Conflict with NAND flash */
                        gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
                };
        };
                compatible = "gpio-leds";
                led@20 {
                        label = "sq201:green:info";
+                       /* Conflict with parallel flash */
                        gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                };
                led@31 {
                        label = "sq201:green:usb";
+                       /* Conflict with parallel and NAND flash */
                        gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                        linux,default-trigger = "usb-host";
 
        soc {
                flash@30000000 {
-                       status = "okay";
+                       /*
+                        * Flash access can be enabled, with the side effect
+                        * of disabling access to GPIO LED on GPIO0[20] which
+                        * reuse one of the parallel flash chip select lines.
+                        * Also the default firmware on the machine has the
+                        * problem that since it uses the flash, the two LEDS
+                        * on the right become numb.
+                        */
+                       /* status = "okay"; */
                        /* 16MB of flash */
                        reg = <0x30000000 0x01000000>;
 
                        };
                };
 
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio0fgrp cover line 18 used by reset button
+                                * gpio0ggrp cover line 20 used by info LED
+                                * gpio0kgrp cover line 31 used by USB LED
+                                */
+                               gpio0_default_pins: pinctrl-gpio0 {
+                                       mux {
+                                               function = "gpio0";
+                                               groups = "gpio0fgrp",
+                                               "gpio0ggrp",
+                                               "gpio0kgrp";
+                                       };
+                               };
+                       };
+               };
+
                sata: sata@46000000 {
                        cortina,gemini-ata-muxmode = <0>;
                        cortina,gemini-enable-sata-bridge;
                        status = "okay";
                };
 
+               gpio0: gpio@4d000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio0_default_pins>;
+               };
+
                pci@50000000 {
                        status = "okay";
                        interrupt-map-mask = <0xf800 0 0 7>;
index 63b756e3bf5a2fcdd42eb8a3fe6760e36878be85..38a49e7504785077bd809a078d082fd51a2f4dbf 100644 (file)
@@ -33,6 +33,7 @@
                        wakeup-source;
                        linux,code = <KEY_SETUP>;
                        label = "reset";
+                       /* Conflict with ICE */
                        gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
                };
        };
 
                led@1 {
                        label = "wbd111:red:L3";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@2 {
                        label = "wbd111:green:L4";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@3 {
                        label = "wbd111:red:L4";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@5 {
                        label = "wbd111:green:L3";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                                read-only;
                        };
                };
+
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio0agrp cover line 0-4
+                                * gpio0bgrp cover line 5
+                                */
+                               gpio0_default_pins: pinctrl-gpio0 {
+                                       mux {
+                                               function = "gpio0";
+                                               groups = "gpio0agrp",
+                                               "gpio0bgrp";
+                                       };
+                               };
+                       };
+               };
+
+               gpio0: gpio@4d000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio0_default_pins>;
+               };
        };
 };
index 9747f5a47807b4679f7cdd8476c9da58c5b78b9c..f77e34e0df0bcdead3b341dd1e155deaee10b37b 100644 (file)
@@ -33,6 +33,7 @@
                        wakeup-source;
                        linux,code = <KEY_SETUP>;
                        label = "reset";
+                       /* Conflict with ICE */
                        gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
                };
        };
 
                led@1 {
                        label = "wbd111:red:L3";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@2 {
                        label = "wbd111:green:L4";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@3 {
                        label = "wbd111:red:L4";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
                        default-state = "off";
                };
                led@5 {
                        label = "wbd111:green:L3";
+                       /* Conflict with TVC and extended parallel flash */
                        gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
                        default-state = "on";
                        linux,default-trigger = "heartbeat";
                                read-only;
                        };
                };
+
+               syscon: syscon@40000000 {
+                       pinctrl {
+                               /*
+                                * gpio0agrp cover line 0-4
+                                * gpio0bgrp cover line 5
+                                */
+                               gpio0_default_pins: pinctrl-gpio0 {
+                                       mux {
+                                               function = "gpio0";
+                                               groups = "gpio0agrp",
+                                               "gpio0bgrp";
+                                       };
+                               };
+                       };
+               };
+
+               gpio0: gpio@4d000000 {
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&gpio0_default_pins>;
+               };
        };
 };
index 49cce9e9d51feab617639f81cc86db7846de48d1..c68e8d430234c3824198d46b336f0d689cf38611 100644 (file)
@@ -20,6 +20,8 @@
                flash@30000000 {
                        compatible = "cortina,gemini-flash", "cfi-flash";
                        syscon = <&syscon>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pflash_default_pins>;
                        bank-width = <2>;
                        #address-cells = <1>;
                        #size-cells = <1>;
                                /* RESET_GLOBAL | RESET_CPU1 */
                                mask = <0xC0000000>;
                        };
+
+                       pinctrl {
+                               compatible = "cortina,gemini-pinctrl";
+                               regmap = <&syscon>;
+                               /* Hog the DRAM pins */
+                               pinctrl-names = "default";
+                               pinctrl-0 = <&dram_default_pins>, <&system_default_pins>,
+                                           <&vcontrol_default_pins>;
+
+                               dram_default_pins: pinctrl-dram {
+                                       mux {
+                                               function = "dram";
+                                               groups = "dramgrp";
+                                       };
+                               };
+                               rtc_default_pins: pinctrl-rtc {
+                                       mux {
+                                               function = "rtc";
+                                               groups = "rtcgrp";
+                                       };
+                               };
+                               power_default_pins: pinctrl-power {
+                                       mux {
+                                               function = "power";
+                                               groups = "powergrp";
+                                       };
+                               };
+                               cir_default_pins: pinctrl-cir {
+                                       mux {
+                                               function = "cir";
+                                               groups = "cirgrp";
+                                       };
+                               };
+                               system_default_pins: pinctrl-system {
+                                       mux {
+                                               function = "system";
+                                               groups = "systemgrp";
+                                       };
+                               };
+                               vcontrol_default_pins: pinctrl-vcontrol {
+                                       mux {
+                                               function = "vcontrol";
+                                               groups = "vcontrolgrp";
+                                       };
+                               };
+                               ice_default_pins: pinctrl-ice {
+                                       mux {
+                                               function = "ice";
+                                               groups = "icegrp";
+                                       };
+                               };
+                               uart_default_pins: pinctrl-uart {
+                                       mux {
+                                               function = "uart";
+                                               groups = "uartrxtxgrp";
+                                       };
+                               };
+                               pflash_default_pins: pinctrl-pflash {
+                                       mux {
+                                               function = "pflash";
+                                               groups = "pflashgrp";
+                                       };
+                               };
+                               usb_default_pins: pinctrl-usb {
+                                       mux {
+                                               function = "usb";
+                                               groups = "usbgrp";
+                                       };
+                               };
+                               gmii_default_pins: pinctrl-gmii {
+                                       mux {
+                                               function = "gmii";
+                                               groups = "gmiigrp";
+                                       };
+                               };
+                               pci_default_pins: pinctrl-pci {
+                                       mux {
+                                               function = "pci";
+                                               groups = "pcigrp";
+                                       };
+                               };
+                               sata_default_pins: pinctrl-sata {
+                                       mux {
+                                               function = "sata";
+                                               groups = "satagrp";
+                                       };
+                               };
+                               /* Activate both groups of pins for this state */
+                               sata_and_ide_pins: pinctrl-sata-ide {
+                                       mux0 {
+                                               function = "sata";
+                                               groups = "satagrp";
+                                       };
+                                       mux1 {
+                                               function = "ide";
+                                               groups = "idegrp";
+                                       };
+                               };
+                       };
                };
 
                watchdog@41000000 {
                        resets = <&syscon GEMINI_RESET_UART>;
                        clocks = <&syscon GEMINI_CLK_UART>;
                        interrupts = <18 IRQ_TYPE_LEVEL_HIGH>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&uart_default_pins>;
                        reg-shift = <2>;
                };
 
                        resets = <&syscon GEMINI_RESET_RTC>;
                        clocks = <&syscon GEMINI_CLK_APB>, <&syscon GEMINI_CLK_RTC>;
                        clock-names = "PCLK", "EXTCLK";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&rtc_default_pins>;
                };
 
                sata: sata@46000000 {
                        clocks = <&syscon GEMINI_CLK_GATE_SATA0>,
                                 <&syscon GEMINI_CLK_GATE_SATA1>;
                        clock-names = "SATA0_PCLK", "SATA1_PCLK";
+                       /*
+                        * This defines the special "ide" state that needs
+                        * to be explicitly enabled to enable the IDE pins,
+                        * as these pins are normally used for other things.
+                        */
+                       pinctrl-names = "default", "ide";
+                       pinctrl-0 = <&sata_default_pins>;
+                       pinctrl-1 = <&sata_and_ide_pins>;
                        syscon = <&syscon>;
                        status = "disabled";
                };
                        compatible = "cortina,gemini-power-controller";
                        reg = <0x4b000000 0x100>;
                        interrupts = <26 IRQ_TYPE_EDGE_RISING>;
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&power_default_pins>;
                };
 
                gpio0: gpio@4d000000 {
                        resets = <&syscon GEMINI_RESET_PCI>;
                        clocks = <&syscon GEMINI_CLK_GATE_PCI>, <&syscon GEMINI_CLK_PCI>;
                        clock-names = "PCLK", "PCICLK";
+                       pinctrl-names = "default";
+                       pinctrl-0 = <&pci_default_pins>;
                        #address-cells = <3>;
                        #size-cells = <2>;
                        #interrupt-cells = <1>;