Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'pinctrl-v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl

Pull pin control updates from Linus Walleij:
"No core changes this time around.

New drivers:

- New driver for Renesas R8A779H0 also known as R-Car V4M.

- New driver for the Awinic AW9523/B I2C GPIO expander. I found this
living out-of-tree in OpenWrt as an upstream attempt had stalled on
the finishing line, so I picked it up and finished the job.

Improvements:

- The Nomadik pin control driver was for years re-used out of tree
for the ST STA chips, and now the IP was re-used in a MIPS
automotive SoC called MobilEyeq5, so it has been split in pin
control and GPIO drivers so the latter can be reused by MobilEyeq5.
(Along with a long list of cleanups)

- A lot of overall cleanup and tidying up"

* tag 'pinctrl-v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl: (87 commits)
drivers/gpio/nomadik: move dummy nmk_gpio_dbg_show_one() to header
gpio: nomadik: remove BUG_ON() in nmk_gpio_populate_chip()
dt-bindings: pinctrl: qcom: update compatible name for match with driver
pinctrl: aw9523: Make the driver tristate
pinctrl: nomadik: fix dereference of error pointer
gpio: nomadik: Back out some managed resources
pinctrl: aw9523: Add proper terminator
pinctrl: core: comment that pinctrl_add_gpio_range() is deprecated
pinctrl: pinmux: Suppress error message for -EPROBE_DEFER
pinctrl: Add driver for Awinic AW9523/B I2C GPIO Expander
dt-bindings: pinctrl: Add bindings for Awinic AW9523/AW9523B
gpio: nomadik: Finish conversion to use firmware node APIs
gpio: nomadik: fix Kconfig dependencies inbetween pinctrl & GPIO
pinctrl: da9062: Add OF table
dt-bindings: pinctrl: at91: add sam9x7
pinctrl: ocelot: remove redundant assignment to variable ret
gpio: nomadik: grab optional reset control and deassert it at probe
gpio: nomadik: support mobileye,eyeq5-gpio
gpio: nomadik: handle variadic GPIO count
gpio: nomadik: support shared GPIO IRQs
...

+7496 -1046
-31
Documentation/devicetree/bindings/gpio/gpio-nmk.txt
··· 1 - Nomadik GPIO controller 2 - 3 - Required properties: 4 - - compatible : Should be "st,nomadik-gpio". 5 - - reg : Physical base address and length of the controller's registers. 6 - - interrupts : The interrupt outputs from the controller. 7 - - #gpio-cells : Should be two: 8 - The first cell is the pin number. 9 - The second cell is used to specify optional parameters: 10 - - bits[3:0] trigger type and level flags: 11 - 1 = low-to-high edge triggered. 12 - 2 = high-to-low edge triggered. 13 - 4 = active high level-sensitive. 14 - 8 = active low level-sensitive. 15 - - gpio-controller : Marks the device node as a GPIO controller. 16 - - interrupt-controller : Marks the device node as an interrupt controller. 17 - - gpio-bank : Specifies which bank a controller owns. 18 - - st,supports-sleepmode : Specifies whether controller can sleep or not 19 - 20 - Example: 21 - 22 - gpio1: gpio@8012e080 { 23 - compatible = "st,nomadik-gpio"; 24 - reg = <0x8012e080 0x80>; 25 - interrupts = <0 120 0x4>; 26 - #gpio-cells = <2>; 27 - gpio-controller; 28 - interrupt-controller; 29 - st,supports-sleepmode; 30 - gpio-bank = <1>; 31 - };
+95
Documentation/devicetree/bindings/gpio/st,nomadik-gpio.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/gpio/st,nomadik-gpio.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Nomadik GPIO controller 8 + 9 + description: 10 + The Nomadik GPIO driver handles Nomadik SoC GPIO blocks. This block has also 11 + been called ST STA2X11. On the Nomadik platform, this driver is intertwined 12 + with pinctrl-nomadik. 13 + 14 + maintainers: 15 + - Linus Walleij <linus.walleij@linaro.org> 16 + 17 + properties: 18 + $nodename: 19 + pattern: "^gpio@[0-9a-f]+$" 20 + 21 + compatible: 22 + enum: 23 + - st,nomadik-gpio 24 + - mobileye,eyeq5-gpio 25 + 26 + reg: 27 + maxItems: 1 28 + 29 + interrupts: 30 + maxItems: 1 31 + 32 + "#gpio-cells": 33 + const: 2 34 + 35 + gpio-controller: true 36 + 37 + interrupt-controller: true 38 + 39 + "#interrupt-cells": 40 + const: 2 41 + 42 + gpio-bank: 43 + description: System-wide GPIO bank index. 44 + $ref: /schemas/types.yaml#/definitions/uint32 45 + 46 + st,supports-sleepmode: 47 + description: Whether the controller can sleep or not. 48 + $ref: /schemas/types.yaml#/definitions/flag 49 + 50 + clocks: 51 + maxItems: 1 52 + 53 + gpio-ranges: 54 + maxItems: 1 55 + 56 + ngpios: 57 + minimum: 0 58 + maximum: 32 59 + 60 + resets: 61 + maxItems: 1 62 + 63 + required: 64 + - compatible 65 + - reg 66 + - interrupts 67 + - "#gpio-cells" 68 + - gpio-controller 69 + - interrupt-controller 70 + - gpio-bank 71 + 72 + unevaluatedProperties: false 73 + 74 + allOf: 75 + - if: 76 + properties: 77 + compatible: 78 + contains: 79 + const: mobileye,eyeq5-gpio 80 + then: 81 + properties: 82 + st,supports-sleepmode: false 83 + 84 + examples: 85 + - | 86 + gpio@8012e080 { 87 + compatible = "st,nomadik-gpio"; 88 + reg = <0x8012e080 0x80>; 89 + interrupts = <0 120 0x4>; 90 + #gpio-cells = <2>; 91 + gpio-controller; 92 + interrupt-controller; 93 + st,supports-sleepmode; 94 + gpio-bank = <1>; 95 + };
+1 -1
Documentation/devicetree/bindings/pinctrl/amlogic,meson-pinctrl-a1.yaml
··· 24 24 - compatible 25 25 26 26 patternProperties: 27 - "^bank@[0-9a-z]+$": 27 + "^bank@[0-9a-f]+$": 28 28 $ref: amlogic,meson-pinctrl-common.yaml#/$defs/meson-gpio 29 29 30 30 unevaluatedProperties: false
+1 -1
Documentation/devicetree/bindings/pinctrl/amlogic,meson-pinctrl-g12a-aobus.yaml
··· 21 21 - compatible 22 22 23 23 patternProperties: 24 - "^bank@[0-9a-z]+$": 24 + "^bank@[0-9a-f]+$": 25 25 $ref: amlogic,meson-pinctrl-common.yaml#/$defs/meson-gpio 26 26 27 27 unevaluatedProperties: false
+1 -1
Documentation/devicetree/bindings/pinctrl/amlogic,meson-pinctrl-g12a-periphs.yaml
··· 21 21 - compatible 22 22 23 23 patternProperties: 24 - "^bank@[0-9a-z]+$": 24 + "^bank@[0-9a-f]+$": 25 25 $ref: amlogic,meson-pinctrl-common.yaml#/$defs/meson-gpio 26 26 27 27 unevaluatedProperties: false
+1 -1
Documentation/devicetree/bindings/pinctrl/amlogic,meson8-pinctrl-aobus.yaml
··· 29 29 - compatible 30 30 31 31 patternProperties: 32 - "^bank@[0-9a-z]+$": 32 + "^bank@[0-9a-f]+$": 33 33 $ref: amlogic,meson-pinctrl-common.yaml#/$defs/meson-gpio 34 34 35 35 unevaluatedProperties: false
+1 -1
Documentation/devicetree/bindings/pinctrl/amlogic,meson8-pinctrl-cbus.yaml
··· 29 29 - compatible 30 30 31 31 patternProperties: 32 - "^bank@[0-9a-z]+$": 32 + "^bank@[0-9a-f]+$": 33 33 $ref: amlogic,meson-pinctrl-common.yaml#/$defs/meson-gpio 34 34 35 35 unevaluatedProperties: false
+2
Documentation/devicetree/bindings/pinctrl/atmel,at91-pinctrl.txt
··· 20 20 Required properties for iomux controller: 21 21 - compatible: "atmel,at91rm9200-pinctrl" or "atmel,at91sam9x5-pinctrl" 22 22 or "atmel,sama5d3-pinctrl" or "microchip,sam9x60-pinctrl" 23 + or "microchip,sam9x7-pinctrl", "microchip,sam9x60-pinctrl" 23 24 - atmel,mux-mask: array of mask (periph per bank) to describe if a pin can be 24 25 configured in this periph mode. All the periph and bank need to be describe. 25 26 ··· 121 120 For each bank the required properties are: 122 121 - compatible: "atmel,at91sam9x5-gpio" or "atmel,at91rm9200-gpio" or 123 122 "microchip,sam9x60-gpio" 123 + or "microchip,sam9x7-gpio", "microchip,sam9x60-gpio", "atmel,at91rm9200-gpio" 124 124 - reg: physical base address and length of the controller's registers 125 125 - interrupts: interrupt outputs from the controller 126 126 - interrupt-controller: marks the device node as an interrupt controller
+139
Documentation/devicetree/bindings/pinctrl/awinic,aw9523-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/awinic,aw9523-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Awinic AW9523/AW9523B I2C GPIO Expander 8 + 9 + maintainers: 10 + - AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org> 11 + 12 + description: | 13 + The Awinic AW9523/AW9523B I2C GPIO Expander featuring 16 multi-function 14 + I/O, 256 steps PWM mode and interrupt support. 15 + 16 + properties: 17 + compatible: 18 + const: awinic,aw9523-pinctrl 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + '#gpio-cells': 24 + description: | 25 + Specifying the pin number and flags, as defined in 26 + include/dt-bindings/gpio/gpio.h 27 + const: 2 28 + 29 + gpio-controller: true 30 + 31 + gpio-ranges: 32 + maxItems: 1 33 + 34 + interrupt-controller: true 35 + 36 + interrupts: 37 + maxItems: 1 38 + description: Specifies the INTN pin IRQ. 39 + 40 + '#interrupt-cells': 41 + description: 42 + Specifies the PIN numbers and Flags, as defined in defined in 43 + include/dt-bindings/interrupt-controller/irq.h 44 + const: 2 45 + 46 + reset-gpios: 47 + maxItems: 1 48 + 49 + # PIN CONFIGURATION NODES 50 + patternProperties: 51 + '-pins$': 52 + type: object 53 + description: 54 + Pinctrl node's client devices use subnodes for desired pin configuration. 55 + Client device subnodes use below standard properties. 56 + $ref: /schemas/pinctrl/pincfg-node.yaml 57 + 58 + properties: 59 + pins: 60 + description: 61 + List of gpio pins affected by the properties specified in 62 + this subnode. 63 + items: 64 + pattern: "^gpio([0-9]|1[0-5])$" 65 + minItems: 1 66 + maxItems: 16 67 + 68 + function: 69 + description: 70 + Specify the alternative function to be configured for the 71 + specified pins. 72 + 73 + enum: [ gpio, pwm ] 74 + 75 + bias-disable: true 76 + bias-pull-down: true 77 + bias-pull-up: true 78 + drive-open-drain: true 79 + drive-push-pull: true 80 + input-enable: true 81 + input-disable: true 82 + output-high: true 83 + output-low: true 84 + 85 + required: 86 + - pins 87 + - function 88 + 89 + additionalProperties: false 90 + 91 + required: 92 + - compatible 93 + - reg 94 + - gpio-controller 95 + - '#gpio-cells' 96 + - gpio-ranges 97 + 98 + additionalProperties: false 99 + 100 + examples: 101 + # Example configuration to drive pins for a keyboard matrix 102 + - | 103 + #include <dt-bindings/gpio/gpio.h> 104 + #include <dt-bindings/interrupt-controller/irq.h> 105 + 106 + i2c { 107 + #address-cells = <1>; 108 + #size-cells = <0>; 109 + 110 + aw9523: gpio-expander@58 { 111 + compatible = "awinic,aw9523-pinctrl"; 112 + reg = <0x58>; 113 + interrupt-parent = <&tlmm>; 114 + interrupts = <50 IRQ_TYPE_EDGE_FALLING>; 115 + gpio-controller; 116 + #gpio-cells = <2>; 117 + gpio-ranges = <&tlmm 0 0 16>; 118 + interrupt-controller; 119 + #interrupt-cells = <2>; 120 + reset-gpios = <&tlmm 51 GPIO_ACTIVE_HIGH>; 121 + 122 + keyboard-matrix-col-pins { 123 + pins = "gpio8", "gpio9", "gpio10", "gpio11", 124 + "gpio12", "gpio13", "gpio14", "gpio15"; 125 + function = "gpio"; 126 + input-disable; 127 + output-low; 128 + }; 129 + 130 + keyboard-matrix-row-pins { 131 + pins = "gpio0", "gpio1", "gpio2", "gpio3", 132 + "gpio4", "gpio5", "gpio6", "gpio7"; 133 + function = "gpio"; 134 + bias-pull-up; 135 + drive-open-drain; 136 + input-enable; 137 + }; 138 + }; 139 + };
+2 -1
Documentation/devicetree/bindings/pinctrl/cirrus,madera.yaml
··· 93 93 94 94 input-schmitt-disable: true 95 95 96 - input-debounce: true 96 + input-debounce: 97 + maxItems: 1 97 98 98 99 output-low: true 99 100
+22 -2
Documentation/devicetree/bindings/pinctrl/cypress,cy8c95x0.yaml
··· 45 45 maxItems: 1 46 46 47 47 gpio-reserved-ranges: 48 - maxItems: 1 48 + minItems: 1 49 + maxItems: 60 49 50 50 51 vdd-supply: 51 52 description: ··· 85 84 bias-pull-up: true 86 85 87 86 bias-disable: true 87 + 88 + input-enable: true 88 89 89 90 output-high: true 90 91 ··· 136 133 interrupts = <GIC_SPI 94 IRQ_TYPE_LEVEL_HIGH>; 137 134 interrupt-controller; 138 135 vdd-supply = <&p3v3>; 139 - gpio-reserved-ranges = <5 1>; 136 + gpio-reserved-ranges = <1 2>, <6 1>, <10 1>, <15 1>; 137 + 138 + pinctrl-0 = <&U62160_pins>, <&U62160_ipins>; 139 + pinctrl-names = "default"; 140 + 141 + U62160_pins: cfg-pins { 142 + pins = "gp03", "gp16", "gp20", "gp50", "gp51"; 143 + function = "gpio"; 144 + input-enable; 145 + bias-pull-up; 146 + }; 147 + 148 + U62160_ipins: icfg-pins { 149 + pins = "gp04", "gp17", "gp21", "gp52", "gp53"; 150 + function = "gpio"; 151 + input-enable; 152 + bias-pull-up; 153 + }; 140 154 }; 141 155 };
+242
Documentation/devicetree/bindings/pinctrl/mobileye,eyeq5-pinctrl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/pinctrl/mobileye,eyeq5-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Mobileye EyeQ5 pin controller 8 + 9 + description: > 10 + The EyeQ5 pin controller handles the two pin banks of the system. It belongs 11 + to a system-controller block called OLB. 12 + 13 + Pin control is about bias (pull-down, pull-up), drive strength and muxing. Pin 14 + muxing supports two functions for each pin: first is GPIO, second is 15 + pin-dependent. 16 + 17 + Pins and groups are bijective. 18 + 19 + maintainers: 20 + - Grégory Clement <gregory.clement@bootlin.com> 21 + - Théo Lebrun <theo.lebrun@bootlin.com> 22 + - Vladimir Kondratiev <vladimir.kondratiev@mobileye.com> 23 + 24 + $ref: pinctrl.yaml# 25 + 26 + properties: 27 + compatible: 28 + enum: 29 + - mobileye,eyeq5-pinctrl 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "-pins?$": 36 + type: object 37 + description: Pin muxing configuration. 38 + $ref: pinmux-node.yaml# 39 + additionalProperties: false 40 + properties: 41 + pins: true 42 + function: 43 + enum: [gpio, 44 + # Bank A 45 + timer0, timer1, timer2, timer5, uart0, uart1, can0, can1, spi0, 46 + spi1, refclk0, 47 + # Bank B 48 + timer3, timer4, timer6, uart2, can2, spi2, spi3, mclk0] 49 + bias-disable: true 50 + bias-pull-down: true 51 + bias-pull-up: true 52 + drive-strength: true 53 + required: 54 + - pins 55 + - function 56 + allOf: 57 + - if: 58 + properties: 59 + function: 60 + const: gpio 61 + then: 62 + properties: 63 + pins: 64 + items: # PA0 - PA28, PB0 - PB22 65 + pattern: '^(P(A|B)1?[0-9]|PA2[0-8]|PB2[0-2])$' 66 + - if: 67 + properties: 68 + function: 69 + const: timer0 70 + then: 71 + properties: 72 + pins: 73 + items: 74 + enum: [PA0, PA1] 75 + - if: 76 + properties: 77 + function: 78 + const: timer1 79 + then: 80 + properties: 81 + pins: 82 + items: 83 + enum: [PA2, PA3] 84 + - if: 85 + properties: 86 + function: 87 + const: timer2 88 + then: 89 + properties: 90 + pins: 91 + items: 92 + enum: [PA4, PA5] 93 + - if: 94 + properties: 95 + function: 96 + const: timer5 97 + then: 98 + properties: 99 + pins: 100 + items: 101 + enum: [PA6, PA7, PA8, PA9] 102 + - if: 103 + properties: 104 + function: 105 + const: uart0 106 + then: 107 + properties: 108 + pins: 109 + items: 110 + enum: [PA10, PA11] 111 + - if: 112 + properties: 113 + function: 114 + const: uart1 115 + then: 116 + properties: 117 + pins: 118 + items: 119 + enum: [PA12, PA13] 120 + - if: 121 + properties: 122 + function: 123 + const: can0 124 + then: 125 + properties: 126 + pins: 127 + items: 128 + enum: [PA14, PA15] 129 + - if: 130 + properties: 131 + function: 132 + const: can1 133 + then: 134 + properties: 135 + pins: 136 + items: 137 + enum: [PA16, PA17] 138 + - if: 139 + properties: 140 + function: 141 + const: spi0 142 + then: 143 + properties: 144 + pins: 145 + items: 146 + enum: [PA18, PA19, PA20, PA21, PA22] 147 + - if: 148 + properties: 149 + function: 150 + const: spi1 151 + then: 152 + properties: 153 + pins: 154 + items: 155 + enum: [PA23, PA24, PA25, PA26, PA27] 156 + - if: 157 + properties: 158 + function: 159 + const: refclk0 160 + then: 161 + properties: 162 + pins: 163 + items: 164 + enum: [PA28] 165 + - if: 166 + properties: 167 + function: 168 + const: timer3 169 + then: 170 + properties: 171 + pins: 172 + items: 173 + enum: [PB0, PB1] 174 + - if: 175 + properties: 176 + function: 177 + const: timer4 178 + then: 179 + properties: 180 + pins: 181 + items: 182 + enum: [PB2, PB3] 183 + - if: 184 + properties: 185 + function: 186 + const: timer6 187 + then: 188 + properties: 189 + pins: 190 + items: 191 + enum: [PB4, PB5, PB6, PB7] 192 + - if: 193 + properties: 194 + function: 195 + const: uart2 196 + then: 197 + properties: 198 + pins: 199 + items: 200 + enum: [PB8, PB9] 201 + - if: 202 + properties: 203 + function: 204 + const: can2 205 + then: 206 + properties: 207 + pins: 208 + items: 209 + enum: [PB10, PB11] 210 + - if: 211 + properties: 212 + function: 213 + const: spi2 214 + then: 215 + properties: 216 + pins: 217 + items: 218 + enum: [PB12, PB13, PB14, PB15, PB16] 219 + - if: 220 + properties: 221 + function: 222 + const: spi3 223 + then: 224 + properties: 225 + pins: 226 + items: 227 + enum: [PB17, PB18, PB19, PB20, PB21] 228 + - if: 229 + properties: 230 + function: 231 + const: mclk0 232 + then: 233 + properties: 234 + pins: 235 + items: 236 + enum: [PB22] 237 + 238 + required: 239 + - compatible 240 + - reg 241 + 242 + additionalProperties: false
-2
Documentation/devicetree/bindings/pinctrl/nuvoton,npcm845-pinctrl.yaml
··· 152 152 description: 153 153 Debouncing periods in microseconds, one period per interrupt 154 154 bank found in the controller 155 - $ref: /schemas/types.yaml#/definitions/uint32-array 156 155 minItems: 1 157 156 maxItems: 4 158 157 ··· 159 160 description: | 160 161 0: Low rate 161 162 1: High rate 162 - $ref: /schemas/types.yaml#/definitions/uint32 163 163 enum: [0, 1] 164 164 165 165 drive-strength:
+2 -1
Documentation/devicetree/bindings/pinctrl/nuvoton,wpcm450-pinctrl.yaml
··· 103 103 items: 104 104 pattern: "^gpio1?[0-9]{1,2}$" 105 105 106 - input-debounce: true 106 + input-debounce: 107 + maxItems: 1 107 108 108 109 additionalProperties: false 109 110
+5 -2
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-aon.yaml
··· 10 10 - Thierry Reding <thierry.reding@gmail.com> 11 11 - Jon Hunter <jonathanh@nvidia.com> 12 12 13 - $ref: nvidia,tegra234-pinmux-common.yaml 14 - 15 13 properties: 16 14 compatible: 17 15 const: nvidia,tegra234-pinmux-aon 16 + 17 + reg: 18 + maxItems: 1 18 19 19 20 patternProperties: 20 21 "^pinmux(-[a-z0-9-]+)?$": ··· 23 22 24 23 # pin groups 25 24 additionalProperties: 25 + $ref: nvidia,tegra234-pinmux-common.yaml 26 + 26 27 properties: 27 28 nvidia,pins: 28 29 items:
+34 -48
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux-common.yaml
··· 10 10 - Thierry Reding <thierry.reding@gmail.com> 11 11 - Jon Hunter <jonathanh@nvidia.com> 12 12 13 + $ref: nvidia,tegra-pinmux-common.yaml 14 + 13 15 properties: 14 - reg: 15 - items: 16 - - description: pinmux registers 16 + nvidia,function: 17 + enum: [ gp, uartc, i2c8, spi2, i2c2, can1, can0, rsvd0, eth0, eth2, 18 + eth1, dp, eth3, i2c4, i2c7, i2c9, eqos, pe2, pe1, pe0, pe3, 19 + pe4, pe5, pe6, pe7, pe8, pe9, pe10, qspi0, qspi1, qpsi, 20 + sdmmc1, sce, soc, gpio, hdmi, ufs0, spi3, spi1, uartb, uarte, 21 + usb, extperiph2, extperiph1, i2c3, vi0, i2c5, uarta, uartd, 22 + i2c1, i2s4, i2s6, aud, spi5, touch, uartj, rsvd1, wdt, tsc, 23 + dmic3, led, vi0_alt, i2s5, nv, extperiph3, extperiph4, spi4, 24 + ccla, i2s1, i2s2, i2s3, i2s8, rsvd2, dmic5, dca, displayb, 25 + displaya, vi1, dcb, dmic1, dmic4, i2s7, dmic2, dspk0, rsvd3, 26 + tsc_alt, istctrl, vi1_alt, dspk1, igpu ] 17 27 18 - patternProperties: 19 - "^pinmux(-[a-z0-9-]+)?$": 20 - type: object 21 - 22 - # pin groups 23 - additionalProperties: 24 - $ref: nvidia,tegra-pinmux-common.yaml 25 - # We would typically use unevaluatedProperties here but that has the 26 - # downside that all the properties in the common bindings become valid 27 - # for all chip generations. In this case, however, we want the per-SoC 28 - # bindings to be able to override which of the common properties are 29 - # allowed, since not all pinmux generations support the same sets of 30 - # properties. This way, the common bindings define the format of the 31 - # properties but the per-SoC bindings define which of them apply to a 32 - # given chip. 33 - additionalProperties: false 34 - properties: 35 - nvidia,function: 36 - enum: [ gp, uartc, i2c8, spi2, i2c2, can1, can0, rsvd0, eth0, eth2, 37 - eth1, dp, eth3, i2c4, i2c7, i2c9, eqos, pe2, pe1, pe0, pe3, 38 - pe4, pe5, pe6, pe7, pe8, pe9, pe10, qspi0, qspi1, qpsi, 39 - sdmmc1, sce, soc, gpio, hdmi, ufs0, spi3, spi1, uartb, uarte, 40 - usb, extperiph2, extperiph1, i2c3, vi0, i2c5, uarta, uartd, 41 - i2c1, i2s4, i2s6, aud, spi5, touch, uartj, rsvd1, wdt, tsc, 42 - dmic3, led, vi0_alt, i2s5, nv, extperiph3, extperiph4, spi4, 43 - ccla, i2s1, i2s2, i2s3, i2s8, rsvd2, dmic5, dca, displayb, 44 - displaya, vi1, dcb, dmic1, dmic4, i2s7, dmic2, dspk0, rsvd3, 45 - tsc_alt, istctrl, vi1_alt, dspk1, igpu ] 46 - 47 - # out of the common properties, only these are allowed for Tegra234 48 - nvidia,pins: true 49 - nvidia,pull: true 50 - nvidia,tristate: true 51 - nvidia,schmitt: true 52 - nvidia,enable-input: true 53 - nvidia,open-drain: true 54 - nvidia,lock: true 55 - nvidia,drive-type: true 56 - nvidia,io-hv: true 57 - 58 - required: 59 - - nvidia,pins 28 + # out of the common properties, only these are allowed for Tegra234 29 + nvidia,pins: true 30 + nvidia,pull: true 31 + nvidia,tristate: true 32 + nvidia,schmitt: true 33 + nvidia,enable-input: true 34 + nvidia,open-drain: true 35 + nvidia,lock: true 36 + nvidia,drive-type: true 37 + nvidia,io-hv: true 60 38 61 39 required: 62 - - compatible 63 - - reg 40 + - nvidia,pins 64 41 65 - additionalProperties: true 42 + # We would typically use unevaluatedProperties here but that has the 43 + # downside that all the properties in the common bindings become valid 44 + # for all chip generations. In this case, however, we want the per-SoC 45 + # bindings to be able to override which of the common properties are 46 + # allowed, since not all pinmux generations support the same sets of 47 + # properties. This way, the common bindings define the format of the 48 + # properties but the per-SoC bindings define which of them apply to a 49 + # given chip. 50 + additionalProperties: false 51 + 66 52 ...
+5 -2
Documentation/devicetree/bindings/pinctrl/nvidia,tegra234-pinmux.yaml
··· 10 10 - Thierry Reding <thierry.reding@gmail.com> 11 11 - Jon Hunter <jonathanh@nvidia.com> 12 12 13 - $ref: nvidia,tegra234-pinmux-common.yaml 14 - 15 13 properties: 16 14 compatible: 17 15 const: nvidia,tegra234-pinmux 16 + 17 + reg: 18 + maxItems: 1 18 19 19 20 patternProperties: 20 21 "^pinmux(-[a-z0-9-]+)?$": ··· 23 22 24 23 # pin groups 25 24 additionalProperties: 25 + $ref: nvidia,tegra234-pinmux-common.yaml 26 + 26 27 properties: 27 28 nvidia,pins: 28 29 items:
+1 -1
Documentation/devicetree/bindings/pinctrl/pincfg-node.yaml
··· 97 97 description: disable schmitt-trigger mode 98 98 99 99 input-debounce: 100 - $ref: /schemas/types.yaml#/definitions/uint32 100 + $ref: /schemas/types.yaml#/definitions/uint32-array 101 101 description: Takes the debounce time in usec as argument or 0 to disable 102 102 debouncing 103 103
+1 -1
Documentation/devicetree/bindings/pinctrl/qcom,sm4450-tlmm.yaml
··· 17 17 18 18 properties: 19 19 compatible: 20 - const: qcom,sm4450-pinctrl 20 + const: qcom,sm4450-tlmm 21 21 22 22 reg: 23 23 maxItems: 1
+1
Documentation/devicetree/bindings/pinctrl/renesas,pfc.yaml
··· 46 46 - renesas,pfc-r8a779a0 # R-Car V3U 47 47 - renesas,pfc-r8a779f0 # R-Car S4-8 48 48 - renesas,pfc-r8a779g0 # R-Car V4H 49 + - renesas,pfc-r8a779h0 # R-Car V4M 49 50 - renesas,pfc-sh73a0 # SH-Mobile AG5 50 51 51 52 reg:
+3 -3
Documentation/devicetree/bindings/pinctrl/xlnx,zynq-pinctrl.yaml Documentation/devicetree/bindings/pinctrl/xlnx,pinctrl-zynq.yaml
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 2 %YAML 1.2 3 3 --- 4 - $id: http://devicetree.org/schemas/pinctrl/xlnx,zynq-pinctrl.yaml# 4 + $id: http://devicetree.org/schemas/pinctrl/xlnx,pinctrl-zynq.yaml# 5 5 $schema: http://devicetree.org/meta-schemas/core.yaml# 6 6 7 7 title: Xilinx Zynq Pinctrl ··· 28 28 29 29 properties: 30 30 compatible: 31 - const: xlnx,zynq-pinctrl 31 + const: xlnx,pinctrl-zynq 32 32 33 33 reg: 34 34 description: Specifies the base address and size of the SLCR space. ··· 181 181 - | 182 182 #include <dt-bindings/pinctrl/pinctrl-zynq.h> 183 183 pinctrl0: pinctrl@700 { 184 - compatible = "xlnx,zynq-pinctrl"; 184 + compatible = "xlnx,pinctrl-zynq"; 185 185 reg = <0x700 0x200>; 186 186 syscon = <&slcr>; 187 187
+2
MAINTAINERS
··· 2471 2471 F: Documentation/devicetree/bindings/arm/ste-* 2472 2472 F: Documentation/devicetree/bindings/arm/ux500.yaml 2473 2473 F: Documentation/devicetree/bindings/arm/ux500/ 2474 + F: Documentation/devicetree/bindings/gpio/st,nomadik-gpio.yaml 2474 2475 F: Documentation/devicetree/bindings/i2c/st,nomadik-i2c.yaml 2475 2476 F: arch/arm/boot/dts/st/ste-* 2476 2477 F: arch/arm/mach-nomadik/ ··· 2480 2479 F: drivers/clocksource/clksrc-dbx500-prcmu.c 2481 2480 F: drivers/dma/ste_dma40* 2482 2481 F: drivers/pmdomain/st/ste-ux500-pm-domain.c 2482 + F: drivers/gpio/gpio-nomadik.c 2483 2483 F: drivers/hwspinlock/u8500_hsem.c 2484 2484 F: drivers/i2c/busses/i2c-nomadik.c 2485 2485 F: drivers/iio/adc/ab8500-gpadc.c
+4
arch/riscv/boot/dts/renesas/r9a07g043f.dtsi
··· 46 46 }; 47 47 }; 48 48 49 + &pinctrl { 50 + gpio-ranges = <&pinctrl 0 0 232>; 51 + }; 52 + 49 53 &soc { 50 54 dma-noncoherent; 51 55 interrupt-parent = <&plic>;
+12
drivers/gpio/Kconfig
··· 478 478 select GPIO_GENERIC 479 479 select GENERIC_IRQ_CHIP 480 480 481 + config GPIO_NOMADIK 482 + bool "Nomadik GPIO driver" 483 + depends on ARCH_U8500 || ARCH_NOMADIK || MACH_EYEQ5 || COMPILE_TEST 484 + select GPIOLIB_IRQCHIP 485 + help 486 + Say yes here to support the Nomadik SoC GPIO block. This block is also 487 + used by the Mobileye EyeQ5 SoC. 488 + 489 + It handles up to 32 GPIOs per bank, that can all be interrupt sources. 490 + It is deeply interconnected with the associated pinctrl driver as GPIO 491 + registers handle muxing ("alternate functions") as well. 492 + 481 493 config GPIO_NPCM_SGPIO 482 494 bool "Nuvoton SGPIO support" 483 495 depends on ARCH_NPCM || COMPILE_TEST
+1
drivers/gpio/Makefile
··· 117 117 obj-$(CONFIG_GPIO_MVEBU) += gpio-mvebu.o 118 118 obj-$(CONFIG_GPIO_MXC) += gpio-mxc.o 119 119 obj-$(CONFIG_GPIO_MXS) += gpio-mxs.o 120 + obj-$(CONFIG_GPIO_NOMADIK) += gpio-nomadik.o 120 121 obj-$(CONFIG_GPIO_NPCM_SGPIO) += gpio-npcm-sgpio.o 121 122 obj-$(CONFIG_GPIO_OCTEON) += gpio-octeon.o 122 123 obj-$(CONFIG_GPIO_OMAP) += gpio-omap.o
+730
drivers/gpio/gpio-nomadik.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * GPIO driver for the IP block found in the Nomadik SoC; it is an AMBA device, 4 + * managing 32 pins with alternate functions. It can also handle the STA2X11 5 + * block from ST. 6 + * 7 + * The GPIO chips are shared with pinctrl-nomadik if used; it needs access for 8 + * pinmuxing functionality and others. 9 + * 10 + * This driver also handles the mobileye,eyeq5-gpio compatible. It is an STA2X11 11 + * but with only data, direction and interrupts register active. We want to 12 + * avoid touching SLPM, RWIMSC, FWIMSC, AFSLA and AFSLB registers; that is, 13 + * wake and alternate function registers. It is NOT compatible with 14 + * pinctrl-nomadik. 15 + * 16 + * Copyright (C) 2008,2009 STMicroelectronics 17 + * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> 18 + * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> 19 + * Copyright (C) 2011-2013 Linus Walleij <linus.walleij@linaro.org> 20 + */ 21 + #include <linux/cleanup.h> 22 + #include <linux/clk.h> 23 + #include <linux/gpio/driver.h> 24 + #include <linux/interrupt.h> 25 + #include <linux/kernel.h> 26 + #include <linux/mod_devicetable.h> 27 + #include <linux/pinctrl/pinctrl.h> 28 + #include <linux/platform_device.h> 29 + #include <linux/property.h> 30 + #include <linux/reset.h> 31 + #include <linux/seq_file.h> 32 + #include <linux/slab.h> 33 + #include <linux/types.h> 34 + 35 + #include <linux/gpio/gpio-nomadik.h> 36 + 37 + #ifndef CONFIG_PINCTRL_NOMADIK 38 + static DEFINE_SPINLOCK(nmk_gpio_slpm_lock); 39 + #endif 40 + 41 + void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip, unsigned int offset, 42 + enum nmk_gpio_slpm mode) 43 + { 44 + u32 slpm; 45 + 46 + /* We should NOT have been called. */ 47 + if (WARN_ON(nmk_chip->is_mobileye_soc)) 48 + return; 49 + 50 + slpm = readl(nmk_chip->addr + NMK_GPIO_SLPC); 51 + if (mode == NMK_GPIO_SLPM_NOCHANGE) 52 + slpm |= BIT(offset); 53 + else 54 + slpm &= ~BIT(offset); 55 + writel(slpm, nmk_chip->addr + NMK_GPIO_SLPC); 56 + } 57 + 58 + static void __nmk_gpio_set_output(struct nmk_gpio_chip *nmk_chip, 59 + unsigned int offset, int val) 60 + { 61 + if (val) 62 + writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DATS); 63 + else 64 + writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DATC); 65 + } 66 + 67 + void __nmk_gpio_make_output(struct nmk_gpio_chip *nmk_chip, 68 + unsigned int offset, int val) 69 + { 70 + writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRS); 71 + __nmk_gpio_set_output(nmk_chip, offset, val); 72 + } 73 + 74 + /* IRQ functions */ 75 + 76 + static void nmk_gpio_irq_ack(struct irq_data *d) 77 + { 78 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 79 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 80 + 81 + clk_enable(nmk_chip->clk); 82 + writel(BIT(d->hwirq), nmk_chip->addr + NMK_GPIO_IC); 83 + clk_disable(nmk_chip->clk); 84 + } 85 + 86 + enum nmk_gpio_irq_type { 87 + NORMAL, 88 + WAKE, 89 + }; 90 + 91 + static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, 92 + int offset, enum nmk_gpio_irq_type which, 93 + bool enable) 94 + { 95 + u32 *rimscval; 96 + u32 *fimscval; 97 + u32 rimscreg; 98 + u32 fimscreg; 99 + 100 + if (which == NORMAL) { 101 + rimscreg = NMK_GPIO_RIMSC; 102 + fimscreg = NMK_GPIO_FIMSC; 103 + rimscval = &nmk_chip->rimsc; 104 + fimscval = &nmk_chip->fimsc; 105 + } else { 106 + /* We should NOT have been called. */ 107 + if (WARN_ON(nmk_chip->is_mobileye_soc)) 108 + return; 109 + rimscreg = NMK_GPIO_RWIMSC; 110 + fimscreg = NMK_GPIO_FWIMSC; 111 + rimscval = &nmk_chip->rwimsc; 112 + fimscval = &nmk_chip->fwimsc; 113 + } 114 + 115 + /* we must individually set/clear the two edges */ 116 + if (nmk_chip->edge_rising & BIT(offset)) { 117 + if (enable) 118 + *rimscval |= BIT(offset); 119 + else 120 + *rimscval &= ~BIT(offset); 121 + writel(*rimscval, nmk_chip->addr + rimscreg); 122 + } 123 + if (nmk_chip->edge_falling & BIT(offset)) { 124 + if (enable) 125 + *fimscval |= BIT(offset); 126 + else 127 + *fimscval &= ~BIT(offset); 128 + writel(*fimscval, nmk_chip->addr + fimscreg); 129 + } 130 + } 131 + 132 + static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, 133 + int offset, bool on) 134 + { 135 + /* We should NOT have been called. */ 136 + if (WARN_ON(nmk_chip->is_mobileye_soc)) 137 + return; 138 + 139 + /* 140 + * Ensure WAKEUP_ENABLE is on. No need to disable it if wakeup is 141 + * disabled, since setting SLPM to 1 increases power consumption, and 142 + * wakeup is anyhow controlled by the RIMSC and FIMSC registers. 143 + */ 144 + if (nmk_chip->sleepmode && on) { 145 + __nmk_gpio_set_slpm(nmk_chip, offset, 146 + NMK_GPIO_SLPM_WAKEUP_ENABLE); 147 + } 148 + 149 + __nmk_gpio_irq_modify(nmk_chip, offset, WAKE, on); 150 + } 151 + 152 + static void nmk_gpio_irq_maskunmask(struct nmk_gpio_chip *nmk_chip, 153 + struct irq_data *d, bool enable) 154 + { 155 + unsigned long flags; 156 + 157 + clk_enable(nmk_chip->clk); 158 + spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 159 + spin_lock(&nmk_chip->lock); 160 + 161 + __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, enable); 162 + 163 + if (!nmk_chip->is_mobileye_soc && !(nmk_chip->real_wake & BIT(d->hwirq))) 164 + __nmk_gpio_set_wake(nmk_chip, d->hwirq, enable); 165 + 166 + spin_unlock(&nmk_chip->lock); 167 + spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); 168 + clk_disable(nmk_chip->clk); 169 + } 170 + 171 + static void nmk_gpio_irq_mask(struct irq_data *d) 172 + { 173 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 174 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 175 + 176 + nmk_gpio_irq_maskunmask(nmk_chip, d, false); 177 + gpiochip_disable_irq(gc, irqd_to_hwirq(d)); 178 + } 179 + 180 + static void nmk_gpio_irq_unmask(struct irq_data *d) 181 + { 182 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 183 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 184 + 185 + gpiochip_enable_irq(gc, irqd_to_hwirq(d)); 186 + nmk_gpio_irq_maskunmask(nmk_chip, d, true); 187 + } 188 + 189 + static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 190 + { 191 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 192 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 193 + unsigned long flags; 194 + 195 + /* Handler is registered in all cases. */ 196 + if (nmk_chip->is_mobileye_soc) 197 + return -ENXIO; 198 + 199 + clk_enable(nmk_chip->clk); 200 + spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 201 + spin_lock(&nmk_chip->lock); 202 + 203 + if (irqd_irq_disabled(d)) 204 + __nmk_gpio_set_wake(nmk_chip, d->hwirq, on); 205 + 206 + if (on) 207 + nmk_chip->real_wake |= BIT(d->hwirq); 208 + else 209 + nmk_chip->real_wake &= ~BIT(d->hwirq); 210 + 211 + spin_unlock(&nmk_chip->lock); 212 + spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); 213 + clk_disable(nmk_chip->clk); 214 + 215 + return 0; 216 + } 217 + 218 + static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) 219 + { 220 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 221 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 222 + bool enabled = !irqd_irq_disabled(d); 223 + bool wake = irqd_is_wakeup_set(d); 224 + unsigned long flags; 225 + 226 + if (type & IRQ_TYPE_LEVEL_HIGH) 227 + return -EINVAL; 228 + if (type & IRQ_TYPE_LEVEL_LOW) 229 + return -EINVAL; 230 + 231 + clk_enable(nmk_chip->clk); 232 + spin_lock_irqsave(&nmk_chip->lock, flags); 233 + 234 + if (enabled) 235 + __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, false); 236 + 237 + if (!nmk_chip->is_mobileye_soc && (enabled || wake)) 238 + __nmk_gpio_irq_modify(nmk_chip, d->hwirq, WAKE, false); 239 + 240 + nmk_chip->edge_rising &= ~BIT(d->hwirq); 241 + if (type & IRQ_TYPE_EDGE_RISING) 242 + nmk_chip->edge_rising |= BIT(d->hwirq); 243 + 244 + nmk_chip->edge_falling &= ~BIT(d->hwirq); 245 + if (type & IRQ_TYPE_EDGE_FALLING) 246 + nmk_chip->edge_falling |= BIT(d->hwirq); 247 + 248 + if (enabled) 249 + __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, true); 250 + 251 + if (!nmk_chip->is_mobileye_soc && (enabled || wake)) 252 + __nmk_gpio_irq_modify(nmk_chip, d->hwirq, WAKE, true); 253 + 254 + spin_unlock_irqrestore(&nmk_chip->lock, flags); 255 + clk_disable(nmk_chip->clk); 256 + 257 + return 0; 258 + } 259 + 260 + static unsigned int nmk_gpio_irq_startup(struct irq_data *d) 261 + { 262 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 263 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 264 + 265 + clk_enable(nmk_chip->clk); 266 + nmk_gpio_irq_unmask(d); 267 + return 0; 268 + } 269 + 270 + static void nmk_gpio_irq_shutdown(struct irq_data *d) 271 + { 272 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 273 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 274 + 275 + nmk_gpio_irq_mask(d); 276 + clk_disable(nmk_chip->clk); 277 + } 278 + 279 + static irqreturn_t nmk_gpio_irq_handler(int irq, void *dev_id) 280 + { 281 + struct nmk_gpio_chip *nmk_chip = dev_id; 282 + struct gpio_chip *chip = &nmk_chip->chip; 283 + unsigned long mask = GENMASK(chip->ngpio - 1, 0); 284 + unsigned long status; 285 + int bit; 286 + 287 + clk_enable(nmk_chip->clk); 288 + 289 + status = readl(nmk_chip->addr + NMK_GPIO_IS); 290 + 291 + /* Ensure we cannot leave pending bits; this should never occur. */ 292 + if (unlikely(status & ~mask)) 293 + writel(status & ~mask, nmk_chip->addr + NMK_GPIO_IC); 294 + 295 + clk_disable(nmk_chip->clk); 296 + 297 + for_each_set_bit(bit, &status, chip->ngpio) 298 + generic_handle_domain_irq_safe(chip->irq.domain, bit); 299 + 300 + return IRQ_RETVAL((status & mask) != 0); 301 + } 302 + 303 + /* I/O Functions */ 304 + 305 + static int nmk_gpio_get_dir(struct gpio_chip *chip, unsigned int offset) 306 + { 307 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 308 + int dir; 309 + 310 + clk_enable(nmk_chip->clk); 311 + 312 + dir = readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset); 313 + 314 + clk_disable(nmk_chip->clk); 315 + 316 + if (dir) 317 + return GPIO_LINE_DIRECTION_OUT; 318 + 319 + return GPIO_LINE_DIRECTION_IN; 320 + } 321 + 322 + static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned int offset) 323 + { 324 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 325 + 326 + clk_enable(nmk_chip->clk); 327 + 328 + writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRC); 329 + 330 + clk_disable(nmk_chip->clk); 331 + 332 + return 0; 333 + } 334 + 335 + static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned int offset) 336 + { 337 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 338 + int value; 339 + 340 + clk_enable(nmk_chip->clk); 341 + 342 + value = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset)); 343 + 344 + clk_disable(nmk_chip->clk); 345 + 346 + return value; 347 + } 348 + 349 + static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned int offset, 350 + int val) 351 + { 352 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 353 + 354 + clk_enable(nmk_chip->clk); 355 + 356 + __nmk_gpio_set_output(nmk_chip, offset, val); 357 + 358 + clk_disable(nmk_chip->clk); 359 + } 360 + 361 + static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned int offset, 362 + int val) 363 + { 364 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 365 + 366 + clk_enable(nmk_chip->clk); 367 + 368 + __nmk_gpio_make_output(nmk_chip, offset, val); 369 + 370 + clk_disable(nmk_chip->clk); 371 + 372 + return 0; 373 + } 374 + 375 + #ifdef CONFIG_DEBUG_FS 376 + 377 + static int nmk_gpio_get_mode(struct nmk_gpio_chip *nmk_chip, int offset) 378 + { 379 + u32 afunc, bfunc; 380 + 381 + /* We don't support modes. */ 382 + if (nmk_chip->is_mobileye_soc) 383 + return NMK_GPIO_ALT_GPIO; 384 + 385 + clk_enable(nmk_chip->clk); 386 + 387 + afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & BIT(offset); 388 + bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & BIT(offset); 389 + 390 + clk_disable(nmk_chip->clk); 391 + 392 + return (afunc ? NMK_GPIO_ALT_A : 0) | (bfunc ? NMK_GPIO_ALT_B : 0); 393 + } 394 + 395 + void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev, 396 + struct gpio_chip *chip, unsigned int offset, 397 + unsigned int gpio) 398 + { 399 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 400 + int mode; 401 + bool is_out; 402 + bool data_out; 403 + bool pull; 404 + static const char * const modes[] = { 405 + [NMK_GPIO_ALT_GPIO] = "gpio", 406 + [NMK_GPIO_ALT_A] = "altA", 407 + [NMK_GPIO_ALT_B] = "altB", 408 + [NMK_GPIO_ALT_C] = "altC", 409 + [NMK_GPIO_ALT_C + 1] = "altC1", 410 + [NMK_GPIO_ALT_C + 2] = "altC2", 411 + [NMK_GPIO_ALT_C + 3] = "altC3", 412 + [NMK_GPIO_ALT_C + 4] = "altC4", 413 + }; 414 + 415 + char *label = gpiochip_dup_line_label(chip, offset); 416 + if (IS_ERR(label)) 417 + return; 418 + 419 + clk_enable(nmk_chip->clk); 420 + is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset)); 421 + pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & BIT(offset)); 422 + data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset)); 423 + mode = nmk_gpio_get_mode(nmk_chip, offset); 424 + #ifdef CONFIG_PINCTRL_NOMADIK 425 + if (mode == NMK_GPIO_ALT_C && pctldev) 426 + mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); 427 + #endif 428 + 429 + if (is_out) { 430 + seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s", 431 + gpio, 432 + label ?: "(none)", 433 + data_out ? "hi" : "lo", 434 + (mode < 0) ? "unknown" : modes[mode]); 435 + } else { 436 + int irq = chip->to_irq(chip, offset); 437 + const int pullidx = pull ? 1 : 0; 438 + int val; 439 + static const char * const pulls[] = { 440 + "none ", 441 + "pull enabled", 442 + }; 443 + 444 + seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", 445 + gpio, 446 + label ?: "(none)", 447 + pulls[pullidx], 448 + (mode < 0) ? "unknown" : modes[mode]); 449 + 450 + val = nmk_gpio_get_input(chip, offset); 451 + seq_printf(s, " VAL %d", val); 452 + 453 + /* 454 + * This races with request_irq(), set_irq_type(), 455 + * and set_irq_wake() ... but those are "rare". 456 + */ 457 + if (irq > 0 && irq_has_action(irq)) { 458 + char *trigger; 459 + bool wake; 460 + 461 + if (nmk_chip->edge_rising & BIT(offset)) 462 + trigger = "edge-rising"; 463 + else if (nmk_chip->edge_falling & BIT(offset)) 464 + trigger = "edge-falling"; 465 + else 466 + trigger = "edge-undefined"; 467 + 468 + wake = !!(nmk_chip->real_wake & BIT(offset)); 469 + 470 + seq_printf(s, " irq-%d %s%s", 471 + irq, trigger, wake ? " wakeup" : ""); 472 + } 473 + } 474 + clk_disable(nmk_chip->clk); 475 + } 476 + 477 + static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) 478 + { 479 + unsigned int i, gpio = chip->base; 480 + 481 + for (i = 0; i < chip->ngpio; i++, gpio++) { 482 + nmk_gpio_dbg_show_one(s, NULL, chip, i, gpio); 483 + seq_puts(s, "\n"); 484 + } 485 + } 486 + 487 + #else 488 + 489 + #define nmk_gpio_dbg_show NULL 490 + 491 + #endif 492 + 493 + /* 494 + * We will allocate memory for the state container using devm* allocators 495 + * binding to the first device reaching this point, it doesn't matter if 496 + * it is the pin controller or GPIO driver. However we need to use the right 497 + * platform device when looking up resources so pay attention to pdev. 498 + */ 499 + struct nmk_gpio_chip *nmk_gpio_populate_chip(struct fwnode_handle *fwnode, 500 + struct platform_device *pdev) 501 + { 502 + struct nmk_gpio_chip *nmk_chip; 503 + struct platform_device *gpio_pdev; 504 + struct device *dev = &pdev->dev; 505 + struct reset_control *reset; 506 + struct device *gpio_dev; 507 + struct gpio_chip *chip; 508 + struct resource *res; 509 + struct clk *clk; 510 + void __iomem *base; 511 + u32 id, ngpio; 512 + int ret; 513 + 514 + gpio_dev = bus_find_device_by_fwnode(&platform_bus_type, fwnode); 515 + if (!gpio_dev) { 516 + dev_err(dev, "populate \"%pfwP\": device not found\n", fwnode); 517 + return ERR_PTR(-ENODEV); 518 + } 519 + gpio_pdev = to_platform_device(gpio_dev); 520 + 521 + if (device_property_read_u32(gpio_dev, "gpio-bank", &id)) { 522 + dev_err(dev, "populate: gpio-bank property not found\n"); 523 + platform_device_put(gpio_pdev); 524 + return ERR_PTR(-EINVAL); 525 + } 526 + 527 + #ifdef CONFIG_PINCTRL_NOMADIK 528 + if (id >= ARRAY_SIZE(nmk_gpio_chips)) { 529 + dev_err(dev, "populate: invalid id: %u\n", id); 530 + platform_device_put(gpio_pdev); 531 + return ERR_PTR(-EINVAL); 532 + } 533 + /* Already populated? */ 534 + nmk_chip = nmk_gpio_chips[id]; 535 + if (nmk_chip) { 536 + platform_device_put(gpio_pdev); 537 + return nmk_chip; 538 + } 539 + #endif 540 + 541 + nmk_chip = devm_kzalloc(dev, sizeof(*nmk_chip), GFP_KERNEL); 542 + if (!nmk_chip) { 543 + platform_device_put(gpio_pdev); 544 + return ERR_PTR(-ENOMEM); 545 + } 546 + 547 + if (device_property_read_u32(gpio_dev, "ngpios", &ngpio)) { 548 + ngpio = NMK_GPIO_PER_CHIP; 549 + dev_dbg(dev, "populate: using default ngpio (%u)\n", ngpio); 550 + } 551 + 552 + nmk_chip->is_mobileye_soc = device_is_compatible(gpio_dev, 553 + "mobileye,eyeq5-gpio"); 554 + nmk_chip->bank = id; 555 + chip = &nmk_chip->chip; 556 + chip->base = -1; 557 + chip->ngpio = ngpio; 558 + chip->label = dev_name(gpio_dev); 559 + chip->parent = gpio_dev; 560 + 561 + /* NOTE: different devices! No devm_platform_ioremap_resource() here! */ 562 + res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0); 563 + base = devm_ioremap_resource(dev, res); 564 + if (IS_ERR(base)) { 565 + platform_device_put(gpio_pdev); 566 + return ERR_CAST(base); 567 + } 568 + nmk_chip->addr = base; 569 + 570 + /* NOTE: do not use devm_ here! */ 571 + clk = clk_get_optional(gpio_dev, NULL); 572 + if (IS_ERR(clk)) { 573 + platform_device_put(gpio_pdev); 574 + return ERR_CAST(clk); 575 + } 576 + clk_prepare(clk); 577 + nmk_chip->clk = clk; 578 + 579 + /* NOTE: do not use devm_ here! */ 580 + reset = reset_control_get_optional_shared(gpio_dev, NULL); 581 + if (IS_ERR(reset)) { 582 + clk_unprepare(clk); 583 + clk_put(clk); 584 + platform_device_put(gpio_pdev); 585 + dev_err(dev, "failed getting reset control: %pe\n", 586 + reset); 587 + return ERR_CAST(reset); 588 + } 589 + 590 + /* 591 + * Reset might be shared and asserts/deasserts calls are unbalanced. We 592 + * only support sharing this reset with other gpio-nomadik devices that 593 + * use this reset to ensure deassertion at probe. 594 + */ 595 + ret = reset_control_deassert(reset); 596 + if (ret) { 597 + reset_control_put(reset); 598 + clk_unprepare(clk); 599 + clk_put(clk); 600 + platform_device_put(gpio_pdev); 601 + dev_err(dev, "failed reset deassert: %d\n", ret); 602 + return ERR_PTR(ret); 603 + } 604 + 605 + #ifdef CONFIG_PINCTRL_NOMADIK 606 + nmk_gpio_chips[id] = nmk_chip; 607 + #endif 608 + return nmk_chip; 609 + } 610 + 611 + static void nmk_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p) 612 + { 613 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 614 + struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 615 + 616 + seq_printf(p, "nmk%u-%u-%u", nmk_chip->bank, 617 + gc->base, gc->base + gc->ngpio - 1); 618 + } 619 + 620 + static const struct irq_chip nmk_irq_chip = { 621 + .irq_ack = nmk_gpio_irq_ack, 622 + .irq_mask = nmk_gpio_irq_mask, 623 + .irq_unmask = nmk_gpio_irq_unmask, 624 + .irq_set_type = nmk_gpio_irq_set_type, 625 + .irq_set_wake = nmk_gpio_irq_set_wake, 626 + .irq_startup = nmk_gpio_irq_startup, 627 + .irq_shutdown = nmk_gpio_irq_shutdown, 628 + .irq_print_chip = nmk_gpio_irq_print_chip, 629 + .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, 630 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 631 + }; 632 + 633 + static int nmk_gpio_probe(struct platform_device *pdev) 634 + { 635 + struct device *dev = &pdev->dev; 636 + struct nmk_gpio_chip *nmk_chip; 637 + struct gpio_irq_chip *girq; 638 + bool supports_sleepmode; 639 + struct gpio_chip *chip; 640 + int irq; 641 + int ret; 642 + 643 + nmk_chip = nmk_gpio_populate_chip(dev_fwnode(dev), pdev); 644 + if (IS_ERR(nmk_chip)) { 645 + dev_err(dev, "could not populate nmk chip struct\n"); 646 + return PTR_ERR(nmk_chip); 647 + } 648 + 649 + supports_sleepmode = 650 + device_property_read_bool(dev, "st,supports-sleepmode"); 651 + 652 + /* Correct platform device ID */ 653 + pdev->id = nmk_chip->bank; 654 + 655 + irq = platform_get_irq(pdev, 0); 656 + if (irq < 0) 657 + return irq; 658 + 659 + /* 660 + * The virt address in nmk_chip->addr is in the nomadik register space, 661 + * so we can simply convert the resource address, without remapping 662 + */ 663 + nmk_chip->sleepmode = supports_sleepmode; 664 + spin_lock_init(&nmk_chip->lock); 665 + 666 + chip = &nmk_chip->chip; 667 + chip->parent = dev; 668 + chip->request = gpiochip_generic_request; 669 + chip->free = gpiochip_generic_free; 670 + chip->get_direction = nmk_gpio_get_dir; 671 + chip->direction_input = nmk_gpio_make_input; 672 + chip->get = nmk_gpio_get_input; 673 + chip->direction_output = nmk_gpio_make_output; 674 + chip->set = nmk_gpio_set_output; 675 + chip->dbg_show = nmk_gpio_dbg_show; 676 + chip->can_sleep = false; 677 + chip->owner = THIS_MODULE; 678 + 679 + girq = &chip->irq; 680 + gpio_irq_chip_set_chip(girq, &nmk_irq_chip); 681 + girq->parent_handler = NULL; 682 + girq->num_parents = 0; 683 + girq->parents = NULL; 684 + girq->default_type = IRQ_TYPE_NONE; 685 + girq->handler = handle_edge_irq; 686 + 687 + ret = devm_request_irq(dev, irq, nmk_gpio_irq_handler, IRQF_SHARED, 688 + dev_name(dev), nmk_chip); 689 + if (ret) { 690 + dev_err(dev, "failed requesting IRQ\n"); 691 + return ret; 692 + } 693 + 694 + if (!nmk_chip->is_mobileye_soc) { 695 + clk_enable(nmk_chip->clk); 696 + nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI); 697 + clk_disable(nmk_chip->clk); 698 + } 699 + 700 + ret = gpiochip_add_data(chip, nmk_chip); 701 + if (ret) 702 + return ret; 703 + 704 + platform_set_drvdata(pdev, nmk_chip); 705 + 706 + dev_info(dev, "chip registered\n"); 707 + 708 + return 0; 709 + } 710 + 711 + static const struct of_device_id nmk_gpio_match[] = { 712 + { .compatible = "st,nomadik-gpio", }, 713 + { .compatible = "mobileye,eyeq5-gpio", }, 714 + {} 715 + }; 716 + 717 + static struct platform_driver nmk_gpio_driver = { 718 + .driver = { 719 + .name = "nomadik-gpio", 720 + .of_match_table = nmk_gpio_match, 721 + .suppress_bind_attrs = true, 722 + }, 723 + .probe = nmk_gpio_probe, 724 + }; 725 + 726 + static int __init nmk_gpio_init(void) 727 + { 728 + return platform_driver_register(&nmk_gpio_driver); 729 + } 730 + subsys_initcall(nmk_gpio_init);
+18
drivers/pinctrl/Kconfig
··· 127 127 selected. 128 128 Say Y to enable pinctrl and GPIO support for the AXP209 PMIC. 129 129 130 + config PINCTRL_AW9523 131 + tristate "Awinic AW9523/AW9523B I2C GPIO expander pinctrl driver" 132 + depends on OF && I2C 133 + select PINMUX 134 + select PINCONF 135 + select GENERIC_PINCONF 136 + select GPIOLIB 137 + select GPIOLIB_IRQCHIP 138 + select REGMAP 139 + select REGMAP_I2C 140 + help 141 + The Awinic AW9523/AW9523B is a multi-function I2C GPIO 142 + expander with PWM functionality. This driver bundles a 143 + pinctrl driver to select the function muxing and a GPIO 144 + driver to handle GPIO, when the GPIO function is selected. 145 + 146 + Say yes to enable pinctrl and GPIO support for the AW9523(B). 147 + 130 148 config PINCTRL_BM1880 131 149 bool "Bitmain BM1880 Pinctrl driver" 132 150 depends on OF && (ARCH_BITMAIN || COMPILE_TEST)
+1
drivers/pinctrl/Makefile
··· 15 15 obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o 16 16 obj-$(CONFIG_PINCTRL_AT91) += pinctrl-at91.o 17 17 obj-$(CONFIG_PINCTRL_AT91PIO4) += pinctrl-at91-pio4.o 18 + obj-$(CONFIG_PINCTRL_AW9523) += pinctrl-aw9523.o 18 19 obj-$(CONFIG_PINCTRL_AXP209) += pinctrl-axp209.o 19 20 obj-$(CONFIG_PINCTRL_BM1880) += pinctrl-bm1880.o 20 21 obj-$(CONFIG_PINCTRL_CY8C95X0) += pinctrl-cy8c95x0.o
+9 -9
drivers/pinctrl/cirrus/pinctrl-cs42l43.c
··· 5 5 // Copyright (c) 2023 Cirrus Logic, Inc. and 6 6 // Cirrus Logic International Semiconductor Ltd. 7 7 8 + #include <linux/array_size.h> 8 9 #include <linux/bits.h> 9 10 #include <linux/build_bug.h> 10 11 #include <linux/err.h> 11 - #include <linux/errno.h> 12 12 #include <linux/gpio/driver.h> 13 13 #include <linux/mfd/cs42l43.h> 14 14 #include <linux/mfd/cs42l43-regs.h> ··· 17 17 #include <linux/platform_device.h> 18 18 #include <linux/pm_runtime.h> 19 19 #include <linux/regmap.h> 20 - #include <linux/string_helpers.h> 20 + #include <linux/string_choices.h> 21 21 22 22 #include <linux/pinctrl/consumer.h> 23 23 #include <linux/pinctrl/pinctrl.h> ··· 276 276 277 277 static const unsigned int cs42l43_pin_drv_str_ma[] = { 1, 2, 4, 8, 9, 10, 12, 16 }; 278 278 279 - static inline int cs42l43_pin_get_drv_str(struct cs42l43_pin *priv, unsigned int pin) 279 + static int cs42l43_pin_get_drv_str(struct cs42l43_pin *priv, unsigned int pin) 280 280 { 281 281 const struct cs42l43_pin_data *pdat = cs42l43_pin_pins[pin].drv_data; 282 282 unsigned int val; ··· 289 289 return cs42l43_pin_drv_str_ma[(val & pdat->mask) >> pdat->shift]; 290 290 } 291 291 292 - static inline int cs42l43_pin_set_drv_str(struct cs42l43_pin *priv, unsigned int pin, 293 - unsigned int ma) 292 + static int cs42l43_pin_set_drv_str(struct cs42l43_pin *priv, unsigned int pin, 293 + unsigned int ma) 294 294 { 295 295 const struct cs42l43_pin_data *pdat = cs42l43_pin_pins[pin].drv_data; 296 296 int i; ··· 314 314 return -EINVAL; 315 315 } 316 316 317 - static inline int cs42l43_pin_get_db(struct cs42l43_pin *priv, unsigned int pin) 317 + static int cs42l43_pin_get_db(struct cs42l43_pin *priv, unsigned int pin) 318 318 { 319 319 unsigned int val; 320 320 int ret; ··· 332 332 return 85; // Debounce is roughly 85uS 333 333 } 334 334 335 - static inline int cs42l43_pin_set_db(struct cs42l43_pin *priv, unsigned int pin, 336 - unsigned int us) 335 + static int cs42l43_pin_set_db(struct cs42l43_pin *priv, unsigned int pin, 336 + unsigned int us) 337 337 { 338 338 if (pin >= CS42L43_NUM_GPIOS) 339 339 return -ENOTSUPP; ··· 490 490 int ret; 491 491 492 492 dev_dbg(priv->dev, "Setting gpio%d to %s\n", 493 - offset + 1, value ? "high" : "low"); 493 + offset + 1, str_high_low(value)); 494 494 495 495 ret = pm_runtime_resume_and_get(priv->dev); 496 496 if (ret) {
+4
drivers/pinctrl/core.c
··· 412 412 * @pctldev: pin controller device to add the range to 413 413 * @range: the GPIO range to add 414 414 * 415 + * DEPRECATED: Don't use this function in new code. See section 2 of 416 + * Documentation/devicetree/bindings/gpio/gpio.txt on how to bind pinctrl and 417 + * gpio drivers. 418 + * 415 419 * This adds a range of GPIOs to be handled by a certain pin controller. Call 416 420 * this to register handled ranges after registering your pin controller. 417 421 */
+22 -2
drivers/pinctrl/mediatek/pinctrl-mt7981.c
··· 700 700 static int mt7981_drv_vbus_funcs[] = { 1, }; 701 701 702 702 /* EMMC */ 703 + static int mt7981_emmc_reset_pins[] = { 15, }; 704 + static int mt7981_emmc_reset_funcs[] = { 2, }; 705 + 706 + static int mt7981_emmc_4_pins[] = { 16, 17, 18, 19, 24, 25, }; 707 + static int mt7981_emmc_4_funcs[] = { 2, 2, 2, 2, 2, 2, }; 708 + 709 + static int mt7981_emmc_8_pins[] = { 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, }; 710 + static int mt7981_emmc_8_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; 711 + 703 712 static int mt7981_emmc_45_pins[] = { 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, }; 704 713 static int mt7981_emmc_45_funcs[] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, }; 705 714 ··· 745 736 746 737 static int mt7981_uart1_2_pins[] = { 9, 10, }; 747 738 static int mt7981_uart1_2_funcs[] = { 2, 2, }; 739 + 740 + static int mt7981_uart1_3_pins[] = { 26, 27, }; 741 + static int mt7981_uart1_3_funcs[] = { 2, 2, }; 748 742 749 743 /* UART2 */ 750 744 static int mt7981_uart2_1_pins[] = { 22, 23, 24, 25, }; ··· 863 851 PINCTRL_PIN_GROUP("udi", mt7981_udi), 864 852 /* @GPIO(14) DRV_VBUS(1) */ 865 853 PINCTRL_PIN_GROUP("drv_vbus", mt7981_drv_vbus), 854 + /* @GPIO(15): EMMC_RSTB(2) */ 855 + PINCTRL_PIN_GROUP("emmc_reset", mt7981_emmc_reset), 856 + /* @GPIO(16,17,18,19,24,25): EMMC_DATx, EMMC_CLK, EMMC_CMD */ 857 + PINCTRL_PIN_GROUP("emmc_4", mt7981_emmc_4), 858 + /* @GPIO(16,17,18,19,20,21,22,23,24,25): EMMC_DATx, EMMC_CLK, EMMC_CMD */ 859 + PINCTRL_PIN_GROUP("emmc_8", mt7981_emmc_8), 866 860 /* @GPIO(15,25): EMMC(2) */ 867 861 PINCTRL_PIN_GROUP("emmc_45", mt7981_emmc_45), 868 862 /* @GPIO(16,21): SNFI(3) */ ··· 889 871 PINCTRL_PIN_GROUP("uart1_1", mt7981_uart1_1), 890 872 /* @GPIO(9,10): UART1(2) */ 891 873 PINCTRL_PIN_GROUP("uart1_2", mt7981_uart1_2), 874 + /* @GPIO(26,27): UART1(2) */ 875 + PINCTRL_PIN_GROUP("uart1_3", mt7981_uart1_3), 892 876 /* @GPIO(22,25): UART1(3) */ 893 877 PINCTRL_PIN_GROUP("uart2_1", mt7981_uart2_1), 894 878 /* @GPIO(22,24) PTA_EXT(4) */ ··· 953 933 static const char *mt7981_wa_aice_groups[] = { "wa_aice1", "wa_aice2", "wm_aice1_1", 954 934 "wa_aice3", "wm_aice1_2", }; 955 935 static const char *mt7981_uart_groups[] = { "net_wo0_uart_txd_0", "net_wo0_uart_txd_1", 956 - "net_wo0_uart_txd_2", "uart0", "uart1_0", "uart1_1", "uart1_2", "uart2_0", 936 + "net_wo0_uart_txd_2", "uart0", "uart1_0", "uart1_1", "uart1_2", "uart1_3", "uart2_0", 957 937 "uart2_0_tx_rx", "uart2_1", "wm_uart_0", "wm_aurt_1", "wm_aurt_2", }; 958 938 static const char *mt7981_dfd_groups[] = { "dfd", "dfd_ntrst", }; 959 939 static const char *mt7981_wdt_groups[] = { "watchdog", "watchdog1", }; ··· 972 952 static const char *mt7981_pcm_groups[] = { "pcm", }; 973 953 static const char *mt7981_udi_groups[] = { "udi", }; 974 954 static const char *mt7981_usb_groups[] = { "drv_vbus", }; 975 - static const char *mt7981_flash_groups[] = { "emmc_45", "snfi", }; 955 + static const char *mt7981_flash_groups[] = { "emmc_reset", "emmc_4", "emmc_8", "emmc_45", "snfi", }; 976 956 static const char *mt7981_ethernet_groups[] = { "smi_mdc_mdio", "gbe_ext_mdc_mdio", 977 957 "wf0_mode1", "wf0_mode3", "mt7531_int", }; 978 958 static const char *mt7981_ant_groups[] = { "ant_sel", };
+1 -1
drivers/pinctrl/mediatek/pinctrl-mt7986.c
··· 16 16 PIN_FIELD_CALC(_s_pin, _e_pin, _i_base, _s_addr, _x_addrs, _s_bit, \ 17 17 _x_bits, 32, 0) 18 18 19 - /** 19 + /* 20 20 * enum - Locking variants of the iocfg bases 21 21 * 22 22 * MT7986 have multiple bases to program pin configuration listed as the below:
-1
drivers/pinctrl/mediatek/pinctrl-mt8186.c
··· 1198 1198 [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8186_pin_dir_range), 1199 1199 [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8186_pin_di_range), 1200 1200 [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8186_pin_do_range), 1201 - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8186_pin_dir_range), 1202 1201 [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8186_pin_smt_range), 1203 1202 [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8186_pin_ies_range), 1204 1203 [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8186_pin_pu_range),
-1
drivers/pinctrl/mediatek/pinctrl-mt8192.c
··· 1379 1379 [PINCTRL_PIN_REG_DIR] = MTK_RANGE(mt8192_pin_dir_range), 1380 1380 [PINCTRL_PIN_REG_DI] = MTK_RANGE(mt8192_pin_di_range), 1381 1381 [PINCTRL_PIN_REG_DO] = MTK_RANGE(mt8192_pin_do_range), 1382 - [PINCTRL_PIN_REG_SR] = MTK_RANGE(mt8192_pin_dir_range), 1383 1382 [PINCTRL_PIN_REG_SMT] = MTK_RANGE(mt8192_pin_smt_range), 1384 1383 [PINCTRL_PIN_REG_IES] = MTK_RANGE(mt8192_pin_ies_range), 1385 1384 [PINCTRL_PIN_REG_PU] = MTK_RANGE(mt8192_pin_pu_range),
+4 -4
drivers/pinctrl/nomadik/Kconfig
··· 18 18 19 19 endif 20 20 21 - if (ARCH_U8500 || ARCH_NOMADIK) 21 + if (ARCH_U8500 || ARCH_NOMADIK || COMPILE_TEST) 22 22 23 23 config PINCTRL_NOMADIK 24 24 bool "Nomadik pin controller driver" 25 - depends on OF && GPIOLIB 25 + depends on OF 26 26 select PINMUX 27 27 select PINCONF 28 - select OF_GPIO 29 - select GPIOLIB_IRQCHIP 28 + select GPIOLIB 29 + select GPIO_NOMADIK 30 30 31 31 config PINCTRL_STN8815 32 32 bool "STN8815 pin controller driver"
+2 -1
drivers/pinctrl/nomadik/pinctrl-nomadik-db8500.c
··· 3 3 #include <linux/types.h> 4 4 5 5 #include <linux/pinctrl/pinctrl.h> 6 + #include <linux/gpio/driver.h> 6 7 7 - #include "pinctrl-nomadik.h" 8 + #include <linux/gpio/gpio-nomadik.h> 8 9 9 10 /* All the pins that can be used for GPIO and some other functions */ 10 11 #define _GPIO(offset) (offset)
+2 -1
drivers/pinctrl/nomadik/pinctrl-nomadik-stn8815.c
··· 3 3 #include <linux/types.h> 4 4 5 5 #include <linux/pinctrl/pinctrl.h> 6 + #include <linux/gpio/driver.h> 6 7 7 - #include "pinctrl-nomadik.h" 8 + #include <linux/gpio/gpio-nomadik.h> 8 9 9 10 /* All the pins that can be used for GPIO and some other functions */ 10 11 #define _GPIO(offset) (offset)
+141 -814
drivers/pinctrl/nomadik/pinctrl-nomadik.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0-only 2 2 /* 3 - * Generic GPIO driver for logic cells found in the Nomadik SoC 3 + * Pinmux & pinconf driver for the IP block found in the Nomadik SoC. This 4 + * depends on gpio-nomadik and some handling is intertwined; see nmk_gpio_chips 5 + * which is used by this driver to access the GPIO banks array. 4 6 * 5 7 * Copyright (C) 2008,2009 STMicroelectronics 6 8 * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> 7 9 * Rewritten based on work by Prafulla WADASKAR <prafulla.wadaskar@st.com> 8 10 * Copyright (C) 2011-2013 Linus Walleij <linus.walleij@linaro.org> 9 11 */ 12 + 10 13 #include <linux/bitops.h> 11 14 #include <linux/cleanup.h> 12 15 #include <linux/clk.h> ··· 28 25 #include <linux/seq_file.h> 29 26 #include <linux/slab.h> 30 27 #include <linux/spinlock.h> 28 + #include <linux/types.h> 31 29 32 30 /* Since we request GPIOs from ourself */ 33 31 #include <linux/pinctrl/consumer.h> ··· 40 36 #include "../core.h" 41 37 #include "../pinctrl-utils.h" 42 38 43 - #include "pinctrl-nomadik.h" 44 - 45 - /* 46 - * The GPIO module in the Nomadik family of Systems-on-Chip is an 47 - * AMBA device, managing 32 pins and alternate functions. The logic block 48 - * is currently used in the Nomadik and ux500. 49 - * 50 - * Symbols in this file are called "nmk_gpio" for "nomadik gpio" 51 - */ 39 + #include <linux/gpio/gpio-nomadik.h> 52 40 53 41 /* 54 42 * pin configurations are represented by 32-bit integers: ··· 71 75 * 72 76 * PIN_CFG - default config with alternate function 73 77 */ 74 - 75 - typedef unsigned long pin_cfg_t; 76 78 77 79 #define PIN_NUM_MASK 0x1ff 78 80 #define PIN_NUM(x) ((x) & PIN_NUM_MASK) ··· 166 172 #define PIN_SLEEPMODE_DISABLED (0 << PIN_SLEEPMODE_SHIFT) 167 173 #define PIN_SLEEPMODE_ENABLED (1 << PIN_SLEEPMODE_SHIFT) 168 174 169 - 170 175 /* Shortcuts. Use these instead of separate DIR, PULL, and VAL. */ 171 176 #define PIN_INPUT_PULLDOWN (PIN_DIR_INPUT | PIN_PULL_DOWN) 172 177 #define PIN_INPUT_PULLUP (PIN_DIR_INPUT | PIN_PULL_UP) ··· 193 200 (PIN_CFG_DEFAULT |\ 194 201 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val)) 195 202 196 - /* 197 - * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving 198 - * the "gpio" namespace for generic and cross-machine functions 199 - */ 200 - 201 - #define GPIO_BLOCK_SHIFT 5 202 - #define NMK_GPIO_PER_CHIP (1 << GPIO_BLOCK_SHIFT) 203 - #define NMK_MAX_BANKS DIV_ROUND_UP(512, NMK_GPIO_PER_CHIP) 204 - 205 - /* Register in the logic block */ 206 - #define NMK_GPIO_DAT 0x00 207 - #define NMK_GPIO_DATS 0x04 208 - #define NMK_GPIO_DATC 0x08 209 - #define NMK_GPIO_PDIS 0x0c 210 - #define NMK_GPIO_DIR 0x10 211 - #define NMK_GPIO_DIRS 0x14 212 - #define NMK_GPIO_DIRC 0x18 213 - #define NMK_GPIO_SLPC 0x1c 214 - #define NMK_GPIO_AFSLA 0x20 215 - #define NMK_GPIO_AFSLB 0x24 216 - #define NMK_GPIO_LOWEMI 0x28 217 - 218 - #define NMK_GPIO_RIMSC 0x40 219 - #define NMK_GPIO_FIMSC 0x44 220 - #define NMK_GPIO_IS 0x48 221 - #define NMK_GPIO_IC 0x4c 222 - #define NMK_GPIO_RWIMSC 0x50 223 - #define NMK_GPIO_FWIMSC 0x54 224 - #define NMK_GPIO_WKS 0x58 225 - /* These appear in DB8540 and later ASICs */ 226 - #define NMK_GPIO_EDGELEVEL 0x5C 227 - #define NMK_GPIO_LEVEL 0x60 228 - 229 - 230 - /* Pull up/down values */ 231 - enum nmk_gpio_pull { 232 - NMK_GPIO_PULL_NONE, 233 - NMK_GPIO_PULL_UP, 234 - NMK_GPIO_PULL_DOWN, 235 - }; 236 - 237 - /* Sleep mode */ 238 - enum nmk_gpio_slpm { 239 - NMK_GPIO_SLPM_INPUT, 240 - NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT, 241 - NMK_GPIO_SLPM_NOCHANGE, 242 - NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, 243 - }; 244 - 245 - struct nmk_gpio_chip { 246 - struct gpio_chip chip; 247 - void __iomem *addr; 248 - struct clk *clk; 249 - unsigned int bank; 250 - void (*set_ioforce)(bool enable); 251 - spinlock_t lock; 252 - bool sleepmode; 253 - /* Keep track of configured edges */ 254 - u32 edge_rising; 255 - u32 edge_falling; 256 - u32 real_wake; 257 - u32 rwimsc; 258 - u32 fwimsc; 259 - u32 rimsc; 260 - u32 fimsc; 261 - u32 pull_up; 262 - u32 lowemi; 263 - }; 264 - 265 203 /** 266 204 * struct nmk_pinctrl - state container for the Nomadik pin controller 267 205 * @dev: containing device pointer ··· 207 283 void __iomem *prcm_base; 208 284 }; 209 285 210 - static struct nmk_gpio_chip *nmk_gpio_chips[NMK_MAX_BANKS]; 286 + /* See nmk_gpio_populate_chip() that fills this array. */ 287 + struct nmk_gpio_chip *nmk_gpio_chips[NMK_MAX_BANKS]; 211 288 212 - static DEFINE_SPINLOCK(nmk_gpio_slpm_lock); 213 - 214 - #define NUM_BANKS ARRAY_SIZE(nmk_gpio_chips) 289 + DEFINE_SPINLOCK(nmk_gpio_slpm_lock); 215 290 216 291 static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip, 217 - unsigned offset, int gpio_mode) 292 + unsigned int offset, int gpio_mode) 218 293 { 219 294 u32 afunc, bfunc; 220 295 ··· 227 304 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB); 228 305 } 229 306 230 - static void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip, 231 - unsigned offset, enum nmk_gpio_slpm mode) 232 - { 233 - u32 slpm; 234 - 235 - slpm = readl(nmk_chip->addr + NMK_GPIO_SLPC); 236 - if (mode == NMK_GPIO_SLPM_NOCHANGE) 237 - slpm |= BIT(offset); 238 - else 239 - slpm &= ~BIT(offset); 240 - writel(slpm, nmk_chip->addr + NMK_GPIO_SLPC); 241 - } 242 - 243 307 static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip, 244 - unsigned offset, enum nmk_gpio_pull pull) 308 + unsigned int offset, enum nmk_gpio_pull pull) 245 309 { 246 310 u32 pdis; 247 311 ··· 252 342 } 253 343 254 344 static void __nmk_gpio_set_lowemi(struct nmk_gpio_chip *nmk_chip, 255 - unsigned offset, bool lowemi) 345 + unsigned int offset, bool lowemi) 256 346 { 257 347 bool enabled = nmk_chip->lowemi & BIT(offset); 258 348 ··· 269 359 } 270 360 271 361 static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip, 272 - unsigned offset) 362 + unsigned int offset) 273 363 { 274 364 writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRC); 275 365 } 276 366 277 - static void __nmk_gpio_set_output(struct nmk_gpio_chip *nmk_chip, 278 - unsigned offset, int val) 279 - { 280 - if (val) 281 - writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DATS); 282 - else 283 - writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DATC); 284 - } 285 - 286 - static void __nmk_gpio_make_output(struct nmk_gpio_chip *nmk_chip, 287 - unsigned offset, int val) 288 - { 289 - writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRS); 290 - __nmk_gpio_set_output(nmk_chip, offset, val); 291 - } 292 - 293 367 static void __nmk_gpio_set_mode_safe(struct nmk_gpio_chip *nmk_chip, 294 - unsigned offset, int gpio_mode, 368 + unsigned int offset, int gpio_mode, 295 369 bool glitch) 296 370 { 297 371 u32 rwimsc = nmk_chip->rwimsc; ··· 302 408 } 303 409 304 410 static void 305 - nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned offset) 411 + nmk_gpio_disable_lazy_irq(struct nmk_gpio_chip *nmk_chip, unsigned int offset) 306 412 { 307 413 u32 falling = nmk_chip->fimsc & BIT(offset); 308 414 u32 rising = nmk_chip->rimsc & BIT(offset); ··· 341 447 } 342 448 343 449 static void nmk_prcm_altcx_set_mode(struct nmk_pinctrl *npct, 344 - unsigned offset, unsigned alt_num) 450 + unsigned int offset, unsigned int alt_num) 345 451 { 346 452 int i; 347 453 u16 reg; ··· 378 484 */ 379 485 if (!alt_num) { 380 486 for (i = 0 ; i < PRCM_IDX_GPIOCR_ALTC_MAX ; i++) { 381 - if (pin_desc->altcx[i].used == true) { 487 + if (pin_desc->altcx[i].used) { 382 488 reg = gpiocr_regs[pin_desc->altcx[i].reg_index]; 383 489 bit = pin_desc->altcx[i].control_bit; 384 490 if (readl(npct->prcm_base + reg) & BIT(bit)) { 385 491 nmk_write_masked(npct->prcm_base + reg, BIT(bit), 0); 386 492 dev_dbg(npct->dev, 387 493 "PRCM GPIOCR: pin %i: alternate-C%i has been disabled\n", 388 - offset, i+1); 494 + offset, i + 1); 389 495 } 390 496 } 391 497 } ··· 393 499 } 394 500 395 501 alt_index = alt_num - 1; 396 - if (pin_desc->altcx[alt_index].used == false) { 502 + if (!pin_desc->altcx[alt_index].used) { 397 503 dev_warn(npct->dev, 398 - "PRCM GPIOCR: pin %i: alternate-C%i does not exist\n", 399 - offset, alt_num); 504 + "PRCM GPIOCR: pin %i: alternate-C%i does not exist\n", 505 + offset, alt_num); 400 506 return; 401 507 } 402 508 ··· 407 513 for (i = 0 ; i < PRCM_IDX_GPIOCR_ALTC_MAX ; i++) { 408 514 if (i == alt_index) 409 515 continue; 410 - if (pin_desc->altcx[i].used == true) { 516 + if (pin_desc->altcx[i].used) { 411 517 reg = gpiocr_regs[pin_desc->altcx[i].reg_index]; 412 518 bit = pin_desc->altcx[i].control_bit; 413 519 if (readl(npct->prcm_base + reg) & BIT(bit)) { 414 520 nmk_write_masked(npct->prcm_base + reg, BIT(bit), 0); 415 521 dev_dbg(npct->dev, 416 522 "PRCM GPIOCR: pin %i: alternate-C%i has been disabled\n", 417 - offset, i+1); 523 + offset, i + 1); 418 524 } 419 525 } 420 526 } ··· 422 528 reg = gpiocr_regs[pin_desc->altcx[alt_index].reg_index]; 423 529 bit = pin_desc->altcx[alt_index].control_bit; 424 530 dev_dbg(npct->dev, "PRCM GPIOCR: pin %i: alternate-C%i has been selected\n", 425 - offset, alt_index+1); 531 + offset, alt_index + 1); 426 532 nmk_write_masked(npct->prcm_base + reg, BIT(bit), BIT(bit)); 427 533 } 428 534 ··· 442 548 { 443 549 int i; 444 550 445 - for (i = 0; i < NUM_BANKS; i++) { 551 + for (i = 0; i < NMK_MAX_BANKS; i++) { 446 552 struct nmk_gpio_chip *chip = nmk_gpio_chips[i]; 447 553 unsigned int temp = slpm[i]; 448 554 ··· 460 566 { 461 567 int i; 462 568 463 - for (i = 0; i < NUM_BANKS; i++) { 569 + for (i = 0; i < NMK_MAX_BANKS; i++) { 464 570 struct nmk_gpio_chip *chip = nmk_gpio_chips[i]; 465 571 466 572 if (!chip) ··· 472 578 } 473 579 } 474 580 475 - static int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) 581 + /* Only called by gpio-nomadik but requires knowledge of struct nmk_pinctrl. */ 582 + int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, int gpio) 476 583 { 477 584 int i; 478 585 u16 reg; ··· 495 600 pin_desc = npct->soc->altcx_pins + i; 496 601 gpiocr_regs = npct->soc->prcm_gpiocr_registers; 497 602 for (i = 0; i < PRCM_IDX_GPIOCR_ALTC_MAX; i++) { 498 - if (pin_desc->altcx[i].used == true) { 603 + if (pin_desc->altcx[i].used) { 499 604 reg = gpiocr_regs[pin_desc->altcx[i].reg_index]; 500 605 bit = pin_desc->altcx[i].control_bit; 501 606 if (readl(npct->prcm_base + reg) & BIT(bit)) 502 - return NMK_GPIO_ALT_C+i+1; 607 + return NMK_GPIO_ALT_C + i + 1; 503 608 } 504 609 } 505 610 return NMK_GPIO_ALT_C; 506 - } 507 - 508 - /* IRQ functions */ 509 - 510 - static void nmk_gpio_irq_ack(struct irq_data *d) 511 - { 512 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 513 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 514 - 515 - clk_enable(nmk_chip->clk); 516 - writel(BIT(d->hwirq), nmk_chip->addr + NMK_GPIO_IC); 517 - clk_disable(nmk_chip->clk); 518 - } 519 - 520 - enum nmk_gpio_irq_type { 521 - NORMAL, 522 - WAKE, 523 - }; 524 - 525 - static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, 526 - int offset, enum nmk_gpio_irq_type which, 527 - bool enable) 528 - { 529 - u32 *rimscval; 530 - u32 *fimscval; 531 - u32 rimscreg; 532 - u32 fimscreg; 533 - 534 - if (which == NORMAL) { 535 - rimscreg = NMK_GPIO_RIMSC; 536 - fimscreg = NMK_GPIO_FIMSC; 537 - rimscval = &nmk_chip->rimsc; 538 - fimscval = &nmk_chip->fimsc; 539 - } else { 540 - rimscreg = NMK_GPIO_RWIMSC; 541 - fimscreg = NMK_GPIO_FWIMSC; 542 - rimscval = &nmk_chip->rwimsc; 543 - fimscval = &nmk_chip->fwimsc; 544 - } 545 - 546 - /* we must individually set/clear the two edges */ 547 - if (nmk_chip->edge_rising & BIT(offset)) { 548 - if (enable) 549 - *rimscval |= BIT(offset); 550 - else 551 - *rimscval &= ~BIT(offset); 552 - writel(*rimscval, nmk_chip->addr + rimscreg); 553 - } 554 - if (nmk_chip->edge_falling & BIT(offset)) { 555 - if (enable) 556 - *fimscval |= BIT(offset); 557 - else 558 - *fimscval &= ~BIT(offset); 559 - writel(*fimscval, nmk_chip->addr + fimscreg); 560 - } 561 - } 562 - 563 - static void __nmk_gpio_set_wake(struct nmk_gpio_chip *nmk_chip, 564 - int offset, bool on) 565 - { 566 - /* 567 - * Ensure WAKEUP_ENABLE is on. No need to disable it if wakeup is 568 - * disabled, since setting SLPM to 1 increases power consumption, and 569 - * wakeup is anyhow controlled by the RIMSC and FIMSC registers. 570 - */ 571 - if (nmk_chip->sleepmode && on) { 572 - __nmk_gpio_set_slpm(nmk_chip, offset, 573 - NMK_GPIO_SLPM_WAKEUP_ENABLE); 574 - } 575 - 576 - __nmk_gpio_irq_modify(nmk_chip, offset, WAKE, on); 577 - } 578 - 579 - static void nmk_gpio_irq_maskunmask(struct nmk_gpio_chip *nmk_chip, 580 - struct irq_data *d, bool enable) 581 - { 582 - unsigned long flags; 583 - 584 - clk_enable(nmk_chip->clk); 585 - spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 586 - spin_lock(&nmk_chip->lock); 587 - 588 - __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, enable); 589 - 590 - if (!(nmk_chip->real_wake & BIT(d->hwirq))) 591 - __nmk_gpio_set_wake(nmk_chip, d->hwirq, enable); 592 - 593 - spin_unlock(&nmk_chip->lock); 594 - spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); 595 - clk_disable(nmk_chip->clk); 596 - } 597 - 598 - static void nmk_gpio_irq_mask(struct irq_data *d) 599 - { 600 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 601 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 602 - 603 - nmk_gpio_irq_maskunmask(nmk_chip, d, false); 604 - gpiochip_disable_irq(gc, irqd_to_hwirq(d)); 605 - } 606 - 607 - static void nmk_gpio_irq_unmask(struct irq_data *d) 608 - { 609 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 610 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 611 - 612 - gpiochip_enable_irq(gc, irqd_to_hwirq(d)); 613 - nmk_gpio_irq_maskunmask(nmk_chip, d, true); 614 - } 615 - 616 - static int nmk_gpio_irq_set_wake(struct irq_data *d, unsigned int on) 617 - { 618 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 619 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 620 - unsigned long flags; 621 - 622 - clk_enable(nmk_chip->clk); 623 - spin_lock_irqsave(&nmk_gpio_slpm_lock, flags); 624 - spin_lock(&nmk_chip->lock); 625 - 626 - if (irqd_irq_disabled(d)) 627 - __nmk_gpio_set_wake(nmk_chip, d->hwirq, on); 628 - 629 - if (on) 630 - nmk_chip->real_wake |= BIT(d->hwirq); 631 - else 632 - nmk_chip->real_wake &= ~BIT(d->hwirq); 633 - 634 - spin_unlock(&nmk_chip->lock); 635 - spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); 636 - clk_disable(nmk_chip->clk); 637 - 638 - return 0; 639 - } 640 - 641 - static int nmk_gpio_irq_set_type(struct irq_data *d, unsigned int type) 642 - { 643 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 644 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 645 - bool enabled = !irqd_irq_disabled(d); 646 - bool wake = irqd_is_wakeup_set(d); 647 - unsigned long flags; 648 - 649 - if (type & IRQ_TYPE_LEVEL_HIGH) 650 - return -EINVAL; 651 - if (type & IRQ_TYPE_LEVEL_LOW) 652 - return -EINVAL; 653 - 654 - clk_enable(nmk_chip->clk); 655 - spin_lock_irqsave(&nmk_chip->lock, flags); 656 - 657 - if (enabled) 658 - __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, false); 659 - 660 - if (enabled || wake) 661 - __nmk_gpio_irq_modify(nmk_chip, d->hwirq, WAKE, false); 662 - 663 - nmk_chip->edge_rising &= ~BIT(d->hwirq); 664 - if (type & IRQ_TYPE_EDGE_RISING) 665 - nmk_chip->edge_rising |= BIT(d->hwirq); 666 - 667 - nmk_chip->edge_falling &= ~BIT(d->hwirq); 668 - if (type & IRQ_TYPE_EDGE_FALLING) 669 - nmk_chip->edge_falling |= BIT(d->hwirq); 670 - 671 - if (enabled) 672 - __nmk_gpio_irq_modify(nmk_chip, d->hwirq, NORMAL, true); 673 - 674 - if (enabled || wake) 675 - __nmk_gpio_irq_modify(nmk_chip, d->hwirq, WAKE, true); 676 - 677 - spin_unlock_irqrestore(&nmk_chip->lock, flags); 678 - clk_disable(nmk_chip->clk); 679 - 680 - return 0; 681 - } 682 - 683 - static unsigned int nmk_gpio_irq_startup(struct irq_data *d) 684 - { 685 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 686 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 687 - 688 - clk_enable(nmk_chip->clk); 689 - nmk_gpio_irq_unmask(d); 690 - return 0; 691 - } 692 - 693 - static void nmk_gpio_irq_shutdown(struct irq_data *d) 694 - { 695 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 696 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 697 - 698 - nmk_gpio_irq_mask(d); 699 - clk_disable(nmk_chip->clk); 700 - } 701 - 702 - static void nmk_gpio_irq_handler(struct irq_desc *desc) 703 - { 704 - struct irq_chip *host_chip = irq_desc_get_chip(desc); 705 - struct gpio_chip *chip = irq_desc_get_handler_data(desc); 706 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 707 - u32 status; 708 - 709 - chained_irq_enter(host_chip, desc); 710 - 711 - clk_enable(nmk_chip->clk); 712 - status = readl(nmk_chip->addr + NMK_GPIO_IS); 713 - clk_disable(nmk_chip->clk); 714 - 715 - while (status) { 716 - int bit = __ffs(status); 717 - 718 - generic_handle_domain_irq(chip->irq.domain, bit); 719 - status &= ~BIT(bit); 720 - } 721 - 722 - chained_irq_exit(host_chip, desc); 723 - } 724 - 725 - /* I/O Functions */ 726 - 727 - static int nmk_gpio_get_dir(struct gpio_chip *chip, unsigned offset) 728 - { 729 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 730 - int dir; 731 - 732 - clk_enable(nmk_chip->clk); 733 - 734 - dir = readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset); 735 - 736 - clk_disable(nmk_chip->clk); 737 - 738 - if (dir) 739 - return GPIO_LINE_DIRECTION_OUT; 740 - 741 - return GPIO_LINE_DIRECTION_IN; 742 - } 743 - 744 - static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset) 745 - { 746 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 747 - 748 - clk_enable(nmk_chip->clk); 749 - 750 - writel(BIT(offset), nmk_chip->addr + NMK_GPIO_DIRC); 751 - 752 - clk_disable(nmk_chip->clk); 753 - 754 - return 0; 755 - } 756 - 757 - static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) 758 - { 759 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 760 - int value; 761 - 762 - clk_enable(nmk_chip->clk); 763 - 764 - value = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset)); 765 - 766 - clk_disable(nmk_chip->clk); 767 - 768 - return value; 769 - } 770 - 771 - static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset, 772 - int val) 773 - { 774 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 775 - 776 - clk_enable(nmk_chip->clk); 777 - 778 - __nmk_gpio_set_output(nmk_chip, offset, val); 779 - 780 - clk_disable(nmk_chip->clk); 781 - } 782 - 783 - static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset, 784 - int val) 785 - { 786 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 787 - 788 - clk_enable(nmk_chip->clk); 789 - 790 - __nmk_gpio_make_output(nmk_chip, offset, val); 791 - 792 - clk_disable(nmk_chip->clk); 793 - 794 - return 0; 795 - } 796 - 797 - #ifdef CONFIG_DEBUG_FS 798 - static int nmk_gpio_get_mode(struct nmk_gpio_chip *nmk_chip, int offset) 799 - { 800 - u32 afunc, bfunc; 801 - 802 - clk_enable(nmk_chip->clk); 803 - 804 - afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & BIT(offset); 805 - bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & BIT(offset); 806 - 807 - clk_disable(nmk_chip->clk); 808 - 809 - return (afunc ? NMK_GPIO_ALT_A : 0) | (bfunc ? NMK_GPIO_ALT_B : 0); 810 - } 811 - 812 - static void nmk_gpio_dbg_show_one(struct seq_file *s, 813 - struct pinctrl_dev *pctldev, struct gpio_chip *chip, 814 - unsigned offset, unsigned gpio) 815 - { 816 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(chip); 817 - int mode; 818 - bool is_out; 819 - bool data_out; 820 - bool pull; 821 - const char *modes[] = { 822 - [NMK_GPIO_ALT_GPIO] = "gpio", 823 - [NMK_GPIO_ALT_A] = "altA", 824 - [NMK_GPIO_ALT_B] = "altB", 825 - [NMK_GPIO_ALT_C] = "altC", 826 - [NMK_GPIO_ALT_C+1] = "altC1", 827 - [NMK_GPIO_ALT_C+2] = "altC2", 828 - [NMK_GPIO_ALT_C+3] = "altC3", 829 - [NMK_GPIO_ALT_C+4] = "altC4", 830 - }; 831 - 832 - char *label = gpiochip_dup_line_label(chip, offset); 833 - if (IS_ERR(label)) 834 - return; 835 - 836 - clk_enable(nmk_chip->clk); 837 - is_out = !!(readl(nmk_chip->addr + NMK_GPIO_DIR) & BIT(offset)); 838 - pull = !(readl(nmk_chip->addr + NMK_GPIO_PDIS) & BIT(offset)); 839 - data_out = !!(readl(nmk_chip->addr + NMK_GPIO_DAT) & BIT(offset)); 840 - mode = nmk_gpio_get_mode(nmk_chip, offset); 841 - if ((mode == NMK_GPIO_ALT_C) && pctldev) 842 - mode = nmk_prcm_gpiocr_get_mode(pctldev, gpio); 843 - 844 - if (is_out) { 845 - seq_printf(s, " gpio-%-3d (%-20.20s) out %s %s", 846 - gpio, 847 - label ?: "(none)", 848 - data_out ? "hi" : "lo", 849 - (mode < 0) ? "unknown" : modes[mode]); 850 - } else { 851 - int irq = chip->to_irq(chip, offset); 852 - const int pullidx = pull ? 1 : 0; 853 - int val; 854 - static const char * const pulls[] = { 855 - "none ", 856 - "pull enabled", 857 - }; 858 - 859 - seq_printf(s, " gpio-%-3d (%-20.20s) in %s %s", 860 - gpio, 861 - label ?: "(none)", 862 - pulls[pullidx], 863 - (mode < 0) ? "unknown" : modes[mode]); 864 - 865 - val = nmk_gpio_get_input(chip, offset); 866 - seq_printf(s, " VAL %d", val); 867 - 868 - /* 869 - * This races with request_irq(), set_irq_type(), 870 - * and set_irq_wake() ... but those are "rare". 871 - */ 872 - if (irq > 0 && irq_has_action(irq)) { 873 - char *trigger; 874 - bool wake; 875 - 876 - if (nmk_chip->edge_rising & BIT(offset)) 877 - trigger = "edge-rising"; 878 - else if (nmk_chip->edge_falling & BIT(offset)) 879 - trigger = "edge-falling"; 880 - else 881 - trigger = "edge-undefined"; 882 - 883 - wake = !!(nmk_chip->real_wake & BIT(offset)); 884 - 885 - seq_printf(s, " irq-%d %s%s", 886 - irq, trigger, wake ? " wakeup" : ""); 887 - } 888 - } 889 - clk_disable(nmk_chip->clk); 890 - } 891 - 892 - static void nmk_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip) 893 - { 894 - unsigned i; 895 - unsigned gpio = chip->base; 896 - 897 - for (i = 0; i < chip->ngpio; i++, gpio++) { 898 - nmk_gpio_dbg_show_one(s, NULL, chip, i, gpio); 899 - seq_printf(s, "\n"); 900 - } 901 - } 902 - 903 - #else 904 - static inline void nmk_gpio_dbg_show_one(struct seq_file *s, 905 - struct pinctrl_dev *pctldev, 906 - struct gpio_chip *chip, 907 - unsigned offset, unsigned gpio) 908 - { 909 - } 910 - #define nmk_gpio_dbg_show NULL 911 - #endif 912 - 913 - /* 914 - * We will allocate memory for the state container using devm* allocators 915 - * binding to the first device reaching this point, it doesn't matter if 916 - * it is the pin controller or GPIO driver. However we need to use the right 917 - * platform device when looking up resources so pay attention to pdev. 918 - */ 919 - static struct nmk_gpio_chip *nmk_gpio_populate_chip(struct device_node *np, 920 - struct platform_device *pdev) 921 - { 922 - struct nmk_gpio_chip *nmk_chip; 923 - struct platform_device *gpio_pdev; 924 - struct gpio_chip *chip; 925 - struct resource *res; 926 - struct clk *clk; 927 - void __iomem *base; 928 - u32 id; 929 - 930 - gpio_pdev = of_find_device_by_node(np); 931 - if (!gpio_pdev) { 932 - pr_err("populate \"%pOFn\": device not found\n", np); 933 - return ERR_PTR(-ENODEV); 934 - } 935 - if (of_property_read_u32(np, "gpio-bank", &id)) { 936 - dev_err(&pdev->dev, "populate: gpio-bank property not found\n"); 937 - platform_device_put(gpio_pdev); 938 - return ERR_PTR(-EINVAL); 939 - } 940 - 941 - /* Already populated? */ 942 - nmk_chip = nmk_gpio_chips[id]; 943 - if (nmk_chip) { 944 - platform_device_put(gpio_pdev); 945 - return nmk_chip; 946 - } 947 - 948 - nmk_chip = devm_kzalloc(&pdev->dev, sizeof(*nmk_chip), GFP_KERNEL); 949 - if (!nmk_chip) { 950 - platform_device_put(gpio_pdev); 951 - return ERR_PTR(-ENOMEM); 952 - } 953 - 954 - nmk_chip->bank = id; 955 - chip = &nmk_chip->chip; 956 - chip->base = id * NMK_GPIO_PER_CHIP; 957 - chip->ngpio = NMK_GPIO_PER_CHIP; 958 - chip->label = dev_name(&gpio_pdev->dev); 959 - chip->parent = &gpio_pdev->dev; 960 - 961 - res = platform_get_resource(gpio_pdev, IORESOURCE_MEM, 0); 962 - base = devm_ioremap_resource(&pdev->dev, res); 963 - if (IS_ERR(base)) { 964 - platform_device_put(gpio_pdev); 965 - return ERR_CAST(base); 966 - } 967 - nmk_chip->addr = base; 968 - 969 - clk = clk_get(&gpio_pdev->dev, NULL); 970 - if (IS_ERR(clk)) { 971 - platform_device_put(gpio_pdev); 972 - return (void *) clk; 973 - } 974 - clk_prepare(clk); 975 - nmk_chip->clk = clk; 976 - 977 - BUG_ON(nmk_chip->bank >= ARRAY_SIZE(nmk_gpio_chips)); 978 - nmk_gpio_chips[id] = nmk_chip; 979 - return nmk_chip; 980 - } 981 - 982 - static void nmk_gpio_irq_print_chip(struct irq_data *d, struct seq_file *p) 983 - { 984 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 985 - struct nmk_gpio_chip *nmk_chip = gpiochip_get_data(gc); 986 - 987 - seq_printf(p, "nmk%u-%u-%u", nmk_chip->bank, 988 - gc->base, gc->base + gc->ngpio - 1); 989 - } 990 - 991 - static const struct irq_chip nmk_irq_chip = { 992 - .irq_ack = nmk_gpio_irq_ack, 993 - .irq_mask = nmk_gpio_irq_mask, 994 - .irq_unmask = nmk_gpio_irq_unmask, 995 - .irq_set_type = nmk_gpio_irq_set_type, 996 - .irq_set_wake = nmk_gpio_irq_set_wake, 997 - .irq_startup = nmk_gpio_irq_startup, 998 - .irq_shutdown = nmk_gpio_irq_shutdown, 999 - .irq_print_chip = nmk_gpio_irq_print_chip, 1000 - .flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE, 1001 - GPIOCHIP_IRQ_RESOURCE_HELPERS, 1002 - }; 1003 - 1004 - static int nmk_gpio_probe(struct platform_device *dev) 1005 - { 1006 - struct device_node *np = dev->dev.of_node; 1007 - struct nmk_gpio_chip *nmk_chip; 1008 - struct gpio_chip *chip; 1009 - struct gpio_irq_chip *girq; 1010 - bool supports_sleepmode; 1011 - int irq; 1012 - int ret; 1013 - 1014 - nmk_chip = nmk_gpio_populate_chip(np, dev); 1015 - if (IS_ERR(nmk_chip)) { 1016 - dev_err(&dev->dev, "could not populate nmk chip struct\n"); 1017 - return PTR_ERR(nmk_chip); 1018 - } 1019 - 1020 - supports_sleepmode = 1021 - of_property_read_bool(np, "st,supports-sleepmode"); 1022 - 1023 - /* Correct platform device ID */ 1024 - dev->id = nmk_chip->bank; 1025 - 1026 - irq = platform_get_irq(dev, 0); 1027 - if (irq < 0) 1028 - return irq; 1029 - 1030 - /* 1031 - * The virt address in nmk_chip->addr is in the nomadik register space, 1032 - * so we can simply convert the resource address, without remapping 1033 - */ 1034 - nmk_chip->sleepmode = supports_sleepmode; 1035 - spin_lock_init(&nmk_chip->lock); 1036 - 1037 - chip = &nmk_chip->chip; 1038 - chip->parent = &dev->dev; 1039 - chip->request = gpiochip_generic_request; 1040 - chip->free = gpiochip_generic_free; 1041 - chip->get_direction = nmk_gpio_get_dir; 1042 - chip->direction_input = nmk_gpio_make_input; 1043 - chip->get = nmk_gpio_get_input; 1044 - chip->direction_output = nmk_gpio_make_output; 1045 - chip->set = nmk_gpio_set_output; 1046 - chip->dbg_show = nmk_gpio_dbg_show; 1047 - chip->can_sleep = false; 1048 - chip->owner = THIS_MODULE; 1049 - 1050 - girq = &chip->irq; 1051 - gpio_irq_chip_set_chip(girq, &nmk_irq_chip); 1052 - girq->parent_handler = nmk_gpio_irq_handler; 1053 - girq->num_parents = 1; 1054 - girq->parents = devm_kcalloc(&dev->dev, 1, 1055 - sizeof(*girq->parents), 1056 - GFP_KERNEL); 1057 - if (!girq->parents) 1058 - return -ENOMEM; 1059 - girq->parents[0] = irq; 1060 - girq->default_type = IRQ_TYPE_NONE; 1061 - girq->handler = handle_edge_irq; 1062 - 1063 - clk_enable(nmk_chip->clk); 1064 - nmk_chip->lowemi = readl_relaxed(nmk_chip->addr + NMK_GPIO_LOWEMI); 1065 - clk_disable(nmk_chip->clk); 1066 - 1067 - ret = gpiochip_add_data(chip, nmk_chip); 1068 - if (ret) 1069 - return ret; 1070 - 1071 - platform_set_drvdata(dev, nmk_chip); 1072 - 1073 - dev_info(&dev->dev, "chip registered\n"); 1074 - 1075 - return 0; 1076 611 } 1077 612 1078 613 static int nmk_get_groups_cnt(struct pinctrl_dev *pctldev) ··· 513 1188 } 514 1189 515 1190 static const char *nmk_get_group_name(struct pinctrl_dev *pctldev, 516 - unsigned selector) 1191 + unsigned int selector) 517 1192 { 518 1193 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 519 1194 520 1195 return npct->soc->groups[selector].grp.name; 521 1196 } 522 1197 523 - static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, 524 - const unsigned **pins, 525 - unsigned *npins) 1198 + static int nmk_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector, 1199 + const unsigned int **pins, 1200 + unsigned int *num_pins) 526 1201 { 527 1202 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 528 1203 529 1204 *pins = npct->soc->groups[selector].grp.pins; 530 - *npins = npct->soc->groups[selector].grp.npins; 1205 + *num_pins = npct->soc->groups[selector].grp.npins; 531 1206 return 0; 532 1207 } 533 1208 534 - static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned pin) 1209 + /* This makes the mapping from pin number to a GPIO chip. We also return the pin 1210 + * offset in the GPIO chip for convenience (and to avoid a second loop). 1211 + */ 1212 + static struct nmk_gpio_chip *find_nmk_gpio_from_pin(unsigned int pin, 1213 + unsigned int *offset) 535 1214 { 536 - int i; 1215 + int i, j = 0; 537 1216 struct nmk_gpio_chip *nmk_gpio; 538 1217 539 - for(i = 0; i < NMK_MAX_BANKS; i++) { 1218 + /* We assume that pins are allocated in bank order. */ 1219 + for (i = 0; i < NMK_MAX_BANKS; i++) { 540 1220 nmk_gpio = nmk_gpio_chips[i]; 541 1221 if (!nmk_gpio) 542 1222 continue; 543 - if (pin >= nmk_gpio->chip.base && 544 - pin < nmk_gpio->chip.base + nmk_gpio->chip.ngpio) 1223 + if (pin >= j && pin < j + nmk_gpio->chip.ngpio) { 1224 + if (offset) 1225 + *offset = pin - j; 545 1226 return nmk_gpio; 1227 + } 1228 + j += nmk_gpio->chip.ngpio; 546 1229 } 547 1230 return NULL; 548 1231 } 549 1232 550 - static struct gpio_chip *find_gc_from_pin(unsigned pin) 1233 + static struct gpio_chip *find_gc_from_pin(unsigned int pin) 551 1234 { 552 - struct nmk_gpio_chip *nmk_gpio = find_nmk_gpio_from_pin(pin); 1235 + struct nmk_gpio_chip *nmk_gpio = find_nmk_gpio_from_pin(pin, NULL); 553 1236 554 1237 if (nmk_gpio) 555 1238 return &nmk_gpio->chip; ··· 565 1232 } 566 1233 567 1234 static void nmk_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s, 568 - unsigned offset) 1235 + unsigned int offset) 569 1236 { 570 1237 struct gpio_chip *chip = find_gc_from_pin(offset); 571 1238 ··· 576 1243 nmk_gpio_dbg_show_one(s, pctldev, chip, offset - chip->base, offset); 577 1244 } 578 1245 579 - static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned *reserved_maps, 580 - unsigned *num_maps, const char *group, 581 - const char *function) 1246 + static int nmk_dt_add_map_mux(struct pinctrl_map **map, unsigned int *reserved_maps, 1247 + unsigned int *num_maps, const char *group, 1248 + const char *function) 582 1249 { 583 1250 if (*num_maps == *reserved_maps) 584 1251 return -ENOSPC; ··· 592 1259 } 593 1260 594 1261 static int nmk_dt_add_map_configs(struct pinctrl_map **map, 595 - unsigned *reserved_maps, 596 - unsigned *num_maps, const char *group, 597 - unsigned long *configs, unsigned num_configs) 1262 + unsigned int *reserved_maps, 1263 + unsigned int *num_maps, const char *group, 1264 + unsigned long *configs, unsigned int num_configs) 598 1265 { 599 1266 unsigned long *dup_configs; 600 1267 ··· 685 1352 686 1353 static int nmk_dt_pin_config(int index, int val, unsigned long *config) 687 1354 { 688 - if (nmk_cfg_params[index].choice == NULL) 1355 + if (!nmk_cfg_params[index].choice) { 689 1356 *config = nmk_cfg_params[index].config; 690 - else { 1357 + } else { 691 1358 /* test if out of range */ 692 1359 if (val < nmk_cfg_params[index].size) { 693 1360 *config = nmk_cfg_params[index].config | ··· 710 1377 } 711 1378 712 1379 static bool nmk_pinctrl_dt_get_config(struct device_node *np, 713 - unsigned long *configs) 1380 + unsigned long *configs) 714 1381 { 715 1382 bool has_config = 0; 716 1383 unsigned long cfg = 0; 717 1384 int i, val, ret; 718 1385 719 1386 for (i = 0; i < ARRAY_SIZE(nmk_cfg_params); i++) { 720 - ret = of_property_read_u32(np, 721 - nmk_cfg_params[i].property, &val); 1387 + ret = of_property_read_u32(np, nmk_cfg_params[i].property, &val); 722 1388 if (ret != -EINVAL) { 723 1389 if (nmk_dt_pin_config(i, val, &cfg) == 0) { 724 1390 *configs |= cfg; ··· 730 1398 } 731 1399 732 1400 static int nmk_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, 733 - struct device_node *np, 734 - struct pinctrl_map **map, 735 - unsigned *reserved_maps, 736 - unsigned *num_maps) 1401 + struct device_node *np, 1402 + struct pinctrl_map **map, 1403 + unsigned int *reserved_maps, 1404 + unsigned int *num_maps) 737 1405 { 738 1406 int ret; 739 1407 const char *function = NULL; ··· 758 1426 759 1427 of_property_for_each_string(np, "groups", prop, group) { 760 1428 ret = nmk_dt_add_map_mux(map, reserved_maps, num_maps, 761 - group, function); 1429 + group, function); 762 1430 if (ret < 0) 763 1431 goto exit; 764 1432 } ··· 799 1467 } 800 1468 801 1469 static int nmk_pinctrl_dt_node_to_map(struct pinctrl_dev *pctldev, 802 - struct device_node *np_config, 803 - struct pinctrl_map **map, unsigned *num_maps) 1470 + struct device_node *np_config, 1471 + struct pinctrl_map **map, 1472 + unsigned int *num_maps) 804 1473 { 805 - unsigned reserved_maps; 1474 + unsigned int reserved_maps; 806 1475 struct device_node *np; 807 1476 int ret; 808 1477 ··· 813 1480 814 1481 for_each_child_of_node(np_config, np) { 815 1482 ret = nmk_pinctrl_dt_subnode_to_map(pctldev, np, map, 816 - &reserved_maps, num_maps); 1483 + &reserved_maps, num_maps); 817 1484 if (ret < 0) { 818 1485 pinctrl_utils_free_map(pctldev, *map, *num_maps); 819 1486 of_node_put(np); ··· 841 1508 } 842 1509 843 1510 static const char *nmk_pmx_get_func_name(struct pinctrl_dev *pctldev, 844 - unsigned function) 1511 + unsigned int function) 845 1512 { 846 1513 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 847 1514 ··· 849 1516 } 850 1517 851 1518 static int nmk_pmx_get_func_groups(struct pinctrl_dev *pctldev, 852 - unsigned function, 1519 + unsigned int function, 853 1520 const char * const **groups, 854 1521 unsigned * const num_groups) 855 1522 { ··· 861 1528 return 0; 862 1529 } 863 1530 864 - static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned function, 865 - unsigned group) 1531 + static int nmk_pmx_set(struct pinctrl_dev *pctldev, unsigned int function, 1532 + unsigned int group) 866 1533 { 867 1534 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 868 1535 const struct nmk_pingroup *g; 869 - static unsigned int slpm[NUM_BANKS]; 1536 + static unsigned int slpm[NMK_MAX_BANKS]; 870 1537 unsigned long flags = 0; 871 1538 bool glitch; 872 1539 int ret = -EINVAL; ··· 877 1544 if (g->altsetting < 0) 878 1545 return -EINVAL; 879 1546 880 - dev_dbg(npct->dev, "enable group %s, %u pins\n", g->grp.name, g->grp.npins); 1547 + dev_dbg(npct->dev, "enable group %s, %zu pins\n", g->grp.name, g->grp.npins); 881 1548 882 1549 /* 883 1550 * If we're setting altfunc C by setting both AFSLA and AFSLB to 1, ··· 912 1579 * Then mask the pins that need to be sleeping now when we're 913 1580 * switching to the ALT C function. 914 1581 */ 915 - for (i = 0; i < g->grp.npins; i++) 916 - slpm[g->grp.pins[i] / NMK_GPIO_PER_CHIP] &= ~BIT(g->grp.pins[i]); 1582 + for (i = 0; i < g->grp.npins; i++) { 1583 + struct nmk_gpio_chip *nmk_chip; 1584 + unsigned int bit; 1585 + 1586 + nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i], &bit); 1587 + if (!nmk_chip) { 1588 + dev_err(npct->dev, 1589 + "invalid pin offset %d in group %s at index %d\n", 1590 + g->grp.pins[i], g->grp.name, i); 1591 + goto out_pre_slpm_init; 1592 + } 1593 + 1594 + slpm[nmk_chip->bank] &= ~BIT(bit); 1595 + } 917 1596 nmk_gpio_glitch_slpm_init(slpm); 918 1597 } 919 1598 920 1599 for (i = 0; i < g->grp.npins; i++) { 921 1600 struct nmk_gpio_chip *nmk_chip; 922 - unsigned bit; 1601 + unsigned int bit; 923 1602 924 - nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i]); 1603 + nmk_chip = find_nmk_gpio_from_pin(g->grp.pins[i], &bit); 925 1604 if (!nmk_chip) { 926 1605 dev_err(npct->dev, 927 1606 "invalid pin offset %d in group %s at index %d\n", 928 1607 g->grp.pins[i], g->grp.name, i); 929 1608 goto out_glitch; 930 1609 } 931 - dev_dbg(npct->dev, "setting pin %d to altsetting %d\n", g->grp.pins[i], g->altsetting); 1610 + dev_dbg(npct->dev, "setting pin %d to altsetting %d\n", 1611 + g->grp.pins[i], g->altsetting); 932 1612 933 1613 clk_enable(nmk_chip->clk); 934 - bit = g->grp.pins[i] % NMK_GPIO_PER_CHIP; 935 1614 /* 936 1615 * If the pin is switching to altfunc, and there was an 937 1616 * interrupt installed on it which has been lazy disabled, ··· 954 1609 nmk_gpio_disable_lazy_irq(nmk_chip, bit); 955 1610 956 1611 __nmk_gpio_set_mode_safe(nmk_chip, bit, 957 - (g->altsetting & NMK_GPIO_ALT_C), glitch); 1612 + (g->altsetting & NMK_GPIO_ALT_C), glitch); 958 1613 clk_disable(nmk_chip->clk); 959 1614 960 1615 /* ··· 967 1622 */ 968 1623 if ((g->altsetting & NMK_GPIO_ALT_C) == NMK_GPIO_ALT_C) 969 1624 nmk_prcm_altcx_set_mode(npct, g->grp.pins[i], 970 - g->altsetting >> NMK_GPIO_ALT_CX_SHIFT); 1625 + g->altsetting >> NMK_GPIO_ALT_CX_SHIFT); 971 1626 } 972 1627 973 1628 /* When all pins are successfully reconfigured we get here */ 974 1629 ret = 0; 975 1630 976 1631 out_glitch: 977 - if (glitch) { 1632 + if (glitch) 978 1633 nmk_gpio_glitch_slpm_restore(slpm); 1634 + out_pre_slpm_init: 1635 + if (glitch) 979 1636 spin_unlock_irqrestore(&nmk_gpio_slpm_lock, flags); 980 - } 981 1637 982 1638 return ret; 983 1639 } 984 1640 985 1641 static int nmk_gpio_request_enable(struct pinctrl_dev *pctldev, 986 1642 struct pinctrl_gpio_range *range, 987 - unsigned offset) 1643 + unsigned int pin) 988 1644 { 989 1645 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 990 1646 struct nmk_gpio_chip *nmk_chip; 991 1647 struct gpio_chip *chip; 992 - unsigned bit; 1648 + unsigned int bit; 993 1649 994 1650 if (!range) { 995 1651 dev_err(npct->dev, "invalid range\n"); ··· 1003 1657 chip = range->gc; 1004 1658 nmk_chip = gpiochip_get_data(chip); 1005 1659 1006 - dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset); 1660 + dev_dbg(npct->dev, "enable pin %u as GPIO\n", pin); 1661 + 1662 + find_nmk_gpio_from_pin(pin, &bit); 1007 1663 1008 1664 clk_enable(nmk_chip->clk); 1009 - bit = offset % NMK_GPIO_PER_CHIP; 1010 1665 /* There is no glitch when converting any pin to GPIO */ 1011 1666 __nmk_gpio_set_mode(nmk_chip, bit, NMK_GPIO_ALT_GPIO); 1012 1667 clk_disable(nmk_chip->clk); ··· 1017 1670 1018 1671 static void nmk_gpio_disable_free(struct pinctrl_dev *pctldev, 1019 1672 struct pinctrl_gpio_range *range, 1020 - unsigned offset) 1673 + unsigned int pin) 1021 1674 { 1022 1675 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 1023 1676 1024 - dev_dbg(npct->dev, "disable pin %u as GPIO\n", offset); 1677 + dev_dbg(npct->dev, "disable pin %u as GPIO\n", pin); 1025 1678 /* Set the pin to some default state, GPIO is usually default */ 1026 1679 } 1027 1680 ··· 1035 1688 .strict = true, 1036 1689 }; 1037 1690 1038 - static int nmk_pin_config_get(struct pinctrl_dev *pctldev, unsigned pin, 1691 + static int nmk_pin_config_get(struct pinctrl_dev *pctldev, unsigned int pin, 1039 1692 unsigned long *config) 1040 1693 { 1041 1694 /* Not implemented */ 1042 1695 return -EINVAL; 1043 1696 } 1044 1697 1045 - static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned pin, 1046 - unsigned long *configs, unsigned num_configs) 1698 + static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin, 1699 + unsigned long *configs, unsigned int num_configs) 1047 1700 { 1048 - static const char *pullnames[] = { 1701 + static const char * const pullnames[] = { 1049 1702 [NMK_GPIO_PULL_NONE] = "none", 1050 1703 [NMK_GPIO_PULL_UP] = "up", 1051 1704 [NMK_GPIO_PULL_DOWN] = "down", 1052 1705 [3] /* illegal */ = "??" 1053 1706 }; 1054 - static const char *slpmnames[] = { 1707 + static const char * const slpmnames[] = { 1055 1708 [NMK_GPIO_SLPM_INPUT] = "input/wakeup", 1056 1709 [NMK_GPIO_SLPM_NOCHANGE] = "no-change/no-wakeup", 1057 1710 }; 1058 1711 struct nmk_pinctrl *npct = pinctrl_dev_get_drvdata(pctldev); 1059 1712 struct nmk_gpio_chip *nmk_chip; 1060 - unsigned bit; 1061 - pin_cfg_t cfg; 1713 + unsigned int bit; 1714 + unsigned long cfg; 1062 1715 int pull, slpm, output, val, i; 1063 1716 bool lowemi, gpiomode, sleep; 1064 1717 1065 - nmk_chip = find_nmk_gpio_from_pin(pin); 1718 + nmk_chip = find_nmk_gpio_from_pin(pin, &bit); 1066 1719 if (!nmk_chip) { 1067 1720 dev_err(npct->dev, 1068 1721 "invalid pin offset %d\n", pin); ··· 1075 1728 * here we just ignore that part. It's being handled by the 1076 1729 * framework and pinmux callback respectively. 1077 1730 */ 1078 - cfg = (pin_cfg_t) configs[i]; 1731 + cfg = configs[i]; 1079 1732 pull = PIN_PULL(cfg); 1080 1733 slpm = PIN_SLPM(cfg); 1081 1734 output = PIN_DIR(cfg); ··· 1120 1773 lowemi ? "on" : "off"); 1121 1774 1122 1775 clk_enable(nmk_chip->clk); 1123 - bit = pin % NMK_GPIO_PER_CHIP; 1124 1776 if (gpiomode) 1125 1777 /* No glitch when going to GPIO mode */ 1126 1778 __nmk_gpio_set_mode(nmk_chip, bit, NMK_GPIO_ALT_GPIO); 1127 - if (output) 1779 + if (output) { 1128 1780 __nmk_gpio_make_output(nmk_chip, bit, val); 1129 - else { 1781 + } else { 1130 1782 __nmk_gpio_make_input(nmk_chip, bit); 1131 1783 __nmk_gpio_set_pull(nmk_chip, bit, pull); 1132 1784 } ··· 1190 1844 1191 1845 static int nmk_pinctrl_probe(struct platform_device *pdev) 1192 1846 { 1193 - struct device_node *np = pdev->dev.of_node; 1194 - struct device_node *prcm_np; 1847 + struct fwnode_handle *fwnode = dev_fwnode(&pdev->dev); 1848 + struct fwnode_handle *prcm_fwnode; 1195 1849 struct nmk_pinctrl *npct; 1196 - unsigned int version = 0; 1850 + uintptr_t version = 0; 1197 1851 int i; 1198 1852 1199 1853 npct = devm_kzalloc(&pdev->dev, sizeof(*npct), GFP_KERNEL); 1200 1854 if (!npct) 1201 1855 return -ENOMEM; 1202 1856 1203 - version = (unsigned int)device_get_match_data(&pdev->dev); 1857 + version = (uintptr_t)device_get_match_data(&pdev->dev); 1204 1858 1205 1859 /* Poke in other ASIC variants here */ 1206 1860 if (version == PINCTRL_NMK_STN8815) ··· 1216 1870 * or after this point: it shouldn't matter as the APIs are orthogonal. 1217 1871 */ 1218 1872 for (i = 0; i < NMK_MAX_BANKS; i++) { 1219 - struct device_node *gpio_np; 1873 + struct fwnode_handle *gpio_fwnode; 1220 1874 struct nmk_gpio_chip *nmk_chip; 1221 1875 1222 - gpio_np = of_parse_phandle(np, "nomadik-gpio-chips", i); 1223 - if (gpio_np) { 1224 - dev_info(&pdev->dev, 1225 - "populate NMK GPIO %d \"%pOFn\"\n", 1226 - i, gpio_np); 1227 - nmk_chip = nmk_gpio_populate_chip(gpio_np, pdev); 1228 - if (IS_ERR(nmk_chip)) 1229 - dev_err(&pdev->dev, 1230 - "could not populate nmk chip struct " 1231 - "- continue anyway\n"); 1232 - of_node_put(gpio_np); 1233 - } 1876 + gpio_fwnode = fwnode_find_reference(fwnode, "nomadik-gpio-chips", i); 1877 + if (IS_ERR(gpio_fwnode)) 1878 + continue; 1879 + 1880 + dev_info(&pdev->dev, "populate NMK GPIO %d \"%pfwP\"\n", i, gpio_fwnode); 1881 + nmk_chip = nmk_gpio_populate_chip(gpio_fwnode, pdev); 1882 + if (IS_ERR(nmk_chip)) 1883 + dev_err(&pdev->dev, 1884 + "could not populate nmk chip struct - continue anyway\n"); 1885 + else 1886 + /* We are NOT compatible with mobileye,eyeq5-gpio. */ 1887 + BUG_ON(nmk_chip->is_mobileye_soc); 1888 + fwnode_handle_put(gpio_fwnode); 1234 1889 } 1235 1890 1236 - prcm_np = of_parse_phandle(np, "prcm", 0); 1237 - if (prcm_np) { 1238 - npct->prcm_base = of_iomap(prcm_np, 0); 1239 - of_node_put(prcm_np); 1891 + prcm_fwnode = fwnode_find_reference(fwnode, "prcm", 0); 1892 + if (!IS_ERR(prcm_fwnode)) { 1893 + npct->prcm_base = fwnode_iomap(prcm_fwnode, 0); 1894 + fwnode_handle_put(prcm_fwnode); 1240 1895 } 1241 1896 if (!npct->prcm_base) { 1242 1897 if (version == PINCTRL_NMK_STN8815) { 1243 1898 dev_info(&pdev->dev, 1244 - "No PRCM base, " 1245 - "assuming no ALT-Cx control is available\n"); 1899 + "No PRCM base, assuming no ALT-Cx control is available\n"); 1246 1900 } else { 1247 1901 dev_err(&pdev->dev, "missing PRCM base address\n"); 1248 1902 return -EINVAL; ··· 1265 1919 return 0; 1266 1920 } 1267 1921 1268 - static const struct of_device_id nmk_gpio_match[] = { 1269 - { .compatible = "st,nomadik-gpio", }, 1270 - {} 1271 - }; 1272 - 1273 - static struct platform_driver nmk_gpio_driver = { 1274 - .driver = { 1275 - .name = "gpio", 1276 - .of_match_table = nmk_gpio_match, 1277 - }, 1278 - .probe = nmk_gpio_probe, 1279 - }; 1280 - 1281 1922 static SIMPLE_DEV_PM_OPS(nmk_pinctrl_pm_ops, 1282 1923 nmk_pinctrl_suspend, 1283 1924 nmk_pinctrl_resume); ··· 1277 1944 }, 1278 1945 .probe = nmk_pinctrl_probe, 1279 1946 }; 1280 - 1281 - static int __init nmk_gpio_init(void) 1282 - { 1283 - return platform_driver_register(&nmk_gpio_driver); 1284 - } 1285 - subsys_initcall(nmk_gpio_init); 1286 1947 1287 1948 static int __init nmk_pinctrl_init(void) 1288 1949 {
+126 -12
drivers/pinctrl/nomadik/pinctrl-nomadik.h include/linux/gpio/gpio-nomadik.h
··· 1 1 /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef PINCTRL_PINCTRL_NOMADIK_H 3 - #define PINCTRL_PINCTRL_NOMADIK_H 2 + #ifndef __LINUX_GPIO_NOMADIK_H 3 + #define __LINUX_GPIO_NOMADIK_H 4 4 5 - #include <linux/kernel.h> 6 - #include <linux/types.h> 7 - 8 - #include <linux/pinctrl/pinctrl.h> 5 + struct fwnode_handle; 9 6 10 7 /* Package definitions */ 11 8 #define PINCTRL_NMK_STN8815 0 12 9 #define PINCTRL_NMK_DB8500 1 10 + 11 + #define GPIO_BLOCK_SHIFT 5 12 + #define NMK_GPIO_PER_CHIP BIT(GPIO_BLOCK_SHIFT) 13 + #define NMK_MAX_BANKS DIV_ROUND_UP(512, NMK_GPIO_PER_CHIP) 14 + 15 + /* Register in the logic block */ 16 + #define NMK_GPIO_DAT 0x00 17 + #define NMK_GPIO_DATS 0x04 18 + #define NMK_GPIO_DATC 0x08 19 + #define NMK_GPIO_PDIS 0x0c 20 + #define NMK_GPIO_DIR 0x10 21 + #define NMK_GPIO_DIRS 0x14 22 + #define NMK_GPIO_DIRC 0x18 23 + #define NMK_GPIO_SLPC 0x1c 24 + #define NMK_GPIO_AFSLA 0x20 25 + #define NMK_GPIO_AFSLB 0x24 26 + #define NMK_GPIO_LOWEMI 0x28 27 + 28 + #define NMK_GPIO_RIMSC 0x40 29 + #define NMK_GPIO_FIMSC 0x44 30 + #define NMK_GPIO_IS 0x48 31 + #define NMK_GPIO_IC 0x4c 32 + #define NMK_GPIO_RWIMSC 0x50 33 + #define NMK_GPIO_FWIMSC 0x54 34 + #define NMK_GPIO_WKS 0x58 35 + /* These appear in DB8540 and later ASICs */ 36 + #define NMK_GPIO_EDGELEVEL 0x5C 37 + #define NMK_GPIO_LEVEL 0x60 38 + 39 + /* Pull up/down values */ 40 + enum nmk_gpio_pull { 41 + NMK_GPIO_PULL_NONE, 42 + NMK_GPIO_PULL_UP, 43 + NMK_GPIO_PULL_DOWN, 44 + }; 45 + 46 + /* Sleep mode */ 47 + enum nmk_gpio_slpm { 48 + NMK_GPIO_SLPM_INPUT, 49 + NMK_GPIO_SLPM_WAKEUP_ENABLE = NMK_GPIO_SLPM_INPUT, 50 + NMK_GPIO_SLPM_NOCHANGE, 51 + NMK_GPIO_SLPM_WAKEUP_DISABLE = NMK_GPIO_SLPM_NOCHANGE, 52 + }; 53 + 54 + struct nmk_gpio_chip { 55 + struct gpio_chip chip; 56 + void __iomem *addr; 57 + struct clk *clk; 58 + unsigned int bank; 59 + void (*set_ioforce)(bool enable); 60 + spinlock_t lock; 61 + bool sleepmode; 62 + bool is_mobileye_soc; 63 + /* Keep track of configured edges */ 64 + u32 edge_rising; 65 + u32 edge_falling; 66 + u32 real_wake; 67 + u32 rwimsc; 68 + u32 fwimsc; 69 + u32 rimsc; 70 + u32 fimsc; 71 + u32 pull_up; 72 + u32 lowemi; 73 + }; 13 74 14 75 /* Alternate functions: function C is set in hw by setting both A and B */ 15 76 #define NMK_GPIO_ALT_GPIO 0 ··· 165 104 struct nmk_function { 166 105 const char *name; 167 106 const char * const *groups; 168 - unsigned ngroups; 107 + unsigned int ngroups; 169 108 }; 170 109 171 110 /** ··· 202 141 */ 203 142 struct nmk_pinctrl_soc_data { 204 143 const struct pinctrl_pin_desc *pins; 205 - unsigned npins; 144 + unsigned int npins; 206 145 const struct nmk_function *functions; 207 - unsigned nfunctions; 146 + unsigned int nfunctions; 208 147 const struct nmk_pingroup *groups; 209 - unsigned ngroups; 148 + unsigned int ngroups; 210 149 const struct prcm_gpiocr_altcx_pin_desc *altcx_pins; 211 - unsigned npins_altcx; 150 + unsigned int npins_altcx; 212 151 const u16 *prcm_gpiocr_registers; 213 152 }; 214 153 ··· 238 177 239 178 #endif 240 179 241 - #endif /* PINCTRL_PINCTRL_NOMADIK_H */ 180 + #ifdef CONFIG_PINCTRL_DB8540 181 + 182 + void nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc); 183 + 184 + #else 185 + 186 + static inline void 187 + nmk_pinctrl_db8540_init(const struct nmk_pinctrl_soc_data **soc) 188 + { 189 + } 190 + 191 + #endif 192 + 193 + struct platform_device; 194 + 195 + #ifdef CONFIG_DEBUG_FS 196 + 197 + /* 198 + * Symbols declared in gpio-nomadik used by pinctrl-nomadik. If pinctrl-nomadik 199 + * is enabled, then gpio-nomadik is enabled as well; the reverse if not always 200 + * true. 201 + */ 202 + void nmk_gpio_dbg_show_one(struct seq_file *s, struct pinctrl_dev *pctldev, 203 + struct gpio_chip *chip, unsigned int offset, 204 + unsigned int gpio); 205 + 206 + #else 207 + 208 + static inline void nmk_gpio_dbg_show_one(struct seq_file *s, 209 + struct pinctrl_dev *pctldev, 210 + struct gpio_chip *chip, 211 + unsigned int offset, 212 + unsigned int gpio) 213 + { 214 + } 215 + 216 + #endif 217 + 218 + void __nmk_gpio_make_output(struct nmk_gpio_chip *nmk_chip, 219 + unsigned int offset, int val); 220 + void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip, unsigned int offset, 221 + enum nmk_gpio_slpm mode); 222 + struct nmk_gpio_chip *nmk_gpio_populate_chip(struct fwnode_handle *fwnode, 223 + struct platform_device *pdev); 224 + 225 + /* Symbols declared in pinctrl-nomadik used by gpio-nomadik. */ 226 + #ifdef CONFIG_PINCTRL_NOMADIK 227 + extern struct nmk_gpio_chip *nmk_gpio_chips[NMK_MAX_BANKS]; 228 + extern spinlock_t nmk_gpio_slpm_lock; 229 + int __maybe_unused nmk_prcm_gpiocr_get_mode(struct pinctrl_dev *pctldev, 230 + int gpio); 231 + #endif 232 + 233 + #endif /* __LINUX_GPIO_NOMADIK_H */
+1 -1
drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
··· 474 474 #undef WPCM450_GRP 475 475 }; 476 476 477 - static struct pingroup wpcm450_groups[] = { 477 + static const struct pingroup wpcm450_groups[] = { 478 478 #define WPCM450_GRP(x) PINCTRL_PINGROUP(#x, x ## _pins, ARRAY_SIZE(x ## _pins)) 479 479 WPCM450_GRPS 480 480 #undef WPCM450_GRP
+1119
drivers/pinctrl/pinctrl-aw9523.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Awinic AW9523B i2c pin controller driver 4 + * Copyright (c) 2020, AngeloGioacchino Del Regno 5 + * <angelogioacchino.delregno@somainline.org> 6 + */ 7 + 8 + #include <linux/bitfield.h> 9 + #include <linux/gpio/consumer.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/i2c.h> 12 + #include <linux/init.h> 13 + #include <linux/interrupt.h> 14 + #include <linux/irq.h> 15 + #include <linux/mutex.h> 16 + #include <linux/module.h> 17 + #include <linux/pinctrl/pinconf.h> 18 + #include <linux/pinctrl/pinctrl.h> 19 + #include <linux/pinctrl/pinmux.h> 20 + #include <linux/pinctrl/pinconf-generic.h> 21 + #include <linux/property.h> 22 + #include <linux/regmap.h> 23 + #include <linux/regulator/consumer.h> 24 + #include <linux/slab.h> 25 + 26 + #define AW9523_MAX_FUNCS 2 27 + #define AW9523_NUM_PORTS 2 28 + #define AW9523_PINS_PER_PORT 8 29 + 30 + /* 31 + * HW needs at least 20uS for reset and at least 1-2uS to recover from 32 + * reset, but we have to account for eventual board quirks, if any: 33 + * for this reason, keep reset asserted for 50uS and wait for 20uS 34 + * to recover from the reset. 35 + */ 36 + #define AW9523_HW_RESET_US 50 37 + #define AW9523_HW_RESET_RECOVERY_US 20 38 + 39 + /* Port 0: P0_0...P0_7 - Port 1: P1_0...P1_7 */ 40 + #define AW9523_PIN_TO_PORT(pin) (pin >> 3) 41 + #define AW9523_REG_IN_STATE(pin) (0x00 + AW9523_PIN_TO_PORT(pin)) 42 + #define AW9523_REG_OUT_STATE(pin) (0x02 + AW9523_PIN_TO_PORT(pin)) 43 + #define AW9523_REG_CONF_STATE(pin) (0x04 + AW9523_PIN_TO_PORT(pin)) 44 + #define AW9523_REG_INTR_DIS(pin) (0x06 + AW9523_PIN_TO_PORT(pin)) 45 + #define AW9523_REG_CHIPID 0x10 46 + #define AW9523_VAL_EXPECTED_CHIPID 0x23 47 + 48 + #define AW9523_REG_GCR 0x11 49 + #define AW9523_GCR_ISEL_MASK GENMASK(0, 1) 50 + #define AW9523_GCR_GPOMD_MASK BIT(4) 51 + 52 + #define AW9523_REG_PORT_MODE(pin) (0x12 + AW9523_PIN_TO_PORT(pin)) 53 + #define AW9523_REG_SOFT_RESET 0x7f 54 + #define AW9523_VAL_RESET 0x00 55 + 56 + /* 57 + * struct aw9523_irq - Interrupt controller structure 58 + * @lock: mutex locking for the irq bus 59 + * @irqchip: structure holding irqchip params 60 + * @cached_gpio: stores the previous gpio status for bit comparison 61 + */ 62 + struct aw9523_irq { 63 + struct mutex lock; 64 + struct irq_chip *irqchip; 65 + u16 cached_gpio; 66 + }; 67 + 68 + /* 69 + * struct aw9523_pinmux - Pin mux params 70 + * @name: Name of the mux 71 + * @grps: Groups of the mux 72 + * @num_grps: Number of groups (sizeof array grps) 73 + */ 74 + struct aw9523_pinmux { 75 + const char *name; 76 + const char * const *grps; 77 + const u8 num_grps; 78 + }; 79 + 80 + /* 81 + * struct aw9523 - Main driver structure 82 + * @dev: device handle 83 + * @regmap: regmap handle for current device 84 + * @i2c_lock: Mutex lock for i2c operations 85 + * @reset_gpio: Hardware reset (RSTN) signal GPIO 86 + * @vio_vreg: VCC regulator (Optional) 87 + * @pctl: pinctrl handle for current device 88 + * @gpio: structure holding gpiochip params 89 + * @irq: Interrupt controller structure 90 + */ 91 + struct aw9523 { 92 + struct device *dev; 93 + struct regmap *regmap; 94 + struct mutex i2c_lock; 95 + struct gpio_desc *reset_gpio; 96 + struct regulator *vio_vreg; 97 + struct pinctrl_dev *pctl; 98 + struct gpio_chip gpio; 99 + struct aw9523_irq *irq; 100 + }; 101 + 102 + static const struct pinctrl_pin_desc aw9523_pins[] = { 103 + /* Port 0 */ 104 + PINCTRL_PIN(0, "gpio0"), 105 + PINCTRL_PIN(1, "gpio1"), 106 + PINCTRL_PIN(2, "gpio2"), 107 + PINCTRL_PIN(3, "gpio3"), 108 + PINCTRL_PIN(4, "gpio4"), 109 + PINCTRL_PIN(5, "gpio5"), 110 + PINCTRL_PIN(6, "gpio6"), 111 + PINCTRL_PIN(7, "gpio7"), 112 + 113 + /* Port 1 */ 114 + PINCTRL_PIN(8, "gpio8"), 115 + PINCTRL_PIN(9, "gpio9"), 116 + PINCTRL_PIN(10, "gpio10"), 117 + PINCTRL_PIN(11, "gpio11"), 118 + PINCTRL_PIN(12, "gpio12"), 119 + PINCTRL_PIN(13, "gpio13"), 120 + PINCTRL_PIN(14, "gpio14"), 121 + PINCTRL_PIN(15, "gpio15"), 122 + }; 123 + 124 + static int aw9523_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) 125 + { 126 + return ARRAY_SIZE(aw9523_pins); 127 + } 128 + 129 + static const char *aw9523_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 130 + unsigned int selector) 131 + { 132 + return aw9523_pins[selector].name; 133 + } 134 + 135 + static int aw9523_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 136 + unsigned int selector, 137 + const unsigned int **pins, 138 + unsigned int *num_pins) 139 + { 140 + *pins = &aw9523_pins[selector].number; 141 + *num_pins = 1; 142 + return 0; 143 + } 144 + 145 + static const struct pinctrl_ops aw9523_pinctrl_ops = { 146 + .get_groups_count = aw9523_pinctrl_get_groups_count, 147 + .get_group_pins = aw9523_pinctrl_get_group_pins, 148 + .get_group_name = aw9523_pinctrl_get_group_name, 149 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 150 + .dt_free_map = pinconf_generic_dt_free_map, 151 + }; 152 + 153 + static const char * const gpio_pwm_groups[] = { 154 + "gpio0", "gpio1", "gpio2", "gpio3", "gpio4", "gpio5", 155 + "gpio6", "gpio7", "gpio8", "gpio9", "gpio10", "gpio11", 156 + "gpio12", "gpio13", "gpio14", "gpio15" 157 + }; 158 + 159 + /* Warning: Do NOT reorder this array */ 160 + static const struct aw9523_pinmux aw9523_pmx[] = { 161 + { 162 + .name = "pwm", 163 + .grps = gpio_pwm_groups, 164 + .num_grps = ARRAY_SIZE(gpio_pwm_groups), 165 + }, 166 + { 167 + .name = "gpio", 168 + .grps = gpio_pwm_groups, 169 + .num_grps = ARRAY_SIZE(gpio_pwm_groups), 170 + }, 171 + }; 172 + 173 + static int aw9523_pmx_get_funcs_count(struct pinctrl_dev *pctl) 174 + { 175 + return ARRAY_SIZE(aw9523_pmx); 176 + } 177 + 178 + static const char *aw9523_pmx_get_fname(struct pinctrl_dev *pctl, 179 + unsigned int sel) 180 + { 181 + return aw9523_pmx[sel].name; 182 + } 183 + 184 + static int aw9523_pmx_get_groups(struct pinctrl_dev *pctl, unsigned int sel, 185 + const char * const **groups, 186 + unsigned int * const num_groups) 187 + { 188 + *groups = aw9523_pmx[sel].grps; 189 + *num_groups = aw9523_pmx[sel].num_grps; 190 + return 0; 191 + } 192 + 193 + static int aw9523_pmx_set_mux(struct pinctrl_dev *pctl, unsigned int fsel, 194 + unsigned int grp) 195 + { 196 + struct aw9523 *awi = pinctrl_dev_get_drvdata(pctl); 197 + int ret, pin = aw9523_pins[grp].number % AW9523_PINS_PER_PORT; 198 + 199 + if (fsel >= ARRAY_SIZE(aw9523_pmx)) 200 + return -EINVAL; 201 + 202 + /* 203 + * This maps directly to the aw9523_pmx array: programming a 204 + * high bit means "gpio" and a low bit means "pwm". 205 + */ 206 + mutex_lock(&awi->i2c_lock); 207 + ret = regmap_update_bits(awi->regmap, AW9523_REG_PORT_MODE(pin), 208 + BIT(pin), (fsel ? BIT(pin) : 0)); 209 + mutex_unlock(&awi->i2c_lock); 210 + return ret; 211 + } 212 + 213 + static const struct pinmux_ops aw9523_pinmux_ops = { 214 + .get_functions_count = aw9523_pmx_get_funcs_count, 215 + .get_function_name = aw9523_pmx_get_fname, 216 + .get_function_groups = aw9523_pmx_get_groups, 217 + .set_mux = aw9523_pmx_set_mux, 218 + }; 219 + 220 + static int aw9523_pcfg_param_to_reg(enum pin_config_param pcp, int pin, u8 *r) 221 + { 222 + u8 reg; 223 + 224 + switch (pcp) { 225 + case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: 226 + case PIN_CONFIG_BIAS_PULL_DOWN: 227 + case PIN_CONFIG_BIAS_PULL_UP: 228 + reg = AW9523_REG_IN_STATE(pin); 229 + break; 230 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 231 + case PIN_CONFIG_DRIVE_PUSH_PULL: 232 + reg = AW9523_REG_GCR; 233 + break; 234 + case PIN_CONFIG_INPUT_ENABLE: 235 + case PIN_CONFIG_OUTPUT_ENABLE: 236 + reg = AW9523_REG_CONF_STATE(pin); 237 + break; 238 + case PIN_CONFIG_OUTPUT: 239 + reg = AW9523_REG_OUT_STATE(pin); 240 + break; 241 + default: 242 + return -EOPNOTSUPP; 243 + } 244 + *r = reg; 245 + 246 + return 0; 247 + } 248 + 249 + static int aw9523_pconf_get(struct pinctrl_dev *pctldev, unsigned int pin, 250 + unsigned long *config) 251 + { 252 + struct aw9523 *awi = pinctrl_dev_get_drvdata(pctldev); 253 + enum pin_config_param param = pinconf_to_config_param(*config); 254 + int regbit = pin % AW9523_PINS_PER_PORT; 255 + unsigned int val; 256 + u8 reg; 257 + int rc; 258 + 259 + rc = aw9523_pcfg_param_to_reg(param, pin, &reg); 260 + if (rc) 261 + return rc; 262 + 263 + mutex_lock(&awi->i2c_lock); 264 + rc = regmap_read(awi->regmap, reg, &val); 265 + mutex_unlock(&awi->i2c_lock); 266 + if (rc) 267 + return rc; 268 + 269 + switch (param) { 270 + case PIN_CONFIG_BIAS_PULL_UP: 271 + case PIN_CONFIG_INPUT_ENABLE: 272 + case PIN_CONFIG_OUTPUT: 273 + val &= BIT(regbit); 274 + break; 275 + case PIN_CONFIG_BIAS_PULL_DOWN: 276 + case PIN_CONFIG_OUTPUT_ENABLE: 277 + val &= BIT(regbit); 278 + val = !val; 279 + break; 280 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 281 + if (pin >= AW9523_PINS_PER_PORT) 282 + val = 0; 283 + else 284 + val = !FIELD_GET(AW9523_GCR_GPOMD_MASK, val); 285 + break; 286 + case PIN_CONFIG_DRIVE_PUSH_PULL: 287 + if (pin >= AW9523_PINS_PER_PORT) 288 + val = 1; 289 + else 290 + val = FIELD_GET(AW9523_GCR_GPOMD_MASK, val); 291 + break; 292 + default: 293 + return -EOPNOTSUPP; 294 + } 295 + if (val < 1) 296 + return -EINVAL; 297 + 298 + *config = pinconf_to_config_packed(param, !!val); 299 + 300 + return rc; 301 + } 302 + 303 + static int aw9523_pconf_set(struct pinctrl_dev *pctldev, unsigned int pin, 304 + unsigned long *configs, unsigned int num_configs) 305 + { 306 + struct aw9523 *awi = pinctrl_dev_get_drvdata(pctldev); 307 + enum pin_config_param param; 308 + int regbit = pin % AW9523_PINS_PER_PORT; 309 + u32 arg; 310 + u8 reg; 311 + unsigned int mask, val; 312 + int i, rc; 313 + 314 + mutex_lock(&awi->i2c_lock); 315 + for (i = 0; i < num_configs; i++) { 316 + param = pinconf_to_config_param(configs[i]); 317 + arg = pinconf_to_config_argument(configs[i]); 318 + 319 + rc = aw9523_pcfg_param_to_reg(param, pin, &reg); 320 + if (rc) 321 + goto end; 322 + 323 + switch (param) { 324 + case PIN_CONFIG_OUTPUT: 325 + /* First, enable pin output */ 326 + rc = regmap_update_bits(awi->regmap, 327 + AW9523_REG_CONF_STATE(pin), 328 + BIT(regbit), 0); 329 + if (rc) 330 + goto end; 331 + 332 + /* Then, fall through to config output level */ 333 + fallthrough; 334 + case PIN_CONFIG_OUTPUT_ENABLE: 335 + arg = !arg; 336 + fallthrough; 337 + case PIN_CONFIG_BIAS_PULL_PIN_DEFAULT: 338 + case PIN_CONFIG_BIAS_PULL_DOWN: 339 + case PIN_CONFIG_BIAS_PULL_UP: 340 + case PIN_CONFIG_INPUT_ENABLE: 341 + mask = BIT(regbit); 342 + val = arg ? BIT(regbit) : 0; 343 + break; 344 + case PIN_CONFIG_DRIVE_OPEN_DRAIN: 345 + /* Open-Drain is supported only on port 0 */ 346 + if (pin >= AW9523_PINS_PER_PORT) { 347 + rc = -EOPNOTSUPP; 348 + goto end; 349 + } 350 + mask = AW9523_GCR_GPOMD_MASK; 351 + val = 0; 352 + break; 353 + case PIN_CONFIG_DRIVE_PUSH_PULL: 354 + /* Port 1 is always Push-Pull */ 355 + if (pin >= AW9523_PINS_PER_PORT) { 356 + mask = 0; 357 + val = 0; 358 + continue; 359 + } 360 + mask = AW9523_GCR_GPOMD_MASK; 361 + val = AW9523_GCR_GPOMD_MASK; 362 + break; 363 + default: 364 + rc = -EOPNOTSUPP; 365 + goto end; 366 + } 367 + 368 + rc = regmap_update_bits(awi->regmap, reg, mask, val); 369 + if (rc) 370 + goto end; 371 + } 372 + end: 373 + mutex_unlock(&awi->i2c_lock); 374 + return rc; 375 + } 376 + 377 + static const struct pinconf_ops aw9523_pinconf_ops = { 378 + .pin_config_get = aw9523_pconf_get, 379 + .pin_config_set = aw9523_pconf_set, 380 + .is_generic = true, 381 + }; 382 + 383 + /* 384 + * aw9523_get_pin_direction - Get pin direction 385 + * @regmap: Regmap structure 386 + * @pin: gpiolib pin number 387 + * @n: pin index in port register 388 + * 389 + * Return: Pin direction for success or negative number for error 390 + */ 391 + static int aw9523_get_pin_direction(struct regmap *regmap, u8 pin, u8 n) 392 + { 393 + int ret; 394 + 395 + ret = regmap_test_bits(regmap, AW9523_REG_CONF_STATE(pin), BIT(n)); 396 + if (ret < 0) 397 + return ret; 398 + 399 + return ret ? GPIO_LINE_DIRECTION_IN : GPIO_LINE_DIRECTION_OUT; 400 + } 401 + 402 + /* 403 + * aw9523_get_port_state - Get input or output state for entire port 404 + * @regmap: Regmap structure 405 + * @pin: gpiolib pin number 406 + * @regbit: hw pin index, used to retrieve port number 407 + * @state: returned port state 408 + * 409 + * Return: Zero for success or negative number for error 410 + */ 411 + static int aw9523_get_port_state(struct regmap *regmap, u8 pin, 412 + u8 regbit, unsigned int *state) 413 + { 414 + u8 reg; 415 + int dir; 416 + 417 + dir = aw9523_get_pin_direction(regmap, pin, regbit); 418 + if (dir < 0) 419 + return dir; 420 + 421 + if (dir == GPIO_LINE_DIRECTION_IN) 422 + reg = AW9523_REG_IN_STATE(pin); 423 + else 424 + reg = AW9523_REG_OUT_STATE(pin); 425 + 426 + return regmap_read(regmap, reg, state); 427 + } 428 + 429 + static int aw9523_gpio_irq_type(struct irq_data *d, unsigned int type) 430 + { 431 + switch (type) { 432 + case IRQ_TYPE_NONE: 433 + case IRQ_TYPE_EDGE_BOTH: 434 + return 0; 435 + default: 436 + return -EINVAL; 437 + }; 438 + } 439 + 440 + /* 441 + * aw9523_irq_mask - Mask interrupt 442 + * @d: irq data 443 + * 444 + * Sets which interrupt to mask in the bitmap; 445 + * The interrupt will be masked when unlocking the irq bus. 446 + */ 447 + static void aw9523_irq_mask(struct irq_data *d) 448 + { 449 + struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 450 + unsigned int n = d->hwirq % AW9523_PINS_PER_PORT; 451 + 452 + regmap_update_bits(awi->regmap, 453 + AW9523_REG_INTR_DIS(d->hwirq), 454 + BIT(n), BIT(n)); 455 + gpiochip_disable_irq(&awi->gpio, irqd_to_hwirq(d)); 456 + } 457 + 458 + /* 459 + * aw9523_irq_unmask - Unmask interrupt 460 + * @d: irq data 461 + * 462 + * Sets which interrupt to unmask in the bitmap; 463 + * The interrupt will be masked when unlocking the irq bus. 464 + */ 465 + static void aw9523_irq_unmask(struct irq_data *d) 466 + { 467 + struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 468 + unsigned int n = d->hwirq % AW9523_PINS_PER_PORT; 469 + 470 + gpiochip_enable_irq(&awi->gpio, irqd_to_hwirq(d)); 471 + regmap_update_bits(awi->regmap, 472 + AW9523_REG_INTR_DIS(d->hwirq), 473 + BIT(n), 0); 474 + } 475 + 476 + static irqreturn_t aw9523_irq_thread_func(int irq, void *dev_id) 477 + { 478 + struct aw9523 *awi = (struct aw9523 *)dev_id; 479 + unsigned long n, val = 0; 480 + unsigned long changed_gpio; 481 + unsigned int tmp, port_pin, i, ret; 482 + 483 + for (i = 0; i < AW9523_NUM_PORTS; i++) { 484 + port_pin = i * AW9523_PINS_PER_PORT; 485 + ret = regmap_read(awi->regmap, 486 + AW9523_REG_IN_STATE(port_pin), 487 + &tmp); 488 + if (ret) 489 + return ret; 490 + val |= (u8)tmp << (i * 8); 491 + } 492 + 493 + /* Handle GPIO input release interrupt as well */ 494 + changed_gpio = awi->irq->cached_gpio ^ val; 495 + awi->irq->cached_gpio = val; 496 + 497 + /* 498 + * To avoid up to four *slow* i2c reads from any driver hooked 499 + * up to our interrupts, just check for the irq_find_mapping 500 + * result: if the interrupt is not mapped, then we don't want 501 + * to care about it. 502 + */ 503 + for_each_set_bit(n, &changed_gpio, awi->gpio.ngpio) { 504 + tmp = irq_find_mapping(awi->gpio.irq.domain, n); 505 + if (tmp <= 0) 506 + continue; 507 + handle_nested_irq(tmp); 508 + } 509 + 510 + return IRQ_HANDLED; 511 + } 512 + 513 + /* 514 + * aw9523_irq_bus_lock - Grab lock for interrupt operation 515 + * @d: irq data 516 + */ 517 + static void aw9523_irq_bus_lock(struct irq_data *d) 518 + { 519 + struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 520 + 521 + mutex_lock(&awi->irq->lock); 522 + regcache_cache_only(awi->regmap, true); 523 + } 524 + 525 + /* 526 + * aw9523_irq_bus_sync_unlock - Synchronize state and unlock 527 + * @d: irq data 528 + * 529 + * Writes the interrupt mask bits (found in the bit map) to the 530 + * hardware, then unlocks the bus. 531 + */ 532 + static void aw9523_irq_bus_sync_unlock(struct irq_data *d) 533 + { 534 + struct aw9523 *awi = gpiochip_get_data(irq_data_get_irq_chip_data(d)); 535 + 536 + regcache_cache_only(awi->regmap, false); 537 + regcache_sync(awi->regmap); 538 + mutex_unlock(&awi->irq->lock); 539 + } 540 + 541 + static int aw9523_gpio_get_direction(struct gpio_chip *chip, 542 + unsigned int offset) 543 + { 544 + struct aw9523 *awi = gpiochip_get_data(chip); 545 + u8 regbit = offset % AW9523_PINS_PER_PORT; 546 + int ret; 547 + 548 + mutex_lock(&awi->i2c_lock); 549 + ret = aw9523_get_pin_direction(awi->regmap, offset, regbit); 550 + mutex_unlock(&awi->i2c_lock); 551 + 552 + return ret; 553 + } 554 + 555 + static int aw9523_gpio_get(struct gpio_chip *chip, unsigned int offset) 556 + { 557 + struct aw9523 *awi = gpiochip_get_data(chip); 558 + u8 regbit = offset % AW9523_PINS_PER_PORT; 559 + unsigned int val; 560 + int ret; 561 + 562 + mutex_lock(&awi->i2c_lock); 563 + ret = aw9523_get_port_state(awi->regmap, offset, regbit, &val); 564 + mutex_unlock(&awi->i2c_lock); 565 + if (ret) 566 + return ret; 567 + 568 + return !!(val & BIT(regbit)); 569 + } 570 + 571 + /** 572 + * _aw9523_gpio_get_multiple - Get I/O state for an entire port 573 + * @regmap: Regmap structure 574 + * @pin: gpiolib pin number 575 + * @regbit: hw pin index, used to retrieve port number 576 + * @state: returned port I/O state 577 + * 578 + * Return: Zero for success or negative number for error 579 + */ 580 + static int _aw9523_gpio_get_multiple(struct aw9523 *awi, u8 regbit, 581 + u8 *state, u8 mask) 582 + { 583 + u32 dir_in, val; 584 + u8 m; 585 + int ret; 586 + 587 + /* Registers are 8-bits wide */ 588 + ret = regmap_read(awi->regmap, AW9523_REG_CONF_STATE(regbit), &dir_in); 589 + if (ret) 590 + return ret; 591 + *state = 0; 592 + 593 + m = mask & dir_in; 594 + if (m) { 595 + ret = regmap_read(awi->regmap, AW9523_REG_IN_STATE(regbit), 596 + &val); 597 + if (ret) 598 + return ret; 599 + *state |= (u8)val & m; 600 + } 601 + 602 + m = mask & ~dir_in; 603 + if (m) { 604 + ret = regmap_read(awi->regmap, AW9523_REG_OUT_STATE(regbit), 605 + &val); 606 + if (ret) 607 + return ret; 608 + *state |= (u8)val & m; 609 + } 610 + 611 + return 0; 612 + } 613 + 614 + static int aw9523_gpio_get_multiple(struct gpio_chip *chip, 615 + unsigned long *mask, 616 + unsigned long *bits) 617 + { 618 + struct aw9523 *awi = gpiochip_get_data(chip); 619 + u8 m, state = 0; 620 + int ret; 621 + 622 + mutex_lock(&awi->i2c_lock); 623 + 624 + /* Port 0 (gpio 0-7) */ 625 + m = *mask & U8_MAX; 626 + if (m) { 627 + ret = _aw9523_gpio_get_multiple(awi, 0, &state, m); 628 + if (ret) 629 + goto out; 630 + } 631 + *bits = state; 632 + 633 + /* Port 1 (gpio 8-15) */ 634 + m = (*mask >> 8) & U8_MAX; 635 + if (m) { 636 + ret = _aw9523_gpio_get_multiple(awi, AW9523_PINS_PER_PORT, 637 + &state, m); 638 + if (ret) 639 + goto out; 640 + 641 + *bits |= (state << 8); 642 + } 643 + out: 644 + mutex_unlock(&awi->i2c_lock); 645 + return ret; 646 + } 647 + 648 + static void aw9523_gpio_set_multiple(struct gpio_chip *chip, 649 + unsigned long *mask, 650 + unsigned long *bits) 651 + { 652 + struct aw9523 *awi = gpiochip_get_data(chip); 653 + u8 mask_lo, mask_hi, bits_lo, bits_hi; 654 + unsigned int reg; 655 + int ret = 0; 656 + 657 + mask_lo = *mask & U8_MAX; 658 + mask_hi = (*mask >> 8) & U8_MAX; 659 + mutex_lock(&awi->i2c_lock); 660 + if (mask_hi) { 661 + reg = AW9523_REG_OUT_STATE(AW9523_PINS_PER_PORT); 662 + bits_hi = (*bits >> 8) & U8_MAX; 663 + 664 + ret = regmap_write_bits(awi->regmap, reg, mask_hi, bits_hi); 665 + if (ret) { 666 + dev_warn(awi->dev, "Cannot write port1 out level\n"); 667 + goto out; 668 + } 669 + } 670 + if (mask_lo) { 671 + reg = AW9523_REG_OUT_STATE(0); 672 + bits_lo = *bits & U8_MAX; 673 + ret = regmap_write_bits(awi->regmap, reg, mask_lo, bits_lo); 674 + if (ret) 675 + dev_warn(awi->dev, "Cannot write port0 out level\n"); 676 + } 677 + out: 678 + mutex_unlock(&awi->i2c_lock); 679 + } 680 + 681 + static void aw9523_gpio_set(struct gpio_chip *chip, 682 + unsigned int offset, int value) 683 + { 684 + struct aw9523 *awi = gpiochip_get_data(chip); 685 + u8 regbit = offset % AW9523_PINS_PER_PORT; 686 + 687 + mutex_lock(&awi->i2c_lock); 688 + regmap_update_bits(awi->regmap, AW9523_REG_OUT_STATE(offset), 689 + BIT(regbit), value ? BIT(regbit) : 0); 690 + mutex_unlock(&awi->i2c_lock); 691 + } 692 + 693 + 694 + static int aw9523_direction_input(struct gpio_chip *chip, unsigned int offset) 695 + { 696 + struct aw9523 *awi = gpiochip_get_data(chip); 697 + u8 regbit = offset % AW9523_PINS_PER_PORT; 698 + int ret; 699 + 700 + mutex_lock(&awi->i2c_lock); 701 + ret = regmap_update_bits(awi->regmap, AW9523_REG_CONF_STATE(offset), 702 + BIT(regbit), BIT(regbit)); 703 + mutex_unlock(&awi->i2c_lock); 704 + 705 + return ret; 706 + } 707 + 708 + static int aw9523_direction_output(struct gpio_chip *chip, 709 + unsigned int offset, int value) 710 + { 711 + struct aw9523 *awi = gpiochip_get_data(chip); 712 + u8 regbit = offset % AW9523_PINS_PER_PORT; 713 + int ret; 714 + 715 + mutex_lock(&awi->i2c_lock); 716 + ret = regmap_update_bits(awi->regmap, AW9523_REG_OUT_STATE(offset), 717 + BIT(regbit), value ? BIT(regbit) : 0); 718 + if (ret) 719 + goto end; 720 + 721 + ret = regmap_update_bits(awi->regmap, AW9523_REG_CONF_STATE(offset), 722 + BIT(regbit), 0); 723 + end: 724 + mutex_unlock(&awi->i2c_lock); 725 + return ret; 726 + } 727 + 728 + static int aw9523_drive_reset_gpio(struct aw9523 *awi) 729 + { 730 + unsigned int chip_id; 731 + int ret; 732 + 733 + /* 734 + * If the chip is already configured for any reason, then we 735 + * will probably succeed in sending the soft reset signal to 736 + * the hardware through I2C: this operation takes less time 737 + * compared to a full HW reset and it gives the same results. 738 + */ 739 + ret = regmap_write(awi->regmap, AW9523_REG_SOFT_RESET, 0); 740 + if (ret == 0) 741 + goto done; 742 + 743 + dev_dbg(awi->dev, "Cannot execute soft reset: trying hard reset\n"); 744 + ret = gpiod_direction_output(awi->reset_gpio, 0); 745 + if (ret) 746 + return ret; 747 + 748 + /* The reset pulse has to be longer than 20uS due to deglitch */ 749 + usleep_range(AW9523_HW_RESET_US, AW9523_HW_RESET_US + 1); 750 + 751 + ret = gpiod_direction_output(awi->reset_gpio, 1); 752 + if (ret) 753 + return ret; 754 + done: 755 + /* The HW needs at least 1uS to reliably recover after reset */ 756 + usleep_range(AW9523_HW_RESET_RECOVERY_US, 757 + AW9523_HW_RESET_RECOVERY_US + 1); 758 + 759 + /* Check the ChipID */ 760 + ret = regmap_read(awi->regmap, AW9523_REG_CHIPID, &chip_id); 761 + if (ret) { 762 + dev_err(awi->dev, "Cannot read Chip ID: %d\n", ret); 763 + return ret; 764 + } 765 + if (chip_id != AW9523_VAL_EXPECTED_CHIPID) { 766 + dev_err(awi->dev, "Bad ChipID; read 0x%x, expected 0x%x\n", 767 + chip_id, AW9523_VAL_EXPECTED_CHIPID); 768 + return -EINVAL; 769 + } 770 + 771 + return 0; 772 + } 773 + 774 + static int aw9523_hw_reset(struct aw9523 *awi) 775 + { 776 + int ret, max_retries = 2; 777 + 778 + /* Sometimes the chip needs more than one reset cycle */ 779 + do { 780 + ret = aw9523_drive_reset_gpio(awi); 781 + if (ret == 0) 782 + break; 783 + max_retries--; 784 + } while (max_retries); 785 + 786 + return ret; 787 + } 788 + 789 + static int aw9523_init_gpiochip(struct aw9523 *awi, unsigned int npins) 790 + { 791 + struct device *dev = awi->dev; 792 + struct gpio_chip *gc = &awi->gpio; 793 + 794 + gc->label = devm_kstrdup(dev, dev_name(dev), GFP_KERNEL); 795 + if (!gc->label) 796 + return -ENOMEM; 797 + 798 + gc->base = -1; 799 + gc->ngpio = npins; 800 + gc->get_direction = aw9523_gpio_get_direction; 801 + gc->direction_input = aw9523_direction_input; 802 + gc->direction_output = aw9523_direction_output; 803 + gc->get = aw9523_gpio_get; 804 + gc->get_multiple = aw9523_gpio_get_multiple; 805 + gc->set = aw9523_gpio_set; 806 + gc->set_multiple = aw9523_gpio_set_multiple; 807 + gc->set_config = gpiochip_generic_config; 808 + gc->parent = dev; 809 + gc->owner = THIS_MODULE; 810 + gc->can_sleep = false; 811 + 812 + return 0; 813 + } 814 + 815 + static const struct irq_chip aw9523_irq_chip = { 816 + .name = "aw9523", 817 + .irq_mask = aw9523_irq_mask, 818 + .irq_unmask = aw9523_irq_unmask, 819 + .irq_bus_lock = aw9523_irq_bus_lock, 820 + .irq_bus_sync_unlock = aw9523_irq_bus_sync_unlock, 821 + .irq_set_type = aw9523_gpio_irq_type, 822 + .flags = IRQCHIP_IMMUTABLE, 823 + GPIOCHIP_IRQ_RESOURCE_HELPERS, 824 + }; 825 + 826 + static int aw9523_init_irq(struct aw9523 *awi, int irq) 827 + { 828 + struct device *dev = awi->dev; 829 + struct gpio_irq_chip *girq; 830 + struct irq_chip *irqchip; 831 + int ret; 832 + 833 + if (!device_property_read_bool(dev, "interrupt-controller")) 834 + return 0; 835 + 836 + irqchip = devm_kzalloc(dev, sizeof(*irqchip), GFP_KERNEL); 837 + if (!irqchip) 838 + return -ENOMEM; 839 + 840 + awi->irq = devm_kzalloc(dev, sizeof(*awi->irq), GFP_KERNEL); 841 + if (!awi->irq) 842 + return -ENOMEM; 843 + 844 + awi->irq->irqchip = irqchip; 845 + mutex_init(&awi->irq->lock); 846 + 847 + ret = devm_request_threaded_irq(dev, irq, NULL, aw9523_irq_thread_func, 848 + IRQF_ONESHOT, dev_name(dev), awi); 849 + if (ret) { 850 + dev_err(dev, "Failed to request irq %d\n", irq); 851 + return ret; 852 + } 853 + 854 + girq = &awi->gpio.irq; 855 + gpio_irq_chip_set_chip(girq, &aw9523_irq_chip); 856 + girq->parent_handler = NULL; 857 + girq->num_parents = 0; 858 + girq->parents = NULL; 859 + girq->default_type = IRQ_TYPE_EDGE_BOTH; 860 + girq->handler = handle_simple_irq; 861 + girq->threaded = true; 862 + 863 + return 0; 864 + } 865 + 866 + static bool aw9523_is_reg_hole(unsigned int reg) 867 + { 868 + return (reg > AW9523_REG_PORT_MODE(AW9523_PINS_PER_PORT) && 869 + reg < AW9523_REG_SOFT_RESET) || 870 + (reg > AW9523_REG_INTR_DIS(AW9523_PINS_PER_PORT) && 871 + reg < AW9523_REG_CHIPID); 872 + } 873 + 874 + static bool aw9523_readable_reg(struct device *dev, unsigned int reg) 875 + { 876 + /* All available registers (minus holes) can be read */ 877 + return !aw9523_is_reg_hole(reg); 878 + } 879 + 880 + static bool aw9523_volatile_reg(struct device *dev, unsigned int reg) 881 + { 882 + return aw9523_is_reg_hole(reg) || 883 + reg == AW9523_REG_IN_STATE(0) || 884 + reg == AW9523_REG_IN_STATE(AW9523_PINS_PER_PORT) || 885 + reg == AW9523_REG_CHIPID || 886 + reg == AW9523_REG_SOFT_RESET; 887 + } 888 + 889 + static bool aw9523_writeable_reg(struct device *dev, unsigned int reg) 890 + { 891 + return !aw9523_is_reg_hole(reg) && reg != AW9523_REG_CHIPID; 892 + } 893 + 894 + static bool aw9523_precious_reg(struct device *dev, unsigned int reg) 895 + { 896 + /* Reading AW9523_REG_IN_STATE clears interrupt status */ 897 + return aw9523_is_reg_hole(reg) || 898 + reg == AW9523_REG_IN_STATE(0) || 899 + reg == AW9523_REG_IN_STATE(AW9523_PINS_PER_PORT); 900 + } 901 + 902 + static const struct regmap_config aw9523_regmap = { 903 + .reg_bits = 8, 904 + .val_bits = 8, 905 + .reg_stride = 1, 906 + 907 + .precious_reg = aw9523_precious_reg, 908 + .readable_reg = aw9523_readable_reg, 909 + .volatile_reg = aw9523_volatile_reg, 910 + .writeable_reg = aw9523_writeable_reg, 911 + 912 + .cache_type = REGCACHE_FLAT, 913 + .disable_locking = true, 914 + 915 + .num_reg_defaults_raw = AW9523_REG_SOFT_RESET, 916 + }; 917 + 918 + static int aw9523_hw_init(struct aw9523 *awi) 919 + { 920 + u8 p1_pin = AW9523_PINS_PER_PORT; 921 + unsigned int val; 922 + int ret; 923 + 924 + /* No register caching during initialization */ 925 + regcache_cache_bypass(awi->regmap, true); 926 + 927 + /* Bring up the chip */ 928 + ret = aw9523_hw_reset(awi); 929 + if (ret) { 930 + dev_err(awi->dev, "HW Reset failed: %d\n", ret); 931 + return ret; 932 + } 933 + 934 + /* 935 + * This is the expected chip and it is running: it's time to 936 + * set a safe default configuration in case the user doesn't 937 + * configure (all of the available) pins in this chip. 938 + * P.S.: The writes order doesn't matter. 939 + */ 940 + 941 + /* Set all pins as GPIO */ 942 + ret = regmap_write(awi->regmap, AW9523_REG_PORT_MODE(0), U8_MAX); 943 + if (ret) 944 + return ret; 945 + ret = regmap_write(awi->regmap, AW9523_REG_PORT_MODE(p1_pin), U8_MAX); 946 + if (ret) 947 + return ret; 948 + 949 + /* Set Open-Drain mode on Port 0 (Port 1 is always P-P) */ 950 + ret = regmap_write(awi->regmap, AW9523_REG_GCR, 0); 951 + if (ret) 952 + return ret; 953 + 954 + /* Set all pins as inputs */ 955 + ret = regmap_write(awi->regmap, AW9523_REG_CONF_STATE(0), U8_MAX); 956 + if (ret) 957 + return ret; 958 + ret = regmap_write(awi->regmap, AW9523_REG_CONF_STATE(p1_pin), U8_MAX); 959 + if (ret) 960 + return ret; 961 + 962 + /* Disable all interrupts to avoid unreasoned wakeups */ 963 + ret = regmap_write(awi->regmap, AW9523_REG_INTR_DIS(0), U8_MAX); 964 + if (ret) 965 + return ret; 966 + ret = regmap_write(awi->regmap, AW9523_REG_INTR_DIS(p1_pin), U8_MAX); 967 + if (ret) 968 + return ret; 969 + 970 + /* Clear setup-generated interrupts by performing a port state read */ 971 + ret = aw9523_get_port_state(awi->regmap, 0, 0, &val); 972 + if (ret) 973 + return ret; 974 + ret = aw9523_get_port_state(awi->regmap, p1_pin, 0, &val); 975 + if (ret) 976 + return ret; 977 + 978 + /* Everything went fine: activate and reinitialize register cache */ 979 + regcache_cache_bypass(awi->regmap, false); 980 + return regmap_reinit_cache(awi->regmap, &aw9523_regmap); 981 + } 982 + 983 + static int aw9523_probe(struct i2c_client *client) 984 + { 985 + struct device *dev = &client->dev; 986 + struct pinctrl_desc *pdesc; 987 + struct aw9523 *awi; 988 + int ret; 989 + 990 + awi = devm_kzalloc(dev, sizeof(*awi), GFP_KERNEL); 991 + if (!awi) 992 + return -ENOMEM; 993 + 994 + i2c_set_clientdata(client, awi); 995 + 996 + awi->dev = dev; 997 + awi->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); 998 + if (IS_ERR(awi->reset_gpio)) 999 + return PTR_ERR(awi->reset_gpio); 1000 + gpiod_set_consumer_name(awi->reset_gpio, "aw9523 reset"); 1001 + 1002 + awi->regmap = devm_regmap_init_i2c(client, &aw9523_regmap); 1003 + if (IS_ERR(awi->regmap)) 1004 + return PTR_ERR(awi->regmap); 1005 + 1006 + awi->vio_vreg = devm_regulator_get_optional(dev, "vio"); 1007 + if (IS_ERR(awi->vio_vreg)) { 1008 + if (PTR_ERR(awi->vio_vreg) == -EPROBE_DEFER) 1009 + return -EPROBE_DEFER; 1010 + awi->vio_vreg = NULL; 1011 + } else { 1012 + ret = regulator_enable(awi->vio_vreg); 1013 + if (ret) 1014 + return ret; 1015 + } 1016 + 1017 + mutex_init(&awi->i2c_lock); 1018 + lockdep_set_subclass(&awi->i2c_lock, 1019 + i2c_adapter_depth(client->adapter)); 1020 + 1021 + pdesc = devm_kzalloc(dev, sizeof(*pdesc), GFP_KERNEL); 1022 + if (!pdesc) 1023 + return -ENOMEM; 1024 + 1025 + ret = aw9523_hw_init(awi); 1026 + if (ret) 1027 + goto err_disable_vregs; 1028 + 1029 + pdesc->name = dev_name(dev); 1030 + pdesc->owner = THIS_MODULE; 1031 + pdesc->pctlops = &aw9523_pinctrl_ops; 1032 + pdesc->pmxops = &aw9523_pinmux_ops; 1033 + pdesc->confops = &aw9523_pinconf_ops; 1034 + pdesc->pins = aw9523_pins; 1035 + pdesc->npins = ARRAY_SIZE(aw9523_pins); 1036 + 1037 + ret = aw9523_init_gpiochip(awi, pdesc->npins); 1038 + if (ret) 1039 + goto err_disable_vregs; 1040 + 1041 + if (client->irq) { 1042 + ret = aw9523_init_irq(awi, client->irq); 1043 + if (ret) 1044 + goto err_disable_vregs; 1045 + } 1046 + 1047 + awi->pctl = devm_pinctrl_register(dev, pdesc, awi); 1048 + if (IS_ERR(awi->pctl)) { 1049 + ret = PTR_ERR(awi->pctl); 1050 + dev_err(dev, "Cannot register pinctrl: %d", ret); 1051 + goto err_disable_vregs; 1052 + } 1053 + 1054 + ret = devm_gpiochip_add_data(dev, &awi->gpio, awi); 1055 + if (ret) 1056 + goto err_disable_vregs; 1057 + 1058 + return ret; 1059 + 1060 + err_disable_vregs: 1061 + if (awi->vio_vreg) 1062 + regulator_disable(awi->vio_vreg); 1063 + mutex_destroy(&awi->i2c_lock); 1064 + return ret; 1065 + } 1066 + 1067 + static void aw9523_remove(struct i2c_client *client) 1068 + { 1069 + struct aw9523 *awi = i2c_get_clientdata(client); 1070 + int ret; 1071 + 1072 + if (!awi) 1073 + return; 1074 + 1075 + /* 1076 + * If the chip VIO is connected to a regulator that we can turn 1077 + * off, life is easy... otherwise, reinitialize the chip and 1078 + * set the pins to hardware defaults before removing the driver 1079 + * to leave it in a clean, safe and predictable state. 1080 + */ 1081 + if (awi->vio_vreg) { 1082 + regulator_disable(awi->vio_vreg); 1083 + } else { 1084 + mutex_lock(&awi->i2c_lock); 1085 + ret = aw9523_hw_init(awi); 1086 + mutex_unlock(&awi->i2c_lock); 1087 + if (ret) 1088 + return; 1089 + } 1090 + 1091 + mutex_destroy(&awi->i2c_lock); 1092 + } 1093 + 1094 + static const struct i2c_device_id aw9523_i2c_id_table[] = { 1095 + { "aw9523_i2c", 0 }, 1096 + { } 1097 + }; 1098 + MODULE_DEVICE_TABLE(i2c, aw9523_i2c_id_table); 1099 + 1100 + static const struct of_device_id of_aw9523_i2c_match[] = { 1101 + { .compatible = "awinic,aw9523-pinctrl", }, 1102 + { } 1103 + }; 1104 + MODULE_DEVICE_TABLE(of, of_aw9523_i2c_match); 1105 + 1106 + static struct i2c_driver aw9523_driver = { 1107 + .driver = { 1108 + .name = "aw9523-pinctrl", 1109 + .of_match_table = of_aw9523_i2c_match, 1110 + }, 1111 + .probe = aw9523_probe, 1112 + .remove = aw9523_remove, 1113 + .id_table = aw9523_i2c_id_table, 1114 + }; 1115 + module_i2c_driver(aw9523_driver); 1116 + 1117 + MODULE_DESCRIPTION("Awinic AW9523 I2C GPIO Expander driver"); 1118 + MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>"); 1119 + MODULE_LICENSE("GPL v2");
+7
drivers/pinctrl/pinctrl-da9062.c
··· 281 281 return devm_gpiochip_add_data(&pdev->dev, &pctl->gc, pctl); 282 282 } 283 283 284 + static const struct of_device_id da9062_compatible_reg_id_table[] = { 285 + { .compatible = "dlg,da9062-gpio" }, 286 + { } 287 + }; 288 + MODULE_DEVICE_TABLE(of, da9062_compatible_reg_id_table); 289 + 284 290 static struct platform_driver da9062_pctl_driver = { 285 291 .probe = da9062_pctl_probe, 286 292 .driver = { 287 293 .name = "da9062-gpio", 294 + .of_match_table = da9062_compatible_reg_id_table, 288 295 }, 289 296 }; 290 297 module_platform_driver(da9062_pctl_driver);
+11 -4
drivers/pinctrl/pinctrl-mcp23s08.c
··· 375 375 static irqreturn_t mcp23s08_irq(int irq, void *data) 376 376 { 377 377 struct mcp23s08 *mcp = data; 378 - int intcap, intcon, intf, i, gpio, gpio_orig, intcap_mask, defval; 378 + int intcap, intcon, intf, i, gpio, gpio_orig, intcap_mask, defval, gpinten; 379 + unsigned long int enabled_interrupts; 379 380 unsigned int child_irq; 380 381 bool intf_set, intcap_changed, gpio_bit_changed, 381 382 defval_changed, gpio_set; ··· 396 395 if (mcp_read(mcp, MCP_INTCON, &intcon)) 397 396 goto unlock; 398 397 398 + if (mcp_read(mcp, MCP_GPINTEN, &gpinten)) 399 + goto unlock; 400 + 399 401 if (mcp_read(mcp, MCP_DEFVAL, &defval)) 400 402 goto unlock; 401 403 ··· 414 410 "intcap 0x%04X intf 0x%04X gpio_orig 0x%04X gpio 0x%04X\n", 415 411 intcap, intf, gpio_orig, gpio); 416 412 417 - for (i = 0; i < mcp->chip.ngpio; i++) { 418 - /* We must check all of the inputs on the chip, 419 - * otherwise we may not notice a change on >=2 pins. 413 + enabled_interrupts = gpinten; 414 + for_each_set_bit(i, &enabled_interrupts, mcp->chip.ngpio) { 415 + /* 416 + * We must check all of the inputs with enabled interrupts 417 + * on the chip, otherwise we may not notice a change 418 + * on more than one pin. 420 419 * 421 420 * On at least the mcp23s17, INTCAP is only updated 422 421 * one byte at a time(INTCAPA and INTCAPB are
-1
drivers/pinctrl/pinctrl-ocelot.c
··· 1401 1401 if (info->pincfg) { 1402 1402 const struct ocelot_pincfg_data *opd = info->pincfg_data; 1403 1403 1404 - ret = 0; 1405 1404 switch (reg) { 1406 1405 case PINCONF_BIAS: 1407 1406 ret = ocelot_pincfg_clrsetbits(info, pin,
+1 -2
drivers/pinctrl/pinctrl-st.c
··· 723 723 struct st_gpio_bank *bank = gpiochip_get_data(chip); 724 724 725 725 __st_gpio_set(bank, offset, value); 726 - pinctrl_gpio_direction_output(chip, offset); 727 726 728 - return 0; 727 + return pinctrl_gpio_direction_output(chip, offset); 729 728 } 730 729 731 730 static int st_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
+4 -4
drivers/pinctrl/pinctrl-zynqmp.c
··· 562 562 const char **fgroups; 563 563 int ret, index, i; 564 564 565 - fgroups = devm_kzalloc(dev, sizeof(*fgroups) * func->ngroups, GFP_KERNEL); 565 + fgroups = devm_kcalloc(dev, func->ngroups, sizeof(*fgroups), GFP_KERNEL); 566 566 if (!fgroups) 567 567 return -ENOMEM; 568 568 ··· 754 754 if (ret) 755 755 return ret; 756 756 757 - funcs = devm_kzalloc(dev, sizeof(*funcs) * pctrl->nfuncs, GFP_KERNEL); 757 + funcs = devm_kcalloc(dev, pctrl->nfuncs, sizeof(*funcs), GFP_KERNEL); 758 758 if (!funcs) 759 759 return -ENOMEM; 760 760 ··· 768 768 pctrl->ngroups += funcs[i].ngroups; 769 769 } 770 770 771 - groups = devm_kzalloc(dev, sizeof(*groups) * pctrl->ngroups, GFP_KERNEL); 771 + groups = devm_kcalloc(dev, pctrl->ngroups, sizeof(*groups), GFP_KERNEL); 772 772 if (!groups) 773 773 return -ENOMEM; 774 774 ··· 830 830 if (ret) 831 831 return ret; 832 832 833 - pins = devm_kzalloc(dev, sizeof(*pins) * *npins, GFP_KERNEL); 833 + pins = devm_kcalloc(dev, *npins, sizeof(*pins), GFP_KERNEL); 834 834 if (!pins) 835 835 return -ENOMEM; 836 836
+3 -3
drivers/pinctrl/pinmux.c
··· 188 188 } 189 189 out: 190 190 if (status) 191 - dev_err(pctldev->dev, "pin-%d (%s) status %d\n", 192 - pin, owner, status); 191 + dev_err_probe(pctldev->dev, status, "pin-%d (%s)\n", 192 + pin, owner); 193 193 194 194 return status; 195 195 } ··· 441 441 pname = desc ? desc->name : "non-existing"; 442 442 gname = pctlops->get_group_name(pctldev, 443 443 setting->data.mux.group); 444 - dev_err(pctldev->dev, 444 + dev_err_probe(pctldev->dev, ret, 445 445 "could not request pin %d (%s) from group %s " 446 446 " on device %s\n", 447 447 pins[i], pname, gname,
+1 -1
drivers/pinctrl/qcom/Kconfig
··· 125 125 platform. 126 126 127 127 config PINCTRL_SM8650_LPASS_LPI 128 - tristate "Qualcomm Technologies Inc SM8550 LPASS LPI pin controller driver" 128 + tristate "Qualcomm Technologies Inc SM8650 LPASS LPI pin controller driver" 129 129 depends on ARM64 || COMPILE_TEST 130 130 depends on PINCTRL_LPASS_LPI 131 131 help
+7
drivers/pinctrl/renesas/Kconfig
··· 38 38 select PINCTRL_PFC_R8A779A0 if ARCH_R8A779A0 39 39 select PINCTRL_PFC_R8A779F0 if ARCH_R8A779F0 40 40 select PINCTRL_PFC_R8A779G0 if ARCH_R8A779G0 41 + select PINCTRL_PFC_R8A779H0 if ARCH_R8A779H0 41 42 select PINCTRL_RZG2L if ARCH_RZG2L 42 43 select PINCTRL_RZV2M if ARCH_R9A09G011 43 44 select PINCTRL_PFC_SH7203 if CPU_SUBTYPE_SH7203 ··· 155 154 bool "pin control support for R-Car V4H" if COMPILE_TEST 156 155 select PINCTRL_SH_PFC 157 156 157 + config PINCTRL_PFC_R8A779H0 158 + bool "pin control support for R-Car V4M" if COMPILE_TEST 159 + select PINCTRL_SH_PFC 160 + 158 161 config PINCTRL_PFC_R8A7740 159 162 bool "pin control support for R-Mobile A1" if COMPILE_TEST 160 163 select PINCTRL_SH_PFC_GPIO ··· 192 187 bool "pin control support for RZ/{G2L,G2UL,V2L}" if COMPILE_TEST 193 188 depends on OF 194 189 select GPIOLIB 190 + select GPIOLIB_IRQCHIP 195 191 select GENERIC_PINCTRL_GROUPS 196 192 select GENERIC_PINMUX_FUNCTIONS 197 193 select GENERIC_PINCONF 194 + select IRQ_DOMAIN_HIERARCHY 198 195 help 199 196 This selects GPIO and pinctrl driver for Renesas RZ/{G2L,G2UL,V2L} 200 197 platforms.
+1
drivers/pinctrl/renesas/Makefile
··· 31 31 obj-$(CONFIG_PINCTRL_PFC_R8A779A0) += pfc-r8a779a0.o 32 32 obj-$(CONFIG_PINCTRL_PFC_R8A779F0) += pfc-r8a779f0.o 33 33 obj-$(CONFIG_PINCTRL_PFC_R8A779G0) += pfc-r8a779g0.o 34 + obj-$(CONFIG_PINCTRL_PFC_R8A779H0) += pfc-r8a779h0.o 34 35 obj-$(CONFIG_PINCTRL_PFC_SH7203) += pfc-sh7203.o 35 36 obj-$(CONFIG_PINCTRL_PFC_SH7264) += pfc-sh7264.o 36 37 obj-$(CONFIG_PINCTRL_PFC_SH7269) += pfc-sh7269.o
+12 -2
drivers/pinctrl/renesas/core.c
··· 638 638 .data = &r8a779g0_pinmux_info, 639 639 }, 640 640 #endif 641 + #ifdef CONFIG_PINCTRL_PFC_R8A779H0 642 + { 643 + .compatible = "renesas,pfc-r8a779h0", 644 + .data = &r8a779h0_pinmux_info, 645 + }, 646 + #endif 641 647 #ifdef CONFIG_PINCTRL_PFC_SH73A0 642 648 { 643 649 .compatible = "renesas,pfc-sh73a0", ··· 737 731 sh_pfc_walk_regs(pfc, sh_pfc_restore_reg); 738 732 return 0; 739 733 } 734 + #define pm_psci_sleep_ptr(_ptr) pm_sleep_ptr(_ptr) 740 735 #else 741 736 static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; } 742 737 static int sh_pfc_suspend_noirq(struct device *dev) { return 0; } 743 738 static int sh_pfc_resume_noirq(struct device *dev) { return 0; } 739 + #define pm_psci_sleep_ptr(_ptr) PTR_IF(false, (_ptr)) 744 740 #endif /* CONFIG_ARM_PSCI_FW */ 745 741 746 742 static DEFINE_NOIRQ_DEV_PM_OPS(sh_pfc_pm, sh_pfc_suspend_noirq, sh_pfc_resume_noirq); ··· 915 907 sh_pfc_err("reg 0x%x: var_field_width declares %u instead of %u bits\n", 916 908 cfg_reg->reg, rw, cfg_reg->reg_width); 917 909 918 - if (n != cfg_reg->nr_enum_ids) 910 + if (n != cfg_reg->nr_enum_ids) { 919 911 sh_pfc_err("reg 0x%x: enum_ids[] has %u instead of %u values\n", 920 912 cfg_reg->reg, cfg_reg->nr_enum_ids, n); 913 + n = cfg_reg->nr_enum_ids; 914 + } 921 915 922 916 check_enum_ids: 923 917 sh_pfc_check_reg_enums(drvname, cfg_reg->reg, cfg_reg->enum_ids, n); ··· 1425 1415 .driver = { 1426 1416 .name = DRV_NAME, 1427 1417 .of_match_table = of_match_ptr(sh_pfc_of_table), 1428 - .pm = pm_sleep_ptr(&sh_pfc_pm), 1418 + .pm = pm_psci_sleep_ptr(&sh_pfc_pm), 1429 1419 }, 1430 1420 }; 1431 1421
+14
drivers/pinctrl/renesas/pfc-r8a779g0.c
··· 2384 2384 SCIF_CLK_MARK, 2385 2385 }; 2386 2386 2387 + static const unsigned int scif_clk2_pins[] = { 2388 + /* SCIF_CLK2 */ 2389 + RCAR_GP_PIN(8, 11), 2390 + }; 2391 + static const unsigned int scif_clk2_mux[] = { 2392 + SCIF_CLK2_MARK, 2393 + }; 2394 + 2387 2395 /* - SSI ------------------------------------------------- */ 2388 2396 static const unsigned int ssi_data_pins[] = { 2389 2397 /* SSI_SD */ ··· 2702 2694 SH_PFC_PIN_GROUP(scif4_clk), 2703 2695 SH_PFC_PIN_GROUP(scif4_ctrl), 2704 2696 SH_PFC_PIN_GROUP(scif_clk), 2697 + SH_PFC_PIN_GROUP(scif_clk2), 2705 2698 2706 2699 SH_PFC_PIN_GROUP(ssi_data), 2707 2700 SH_PFC_PIN_GROUP(ssi_ctrl), ··· 3024 3015 "scif_clk", 3025 3016 }; 3026 3017 3018 + static const char * const scif_clk2_groups[] = { 3019 + "scif_clk2", 3020 + }; 3021 + 3027 3022 static const char * const ssi_groups[] = { 3028 3023 "ssi_data", 3029 3024 "ssi_ctrl", ··· 3115 3102 SH_PFC_FUNCTION(scif3), 3116 3103 SH_PFC_FUNCTION(scif4), 3117 3104 SH_PFC_FUNCTION(scif_clk), 3105 + SH_PFC_FUNCTION(scif_clk2), 3118 3106 3119 3107 SH_PFC_FUNCTION(ssi), 3120 3108
+3967
drivers/pinctrl/renesas/pfc-r8a779h0.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * R8A779H0 processor support - PFC hardware block. 4 + * 5 + * Copyright (C) 2023 Renesas Electronics Corp. 6 + * 7 + * This file is based on the drivers/pinctrl/renesas/pfc-r8a779a0.c 8 + */ 9 + 10 + #include <linux/errno.h> 11 + #include <linux/io.h> 12 + #include <linux/kernel.h> 13 + 14 + #include "sh_pfc.h" 15 + 16 + #define CFG_FLAGS (SH_PFC_PIN_CFG_DRIVE_STRENGTH | SH_PFC_PIN_CFG_PULL_UP_DOWN) 17 + 18 + #define CPU_ALL_GP(fn, sfx) \ 19 + PORT_GP_CFG_19(0, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33), \ 20 + PORT_GP_CFG_29(1, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33), \ 21 + PORT_GP_CFG_1(1, 29, fn, sfx, CFG_FLAGS), \ 22 + PORT_GP_CFG_16(2, fn, sfx, CFG_FLAGS), \ 23 + PORT_GP_CFG_1(2, 17, fn, sfx, CFG_FLAGS), \ 24 + PORT_GP_CFG_1(2, 19, fn, sfx, CFG_FLAGS), \ 25 + PORT_GP_CFG_13(3, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33), \ 26 + PORT_GP_CFG_1(3, 13, fn, sfx, CFG_FLAGS), \ 27 + PORT_GP_CFG_1(3, 14, fn, sfx, CFG_FLAGS), \ 28 + PORT_GP_CFG_1(3, 15, fn, sfx, CFG_FLAGS), \ 29 + PORT_GP_CFG_1(3, 16, fn, sfx, CFG_FLAGS), \ 30 + PORT_GP_CFG_1(3, 17, fn, sfx, CFG_FLAGS), \ 31 + PORT_GP_CFG_1(3, 18, fn, sfx, CFG_FLAGS), \ 32 + PORT_GP_CFG_1(3, 19, fn, sfx, CFG_FLAGS), \ 33 + PORT_GP_CFG_1(3, 20, fn, sfx, CFG_FLAGS), \ 34 + PORT_GP_CFG_1(3, 21, fn, sfx, CFG_FLAGS), \ 35 + PORT_GP_CFG_1(3, 22, fn, sfx, CFG_FLAGS), \ 36 + PORT_GP_CFG_1(3, 23, fn, sfx, CFG_FLAGS), \ 37 + PORT_GP_CFG_1(3, 24, fn, sfx, CFG_FLAGS), \ 38 + PORT_GP_CFG_1(3, 25, fn, sfx, CFG_FLAGS), \ 39 + PORT_GP_CFG_1(3, 26, fn, sfx, CFG_FLAGS), \ 40 + PORT_GP_CFG_1(3, 27, fn, sfx, CFG_FLAGS), \ 41 + PORT_GP_CFG_1(3, 28, fn, sfx, CFG_FLAGS), \ 42 + PORT_GP_CFG_1(3, 29, fn, sfx, CFG_FLAGS), \ 43 + PORT_GP_CFG_1(3, 30, fn, sfx, CFG_FLAGS), \ 44 + PORT_GP_CFG_1(3, 31, fn, sfx, CFG_FLAGS), \ 45 + PORT_GP_CFG_14(4, fn, sfx, CFG_FLAGS | SH_PFC_PIN_CFG_IO_VOLTAGE_18_33), \ 46 + PORT_GP_CFG_1(4, 14, fn, sfx, CFG_FLAGS), \ 47 + PORT_GP_CFG_1(4, 15, fn, sfx, CFG_FLAGS), \ 48 + PORT_GP_CFG_1(4, 21, fn, sfx, CFG_FLAGS), \ 49 + PORT_GP_CFG_1(4, 23, fn, sfx, CFG_FLAGS), \ 50 + PORT_GP_CFG_1(4, 24, fn, sfx, CFG_FLAGS), \ 51 + PORT_GP_CFG_21(5, fn, sfx, CFG_FLAGS), \ 52 + PORT_GP_CFG_21(6, fn, sfx, CFG_FLAGS), \ 53 + PORT_GP_CFG_21(7, fn, sfx, CFG_FLAGS) 54 + 55 + #define CPU_ALL_NOGP(fn) \ 56 + PIN_NOGP_CFG(VDDQ_AVB0, "VDDQ_AVB0", fn, SH_PFC_PIN_CFG_IO_VOLTAGE_18_25), \ 57 + PIN_NOGP_CFG(VDDQ_AVB1, "VDDQ_AVB1", fn, SH_PFC_PIN_CFG_IO_VOLTAGE_18_25), \ 58 + PIN_NOGP_CFG(VDDQ_AVB2, "VDDQ_AVB2", fn, SH_PFC_PIN_CFG_IO_VOLTAGE_18_25) 59 + 60 + /* 61 + * F_() : just information 62 + * FM() : macro for FN_xxx / xxx_MARK 63 + */ 64 + 65 + /* GPSR0 */ 66 + #define GPSR0_18 F_(MSIOF2_RXD, IP2SR0_11_8) 67 + #define GPSR0_17 F_(MSIOF2_SCK, IP2SR0_7_4) 68 + #define GPSR0_16 F_(MSIOF2_TXD, IP2SR0_3_0) 69 + #define GPSR0_15 F_(MSIOF2_SYNC, IP1SR0_31_28) 70 + #define GPSR0_14 F_(MSIOF2_SS1, IP1SR0_27_24) 71 + #define GPSR0_13 F_(MSIOF2_SS2, IP1SR0_23_20) 72 + #define GPSR0_12 F_(MSIOF5_RXD, IP1SR0_19_16) 73 + #define GPSR0_11 F_(MSIOF5_SCK, IP1SR0_15_12) 74 + #define GPSR0_10 F_(MSIOF5_TXD, IP1SR0_11_8) 75 + #define GPSR0_9 F_(MSIOF5_SYNC, IP1SR0_7_4) 76 + #define GPSR0_8 F_(MSIOF5_SS1, IP1SR0_3_0) 77 + #define GPSR0_7 F_(MSIOF5_SS2, IP0SR0_31_28) 78 + #define GPSR0_6 F_(IRQ0, IP0SR0_27_24) 79 + #define GPSR0_5 F_(IRQ1, IP0SR0_23_20) 80 + #define GPSR0_4 F_(IRQ2, IP0SR0_19_16) 81 + #define GPSR0_3 F_(IRQ3, IP0SR0_15_12) 82 + #define GPSR0_2 F_(GP0_02, IP0SR0_11_8) 83 + #define GPSR0_1 F_(GP0_01, IP0SR0_7_4) 84 + #define GPSR0_0 F_(GP0_00, IP0SR0_3_0) 85 + 86 + /* GPSR1 */ 87 + #define GPSR1_29 F_(ERROROUTC_N_A, IP3SR1_23_20) 88 + #define GPSR1_28 F_(HTX3, IP3SR1_19_16) 89 + #define GPSR1_27 F_(HCTS3_N, IP3SR1_15_12) 90 + #define GPSR1_26 F_(HRTS3_N, IP3SR1_11_8) 91 + #define GPSR1_25 F_(HSCK3, IP3SR1_7_4) 92 + #define GPSR1_24 F_(HRX3, IP3SR1_3_0) 93 + #define GPSR1_23 F_(GP1_23, IP2SR1_31_28) 94 + #define GPSR1_22 F_(AUDIO_CLKIN, IP2SR1_27_24) 95 + #define GPSR1_21 F_(AUDIO_CLKOUT, IP2SR1_23_20) 96 + #define GPSR1_20 F_(SSI_SD, IP2SR1_19_16) 97 + #define GPSR1_19 F_(SSI_WS, IP2SR1_15_12) 98 + #define GPSR1_18 F_(SSI_SCK, IP2SR1_11_8) 99 + #define GPSR1_17 F_(SCIF_CLK, IP2SR1_7_4) 100 + #define GPSR1_16 F_(HRX0, IP2SR1_3_0) 101 + #define GPSR1_15 F_(HSCK0, IP1SR1_31_28) 102 + #define GPSR1_14 F_(HRTS0_N, IP1SR1_27_24) 103 + #define GPSR1_13 F_(HCTS0_N, IP1SR1_23_20) 104 + #define GPSR1_12 F_(HTX0, IP1SR1_19_16) 105 + #define GPSR1_11 F_(MSIOF0_RXD, IP1SR1_15_12) 106 + #define GPSR1_10 F_(MSIOF0_SCK, IP1SR1_11_8) 107 + #define GPSR1_9 F_(MSIOF0_TXD, IP1SR1_7_4) 108 + #define GPSR1_8 F_(MSIOF0_SYNC, IP1SR1_3_0) 109 + #define GPSR1_7 F_(MSIOF0_SS1, IP0SR1_31_28) 110 + #define GPSR1_6 F_(MSIOF0_SS2, IP0SR1_27_24) 111 + #define GPSR1_5 F_(MSIOF1_RXD, IP0SR1_23_20) 112 + #define GPSR1_4 F_(MSIOF1_TXD, IP0SR1_19_16) 113 + #define GPSR1_3 F_(MSIOF1_SCK, IP0SR1_15_12) 114 + #define GPSR1_2 F_(MSIOF1_SYNC, IP0SR1_11_8) 115 + #define GPSR1_1 F_(MSIOF1_SS1, IP0SR1_7_4) 116 + #define GPSR1_0 F_(MSIOF1_SS2, IP0SR1_3_0) 117 + 118 + /* GPSR2 */ 119 + #define GPSR2_19 F_(CANFD1_RX, IP2SR2_15_12) 120 + #define GPSR2_17 F_(CANFD1_TX, IP2SR2_7_4) 121 + #define GPSR2_15 F_(CANFD3_RX, IP1SR2_31_28) 122 + #define GPSR2_14 F_(CANFD3_TX, IP1SR2_27_24) 123 + #define GPSR2_13 F_(CANFD2_RX, IP1SR2_23_20) 124 + #define GPSR2_12 F_(CANFD2_TX, IP1SR2_19_16) 125 + #define GPSR2_11 F_(CANFD0_RX, IP1SR2_15_12) 126 + #define GPSR2_10 F_(CANFD0_TX, IP1SR2_11_8) 127 + #define GPSR2_9 F_(CAN_CLK, IP1SR2_7_4) 128 + #define GPSR2_8 F_(TPU0TO0, IP1SR2_3_0) 129 + #define GPSR2_7 F_(TPU0TO1, IP0SR2_31_28) 130 + #define GPSR2_6 F_(FXR_TXDB, IP0SR2_27_24) 131 + #define GPSR2_5 F_(FXR_TXENB_N_A, IP0SR2_23_20) 132 + #define GPSR2_4 F_(RXDB_EXTFXR, IP0SR2_19_16) 133 + #define GPSR2_3 F_(CLK_EXTFXR, IP0SR2_15_12) 134 + #define GPSR2_2 F_(RXDA_EXTFXR, IP0SR2_11_8) 135 + #define GPSR2_1 F_(FXR_TXENA_N_A, IP0SR2_7_4) 136 + #define GPSR2_0 F_(FXR_TXDA, IP0SR2_3_0) 137 + 138 + /* GPSR3 */ 139 + #define GPSR3_31 F_(TCLK4, IP3SR3_31_28) 140 + #define GPSR3_30 F_(TCLK3, IP3SR3_27_24) 141 + #define GPSR3_29 F_(RPC_INT_N, IP3SR3_23_20) 142 + #define GPSR3_28 F_(RPC_WP_N, IP3SR3_19_16) 143 + #define GPSR3_27 F_(RPC_RESET_N, IP3SR3_15_12) 144 + #define GPSR3_26 F_(QSPI1_IO3, IP3SR3_11_8) 145 + #define GPSR3_25 F_(QSPI1_SSL, IP3SR3_7_4) 146 + #define GPSR3_24 F_(QSPI1_IO2, IP3SR3_3_0) 147 + #define GPSR3_23 F_(QSPI1_MISO_IO1, IP2SR3_31_28) 148 + #define GPSR3_22 F_(QSPI1_SPCLK, IP2SR3_27_24) 149 + #define GPSR3_21 F_(QSPI1_MOSI_IO0, IP2SR3_23_20) 150 + #define GPSR3_20 F_(QSPI0_SPCLK, IP2SR3_19_16) 151 + #define GPSR3_19 F_(QSPI0_MOSI_IO0, IP2SR3_15_12) 152 + #define GPSR3_18 F_(QSPI0_MISO_IO1, IP2SR3_11_8) 153 + #define GPSR3_17 F_(QSPI0_IO2, IP2SR3_7_4) 154 + #define GPSR3_16 F_(QSPI0_IO3, IP2SR3_3_0) 155 + #define GPSR3_15 F_(QSPI0_SSL, IP1SR3_31_28) 156 + #define GPSR3_14 F_(PWM2, IP1SR3_27_24) 157 + #define GPSR3_13 F_(PWM1, IP1SR3_23_20) 158 + #define GPSR3_12 F_(SD_WP, IP1SR3_19_16) 159 + #define GPSR3_11 F_(SD_CD, IP1SR3_15_12) 160 + #define GPSR3_10 F_(MMC_SD_CMD, IP1SR3_11_8) 161 + #define GPSR3_9 F_(MMC_D6, IP1SR3_7_4) 162 + #define GPSR3_8 F_(MMC_D7, IP1SR3_3_0) 163 + #define GPSR3_7 F_(MMC_D4, IP0SR3_31_28) 164 + #define GPSR3_6 F_(MMC_D5, IP0SR3_27_24) 165 + #define GPSR3_5 F_(MMC_SD_D3, IP0SR3_23_20) 166 + #define GPSR3_4 F_(MMC_DS, IP0SR3_19_16) 167 + #define GPSR3_3 F_(MMC_SD_CLK, IP0SR3_15_12) 168 + #define GPSR3_2 F_(MMC_SD_D2, IP0SR3_11_8) 169 + #define GPSR3_1 F_(MMC_SD_D0, IP0SR3_7_4) 170 + #define GPSR3_0 F_(MMC_SD_D1, IP0SR3_3_0) 171 + 172 + /* GPSR4 */ 173 + #define GPSR4_24 F_(AVS1, IP3SR4_3_0) 174 + #define GPSR4_23 F_(AVS0, IP2SR4_31_28) 175 + #define GPSR4_21 F_(PCIE0_CLKREQ_N, IP2SR4_23_20) 176 + #define GPSR4_15 F_(PWM4, IP1SR4_31_28) 177 + #define GPSR4_14 F_(PWM3, IP1SR4_27_24) 178 + #define GPSR4_13 F_(HSCK2, IP1SR4_23_20) 179 + #define GPSR4_12 F_(HCTS2_N, IP1SR4_19_16) 180 + #define GPSR4_11 F_(SCIF_CLK2, IP1SR4_15_12) 181 + #define GPSR4_10 F_(HRTS2_N, IP1SR4_11_8) 182 + #define GPSR4_9 F_(HTX2, IP1SR4_7_4) 183 + #define GPSR4_8 F_(HRX2, IP1SR4_3_0) 184 + #define GPSR4_7 F_(SDA3, IP0SR4_31_28) 185 + #define GPSR4_6 F_(SCL3, IP0SR4_27_24) 186 + #define GPSR4_5 F_(SDA2, IP0SR4_23_20) 187 + #define GPSR4_4 F_(SCL2, IP0SR4_19_16) 188 + #define GPSR4_3 F_(SDA1, IP0SR4_15_12) 189 + #define GPSR4_2 F_(SCL1, IP0SR4_11_8) 190 + #define GPSR4_1 F_(SDA0, IP0SR4_7_4) 191 + #define GPSR4_0 F_(SCL0, IP0SR4_3_0) 192 + 193 + /* GPSR 5 */ 194 + #define GPSR5_20 F_(AVB2_RX_CTL, IP2SR5_19_16) 195 + #define GPSR5_19 F_(AVB2_TX_CTL, IP2SR5_15_12) 196 + #define GPSR5_18 F_(AVB2_RXC, IP2SR5_11_8) 197 + #define GPSR5_17 F_(AVB2_RD0, IP2SR5_7_4) 198 + #define GPSR5_16 F_(AVB2_TXC, IP2SR5_3_0) 199 + #define GPSR5_15 F_(AVB2_TD0, IP1SR5_31_28) 200 + #define GPSR5_14 F_(AVB2_RD1, IP1SR5_27_24) 201 + #define GPSR5_13 F_(AVB2_RD2, IP1SR5_23_20) 202 + #define GPSR5_12 F_(AVB2_TD1, IP1SR5_19_16) 203 + #define GPSR5_11 F_(AVB2_TD2, IP1SR5_15_12) 204 + #define GPSR5_10 F_(AVB2_MDIO, IP1SR5_11_8) 205 + #define GPSR5_9 F_(AVB2_RD3, IP1SR5_7_4) 206 + #define GPSR5_8 F_(AVB2_TD3, IP1SR5_3_0) 207 + #define GPSR5_7 F_(AVB2_TXCREFCLK, IP0SR5_31_28) 208 + #define GPSR5_6 F_(AVB2_MDC, IP0SR5_27_24) 209 + #define GPSR5_5 F_(AVB2_MAGIC, IP0SR5_23_20) 210 + #define GPSR5_4 F_(AVB2_PHY_INT, IP0SR5_19_16) 211 + #define GPSR5_3 F_(AVB2_LINK, IP0SR5_15_12) 212 + #define GPSR5_2 F_(AVB2_AVTP_MATCH, IP0SR5_11_8) 213 + #define GPSR5_1 F_(AVB2_AVTP_CAPTURE, IP0SR5_7_4) 214 + #define GPSR5_0 F_(AVB2_AVTP_PPS, IP0SR5_3_0) 215 + 216 + /* GPSR 6 */ 217 + #define GPSR6_20 F_(AVB1_TXCREFCLK, IP2SR6_19_16) 218 + #define GPSR6_19 F_(AVB1_RD3, IP2SR6_15_12) 219 + #define GPSR6_18 F_(AVB1_TD3, IP2SR6_11_8) 220 + #define GPSR6_17 F_(AVB1_RD2, IP2SR6_7_4) 221 + #define GPSR6_16 F_(AVB1_TD2, IP2SR6_3_0) 222 + #define GPSR6_15 F_(AVB1_RD0, IP1SR6_31_28) 223 + #define GPSR6_14 F_(AVB1_RD1, IP1SR6_27_24) 224 + #define GPSR6_13 F_(AVB1_TD0, IP1SR6_23_20) 225 + #define GPSR6_12 F_(AVB1_TD1, IP1SR6_19_16) 226 + #define GPSR6_11 F_(AVB1_AVTP_CAPTURE, IP1SR6_15_12) 227 + #define GPSR6_10 F_(AVB1_AVTP_PPS, IP1SR6_11_8) 228 + #define GPSR6_9 F_(AVB1_RX_CTL, IP1SR6_7_4) 229 + #define GPSR6_8 F_(AVB1_RXC, IP1SR6_3_0) 230 + #define GPSR6_7 F_(AVB1_TX_CTL, IP0SR6_31_28) 231 + #define GPSR6_6 F_(AVB1_TXC, IP0SR6_27_24) 232 + #define GPSR6_5 F_(AVB1_AVTP_MATCH, IP0SR6_23_20) 233 + #define GPSR6_4 F_(AVB1_LINK, IP0SR6_19_16) 234 + #define GPSR6_3 F_(AVB1_PHY_INT, IP0SR6_15_12) 235 + #define GPSR6_2 F_(AVB1_MDC, IP0SR6_11_8) 236 + #define GPSR6_1 F_(AVB1_MAGIC, IP0SR6_7_4) 237 + #define GPSR6_0 F_(AVB1_MDIO, IP0SR6_3_0) 238 + 239 + /* GPSR7 */ 240 + #define GPSR7_20 F_(AVB0_RX_CTL, IP2SR7_19_16) 241 + #define GPSR7_19 F_(AVB0_RXC, IP2SR7_15_12) 242 + #define GPSR7_18 F_(AVB0_RD0, IP2SR7_11_8) 243 + #define GPSR7_17 F_(AVB0_RD1, IP2SR7_7_4) 244 + #define GPSR7_16 F_(AVB0_TX_CTL, IP2SR7_3_0) 245 + #define GPSR7_15 F_(AVB0_TXC, IP1SR7_31_28) 246 + #define GPSR7_14 F_(AVB0_MDIO, IP1SR7_27_24) 247 + #define GPSR7_13 F_(AVB0_MDC, IP1SR7_23_20) 248 + #define GPSR7_12 F_(AVB0_RD2, IP1SR7_19_16) 249 + #define GPSR7_11 F_(AVB0_TD0, IP1SR7_15_12) 250 + #define GPSR7_10 F_(AVB0_MAGIC, IP1SR7_11_8) 251 + #define GPSR7_9 F_(AVB0_TXCREFCLK, IP1SR7_7_4) 252 + #define GPSR7_8 F_(AVB0_RD3, IP1SR7_3_0) 253 + #define GPSR7_7 F_(AVB0_TD1, IP0SR7_31_28) 254 + #define GPSR7_6 F_(AVB0_TD2, IP0SR7_27_24) 255 + #define GPSR7_5 F_(AVB0_PHY_INT, IP0SR7_23_20) 256 + #define GPSR7_4 F_(AVB0_LINK, IP0SR7_19_16) 257 + #define GPSR7_3 F_(AVB0_TD3, IP0SR7_15_12) 258 + #define GPSR7_2 F_(AVB0_AVTP_MATCH, IP0SR7_11_8) 259 + #define GPSR7_1 F_(AVB0_AVTP_CAPTURE, IP0SR7_7_4) 260 + #define GPSR7_0 F_(AVB0_AVTP_PPS, IP0SR7_3_0) 261 + 262 + 263 + /* SR0 */ 264 + /* IP0SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 265 + #define IP0SR0_3_0 F_(0, 0) FM(ERROROUTC_N_B) FM(TCLK2_B) 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) 266 + #define IP0SR0_7_4 F_(0, 0) FM(MSIOF3_SS1) 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) 267 + #define IP0SR0_11_8 F_(0, 0) FM(MSIOF3_SS2) 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) 268 + #define IP0SR0_15_12 FM(IRQ3) FM(MSIOF3_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) F_(0, 0) F_(0, 0) 269 + #define IP0SR0_19_16 FM(IRQ2) 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) F_(0, 0) 270 + #define IP0SR0_23_20 FM(IRQ1) FM(MSIOF3_RXD) 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) 271 + #define IP0SR0_27_24 FM(IRQ0) FM(MSIOF3_SYNC) 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) 272 + #define IP0SR0_31_28 FM(MSIOF5_SS2) 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) 273 + 274 + /* IP1SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 275 + #define IP1SR0_3_0 FM(MSIOF5_SS1) 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) 276 + #define IP1SR0_7_4 FM(MSIOF5_SYNC) 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) 277 + #define IP1SR0_11_8 FM(MSIOF5_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) F_(0, 0) F_(0, 0) 278 + #define IP1SR0_15_12 FM(MSIOF5_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) F_(0, 0) F_(0, 0) F_(0, 0) 279 + #define IP1SR0_19_16 FM(MSIOF5_RXD) 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) 280 + #define IP1SR0_23_20 FM(MSIOF2_SS2) FM(TCLK1_A) FM(IRQ2_B) 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) 281 + #define IP1SR0_27_24 FM(MSIOF2_SS1) FM(HTX1_A) FM(TX1_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) F_(0, 0) F_(0, 0) F_(0, 0) 282 + #define IP1SR0_31_28 FM(MSIOF2_SYNC) FM(HRX1_A) FM(RX1_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) F_(0, 0) F_(0, 0) F_(0, 0) 283 + 284 + /* IP2SR0 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 285 + #define IP2SR0_3_0 FM(MSIOF2_TXD) FM(HCTS1_N_A) FM(CTS1_N_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) F_(0, 0) F_(0, 0) F_(0, 0) 286 + #define IP2SR0_7_4 FM(MSIOF2_SCK) FM(HRTS1_N_A) FM(RTS1_N_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) F_(0, 0) F_(0, 0) F_(0, 0) 287 + #define IP2SR0_11_8 FM(MSIOF2_RXD) FM(HSCK1_A) FM(SCK1_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) F_(0, 0) F_(0, 0) F_(0, 0) 288 + 289 + /* SR1 */ 290 + /* IP0SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 291 + #define IP0SR1_3_0 FM(MSIOF1_SS2) FM(HTX3_B) FM(TX3_B) 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) 292 + #define IP0SR1_7_4 FM(MSIOF1_SS1) FM(HCTS3_N_B) FM(RX3_B) 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) 293 + #define IP0SR1_11_8 FM(MSIOF1_SYNC) FM(HRTS3_N_B) FM(RTS3_N_B) 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) 294 + #define IP0SR1_15_12 FM(MSIOF1_SCK) FM(HSCK3_B) FM(CTS3_N_B) 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) 295 + #define IP0SR1_19_16 FM(MSIOF1_TXD) FM(HRX3_B) FM(SCK3_B) 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) 296 + #define IP0SR1_23_20 FM(MSIOF1_RXD) 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) 297 + #define IP0SR1_27_24 FM(MSIOF0_SS2) FM(HTX1_B) FM(TX1_B) 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) 298 + #define IP0SR1_31_28 FM(MSIOF0_SS1) FM(HRX1_B) FM(RX1_B) 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) 299 + 300 + /* IP1SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 301 + #define IP1SR1_3_0 FM(MSIOF0_SYNC) FM(HCTS1_N_B) FM(CTS1_N_B) 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) 302 + #define IP1SR1_7_4 FM(MSIOF0_TXD) FM(HRTS1_N_B) FM(RTS1_N_B) 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) 303 + #define IP1SR1_11_8 FM(MSIOF0_SCK) FM(HSCK1_B) FM(SCK1_B) 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) 304 + #define IP1SR1_15_12 FM(MSIOF0_RXD) 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) 305 + #define IP1SR1_19_16 FM(HTX0) FM(TX0) 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) 306 + #define IP1SR1_23_20 FM(HCTS0_N) FM(CTS0_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) F_(0, 0) F_(0, 0) F_(0, 0) 307 + #define IP1SR1_27_24 FM(HRTS0_N) FM(RTS0_N) FM(PWM0_B) 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) 308 + #define IP1SR1_31_28 FM(HSCK0) FM(SCK0) FM(PWM0_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) F_(0, 0) F_(0, 0) F_(0, 0) 309 + 310 + /* IP2SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 311 + #define IP2SR1_3_0 FM(HRX0) FM(RX0) 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) 312 + #define IP2SR1_7_4 FM(SCIF_CLK) FM(IRQ4_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 313 + #define IP2SR1_11_8 FM(SSI_SCK) FM(TCLK3_B) 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) 314 + #define IP2SR1_15_12 FM(SSI_WS) FM(TCLK4_B) 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) 315 + #define IP2SR1_19_16 FM(SSI_SD) FM(IRQ0_B) 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) 316 + #define IP2SR1_23_20 FM(AUDIO_CLKOUT) FM(IRQ1_B) 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) 317 + #define IP2SR1_27_24 FM(AUDIO_CLKIN) FM(PWM3_C) 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) 318 + #define IP2SR1_31_28 F_(0, 0) FM(TCLK2_A) FM(MSIOF4_SS1) FM(IRQ3_B) 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) 319 + 320 + /* IP3SR1 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 321 + #define IP3SR1_3_0 FM(HRX3_A) FM(SCK3_A) FM(MSIOF4_SS2) 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) 322 + #define IP3SR1_7_4 FM(HSCK3_A) FM(CTS3_N_A) FM(MSIOF4_SCK) FM(TPU0TO0_B) 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) 323 + #define IP3SR1_11_8 FM(HRTS3_N_A) FM(RTS3_N_A) FM(MSIOF4_TXD) FM(TPU0TO1_B) 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) 324 + #define IP3SR1_15_12 FM(HCTS3_N_A) FM(RX3_A) FM(MSIOF4_RXD) 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) 325 + #define IP3SR1_19_16 FM(HTX3_A) FM(TX3_A) FM(MSIOF4_SYNC) 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) 326 + #define IP3SR1_23_20 FM(ERROROUTC_N_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 327 + 328 + /* SR2 */ 329 + /* IP0SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 330 + #define IP0SR2_3_0 FM(FXR_TXDA) F_(0, 0) FM(TPU0TO2_B) 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) 331 + #define IP0SR2_7_4 FM(FXR_TXENA_N_A) F_(0, 0) FM(TPU0TO3_B) 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) 332 + #define IP0SR2_11_8 FM(RXDA_EXTFXR) F_(0, 0) FM(IRQ5) 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) 333 + #define IP0SR2_15_12 FM(CLK_EXTFXR) F_(0, 0) FM(IRQ4_B) 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) 334 + #define IP0SR2_19_16 FM(RXDB_EXTFXR) 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) 335 + #define IP0SR2_23_20 FM(FXR_TXENB_N_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 336 + #define IP0SR2_27_24 FM(FXR_TXDB) 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) 337 + #define IP0SR2_31_28 FM(TPU0TO1_A) F_(0, 0) F_(0, 0) FM(TCLK2_C) 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) 338 + 339 + /* IP1SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 340 + #define IP1SR2_3_0 FM(TPU0TO0_A) F_(0, 0) F_(0, 0) FM(TCLK1_B) 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) 341 + #define IP1SR2_7_4 FM(CAN_CLK) FM(FXR_TXENA_N_B) 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) 342 + #define IP1SR2_11_8 FM(CANFD0_TX) FM(FXR_TXENB_N_B) 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) 343 + #define IP1SR2_15_12 FM(CANFD0_RX) FM(STPWT_EXTFXR) 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) 344 + #define IP1SR2_19_16 FM(CANFD2_TX) FM(TPU0TO2_A) F_(0, 0) FM(TCLK3_C) 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) 345 + #define IP1SR2_23_20 FM(CANFD2_RX) FM(TPU0TO3_A) FM(PWM1_B) FM(TCLK4_C) 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) 346 + #define IP1SR2_27_24 FM(CANFD3_TX) F_(0, 0) FM(PWM2_B) 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) 347 + #define IP1SR2_31_28 FM(CANFD3_RX) F_(0, 0) FM(PWM3_B) 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) 348 + 349 + /* IP2SR2 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 350 + #define IP2SR2_7_4 FM(CANFD1_TX) F_(0, 0) FM(PWM1_C) 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) 351 + #define IP2SR2_15_12 FM(CANFD1_RX) F_(0, 0) FM(PWM2_C) 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) 352 + 353 + /* SR3 */ 354 + /* IP0SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 355 + #define IP0SR3_3_0 FM(MMC_SD_D1) 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) 356 + #define IP0SR3_7_4 FM(MMC_SD_D0) 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) 357 + #define IP0SR3_11_8 FM(MMC_SD_D2) 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) 358 + #define IP0SR3_15_12 FM(MMC_SD_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) 359 + #define IP0SR3_19_16 FM(MMC_DS) 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) 360 + #define IP0SR3_23_20 FM(MMC_SD_D3) 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) 361 + #define IP0SR3_27_24 FM(MMC_D5) 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) 362 + #define IP0SR3_31_28 FM(MMC_D4) 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) 363 + 364 + /* IP1SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 365 + #define IP1SR3_3_0 FM(MMC_D7) 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) 366 + #define IP1SR3_7_4 FM(MMC_D6) 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) 367 + #define IP1SR3_11_8 FM(MMC_SD_CMD) 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) 368 + #define IP1SR3_15_12 FM(SD_CD) 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) 369 + #define IP1SR3_19_16 FM(SD_WP) 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) 370 + #define IP1SR3_23_20 FM(PWM1_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 371 + #define IP1SR3_27_24 FM(PWM2_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 372 + #define IP1SR3_31_28 FM(QSPI0_SSL) 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) 373 + 374 + /* IP2SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 375 + #define IP2SR3_3_0 FM(QSPI0_IO3) 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) 376 + #define IP2SR3_7_4 FM(QSPI0_IO2) 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) 377 + #define IP2SR3_11_8 FM(QSPI0_MISO_IO1) 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) 378 + #define IP2SR3_15_12 FM(QSPI0_MOSI_IO0) 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) 379 + #define IP2SR3_19_16 FM(QSPI0_SPCLK) 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) 380 + #define IP2SR3_23_20 FM(QSPI1_MOSI_IO0) 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) 381 + #define IP2SR3_27_24 FM(QSPI1_SPCLK) 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) 382 + #define IP2SR3_31_28 FM(QSPI1_MISO_IO1) 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) 383 + 384 + /* IP3SR3 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 385 + #define IP3SR3_3_0 FM(QSPI1_IO2) 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) 386 + #define IP3SR3_7_4 FM(QSPI1_SSL) 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) 387 + #define IP3SR3_11_8 FM(QSPI1_IO3) 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) 388 + #define IP3SR3_15_12 FM(RPC_RESET_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 389 + #define IP3SR3_19_16 FM(RPC_WP_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 390 + #define IP3SR3_23_20 FM(RPC_INT_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 391 + #define IP3SR3_27_24 FM(TCLK3_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 392 + #define IP3SR3_31_28 FM(TCLK4_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 393 + 394 + /* SR4 */ 395 + /* IP0SR4 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 396 + #define IP0SR4_3_0 FM(SCL0) 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) 397 + #define IP0SR4_7_4 FM(SDA0) 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) 398 + #define IP0SR4_11_8 FM(SCL1) 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) 399 + #define IP0SR4_15_12 FM(SDA1) 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) 400 + #define IP0SR4_19_16 FM(SCL2) 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) 401 + #define IP0SR4_23_20 FM(SDA2) 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) 402 + #define IP0SR4_27_24 FM(SCL3) 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) 403 + #define IP0SR4_31_28 FM(SDA3) 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) 404 + 405 + /* IP1SR4 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 406 + #define IP1SR4_3_0 FM(HRX2) 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) F_(0, 0) 407 + #define IP1SR4_7_4 FM(HTX2) FM(CTS4_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) F_(0, 0) F_(0, 0) F_(0, 0) 408 + #define IP1SR4_11_8 FM(HRTS2_N) 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) F_(0, 0) F_(0, 0) F_(0, 0) 409 + #define IP1SR4_15_12 FM(SCIF_CLK2) 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) 410 + #define IP1SR4_19_16 FM(HCTS2_N) 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) F_(0, 0) 411 + #define IP1SR4_23_20 FM(HSCK2) 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) F_(0, 0) 412 + #define IP1SR4_27_24 FM(PWM3_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 413 + #define IP1SR4_31_28 FM(PWM4) 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) 414 + 415 + /* IP2SR4 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 416 + #define IP2SR4_23_20 FM(PCIE0_CLKREQ_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) F_(0, 0) F_(0, 0) F_(0, 0) F_(0, 0) 417 + #define IP2SR4_31_28 FM(AVS0) 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) 418 + 419 + /* IP3SR4 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 420 + #define IP3SR4_3_0 FM(AVS1) 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) 421 + 422 + /* SR5 */ 423 + /* IP0SR5 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 424 + #define IP0SR5_3_0 FM(AVB2_AVTP_PPS) FM(Ether_GPTP_PPS0) 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) 425 + #define IP0SR5_7_4 FM(AVB2_AVTP_CAPTURE) FM(Ether_GPTP_CAPTURE) 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) 426 + #define IP0SR5_11_8 FM(AVB2_AVTP_MATCH) FM(Ether_GPTP_MATCH) 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) 427 + #define IP0SR5_15_12 FM(AVB2_LINK) 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) 428 + #define IP0SR5_19_16 FM(AVB2_PHY_INT) 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) 429 + #define IP0SR5_23_20 FM(AVB2_MAGIC) FM(Ether_GPTP_PPS1) 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) 430 + #define IP0SR5_27_24 FM(AVB2_MDC) 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) 431 + #define IP0SR5_31_28 FM(AVB2_TXCREFCLK) 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) 432 + 433 + /* IP1SR5 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 434 + #define IP1SR5_3_0 FM(AVB2_TD3) 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) 435 + #define IP1SR5_7_4 FM(AVB2_RD3) 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) 436 + #define IP1SR5_11_8 FM(AVB2_MDIO) 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) 437 + #define IP1SR5_15_12 FM(AVB2_TD2) 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) 438 + #define IP1SR5_19_16 FM(AVB2_TD1) 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) 439 + #define IP1SR5_23_20 FM(AVB2_RD2) 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) 440 + #define IP1SR5_27_24 FM(AVB2_RD1) 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) 441 + #define IP1SR5_31_28 FM(AVB2_TD0) 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) 442 + 443 + /* IP2SR5 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 444 + #define IP2SR5_3_0 FM(AVB2_TXC) 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) 445 + #define IP2SR5_7_4 FM(AVB2_RD0) 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) 446 + #define IP2SR5_11_8 FM(AVB2_RXC) 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) 447 + #define IP2SR5_15_12 FM(AVB2_TX_CTL) 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) 448 + #define IP2SR5_19_16 FM(AVB2_RX_CTL) 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) 449 + 450 + /* SR6 */ 451 + /* IP0SR6 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 452 + #define IP0SR6_3_0 FM(AVB1_MDIO) 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) 453 + #define IP0SR6_7_4 FM(AVB1_MAGIC) 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) 454 + #define IP0SR6_11_8 FM(AVB1_MDC) 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) 455 + #define IP0SR6_15_12 FM(AVB1_PHY_INT) 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) 456 + #define IP0SR6_19_16 FM(AVB1_LINK) FM(AVB1_MII_TX_ER) 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) 457 + #define IP0SR6_23_20 FM(AVB1_AVTP_MATCH) FM(AVB1_MII_RX_ER) 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) 458 + #define IP0SR6_27_24 FM(AVB1_TXC) FM(AVB1_MII_TXC) 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) 459 + #define IP0SR6_31_28 FM(AVB1_TX_CTL) FM(AVB1_MII_TX_EN) 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) 460 + 461 + /* IP1SR6 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 462 + #define IP1SR6_3_0 FM(AVB1_RXC) FM(AVB1_MII_RXC) 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) 463 + #define IP1SR6_7_4 FM(AVB1_RX_CTL) FM(AVB1_MII_RX_DV) 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) 464 + #define IP1SR6_11_8 FM(AVB1_AVTP_PPS) FM(AVB1_MII_COL) 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) 465 + #define IP1SR6_15_12 FM(AVB1_AVTP_CAPTURE) FM(AVB1_MII_CRS) 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) 466 + #define IP1SR6_19_16 FM(AVB1_TD1) FM(AVB1_MII_TD1) 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) 467 + #define IP1SR6_23_20 FM(AVB1_TD0) FM(AVB1_MII_TD0) 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) 468 + #define IP1SR6_27_24 FM(AVB1_RD1) FM(AVB1_MII_RD1) 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) 469 + #define IP1SR6_31_28 FM(AVB1_RD0) FM(AVB1_MII_RD0) 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) 470 + 471 + /* IP2SR6 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 472 + #define IP2SR6_3_0 FM(AVB1_TD2) FM(AVB1_MII_TD2) 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) 473 + #define IP2SR6_7_4 FM(AVB1_RD2) FM(AVB1_MII_RD2) 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) 474 + #define IP2SR6_11_8 FM(AVB1_TD3) FM(AVB1_MII_TD3) 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) 475 + #define IP2SR6_15_12 FM(AVB1_RD3) FM(AVB1_MII_RD3) 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) 476 + #define IP2SR6_19_16 FM(AVB1_TXCREFCLK) 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) 477 + 478 + /* SR7 */ 479 + /* IP0SR7 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 480 + #define IP0SR7_3_0 FM(AVB0_AVTP_PPS) FM(AVB0_MII_COL) 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) 481 + #define IP0SR7_7_4 FM(AVB0_AVTP_CAPTURE) FM(AVB0_MII_CRS) 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) 482 + #define IP0SR7_11_8 FM(AVB0_AVTP_MATCH) FM(AVB0_MII_RX_ER) FM(CC5_OSCOUT) 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) 483 + #define IP0SR7_15_12 FM(AVB0_TD3) FM(AVB0_MII_TD3) 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) 484 + #define IP0SR7_19_16 FM(AVB0_LINK) FM(AVB0_MII_TX_ER) 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) 485 + #define IP0SR7_23_20 FM(AVB0_PHY_INT) 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) 486 + #define IP0SR7_27_24 FM(AVB0_TD2) FM(AVB0_MII_TD2) 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) 487 + #define IP0SR7_31_28 FM(AVB0_TD1) FM(AVB0_MII_TD1) 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) 488 + 489 + /* IP1SR7 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 490 + #define IP1SR7_3_0 FM(AVB0_RD3) FM(AVB0_MII_RD3) 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) 491 + #define IP1SR7_7_4 FM(AVB0_TXCREFCLK) 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) 492 + #define IP1SR7_11_8 FM(AVB0_MAGIC) 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) 493 + #define IP1SR7_15_12 FM(AVB0_TD0) FM(AVB0_MII_TD0) 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) 494 + #define IP1SR7_19_16 FM(AVB0_RD2) FM(AVB0_MII_RD2) 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) 495 + #define IP1SR7_23_20 FM(AVB0_MDC) 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) 496 + #define IP1SR7_27_24 FM(AVB0_MDIO) 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) 497 + #define IP1SR7_31_28 FM(AVB0_TXC) FM(AVB0_MII_TXC) 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) 498 + 499 + /* IP2SR7 */ /* 0 */ /* 1 */ /* 2 */ /* 3 4 5 6 7 8 9 A B C D E F */ 500 + #define IP2SR7_3_0 FM(AVB0_TX_CTL) FM(AVB0_MII_TX_EN) 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) 501 + #define IP2SR7_7_4 FM(AVB0_RD1) FM(AVB0_MII_RD1) 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) 502 + #define IP2SR7_11_8 FM(AVB0_RD0) FM(AVB0_MII_RD0) 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) 503 + #define IP2SR7_15_12 FM(AVB0_RXC) FM(AVB0_MII_RXC) 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) 504 + #define IP2SR7_19_16 FM(AVB0_RX_CTL) FM(AVB0_MII_RX_DV) 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) 505 + 506 + #define PINMUX_GPSR \ 507 + GPSR3_31 \ 508 + GPSR3_30 \ 509 + GPSR1_29 GPSR3_29 \ 510 + GPSR1_28 GPSR3_28 \ 511 + GPSR1_27 GPSR3_27 \ 512 + GPSR1_26 GPSR3_26 \ 513 + GPSR1_25 GPSR3_25 \ 514 + GPSR1_24 GPSR3_24 GPSR4_24 \ 515 + GPSR1_23 GPSR3_23 GPSR4_23 \ 516 + GPSR1_22 GPSR3_22 \ 517 + GPSR1_21 GPSR3_21 GPSR4_21 \ 518 + GPSR1_20 GPSR3_20 GPSR5_20 GPSR6_20 GPSR7_20 \ 519 + GPSR1_19 GPSR2_19 GPSR3_19 GPSR5_19 GPSR6_19 GPSR7_19 \ 520 + GPSR0_18 GPSR1_18 GPSR3_18 GPSR5_18 GPSR6_18 GPSR7_18 \ 521 + GPSR0_17 GPSR1_17 GPSR2_17 GPSR3_17 GPSR5_17 GPSR6_17 GPSR7_17 \ 522 + GPSR0_16 GPSR1_16 GPSR3_16 GPSR5_16 GPSR6_16 GPSR7_16 \ 523 + GPSR0_15 GPSR1_15 GPSR2_15 GPSR3_15 GPSR4_15 GPSR5_15 GPSR6_15 GPSR7_15 \ 524 + GPSR0_14 GPSR1_14 GPSR2_14 GPSR3_14 GPSR4_14 GPSR5_14 GPSR6_14 GPSR7_14 \ 525 + GPSR0_13 GPSR1_13 GPSR2_13 GPSR3_13 GPSR4_13 GPSR5_13 GPSR6_13 GPSR7_13 \ 526 + GPSR0_12 GPSR1_12 GPSR2_12 GPSR3_12 GPSR4_12 GPSR5_12 GPSR6_12 GPSR7_12 \ 527 + GPSR0_11 GPSR1_11 GPSR2_11 GPSR3_11 GPSR4_11 GPSR5_11 GPSR6_11 GPSR7_11 \ 528 + GPSR0_10 GPSR1_10 GPSR2_10 GPSR3_10 GPSR4_10 GPSR5_10 GPSR6_10 GPSR7_10 \ 529 + GPSR0_9 GPSR1_9 GPSR2_9 GPSR3_9 GPSR4_9 GPSR5_9 GPSR6_9 GPSR7_9 \ 530 + GPSR0_8 GPSR1_8 GPSR2_8 GPSR3_8 GPSR4_8 GPSR5_8 GPSR6_8 GPSR7_8 \ 531 + GPSR0_7 GPSR1_7 GPSR2_7 GPSR3_7 GPSR4_7 GPSR5_7 GPSR6_7 GPSR7_7 \ 532 + GPSR0_6 GPSR1_6 GPSR2_6 GPSR3_6 GPSR4_6 GPSR5_6 GPSR6_6 GPSR7_6 \ 533 + GPSR0_5 GPSR1_5 GPSR2_5 GPSR3_5 GPSR4_5 GPSR5_5 GPSR6_5 GPSR7_5 \ 534 + GPSR0_4 GPSR1_4 GPSR2_4 GPSR3_4 GPSR4_4 GPSR5_4 GPSR6_4 GPSR7_4 \ 535 + GPSR0_3 GPSR1_3 GPSR2_3 GPSR3_3 GPSR4_3 GPSR5_3 GPSR6_3 GPSR7_3 \ 536 + GPSR0_2 GPSR1_2 GPSR2_2 GPSR3_2 GPSR4_2 GPSR5_2 GPSR6_2 GPSR7_2 \ 537 + GPSR0_1 GPSR1_1 GPSR2_1 GPSR3_1 GPSR4_1 GPSR5_1 GPSR6_1 GPSR7_1 \ 538 + GPSR0_0 GPSR1_0 GPSR2_0 GPSR3_0 GPSR4_0 GPSR5_0 GPSR6_0 GPSR7_0 539 + 540 + #define PINMUX_IPSR \ 541 + \ 542 + FM(IP0SR0_3_0) IP0SR0_3_0 FM(IP1SR0_3_0) IP1SR0_3_0 FM(IP2SR0_3_0) IP2SR0_3_0 \ 543 + FM(IP0SR0_7_4) IP0SR0_7_4 FM(IP1SR0_7_4) IP1SR0_7_4 FM(IP2SR0_7_4) IP2SR0_7_4 \ 544 + FM(IP0SR0_11_8) IP0SR0_11_8 FM(IP1SR0_11_8) IP1SR0_11_8 FM(IP2SR0_11_8) IP2SR0_11_8 \ 545 + FM(IP0SR0_15_12) IP0SR0_15_12 FM(IP1SR0_15_12) IP1SR0_15_12 \ 546 + FM(IP0SR0_19_16) IP0SR0_19_16 FM(IP1SR0_19_16) IP1SR0_19_16 \ 547 + FM(IP0SR0_23_20) IP0SR0_23_20 FM(IP1SR0_23_20) IP1SR0_23_20 \ 548 + FM(IP0SR0_27_24) IP0SR0_27_24 FM(IP1SR0_27_24) IP1SR0_27_24 \ 549 + FM(IP0SR0_31_28) IP0SR0_31_28 FM(IP1SR0_31_28) IP1SR0_31_28 \ 550 + \ 551 + FM(IP0SR1_3_0) IP0SR1_3_0 FM(IP1SR1_3_0) IP1SR1_3_0 FM(IP2SR1_3_0) IP2SR1_3_0 FM(IP3SR1_3_0) IP3SR1_3_0 \ 552 + FM(IP0SR1_7_4) IP0SR1_7_4 FM(IP1SR1_7_4) IP1SR1_7_4 FM(IP2SR1_7_4) IP2SR1_7_4 FM(IP3SR1_7_4) IP3SR1_7_4 \ 553 + FM(IP0SR1_11_8) IP0SR1_11_8 FM(IP1SR1_11_8) IP1SR1_11_8 FM(IP2SR1_11_8) IP2SR1_11_8 FM(IP3SR1_11_8) IP3SR1_11_8 \ 554 + FM(IP0SR1_15_12) IP0SR1_15_12 FM(IP1SR1_15_12) IP1SR1_15_12 FM(IP2SR1_15_12) IP2SR1_15_12 FM(IP3SR1_15_12) IP3SR1_15_12 \ 555 + FM(IP0SR1_19_16) IP0SR1_19_16 FM(IP1SR1_19_16) IP1SR1_19_16 FM(IP2SR1_19_16) IP2SR1_19_16 FM(IP3SR1_19_16) IP3SR1_19_16 \ 556 + FM(IP0SR1_23_20) IP0SR1_23_20 FM(IP1SR1_23_20) IP1SR1_23_20 FM(IP2SR1_23_20) IP2SR1_23_20 FM(IP3SR1_23_20) IP3SR1_23_20 \ 557 + FM(IP0SR1_27_24) IP0SR1_27_24 FM(IP1SR1_27_24) IP1SR1_27_24 FM(IP2SR1_27_24) IP2SR1_27_24 \ 558 + FM(IP0SR1_31_28) IP0SR1_31_28 FM(IP1SR1_31_28) IP1SR1_31_28 FM(IP2SR1_31_28) IP2SR1_31_28 \ 559 + \ 560 + FM(IP0SR2_3_0) IP0SR2_3_0 FM(IP1SR2_3_0) IP1SR2_3_0 \ 561 + FM(IP0SR2_7_4) IP0SR2_7_4 FM(IP1SR2_7_4) IP1SR2_7_4 FM(IP2SR2_7_4) IP2SR2_7_4 \ 562 + FM(IP0SR2_11_8) IP0SR2_11_8 FM(IP1SR2_11_8) IP1SR2_11_8 \ 563 + FM(IP0SR2_15_12) IP0SR2_15_12 FM(IP1SR2_15_12) IP1SR2_15_12 FM(IP2SR2_15_12) IP2SR2_15_12 \ 564 + FM(IP0SR2_19_16) IP0SR2_19_16 FM(IP1SR2_19_16) IP1SR2_19_16 \ 565 + FM(IP0SR2_23_20) IP0SR2_23_20 FM(IP1SR2_23_20) IP1SR2_23_20 \ 566 + FM(IP0SR2_27_24) IP0SR2_27_24 FM(IP1SR2_27_24) IP1SR2_27_24 \ 567 + FM(IP0SR2_31_28) IP0SR2_31_28 FM(IP1SR2_31_28) IP1SR2_31_28 \ 568 + \ 569 + FM(IP0SR3_3_0) IP0SR3_3_0 FM(IP1SR3_3_0) IP1SR3_3_0 FM(IP2SR3_3_0) IP2SR3_3_0 FM(IP3SR3_3_0) IP3SR3_3_0 \ 570 + FM(IP0SR3_7_4) IP0SR3_7_4 FM(IP1SR3_7_4) IP1SR3_7_4 FM(IP2SR3_7_4) IP2SR3_7_4 FM(IP3SR3_7_4) IP3SR3_7_4 \ 571 + FM(IP0SR3_11_8) IP0SR3_11_8 FM(IP1SR3_11_8) IP1SR3_11_8 FM(IP2SR3_11_8) IP2SR3_11_8 FM(IP3SR3_11_8) IP3SR3_11_8 \ 572 + FM(IP0SR3_15_12) IP0SR3_15_12 FM(IP1SR3_15_12) IP1SR3_15_12 FM(IP2SR3_15_12) IP2SR3_15_12 FM(IP3SR3_15_12) IP3SR3_15_12 \ 573 + FM(IP0SR3_19_16) IP0SR3_19_16 FM(IP1SR3_19_16) IP1SR3_19_16 FM(IP2SR3_19_16) IP2SR3_19_16 FM(IP3SR3_19_16) IP3SR3_19_16 \ 574 + FM(IP0SR3_23_20) IP0SR3_23_20 FM(IP1SR3_23_20) IP1SR3_23_20 FM(IP2SR3_23_20) IP2SR3_23_20 FM(IP3SR3_23_20) IP3SR3_23_20 \ 575 + FM(IP0SR3_27_24) IP0SR3_27_24 FM(IP1SR3_27_24) IP1SR3_27_24 FM(IP2SR3_27_24) IP2SR3_27_24 FM(IP3SR3_27_24) IP3SR3_27_24 \ 576 + FM(IP0SR3_31_28) IP0SR3_31_28 FM(IP1SR3_31_28) IP1SR3_31_28 FM(IP2SR3_31_28) IP2SR3_31_28 FM(IP3SR3_31_28) IP3SR3_31_28 \ 577 + \ 578 + FM(IP0SR4_3_0) IP0SR4_3_0 FM(IP1SR4_3_0) IP1SR4_3_0 FM(IP3SR4_3_0) IP3SR4_3_0 \ 579 + FM(IP0SR4_7_4) IP0SR4_7_4 FM(IP1SR4_7_4) IP1SR4_7_4 \ 580 + FM(IP0SR4_11_8) IP0SR4_11_8 FM(IP1SR4_11_8) IP1SR4_11_8 \ 581 + FM(IP0SR4_15_12) IP0SR4_15_12 FM(IP1SR4_15_12) IP1SR4_15_12 \ 582 + FM(IP0SR4_19_16) IP0SR4_19_16 FM(IP1SR4_19_16) IP1SR4_19_16 \ 583 + FM(IP0SR4_23_20) IP0SR4_23_20 FM(IP1SR4_23_20) IP1SR4_23_20 FM(IP2SR4_23_20) IP2SR4_23_20 \ 584 + FM(IP0SR4_27_24) IP0SR4_27_24 FM(IP1SR4_27_24) IP1SR4_27_24 \ 585 + FM(IP0SR4_31_28) IP0SR4_31_28 FM(IP1SR4_31_28) IP1SR4_31_28 FM(IP2SR4_31_28) IP2SR4_31_28 \ 586 + \ 587 + FM(IP0SR5_3_0) IP0SR5_3_0 FM(IP1SR5_3_0) IP1SR5_3_0 FM(IP2SR5_3_0) IP2SR5_3_0 \ 588 + FM(IP0SR5_7_4) IP0SR5_7_4 FM(IP1SR5_7_4) IP1SR5_7_4 FM(IP2SR5_7_4) IP2SR5_7_4 \ 589 + FM(IP0SR5_11_8) IP0SR5_11_8 FM(IP1SR5_11_8) IP1SR5_11_8 FM(IP2SR5_11_8) IP2SR5_11_8 \ 590 + FM(IP0SR5_15_12) IP0SR5_15_12 FM(IP1SR5_15_12) IP1SR5_15_12 FM(IP2SR5_15_12) IP2SR5_15_12 \ 591 + FM(IP0SR5_19_16) IP0SR5_19_16 FM(IP1SR5_19_16) IP1SR5_19_16 FM(IP2SR5_19_16) IP2SR5_19_16 \ 592 + FM(IP0SR5_23_20) IP0SR5_23_20 FM(IP1SR5_23_20) IP1SR5_23_20 \ 593 + FM(IP0SR5_27_24) IP0SR5_27_24 FM(IP1SR5_27_24) IP1SR5_27_24 \ 594 + FM(IP0SR5_31_28) IP0SR5_31_28 FM(IP1SR5_31_28) IP1SR5_31_28 \ 595 + \ 596 + FM(IP0SR6_3_0) IP0SR6_3_0 FM(IP1SR6_3_0) IP1SR6_3_0 FM(IP2SR6_3_0) IP2SR6_3_0 \ 597 + FM(IP0SR6_7_4) IP0SR6_7_4 FM(IP1SR6_7_4) IP1SR6_7_4 FM(IP2SR6_7_4) IP2SR6_7_4 \ 598 + FM(IP0SR6_11_8) IP0SR6_11_8 FM(IP1SR6_11_8) IP1SR6_11_8 FM(IP2SR6_11_8) IP2SR6_11_8 \ 599 + FM(IP0SR6_15_12) IP0SR6_15_12 FM(IP1SR6_15_12) IP1SR6_15_12 FM(IP2SR6_15_12) IP2SR6_15_12 \ 600 + FM(IP0SR6_19_16) IP0SR6_19_16 FM(IP1SR6_19_16) IP1SR6_19_16 FM(IP2SR6_19_16) IP2SR6_19_16 \ 601 + FM(IP0SR6_23_20) IP0SR6_23_20 FM(IP1SR6_23_20) IP1SR6_23_20 \ 602 + FM(IP0SR6_27_24) IP0SR6_27_24 FM(IP1SR6_27_24) IP1SR6_27_24 \ 603 + FM(IP0SR6_31_28) IP0SR6_31_28 FM(IP1SR6_31_28) IP1SR6_31_28 \ 604 + \ 605 + FM(IP0SR7_3_0) IP0SR7_3_0 FM(IP1SR7_3_0) IP1SR7_3_0 FM(IP2SR7_3_0) IP2SR7_3_0 \ 606 + FM(IP0SR7_7_4) IP0SR7_7_4 FM(IP1SR7_7_4) IP1SR7_7_4 FM(IP2SR7_7_4) IP2SR7_7_4 \ 607 + FM(IP0SR7_11_8) IP0SR7_11_8 FM(IP1SR7_11_8) IP1SR7_11_8 FM(IP2SR7_11_8) IP2SR7_11_8 \ 608 + FM(IP0SR7_15_12) IP0SR7_15_12 FM(IP1SR7_15_12) IP1SR7_15_12 FM(IP2SR7_15_12) IP2SR7_15_12 \ 609 + FM(IP0SR7_19_16) IP0SR7_19_16 FM(IP1SR7_19_16) IP1SR7_19_16 FM(IP2SR7_19_16) IP2SR7_19_16 \ 610 + FM(IP0SR7_23_20) IP0SR7_23_20 FM(IP1SR7_23_20) IP1SR7_23_20 \ 611 + FM(IP0SR7_27_24) IP0SR7_27_24 FM(IP1SR7_27_24) IP1SR7_27_24 \ 612 + FM(IP0SR7_31_28) IP0SR7_31_28 FM(IP1SR7_31_28) IP1SR7_31_28 \ 613 + 614 + /* MOD_SEL4 */ /* 0 */ /* 1 */ 615 + #define MOD_SEL4_7 FM(SEL_SDA3_0) FM(SEL_SDA3_1) 616 + #define MOD_SEL4_6 FM(SEL_SCL3_0) FM(SEL_SCL3_1) 617 + #define MOD_SEL4_5 FM(SEL_SDA2_0) FM(SEL_SDA2_1) 618 + #define MOD_SEL4_4 FM(SEL_SCL2_0) FM(SEL_SCL2_1) 619 + #define MOD_SEL4_3 FM(SEL_SDA1_0) FM(SEL_SDA1_1) 620 + #define MOD_SEL4_2 FM(SEL_SCL1_0) FM(SEL_SCL1_1) 621 + #define MOD_SEL4_1 FM(SEL_SDA0_0) FM(SEL_SDA0_1) 622 + #define MOD_SEL4_0 FM(SEL_SCL0_0) FM(SEL_SCL0_1) 623 + 624 + #define PINMUX_MOD_SELS \ 625 + \ 626 + MOD_SEL4_7 \ 627 + MOD_SEL4_6 \ 628 + MOD_SEL4_5 \ 629 + MOD_SEL4_4 \ 630 + MOD_SEL4_3 \ 631 + MOD_SEL4_2 \ 632 + MOD_SEL4_1 \ 633 + MOD_SEL4_0 634 + 635 + enum { 636 + PINMUX_RESERVED = 0, 637 + 638 + PINMUX_DATA_BEGIN, 639 + GP_ALL(DATA), 640 + PINMUX_DATA_END, 641 + 642 + #define F_(x, y) 643 + #define FM(x) FN_##x, 644 + PINMUX_FUNCTION_BEGIN, 645 + GP_ALL(FN), 646 + PINMUX_GPSR 647 + PINMUX_IPSR 648 + PINMUX_MOD_SELS 649 + PINMUX_FUNCTION_END, 650 + #undef F_ 651 + #undef FM 652 + 653 + #define F_(x, y) 654 + #define FM(x) x##_MARK, 655 + PINMUX_MARK_BEGIN, 656 + PINMUX_GPSR 657 + PINMUX_IPSR 658 + PINMUX_MOD_SELS 659 + PINMUX_MARK_END, 660 + #undef F_ 661 + #undef FM 662 + }; 663 + 664 + static const u16 pinmux_data[] = { 665 + PINMUX_DATA_GP_ALL(), 666 + 667 + /* IP0SR0 */ 668 + PINMUX_IPSR_GPSR(IP0SR0_3_0, ERROROUTC_N_B), 669 + PINMUX_IPSR_GPSR(IP0SR0_3_0, TCLK2_B), 670 + 671 + PINMUX_IPSR_GPSR(IP0SR0_7_4, MSIOF3_SS1), 672 + 673 + PINMUX_IPSR_GPSR(IP0SR0_11_8, MSIOF3_SS2), 674 + 675 + PINMUX_IPSR_GPSR(IP0SR0_15_12, IRQ3), 676 + PINMUX_IPSR_GPSR(IP0SR0_15_12, MSIOF3_SCK), 677 + 678 + PINMUX_IPSR_GPSR(IP0SR0_19_16, IRQ2), 679 + PINMUX_IPSR_GPSR(IP0SR0_19_16, MSIOF3_TXD), 680 + 681 + PINMUX_IPSR_GPSR(IP0SR0_23_20, IRQ1), 682 + PINMUX_IPSR_GPSR(IP0SR0_23_20, MSIOF3_RXD), 683 + 684 + PINMUX_IPSR_GPSR(IP0SR0_27_24, IRQ0), 685 + PINMUX_IPSR_GPSR(IP0SR0_27_24, MSIOF3_SYNC), 686 + 687 + PINMUX_IPSR_GPSR(IP0SR0_31_28, MSIOF5_SS2), 688 + 689 + /* IP1SR0 */ 690 + PINMUX_IPSR_GPSR(IP1SR0_3_0, MSIOF5_SS1), 691 + 692 + PINMUX_IPSR_GPSR(IP1SR0_7_4, MSIOF5_SYNC), 693 + 694 + PINMUX_IPSR_GPSR(IP1SR0_11_8, MSIOF5_TXD), 695 + 696 + PINMUX_IPSR_GPSR(IP1SR0_15_12, MSIOF5_SCK), 697 + 698 + PINMUX_IPSR_GPSR(IP1SR0_19_16, MSIOF5_RXD), 699 + 700 + PINMUX_IPSR_GPSR(IP1SR0_23_20, MSIOF2_SS2), 701 + PINMUX_IPSR_GPSR(IP1SR0_23_20, TCLK1_A), 702 + PINMUX_IPSR_GPSR(IP1SR0_23_20, IRQ2_B), 703 + 704 + PINMUX_IPSR_GPSR(IP1SR0_27_24, MSIOF2_SS1), 705 + PINMUX_IPSR_GPSR(IP1SR0_27_24, HTX1_A), 706 + PINMUX_IPSR_GPSR(IP1SR0_27_24, TX1_A), 707 + 708 + PINMUX_IPSR_GPSR(IP1SR0_31_28, MSIOF2_SYNC), 709 + PINMUX_IPSR_GPSR(IP1SR0_31_28, HRX1_A), 710 + PINMUX_IPSR_GPSR(IP1SR0_31_28, RX1_A), 711 + 712 + /* IP2SR0 */ 713 + PINMUX_IPSR_GPSR(IP2SR0_3_0, MSIOF2_TXD), 714 + PINMUX_IPSR_GPSR(IP2SR0_3_0, HCTS1_N_A), 715 + PINMUX_IPSR_GPSR(IP2SR0_3_0, CTS1_N_A), 716 + 717 + PINMUX_IPSR_GPSR(IP2SR0_7_4, MSIOF2_SCK), 718 + PINMUX_IPSR_GPSR(IP2SR0_7_4, HRTS1_N_A), 719 + PINMUX_IPSR_GPSR(IP2SR0_7_4, RTS1_N_A), 720 + 721 + PINMUX_IPSR_GPSR(IP2SR0_11_8, MSIOF2_RXD), 722 + PINMUX_IPSR_GPSR(IP2SR0_11_8, HSCK1_A), 723 + PINMUX_IPSR_GPSR(IP2SR0_11_8, SCK1_A), 724 + 725 + /* IP0SR1 */ 726 + PINMUX_IPSR_GPSR(IP0SR1_3_0, MSIOF1_SS2), 727 + PINMUX_IPSR_GPSR(IP0SR1_3_0, HTX3_B), 728 + PINMUX_IPSR_GPSR(IP0SR1_3_0, TX3_B), 729 + 730 + PINMUX_IPSR_GPSR(IP0SR1_7_4, MSIOF1_SS1), 731 + PINMUX_IPSR_GPSR(IP0SR1_7_4, HCTS3_N_B), 732 + PINMUX_IPSR_GPSR(IP0SR1_7_4, RX3_B), 733 + 734 + PINMUX_IPSR_GPSR(IP0SR1_11_8, MSIOF1_SYNC), 735 + PINMUX_IPSR_GPSR(IP0SR1_11_8, HRTS3_N_B), 736 + PINMUX_IPSR_GPSR(IP0SR1_11_8, RTS3_N_B), 737 + 738 + PINMUX_IPSR_GPSR(IP0SR1_15_12, MSIOF1_SCK), 739 + PINMUX_IPSR_GPSR(IP0SR1_15_12, HSCK3_B), 740 + PINMUX_IPSR_GPSR(IP0SR1_15_12, CTS3_N_B), 741 + 742 + PINMUX_IPSR_GPSR(IP0SR1_19_16, MSIOF1_TXD), 743 + PINMUX_IPSR_GPSR(IP0SR1_19_16, HRX3_B), 744 + PINMUX_IPSR_GPSR(IP0SR1_19_16, SCK3_B), 745 + 746 + PINMUX_IPSR_GPSR(IP0SR1_23_20, MSIOF1_RXD), 747 + 748 + PINMUX_IPSR_GPSR(IP0SR1_27_24, MSIOF0_SS2), 749 + PINMUX_IPSR_GPSR(IP0SR1_27_24, HTX1_B), 750 + PINMUX_IPSR_GPSR(IP0SR1_27_24, TX1_B), 751 + 752 + PINMUX_IPSR_GPSR(IP0SR1_31_28, MSIOF0_SS1), 753 + PINMUX_IPSR_GPSR(IP0SR1_31_28, HRX1_B), 754 + PINMUX_IPSR_GPSR(IP0SR1_31_28, RX1_B), 755 + 756 + /* IP1SR1 */ 757 + PINMUX_IPSR_GPSR(IP1SR1_3_0, MSIOF0_SYNC), 758 + PINMUX_IPSR_GPSR(IP1SR1_3_0, HCTS1_N_B), 759 + PINMUX_IPSR_GPSR(IP1SR1_3_0, CTS1_N_B), 760 + 761 + PINMUX_IPSR_GPSR(IP1SR1_7_4, MSIOF0_TXD), 762 + PINMUX_IPSR_GPSR(IP1SR1_7_4, HRTS1_N_B), 763 + PINMUX_IPSR_GPSR(IP1SR1_7_4, RTS1_N_B), 764 + 765 + PINMUX_IPSR_GPSR(IP1SR1_11_8, MSIOF0_SCK), 766 + PINMUX_IPSR_GPSR(IP1SR1_11_8, HSCK1_B), 767 + PINMUX_IPSR_GPSR(IP1SR1_11_8, SCK1_B), 768 + 769 + PINMUX_IPSR_GPSR(IP1SR1_15_12, MSIOF0_RXD), 770 + 771 + PINMUX_IPSR_GPSR(IP1SR1_19_16, HTX0), 772 + PINMUX_IPSR_GPSR(IP1SR1_19_16, TX0), 773 + 774 + PINMUX_IPSR_GPSR(IP1SR1_23_20, HCTS0_N), 775 + PINMUX_IPSR_GPSR(IP1SR1_23_20, CTS0_N), 776 + 777 + PINMUX_IPSR_GPSR(IP1SR1_27_24, HRTS0_N), 778 + PINMUX_IPSR_GPSR(IP1SR1_27_24, RTS0_N), 779 + PINMUX_IPSR_GPSR(IP1SR1_27_24, PWM0_B), 780 + 781 + PINMUX_IPSR_GPSR(IP1SR1_31_28, HSCK0), 782 + PINMUX_IPSR_GPSR(IP1SR1_31_28, SCK0), 783 + PINMUX_IPSR_GPSR(IP1SR1_31_28, PWM0_A), 784 + 785 + /* IP2SR1 */ 786 + PINMUX_IPSR_GPSR(IP2SR1_3_0, HRX0), 787 + PINMUX_IPSR_GPSR(IP2SR1_3_0, RX0), 788 + 789 + PINMUX_IPSR_GPSR(IP2SR1_7_4, SCIF_CLK), 790 + PINMUX_IPSR_GPSR(IP2SR1_7_4, IRQ4_A), 791 + 792 + PINMUX_IPSR_GPSR(IP2SR1_11_8, SSI_SCK), 793 + PINMUX_IPSR_GPSR(IP2SR1_11_8, TCLK3_B), 794 + 795 + PINMUX_IPSR_GPSR(IP2SR1_15_12, SSI_WS), 796 + PINMUX_IPSR_GPSR(IP2SR1_15_12, TCLK4_B), 797 + 798 + PINMUX_IPSR_GPSR(IP2SR1_19_16, SSI_SD), 799 + PINMUX_IPSR_GPSR(IP2SR1_19_16, IRQ0_B), 800 + 801 + PINMUX_IPSR_GPSR(IP2SR1_23_20, AUDIO_CLKOUT), 802 + PINMUX_IPSR_GPSR(IP2SR1_23_20, IRQ1_B), 803 + 804 + PINMUX_IPSR_GPSR(IP2SR1_27_24, AUDIO_CLKIN), 805 + PINMUX_IPSR_GPSR(IP2SR1_27_24, PWM3_C), 806 + 807 + PINMUX_IPSR_GPSR(IP2SR1_31_28, TCLK2_A), 808 + PINMUX_IPSR_GPSR(IP2SR1_31_28, MSIOF4_SS1), 809 + PINMUX_IPSR_GPSR(IP2SR1_31_28, IRQ3_B), 810 + 811 + /* IP3SR1 */ 812 + PINMUX_IPSR_GPSR(IP3SR1_3_0, HRX3_A), 813 + PINMUX_IPSR_GPSR(IP3SR1_3_0, SCK3_A), 814 + PINMUX_IPSR_GPSR(IP3SR1_3_0, MSIOF4_SS2), 815 + 816 + PINMUX_IPSR_GPSR(IP3SR1_7_4, HSCK3_A), 817 + PINMUX_IPSR_GPSR(IP3SR1_7_4, CTS3_N_A), 818 + PINMUX_IPSR_GPSR(IP3SR1_7_4, MSIOF4_SCK), 819 + PINMUX_IPSR_GPSR(IP3SR1_7_4, TPU0TO0_B), 820 + 821 + PINMUX_IPSR_GPSR(IP3SR1_11_8, HRTS3_N_A), 822 + PINMUX_IPSR_GPSR(IP3SR1_11_8, RTS3_N_A), 823 + PINMUX_IPSR_GPSR(IP3SR1_11_8, MSIOF4_TXD), 824 + PINMUX_IPSR_GPSR(IP3SR1_11_8, TPU0TO1_B), 825 + 826 + PINMUX_IPSR_GPSR(IP3SR1_15_12, HCTS3_N_A), 827 + PINMUX_IPSR_GPSR(IP3SR1_15_12, RX3_A), 828 + PINMUX_IPSR_GPSR(IP3SR1_15_12, MSIOF4_RXD), 829 + 830 + PINMUX_IPSR_GPSR(IP3SR1_19_16, HTX3_A), 831 + PINMUX_IPSR_GPSR(IP3SR1_19_16, TX3_A), 832 + PINMUX_IPSR_GPSR(IP3SR1_19_16, MSIOF4_SYNC), 833 + 834 + PINMUX_IPSR_GPSR(IP3SR1_23_20, ERROROUTC_N_A), 835 + 836 + /* IP0SR2 */ 837 + PINMUX_IPSR_GPSR(IP0SR2_3_0, FXR_TXDA), 838 + PINMUX_IPSR_GPSR(IP0SR2_3_0, TPU0TO2_B), 839 + 840 + PINMUX_IPSR_GPSR(IP0SR2_7_4, FXR_TXENA_N_A), 841 + PINMUX_IPSR_GPSR(IP0SR2_7_4, TPU0TO3_B), 842 + 843 + PINMUX_IPSR_GPSR(IP0SR2_11_8, RXDA_EXTFXR), 844 + PINMUX_IPSR_GPSR(IP0SR2_11_8, IRQ5), 845 + 846 + PINMUX_IPSR_GPSR(IP0SR2_15_12, CLK_EXTFXR), 847 + PINMUX_IPSR_GPSR(IP0SR2_15_12, IRQ4_B), 848 + 849 + PINMUX_IPSR_GPSR(IP0SR2_19_16, RXDB_EXTFXR), 850 + 851 + PINMUX_IPSR_GPSR(IP0SR2_23_20, FXR_TXENB_N_A), 852 + 853 + PINMUX_IPSR_GPSR(IP0SR2_27_24, FXR_TXDB), 854 + 855 + PINMUX_IPSR_GPSR(IP0SR2_31_28, TPU0TO1_A), 856 + PINMUX_IPSR_GPSR(IP0SR2_31_28, TCLK2_C), 857 + 858 + /* IP1SR2 */ 859 + PINMUX_IPSR_GPSR(IP1SR2_3_0, TPU0TO0_A), 860 + PINMUX_IPSR_GPSR(IP1SR2_3_0, TCLK1_B), 861 + 862 + PINMUX_IPSR_GPSR(IP1SR2_7_4, CAN_CLK), 863 + PINMUX_IPSR_GPSR(IP1SR2_7_4, FXR_TXENA_N_B), 864 + 865 + PINMUX_IPSR_GPSR(IP1SR2_11_8, CANFD0_TX), 866 + PINMUX_IPSR_GPSR(IP1SR2_11_8, FXR_TXENB_N_B), 867 + 868 + PINMUX_IPSR_GPSR(IP1SR2_15_12, CANFD0_RX), 869 + PINMUX_IPSR_GPSR(IP1SR2_15_12, STPWT_EXTFXR), 870 + 871 + PINMUX_IPSR_GPSR(IP1SR2_19_16, CANFD2_TX), 872 + PINMUX_IPSR_GPSR(IP1SR2_19_16, TPU0TO2_A), 873 + PINMUX_IPSR_GPSR(IP1SR2_19_16, TCLK3_C), 874 + 875 + PINMUX_IPSR_GPSR(IP1SR2_23_20, CANFD2_RX), 876 + PINMUX_IPSR_GPSR(IP1SR2_23_20, TPU0TO3_A), 877 + PINMUX_IPSR_GPSR(IP1SR2_23_20, PWM1_B), 878 + PINMUX_IPSR_GPSR(IP1SR2_23_20, TCLK4_C), 879 + 880 + PINMUX_IPSR_GPSR(IP1SR2_27_24, CANFD3_TX), 881 + PINMUX_IPSR_GPSR(IP1SR2_27_24, PWM2_B), 882 + 883 + PINMUX_IPSR_GPSR(IP1SR2_31_28, CANFD3_RX), 884 + PINMUX_IPSR_GPSR(IP1SR2_31_28, PWM3_B), 885 + 886 + /* IP2SR2 */ 887 + PINMUX_IPSR_GPSR(IP2SR2_7_4, CANFD1_TX), 888 + PINMUX_IPSR_GPSR(IP2SR2_7_4, PWM1_C), 889 + 890 + PINMUX_IPSR_GPSR(IP2SR2_15_12, CANFD1_RX), 891 + PINMUX_IPSR_GPSR(IP2SR2_15_12, PWM2_C), 892 + 893 + /* IP0SR3 */ 894 + PINMUX_IPSR_GPSR(IP0SR3_3_0, MMC_SD_D1), 895 + 896 + PINMUX_IPSR_GPSR(IP0SR3_7_4, MMC_SD_D0), 897 + 898 + PINMUX_IPSR_GPSR(IP0SR3_11_8, MMC_SD_D2), 899 + 900 + PINMUX_IPSR_GPSR(IP0SR3_15_12, MMC_SD_CLK), 901 + 902 + PINMUX_IPSR_GPSR(IP0SR3_19_16, MMC_DS), 903 + 904 + PINMUX_IPSR_GPSR(IP0SR3_23_20, MMC_SD_D3), 905 + 906 + PINMUX_IPSR_GPSR(IP0SR3_27_24, MMC_D5), 907 + 908 + PINMUX_IPSR_GPSR(IP0SR3_31_28, MMC_D4), 909 + 910 + /* IP1SR3 */ 911 + PINMUX_IPSR_GPSR(IP1SR3_3_0, MMC_D7), 912 + 913 + PINMUX_IPSR_GPSR(IP1SR3_7_4, MMC_D6), 914 + 915 + PINMUX_IPSR_GPSR(IP1SR3_11_8, MMC_SD_CMD), 916 + 917 + PINMUX_IPSR_GPSR(IP1SR3_15_12, SD_CD), 918 + 919 + PINMUX_IPSR_GPSR(IP1SR3_19_16, SD_WP), 920 + 921 + PINMUX_IPSR_GPSR(IP1SR3_23_20, PWM1_A), 922 + 923 + PINMUX_IPSR_GPSR(IP1SR3_27_24, PWM2_A), 924 + 925 + PINMUX_IPSR_GPSR(IP1SR3_31_28, QSPI0_SSL), 926 + 927 + /* IP2SR3 */ 928 + PINMUX_IPSR_GPSR(IP2SR3_3_0, QSPI0_IO3), 929 + 930 + PINMUX_IPSR_GPSR(IP2SR3_7_4, QSPI0_IO2), 931 + 932 + PINMUX_IPSR_GPSR(IP2SR3_11_8, QSPI0_MISO_IO1), 933 + 934 + PINMUX_IPSR_GPSR(IP2SR3_15_12, QSPI0_MOSI_IO0), 935 + 936 + PINMUX_IPSR_GPSR(IP2SR3_19_16, QSPI0_SPCLK), 937 + 938 + PINMUX_IPSR_GPSR(IP2SR3_23_20, QSPI1_MOSI_IO0), 939 + 940 + PINMUX_IPSR_GPSR(IP2SR3_27_24, QSPI1_SPCLK), 941 + 942 + PINMUX_IPSR_GPSR(IP2SR3_31_28, QSPI1_MISO_IO1), 943 + 944 + /* IP3SR3 */ 945 + PINMUX_IPSR_GPSR(IP3SR3_3_0, QSPI1_IO2), 946 + 947 + PINMUX_IPSR_GPSR(IP3SR3_7_4, QSPI1_SSL), 948 + 949 + PINMUX_IPSR_GPSR(IP3SR3_11_8, QSPI1_IO3), 950 + 951 + PINMUX_IPSR_GPSR(IP3SR3_15_12, RPC_RESET_N), 952 + 953 + PINMUX_IPSR_GPSR(IP3SR3_19_16, RPC_WP_N), 954 + 955 + PINMUX_IPSR_GPSR(IP3SR3_23_20, RPC_INT_N), 956 + 957 + PINMUX_IPSR_GPSR(IP3SR3_27_24, TCLK3_A), 958 + 959 + PINMUX_IPSR_GPSR(IP3SR3_31_28, TCLK4_A), 960 + 961 + /* IP0SR4 */ 962 + PINMUX_IPSR_MSEL(IP0SR4_3_0, SCL0, SEL_SCL0_0), 963 + 964 + PINMUX_IPSR_MSEL(IP0SR4_7_4, SDA0, SEL_SDA0_0), 965 + 966 + PINMUX_IPSR_MSEL(IP0SR4_11_8, SCL1, SEL_SCL1_0), 967 + 968 + PINMUX_IPSR_MSEL(IP0SR4_15_12, SDA1, SEL_SDA1_0), 969 + 970 + PINMUX_IPSR_MSEL(IP0SR4_19_16, SCL2, SEL_SCL2_0), 971 + 972 + PINMUX_IPSR_MSEL(IP0SR4_23_20, SDA2, SEL_SDA2_0), 973 + 974 + PINMUX_IPSR_MSEL(IP0SR4_27_24, SCL3, SEL_SCL3_0), 975 + 976 + PINMUX_IPSR_MSEL(IP0SR4_31_28, SDA3, SEL_SDA3_0), 977 + 978 + /* IP1SR4 */ 979 + PINMUX_IPSR_GPSR(IP1SR4_3_0, HRX2), 980 + PINMUX_IPSR_GPSR(IP1SR4_3_0, SCK4), 981 + 982 + PINMUX_IPSR_GPSR(IP1SR4_7_4, HTX2), 983 + PINMUX_IPSR_GPSR(IP1SR4_7_4, CTS4_N), 984 + 985 + PINMUX_IPSR_GPSR(IP1SR4_11_8, HRTS2_N), 986 + PINMUX_IPSR_GPSR(IP1SR4_11_8, RTS4_N), 987 + 988 + PINMUX_IPSR_GPSR(IP1SR4_15_12, SCIF_CLK2), 989 + 990 + PINMUX_IPSR_GPSR(IP1SR4_19_16, HCTS2_N), 991 + PINMUX_IPSR_GPSR(IP1SR4_19_16, TX4), 992 + 993 + PINMUX_IPSR_GPSR(IP1SR4_23_20, HSCK2), 994 + PINMUX_IPSR_GPSR(IP1SR4_23_20, RX4), 995 + 996 + PINMUX_IPSR_GPSR(IP1SR4_27_24, PWM3_A), 997 + 998 + PINMUX_IPSR_GPSR(IP1SR4_31_28, PWM4), 999 + 1000 + /* IP2SR4 */ 1001 + PINMUX_IPSR_GPSR(IP2SR4_23_20, PCIE0_CLKREQ_N), 1002 + 1003 + PINMUX_IPSR_GPSR(IP2SR4_31_28, AVS0), 1004 + 1005 + /* IP3SR4 */ 1006 + PINMUX_IPSR_GPSR(IP3SR4_3_0, AVS1), 1007 + 1008 + /* IP0SR5 */ 1009 + PINMUX_IPSR_GPSR(IP0SR5_3_0, AVB2_AVTP_PPS), 1010 + PINMUX_IPSR_GPSR(IP0SR5_3_0, Ether_GPTP_PPS0), 1011 + 1012 + PINMUX_IPSR_GPSR(IP0SR5_7_4, AVB2_AVTP_CAPTURE), 1013 + PINMUX_IPSR_GPSR(IP0SR5_7_4, Ether_GPTP_CAPTURE), 1014 + 1015 + PINMUX_IPSR_GPSR(IP0SR5_11_8, AVB2_AVTP_MATCH), 1016 + PINMUX_IPSR_GPSR(IP0SR5_11_8, Ether_GPTP_MATCH), 1017 + 1018 + PINMUX_IPSR_GPSR(IP0SR5_15_12, AVB2_LINK), 1019 + 1020 + PINMUX_IPSR_GPSR(IP0SR5_19_16, AVB2_PHY_INT), 1021 + 1022 + PINMUX_IPSR_GPSR(IP0SR5_23_20, AVB2_MAGIC), 1023 + PINMUX_IPSR_GPSR(IP0SR5_23_20, Ether_GPTP_PPS1), 1024 + 1025 + PINMUX_IPSR_GPSR(IP0SR5_27_24, AVB2_MDC), 1026 + 1027 + PINMUX_IPSR_GPSR(IP0SR5_31_28, AVB2_TXCREFCLK), 1028 + 1029 + /* IP1SR5 */ 1030 + PINMUX_IPSR_GPSR(IP1SR5_3_0, AVB2_TD3), 1031 + 1032 + PINMUX_IPSR_GPSR(IP1SR5_7_4, AVB2_RD3), 1033 + 1034 + PINMUX_IPSR_GPSR(IP1SR5_11_8, AVB2_MDIO), 1035 + 1036 + PINMUX_IPSR_GPSR(IP1SR5_15_12, AVB2_TD2), 1037 + 1038 + PINMUX_IPSR_GPSR(IP1SR5_19_16, AVB2_TD1), 1039 + 1040 + PINMUX_IPSR_GPSR(IP1SR5_23_20, AVB2_RD2), 1041 + 1042 + PINMUX_IPSR_GPSR(IP1SR5_27_24, AVB2_RD1), 1043 + 1044 + PINMUX_IPSR_GPSR(IP1SR5_31_28, AVB2_TD0), 1045 + 1046 + /* IP2SR5 */ 1047 + PINMUX_IPSR_GPSR(IP2SR5_3_0, AVB2_TXC), 1048 + 1049 + PINMUX_IPSR_GPSR(IP2SR5_7_4, AVB2_RD0), 1050 + 1051 + PINMUX_IPSR_GPSR(IP2SR5_11_8, AVB2_RXC), 1052 + 1053 + PINMUX_IPSR_GPSR(IP2SR5_15_12, AVB2_TX_CTL), 1054 + 1055 + PINMUX_IPSR_GPSR(IP2SR5_19_16, AVB2_RX_CTL), 1056 + 1057 + /* IP0SR6 */ 1058 + PINMUX_IPSR_GPSR(IP0SR6_3_0, AVB1_MDIO), 1059 + 1060 + PINMUX_IPSR_GPSR(IP0SR6_7_4, AVB1_MAGIC), 1061 + 1062 + PINMUX_IPSR_GPSR(IP0SR6_11_8, AVB1_MDC), 1063 + 1064 + PINMUX_IPSR_GPSR(IP0SR6_15_12, AVB1_PHY_INT), 1065 + 1066 + PINMUX_IPSR_GPSR(IP0SR6_19_16, AVB1_LINK), 1067 + PINMUX_IPSR_GPSR(IP0SR6_19_16, AVB1_MII_TX_ER), 1068 + 1069 + PINMUX_IPSR_GPSR(IP0SR6_23_20, AVB1_AVTP_MATCH), 1070 + PINMUX_IPSR_GPSR(IP0SR6_23_20, AVB1_MII_RX_ER), 1071 + 1072 + PINMUX_IPSR_GPSR(IP0SR6_27_24, AVB1_TXC), 1073 + PINMUX_IPSR_GPSR(IP0SR6_27_24, AVB1_MII_TXC), 1074 + 1075 + PINMUX_IPSR_GPSR(IP0SR6_31_28, AVB1_TX_CTL), 1076 + PINMUX_IPSR_GPSR(IP0SR6_31_28, AVB1_MII_TX_EN), 1077 + 1078 + /* IP1SR6 */ 1079 + PINMUX_IPSR_GPSR(IP1SR6_3_0, AVB1_RXC), 1080 + PINMUX_IPSR_GPSR(IP1SR6_3_0, AVB1_MII_RXC), 1081 + 1082 + PINMUX_IPSR_GPSR(IP1SR6_7_4, AVB1_RX_CTL), 1083 + PINMUX_IPSR_GPSR(IP1SR6_7_4, AVB1_MII_RX_DV), 1084 + 1085 + PINMUX_IPSR_GPSR(IP1SR6_11_8, AVB1_AVTP_PPS), 1086 + PINMUX_IPSR_GPSR(IP1SR6_11_8, AVB1_MII_COL), 1087 + 1088 + PINMUX_IPSR_GPSR(IP1SR6_15_12, AVB1_AVTP_CAPTURE), 1089 + PINMUX_IPSR_GPSR(IP1SR6_15_12, AVB1_MII_CRS), 1090 + 1091 + PINMUX_IPSR_GPSR(IP1SR6_19_16, AVB1_TD1), 1092 + PINMUX_IPSR_GPSR(IP1SR6_19_16, AVB1_MII_TD1), 1093 + 1094 + PINMUX_IPSR_GPSR(IP1SR6_23_20, AVB1_TD0), 1095 + PINMUX_IPSR_GPSR(IP1SR6_23_20, AVB1_MII_TD0), 1096 + 1097 + PINMUX_IPSR_GPSR(IP1SR6_27_24, AVB1_RD1), 1098 + PINMUX_IPSR_GPSR(IP1SR6_27_24, AVB1_MII_RD1), 1099 + 1100 + PINMUX_IPSR_GPSR(IP1SR6_31_28, AVB1_RD0), 1101 + PINMUX_IPSR_GPSR(IP1SR6_31_28, AVB1_MII_RD0), 1102 + 1103 + /* IP2SR6 */ 1104 + PINMUX_IPSR_GPSR(IP2SR6_3_0, AVB1_TD2), 1105 + PINMUX_IPSR_GPSR(IP2SR6_3_0, AVB1_MII_TD2), 1106 + 1107 + PINMUX_IPSR_GPSR(IP2SR6_7_4, AVB1_RD2), 1108 + PINMUX_IPSR_GPSR(IP2SR6_7_4, AVB1_MII_RD2), 1109 + 1110 + PINMUX_IPSR_GPSR(IP2SR6_11_8, AVB1_TD3), 1111 + PINMUX_IPSR_GPSR(IP2SR6_11_8, AVB1_MII_TD3), 1112 + 1113 + PINMUX_IPSR_GPSR(IP2SR6_15_12, AVB1_RD3), 1114 + PINMUX_IPSR_GPSR(IP2SR6_15_12, AVB1_MII_RD3), 1115 + 1116 + PINMUX_IPSR_GPSR(IP2SR6_19_16, AVB1_TXCREFCLK), 1117 + 1118 + /* IP0SR7 */ 1119 + PINMUX_IPSR_GPSR(IP0SR7_3_0, AVB0_AVTP_PPS), 1120 + PINMUX_IPSR_GPSR(IP0SR7_3_0, AVB0_MII_COL), 1121 + 1122 + PINMUX_IPSR_GPSR(IP0SR7_7_4, AVB0_AVTP_CAPTURE), 1123 + PINMUX_IPSR_GPSR(IP0SR7_7_4, AVB0_MII_CRS), 1124 + 1125 + PINMUX_IPSR_GPSR(IP0SR7_11_8, AVB0_AVTP_MATCH), 1126 + PINMUX_IPSR_GPSR(IP0SR7_11_8, AVB0_MII_RX_ER), 1127 + PINMUX_IPSR_GPSR(IP0SR7_11_8, CC5_OSCOUT), 1128 + 1129 + PINMUX_IPSR_GPSR(IP0SR7_15_12, AVB0_TD3), 1130 + PINMUX_IPSR_GPSR(IP0SR7_15_12, AVB0_MII_TD3), 1131 + 1132 + PINMUX_IPSR_GPSR(IP0SR7_19_16, AVB0_LINK), 1133 + PINMUX_IPSR_GPSR(IP0SR7_19_16, AVB0_MII_TX_ER), 1134 + 1135 + PINMUX_IPSR_GPSR(IP0SR7_23_20, AVB0_PHY_INT), 1136 + 1137 + PINMUX_IPSR_GPSR(IP0SR7_27_24, AVB0_TD2), 1138 + PINMUX_IPSR_GPSR(IP0SR7_27_24, AVB0_MII_TD2), 1139 + 1140 + PINMUX_IPSR_GPSR(IP0SR7_31_28, AVB0_TD1), 1141 + PINMUX_IPSR_GPSR(IP0SR7_31_28, AVB0_MII_TD1), 1142 + 1143 + /* IP1SR7 */ 1144 + PINMUX_IPSR_GPSR(IP1SR7_3_0, AVB0_RD3), 1145 + PINMUX_IPSR_GPSR(IP1SR7_3_0, AVB0_MII_RD3), 1146 + 1147 + PINMUX_IPSR_GPSR(IP1SR7_7_4, AVB0_TXCREFCLK), 1148 + 1149 + PINMUX_IPSR_GPSR(IP1SR7_11_8, AVB0_MAGIC), 1150 + 1151 + PINMUX_IPSR_GPSR(IP1SR7_15_12, AVB0_TD0), 1152 + PINMUX_IPSR_GPSR(IP1SR7_15_12, AVB0_MII_TD0), 1153 + 1154 + PINMUX_IPSR_GPSR(IP1SR7_19_16, AVB0_RD2), 1155 + PINMUX_IPSR_GPSR(IP1SR7_19_16, AVB0_MII_RD2), 1156 + 1157 + PINMUX_IPSR_GPSR(IP1SR7_23_20, AVB0_MDC), 1158 + 1159 + PINMUX_IPSR_GPSR(IP1SR7_27_24, AVB0_MDIO), 1160 + 1161 + PINMUX_IPSR_GPSR(IP1SR7_31_28, AVB0_TXC), 1162 + PINMUX_IPSR_GPSR(IP1SR7_31_28, AVB0_MII_TXC), 1163 + 1164 + /* IP2SR7 */ 1165 + PINMUX_IPSR_GPSR(IP2SR7_3_0, AVB0_TX_CTL), 1166 + PINMUX_IPSR_GPSR(IP2SR7_3_0, AVB0_MII_TX_EN), 1167 + 1168 + PINMUX_IPSR_GPSR(IP2SR7_7_4, AVB0_RD1), 1169 + PINMUX_IPSR_GPSR(IP2SR7_7_4, AVB0_MII_RD1), 1170 + 1171 + PINMUX_IPSR_GPSR(IP2SR7_11_8, AVB0_RD0), 1172 + PINMUX_IPSR_GPSR(IP2SR7_11_8, AVB0_MII_RD0), 1173 + 1174 + PINMUX_IPSR_GPSR(IP2SR7_15_12, AVB0_RXC), 1175 + PINMUX_IPSR_GPSR(IP2SR7_15_12, AVB0_MII_RXC), 1176 + 1177 + PINMUX_IPSR_GPSR(IP2SR7_19_16, AVB0_RX_CTL), 1178 + PINMUX_IPSR_GPSR(IP2SR7_19_16, AVB0_MII_RX_DV), 1179 + }; 1180 + 1181 + /* 1182 + * Pins not associated with a GPIO port. 1183 + */ 1184 + enum { 1185 + GP_ASSIGN_LAST(), 1186 + NOGP_ALL(), 1187 + }; 1188 + 1189 + static const struct sh_pfc_pin pinmux_pins[] = { 1190 + PINMUX_GPIO_GP_ALL(), 1191 + PINMUX_NOGP_ALL(), 1192 + }; 1193 + 1194 + /* - AUDIO CLOCK ----------------------------------------- */ 1195 + static const unsigned int audio_clkin_pins[] = { 1196 + /* CLK IN */ 1197 + RCAR_GP_PIN(1, 22), 1198 + }; 1199 + static const unsigned int audio_clkin_mux[] = { 1200 + AUDIO_CLKIN_MARK, 1201 + }; 1202 + static const unsigned int audio_clkout_pins[] = { 1203 + /* CLK OUT */ 1204 + RCAR_GP_PIN(1, 21), 1205 + }; 1206 + static const unsigned int audio_clkout_mux[] = { 1207 + AUDIO_CLKOUT_MARK, 1208 + }; 1209 + 1210 + /* - AVB0 ------------------------------------------------ */ 1211 + static const unsigned int avb0_link_pins[] = { 1212 + /* AVB0_LINK */ 1213 + RCAR_GP_PIN(7, 4), 1214 + }; 1215 + static const unsigned int avb0_link_mux[] = { 1216 + AVB0_LINK_MARK, 1217 + }; 1218 + static const unsigned int avb0_magic_pins[] = { 1219 + /* AVB0_MAGIC */ 1220 + RCAR_GP_PIN(7, 10), 1221 + }; 1222 + static const unsigned int avb0_magic_mux[] = { 1223 + AVB0_MAGIC_MARK, 1224 + }; 1225 + static const unsigned int avb0_phy_int_pins[] = { 1226 + /* AVB0_PHY_INT */ 1227 + RCAR_GP_PIN(7, 5), 1228 + }; 1229 + static const unsigned int avb0_phy_int_mux[] = { 1230 + AVB0_PHY_INT_MARK, 1231 + }; 1232 + static const unsigned int avb0_mdio_pins[] = { 1233 + /* AVB0_MDC, AVB0_MDIO */ 1234 + RCAR_GP_PIN(7, 13), RCAR_GP_PIN(7, 14), 1235 + }; 1236 + static const unsigned int avb0_mdio_mux[] = { 1237 + AVB0_MDC_MARK, AVB0_MDIO_MARK, 1238 + }; 1239 + static const unsigned int avb0_rgmii_pins[] = { 1240 + /* 1241 + * AVB0_TX_CTL, AVB0_TXC, AVB0_TD0, AVB0_TD1, AVB0_TD2, AVB0_TD3, 1242 + * AVB0_RX_CTL, AVB0_RXC, AVB0_RD0, AVB0_RD1, AVB0_RD2, AVB0_RD3, 1243 + */ 1244 + RCAR_GP_PIN(7, 16), RCAR_GP_PIN(7, 15), 1245 + RCAR_GP_PIN(7, 11), RCAR_GP_PIN(7, 7), 1246 + RCAR_GP_PIN(7, 6), RCAR_GP_PIN(7, 3), 1247 + RCAR_GP_PIN(7, 20), RCAR_GP_PIN(7, 19), 1248 + RCAR_GP_PIN(7, 18), RCAR_GP_PIN(7, 17), 1249 + RCAR_GP_PIN(7, 12), RCAR_GP_PIN(7, 8), 1250 + }; 1251 + static const unsigned int avb0_rgmii_mux[] = { 1252 + AVB0_TX_CTL_MARK, AVB0_TXC_MARK, 1253 + AVB0_TD0_MARK, AVB0_TD1_MARK, 1254 + AVB0_TD2_MARK, AVB0_TD3_MARK, 1255 + AVB0_RX_CTL_MARK, AVB0_RXC_MARK, 1256 + AVB0_RD0_MARK, AVB0_RD1_MARK, 1257 + AVB0_RD2_MARK, AVB0_RD3_MARK, 1258 + }; 1259 + static const unsigned int avb0_txcrefclk_pins[] = { 1260 + /* AVB0_TXCREFCLK */ 1261 + RCAR_GP_PIN(7, 9), 1262 + }; 1263 + static const unsigned int avb0_txcrefclk_mux[] = { 1264 + AVB0_TXCREFCLK_MARK, 1265 + }; 1266 + static const unsigned int avb0_avtp_pps_pins[] = { 1267 + /* AVB0_AVTP_PPS */ 1268 + RCAR_GP_PIN(7, 0), 1269 + }; 1270 + static const unsigned int avb0_avtp_pps_mux[] = { 1271 + AVB0_AVTP_PPS_MARK, 1272 + }; 1273 + static const unsigned int avb0_avtp_capture_pins[] = { 1274 + /* AVB0_AVTP_CAPTURE */ 1275 + RCAR_GP_PIN(7, 1), 1276 + }; 1277 + static const unsigned int avb0_avtp_capture_mux[] = { 1278 + AVB0_AVTP_CAPTURE_MARK, 1279 + }; 1280 + static const unsigned int avb0_avtp_match_pins[] = { 1281 + /* AVB0_AVTP_MATCH */ 1282 + RCAR_GP_PIN(7, 2), 1283 + }; 1284 + static const unsigned int avb0_avtp_match_mux[] = { 1285 + AVB0_AVTP_MATCH_MARK, 1286 + }; 1287 + 1288 + /* - AVB1 ------------------------------------------------ */ 1289 + static const unsigned int avb1_link_pins[] = { 1290 + /* AVB1_LINK */ 1291 + RCAR_GP_PIN(6, 4), 1292 + }; 1293 + static const unsigned int avb1_link_mux[] = { 1294 + AVB1_LINK_MARK, 1295 + }; 1296 + static const unsigned int avb1_magic_pins[] = { 1297 + /* AVB1_MAGIC */ 1298 + RCAR_GP_PIN(6, 1), 1299 + }; 1300 + static const unsigned int avb1_magic_mux[] = { 1301 + AVB1_MAGIC_MARK, 1302 + }; 1303 + static const unsigned int avb1_phy_int_pins[] = { 1304 + /* AVB1_PHY_INT */ 1305 + RCAR_GP_PIN(6, 3), 1306 + }; 1307 + static const unsigned int avb1_phy_int_mux[] = { 1308 + AVB1_PHY_INT_MARK, 1309 + }; 1310 + static const unsigned int avb1_mdio_pins[] = { 1311 + /* AVB1_MDC, AVB1_MDIO */ 1312 + RCAR_GP_PIN(6, 2), RCAR_GP_PIN(6, 0), 1313 + }; 1314 + static const unsigned int avb1_mdio_mux[] = { 1315 + AVB1_MDC_MARK, AVB1_MDIO_MARK, 1316 + }; 1317 + static const unsigned int avb1_rgmii_pins[] = { 1318 + /* 1319 + * AVB1_TX_CTL, AVB1_TXC, AVB1_TD0, AVB1_TD1, AVB1_TD2, AVB1_TD3, 1320 + * AVB1_RX_CTL, AVB1_RXC, AVB1_RD0, AVB1_RD1, AVB1_RD2, AVB1_RD3, 1321 + */ 1322 + RCAR_GP_PIN(6, 7), RCAR_GP_PIN(6, 6), 1323 + RCAR_GP_PIN(6, 13), RCAR_GP_PIN(6, 12), 1324 + RCAR_GP_PIN(6, 16), RCAR_GP_PIN(6, 18), 1325 + RCAR_GP_PIN(6, 9), RCAR_GP_PIN(6, 8), 1326 + RCAR_GP_PIN(6, 15), RCAR_GP_PIN(6, 14), 1327 + RCAR_GP_PIN(6, 17), RCAR_GP_PIN(6, 19), 1328 + }; 1329 + static const unsigned int avb1_rgmii_mux[] = { 1330 + AVB1_TX_CTL_MARK, AVB1_TXC_MARK, 1331 + AVB1_TD0_MARK, AVB1_TD1_MARK, 1332 + AVB1_TD2_MARK, AVB1_TD3_MARK, 1333 + AVB1_RX_CTL_MARK, AVB1_RXC_MARK, 1334 + AVB1_RD0_MARK, AVB1_RD1_MARK, 1335 + AVB1_RD2_MARK, AVB1_RD3_MARK, 1336 + }; 1337 + static const unsigned int avb1_txcrefclk_pins[] = { 1338 + /* AVB1_TXCREFCLK */ 1339 + RCAR_GP_PIN(6, 20), 1340 + }; 1341 + static const unsigned int avb1_txcrefclk_mux[] = { 1342 + AVB1_TXCREFCLK_MARK, 1343 + }; 1344 + static const unsigned int avb1_avtp_pps_pins[] = { 1345 + /* AVB1_AVTP_PPS */ 1346 + RCAR_GP_PIN(6, 10), 1347 + }; 1348 + static const unsigned int avb1_avtp_pps_mux[] = { 1349 + AVB1_AVTP_PPS_MARK, 1350 + }; 1351 + static const unsigned int avb1_avtp_capture_pins[] = { 1352 + /* AVB1_AVTP_CAPTURE */ 1353 + RCAR_GP_PIN(6, 11), 1354 + }; 1355 + static const unsigned int avb1_avtp_capture_mux[] = { 1356 + AVB1_AVTP_CAPTURE_MARK, 1357 + }; 1358 + static const unsigned int avb1_avtp_match_pins[] = { 1359 + /* AVB1_AVTP_MATCH */ 1360 + RCAR_GP_PIN(6, 5), 1361 + }; 1362 + static const unsigned int avb1_avtp_match_mux[] = { 1363 + AVB1_AVTP_MATCH_MARK, 1364 + }; 1365 + 1366 + /* - AVB2 ------------------------------------------------ */ 1367 + static const unsigned int avb2_link_pins[] = { 1368 + /* AVB2_LINK */ 1369 + RCAR_GP_PIN(5, 3), 1370 + }; 1371 + static const unsigned int avb2_link_mux[] = { 1372 + AVB2_LINK_MARK, 1373 + }; 1374 + static const unsigned int avb2_magic_pins[] = { 1375 + /* AVB2_MAGIC */ 1376 + RCAR_GP_PIN(5, 5), 1377 + }; 1378 + static const unsigned int avb2_magic_mux[] = { 1379 + AVB2_MAGIC_MARK, 1380 + }; 1381 + static const unsigned int avb2_phy_int_pins[] = { 1382 + /* AVB2_PHY_INT */ 1383 + RCAR_GP_PIN(5, 4), 1384 + }; 1385 + static const unsigned int avb2_phy_int_mux[] = { 1386 + AVB2_PHY_INT_MARK, 1387 + }; 1388 + static const unsigned int avb2_mdio_pins[] = { 1389 + /* AVB2_MDC, AVB2_MDIO */ 1390 + RCAR_GP_PIN(5, 6), RCAR_GP_PIN(5, 10), 1391 + }; 1392 + static const unsigned int avb2_mdio_mux[] = { 1393 + AVB2_MDC_MARK, AVB2_MDIO_MARK, 1394 + }; 1395 + static const unsigned int avb2_rgmii_pins[] = { 1396 + /* 1397 + * AVB2_TX_CTL, AVB2_TXC, AVB2_TD0, AVB2_TD1, AVB2_TD2, AVB2_TD3, 1398 + * AVB2_RX_CTL, AVB2_RXC, AVB2_RD0, AVB2_RD1, AVB2_RD2, AVB2_RD3, 1399 + */ 1400 + RCAR_GP_PIN(5, 19), RCAR_GP_PIN(5, 16), 1401 + RCAR_GP_PIN(5, 15), RCAR_GP_PIN(5, 12), 1402 + RCAR_GP_PIN(5, 11), RCAR_GP_PIN(5, 8), 1403 + RCAR_GP_PIN(5, 20), RCAR_GP_PIN(5, 18), 1404 + RCAR_GP_PIN(5, 17), RCAR_GP_PIN(5, 14), 1405 + RCAR_GP_PIN(5, 13), RCAR_GP_PIN(5, 9), 1406 + }; 1407 + static const unsigned int avb2_rgmii_mux[] = { 1408 + AVB2_TX_CTL_MARK, AVB2_TXC_MARK, 1409 + AVB2_TD0_MARK, AVB2_TD1_MARK, 1410 + AVB2_TD2_MARK, AVB2_TD3_MARK, 1411 + AVB2_RX_CTL_MARK, AVB2_RXC_MARK, 1412 + AVB2_RD0_MARK, AVB2_RD1_MARK, 1413 + AVB2_RD2_MARK, AVB2_RD3_MARK, 1414 + }; 1415 + static const unsigned int avb2_txcrefclk_pins[] = { 1416 + /* AVB2_TXCREFCLK */ 1417 + RCAR_GP_PIN(5, 7), 1418 + }; 1419 + static const unsigned int avb2_txcrefclk_mux[] = { 1420 + AVB2_TXCREFCLK_MARK, 1421 + }; 1422 + static const unsigned int avb2_avtp_pps_pins[] = { 1423 + /* AVB2_AVTP_PPS */ 1424 + RCAR_GP_PIN(5, 0), 1425 + }; 1426 + static const unsigned int avb2_avtp_pps_mux[] = { 1427 + AVB2_AVTP_PPS_MARK, 1428 + }; 1429 + static const unsigned int avb2_avtp_capture_pins[] = { 1430 + /* AVB2_AVTP_CAPTURE */ 1431 + RCAR_GP_PIN(5, 1), 1432 + }; 1433 + static const unsigned int avb2_avtp_capture_mux[] = { 1434 + AVB2_AVTP_CAPTURE_MARK, 1435 + }; 1436 + static const unsigned int avb2_avtp_match_pins[] = { 1437 + /* AVB2_AVTP_MATCH */ 1438 + RCAR_GP_PIN(5, 2), 1439 + }; 1440 + static const unsigned int avb2_avtp_match_mux[] = { 1441 + AVB2_AVTP_MATCH_MARK, 1442 + }; 1443 + 1444 + /* - CANFD0 ----------------------------------------------------------------- */ 1445 + static const unsigned int canfd0_data_pins[] = { 1446 + /* CANFD0_TX, CANFD0_RX */ 1447 + RCAR_GP_PIN(2, 10), RCAR_GP_PIN(2, 11), 1448 + }; 1449 + static const unsigned int canfd0_data_mux[] = { 1450 + CANFD0_TX_MARK, CANFD0_RX_MARK, 1451 + }; 1452 + 1453 + /* - CANFD1 ----------------------------------------------------------------- */ 1454 + static const unsigned int canfd1_data_pins[] = { 1455 + /* CANFD1_TX, CANFD1_RX */ 1456 + RCAR_GP_PIN(2, 17), RCAR_GP_PIN(2, 19), 1457 + }; 1458 + static const unsigned int canfd1_data_mux[] = { 1459 + CANFD1_TX_MARK, CANFD1_RX_MARK, 1460 + }; 1461 + 1462 + /* - CANFD2 ----------------------------------------------------------------- */ 1463 + static const unsigned int canfd2_data_pins[] = { 1464 + /* CANFD2_TX, CANFD2_RX */ 1465 + RCAR_GP_PIN(2, 12), RCAR_GP_PIN(2, 13), 1466 + }; 1467 + static const unsigned int canfd2_data_mux[] = { 1468 + CANFD2_TX_MARK, CANFD2_RX_MARK, 1469 + }; 1470 + 1471 + /* - CANFD3 ----------------------------------------------------------------- */ 1472 + static const unsigned int canfd3_data_pins[] = { 1473 + /* CANFD3_TX, CANFD3_RX */ 1474 + RCAR_GP_PIN(2, 14), RCAR_GP_PIN(2, 15), 1475 + }; 1476 + static const unsigned int canfd3_data_mux[] = { 1477 + CANFD3_TX_MARK, CANFD3_RX_MARK, 1478 + }; 1479 + 1480 + /* - CANFD Clock ------------------------------------------------------------ */ 1481 + static const unsigned int can_clk_pins[] = { 1482 + /* CAN_CLK */ 1483 + RCAR_GP_PIN(2, 9), 1484 + }; 1485 + static const unsigned int can_clk_mux[] = { 1486 + CAN_CLK_MARK, 1487 + }; 1488 + 1489 + /* - HSCIF0 ----------------------------------------------------------------- */ 1490 + static const unsigned int hscif0_data_pins[] = { 1491 + /* HRX0, HTX0 */ 1492 + RCAR_GP_PIN(1, 16), RCAR_GP_PIN(1, 12), 1493 + }; 1494 + static const unsigned int hscif0_data_mux[] = { 1495 + HRX0_MARK, HTX0_MARK, 1496 + }; 1497 + static const unsigned int hscif0_clk_pins[] = { 1498 + /* HSCK0 */ 1499 + RCAR_GP_PIN(1, 15), 1500 + }; 1501 + static const unsigned int hscif0_clk_mux[] = { 1502 + HSCK0_MARK, 1503 + }; 1504 + static const unsigned int hscif0_ctrl_pins[] = { 1505 + /* HRTS0_N, HCTS0_N */ 1506 + RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 13), 1507 + }; 1508 + static const unsigned int hscif0_ctrl_mux[] = { 1509 + HRTS0_N_MARK, HCTS0_N_MARK, 1510 + }; 1511 + 1512 + /* - HSCIF1_A ----------------------------------------------------------------- */ 1513 + static const unsigned int hscif1_data_a_pins[] = { 1514 + /* HRX1_A, HTX1_A */ 1515 + RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 14), 1516 + }; 1517 + static const unsigned int hscif1_data_a_mux[] = { 1518 + HRX1_A_MARK, HTX1_A_MARK, 1519 + }; 1520 + static const unsigned int hscif1_clk_a_pins[] = { 1521 + /* HSCK1_A */ 1522 + RCAR_GP_PIN(0, 18), 1523 + }; 1524 + static const unsigned int hscif1_clk_a_mux[] = { 1525 + HSCK1_A_MARK, 1526 + }; 1527 + static const unsigned int hscif1_ctrl_a_pins[] = { 1528 + /* HRTS1_N_A, HCTS1_N_A */ 1529 + RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 16), 1530 + }; 1531 + static const unsigned int hscif1_ctrl_a_mux[] = { 1532 + HRTS1_N_A_MARK, HCTS1_N_A_MARK, 1533 + }; 1534 + 1535 + /* - HSCIF1_B ---------------------------------------------------------------- */ 1536 + static const unsigned int hscif1_data_b_pins[] = { 1537 + /* HRX1_B, HTX1_B */ 1538 + RCAR_GP_PIN(1, 7), RCAR_GP_PIN(1, 6), 1539 + }; 1540 + static const unsigned int hscif1_data_b_mux[] = { 1541 + HRX1_B_MARK, HTX1_B_MARK, 1542 + }; 1543 + static const unsigned int hscif1_clk_b_pins[] = { 1544 + /* HSCK1_B */ 1545 + RCAR_GP_PIN(1, 10), 1546 + }; 1547 + static const unsigned int hscif1_clk_b_mux[] = { 1548 + HSCK1_B_MARK, 1549 + }; 1550 + static const unsigned int hscif1_ctrl_b_pins[] = { 1551 + /* HRTS1_N_B, HCTS1_N_B */ 1552 + RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 8), 1553 + }; 1554 + static const unsigned int hscif1_ctrl_b_mux[] = { 1555 + HRTS1_N_B_MARK, HCTS1_N_B_MARK, 1556 + }; 1557 + 1558 + /* - HSCIF2 ----------------------------------------------------------------- */ 1559 + static const unsigned int hscif2_data_pins[] = { 1560 + /* HRX2, HTX2 */ 1561 + RCAR_GP_PIN(4, 8), RCAR_GP_PIN(4, 9), 1562 + }; 1563 + static const unsigned int hscif2_data_mux[] = { 1564 + HRX2_MARK, HTX2_MARK, 1565 + }; 1566 + static const unsigned int hscif2_clk_pins[] = { 1567 + /* HSCK2 */ 1568 + RCAR_GP_PIN(4, 13), 1569 + }; 1570 + static const unsigned int hscif2_clk_mux[] = { 1571 + HSCK2_MARK, 1572 + }; 1573 + static const unsigned int hscif2_ctrl_pins[] = { 1574 + /* HRTS2_N, HCTS2_N */ 1575 + RCAR_GP_PIN(4, 10), RCAR_GP_PIN(4, 12), 1576 + }; 1577 + static const unsigned int hscif2_ctrl_mux[] = { 1578 + HRTS2_N_MARK, HCTS2_N_MARK, 1579 + }; 1580 + 1581 + /* - HSCIF3_A ----------------------------------------------------------------- */ 1582 + static const unsigned int hscif3_data_a_pins[] = { 1583 + /* HRX3_A, HTX3_A */ 1584 + RCAR_GP_PIN(1, 24), RCAR_GP_PIN(1, 28), 1585 + }; 1586 + static const unsigned int hscif3_data_a_mux[] = { 1587 + HRX3_A_MARK, HTX3_A_MARK, 1588 + }; 1589 + static const unsigned int hscif3_clk_a_pins[] = { 1590 + /* HSCK3_A */ 1591 + RCAR_GP_PIN(1, 25), 1592 + }; 1593 + static const unsigned int hscif3_clk_a_mux[] = { 1594 + HSCK3_A_MARK, 1595 + }; 1596 + static const unsigned int hscif3_ctrl_a_pins[] = { 1597 + /* HRTS3_N_A, HCTS3_N_A */ 1598 + RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 27), 1599 + }; 1600 + static const unsigned int hscif3_ctrl_a_mux[] = { 1601 + HRTS3_N_A_MARK, HCTS3_N_A_MARK, 1602 + }; 1603 + 1604 + /* - HSCIF3_B ----------------------------------------------------------------- */ 1605 + static const unsigned int hscif3_data_b_pins[] = { 1606 + /* HRX3_B, HTX3_B */ 1607 + RCAR_GP_PIN(1, 4), RCAR_GP_PIN(1, 0), 1608 + }; 1609 + static const unsigned int hscif3_data_b_mux[] = { 1610 + HRX3_B_MARK, HTX3_B_MARK, 1611 + }; 1612 + static const unsigned int hscif3_clk_b_pins[] = { 1613 + /* HSCK3_B */ 1614 + RCAR_GP_PIN(1, 3), 1615 + }; 1616 + static const unsigned int hscif3_clk_b_mux[] = { 1617 + HSCK3_B_MARK, 1618 + }; 1619 + static const unsigned int hscif3_ctrl_b_pins[] = { 1620 + /* HRTS3_N_B, HCTS3_N_B */ 1621 + RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 1), 1622 + }; 1623 + static const unsigned int hscif3_ctrl_b_mux[] = { 1624 + HRTS3_N_B_MARK, HCTS3_N_B_MARK, 1625 + }; 1626 + 1627 + /* - I2C0 ------------------------------------------------------------------- */ 1628 + static const unsigned int i2c0_pins[] = { 1629 + /* SDA0, SCL0 */ 1630 + RCAR_GP_PIN(4, 1), RCAR_GP_PIN(4, 0), 1631 + }; 1632 + static const unsigned int i2c0_mux[] = { 1633 + SDA0_MARK, SCL0_MARK, 1634 + }; 1635 + 1636 + /* - I2C1 ------------------------------------------------------------------- */ 1637 + static const unsigned int i2c1_pins[] = { 1638 + /* SDA1, SCL1 */ 1639 + RCAR_GP_PIN(4, 3), RCAR_GP_PIN(4, 2), 1640 + }; 1641 + static const unsigned int i2c1_mux[] = { 1642 + SDA1_MARK, SCL1_MARK, 1643 + }; 1644 + 1645 + /* - I2C2 ------------------------------------------------------------------- */ 1646 + static const unsigned int i2c2_pins[] = { 1647 + /* SDA2, SCL2 */ 1648 + RCAR_GP_PIN(4, 5), RCAR_GP_PIN(4, 4), 1649 + }; 1650 + static const unsigned int i2c2_mux[] = { 1651 + SDA2_MARK, SCL2_MARK, 1652 + }; 1653 + 1654 + /* - I2C3 ------------------------------------------------------------------- */ 1655 + static const unsigned int i2c3_pins[] = { 1656 + /* SDA3, SCL3 */ 1657 + RCAR_GP_PIN(4, 7), RCAR_GP_PIN(4, 6), 1658 + }; 1659 + static const unsigned int i2c3_mux[] = { 1660 + SDA3_MARK, SCL3_MARK, 1661 + }; 1662 + 1663 + /* - MMC -------------------------------------------------------------------- */ 1664 + static const unsigned int mmc_data_pins[] = { 1665 + /* MMC_SD_D[0:3], MMC_D[4:7] */ 1666 + RCAR_GP_PIN(3, 1), RCAR_GP_PIN(3, 0), 1667 + RCAR_GP_PIN(3, 2), RCAR_GP_PIN(3, 5), 1668 + RCAR_GP_PIN(3, 7), RCAR_GP_PIN(3, 6), 1669 + RCAR_GP_PIN(3, 9), RCAR_GP_PIN(3, 8), 1670 + }; 1671 + static const unsigned int mmc_data_mux[] = { 1672 + MMC_SD_D0_MARK, MMC_SD_D1_MARK, 1673 + MMC_SD_D2_MARK, MMC_SD_D3_MARK, 1674 + MMC_D4_MARK, MMC_D5_MARK, 1675 + MMC_D6_MARK, MMC_D7_MARK, 1676 + }; 1677 + static const unsigned int mmc_ctrl_pins[] = { 1678 + /* MMC_SD_CLK, MMC_SD_CMD */ 1679 + RCAR_GP_PIN(3, 3), RCAR_GP_PIN(3, 10), 1680 + }; 1681 + static const unsigned int mmc_ctrl_mux[] = { 1682 + MMC_SD_CLK_MARK, MMC_SD_CMD_MARK, 1683 + }; 1684 + static const unsigned int mmc_cd_pins[] = { 1685 + /* SD_CD */ 1686 + RCAR_GP_PIN(3, 11), 1687 + }; 1688 + static const unsigned int mmc_cd_mux[] = { 1689 + SD_CD_MARK, 1690 + }; 1691 + static const unsigned int mmc_wp_pins[] = { 1692 + /* SD_WP */ 1693 + RCAR_GP_PIN(3, 12), 1694 + }; 1695 + static const unsigned int mmc_wp_mux[] = { 1696 + SD_WP_MARK, 1697 + }; 1698 + static const unsigned int mmc_ds_pins[] = { 1699 + /* MMC_DS */ 1700 + RCAR_GP_PIN(3, 4), 1701 + }; 1702 + static const unsigned int mmc_ds_mux[] = { 1703 + MMC_DS_MARK, 1704 + }; 1705 + 1706 + /* - MSIOF0 ----------------------------------------------------------------- */ 1707 + static const unsigned int msiof0_clk_pins[] = { 1708 + /* MSIOF0_SCK */ 1709 + RCAR_GP_PIN(1, 10), 1710 + }; 1711 + static const unsigned int msiof0_clk_mux[] = { 1712 + MSIOF0_SCK_MARK, 1713 + }; 1714 + static const unsigned int msiof0_sync_pins[] = { 1715 + /* MSIOF0_SYNC */ 1716 + RCAR_GP_PIN(1, 8), 1717 + }; 1718 + static const unsigned int msiof0_sync_mux[] = { 1719 + MSIOF0_SYNC_MARK, 1720 + }; 1721 + static const unsigned int msiof0_ss1_pins[] = { 1722 + /* MSIOF0_SS1 */ 1723 + RCAR_GP_PIN(1, 7), 1724 + }; 1725 + static const unsigned int msiof0_ss1_mux[] = { 1726 + MSIOF0_SS1_MARK, 1727 + }; 1728 + static const unsigned int msiof0_ss2_pins[] = { 1729 + /* MSIOF0_SS2 */ 1730 + RCAR_GP_PIN(1, 6), 1731 + }; 1732 + static const unsigned int msiof0_ss2_mux[] = { 1733 + MSIOF0_SS2_MARK, 1734 + }; 1735 + static const unsigned int msiof0_txd_pins[] = { 1736 + /* MSIOF0_TXD */ 1737 + RCAR_GP_PIN(1, 9), 1738 + }; 1739 + static const unsigned int msiof0_txd_mux[] = { 1740 + MSIOF0_TXD_MARK, 1741 + }; 1742 + static const unsigned int msiof0_rxd_pins[] = { 1743 + /* MSIOF0_RXD */ 1744 + RCAR_GP_PIN(1, 11), 1745 + }; 1746 + static const unsigned int msiof0_rxd_mux[] = { 1747 + MSIOF0_RXD_MARK, 1748 + }; 1749 + 1750 + /* - MSIOF1 ----------------------------------------------------------------- */ 1751 + static const unsigned int msiof1_clk_pins[] = { 1752 + /* MSIOF1_SCK */ 1753 + RCAR_GP_PIN(1, 3), 1754 + }; 1755 + static const unsigned int msiof1_clk_mux[] = { 1756 + MSIOF1_SCK_MARK, 1757 + }; 1758 + static const unsigned int msiof1_sync_pins[] = { 1759 + /* MSIOF1_SYNC */ 1760 + RCAR_GP_PIN(1, 2), 1761 + }; 1762 + static const unsigned int msiof1_sync_mux[] = { 1763 + MSIOF1_SYNC_MARK, 1764 + }; 1765 + static const unsigned int msiof1_ss1_pins[] = { 1766 + /* MSIOF1_SS1 */ 1767 + RCAR_GP_PIN(1, 1), 1768 + }; 1769 + static const unsigned int msiof1_ss1_mux[] = { 1770 + MSIOF1_SS1_MARK, 1771 + }; 1772 + static const unsigned int msiof1_ss2_pins[] = { 1773 + /* MSIOF1_SS2 */ 1774 + RCAR_GP_PIN(1, 0), 1775 + }; 1776 + static const unsigned int msiof1_ss2_mux[] = { 1777 + MSIOF1_SS2_MARK, 1778 + }; 1779 + static const unsigned int msiof1_txd_pins[] = { 1780 + /* MSIOF1_TXD */ 1781 + RCAR_GP_PIN(1, 4), 1782 + }; 1783 + static const unsigned int msiof1_txd_mux[] = { 1784 + MSIOF1_TXD_MARK, 1785 + }; 1786 + static const unsigned int msiof1_rxd_pins[] = { 1787 + /* MSIOF1_RXD */ 1788 + RCAR_GP_PIN(1, 5), 1789 + }; 1790 + static const unsigned int msiof1_rxd_mux[] = { 1791 + MSIOF1_RXD_MARK, 1792 + }; 1793 + 1794 + /* - MSIOF2 ----------------------------------------------------------------- */ 1795 + static const unsigned int msiof2_clk_pins[] = { 1796 + /* MSIOF2_SCK */ 1797 + RCAR_GP_PIN(0, 17), 1798 + }; 1799 + static const unsigned int msiof2_clk_mux[] = { 1800 + MSIOF2_SCK_MARK, 1801 + }; 1802 + static const unsigned int msiof2_sync_pins[] = { 1803 + /* MSIOF2_SYNC */ 1804 + RCAR_GP_PIN(0, 15), 1805 + }; 1806 + static const unsigned int msiof2_sync_mux[] = { 1807 + MSIOF2_SYNC_MARK, 1808 + }; 1809 + static const unsigned int msiof2_ss1_pins[] = { 1810 + /* MSIOF2_SS1 */ 1811 + RCAR_GP_PIN(0, 14), 1812 + }; 1813 + static const unsigned int msiof2_ss1_mux[] = { 1814 + MSIOF2_SS1_MARK, 1815 + }; 1816 + static const unsigned int msiof2_ss2_pins[] = { 1817 + /* MSIOF2_SS2 */ 1818 + RCAR_GP_PIN(0, 13), 1819 + }; 1820 + static const unsigned int msiof2_ss2_mux[] = { 1821 + MSIOF2_SS2_MARK, 1822 + }; 1823 + static const unsigned int msiof2_txd_pins[] = { 1824 + /* MSIOF2_TXD */ 1825 + RCAR_GP_PIN(0, 16), 1826 + }; 1827 + static const unsigned int msiof2_txd_mux[] = { 1828 + MSIOF2_TXD_MARK, 1829 + }; 1830 + static const unsigned int msiof2_rxd_pins[] = { 1831 + /* MSIOF2_RXD */ 1832 + RCAR_GP_PIN(0, 18), 1833 + }; 1834 + static const unsigned int msiof2_rxd_mux[] = { 1835 + MSIOF2_RXD_MARK, 1836 + }; 1837 + 1838 + /* - MSIOF3 ----------------------------------------------------------------- */ 1839 + static const unsigned int msiof3_clk_pins[] = { 1840 + /* MSIOF3_SCK */ 1841 + RCAR_GP_PIN(0, 3), 1842 + }; 1843 + static const unsigned int msiof3_clk_mux[] = { 1844 + MSIOF3_SCK_MARK, 1845 + }; 1846 + static const unsigned int msiof3_sync_pins[] = { 1847 + /* MSIOF3_SYNC */ 1848 + RCAR_GP_PIN(0, 6), 1849 + }; 1850 + static const unsigned int msiof3_sync_mux[] = { 1851 + MSIOF3_SYNC_MARK, 1852 + }; 1853 + static const unsigned int msiof3_ss1_pins[] = { 1854 + /* MSIOF3_SS1 */ 1855 + RCAR_GP_PIN(0, 1), 1856 + }; 1857 + static const unsigned int msiof3_ss1_mux[] = { 1858 + MSIOF3_SS1_MARK, 1859 + }; 1860 + static const unsigned int msiof3_ss2_pins[] = { 1861 + /* MSIOF3_SS2 */ 1862 + RCAR_GP_PIN(0, 2), 1863 + }; 1864 + static const unsigned int msiof3_ss2_mux[] = { 1865 + MSIOF3_SS2_MARK, 1866 + }; 1867 + static const unsigned int msiof3_txd_pins[] = { 1868 + /* MSIOF3_TXD */ 1869 + RCAR_GP_PIN(0, 4), 1870 + }; 1871 + static const unsigned int msiof3_txd_mux[] = { 1872 + MSIOF3_TXD_MARK, 1873 + }; 1874 + static const unsigned int msiof3_rxd_pins[] = { 1875 + /* MSIOF3_RXD */ 1876 + RCAR_GP_PIN(0, 5), 1877 + }; 1878 + static const unsigned int msiof3_rxd_mux[] = { 1879 + MSIOF3_RXD_MARK, 1880 + }; 1881 + 1882 + /* - MSIOF4 ----------------------------------------------------------------- */ 1883 + static const unsigned int msiof4_clk_pins[] = { 1884 + /* MSIOF4_SCK */ 1885 + RCAR_GP_PIN(1, 25), 1886 + }; 1887 + static const unsigned int msiof4_clk_mux[] = { 1888 + MSIOF4_SCK_MARK, 1889 + }; 1890 + static const unsigned int msiof4_sync_pins[] = { 1891 + /* MSIOF4_SYNC */ 1892 + RCAR_GP_PIN(1, 28), 1893 + }; 1894 + static const unsigned int msiof4_sync_mux[] = { 1895 + MSIOF4_SYNC_MARK, 1896 + }; 1897 + static const unsigned int msiof4_ss1_pins[] = { 1898 + /* MSIOF4_SS1 */ 1899 + RCAR_GP_PIN(1, 23), 1900 + }; 1901 + static const unsigned int msiof4_ss1_mux[] = { 1902 + MSIOF4_SS1_MARK, 1903 + }; 1904 + static const unsigned int msiof4_ss2_pins[] = { 1905 + /* MSIOF4_SS2 */ 1906 + RCAR_GP_PIN(1, 24), 1907 + }; 1908 + static const unsigned int msiof4_ss2_mux[] = { 1909 + MSIOF4_SS2_MARK, 1910 + }; 1911 + static const unsigned int msiof4_txd_pins[] = { 1912 + /* MSIOF4_TXD */ 1913 + RCAR_GP_PIN(1, 26), 1914 + }; 1915 + static const unsigned int msiof4_txd_mux[] = { 1916 + MSIOF4_TXD_MARK, 1917 + }; 1918 + static const unsigned int msiof4_rxd_pins[] = { 1919 + /* MSIOF4_RXD */ 1920 + RCAR_GP_PIN(1, 27), 1921 + }; 1922 + static const unsigned int msiof4_rxd_mux[] = { 1923 + MSIOF4_RXD_MARK, 1924 + }; 1925 + 1926 + /* - MSIOF5 ----------------------------------------------------------------- */ 1927 + static const unsigned int msiof5_clk_pins[] = { 1928 + /* MSIOF5_SCK */ 1929 + RCAR_GP_PIN(0, 11), 1930 + }; 1931 + static const unsigned int msiof5_clk_mux[] = { 1932 + MSIOF5_SCK_MARK, 1933 + }; 1934 + static const unsigned int msiof5_sync_pins[] = { 1935 + /* MSIOF5_SYNC */ 1936 + RCAR_GP_PIN(0, 9), 1937 + }; 1938 + static const unsigned int msiof5_sync_mux[] = { 1939 + MSIOF5_SYNC_MARK, 1940 + }; 1941 + static const unsigned int msiof5_ss1_pins[] = { 1942 + /* MSIOF5_SS1 */ 1943 + RCAR_GP_PIN(0, 8), 1944 + }; 1945 + static const unsigned int msiof5_ss1_mux[] = { 1946 + MSIOF5_SS1_MARK, 1947 + }; 1948 + static const unsigned int msiof5_ss2_pins[] = { 1949 + /* MSIOF5_SS2 */ 1950 + RCAR_GP_PIN(0, 7), 1951 + }; 1952 + static const unsigned int msiof5_ss2_mux[] = { 1953 + MSIOF5_SS2_MARK, 1954 + }; 1955 + static const unsigned int msiof5_txd_pins[] = { 1956 + /* MSIOF5_TXD */ 1957 + RCAR_GP_PIN(0, 10), 1958 + }; 1959 + static const unsigned int msiof5_txd_mux[] = { 1960 + MSIOF5_TXD_MARK, 1961 + }; 1962 + static const unsigned int msiof5_rxd_pins[] = { 1963 + /* MSIOF5_RXD */ 1964 + RCAR_GP_PIN(0, 12), 1965 + }; 1966 + static const unsigned int msiof5_rxd_mux[] = { 1967 + MSIOF5_RXD_MARK, 1968 + }; 1969 + 1970 + /* - PCIE ------------------------------------------------------------------- */ 1971 + static const unsigned int pcie0_clkreq_n_pins[] = { 1972 + /* PCIE0_CLKREQ_N */ 1973 + RCAR_GP_PIN(4, 21), 1974 + }; 1975 + 1976 + static const unsigned int pcie0_clkreq_n_mux[] = { 1977 + PCIE0_CLKREQ_N_MARK, 1978 + }; 1979 + 1980 + /* - PWM0_A ------------------------------------------------------------------- */ 1981 + static const unsigned int pwm0_a_pins[] = { 1982 + /* PWM0_A */ 1983 + RCAR_GP_PIN(1, 15), 1984 + }; 1985 + static const unsigned int pwm0_a_mux[] = { 1986 + PWM0_A_MARK, 1987 + }; 1988 + 1989 + /* - PWM0_B ------------------------------------------------------------------- */ 1990 + static const unsigned int pwm0_b_pins[] = { 1991 + /* PWM0_B */ 1992 + RCAR_GP_PIN(1, 14), 1993 + }; 1994 + static const unsigned int pwm0_b_mux[] = { 1995 + PWM0_B_MARK, 1996 + }; 1997 + 1998 + /* - PWM1_A ------------------------------------------------------------------- */ 1999 + static const unsigned int pwm1_a_pins[] = { 2000 + /* PWM1_A */ 2001 + RCAR_GP_PIN(3, 13), 2002 + }; 2003 + static const unsigned int pwm1_a_mux[] = { 2004 + PWM1_A_MARK, 2005 + }; 2006 + 2007 + /* - PWM1_B ------------------------------------------------------------------- */ 2008 + static const unsigned int pwm1_b_pins[] = { 2009 + /* PWM1_B */ 2010 + RCAR_GP_PIN(2, 13), 2011 + }; 2012 + static const unsigned int pwm1_b_mux[] = { 2013 + PWM1_B_MARK, 2014 + }; 2015 + 2016 + /* - PWM1_C ------------------------------------------------------------------- */ 2017 + static const unsigned int pwm1_c_pins[] = { 2018 + /* PWM1_C */ 2019 + RCAR_GP_PIN(2, 17), 2020 + }; 2021 + static const unsigned int pwm1_c_mux[] = { 2022 + PWM1_C_MARK, 2023 + }; 2024 + 2025 + /* - PWM2_A ------------------------------------------------------------------- */ 2026 + static const unsigned int pwm2_a_pins[] = { 2027 + /* PWM2_A */ 2028 + RCAR_GP_PIN(3, 14), 2029 + }; 2030 + static const unsigned int pwm2_a_mux[] = { 2031 + PWM2_A_MARK, 2032 + }; 2033 + 2034 + /* - PWM2_B ------------------------------------------------------------------- */ 2035 + static const unsigned int pwm2_b_pins[] = { 2036 + /* PWM2_B */ 2037 + RCAR_GP_PIN(2, 14), 2038 + }; 2039 + static const unsigned int pwm2_b_mux[] = { 2040 + PWM2_B_MARK, 2041 + }; 2042 + 2043 + /* - PWM2_C ------------------------------------------------------------------- */ 2044 + static const unsigned int pwm2_c_pins[] = { 2045 + /* PWM2_C */ 2046 + RCAR_GP_PIN(2, 19), 2047 + }; 2048 + static const unsigned int pwm2_c_mux[] = { 2049 + PWM2_C_MARK, 2050 + }; 2051 + 2052 + /* - PWM3_A ------------------------------------------------------------------- */ 2053 + static const unsigned int pwm3_a_pins[] = { 2054 + /* PWM3_A */ 2055 + RCAR_GP_PIN(4, 14), 2056 + }; 2057 + static const unsigned int pwm3_a_mux[] = { 2058 + PWM3_A_MARK, 2059 + }; 2060 + 2061 + /* - PWM3_B ------------------------------------------------------------------- */ 2062 + static const unsigned int pwm3_b_pins[] = { 2063 + /* PWM3_B */ 2064 + RCAR_GP_PIN(2, 15), 2065 + }; 2066 + static const unsigned int pwm3_b_mux[] = { 2067 + PWM3_B_MARK, 2068 + }; 2069 + 2070 + /* - PWM3_C ------------------------------------------------------------------- */ 2071 + static const unsigned int pwm3_c_pins[] = { 2072 + /* PWM3_C */ 2073 + RCAR_GP_PIN(1, 22), 2074 + }; 2075 + static const unsigned int pwm3_c_mux[] = { 2076 + PWM3_C_MARK, 2077 + }; 2078 + 2079 + /* - PWM4 ------------------------------------------------------------------- */ 2080 + static const unsigned int pwm4_pins[] = { 2081 + /* PWM4 */ 2082 + RCAR_GP_PIN(4, 15), 2083 + }; 2084 + static const unsigned int pwm4_mux[] = { 2085 + PWM4_MARK, 2086 + }; 2087 + 2088 + /* - QSPI0 ------------------------------------------------------------------ */ 2089 + static const unsigned int qspi0_ctrl_pins[] = { 2090 + /* SPCLK, SSL */ 2091 + RCAR_GP_PIN(3, 20), RCAR_GP_PIN(3, 15), 2092 + }; 2093 + static const unsigned int qspi0_ctrl_mux[] = { 2094 + QSPI0_SPCLK_MARK, QSPI0_SSL_MARK, 2095 + }; 2096 + static const unsigned int qspi0_data_pins[] = { 2097 + /* MOSI_IO0, MISO_IO1, IO2, IO3 */ 2098 + RCAR_GP_PIN(3, 19), RCAR_GP_PIN(3, 18), 2099 + RCAR_GP_PIN(3, 17), RCAR_GP_PIN(3, 16), 2100 + }; 2101 + static const unsigned int qspi0_data_mux[] = { 2102 + QSPI0_MOSI_IO0_MARK, QSPI0_MISO_IO1_MARK, 2103 + QSPI0_IO2_MARK, QSPI0_IO3_MARK 2104 + }; 2105 + 2106 + /* - QSPI1 ------------------------------------------------------------------ */ 2107 + static const unsigned int qspi1_ctrl_pins[] = { 2108 + /* SPCLK, SSL */ 2109 + RCAR_GP_PIN(3, 22), RCAR_GP_PIN(3, 25), 2110 + }; 2111 + static const unsigned int qspi1_ctrl_mux[] = { 2112 + QSPI1_SPCLK_MARK, QSPI1_SSL_MARK, 2113 + }; 2114 + static const unsigned int qspi1_data_pins[] = { 2115 + /* MOSI_IO0, MISO_IO1, IO2, IO3 */ 2116 + RCAR_GP_PIN(3, 21), RCAR_GP_PIN(3, 23), 2117 + RCAR_GP_PIN(3, 24), RCAR_GP_PIN(3, 26), 2118 + }; 2119 + static const unsigned int qspi1_data_mux[] = { 2120 + QSPI1_MOSI_IO0_MARK, QSPI1_MISO_IO1_MARK, 2121 + QSPI1_IO2_MARK, QSPI1_IO3_MARK 2122 + }; 2123 + 2124 + /* - SCIF0 ------------------------------------------------------------------ */ 2125 + static const unsigned int scif0_data_pins[] = { 2126 + /* RX0, TX0 */ 2127 + RCAR_GP_PIN(1, 16), RCAR_GP_PIN(1, 12), 2128 + }; 2129 + static const unsigned int scif0_data_mux[] = { 2130 + RX0_MARK, TX0_MARK, 2131 + }; 2132 + static const unsigned int scif0_clk_pins[] = { 2133 + /* SCK0 */ 2134 + RCAR_GP_PIN(1, 15), 2135 + }; 2136 + static const unsigned int scif0_clk_mux[] = { 2137 + SCK0_MARK, 2138 + }; 2139 + static const unsigned int scif0_ctrl_pins[] = { 2140 + /* RTS0_N, CTS0_N */ 2141 + RCAR_GP_PIN(1, 14), RCAR_GP_PIN(1, 13), 2142 + }; 2143 + static const unsigned int scif0_ctrl_mux[] = { 2144 + RTS0_N_MARK, CTS0_N_MARK, 2145 + }; 2146 + 2147 + /* - SCIF1_A ------------------------------------------------------------------ */ 2148 + static const unsigned int scif1_data_a_pins[] = { 2149 + /* RX1_A, TX1_A */ 2150 + RCAR_GP_PIN(0, 15), RCAR_GP_PIN(0, 14), 2151 + }; 2152 + static const unsigned int scif1_data_a_mux[] = { 2153 + RX1_A_MARK, TX1_A_MARK, 2154 + }; 2155 + static const unsigned int scif1_clk_a_pins[] = { 2156 + /* SCK1_A */ 2157 + RCAR_GP_PIN(0, 18), 2158 + }; 2159 + static const unsigned int scif1_clk_a_mux[] = { 2160 + SCK1_A_MARK, 2161 + }; 2162 + static const unsigned int scif1_ctrl_a_pins[] = { 2163 + /* RTS1_N_A, CTS1_N_A */ 2164 + RCAR_GP_PIN(0, 17), RCAR_GP_PIN(0, 16), 2165 + }; 2166 + static const unsigned int scif1_ctrl_a_mux[] = { 2167 + RTS1_N_A_MARK, CTS1_N_A_MARK, 2168 + }; 2169 + 2170 + /* - SCIF1_B ------------------------------------------------------------------ */ 2171 + static const unsigned int scif1_data_b_pins[] = { 2172 + /* RX1_B, TX1_B */ 2173 + RCAR_GP_PIN(1, 7), RCAR_GP_PIN(1, 6), 2174 + }; 2175 + static const unsigned int scif1_data_b_mux[] = { 2176 + RX1_B_MARK, TX1_B_MARK, 2177 + }; 2178 + static const unsigned int scif1_clk_b_pins[] = { 2179 + /* SCK1_B */ 2180 + RCAR_GP_PIN(1, 10), 2181 + }; 2182 + static const unsigned int scif1_clk_b_mux[] = { 2183 + SCK1_B_MARK, 2184 + }; 2185 + static const unsigned int scif1_ctrl_b_pins[] = { 2186 + /* RTS1_N_B, CTS1_N_B */ 2187 + RCAR_GP_PIN(1, 9), RCAR_GP_PIN(1, 8), 2188 + }; 2189 + static const unsigned int scif1_ctrl_b_mux[] = { 2190 + RTS1_N_B_MARK, CTS1_N_B_MARK, 2191 + }; 2192 + 2193 + /* - SCIF3_A ------------------------------------------------------------------ */ 2194 + static const unsigned int scif3_data_a_pins[] = { 2195 + /* RX3_A, TX3_A */ 2196 + RCAR_GP_PIN(1, 27), RCAR_GP_PIN(1, 28), 2197 + }; 2198 + static const unsigned int scif3_data_a_mux[] = { 2199 + RX3_A_MARK, TX3_A_MARK, 2200 + }; 2201 + static const unsigned int scif3_clk_a_pins[] = { 2202 + /* SCK3_A */ 2203 + RCAR_GP_PIN(1, 24), 2204 + }; 2205 + static const unsigned int scif3_clk_a_mux[] = { 2206 + SCK3_A_MARK, 2207 + }; 2208 + static const unsigned int scif3_ctrl_a_pins[] = { 2209 + /* RTS3_N_A, CTS3_N_A */ 2210 + RCAR_GP_PIN(1, 26), RCAR_GP_PIN(1, 25), 2211 + }; 2212 + static const unsigned int scif3_ctrl_a_mux[] = { 2213 + RTS3_N_A_MARK, CTS3_N_A_MARK, 2214 + }; 2215 + 2216 + /* - SCIF3_B ------------------------------------------------------------------ */ 2217 + static const unsigned int scif3_data_b_pins[] = { 2218 + /* RX3_B, TX3_B */ 2219 + RCAR_GP_PIN(1, 1), RCAR_GP_PIN(1, 0), 2220 + }; 2221 + static const unsigned int scif3_data_b_mux[] = { 2222 + RX3_B_MARK, TX3_B_MARK, 2223 + }; 2224 + static const unsigned int scif3_clk_b_pins[] = { 2225 + /* SCK3_B */ 2226 + RCAR_GP_PIN(1, 4), 2227 + }; 2228 + static const unsigned int scif3_clk_b_mux[] = { 2229 + SCK3_B_MARK, 2230 + }; 2231 + static const unsigned int scif3_ctrl_b_pins[] = { 2232 + /* RTS3_N_B, CTS3_N_B */ 2233 + RCAR_GP_PIN(1, 2), RCAR_GP_PIN(1, 3), 2234 + }; 2235 + static const unsigned int scif3_ctrl_b_mux[] = { 2236 + RTS3_N_B_MARK, CTS3_N_B_MARK, 2237 + }; 2238 + 2239 + /* - SCIF4 ------------------------------------------------------------------ */ 2240 + static const unsigned int scif4_data_pins[] = { 2241 + /* RX4, TX4 */ 2242 + RCAR_GP_PIN(4, 13), RCAR_GP_PIN(4, 12), 2243 + }; 2244 + static const unsigned int scif4_data_mux[] = { 2245 + RX4_MARK, TX4_MARK, 2246 + }; 2247 + static const unsigned int scif4_clk_pins[] = { 2248 + /* SCK4 */ 2249 + RCAR_GP_PIN(4, 8), 2250 + }; 2251 + static const unsigned int scif4_clk_mux[] = { 2252 + SCK4_MARK, 2253 + }; 2254 + static const unsigned int scif4_ctrl_pins[] = { 2255 + /* RTS4_N, CTS4_N */ 2256 + RCAR_GP_PIN(4, 10), RCAR_GP_PIN(4, 9), 2257 + }; 2258 + static const unsigned int scif4_ctrl_mux[] = { 2259 + RTS4_N_MARK, CTS4_N_MARK, 2260 + }; 2261 + 2262 + /* - SCIF Clock ------------------------------------------------------------- */ 2263 + static const unsigned int scif_clk_pins[] = { 2264 + /* SCIF_CLK */ 2265 + RCAR_GP_PIN(1, 17), 2266 + }; 2267 + static const unsigned int scif_clk_mux[] = { 2268 + SCIF_CLK_MARK, 2269 + }; 2270 + 2271 + static const unsigned int scif_clk2_pins[] = { 2272 + /* SCIF_CLK2 */ 2273 + RCAR_GP_PIN(4, 11), 2274 + }; 2275 + static const unsigned int scif_clk2_mux[] = { 2276 + SCIF_CLK2_MARK, 2277 + }; 2278 + 2279 + /* - SSI ------------------------------------------------- */ 2280 + static const unsigned int ssi_data_pins[] = { 2281 + /* SSI_SD */ 2282 + RCAR_GP_PIN(1, 20), 2283 + }; 2284 + static const unsigned int ssi_data_mux[] = { 2285 + SSI_SD_MARK, 2286 + }; 2287 + static const unsigned int ssi_ctrl_pins[] = { 2288 + /* SSI_SCK, SSI_WS */ 2289 + RCAR_GP_PIN(1, 18), RCAR_GP_PIN(1, 19), 2290 + }; 2291 + static const unsigned int ssi_ctrl_mux[] = { 2292 + SSI_SCK_MARK, SSI_WS_MARK, 2293 + }; 2294 + 2295 + /* - TPU_A ------------------------------------------------------------------- */ 2296 + static const unsigned int tpu_to0_a_pins[] = { 2297 + /* TPU0TO0_A */ 2298 + RCAR_GP_PIN(2, 8), 2299 + }; 2300 + static const unsigned int tpu_to0_a_mux[] = { 2301 + TPU0TO0_A_MARK, 2302 + }; 2303 + static const unsigned int tpu_to1_a_pins[] = { 2304 + /* TPU0TO1_A */ 2305 + RCAR_GP_PIN(2, 7), 2306 + }; 2307 + static const unsigned int tpu_to1_a_mux[] = { 2308 + TPU0TO1_A_MARK, 2309 + }; 2310 + static const unsigned int tpu_to2_a_pins[] = { 2311 + /* TPU0TO2_A */ 2312 + RCAR_GP_PIN(2, 12), 2313 + }; 2314 + static const unsigned int tpu_to2_a_mux[] = { 2315 + TPU0TO2_A_MARK, 2316 + }; 2317 + static const unsigned int tpu_to3_a_pins[] = { 2318 + /* TPU0TO3_A */ 2319 + RCAR_GP_PIN(2, 13), 2320 + }; 2321 + static const unsigned int tpu_to3_a_mux[] = { 2322 + TPU0TO3_A_MARK, 2323 + }; 2324 + 2325 + /* - TPU_B ------------------------------------------------------------------- */ 2326 + static const unsigned int tpu_to0_b_pins[] = { 2327 + /* TPU0TO0_B */ 2328 + RCAR_GP_PIN(1, 25), 2329 + }; 2330 + static const unsigned int tpu_to0_b_mux[] = { 2331 + TPU0TO0_B_MARK, 2332 + }; 2333 + static const unsigned int tpu_to1_b_pins[] = { 2334 + /* TPU0TO1_B */ 2335 + RCAR_GP_PIN(1, 26), 2336 + }; 2337 + static const unsigned int tpu_to1_b_mux[] = { 2338 + TPU0TO1_B_MARK, 2339 + }; 2340 + static const unsigned int tpu_to2_b_pins[] = { 2341 + /* TPU0TO2_B */ 2342 + RCAR_GP_PIN(2, 0), 2343 + }; 2344 + static const unsigned int tpu_to2_b_mux[] = { 2345 + TPU0TO2_B_MARK, 2346 + }; 2347 + static const unsigned int tpu_to3_b_pins[] = { 2348 + /* TPU0TO3_B */ 2349 + RCAR_GP_PIN(2, 1), 2350 + }; 2351 + static const unsigned int tpu_to3_b_mux[] = { 2352 + TPU0TO3_B_MARK, 2353 + }; 2354 + 2355 + static const struct sh_pfc_pin_group pinmux_groups[] = { 2356 + SH_PFC_PIN_GROUP(audio_clkin), 2357 + SH_PFC_PIN_GROUP(audio_clkout), 2358 + 2359 + SH_PFC_PIN_GROUP(avb0_link), 2360 + SH_PFC_PIN_GROUP(avb0_magic), 2361 + SH_PFC_PIN_GROUP(avb0_phy_int), 2362 + SH_PFC_PIN_GROUP(avb0_mdio), 2363 + SH_PFC_PIN_GROUP(avb0_rgmii), 2364 + SH_PFC_PIN_GROUP(avb0_txcrefclk), 2365 + SH_PFC_PIN_GROUP(avb0_avtp_pps), 2366 + SH_PFC_PIN_GROUP(avb0_avtp_capture), 2367 + SH_PFC_PIN_GROUP(avb0_avtp_match), 2368 + 2369 + SH_PFC_PIN_GROUP(avb1_link), 2370 + SH_PFC_PIN_GROUP(avb1_magic), 2371 + SH_PFC_PIN_GROUP(avb1_phy_int), 2372 + SH_PFC_PIN_GROUP(avb1_mdio), 2373 + SH_PFC_PIN_GROUP(avb1_rgmii), 2374 + SH_PFC_PIN_GROUP(avb1_txcrefclk), 2375 + SH_PFC_PIN_GROUP(avb1_avtp_pps), 2376 + SH_PFC_PIN_GROUP(avb1_avtp_capture), 2377 + SH_PFC_PIN_GROUP(avb1_avtp_match), 2378 + 2379 + SH_PFC_PIN_GROUP(avb2_link), 2380 + SH_PFC_PIN_GROUP(avb2_magic), 2381 + SH_PFC_PIN_GROUP(avb2_phy_int), 2382 + SH_PFC_PIN_GROUP(avb2_mdio), 2383 + SH_PFC_PIN_GROUP(avb2_rgmii), 2384 + SH_PFC_PIN_GROUP(avb2_txcrefclk), 2385 + SH_PFC_PIN_GROUP(avb2_avtp_pps), 2386 + SH_PFC_PIN_GROUP(avb2_avtp_capture), 2387 + SH_PFC_PIN_GROUP(avb2_avtp_match), 2388 + 2389 + SH_PFC_PIN_GROUP(canfd0_data), 2390 + SH_PFC_PIN_GROUP(canfd1_data), 2391 + SH_PFC_PIN_GROUP(canfd2_data), 2392 + SH_PFC_PIN_GROUP(canfd3_data), 2393 + SH_PFC_PIN_GROUP(can_clk), 2394 + 2395 + SH_PFC_PIN_GROUP(hscif0_data), 2396 + SH_PFC_PIN_GROUP(hscif0_clk), 2397 + SH_PFC_PIN_GROUP(hscif0_ctrl), 2398 + SH_PFC_PIN_GROUP(hscif1_data_a), 2399 + SH_PFC_PIN_GROUP(hscif1_clk_a), 2400 + SH_PFC_PIN_GROUP(hscif1_ctrl_a), 2401 + SH_PFC_PIN_GROUP(hscif1_data_b), 2402 + SH_PFC_PIN_GROUP(hscif1_clk_b), 2403 + SH_PFC_PIN_GROUP(hscif1_ctrl_b), 2404 + SH_PFC_PIN_GROUP(hscif2_data), 2405 + SH_PFC_PIN_GROUP(hscif2_clk), 2406 + SH_PFC_PIN_GROUP(hscif2_ctrl), 2407 + SH_PFC_PIN_GROUP(hscif3_data_a), 2408 + SH_PFC_PIN_GROUP(hscif3_clk_a), 2409 + SH_PFC_PIN_GROUP(hscif3_ctrl_a), 2410 + SH_PFC_PIN_GROUP(hscif3_data_b), 2411 + SH_PFC_PIN_GROUP(hscif3_clk_b), 2412 + SH_PFC_PIN_GROUP(hscif3_ctrl_b), 2413 + 2414 + SH_PFC_PIN_GROUP(i2c0), 2415 + SH_PFC_PIN_GROUP(i2c1), 2416 + SH_PFC_PIN_GROUP(i2c2), 2417 + SH_PFC_PIN_GROUP(i2c3), 2418 + 2419 + BUS_DATA_PIN_GROUP(mmc_data, 1), 2420 + BUS_DATA_PIN_GROUP(mmc_data, 4), 2421 + BUS_DATA_PIN_GROUP(mmc_data, 8), 2422 + SH_PFC_PIN_GROUP(mmc_ctrl), 2423 + SH_PFC_PIN_GROUP(mmc_cd), 2424 + SH_PFC_PIN_GROUP(mmc_wp), 2425 + SH_PFC_PIN_GROUP(mmc_ds), 2426 + 2427 + SH_PFC_PIN_GROUP(msiof0_clk), 2428 + SH_PFC_PIN_GROUP(msiof0_sync), 2429 + SH_PFC_PIN_GROUP(msiof0_ss1), 2430 + SH_PFC_PIN_GROUP(msiof0_ss2), 2431 + SH_PFC_PIN_GROUP(msiof0_txd), 2432 + SH_PFC_PIN_GROUP(msiof0_rxd), 2433 + 2434 + SH_PFC_PIN_GROUP(msiof1_clk), 2435 + SH_PFC_PIN_GROUP(msiof1_sync), 2436 + SH_PFC_PIN_GROUP(msiof1_ss1), 2437 + SH_PFC_PIN_GROUP(msiof1_ss2), 2438 + SH_PFC_PIN_GROUP(msiof1_txd), 2439 + SH_PFC_PIN_GROUP(msiof1_rxd), 2440 + 2441 + SH_PFC_PIN_GROUP(msiof2_clk), 2442 + SH_PFC_PIN_GROUP(msiof2_sync), 2443 + SH_PFC_PIN_GROUP(msiof2_ss1), 2444 + SH_PFC_PIN_GROUP(msiof2_ss2), 2445 + SH_PFC_PIN_GROUP(msiof2_txd), 2446 + SH_PFC_PIN_GROUP(msiof2_rxd), 2447 + 2448 + SH_PFC_PIN_GROUP(msiof3_clk), 2449 + SH_PFC_PIN_GROUP(msiof3_sync), 2450 + SH_PFC_PIN_GROUP(msiof3_ss1), 2451 + SH_PFC_PIN_GROUP(msiof3_ss2), 2452 + SH_PFC_PIN_GROUP(msiof3_txd), 2453 + SH_PFC_PIN_GROUP(msiof3_rxd), 2454 + 2455 + SH_PFC_PIN_GROUP(msiof4_clk), 2456 + SH_PFC_PIN_GROUP(msiof4_sync), 2457 + SH_PFC_PIN_GROUP(msiof4_ss1), 2458 + SH_PFC_PIN_GROUP(msiof4_ss2), 2459 + SH_PFC_PIN_GROUP(msiof4_txd), 2460 + SH_PFC_PIN_GROUP(msiof4_rxd), 2461 + 2462 + SH_PFC_PIN_GROUP(msiof5_clk), 2463 + SH_PFC_PIN_GROUP(msiof5_sync), 2464 + SH_PFC_PIN_GROUP(msiof5_ss1), 2465 + SH_PFC_PIN_GROUP(msiof5_ss2), 2466 + SH_PFC_PIN_GROUP(msiof5_txd), 2467 + SH_PFC_PIN_GROUP(msiof5_rxd), 2468 + 2469 + SH_PFC_PIN_GROUP(pcie0_clkreq_n), 2470 + 2471 + SH_PFC_PIN_GROUP(pwm0_a), 2472 + SH_PFC_PIN_GROUP(pwm0_b), 2473 + SH_PFC_PIN_GROUP(pwm1_a), 2474 + SH_PFC_PIN_GROUP(pwm1_b), 2475 + SH_PFC_PIN_GROUP(pwm1_c), 2476 + SH_PFC_PIN_GROUP(pwm2_a), 2477 + SH_PFC_PIN_GROUP(pwm2_b), 2478 + SH_PFC_PIN_GROUP(pwm2_c), 2479 + SH_PFC_PIN_GROUP(pwm3_a), 2480 + SH_PFC_PIN_GROUP(pwm3_b), 2481 + SH_PFC_PIN_GROUP(pwm3_c), 2482 + SH_PFC_PIN_GROUP(pwm4), 2483 + 2484 + SH_PFC_PIN_GROUP(qspi0_ctrl), 2485 + BUS_DATA_PIN_GROUP(qspi0_data, 2), 2486 + BUS_DATA_PIN_GROUP(qspi0_data, 4), 2487 + SH_PFC_PIN_GROUP(qspi1_ctrl), 2488 + BUS_DATA_PIN_GROUP(qspi1_data, 2), 2489 + BUS_DATA_PIN_GROUP(qspi1_data, 4), 2490 + 2491 + SH_PFC_PIN_GROUP(scif0_data), 2492 + SH_PFC_PIN_GROUP(scif0_clk), 2493 + SH_PFC_PIN_GROUP(scif0_ctrl), 2494 + SH_PFC_PIN_GROUP(scif1_data_a), 2495 + SH_PFC_PIN_GROUP(scif1_clk_a), 2496 + SH_PFC_PIN_GROUP(scif1_ctrl_a), 2497 + SH_PFC_PIN_GROUP(scif1_data_b), 2498 + SH_PFC_PIN_GROUP(scif1_clk_b), 2499 + SH_PFC_PIN_GROUP(scif1_ctrl_b), 2500 + SH_PFC_PIN_GROUP(scif3_data_a), 2501 + SH_PFC_PIN_GROUP(scif3_clk_a), 2502 + SH_PFC_PIN_GROUP(scif3_ctrl_a), 2503 + SH_PFC_PIN_GROUP(scif3_data_b), 2504 + SH_PFC_PIN_GROUP(scif3_clk_b), 2505 + SH_PFC_PIN_GROUP(scif3_ctrl_b), 2506 + SH_PFC_PIN_GROUP(scif4_data), 2507 + SH_PFC_PIN_GROUP(scif4_clk), 2508 + SH_PFC_PIN_GROUP(scif4_ctrl), 2509 + SH_PFC_PIN_GROUP(scif_clk), 2510 + SH_PFC_PIN_GROUP(scif_clk2), 2511 + 2512 + SH_PFC_PIN_GROUP(ssi_data), 2513 + SH_PFC_PIN_GROUP(ssi_ctrl), 2514 + 2515 + SH_PFC_PIN_GROUP(tpu_to0_a), 2516 + SH_PFC_PIN_GROUP(tpu_to0_b), 2517 + SH_PFC_PIN_GROUP(tpu_to1_a), 2518 + SH_PFC_PIN_GROUP(tpu_to1_b), 2519 + SH_PFC_PIN_GROUP(tpu_to2_a), 2520 + SH_PFC_PIN_GROUP(tpu_to2_b), 2521 + SH_PFC_PIN_GROUP(tpu_to3_a), 2522 + SH_PFC_PIN_GROUP(tpu_to3_b), 2523 + }; 2524 + 2525 + static const char * const audio_clk_groups[] = { 2526 + "audio_clkin", 2527 + "audio_clkout", 2528 + }; 2529 + 2530 + static const char * const avb0_groups[] = { 2531 + "avb0_link", 2532 + "avb0_magic", 2533 + "avb0_phy_int", 2534 + "avb0_mdio", 2535 + "avb0_rgmii", 2536 + "avb0_txcrefclk", 2537 + "avb0_avtp_pps", 2538 + "avb0_avtp_capture", 2539 + "avb0_avtp_match", 2540 + }; 2541 + 2542 + static const char * const avb1_groups[] = { 2543 + "avb1_link", 2544 + "avb1_magic", 2545 + "avb1_phy_int", 2546 + "avb1_mdio", 2547 + "avb1_rgmii", 2548 + "avb1_txcrefclk", 2549 + "avb1_avtp_pps", 2550 + "avb1_avtp_capture", 2551 + "avb1_avtp_match", 2552 + }; 2553 + 2554 + static const char * const avb2_groups[] = { 2555 + "avb2_link", 2556 + "avb2_magic", 2557 + "avb2_phy_int", 2558 + "avb2_mdio", 2559 + "avb2_rgmii", 2560 + "avb2_txcrefclk", 2561 + "avb2_avtp_pps", 2562 + "avb2_avtp_capture", 2563 + "avb2_avtp_match", 2564 + }; 2565 + 2566 + static const char * const canfd0_groups[] = { 2567 + "canfd0_data", 2568 + }; 2569 + 2570 + static const char * const canfd1_groups[] = { 2571 + "canfd1_data", 2572 + }; 2573 + 2574 + static const char * const canfd2_groups[] = { 2575 + "canfd2_data", 2576 + }; 2577 + 2578 + static const char * const canfd3_groups[] = { 2579 + "canfd3_data", 2580 + }; 2581 + 2582 + static const char * const can_clk_groups[] = { 2583 + "can_clk", 2584 + }; 2585 + 2586 + static const char * const hscif0_groups[] = { 2587 + "hscif0_data", 2588 + "hscif0_clk", 2589 + "hscif0_ctrl", 2590 + }; 2591 + 2592 + static const char * const hscif1_groups[] = { 2593 + "hscif1_data_a", 2594 + "hscif1_clk_a", 2595 + "hscif1_ctrl_a", 2596 + "hscif1_data_b", 2597 + "hscif1_clk_b", 2598 + "hscif1_ctrl_b", 2599 + }; 2600 + 2601 + static const char * const hscif2_groups[] = { 2602 + "hscif2_data", 2603 + "hscif2_clk", 2604 + "hscif2_ctrl", 2605 + }; 2606 + 2607 + static const char * const hscif3_groups[] = { 2608 + "hscif3_data_a", 2609 + "hscif3_clk_a", 2610 + "hscif3_ctrl_a", 2611 + "hscif3_data_b", 2612 + "hscif3_clk_b", 2613 + "hscif3_ctrl_b", 2614 + }; 2615 + 2616 + static const char * const i2c0_groups[] = { 2617 + "i2c0", 2618 + }; 2619 + 2620 + static const char * const i2c1_groups[] = { 2621 + "i2c1", 2622 + }; 2623 + 2624 + static const char * const i2c2_groups[] = { 2625 + "i2c2", 2626 + }; 2627 + 2628 + static const char * const i2c3_groups[] = { 2629 + "i2c3", 2630 + }; 2631 + 2632 + static const char * const mmc_groups[] = { 2633 + "mmc_data1", 2634 + "mmc_data4", 2635 + "mmc_data8", 2636 + "mmc_ctrl", 2637 + "mmc_cd", 2638 + "mmc_wp", 2639 + "mmc_ds", 2640 + }; 2641 + 2642 + static const char * const msiof0_groups[] = { 2643 + "msiof0_clk", 2644 + "msiof0_sync", 2645 + "msiof0_ss1", 2646 + "msiof0_ss2", 2647 + "msiof0_txd", 2648 + "msiof0_rxd", 2649 + }; 2650 + 2651 + static const char * const msiof1_groups[] = { 2652 + "msiof1_clk", 2653 + "msiof1_sync", 2654 + "msiof1_ss1", 2655 + "msiof1_ss2", 2656 + "msiof1_txd", 2657 + "msiof1_rxd", 2658 + }; 2659 + 2660 + static const char * const msiof2_groups[] = { 2661 + "msiof2_clk", 2662 + "msiof2_sync", 2663 + "msiof2_ss1", 2664 + "msiof2_ss2", 2665 + "msiof2_txd", 2666 + "msiof2_rxd", 2667 + }; 2668 + 2669 + static const char * const msiof3_groups[] = { 2670 + "msiof3_clk", 2671 + "msiof3_sync", 2672 + "msiof3_ss1", 2673 + "msiof3_ss2", 2674 + "msiof3_txd", 2675 + "msiof3_rxd", 2676 + }; 2677 + 2678 + static const char * const msiof4_groups[] = { 2679 + "msiof4_clk", 2680 + "msiof4_sync", 2681 + "msiof4_ss1", 2682 + "msiof4_ss2", 2683 + "msiof4_txd", 2684 + "msiof4_rxd", 2685 + }; 2686 + 2687 + static const char * const msiof5_groups[] = { 2688 + "msiof5_clk", 2689 + "msiof5_sync", 2690 + "msiof5_ss1", 2691 + "msiof5_ss2", 2692 + "msiof5_txd", 2693 + "msiof5_rxd", 2694 + }; 2695 + 2696 + static const char * const pcie_groups[] = { 2697 + "pcie0_clkreq_n", 2698 + }; 2699 + 2700 + static const char * const pwm0_groups[] = { 2701 + "pwm0_a", 2702 + "pwm0_b", 2703 + }; 2704 + 2705 + static const char * const pwm1_groups[] = { 2706 + "pwm1_a", 2707 + "pwm1_b", 2708 + "pwm1_c", 2709 + }; 2710 + 2711 + static const char * const pwm2_groups[] = { 2712 + "pwm2_a", 2713 + "pwm2_b", 2714 + "pwm2_c", 2715 + }; 2716 + 2717 + static const char * const pwm3_groups[] = { 2718 + "pwm3_a", 2719 + "pwm3_b", 2720 + "pwm3_c", 2721 + }; 2722 + 2723 + static const char * const pwm4_groups[] = { 2724 + "pwm4", 2725 + }; 2726 + 2727 + static const char * const qspi0_groups[] = { 2728 + "qspi0_ctrl", 2729 + "qspi0_data2", 2730 + "qspi0_data4", 2731 + }; 2732 + 2733 + static const char * const qspi1_groups[] = { 2734 + "qspi1_ctrl", 2735 + "qspi1_data2", 2736 + "qspi1_data4", 2737 + }; 2738 + 2739 + static const char * const scif0_groups[] = { 2740 + "scif0_data", 2741 + "scif0_clk", 2742 + "scif0_ctrl", 2743 + }; 2744 + 2745 + static const char * const scif1_groups[] = { 2746 + "scif1_data_a", 2747 + "scif1_clk_a", 2748 + "scif1_ctrl_a", 2749 + "scif1_data_b", 2750 + "scif1_clk_b", 2751 + "scif1_ctrl_b", 2752 + }; 2753 + 2754 + static const char * const scif3_groups[] = { 2755 + "scif3_data_a", 2756 + "scif3_clk_a", 2757 + "scif3_ctrl_a", 2758 + "scif3_data_b", 2759 + "scif3_clk_b", 2760 + "scif3_ctrl_b", 2761 + }; 2762 + 2763 + static const char * const scif4_groups[] = { 2764 + "scif4_data", 2765 + "scif4_clk", 2766 + "scif4_ctrl", 2767 + }; 2768 + 2769 + static const char * const scif_clk_groups[] = { 2770 + "scif_clk", 2771 + }; 2772 + 2773 + static const char * const scif_clk2_groups[] = { 2774 + "scif_clk2", 2775 + }; 2776 + 2777 + static const char * const ssi_groups[] = { 2778 + "ssi_data", 2779 + "ssi_ctrl", 2780 + }; 2781 + 2782 + static const char * const tpu_groups[] = { 2783 + "tpu_to0_a", 2784 + "tpu_to0_b", 2785 + "tpu_to1_a", 2786 + "tpu_to1_b", 2787 + "tpu_to2_a", 2788 + "tpu_to2_b", 2789 + "tpu_to3_a", 2790 + "tpu_to3_b", 2791 + }; 2792 + 2793 + static const struct sh_pfc_function pinmux_functions[] = { 2794 + SH_PFC_FUNCTION(audio_clk), 2795 + 2796 + SH_PFC_FUNCTION(avb0), 2797 + SH_PFC_FUNCTION(avb1), 2798 + SH_PFC_FUNCTION(avb2), 2799 + 2800 + SH_PFC_FUNCTION(canfd0), 2801 + SH_PFC_FUNCTION(canfd1), 2802 + SH_PFC_FUNCTION(canfd2), 2803 + SH_PFC_FUNCTION(canfd3), 2804 + SH_PFC_FUNCTION(can_clk), 2805 + 2806 + SH_PFC_FUNCTION(hscif0), 2807 + SH_PFC_FUNCTION(hscif1), 2808 + SH_PFC_FUNCTION(hscif2), 2809 + SH_PFC_FUNCTION(hscif3), 2810 + 2811 + SH_PFC_FUNCTION(i2c0), 2812 + SH_PFC_FUNCTION(i2c1), 2813 + SH_PFC_FUNCTION(i2c2), 2814 + SH_PFC_FUNCTION(i2c3), 2815 + 2816 + SH_PFC_FUNCTION(mmc), 2817 + 2818 + SH_PFC_FUNCTION(msiof0), 2819 + SH_PFC_FUNCTION(msiof1), 2820 + SH_PFC_FUNCTION(msiof2), 2821 + SH_PFC_FUNCTION(msiof3), 2822 + SH_PFC_FUNCTION(msiof4), 2823 + SH_PFC_FUNCTION(msiof5), 2824 + 2825 + SH_PFC_FUNCTION(pcie), 2826 + 2827 + SH_PFC_FUNCTION(pwm0), 2828 + SH_PFC_FUNCTION(pwm1), 2829 + SH_PFC_FUNCTION(pwm2), 2830 + SH_PFC_FUNCTION(pwm3), 2831 + SH_PFC_FUNCTION(pwm4), 2832 + 2833 + SH_PFC_FUNCTION(qspi0), 2834 + SH_PFC_FUNCTION(qspi1), 2835 + 2836 + SH_PFC_FUNCTION(scif0), 2837 + SH_PFC_FUNCTION(scif1), 2838 + SH_PFC_FUNCTION(scif3), 2839 + SH_PFC_FUNCTION(scif4), 2840 + SH_PFC_FUNCTION(scif_clk), 2841 + SH_PFC_FUNCTION(scif_clk2), 2842 + 2843 + SH_PFC_FUNCTION(ssi), 2844 + 2845 + SH_PFC_FUNCTION(tpu), 2846 + }; 2847 + 2848 + static const struct pinmux_cfg_reg pinmux_config_regs[] = { 2849 + #define F_(x, y) FN_##y 2850 + #define FM(x) FN_##x 2851 + { PINMUX_CFG_REG_VAR("GPSR0", 0xE6050040, 32, 2852 + GROUP(-13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2853 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 2854 + GROUP( 2855 + /* GP0_31_19 RESERVED */ 2856 + GP_0_18_FN, GPSR0_18, 2857 + GP_0_17_FN, GPSR0_17, 2858 + GP_0_16_FN, GPSR0_16, 2859 + GP_0_15_FN, GPSR0_15, 2860 + GP_0_14_FN, GPSR0_14, 2861 + GP_0_13_FN, GPSR0_13, 2862 + GP_0_12_FN, GPSR0_12, 2863 + GP_0_11_FN, GPSR0_11, 2864 + GP_0_10_FN, GPSR0_10, 2865 + GP_0_9_FN, GPSR0_9, 2866 + GP_0_8_FN, GPSR0_8, 2867 + GP_0_7_FN, GPSR0_7, 2868 + GP_0_6_FN, GPSR0_6, 2869 + GP_0_5_FN, GPSR0_5, 2870 + GP_0_4_FN, GPSR0_4, 2871 + GP_0_3_FN, GPSR0_3, 2872 + GP_0_2_FN, GPSR0_2, 2873 + GP_0_1_FN, GPSR0_1, 2874 + GP_0_0_FN, GPSR0_0, )) 2875 + }, 2876 + { PINMUX_CFG_REG("GPSR1", 0xE6050840, 32, 1, GROUP( 2877 + 0, 0, 2878 + 0, 0, 2879 + GP_1_29_FN, GPSR1_29, 2880 + GP_1_28_FN, GPSR1_28, 2881 + GP_1_27_FN, GPSR1_27, 2882 + GP_1_26_FN, GPSR1_26, 2883 + GP_1_25_FN, GPSR1_25, 2884 + GP_1_24_FN, GPSR1_24, 2885 + GP_1_23_FN, GPSR1_23, 2886 + GP_1_22_FN, GPSR1_22, 2887 + GP_1_21_FN, GPSR1_21, 2888 + GP_1_20_FN, GPSR1_20, 2889 + GP_1_19_FN, GPSR1_19, 2890 + GP_1_18_FN, GPSR1_18, 2891 + GP_1_17_FN, GPSR1_17, 2892 + GP_1_16_FN, GPSR1_16, 2893 + GP_1_15_FN, GPSR1_15, 2894 + GP_1_14_FN, GPSR1_14, 2895 + GP_1_13_FN, GPSR1_13, 2896 + GP_1_12_FN, GPSR1_12, 2897 + GP_1_11_FN, GPSR1_11, 2898 + GP_1_10_FN, GPSR1_10, 2899 + GP_1_9_FN, GPSR1_9, 2900 + GP_1_8_FN, GPSR1_8, 2901 + GP_1_7_FN, GPSR1_7, 2902 + GP_1_6_FN, GPSR1_6, 2903 + GP_1_5_FN, GPSR1_5, 2904 + GP_1_4_FN, GPSR1_4, 2905 + GP_1_3_FN, GPSR1_3, 2906 + GP_1_2_FN, GPSR1_2, 2907 + GP_1_1_FN, GPSR1_1, 2908 + GP_1_0_FN, GPSR1_0, )) 2909 + }, 2910 + { PINMUX_CFG_REG_VAR("GPSR2", 0xE6058040, 32, 2911 + GROUP(-12, 1, -1, 1, -1, 1, 1, 1, 1, 1, 1, 2912 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 2913 + GROUP( 2914 + /* GP2_31_20 RESERVED */ 2915 + GP_2_19_FN, GPSR2_19, 2916 + /* GP2_18 RESERVED */ 2917 + GP_2_17_FN, GPSR2_17, 2918 + /* GP2_16 RESERVED */ 2919 + GP_2_15_FN, GPSR2_15, 2920 + GP_2_14_FN, GPSR2_14, 2921 + GP_2_13_FN, GPSR2_13, 2922 + GP_2_12_FN, GPSR2_12, 2923 + GP_2_11_FN, GPSR2_11, 2924 + GP_2_10_FN, GPSR2_10, 2925 + GP_2_9_FN, GPSR2_9, 2926 + GP_2_8_FN, GPSR2_8, 2927 + GP_2_7_FN, GPSR2_7, 2928 + GP_2_6_FN, GPSR2_6, 2929 + GP_2_5_FN, GPSR2_5, 2930 + GP_2_4_FN, GPSR2_4, 2931 + GP_2_3_FN, GPSR2_3, 2932 + GP_2_2_FN, GPSR2_2, 2933 + GP_2_1_FN, GPSR2_1, 2934 + GP_2_0_FN, GPSR2_0, )) 2935 + }, 2936 + { PINMUX_CFG_REG("GPSR3", 0xE6058840, 32, 1, GROUP( 2937 + GP_3_31_FN, GPSR3_31, 2938 + GP_3_30_FN, GPSR3_30, 2939 + GP_3_29_FN, GPSR3_29, 2940 + GP_3_28_FN, GPSR3_28, 2941 + GP_3_27_FN, GPSR3_27, 2942 + GP_3_26_FN, GPSR3_26, 2943 + GP_3_25_FN, GPSR3_25, 2944 + GP_3_24_FN, GPSR3_24, 2945 + GP_3_23_FN, GPSR3_23, 2946 + GP_3_22_FN, GPSR3_22, 2947 + GP_3_21_FN, GPSR3_21, 2948 + GP_3_20_FN, GPSR3_20, 2949 + GP_3_19_FN, GPSR3_19, 2950 + GP_3_18_FN, GPSR3_18, 2951 + GP_3_17_FN, GPSR3_17, 2952 + GP_3_16_FN, GPSR3_16, 2953 + GP_3_15_FN, GPSR3_15, 2954 + GP_3_14_FN, GPSR3_14, 2955 + GP_3_13_FN, GPSR3_13, 2956 + GP_3_12_FN, GPSR3_12, 2957 + GP_3_11_FN, GPSR3_11, 2958 + GP_3_10_FN, GPSR3_10, 2959 + GP_3_9_FN, GPSR3_9, 2960 + GP_3_8_FN, GPSR3_8, 2961 + GP_3_7_FN, GPSR3_7, 2962 + GP_3_6_FN, GPSR3_6, 2963 + GP_3_5_FN, GPSR3_5, 2964 + GP_3_4_FN, GPSR3_4, 2965 + GP_3_3_FN, GPSR3_3, 2966 + GP_3_2_FN, GPSR3_2, 2967 + GP_3_1_FN, GPSR3_1, 2968 + GP_3_0_FN, GPSR3_0, )) 2969 + }, 2970 + { PINMUX_CFG_REG_VAR("GPSR4", 0xE6060040, 32, 2971 + GROUP(-7, 1, 1, -1, 1, -5, 1, 1, 1, 1, 1, 2972 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 2973 + GROUP( 2974 + /* GP4_31_25 RESERVED */ 2975 + GP_4_24_FN, GPSR4_24, 2976 + GP_4_23_FN, GPSR4_23, 2977 + /* GP4_22 RESERVED */ 2978 + GP_4_21_FN, GPSR4_21, 2979 + /* GP4_20_16 RESERVED */ 2980 + GP_4_15_FN, GPSR4_15, 2981 + GP_4_14_FN, GPSR4_14, 2982 + GP_4_13_FN, GPSR4_13, 2983 + GP_4_12_FN, GPSR4_12, 2984 + GP_4_11_FN, GPSR4_11, 2985 + GP_4_10_FN, GPSR4_10, 2986 + GP_4_9_FN, GPSR4_9, 2987 + GP_4_8_FN, GPSR4_8, 2988 + GP_4_7_FN, GPSR4_7, 2989 + GP_4_6_FN, GPSR4_6, 2990 + GP_4_5_FN, GPSR4_5, 2991 + GP_4_4_FN, GPSR4_4, 2992 + GP_4_3_FN, GPSR4_3, 2993 + GP_4_2_FN, GPSR4_2, 2994 + GP_4_1_FN, GPSR4_1, 2995 + GP_4_0_FN, GPSR4_0, )) 2996 + }, 2997 + { PINMUX_CFG_REG_VAR("GPSR5", 0xE6060840, 32, 2998 + GROUP(-11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2999 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 3000 + GROUP( 3001 + /* GP5_31_21 RESERVED */ 3002 + GP_5_20_FN, GPSR5_20, 3003 + GP_5_19_FN, GPSR5_19, 3004 + GP_5_18_FN, GPSR5_18, 3005 + GP_5_17_FN, GPSR5_17, 3006 + GP_5_16_FN, GPSR5_16, 3007 + GP_5_15_FN, GPSR5_15, 3008 + GP_5_14_FN, GPSR5_14, 3009 + GP_5_13_FN, GPSR5_13, 3010 + GP_5_12_FN, GPSR5_12, 3011 + GP_5_11_FN, GPSR5_11, 3012 + GP_5_10_FN, GPSR5_10, 3013 + GP_5_9_FN, GPSR5_9, 3014 + GP_5_8_FN, GPSR5_8, 3015 + GP_5_7_FN, GPSR5_7, 3016 + GP_5_6_FN, GPSR5_6, 3017 + GP_5_5_FN, GPSR5_5, 3018 + GP_5_4_FN, GPSR5_4, 3019 + GP_5_3_FN, GPSR5_3, 3020 + GP_5_2_FN, GPSR5_2, 3021 + GP_5_1_FN, GPSR5_1, 3022 + GP_5_0_FN, GPSR5_0, )) 3023 + }, 3024 + { PINMUX_CFG_REG_VAR("GPSR6", 0xE6061040, 32, 3025 + GROUP(-11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3026 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 3027 + GROUP( 3028 + /* GP6_31_21 RESERVED */ 3029 + GP_6_20_FN, GPSR6_20, 3030 + GP_6_19_FN, GPSR6_19, 3031 + GP_6_18_FN, GPSR6_18, 3032 + GP_6_17_FN, GPSR6_17, 3033 + GP_6_16_FN, GPSR6_16, 3034 + GP_6_15_FN, GPSR6_15, 3035 + GP_6_14_FN, GPSR6_14, 3036 + GP_6_13_FN, GPSR6_13, 3037 + GP_6_12_FN, GPSR6_12, 3038 + GP_6_11_FN, GPSR6_11, 3039 + GP_6_10_FN, GPSR6_10, 3040 + GP_6_9_FN, GPSR6_9, 3041 + GP_6_8_FN, GPSR6_8, 3042 + GP_6_7_FN, GPSR6_7, 3043 + GP_6_6_FN, GPSR6_6, 3044 + GP_6_5_FN, GPSR6_5, 3045 + GP_6_4_FN, GPSR6_4, 3046 + GP_6_3_FN, GPSR6_3, 3047 + GP_6_2_FN, GPSR6_2, 3048 + GP_6_1_FN, GPSR6_1, 3049 + GP_6_0_FN, GPSR6_0, )) 3050 + }, 3051 + { PINMUX_CFG_REG_VAR("GPSR7", 0xE6061840, 32, 3052 + GROUP(-11, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3053 + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1), 3054 + GROUP( 3055 + /* GP7_31_21 RESERVED */ 3056 + GP_7_20_FN, GPSR7_20, 3057 + GP_7_19_FN, GPSR7_19, 3058 + GP_7_18_FN, GPSR7_18, 3059 + GP_7_17_FN, GPSR7_17, 3060 + GP_7_16_FN, GPSR7_16, 3061 + GP_7_15_FN, GPSR7_15, 3062 + GP_7_14_FN, GPSR7_14, 3063 + GP_7_13_FN, GPSR7_13, 3064 + GP_7_12_FN, GPSR7_12, 3065 + GP_7_11_FN, GPSR7_11, 3066 + GP_7_10_FN, GPSR7_10, 3067 + GP_7_9_FN, GPSR7_9, 3068 + GP_7_8_FN, GPSR7_8, 3069 + GP_7_7_FN, GPSR7_7, 3070 + GP_7_6_FN, GPSR7_6, 3071 + GP_7_5_FN, GPSR7_5, 3072 + GP_7_4_FN, GPSR7_4, 3073 + GP_7_3_FN, GPSR7_3, 3074 + GP_7_2_FN, GPSR7_2, 3075 + GP_7_1_FN, GPSR7_1, 3076 + GP_7_0_FN, GPSR7_0, )) 3077 + }, 3078 + #undef F_ 3079 + #undef FM 3080 + 3081 + #define F_(x, y) x, 3082 + #define FM(x) FN_##x, 3083 + { PINMUX_CFG_REG("IP0SR0", 0xE6050060, 32, 4, GROUP( 3084 + IP0SR0_31_28 3085 + IP0SR0_27_24 3086 + IP0SR0_23_20 3087 + IP0SR0_19_16 3088 + IP0SR0_15_12 3089 + IP0SR0_11_8 3090 + IP0SR0_7_4 3091 + IP0SR0_3_0)) 3092 + }, 3093 + { PINMUX_CFG_REG("IP1SR0", 0xE6050064, 32, 4, GROUP( 3094 + IP1SR0_31_28 3095 + IP1SR0_27_24 3096 + IP1SR0_23_20 3097 + IP1SR0_19_16 3098 + IP1SR0_15_12 3099 + IP1SR0_11_8 3100 + IP1SR0_7_4 3101 + IP1SR0_3_0)) 3102 + }, 3103 + { PINMUX_CFG_REG_VAR("IP2SR0", 0xE6050068, 32, 3104 + GROUP(-20, 4, 4, 4), 3105 + GROUP( 3106 + /* IP2SR0_31_12 RESERVED */ 3107 + IP2SR0_11_8 3108 + IP2SR0_7_4 3109 + IP2SR0_3_0)) 3110 + }, 3111 + { PINMUX_CFG_REG("IP0SR1", 0xE6050860, 32, 4, GROUP( 3112 + IP0SR1_31_28 3113 + IP0SR1_27_24 3114 + IP0SR1_23_20 3115 + IP0SR1_19_16 3116 + IP0SR1_15_12 3117 + IP0SR1_11_8 3118 + IP0SR1_7_4 3119 + IP0SR1_3_0)) 3120 + }, 3121 + { PINMUX_CFG_REG("IP1SR1", 0xE6050864, 32, 4, GROUP( 3122 + IP1SR1_31_28 3123 + IP1SR1_27_24 3124 + IP1SR1_23_20 3125 + IP1SR1_19_16 3126 + IP1SR1_15_12 3127 + IP1SR1_11_8 3128 + IP1SR1_7_4 3129 + IP1SR1_3_0)) 3130 + }, 3131 + { PINMUX_CFG_REG("IP2SR1", 0xE6050868, 32, 4, GROUP( 3132 + IP2SR1_31_28 3133 + IP2SR1_27_24 3134 + IP2SR1_23_20 3135 + IP2SR1_19_16 3136 + IP2SR1_15_12 3137 + IP2SR1_11_8 3138 + IP2SR1_7_4 3139 + IP2SR1_3_0)) 3140 + }, 3141 + { PINMUX_CFG_REG_VAR("IP3SR1", 0xE605086C, 32, 3142 + GROUP(-8, 4, 4, 4, 4, 4, 4), 3143 + GROUP( 3144 + /* IP3SR1_31_24 RESERVED */ 3145 + IP3SR1_23_20 3146 + IP3SR1_19_16 3147 + IP3SR1_15_12 3148 + IP3SR1_11_8 3149 + IP3SR1_7_4 3150 + IP3SR1_3_0)) 3151 + }, 3152 + { PINMUX_CFG_REG("IP0SR2", 0xE6058060, 32, 4, GROUP( 3153 + IP0SR2_31_28 3154 + IP0SR2_27_24 3155 + IP0SR2_23_20 3156 + IP0SR2_19_16 3157 + IP0SR2_15_12 3158 + IP0SR2_11_8 3159 + IP0SR2_7_4 3160 + IP0SR2_3_0)) 3161 + }, 3162 + { PINMUX_CFG_REG("IP1SR2", 0xE6058064, 32, 4, GROUP( 3163 + IP1SR2_31_28 3164 + IP1SR2_27_24 3165 + IP1SR2_23_20 3166 + IP1SR2_19_16 3167 + IP1SR2_15_12 3168 + IP1SR2_11_8 3169 + IP1SR2_7_4 3170 + IP1SR2_3_0)) 3171 + }, 3172 + { PINMUX_CFG_REG_VAR("IP2SR2", 0xE6058068, 32, 3173 + GROUP(-16, 4, -4, 4, -4), 3174 + GROUP( 3175 + /* IP2SR2_31_16 RESERVED */ 3176 + IP2SR2_15_12 3177 + /* IP2SR2_11_8 RESERVED */ 3178 + IP2SR2_7_4 3179 + /* IP2SR2_3_0 RESERVED */)) 3180 + }, 3181 + { PINMUX_CFG_REG("IP0SR3", 0xE6058860, 32, 4, GROUP( 3182 + IP0SR3_31_28 3183 + IP0SR3_27_24 3184 + IP0SR3_23_20 3185 + IP0SR3_19_16 3186 + IP0SR3_15_12 3187 + IP0SR3_11_8 3188 + IP0SR3_7_4 3189 + IP0SR3_3_0)) 3190 + }, 3191 + { PINMUX_CFG_REG("IP1SR3", 0xE6058864, 32, 4, GROUP( 3192 + IP1SR3_31_28 3193 + IP1SR3_27_24 3194 + IP1SR3_23_20 3195 + IP1SR3_19_16 3196 + IP1SR3_15_12 3197 + IP1SR3_11_8 3198 + IP1SR3_7_4 3199 + IP1SR3_3_0)) 3200 + }, 3201 + { PINMUX_CFG_REG("IP2SR3", 0xE6058868, 32, 4, GROUP( 3202 + IP2SR3_31_28 3203 + IP2SR3_27_24 3204 + IP2SR3_23_20 3205 + IP2SR3_19_16 3206 + IP2SR3_15_12 3207 + IP2SR3_11_8 3208 + IP2SR3_7_4 3209 + IP2SR3_3_0)) 3210 + }, 3211 + { PINMUX_CFG_REG("IP3SR3", 0xE605886C, 32, 4, GROUP( 3212 + IP3SR3_31_28 3213 + IP3SR3_27_24 3214 + IP3SR3_23_20 3215 + IP3SR3_19_16 3216 + IP3SR3_15_12 3217 + IP3SR3_11_8 3218 + IP3SR3_7_4 3219 + IP3SR3_3_0)) 3220 + }, 3221 + { PINMUX_CFG_REG("IP0SR4", 0xE6060060, 32, 4, GROUP( 3222 + IP0SR4_31_28 3223 + IP0SR4_27_24 3224 + IP0SR4_23_20 3225 + IP0SR4_19_16 3226 + IP0SR4_15_12 3227 + IP0SR4_11_8 3228 + IP0SR4_7_4 3229 + IP0SR4_3_0)) 3230 + }, 3231 + { PINMUX_CFG_REG("IP1SR4", 0xE6060064, 32, 4, GROUP( 3232 + IP1SR4_31_28 3233 + IP1SR4_27_24 3234 + IP1SR4_23_20 3235 + IP1SR4_19_16 3236 + IP1SR4_15_12 3237 + IP1SR4_11_8 3238 + IP1SR4_7_4 3239 + IP1SR4_3_0)) 3240 + }, 3241 + { PINMUX_CFG_REG_VAR("IP2SR4", 0xE6060068, 32, 3242 + GROUP(4, -4, 4, -20), 3243 + GROUP( 3244 + IP2SR4_31_28 3245 + /* IP2SR4_27_24 RESERVED */ 3246 + IP2SR4_23_20 3247 + /* IP2SR4_19_0 RESERVED */)) 3248 + }, 3249 + { PINMUX_CFG_REG_VAR("IP3SR4", 0xE606006C, 32, 3250 + GROUP(-28, 4), 3251 + GROUP( 3252 + /* IP3SR4_31_4 RESERVED */ 3253 + IP3SR4_3_0)) 3254 + }, 3255 + { PINMUX_CFG_REG("IP0SR5", 0xE6060860, 32, 4, GROUP( 3256 + IP0SR5_31_28 3257 + IP0SR5_27_24 3258 + IP0SR5_23_20 3259 + IP0SR5_19_16 3260 + IP0SR5_15_12 3261 + IP0SR5_11_8 3262 + IP0SR5_7_4 3263 + IP0SR5_3_0)) 3264 + }, 3265 + { PINMUX_CFG_REG("IP1SR5", 0xE6060864, 32, 4, GROUP( 3266 + IP1SR5_31_28 3267 + IP1SR5_27_24 3268 + IP1SR5_23_20 3269 + IP1SR5_19_16 3270 + IP1SR5_15_12 3271 + IP1SR5_11_8 3272 + IP1SR5_7_4 3273 + IP1SR5_3_0)) 3274 + }, 3275 + { PINMUX_CFG_REG_VAR("IP2SR5", 0xE6060868, 32, 3276 + GROUP(-12, 4, 4, 4, 4, 4), 3277 + GROUP( 3278 + /* IP2SR5_31_20 RESERVED */ 3279 + IP2SR5_19_16 3280 + IP2SR5_15_12 3281 + IP2SR5_11_8 3282 + IP2SR5_7_4 3283 + IP2SR5_3_0)) 3284 + }, 3285 + { PINMUX_CFG_REG("IP0SR6", 0xE6061060, 32, 4, GROUP( 3286 + IP0SR6_31_28 3287 + IP0SR6_27_24 3288 + IP0SR6_23_20 3289 + IP0SR6_19_16 3290 + IP0SR6_15_12 3291 + IP0SR6_11_8 3292 + IP0SR6_7_4 3293 + IP0SR6_3_0)) 3294 + }, 3295 + { PINMUX_CFG_REG("IP1SR6", 0xE6061064, 32, 4, GROUP( 3296 + IP1SR6_31_28 3297 + IP1SR6_27_24 3298 + IP1SR6_23_20 3299 + IP1SR6_19_16 3300 + IP1SR6_15_12 3301 + IP1SR6_11_8 3302 + IP1SR6_7_4 3303 + IP1SR6_3_0)) 3304 + }, 3305 + { PINMUX_CFG_REG_VAR("IP2SR6", 0xE6061068, 32, 3306 + GROUP(-12, 4, 4, 4, 4, 4), 3307 + GROUP( 3308 + /* IP2SR6_31_20 RESERVED */ 3309 + IP2SR6_19_16 3310 + IP2SR6_15_12 3311 + IP2SR6_11_8 3312 + IP2SR6_7_4 3313 + IP2SR6_3_0)) 3314 + }, 3315 + { PINMUX_CFG_REG("IP0SR7", 0xE6061860, 32, 4, GROUP( 3316 + IP0SR7_31_28 3317 + IP0SR7_27_24 3318 + IP0SR7_23_20 3319 + IP0SR7_19_16 3320 + IP0SR7_15_12 3321 + IP0SR7_11_8 3322 + IP0SR7_7_4 3323 + IP0SR7_3_0)) 3324 + }, 3325 + { PINMUX_CFG_REG("IP1SR7", 0xE6061864, 32, 4, GROUP( 3326 + IP1SR7_31_28 3327 + IP1SR7_27_24 3328 + IP1SR7_23_20 3329 + IP1SR7_19_16 3330 + IP1SR7_15_12 3331 + IP1SR7_11_8 3332 + IP1SR7_7_4 3333 + IP1SR7_3_0)) 3334 + }, 3335 + { PINMUX_CFG_REG_VAR("IP2SR7", 0xE6061868, 32, 3336 + GROUP(-12, 4, 4, 4, 4, 4), 3337 + GROUP( 3338 + /* IP2SR7_31_20 RESERVED */ 3339 + IP2SR7_19_16 3340 + IP2SR7_15_12 3341 + IP2SR7_11_8 3342 + IP2SR7_7_4 3343 + IP2SR7_3_0)) 3344 + }, 3345 + #undef F_ 3346 + #undef FM 3347 + 3348 + #define F_(x, y) x, 3349 + #define FM(x) FN_##x, 3350 + { PINMUX_CFG_REG_VAR("MOD_SEL4", 0xE6060100, 32, 3351 + GROUP(-24, 1, 1, 1, 1, 1, 1, 1, 1), 3352 + GROUP( 3353 + /* RESERVED 31-8 */ 3354 + MOD_SEL4_7 3355 + MOD_SEL4_6 3356 + MOD_SEL4_5 3357 + MOD_SEL4_4 3358 + MOD_SEL4_3 3359 + MOD_SEL4_2 3360 + MOD_SEL4_1 3361 + MOD_SEL4_0)) 3362 + }, 3363 + { }, 3364 + }; 3365 + 3366 + static const struct pinmux_drive_reg pinmux_drive_regs[] = { 3367 + { PINMUX_DRIVE_REG("DRV0CTRL0", 0xE6050080) { 3368 + { RCAR_GP_PIN(0, 7), 28, 3 }, /* MSIOF5_SS2 */ 3369 + { RCAR_GP_PIN(0, 6), 24, 3 }, /* IRQ0 */ 3370 + { RCAR_GP_PIN(0, 5), 20, 3 }, /* IRQ1 */ 3371 + { RCAR_GP_PIN(0, 4), 16, 3 }, /* IRQ2 */ 3372 + { RCAR_GP_PIN(0, 3), 12, 3 }, /* IRQ3 */ 3373 + { RCAR_GP_PIN(0, 2), 8, 3 }, /* GP0_02 */ 3374 + { RCAR_GP_PIN(0, 1), 4, 3 }, /* GP0_01 */ 3375 + { RCAR_GP_PIN(0, 0), 0, 3 }, /* GP0_00 */ 3376 + } }, 3377 + { PINMUX_DRIVE_REG("DRV1CTRL0", 0xE6050084) { 3378 + { RCAR_GP_PIN(0, 15), 28, 3 }, /* MSIOF2_SYNC */ 3379 + { RCAR_GP_PIN(0, 14), 24, 3 }, /* MSIOF2_SS1 */ 3380 + { RCAR_GP_PIN(0, 13), 20, 3 }, /* MSIOF2_SS2 */ 3381 + { RCAR_GP_PIN(0, 12), 16, 3 }, /* MSIOF5_RXD */ 3382 + { RCAR_GP_PIN(0, 11), 12, 3 }, /* MSIOF5_SCK */ 3383 + { RCAR_GP_PIN(0, 10), 8, 3 }, /* MSIOF5_TXD */ 3384 + { RCAR_GP_PIN(0, 9), 4, 3 }, /* MSIOF5_SYNC */ 3385 + { RCAR_GP_PIN(0, 8), 0, 3 }, /* MSIOF5_SS1 */ 3386 + } }, 3387 + { PINMUX_DRIVE_REG("DRV2CTRL0", 0xE6050088) { 3388 + { RCAR_GP_PIN(0, 18), 8, 3 }, /* MSIOF2_RXD */ 3389 + { RCAR_GP_PIN(0, 17), 4, 3 }, /* MSIOF2_SCK */ 3390 + { RCAR_GP_PIN(0, 16), 0, 3 }, /* MSIOF2_TXD */ 3391 + } }, 3392 + { PINMUX_DRIVE_REG("DRV0CTRL1", 0xE6050880) { 3393 + { RCAR_GP_PIN(1, 7), 28, 3 }, /* MSIOF0_SS1 */ 3394 + { RCAR_GP_PIN(1, 6), 24, 3 }, /* MSIOF0_SS2 */ 3395 + { RCAR_GP_PIN(1, 5), 20, 3 }, /* MSIOF1_RXD */ 3396 + { RCAR_GP_PIN(1, 4), 16, 3 }, /* MSIOF1_TXD */ 3397 + { RCAR_GP_PIN(1, 3), 12, 3 }, /* MSIOF1_SCK */ 3398 + { RCAR_GP_PIN(1, 2), 8, 3 }, /* MSIOF1_SYNC */ 3399 + { RCAR_GP_PIN(1, 1), 4, 3 }, /* MSIOF1_SS1 */ 3400 + { RCAR_GP_PIN(1, 0), 0, 3 }, /* MSIOF1_SS2 */ 3401 + } }, 3402 + { PINMUX_DRIVE_REG("DRV1CTRL1", 0xE6050884) { 3403 + { RCAR_GP_PIN(1, 15), 28, 3 }, /* HSCK0 */ 3404 + { RCAR_GP_PIN(1, 14), 24, 3 }, /* HRTS0_N */ 3405 + { RCAR_GP_PIN(1, 13), 20, 3 }, /* HCTS0_N */ 3406 + { RCAR_GP_PIN(1, 12), 16, 3 }, /* HTX0 */ 3407 + { RCAR_GP_PIN(1, 11), 12, 3 }, /* MSIOF0_RXD */ 3408 + { RCAR_GP_PIN(1, 10), 8, 3 }, /* MSIOF0_SCK */ 3409 + { RCAR_GP_PIN(1, 9), 4, 3 }, /* MSIOF0_TXD */ 3410 + { RCAR_GP_PIN(1, 8), 0, 3 }, /* MSIOF0_SYNC */ 3411 + } }, 3412 + { PINMUX_DRIVE_REG("DRV2CTRL1", 0xE6050888) { 3413 + { RCAR_GP_PIN(1, 23), 28, 3 }, /* GP1_23 */ 3414 + { RCAR_GP_PIN(1, 22), 24, 3 }, /* AUDIO_CLKIN */ 3415 + { RCAR_GP_PIN(1, 21), 20, 3 }, /* AUDIO_CLKOUT */ 3416 + { RCAR_GP_PIN(1, 20), 16, 3 }, /* SSI_SD */ 3417 + { RCAR_GP_PIN(1, 19), 12, 3 }, /* SSI_WS */ 3418 + { RCAR_GP_PIN(1, 18), 8, 3 }, /* SSI_SCK */ 3419 + { RCAR_GP_PIN(1, 17), 4, 3 }, /* SCIF_CLK */ 3420 + { RCAR_GP_PIN(1, 16), 0, 3 }, /* HRX0 */ 3421 + } }, 3422 + { PINMUX_DRIVE_REG("DRV3CTRL1", 0xE605088C) { 3423 + { RCAR_GP_PIN(1, 29), 20, 2 }, /* ERROROUTC_N */ 3424 + { RCAR_GP_PIN(1, 28), 16, 3 }, /* HTX3 */ 3425 + { RCAR_GP_PIN(1, 27), 12, 3 }, /* HCTS3_N */ 3426 + { RCAR_GP_PIN(1, 26), 8, 3 }, /* HRTS3_N */ 3427 + { RCAR_GP_PIN(1, 25), 4, 3 }, /* HSCK3 */ 3428 + { RCAR_GP_PIN(1, 24), 0, 3 }, /* HRX3 */ 3429 + } }, 3430 + { PINMUX_DRIVE_REG("DRV0CTRL2", 0xE6058080) { 3431 + { RCAR_GP_PIN(2, 7), 28, 3 }, /* TPU0TO1 */ 3432 + { RCAR_GP_PIN(2, 6), 24, 3 }, /* FXR_TXDB */ 3433 + { RCAR_GP_PIN(2, 5), 20, 3 }, /* FXR_TXENB_N */ 3434 + { RCAR_GP_PIN(2, 4), 16, 3 }, /* RXDB_EXTFXR */ 3435 + { RCAR_GP_PIN(2, 3), 12, 3 }, /* CLK_EXTFXR */ 3436 + { RCAR_GP_PIN(2, 2), 8, 3 }, /* RXDA_EXTFXR */ 3437 + { RCAR_GP_PIN(2, 1), 4, 3 }, /* FXR_TXENA_N */ 3438 + { RCAR_GP_PIN(2, 0), 0, 3 }, /* FXR_TXDA */ 3439 + } }, 3440 + { PINMUX_DRIVE_REG("DRV1CTRL2", 0xE6058084) { 3441 + { RCAR_GP_PIN(2, 15), 28, 3 }, /* CANFD3_RX */ 3442 + { RCAR_GP_PIN(2, 14), 24, 3 }, /* CANFD3_TX */ 3443 + { RCAR_GP_PIN(2, 13), 20, 3 }, /* CANFD2_RX */ 3444 + { RCAR_GP_PIN(2, 12), 16, 3 }, /* CANFD2_TX */ 3445 + { RCAR_GP_PIN(2, 11), 12, 3 }, /* CANFD0_RX */ 3446 + { RCAR_GP_PIN(2, 10), 8, 3 }, /* CANFD0_TX */ 3447 + { RCAR_GP_PIN(2, 9), 4, 3 }, /* CAN_CLK */ 3448 + { RCAR_GP_PIN(2, 8), 0, 3 }, /* TPU0TO0 */ 3449 + } }, 3450 + { PINMUX_DRIVE_REG("DRV2CTRL2", 0xE6058088) { 3451 + { RCAR_GP_PIN(2, 19), 12, 3 }, /* CANFD1_RX */ 3452 + { RCAR_GP_PIN(2, 17), 4, 3 }, /* CANFD1_TX */ 3453 + } }, 3454 + { PINMUX_DRIVE_REG("DRV0CTRL3", 0xE6058880) { 3455 + { RCAR_GP_PIN(3, 7), 28, 3 }, /* MMC_D4 */ 3456 + { RCAR_GP_PIN(3, 6), 24, 3 }, /* MMC_D5 */ 3457 + { RCAR_GP_PIN(3, 5), 20, 3 }, /* MMC_SD_D3 */ 3458 + { RCAR_GP_PIN(3, 4), 16, 3 }, /* MMC_DS */ 3459 + { RCAR_GP_PIN(3, 3), 12, 3 }, /* MMC_SD_CLK */ 3460 + { RCAR_GP_PIN(3, 2), 8, 3 }, /* MMC_SD_D2 */ 3461 + { RCAR_GP_PIN(3, 1), 4, 3 }, /* MMC_SD_D0 */ 3462 + { RCAR_GP_PIN(3, 0), 0, 3 }, /* MMC_SD_D1 */ 3463 + } }, 3464 + { PINMUX_DRIVE_REG("DRV1CTRL3", 0xE6058884) { 3465 + { RCAR_GP_PIN(3, 15), 28, 2 }, /* QSPI0_SSL */ 3466 + { RCAR_GP_PIN(3, 14), 24, 2 }, /* PWM2 */ 3467 + { RCAR_GP_PIN(3, 13), 20, 2 }, /* PWM1 */ 3468 + { RCAR_GP_PIN(3, 12), 16, 3 }, /* SD_WP */ 3469 + { RCAR_GP_PIN(3, 11), 12, 3 }, /* SD_CD */ 3470 + { RCAR_GP_PIN(3, 10), 8, 3 }, /* MMC_SD_CMD */ 3471 + { RCAR_GP_PIN(3, 9), 4, 3 }, /* MMC_D6*/ 3472 + { RCAR_GP_PIN(3, 8), 0, 3 }, /* MMC_D7 */ 3473 + } }, 3474 + { PINMUX_DRIVE_REG("DRV2CTRL3", 0xE6058888) { 3475 + { RCAR_GP_PIN(3, 23), 28, 2 }, /* QSPI1_MISO_IO1 */ 3476 + { RCAR_GP_PIN(3, 22), 24, 2 }, /* QSPI1_SPCLK */ 3477 + { RCAR_GP_PIN(3, 21), 20, 2 }, /* QSPI1_MOSI_IO0 */ 3478 + { RCAR_GP_PIN(3, 20), 16, 2 }, /* QSPI0_SPCLK */ 3479 + { RCAR_GP_PIN(3, 19), 12, 2 }, /* QSPI0_MOSI_IO0 */ 3480 + { RCAR_GP_PIN(3, 18), 8, 2 }, /* QSPI0_MISO_IO1 */ 3481 + { RCAR_GP_PIN(3, 17), 4, 2 }, /* QSPI0_IO2 */ 3482 + { RCAR_GP_PIN(3, 16), 0, 2 }, /* QSPI0_IO3 */ 3483 + } }, 3484 + { PINMUX_DRIVE_REG("DRV3CTRL3", 0xE605888C) { 3485 + { RCAR_GP_PIN(3, 31), 28, 2 }, /* TCLK4 */ 3486 + { RCAR_GP_PIN(3, 30), 24, 2 }, /* TCLK3 */ 3487 + { RCAR_GP_PIN(3, 29), 20, 2 }, /* RPC_INT_N */ 3488 + { RCAR_GP_PIN(3, 28), 16, 2 }, /* RPC_WP_N */ 3489 + { RCAR_GP_PIN(3, 27), 12, 2 }, /* RPC_RESET_N */ 3490 + { RCAR_GP_PIN(3, 26), 8, 2 }, /* QSPI1_IO3 */ 3491 + { RCAR_GP_PIN(3, 25), 4, 2 }, /* QSPI1_SSL */ 3492 + { RCAR_GP_PIN(3, 24), 0, 2 }, /* QSPI1_IO2 */ 3493 + } }, 3494 + { PINMUX_DRIVE_REG("DRV0CTRL4", 0xE6060080) { 3495 + { RCAR_GP_PIN(4, 7), 28, 3 }, /* SDA3 */ 3496 + { RCAR_GP_PIN(4, 6), 24, 3 }, /* SCL3 */ 3497 + { RCAR_GP_PIN(4, 5), 20, 3 }, /* SDA2 */ 3498 + { RCAR_GP_PIN(4, 4), 16, 3 }, /* SCL2 */ 3499 + { RCAR_GP_PIN(4, 3), 12, 3 }, /* SDA1 */ 3500 + { RCAR_GP_PIN(4, 2), 8, 3 }, /* SCL1 */ 3501 + { RCAR_GP_PIN(4, 1), 4, 3 }, /* SDA0 */ 3502 + { RCAR_GP_PIN(4, 0), 0, 3 }, /* SCL0 */ 3503 + } }, 3504 + { PINMUX_DRIVE_REG("DRV1CTRL4", 0xE6060084) { 3505 + { RCAR_GP_PIN(4, 15), 28, 3 }, /* PWM4 */ 3506 + { RCAR_GP_PIN(4, 14), 24, 3 }, /* PWM3 */ 3507 + { RCAR_GP_PIN(4, 13), 20, 3 }, /* HSCK2 */ 3508 + { RCAR_GP_PIN(4, 12), 16, 3 }, /* HCTS2_N */ 3509 + { RCAR_GP_PIN(4, 11), 12, 3 }, /* SCIF_CLK2 */ 3510 + { RCAR_GP_PIN(4, 10), 8, 3 }, /* HRTS2_N */ 3511 + { RCAR_GP_PIN(4, 9), 4, 3 }, /* HTX2 */ 3512 + { RCAR_GP_PIN(4, 8), 0, 3 }, /* HRX2 */ 3513 + } }, 3514 + { PINMUX_DRIVE_REG("DRV2CTRL4", 0xE6060088) { 3515 + { RCAR_GP_PIN(4, 23), 28, 3 }, /* AVS0 */ 3516 + { RCAR_GP_PIN(4, 21), 20, 3 }, /* PCIE0_CLKREQ_N */ 3517 + } }, 3518 + { PINMUX_DRIVE_REG("DRV3CTRL4", 0xE606008C) { 3519 + { RCAR_GP_PIN(4, 24), 0, 3 }, /* AVS1 */ 3520 + } }, 3521 + { PINMUX_DRIVE_REG("DRV0CTRL5", 0xE6060880) { 3522 + { RCAR_GP_PIN(5, 7), 28, 3 }, /* AVB2_TXCREFCLK */ 3523 + { RCAR_GP_PIN(5, 6), 24, 3 }, /* AVB2_MDC */ 3524 + { RCAR_GP_PIN(5, 5), 20, 3 }, /* AVB2_MAGIC */ 3525 + { RCAR_GP_PIN(5, 4), 16, 3 }, /* AVB2_PHY_INT */ 3526 + { RCAR_GP_PIN(5, 3), 12, 3 }, /* AVB2_LINK */ 3527 + { RCAR_GP_PIN(5, 2), 8, 3 }, /* AVB2_AVTP_MATCH */ 3528 + { RCAR_GP_PIN(5, 1), 4, 3 }, /* AVB2_AVTP_CAPTURE */ 3529 + { RCAR_GP_PIN(5, 0), 0, 3 }, /* AVB2_AVTP_PPS */ 3530 + } }, 3531 + { PINMUX_DRIVE_REG("DRV1CTRL5", 0xE6060884) { 3532 + { RCAR_GP_PIN(5, 15), 28, 3 }, /* AVB2_TD0 */ 3533 + { RCAR_GP_PIN(5, 14), 24, 3 }, /* AVB2_RD1 */ 3534 + { RCAR_GP_PIN(5, 13), 20, 3 }, /* AVB2_RD2 */ 3535 + { RCAR_GP_PIN(5, 12), 16, 3 }, /* AVB2_TD1 */ 3536 + { RCAR_GP_PIN(5, 11), 12, 3 }, /* AVB2_TD2 */ 3537 + { RCAR_GP_PIN(5, 10), 8, 3 }, /* AVB2_MDIO */ 3538 + { RCAR_GP_PIN(5, 9), 4, 3 }, /* AVB2_RD3 */ 3539 + { RCAR_GP_PIN(5, 8), 0, 3 }, /* AVB2_TD3 */ 3540 + } }, 3541 + { PINMUX_DRIVE_REG("DRV2CTRL5", 0xE6060888) { 3542 + { RCAR_GP_PIN(5, 20), 16, 3 }, /* AVB2_RX_CTL */ 3543 + { RCAR_GP_PIN(5, 19), 12, 3 }, /* AVB2_TX_CTL */ 3544 + { RCAR_GP_PIN(5, 18), 8, 3 }, /* AVB2_RXC */ 3545 + { RCAR_GP_PIN(5, 17), 4, 3 }, /* AVB2_RD0 */ 3546 + { RCAR_GP_PIN(5, 16), 0, 3 }, /* AVB2_TXC */ 3547 + } }, 3548 + { PINMUX_DRIVE_REG("DRV0CTRL6", 0xE6061080) { 3549 + { RCAR_GP_PIN(6, 7), 28, 3 }, /* AVB1_TX_CTL */ 3550 + { RCAR_GP_PIN(6, 6), 24, 3 }, /* AVB1_TXC */ 3551 + { RCAR_GP_PIN(6, 5), 20, 3 }, /* AVB1_AVTP_MATCH */ 3552 + { RCAR_GP_PIN(6, 4), 16, 3 }, /* AVB1_LINK */ 3553 + { RCAR_GP_PIN(6, 3), 12, 3 }, /* AVB1_PHY_INT */ 3554 + { RCAR_GP_PIN(6, 2), 8, 3 }, /* AVB1_MDC */ 3555 + { RCAR_GP_PIN(6, 1), 4, 3 }, /* AVB1_MAGIC */ 3556 + { RCAR_GP_PIN(6, 0), 0, 3 }, /* AVB1_MDIO */ 3557 + } }, 3558 + { PINMUX_DRIVE_REG("DRV1CTRL6", 0xE6061084) { 3559 + { RCAR_GP_PIN(6, 15), 28, 3 }, /* AVB1_RD0 */ 3560 + { RCAR_GP_PIN(6, 14), 24, 3 }, /* AVB1_RD1 */ 3561 + { RCAR_GP_PIN(6, 13), 20, 3 }, /* AVB1_TD0 */ 3562 + { RCAR_GP_PIN(6, 12), 16, 3 }, /* AVB1_TD1 */ 3563 + { RCAR_GP_PIN(6, 11), 12, 3 }, /* AVB1_AVTP_CAPTURE */ 3564 + { RCAR_GP_PIN(6, 10), 8, 3 }, /* AVB1_AVTP_PPS */ 3565 + { RCAR_GP_PIN(6, 9), 4, 3 }, /* AVB1_RX_CTL */ 3566 + { RCAR_GP_PIN(6, 8), 0, 3 }, /* AVB1_RXC */ 3567 + } }, 3568 + { PINMUX_DRIVE_REG("DRV2CTRL6", 0xE6061088) { 3569 + { RCAR_GP_PIN(6, 20), 16, 3 }, /* AVB1_TXCREFCLK */ 3570 + { RCAR_GP_PIN(6, 19), 12, 3 }, /* AVB1_RD3 */ 3571 + { RCAR_GP_PIN(6, 18), 8, 3 }, /* AVB1_TD3 */ 3572 + { RCAR_GP_PIN(6, 17), 4, 3 }, /* AVB1_RD2 */ 3573 + { RCAR_GP_PIN(6, 16), 0, 3 }, /* AVB1_TD2 */ 3574 + } }, 3575 + { PINMUX_DRIVE_REG("DRV0CTRL7", 0xE6061880) { 3576 + { RCAR_GP_PIN(7, 7), 28, 3 }, /* AVB0_TD1 */ 3577 + { RCAR_GP_PIN(7, 6), 24, 3 }, /* AVB0_TD2 */ 3578 + { RCAR_GP_PIN(7, 5), 20, 3 }, /* AVB0_PHY_INT */ 3579 + { RCAR_GP_PIN(7, 4), 16, 3 }, /* AVB0_LINK */ 3580 + { RCAR_GP_PIN(7, 3), 12, 3 }, /* AVB0_TD3 */ 3581 + { RCAR_GP_PIN(7, 2), 8, 3 }, /* AVB0_AVTP_MATCH */ 3582 + { RCAR_GP_PIN(7, 1), 4, 3 }, /* AVB0_AVTP_CAPTURE */ 3583 + { RCAR_GP_PIN(7, 0), 0, 3 }, /* AVB0_AVTP_PPS */ 3584 + } }, 3585 + { PINMUX_DRIVE_REG("DRV1CTRL7", 0xE6061884) { 3586 + { RCAR_GP_PIN(7, 15), 28, 3 }, /* AVB0_TXC */ 3587 + { RCAR_GP_PIN(7, 14), 24, 3 }, /* AVB0_MDIO */ 3588 + { RCAR_GP_PIN(7, 13), 20, 3 }, /* AVB0_MDC */ 3589 + { RCAR_GP_PIN(7, 12), 16, 3 }, /* AVB0_RD2 */ 3590 + { RCAR_GP_PIN(7, 11), 12, 3 }, /* AVB0_TD0 */ 3591 + { RCAR_GP_PIN(7, 10), 8, 3 }, /* AVB0_MAGIC */ 3592 + { RCAR_GP_PIN(7, 9), 4, 3 }, /* AVB0_TXCREFCLK */ 3593 + { RCAR_GP_PIN(7, 8), 0, 3 }, /* AVB0_RD3 */ 3594 + } }, 3595 + { PINMUX_DRIVE_REG("DRV2CTRL7", 0xE6061888) { 3596 + { RCAR_GP_PIN(7, 20), 16, 3 }, /* AVB0_RX_CTL */ 3597 + { RCAR_GP_PIN(7, 19), 12, 3 }, /* AVB0_RXC */ 3598 + { RCAR_GP_PIN(7, 18), 8, 3 }, /* AVB0_RD0 */ 3599 + { RCAR_GP_PIN(7, 17), 4, 3 }, /* AVB0_RD1 */ 3600 + { RCAR_GP_PIN(7, 16), 0, 3 }, /* AVB0_TX_CTL */ 3601 + } }, 3602 + { }, 3603 + }; 3604 + 3605 + enum ioctrl_regs { 3606 + POC0, 3607 + POC1, 3608 + POC3, 3609 + POC4, 3610 + POC5, 3611 + POC6, 3612 + POC7, 3613 + }; 3614 + 3615 + static const struct pinmux_ioctrl_reg pinmux_ioctrl_regs[] = { 3616 + [POC0] = { 0xE60500A0, }, 3617 + [POC1] = { 0xE60508A0, }, 3618 + [POC3] = { 0xE60588A0, }, 3619 + [POC4] = { 0xE60600A0, }, 3620 + [POC5] = { 0xE60608A0, }, 3621 + [POC6] = { 0xE60610A0, }, 3622 + [POC7] = { 0xE60618A0, }, 3623 + { /* sentinel */ }, 3624 + }; 3625 + 3626 + static int r8a779h0_pin_to_pocctrl(unsigned int pin, u32 *pocctrl) 3627 + { 3628 + int bit = pin & 0x1f; 3629 + 3630 + switch (pin) { 3631 + case RCAR_GP_PIN(0, 0) ... RCAR_GP_PIN(0, 18): 3632 + *pocctrl = pinmux_ioctrl_regs[POC0].reg; 3633 + return bit; 3634 + 3635 + case RCAR_GP_PIN(1, 0) ... RCAR_GP_PIN(1, 28): 3636 + *pocctrl = pinmux_ioctrl_regs[POC1].reg; 3637 + return bit; 3638 + 3639 + case RCAR_GP_PIN(3, 0) ... RCAR_GP_PIN(3, 12): 3640 + *pocctrl = pinmux_ioctrl_regs[POC3].reg; 3641 + return bit; 3642 + 3643 + case RCAR_GP_PIN(4, 0) ... RCAR_GP_PIN(4, 13): 3644 + *pocctrl = pinmux_ioctrl_regs[POC4].reg; 3645 + return bit; 3646 + 3647 + case PIN_VDDQ_AVB2: 3648 + *pocctrl = pinmux_ioctrl_regs[POC5].reg; 3649 + return 0; 3650 + 3651 + case PIN_VDDQ_AVB1: 3652 + *pocctrl = pinmux_ioctrl_regs[POC6].reg; 3653 + return 0; 3654 + 3655 + case PIN_VDDQ_AVB0: 3656 + *pocctrl = pinmux_ioctrl_regs[POC7].reg; 3657 + return 0; 3658 + 3659 + default: 3660 + return -EINVAL; 3661 + } 3662 + } 3663 + 3664 + static const struct pinmux_bias_reg pinmux_bias_regs[] = { 3665 + { PINMUX_BIAS_REG("PUEN0", 0xE60500C0, "PUD0", 0xE60500E0) { 3666 + [ 0] = RCAR_GP_PIN(0, 0), /* GP0_00 */ 3667 + [ 1] = RCAR_GP_PIN(0, 1), /* GP0_01 */ 3668 + [ 2] = RCAR_GP_PIN(0, 2), /* GP0_02 */ 3669 + [ 3] = RCAR_GP_PIN(0, 3), /* IRQ3 */ 3670 + [ 4] = RCAR_GP_PIN(0, 4), /* IRQ2 */ 3671 + [ 5] = RCAR_GP_PIN(0, 5), /* IRQ1 */ 3672 + [ 6] = RCAR_GP_PIN(0, 6), /* IRQ0 */ 3673 + [ 7] = RCAR_GP_PIN(0, 7), /* MSIOF5_SS2 */ 3674 + [ 8] = RCAR_GP_PIN(0, 8), /* MSIOF5_SS1 */ 3675 + [ 9] = RCAR_GP_PIN(0, 9), /* MSIOF5_SYNC */ 3676 + [10] = RCAR_GP_PIN(0, 10), /* MSIOF5_TXD */ 3677 + [11] = RCAR_GP_PIN(0, 11), /* MSIOF5_SCK */ 3678 + [12] = RCAR_GP_PIN(0, 12), /* MSIOF5_RXD */ 3679 + [13] = RCAR_GP_PIN(0, 13), /* MSIOF2_SS2 */ 3680 + [14] = RCAR_GP_PIN(0, 14), /* MSIOF2_SS1 */ 3681 + [15] = RCAR_GP_PIN(0, 15), /* MSIOF2_SYNC */ 3682 + [16] = RCAR_GP_PIN(0, 16), /* MSIOF2_TXD */ 3683 + [17] = RCAR_GP_PIN(0, 17), /* MSIOF2_SCK */ 3684 + [18] = RCAR_GP_PIN(0, 18), /* MSIOF2_RXD */ 3685 + [19] = SH_PFC_PIN_NONE, 3686 + [20] = SH_PFC_PIN_NONE, 3687 + [21] = SH_PFC_PIN_NONE, 3688 + [22] = SH_PFC_PIN_NONE, 3689 + [23] = SH_PFC_PIN_NONE, 3690 + [24] = SH_PFC_PIN_NONE, 3691 + [25] = SH_PFC_PIN_NONE, 3692 + [26] = SH_PFC_PIN_NONE, 3693 + [27] = SH_PFC_PIN_NONE, 3694 + [28] = SH_PFC_PIN_NONE, 3695 + [29] = SH_PFC_PIN_NONE, 3696 + [30] = SH_PFC_PIN_NONE, 3697 + [31] = SH_PFC_PIN_NONE, 3698 + } }, 3699 + { PINMUX_BIAS_REG("PUEN1", 0xE60508C0, "PUD1", 0xE60508E0) { 3700 + [ 0] = RCAR_GP_PIN(1, 0), /* MSIOF1_SS2 */ 3701 + [ 1] = RCAR_GP_PIN(1, 1), /* MSIOF1_SS1 */ 3702 + [ 2] = RCAR_GP_PIN(1, 2), /* MSIOF1_SYNC */ 3703 + [ 3] = RCAR_GP_PIN(1, 3), /* MSIOF1_SCK */ 3704 + [ 4] = RCAR_GP_PIN(1, 4), /* MSIOF1_TXD */ 3705 + [ 5] = RCAR_GP_PIN(1, 5), /* MSIOF1_RXD */ 3706 + [ 6] = RCAR_GP_PIN(1, 6), /* MSIOF0_SS2 */ 3707 + [ 7] = RCAR_GP_PIN(1, 7), /* MSIOF0_SS1 */ 3708 + [ 8] = RCAR_GP_PIN(1, 8), /* MSIOF0_SYNC */ 3709 + [ 9] = RCAR_GP_PIN(1, 9), /* MSIOF0_TXD */ 3710 + [10] = RCAR_GP_PIN(1, 10), /* MSIOF0_SCK */ 3711 + [11] = RCAR_GP_PIN(1, 11), /* MSIOF0_RXD */ 3712 + [12] = RCAR_GP_PIN(1, 12), /* HTX0 */ 3713 + [13] = RCAR_GP_PIN(1, 13), /* HCTS0_N */ 3714 + [14] = RCAR_GP_PIN(1, 14), /* HRTS0_N */ 3715 + [15] = RCAR_GP_PIN(1, 15), /* HSCK0 */ 3716 + [16] = RCAR_GP_PIN(1, 16), /* HRX0 */ 3717 + [17] = RCAR_GP_PIN(1, 17), /* SCIF_CLK */ 3718 + [18] = RCAR_GP_PIN(1, 18), /* SSI_SCK */ 3719 + [19] = RCAR_GP_PIN(1, 19), /* SSI_WS */ 3720 + [20] = RCAR_GP_PIN(1, 20), /* SSI_SD */ 3721 + [21] = RCAR_GP_PIN(1, 21), /* AUDIO_CLKOUT */ 3722 + [22] = RCAR_GP_PIN(1, 22), /* AUDIO_CLKIN */ 3723 + [23] = RCAR_GP_PIN(1, 23), /* GP1_23 */ 3724 + [24] = RCAR_GP_PIN(1, 24), /* HRX3 */ 3725 + [25] = RCAR_GP_PIN(1, 25), /* HSCK3 */ 3726 + [26] = RCAR_GP_PIN(1, 26), /* HRTS3_N */ 3727 + [27] = RCAR_GP_PIN(1, 27), /* HCTS3_N */ 3728 + [28] = RCAR_GP_PIN(1, 28), /* HTX3 */ 3729 + [29] = RCAR_GP_PIN(1, 29), /* ERROROUTC_N */ 3730 + [30] = SH_PFC_PIN_NONE, 3731 + [31] = SH_PFC_PIN_NONE, 3732 + } }, 3733 + { PINMUX_BIAS_REG("PUEN2", 0xE60580C0, "PUD2", 0xE60580E0) { 3734 + [ 0] = RCAR_GP_PIN(2, 0), /* FXR_TXDA */ 3735 + [ 1] = RCAR_GP_PIN(2, 1), /* FXR_TXENA_N */ 3736 + [ 2] = RCAR_GP_PIN(2, 2), /* RXDA_EXTFXR */ 3737 + [ 3] = RCAR_GP_PIN(2, 3), /* CLK_EXTFXR */ 3738 + [ 4] = RCAR_GP_PIN(2, 4), /* RXDB_EXTFXR */ 3739 + [ 5] = RCAR_GP_PIN(2, 5), /* FXR_TXENB_N */ 3740 + [ 6] = RCAR_GP_PIN(2, 6), /* FXR_TXDB */ 3741 + [ 7] = RCAR_GP_PIN(2, 7), /* TPU0TO1 */ 3742 + [ 8] = RCAR_GP_PIN(2, 8), /* TPU0TO0 */ 3743 + [ 9] = RCAR_GP_PIN(2, 9), /* CAN_CLK */ 3744 + [10] = RCAR_GP_PIN(2, 10), /* CANFD0_TX */ 3745 + [11] = RCAR_GP_PIN(2, 11), /* CANFD0_RX */ 3746 + [12] = RCAR_GP_PIN(2, 12), /* CANFD2_TX */ 3747 + [13] = RCAR_GP_PIN(2, 13), /* CANFD2_RX */ 3748 + [14] = RCAR_GP_PIN(2, 14), /* CANFD3_TX */ 3749 + [15] = RCAR_GP_PIN(2, 15), /* CANFD3_RX */ 3750 + [16] = SH_PFC_PIN_NONE, 3751 + [17] = RCAR_GP_PIN(2, 17), /* CANFD1_TX */ 3752 + [18] = SH_PFC_PIN_NONE, 3753 + [19] = RCAR_GP_PIN(2, 19), /* CANFD1_RX */ 3754 + [20] = SH_PFC_PIN_NONE, 3755 + [21] = SH_PFC_PIN_NONE, 3756 + [22] = SH_PFC_PIN_NONE, 3757 + [23] = SH_PFC_PIN_NONE, 3758 + [24] = SH_PFC_PIN_NONE, 3759 + [25] = SH_PFC_PIN_NONE, 3760 + [26] = SH_PFC_PIN_NONE, 3761 + [27] = SH_PFC_PIN_NONE, 3762 + [28] = SH_PFC_PIN_NONE, 3763 + [29] = SH_PFC_PIN_NONE, 3764 + [30] = SH_PFC_PIN_NONE, 3765 + [31] = SH_PFC_PIN_NONE, 3766 + } }, 3767 + { PINMUX_BIAS_REG("PUEN3", 0xE60588C0, "PUD3", 0xE60588E0) { 3768 + [ 0] = RCAR_GP_PIN(3, 0), /* MMC_SD_D1 */ 3769 + [ 1] = RCAR_GP_PIN(3, 1), /* MMC_SD_D0 */ 3770 + [ 2] = RCAR_GP_PIN(3, 2), /* MMC_SD_D2 */ 3771 + [ 3] = RCAR_GP_PIN(3, 3), /* MMC_SD_CLK */ 3772 + [ 4] = RCAR_GP_PIN(3, 4), /* MMC_DS */ 3773 + [ 5] = RCAR_GP_PIN(3, 5), /* MMC_SD_D3 */ 3774 + [ 6] = RCAR_GP_PIN(3, 6), /* MMC_D5 */ 3775 + [ 7] = RCAR_GP_PIN(3, 7), /* MMC_D4 */ 3776 + [ 8] = RCAR_GP_PIN(3, 8), /* MMC_D7 */ 3777 + [ 9] = RCAR_GP_PIN(3, 9), /* MMC_D6 */ 3778 + [10] = RCAR_GP_PIN(3, 10), /* MMC_SD_CMD */ 3779 + [11] = RCAR_GP_PIN(3, 11), /* SD_CD */ 3780 + [12] = RCAR_GP_PIN(3, 12), /* SD_WP */ 3781 + [13] = RCAR_GP_PIN(3, 13), /* PWM1 */ 3782 + [14] = RCAR_GP_PIN(3, 14), /* PWM2 */ 3783 + [15] = RCAR_GP_PIN(3, 15), /* QSPI0_SSL */ 3784 + [16] = RCAR_GP_PIN(3, 16), /* QSPI0_IO3 */ 3785 + [17] = RCAR_GP_PIN(3, 17), /* QSPI0_IO2 */ 3786 + [18] = RCAR_GP_PIN(3, 18), /* QSPI0_MISO_IO1 */ 3787 + [19] = RCAR_GP_PIN(3, 19), /* QSPI0_MOSI_IO0 */ 3788 + [20] = RCAR_GP_PIN(3, 20), /* QSPI0_SPCLK */ 3789 + [21] = RCAR_GP_PIN(3, 21), /* QSPI1_MOSI_IO0 */ 3790 + [22] = RCAR_GP_PIN(3, 22), /* QSPI1_SPCLK */ 3791 + [23] = RCAR_GP_PIN(3, 23), /* QSPI1_MISO_IO1 */ 3792 + [24] = RCAR_GP_PIN(3, 24), /* QSPI1_IO2 */ 3793 + [25] = RCAR_GP_PIN(3, 25), /* QSPI1_SSL */ 3794 + [26] = RCAR_GP_PIN(3, 26), /* QSPI1_IO3 */ 3795 + [27] = RCAR_GP_PIN(3, 27), /* RPC_RESET_N */ 3796 + [28] = RCAR_GP_PIN(3, 28), /* RPC_WP_N */ 3797 + [29] = RCAR_GP_PIN(3, 29), /* RPC_INT_N */ 3798 + [30] = RCAR_GP_PIN(3, 30), /* TCLK3 */ 3799 + [31] = RCAR_GP_PIN(3, 31), /* TCLK4 */ 3800 + } }, 3801 + { PINMUX_BIAS_REG("PUEN4", 0xE60600C0, "PUD4", 0xE60600E0) { 3802 + [ 0] = RCAR_GP_PIN(4, 0), /* SCL0 */ 3803 + [ 1] = RCAR_GP_PIN(4, 1), /* SDA0 */ 3804 + [ 2] = RCAR_GP_PIN(4, 2), /* SCL1 */ 3805 + [ 3] = RCAR_GP_PIN(4, 3), /* SDA1 */ 3806 + [ 4] = RCAR_GP_PIN(4, 4), /* SCL2 */ 3807 + [ 5] = RCAR_GP_PIN(4, 5), /* SDA2 */ 3808 + [ 6] = RCAR_GP_PIN(4, 6), /* SCL3 */ 3809 + [ 7] = RCAR_GP_PIN(4, 7), /* SDA3 */ 3810 + [ 8] = RCAR_GP_PIN(4, 8), /* HRX2 */ 3811 + [ 9] = RCAR_GP_PIN(4, 9), /* HTX2 */ 3812 + [10] = RCAR_GP_PIN(4, 10), /* HRTS2_N */ 3813 + [11] = RCAR_GP_PIN(4, 11), /* SCIF_CLK2 */ 3814 + [12] = RCAR_GP_PIN(4, 12), /* HCTS2_N */ 3815 + [13] = RCAR_GP_PIN(4, 13), /* HSCK2 */ 3816 + [14] = RCAR_GP_PIN(4, 14), /* PWM3 */ 3817 + [15] = RCAR_GP_PIN(4, 15), /* PWM4 */ 3818 + [16] = SH_PFC_PIN_NONE, 3819 + [17] = SH_PFC_PIN_NONE, 3820 + [18] = SH_PFC_PIN_NONE, 3821 + [19] = SH_PFC_PIN_NONE, 3822 + [20] = SH_PFC_PIN_NONE, 3823 + [21] = RCAR_GP_PIN(4, 21), /* PCIE0_CLKREQ_N */ 3824 + [22] = SH_PFC_PIN_NONE, 3825 + [23] = RCAR_GP_PIN(4, 23), /* AVS0 */ 3826 + [24] = RCAR_GP_PIN(4, 24), /* AVS1 */ 3827 + [25] = SH_PFC_PIN_NONE, 3828 + [26] = SH_PFC_PIN_NONE, 3829 + [27] = SH_PFC_PIN_NONE, 3830 + [28] = SH_PFC_PIN_NONE, 3831 + [29] = SH_PFC_PIN_NONE, 3832 + [30] = SH_PFC_PIN_NONE, 3833 + [31] = SH_PFC_PIN_NONE, 3834 + } }, 3835 + { PINMUX_BIAS_REG("PUEN5", 0xE60608C0, "PUD5", 0xE60608E0) { 3836 + [ 0] = RCAR_GP_PIN(5, 0), /* AVB2_AVTP_PPS */ 3837 + [ 1] = RCAR_GP_PIN(5, 1), /* AVB0_AVTP_CAPTURE */ 3838 + [ 2] = RCAR_GP_PIN(5, 2), /* AVB2_AVTP_MATCH */ 3839 + [ 3] = RCAR_GP_PIN(5, 3), /* AVB2_LINK */ 3840 + [ 4] = RCAR_GP_PIN(5, 4), /* AVB2_PHY_INT */ 3841 + [ 5] = RCAR_GP_PIN(5, 5), /* AVB2_MAGIC */ 3842 + [ 6] = RCAR_GP_PIN(5, 6), /* AVB2_MDC */ 3843 + [ 7] = RCAR_GP_PIN(5, 7), /* AVB2_TXCREFCLK */ 3844 + [ 8] = RCAR_GP_PIN(5, 8), /* AVB2_TD3 */ 3845 + [ 9] = RCAR_GP_PIN(5, 9), /* AVB2_RD3 */ 3846 + [10] = RCAR_GP_PIN(5, 10), /* AVB2_MDIO */ 3847 + [11] = RCAR_GP_PIN(5, 11), /* AVB2_TD2 */ 3848 + [12] = RCAR_GP_PIN(5, 12), /* AVB2_TD1 */ 3849 + [13] = RCAR_GP_PIN(5, 13), /* AVB2_RD2 */ 3850 + [14] = RCAR_GP_PIN(5, 14), /* AVB2_RD1 */ 3851 + [15] = RCAR_GP_PIN(5, 15), /* AVB2_TD0 */ 3852 + [16] = RCAR_GP_PIN(5, 16), /* AVB2_TXC */ 3853 + [17] = RCAR_GP_PIN(5, 17), /* AVB2_RD0 */ 3854 + [18] = RCAR_GP_PIN(5, 18), /* AVB2_RXC */ 3855 + [19] = RCAR_GP_PIN(5, 19), /* AVB2_TX_CTL */ 3856 + [20] = RCAR_GP_PIN(5, 20), /* AVB2_RX_CTL */ 3857 + [21] = SH_PFC_PIN_NONE, 3858 + [22] = SH_PFC_PIN_NONE, 3859 + [23] = SH_PFC_PIN_NONE, 3860 + [24] = SH_PFC_PIN_NONE, 3861 + [25] = SH_PFC_PIN_NONE, 3862 + [26] = SH_PFC_PIN_NONE, 3863 + [27] = SH_PFC_PIN_NONE, 3864 + [28] = SH_PFC_PIN_NONE, 3865 + [29] = SH_PFC_PIN_NONE, 3866 + [30] = SH_PFC_PIN_NONE, 3867 + [31] = SH_PFC_PIN_NONE, 3868 + } }, 3869 + { PINMUX_BIAS_REG("PUEN6", 0xE60610C0, "PUD6", 0xE60610E0) { 3870 + [ 0] = RCAR_GP_PIN(6, 0), /* AVB1_MDIO */ 3871 + [ 1] = RCAR_GP_PIN(6, 1), /* AVB1_MAGIC */ 3872 + [ 2] = RCAR_GP_PIN(6, 2), /* AVB1_MDC */ 3873 + [ 3] = RCAR_GP_PIN(6, 3), /* AVB1_PHY_INT */ 3874 + [ 4] = RCAR_GP_PIN(6, 4), /* AVB1_LINK */ 3875 + [ 5] = RCAR_GP_PIN(6, 5), /* AVB1_AVTP_MATCH */ 3876 + [ 6] = RCAR_GP_PIN(6, 6), /* AVB1_TXC */ 3877 + [ 7] = RCAR_GP_PIN(6, 7), /* AVB1_TX_CTL */ 3878 + [ 8] = RCAR_GP_PIN(6, 8), /* AVB1_RXC */ 3879 + [ 9] = RCAR_GP_PIN(6, 9), /* AVB1_RX_CTL */ 3880 + [10] = RCAR_GP_PIN(6, 10), /* AVB1_AVTP_PPS */ 3881 + [11] = RCAR_GP_PIN(6, 11), /* AVB1_AVTP_CAPTURE */ 3882 + [12] = RCAR_GP_PIN(6, 12), /* AVB1_TD1 */ 3883 + [13] = RCAR_GP_PIN(6, 13), /* AVB1_TD0 */ 3884 + [14] = RCAR_GP_PIN(6, 14), /* AVB1_RD1*/ 3885 + [15] = RCAR_GP_PIN(6, 15), /* AVB1_RD0 */ 3886 + [16] = RCAR_GP_PIN(6, 16), /* AVB1_TD2 */ 3887 + [17] = RCAR_GP_PIN(6, 17), /* AVB1_RD2 */ 3888 + [18] = RCAR_GP_PIN(6, 18), /* AVB1_TD3 */ 3889 + [19] = RCAR_GP_PIN(6, 19), /* AVB1_RD3 */ 3890 + [20] = RCAR_GP_PIN(6, 20), /* AVB1_TXCREFCLK */ 3891 + [21] = SH_PFC_PIN_NONE, 3892 + [22] = SH_PFC_PIN_NONE, 3893 + [23] = SH_PFC_PIN_NONE, 3894 + [24] = SH_PFC_PIN_NONE, 3895 + [25] = SH_PFC_PIN_NONE, 3896 + [26] = SH_PFC_PIN_NONE, 3897 + [27] = SH_PFC_PIN_NONE, 3898 + [28] = SH_PFC_PIN_NONE, 3899 + [29] = SH_PFC_PIN_NONE, 3900 + [30] = SH_PFC_PIN_NONE, 3901 + [31] = SH_PFC_PIN_NONE, 3902 + } }, 3903 + { PINMUX_BIAS_REG("PUEN7", 0xE60618C0, "PUD7", 0xE60618E0) { 3904 + [ 0] = RCAR_GP_PIN(7, 0), /* AVB0_AVTP_PPS */ 3905 + [ 1] = RCAR_GP_PIN(7, 1), /* AVB0_AVTP_CAPTURE */ 3906 + [ 2] = RCAR_GP_PIN(7, 2), /* AVB0_AVTP_MATCH */ 3907 + [ 3] = RCAR_GP_PIN(7, 3), /* AVB0_TD3 */ 3908 + [ 4] = RCAR_GP_PIN(7, 4), /* AVB0_LINK */ 3909 + [ 5] = RCAR_GP_PIN(7, 5), /* AVB0_PHY_INT */ 3910 + [ 6] = RCAR_GP_PIN(7, 6), /* AVB0_TD2 */ 3911 + [ 7] = RCAR_GP_PIN(7, 7), /* AVB0_TD1 */ 3912 + [ 8] = RCAR_GP_PIN(7, 8), /* AVB0_RD3 */ 3913 + [ 9] = RCAR_GP_PIN(7, 9), /* AVB0_TXCREFCLK */ 3914 + [10] = RCAR_GP_PIN(7, 10), /* AVB0_MAGIC */ 3915 + [11] = RCAR_GP_PIN(7, 11), /* AVB0_TD0 */ 3916 + [12] = RCAR_GP_PIN(7, 12), /* AVB0_RD2 */ 3917 + [13] = RCAR_GP_PIN(7, 13), /* AVB0_MDC */ 3918 + [14] = RCAR_GP_PIN(7, 14), /* AVB0_MDIO */ 3919 + [15] = RCAR_GP_PIN(7, 15), /* AVB0_TXC */ 3920 + [16] = RCAR_GP_PIN(7, 16), /* AVB0_TX_CTL */ 3921 + [17] = RCAR_GP_PIN(7, 17), /* AVB0_RD1 */ 3922 + [18] = RCAR_GP_PIN(7, 18), /* AVB0_RD0 */ 3923 + [19] = RCAR_GP_PIN(7, 19), /* AVB0_RXC */ 3924 + [20] = RCAR_GP_PIN(7, 20), /* AVB0_RX_CTL */ 3925 + [21] = SH_PFC_PIN_NONE, 3926 + [22] = SH_PFC_PIN_NONE, 3927 + [23] = SH_PFC_PIN_NONE, 3928 + [24] = SH_PFC_PIN_NONE, 3929 + [25] = SH_PFC_PIN_NONE, 3930 + [26] = SH_PFC_PIN_NONE, 3931 + [27] = SH_PFC_PIN_NONE, 3932 + [28] = SH_PFC_PIN_NONE, 3933 + [29] = SH_PFC_PIN_NONE, 3934 + [30] = SH_PFC_PIN_NONE, 3935 + [31] = SH_PFC_PIN_NONE, 3936 + } }, 3937 + { /* sentinel */ }, 3938 + }; 3939 + 3940 + static const struct sh_pfc_soc_operations r8a779h0_pin_ops = { 3941 + .pin_to_pocctrl = r8a779h0_pin_to_pocctrl, 3942 + .get_bias = rcar_pinmux_get_bias, 3943 + .set_bias = rcar_pinmux_set_bias, 3944 + }; 3945 + 3946 + const struct sh_pfc_soc_info r8a779h0_pinmux_info = { 3947 + .name = "r8a779h0_pfc", 3948 + .ops = &r8a779h0_pin_ops, 3949 + .unlock_reg = 0x1ff, /* PMMRn mask */ 3950 + 3951 + .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END }, 3952 + 3953 + .pins = pinmux_pins, 3954 + .nr_pins = ARRAY_SIZE(pinmux_pins), 3955 + .groups = pinmux_groups, 3956 + .nr_groups = ARRAY_SIZE(pinmux_groups), 3957 + .functions = pinmux_functions, 3958 + .nr_functions = ARRAY_SIZE(pinmux_functions), 3959 + 3960 + .cfg_regs = pinmux_config_regs, 3961 + .drive_regs = pinmux_drive_regs, 3962 + .bias_regs = pinmux_bias_regs, 3963 + .ioctrl_regs = pinmux_ioctrl_regs, 3964 + 3965 + .pinmux_data = pinmux_data, 3966 + .pinmux_data_size = ARRAY_SIZE(pinmux_data), 3967 + };
+709 -83
drivers/pinctrl/renesas/pinctrl-rzg2l.c
··· 5 5 * Copyright (C) 2021 Renesas Electronics Corporation. 6 6 */ 7 7 8 + #include <linux/bitfield.h> 8 9 #include <linux/bitops.h> 9 10 #include <linux/clk.h> 10 11 #include <linux/gpio/driver.h> ··· 39 38 */ 40 39 #define MUX_PIN_ID_MASK GENMASK(15, 0) 41 40 #define MUX_FUNC_MASK GENMASK(31, 16) 42 - #define MUX_FUNC_OFFS 16 43 - #define MUX_FUNC(pinconf) (((pinconf) & MUX_FUNC_MASK) >> MUX_FUNC_OFFS) 44 41 45 42 /* PIN capabilities */ 46 43 #define PIN_CFG_IOLH_A BIT(0) ··· 57 58 #define PIN_CFG_IOLH_C BIT(13) 58 59 #define PIN_CFG_SOFT_PS BIT(14) 59 60 #define PIN_CFG_OEN BIT(15) 61 + #define PIN_CFG_VARIABLE BIT(16) 62 + #define PIN_CFG_NOGPIO_INT BIT(17) 60 63 61 64 #define RZG2L_MPXED_COMMON_PIN_FUNCS(group) \ 62 65 (PIN_CFG_IOLH_##group | \ ··· 78 77 PIN_CFG_FILNUM | \ 79 78 PIN_CFG_FILCLKSEL) 80 79 80 + #define PIN_CFG_PIN_MAP_MASK GENMASK_ULL(35, 28) 81 + #define PIN_CFG_PIN_REG_MASK GENMASK(27, 20) 82 + #define PIN_CFG_MASK GENMASK(19, 0) 83 + 84 + /* 85 + * m indicates the bitmap of supported pins, a is the register index 86 + * and f is pin configuration capabilities supported. 87 + */ 88 + #define RZG2L_GPIO_PORT_SPARSE_PACK(m, a, f) (FIELD_PREP_CONST(PIN_CFG_PIN_MAP_MASK, (m)) | \ 89 + FIELD_PREP_CONST(PIN_CFG_PIN_REG_MASK, (a)) | \ 90 + FIELD_PREP_CONST(PIN_CFG_MASK, (f))) 91 + 81 92 /* 82 93 * n indicates number of pins in the port, a is the register index 83 94 * and f is pin configuration capabilities supported. 84 95 */ 85 - #define RZG2L_GPIO_PORT_PACK(n, a, f) (((n) << 28) | ((a) << 20) | (f)) 86 - #define RZG2L_GPIO_PORT_GET_PINCNT(x) (((x) & GENMASK(30, 28)) >> 28) 96 + #define RZG2L_GPIO_PORT_PACK(n, a, f) RZG2L_GPIO_PORT_SPARSE_PACK((1ULL << (n)) - 1, (a), (f)) 87 97 88 98 /* 89 - * BIT(31) indicates dedicated pin, p is the register index while 99 + * BIT(63) indicates dedicated pin, p is the register index while 90 100 * referencing to SR/IEN/IOLH/FILxx registers, b is the register bits 91 101 * (b * 8) and f is the pin configuration capabilities supported. 92 102 */ 93 - #define RZG2L_SINGLE_PIN BIT(31) 94 - #define RZG2L_SINGLE_PIN_PACK(p, b, f) (RZG2L_SINGLE_PIN | \ 95 - ((p) << 24) | ((b) << 20) | (f)) 96 - #define RZG2L_SINGLE_PIN_GET_BIT(x) (((x) & GENMASK(22, 20)) >> 20) 103 + #define RZG2L_SINGLE_PIN BIT_ULL(63) 104 + #define RZG2L_SINGLE_PIN_INDEX_MASK GENMASK(30, 24) 105 + #define RZG2L_SINGLE_PIN_BITS_MASK GENMASK(22, 20) 97 106 98 - #define RZG2L_PIN_CFG_TO_CAPS(cfg) ((cfg) & GENMASK(19, 0)) 107 + #define RZG2L_SINGLE_PIN_PACK(p, b, f) (RZG2L_SINGLE_PIN | \ 108 + FIELD_PREP_CONST(RZG2L_SINGLE_PIN_INDEX_MASK, (p)) | \ 109 + FIELD_PREP_CONST(RZG2L_SINGLE_PIN_BITS_MASK, (b)) | \ 110 + FIELD_PREP_CONST(PIN_CFG_MASK, (f))) 111 + 99 112 #define RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg) ((cfg) & RZG2L_SINGLE_PIN ? \ 100 - (((cfg) & GENMASK(30, 24)) >> 24) : \ 101 - (((cfg) & GENMASK(26, 20)) >> 20)) 113 + FIELD_GET(RZG2L_SINGLE_PIN_INDEX_MASK, (cfg)) : \ 114 + FIELD_GET(PIN_CFG_PIN_REG_MASK, (cfg))) 102 115 103 116 #define P(off) (0x0000 + (off)) 104 117 #define PM(off) (0x0100 + (off) * 2) ··· 148 133 #define RZG2L_TINT_MAX_INTERRUPT 32 149 134 #define RZG2L_TINT_IRQ_START_INDEX 9 150 135 #define RZG2L_PACK_HWIRQ(t, i) (((t) << 16) | (i)) 136 + 137 + /* Read/write 8 bits register */ 138 + #define RZG2L_PCTRL_REG_ACCESS8(_read, _addr, _val) \ 139 + do { \ 140 + if (_read) \ 141 + _val = readb(_addr); \ 142 + else \ 143 + writeb(_val, _addr); \ 144 + } while (0) 145 + 146 + /* Read/write 16 bits register */ 147 + #define RZG2L_PCTRL_REG_ACCESS16(_read, _addr, _val) \ 148 + do { \ 149 + if (_read) \ 150 + _val = readw(_addr); \ 151 + else \ 152 + writew(_val, _addr); \ 153 + } while (0) 154 + 155 + /* Read/write 32 bits register */ 156 + #define RZG2L_PCTRL_REG_ACCESS32(_read, _addr, _val) \ 157 + do { \ 158 + if (_read) \ 159 + _val = readl(_addr); \ 160 + else \ 161 + writel(_val, _addr); \ 162 + } while (0) 151 163 152 164 /** 153 165 * struct rzg2l_register_offsets - specific register offsets ··· 231 189 232 190 struct rzg2l_dedicated_configs { 233 191 const char *name; 234 - u32 config; 192 + u64 config; 193 + }; 194 + 195 + /** 196 + * struct rzg2l_variable_pin_cfg - pin data cfg 197 + * @cfg: port pin configuration 198 + * @port: port number 199 + * @pin: port pin 200 + */ 201 + struct rzg2l_variable_pin_cfg { 202 + u32 cfg:20; 203 + u32 port:5; 204 + u32 pin:3; 235 205 }; 236 206 237 207 struct rzg2l_pinctrl_data { 238 208 const char * const *port_pins; 239 - const u32 *port_pin_configs; 209 + const u64 *port_pin_configs; 240 210 unsigned int n_ports; 241 211 const struct rzg2l_dedicated_configs *dedicated_pins; 242 212 unsigned int n_port_pins; 243 213 unsigned int n_dedicated_pins; 244 214 const struct rzg2l_hwcfg *hwcfg; 215 + const struct rzg2l_variable_pin_cfg *variable_pin_cfg; 216 + unsigned int n_variable_pin_cfg; 245 217 }; 246 218 247 219 /** ··· 268 212 u16 drive_strength_ua; 269 213 }; 270 214 215 + /** 216 + * struct rzg2l_pinctrl_reg_cache - register cache structure (to be used in suspend/resume) 217 + * @p: P registers cache 218 + * @pm: PM registers cache 219 + * @pmc: PMC registers cache 220 + * @pfc: PFC registers cache 221 + * @iolh: IOLH registers cache 222 + * @ien: IEN registers cache 223 + * @sd_ch: SD_CH registers cache 224 + * @eth_poc: ET_POC registers cache 225 + * @eth_mode: ETH_MODE register cache 226 + * @qspi: QSPI registers cache 227 + */ 228 + struct rzg2l_pinctrl_reg_cache { 229 + u8 *p; 230 + u16 *pm; 231 + u8 *pmc; 232 + u32 *pfc; 233 + u32 *iolh[2]; 234 + u32 *ien[2]; 235 + u8 sd_ch[2]; 236 + u8 eth_poc[2]; 237 + u8 eth_mode; 238 + u8 qspi; 239 + }; 240 + 271 241 struct rzg2l_pinctrl { 272 242 struct pinctrl_dev *pctl; 273 243 struct pinctrl_desc desc; ··· 302 220 const struct rzg2l_pinctrl_data *data; 303 221 void __iomem *base; 304 222 struct device *dev; 223 + 224 + struct clk *clk; 305 225 306 226 struct gpio_chip gpio_chip; 307 227 struct pinctrl_gpio_range gpio_range; ··· 315 231 struct mutex mutex; /* serialize adding groups and functions */ 316 232 317 233 struct rzg2l_pinctrl_pin_settings *settings; 234 + struct rzg2l_pinctrl_reg_cache *cache; 235 + struct rzg2l_pinctrl_reg_cache *dedicated_cache; 236 + atomic_t wakeup_path; 318 237 }; 319 238 320 239 static const u16 available_ps[] = { 1800, 2500, 3300 }; 240 + 241 + #ifdef CONFIG_RISCV 242 + static u64 rzg2l_pinctrl_get_variable_pin_cfg(struct rzg2l_pinctrl *pctrl, 243 + u64 pincfg, 244 + unsigned int port, 245 + u8 pin) 246 + { 247 + unsigned int i; 248 + 249 + for (i = 0; i < pctrl->data->n_variable_pin_cfg; i++) { 250 + if (pctrl->data->variable_pin_cfg[i].port == port && 251 + pctrl->data->variable_pin_cfg[i].pin == pin) 252 + return (pincfg & ~PIN_CFG_VARIABLE) | pctrl->data->variable_pin_cfg[i].cfg; 253 + } 254 + 255 + return 0; 256 + } 257 + 258 + static const struct rzg2l_variable_pin_cfg r9a07g043f_variable_pin_cfg[] = { 259 + { 260 + .port = 20, 261 + .pin = 0, 262 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 263 + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 264 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 265 + }, 266 + { 267 + .port = 20, 268 + .pin = 1, 269 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 270 + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 271 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 272 + }, 273 + { 274 + .port = 20, 275 + .pin = 2, 276 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 277 + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 278 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 279 + }, 280 + { 281 + .port = 20, 282 + .pin = 3, 283 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 284 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 285 + }, 286 + { 287 + .port = 20, 288 + .pin = 4, 289 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 290 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 291 + }, 292 + { 293 + .port = 20, 294 + .pin = 5, 295 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 296 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 297 + }, 298 + { 299 + .port = 20, 300 + .pin = 6, 301 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 302 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 303 + }, 304 + { 305 + .port = 20, 306 + .pin = 7, 307 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 308 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT, 309 + }, 310 + { 311 + .port = 23, 312 + .pin = 1, 313 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 314 + PIN_CFG_NOGPIO_INT 315 + }, 316 + { 317 + .port = 23, 318 + .pin = 2, 319 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 320 + PIN_CFG_NOGPIO_INT, 321 + }, 322 + { 323 + .port = 23, 324 + .pin = 3, 325 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 326 + PIN_CFG_NOGPIO_INT, 327 + }, 328 + { 329 + .port = 23, 330 + .pin = 4, 331 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 332 + PIN_CFG_NOGPIO_INT, 333 + }, 334 + { 335 + .port = 23, 336 + .pin = 5, 337 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT, 338 + }, 339 + { 340 + .port = 24, 341 + .pin = 0, 342 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_NOGPIO_INT, 343 + }, 344 + { 345 + .port = 24, 346 + .pin = 1, 347 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 348 + PIN_CFG_NOGPIO_INT, 349 + }, 350 + { 351 + .port = 24, 352 + .pin = 2, 353 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 354 + PIN_CFG_NOGPIO_INT, 355 + }, 356 + { 357 + .port = 24, 358 + .pin = 3, 359 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 360 + PIN_CFG_NOGPIO_INT, 361 + }, 362 + { 363 + .port = 24, 364 + .pin = 4, 365 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 366 + PIN_CFG_NOGPIO_INT, 367 + }, 368 + { 369 + .port = 24, 370 + .pin = 5, 371 + .cfg = PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 372 + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 373 + PIN_CFG_NOGPIO_INT, 374 + }, 375 + }; 376 + #endif 321 377 322 378 static void rzg2l_pinctrl_set_pfc_mode(struct rzg2l_pinctrl *pctrl, 323 379 u8 pin, u8 off, u8 func) ··· 519 295 pins = group->grp.pins; 520 296 521 297 for (i = 0; i < group->grp.npins; i++) { 522 - unsigned int *pin_data = pctrl->desc.pins[pins[i]].drv_data; 298 + u64 *pin_data = pctrl->desc.pins[pins[i]].drv_data; 523 299 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 524 300 u32 pin = RZG2L_PIN_ID_TO_PIN(pins[i]); 525 301 ··· 656 432 ret = of_property_read_u32_index(np, "pinmux", i, &value); 657 433 if (ret) 658 434 goto done; 659 - pins[i] = value & MUX_PIN_ID_MASK; 660 - psel_val[i] = MUX_FUNC(value); 435 + pins[i] = FIELD_GET(MUX_PIN_ID_MASK, value); 436 + psel_val[i] = FIELD_GET(MUX_FUNC_MASK, value); 661 437 } 662 438 663 439 if (parent) { ··· 669 445 } 670 446 } else { 671 447 name = np->name; 448 + } 449 + 450 + if (num_configs) { 451 + ret = rzg2l_map_add_config(&maps[idx], name, 452 + PIN_MAP_TYPE_CONFIGS_GROUP, 453 + configs, num_configs); 454 + if (ret < 0) 455 + goto done; 456 + 457 + idx++; 672 458 } 673 459 674 460 mutex_lock(&pctrl->mutex); ··· 707 473 maps[idx].data.mux.group = name; 708 474 maps[idx].data.mux.function = name; 709 475 idx++; 710 - 711 - if (num_configs) { 712 - ret = rzg2l_map_add_config(&maps[idx], name, 713 - PIN_MAP_TYPE_CONFIGS_GROUP, 714 - configs, num_configs); 715 - if (ret < 0) 716 - goto remove_group; 717 - 718 - idx++; 719 - } 720 476 721 477 dev_dbg(pctrl->dev, "Parsed %pOF with %d pins\n", np, num_pinmux); 722 478 ret = 0; ··· 782 558 } 783 559 784 560 static int rzg2l_validate_gpio_pin(struct rzg2l_pinctrl *pctrl, 785 - u32 cfg, u32 port, u8 bit) 561 + u64 cfg, u32 port, u8 bit) 786 562 { 787 - u8 pincount = RZG2L_GPIO_PORT_GET_PINCNT(cfg); 563 + u8 pinmap = FIELD_GET(PIN_CFG_PIN_MAP_MASK, cfg); 788 564 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg); 789 - u32 data; 565 + u64 data; 790 566 791 - if (bit >= pincount || port >= pctrl->data->n_port_pins) 567 + if (!(pinmap & BIT(bit)) || port >= pctrl->data->n_port_pins) 792 568 return -EINVAL; 793 569 794 570 data = pctrl->data->port_pin_configs[port]; ··· 1080 856 enum pin_config_param param = pinconf_to_config_param(*config); 1081 857 const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 1082 858 const struct pinctrl_pin_desc *pin = &pctrl->desc.pins[_pin]; 1083 - unsigned int *pin_data = pin->drv_data; 859 + u64 *pin_data = pin->drv_data; 1084 860 unsigned int arg = 0; 1085 861 u32 off, cfg; 1086 862 int ret; ··· 1090 866 return -EINVAL; 1091 867 1092 868 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1093 - cfg = RZG2L_PIN_CFG_TO_CAPS(*pin_data); 869 + cfg = FIELD_GET(PIN_CFG_MASK, *pin_data); 1094 870 if (*pin_data & RZG2L_SINGLE_PIN) { 1095 - bit = RZG2L_SINGLE_PIN_GET_BIT(*pin_data); 871 + bit = FIELD_GET(RZG2L_SINGLE_PIN_BITS_MASK, *pin_data); 1096 872 } else { 1097 873 bit = RZG2L_PIN_ID_TO_PIN(_pin); 1098 874 ··· 1183 959 const struct pinctrl_pin_desc *pin = &pctrl->desc.pins[_pin]; 1184 960 const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 1185 961 struct rzg2l_pinctrl_pin_settings settings = pctrl->settings[_pin]; 1186 - unsigned int *pin_data = pin->drv_data; 962 + u64 *pin_data = pin->drv_data; 1187 963 enum pin_config_param param; 1188 964 unsigned int i, arg, index; 1189 965 u32 cfg, off; ··· 1194 970 return -EINVAL; 1195 971 1196 972 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1197 - cfg = RZG2L_PIN_CFG_TO_CAPS(*pin_data); 973 + cfg = FIELD_GET(PIN_CFG_MASK, *pin_data); 1198 974 if (*pin_data & RZG2L_SINGLE_PIN) { 1199 - bit = RZG2L_SINGLE_PIN_GET_BIT(*pin_data); 975 + bit = FIELD_GET(RZG2L_SINGLE_PIN_BITS_MASK, *pin_data); 1200 976 } else { 1201 977 bit = RZG2L_PIN_ID_TO_PIN(_pin); 1202 978 ··· 1388 1164 { 1389 1165 struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); 1390 1166 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1391 - u32 *pin_data = pin_desc->drv_data; 1167 + u64 *pin_data = pin_desc->drv_data; 1392 1168 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1393 1169 u32 port = RZG2L_PIN_ID_TO_PORT(offset); 1394 1170 u8 bit = RZG2L_PIN_ID_TO_PIN(offset); ··· 1420 1196 bool output) 1421 1197 { 1422 1198 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1423 - unsigned int *pin_data = pin_desc->drv_data; 1199 + u64 *pin_data = pin_desc->drv_data; 1424 1200 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1425 1201 u8 bit = RZG2L_PIN_ID_TO_PIN(offset); 1426 1202 unsigned long flags; ··· 1441 1217 { 1442 1218 struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); 1443 1219 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1444 - unsigned int *pin_data = pin_desc->drv_data; 1220 + u64 *pin_data = pin_desc->drv_data; 1445 1221 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1446 1222 u8 bit = RZG2L_PIN_ID_TO_PIN(offset); 1447 1223 ··· 1472 1248 { 1473 1249 struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); 1474 1250 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1475 - unsigned int *pin_data = pin_desc->drv_data; 1251 + u64 *pin_data = pin_desc->drv_data; 1476 1252 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1477 1253 u8 bit = RZG2L_PIN_ID_TO_PIN(offset); 1478 1254 unsigned long flags; ··· 1505 1281 { 1506 1282 struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); 1507 1283 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1508 - unsigned int *pin_data = pin_desc->drv_data; 1284 + u64 *pin_data = pin_desc->drv_data; 1509 1285 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1510 1286 u8 bit = RZG2L_PIN_ID_TO_PIN(offset); 1511 1287 u16 reg16; ··· 1590 1366 "P48_0", "P48_1", "P48_2", "P48_3", "P48_4", "P48_5", "P48_6", "P48_7", 1591 1367 }; 1592 1368 1593 - static const u32 r9a07g044_gpio_configs[] = { 1369 + static const u64 r9a07g044_gpio_configs[] = { 1594 1370 RZG2L_GPIO_PORT_PACK(2, 0x10, RZG2L_MPXED_PIN_FUNCS), 1595 1371 RZG2L_GPIO_PORT_PACK(2, 0x11, RZG2L_MPXED_PIN_FUNCS), 1596 1372 RZG2L_GPIO_PORT_PACK(2, 0x12, RZG2L_MPXED_PIN_FUNCS), ··· 1642 1418 RZG2L_GPIO_PORT_PACK(5, 0x40, RZG2L_MPXED_PIN_FUNCS), 1643 1419 }; 1644 1420 1645 - static const u32 r9a07g043_gpio_configs[] = { 1421 + static const u64 r9a07g043_gpio_configs[] = { 1646 1422 RZG2L_GPIO_PORT_PACK(4, 0x10, RZG2L_MPXED_PIN_FUNCS), 1647 1423 RZG2L_GPIO_PORT_PACK(5, 0x11, RZG2L_MPXED_ETH_PIN_FUNCS(PIN_CFG_IO_VMC_ETH0)), 1648 1424 RZG2L_GPIO_PORT_PACK(4, 0x12, RZG2L_MPXED_ETH_PIN_FUNCS(PIN_CFG_IO_VMC_ETH0)), ··· 1662 1438 RZG2L_GPIO_PORT_PACK(2, 0x20, RZG2L_MPXED_PIN_FUNCS), 1663 1439 RZG2L_GPIO_PORT_PACK(4, 0x21, RZG2L_MPXED_PIN_FUNCS), 1664 1440 RZG2L_GPIO_PORT_PACK(6, 0x22, RZG2L_MPXED_PIN_FUNCS), 1441 + #ifdef CONFIG_RISCV 1442 + /* Below additional port pins (P19 - P28) are exclusively available on RZ/Five SoC only */ 1443 + RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x06, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 1444 + PIN_CFG_FILONOFF | PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 1445 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P19 */ 1446 + RZG2L_GPIO_PORT_PACK(8, 0x07, PIN_CFG_VARIABLE), /* P20 */ 1447 + RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x08, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 1448 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P21 */ 1449 + RZG2L_GPIO_PORT_PACK(4, 0x09, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_PUPD | 1450 + PIN_CFG_IEN | PIN_CFG_NOGPIO_INT), /* P22 */ 1451 + RZG2L_GPIO_PORT_SPARSE_PACK(0x3e, 0x0a, PIN_CFG_VARIABLE), /* P23 */ 1452 + RZG2L_GPIO_PORT_PACK(6, 0x0b, PIN_CFG_VARIABLE), /* P24 */ 1453 + RZG2L_GPIO_PORT_SPARSE_PACK(0x2, 0x0c, PIN_CFG_IOLH_B | PIN_CFG_SR | PIN_CFG_FILONOFF | 1454 + PIN_CFG_FILNUM | PIN_CFG_FILCLKSEL | 1455 + PIN_CFG_NOGPIO_INT), /* P25 */ 1456 + 0x0, /* P26 */ 1457 + 0x0, /* P27 */ 1458 + RZG2L_GPIO_PORT_PACK(6, 0x0f, RZG2L_MPXED_PIN_FUNCS | PIN_CFG_NOGPIO_INT), /* P28 */ 1459 + #endif 1665 1460 }; 1666 1461 1667 - static const u32 r9a08g045_gpio_configs[] = { 1462 + static const u64 r9a08g045_gpio_configs[] = { 1668 1463 RZG2L_GPIO_PORT_PACK(4, 0x20, RZG3S_MPXED_PIN_FUNCS(A)), /* P0 */ 1669 1464 RZG2L_GPIO_PORT_PACK(5, 0x30, RZG2L_MPXED_ETH_PIN_FUNCS(PIN_CFG_IOLH_C | 1670 1465 PIN_CFG_IO_VMC_ETH0)) | ··· 1841 1598 PIN_CFG_IO_VMC_SD1)) }, 1842 1599 }; 1843 1600 1844 - static int rzg2l_gpio_get_gpioint(unsigned int virq, const struct rzg2l_pinctrl_data *data) 1601 + static int rzg2l_gpio_get_gpioint(unsigned int virq, struct rzg2l_pinctrl *pctrl) 1845 1602 { 1603 + const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[virq]; 1604 + const struct rzg2l_pinctrl_data *data = pctrl->data; 1605 + u64 *pin_data = pin_desc->drv_data; 1846 1606 unsigned int gpioint; 1847 1607 unsigned int i; 1848 1608 u32 port, bit; 1609 + 1610 + if (*pin_data & PIN_CFG_NOGPIO_INT) 1611 + return -EINVAL; 1849 1612 1850 1613 port = virq / 8; 1851 1614 bit = virq % 8; 1852 1615 1853 1616 if (port >= data->n_ports || 1854 - bit >= RZG2L_GPIO_PORT_GET_PINCNT(data->port_pin_configs[port])) 1617 + bit >= hweight8(FIELD_GET(PIN_CFG_PIN_MAP_MASK, data->port_pin_configs[port]))) 1855 1618 return -EINVAL; 1856 1619 1857 1620 gpioint = bit; 1858 1621 for (i = 0; i < port; i++) 1859 - gpioint += RZG2L_GPIO_PORT_GET_PINCNT(data->port_pin_configs[i]); 1622 + gpioint += hweight8(FIELD_GET(PIN_CFG_PIN_MAP_MASK, data->port_pin_configs[i])); 1860 1623 1861 1624 return gpioint; 1862 1625 } 1863 1626 1864 - static void rzg2l_gpio_irq_disable(struct irq_data *d) 1627 + static void rzg2l_gpio_irq_endisable(struct rzg2l_pinctrl *pctrl, 1628 + unsigned int hwirq, bool enable) 1865 1629 { 1866 - struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 1867 - struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip); 1868 - unsigned int hwirq = irqd_to_hwirq(d); 1869 1630 const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[hwirq]; 1870 - unsigned int *pin_data = pin_desc->drv_data; 1631 + u64 *pin_data = pin_desc->drv_data; 1871 1632 u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1872 1633 u8 bit = RZG2L_PIN_ID_TO_PIN(hwirq); 1873 1634 unsigned long flags; 1874 1635 void __iomem *addr; 1875 - 1876 - irq_chip_disable_parent(d); 1877 1636 1878 1637 addr = pctrl->base + ISEL(off); 1879 1638 if (bit >= 4) { ··· 1884 1639 } 1885 1640 1886 1641 spin_lock_irqsave(&pctrl->lock, flags); 1887 - writel(readl(addr) & ~BIT(bit * 8), addr); 1642 + if (enable) 1643 + writel(readl(addr) | BIT(bit * 8), addr); 1644 + else 1645 + writel(readl(addr) & ~BIT(bit * 8), addr); 1888 1646 spin_unlock_irqrestore(&pctrl->lock, flags); 1647 + } 1889 1648 1649 + static void rzg2l_gpio_irq_disable(struct irq_data *d) 1650 + { 1651 + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 1652 + unsigned int hwirq = irqd_to_hwirq(d); 1653 + 1654 + irq_chip_disable_parent(d); 1890 1655 gpiochip_disable_irq(gc, hwirq); 1891 1656 } 1892 1657 1893 1658 static void rzg2l_gpio_irq_enable(struct irq_data *d) 1894 1659 { 1895 1660 struct gpio_chip *gc = irq_data_get_irq_chip_data(d); 1896 - struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip); 1897 1661 unsigned int hwirq = irqd_to_hwirq(d); 1898 - const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[hwirq]; 1899 - unsigned int *pin_data = pin_desc->drv_data; 1900 - u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1901 - u8 bit = RZG2L_PIN_ID_TO_PIN(hwirq); 1902 - unsigned long flags; 1903 - void __iomem *addr; 1904 1662 1905 1663 gpiochip_enable_irq(gc, hwirq); 1906 - 1907 - addr = pctrl->base + ISEL(off); 1908 - if (bit >= 4) { 1909 - bit -= 4; 1910 - addr += 4; 1911 - } 1912 - 1913 - spin_lock_irqsave(&pctrl->lock, flags); 1914 - writel(readl(addr) | BIT(bit * 8), addr); 1915 - spin_unlock_irqrestore(&pctrl->lock, flags); 1916 - 1917 1664 irq_chip_enable_parent(d); 1918 1665 } 1919 1666 ··· 1926 1689 seq_printf(p, dev_name(gc->parent)); 1927 1690 } 1928 1691 1692 + static int rzg2l_gpio_irq_set_wake(struct irq_data *data, unsigned int on) 1693 + { 1694 + struct gpio_chip *gc = irq_data_get_irq_chip_data(data); 1695 + struct rzg2l_pinctrl *pctrl = container_of(gc, struct rzg2l_pinctrl, gpio_chip); 1696 + int ret; 1697 + 1698 + /* It should not happen. */ 1699 + if (!data->parent_data) 1700 + return -EOPNOTSUPP; 1701 + 1702 + ret = irq_chip_set_wake_parent(data, on); 1703 + if (ret) 1704 + return ret; 1705 + 1706 + if (on) 1707 + atomic_inc(&pctrl->wakeup_path); 1708 + else 1709 + atomic_dec(&pctrl->wakeup_path); 1710 + 1711 + return 0; 1712 + } 1713 + 1929 1714 static const struct irq_chip rzg2l_gpio_irqchip = { 1930 1715 .name = "rzg2l-gpio", 1931 1716 .irq_disable = rzg2l_gpio_irq_disable, ··· 1958 1699 .irq_eoi = rzg2l_gpio_irqc_eoi, 1959 1700 .irq_print_chip = rzg2l_gpio_irq_print_chip, 1960 1701 .irq_set_affinity = irq_chip_set_affinity_parent, 1702 + .irq_set_wake = rzg2l_gpio_irq_set_wake, 1961 1703 .flags = IRQCHIP_IMMUTABLE, 1962 1704 GPIOCHIP_IRQ_RESOURCE_HELPERS, 1963 1705 }; 1706 + 1707 + static int rzg2l_gpio_interrupt_input_mode(struct gpio_chip *chip, unsigned int offset) 1708 + { 1709 + struct rzg2l_pinctrl *pctrl = gpiochip_get_data(chip); 1710 + const struct pinctrl_pin_desc *pin_desc = &pctrl->desc.pins[offset]; 1711 + u64 *pin_data = pin_desc->drv_data; 1712 + u32 off = RZG2L_PIN_CFG_TO_PORT_OFFSET(*pin_data); 1713 + u8 bit = RZG2L_PIN_ID_TO_PIN(offset); 1714 + u8 reg8; 1715 + int ret; 1716 + 1717 + reg8 = readb(pctrl->base + PMC(off)); 1718 + if (reg8 & BIT(bit)) { 1719 + ret = rzg2l_gpio_request(chip, offset); 1720 + if (ret) 1721 + return ret; 1722 + } 1723 + 1724 + return rzg2l_gpio_direction_input(chip, offset); 1725 + } 1964 1726 1965 1727 static int rzg2l_gpio_child_to_parent_hwirq(struct gpio_chip *gc, 1966 1728 unsigned int child, ··· 1992 1712 struct rzg2l_pinctrl *pctrl = gpiochip_get_data(gc); 1993 1713 unsigned long flags; 1994 1714 int gpioint, irq; 1715 + int ret; 1995 1716 1996 - gpioint = rzg2l_gpio_get_gpioint(child, pctrl->data); 1717 + gpioint = rzg2l_gpio_get_gpioint(child, pctrl); 1997 1718 if (gpioint < 0) 1998 1719 return gpioint; 1720 + 1721 + ret = rzg2l_gpio_interrupt_input_mode(gc, child); 1722 + if (ret) 1723 + return ret; 1999 1724 2000 1725 spin_lock_irqsave(&pctrl->bitmap_lock, flags); 2001 1726 irq = bitmap_find_free_region(pctrl->tint_slot, RZG2L_TINT_MAX_INTERRUPT, get_order(1)); 2002 1727 spin_unlock_irqrestore(&pctrl->bitmap_lock, flags); 2003 - if (irq < 0) 2004 - return -ENOSPC; 1728 + if (irq < 0) { 1729 + ret = -ENOSPC; 1730 + goto err; 1731 + } 1732 + 1733 + rzg2l_gpio_irq_endisable(pctrl, child, true); 2005 1734 pctrl->hwirq[irq] = child; 2006 1735 irq += RZG2L_TINT_IRQ_START_INDEX; 2007 1736 ··· 2018 1729 *parent_type = IRQ_TYPE_LEVEL_HIGH; 2019 1730 *parent = RZG2L_PACK_HWIRQ(gpioint, irq); 2020 1731 return 0; 1732 + 1733 + err: 1734 + rzg2l_gpio_free(gc, child); 1735 + return ret; 2021 1736 } 2022 1737 2023 1738 static int rzg2l_gpio_populate_parent_fwspec(struct gpio_chip *chip, ··· 2039 1746 return 0; 2040 1747 } 2041 1748 1749 + static void rzg2l_gpio_irq_restore(struct rzg2l_pinctrl *pctrl) 1750 + { 1751 + struct irq_domain *domain = pctrl->gpio_chip.irq.domain; 1752 + 1753 + for (unsigned int i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) { 1754 + struct irq_data *data; 1755 + unsigned int virq; 1756 + 1757 + if (!pctrl->hwirq[i]) 1758 + continue; 1759 + 1760 + virq = irq_find_mapping(domain, pctrl->hwirq[i]); 1761 + if (!virq) { 1762 + dev_crit(pctrl->dev, "Failed to find IRQ mapping for hwirq %u\n", 1763 + pctrl->hwirq[i]); 1764 + continue; 1765 + } 1766 + 1767 + data = irq_domain_get_irq_data(domain, virq); 1768 + if (!data) { 1769 + dev_crit(pctrl->dev, "Failed to get IRQ data for virq=%u\n", virq); 1770 + continue; 1771 + } 1772 + 1773 + if (!irqd_irq_disabled(data)) 1774 + rzg2l_gpio_irq_enable(data); 1775 + } 1776 + } 1777 + 2042 1778 static void rzg2l_gpio_irq_domain_free(struct irq_domain *domain, unsigned int virq, 2043 1779 unsigned int nr_irqs) 2044 1780 { ··· 2083 1761 2084 1762 for (i = 0; i < RZG2L_TINT_MAX_INTERRUPT; i++) { 2085 1763 if (pctrl->hwirq[i] == hwirq) { 1764 + rzg2l_gpio_irq_endisable(pctrl, hwirq, false); 1765 + rzg2l_gpio_free(gc, hwirq); 2086 1766 spin_lock_irqsave(&pctrl->bitmap_lock, flags); 2087 1767 bitmap_release_region(pctrl->tint_slot, i, get_order(1)); 2088 1768 spin_unlock_irqrestore(&pctrl->bitmap_lock, flags); ··· 2112 1788 bit = offset % 8; 2113 1789 2114 1790 if (port >= pctrl->data->n_ports || 2115 - bit >= RZG2L_GPIO_PORT_GET_PINCNT(pctrl->data->port_pin_configs[port])) 1791 + bit >= hweight8(FIELD_GET(PIN_CFG_PIN_MAP_MASK, 1792 + pctrl->data->port_pin_configs[port]))) 2116 1793 clear_bit(offset, valid_mask); 2117 1794 } 1795 + } 1796 + 1797 + static int rzg2l_pinctrl_reg_cache_alloc(struct rzg2l_pinctrl *pctrl) 1798 + { 1799 + u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; 1800 + struct rzg2l_pinctrl_reg_cache *cache, *dedicated_cache; 1801 + 1802 + cache = devm_kzalloc(pctrl->dev, sizeof(*cache), GFP_KERNEL); 1803 + if (!cache) 1804 + return -ENOMEM; 1805 + 1806 + dedicated_cache = devm_kzalloc(pctrl->dev, sizeof(*dedicated_cache), GFP_KERNEL); 1807 + if (!dedicated_cache) 1808 + return -ENOMEM; 1809 + 1810 + cache->p = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->p), GFP_KERNEL); 1811 + if (!cache->p) 1812 + return -ENOMEM; 1813 + 1814 + cache->pm = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pm), GFP_KERNEL); 1815 + if (!cache->pm) 1816 + return -ENOMEM; 1817 + 1818 + cache->pmc = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pmc), GFP_KERNEL); 1819 + if (!cache->pmc) 1820 + return -ENOMEM; 1821 + 1822 + cache->pfc = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->pfc), GFP_KERNEL); 1823 + if (!cache->pfc) 1824 + return -ENOMEM; 1825 + 1826 + for (u8 i = 0; i < 2; i++) { 1827 + u32 n_dedicated_pins = pctrl->data->n_dedicated_pins; 1828 + 1829 + cache->iolh[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->iolh[i]), 1830 + GFP_KERNEL); 1831 + if (!cache->iolh[i]) 1832 + return -ENOMEM; 1833 + 1834 + cache->ien[i] = devm_kcalloc(pctrl->dev, nports, sizeof(*cache->ien[i]), 1835 + GFP_KERNEL); 1836 + if (!cache->ien[i]) 1837 + return -ENOMEM; 1838 + 1839 + /* Allocate dedicated cache. */ 1840 + dedicated_cache->iolh[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, 1841 + sizeof(*dedicated_cache->iolh[i]), 1842 + GFP_KERNEL); 1843 + if (!dedicated_cache->iolh[i]) 1844 + return -ENOMEM; 1845 + 1846 + dedicated_cache->ien[i] = devm_kcalloc(pctrl->dev, n_dedicated_pins, 1847 + sizeof(*dedicated_cache->ien[i]), 1848 + GFP_KERNEL); 1849 + if (!dedicated_cache->ien[i]) 1850 + return -ENOMEM; 1851 + } 1852 + 1853 + pctrl->cache = cache; 1854 + pctrl->dedicated_cache = dedicated_cache; 1855 + 1856 + return 0; 2118 1857 } 2119 1858 2120 1859 static int rzg2l_gpio_register(struct rzg2l_pinctrl *pctrl) ··· 2257 1870 const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 2258 1871 struct pinctrl_pin_desc *pins; 2259 1872 unsigned int i, j; 2260 - u32 *pin_data; 1873 + u64 *pin_data; 2261 1874 int ret; 2262 1875 2263 1876 pctrl->desc.name = DRV_NAME; ··· 2285 1898 if (i && !(i % RZG2L_PINS_PER_PORT)) 2286 1899 j++; 2287 1900 pin_data[i] = pctrl->data->port_pin_configs[j]; 1901 + #ifdef CONFIG_RISCV 1902 + if (pin_data[i] & PIN_CFG_VARIABLE) 1903 + pin_data[i] = rzg2l_pinctrl_get_variable_pin_cfg(pctrl, 1904 + pin_data[i], 1905 + j, 1906 + i % RZG2L_PINS_PER_PORT); 1907 + #endif 2288 1908 pins[i].drv_data = &pin_data[i]; 2289 1909 } 2290 1910 ··· 2320 1926 } 2321 1927 } 2322 1928 1929 + ret = rzg2l_pinctrl_reg_cache_alloc(pctrl); 1930 + if (ret) 1931 + return ret; 1932 + 2323 1933 ret = devm_pinctrl_register_and_init(pctrl->dev, &pctrl->desc, pctrl, 2324 1934 &pctrl->pctl); 2325 1935 if (ret) { ··· 2349 1951 static int rzg2l_pinctrl_probe(struct platform_device *pdev) 2350 1952 { 2351 1953 struct rzg2l_pinctrl *pctrl; 2352 - struct clk *clk; 2353 1954 int ret; 2354 1955 2355 1956 BUILD_BUG_ON(ARRAY_SIZE(r9a07g044_gpio_configs) * RZG2L_PINS_PER_PORT > ··· 2374 1977 if (IS_ERR(pctrl->base)) 2375 1978 return PTR_ERR(pctrl->base); 2376 1979 2377 - clk = devm_clk_get_enabled(pctrl->dev, NULL); 2378 - if (IS_ERR(clk)) 2379 - return dev_err_probe(pctrl->dev, PTR_ERR(clk), 1980 + pctrl->clk = devm_clk_get_enabled(pctrl->dev, NULL); 1981 + if (IS_ERR(pctrl->clk)) { 1982 + return dev_err_probe(pctrl->dev, PTR_ERR(pctrl->clk), 2380 1983 "failed to enable GPIO clk\n"); 1984 + } 2381 1985 2382 1986 spin_lock_init(&pctrl->lock); 2383 1987 spin_lock_init(&pctrl->bitmap_lock); 2384 1988 mutex_init(&pctrl->mutex); 1989 + atomic_set(&pctrl->wakeup_path, 0); 2385 1990 2386 1991 platform_set_drvdata(pdev, pctrl); 2387 1992 ··· 2392 1993 return ret; 2393 1994 2394 1995 dev_info(pctrl->dev, "%s support registered\n", DRV_NAME); 1996 + return 0; 1997 + } 1998 + 1999 + static void rzg2l_pinctrl_pm_setup_regs(struct rzg2l_pinctrl *pctrl, bool suspend) 2000 + { 2001 + u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; 2002 + struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache; 2003 + 2004 + for (u32 port = 0; port < nports; port++) { 2005 + bool has_iolh, has_ien; 2006 + u32 off, caps; 2007 + u8 pincnt; 2008 + u64 cfg; 2009 + 2010 + cfg = pctrl->data->port_pin_configs[port]; 2011 + off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg); 2012 + pincnt = hweight8(FIELD_GET(PIN_CFG_PIN_MAP_MASK, cfg)); 2013 + 2014 + caps = FIELD_GET(PIN_CFG_MASK, cfg); 2015 + has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C)); 2016 + has_ien = !!(caps & PIN_CFG_IEN); 2017 + 2018 + if (suspend) 2019 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + PFC(off), cache->pfc[port]); 2020 + 2021 + /* 2022 + * Now cache the registers or set them in the order suggested by 2023 + * HW manual (section "Operation for GPIO Function"). 2024 + */ 2025 + RZG2L_PCTRL_REG_ACCESS8(suspend, pctrl->base + PMC(off), cache->pmc[port]); 2026 + if (has_iolh) { 2027 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IOLH(off), 2028 + cache->iolh[0][port]); 2029 + if (pincnt >= 4) { 2030 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IOLH(off) + 4, 2031 + cache->iolh[1][port]); 2032 + } 2033 + } 2034 + 2035 + RZG2L_PCTRL_REG_ACCESS16(suspend, pctrl->base + PM(off), cache->pm[port]); 2036 + RZG2L_PCTRL_REG_ACCESS8(suspend, pctrl->base + P(off), cache->p[port]); 2037 + 2038 + if (has_ien) { 2039 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IEN(off), 2040 + cache->ien[0][port]); 2041 + if (pincnt >= 4) { 2042 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IEN(off) + 4, 2043 + cache->ien[1][port]); 2044 + } 2045 + } 2046 + } 2047 + } 2048 + 2049 + static void rzg2l_pinctrl_pm_setup_dedicated_regs(struct rzg2l_pinctrl *pctrl, bool suspend) 2050 + { 2051 + struct rzg2l_pinctrl_reg_cache *cache = pctrl->dedicated_cache; 2052 + 2053 + /* 2054 + * Make sure entries in pctrl->data->n_dedicated_pins[] having the same 2055 + * port offset are close together. 2056 + */ 2057 + for (u32 i = 0, caps = 0; i < pctrl->data->n_dedicated_pins; i++) { 2058 + bool has_iolh, has_ien; 2059 + u32 off, next_off = 0; 2060 + u64 cfg, next_cfg; 2061 + u8 pincnt; 2062 + 2063 + cfg = pctrl->data->dedicated_pins[i].config; 2064 + off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg); 2065 + if (i + 1 < pctrl->data->n_dedicated_pins) { 2066 + next_cfg = pctrl->data->dedicated_pins[i + 1].config; 2067 + next_off = RZG2L_PIN_CFG_TO_PORT_OFFSET(next_cfg); 2068 + } 2069 + 2070 + if (off == next_off) { 2071 + /* Gather caps of all port pins. */ 2072 + caps |= FIELD_GET(PIN_CFG_MASK, cfg); 2073 + continue; 2074 + } 2075 + 2076 + /* And apply them in a single shot. */ 2077 + has_iolh = !!(caps & (PIN_CFG_IOLH_A | PIN_CFG_IOLH_B | PIN_CFG_IOLH_C)); 2078 + has_ien = !!(caps & PIN_CFG_IEN); 2079 + pincnt = hweight8(FIELD_GET(RZG2L_SINGLE_PIN_BITS_MASK, cfg)); 2080 + 2081 + if (has_iolh) { 2082 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IOLH(off), 2083 + cache->iolh[0][i]); 2084 + } 2085 + if (has_ien) { 2086 + RZG2L_PCTRL_REG_ACCESS32(suspend, pctrl->base + IEN(off), 2087 + cache->ien[0][i]); 2088 + } 2089 + 2090 + if (pincnt >= 4) { 2091 + if (has_iolh) { 2092 + RZG2L_PCTRL_REG_ACCESS32(suspend, 2093 + pctrl->base + IOLH(off) + 4, 2094 + cache->iolh[1][i]); 2095 + } 2096 + if (has_ien) { 2097 + RZG2L_PCTRL_REG_ACCESS32(suspend, 2098 + pctrl->base + IEN(off) + 4, 2099 + cache->ien[1][i]); 2100 + } 2101 + } 2102 + caps = 0; 2103 + } 2104 + } 2105 + 2106 + static void rzg2l_pinctrl_pm_setup_pfc(struct rzg2l_pinctrl *pctrl) 2107 + { 2108 + u32 nports = pctrl->data->n_port_pins / RZG2L_PINS_PER_PORT; 2109 + const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 2110 + const struct rzg2l_register_offsets *regs = &hwcfg->regs; 2111 + 2112 + /* Set the PWPR register to allow PFC register to write. */ 2113 + writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ 2114 + writel(PWPR_PFCWE, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=1 */ 2115 + 2116 + /* Restore port registers. */ 2117 + for (u32 port = 0; port < nports; port++) { 2118 + unsigned long pinmap; 2119 + u8 pmc = 0, max_pin; 2120 + u32 off, pfc = 0; 2121 + u64 cfg; 2122 + u16 pm; 2123 + u8 pin; 2124 + 2125 + cfg = pctrl->data->port_pin_configs[port]; 2126 + off = RZG2L_PIN_CFG_TO_PORT_OFFSET(cfg); 2127 + pinmap = FIELD_GET(PIN_CFG_PIN_MAP_MASK, cfg); 2128 + max_pin = fls(pinmap); 2129 + 2130 + pm = readw(pctrl->base + PM(off)); 2131 + for_each_set_bit(pin, &pinmap, max_pin) { 2132 + struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache; 2133 + 2134 + /* Nothing to do if PFC was not configured before. */ 2135 + if (!(cache->pmc[port] & BIT(pin))) 2136 + continue; 2137 + 2138 + /* Set pin to 'Non-use (Hi-Z input protection)' */ 2139 + pm &= ~(PM_MASK << (pin * 2)); 2140 + writew(pm, pctrl->base + PM(off)); 2141 + 2142 + /* Temporarily switch to GPIO mode with PMC register */ 2143 + pmc &= ~BIT(pin); 2144 + writeb(pmc, pctrl->base + PMC(off)); 2145 + 2146 + /* Select Pin function mode. */ 2147 + pfc &= ~(PFC_MASK << (pin * 4)); 2148 + pfc |= (cache->pfc[port] & (PFC_MASK << (pin * 4))); 2149 + writel(pfc, pctrl->base + PFC(off)); 2150 + 2151 + /* Switch to Peripheral pin function. */ 2152 + pmc |= BIT(pin); 2153 + writeb(pmc, pctrl->base + PMC(off)); 2154 + } 2155 + } 2156 + 2157 + /* Set the PWPR register to be write-protected. */ 2158 + writel(0x0, pctrl->base + regs->pwpr); /* B0WI=0, PFCWE=0 */ 2159 + writel(PWPR_B0WI, pctrl->base + regs->pwpr); /* B0WI=1, PFCWE=0 */ 2160 + } 2161 + 2162 + static int rzg2l_pinctrl_suspend_noirq(struct device *dev) 2163 + { 2164 + struct rzg2l_pinctrl *pctrl = dev_get_drvdata(dev); 2165 + const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 2166 + const struct rzg2l_register_offsets *regs = &hwcfg->regs; 2167 + struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache; 2168 + 2169 + rzg2l_pinctrl_pm_setup_regs(pctrl, true); 2170 + rzg2l_pinctrl_pm_setup_dedicated_regs(pctrl, true); 2171 + 2172 + for (u8 i = 0; i < 2; i++) { 2173 + cache->sd_ch[i] = readb(pctrl->base + SD_CH(regs->sd_ch, i)); 2174 + cache->eth_poc[i] = readb(pctrl->base + ETH_POC(regs->eth_poc, i)); 2175 + } 2176 + 2177 + cache->qspi = readb(pctrl->base + QSPI); 2178 + cache->eth_mode = readb(pctrl->base + ETH_MODE); 2179 + 2180 + if (!atomic_read(&pctrl->wakeup_path)) 2181 + clk_disable_unprepare(pctrl->clk); 2182 + else 2183 + device_set_wakeup_path(dev); 2184 + 2185 + return 0; 2186 + } 2187 + 2188 + static int rzg2l_pinctrl_resume_noirq(struct device *dev) 2189 + { 2190 + struct rzg2l_pinctrl *pctrl = dev_get_drvdata(dev); 2191 + const struct rzg2l_hwcfg *hwcfg = pctrl->data->hwcfg; 2192 + const struct rzg2l_register_offsets *regs = &hwcfg->regs; 2193 + struct rzg2l_pinctrl_reg_cache *cache = pctrl->cache; 2194 + int ret; 2195 + 2196 + if (!atomic_read(&pctrl->wakeup_path)) { 2197 + ret = clk_prepare_enable(pctrl->clk); 2198 + if (ret) 2199 + return ret; 2200 + } 2201 + 2202 + writeb(cache->qspi, pctrl->base + QSPI); 2203 + writeb(cache->eth_mode, pctrl->base + ETH_MODE); 2204 + for (u8 i = 0; i < 2; i++) { 2205 + writeb(cache->sd_ch[i], pctrl->base + SD_CH(regs->sd_ch, i)); 2206 + writeb(cache->eth_poc[i], pctrl->base + ETH_POC(regs->eth_poc, i)); 2207 + } 2208 + 2209 + rzg2l_pinctrl_pm_setup_pfc(pctrl); 2210 + rzg2l_pinctrl_pm_setup_regs(pctrl, false); 2211 + rzg2l_pinctrl_pm_setup_dedicated_regs(pctrl, false); 2212 + rzg2l_gpio_irq_restore(pctrl); 2213 + 2395 2214 return 0; 2396 2215 } 2397 2216 ··· 2666 2049 .n_port_pins = ARRAY_SIZE(r9a07g043_gpio_configs) * RZG2L_PINS_PER_PORT, 2667 2050 .n_dedicated_pins = ARRAY_SIZE(rzg2l_dedicated_pins.common), 2668 2051 .hwcfg = &rzg2l_hwcfg, 2052 + #ifdef CONFIG_RISCV 2053 + .variable_pin_cfg = r9a07g043f_variable_pin_cfg, 2054 + .n_variable_pin_cfg = ARRAY_SIZE(r9a07g043f_variable_pin_cfg), 2055 + #endif 2669 2056 }; 2670 2057 2671 2058 static struct rzg2l_pinctrl_data r9a07g044_data = { ··· 2709 2088 { /* sentinel */ } 2710 2089 }; 2711 2090 2091 + static const struct dev_pm_ops rzg2l_pinctrl_pm_ops = { 2092 + NOIRQ_SYSTEM_SLEEP_PM_OPS(rzg2l_pinctrl_suspend_noirq, rzg2l_pinctrl_resume_noirq) 2093 + }; 2094 + 2712 2095 static struct platform_driver rzg2l_pinctrl_driver = { 2713 2096 .driver = { 2714 2097 .name = DRV_NAME, 2715 2098 .of_match_table = of_match_ptr(rzg2l_pinctrl_of_table), 2099 + .pm = pm_sleep_ptr(&rzg2l_pinctrl_pm_ops), 2716 2100 }, 2717 2101 .probe = rzg2l_pinctrl_probe, 2718 2102 };
+1
drivers/pinctrl/renesas/sh_pfc.h
··· 322 322 extern const struct sh_pfc_soc_info r8a779a0_pinmux_info; 323 323 extern const struct sh_pfc_soc_info r8a779f0_pinmux_info; 324 324 extern const struct sh_pfc_soc_info r8a779g0_pinmux_info; 325 + extern const struct sh_pfc_soc_info r8a779h0_pinmux_info; 325 326 extern const struct sh_pfc_soc_info sh7203_pinmux_info; 326 327 extern const struct sh_pfc_soc_info sh7264_pinmux_info; 327 328 extern const struct sh_pfc_soc_info sh7269_pinmux_info;