Merge tag 'intel-pinctrl-v5.18-1' of gitolite.kernel.org:pub/scm/linux/kernel/git...
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 28 Feb 2022 22:55:50 +0000 (23:55 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 28 Feb 2022 22:55:50 +0000 (23:55 +0100)
intel-pinctrl for v5.18-1

* Introduce support for Alder Lake-N (required to revert misplaced ID)
* Add support for Raptor Lake-S
* Add support for Ice Lake-N (MacBookPro16,2)
* Miscellaneous fixes

The following is an automated git shortlog grouped by driver:

alderlake:
 -  Add Intel Alder Lake-N pin controller support
 -  Add Raptor Lake-S ACPI ID

baytrail:
 -  Clear direct_irq_en flag on broken configs

icelake:
 -  Add Ice Lake-N PCH pin controller support

intel:
 -  Fix a glitch when updating IRQ flags on a preconfigured line
 -  fix unexpected interrupt

Place correctly CONFIG_PINCTRL_ST in the Makefile:
 - Place correctly CONFIG_PINCTRL_ST in the Makefile

tigerlake:
 -  Revert "Add Alder Lake-M ACPI ID"

85 files changed:
Documentation/devicetree/bindings/pinctrl/brcm,bcm11351-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/pinctrl/meson,pinctrl.txt
Documentation/devicetree/bindings/pinctrl/microchip,sparx5-sgpio.yaml
Documentation/devicetree/bindings/pinctrl/mscc,ocelot-pinctrl.txt
Documentation/devicetree/bindings/pinctrl/pinctrl-mt8195.yaml
Documentation/devicetree/bindings/pinctrl/qcom,msm8953-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/qcom,pmic-mpp.yaml
Documentation/devicetree/bindings/pinctrl/qcom,tlmm-common.yaml
Documentation/devicetree/bindings/pinctrl/renesas,pfc.yaml
Documentation/devicetree/bindings/pinctrl/renesas,rzg2l-pinctrl.yaml
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-gpio-bank.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-pins-cfg.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml [new file with mode: 0644]
Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt [deleted file]
Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml [new file with mode: 0644]
MAINTAINERS
drivers/pinctrl/Kconfig
drivers/pinctrl/Makefile
drivers/pinctrl/bcm/Kconfig
drivers/pinctrl/bcm/Makefile
drivers/pinctrl/bcm/pinctrl-bcm4908.c [new file with mode: 0644]
drivers/pinctrl/meson/Kconfig
drivers/pinctrl/meson/Makefile
drivers/pinctrl/meson/pinctrl-meson-g12a.c
drivers/pinctrl/meson/pinctrl-meson-s4.c [new file with mode: 0644]
drivers/pinctrl/nuvoton/pinctrl-npcm7xx.c
drivers/pinctrl/pinctrl-at91-pio4.c
drivers/pinctrl/pinctrl-ocelot.c
drivers/pinctrl/pinctrl-starfive.c
drivers/pinctrl/pxa/pinctrl-pxa27x.c
drivers/pinctrl/qcom/pinctrl-msm.c
drivers/pinctrl/qcom/pinctrl-qcm2290.c
drivers/pinctrl/qcom/pinctrl-sm8450.c
drivers/pinctrl/qcom/pinctrl-spmi-mpp.c
drivers/pinctrl/renesas/Kconfig
drivers/pinctrl/renesas/Makefile
drivers/pinctrl/renesas/core.c
drivers/pinctrl/renesas/pfc-emev2.c
drivers/pinctrl/renesas/pfc-r8a73a4.c
drivers/pinctrl/renesas/pfc-r8a7740.c
drivers/pinctrl/renesas/pfc-r8a77470.c
drivers/pinctrl/renesas/pfc-r8a7778.c
drivers/pinctrl/renesas/pfc-r8a7779.c
drivers/pinctrl/renesas/pfc-r8a7790.c
drivers/pinctrl/renesas/pfc-r8a7791.c
drivers/pinctrl/renesas/pfc-r8a7792.c
drivers/pinctrl/renesas/pfc-r8a7794.c
drivers/pinctrl/renesas/pfc-r8a77950.c
drivers/pinctrl/renesas/pfc-r8a77951.c
drivers/pinctrl/renesas/pfc-r8a7796.c
drivers/pinctrl/renesas/pfc-r8a77965.c
drivers/pinctrl/renesas/pfc-r8a77970.c
drivers/pinctrl/renesas/pfc-r8a77980.c
drivers/pinctrl/renesas/pfc-r8a77990.c
drivers/pinctrl/renesas/pfc-r8a77995.c
drivers/pinctrl/renesas/pfc-r8a779a0.c
drivers/pinctrl/renesas/pfc-r8a779f0.c [new file with mode: 0644]
drivers/pinctrl/renesas/pfc-sh7203.c
drivers/pinctrl/renesas/pfc-sh7264.c
drivers/pinctrl/renesas/pfc-sh7269.c
drivers/pinctrl/renesas/pfc-sh73a0.c
drivers/pinctrl/renesas/pfc-sh7720.c
drivers/pinctrl/renesas/pfc-sh7722.c
drivers/pinctrl/renesas/pinctrl-rzg2l.c
drivers/pinctrl/renesas/pinctrl.c
drivers/pinctrl/renesas/sh_pfc.h
drivers/pinctrl/samsung/pinctrl-exynos-arm64.c
drivers/pinctrl/samsung/pinctrl-exynos.c
drivers/pinctrl/samsung/pinctrl-samsung.c
drivers/pinctrl/samsung/pinctrl-samsung.h
drivers/pinctrl/sunplus/Kconfig [new file with mode: 0644]
drivers/pinctrl/sunplus/Makefile [new file with mode: 0644]
drivers/pinctrl/sunplus/sppctl.c [new file with mode: 0644]
drivers/pinctrl/sunplus/sppctl.h [new file with mode: 0644]
drivers/pinctrl/sunplus/sppctl_sp7021.c [new file with mode: 0644]
drivers/pinctrl/sunxi/pinctrl-sunxi.c
drivers/pinctrl/uniphier/pinctrl-uniphier-ld11.c
drivers/pinctrl/uniphier/pinctrl-uniphier-ld20.c
drivers/pinctrl/uniphier/pinctrl-uniphier-pxs2.c
drivers/pinctrl/uniphier/pinctrl-uniphier-pxs3.c
include/dt-bindings/gpio/meson-s4-gpio.h [new file with mode: 0644]
include/dt-bindings/pinctrl/sppctl-sp7021.h [new file with mode: 0644]
include/dt-bindings/pinctrl/sppctl.h [new file with mode: 0644]

index 4eaae32..e047a19 100644 (file)
@@ -85,7 +85,7 @@ Optional Properties (for I2C pins):
 - function:                    String. Specifies the pin mux selection. Values
                                must be one of: "alt1", "alt2", "alt3", "alt4"
 - bias-pull-up:                        Integer. Pull up strength in Ohm. There are 3
-                               pull-up resisitors (1.2k, 1.8k, 2.7k) available
+                               pull-up resistors (1.2k, 1.8k, 2.7k) available
                                in parallel for I2C pins, so the valid values
                                are: 568, 720, 831, 1080, 1200, 1800, 2700 Ohm.
 - bias-disable:                        No arguments. Disable pin bias.
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml
new file mode 100644 (file)
index 0000000..175a992
--- /dev/null
@@ -0,0 +1,72 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/brcm,bcm4908-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Broadcom BCM4908 pin controller
+
+maintainers:
+  - RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
+
+description:
+  Binding for pin controller present on BCM4908 family SoCs.
+
+properties:
+  compatible:
+    const: brcm,bcm4908-pinctrl
+
+  reg:
+    maxItems: 1
+
+patternProperties:
+  '-pins$':
+    type: object
+    $ref: pinmux-node.yaml#
+
+    properties:
+      function:
+        enum: [ led_0, led_1, led_2, led_3, led_4, led_5, led_6, led_7, led_8,
+                led_9, led_10, led_11, led_12, led_13, led_14, led_15, led_16,
+                led_17, led_18, led_19, led_20, led_21, led_22, led_23, led_24,
+                led_25, led_26, led_27, led_28, led_29, led_30, led_31,
+                hs_uart, i2c, i2s, nand_ctrl, nand_data, emmc_ctrl, usb0_pwr,
+                usb1_pwr ]
+
+      groups:
+        minItems: 1
+        maxItems: 2
+        items:
+          enum: [ led_0_grp_a, led_1_grp_a, led_2_grp_a, led_3_grp_a,
+                  led_4_grp_a, led_5_grp_a, led_6_grp_a, led_7_grp_a,
+                  led_8_grp_a, led_9_grp_a, led_10_grp_a, led_10_grp_b,
+                  led_11_grp_a, led_11_grp_b, led_12_grp_a, led_12_grp_b,
+                  led_13_grp_a, led_13_grp_b, led_14_grp_a, led_15_grp_a,
+                  led_16_grp_a, led_17_grp_a, led_18_grp_a, led_19_grp_a,
+                  led_20_grp_a, led_21_grp_a, led_22_grp_a, led_23_grp_a,
+                  led_24_grp_a, led_25_grp_a, led_26_grp_a, led_27_grp_a,
+                  led_28_grp_a, led_29_grp_a, led_30_grp_a, led_31_grp_a,
+                  led_31_grp_b, hs_uart_grp, i2c_grp_a, i2c_grp_b, i2s_grp,
+                  nand_ctrl_grp, nand_data_grp, emmc_ctrl_grp, usb0_pwr_grp,
+                  usb1_pwr_grp ]
+
+allOf:
+  - $ref: pinctrl.yaml#
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    pinctrl@ff800560 {
+        compatible = "brcm,bcm4908-pinctrl";
+        reg = <0xff800560 0x10>;
+
+        led_0-a-pins {
+            function = "led_0";
+            groups = "led_0_grp_a";
+        };
+    };
index 0aff1f2..8146193 100644 (file)
@@ -16,6 +16,7 @@ Required properties for the root node:
                      "amlogic,meson-g12a-periphs-pinctrl"
                      "amlogic,meson-g12a-aobus-pinctrl"
                      "amlogic,meson-a1-periphs-pinctrl"
+                     "amlogic,meson-s4-periphs-pinctrl"
  - reg: address and size of registers controlling irq functionality
 
 === GPIO sub-nodes ===
index cb55408..0df4e11 100644 (file)
@@ -145,7 +145,7 @@ examples:
       clocks = <&sys_clk>;
       pinctrl-0 = <&sgpio2_pins>;
       pinctrl-names = "default";
-      reg = <0x1101059c 0x100>;
+      reg = <0x1101059c 0x118>;
       microchip,sgpio-port-ranges = <0 0>, <16 18>, <28 31>;
       bus-frequency = <25000000>;
       sgpio_in2: gpio@0 {
index 3bb7648..5d84fd2 100644 (file)
@@ -4,8 +4,8 @@ Microsemi Ocelot pin controller Device Tree Bindings
 Required properties:
  - compatible          : Should be "mscc,ocelot-pinctrl",
                          "mscc,jaguar2-pinctrl", "microchip,sparx5-pinctrl",
-                         "mscc,luton-pinctrl", "mscc,serval-pinctrl" or
-                         "microchip,lan966x-pinctrl"
+                         "mscc,luton-pinctrl", "mscc,serval-pinctrl",
+                         "microchip,lan966x-pinctrl" or "mscc,servalt-pinctrl"
  - reg                 : Address and length of the register set for the device
  - gpio-controller     : Indicates this device is a GPIO controller
  - #gpio-cells         : Must be 2.
index 328ea59..8299662 100644 (file)
@@ -99,6 +99,14 @@ patternProperties:
             enum: [2, 4, 6, 8, 10, 12, 14, 16]
 
           bias-pull-down:
+            oneOf:
+              - type: boolean
+              - enum: [100, 101, 102, 103]
+                description: mt8195 pull down PUPD/R0/R1 type define value.
+              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
+                description: mt8195 pull down RSEL type define value.
+              - enum: [75000, 5000]
+                description: mt8195 pull down RSEL type si unit value(ohm).
             description: |
               For pull down type is normal, it don't need add RSEL & R1R0 define
               and resistance value.
@@ -115,13 +123,6 @@ patternProperties:
               & "MTK_PULL_SET_RSEL_110" & "MTK_PULL_SET_RSEL_111"
               define in mt8195. It can also support resistance value(ohm)
               "75000" & "5000" in mt8195.
-              oneOf:
-                - enum: [100, 101, 102, 103]
-                - description: mt8195 pull down PUPD/R0/R1 type define value.
-                - enum: [200, 201, 202, 203, 204, 205, 206, 207]
-                - description: mt8195 pull down RSEL type define value.
-                - enum: [75000, 5000]
-                - description: mt8195 pull down RSEL type si unit value(ohm).
 
               An example of using RSEL define:
               pincontroller {
@@ -146,6 +147,14 @@ patternProperties:
               };
 
           bias-pull-up:
+            oneOf:
+              - type: boolean
+              - enum: [100, 101, 102, 103]
+                description: mt8195 pull up PUPD/R0/R1 type define value.
+              - enum: [200, 201, 202, 203, 204, 205, 206, 207]
+                description: mt8195 pull up RSEL type define value.
+              - enum: [1000, 1500, 2000, 3000, 4000, 5000, 10000, 75000]
+                description: mt8195 pull up RSEL type si unit value(ohm).
             description: |
               For pull up type is normal, it don't need add RSEL & R1R0 define
               and resistance value.
@@ -163,13 +172,6 @@ patternProperties:
               define in mt8195. It can also support resistance value(ohm)
               "1000" & "1500" & "2000" & "3000" & "4000" & "5000" & "10000" &
               "75000" in mt8195.
-              oneOf:
-                - enum: [100, 101, 102, 103]
-                - description: mt8195 pull up PUPD/R0/R1 type define value.
-                - enum: [200, 201, 202, 203, 204, 205, 206, 207]
-                - description: mt8195 pull up RSEL type define value.
-                - enum: [1000, 1500, 2000, 3000, 4000, 5000, 10000, 75000]
-                - description: mt8195 pull up RSEL type si unit value(ohm).
               An example of using RSEL define:
               pincontroller {
                 i2c0-pins {
index 64c0a41..d4da558 100644 (file)
@@ -34,6 +34,8 @@ properties:
 
   gpio-controller: true
 
+  gpio-reserved-ranges: true
+
   '#gpio-cells':
     description: Specifying the pin number and flags, as defined in
       include/dt-bindings/gpio/gpio.h
index 35c846f..df79274 100644 (file)
@@ -21,6 +21,7 @@ properties:
           - qcom,pm8019-mpp
           - qcom,pm8038-mpp
           - qcom,pm8058-mpp
+          - qcom,pm8226-mpp
           - qcom,pm8821-mpp
           - qcom,pm8841-mpp
           - qcom,pm8916-mpp
index be8cb0e..780f15b 100644 (file)
@@ -73,7 +73,6 @@ $defs:
     properties:
       drive-strength:
         enum: [2, 4, 6, 8, 10, 12, 14, 16]
-        default: 2
         description:
           Selects the drive strength for the specified pins, in mA.
 
index 8548e36..2a57df7 100644 (file)
@@ -44,6 +44,7 @@ properties:
       - renesas,pfc-r8a77990    # R-Car E3
       - renesas,pfc-r8a77995    # R-Car D3
       - renesas,pfc-r8a779a0    # R-Car V3U
+      - renesas,pfc-r8a779f0    # R-Car S4-8
       - renesas,pfc-sh73a0      # SH-Mobile AG5
 
   reg:
index b749c82..9ccf548 100644 (file)
@@ -4,14 +4,14 @@
 $id: http://devicetree.org/schemas/pinctrl/renesas,rzg2l-pinctrl.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Renesas RZ/G2L combined Pin and GPIO controller
+title: Renesas RZ/{G2L,V2L} combined Pin and GPIO controller
 
 maintainers:
   - Geert Uytterhoeven <geert+renesas@glider.be>
   - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
 
 description:
-  The Renesas SoCs of the RZ/G2L series feature a combined Pin and GPIO
+  The Renesas SoCs of the RZ/{G2L,V2L} series feature a combined Pin and GPIO
   controller.
   Pin multiplexing and GPIO configuration is performed on a per-pin basis.
   Each port features up to 8 pins, each of them configurable for GPIO function
@@ -20,8 +20,15 @@ description:
 
 properties:
   compatible:
-    enum:
-      - renesas,r9a07g044-pinctrl # RZ/G2{L,LC}
+    oneOf:
+      - items:
+          - enum:
+              - renesas,r9a07g044-pinctrl # RZ/G2{L,LC}
+
+      - items:
+          - enum:
+              - renesas,r9a07g054-pinctrl     # RZ/V2L
+          - const: renesas,r9a07g044-pinctrl  # RZ/G2{L,LC} fallback for RZ/V2L
 
   reg:
     maxItems: 1
@@ -76,6 +83,7 @@ additionalProperties:
         output-impedance-ohms:
           enum: [ 33, 50, 66, 100 ]
         power-source:
+          description: I/O voltage in millivolt.
           enum: [ 1800, 2500, 3300 ]
         slew-rate: true
         gpio-hog: true
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-gpio-bank.yaml b/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-gpio-bank.yaml
new file mode 100644 (file)
index 0000000..f73348c
--- /dev/null
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/samsung,pinctrl-gpio-bank.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S3C/S5P/Exynos SoC pin controller - gpio bank
+
+maintainers:
+  - Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+  - Sylwester Nawrocki <s.nawrocki@samsung.com>
+  - Tomasz Figa <tomasz.figa@gmail.com>
+
+description: |
+  This is a part of device tree bindings for Samsung S3C/S5P/Exynos SoC pin
+  controller.
+
+  GPIO bank description for Samsung S3C/S5P/Exynos SoC pin controller.
+
+  See also Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml for
+  additional information and example.
+
+properties:
+  '#gpio-cells':
+    const: 2
+
+  gpio-controller: true
+
+  '#interrupt-cells':
+    description:
+      For GPIO banks supporting external GPIO interrupts or external wake-up
+      interrupts.
+    const: 2
+
+  interrupt-controller:
+    description:
+      For GPIO banks supporting external GPIO interrupts or external wake-up
+      interrupts.
+
+  interrupts:
+    description:
+      For GPIO banks supporting direct external wake-up interrupts (without
+      multiplexing).  Number of interrupts must match number of wake-up capable
+      pins of this bank.
+    minItems: 1
+    maxItems: 8
+
+required:
+  - '#gpio-cells'
+  - gpio-controller
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-pins-cfg.yaml b/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-pins-cfg.yaml
new file mode 100644 (file)
index 0000000..c71939a
--- /dev/null
@@ -0,0 +1,81 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/samsung,pinctrl-pins-cfg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S3C/S5P/Exynos SoC pin controller - pins configuration
+
+maintainers:
+  - Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+  - Sylwester Nawrocki <s.nawrocki@samsung.com>
+  - Tomasz Figa <tomasz.figa@gmail.com>
+
+description: |
+  This is a part of device tree bindings for Samsung S3C/S5P/Exynos SoC pin
+  controller.
+
+  Pins configuration for Samsung S3C/S5P/Exynos SoC pin controller.
+
+  The values used for config properties should be derived from the hardware
+  manual and these values are programmed as-is into the pin pull up/down and
+  driver strength register of the pin-controller.
+  See also include/dt-bindings/pinctrl/samsung.h with useful constants.
+
+  See also Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml for
+  additional information and example.
+
+properties:
+  samsung,pins:
+    description: |
+      List of pins to configure. For initial and sleep states, the maximum
+      number is one pin. In other cases there is no upper limit.
+
+      The pins should use lowercase names matching hardware manual, e.g. for
+      GPA0 bank: gpa0-0, gpa0-1, gpa0-2.
+    $ref: /schemas/types.yaml#/definitions/string-array
+
+  samsung,pin-function:
+    description: |
+      The pin function selection that should be applied on the pins listed in the
+      child node is specified using the "samsung,pin-function" property. The value
+      of this property that should be applied to each of the pins listed in the
+      "samsung,pins" property should be picked from the hardware manual of the SoC
+      for the specified pin group. This property is optional in the child node if
+      no specific function selection is desired for the pins listed in the child
+      node. The value of this property is used as-is to program the pin-controller
+      function selector register of the pin-bank.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 15
+
+  samsung,pin-drv:
+    description: Drive strength configuration.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 15
+
+  samsung,pin-pud:
+    description: Pull up/down configuration.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3]
+
+  samsung,pin-val:
+    description: Initial value of pin output buffer.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1]
+
+  samsung,pin-con-pdn:
+    description: Function in power down mode.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3]
+
+  samsung,pin-pud-pdn:
+    description: Pull up/down configuration in power down mode.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1, 2, 3]
+
+required:
+  - samsung,pins
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml b/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml
new file mode 100644 (file)
index 0000000..a822f70
--- /dev/null
@@ -0,0 +1,106 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/samsung,pinctrl-wakeup-interrupt.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S3C/S5P/Exynos SoC pin controller - wake-up interrupt controller
+
+maintainers:
+  - Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+  - Sylwester Nawrocki <s.nawrocki@samsung.com>
+  - Tomasz Figa <tomasz.figa@gmail.com>
+
+description: |
+  This is a part of device tree bindings for Samsung S3C/S5P/Exynos SoC pin
+  controller.
+
+  External wake-up interrupts for Samsung S3C/S5P/Exynos SoC pin controller.
+  For S3C24xx, S3C64xx, S5PV210 and Exynos4210 compatible wake-up interrupt
+  controllers, only one pin-controller device node can include external wake-up
+  interrupts child node (in other words, only one External wake-up interrupts
+  pin-controller is supported).
+  For newer controllers, multiple pin-controller device node can include
+  external wake-up interrupts child node.
+
+  See also Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml for
+  additional information and example.
+
+properties:
+  compatible:
+    enum:
+      - samsung,s3c2410-wakeup-eint
+      - samsung,s3c2412-wakeup-eint
+      - samsung,s3c64xx-wakeup-eint
+      - samsung,s5pv210-wakeup-eint
+      - samsung,exynos4210-wakeup-eint
+      - samsung,exynos7-wakeup-eint
+      - samsung,exynos850-wakeup-eint
+      - samsung,exynosautov9-wakeup-eint
+
+  interrupts:
+    description:
+      Interrupt used by multiplexed external wake-up interrupts.
+    minItems: 1
+    maxItems: 6
+
+required:
+  - compatible
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - samsung,s3c2410-wakeup-eint
+              - samsung,s3c2412-wakeup-eint
+    then:
+      properties:
+        interrupts:
+          minItems: 6
+          maxItems: 6
+      required:
+        - interrupts
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: samsung,s3c64xx-wakeup-eint
+    then:
+      properties:
+        interrupts:
+          minItems: 4
+          maxItems: 4
+      required:
+        - interrupts
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - samsung,s5pv210-wakeup-eint
+              - samsung,exynos4210-wakeup-eint
+              - samsung,exynos7-wakeup-eint
+    then:
+      properties:
+        interrupts:
+          minItems: 1
+          maxItems: 1
+      required:
+        - interrupts
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - samsung,exynos850-wakeup-eint
+              - samsung,exynosautov9-wakeup-eint
+    then:
+      properties:
+        interrupts: false
+
+additionalProperties: false
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/samsung,pinctrl.yaml
new file mode 100644 (file)
index 0000000..989e48c
--- /dev/null
@@ -0,0 +1,393 @@
+# SPDX-License-Identifier: GPL-2.0-only
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/samsung,pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Samsung S3C/S5P/Exynos SoC pin controller
+
+maintainers:
+  - Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+  - Sylwester Nawrocki <s.nawrocki@samsung.com>
+  - Tomasz Figa <tomasz.figa@gmail.com>
+
+description: |
+  This is a part of device tree bindings for Samsung S3C/S5P/Exynos SoC pin
+  controller.
+
+  Pin group settings (like drive strength, pull up/down) are available as
+  macros in include/dt-bindings/pinctrl/samsung.h.
+
+  All the pin controller nodes should be represented in the aliases node using
+  the following format 'pinctrl{n}' where n is a unique number for the alias.
+
+  The controller supports three types of interrupts::
+   - External GPIO interrupts (see interrupts property in pin controller node);
+
+   - External wake-up interrupts - multiplexed (capable of waking up the system
+     see interrupts property in external wake-up interrupt controller node -
+     samsung,pinctrl-wakeup-interrupt.yaml);
+
+   - External wake-up interrupts - direct (capable of waking up the system, see
+     interrupts property in every bank of pin controller with external wake-up
+     interrupt controller - samsung,pinctrl-gpio-bank.yaml).
+
+properties:
+  $nodename:
+    pattern: "^pinctrl(@.*)?"
+
+  compatible:
+    enum:
+      - samsung,s3c2412-pinctrl
+      - samsung,s3c2416-pinctrl
+      - samsung,s3c2440-pinctrl
+      - samsung,s3c2450-pinctrl
+      - samsung,s3c64xx-pinctrl
+      - samsung,s5pv210-pinctrl
+      - samsung,exynos3250-pinctrl
+      - samsung,exynos4210-pinctrl
+      - samsung,exynos4x12-pinctrl
+      - samsung,exynos5250-pinctrl
+      - samsung,exynos5260-pinctrl
+      - samsung,exynos5410-pinctrl
+      - samsung,exynos5420-pinctrl
+      - samsung,exynos5433-pinctrl
+      - samsung,exynos7-pinctrl
+      - samsung,exynos7885-pinctrl
+      - samsung,exynos850-pinctrl
+      - samsung,exynosautov9-pinctrl
+      - tesla,fsd-pinctrl
+
+  interrupts:
+    description:
+      Required for GPIO banks supporting external GPIO interrupts.
+    maxItems: 1
+
+  power-domains:
+    maxItems: 1
+
+  reg:
+    description:
+      Second base address of the pin controller if the specific registers of
+      the pin controller are separated into the different base address.
+      Only certain banks of certain pin controller might need it.
+    minItems: 1
+    maxItems: 2
+
+  wakeup-interrupt-controller:
+    $ref: samsung,pinctrl-wakeup-interrupt.yaml
+
+patternProperties:
+  "^[a-z]+[0-9]*-gpio-bank$":
+    description:
+      Pin banks of the controller are represented by child nodes of the
+      controller node. Bank name is taken from name of the node.
+    $ref: samsung,pinctrl-gpio-bank.yaml
+
+  "^[a-z0-9-]+-pins$":
+    oneOf:
+      - $ref: samsung,pinctrl-pins-cfg.yaml
+        required:
+          - samsung,pins
+      - type: object
+        patternProperties:
+          "^[a-z0-9-]+-pins$":
+            $ref: samsung,pinctrl-pins-cfg.yaml
+
+        additionalProperties: false
+
+  "^(initial|sleep)-state$":
+    patternProperties:
+      "^(pin-[a-z0-9-]+|[a-z0-9-]+-pin)$":
+        $ref: samsung,pinctrl-pins-cfg.yaml
+
+        properties:
+          samsung,pins:
+            description: See samsung,pinctrl-pins-cfg.yaml
+            $ref: /schemas/types.yaml#/definitions/string-array
+            maxItems: 1
+
+        required:
+          - samsung,pins
+
+        unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+
+allOf:
+  - $ref: "pinctrl.yaml#"
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: samsung,exynos5433-pinctrl
+    then:
+      properties:
+        reg:
+          minItems: 1
+          maxItems: 2
+    else:
+      properties:
+        reg:
+          minItems: 1
+          maxItems: 1
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/pinctrl/samsung.h>
+
+    pinctrl@7f008000 {
+        compatible = "samsung,s3c64xx-pinctrl";
+        reg = <0x7f008000 0x1000>;
+        interrupt-parent = <&vic1>;
+        interrupts = <21>;
+
+        wakeup-interrupt-controller {
+            compatible = "samsung,s3c64xx-wakeup-eint";
+            interrupts-extended = <&vic0 0>,
+                                  <&vic0 1>,
+                                  <&vic1 0>,
+                                  <&vic1 1>;
+        };
+
+        /* Pin bank with external GPIO or muxed external wake-up interrupts */
+        gpa-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+
+        // ...
+
+        uart0-data-pins {
+            samsung,pins = "gpa-0", "gpa-1";
+            samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
+            samsung,pin-pud = <S3C64XX_PIN_PULL_NONE>;
+        };
+
+        // ...
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/pinctrl/samsung.h>
+
+    pinctrl@11400000 {
+        compatible = "samsung,exynos4210-pinctrl";
+        reg = <0x11400000 0x1000>;
+        interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&sleep0>;
+
+        /* Pin bank with external GPIO or muxed external wake-up interrupts */
+        gpa0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+
+        // ...
+
+        uart0-data-pins {
+            samsung,pins = "gpa0-0", "gpa0-1";
+            samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
+            samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+            samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+        };
+
+        // ...
+
+        sleep0: sleep-state {
+            gpa0-0-pin {
+                samsung,pins = "gpa0-0";
+                samsung,pin-con-pdn = <EXYNOS_PIN_PDN_INPUT>;
+                samsung,pin-pud-pdn = <EXYNOS_PIN_PULL_NONE>;
+            };
+
+            gpa0-1-pin {
+                samsung,pins = "gpa0-1";
+                samsung,pin-con-pdn = <EXYNOS_PIN_PDN_OUT0>;
+                samsung,pin-pud-pdn = <EXYNOS_PIN_PULL_NONE>;
+            };
+
+            // ...
+        };
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/pinctrl/samsung.h>
+
+    pinctrl@11000000 {
+        compatible = "samsung,exynos4210-pinctrl";
+        reg = <0x11000000 0x1000>;
+        interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
+
+        wakeup-interrupt-controller {
+            compatible = "samsung,exynos4210-wakeup-eint";
+            interrupt-parent = <&gic>;
+            interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_HIGH>;
+        };
+
+        /* Pin bank with external GPIO or muxed external wake-up interrupts */
+        gpj0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+
+        /* Pin bank without external interrupts */
+        gpy0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+        };
+
+        /* Pin bank with external direct wake-up interrupts */
+        gpx0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+
+            interrupt-controller;
+            interrupt-parent = <&gic>;
+            interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 17 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 18 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 22 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>;
+            #interrupt-cells = <2>;
+        };
+
+        // ...
+
+        sd0-clk-pins {
+            samsung,pins = "gpk0-0";
+            samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
+            samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+            samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
+        };
+
+        sd4-bus-width8-pins {
+            part-1-pins {
+                samsung,pins = "gpk0-3", "gpk0-4",
+                               "gpk0-5", "gpk0-6";
+                samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
+                samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
+            };
+
+            part-2-pins {
+                samsung,pins = "gpk1-3", "gpk1-4",
+                               "gpk1-5", "gpk1-6";
+                samsung,pin-function = <EXYNOS_PIN_FUNC_4>;
+                samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
+                samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
+            };
+        };
+
+        // ...
+
+        otg-gp-pins {
+            samsung,pins = "gpx3-3";
+            samsung,pin-function = <EXYNOS_PIN_FUNC_OUTPUT>;
+            samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+            samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
+            samsung,pin-val = <0>;
+        };
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/pinctrl/samsung.h>
+
+    pinctrl@10580000 {
+        compatible = "samsung,exynos5433-pinctrl";
+        reg = <0x10580000 0x1a20>, <0x11090000 0x100>;
+
+        pinctrl-names = "default";
+        pinctrl-0 = <&initial_alive>;
+
+        wakeup-interrupt-controller {
+            compatible = "samsung,exynos7-wakeup-eint";
+            interrupts = <GIC_SPI 16 IRQ_TYPE_LEVEL_HIGH>;
+        };
+
+        /* Pin bank with external direct wake-up interrupts */
+        gpa0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+
+            interrupt-controller;
+            interrupt-parent = <&gic>;
+            interrupts = <GIC_SPI 0 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 1 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 2 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 3 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 5 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>,
+                         <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
+            #interrupt-cells = <2>;
+        };
+
+        // ...
+
+        te-irq-pins {
+            samsung,pins = "gpf1-3";
+            samsung,pin-function = <0xf>;
+        };
+
+        // ..
+
+        initial_alive: initial-state {
+            gpa0-0-pin {
+                samsung,pins = "gpa0-0";
+                samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
+                samsung,pin-pud = <EXYNOS_PIN_PULL_DOWN>;
+                samsung,pin-drv = <EXYNOS5433_PIN_DRV_FAST_SR1>;
+            };
+
+            // ...
+        };
+    };
+
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/pinctrl/samsung.h>
+
+    pinctrl@114b0000 {
+        compatible = "samsung,exynos5433-pinctrl";
+        reg = <0x114b0000 0x1000>;
+        interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>;
+        power-domains = <&pd_aud>;
+
+        /* Pin bank with external GPIO or muxed external wake-up interrupts */
+        gpz0-gpio-bank {
+            gpio-controller;
+            #gpio-cells = <2>;
+            interrupt-controller;
+            #interrupt-cells = <2>;
+        };
+
+        // ...
+
+        i2s0-bus-pins {
+            samsung,pins = "gpz0-0", "gpz0-1", "gpz0-2", "gpz0-3",
+                           "gpz0-4", "gpz0-5", "gpz0-6";
+            samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
+            samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+            samsung,pin-drv = <EXYNOS5433_PIN_DRV_FAST_SR1>;
+        };
+
+        // ...
+    };
diff --git a/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt b/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
deleted file mode 100644 (file)
index 9e70edc..0000000
+++ /dev/null
@@ -1,383 +0,0 @@
-Samsung GPIO and Pin Mux/Config controller
-
-Samsung's ARM based SoC's integrates a GPIO and Pin mux/config hardware
-controller. It controls the input/output settings on the available pads/pins
-and also provides ability to multiplex and configure the output of various
-on-chip controllers onto these pads.
-
-Required Properties:
-- compatible: should be one of the following.
-  - "samsung,s3c2412-pinctrl": for S3C2412-compatible pin-controller,
-  - "samsung,s3c2416-pinctrl": for S3C2416-compatible pin-controller,
-  - "samsung,s3c2440-pinctrl": for S3C2440-compatible pin-controller,
-  - "samsung,s3c2450-pinctrl": for S3C2450-compatible pin-controller,
-  - "samsung,s3c64xx-pinctrl": for S3C64xx-compatible pin-controller,
-  - "samsung,s5pv210-pinctrl": for S5PV210-compatible pin-controller,
-  - "samsung,exynos3250-pinctrl": for Exynos3250 compatible pin-controller.
-  - "samsung,exynos4210-pinctrl": for Exynos4210 compatible pin-controller.
-  - "samsung,exynos4x12-pinctrl": for Exynos4x12 compatible pin-controller.
-  - "samsung,exynos5250-pinctrl": for Exynos5250 compatible pin-controller.
-  - "samsung,exynos5260-pinctrl": for Exynos5260 compatible pin-controller.
-  - "samsung,exynos5410-pinctrl": for Exynos5410 compatible pin-controller.
-  - "samsung,exynos5420-pinctrl": for Exynos5420 compatible pin-controller.
-  - "samsung,exynos5433-pinctrl": for Exynos5433 compatible pin-controller.
-  - "samsung,exynos7-pinctrl": for Exynos7 compatible pin-controller.
-  - "samsung,exynos7885-pinctrl": for Exynos7885 compatible pin-controller.
-  - "samsung,exynos850-pinctrl": for Exynos850 compatible pin-controller.
-  - "samsung,exynosautov9-pinctrl": for ExynosAutov9 compatible pin-controller.
-
-- reg: Base address of the pin controller hardware module and length of
-  the address space it occupies.
-
-  - reg: Second base address of the pin controller if the specific registers
-  of the pin controller are separated into the different base address.
-
-       Eg: GPF[1-5] of Exynos5433 are separated into the two base address.
-       - First base address is for GPAx and GPF[1-5] external interrupt
-         registers.
-       - Second base address is for GPF[1-5] pinctrl registers.
-
-       pinctrl_0: pinctrl@10580000 {
-               compatible = "samsung,exynos5433-pinctrl";
-               reg = <0x10580000 0x1a20>, <0x11090000 0x100>;
-
-               wakeup-interrupt-controller {
-                       compatible = "samsung,exynos7-wakeup-eint";
-                       interrupts = <0 16 0>;
-               };
-       };
-
-- Pin banks as child nodes: Pin banks of the controller are represented by child
-  nodes of the controller node. Bank name is taken from name of the node. Each
-  bank node must contain following properties:
-
-  - gpio-controller: identifies the node as a gpio controller and pin bank.
-  - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
-    binding is used, the amount of cells must be specified as 2. See the below
-    mentioned gpio binding representation for description of particular cells.
-
-       Eg: <&gpx2 6 0>
-       <[phandle of the gpio controller node]
-       [pin number within the gpio controller]
-       [flags]>
-
-       Values for gpio specifier:
-       - Pin number: is a value between 0 to 7.
-       - Flags: 0 - Active High
-                1 - Active Low
-
-- Pin mux/config groups as child nodes: The pin mux (selecting pin function
-  mode) and pin config (pull up/down, driver strength) settings are represented
-  as child nodes of the pin-controller node. There should be at least one
-  child node and there is no limit on the count of these child nodes. It is
-  also possible for a child node to consist of several further child nodes
-  to allow grouping multiple pinctrl groups into one. The format of second
-  level child nodes is exactly the same as for first level ones and is
-  described below.
-
-  The child node should contain a list of pin(s) on which a particular pin
-  function selection or pin configuration (or both) have to applied. This
-  list of pins is specified using the property name "samsung,pins". There
-  should be at least one pin specified for this property and there is no upper
-  limit on the count of pins that can be specified. The pins are specified
-  using pin names which are derived from the hardware manual of the SoC. As
-  an example, the pins in GPA0 bank of the pin controller can be represented
-  as "gpa0-0", "gpa0-1", "gpa0-2" and so on. The names should be in lower case.
-  The format of the pin names should be (as per the hardware manual)
-  "[pin bank name]-[pin number within the bank]".
-
-  The pin function selection that should be applied on the pins listed in the
-  child node is specified using the "samsung,pin-function" property. The value
-  of this property that should be applied to each of the pins listed in the
-  "samsung,pins" property should be picked from the hardware manual of the SoC
-  for the specified pin group. This property is optional in the child node if
-  no specific function selection is desired for the pins listed in the child
-  node. The value of this property is used as-is to program the pin-controller
-  function selector register of the pin-bank.
-
-  The child node can also optionally specify one or more of the pin
-  configuration that should be applied on all the pins listed in the
-  "samsung,pins" property of the child node. The following pin configuration
-  properties are supported.
-
-  - samsung,pin-val: Initial value of pin output buffer.
-  - samsung,pin-pud: Pull up/down configuration.
-  - samsung,pin-drv: Drive strength configuration.
-  - samsung,pin-pud-pdn: Pull up/down configuration in power down mode.
-  - samsung,pin-drv-pdn: Drive strength configuration in power down mode.
-
-  The values specified by these config properties should be derived from the
-  hardware manual and these values are programmed as-is into the pin
-  pull up/down and driver strength register of the pin-controller.
-
-  Note: A child should include at least a pin function selection property or
-  pin configuration property (one or more) or both.
-
-  The client nodes that require a particular pin function selection and/or
-  pin configuration should use the bindings listed in the "pinctrl-bindings.txt"
-  file.
-
-External GPIO and Wakeup Interrupts:
-
-The controller supports two types of external interrupts over gpio. The first
-is the external gpio interrupt and second is the external wakeup interrupts.
-The difference between the two is that the external wakeup interrupts can be
-used as system wakeup events.
-
-A. External GPIO Interrupts: For supporting external gpio interrupts, the
-   following properties should be specified in the pin-controller device node.
-
-   - interrupts: interrupt specifier for the controller. The format and value of
-     the interrupt specifier depends on the interrupt parent for the controller.
-
-   In addition, following properties must be present in node of every bank
-   of pins supporting GPIO interrupts:
-
-   - interrupt-controller: identifies the controller node as interrupt-parent.
-   - #interrupt-cells: the value of this property should be 2.
-     - First Cell: represents the external gpio interrupt number local to the
-       external gpio interrupt space of the controller.
-     - Second Cell: flags to identify the type of the interrupt
-       - 1 = rising edge triggered
-       - 2 = falling edge triggered
-       - 3 = rising and falling edge triggered
-       - 4 = high level triggered
-       - 8 = low level triggered
-
-B. External Wakeup Interrupts: For supporting external wakeup interrupts, a
-   child node representing the external wakeup interrupt controller should be
-   included in the pin-controller device node.
-
-   Only one pin-controller device node can include external wakeup interrupts
-   child node (in other words, only one External Wakeup Interrupts
-   pin-controller is supported).
-
-   This child node should include following properties:
-
-   - compatible: identifies the type of the external wakeup interrupt controller
-     The possible values are:
-     - samsung,s3c2410-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung S3C24xx SoCs except S3C2412 and S3C2413,
-     - samsung,s3c2412-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung S3C2412 and S3C2413 SoCs,
-     - samsung,s3c64xx-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung S3C64xx SoCs,
-     - samsung,s5pv210-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung S5Pv210 SoCs,
-     - samsung,exynos4210-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung Exynos4210 and S5PC110/S5PV210 SoCs.
-     - samsung,exynos7-wakeup-eint: represents wakeup interrupt controller
-       found on Samsung Exynos7 SoC.
-   - interrupts: interrupt used by multiplexed wakeup interrupts.
-
-   In addition, following properties must be present in node of every bank
-   of pins supporting wake-up interrupts:
-
-   - interrupt-controller: identifies the node as interrupt-parent.
-   - #interrupt-cells: the value of this property should be 2
-     - First Cell: represents the external wakeup interrupt number local to
-       the external wakeup interrupt space of the controller.
-     - Second Cell: flags to identify the type of the interrupt
-       - 1 = rising edge triggered
-       - 2 = falling edge triggered
-       - 3 = rising and falling edge triggered
-       - 4 = high level triggered
-       - 8 = low level triggered
-
-   Node of every bank of pins supporting direct wake-up interrupts (without
-   multiplexing) must contain following properties:
-
-   - interrupts: interrupts of the interrupt parent which are used for external
-     wakeup interrupts from pins of the bank, must contain interrupts for all
-     pins of the bank.
-
-Aliases:
-
-All the pin controller nodes should be represented in the aliases node using
-the following format 'pinctrl{n}' where n is a unique number for the alias.
-
-Aliases for controllers compatible with "samsung,exynos7-pinctrl":
-- pinctrl0: pin controller of ALIVE block,
-- pinctrl1: pin controller of BUS0 block,
-- pinctrl2: pin controller of NFC block,
-- pinctrl3: pin controller of TOUCH block,
-- pinctrl4: pin controller of FF block,
-- pinctrl5: pin controller of ESE block,
-- pinctrl6: pin controller of FSYS0 block,
-- pinctrl7: pin controller of FSYS1 block,
-- pinctrl8: pin controller of BUS1 block,
-- pinctrl9: pin controller of AUDIO block,
-
-Example: A pin-controller node with pin banks:
-
-       pinctrl_0: pinctrl@11400000 {
-               compatible = "samsung,exynos4210-pinctrl";
-               reg = <0x11400000 0x1000>;
-               interrupts = <0 47 0>;
-
-               /* ... */
-
-               /* Pin bank without external interrupts */
-               gpy0: gpy0 {
-                       gpio-controller;
-                       #gpio-cells = <2>;
-               };
-
-               /* ... */
-
-               /* Pin bank with external GPIO or muxed wake-up interrupts */
-               gpj0: gpj0 {
-                       gpio-controller;
-                       #gpio-cells = <2>;
-
-                       interrupt-controller;
-                       #interrupt-cells = <2>;
-               };
-
-               /* ... */
-
-               /* Pin bank with external direct wake-up interrupts */
-               gpx0: gpx0 {
-                       gpio-controller;
-                       #gpio-cells = <2>;
-
-                       interrupt-controller;
-                       interrupt-parent = <&gic>;
-                       interrupts = <0 16 0>, <0 17 0>, <0 18 0>, <0 19 0>,
-                                    <0 20 0>, <0 21 0>, <0 22 0>, <0 23 0>;
-                       #interrupt-cells = <2>;
-               };
-
-               /* ... */
-       };
-
-Example 1: A pin-controller node with pin groups.
-
-       #include <dt-bindings/pinctrl/samsung.h>
-
-       pinctrl_0: pinctrl@11400000 {
-               compatible = "samsung,exynos4210-pinctrl";
-               reg = <0x11400000 0x1000>;
-               interrupts = <0 47 0>;
-
-               /* ... */
-
-               uart0_data: uart0-data {
-                       samsung,pins = "gpa0-0", "gpa0-1";
-                       samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
-                       samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
-                       samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
-               };
-
-               uart0_fctl: uart0-fctl {
-                       samsung,pins = "gpa0-2", "gpa0-3";
-                       samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
-                       samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
-                       samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
-               };
-
-               uart1_data: uart1-data {
-                       samsung,pins = "gpa0-4", "gpa0-5";
-                       samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
-                       samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
-                       samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
-               };
-
-               uart1_fctl: uart1-fctl {
-                       samsung,pins = "gpa0-6", "gpa0-7";
-                       samsung,pin-function = <EXYNOS_PIN_FUNC_2>;
-                       samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
-                       samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
-               };
-
-               i2c2_bus: i2c2-bus {
-                       samsung,pins = "gpa0-6", "gpa0-7";
-                       samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
-                       samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
-                       samsung,pin-drv = <EXYNOS4_PIN_DRV_LV1>;
-               };
-
-               sd4_bus8: sd4-bus-width8 {
-                       part-1 {
-                               samsung,pins = "gpk0-3", "gpk0-4",
-                                               "gpk0-5", "gpk0-6";
-                               samsung,pin-function = <EXYNOS_PIN_FUNC_3>;
-                               samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
-                               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
-                       };
-                       part-2 {
-                               samsung,pins = "gpk1-3", "gpk1-4",
-                                               "gpk1-5", "gpk1-6";
-                               samsung,pin-function = <EXYNOS_PIN_FUNC_4>;
-                               samsung,pin-pud = <EXYNOS_PIN_PULL_UP>;
-                               samsung,pin-drv = <EXYNOS4_PIN_DRV_LV4>;
-                       };
-               };
-       };
-
-Example 2: A pin-controller node with external wakeup interrupt controller node.
-
-       pinctrl_1: pinctrl@11000000 {
-               compatible = "samsung,exynos4210-pinctrl";
-               reg = <0x11000000 0x1000>;
-               interrupts = <0 46 0>
-
-               /* ... */
-
-               wakeup-interrupt-controller {
-                       compatible = "samsung,exynos4210-wakeup-eint";
-                       interrupt-parent = <&gic>;
-                       interrupts = <0 32 0>;
-               };
-       };
-
-Example 3: A uart client node that supports 'default' and 'flow-control' states.
-
-       uart@13800000 {
-               compatible = "samsung,exynos4210-uart";
-               reg = <0x13800000 0x100>;
-               interrupts = <0 52 0>;
-               pinctrl-names = "default", "flow-control;
-               pinctrl-0 = <&uart0_data>;
-               pinctrl-1 = <&uart0_data>, <&uart0_fctl>;
-       };
-
-Example 4: Set up the default pin state for uart controller.
-
-       static int s3c24xx_serial_probe(struct platform_device *pdev) {
-               struct pinctrl *pinctrl;
-
-               /* ... */
-
-               pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
-       }
-
-Example 5: A display port client node that supports 'default' pinctrl state
-          and gpio binding.
-
-       display-port-controller {
-               /* ... */
-
-               samsung,hpd-gpio = <&gpx2 6 0>;
-               pinctrl-names = "default";
-               pinctrl-0 = <&dp_hpd>;
-       };
-
-Example 6: Request the gpio for display port controller
-
-       static int exynos_dp_probe(struct platform_device *pdev)
-       {
-               int hpd_gpio, ret;
-               struct device *dev = &pdev->dev;
-               struct device_node *dp_node = dev->of_node;
-
-               /* ... */
-
-               hpd_gpio = of_get_named_gpio(dp_node, "samsung,hpd-gpio", 0);
-
-               /* ... */
-
-               ret = devm_gpio_request_one(&pdev->dev, hpd_gpio, GPIOF_IN,
-                                           "hpd_gpio");
-               /* ... */
-       }
diff --git a/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml b/Documentation/devicetree/bindings/pinctrl/sunplus,sp7021-pinctrl.yaml
new file mode 100644 (file)
index 0000000..d8e75b3
--- /dev/null
@@ -0,0 +1,374 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) Sunplus Co., Ltd.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pinctrl/sunplus,sp7021-pinctrl.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sunplus SP7021 Pin Controller Device Tree Bindings
+
+maintainers:
+  - Dvorkin Dmitry <dvorkin@tibbo.com>
+  - Wells Lu <wellslutw@gmail.com>
+
+description: |
+  The Sunplus SP7021 pin controller is used to control SoC pins. Please
+  refer to pinctrl-bindings.txt in this directory for details of the common
+  pinctrl bindings used by client devices.
+
+  SP7021 has 99 digital GPIO pins which are numbered from GPIO 0 to 98. All
+  are multiplexed with some special function pins. SP7021 has 3 types of
+  special function pins:
+
+  (1) function-group pins:
+      Ex 1 (SPI-NOR flash):
+        If control-field SPI_FLASH_SEL is set to 1, GPIO 83, 84, 86 and 87
+        will be pins of SPI-NOR flash. If it is set to 2, GPIO 76, 78, 79
+        and 81 will be pins of SPI-NOR flash.
+
+      Ex 2 (UART_0):
+        If control-bit UA0_SEL is set to 1, GPIO 88 and 89 will be TX and
+        RX pins of UART_0 (UART channel 0).
+
+      Ex 3 (eMMC):
+        If control-bit EMMC_SEL is set to 1, GPIO 72, 73, 74, 75, 76, 77,
+        78, 79, 80, 81 will be pins of an eMMC device.
+
+      Properties "function" and "groups" are used to select function-group
+      pins.
+
+  (2) fully pin-mux (like phone exchange mux) pins:
+      GPIO 8 to 71 are 'fully pin-mux' pins. Any pins of peripherals of
+      SP7021 (ex: UART_1, UART_2, UART_3, UART_4, I2C_0, I2C_1, and etc.)
+      can be routed to any pins of fully pin-mux pins.
+
+      Ex 1 (UART channel 1):
+        If control-field UA1_TX_SEL is set to 3, TX pin of UART_1 will be
+        routed to GPIO 10 (3 - 1 + 8 = 10).
+        If control-field UA1_RX_SEL is set to 4, RX pin of UART_1 will be
+        routed to GPIO 11 (4 - 1 + 8 = 11).
+        If control-field UA1_RTS_SEL is set to 5, RTS pin of UART_1 will
+        be routed to GPIO 12 (5 - 1 + 8 = 12).
+        If control-field UA1_CTS_SEL is set to 6, CTS pin of UART_1 will
+        be routed to GPIO 13 (6 - 1 + 8 = 13).
+
+      Ex 2 (I2C channel 0):
+        If control-field I2C0_CLK_SEL is set to 20, CLK pin of I2C_0 will
+        be routed to GPIO 27 (20 - 1 + 8 = 27).
+        If control-field I2C0_DATA_SEL is set to 21, DATA pin of I2C_0
+        will be routed to GPIO 28 (21 - 1 + 9 = 28).
+
+      Totally, SP7021 has 120 peripheral pins. The peripheral pins can be
+      routed to any of 64 'fully pin-mux' pins.
+
+  (3) I/O processor pins
+      SP7021 has a built-in I/O processor.
+      Any GPIO pins (GPIO 0 to 98) can be set to pins of I/O processor.
+
+  Vendor property "sunplus,pins" is used to select "fully pin-mux" pins,
+  "I/O processor pins" and "digital GPIO" pins.
+
+  The device node of pin controller of Sunplus SP7021 has following
+  properties.
+
+properties:
+  compatible:
+    const: sunplus,sp7021-pctl
+
+  gpio-controller: true
+
+  '#gpio-cells':
+    const: 2
+
+  reg:
+    items:
+      - description: the MOON2 registers
+      - description: the GPIOXT registers
+      - description: the FIRST registers
+      - description: the MOON1 registers
+
+  reg-names:
+    items:
+      - const: moon2
+      - const: gpioxt
+      - const: first
+      - const: moon1
+
+  clocks:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+patternProperties:
+  '-pins$':
+    type: object
+    description: |
+      A pinctrl node should contain at least one subnodes representing the
+      pins or function-pins group available on the machine. Each subnode
+      will list the pins it needs, and how they should be configured.
+
+      Pinctrl node's client devices use subnodes for desired pin
+      configuration. Client device subnodes use below standard properties.
+    $ref: pinmux-node.yaml#
+
+    properties:
+      sunplus,pins:
+        description: |
+          Define 'sunplus,pins' which are used by pinctrl node's client
+          device.
+
+          It consists of one or more integers which represents the config
+          setting for corresponding pin. Each integer defines a individual
+          pin in which:
+
+          Bit 32~24: defines GPIO number. Its range is 0 ~ 98.
+          Bit 23~16: defines types: (1) fully pin-mux pins
+                                    (2) IO processor pins
+                                    (3) digital GPIO pins
+          Bit 15~8:  defines pins of peripherals (which are defined in
+                     'include/dt-binging/pinctrl/sppctl.h').
+          Bit 7~0:   defines types or initial-state of digital GPIO pins.
+
+          Please use macro SPPCTL_IOPAD to define the integers for pins.
+
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+
+      function:
+        description: |
+          Define pin-function which is used by pinctrl node's client device.
+          The name should be one of string in the following enumeration.
+        $ref: "/schemas/types.yaml#/definitions/string"
+        enum: [ SPI_FLASH, SPI_FLASH_4BIT, SPI_NAND, CARD0_EMMC, SD_CARD,
+                UA0, FPGA_IFX, HDMI_TX, LCDIF, USB0_OTG, USB1_OTG ]
+
+      groups:
+        description: |
+          Define pin-group in a specified pin-function.
+          The name should be one of string in the following enumeration.
+        $ref: "/schemas/types.yaml#/definitions/string"
+        enum: [ SPI_FLASH1, SPI_FLASH2, SPI_FLASH_4BIT1, SPI_FLASH_4BIT2,
+                SPI_NAND, CARD0_EMMC, SD_CARD, UA0, FPGA_IFX, HDMI_TX1,
+                HDMI_TX2, HDMI_TX3, LCDIF, USB0_OTG, USB1_OTG ]
+
+      sunplus,zerofunc:
+        description: |
+          This is a vendor specific property. It is used to disable pins
+          which are not used by pinctrl node's client device.
+          Some pins may be enabled by boot-loader. We can use this
+          property to disable them.
+        $ref: /schemas/types.yaml#/definitions/uint32-array
+
+    additionalProperties: false
+
+    allOf:
+      - if:
+          properties:
+            function:
+              enum:
+                - SPI_FLASH
+        then:
+          properties:
+            groups:
+              enum:
+                - SPI_FLASH1
+                - SPI_FLASH2
+      - if:
+          properties:
+            function:
+              enum:
+                - SPI_FLASH_4BIT
+        then:
+          properties:
+            groups:
+              enum:
+                - SPI_FLASH_4BIT1
+                - SPI_FLASH_4BIT2
+      - if:
+          properties:
+            function:
+              enum:
+                - SPI_NAND
+        then:
+          properties:
+            groups:
+              enum:
+                - SPI_NAND
+      - if:
+          properties:
+            function:
+              enum:
+                - CARD0_EMMC
+        then:
+          properties:
+            groups:
+              enum:
+                - CARD0_EMMC
+      - if:
+          properties:
+            function:
+              enum:
+                - SD_CARD
+        then:
+          properties:
+            groups:
+              enum:
+                - SD_CARD
+      - if:
+          properties:
+            function:
+              enum:
+                - UA0
+        then:
+          properties:
+            groups:
+              enum:
+                - UA0
+      - if:
+          properties:
+            function:
+              enum:
+                - FPGA_IFX
+        then:
+          properties:
+            groups:
+              enum:
+                - FPGA_IFX
+      - if:
+          properties:
+            function:
+              enum:
+                - HDMI_TX
+        then:
+          properties:
+            groups:
+              enum:
+                - HDMI_TX1
+                - HDMI_TX2
+                - HDMI_TX3
+      - if:
+          properties:
+            function:
+              enum:
+                - LCDIF
+        then:
+          properties:
+            groups:
+              enum:
+                - LCDIF
+      - if:
+          properties:
+            function:
+              enum:
+                - USB0_OTG
+        then:
+          properties:
+            groups:
+              enum:
+                - USB0_OTG
+      - if:
+          properties:
+            function:
+              enum:
+                - USB1_OTG
+        then:
+          properties:
+            groups:
+              enum:
+                - USB1_OTG
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - "#gpio-cells"
+  - gpio-controller
+  - clocks
+  - resets
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/pinctrl/sppctl-sp7021.h>
+
+    pinctl@9c000100 {
+        compatible = "sunplus,sp7021-pctl";
+        reg = <0x9c000100 0x100>, <0x9c000300 0x100>,
+              <0x9c0032e4 0x1c>, <0x9c000080 0x20>;
+        reg-names = "moon2", "gpioxt", "first", "moon1";
+        gpio-controller;
+        #gpio-cells = <2>;
+        clocks = <&clkc 0x83>;
+        resets = <&rstc 0x73>;
+
+        uart0-pins {
+            function = "UA0";
+            groups = "UA0";
+        };
+
+        spinand0-pins {
+            function = "SPI_NAND";
+            groups = "SPI_NAND";
+        };
+
+        uart1-pins {
+            sunplus,pins = <
+                SPPCTL_IOPAD(11, SPPCTL_PCTL_G_PMUX, MUXF_UA1_TX, 0)
+                SPPCTL_IOPAD(10, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RX, 0)
+            >;
+        };
+
+        uart2-pins {
+            sunplus,pins = <
+                SPPCTL_IOPAD(20, SPPCTL_PCTL_G_PMUX, MUXF_UA1_TX, 0)
+                SPPCTL_IOPAD(21, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RX, 0)
+                SPPCTL_IOPAD(22, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RTS, 0)
+                SPPCTL_IOPAD(23, SPPCTL_PCTL_G_PMUX, MUXF_UA1_CTS, 0)
+            >;
+        };
+
+        emmc-pins {
+            function = "CARD0_EMMC";
+            groups = "CARD0_EMMC";
+        };
+
+        sdcard-pins {
+            function = "SD_CARD";
+            groups = "SD_CARD";
+            sunplus,pins = < SPPCTL_IOPAD(91, SPPCTL_PCTL_G_GPIO, 0, 0) >;
+        };
+
+        hdmi_A_tx1-pins {
+            function = "HDMI_TX";
+            groups = "HDMI_TX1";
+        };
+        hdmi_A_tx2-pins {
+            function = "HDMI_TX";
+            groups = "HDMI_TX2";
+        };
+        hdmi_A_tx3-pins {
+            function = "HDMI_TX";
+            groups = "HDMI_TX3";
+        };
+
+        ethernet-pins {
+            sunplus,pins = <
+                SPPCTL_IOPAD(49,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_CLK_OUT,0)
+                SPPCTL_IOPAD(44,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDC,0)
+                SPPCTL_IOPAD(43,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDIO,0)
+                SPPCTL_IOPAD(52,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXEN,0)
+                SPPCTL_IOPAD(50,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD0,0)
+                SPPCTL_IOPAD(51,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD1,0)
+                SPPCTL_IOPAD(46,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_CRSDV,0)
+                SPPCTL_IOPAD(47,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD0,0)
+                SPPCTL_IOPAD(48,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD1,0)
+            >;
+            sunplus,zerofunc = <
+                MUXF_L2SW_LED_FLASH0
+                MUXF_L2SW_LED_ON0
+                MUXF_L2SW_P0_MAC_RMII_RXER
+            >;
+        };
+    };
+...
index ea3e6c9..1c2c44c 100644 (file)
@@ -3688,6 +3688,14 @@ F:       Documentation/devicetree/bindings/net/brcm,bcm4908-enet.yaml
 F:     drivers/net/ethernet/broadcom/bcm4908_enet.*
 F:     drivers/net/ethernet/broadcom/unimac.h
 
+BROADCOM BCM4908 PINMUX DRIVER
+M:     RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl>
+M:     bcm-kernel-feedback-list@broadcom.com
+L:     linux-gpio@vger.kernel.org
+S:     Maintained
+F:     Documentation/devicetree/bindings/pinctrl/brcm,bcm4908-pinctrl.yaml
+F:     drivers/pinctrl/bcm/pinctrl-bcm4908.c
+
 BROADCOM BCM5301X ARM ARCHITECTURE
 M:     Florian Fainelli <f.fainelli@gmail.com>
 M:     Hauke Mehrtens <hauke@hauke-m.de>
@@ -15285,7 +15293,7 @@ L:      linux-samsung-soc@vger.kernel.org
 S:     Maintained
 Q:     https://patchwork.kernel.org/project/linux-samsung-soc/list/
 T:     git git://git.kernel.org/pub/scm/linux/kernel/git/pinctrl/samsung.git
-F:     Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
+F:     Documentation/devicetree/bindings/pinctrl/samsung,pinctrl*yaml
 F:     drivers/pinctrl/samsung/
 F:     include/dt-bindings/pinctrl/samsung.h
 
@@ -15302,6 +15310,16 @@ M:     Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>
 S:     Supported
 F:     drivers/pinctrl/pinctrl-thunderbay.c
 
+PIN CONTROLLER - SUNPLUS / TIBBO
+M:     Dvorkin Dmitry <dvorkin@tibbo.com>
+M:     Wells Lu <wellslutw@gmail.com>
+L:     linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
+S:     Maintained
+W:     https://sunplus.atlassian.net/wiki/spaces/doc/overview
+F:     Documentation/devicetree/bindings/pinctrl/sunplus,*
+F:     drivers/pinctrl/sunplus/
+F:     include/dt-bindings/pinctrl/sppctl*.h
+
 PKTCDVD DRIVER
 M:     linux-block@vger.kernel.org
 S:     Orphan
index 6fc56d6..f52960d 100644 (file)
@@ -527,6 +527,7 @@ source "drivers/pinctrl/samsung/Kconfig"
 source "drivers/pinctrl/spear/Kconfig"
 source "drivers/pinctrl/sprd/Kconfig"
 source "drivers/pinctrl/stm32/Kconfig"
+source "drivers/pinctrl/sunplus/Kconfig"
 source "drivers/pinctrl/sunxi/Kconfig"
 source "drivers/pinctrl/tegra/Kconfig"
 source "drivers/pinctrl/ti/Kconfig"
index f64d29f..c7064d9 100644 (file)
@@ -71,6 +71,7 @@ obj-$(CONFIG_PINCTRL_SAMSUNG) += samsung/
 obj-$(CONFIG_PINCTRL_SPEAR)    += spear/
 obj-y                          += sprd/
 obj-$(CONFIG_PINCTRL_STM32)    += stm32/
+obj-y                          += sunplus/
 obj-$(CONFIG_PINCTRL_SUNXI)    += sunxi/
 obj-$(CONFIG_ARCH_TEGRA)       += tegra/
 obj-y                          += ti/
index 5123f4c..042ec24 100644 (file)
@@ -29,6 +29,20 @@ config PINCTRL_BCM2835
        help
           Say Y here to enable the Broadcom BCM2835 GPIO driver.
 
+config PINCTRL_BCM4908
+       tristate "Broadcom BCM4908 pinmux driver"
+       depends on OF && (ARCH_BCM4908 || COMPILE_TEST)
+       select PINMUX
+       select PINCONF
+       select GENERIC_PINCONF
+       select GENERIC_PINCTRL_GROUPS
+       select GENERIC_PINMUX_FUNCTIONS
+       default ARCH_BCM4908
+       help
+         Driver for BCM4908 family SoCs with integrated pin controller.
+
+         If compiled as module it will be called pinctrl-bcm4908.
+
 config PINCTRL_BCM63XX
        bool
        select PINMUX
index 00c7b77..82b868e 100644 (file)
@@ -3,6 +3,7 @@
 
 obj-$(CONFIG_PINCTRL_BCM281XX)         += pinctrl-bcm281xx.o
 obj-$(CONFIG_PINCTRL_BCM2835)          += pinctrl-bcm2835.o
+obj-$(CONFIG_PINCTRL_BCM4908)          += pinctrl-bcm4908.o
 obj-$(CONFIG_PINCTRL_BCM63XX)          += pinctrl-bcm63xx.o
 obj-$(CONFIG_PINCTRL_BCM6318)          += pinctrl-bcm6318.o
 obj-$(CONFIG_PINCTRL_BCM6328)          += pinctrl-bcm6328.o
diff --git a/drivers/pinctrl/bcm/pinctrl-bcm4908.c b/drivers/pinctrl/bcm/pinctrl-bcm4908.c
new file mode 100644 (file)
index 0000000..cdfa165
--- /dev/null
@@ -0,0 +1,563 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (C) 2021 RafaÅ‚ MiÅ‚ecki <rafal@milecki.pl> */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/pinctrl/pinconf-generic.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/string_helpers.h>
+
+#include "../core.h"
+#include "../pinmux.h"
+
+#define BCM4908_NUM_PINS                       86
+
+#define BCM4908_TEST_PORT_BLOCK_EN_LSB                 0x00
+#define BCM4908_TEST_PORT_BLOCK_DATA_MSB               0x04
+#define BCM4908_TEST_PORT_BLOCK_DATA_LSB               0x08
+#define  BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT       12
+#define BCM4908_TEST_PORT_COMMAND                      0x0c
+#define  BCM4908_TEST_PORT_CMD_LOAD_MUX_REG            0x00000021
+
+struct bcm4908_pinctrl {
+       struct device *dev;
+       void __iomem *base;
+       struct mutex mutex;
+       struct pinctrl_dev *pctldev;
+       struct pinctrl_desc pctldesc;
+};
+
+/*
+ * Groups
+ */
+
+struct bcm4908_pinctrl_pin_setup {
+       unsigned int number;
+       unsigned int function;
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_0_pins_a[] = {
+       { 0, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_1_pins_a[] = {
+       { 1, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_2_pins_a[] = {
+       { 2, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_3_pins_a[] = {
+       { 3, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_4_pins_a[] = {
+       { 4, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_5_pins_a[] = {
+       { 5, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_6_pins_a[] = {
+       { 6, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_7_pins_a[] = {
+       { 7, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_8_pins_a[] = {
+       { 8, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_9_pins_a[] = {
+       { 9, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_10_pins_a[] = {
+       { 10, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_11_pins_a[] = {
+       { 11, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_12_pins_a[] = {
+       { 12, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_13_pins_a[] = {
+       { 13, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_14_pins_a[] = {
+       { 14, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_15_pins_a[] = {
+       { 15, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_16_pins_a[] = {
+       { 16, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_17_pins_a[] = {
+       { 17, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_18_pins_a[] = {
+       { 18, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_19_pins_a[] = {
+       { 19, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_20_pins_a[] = {
+       { 20, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_21_pins_a[] = {
+       { 21, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_22_pins_a[] = {
+       { 22, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_23_pins_a[] = {
+       { 23, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_24_pins_a[] = {
+       { 24, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_25_pins_a[] = {
+       { 25, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_26_pins_a[] = {
+       { 26, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_27_pins_a[] = {
+       { 27, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_28_pins_a[] = {
+       { 28, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_29_pins_a[] = {
+       { 29, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_30_pins_a[] = {
+       { 30, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_31_pins_a[] = {
+       { 31, 3 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_10_pins_b[] = {
+       { 8, 2 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_11_pins_b[] = {
+       { 9, 2 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_12_pins_b[] = {
+       { 0, 2 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_13_pins_b[] = {
+       { 1, 2 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup led_31_pins_b[] = {
+       { 30, 2 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup hs_uart_pins[] = {
+       { 10, 0 },      /* CTS */
+       { 11, 0 },      /* RTS */
+       { 12, 0 },      /* RXD */
+       { 13, 0 },      /* TXD */
+};
+
+static const struct bcm4908_pinctrl_pin_setup i2c_pins_a[] = {
+       { 18, 0 },      /* SDA */
+       { 19, 0 },      /* SCL */
+};
+
+static const struct bcm4908_pinctrl_pin_setup i2c_pins_b[] = {
+       { 22, 0 },      /* SDA */
+       { 23, 0 },      /* SCL */
+};
+
+static const struct bcm4908_pinctrl_pin_setup i2s_pins[] = {
+       { 27, 0 },      /* MCLK */
+       { 28, 0 },      /* LRCK */
+       { 29, 0 },      /* SDATA */
+       { 30, 0 },      /* SCLK */
+};
+
+static const struct bcm4908_pinctrl_pin_setup nand_ctrl_pins[] = {
+       { 32, 0 },
+       { 33, 0 },
+       { 34, 0 },
+       { 43, 0 },
+       { 44, 0 },
+       { 45, 0 },
+       { 56, 1 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup nand_data_pins[] = {
+       { 35, 0 },
+       { 36, 0 },
+       { 37, 0 },
+       { 38, 0 },
+       { 39, 0 },
+       { 40, 0 },
+       { 41, 0 },
+       { 42, 0 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup emmc_ctrl_pins[] = {
+       { 46, 0 },
+       { 47, 0 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup usb0_pwr_pins[] = {
+       { 63, 0 },
+       { 64, 0 },
+};
+
+static const struct bcm4908_pinctrl_pin_setup usb1_pwr_pins[] = {
+       { 66, 0 },
+       { 67, 0 },
+};
+
+struct bcm4908_pinctrl_grp {
+       const char *name;
+       const struct bcm4908_pinctrl_pin_setup *pins;
+       const unsigned int num_pins;
+};
+
+static const struct bcm4908_pinctrl_grp bcm4908_pinctrl_grps[] = {
+       { "led_0_grp_a", led_0_pins_a, ARRAY_SIZE(led_0_pins_a) },
+       { "led_1_grp_a", led_1_pins_a, ARRAY_SIZE(led_1_pins_a) },
+       { "led_2_grp_a", led_2_pins_a, ARRAY_SIZE(led_2_pins_a) },
+       { "led_3_grp_a", led_3_pins_a, ARRAY_SIZE(led_3_pins_a) },
+       { "led_4_grp_a", led_4_pins_a, ARRAY_SIZE(led_4_pins_a) },
+       { "led_5_grp_a", led_5_pins_a, ARRAY_SIZE(led_5_pins_a) },
+       { "led_6_grp_a", led_6_pins_a, ARRAY_SIZE(led_6_pins_a) },
+       { "led_7_grp_a", led_7_pins_a, ARRAY_SIZE(led_7_pins_a) },
+       { "led_8_grp_a", led_8_pins_a, ARRAY_SIZE(led_8_pins_a) },
+       { "led_9_grp_a", led_9_pins_a, ARRAY_SIZE(led_9_pins_a) },
+       { "led_10_grp_a", led_10_pins_a, ARRAY_SIZE(led_10_pins_a) },
+       { "led_11_grp_a", led_11_pins_a, ARRAY_SIZE(led_11_pins_a) },
+       { "led_12_grp_a", led_12_pins_a, ARRAY_SIZE(led_12_pins_a) },
+       { "led_13_grp_a", led_13_pins_a, ARRAY_SIZE(led_13_pins_a) },
+       { "led_14_grp_a", led_14_pins_a, ARRAY_SIZE(led_14_pins_a) },
+       { "led_15_grp_a", led_15_pins_a, ARRAY_SIZE(led_15_pins_a) },
+       { "led_16_grp_a", led_16_pins_a, ARRAY_SIZE(led_16_pins_a) },
+       { "led_17_grp_a", led_17_pins_a, ARRAY_SIZE(led_17_pins_a) },
+       { "led_18_grp_a", led_18_pins_a, ARRAY_SIZE(led_18_pins_a) },
+       { "led_19_grp_a", led_19_pins_a, ARRAY_SIZE(led_19_pins_a) },
+       { "led_20_grp_a", led_20_pins_a, ARRAY_SIZE(led_20_pins_a) },
+       { "led_21_grp_a", led_21_pins_a, ARRAY_SIZE(led_21_pins_a) },
+       { "led_22_grp_a", led_22_pins_a, ARRAY_SIZE(led_22_pins_a) },
+       { "led_23_grp_a", led_23_pins_a, ARRAY_SIZE(led_23_pins_a) },
+       { "led_24_grp_a", led_24_pins_a, ARRAY_SIZE(led_24_pins_a) },
+       { "led_25_grp_a", led_25_pins_a, ARRAY_SIZE(led_25_pins_a) },
+       { "led_26_grp_a", led_26_pins_a, ARRAY_SIZE(led_26_pins_a) },
+       { "led_27_grp_a", led_27_pins_a, ARRAY_SIZE(led_27_pins_a) },
+       { "led_28_grp_a", led_28_pins_a, ARRAY_SIZE(led_28_pins_a) },
+       { "led_29_grp_a", led_29_pins_a, ARRAY_SIZE(led_29_pins_a) },
+       { "led_30_grp_a", led_30_pins_a, ARRAY_SIZE(led_30_pins_a) },
+       { "led_31_grp_a", led_31_pins_a, ARRAY_SIZE(led_31_pins_a) },
+       { "led_10_grp_b", led_10_pins_b, ARRAY_SIZE(led_10_pins_b) },
+       { "led_11_grp_b", led_11_pins_b, ARRAY_SIZE(led_11_pins_b) },
+       { "led_12_grp_b", led_12_pins_b, ARRAY_SIZE(led_12_pins_b) },
+       { "led_13_grp_b", led_13_pins_b, ARRAY_SIZE(led_13_pins_b) },
+       { "led_31_grp_b", led_31_pins_b, ARRAY_SIZE(led_31_pins_b) },
+       { "hs_uart_grp", hs_uart_pins, ARRAY_SIZE(hs_uart_pins) },
+       { "i2c_grp_a", i2c_pins_a, ARRAY_SIZE(i2c_pins_a) },
+       { "i2c_grp_b", i2c_pins_b, ARRAY_SIZE(i2c_pins_b) },
+       { "i2s_grp", i2s_pins, ARRAY_SIZE(i2s_pins) },
+       { "nand_ctrl_grp", nand_ctrl_pins, ARRAY_SIZE(nand_ctrl_pins) },
+       { "nand_data_grp", nand_data_pins, ARRAY_SIZE(nand_data_pins) },
+       { "emmc_ctrl_grp", emmc_ctrl_pins, ARRAY_SIZE(emmc_ctrl_pins) },
+       { "usb0_pwr_grp", usb0_pwr_pins, ARRAY_SIZE(usb0_pwr_pins) },
+       { "usb1_pwr_grp", usb1_pwr_pins, ARRAY_SIZE(usb1_pwr_pins) },
+};
+
+/*
+ * Functions
+ */
+
+struct bcm4908_pinctrl_function {
+       const char *name;
+       const char * const *groups;
+       const unsigned int num_groups;
+};
+
+static const char * const led_0_groups[] = { "led_0_grp_a" };
+static const char * const led_1_groups[] = { "led_1_grp_a" };
+static const char * const led_2_groups[] = { "led_2_grp_a" };
+static const char * const led_3_groups[] = { "led_3_grp_a" };
+static const char * const led_4_groups[] = { "led_4_grp_a" };
+static const char * const led_5_groups[] = { "led_5_grp_a" };
+static const char * const led_6_groups[] = { "led_6_grp_a" };
+static const char * const led_7_groups[] = { "led_7_grp_a" };
+static const char * const led_8_groups[] = { "led_8_grp_a" };
+static const char * const led_9_groups[] = { "led_9_grp_a" };
+static const char * const led_10_groups[] = { "led_10_grp_a", "led_10_grp_b" };
+static const char * const led_11_groups[] = { "led_11_grp_a", "led_11_grp_b" };
+static const char * const led_12_groups[] = { "led_12_grp_a", "led_12_grp_b" };
+static const char * const led_13_groups[] = { "led_13_grp_a", "led_13_grp_b" };
+static const char * const led_14_groups[] = { "led_14_grp_a" };
+static const char * const led_15_groups[] = { "led_15_grp_a" };
+static const char * const led_16_groups[] = { "led_16_grp_a" };
+static const char * const led_17_groups[] = { "led_17_grp_a" };
+static const char * const led_18_groups[] = { "led_18_grp_a" };
+static const char * const led_19_groups[] = { "led_19_grp_a" };
+static const char * const led_20_groups[] = { "led_20_grp_a" };
+static const char * const led_21_groups[] = { "led_21_grp_a" };
+static const char * const led_22_groups[] = { "led_22_grp_a" };
+static const char * const led_23_groups[] = { "led_23_grp_a" };
+static const char * const led_24_groups[] = { "led_24_grp_a" };
+static const char * const led_25_groups[] = { "led_25_grp_a" };
+static const char * const led_26_groups[] = { "led_26_grp_a" };
+static const char * const led_27_groups[] = { "led_27_grp_a" };
+static const char * const led_28_groups[] = { "led_28_grp_a" };
+static const char * const led_29_groups[] = { "led_29_grp_a" };
+static const char * const led_30_groups[] = { "led_30_grp_a" };
+static const char * const led_31_groups[] = { "led_31_grp_a", "led_31_grp_b" };
+static const char * const hs_uart_groups[] = { "hs_uart_grp" };
+static const char * const i2c_groups[] = { "i2c_grp_a", "i2c_grp_b" };
+static const char * const i2s_groups[] = { "i2s_grp" };
+static const char * const nand_ctrl_groups[] = { "nand_ctrl_grp" };
+static const char * const nand_data_groups[] = { "nand_data_grp" };
+static const char * const emmc_ctrl_groups[] = { "emmc_ctrl_grp" };
+static const char * const usb0_pwr_groups[] = { "usb0_pwr_grp" };
+static const char * const usb1_pwr_groups[] = { "usb1_pwr_grp" };
+
+static const struct bcm4908_pinctrl_function bcm4908_pinctrl_functions[] = {
+       { "led_0", led_0_groups, ARRAY_SIZE(led_0_groups) },
+       { "led_1", led_1_groups, ARRAY_SIZE(led_1_groups) },
+       { "led_2", led_2_groups, ARRAY_SIZE(led_2_groups) },
+       { "led_3", led_3_groups, ARRAY_SIZE(led_3_groups) },
+       { "led_4", led_4_groups, ARRAY_SIZE(led_4_groups) },
+       { "led_5", led_5_groups, ARRAY_SIZE(led_5_groups) },
+       { "led_6", led_6_groups, ARRAY_SIZE(led_6_groups) },
+       { "led_7", led_7_groups, ARRAY_SIZE(led_7_groups) },
+       { "led_8", led_8_groups, ARRAY_SIZE(led_8_groups) },
+       { "led_9", led_9_groups, ARRAY_SIZE(led_9_groups) },
+       { "led_10", led_10_groups, ARRAY_SIZE(led_10_groups) },
+       { "led_11", led_11_groups, ARRAY_SIZE(led_11_groups) },
+       { "led_12", led_12_groups, ARRAY_SIZE(led_12_groups) },
+       { "led_13", led_13_groups, ARRAY_SIZE(led_13_groups) },
+       { "led_14", led_14_groups, ARRAY_SIZE(led_14_groups) },
+       { "led_15", led_15_groups, ARRAY_SIZE(led_15_groups) },
+       { "led_16", led_16_groups, ARRAY_SIZE(led_16_groups) },
+       { "led_17", led_17_groups, ARRAY_SIZE(led_17_groups) },
+       { "led_18", led_18_groups, ARRAY_SIZE(led_18_groups) },
+       { "led_19", led_19_groups, ARRAY_SIZE(led_19_groups) },
+       { "led_20", led_20_groups, ARRAY_SIZE(led_20_groups) },
+       { "led_21", led_21_groups, ARRAY_SIZE(led_21_groups) },
+       { "led_22", led_22_groups, ARRAY_SIZE(led_22_groups) },
+       { "led_23", led_23_groups, ARRAY_SIZE(led_23_groups) },
+       { "led_24", led_24_groups, ARRAY_SIZE(led_24_groups) },
+       { "led_25", led_25_groups, ARRAY_SIZE(led_25_groups) },
+       { "led_26", led_26_groups, ARRAY_SIZE(led_26_groups) },
+       { "led_27", led_27_groups, ARRAY_SIZE(led_27_groups) },
+       { "led_28", led_28_groups, ARRAY_SIZE(led_28_groups) },
+       { "led_29", led_29_groups, ARRAY_SIZE(led_29_groups) },
+       { "led_30", led_30_groups, ARRAY_SIZE(led_30_groups) },
+       { "led_31", led_31_groups, ARRAY_SIZE(led_31_groups) },
+       { "hs_uart", hs_uart_groups, ARRAY_SIZE(hs_uart_groups) },
+       { "i2c", i2c_groups, ARRAY_SIZE(i2c_groups) },
+       { "i2s", i2s_groups, ARRAY_SIZE(i2s_groups) },
+       { "nand_ctrl", nand_ctrl_groups, ARRAY_SIZE(nand_ctrl_groups) },
+       { "nand_data", nand_data_groups, ARRAY_SIZE(nand_data_groups) },
+       { "emmc_ctrl", emmc_ctrl_groups, ARRAY_SIZE(emmc_ctrl_groups) },
+       { "usb0_pwr", usb0_pwr_groups, ARRAY_SIZE(usb0_pwr_groups) },
+       { "usb1_pwr", usb1_pwr_groups, ARRAY_SIZE(usb1_pwr_groups) },
+};
+
+/*
+ * Groups code
+ */
+
+static const struct pinctrl_ops bcm4908_pinctrl_ops = {
+       .get_groups_count = pinctrl_generic_get_group_count,
+       .get_group_name = pinctrl_generic_get_group_name,
+       .get_group_pins = pinctrl_generic_get_group_pins,
+       .dt_node_to_map = pinconf_generic_dt_node_to_map_group,
+       .dt_free_map = pinconf_generic_dt_free_map,
+};
+
+/*
+ * Functions code
+ */
+
+static int bcm4908_pinctrl_set_mux(struct pinctrl_dev *pctrl_dev,
+                             unsigned int func_selector,
+                             unsigned int group_selector)
+{
+       struct bcm4908_pinctrl *bcm4908_pinctrl = pinctrl_dev_get_drvdata(pctrl_dev);
+       const struct bcm4908_pinctrl_grp *group;
+       struct group_desc *group_desc;
+       int i;
+
+       group_desc = pinctrl_generic_get_group(pctrl_dev, group_selector);
+       if (!group_desc)
+               return -EINVAL;
+       group = group_desc->data;
+
+       mutex_lock(&bcm4908_pinctrl->mutex);
+       for (i = 0; i < group->num_pins; i++) {
+               u32 lsb = 0;
+
+               lsb |= group->pins[i].number;
+               lsb |= group->pins[i].function << BCM4908_TEST_PORT_LSB_PINMUX_DATA_SHIFT;
+
+               writel(0x0, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_MSB);
+               writel(lsb, bcm4908_pinctrl->base + BCM4908_TEST_PORT_BLOCK_DATA_LSB);
+               writel(BCM4908_TEST_PORT_CMD_LOAD_MUX_REG,
+                      bcm4908_pinctrl->base + BCM4908_TEST_PORT_COMMAND);
+       }
+       mutex_unlock(&bcm4908_pinctrl->mutex);
+
+       return 0;
+}
+
+static const struct pinmux_ops bcm4908_pinctrl_pmxops = {
+       .get_functions_count = pinmux_generic_get_function_count,
+       .get_function_name = pinmux_generic_get_function_name,
+       .get_function_groups = pinmux_generic_get_function_groups,
+       .set_mux = bcm4908_pinctrl_set_mux,
+};
+
+/*
+ * Controller code
+ */
+
+static struct pinctrl_desc bcm4908_pinctrl_desc = {
+       .name = "bcm4908-pinctrl",
+       .pctlops = &bcm4908_pinctrl_ops,
+       .pmxops = &bcm4908_pinctrl_pmxops,
+};
+
+static const struct of_device_id bcm4908_pinctrl_of_match_table[] = {
+       { .compatible = "brcm,bcm4908-pinctrl", },
+       { }
+};
+
+static int bcm4908_pinctrl_probe(struct platform_device *pdev)
+{
+       struct device *dev = &pdev->dev;
+       struct bcm4908_pinctrl *bcm4908_pinctrl;
+       struct pinctrl_desc *pctldesc;
+       struct pinctrl_pin_desc *pins;
+       char **pin_names;
+       int i;
+
+       bcm4908_pinctrl = devm_kzalloc(dev, sizeof(*bcm4908_pinctrl), GFP_KERNEL);
+       if (!bcm4908_pinctrl)
+               return -ENOMEM;
+       pctldesc = &bcm4908_pinctrl->pctldesc;
+       platform_set_drvdata(pdev, bcm4908_pinctrl);
+
+       /* Set basic properties */
+
+       bcm4908_pinctrl->dev = dev;
+
+       bcm4908_pinctrl->base = devm_platform_ioremap_resource(pdev, 0);
+       if (IS_ERR(bcm4908_pinctrl->base))
+               return PTR_ERR(bcm4908_pinctrl->base);
+
+       mutex_init(&bcm4908_pinctrl->mutex);
+
+       memcpy(pctldesc, &bcm4908_pinctrl_desc, sizeof(*pctldesc));
+
+       /* Set pinctrl properties */
+
+       pin_names = devm_kasprintf_strarray(dev, "pin", BCM4908_NUM_PINS);
+       if (IS_ERR(pin_names))
+               return PTR_ERR(pin_names);
+
+       pins = devm_kcalloc(dev, BCM4908_NUM_PINS, sizeof(*pins), GFP_KERNEL);
+       if (!pins)
+               return -ENOMEM;
+       for (i = 0; i < BCM4908_NUM_PINS; i++) {
+               pins[i].number = i;
+               pins[i].name = pin_names[i];
+       }
+       pctldesc->pins = pins;
+       pctldesc->npins = BCM4908_NUM_PINS;
+
+       /* Register */
+
+       bcm4908_pinctrl->pctldev = devm_pinctrl_register(dev, pctldesc, bcm4908_pinctrl);
+       if (IS_ERR(bcm4908_pinctrl->pctldev))
+               return dev_err_probe(dev, PTR_ERR(bcm4908_pinctrl->pctldev),
+                                    "Failed to register pinctrl\n");
+
+       /* Groups */
+
+       for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_grps); i++) {
+               const struct bcm4908_pinctrl_grp *group = &bcm4908_pinctrl_grps[i];
+               int *pins;
+               int j;
+
+               pins = devm_kcalloc(dev, group->num_pins, sizeof(*pins), GFP_KERNEL);
+               if (!pins)
+                       return -ENOMEM;
+               for (j = 0; j < group->num_pins; j++)
+                       pins[j] = group->pins[j].number;
+
+               pinctrl_generic_add_group(bcm4908_pinctrl->pctldev, group->name,
+                                         pins, group->num_pins, (void *)group);
+       }
+
+       /* Functions */
+
+       for (i = 0; i < ARRAY_SIZE(bcm4908_pinctrl_functions); i++) {
+               const struct bcm4908_pinctrl_function *function = &bcm4908_pinctrl_functions[i];
+
+               pinmux_generic_add_function(bcm4908_pinctrl->pctldev,
+                                           function->name,
+                                           function->groups,
+                                           function->num_groups, NULL);
+       }
+
+       return 0;
+}
+
+static struct platform_driver bcm4908_pinctrl_driver = {
+       .probe = bcm4908_pinctrl_probe,
+       .driver = {
+               .name = "bcm4908-pinctrl",
+               .of_match_table = bcm4908_pinctrl_of_match_table,
+       },
+};
+
+module_platform_driver(bcm4908_pinctrl_driver);
+
+MODULE_AUTHOR("RafaÅ‚ MiÅ‚ecki");
+MODULE_LICENSE("GPL v2");
+MODULE_DEVICE_TABLE(of, bcm4908_pinctrl_of_match_table);
index b2855e3..d1955c6 100644 (file)
@@ -61,4 +61,10 @@ config PINCTRL_MESON_A1
        select PINCTRL_MESON_AXG_PMX
        default y
 
+config PINCTRL_MESON_S4
+       tristate "Meson s4 Soc pinctrl driver"
+       depends on ARM64
+       select PINCTRL_MESON_AXG_PMX
+       default y
+
 endif
index 1a5bffe..694f059 100644 (file)
@@ -9,3 +9,4 @@ obj-$(CONFIG_PINCTRL_MESON_AXG_PMX) += pinctrl-meson-axg-pmx.o
 obj-$(CONFIG_PINCTRL_MESON_AXG) += pinctrl-meson-axg.o
 obj-$(CONFIG_PINCTRL_MESON_G12A) += pinctrl-meson-g12a.o
 obj-$(CONFIG_PINCTRL_MESON_A1) += pinctrl-meson-a1.o
+obj-$(CONFIG_PINCTRL_MESON_S4) += pinctrl-meson-s4.o
index cd9656b..d182a57 100644 (file)
@@ -283,6 +283,8 @@ static const unsigned int pwm_d_x6_pins[]           = { GPIOX_6 };
 static const unsigned int pwm_e_pins[]                 = { GPIOX_16 };
 
 /* pwm_f */
+static const unsigned int pwm_f_z_pins[]               = { GPIOZ_12 };
+static const unsigned int pwm_f_a_pins[]               = { GPIOA_11 };
 static const unsigned int pwm_f_x_pins[]               = { GPIOX_7 };
 static const unsigned int pwm_f_h_pins[]               = { GPIOH_5 };
 
@@ -618,6 +620,7 @@ static struct meson_pmx_group meson_g12a_periphs_groups[] = {
        GROUP(tdm_c_dout2_z,            4),
        GROUP(tdm_c_dout3_z,            4),
        GROUP(mclk1_z,                  4),
+       GROUP(pwm_f_z,                  5),
 
        /* bank GPIOX */
        GROUP(sdio_d0,                  1),
@@ -768,6 +771,7 @@ static struct meson_pmx_group meson_g12a_periphs_groups[] = {
        GROUP(tdm_c_dout3_a,            2),
        GROUP(mclk0_a,                  1),
        GROUP(mclk1_a,                  2),
+       GROUP(pwm_f_a,                  3),
 };
 
 /* uart_ao_a */
@@ -1069,7 +1073,7 @@ static const char * const pwm_e_groups[] = {
 };
 
 static const char * const pwm_f_groups[] = {
-       "pwm_f_x", "pwm_f_h",
+       "pwm_f_z", "pwm_f_a", "pwm_f_x", "pwm_f_h",
 };
 
 static const char * const cec_ao_a_h_groups[] = {
diff --git a/drivers/pinctrl/meson/pinctrl-meson-s4.c b/drivers/pinctrl/meson/pinctrl-meson-s4.c
new file mode 100644 (file)
index 0000000..3c7358f
--- /dev/null
@@ -0,0 +1,1232 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Pin controller and GPIO driver for Amlogic Meson S4 SoC.
+ *
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
+ * Author: Qianggui Song <qianggui.song@amlogic.com>
+ */
+
+#include <dt-bindings/gpio/meson-s4-gpio.h>
+#include "pinctrl-meson.h"
+#include "pinctrl-meson-axg-pmx.h"
+
+static const struct pinctrl_pin_desc meson_s4_periphs_pins[] = {
+       MESON_PIN(GPIOE_0),
+       MESON_PIN(GPIOE_1),
+
+       MESON_PIN(GPIOB_0),
+       MESON_PIN(GPIOB_1),
+       MESON_PIN(GPIOB_2),
+       MESON_PIN(GPIOB_3),
+       MESON_PIN(GPIOB_4),
+       MESON_PIN(GPIOB_5),
+       MESON_PIN(GPIOB_6),
+       MESON_PIN(GPIOB_7),
+       MESON_PIN(GPIOB_8),
+       MESON_PIN(GPIOB_9),
+       MESON_PIN(GPIOB_10),
+       MESON_PIN(GPIOB_11),
+       MESON_PIN(GPIOB_12),
+       MESON_PIN(GPIOB_13),
+
+       MESON_PIN(GPIOC_0),
+       MESON_PIN(GPIOC_1),
+       MESON_PIN(GPIOC_2),
+       MESON_PIN(GPIOC_3),
+       MESON_PIN(GPIOC_4),
+       MESON_PIN(GPIOC_5),
+       MESON_PIN(GPIOC_6),
+       MESON_PIN(GPIOC_7),
+
+       MESON_PIN(GPIOD_0),
+       MESON_PIN(GPIOD_1),
+       MESON_PIN(GPIOD_2),
+       MESON_PIN(GPIOD_3),
+       MESON_PIN(GPIOD_4),
+       MESON_PIN(GPIOD_5),
+       MESON_PIN(GPIOD_6),
+       MESON_PIN(GPIOD_7),
+       MESON_PIN(GPIOD_8),
+       MESON_PIN(GPIOD_9),
+       MESON_PIN(GPIOD_10),
+       MESON_PIN(GPIOD_11),
+
+       MESON_PIN(GPIOH_0),
+       MESON_PIN(GPIOH_1),
+       MESON_PIN(GPIOH_2),
+       MESON_PIN(GPIOH_3),
+       MESON_PIN(GPIOH_4),
+       MESON_PIN(GPIOH_5),
+       MESON_PIN(GPIOH_6),
+       MESON_PIN(GPIOH_7),
+       MESON_PIN(GPIOH_8),
+       MESON_PIN(GPIOH_9),
+       MESON_PIN(GPIOH_10),
+       MESON_PIN(GPIOH_11),
+
+       MESON_PIN(GPIOX_0),
+       MESON_PIN(GPIOX_1),
+       MESON_PIN(GPIOX_2),
+       MESON_PIN(GPIOX_3),
+       MESON_PIN(GPIOX_4),
+       MESON_PIN(GPIOX_5),
+       MESON_PIN(GPIOX_6),
+       MESON_PIN(GPIOX_7),
+       MESON_PIN(GPIOX_8),
+       MESON_PIN(GPIOX_9),
+       MESON_PIN(GPIOX_10),
+       MESON_PIN(GPIOX_11),
+       MESON_PIN(GPIOX_12),
+       MESON_PIN(GPIOX_13),
+       MESON_PIN(GPIOX_14),
+       MESON_PIN(GPIOX_15),
+       MESON_PIN(GPIOX_16),
+       MESON_PIN(GPIOX_17),
+       MESON_PIN(GPIOX_18),
+       MESON_PIN(GPIOX_19),
+
+       MESON_PIN(GPIOZ_0),
+       MESON_PIN(GPIOZ_1),
+       MESON_PIN(GPIOZ_2),
+       MESON_PIN(GPIOZ_3),
+       MESON_PIN(GPIOZ_4),
+       MESON_PIN(GPIOZ_5),
+       MESON_PIN(GPIOZ_6),
+       MESON_PIN(GPIOZ_7),
+       MESON_PIN(GPIOZ_8),
+       MESON_PIN(GPIOZ_9),
+       MESON_PIN(GPIOZ_10),
+       MESON_PIN(GPIOZ_11),
+       MESON_PIN(GPIOZ_12),
+
+       MESON_PIN(GPIO_TEST_N),
+};
+
+/* BANK E func1 */
+static const unsigned int i2c0_sda_pins[]              = { GPIOE_0 };
+static const unsigned int i2c0_scl_pins[]              = { GPIOE_1 };
+
+/* BANK E func2 */
+static const unsigned int uart_b_tx_e_pins[]           = { GPIOE_0 };
+static const unsigned int uart_b_rx_e_pins[]           = { GPIOE_1 };
+
+/* BANK E func3 */
+static const unsigned int pwm_h_pins[]                 = { GPIOE_0 };
+static const unsigned int pwm_j_pins[]                 = { GPIOE_1 };
+
+/* BANK B func1 */
+static const unsigned int emmc_nand_d0_pins[]          = { GPIOB_0 };
+static const unsigned int emmc_nand_d1_pins[]          = { GPIOB_1 };
+static const unsigned int emmc_nand_d2_pins[]          = { GPIOB_2 };
+static const unsigned int emmc_nand_d3_pins[]          = { GPIOB_3 };
+static const unsigned int emmc_nand_d4_pins[]          = { GPIOB_4 };
+static const unsigned int emmc_nand_d5_pins[]          = { GPIOB_5 };
+static const unsigned int emmc_nand_d6_pins[]          = { GPIOB_6 };
+static const unsigned int emmc_nand_d7_pins[]          = { GPIOB_7 };
+static const unsigned int emmc_clk_pins[]              = { GPIOB_8 };
+static const unsigned int emmc_rst_pins[]              = { GPIOB_9 };
+static const unsigned int emmc_cmd_pins[]              = { GPIOB_10 };
+static const unsigned int emmc_nand_ds_pins[]          = { GPIOB_11 };
+
+/* Bank B func2 */
+static const unsigned int nand_wen_clk_pins[]          = { GPIOB_8 };
+static const unsigned int nand_ale_pins[]              = { GPIOB_9 };
+static const unsigned int nand_ren_wr_pins[]           = { GPIOB_10 };
+static const unsigned int nand_cle_pins[]              = { GPIOB_11 };
+static const unsigned int nand_ce0_pins[]              = { GPIOB_12 };
+
+/* Bank B func3 */
+static const unsigned int spif_hold_pins[]             = { GPIOB_3 };
+static const unsigned int spif_mo_pins[]               = { GPIOB_4 };
+static const unsigned int spif_mi_pins[]               = { GPIOB_5 };
+static const unsigned int spif_clk_pins[]              = { GPIOB_6 };
+static const unsigned int spif_wp_pins[]               = { GPIOB_7 };
+static const unsigned int spif_cs_pins[]               = { GPIOB_13 };
+
+/* Bank C func1 */
+static const unsigned int sdcard_d0_c_pins[]           = { GPIOC_0 };
+static const unsigned int sdcard_d1_c_pins[]           = { GPIOC_1 };
+static const unsigned int sdcard_d2_c_pins[]           = { GPIOC_2 };
+static const unsigned int sdcard_d3_c_pins[]           = { GPIOC_3 };
+static const unsigned int sdcard_clk_c_pins[]          = { GPIOC_4 };
+static const unsigned int sdcard_cmd_c_pins[]          = { GPIOC_5 };
+static const unsigned int sdcard_cd_pins[]             = { GPIOC_6 };
+
+/* Bank C func2 */
+static const unsigned int jtag_2_tdo_pins[]            = { GPIOC_0 };
+static const unsigned int jtag_2_tdi_pins[]            = { GPIOC_1 };
+static const unsigned int uart_b_rx_c_pins[]           = { GPIOC_2 };
+static const unsigned int uart_b_tx_c_pins[]           = { GPIOC_3 };
+static const unsigned int jtag_2_clk_pins[]            = { GPIOC_4 };
+static const unsigned int jtag_2_tms_pins[]            = { GPIOC_5 };
+static const unsigned int i2c1_sda_c_pins[]            = { GPIOC_6 };
+static const unsigned int i2c1_scl_c_pins[]            = { GPIOC_7 };
+
+/* Bank C func3 */
+static const unsigned int pdm_din1_c_pins[]            = { GPIOC_0 };
+static const unsigned int pdm_din0_c_pins[]            = { GPIOC_1 };
+static const unsigned int i2c4_sda_c_pins[]            = { GPIOC_2 };
+static const unsigned int i2c4_scl_c_pins[]            = { GPIOC_3 };
+static const unsigned int pdm_dclk_c_pins[]            = { GPIOC_4 };
+static const unsigned int iso7816_clk_c_pins[]         = { GPIOC_5 };
+static const unsigned int iso7816_data_c_pins[]                = { GPIOC_6 };
+
+/* Bank C func4 */
+static const unsigned int tdm_d2_c_pins[]              = { GPIOC_0 };
+static const unsigned int tdm_d3_c_pins[]              = { GPIOC_1 };
+static const unsigned int tdm_fs1_c_pins[]             = { GPIOC_2 };
+static const unsigned int tdm_sclk1_c_pins[]           = { GPIOC_3 };
+static const unsigned int mclk_1_c_pins[]              = { GPIOC_4 };
+static const unsigned int tdm_d4_c_pins[]              = { GPIOC_5 };
+static const unsigned int tdm_d5_c_pins[]              = { GPIOC_6 };
+
+/* Bank D func1 */
+static const unsigned int uart_b_tx_d_pins[]           = { GPIOD_0 };
+static const unsigned int uart_b_rx_d_pins[]           = { GPIOD_1 };
+static const unsigned int uart_b_cts_d_pins[]          = { GPIOD_2 };
+static const unsigned int uart_b_rts_d_pins[]          = { GPIOD_3 };
+static const unsigned int remote_out_pins[]            = { GPIOD_4 };
+static const unsigned int remote_in_pins[]             = { GPIOD_5 };
+static const unsigned int jtag_1_clk_pins[]            = { GPIOD_6 };
+static const unsigned int jtag_1_tms_pins[]            = { GPIOD_7 };
+static const unsigned int jtag_1_tdi_pins[]            = { GPIOD_8 };
+static const unsigned int jtag_1_tdo_pins[]            = { GPIOD_9 };
+static const unsigned int clk12_24_pins[]              = { GPIOD_10 };
+static const unsigned int pwm_g_hiz_pins[]             = { GPIOD_11 };
+
+/* Bank D func2 */
+static const unsigned int i2c4_sda_d_pins[]            = { GPIOD_2 };
+static const unsigned int i2c4_scl_d_pins[]            = { GPIOD_3 };
+static const unsigned int mclk_1_d_pins[]              = { GPIOD_4 };
+static const unsigned int tdm_sclk1_d_pins[]           = { GPIOD_6 };
+static const unsigned int tdm_fs1_d_pins[]             = { GPIOD_7 };
+static const unsigned int tdm_d4_d_pins[]              = { GPIOD_8 };
+static const unsigned int tdm_d3_d_pins[]              = { GPIOD_9 };
+static const unsigned int tdm_d2_d_pins[]              = { GPIOD_10 };
+static const unsigned int pwm_g_d_pins[]               = { GPIOD_11 };
+
+/* Bank D func3 */
+static const unsigned int uart_c_tx_pins[]             = { GPIOD_2 };
+static const unsigned int uart_c_rx_pins[]             = { GPIOD_3 };
+static const unsigned int pwm_b_d_pins[]               = { GPIOD_4 };
+static const unsigned int pwm_a_d_pins[]               = { GPIOD_6 };
+static const unsigned int pwm_c_d_pins[]               = { GPIOD_7 };
+static const unsigned int pwm_d_d_pins[]               = { GPIOD_8 };
+static const unsigned int pwm_i_d_pins[]               = { GPIOD_9 };
+
+/* Bank D func4 */
+static const unsigned int clk_32k_in_pins[]            = { GPIOD_2 };
+static const unsigned int pwm_b_hiz_pins[]             = { GPIOD_4 };
+static const unsigned int pwm_a_hiz_pins[]             = { GPIOD_6 };
+static const unsigned int pwm_c_hiz_pins[]             = { GPIOD_7 };
+static const unsigned int pdm_dclk_d_pins[]            = { GPIOD_8 };
+static const unsigned int pdm_din0_d_pins[]            = { GPIOD_9 };
+static const unsigned int pdm_din1_d_pins[]            = { GPIOD_10 };
+
+/* Bank D func5 */
+static const unsigned int mic_mute_en_pins[]           = { GPIOD_2 };
+static const unsigned int mic_mute_key_pins[]          = { GPIOD_3 };
+static const unsigned int i2c1_sda_d_pins[]            = { GPIOD_6 };
+static const unsigned int i2c1_scl_d_pins[]            = { GPIOD_7 };
+static const unsigned int i2c2_sda_d_pins[]            = { GPIOD_10 };
+static const unsigned int i2c2_scl_d_pins[]            = { GPIOD_11 };
+
+/* Bank D func6 */
+static const unsigned int gen_clk_d_pins[]             = { GPIOD_10 };
+static const unsigned int tsin_b_clk_c_pins[]          = { GPIOD_6 };
+static const unsigned int tsin_b_sop_c_pins[]          = { GPIOD_7 };
+static const unsigned int tsin_b_valid_c_pins[]                = { GPIOD_8 };
+static const unsigned int tsin_b_d0_c_pins[]           = { GPIOD_9 };
+
+/* Bank H func1 */
+static const unsigned int hdmitx_sda_pins[]            = { GPIOH_0 };
+static const unsigned int hdmitx_sck_pins[]            = { GPIOH_1 };
+static const unsigned int hdmitx_hpd_in_pins[]         = { GPIOH_2 };
+static const unsigned int ao_cec_a_pins[]              = { GPIOH_3 };
+static const unsigned int spdif_out_h_pins[]           = { GPIOH_4 };
+static const unsigned int spdif_in_pins[]              = { GPIOH_5 };
+static const unsigned int i2c1_sda_h_pins[]            = { GPIOH_6 };
+static const unsigned int i2c1_scl_h_pins[]            = { GPIOH_7 };
+static const unsigned int i2c2_sda_h8_pins[]           = { GPIOH_8 };
+static const unsigned int i2c2_scl_h9_pins[]           = { GPIOH_9 };
+static const unsigned int eth_link_led_pins[]          = { GPIOH_10 };
+static const unsigned int eth_act_led_pins[]           = { GPIOH_11 };
+
+/* Bank H func2 */
+static const unsigned int i2c2_sda_h0_pins[]           = { GPIOH_0 };
+static const unsigned int i2c2_scl_h1_pins[]           = { GPIOH_1 };
+static const unsigned int ao_cec_b_pins[]              = { GPIOH_3 };
+static const unsigned int uart_d_tx_h_pins[]           = { GPIOH_4 };
+static const unsigned int uart_d_rx_h_pins[]           = { GPIOH_5 };
+static const unsigned int uart_d_cts_h_pins[]          = { GPIOH_6 };
+static const unsigned int uart_d_rts_h_pins[]          = { GPIOH_7 };
+static const unsigned int iso7816_clk_h_pins[]         = { GPIOH_8 };
+static const unsigned int iso7816_data_h_pins[]                = { GPIOH_9 };
+static const unsigned int uart_e_tx_h_pins[]           = { GPIOH_10 };
+static const unsigned int uart_e_rx_h_pins[]           = { GPIOH_11 };
+
+/* Bank H func3 */
+static const unsigned int pwm_d_h_pins[]               = { GPIOH_6 };
+static const unsigned int pwm_i_h_pins[]               = { GPIOH_7 };
+static const unsigned int pdm_dclk_h_pins[]            = { GPIOH_8 };
+static const unsigned int pdm_din0_h_pins[]            = { GPIOH_9 };
+static const unsigned int pdm_din1_h_pins[]            = { GPIOH_10 };
+
+/* Bank H func4 */
+static const unsigned int mclk_1_h_pins[]              = { GPIOH_4 };
+static const unsigned int tdm_sclk1_h_pins[]           = { GPIOH_5 };
+static const unsigned int tdm_fs1_h_pins[]             = { GPIOH_6 };
+static const unsigned int tdm_d2_h_pins[]              = { GPIOH_7 };
+static const unsigned int tdm_d3_h_pins[]              = { GPIOH_8 };
+static const unsigned int tdm_d4_h_pins[]              = { GPIOH_9 };
+
+/* Bank H func5 */
+static const unsigned int spi_a_miso_h_pins[]          = { GPIOH_4 };
+static const unsigned int spi_a_mosi_h_pins[]          = { GPIOH_5 };
+static const unsigned int spi_a_clk_h_pins[]           = { GPIOH_6 };
+static const unsigned int spi_a_ss0_h_pins[]           = { GPIOH_7 };
+
+/* Bank H func6 */
+static const unsigned int gen_clk_h_pins[]             = { GPIOH_11 };
+static const unsigned int tsin_b1_clk_pins[]           = { GPIOH_4 };
+static const unsigned int tsin_b1_sop_pins[]           = { GPIOH_5 };
+static const unsigned int tsin_b1_valid_pins[]         = { GPIOH_6 };
+static const unsigned int tsin_b1_d0_pins[]            = { GPIOH_7 };
+
+/* Bank X func1 */
+static const unsigned int sdio_d0_pins[]               = { GPIOX_0 };
+static const unsigned int sdio_d1_pins[]               = { GPIOX_1 };
+static const unsigned int sdio_d2_pins[]               = { GPIOX_2 };
+static const unsigned int sdio_d3_pins[]               = { GPIOX_3 };
+static const unsigned int sdio_clk_pins[]              = { GPIOX_4 };
+static const unsigned int sdio_cmd_pins[]              = { GPIOX_5 };
+static const unsigned int pwm_a_x_pins[]               = { GPIOX_6 };
+static const unsigned int pwm_f_x_pins[]               = { GPIOX_7 };
+static const unsigned int tdm_d1_pins[]                        = { GPIOX_8 };
+static const unsigned int tdm_d0_pins[]                        = { GPIOX_9 };
+static const unsigned int tdm_fs0_pins[]               = { GPIOX_10 };
+static const unsigned int tdm_sclk0_pins[]             = { GPIOX_11 };
+static const unsigned int uart_a_tx_pins[]             = { GPIOX_12 };
+static const unsigned int uart_a_rx_pins[]             = { GPIOX_13 };
+static const unsigned int uart_a_cts_pins[]            = { GPIOX_14 };
+static const unsigned int uart_a_rts_pins[]            = { GPIOX_15 };
+static const unsigned int pwm_e_x_pins[]               = { GPIOX_16 };
+static const unsigned int i2c1_sda_x_pins[]            = { GPIOX_17 };
+static const unsigned int i2c1_scl_x_pins[]            = { GPIOX_18 };
+static const unsigned int pwm_b_x_pins[]               = { GPIOX_19 };
+
+/* Bank X func2 */
+static const unsigned int pdm_din0_x_pins[]            = { GPIOX_8 };
+static const unsigned int pdm_din1_x_pins[]            = { GPIOX_9 };
+static const unsigned int pdm_dclk_x_pins[]            = { GPIOX_11 };
+
+/* Bank X func3 */
+static const unsigned int spi_a_mosi_x_pins[]          = { GPIOX_8 };
+static const unsigned int spi_a_miso_x_pins[]          = { GPIOX_9 };
+static const unsigned int spi_a_ss0_x_pins[]           = { GPIOX_10 };
+static const unsigned int spi_a_clk_x_pins[]           = { GPIOX_11 };
+
+/* Bank X func4 */
+static const unsigned int pwm_c_x_pins[]               = { GPIOX_8 };
+static const unsigned int i2c_slave_scl_pins[]         = { GPIOX_10 };
+static const unsigned int i2c_slave_sda_pins[]         = { GPIOX_11 };
+
+/* Bank X func5 */
+static const unsigned int i2c3_sda_x_pins[]            = { GPIOX_10 };
+static const unsigned int i2c3_scl_x_pins[]            = { GPIOX_11 };
+
+/* Bank Z func1 */
+static const unsigned int tdm_fs2_pins[]               = { GPIOZ_0 };
+static const unsigned int tdm_sclk2_pins[]             = { GPIOZ_1 };
+static const unsigned int tdm_d4_z_pins[]              = { GPIOZ_2 };
+static const unsigned int tdm_d5_z_pins[]              = { GPIOZ_3 };
+static const unsigned int tdm_d6_pins[]                        = { GPIOZ_4 };
+static const unsigned int tdm_d7_pins[]                        = { GPIOZ_5 };
+static const unsigned int mclk_2_pins[]                        = { GPIOZ_6 };
+static const unsigned int spdif_out_z_pins[]           = { GPIOZ_9 };
+static const unsigned int dtv_a_if_agc_z10_pins[]      = { GPIOZ_10 };
+static const unsigned int uart_e_tx_z11_pins[]         = { GPIOZ_11 };
+static const unsigned int uart_e_rx_z12_pins[]         = { GPIOZ_12 };
+
+/* Bank Z func2 */
+static const unsigned int tsin_a_clk_pins[]            = { GPIOZ_0 };
+static const unsigned int tsin_a_sop_pins[]            = { GPIOZ_1 };
+static const unsigned int tsin_a_valid_pins[]          = { GPIOZ_2 };
+static const unsigned int tsin_a_din0_pins[]           = { GPIOZ_3 };
+static const unsigned int dtv_a_if_agc_z6_pins[]       = { GPIOZ_6 };
+static const unsigned int dtv_b_if_agc_pins[]          = { GPIOZ_7 };
+static const unsigned int i2c3_sda_z_pins[]            = { GPIOZ_8 };
+static const unsigned int i2c3_scl_z_pins[]            = { GPIOZ_9 };
+static const unsigned int dtv_a_rf_agc_pins[]          = { GPIOZ_10 };
+static const unsigned int dtv_b_rf_agc_pins[]          = { GPIOZ_11 };
+
+/* Bank Z func3 */
+static const unsigned int sdcard_d0_z_pins[]           = { GPIOZ_0 };
+static const unsigned int sdcard_d1_z_pins[]           = { GPIOZ_1 };
+static const unsigned int sdcard_d2_z_pins[]           = { GPIOZ_2 };
+static const unsigned int sdcard_d3_z_pins[]           = { GPIOZ_3 };
+static const unsigned int sdcard_clk_z_pins[]          = { GPIOZ_4 };
+static const unsigned int sdcard_cmd_z_pins[]          = { GPIOZ_5 };
+static const unsigned int uart_e_tx_z8_pins[]          = { GPIOZ_8 };
+static const unsigned int uart_e_rx_z9_pins[]          = { GPIOZ_9 };
+static const unsigned int pdm_din1_z_pins[]            = { GPIOZ_10 };
+static const unsigned int pdm_din0_z_pins[]            = { GPIOZ_11 };
+static const unsigned int pdm_dclk_z_pins[]            = { GPIOZ_12 };
+
+/* Bank Z func4 */
+static const unsigned int spi_a_miso_z_pins[]          = { GPIOZ_0 };
+static const unsigned int spi_a_mosi_z_pins[]          = { GPIOZ_1 };
+static const unsigned int spi_a_clk_z_pins[]           = { GPIOZ_2 };
+static const unsigned int spi_a_ss0_z_pins[]           = { GPIOZ_3 };
+static const unsigned int spi_a_ss1_z_pins[]           = { GPIOZ_4 };
+static const unsigned int spi_a_ss2_z_pins[]           = { GPIOZ_5 };
+static const unsigned int i2c4_scl_z_pins[]            = { GPIOZ_11 };
+static const unsigned int i2c4_sda_z_pins[]            = { GPIOZ_12 };
+
+/* Bank Z func5 */
+static const unsigned int uart_d_tx_z_pins[]           = { GPIOZ_0 };
+static const unsigned int uart_d_rx_z_pins[]           = { GPIOZ_1 };
+static const unsigned int uart_d_cts_z_pins[]          = { GPIOZ_2 };
+static const unsigned int uart_d_rts_z_pins[]          = { GPIOZ_3 };
+static const unsigned int pwm_g_z_pins[]               = { GPIOZ_4 };
+static const unsigned int pwm_f_z_pins[]               = { GPIOZ_5 };
+static const unsigned int pwm_e_z_pins[]               = { GPIOZ_6 };
+static const unsigned int tsin_b_clk_z_pins[]          = { GPIOZ_7 };
+static const unsigned int tsin_b_sop_z_pins[]          = { GPIOZ_10 };
+static const unsigned int tsin_b_valid_z_pins[]                = { GPIOZ_11 };
+static const unsigned int tsin_b_d0_z_pins[]           = { GPIOZ_12 };
+
+/* Bank Z func6 */
+static const unsigned int s2_demod_gpio7_pins[]                = { GPIOZ_0 };
+static const unsigned int s2_demod_gpio6_pins[]                = { GPIOZ_1 };
+static const unsigned int s2_demod_gpio5_pins[]                = { GPIOZ_2 };
+static const unsigned int s2_demod_gpio4_pins[]                = { GPIOZ_3 };
+static const unsigned int s2_demod_gpio3_pins[]                = { GPIOZ_4 };
+static const unsigned int s2_demod_gpio2_pins[]                = { GPIOZ_5 };
+static const unsigned int diseqc_out_pins[]            = { GPIOZ_7 };
+static const unsigned int s2_demod_gpio1_pins[]                = { GPIOZ_8 };
+static const unsigned int s2_demod_gpio0_pins[]                = { GPIOZ_12 };
+
+/* Bank Z func7 */
+static const unsigned int gen_clk_z9_pins[]            = { GPIOZ_9 };
+static const unsigned int gen_clk_z12_pins[]           = { GPIOZ_12 };
+
+static struct meson_pmx_group meson_s4_periphs_groups[] = {
+       GPIO_GROUP(GPIOE_0),
+       GPIO_GROUP(GPIOE_1),
+
+       GPIO_GROUP(GPIOB_0),
+       GPIO_GROUP(GPIOB_1),
+       GPIO_GROUP(GPIOB_2),
+       GPIO_GROUP(GPIOB_3),
+       GPIO_GROUP(GPIOB_4),
+       GPIO_GROUP(GPIOB_5),
+       GPIO_GROUP(GPIOB_6),
+       GPIO_GROUP(GPIOB_7),
+       GPIO_GROUP(GPIOB_8),
+       GPIO_GROUP(GPIOB_9),
+       GPIO_GROUP(GPIOB_10),
+       GPIO_GROUP(GPIOB_11),
+       GPIO_GROUP(GPIOB_12),
+       GPIO_GROUP(GPIOB_13),
+
+       GPIO_GROUP(GPIOC_0),
+       GPIO_GROUP(GPIOC_1),
+       GPIO_GROUP(GPIOC_2),
+       GPIO_GROUP(GPIOC_3),
+       GPIO_GROUP(GPIOC_4),
+       GPIO_GROUP(GPIOC_5),
+       GPIO_GROUP(GPIOC_6),
+       GPIO_GROUP(GPIOC_7),
+
+       GPIO_GROUP(GPIOD_0),
+       GPIO_GROUP(GPIOD_1),
+       GPIO_GROUP(GPIOD_2),
+       GPIO_GROUP(GPIOD_3),
+       GPIO_GROUP(GPIOD_4),
+       GPIO_GROUP(GPIOD_5),
+       GPIO_GROUP(GPIOD_6),
+       GPIO_GROUP(GPIOD_7),
+       GPIO_GROUP(GPIOD_8),
+       GPIO_GROUP(GPIOD_9),
+       GPIO_GROUP(GPIOD_10),
+       GPIO_GROUP(GPIOD_11),
+
+       GPIO_GROUP(GPIOH_0),
+       GPIO_GROUP(GPIOH_1),
+       GPIO_GROUP(GPIOH_2),
+       GPIO_GROUP(GPIOH_3),
+       GPIO_GROUP(GPIOH_4),
+       GPIO_GROUP(GPIOH_5),
+       GPIO_GROUP(GPIOH_6),
+       GPIO_GROUP(GPIOH_7),
+       GPIO_GROUP(GPIOH_8),
+       GPIO_GROUP(GPIOH_9),
+       GPIO_GROUP(GPIOH_10),
+       GPIO_GROUP(GPIOH_11),
+
+       GPIO_GROUP(GPIOX_0),
+       GPIO_GROUP(GPIOX_1),
+       GPIO_GROUP(GPIOX_2),
+       GPIO_GROUP(GPIOX_3),
+       GPIO_GROUP(GPIOX_4),
+       GPIO_GROUP(GPIOX_5),
+       GPIO_GROUP(GPIOX_6),
+       GPIO_GROUP(GPIOX_7),
+       GPIO_GROUP(GPIOX_8),
+       GPIO_GROUP(GPIOX_9),
+       GPIO_GROUP(GPIOX_10),
+       GPIO_GROUP(GPIOX_11),
+       GPIO_GROUP(GPIOX_12),
+       GPIO_GROUP(GPIOX_13),
+       GPIO_GROUP(GPIOX_14),
+       GPIO_GROUP(GPIOX_15),
+       GPIO_GROUP(GPIOX_16),
+       GPIO_GROUP(GPIOX_17),
+       GPIO_GROUP(GPIOX_18),
+       GPIO_GROUP(GPIOX_19),
+
+       GPIO_GROUP(GPIOZ_0),
+       GPIO_GROUP(GPIOZ_1),
+       GPIO_GROUP(GPIOZ_2),
+       GPIO_GROUP(GPIOZ_3),
+       GPIO_GROUP(GPIOZ_4),
+       GPIO_GROUP(GPIOZ_5),
+       GPIO_GROUP(GPIOZ_6),
+       GPIO_GROUP(GPIOZ_7),
+       GPIO_GROUP(GPIOZ_8),
+       GPIO_GROUP(GPIOZ_9),
+       GPIO_GROUP(GPIOZ_10),
+       GPIO_GROUP(GPIOZ_11),
+       GPIO_GROUP(GPIOZ_12),
+
+       GPIO_GROUP(GPIO_TEST_N),
+
+       /* BANK E func1 */
+       GROUP(i2c0_sda,                 1),
+       GROUP(i2c0_scl,                 1),
+
+       /* BANK E func2 */
+       GROUP(uart_b_tx_e,              2),
+       GROUP(uart_b_rx_e,              2),
+
+       /* BANK E func3 */
+       GROUP(pwm_h,                    3),
+       GROUP(pwm_j,                    3),
+
+       /* BANK B func1 */
+       GROUP(emmc_nand_d0,             1),
+       GROUP(emmc_nand_d1,             1),
+       GROUP(emmc_nand_d2,             1),
+       GROUP(emmc_nand_d3,             1),
+       GROUP(emmc_nand_d4,             1),
+       GROUP(emmc_nand_d5,             1),
+       GROUP(emmc_nand_d6,             1),
+       GROUP(emmc_nand_d7,             1),
+       GROUP(emmc_clk,                 1),
+       GROUP(emmc_rst,                 1),
+       GROUP(emmc_cmd,                 1),
+       GROUP(emmc_nand_ds,             1),
+
+       /* Bank B func2 */
+       GROUP(nand_wen_clk,             2),
+       GROUP(nand_ale,                 2),
+       GROUP(nand_ren_wr,              2),
+       GROUP(nand_cle,                 2),
+       GROUP(nand_ce0,                 2),
+
+       /* Bank B func3 */
+       GROUP(spif_hold,                3),
+       GROUP(spif_mo,                  3),
+       GROUP(spif_mi,                  3),
+       GROUP(spif_clk,                 3),
+       GROUP(spif_wp,                  3),
+       GROUP(spif_cs,                  3),
+
+       /* Bank C func1 */
+       GROUP(sdcard_d0_c,              1),
+       GROUP(sdcard_d1_c,              1),
+       GROUP(sdcard_d2_c,              1),
+       GROUP(sdcard_d3_c,              1),
+       GROUP(sdcard_clk_c,             1),
+       GROUP(sdcard_cmd_c,             1),
+       GROUP(sdcard_cd,                1),
+
+       /* Bank C func2 */
+       GROUP(jtag_2_tdo,               2),
+       GROUP(jtag_2_tdi,               2),
+       GROUP(uart_b_rx_c,              2),
+       GROUP(uart_b_tx_c,              2),
+       GROUP(jtag_2_clk,               2),
+       GROUP(jtag_2_tms,               2),
+       GROUP(i2c1_sda_c,               2),
+       GROUP(i2c1_scl_c,               2),
+
+       /* Bank C func3 */
+       GROUP(pdm_din1_c,               3),
+       GROUP(pdm_din0_c,               3),
+       GROUP(i2c4_sda_c,               3),
+       GROUP(i2c4_scl_c,               3),
+       GROUP(pdm_dclk_c,               3),
+       GROUP(iso7816_clk_c,            3),
+       GROUP(iso7816_data_c,           3),
+
+       /* Bank C func4 */
+       GROUP(tdm_d2_c,                 4),
+       GROUP(tdm_d3_c,                 4),
+       GROUP(tdm_fs1_c,                4),
+       GROUP(mclk_1_c,                 4),
+       GROUP(tdm_d4_c,                 4),
+       GROUP(tdm_d5_c,                 4),
+
+       /* Bank D func1 */
+       GROUP(uart_b_tx_d,              1),
+       GROUP(uart_b_rx_d,              1),
+       GROUP(uart_b_cts_d,             1),
+       GROUP(uart_b_rts_d,             1),
+       GROUP(remote_out,               1),
+       GROUP(remote_in,                1),
+       GROUP(jtag_1_clk,               1),
+       GROUP(jtag_1_tms,               1),
+       GROUP(jtag_1_tdi,               1),
+       GROUP(jtag_1_tdo,               1),
+       GROUP(clk12_24,                 1),
+       GROUP(pwm_g_hiz,                1),
+
+       /* Bank D func2 */
+       GROUP(i2c4_sda_d,               2),
+       GROUP(i2c4_scl_d,               2),
+       GROUP(mclk_1_d,                 2),
+       GROUP(tdm_sclk1_d,              2),
+       GROUP(tdm_fs1_d,                2),
+       GROUP(tdm_d4_d,                 2),
+       GROUP(tdm_d3_d,                 2),
+       GROUP(tdm_d2_d,                 2),
+       GROUP(pwm_g_d,                  2),
+
+       /* Bank D func3 */
+       GROUP(uart_c_tx,                3),
+       GROUP(uart_c_rx,                3),
+       GROUP(pwm_b_d,                  3),
+       GROUP(pwm_a_d,                  3),
+       GROUP(pwm_c_d,                  3),
+       GROUP(pwm_d_d,                  3),
+       GROUP(pwm_i_d,                  3),
+
+       /* Bank D func4 */
+       GROUP(clk_32k_in,               4),
+       GROUP(pwm_b_hiz,                4),
+       GROUP(pwm_a_hiz,                4),
+       GROUP(pwm_c_hiz,                4),
+       GROUP(pdm_dclk_d,               4),
+       GROUP(pdm_din0_d,               4),
+       GROUP(pdm_din1_d,               4),
+
+       /* Bank D func5 */
+       GROUP(mic_mute_en,              5),
+       GROUP(mic_mute_key,             5),
+       GROUP(i2c1_sda_d,               5),
+       GROUP(i2c1_scl_d,               5),
+       GROUP(i2c2_sda_d,               5),
+       GROUP(i2c2_scl_d,               5),
+
+       /* Bank D func6 */
+       GROUP(gen_clk_d,                6),
+       GROUP(tsin_b_clk_c,             6),
+       GROUP(tsin_b_sop_c,             6),
+       GROUP(tsin_b_valid_c,           6),
+       GROUP(tsin_b_d0_c,              6),
+
+       /* Bank H func1 */
+       GROUP(hdmitx_sda,               1),
+       GROUP(hdmitx_sck,               1),
+       GROUP(hdmitx_hpd_in,            1),
+       GROUP(ao_cec_a,                 1),
+       GROUP(spdif_out_h,              1),
+       GROUP(spdif_in,                 1),
+       GROUP(i2c1_sda_h,               1),
+       GROUP(i2c1_scl_h,               1),
+       GROUP(i2c2_sda_h8,              1),
+       GROUP(i2c2_scl_h9,              1),
+       GROUP(eth_link_led,             1),
+       GROUP(eth_act_led,              1),
+
+       /* Bank H func2 */
+       GROUP(i2c2_sda_h0,              2),
+       GROUP(i2c2_scl_h1,              2),
+       GROUP(ao_cec_b,                 2),
+       GROUP(uart_d_tx_h,              2),
+       GROUP(uart_d_rx_h,              2),
+       GROUP(uart_d_cts_h,             2),
+       GROUP(uart_d_rts_h,             2),
+       GROUP(iso7816_clk_h,            2),
+       GROUP(iso7816_data_h,           2),
+       GROUP(uart_e_tx_h,              2),
+       GROUP(uart_e_rx_h,              2),
+
+       /* Bank H func3 */
+       GROUP(pwm_d_h,                  3),
+       GROUP(pwm_i_h,                  3),
+       GROUP(pdm_dclk_h,               3),
+       GROUP(pdm_din0_h,               3),
+       GROUP(pdm_din1_h,               3),
+
+       /* Bank H func4 */
+       GROUP(mclk_1_h,                 4),
+       GROUP(tdm_sclk1_h,              4),
+       GROUP(tdm_fs1_h,                4),
+       GROUP(tdm_d2_h,                 4),
+       GROUP(tdm_d3_h,                 4),
+       GROUP(tdm_d4_h,                 4),
+
+       /* Bank H func5 */
+       GROUP(spi_a_miso_h,             5),
+       GROUP(spi_a_mosi_h,             5),
+       GROUP(spi_a_clk_h,              5),
+       GROUP(spi_a_ss0_h,              5),
+
+       /* Bank H func6 */
+       GROUP(gen_clk_h,                6),
+       GROUP(tsin_b1_clk,              6),
+       GROUP(tsin_b1_sop,              6),
+       GROUP(tsin_b1_valid,            6),
+       GROUP(tsin_b1_d0,               6),
+
+       /* Bank X func1 */
+       GROUP(sdio_d0,                  1),
+       GROUP(sdio_d1,                  1),
+       GROUP(sdio_d2,                  1),
+       GROUP(sdio_d3,                  1),
+       GROUP(sdio_clk,                 1),
+       GROUP(sdio_cmd,                 1),
+       GROUP(pwm_a_x,                  1),
+       GROUP(pwm_f_x,                  1),
+       GROUP(tdm_d1,                   1),
+       GROUP(tdm_d0,                   1),
+       GROUP(tdm_fs0,                  1),
+       GROUP(tdm_sclk0,                1),
+       GROUP(uart_a_tx,                1),
+       GROUP(uart_a_rx,                1),
+       GROUP(uart_a_cts,               1),
+       GROUP(uart_a_rts,               1),
+       GROUP(pwm_e_x,                  1),
+       GROUP(i2c1_sda_x,               1),
+       GROUP(i2c1_scl_x,               1),
+       GROUP(pwm_b_x,                  1),
+
+       /* Bank X func2 */
+       GROUP(pdm_din0_x,               2),
+       GROUP(pdm_din1_x,               2),
+       GROUP(pdm_dclk_x,               2),
+
+       /* Bank X func3 */
+       GROUP(spi_a_mosi_x,             3),
+       GROUP(spi_a_miso_x,             3),
+       GROUP(spi_a_ss0_x,              3),
+       GROUP(spi_a_clk_x,              3),
+
+       /* Bank X func4 */
+       GROUP(pwm_c_x,                  4),
+       GROUP(i2c_slave_scl,            4),
+       GROUP(i2c_slave_sda,            4),
+
+       /* Bank X func5 */
+       GROUP(i2c3_sda_x,               5),
+       GROUP(i2c3_scl_x,               5),
+
+       /* Bank Z func1 */
+       GROUP(tdm_fs2,                  1),
+       GROUP(tdm_sclk2,                1),
+       GROUP(tdm_d4_z,                 1),
+       GROUP(tdm_d5_z,                 1),
+       GROUP(tdm_d6,                   1),
+       GROUP(tdm_d7,                   1),
+       GROUP(mclk_2,                   1),
+       GROUP(spdif_out_z,              1),
+       GROUP(dtv_a_if_agc_z10,         1),
+       GROUP(uart_e_tx_z11,            1),
+       GROUP(uart_e_rx_z12,            1),
+
+       /* Bank Z func2 */
+       GROUP(tsin_a_clk,               2),
+       GROUP(tsin_a_sop,               2),
+       GROUP(tsin_a_valid,             2),
+       GROUP(tsin_a_din0,              2),
+       GROUP(dtv_a_if_agc_z6,          2),
+       GROUP(dtv_b_if_agc,             2),
+       GROUP(i2c3_sda_z,               2),
+       GROUP(i2c3_scl_z,               2),
+       GROUP(dtv_a_rf_agc,             2),
+       GROUP(dtv_b_rf_agc,             2),
+
+       /* Bank Z func3 */
+       GROUP(sdcard_d0_z,              3),
+       GROUP(sdcard_d1_z,              3),
+       GROUP(sdcard_d2_z,              3),
+       GROUP(sdcard_d3_z,              3),
+       GROUP(sdcard_clk_z,             3),
+       GROUP(sdcard_cmd_z,             3),
+       GROUP(uart_e_tx_z8,             3),
+       GROUP(uart_e_rx_z9,             3),
+       GROUP(pdm_din1_z,               3),
+       GROUP(pdm_din0_z,               3),
+       GROUP(pdm_dclk_z,               3),
+
+       /* Bank Z func4 */
+       GROUP(spi_a_miso_z,             4),
+       GROUP(spi_a_mosi_z,             4),
+       GROUP(spi_a_clk_z,              4),
+       GROUP(spi_a_ss0_z,              4),
+       GROUP(spi_a_ss1_z,              4),
+       GROUP(spi_a_ss2_z,              4),
+       GROUP(i2c4_scl_z,               4),
+       GROUP(i2c4_sda_z,               4),
+
+       /* Bank Z func5 */
+       GROUP(uart_d_tx_z,              5),
+       GROUP(uart_d_rx_z,              5),
+       GROUP(uart_d_cts_z,             5),
+       GROUP(uart_d_rts_z,             5),
+       GROUP(pwm_g_z,                  5),
+       GROUP(pwm_f_z,                  5),
+       GROUP(pwm_e_z,                  5),
+       GROUP(tsin_b_clk_z,             5),
+       GROUP(tsin_b_sop_z,             5),
+       GROUP(tsin_b_valid_z,           5),
+       GROUP(tsin_b_d0_z,              5),
+
+       /* Bank Z func6 */
+       GROUP(s2_demod_gpio7,           6),
+       GROUP(s2_demod_gpio6,           6),
+       GROUP(s2_demod_gpio5,           6),
+       GROUP(s2_demod_gpio4,           6),
+       GROUP(s2_demod_gpio3,           6),
+       GROUP(s2_demod_gpio2,           6),
+       GROUP(diseqc_out,               6),
+       GROUP(s2_demod_gpio1,           6),
+       GROUP(s2_demod_gpio0,           6),
+
+       /* Bank Z func7 */
+       GROUP(gen_clk_z9,               7),
+       GROUP(gen_clk_z12,              7),
+};
+
+static const char * const gpio_periphs_groups[] = {
+       "GPIOE_0", "GPIOE_1",
+
+       "GPIOB_0", "GPIOB_1", "GPIOB_2", "GPIOB_3", "GPIOB_4", "GPIOB_5",
+       "GPIOB_6", "GPIOB_7", "GPIOB_8", "GPIOB_9", "GPIOB_10", "GPIOB_11",
+       "GPIOB_12", "GPIOB_13",
+
+       "GPIOC_0", "GPIOC_1", "GPIOC_2", "GPIOC_3", "GPIOC_4", "GPIOC_5",
+       "GPIOC_6", "GPIOC_7",
+
+       "GPIOD_0", "GPIOD_1", "GPIOD_2", "GPIOD_3", "GPIOD_4", "GPIOD_5",
+       "GPIOD_6", "GPIOD_7", "GPIOD_8", "GPIOD_9", "GPIOD_10", "GPIOD_11",
+
+       "GPIOH_0", "GPIOH_1", "GPIOH_2", "GPIOH_3", "GPIOH_4", "GPIOH_5",
+       "GPIOH_6", "GPIOH_7", "GPIOH_8", "GPIOH_9", "GPIOH_10", "GPIOH_11",
+
+       "GPIOX_0", "GPIOX_1", "GPIOX_2", "GPIOX_3", "GPIOX_4", "GPIOX_5",
+       "GPIOX_6", "GPIOX_7", "GPIOX_8", "GPIOX_9", "GPIOX_10", "GPIOX_11",
+       "GPIOX_12", "GPIOX_13", "GPIOX_14", "GPIOX_15", "GPIOX_16", "GPIOX_17",
+       "GPIOX_18", "GPIOX_19",
+
+       "GPIOZ_0", "GPIOZ_1", "GPIOZ_2", "GPIOZ_3", "GPIOZ_4", "GPIOZ_5",
+       "GPIOZ_6", "GPIOZ_7", "GPIOZ_8", "GPIOZ_9", "GPIOZ_10",
+       "GPIOZ_11", "GPIOZ_12",
+
+       "GPIO_TEST_N",
+};
+
+static const char * const i2c0_groups[] = {
+       "i2c0_sda", "i2c0_scl",
+};
+
+static const char * const i2c1_groups[] = {
+       "i2c1_sda_c", "i2c1_scl_c",
+       "i2c1_sda_d", "i2c1_scl_d",
+       "i2c1_sda_h", "i2c1_scl_h",
+       "i2c1_sda_x", "i2c1_scl_x",
+};
+
+static const char * const i2c2_groups[] = {
+       "i2c2_sda_d", "i2c2_scl_d",
+       "i2c2_sda_h8", "i2c2_scl_h9",
+       "i2c2_sda_h0", "i2c2_scl_h1l,"
+};
+
+static const char * const i2c3_groups[] = {
+       "i2c3_sda_x", "i2c3_scl_x",
+       "i2c3_sda_z", "i2c3_scl_z",
+};
+
+static const char * const i2c4_groups[] = {
+       "i2c4_sda_c", "i2c4_scl_c",
+       "i2c4_sda_d", "i2c4_scl_d",
+       "i2c4_scl_z", "i2c4_sda_z",
+};
+
+static const char * const uart_a_groups[] = {
+       "uart_a_tx", "uart_a_rx", "uart_a_cts", "uart_a_rts",
+};
+
+static const char * const uart_b_groups[] = {
+       "uart_b_tx_e", "uart_b_rx_e", "uart_b_rx_c", "uart_b_tx_c",
+       "uart_b_tx_d", "uart_b_rx_d", "uart_b_cts_d", "uart_b_rts_d",
+};
+
+static const char * const uart_c_groups[] = {
+       "uart_c_tx", "uart_c_rx",
+};
+
+static const char * const uart_d_groups[] = {
+       "uart_d_tx_h", "uart_d_rx_h", "uart_d_cts_h", "uart_d_rts_h",
+       "uart_d_tx_z", "uart_d_rx_z", "uart_d_cts_z", "uart_d_rts_z",
+};
+
+static const char * const uart_e_groups[] = {
+       "uart_e_tx_h", "uart_e_rx_h", "uart_e_tx_z11", "uart_e_rx_z12",
+       "uart_e_tx_z8", "uart_e_rx_z9",
+};
+
+static const char * const emmc_groups[] = {
+       "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
+       "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
+       "emmc_clk", "emmc_rst", "emmc_cmd", "emmc_nand_ds",
+};
+
+static const char * const nand_groups[] = {
+       "emmc_nand_d0", "emmc_nand_d1", "emmc_nand_d2", "emmc_nand_d3",
+       "emmc_nand_d4", "emmc_nand_d5", "emmc_nand_d6", "emmc_nand_d7",
+       "nand_wen_clk", "nand_ale", "nand_ren_wr", "nand_cle", "nand_ce0",
+};
+
+static const char * const spif_groups[] = {
+       "spif_hold", "spif_mo", "spif_mi", "spif_clk", "spif_wp",
+       "spif_cs",
+};
+
+static const char * const sdcard_groups[] = {
+       "sdcard_d0_c", "sdcard_d1_c", "sdcard_d2_c", "sdcard_d3_c",
+       "sdcard_clk_c", "sdcard_cmd_c", "sdcard_cd",
+       "sdcard_d0_z", "sdcard_d1_z", "sdcard_d2_z", "sdcard_d3_z",
+       "sdcard_clk_z", "sdcard_cmd_z",
+};
+
+static const char * const jtag_1_groups[] = {
+       "jtag_1_clk", "jtag_1_tms", "jtag_1_tdi", "jtag_1_tdo",
+};
+
+static const char * const jtag_2_groups[] = {
+       "jtag_2_tdo", "jtag_2_tdi", "jtag_2_clk", "jtag_2_tms",
+};
+
+static const char * const pdm_groups[] = {
+       "pdm_din1_c", "pdm_din0_c", "pdm_dclk_c",
+       "pdm_dclk_d", "pdm_din0_d", "pdm_din1_d",
+       "pdm_dclk_h", "pdm_din0_h", "pdm_din1_h",
+       "pdm_din0_x", "pdm_din1_x", "pdm_dclk_x",
+       "pdm_din1_z", "pdm_din0_z", "pdm_dclk_z",
+};
+
+static const char * const iso7816_groups[] = {
+       "iso7816_clk_c", "iso7816_data_c",
+       "iso7816_clk_h", "iso7816_data_h",
+};
+
+static const char * const tdm_groups[] = {
+       "tdm_d2_c", "tdm_d3_c", "tdm_fs1_c", "tdm_d4_c", "tdm_d5_c",
+       "tdm_fs1_d", "tdm_d4_d", "tdm_d3_d", "tdm_d2_d", "tdm_sclk1_d",
+       "tdm_sclk1_h", "tdm_fs1_h", "tdm_d2_h", "tdm_d3_h", "tdm_d4_h",
+       "tdm_d1", "tdm_d0", "tdm_fs0", "tdm_sclk0", "tdm_fs2", "tdm_sclk2",
+       "tdm_d4_z", "tdm_d5_z", "tdm_d6", "tdm_d7",
+};
+
+static const char * const mclk_1_groups[] = {
+       "mclk_1_c", "mclk_1_d", "mclk_1_h", "mclk_2",
+};
+
+static const char * const mclk_2_groups[] = {
+       "mclk_2",
+};
+
+static const char * const remote_out_groups[] = {
+       "remote_out",
+};
+
+static const char * const remote_in_groups[] = {
+       "remote_in",
+};
+
+static const char * const clk12_24_groups[] = {
+       "clk12_24",
+};
+
+static const char * const clk_32k_in_groups[] = {
+       "clk_32k_in",
+};
+
+static const char * const pwm_a_hiz_groups[] = {
+       "pwm_a_hiz",
+};
+
+static const char * const pwm_b_hiz_groups[] = {
+       "pwm_b_hiz",
+};
+
+static const char * const pwm_c_hiz_groups[] = {
+       "pwm_c_hiz",
+};
+
+static const char * const pwm_g_hiz_groups[] = {
+       "pwm_g_hiz",
+};
+
+static const char * const pwm_a_groups[] = {
+       "pwm_a_d",
+};
+
+static const char * const pwm_b_groups[] = {
+       "pwm_b_d", "pwm_b_x",
+};
+
+static const char * const pwm_c_groups[] = {
+       "pwm_c_d", "pwm_c_x",
+};
+
+static const char * const pwm_d_groups[] = {
+       "pwm_d_d", "pwm_d_h",
+};
+
+static const char * const pwm_e_groups[] = {
+       "pwm_e_x", "pwm_e_z",
+};
+
+static const char * const pwm_f_groups[] = {
+       "pwm_f_x", "pwm_f_z",
+};
+
+static const char * const pwm_g_groups[] = {
+       "pwm_g_d", "pwm_g_z",
+};
+
+static const char * const pwm_h_groups[] = {
+       "pwm_h",
+};
+
+static const char * const pwm_i_groups[] = {
+       "pwm_i_d", "pwm_i_h"
+};
+
+static const char * const pwm_j_groups[] = {
+       "pwm_j",
+};
+
+static const char * const mic_mute_groups[] = {
+       "mic_mute_en", "mic_mute_key",
+};
+
+static const char * const hdmitx_groups[] = {
+       "hdmitx_sda", "hdmitx_sck", "hdmitx_hpd_in",
+};
+
+static const char * const ao_cec_a_groups[] = {
+       "ao_cec_a",
+};
+
+static const char * const ao_cec_b_groups[] = {
+       "ao_cec_b",
+};
+
+static const char * const spdif_out_groups[] = {
+       "spdif_out_h", "spdif_out_z",
+};
+
+static const char * const spdif_in_groups[] = {
+       "spdif_in",
+};
+
+static const char * const eth_groups[] = {
+       "eth_link_led", "eth_act_led",
+};
+
+static const char * const spi_a_groups[] = {
+       "spi_a_miso_h", "spi_a_mosi_h", "spi_a_clk_h", "spi_a_ss0_h",
+
+       "spi_a_mosi_x", "spi_a_miso_x", "spi_a_ss0_x", "spi_a_clk_x",
+
+       "spi_a_miso_z", "spi_a_mosi_z", "spi_a_clk_z", "spi_a_ss0_z",
+       "spi_a_ss1_z", "spi_a_ss2_z",
+};
+
+static const char * const gen_clk_groups[] = {
+       "gen_clk_h", "gen_clk_z9", "gen_clk_z12",
+};
+
+static const char * const sdio_groups[] = {
+       "sdio_d0", "sdio_d1", "sdio_d2", "sdio_d3", "sdio_clk", "sdio_cmd",
+};
+
+static const char * const i2c_slave_groups[] = {
+       "i2c_slave_scl", "i2c_slave_sda",
+};
+
+static const char * const dtv_groups[] = {
+       "dtv_a_if_agc_z10", "dtv_a_if_agc_z6", "dtv_b_if_agc",
+       "dtv_a_rf_agc", "dtv_b_rf_agc",
+};
+
+static const char * const tsin_a_groups[] = {
+       "tsin_a_clk", "tsin_a_sop", "tsin_a_valid", "tsin_a_din0",
+};
+
+static const char * const tsin_b_groups[] = {
+       "tsin_b_clk_c", "tsin_b_sop_c", "tsin_b_valid_c", "tsin_b_d0_c",
+       "tsin_b_clk_z", "tsin_b_sop_z", "tsin_b_valid_z", "tsin_b_d0_z",
+};
+
+static const char * const tsin_b1_groups[] = {
+       "tsin_b1_clk", "tsin_b1_sop", "tsin_b1_valid", "tsin_b1_d0",
+};
+
+static const char * const diseqc_out_groups[] = {
+       "diseqc_out",
+};
+
+static const char * const s2_demod_groups[] = {
+       "s2_demod_gpio7", "s2_demod_gpio6", "s2_demod_gpio5", "s2_demod_gpio4",
+       "s2_demod_gpio3", "s2_demod_gpio2", "s2_demod_gpio1", "s2_demod_gpio0",
+};
+
+static struct meson_pmx_func meson_s4_periphs_functions[] = {
+       FUNCTION(gpio_periphs),
+       FUNCTION(i2c0),
+       FUNCTION(i2c1),
+       FUNCTION(i2c2),
+       FUNCTION(i2c3),
+       FUNCTION(i2c4),
+       FUNCTION(uart_a),
+       FUNCTION(uart_b),
+       FUNCTION(uart_c),
+       FUNCTION(uart_d),
+       FUNCTION(uart_e),
+       FUNCTION(emmc),
+       FUNCTION(nand),
+       FUNCTION(spif),
+       FUNCTION(sdcard),
+       FUNCTION(jtag_1),
+       FUNCTION(jtag_2),
+       FUNCTION(pdm),
+       FUNCTION(iso7816),
+       FUNCTION(tdm),
+       FUNCTION(mclk_1),
+       FUNCTION(mclk_2),
+       FUNCTION(remote_out),
+       FUNCTION(remote_in),
+       FUNCTION(clk12_24),
+       FUNCTION(clk_32k_in),
+       FUNCTION(pwm_a_hiz),
+       FUNCTION(pwm_b_hiz),
+       FUNCTION(pwm_c_hiz),
+       FUNCTION(pwm_g_hiz),
+       FUNCTION(pwm_a),
+       FUNCTION(pwm_b),
+       FUNCTION(pwm_c),
+       FUNCTION(pwm_d),
+       FUNCTION(pwm_e),
+       FUNCTION(pwm_f),
+       FUNCTION(pwm_g),
+       FUNCTION(pwm_h),
+       FUNCTION(pwm_i),
+       FUNCTION(pwm_j),
+       FUNCTION(mic_mute),
+       FUNCTION(hdmitx),
+       FUNCTION(ao_cec_a),
+       FUNCTION(ao_cec_b),
+       FUNCTION(spdif_out),
+       FUNCTION(spdif_in),
+       FUNCTION(eth),
+       FUNCTION(spi_a),
+       FUNCTION(gen_clk),
+       FUNCTION(sdio),
+       FUNCTION(i2c_slave),
+       FUNCTION(dtv),
+       FUNCTION(tsin_a),
+       FUNCTION(tsin_b),
+       FUNCTION(tsin_b1),
+       FUNCTION(diseqc_out),
+       FUNCTION(s2_demod),
+};
+
+static struct meson_bank meson_s4_periphs_banks[] = {
+       /* name  first  last  irq  pullen  pull  dir  out  in */
+       BANK_DS("B", GPIOB_0,    GPIOB_13,  0, 13,
+               0x63,  0,  0x64,  0,  0x62, 0,  0x61, 0,  0x60, 0, 0x67, 0),
+       BANK_DS("C", GPIOC_0,    GPIOC_7,   14, 21,
+               0x53,  0,  0x54,  0,  0x52, 0,  0x51, 0,  0x50, 0, 0x57, 0),
+       BANK_DS("E", GPIOE_0,    GPIOE_1,   22, 23,
+               0x43,  0,  0x44,  0,  0x42, 0,  0x41, 0,  0x40, 0, 0x47, 0),
+       BANK_DS("D", GPIOD_0,    GPIOD_11,  24, 35,
+               0x33,  0,  0x34,  0,  0x32, 0,  0x31, 0,  0x30, 0, 0x37, 0),
+       BANK_DS("H", GPIOH_0,    GPIOH_11,  36, 47,
+               0x23,  0,  0x24,  0,  0x22, 0,  0x21, 0,  0x20, 0, 0x27, 0),
+       BANK_DS("X", GPIOX_0,    GPIOX_19,   48, 67,
+               0x13,  0,  0x14,  0,  0x12, 0,  0x11, 0,  0x10, 0, 0x17, 0),
+       BANK_DS("Z", GPIOZ_0,    GPIOZ_12,  68, 80,
+               0x03,  0,  0x04,  0,  0x02, 0,  0x01, 0,  0x00, 0, 0x07, 0),
+       BANK_DS("TEST_N", GPIO_TEST_N,    GPIO_TEST_N,   -1, -1,
+               0x83,  0,  0x84,  0,  0x82, 0,  0x81,  0, 0x80, 0, 0x87, 0),
+};
+
+static struct meson_pmx_bank meson_s4_periphs_pmx_banks[] = {
+       /*name              first        lask        reg offset*/
+       BANK_PMX("B",      GPIOB_0,     GPIOB_13,    0x00, 0),
+       BANK_PMX("C",      GPIOC_0,     GPIOC_7,     0x9,  0),
+       BANK_PMX("E",      GPIOE_0,     GPIOE_1,     0x12, 0),
+       BANK_PMX("D",      GPIOD_0,     GPIOD_11,    0x10, 0),
+       BANK_PMX("H",      GPIOH_0,     GPIOH_11,    0xb,  0),
+       BANK_PMX("X",      GPIOX_0,     GPIOX_19,    0x3,  0),
+       BANK_PMX("Z",      GPIOZ_0,     GPIOZ_12,    0x6,  0),
+       BANK_PMX("TEST_N", GPIO_TEST_N, GPIO_TEST_N, 0xf,  0)
+};
+
+static struct meson_axg_pmx_data meson_s4_periphs_pmx_banks_data = {
+       .pmx_banks      = meson_s4_periphs_pmx_banks,
+       .num_pmx_banks  = ARRAY_SIZE(meson_s4_periphs_pmx_banks),
+};
+
+static struct meson_pinctrl_data meson_s4_periphs_pinctrl_data = {
+       .name           = "periphs-banks",
+       .pins           = meson_s4_periphs_pins,
+       .groups         = meson_s4_periphs_groups,
+       .funcs          = meson_s4_periphs_functions,
+       .banks          = meson_s4_periphs_banks,
+       .num_pins       = ARRAY_SIZE(meson_s4_periphs_pins),
+       .num_groups     = ARRAY_SIZE(meson_s4_periphs_groups),
+       .num_funcs      = ARRAY_SIZE(meson_s4_periphs_functions),
+       .num_banks      = ARRAY_SIZE(meson_s4_periphs_banks),
+       .pmx_ops        = &meson_axg_pmx_ops,
+       .pmx_data       = &meson_s4_periphs_pmx_banks_data,
+       .parse_dt       = &meson_a1_parse_dt_extra,
+};
+
+static const struct of_device_id meson_s4_pinctrl_dt_match[] = {
+       {
+               .compatible = "amlogic,meson-s4-periphs-pinctrl",
+               .data = &meson_s4_periphs_pinctrl_data,
+       },
+       { }
+};
+MODULE_DEVICE_TABLE(of, meson_s4_pinctrl_dt_match);
+
+static struct platform_driver meson_s4_pinctrl_driver = {
+       .probe  = meson_pinctrl_probe,
+       .driver = {
+               .name   = "meson-s4-pinctrl",
+               .of_match_table = meson_s4_pinctrl_dt_match,
+       },
+};
+module_platform_driver(meson_s4_pinctrl_driver);
+
+MODULE_LICENSE("Dual BSD/GPL");
index 4d81908..6656bac 100644 (file)
@@ -905,7 +905,7 @@ static struct npcm7xx_func npcm7xx_funcs[] = {
 #define DRIVE_STRENGTH_HI_SHIFT                12
 #define DRIVE_STRENGTH_MASK            0x0000FF00
 
-#define DS(lo, hi)     (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
+#define DSTR(lo, hi)   (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
                         ((hi) << DRIVE_STRENGTH_HI_SHIFT))
 #define DSLO(x)                (((x) >> DRIVE_STRENGTH_LO_SHIFT) & 0xF)
 #define DSHI(x)                (((x) >> DRIVE_STRENGTH_HI_SHIFT) & 0xF)
@@ -925,31 +925,31 @@ struct npcm7xx_pincfg {
 static const struct npcm7xx_pincfg pincfg[] = {
        /*              PIN       FUNCTION 1               FUNCTION 2             FUNCTION 3        FLAGS */
        NPCM7XX_PINCFG(0,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(1,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(2,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(1,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(2,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(3,        iox1, MFSEL1, 30,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(4,        iox2, MFSEL3, 14,       smb1d, I2CSEGSEL, 7,   none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(5,        iox2, MFSEL3, 14,       smb1d, I2CSEGSEL, 7,   none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(6,        iox2, MFSEL3, 14,       smb2d, I2CSEGSEL, 10,  none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(7,        iox2, MFSEL3, 14,       smb2d, I2CSEGSEL, 10,  none, NONE, 0,       SLEW),
-       NPCM7XX_PINCFG(8,      lkgpo1, FLOCKR1, 4,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(9,      lkgpo2, FLOCKR1, 8,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(10,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(11,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(8,      lkgpo1, FLOCKR1, 4,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(9,      lkgpo2, FLOCKR1, 8,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(10,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(11,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(12,       gspi, MFSEL1, 24,       smb5b, I2CSEGSEL, 19,  none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(13,       gspi, MFSEL1, 24,       smb5b, I2CSEGSEL, 19,  none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(14,       gspi, MFSEL1, 24,       smb5c, I2CSEGSEL, 20,  none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(15,       gspi, MFSEL1, 24,       smb5c, I2CSEGSEL, 20,  none, NONE, 0,       SLEW),
-       NPCM7XX_PINCFG(16,     lkgpo0, FLOCKR1, 0,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(17,      pspi2, MFSEL3, 13,     smb4den, I2CSEGSEL, 23,  none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(18,      pspi2, MFSEL3, 13,       smb4b, I2CSEGSEL, 14,  none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(19,      pspi2, MFSEL3, 13,       smb4b, I2CSEGSEL, 14,  none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(16,     lkgpo0, FLOCKR1, 0,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(17,      pspi2, MFSEL3, 13,     smb4den, I2CSEGSEL, 23,  none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(18,      pspi2, MFSEL3, 13,       smb4b, I2CSEGSEL, 14,  none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(19,      pspi2, MFSEL3, 13,       smb4b, I2CSEGSEL, 14,  none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(20,      smb4c, I2CSEGSEL, 15,    smb15, MFSEL3, 8,      none, NONE, 0,       0),
        NPCM7XX_PINCFG(21,      smb4c, I2CSEGSEL, 15,    smb15, MFSEL3, 8,      none, NONE, 0,       0),
        NPCM7XX_PINCFG(22,      smb4d, I2CSEGSEL, 16,    smb14, MFSEL3, 7,      none, NONE, 0,       0),
        NPCM7XX_PINCFG(23,      smb4d, I2CSEGSEL, 16,    smb14, MFSEL3, 7,      none, NONE, 0,       0),
-       NPCM7XX_PINCFG(24,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(25,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(24,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(25,       ioxh, MFSEL3, 18,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(26,       smb5, MFSEL1, 2,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(27,       smb5, MFSEL1, 2,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(28,       smb4, MFSEL1, 1,         none, NONE, 0,        none, NONE, 0,       0),
@@ -965,12 +965,12 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(39,      smb3b, I2CSEGSEL, 11,     none, NONE, 0,        none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(40,      smb3b, I2CSEGSEL, 11,     none, NONE, 0,        none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(41,  bmcuart0a, MFSEL1, 9,         none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(42,  bmcuart0a, MFSEL1, 9,         none, NONE, 0,        none, NONE, 0,       DS(2, 4) | GPO),
+       NPCM7XX_PINCFG(42,  bmcuart0a, MFSEL1, 9,         none, NONE, 0,        none, NONE, 0,       DSTR(2, 4) | GPO),
        NPCM7XX_PINCFG(43,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,  bmcuart1, MFSEL3, 24,    0),
        NPCM7XX_PINCFG(44,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,  bmcuart1, MFSEL3, 24,    0),
        NPCM7XX_PINCFG(45,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,      none, NONE, 0,       0),
-       NPCM7XX_PINCFG(46,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,      none, NONE, 0,       DS(2, 8)),
-       NPCM7XX_PINCFG(47,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,      none, NONE, 0,       DS(2, 8)),
+       NPCM7XX_PINCFG(46,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,      none, NONE, 0,       DSTR(2, 8)),
+       NPCM7XX_PINCFG(47,      uart1, MFSEL1, 10,       jtag2, MFSEL4, 0,      none, NONE, 0,       DSTR(2, 8)),
        NPCM7XX_PINCFG(48,      uart2, MFSEL1, 11,   bmcuart0b, MFSEL4, 1,      none, NONE, 0,       GPO),
        NPCM7XX_PINCFG(49,      uart2, MFSEL1, 11,   bmcuart0b, MFSEL4, 1,      none, NONE, 0,       0),
        NPCM7XX_PINCFG(50,      uart2, MFSEL1, 11,        none, NONE, 0,        none, NONE, 0,       0),
@@ -980,8 +980,8 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(54,      uart2, MFSEL1, 11,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(55,      uart2, MFSEL1, 11,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(56,      r1err, MFSEL1, 12,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(57,       r1md, MFSEL1, 13,        none, NONE, 0,        none, NONE, 0,       DS(2, 4)),
-       NPCM7XX_PINCFG(58,       r1md, MFSEL1, 13,        none, NONE, 0,        none, NONE, 0,       DS(2, 4)),
+       NPCM7XX_PINCFG(57,       r1md, MFSEL1, 13,        none, NONE, 0,        none, NONE, 0,       DSTR(2, 4)),
+       NPCM7XX_PINCFG(58,       r1md, MFSEL1, 13,        none, NONE, 0,        none, NONE, 0,       DSTR(2, 4)),
        NPCM7XX_PINCFG(59,      smb3d, I2CSEGSEL, 13,     none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(60,      smb3d, I2CSEGSEL, 13,     none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(61,      uart1, MFSEL1, 10,        none, NONE, 0,        none, NONE, 0,     GPO),
@@ -1004,19 +1004,19 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(77,    fanin13, MFSEL2, 13,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(78,    fanin14, MFSEL2, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(79,    fanin15, MFSEL2, 15,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(80,       pwm0, MFSEL2, 16,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(81,       pwm1, MFSEL2, 17,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(82,       pwm2, MFSEL2, 18,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(83,       pwm3, MFSEL2, 19,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(84,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(85,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(86,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(80,       pwm0, MFSEL2, 16,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(81,       pwm1, MFSEL2, 17,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(82,       pwm2, MFSEL2, 18,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(83,       pwm3, MFSEL2, 19,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(84,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(85,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(86,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(87,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(88,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(89,         r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(90,      r2err, MFSEL1, 15,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(91,       r2md, MFSEL1, 16,        none, NONE, 0,        none, NONE, 0,       DS(2, 4)),
-       NPCM7XX_PINCFG(92,       r2md, MFSEL1, 16,        none, NONE, 0,        none, NONE, 0,       DS(2, 4)),
+       NPCM7XX_PINCFG(91,       r2md, MFSEL1, 16,        none, NONE, 0,        none, NONE, 0,       DSTR(2, 4)),
+       NPCM7XX_PINCFG(92,       r2md, MFSEL1, 16,        none, NONE, 0,        none, NONE, 0,       DSTR(2, 4)),
        NPCM7XX_PINCFG(93,    ga20kbc, MFSEL1, 17,       smb5d, I2CSEGSEL, 21,  none, NONE, 0,       0),
        NPCM7XX_PINCFG(94,    ga20kbc, MFSEL1, 17,       smb5d, I2CSEGSEL, 21,  none, NONE, 0,       0),
        NPCM7XX_PINCFG(95,        lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    0),
@@ -1062,34 +1062,34 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(133,     smb10, MFSEL4, 13,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(134,     smb11, MFSEL4, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(135,     smb11, MFSEL4, 14,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(136,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(137,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(138,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(139,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(140,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(136,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(137,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(138,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(139,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(140,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(141,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(142,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(142,       sd1, MFSEL3, 12,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(143,       sd1, MFSEL3, 12,      sd1pwr, MFSEL4, 5,      none, NONE, 0,       0),
-       NPCM7XX_PINCFG(144,      pwm4, MFSEL2, 20,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(145,      pwm5, MFSEL2, 21,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(146,      pwm6, MFSEL2, 22,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(147,      pwm7, MFSEL2, 23,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(148,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(149,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(150,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(151,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(152,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(144,      pwm4, MFSEL2, 20,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(145,      pwm5, MFSEL2, 21,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(146,      pwm6, MFSEL2, 22,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(147,      pwm7, MFSEL2, 23,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(148,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(149,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(150,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(151,      mmc8, MFSEL3, 11,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(152,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(153,     mmcwp, FLOCKR1, 24,       none, NONE, 0,        none, NONE, 0,       0),  /* Z1/A1 */
-       NPCM7XX_PINCFG(154,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(154,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(155,     mmccd, MFSEL3, 25,      mmcrst, MFSEL4, 6,      none, NONE, 0,       0),  /* Z1/A1 */
-       NPCM7XX_PINCFG(156,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(157,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(158,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(159,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-
-       NPCM7XX_PINCFG(160,    clkout, MFSEL1, 21,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(161,       lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    DS(8, 12)),
-       NPCM7XX_PINCFG(162,    serirq, NONE, 0,           gpio, MFSEL1, 31,     none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(156,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(157,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(158,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(159,       mmc, MFSEL3, 10,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+
+       NPCM7XX_PINCFG(160,    clkout, MFSEL1, 21,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(161,       lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    DSTR(8, 12)),
+       NPCM7XX_PINCFG(162,    serirq, NONE, 0,           gpio, MFSEL1, 31,     none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(163,       lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    0),
        NPCM7XX_PINCFG(164,       lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    SLEWLPC),
        NPCM7XX_PINCFG(165,       lpc, NONE, 0,           espi, MFSEL4, 8,      gpio, MFSEL1, 26,    SLEWLPC),
@@ -1102,25 +1102,25 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(172,      smb6, MFSEL3, 1,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(173,      smb7, MFSEL3, 2,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(174,      smb7, MFSEL3, 2,         none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(175,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(176,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(177,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(178,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(179,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(180,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
+       NPCM7XX_PINCFG(175,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(176,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(177,     pspi1, MFSEL3, 4,       faninx, MFSEL3, 3,      none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(178,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(179,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(180,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
        NPCM7XX_PINCFG(181,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(182,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(183,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(184,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW | GPO),
-       NPCM7XX_PINCFG(185,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW | GPO),
-       NPCM7XX_PINCFG(186,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(187,   spi3cs1, MFSEL4, 17,        none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
-       NPCM7XX_PINCFG(188,  spi3quad, MFSEL4, 20,     spi3cs2, MFSEL4, 18,     none, NONE, 0,    DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(189,  spi3quad, MFSEL4, 20,     spi3cs3, MFSEL4, 19,     none, NONE, 0,    DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(190,      gpio, FLOCKR1, 20,   nprd_smi, NONE, 0,        none, NONE, 0,       DS(2, 4)),
-       NPCM7XX_PINCFG(191,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       DS(8, 12)),  /* XX */
-
-       NPCM7XX_PINCFG(192,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       DS(8, 12)),  /* XX */
+       NPCM7XX_PINCFG(183,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(184,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW | GPO),
+       NPCM7XX_PINCFG(185,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW | GPO),
+       NPCM7XX_PINCFG(186,     spi3, MFSEL4, 16,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(187,   spi3cs1, MFSEL4, 17,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
+       NPCM7XX_PINCFG(188,  spi3quad, MFSEL4, 20,     spi3cs2, MFSEL4, 18,     none, NONE, 0,    DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(189,  spi3quad, MFSEL4, 20,     spi3cs3, MFSEL4, 19,     none, NONE, 0,    DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(190,      gpio, FLOCKR1, 20,   nprd_smi, NONE, 0,        none, NONE, 0,       DSTR(2, 4)),
+       NPCM7XX_PINCFG(191,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),  /* XX */
+
+       NPCM7XX_PINCFG(192,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),  /* XX */
        NPCM7XX_PINCFG(193,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(194,     smb0b, I2CSEGSEL, 0,      none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(195,     smb0b, I2CSEGSEL, 0,      none, NONE, 0,        none, NONE, 0,       0),
@@ -1131,11 +1131,11 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(200,        r2, MFSEL1, 14,        none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(201,        r1, MFSEL3, 9,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(202,     smb0c, I2CSEGSEL, 1,      none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(203,    faninx, MFSEL3, 3,         none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(203,    faninx, MFSEL3, 3,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(204,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       SLEW),
        NPCM7XX_PINCFG(205,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       SLEW),
-       NPCM7XX_PINCFG(206,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       DS(4, 8)),
-       NPCM7XX_PINCFG(207,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       DS(4, 8)),
+       NPCM7XX_PINCFG(206,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       DSTR(4, 8)),
+       NPCM7XX_PINCFG(207,       ddc, NONE, 0,           gpio, MFSEL3, 22,     none, NONE, 0,       DSTR(4, 8)),
        NPCM7XX_PINCFG(208,       rg2, MFSEL4, 24,         ddr, MFSEL3, 26,     none, NONE, 0,       0),
        NPCM7XX_PINCFG(209,       rg2, MFSEL4, 24,         ddr, MFSEL3, 26,     none, NONE, 0,       0),
        NPCM7XX_PINCFG(210,       rg2, MFSEL4, 24,         ddr, MFSEL3, 26,     none, NONE, 0,       0),
@@ -1147,20 +1147,20 @@ static const struct npcm7xx_pincfg pincfg[] = {
        NPCM7XX_PINCFG(216,   rg2mdio, MFSEL4, 23,         ddr, MFSEL3, 26,     none, NONE, 0,       0),
        NPCM7XX_PINCFG(217,   rg2mdio, MFSEL4, 23,         ddr, MFSEL3, 26,     none, NONE, 0,       0),
        NPCM7XX_PINCFG(218,     wdog1, MFSEL3, 19,        none, NONE, 0,        none, NONE, 0,       0),
-       NPCM7XX_PINCFG(219,     wdog2, MFSEL3, 20,        none, NONE, 0,        none, NONE, 0,       DS(4, 8)),
+       NPCM7XX_PINCFG(219,     wdog2, MFSEL3, 20,        none, NONE, 0,        none, NONE, 0,       DSTR(4, 8)),
        NPCM7XX_PINCFG(220,     smb12, MFSEL3, 5,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(221,     smb12, MFSEL3, 5,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(222,     smb13, MFSEL3, 6,         none, NONE, 0,        none, NONE, 0,       0),
        NPCM7XX_PINCFG(223,     smb13, MFSEL3, 6,         none, NONE, 0,        none, NONE, 0,       0),
 
        NPCM7XX_PINCFG(224,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       SLEW),
-       NPCM7XX_PINCFG(225,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW | GPO),
-       NPCM7XX_PINCFG(226,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW | GPO),
-       NPCM7XX_PINCFG(227,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(228,   spixcs1, MFSEL4, 28,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(229,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(230,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DS(8, 12) | SLEW),
-       NPCM7XX_PINCFG(231,    clkreq, MFSEL4, 9,         none, NONE, 0,        none, NONE, 0,       DS(8, 12)),
+       NPCM7XX_PINCFG(225,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW | GPO),
+       NPCM7XX_PINCFG(226,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW | GPO),
+       NPCM7XX_PINCFG(227,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(228,   spixcs1, MFSEL4, 28,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(229,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(230,      spix, MFSEL4, 27,        none, NONE, 0,        none, NONE, 0,       DSTR(8, 12) | SLEW),
+       NPCM7XX_PINCFG(231,    clkreq, MFSEL4, 9,         none, NONE, 0,        none, NONE, 0,       DSTR(8, 12)),
        NPCM7XX_PINCFG(253,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       GPI), /* SDHC1 power */
        NPCM7XX_PINCFG(254,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       GPI), /* SDHC2 power */
        NPCM7XX_PINCFG(255,      none, NONE, 0,           none, NONE, 0,        none, NONE, 0,       GPI), /* DACOSEL */
@@ -1561,7 +1561,7 @@ static int npcm7xx_get_groups_count(struct pinctrl_dev *pctldev)
 {
        struct npcm7xx_pinctrl *npcm = pinctrl_dev_get_drvdata(pctldev);
 
-       dev_dbg(npcm->dev, "group size: %d\n", ARRAY_SIZE(npcm7xx_groups));
+       dev_dbg(npcm->dev, "group size: %zu\n", ARRAY_SIZE(npcm7xx_groups));
        return ARRAY_SIZE(npcm7xx_groups);
 }
 
index fafd1f5..517f2a6 100644 (file)
@@ -1045,7 +1045,6 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
        const char **group_names;
        const struct of_device_id *match;
        int i, ret;
-       struct resource *res;
        struct atmel_pioctrl *atmel_pioctrl;
        const struct atmel_pioctrl_data *atmel_pioctrl_data;
 
@@ -1164,16 +1163,15 @@ static int atmel_pinctrl_probe(struct platform_device *pdev)
 
        /* There is one controller but each bank has its own irq line. */
        for (i = 0; i < atmel_pioctrl->nbanks; i++) {
-               res = platform_get_resource(pdev, IORESOURCE_IRQ, i);
-               if (!res) {
-                       dev_err(dev, "missing irq resource for group %c\n",
+               ret = platform_get_irq(pdev, i);
+               if (ret < 0) {
+                       dev_dbg(dev, "missing irq resource for group %c\n",
                                'A' + i);
-                       return -EINVAL;
+                       return ret;
                }
-               atmel_pioctrl->irqs[i] = res->start;
-               irq_set_chained_handler_and_data(res->start,
-                       atmel_gpio_irq_handler, atmel_pioctrl);
-               dev_dbg(dev, "bank %i: irq=%pr\n", i, res);
+               atmel_pioctrl->irqs[i] = ret;
+               irq_set_chained_handler_and_data(ret, atmel_gpio_irq_handler, atmel_pioctrl);
+               dev_dbg(dev, "bank %i: irq=%d\n", i, ret);
        }
 
        atmel_pioctrl->irq_domain = irq_domain_add_linear(dev->of_node,
index fc96920..685c79e 100644 (file)
@@ -695,6 +695,98 @@ static const struct pinctrl_pin_desc jaguar2_pins[] = {
        JAGUAR2_PIN(63),
 };
 
+#define SERVALT_P(p, f0, f1, f2)                                       \
+static struct ocelot_pin_caps servalt_pin_##p = {                      \
+       .pin = p,                                                       \
+       .functions = {                                                  \
+               FUNC_GPIO, FUNC_##f0, FUNC_##f1, FUNC_##f2              \
+       },                                                              \
+}
+
+SERVALT_P(0,  SG0,        NONE,      NONE);
+SERVALT_P(1,  SG0,        NONE,      NONE);
+SERVALT_P(2,  SG0,        NONE,      NONE);
+SERVALT_P(3,  SG0,        NONE,      NONE);
+SERVALT_P(4,  IRQ0_IN,    IRQ0_OUT,  TWI_SCL_M);
+SERVALT_P(5,  IRQ1_IN,    IRQ1_OUT,  TWI_SCL_M);
+SERVALT_P(6,  UART,       NONE,      NONE);
+SERVALT_P(7,  UART,       NONE,      NONE);
+SERVALT_P(8,  SI,         SFP,       TWI_SCL_M);
+SERVALT_P(9,  PCI_WAKE,   SFP,       SI);
+SERVALT_P(10, PTP0,       SFP,       TWI_SCL_M);
+SERVALT_P(11, PTP1,       SFP,       TWI_SCL_M);
+SERVALT_P(12, REF_CLK,    SFP,       TWI_SCL_M);
+SERVALT_P(13, REF_CLK,    SFP,       TWI_SCL_M);
+SERVALT_P(14, REF_CLK,    IRQ0_OUT,  SI);
+SERVALT_P(15, REF_CLK,    IRQ1_OUT,  SI);
+SERVALT_P(16, TACHO,      SFP,       SI);
+SERVALT_P(17, PWM,        NONE,      TWI_SCL_M);
+SERVALT_P(18, PTP2,       SFP,       SI);
+SERVALT_P(19, PTP3,       SFP,       SI);
+SERVALT_P(20, UART2,      SFP,       SI);
+SERVALT_P(21, UART2,      NONE,      NONE);
+SERVALT_P(22, MIIM,       SFP,       TWI2);
+SERVALT_P(23, MIIM,       SFP,       TWI2);
+SERVALT_P(24, TWI,        NONE,      NONE);
+SERVALT_P(25, TWI,        SFP,       TWI_SCL_M);
+SERVALT_P(26, TWI_SCL_M,  SFP,       SI);
+SERVALT_P(27, TWI_SCL_M,  SFP,       SI);
+SERVALT_P(28, TWI_SCL_M,  SFP,       SI);
+SERVALT_P(29, TWI_SCL_M,  NONE,      NONE);
+SERVALT_P(30, TWI_SCL_M,  NONE,      NONE);
+SERVALT_P(31, TWI_SCL_M,  NONE,      NONE);
+SERVALT_P(32, TWI_SCL_M,  NONE,      NONE);
+SERVALT_P(33, RCVRD_CLK,  NONE,      NONE);
+SERVALT_P(34, RCVRD_CLK,  NONE,      NONE);
+SERVALT_P(35, RCVRD_CLK,  NONE,      NONE);
+SERVALT_P(36, RCVRD_CLK,  NONE,      NONE);
+
+#define SERVALT_PIN(n) {                                       \
+       .number = n,                                            \
+       .name = "GPIO_"#n,                                      \
+       .drv_data = &servalt_pin_##n                            \
+}
+
+static const struct pinctrl_pin_desc servalt_pins[] = {
+       SERVALT_PIN(0),
+       SERVALT_PIN(1),
+       SERVALT_PIN(2),
+       SERVALT_PIN(3),
+       SERVALT_PIN(4),
+       SERVALT_PIN(5),
+       SERVALT_PIN(6),
+       SERVALT_PIN(7),
+       SERVALT_PIN(8),
+       SERVALT_PIN(9),
+       SERVALT_PIN(10),
+       SERVALT_PIN(11),
+       SERVALT_PIN(12),
+       SERVALT_PIN(13),
+       SERVALT_PIN(14),
+       SERVALT_PIN(15),
+       SERVALT_PIN(16),
+       SERVALT_PIN(17),
+       SERVALT_PIN(18),
+       SERVALT_PIN(19),
+       SERVALT_PIN(20),
+       SERVALT_PIN(21),
+       SERVALT_PIN(22),
+       SERVALT_PIN(23),
+       SERVALT_PIN(24),
+       SERVALT_PIN(25),
+       SERVALT_PIN(26),
+       SERVALT_PIN(27),
+       SERVALT_PIN(28),
+       SERVALT_PIN(29),
+       SERVALT_PIN(30),
+       SERVALT_PIN(31),
+       SERVALT_PIN(32),
+       SERVALT_PIN(33),
+       SERVALT_PIN(34),
+       SERVALT_PIN(35),
+       SERVALT_PIN(36),
+};
+
 #define SPARX5_P(p, f0, f1, f2)                                        \
 static struct ocelot_pin_caps sparx5_pin_##p = {                       \
        .pin = p,                                                       \
@@ -1497,6 +1589,15 @@ static struct pinctrl_desc jaguar2_desc = {
        .owner = THIS_MODULE,
 };
 
+static struct pinctrl_desc servalt_desc = {
+       .name = "servalt-pinctrl",
+       .pins = servalt_pins,
+       .npins = ARRAY_SIZE(servalt_pins),
+       .pctlops = &ocelot_pctl_ops,
+       .pmxops = &ocelot_pmx_ops,
+       .owner = THIS_MODULE,
+};
+
 static struct pinctrl_desc sparx5_desc = {
        .name = "sparx5-pinctrl",
        .pins = sparx5_pins,
@@ -1774,6 +1875,7 @@ static const struct of_device_id ocelot_pinctrl_of_match[] = {
        { .compatible = "mscc,serval-pinctrl", .data = &serval_desc },
        { .compatible = "mscc,ocelot-pinctrl", .data = &ocelot_desc },
        { .compatible = "mscc,jaguar2-pinctrl", .data = &jaguar2_desc },
+       { .compatible = "mscc,servalt-pinctrl", .data = &servalt_desc },
        { .compatible = "microchip,sparx5-pinctrl", .data = &sparx5_desc },
        { .compatible = "microchip,lan966x-pinctrl", .data = &lan966x_desc },
        {},
index 0b91215..ed6c9b3 100644 (file)
@@ -1026,7 +1026,7 @@ static int starfive_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
                break;
        default:
                return -ENOTSUPP;
-       };
+       }
 
        starfive_padctl_rmw(sfp, starfive_gpio_to_pin(sfp, gpio), mask, value);
        return 0;
index 48ccfb5..ff9302e 100644 (file)
@@ -504,7 +504,7 @@ static const struct pxa_desc_pin pxa27x_pins[] = {
 
 static int pxa27x_pinctrl_probe(struct platform_device *pdev)
 {
-       int ret, i;
+       int i;
        void __iomem *base_af[8];
        void __iomem *base_dir[4];
        void __iomem *base_sleep[4];
@@ -532,9 +532,8 @@ static int pxa27x_pinctrl_probe(struct platform_device *pdev)
        for (i = 0; i < ARRAY_SIZE(base_sleep); i++)
                base_sleep[i] = base_sleep[0] + sizeof(base_af[0]) * i;
 
-       ret = pxa2xx_pinctrl_init(pdev, pxa27x_pins, ARRAY_SIZE(pxa27x_pins),
+       return pxa2xx_pinctrl_init(pdev, pxa27x_pins, ARRAY_SIZE(pxa27x_pins),
                                  base_af, base_dir, base_sleep);
-       return ret;
 }
 
 static const struct of_device_id pxa27x_pinctrl_match[] = {
index 780878d..966ea66 100644 (file)
@@ -615,6 +615,7 @@ static void msm_gpio_dbg_show_one(struct seq_file *s,
        int drive;
        int pull;
        int val;
+       int egpio_enable;
        u32 ctl_reg, io_reg;
 
        static const char * const pulls_keeper[] = {
@@ -641,12 +642,20 @@ static void msm_gpio_dbg_show_one(struct seq_file *s,
        func = (ctl_reg >> g->mux_bit) & 7;
        drive = (ctl_reg >> g->drv_bit) & 7;
        pull = (ctl_reg >> g->pull_bit) & 3;
+       egpio_enable = 0;
+       if (pctrl->soc->egpio_func && ctl_reg & BIT(g->egpio_present))
+               egpio_enable = !(ctl_reg & BIT(g->egpio_enable));
 
        if (is_out)
                val = !!(io_reg & BIT(g->out_bit));
        else
                val = !!(io_reg & BIT(g->in_bit));
 
+       if (egpio_enable) {
+               seq_printf(s, " %-8s: egpio\n", g->name);
+               return;
+       }
+
        seq_printf(s, " %-8s: %-3s", g->name, is_out ? "out" : "in");
        seq_printf(s, " %-4s func%d", val ? "high" : "low", func);
        seq_printf(s, " %dmA", msm_regval_to_drive(drive));
@@ -1168,7 +1177,7 @@ static int msm_gpio_irq_set_affinity(struct irq_data *d,
        if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
                return irq_chip_set_affinity_parent(d, dest, force);
 
-       return 0;
+       return -EINVAL;
 }
 
 static int msm_gpio_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
@@ -1179,7 +1188,7 @@ static int msm_gpio_irq_set_vcpu_affinity(struct irq_data *d, void *vcpu_info)
        if (d->parent_data && test_bit(d->hwirq, pctrl->skip_wake_irqs))
                return irq_chip_set_vcpu_affinity_parent(d, vcpu_info);
 
-       return 0;
+       return -EINVAL;
 }
 
 static void msm_gpio_irq_handler(struct irq_desc *desc)
index 3f05c0a..aa9325f 100644 (file)
@@ -1083,6 +1083,16 @@ static const struct msm_pingroup qcm2290_groups[] = {
        [133] = SDC_QDSD_PINGROUP(sdc2_data, 0x86000, 9, 0),
 };
 
+static const struct msm_gpio_wakeirq_map qcm2290_mpm_map[] = {
+       { 0, 84 }, { 3, 75 }, { 4, 16 }, { 6, 59 }, { 8, 63 }, { 11, 17 },
+       { 13, 18 }, { 14, 51 }, { 17, 20 }, { 18, 52 }, { 19, 53 }, { 24, 6 },
+       { 25, 71 }, { 27, 73 }, { 28, 41 }, { 31, 27 }, { 32, 54 }, { 33, 55 },
+       { 34, 56 }, { 35, 57 }, { 36, 58 }, { 39, 28 }, { 46, 29 }, { 62, 60 },
+       { 63, 61 }, { 64, 62 }, { 69, 33 }, { 70, 34 }, { 72, 72 }, { 75, 35 },
+       { 79, 36 }, { 80, 21 }, { 81, 38 }, { 86, 19 }, { 87, 42 }, { 88, 43 },
+       { 89, 45 }, { 91, 74 }, { 94, 47 }, { 95, 48 }, { 96, 49 }, { 97, 50 },
+};
+
 static const struct msm_pinctrl_soc_data qcm2290_pinctrl = {
        .pins = qcm2290_pins,
        .npins = ARRAY_SIZE(qcm2290_pins),
@@ -1091,6 +1101,8 @@ static const struct msm_pinctrl_soc_data qcm2290_pinctrl = {
        .groups = qcm2290_groups,
        .ngroups = ARRAY_SIZE(qcm2290_groups),
        .ngpios = 127,
+       .wakeirq_map = qcm2290_mpm_map,
+       .nwakeirq_map = ARRAY_SIZE(qcm2290_mpm_map),
 };
 
 static int qcm2290_pinctrl_probe(struct platform_device *pdev)
index c6fa3db..3110d7b 100644 (file)
@@ -46,6 +46,8 @@
                .mux_bit = 2,                   \
                .pull_bit = 0,                  \
                .drv_bit = 6,                   \
+               .egpio_enable = 12,             \
+               .egpio_present = 11,            \
                .oe_bit = 9,                    \
                .in_bit = 0,                    \
                .out_bit = 1,                   \
@@ -567,6 +569,7 @@ enum sm8450_functions {
        msm_mux_ddr_pxi2,
        msm_mux_ddr_pxi3,
        msm_mux_dp_hot,
+       msm_mux_egpio,
        msm_mux_gcc_gp1,
        msm_mux_gcc_gp2,
        msm_mux_gcc_gp3,
@@ -719,6 +722,17 @@ static const char * const gpio_groups[] = {
        "gpio207", "gpio208", "gpio209",
 };
 
+static const char * const egpio_groups[] = {
+       "gpio165", "gpio166", "gpio167", "gpio168", "gpio169", "gpio170",
+       "gpio171", "gpio172", "gpio173", "gpio174", "gpio175", "gpio176",
+       "gpio177", "gpio178", "gpio179", "gpio180", "gpio181", "gpio182",
+       "gpio183", "gpio184", "gpio185", "gpio186", "gpio187", "gpio188",
+       "gpio189", "gpio190", "gpio191", "gpio192", "gpio193", "gpio194",
+       "gpio195", "gpio196", "gpio197", "gpio198", "gpio199", "gpio200",
+       "gpio201", "gpio202", "gpio203", "gpio204", "gpio205", "gpio206",
+       "gpio207", "gpio208", "gpio209",
+};
+
 static const char * const aon_cam_groups[] = {
        "gpio108",
 };
@@ -1285,6 +1299,7 @@ static const struct msm_function sm8450_functions[] = {
        FUNCTION(ddr_pxi2),
        FUNCTION(ddr_pxi3),
        FUNCTION(dp_hot),
+       FUNCTION(egpio),
        FUNCTION(gcc_gp1),
        FUNCTION(gcc_gp2),
        FUNCTION(gcc_gp3),
@@ -1571,51 +1586,51 @@ static const struct msm_pingroup sm8450_groups[] = {
        [162] = PINGROUP(162, qlink2_request, _, _, _, _, _, _, _, _),
        [163] = PINGROUP(163, qlink2_enable, _, _, _, _, _, _, _, _),
        [164] = PINGROUP(164, qlink2_wmss, _, _, _, _, _, _, _, _),
-       [165] = PINGROUP(165, _, _, _, _, _, _, _, _, _),
-       [166] = PINGROUP(166, _, _, _, _, _, _, _, _, _),
-       [167] = PINGROUP(167, _, _, _, _, _, _, _, _, _),
-       [168] = PINGROUP(168, _, _, _, _, _, _, _, _, _),
-       [169] = PINGROUP(169, _, _, _, _, _, _, _, _, _),
-       [170] = PINGROUP(170, _, _, _, _, _, _, _, _, _),
-       [171] = PINGROUP(171, _, _, _, _, _, _, _, _, _),
-       [172] = PINGROUP(172, _, _, _, _, _, _, _, _, _),
-       [173] = PINGROUP(173, _, _, _, _, _, _, _, _, _),
-       [174] = PINGROUP(174, _, _, _, _, _, _, _, _, _),
-       [175] = PINGROUP(175, _, _, _, _, _, _, _, _, _),
-       [176] = PINGROUP(176, _, _, _, _, _, _, _, _, _),
-       [177] = PINGROUP(177, _, _, _, _, _, _, _, _, _),
-       [178] = PINGROUP(178, _, _, _, _, _, _, _, _, _),
-       [179] = PINGROUP(179, _, _, _, _, _, _, _, _, _),
-       [180] = PINGROUP(180, _, _, _, _, _, _, _, _, _),
-       [181] = PINGROUP(181, _, _, _, _, _, _, _, _, _),
-       [182] = PINGROUP(182, _, _, _, _, _, _, _, _, _),
-       [183] = PINGROUP(183, _, _, _, _, _, _, _, _, _),
-       [184] = PINGROUP(184, _, _, _, _, _, _, _, _, _),
-       [185] = PINGROUP(185, _, _, _, _, _, _, _, _, _),
-       [186] = PINGROUP(186, _, _, _, _, _, _, _, _, _),
-       [187] = PINGROUP(187, _, _, _, _, _, _, _, _, _),
-       [188] = PINGROUP(188, _, qdss_gpio, _, _, _, _, _, _, _),
-       [189] = PINGROUP(189, _, qdss_gpio, _, _, _, _, _, _, _),
-       [190] = PINGROUP(190, qdss_gpio, _, _, _, _, _, _, _, _),
-       [191] = PINGROUP(191, qdss_gpio, _, _, _, _, _, _, _, _),
-       [192] = PINGROUP(192, _, qdss_gpio, _, _, _, _, _, _, _),
-       [193] = PINGROUP(193, _, qdss_gpio, _, _, _, _, _, _, _),
-       [194] = PINGROUP(194, _, qdss_gpio, _, _, _, _, _, _, _),
-       [195] = PINGROUP(195, _, qdss_gpio, _, _, _, _, _, _, _),
-       [196] = PINGROUP(196, _, qdss_gpio, _, _, _, _, _, _, _),
-       [197] = PINGROUP(197, _, qdss_gpio, _, _, _, _, _, _, _),
-       [198] = PINGROUP(198, _, qdss_gpio, _, _, _, _, _, _, _),
-       [199] = PINGROUP(199, _, qdss_gpio, _, _, _, _, _, _, _),
-       [200] = PINGROUP(200, _, qdss_gpio, _, _, _, _, _, _, _),
-       [201] = PINGROUP(201, _, qdss_gpio, _, _, _, _, _, _, _),
-       [202] = PINGROUP(202, qdss_gpio, _, _, _, _, _, _, _, _),
-       [203] = PINGROUP(203, qdss_gpio, _, _, _, _, _, _, _, _),
-       [204] = PINGROUP(204, qdss_gpio, _, _, _, _, _, _, _, _),
-       [205] = PINGROUP(205, qdss_gpio, _, _, _, _, _, _, _, _),
-       [206] = PINGROUP(206, qup5, _, _, _, _, _, _, _, _),
-       [207] = PINGROUP(207, qup5, _, _, _, _, _, _, _, _),
-       [208] = PINGROUP(208, cci_i2c, _, _, _, _, _, _, _, _),
-       [209] = PINGROUP(209, cci_i2c, _, _, _, _, _, _, _, _),
+       [165] = PINGROUP(165, _, _, _, _, _, _, _, _, egpio),
+       [166] = PINGROUP(166, _, _, _, _, _, _, _, _, egpio),
+       [167] = PINGROUP(167, _, _, _, _, _, _, _, _, egpio),
+       [168] = PINGROUP(168, _, _, _, _, _, _, _, _, egpio),
+       [169] = PINGROUP(169, _, _, _, _, _, _, _, _, egpio),
+       [170] = PINGROUP(170, _, _, _, _, _, _, _, _, egpio),
+       [171] = PINGROUP(171, _, _, _, _, _, _, _, _, egpio),
+       [172] = PINGROUP(172, _, _, _, _, _, _, _, _, egpio),
+       [173] = PINGROUP(173, _, _, _, _, _, _, _, _, egpio),
+       [174] = PINGROUP(174, _, _, _, _, _, _, _, _, egpio),
+       [175] = PINGROUP(175, _, _, _, _, _, _, _, _, egpio),
+       [176] = PINGROUP(176, _, _, _, _, _, _, _, _, egpio),
+       [177] = PINGROUP(177, _, _, _, _, _, _, _, _, egpio),
+       [178] = PINGROUP(178, _, _, _, _, _, _, _, _, egpio),
+       [179] = PINGROUP(179, _, _, _, _, _, _, _, _, egpio),
+       [180] = PINGROUP(180, _, _, _, _, _, _, _, _, egpio),
+       [181] = PINGROUP(181, _, _, _, _, _, _, _, _, egpio),
+       [182] = PINGROUP(182, _, _, _, _, _, _, _, _, egpio),
+       [183] = PINGROUP(183, _, _, _, _, _, _, _, _, egpio),
+       [184] = PINGROUP(184, _, _, _, _, _, _, _, _, egpio),
+       [185] = PINGROUP(185, _, _, _, _, _, _, _, _, egpio),
+       [186] = PINGROUP(186, _, _, _, _, _, _, _, _, egpio),
+       [187] = PINGROUP(187, _, _, _, _, _, _, _, _, egpio),
+       [188] = PINGROUP(188, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [189] = PINGROUP(189, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [190] = PINGROUP(190, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [191] = PINGROUP(191, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [192] = PINGROUP(192, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [193] = PINGROUP(193, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [194] = PINGROUP(194, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [195] = PINGROUP(195, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [196] = PINGROUP(196, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [197] = PINGROUP(197, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [198] = PINGROUP(198, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [199] = PINGROUP(199, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [200] = PINGROUP(200, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [201] = PINGROUP(201, _, qdss_gpio, _, _, _, _, _, _, egpio),
+       [202] = PINGROUP(202, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [203] = PINGROUP(203, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [204] = PINGROUP(204, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [205] = PINGROUP(205, qdss_gpio, _, _, _, _, _, _, _, egpio),
+       [206] = PINGROUP(206, qup5, _, _, _, _, _, _, _, egpio),
+       [207] = PINGROUP(207, qup5, _, _, _, _, _, _, _, egpio),
+       [208] = PINGROUP(208, cci_i2c, _, _, _, _, _, _, _, egpio),
+       [209] = PINGROUP(209, cci_i2c, _, _, _, _, _, _, _, egpio),
        [210] = UFS_RESET(ufs_reset, 0xde000),
        [211] = SDC_QDSD_PINGROUP(sdc2_clk, 0xd6000, 14, 6),
        [212] = SDC_QDSD_PINGROUP(sdc2_cmd, 0xd6000, 11, 3),
@@ -1651,6 +1666,7 @@ static const struct msm_pinctrl_soc_data sm8450_tlmm = {
        .ngpios = 211,
        .wakeirq_map = sm8450_pdc_map,
        .nwakeirq_map = ARRAY_SIZE(sm8450_pdc_map),
+       .egpio_func = 9,
 };
 
 static int sm8450_tlmm_probe(struct platform_device *pdev)
index b807239..6937157 100644 (file)
@@ -961,6 +961,7 @@ static int pmic_mpp_remove(struct platform_device *pdev)
 
 static const struct of_device_id pmic_mpp_of_match[] = {
        { .compatible = "qcom,pm8019-mpp", .data = (void *) 6 },
+       { .compatible = "qcom,pm8226-mpp", .data = (void *) 8 },
        { .compatible = "qcom,pm8841-mpp", .data = (void *) 4 },
        { .compatible = "qcom,pm8916-mpp", .data = (void *) 4 },
        { .compatible = "qcom,pm8941-mpp", .data = (void *) 8 },
index 9a72999..6b38720 100644 (file)
@@ -37,7 +37,9 @@ config PINCTRL_RENESAS
        select PINCTRL_PFC_R8A77990 if ARCH_R8A77990
        select PINCTRL_PFC_R8A77995 if ARCH_R8A77995
        select PINCTRL_PFC_R8A779A0 if ARCH_R8A779A0
+       select PINCTRL_PFC_R8A779F0 if ARCH_R8A779F0
        select PINCTRL_RZG2L if ARCH_R9A07G044
+       select PINCTRL_RZG2L if ARCH_R9A07G054
        select PINCTRL_PFC_SH7203 if CPU_SUBTYPE_SH7203
        select PINCTRL_PFC_SH7264 if CPU_SUBTYPE_SH7264
        select PINCTRL_PFC_SH7269 if CPU_SUBTYPE_SH7269
@@ -132,6 +134,10 @@ config PINCTRL_PFC_R8A77961
        bool "pin control support for R-Car M3-W+" if COMPILE_TEST
        select PINCTRL_SH_PFC
 
+config PINCTRL_PFC_R8A779F0
+       bool "pin control support for R-Car S4-8" if COMPILE_TEST
+       select PINCTRL_SH_PFC
+
 config PINCTRL_PFC_R8A7792
        bool "pin control support for R-Car V2H" if COMPILE_TEST
        select PINCTRL_SH_PFC
@@ -178,14 +184,15 @@ config PINCTRL_RZA2
          This selects GPIO and pinctrl driver for Renesas RZ/A2 platforms.
 
 config PINCTRL_RZG2L
-       bool "pin control support for RZ/G2L" if COMPILE_TEST
+       bool "pin control support for RZ/{G2L,V2L}" if COMPILE_TEST
        depends on OF
        select GPIOLIB
        select GENERIC_PINCTRL_GROUPS
        select GENERIC_PINMUX_FUNCTIONS
        select GENERIC_PINCONF
        help
-         This selects GPIO and pinctrl driver for Renesas RZ/G2L platforms.
+         This selects GPIO and pinctrl driver for Renesas RZ/{G2L,V2L}
+         platforms.
 
 config PINCTRL_PFC_R8A77470
        bool "pin control support for RZ/G1C" if COMPILE_TEST
index 7d9238a..5d936c1 100644 (file)
@@ -30,6 +30,7 @@ obj-$(CONFIG_PINCTRL_PFC_R8A77980)    += pfc-r8a77980.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77990)     += pfc-r8a77990.o
 obj-$(CONFIG_PINCTRL_PFC_R8A77995)     += pfc-r8a77995.o
 obj-$(CONFIG_PINCTRL_PFC_R8A779A0)     += pfc-r8a779a0.o
+obj-$(CONFIG_PINCTRL_PFC_R8A779F0)     += pfc-r8a779f0.o
 obj-$(CONFIG_PINCTRL_PFC_SH7203)       += pfc-sh7203.o
 obj-$(CONFIG_PINCTRL_PFC_SH7264)       += pfc-sh7264.o
 obj-$(CONFIG_PINCTRL_PFC_SH7269)       += pfc-sh7269.o
index 0d4ea2e..d0d4714 100644 (file)
@@ -636,6 +636,12 @@ static const struct of_device_id sh_pfc_of_table[] = {
                .data = &r8a779a0_pinmux_info,
        },
 #endif
+#ifdef CONFIG_PINCTRL_PFC_R8A779F0
+       {
+               .compatible = "renesas,pfc-r8a779f0",
+               .data = &r8a779f0_pinmux_info,
+       },
+#endif
 #ifdef CONFIG_PINCTRL_PFC_SH73A0
        {
                .compatible = "renesas,pfc-sh73a0",
@@ -741,10 +747,13 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; }
 
 #ifdef DEBUG
 #define SH_PFC_MAX_REGS                300
-#define SH_PFC_MAX_ENUMS       3000
+#define SH_PFC_MAX_ENUMS       5000
 
 static unsigned int sh_pfc_errors __initdata;
 static unsigned int sh_pfc_warnings __initdata;
+static bool sh_pfc_bias_done __initdata;
+static bool sh_pfc_drive_done __initdata;
+static bool sh_pfc_power_done __initdata;
 static struct {
        u32 reg;
        u32 bits;
@@ -758,6 +767,15 @@ static u32 sh_pfc_num_enums __initdata;
                pr_err("%s: " fmt, drvname, ##__VA_ARGS__);     \
                sh_pfc_errors++;                                \
        } while (0)
+
+#define sh_pfc_err_once(type, fmt, ...)                                \
+       do {                                                    \
+               if (!sh_pfc_ ## type ## _done) {                \
+                       sh_pfc_ ## type ## _done = true;        \
+                       sh_pfc_err(fmt, ##__VA_ARGS__);         \
+               }                                               \
+       } while (0)
+
 #define sh_pfc_warn(fmt, ...)                                  \
        do {                                                    \
                pr_warn("%s: " fmt, drvname, ##__VA_ARGS__);    \
@@ -777,10 +795,7 @@ static bool __init is0s(const u16 *enum_ids, unsigned int n)
 
 static bool __init same_name(const char *a, const char *b)
 {
-       if (!a || !b)
-               return false;
-
-       return !strcmp(a, b);
+       return a && b && !strcmp(a, b);
 }
 
 static void __init sh_pfc_check_reg(const char *drvname, u32 reg, u32 bits)
@@ -839,21 +854,22 @@ static void __init sh_pfc_check_reg_enums(const char *drvname, u32 reg,
        }
 }
 
-static void __init sh_pfc_check_pin(const struct sh_pfc_soc_info *info,
-                                   u32 reg, unsigned int pin)
+static const struct sh_pfc_pin __init *sh_pfc_find_pin(
+       const struct sh_pfc_soc_info *info, u32 reg, unsigned int pin)
 {
        const char *drvname = info->name;
        unsigned int i;
 
        if (pin == SH_PFC_PIN_NONE)
-               return;
+               return NULL;
 
        for (i = 0; i < info->nr_pins; i++) {
                if (pin == info->pins[i].pin)
-                       return;
+                       return &info->pins[i];
        }
 
        sh_pfc_err("reg 0x%x: pin %u not found\n", reg, pin);
+       return NULL;
 }
 
 static void __init sh_pfc_check_cfg_reg(const char *drvname,
@@ -865,7 +881,8 @@ static void __init sh_pfc_check_cfg_reg(const char *drvname,
                         GENMASK(cfg_reg->reg_width - 1, 0));
 
        if (cfg_reg->field_width) {
-               n = cfg_reg->reg_width / cfg_reg->field_width;
+               fw = cfg_reg->field_width;
+               n = (cfg_reg->reg_width / fw) << fw;
                /* Skip field checks (done at build time) */
                goto check_enum_ids;
        }
@@ -893,6 +910,8 @@ check_enum_ids:
 static void __init sh_pfc_check_drive_reg(const struct sh_pfc_soc_info *info,
                                          const struct pinmux_drive_reg *drive)
 {
+       const char *drvname = info->name;
+       const struct sh_pfc_pin *pin;
        unsigned int i;
 
        for (i = 0; i < ARRAY_SIZE(drive->fields); i++) {
@@ -905,13 +924,18 @@ static void __init sh_pfc_check_drive_reg(const struct sh_pfc_soc_info *info,
                                 GENMASK(field->offset + field->size - 1,
                                         field->offset));
 
-               sh_pfc_check_pin(info, drive->reg, field->pin);
+               pin = sh_pfc_find_pin(info, drive->reg, field->pin);
+               if (pin && !(pin->configs & SH_PFC_PIN_CFG_DRIVE_STRENGTH))
+                       sh_pfc_err("drive_reg 0x%x: field %u: pin %s lacks SH_PFC_PIN_CFG_DRIVE_STRENGTH flag\n",
+                                  drive->reg, i, pin->name);
        }
 }
 
 static void __init sh_pfc_check_bias_reg(const struct sh_pfc_soc_info *info,
                                         const struct pinmux_bias_reg *bias)
 {
+       const char *drvname = info->name;
+       const struct sh_pfc_pin *pin;
        unsigned int i;
        u32 bits;
 
@@ -923,12 +947,66 @@ static void __init sh_pfc_check_bias_reg(const struct sh_pfc_soc_info *info,
                sh_pfc_check_reg(info->name, bias->puen, bits);
        if (bias->pud)
                sh_pfc_check_reg(info->name, bias->pud, bits);
-       for (i = 0; i < ARRAY_SIZE(bias->pins); i++)
-               sh_pfc_check_pin(info, bias->puen, bias->pins[i]);
+       for (i = 0; i < ARRAY_SIZE(bias->pins); i++) {
+               pin = sh_pfc_find_pin(info, bias->puen, bias->pins[i]);
+               if (!pin)
+                       continue;
+
+               if (bias->puen && bias->pud) {
+                       /*
+                        * Pull-enable and pull-up/down control registers
+                        * As some SoCs have pins that support only pull-up
+                        * or pull-down, we just check for one of them
+                        */
+                       if (!(pin->configs & SH_PFC_PIN_CFG_PULL_UP_DOWN))
+                               sh_pfc_err("bias_reg 0x%x:%u: pin %s lacks one or more SH_PFC_PIN_CFG_PULL_* flags\n",
+                                          bias->puen, i, pin->name);
+               } else if (bias->puen) {
+                       /* Pull-up control register only */
+                       if (!(pin->configs & SH_PFC_PIN_CFG_PULL_UP))
+                               sh_pfc_err("bias_reg 0x%x:%u: pin %s lacks SH_PFC_PIN_CFG_PULL_UP flag\n",
+                                          bias->puen, i, pin->name);
+               } else if (bias->pud) {
+                       /* Pull-down control register only */
+                       if (!(pin->configs & SH_PFC_PIN_CFG_PULL_DOWN))
+                               sh_pfc_err("bias_reg 0x%x:%u: pin %s lacks SH_PFC_PIN_CFG_PULL_DOWN flag\n",
+                                          bias->pud, i, pin->name);
+               }
+       }
+}
+
+static void __init sh_pfc_compare_groups(const char *drvname,
+                                        const struct sh_pfc_pin_group *a,
+                                        const struct sh_pfc_pin_group *b)
+{
+       unsigned int i;
+       size_t len;
+
+       if (same_name(a->name, b->name))
+               sh_pfc_err("group %s: name conflict\n", a->name);
+
+       if (a->nr_pins > b->nr_pins)
+               swap(a, b);
+
+       len = a->nr_pins * sizeof(a->pins[0]);
+       for (i = 0; i <= b->nr_pins - a->nr_pins; i++) {
+               if (a->pins == b->pins + i || a->mux == b->mux + i ||
+                   memcmp(a->pins, b->pins + i, len) ||
+                   memcmp(a->mux, b->mux + i, len))
+                       continue;
+
+               if (a->nr_pins == b->nr_pins)
+                       sh_pfc_warn("group %s can be an alias for %s\n",
+                                   a->name, b->name);
+               else
+                       sh_pfc_warn("group %s is a subset of %s\n", a->name,
+                                   b->name);
+       }
 }
 
 static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
 {
+       const struct pinmux_drive_reg *drive_regs = info->drive_regs;
        const struct pinmux_bias_reg *bias_regs = info->bias_regs;
        const char *drvname = info->name;
        unsigned int *refcnts;
@@ -937,10 +1015,14 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
        pr_info("sh_pfc: Checking %s\n", drvname);
        sh_pfc_num_regs = 0;
        sh_pfc_num_enums = 0;
+       sh_pfc_bias_done = false;
+       sh_pfc_drive_done = false;
+       sh_pfc_power_done = false;
 
        /* Check pins */
        for (i = 0; i < info->nr_pins; i++) {
                const struct sh_pfc_pin *pin = &info->pins[i];
+               unsigned int x;
 
                if (!pin->name) {
                        sh_pfc_err("empty pin %u\n", i);
@@ -962,6 +1044,65 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
                                           pin->name, pin2->name,
                                           pin->enum_id);
                }
+
+               if (pin->configs & SH_PFC_PIN_CFG_PULL_UP_DOWN) {
+                       if (!info->ops || !info->ops->get_bias ||
+                           !info->ops->set_bias)
+                               sh_pfc_err_once(bias, "SH_PFC_PIN_CFG_PULL_* flag set but .[gs]et_bias() not implemented\n");
+
+                       if (!bias_regs &&
+                            (!info->ops || !info->ops->pin_to_portcr))
+                               sh_pfc_err_once(bias, "SH_PFC_PIN_CFG_PULL_UP flag set but no bias_regs defined and .pin_to_portcr() not implemented\n");
+               }
+
+               if ((pin->configs & SH_PFC_PIN_CFG_PULL_UP_DOWN) && bias_regs) {
+                       const struct pinmux_bias_reg *bias_reg =
+                               rcar_pin_to_bias_reg(info, pin->pin, &x);
+
+                       if (!bias_reg ||
+                           ((pin->configs & SH_PFC_PIN_CFG_PULL_UP) &&
+                            !bias_reg->puen))
+                               sh_pfc_err("pin %s: SH_PFC_PIN_CFG_PULL_UP flag set but pin not in bias_regs\n",
+                                          pin->name);
+
+                       if (!bias_reg ||
+                           ((pin->configs & SH_PFC_PIN_CFG_PULL_DOWN) &&
+                            !bias_reg->pud))
+                               sh_pfc_err("pin %s: SH_PFC_PIN_CFG_PULL_DOWN flag set but pin not in bias_regs\n",
+                                          pin->name);
+               }
+
+               if (pin->configs & SH_PFC_PIN_CFG_DRIVE_STRENGTH) {
+                       if (!drive_regs) {
+                               sh_pfc_err_once(drive, "SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but drive_regs missing\n");
+                       } else {
+                               for (j = 0; drive_regs[j / 8].reg; j++) {
+                                       if (!drive_regs[j / 8].fields[j % 8].pin &&
+                                           !drive_regs[j / 8].fields[j % 8].offset &&
+                                           !drive_regs[j / 8].fields[j % 8].size)
+                                               continue;
+
+                                       if (drive_regs[j / 8].fields[j % 8].pin == pin->pin)
+                                               break;
+                               }
+
+                               if (!drive_regs[j / 8].reg)
+                                       sh_pfc_err("pin %s: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs\n",
+                                                  pin->name);
+                       }
+               }
+
+               if (pin->configs & SH_PFC_PIN_CFG_IO_VOLTAGE) {
+                       if (!info->ops || !info->ops->pin_to_pocctrl)
+                               sh_pfc_err_once(power, "SH_PFC_PIN_CFG_IO_VOLTAGE flag set but .pin_to_pocctrl() not implemented\n");
+                       else if (info->ops->pin_to_pocctrl(pin->pin, &x) < 0)
+                               sh_pfc_err("pin %s: SH_PFC_PIN_CFG_IO_VOLTAGE set but invalid pin_to_pocctrl()\n",
+                                          pin->name);
+               } else if (info->ops && info->ops->pin_to_pocctrl &&
+                          info->ops->pin_to_pocctrl(pin->pin, &x) >= 0) {
+                       sh_pfc_warn("pin %s: SH_PFC_PIN_CFG_IO_VOLTAGE not set but valid pin_to_pocctrl()\n",
+                                   pin->name);
+               }
        }
 
        /* Check groups and functions */
@@ -1003,11 +1144,9 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
                        sh_pfc_err("empty group %u\n", i);
                        continue;
                }
-               for (j = 0; j < i; j++) {
-                       if (same_name(group->name, info->groups[j].name))
-                               sh_pfc_err("group %s: name conflict\n",
-                                          group->name);
-               }
+               for (j = 0; j < i; j++)
+                       sh_pfc_compare_groups(drvname, group, &info->groups[j]);
+
                if (!refcnts[i])
                        sh_pfc_err("orphan group %s\n", group->name);
                else if (refcnts[i] > 1)
@@ -1022,13 +1161,53 @@ static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
                sh_pfc_check_cfg_reg(drvname, &info->cfg_regs[i]);
 
        /* Check drive strength registers */
-       for (i = 0; info->drive_regs && info->drive_regs[i].reg; i++)
-               sh_pfc_check_drive_reg(info, &info->drive_regs[i]);
+       for (i = 0; drive_regs && drive_regs[i].reg; i++)
+               sh_pfc_check_drive_reg(info, &drive_regs[i]);
+
+       for (i = 0; drive_regs && drive_regs[i / 8].reg; i++) {
+               if (!drive_regs[i / 8].fields[i % 8].pin &&
+                   !drive_regs[i / 8].fields[i % 8].offset &&
+                   !drive_regs[i / 8].fields[i % 8].size)
+                       continue;
+
+               for (j = 0; j < i; j++) {
+                       if (drive_regs[i / 8].fields[i % 8].pin ==
+                           drive_regs[j / 8].fields[j % 8].pin &&
+                           drive_regs[j / 8].fields[j % 8].offset &&
+                           drive_regs[j / 8].fields[j % 8].size) {
+                               sh_pfc_err("drive_reg 0x%x:%u/0x%x:%u: pin conflict\n",
+                                          drive_regs[i / 8].reg, i % 8,
+                                          drive_regs[j / 8].reg, j % 8);
+                       }
+               }
+       }
 
        /* Check bias registers */
        for (i = 0; bias_regs && (bias_regs[i].puen || bias_regs[i].pud); i++)
                sh_pfc_check_bias_reg(info, &bias_regs[i]);
 
+       for (i = 0; bias_regs &&
+                   (bias_regs[i / 32].puen || bias_regs[i / 32].pud); i++) {
+               if (bias_regs[i / 32].pins[i % 32] == SH_PFC_PIN_NONE)
+                       continue;
+
+               for (j = 0; j < i; j++) {
+                       if (bias_regs[i / 32].pins[i % 32] !=
+                           bias_regs[j / 32].pins[j % 32])
+                               continue;
+
+                       if (bias_regs[i / 32].puen && bias_regs[j / 32].puen)
+                               sh_pfc_err("bias_reg 0x%x:%u/0x%x:%u: pin conflict\n",
+                                          bias_regs[i / 32].puen, i % 32,
+                                          bias_regs[j / 32].puen, j % 32);
+                       if (bias_regs[i / 32].pud && bias_regs[j / 32].pud)
+                               sh_pfc_err("bias_reg 0x%x:%u/0x%x:%u: pin conflict\n",
+                                          bias_regs[i / 32].pud, i % 32,
+                                          bias_regs[j / 32].pud, j % 32);
+               }
+
+       }
+
        /* Check ioctrl registers */
        for (i = 0; info->ioctrl_regs && info->ioctrl_regs[i].reg; i++)
                sh_pfc_check_reg(drvname, info->ioctrl_regs[i].reg, U32_MAX);
index 6c66fc3..2326d34 100644 (file)
@@ -749,23 +749,14 @@ static const unsigned int cf_ctrl_mux[] = {
        CF_CDB2_MARK,
 };
 
-static const unsigned int cf_data8_pins[] = {
-       /* CF_D[0:7] */
-       77, 78, 79, 80,
-       81, 82, 83, 84,
-};
-static const unsigned int cf_data8_mux[] = {
-       CF_D00_MARK, CF_D01_MARK, CF_D02_MARK, CF_D03_MARK,
-       CF_D04_MARK, CF_D05_MARK, CF_D06_MARK, CF_D07_MARK,
-};
-static const unsigned int cf_data16_pins[] = {
+static const unsigned int cf_data_pins[] = {
        /* CF_D[0:15] */
        77, 78, 79, 80,
        81, 82, 83, 84,
        85, 86, 87, 88,
        89, 90, 91, 92,
 };
-static const unsigned int cf_data16_mux[] = {
+static const unsigned int cf_data_mux[] = {
        CF_D00_MARK, CF_D01_MARK, CF_D02_MARK, CF_D03_MARK,
        CF_D04_MARK, CF_D05_MARK, CF_D06_MARK, CF_D07_MARK,
        CF_D08_MARK, CF_D09_MARK, CF_D10_MARK, CF_D11_MARK,
@@ -895,26 +886,12 @@ static const unsigned int sdi0_ctrl_mux[] = {
        SDI0_CKO_MARK, SDI0_CKI_MARK, SDI0_CMD_MARK,
 };
 
-static const unsigned int sdi0_data1_pins[] = {
-       /* SDI0_DATA[0] */
-       53,
-};
-static const unsigned int sdi0_data1_mux[] = {
-       SDI0_DATA0_MARK,
-};
-static const unsigned int sdi0_data4_pins[] = {
-       /* SDI0_DATA[0:3] */
-       53, 54, 55, 56,
-};
-static const unsigned int sdi0_data4_mux[] = {
-       SDI0_DATA0_MARK, SDI0_DATA1_MARK, SDI0_DATA2_MARK, SDI0_DATA3_MARK,
-};
-static const unsigned int sdi0_data8_pins[] = {
+static const unsigned int sdi0_data_pins[] = {
        /* SDI0_DATA[0:7] */
        53, 54, 55, 56,
        57, 58, 59, 60
 };
-static const unsigned int sdi0_data8_mux[] = {
+static const unsigned int sdi0_data_mux[] = {
        SDI0_DATA0_MARK, SDI0_DATA1_MARK, SDI0_DATA2_MARK, SDI0_DATA3_MARK,
        SDI0_DATA4_MARK, SDI0_DATA5_MARK, SDI0_DATA6_MARK, SDI0_DATA7_MARK,
 };
@@ -928,18 +905,11 @@ static const unsigned int sdi1_ctrl_mux[] = {
        SDI1_CKO_MARK, SDI1_CKI_MARK, SDI1_CMD_MARK,
 };
 
-static const unsigned int sdi1_data1_pins[] = {
-       /* SDI1_DATA[0] */
-       64,
-};
-static const unsigned int sdi1_data1_mux[] = {
-       SDI1_DATA0_MARK,
-};
-static const unsigned int sdi1_data4_pins[] = {
+static const unsigned int sdi1_data_pins[] = {
        /* SDI1_DATA[0:3] */
        64, 65, 66, 67,
 };
-static const unsigned int sdi1_data4_mux[] = {
+static const unsigned int sdi1_data_mux[] = {
        SDI1_DATA0_MARK, SDI1_DATA1_MARK, SDI1_DATA2_MARK, SDI1_DATA3_MARK,
 };
 
@@ -952,18 +922,11 @@ static const unsigned int sdi2_ctrl_mux[] = {
        SDI2_CKO_MARK, SDI2_CKI_MARK, SDI2_CMD_MARK,
 };
 
-static const unsigned int sdi2_data1_pins[] = {
-       /* SDI2_DATA[0] */
-       89,
-};
-static const unsigned int sdi2_data1_mux[] = {
-       SDI2_DATA0_MARK,
-};
-static const unsigned int sdi2_data4_pins[] = {
+static const unsigned int sdi2_data_pins[] = {
        /* SDI2_DATA[0:3] */
        89, 90, 91, 92,
 };
-static const unsigned int sdi2_data4_mux[] = {
+static const unsigned int sdi2_data_mux[] = {
        SDI2_DATA0_MARK, SDI2_DATA1_MARK, SDI2_DATA2_MARK, SDI2_DATA3_MARK,
 };
 
@@ -1131,8 +1094,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(cam),
 
        SH_PFC_PIN_GROUP(cf_ctrl),
-       SH_PFC_PIN_GROUP(cf_data8),
-       SH_PFC_PIN_GROUP(cf_data16),
+       BUS_DATA_PIN_GROUP(cf_data, 8),
+       BUS_DATA_PIN_GROUP(cf_data, 16),
 
        SH_PFC_PIN_GROUP(dtv_a),
        SH_PFC_PIN_GROUP(dtv_b),
@@ -1161,17 +1124,17 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(sd_cki),
 
        SH_PFC_PIN_GROUP(sdi0_ctrl),
-       SH_PFC_PIN_GROUP(sdi0_data1),
-       SH_PFC_PIN_GROUP(sdi0_data4),
-       SH_PFC_PIN_GROUP(sdi0_data8),
+       BUS_DATA_PIN_GROUP(sdi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdi0_data, 4),
+       BUS_DATA_PIN_GROUP(sdi0_data, 8),
 
        SH_PFC_PIN_GROUP(sdi1_ctrl),
-       SH_PFC_PIN_GROUP(sdi1_data1),
-       SH_PFC_PIN_GROUP(sdi1_data4),
+       BUS_DATA_PIN_GROUP(sdi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdi1_data, 4),
 
        SH_PFC_PIN_GROUP(sdi2_ctrl),
-       SH_PFC_PIN_GROUP(sdi2_data1),
-       SH_PFC_PIN_GROUP(sdi2_data4),
+       BUS_DATA_PIN_GROUP(sdi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdi2_data, 4),
 
        SH_PFC_PIN_GROUP(tp33),
 
index b26ff9d..ba3a185 100644 (file)
@@ -1449,25 +1449,11 @@ IRQC_PINS_MUX(327, 55);
 IRQC_PINS_MUX(328, 56);
 IRQC_PINS_MUX(329, 57);
 /* - MMCIF0 ----------------------------------------------------------------- */
-static const unsigned int mmc0_data1_pins[] = {
-       /* D[0] */
-       164,
-};
-static const unsigned int mmc0_data1_mux[] = {
-       MMCD0_0_MARK,
-};
-static const unsigned int mmc0_data4_pins[] = {
-       /* D[0:3] */
-       164, 165, 166, 167,
-};
-static const unsigned int mmc0_data4_mux[] = {
-       MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
-};
-static const unsigned int mmc0_data8_pins[] = {
+static const unsigned int mmc0_data_pins[] = {
        /* D[0:7] */
        164, 165, 166, 167, 168, 169, 170, 171,
 };
-static const unsigned int mmc0_data8_mux[] = {
+static const unsigned int mmc0_data_mux[] = {
        MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
        MMCD0_4_MARK, MMCD0_5_MARK, MMCD0_6_MARK, MMCD0_7_MARK,
 };
@@ -1479,25 +1465,11 @@ static const unsigned int mmc0_ctrl_mux[] = {
        MMCCMD0_MARK, MMCCLK0_MARK,
 };
 /* - MMCIF1 ----------------------------------------------------------------- */
-static const unsigned int mmc1_data1_pins[] = {
-       /* D[0] */
-       199,
-};
-static const unsigned int mmc1_data1_mux[] = {
-       MMCD1_0_MARK,
-};
-static const unsigned int mmc1_data4_pins[] = {
-       /* D[0:3] */
-       199, 198, 197, 196,
-};
-static const unsigned int mmc1_data4_mux[] = {
-       MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
-};
-static const unsigned int mmc1_data8_pins[] = {
+static const unsigned int mmc1_data_pins[] = {
        /* D[0:7] */
        199, 198, 197, 196, 195, 194, 193, 192,
 };
-static const unsigned int mmc1_data8_mux[] = {
+static const unsigned int mmc1_data_mux[] = {
        MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
        MMCD1_4_MARK, MMCD1_5_MARK, MMCD1_6_MARK, MMCD1_7_MARK,
 };
@@ -1704,18 +1676,11 @@ static const unsigned int scifb3_ctrl_b_mux[] = {
        SCIFB3_RTS_38_MARK, SCIFB3_CTS_39_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       302,
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SDHID0_0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        302, 303, 304, 305,
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SDHID0_0_MARK, SDHID0_1_MARK, SDHID0_2_MARK, SDHID0_3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -1740,18 +1705,11 @@ static const unsigned int sdhi0_wp_mux[] = {
        SDHIWP0_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       289,
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SDHID1_0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        289, 290, 291, 292,
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SDHID1_0_MARK, SDHID1_1_MARK, SDHID1_2_MARK, SDHID1_3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -1762,18 +1720,11 @@ static const unsigned int sdhi1_ctrl_mux[] = {
        SDHICLK1_MARK, SDHICMD1_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       295,
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SDHID2_0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        295, 296, 297, 298,
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SDHID2_0_MARK, SDHID2_1_MARK, SDHID2_2_MARK, SDHID2_3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -1843,13 +1794,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(irqc_irq55),
        SH_PFC_PIN_GROUP(irqc_irq56),
        SH_PFC_PIN_GROUP(irqc_irq57),
-       SH_PFC_PIN_GROUP(mmc0_data1),
-       SH_PFC_PIN_GROUP(mmc0_data4),
-       SH_PFC_PIN_GROUP(mmc0_data8),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8),
        SH_PFC_PIN_GROUP(mmc0_ctrl),
-       SH_PFC_PIN_GROUP(mmc1_data1),
-       SH_PFC_PIN_GROUP(mmc1_data4),
-       SH_PFC_PIN_GROUP(mmc1_data8),
+       BUS_DATA_PIN_GROUP(mmc1_data, 1),
+       BUS_DATA_PIN_GROUP(mmc1_data, 4),
+       BUS_DATA_PIN_GROUP(mmc1_data, 8),
        SH_PFC_PIN_GROUP(mmc1_ctrl),
        SH_PFC_PIN_GROUP(scifa0_data),
        SH_PFC_PIN_GROUP(scifa0_clk),
@@ -1878,16 +1829,16 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scifb3_data_b),
        SH_PFC_PIN_GROUP(scifb3_clk_b),
        SH_PFC_PIN_GROUP(scifb3_ctrl_b),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
 };
 
@@ -2655,9 +2606,9 @@ static const unsigned int r8a73a4_portcr_offsets[] = {
        0x00002000, 0x00003000, 0x00003000,
 };
 
-static void __iomem *r8a73a4_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin)
+static int r8a73a4_pin_to_portcr(unsigned int pin)
 {
-       return pfc->windows->virt + r8a73a4_portcr_offsets[pin >> 5] + pin;
+       return r8a73a4_portcr_offsets[pin >> 5] + pin;
 }
 
 static const struct sh_pfc_soc_operations r8a73a4_pfc_ops = {
index 4eac389..e8b9fb7 100644 (file)
@@ -1638,33 +1638,14 @@ static const struct sh_pfc_pin pinmux_pins[] = {
 };
 
 /* - BSC -------------------------------------------------------------------- */
-static const unsigned int bsc_data8_pins[] = {
-       /* D[0:7] */
-       157, 156, 155, 154, 153, 152, 151, 150,
-};
-static const unsigned int bsc_data8_mux[] = {
-       D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, D3_NAF3_MARK,
-       D4_NAF4_MARK, D5_NAF5_MARK, D6_NAF6_MARK, D7_NAF7_MARK,
-};
-static const unsigned int bsc_data16_pins[] = {
-       /* D[0:15] */
-       157, 156, 155, 154, 153, 152, 151, 150,
-       149, 148, 147, 146, 145, 144, 143, 142,
-};
-static const unsigned int bsc_data16_mux[] = {
-       D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, D3_NAF3_MARK,
-       D4_NAF4_MARK, D5_NAF5_MARK, D6_NAF6_MARK, D7_NAF7_MARK,
-       D8_NAF8_MARK, D9_NAF9_MARK, D10_NAF10_MARK, D11_NAF11_MARK,
-       D12_NAF12_MARK, D13_NAF13_MARK, D14_NAF14_MARK, D15_NAF15_MARK,
-};
-static const unsigned int bsc_data32_pins[] = {
+static const unsigned int bsc_data_pins[] = {
        /* D[0:31] */
        157, 156, 155, 154, 153, 152, 151, 150,
        149, 148, 147, 146, 145, 144, 143, 142,
        171, 170, 169, 168, 167, 166, 173, 172,
        165, 164, 163, 162, 161, 160, 159, 158,
 };
-static const unsigned int bsc_data32_mux[] = {
+static const unsigned int bsc_data_mux[] = {
        D0_NAF0_MARK, D1_NAF1_MARK, D2_NAF2_MARK, D3_NAF3_MARK,
        D4_NAF4_MARK, D5_NAF5_MARK, D6_NAF6_MARK, D7_NAF7_MARK,
        D8_NAF8_MARK, D9_NAF9_MARK, D10_NAF10_MARK, D11_NAF11_MARK,
@@ -1723,25 +1704,11 @@ static const unsigned int bsc_cs6a_pins[] = {
 static const unsigned int bsc_cs6a_mux[] = {
        CS6A_MARK,
 };
-static const unsigned int bsc_rd_we8_pins[] = {
-       /* RD, WE[0] */
-       115, 113,
-};
-static const unsigned int bsc_rd_we8_mux[] = {
-       RD_FSC_MARK, WE0_FWE_MARK,
-};
-static const unsigned int bsc_rd_we16_pins[] = {
-       /* RD, WE[0:1] */
-       115, 113, 112,
-};
-static const unsigned int bsc_rd_we16_mux[] = {
-       RD_FSC_MARK, WE0_FWE_MARK, WE1_MARK,
-};
-static const unsigned int bsc_rd_we32_pins[] = {
+static const unsigned int bsc_rd_we_pins[] = {
        /* RD, WE[0:3] */
        115, 113, 112, 108, 107,
 };
-static const unsigned int bsc_rd_we32_mux[] = {
+static const unsigned int bsc_rd_we_mux[] = {
        RD_FSC_MARK, WE0_FWE_MARK, WE1_MARK, WE2_ICIORD_MARK, WE3_ICIOWR_MARK,
 };
 static const unsigned int bsc_bs_pins[] = {
@@ -2064,58 +2031,6 @@ IRQC_PINS_MUX(31, 0, 41);
 IRQC_PINS_MUX(31, 1, 167);
 
 /* - LCD0 ------------------------------------------------------------------- */
-static const unsigned int lcd0_data8_pins[] = {
-       /* D[0:7] */
-       58, 57, 56, 55, 54, 53, 52, 51,
-};
-static const unsigned int lcd0_data8_mux[] = {
-       LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
-       LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
-};
-static const unsigned int lcd0_data9_pins[] = {
-       /* D[0:8] */
-       58, 57, 56, 55, 54, 53, 52, 51,
-       50,
-};
-static const unsigned int lcd0_data9_mux[] = {
-       LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
-       LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
-       LCD0_D8_MARK,
-};
-static const unsigned int lcd0_data12_pins[] = {
-       /* D[0:11] */
-       58, 57, 56, 55, 54, 53, 52, 51,
-       50, 49, 48, 47,
-};
-static const unsigned int lcd0_data12_mux[] = {
-       LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
-       LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
-       LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
-};
-static const unsigned int lcd0_data16_pins[] = {
-       /* D[0:15] */
-       58, 57, 56, 55, 54, 53, 52, 51,
-       50, 49, 48, 47, 46, 45, 44, 43,
-};
-static const unsigned int lcd0_data16_mux[] = {
-       LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
-       LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
-       LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
-       LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
-};
-static const unsigned int lcd0_data18_pins[] = {
-       /* D[0:17] */
-       58, 57, 56, 55, 54, 53, 52, 51,
-       50, 49, 48, 47, 46, 45, 44, 43,
-       42, 41,
-};
-static const unsigned int lcd0_data18_mux[] = {
-       LCD0_D0_MARK, LCD0_D1_MARK, LCD0_D2_MARK, LCD0_D3_MARK,
-       LCD0_D4_MARK, LCD0_D5_MARK, LCD0_D6_MARK, LCD0_D7_MARK,
-       LCD0_D8_MARK, LCD0_D9_MARK, LCD0_D10_MARK, LCD0_D11_MARK,
-       LCD0_D12_MARK, LCD0_D13_MARK, LCD0_D14_MARK, LCD0_D15_MARK,
-       LCD0_D16_MARK, LCD0_D17_MARK,
-};
 static const unsigned int lcd0_data24_0_pins[] = {
        /* D[0:23] */
        58, 57, 56, 55, 54, 53, 52, 51,
@@ -2182,65 +2097,13 @@ static const unsigned int lcd0_sys_mux[] = {
        LCD0_CS_MARK, LCD0_WR_MARK, LCD0_RD_MARK, LCD0_RS_MARK,
 };
 /* - LCD1 ------------------------------------------------------------------- */
-static const unsigned int lcd1_data8_pins[] = {
-       /* D[0:7] */
-       4, 3, 2, 1, 0, 91, 92, 23,
-};
-static const unsigned int lcd1_data8_mux[] = {
-       LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
-       LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
-};
-static const unsigned int lcd1_data9_pins[] = {
-       /* D[0:8] */
-       4, 3, 2, 1, 0, 91, 92, 23,
-       93,
-};
-static const unsigned int lcd1_data9_mux[] = {
-       LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
-       LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
-       LCD1_D8_MARK,
-};
-static const unsigned int lcd1_data12_pins[] = {
-       /* D[0:11] */
-       4, 3, 2, 1, 0, 91, 92, 23,
-       93, 94, 21, 201,
-};
-static const unsigned int lcd1_data12_mux[] = {
-       LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
-       LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
-       LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
-};
-static const unsigned int lcd1_data16_pins[] = {
-       /* D[0:15] */
-       4, 3, 2, 1, 0, 91, 92, 23,
-       93, 94, 21, 201, 200, 199, 196, 195,
-};
-static const unsigned int lcd1_data16_mux[] = {
-       LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
-       LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
-       LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
-       LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
-};
-static const unsigned int lcd1_data18_pins[] = {
-       /* D[0:17] */
-       4, 3, 2, 1, 0, 91, 92, 23,
-       93, 94, 21, 201, 200, 199, 196, 195,
-       194, 193,
-};
-static const unsigned int lcd1_data18_mux[] = {
-       LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
-       LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
-       LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
-       LCD1_D12_MARK, LCD1_D13_MARK, LCD1_D14_MARK, LCD1_D15_MARK,
-       LCD1_D16_MARK, LCD1_D17_MARK,
-};
-static const unsigned int lcd1_data24_pins[] = {
+static const unsigned int lcd1_data_pins[] = {
        /* D[0:23] */
        4, 3, 2, 1, 0, 91, 92, 23,
        93, 94, 21, 201, 200, 199, 196, 195,
        194, 193, 198, 197, 75, 74, 15, 14,
 };
-static const unsigned int lcd1_data24_mux[] = {
+static const unsigned int lcd1_data_mux[] = {
        LCD1_D0_MARK, LCD1_D1_MARK, LCD1_D2_MARK, LCD1_D3_MARK,
        LCD1_D4_MARK, LCD1_D5_MARK, LCD1_D6_MARK, LCD1_D7_MARK,
        LCD1_D8_MARK, LCD1_D9_MARK, LCD1_D10_MARK, LCD1_D11_MARK,
@@ -2277,25 +2140,11 @@ static const unsigned int lcd1_sys_mux[] = {
        LCD1_CS_MARK, LCD1_WR_MARK, LCD1_RD_MARK, LCD1_RS_MARK,
 };
 /* - MMCIF ------------------------------------------------------------------ */
-static const unsigned int mmc0_data1_0_pins[] = {
-       /* D[0] */
-       68,
-};
-static const unsigned int mmc0_data1_0_mux[] = {
-       MMC0_D0_PORT68_MARK,
-};
-static const unsigned int mmc0_data4_0_pins[] = {
-       /* D[0:3] */
-       68, 69, 70, 71,
-};
-static const unsigned int mmc0_data4_0_mux[] = {
-       MMC0_D0_PORT68_MARK, MMC0_D1_PORT69_MARK, MMC0_D2_PORT70_MARK, MMC0_D3_PORT71_MARK,
-};
-static const unsigned int mmc0_data8_0_pins[] = {
+static const unsigned int mmc0_data_0_pins[] = {
        /* D[0:7] */
        68, 69, 70, 71, 72, 73, 74, 75,
 };
-static const unsigned int mmc0_data8_0_mux[] = {
+static const unsigned int mmc0_data_0_mux[] = {
        MMC0_D0_PORT68_MARK, MMC0_D1_PORT69_MARK, MMC0_D2_PORT70_MARK, MMC0_D3_PORT71_MARK,
        MMC0_D4_PORT72_MARK, MMC0_D5_PORT73_MARK, MMC0_D6_PORT74_MARK, MMC0_D7_PORT75_MARK,
 };
@@ -2307,25 +2156,11 @@ static const unsigned int mmc0_ctrl_0_mux[] = {
        MMC0_CMD_PORT67_MARK, MMC0_CLK_PORT66_MARK,
 };
 
-static const unsigned int mmc0_data1_1_pins[] = {
-       /* D[0] */
-       149,
-};
-static const unsigned int mmc0_data1_1_mux[] = {
-       MMC1_D0_PORT149_MARK,
-};
-static const unsigned int mmc0_data4_1_pins[] = {
-       /* D[0:3] */
-       149, 148, 147, 146,
-};
-static const unsigned int mmc0_data4_1_mux[] = {
-       MMC1_D0_PORT149_MARK, MMC1_D1_PORT148_MARK, MMC1_D2_PORT147_MARK, MMC1_D3_PORT146_MARK,
-};
-static const unsigned int mmc0_data8_1_pins[] = {
+static const unsigned int mmc0_data_1_pins[] = {
        /* D[0:7] */
        149, 148, 147, 146, 145, 144, 143, 142,
 };
-static const unsigned int mmc0_data8_1_mux[] = {
+static const unsigned int mmc0_data_1_mux[] = {
        MMC1_D0_PORT149_MARK, MMC1_D1_PORT148_MARK, MMC1_D2_PORT147_MARK, MMC1_D3_PORT146_MARK,
        MMC1_D4_PORT145_MARK, MMC1_D5_PORT144_MARK, MMC1_D6_PORT143_MARK, MMC1_D7_PORT142_MARK,
 };
@@ -2591,18 +2426,11 @@ static const unsigned int scifb_ctrl_1_mux[] = {
        SCIFB_RTS_PORT172_MARK, SCIFB_CTS_PORT173_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       77,
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SDHI0_D0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        77, 78, 79, 80,
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SDHI0_D0_MARK, SDHI0_D1_MARK, SDHI0_D2_MARK, SDHI0_D3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -2627,18 +2455,11 @@ static const unsigned int sdhi0_wp_mux[] = {
        SDHI0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       68,
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SDHI1_D0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        68, 69, 70, 71,
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SDHI1_D0_MARK, SDHI1_D1_MARK, SDHI1_D2_MARK, SDHI1_D3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -2663,18 +2484,11 @@ static const unsigned int sdhi1_wp_mux[] = {
        SDHI1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       205,
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SDHI2_D0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        205, 206, 207, 208,
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SDHI2_D0_MARK, SDHI2_D1_MARK, SDHI2_D2_MARK, SDHI2_D3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -2750,9 +2564,9 @@ static const unsigned int tpu0_to3_mux[] = {
 };
 
 static const struct sh_pfc_pin_group pinmux_groups[] = {
-       SH_PFC_PIN_GROUP(bsc_data8),
-       SH_PFC_PIN_GROUP(bsc_data16),
-       SH_PFC_PIN_GROUP(bsc_data32),
+       BUS_DATA_PIN_GROUP(bsc_data, 8),
+       BUS_DATA_PIN_GROUP(bsc_data, 16),
+       BUS_DATA_PIN_GROUP(bsc_data, 32),
        SH_PFC_PIN_GROUP(bsc_cs0),
        SH_PFC_PIN_GROUP(bsc_cs2),
        SH_PFC_PIN_GROUP(bsc_cs4),
@@ -2760,9 +2574,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(bsc_cs5a_1),
        SH_PFC_PIN_GROUP(bsc_cs5b),
        SH_PFC_PIN_GROUP(bsc_cs6a),
-       SH_PFC_PIN_GROUP(bsc_rd_we8),
-       SH_PFC_PIN_GROUP(bsc_rd_we16),
-       SH_PFC_PIN_GROUP(bsc_rd_we32),
+       SH_PFC_PIN_GROUP_SUBSET(bsc_rd_we8, bsc_rd_we, 0, 2),
+       SH_PFC_PIN_GROUP_SUBSET(bsc_rd_we16, bsc_rd_we, 0, 3),
+       SH_PFC_PIN_GROUP_SUBSET(bsc_rd_we32, bsc_rd_we, 0, 5),
        SH_PFC_PIN_GROUP(bsc_bs),
        SH_PFC_PIN_GROUP(bsc_rdwr),
        SH_PFC_PIN_GROUP(ceu0_data_0_7),
@@ -2847,11 +2661,11 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(intc_irq30_1),
        SH_PFC_PIN_GROUP(intc_irq31_0),
        SH_PFC_PIN_GROUP(intc_irq31_1),
-       SH_PFC_PIN_GROUP(lcd0_data8),
-       SH_PFC_PIN_GROUP(lcd0_data9),
-       SH_PFC_PIN_GROUP(lcd0_data12),
-       SH_PFC_PIN_GROUP(lcd0_data16),
-       SH_PFC_PIN_GROUP(lcd0_data18),
+       SH_PFC_PIN_GROUP_SUBSET(lcd0_data8, lcd0_data24_0, 0, 8),
+       SH_PFC_PIN_GROUP_SUBSET(lcd0_data9, lcd0_data24_0, 0, 9),
+       SH_PFC_PIN_GROUP_SUBSET(lcd0_data12, lcd0_data24_0, 0, 12),
+       SH_PFC_PIN_GROUP_SUBSET(lcd0_data16, lcd0_data24_0, 0, 16),
+       SH_PFC_PIN_GROUP_SUBSET(lcd0_data18, lcd0_data24_0, 0, 18),
        SH_PFC_PIN_GROUP(lcd0_data24_0),
        SH_PFC_PIN_GROUP(lcd0_data24_1),
        SH_PFC_PIN_GROUP(lcd0_display),
@@ -2859,23 +2673,23 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(lcd0_lclk_1),
        SH_PFC_PIN_GROUP(lcd0_sync),
        SH_PFC_PIN_GROUP(lcd0_sys),
-       SH_PFC_PIN_GROUP(lcd1_data8),
-       SH_PFC_PIN_GROUP(lcd1_data9),
-       SH_PFC_PIN_GROUP(lcd1_data12),
-       SH_PFC_PIN_GROUP(lcd1_data16),
-       SH_PFC_PIN_GROUP(lcd1_data18),
-       SH_PFC_PIN_GROUP(lcd1_data24),
+       BUS_DATA_PIN_GROUP(lcd1_data, 8),
+       BUS_DATA_PIN_GROUP(lcd1_data, 9),
+       BUS_DATA_PIN_GROUP(lcd1_data, 12),
+       BUS_DATA_PIN_GROUP(lcd1_data, 16),
+       BUS_DATA_PIN_GROUP(lcd1_data, 18),
+       BUS_DATA_PIN_GROUP(lcd1_data, 24),
        SH_PFC_PIN_GROUP(lcd1_display),
        SH_PFC_PIN_GROUP(lcd1_lclk),
        SH_PFC_PIN_GROUP(lcd1_sync),
        SH_PFC_PIN_GROUP(lcd1_sys),
-       SH_PFC_PIN_GROUP(mmc0_data1_0),
-       SH_PFC_PIN_GROUP(mmc0_data4_0),
-       SH_PFC_PIN_GROUP(mmc0_data8_0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1, _0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4, _0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8, _0),
        SH_PFC_PIN_GROUP(mmc0_ctrl_0),
-       SH_PFC_PIN_GROUP(mmc0_data1_1),
-       SH_PFC_PIN_GROUP(mmc0_data4_1),
-       SH_PFC_PIN_GROUP(mmc0_data8_1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1, _1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4, _1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8, _1),
        SH_PFC_PIN_GROUP(mmc0_ctrl_1),
        SH_PFC_PIN_GROUP(scifa0_data),
        SH_PFC_PIN_GROUP(scifa0_clk),
@@ -2912,18 +2726,18 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scifb_data_1),
        SH_PFC_PIN_GROUP(scifb_clk_1),
        SH_PFC_PIN_GROUP(scifb_ctrl_1),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
        SH_PFC_PIN_GROUP(sdhi1_cd),
        SH_PFC_PIN_GROUP(sdhi1_wp),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(sdhi2_cd_0),
        SH_PFC_PIN_GROUP(sdhi2_wp_0),
@@ -3681,7 +3495,7 @@ static const struct r8a7740_portcr_group r8a7740_portcr_offsets[] = {
        { 83, 0x0000 }, { 114, 0x1000 }, { 209, 0x2000 }, { 211, 0x3000 },
 };
 
-static void __iomem *r8a7740_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin)
+static int r8a7740_pin_to_portcr(unsigned int pin)
 {
        unsigned int i;
 
@@ -3690,10 +3504,10 @@ static void __iomem *r8a7740_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin)
                        &r8a7740_portcr_offsets[i];
 
                if (pin <= group->end_pin)
-                       return pfc->windows->virt + group->offset + pin;
+                       return group->offset + pin;
        }
 
-       return NULL;
+       return -1;
 }
 
 static const struct sh_pfc_soc_operations r8a7740_pfc_ops = {
index e6e5487..ee6e8fa 100644 (file)
@@ -1595,30 +1595,14 @@ static const unsigned int i2c4_e_mux[] = {
        SCL4_E_MARK, SDA4_E_MARK,
 };
 /* - MMC -------------------------------------------------------------------- */
-static const unsigned int mmc_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(0, 15),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC0_D0_SDHI1_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 16),
-       RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 18),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC0_D0_SDHI1_D0_MARK, MMC0_D1_SDHI1_D1_MARK,
-       MMC0_D2_SDHI1_D2_MARK, MMC0_D3_SDHI1_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 16),
        RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 18),
        RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20),
        RCAR_GP_PIN(0, 21), RCAR_GP_PIN(0, 22),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC0_D0_SDHI1_D0_MARK, MMC0_D1_SDHI1_D1_MARK,
        MMC0_D2_SDHI1_D2_MARK, MMC0_D3_SDHI1_D3_MARK,
        MMC0_D4_MARK, MMC0_D5_MARK,
@@ -1639,19 +1623,12 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_QSPI0_IO0_MARK, QSPI0_MISO_QSPI0_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18), RCAR_GP_PIN(1, 19),
        RCAR_GP_PIN(1, 20),
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_QSPI0_IO0_MARK, QSPI0_MISO_QSPI0_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -1662,19 +1639,12 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_QSPI1_IO0_MARK, QSPI1_MISO_QSPI1_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5), RCAR_GP_PIN(4, 7),
        RCAR_GP_PIN(4, 8),
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_QSPI1_IO0_MARK, QSPI1_MISO_QSPI1_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -1917,19 +1887,12 @@ static const unsigned int scif_clk_b_mux[] = {
        SCIF_CLK_B_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(0, 7),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 8),
        RCAR_GP_PIN(0, 9), RCAR_GP_PIN(0, 10),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK, SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -1954,29 +1917,6 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(0, 15),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       MMC0_D0_SDHI1_D0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 16),
-       RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 18),
-};
-static const unsigned int sdhi1_data4_mux[] = {
-       MMC0_D0_SDHI1_D0_MARK, MMC0_D1_SDHI1_D1_MARK,
-       MMC0_D2_SDHI1_D2_MARK, MMC0_D3_SDHI1_D3_MARK,
-};
-static const unsigned int sdhi1_ctrl_pins[] = {
-       /* CLK, CMD */
-       RCAR_GP_PIN(0, 13), RCAR_GP_PIN(0, 14),
-};
-static const unsigned int sdhi1_ctrl_mux[] = {
-       MMC0_CLK_SDHI1_CLK_MARK, MMC0_CMD_SDHI1_CMD_MARK,
-};
 static const unsigned int sdhi1_cd_pins[] = {
        /* CD */
        RCAR_GP_PIN(0, 19),
@@ -1992,19 +1932,12 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 16),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(4, 16), RCAR_GP_PIN(4, 17),
        RCAR_GP_PIN(4, 18), RCAR_GP_PIN(4, 19),
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK, SD2_DAT2_MARK, SD2_DAT3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -2047,43 +1980,39 @@ static const unsigned int usb1_mux[] = {
        USB1_OVC_MARK,
 };
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 21),
-               RCAR_GP_PIN(5, 22), RCAR_GP_PIN(5, 23),
-               RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 25),
-               RCAR_GP_PIN(5, 26), RCAR_GP_PIN(5, 27),
-               /* G */
-               RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-               RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-               RCAR_GP_PIN(4, 6), RCAR_GP_PIN(5, 8),
-               RCAR_GP_PIN(5, 9), RCAR_GP_PIN(5, 10),
-               /* R */
-               RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 12),
-               RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 14),
-               RCAR_GP_PIN(5, 15), RCAR_GP_PIN(5, 16),
-               RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 19),
-       },
+static const unsigned int vin0_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 21),
+       RCAR_GP_PIN(5, 22), RCAR_GP_PIN(5, 23),
+       RCAR_GP_PIN(5, 24), RCAR_GP_PIN(5, 25),
+       RCAR_GP_PIN(5, 26), RCAR_GP_PIN(5, 27),
+       /* G */
+       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
+       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
+       RCAR_GP_PIN(4, 6), RCAR_GP_PIN(5, 8),
+       RCAR_GP_PIN(5, 9), RCAR_GP_PIN(5, 10),
+       /* R */
+       RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 12),
+       RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 14),
+       RCAR_GP_PIN(5, 15), RCAR_GP_PIN(5, 16),
+       RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 19),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               /* B */
-               VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
-               VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
-               VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
-               VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
-               /* G */
-               VI0_G0_MARK, VI0_G1_MARK,
-               VI0_G2_MARK, VI0_G3_MARK,
-               VI0_G4_MARK, VI0_G5_MARK,
-               VI0_G6_MARK, VI0_G7_MARK,
-               /* R */
-               VI0_R0_MARK, VI0_R1_MARK,
-               VI0_R2_MARK, VI0_R3_MARK,
-               VI0_R4_MARK, VI0_R5_MARK,
-               VI0_R6_MARK, VI0_R7_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       /* B */
+       VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
+       VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
+       VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
+       VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
+       /* G */
+       VI0_G0_MARK, VI0_G1_MARK,
+       VI0_G2_MARK, VI0_G3_MARK,
+       VI0_G4_MARK, VI0_G5_MARK,
+       VI0_G6_MARK, VI0_G7_MARK,
+       /* R */
+       VI0_R0_MARK, VI0_R1_MARK,
+       VI0_R2_MARK, VI0_R3_MARK,
+       VI0_R4_MARK, VI0_R5_MARK,
+       VI0_R6_MARK, VI0_R7_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        /* B */
@@ -2140,25 +2069,21 @@ static const unsigned int vin0_clk_mux[] = {
        VI0_CLK_MARK,
 };
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data vin1_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(3,  1), RCAR_GP_PIN(3, 2),
-               RCAR_GP_PIN(3,  3), RCAR_GP_PIN(3, 4),
-               RCAR_GP_PIN(3,  5), RCAR_GP_PIN(3, 6),
-               RCAR_GP_PIN(3,  7), RCAR_GP_PIN(3, 8),
-               RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
-               RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
-       },
+static const unsigned int vin1_data_pins[] = {
+       RCAR_GP_PIN(3,  1), RCAR_GP_PIN(3, 2),
+       RCAR_GP_PIN(3,  3), RCAR_GP_PIN(3, 4),
+       RCAR_GP_PIN(3,  5), RCAR_GP_PIN(3, 6),
+       RCAR_GP_PIN(3,  7), RCAR_GP_PIN(3, 8),
+       RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
+       RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
 };
-static const union vin_data vin1_data_mux = {
-       .data12 = {
-               VI1_DATA0_MARK, VI1_DATA1_MARK,
-               VI1_DATA2_MARK, VI1_DATA3_MARK,
-               VI1_DATA4_MARK, VI1_DATA5_MARK,
-               VI1_DATA6_MARK, VI1_DATA7_MARK,
-               VI1_DATA8_MARK, VI1_DATA9_MARK,
-               VI1_DATA10_MARK, VI1_DATA11_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       VI1_DATA0_MARK, VI1_DATA1_MARK,
+       VI1_DATA2_MARK, VI1_DATA3_MARK,
+       VI1_DATA4_MARK, VI1_DATA5_MARK,
+       VI1_DATA6_MARK, VI1_DATA7_MARK,
+       VI1_DATA8_MARK, VI1_DATA9_MARK,
+       VI1_DATA10_MARK, VI1_DATA11_MARK,
 };
 static const unsigned int vin1_sync_pins[] = {
        RCAR_GP_PIN(3, 11), /* HSYNC */
@@ -2243,16 +2168,16 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(i2c4_c),
        SH_PFC_PIN_GROUP(i2c4_d),
        SH_PFC_PIN_GROUP(i2c4_e),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(qspi0_ctrl),
-       SH_PFC_PIN_GROUP(qspi0_data2),
-       SH_PFC_PIN_GROUP(qspi0_data4),
+       BUS_DATA_PIN_GROUP(qspi0_data, 2),
+       BUS_DATA_PIN_GROUP(qspi0_data, 4),
        SH_PFC_PIN_GROUP(qspi1_ctrl),
-       SH_PFC_PIN_GROUP(qspi1_data2),
-       SH_PFC_PIN_GROUP(qspi1_data4),
+       BUS_DATA_PIN_GROUP(qspi1_data, 2),
+       BUS_DATA_PIN_GROUP(qspi1_data, 4),
        SH_PFC_PIN_GROUP(scif0_data_a),
        SH_PFC_PIN_GROUP(scif0_data_b),
        SH_PFC_PIN_GROUP(scif0_data_c),
@@ -2286,37 +2211,37 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scif5_data_f),
        SH_PFC_PIN_GROUP(scif_clk_a),
        SH_PFC_PIN_GROUP(scif_clk_b),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
-       SH_PFC_PIN_GROUP(sdhi1_ctrl),
+       SH_PFC_PIN_GROUP_SUBSET(sdhi1_data1, mmc_data, 0, 1),
+       SH_PFC_PIN_GROUP_SUBSET(sdhi1_data4, mmc_data, 0, 4),
+       SH_PFC_PIN_GROUP_ALIAS(sdhi1_ctrl, mmc_ctrl),
        SH_PFC_PIN_GROUP(sdhi1_cd),
        SH_PFC_PIN_GROUP(sdhi1_wp),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(sdhi2_cd),
        SH_PFC_PIN_GROUP(sdhi2_wp),
        SH_PFC_PIN_GROUP(usb0),
        SH_PFC_PIN_GROUP(usb1),
-       VIN_DATA_PIN_GROUP(vin0_data, 24),
-       VIN_DATA_PIN_GROUP(vin0_data, 20),
+       BUS_DATA_PIN_GROUP(vin0_data, 24),
+       BUS_DATA_PIN_GROUP(vin0_data, 20),
        SH_PFC_PIN_GROUP(vin0_data18),
-       VIN_DATA_PIN_GROUP(vin0_data, 16),
-       VIN_DATA_PIN_GROUP(vin0_data, 12),
-       VIN_DATA_PIN_GROUP(vin0_data, 10),
-       VIN_DATA_PIN_GROUP(vin0_data, 8),
+       BUS_DATA_PIN_GROUP(vin0_data, 16),
+       BUS_DATA_PIN_GROUP(vin0_data, 12),
+       BUS_DATA_PIN_GROUP(vin0_data, 10),
+       BUS_DATA_PIN_GROUP(vin0_data, 8),
        SH_PFC_PIN_GROUP(vin0_sync),
        SH_PFC_PIN_GROUP(vin0_field),
        SH_PFC_PIN_GROUP(vin0_clkenb),
        SH_PFC_PIN_GROUP(vin0_clk),
-       VIN_DATA_PIN_GROUP(vin1_data, 12),
-       VIN_DATA_PIN_GROUP(vin1_data, 10),
-       VIN_DATA_PIN_GROUP(vin1_data, 8),
+       BUS_DATA_PIN_GROUP(vin1_data, 12),
+       BUS_DATA_PIN_GROUP(vin1_data, 10),
+       BUS_DATA_PIN_GROUP(vin1_data, 8),
        SH_PFC_PIN_GROUP(vin1_sync),
        SH_PFC_PIN_GROUP(vin1_field),
        SH_PFC_PIN_GROUP(vin1_clkenb),
@@ -3420,8 +3345,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        { },
 };
 
-static int r8a77470_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a77470_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -3683,7 +3607,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ }
 };
 
-static const struct sh_pfc_soc_operations r8a77470_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77470_pfc_ops = {
        .pin_to_pocctrl = r8a77470_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -3692,7 +3616,7 @@ static const struct sh_pfc_soc_operations r8a77470_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77470
 const struct sh_pfc_soc_info r8a77470_pinmux_info = {
        .name = "r8a77470_pfc",
-       .ops = &r8a77470_pinmux_ops,
+       .ops = &r8a77470_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index d641e40..a24672c 100644 (file)
@@ -1427,25 +1427,17 @@ I2C_PFC_MUX(i2c3_c,     SDA3_C,                 SCL3_C);
 /* - MMC macro -------------------------------------------------------------- */
 #define MMC_PFC_PINS(name, args...)            SH_PFC_PINS(name, args)
 #define MMC_PFC_CTRL(name, clk, cmd)           SH_PFC_MUX2(name, clk, cmd)
-#define MMC_PFC_DAT1(name, d0)                 SH_PFC_MUX1(name, d0)
-#define MMC_PFC_DAT4(name, d0, d1, d2, d3)     SH_PFC_MUX4(name, d0, d1, d2, d3)
 #define MMC_PFC_DAT8(name, d0, d1, d2, d3, d4, d5, d6, d7)     \
                        SH_PFC_MUX8(name, d0, d1, d2, d3, d4, d5, d6, d7)
 
 /* - MMC -------------------------------------------------------------------- */
 MMC_PFC_PINS(mmc_ctrl,         RCAR_GP_PIN(1, 5),      RCAR_GP_PIN(1, 6));
 MMC_PFC_CTRL(mmc_ctrl,         MMC_CLK,                MMC_CMD);
-MMC_PFC_PINS(mmc_data1,                RCAR_GP_PIN(1, 7));
-MMC_PFC_DAT1(mmc_data1,                MMC_D0);
-MMC_PFC_PINS(mmc_data4,                RCAR_GP_PIN(1, 7),      RCAR_GP_PIN(1, 8),
-                               RCAR_GP_PIN(0, 5),      RCAR_GP_PIN(0, 6));
-MMC_PFC_DAT4(mmc_data4,                MMC_D0,                 MMC_D1,
-                               MMC_D2,                 MMC_D3);
-MMC_PFC_PINS(mmc_data8,                RCAR_GP_PIN(1, 7),      RCAR_GP_PIN(1, 8),
+MMC_PFC_PINS(mmc_data,         RCAR_GP_PIN(1, 7),      RCAR_GP_PIN(1, 8),
                                RCAR_GP_PIN(0, 5),      RCAR_GP_PIN(0, 6),
                                RCAR_GP_PIN(1, 4),      RCAR_GP_PIN(1, 0),
                                RCAR_GP_PIN(0, 30),     RCAR_GP_PIN(0, 31));
-MMC_PFC_DAT8(mmc_data8,                MMC_D0,                 MMC_D1,
+MMC_PFC_DAT8(mmc_data,         MMC_D0,                 MMC_D1,
                                MMC_D2,                 MMC_D3,
                                MMC_D4,                 MMC_D5,
                                MMC_D6,                 MMC_D7);
@@ -1530,7 +1522,6 @@ SCIF_PFC_DAT(scif5_data_b,        TX5_B,                  RX5_B);
 
 /* - SDHI macro ------------------------------------------------------------- */
 #define SDHI_PFC_PINS(name, args...)           SH_PFC_PINS(name, args)
-#define SDHI_PFC_DAT1(name, d0)                        SH_PFC_MUX1(name, d0)
 #define SDHI_PFC_DAT4(name, d0, d1, d2, d3)    SH_PFC_MUX4(name, d0, d1, d2, d3)
 #define SDHI_PFC_CTRL(name, clk, cmd)          SH_PFC_MUX2(name, clk, cmd)
 #define SDHI_PFC_CDPN(name, cd)                        SH_PFC_MUX1(name, cd)
@@ -1541,11 +1532,9 @@ SDHI_PFC_PINS(sdhi0_cd,          RCAR_GP_PIN(3, 17));
 SDHI_PFC_CDPN(sdhi0_cd,                SD0_CD);
 SDHI_PFC_PINS(sdhi0_ctrl,      RCAR_GP_PIN(3, 11),     RCAR_GP_PIN(3, 12));
 SDHI_PFC_CTRL(sdhi0_ctrl,      SD0_CLK,                SD0_CMD);
-SDHI_PFC_PINS(sdhi0_data1,     RCAR_GP_PIN(3, 13));
-SDHI_PFC_DAT1(sdhi0_data1,     SD0_DAT0);
-SDHI_PFC_PINS(sdhi0_data4,     RCAR_GP_PIN(3, 13),     RCAR_GP_PIN(3, 14),
+SDHI_PFC_PINS(sdhi0_data,      RCAR_GP_PIN(3, 13),     RCAR_GP_PIN(3, 14),
                                RCAR_GP_PIN(3, 15),     RCAR_GP_PIN(3, 16));
-SDHI_PFC_DAT4(sdhi0_data4,     SD0_DAT0,               SD0_DAT1,
+SDHI_PFC_DAT4(sdhi0_data     SD0_DAT0,               SD0_DAT1,
                                SD0_DAT2,               SD0_DAT3);
 SDHI_PFC_PINS(sdhi0_wp,                RCAR_GP_PIN(3, 18));
 SDHI_PFC_WPPN(sdhi0_wp,                SD0_WP);
@@ -1559,17 +1548,13 @@ SDHI_PFC_PINS(sdhi1_ctrl_a,     RCAR_GP_PIN(1, 5),      RCAR_GP_PIN(1, 6));
 SDHI_PFC_CTRL(sdhi1_ctrl_a,    SD1_CLK_A,              SD1_CMD_A);
 SDHI_PFC_PINS(sdhi1_ctrl_b,    RCAR_GP_PIN(1, 17),     RCAR_GP_PIN(1, 16));
 SDHI_PFC_CTRL(sdhi1_ctrl_b,    SD1_CLK_B,              SD1_CMD_B);
-SDHI_PFC_PINS(sdhi1_data1_a,   RCAR_GP_PIN(1, 7));
-SDHI_PFC_DAT1(sdhi1_data1_a,   SD1_DAT0_A);
-SDHI_PFC_PINS(sdhi1_data1_b,   RCAR_GP_PIN(1, 18));
-SDHI_PFC_DAT1(sdhi1_data1_b,   SD1_DAT0_B);
-SDHI_PFC_PINS(sdhi1_data4_a,   RCAR_GP_PIN(1, 7),      RCAR_GP_PIN(1, 8),
+SDHI_PFC_PINS(sdhi1_data_a,    RCAR_GP_PIN(1, 7),      RCAR_GP_PIN(1, 8),
                                RCAR_GP_PIN(0, 5),      RCAR_GP_PIN(0, 6));
-SDHI_PFC_DAT4(sdhi1_data4_a,   SD1_DAT0_A,             SD1_DAT1_A,
+SDHI_PFC_DAT4(sdhi1_data_a,    SD1_DAT0_A,             SD1_DAT1_A,
                                SD1_DAT2_A,             SD1_DAT3_A);
-SDHI_PFC_PINS(sdhi1_data4_b,   RCAR_GP_PIN(1, 18),     RCAR_GP_PIN(1, 19),
+SDHI_PFC_PINS(sdhi1_data_b,    RCAR_GP_PIN(1, 18),     RCAR_GP_PIN(1, 19),
                                RCAR_GP_PIN(1, 20),     RCAR_GP_PIN(1, 21));
-SDHI_PFC_DAT4(sdhi1_data4_b,   SD1_DAT0_B,             SD1_DAT1_B,
+SDHI_PFC_DAT4(sdhi1_data_b,    SD1_DAT0_B,             SD1_DAT1_B,
                                SD1_DAT2_B,             SD1_DAT3_B);
 SDHI_PFC_PINS(sdhi1_wp_a,      RCAR_GP_PIN(0, 31));
 SDHI_PFC_WPPN(sdhi1_wp_a,      SD1_WP_A);
@@ -1585,17 +1570,13 @@ SDHI_PFC_PINS(sdhi2_ctrl_a,     RCAR_GP_PIN(4, 17),     RCAR_GP_PIN(4, 18));
 SDHI_PFC_CTRL(sdhi2_ctrl_a,    SD2_CLK_A,              SD2_CMD_A);
 SDHI_PFC_PINS(sdhi2_ctrl_b,    RCAR_GP_PIN(4, 5),      RCAR_GP_PIN(4, 6));
 SDHI_PFC_CTRL(sdhi2_ctrl_b,    SD2_CLK_B,              SD2_CMD_B);
-SDHI_PFC_PINS(sdhi2_data1_a,   RCAR_GP_PIN(4, 19));
-SDHI_PFC_DAT1(sdhi2_data1_a,   SD2_DAT0_A);
-SDHI_PFC_PINS(sdhi2_data1_b,   RCAR_GP_PIN(4, 7));
-SDHI_PFC_DAT1(sdhi2_data1_b,   SD2_DAT0_B);
-SDHI_PFC_PINS(sdhi2_data4_a,   RCAR_GP_PIN(4, 19),     RCAR_GP_PIN(4, 20),
+SDHI_PFC_PINS(sdhi2_data_a,    RCAR_GP_PIN(4, 19),     RCAR_GP_PIN(4, 20),
                                RCAR_GP_PIN(4, 21),     RCAR_GP_PIN(4, 22));
-SDHI_PFC_DAT4(sdhi2_data4_a,   SD2_DAT0_A,             SD2_DAT1_A,
+SDHI_PFC_DAT4(sdhi2_data_a,    SD2_DAT0_A,             SD2_DAT1_A,
                                SD2_DAT2_A,             SD2_DAT3_A);
-SDHI_PFC_PINS(sdhi2_data4_b,   RCAR_GP_PIN(4, 7),      RCAR_GP_PIN(4, 8),
+SDHI_PFC_PINS(sdhi2_data_b,    RCAR_GP_PIN(4, 7),      RCAR_GP_PIN(4, 8),
                                RCAR_GP_PIN(3, 25),     RCAR_GP_PIN(3, 26));
-SDHI_PFC_DAT4(sdhi2_data4_b,   SD2_DAT0_B,             SD2_DAT1_B,
+SDHI_PFC_DAT4(sdhi2_data_b,    SD2_DAT0_B,             SD2_DAT1_B,
                                SD2_DAT2_B,             SD2_DAT3_B);
 SDHI_PFC_PINS(sdhi2_wp_a,      RCAR_GP_PIN(4, 24));
 SDHI_PFC_WPPN(sdhi2_wp_a,      SD2_WP_A);
@@ -1744,9 +1725,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(i2c3_b),
        SH_PFC_PIN_GROUP(i2c3_c),
        SH_PFC_PIN_GROUP(mmc_ctrl),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(scif_clk),
        SH_PFC_PIN_GROUP(scif0_data_a),
        SH_PFC_PIN_GROUP(scif0_data_b),
@@ -1781,27 +1762,27 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scif5_data_b),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_wp),
        SH_PFC_PIN_GROUP(sdhi1_cd_a),
        SH_PFC_PIN_GROUP(sdhi1_cd_b),
        SH_PFC_PIN_GROUP(sdhi1_ctrl_a),
        SH_PFC_PIN_GROUP(sdhi1_ctrl_b),
-       SH_PFC_PIN_GROUP(sdhi1_data1_a),
-       SH_PFC_PIN_GROUP(sdhi1_data1_b),
-       SH_PFC_PIN_GROUP(sdhi1_data4_a),
-       SH_PFC_PIN_GROUP(sdhi1_data4_b),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1, _a),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1, _b),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4, _a),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4, _b),
        SH_PFC_PIN_GROUP(sdhi1_wp_a),
        SH_PFC_PIN_GROUP(sdhi1_wp_b),
        SH_PFC_PIN_GROUP(sdhi2_cd_a),
        SH_PFC_PIN_GROUP(sdhi2_cd_b),
        SH_PFC_PIN_GROUP(sdhi2_ctrl_a),
        SH_PFC_PIN_GROUP(sdhi2_ctrl_b),
-       SH_PFC_PIN_GROUP(sdhi2_data1_a),
-       SH_PFC_PIN_GROUP(sdhi2_data1_b),
-       SH_PFC_PIN_GROUP(sdhi2_data4_a),
-       SH_PFC_PIN_GROUP(sdhi2_data4_b),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1, _a),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1, _b),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4, _a),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4, _b),
        SH_PFC_PIN_GROUP(sdhi2_wp_a),
        SH_PFC_PIN_GROUP(sdhi2_wp_b),
        SH_PFC_PIN_GROUP(ssi012_ctrl),
index 3e47cdc..296b5fb 100644 (file)
@@ -1928,28 +1928,13 @@ static const unsigned int lbsc_ex_cs5_mux[] = {
        EX_CS5_MARK,
 };
 /* - MMCIF ------------------------------------------------------------------ */
-static const unsigned int mmc0_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(0, 19),
-};
-static const unsigned int mmc0_data1_mux[] = {
-       MMC0_D0_MARK,
-};
-static const unsigned int mmc0_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20), RCAR_GP_PIN(0, 21),
-       RCAR_GP_PIN(0, 2),
-};
-static const unsigned int mmc0_data4_mux[] = {
-       MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
-};
-static const unsigned int mmc0_data8_pins[] = {
+static const unsigned int mmc0_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20), RCAR_GP_PIN(0, 21),
        RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
        RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 16),
 };
-static const unsigned int mmc0_data8_mux[] = {
+static const unsigned int mmc0_data_mux[] = {
        MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
        MMC0_D4_MARK, MMC0_D5_MARK, MMC0_D6_MARK, MMC0_D7_MARK,
 };
@@ -1960,28 +1945,13 @@ static const unsigned int mmc0_ctrl_pins[] = {
 static const unsigned int mmc0_ctrl_mux[] = {
        MMC0_CMD_MARK, MMC0_CLK_MARK,
 };
-static const unsigned int mmc1_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(2, 8),
-};
-static const unsigned int mmc1_data1_mux[] = {
-       MMC1_D0_MARK,
-};
-static const unsigned int mmc1_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9), RCAR_GP_PIN(2, 10),
-       RCAR_GP_PIN(2, 11),
-};
-static const unsigned int mmc1_data4_mux[] = {
-       MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
-};
-static const unsigned int mmc1_data8_pins[] = {
+static const unsigned int mmc1_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(2, 8),  RCAR_GP_PIN(2, 9),  RCAR_GP_PIN(2, 10),
        RCAR_GP_PIN(2, 11), RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
        RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17),
 };
-static const unsigned int mmc1_data8_mux[] = {
+static const unsigned int mmc1_data_mux[] = {
        MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
        MMC1_D4_MARK, MMC1_D5_MARK, MMC1_D6_MARK, MMC1_D7_MARK,
 };
@@ -2386,19 +2356,12 @@ static const unsigned int scif_clk_d_mux[] = {
        SCIF_CLK_D_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 21),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 22), RCAR_GP_PIN(3, 23),
        RCAR_GP_PIN(3, 24),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK, SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -2423,19 +2386,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(0, 19),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20), RCAR_GP_PIN(0, 21),
        RCAR_GP_PIN(0, 2),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK, SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -2460,19 +2416,12 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 1),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4),
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK, SD2_DAT2_MARK, SD2_DAT3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -2497,19 +2446,12 @@ static const unsigned int sdhi2_wp_mux[] = {
        SD2_WP_MARK,
 };
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(1, 18),
-};
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-static const unsigned int sdhi3_data4_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(1, 18), RCAR_GP_PIN(1, 19), RCAR_GP_PIN(1, 20),
        RCAR_GP_PIN(1, 21),
 };
-static const unsigned int sdhi3_data4_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK, SD3_DAT2_MARK, SD3_DAT3_MARK,
 };
 static const unsigned int sdhi3_ctrl_pins[] = {
@@ -2749,13 +2691,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(lbsc_ex_cs3),
        SH_PFC_PIN_GROUP(lbsc_ex_cs4),
        SH_PFC_PIN_GROUP(lbsc_ex_cs5),
-       SH_PFC_PIN_GROUP(mmc0_data1),
-       SH_PFC_PIN_GROUP(mmc0_data4),
-       SH_PFC_PIN_GROUP(mmc0_data8),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8),
        SH_PFC_PIN_GROUP(mmc0_ctrl),
-       SH_PFC_PIN_GROUP(mmc1_data1),
-       SH_PFC_PIN_GROUP(mmc1_data4),
-       SH_PFC_PIN_GROUP(mmc1_data8),
+       BUS_DATA_PIN_GROUP(mmc1_data, 1),
+       BUS_DATA_PIN_GROUP(mmc1_data, 4),
+       BUS_DATA_PIN_GROUP(mmc1_data, 8),
        SH_PFC_PIN_GROUP(mmc1_ctrl),
        SH_PFC_PIN_GROUP(scif0_data),
        SH_PFC_PIN_GROUP(scif0_clk),
@@ -2812,23 +2754,23 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scif_clk_b),
        SH_PFC_PIN_GROUP(scif_clk_c),
        SH_PFC_PIN_GROUP(scif_clk_d),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
        SH_PFC_PIN_GROUP(sdhi1_cd),
        SH_PFC_PIN_GROUP(sdhi1_wp),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(sdhi2_cd),
        SH_PFC_PIN_GROUP(sdhi2_wp),
-       SH_PFC_PIN_GROUP(sdhi3_data1),
-       SH_PFC_PIN_GROUP(sdhi3_data4),
+       BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi3_data, 4),
        SH_PFC_PIN_GROUP(sdhi3_ctrl),
        SH_PFC_PIN_GROUP(sdhi3_cd),
        SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -3133,10 +3075,6 @@ static const struct sh_pfc_function pinmux_functions[] = {
        SH_PFC_FUNCTION(lbsc),
        SH_PFC_FUNCTION(mmc0),
        SH_PFC_FUNCTION(mmc1),
-       SH_PFC_FUNCTION(sdhi0),
-       SH_PFC_FUNCTION(sdhi1),
-       SH_PFC_FUNCTION(sdhi2),
-       SH_PFC_FUNCTION(sdhi3),
        SH_PFC_FUNCTION(scif0),
        SH_PFC_FUNCTION(scif1),
        SH_PFC_FUNCTION(scif2),
@@ -3144,6 +3082,10 @@ static const struct sh_pfc_function pinmux_functions[] = {
        SH_PFC_FUNCTION(scif4),
        SH_PFC_FUNCTION(scif5),
        SH_PFC_FUNCTION(scif_clk),
+       SH_PFC_FUNCTION(sdhi0),
+       SH_PFC_FUNCTION(sdhi1),
+       SH_PFC_FUNCTION(sdhi2),
+       SH_PFC_FUNCTION(sdhi3),
        SH_PFC_FUNCTION(usb0),
        SH_PFC_FUNCTION(usb1),
        SH_PFC_FUNCTION(usb2),
index 08c0a23..9db9e61 100644 (file)
@@ -194,24 +194,24 @@ enum {
        FN_CAN1_TX, FN_DRACK0, FN_IETX_C, FN_RD_N,
        FN_CAN0_TX, FN_SCIFA0_SCK_B, FN_RD_WR_N, FN_VI1_G3,
        FN_VI1_G3_B, FN_VI2_R5, FN_SCIFA0_RXD_B,
-       FN_INTC_IRQ4_N, FN_WE0_N, FN_IECLK, FN_CAN_CLK,
+       FN_WE0_N, FN_IECLK, FN_CAN_CLK,
        FN_VI2_VSYNC_N, FN_SCIFA0_TXD_B, FN_VI2_VSYNC_N_B,
        FN_WE1_N, FN_IERX, FN_CAN1_RX, FN_VI1_G4,
        FN_VI1_G4_B, FN_VI2_R6, FN_SCIFA0_CTS_N_B,
-       FN_IERX_C, FN_EX_WAIT0, FN_IRQ3, FN_INTC_IRQ3_N,
+       FN_IERX_C, FN_EX_WAIT0, FN_IRQ3,
        FN_VI3_CLK, FN_SCIFA0_RTS_N_B, FN_HRX0_B,
        FN_MSIOF0_SCK_B, FN_DREQ0_N, FN_VI1_HSYNC_N,
        FN_VI1_HSYNC_N_B, FN_VI2_R7, FN_SSI_SCK78_C,
        FN_SSI_WS78_B,
 
        /* IPSR6 */
-       FN_DACK0, FN_IRQ0, FN_INTC_IRQ0_N, FN_SSI_SCK6_B,
+       FN_DACK0, FN_IRQ0, FN_SSI_SCK6_B,
        FN_VI1_VSYNC_N, FN_VI1_VSYNC_N_B, FN_SSI_WS78_C,
        FN_DREQ1_N, FN_VI1_CLKENB, FN_VI1_CLKENB_B,
        FN_SSI_SDATA7_C, FN_SSI_SCK78_B, FN_DACK1, FN_IRQ1,
-       FN_INTC_IRQ1_N, FN_SSI_WS6_B, FN_SSI_SDATA8_C,
+       FN_SSI_WS6_B, FN_SSI_SDATA8_C,
        FN_DREQ2_N, FN_HSCK1_B, FN_HCTS0_N_B,
-       FN_MSIOF0_TXD_B, FN_DACK2, FN_IRQ2, FN_INTC_IRQ2_N,
+       FN_MSIOF0_TXD_B, FN_DACK2, FN_IRQ2,
        FN_SSI_SDATA6_B, FN_HRTS0_N_B, FN_MSIOF0_RXD_B,
        FN_ETH_CRS_DV, FN_STP_ISCLK_0_B,
        FN_TS_SDEN0_D, FN_GLO_Q0_C, FN_IIC2_SCL_E,
@@ -568,23 +568,23 @@ enum {
        CAN1_TX_MARK, DRACK0_MARK, IETX_C_MARK, RD_N_MARK,
        CAN0_TX_MARK, SCIFA0_SCK_B_MARK, RD_WR_N_MARK, VI1_G3_MARK,
        VI1_G3_B_MARK, VI2_R5_MARK, SCIFA0_RXD_B_MARK,
-       INTC_IRQ4_N_MARK, WE0_N_MARK, IECLK_MARK, CAN_CLK_MARK,
+       WE0_N_MARK, IECLK_MARK, CAN_CLK_MARK,
        VI2_VSYNC_N_MARK, SCIFA0_TXD_B_MARK, VI2_VSYNC_N_B_MARK,
        WE1_N_MARK, IERX_MARK, CAN1_RX_MARK, VI1_G4_MARK,
        VI1_G4_B_MARK, VI2_R6_MARK, SCIFA0_CTS_N_B_MARK,
-       IERX_C_MARK, EX_WAIT0_MARK, IRQ3_MARK, INTC_IRQ3_N_MARK,
+       IERX_C_MARK, EX_WAIT0_MARK, IRQ3_MARK,
        VI3_CLK_MARK, SCIFA0_RTS_N_B_MARK, HRX0_B_MARK,
        MSIOF0_SCK_B_MARK, DREQ0_N_MARK, VI1_HSYNC_N_MARK,
        VI1_HSYNC_N_B_MARK, VI2_R7_MARK, SSI_SCK78_C_MARK,
        SSI_WS78_B_MARK,
 
-       DACK0_MARK, IRQ0_MARK, INTC_IRQ0_N_MARK, SSI_SCK6_B_MARK,
+       DACK0_MARK, IRQ0_MARK, SSI_SCK6_B_MARK,
        VI1_VSYNC_N_MARK, VI1_VSYNC_N_B_MARK, SSI_WS78_C_MARK,
        DREQ1_N_MARK, VI1_CLKENB_MARK, VI1_CLKENB_B_MARK,
        SSI_SDATA7_C_MARK, SSI_SCK78_B_MARK, DACK1_MARK, IRQ1_MARK,
-       INTC_IRQ1_N_MARK, SSI_WS6_B_MARK, SSI_SDATA8_C_MARK,
+       SSI_WS6_B_MARK, SSI_SDATA8_C_MARK,
        DREQ2_N_MARK, HSCK1_B_MARK, HCTS0_N_B_MARK,
-       MSIOF0_TXD_B_MARK, DACK2_MARK, IRQ2_MARK, INTC_IRQ2_N_MARK,
+       MSIOF0_TXD_B_MARK, DACK2_MARK, IRQ2_MARK,
        SSI_SDATA6_B_MARK, HRTS0_N_B_MARK, MSIOF0_RXD_B_MARK,
        ETH_CRS_DV_MARK, STP_ISCLK_0_B_MARK,
        TS_SDEN0_D_MARK, GLO_Q0_C_MARK, IIC2_SCL_E_MARK,
@@ -1094,7 +1094,6 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP5_17_15, VI1_G3_B, SEL_VI1_1),
        PINMUX_IPSR_GPSR(IP5_17_15, VI2_R5),
        PINMUX_IPSR_MSEL(IP5_17_15, SCIFA0_RXD_B, SEL_SCFA_1),
-       PINMUX_IPSR_GPSR(IP5_17_15, INTC_IRQ4_N),
        PINMUX_IPSR_GPSR(IP5_20_18, WE0_N),
        PINMUX_IPSR_MSEL(IP5_20_18, IECLK, SEL_IEB_0),
        PINMUX_IPSR_MSEL(IP5_20_18, CAN_CLK, SEL_CANCLK_0),
@@ -1111,7 +1110,6 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP5_23_21, IERX_C, SEL_IEB_2),
        PINMUX_IPSR_MSEL(IP5_26_24, EX_WAIT0, SEL_LBS_0),
        PINMUX_IPSR_GPSR(IP5_26_24, IRQ3),
-       PINMUX_IPSR_GPSR(IP5_26_24, INTC_IRQ3_N),
        PINMUX_IPSR_MSEL(IP5_26_24, VI3_CLK, SEL_VI3_0),
        PINMUX_IPSR_MSEL(IP5_26_24, SCIFA0_RTS_N_B, SEL_SCFA_1),
        PINMUX_IPSR_MSEL(IP5_26_24, HRX0_B, SEL_HSCIF0_1),
@@ -1125,7 +1123,6 @@ static const u16 pinmux_data[] = {
 
        PINMUX_IPSR_GPSR(IP6_2_0, DACK0),
        PINMUX_IPSR_GPSR(IP6_2_0, IRQ0),
-       PINMUX_IPSR_GPSR(IP6_2_0, INTC_IRQ0_N),
        PINMUX_IPSR_MSEL(IP6_2_0, SSI_SCK6_B, SEL_SSI6_1),
        PINMUX_IPSR_MSEL(IP6_2_0, VI1_VSYNC_N, SEL_VI1_0),
        PINMUX_IPSR_MSEL(IP6_2_0, VI1_VSYNC_N_B, SEL_VI1_1),
@@ -1137,7 +1134,6 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP6_5_3, SSI_SCK78_B, SEL_SSI7_1),
        PINMUX_IPSR_GPSR(IP6_8_6, DACK1),
        PINMUX_IPSR_GPSR(IP6_8_6, IRQ1),
-       PINMUX_IPSR_GPSR(IP6_8_6, INTC_IRQ1_N),
        PINMUX_IPSR_MSEL(IP6_8_6, SSI_WS6_B, SEL_SSI6_1),
        PINMUX_IPSR_MSEL(IP6_8_6, SSI_SDATA8_C, SEL_SSI8_2),
        PINMUX_IPSR_GPSR(IP6_10_9, DREQ2_N),
@@ -1146,7 +1142,6 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP6_10_9, MSIOF0_TXD_B, SEL_SOF0_1),
        PINMUX_IPSR_GPSR(IP6_13_11, DACK2),
        PINMUX_IPSR_GPSR(IP6_13_11, IRQ2),
-       PINMUX_IPSR_GPSR(IP6_13_11, INTC_IRQ2_N),
        PINMUX_IPSR_MSEL(IP6_13_11, SSI_SDATA6_B, SEL_SSI6_1),
        PINMUX_IPSR_MSEL(IP6_13_11, HRTS0_N_B, SEL_HSCIF0_1),
        PINMUX_IPSR_MSEL(IP6_13_11, MSIOF0_RXD_B, SEL_SOF0_1),
@@ -2410,29 +2405,14 @@ static const unsigned int mlb_3pin_mux[] = {
 #endif /* CONFIG_PINCTRL_PFC_R8A7790 */
 
 /* - MMCIF0 ----------------------------------------------------------------- */
-static const unsigned int mmc0_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(3, 18),
-};
-static const unsigned int mmc0_data1_mux[] = {
-       MMC0_D0_MARK,
-};
-static const unsigned int mmc0_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(3, 18), RCAR_GP_PIN(3, 19),
-       RCAR_GP_PIN(3, 20), RCAR_GP_PIN(3, 21),
-};
-static const unsigned int mmc0_data4_mux[] = {
-       MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
-};
-static const unsigned int mmc0_data8_pins[] = {
+static const unsigned int mmc0_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(3, 18), RCAR_GP_PIN(3, 19),
        RCAR_GP_PIN(3, 20), RCAR_GP_PIN(3, 21),
        RCAR_GP_PIN(3, 22), RCAR_GP_PIN(3, 23),
        RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
 };
-static const unsigned int mmc0_data8_mux[] = {
+static const unsigned int mmc0_data_mux[] = {
        MMC0_D0_MARK, MMC0_D1_MARK, MMC0_D2_MARK, MMC0_D3_MARK,
        MMC0_D4_MARK, MMC0_D5_MARK, MMC0_D6_MARK, MMC0_D7_MARK,
 };
@@ -2444,29 +2424,14 @@ static const unsigned int mmc0_ctrl_mux[] = {
        MMC0_CLK_MARK, MMC0_CMD_MARK,
 };
 /* - MMCIF1 ----------------------------------------------------------------- */
-static const unsigned int mmc1_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(3, 26),
-};
-static const unsigned int mmc1_data1_mux[] = {
-       MMC1_D0_MARK,
-};
-static const unsigned int mmc1_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(3, 26), RCAR_GP_PIN(3, 27),
-       RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 29),
-};
-static const unsigned int mmc1_data4_mux[] = {
-       MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
-};
-static const unsigned int mmc1_data8_pins[] = {
+static const unsigned int mmc1_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(3, 26), RCAR_GP_PIN(3, 27),
        RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 29),
        RCAR_GP_PIN(3, 30), RCAR_GP_PIN(3, 31),
        RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15),
 };
-static const unsigned int mmc1_data8_mux[] = {
+static const unsigned int mmc1_data_mux[] = {
        MMC1_D0_MARK, MMC1_D1_MARK, MMC1_D2_MARK, MMC1_D3_MARK,
        MMC1_D4_MARK, MMC1_D5_MARK, MMC1_D6_MARK, MMC1_D7_MARK,
 };
@@ -2813,19 +2778,12 @@ static const unsigned int qspi_ctrl_pins[] = {
 static const unsigned int qspi_ctrl_mux[] = {
        SPCLK_MARK, SSL_MARK,
 };
-static const unsigned int qspi_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-};
-static const unsigned int qspi_data2_mux[] = {
-       MOSI_IO0_MARK, MISO_IO1_MARK,
-};
-static const unsigned int qspi_data4_pins[] = {
+static const unsigned int qspi_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
        RCAR_GP_PIN(1, 8),
 };
-static const unsigned int qspi_data4_mux[] = {
+static const unsigned int qspi_data_mux[] = {
        MOSI_IO0_MARK, MISO_IO1_MARK, IO2_MARK, IO3_MARK,
 };
 /* - SCIF0 ------------------------------------------------------------------ */
@@ -3322,18 +3280,11 @@ static const unsigned int scif_clk_b_mux[] = {
        SCIF_CLK_B_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK, SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -3358,18 +3309,11 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 10),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11), RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK, SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -3394,18 +3338,11 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 18),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 18), RCAR_GP_PIN(3, 19), RCAR_GP_PIN(3, 20), RCAR_GP_PIN(3, 21),
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK, SD2_DAT2_MARK, SD2_DAT3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -3430,18 +3367,11 @@ static const unsigned int sdhi2_wp_mux[] = {
        SD2_WP_MARK,
 };
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 26),
-};
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-static const unsigned int sdhi3_data4_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 26), RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28), RCAR_GP_PIN(3, 29),
 };
-static const unsigned int sdhi3_data4_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK, SD3_DAT2_MARK, SD3_DAT3_MARK,
 };
 static const unsigned int sdhi3_ctrl_pins[] = {
@@ -3679,18 +3609,11 @@ static const unsigned int tpu0_to3_mux[] = {
 };
 /* - USB0 ------------------------------------------------------------------- */
 static const unsigned int usb0_pins[] = {
-       /* PWEN, OVC/VBUS */
-       RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
+       /* OVC/VBUS, PWEN */
+       RCAR_GP_PIN(5, 19), RCAR_GP_PIN(5, 18),
 };
 static const unsigned int usb0_mux[] = {
-       USB0_PWEN_MARK, USB0_OVC_VBUS_MARK,
-};
-static const unsigned int usb0_ovc_vbus_pins[] = {
-       /* OVC/VBUS */
-       RCAR_GP_PIN(5, 19),
-};
-static const unsigned int usb0_ovc_vbus_mux[] = {
-       USB0_OVC_VBUS_MARK,
+       USB0_OVC_VBUS_MARK, USB0_PWEN_MARK,
 };
 /* - USB1 ------------------------------------------------------------------- */
 static const unsigned int usb1_pins[] = {
@@ -3700,13 +3623,6 @@ static const unsigned int usb1_pins[] = {
 static const unsigned int usb1_mux[] = {
        USB1_PWEN_MARK, USB1_OVC_MARK,
 };
-static const unsigned int usb1_pwen_pins[] = {
-       /* PWEN */
-       RCAR_GP_PIN(5, 20),
-};
-static const unsigned int usb1_pwen_mux[] = {
-       USB1_PWEN_MARK,
-};
 /* - USB2 ------------------------------------------------------------------- */
 static const unsigned int usb2_pins[] = {
        /* PWEN, OVC */
@@ -3716,43 +3632,39 @@ static const unsigned int usb2_mux[] = {
        USB2_PWEN_MARK, USB2_OVC_MARK,
 };
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
-               RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4),
-               RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6),
-               RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
-               /* G */
-               RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-               RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               /* R */
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-               RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25),
-               RCAR_GP_PIN(0, 26), RCAR_GP_PIN(1, 11),
-       },
+static const unsigned int vin0_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
+       RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4),
+       RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6),
+       RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
+       /* G */
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       /* R */
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
+       RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25),
+       RCAR_GP_PIN(0, 26), RCAR_GP_PIN(1, 11),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               /* B */
-               VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
-               VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
-               VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
-               VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
-               /* G */
-               VI0_G0_MARK, VI0_G1_MARK,
-               VI0_G2_MARK, VI0_G3_MARK,
-               VI0_G4_MARK, VI0_G5_MARK,
-               VI0_G6_MARK, VI0_G7_MARK,
-               /* R */
-               VI0_R0_MARK, VI0_R1_MARK,
-               VI0_R2_MARK, VI0_R3_MARK,
-               VI0_R4_MARK, VI0_R5_MARK,
-               VI0_R6_MARK, VI0_R7_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       /* B */
+       VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
+       VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
+       VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
+       VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
+       /* G */
+       VI0_G0_MARK, VI0_G1_MARK,
+       VI0_G2_MARK, VI0_G3_MARK,
+       VI0_G4_MARK, VI0_G5_MARK,
+       VI0_G6_MARK, VI0_G7_MARK,
+       /* R */
+       VI0_R0_MARK, VI0_R1_MARK,
+       VI0_R2_MARK, VI0_R3_MARK,
+       VI0_R4_MARK, VI0_R5_MARK,
+       VI0_R6_MARK, VI0_R7_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        /* B */
@@ -3809,43 +3721,39 @@ static const unsigned int vin0_clk_mux[] = {
        VI0_CLK_MARK,
 };
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data vin1_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
-               RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
-               RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
-               RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17),
-               /* G */
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
-               RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12),
-               RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7),
-               /* R */
-               RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
-               RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4),
-               RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-               RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8),
-       },
+static const unsigned int vin1_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
+       RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
+       RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
+       RCAR_GP_PIN(2, 16), RCAR_GP_PIN(2, 17),
+       /* G */
+       RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
+       RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12),
+       RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7),
+       /* R */
+       RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
+       RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4),
+       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
+       RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8),
 };
-static const union vin_data vin1_data_mux = {
-       .data24 = {
-               /* B */
-               VI1_DATA0_VI1_B0_MARK, VI1_DATA1_VI1_B1_MARK,
-               VI1_DATA2_VI1_B2_MARK, VI1_DATA3_VI1_B3_MARK,
-               VI1_DATA4_VI1_B4_MARK, VI1_DATA5_VI1_B5_MARK,
-               VI1_DATA6_VI1_B6_MARK, VI1_DATA7_VI1_B7_MARK,
-               /* G */
-               VI1_G0_MARK, VI1_G1_MARK,
-               VI1_G2_MARK, VI1_G3_MARK,
-               VI1_G4_MARK, VI1_G5_MARK,
-               VI1_G6_MARK, VI1_G7_MARK,
-               /* R */
-               VI1_R0_MARK, VI1_R1_MARK,
-               VI1_R2_MARK, VI1_R3_MARK,
-               VI1_R4_MARK, VI1_R5_MARK,
-               VI1_R6_MARK, VI1_R7_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       /* B */
+       VI1_DATA0_VI1_B0_MARK, VI1_DATA1_VI1_B1_MARK,
+       VI1_DATA2_VI1_B2_MARK, VI1_DATA3_VI1_B3_MARK,
+       VI1_DATA4_VI1_B4_MARK, VI1_DATA5_VI1_B5_MARK,
+       VI1_DATA6_VI1_B6_MARK, VI1_DATA7_VI1_B7_MARK,
+       /* G */
+       VI1_G0_MARK, VI1_G1_MARK,
+       VI1_G2_MARK, VI1_G3_MARK,
+       VI1_G4_MARK, VI1_G5_MARK,
+       VI1_G6_MARK, VI1_G7_MARK,
+       /* R */
+       VI1_R0_MARK, VI1_R1_MARK,
+       VI1_R2_MARK, VI1_R3_MARK,
+       VI1_R4_MARK, VI1_R5_MARK,
+       VI1_R6_MARK, VI1_R7_MARK,
 };
 static const unsigned int vin1_data18_pins[] = {
        /* B */
@@ -3875,43 +3783,39 @@ static const unsigned int vin1_data18_mux[] = {
        VI1_R4_MARK, VI1_R5_MARK,
        VI1_R6_MARK, VI1_R7_MARK,
 };
-static const union vin_data vin1_data_b_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
-               RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
-               RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
-               RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
-               /* G */
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
-               RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12),
-               RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7),
-               /* R */
-               RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
-               RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4),
-               RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-               RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8),
-       },
+static const unsigned int vin1_data_b_pins[] = {
+       /* B */
+       RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
+       RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
+       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+       /* G */
+       RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
+       RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 12),
+       RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 7),
+       /* R */
+       RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
+       RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 4),
+       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
+       RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 8),
 };
-static const union vin_data vin1_data_b_mux = {
-       .data24 = {
-               /* B */
-               VI1_DATA0_VI1_B0_B_MARK, VI1_DATA1_VI1_B1_B_MARK,
-               VI1_DATA2_VI1_B2_B_MARK, VI1_DATA3_VI1_B3_B_MARK,
-               VI1_DATA4_VI1_B4_B_MARK, VI1_DATA5_VI1_B5_B_MARK,
-               VI1_DATA6_VI1_B6_B_MARK, VI1_DATA7_VI1_B7_B_MARK,
-               /* G */
-               VI1_G0_B_MARK, VI1_G1_B_MARK,
-               VI1_G2_B_MARK, VI1_G3_B_MARK,
-               VI1_G4_B_MARK, VI1_G5_B_MARK,
-               VI1_G6_B_MARK, VI1_G7_B_MARK,
-               /* R */
-               VI1_R0_B_MARK, VI1_R1_B_MARK,
-               VI1_R2_B_MARK, VI1_R3_B_MARK,
-               VI1_R4_B_MARK, VI1_R5_B_MARK,
-               VI1_R6_B_MARK, VI1_R7_B_MARK,
-       },
+static const unsigned int vin1_data_b_mux[] = {
+       /* B */
+       VI1_DATA0_VI1_B0_B_MARK, VI1_DATA1_VI1_B1_B_MARK,
+       VI1_DATA2_VI1_B2_B_MARK, VI1_DATA3_VI1_B3_B_MARK,
+       VI1_DATA4_VI1_B4_B_MARK, VI1_DATA5_VI1_B5_B_MARK,
+       VI1_DATA6_VI1_B6_B_MARK, VI1_DATA7_VI1_B7_B_MARK,
+       /* G */
+       VI1_G0_B_MARK, VI1_G1_B_MARK,
+       VI1_G2_B_MARK, VI1_G3_B_MARK,
+       VI1_G4_B_MARK, VI1_G5_B_MARK,
+       VI1_G6_B_MARK, VI1_G7_B_MARK,
+       /* R */
+       VI1_R0_B_MARK, VI1_R1_B_MARK,
+       VI1_R2_B_MARK, VI1_R3_B_MARK,
+       VI1_R4_B_MARK, VI1_R5_B_MARK,
+       VI1_R6_B_MARK, VI1_R7_B_MARK,
 };
 static const unsigned int vin1_data18_b_pins[] = {
        /* B */
@@ -3994,83 +3898,67 @@ static const unsigned int vin1_clk_b_mux[] = {
        VI1_CLK_B_MARK,
 };
 /* - VIN2 ----------------------------------------------------------------- */
-static const union vin_data vin2_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-               RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-               RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
-               /* G */
-               RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
-               RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 10),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               /* R */
-               RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
-               RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 24),
-       },
-};
-static const union vin_data vin2_data_mux = {
-       .data24 = {
-               /* B */
-               VI2_DATA0_VI2_B0_MARK, VI2_DATA1_VI2_B1_MARK,
-               VI2_DATA2_VI2_B2_MARK, VI2_DATA3_VI2_B3_MARK,
-               VI2_DATA4_VI2_B4_MARK, VI2_DATA5_VI2_B5_MARK,
-               VI2_DATA6_VI2_B6_MARK, VI2_DATA7_VI2_B7_MARK,
-               /* G */
-               VI2_G0_MARK, VI2_G1_MARK,
-               VI2_G2_MARK, VI2_G3_MARK,
-               VI2_G4_MARK, VI2_G5_MARK,
-               VI2_G6_MARK, VI2_G7_MARK,
-               /* R */
-               VI2_R0_MARK, VI2_R1_MARK,
-               VI2_R2_MARK, VI2_R3_MARK,
-               VI2_R4_MARK, VI2_R5_MARK,
-               VI2_R6_MARK, VI2_R7_MARK,
-       },
-};
-static const unsigned int vin2_data18_pins[] = {
+static const unsigned int vin2_data_pins[] = {
        /* B */
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
        RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
        RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
        RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
        /* G */
+       RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
        RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 10),
        RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
        RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
        /* R */
+       RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
        RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
        RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
        RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 24),
 };
-static const unsigned int vin2_data18_mux[] = {
+static const unsigned int vin2_data_mux[] = {
        /* B */
+       VI2_DATA0_VI2_B0_MARK, VI2_DATA1_VI2_B1_MARK,
        VI2_DATA2_VI2_B2_MARK, VI2_DATA3_VI2_B3_MARK,
        VI2_DATA4_VI2_B4_MARK, VI2_DATA5_VI2_B5_MARK,
        VI2_DATA6_VI2_B6_MARK, VI2_DATA7_VI2_B7_MARK,
        /* G */
+       VI2_G0_MARK, VI2_G1_MARK,
        VI2_G2_MARK, VI2_G3_MARK,
        VI2_G4_MARK, VI2_G5_MARK,
        VI2_G6_MARK, VI2_G7_MARK,
        /* R */
+       VI2_R0_MARK, VI2_R1_MARK,
        VI2_R2_MARK, VI2_R3_MARK,
        VI2_R4_MARK, VI2_R5_MARK,
        VI2_R6_MARK, VI2_R7_MARK,
 };
-static const unsigned int vin2_g8_pins[] = {
-       RCAR_GP_PIN(0, 27), RCAR_GP_PIN(0, 28),
+static const unsigned int vin2_data18_pins[] = {
+       /* B */
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
+       /* G */
        RCAR_GP_PIN(0, 29), RCAR_GP_PIN(1, 10),
        RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
        RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       /* R */
+       RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 20),
+       RCAR_GP_PIN(1, 22), RCAR_GP_PIN(1, 24),
 };
-static const unsigned int vin2_g8_mux[] = {
-       VI2_G0_MARK, VI2_G1_MARK,
+static const unsigned int vin2_data18_mux[] = {
+       /* B */
+       VI2_DATA2_VI2_B2_MARK, VI2_DATA3_VI2_B3_MARK,
+       VI2_DATA4_VI2_B4_MARK, VI2_DATA5_VI2_B5_MARK,
+       VI2_DATA6_VI2_B6_MARK, VI2_DATA7_VI2_B7_MARK,
+       /* G */
        VI2_G2_MARK, VI2_G3_MARK,
        VI2_G4_MARK, VI2_G5_MARK,
        VI2_G6_MARK, VI2_G7_MARK,
+       /* R */
+       VI2_R2_MARK, VI2_R3_MARK,
+       VI2_R4_MARK, VI2_R5_MARK,
+       VI2_R6_MARK, VI2_R7_MARK,
 };
 static const unsigned int vin2_sync_pins[] = {
        RCAR_GP_PIN(1, 16), /* HSYNC */
@@ -4223,13 +4111,13 @@ static const struct {
                SH_PFC_PIN_GROUP(intc_irq1),
                SH_PFC_PIN_GROUP(intc_irq2),
                SH_PFC_PIN_GROUP(intc_irq3),
-               SH_PFC_PIN_GROUP(mmc0_data1),
-               SH_PFC_PIN_GROUP(mmc0_data4),
-               SH_PFC_PIN_GROUP(mmc0_data8),
+               BUS_DATA_PIN_GROUP(mmc0_data, 1),
+               BUS_DATA_PIN_GROUP(mmc0_data, 4),
+               BUS_DATA_PIN_GROUP(mmc0_data, 8),
                SH_PFC_PIN_GROUP(mmc0_ctrl),
-               SH_PFC_PIN_GROUP(mmc1_data1),
-               SH_PFC_PIN_GROUP(mmc1_data4),
-               SH_PFC_PIN_GROUP(mmc1_data8),
+               BUS_DATA_PIN_GROUP(mmc1_data, 1),
+               BUS_DATA_PIN_GROUP(mmc1_data, 4),
+               BUS_DATA_PIN_GROUP(mmc1_data, 8),
                SH_PFC_PIN_GROUP(mmc1_ctrl),
                SH_PFC_PIN_GROUP(msiof0_clk),
                SH_PFC_PIN_GROUP(msiof0_sync),
@@ -4279,8 +4167,8 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm5),
                SH_PFC_PIN_GROUP(pwm6),
                SH_PFC_PIN_GROUP(qspi_ctrl),
-               SH_PFC_PIN_GROUP(qspi_data2),
-               SH_PFC_PIN_GROUP(qspi_data4),
+               BUS_DATA_PIN_GROUP(qspi_data, 2),
+               BUS_DATA_PIN_GROUP(qspi_data, 4),
                SH_PFC_PIN_GROUP(scif0_data),
                SH_PFC_PIN_GROUP(scif0_clk),
                SH_PFC_PIN_GROUP(scif0_ctrl),
@@ -4350,23 +4238,23 @@ static const struct {
                SH_PFC_PIN_GROUP(scifb2_data_c),
                SH_PFC_PIN_GROUP(scif_clk),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi2_data1),
-               SH_PFC_PIN_GROUP(sdhi2_data4),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 4),
                SH_PFC_PIN_GROUP(sdhi2_ctrl),
                SH_PFC_PIN_GROUP(sdhi2_cd),
                SH_PFC_PIN_GROUP(sdhi2_wp),
-               SH_PFC_PIN_GROUP(sdhi3_data1),
-               SH_PFC_PIN_GROUP(sdhi3_data4),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 4),
                SH_PFC_PIN_GROUP(sdhi3_ctrl),
                SH_PFC_PIN_GROUP(sdhi3_cd),
                SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -4401,38 +4289,38 @@ static const struct {
                SH_PFC_PIN_GROUP(tpu0_to2),
                SH_PFC_PIN_GROUP(tpu0_to3),
                SH_PFC_PIN_GROUP(usb0),
-               SH_PFC_PIN_GROUP(usb0_ovc_vbus),
+               SH_PFC_PIN_GROUP_SUBSET(usb0_ovc_vbus, usb0, 0, 1),
                SH_PFC_PIN_GROUP(usb1),
-               SH_PFC_PIN_GROUP(usb1_pwen),
+               SH_PFC_PIN_GROUP_SUBSET(usb1_pwen, usb1, 0, 1),
                SH_PFC_PIN_GROUP(usb2),
-               VIN_DATA_PIN_GROUP(vin0_data, 24),
-               VIN_DATA_PIN_GROUP(vin0_data, 20),
+               BUS_DATA_PIN_GROUP(vin0_data, 24),
+               BUS_DATA_PIN_GROUP(vin0_data, 20),
                SH_PFC_PIN_GROUP(vin0_data18),
-               VIN_DATA_PIN_GROUP(vin0_data, 16),
-               VIN_DATA_PIN_GROUP(vin0_data, 12),
-               VIN_DATA_PIN_GROUP(vin0_data, 10),
-               VIN_DATA_PIN_GROUP(vin0_data, 8),
-               VIN_DATA_PIN_GROUP(vin0_data, 4),
+               BUS_DATA_PIN_GROUP(vin0_data, 16),
+               BUS_DATA_PIN_GROUP(vin0_data, 12),
+               BUS_DATA_PIN_GROUP(vin0_data, 10),
+               BUS_DATA_PIN_GROUP(vin0_data, 8),
+               BUS_DATA_PIN_GROUP(vin0_data, 4),
                SH_PFC_PIN_GROUP(vin0_sync),
                SH_PFC_PIN_GROUP(vin0_field),
                SH_PFC_PIN_GROUP(vin0_clkenb),
                SH_PFC_PIN_GROUP(vin0_clk),
-               VIN_DATA_PIN_GROUP(vin1_data, 24),
-               VIN_DATA_PIN_GROUP(vin1_data, 20),
+               BUS_DATA_PIN_GROUP(vin1_data, 24),
+               BUS_DATA_PIN_GROUP(vin1_data, 20),
                SH_PFC_PIN_GROUP(vin1_data18),
-               VIN_DATA_PIN_GROUP(vin1_data, 16),
-               VIN_DATA_PIN_GROUP(vin1_data, 12),
-               VIN_DATA_PIN_GROUP(vin1_data, 10),
-               VIN_DATA_PIN_GROUP(vin1_data, 8),
-               VIN_DATA_PIN_GROUP(vin1_data, 4),
-               VIN_DATA_PIN_GROUP(vin1_data, 24, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 16),
+               BUS_DATA_PIN_GROUP(vin1_data, 12),
+               BUS_DATA_PIN_GROUP(vin1_data, 10),
+               BUS_DATA_PIN_GROUP(vin1_data, 8),
+               BUS_DATA_PIN_GROUP(vin1_data, 4),
+               BUS_DATA_PIN_GROUP(vin1_data, 24, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 20, _b),
                SH_PFC_PIN_GROUP(vin1_data18_b),
-               VIN_DATA_PIN_GROUP(vin1_data, 16, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 8, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 4, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 4, _b),
                SH_PFC_PIN_GROUP(vin1_sync),
                SH_PFC_PIN_GROUP(vin1_sync_b),
                SH_PFC_PIN_GROUP(vin1_field),
@@ -4441,12 +4329,12 @@ static const struct {
                SH_PFC_PIN_GROUP(vin1_clkenb_b),
                SH_PFC_PIN_GROUP(vin1_clk),
                SH_PFC_PIN_GROUP(vin1_clk_b),
-               VIN_DATA_PIN_GROUP(vin2_data, 24),
+               BUS_DATA_PIN_GROUP(vin2_data, 24),
                SH_PFC_PIN_GROUP(vin2_data18),
-               VIN_DATA_PIN_GROUP(vin2_data, 16),
-               VIN_DATA_PIN_GROUP(vin2_data, 8),
-               VIN_DATA_PIN_GROUP(vin2_data, 4),
-               SH_PFC_PIN_GROUP(vin2_g8),
+               BUS_DATA_PIN_GROUP(vin2_data, 16),
+               BUS_DATA_PIN_GROUP(vin2_data, 8),
+               BUS_DATA_PIN_GROUP(vin2_data, 4),
+               SH_PFC_PIN_GROUP_SUBSET(vin2_g8, vin2_data, 8, 8),
                SH_PFC_PIN_GROUP(vin2_sync),
                SH_PFC_PIN_GROUP(vin2_field),
                SH_PFC_PIN_GROUP(vin2_clkenb),
@@ -4964,10 +4852,10 @@ static const struct {
        .common = {
                SH_PFC_FUNCTION(audio_clk),
                SH_PFC_FUNCTION(avb),
-               SH_PFC_FUNCTION(du),
                SH_PFC_FUNCTION(can0),
                SH_PFC_FUNCTION(can1),
                SH_PFC_FUNCTION(can_clk),
+               SH_PFC_FUNCTION(du),
                SH_PFC_FUNCTION(du0),
                SH_PFC_FUNCTION(du1),
                SH_PFC_FUNCTION(du2),
@@ -5415,9 +5303,8 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
                FN_DREQ0_N, FN_VI1_HSYNC_N, FN_VI1_HSYNC_N_B, FN_VI2_R7,
                FN_SSI_SCK78_C, FN_SSI_WS78_B, 0, 0,
                /* IP5_26_24 [3] */
-               FN_EX_WAIT0, FN_IRQ3, FN_INTC_IRQ3_N,
-               FN_VI3_CLK, FN_SCIFA0_RTS_N_B, FN_HRX0_B,
-               FN_MSIOF0_SCK_B, 0,
+               FN_EX_WAIT0, FN_IRQ3, 0, FN_VI3_CLK, FN_SCIFA0_RTS_N_B,
+               FN_HRX0_B, FN_MSIOF0_SCK_B, 0,
                /* IP5_23_21 [3] */
                FN_WE1_N, FN_IERX, FN_CAN1_RX, FN_VI1_G4,
                FN_VI1_G4_B, FN_VI2_R6, FN_SCIFA0_CTS_N_B, FN_IERX_C,
@@ -5426,7 +5313,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
                FN_VI2_VSYNC_N, FN_SCIFA0_TXD_B, FN_VI2_VSYNC_N_B, 0, 0,
                /* IP5_17_15 [3] */
                FN_RD_WR_N, FN_VI1_G3, FN_VI1_G3_B, FN_VI2_R5, FN_SCIFA0_RXD_B,
-               FN_INTC_IRQ4_N, 0, 0,
+               0, 0, 0,
                /* IP5_14_13 [2] */
                FN_RD_N, FN_CAN0_TX, FN_SCIFA0_SCK_B, 0,
                /* IP5_12_10 [3] */
@@ -5467,19 +5354,18 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
                FN_TS_SDEN0_D, FN_GLO_Q0_C, FN_IIC2_SCL_E,
                FN_I2C2_SCL_E, 0,
                /* IP6_13_11 [3] */
-               FN_DACK2, FN_IRQ2, FN_INTC_IRQ2_N,
-               FN_SSI_SDATA6_B, FN_HRTS0_N_B, FN_MSIOF0_RXD_B, 0, 0,
+               FN_DACK2, FN_IRQ2, 0, FN_SSI_SDATA6_B, FN_HRTS0_N_B,
+               FN_MSIOF0_RXD_B, 0, 0,
                /* IP6_10_9 [2] */
                FN_DREQ2_N, FN_HSCK1_B, FN_HCTS0_N_B, FN_MSIOF0_TXD_B,
                /* IP6_8_6 [3] */
-               FN_DACK1, FN_IRQ1, FN_INTC_IRQ1_N, FN_SSI_WS6_B,
-               FN_SSI_SDATA8_C, 0, 0, 0,
+               FN_DACK1, FN_IRQ1, 0, FN_SSI_WS6_B, FN_SSI_SDATA8_C, 0, 0, 0,
                /* IP6_5_3 [3] */
                FN_DREQ1_N, FN_VI1_CLKENB, FN_VI1_CLKENB_B,
                FN_SSI_SDATA7_C, FN_SSI_SCK78_B, 0, 0, 0,
                /* IP6_2_0 [3] */
-               FN_DACK0, FN_IRQ0, FN_INTC_IRQ0_N, FN_SSI_SCK6_B,
-               FN_VI1_VSYNC_N, FN_VI1_VSYNC_N_B, FN_SSI_WS78_C, 0, ))
+               FN_DACK0, FN_IRQ0, 0, FN_SSI_SCK6_B, FN_VI1_VSYNC_N,
+               FN_VI1_VSYNC_N_B, FN_SSI_WS78_C, 0, ))
        },
        { PINMUX_CFG_REG_VAR("IPSR7", 0xE606003C, 32,
                             GROUP(1, 2, 2, 2, 3, 3, 3, 3, 3, 2, 2, 3, 3),
@@ -5987,7 +5873,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        { },
 };
 
-static int r8a7790_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl)
+static int r8a7790_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        if (pin < RCAR_GP_PIN(3, 0) || pin > RCAR_GP_PIN(3, 31))
                return -EINVAL;
@@ -6289,7 +6175,7 @@ static int r8a7790_pinmux_soc_init(struct sh_pfc *pfc)
        return 0;
 }
 
-static const struct sh_pfc_soc_operations r8a7790_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a7790_pfc_ops = {
        .init = r8a7790_pinmux_soc_init,
        .pin_to_pocctrl = r8a7790_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
@@ -6299,7 +6185,7 @@ static const struct sh_pfc_soc_operations r8a7790_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7742
 const struct sh_pfc_soc_info r8a7742_pinmux_info = {
        .name = "r8a77420_pfc",
-       .ops = &r8a7790_pinmux_ops,
+       .ops = &r8a7790_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -6322,7 +6208,7 @@ const struct sh_pfc_soc_info r8a7742_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7790
 const struct sh_pfc_soc_info r8a7790_pinmux_info = {
        .name = "r8a77900_pfc",
-       .ops = &r8a7790_pinmux_ops,
+       .ops = &r8a7790_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index fe4ccab..076a8b7 100644 (file)
@@ -234,11 +234,11 @@ enum {
        FN_AUDIO_CLKC, FN_SCIFB0_SCK_C, FN_MSIOF1_SYNC_B, FN_RX2,
        FN_SCIFA2_RXD, FN_FMIN_E,
        FN_AUDIO_CLKOUT, FN_MSIOF1_SS1_B, FN_TX2, FN_SCIFA2_TXD,
-       FN_IRQ0, FN_SCIFB1_RXD_D, FN_INTC_IRQ0_N,
-       FN_IRQ1, FN_SCIFB1_SCK_C, FN_INTC_IRQ1_N,
-       FN_IRQ2, FN_SCIFB1_TXD_D, FN_INTC_IRQ2_N,
-       FN_IRQ3, FN_I2C4_SCL_C, FN_MSIOF2_TXD_E, FN_INTC_IRQ3_N,
-       FN_IRQ4, FN_HRX1_C, FN_I2C4_SDA_C, FN_MSIOF2_RXD_E, FN_INTC_IRQ4_N,
+       FN_IRQ0, FN_SCIFB1_RXD_D,
+       FN_IRQ1, FN_SCIFB1_SCK_C,
+       FN_IRQ2, FN_SCIFB1_TXD_D,
+       FN_IRQ3, FN_I2C4_SCL_C, FN_MSIOF2_TXD_E,
+       FN_IRQ4, FN_HRX1_C, FN_I2C4_SDA_C, FN_MSIOF2_RXD_E,
        FN_IRQ5, FN_HTX1_C, FN_I2C1_SCL_E, FN_MSIOF2_SCK_E,
        FN_IRQ6, FN_HSCK1_C, FN_MSIOF1_SS2_B, FN_I2C1_SDA_E, FN_MSIOF2_SYNC_E,
        FN_IRQ7, FN_HCTS1_N_C, FN_MSIOF1_TXD_B, FN_GPS_CLK_C, FN_GPS_CLK_D,
@@ -606,12 +606,12 @@ enum {
        AUDIO_CLKC_MARK, SCIFB0_SCK_C_MARK, MSIOF1_SYNC_B_MARK, RX2_MARK,
        SCIFA2_RXD_MARK, FMIN_E_MARK,
        AUDIO_CLKOUT_MARK, MSIOF1_SS1_B_MARK, TX2_MARK, SCIFA2_TXD_MARK,
-       IRQ0_MARK, SCIFB1_RXD_D_MARK, INTC_IRQ0_N_MARK,
-       IRQ1_MARK, SCIFB1_SCK_C_MARK, INTC_IRQ1_N_MARK,
-       IRQ2_MARK, SCIFB1_TXD_D_MARK, INTC_IRQ2_N_MARK,
-       IRQ3_MARK, I2C4_SCL_C_MARK, MSIOF2_TXD_E_MARK, INTC_IRQ3_N_MARK,
+       IRQ0_MARK, SCIFB1_RXD_D_MARK,
+       IRQ1_MARK, SCIFB1_SCK_C_MARK,
+       IRQ2_MARK, SCIFB1_TXD_D_MARK,
+       IRQ3_MARK, I2C4_SCL_C_MARK, MSIOF2_TXD_E_MARK,
        IRQ4_MARK, HRX1_C_MARK, I2C4_SDA_C_MARK,
-       MSIOF2_RXD_E_MARK, INTC_IRQ4_N_MARK,
+       MSIOF2_RXD_E_MARK,
        IRQ5_MARK, HTX1_C_MARK, I2C1_SCL_E_MARK, MSIOF2_SCK_E_MARK,
        IRQ6_MARK, HSCK1_C_MARK, MSIOF1_SS2_B_MARK,
        I2C1_SDA_E_MARK, MSIOF2_SYNC_E_MARK,
@@ -1140,22 +1140,17 @@ static const u16 pinmux_data[] = {
        PINMUX_IPSR_MSEL(IP6_7_6, SCIFA2_TXD, SEL_SCIFA2_0),
        PINMUX_IPSR_GPSR(IP6_9_8, IRQ0),
        PINMUX_IPSR_MSEL(IP6_9_8, SCIFB1_RXD_D, SEL_SCIFB1_3),
-       PINMUX_IPSR_GPSR(IP6_9_8, INTC_IRQ0_N),
        PINMUX_IPSR_GPSR(IP6_11_10, IRQ1),
        PINMUX_IPSR_MSEL(IP6_11_10, SCIFB1_SCK_C, SEL_SCIFB1_2),
-       PINMUX_IPSR_GPSR(IP6_11_10, INTC_IRQ1_N),
        PINMUX_IPSR_GPSR(IP6_13_12, IRQ2),
        PINMUX_IPSR_MSEL(IP6_13_12, SCIFB1_TXD_D, SEL_SCIFB1_3),
-       PINMUX_IPSR_GPSR(IP6_13_12, INTC_IRQ2_N),
        PINMUX_IPSR_GPSR(IP6_15_14, IRQ3),
        PINMUX_IPSR_MSEL(IP6_15_14, I2C4_SCL_C, SEL_I2C4_2),
        PINMUX_IPSR_MSEL(IP6_15_14, MSIOF2_TXD_E, SEL_SOF2_4),
-       PINMUX_IPSR_GPSR(IP6_15_14, INTC_IRQ4_N),
        PINMUX_IPSR_GPSR(IP6_18_16, IRQ4),
        PINMUX_IPSR_MSEL(IP6_18_16, HRX1_C, SEL_HSCIF1_2),
        PINMUX_IPSR_MSEL(IP6_18_16, I2C4_SDA_C, SEL_I2C4_2),
        PINMUX_IPSR_MSEL(IP6_18_16, MSIOF2_RXD_E, SEL_SOF2_4),
-       PINMUX_IPSR_GPSR(IP6_18_16, INTC_IRQ4_N),
        PINMUX_IPSR_GPSR(IP6_20_19, IRQ5),
        PINMUX_IPSR_MSEL(IP6_20_19, HTX1_C, SEL_HSCIF1_2),
        PINMUX_IPSR_MSEL(IP6_20_19, I2C1_SCL_E, SEL_I2C1_4),
@@ -2303,13 +2298,6 @@ static const unsigned int hscif1_data_d_pins[] = {
 static const unsigned int hscif1_data_d_mux[] = {
        HRX1_D_MARK, HTX1_D_MARK,
 };
-static const unsigned int hscif1_data_e_pins[] = {
-       /* RX, TX */
-       RCAR_GP_PIN(7, 14), RCAR_GP_PIN(7, 15),
-};
-static const unsigned int hscif1_data_e_mux[] = {
-       HRX1_C_MARK, HTX1_C_MARK,
-};
 static const unsigned int hscif1_clk_e_pins[] = {
        /* SCK */
        RCAR_GP_PIN(2, 6),
@@ -2604,40 +2592,25 @@ static const unsigned int mlb_3pin_mux[] = {
 #endif /* CONFIG_PINCTRL_PFC_R8A7791 || CONFIG_PINCTRL_PFC_R8A7793 */
 
 /* - MMCIF ------------------------------------------------------------------ */
-static const unsigned int mmc_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(6, 18),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
-       RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
        RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
        RCAR_GP_PIN(6, 22), RCAR_GP_PIN(6, 23),
        RCAR_GP_PIN(6, 28), RCAR_GP_PIN(6, 29),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK, MMC_D6_MARK, MMC_D7_MARK,
 };
-static const unsigned int mmc_data8_b_pins[] = {
+static const unsigned int mmc_data_b_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
        RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
        RCAR_GP_PIN(6, 22), RCAR_GP_PIN(6, 23),
        RCAR_GP_PIN(6, 6), RCAR_GP_PIN(6, 7),
 };
-static const unsigned int mmc_data8_b_mux[] = {
+static const unsigned int mmc_data_b_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK, MMC_D6_B_MARK, MMC_D7_B_MARK,
 };
@@ -3225,19 +3198,12 @@ static const unsigned int qspi_ctrl_pins[] = {
 static const unsigned int qspi_ctrl_mux[] = {
        SPCLK_MARK, SSL_MARK,
 };
-static const unsigned int qspi_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-};
-static const unsigned int qspi_data2_mux[] = {
-       MOSI_IO0_MARK, MISO_IO1_MARK,
-};
-static const unsigned int qspi_data4_pins[] = {
+static const unsigned int qspi_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
        RCAR_GP_PIN(1, 8),
 };
-static const unsigned int qspi_data4_mux[] = {
+static const unsigned int qspi_data_mux[] = {
        MOSI_IO0_MARK, MISO_IO1_MARK, IO2_MARK, IO3_MARK,
 };
 
@@ -3248,19 +3214,12 @@ static const unsigned int qspi_ctrl_b_pins[] = {
 static const unsigned int qspi_ctrl_b_mux[] = {
        SPCLK_B_MARK, SSL_B_MARK,
 };
-static const unsigned int qspi_data2_b_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(6, 1), RCAR_GP_PIN(6, 2),
-};
-static const unsigned int qspi_data2_b_mux[] = {
-       MOSI_IO0_B_MARK, MISO_IO1_B_MARK,
-};
-static const unsigned int qspi_data4_b_pins[] = {
+static const unsigned int qspi_data_b_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(6, 1), RCAR_GP_PIN(6, 2), RCAR_GP_PIN(6, 3),
        RCAR_GP_PIN(6, 4),
 };
-static const unsigned int qspi_data4_b_mux[] = {
+static const unsigned int qspi_data_b_mux[] = {
        MOSI_IO0_B_MARK, MISO_IO1_B_MARK, IO2_B_MARK, IO3_B_MARK,
 };
 /* - SCIF0 ------------------------------------------------------------------ */
@@ -3821,19 +3780,12 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DATA0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 2), RCAR_GP_PIN(6, 3),
        RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DATA0_MARK, SD0_DATA1_MARK, SD0_DATA2_MARK, SD0_DATA3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -3858,19 +3810,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 10),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DATA0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 10), RCAR_GP_PIN(6, 11),
        RCAR_GP_PIN(6, 12), RCAR_GP_PIN(6, 13),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DATA0_MARK, SD1_DATA1_MARK, SD1_DATA2_MARK, SD1_DATA3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -3895,19 +3840,12 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 18),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DATA0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
        RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DATA0_MARK, SD2_DATA1_MARK, SD2_DATA2_MARK, SD2_DATA3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -4230,43 +4168,39 @@ static const unsigned int usb1_mux[] = {
        USB1_OVC_MARK,
 };
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(4, 5), RCAR_GP_PIN(4, 6),
-               RCAR_GP_PIN(4, 7), RCAR_GP_PIN(4, 8),
-               RCAR_GP_PIN(4, 9), RCAR_GP_PIN(4, 10),
-               RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
-               /* G */
-               RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 14),
-               RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
-               RCAR_GP_PIN(4, 17), RCAR_GP_PIN(4, 18),
-               RCAR_GP_PIN(4, 19), RCAR_GP_PIN(4, 20),
-               /* R */
-               RCAR_GP_PIN(4, 21), RCAR_GP_PIN(4, 22),
-               RCAR_GP_PIN(4, 23), RCAR_GP_PIN(4, 24),
-               RCAR_GP_PIN(4, 25), RCAR_GP_PIN(4, 26),
-               RCAR_GP_PIN(4, 27), RCAR_GP_PIN(4, 28),
-       },
+static const unsigned int vin0_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(4, 5), RCAR_GP_PIN(4, 6),
+       RCAR_GP_PIN(4, 7), RCAR_GP_PIN(4, 8),
+       RCAR_GP_PIN(4, 9), RCAR_GP_PIN(4, 10),
+       RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
+       /* G */
+       RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 14),
+       RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
+       RCAR_GP_PIN(4, 17), RCAR_GP_PIN(4, 18),
+       RCAR_GP_PIN(4, 19), RCAR_GP_PIN(4, 20),
+       /* R */
+       RCAR_GP_PIN(4, 21), RCAR_GP_PIN(4, 22),
+       RCAR_GP_PIN(4, 23), RCAR_GP_PIN(4, 24),
+       RCAR_GP_PIN(4, 25), RCAR_GP_PIN(4, 26),
+       RCAR_GP_PIN(4, 27), RCAR_GP_PIN(4, 28),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               /* B */
-               VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
-               VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
-               VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
-               VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
-               /* G */
-               VI0_G0_MARK, VI0_G1_MARK,
-               VI0_G2_MARK, VI0_G3_MARK,
-               VI0_G4_MARK, VI0_G5_MARK,
-               VI0_G6_MARK, VI0_G7_MARK,
-               /* R */
-               VI0_R0_MARK, VI0_R1_MARK,
-               VI0_R2_MARK, VI0_R3_MARK,
-               VI0_R4_MARK, VI0_R5_MARK,
-               VI0_R6_MARK, VI0_R7_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       /* B */
+       VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
+       VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
+       VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
+       VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
+       /* G */
+       VI0_G0_MARK, VI0_G1_MARK,
+       VI0_G2_MARK, VI0_G3_MARK,
+       VI0_G4_MARK, VI0_G5_MARK,
+       VI0_G6_MARK, VI0_G7_MARK,
+       /* R */
+       VI0_R0_MARK, VI0_R1_MARK,
+       VI0_R2_MARK, VI0_R3_MARK,
+       VI0_R4_MARK, VI0_R5_MARK,
+       VI0_R6_MARK, VI0_R7_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        /* B */
@@ -4361,43 +4295,39 @@ static const unsigned int vin1_clk_pins[] = {
 static const unsigned int vin1_clk_mux[] = {
        VI1_CLK_MARK,
 };
-static const union vin_data vin1_data_b_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
-               RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
-               RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
-               RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
-               /* G */
-               RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
-               RCAR_GP_PIN(6, 26), RCAR_GP_PIN(6, 27),
-               RCAR_GP_PIN(6, 28), RCAR_GP_PIN(6, 29),
-               RCAR_GP_PIN(7, 21), RCAR_GP_PIN(7, 22),
-               /* R */
-               RCAR_GP_PIN(7, 5), RCAR_GP_PIN(7, 6),
-               RCAR_GP_PIN(2, 15), RCAR_GP_PIN(2, 16),
-               RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
-               RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
-       },
+static const unsigned int vin1_data_b_pins[] = {
+       /* B */
+       RCAR_GP_PIN(3, 0), RCAR_GP_PIN(3, 1),
+       RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
+       RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
+       RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
+       /* G */
+       RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
+       RCAR_GP_PIN(6, 26), RCAR_GP_PIN(6, 27),
+       RCAR_GP_PIN(6, 28), RCAR_GP_PIN(6, 29),
+       RCAR_GP_PIN(7, 21), RCAR_GP_PIN(7, 22),
+       /* R */
+       RCAR_GP_PIN(7, 5), RCAR_GP_PIN(7, 6),
+       RCAR_GP_PIN(2, 15), RCAR_GP_PIN(2, 16),
+       RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
+       RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
 };
-static const union vin_data vin1_data_b_mux = {
-       .data24 = {
-               /* B */
-               VI1_DATA0_B_MARK, VI1_DATA1_B_MARK,
-               VI1_DATA2_B_MARK, VI1_DATA3_B_MARK,
-               VI1_DATA4_B_MARK, VI1_DATA5_B_MARK,
-               VI1_DATA6_B_MARK, VI1_DATA7_B_MARK,
-               /* G */
-               VI1_G0_B_MARK, VI1_G1_B_MARK,
-               VI1_G2_B_MARK, VI1_G3_B_MARK,
-               VI1_G4_B_MARK, VI1_G5_B_MARK,
-               VI1_G6_B_MARK, VI1_G7_B_MARK,
-               /* R */
-               VI1_R0_B_MARK, VI1_R1_B_MARK,
-               VI1_R2_B_MARK, VI1_R3_B_MARK,
-               VI1_R4_B_MARK, VI1_R5_B_MARK,
-               VI1_R6_B_MARK, VI1_R7_B_MARK,
-       },
+static const unsigned int vin1_data_b_mux[] = {
+       /* B */
+       VI1_DATA0_B_MARK, VI1_DATA1_B_MARK,
+       VI1_DATA2_B_MARK, VI1_DATA3_B_MARK,
+       VI1_DATA4_B_MARK, VI1_DATA5_B_MARK,
+       VI1_DATA6_B_MARK, VI1_DATA7_B_MARK,
+       /* G */
+       VI1_G0_B_MARK, VI1_G1_B_MARK,
+       VI1_G2_B_MARK, VI1_G3_B_MARK,
+       VI1_G4_B_MARK, VI1_G5_B_MARK,
+       VI1_G6_B_MARK, VI1_G7_B_MARK,
+       /* R */
+       VI1_R0_B_MARK, VI1_R1_B_MARK,
+       VI1_R2_B_MARK, VI1_R3_B_MARK,
+       VI1_R4_B_MARK, VI1_R5_B_MARK,
+       VI1_R6_B_MARK, VI1_R7_B_MARK,
 };
 static const unsigned int vin1_data18_b_pins[] = {
        /* B */
@@ -4556,7 +4486,7 @@ static const struct {
                SH_PFC_PIN_GROUP(hscif1_clk_c),
                SH_PFC_PIN_GROUP(hscif1_ctrl_c),
                SH_PFC_PIN_GROUP(hscif1_data_d),
-               SH_PFC_PIN_GROUP(hscif1_data_e),
+               SH_PFC_PIN_GROUP_ALIAS(hscif1_data_e, hscif1_data_c),
                SH_PFC_PIN_GROUP(hscif1_clk_e),
                SH_PFC_PIN_GROUP(hscif1_ctrl_e),
                SH_PFC_PIN_GROUP(hscif2_data),
@@ -4596,10 +4526,10 @@ static const struct {
                SH_PFC_PIN_GROUP(intc_irq1),
                SH_PFC_PIN_GROUP(intc_irq2),
                SH_PFC_PIN_GROUP(intc_irq3),
-               SH_PFC_PIN_GROUP(mmc_data1),
-               SH_PFC_PIN_GROUP(mmc_data4),
-               SH_PFC_PIN_GROUP(mmc_data8),
-               SH_PFC_PIN_GROUP(mmc_data8_b),
+               BUS_DATA_PIN_GROUP(mmc_data, 1),
+               BUS_DATA_PIN_GROUP(mmc_data, 4),
+               BUS_DATA_PIN_GROUP(mmc_data, 8),
+               BUS_DATA_PIN_GROUP(mmc_data, 8, _b),
                SH_PFC_PIN_GROUP(mmc_ctrl),
                SH_PFC_PIN_GROUP(msiof0_clk),
                SH_PFC_PIN_GROUP(msiof0_sync),
@@ -4683,11 +4613,11 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm5_b),
                SH_PFC_PIN_GROUP(pwm6),
                SH_PFC_PIN_GROUP(qspi_ctrl),
-               SH_PFC_PIN_GROUP(qspi_data2),
-               SH_PFC_PIN_GROUP(qspi_data4),
+               BUS_DATA_PIN_GROUP(qspi_data, 2),
+               BUS_DATA_PIN_GROUP(qspi_data, 4),
                SH_PFC_PIN_GROUP(qspi_ctrl_b),
-               SH_PFC_PIN_GROUP(qspi_data2_b),
-               SH_PFC_PIN_GROUP(qspi_data4_b),
+               BUS_DATA_PIN_GROUP(qspi_data, 2, _b),
+               BUS_DATA_PIN_GROUP(qspi_data, 4, _b),
                SH_PFC_PIN_GROUP(scif0_data),
                SH_PFC_PIN_GROUP(scif0_data_b),
                SH_PFC_PIN_GROUP(scif0_data_c),
@@ -4765,18 +4695,18 @@ static const struct {
                SH_PFC_PIN_GROUP(scifb2_data_d),
                SH_PFC_PIN_GROUP(scif_clk),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi2_data1),
-               SH_PFC_PIN_GROUP(sdhi2_data4),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 4),
                SH_PFC_PIN_GROUP(sdhi2_ctrl),
                SH_PFC_PIN_GROUP(sdhi2_cd),
                SH_PFC_PIN_GROUP(sdhi2_wp),
@@ -4814,13 +4744,13 @@ static const struct {
                SH_PFC_PIN_GROUP(tpu_to3),
                SH_PFC_PIN_GROUP(usb0),
                SH_PFC_PIN_GROUP(usb1),
-               VIN_DATA_PIN_GROUP(vin0_data, 24),
-               VIN_DATA_PIN_GROUP(vin0_data, 20),
+               BUS_DATA_PIN_GROUP(vin0_data, 24),
+               BUS_DATA_PIN_GROUP(vin0_data, 20),
                SH_PFC_PIN_GROUP(vin0_data18),
-               VIN_DATA_PIN_GROUP(vin0_data, 16),
-               VIN_DATA_PIN_GROUP(vin0_data, 12),
-               VIN_DATA_PIN_GROUP(vin0_data, 10),
-               VIN_DATA_PIN_GROUP(vin0_data, 8),
+               BUS_DATA_PIN_GROUP(vin0_data, 16),
+               BUS_DATA_PIN_GROUP(vin0_data, 12),
+               BUS_DATA_PIN_GROUP(vin0_data, 10),
+               BUS_DATA_PIN_GROUP(vin0_data, 8),
                SH_PFC_PIN_GROUP(vin0_sync),
                SH_PFC_PIN_GROUP(vin0_field),
                SH_PFC_PIN_GROUP(vin0_clkenb),
@@ -4830,13 +4760,13 @@ static const struct {
                SH_PFC_PIN_GROUP(vin1_field),
                SH_PFC_PIN_GROUP(vin1_clkenb),
                SH_PFC_PIN_GROUP(vin1_clk),
-               VIN_DATA_PIN_GROUP(vin1_data, 24, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 24, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 20, _b),
                SH_PFC_PIN_GROUP(vin1_data18_b),
-               VIN_DATA_PIN_GROUP(vin1_data, 16, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin1_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin1_data, 8, _b),
                SH_PFC_PIN_GROUP(vin1_sync_b),
                SH_PFC_PIN_GROUP(vin1_field_b),
                SH_PFC_PIN_GROUP(vin1_clkenb_b),
@@ -6033,15 +5963,15 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
                FN_IRQ5, FN_HTX1_C, FN_I2C1_SCL_E, FN_MSIOF2_SCK_E,
                /* IP6_18_16 [3] */
                FN_IRQ4, FN_HRX1_C, FN_I2C4_SDA_C, FN_MSIOF2_RXD_E,
-               FN_INTC_IRQ4_N, 0, 0, 0,
+               0, 0, 0, 0,
                /* IP6_15_14 [2] */
-               FN_IRQ3, FN_I2C4_SCL_C, FN_MSIOF2_TXD_E, FN_INTC_IRQ3_N,
+               FN_IRQ3, FN_I2C4_SCL_C, FN_MSIOF2_TXD_E, 0,
                /* IP6_13_12 [2] */
-               FN_IRQ2, FN_SCIFB1_TXD_D, FN_INTC_IRQ2_N, 0,
+               FN_IRQ2, FN_SCIFB1_TXD_D, 0, 0,
                /* IP6_11_10 [2] */
-               FN_IRQ1, FN_SCIFB1_SCK_C, FN_INTC_IRQ1_N, 0,
+               FN_IRQ1, FN_SCIFB1_SCK_C, 0, 0,
                /* IP6_9_8 [2] */
-               FN_IRQ0, FN_SCIFB1_RXD_D, FN_INTC_IRQ0_N, 0,
+               FN_IRQ0, FN_SCIFB1_RXD_D, 0, 0,
                /* IP6_7_6 [2] */
                FN_AUDIO_CLKOUT, FN_MSIOF1_SS1_B, FN_TX2, FN_SCIFA2_TXD,
                /* IP6_5_3 [3] */
@@ -6672,7 +6602,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        { },
 };
 
-static int r8a7791_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl)
+static int r8a7791_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        if (pin < RCAR_GP_PIN(6, 0) || pin > RCAR_GP_PIN(6, 23))
                return -EINVAL;
@@ -6994,7 +6924,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a7791_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a7791_pfc_ops = {
        .pin_to_pocctrl = r8a7791_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -7003,7 +6933,7 @@ static const struct sh_pfc_soc_operations r8a7791_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7743
 const struct sh_pfc_soc_info r8a7743_pinmux_info = {
        .name = "r8a77430_pfc",
-       .ops = &r8a7791_pinmux_ops,
+       .ops = &r8a7791_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -7026,7 +6956,7 @@ const struct sh_pfc_soc_info r8a7743_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7744
 const struct sh_pfc_soc_info r8a7744_pinmux_info = {
        .name = "r8a77440_pfc",
-       .ops = &r8a7791_pinmux_ops,
+       .ops = &r8a7791_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -7049,7 +6979,7 @@ const struct sh_pfc_soc_info r8a7744_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7791
 const struct sh_pfc_soc_info r8a7791_pinmux_info = {
        .name = "r8a77910_pfc",
-       .ops = &r8a7791_pinmux_ops,
+       .ops = &r8a7791_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -7074,7 +7004,7 @@ const struct sh_pfc_soc_info r8a7791_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7793
 const struct sh_pfc_soc_info r8a7793_pinmux_info = {
        .name = "r8a77930_pfc",
-       .ops = &r8a7791_pinmux_ops,
+       .ops = &r8a7791_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index 3ab56dc..3e101f6 100644 (file)
@@ -1116,19 +1116,12 @@ static const unsigned int qspi_ctrl_pins[] = {
 static const unsigned int qspi_ctrl_mux[] = {
        SPCLK_MARK, SSL_MARK,
 };
-static const unsigned int qspi_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
-};
-static const unsigned int qspi_data2_mux[] = {
-       MOSI_IO0_MARK, MISO_IO1_MARK,
-};
-static const unsigned int qspi_data4_pins[] = {
+static const unsigned int qspi_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 23),
        RCAR_GP_PIN(3, 24),
 };
-static const unsigned int qspi_data4_mux[] = {
+static const unsigned int qspi_data_mux[] = {
        MOSI_IO0_MARK, MISO_IO1_MARK, IO2_MARK, IO3_MARK,
 };
 /* - SCIF0 ------------------------------------------------------------------ */
@@ -1206,19 +1199,12 @@ static const unsigned int scif3_clk_mux[] = {
        SCK3_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* DAT0 */
-       RCAR_GP_PIN(11, 7),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* DAT[0-3] */
        RCAR_GP_PIN(11, 7), RCAR_GP_PIN(11, 8),
        RCAR_GP_PIN(11, 9), RCAR_GP_PIN(11, 10),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK, SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -1243,43 +1229,39 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-               RCAR_GP_PIN(4, 6), RCAR_GP_PIN(4, 7),
-               RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9),
-               RCAR_GP_PIN(4, 10), RCAR_GP_PIN(4, 11),
-               /* G */
-               RCAR_GP_PIN(4, 12), RCAR_GP_PIN(4, 13),
-               RCAR_GP_PIN(4, 14), RCAR_GP_PIN(4, 15),
-               RCAR_GP_PIN(8, 1), RCAR_GP_PIN(8, 2),
-               RCAR_GP_PIN(8, 3), RCAR_GP_PIN(8, 4),
-               /* R */
-               RCAR_GP_PIN(8, 5), RCAR_GP_PIN(8, 6),
-               RCAR_GP_PIN(8, 7), RCAR_GP_PIN(8, 8),
-               RCAR_GP_PIN(8, 9), RCAR_GP_PIN(8, 10),
-               RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12),
-       },
+static const unsigned int vin0_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
+       RCAR_GP_PIN(4, 6), RCAR_GP_PIN(4, 7),
+       RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9),
+       RCAR_GP_PIN(4, 10), RCAR_GP_PIN(4, 11),
+       /* G */
+       RCAR_GP_PIN(4, 12), RCAR_GP_PIN(4, 13),
+       RCAR_GP_PIN(4, 14), RCAR_GP_PIN(4, 15),
+       RCAR_GP_PIN(8, 1), RCAR_GP_PIN(8, 2),
+       RCAR_GP_PIN(8, 3), RCAR_GP_PIN(8, 4),
+       /* R */
+       RCAR_GP_PIN(8, 5), RCAR_GP_PIN(8, 6),
+       RCAR_GP_PIN(8, 7), RCAR_GP_PIN(8, 8),
+       RCAR_GP_PIN(8, 9), RCAR_GP_PIN(8, 10),
+       RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               /* B */
-               VI0_D0_B0_C0_MARK, VI0_D1_B1_C1_MARK,
-               VI0_D2_B2_C2_MARK, VI0_D3_B3_C3_MARK,
-               VI0_D4_B4_C4_MARK, VI0_D5_B5_C5_MARK,
-               VI0_D6_B6_C6_MARK, VI0_D7_B7_C7_MARK,
-               /* G */
-               VI0_D8_G0_Y0_MARK, VI0_D9_G1_Y1_MARK,
-               VI0_D10_G2_Y2_MARK, VI0_D11_G3_Y3_MARK,
-               VI0_D12_G4_Y4_MARK, VI0_D13_G5_Y5_MARK,
-               VI0_D14_G6_Y6_MARK, VI0_D15_G7_Y7_MARK,
-               /* R */
-               VI0_D16_R0_MARK, VI0_D17_R1_MARK,
-               VI0_D18_R2_MARK, VI0_D19_R3_MARK,
-               VI0_D20_R4_MARK, VI0_D21_R5_MARK,
-               VI0_D22_R6_MARK, VI0_D23_R7_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       /* B */
+       VI0_D0_B0_C0_MARK, VI0_D1_B1_C1_MARK,
+       VI0_D2_B2_C2_MARK, VI0_D3_B3_C3_MARK,
+       VI0_D4_B4_C4_MARK, VI0_D5_B5_C5_MARK,
+       VI0_D6_B6_C6_MARK, VI0_D7_B7_C7_MARK,
+       /* G */
+       VI0_D8_G0_Y0_MARK, VI0_D9_G1_Y1_MARK,
+       VI0_D10_G2_Y2_MARK, VI0_D11_G3_Y3_MARK,
+       VI0_D12_G4_Y4_MARK, VI0_D13_G5_Y5_MARK,
+       VI0_D14_G6_Y6_MARK, VI0_D15_G7_Y7_MARK,
+       /* R */
+       VI0_D16_R0_MARK, VI0_D17_R1_MARK,
+       VI0_D18_R2_MARK, VI0_D19_R3_MARK,
+       VI0_D20_R4_MARK, VI0_D21_R5_MARK,
+       VI0_D22_R6_MARK, VI0_D23_R7_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        /* B */
@@ -1335,43 +1317,39 @@ static const unsigned int vin0_clk_mux[] = {
        VI0_CLK_MARK,
 };
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data vin1_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(5, 4), RCAR_GP_PIN(5, 5),
-               RCAR_GP_PIN(5, 6), RCAR_GP_PIN(5, 7),
-               RCAR_GP_PIN(5, 8), RCAR_GP_PIN(5, 9),
-               RCAR_GP_PIN(5, 10), RCAR_GP_PIN(5, 11),
-               /* G */
-               RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
-               RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
-               RCAR_GP_PIN(8, 5), RCAR_GP_PIN(8, 6),
-               RCAR_GP_PIN(8, 7), RCAR_GP_PIN(8, 8),
-               /* R */
-               RCAR_GP_PIN(9, 5), RCAR_GP_PIN(9, 6),
-               RCAR_GP_PIN(9, 7), RCAR_GP_PIN(9, 8),
-               RCAR_GP_PIN(9, 9), RCAR_GP_PIN(9, 10),
-               RCAR_GP_PIN(9, 11), RCAR_GP_PIN(9, 12),
-       },
+static const unsigned int vin1_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(5, 4), RCAR_GP_PIN(5, 5),
+       RCAR_GP_PIN(5, 6), RCAR_GP_PIN(5, 7),
+       RCAR_GP_PIN(5, 8), RCAR_GP_PIN(5, 9),
+       RCAR_GP_PIN(5, 10), RCAR_GP_PIN(5, 11),
+       /* G */
+       RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
+       RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
+       RCAR_GP_PIN(8, 5), RCAR_GP_PIN(8, 6),
+       RCAR_GP_PIN(8, 7), RCAR_GP_PIN(8, 8),
+       /* R */
+       RCAR_GP_PIN(9, 5), RCAR_GP_PIN(9, 6),
+       RCAR_GP_PIN(9, 7), RCAR_GP_PIN(9, 8),
+       RCAR_GP_PIN(9, 9), RCAR_GP_PIN(9, 10),
+       RCAR_GP_PIN(9, 11), RCAR_GP_PIN(9, 12),
 };
-static const union vin_data vin1_data_mux = {
-       .data24 = {
-               /* B */
-               VI1_D0_B0_C0_MARK, VI1_D1_B1_C1_MARK,
-               VI1_D2_B2_C2_MARK, VI1_D3_B3_C3_MARK,
-               VI1_D4_B4_C4_MARK, VI1_D5_B5_C5_MARK,
-               VI1_D6_B6_C6_MARK, VI1_D7_B7_C7_MARK,
-               /* G */
-               VI1_D8_G0_Y0_MARK, VI1_D9_G1_Y1_MARK,
-               VI1_D10_G2_Y2_MARK, VI1_D11_G3_Y3_MARK,
-               VI1_D12_G4_Y4_MARK, VI1_D13_G5_Y5_MARK,
-               VI1_D14_G6_Y6_MARK, VI1_D15_G7_Y7_MARK,
-               /* R */
-               VI1_D16_R0_MARK, VI1_D17_R1_MARK,
-               VI1_D18_R2_MARK, VI1_D19_R3_MARK,
-               VI1_D20_R4_MARK, VI1_D21_R5_MARK,
-               VI1_D22_R6_MARK, VI1_D23_R7_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       /* B */
+       VI1_D0_B0_C0_MARK, VI1_D1_B1_C1_MARK,
+       VI1_D2_B2_C2_MARK, VI1_D3_B3_C3_MARK,
+       VI1_D4_B4_C4_MARK, VI1_D5_B5_C5_MARK,
+       VI1_D6_B6_C6_MARK, VI1_D7_B7_C7_MARK,
+       /* G */
+       VI1_D8_G0_Y0_MARK, VI1_D9_G1_Y1_MARK,
+       VI1_D10_G2_Y2_MARK, VI1_D11_G3_Y3_MARK,
+       VI1_D12_G4_Y4_MARK, VI1_D13_G5_Y5_MARK,
+       VI1_D14_G6_Y6_MARK, VI1_D15_G7_Y7_MARK,
+       /* R */
+       VI1_D16_R0_MARK, VI1_D17_R1_MARK,
+       VI1_D18_R2_MARK, VI1_D19_R3_MARK,
+       VI1_D20_R4_MARK, VI1_D21_R5_MARK,
+       VI1_D22_R6_MARK, VI1_D23_R7_MARK,
 };
 static const unsigned int vin1_data18_pins[] = {
        /* B */
@@ -1401,43 +1379,39 @@ static const unsigned int vin1_data18_mux[] = {
        VI1_D20_R4_MARK, VI1_D21_R5_MARK,
        VI1_D22_R6_MARK, VI1_D23_R7_MARK,
 };
-static const union vin_data vin1_data_b_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(5, 4), RCAR_GP_PIN(5, 5),
-               RCAR_GP_PIN(5, 6), RCAR_GP_PIN(5, 7),
-               RCAR_GP_PIN(5, 8), RCAR_GP_PIN(5, 9),
-               RCAR_GP_PIN(5, 10), RCAR_GP_PIN(5, 11),
-               /* G */
-               RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
-               RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
-               RCAR_GP_PIN(9, 1), RCAR_GP_PIN(9, 2),
-               RCAR_GP_PIN(9, 3), RCAR_GP_PIN(9, 4),
-               /* R */
-               RCAR_GP_PIN(9, 5), RCAR_GP_PIN(9, 6),
-               RCAR_GP_PIN(9, 7), RCAR_GP_PIN(9, 8),
-               RCAR_GP_PIN(9, 9), RCAR_GP_PIN(9, 10),
-               RCAR_GP_PIN(9, 11), RCAR_GP_PIN(9, 12),
-       },
+static const unsigned int vin1_data_b_pins[] = {
+       /* B */
+       RCAR_GP_PIN(5, 4), RCAR_GP_PIN(5, 5),
+       RCAR_GP_PIN(5, 6), RCAR_GP_PIN(5, 7),
+       RCAR_GP_PIN(5, 8), RCAR_GP_PIN(5, 9),
+       RCAR_GP_PIN(5, 10), RCAR_GP_PIN(5, 11),
+       /* G */
+       RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
+       RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
+       RCAR_GP_PIN(9, 1), RCAR_GP_PIN(9, 2),
+       RCAR_GP_PIN(9, 3), RCAR_GP_PIN(9, 4),
+       /* R */
+       RCAR_GP_PIN(9, 5), RCAR_GP_PIN(9, 6),
+       RCAR_GP_PIN(9, 7), RCAR_GP_PIN(9, 8),
+       RCAR_GP_PIN(9, 9), RCAR_GP_PIN(9, 10),
+       RCAR_GP_PIN(9, 11), RCAR_GP_PIN(9, 12),
 };
-static const union vin_data vin1_data_b_mux = {
-       .data24 = {
-               /* B */
-               VI1_D0_B0_C0_MARK, VI1_D1_B1_C1_MARK,
-               VI1_D2_B2_C2_MARK, VI1_D3_B3_C3_MARK,
-               VI1_D4_B4_C4_MARK, VI1_D5_B5_C5_MARK,
-               VI1_D6_B6_C6_MARK, VI1_D7_B7_C7_MARK,
-               /* G */
-               VI1_D8_G0_Y0_MARK, VI1_D9_G1_Y1_MARK,
-               VI1_D10_G2_Y2_MARK, VI1_D11_G3_Y3_MARK,
-               VI1_D12_G4_Y4_B_MARK, VI1_D13_G5_Y5_B_MARK,
-               VI1_D14_G6_Y6_B_MARK, VI1_D15_G7_Y7_B_MARK,
-               /* R */
-               VI1_D16_R0_MARK, VI1_D17_R1_MARK,
-               VI1_D18_R2_MARK, VI1_D19_R3_MARK,
-               VI1_D20_R4_MARK, VI1_D21_R5_MARK,
-               VI1_D22_R6_MARK, VI1_D23_R7_MARK,
-       },
+static const unsigned int vin1_data_b_mux[] = {
+       /* B */
+       VI1_D0_B0_C0_MARK, VI1_D1_B1_C1_MARK,
+       VI1_D2_B2_C2_MARK, VI1_D3_B3_C3_MARK,
+       VI1_D4_B4_C4_MARK, VI1_D5_B5_C5_MARK,
+       VI1_D6_B6_C6_MARK, VI1_D7_B7_C7_MARK,
+       /* G */
+       VI1_D8_G0_Y0_MARK, VI1_D9_G1_Y1_MARK,
+       VI1_D10_G2_Y2_MARK, VI1_D11_G3_Y3_MARK,
+       VI1_D12_G4_Y4_B_MARK, VI1_D13_G5_Y5_B_MARK,
+       VI1_D14_G6_Y6_B_MARK, VI1_D15_G7_Y7_B_MARK,
+       /* R */
+       VI1_D16_R0_MARK, VI1_D17_R1_MARK,
+       VI1_D18_R2_MARK, VI1_D19_R3_MARK,
+       VI1_D20_R4_MARK, VI1_D21_R5_MARK,
+       VI1_D22_R6_MARK, VI1_D23_R7_MARK,
 };
 static const unsigned int vin1_data18_b_pins[] = {
        /* B */
@@ -1493,29 +1467,25 @@ static const unsigned int vin1_clk_mux[] = {
        VI1_CLK_MARK,
 };
 /* - VIN2 ------------------------------------------------------------------- */
-static const union vin_data16 vin2_data_pins = {
-       .data16 = {
-               RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
-               RCAR_GP_PIN(6, 6), RCAR_GP_PIN(6, 7),
-               RCAR_GP_PIN(6, 8), RCAR_GP_PIN(6, 9),
-               RCAR_GP_PIN(6, 10), RCAR_GP_PIN(6, 11),
-               RCAR_GP_PIN(6, 12), RCAR_GP_PIN(6, 13),
-               RCAR_GP_PIN(6, 14), RCAR_GP_PIN(6, 15),
-               RCAR_GP_PIN(8, 9), RCAR_GP_PIN(8, 10),
-               RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12),
-       },
+static const unsigned int vin2_data_pins[] = {
+       RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
+       RCAR_GP_PIN(6, 6), RCAR_GP_PIN(6, 7),
+       RCAR_GP_PIN(6, 8), RCAR_GP_PIN(6, 9),
+       RCAR_GP_PIN(6, 10), RCAR_GP_PIN(6, 11),
+       RCAR_GP_PIN(6, 12), RCAR_GP_PIN(6, 13),
+       RCAR_GP_PIN(6, 14), RCAR_GP_PIN(6, 15),
+       RCAR_GP_PIN(8, 9), RCAR_GP_PIN(8, 10),
+       RCAR_GP_PIN(8, 11), RCAR_GP_PIN(8, 12),
 };
-static const union vin_data16 vin2_data_mux = {
-       .data16 = {
-               VI2_D0_C0_MARK, VI2_D1_C1_MARK,
-               VI2_D2_C2_MARK, VI2_D3_C3_MARK,
-               VI2_D4_C4_MARK, VI2_D5_C5_MARK,
-               VI2_D6_C6_MARK, VI2_D7_C7_MARK,
-               VI2_D8_Y0_MARK, VI2_D9_Y1_MARK,
-               VI2_D10_Y2_MARK, VI2_D11_Y3_MARK,
-               VI2_D12_Y4_MARK, VI2_D13_Y5_MARK,
-               VI2_D14_Y6_MARK, VI2_D15_Y7_MARK,
-       },
+static const unsigned int vin2_data_mux[] = {
+       VI2_D0_C0_MARK, VI2_D1_C1_MARK,
+       VI2_D2_C2_MARK, VI2_D3_C3_MARK,
+       VI2_D4_C4_MARK, VI2_D5_C5_MARK,
+       VI2_D6_C6_MARK, VI2_D7_C7_MARK,
+       VI2_D8_Y0_MARK, VI2_D9_Y1_MARK,
+       VI2_D10_Y2_MARK, VI2_D11_Y3_MARK,
+       VI2_D12_Y4_MARK, VI2_D13_Y5_MARK,
+       VI2_D14_Y6_MARK, VI2_D15_Y7_MARK,
 };
 static const unsigned int vin2_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -1543,29 +1513,25 @@ static const unsigned int vin2_clk_mux[] = {
        VI2_CLK_MARK,
 };
 /* - VIN3 ------------------------------------------------------------------- */
-static const union vin_data16 vin3_data_pins = {
-       .data16 = {
-               RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 5),
-               RCAR_GP_PIN(7, 6), RCAR_GP_PIN(7, 7),
-               RCAR_GP_PIN(7, 8), RCAR_GP_PIN(7, 9),
-               RCAR_GP_PIN(7, 10), RCAR_GP_PIN(7, 11),
-               RCAR_GP_PIN(7, 12), RCAR_GP_PIN(7, 13),
-               RCAR_GP_PIN(7, 14), RCAR_GP_PIN(7, 15),
-               RCAR_GP_PIN(8, 13), RCAR_GP_PIN(8, 14),
-               RCAR_GP_PIN(8, 15), RCAR_GP_PIN(8, 16),
-       },
-};
-static const union vin_data16 vin3_data_mux = {
-       .data16 = {
-               VI3_D0_C0_MARK, VI3_D1_C1_MARK,
-               VI3_D2_C2_MARK, VI3_D3_C3_MARK,
-               VI3_D4_C4_MARK, VI3_D5_C5_MARK,
-               VI3_D6_C6_MARK, VI3_D7_C7_MARK,
-               VI3_D8_Y0_MARK, VI3_D9_Y1_MARK,
-               VI3_D10_Y2_MARK, VI3_D11_Y3_MARK,
-               VI3_D12_Y4_MARK, VI3_D13_Y5_MARK,
-               VI3_D14_Y6_MARK, VI3_D15_Y7_MARK,
-       },
+static const unsigned int vin3_data_pins[] = {
+       RCAR_GP_PIN(7, 4), RCAR_GP_PIN(7, 5),
+       RCAR_GP_PIN(7, 6), RCAR_GP_PIN(7, 7),
+       RCAR_GP_PIN(7, 8), RCAR_GP_PIN(7, 9),
+       RCAR_GP_PIN(7, 10), RCAR_GP_PIN(7, 11),
+       RCAR_GP_PIN(7, 12), RCAR_GP_PIN(7, 13),
+       RCAR_GP_PIN(7, 14), RCAR_GP_PIN(7, 15),
+       RCAR_GP_PIN(8, 13), RCAR_GP_PIN(8, 14),
+       RCAR_GP_PIN(8, 15), RCAR_GP_PIN(8, 16),
+};
+static const unsigned int vin3_data_mux[] = {
+       VI3_D0_C0_MARK, VI3_D1_C1_MARK,
+       VI3_D2_C2_MARK, VI3_D3_C3_MARK,
+       VI3_D4_C4_MARK, VI3_D5_C5_MARK,
+       VI3_D6_C6_MARK, VI3_D7_C7_MARK,
+       VI3_D8_Y0_MARK, VI3_D9_Y1_MARK,
+       VI3_D10_Y2_MARK, VI3_D11_Y3_MARK,
+       VI3_D12_Y4_MARK, VI3_D13_Y5_MARK,
+       VI3_D14_Y6_MARK, VI3_D15_Y7_MARK,
 };
 static const unsigned int vin3_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -1593,25 +1559,21 @@ static const unsigned int vin3_clk_mux[] = {
        VI3_CLK_MARK,
 };
 /* - VIN4 ------------------------------------------------------------------- */
-static const union vin_data12 vin4_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(8, 4), RCAR_GP_PIN(8, 5),
-               RCAR_GP_PIN(8, 6), RCAR_GP_PIN(8, 7),
-               RCAR_GP_PIN(8, 8), RCAR_GP_PIN(8, 9),
-               RCAR_GP_PIN(8, 10), RCAR_GP_PIN(8, 11),
-               RCAR_GP_PIN(8, 12), RCAR_GP_PIN(8, 13),
-               RCAR_GP_PIN(8, 14), RCAR_GP_PIN(8, 15),
-       },
-};
-static const union vin_data12 vin4_data_mux = {
-       .data12 = {
-               VI4_D0_C0_MARK, VI4_D1_C1_MARK,
-               VI4_D2_C2_MARK, VI4_D3_C3_MARK,
-               VI4_D4_C4_MARK, VI4_D5_C5_MARK,
-               VI4_D6_C6_MARK, VI4_D7_C7_MARK,
-               VI4_D8_Y0_MARK, VI4_D9_Y1_MARK,
-               VI4_D10_Y2_MARK, VI4_D11_Y3_MARK,
-       },
+static const unsigned int vin4_data_pins[] = {
+       RCAR_GP_PIN(8, 4), RCAR_GP_PIN(8, 5),
+       RCAR_GP_PIN(8, 6), RCAR_GP_PIN(8, 7),
+       RCAR_GP_PIN(8, 8), RCAR_GP_PIN(8, 9),
+       RCAR_GP_PIN(8, 10), RCAR_GP_PIN(8, 11),
+       RCAR_GP_PIN(8, 12), RCAR_GP_PIN(8, 13),
+       RCAR_GP_PIN(8, 14), RCAR_GP_PIN(8, 15),
+};
+static const unsigned int vin4_data_mux[] = {
+       VI4_D0_C0_MARK, VI4_D1_C1_MARK,
+       VI4_D2_C2_MARK, VI4_D3_C3_MARK,
+       VI4_D4_C4_MARK, VI4_D5_C5_MARK,
+       VI4_D6_C6_MARK, VI4_D7_C7_MARK,
+       VI4_D8_Y0_MARK, VI4_D9_Y1_MARK,
+       VI4_D10_Y2_MARK, VI4_D11_Y3_MARK,
 };
 static const unsigned int vin4_sync_pins[] = {
         /* HSYNC#, VSYNC# */
@@ -1639,25 +1601,21 @@ static const unsigned int vin4_clk_mux[] = {
        VI4_CLK_MARK,
 };
 /* - VIN5 ------------------------------------------------------------------- */
-static const union vin_data12 vin5_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(9, 4), RCAR_GP_PIN(9, 5),
-               RCAR_GP_PIN(9, 6), RCAR_GP_PIN(9, 7),
-               RCAR_GP_PIN(9, 8), RCAR_GP_PIN(9, 9),
-               RCAR_GP_PIN(9, 10), RCAR_GP_PIN(9, 11),
-               RCAR_GP_PIN(9, 12), RCAR_GP_PIN(9, 13),
-               RCAR_GP_PIN(9, 14), RCAR_GP_PIN(9, 15),
-       },
-};
-static const union vin_data12 vin5_data_mux = {
-       .data12 = {
-               VI5_D0_C0_MARK, VI5_D1_C1_MARK,
-               VI5_D2_C2_MARK, VI5_D3_C3_MARK,
-               VI5_D4_C4_MARK, VI5_D5_C5_MARK,
-               VI5_D6_C6_MARK, VI5_D7_C7_MARK,
-               VI5_D8_Y0_MARK, VI5_D9_Y1_MARK,
-               VI5_D10_Y2_MARK, VI5_D11_Y3_MARK,
-       },
+static const unsigned int vin5_data_pins[] = {
+       RCAR_GP_PIN(9, 4), RCAR_GP_PIN(9, 5),
+       RCAR_GP_PIN(9, 6), RCAR_GP_PIN(9, 7),
+       RCAR_GP_PIN(9, 8), RCAR_GP_PIN(9, 9),
+       RCAR_GP_PIN(9, 10), RCAR_GP_PIN(9, 11),
+       RCAR_GP_PIN(9, 12), RCAR_GP_PIN(9, 13),
+       RCAR_GP_PIN(9, 14), RCAR_GP_PIN(9, 15),
+};
+static const unsigned int vin5_data_mux[] = {
+       VI5_D0_C0_MARK, VI5_D1_C1_MARK,
+       VI5_D2_C2_MARK, VI5_D3_C3_MARK,
+       VI5_D4_C4_MARK, VI5_D5_C5_MARK,
+       VI5_D6_C6_MARK, VI5_D7_C7_MARK,
+       VI5_D8_Y0_MARK, VI5_D9_Y1_MARK,
+       VI5_D10_Y2_MARK, VI5_D11_Y3_MARK,
 };
 static const unsigned int vin5_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -1728,8 +1686,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(msiof1_rx),
        SH_PFC_PIN_GROUP(msiof1_tx),
        SH_PFC_PIN_GROUP(qspi_ctrl),
-       SH_PFC_PIN_GROUP(qspi_data2),
-       SH_PFC_PIN_GROUP(qspi_data4),
+       BUS_DATA_PIN_GROUP(qspi_data, 2),
+       BUS_DATA_PIN_GROUP(qspi_data, 4),
        SH_PFC_PIN_GROUP(scif0_data),
        SH_PFC_PIN_GROUP(scif0_clk),
        SH_PFC_PIN_GROUP(scif0_ctrl),
@@ -1740,63 +1698,63 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scif2_clk),
        SH_PFC_PIN_GROUP(scif3_data),
        SH_PFC_PIN_GROUP(scif3_clk),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       VIN_DATA_PIN_GROUP(vin0_data, 24),
-       VIN_DATA_PIN_GROUP(vin0_data, 20),
+       BUS_DATA_PIN_GROUP(vin0_data, 24),
+       BUS_DATA_PIN_GROUP(vin0_data, 20),
        SH_PFC_PIN_GROUP(vin0_data18),
-       VIN_DATA_PIN_GROUP(vin0_data, 16),
-       VIN_DATA_PIN_GROUP(vin0_data, 12),
-       VIN_DATA_PIN_GROUP(vin0_data, 10),
-       VIN_DATA_PIN_GROUP(vin0_data, 8),
+       BUS_DATA_PIN_GROUP(vin0_data, 16),
+       BUS_DATA_PIN_GROUP(vin0_data, 12),
+       BUS_DATA_PIN_GROUP(vin0_data, 10),
+       BUS_DATA_PIN_GROUP(vin0_data, 8),
        SH_PFC_PIN_GROUP(vin0_sync),
        SH_PFC_PIN_GROUP(vin0_field),
        SH_PFC_PIN_GROUP(vin0_clkenb),
        SH_PFC_PIN_GROUP(vin0_clk),
-       VIN_DATA_PIN_GROUP(vin1_data, 24),
-       VIN_DATA_PIN_GROUP(vin1_data, 20),
+       BUS_DATA_PIN_GROUP(vin1_data, 24),
+       BUS_DATA_PIN_GROUP(vin1_data, 20),
        SH_PFC_PIN_GROUP(vin1_data18),
-       VIN_DATA_PIN_GROUP(vin1_data, 16),
-       VIN_DATA_PIN_GROUP(vin1_data, 12),
-       VIN_DATA_PIN_GROUP(vin1_data, 10),
-       VIN_DATA_PIN_GROUP(vin1_data, 8),
-       VIN_DATA_PIN_GROUP(vin1_data, 24, _b),
-       VIN_DATA_PIN_GROUP(vin1_data, 20, _b),
+       BUS_DATA_PIN_GROUP(vin1_data, 16),
+       BUS_DATA_PIN_GROUP(vin1_data, 12),
+       BUS_DATA_PIN_GROUP(vin1_data, 10),
+       BUS_DATA_PIN_GROUP(vin1_data, 8),
+       BUS_DATA_PIN_GROUP(vin1_data, 24, _b),
+       BUS_DATA_PIN_GROUP(vin1_data, 20, _b),
        SH_PFC_PIN_GROUP(vin1_data18_b),
-       VIN_DATA_PIN_GROUP(vin1_data, 16, _b),
+       BUS_DATA_PIN_GROUP(vin1_data, 16, _b),
        SH_PFC_PIN_GROUP(vin1_sync),
        SH_PFC_PIN_GROUP(vin1_field),
        SH_PFC_PIN_GROUP(vin1_clkenb),
        SH_PFC_PIN_GROUP(vin1_clk),
-       VIN_DATA_PIN_GROUP(vin2_data, 16),
-       VIN_DATA_PIN_GROUP(vin2_data, 12),
-       VIN_DATA_PIN_GROUP(vin2_data, 10),
-       VIN_DATA_PIN_GROUP(vin2_data, 8),
+       BUS_DATA_PIN_GROUP(vin2_data, 16),
+       BUS_DATA_PIN_GROUP(vin2_data, 12),
+       BUS_DATA_PIN_GROUP(vin2_data, 10),
+       BUS_DATA_PIN_GROUP(vin2_data, 8),
        SH_PFC_PIN_GROUP(vin2_sync),
        SH_PFC_PIN_GROUP(vin2_field),
        SH_PFC_PIN_GROUP(vin2_clkenb),
        SH_PFC_PIN_GROUP(vin2_clk),
-       VIN_DATA_PIN_GROUP(vin3_data, 16),
-       VIN_DATA_PIN_GROUP(vin3_data, 12),
-       VIN_DATA_PIN_GROUP(vin3_data, 10),
-       VIN_DATA_PIN_GROUP(vin3_data, 8),
+       BUS_DATA_PIN_GROUP(vin3_data, 16),
+       BUS_DATA_PIN_GROUP(vin3_data, 12),
+       BUS_DATA_PIN_GROUP(vin3_data, 10),
+       BUS_DATA_PIN_GROUP(vin3_data, 8),
        SH_PFC_PIN_GROUP(vin3_sync),
        SH_PFC_PIN_GROUP(vin3_field),
        SH_PFC_PIN_GROUP(vin3_clkenb),
        SH_PFC_PIN_GROUP(vin3_clk),
-       VIN_DATA_PIN_GROUP(vin4_data, 12),
-       VIN_DATA_PIN_GROUP(vin4_data, 10),
-       VIN_DATA_PIN_GROUP(vin4_data, 8),
+       BUS_DATA_PIN_GROUP(vin4_data, 12),
+       BUS_DATA_PIN_GROUP(vin4_data, 10),
+       BUS_DATA_PIN_GROUP(vin4_data, 8),
        SH_PFC_PIN_GROUP(vin4_sync),
        SH_PFC_PIN_GROUP(vin4_field),
        SH_PFC_PIN_GROUP(vin4_clkenb),
        SH_PFC_PIN_GROUP(vin4_clk),
-       VIN_DATA_PIN_GROUP(vin5_data, 12),
-       VIN_DATA_PIN_GROUP(vin5_data, 10),
-       VIN_DATA_PIN_GROUP(vin5_data, 8),
+       BUS_DATA_PIN_GROUP(vin5_data, 12),
+       BUS_DATA_PIN_GROUP(vin5_data, 10),
+       BUS_DATA_PIN_GROUP(vin5_data, 8),
        SH_PFC_PIN_GROUP(vin5_sync),
        SH_PFC_PIN_GROUP(vin5_field),
        SH_PFC_PIN_GROUP(vin5_clkenb),
@@ -3281,14 +3239,14 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ }
 };
 
-static const struct sh_pfc_soc_operations r8a7792_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a7792_pfc_ops = {
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
 };
 
 const struct sh_pfc_soc_info r8a7792_pinmux_info = {
        .name = "r8a77920_pfc",
-       .ops = &r8a7792_pinmux_ops,
+       .ops = &r8a7792_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index fbb5b3b..d1b0e65 100644 (file)
@@ -2388,29 +2388,14 @@ static const unsigned int intc_irq9_mux[] = {
        IRQ9_MARK,
 };
 /* - MMCIF ------------------------------------------------------------------ */
-static const unsigned int mmc_data1_pins[] = {
-       /* D[0] */
-       RCAR_GP_PIN(6, 18),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
-       RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
        RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
        RCAR_GP_PIN(6, 22), RCAR_GP_PIN(6, 23),
        RCAR_GP_PIN(6, 24), RCAR_GP_PIN(6, 25),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK, MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK, MMC_D6_MARK, MMC_D7_MARK,
 };
@@ -2745,19 +2730,12 @@ static const unsigned int qspi_ctrl_pins[] = {
 static const unsigned int qspi_ctrl_mux[] = {
        SPCLK_MARK, SSL_MARK,
 };
-static const unsigned int qspi_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6),
-};
-static const unsigned int qspi_data2_mux[] = {
-       MOSI_IO0_MARK, MISO_IO1_MARK,
-};
-static const unsigned int qspi_data4_pins[] = {
+static const unsigned int qspi_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
        RCAR_GP_PIN(1, 8),
 };
-static const unsigned int qspi_data4_mux[] = {
+static const unsigned int qspi_data_mux[] = {
        MOSI_IO0_MARK, MISO_IO1_MARK, IO2_MARK, IO3_MARK,
 };
 /* - SCIF0 ------------------------------------------------------------------ */
@@ -3232,19 +3210,12 @@ static const unsigned int scif_clk_b_mux[] = {
        SCIF_CLK_B_MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DATA0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 2), RCAR_GP_PIN(6, 3),
        RCAR_GP_PIN(6, 4), RCAR_GP_PIN(6, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DATA0_MARK, SD0_DATA1_MARK, SD0_DATA2_MARK, SD0_DATA3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -3269,19 +3240,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 10),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DATA0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 10), RCAR_GP_PIN(6, 11),
        RCAR_GP_PIN(6, 12), RCAR_GP_PIN(6, 13),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DATA0_MARK, SD1_DATA1_MARK, SD1_DATA2_MARK, SD1_DATA3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -3306,19 +3270,12 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(6, 18),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DATA0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(6, 18), RCAR_GP_PIN(6, 19),
        RCAR_GP_PIN(6, 20), RCAR_GP_PIN(6, 21),
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DATA0_MARK, SD2_DATA1_MARK, SD2_DATA2_MARK, SD2_DATA3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -3673,43 +3630,39 @@ static const unsigned int usb1_mux[] = {
        USB1_OVC_MARK,
 };
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               /* B */
-               RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 2),
-               RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
-               RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 6),
-               RCAR_GP_PIN(3, 7), RCAR_GP_PIN(3, 8),
-               /* G */
-               RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
-               RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
-               RCAR_GP_PIN(3, 17), RCAR_GP_PIN(3, 18),
-               RCAR_GP_PIN(3, 19), RCAR_GP_PIN(3, 20),
-               /* R */
-               RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 22),
-               RCAR_GP_PIN(3, 23), RCAR_GP_PIN(3, 24),
-               RCAR_GP_PIN(3, 25), RCAR_GP_PIN(3, 26),
-               RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28),
-       },
+static const unsigned int vin0_data_pins[] = {
+       /* B */
+       RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 2),
+       RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 4),
+       RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 6),
+       RCAR_GP_PIN(3, 7), RCAR_GP_PIN(3, 8),
+       /* G */
+       RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
+       RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
+       RCAR_GP_PIN(3, 17), RCAR_GP_PIN(3, 18),
+       RCAR_GP_PIN(3, 19), RCAR_GP_PIN(3, 20),
+       /* R */
+       RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 22),
+       RCAR_GP_PIN(3, 23), RCAR_GP_PIN(3, 24),
+       RCAR_GP_PIN(3, 25), RCAR_GP_PIN(3, 26),
+       RCAR_GP_PIN(3, 27), RCAR_GP_PIN(3, 28),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               /* B */
-               VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
-               VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
-               VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
-               VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
-               /* G */
-               VI0_G0_MARK, VI0_G1_MARK,
-               VI0_G2_MARK, VI0_G3_MARK,
-               VI0_G4_MARK, VI0_G5_MARK,
-               VI0_G6_MARK, VI0_G7_MARK,
-               /* R */
-               VI0_R0_MARK, VI0_R1_MARK,
-               VI0_R2_MARK, VI0_R3_MARK,
-               VI0_R4_MARK, VI0_R5_MARK,
-               VI0_R6_MARK, VI0_R7_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       /* B */
+       VI0_DATA0_VI0_B0_MARK, VI0_DATA1_VI0_B1_MARK,
+       VI0_DATA2_VI0_B2_MARK, VI0_DATA3_VI0_B3_MARK,
+       VI0_DATA4_VI0_B4_MARK, VI0_DATA5_VI0_B5_MARK,
+       VI0_DATA6_VI0_B6_MARK, VI0_DATA7_VI0_B7_MARK,
+       /* G */
+       VI0_G0_MARK, VI0_G1_MARK,
+       VI0_G2_MARK, VI0_G3_MARK,
+       VI0_G4_MARK, VI0_G5_MARK,
+       VI0_G6_MARK, VI0_G7_MARK,
+       /* R */
+       VI0_R0_MARK, VI0_R1_MARK,
+       VI0_R2_MARK, VI0_R3_MARK,
+       VI0_R4_MARK, VI0_R5_MARK,
+       VI0_R6_MARK, VI0_R7_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        /* B */
@@ -3766,25 +3719,21 @@ static const unsigned int vin0_clk_mux[] = {
        VI0_CLK_MARK,
 };
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data12 vin1_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
-               RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
-               RCAR_GP_PIN(5, 16), RCAR_GP_PIN(5, 17),
-               RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
-               RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 11),
-               RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
-       },
+static const unsigned int vin1_data_pins[] = {
+       RCAR_GP_PIN(5, 12), RCAR_GP_PIN(5, 13),
+       RCAR_GP_PIN(5, 14), RCAR_GP_PIN(5, 15),
+       RCAR_GP_PIN(5, 16), RCAR_GP_PIN(5, 17),
+       RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
+       RCAR_GP_PIN(1, 10), RCAR_GP_PIN(1, 11),
+       RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
 };
-static const union vin_data12 vin1_data_mux = {
-       .data12 = {
-               VI1_DATA0_MARK, VI1_DATA1_MARK,
-               VI1_DATA2_MARK, VI1_DATA3_MARK,
-               VI1_DATA4_MARK, VI1_DATA5_MARK,
-               VI1_DATA6_MARK, VI1_DATA7_MARK,
-               VI1_DATA8_MARK, VI1_DATA9_MARK,
-               VI1_DATA10_MARK, VI1_DATA11_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       VI1_DATA0_MARK, VI1_DATA1_MARK,
+       VI1_DATA2_MARK, VI1_DATA3_MARK,
+       VI1_DATA4_MARK, VI1_DATA5_MARK,
+       VI1_DATA6_MARK, VI1_DATA7_MARK,
+       VI1_DATA8_MARK, VI1_DATA9_MARK,
+       VI1_DATA10_MARK, VI1_DATA11_MARK,
 };
 static const unsigned int vin1_sync_pins[] = {
        RCAR_GP_PIN(5, 22), /* HSYNC */
@@ -3923,9 +3872,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(intc_irq7),
        SH_PFC_PIN_GROUP(intc_irq8),
        SH_PFC_PIN_GROUP(intc_irq9),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(msiof0_clk),
        SH_PFC_PIN_GROUP(msiof0_sync),
@@ -3975,8 +3924,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(pwm6),
        SH_PFC_PIN_GROUP(pwm6_b),
        SH_PFC_PIN_GROUP(qspi_ctrl),
-       SH_PFC_PIN_GROUP(qspi_data2),
-       SH_PFC_PIN_GROUP(qspi_data4),
+       BUS_DATA_PIN_GROUP(qspi_data, 2),
+       BUS_DATA_PIN_GROUP(qspi_data, 4),
        SH_PFC_PIN_GROUP(scif0_data),
        SH_PFC_PIN_GROUP(scif0_data_b),
        SH_PFC_PIN_GROUP(scif0_data_c),
@@ -4042,18 +3991,18 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scifb2_ctrl),
        SH_PFC_PIN_GROUP(scif_clk),
        SH_PFC_PIN_GROUP(scif_clk_b),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
        SH_PFC_PIN_GROUP(sdhi1_cd),
        SH_PFC_PIN_GROUP(sdhi1_wp),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(sdhi2_cd),
        SH_PFC_PIN_GROUP(sdhi2_wp),
@@ -4105,20 +4054,20 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(tpu_to3_c),
        SH_PFC_PIN_GROUP(usb0),
        SH_PFC_PIN_GROUP(usb1),
-       VIN_DATA_PIN_GROUP(vin0_data, 24),
-       VIN_DATA_PIN_GROUP(vin0_data, 20),
+       BUS_DATA_PIN_GROUP(vin0_data, 24),
+       BUS_DATA_PIN_GROUP(vin0_data, 20),
        SH_PFC_PIN_GROUP(vin0_data18),
-       VIN_DATA_PIN_GROUP(vin0_data, 16),
-       VIN_DATA_PIN_GROUP(vin0_data, 12),
-       VIN_DATA_PIN_GROUP(vin0_data, 10),
-       VIN_DATA_PIN_GROUP(vin0_data, 8),
+       BUS_DATA_PIN_GROUP(vin0_data, 16),
+       BUS_DATA_PIN_GROUP(vin0_data, 12),
+       BUS_DATA_PIN_GROUP(vin0_data, 10),
+       BUS_DATA_PIN_GROUP(vin0_data, 8),
        SH_PFC_PIN_GROUP(vin0_sync),
        SH_PFC_PIN_GROUP(vin0_field),
        SH_PFC_PIN_GROUP(vin0_clkenb),
        SH_PFC_PIN_GROUP(vin0_clk),
-       VIN_DATA_PIN_GROUP(vin1_data, 12),
-       VIN_DATA_PIN_GROUP(vin1_data, 10),
-       VIN_DATA_PIN_GROUP(vin1_data, 8),
+       BUS_DATA_PIN_GROUP(vin1_data, 12),
+       BUS_DATA_PIN_GROUP(vin1_data, 10),
+       BUS_DATA_PIN_GROUP(vin1_data, 8),
        SH_PFC_PIN_GROUP(vin1_sync),
        SH_PFC_PIN_GROUP(vin1_field),
        SH_PFC_PIN_GROUP(vin1_clkenb),
@@ -5621,8 +5570,11 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        { },
 };
 
-static int r8a7794_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl)
+static int r8a7794_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
+       if (pin < RCAR_GP_PIN(6, 0) || pin > RCAR_GP_PIN(6, 23))
+               return -EINVAL;
+
        *pocctrl = 0xe606006c;
 
        switch (pin & 0x1f) {
@@ -5932,7 +5884,7 @@ static int r8a7794_pinmux_soc_init(struct sh_pfc *pfc)
        return 0;
 }
 
-static const struct sh_pfc_soc_operations r8a7794_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a7794_pfc_ops = {
        .init = r8a7794_pinmux_soc_init,
        .pin_to_pocctrl = r8a7794_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
@@ -5942,7 +5894,7 @@ static const struct sh_pfc_soc_operations r8a7794_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7745
 const struct sh_pfc_soc_info r8a7745_pinmux_info = {
        .name = "r8a77450_pfc",
-       .ops = &r8a7794_pinmux_ops,
+       .ops = &r8a7794_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -5965,7 +5917,7 @@ const struct sh_pfc_soc_info r8a7745_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A7794
 const struct sh_pfc_soc_info r8a7794_pinmux_info = {
        .name = "r8a77940_pfc",
-       .ops = &r8a7794_pinmux_ops,
+       .ops = &r8a7794_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index c860649..63c9f6d 100644 (file)
@@ -3140,18 +3140,11 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
-       PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1, QSPI0_IO2, QSPI0_IO3 */
        PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1, PIN_QSPI0_IO2, PIN_QSPI0_IO3,
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -3163,18 +3156,11 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
-       PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1, QSPI1_IO2, QSPI1_IO3 */
        PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1, PIN_QSPI1_IO2, PIN_QSPI1_IO3,
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -3395,19 +3381,12 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK,
        SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
@@ -3433,19 +3412,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 8),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK,
        SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
@@ -3471,30 +3443,14 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 2),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-static const unsigned int sdhi2_data4_mux[] = {
-       SD2_DAT0_MARK, SD2_DAT1_MARK,
-       SD2_DAT2_MARK, SD2_DAT3_MARK,
-};
-static const unsigned int sdhi2_data8_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 2),  RCAR_GP_PIN(4, 3),
        RCAR_GP_PIN(4, 4),  RCAR_GP_PIN(4, 5),
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi2_data8_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK,
        SD2_DAT2_MARK, SD2_DAT3_MARK,
        SD2_DAT4_MARK, SD2_DAT5_MARK,
@@ -3543,30 +3499,14 @@ static const unsigned int sdhi2_ds_mux[] = {
        SD2_DS_MARK,
 };
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 9),
-};
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-static const unsigned int sdhi3_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
-       RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
-};
-static const unsigned int sdhi3_data4_mux[] = {
-       SD3_DAT0_MARK, SD3_DAT1_MARK,
-       SD3_DAT2_MARK, SD3_DAT3_MARK,
-};
-static const unsigned int sdhi3_data8_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
        RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
        RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 14),
        RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
 };
-static const unsigned int sdhi3_data8_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK,
        SD3_DAT2_MARK, SD3_DAT3_MARK,
        SD3_DAT4_MARK, SD3_DAT5_MARK,
@@ -4103,11 +4043,11 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(pwm6_a),
        SH_PFC_PIN_GROUP(pwm6_b),
        SH_PFC_PIN_GROUP(qspi0_ctrl),
-       SH_PFC_PIN_GROUP(qspi0_data2),
-       SH_PFC_PIN_GROUP(qspi0_data4),
+       BUS_DATA_PIN_GROUP(qspi0_data, 2),
+       BUS_DATA_PIN_GROUP(qspi0_data, 4),
        SH_PFC_PIN_GROUP(qspi1_ctrl),
-       SH_PFC_PIN_GROUP(qspi1_data2),
-       SH_PFC_PIN_GROUP(qspi1_data4),
+       BUS_DATA_PIN_GROUP(qspi1_data, 2),
+       BUS_DATA_PIN_GROUP(qspi1_data, 4),
        SH_PFC_PIN_GROUP(sata0_devslp_a),
        SH_PFC_PIN_GROUP(sata0_devslp_b),
        SH_PFC_PIN_GROUP(scif0_data),
@@ -4137,28 +4077,28 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scif5_clk),
        SH_PFC_PIN_GROUP(scif_clk_a),
        SH_PFC_PIN_GROUP(scif_clk_b),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
        SH_PFC_PIN_GROUP(sdhi1_cd),
        SH_PFC_PIN_GROUP(sdhi1_wp),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
-       SH_PFC_PIN_GROUP(sdhi2_data8),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 8),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(sdhi2_cd_a),
        SH_PFC_PIN_GROUP(sdhi2_wp_a),
        SH_PFC_PIN_GROUP(sdhi2_cd_b),
        SH_PFC_PIN_GROUP(sdhi2_wp_b),
        SH_PFC_PIN_GROUP(sdhi2_ds),
-       SH_PFC_PIN_GROUP(sdhi3_data1),
-       SH_PFC_PIN_GROUP(sdhi3_data4),
-       SH_PFC_PIN_GROUP(sdhi3_data8),
+       BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi3_data, 4),
+       BUS_DATA_PIN_GROUP(sdhi3_data, 8),
        SH_PFC_PIN_GROUP(sdhi3_ctrl),
        SH_PFC_PIN_GROUP(sdhi3_cd),
        SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -5574,8 +5514,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77950_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a77950_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -5832,7 +5771,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a77950_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77950_pfc_ops = {
        .pin_to_pocctrl = r8a77950_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -5840,7 +5779,7 @@ static const struct sh_pfc_soc_operations r8a77950_pinmux_ops = {
 
 const struct sh_pfc_soc_info r8a77950_pinmux_info = {
        .name = "r8a77950_pfc",
-       .ops = &r8a77950_pinmux_ops,
+       .ops = &r8a77950_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index ee9ce5f..9d6eef4 100644 (file)
@@ -3268,20 +3268,13 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
-       PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
        PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
        /* QSPI0_IO2, QSPI0_IO3 */
        PIN_QSPI0_IO2, PIN_QSPI0_IO3,
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -3293,20 +3286,13 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
-       PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
        PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
        /* QSPI1_IO2, QSPI1_IO3 */
        PIN_QSPI1_IO2, PIN_QSPI1_IO3,
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -3541,19 +3527,12 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK,
        SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
@@ -3579,19 +3558,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 8),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK,
        SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
@@ -3617,30 +3589,14 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 2),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-static const unsigned int sdhi2_data4_mux[] = {
-       SD2_DAT0_MARK, SD2_DAT1_MARK,
-       SD2_DAT2_MARK, SD2_DAT3_MARK,
-};
-static const unsigned int sdhi2_data8_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 2),  RCAR_GP_PIN(4, 3),
        RCAR_GP_PIN(4, 4),  RCAR_GP_PIN(4, 5),
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi2_data8_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK,
        SD2_DAT2_MARK, SD2_DAT3_MARK,
        SD2_DAT4_MARK, SD2_DAT5_MARK,
@@ -3689,30 +3645,14 @@ static const unsigned int sdhi2_ds_mux[] = {
        SD2_DS_MARK,
 };
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 9),
-};
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-static const unsigned int sdhi3_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
-       RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
-};
-static const unsigned int sdhi3_data4_mux[] = {
-       SD3_DAT0_MARK, SD3_DAT1_MARK,
-       SD3_DAT2_MARK, SD3_DAT3_MARK,
-};
-static const unsigned int sdhi3_data8_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
        RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
        RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 14),
        RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
 };
-static const unsigned int sdhi3_data8_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK,
        SD3_DAT2_MARK, SD3_DAT3_MARK,
        SD3_DAT4_MARK, SD3_DAT5_MARK,
@@ -4071,81 +4011,61 @@ static const unsigned int vin4_data18_b_mux[] = {
        VI4_DATA20_MARK, VI4_DATA21_MARK,
        VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
-static const union vin_data vin4_data_a_pins = {
-       .data24 = {
-               RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-               RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-               RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
-               RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-       },
-};
-static const union vin_data vin4_data_a_mux = {
-       .data24 = {
-               VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
-               VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
-               VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
-               VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
-               VI4_DATA8_MARK,  VI4_DATA9_MARK,
-               VI4_DATA10_MARK, VI4_DATA11_MARK,
-               VI4_DATA12_MARK, VI4_DATA13_MARK,
-               VI4_DATA14_MARK, VI4_DATA15_MARK,
-               VI4_DATA16_MARK, VI4_DATA17_MARK,
-               VI4_DATA18_MARK, VI4_DATA19_MARK,
-               VI4_DATA20_MARK, VI4_DATA21_MARK,
-               VI4_DATA22_MARK, VI4_DATA23_MARK,
-       },
-};
-static const union vin_data vin4_data_b_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
-               RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
-               RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
-               RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-       },
+static const unsigned int vin4_data_a_pins[] = {
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
+       RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
 };
-static const union vin_data vin4_data_b_mux = {
-       .data24 = {
-               VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
-               VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
-               VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
-               VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
-               VI4_DATA8_MARK,  VI4_DATA9_MARK,
-               VI4_DATA10_MARK, VI4_DATA11_MARK,
-               VI4_DATA12_MARK, VI4_DATA13_MARK,
-               VI4_DATA14_MARK, VI4_DATA15_MARK,
-               VI4_DATA16_MARK, VI4_DATA17_MARK,
-               VI4_DATA18_MARK, VI4_DATA19_MARK,
-               VI4_DATA20_MARK, VI4_DATA21_MARK,
-               VI4_DATA22_MARK, VI4_DATA23_MARK,
-       },
+static const unsigned int vin4_data_a_mux[] = {
+       VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
+       VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
+       VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
+       VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
+       VI4_DATA8_MARK,  VI4_DATA9_MARK,
+       VI4_DATA10_MARK, VI4_DATA11_MARK,
+       VI4_DATA12_MARK, VI4_DATA13_MARK,
+       VI4_DATA14_MARK, VI4_DATA15_MARK,
+       VI4_DATA16_MARK, VI4_DATA17_MARK,
+       VI4_DATA18_MARK, VI4_DATA19_MARK,
+       VI4_DATA20_MARK, VI4_DATA21_MARK,
+       VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
-static const unsigned int vin4_g8_pins[] = {
-       RCAR_GP_PIN(1, 0),  RCAR_GP_PIN(1, 1),
-       RCAR_GP_PIN(1, 2),  RCAR_GP_PIN(1, 3),
-       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+static const unsigned int vin4_data_b_pins[] = {
+       RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
+       RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
+       RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
 };
-static const unsigned int vin4_g8_mux[] = {
+static const unsigned int vin4_data_b_mux[] = {
+       VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
+       VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
+       VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
+       VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
        VI4_DATA8_MARK,  VI4_DATA9_MARK,
        VI4_DATA10_MARK, VI4_DATA11_MARK,
        VI4_DATA12_MARK, VI4_DATA13_MARK,
        VI4_DATA14_MARK, VI4_DATA15_MARK,
+       VI4_DATA16_MARK, VI4_DATA17_MARK,
+       VI4_DATA18_MARK, VI4_DATA19_MARK,
+       VI4_DATA20_MARK, VI4_DATA21_MARK,
+       VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
 static const unsigned int vin4_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -4177,37 +4097,21 @@ static const unsigned int vin4_clk_mux[] = {
 };
 
 /* - VIN5 ------------------------------------------------------------------- */
-static const union vin_data16 vin5_data_pins = {
-       .data16 = {
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-               RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-       },
-};
-static const union vin_data16 vin5_data_mux = {
-       .data16 = {
-               VI5_DATA0_MARK, VI5_DATA1_MARK,
-               VI5_DATA2_MARK, VI5_DATA3_MARK,
-               VI5_DATA4_MARK, VI5_DATA5_MARK,
-               VI5_DATA6_MARK, VI5_DATA7_MARK,
-               VI5_DATA8_MARK,  VI5_DATA9_MARK,
-               VI5_DATA10_MARK, VI5_DATA11_MARK,
-               VI5_DATA12_MARK, VI5_DATA13_MARK,
-               VI5_DATA14_MARK, VI5_DATA15_MARK,
-       },
-};
-static const unsigned int vin5_high8_pins[] = {
+static const unsigned int vin5_data_pins[] = {
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
        RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
        RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
 };
-static const unsigned int vin5_high8_mux[] = {
+static const unsigned int vin5_data_mux[] = {
+       VI5_DATA0_MARK, VI5_DATA1_MARK,
+       VI5_DATA2_MARK, VI5_DATA3_MARK,
+       VI5_DATA4_MARK, VI5_DATA5_MARK,
+       VI5_DATA6_MARK, VI5_DATA7_MARK,
        VI5_DATA8_MARK,  VI5_DATA9_MARK,
        VI5_DATA10_MARK, VI5_DATA11_MARK,
        VI5_DATA12_MARK, VI5_DATA13_MARK,
@@ -4449,11 +4353,11 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm6_a),
                SH_PFC_PIN_GROUP(pwm6_b),
                SH_PFC_PIN_GROUP(qspi0_ctrl),
-               SH_PFC_PIN_GROUP(qspi0_data2),
-               SH_PFC_PIN_GROUP(qspi0_data4),
+               BUS_DATA_PIN_GROUP(qspi0_data, 2),
+               BUS_DATA_PIN_GROUP(qspi0_data, 4),
                SH_PFC_PIN_GROUP(qspi1_ctrl),
-               SH_PFC_PIN_GROUP(qspi1_data2),
-               SH_PFC_PIN_GROUP(qspi1_data4),
+               BUS_DATA_PIN_GROUP(qspi1_data, 2),
+               BUS_DATA_PIN_GROUP(qspi1_data, 4),
                SH_PFC_PIN_GROUP(sata0_devslp_a),
                SH_PFC_PIN_GROUP(sata0_devslp_b),
                SH_PFC_PIN_GROUP(scif0_data),
@@ -4485,28 +4389,28 @@ static const struct {
                SH_PFC_PIN_GROUP(scif5_clk_b),
                SH_PFC_PIN_GROUP(scif_clk_a),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi2_data1),
-               SH_PFC_PIN_GROUP(sdhi2_data4),
-               SH_PFC_PIN_GROUP(sdhi2_data8),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 8),
                SH_PFC_PIN_GROUP(sdhi2_ctrl),
                SH_PFC_PIN_GROUP(sdhi2_cd_a),
                SH_PFC_PIN_GROUP(sdhi2_wp_a),
                SH_PFC_PIN_GROUP(sdhi2_cd_b),
                SH_PFC_PIN_GROUP(sdhi2_wp_b),
                SH_PFC_PIN_GROUP(sdhi2_ds),
-               SH_PFC_PIN_GROUP(sdhi3_data1),
-               SH_PFC_PIN_GROUP(sdhi3_data4),
-               SH_PFC_PIN_GROUP(sdhi3_data8),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 8),
                SH_PFC_PIN_GROUP(sdhi3_ctrl),
                SH_PFC_PIN_GROUP(sdhi3_cd),
                SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -4549,30 +4453,30 @@ static const struct {
                SH_PFC_PIN_GROUP(usb2),
                SH_PFC_PIN_GROUP(usb2_ch3),
                SH_PFC_PIN_GROUP(usb30),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _a),
                SH_PFC_PIN_GROUP(vin4_data18_a),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _b),
                SH_PFC_PIN_GROUP(vin4_data18_b),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _b),
-               SH_PFC_PIN_GROUP(vin4_g8),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _b),
+               SH_PFC_PIN_GROUP_SUBSET(vin4_g8, vin4_data_a, 8, 8),
                SH_PFC_PIN_GROUP(vin4_sync),
                SH_PFC_PIN_GROUP(vin4_field),
                SH_PFC_PIN_GROUP(vin4_clkenb),
                SH_PFC_PIN_GROUP(vin4_clk),
-               VIN_DATA_PIN_GROUP(vin5_data, 8),
-               VIN_DATA_PIN_GROUP(vin5_data, 10),
-               VIN_DATA_PIN_GROUP(vin5_data, 12),
-               VIN_DATA_PIN_GROUP(vin5_data, 16),
-               SH_PFC_PIN_GROUP(vin5_high8),
+               BUS_DATA_PIN_GROUP(vin5_data, 8),
+               BUS_DATA_PIN_GROUP(vin5_data, 10),
+               BUS_DATA_PIN_GROUP(vin5_data, 12),
+               BUS_DATA_PIN_GROUP(vin5_data, 16),
+               SH_PFC_PIN_GROUP_SUBSET(vin5_high8, vin5_data, 8, 8),
                SH_PFC_PIN_GROUP(vin5_sync),
                SH_PFC_PIN_GROUP(vin5_field),
                SH_PFC_PIN_GROUP(vin5_clkenb),
@@ -6058,8 +5962,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77951_pin_to_pocctrl(struct sh_pfc *pfc,
-                                  unsigned int pin, u32 *pocctrl)
+static int r8a77951_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -6316,7 +6219,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a77951_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77951_pfc_ops = {
        .pin_to_pocctrl = r8a77951_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -6325,7 +6228,7 @@ static const struct sh_pfc_soc_operations r8a77951_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A774E1
 const struct sh_pfc_soc_info r8a774e1_pinmux_info = {
        .name = "r8a774e1_pfc",
-       .ops = &r8a77951_pinmux_ops,
+       .ops = &r8a77951_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -6350,7 +6253,7 @@ const struct sh_pfc_soc_info r8a774e1_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77951
 const struct sh_pfc_soc_info r8a77951_pinmux_info = {
        .name = "r8a77951_pfc",
-       .ops = &r8a77951_pinmux_ops,
+       .ops = &r8a77951_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index de3df50..75ea368 100644 (file)
@@ -3274,20 +3274,13 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
-       PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
        PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
        /* QSPI0_IO2, QSPI0_IO3 */
        PIN_QSPI0_IO2, PIN_QSPI0_IO3,
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -3299,20 +3292,13 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
-       PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
        PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
        /* QSPI1_IO2, QSPI1_IO3 */
        PIN_QSPI1_IO2, PIN_QSPI1_IO3,
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -3532,19 +3518,12 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK,
        SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
@@ -3570,19 +3549,12 @@ static const unsigned int sdhi0_wp_mux[] = {
        SD0_WP_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 8),
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK,
        SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
@@ -3608,30 +3580,14 @@ static const unsigned int sdhi1_wp_mux[] = {
        SD1_WP_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 2),
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-static const unsigned int sdhi2_data4_mux[] = {
-       SD2_DAT0_MARK, SD2_DAT1_MARK,
-       SD2_DAT2_MARK, SD2_DAT3_MARK,
-};
-static const unsigned int sdhi2_data8_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 2),  RCAR_GP_PIN(4, 3),
        RCAR_GP_PIN(4, 4),  RCAR_GP_PIN(4, 5),
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
-static const unsigned int sdhi2_data8_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK,
        SD2_DAT2_MARK, SD2_DAT3_MARK,
        SD2_DAT4_MARK, SD2_DAT5_MARK,
@@ -3680,30 +3636,14 @@ static const unsigned int sdhi2_ds_mux[] = {
        SD2_DS_MARK,
 };
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 9),
-};
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-static const unsigned int sdhi3_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
-       RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
-};
-static const unsigned int sdhi3_data4_mux[] = {
-       SD3_DAT0_MARK, SD3_DAT1_MARK,
-       SD3_DAT2_MARK, SD3_DAT3_MARK,
-};
-static const unsigned int sdhi3_data8_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
        RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
        RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 14),
        RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
 };
-static const unsigned int sdhi3_data8_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK,
        SD3_DAT2_MARK, SD3_DAT3_MARK,
        SD3_DAT4_MARK, SD3_DAT5_MARK,
@@ -4046,81 +3986,61 @@ static const unsigned int vin4_data18_b_mux[] = {
        VI4_DATA20_MARK, VI4_DATA21_MARK,
        VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
-static const union vin_data vin4_data_a_pins = {
-       .data24 = {
-               RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
-               RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-               RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
-               RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-       },
-};
-static const union vin_data vin4_data_a_mux = {
-       .data24 = {
-               VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
-               VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
-               VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
-               VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
-               VI4_DATA8_MARK,  VI4_DATA9_MARK,
-               VI4_DATA10_MARK, VI4_DATA11_MARK,
-               VI4_DATA12_MARK, VI4_DATA13_MARK,
-               VI4_DATA14_MARK, VI4_DATA15_MARK,
-               VI4_DATA16_MARK, VI4_DATA17_MARK,
-               VI4_DATA18_MARK, VI4_DATA19_MARK,
-               VI4_DATA20_MARK, VI4_DATA21_MARK,
-               VI4_DATA22_MARK, VI4_DATA23_MARK,
-       },
-};
-static const union vin_data vin4_data_b_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
-               RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
-               RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
-               RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-       },
+static const unsigned int vin4_data_a_pins[] = {
+       RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
+       RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
 };
-static const union vin_data vin4_data_b_mux = {
-       .data24 = {
-               VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
-               VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
-               VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
-               VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
-               VI4_DATA8_MARK,  VI4_DATA9_MARK,
-               VI4_DATA10_MARK, VI4_DATA11_MARK,
-               VI4_DATA12_MARK, VI4_DATA13_MARK,
-               VI4_DATA14_MARK, VI4_DATA15_MARK,
-               VI4_DATA16_MARK, VI4_DATA17_MARK,
-               VI4_DATA18_MARK, VI4_DATA19_MARK,
-               VI4_DATA20_MARK, VI4_DATA21_MARK,
-               VI4_DATA22_MARK, VI4_DATA23_MARK,
-       },
+static const unsigned int vin4_data_a_mux[] = {
+       VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
+       VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
+       VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
+       VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
+       VI4_DATA8_MARK,  VI4_DATA9_MARK,
+       VI4_DATA10_MARK, VI4_DATA11_MARK,
+       VI4_DATA12_MARK, VI4_DATA13_MARK,
+       VI4_DATA14_MARK, VI4_DATA15_MARK,
+       VI4_DATA16_MARK, VI4_DATA17_MARK,
+       VI4_DATA18_MARK, VI4_DATA19_MARK,
+       VI4_DATA20_MARK, VI4_DATA21_MARK,
+       VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
-static const unsigned int vin4_g8_pins[] = {
-       RCAR_GP_PIN(1, 0),  RCAR_GP_PIN(1, 1),
-       RCAR_GP_PIN(1, 2),  RCAR_GP_PIN(1, 3),
-       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+static const unsigned int vin4_data_b_pins[] = {
+       RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
+       RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
+       RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
 };
-static const unsigned int vin4_g8_mux[] = {
+static const unsigned int vin4_data_b_mux[] = {
+       VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
+       VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
+       VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
+       VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
        VI4_DATA8_MARK,  VI4_DATA9_MARK,
        VI4_DATA10_MARK, VI4_DATA11_MARK,
        VI4_DATA12_MARK, VI4_DATA13_MARK,
        VI4_DATA14_MARK, VI4_DATA15_MARK,
+       VI4_DATA16_MARK, VI4_DATA17_MARK,
+       VI4_DATA18_MARK, VI4_DATA19_MARK,
+       VI4_DATA20_MARK, VI4_DATA21_MARK,
+       VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
 static const unsigned int vin4_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -4152,37 +4072,21 @@ static const unsigned int vin4_clk_mux[] = {
 };
 
 /* - VIN5 ------------------------------------------------------------------- */
-static const union vin_data16 vin5_data_pins = {
-       .data16 = {
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-               RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-       },
-};
-static const union vin_data16 vin5_data_mux = {
-       .data16 = {
-               VI5_DATA0_MARK, VI5_DATA1_MARK,
-               VI5_DATA2_MARK, VI5_DATA3_MARK,
-               VI5_DATA4_MARK, VI5_DATA5_MARK,
-               VI5_DATA6_MARK, VI5_DATA7_MARK,
-               VI5_DATA8_MARK,  VI5_DATA9_MARK,
-               VI5_DATA10_MARK, VI5_DATA11_MARK,
-               VI5_DATA12_MARK, VI5_DATA13_MARK,
-               VI5_DATA14_MARK, VI5_DATA15_MARK,
-       },
-};
-static const unsigned int vin5_high8_pins[] = {
+static const unsigned int vin5_data_pins[] = {
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
        RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
        RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
 };
-static const unsigned int vin5_high8_mux[] = {
+static const unsigned int vin5_data_mux[] = {
+       VI5_DATA0_MARK, VI5_DATA1_MARK,
+       VI5_DATA2_MARK, VI5_DATA3_MARK,
+       VI5_DATA4_MARK, VI5_DATA5_MARK,
+       VI5_DATA6_MARK, VI5_DATA7_MARK,
        VI5_DATA8_MARK,  VI5_DATA9_MARK,
        VI5_DATA10_MARK, VI5_DATA11_MARK,
        VI5_DATA12_MARK, VI5_DATA13_MARK,
@@ -4424,11 +4328,11 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm6_a),
                SH_PFC_PIN_GROUP(pwm6_b),
                SH_PFC_PIN_GROUP(qspi0_ctrl),
-               SH_PFC_PIN_GROUP(qspi0_data2),
-               SH_PFC_PIN_GROUP(qspi0_data4),
+               BUS_DATA_PIN_GROUP(qspi0_data, 2),
+               BUS_DATA_PIN_GROUP(qspi0_data, 4),
                SH_PFC_PIN_GROUP(qspi1_ctrl),
-               SH_PFC_PIN_GROUP(qspi1_data2),
-               SH_PFC_PIN_GROUP(qspi1_data4),
+               BUS_DATA_PIN_GROUP(qspi1_data, 2),
+               BUS_DATA_PIN_GROUP(qspi1_data, 4),
                SH_PFC_PIN_GROUP(scif0_data),
                SH_PFC_PIN_GROUP(scif0_clk),
                SH_PFC_PIN_GROUP(scif0_ctrl),
@@ -4458,28 +4362,28 @@ static const struct {
                SH_PFC_PIN_GROUP(scif5_clk_b),
                SH_PFC_PIN_GROUP(scif_clk_a),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi2_data1),
-               SH_PFC_PIN_GROUP(sdhi2_data4),
-               SH_PFC_PIN_GROUP(sdhi2_data8),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 8),
                SH_PFC_PIN_GROUP(sdhi2_ctrl),
                SH_PFC_PIN_GROUP(sdhi2_cd_a),
                SH_PFC_PIN_GROUP(sdhi2_wp_a),
                SH_PFC_PIN_GROUP(sdhi2_cd_b),
                SH_PFC_PIN_GROUP(sdhi2_wp_b),
                SH_PFC_PIN_GROUP(sdhi2_ds),
-               SH_PFC_PIN_GROUP(sdhi3_data1),
-               SH_PFC_PIN_GROUP(sdhi3_data4),
-               SH_PFC_PIN_GROUP(sdhi3_data8),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 8),
                SH_PFC_PIN_GROUP(sdhi3_ctrl),
                SH_PFC_PIN_GROUP(sdhi3_cd),
                SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -4520,30 +4424,30 @@ static const struct {
                SH_PFC_PIN_GROUP(usb0),
                SH_PFC_PIN_GROUP(usb1),
                SH_PFC_PIN_GROUP(usb30),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _a),
                SH_PFC_PIN_GROUP(vin4_data18_a),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _b),
                SH_PFC_PIN_GROUP(vin4_data18_b),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _b),
-               SH_PFC_PIN_GROUP(vin4_g8),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _b),
+               SH_PFC_PIN_GROUP_SUBSET(vin4_g8, vin4_data_a, 8, 8),
                SH_PFC_PIN_GROUP(vin4_sync),
                SH_PFC_PIN_GROUP(vin4_field),
                SH_PFC_PIN_GROUP(vin4_clkenb),
                SH_PFC_PIN_GROUP(vin4_clk),
-               VIN_DATA_PIN_GROUP(vin5_data, 8),
-               VIN_DATA_PIN_GROUP(vin5_data, 10),
-               VIN_DATA_PIN_GROUP(vin5_data, 12),
-               VIN_DATA_PIN_GROUP(vin5_data, 16),
-               SH_PFC_PIN_GROUP(vin5_high8),
+               BUS_DATA_PIN_GROUP(vin5_data, 8),
+               BUS_DATA_PIN_GROUP(vin5_data, 10),
+               BUS_DATA_PIN_GROUP(vin5_data, 12),
+               BUS_DATA_PIN_GROUP(vin5_data, 16),
+               SH_PFC_PIN_GROUP_SUBSET(vin5_high8, vin5_data, 8, 8),
                SH_PFC_PIN_GROUP(vin5_sync),
                SH_PFC_PIN_GROUP(vin5_field),
                SH_PFC_PIN_GROUP(vin5_clkenb),
@@ -6009,8 +5913,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a7796_pin_to_pocctrl(struct sh_pfc *pfc,
-                                 unsigned int pin, u32 *pocctrl)
+static int r8a7796_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -6267,7 +6170,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a7796_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a7796_pfc_ops = {
        .pin_to_pocctrl = r8a7796_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -6276,7 +6179,7 @@ static const struct sh_pfc_soc_operations r8a7796_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A774A1
 const struct sh_pfc_soc_info r8a774a1_pinmux_info = {
        .name = "r8a774a1_pfc",
-       .ops = &r8a7796_pinmux_ops,
+       .ops = &r8a7796_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -6301,7 +6204,7 @@ const struct sh_pfc_soc_info r8a774a1_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77960
 const struct sh_pfc_soc_info r8a77960_pinmux_info = {
        .name = "r8a77960_pfc",
-       .ops = &r8a7796_pinmux_ops,
+       .ops = &r8a7796_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -6328,7 +6231,7 @@ const struct sh_pfc_soc_info r8a77960_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77961
 const struct sh_pfc_soc_info r8a77961_pinmux_info = {
        .name = "r8a77961_pfc",
-       .ops = &r8a7796_pinmux_ops,
+       .ops = &r8a7796_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index 268129f..6bb7f75 100644 (file)
@@ -3424,20 +3424,13 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
-       PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
        PIN_QSPI0_MOSI_IO0, PIN_QSPI0_MISO_IO1,
        /* QSPI0_IO2, QSPI0_IO3 */
        PIN_QSPI0_IO2, PIN_QSPI0_IO3,
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -3449,20 +3442,13 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
-       PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
        PIN_QSPI1_MOSI_IO0, PIN_QSPI1_MISO_IO1,
        /* QSPI1_IO2, QSPI1_IO3 */
        PIN_QSPI1_IO2, PIN_QSPI1_IO3,
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -3698,22 +3684,13 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
 
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK,
        SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
@@ -3746,22 +3723,13 @@ static const unsigned int sdhi0_wp_mux[] = {
 };
 
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 8),
-};
-
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
 
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK,
        SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
@@ -3794,27 +3762,7 @@ static const unsigned int sdhi1_wp_mux[] = {
 };
 
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 2),
-};
-
-static const unsigned int sdhi2_data1_mux[] = {
-       SD2_DAT0_MARK,
-};
-
-static const unsigned int sdhi2_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-
-static const unsigned int sdhi2_data4_mux[] = {
-       SD2_DAT0_MARK, SD2_DAT1_MARK,
-       SD2_DAT2_MARK, SD2_DAT3_MARK,
-};
-
-static const unsigned int sdhi2_data8_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 2),  RCAR_GP_PIN(4, 3),
        RCAR_GP_PIN(4, 4),  RCAR_GP_PIN(4, 5),
@@ -3822,7 +3770,7 @@ static const unsigned int sdhi2_data8_pins[] = {
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
 
-static const unsigned int sdhi2_data8_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SD2_DAT0_MARK, SD2_DAT1_MARK,
        SD2_DAT2_MARK, SD2_DAT3_MARK,
        SD2_DAT4_MARK, SD2_DAT5_MARK,
@@ -3884,27 +3832,7 @@ static const unsigned int sdhi2_ds_mux[] = {
 };
 
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 9),
-};
-
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-
-static const unsigned int sdhi3_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
-       RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
-};
-
-static const unsigned int sdhi3_data4_mux[] = {
-       SD3_DAT0_MARK, SD3_DAT1_MARK,
-       SD3_DAT2_MARK, SD3_DAT3_MARK,
-};
-
-static const unsigned int sdhi3_data8_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 9),  RCAR_GP_PIN(4, 10),
        RCAR_GP_PIN(4, 11), RCAR_GP_PIN(4, 12),
@@ -3912,7 +3840,7 @@ static const unsigned int sdhi3_data8_pins[] = {
        RCAR_GP_PIN(4, 15), RCAR_GP_PIN(4, 16),
 };
 
-static const unsigned int sdhi3_data8_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK,
        SD3_DAT2_MARK, SD3_DAT3_MARK,
        SD3_DAT4_MARK, SD3_DAT5_MARK,
@@ -4254,38 +4182,34 @@ static const unsigned int vin4_data18_a_mux[] = {
        VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
 
-static const union vin_data vin4_data_a_pins = {
-       .data24 = {
-               RCAR_GP_PIN(0, 8),  RCAR_GP_PIN(0, 9),
-               RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-               RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
-               RCAR_GP_PIN(1, 0),  RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2),  RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0),  RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4),  RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6),  RCAR_GP_PIN(0, 7),
-       },
+static const unsigned int vin4_data_a_pins[] = {
+       RCAR_GP_PIN(0, 8),  RCAR_GP_PIN(0, 9),
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+       RCAR_GP_PIN(0, 14), RCAR_GP_PIN(0, 15),
+       RCAR_GP_PIN(1, 0),  RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2),  RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0),  RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4),  RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6),  RCAR_GP_PIN(0, 7),
 };
 
-static const union vin_data vin4_data_a_mux = {
-       .data24 = {
-               VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
-               VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
-               VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
-               VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
-               VI4_DATA8_MARK,   VI4_DATA9_MARK,
-               VI4_DATA10_MARK,  VI4_DATA11_MARK,
-               VI4_DATA12_MARK,  VI4_DATA13_MARK,
-               VI4_DATA14_MARK,  VI4_DATA15_MARK,
-               VI4_DATA16_MARK,  VI4_DATA17_MARK,
-               VI4_DATA18_MARK,  VI4_DATA19_MARK,
-               VI4_DATA20_MARK,  VI4_DATA21_MARK,
-               VI4_DATA22_MARK,  VI4_DATA23_MARK,
-       },
+static const unsigned int vin4_data_a_mux[] = {
+       VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
+       VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
+       VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
+       VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
+       VI4_DATA8_MARK,   VI4_DATA9_MARK,
+       VI4_DATA10_MARK,  VI4_DATA11_MARK,
+       VI4_DATA12_MARK,  VI4_DATA13_MARK,
+       VI4_DATA14_MARK,  VI4_DATA15_MARK,
+       VI4_DATA16_MARK,  VI4_DATA17_MARK,
+       VI4_DATA18_MARK,  VI4_DATA19_MARK,
+       VI4_DATA20_MARK,  VI4_DATA21_MARK,
+       VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
 static const unsigned int vin4_data18_b_pins[] = {
@@ -4312,52 +4236,34 @@ static const unsigned int vin4_data18_b_mux[] = {
        VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
 
-static const union vin_data vin4_data_b_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
-               RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
-               RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
-               RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
-               RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
-               RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-       },
-};
-
-static const union vin_data vin4_data_b_mux = {
-       .data24 = {
-               VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
-               VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
-               VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
-               VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
-               VI4_DATA8_MARK,   VI4_DATA9_MARK,
-               VI4_DATA10_MARK,  VI4_DATA11_MARK,
-               VI4_DATA12_MARK,  VI4_DATA13_MARK,
-               VI4_DATA14_MARK,  VI4_DATA15_MARK,
-               VI4_DATA16_MARK,  VI4_DATA17_MARK,
-               VI4_DATA18_MARK,  VI4_DATA19_MARK,
-               VI4_DATA20_MARK,  VI4_DATA21_MARK,
-               VI4_DATA22_MARK,  VI4_DATA23_MARK,
-       },
-};
-
-static const unsigned int vin4_g8_pins[] = {
-       RCAR_GP_PIN(1, 0),  RCAR_GP_PIN(1, 1),
-       RCAR_GP_PIN(1, 2),  RCAR_GP_PIN(1, 3),
-       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+static const unsigned int vin4_data_b_pins[] = {
+       RCAR_GP_PIN(2, 0), RCAR_GP_PIN(2, 1),
+       RCAR_GP_PIN(2, 2), RCAR_GP_PIN(2, 3),
+       RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(1, 0), RCAR_GP_PIN(1, 1),
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
 };
 
-static const unsigned int vin4_g8_mux[] = {
-       VI4_DATA8_MARK,  VI4_DATA9_MARK,
-       VI4_DATA10_MARK, VI4_DATA11_MARK,
-       VI4_DATA12_MARK, VI4_DATA13_MARK,
-       VI4_DATA14_MARK, VI4_DATA15_MARK,
+static const unsigned int vin4_data_b_mux[] = {
+       VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
+       VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
+       VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
+       VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
+       VI4_DATA8_MARK,   VI4_DATA9_MARK,
+       VI4_DATA10_MARK,  VI4_DATA11_MARK,
+       VI4_DATA12_MARK,  VI4_DATA13_MARK,
+       VI4_DATA14_MARK,  VI4_DATA15_MARK,
+       VI4_DATA16_MARK,  VI4_DATA17_MARK,
+       VI4_DATA18_MARK,  VI4_DATA19_MARK,
+       VI4_DATA20_MARK,  VI4_DATA21_MARK,
+       VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
 static const unsigned int vin4_sync_pins[] = {
@@ -4394,40 +4300,22 @@ static const unsigned int vin4_clk_mux[] = {
 };
 
 /* - VIN5 ------------------------------------------------------------------- */
-static const union vin_data16 vin5_data_pins = {
-       .data16 = {
-               RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
-               RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
-               RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
-               RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
-               RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
-               RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
-               RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
-       },
-};
-
-static const union vin_data16 vin5_data_mux = {
-       .data16 = {
-               VI5_DATA0_MARK, VI5_DATA1_MARK,
-               VI5_DATA2_MARK, VI5_DATA3_MARK,
-               VI5_DATA4_MARK, VI5_DATA5_MARK,
-               VI5_DATA6_MARK, VI5_DATA7_MARK,
-               VI5_DATA8_MARK,  VI5_DATA9_MARK,
-               VI5_DATA10_MARK, VI5_DATA11_MARK,
-               VI5_DATA12_MARK, VI5_DATA13_MARK,
-               VI5_DATA14_MARK, VI5_DATA15_MARK,
-       },
-};
-
-static const unsigned int vin5_high8_pins[] = {
+static const unsigned int vin5_data_pins[] = {
+       RCAR_GP_PIN(0, 0), RCAR_GP_PIN(0, 1),
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
        RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 13),
        RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 15),
        RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
        RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
 };
 
-static const unsigned int vin5_high8_mux[] = {
+static const unsigned int vin5_data_mux[] = {
+       VI5_DATA0_MARK, VI5_DATA1_MARK,
+       VI5_DATA2_MARK, VI5_DATA3_MARK,
+       VI5_DATA4_MARK, VI5_DATA5_MARK,
+       VI5_DATA6_MARK, VI5_DATA7_MARK,
        VI5_DATA8_MARK,  VI5_DATA9_MARK,
        VI5_DATA10_MARK, VI5_DATA11_MARK,
        VI5_DATA12_MARK, VI5_DATA13_MARK,
@@ -4674,11 +4562,11 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm6_a),
                SH_PFC_PIN_GROUP(pwm6_b),
                SH_PFC_PIN_GROUP(qspi0_ctrl),
-               SH_PFC_PIN_GROUP(qspi0_data2),
-               SH_PFC_PIN_GROUP(qspi0_data4),
+               BUS_DATA_PIN_GROUP(qspi0_data, 2),
+               BUS_DATA_PIN_GROUP(qspi0_data, 4),
                SH_PFC_PIN_GROUP(qspi1_ctrl),
-               SH_PFC_PIN_GROUP(qspi1_data2),
-               SH_PFC_PIN_GROUP(qspi1_data4),
+               BUS_DATA_PIN_GROUP(qspi1_data, 2),
+               BUS_DATA_PIN_GROUP(qspi1_data, 4),
                SH_PFC_PIN_GROUP(sata0_devslp_a),
                SH_PFC_PIN_GROUP(sata0_devslp_b),
                SH_PFC_PIN_GROUP(scif0_data),
@@ -4710,28 +4598,28 @@ static const struct {
                SH_PFC_PIN_GROUP(scif5_clk_b),
                SH_PFC_PIN_GROUP(scif_clk_a),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi2_data1),
-               SH_PFC_PIN_GROUP(sdhi2_data4),
-               SH_PFC_PIN_GROUP(sdhi2_data8),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi2_data, 8),
                SH_PFC_PIN_GROUP(sdhi2_ctrl),
                SH_PFC_PIN_GROUP(sdhi2_cd_a),
                SH_PFC_PIN_GROUP(sdhi2_wp_a),
                SH_PFC_PIN_GROUP(sdhi2_cd_b),
                SH_PFC_PIN_GROUP(sdhi2_wp_b),
                SH_PFC_PIN_GROUP(sdhi2_ds),
-               SH_PFC_PIN_GROUP(sdhi3_data1),
-               SH_PFC_PIN_GROUP(sdhi3_data4),
-               SH_PFC_PIN_GROUP(sdhi3_data8),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 8),
                SH_PFC_PIN_GROUP(sdhi3_ctrl),
                SH_PFC_PIN_GROUP(sdhi3_cd),
                SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -4772,30 +4660,30 @@ static const struct {
                SH_PFC_PIN_GROUP(usb0),
                SH_PFC_PIN_GROUP(usb1),
                SH_PFC_PIN_GROUP(usb30),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _a),
                SH_PFC_PIN_GROUP(vin4_data18_a),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _b),
                SH_PFC_PIN_GROUP(vin4_data18_b),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _b),
-               SH_PFC_PIN_GROUP(vin4_g8),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _b),
+               SH_PFC_PIN_GROUP_SUBSET(vin4_g8, vin4_data_a, 8, 8),
                SH_PFC_PIN_GROUP(vin4_sync),
                SH_PFC_PIN_GROUP(vin4_field),
                SH_PFC_PIN_GROUP(vin4_clkenb),
                SH_PFC_PIN_GROUP(vin4_clk),
-               VIN_DATA_PIN_GROUP(vin5_data, 8),
-               VIN_DATA_PIN_GROUP(vin5_data, 10),
-               VIN_DATA_PIN_GROUP(vin5_data, 12),
-               VIN_DATA_PIN_GROUP(vin5_data, 16),
-               SH_PFC_PIN_GROUP(vin5_high8),
+               BUS_DATA_PIN_GROUP(vin5_data, 8),
+               BUS_DATA_PIN_GROUP(vin5_data, 10),
+               BUS_DATA_PIN_GROUP(vin5_data, 12),
+               BUS_DATA_PIN_GROUP(vin5_data, 16),
+               SH_PFC_PIN_GROUP_SUBSET(vin5_high8, vin5_data, 8, 8),
                SH_PFC_PIN_GROUP(vin5_sync),
                SH_PFC_PIN_GROUP(vin5_field),
                SH_PFC_PIN_GROUP(vin5_clkenb),
@@ -6266,8 +6154,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77965_pin_to_pocctrl(struct sh_pfc *pfc,
-                                  unsigned int pin, u32 *pocctrl)
+static int r8a77965_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -6524,7 +6411,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a77965_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77965_pfc_ops = {
        .pin_to_pocctrl = r8a77965_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -6533,7 +6420,7 @@ static const struct sh_pfc_soc_operations r8a77965_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A774B1
 const struct sh_pfc_soc_info r8a774b1_pinmux_info = {
        .name = "r8a774b1_pfc",
-       .ops = &r8a77965_pinmux_ops,
+       .ops = &r8a77965_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -6558,7 +6445,7 @@ const struct sh_pfc_soc_info r8a774b1_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77965
 const struct sh_pfc_soc_info r8a77965_pinmux_info = {
        .name = "r8a77965_pfc",
-       .ops = &r8a77965_pinmux_ops,
+       .ops = &r8a77965_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index 45b0b23..94f90c1 100644 (file)
@@ -1102,30 +1102,14 @@ static const unsigned int intc_ex_irq5_mux[] = {
 };
 
 /* - MMC -------------------------------------------------------------------- */
-static const unsigned int mmc_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 6),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
-       RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC_D0_MARK, MMC_D1_MARK,
-       MMC_D2_MARK, MMC_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
        RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 11), RCAR_GP_PIN(3, 12),
        RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK,
        MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK,
@@ -1393,22 +1377,6 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
-       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
-       RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
-       RCAR_GP_PIN(5, 3), RCAR_GP_PIN(5, 4),
-};
-static const unsigned int qspi0_data4_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-       QSPI0_IO2_MARK, QSPI0_IO3_MARK
-};
 
 /* - QSPI1 ------------------------------------------------------------------ */
 static const unsigned int qspi1_ctrl_pins[] = {
@@ -1418,36 +1386,14 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(5, 7), RCAR_GP_PIN(5, 8),
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
-       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
-       RCAR_GP_PIN(5, 7), RCAR_GP_PIN(5, 8),
-       RCAR_GP_PIN(5, 9), RCAR_GP_PIN(5, 10),
-};
-static const unsigned int qspi1_data4_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-       QSPI1_IO2_MARK, QSPI1_IO3_MARK
-};
 
 /* - RPC -------------------------------------------------------------------- */
-static const unsigned int rpc_clk1_pins[] = {
+static const unsigned int rpc_clk_pins[] = {
        /* Octal-SPI flash: C/SCLK */
-       RCAR_GP_PIN(5, 0),
-};
-static const unsigned int rpc_clk1_mux[] = {
-       QSPI0_SPCLK_MARK,
-};
-static const unsigned int rpc_clk2_pins[] = {
        /* HyperFlash: CK, CK# */
        RCAR_GP_PIN(5, 0), RCAR_GP_PIN(5, 6),
 };
-static const unsigned int rpc_clk2_mux[] = {
+static const unsigned int rpc_clk_mux[] = {
        QSPI0_SPCLK_MARK, QSPI1_SPCLK_MARK,
 };
 static const unsigned int rpc_ctrl_pins[] = {
@@ -1639,25 +1585,21 @@ static const unsigned int tmu_tclk2_b_mux[] = {
 };
 
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data12 vin0_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
-               RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
-               RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
-               RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
-               RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
-       },
-};
-static const union vin_data12 vin0_data_mux = {
-       .data12 = {
-               VI0_DATA0_MARK, VI0_DATA1_MARK,
-               VI0_DATA2_MARK, VI0_DATA3_MARK,
-               VI0_DATA4_MARK, VI0_DATA5_MARK,
-               VI0_DATA6_MARK, VI0_DATA7_MARK,
-               VI0_DATA8_MARK,  VI0_DATA9_MARK,
-               VI0_DATA10_MARK, VI0_DATA11_MARK,
-       },
+static const unsigned int vin0_data_pins[] = {
+       RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
+       RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
+       RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
+       RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
+};
+static const unsigned int vin0_data_mux[] = {
+       VI0_DATA0_MARK, VI0_DATA1_MARK,
+       VI0_DATA2_MARK, VI0_DATA3_MARK,
+       VI0_DATA4_MARK, VI0_DATA5_MARK,
+       VI0_DATA6_MARK, VI0_DATA7_MARK,
+       VI0_DATA8_MARK,  VI0_DATA9_MARK,
+       VI0_DATA10_MARK, VI0_DATA11_MARK,
 };
 static const unsigned int vin0_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -1689,25 +1631,21 @@ static const unsigned int vin0_clk_mux[] = {
 };
 
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data12 vin1_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
-               RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
-               RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
-               RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
-               RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
-               RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15),
-       },
+static const unsigned int vin1_data_pins[] = {
+       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+       RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
+       RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
+       RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
+       RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15),
 };
-static const union vin_data12 vin1_data_mux = {
-       .data12 = {
-               VI1_DATA0_MARK, VI1_DATA1_MARK,
-               VI1_DATA2_MARK, VI1_DATA3_MARK,
-               VI1_DATA4_MARK, VI1_DATA5_MARK,
-               VI1_DATA6_MARK, VI1_DATA7_MARK,
-               VI1_DATA8_MARK,  VI1_DATA9_MARK,
-               VI1_DATA10_MARK, VI1_DATA11_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       VI1_DATA0_MARK, VI1_DATA1_MARK,
+       VI1_DATA2_MARK, VI1_DATA3_MARK,
+       VI1_DATA4_MARK, VI1_DATA5_MARK,
+       VI1_DATA6_MARK, VI1_DATA7_MARK,
+       VI1_DATA8_MARK,  VI1_DATA9_MARK,
+       VI1_DATA10_MARK, VI1_DATA11_MARK,
 };
 static const unsigned int vin1_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -1783,9 +1721,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(intc_ex_irq3),
        SH_PFC_PIN_GROUP(intc_ex_irq4),
        SH_PFC_PIN_GROUP(intc_ex_irq5),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(msiof0_clk),
        SH_PFC_PIN_GROUP(msiof0_sync),
@@ -1822,13 +1760,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(pwm4_a),
        SH_PFC_PIN_GROUP(pwm4_b),
        SH_PFC_PIN_GROUP(qspi0_ctrl),
-       SH_PFC_PIN_GROUP(qspi0_data2),
-       SH_PFC_PIN_GROUP(qspi0_data4),
+       SH_PFC_PIN_GROUP_SUBSET(qspi0_data2, rpc_data, 0, 2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi0_data4, rpc_data, 0, 4),
        SH_PFC_PIN_GROUP(qspi1_ctrl),
-       SH_PFC_PIN_GROUP(qspi1_data2),
-       SH_PFC_PIN_GROUP(qspi1_data4),
-       SH_PFC_PIN_GROUP(rpc_clk1),
-       SH_PFC_PIN_GROUP(rpc_clk2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi1_data2, rpc_data, 4, 2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi1_data4, rpc_data, 4, 4),
+       BUS_DATA_PIN_GROUP(rpc_clk, 1),
+       BUS_DATA_PIN_GROUP(rpc_clk, 2),
        SH_PFC_PIN_GROUP(rpc_ctrl),
        SH_PFC_PIN_GROUP(rpc_data),
        SH_PFC_PIN_GROUP(rpc_reset),
@@ -1853,16 +1791,16 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(tmu_tclk1_b),
        SH_PFC_PIN_GROUP(tmu_tclk2_a),
        SH_PFC_PIN_GROUP(tmu_tclk2_b),
-       VIN_DATA_PIN_GROUP(vin0_data, 8),
-       VIN_DATA_PIN_GROUP(vin0_data, 10),
-       VIN_DATA_PIN_GROUP(vin0_data, 12),
+       BUS_DATA_PIN_GROUP(vin0_data, 8),
+       BUS_DATA_PIN_GROUP(vin0_data, 10),
+       BUS_DATA_PIN_GROUP(vin0_data, 12),
        SH_PFC_PIN_GROUP(vin0_sync),
        SH_PFC_PIN_GROUP(vin0_field),
        SH_PFC_PIN_GROUP(vin0_clkenb),
        SH_PFC_PIN_GROUP(vin0_clk),
-       VIN_DATA_PIN_GROUP(vin1_data, 8),
-       VIN_DATA_PIN_GROUP(vin1_data, 10),
-       VIN_DATA_PIN_GROUP(vin1_data, 12),
+       BUS_DATA_PIN_GROUP(vin1_data, 8),
+       BUS_DATA_PIN_GROUP(vin1_data, 10),
+       BUS_DATA_PIN_GROUP(vin1_data, 12),
        SH_PFC_PIN_GROUP(vin1_sync),
        SH_PFC_PIN_GROUP(vin1_field),
        SH_PFC_PIN_GROUP(vin1_clkenb),
@@ -2496,8 +2434,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77970_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a77970_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = pin & 0x1f;
 
@@ -2656,7 +2593,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ }
 };
 
-static const struct sh_pfc_soc_operations pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77970_pfc_ops = {
        .pin_to_pocctrl = r8a77970_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -2664,7 +2601,7 @@ static const struct sh_pfc_soc_operations pinmux_ops = {
 
 const struct sh_pfc_soc_info r8a77970_pinmux_info = {
        .name = "r8a77970_pfc",
-       .ops = &pinmux_ops,
+       .ops = &r8a77970_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index c4825b0..c229a5d 100644 (file)
@@ -1365,30 +1365,14 @@ static const unsigned int intc_ex_irq5_mux[] = {
 };
 
 /* - MMC -------------------------------------------------------------------- */
-static const unsigned int mmc_data1_pins[] = {
-       /* MMC_D0 */
-       RCAR_GP_PIN(3, 8),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* MMC_D[0:3] */
-       RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
-       RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC_D0_MARK, MMC_D1_MARK,
-       MMC_D2_MARK, MMC_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* MMC_D[0:7] */
        RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
        RCAR_GP_PIN(3, 13), RCAR_GP_PIN(3, 14),
        RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK,
        MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK,
@@ -1687,22 +1671,6 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
-       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
-       RCAR_GP_PIN(5, 1), RCAR_GP_PIN(5, 2),
-       RCAR_GP_PIN(5, 3), RCAR_GP_PIN(5, 4),
-};
-static const unsigned int qspi0_data4_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-       QSPI0_IO2_MARK, QSPI0_IO3_MARK
-};
 
 /* - QSPI1 ------------------------------------------------------------------ */
 static const unsigned int qspi1_ctrl_pins[] = {
@@ -1712,36 +1680,14 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(5, 7), RCAR_GP_PIN(5, 8),
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
-       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
-       RCAR_GP_PIN(5, 7), RCAR_GP_PIN(5, 8),
-       RCAR_GP_PIN(5, 9), RCAR_GP_PIN(5, 10),
-};
-static const unsigned int qspi1_data4_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-       QSPI1_IO2_MARK, QSPI1_IO3_MARK
-};
 
 /* - RPC -------------------------------------------------------------------- */
-static const unsigned int rpc_clk1_pins[] = {
+static const unsigned int rpc_clk_pins[] = {
        /* Octal-SPI flash: C/SCLK */
-       RCAR_GP_PIN(5, 0),
-};
-static const unsigned int rpc_clk1_mux[] = {
-       QSPI0_SPCLK_MARK,
-};
-static const unsigned int rpc_clk2_pins[] = {
        /* HyperFlash: CK, CK# */
        RCAR_GP_PIN(5, 0), RCAR_GP_PIN(5, 6),
 };
-static const unsigned int rpc_clk2_mux[] = {
+static const unsigned int rpc_clk_mux[] = {
        QSPI0_SPCLK_MARK, QSPI1_SPCLK_MARK,
 };
 static const unsigned int rpc_ctrl_pins[] = {
@@ -1963,37 +1909,33 @@ static const unsigned int tpu_to3_mux[] = {
 };
 
 /* - VIN0 ------------------------------------------------------------------- */
-static const union vin_data vin0_data_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
-               RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
-               RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
-               RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
-               RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
-               RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
-               RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
-               RCAR_GP_PIN(2, 21), RCAR_GP_PIN(2, 22),
-               RCAR_GP_PIN(2, 23), RCAR_GP_PIN(2, 24),
-               RCAR_GP_PIN(2, 25), RCAR_GP_PIN(2, 26),
-               RCAR_GP_PIN(2, 27), RCAR_GP_PIN(2, 28),
-       },
+static const unsigned int vin0_data_pins[] = {
+       RCAR_GP_PIN(2, 4), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 9),
+       RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
+       RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
+       RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15),
+       RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
+       RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
+       RCAR_GP_PIN(2, 21), RCAR_GP_PIN(2, 22),
+       RCAR_GP_PIN(2, 23), RCAR_GP_PIN(2, 24),
+       RCAR_GP_PIN(2, 25), RCAR_GP_PIN(2, 26),
+       RCAR_GP_PIN(2, 27), RCAR_GP_PIN(2, 28),
 };
-static const union vin_data vin0_data_mux = {
-       .data24 = {
-               VI0_DATA0_MARK, VI0_DATA1_MARK,
-               VI0_DATA2_MARK, VI0_DATA3_MARK,
-               VI0_DATA4_MARK, VI0_DATA5_MARK,
-               VI0_DATA6_MARK, VI0_DATA7_MARK,
-               VI0_DATA8_MARK, VI0_DATA9_MARK,
-               VI0_DATA10_MARK, VI0_DATA11_MARK,
-               VI0_DATA12_MARK, VI0_DATA13_MARK,
-               VI0_DATA14_MARK, VI0_DATA15_MARK,
-               VI0_DATA16_MARK, VI0_DATA17_MARK,
-               VI0_DATA18_MARK, VI0_DATA19_MARK,
-               VI0_DATA20_MARK, VI0_DATA21_MARK,
-               VI0_DATA22_MARK, VI0_DATA23_MARK,
-       },
+static const unsigned int vin0_data_mux[] = {
+       VI0_DATA0_MARK, VI0_DATA1_MARK,
+       VI0_DATA2_MARK, VI0_DATA3_MARK,
+       VI0_DATA4_MARK, VI0_DATA5_MARK,
+       VI0_DATA6_MARK, VI0_DATA7_MARK,
+       VI0_DATA8_MARK, VI0_DATA9_MARK,
+       VI0_DATA10_MARK, VI0_DATA11_MARK,
+       VI0_DATA12_MARK, VI0_DATA13_MARK,
+       VI0_DATA14_MARK, VI0_DATA15_MARK,
+       VI0_DATA16_MARK, VI0_DATA17_MARK,
+       VI0_DATA18_MARK, VI0_DATA19_MARK,
+       VI0_DATA20_MARK, VI0_DATA21_MARK,
+       VI0_DATA22_MARK, VI0_DATA23_MARK,
 };
 static const unsigned int vin0_data18_pins[] = {
        RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 7),
@@ -2047,25 +1989,21 @@ static const unsigned int vin0_clk_mux[] = {
 };
 
 /* - VIN1 ------------------------------------------------------------------- */
-static const union vin_data12 vin1_data_pins = {
-       .data12 = {
-               RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
-               RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
-               RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
-               RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
-               RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
-               RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15),
-       },
+static const unsigned int vin1_data_pins[] = {
+       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
+       RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
+       RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
+       RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
+       RCAR_GP_PIN(3, 12), RCAR_GP_PIN(3, 13),
+       RCAR_GP_PIN(3, 14), RCAR_GP_PIN(3, 15),
 };
-static const union vin_data12 vin1_data_mux = {
-       .data12 = {
-               VI1_DATA0_MARK, VI1_DATA1_MARK,
-               VI1_DATA2_MARK, VI1_DATA3_MARK,
-               VI1_DATA4_MARK, VI1_DATA5_MARK,
-               VI1_DATA6_MARK, VI1_DATA7_MARK,
-               VI1_DATA8_MARK,  VI1_DATA9_MARK,
-               VI1_DATA10_MARK, VI1_DATA11_MARK,
-       },
+static const unsigned int vin1_data_mux[] = {
+       VI1_DATA0_MARK, VI1_DATA1_MARK,
+       VI1_DATA2_MARK, VI1_DATA3_MARK,
+       VI1_DATA4_MARK, VI1_DATA5_MARK,
+       VI1_DATA6_MARK, VI1_DATA7_MARK,
+       VI1_DATA8_MARK,  VI1_DATA9_MARK,
+       VI1_DATA10_MARK, VI1_DATA11_MARK,
 };
 static const unsigned int vin1_sync_pins[] = {
        /* VI1_VSYNC#, VI1_HSYNC# */
@@ -2156,9 +2094,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(intc_ex_irq3),
        SH_PFC_PIN_GROUP(intc_ex_irq4),
        SH_PFC_PIN_GROUP(intc_ex_irq5),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(mmc_cd),
        SH_PFC_PIN_GROUP(mmc_wp),
@@ -2198,13 +2136,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(pwm4_a),
        SH_PFC_PIN_GROUP(pwm4_b),
        SH_PFC_PIN_GROUP(qspi0_ctrl),
-       SH_PFC_PIN_GROUP(qspi0_data2),
-       SH_PFC_PIN_GROUP(qspi0_data4),
+       SH_PFC_PIN_GROUP_SUBSET(qspi0_data2, rpc_data, 0, 2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi0_data4, rpc_data, 0, 4),
        SH_PFC_PIN_GROUP(qspi1_ctrl),
-       SH_PFC_PIN_GROUP(qspi1_data2),
-       SH_PFC_PIN_GROUP(qspi1_data4),
-       SH_PFC_PIN_GROUP(rpc_clk1),
-       SH_PFC_PIN_GROUP(rpc_clk2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi1_data2, rpc_data, 4, 2),
+       SH_PFC_PIN_GROUP_SUBSET(qspi1_data4, rpc_data, 4, 4),
+       BUS_DATA_PIN_GROUP(rpc_clk, 1),
+       BUS_DATA_PIN_GROUP(rpc_clk, 2),
        SH_PFC_PIN_GROUP(rpc_ctrl),
        SH_PFC_PIN_GROUP(rpc_data),
        SH_PFC_PIN_GROUP(rpc_reset),
@@ -2233,20 +2171,20 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(tpu_to1),
        SH_PFC_PIN_GROUP(tpu_to2),
        SH_PFC_PIN_GROUP(tpu_to3),
-       VIN_DATA_PIN_GROUP(vin0_data, 8),
-       VIN_DATA_PIN_GROUP(vin0_data, 10),
-       VIN_DATA_PIN_GROUP(vin0_data, 12),
-       VIN_DATA_PIN_GROUP(vin0_data, 16),
+       BUS_DATA_PIN_GROUP(vin0_data, 8),
+       BUS_DATA_PIN_GROUP(vin0_data, 10),
+       BUS_DATA_PIN_GROUP(vin0_data, 12),
+       BUS_DATA_PIN_GROUP(vin0_data, 16),
        SH_PFC_PIN_GROUP(vin0_data18),
-       VIN_DATA_PIN_GROUP(vin0_data, 20),
-       VIN_DATA_PIN_GROUP(vin0_data, 24),
+       BUS_DATA_PIN_GROUP(vin0_data, 20),
+       BUS_DATA_PIN_GROUP(vin0_data, 24),
        SH_PFC_PIN_GROUP(vin0_sync),
        SH_PFC_PIN_GROUP(vin0_field),
        SH_PFC_PIN_GROUP(vin0_clkenb),
        SH_PFC_PIN_GROUP(vin0_clk),
-       VIN_DATA_PIN_GROUP(vin1_data, 8),
-       VIN_DATA_PIN_GROUP(vin1_data, 10),
-       VIN_DATA_PIN_GROUP(vin1_data, 12),
+       BUS_DATA_PIN_GROUP(vin1_data, 8),
+       BUS_DATA_PIN_GROUP(vin1_data, 10),
+       BUS_DATA_PIN_GROUP(vin1_data, 12),
        SH_PFC_PIN_GROUP(vin1_sync),
        SH_PFC_PIN_GROUP(vin1_field),
        SH_PFC_PIN_GROUP(vin1_clkenb),
@@ -2940,8 +2878,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77980_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a77980_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = pin & 0x1f;
 
@@ -3139,7 +3076,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ }
 };
 
-static const struct sh_pfc_soc_operations pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77980_pfc_ops = {
        .pin_to_pocctrl = r8a77980_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -3147,7 +3084,7 @@ static const struct sh_pfc_soc_operations pinmux_ops = {
 
 const struct sh_pfc_soc_info r8a77980_pinmux_info = {
        .name = "r8a77980_pfc",
-       .ops = &pinmux_ops,
+       .ops = &r8a77980_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index f44c7da..6c4ba9e 100644 (file)
@@ -2339,6 +2339,16 @@ static const unsigned int intc_ex_irq5_mux[] = {
        IRQ5_MARK,
 };
 
+#ifdef CONFIG_PINCTRL_PFC_R8A77990
+/* - MLB+ ------------------------------------------------------------------- */
+static const unsigned int mlb_3pin_pins[] = {
+       RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 18), RCAR_GP_PIN(5, 19),
+};
+static const unsigned int mlb_3pin_mux[] = {
+       MLB_CLK_MARK, MLB_SIG_MARK, MLB_DAT_MARK,
+};
+#endif /* CONFIG_PINCTRL_PFC_R8A77990 */
+
 /* - MSIOF0 ----------------------------------------------------------------- */
 static const unsigned int msiof0_clk_pins[] = {
        /* SCK */
@@ -2817,20 +2827,13 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
-       RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* QSPI0_MOSI_IO0, QSPI0_MISO_IO1 */
        RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
        /* QSPI0_IO2, QSPI0_IO3 */
        RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4),
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK,
 };
@@ -2842,20 +2845,13 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
-       RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* QSPI1_MOSI_IO0, QSPI1_MISO_IO1 */
        RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
        /* QSPI1_IO2, QSPI1_IO3 */
        RCAR_GP_PIN(2, 9), RCAR_GP_PIN(2, 10),
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK,
 };
@@ -3138,22 +3134,13 @@ static const unsigned int scif_clk_b_mux[] = {
 };
 
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-
-static const unsigned int sdhi0_data1_mux[] = {
-       SD0_DAT0_MARK,
-};
-
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
 };
 
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SD0_DAT0_MARK, SD0_DAT1_MARK,
        SD0_DAT2_MARK, SD0_DAT3_MARK,
 };
@@ -3186,22 +3173,13 @@ static const unsigned int sdhi0_wp_mux[] = {
 };
 
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 8),
-};
-
-static const unsigned int sdhi1_data1_mux[] = {
-       SD1_DAT0_MARK,
-};
-
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        RCAR_GP_PIN(3, 8),  RCAR_GP_PIN(3, 9),
        RCAR_GP_PIN(3, 10), RCAR_GP_PIN(3, 11),
 };
 
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SD1_DAT0_MARK, SD1_DAT1_MARK,
        SD1_DAT2_MARK, SD1_DAT3_MARK,
 };
@@ -3234,27 +3212,7 @@ static const unsigned int sdhi1_wp_mux[] = {
 };
 
 /* - SDHI3 ------------------------------------------------------------------ */
-static const unsigned int sdhi3_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(4, 2),
-};
-
-static const unsigned int sdhi3_data1_mux[] = {
-       SD3_DAT0_MARK,
-};
-
-static const unsigned int sdhi3_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
-       RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
-};
-
-static const unsigned int sdhi3_data4_mux[] = {
-       SD3_DAT0_MARK, SD3_DAT1_MARK,
-       SD3_DAT2_MARK, SD3_DAT3_MARK,
-};
-
-static const unsigned int sdhi3_data8_pins[] = {
+static const unsigned int sdhi3_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(4, 2), RCAR_GP_PIN(4, 3),
        RCAR_GP_PIN(4, 4), RCAR_GP_PIN(4, 5),
@@ -3262,7 +3220,7 @@ static const unsigned int sdhi3_data8_pins[] = {
        RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9),
 };
 
-static const unsigned int sdhi3_data8_mux[] = {
+static const unsigned int sdhi3_data_mux[] = {
        SD3_DAT0_MARK, SD3_DAT1_MARK,
        SD3_DAT2_MARK, SD3_DAT3_MARK,
        SD3_DAT4_MARK, SD3_DAT5_MARK,
@@ -3604,38 +3562,34 @@ static const unsigned int vin4_data18_a_mux[] = {
        VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
-static const union vin_data vin4_data_a_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 6),  RCAR_GP_PIN(2, 7),
-               RCAR_GP_PIN(2, 8),  RCAR_GP_PIN(2, 9),
-               RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
-               RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
-               RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(1, 3),  RCAR_GP_PIN(1, 10),
-               RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
-               RCAR_GP_PIN(1, 9),  RCAR_GP_PIN(1, 12),
-               RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
-               RCAR_GP_PIN(1, 19), RCAR_GP_PIN(0, 1),
-       },
+static const unsigned int vin4_data_a_pins[] = {
+       RCAR_GP_PIN(2, 6),  RCAR_GP_PIN(2, 7),
+       RCAR_GP_PIN(2, 8),  RCAR_GP_PIN(2, 9),
+       RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11),
+       RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13),
+       RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
+       RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
+       RCAR_GP_PIN(1, 3),  RCAR_GP_PIN(1, 10),
+       RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
+       RCAR_GP_PIN(1, 9),  RCAR_GP_PIN(1, 12),
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
+       RCAR_GP_PIN(1, 19), RCAR_GP_PIN(0, 1),
 };
 
-static const union vin_data vin4_data_a_mux = {
-       .data24 = {
-               VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
-               VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
-               VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
-               VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
-               VI4_DATA8_MARK,   VI4_DATA9_MARK,
-               VI4_DATA10_MARK,  VI4_DATA11_MARK,
-               VI4_DATA12_MARK,  VI4_DATA13_MARK,
-               VI4_DATA14_MARK,  VI4_DATA15_MARK,
-               VI4_DATA16_MARK,  VI4_DATA17_MARK,
-               VI4_DATA18_MARK,  VI4_DATA19_MARK,
-               VI4_DATA20_MARK,  VI4_DATA21_MARK,
-               VI4_DATA22_MARK,  VI4_DATA23_MARK,
-       },
+static const unsigned int vin4_data_a_mux[] = {
+       VI4_DATA0_A_MARK, VI4_DATA1_A_MARK,
+       VI4_DATA2_A_MARK, VI4_DATA3_A_MARK,
+       VI4_DATA4_A_MARK, VI4_DATA5_A_MARK,
+       VI4_DATA6_A_MARK, VI4_DATA7_A_MARK,
+       VI4_DATA8_MARK,   VI4_DATA9_MARK,
+       VI4_DATA10_MARK,  VI4_DATA11_MARK,
+       VI4_DATA12_MARK,  VI4_DATA13_MARK,
+       VI4_DATA14_MARK,  VI4_DATA15_MARK,
+       VI4_DATA16_MARK,  VI4_DATA17_MARK,
+       VI4_DATA18_MARK,  VI4_DATA19_MARK,
+       VI4_DATA20_MARK,  VI4_DATA21_MARK,
+       VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
 static const unsigned int vin4_data18_b_pins[] = {
@@ -3662,52 +3616,34 @@ static const unsigned int vin4_data18_b_mux[] = {
        VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
-static const union vin_data vin4_data_b_pins = {
-       .data24 = {
-               RCAR_GP_PIN(1, 8),  RCAR_GP_PIN(1, 11),
-               RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
-               RCAR_GP_PIN(0, 5),  RCAR_GP_PIN(0, 6),
-               RCAR_GP_PIN(0, 16), RCAR_GP_PIN(0, 17),
-               RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
-               RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
-               RCAR_GP_PIN(1, 3),  RCAR_GP_PIN(1, 10),
-               RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
-               RCAR_GP_PIN(1, 9),  RCAR_GP_PIN(1, 12),
-               RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
-               RCAR_GP_PIN(1, 19), RCAR_GP_PIN(0, 1),
-       },
-};
-
-static const union vin_data vin4_data_b_mux = {
-       .data24 = {
-               VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
-               VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
-               VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
-               VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
-               VI4_DATA8_MARK,   VI4_DATA9_MARK,
-               VI4_DATA10_MARK,  VI4_DATA11_MARK,
-               VI4_DATA12_MARK,  VI4_DATA13_MARK,
-               VI4_DATA14_MARK,  VI4_DATA15_MARK,
-               VI4_DATA16_MARK,  VI4_DATA17_MARK,
-               VI4_DATA18_MARK,  VI4_DATA19_MARK,
-               VI4_DATA20_MARK,  VI4_DATA21_MARK,
-               VI4_DATA22_MARK,  VI4_DATA23_MARK,
-       },
-};
-
-static const unsigned int vin4_g8_pins[] = {
+static const unsigned int vin4_data_b_pins[] = {
+       RCAR_GP_PIN(1, 8),  RCAR_GP_PIN(1, 11),
+       RCAR_GP_PIN(1, 21), RCAR_GP_PIN(1, 22),
+       RCAR_GP_PIN(0, 5),  RCAR_GP_PIN(0, 6),
+       RCAR_GP_PIN(0, 16), RCAR_GP_PIN(0, 17),
        RCAR_GP_PIN(1, 4),  RCAR_GP_PIN(1, 5),
        RCAR_GP_PIN(1, 6),  RCAR_GP_PIN(1, 7),
        RCAR_GP_PIN(1, 3),  RCAR_GP_PIN(1, 10),
        RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
+       RCAR_GP_PIN(1, 9),  RCAR_GP_PIN(1, 12),
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
+       RCAR_GP_PIN(1, 19), RCAR_GP_PIN(0, 1),
 };
 
-static const unsigned int vin4_g8_mux[] = {
-       VI4_DATA8_MARK,  VI4_DATA9_MARK,
-       VI4_DATA10_MARK, VI4_DATA11_MARK,
-       VI4_DATA12_MARK, VI4_DATA13_MARK,
-       VI4_DATA14_MARK, VI4_DATA15_MARK,
+static const unsigned int vin4_data_b_mux[] = {
+       VI4_DATA0_B_MARK, VI4_DATA1_B_MARK,
+       VI4_DATA2_B_MARK, VI4_DATA3_B_MARK,
+       VI4_DATA4_B_MARK, VI4_DATA5_B_MARK,
+       VI4_DATA6_B_MARK, VI4_DATA7_B_MARK,
+       VI4_DATA8_MARK,   VI4_DATA9_MARK,
+       VI4_DATA10_MARK,  VI4_DATA11_MARK,
+       VI4_DATA12_MARK,  VI4_DATA13_MARK,
+       VI4_DATA14_MARK,  VI4_DATA15_MARK,
+       VI4_DATA16_MARK,  VI4_DATA17_MARK,
+       VI4_DATA18_MARK,  VI4_DATA19_MARK,
+       VI4_DATA20_MARK,  VI4_DATA21_MARK,
+       VI4_DATA22_MARK,  VI4_DATA23_MARK,
 };
 
 static const unsigned int vin4_sync_pins[] = {
@@ -3744,30 +3680,26 @@ static const unsigned int vin4_clk_mux[] = {
 };
 
 /* - VIN5 ------------------------------------------------------------------- */
-static const union vin_data16 vin5_data_a_pins = {
-       .data16 = {
-               RCAR_GP_PIN(1, 1),  RCAR_GP_PIN(1, 2),
-               RCAR_GP_PIN(1, 19), RCAR_GP_PIN(1, 12),
-               RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
-               RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
-               RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-               RCAR_GP_PIN(0, 9),  RCAR_GP_PIN(0, 11),
-               RCAR_GP_PIN(0, 8),  RCAR_GP_PIN(0, 10),
-               RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 3),
-       },
+static const unsigned int vin5_data_a_pins[] = {
+       RCAR_GP_PIN(1, 1),  RCAR_GP_PIN(1, 2),
+       RCAR_GP_PIN(1, 19), RCAR_GP_PIN(1, 12),
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
+       RCAR_GP_PIN(1, 17), RCAR_GP_PIN(1, 18),
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+       RCAR_GP_PIN(0, 9),  RCAR_GP_PIN(0, 11),
+       RCAR_GP_PIN(0, 8),  RCAR_GP_PIN(0, 10),
+       RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 3),
 };
 
-static const union vin_data16 vin5_data_a_mux = {
-       .data16 = {
-               VI5_DATA0_A_MARK,  VI5_DATA1_A_MARK,
-               VI5_DATA2_A_MARK,  VI5_DATA3_A_MARK,
-               VI5_DATA4_A_MARK,  VI5_DATA5_A_MARK,
-               VI5_DATA6_A_MARK,  VI5_DATA7_A_MARK,
-               VI5_DATA8_A_MARK,  VI5_DATA9_A_MARK,
-               VI5_DATA10_A_MARK, VI5_DATA11_A_MARK,
-               VI5_DATA12_A_MARK, VI5_DATA13_A_MARK,
-               VI5_DATA14_A_MARK, VI5_DATA15_A_MARK,
-       },
+static const unsigned int vin5_data_a_mux[] = {
+       VI5_DATA0_A_MARK,  VI5_DATA1_A_MARK,
+       VI5_DATA2_A_MARK,  VI5_DATA3_A_MARK,
+       VI5_DATA4_A_MARK,  VI5_DATA5_A_MARK,
+       VI5_DATA6_A_MARK,  VI5_DATA7_A_MARK,
+       VI5_DATA8_A_MARK,  VI5_DATA9_A_MARK,
+       VI5_DATA10_A_MARK, VI5_DATA11_A_MARK,
+       VI5_DATA12_A_MARK, VI5_DATA13_A_MARK,
+       VI5_DATA14_A_MARK, VI5_DATA15_A_MARK,
 };
 
 static const unsigned int vin5_data8_b_pins[] = {
@@ -3784,20 +3716,6 @@ static const unsigned int vin5_data8_b_mux[] = {
        VI5_DATA6_B_MARK,  VI5_DATA7_B_MARK,
 };
 
-static const unsigned int vin5_high8_pins[] = {
-       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
-       RCAR_GP_PIN(0, 9),  RCAR_GP_PIN(0, 11),
-       RCAR_GP_PIN(0, 8),  RCAR_GP_PIN(0, 10),
-       RCAR_GP_PIN(0, 2),  RCAR_GP_PIN(0, 3),
-};
-
-static const unsigned int vin5_high8_mux[] = {
-       VI5_DATA8_A_MARK,  VI5_DATA9_A_MARK,
-       VI5_DATA10_A_MARK, VI5_DATA11_A_MARK,
-       VI5_DATA12_A_MARK, VI5_DATA13_A_MARK,
-       VI5_DATA14_A_MARK, VI5_DATA15_A_MARK,
-};
-
 static const unsigned int vin5_sync_a_pins[] = {
        /* HSYNC_N, VSYNC_N */
        RCAR_GP_PIN(1, 8), RCAR_GP_PIN(1, 9),
@@ -3842,7 +3760,7 @@ static const unsigned int vin5_clk_b_mux[] = {
 static const struct {
        struct sh_pfc_pin_group common[255];
 #ifdef CONFIG_PINCTRL_PFC_R8A77990
-       struct sh_pfc_pin_group automotive[21];
+       struct sh_pfc_pin_group automotive[22];
 #endif
 } pinmux_groups = {
        .common = {
@@ -3989,11 +3907,11 @@ static const struct {
                SH_PFC_PIN_GROUP(pwm6_a),
                SH_PFC_PIN_GROUP(pwm6_b),
                SH_PFC_PIN_GROUP(qspi0_ctrl),
-               SH_PFC_PIN_GROUP(qspi0_data2),
-               SH_PFC_PIN_GROUP(qspi0_data4),
+               BUS_DATA_PIN_GROUP(qspi0_data, 2),
+               BUS_DATA_PIN_GROUP(qspi0_data, 4),
                SH_PFC_PIN_GROUP(qspi1_ctrl),
-               SH_PFC_PIN_GROUP(qspi1_data2),
-               SH_PFC_PIN_GROUP(qspi1_data4),
+               BUS_DATA_PIN_GROUP(qspi1_data, 2),
+               BUS_DATA_PIN_GROUP(qspi1_data, 4),
                SH_PFC_PIN_GROUP(scif0_data_a),
                SH_PFC_PIN_GROUP(scif0_clk_a),
                SH_PFC_PIN_GROUP(scif0_ctrl_a),
@@ -4024,19 +3942,19 @@ static const struct {
                SH_PFC_PIN_GROUP(scif5_data_c),
                SH_PFC_PIN_GROUP(scif_clk_a),
                SH_PFC_PIN_GROUP(scif_clk_b),
-               SH_PFC_PIN_GROUP(sdhi0_data1),
-               SH_PFC_PIN_GROUP(sdhi0_data4),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi0_data, 4),
                SH_PFC_PIN_GROUP(sdhi0_ctrl),
                SH_PFC_PIN_GROUP(sdhi0_cd),
                SH_PFC_PIN_GROUP(sdhi0_wp),
-               SH_PFC_PIN_GROUP(sdhi1_data1),
-               SH_PFC_PIN_GROUP(sdhi1_data4),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi1_data, 4),
                SH_PFC_PIN_GROUP(sdhi1_ctrl),
                SH_PFC_PIN_GROUP(sdhi1_cd),
                SH_PFC_PIN_GROUP(sdhi1_wp),
-               SH_PFC_PIN_GROUP(sdhi3_data1),
-               SH_PFC_PIN_GROUP(sdhi3_data4),
-               SH_PFC_PIN_GROUP(sdhi3_data8),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 1),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 4),
+               BUS_DATA_PIN_GROUP(sdhi3_data, 8),
                SH_PFC_PIN_GROUP(sdhi3_ctrl),
                SH_PFC_PIN_GROUP(sdhi3_cd),
                SH_PFC_PIN_GROUP(sdhi3_wp),
@@ -4071,31 +3989,31 @@ static const struct {
                SH_PFC_PIN_GROUP(usb0_id),
                SH_PFC_PIN_GROUP(usb30),
                SH_PFC_PIN_GROUP(usb30_id),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _a),
                SH_PFC_PIN_GROUP(vin4_data18_a),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _a),
-               VIN_DATA_PIN_GROUP(vin4_data, 8, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 10, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 12, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 16, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _a),
+               BUS_DATA_PIN_GROUP(vin4_data, 8, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 10, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 12, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 16, _b),
                SH_PFC_PIN_GROUP(vin4_data18_b),
-               VIN_DATA_PIN_GROUP(vin4_data, 20, _b),
-               VIN_DATA_PIN_GROUP(vin4_data, 24, _b),
-               SH_PFC_PIN_GROUP(vin4_g8),
+               BUS_DATA_PIN_GROUP(vin4_data, 20, _b),
+               BUS_DATA_PIN_GROUP(vin4_data, 24, _b),
+               SH_PFC_PIN_GROUP_SUBSET(vin4_g8, vin4_data_a, 8, 8),
                SH_PFC_PIN_GROUP(vin4_sync),
                SH_PFC_PIN_GROUP(vin4_field),
                SH_PFC_PIN_GROUP(vin4_clkenb),
                SH_PFC_PIN_GROUP(vin4_clk),
-               VIN_DATA_PIN_GROUP(vin5_data, 8, _a),
-               VIN_DATA_PIN_GROUP(vin5_data, 10, _a),
-               VIN_DATA_PIN_GROUP(vin5_data, 12, _a),
-               VIN_DATA_PIN_GROUP(vin5_data, 16, _a),
+               BUS_DATA_PIN_GROUP(vin5_data, 8, _a),
+               BUS_DATA_PIN_GROUP(vin5_data, 10, _a),
+               BUS_DATA_PIN_GROUP(vin5_data, 12, _a),
+               BUS_DATA_PIN_GROUP(vin5_data, 16, _a),
                SH_PFC_PIN_GROUP(vin5_data8_b),
-               SH_PFC_PIN_GROUP(vin5_high8),
+               SH_PFC_PIN_GROUP_SUBSET(vin5_high8, vin5_data_a, 8, 8),
                SH_PFC_PIN_GROUP(vin5_sync_a),
                SH_PFC_PIN_GROUP(vin5_field_a),
                SH_PFC_PIN_GROUP(vin5_clkenb_a),
@@ -4125,6 +4043,7 @@ static const struct {
                SH_PFC_PIN_GROUP(drif3_ctrl_b),
                SH_PFC_PIN_GROUP(drif3_data0_b),
                SH_PFC_PIN_GROUP(drif3_data1_b),
+               SH_PFC_PIN_GROUP(mlb_3pin),
        }
 #endif /* CONFIG_PINCTRL_PFC_R8A77990 */
 };
@@ -4315,6 +4234,12 @@ static const char * const intc_ex_groups[] = {
        "intc_ex_irq5",
 };
 
+#ifdef CONFIG_PINCTRL_PFC_R8A77990
+static const char * const mlb_3pin_groups[] = {
+       "mlb_3pin",
+};
+#endif /* CONFIG_PINCTRL_PFC_R8A77990 */
+
 static const char * const msiof0_groups[] = {
        "msiof0_clk",
        "msiof0_sync",
@@ -4569,7 +4494,7 @@ static const char * const vin5_groups[] = {
 static const struct {
        struct sh_pfc_function common[49];
 #ifdef CONFIG_PINCTRL_PFC_R8A77990
-       struct sh_pfc_function automotive[4];
+       struct sh_pfc_function automotive[5];
 #endif
 } pinmux_functions = {
        .common = {
@@ -4629,6 +4554,7 @@ static const struct {
                SH_PFC_FUNCTION(drif1),
                SH_PFC_FUNCTION(drif2),
                SH_PFC_FUNCTION(drif3),
+               SH_PFC_FUNCTION(mlb_3pin),
        }
 #endif /* CONFIG_PINCTRL_PFC_R8A77990 */
 };
@@ -5115,8 +5041,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a77990_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a77990_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -5339,7 +5264,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations r8a77990_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77990_pfc_ops = {
        .pin_to_pocctrl = r8a77990_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -5348,7 +5273,7 @@ static const struct sh_pfc_soc_operations r8a77990_pinmux_ops = {
 #ifdef CONFIG_PINCTRL_PFC_R8A774C0
 const struct sh_pfc_soc_info r8a774c0_pinmux_info = {
        .name = "r8a774c0_pfc",
-       .ops = &r8a77990_pinmux_ops,
+       .ops = &r8a77990_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
@@ -5372,7 +5297,7 @@ const struct sh_pfc_soc_info r8a774c0_pinmux_info = {
 #ifdef CONFIG_PINCTRL_PFC_R8A77990
 const struct sh_pfc_soc_info r8a77990_pinmux_info = {
        .name = "r8a77990_pfc",
-       .ops = &r8a77990_pinmux_ops,
+       .ops = &r8a77990_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index c56e1e4..445c903 100644 (file)
@@ -1257,31 +1257,23 @@ static const unsigned int i2c3_b_mux[] = {
        SCL3_B_MARK, SDA3_B_MARK,
 };
 
-/* - MMC ------------------------------------------------------------------- */
-static const unsigned int mmc_data1_pins[] = {
-       /* D0 */
-       RCAR_GP_PIN(3, 2),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* D[0:3] */
-       RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
-       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
+/* - MLB+ ------------------------------------------------------------------- */
+static const unsigned int mlb_3pin_pins[] = {
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 8), RCAR_GP_PIN(0, 7),
 };
-static const unsigned int mmc_data4_mux[] = {
-       MMC_D0_MARK, MMC_D1_MARK,
-       MMC_D2_MARK, MMC_D3_MARK,
+static const unsigned int mlb_3pin_mux[] = {
+       MLB_CLK_MARK, MLB_SIG_MARK, MLB_DAT_MARK,
 };
-static const unsigned int mmc_data8_pins[] = {
+
+/* - MMC ------------------------------------------------------------------- */
+static const unsigned int mmc_data_pins[] = {
        /* D[0:7] */
        RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 3),
        RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 5),
        RCAR_GP_PIN(3, 6), RCAR_GP_PIN(3, 7),
        RCAR_GP_PIN(3, 8), RCAR_GP_PIN(3, 9),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_D0_MARK, MMC_D1_MARK,
        MMC_D2_MARK, MMC_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK,
@@ -1950,37 +1942,33 @@ static const unsigned int vin4_data18_mux[] = {
        VI4_DATA20_MARK, VI4_DATA21_MARK,
        VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
-static const union vin_data vin4_data_pins = {
-       .data24 = {
-               RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
-               RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4),
-               RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6),
-               RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
-               RCAR_GP_PIN(2, 9), RCAR_GP_PIN(2, 10),
-               RCAR_GP_PIN(2, 11), RCAR_GP_PIN(2, 12),
-               RCAR_GP_PIN(2, 13), RCAR_GP_PIN(2, 14),
-               RCAR_GP_PIN(2, 15), RCAR_GP_PIN(2, 16),
-               RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
-               RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
-               RCAR_GP_PIN(2, 21), RCAR_GP_PIN(2, 22),
-               RCAR_GP_PIN(2, 23), RCAR_GP_PIN(2, 24),
-       },
+static const unsigned int vin4_data_pins[] = {
+       RCAR_GP_PIN(2, 1), RCAR_GP_PIN(2, 2),
+       RCAR_GP_PIN(2, 3), RCAR_GP_PIN(2, 4),
+       RCAR_GP_PIN(2, 5), RCAR_GP_PIN(2, 6),
+       RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 8),
+       RCAR_GP_PIN(2, 9), RCAR_GP_PIN(2, 10),
+       RCAR_GP_PIN(2, 11), RCAR_GP_PIN(2, 12),
+       RCAR_GP_PIN(2, 13), RCAR_GP_PIN(2, 14),
+       RCAR_GP_PIN(2, 15), RCAR_GP_PIN(2, 16),
+       RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 18),
+       RCAR_GP_PIN(2, 19), RCAR_GP_PIN(2, 20),
+       RCAR_GP_PIN(2, 21), RCAR_GP_PIN(2, 22),
+       RCAR_GP_PIN(2, 23), RCAR_GP_PIN(2, 24),
 };
-static const union vin_data vin4_data_mux = {
-       .data24 = {
-               VI4_DATA0_MARK, VI4_DATA1_MARK,
-               VI4_DATA2_MARK, VI4_DATA3_MARK,
-               VI4_DATA4_MARK, VI4_DATA5_MARK,
-               VI4_DATA6_MARK, VI4_DATA7_MARK,
-               VI4_DATA8_MARK,  VI4_DATA9_MARK,
-               VI4_DATA10_MARK, VI4_DATA11_MARK,
-               VI4_DATA12_MARK, VI4_DATA13_MARK,
-               VI4_DATA14_MARK, VI4_DATA15_MARK,
-               VI4_DATA16_MARK, VI4_DATA17_MARK,
-               VI4_DATA18_MARK, VI4_DATA19_MARK,
-               VI4_DATA20_MARK, VI4_DATA21_MARK,
-               VI4_DATA22_MARK, VI4_DATA23_MARK,
-       },
+static const unsigned int vin4_data_mux[] = {
+       VI4_DATA0_MARK, VI4_DATA1_MARK,
+       VI4_DATA2_MARK, VI4_DATA3_MARK,
+       VI4_DATA4_MARK, VI4_DATA5_MARK,
+       VI4_DATA6_MARK, VI4_DATA7_MARK,
+       VI4_DATA8_MARK,  VI4_DATA9_MARK,
+       VI4_DATA10_MARK, VI4_DATA11_MARK,
+       VI4_DATA12_MARK, VI4_DATA13_MARK,
+       VI4_DATA14_MARK, VI4_DATA15_MARK,
+       VI4_DATA16_MARK, VI4_DATA17_MARK,
+       VI4_DATA18_MARK, VI4_DATA19_MARK,
+       VI4_DATA20_MARK, VI4_DATA21_MARK,
+       VI4_DATA22_MARK, VI4_DATA23_MARK,
 };
 static const unsigned int vin4_sync_pins[] = {
        /* HSYNC#, VSYNC# */
@@ -2049,9 +2037,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(i2c2_b),
        SH_PFC_PIN_GROUP(i2c3_a),
        SH_PFC_PIN_GROUP(i2c3_b),
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       SH_PFC_PIN_GROUP(mlb_3pin),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(msiof0_clk),
        SH_PFC_PIN_GROUP(msiof0_sync),
@@ -2128,13 +2117,13 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(ssi4_ctrl_b),
        SH_PFC_PIN_GROUP(ssi4_data_b),
        SH_PFC_PIN_GROUP(usb0),
-       VIN_DATA_PIN_GROUP(vin4_data, 8),
-       VIN_DATA_PIN_GROUP(vin4_data, 10),
-       VIN_DATA_PIN_GROUP(vin4_data, 12),
-       VIN_DATA_PIN_GROUP(vin4_data, 16),
+       BUS_DATA_PIN_GROUP(vin4_data, 8),
+       BUS_DATA_PIN_GROUP(vin4_data, 10),
+       BUS_DATA_PIN_GROUP(vin4_data, 12),
+       BUS_DATA_PIN_GROUP(vin4_data, 16),
        SH_PFC_PIN_GROUP(vin4_data18),
-       VIN_DATA_PIN_GROUP(vin4_data, 20),
-       VIN_DATA_PIN_GROUP(vin4_data, 24),
+       BUS_DATA_PIN_GROUP(vin4_data, 20),
+       BUS_DATA_PIN_GROUP(vin4_data, 24),
        SH_PFC_PIN_GROUP(vin4_sync),
        SH_PFC_PIN_GROUP(vin4_field),
        SH_PFC_PIN_GROUP(vin4_clkenb),
@@ -2210,6 +2199,10 @@ static const char * const i2c3_groups[] = {
        "i2c3_b",
 };
 
+static const char * const mlb_3pin_groups[] = {
+       "mlb_3pin",
+};
+
 static const char * const mmc_groups[] = {
        "mmc_data1",
        "mmc_data4",
@@ -2217,6 +2210,49 @@ static const char * const mmc_groups[] = {
        "mmc_ctrl",
 };
 
+static const char * const msiof0_groups[] = {
+       "msiof0_clk",
+       "msiof0_sync",
+       "msiof0_ss1",
+       "msiof0_ss2",
+       "msiof0_txd",
+       "msiof0_rxd",
+};
+
+static const char * const msiof1_groups[] = {
+       "msiof1_clk",
+       "msiof1_sync",
+       "msiof1_ss1",
+       "msiof1_ss2",
+       "msiof1_txd",
+       "msiof1_rxd",
+};
+
+static const char * const msiof2_groups[] = {
+       "msiof2_clk",
+       "msiof2_sync_a",
+       "msiof2_sync_b",
+       "msiof2_ss1",
+       "msiof2_ss2",
+       "msiof2_txd",
+       "msiof2_rxd",
+};
+
+static const char * const msiof3_groups[] = {
+       "msiof3_clk_a",
+       "msiof3_sync_a",
+       "msiof3_ss1_a",
+       "msiof3_ss2_a",
+       "msiof3_txd_a",
+       "msiof3_rxd_a",
+       "msiof3_clk_b",
+       "msiof3_sync_b",
+       "msiof3_ss1_b",
+       "msiof3_ss2_b",
+       "msiof3_txd_b",
+       "msiof3_rxd_b",
+};
+
 static const char * const pwm0_groups[] = {
        "pwm0_a",
        "pwm0_b",
@@ -2314,49 +2350,6 @@ static const char * const vin4_groups[] = {
        "vin4_clk",
 };
 
-static const char * const msiof0_groups[] = {
-       "msiof0_clk",
-       "msiof0_sync",
-       "msiof0_ss1",
-       "msiof0_ss2",
-       "msiof0_txd",
-       "msiof0_rxd",
-};
-
-static const char * const msiof1_groups[] = {
-       "msiof1_clk",
-       "msiof1_sync",
-       "msiof1_ss1",
-       "msiof1_ss2",
-       "msiof1_txd",
-       "msiof1_rxd",
-};
-
-static const char * const msiof2_groups[] = {
-       "msiof2_clk",
-       "msiof2_sync_a",
-       "msiof2_sync_b",
-       "msiof2_ss1",
-       "msiof2_ss2",
-       "msiof2_txd",
-       "msiof2_rxd",
-};
-
-static const char * const msiof3_groups[] = {
-       "msiof3_clk_a",
-       "msiof3_sync_a",
-       "msiof3_ss1_a",
-       "msiof3_ss2_a",
-       "msiof3_txd_a",
-       "msiof3_rxd_a",
-       "msiof3_clk_b",
-       "msiof3_sync_b",
-       "msiof3_ss1_b",
-       "msiof3_ss2_b",
-       "msiof3_txd_b",
-       "msiof3_rxd_b",
-};
-
 static const struct sh_pfc_function pinmux_functions[] = {
        SH_PFC_FUNCTION(audio_clk),
        SH_PFC_FUNCTION(avb0),
@@ -2370,6 +2363,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
        SH_PFC_FUNCTION(i2c1),
        SH_PFC_FUNCTION(i2c2),
        SH_PFC_FUNCTION(i2c3),
+       SH_PFC_FUNCTION(mlb_3pin),
        SH_PFC_FUNCTION(mmc),
        SH_PFC_FUNCTION(msiof0),
        SH_PFC_FUNCTION(msiof1),
@@ -2842,7 +2836,7 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
        { },
 };
 
-static int r8a77995_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl)
+static int r8a77995_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = -EINVAL;
 
@@ -3078,7 +3072,7 @@ r8a77995_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin,
        const struct pinmux_bias_reg *reg;
        unsigned int bit;
 
-       reg = rcar_pin_to_bias_reg(pfc, pin, &bit);
+       reg = rcar_pin_to_bias_reg(pfc->info, pin, &bit);
        if (!reg)
                return reg;
 
@@ -3144,7 +3138,7 @@ static void r8a77995_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
        sh_pfc_write(pfc, reg->puen, enable);
 }
 
-static const struct sh_pfc_soc_operations r8a77995_pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a77995_pfc_ops = {
        .pin_to_pocctrl = r8a77995_pin_to_pocctrl,
        .get_bias = r8a77995_pinmux_get_bias,
        .set_bias = r8a77995_pinmux_set_bias,
@@ -3152,7 +3146,7 @@ static const struct sh_pfc_soc_operations r8a77995_pinmux_ops = {
 
 const struct sh_pfc_soc_info r8a77995_pinmux_info = {
        .name = "r8a77995_pfc",
-       .ops = &r8a77995_pinmux_ops,
+       .ops = &r8a77995_pfc_ops,
        .unlock_reg = 0xe6060000, /* PMMR */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
index 8358038..4a668a0 100644 (file)
@@ -576,23 +576,23 @@ FM(IP0SR5_27_24)  IP0SR5_27_24    FM(IP1SR5_27_24)        IP1SR5_27_24    FM(IP2SR5_27_24)        IP2
 FM(IP0SR5_31_28)       IP0SR5_31_28    FM(IP1SR5_31_28)        IP1SR5_31_28    FM(IP2SR5_31_28)        IP2SR5_31_28
 
 /* MOD_SEL2 */                 /* 0 */         /* 1 */         /* 2 */         /* 3 */
-#define MOD_SEL2_14_15         FM(SEL_I2C6_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C6_3)
-#define MOD_SEL2_12_13         FM(SEL_I2C5_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C5_3)
-#define MOD_SEL2_10_11         FM(SEL_I2C4_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C4_3)
-#define MOD_SEL2_8_9           FM(SEL_I2C3_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C3_3)
-#define MOD_SEL2_6_7           FM(SEL_I2C2_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C2_3)
-#define MOD_SEL2_4_5           FM(SEL_I2C1_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C1_3)
-#define MOD_SEL2_2_3           FM(SEL_I2C0_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C0_3)
+#define MOD_SEL2_15_14         FM(SEL_I2C6_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C6_3)
+#define MOD_SEL2_13_12         FM(SEL_I2C5_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C5_3)
+#define MOD_SEL2_11_10         FM(SEL_I2C4_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C4_3)
+#define MOD_SEL2_9_8           FM(SEL_I2C3_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C3_3)
+#define MOD_SEL2_7_6           FM(SEL_I2C2_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C2_3)
+#define MOD_SEL2_5_4           FM(SEL_I2C1_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C1_3)
+#define MOD_SEL2_3_2           FM(SEL_I2C0_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C0_3)
 
 #define PINMUX_MOD_SELS \
 \
-MOD_SEL2_14_15 \
-MOD_SEL2_12_13 \
-MOD_SEL2_10_11 \
-MOD_SEL2_8_9 \
-MOD_SEL2_6_7 \
-MOD_SEL2_4_5 \
-MOD_SEL2_2_3
+MOD_SEL2_15_14 \
+MOD_SEL2_13_12 \
+MOD_SEL2_11_10 \
+MOD_SEL2_9_8 \
+MOD_SEL2_7_6 \
+MOD_SEL2_5_4 \
+MOD_SEL2_3_2
 
 #define PINMUX_PHYS \
        FM(SCL0) FM(SDA0) FM(SCL1) FM(SDA1) FM(SCL2) FM(SDA2) FM(SCL3) FM(SDA3) \
@@ -2009,30 +2009,14 @@ static const unsigned int intc_ex_irq5_mux[] = {
 };
 
 /* - MMC -------------------------------------------------------------------- */
-static const unsigned int mmc_data1_pins[] = {
-       /* MMC_SD_D0 */
-       RCAR_GP_PIN(0, 19),
-};
-static const unsigned int mmc_data1_mux[] = {
-       MMC_SD_D0_MARK,
-};
-static const unsigned int mmc_data4_pins[] = {
-       /* MMC_SD_D[0:3] */
-       RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20),
-       RCAR_GP_PIN(0, 21), RCAR_GP_PIN(0, 22),
-};
-static const unsigned int mmc_data4_mux[] = {
-       MMC_SD_D0_MARK, MMC_SD_D1_MARK,
-       MMC_SD_D2_MARK, MMC_SD_D3_MARK,
-};
-static const unsigned int mmc_data8_pins[] = {
+static const unsigned int mmc_data_pins[] = {
        /* MMC_SD_D[0:3], MMC_D[4:7] */
        RCAR_GP_PIN(0, 19), RCAR_GP_PIN(0, 20),
        RCAR_GP_PIN(0, 21), RCAR_GP_PIN(0, 22),
        RCAR_GP_PIN(0, 24), RCAR_GP_PIN(0, 25),
        RCAR_GP_PIN(0, 26), RCAR_GP_PIN(0, 27),
 };
-static const unsigned int mmc_data8_mux[] = {
+static const unsigned int mmc_data_mux[] = {
        MMC_SD_D0_MARK, MMC_SD_D1_MARK,
        MMC_SD_D2_MARK, MMC_SD_D3_MARK,
        MMC_D4_MARK, MMC_D5_MARK,
@@ -2384,19 +2368,12 @@ static const unsigned int qspi0_ctrl_pins[] = {
 static const unsigned int qspi0_ctrl_mux[] = {
        QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
 };
-static const unsigned int qspi0_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(0, 1), RCAR_GP_PIN(0, 2),
-};
-static const unsigned int qspi0_data2_mux[] = {
-       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
-};
-static const unsigned int qspi0_data4_pins[] = {
+static const unsigned int qspi0_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(0, 1), RCAR_GP_PIN(0, 2),
        RCAR_GP_PIN(0, 3), RCAR_GP_PIN(0, 4),
 };
-static const unsigned int qspi0_data4_mux[] = {
+static const unsigned int qspi0_data_mux[] = {
        QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
        QSPI0_IO2_MARK, QSPI0_IO3_MARK
 };
@@ -2409,19 +2386,12 @@ static const unsigned int qspi1_ctrl_pins[] = {
 static const unsigned int qspi1_ctrl_mux[] = {
        QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
 };
-static const unsigned int qspi1_data2_pins[] = {
-       /* MOSI_IO0, MISO_IO1 */
-       RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 8),
-};
-static const unsigned int qspi1_data2_mux[] = {
-       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
-};
-static const unsigned int qspi1_data4_pins[] = {
+static const unsigned int qspi1_data_pins[] = {
        /* MOSI_IO0, MISO_IO1, IO2, IO3 */
        RCAR_GP_PIN(0, 7), RCAR_GP_PIN(0, 8),
        RCAR_GP_PIN(0, 9), RCAR_GP_PIN(0, 10),
 };
-static const unsigned int qspi1_data4_mux[] = {
+static const unsigned int qspi1_data_mux[] = {
        QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
        QSPI1_IO2_MARK, QSPI1_IO3_MARK
 };
@@ -2715,9 +2685,9 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(intc_ex_irq4),
        SH_PFC_PIN_GROUP(intc_ex_irq5),
 
-       SH_PFC_PIN_GROUP(mmc_data1),
-       SH_PFC_PIN_GROUP(mmc_data4),
-       SH_PFC_PIN_GROUP(mmc_data8),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
        SH_PFC_PIN_GROUP(mmc_ctrl),
        SH_PFC_PIN_GROUP(mmc_cd),
        SH_PFC_PIN_GROUP(mmc_wp),
@@ -2767,11 +2737,11 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(pwm4),
 
        SH_PFC_PIN_GROUP(qspi0_ctrl),
-       SH_PFC_PIN_GROUP(qspi0_data2),
-       SH_PFC_PIN_GROUP(qspi0_data4),
+       BUS_DATA_PIN_GROUP(qspi0_data, 2),
+       BUS_DATA_PIN_GROUP(qspi0_data, 4),
        SH_PFC_PIN_GROUP(qspi1_ctrl),
-       SH_PFC_PIN_GROUP(qspi1_data2),
-       SH_PFC_PIN_GROUP(qspi1_data4),
+       BUS_DATA_PIN_GROUP(qspi1_data, 2),
+       BUS_DATA_PIN_GROUP(qspi1_data, 4),
 
        SH_PFC_PIN_GROUP(scif0_data),
        SH_PFC_PIN_GROUP(scif0_clk),
@@ -3696,13 +3666,13 @@ static const struct pinmux_cfg_reg pinmux_config_regs[] = {
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                /* RESERVED 19, 18, 17, 16 */
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-               MOD_SEL2_14_15
-               MOD_SEL2_12_13
-               MOD_SEL2_10_11
-               MOD_SEL2_8_9
-               MOD_SEL2_6_7
-               MOD_SEL2_4_5
-               MOD_SEL2_2_3
+               MOD_SEL2_15_14
+               MOD_SEL2_13_12
+               MOD_SEL2_11_10
+               MOD_SEL2_9_8
+               MOD_SEL2_7_6
+               MOD_SEL2_5_4
+               MOD_SEL2_3_2
                0, 0,
                0, 0, ))
        },
@@ -4041,8 +4011,7 @@ static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
        { /* sentinel */ },
 };
 
-static int r8a779a0_pin_to_pocctrl(struct sh_pfc *pfc, unsigned int pin,
-                                  u32 *pocctrl)
+static int r8a779a0_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
 {
        int bit = pin & 0x1f;
 
@@ -4429,7 +4398,7 @@ static const struct pinmux_bias_reg pinmux_bias_regs[] = {
        { /* sentinel */ },
 };
 
-static const struct sh_pfc_soc_operations pinmux_ops = {
+static const struct sh_pfc_soc_operations r8a779a0_pfc_ops = {
        .pin_to_pocctrl = r8a779a0_pin_to_pocctrl,
        .get_bias = rcar_pinmux_get_bias,
        .set_bias = rcar_pinmux_set_bias,
@@ -4437,7 +4406,7 @@ static const struct sh_pfc_soc_operations pinmux_ops = {
 
 const struct sh_pfc_soc_info r8a779a0_pinmux_info = {
        .name = "r8a779a0_pfc",
-       .ops = &pinmux_ops,
+       .ops = &r8a779a0_pfc_ops,
        .unlock_reg = 0x1ff,    /* PMMRn mask */
 
        .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
diff --git a/drivers/pinctrl/renesas/pfc-r8a779f0.c b/drivers/pinctrl/renesas/pfc-r8a779f0.c
new file mode 100644 (file)
index 0000000..9186060
--- /dev/null
@@ -0,0 +1,2126 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * R8A779F0 processor support - PFC hardware block.
+ *
+ * Copyright (C) 2021 Renesas Electronics Corp.
+ *
+ * This file is based on the drivers/pinctrl/renesas/pfc-r8a779a0.c
+ */
+
+#include <linux/errno.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+
+#include "sh_pfc.h"
+
+#define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN)
+
+#define CPU_ALL_GP(fn, sfx)    \
+       PORT_GP_CFG_21(0, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33),        \
+       PORT_GP_CFG_25(1, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33),        \
+       PORT_GP_CFG_17(2, fn, sfx, CFG_FLAGS),  \
+       PORT_GP_CFG_19(3, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33)
+
+#define CPU_ALL_NOGP(fn)                                                               \
+       PIN_NOGP_CFG(PRESETOUT0_N, "PRESETOUT0#", fn, SH_PFC_PIN_CFG_PULL_DOWN),        \
+       PIN_NOGP_CFG(EXTALR, "EXTALR", fn, SH_PFC_PIN_CFG_PULL_UP_DOWN)
+
+/*
+ * F_() : just information
+ * FM() : macro for FN_xxx / xxx_MARK
+ */
+
+/* GPSR0 */
+#define GPSR0_20       F_(IRQ3,        IP2SR0_19_16)
+#define GPSR0_19       F_(IRQ2,        IP2SR0_15_12)
+#define GPSR0_18       F_(IRQ1,        IP2SR0_11_8)
+#define GPSR0_17       F_(IRQ0,        IP2SR0_7_4)
+#define GPSR0_16       F_(MSIOF0_SS2,  IP2SR0_3_0)
+#define GPSR0_15       F_(MSIOF0_SS1,  IP1SR0_31_28)
+#define GPSR0_14       F_(MSIOF0_SCK,  IP1SR0_27_24)
+#define GPSR0_13       F_(MSIOF0_TXD,  IP1SR0_23_20)
+#define GPSR0_12       F_(MSIOF0_RXD,  IP1SR0_19_16)
+#define GPSR0_11       F_(MSIOF0_SYNC, IP1SR0_15_12)
+#define GPSR0_10       F_(CTS0_N,      IP1SR0_11_8)
+#define GPSR0_9                F_(RTS0_N,      IP1SR0_7_4)
+#define GPSR0_8                F_(SCK0,        IP1SR0_3_0)
+#define GPSR0_7                F_(TX0,         IP0SR0_31_28)
+#define GPSR0_6                F_(RX0,         IP0SR0_27_24)
+#define GPSR0_5                F_(HRTS0_N,     IP0SR0_23_20)
+#define GPSR0_4                F_(HCTS0_N,     IP0SR0_19_16)
+#define GPSR0_3                F_(HTX0,        IP0SR0_15_12)
+#define GPSR0_2                F_(HRX0,        IP0SR0_11_8)
+#define GPSR0_1                F_(HSCK0,       IP0SR0_7_4)
+#define GPSR0_0                F_(SCIF_CLK,    IP0SR0_3_0)
+
+/* GPSR1 */
+#define GPSR1_24       FM(SD_WP)
+#define GPSR1_23       FM(SD_CD)
+#define GPSR1_22       FM(MMC_SD_CMD)
+#define GPSR1_21       FM(MMC_D7)
+#define GPSR1_20       FM(MMC_DS)
+#define GPSR1_19       FM(MMC_D6)
+#define GPSR1_18       FM(MMC_D4)
+#define GPSR1_17       FM(MMC_D5)
+#define GPSR1_16       FM(MMC_SD_D3)
+#define GPSR1_15       FM(MMC_SD_D2)
+#define GPSR1_14       FM(MMC_SD_D1)
+#define GPSR1_13       FM(MMC_SD_D0)
+#define GPSR1_12       FM(MMC_SD_CLK)
+#define GPSR1_11       FM(GP1_11)
+#define GPSR1_10       FM(GP1_10)
+#define GPSR1_9                FM(GP1_09)
+#define GPSR1_8                FM(GP1_08)
+#define GPSR1_7                F_(GP1_07,      IP0SR1_31_28)
+#define GPSR1_6                F_(GP1_06,      IP0SR1_27_24)
+#define GPSR1_5                F_(GP1_05,      IP0SR1_23_20)
+#define GPSR1_4                F_(GP1_04,      IP0SR1_19_16)
+#define GPSR1_3                F_(GP1_03,      IP0SR1_15_12)
+#define GPSR1_2                F_(GP1_02,      IP0SR1_11_8)
+#define GPSR1_1                F_(GP1_01,      IP0SR1_7_4)
+#define GPSR1_0                F_(GP1_00,      IP0SR1_3_0)
+
+/* GPSR2 */
+#define GPSR2_16       FM(PCIE1_CLKREQ_N)
+#define GPSR2_15       FM(PCIE0_CLKREQ_N)
+#define GPSR2_14       FM(QSPI0_IO3)
+#define GPSR2_13       FM(QSPI0_SSL)
+#define GPSR2_12       FM(QSPI0_MISO_IO1)
+#define GPSR2_11       FM(QSPI0_IO2)
+#define GPSR2_10       FM(QSPI0_SPCLK)
+#define GPSR2_9                FM(QSPI0_MOSI_IO0)
+#define GPSR2_8                FM(QSPI1_SPCLK)
+#define GPSR2_7                FM(QSPI1_MOSI_IO0)
+#define GPSR2_6                FM(QSPI1_IO2)
+#define GPSR2_5                FM(QSPI1_MISO_IO1)
+#define GPSR2_4                FM(QSPI1_IO3)
+#define GPSR2_3                FM(QSPI1_SSL)
+#define GPSR2_2                FM(RPC_RESET_N)
+#define GPSR2_1                FM(RPC_WP_N)
+#define GPSR2_0                FM(RPC_INT_N)
+
+/* GPSR3 */
+#define GPSR3_18       FM(TSN0_AVTP_CAPTURE_B)
+#define GPSR3_17       FM(TSN0_AVTP_MATCH_B)
+#define GPSR3_16       FM(TSN0_AVTP_PPS)
+#define GPSR3_15       FM(TSN1_AVTP_CAPTURE_B)
+#define GPSR3_14       FM(TSN1_AVTP_MATCH_B)
+#define GPSR3_13       FM(TSN1_AVTP_PPS)
+#define GPSR3_12       FM(TSN0_MAGIC_B)
+#define GPSR3_11       FM(TSN1_PHY_INT_B)
+#define GPSR3_10       FM(TSN0_PHY_INT_B)
+#define GPSR3_9                FM(TSN2_PHY_INT_B)
+#define GPSR3_8                FM(TSN0_LINK_B)
+#define GPSR3_7                FM(TSN2_LINK_B)
+#define GPSR3_6                FM(TSN1_LINK_B)
+#define GPSR3_5                FM(TSN1_MDC_B)
+#define GPSR3_4                FM(TSN0_MDC_B)
+#define GPSR3_3                FM(TSN2_MDC_B)
+#define GPSR3_2                FM(TSN0_MDIO_B)
+#define GPSR3_1                FM(TSN2_MDIO_B)
+#define GPSR3_0                FM(TSN1_MDIO_B)
+
+/* IP0SR0 */           /* 0 */                 /* 1 */                 /* 2 */                 /* 3 */                 /* 4 */         /* 5 */                 /* 6 */                 /* 7 - F */
+#define IP0SR0_3_0     FM(SCIF_CLK)            F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_7_4     FM(HSCK0)               FM(SCK3)                FM(MSIOF3_SCK)          F_(0, 0)                F_(0, 0)        FM(TSN0_AVTP_CAPTURE_A) F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_11_8    FM(HRX0)                FM(RX3)                 FM(MSIOF3_RXD)          F_(0, 0)                F_(0, 0)        FM(TSN0_AVTP_MATCH_A)   F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_15_12   FM(HTX0)                FM(TX3)                 FM(MSIOF3_TXD)          F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_19_16   FM(HCTS0_N)             FM(CTS3_N)              FM(MSIOF3_SS1)          F_(0, 0)                F_(0, 0)        FM(TSN0_MDC_A)          F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_23_20   FM(HRTS0_N)             FM(RTS3_N)              FM(MSIOF3_SS2)          F_(0, 0)                F_(0, 0)        FM(TSN0_MDIO_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_27_24   FM(RX0)                 FM(HRX1)                F_(0, 0)                FM(MSIOF1_RXD)          F_(0, 0)        FM(TSN1_AVTP_MATCH_A)   F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR0_31_28   FM(TX0)                 FM(HTX1)                F_(0, 0)                FM(MSIOF1_TXD)          F_(0, 0)        FM(TSN1_AVTP_CAPTURE_A) F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+/* IP1SR0 */           /* 0 */                 /* 1 */                 /* 2 */                 /* 3 */                 /* 4 */         /* 5 */                 /* 6 */                 /* 7 - F */
+#define IP1SR0_3_0     FM(SCK0)                FM(HSCK1)               F_(0, 0)                FM(MSIOF1_SCK)          F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_7_4     FM(RTS0_N)              FM(HRTS1_N)             FM(MSIOF3_SYNC)         F_(0, 0)                F_(0, 0)        FM(TSN1_MDIO_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_11_8    FM(CTS0_N)              FM(HCTS1_N)             F_(0, 0)                FM(MSIOF1_SYNC)         F_(0, 0)        FM(TSN1_MDC_A)          F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_15_12   FM(MSIOF0_SYNC)         FM(HCTS3_N)             FM(CTS1_N)              FM(IRQ4)                F_(0, 0)        FM(TSN0_LINK_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_19_16   FM(MSIOF0_RXD)          FM(HRX3)                FM(RX1)                 F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_23_20   FM(MSIOF0_TXD)          FM(HTX3)                FM(TX1)                 F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_27_24   FM(MSIOF0_SCK)          FM(HSCK3)               FM(SCK1)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP1SR0_31_28   FM(MSIOF0_SS1)          FM(HRTS3_N)             FM(RTS1_N)              FM(IRQ5)                F_(0, 0)        FM(TSN1_LINK_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+/* IP2SR0 */           /* 0 */                 /* 1 */                 /* 2 */                 /* 3 */                 /* 4 */         /* 5 */                 /* 6 */                 /* 7 - F */
+#define IP2SR0_3_0     FM(MSIOF0_SS2)          F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        FM(TSN2_LINK_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_7_4     FM(IRQ0)                F_(0, 0)                F_(0, 0)                FM(MSIOF1_SS1)          F_(0, 0)        FM(TSN0_MAGIC_A)        F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_11_8    FM(IRQ1)                F_(0, 0)                F_(0, 0)                FM(MSIOF1_SS2)          F_(0, 0)        FM(TSN0_PHY_INT_A)      F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_15_12   FM(IRQ2)                F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        FM(TSN1_PHY_INT_A)      F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_19_16   FM(IRQ3)                F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        FM(TSN2_PHY_INT_A)      F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_23_20   F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_27_24   F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP2SR0_31_28   F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+
+/* IP0SR1 */           /* 0 */                 /* 1 */                 /* 2 */                 /* 3 */                 /* 4 */         /* 5 */                 /* 6 */                 /* 7 - F */
+#define IP0SR1_3_0     FM(GP1_00)              FM(TCLK1)               FM(HSCK2)               F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_7_4     FM(GP1_01)              FM(TCLK4)               FM(HRX2)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_11_8    FM(GP1_02)              F_(0, 0)                FM(HTX2)                FM(MSIOF2_SS1)          F_(0, 0)        FM(TSN2_MDC_A)          F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_15_12   FM(GP1_03)              FM(TCLK2)               FM(HCTS2_N)             FM(MSIOF2_SS2)          FM(CTS4_N)      FM(TSN2_MDIO_A)         F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_19_16   FM(GP1_04)              FM(TCLK3)               FM(HRTS2_N)             FM(MSIOF2_SYNC)         FM(RTS4_N)      F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_23_20   FM(GP1_05)              FM(MSIOF2_SCK)          FM(SCK4)                F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_27_24   FM(GP1_06)              FM(MSIOF2_RXD)          FM(RX4)                 F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+#define IP0SR1_31_28   FM(GP1_07)              FM(MSIOF2_TXD)          FM(TX4)                 F_(0, 0)                F_(0, 0)        F_(0, 0)                F_(0, 0)                F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0)
+
+#define PINMUX_GPSR    \
+               GPSR1_24                                        \
+               GPSR1_23                                        \
+               GPSR1_22                                        \
+               GPSR1_21                                        \
+GPSR0_20       GPSR1_20                                        \
+GPSR0_19       GPSR1_19                                        \
+GPSR0_18       GPSR1_18                        GPSR3_18        \
+GPSR0_17       GPSR1_17                        GPSR3_17        \
+GPSR0_16       GPSR1_16        GPSR2_16        GPSR3_16        \
+GPSR0_15       GPSR1_15        GPSR2_15        GPSR3_15        \
+GPSR0_14       GPSR1_14        GPSR2_14        GPSR3_14        \
+GPSR0_13       GPSR1_13        GPSR2_13        GPSR3_13        \
+GPSR0_12       GPSR1_12        GPSR2_12        GPSR3_12        \
+GPSR0_11       GPSR1_11        GPSR2_11        GPSR3_11        \
+GPSR0_10       GPSR1_10        GPSR2_10        GPSR3_10        \
+GPSR0_9                GPSR1_9         GPSR2_9         GPSR3_9         \
+GPSR0_8                GPSR1_8         GPSR2_8         GPSR3_8         \
+GPSR0_7                GPSR1_7         GPSR2_7         GPSR3_7         \
+GPSR0_6                GPSR1_6         GPSR2_6         GPSR3_6         \
+GPSR0_5                GPSR1_5         GPSR2_5         GPSR3_5         \
+GPSR0_4                GPSR1_4         GPSR2_4         GPSR3_4         \
+GPSR0_3                GPSR1_3         GPSR2_3         GPSR3_3         \
+GPSR0_2                GPSR1_2         GPSR2_2         GPSR3_2         \
+GPSR0_1                GPSR1_1         GPSR2_1         GPSR3_1         \
+GPSR0_0                GPSR1_0         GPSR2_0         GPSR3_0
+
+#define PINMUX_IPSR    \
+\
+FM(IP0SR0_3_0)         IP0SR0_3_0      FM(IP1SR0_3_0)          IP1SR0_3_0      FM(IP2SR0_3_0)          IP2SR0_3_0      \
+FM(IP0SR0_7_4)         IP0SR0_7_4      FM(IP1SR0_7_4)          IP1SR0_7_4      FM(IP2SR0_7_4)          IP2SR0_7_4      \
+FM(IP0SR0_11_8)                IP0SR0_11_8     FM(IP1SR0_11_8)         IP1SR0_11_8     FM(IP2SR0_11_8)         IP2SR0_11_8     \
+FM(IP0SR0_15_12)       IP0SR0_15_12    FM(IP1SR0_15_12)        IP1SR0_15_12    FM(IP2SR0_15_12)        IP2SR0_15_12    \
+FM(IP0SR0_19_16)       IP0SR0_19_16    FM(IP1SR0_19_16)        IP1SR0_19_16    FM(IP2SR0_19_16)        IP2SR0_19_16    \
+FM(IP0SR0_23_20)       IP0SR0_23_20    FM(IP1SR0_23_20)        IP1SR0_23_20    FM(IP2SR0_23_20)        IP2SR0_23_20    \
+FM(IP0SR0_27_24)       IP0SR0_27_24    FM(IP1SR0_27_24)        IP1SR0_27_24    FM(IP2SR0_27_24)        IP2SR0_27_24    \
+FM(IP0SR0_31_28)       IP0SR0_31_28    FM(IP1SR0_31_28)        IP1SR0_31_28    FM(IP2SR0_31_28)        IP2SR0_31_28    \
+\
+FM(IP0SR1_3_0)         IP0SR1_3_0      \
+FM(IP0SR1_7_4)         IP0SR1_7_4      \
+FM(IP0SR1_11_8)                IP0SR1_11_8     \
+FM(IP0SR1_15_12)       IP0SR1_15_12    \
+FM(IP0SR1_19_16)       IP0SR1_19_16    \
+FM(IP0SR1_23_20)       IP0SR1_23_20    \
+FM(IP0SR1_27_24)       IP0SR1_27_24    \
+FM(IP0SR1_31_28)       IP0SR1_31_28
+
+/* MOD_SEL1 */                 /* 0 */         /* 1 */         /* 2 */         /* 3 */
+#define MOD_SEL1_11_10         FM(SEL_I2C5_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C5_3)
+#define MOD_SEL1_9_8           FM(SEL_I2C4_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C4_3)
+#define MOD_SEL1_7_6           FM(SEL_I2C3_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C3_3)
+#define MOD_SEL1_5_4           FM(SEL_I2C2_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C2_3)
+#define MOD_SEL1_3_2           FM(SEL_I2C1_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C1_3)
+#define MOD_SEL1_1_0           FM(SEL_I2C0_0)  F_(0, 0)        F_(0, 0)        FM(SEL_I2C0_3)
+
+#define PINMUX_MOD_SELS \
+\
+MOD_SEL1_11_10 \
+MOD_SEL1_9_8 \
+MOD_SEL1_7_6 \
+MOD_SEL1_5_4 \
+MOD_SEL1_3_2 \
+MOD_SEL1_1_0
+
+#define PINMUX_PHYS \
+       FM(SCL0) FM(SDA0) FM(SCL1) FM(SDA1) FM(SCL2) FM(SDA2) FM(SCL3) FM(SDA3) \
+       FM(SCL4) FM(SDA4) FM(SCL5) FM(SDA5)
+
+enum {
+       PINMUX_RESERVED = 0,
+
+       PINMUX_DATA_BEGIN,
+       GP_ALL(DATA),
+       PINMUX_DATA_END,
+
+#define F_(x, y)
+#define FM(x)   FN_##x,
+       PINMUX_FUNCTION_BEGIN,
+       GP_ALL(FN),
+       PINMUX_GPSR
+       PINMUX_IPSR
+       PINMUX_MOD_SELS
+       PINMUX_FUNCTION_END,
+#undef F_
+#undef FM
+
+#define F_(x, y)
+#define FM(x)  x##_MARK,
+       PINMUX_MARK_BEGIN,
+       PINMUX_GPSR
+       PINMUX_IPSR
+       PINMUX_MOD_SELS
+       PINMUX_PHYS
+       PINMUX_MARK_END,
+#undef F_
+#undef FM
+};
+
+static const u16 pinmux_data[] = {
+       PINMUX_DATA_GP_ALL(),
+
+       PINMUX_SINGLE(SD_WP),
+       PINMUX_SINGLE(SD_CD),
+       PINMUX_SINGLE(MMC_SD_CMD),
+       PINMUX_SINGLE(MMC_D7),
+       PINMUX_SINGLE(MMC_DS),
+       PINMUX_SINGLE(MMC_D6),
+       PINMUX_SINGLE(MMC_D4),
+       PINMUX_SINGLE(MMC_D5),
+       PINMUX_SINGLE(MMC_SD_D3),
+       PINMUX_SINGLE(MMC_SD_D2),
+       PINMUX_SINGLE(MMC_SD_D1),
+       PINMUX_SINGLE(MMC_SD_D0),
+       PINMUX_SINGLE(MMC_SD_CLK),
+       PINMUX_SINGLE(PCIE1_CLKREQ_N),
+       PINMUX_SINGLE(PCIE0_CLKREQ_N),
+       PINMUX_SINGLE(QSPI0_IO3),
+       PINMUX_SINGLE(QSPI0_SSL),
+       PINMUX_SINGLE(QSPI0_MISO_IO1),
+       PINMUX_SINGLE(QSPI0_IO2),
+       PINMUX_SINGLE(QSPI0_SPCLK),
+       PINMUX_SINGLE(QSPI0_MOSI_IO0),
+       PINMUX_SINGLE(QSPI1_SPCLK),
+       PINMUX_SINGLE(QSPI1_MOSI_IO0),
+       PINMUX_SINGLE(QSPI1_IO2),
+       PINMUX_SINGLE(QSPI1_MISO_IO1),
+       PINMUX_SINGLE(QSPI1_IO3),
+       PINMUX_SINGLE(QSPI1_SSL),
+       PINMUX_SINGLE(RPC_RESET_N),
+       PINMUX_SINGLE(RPC_WP_N),
+       PINMUX_SINGLE(RPC_INT_N),
+
+       PINMUX_SINGLE(TSN0_AVTP_CAPTURE_B),
+       PINMUX_SINGLE(TSN0_AVTP_MATCH_B),
+       PINMUX_SINGLE(TSN0_AVTP_PPS),
+       PINMUX_SINGLE(TSN1_AVTP_CAPTURE_B),
+       PINMUX_SINGLE(TSN1_AVTP_MATCH_B),
+       PINMUX_SINGLE(TSN1_AVTP_PPS),
+       PINMUX_SINGLE(TSN0_MAGIC_B),
+       PINMUX_SINGLE(TSN1_PHY_INT_B),
+       PINMUX_SINGLE(TSN0_PHY_INT_B),
+       PINMUX_SINGLE(TSN2_PHY_INT_B),
+       PINMUX_SINGLE(TSN0_LINK_B),
+       PINMUX_SINGLE(TSN2_LINK_B),
+       PINMUX_SINGLE(TSN1_LINK_B),
+       PINMUX_SINGLE(TSN1_MDC_B),
+       PINMUX_SINGLE(TSN0_MDC_B),
+       PINMUX_SINGLE(TSN2_MDC_B),
+       PINMUX_SINGLE(TSN0_MDIO_B),
+       PINMUX_SINGLE(TSN2_MDIO_B),
+       PINMUX_SINGLE(TSN1_MDIO_B),
+
+       /* IP0SR0 */
+       PINMUX_IPSR_GPSR(IP0SR0_3_0,    SCIF_CLK),
+
+       PINMUX_IPSR_GPSR(IP0SR0_7_4,    HSCK0),
+       PINMUX_IPSR_GPSR(IP0SR0_7_4,    SCK3),
+       PINMUX_IPSR_GPSR(IP0SR0_7_4,    MSIOF3_SCK),
+       PINMUX_IPSR_GPSR(IP0SR0_7_4,    TSN0_AVTP_CAPTURE_A),
+
+       PINMUX_IPSR_GPSR(IP0SR0_11_8,   HRX0),
+       PINMUX_IPSR_GPSR(IP0SR0_11_8,   RX3),
+       PINMUX_IPSR_GPSR(IP0SR0_11_8,   MSIOF3_RXD),
+       PINMUX_IPSR_GPSR(IP0SR0_11_8,   TSN0_AVTP_MATCH_A),
+
+       PINMUX_IPSR_GPSR(IP0SR0_15_12,  HTX0),
+       PINMUX_IPSR_GPSR(IP0SR0_15_12,  TX3),
+       PINMUX_IPSR_GPSR(IP0SR0_15_12,  MSIOF3_TXD),
+
+       PINMUX_IPSR_GPSR(IP0SR0_19_16,  HCTS0_N),
+       PINMUX_IPSR_GPSR(IP0SR0_19_16,  CTS3_N),
+       PINMUX_IPSR_GPSR(IP0SR0_19_16,  MSIOF3_SS1),
+       PINMUX_IPSR_GPSR(IP0SR0_19_16,  TSN0_MDC_A),
+
+       PINMUX_IPSR_GPSR(IP0SR0_23_20,  HRTS0_N),
+       PINMUX_IPSR_GPSR(IP0SR0_23_20,  RTS3_N),
+       PINMUX_IPSR_GPSR(IP0SR0_23_20,  MSIOF3_SS2),
+       PINMUX_IPSR_GPSR(IP0SR0_23_20,  TSN0_MDIO_A),
+
+       PINMUX_IPSR_GPSR(IP0SR0_27_24,  RX0),
+       PINMUX_IPSR_GPSR(IP0SR0_27_24,  HRX1),
+       PINMUX_IPSR_GPSR(IP0SR0_27_24,  MSIOF1_RXD),
+       PINMUX_IPSR_GPSR(IP0SR0_27_24,  TSN1_AVTP_MATCH_A),
+
+       PINMUX_IPSR_GPSR(IP0SR0_31_28,  TX0),
+       PINMUX_IPSR_GPSR(IP0SR0_31_28,  HTX1),
+       PINMUX_IPSR_GPSR(IP0SR0_31_28,  MSIOF1_TXD),
+       PINMUX_IPSR_GPSR(IP0SR0_31_28,  TSN1_AVTP_CAPTURE_A),
+
+       /* IP1SR0 */
+       PINMUX_IPSR_GPSR(IP1SR0_3_0,    SCK0),
+       PINMUX_IPSR_GPSR(IP1SR0_3_0,    HSCK1),
+       PINMUX_IPSR_GPSR(IP1SR0_3_0,    MSIOF1_SCK),
+
+       PINMUX_IPSR_GPSR(IP1SR0_7_4,    RTS0_N),
+       PINMUX_IPSR_GPSR(IP1SR0_7_4,    HRTS1_N),
+       PINMUX_IPSR_GPSR(IP1SR0_7_4,    MSIOF3_SYNC),
+       PINMUX_IPSR_GPSR(IP1SR0_7_4,    TSN1_MDIO_A),
+
+       PINMUX_IPSR_GPSR(IP1SR0_11_8,   CTS0_N),
+       PINMUX_IPSR_GPSR(IP1SR0_11_8,   HCTS1_N),
+       PINMUX_IPSR_GPSR(IP1SR0_11_8,   MSIOF1_SYNC),
+       PINMUX_IPSR_GPSR(IP1SR0_11_8,   TSN1_MDC_A),
+
+       PINMUX_IPSR_GPSR(IP1SR0_15_12,  MSIOF0_SYNC),
+       PINMUX_IPSR_GPSR(IP1SR0_15_12,  HCTS3_N),
+       PINMUX_IPSR_GPSR(IP1SR0_15_12,  CTS1_N),
+       PINMUX_IPSR_GPSR(IP1SR0_15_12,  IRQ4),
+       PINMUX_IPSR_GPSR(IP1SR0_15_12,  TSN0_LINK_A),
+
+       PINMUX_IPSR_GPSR(IP1SR0_19_16,  MSIOF0_RXD),
+       PINMUX_IPSR_GPSR(IP1SR0_19_16,  HRX3),
+       PINMUX_IPSR_GPSR(IP1SR0_19_16,  RX1),
+
+       PINMUX_IPSR_GPSR(IP1SR0_23_20,  MSIOF0_TXD),
+       PINMUX_IPSR_GPSR(IP1SR0_23_20,  HTX3),
+       PINMUX_IPSR_GPSR(IP1SR0_23_20,  TX1),
+
+       PINMUX_IPSR_GPSR(IP1SR0_27_24,  MSIOF0_SCK),
+       PINMUX_IPSR_GPSR(IP1SR0_27_24,  HSCK3),
+       PINMUX_IPSR_GPSR(IP1SR0_27_24,  SCK1),
+
+       PINMUX_IPSR_GPSR(IP1SR0_31_28,  MSIOF0_SS1),
+       PINMUX_IPSR_GPSR(IP1SR0_31_28,  HRTS3_N),
+       PINMUX_IPSR_GPSR(IP1SR0_31_28,  RTS1_N),
+       PINMUX_IPSR_GPSR(IP1SR0_31_28,  IRQ5),
+       PINMUX_IPSR_GPSR(IP1SR0_31_28,  TSN1_LINK_A),
+
+       /* IP2SR0 */
+       PINMUX_IPSR_GPSR(IP2SR0_3_0,    MSIOF0_SS2),
+       PINMUX_IPSR_GPSR(IP2SR0_3_0,    TSN2_LINK_A),
+
+       PINMUX_IPSR_GPSR(IP2SR0_7_4,    IRQ0),
+       PINMUX_IPSR_GPSR(IP2SR0_7_4,    MSIOF1_SS1),
+       PINMUX_IPSR_GPSR(IP2SR0_7_4,    TSN0_MAGIC_A),
+
+       PINMUX_IPSR_GPSR(IP2SR0_11_8,   IRQ1),
+       PINMUX_IPSR_GPSR(IP2SR0_11_8,   MSIOF1_SS2),
+       PINMUX_IPSR_GPSR(IP2SR0_11_8,   TSN0_PHY_INT_A),
+
+       PINMUX_IPSR_GPSR(IP2SR0_15_12,  IRQ2),
+       PINMUX_IPSR_GPSR(IP2SR0_15_12,  TSN1_PHY_INT_A),
+
+       PINMUX_IPSR_GPSR(IP2SR0_19_16,  IRQ3),
+       PINMUX_IPSR_GPSR(IP2SR0_19_16,  TSN2_PHY_INT_A),
+
+       /* IP0SR1 */
+       /* GP1_00 = SCL0 */
+       PINMUX_IPSR_MSEL(IP0SR1_3_0,    GP1_00,         SEL_I2C0_0),
+       PINMUX_IPSR_MSEL(IP0SR1_3_0,    TCLK1,          SEL_I2C0_0),
+       PINMUX_IPSR_MSEL(IP0SR1_3_0,    HSCK2,          SEL_I2C0_0),
+       PINMUX_IPSR_PHYS(IP0SR1_3_0,    SCL0,           SEL_I2C0_3),
+
+       /* GP1_01 = SDA0 */
+       PINMUX_IPSR_MSEL(IP0SR1_7_4,    GP1_01,         SEL_I2C0_0),
+       PINMUX_IPSR_MSEL(IP0SR1_7_4,    TCLK4,          SEL_I2C0_0),
+       PINMUX_IPSR_MSEL(IP0SR1_7_4,    HRX2,           SEL_I2C0_0),
+       PINMUX_IPSR_PHYS(IP0SR1_7_4,    SDA0,           SEL_I2C0_3),
+
+       /* GP1_02 = SCL1 */
+       PINMUX_IPSR_MSEL(IP0SR1_11_8,   GP1_02,         SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_11_8,   HTX2,           SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_11_8,   MSIOF2_SS1,     SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_11_8,   TSN2_MDC_A,     SEL_I2C1_0),
+       PINMUX_IPSR_PHYS(IP0SR1_11_8,   SCL1,           SEL_I2C1_3),
+
+       /* GP1_03 = SDA1 */
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  GP1_03,         SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  TCLK2,          SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  HCTS2_N,        SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  MSIOF2_SS2,     SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  CTS4_N,         SEL_I2C1_0),
+       PINMUX_IPSR_MSEL(IP0SR1_15_12,  TSN2_MDIO_A,    SEL_I2C1_0),
+       PINMUX_IPSR_PHYS(IP0SR1_15_12,  SDA1,           SEL_I2C1_3),
+
+       /* GP1_04 = SCL2 */
+       PINMUX_IPSR_MSEL(IP0SR1_19_16,  GP1_04,         SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_19_16,  TCLK3,          SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_19_16,  HRTS2_N,        SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_19_16,  MSIOF2_SYNC,    SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_19_16,  RTS4_N,         SEL_I2C2_0),
+       PINMUX_IPSR_PHYS(IP0SR1_19_16,  SCL2,           SEL_I2C2_3),
+
+       /* GP1_05 = SDA2 */
+       PINMUX_IPSR_MSEL(IP0SR1_23_20,  GP1_05,         SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_23_20,  MSIOF2_SCK,     SEL_I2C2_0),
+       PINMUX_IPSR_MSEL(IP0SR1_23_20,  SCK4,           SEL_I2C2_0),
+       PINMUX_IPSR_PHYS(IP0SR1_23_20,  SDA2,           SEL_I2C2_3),
+
+       /* GP1_06 = SCL3 */
+       PINMUX_IPSR_MSEL(IP0SR1_27_24,  GP1_06,         SEL_I2C3_0),
+       PINMUX_IPSR_MSEL(IP0SR1_27_24,  MSIOF2_RXD,     SEL_I2C3_0),
+       PINMUX_IPSR_MSEL(IP0SR1_27_24,  RX4,            SEL_I2C3_0),
+       PINMUX_IPSR_PHYS(IP0SR1_27_24,  SCL3,           SEL_I2C3_3),
+
+       /* GP1_07 = SDA3 */
+       PINMUX_IPSR_MSEL(IP0SR1_31_28,  GP1_07,         SEL_I2C3_0),
+       PINMUX_IPSR_MSEL(IP0SR1_31_28,  MSIOF2_TXD,     SEL_I2C3_0),
+       PINMUX_IPSR_MSEL(IP0SR1_31_28,  TX4,            SEL_I2C3_0),
+       PINMUX_IPSR_PHYS(IP0SR1_31_28,  SDA3,           SEL_I2C3_3),
+
+       /* GP1_08 = SCL4 */
+       PINMUX_IPSR_NOGM(0,             GP1_08,         SEL_I2C4_0),
+       PINMUX_IPSR_NOFN(GP1_08,        SCL4,           SEL_I2C4_3),
+
+       /* GP1_09 = SDA4 */
+       PINMUX_IPSR_NOGM(0,             GP1_09,         SEL_I2C4_0),
+       PINMUX_IPSR_NOFN(GP1_09,        SDA4,           SEL_I2C4_3),
+
+       /* GP1_10 = SCL5 */
+       PINMUX_IPSR_NOGM(0,             GP1_10,         SEL_I2C5_0),
+       PINMUX_IPSR_NOFN(GP1_10,        SCL5,           SEL_I2C5_3),
+
+       /* GP1_11 = SDA5 */
+       PINMUX_IPSR_NOGM(0,             GP1_11,         SEL_I2C5_0),
+       PINMUX_IPSR_NOFN(GP1_11,        SDA5,           SEL_I2C5_3),
+};
+
+/*
+ * Pins not associated with a GPIO port.
+ */
+enum {
+       GP_ASSIGN_LAST(),
+       NOGP_ALL(),
+};
+
+static const struct sh_pfc_pin pinmux_pins[] = {
+       PINMUX_GPIO_GP_ALL(),
+};
+
+/* - HSCIF0 ----------------------------------------------------------------- */
+static const unsigned int hscif0_data_pins[] = {
+       /* HRX0, HTX0 */
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+};
+static const unsigned int hscif0_data_mux[] = {
+       HRX0_MARK, HTX0_MARK,
+};
+static const unsigned int hscif0_clk_pins[] = {
+       /* HSCK0 */
+       RCAR_GP_PIN(0, 1),
+};
+static const unsigned int hscif0_clk_mux[] = {
+       HSCK0_MARK,
+};
+static const unsigned int hscif0_ctrl_pins[] = {
+       /* HRTS0#, HCTS0# */
+       RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 4),
+};
+static const unsigned int hscif0_ctrl_mux[] = {
+       HRTS0_N_MARK, HCTS0_N_MARK,
+};
+
+/* - HSCIF1 ----------------------------------------------------------------- */
+static const unsigned int hscif1_data_pins[] = {
+       /* HRX1, HTX1 */
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
+};
+static const unsigned int hscif1_data_mux[] = {
+       HRX1_MARK, HTX1_MARK,
+};
+static const unsigned int hscif1_clk_pins[] = {
+       /* HSCK1 */
+       RCAR_GP_PIN(0, 8),
+};
+static const unsigned int hscif1_clk_mux[] = {
+       HSCK1_MARK,
+};
+static const unsigned int hscif1_ctrl_pins[] = {
+       /* HRTS1#, HCTS1# */
+       RCAR_GP_PIN(0, 9), RCAR_GP_PIN(0, 10),
+};
+static const unsigned int hscif1_ctrl_mux[] = {
+       HRTS1_N_MARK, HCTS1_N_MARK,
+};
+
+/* - HSCIF2 ----------------------------------------------------------------- */
+static const unsigned int hscif2_data_pins[] = {
+       /* HRX2, HTX2 */
+       RCAR_GP_PIN(1, 1), RCAR_GP_PIN(1, 2),
+};
+static const unsigned int hscif2_data_mux[] = {
+       HRX2_MARK, HTX2_MARK,
+};
+static const unsigned int hscif2_clk_pins[] = {
+       /* HSCK2 */
+       RCAR_GP_PIN(1, 0),
+};
+static const unsigned int hscif2_clk_mux[] = {
+       HSCK2_MARK,
+};
+static const unsigned int hscif2_ctrl_pins[] = {
+       /* HRTS2#, HCTS2# */
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 3),
+};
+static const unsigned int hscif2_ctrl_mux[] = {
+       HRTS2_N_MARK, HCTS2_N_MARK,
+};
+
+/* - HSCIF3 ----------------------------------------------------------------- */
+static const unsigned int hscif3_data_pins[] = {
+       /* HRX3, HTX3 */
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+};
+static const unsigned int hscif3_data_mux[] = {
+       HRX3_MARK, HTX3_MARK,
+};
+static const unsigned int hscif3_clk_pins[] = {
+       /* HSCK3 */
+       RCAR_GP_PIN(0, 14),
+};
+static const unsigned int hscif3_clk_mux[] = {
+       HSCK3_MARK,
+};
+static const unsigned int hscif3_ctrl_pins[] = {
+       /* HRTS3#, HCTS3# */
+       RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 11),
+};
+static const unsigned int hscif3_ctrl_mux[] = {
+       HRTS3_N_MARK, HCTS3_N_MARK,
+};
+
+/* - I2C0 ------------------------------------------------------------------- */
+static const unsigned int i2c0_pins[] = {
+       /* SDA0, SCL0 */
+       RCAR_GP_PIN(1, 1), RCAR_GP_PIN(1, 0),
+};
+static const unsigned int i2c0_mux[] = {
+       SDA0_MARK, SCL0_MARK,
+};
+
+/* - I2C1 ------------------------------------------------------------------- */
+static const unsigned int i2c1_pins[] = {
+       /* SDA1, SCL1 */
+       RCAR_GP_PIN(1, 3), RCAR_GP_PIN(1, 2),
+};
+static const unsigned int i2c1_mux[] = {
+       SDA1_MARK, SCL1_MARK,
+};
+
+/* - I2C2 ------------------------------------------------------------------- */
+static const unsigned int i2c2_pins[] = {
+       /* SDA2, SCL2 */
+       RCAR_GP_PIN(1, 5), RCAR_GP_PIN(1, 4),
+};
+static const unsigned int i2c2_mux[] = {
+       SDA2_MARK, SCL2_MARK,
+};
+
+/* - I2C3 ------------------------------------------------------------------- */
+static const unsigned int i2c3_pins[] = {
+       /* SDA3, SCL3 */
+       RCAR_GP_PIN(1, 7), RCAR_GP_PIN(1, 6),
+};
+static const unsigned int i2c3_mux[] = {
+       SDA3_MARK, SCL3_MARK,
+};
+
+/* - I2C4 ------------------------------------------------------------------- */
+static const unsigned int i2c4_pins[] = {
+       /* SDA4, SCL4 */
+       RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 8),
+};
+static const unsigned int i2c4_mux[] = {
+       SDA4_MARK, SCL4_MARK,
+};
+
+/* - I2C5 ------------------------------------------------------------------- */
+static const unsigned int i2c5_pins[] = {
+       /* SDA5, SCL5 */
+       RCAR_GP_PIN(1, 11), RCAR_GP_PIN(1, 10),
+};
+static const unsigned int i2c5_mux[] = {
+       SDA5_MARK, SCL5_MARK,
+};
+
+
+/* - INTC-EX ---------------------------------------------------------------- */
+static const unsigned int intc_ex_irq0_pins[] = {
+       /* IRQ0 */
+       RCAR_GP_PIN(0, 17),
+};
+static const unsigned int intc_ex_irq0_mux[] = {
+       IRQ0_MARK,
+};
+static const unsigned int intc_ex_irq1_pins[] = {
+       /* IRQ1 */
+       RCAR_GP_PIN(0, 18),
+};
+static const unsigned int intc_ex_irq1_mux[] = {
+       IRQ1_MARK,
+};
+static const unsigned int intc_ex_irq2_pins[] = {
+       /* IRQ2 */
+       RCAR_GP_PIN(0, 19),
+};
+static const unsigned int intc_ex_irq2_mux[] = {
+       IRQ2_MARK,
+};
+static const unsigned int intc_ex_irq3_pins[] = {
+       /* IRQ3 */
+       RCAR_GP_PIN(0, 20),
+};
+static const unsigned int intc_ex_irq3_mux[] = {
+       IRQ3_MARK,
+};
+static const unsigned int intc_ex_irq4_pins[] = {
+       /* IRQ4 */
+       RCAR_GP_PIN(0, 11),
+};
+static const unsigned int intc_ex_irq4_mux[] = {
+       IRQ4_MARK,
+};
+static const unsigned int intc_ex_irq5_pins[] = {
+       /* IRQ5 */
+       RCAR_GP_PIN(0, 15),
+};
+static const unsigned int intc_ex_irq5_mux[] = {
+       IRQ5_MARK,
+};
+
+/* - MMC -------------------------------------------------------------------- */
+static const unsigned int mmc_data_pins[] = {
+       /* MMC_SD_D[0:3], MMC_D[4:7] */
+       RCAR_GP_PIN(1, 13), RCAR_GP_PIN(1, 14),
+       RCAR_GP_PIN(1, 15), RCAR_GP_PIN(1, 16),
+       RCAR_GP_PIN(1, 18), RCAR_GP_PIN(1, 17),
+       RCAR_GP_PIN(1, 19), RCAR_GP_PIN(1, 21),
+};
+static const unsigned int mmc_data_mux[] = {
+       MMC_SD_D0_MARK, MMC_SD_D1_MARK,
+       MMC_SD_D2_MARK, MMC_SD_D3_MARK,
+       MMC_D4_MARK, MMC_D5_MARK,
+       MMC_D6_MARK, MMC_D7_MARK,
+};
+static const unsigned int mmc_ctrl_pins[] = {
+       /* MMC_SD_CLK, MMC_SD_CMD */
+       RCAR_GP_PIN(1, 12), RCAR_GP_PIN(1, 22),
+};
+static const unsigned int mmc_ctrl_mux[] = {
+       MMC_SD_CLK_MARK, MMC_SD_CMD_MARK,
+};
+static const unsigned int mmc_cd_pins[] = {
+       /* SD_CD */
+       RCAR_GP_PIN(1, 23),
+};
+static const unsigned int mmc_cd_mux[] = {
+       SD_CD_MARK,
+};
+static const unsigned int mmc_wp_pins[] = {
+       /* SD_WP */
+       RCAR_GP_PIN(1, 24),
+};
+static const unsigned int mmc_wp_mux[] = {
+       SD_WP_MARK,
+};
+static const unsigned int mmc_ds_pins[] = {
+       /* MMC_DS */
+       RCAR_GP_PIN(1, 20),
+};
+static const unsigned int mmc_ds_mux[] = {
+       MMC_DS_MARK,
+};
+
+/* - MSIOF0 ----------------------------------------------------------------- */
+static const unsigned int msiof0_clk_pins[] = {
+       /* MSIOF0_SCK */
+       RCAR_GP_PIN(0, 14),
+};
+static const unsigned int msiof0_clk_mux[] = {
+       MSIOF0_SCK_MARK,
+};
+static const unsigned int msiof0_sync_pins[] = {
+       /* MSIOF0_SYNC */
+       RCAR_GP_PIN(0, 11),
+};
+static const unsigned int msiof0_sync_mux[] = {
+       MSIOF0_SYNC_MARK,
+};
+static const unsigned int msiof0_ss1_pins[] = {
+       /* MSIOF0_SS1 */
+       RCAR_GP_PIN(0, 15),
+};
+static const unsigned int msiof0_ss1_mux[] = {
+       MSIOF0_SS1_MARK,
+};
+static const unsigned int msiof0_ss2_pins[] = {
+       /* MSIOF0_SS2 */
+       RCAR_GP_PIN(0, 16),
+};
+static const unsigned int msiof0_ss2_mux[] = {
+       MSIOF0_SS2_MARK,
+};
+static const unsigned int msiof0_txd_pins[] = {
+       /* MSIOF0_TXD */
+       RCAR_GP_PIN(0, 13),
+};
+static const unsigned int msiof0_txd_mux[] = {
+       MSIOF0_TXD_MARK,
+};
+static const unsigned int msiof0_rxd_pins[] = {
+       /* MSIOF0_RXD */
+       RCAR_GP_PIN(0, 12),
+};
+static const unsigned int msiof0_rxd_mux[] = {
+       MSIOF0_RXD_MARK,
+};
+
+/* - MSIOF1 ----------------------------------------------------------------- */
+static const unsigned int msiof1_clk_pins[] = {
+       /* MSIOF1_SCK */
+       RCAR_GP_PIN(0, 8),
+};
+static const unsigned int msiof1_clk_mux[] = {
+       MSIOF1_SCK_MARK,
+};
+static const unsigned int msiof1_sync_pins[] = {
+       /* MSIOF1_SYNC */
+       RCAR_GP_PIN(0, 10),
+};
+static const unsigned int msiof1_sync_mux[] = {
+       MSIOF1_SYNC_MARK,
+};
+static const unsigned int msiof1_ss1_pins[] = {
+       /* MSIOF1_SS1 */
+       RCAR_GP_PIN(0, 17),
+};
+static const unsigned int msiof1_ss1_mux[] = {
+       MSIOF1_SS1_MARK,
+};
+static const unsigned int msiof1_ss2_pins[] = {
+       /* MSIOF1_SS2 */
+       RCAR_GP_PIN(0, 18),
+};
+static const unsigned int msiof1_ss2_mux[] = {
+       MSIOF1_SS2_MARK,
+};
+static const unsigned int msiof1_txd_pins[] = {
+       /* MSIOF1_TXD */
+       RCAR_GP_PIN(0, 7),
+};
+static const unsigned int msiof1_txd_mux[] = {
+       MSIOF1_TXD_MARK,
+};
+static const unsigned int msiof1_rxd_pins[] = {
+       /* MSIOF1_RXD */
+       RCAR_GP_PIN(0, 6),
+};
+static const unsigned int msiof1_rxd_mux[] = {
+       MSIOF1_RXD_MARK,
+};
+
+/* - MSIOF2 ----------------------------------------------------------------- */
+static const unsigned int msiof2_clk_pins[] = {
+       /* MSIOF2_SCK */
+       RCAR_GP_PIN(1, 5),
+};
+static const unsigned int msiof2_clk_mux[] = {
+       MSIOF2_SCK_MARK,
+};
+static const unsigned int msiof2_sync_pins[] = {
+       /* MSIOF2_SYNC */
+       RCAR_GP_PIN(1, 4),
+};
+static const unsigned int msiof2_sync_mux[] = {
+       MSIOF2_SYNC_MARK,
+};
+static const unsigned int msiof2_ss1_pins[] = {
+       /* MSIOF2_SS1 */
+       RCAR_GP_PIN(1, 2),
+};
+static const unsigned int msiof2_ss1_mux[] = {
+       MSIOF2_SS1_MARK,
+};
+static const unsigned int msiof2_ss2_pins[] = {
+       /* MSIOF2_SS2 */
+       RCAR_GP_PIN(1, 3),
+};
+static const unsigned int msiof2_ss2_mux[] = {
+       MSIOF2_SS2_MARK,
+};
+static const unsigned int msiof2_txd_pins[] = {
+       /* MSIOF2_TXD */
+       RCAR_GP_PIN(1, 7),
+};
+static const unsigned int msiof2_txd_mux[] = {
+       MSIOF2_TXD_MARK,
+};
+static const unsigned int msiof2_rxd_pins[] = {
+       /* MSIOF2_RXD */
+       RCAR_GP_PIN(1, 6),
+};
+static const unsigned int msiof2_rxd_mux[] = {
+       MSIOF2_RXD_MARK,
+};
+
+/* - MSIOF3 ----------------------------------------------------------------- */
+static const unsigned int msiof3_clk_pins[] = {
+       /* MSIOF3_SCK */
+       RCAR_GP_PIN(0, 1),
+};
+static const unsigned int msiof3_clk_mux[] = {
+       MSIOF3_SCK_MARK,
+};
+static const unsigned int msiof3_sync_pins[] = {
+       /* MSIOF3_SYNC */
+       RCAR_GP_PIN(0, 9),
+};
+static const unsigned int msiof3_sync_mux[] = {
+       MSIOF3_SYNC_MARK,
+};
+static const unsigned int msiof3_ss1_pins[] = {
+       /* MSIOF3_SS1 */
+       RCAR_GP_PIN(0, 4),
+};
+static const unsigned int msiof3_ss1_mux[] = {
+       MSIOF3_SS1_MARK,
+};
+static const unsigned int msiof3_ss2_pins[] = {
+       /* MSIOF3_SS2 */
+       RCAR_GP_PIN(0, 5),
+};
+static const unsigned int msiof3_ss2_mux[] = {
+       MSIOF3_SS2_MARK,
+};
+static const unsigned int msiof3_txd_pins[] = {
+       /* MSIOF3_TXD */
+       RCAR_GP_PIN(0, 3),
+};
+static const unsigned int msiof3_txd_mux[] = {
+       MSIOF3_TXD_MARK,
+};
+static const unsigned int msiof3_rxd_pins[] = {
+       /* MSIOF3_RXD */
+       RCAR_GP_PIN(0, 2),
+};
+static const unsigned int msiof3_rxd_mux[] = {
+       MSIOF3_RXD_MARK,
+};
+
+/* - PCIE ------------------------------------------------------------------- */
+static const unsigned int pcie0_clkreq_n_pins[] = {
+       /* PCIE0_CLKREQ# */
+       RCAR_GP_PIN(2, 15),
+};
+
+static const unsigned int pcie0_clkreq_n_mux[] = {
+       PCIE0_CLKREQ_N_MARK,
+};
+
+static const unsigned int pcie1_clkreq_n_pins[] = {
+       /* PCIE1_CLKREQ# */
+       RCAR_GP_PIN(2, 16),
+};
+
+static const unsigned int pcie1_clkreq_n_mux[] = {
+       PCIE1_CLKREQ_N_MARK,
+};
+
+/* - QSPI0 ------------------------------------------------------------------ */
+static const unsigned int qspi0_ctrl_pins[] = {
+       /* SPCLK, SSL */
+       RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 13),
+};
+static const unsigned int qspi0_ctrl_mux[] = {
+       QSPI0_SPCLK_MARK, QSPI0_SSL_MARK,
+};
+static const unsigned int qspi0_data_pins[] = {
+       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
+       RCAR_GP_PIN(2, 9), RCAR_GP_PIN(2, 12),
+       RCAR_GP_PIN(2, 11), RCAR_GP_PIN(2, 14),
+};
+static const unsigned int qspi0_data_mux[] = {
+       QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK,
+       QSPI0_IO2_MARK, QSPI0_IO3_MARK
+};
+
+/* - QSPI1 ------------------------------------------------------------------ */
+static const unsigned int qspi1_ctrl_pins[] = {
+       /* SPCLK, SSL */
+       RCAR_GP_PIN(2, 8), RCAR_GP_PIN(2, 3),
+};
+static const unsigned int qspi1_ctrl_mux[] = {
+       QSPI1_SPCLK_MARK, QSPI1_SSL_MARK,
+};
+static const unsigned int qspi1_data_pins[] = {
+       /* MOSI_IO0, MISO_IO1, IO2, IO3 */
+       RCAR_GP_PIN(2, 7), RCAR_GP_PIN(2, 5),
+       RCAR_GP_PIN(2, 6), RCAR_GP_PIN(2, 4),
+};
+static const unsigned int qspi1_data_mux[] = {
+       QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK,
+       QSPI1_IO2_MARK, QSPI1_IO3_MARK
+};
+
+/* - SCIF0 ------------------------------------------------------------------ */
+static const unsigned int scif0_data_pins[] = {
+       /* RX0, TX0 */
+       RCAR_GP_PIN(0, 6), RCAR_GP_PIN(0, 7),
+};
+static const unsigned int scif0_data_mux[] = {
+       RX0_MARK, TX0_MARK,
+};
+static const unsigned int scif0_clk_pins[] = {
+       /* SCK0 */
+       RCAR_GP_PIN(0, 8),
+};
+static const unsigned int scif0_clk_mux[] = {
+       SCK0_MARK,
+};
+static const unsigned int scif0_ctrl_pins[] = {
+       /* RTS0#, CTS0# */
+       RCAR_GP_PIN(0, 9), RCAR_GP_PIN(0, 10),
+};
+static const unsigned int scif0_ctrl_mux[] = {
+       RTS0_N_MARK, CTS0_N_MARK,
+};
+
+/* - SCIF1 ------------------------------------------------------------------ */
+static const unsigned int scif1_data_pins[] = {
+       /* RX1, TX1 */
+       RCAR_GP_PIN(0, 12), RCAR_GP_PIN(0, 13),
+};
+static const unsigned int scif1_data_mux[] = {
+       RX1_MARK, TX1_MARK,
+};
+static const unsigned int scif1_clk_pins[] = {
+       /* SCK1 */
+       RCAR_GP_PIN(0, 14),
+};
+static const unsigned int scif1_clk_mux[] = {
+       SCK1_MARK,
+};
+static const unsigned int scif1_ctrl_pins[] = {
+       /* RTS1#, CTS1# */
+       RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 11),
+};
+static const unsigned int scif1_ctrl_mux[] = {
+       RTS1_N_MARK, CTS1_N_MARK,
+};
+
+/* - SCIF3 ------------------------------------------------------------------ */
+static const unsigned int scif3_data_pins[] = {
+       /* RX3, TX3 */
+       RCAR_GP_PIN(0, 2), RCAR_GP_PIN(0, 3),
+};
+static const unsigned int scif3_data_mux[] = {
+       RX3_MARK, TX3_MARK,
+};
+static const unsigned int scif3_clk_pins[] = {
+       /* SCK3 */
+       RCAR_GP_PIN(0, 1),
+};
+static const unsigned int scif3_clk_mux[] = {
+       SCK3_MARK,
+};
+static const unsigned int scif3_ctrl_pins[] = {
+       /* RTS3#, CTS3# */
+       RCAR_GP_PIN(0, 5), RCAR_GP_PIN(0, 4),
+};
+static const unsigned int scif3_ctrl_mux[] = {
+       RTS3_N_MARK, CTS3_N_MARK,
+};
+
+/* - SCIF4 ------------------------------------------------------------------ */
+static const unsigned int scif4_data_pins[] = {
+       /* RX4, TX4 */
+       RCAR_GP_PIN(1, 6), RCAR_GP_PIN(1, 7),
+};
+static const unsigned int scif4_data_mux[] = {
+       RX4_MARK, TX4_MARK,
+};
+static const unsigned int scif4_clk_pins[] = {
+       /* SCK4 */
+       RCAR_GP_PIN(1, 5),
+};
+static const unsigned int scif4_clk_mux[] = {
+       SCK4_MARK,
+};
+static const unsigned int scif4_ctrl_pins[] = {
+       /* RTS4#, CTS4# */
+       RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 3),
+};
+static const unsigned int scif4_ctrl_mux[] = {
+       RTS4_N_MARK, CTS4_N_MARK,
+};
+
+/* - SCIF Clock ------------------------------------------------------------- */
+static const unsigned int scif_clk_pins[] = {
+       /* SCIF_CLK */
+       RCAR_GP_PIN(0, 0),
+};
+static const unsigned int scif_clk_mux[] = {
+       SCIF_CLK_MARK,
+};
+
+/* - TSN0 ------------------------------------------------ */
+static const unsigned int tsn0_link_a_pins[] = {
+       /* TSN0_LINK_A */
+       RCAR_GP_PIN(0, 11),
+};
+static const unsigned int tsn0_link_a_mux[] = {
+       TSN0_LINK_A_MARK,
+};
+static const unsigned int tsn0_magic_a_pins[] = {
+       /* TSN0_MAGIC_A */
+       RCAR_GP_PIN(0, 17),
+};
+static const unsigned int tsn0_magic_a_mux[] = {
+       TSN0_MAGIC_A_MARK,
+};
+static const unsigned int tsn0_phy_int_a_pins[] = {
+       /* TSN0_PHY_INT_A */
+       RCAR_GP_PIN(0, 18),
+};
+static const unsigned int tsn0_phy_int_a_mux[] = {
+       TSN0_PHY_INT_A_MARK,
+};
+static const unsigned int tsn0_mdio_a_pins[] = {
+       /* TSN0_MDC_A, TSN0_MDIO_A */
+       RCAR_GP_PIN(0, 4), RCAR_GP_PIN(0, 5),
+};
+static const unsigned int tsn0_mdio_a_mux[] = {
+       TSN0_MDC_A_MARK, TSN0_MDIO_A_MARK,
+};
+static const unsigned int tsn0_link_b_pins[] = {
+       /* TSN0_LINK_B */
+       RCAR_GP_PIN(3, 8),
+};
+static const unsigned int tsn0_link_b_mux[] = {
+       TSN0_LINK_B_MARK,
+};
+static const unsigned int tsn0_magic_b_pins[] = {
+       /* TSN0_MAGIC_B */
+       RCAR_GP_PIN(3, 12),
+};
+static const unsigned int tsn0_magic_b_mux[] = {
+       TSN0_MAGIC_B_MARK,
+};
+static const unsigned int tsn0_phy_int_b_pins[] = {
+       /* TSN0_PHY_INT_B */
+       RCAR_GP_PIN(3, 10),
+};
+static const unsigned int tsn0_phy_int_b_mux[] = {
+       TSN0_PHY_INT_B_MARK,
+};
+static const unsigned int tsn0_mdio_b_pins[] = {
+       /* TSN0_MDC_B, TSN0_MDIO_B */
+       RCAR_GP_PIN(3, 4), RCAR_GP_PIN(3, 2),
+};
+static const unsigned int tsn0_mdio_b_mux[] = {
+       TSN0_MDC_B_MARK, TSN0_MDIO_B_MARK,
+};
+static const unsigned int tsn0_avtp_pps_pins[] = {
+       /* TSN0_AVTP_PPS */
+       RCAR_GP_PIN(3, 16),
+};
+static const unsigned int tsn0_avtp_pps_mux[] = {
+       TSN0_AVTP_PPS_MARK,
+};
+static const unsigned int tsn0_avtp_capture_a_pins[] = {
+       /* TSN0_AVTP_CAPTURE_A */
+       RCAR_GP_PIN(0, 1),
+};
+static const unsigned int tsn0_avtp_capture_a_mux[] = {
+       TSN0_AVTP_CAPTURE_A_MARK,
+};
+static const unsigned int tsn0_avtp_match_a_pins[] = {
+       /* TSN0_AVTP_MATCH_A */
+       RCAR_GP_PIN(0, 2),
+};
+static const unsigned int tsn0_avtp_match_a_mux[] = {
+       TSN0_AVTP_MATCH_A_MARK,
+};
+static const unsigned int tsn0_avtp_capture_b_pins[] = {
+       /* TSN0_AVTP_CAPTURE_B */
+       RCAR_GP_PIN(3, 18),
+};
+static const unsigned int tsn0_avtp_capture_b_mux[] = {
+       TSN0_AVTP_CAPTURE_B_MARK,
+};
+static const unsigned int tsn0_avtp_match_b_pins[] = {
+       /* TSN0_AVTP_MATCH_B */
+       RCAR_GP_PIN(3, 17),
+};
+static const unsigned int tsn0_avtp_match_b_mux[] = {
+       TSN0_AVTP_MATCH_B_MARK,
+};
+
+/* - TSN1 ------------------------------------------------ */
+static const unsigned int tsn1_link_a_pins[] = {
+       /* TSN1_LINK_A */
+       RCAR_GP_PIN(0, 15),
+};
+static const unsigned int tsn1_link_a_mux[] = {
+       TSN1_LINK_A_MARK,
+};
+static const unsigned int tsn1_phy_int_a_pins[] = {
+       /* TSN1_PHY_INT_A */
+       RCAR_GP_PIN(0, 19),
+};
+static const unsigned int tsn1_phy_int_a_mux[] = {
+       TSN1_PHY_INT_A_MARK,
+};
+static const unsigned int tsn1_mdio_a_pins[] = {
+       /* TSN1_MDC_A, TSN1_MDIO_A */
+       RCAR_GP_PIN(0, 10), RCAR_GP_PIN(0, 9),
+};
+static const unsigned int tsn1_mdio_a_mux[] = {
+       TSN1_MDC_A_MARK, TSN1_MDIO_A_MARK,
+};
+static const unsigned int tsn1_link_b_pins[] = {
+       /* TSN1_LINK_B */
+       RCAR_GP_PIN(3, 6),
+};
+static const unsigned int tsn1_link_b_mux[] = {
+       TSN1_LINK_B_MARK,
+};
+static const unsigned int tsn1_phy_int_b_pins[] = {
+       /* TSN1_PHY_INT_B */
+       RCAR_GP_PIN(3, 11),
+};
+static const unsigned int tsn1_phy_int_b_mux[] = {
+       TSN1_PHY_INT_B_MARK,
+};
+static const unsigned int tsn1_mdio_b_pins[] = {
+       /* TSN1_MDC_B, TSN1_MDIO_B */
+       RCAR_GP_PIN(3, 5), RCAR_GP_PIN(3, 0),
+};
+static const unsigned int tsn1_mdio_b_mux[] = {
+       TSN1_MDC_B_MARK, TSN1_MDIO_B_MARK,
+};
+static const unsigned int tsn1_avtp_pps_pins[] = {
+       /* TSN1_AVTP_PPS */
+       RCAR_GP_PIN(3, 13),
+};
+static const unsigned int tsn1_avtp_pps_mux[] = {
+       TSN0_AVTP_PPS_MARK,
+};
+static const unsigned int tsn1_avtp_capture_a_pins[] = {
+       /* TSN1_AVTP_CAPTURE_A */
+       RCAR_GP_PIN(0, 7),
+};
+static const unsigned int tsn1_avtp_capture_a_mux[] = {
+       TSN1_AVTP_CAPTURE_A_MARK,
+};
+static const unsigned int tsn1_avtp_match_a_pins[] = {
+       /* TSN1_AVTP_MATCH_A */
+       RCAR_GP_PIN(0, 6),
+};
+static const unsigned int tsn1_avtp_match_a_mux[] = {
+       TSN1_AVTP_MATCH_A_MARK,
+};
+static const unsigned int tsn1_avtp_capture_b_pins[] = {
+       /* TSN1_AVTP_CAPTURE_B */
+       RCAR_GP_PIN(3, 15),
+};
+static const unsigned int tsn1_avtp_capture_b_mux[] = {
+       TSN1_AVTP_CAPTURE_B_MARK,
+};
+static const unsigned int tsn1_avtp_match_b_pins[] = {
+       /* TSN1_AVTP_MATCH_B */
+       RCAR_GP_PIN(3, 14),
+};
+static const unsigned int tsn1_avtp_match_b_mux[] = {
+       TSN1_AVTP_MATCH_B_MARK,
+};
+
+/* - TSN2 ------------------------------------------------ */
+static const unsigned int tsn2_link_a_pins[] = {
+       /* TSN2_LINK_A */
+       RCAR_GP_PIN(0, 16),
+};
+static const unsigned int tsn2_link_a_mux[] = {
+       TSN2_LINK_A_MARK,
+};
+static const unsigned int tsn2_phy_int_a_pins[] = {
+       /* TSN2_PHY_INT_A */
+       RCAR_GP_PIN(0, 20),
+};
+static const unsigned int tsn2_phy_int_a_mux[] = {
+       TSN2_PHY_INT_A_MARK,
+};
+static const unsigned int tsn2_mdio_a_pins[] = {
+       /* TSN2_MDC_A, TSN2_MDIO_A */
+       RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3),
+};
+static const unsigned int tsn2_mdio_a_mux[] = {
+       TSN2_MDC_A_MARK, TSN2_MDIO_A_MARK,
+};
+static const unsigned int tsn2_link_b_pins[] = {
+       /* TSN2_LINK_B */
+       RCAR_GP_PIN(3, 7),
+};
+static const unsigned int tsn2_link_b_mux[] = {
+       TSN2_LINK_B_MARK,
+};
+static const unsigned int tsn2_phy_int_b_pins[] = {
+       /* TSN2_PHY_INT_B */
+       RCAR_GP_PIN(3, 9),
+};
+static const unsigned int tsn2_phy_int_b_mux[] = {
+       TSN2_PHY_INT_B_MARK,
+};
+static const unsigned int tsn2_mdio_b_pins[] = {
+       /* TSN2_MDC_B, TSN2_MDIO_B */
+       RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 1),
+};
+static const unsigned int tsn2_mdio_b_mux[] = {
+       TSN2_MDC_B_MARK, TSN2_MDIO_B_MARK,
+};
+
+static const struct sh_pfc_pin_group pinmux_groups[] = {
+       SH_PFC_PIN_GROUP(hscif0_data),
+       SH_PFC_PIN_GROUP(hscif0_clk),
+       SH_PFC_PIN_GROUP(hscif0_ctrl),
+       SH_PFC_PIN_GROUP(hscif1_data),
+       SH_PFC_PIN_GROUP(hscif1_clk),
+       SH_PFC_PIN_GROUP(hscif1_ctrl),
+       SH_PFC_PIN_GROUP(hscif2_data),
+       SH_PFC_PIN_GROUP(hscif2_clk),
+       SH_PFC_PIN_GROUP(hscif2_ctrl),
+       SH_PFC_PIN_GROUP(hscif3_data),
+       SH_PFC_PIN_GROUP(hscif3_clk),
+       SH_PFC_PIN_GROUP(hscif3_ctrl),
+       SH_PFC_PIN_GROUP(i2c0),
+       SH_PFC_PIN_GROUP(i2c1),
+       SH_PFC_PIN_GROUP(i2c2),
+       SH_PFC_PIN_GROUP(i2c3),
+       SH_PFC_PIN_GROUP(i2c4),
+       SH_PFC_PIN_GROUP(i2c5),
+       SH_PFC_PIN_GROUP(intc_ex_irq0),
+       SH_PFC_PIN_GROUP(intc_ex_irq1),
+       SH_PFC_PIN_GROUP(intc_ex_irq2),
+       SH_PFC_PIN_GROUP(intc_ex_irq3),
+       SH_PFC_PIN_GROUP(intc_ex_irq4),
+       SH_PFC_PIN_GROUP(intc_ex_irq5),
+       BUS_DATA_PIN_GROUP(mmc_data, 1),
+       BUS_DATA_PIN_GROUP(mmc_data, 4),
+       BUS_DATA_PIN_GROUP(mmc_data, 8),
+       SH_PFC_PIN_GROUP(mmc_ctrl),
+       SH_PFC_PIN_GROUP(mmc_cd),
+       SH_PFC_PIN_GROUP(mmc_wp),
+       SH_PFC_PIN_GROUP(mmc_ds),
+       SH_PFC_PIN_GROUP(msiof0_clk),
+       SH_PFC_PIN_GROUP(msiof0_sync),
+       SH_PFC_PIN_GROUP(msiof0_ss1),
+       SH_PFC_PIN_GROUP(msiof0_ss2),
+       SH_PFC_PIN_GROUP(msiof0_txd),
+       SH_PFC_PIN_GROUP(msiof0_rxd),
+       SH_PFC_PIN_GROUP(msiof1_clk),
+       SH_PFC_PIN_GROUP(msiof1_sync),
+       SH_PFC_PIN_GROUP(msiof1_ss1),
+       SH_PFC_PIN_GROUP(msiof1_ss2),
+       SH_PFC_PIN_GROUP(msiof1_txd),
+       SH_PFC_PIN_GROUP(msiof1_rxd),
+       SH_PFC_PIN_GROUP(msiof2_clk),
+       SH_PFC_PIN_GROUP(msiof2_sync),
+       SH_PFC_PIN_GROUP(msiof2_ss1),
+       SH_PFC_PIN_GROUP(msiof2_ss2),
+       SH_PFC_PIN_GROUP(msiof2_txd),
+       SH_PFC_PIN_GROUP(msiof2_rxd),
+       SH_PFC_PIN_GROUP(msiof3_clk),
+       SH_PFC_PIN_GROUP(msiof3_sync),
+       SH_PFC_PIN_GROUP(msiof3_ss1),
+       SH_PFC_PIN_GROUP(msiof3_ss2),
+       SH_PFC_PIN_GROUP(msiof3_txd),
+       SH_PFC_PIN_GROUP(msiof3_rxd),
+       SH_PFC_PIN_GROUP(pcie0_clkreq_n),
+       SH_PFC_PIN_GROUP(pcie1_clkreq_n),
+       SH_PFC_PIN_GROUP(qspi0_ctrl),
+       BUS_DATA_PIN_GROUP(qspi0_data, 2),
+       BUS_DATA_PIN_GROUP(qspi0_data, 4),
+       SH_PFC_PIN_GROUP(qspi1_ctrl),
+       BUS_DATA_PIN_GROUP(qspi1_data, 2),
+       BUS_DATA_PIN_GROUP(qspi1_data, 4),
+       SH_PFC_PIN_GROUP(scif0_data),
+       SH_PFC_PIN_GROUP(scif0_clk),
+       SH_PFC_PIN_GROUP(scif0_ctrl),
+       SH_PFC_PIN_GROUP(scif1_data),
+       SH_PFC_PIN_GROUP(scif1_clk),
+       SH_PFC_PIN_GROUP(scif1_ctrl),
+       SH_PFC_PIN_GROUP(scif3_data),
+       SH_PFC_PIN_GROUP(scif3_clk),
+       SH_PFC_PIN_GROUP(scif3_ctrl),
+       SH_PFC_PIN_GROUP(scif4_data),
+       SH_PFC_PIN_GROUP(scif4_clk),
+       SH_PFC_PIN_GROUP(scif4_ctrl),
+       SH_PFC_PIN_GROUP(scif_clk),
+       SH_PFC_PIN_GROUP(tsn0_link_a),
+       SH_PFC_PIN_GROUP(tsn0_magic_a),
+       SH_PFC_PIN_GROUP(tsn0_phy_int_a),
+       SH_PFC_PIN_GROUP(tsn0_mdio_a),
+       SH_PFC_PIN_GROUP(tsn0_link_b),
+       SH_PFC_PIN_GROUP(tsn0_magic_b),
+       SH_PFC_PIN_GROUP(tsn0_phy_int_b),
+       SH_PFC_PIN_GROUP(tsn0_mdio_b),
+       SH_PFC_PIN_GROUP(tsn0_avtp_pps),
+       SH_PFC_PIN_GROUP(tsn0_avtp_capture_a),
+       SH_PFC_PIN_GROUP(tsn0_avtp_match_a),
+       SH_PFC_PIN_GROUP(tsn0_avtp_capture_b),
+       SH_PFC_PIN_GROUP(tsn0_avtp_match_b),
+       SH_PFC_PIN_GROUP(tsn1_link_a),
+       SH_PFC_PIN_GROUP(tsn1_phy_int_a),
+       SH_PFC_PIN_GROUP(tsn1_mdio_a),
+       SH_PFC_PIN_GROUP(tsn1_link_b),
+       SH_PFC_PIN_GROUP(tsn1_phy_int_b),
+       SH_PFC_PIN_GROUP(tsn1_mdio_b),
+       SH_PFC_PIN_GROUP(tsn1_avtp_pps),
+       SH_PFC_PIN_GROUP(tsn1_avtp_capture_a),
+       SH_PFC_PIN_GROUP(tsn1_avtp_match_a),
+       SH_PFC_PIN_GROUP(tsn1_avtp_capture_b),
+       SH_PFC_PIN_GROUP(tsn1_avtp_match_b),
+       SH_PFC_PIN_GROUP(tsn2_link_a),
+       SH_PFC_PIN_GROUP(tsn2_phy_int_a),
+       SH_PFC_PIN_GROUP(tsn2_mdio_a),
+       SH_PFC_PIN_GROUP(tsn2_link_b),
+       SH_PFC_PIN_GROUP(tsn2_phy_int_b),
+       SH_PFC_PIN_GROUP(tsn2_mdio_b),
+};
+
+static const char * const hscif0_groups[] = {
+       "hscif0_data",
+       "hscif0_clk",
+       "hscif0_ctrl",
+};
+
+static const char * const hscif1_groups[] = {
+       "hscif1_data",
+       "hscif1_clk",
+       "hscif1_ctrl",
+};
+
+static const char * const hscif2_groups[] = {
+       "hscif2_data",
+       "hscif2_clk",
+       "hscif2_ctrl",
+};
+
+static const char * const hscif3_groups[] = {
+       "hscif3_data",
+       "hscif3_clk",
+       "hscif3_ctrl",
+};
+
+static const char * const i2c0_groups[] = {
+       "i2c0",
+};
+
+static const char * const i2c1_groups[] = {
+       "i2c1",
+};
+
+static const char * const i2c2_groups[] = {
+       "i2c2",
+};
+
+static const char * const i2c3_groups[] = {
+       "i2c3",
+};
+
+static const char * const i2c4_groups[] = {
+       "i2c4",
+};
+
+static const char * const i2c5_groups[] = {
+       "i2c5",
+};
+
+static const char * const intc_ex_groups[] = {
+       "intc_ex_irq0",
+       "intc_ex_irq1",
+       "intc_ex_irq2",
+       "intc_ex_irq3",
+       "intc_ex_irq4",
+       "intc_ex_irq5",
+};
+
+static const char * const mmc_groups[] = {
+       "mmc_data1",
+       "mmc_data4",
+       "mmc_data8",
+       "mmc_ctrl",
+       "mmc_cd",
+       "mmc_wp",
+       "mmc_ds",
+};
+
+static const char * const msiof0_groups[] = {
+       "msiof0_clk",
+       "msiof0_sync",
+       "msiof0_ss1",
+       "msiof0_ss2",
+       "msiof0_txd",
+       "msiof0_rxd",
+};
+
+static const char * const msiof1_groups[] = {
+       "msiof1_clk",
+       "msiof1_sync",
+       "msiof1_ss1",
+       "msiof1_ss2",
+       "msiof1_txd",
+       "msiof1_rxd",
+};
+
+static const char * const msiof2_groups[] = {
+       "msiof2_clk",
+       "msiof2_sync",
+       "msiof2_ss1",
+       "msiof2_ss2",
+       "msiof2_txd",
+       "msiof2_rxd",
+};
+
+static const char * const msiof3_groups[] = {
+       "msiof3_clk",
+       "msiof3_sync",
+       "msiof3_ss1",
+       "msiof3_ss2",
+       "msiof3_txd",
+       "msiof3_rxd",
+};
+
+static const char * const pcie_groups[] = {
+       "pcie0_clkreq_n",
+       "pcie1_clkreq_n",
+};
+
+static const char * const qspi0_groups[] = {
+       "qspi0_ctrl",
+       "qspi0_data2",
+       "qspi0_data4",
+};
+
+static const char * const qspi1_groups[] = {
+       "qspi1_ctrl",
+       "qspi1_data2",
+       "qspi1_data4",
+};
+
+static const char * const scif0_groups[] = {
+       "scif0_data",
+       "scif0_clk",
+       "scif0_ctrl",
+};
+
+static const char * const scif1_groups[] = {
+       "scif1_data",
+       "scif1_clk",
+       "scif1_ctrl",
+};
+
+static const char * const scif3_groups[] = {
+       "scif3_data",
+       "scif3_clk",
+       "scif3_ctrl",
+};
+
+static const char * const scif4_groups[] = {
+       "scif4_data",
+       "scif4_clk",
+       "scif4_ctrl",
+};
+
+static const char * const scif_clk_groups[] = {
+       "scif_clk",
+};
+
+static const char * const tsn0_groups[] = {
+       "tsn0_link_a",
+       "tsn0_magic_a",
+       "tsn0_phy_int_a",
+       "tsn0_mdio_a",
+       "tsn0_link_b",
+       "tsn0_magic_b",
+       "tsn0_phy_int_b",
+       "tsn0_mdio_b",
+       "tsn0_avtp_pps",
+       "tsn0_avtp_capture_a",
+       "tsn0_avtp_match_a",
+       "tsn0_avtp_capture_b",
+       "tsn0_avtp_match_b",
+};
+
+static const char * const tsn1_groups[] = {
+       "tsn1_link_a",
+       "tsn1_phy_int_a",
+       "tsn1_mdio_a",
+       "tsn1_link_b",
+       "tsn1_phy_int_b",
+       "tsn1_mdio_b",
+       "tsn1_avtp_pps",
+       "tsn1_avtp_capture_a",
+       "tsn1_avtp_match_a",
+       "tsn1_avtp_capture_b",
+       "tsn1_avtp_match_b",
+};
+
+static const char * const tsn2_groups[] = {
+       "tsn2_link_a",
+       "tsn2_phy_int_a",
+       "tsn2_mdio_a",
+       "tsn2_link_b",
+       "tsn2_phy_int_b",
+       "tsn2_mdio_b",
+};
+
+static const struct sh_pfc_function pinmux_functions[] = {
+       SH_PFC_FUNCTION(hscif0),
+       SH_PFC_FUNCTION(hscif1),
+       SH_PFC_FUNCTION(hscif2),
+       SH_PFC_FUNCTION(hscif3),
+       SH_PFC_FUNCTION(i2c0),
+       SH_PFC_FUNCTION(i2c1),
+       SH_PFC_FUNCTION(i2c2),
+       SH_PFC_FUNCTION(i2c3),
+       SH_PFC_FUNCTION(i2c4),
+       SH_PFC_FUNCTION(i2c5),
+       SH_PFC_FUNCTION(intc_ex),
+       SH_PFC_FUNCTION(mmc),
+       SH_PFC_FUNCTION(msiof0),
+       SH_PFC_FUNCTION(msiof1),
+       SH_PFC_FUNCTION(msiof2),
+       SH_PFC_FUNCTION(msiof3),
+       SH_PFC_FUNCTION(pcie),
+       SH_PFC_FUNCTION(qspi0),
+       SH_PFC_FUNCTION(qspi1),
+       SH_PFC_FUNCTION(scif0),
+       SH_PFC_FUNCTION(scif1),
+       SH_PFC_FUNCTION(scif3),
+       SH_PFC_FUNCTION(scif4),
+       SH_PFC_FUNCTION(scif_clk),
+       SH_PFC_FUNCTION(tsn0),
+       SH_PFC_FUNCTION(tsn1),
+       SH_PFC_FUNCTION(tsn2),
+};
+
+static const struct pinmux_cfg_reg pinmux_config_regs[] = {
+#define F_(x, y)       FN_##y
+#define FM(x)          FN_##x
+       { PINMUX_CFG_REG("GPSR0", 0xe6050040, 32, 1, GROUP(
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               GP_0_20_FN,     GPSR0_20,
+               GP_0_19_FN,     GPSR0_19,
+               GP_0_18_FN,     GPSR0_18,
+               GP_0_17_FN,     GPSR0_17,
+               GP_0_16_FN,     GPSR0_16,
+               GP_0_15_FN,     GPSR0_15,
+               GP_0_14_FN,     GPSR0_14,
+               GP_0_13_FN,     GPSR0_13,
+               GP_0_12_FN,     GPSR0_12,
+               GP_0_11_FN,     GPSR0_11,
+               GP_0_10_FN,     GPSR0_10,
+               GP_0_9_FN,      GPSR0_9,
+               GP_0_8_FN,      GPSR0_8,
+               GP_0_7_FN,      GPSR0_7,
+               GP_0_6_FN,      GPSR0_6,
+               GP_0_5_FN,      GPSR0_5,
+               GP_0_4_FN,      GPSR0_4,
+               GP_0_3_FN,      GPSR0_3,
+               GP_0_2_FN,      GPSR0_2,
+               GP_0_1_FN,      GPSR0_1,
+               GP_0_0_FN,      GPSR0_0, ))
+       },
+       { PINMUX_CFG_REG("GPSR1", 0xe6050840, 32, 1, GROUP(
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               GP_1_24_FN,     GPSR1_24,
+               GP_1_23_FN,     GPSR1_23,
+               GP_1_22_FN,     GPSR1_22,
+               GP_1_21_FN,     GPSR1_21,
+               GP_1_20_FN,     GPSR1_20,
+               GP_1_19_FN,     GPSR1_19,
+               GP_1_18_FN,     GPSR1_18,
+               GP_1_17_FN,     GPSR1_17,
+               GP_1_16_FN,     GPSR1_16,
+               GP_1_15_FN,     GPSR1_15,
+               GP_1_14_FN,     GPSR1_14,
+               GP_1_13_FN,     GPSR1_13,
+               GP_1_12_FN,     GPSR1_12,
+               GP_1_11_FN,     GPSR1_11,
+               GP_1_10_FN,     GPSR1_10,
+               GP_1_9_FN,      GPSR1_9,
+               GP_1_8_FN,      GPSR1_8,
+               GP_1_7_FN,      GPSR1_7,
+               GP_1_6_FN,      GPSR1_6,
+               GP_1_5_FN,      GPSR1_5,
+               GP_1_4_FN,      GPSR1_4,
+               GP_1_3_FN,      GPSR1_3,
+               GP_1_2_FN,      GPSR1_2,
+               GP_1_1_FN,      GPSR1_1,
+               GP_1_0_FN,      GPSR1_0, ))
+       },
+       { PINMUX_CFG_REG("GPSR2", 0xe6051040, 32, 1, GROUP(
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               GP_2_16_FN,     GPSR2_16,
+               GP_2_15_FN,     GPSR2_15,
+               GP_2_14_FN,     GPSR2_14,
+               GP_2_13_FN,     GPSR2_13,
+               GP_2_12_FN,     GPSR2_12,
+               GP_2_11_FN,     GPSR2_11,
+               GP_2_10_FN,     GPSR2_10,
+               GP_2_9_FN,      GPSR2_9,
+               GP_2_8_FN,      GPSR2_8,
+               GP_2_7_FN,      GPSR2_7,
+               GP_2_6_FN,      GPSR2_6,
+               GP_2_5_FN,      GPSR2_5,
+               GP_2_4_FN,      GPSR2_4,
+               GP_2_3_FN,      GPSR2_3,
+               GP_2_2_FN,      GPSR2_2,
+               GP_2_1_FN,      GPSR2_1,
+               GP_2_0_FN,      GPSR2_0, ))
+       },
+       { PINMUX_CFG_REG("GPSR3", 0xe6051840, 32, 1, GROUP(
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               0, 0,
+               GP_3_18_FN,     GPSR3_18,
+               GP_3_17_FN,     GPSR3_17,
+               GP_3_16_FN,     GPSR3_16,
+               GP_3_15_FN,     GPSR3_15,
+               GP_3_14_FN,     GPSR3_14,
+               GP_3_13_FN,     GPSR3_13,
+               GP_3_12_FN,     GPSR3_12,
+               GP_3_11_FN,     GPSR3_11,
+               GP_3_10_FN,     GPSR3_10,
+               GP_3_9_FN,      GPSR3_9,
+               GP_3_8_FN,      GPSR3_8,
+               GP_3_7_FN,      GPSR3_7,
+               GP_3_6_FN,      GPSR3_6,
+               GP_3_5_FN,      GPSR3_5,
+               GP_3_4_FN,      GPSR3_4,
+               GP_3_3_FN,      GPSR3_3,
+               GP_3_2_FN,      GPSR3_2,
+               GP_3_1_FN,      GPSR3_1,
+               GP_3_0_FN,      GPSR3_0, ))
+       },
+#undef F_
+#undef FM
+
+#define F_(x, y)       x,
+#define FM(x)          FN_##x,
+       { PINMUX_CFG_REG("IP0SR0", 0xe6050060, 32, 4, GROUP(
+               IP0SR0_31_28
+               IP0SR0_27_24
+               IP0SR0_23_20
+               IP0SR0_19_16
+               IP0SR0_15_12
+               IP0SR0_11_8
+               IP0SR0_7_4
+               IP0SR0_3_0))
+       },
+       { PINMUX_CFG_REG("IP1SR0", 0xe6050064, 32, 4, GROUP(
+               IP1SR0_31_28
+               IP1SR0_27_24
+               IP1SR0_23_20
+               IP1SR0_19_16
+               IP1SR0_15_12
+               IP1SR0_11_8
+               IP1SR0_7_4
+               IP1SR0_3_0))
+       },
+       { PINMUX_CFG_REG("IP2SR0", 0xe6050068, 32, 4, GROUP(
+               IP2SR0_31_28
+               IP2SR0_27_24
+               IP2SR0_23_20
+               IP2SR0_19_16
+               IP2SR0_15_12
+               IP2SR0_11_8
+               IP2SR0_7_4
+               IP2SR0_3_0))
+       },
+       { PINMUX_CFG_REG("IP0SR1", 0xe6050860, 32, 4, GROUP(
+               IP0SR1_31_28
+               IP0SR1_27_24
+               IP0SR1_23_20
+               IP0SR1_19_16
+               IP0SR1_15_12
+               IP0SR1_11_8
+               IP0SR1_7_4
+               IP0SR1_3_0))
+       },
+#undef F_
+#undef FM
+
+#define F_(x, y)       x,
+#define FM(x)          FN_##x,
+       { PINMUX_CFG_REG_VAR("MOD_SEL1", 0xe6050900, 32,
+                            GROUP(4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2),
+                            GROUP(
+               /* RESERVED 31, 30, 29, 28 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               /* RESERVED 27, 26, 25, 24 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               /* RESERVED 23, 22, 21, 20 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               /* RESERVED 19, 18, 17, 16 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               /* RESERVED 15, 14, 13, 12 */
+               0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+               MOD_SEL1_11_10
+               MOD_SEL1_9_8
+               MOD_SEL1_7_6
+               MOD_SEL1_5_4
+               MOD_SEL1_3_2
+               MOD_SEL1_1_0))
+       },
+       { /* sentinel */ },
+};
+
+static const struct pinmux_drive_reg pinmux_drive_regs[] = {
+       { PINMUX_DRIVE_REG("DRV0CTRL0", 0xe6050080) {
+               { RCAR_GP_PIN(0,  7), 28, 3 },  /* TX0 */
+               { RCAR_GP_PIN(0,  6), 24, 3 },  /* RX0 */
+               { RCAR_GP_PIN(0,  5), 20, 3 },  /* HRTS0_N */
+               { RCAR_GP_PIN(0,  4), 16, 3 },  /* HCTS0_N */
+               { RCAR_GP_PIN(0,  3), 12, 3 },  /* HTX0 */
+               { RCAR_GP_PIN(0,  2),  8, 3 },  /* HRX0 */
+               { RCAR_GP_PIN(0,  1),  4, 3 },  /* HSCK0 */
+               { RCAR_GP_PIN(0,  0),  0, 3 },  /* SCIF_CLK */
+       } },
+       { PINMUX_DRIVE_REG("DRV1CTRL0", 0xe6050084) {
+               { RCAR_GP_PIN(0, 15), 28, 3 },  /* MSIOF0_SS1 */
+               { RCAR_GP_PIN(0, 14), 24, 3 },  /* MSIOF0_SCK */
+               { RCAR_GP_PIN(0, 13), 20, 3 },  /* MSIOF0_TXD */
+               { RCAR_GP_PIN(0, 12), 16, 3 },  /* MSIOF0_RXD */
+               { RCAR_GP_PIN(0, 11), 12, 3 },  /* MSIOF0_SYNC */
+               { RCAR_GP_PIN(0, 10),  8, 3 },  /* CTS0_N */
+               { RCAR_GP_PIN(0,  9),  4, 3 },  /* RTS0_N */
+               { RCAR_GP_PIN(0,  8),  0, 3 },  /* SCK0 */
+       } },
+       { PINMUX_DRIVE_REG("DRV2CTRL0", 0xe6050088) {
+               { RCAR_GP_PIN(0, 20), 16, 3 },  /* IRQ3 */
+               { RCAR_GP_PIN(0, 19), 12, 3 },  /* IRQ2 */
+               { RCAR_GP_PIN(0, 18),  8, 3 },  /* IRQ1 */
+               { RCAR_GP_PIN(0, 17),  4, 3 },  /* IRQ0 */
+               { RCAR_GP_PIN(0, 16),  0, 3 },  /* MSIOF0_SS2 */
+       } },
+       { PINMUX_DRIVE_REG("DRV0CTRL1", 0xe6050880) {
+               { RCAR_GP_PIN(1,  7), 28, 3 },  /* GP1_07 */
+               { RCAR_GP_PIN(1,  6), 24, 3 },  /* GP1_06 */
+               { RCAR_GP_PIN(1,  5), 20, 3 },  /* GP1_05 */
+               { RCAR_GP_PIN(1,  4), 16, 3 },  /* GP1_04 */
+               { RCAR_GP_PIN(1,  3), 12, 3 },  /* GP1_03 */
+               { RCAR_GP_PIN(1,  2),  8, 3 },  /* GP1_02 */
+               { RCAR_GP_PIN(1,  1),  4, 3 },  /* GP1_01 */
+               { RCAR_GP_PIN(1,  0),  0, 3 },  /* GP1_00 */
+       } },
+       { PINMUX_DRIVE_REG("DRV1CTRL1", 0xe6050884) {
+               { RCAR_GP_PIN(1, 15), 28, 3 },  /* MMC_SD_D2 */
+               { RCAR_GP_PIN(1, 14), 24, 3 },  /* MMC_SD_D1 */
+               { RCAR_GP_PIN(1, 13), 20, 3 },  /* MMC_SD_D0 */
+               { RCAR_GP_PIN(1, 12), 16, 3 },  /* MMC_SD_CLK */
+               { RCAR_GP_PIN(1, 11), 12, 3 },  /* GP1_11 */
+               { RCAR_GP_PIN(1, 10),  8, 3 },  /* GP1_10 */
+               { RCAR_GP_PIN(1,  9),  4, 3 },  /* GP1_09 */
+               { RCAR_GP_PIN(1,  8),  0, 3 },  /* GP1_08 */
+       } },
+       { PINMUX_DRIVE_REG("DRV2CTRL1", 0xe6050888) {
+               { RCAR_GP_PIN(1, 23), 28, 3 },  /* SD_CD */
+               { RCAR_GP_PIN(1, 22), 24, 3 },  /* MMC_SD_CMD */
+               { RCAR_GP_PIN(1, 21), 20, 3 },  /* MMC_D7 */
+               { RCAR_GP_PIN(1, 20), 16, 3 },  /* MMC_DS */
+               { RCAR_GP_PIN(1, 19), 12, 3 },  /* MMC_D6 */
+               { RCAR_GP_PIN(1, 18),  8, 3 },  /* MMC_D4 */
+               { RCAR_GP_PIN(1, 17),  4, 3 },  /* MMC_D5 */
+               { RCAR_GP_PIN(1, 16),  0, 3 },  /* MMC_SD_D3 */
+       } },
+       { PINMUX_DRIVE_REG("DRV3CTRL1", 0xe605088c) {
+               { RCAR_GP_PIN(1, 24),  0, 3 },  /* SD_WP */
+       } },
+       { PINMUX_DRIVE_REG("DRV0CTRL2", 0xe6051080) {
+               { RCAR_GP_PIN(2,  7), 28, 2 },  /* QSPI1_MOSI_IO0 */
+               { RCAR_GP_PIN(2,  6), 24, 2 },  /* QSPI1_IO2 */
+               { RCAR_GP_PIN(2,  5), 20, 2 },  /* QSPI1_MISO_IO1 */
+               { RCAR_GP_PIN(2,  4), 16, 2 },  /* QSPI1_IO3 */
+               { RCAR_GP_PIN(2,  3), 12, 2 },  /* QSPI1_SSL */
+               { RCAR_GP_PIN(2,  2),  8, 2 },  /* RPC_RESET_N */
+               { RCAR_GP_PIN(2,  1),  4, 2 },  /* RPC_WP_N */
+               { RCAR_GP_PIN(2,  0),  0, 2 },  /* RPC_INT_N */
+       } },
+       { PINMUX_DRIVE_REG("DRV1CTRL2", 0xe6051084) {
+               { RCAR_GP_PIN(2, 15), 28, 3 },  /* PCIE0_CLKREQ_N */
+               { RCAR_GP_PIN(2, 14), 24, 2 },  /* QSPI0_IO3 */
+               { RCAR_GP_PIN(2, 13), 20, 2 },  /* QSPI0_SSL */
+               { RCAR_GP_PIN(2, 12), 16, 2 },  /* QSPI0_MISO_IO1 */
+               { RCAR_GP_PIN(2, 11), 12, 2 },  /* QSPI0_IO2 */
+               { RCAR_GP_PIN(2, 10),  8, 2 },  /* QSPI0_SPCLK */
+               { RCAR_GP_PIN(2,  9),  4, 2 },  /* QSPI0_MOSI_IO0 */
+               { RCAR_GP_PIN(2,  8),  0, 2 },  /* QSPI1_SPCLK */
+       } },
+       { PINMUX_DRIVE_REG("DRV2CTRL2", 0xe6051088) {
+               { RCAR_GP_PIN(2, 16),  0, 3 },  /* PCIE1_CLKREQ_N */
+       } },
+       { PINMUX_DRIVE_REG("DRV0CTRL3", 0xe6051880) {
+               { RCAR_GP_PIN(3,  7), 28, 3 },  /* TSN2_LINK_B */
+               { RCAR_GP_PIN(3,  6), 24, 3 },  /* TSN1_LINK_B */
+               { RCAR_GP_PIN(3,  5), 20, 3 },  /* TSN1_MDC_B */
+               { RCAR_GP_PIN(3,  4), 16, 3 },  /* TSN0_MDC_B */
+               { RCAR_GP_PIN(3,  3), 12, 3 },  /* TSN2_MDC_B */
+               { RCAR_GP_PIN(3,  2),  8, 3 },  /* TSN0_MDIO_B */
+               { RCAR_GP_PIN(3,  1),  4, 3 },  /* TSN2_MDIO_B */
+               { RCAR_GP_PIN(3,  0),  0, 3 },  /* TSN1_MDIO_B */
+       } },
+       { PINMUX_DRIVE_REG("DRV1CTRL3", 0xe6051884) {
+               { RCAR_GP_PIN(3, 15), 28, 3 },  /* TSN1_AVTP_CAPTURE_B */
+               { RCAR_GP_PIN(3, 14), 24, 3 },  /* TSN1_AVTP_MATCH_B */
+               { RCAR_GP_PIN(3, 13), 20, 3 },  /* TSN1_AVTP_PPS */
+               { RCAR_GP_PIN(3, 12), 16, 3 },  /* TSN0_MAGIC_B */
+               { RCAR_GP_PIN(3, 11), 12, 3 },  /* TSN1_PHY_INT_B */
+               { RCAR_GP_PIN(3, 10),  8, 3 },  /* TSN0_PHY_INT_B */
+               { RCAR_GP_PIN(3,  9),  4, 3 },  /* TSN2_PHY_INT_B */
+               { RCAR_GP_PIN(3,  8),  0, 3 },  /* TSN0_LINK_B */
+       } },
+       { PINMUX_DRIVE_REG("DRV2CTRL3", 0xe6051888) {
+               { RCAR_GP_PIN(3, 18),  8, 3 },  /* TSN0_AVTP_CAPTURE_B */
+               { RCAR_GP_PIN(3, 17),  4, 3 },  /* TSN0_AVTP_MATCH_B */
+               { RCAR_GP_PIN(3, 16),  0, 3 },  /* TSN0_AVTP_PPS */
+       } },
+       { /* sentinel */ },
+};
+
+enum ioctrl_regs {
+       POC0,
+       POC1,
+       POC2,
+       POC3,
+       TD0SEL1,
+};
+
+static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = {
+       [POC0] = { 0xe60500a0, },
+       [POC1] = { 0xe60508a0, },
+       [POC2] = { 0xe60510a0, },
+       [POC3] = { 0xe60518a0, },
+       [TD0SEL1] = { 0xe6050920, },
+       { /* sentinel */ },
+};
+
+static int r8a779f0_pin_to_pocctrl(unsigned int pin, u32 *pocctrl)
+{
+       int bit = pin & 0x1f;
+
+       *pocctrl = pinmux_ioctrl_regs[POC0].reg;
+       if (pin >= RCAR_GP_PIN(0, 0) && pin <= RCAR_GP_PIN(0, 20))
+               return bit;
+
+       *pocctrl = pinmux_ioctrl_regs[POC1].reg;
+       if (pin >= RCAR_GP_PIN(1, 0) && pin <= RCAR_GP_PIN(1, 24))
+               return bit;
+
+       *pocctrl = pinmux_ioctrl_regs[POC3].reg;
+       if (pin >= RCAR_GP_PIN(3, 0) && pin <= RCAR_GP_PIN(3, 18))
+               return bit;
+
+       return -EINVAL;
+}
+
+static const struct pinmux_bias_reg pinmux_bias_regs[] = {
+       { PINMUX_BIAS_REG("PUEN0", 0xe60500c0, "PUD0", 0xe60500e0) {
+               [ 0] = RCAR_GP_PIN(0,  0),      /* SCIF_CLK */
+               [ 1] = RCAR_GP_PIN(0,  1),      /* HSCK0 */
+               [ 2] = RCAR_GP_PIN(0,  2),      /* HRX0 */
+               [ 3] = RCAR_GP_PIN(0,  3),      /* HTX0 */
+               [ 4] = RCAR_GP_PIN(0,  4),      /* HCTS0_N */
+               [ 5] = RCAR_GP_PIN(0,  5),      /* HRTS0_N */
+               [ 6] = RCAR_GP_PIN(0,  6),      /* RX0 */
+               [ 7] = RCAR_GP_PIN(0,  7),      /* TX0 */
+               [ 8] = RCAR_GP_PIN(0,  8),      /* SCK0 */
+               [ 9] = RCAR_GP_PIN(0,  9),      /* RTS0_N */
+               [10] = RCAR_GP_PIN(0, 10),      /* CTS0_N */
+               [11] = RCAR_GP_PIN(0, 11),      /* MSIOF0_SYNC */
+               [12] = RCAR_GP_PIN(0, 12),      /* MSIOF0_RXD */
+               [13] = RCAR_GP_PIN(0, 13),      /* MSIOF0_TXD */
+               [14] = RCAR_GP_PIN(0, 14),      /* MSIOF0_SCK */
+               [15] = RCAR_GP_PIN(0, 15),      /* MSIOF0_SS1 */
+               [16] = RCAR_GP_PIN(0, 16),      /* MSIOF0_SS2 */
+               [17] = RCAR_GP_PIN(0, 17),      /* IRQ0 */
+               [18] = RCAR_GP_PIN(0, 18),      /* IRQ1 */
+               [19] = RCAR_GP_PIN(0, 19),      /* IRQ2 */
+               [20] = RCAR_GP_PIN(0, 20),      /* IRQ3 */
+               [21] = SH_PFC_PIN_NONE,
+               [22] = SH_PFC_PIN_NONE,
+               [23] = SH_PFC_PIN_NONE,
+               [24] = SH_PFC_PIN_NONE,
+               [25] = SH_PFC_PIN_NONE,
+               [26] = SH_PFC_PIN_NONE,
+               [27] = SH_PFC_PIN_NONE,
+               [28] = SH_PFC_PIN_NONE,
+               [29] = SH_PFC_PIN_NONE,
+               [30] = SH_PFC_PIN_NONE,
+               [31] = SH_PFC_PIN_NONE,
+       } },
+       { PINMUX_BIAS_REG("PUEN1", 0xe60508c0, "PUD1", 0xe60508e0) {
+               [ 0] = RCAR_GP_PIN(1,  0),      /* GP1_00 */
+               [ 1] = RCAR_GP_PIN(1,  1),      /* GP1_01 */
+               [ 2] = RCAR_GP_PIN(1,  2),      /* GP1_02 */
+               [ 3] = RCAR_GP_PIN(1,  3),      /* GP1_03 */
+               [ 4] = RCAR_GP_PIN(1,  4),      /* GP1_04 */
+               [ 5] = RCAR_GP_PIN(1,  5),      /* GP1_05 */
+               [ 6] = RCAR_GP_PIN(1,  6),      /* GP1_06 */
+               [ 7] = RCAR_GP_PIN(1,  7),      /* GP1_07 */
+               [ 8] = RCAR_GP_PIN(1,  8),      /* GP1_08 */
+               [ 9] = RCAR_GP_PIN(1,  9),      /* GP1_09 */
+               [10] = RCAR_GP_PIN(1, 10),      /* GP1_10 */
+               [11] = RCAR_GP_PIN(1, 11),      /* GP1_11 */
+               [12] = RCAR_GP_PIN(1, 12),      /* MMC_SD_CLK */
+               [13] = RCAR_GP_PIN(1, 13),      /* MMC_SD_D0 */
+               [14] = RCAR_GP_PIN(1, 14),      /* MMC_SD_D1 */
+               [15] = RCAR_GP_PIN(1, 15),      /* MMC_SD_D2 */
+               [16] = RCAR_GP_PIN(1, 16),      /* MMC_SD_D3 */
+               [17] = RCAR_GP_PIN(1, 17),      /* MMC_D5 */
+               [18] = RCAR_GP_PIN(1, 18),      /* MMC_D4 */
+               [19] = RCAR_GP_PIN(1, 19),      /* MMC_D6 */
+               [20] = RCAR_GP_PIN(1, 20),      /* MMC_DS */
+               [21] = RCAR_GP_PIN(1, 21),      /* MMC_D7 */
+               [22] = RCAR_GP_PIN(1, 22),      /* MMC_SD_CMD */
+               [23] = RCAR_GP_PIN(1, 23),      /* SD_CD */
+               [24] = RCAR_GP_PIN(1, 24),      /* SD_WP */
+               [25] = SH_PFC_PIN_NONE,
+               [26] = SH_PFC_PIN_NONE,
+               [27] = SH_PFC_PIN_NONE,
+               [28] = SH_PFC_PIN_NONE,
+               [29] = SH_PFC_PIN_NONE,
+               [30] = SH_PFC_PIN_NONE,
+               [31] = SH_PFC_PIN_NONE,
+       } },
+       { PINMUX_BIAS_REG("PUEN2", 0xe60510c0, "PUD2", 0xe60510e0) {
+               [ 0] = RCAR_GP_PIN(2,  0),      /* RPC_INT_N */
+               [ 1] = RCAR_GP_PIN(2,  1),      /* RPC_WP_N */
+               [ 2] = RCAR_GP_PIN(2,  2),      /* RPC_RESET_N */
+               [ 3] = RCAR_GP_PIN(2,  3),      /* QSPI1_SSL */
+               [ 4] = RCAR_GP_PIN(2,  4),      /* QSPI1_IO3 */
+               [ 5] = RCAR_GP_PIN(2,  5),      /* QSPI1_MISO_IO1 */
+               [ 6] = RCAR_GP_PIN(2,  6),      /* QSPI1_IO2 */
+               [ 7] = RCAR_GP_PIN(2,  7),      /* QSPI1_MOSI_IO0 */
+               [ 8] = RCAR_GP_PIN(2,  8),      /* QSPI1_SPCLK */
+               [ 9] = RCAR_GP_PIN(2,  9),      /* QSPI0_MOSI_IO0 */
+               [10] = RCAR_GP_PIN(2, 10),      /* QSPI0_SPCLK */
+               [11] = RCAR_GP_PIN(2, 11),      /* QSPI0_IO2 */
+               [12] = RCAR_GP_PIN(2, 12),      /* QSPI0_MISO_IO1 */
+               [13] = RCAR_GP_PIN(2, 13),      /* QSPI0_SSL */
+               [14] = RCAR_GP_PIN(2, 14),      /* QSPI0_IO3 */
+               [15] = RCAR_GP_PIN(2, 15),      /* PCIE0_CLKREQ_N */
+               [16] = RCAR_GP_PIN(2, 16),      /* PCIE1_CLKREQ_N */
+               [17] = SH_PFC_PIN_NONE,
+               [18] = SH_PFC_PIN_NONE,
+               [19] = SH_PFC_PIN_NONE,
+               [20] = SH_PFC_PIN_NONE,
+               [21] = SH_PFC_PIN_NONE,
+               [22] = SH_PFC_PIN_NONE,
+               [23] = SH_PFC_PIN_NONE,
+               [24] = SH_PFC_PIN_NONE,
+               [25] = SH_PFC_PIN_NONE,
+               [26] = SH_PFC_PIN_NONE,
+               [27] = SH_PFC_PIN_NONE,
+               [28] = SH_PFC_PIN_NONE,
+               [29] = SH_PFC_PIN_NONE,
+               [30] = SH_PFC_PIN_NONE,
+               [31] = SH_PFC_PIN_NONE,
+       } },
+       { PINMUX_BIAS_REG("PUEN3", 0xe60518c0, "PUD3", 0xe60518e0) {
+               [ 0] = RCAR_GP_PIN(3,  0),      /* TSN1_MDIO_B */
+               [ 1] = RCAR_GP_PIN(3,  1),      /* TSN2_MDIO_B */
+               [ 2] = RCAR_GP_PIN(3,  2),      /* TSN0_MDIO_B */
+               [ 3] = RCAR_GP_PIN(3,  3),      /* TSN2_MDC_B */
+               [ 4] = RCAR_GP_PIN(3,  4),      /* TSN0_MDC_B */
+               [ 5] = RCAR_GP_PIN(3,  5),      /* TSN1_MDC_B */
+               [ 6] = RCAR_GP_PIN(3,  6),      /* TSN1_LINK_B */
+               [ 7] = RCAR_GP_PIN(3,  7),      /* TSN2_LINK_B */
+               [ 8] = RCAR_GP_PIN(3,  8),      /* TSN0_LINK_B */
+               [ 9] = RCAR_GP_PIN(3,  9),      /* TSN2_PHY_INT_B */
+               [10] = RCAR_GP_PIN(3, 10),      /* TSN0_PHY_INT_B */
+               [11] = RCAR_GP_PIN(3, 11),      /* TSN1_PHY_INT_B */
+               [12] = RCAR_GP_PIN(3, 12),      /* TSN0_MAGIC_B */
+               [13] = RCAR_GP_PIN(3, 13),      /* TSN1_AVTP_PPS */
+               [14] = RCAR_GP_PIN(3, 14),      /* TSN1_AVTP_MATCH_B */
+               [15] = RCAR_GP_PIN(3, 15),      /* TSN1_AVTP_CAPTURE_B */
+               [16] = RCAR_GP_PIN(3, 16),      /* TSN0_AVTP_PPS */
+               [17] = RCAR_GP_PIN(3, 17),      /* TSN0_AVTP_MATCH_B */
+               [18] = RCAR_GP_PIN(3, 18),      /* TSN0_AVTP_CAPTURE_B */
+               [19] = SH_PFC_PIN_NONE,
+               [20] = SH_PFC_PIN_NONE,
+               [21] = SH_PFC_PIN_NONE,
+               [22] = SH_PFC_PIN_NONE,
+               [23] = SH_PFC_PIN_NONE,
+               [24] = SH_PFC_PIN_NONE,
+               [25] = SH_PFC_PIN_NONE,
+               [26] = SH_PFC_PIN_NONE,
+               [27] = SH_PFC_PIN_NONE,
+               [28] = SH_PFC_PIN_NONE,
+               [29] = SH_PFC_PIN_NONE,
+               [30] = SH_PFC_PIN_NONE,
+               [31] = SH_PFC_PIN_NONE,
+       } },
+       { /* sentinel */ },
+};
+
+static const struct sh_pfc_soc_operations r8a779f0_pfc_ops = {
+       .pin_to_pocctrl = r8a779f0_pin_to_pocctrl,
+       .get_bias = rcar_pinmux_get_bias,
+       .set_bias = rcar_pinmux_set_bias,
+};
+
+const struct sh_pfc_soc_info r8a779f0_pinmux_info = {
+       .name = "r8a779f0_pfc",
+       .ops = &r8a779f0_pfc_ops,
+       .unlock_reg = 0x1ff,    /* PMMRn mask */
+
+       .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
+
+       .pins = pinmux_pins,
+       .nr_pins = ARRAY_SIZE(pinmux_pins),
+       .groups = pinmux_groups,
+       .nr_groups = ARRAY_SIZE(pinmux_groups),
+       .functions = pinmux_functions,
+       .nr_functions = ARRAY_SIZE(pinmux_functions),
+
+       .cfg_regs = pinmux_config_regs,
+       .drive_regs = pinmux_drive_regs,
+       .bias_regs = pinmux_bias_regs,
+       .ioctrl_regs = pinmux_ioctrl_regs,
+
+       .pinmux_data = pinmux_data,
+       .pinmux_data_size = ARRAY_SIZE(pinmux_data),
+};
index 811a6f2..3986802 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/sh7203.h>
 
 #include "sh_pfc.h"
index 908837e..7476b98 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/sh7264.h>
 
 #include "sh_pfc.h"
index e2916aa..733a2c1 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/sh7269.h>
 
 #include "sh_pfc.h"
index ed6db80..5d8a017 100644 (file)
@@ -1777,35 +1777,11 @@ static const unsigned int irda_1_mux[] = {
        PORT49_IRDA_OUT_MARK, PORT53_IRDA_IN_MARK, PORT54_IRDA_FIRSEL_MARK,
 };
 /* - KEYSC ------------------------------------------------------------------ */
-static const unsigned int keysc_in5_pins[] = {
-       /* KEYIN[0:4] */
-       66, 67, 68, 69, 70,
-};
-static const unsigned int keysc_in5_mux[] = {
-       KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
-       KEYIN4_MARK,
-};
-static const unsigned int keysc_in6_pins[] = {
-       /* KEYIN[0:5] */
-       66, 67, 68, 69, 70, 71,
-};
-static const unsigned int keysc_in6_mux[] = {
-       KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
-       KEYIN4_MARK, KEYIN5_MARK,
-};
-static const unsigned int keysc_in7_pins[] = {
-       /* KEYIN[0:6] */
-       66, 67, 68, 69, 70, 71, 72,
-};
-static const unsigned int keysc_in7_mux[] = {
-       KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
-       KEYIN4_MARK, KEYIN5_MARK, KEYIN6_MARK,
-};
-static const unsigned int keysc_in8_pins[] = {
+static const unsigned int keysc_in_pins[] = {
        /* KEYIN[0:7] */
        66, 67, 68, 69, 70, 71, 72, 73,
 };
-static const unsigned int keysc_in8_mux[] = {
+static const unsigned int keysc_in_mux[] = {
        KEYIN0_MARK, KEYIN1_MARK, KEYIN2_MARK, KEYIN3_MARK,
        KEYIN4_MARK, KEYIN5_MARK, KEYIN6_MARK, KEYIN7_MARK,
 };
@@ -1936,65 +1912,13 @@ static const unsigned int keysc_out11_1_mux[] = {
        PORT143_KEYOUT11_MARK,
 };
 /* - LCD -------------------------------------------------------------------- */
-static const unsigned int lcd_data8_pins[] = {
-       /* D[0:7] */
-       192, 193, 194, 195, 196, 197, 198, 199,
-};
-static const unsigned int lcd_data8_mux[] = {
-       LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
-       LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
-};
-static const unsigned int lcd_data9_pins[] = {
-       /* D[0:8] */
-       192, 193, 194, 195, 196, 197, 198, 199,
-       200,
-};
-static const unsigned int lcd_data9_mux[] = {
-       LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
-       LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
-       LCDD8_MARK,
-};
-static const unsigned int lcd_data12_pins[] = {
-       /* D[0:11] */
-       192, 193, 194, 195, 196, 197, 198, 199,
-       200, 201, 202, 203,
-};
-static const unsigned int lcd_data12_mux[] = {
-       LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
-       LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
-       LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
-};
-static const unsigned int lcd_data16_pins[] = {
-       /* D[0:15] */
-       192, 193, 194, 195, 196, 197, 198, 199,
-       200, 201, 202, 203, 204, 205, 206, 207,
-};
-static const unsigned int lcd_data16_mux[] = {
-       LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
-       LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
-       LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
-       LCDD12_MARK, LCDD13_MARK, LCDD14_MARK, LCDD15_MARK,
-};
-static const unsigned int lcd_data18_pins[] = {
-       /* D[0:17] */
-       192, 193, 194, 195, 196, 197, 198, 199,
-       200, 201, 202, 203, 204, 205, 206, 207,
-       208, 209,
-};
-static const unsigned int lcd_data18_mux[] = {
-       LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
-       LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
-       LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
-       LCDD12_MARK, LCDD13_MARK, LCDD14_MARK, LCDD15_MARK,
-       LCDD16_MARK, LCDD17_MARK,
-};
-static const unsigned int lcd_data24_pins[] = {
+static const unsigned int lcd_data_pins[] = {
        /* D[0:23] */
        192, 193, 194, 195, 196, 197, 198, 199,
        200, 201, 202, 203, 204, 205, 206, 207,
        208, 209, 210, 211, 212, 213, 214, 215
 };
-static const unsigned int lcd_data24_mux[] = {
+static const unsigned int lcd_data_mux[] = {
        LCDD0_MARK, LCDD1_MARK, LCDD2_MARK, LCDD3_MARK,
        LCDD4_MARK, LCDD5_MARK, LCDD6_MARK, LCDD7_MARK,
        LCDD8_MARK, LCDD9_MARK, LCDD10_MARK, LCDD11_MARK,
@@ -2031,65 +1955,13 @@ static const unsigned int lcd_sys_mux[] = {
        LCDCS__MARK, LCDWR__MARK, LCDRD__MARK, LCDRS_MARK,
 };
 /* - LCD2 ------------------------------------------------------------------- */
-static const unsigned int lcd2_data8_pins[] = {
-       /* D[0:7] */
-       128, 129, 142, 143, 144, 145, 138, 139,
-};
-static const unsigned int lcd2_data8_mux[] = {
-       LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
-       LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
-};
-static const unsigned int lcd2_data9_pins[] = {
-       /* D[0:8] */
-       128, 129, 142, 143, 144, 145, 138, 139,
-       140,
-};
-static const unsigned int lcd2_data9_mux[] = {
-       LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
-       LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
-       LCD2D8_MARK,
-};
-static const unsigned int lcd2_data12_pins[] = {
-       /* D[0:11] */
-       128, 129, 142, 143, 144, 145, 138, 139,
-       140, 141, 130, 131,
-};
-static const unsigned int lcd2_data12_mux[] = {
-       LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
-       LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
-       LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
-};
-static const unsigned int lcd2_data16_pins[] = {
-       /* D[0:15] */
-       128, 129, 142, 143, 144, 145, 138, 139,
-       140, 141, 130, 131, 132, 133, 134, 135,
-};
-static const unsigned int lcd2_data16_mux[] = {
-       LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
-       LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
-       LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
-       LCD2D12_MARK, LCD2D13_MARK, LCD2D14_MARK, LCD2D15_MARK,
-};
-static const unsigned int lcd2_data18_pins[] = {
-       /* D[0:17] */
-       128, 129, 142, 143, 144, 145, 138, 139,
-       140, 141, 130, 131, 132, 133, 134, 135,
-       136, 137,
-};
-static const unsigned int lcd2_data18_mux[] = {
-       LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
-       LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
-       LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
-       LCD2D12_MARK, LCD2D13_MARK, LCD2D14_MARK, LCD2D15_MARK,
-       LCD2D16_MARK, LCD2D17_MARK,
-};
-static const unsigned int lcd2_data24_pins[] = {
+static const unsigned int lcd2_data_pins[] = {
        /* D[0:23] */
        128, 129, 142, 143, 144, 145, 138, 139,
        140, 141, 130, 131, 132, 133, 134, 135,
        136, 137, 146, 147, 234, 235, 238, 239
 };
-static const unsigned int lcd2_data24_mux[] = {
+static const unsigned int lcd2_data_mux[] = {
        LCD2D0_MARK, LCD2D1_MARK, LCD2D2_MARK, LCD2D3_MARK,
        LCD2D4_MARK, LCD2D5_MARK, LCD2D6_MARK, LCD2D7_MARK,
        LCD2D8_MARK, LCD2D9_MARK, LCD2D10_MARK, LCD2D11_MARK,
@@ -2130,25 +2002,11 @@ static const unsigned int lcd2_sys_1_mux[] = {
        LCD2RD__MARK, PORT217_LCD2RS_MARK,
 };
 /* - MMCIF ------------------------------------------------------------------ */
-static const unsigned int mmc0_data1_0_pins[] = {
-       /* D[0] */
-       271,
-};
-static const unsigned int mmc0_data1_0_mux[] = {
-       MMCD0_0_MARK,
-};
-static const unsigned int mmc0_data4_0_pins[] = {
-       /* D[0:3] */
-       271, 272, 273, 274,
-};
-static const unsigned int mmc0_data4_0_mux[] = {
-       MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
-};
-static const unsigned int mmc0_data8_0_pins[] = {
+static const unsigned int mmc0_data_0_pins[] = {
        /* D[0:7] */
        271, 272, 273, 274, 275, 276, 277, 278,
 };
-static const unsigned int mmc0_data8_0_mux[] = {
+static const unsigned int mmc0_data_0_mux[] = {
        MMCD0_0_MARK, MMCD0_1_MARK, MMCD0_2_MARK, MMCD0_3_MARK,
        MMCD0_4_MARK, MMCD0_5_MARK, MMCD0_6_MARK, MMCD0_7_MARK,
 };
@@ -2160,25 +2018,11 @@ static const unsigned int mmc0_ctrl_0_mux[] = {
        MMCCMD0_MARK, MMCCLK0_MARK,
 };
 
-static const unsigned int mmc0_data1_1_pins[] = {
-       /* D[0] */
-       305,
-};
-static const unsigned int mmc0_data1_1_mux[] = {
-       MMCD1_0_MARK,
-};
-static const unsigned int mmc0_data4_1_pins[] = {
-       /* D[0:3] */
-       305, 304, 303, 302,
-};
-static const unsigned int mmc0_data4_1_mux[] = {
-       MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
-};
-static const unsigned int mmc0_data8_1_pins[] = {
+static const unsigned int mmc0_data_1_pins[] = {
        /* D[0:7] */
        305, 304, 303, 302, 301, 300, 299, 298,
 };
-static const unsigned int mmc0_data8_1_mux[] = {
+static const unsigned int mmc0_data_1_mux[] = {
        MMCD1_0_MARK, MMCD1_1_MARK, MMCD1_2_MARK, MMCD1_3_MARK,
        MMCD1_4_MARK, MMCD1_5_MARK, MMCD1_6_MARK, MMCD1_7_MARK,
 };
@@ -2851,18 +2695,11 @@ static const unsigned int scifb_ctrl_1_mux[] = {
        PORT245_SCIFB_RTS__MARK, PORT244_SCIFB_CTS__MARK,
 };
 /* - SDHI0 ------------------------------------------------------------------ */
-static const unsigned int sdhi0_data1_pins[] = {
-       /* D0 */
-       252,
-};
-static const unsigned int sdhi0_data1_mux[] = {
-       SDHID0_0_MARK,
-};
-static const unsigned int sdhi0_data4_pins[] = {
+static const unsigned int sdhi0_data_pins[] = {
        /* D[0:3] */
        252, 253, 254, 255,
 };
-static const unsigned int sdhi0_data4_mux[] = {
+static const unsigned int sdhi0_data_mux[] = {
        SDHID0_0_MARK, SDHID0_1_MARK, SDHID0_2_MARK, SDHID0_3_MARK,
 };
 static const unsigned int sdhi0_ctrl_pins[] = {
@@ -2887,18 +2724,11 @@ static const unsigned int sdhi0_wp_mux[] = {
        SDHIWP0_MARK,
 };
 /* - SDHI1 ------------------------------------------------------------------ */
-static const unsigned int sdhi1_data1_pins[] = {
-       /* D0 */
-       259,
-};
-static const unsigned int sdhi1_data1_mux[] = {
-       SDHID1_0_MARK,
-};
-static const unsigned int sdhi1_data4_pins[] = {
+static const unsigned int sdhi1_data_pins[] = {
        /* D[0:3] */
        259, 260, 261, 262,
 };
-static const unsigned int sdhi1_data4_mux[] = {
+static const unsigned int sdhi1_data_mux[] = {
        SDHID1_0_MARK, SDHID1_1_MARK, SDHID1_2_MARK, SDHID1_3_MARK,
 };
 static const unsigned int sdhi1_ctrl_pins[] = {
@@ -2909,18 +2739,11 @@ static const unsigned int sdhi1_ctrl_mux[] = {
        SDHICMD1_MARK, SDHICLK1_MARK,
 };
 /* - SDHI2 ------------------------------------------------------------------ */
-static const unsigned int sdhi2_data1_pins[] = {
-       /* D0 */
-       265,
-};
-static const unsigned int sdhi2_data1_mux[] = {
-       SDHID2_0_MARK,
-};
-static const unsigned int sdhi2_data4_pins[] = {
+static const unsigned int sdhi2_data_pins[] = {
        /* D[0:3] */
        265, 266, 267, 268,
 };
-static const unsigned int sdhi2_data4_mux[] = {
+static const unsigned int sdhi2_data_mux[] = {
        SDHID2_0_MARK, SDHID2_1_MARK, SDHID2_2_MARK, SDHID2_3_MARK,
 };
 static const unsigned int sdhi2_ctrl_pins[] = {
@@ -3138,10 +2961,10 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(i2c3_2),
        SH_PFC_PIN_GROUP(irda_0),
        SH_PFC_PIN_GROUP(irda_1),
-       SH_PFC_PIN_GROUP(keysc_in5),
-       SH_PFC_PIN_GROUP(keysc_in6),
-       SH_PFC_PIN_GROUP(keysc_in7),
-       SH_PFC_PIN_GROUP(keysc_in8),
+       BUS_DATA_PIN_GROUP(keysc_in, 5),
+       BUS_DATA_PIN_GROUP(keysc_in, 6),
+       BUS_DATA_PIN_GROUP(keysc_in, 7),
+       BUS_DATA_PIN_GROUP(keysc_in, 8),
        SH_PFC_PIN_GROUP(keysc_out04),
        SH_PFC_PIN_GROUP(keysc_out5),
        SH_PFC_PIN_GROUP(keysc_out6_0),
@@ -3160,33 +2983,33 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(keysc_out10_1),
        SH_PFC_PIN_GROUP(keysc_out11_0),
        SH_PFC_PIN_GROUP(keysc_out11_1),
-       SH_PFC_PIN_GROUP(lcd_data8),
-       SH_PFC_PIN_GROUP(lcd_data9),
-       SH_PFC_PIN_GROUP(lcd_data12),
-       SH_PFC_PIN_GROUP(lcd_data16),
-       SH_PFC_PIN_GROUP(lcd_data18),
-       SH_PFC_PIN_GROUP(lcd_data24),
+       BUS_DATA_PIN_GROUP(lcd_data, 8),
+       BUS_DATA_PIN_GROUP(lcd_data, 9),
+       BUS_DATA_PIN_GROUP(lcd_data, 12),
+       BUS_DATA_PIN_GROUP(lcd_data, 16),
+       BUS_DATA_PIN_GROUP(lcd_data, 18),
+       BUS_DATA_PIN_GROUP(lcd_data, 24),
        SH_PFC_PIN_GROUP(lcd_display),
        SH_PFC_PIN_GROUP(lcd_lclk),
        SH_PFC_PIN_GROUP(lcd_sync),
        SH_PFC_PIN_GROUP(lcd_sys),
-       SH_PFC_PIN_GROUP(lcd2_data8),
-       SH_PFC_PIN_GROUP(lcd2_data9),
-       SH_PFC_PIN_GROUP(lcd2_data12),
-       SH_PFC_PIN_GROUP(lcd2_data16),
-       SH_PFC_PIN_GROUP(lcd2_data18),
-       SH_PFC_PIN_GROUP(lcd2_data24),
+       BUS_DATA_PIN_GROUP(lcd2_data, 8),
+       BUS_DATA_PIN_GROUP(lcd2_data, 9),
+       BUS_DATA_PIN_GROUP(lcd2_data, 12),
+       BUS_DATA_PIN_GROUP(lcd2_data, 16),
+       BUS_DATA_PIN_GROUP(lcd2_data, 18),
+       BUS_DATA_PIN_GROUP(lcd2_data, 24),
        SH_PFC_PIN_GROUP(lcd2_sync_0),
        SH_PFC_PIN_GROUP(lcd2_sync_1),
        SH_PFC_PIN_GROUP(lcd2_sys_0),
        SH_PFC_PIN_GROUP(lcd2_sys_1),
-       SH_PFC_PIN_GROUP(mmc0_data1_0),
-       SH_PFC_PIN_GROUP(mmc0_data4_0),
-       SH_PFC_PIN_GROUP(mmc0_data8_0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1, _0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4, _0),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8, _0),
        SH_PFC_PIN_GROUP(mmc0_ctrl_0),
-       SH_PFC_PIN_GROUP(mmc0_data1_1),
-       SH_PFC_PIN_GROUP(mmc0_data4_1),
-       SH_PFC_PIN_GROUP(mmc0_data8_1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 1, _1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 4, _1),
+       BUS_DATA_PIN_GROUP(mmc0_data, 8, _1),
        SH_PFC_PIN_GROUP(mmc0_ctrl_1),
        SH_PFC_PIN_GROUP(msiof0_rsck),
        SH_PFC_PIN_GROUP(msiof0_tsck),
@@ -3280,16 +3103,16 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
        SH_PFC_PIN_GROUP(scifb_data_1),
        SH_PFC_PIN_GROUP(scifb_clk_1),
        SH_PFC_PIN_GROUP(scifb_ctrl_1),
-       SH_PFC_PIN_GROUP(sdhi0_data1),
-       SH_PFC_PIN_GROUP(sdhi0_data4),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi0_data, 4),
        SH_PFC_PIN_GROUP(sdhi0_ctrl),
        SH_PFC_PIN_GROUP(sdhi0_cd),
        SH_PFC_PIN_GROUP(sdhi0_wp),
-       SH_PFC_PIN_GROUP(sdhi1_data1),
-       SH_PFC_PIN_GROUP(sdhi1_data4),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi1_data, 4),
        SH_PFC_PIN_GROUP(sdhi1_ctrl),
-       SH_PFC_PIN_GROUP(sdhi2_data1),
-       SH_PFC_PIN_GROUP(sdhi2_data4),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 1),
+       BUS_DATA_PIN_GROUP(sdhi2_data, 4),
        SH_PFC_PIN_GROUP(sdhi2_ctrl),
        SH_PFC_PIN_GROUP(tpu0_to0),
        SH_PFC_PIN_GROUP(tpu0_to1),
@@ -4314,9 +4137,9 @@ static const unsigned int sh73a0_portcr_offsets[] = {
        0x00002000, 0x00002000, 0x00003000, 0x00003000, 0x00002000,
 };
 
-static void __iomem *sh73a0_pin_to_portcr(struct sh_pfc *pfc, unsigned int pin)
+static int sh73a0_pin_to_portcr(unsigned int pin)
 {
-       return pfc->windows->virt + sh73a0_portcr_offsets[pin >> 5] + pin;
+       return sh73a0_portcr_offsets[pin >> 5] + pin;
 }
 
 /* -----------------------------------------------------------------------------
index 37bcae6..7071ef5 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/sh7720.h>
 
 #include "sh_pfc.h"
index 95295be..13d9967 100644 (file)
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/gpio.h>
 #include <cpu/sh7722.h>
 
 #include "sh_pfc.h"
index ccee9c9..cb80550 100644 (file)
@@ -1090,12 +1090,12 @@ static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl)
        }
 
        if (of_args.args[0] != 0 || of_args.args[1] != 0 ||
-           of_args.args[2] != ARRAY_SIZE(rzg2l_gpio_names)) {
+           of_args.args[2] != pctrl->data->n_port_pins) {
                dev_err(pctrl->dev, "gpio-ranges does not match selected SOC\n");
                return -EINVAL;
        }
 
-       chip->names = rzg2l_gpio_names;
+       chip->names = pctrl->data->port_pins;
        chip->request = rzg2l_gpio_request;
        chip->free = rzg2l_gpio_free;
        chip->get_direction = rzg2l_gpio_get_direction;
index 96b9de9..4c37aeb 100644 (file)
@@ -397,7 +397,7 @@ static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
 
        spin_lock_irqsave(&pfc->lock, flags);
 
-       if (!pfc->gpio) {
+       if (!pfc->gpio && !cfg->mux_mark) {
                /* If GPIOs are handled externally the pin mux type needs to be
                 * set to GPIO here.
                 */
@@ -639,7 +639,7 @@ static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
                if (!pfc->info->ops || !pfc->info->ops->pin_to_pocctrl)
                        return -ENOTSUPP;
 
-               bit = pfc->info->ops->pin_to_pocctrl(pfc, _pin, &pocctrl);
+               bit = pfc->info->ops->pin_to_pocctrl(_pin, &pocctrl);
                if (WARN(bit < 0, "invalid pin %#x", _pin))
                        return bit;
 
@@ -711,7 +711,7 @@ static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned _pin,
                        if (!pfc->info->ops || !pfc->info->ops->pin_to_pocctrl)
                                return -ENOTSUPP;
 
-                       bit = pfc->info->ops->pin_to_pocctrl(pfc, _pin, &pocctrl);
+                       bit = pfc->info->ops->pin_to_pocctrl(_pin, &pocctrl);
                        if (WARN(bit < 0, "invalid pin %#x", _pin))
                                return bit;
 
@@ -835,16 +835,16 @@ int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
 }
 
 const struct pinmux_bias_reg *
-rcar_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin,
+rcar_pin_to_bias_reg(const struct sh_pfc_soc_info *info, unsigned int pin,
                     unsigned int *bit)
 {
        unsigned int i, j;
 
-       for (i = 0; pfc->info->bias_regs[i].puen || pfc->info->bias_regs[i].pud; i++) {
-               for (j = 0; j < ARRAY_SIZE(pfc->info->bias_regs[i].pins); j++) {
-                       if (pfc->info->bias_regs[i].pins[j] == pin) {
+       for (i = 0; info->bias_regs[i].puen || info->bias_regs[i].pud; i++) {
+               for (j = 0; j < ARRAY_SIZE(info->bias_regs[i].pins); j++) {
+                       if (info->bias_regs[i].pins[j] == pin) {
                                *bit = j;
-                               return &pfc->info->bias_regs[i];
+                               return &info->bias_regs[i];
                        }
                }
        }
@@ -859,7 +859,7 @@ unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
        const struct pinmux_bias_reg *reg;
        unsigned int bit;
 
-       reg = rcar_pin_to_bias_reg(pfc, pin, &bit);
+       reg = rcar_pin_to_bias_reg(pfc->info, pin, &bit);
        if (!reg)
                return PIN_CONFIG_BIAS_DISABLE;
 
@@ -885,7 +885,7 @@ void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
        u32 enable, updown;
        unsigned int bit;
 
-       reg = rcar_pin_to_bias_reg(pfc, pin, &bit);
+       reg = rcar_pin_to_bias_reg(pfc->info, pin, &bit);
        if (!reg)
                return;
 
@@ -919,7 +919,8 @@ void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
 
 unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
 {
-       void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin);
+       void __iomem *reg = pfc->windows->virt +
+                           pfc->info->ops->pin_to_portcr(pin);
        u32 value = ioread8(reg) & PORTnCR_PULMD_MASK;
 
        switch (value) {
@@ -936,7 +937,8 @@ unsigned int rmobile_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin)
 void rmobile_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
                             unsigned int bias)
 {
-       void __iomem *reg = pfc->info->ops->pin_to_portcr(pfc, pin);
+       void __iomem *reg = pfc->windows->virt +
+                           pfc->info->ops->pin_to_portcr(pin);
        u32 value = ioread8(reg) & ~PORTnCR_PULMD_MASK;
 
        switch (bias) {
index 2479b4f..6b5836e 100644 (file)
@@ -49,15 +49,34 @@ struct sh_pfc_pin {
        u16 enum_id;
 };
 
-#define SH_PFC_PIN_GROUP_ALIAS(alias, n)               \
-       {                                               \
-               .name = #alias,                         \
-               .pins = n##_pins,                       \
-               .mux = n##_mux,                         \
-               .nr_pins = ARRAY_SIZE(n##_pins) +       \
-               BUILD_BUG_ON_ZERO(sizeof(n##_pins) != sizeof(n##_mux)), \
-       }
-#define SH_PFC_PIN_GROUP(n)    SH_PFC_PIN_GROUP_ALIAS(n, n)
+#define SH_PFC_PIN_GROUP_ALIAS(alias, _name) {                         \
+       .name = #alias,                                                 \
+       .pins = _name##_pins,                                           \
+       .mux = _name##_mux,                                             \
+       .nr_pins = ARRAY_SIZE(_name##_pins) +                           \
+       BUILD_BUG_ON_ZERO(sizeof(_name##_pins) != sizeof(_name##_mux)), \
+}
+#define SH_PFC_PIN_GROUP(name) SH_PFC_PIN_GROUP_ALIAS(name, name)
+
+/*
+ * Define a pin group referring to a subset of an array of pins.
+ */
+#define SH_PFC_PIN_GROUP_SUBSET(_name, data, first, n) {               \
+       .name = #_name,                                                 \
+       .pins = data##_pins + first,                                    \
+       .mux = data##_mux + first,                                      \
+       .nr_pins = n +                                                  \
+       BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_pins)) +        \
+       BUILD_BUG_ON_ZERO(first + n > ARRAY_SIZE(data##_mux)),          \
+}
+
+/*
+ * Define a pin group for the data pins of a resizable bus.
+ * An optional 'suffix' argument is accepted, to be used when the same group
+ * can appear on a different set of pins.
+ */
+#define BUS_DATA_PIN_GROUP(base, n, ...)                               \
+       SH_PFC_PIN_GROUP_SUBSET(base##n##__VA_ARGS__, base##__VA_ARGS__, 0, n)
 
 struct sh_pfc_pin_group {
        const char *name;
@@ -66,49 +85,11 @@ struct sh_pfc_pin_group {
        unsigned int nr_pins;
 };
 
-/*
- * Using union vin_data{,12,16} saves memory occupied by the VIN data pins.
- * VIN_DATA_PIN_GROUP() is a macro used to describe the VIN pin groups
- * in this case. It accepts an optional 'version' argument used when the
- * same group can appear on a different set of pins.
- */
-#define VIN_DATA_PIN_GROUP(n, s, ...)                                  \
-       {                                                               \
-               .name = #n#s#__VA_ARGS__,                               \
-               .pins = n##__VA_ARGS__##_pins.data##s,                  \
-               .mux = n##__VA_ARGS__##_mux.data##s,                    \
-               .nr_pins = ARRAY_SIZE(n##__VA_ARGS__##_pins.data##s),   \
-       }
-
-union vin_data12 {
-       unsigned int data12[12];
-       unsigned int data10[10];
-       unsigned int data8[8];
-};
-
-union vin_data16 {
-       unsigned int data16[16];
-       unsigned int data12[12];
-       unsigned int data10[10];
-       unsigned int data8[8];
-};
-
-union vin_data {
-       unsigned int data24[24];
-       unsigned int data20[20];
-       unsigned int data16[16];
-       unsigned int data12[12];
-       unsigned int data10[10];
-       unsigned int data8[8];
-       unsigned int data4[4];
-};
-
-#define SH_PFC_FUNCTION(n)                             \
-       {                                               \
-               .name = #n,                             \
-               .groups = n##_groups,                   \
-               .nr_groups = ARRAY_SIZE(n##_groups),    \
-       }
+#define SH_PFC_FUNCTION(n) {                                           \
+       .name = #n,                                                     \
+       .groups = n##_groups,                                           \
+       .nr_groups = ARRAY_SIZE(n##_groups),                            \
+}
 
 struct sh_pfc_function {
        const char *name;
@@ -231,8 +212,9 @@ struct pinmux_irq {
  * Describe the mapping from GPIOs to a single IRQ
  *   - ids...: List of GPIOs that are mapped to the same IRQ
  */
-#define PINMUX_IRQ(ids...)                        \
-       { .gpios = (const short []) { ids, -1 } }
+#define PINMUX_IRQ(ids...) {                                           \
+       .gpios = (const short []) { ids, -1 }                           \
+}
 
 struct pinmux_range {
        u16 begin;
@@ -272,8 +254,8 @@ struct sh_pfc_soc_operations {
        unsigned int (*get_bias)(struct sh_pfc *pfc, unsigned int pin);
        void (*set_bias)(struct sh_pfc *pfc, unsigned int pin,
                         unsigned int bias);
-       int (*pin_to_pocctrl)(struct sh_pfc *pfc, unsigned int pin, u32 *pocctrl);
-       void __iomem * (*pin_to_portcr)(struct sh_pfc *pfc, unsigned int pin);
+       int (*pin_to_pocctrl)(unsigned int pin, u32 *pocctrl);
+       int (*pin_to_portcr)(unsigned int pin);
 };
 
 struct sh_pfc_soc_info {
@@ -342,6 +324,7 @@ extern const struct sh_pfc_soc_info r8a77980_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77990_pinmux_info;
 extern const struct sh_pfc_soc_info r8a77995_pinmux_info;
 extern const struct sh_pfc_soc_info r8a779a0_pinmux_info;
+extern const struct sh_pfc_soc_info r8a779f0_pinmux_info;
 extern const struct sh_pfc_soc_info sh7203_pinmux_info;
 extern const struct sh_pfc_soc_info sh7264_pinmux_info;
 extern const struct sh_pfc_soc_info sh7269_pinmux_info;
@@ -535,9 +518,13 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info;
        PORT_GP_CFG_1(bank, 17, fn, sfx, cfg)
 #define PORT_GP_18(bank, fn, sfx)      PORT_GP_CFG_18(bank, fn, sfx, 0)
 
-#define PORT_GP_CFG_20(bank, fn, sfx, cfg)                             \
+#define PORT_GP_CFG_19(bank, fn, sfx, cfg)                             \
        PORT_GP_CFG_18(bank, fn, sfx, cfg),                             \
-       PORT_GP_CFG_1(bank, 18, fn, sfx, cfg),                          \
+       PORT_GP_CFG_1(bank, 18, fn, sfx, cfg)
+#define PORT_GP_19(bank, fn, sfx)      PORT_GP_CFG_19(bank, fn, sfx, 0)
+
+#define PORT_GP_CFG_20(bank, fn, sfx, cfg)                             \
+       PORT_GP_CFG_19(bank, fn, sfx, cfg),                             \
        PORT_GP_CFG_1(bank, 19, fn, sfx, cfg)
 #define PORT_GP_20(bank, fn, sfx)      PORT_GP_CFG_20(bank, fn, sfx, 0)
 
@@ -624,13 +611,12 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info;
 #define GP_ALL(str)                    CPU_ALL_GP(_GP_ALL, str)
 
 /* PINMUX_GPIO_GP_ALL - Expand to a list of sh_pfc_pin entries */
-#define _GP_GPIO(bank, _pin, _name, sfx, cfg)                          \
-       {                                                               \
-               .pin = (bank * 32) + _pin,                              \
-               .name = __stringify(_name),                             \
-               .enum_id = _name##_DATA,                                \
-               .configs = cfg,                                         \
-       }
+#define _GP_GPIO(bank, _pin, _name, sfx, cfg) {                                \
+       .pin = (bank * 32) + _pin,                                      \
+       .name = __stringify(_name),                                     \
+       .enum_id = _name##_DATA,                                        \
+       .configs = cfg,                                                 \
+}
 #define PINMUX_GPIO_GP_ALL()           CPU_ALL_GP(_GP_GPIO, unused)
 
 /* PINMUX_DATA_GP_ALL -  Expand to a list of name_DATA, name_FN marks */
@@ -688,13 +674,12 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info;
        }
 
 /* SH_PFC_PIN_CFG - Expand to a sh_pfc_pin entry (named PORT#) with config */
-#define SH_PFC_PIN_CFG(_pin, cfgs)                                     \
-       {                                                               \
-               .pin = _pin,                                            \
-               .name = __stringify(PORT##_pin),                        \
-               .enum_id = PORT##_pin##_DATA,                           \
-               .configs = cfgs,                                        \
-       }
+#define SH_PFC_PIN_CFG(_pin, cfgs) {                                   \
+       .pin = _pin,                                                    \
+       .name = __stringify(PORT##_pin),                                \
+       .enum_id = PORT##_pin##_DATA,                                   \
+       .configs = cfgs,                                                \
+}
 
 /* PINMUX_DATA_ALL - Expand to a list of PORT_name_DATA, PORT_name_FN0,
  *                  PORT_name_OUT, PORT_name_IN marks
@@ -743,35 +728,32 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info;
 #define NOGP_ALL()                             CPU_ALL_NOGP(_NOGP_ALL)
 
 /* PINMUX_NOGP_ALL - Expand to a list of sh_pfc_pin entries */
-#define _NOGP_PINMUX(_pin, _name, cfg)                                 \
-       {                                                               \
-               .pin = PIN_##_pin,                                      \
-               .name = "PIN_" _name,                                   \
-               .configs = SH_PFC_PIN_CFG_NO_GPIO | cfg,                \
-       }
+#define _NOGP_PINMUX(_pin, _name, cfg) {                               \
+       .pin = PIN_##_pin,                                              \
+       .name = "PIN_" _name,                                           \
+       .configs = SH_PFC_PIN_CFG_NO_GPIO | cfg,                        \
+}
 #define PINMUX_NOGP_ALL()              CPU_ALL_NOGP(_NOGP_PINMUX)
 
 /*
  * PORTnCR helper macro for SH-Mobile/R-Mobile
  */
-#define PORTCR(nr, reg)                                                        \
-       {                                                               \
-               PINMUX_CFG_REG_VAR("PORT" nr "CR", reg, 8,              \
-                                  GROUP(2, 2, 1, 3),                   \
-                                  GROUP(                               \
-                       /* PULMD[1:0], handled by .set_bias() */        \
-                       0, 0, 0, 0,                                     \
-                       /* IE and OE */                                 \
-                       0, PORT##nr##_OUT, PORT##nr##_IN, 0,            \
-                       /* SEC, not supported */                        \
-                       0, 0,                                           \
-                       /* PTMD[2:0] */                                 \
-                       PORT##nr##_FN0, PORT##nr##_FN1,                 \
-                       PORT##nr##_FN2, PORT##nr##_FN3,                 \
-                       PORT##nr##_FN4, PORT##nr##_FN5,                 \
-                       PORT##nr##_FN6, PORT##nr##_FN7                  \
-               ))                                                      \
-       }
+#define PORTCR(nr, reg) {                                              \
+       PINMUX_CFG_REG_VAR("PORT" nr "CR", reg, 8, GROUP(2, 2, 1, 3),   \
+                          GROUP(                                       \
+               /* PULMD[1:0], handled by .set_bias() */                \
+               0, 0, 0, 0,                                             \
+               /* IE and OE */                                         \
+               0, PORT##nr##_OUT, PORT##nr##_IN, 0,                    \
+               /* SEC, not supported */                                \
+               0, 0,                                                   \
+               /* PTMD[2:0] */                                         \
+               PORT##nr##_FN0, PORT##nr##_FN1,                         \
+               PORT##nr##_FN2, PORT##nr##_FN3,                         \
+               PORT##nr##_FN4, PORT##nr##_FN5,                         \
+               PORT##nr##_FN6, PORT##nr##_FN7                          \
+       ))                                                              \
+}
 
 /*
  * GPIO number helper macro for R-Car
@@ -782,7 +764,7 @@ extern const struct sh_pfc_soc_info shx3_pinmux_info;
  * Bias helpers
  */
 const struct pinmux_bias_reg *
-rcar_pin_to_bias_reg(const struct sh_pfc *pfc, unsigned int pin,
+rcar_pin_to_bias_reg(const struct sh_pfc_soc_info *info, unsigned int pin,
                     unsigned int *bit);
 unsigned int rcar_pinmux_get_bias(struct sh_pfc *pfc, unsigned int pin);
 void rcar_pinmux_set_bias(struct sh_pfc *pfc, unsigned int pin,
index 2e490e7..d291819 100644 (file)
@@ -585,13 +585,11 @@ static const struct samsung_pin_ctrl exynos850_pin_ctrl[] __initconst = {
                /* pin-controller instance 0 ALIVE data */
                .pin_banks      = exynos850_pin_banks0,
                .nr_banks       = ARRAY_SIZE(exynos850_pin_banks0),
-               .eint_gpio_init = exynos_eint_gpio_init,
                .eint_wkup_init = exynos_eint_wkup_init,
        }, {
                /* pin-controller instance 1 CMGP data */
                .pin_banks      = exynos850_pin_banks1,
                .nr_banks       = ARRAY_SIZE(exynos850_pin_banks1),
-               .eint_gpio_init = exynos_eint_gpio_init,
                .eint_wkup_init = exynos_eint_wkup_init,
        }, {
                /* pin-controller instance 2 AUD data */
@@ -727,3 +725,74 @@ const struct samsung_pinctrl_of_match_data exynosautov9_of_data __initconst = {
        .ctrl           = exynosautov9_pin_ctrl,
        .num_ctrl       = ARRAY_SIZE(exynosautov9_pin_ctrl),
 };
+
+/*
+ * Pinctrl driver data for Tesla FSD SoC. FSD SoC includes three
+ * gpio/pin-mux/pinconfig controllers.
+ */
+
+/* pin banks of FSD pin-controller 0 (FSYS) */
+static const struct samsung_pin_bank_data fsd_pin_banks0[] __initconst = {
+       EXYNOS850_PIN_BANK_EINTG(7, 0x00, "gpf0", 0x00),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x20, "gpf1", 0x04),
+       EXYNOS850_PIN_BANK_EINTG(3, 0x40, "gpf6", 0x08),
+       EXYNOS850_PIN_BANK_EINTG(2, 0x60, "gpf4", 0x0c),
+       EXYNOS850_PIN_BANK_EINTG(6, 0x80, "gpf5", 0x10),
+};
+
+/* pin banks of FSD pin-controller 1 (PERIC) */
+static const struct samsung_pin_bank_data fsd_pin_banks1[] __initconst = {
+       EXYNOS850_PIN_BANK_EINTG(4, 0x000, "gpc8", 0x00),
+       EXYNOS850_PIN_BANK_EINTG(7, 0x020, "gpf2", 0x04),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x040, "gpf3", 0x08),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x060, "gpd0", 0x0c),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x080, "gpb0", 0x10),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x0a0, "gpb1", 0x14),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x0c0, "gpb4", 0x18),
+       EXYNOS850_PIN_BANK_EINTG(4, 0x0e0, "gpb5", 0x1c),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x100, "gpb6", 0x20),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x120, "gpb7", 0x24),
+       EXYNOS850_PIN_BANK_EINTG(5, 0x140, "gpd1", 0x28),
+       EXYNOS850_PIN_BANK_EINTG(5, 0x160, "gpd2", 0x2c),
+       EXYNOS850_PIN_BANK_EINTG(7, 0x180, "gpd3", 0x30),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x1a0, "gpg0", 0x34),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x1c0, "gpg1", 0x38),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x1e0, "gpg2", 0x3c),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x200, "gpg3", 0x40),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x220, "gpg4", 0x44),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x240, "gpg5", 0x48),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x260, "gpg6", 0x4c),
+       EXYNOS850_PIN_BANK_EINTG(8, 0x280, "gpg7", 0x50),
+};
+
+/* pin banks of FSD pin-controller 2 (PMU) */
+static const struct samsung_pin_bank_data fsd_pin_banks2[] __initconst = {
+       EXYNOS850_PIN_BANK_EINTN(3, 0x00, "gpq0"),
+};
+
+const struct samsung_pin_ctrl fsd_pin_ctrl[] __initconst = {
+       {
+               /* pin-controller instance 0 FSYS0 data */
+               .pin_banks      = fsd_pin_banks0,
+               .nr_banks       = ARRAY_SIZE(fsd_pin_banks0),
+               .eint_gpio_init = exynos_eint_gpio_init,
+               .suspend        = exynos_pinctrl_suspend,
+               .resume         = exynos_pinctrl_resume,
+       }, {
+               /* pin-controller instance 1 PERIC data */
+               .pin_banks      = fsd_pin_banks1,
+               .nr_banks       = ARRAY_SIZE(fsd_pin_banks1),
+               .eint_gpio_init = exynos_eint_gpio_init,
+               .suspend        = exynos_pinctrl_suspend,
+               .resume         = exynos_pinctrl_resume,
+       }, {
+               /* pin-controller instance 2 PMU data */
+               .pin_banks      = fsd_pin_banks2,
+               .nr_banks       = ARRAY_SIZE(fsd_pin_banks2),
+       },
+};
+
+const struct samsung_pinctrl_of_match_data fsd_of_data __initconst = {
+       .ctrl           = fsd_pin_ctrl,
+       .num_ctrl       = ARRAY_SIZE(fsd_pin_ctrl),
+};
index 0489c89..c1c4ffb 100644 (file)
@@ -344,7 +344,8 @@ static int exynos_wkup_irq_set_wake(struct irq_data *irqd, unsigned int on)
        struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd);
        unsigned long bit = 1UL << (2 * bank->eint_offset + irqd->hwirq);
 
-       pr_info("wake %s for irq %d\n", on ? "enabled" : "disabled", irqd->irq);
+       pr_info("wake %s for irq %u (%s-%lu)\n", on ? "enabled" : "disabled",
+               irqd->irq, bank->name, irqd->hwirq);
 
        if (!on)
                *our_chip->eint_wake_mask_value |= bit;
@@ -465,6 +466,10 @@ static const struct of_device_id exynos_wkup_irq_ids[] = {
                        .data = &exynos4210_wkup_irq_chip },
        { .compatible = "samsung,exynos7-wakeup-eint",
                        .data = &exynos7_wkup_irq_chip },
+       { .compatible = "samsung,exynos850-wakeup-eint",
+                       .data = &exynos7_wkup_irq_chip },
+       { .compatible = "samsung,exynosautov9-wakeup-eint",
+                       .data = &exynos7_wkup_irq_chip },
        { }
 };
 
index 0f6e930..f610bea 100644 (file)
@@ -1002,13 +1002,66 @@ samsung_pinctrl_get_soc_data_for_of_alias(struct platform_device *pdev)
        return &(of_data->ctrl[id]);
 }
 
+static void samsung_banks_of_node_put(struct samsung_pinctrl_drv_data *d)
+{
+       struct samsung_pin_bank *bank;
+       unsigned int i;
+
+       bank = d->pin_banks;
+       for (i = 0; i < d->nr_banks; ++i, ++bank)
+               of_node_put(bank->of_node);
+}
+
+/*
+ * Iterate over all driver pin banks to find one matching the name of node,
+ * skipping optional "-gpio" node suffix. When found, assign node to the bank.
+ */
+static void samsung_banks_of_node_get(struct device *dev,
+                                     struct samsung_pinctrl_drv_data *d,
+                                     struct device_node *node)
+{
+       const char *suffix = "-gpio-bank";
+       struct samsung_pin_bank *bank;
+       struct device_node *child;
+       /* Pin bank names are up to 4 characters */
+       char node_name[20];
+       unsigned int i;
+       size_t len;
+
+       bank = d->pin_banks;
+       for (i = 0; i < d->nr_banks; ++i, ++bank) {
+               strscpy(node_name, bank->name, sizeof(node_name));
+               len = strlcat(node_name, suffix, sizeof(node_name));
+               if (len >= sizeof(node_name)) {
+                       dev_err(dev, "Too long pin bank name '%s', ignoring\n",
+                               bank->name);
+                       continue;
+               }
+
+               for_each_child_of_node(node, child) {
+                       if (!of_find_property(child, "gpio-controller", NULL))
+                               continue;
+                       if (of_node_name_eq(child, node_name))
+                               break;
+                       else if (of_node_name_eq(child, bank->name))
+                               break;
+               }
+
+               if (child)
+                       bank->of_node = child;
+               else
+                       dev_warn(dev, "Missing node for bank %s - invalid DTB\n",
+                                bank->name);
+               /* child reference dropped in samsung_drop_banks_of_node() */
+       }
+}
+
 /* retrieve the soc specific data */
 static const struct samsung_pin_ctrl *
 samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
                             struct platform_device *pdev)
 {
        struct device_node *node = pdev->dev.of_node;
-       struct device_node *np;
        const struct samsung_pin_bank_data *bdata;
        const struct samsung_pin_ctrl *ctrl;
        struct samsung_pin_bank *bank;
@@ -1072,17 +1125,7 @@ samsung_pinctrl_get_soc_data(struct samsung_pinctrl_drv_data *d,
         */
        d->virt_base = virt_base[0];
 
-       for_each_child_of_node(node, np) {
-               if (!of_find_property(np, "gpio-controller", NULL))
-                       continue;
-               bank = d->pin_banks;
-               for (i = 0; i < d->nr_banks; ++i, ++bank) {
-                       if (of_node_name_eq(np, bank->name)) {
-                               bank->of_node = np;
-                               break;
-                       }
-               }
-       }
+       samsung_banks_of_node_get(&pdev->dev, d, node);
 
        d->pin_base = pin_base;
        pin_base += d->nr_pins;
@@ -1117,19 +1160,19 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
        if (ctrl->retention_data) {
                drvdata->retention_ctrl = ctrl->retention_data->init(drvdata,
                                                          ctrl->retention_data);
-               if (IS_ERR(drvdata->retention_ctrl))
-                       return PTR_ERR(drvdata->retention_ctrl);
+               if (IS_ERR(drvdata->retention_ctrl)) {
+                       ret = PTR_ERR(drvdata->retention_ctrl);
+                       goto err_put_banks;
+               }
        }
 
        ret = samsung_pinctrl_register(pdev, drvdata);
        if (ret)
-               return ret;
+               goto err_put_banks;
 
        ret = samsung_gpiolib_register(pdev, drvdata);
-       if (ret) {
-               samsung_pinctrl_unregister(pdev, drvdata);
-               return ret;
-       }
+       if (ret)
+               goto err_unregister;
 
        if (ctrl->eint_gpio_init)
                ctrl->eint_gpio_init(drvdata);
@@ -1139,6 +1182,12 @@ static int samsung_pinctrl_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, drvdata);
 
        return 0;
+
+err_unregister:
+       samsung_pinctrl_unregister(pdev, drvdata);
+err_put_banks:
+       samsung_banks_of_node_put(drvdata);
+       return ret;
 }
 
 /*
@@ -1271,6 +1320,8 @@ static const struct of_device_id samsung_pinctrl_dt_match[] = {
                .data = &exynos850_of_data },
        { .compatible = "samsung,exynosautov9-pinctrl",
                .data = &exynosautov9_of_data },
+       { .compatible = "tesla,fsd-pinctrl",
+               .data = &fsd_of_data },
 #endif
 #ifdef CONFIG_PINCTRL_S3C64XX
        { .compatible = "samsung,s3c64xx-pinctrl",
index 1f8d30b..5b32d3f 100644 (file)
@@ -342,6 +342,7 @@ extern const struct samsung_pinctrl_of_match_data exynos7_of_data;
 extern const struct samsung_pinctrl_of_match_data exynos7885_of_data;
 extern const struct samsung_pinctrl_of_match_data exynos850_of_data;
 extern const struct samsung_pinctrl_of_match_data exynosautov9_of_data;
+extern const struct samsung_pinctrl_of_match_data fsd_of_data;
 extern const struct samsung_pinctrl_of_match_data s3c64xx_of_data;
 extern const struct samsung_pinctrl_of_match_data s3c2412_of_data;
 extern const struct samsung_pinctrl_of_match_data s3c2416_of_data;
diff --git a/drivers/pinctrl/sunplus/Kconfig b/drivers/pinctrl/sunplus/Kconfig
new file mode 100644 (file)
index 0000000..4b5c47c
--- /dev/null
@@ -0,0 +1,22 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Sunplus Pin control driver configuration
+#
+
+config PINCTRL_SPPCTL
+       tristate "Sunplus SP7021 PinMux and GPIO driver"
+       depends on SOC_SP7021
+       depends on OF && HAS_IOMEM
+       select GENERIC_PINCTRL_GROUPS
+       select GENERIC_PINMUX_FUNCTIONS
+       select GENERIC_PINCONF
+       select PINCONF
+       select PINMUX
+       select GPIOLIB
+       select OF_GPIO
+       help
+         Say Y here to support Sunplus SP7021 pinmux controller.
+         This driver requires the pinctrl framework.
+         GPIO is provided by the same driver.
+         To compile this driver as a module, choose M here.
+         The module will be called sppinctrl.
diff --git a/drivers/pinctrl/sunplus/Makefile b/drivers/pinctrl/sunplus/Makefile
new file mode 100644 (file)
index 0000000..a26952c
--- /dev/null
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for the Sunplus Pin control drivers.
+#
+obj-$(CONFIG_PINCTRL_SPPCTL) += sppinctrl.o
+sppinctrl-objs := sppctl.o sppctl_sp7021.o
diff --git a/drivers/pinctrl/sunplus/sppctl.c b/drivers/pinctrl/sunplus/sppctl.c
new file mode 100644 (file)
index 0000000..3ba4704
--- /dev/null
@@ -0,0 +1,1118 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SP7021 Pin Controller Driver.
+ * Copyright (C) Sunplus Tech / Tibbo Tech.
+ */
+
+#include <linux/bitfield.h>
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/gpio/driver.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/overflow.h>
+#include <linux/platform_device.h>
+#include <linux/seq_file.h>
+#include <linux/slab.h>
+
+#include <linux/pinctrl/pinconf.h>
+#include <linux/pinctrl/pinconf-generic.h>
+#include <linux/pinctrl/pinmux.h>
+
+#include <dt-bindings/pinctrl/sppctl-sp7021.h>
+
+#include "../core.h"
+#include "../pinctrl-utils.h"
+
+#include "sppctl.h"
+
+struct sppctl_gpio_chip {
+       void __iomem *gpioxt_base;      /* MASTER, OE, OUT, IN, I_INV, O_INV, OD */
+       void __iomem *first_base;       /* GPIO_FIRST                            */
+
+       struct gpio_chip chip;
+       spinlock_t lock;                /* lock for accessing OE register        */
+};
+
+static inline u32 sppctl_first_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->first_base + SPPCTL_GPIO_OFF_FIRST + off);
+}
+
+static inline void sppctl_first_writel(struct sppctl_gpio_chip *spp_gchip, u32 val, u32 off)
+{
+       writel(val, spp_gchip->first_base + SPPCTL_GPIO_OFF_FIRST + off);
+}
+
+static inline u32 sppctl_gpio_master_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_MASTER + off);
+}
+
+static inline void sppctl_gpio_master_writel(struct sppctl_gpio_chip *spp_gchip, u32 val,
+                                            u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_MASTER + off);
+}
+
+static inline u32 sppctl_gpio_oe_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OE + off);
+}
+
+static inline void sppctl_gpio_oe_writel(struct sppctl_gpio_chip *spp_gchip, u32 val, u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OE + off);
+}
+
+static inline void sppctl_gpio_out_writel(struct sppctl_gpio_chip *spp_gchip, u32 val, u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OUT + off);
+}
+
+static inline u32 sppctl_gpio_in_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_IN + off);
+}
+
+static inline u32 sppctl_gpio_iinv_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_IINV + off);
+}
+
+static inline void sppctl_gpio_iinv_writel(struct sppctl_gpio_chip *spp_gchip, u32 val,
+                                          u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_IINV + off);
+}
+
+static inline u32 sppctl_gpio_oinv_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OINV + off);
+}
+
+static inline void sppctl_gpio_oinv_writel(struct sppctl_gpio_chip *spp_gchip, u32 val,
+                                          u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OINV + off);
+}
+
+static inline u32 sppctl_gpio_od_readl(struct sppctl_gpio_chip *spp_gchip, u32 off)
+{
+       return readl(spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OD + off);
+}
+
+static inline void sppctl_gpio_od_writel(struct sppctl_gpio_chip *spp_gchip, u32 val, u32 off)
+{
+       writel(val, spp_gchip->gpioxt_base + SPPCTL_GPIO_OFF_OD + off);
+}
+
+static inline u32 sppctl_get_reg_and_bit_offset(unsigned int offset, u32 *reg_off)
+{
+       u32 bit_off;
+
+       /* Each register has 32 bits. */
+       *reg_off = (offset / 32) * 4;
+       bit_off = offset % 32;
+
+       return bit_off;
+}
+
+static inline u32 sppctl_get_moon_reg_and_bit_offset(unsigned int offset, u32 *reg_off)
+{
+       u32 bit_off;
+
+       /*
+        * Each MOON register has 32 bits. Upper 16-bit word are mask-fields.
+        * The lower 16-bit word are the control-fields. The corresponding
+        * bits in mask-field should be set then you can write something to
+        * control-field.
+        */
+       *reg_off = (offset / 16) * 4;
+       bit_off = offset % 16;
+
+       return bit_off;
+}
+
+static inline u32 sppctl_prep_moon_reg_and_offset(unsigned int offset, u32 *reg_off, int val)
+{
+       u32 bit_off;
+
+       bit_off = sppctl_get_moon_reg_and_bit_offset(offset, reg_off);
+       if (val)
+               return SPPCTL_SET_MOON_REG_BIT(bit_off);
+       else
+               return SPPCTL_CLR_MOON_REG_BIT(bit_off);
+}
+
+/**
+ * sppctl_func_set() - Set pin of fully-pinmux function.
+ *
+ * Mask-fields and control-fields of fully-pinmux function of SP7021 are
+ * arranged as shown below:
+ *
+ *  func# | register |  mask-field  | control-field
+ * -------+----------+--------------+---------------
+ *    0   | base[0]  |  (22 : 16)   |   ( 6 : 0)
+ *    1   | base[0]  |  (30 : 24)   |   (14 : 8)
+ *    2   | base[1]  |  (22 : 16)   |   ( 6 : 0)
+ *    3   | baeg[1]  |  (30 : 24)   |   (14 : 8)
+ *    :   |    :     |      :       |       :
+ *
+ * where mask-fields are used to protect control-fields from write-in
+ * accidentally. Set the corresponding bits in the mask-field before
+ * you write a value into a control-field.
+ *
+ * Control-fields are used to set where the function pin is going to
+ * be routed to.
+ *
+ * Note that mask-fields and control-fields of even number of 'func'
+ * are located at bits (22:16) and (6:0), while odd number of 'func's
+ * are located at bits (30:24) and (14:8).
+ */
+static void sppctl_func_set(struct sppctl_pdata *pctl, u8 func, u8 val)
+{
+       u32 reg, offset;
+
+       /*
+        * Note that upper 16-bit word are mask-fields and lower 16-bit
+        * word are the control-fields. Set corresponding bits in mask-
+        * field before write to a control-field.
+        */
+       reg = SPPCTL_FULLY_PINMUX_MASK_MASK | val;
+
+       /*
+        * MUXF_L2SW_CLK_OUT is the first fully-pinmux pin
+        * and its register offset is 0.
+        */
+       func -= MUXF_L2SW_CLK_OUT;
+
+       /*
+        * Check if 'func' is an odd number or not. Mask and control-
+        * fields of odd number 'func' is located at upper portion of
+        * a register. Extra shift is needed.
+        */
+       if (func & BIT(0))
+               reg <<= SPPCTL_FULLY_PINMUX_UPPER_SHIFT;
+
+       /* Convert func# to register offset w.r.t. base register. */
+       offset = func * 2;
+       offset &= GENMASK(31, 2);
+
+       writel(reg, pctl->moon2_base + offset);
+}
+
+/**
+ * sppctl_gmx_set() - Set pin of group-pinmux.
+ *
+ * Mask-fields and control-fields of group-pinmux function of SP7021 are
+ * arranged as shown below:
+ *
+ *  register |  mask-fields | control-fields
+ * ----------+--------------+----------------
+ *  base[0]  |  (31 : 16)   |   (15 : 0)
+ *  base[1]  |  (31 : 24)   |   (15 : 0)
+ *  base[2]  |  (31 : 24)   |   (15 : 0)
+ *     :     |      :       |       :
+ *
+ * where mask-fields are used to protect control-fields from write-in
+ * accidentally. Set the corresponding bits in the mask-field before
+ * you write a value into a control-field.
+ *
+ * Control-fields are used to set where the function pin is going to
+ * be routed to. A control-field consists of one or more bits.
+ */
+static void sppctl_gmx_set(struct sppctl_pdata *pctl, u8 reg_off, u8 bit_off, u8 bit_sz,
+                          u8 val)
+{
+       u32 mask, reg;
+
+       /*
+        * Note that upper 16-bit word are mask-fields and lower 16-bit
+        * word are the control-fields. Set corresponding bits in mask-
+        * field before write to a control-field.
+        */
+       mask = GENMASK(bit_sz - 1, 0) << SPPCTL_MOON_REG_MASK_SHIFT;
+       reg = (mask | val) << bit_off;
+
+       writel(reg, pctl->moon1_base + reg_off * 4);
+}
+
+/**
+ * sppctl_first_get() - get bit of FIRST register.
+ *
+ * There are 4 FIRST registers. Each has 32 control-bits.
+ * Totally, there are 4 * 32 = 128 control-bits.
+ * Control-bits are arranged as shown below:
+ *
+ *  registers | control-bits
+ * -----------+--------------
+ *  first[0]  |  (31 :  0)
+ *  first[1]  |  (63 : 32)
+ *  first[2]  |  (95 : 64)
+ *  first[3]  | (127 : 96)
+ *
+ * Each control-bit sets type of a GPIO pin.
+ *   0: a fully-pinmux pin
+ *   1: a GPIO or IOP pin
+ */
+static int sppctl_first_get(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+
+       bit_off = sppctl_get_reg_and_bit_offset(offset, &reg_off);
+       reg = sppctl_first_readl(spp_gchip, reg_off);
+
+       return (reg & BIT(bit_off)) ? 1 : 0;
+}
+
+/**
+ * sppctl_master_get() - get bit of MASTER register.
+ *
+ * There are 8 MASTER registers. Each has 16 mask-bits and 16 control-bits.
+ * Upper 16-bit of MASTER registers are mask-bits while lower 16-bit are
+ * control-bits. Totally, there are 128 mask-bits and 128 control-bits.
+ * They are arranged as shown below:
+ *
+ *  register  |  mask-bits  | control-bits
+ * -----------+-------------+--------------
+ *  master[0] |  (15 :   0) |  (15 :   0)
+ *  master[1] |  (31 :  16) |  (31 :  16)
+ *  master[2] |  (47 :  32) |  (47 :  32)
+ *     :      |      :      |      :
+ *  master[7] | (127 : 112) | (127 : 112)
+ *
+ * where mask-bits are used to protect control-bits from write-in
+ * accidentally. Set the corresponding mask-bit before you write
+ * a value into a control-bit.
+ *
+ * Each control-bit sets type of a GPIO pin when FIRST bit is 1.
+ *   0: a IOP pin
+ *   1: a GPIO pin
+ */
+static int sppctl_master_get(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+
+       bit_off = sppctl_get_moon_reg_and_bit_offset(offset, &reg_off);
+       reg = sppctl_gpio_master_readl(spp_gchip, reg_off);
+       return (reg & BIT(bit_off)) ? 1 : 0;
+}
+
+static void sppctl_first_master_set(struct gpio_chip *chip, unsigned int offset,
+                                   enum mux_first_reg first, enum mux_master_reg master)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+       enum mux_first_reg val;
+
+       /* FIRST register */
+       if (first != mux_f_keep) {
+               bit_off = sppctl_get_reg_and_bit_offset(offset, &reg_off);
+               reg = sppctl_first_readl(spp_gchip, reg_off);
+               val = (reg & BIT(bit_off)) ? mux_f_gpio : mux_f_mux;
+
+               if (first != val)
+                       switch (first) {
+                       case mux_f_gpio:
+                               reg |= BIT(bit_off);
+                               sppctl_first_writel(spp_gchip, reg, reg_off);
+                               break;
+
+                       case mux_f_mux:
+                               reg &= ~BIT(bit_off);
+                               sppctl_first_writel(spp_gchip, reg, reg_off);
+                               break;
+
+                       case mux_f_keep:
+                               break;
+                       }
+       }
+
+       /* MASTER register */
+       if (master != mux_m_keep) {
+               reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, (master == mux_m_gpio));
+               sppctl_gpio_master_writel(spp_gchip, reg, reg_off);
+       }
+}
+
+static void sppctl_gpio_input_inv_set(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, 1);
+       sppctl_gpio_iinv_writel(spp_gchip, reg, reg_off);
+}
+
+static void sppctl_gpio_output_inv_set(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, 1);
+       sppctl_gpio_oinv_writel(spp_gchip, reg, reg_off);
+}
+
+static int sppctl_gpio_output_od_get(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+
+       bit_off = sppctl_get_moon_reg_and_bit_offset(offset, &reg_off);
+       reg = sppctl_gpio_od_readl(spp_gchip, reg_off);
+
+       return (reg & BIT(bit_off)) ? 1 : 0;
+}
+
+static void sppctl_gpio_output_od_set(struct gpio_chip *chip, unsigned int offset,
+                                     unsigned int val)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, val);
+       sppctl_gpio_od_writel(spp_gchip, reg, reg_off);
+}
+
+static int sppctl_gpio_get_direction(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+
+       bit_off = sppctl_get_moon_reg_and_bit_offset(offset, &reg_off);
+       reg = sppctl_gpio_oe_readl(spp_gchip, reg_off);
+
+       return (reg & BIT(bit_off)) ? 0 : 1;
+}
+
+static int sppctl_gpio_inv_get(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+       unsigned long flags;
+
+       bit_off = sppctl_get_moon_reg_and_bit_offset(offset, &reg_off);
+
+       spin_lock_irqsave(&spp_gchip->lock, flags);
+
+       if (sppctl_gpio_get_direction(chip, offset))
+               reg = sppctl_gpio_iinv_readl(spp_gchip, reg_off);
+       else
+               reg = sppctl_gpio_oinv_readl(spp_gchip, reg_off);
+
+       spin_unlock_irqrestore(&spp_gchip->lock, flags);
+
+       return (reg & BIT(bit_off)) ? 1 : 0;
+}
+
+static int sppctl_gpio_direction_input(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       unsigned long flags;
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, 0);
+
+       spin_lock_irqsave(&spp_gchip->lock, flags);
+
+       sppctl_gpio_oe_writel(spp_gchip, reg, reg_off);
+
+       spin_unlock_irqrestore(&spp_gchip->lock, flags);
+       return 0;
+}
+
+static int sppctl_gpio_direction_output(struct gpio_chip *chip, unsigned int offset, int val)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       unsigned long flags;
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, 1);
+
+       spin_lock_irqsave(&spp_gchip->lock, flags);
+
+       sppctl_gpio_oe_writel(spp_gchip, reg, reg_off);
+
+       if (val < 0) {
+               spin_unlock_irqrestore(&spp_gchip->lock, flags);
+               return 0;
+       }
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, val);
+       sppctl_gpio_out_writel(spp_gchip, reg, reg_off);
+
+       spin_unlock_irqrestore(&spp_gchip->lock, flags);
+       return 0;
+}
+
+static int sppctl_gpio_get(struct gpio_chip *chip, unsigned int offset)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, bit_off, reg;
+
+       bit_off = sppctl_get_reg_and_bit_offset(offset, &reg_off);
+       reg = sppctl_gpio_in_readl(spp_gchip, reg_off);
+
+       return (reg & BIT(bit_off)) ? 1 : 0;
+}
+
+static void sppctl_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
+{
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, reg;
+
+       reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, val);
+       sppctl_gpio_out_writel(spp_gchip, reg, reg_off);
+}
+
+static int sppctl_gpio_set_config(struct gpio_chip *chip, unsigned int offset,
+                                 unsigned long config)
+{
+       enum pin_config_param param = pinconf_to_config_param(config);
+       struct sppctl_gpio_chip *spp_gchip = gpiochip_get_data(chip);
+       u32 reg_off, reg;
+
+       switch (param) {
+       case PIN_CONFIG_DRIVE_OPEN_DRAIN:
+               reg = sppctl_prep_moon_reg_and_offset(offset, &reg_off, 1);
+               sppctl_gpio_od_writel(spp_gchip, reg, reg_off);
+               break;
+
+       case PIN_CONFIG_INPUT_ENABLE:
+               break;
+
+       case PIN_CONFIG_OUTPUT:
+               return sppctl_gpio_direction_output(chip, offset, 0);
+
+       case PIN_CONFIG_PERSIST_STATE:
+               return -ENOTSUPP;
+
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+#ifdef CONFIG_DEBUG_FS
+static void sppctl_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
+{
+       const char *label;
+       int i;
+
+       for (i = 0; i < chip->ngpio; i++) {
+               label = gpiochip_is_requested(chip, i);
+               if (!label)
+                       label = "";
+
+               seq_printf(s, " gpio-%03d (%-16.16s | %-16.16s)", i + chip->base,
+                          chip->names[i], label);
+               seq_printf(s, " %c", sppctl_gpio_get_direction(chip, i) ? 'I' : 'O');
+               seq_printf(s, ":%d", sppctl_gpio_get(chip, i));
+               seq_printf(s, " %s", sppctl_first_get(chip, i) ? "gpi" : "mux");
+               seq_printf(s, " %s", sppctl_master_get(chip, i) ? "gpi" : "iop");
+               seq_printf(s, " %s", sppctl_gpio_inv_get(chip, i) ? "inv" : "   ");
+               seq_printf(s, " %s", sppctl_gpio_output_od_get(chip, i) ? "oDr" : "");
+               seq_puts(s, "\n");
+       }
+}
+#endif
+
+static int sppctl_gpio_new(struct platform_device *pdev, struct sppctl_pdata *pctl)
+{
+       struct sppctl_gpio_chip *spp_gchip;
+       struct gpio_chip *gchip;
+       int err;
+
+       spp_gchip = devm_kzalloc(&pdev->dev, sizeof(*spp_gchip), GFP_KERNEL);
+       if (!spp_gchip)
+               return -ENOMEM;
+       pctl->spp_gchip = spp_gchip;
+
+       spp_gchip->gpioxt_base  = pctl->gpioxt_base;
+       spp_gchip->first_base   = pctl->first_base;
+       spin_lock_init(&spp_gchip->lock);
+
+       gchip                   = &spp_gchip->chip;
+       gchip->label            = SPPCTL_MODULE_NAME;
+       gchip->parent           = &pdev->dev;
+       gchip->owner            = THIS_MODULE;
+       gchip->request          = gpiochip_generic_request;
+       gchip->free             = gpiochip_generic_free;
+       gchip->get_direction    = sppctl_gpio_get_direction;
+       gchip->direction_input  = sppctl_gpio_direction_input;
+       gchip->direction_output = sppctl_gpio_direction_output;
+       gchip->get              = sppctl_gpio_get;
+       gchip->set              = sppctl_gpio_set;
+       gchip->set_config       = sppctl_gpio_set_config;
+#ifdef CONFIG_DEBUG_FS
+       gchip->dbg_show         = sppctl_gpio_dbg_show;
+#endif
+       gchip->base             = -1;
+       gchip->ngpio            = sppctl_gpio_list_sz;
+       gchip->names            = sppctl_gpio_list_s;
+       gchip->of_gpio_n_cells  = 2;
+
+       pctl->pctl_grange.npins = gchip->ngpio;
+       pctl->pctl_grange.name  = gchip->label;
+       pctl->pctl_grange.gc    = gchip;
+
+       err = devm_gpiochip_add_data(&pdev->dev, gchip, spp_gchip);
+       if (err)
+               return dev_err_probe(&pdev->dev, err, "Failed to add gpiochip!\n");
+
+       return 0;
+}
+
+static int sppctl_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin,
+                                unsigned long *config)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       unsigned int param = pinconf_to_config_param(*config);
+       unsigned int arg;
+
+       switch (param) {
+       case PIN_CONFIG_DRIVE_OPEN_DRAIN:
+               if (!sppctl_gpio_output_od_get(&pctl->spp_gchip->chip, pin))
+                       return -EINVAL;
+               arg = 0;
+               break;
+
+       case PIN_CONFIG_OUTPUT:
+               if (!sppctl_first_get(&pctl->spp_gchip->chip, pin))
+                       return -EINVAL;
+               if (!sppctl_master_get(&pctl->spp_gchip->chip, pin))
+                       return -EINVAL;
+               if (sppctl_gpio_get_direction(&pctl->spp_gchip->chip, pin))
+                       return -EINVAL;
+               arg = sppctl_gpio_get(&pctl->spp_gchip->chip, pin);
+               break;
+
+       default:
+               return -EOPNOTSUPP;
+       }
+       *config = pinconf_to_config_packed(param, arg);
+
+       return 0;
+}
+
+static int sppctl_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
+                                unsigned long *configs, unsigned int num_configs)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       int i;
+
+       /* Special handling for IOP pins */
+       if (configs[0] == SPPCTL_IOP_CONFIGS) {
+               sppctl_first_master_set(&pctl->spp_gchip->chip, pin, mux_f_gpio, mux_m_iop);
+               return 0;
+       }
+
+       for (i = 0; i < num_configs; i++) {
+               if (configs[i] & SPPCTL_PCTL_L_OUT)
+                       sppctl_gpio_direction_output(&pctl->spp_gchip->chip, pin, 0);
+               if (configs[i] & SPPCTL_PCTL_L_OU1)
+                       sppctl_gpio_direction_output(&pctl->spp_gchip->chip, pin, 1);
+               if (configs[i] & SPPCTL_PCTL_L_INV)
+                       sppctl_gpio_input_inv_set(&pctl->spp_gchip->chip, pin);
+               if (configs[i] & SPPCTL_PCTL_L_ONV)
+                       sppctl_gpio_output_inv_set(&pctl->spp_gchip->chip, pin);
+               if (configs[i] & SPPCTL_PCTL_L_ODR)
+                       sppctl_gpio_output_od_set(&pctl->spp_gchip->chip, pin, 1);
+       }
+
+       return 0;
+}
+
+static const struct pinconf_ops sppctl_pconf_ops = {
+       .is_generic     = true,
+       .pin_config_get = sppctl_pin_config_get,
+       .pin_config_set = sppctl_pin_config_set,
+};
+
+static int sppctl_get_functions_count(struct pinctrl_dev *pctldev)
+{
+       return sppctl_list_funcs_sz;
+}
+
+static const char *sppctl_get_function_name(struct pinctrl_dev *pctldev,
+                                           unsigned int selector)
+{
+       return sppctl_list_funcs[selector].name;
+}
+
+static int sppctl_get_function_groups(struct pinctrl_dev *pctldev, unsigned int selector,
+                                     const char * const **groups, unsigned int *num_groups)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       const struct sppctl_func *f = &sppctl_list_funcs[selector];
+       int i;
+
+       *num_groups = 0;
+       switch (f->type) {
+       case pinmux_type_fpmx:
+               *num_groups = sppctl_pmux_list_sz;
+               *groups = sppctl_pmux_list_s;
+               break;
+
+       case pinmux_type_grp:
+               if (!f->grps)
+                       break;
+
+               *num_groups = f->gnum;
+               for (i = 0; i < pctl->unq_grps_sz; i++)
+                       if (pctl->g2fp_maps[i].f_idx == selector)
+                               break;
+               *groups = &pctl->unq_grps[i];
+               break;
+
+       default:
+               dev_err(pctldev->dev, "Unknown pinmux (selector: %d, type: %d)\n",
+                       selector, f->type);
+               break;
+       }
+
+       return 0;
+}
+
+/**
+ * sppctl_fully_pinmux_conv - Convert GPIO# to fully-pinmux control-field setting
+ *
+ * Each fully-pinmux function can be mapped to any of GPIO 8 ~ 71 by
+ * settings its control-field. Refer to following table:
+ *
+ * control-field |  GPIO
+ * --------------+--------
+ *        0      |  No map
+ *        1      |    8
+ *        2      |    9
+ *        3      |   10
+ *        :      |    :
+ *       65      |   71
+ */
+static inline int sppctl_fully_pinmux_conv(unsigned int offset)
+{
+       return (offset < 8) ? 0 : offset - 7;
+}
+
+static int sppctl_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector,
+                         unsigned int group_selector)
+{
+       const struct sppctl_func *f = &sppctl_list_funcs[func_selector];
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       struct grp2fp_map g2fpm = pctl->g2fp_maps[group_selector];
+       int i;
+
+       switch (f->type) {
+       case pinmux_type_fpmx:
+               sppctl_first_master_set(&pctl->spp_gchip->chip, group_selector,
+                                       mux_f_mux, mux_m_keep);
+               sppctl_func_set(pctl, func_selector, sppctl_fully_pinmux_conv(group_selector));
+               break;
+
+       case pinmux_type_grp:
+               for (i = 0; i < f->grps[g2fpm.g_idx].pnum; i++)
+                       sppctl_first_master_set(&pctl->spp_gchip->chip,
+                                               f->grps[g2fpm.g_idx].pins[i],
+                                               mux_f_mux, mux_m_keep);
+               sppctl_gmx_set(pctl, f->roff, f->boff, f->blen, f->grps[g2fpm.g_idx].gval);
+               break;
+
+       default:
+               dev_err(pctldev->dev, "Unknown pinmux type (func_selector: %d, type: %d)\n",
+                       func_selector, f->type);
+               break;
+       }
+
+       return 0;
+}
+
+static int sppctl_gpio_request_enable(struct pinctrl_dev *pctldev,
+                                     struct pinctrl_gpio_range *range, unsigned int offset)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       int g_f, g_m;
+
+       g_f = sppctl_first_get(&pctl->spp_gchip->chip, offset);
+       g_m = sppctl_master_get(&pctl->spp_gchip->chip, offset);
+       if (g_f == mux_f_gpio && g_m == mux_m_gpio)
+               return 0;
+
+       sppctl_first_master_set(&pctl->spp_gchip->chip, offset, mux_f_gpio, mux_m_gpio);
+       return 0;
+}
+
+static const struct pinmux_ops sppctl_pinmux_ops = {
+       .get_functions_count = sppctl_get_functions_count,
+       .get_function_name   = sppctl_get_function_name,
+       .get_function_groups = sppctl_get_function_groups,
+       .set_mux             = sppctl_set_mux,
+       .gpio_request_enable = sppctl_gpio_request_enable,
+       .strict              = true,
+};
+
+static int sppctl_get_groups_count(struct pinctrl_dev *pctldev)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+
+       return pctl->unq_grps_sz;
+}
+
+static const char *sppctl_get_group_name(struct pinctrl_dev *pctldev, unsigned int selector)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+
+       return pctl->unq_grps[selector];
+}
+
+static int sppctl_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
+                                const unsigned int **pins, unsigned int *num_pins)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       struct grp2fp_map g2fpm = pctl->g2fp_maps[selector];
+       const struct sppctl_func *f;
+
+       f = &sppctl_list_funcs[g2fpm.f_idx];
+       *num_pins = 0;
+
+       /* Except group-pinmux, each group has 1 pin. */
+       if (f->type != pinmux_type_grp) {
+               *num_pins = 1;
+               *pins = &sppctl_pins_gpio[selector];
+               return 0;
+       }
+
+       /* Group-pinmux may have more than one pin. */
+       if (!f->grps)
+               return 0;
+
+       if (f->gnum < 1)
+               return 0;
+
+       *num_pins = f->grps[g2fpm.g_idx].pnum;
+       *pins = f->grps[g2fpm.g_idx].pins;
+
+       return 0;
+}
+
+#ifdef CONFIG_DEBUG_FS
+static void sppctl_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
+                               unsigned int offset)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       const char *pin_type;
+       u8 first, master;
+
+       first = sppctl_first_get(&pctl->spp_gchip->chip, offset);
+       master = sppctl_master_get(&pctl->spp_gchip->chip, offset);
+       if (first)
+               if (master)
+                       pin_type = "GPIO";
+               else
+                       pin_type = " IOP";
+       else
+               pin_type = " MUX";
+       seq_printf(s, " %s", pin_type);
+}
+#endif
+
+static int sppctl_dt_node_to_map(struct pinctrl_dev *pctldev, struct device_node *np_config,
+                                struct pinctrl_map **map, unsigned int *num_maps)
+{
+       struct sppctl_pdata *pctl = pinctrl_dev_get_drvdata(pctldev);
+       int nmG = of_property_count_strings(np_config, "groups");
+       const struct sppctl_func *f = NULL;
+       u8 pin_num, pin_type, pin_func;
+       struct device_node *parent;
+       unsigned long *configs;
+       struct property *prop;
+       const char *s_f, *s_g;
+
+       const __be32 *list;
+       u32 dt_pin, dt_fun;
+       int i, size = 0;
+
+       list = of_get_property(np_config, "sunplus,pins", &size);
+
+       if (nmG <= 0)
+               nmG = 0;
+
+       parent = of_get_parent(np_config);
+       *num_maps = size / sizeof(*list);
+
+       /*
+        * Process property:
+        *     sunplus,pins = < u32 u32 u32 ... >;
+        *
+        * Each 32-bit integer defines a individual pin in which:
+        *
+        *   Bit 32~24: defines GPIO pin number. Its range is 0 ~ 98.
+        *   Bit 23~16: defines types: (1) fully-pinmux pins
+        *                             (2) IO processor pins
+        *                             (3) digital GPIO pins
+        *   Bit 15~8:  defines pins of peripherals (which are defined in
+        *              'include/dt-binging/pinctrl/sppctl.h').
+        *   Bit 7~0:   defines types or initial-state of digital GPIO pins.
+        */
+       for (i = 0; i < (*num_maps); i++) {
+               dt_pin = be32_to_cpu(list[i]);
+               pin_num = FIELD_GET(GENMASK(31, 24), dt_pin);
+
+               if (pin_num >= sppctl_pins_all_sz) {
+                       dev_err(pctldev->dev, "Invalid pin property at index %d (0x%08x)\n",
+                               i, dt_pin);
+                       return -EINVAL;
+               }
+       }
+
+       *map = kcalloc(*num_maps + nmG, sizeof(**map), GFP_KERNEL);
+       for (i = 0; i < (*num_maps); i++) {
+               dt_pin = be32_to_cpu(list[i]);
+               pin_num = FIELD_GET(GENMASK(31, 24), dt_pin);
+               pin_type = FIELD_GET(GENMASK(23, 16), dt_pin);
+               pin_func = FIELD_GET(GENMASK(15, 8), dt_pin);
+               (*map)[i].name = parent->name;
+
+               if (pin_type == SPPCTL_PCTL_G_GPIO) {
+                       /* A digital GPIO pin */
+                       (*map)[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
+                       (*map)[i].data.configs.num_configs = 1;
+                       (*map)[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_num);
+                       configs = kmalloc(sizeof(*configs), GFP_KERNEL);
+                       *configs = FIELD_GET(GENMASK(7, 0), dt_pin);
+                       (*map)[i].data.configs.configs = configs;
+
+                       dev_dbg(pctldev->dev, "%s: GPIO (%s)\n",
+                               (*map)[i].data.configs.group_or_pin,
+                               (*configs & (SPPCTL_PCTL_L_OUT | SPPCTL_PCTL_L_OU1)) ?
+                               "OUT" : "IN");
+               } else if (pin_type == SPPCTL_PCTL_G_IOPP) {
+                       /* A IO Processor (IOP) pin */
+                       (*map)[i].type = PIN_MAP_TYPE_CONFIGS_PIN;
+                       (*map)[i].data.configs.num_configs = 1;
+                       (*map)[i].data.configs.group_or_pin = pin_get_name(pctldev, pin_num);
+                       configs = kmalloc(sizeof(*configs), GFP_KERNEL);
+                       *configs = SPPCTL_IOP_CONFIGS;
+                       (*map)[i].data.configs.configs = configs;
+
+                       dev_dbg(pctldev->dev, "%s: IOP\n",
+                               (*map)[i].data.configs.group_or_pin);
+               } else {
+                       /* A fully-pinmux pin */
+                       (*map)[i].type = PIN_MAP_TYPE_MUX_GROUP;
+                       (*map)[i].data.mux.function = sppctl_list_funcs[pin_func].name;
+                       (*map)[i].data.mux.group = pin_get_name(pctldev, pin_num);
+
+                       dev_dbg(pctldev->dev, "%s: %s\n", (*map)[i].data.mux.group,
+                               (*map)[i].data.mux.function);
+               }
+       }
+
+       /*
+        * Process properties:
+        *     function = "xxx";
+        *     groups = "yyy";
+        */
+       if (nmG > 0 && of_property_read_string(np_config, "function", &s_f) == 0) {
+               of_property_for_each_string(np_config, "groups", prop, s_g) {
+                       (*map)[*num_maps].type = PIN_MAP_TYPE_MUX_GROUP;
+                       (*map)[*num_maps].data.mux.function = s_f;
+                       (*map)[*num_maps].data.mux.group = s_g;
+                       (*num_maps)++;
+
+                       dev_dbg(pctldev->dev, "%s: %s\n", s_f, s_g);
+               }
+       }
+
+       /*
+        * Process property:
+        *     sunplus,zerofunc = < u32 u32 u32 ...>
+        */
+       list = of_get_property(np_config, "sunplus,zerofunc", &size);
+       if (list) {
+               for (i = 0; i < (size / sizeof(*list)); i++) {
+                       dt_fun = be32_to_cpu(list[i]);
+                       if (dt_fun >= sppctl_list_funcs_sz) {
+                               dev_err(pctldev->dev, "Zero-func %d out of range!\n",
+                                       dt_fun);
+                               continue;
+                       }
+
+                       f = &sppctl_list_funcs[dt_fun];
+                       switch (f->type) {
+                       case pinmux_type_fpmx:
+                               sppctl_func_set(pctl, dt_fun, 0);
+                               dev_dbg(pctldev->dev, "%s: No map\n", f->name);
+                               break;
+
+                       case pinmux_type_grp:
+                               sppctl_gmx_set(pctl, f->roff, f->boff, f->blen, 0);
+                               dev_dbg(pctldev->dev, "%s: No map\n", f->name);
+                               break;
+
+                       default:
+                               dev_err(pctldev->dev, "Wrong zero-group: %d (%s)\n",
+                                       dt_fun, f->name);
+                               break;
+                       }
+               }
+       }
+
+       of_node_put(parent);
+       dev_dbg(pctldev->dev, "%d pins mapped\n", *num_maps);
+       return 0;
+}
+
+static const struct pinctrl_ops sppctl_pctl_ops = {
+       .get_groups_count = sppctl_get_groups_count,
+       .get_group_name   = sppctl_get_group_name,
+       .get_group_pins   = sppctl_get_group_pins,
+#ifdef CONFIG_DEBUG_FS
+       .pin_dbg_show     = sppctl_pin_dbg_show,
+#endif
+       .dt_node_to_map   = sppctl_dt_node_to_map,
+       .dt_free_map      = pinctrl_utils_free_map,
+};
+
+static int sppctl_group_groups(struct platform_device *pdev)
+{
+       struct sppctl_pdata *sppctl = platform_get_drvdata(pdev);
+       int i, k, j;
+
+       /* Calculate number of total group (GPIO + group-pinmux group). */
+       sppctl->unq_grps_sz = sppctl_gpio_list_sz;
+       for (i = 0; i < sppctl_list_funcs_sz; i++)
+               if (sppctl_list_funcs[i].type == pinmux_type_grp)
+                       sppctl->unq_grps_sz += sppctl_list_funcs[i].gnum;
+
+       sppctl->unq_grps = devm_kcalloc(&pdev->dev, sppctl->unq_grps_sz + 1,
+                                       sizeof(*sppctl->unq_grps), GFP_KERNEL);
+       if (!sppctl->unq_grps)
+               return -ENOMEM;
+
+       sppctl->g2fp_maps = devm_kcalloc(&pdev->dev, sppctl->unq_grps_sz + 1,
+                                        sizeof(*sppctl->g2fp_maps), GFP_KERNEL);
+       if (!sppctl->g2fp_maps)
+               return -ENOMEM;
+
+       /* Add GPIO pins. */
+       for (i = 0; i < sppctl_gpio_list_sz; i++) {
+               sppctl->unq_grps[i] = sppctl_gpio_list_s[i];
+               sppctl->g2fp_maps[i].f_idx = 0;
+               sppctl->g2fp_maps[i].g_idx = i;
+       }
+
+       /* Add group-pinmux to end of GPIO pins. */
+       j = sppctl_gpio_list_sz;
+       for (i = 0; i < sppctl_list_funcs_sz; i++) {
+               if (sppctl_list_funcs[i].type != pinmux_type_grp)
+                       continue;
+
+               for (k = 0; k < sppctl_list_funcs[i].gnum; k++) {
+                       sppctl->unq_grps[j] = sppctl_list_funcs[i].grps[k].name;
+                       sppctl->g2fp_maps[j].f_idx = i;
+                       sppctl->g2fp_maps[j].g_idx = k;
+                       j++;
+               }
+       }
+
+       return 0;
+}
+
+static int sppctl_pinctrl_init(struct platform_device *pdev)
+{
+       struct sppctl_pdata *sppctl = platform_get_drvdata(pdev);
+       int err;
+
+       sppctl->pctl_desc.owner   = THIS_MODULE;
+       sppctl->pctl_desc.name    = dev_name(&pdev->dev);
+       sppctl->pctl_desc.pins    = sppctl_pins_all;
+       sppctl->pctl_desc.npins   = sppctl_pins_all_sz;
+       sppctl->pctl_desc.pctlops = &sppctl_pctl_ops;
+       sppctl->pctl_desc.confops = &sppctl_pconf_ops;
+       sppctl->pctl_desc.pmxops  = &sppctl_pinmux_ops;
+
+       err = sppctl_group_groups(pdev);
+       if (err)
+               return err;
+
+       err = devm_pinctrl_register_and_init(&pdev->dev, &sppctl->pctl_desc,
+                                            sppctl, &sppctl->pctl_dev);
+       if (err)
+               return dev_err_probe(&pdev->dev, err, "Failed to register pinctrl!\n");
+
+       pinctrl_enable(sppctl->pctl_dev);
+       return 0;
+}
+
+static int sppctl_resource_map(struct platform_device *pdev, struct sppctl_pdata *sppctl)
+{
+       sppctl->moon2_base = devm_platform_ioremap_resource_byname(pdev, "moon2");
+       if (IS_ERR(sppctl->moon2_base))
+               return PTR_ERR(sppctl->moon2_base);
+
+       sppctl->gpioxt_base = devm_platform_ioremap_resource_byname(pdev, "gpioxt");
+       if (IS_ERR(sppctl->gpioxt_base))
+               return PTR_ERR(sppctl->gpioxt_base);
+
+       sppctl->first_base = devm_platform_ioremap_resource_byname(pdev, "first");
+       if (IS_ERR(sppctl->first_base))
+               return PTR_ERR(sppctl->first_base);
+
+       sppctl->moon1_base = devm_platform_ioremap_resource_byname(pdev, "moon1");
+       if (IS_ERR(sppctl->moon1_base))
+               return PTR_ERR(sppctl->moon1_base);
+
+       return 0;
+}
+
+static int sppctl_probe(struct platform_device *pdev)
+{
+       struct sppctl_pdata *sppctl;
+       int ret;
+
+       sppctl = devm_kzalloc(&pdev->dev, sizeof(*sppctl), GFP_KERNEL);
+       if (!sppctl)
+               return -ENOMEM;
+       platform_set_drvdata(pdev, sppctl);
+
+       ret = sppctl_resource_map(pdev, sppctl);
+       if (ret)
+               return ret;
+
+       ret = sppctl_gpio_new(pdev, sppctl);
+       if (ret)
+               return ret;
+
+       ret = sppctl_pinctrl_init(pdev);
+       if (ret)
+               return ret;
+
+       pinctrl_add_gpio_range(sppctl->pctl_dev, &sppctl->pctl_grange);
+
+       return 0;
+}
+
+static const struct of_device_id sppctl_match_table[] = {
+       { .compatible = "sunplus,sp7021-pctl" },
+       { /* sentinel */ }
+};
+
+static struct platform_driver sppctl_pinctrl_driver = {
+       .driver = {
+               .name           = SPPCTL_MODULE_NAME,
+               .of_match_table = sppctl_match_table,
+       },
+       .probe  = sppctl_probe,
+};
+builtin_platform_driver(sppctl_pinctrl_driver)
+
+MODULE_AUTHOR("Dvorkin Dmitry <dvorkin@tibbo.com>");
+MODULE_AUTHOR("Wells Lu <wellslutw@gmail.com>");
+MODULE_DESCRIPTION("Sunplus SP7021 Pin Control and GPIO driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/sunplus/sppctl.h b/drivers/pinctrl/sunplus/sppctl.h
new file mode 100644 (file)
index 0000000..6210f22
--- /dev/null
@@ -0,0 +1,170 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * SP7021 Pin Controller Driver.
+ * Copyright (C) Sunplus Tech / Tibbo Tech.
+ */
+
+#ifndef __SPPCTL_H__
+#define __SPPCTL_H__
+
+#include <linux/bits.h>
+#include <linux/gpio/driver.h>
+#include <linux/kernel.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/spinlock.h>
+#include <linux/types.h>
+
+#define SPPCTL_MODULE_NAME             "sppctl_sp7021"
+
+#define SPPCTL_GPIO_OFF_FIRST          0x00
+#define SPPCTL_GPIO_OFF_MASTER         0x00
+#define SPPCTL_GPIO_OFF_OE             0x20
+#define SPPCTL_GPIO_OFF_OUT            0x40
+#define SPPCTL_GPIO_OFF_IN             0x60
+#define SPPCTL_GPIO_OFF_IINV           0x80
+#define SPPCTL_GPIO_OFF_OINV           0xa0
+#define SPPCTL_GPIO_OFF_OD             0xc0
+
+#define SPPCTL_FULLY_PINMUX_MASK_MASK  GENMASK(22, 16)
+#define SPPCTL_FULLY_PINMUX_SEL_MASK   GENMASK(6, 0)
+#define SPPCTL_FULLY_PINMUX_UPPER_SHIFT        8
+
+/*
+ * Mask-fields and control-fields of MOON registers of SP7021 are
+ * arranged as shown below:
+ *
+ *  register |  mask-fields | control-fields
+ * ----------+--------------+----------------
+ *  base[0]  |  (31 : 16)   |   (15 : 0)
+ *  base[1]  |  (31 : 24)   |   (15 : 0)
+ *  base[2]  |  (31 : 24)   |   (15 : 0)
+ *     :     |      :       |       :
+ *
+ * where mask-fields are used to protect control-fields from write-in
+ * accidentally. Set the corresponding bits in the mask-field before
+ * you write a value into a control-field.
+ */
+#define SPPCTL_MOON_REG_MASK_SHIFT     16
+#define SPPCTL_SET_MOON_REG_BIT(bit)   (BIT((bit) + SPPCTL_MOON_REG_MASK_SHIFT) | BIT(bit))
+#define SPPCTL_CLR_MOON_REG_BIT(bit)   BIT((bit) + SPPCTL_MOON_REG_MASK_SHIFT)
+
+#define SPPCTL_IOP_CONFIGS             0xff
+
+#define FNCE(n, r, o, bo, bl, g) { \
+       .name = n, \
+       .type = r, \
+       .roff = o, \
+       .boff = bo, \
+       .blen = bl, \
+       .grps = (g), \
+       .gnum = ARRAY_SIZE(g), \
+}
+
+#define FNCN(n, r, o, bo, bl) { \
+       .name = n, \
+       .type = r, \
+       .roff = o, \
+       .boff = bo, \
+       .blen = bl, \
+       .grps = NULL, \
+       .gnum = 0, \
+}
+
+#define EGRP(n, v, p) { \
+       .name = n, \
+       .gval = (v), \
+       .pins = (p), \
+       .pnum = ARRAY_SIZE(p), \
+}
+
+/**
+ * enum mux_first_reg - Define modes of access of FIRST register
+ * @mux_f_mux:  Set the corresponding pin to a fully-pinmux pin
+ * @mux_f_gpio: Set the corresponding pin to a GPIO or IOP pin
+ * @mux_f_keep: Don't change (keep intact)
+ */
+enum mux_first_reg {
+       mux_f_mux = 0,
+       mux_f_gpio = 1,
+       mux_f_keep = 2,
+};
+
+/**
+ * enum mux_master_reg - Define modes of access of MASTER register
+ * @mux_m_iop:  Set the corresponding pin to an IO processor (IOP) pin
+ * @mux_m_gpio: Set the corresponding pin to a digital GPIO pin
+ * @mux_m_keep: Don't change (keep intact)
+ */
+enum mux_master_reg {
+       mux_m_iop = 0,
+       mux_m_gpio = 1,
+       mux_m_keep = 2,
+};
+
+/**
+ * enum pinmux_type - Define types of pinmux pins
+ * @pinmux_type_fpmx: A fully-pinmux pin
+ * @pinmux_type_grp:  A group-pinmux pin
+ */
+enum pinmux_type {
+       pinmux_type_fpmx,
+       pinmux_type_grp,
+};
+
+/**
+ * struct grp2fp_map - A map storing indexes
+ * @f_idx: an index to function table
+ * @g_idx: an index to group table
+ */
+struct grp2fp_map {
+       u16 f_idx;
+       u16 g_idx;
+};
+
+struct sppctl_gpio_chip;
+
+struct sppctl_pdata {
+       void __iomem *moon2_base;       /* MOON2                                 */
+       void __iomem *gpioxt_base;      /* MASTER, OE, OUT, IN, I_INV, O_INV, OD */
+       void __iomem *first_base;       /* FIRST                                 */
+       void __iomem *moon1_base;       /* MOON1               */
+
+       struct pinctrl_desc pctl_desc;
+       struct pinctrl_dev *pctl_dev;
+       struct pinctrl_gpio_range pctl_grange;
+       struct sppctl_gpio_chip *spp_gchip;
+
+       char const **unq_grps;
+       size_t unq_grps_sz;
+       struct grp2fp_map *g2fp_maps;
+};
+
+struct sppctl_grp {
+       const char * const name;
+       const u8 gval;                  /* group number   */
+       const unsigned * const pins;    /* list of pins   */
+       const unsigned int pnum;        /* number of pins */
+};
+
+struct sppctl_func {
+       const char * const name;
+       const enum pinmux_type type;    /* function type          */
+       const u8 roff;                  /* register offset        */
+       const u8 boff;                  /* bit offset             */
+       const u8 blen;                  /* bit length             */
+       const struct sppctl_grp * const grps; /* list of groups   */
+       const unsigned int gnum;        /* number of groups       */
+};
+
+extern const struct sppctl_func sppctl_list_funcs[];
+extern const char * const sppctl_pmux_list_s[];
+extern const char * const sppctl_gpio_list_s[];
+extern const struct pinctrl_pin_desc sppctl_pins_all[];
+extern const unsigned int sppctl_pins_gpio[];
+
+extern const size_t sppctl_list_funcs_sz;
+extern const size_t sppctl_pmux_list_sz;
+extern const size_t sppctl_gpio_list_sz;
+extern const size_t sppctl_pins_all_sz;
+
+#endif
diff --git a/drivers/pinctrl/sunplus/sppctl_sp7021.c b/drivers/pinctrl/sunplus/sppctl_sp7021.c
new file mode 100644 (file)
index 0000000..9748345
--- /dev/null
@@ -0,0 +1,583 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * SP7021 Pin Controller Driver.
+ * Copyright (C) Sunplus Tech / Tibbo Tech.
+ */
+
+#include <linux/gpio/driver.h>
+#include <linux/kernel.h>
+#include <linux/pinctrl/pinctrl.h>
+
+#include "sppctl.h"
+
+#define D_PIS(x, y)    "P" __stringify(x) "_0" __stringify(y)
+#define D(x, y)                ((x) * 8 + (y))
+#define P(x, y)                PINCTRL_PIN(D(x, y), D_PIS(x, y))
+
+const char * const sppctl_gpio_list_s[] = {
+       D_PIS(0, 0),  D_PIS(0, 1),  D_PIS(0, 2),  D_PIS(0, 3),
+       D_PIS(0, 4),  D_PIS(0, 5),  D_PIS(0, 6),  D_PIS(0, 7),
+       D_PIS(1, 0),  D_PIS(1, 1),  D_PIS(1, 2),  D_PIS(1, 3),
+       D_PIS(1, 4),  D_PIS(1, 5),  D_PIS(1, 6),  D_PIS(1, 7),
+       D_PIS(2, 0),  D_PIS(2, 1),  D_PIS(2, 2),  D_PIS(2, 3),
+       D_PIS(2, 4),  D_PIS(2, 5),  D_PIS(2, 6),  D_PIS(2, 7),
+       D_PIS(3, 0),  D_PIS(3, 1),  D_PIS(3, 2),  D_PIS(3, 3),
+       D_PIS(3, 4),  D_PIS(3, 5),  D_PIS(3, 6),  D_PIS(3, 7),
+       D_PIS(4, 0),  D_PIS(4, 1),  D_PIS(4, 2),  D_PIS(4, 3),
+       D_PIS(4, 4),  D_PIS(4, 5),  D_PIS(4, 6),  D_PIS(4, 7),
+       D_PIS(5, 0),  D_PIS(5, 1),  D_PIS(5, 2),  D_PIS(5, 3),
+       D_PIS(5, 4),  D_PIS(5, 5),  D_PIS(5, 6),  D_PIS(5, 7),
+       D_PIS(6, 0),  D_PIS(6, 1),  D_PIS(6, 2),  D_PIS(6, 3),
+       D_PIS(6, 4),  D_PIS(6, 5),  D_PIS(6, 6),  D_PIS(6, 7),
+       D_PIS(7, 0),  D_PIS(7, 1),  D_PIS(7, 2),  D_PIS(7, 3),
+       D_PIS(7, 4),  D_PIS(7, 5),  D_PIS(7, 6),  D_PIS(7, 7),
+       D_PIS(8, 0),  D_PIS(8, 1),  D_PIS(8, 2),  D_PIS(8, 3),
+       D_PIS(8, 4),  D_PIS(8, 5),  D_PIS(8, 6),  D_PIS(8, 7),
+       D_PIS(9, 0),  D_PIS(9, 1),  D_PIS(9, 2),  D_PIS(9, 3),
+       D_PIS(9, 4),  D_PIS(9, 5),  D_PIS(9, 6),  D_PIS(9, 7),
+       D_PIS(10, 0), D_PIS(10, 1), D_PIS(10, 2), D_PIS(10, 3),
+       D_PIS(10, 4), D_PIS(10, 5), D_PIS(10, 6), D_PIS(10, 7),
+       D_PIS(11, 0), D_PIS(11, 1), D_PIS(11, 2), D_PIS(11, 3),
+       D_PIS(11, 4), D_PIS(11, 5), D_PIS(11, 6), D_PIS(11, 7),
+       D_PIS(12, 0), D_PIS(12, 1), D_PIS(12, 2),
+};
+
+const size_t sppctl_gpio_list_sz = ARRAY_SIZE(sppctl_gpio_list_s);
+
+const unsigned int sppctl_pins_gpio[] = {
+       D(0, 0), D(0, 1), D(0, 2), D(0, 3), D(0, 4), D(0, 5), D(0, 6), D(0, 7),
+       D(1, 0), D(1, 1), D(1, 2), D(1, 3), D(1, 4), D(1, 5), D(1, 6), D(1, 7),
+       D(2, 0), D(2, 1), D(2, 2), D(2, 3), D(2, 4), D(2, 5), D(2, 6), D(2, 7),
+       D(3, 0), D(3, 1), D(3, 2), D(3, 3), D(3, 4), D(3, 5), D(3, 6), D(3, 7),
+       D(4, 0), D(4, 1), D(4, 2), D(4, 3), D(4, 4), D(4, 5), D(4, 6), D(4, 7),
+       D(5, 0), D(5, 1), D(5, 2), D(5, 3), D(5, 4), D(5, 5), D(5, 6), D(5, 7),
+       D(6, 0), D(6, 1), D(6, 2), D(6, 3), D(6, 4), D(6, 5), D(6, 6), D(6, 7),
+       D(7, 0), D(7, 1), D(7, 2), D(7, 3), D(7, 4), D(7, 5), D(7, 6), D(7, 7),
+       D(8, 0), D(8, 1), D(8, 2), D(8, 3), D(8, 4), D(8, 5), D(8, 6), D(8, 7),
+       D(9, 0), D(9, 1), D(9, 2), D(9, 3), D(9, 4), D(9, 5), D(9, 6), D(9, 7),
+       D(10, 0), D(10, 1), D(10, 2), D(10, 3), D(10, 4), D(10, 5), D(10, 6), D(10, 7),
+       D(11, 0), D(11, 1), D(11, 2), D(11, 3), D(11, 4), D(11, 5), D(11, 6), D(11, 7),
+       D(12, 0), D(12, 1), D(12, 2),
+};
+
+const struct pinctrl_pin_desc sppctl_pins_all[] = {
+       /* gpio and iop only */
+       P(0, 0), P(0, 1), P(0, 2), P(0, 3), P(0, 4), P(0, 5), P(0, 6), P(0, 7),
+       /* gpio, iop, muxable */
+       P(1, 0), P(1, 1), P(1, 2), P(1, 3), P(1, 4), P(1, 5), P(1, 6), P(1, 7),
+       P(2, 0), P(2, 1), P(2, 2), P(2, 3), P(2, 4), P(2, 5), P(2, 6), P(2, 7),
+       P(3, 0), P(3, 1), P(3, 2), P(3, 3), P(3, 4), P(3, 5), P(3, 6), P(3, 7),
+       P(4, 0), P(4, 1), P(4, 2), P(4, 3), P(4, 4), P(4, 5), P(4, 6), P(4, 7),
+       P(5, 0), P(5, 1), P(5, 2), P(5, 3), P(5, 4), P(5, 5), P(5, 6), P(5, 7),
+       P(6, 0), P(6, 1), P(6, 2), P(6, 3), P(6, 4), P(6, 5), P(6, 6), P(6, 7),
+       P(7, 0), P(7, 1), P(7, 2), P(7, 3), P(7, 4), P(7, 5), P(7, 6), P(7, 7),
+       P(8, 0), P(8, 1), P(8, 2), P(8, 3), P(8, 4), P(8, 5), P(8, 6), P(8, 7),
+       /* gpio and iop only */
+       P(9, 0),  P(9, 1),  P(9, 2),  P(9, 3),  P(9, 4),  P(9, 5),  P(9, 6),  P(9, 7),
+       P(10, 0), P(10, 1), P(10, 2), P(10, 3), P(10, 4), P(10, 5), P(10, 6), P(10, 7),
+       P(11, 0), P(11, 1), P(11, 2), P(11, 3), P(11, 4), P(11, 5), P(11, 6), P(11, 7),
+       P(12, 0), P(12, 1), P(12, 2),
+};
+
+const size_t sppctl_pins_all_sz = ARRAY_SIZE(sppctl_pins_all);
+
+const char * const sppctl_pmux_list_s[] = {
+       D_PIS(0, 0),
+       D_PIS(1, 0), D_PIS(1, 1), D_PIS(1, 2), D_PIS(1, 3),
+       D_PIS(1, 4), D_PIS(1, 5), D_PIS(1, 6), D_PIS(1, 7),
+       D_PIS(2, 0), D_PIS(2, 1), D_PIS(2, 2), D_PIS(2, 3),
+       D_PIS(2, 4), D_PIS(2, 5), D_PIS(2, 6), D_PIS(2, 7),
+       D_PIS(3, 0), D_PIS(3, 1), D_PIS(3, 2), D_PIS(3, 3),
+       D_PIS(3, 4), D_PIS(3, 5), D_PIS(3, 6), D_PIS(3, 7),
+       D_PIS(4, 0), D_PIS(4, 1), D_PIS(4, 2), D_PIS(4, 3),
+       D_PIS(4, 4), D_PIS(4, 5), D_PIS(4, 6), D_PIS(4, 7),
+       D_PIS(5, 0), D_PIS(5, 1), D_PIS(5, 2), D_PIS(5, 3),
+       D_PIS(5, 4), D_PIS(5, 5), D_PIS(5, 6), D_PIS(5, 7),
+       D_PIS(6, 0), D_PIS(6, 1), D_PIS(6, 2), D_PIS(6, 3),
+       D_PIS(6, 4), D_PIS(6, 5), D_PIS(6, 6), D_PIS(6, 7),
+       D_PIS(7, 0), D_PIS(7, 1), D_PIS(7, 2), D_PIS(7, 3),
+       D_PIS(7, 4), D_PIS(7, 5), D_PIS(7, 6), D_PIS(7, 7),
+       D_PIS(8, 0), D_PIS(8, 1), D_PIS(8, 2), D_PIS(8, 3),
+       D_PIS(8, 4), D_PIS(8, 5), D_PIS(8, 6), D_PIS(8, 7),
+};
+
+const size_t sppctl_pmux_list_sz = ARRAY_SIZE(sppctl_pmux_list_s);
+
+static const unsigned int pins_spif1[] = {
+       D(10, 3), D(10, 4), D(10, 6), D(10, 7),
+};
+
+static const unsigned int pins_spif2[] = {
+       D(9, 4), D(9, 6), D(9, 7), D(10, 1),
+};
+
+static const struct sppctl_grp sp7021grps_spif[] = {
+       EGRP("SPI_FLASH1", 1, pins_spif1),
+       EGRP("SPI_FLASH2", 2, pins_spif2),
+};
+
+static const unsigned int pins_spi41[] = {
+       D(10, 2), D(10, 5),
+};
+
+static const unsigned int pins_spi42[] = {
+       D(9, 5), D(9, 8),
+};
+
+static const struct sppctl_grp sp7021grps_spi4[] = {
+       EGRP("SPI_FLASH_4BIT1", 1, pins_spi41),
+       EGRP("SPI_FLASH_4BIT2", 2, pins_spi42),
+};
+
+static const unsigned int pins_snan[] = {
+       D(9, 4), D(9, 5), D(9, 6), D(9, 7), D(10, 0), D(10, 1),
+};
+
+static const struct sppctl_grp sp7021grps_snan[] = {
+       EGRP("SPI_NAND", 1, pins_snan),
+};
+
+static const unsigned int pins_emmc[] = {
+       D(9, 0), D(9, 1), D(9, 2), D(9, 3), D(9, 4), D(9, 5),
+       D(9, 6), D(9, 7), D(10, 0), D(10, 1),
+};
+
+static const struct sppctl_grp sp7021grps_emmc[] = {
+       EGRP("CARD0_EMMC", 1, pins_emmc),
+};
+
+static const unsigned int pins_sdsd[] = {
+       D(8, 1), D(8, 2), D(8, 3), D(8, 4), D(8, 5), D(8, 6),
+};
+
+static const struct sppctl_grp sp7021grps_sdsd[] = {
+       EGRP("SD_CARD", 1, pins_sdsd),
+};
+
+static const unsigned int pins_uar0[] = {
+       D(11, 0), D(11, 1),
+};
+
+static const struct sppctl_grp sp7021grps_uar0[] = {
+       EGRP("UA0", 1, pins_uar0),
+};
+
+static const unsigned int pins_adbg1[] = {
+       D(10, 2), D(10, 3),
+};
+
+static const unsigned int pins_adbg2[] = {
+       D(7, 1), D(7, 2),
+};
+
+static const struct sppctl_grp sp7021grps_adbg[] = {
+       EGRP("ACHIP_DEBUG1", 1, pins_adbg1),
+       EGRP("ACHIP_DEBUG2", 2, pins_adbg2),
+};
+
+static const unsigned int pins_aua2axi1[] = {
+       D(2, 0), D(2, 1), D(2, 2),
+};
+
+static const unsigned int pins_aua2axi2[] = {
+       D(1, 0), D(1, 1), D(1, 2),
+};
+
+static const struct sppctl_grp sp7021grps_au2x[] = {
+       EGRP("ACHIP_UA2AXI1", 1, pins_aua2axi1),
+       EGRP("ACHIP_UA2AXI2", 2, pins_aua2axi2),
+};
+
+static const unsigned int pins_fpga[] = {
+       D(0, 2), D(0, 3), D(0, 4), D(0, 5), D(0, 6), D(0, 7),
+       D(1, 0), D(1, 1), D(1, 2), D(1, 3), D(1, 4), D(1, 5),
+       D(1, 6), D(1, 7), D(2, 0), D(2, 1), D(2, 2), D(2, 3),
+       D(2, 4), D(2, 5), D(2, 6), D(2, 7), D(3, 0), D(3, 1),
+       D(3, 2), D(3, 3), D(3, 4), D(3, 5), D(3, 6), D(3, 7),
+       D(4, 0), D(4, 1), D(4, 2), D(4, 3), D(4, 4), D(4, 5),
+       D(4, 6), D(4, 7), D(5, 0), D(5, 1), D(5, 2),
+};
+
+static const struct sppctl_grp sp7021grps_fpga[] = {
+       EGRP("FPGA_IFX", 1, pins_fpga),
+};
+
+static const unsigned int pins_hdmi1[] = {
+       D(10, 6), D(12, 2), D(12, 1),
+};
+
+static const unsigned int pins_hdmi2[] = {
+       D(8, 3), D(8, 5), D(8, 6),
+};
+
+static const unsigned int pins_hdmi3[] = {
+       D(7, 4), D(7, 6), D(7, 7),
+};
+
+static const struct sppctl_grp sp7021grps_hdmi[] = {
+       EGRP("HDMI_TX1", 1, pins_hdmi1),
+       EGRP("HDMI_TX2", 2, pins_hdmi2),
+       EGRP("HDMI_TX3", 3, pins_hdmi3),
+};
+
+static const unsigned int pins_eadc[] = {
+       D(1, 0), D(1, 1), D(1, 2), D(1, 3), D(1, 4), D(1, 5), D(1, 6),
+};
+
+static const struct sppctl_grp sp7021grps_eadc[] = {
+       EGRP("AUD_EXT_ADC_IFX0", 1, pins_eadc),
+};
+
+static const unsigned int pins_edac[] = {
+       D(2, 5), D(2, 6), D(2, 7), D(3, 0), D(3, 1), D(3, 2), D(3, 4),
+};
+
+static const struct sppctl_grp sp7021grps_edac[] = {
+       EGRP("AUD_EXT_DAC_IFX0", 1, pins_edac),
+};
+
+static const unsigned int pins_spdi[] = {
+       D(2, 4),
+};
+
+static const struct sppctl_grp sp7021grps_spdi[] = {
+       EGRP("AUD_IEC_RX0", 1, pins_spdi),
+};
+
+static const unsigned int pins_spdo[] = {
+       D(3, 6),
+};
+
+static const struct sppctl_grp sp7021grps_spdo[] = {
+       EGRP("AUD_IEC_TX0", 1, pins_spdo),
+};
+
+static const unsigned int pins_tdmt[] = {
+       D(2, 5), D(2, 6), D(2, 7), D(3, 0), D(3, 1), D(3, 2),
+};
+
+static const struct sppctl_grp sp7021grps_tdmt[] = {
+       EGRP("TDMTX_IFX0", 1, pins_tdmt),
+};
+
+static const unsigned int pins_tdmr[] = {
+       D(1, 7), D(2, 0), D(2, 1), D(2, 2),
+};
+
+static const struct sppctl_grp sp7021grps_tdmr[] = {
+       EGRP("TDMRX_IFX0", 1, pins_tdmr),
+};
+
+static const unsigned int pins_pdmr[] = {
+       D(1, 7), D(2, 0), D(2, 1), D(2, 2), D(2, 3),
+};
+
+static const struct sppctl_grp sp7021grps_pdmr[] = {
+       EGRP("PDMRX_IFX0", 1, pins_pdmr),
+};
+
+static const unsigned int pins_pcmt[] = {
+       D(3, 7), D(4, 0), D(4, 1), D(4, 2), D(4, 3), D(4, 4),
+};
+
+static const struct sppctl_grp sp7021grps_pcmt[] = {
+       EGRP("PCM_IEC_TX", 1, pins_pcmt),
+};
+
+static const unsigned int pins_lcdi[] = {
+       D(1, 4), D(1, 5), D(1, 6), D(1, 7), D(2, 0), D(2, 1), D(2, 2), D(2, 3),
+       D(2, 4), D(2, 5), D(2, 6), D(2, 7), D(3, 0), D(3, 1), D(3, 2), D(3, 3),
+       D(3, 4), D(3, 5), D(3, 6), D(3, 7), D(4, 0), D(4, 1), D(4, 2), D(4, 3),
+       D(4, 4), D(4, 5), D(4, 6), D(4, 7),
+};
+
+static const struct sppctl_grp sp7021grps_lcdi[] = {
+       EGRP("LCDIF", 1, pins_lcdi),
+};
+
+static const unsigned int pins_dvdd[] = {
+       D(7, 0), D(7, 1), D(7, 2), D(7, 3), D(7, 4), D(7, 5), D(7, 6), D(7, 7),
+       D(8, 0), D(8, 1), D(8, 2), D(8, 3), D(8, 4), D(8, 5),
+};
+
+static const struct sppctl_grp sp7021grps_dvdd[] = {
+       EGRP("DVD_DSP_DEBUG", 1, pins_dvdd),
+};
+
+static const unsigned int pins_i2cd[] = {
+       D(1, 0), D(1, 1),
+};
+
+static const struct sppctl_grp sp7021grps_i2cd[] = {
+       EGRP("I2C_DEBUG", 1, pins_i2cd),
+};
+
+static const unsigned int pins_i2cs[] = {
+       D(0, 0), D(0, 1),
+};
+
+static const struct sppctl_grp sp7021grps_i2cs[] = {
+       EGRP("I2C_SLAVE", 1, pins_i2cs),
+};
+
+static const unsigned int pins_wakp[] = {
+       D(10, 5),
+};
+
+static const struct sppctl_grp sp7021grps_wakp[] = {
+       EGRP("WAKEUP", 1, pins_wakp),
+};
+
+static const unsigned int pins_u2ax[] = {
+       D(2, 0), D(2, 1), D(3, 0), D(3, 1),
+};
+
+static const struct sppctl_grp sp7021grps_u2ax[] = {
+       EGRP("UART2AXI", 1, pins_u2ax),
+};
+
+static const unsigned int pins_u0ic[] = {
+       D(0, 0), D(0, 1), D(0, 4), D(0, 5), D(1, 0), D(1, 1),
+};
+
+static const struct sppctl_grp sp7021grps_u0ic[] = {
+       EGRP("USB0_I2C", 1, pins_u0ic),
+};
+
+static const unsigned int pins_u1ic[] = {
+       D(0, 2), D(0, 3), D(0, 6), D(0, 7), D(1, 2), D(1, 3),
+};
+
+static const struct sppctl_grp sp7021grps_u1ic[] = {
+       EGRP("USB1_I2C", 1, pins_u1ic),
+};
+
+static const unsigned int pins_u0ot[] = {
+       D(11, 2),
+};
+
+static const struct sppctl_grp sp7021grps_u0ot[] = {
+       EGRP("USB0_OTG", 1, pins_u0ot),
+};
+
+static const unsigned int pins_u1ot[] = {
+       D(11, 3),
+};
+
+static const struct sppctl_grp sp7021grps_u1ot[] = {
+       EGRP("USB1_OTG", 1, pins_u1ot),
+};
+
+static const unsigned int pins_uphd[] = {
+       D(0, 1), D(0, 2), D(0, 3), D(7, 4), D(7, 5), D(7, 6),
+       D(7, 7), D(8, 0), D(8, 1), D(8, 2), D(8, 3),
+       D(9, 7), D(10, 2), D(10, 3), D(10, 4),
+};
+
+static const struct sppctl_grp sp7021grps_up0d[] = {
+       EGRP("UPHY0_DEBUG", 1, pins_uphd),
+};
+
+static const struct sppctl_grp sp7021grps_up1d[] = {
+       EGRP("UPHY1_DEBUG", 1, pins_uphd),
+};
+
+static const unsigned int pins_upex[] = {
+       D(0, 0), D(0, 1), D(0, 2), D(0, 3), D(0, 4), D(0, 5), D(0, 6), D(0, 7),
+       D(1, 0), D(1, 1), D(1, 2), D(1, 3), D(1, 4), D(1, 5), D(1, 6), D(1, 7),
+       D(2, 0), D(2, 1), D(2, 2), D(2, 3), D(2, 4), D(2, 5), D(2, 6), D(2, 7),
+       D(3, 0), D(3, 1), D(3, 2), D(3, 3), D(3, 4), D(3, 5), D(3, 6), D(3, 7),
+       D(4, 0), D(4, 1), D(4, 2), D(4, 3), D(4, 4), D(4, 5), D(4, 6), D(4, 7),
+       D(5, 0), D(5, 1), D(5, 2), D(5, 3), D(5, 4), D(5, 5), D(5, 6), D(5, 7),
+       D(6, 0), D(6, 1), D(6, 2), D(6, 3), D(6, 4), D(6, 5), D(6, 6), D(6, 7),
+       D(7, 0), D(7, 1), D(7, 2), D(7, 3), D(7, 4), D(7, 5), D(7, 6), D(7, 7),
+       D(8, 0), D(8, 1), D(8, 2), D(8, 3), D(8, 4), D(8, 5), D(8, 6), D(8, 7),
+       D(9, 0), D(9, 1), D(9, 2), D(9, 3), D(9, 4), D(9, 5), D(9, 6), D(9, 7),
+       D(10, 0), D(10, 1), D(10, 2), D(10, 3), D(10, 4), D(10, 5), D(10, 6), D(10, 7),
+};
+
+static const struct sppctl_grp sp7021grps_upex[] = {
+       EGRP("UPHY0_EXT", 1, pins_upex),
+};
+
+static const unsigned int pins_prp1[] = {
+       D(0, 6), D(0, 7),
+       D(1, 0), D(1, 1), D(1, 2), D(1, 3), D(1, 4), D(1, 5), D(1, 6), D(1, 7),
+       D(2, 1), D(2, 2), D(2, 3), D(2, 4), D(2, 5), D(2, 6), D(2, 7),
+       D(3, 0), D(3, 1), D(3, 2),
+};
+
+static const unsigned int pins_prp2[] = {
+       D(3, 4), D(3, 6), D(3, 7),
+       D(4, 0), D(4, 1), D(4, 2), D(4, 3), D(4, 4), D(4, 5), D(4, 6), D(4, 7),
+       D(5, 0), D(5, 1), D(5, 2), D(5, 3), D(5, 4), D(5, 5), D(5, 6), D(5, 7),
+       D(6, 4),
+};
+
+static const struct sppctl_grp sp7021grps_prbp[] = {
+       EGRP("PROBE_PORT1", 1, pins_prp1),
+       EGRP("PROBE_PORT2", 2, pins_prp2),
+};
+
+const struct sppctl_func sppctl_list_funcs[] = {
+       FNCN("L2SW_CLK_OUT",        pinmux_type_fpmx, 0x00, 0, 7),
+       FNCN("L2SW_MAC_SMI_MDC",    pinmux_type_fpmx, 0x00, 8, 7),
+       FNCN("L2SW_LED_FLASH0",     pinmux_type_fpmx, 0x01, 0, 7),
+       FNCN("L2SW_LED_FLASH1",     pinmux_type_fpmx, 0x01, 8, 7),
+       FNCN("L2SW_LED_ON0",        pinmux_type_fpmx, 0x02, 0, 7),
+       FNCN("L2SW_LED_ON1",        pinmux_type_fpmx, 0x02, 8, 7),
+       FNCN("L2SW_MAC_SMI_MDIO",   pinmux_type_fpmx, 0x03, 0, 7),
+       FNCN("L2SW_P0_MAC_RMII_TXEN",   pinmux_type_fpmx, 0x03, 8, 7),
+       FNCN("L2SW_P0_MAC_RMII_TXD0",   pinmux_type_fpmx, 0x04, 0, 7),
+       FNCN("L2SW_P0_MAC_RMII_TXD1",   pinmux_type_fpmx, 0x04, 8, 7),
+       FNCN("L2SW_P0_MAC_RMII_CRSDV",  pinmux_type_fpmx, 0x05, 0, 7),
+       FNCN("L2SW_P0_MAC_RMII_RXD0",   pinmux_type_fpmx, 0x05, 8, 7),
+       FNCN("L2SW_P0_MAC_RMII_RXD1",   pinmux_type_fpmx, 0x06, 0, 7),
+       FNCN("L2SW_P0_MAC_RMII_RXER",   pinmux_type_fpmx, 0x06, 8, 7),
+       FNCN("L2SW_P1_MAC_RMII_TXEN",   pinmux_type_fpmx, 0x07, 0, 7),
+       FNCN("L2SW_P1_MAC_RMII_TXD0",   pinmux_type_fpmx, 0x07, 8, 7),
+       FNCN("L2SW_P1_MAC_RMII_TXD1",   pinmux_type_fpmx, 0x08, 0, 7),
+       FNCN("L2SW_P1_MAC_RMII_CRSDV",  pinmux_type_fpmx, 0x08, 8, 7),
+       FNCN("L2SW_P1_MAC_RMII_RXD0",   pinmux_type_fpmx, 0x09, 0, 7),
+       FNCN("L2SW_P1_MAC_RMII_RXD1",   pinmux_type_fpmx, 0x09, 8, 7),
+       FNCN("L2SW_P1_MAC_RMII_RXER",   pinmux_type_fpmx, 0x0A, 0, 7),
+       FNCN("DAISY_MODE",      pinmux_type_fpmx, 0x0A, 8, 7),
+       FNCN("SDIO_CLK",        pinmux_type_fpmx, 0x0B, 0, 7),    /* 1x SDIO */
+       FNCN("SDIO_CMD",        pinmux_type_fpmx, 0x0B, 8, 7),
+       FNCN("SDIO_D0",         pinmux_type_fpmx, 0x0C, 0, 7),
+       FNCN("SDIO_D1",         pinmux_type_fpmx, 0x0C, 8, 7),
+       FNCN("SDIO_D2",         pinmux_type_fpmx, 0x0D, 0, 7),
+       FNCN("SDIO_D3",         pinmux_type_fpmx, 0x0D, 8, 7),
+       FNCN("PWM0",            pinmux_type_fpmx, 0x0E, 0, 7),    /* 8x PWM */
+       FNCN("PWM1",            pinmux_type_fpmx, 0x0E, 8, 7),
+       FNCN("PWM2",            pinmux_type_fpmx, 0x0F, 0, 7),
+       FNCN("PWM3",            pinmux_type_fpmx, 0x0F, 8, 7),
+
+       FNCN("PWM4",            pinmux_type_fpmx, 0x10, 0, 7),
+       FNCN("PWM5",            pinmux_type_fpmx, 0x10, 8, 7),
+       FNCN("PWM6",            pinmux_type_fpmx, 0x11, 0, 7),
+       FNCN("PWM7",            pinmux_type_fpmx, 0x11, 8, 7),
+       FNCN("ICM0_D",          pinmux_type_fpmx, 0x12, 0, 7),    /* 4x Input captures */
+       FNCN("ICM1_D",          pinmux_type_fpmx, 0x12, 8, 7),
+       FNCN("ICM2_D",          pinmux_type_fpmx, 0x13, 0, 7),
+       FNCN("ICM3_D",          pinmux_type_fpmx, 0x13, 8, 7),
+       FNCN("ICM0_CLK",        pinmux_type_fpmx, 0x14, 0, 7),
+       FNCN("ICM1_CLK",        pinmux_type_fpmx, 0x14, 8, 7),
+       FNCN("ICM2_CLK",        pinmux_type_fpmx, 0x15, 0, 7),
+       FNCN("ICM3_CLK",        pinmux_type_fpmx, 0x15, 8, 7),
+       FNCN("SPIM0_INT",       pinmux_type_fpmx, 0x16, 0, 7),    /* 4x SPI masters */
+       FNCN("SPIM0_CLK",       pinmux_type_fpmx, 0x16, 8, 7),
+       FNCN("SPIM0_EN",        pinmux_type_fpmx, 0x17, 0, 7),
+       FNCN("SPIM0_DO",        pinmux_type_fpmx, 0x17, 8, 7),
+       FNCN("SPIM0_DI",        pinmux_type_fpmx, 0x18, 0, 7),
+       FNCN("SPIM1_INT",       pinmux_type_fpmx, 0x18, 8, 7),
+       FNCN("SPIM1_CLK",       pinmux_type_fpmx, 0x19, 0, 7),
+       FNCN("SPIM1_EN",        pinmux_type_fpmx, 0x19, 8, 7),
+       FNCN("SPIM1_DO",        pinmux_type_fpmx, 0x1A, 0, 7),
+       FNCN("SPIM1_DI",        pinmux_type_fpmx, 0x1A, 8, 7),
+       FNCN("SPIM2_INT",       pinmux_type_fpmx, 0x1B, 0, 7),
+       FNCN("SPIM2_CLK",       pinmux_type_fpmx, 0x1B, 8, 7),
+       FNCN("SPIM2_EN",        pinmux_type_fpmx, 0x1C, 0, 7),
+       FNCN("SPIM2_DO",        pinmux_type_fpmx, 0x1C, 8, 7),
+       FNCN("SPIM2_DI",        pinmux_type_fpmx, 0x1D, 0, 7),
+       FNCN("SPIM3_INT",       pinmux_type_fpmx, 0x1D, 8, 7),
+       FNCN("SPIM3_CLK",       pinmux_type_fpmx, 0x1E, 0, 7),
+       FNCN("SPIM3_EN",        pinmux_type_fpmx, 0x1E, 8, 7),
+       FNCN("SPIM3_DO",        pinmux_type_fpmx, 0x1F, 0, 7),
+       FNCN("SPIM3_DI",        pinmux_type_fpmx, 0x1F, 8, 7),
+
+       FNCN("SPI0S_INT",       pinmux_type_fpmx, 0x20, 0, 7),    /* 4x SPI slaves */
+       FNCN("SPI0S_CLK",       pinmux_type_fpmx, 0x20, 8, 7),
+       FNCN("SPI0S_EN",        pinmux_type_fpmx, 0x21, 0, 7),
+       FNCN("SPI0S_DO",        pinmux_type_fpmx, 0x21, 8, 7),
+       FNCN("SPI0S_DI",        pinmux_type_fpmx, 0x22, 0, 7),
+       FNCN("SPI1S_INT",       pinmux_type_fpmx, 0x22, 8, 7),
+       FNCN("SPI1S_CLK",       pinmux_type_fpmx, 0x23, 0, 7),
+       FNCN("SPI1S_EN",        pinmux_type_fpmx, 0x23, 8, 7),
+       FNCN("SPI1S_DO",        pinmux_type_fpmx, 0x24, 0, 7),
+       FNCN("SPI1S_DI",        pinmux_type_fpmx, 0x24, 8, 7),
+       FNCN("SPI2S_INT",       pinmux_type_fpmx, 0x25, 0, 7),
+       FNCN("SPI2S_CLK",       pinmux_type_fpmx, 0x25, 8, 7),
+       FNCN("SPI2S_EN",        pinmux_type_fpmx, 0x26, 0, 7),
+       FNCN("SPI2S_DO",        pinmux_type_fpmx, 0x26, 8, 7),
+       FNCN("SPI2S_DI",        pinmux_type_fpmx, 0x27, 0, 7),
+       FNCN("SPI3S_INT",       pinmux_type_fpmx, 0x27, 8, 7),
+       FNCN("SPI3S_CLK",       pinmux_type_fpmx, 0x28, 0, 7),
+       FNCN("SPI3S_EN",        pinmux_type_fpmx, 0x28, 8, 7),
+       FNCN("SPI3S_DO",        pinmux_type_fpmx, 0x29, 0, 7),
+       FNCN("SPI3S_DI",        pinmux_type_fpmx, 0x29, 8, 7),
+       FNCN("I2CM0_CLK",       pinmux_type_fpmx, 0x2A, 0, 7),    /* 4x I2C masters */
+       FNCN("I2CM0_DAT",       pinmux_type_fpmx, 0x2A, 8, 7),
+       FNCN("I2CM1_CLK",       pinmux_type_fpmx, 0x2B, 0, 7),
+       FNCN("I2CM1_DAT",       pinmux_type_fpmx, 0x2B, 8, 7),
+       FNCN("I2CM2_CLK",       pinmux_type_fpmx, 0x2C, 0, 7),
+       FNCN("I2CM2_DAT",       pinmux_type_fpmx, 0x2C, 8, 7),
+       FNCN("I2CM3_CLK",       pinmux_type_fpmx, 0x2D, 0, 7),
+       FNCN("I2CM3_DAT",       pinmux_type_fpmx, 0x2D, 8, 7),
+       FNCN("UA1_TX",          pinmux_type_fpmx, 0x2E, 0, 7),    /* 4x UARTS */
+       FNCN("UA1_RX",          pinmux_type_fpmx, 0x2E, 8, 7),
+       FNCN("UA1_CTS",         pinmux_type_fpmx, 0x2F, 0, 7),
+       FNCN("UA1_RTS",         pinmux_type_fpmx, 0x2F, 8, 7),
+
+       FNCN("UA2_TX",          pinmux_type_fpmx, 0x30, 0, 7),
+       FNCN("UA2_RX",          pinmux_type_fpmx, 0x30, 8, 7),
+       FNCN("UA2_CTS",         pinmux_type_fpmx, 0x31, 0, 7),
+       FNCN("UA2_RTS",         pinmux_type_fpmx, 0x31, 8, 7),
+       FNCN("UA3_TX",          pinmux_type_fpmx, 0x32, 0, 7),
+       FNCN("UA3_RX",          pinmux_type_fpmx, 0x32, 8, 7),
+       FNCN("UA3_CTS",         pinmux_type_fpmx, 0x33, 0, 7),
+       FNCN("UA3_RTS",         pinmux_type_fpmx, 0x33, 8, 7),
+       FNCN("UA4_TX",          pinmux_type_fpmx, 0x34, 0, 7),
+       FNCN("UA4_RX",          pinmux_type_fpmx, 0x34, 8, 7),
+       FNCN("UA4_CTS",         pinmux_type_fpmx, 0x35, 0, 7),
+       FNCN("UA4_RTS",         pinmux_type_fpmx, 0x35, 8, 7),
+       FNCN("TIMER0_INT",      pinmux_type_fpmx, 0x36, 0, 7),    /* 4x timer int. */
+       FNCN("TIMER1_INT",      pinmux_type_fpmx, 0x36, 8, 7),
+       FNCN("TIMER2_INT",      pinmux_type_fpmx, 0x37, 0, 7),
+       FNCN("TIMER3_INT",      pinmux_type_fpmx, 0x37, 8, 7),
+       FNCN("GPIO_INT0",       pinmux_type_fpmx, 0x38, 0, 7),    /* 8x GPIO int. */
+       FNCN("GPIO_INT1",       pinmux_type_fpmx, 0x38, 8, 7),
+       FNCN("GPIO_INT2",       pinmux_type_fpmx, 0x39, 0, 7),
+       FNCN("GPIO_INT3",       pinmux_type_fpmx, 0x39, 8, 7),
+       FNCN("GPIO_INT4",       pinmux_type_fpmx, 0x3A, 0, 7),
+       FNCN("GPIO_INT5",       pinmux_type_fpmx, 0x3A, 8, 7),
+       FNCN("GPIO_INT6",       pinmux_type_fpmx, 0x3B, 0, 7),
+       FNCN("GPIO_INT7",       pinmux_type_fpmx, 0x3B, 8, 7),
+
+       /* MOON1 register */
+       FNCE("SPI_FLASH",       pinmux_type_grp, 0x01,  0, 2, sp7021grps_spif),
+       FNCE("SPI_FLASH_4BIT",  pinmux_type_grp, 0x01,  2, 2, sp7021grps_spi4),
+       FNCE("SPI_NAND",        pinmux_type_grp, 0x01,  4, 1, sp7021grps_snan),
+       FNCE("CARD0_EMMC",      pinmux_type_grp, 0x01,  5, 1, sp7021grps_emmc),
+       FNCE("SD_CARD",         pinmux_type_grp, 0x01,  6, 1, sp7021grps_sdsd),
+       FNCE("UA0",             pinmux_type_grp, 0x01,  7, 1, sp7021grps_uar0),
+       FNCE("ACHIP_DEBUG",     pinmux_type_grp, 0x01,  8, 2, sp7021grps_adbg),
+       FNCE("ACHIP_UA2AXI",    pinmux_type_grp, 0x01, 10, 2, sp7021grps_au2x),
+       FNCE("FPGA_IFX",        pinmux_type_grp, 0x01, 12, 1, sp7021grps_fpga),
+       FNCE("HDMI_TX",         pinmux_type_grp, 0x01, 13, 2, sp7021grps_hdmi),
+
+       FNCE("AUD_EXT_ADC_IFX0", pinmux_type_grp, 0x01, 15, 1, sp7021grps_eadc),
+       FNCE("AUD_EXT_DAC_IFX0", pinmux_type_grp, 0x02,  0, 1, sp7021grps_edac),
+       FNCE("SPDIF_RX",        pinmux_type_grp, 0x02,  2, 1, sp7021grps_spdi),
+       FNCE("SPDIF_TX",        pinmux_type_grp, 0x02,  3, 1, sp7021grps_spdo),
+       FNCE("TDMTX_IFX0",      pinmux_type_grp, 0x02,  4, 1, sp7021grps_tdmt),
+       FNCE("TDMRX_IFX0",      pinmux_type_grp, 0x02,  5, 1, sp7021grps_tdmr),
+       FNCE("PDMRX_IFX0",      pinmux_type_grp, 0x02,  6, 1, sp7021grps_pdmr),
+       FNCE("PCM_IEC_TX",      pinmux_type_grp, 0x02,  7, 1, sp7021grps_pcmt),
+       FNCE("LCDIF",           pinmux_type_grp, 0x04,  6, 1, sp7021grps_lcdi),
+       FNCE("DVD_DSP_DEBUG",   pinmux_type_grp, 0x02,  8, 1, sp7021grps_dvdd),
+       FNCE("I2C_DEBUG",       pinmux_type_grp, 0x02,  9, 1, sp7021grps_i2cd),
+       FNCE("I2C_SLAVE",       pinmux_type_grp, 0x02, 10, 1, sp7021grps_i2cs),
+       FNCE("WAKEUP",          pinmux_type_grp, 0x02, 11, 1, sp7021grps_wakp),
+       FNCE("UART2AXI",        pinmux_type_grp, 0x02, 12, 2, sp7021grps_u2ax),
+       FNCE("USB0_I2C",        pinmux_type_grp, 0x02, 14, 2, sp7021grps_u0ic),
+       FNCE("USB1_I2C",        pinmux_type_grp, 0x03,  0, 2, sp7021grps_u1ic),
+       FNCE("USB0_OTG",        pinmux_type_grp, 0x03,  2, 1, sp7021grps_u0ot),
+       FNCE("USB1_OTG",        pinmux_type_grp, 0x03,  3, 1, sp7021grps_u1ot),
+       FNCE("UPHY0_DEBUG",     pinmux_type_grp, 0x03,  4, 1, sp7021grps_up0d),
+       FNCE("UPHY1_DEBUG",     pinmux_type_grp, 0x03,  5, 1, sp7021grps_up1d),
+       FNCE("UPHY0_EXT",       pinmux_type_grp, 0x03,  6, 1, sp7021grps_upex),
+       FNCE("PROBE_PORT",      pinmux_type_grp, 0x03,  7, 2, sp7021grps_prbp),
+};
+
+const size_t sppctl_list_funcs_sz = ARRAY_SIZE(sppctl_list_funcs);
index 80d6750..dff73d8 100644 (file)
 #include "../core.h"
 #include "pinctrl-sunxi.h"
 
+/*
+ * These lock classes tell lockdep that GPIO IRQs are in a different
+ * category than their parents, so it won't report false recursion.
+ */
+static struct lock_class_key sunxi_pinctrl_irq_lock_class;
+static struct lock_class_key sunxi_pinctrl_irq_request_class;
+
 static struct irq_chip sunxi_pinctrl_edge_irq_chip;
 static struct irq_chip sunxi_pinctrl_level_irq_chip;
 
@@ -777,11 +784,10 @@ static int sunxi_pmx_request(struct pinctrl_dev *pctldev, unsigned offset)
 
        snprintf(supply, sizeof(supply), "vcc-p%c", 'a' + bank);
        reg = regulator_get(pctl->dev, supply);
-       if (IS_ERR(reg)) {
-               dev_err(pctl->dev, "Couldn't get bank P%c regulator\n",
-                       'A' + bank);
-               return PTR_ERR(reg);
-       }
+       if (IS_ERR(reg))
+               return dev_err_probe(pctl->dev, PTR_ERR(reg),
+                                    "Couldn't get bank P%c regulator\n",
+                                    'A' + bank);
 
        ret = regulator_enable(reg);
        if (ret) {
@@ -1555,6 +1561,8 @@ int sunxi_pinctrl_init_with_variant(struct platform_device *pdev,
        for (i = 0; i < (pctl->desc->irq_banks * IRQ_PER_BANK); i++) {
                int irqno = irq_create_mapping(pctl->domain, i);
 
+               irq_set_lockdep_class(irqno, &sunxi_pinctrl_irq_lock_class,
+                                     &sunxi_pinctrl_irq_request_class);
                irq_set_chip_and_handler(irqno, &sunxi_pinctrl_edge_irq_chip,
                                         handle_edge_irq);
                irq_set_chip_data(irqno, pctl);
index a4fa8e3..65ed20b 100644 (file)
@@ -461,10 +461,18 @@ static const struct pinctrl_pin_desc uniphier_ld11_pins[] = {
                             166, UNIPHIER_PIN_PULL_DOWN),
 };
 
-static const unsigned ain1_pins[] = {151, 152, 153, 154, 155, 156, 157};
-static const int ain1_muxvals[] = {4, 4, 4, 4, 4, 4, 4};
-static const unsigned aout1_pins[] = {137, 138, 139, 140, 141, 142};
-static const int aout1_muxvals[] = {0, 0, 0, 0, 0, 0};
+static const unsigned ain1_pins[] = {151, 152, 153, 154};
+static const int ain1_muxvals[] = {4, 4, 4, 4};
+static const unsigned ain1_dat2_pins[] = {155};
+static const int ain1_dat2_muxvals[] = {4};
+static const unsigned ain1_dat4_pins[] = {156, 157};
+static const int ain1_dat4_muxvals[] = {4, 4};
+static const unsigned aout1_pins[] = {137, 138, 139, 140};
+static const int aout1_muxvals[] = {0, 0, 0, 0};
+static const unsigned aout1_dat2_pins[] = {141};
+static const int aout1_dat2_muxvals[] = {0};
+static const unsigned aout1_dat4_pins[] = {142, 143};
+static const int aout1_dat4_muxvals[] = {0, 3};
 static const unsigned ainiec1_pins[] = {150};
 static const int ainiec1_muxvals[] = {4};
 static const unsigned ainiec1b_pins[] = {141};
@@ -582,7 +590,11 @@ static const unsigned int gpio_range5_pins[] = {
 
 static const struct uniphier_pinctrl_group uniphier_ld11_groups[] = {
        UNIPHIER_PINCTRL_GROUP(ain1),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat4),
        UNIPHIER_PINCTRL_GROUP(aout1),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat4),
        UNIPHIER_PINCTRL_GROUP(ainiec1),
        UNIPHIER_PINCTRL_GROUP(ainiec1b),
        UNIPHIER_PINCTRL_GROUP(aoutiec1),
@@ -626,8 +638,10 @@ static const struct uniphier_pinctrl_group uniphier_ld11_groups[] = {
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range5),
 };
 
-static const char * const ain1_groups[] = {"ain1"};
-static const char * const aout1_groups[] = {"aout1"};
+static const char * const ain1_groups[] = {"ain1", "ain1_dat2",
+                                          "ain1_dat4"};
+static const char * const aout1_groups[] = {"aout1", "aout1_dat2",
+                                           "aout1_dat4"};
 static const char * const ainiec1_groups[] = {"ainiec1", "ainiec1b"};
 static const char * const aoutiec1_groups[] = {"aoutiec1"};
 static const char * const aoutiec2_groups[] = {"aoutiec2"};
index 8507369..a68b21f 100644 (file)
@@ -542,18 +542,38 @@ static const struct pinctrl_pin_desc uniphier_ld20_pins[] = {
                             175, UNIPHIER_PIN_PULL_DOWN),
 };
 
-static const unsigned ain1_pins[] = {150, 151, 152, 153, 154, 155, 156};
-static const int ain1_muxvals[] = {4, 4, 4, 4, 4, 4, 4};
-static const unsigned ain2_pins[] = {116, 117, 118, 119, 120, 121, 122};
-static const int ain2_muxvals[] = {26, 26, 26, 26, 26, 26, 26};
+static const unsigned ain1_pins[] = {150, 151, 152, 153};
+static const int ain1_muxvals[] = {4, 4, 4, 4};
+static const unsigned ain1_dat2_pins[] = {154};
+static const int ain1_dat2_muxvals[] = {4};
+static const unsigned ain1_dat4_pins[] = {155, 156};
+static const int ain1_dat4_muxvals[] = {4, 4};
+static const unsigned ain2_pins[] = {116, 117, 118, 119};
+static const int ain2_muxvals[] = {26, 26, 26, 26};
+static const unsigned ain2_dat2_pins[] = {120};
+static const int ain2_dat2_muxvals[] = {26};
+static const unsigned ain2_dat4_pins[] = {121, 122};
+static const int ain2_dat4_muxvals[] = {26, 26};
 static const unsigned ain3_pins[] = {116, 117, 118, 119};
 static const int ain3_muxvals[] = {27, 27, 27, 27};
-static const unsigned aout1_pins[] = {137, 138, 139, 140, 141, 142};
-static const int aout1_muxvals[] = {0, 0, 0, 0, 0, 0};
-static const unsigned aout1b_pins[] = {150, 151, 152, 153, 154, 155, 156};
-static const int aout1b_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
-static const unsigned aout2_pins[] = {165, 157, 162, 158, 159, 160, 161};
-static const int aout2_muxvals[] = {2, 2, 2, 1, 1, 1, 1};
+static const unsigned aout1_pins[] = {137, 138, 139, 140};
+static const int aout1_muxvals[] = {0, 0, 0, 0};
+static const unsigned aout1_dat2_pins[] = {141};
+static const int aout1_dat2_muxvals[] = {0};
+static const unsigned aout1_dat4_pins[] = {142, 156};
+static const int aout1_dat4_muxvals[] = {0, 1};
+static const unsigned aout1b_pins[] = {150, 151, 152, 153};
+static const int aout1b_muxvals[] = {1, 1, 1, 1};
+static const unsigned aout1b_dat2_pins[] = {154};
+static const int aout1b_dat2_muxvals[] = {1};
+static const unsigned aout1b_dat4_pins[] = {155, 156};
+static const int aout1b_dat4_muxvals[] = {1, 1};
+static const unsigned aout2_pins[] = {165, 157, 162, 158};
+static const int aout2_muxvals[] = {2, 2, 2, 1};
+static const unsigned aout2_dat2_pins[] = {159};
+static const int aout2_dat2_muxvals[] = {1};
+static const unsigned aout2_dat4_pins[] = {160, 161};
+static const int aout2_dat4_muxvals[] = {1, 1};
 static const unsigned aout3_pins[] = {166, 167, 168, 163};
 static const int aout3_muxvals[] = {2, 2, 2, 1};
 static const unsigned aout4_pins[] = {169, 170, 171, 164};
@@ -682,11 +702,21 @@ static const unsigned int gpio_range2_pins[] = {
 
 static const struct uniphier_pinctrl_group uniphier_ld20_groups[] = {
        UNIPHIER_PINCTRL_GROUP(ain1),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat4),
        UNIPHIER_PINCTRL_GROUP(ain2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat4),
        UNIPHIER_PINCTRL_GROUP(ain3),
        UNIPHIER_PINCTRL_GROUP(aout1),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat4),
        UNIPHIER_PINCTRL_GROUP(aout1b),
+       UNIPHIER_PINCTRL_GROUP(aout1b_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout1b_dat4),
        UNIPHIER_PINCTRL_GROUP(aout2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat4),
        UNIPHIER_PINCTRL_GROUP(aout3),
        UNIPHIER_PINCTRL_GROUP(aout4),
        UNIPHIER_PINCTRL_GROUP(aoutiec1),
@@ -734,11 +764,17 @@ static const struct uniphier_pinctrl_group uniphier_ld20_groups[] = {
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range2),
 };
 
-static const char * const ain1_groups[] = {"ain1"};
-static const char * const ain2_groups[] = {"ain2"};
+static const char * const ain1_groups[] = {"ain1", "ain1_dat2",
+                                          "ain1_dat4"};
+static const char * const ain2_groups[] = {"ain2", "ain2_dat2",
+                                          "ain2_dat4"};
 static const char * const ain3_groups[] = {"ain3"};
-static const char * const aout1_groups[] = {"aout1", "aout1b"};
-static const char * const aout2_groups[] = {"aout2"};
+static const char * const aout1_groups[] = {"aout1", "aout1_dat2",
+                                           "aout1_dat4",
+                                           "aout1b", "aout1b_dat2",
+                                           "aout1b_dat4"};
+static const char * const aout2_groups[] = {"aout2", "aout2_dat2",
+                                           "aout2_dat4"};
 static const char * const aout3_groups[] = {"aout3"};
 static const char * const aout4_groups[] = {"aout4"};
 static const char * const aoutiec1_groups[] = {"aoutiec1"};
index e52e65a..2a9dbf9 100644 (file)
@@ -721,12 +721,32 @@ static const struct pinctrl_pin_desc uniphier_pxs2_pins[] = {
 
 static const unsigned ain1_pins[] = {161, 162, 173, 174};
 static const int ain1_muxvals[] = {8, 8, 8, 8};
-static const unsigned ain2_pins[] = {98, 99, 100, 101, 102, 103, 104};
-static const int ain2_muxvals[] = {8, 8, 8, 8, 8, 8, 8};
+static const unsigned ain1_dat2_pins[] = {127};
+static const int ain1_dat2_muxvals[] = {3};
+static const unsigned ain1_dat4_pins[] = {128, 129};
+static const int ain1_dat4_muxvals[] = {3, 3};
+static const unsigned ain2_pins[] = {98, 99, 100, 101};
+static const int ain2_muxvals[] = {8, 8, 8, 8};
+static const unsigned ain2_dat2_pins[] = {102};
+static const int ain2_dat2_muxvals[] = {8};
+static const unsigned ain2_dat4_pins[] = {103, 104};
+static const int ain2_dat4_muxvals[] = {8, 8};
+static const unsigned ain3_pins[] = {132, 133, 134, 131};
+static const int ain3_muxvals[] = {5, 5, 5, 5};
 static const unsigned ainiec1_pins[] = {91};
 static const int ainiec1_muxvals[] = {11};
-static const unsigned aout2_pins[] = {175, 176, 177, 178, 183, 184, 185};
-static const int aout2_muxvals[] = {8, 8, 8, 8, 9, 9, 9};
+static const unsigned aout1_pins[] = {87, 88, 89, 90};
+static const int aout1_muxvals[] = {11, 11, 11, 11};
+static const unsigned aout1_dat2_pins[] = {92};
+static const int aout1_dat2_muxvals[] = {11};
+static const unsigned aout1_dat4_pins[] = {93, 94};
+static const int aout1_dat4_muxvals[] = {11, 11};
+static const unsigned aout2_pins[] = {177, 178, 175, 176};
+static const int aout2_muxvals[] = {8, 8, 8, 8};
+static const unsigned aout2_dat2_pins[] = {183};
+static const int aout2_dat2_muxvals[] = {9};
+static const unsigned aout2_dat4_pins[] = {184, 185};
+static const int aout2_dat4_muxvals[] = {9, 9};
 static const unsigned aout3_pins[] = {105, 106, 107, 108};
 static const int aout3_muxvals[] = {8, 8, 8, 8};
 static const unsigned aoutiec1_pins[] = {95};
@@ -797,8 +817,12 @@ static const unsigned uart3b_pins[] = {181, 182};
 static const int uart3b_muxvals[] = {10, 10};
 static const unsigned usb0_pins[] = {56, 57};
 static const int usb0_muxvals[] = {8, 8};
+static const unsigned usb0_device_pins[] = {213};
+static const int usb0_device_muxvals[] = {9};
 static const unsigned usb1_pins[] = {58, 59};
 static const int usb1_muxvals[] = {8, 8};
+static const unsigned usb1_device_pins[] = {214};
+static const int usb1_device_muxvals[] = {9};
 static const unsigned usb2_pins[] = {60, 61};
 static const int usb2_muxvals[] = {8, 8};
 static const unsigned usb3_pins[] = {62, 63};
@@ -838,9 +862,19 @@ static const unsigned int gpio_range1_pins[] = {
 
 static const struct uniphier_pinctrl_group uniphier_pxs2_groups[] = {
        UNIPHIER_PINCTRL_GROUP(ain1),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat4),
        UNIPHIER_PINCTRL_GROUP(ain2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat4),
+       UNIPHIER_PINCTRL_GROUP(ain3),
        UNIPHIER_PINCTRL_GROUP(ainiec1),
+       UNIPHIER_PINCTRL_GROUP(aout1),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat4),
        UNIPHIER_PINCTRL_GROUP(aout2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat4),
        UNIPHIER_PINCTRL_GROUP(aout3),
        UNIPHIER_PINCTRL_GROUP(aoutiec1),
        UNIPHIER_PINCTRL_GROUP(aoutiec2),
@@ -871,17 +905,25 @@ static const struct uniphier_pinctrl_group uniphier_pxs2_groups[] = {
        UNIPHIER_PINCTRL_GROUP(uart3),
        UNIPHIER_PINCTRL_GROUP(uart3b),
        UNIPHIER_PINCTRL_GROUP(usb0),
+       UNIPHIER_PINCTRL_GROUP(usb0_device),
        UNIPHIER_PINCTRL_GROUP(usb1),
+       UNIPHIER_PINCTRL_GROUP(usb1_device),
        UNIPHIER_PINCTRL_GROUP(usb2),
        UNIPHIER_PINCTRL_GROUP(usb3),
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range0),
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range1),
 };
 
-static const char * const ain1_groups[] = {"ain1"};
-static const char * const ain2_groups[] = {"ain2"};
+static const char * const ain1_groups[] = {"ain1", "ain1_dat2",
+                                          "ain1_dat4"};
+static const char * const ain2_groups[] = {"ain2", "ain2_dat2",
+                                          "ain2_dat4"};
+static const char * const ain3_groups[] = {"ain3"};
 static const char * const ainiec1_groups[] = {"ainiec1"};
-static const char * const aout2_groups[] = {"aout2"};
+static const char * const aout1_groups[] = {"aout1", "aout1_dat2",
+                                           "aout1_dat4"};
+static const char * const aout2_groups[] = {"aout2", "aout2_dat2",
+                                           "aout2_dat4"};
 static const char * const aout3_groups[] = {"aout3"};
 static const char * const aoutiec1_groups[] = {"aoutiec1"};
 static const char * const aoutiec2_groups[] = {"aoutiec2"};
@@ -906,15 +948,17 @@ static const char * const uart0_groups[] = {"uart0", "uart0b",
 static const char * const uart1_groups[] = {"uart1"};
 static const char * const uart2_groups[] = {"uart2"};
 static const char * const uart3_groups[] = {"uart3", "uart3b"};
-static const char * const usb0_groups[] = {"usb0"};
-static const char * const usb1_groups[] = {"usb1"};
+static const char * const usb0_groups[] = {"usb0", "usb0_device"};
+static const char * const usb1_groups[] = {"usb1", "usb1_device"};
 static const char * const usb2_groups[] = {"usb2"};
 static const char * const usb3_groups[] = {"usb3"};
 
 static const struct uniphier_pinmux_function uniphier_pxs2_functions[] = {
        UNIPHIER_PINMUX_FUNCTION(ain1),
        UNIPHIER_PINMUX_FUNCTION(ain2),
+       UNIPHIER_PINMUX_FUNCTION(ain3),
        UNIPHIER_PINMUX_FUNCTION(ainiec1),
+       UNIPHIER_PINMUX_FUNCTION(aout1),
        UNIPHIER_PINMUX_FUNCTION(aout2),
        UNIPHIER_PINMUX_FUNCTION(aout3),
        UNIPHIER_PINMUX_FUNCTION(aoutiec1),
index 4810db6..ab3bd2d 100644 (file)
@@ -767,14 +767,30 @@ static const struct pinctrl_pin_desc uniphier_pxs3_pins[] = {
                             250, UNIPHIER_PIN_PULL_DOWN),
 };
 
-static const unsigned ain1_pins[] = {186, 187, 188, 189, 237, 238, 239};
-static const int ain1_muxvals[] = {0, 0, 0, 0, 1, 1, 1};
-static const unsigned ain2_pins[] = {243, 244, 245, 246, 247, 248, 249};
-static const int ain2_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
-static const unsigned aout1_pins[] = {226, 227, 228, 229, 230, 231, 232};
-static const int aout1_muxvals[] = {1, 1, 1, 1, 1, 1, 1};
-static const unsigned aout2_pins[] = {192, 193, 194, 195, 196, 197, 198};
-static const int aout2_muxvals[] = {0, 0, 0, 0, 0, 0, 0};
+static const unsigned ain1_pins[] = {186, 187, 188, 189};
+static const int ain1_muxvals[] = {0, 0, 0, 0};
+static const unsigned ain1_dat2_pins[] = {237};
+static const int ain1_dat2_muxvals[] = {1};
+static const unsigned ain1_dat4_pins[] = {238, 239};
+static const int ain1_dat4_muxvals[] = {1, 1};
+static const unsigned ain2_pins[] = {243, 244, 245, 246};
+static const int ain2_muxvals[] = {1, 1, 1, 1};
+static const unsigned ain2_dat2_pins[] = {247};
+static const int ain2_dat2_muxvals[] = {1};
+static const unsigned ain2_dat4_pins[] = {248, 249};
+static const int ain2_dat4_muxvals[] = {1, 1};
+static const unsigned aout1_pins[] = {226, 227, 228, 229};
+static const int aout1_muxvals[] = {1, 1, 1, 1};
+static const unsigned aout1_dat2_pins[] = {230};
+static const int aout1_dat2_muxvals[] = {1};
+static const unsigned aout1_dat4_pins[] = {231, 232};
+static const int aout1_dat4_muxvals[] = {1, 1};
+static const unsigned aout2_pins[] = {192, 193, 194, 195};
+static const int aout2_muxvals[] = {0, 0, 0, 0};
+static const unsigned aout2_dat2_pins[] = {196};
+static const int aout2_dat2_muxvals[] = {0};
+static const unsigned aout2_dat4_pins[] = {197, 198};
+static const int aout2_dat4_muxvals[] = {0, 0};
 static const unsigned aout3_pins[] = {199, 200, 201, 202};
 static const int aout3_muxvals[] = {0, 0, 0, 0};
 static const unsigned ainiec1_pins[] = {240};
@@ -839,8 +855,12 @@ static const unsigned int uart3_pins[] = {98, 99};
 static const int uart3_muxvals[] = {0, 0};
 static const unsigned int usb0_pins[] = {84, 85};
 static const int usb0_muxvals[] = {0, 0};
+static const unsigned int usb0_device_pins[] = {110};
+static const int usb0_device_muxvals[] = {2};
 static const unsigned int usb1_pins[] = {86, 87};
 static const int usb1_muxvals[] = {0, 0};
+static const unsigned int usb1_device_pins[] = {111};
+static const int usb1_device_muxvals[] = {2};
 static const unsigned int usb2_pins[] = {88, 89};
 static const int usb2_muxvals[] = {0, 0};
 static const unsigned int usb3_pins[] = {90, 91};
@@ -888,9 +908,17 @@ static const unsigned int gpio_range2_pins[] = {
 
 static const struct uniphier_pinctrl_group uniphier_pxs3_groups[] = {
        UNIPHIER_PINCTRL_GROUP(ain1),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain1_dat4),
        UNIPHIER_PINCTRL_GROUP(ain2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat2),
+       UNIPHIER_PINCTRL_GROUP(ain2_dat4),
        UNIPHIER_PINCTRL_GROUP(aout1),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout1_dat4),
        UNIPHIER_PINCTRL_GROUP(aout2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat2),
+       UNIPHIER_PINCTRL_GROUP(aout2_dat4),
        UNIPHIER_PINCTRL_GROUP(aout3),
        UNIPHIER_PINCTRL_GROUP(ainiec1),
        UNIPHIER_PINCTRL_GROUP(aoutiec1),
@@ -918,7 +946,9 @@ static const struct uniphier_pinctrl_group uniphier_pxs3_groups[] = {
        UNIPHIER_PINCTRL_GROUP(uart2),
        UNIPHIER_PINCTRL_GROUP(uart3),
        UNIPHIER_PINCTRL_GROUP(usb0),
+       UNIPHIER_PINCTRL_GROUP(usb0_device),
        UNIPHIER_PINCTRL_GROUP(usb1),
+       UNIPHIER_PINCTRL_GROUP(usb1_device),
        UNIPHIER_PINCTRL_GROUP(usb2),
        UNIPHIER_PINCTRL_GROUP(usb3),
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range0),
@@ -926,10 +956,14 @@ static const struct uniphier_pinctrl_group uniphier_pxs3_groups[] = {
        UNIPHIER_PINCTRL_GROUP_GPIO(gpio_range2),
 };
 
-static const char * const ain1_groups[] = {"ain1"};
-static const char * const ain2_groups[] = {"ain2"};
-static const char * const aout1_groups[] = {"aout1"};
-static const char * const aout2_groups[] = {"aout2"};
+static const char * const ain1_groups[] = {"ain1", "ain1_dat2",
+                                          "ain1_dat4"};
+static const char * const ain2_groups[] = {"ain2", "ain2_dat2",
+                                          "ain1_dat4"};
+static const char * const aout1_groups[] = {"aout1", "aout1_dat2",
+                                           "aout1_dat4"};
+static const char * const aout2_groups[] = {"aout2", "aout2_dat2",
+                                           "aout2_dat4"};
 static const char * const aout3_groups[] = {"aout3"};
 static const char * const ainiec1_groups[] = {"ainiec1"};
 static const char * const aoutiec1_groups[] = {"aoutiec1"};
@@ -954,8 +988,8 @@ static const char * const uart0_groups[] = {"uart0", "uart0_ctsrts",
 static const char * const uart1_groups[] = {"uart1"};
 static const char * const uart2_groups[] = {"uart2"};
 static const char * const uart3_groups[] = {"uart3"};
-static const char * const usb0_groups[] = {"usb0"};
-static const char * const usb1_groups[] = {"usb1"};
+static const char * const usb0_groups[] = {"usb0", "usb0_device"};
+static const char * const usb1_groups[] = {"usb1", "usb1_device"};
 static const char * const usb2_groups[] = {"usb2"};
 static const char * const usb3_groups[] = {"usb3"};
 
diff --git a/include/dt-bindings/gpio/meson-s4-gpio.h b/include/dt-bindings/gpio/meson-s4-gpio.h
new file mode 100644 (file)
index 0000000..35aee21
--- /dev/null
@@ -0,0 +1,99 @@
+/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
+/*
+ * Copyright (c) 2021 Amlogic, Inc. All rights reserved.
+ * Author: Qianggui Song <qianggui.song@amlogic.com>
+ */
+
+#ifndef _DT_BINDINGS_MESON_S4_GPIO_H
+#define _DT_BINDINGS_MESON_S4_GPIO_H
+
+#define        GPIOB_0         0
+#define        GPIOB_1         1
+#define        GPIOB_2         2
+#define        GPIOB_3         3
+#define        GPIOB_4         4
+#define        GPIOB_5         5
+#define        GPIOB_6         6
+#define        GPIOB_7         7
+#define        GPIOB_8         8
+#define        GPIOB_9         9
+#define        GPIOB_10        10
+#define        GPIOB_11        11
+#define        GPIOB_12        12
+#define        GPIOB_13        13
+
+#define        GPIOC_0         14
+#define        GPIOC_1         15
+#define        GPIOC_2         16
+#define        GPIOC_3         17
+#define        GPIOC_4         18
+#define        GPIOC_5         19
+#define        GPIOC_6         20
+#define        GPIOC_7         21
+
+#define        GPIOE_0         22
+#define        GPIOE_1         23
+
+#define        GPIOD_0         24
+#define        GPIOD_1         25
+#define        GPIOD_2         26
+#define        GPIOD_3         27
+#define        GPIOD_4         28
+#define        GPIOD_5         29
+#define        GPIOD_6         30
+#define        GPIOD_7         31
+#define        GPIOD_8         32
+#define        GPIOD_9         33
+#define        GPIOD_10        34
+#define        GPIOD_11        35
+
+#define        GPIOH_0         36
+#define        GPIOH_1         37
+#define        GPIOH_2         38
+#define        GPIOH_3         39
+#define        GPIOH_4         40
+#define        GPIOH_5         41
+#define        GPIOH_6         42
+#define        GPIOH_7         43
+#define        GPIOH_8         44
+#define        GPIOH_9         45
+#define        GPIOH_10        46
+#define        GPIOH_11        47
+
+#define        GPIOX_0         48
+#define        GPIOX_1         49
+#define        GPIOX_2         50
+#define        GPIOX_3         51
+#define        GPIOX_4         52
+#define        GPIOX_5         53
+#define        GPIOX_6         54
+#define        GPIOX_7         55
+#define        GPIOX_8         56
+#define        GPIOX_9         57
+#define        GPIOX_10        58
+#define        GPIOX_11        59
+#define        GPIOX_12        60
+#define        GPIOX_13        61
+#define        GPIOX_14        62
+#define        GPIOX_15        63
+#define        GPIOX_16        64
+#define        GPIOX_17        65
+#define        GPIOX_18        66
+#define        GPIOX_19        67
+
+#define        GPIOZ_0         68
+#define        GPIOZ_1         69
+#define        GPIOZ_2         70
+#define        GPIOZ_3         71
+#define        GPIOZ_4         72
+#define        GPIOZ_5         73
+#define        GPIOZ_6         74
+#define        GPIOZ_7         75
+#define        GPIOZ_8         76
+#define        GPIOZ_9         77
+#define        GPIOZ_10        78
+#define        GPIOZ_11        79
+#define        GPIOZ_12        80
+
+#define        GPIO_TEST_N     81
+#endif /* _DT_BINDINGS_MESON_S4_GPIO_H */
diff --git a/include/dt-bindings/pinctrl/sppctl-sp7021.h b/include/dt-bindings/pinctrl/sppctl-sp7021.h
new file mode 100644 (file)
index 0000000..629aa9b
--- /dev/null
@@ -0,0 +1,179 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Sunplus SP7021 dt-bindings Pinctrl header file
+ * Copyright (C) Sunplus Tech/Tibbo Tech.
+ * Author: Dvorkin Dmitry <dvorkin@tibbo.com>
+ */
+
+#ifndef        __DT_BINDINGS_PINCTRL_SPPCTL_SP7021_H__
+#define        __DT_BINDINGS_PINCTRL_SPPCTL_SP7021_H__
+
+#include <dt-bindings/pinctrl/sppctl.h>
+
+/*
+ * Please don't change the order of the following defines.
+ * They are based on order of 'hardware' control register
+ * defined in MOON2 ~ MOON3 registers.
+ */
+#define MUXF_GPIO                       0
+#define MUXF_IOP                        1
+#define MUXF_L2SW_CLK_OUT               2
+#define MUXF_L2SW_MAC_SMI_MDC           3
+#define MUXF_L2SW_LED_FLASH0            4
+#define MUXF_L2SW_LED_FLASH1            5
+#define MUXF_L2SW_LED_ON0               6
+#define MUXF_L2SW_LED_ON1               7
+#define MUXF_L2SW_MAC_SMI_MDIO          8
+#define MUXF_L2SW_P0_MAC_RMII_TXEN      9
+#define MUXF_L2SW_P0_MAC_RMII_TXD0      10
+#define MUXF_L2SW_P0_MAC_RMII_TXD1      11
+#define MUXF_L2SW_P0_MAC_RMII_CRSDV     12
+#define MUXF_L2SW_P0_MAC_RMII_RXD0      13
+#define MUXF_L2SW_P0_MAC_RMII_RXD1      14
+#define MUXF_L2SW_P0_MAC_RMII_RXER      15
+#define MUXF_L2SW_P1_MAC_RMII_TXEN      16
+#define MUXF_L2SW_P1_MAC_RMII_TXD0      17
+#define MUXF_L2SW_P1_MAC_RMII_TXD1      18
+#define MUXF_L2SW_P1_MAC_RMII_CRSDV     19
+#define MUXF_L2SW_P1_MAC_RMII_RXD0      20
+#define MUXF_L2SW_P1_MAC_RMII_RXD1      21
+#define MUXF_L2SW_P1_MAC_RMII_RXER      22
+#define MUXF_DAISY_MODE                 23
+#define MUXF_SDIO_CLK                   24
+#define MUXF_SDIO_CMD                   25
+#define MUXF_SDIO_D0                    26
+#define MUXF_SDIO_D1                    27
+#define MUXF_SDIO_D2                    28
+#define MUXF_SDIO_D3                    29
+#define MUXF_PWM0                       30
+#define MUXF_PWM1                       31
+#define MUXF_PWM2                       32
+#define MUXF_PWM3                       33
+#define MUXF_PWM4                       34
+#define MUXF_PWM5                       35
+#define MUXF_PWM6                       36
+#define MUXF_PWM7                       37
+#define MUXF_ICM0_D                     38
+#define MUXF_ICM1_D                     39
+#define MUXF_ICM2_D                     40
+#define MUXF_ICM3_D                     41
+#define MUXF_ICM0_CLK                   42
+#define MUXF_ICM1_CLK                   43
+#define MUXF_ICM2_CLK                   44
+#define MUXF_ICM3_CLK                   45
+#define MUXF_SPIM0_INT                  46
+#define MUXF_SPIM0_CLK                  47
+#define MUXF_SPIM0_EN                   48
+#define MUXF_SPIM0_DO                   49
+#define MUXF_SPIM0_DI                   50
+#define MUXF_SPIM1_INT                  51
+#define MUXF_SPIM1_CLK                  52
+#define MUXF_SPIM1_EN                   53
+#define MUXF_SPIM1_DO                   54
+#define MUXF_SPIM1_DI                   55
+#define MUXF_SPIM2_INT                  56
+#define MUXF_SPIM2_CLK                  57
+#define MUXF_SPIM2_EN                   58
+#define MUXF_SPIM2_DO                   59
+#define MUXF_SPIM2_DI                   60
+#define MUXF_SPIM3_INT                  61
+#define MUXF_SPIM3_CLK                  62
+#define MUXF_SPIM3_EN                   63
+#define MUXF_SPIM3_DO                   64
+#define MUXF_SPIM3_DI                   65
+#define MUXF_SPI0S_INT                  66
+#define MUXF_SPI0S_CLK                  67
+#define MUXF_SPI0S_EN                   68
+#define MUXF_SPI0S_DO                   69
+#define MUXF_SPI0S_DI                   70
+#define MUXF_SPI1S_INT                  71
+#define MUXF_SPI1S_CLK                  72
+#define MUXF_SPI1S_EN                   73
+#define MUXF_SPI1S_DO                   74
+#define MUXF_SPI1S_DI                   75
+#define MUXF_SPI2S_INT                  76
+#define MUXF_SPI2S_CLK                  77
+#define MUXF_SPI2S_EN                   78
+#define MUXF_SPI2S_DO                   79
+#define MUXF_SPI2S_DI                   80
+#define MUXF_SPI3S_INT                  81
+#define MUXF_SPI3S_CLK                  82
+#define MUXF_SPI3S_EN                   83
+#define MUXF_SPI3S_DO                   84
+#define MUXF_SPI3S_DI                   85
+#define MUXF_I2CM0_CLK                  86
+#define MUXF_I2CM0_DAT                  87
+#define MUXF_I2CM1_CLK                  88
+#define MUXF_I2CM1_DAT                  89
+#define MUXF_I2CM2_CLK                  90
+#define MUXF_I2CM2_DAT                  91
+#define MUXF_I2CM3_CLK                  92
+#define MUXF_I2CM3_DAT                  93
+#define MUXF_UA1_TX                     94
+#define MUXF_UA1_RX                     95
+#define MUXF_UA1_CTS                    96
+#define MUXF_UA1_RTS                    97
+#define MUXF_UA2_TX                     98
+#define MUXF_UA2_RX                     99
+#define MUXF_UA2_CTS                    100
+#define MUXF_UA2_RTS                    101
+#define MUXF_UA3_TX                     102
+#define MUXF_UA3_RX                     103
+#define MUXF_UA3_CTS                    104
+#define MUXF_UA3_RTS                    105
+#define MUXF_UA4_TX                     106
+#define MUXF_UA4_RX                     107
+#define MUXF_UA4_CTS                    108
+#define MUXF_UA4_RTS                    109
+#define MUXF_TIMER0_INT                 110
+#define MUXF_TIMER1_INT                 111
+#define MUXF_TIMER2_INT                 112
+#define MUXF_TIMER3_INT                 113
+#define MUXF_GPIO_INT0                  114
+#define MUXF_GPIO_INT1                  115
+#define MUXF_GPIO_INT2                  116
+#define MUXF_GPIO_INT3                  117
+#define MUXF_GPIO_INT4                  118
+#define MUXF_GPIO_INT5                  119
+#define MUXF_GPIO_INT6                  120
+#define MUXF_GPIO_INT7                  121
+
+/*
+ * Please don't change the order of the following defines.
+ * They are based on order of items in array 'sppctl_list_funcs'
+ * in Sunplus pinctrl driver.
+ */
+#define GROP_SPI_FLASH                  122
+#define GROP_SPI_FLASH_4BIT             123
+#define GROP_SPI_NAND                   124
+#define GROP_CARD0_EMMC                 125
+#define GROP_SD_CARD                    126
+#define GROP_UA0                        127
+#define GROP_ACHIP_DEBUG                128
+#define GROP_ACHIP_UA2AXI               129
+#define GROP_FPGA_IFX                   130
+#define GROP_HDMI_TX                    131
+#define GROP_AUD_EXT_ADC_IFX0           132
+#define GROP_AUD_EXT_DAC_IFX0           133
+#define GROP_SPDIF_RX                   134
+#define GROP_SPDIF_TX                   135
+#define GROP_TDMTX_IFX0                 136
+#define GROP_TDMRX_IFX0                 137
+#define GROP_PDMRX_IFX0                 138
+#define GROP_PCM_IEC_TX                 139
+#define GROP_LCDIF                      140
+#define GROP_DVD_DSP_DEBUG              141
+#define GROP_I2C_DEBUG                  142
+#define GROP_I2C_SLAVE                  143
+#define GROP_WAKEUP                     144
+#define GROP_UART2AXI                   145
+#define GROP_USB0_I2C                   146
+#define GROP_USB1_I2C                   147
+#define GROP_USB0_OTG                   148
+#define GROP_USB1_OTG                   149
+#define GROP_UPHY0_DEBUG                150
+#define GROP_UPHY1_DEBUG                151
+#define GROP_UPHY0_EXT                  152
+#define GROP_PROBE_PORT                 153
+
+#endif
diff --git a/include/dt-bindings/pinctrl/sppctl.h b/include/dt-bindings/pinctrl/sppctl.h
new file mode 100644 (file)
index 0000000..5055726
--- /dev/null
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Sunplus dt-bindings Pinctrl header file
+ * Copyright (C) Sunplus Tech / Tibbo Tech.
+ * Author: Dvorkin Dmitry <dvorkin@tibbo.com>
+ */
+
+#ifndef __DT_BINDINGS_PINCTRL_SPPCTL_H__
+#define __DT_BINDINGS_PINCTRL_SPPCTL_H__
+
+#define IOP_G_MASTE            (0x01 << 0)
+#define IOP_G_FIRST            (0x01 << 1)
+
+#define SPPCTL_PCTL_G_PMUX     (0x00        | IOP_G_MASTE)
+#define SPPCTL_PCTL_G_GPIO     (IOP_G_FIRST | IOP_G_MASTE)
+#define SPPCTL_PCTL_G_IOPP     (IOP_G_FIRST | 0x00)
+
+#define SPPCTL_PCTL_L_OUT      (0x01 << 0)     /* Output LOW        */
+#define SPPCTL_PCTL_L_OU1      (0x01 << 1)     /* Output HIGH       */
+#define SPPCTL_PCTL_L_INV      (0x01 << 2)     /* Input Invert      */
+#define SPPCTL_PCTL_L_ONV      (0x01 << 3)     /* Output Invert     */
+#define SPPCTL_PCTL_L_ODR      (0x01 << 4)     /* Output Open Drain */
+
+/*
+ * pack into 32-bit value:
+ * pin# (8bit), typ (8bit), function (8bit), flag (8bit)
+ */
+#define SPPCTL_IOPAD(pin, typ, fun, flg)       (((pin) << 24) | ((typ) << 16) | \
+                                               ((fun) << 8) | (flg))
+
+#endif