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

Merge branch 'ib-bcm63xx' into devel

+5467 -46
-46
Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.txt
··· 1 - Bindings for the Broadcom's brcm,bcm6345-gpio memory-mapped GPIO controllers. 2 - 3 - These bindings can be used on any BCM63xx SoC. However, BCM6338 and BCM6345 4 - are the only ones which don't need a pinctrl driver. 5 - BCM6338 have 8-bit data and dirout registers, where GPIO state can be read 6 - and/or written, and the direction changed from input to output. 7 - BCM6345 have 16-bit data and dirout registers, where GPIO state can be read 8 - and/or written, and the direction changed from input to output. 9 - 10 - Required properties: 11 - - compatible: should be "brcm,bcm6345-gpio" 12 - - reg-names: must contain 13 - "dat" - data register 14 - "dirout" - direction (output) register 15 - - reg: address + size pairs describing the GPIO register sets; 16 - order must correspond with the order of entries in reg-names 17 - - #gpio-cells: must be set to 2. The first cell is the pin number and 18 - the second cell is used to specify the gpio polarity: 19 - 0 = active high 20 - 1 = active low 21 - - gpio-controller: Marks the device node as a gpio controller. 22 - 23 - Optional properties: 24 - - native-endian: use native endian memory. 25 - 26 - Examples: 27 - - BCM6338: 28 - gpio: gpio-controller@fffe0407 { 29 - compatible = "brcm,bcm6345-gpio"; 30 - reg-names = "dirout", "dat"; 31 - reg = <0xfffe0407 1>, <0xfffe040f 1>; 32 - 33 - #gpio-cells = <2>; 34 - gpio-controller; 35 - }; 36 - 37 - - BCM6345: 38 - gpio: gpio-controller@fffe0406 { 39 - compatible = "brcm,bcm6345-gpio"; 40 - reg-names = "dirout", "dat"; 41 - reg = <0xfffe0406 2>, <0xfffe040a 2>; 42 - native-endian; 43 - 44 - #gpio-cells = <2>; 45 - gpio-controller; 46 - };
+86
Documentation/devicetree/bindings/gpio/brcm,bcm6345-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/brcm,bcm6345-gpio.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6345 GPIO controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: |+ 14 + Bindings for Broadcom's BCM63xx memory-mapped GPIO controllers. 15 + 16 + These bindings can be used on any BCM63xx SoC. However, BCM6338 and BCM6345 17 + are the only ones which don't need a pinctrl driver. 18 + 19 + BCM6338 have 8-bit data and dirout registers, where GPIO state can be read 20 + and/or written, and the direction changed from input to output. 21 + BCM6345 have 16-bit data and dirout registers, where GPIO state can be read 22 + and/or written, and the direction changed from input to output. 23 + BCM6318, BCM6328, BCM6358, BCM6362, BCM6368 and BCM63268 have 32-bit data 24 + and dirout registers, where GPIO state can be read and/or written, and the 25 + direction changed from input to output. 26 + 27 + properties: 28 + compatible: 29 + enum: 30 + - brcm,bcm6318-gpio 31 + - brcm,bcm6328-gpio 32 + - brcm,bcm6345-gpio 33 + - brcm,bcm6358-gpio 34 + - brcm,bcm6362-gpio 35 + - brcm,bcm6368-gpio 36 + - brcm,bcm63268-gpio 37 + 38 + gpio-controller: true 39 + 40 + "#gpio-cells": 41 + const: 2 42 + 43 + gpio-ranges: 44 + maxItems: 1 45 + 46 + native-endian: true 47 + 48 + reg: 49 + maxItems: 2 50 + 51 + reg-names: 52 + items: 53 + - const: dirout 54 + - const: dat 55 + 56 + required: 57 + - compatible 58 + - reg 59 + - reg-names 60 + - gpio-controller 61 + - '#gpio-cells' 62 + 63 + additionalProperties: false 64 + 65 + examples: 66 + - | 67 + gpio@fffe0406 { 68 + compatible = "brcm,bcm6345-gpio"; 69 + reg-names = "dirout", "dat"; 70 + reg = <0xfffe0406 2>, <0xfffe040a 2>; 71 + native-endian; 72 + 73 + gpio-controller; 74 + #gpio-cells = <2>; 75 + }; 76 + 77 + - | 78 + gpio@0 { 79 + compatible = "brcm,bcm63268-gpio"; 80 + reg-names = "dirout", "dat"; 81 + reg = <0x0 0x8>, <0x8 0x8>; 82 + 83 + gpio-controller; 84 + gpio-ranges = <&pinctrl 0 0 52>; 85 + #gpio-cells = <2>; 86 + };
+177
Documentation/devicetree/bindings/mfd/brcm,bcm6318-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm6318-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6318 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM6318 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm6318-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm6318-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@10000080 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm6318-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0x10000080 0x80>; 69 + ranges = <0 0x10000080 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm6318-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 50>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@10 { 82 + compatible = "brcm,bcm6318-pinctrl"; 83 + reg = <0x18 0x10>, <0x54 0x18>; 84 + 85 + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { 86 + function = "ephy0_spd_led"; 87 + pins = "gpio0"; 88 + }; 89 + 90 + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { 91 + function = "ephy1_spd_led"; 92 + pins = "gpio1"; 93 + }; 94 + 95 + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { 96 + function = "ephy2_spd_led"; 97 + pins = "gpio2"; 98 + }; 99 + 100 + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { 101 + function = "ephy3_spd_led"; 102 + pins = "gpio3"; 103 + }; 104 + 105 + pinctrl_ephy0_act_led: ephy0_act_led-pins { 106 + function = "ephy0_act_led"; 107 + pins = "gpio4"; 108 + }; 109 + 110 + pinctrl_ephy1_act_led: ephy1_act_led-pins { 111 + function = "ephy1_act_led"; 112 + pins = "gpio5"; 113 + }; 114 + 115 + pinctrl_ephy2_act_led: ephy2_act_led-pins { 116 + function = "ephy2_act_led"; 117 + pins = "gpio6"; 118 + }; 119 + 120 + pinctrl_ephy3_act_led: ephy3_act_led-pins { 121 + function = "ephy3_act_led"; 122 + pins = "gpio7"; 123 + }; 124 + 125 + pinctrl_serial_led: serial_led-pins { 126 + pinctrl_serial_led_data: serial_led_data-pins { 127 + function = "serial_led_data"; 128 + pins = "gpio6"; 129 + }; 130 + 131 + pinctrl_serial_led_clk: serial_led_clk-pins { 132 + function = "serial_led_clk"; 133 + pins = "gpio7"; 134 + }; 135 + }; 136 + 137 + pinctrl_inet_act_led: inet_act_led-pins { 138 + function = "inet_act_led"; 139 + pins = "gpio8"; 140 + }; 141 + 142 + pinctrl_inet_fail_led: inet_fail_led-pins { 143 + function = "inet_fail_led"; 144 + pins = "gpio9"; 145 + }; 146 + 147 + pinctrl_dsl_led: dsl_led-pins { 148 + function = "dsl_led"; 149 + pins = "gpio10"; 150 + }; 151 + 152 + pinctrl_post_fail_led: post_fail_led-pins { 153 + function = "post_fail_led"; 154 + pins = "gpio11"; 155 + }; 156 + 157 + pinctrl_wlan_wps_led: wlan_wps_led-pins { 158 + function = "wlan_wps_led"; 159 + pins = "gpio12"; 160 + }; 161 + 162 + pinctrl_usb_pwron: usb_pwron-pins { 163 + function = "usb_pwron"; 164 + pins = "gpio13"; 165 + }; 166 + 167 + pinctrl_usb_device_led: usb_device_led-pins { 168 + function = "usb_device_led"; 169 + pins = "gpio13"; 170 + }; 171 + 172 + pinctrl_usb_active: usb_active-pins { 173 + function = "usb_active"; 174 + pins = "gpio40"; 175 + }; 176 + }; 177 + };
+194
Documentation/devicetree/bindings/mfd/brcm,bcm63268-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm63268-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM63268 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM63268 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm63268-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm63268-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@100000c0 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm63268-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0x100000c0 0x80>; 69 + ranges = <0 0x100000c0 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm63268-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 52>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@10 { 82 + compatible = "brcm,bcm63268-pinctrl"; 83 + reg = <0x10 0x4>, <0x18 0x8>, <0x38 0x4>; 84 + 85 + pinctrl_serial_led: serial_led-pins { 86 + pinctrl_serial_led_clk: serial_led_clk-pins { 87 + function = "serial_led_clk"; 88 + pins = "gpio0"; 89 + }; 90 + 91 + pinctrl_serial_led_data: serial_led_data-pins { 92 + function = "serial_led_data"; 93 + pins = "gpio1"; 94 + }; 95 + }; 96 + 97 + pinctrl_hsspi_cs4: hsspi_cs4-pins { 98 + function = "hsspi_cs4"; 99 + pins = "gpio16"; 100 + }; 101 + 102 + pinctrl_hsspi_cs5: hsspi_cs5-pins { 103 + function = "hsspi_cs5"; 104 + pins = "gpio17"; 105 + }; 106 + 107 + pinctrl_hsspi_cs6: hsspi_cs6-pins { 108 + function = "hsspi_cs6"; 109 + pins = "gpio8"; 110 + }; 111 + 112 + pinctrl_hsspi_cs7: hsspi_cs7-pins { 113 + function = "hsspi_cs7"; 114 + pins = "gpio9"; 115 + }; 116 + 117 + pinctrl_adsl_spi: adsl_spi-pins { 118 + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { 119 + function = "adsl_spi_miso"; 120 + pins = "gpio18"; 121 + }; 122 + 123 + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { 124 + function = "adsl_spi_mosi"; 125 + pins = "gpio19"; 126 + }; 127 + }; 128 + 129 + pinctrl_vreq_clk: vreq_clk-pins { 130 + function = "vreq_clk"; 131 + pins = "gpio22"; 132 + }; 133 + 134 + pinctrl_pcie_clkreq_b: pcie_clkreq_b-pins { 135 + function = "pcie_clkreq_b"; 136 + pins = "gpio23"; 137 + }; 138 + 139 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 140 + function = "robosw_led_clk"; 141 + pins = "gpio30"; 142 + }; 143 + 144 + pinctrl_robosw_led_data: robosw_led_data-pins { 145 + function = "robosw_led_data"; 146 + pins = "gpio31"; 147 + }; 148 + 149 + pinctrl_nand: nand-pins { 150 + function = "nand"; 151 + group = "nand_grp"; 152 + }; 153 + 154 + pinctrl_gpio35_alt: gpio35_alt-pins { 155 + function = "gpio35_alt"; 156 + pin = "gpio35"; 157 + }; 158 + 159 + pinctrl_dectpd: dectpd-pins { 160 + function = "dectpd"; 161 + group = "dectpd_grp"; 162 + }; 163 + 164 + pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { 165 + function = "vdsl_phy_override_0"; 166 + group = "vdsl_phy_override_0_grp"; 167 + }; 168 + 169 + pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { 170 + function = "vdsl_phy_override_1"; 171 + group = "vdsl_phy_override_1_grp"; 172 + }; 173 + 174 + pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { 175 + function = "vdsl_phy_override_2"; 176 + group = "vdsl_phy_override_2_grp"; 177 + }; 178 + 179 + pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { 180 + function = "vdsl_phy_override_3"; 181 + group = "vdsl_phy_override_3_grp"; 182 + }; 183 + 184 + pinctrl_dsl_gpio8: dsl_gpio8-pins { 185 + function = "dsl_gpio8"; 186 + group = "dsl_gpio8"; 187 + }; 188 + 189 + pinctrl_dsl_gpio9: dsl_gpio9-pins { 190 + function = "dsl_gpio9"; 191 + group = "dsl_gpio9"; 192 + }; 193 + }; 194 + };
+162
Documentation/devicetree/bindings/mfd/brcm,bcm6328-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm6328-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6328 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM6328 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm6328-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm6328-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@10000080 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm6328-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0x10000080 0x80>; 69 + ranges = <0 0x10000080 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm6328-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 32>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@18 { 82 + compatible = "brcm,bcm6328-pinctrl"; 83 + reg = <0x18 0x10>; 84 + 85 + pinctrl_serial_led: serial_led-pins { 86 + pinctrl_serial_led_data: serial_led_data-pins { 87 + function = "serial_led_data"; 88 + pins = "gpio6"; 89 + }; 90 + 91 + pinctrl_serial_led_clk: serial_led_clk-pins { 92 + function = "serial_led_clk"; 93 + pins = "gpio7"; 94 + }; 95 + }; 96 + 97 + pinctrl_inet_act_led: inet_act_led-pins { 98 + function = "inet_act_led"; 99 + pins = "gpio11"; 100 + }; 101 + 102 + pinctrl_pcie_clkreq: pcie_clkreq-pins { 103 + function = "pcie_clkreq"; 104 + pins = "gpio16"; 105 + }; 106 + 107 + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { 108 + function = "led"; 109 + pins = "gpio17"; 110 + }; 111 + 112 + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { 113 + function = "led"; 114 + pins = "gpio18"; 115 + }; 116 + 117 + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { 118 + function = "led"; 119 + pins = "gpio19"; 120 + }; 121 + 122 + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { 123 + function = "led"; 124 + pins = "gpio20"; 125 + }; 126 + 127 + pinctrl_ephy0_act_led: ephy0_act_led-pins { 128 + function = "ephy0_act_led"; 129 + pins = "gpio25"; 130 + }; 131 + 132 + pinctrl_ephy1_act_led: ephy1_act_led-pins { 133 + function = "ephy1_act_led"; 134 + pins = "gpio26"; 135 + }; 136 + 137 + pinctrl_ephy2_act_led: ephy2_act_led-pins { 138 + function = "ephy2_act_led"; 139 + pins = "gpio27"; 140 + }; 141 + 142 + pinctrl_ephy3_act_led: ephy3_act_led-pins { 143 + function = "ephy3_act_led"; 144 + pins = "gpio28"; 145 + }; 146 + 147 + pinctrl_hsspi_cs1: hsspi_cs1-pins { 148 + function = "hsspi_cs1"; 149 + pins = "hsspi_cs1"; 150 + }; 151 + 152 + pinctrl_usb_port1_device: usb_port1_device-pins { 153 + function = "usb_device_port"; 154 + pins = "usb_port1"; 155 + }; 156 + 157 + pinctrl_usb_port1_host: usb_port1_host-pins { 158 + function = "usb_host_port"; 159 + pins = "usb_port1"; 160 + }; 161 + }; 162 + };
+130
Documentation/devicetree/bindings/mfd/brcm,bcm6358-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm6358-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6358 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM6358 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm6358-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm6358-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@fffe0080 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm6358-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0xfffe0080 0x80>; 69 + ranges = <0 0xfffe0080 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm6358-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 40>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@18 { 82 + compatible = "brcm,bcm6358-pinctrl"; 83 + reg = <0x18 0x4>; 84 + 85 + pinctrl_ebi_cs: ebi_cs-pins { 86 + function = "ebi_cs"; 87 + groups = "ebi_cs_grp"; 88 + }; 89 + 90 + pinctrl_uart1: uart1-pins { 91 + function = "uart1"; 92 + groups = "uart1_grp"; 93 + }; 94 + 95 + pinctrl_serial_led: serial_led-pins { 96 + function = "serial_led"; 97 + groups = "serial_led_grp"; 98 + }; 99 + 100 + pinctrl_legacy_led: legacy_led-pins { 101 + function = "legacy_led"; 102 + groups = "legacy_led_grp"; 103 + }; 104 + 105 + pinctrl_led: led-pins { 106 + function = "led"; 107 + groups = "led_grp"; 108 + }; 109 + 110 + pinctrl_spi_cs_23: spi_cs-pins { 111 + function = "spi_cs"; 112 + groups = "spi_cs_grp"; 113 + }; 114 + 115 + pinctrl_utopia: utopia-pins { 116 + function = "utopia"; 117 + groups = "utopia_grp"; 118 + }; 119 + 120 + pinctrl_pwm_syn_clk: pwm_syn_clk-pins { 121 + function = "pwm_syn_clk"; 122 + groups = "pwm_syn_clk_grp"; 123 + }; 124 + 125 + pinctrl_sys_irq: sys_irq-pins { 126 + function = "sys_irq"; 127 + groups = "sys_irq_grp"; 128 + }; 129 + }; 130 + };
+236
Documentation/devicetree/bindings/mfd/brcm,bcm6362-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm6362-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6362 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM6362 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm6362-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm6362-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@10000080 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm6362-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0x10000080 0x80>; 69 + ranges = <0 0x10000080 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm6362-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 48>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@18 { 82 + compatible = "brcm,bcm6362-pinctrl"; 83 + reg = <0x18 0x10>, <0x38 0x4>; 84 + 85 + pinctrl_usb_device_led: usb_device_led-pins { 86 + function = "usb_device_led"; 87 + pins = "gpio0"; 88 + }; 89 + 90 + pinctrl_sys_irq: sys_irq-pins { 91 + function = "sys_irq"; 92 + pins = "gpio1"; 93 + }; 94 + 95 + pinctrl_serial_led: serial_led-pins { 96 + pinctrl_serial_led_clk: serial_led_clk-pins { 97 + function = "serial_led_clk"; 98 + pins = "gpio2"; 99 + }; 100 + 101 + pinctrl_serial_led_data: serial_led_data-pins { 102 + function = "serial_led_data"; 103 + pins = "gpio3"; 104 + }; 105 + }; 106 + 107 + pinctrl_robosw_led_data: robosw_led_data-pins { 108 + function = "robosw_led_data"; 109 + pins = "gpio4"; 110 + }; 111 + 112 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 113 + function = "robosw_led_clk"; 114 + pins = "gpio5"; 115 + }; 116 + 117 + pinctrl_robosw_led0: robosw_led0-pins { 118 + function = "robosw_led0"; 119 + pins = "gpio6"; 120 + }; 121 + 122 + pinctrl_robosw_led1: robosw_led1-pins { 123 + function = "robosw_led1"; 124 + pins = "gpio7"; 125 + }; 126 + 127 + pinctrl_inet_led: inet_led-pins { 128 + function = "inet_led"; 129 + pins = "gpio8"; 130 + }; 131 + 132 + pinctrl_spi_cs2: spi_cs2-pins { 133 + function = "spi_cs2"; 134 + pins = "gpio9"; 135 + }; 136 + 137 + pinctrl_spi_cs3: spi_cs3-pins { 138 + function = "spi_cs3"; 139 + pins = "gpio10"; 140 + }; 141 + 142 + pinctrl_ntr_pulse: ntr_pulse-pins { 143 + function = "ntr_pulse"; 144 + pins = "gpio11"; 145 + }; 146 + 147 + pinctrl_uart1_scts: uart1_scts-pins { 148 + function = "uart1_scts"; 149 + pins = "gpio12"; 150 + }; 151 + 152 + pinctrl_uart1_srts: uart1_srts-pins { 153 + function = "uart1_srts"; 154 + pins = "gpio13"; 155 + }; 156 + 157 + pinctrl_uart1: uart1-pins { 158 + pinctrl_uart1_sdin: uart1_sdin-pins { 159 + function = "uart1_sdin"; 160 + pins = "gpio14"; 161 + }; 162 + 163 + pinctrl_uart1_sdout: uart1_sdout-pins { 164 + function = "uart1_sdout"; 165 + pins = "gpio15"; 166 + }; 167 + }; 168 + 169 + pinctrl_adsl_spi: adsl_spi-pins { 170 + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { 171 + function = "adsl_spi_miso"; 172 + pins = "gpio16"; 173 + }; 174 + 175 + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { 176 + function = "adsl_spi_mosi"; 177 + pins = "gpio17"; 178 + }; 179 + 180 + pinctrl_adsl_spi_clk: adsl_spi_clk-pins { 181 + function = "adsl_spi_clk"; 182 + pins = "gpio18"; 183 + }; 184 + 185 + pinctrl_adsl_spi_cs: adsl_spi_cs-pins { 186 + function = "adsl_spi_cs"; 187 + pins = "gpio19"; 188 + }; 189 + }; 190 + 191 + pinctrl_ephy0_led: ephy0_led-pins { 192 + function = "ephy0_led"; 193 + pins = "gpio20"; 194 + }; 195 + 196 + pinctrl_ephy1_led: ephy1_led-pins { 197 + function = "ephy1_led"; 198 + pins = "gpio21"; 199 + }; 200 + 201 + pinctrl_ephy2_led: ephy2_led-pins { 202 + function = "ephy2_led"; 203 + pins = "gpio22"; 204 + }; 205 + 206 + pinctrl_ephy3_led: ephy3_led-pins { 207 + function = "ephy3_led"; 208 + pins = "gpio23"; 209 + }; 210 + 211 + pinctrl_ext_irq0: ext_irq0-pins { 212 + function = "ext_irq0"; 213 + pins = "gpio24"; 214 + }; 215 + 216 + pinctrl_ext_irq1: ext_irq1-pins { 217 + function = "ext_irq1"; 218 + pins = "gpio25"; 219 + }; 220 + 221 + pinctrl_ext_irq2: ext_irq2-pins { 222 + function = "ext_irq2"; 223 + pins = "gpio26"; 224 + }; 225 + 226 + pinctrl_ext_irq3: ext_irq3-pins { 227 + function = "ext_irq3"; 228 + pins = "gpio27"; 229 + }; 230 + 231 + pinctrl_nand: nand-pins { 232 + function = "nand"; 233 + group = "nand_grp"; 234 + }; 235 + }; 236 + };
+246
Documentation/devicetree/bindings/mfd/brcm,bcm6368-gpio-sysctl.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/mfd/brcm,bcm6368-gpio-sysctl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6368 GPIO System Controller Device Tree Bindings 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Broadcom BCM6368 SoC GPIO system controller which provides a register map 15 + for controlling the GPIO and pins of the SoC. 16 + 17 + properties: 18 + "#address-cells": true 19 + 20 + "#size-cells": true 21 + 22 + compatible: 23 + items: 24 + - const: brcm,bcm6368-gpio-sysctl 25 + - const: syscon 26 + - const: simple-mfd 27 + 28 + ranges: 29 + maxItems: 1 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + patternProperties: 35 + "^gpio@[0-9a-f]+$": 36 + # Child node 37 + type: object 38 + $ref: "../gpio/brcm,bcm6345-gpio.yaml" 39 + description: 40 + GPIO controller for the SoC GPIOs. This child node definition 41 + should follow the bindings specified in 42 + Documentation/devicetree/bindings/gpio/brcm,bcm6345-gpio.yaml. 43 + 44 + "^pinctrl@[0-9a-f]+$": 45 + # Child node 46 + type: object 47 + $ref: "../pinctrl/brcm,bcm6368-pinctrl.yaml" 48 + description: 49 + Pin controller for the SoC pins. This child node definition 50 + should follow the bindings specified in 51 + Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-pinctrl.yaml. 52 + 53 + required: 54 + - "#address-cells" 55 + - compatible 56 + - ranges 57 + - reg 58 + - "#size-cells" 59 + 60 + additionalProperties: false 61 + 62 + examples: 63 + - | 64 + syscon@10000080 { 65 + #address-cells = <1>; 66 + #size-cells = <1>; 67 + compatible = "brcm,bcm6368-gpio-sysctl", "syscon", "simple-mfd"; 68 + reg = <0x10000080 0x80>; 69 + ranges = <0 0x10000080 0x80>; 70 + 71 + gpio@0 { 72 + compatible = "brcm,bcm6368-gpio"; 73 + reg-names = "dirout", "dat"; 74 + reg = <0x0 0x8>, <0x8 0x8>; 75 + 76 + gpio-controller; 77 + gpio-ranges = <&pinctrl 0 0 38>; 78 + #gpio-cells = <2>; 79 + }; 80 + 81 + pinctrl: pinctrl@18 { 82 + compatible = "brcm,bcm6368-pinctrl"; 83 + reg = <0x18 0x4>, <0x38 0x4>; 84 + 85 + pinctrl_analog_afe_0: analog_afe_0-pins { 86 + function = "analog_afe_0"; 87 + pins = "gpio0"; 88 + }; 89 + 90 + pinctrl_analog_afe_1: analog_afe_1-pins { 91 + function = "analog_afe_1"; 92 + pins = "gpio1"; 93 + }; 94 + 95 + pinctrl_sys_irq: sys_irq-pins { 96 + function = "sys_irq"; 97 + pins = "gpio2"; 98 + }; 99 + 100 + pinctrl_serial_led: serial_led-pins { 101 + pinctrl_serial_led_data: serial_led_data-pins { 102 + function = "serial_led_data"; 103 + pins = "gpio3"; 104 + }; 105 + 106 + pinctrl_serial_led_clk: serial_led_clk-pins { 107 + function = "serial_led_clk"; 108 + pins = "gpio4"; 109 + }; 110 + }; 111 + 112 + pinctrl_inet_led: inet_led-pins { 113 + function = "inet_led"; 114 + pins = "gpio5"; 115 + }; 116 + 117 + pinctrl_ephy0_led: ephy0_led-pins { 118 + function = "ephy0_led"; 119 + pins = "gpio6"; 120 + }; 121 + 122 + pinctrl_ephy1_led: ephy1_led-pins { 123 + function = "ephy1_led"; 124 + pins = "gpio7"; 125 + }; 126 + 127 + pinctrl_ephy2_led: ephy2_led-pins { 128 + function = "ephy2_led"; 129 + pins = "gpio8"; 130 + }; 131 + 132 + pinctrl_ephy3_led: ephy3_led-pins { 133 + function = "ephy3_led"; 134 + pins = "gpio9"; 135 + }; 136 + 137 + pinctrl_robosw_led_data: robosw_led_data-pins { 138 + function = "robosw_led_data"; 139 + pins = "gpio10"; 140 + }; 141 + 142 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 143 + function = "robosw_led_clk"; 144 + pins = "gpio11"; 145 + }; 146 + 147 + pinctrl_robosw_led0: robosw_led0-pins { 148 + function = "robosw_led0"; 149 + pins = "gpio12"; 150 + }; 151 + 152 + pinctrl_robosw_led1: robosw_led1-pins { 153 + function = "robosw_led1"; 154 + pins = "gpio13"; 155 + }; 156 + 157 + pinctrl_usb_device_led: usb_device_led-pins { 158 + function = "usb_device_led"; 159 + pins = "gpio14"; 160 + }; 161 + 162 + pinctrl_pci: pci-pins { 163 + pinctrl_pci_req1: pci_req1-pins { 164 + function = "pci_req1"; 165 + pins = "gpio16"; 166 + }; 167 + 168 + pinctrl_pci_gnt1: pci_gnt1-pins { 169 + function = "pci_gnt1"; 170 + pins = "gpio17"; 171 + }; 172 + 173 + pinctrl_pci_intb: pci_intb-pins { 174 + function = "pci_intb"; 175 + pins = "gpio18"; 176 + }; 177 + 178 + pinctrl_pci_req0: pci_req0-pins { 179 + function = "pci_req0"; 180 + pins = "gpio19"; 181 + }; 182 + 183 + pinctrl_pci_gnt0: pci_gnt0-pins { 184 + function = "pci_gnt0"; 185 + pins = "gpio20"; 186 + }; 187 + }; 188 + 189 + pinctrl_pcmcia: pcmcia-pins { 190 + pinctrl_pcmcia_cd1: pcmcia_cd1-pins { 191 + function = "pcmcia_cd1"; 192 + pins = "gpio22"; 193 + }; 194 + 195 + pinctrl_pcmcia_cd2: pcmcia_cd2-pins { 196 + function = "pcmcia_cd2"; 197 + pins = "gpio23"; 198 + }; 199 + 200 + pinctrl_pcmcia_vs1: pcmcia_vs1-pins { 201 + function = "pcmcia_vs1"; 202 + pins = "gpio24"; 203 + }; 204 + 205 + pinctrl_pcmcia_vs2: pcmcia_vs2-pins { 206 + function = "pcmcia_vs2"; 207 + pins = "gpio25"; 208 + }; 209 + }; 210 + 211 + pinctrl_ebi_cs2: ebi_cs2-pins { 212 + function = "ebi_cs2"; 213 + pins = "gpio26"; 214 + }; 215 + 216 + pinctrl_ebi_cs3: ebi_cs3-pins { 217 + function = "ebi_cs3"; 218 + pins = "gpio27"; 219 + }; 220 + 221 + pinctrl_spi_cs2: spi_cs2-pins { 222 + function = "spi_cs2"; 223 + pins = "gpio28"; 224 + }; 225 + 226 + pinctrl_spi_cs3: spi_cs3-pins { 227 + function = "spi_cs3"; 228 + pins = "gpio29"; 229 + }; 230 + 231 + pinctrl_spi_cs4: spi_cs4-pins { 232 + function = "spi_cs4"; 233 + pins = "gpio30"; 234 + }; 235 + 236 + pinctrl_spi_cs5: spi_cs5-pins { 237 + function = "spi_cs5"; 238 + pins = "gpio31"; 239 + }; 240 + 241 + pinctrl_uart1: uart1-pins { 242 + function = "uart1"; 243 + group = "uart1_grp"; 244 + }; 245 + }; 246 + };
+143
Documentation/devicetree/bindings/pinctrl/brcm,bcm6318-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/brcm,bcm6318-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6318 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM6318 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm6318-pinctrl 19 + 20 + reg: 21 + maxItems: 2 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ ephy0_spd_led, ephy1_spd_led, ephy2_spd_led, ephy3_spd_led, 31 + ephy0_act_led, ephy1_act_led, ephy2_act_led, ephy3_act_led, 32 + serial_led_data, serial_led_clk, inet_act_led, inet_fail_led, 33 + dsl_led, post_fail_led, wlan_wps_led, usb_pwron, 34 + usb_device_led, usb_active ] 35 + 36 + pins: 37 + enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, 38 + gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio40 ] 39 + 40 + required: 41 + - compatible 42 + - reg 43 + 44 + additionalProperties: false 45 + 46 + examples: 47 + - | 48 + pinctrl@18 { 49 + compatible = "brcm,bcm6318-pinctrl"; 50 + reg = <0x18 0x10>, <0x54 0x18>; 51 + 52 + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { 53 + function = "ephy0_spd_led"; 54 + pins = "gpio0"; 55 + }; 56 + 57 + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { 58 + function = "ephy1_spd_led"; 59 + pins = "gpio1"; 60 + }; 61 + 62 + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { 63 + function = "ephy2_spd_led"; 64 + pins = "gpio2"; 65 + }; 66 + 67 + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { 68 + function = "ephy3_spd_led"; 69 + pins = "gpio3"; 70 + }; 71 + 72 + pinctrl_ephy0_act_led: ephy0_act_led-pins { 73 + function = "ephy0_act_led"; 74 + pins = "gpio4"; 75 + }; 76 + 77 + pinctrl_ephy1_act_led: ephy1_act_led-pins { 78 + function = "ephy1_act_led"; 79 + pins = "gpio5"; 80 + }; 81 + 82 + pinctrl_ephy2_act_led: ephy2_act_led-pins { 83 + function = "ephy2_act_led"; 84 + pins = "gpio6"; 85 + }; 86 + 87 + pinctrl_ephy3_act_led: ephy3_act_led-pins { 88 + function = "ephy3_act_led"; 89 + pins = "gpio7"; 90 + }; 91 + 92 + pinctrl_serial_led: serial_led-pins { 93 + pinctrl_serial_led_data: serial_led_data-pins { 94 + function = "serial_led_data"; 95 + pins = "gpio6"; 96 + }; 97 + 98 + pinctrl_serial_led_clk: serial_led_clk-pins { 99 + function = "serial_led_clk"; 100 + pins = "gpio7"; 101 + }; 102 + }; 103 + 104 + pinctrl_inet_act_led: inet_act_led-pins { 105 + function = "inet_act_led"; 106 + pins = "gpio8"; 107 + }; 108 + 109 + pinctrl_inet_fail_led: inet_fail_led-pins { 110 + function = "inet_fail_led"; 111 + pins = "gpio9"; 112 + }; 113 + 114 + pinctrl_dsl_led: dsl_led-pins { 115 + function = "dsl_led"; 116 + pins = "gpio10"; 117 + }; 118 + 119 + pinctrl_post_fail_led: post_fail_led-pins { 120 + function = "post_fail_led"; 121 + pins = "gpio11"; 122 + }; 123 + 124 + pinctrl_wlan_wps_led: wlan_wps_led-pins { 125 + function = "wlan_wps_led"; 126 + pins = "gpio12"; 127 + }; 128 + 129 + pinctrl_usb_pwron: usb_pwron-pins { 130 + function = "usb_pwron"; 131 + pins = "gpio13"; 132 + }; 133 + 134 + pinctrl_usb_device_led: usb_device_led-pins { 135 + function = "usb_device_led"; 136 + pins = "gpio13"; 137 + }; 138 + 139 + pinctrl_usb_active: usb_active-pins { 140 + function = "usb_active"; 141 + pins = "gpio40"; 142 + }; 143 + };
+164
Documentation/devicetree/bindings/pinctrl/brcm,bcm63268-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/brcm,bcm63268-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM63268 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM63268 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm63268-pinctrl 19 + 20 + reg: 21 + maxItems: 3 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ serial_led_clk, serial_led_data, hsspi_cs4, hsspi_cs5, 31 + hsspi_cs6, hsspi_cs7, adsl_spi_miso, adsl_spi_mosi, 32 + vreq_clk, pcie_clkreq_b, robosw_led_clk, robosw_led_data, 33 + nand, gpio35_alt, dectpd, vdsl_phy_override_0, 34 + vdsl_phy_override_1, vdsl_phy_override_2, 35 + vdsl_phy_override_3, dsl_gpio8, dsl_gpio9 ] 36 + 37 + pins: 38 + enum: [ gpio0, gpio1, gpio16, gpio17, gpio8, gpio9, gpio18, gpio19, 39 + gpio22, gpio23, gpio30, gpio31, nand_grp, gpio35 40 + dectpd_grp, vdsl_phy_override_0_grp, 41 + vdsl_phy_override_1_grp, vdsl_phy_override_2_grp, 42 + vdsl_phy_override_3_grp, dsl_gpio8, dsl_gpio9 ] 43 + 44 + required: 45 + - compatible 46 + - reg 47 + 48 + additionalProperties: false 49 + 50 + examples: 51 + - | 52 + pinctrl@10 { 53 + compatible = "brcm,bcm63268-pinctrl"; 54 + reg = <0x10 0x4>, <0x18 0x8>, <0x38 0x4>; 55 + 56 + pinctrl_serial_led: serial_led-pins { 57 + pinctrl_serial_led_clk: serial_led_clk-pins { 58 + function = "serial_led_clk"; 59 + pins = "gpio0"; 60 + }; 61 + 62 + pinctrl_serial_led_data: serial_led_data-pins { 63 + function = "serial_led_data"; 64 + pins = "gpio1"; 65 + }; 66 + }; 67 + 68 + pinctrl_hsspi_cs4: hsspi_cs4-pins { 69 + function = "hsspi_cs4"; 70 + pins = "gpio16"; 71 + }; 72 + 73 + pinctrl_hsspi_cs5: hsspi_cs5-pins { 74 + function = "hsspi_cs5"; 75 + pins = "gpio17"; 76 + }; 77 + 78 + pinctrl_hsspi_cs6: hsspi_cs6-pins { 79 + function = "hsspi_cs6"; 80 + pins = "gpio8"; 81 + }; 82 + 83 + pinctrl_hsspi_cs7: hsspi_cs7-pins { 84 + function = "hsspi_cs7"; 85 + pins = "gpio9"; 86 + }; 87 + 88 + pinctrl_adsl_spi: adsl_spi-pins { 89 + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { 90 + function = "adsl_spi_miso"; 91 + pins = "gpio18"; 92 + }; 93 + 94 + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { 95 + function = "adsl_spi_mosi"; 96 + pins = "gpio19"; 97 + }; 98 + }; 99 + 100 + pinctrl_vreq_clk: vreq_clk-pins { 101 + function = "vreq_clk"; 102 + pins = "gpio22"; 103 + }; 104 + 105 + pinctrl_pcie_clkreq_b: pcie_clkreq_b-pins { 106 + function = "pcie_clkreq_b"; 107 + pins = "gpio23"; 108 + }; 109 + 110 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 111 + function = "robosw_led_clk"; 112 + pins = "gpio30"; 113 + }; 114 + 115 + pinctrl_robosw_led_data: robosw_led_data-pins { 116 + function = "robosw_led_data"; 117 + pins = "gpio31"; 118 + }; 119 + 120 + pinctrl_nand: nand-pins { 121 + function = "nand"; 122 + group = "nand_grp"; 123 + }; 124 + 125 + pinctrl_gpio35_alt: gpio35_alt-pins { 126 + function = "gpio35_alt"; 127 + pin = "gpio35"; 128 + }; 129 + 130 + pinctrl_dectpd: dectpd-pins { 131 + function = "dectpd"; 132 + group = "dectpd_grp"; 133 + }; 134 + 135 + pinctrl_vdsl_phy_override_0: vdsl_phy_override_0-pins { 136 + function = "vdsl_phy_override_0"; 137 + group = "vdsl_phy_override_0_grp"; 138 + }; 139 + 140 + pinctrl_vdsl_phy_override_1: vdsl_phy_override_1-pins { 141 + function = "vdsl_phy_override_1"; 142 + group = "vdsl_phy_override_1_grp"; 143 + }; 144 + 145 + pinctrl_vdsl_phy_override_2: vdsl_phy_override_2-pins { 146 + function = "vdsl_phy_override_2"; 147 + group = "vdsl_phy_override_2_grp"; 148 + }; 149 + 150 + pinctrl_vdsl_phy_override_3: vdsl_phy_override_3-pins { 151 + function = "vdsl_phy_override_3"; 152 + group = "vdsl_phy_override_3_grp"; 153 + }; 154 + 155 + pinctrl_dsl_gpio8: dsl_gpio8-pins { 156 + function = "dsl_gpio8"; 157 + group = "dsl_gpio8"; 158 + }; 159 + 160 + pinctrl_dsl_gpio9: dsl_gpio9-pins { 161 + function = "dsl_gpio9"; 162 + group = "dsl_gpio9"; 163 + }; 164 + };
+127
Documentation/devicetree/bindings/pinctrl/brcm,bcm6328-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/brcm,bcm6328-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6328 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM6328 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm6328-pinctrl 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ serial_led_data, serial_led_clk, inet_act_led, pcie_clkreq, 31 + led, ephy0_act_led, ephy1_act_led, ephy2_act_led, 32 + ephy3_act_led, hsspi_cs1, usb_device_port, usb_host_port ] 33 + 34 + pins: 35 + enum: [ gpio6, gpio7, gpio11, gpio16, gpio17, gpio18, gpio19, 36 + gpio20, gpio25, gpio26, gpio27, gpio28, hsspi_cs1, 37 + usb_port1 ] 38 + 39 + required: 40 + - compatible 41 + - reg 42 + 43 + additionalProperties: false 44 + 45 + examples: 46 + - | 47 + pinctrl@18 { 48 + compatible = "brcm,bcm6328-pinctrl"; 49 + reg = <0x18 0x10>; 50 + 51 + pinctrl_serial_led: serial_led-pins { 52 + pinctrl_serial_led_data: serial_led_data-pins { 53 + function = "serial_led_data"; 54 + pins = "gpio6"; 55 + }; 56 + 57 + pinctrl_serial_led_clk: serial_led_clk-pins { 58 + function = "serial_led_clk"; 59 + pins = "gpio7"; 60 + }; 61 + }; 62 + 63 + pinctrl_inet_act_led: inet_act_led-pins { 64 + function = "inet_act_led"; 65 + pins = "gpio11"; 66 + }; 67 + 68 + pinctrl_pcie_clkreq: pcie_clkreq-pins { 69 + function = "pcie_clkreq"; 70 + pins = "gpio16"; 71 + }; 72 + 73 + pinctrl_ephy0_spd_led: ephy0_spd_led-pins { 74 + function = "led"; 75 + pins = "gpio17"; 76 + }; 77 + 78 + pinctrl_ephy1_spd_led: ephy1_spd_led-pins { 79 + function = "led"; 80 + pins = "gpio18"; 81 + }; 82 + 83 + pinctrl_ephy2_spd_led: ephy2_spd_led-pins { 84 + function = "led"; 85 + pins = "gpio19"; 86 + }; 87 + 88 + pinctrl_ephy3_spd_led: ephy3_spd_led-pins { 89 + function = "led"; 90 + pins = "gpio20"; 91 + }; 92 + 93 + pinctrl_ephy0_act_led: ephy0_act_led-pins { 94 + function = "ephy0_act_led"; 95 + pins = "gpio25"; 96 + }; 97 + 98 + pinctrl_ephy1_act_led: ephy1_act_led-pins { 99 + function = "ephy1_act_led"; 100 + pins = "gpio26"; 101 + }; 102 + 103 + pinctrl_ephy2_act_led: ephy2_act_led-pins { 104 + function = "ephy2_act_led"; 105 + pins = "gpio27"; 106 + }; 107 + 108 + pinctrl_ephy3_act_led: ephy3_act_led-pins { 109 + function = "ephy3_act_led"; 110 + pins = "gpio28"; 111 + }; 112 + 113 + pinctrl_hsspi_cs1: hsspi_cs1-pins { 114 + function = "hsspi_cs1"; 115 + pins = "hsspi_cs1"; 116 + }; 117 + 118 + pinctrl_usb_port1_device: usb_port1_device-pins { 119 + function = "usb_device_port"; 120 + pins = "usb_port1"; 121 + }; 122 + 123 + pinctrl_usb_port1_host: usb_port1_host-pins { 124 + function = "usb_host_port"; 125 + pins = "usb_port1"; 126 + }; 127 + };
+93
Documentation/devicetree/bindings/pinctrl/brcm,bcm6358-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/brcm,bcm6358-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6358 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM6358 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm6358-pinctrl 19 + 20 + reg: 21 + maxItems: 1 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ ebi_cs, uart1, serial_led, legacy_led, led, spi_cs, utopia, 31 + pwm_syn_clk, sys_irq ] 32 + 33 + pins: 34 + enum: [ ebi_cs_grp, uart1_grp, serial_led_grp, legacy_led_grp, 35 + led_grp, spi_cs_grp, utopia_grp, pwm_syn_clk, sys_irq_grp ] 36 + 37 + required: 38 + - compatible 39 + - reg 40 + 41 + additionalProperties: false 42 + 43 + examples: 44 + - | 45 + pinctrl@18 { 46 + compatible = "brcm,bcm6358-pinctrl"; 47 + reg = <0x18 0x4>; 48 + 49 + pinctrl_ebi_cs: ebi_cs-pins { 50 + function = "ebi_cs"; 51 + groups = "ebi_cs_grp"; 52 + }; 53 + 54 + pinctrl_uart1: uart1-pins { 55 + function = "uart1"; 56 + groups = "uart1_grp"; 57 + }; 58 + 59 + pinctrl_serial_led: serial_led-pins { 60 + function = "serial_led"; 61 + groups = "serial_led_grp"; 62 + }; 63 + 64 + pinctrl_legacy_led: legacy_led-pins { 65 + function = "legacy_led"; 66 + groups = "legacy_led_grp"; 67 + }; 68 + 69 + pinctrl_led: led-pins { 70 + function = "led"; 71 + groups = "led_grp"; 72 + }; 73 + 74 + pinctrl_spi_cs_23: spi_cs-pins { 75 + function = "spi_cs"; 76 + groups = "spi_cs_grp"; 77 + }; 78 + 79 + pinctrl_utopia: utopia-pins { 80 + function = "utopia"; 81 + groups = "utopia_grp"; 82 + }; 83 + 84 + pinctrl_pwm_syn_clk: pwm_syn_clk-pins { 85 + function = "pwm_syn_clk"; 86 + groups = "pwm_syn_clk_grp"; 87 + }; 88 + 89 + pinctrl_sys_irq: sys_irq-pins { 90 + function = "sys_irq"; 91 + groups = "sys_irq_grp"; 92 + }; 93 + };
+206
Documentation/devicetree/bindings/pinctrl/brcm,bcm6362-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/brcm,bcm6362-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6362 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM6362 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm6362-pinctrl 19 + 20 + reg: 21 + maxItems: 2 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ usb_device_led, sys_irq, serial_led_clk, serial_led_data, 31 + robosw_led_data, robosw_led_clk, robosw_led0, robosw_led1, 32 + inet_led, spi_cs2, spi_cs3, ntr_pulse, uart1_scts, 33 + uart1_srts, uart1_sdin, uart1_sdout, adsl_spi_miso, 34 + adsl_spi_mosi, adsl_spi_clk, adsl_spi_cs, ephy0_led, 35 + ephy1_led, ephy2_led, ephy3_led, ext_irq0, ext_irq1, 36 + ext_irq2, ext_irq3, nand ] 37 + 38 + pins: 39 + enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, 40 + gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, 41 + gpio15, gpio16, gpio17, gpio18, gpio19, gpio20, gpio21, 42 + gpio22, gpio23, gpio24, gpio25, gpio26, gpio27, nand_grp ] 43 + 44 + required: 45 + - compatible 46 + - reg 47 + 48 + additionalProperties: false 49 + 50 + examples: 51 + - | 52 + pinctrl@18 { 53 + compatible = "brcm,bcm6362-pinctrl"; 54 + reg = <0x18 0x10>, <0x38 0x4>; 55 + 56 + pinctrl_usb_device_led: usb_device_led-pins { 57 + function = "usb_device_led"; 58 + pins = "gpio0"; 59 + }; 60 + 61 + pinctrl_sys_irq: sys_irq-pins { 62 + function = "sys_irq"; 63 + pins = "gpio1"; 64 + }; 65 + 66 + pinctrl_serial_led: serial_led-pins { 67 + pinctrl_serial_led_clk: serial_led_clk-pins { 68 + function = "serial_led_clk"; 69 + pins = "gpio2"; 70 + }; 71 + 72 + pinctrl_serial_led_data: serial_led_data-pins { 73 + function = "serial_led_data"; 74 + pins = "gpio3"; 75 + }; 76 + }; 77 + 78 + pinctrl_robosw_led_data: robosw_led_data-pins { 79 + function = "robosw_led_data"; 80 + pins = "gpio4"; 81 + }; 82 + 83 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 84 + function = "robosw_led_clk"; 85 + pins = "gpio5"; 86 + }; 87 + 88 + pinctrl_robosw_led0: robosw_led0-pins { 89 + function = "robosw_led0"; 90 + pins = "gpio6"; 91 + }; 92 + 93 + pinctrl_robosw_led1: robosw_led1-pins { 94 + function = "robosw_led1"; 95 + pins = "gpio7"; 96 + }; 97 + 98 + pinctrl_inet_led: inet_led-pins { 99 + function = "inet_led"; 100 + pins = "gpio8"; 101 + }; 102 + 103 + pinctrl_spi_cs2: spi_cs2-pins { 104 + function = "spi_cs2"; 105 + pins = "gpio9"; 106 + }; 107 + 108 + pinctrl_spi_cs3: spi_cs3-pins { 109 + function = "spi_cs3"; 110 + pins = "gpio10"; 111 + }; 112 + 113 + pinctrl_ntr_pulse: ntr_pulse-pins { 114 + function = "ntr_pulse"; 115 + pins = "gpio11"; 116 + }; 117 + 118 + pinctrl_uart1_scts: uart1_scts-pins { 119 + function = "uart1_scts"; 120 + pins = "gpio12"; 121 + }; 122 + 123 + pinctrl_uart1_srts: uart1_srts-pins { 124 + function = "uart1_srts"; 125 + pins = "gpio13"; 126 + }; 127 + 128 + pinctrl_uart1: uart1-pins { 129 + pinctrl_uart1_sdin: uart1_sdin-pins { 130 + function = "uart1_sdin"; 131 + pins = "gpio14"; 132 + }; 133 + 134 + pinctrl_uart1_sdout: uart1_sdout-pins { 135 + function = "uart1_sdout"; 136 + pins = "gpio15"; 137 + }; 138 + }; 139 + 140 + pinctrl_adsl_spi: adsl_spi-pins { 141 + pinctrl_adsl_spi_miso: adsl_spi_miso-pins { 142 + function = "adsl_spi_miso"; 143 + pins = "gpio16"; 144 + }; 145 + 146 + pinctrl_adsl_spi_mosi: adsl_spi_mosi-pins { 147 + function = "adsl_spi_mosi"; 148 + pins = "gpio17"; 149 + }; 150 + 151 + pinctrl_adsl_spi_clk: adsl_spi_clk-pins { 152 + function = "adsl_spi_clk"; 153 + pins = "gpio18"; 154 + }; 155 + 156 + pinctrl_adsl_spi_cs: adsl_spi_cs-pins { 157 + function = "adsl_spi_cs"; 158 + pins = "gpio19"; 159 + }; 160 + }; 161 + 162 + pinctrl_ephy0_led: ephy0_led-pins { 163 + function = "ephy0_led"; 164 + pins = "gpio20"; 165 + }; 166 + 167 + pinctrl_ephy1_led: ephy1_led-pins { 168 + function = "ephy1_led"; 169 + pins = "gpio21"; 170 + }; 171 + 172 + pinctrl_ephy2_led: ephy2_led-pins { 173 + function = "ephy2_led"; 174 + pins = "gpio22"; 175 + }; 176 + 177 + pinctrl_ephy3_led: ephy3_led-pins { 178 + function = "ephy3_led"; 179 + pins = "gpio23"; 180 + }; 181 + 182 + pinctrl_ext_irq0: ext_irq0-pins { 183 + function = "ext_irq0"; 184 + pins = "gpio24"; 185 + }; 186 + 187 + pinctrl_ext_irq1: ext_irq1-pins { 188 + function = "ext_irq1"; 189 + pins = "gpio25"; 190 + }; 191 + 192 + pinctrl_ext_irq2: ext_irq2-pins { 193 + function = "ext_irq2"; 194 + pins = "gpio26"; 195 + }; 196 + 197 + pinctrl_ext_irq3: ext_irq3-pins { 198 + function = "ext_irq3"; 199 + pins = "gpio27"; 200 + }; 201 + 202 + pinctrl_nand: nand-pins { 203 + function = "nand"; 204 + group = "nand_grp"; 205 + }; 206 + };
+217
Documentation/devicetree/bindings/pinctrl/brcm,bcm6368-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/brcm,bcm6368-pinctrl.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Broadcom BCM6368 pin controller 8 + 9 + maintainers: 10 + - Álvaro Fernández Rojas <noltari@gmail.com> 11 + - Jonas Gorski <jonas.gorski@gmail.com> 12 + 13 + description: 14 + Bindings for Broadcom's BCM6368 memory-mapped pin controller. 15 + 16 + properties: 17 + compatible: 18 + const: brcm,bcm6368-pinctrl 19 + 20 + reg: 21 + maxItems: 2 22 + 23 + patternProperties: 24 + '-pins$': 25 + type: object 26 + $ref: pinmux-node.yaml# 27 + 28 + properties: 29 + function: 30 + enum: [ analog_afe_0, analog_afe_1, sys_irq, serial_led_data, 31 + serial_led_clk, inet_led, ephy0_led, ephy1_led, ephy2_led, 32 + ephy3_led, robosw_led_data, robosw_led_clk, robosw_led0, 33 + robosw_led1, usb_device_led, pci_req1, pci_gnt1, pci_intb, 34 + pci_req0, pci_gnt0, pcmcia_cd1, pcmcia_cd2, pcmcia_vs1, 35 + pcmcia_vs2, ebi_cs2, ebi_cs3, spi_cs2, spi_cs3, spi_cs4, 36 + spi_cs5, uart1 ] 37 + 38 + pins: 39 + enum: [ gpio0, gpio1, gpio2, gpio3, gpio4, gpio5, gpio6, gpio7, 40 + gpio8, gpio9, gpio10, gpio11, gpio12, gpio13, gpio14, 41 + gpio16, gpio17, gpio18, gpio19, gpio20, gpio22, gpio23, 42 + gpio24, gpio25, gpio26, gpio27, gpio28, gpio29, gpio30, 43 + gpio31, uart1_grp ] 44 + 45 + required: 46 + - compatible 47 + - reg 48 + 49 + additionalProperties: false 50 + 51 + examples: 52 + - | 53 + pinctrl@18 { 54 + compatible = "brcm,bcm6368-pinctrl"; 55 + reg = <0x18 0x4>, <0x38 0x4>; 56 + 57 + pinctrl_analog_afe_0: analog_afe_0-pins { 58 + function = "analog_afe_0"; 59 + pins = "gpio0"; 60 + }; 61 + 62 + pinctrl_analog_afe_1: analog_afe_1-pins { 63 + function = "analog_afe_1"; 64 + pins = "gpio1"; 65 + }; 66 + 67 + pinctrl_sys_irq: sys_irq-pins { 68 + function = "sys_irq"; 69 + pins = "gpio2"; 70 + }; 71 + 72 + pinctrl_serial_led: serial_led-pins { 73 + pinctrl_serial_led_data: serial_led_data-pins { 74 + function = "serial_led_data"; 75 + pins = "gpio3"; 76 + }; 77 + 78 + pinctrl_serial_led_clk: serial_led_clk-pins { 79 + function = "serial_led_clk"; 80 + pins = "gpio4"; 81 + }; 82 + }; 83 + 84 + pinctrl_inet_led: inet_led-pins { 85 + function = "inet_led"; 86 + pins = "gpio5"; 87 + }; 88 + 89 + pinctrl_ephy0_led: ephy0_led-pins { 90 + function = "ephy0_led"; 91 + pins = "gpio6"; 92 + }; 93 + 94 + pinctrl_ephy1_led: ephy1_led-pins { 95 + function = "ephy1_led"; 96 + pins = "gpio7"; 97 + }; 98 + 99 + pinctrl_ephy2_led: ephy2_led-pins { 100 + function = "ephy2_led"; 101 + pins = "gpio8"; 102 + }; 103 + 104 + pinctrl_ephy3_led: ephy3_led-pins { 105 + function = "ephy3_led"; 106 + pins = "gpio9"; 107 + }; 108 + 109 + pinctrl_robosw_led_data: robosw_led_data-pins { 110 + function = "robosw_led_data"; 111 + pins = "gpio10"; 112 + }; 113 + 114 + pinctrl_robosw_led_clk: robosw_led_clk-pins { 115 + function = "robosw_led_clk"; 116 + pins = "gpio11"; 117 + }; 118 + 119 + pinctrl_robosw_led0: robosw_led0-pins { 120 + function = "robosw_led0"; 121 + pins = "gpio12"; 122 + }; 123 + 124 + pinctrl_robosw_led1: robosw_led1-pins { 125 + function = "robosw_led1"; 126 + pins = "gpio13"; 127 + }; 128 + 129 + pinctrl_usb_device_led: usb_device_led-pins { 130 + function = "usb_device_led"; 131 + pins = "gpio14"; 132 + }; 133 + 134 + pinctrl_pci: pci-pins { 135 + pinctrl_pci_req1: pci_req1-pins { 136 + function = "pci_req1"; 137 + pins = "gpio16"; 138 + }; 139 + 140 + pinctrl_pci_gnt1: pci_gnt1-pins { 141 + function = "pci_gnt1"; 142 + pins = "gpio17"; 143 + }; 144 + 145 + pinctrl_pci_intb: pci_intb-pins { 146 + function = "pci_intb"; 147 + pins = "gpio18"; 148 + }; 149 + 150 + pinctrl_pci_req0: pci_req0-pins { 151 + function = "pci_req0"; 152 + pins = "gpio19"; 153 + }; 154 + 155 + pinctrl_pci_gnt0: pci_gnt0-pins { 156 + function = "pci_gnt0"; 157 + pins = "gpio20"; 158 + }; 159 + }; 160 + 161 + pinctrl_pcmcia: pcmcia-pins { 162 + pinctrl_pcmcia_cd1: pcmcia_cd1-pins { 163 + function = "pcmcia_cd1"; 164 + pins = "gpio22"; 165 + }; 166 + 167 + pinctrl_pcmcia_cd2: pcmcia_cd2-pins { 168 + function = "pcmcia_cd2"; 169 + pins = "gpio23"; 170 + }; 171 + 172 + pinctrl_pcmcia_vs1: pcmcia_vs1-pins { 173 + function = "pcmcia_vs1"; 174 + pins = "gpio24"; 175 + }; 176 + 177 + pinctrl_pcmcia_vs2: pcmcia_vs2-pins { 178 + function = "pcmcia_vs2"; 179 + pins = "gpio25"; 180 + }; 181 + }; 182 + 183 + pinctrl_ebi_cs2: ebi_cs2-pins { 184 + function = "ebi_cs2"; 185 + pins = "gpio26"; 186 + }; 187 + 188 + pinctrl_ebi_cs3: ebi_cs3-pins { 189 + function = "ebi_cs3"; 190 + pins = "gpio27"; 191 + }; 192 + 193 + pinctrl_spi_cs2: spi_cs2-pins { 194 + function = "spi_cs2"; 195 + pins = "gpio28"; 196 + }; 197 + 198 + pinctrl_spi_cs3: spi_cs3-pins { 199 + function = "spi_cs3"; 200 + pins = "gpio29"; 201 + }; 202 + 203 + pinctrl_spi_cs4: spi_cs4-pins { 204 + function = "spi_cs4"; 205 + pins = "gpio30"; 206 + }; 207 + 208 + pinctrl_spi_cs5: spi_cs5-pins { 209 + function = "spi_cs5"; 210 + pins = "gpio31"; 211 + }; 212 + 213 + pinctrl_uart1: uart1-pins { 214 + function = "uart1"; 215 + group = "uart1_grp"; 216 + }; 217 + };
+5
drivers/gpio/gpio-regmap.c
··· 254 254 chip->names = config->names; 255 255 chip->label = config->label ?: dev_name(config->parent); 256 256 257 + #if defined(CONFIG_OF_GPIO) 258 + /* gpiolib will use of_node of the parent if chip->of_node is NULL */ 259 + chip->of_node = to_of_node(config->fwnode); 260 + #endif /* CONFIG_OF_GPIO */ 261 + 257 262 /* 258 263 * If our regmap is fast_io we should probably set can_sleep to false. 259 264 * Right now, the regmap doesn't save this property, nor is there any
+55
drivers/pinctrl/bcm/Kconfig
··· 29 29 help 30 30 Say Y here to enable the Broadcom BCM2835 GPIO driver. 31 31 32 + config PINCTRL_BCM63XX 33 + bool 34 + select GENERIC_PINCONF 35 + select GPIO_REGMAP 36 + select PINCONF 37 + select PINMUX 38 + 39 + config PINCTRL_BCM6318 40 + bool "Broadcom BCM6318 GPIO driver" 41 + depends on (BMIPS_GENERIC || COMPILE_TEST) 42 + select PINCTRL_BCM63XX 43 + default BMIPS_GENERIC 44 + help 45 + Say Y here to enable the Broadcom BCM6318 GPIO driver. 46 + 47 + config PINCTRL_BCM6328 48 + bool "Broadcom BCM6328 GPIO driver" 49 + depends on (BMIPS_GENERIC || COMPILE_TEST) 50 + select PINCTRL_BCM63XX 51 + default BMIPS_GENERIC 52 + help 53 + Say Y here to enable the Broadcom BCM6328 GPIO driver. 54 + 55 + config PINCTRL_BCM6358 56 + bool "Broadcom BCM6358 GPIO driver" 57 + depends on (BMIPS_GENERIC || COMPILE_TEST) 58 + select PINCTRL_BCM63XX 59 + default BMIPS_GENERIC 60 + help 61 + Say Y here to enable the Broadcom BCM6358 GPIO driver. 62 + 63 + config PINCTRL_BCM6362 64 + bool "Broadcom BCM6362 GPIO driver" 65 + depends on (BMIPS_GENERIC || COMPILE_TEST) 66 + select PINCTRL_BCM63XX 67 + default BMIPS_GENERIC 68 + help 69 + Say Y here to enable the Broadcom BCM6362 GPIO driver. 70 + 71 + config PINCTRL_BCM6368 72 + bool "Broadcom BCM6368 GPIO driver" 73 + depends on (BMIPS_GENERIC || COMPILE_TEST) 74 + select PINCTRL_BCM63XX 75 + default BMIPS_GENERIC 76 + help 77 + Say Y here to enable the Broadcom BCM6368 GPIO driver. 78 + 79 + config PINCTRL_BCM63268 80 + bool "Broadcom BCM63268 GPIO driver" 81 + depends on (BMIPS_GENERIC || COMPILE_TEST) 82 + select PINCTRL_BCM63XX 83 + default BMIPS_GENERIC 84 + help 85 + Say Y here to enable the Broadcom BCM63268 GPIO driver. 86 + 32 87 config PINCTRL_IPROC_GPIO 33 88 bool "Broadcom iProc GPIO (with PINCONF) driver" 34 89 depends on OF_GPIO && (ARCH_BCM_IPROC || COMPILE_TEST)
+7
drivers/pinctrl/bcm/Makefile
··· 3 3 4 4 obj-$(CONFIG_PINCTRL_BCM281XX) += pinctrl-bcm281xx.o 5 5 obj-$(CONFIG_PINCTRL_BCM2835) += pinctrl-bcm2835.o 6 + obj-$(CONFIG_PINCTRL_BCM63XX) += pinctrl-bcm63xx.o 7 + obj-$(CONFIG_PINCTRL_BCM6318) += pinctrl-bcm6318.o 8 + obj-$(CONFIG_PINCTRL_BCM6328) += pinctrl-bcm6328.o 9 + obj-$(CONFIG_PINCTRL_BCM6358) += pinctrl-bcm6358.o 10 + obj-$(CONFIG_PINCTRL_BCM6362) += pinctrl-bcm6362.o 11 + obj-$(CONFIG_PINCTRL_BCM6368) += pinctrl-bcm6368.o 12 + obj-$(CONFIG_PINCTRL_BCM63268) += pinctrl-bcm63268.o 6 13 obj-$(CONFIG_PINCTRL_IPROC_GPIO) += pinctrl-iproc-gpio.o 7 14 obj-$(CONFIG_PINCTRL_CYGNUS_MUX) += pinctrl-cygnus-mux.o 8 15 obj-$(CONFIG_PINCTRL_NS) += pinctrl-ns.o
+498
drivers/pinctrl/bcm/pinctrl-bcm6318.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM6318 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM6318_NUM_GPIOS 50 22 + #define BCM6318_NUM_MUX 48 23 + 24 + #define BCM6318_MODE_REG 0x18 25 + #define BCM6318_MUX_REG 0x1c 26 + #define BCM6328_MUX_MASK GENMASK(1, 0) 27 + #define BCM6318_PAD_REG 0x54 28 + #define BCM6328_PAD_MASK GENMASK(3, 0) 29 + 30 + struct bcm6318_pingroup { 31 + const char *name; 32 + const unsigned * const pins; 33 + const unsigned num_pins; 34 + }; 35 + 36 + struct bcm6318_function { 37 + const char *name; 38 + const char * const *groups; 39 + const unsigned num_groups; 40 + 41 + unsigned mode_val:1; 42 + unsigned mux_val:2; 43 + }; 44 + 45 + static const struct pinctrl_pin_desc bcm6318_pins[] = { 46 + PINCTRL_PIN(0, "gpio0"), 47 + PINCTRL_PIN(1, "gpio1"), 48 + PINCTRL_PIN(2, "gpio2"), 49 + PINCTRL_PIN(3, "gpio3"), 50 + PINCTRL_PIN(4, "gpio4"), 51 + PINCTRL_PIN(5, "gpio5"), 52 + PINCTRL_PIN(6, "gpio6"), 53 + PINCTRL_PIN(7, "gpio7"), 54 + PINCTRL_PIN(8, "gpio8"), 55 + PINCTRL_PIN(9, "gpio9"), 56 + PINCTRL_PIN(10, "gpio10"), 57 + PINCTRL_PIN(11, "gpio11"), 58 + PINCTRL_PIN(12, "gpio12"), 59 + PINCTRL_PIN(13, "gpio13"), 60 + PINCTRL_PIN(14, "gpio14"), 61 + PINCTRL_PIN(15, "gpio15"), 62 + PINCTRL_PIN(16, "gpio16"), 63 + PINCTRL_PIN(17, "gpio17"), 64 + PINCTRL_PIN(18, "gpio18"), 65 + PINCTRL_PIN(19, "gpio19"), 66 + PINCTRL_PIN(20, "gpio20"), 67 + PINCTRL_PIN(21, "gpio21"), 68 + PINCTRL_PIN(22, "gpio22"), 69 + PINCTRL_PIN(23, "gpio23"), 70 + PINCTRL_PIN(24, "gpio24"), 71 + PINCTRL_PIN(25, "gpio25"), 72 + PINCTRL_PIN(26, "gpio26"), 73 + PINCTRL_PIN(27, "gpio27"), 74 + PINCTRL_PIN(28, "gpio28"), 75 + PINCTRL_PIN(29, "gpio29"), 76 + PINCTRL_PIN(30, "gpio30"), 77 + PINCTRL_PIN(31, "gpio31"), 78 + PINCTRL_PIN(32, "gpio32"), 79 + PINCTRL_PIN(33, "gpio33"), 80 + PINCTRL_PIN(34, "gpio34"), 81 + PINCTRL_PIN(35, "gpio35"), 82 + PINCTRL_PIN(36, "gpio36"), 83 + PINCTRL_PIN(37, "gpio37"), 84 + PINCTRL_PIN(38, "gpio38"), 85 + PINCTRL_PIN(39, "gpio39"), 86 + PINCTRL_PIN(40, "gpio40"), 87 + PINCTRL_PIN(41, "gpio41"), 88 + PINCTRL_PIN(42, "gpio42"), 89 + PINCTRL_PIN(43, "gpio43"), 90 + PINCTRL_PIN(44, "gpio44"), 91 + PINCTRL_PIN(45, "gpio45"), 92 + PINCTRL_PIN(46, "gpio46"), 93 + PINCTRL_PIN(47, "gpio47"), 94 + PINCTRL_PIN(48, "gpio48"), 95 + PINCTRL_PIN(49, "gpio49"), 96 + }; 97 + 98 + static unsigned gpio0_pins[] = { 0 }; 99 + static unsigned gpio1_pins[] = { 1 }; 100 + static unsigned gpio2_pins[] = { 2 }; 101 + static unsigned gpio3_pins[] = { 3 }; 102 + static unsigned gpio4_pins[] = { 4 }; 103 + static unsigned gpio5_pins[] = { 5 }; 104 + static unsigned gpio6_pins[] = { 6 }; 105 + static unsigned gpio7_pins[] = { 7 }; 106 + static unsigned gpio8_pins[] = { 8 }; 107 + static unsigned gpio9_pins[] = { 9 }; 108 + static unsigned gpio10_pins[] = { 10 }; 109 + static unsigned gpio11_pins[] = { 11 }; 110 + static unsigned gpio12_pins[] = { 12 }; 111 + static unsigned gpio13_pins[] = { 13 }; 112 + static unsigned gpio14_pins[] = { 14 }; 113 + static unsigned gpio15_pins[] = { 15 }; 114 + static unsigned gpio16_pins[] = { 16 }; 115 + static unsigned gpio17_pins[] = { 17 }; 116 + static unsigned gpio18_pins[] = { 18 }; 117 + static unsigned gpio19_pins[] = { 19 }; 118 + static unsigned gpio20_pins[] = { 20 }; 119 + static unsigned gpio21_pins[] = { 21 }; 120 + static unsigned gpio22_pins[] = { 22 }; 121 + static unsigned gpio23_pins[] = { 23 }; 122 + static unsigned gpio24_pins[] = { 24 }; 123 + static unsigned gpio25_pins[] = { 25 }; 124 + static unsigned gpio26_pins[] = { 26 }; 125 + static unsigned gpio27_pins[] = { 27 }; 126 + static unsigned gpio28_pins[] = { 28 }; 127 + static unsigned gpio29_pins[] = { 29 }; 128 + static unsigned gpio30_pins[] = { 30 }; 129 + static unsigned gpio31_pins[] = { 31 }; 130 + static unsigned gpio32_pins[] = { 32 }; 131 + static unsigned gpio33_pins[] = { 33 }; 132 + static unsigned gpio34_pins[] = { 34 }; 133 + static unsigned gpio35_pins[] = { 35 }; 134 + static unsigned gpio36_pins[] = { 36 }; 135 + static unsigned gpio37_pins[] = { 37 }; 136 + static unsigned gpio38_pins[] = { 38 }; 137 + static unsigned gpio39_pins[] = { 39 }; 138 + static unsigned gpio40_pins[] = { 40 }; 139 + static unsigned gpio41_pins[] = { 41 }; 140 + static unsigned gpio42_pins[] = { 42 }; 141 + static unsigned gpio43_pins[] = { 43 }; 142 + static unsigned gpio44_pins[] = { 44 }; 143 + static unsigned gpio45_pins[] = { 45 }; 144 + static unsigned gpio46_pins[] = { 46 }; 145 + static unsigned gpio47_pins[] = { 47 }; 146 + static unsigned gpio48_pins[] = { 48 }; 147 + static unsigned gpio49_pins[] = { 49 }; 148 + 149 + #define BCM6318_GROUP(n) \ 150 + { \ 151 + .name = #n, \ 152 + .pins = n##_pins, \ 153 + .num_pins = ARRAY_SIZE(n##_pins), \ 154 + } 155 + 156 + static struct bcm6318_pingroup bcm6318_groups[] = { 157 + BCM6318_GROUP(gpio0), 158 + BCM6318_GROUP(gpio1), 159 + BCM6318_GROUP(gpio2), 160 + BCM6318_GROUP(gpio3), 161 + BCM6318_GROUP(gpio4), 162 + BCM6318_GROUP(gpio5), 163 + BCM6318_GROUP(gpio6), 164 + BCM6318_GROUP(gpio7), 165 + BCM6318_GROUP(gpio8), 166 + BCM6318_GROUP(gpio9), 167 + BCM6318_GROUP(gpio10), 168 + BCM6318_GROUP(gpio11), 169 + BCM6318_GROUP(gpio12), 170 + BCM6318_GROUP(gpio13), 171 + BCM6318_GROUP(gpio14), 172 + BCM6318_GROUP(gpio15), 173 + BCM6318_GROUP(gpio16), 174 + BCM6318_GROUP(gpio17), 175 + BCM6318_GROUP(gpio18), 176 + BCM6318_GROUP(gpio19), 177 + BCM6318_GROUP(gpio20), 178 + BCM6318_GROUP(gpio21), 179 + BCM6318_GROUP(gpio22), 180 + BCM6318_GROUP(gpio23), 181 + BCM6318_GROUP(gpio24), 182 + BCM6318_GROUP(gpio25), 183 + BCM6318_GROUP(gpio26), 184 + BCM6318_GROUP(gpio27), 185 + BCM6318_GROUP(gpio28), 186 + BCM6318_GROUP(gpio29), 187 + BCM6318_GROUP(gpio30), 188 + BCM6318_GROUP(gpio31), 189 + BCM6318_GROUP(gpio32), 190 + BCM6318_GROUP(gpio33), 191 + BCM6318_GROUP(gpio34), 192 + BCM6318_GROUP(gpio35), 193 + BCM6318_GROUP(gpio36), 194 + BCM6318_GROUP(gpio37), 195 + BCM6318_GROUP(gpio38), 196 + BCM6318_GROUP(gpio39), 197 + BCM6318_GROUP(gpio40), 198 + BCM6318_GROUP(gpio41), 199 + BCM6318_GROUP(gpio42), 200 + BCM6318_GROUP(gpio43), 201 + BCM6318_GROUP(gpio44), 202 + BCM6318_GROUP(gpio45), 203 + BCM6318_GROUP(gpio46), 204 + BCM6318_GROUP(gpio47), 205 + BCM6318_GROUP(gpio48), 206 + BCM6318_GROUP(gpio49), 207 + }; 208 + 209 + /* GPIO_MODE */ 210 + static const char * const led_groups[] = { 211 + "gpio0", 212 + "gpio1", 213 + "gpio2", 214 + "gpio3", 215 + "gpio4", 216 + "gpio5", 217 + "gpio6", 218 + "gpio7", 219 + "gpio8", 220 + "gpio9", 221 + "gpio10", 222 + "gpio11", 223 + "gpio12", 224 + "gpio13", 225 + "gpio14", 226 + "gpio15", 227 + "gpio16", 228 + "gpio17", 229 + "gpio18", 230 + "gpio19", 231 + "gpio20", 232 + "gpio21", 233 + "gpio22", 234 + "gpio23", 235 + }; 236 + 237 + /* PINMUX_SEL */ 238 + static const char * const ephy0_spd_led_groups[] = { 239 + "gpio0", 240 + }; 241 + 242 + static const char * const ephy1_spd_led_groups[] = { 243 + "gpio1", 244 + }; 245 + 246 + static const char * const ephy2_spd_led_groups[] = { 247 + "gpio2", 248 + }; 249 + 250 + static const char * const ephy3_spd_led_groups[] = { 251 + "gpio3", 252 + }; 253 + 254 + static const char * const ephy0_act_led_groups[] = { 255 + "gpio4", 256 + }; 257 + 258 + static const char * const ephy1_act_led_groups[] = { 259 + "gpio5", 260 + }; 261 + 262 + static const char * const ephy2_act_led_groups[] = { 263 + "gpio6", 264 + }; 265 + 266 + static const char * const ephy3_act_led_groups[] = { 267 + "gpio7", 268 + }; 269 + 270 + static const char * const serial_led_data_groups[] = { 271 + "gpio6", 272 + }; 273 + 274 + static const char * const serial_led_clk_groups[] = { 275 + "gpio7", 276 + }; 277 + 278 + static const char * const inet_act_led_groups[] = { 279 + "gpio8", 280 + }; 281 + 282 + static const char * const inet_fail_led_groups[] = { 283 + "gpio9", 284 + }; 285 + 286 + static const char * const dsl_led_groups[] = { 287 + "gpio10", 288 + }; 289 + 290 + static const char * const post_fail_led_groups[] = { 291 + "gpio11", 292 + }; 293 + 294 + static const char * const wlan_wps_led_groups[] = { 295 + "gpio12", 296 + }; 297 + 298 + static const char * const usb_pwron_groups[] = { 299 + "gpio13", 300 + }; 301 + 302 + static const char * const usb_device_led_groups[] = { 303 + "gpio13", 304 + }; 305 + 306 + static const char * const usb_active_groups[] = { 307 + "gpio40", 308 + }; 309 + 310 + #define BCM6318_MODE_FUN(n) \ 311 + { \ 312 + .name = #n, \ 313 + .groups = n##_groups, \ 314 + .num_groups = ARRAY_SIZE(n##_groups), \ 315 + .mode_val = 1, \ 316 + } 317 + 318 + #define BCM6318_MUX_FUN(n, mux) \ 319 + { \ 320 + .name = #n, \ 321 + .groups = n##_groups, \ 322 + .num_groups = ARRAY_SIZE(n##_groups), \ 323 + .mux_val = mux, \ 324 + } 325 + 326 + static const struct bcm6318_function bcm6318_funcs[] = { 327 + BCM6318_MODE_FUN(led), 328 + BCM6318_MUX_FUN(ephy0_spd_led, 1), 329 + BCM6318_MUX_FUN(ephy1_spd_led, 1), 330 + BCM6318_MUX_FUN(ephy2_spd_led, 1), 331 + BCM6318_MUX_FUN(ephy3_spd_led, 1), 332 + BCM6318_MUX_FUN(ephy0_act_led, 1), 333 + BCM6318_MUX_FUN(ephy1_act_led, 1), 334 + BCM6318_MUX_FUN(ephy2_act_led, 1), 335 + BCM6318_MUX_FUN(ephy3_act_led, 1), 336 + BCM6318_MUX_FUN(serial_led_data, 3), 337 + BCM6318_MUX_FUN(serial_led_clk, 3), 338 + BCM6318_MUX_FUN(inet_act_led, 1), 339 + BCM6318_MUX_FUN(inet_fail_led, 1), 340 + BCM6318_MUX_FUN(dsl_led, 1), 341 + BCM6318_MUX_FUN(post_fail_led, 1), 342 + BCM6318_MUX_FUN(wlan_wps_led, 1), 343 + BCM6318_MUX_FUN(usb_pwron, 1), 344 + BCM6318_MUX_FUN(usb_device_led, 2), 345 + BCM6318_MUX_FUN(usb_active, 2), 346 + }; 347 + 348 + static inline unsigned int bcm6318_mux_off(unsigned int pin) 349 + { 350 + return BCM6318_MUX_REG + (pin / 16) * 4; 351 + } 352 + 353 + static inline unsigned int bcm6318_pad_off(unsigned int pin) 354 + { 355 + return BCM6318_PAD_REG + (pin / 8) * 4; 356 + } 357 + 358 + static int bcm6318_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 359 + { 360 + return ARRAY_SIZE(bcm6318_groups); 361 + } 362 + 363 + static const char *bcm6318_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 364 + unsigned group) 365 + { 366 + return bcm6318_groups[group].name; 367 + } 368 + 369 + static int bcm6318_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 370 + unsigned group, const unsigned **pins, 371 + unsigned *num_pins) 372 + { 373 + *pins = bcm6318_groups[group].pins; 374 + *num_pins = bcm6318_groups[group].num_pins; 375 + 376 + return 0; 377 + } 378 + 379 + static int bcm6318_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 380 + { 381 + return ARRAY_SIZE(bcm6318_funcs); 382 + } 383 + 384 + static const char *bcm6318_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 385 + unsigned selector) 386 + { 387 + return bcm6318_funcs[selector].name; 388 + } 389 + 390 + static int bcm6318_pinctrl_get_groups(struct pinctrl_dev *pctldev, 391 + unsigned selector, 392 + const char * const **groups, 393 + unsigned * const num_groups) 394 + { 395 + *groups = bcm6318_funcs[selector].groups; 396 + *num_groups = bcm6318_funcs[selector].num_groups; 397 + 398 + return 0; 399 + } 400 + 401 + static inline void bcm6318_rmw_mux(struct bcm63xx_pinctrl *pc, unsigned pin, 402 + unsigned int mode, unsigned int mux) 403 + { 404 + if (pin < BCM63XX_BANK_GPIOS) 405 + regmap_update_bits(pc->regs, BCM6318_MODE_REG, BIT(pin), 406 + mode ? BIT(pin) : 0); 407 + 408 + if (pin < BCM6318_NUM_MUX) 409 + regmap_update_bits(pc->regs, 410 + bcm6318_mux_off(pin), 411 + BCM6328_MUX_MASK << ((pin % 16) * 2), 412 + mux << ((pin % 16) * 2)); 413 + } 414 + 415 + static inline void bcm6318_set_pad(struct bcm63xx_pinctrl *pc, unsigned pin, 416 + uint8_t val) 417 + { 418 + regmap_update_bits(pc->regs, bcm6318_pad_off(pin), 419 + BCM6328_PAD_MASK << ((pin % 8) * 4), 420 + val << ((pin % 8) * 4)); 421 + } 422 + 423 + static int bcm6318_pinctrl_set_mux(struct pinctrl_dev *pctldev, 424 + unsigned selector, unsigned group) 425 + { 426 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 427 + const struct bcm6318_pingroup *pg = &bcm6318_groups[group]; 428 + const struct bcm6318_function *f = &bcm6318_funcs[selector]; 429 + 430 + bcm6318_rmw_mux(pc, pg->pins[0], f->mode_val, f->mux_val); 431 + 432 + return 0; 433 + } 434 + 435 + static int bcm6318_gpio_request_enable(struct pinctrl_dev *pctldev, 436 + struct pinctrl_gpio_range *range, 437 + unsigned offset) 438 + { 439 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 440 + 441 + /* disable all functions using this pin */ 442 + if (offset < 13) { 443 + /* GPIOs 0-12 use mux 0 as GPIO function */ 444 + bcm6318_rmw_mux(pc, offset, 0, 0); 445 + } else if (offset < 42) { 446 + /* GPIOs 13-41 use mux 3 as GPIO function */ 447 + bcm6318_rmw_mux(pc, offset, 0, 3); 448 + 449 + bcm6318_set_pad(pc, offset, 0); 450 + } 451 + 452 + return 0; 453 + } 454 + 455 + static struct pinctrl_ops bcm6318_pctl_ops = { 456 + .dt_free_map = pinctrl_utils_free_map, 457 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 458 + .get_group_name = bcm6318_pinctrl_get_group_name, 459 + .get_group_pins = bcm6318_pinctrl_get_group_pins, 460 + .get_groups_count = bcm6318_pinctrl_get_group_count, 461 + }; 462 + 463 + static struct pinmux_ops bcm6318_pmx_ops = { 464 + .get_function_groups = bcm6318_pinctrl_get_groups, 465 + .get_function_name = bcm6318_pinctrl_get_func_name, 466 + .get_functions_count = bcm6318_pinctrl_get_func_count, 467 + .gpio_request_enable = bcm6318_gpio_request_enable, 468 + .set_mux = bcm6318_pinctrl_set_mux, 469 + .strict = true, 470 + }; 471 + 472 + static const struct bcm63xx_pinctrl_soc bcm6318_soc = { 473 + .ngpios = BCM6318_NUM_GPIOS, 474 + .npins = ARRAY_SIZE(bcm6318_pins), 475 + .pctl_ops = &bcm6318_pctl_ops, 476 + .pins = bcm6318_pins, 477 + .pmx_ops = &bcm6318_pmx_ops, 478 + }; 479 + 480 + static int bcm6318_pinctrl_probe(struct platform_device *pdev) 481 + { 482 + return bcm63xx_pinctrl_probe(pdev, &bcm6318_soc, NULL); 483 + } 484 + 485 + static const struct of_device_id bcm6318_pinctrl_match[] = { 486 + { .compatible = "brcm,bcm6318-pinctrl", }, 487 + { /* sentinel */ } 488 + }; 489 + 490 + static struct platform_driver bcm6318_pinctrl_driver = { 491 + .probe = bcm6318_pinctrl_probe, 492 + .driver = { 493 + .name = "bcm6318-pinctrl", 494 + .of_match_table = bcm6318_pinctrl_match, 495 + }, 496 + }; 497 + 498 + builtin_platform_driver(bcm6318_pinctrl_driver);
+643
drivers/pinctrl/bcm/pinctrl-bcm63268.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM63268 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM63268_NUM_GPIOS 52 22 + #define BCM63268_NUM_LEDS 24 23 + 24 + #define BCM63268_LED_REG 0x10 25 + #define BCM63268_MODE_REG 0x18 26 + #define BCM63268_CTRL_REG 0x1c 27 + #define BCM63268_BASEMODE_REG 0x38 28 + #define BCM63268_BASEMODE_NAND BIT(2) /* GPIOs 2-7, 24-31 */ 29 + #define BCM63268_BASEMODE_GPIO35 BIT(4) /* GPIO 35 */ 30 + #define BCM63268_BASEMODE_DECTPD BIT(5) /* GPIOs 8/9 */ 31 + #define BCM63268_BASEMODE_VDSL_PHY_0 BIT(6) /* GPIOs 10/11 */ 32 + #define BCM63268_BASEMODE_VDSL_PHY_1 BIT(7) /* GPIOs 12/13 */ 33 + #define BCM63268_BASEMODE_VDSL_PHY_2 BIT(8) /* GPIOs 24/25 */ 34 + #define BCM63268_BASEMODE_VDSL_PHY_3 BIT(9) /* GPIOs 26/27 */ 35 + 36 + enum bcm63268_pinctrl_reg { 37 + BCM63268_LEDCTRL, 38 + BCM63268_MODE, 39 + BCM63268_CTRL, 40 + BCM63268_BASEMODE, 41 + }; 42 + 43 + struct bcm63268_pingroup { 44 + const char *name; 45 + const unsigned * const pins; 46 + const unsigned num_pins; 47 + }; 48 + 49 + struct bcm63268_function { 50 + const char *name; 51 + const char * const *groups; 52 + const unsigned num_groups; 53 + 54 + enum bcm63268_pinctrl_reg reg; 55 + uint32_t mask; 56 + }; 57 + 58 + #define BCM63268_PIN(a, b, basemode) \ 59 + { \ 60 + .number = a, \ 61 + .name = b, \ 62 + .drv_data = (void *)(basemode) \ 63 + } 64 + 65 + static const struct pinctrl_pin_desc bcm63268_pins[] = { 66 + PINCTRL_PIN(0, "gpio0"), 67 + PINCTRL_PIN(1, "gpio1"), 68 + BCM63268_PIN(2, "gpio2", BCM63268_BASEMODE_NAND), 69 + BCM63268_PIN(3, "gpio3", BCM63268_BASEMODE_NAND), 70 + BCM63268_PIN(4, "gpio4", BCM63268_BASEMODE_NAND), 71 + BCM63268_PIN(5, "gpio5", BCM63268_BASEMODE_NAND), 72 + BCM63268_PIN(6, "gpio6", BCM63268_BASEMODE_NAND), 73 + BCM63268_PIN(7, "gpio7", BCM63268_BASEMODE_NAND), 74 + BCM63268_PIN(8, "gpio8", BCM63268_BASEMODE_DECTPD), 75 + BCM63268_PIN(9, "gpio9", BCM63268_BASEMODE_DECTPD), 76 + BCM63268_PIN(10, "gpio10", BCM63268_BASEMODE_VDSL_PHY_0), 77 + BCM63268_PIN(11, "gpio11", BCM63268_BASEMODE_VDSL_PHY_0), 78 + BCM63268_PIN(12, "gpio12", BCM63268_BASEMODE_VDSL_PHY_1), 79 + BCM63268_PIN(13, "gpio13", BCM63268_BASEMODE_VDSL_PHY_1), 80 + PINCTRL_PIN(14, "gpio14"), 81 + PINCTRL_PIN(15, "gpio15"), 82 + PINCTRL_PIN(16, "gpio16"), 83 + PINCTRL_PIN(17, "gpio17"), 84 + PINCTRL_PIN(18, "gpio18"), 85 + PINCTRL_PIN(19, "gpio19"), 86 + PINCTRL_PIN(20, "gpio20"), 87 + PINCTRL_PIN(21, "gpio21"), 88 + PINCTRL_PIN(22, "gpio22"), 89 + PINCTRL_PIN(23, "gpio23"), 90 + BCM63268_PIN(24, "gpio24", 91 + BCM63268_BASEMODE_NAND | BCM63268_BASEMODE_VDSL_PHY_2), 92 + BCM63268_PIN(25, "gpio25", 93 + BCM63268_BASEMODE_NAND | BCM63268_BASEMODE_VDSL_PHY_2), 94 + BCM63268_PIN(26, "gpio26", 95 + BCM63268_BASEMODE_NAND | BCM63268_BASEMODE_VDSL_PHY_3), 96 + BCM63268_PIN(27, "gpio27", 97 + BCM63268_BASEMODE_NAND | BCM63268_BASEMODE_VDSL_PHY_3), 98 + BCM63268_PIN(28, "gpio28", BCM63268_BASEMODE_NAND), 99 + BCM63268_PIN(29, "gpio29", BCM63268_BASEMODE_NAND), 100 + BCM63268_PIN(30, "gpio30", BCM63268_BASEMODE_NAND), 101 + BCM63268_PIN(31, "gpio31", BCM63268_BASEMODE_NAND), 102 + PINCTRL_PIN(32, "gpio32"), 103 + PINCTRL_PIN(33, "gpio33"), 104 + PINCTRL_PIN(34, "gpio34"), 105 + PINCTRL_PIN(35, "gpio35"), 106 + PINCTRL_PIN(36, "gpio36"), 107 + PINCTRL_PIN(37, "gpio37"), 108 + PINCTRL_PIN(38, "gpio38"), 109 + PINCTRL_PIN(39, "gpio39"), 110 + PINCTRL_PIN(40, "gpio40"), 111 + PINCTRL_PIN(41, "gpio41"), 112 + PINCTRL_PIN(42, "gpio42"), 113 + PINCTRL_PIN(43, "gpio43"), 114 + PINCTRL_PIN(44, "gpio44"), 115 + PINCTRL_PIN(45, "gpio45"), 116 + PINCTRL_PIN(46, "gpio46"), 117 + PINCTRL_PIN(47, "gpio47"), 118 + PINCTRL_PIN(48, "gpio48"), 119 + PINCTRL_PIN(49, "gpio49"), 120 + PINCTRL_PIN(50, "gpio50"), 121 + PINCTRL_PIN(51, "gpio51"), 122 + }; 123 + 124 + static unsigned gpio0_pins[] = { 0 }; 125 + static unsigned gpio1_pins[] = { 1 }; 126 + static unsigned gpio2_pins[] = { 2 }; 127 + static unsigned gpio3_pins[] = { 3 }; 128 + static unsigned gpio4_pins[] = { 4 }; 129 + static unsigned gpio5_pins[] = { 5 }; 130 + static unsigned gpio6_pins[] = { 6 }; 131 + static unsigned gpio7_pins[] = { 7 }; 132 + static unsigned gpio8_pins[] = { 8 }; 133 + static unsigned gpio9_pins[] = { 9 }; 134 + static unsigned gpio10_pins[] = { 10 }; 135 + static unsigned gpio11_pins[] = { 11 }; 136 + static unsigned gpio12_pins[] = { 12 }; 137 + static unsigned gpio13_pins[] = { 13 }; 138 + static unsigned gpio14_pins[] = { 14 }; 139 + static unsigned gpio15_pins[] = { 15 }; 140 + static unsigned gpio16_pins[] = { 16 }; 141 + static unsigned gpio17_pins[] = { 17 }; 142 + static unsigned gpio18_pins[] = { 18 }; 143 + static unsigned gpio19_pins[] = { 19 }; 144 + static unsigned gpio20_pins[] = { 20 }; 145 + static unsigned gpio21_pins[] = { 21 }; 146 + static unsigned gpio22_pins[] = { 22 }; 147 + static unsigned gpio23_pins[] = { 23 }; 148 + static unsigned gpio24_pins[] = { 24 }; 149 + static unsigned gpio25_pins[] = { 25 }; 150 + static unsigned gpio26_pins[] = { 26 }; 151 + static unsigned gpio27_pins[] = { 27 }; 152 + static unsigned gpio28_pins[] = { 28 }; 153 + static unsigned gpio29_pins[] = { 29 }; 154 + static unsigned gpio30_pins[] = { 30 }; 155 + static unsigned gpio31_pins[] = { 31 }; 156 + static unsigned gpio32_pins[] = { 32 }; 157 + static unsigned gpio33_pins[] = { 33 }; 158 + static unsigned gpio34_pins[] = { 34 }; 159 + static unsigned gpio35_pins[] = { 35 }; 160 + static unsigned gpio36_pins[] = { 36 }; 161 + static unsigned gpio37_pins[] = { 37 }; 162 + static unsigned gpio38_pins[] = { 38 }; 163 + static unsigned gpio39_pins[] = { 39 }; 164 + static unsigned gpio40_pins[] = { 40 }; 165 + static unsigned gpio41_pins[] = { 41 }; 166 + static unsigned gpio42_pins[] = { 42 }; 167 + static unsigned gpio43_pins[] = { 43 }; 168 + static unsigned gpio44_pins[] = { 44 }; 169 + static unsigned gpio45_pins[] = { 45 }; 170 + static unsigned gpio46_pins[] = { 46 }; 171 + static unsigned gpio47_pins[] = { 47 }; 172 + static unsigned gpio48_pins[] = { 48 }; 173 + static unsigned gpio49_pins[] = { 49 }; 174 + static unsigned gpio50_pins[] = { 50 }; 175 + static unsigned gpio51_pins[] = { 51 }; 176 + 177 + static unsigned nand_grp_pins[] = { 178 + 2, 3, 4, 5, 6, 7, 24, 179 + 25, 26, 27, 28, 29, 30, 31, 180 + }; 181 + 182 + static unsigned dectpd_grp_pins[] = { 8, 9 }; 183 + static unsigned vdsl_phy0_grp_pins[] = { 10, 11 }; 184 + static unsigned vdsl_phy1_grp_pins[] = { 12, 13 }; 185 + static unsigned vdsl_phy2_grp_pins[] = { 24, 25 }; 186 + static unsigned vdsl_phy3_grp_pins[] = { 26, 27 }; 187 + 188 + #define BCM63268_GROUP(n) \ 189 + { \ 190 + .name = #n, \ 191 + .pins = n##_pins, \ 192 + .num_pins = ARRAY_SIZE(n##_pins), \ 193 + } 194 + 195 + static struct bcm63268_pingroup bcm63268_groups[] = { 196 + BCM63268_GROUP(gpio0), 197 + BCM63268_GROUP(gpio1), 198 + BCM63268_GROUP(gpio2), 199 + BCM63268_GROUP(gpio3), 200 + BCM63268_GROUP(gpio4), 201 + BCM63268_GROUP(gpio5), 202 + BCM63268_GROUP(gpio6), 203 + BCM63268_GROUP(gpio7), 204 + BCM63268_GROUP(gpio8), 205 + BCM63268_GROUP(gpio9), 206 + BCM63268_GROUP(gpio10), 207 + BCM63268_GROUP(gpio11), 208 + BCM63268_GROUP(gpio12), 209 + BCM63268_GROUP(gpio13), 210 + BCM63268_GROUP(gpio14), 211 + BCM63268_GROUP(gpio15), 212 + BCM63268_GROUP(gpio16), 213 + BCM63268_GROUP(gpio17), 214 + BCM63268_GROUP(gpio18), 215 + BCM63268_GROUP(gpio19), 216 + BCM63268_GROUP(gpio20), 217 + BCM63268_GROUP(gpio21), 218 + BCM63268_GROUP(gpio22), 219 + BCM63268_GROUP(gpio23), 220 + BCM63268_GROUP(gpio24), 221 + BCM63268_GROUP(gpio25), 222 + BCM63268_GROUP(gpio26), 223 + BCM63268_GROUP(gpio27), 224 + BCM63268_GROUP(gpio28), 225 + BCM63268_GROUP(gpio29), 226 + BCM63268_GROUP(gpio30), 227 + BCM63268_GROUP(gpio31), 228 + BCM63268_GROUP(gpio32), 229 + BCM63268_GROUP(gpio33), 230 + BCM63268_GROUP(gpio34), 231 + BCM63268_GROUP(gpio35), 232 + BCM63268_GROUP(gpio36), 233 + BCM63268_GROUP(gpio37), 234 + BCM63268_GROUP(gpio38), 235 + BCM63268_GROUP(gpio39), 236 + BCM63268_GROUP(gpio40), 237 + BCM63268_GROUP(gpio41), 238 + BCM63268_GROUP(gpio42), 239 + BCM63268_GROUP(gpio43), 240 + BCM63268_GROUP(gpio44), 241 + BCM63268_GROUP(gpio45), 242 + BCM63268_GROUP(gpio46), 243 + BCM63268_GROUP(gpio47), 244 + BCM63268_GROUP(gpio48), 245 + BCM63268_GROUP(gpio49), 246 + BCM63268_GROUP(gpio50), 247 + BCM63268_GROUP(gpio51), 248 + 249 + /* multi pin groups */ 250 + BCM63268_GROUP(nand_grp), 251 + BCM63268_GROUP(dectpd_grp), 252 + BCM63268_GROUP(vdsl_phy0_grp), 253 + BCM63268_GROUP(vdsl_phy1_grp), 254 + BCM63268_GROUP(vdsl_phy2_grp), 255 + BCM63268_GROUP(vdsl_phy3_grp), 256 + }; 257 + 258 + static const char * const led_groups[] = { 259 + "gpio0", 260 + "gpio1", 261 + "gpio2", 262 + "gpio3", 263 + "gpio4", 264 + "gpio5", 265 + "gpio6", 266 + "gpio7", 267 + "gpio8", 268 + "gpio9", 269 + "gpio10", 270 + "gpio11", 271 + "gpio12", 272 + "gpio13", 273 + "gpio14", 274 + "gpio15", 275 + "gpio16", 276 + "gpio17", 277 + "gpio18", 278 + "gpio19", 279 + "gpio20", 280 + "gpio21", 281 + "gpio22", 282 + "gpio23", 283 + }; 284 + 285 + static const char * const serial_led_clk_groups[] = { 286 + "gpio0", 287 + }; 288 + 289 + static const char * const serial_led_data_groups[] = { 290 + "gpio1", 291 + }; 292 + 293 + static const char * const hsspi_cs4_groups[] = { 294 + "gpio16", 295 + }; 296 + 297 + static const char * const hsspi_cs5_groups[] = { 298 + "gpio17", 299 + }; 300 + 301 + static const char * const hsspi_cs6_groups[] = { 302 + "gpio8", 303 + }; 304 + 305 + static const char * const hsspi_cs7_groups[] = { 306 + "gpio9", 307 + }; 308 + 309 + static const char * const uart1_scts_groups[] = { 310 + "gpio10", 311 + "gpio24", 312 + }; 313 + 314 + static const char * const uart1_srts_groups[] = { 315 + "gpio11", 316 + "gpio25", 317 + }; 318 + 319 + static const char * const uart1_sdin_groups[] = { 320 + "gpio12", 321 + "gpio26", 322 + }; 323 + 324 + static const char * const uart1_sdout_groups[] = { 325 + "gpio13", 326 + "gpio27", 327 + }; 328 + 329 + static const char * const ntr_pulse_in_groups[] = { 330 + "gpio14", 331 + "gpio28", 332 + }; 333 + 334 + static const char * const dsl_ntr_pulse_out_groups[] = { 335 + "gpio15", 336 + "gpio29", 337 + }; 338 + 339 + static const char * const adsl_spi_miso_groups[] = { 340 + "gpio18", 341 + }; 342 + 343 + static const char * const adsl_spi_mosi_groups[] = { 344 + "gpio19", 345 + }; 346 + 347 + static const char * const vreg_clk_groups[] = { 348 + "gpio22", 349 + }; 350 + 351 + static const char * const pcie_clkreq_b_groups[] = { 352 + "gpio23", 353 + }; 354 + 355 + static const char * const switch_led_clk_groups[] = { 356 + "gpio30", 357 + }; 358 + 359 + static const char * const switch_led_data_groups[] = { 360 + "gpio31", 361 + }; 362 + 363 + static const char * const wifi_groups[] = { 364 + "gpio32", 365 + "gpio33", 366 + "gpio34", 367 + "gpio35", 368 + "gpio36", 369 + "gpio37", 370 + "gpio38", 371 + "gpio39", 372 + "gpio40", 373 + "gpio41", 374 + "gpio42", 375 + "gpio43", 376 + "gpio44", 377 + "gpio45", 378 + "gpio46", 379 + "gpio47", 380 + "gpio48", 381 + "gpio49", 382 + "gpio50", 383 + "gpio51", 384 + }; 385 + 386 + static const char * const nand_groups[] = { 387 + "nand_grp", 388 + }; 389 + 390 + static const char * const dectpd_groups[] = { 391 + "dectpd_grp", 392 + }; 393 + 394 + static const char * const vdsl_phy_override_0_groups[] = { 395 + "vdsl_phy_override_0_grp", 396 + }; 397 + 398 + static const char * const vdsl_phy_override_1_groups[] = { 399 + "vdsl_phy_override_1_grp", 400 + }; 401 + 402 + static const char * const vdsl_phy_override_2_groups[] = { 403 + "vdsl_phy_override_2_grp", 404 + }; 405 + 406 + static const char * const vdsl_phy_override_3_groups[] = { 407 + "vdsl_phy_override_3_grp", 408 + }; 409 + 410 + #define BCM63268_LED_FUN(n) \ 411 + { \ 412 + .name = #n, \ 413 + .groups = n##_groups, \ 414 + .num_groups = ARRAY_SIZE(n##_groups), \ 415 + .reg = BCM63268_LEDCTRL, \ 416 + } 417 + 418 + #define BCM63268_MODE_FUN(n) \ 419 + { \ 420 + .name = #n, \ 421 + .groups = n##_groups, \ 422 + .num_groups = ARRAY_SIZE(n##_groups), \ 423 + .reg = BCM63268_MODE, \ 424 + } 425 + 426 + #define BCM63268_CTRL_FUN(n) \ 427 + { \ 428 + .name = #n, \ 429 + .groups = n##_groups, \ 430 + .num_groups = ARRAY_SIZE(n##_groups), \ 431 + .reg = BCM63268_CTRL, \ 432 + } 433 + 434 + #define BCM63268_BASEMODE_FUN(n, val) \ 435 + { \ 436 + .name = #n, \ 437 + .groups = n##_groups, \ 438 + .num_groups = ARRAY_SIZE(n##_groups), \ 439 + .reg = BCM63268_BASEMODE, \ 440 + .mask = val, \ 441 + } 442 + 443 + static const struct bcm63268_function bcm63268_funcs[] = { 444 + BCM63268_LED_FUN(led), 445 + BCM63268_MODE_FUN(serial_led_clk), 446 + BCM63268_MODE_FUN(serial_led_data), 447 + BCM63268_MODE_FUN(hsspi_cs6), 448 + BCM63268_MODE_FUN(hsspi_cs7), 449 + BCM63268_MODE_FUN(uart1_scts), 450 + BCM63268_MODE_FUN(uart1_srts), 451 + BCM63268_MODE_FUN(uart1_sdin), 452 + BCM63268_MODE_FUN(uart1_sdout), 453 + BCM63268_MODE_FUN(ntr_pulse_in), 454 + BCM63268_MODE_FUN(dsl_ntr_pulse_out), 455 + BCM63268_MODE_FUN(hsspi_cs4), 456 + BCM63268_MODE_FUN(hsspi_cs5), 457 + BCM63268_MODE_FUN(adsl_spi_miso), 458 + BCM63268_MODE_FUN(adsl_spi_mosi), 459 + BCM63268_MODE_FUN(vreg_clk), 460 + BCM63268_MODE_FUN(pcie_clkreq_b), 461 + BCM63268_MODE_FUN(switch_led_clk), 462 + BCM63268_MODE_FUN(switch_led_data), 463 + BCM63268_CTRL_FUN(wifi), 464 + BCM63268_BASEMODE_FUN(nand, BCM63268_BASEMODE_NAND), 465 + BCM63268_BASEMODE_FUN(dectpd, BCM63268_BASEMODE_DECTPD), 466 + BCM63268_BASEMODE_FUN(vdsl_phy_override_0, 467 + BCM63268_BASEMODE_VDSL_PHY_0), 468 + BCM63268_BASEMODE_FUN(vdsl_phy_override_1, 469 + BCM63268_BASEMODE_VDSL_PHY_1), 470 + BCM63268_BASEMODE_FUN(vdsl_phy_override_2, 471 + BCM63268_BASEMODE_VDSL_PHY_2), 472 + BCM63268_BASEMODE_FUN(vdsl_phy_override_3, 473 + BCM63268_BASEMODE_VDSL_PHY_3), 474 + }; 475 + 476 + static int bcm63268_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 477 + { 478 + return ARRAY_SIZE(bcm63268_groups); 479 + } 480 + 481 + static const char *bcm63268_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 482 + unsigned group) 483 + { 484 + return bcm63268_groups[group].name; 485 + } 486 + 487 + static int bcm63268_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 488 + unsigned group, 489 + const unsigned **pins, 490 + unsigned *num_pins) 491 + { 492 + *pins = bcm63268_groups[group].pins; 493 + *num_pins = bcm63268_groups[group].num_pins; 494 + 495 + return 0; 496 + } 497 + 498 + static int bcm63268_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 499 + { 500 + return ARRAY_SIZE(bcm63268_funcs); 501 + } 502 + 503 + static const char *bcm63268_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 504 + unsigned selector) 505 + { 506 + return bcm63268_funcs[selector].name; 507 + } 508 + 509 + static int bcm63268_pinctrl_get_groups(struct pinctrl_dev *pctldev, 510 + unsigned selector, 511 + const char * const **groups, 512 + unsigned * const num_groups) 513 + { 514 + *groups = bcm63268_funcs[selector].groups; 515 + *num_groups = bcm63268_funcs[selector].num_groups; 516 + 517 + return 0; 518 + } 519 + 520 + static void bcm63268_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin) 521 + { 522 + const struct pinctrl_pin_desc *desc = &bcm63268_pins[pin]; 523 + unsigned int basemode = (unsigned long) desc->drv_data; 524 + unsigned int mask = BIT(bcm63xx_bank_pin(pin)); 525 + 526 + if (basemode) 527 + regmap_update_bits(pc->regs, BCM63268_BASEMODE_REG, basemode, 528 + 0); 529 + 530 + if (pin < BCM63XX_BANK_GPIOS) { 531 + /* base mode: 0 => gpio, 1 => mux function */ 532 + regmap_update_bits(pc->regs, BCM63268_MODE_REG, mask, 0); 533 + 534 + /* pins 0-23 might be muxed to led */ 535 + if (pin < BCM63268_NUM_LEDS) 536 + regmap_update_bits(pc->regs, BCM63268_LED_REG, mask, 537 + 0); 538 + } else if (pin < BCM63268_NUM_GPIOS) { 539 + /* ctrl reg: 0 => wifi function, 1 => gpio */ 540 + regmap_update_bits(pc->regs, BCM63268_CTRL_REG, mask, mask); 541 + } 542 + } 543 + 544 + static int bcm63268_pinctrl_set_mux(struct pinctrl_dev *pctldev, 545 + unsigned selector, unsigned group) 546 + { 547 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 548 + const struct bcm63268_pingroup *pg = &bcm63268_groups[group]; 549 + const struct bcm63268_function *f = &bcm63268_funcs[selector]; 550 + unsigned i; 551 + unsigned int reg; 552 + unsigned int val, mask; 553 + 554 + for (i = 0; i < pg->num_pins; i++) 555 + bcm63268_set_gpio(pc, pg->pins[i]); 556 + 557 + switch (f->reg) { 558 + case BCM63268_LEDCTRL: 559 + reg = BCM63268_LED_REG; 560 + mask = BIT(pg->pins[0]); 561 + val = BIT(pg->pins[0]); 562 + break; 563 + case BCM63268_MODE: 564 + reg = BCM63268_MODE_REG; 565 + mask = BIT(pg->pins[0]); 566 + val = BIT(pg->pins[0]); 567 + break; 568 + case BCM63268_CTRL: 569 + reg = BCM63268_CTRL_REG; 570 + mask = BIT(pg->pins[0]); 571 + val = 0; 572 + break; 573 + case BCM63268_BASEMODE: 574 + reg = BCM63268_BASEMODE_REG; 575 + mask = f->mask; 576 + val = f->mask; 577 + break; 578 + default: 579 + WARN_ON(1); 580 + return -EINVAL; 581 + } 582 + 583 + regmap_update_bits(pc->regs, reg, mask, val); 584 + 585 + return 0; 586 + } 587 + 588 + static int bcm63268_gpio_request_enable(struct pinctrl_dev *pctldev, 589 + struct pinctrl_gpio_range *range, 590 + unsigned offset) 591 + { 592 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 593 + 594 + /* disable all functions using this pin */ 595 + bcm63268_set_gpio(pc, offset); 596 + 597 + return 0; 598 + } 599 + 600 + static struct pinctrl_ops bcm63268_pctl_ops = { 601 + .dt_free_map = pinctrl_utils_free_map, 602 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 603 + .get_group_name = bcm63268_pinctrl_get_group_name, 604 + .get_group_pins = bcm63268_pinctrl_get_group_pins, 605 + .get_groups_count = bcm63268_pinctrl_get_group_count, 606 + }; 607 + 608 + static struct pinmux_ops bcm63268_pmx_ops = { 609 + .get_function_groups = bcm63268_pinctrl_get_groups, 610 + .get_function_name = bcm63268_pinctrl_get_func_name, 611 + .get_functions_count = bcm63268_pinctrl_get_func_count, 612 + .gpio_request_enable = bcm63268_gpio_request_enable, 613 + .set_mux = bcm63268_pinctrl_set_mux, 614 + .strict = true, 615 + }; 616 + 617 + static const struct bcm63xx_pinctrl_soc bcm63268_soc = { 618 + .ngpios = BCM63268_NUM_GPIOS, 619 + .npins = ARRAY_SIZE(bcm63268_pins), 620 + .pctl_ops = &bcm63268_pctl_ops, 621 + .pins = bcm63268_pins, 622 + .pmx_ops = &bcm63268_pmx_ops, 623 + }; 624 + 625 + static int bcm63268_pinctrl_probe(struct platform_device *pdev) 626 + { 627 + return bcm63xx_pinctrl_probe(pdev, &bcm63268_soc, NULL); 628 + } 629 + 630 + static const struct of_device_id bcm63268_pinctrl_match[] = { 631 + { .compatible = "brcm,bcm63268-pinctrl", }, 632 + { /* sentinel */ } 633 + }; 634 + 635 + static struct platform_driver bcm63268_pinctrl_driver = { 636 + .probe = bcm63268_pinctrl_probe, 637 + .driver = { 638 + .name = "bcm63268-pinctrl", 639 + .of_match_table = bcm63268_pinctrl_match, 640 + }, 641 + }; 642 + 643 + builtin_platform_driver(bcm63268_pinctrl_driver);
+404
drivers/pinctrl/bcm/pinctrl-bcm6328.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM6328 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM6328_NUM_GPIOS 32 22 + 23 + #define BCM6328_MODE_REG 0x18 24 + #define BCM6328_MUX_HI_REG 0x1c 25 + #define BCM6328_MUX_LO_REG 0x20 26 + #define BCM6328_MUX_OTHER_REG 0x24 27 + #define BCM6328_MUX_MASK GENMASK(1, 0) 28 + 29 + struct bcm6328_pingroup { 30 + const char *name; 31 + const unsigned * const pins; 32 + const unsigned num_pins; 33 + }; 34 + 35 + struct bcm6328_function { 36 + const char *name; 37 + const char * const *groups; 38 + const unsigned num_groups; 39 + 40 + unsigned mode_val:1; 41 + unsigned mux_val:2; 42 + }; 43 + 44 + static const unsigned int bcm6328_mux[] = { 45 + BCM6328_MUX_LO_REG, 46 + BCM6328_MUX_HI_REG, 47 + BCM6328_MUX_OTHER_REG 48 + }; 49 + 50 + static const struct pinctrl_pin_desc bcm6328_pins[] = { 51 + PINCTRL_PIN(0, "gpio0"), 52 + PINCTRL_PIN(1, "gpio1"), 53 + PINCTRL_PIN(2, "gpio2"), 54 + PINCTRL_PIN(3, "gpio3"), 55 + PINCTRL_PIN(4, "gpio4"), 56 + PINCTRL_PIN(5, "gpio5"), 57 + PINCTRL_PIN(6, "gpio6"), 58 + PINCTRL_PIN(7, "gpio7"), 59 + PINCTRL_PIN(8, "gpio8"), 60 + PINCTRL_PIN(9, "gpio9"), 61 + PINCTRL_PIN(10, "gpio10"), 62 + PINCTRL_PIN(11, "gpio11"), 63 + PINCTRL_PIN(12, "gpio12"), 64 + PINCTRL_PIN(13, "gpio13"), 65 + PINCTRL_PIN(14, "gpio14"), 66 + PINCTRL_PIN(15, "gpio15"), 67 + PINCTRL_PIN(16, "gpio16"), 68 + PINCTRL_PIN(17, "gpio17"), 69 + PINCTRL_PIN(18, "gpio18"), 70 + PINCTRL_PIN(19, "gpio19"), 71 + PINCTRL_PIN(20, "gpio20"), 72 + PINCTRL_PIN(21, "gpio21"), 73 + PINCTRL_PIN(22, "gpio22"), 74 + PINCTRL_PIN(23, "gpio23"), 75 + PINCTRL_PIN(24, "gpio24"), 76 + PINCTRL_PIN(25, "gpio25"), 77 + PINCTRL_PIN(26, "gpio26"), 78 + PINCTRL_PIN(27, "gpio27"), 79 + PINCTRL_PIN(28, "gpio28"), 80 + PINCTRL_PIN(29, "gpio29"), 81 + PINCTRL_PIN(30, "gpio30"), 82 + PINCTRL_PIN(31, "gpio31"), 83 + 84 + /* 85 + * No idea where they really are; so let's put them according 86 + * to their mux offsets. 87 + */ 88 + PINCTRL_PIN(36, "hsspi_cs1"), 89 + PINCTRL_PIN(38, "usb_p2"), 90 + }; 91 + 92 + static unsigned gpio0_pins[] = { 0 }; 93 + static unsigned gpio1_pins[] = { 1 }; 94 + static unsigned gpio2_pins[] = { 2 }; 95 + static unsigned gpio3_pins[] = { 3 }; 96 + static unsigned gpio4_pins[] = { 4 }; 97 + static unsigned gpio5_pins[] = { 5 }; 98 + static unsigned gpio6_pins[] = { 6 }; 99 + static unsigned gpio7_pins[] = { 7 }; 100 + static unsigned gpio8_pins[] = { 8 }; 101 + static unsigned gpio9_pins[] = { 9 }; 102 + static unsigned gpio10_pins[] = { 10 }; 103 + static unsigned gpio11_pins[] = { 11 }; 104 + static unsigned gpio12_pins[] = { 12 }; 105 + static unsigned gpio13_pins[] = { 13 }; 106 + static unsigned gpio14_pins[] = { 14 }; 107 + static unsigned gpio15_pins[] = { 15 }; 108 + static unsigned gpio16_pins[] = { 16 }; 109 + static unsigned gpio17_pins[] = { 17 }; 110 + static unsigned gpio18_pins[] = { 18 }; 111 + static unsigned gpio19_pins[] = { 19 }; 112 + static unsigned gpio20_pins[] = { 20 }; 113 + static unsigned gpio21_pins[] = { 21 }; 114 + static unsigned gpio22_pins[] = { 22 }; 115 + static unsigned gpio23_pins[] = { 23 }; 116 + static unsigned gpio24_pins[] = { 24 }; 117 + static unsigned gpio25_pins[] = { 25 }; 118 + static unsigned gpio26_pins[] = { 26 }; 119 + static unsigned gpio27_pins[] = { 27 }; 120 + static unsigned gpio28_pins[] = { 28 }; 121 + static unsigned gpio29_pins[] = { 29 }; 122 + static unsigned gpio30_pins[] = { 30 }; 123 + static unsigned gpio31_pins[] = { 31 }; 124 + 125 + static unsigned hsspi_cs1_pins[] = { 36 }; 126 + static unsigned usb_port1_pins[] = { 38 }; 127 + 128 + #define BCM6328_GROUP(n) \ 129 + { \ 130 + .name = #n, \ 131 + .pins = n##_pins, \ 132 + .num_pins = ARRAY_SIZE(n##_pins), \ 133 + } 134 + 135 + static struct bcm6328_pingroup bcm6328_groups[] = { 136 + BCM6328_GROUP(gpio0), 137 + BCM6328_GROUP(gpio1), 138 + BCM6328_GROUP(gpio2), 139 + BCM6328_GROUP(gpio3), 140 + BCM6328_GROUP(gpio4), 141 + BCM6328_GROUP(gpio5), 142 + BCM6328_GROUP(gpio6), 143 + BCM6328_GROUP(gpio7), 144 + BCM6328_GROUP(gpio8), 145 + BCM6328_GROUP(gpio9), 146 + BCM6328_GROUP(gpio10), 147 + BCM6328_GROUP(gpio11), 148 + BCM6328_GROUP(gpio12), 149 + BCM6328_GROUP(gpio13), 150 + BCM6328_GROUP(gpio14), 151 + BCM6328_GROUP(gpio15), 152 + BCM6328_GROUP(gpio16), 153 + BCM6328_GROUP(gpio17), 154 + BCM6328_GROUP(gpio18), 155 + BCM6328_GROUP(gpio19), 156 + BCM6328_GROUP(gpio20), 157 + BCM6328_GROUP(gpio21), 158 + BCM6328_GROUP(gpio22), 159 + BCM6328_GROUP(gpio23), 160 + BCM6328_GROUP(gpio24), 161 + BCM6328_GROUP(gpio25), 162 + BCM6328_GROUP(gpio26), 163 + BCM6328_GROUP(gpio27), 164 + BCM6328_GROUP(gpio28), 165 + BCM6328_GROUP(gpio29), 166 + BCM6328_GROUP(gpio30), 167 + BCM6328_GROUP(gpio31), 168 + 169 + BCM6328_GROUP(hsspi_cs1), 170 + BCM6328_GROUP(usb_port1), 171 + }; 172 + 173 + /* GPIO_MODE */ 174 + static const char * const led_groups[] = { 175 + "gpio0", 176 + "gpio1", 177 + "gpio2", 178 + "gpio3", 179 + "gpio4", 180 + "gpio5", 181 + "gpio6", 182 + "gpio7", 183 + "gpio8", 184 + "gpio9", 185 + "gpio10", 186 + "gpio11", 187 + "gpio12", 188 + "gpio13", 189 + "gpio14", 190 + "gpio15", 191 + "gpio16", 192 + "gpio17", 193 + "gpio18", 194 + "gpio19", 195 + "gpio20", 196 + "gpio21", 197 + "gpio22", 198 + "gpio23", 199 + }; 200 + 201 + /* PINMUX_SEL */ 202 + static const char * const serial_led_data_groups[] = { 203 + "gpio6", 204 + }; 205 + 206 + static const char * const serial_led_clk_groups[] = { 207 + "gpio7", 208 + }; 209 + 210 + static const char * const inet_act_led_groups[] = { 211 + "gpio11", 212 + }; 213 + 214 + static const char * const pcie_clkreq_groups[] = { 215 + "gpio16", 216 + }; 217 + 218 + static const char * const ephy0_act_led_groups[] = { 219 + "gpio25", 220 + }; 221 + 222 + static const char * const ephy1_act_led_groups[] = { 223 + "gpio26", 224 + }; 225 + 226 + static const char * const ephy2_act_led_groups[] = { 227 + "gpio27", 228 + }; 229 + 230 + static const char * const ephy3_act_led_groups[] = { 231 + "gpio28", 232 + }; 233 + 234 + static const char * const hsspi_cs1_groups[] = { 235 + "hsspi_cs1" 236 + }; 237 + 238 + static const char * const usb_host_port_groups[] = { 239 + "usb_port1", 240 + }; 241 + 242 + static const char * const usb_device_port_groups[] = { 243 + "usb_port1", 244 + }; 245 + 246 + #define BCM6328_MODE_FUN(n) \ 247 + { \ 248 + .name = #n, \ 249 + .groups = n##_groups, \ 250 + .num_groups = ARRAY_SIZE(n##_groups), \ 251 + .mode_val = 1, \ 252 + } 253 + 254 + #define BCM6328_MUX_FUN(n, mux) \ 255 + { \ 256 + .name = #n, \ 257 + .groups = n##_groups, \ 258 + .num_groups = ARRAY_SIZE(n##_groups), \ 259 + .mux_val = mux, \ 260 + } 261 + 262 + static const struct bcm6328_function bcm6328_funcs[] = { 263 + BCM6328_MODE_FUN(led), 264 + BCM6328_MUX_FUN(serial_led_data, 2), 265 + BCM6328_MUX_FUN(serial_led_clk, 2), 266 + BCM6328_MUX_FUN(inet_act_led, 1), 267 + BCM6328_MUX_FUN(pcie_clkreq, 2), 268 + BCM6328_MUX_FUN(ephy0_act_led, 1), 269 + BCM6328_MUX_FUN(ephy1_act_led, 1), 270 + BCM6328_MUX_FUN(ephy2_act_led, 1), 271 + BCM6328_MUX_FUN(ephy3_act_led, 1), 272 + BCM6328_MUX_FUN(hsspi_cs1, 2), 273 + BCM6328_MUX_FUN(usb_host_port, 1), 274 + BCM6328_MUX_FUN(usb_device_port, 2), 275 + }; 276 + 277 + static inline unsigned int bcm6328_mux_off(unsigned int pin) 278 + { 279 + return bcm6328_mux[pin / 16]; 280 + } 281 + 282 + static int bcm6328_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 283 + { 284 + return ARRAY_SIZE(bcm6328_groups); 285 + } 286 + 287 + static const char *bcm6328_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 288 + unsigned group) 289 + { 290 + return bcm6328_groups[group].name; 291 + } 292 + 293 + static int bcm6328_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 294 + unsigned group, const unsigned **pins, 295 + unsigned *num_pins) 296 + { 297 + *pins = bcm6328_groups[group].pins; 298 + *num_pins = bcm6328_groups[group].num_pins; 299 + 300 + return 0; 301 + } 302 + 303 + static int bcm6328_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 304 + { 305 + return ARRAY_SIZE(bcm6328_funcs); 306 + } 307 + 308 + static const char *bcm6328_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 309 + unsigned selector) 310 + { 311 + return bcm6328_funcs[selector].name; 312 + } 313 + 314 + static int bcm6328_pinctrl_get_groups(struct pinctrl_dev *pctldev, 315 + unsigned selector, 316 + const char * const **groups, 317 + unsigned * const num_groups) 318 + { 319 + *groups = bcm6328_funcs[selector].groups; 320 + *num_groups = bcm6328_funcs[selector].num_groups; 321 + 322 + return 0; 323 + } 324 + 325 + static void bcm6328_rmw_mux(struct bcm63xx_pinctrl *pc, unsigned pin, 326 + unsigned int mode, unsigned int mux) 327 + { 328 + if (pin < BCM6328_NUM_GPIOS) 329 + regmap_update_bits(pc->regs, BCM6328_MODE_REG, BIT(pin), 330 + mode ? BIT(pin) : 0); 331 + 332 + regmap_update_bits(pc->regs, bcm6328_mux_off(pin), 333 + BCM6328_MUX_MASK << ((pin % 16) * 2), 334 + mux << ((pin % 16) * 2)); 335 + } 336 + 337 + static int bcm6328_pinctrl_set_mux(struct pinctrl_dev *pctldev, 338 + unsigned selector, unsigned group) 339 + { 340 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 341 + const struct bcm6328_pingroup *pg = &bcm6328_groups[group]; 342 + const struct bcm6328_function *f = &bcm6328_funcs[selector]; 343 + 344 + bcm6328_rmw_mux(pc, pg->pins[0], f->mode_val, f->mux_val); 345 + 346 + return 0; 347 + } 348 + 349 + static int bcm6328_gpio_request_enable(struct pinctrl_dev *pctldev, 350 + struct pinctrl_gpio_range *range, 351 + unsigned offset) 352 + { 353 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 354 + 355 + /* disable all functions using this pin */ 356 + bcm6328_rmw_mux(pc, offset, 0, 0); 357 + 358 + return 0; 359 + } 360 + 361 + static struct pinctrl_ops bcm6328_pctl_ops = { 362 + .dt_free_map = pinctrl_utils_free_map, 363 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 364 + .get_group_name = bcm6328_pinctrl_get_group_name, 365 + .get_group_pins = bcm6328_pinctrl_get_group_pins, 366 + .get_groups_count = bcm6328_pinctrl_get_group_count, 367 + }; 368 + 369 + static struct pinmux_ops bcm6328_pmx_ops = { 370 + .get_function_groups = bcm6328_pinctrl_get_groups, 371 + .get_function_name = bcm6328_pinctrl_get_func_name, 372 + .get_functions_count = bcm6328_pinctrl_get_func_count, 373 + .gpio_request_enable = bcm6328_gpio_request_enable, 374 + .set_mux = bcm6328_pinctrl_set_mux, 375 + .strict = true, 376 + }; 377 + 378 + static const struct bcm63xx_pinctrl_soc bcm6328_soc = { 379 + .ngpios = BCM6328_NUM_GPIOS, 380 + .npins = ARRAY_SIZE(bcm6328_pins), 381 + .pctl_ops = &bcm6328_pctl_ops, 382 + .pins = bcm6328_pins, 383 + .pmx_ops = &bcm6328_pmx_ops, 384 + }; 385 + 386 + static int bcm6328_pinctrl_probe(struct platform_device *pdev) 387 + { 388 + return bcm63xx_pinctrl_probe(pdev, &bcm6328_soc, NULL); 389 + } 390 + 391 + static const struct of_device_id bcm6328_pinctrl_match[] = { 392 + { .compatible = "brcm,bcm6328-pinctrl", }, 393 + { /* sentinel */ } 394 + }; 395 + 396 + static struct platform_driver bcm6328_pinctrl_driver = { 397 + .probe = bcm6328_pinctrl_probe, 398 + .driver = { 399 + .name = "bcm6328-pinctrl", 400 + .of_match_table = bcm6328_pinctrl_match, 401 + }, 402 + }; 403 + 404 + builtin_platform_driver(bcm6328_pinctrl_driver);
+369
drivers/pinctrl/bcm/pinctrl-bcm6358.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM6358 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM6358_NUM_GPIOS 40 22 + 23 + #define BCM6358_MODE_REG 0x18 24 + #define BCM6358_MODE_MUX_NONE 0 25 + #define BCM6358_MODE_MUX_EBI_CS BIT(5) 26 + #define BCM6358_MODE_MUX_UART1 BIT(6) 27 + #define BCM6358_MODE_MUX_SPI_CS BIT(7) 28 + #define BCM6358_MODE_MUX_ASYNC_MODEM BIT(8) 29 + #define BCM6358_MODE_MUX_LEGACY_LED BIT(9) 30 + #define BCM6358_MODE_MUX_SERIAL_LED BIT(10) 31 + #define BCM6358_MODE_MUX_LED BIT(11) 32 + #define BCM6358_MODE_MUX_UTOPIA BIT(12) 33 + #define BCM6358_MODE_MUX_CLKRST BIT(13) 34 + #define BCM6358_MODE_MUX_PWM_SYN_CLK BIT(14) 35 + #define BCM6358_MODE_MUX_SYS_IRQ BIT(15) 36 + 37 + struct bcm6358_pingroup { 38 + const char *name; 39 + const unsigned * const pins; 40 + const unsigned num_pins; 41 + 42 + const uint16_t mode_val; 43 + 44 + /* non-GPIO function muxes require the gpio direction to be set */ 45 + const uint16_t direction; 46 + }; 47 + 48 + struct bcm6358_function { 49 + const char *name; 50 + const char * const *groups; 51 + const unsigned num_groups; 52 + }; 53 + 54 + struct bcm6358_priv { 55 + struct regmap_field *overlays; 56 + }; 57 + 58 + #define BCM6358_GPIO_PIN(a, b, bit1, bit2, bit3) \ 59 + { \ 60 + .number = a, \ 61 + .name = b, \ 62 + .drv_data = (void *)(BCM6358_MODE_MUX_##bit1 | \ 63 + BCM6358_MODE_MUX_##bit2 | \ 64 + BCM6358_MODE_MUX_##bit3), \ 65 + } 66 + 67 + static const struct pinctrl_pin_desc bcm6358_pins[] = { 68 + BCM6358_GPIO_PIN(0, "gpio0", LED, NONE, NONE), 69 + BCM6358_GPIO_PIN(1, "gpio1", LED, NONE, NONE), 70 + BCM6358_GPIO_PIN(2, "gpio2", LED, NONE, NONE), 71 + BCM6358_GPIO_PIN(3, "gpio3", LED, NONE, NONE), 72 + PINCTRL_PIN(4, "gpio4"), 73 + BCM6358_GPIO_PIN(5, "gpio5", SYS_IRQ, NONE, NONE), 74 + BCM6358_GPIO_PIN(6, "gpio6", SERIAL_LED, NONE, NONE), 75 + BCM6358_GPIO_PIN(7, "gpio7", SERIAL_LED, NONE, NONE), 76 + BCM6358_GPIO_PIN(8, "gpio8", PWM_SYN_CLK, NONE, NONE), 77 + BCM6358_GPIO_PIN(9, "gpio09", LEGACY_LED, NONE, NONE), 78 + BCM6358_GPIO_PIN(10, "gpio10", LEGACY_LED, NONE, NONE), 79 + BCM6358_GPIO_PIN(11, "gpio11", LEGACY_LED, NONE, NONE), 80 + BCM6358_GPIO_PIN(12, "gpio12", LEGACY_LED, ASYNC_MODEM, UTOPIA), 81 + BCM6358_GPIO_PIN(13, "gpio13", LEGACY_LED, ASYNC_MODEM, UTOPIA), 82 + BCM6358_GPIO_PIN(14, "gpio14", LEGACY_LED, ASYNC_MODEM, UTOPIA), 83 + BCM6358_GPIO_PIN(15, "gpio15", LEGACY_LED, ASYNC_MODEM, UTOPIA), 84 + PINCTRL_PIN(16, "gpio16"), 85 + PINCTRL_PIN(17, "gpio17"), 86 + PINCTRL_PIN(18, "gpio18"), 87 + PINCTRL_PIN(19, "gpio19"), 88 + PINCTRL_PIN(20, "gpio20"), 89 + PINCTRL_PIN(21, "gpio21"), 90 + BCM6358_GPIO_PIN(22, "gpio22", UTOPIA, NONE, NONE), 91 + BCM6358_GPIO_PIN(23, "gpio23", UTOPIA, NONE, NONE), 92 + BCM6358_GPIO_PIN(24, "gpio24", UTOPIA, NONE, NONE), 93 + BCM6358_GPIO_PIN(25, "gpio25", UTOPIA, NONE, NONE), 94 + BCM6358_GPIO_PIN(26, "gpio26", UTOPIA, NONE, NONE), 95 + BCM6358_GPIO_PIN(27, "gpio27", UTOPIA, NONE, NONE), 96 + BCM6358_GPIO_PIN(28, "gpio28", UTOPIA, UART1, NONE), 97 + BCM6358_GPIO_PIN(29, "gpio29", UTOPIA, UART1, NONE), 98 + BCM6358_GPIO_PIN(30, "gpio30", UTOPIA, UART1, EBI_CS), 99 + BCM6358_GPIO_PIN(31, "gpio31", UTOPIA, UART1, EBI_CS), 100 + BCM6358_GPIO_PIN(32, "gpio32", SPI_CS, NONE, NONE), 101 + BCM6358_GPIO_PIN(33, "gpio33", SPI_CS, NONE, NONE), 102 + PINCTRL_PIN(34, "gpio34"), 103 + PINCTRL_PIN(35, "gpio35"), 104 + PINCTRL_PIN(36, "gpio36"), 105 + PINCTRL_PIN(37, "gpio37"), 106 + PINCTRL_PIN(38, "gpio38"), 107 + PINCTRL_PIN(39, "gpio39"), 108 + }; 109 + 110 + static unsigned ebi_cs_grp_pins[] = { 30, 31 }; 111 + 112 + static unsigned uart1_grp_pins[] = { 28, 29, 30, 31 }; 113 + 114 + static unsigned spi_cs_grp_pins[] = { 32, 33 }; 115 + 116 + static unsigned async_modem_grp_pins[] = { 12, 13, 14, 15 }; 117 + 118 + static unsigned serial_led_grp_pins[] = { 6, 7 }; 119 + 120 + static unsigned legacy_led_grp_pins[] = { 9, 10, 11, 12, 13, 14, 15 }; 121 + 122 + static unsigned led_grp_pins[] = { 0, 1, 2, 3 }; 123 + 124 + static unsigned utopia_grp_pins[] = { 125 + 12, 13, 14, 15, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 126 + }; 127 + 128 + static unsigned pwm_syn_clk_grp_pins[] = { 8 }; 129 + 130 + static unsigned sys_irq_grp_pins[] = { 5 }; 131 + 132 + #define BCM6358_GPIO_MUX_GROUP(n, bit, dir) \ 133 + { \ 134 + .name = #n, \ 135 + .pins = n##_pins, \ 136 + .num_pins = ARRAY_SIZE(n##_pins), \ 137 + .mode_val = BCM6358_MODE_MUX_##bit, \ 138 + .direction = dir, \ 139 + } 140 + 141 + static const struct bcm6358_pingroup bcm6358_groups[] = { 142 + BCM6358_GPIO_MUX_GROUP(ebi_cs_grp, EBI_CS, 0x3), 143 + BCM6358_GPIO_MUX_GROUP(uart1_grp, UART1, 0x2), 144 + BCM6358_GPIO_MUX_GROUP(spi_cs_grp, SPI_CS, 0x6), 145 + BCM6358_GPIO_MUX_GROUP(async_modem_grp, ASYNC_MODEM, 0x6), 146 + BCM6358_GPIO_MUX_GROUP(legacy_led_grp, LEGACY_LED, 0x7f), 147 + BCM6358_GPIO_MUX_GROUP(serial_led_grp, SERIAL_LED, 0x3), 148 + BCM6358_GPIO_MUX_GROUP(led_grp, LED, 0xf), 149 + BCM6358_GPIO_MUX_GROUP(utopia_grp, UTOPIA, 0x000f), 150 + BCM6358_GPIO_MUX_GROUP(pwm_syn_clk_grp, PWM_SYN_CLK, 0x1), 151 + BCM6358_GPIO_MUX_GROUP(sys_irq_grp, SYS_IRQ, 0x1), 152 + }; 153 + 154 + static const char * const ebi_cs_groups[] = { 155 + "ebi_cs_grp" 156 + }; 157 + 158 + static const char * const uart1_groups[] = { 159 + "uart1_grp" 160 + }; 161 + 162 + static const char * const spi_cs_2_3_groups[] = { 163 + "spi_cs_2_3_grp" 164 + }; 165 + 166 + static const char * const async_modem_groups[] = { 167 + "async_modem_grp" 168 + }; 169 + 170 + static const char * const legacy_led_groups[] = { 171 + "legacy_led_grp", 172 + }; 173 + 174 + static const char * const serial_led_groups[] = { 175 + "serial_led_grp", 176 + }; 177 + 178 + static const char * const led_groups[] = { 179 + "led_grp", 180 + }; 181 + 182 + static const char * const clkrst_groups[] = { 183 + "clkrst_grp", 184 + }; 185 + 186 + static const char * const pwm_syn_clk_groups[] = { 187 + "pwm_syn_clk_grp", 188 + }; 189 + 190 + static const char * const sys_irq_groups[] = { 191 + "sys_irq_grp", 192 + }; 193 + 194 + #define BCM6358_FUN(n) \ 195 + { \ 196 + .name = #n, \ 197 + .groups = n##_groups, \ 198 + .num_groups = ARRAY_SIZE(n##_groups), \ 199 + } 200 + 201 + static const struct bcm6358_function bcm6358_funcs[] = { 202 + BCM6358_FUN(ebi_cs), 203 + BCM6358_FUN(uart1), 204 + BCM6358_FUN(spi_cs_2_3), 205 + BCM6358_FUN(async_modem), 206 + BCM6358_FUN(legacy_led), 207 + BCM6358_FUN(serial_led), 208 + BCM6358_FUN(led), 209 + BCM6358_FUN(clkrst), 210 + BCM6358_FUN(pwm_syn_clk), 211 + BCM6358_FUN(sys_irq), 212 + }; 213 + 214 + static int bcm6358_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 215 + { 216 + return ARRAY_SIZE(bcm6358_groups); 217 + } 218 + 219 + static const char *bcm6358_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 220 + unsigned group) 221 + { 222 + return bcm6358_groups[group].name; 223 + } 224 + 225 + static int bcm6358_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 226 + unsigned group, const unsigned **pins, 227 + unsigned *num_pins) 228 + { 229 + *pins = bcm6358_groups[group].pins; 230 + *num_pins = bcm6358_groups[group].num_pins; 231 + 232 + return 0; 233 + } 234 + 235 + static int bcm6358_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 236 + { 237 + return ARRAY_SIZE(bcm6358_funcs); 238 + } 239 + 240 + static const char *bcm6358_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 241 + unsigned selector) 242 + { 243 + return bcm6358_funcs[selector].name; 244 + } 245 + 246 + static int bcm6358_pinctrl_get_groups(struct pinctrl_dev *pctldev, 247 + unsigned selector, 248 + const char * const **groups, 249 + unsigned * const num_groups) 250 + { 251 + *groups = bcm6358_funcs[selector].groups; 252 + *num_groups = bcm6358_funcs[selector].num_groups; 253 + 254 + return 0; 255 + } 256 + 257 + static int bcm6358_pinctrl_set_mux(struct pinctrl_dev *pctldev, 258 + unsigned selector, unsigned group) 259 + { 260 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 261 + struct bcm6358_priv *priv = pc->driver_data; 262 + const struct bcm6358_pingroup *pg = &bcm6358_groups[group]; 263 + unsigned int val = pg->mode_val; 264 + unsigned int mask = val; 265 + unsigned pin; 266 + 267 + for (pin = 0; pin < pg->num_pins; pin++) 268 + mask |= (unsigned long)bcm6358_pins[pin].drv_data; 269 + 270 + regmap_field_update_bits(priv->overlays, mask, val); 271 + 272 + for (pin = 0; pin < pg->num_pins; pin++) { 273 + struct pinctrl_gpio_range *range; 274 + unsigned int hw_gpio = bcm6358_pins[pin].number; 275 + 276 + range = pinctrl_find_gpio_range_from_pin(pctldev, hw_gpio); 277 + if (range) { 278 + struct gpio_chip *gc = range->gc; 279 + 280 + if (pg->direction & BIT(pin)) 281 + gc->direction_output(gc, hw_gpio, 0); 282 + else 283 + gc->direction_input(gc, hw_gpio); 284 + } 285 + } 286 + 287 + return 0; 288 + } 289 + 290 + static int bcm6358_gpio_request_enable(struct pinctrl_dev *pctldev, 291 + struct pinctrl_gpio_range *range, 292 + unsigned offset) 293 + { 294 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 295 + struct bcm6358_priv *priv = pc->driver_data; 296 + unsigned int mask; 297 + 298 + mask = (unsigned long) bcm6358_pins[offset].drv_data; 299 + if (!mask) 300 + return 0; 301 + 302 + /* disable all functions using this pin */ 303 + return regmap_field_update_bits(priv->overlays, mask, 0); 304 + } 305 + 306 + static struct pinctrl_ops bcm6358_pctl_ops = { 307 + .dt_free_map = pinctrl_utils_free_map, 308 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 309 + .get_group_name = bcm6358_pinctrl_get_group_name, 310 + .get_group_pins = bcm6358_pinctrl_get_group_pins, 311 + .get_groups_count = bcm6358_pinctrl_get_group_count, 312 + }; 313 + 314 + static struct pinmux_ops bcm6358_pmx_ops = { 315 + .get_function_groups = bcm6358_pinctrl_get_groups, 316 + .get_function_name = bcm6358_pinctrl_get_func_name, 317 + .get_functions_count = bcm6358_pinctrl_get_func_count, 318 + .gpio_request_enable = bcm6358_gpio_request_enable, 319 + .set_mux = bcm6358_pinctrl_set_mux, 320 + .strict = true, 321 + }; 322 + 323 + static const struct bcm63xx_pinctrl_soc bcm6358_soc = { 324 + .ngpios = BCM6358_NUM_GPIOS, 325 + .npins = ARRAY_SIZE(bcm6358_pins), 326 + .pctl_ops = &bcm6358_pctl_ops, 327 + .pins = bcm6358_pins, 328 + .pmx_ops = &bcm6358_pmx_ops, 329 + }; 330 + 331 + static int bcm6358_pinctrl_probe(struct platform_device *pdev) 332 + { 333 + struct reg_field overlays = REG_FIELD(BCM6358_MODE_REG, 0, 15); 334 + struct device *dev = &pdev->dev; 335 + struct bcm63xx_pinctrl *pc; 336 + struct bcm6358_priv *priv; 337 + int err; 338 + 339 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 340 + if (!priv) 341 + return -ENOMEM; 342 + 343 + err = bcm63xx_pinctrl_probe(pdev, &bcm6358_soc, (void *) priv); 344 + if (err) 345 + return err; 346 + 347 + pc = platform_get_drvdata(pdev); 348 + 349 + priv->overlays = devm_regmap_field_alloc(dev, pc->regs, overlays); 350 + if (IS_ERR(priv->overlays)) 351 + return PTR_ERR(priv->overlays); 352 + 353 + return 0; 354 + } 355 + 356 + static const struct of_device_id bcm6358_pinctrl_match[] = { 357 + { .compatible = "brcm,bcm6358-pinctrl", }, 358 + { /* sentinel */ } 359 + }; 360 + 361 + static struct platform_driver bcm6358_pinctrl_driver = { 362 + .probe = bcm6358_pinctrl_probe, 363 + .driver = { 364 + .name = "bcm6358-pinctrl", 365 + .of_match_table = bcm6358_pinctrl_match, 366 + }, 367 + }; 368 + 369 + builtin_platform_driver(bcm6358_pinctrl_driver);
+617
drivers/pinctrl/bcm/pinctrl-bcm6362.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM6362 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM6362_BANK_GPIOS 32 22 + #define BCM6362_NUM_GPIOS 48 23 + #define BCM6362_NUM_LEDS 24 24 + 25 + #define BCM6362_LED_REG 0x10 26 + #define BCM6362_MODE_REG 0x18 27 + #define BCM6362_CTRL_REG 0x1c 28 + #define BCM6362_BASEMODE_REG 0x38 29 + #define BASEMODE_NAND BIT(2) 30 + 31 + enum bcm6362_pinctrl_reg { 32 + BCM6362_LEDCTRL, 33 + BCM6362_MODE, 34 + BCM6362_CTRL, 35 + BCM6362_BASEMODE, 36 + }; 37 + 38 + struct bcm6362_pingroup { 39 + const char *name; 40 + const unsigned * const pins; 41 + const unsigned num_pins; 42 + }; 43 + 44 + struct bcm6362_function { 45 + const char *name; 46 + const char * const *groups; 47 + const unsigned num_groups; 48 + 49 + enum bcm6362_pinctrl_reg reg; 50 + uint32_t basemode_mask; 51 + }; 52 + 53 + #define BCM6362_PIN(a, b, mask) \ 54 + { \ 55 + .number = a, \ 56 + .name = b, \ 57 + .drv_data = (void *)(mask), \ 58 + } 59 + 60 + static const struct pinctrl_pin_desc bcm6362_pins[] = { 61 + PINCTRL_PIN(0, "gpio0"), 62 + PINCTRL_PIN(1, "gpio1"), 63 + PINCTRL_PIN(2, "gpio2"), 64 + PINCTRL_PIN(3, "gpio3"), 65 + PINCTRL_PIN(4, "gpio4"), 66 + PINCTRL_PIN(5, "gpio5"), 67 + PINCTRL_PIN(6, "gpio6"), 68 + PINCTRL_PIN(7, "gpio7"), 69 + BCM6362_PIN(8, "gpio8", BASEMODE_NAND), 70 + PINCTRL_PIN(9, "gpio9"), 71 + PINCTRL_PIN(10, "gpio10"), 72 + PINCTRL_PIN(11, "gpio11"), 73 + BCM6362_PIN(12, "gpio12", BASEMODE_NAND), 74 + BCM6362_PIN(13, "gpio13", BASEMODE_NAND), 75 + BCM6362_PIN(14, "gpio14", BASEMODE_NAND), 76 + BCM6362_PIN(15, "gpio15", BASEMODE_NAND), 77 + BCM6362_PIN(16, "gpio16", BASEMODE_NAND), 78 + BCM6362_PIN(17, "gpio17", BASEMODE_NAND), 79 + BCM6362_PIN(18, "gpio18", BASEMODE_NAND), 80 + BCM6362_PIN(19, "gpio19", BASEMODE_NAND), 81 + BCM6362_PIN(20, "gpio20", BASEMODE_NAND), 82 + BCM6362_PIN(21, "gpio21", BASEMODE_NAND), 83 + BCM6362_PIN(22, "gpio22", BASEMODE_NAND), 84 + BCM6362_PIN(23, "gpio23", BASEMODE_NAND), 85 + PINCTRL_PIN(24, "gpio24"), 86 + PINCTRL_PIN(25, "gpio25"), 87 + PINCTRL_PIN(26, "gpio26"), 88 + BCM6362_PIN(27, "gpio27", BASEMODE_NAND), 89 + PINCTRL_PIN(28, "gpio28"), 90 + PINCTRL_PIN(29, "gpio29"), 91 + PINCTRL_PIN(30, "gpio30"), 92 + PINCTRL_PIN(31, "gpio31"), 93 + PINCTRL_PIN(32, "gpio32"), 94 + PINCTRL_PIN(33, "gpio33"), 95 + PINCTRL_PIN(34, "gpio34"), 96 + PINCTRL_PIN(35, "gpio35"), 97 + PINCTRL_PIN(36, "gpio36"), 98 + PINCTRL_PIN(37, "gpio37"), 99 + PINCTRL_PIN(38, "gpio38"), 100 + PINCTRL_PIN(39, "gpio39"), 101 + PINCTRL_PIN(40, "gpio40"), 102 + PINCTRL_PIN(41, "gpio41"), 103 + PINCTRL_PIN(42, "gpio42"), 104 + PINCTRL_PIN(43, "gpio43"), 105 + PINCTRL_PIN(44, "gpio44"), 106 + PINCTRL_PIN(45, "gpio45"), 107 + PINCTRL_PIN(46, "gpio46"), 108 + PINCTRL_PIN(47, "gpio47"), 109 + }; 110 + 111 + static unsigned gpio0_pins[] = { 0 }; 112 + static unsigned gpio1_pins[] = { 1 }; 113 + static unsigned gpio2_pins[] = { 2 }; 114 + static unsigned gpio3_pins[] = { 3 }; 115 + static unsigned gpio4_pins[] = { 4 }; 116 + static unsigned gpio5_pins[] = { 5 }; 117 + static unsigned gpio6_pins[] = { 6 }; 118 + static unsigned gpio7_pins[] = { 7 }; 119 + static unsigned gpio8_pins[] = { 8 }; 120 + static unsigned gpio9_pins[] = { 9 }; 121 + static unsigned gpio10_pins[] = { 10 }; 122 + static unsigned gpio11_pins[] = { 11 }; 123 + static unsigned gpio12_pins[] = { 12 }; 124 + static unsigned gpio13_pins[] = { 13 }; 125 + static unsigned gpio14_pins[] = { 14 }; 126 + static unsigned gpio15_pins[] = { 15 }; 127 + static unsigned gpio16_pins[] = { 16 }; 128 + static unsigned gpio17_pins[] = { 17 }; 129 + static unsigned gpio18_pins[] = { 18 }; 130 + static unsigned gpio19_pins[] = { 19 }; 131 + static unsigned gpio20_pins[] = { 20 }; 132 + static unsigned gpio21_pins[] = { 21 }; 133 + static unsigned gpio22_pins[] = { 22 }; 134 + static unsigned gpio23_pins[] = { 23 }; 135 + static unsigned gpio24_pins[] = { 24 }; 136 + static unsigned gpio25_pins[] = { 25 }; 137 + static unsigned gpio26_pins[] = { 26 }; 138 + static unsigned gpio27_pins[] = { 27 }; 139 + static unsigned gpio28_pins[] = { 28 }; 140 + static unsigned gpio29_pins[] = { 29 }; 141 + static unsigned gpio30_pins[] = { 30 }; 142 + static unsigned gpio31_pins[] = { 31 }; 143 + static unsigned gpio32_pins[] = { 32 }; 144 + static unsigned gpio33_pins[] = { 33 }; 145 + static unsigned gpio34_pins[] = { 34 }; 146 + static unsigned gpio35_pins[] = { 35 }; 147 + static unsigned gpio36_pins[] = { 36 }; 148 + static unsigned gpio37_pins[] = { 37 }; 149 + static unsigned gpio38_pins[] = { 38 }; 150 + static unsigned gpio39_pins[] = { 39 }; 151 + static unsigned gpio40_pins[] = { 40 }; 152 + static unsigned gpio41_pins[] = { 41 }; 153 + static unsigned gpio42_pins[] = { 42 }; 154 + static unsigned gpio43_pins[] = { 43 }; 155 + static unsigned gpio44_pins[] = { 44 }; 156 + static unsigned gpio45_pins[] = { 45 }; 157 + static unsigned gpio46_pins[] = { 46 }; 158 + static unsigned gpio47_pins[] = { 47 }; 159 + 160 + static unsigned nand_grp_pins[] = { 161 + 8, 12, 13, 14, 15, 16, 17, 162 + 18, 19, 20, 21, 22, 23, 27, 163 + }; 164 + 165 + #define BCM6362_GROUP(n) \ 166 + { \ 167 + .name = #n, \ 168 + .pins = n##_pins, \ 169 + .num_pins = ARRAY_SIZE(n##_pins), \ 170 + } 171 + 172 + static struct bcm6362_pingroup bcm6362_groups[] = { 173 + BCM6362_GROUP(gpio0), 174 + BCM6362_GROUP(gpio1), 175 + BCM6362_GROUP(gpio2), 176 + BCM6362_GROUP(gpio3), 177 + BCM6362_GROUP(gpio4), 178 + BCM6362_GROUP(gpio5), 179 + BCM6362_GROUP(gpio6), 180 + BCM6362_GROUP(gpio7), 181 + BCM6362_GROUP(gpio8), 182 + BCM6362_GROUP(gpio9), 183 + BCM6362_GROUP(gpio10), 184 + BCM6362_GROUP(gpio11), 185 + BCM6362_GROUP(gpio12), 186 + BCM6362_GROUP(gpio13), 187 + BCM6362_GROUP(gpio14), 188 + BCM6362_GROUP(gpio15), 189 + BCM6362_GROUP(gpio16), 190 + BCM6362_GROUP(gpio17), 191 + BCM6362_GROUP(gpio18), 192 + BCM6362_GROUP(gpio19), 193 + BCM6362_GROUP(gpio20), 194 + BCM6362_GROUP(gpio21), 195 + BCM6362_GROUP(gpio22), 196 + BCM6362_GROUP(gpio23), 197 + BCM6362_GROUP(gpio24), 198 + BCM6362_GROUP(gpio25), 199 + BCM6362_GROUP(gpio26), 200 + BCM6362_GROUP(gpio27), 201 + BCM6362_GROUP(gpio28), 202 + BCM6362_GROUP(gpio29), 203 + BCM6362_GROUP(gpio30), 204 + BCM6362_GROUP(gpio31), 205 + BCM6362_GROUP(gpio32), 206 + BCM6362_GROUP(gpio33), 207 + BCM6362_GROUP(gpio34), 208 + BCM6362_GROUP(gpio35), 209 + BCM6362_GROUP(gpio36), 210 + BCM6362_GROUP(gpio37), 211 + BCM6362_GROUP(gpio38), 212 + BCM6362_GROUP(gpio39), 213 + BCM6362_GROUP(gpio40), 214 + BCM6362_GROUP(gpio41), 215 + BCM6362_GROUP(gpio42), 216 + BCM6362_GROUP(gpio43), 217 + BCM6362_GROUP(gpio44), 218 + BCM6362_GROUP(gpio45), 219 + BCM6362_GROUP(gpio46), 220 + BCM6362_GROUP(gpio47), 221 + BCM6362_GROUP(nand_grp), 222 + }; 223 + 224 + static const char * const led_groups[] = { 225 + "gpio0", 226 + "gpio1", 227 + "gpio2", 228 + "gpio3", 229 + "gpio4", 230 + "gpio5", 231 + "gpio6", 232 + "gpio7", 233 + "gpio8", 234 + "gpio9", 235 + "gpio10", 236 + "gpio11", 237 + "gpio12", 238 + "gpio13", 239 + "gpio14", 240 + "gpio15", 241 + "gpio16", 242 + "gpio17", 243 + "gpio18", 244 + "gpio19", 245 + "gpio20", 246 + "gpio21", 247 + "gpio22", 248 + "gpio23", 249 + }; 250 + 251 + static const char * const usb_device_led_groups[] = { 252 + "gpio0", 253 + }; 254 + 255 + static const char * const sys_irq_groups[] = { 256 + "gpio1", 257 + }; 258 + 259 + static const char * const serial_led_clk_groups[] = { 260 + "gpio2", 261 + }; 262 + 263 + static const char * const serial_led_data_groups[] = { 264 + "gpio3", 265 + }; 266 + 267 + static const char * const robosw_led_data_groups[] = { 268 + "gpio4", 269 + }; 270 + 271 + static const char * const robosw_led_clk_groups[] = { 272 + "gpio5", 273 + }; 274 + 275 + static const char * const robosw_led0_groups[] = { 276 + "gpio6", 277 + }; 278 + 279 + static const char * const robosw_led1_groups[] = { 280 + "gpio7", 281 + }; 282 + 283 + static const char * const inet_led_groups[] = { 284 + "gpio8", 285 + }; 286 + 287 + static const char * const spi_cs2_groups[] = { 288 + "gpio9", 289 + }; 290 + 291 + static const char * const spi_cs3_groups[] = { 292 + "gpio10", 293 + }; 294 + 295 + static const char * const ntr_pulse_groups[] = { 296 + "gpio11", 297 + }; 298 + 299 + static const char * const uart1_scts_groups[] = { 300 + "gpio12", 301 + }; 302 + 303 + static const char * const uart1_srts_groups[] = { 304 + "gpio13", 305 + }; 306 + 307 + static const char * const uart1_sdin_groups[] = { 308 + "gpio14", 309 + }; 310 + 311 + static const char * const uart1_sdout_groups[] = { 312 + "gpio15", 313 + }; 314 + 315 + static const char * const adsl_spi_miso_groups[] = { 316 + "gpio16", 317 + }; 318 + 319 + static const char * const adsl_spi_mosi_groups[] = { 320 + "gpio17", 321 + }; 322 + 323 + static const char * const adsl_spi_clk_groups[] = { 324 + "gpio18", 325 + }; 326 + 327 + static const char * const adsl_spi_cs_groups[] = { 328 + "gpio19", 329 + }; 330 + 331 + static const char * const ephy0_led_groups[] = { 332 + "gpio20", 333 + }; 334 + 335 + static const char * const ephy1_led_groups[] = { 336 + "gpio21", 337 + }; 338 + 339 + static const char * const ephy2_led_groups[] = { 340 + "gpio22", 341 + }; 342 + 343 + static const char * const ephy3_led_groups[] = { 344 + "gpio23", 345 + }; 346 + 347 + static const char * const ext_irq0_groups[] = { 348 + "gpio24", 349 + }; 350 + 351 + static const char * const ext_irq1_groups[] = { 352 + "gpio25", 353 + }; 354 + 355 + static const char * const ext_irq2_groups[] = { 356 + "gpio26", 357 + }; 358 + 359 + static const char * const ext_irq3_groups[] = { 360 + "gpio27", 361 + }; 362 + 363 + static const char * const wifi_groups[] = { 364 + "gpio32", 365 + "gpio33", 366 + "gpio34", 367 + "gpio35", 368 + "gpio36", 369 + "gpio37", 370 + "gpio38", 371 + "gpio39", 372 + "gpio40", 373 + "gpio41", 374 + "gpio42", 375 + "gpio43", 376 + "gpio44", 377 + "gpio45", 378 + "gpio46", 379 + "gpio47", 380 + }; 381 + 382 + static const char * const nand_groups[] = { 383 + "nand_grp", 384 + }; 385 + 386 + #define BCM6362_LED_FUN(n) \ 387 + { \ 388 + .name = #n, \ 389 + .groups = n##_groups, \ 390 + .num_groups = ARRAY_SIZE(n##_groups), \ 391 + .reg = BCM6362_LEDCTRL, \ 392 + } 393 + 394 + #define BCM6362_MODE_FUN(n) \ 395 + { \ 396 + .name = #n, \ 397 + .groups = n##_groups, \ 398 + .num_groups = ARRAY_SIZE(n##_groups), \ 399 + .reg = BCM6362_MODE, \ 400 + } 401 + 402 + #define BCM6362_CTRL_FUN(n) \ 403 + { \ 404 + .name = #n, \ 405 + .groups = n##_groups, \ 406 + .num_groups = ARRAY_SIZE(n##_groups), \ 407 + .reg = BCM6362_CTRL, \ 408 + } 409 + 410 + #define BCM6362_BASEMODE_FUN(n, mask) \ 411 + { \ 412 + .name = #n, \ 413 + .groups = n##_groups, \ 414 + .num_groups = ARRAY_SIZE(n##_groups), \ 415 + .reg = BCM6362_BASEMODE, \ 416 + .basemode_mask = (mask), \ 417 + } 418 + 419 + static const struct bcm6362_function bcm6362_funcs[] = { 420 + BCM6362_LED_FUN(led), 421 + BCM6362_MODE_FUN(usb_device_led), 422 + BCM6362_MODE_FUN(sys_irq), 423 + BCM6362_MODE_FUN(serial_led_clk), 424 + BCM6362_MODE_FUN(serial_led_data), 425 + BCM6362_MODE_FUN(robosw_led_data), 426 + BCM6362_MODE_FUN(robosw_led_clk), 427 + BCM6362_MODE_FUN(robosw_led0), 428 + BCM6362_MODE_FUN(robosw_led1), 429 + BCM6362_MODE_FUN(inet_led), 430 + BCM6362_MODE_FUN(spi_cs2), 431 + BCM6362_MODE_FUN(spi_cs3), 432 + BCM6362_MODE_FUN(ntr_pulse), 433 + BCM6362_MODE_FUN(uart1_scts), 434 + BCM6362_MODE_FUN(uart1_srts), 435 + BCM6362_MODE_FUN(uart1_sdin), 436 + BCM6362_MODE_FUN(uart1_sdout), 437 + BCM6362_MODE_FUN(adsl_spi_miso), 438 + BCM6362_MODE_FUN(adsl_spi_mosi), 439 + BCM6362_MODE_FUN(adsl_spi_clk), 440 + BCM6362_MODE_FUN(adsl_spi_cs), 441 + BCM6362_MODE_FUN(ephy0_led), 442 + BCM6362_MODE_FUN(ephy1_led), 443 + BCM6362_MODE_FUN(ephy2_led), 444 + BCM6362_MODE_FUN(ephy3_led), 445 + BCM6362_MODE_FUN(ext_irq0), 446 + BCM6362_MODE_FUN(ext_irq1), 447 + BCM6362_MODE_FUN(ext_irq2), 448 + BCM6362_MODE_FUN(ext_irq3), 449 + BCM6362_CTRL_FUN(wifi), 450 + BCM6362_BASEMODE_FUN(nand, BASEMODE_NAND), 451 + }; 452 + 453 + static int bcm6362_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 454 + { 455 + return ARRAY_SIZE(bcm6362_groups); 456 + } 457 + 458 + static const char *bcm6362_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 459 + unsigned group) 460 + { 461 + return bcm6362_groups[group].name; 462 + } 463 + 464 + static int bcm6362_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 465 + unsigned group, const unsigned **pins, 466 + unsigned *num_pins) 467 + { 468 + *pins = bcm6362_groups[group].pins; 469 + *num_pins = bcm6362_groups[group].num_pins; 470 + 471 + return 0; 472 + } 473 + 474 + static int bcm6362_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 475 + { 476 + return ARRAY_SIZE(bcm6362_funcs); 477 + } 478 + 479 + static const char *bcm6362_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 480 + unsigned selector) 481 + { 482 + return bcm6362_funcs[selector].name; 483 + } 484 + 485 + static int bcm6362_pinctrl_get_groups(struct pinctrl_dev *pctldev, 486 + unsigned selector, 487 + const char * const **groups, 488 + unsigned * const num_groups) 489 + { 490 + *groups = bcm6362_funcs[selector].groups; 491 + *num_groups = bcm6362_funcs[selector].num_groups; 492 + 493 + return 0; 494 + } 495 + 496 + static void bcm6362_set_gpio(struct bcm63xx_pinctrl *pc, unsigned pin) 497 + { 498 + const struct pinctrl_pin_desc *desc = &bcm6362_pins[pin]; 499 + unsigned int mask = bcm63xx_bank_pin(pin); 500 + 501 + if (desc->drv_data) 502 + regmap_update_bits(pc->regs, BCM6362_BASEMODE_REG, 503 + (uint32_t) desc->drv_data, 0); 504 + 505 + if (pin < BCM63XX_BANK_GPIOS) { 506 + /* base mode 0 => gpio 1 => mux function */ 507 + regmap_update_bits(pc->regs, BCM6362_MODE_REG, mask, 0); 508 + 509 + /* pins 0-23 might be muxed to led */ 510 + if (pin < BCM6362_NUM_LEDS) 511 + regmap_update_bits(pc->regs, BCM6362_LED_REG, mask, 0); 512 + } else { 513 + /* ctrl reg 0 => wifi function 1 => gpio */ 514 + regmap_update_bits(pc->regs, BCM6362_CTRL_REG, mask, mask); 515 + } 516 + } 517 + 518 + static int bcm6362_pinctrl_set_mux(struct pinctrl_dev *pctldev, 519 + unsigned selector, unsigned group) 520 + { 521 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 522 + const struct bcm6362_pingroup *pg = &bcm6362_groups[group]; 523 + const struct bcm6362_function *f = &bcm6362_funcs[selector]; 524 + unsigned i; 525 + unsigned int reg; 526 + unsigned int val, mask; 527 + 528 + for (i = 0; i < pg->num_pins; i++) 529 + bcm6362_set_gpio(pc, pg->pins[i]); 530 + 531 + switch (f->reg) { 532 + case BCM6362_LEDCTRL: 533 + reg = BCM6362_LED_REG; 534 + mask = BIT(pg->pins[0]); 535 + val = BIT(pg->pins[0]); 536 + break; 537 + case BCM6362_MODE: 538 + reg = BCM6362_MODE_REG; 539 + mask = BIT(pg->pins[0]); 540 + val = BIT(pg->pins[0]); 541 + break; 542 + case BCM6362_CTRL: 543 + reg = BCM6362_CTRL_REG; 544 + mask = BIT(pg->pins[0]); 545 + val = 0; 546 + break; 547 + case BCM6362_BASEMODE: 548 + reg = BCM6362_BASEMODE_REG; 549 + mask = f->basemode_mask; 550 + val = f->basemode_mask; 551 + break; 552 + default: 553 + WARN_ON(1); 554 + return -EINVAL; 555 + } 556 + 557 + regmap_update_bits(pc->regs, reg, mask, val); 558 + 559 + return 0; 560 + } 561 + 562 + static int bcm6362_gpio_request_enable(struct pinctrl_dev *pctldev, 563 + struct pinctrl_gpio_range *range, 564 + unsigned offset) 565 + { 566 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 567 + 568 + /* disable all functions using this pin */ 569 + bcm6362_set_gpio(pc, offset); 570 + 571 + return 0; 572 + } 573 + 574 + static struct pinctrl_ops bcm6362_pctl_ops = { 575 + .dt_free_map = pinctrl_utils_free_map, 576 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 577 + .get_group_name = bcm6362_pinctrl_get_group_name, 578 + .get_group_pins = bcm6362_pinctrl_get_group_pins, 579 + .get_groups_count = bcm6362_pinctrl_get_group_count, 580 + }; 581 + 582 + static struct pinmux_ops bcm6362_pmx_ops = { 583 + .get_function_groups = bcm6362_pinctrl_get_groups, 584 + .get_function_name = bcm6362_pinctrl_get_func_name, 585 + .get_functions_count = bcm6362_pinctrl_get_func_count, 586 + .gpio_request_enable = bcm6362_gpio_request_enable, 587 + .set_mux = bcm6362_pinctrl_set_mux, 588 + .strict = true, 589 + }; 590 + 591 + static const struct bcm63xx_pinctrl_soc bcm6362_soc = { 592 + .ngpios = BCM6362_NUM_GPIOS, 593 + .npins = ARRAY_SIZE(bcm6362_pins), 594 + .pctl_ops = &bcm6362_pctl_ops, 595 + .pins = bcm6362_pins, 596 + .pmx_ops = &bcm6362_pmx_ops, 597 + }; 598 + 599 + static int bcm6362_pinctrl_probe(struct platform_device *pdev) 600 + { 601 + return bcm63xx_pinctrl_probe(pdev, &bcm6362_soc, NULL); 602 + } 603 + 604 + static const struct of_device_id bcm6362_pinctrl_match[] = { 605 + { .compatible = "brcm,bcm6362-pinctrl", }, 606 + { /* sentinel */ } 607 + }; 608 + 609 + static struct platform_driver bcm6362_pinctrl_driver = { 610 + .probe = bcm6362_pinctrl_probe, 611 + .driver = { 612 + .name = "bcm6362-pinctrl", 613 + .of_match_table = bcm6362_pinctrl_match, 614 + }, 615 + }; 616 + 617 + builtin_platform_driver(bcm6362_pinctrl_driver);
+523
drivers/pinctrl/bcm/pinctrl-bcm6368.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM6368 GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/gpio/driver.h> 11 + #include <linux/kernel.h> 12 + #include <linux/of.h> 13 + #include <linux/pinctrl/pinmux.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + 17 + #include "../pinctrl-utils.h" 18 + 19 + #include "pinctrl-bcm63xx.h" 20 + 21 + #define BCM6368_NUM_GPIOS 38 22 + 23 + #define BCM6368_MODE_REG 0x18 24 + #define BCM6368_BASEMODE_REG 0x38 25 + #define BCM6368_BASEMODE_MASK 0x7 26 + #define BCM6368_BASEMODE_GPIO 0x0 27 + #define BCM6368_BASEMODE_UART1 0x1 28 + 29 + struct bcm6368_pingroup { 30 + const char *name; 31 + const unsigned * const pins; 32 + const unsigned num_pins; 33 + }; 34 + 35 + struct bcm6368_function { 36 + const char *name; 37 + const char * const *groups; 38 + const unsigned num_groups; 39 + 40 + unsigned dir_out:16; 41 + unsigned basemode:3; 42 + }; 43 + 44 + struct bcm6368_priv { 45 + struct regmap_field *overlays; 46 + }; 47 + 48 + #define BCM6368_BASEMODE_PIN(a, b) \ 49 + { \ 50 + .number = a, \ 51 + .name = b, \ 52 + .drv_data = (void *)true \ 53 + } 54 + 55 + static const struct pinctrl_pin_desc bcm6368_pins[] = { 56 + PINCTRL_PIN(0, "gpio0"), 57 + PINCTRL_PIN(1, "gpio1"), 58 + PINCTRL_PIN(2, "gpio2"), 59 + PINCTRL_PIN(3, "gpio3"), 60 + PINCTRL_PIN(4, "gpio4"), 61 + PINCTRL_PIN(5, "gpio5"), 62 + PINCTRL_PIN(6, "gpio6"), 63 + PINCTRL_PIN(7, "gpio7"), 64 + PINCTRL_PIN(8, "gpio8"), 65 + PINCTRL_PIN(9, "gpio9"), 66 + PINCTRL_PIN(10, "gpio10"), 67 + PINCTRL_PIN(11, "gpio11"), 68 + PINCTRL_PIN(12, "gpio12"), 69 + PINCTRL_PIN(13, "gpio13"), 70 + PINCTRL_PIN(14, "gpio14"), 71 + PINCTRL_PIN(15, "gpio15"), 72 + PINCTRL_PIN(16, "gpio16"), 73 + PINCTRL_PIN(17, "gpio17"), 74 + PINCTRL_PIN(18, "gpio18"), 75 + PINCTRL_PIN(19, "gpio19"), 76 + PINCTRL_PIN(20, "gpio20"), 77 + PINCTRL_PIN(21, "gpio21"), 78 + PINCTRL_PIN(22, "gpio22"), 79 + PINCTRL_PIN(23, "gpio23"), 80 + PINCTRL_PIN(24, "gpio24"), 81 + PINCTRL_PIN(25, "gpio25"), 82 + PINCTRL_PIN(26, "gpio26"), 83 + PINCTRL_PIN(27, "gpio27"), 84 + PINCTRL_PIN(28, "gpio28"), 85 + PINCTRL_PIN(29, "gpio29"), 86 + BCM6368_BASEMODE_PIN(30, "gpio30"), 87 + BCM6368_BASEMODE_PIN(31, "gpio31"), 88 + BCM6368_BASEMODE_PIN(32, "gpio32"), 89 + BCM6368_BASEMODE_PIN(33, "gpio33"), 90 + PINCTRL_PIN(34, "gpio34"), 91 + PINCTRL_PIN(35, "gpio35"), 92 + PINCTRL_PIN(36, "gpio36"), 93 + PINCTRL_PIN(37, "gpio37"), 94 + }; 95 + 96 + static unsigned gpio0_pins[] = { 0 }; 97 + static unsigned gpio1_pins[] = { 1 }; 98 + static unsigned gpio2_pins[] = { 2 }; 99 + static unsigned gpio3_pins[] = { 3 }; 100 + static unsigned gpio4_pins[] = { 4 }; 101 + static unsigned gpio5_pins[] = { 5 }; 102 + static unsigned gpio6_pins[] = { 6 }; 103 + static unsigned gpio7_pins[] = { 7 }; 104 + static unsigned gpio8_pins[] = { 8 }; 105 + static unsigned gpio9_pins[] = { 9 }; 106 + static unsigned gpio10_pins[] = { 10 }; 107 + static unsigned gpio11_pins[] = { 11 }; 108 + static unsigned gpio12_pins[] = { 12 }; 109 + static unsigned gpio13_pins[] = { 13 }; 110 + static unsigned gpio14_pins[] = { 14 }; 111 + static unsigned gpio15_pins[] = { 15 }; 112 + static unsigned gpio16_pins[] = { 16 }; 113 + static unsigned gpio17_pins[] = { 17 }; 114 + static unsigned gpio18_pins[] = { 18 }; 115 + static unsigned gpio19_pins[] = { 19 }; 116 + static unsigned gpio20_pins[] = { 20 }; 117 + static unsigned gpio21_pins[] = { 21 }; 118 + static unsigned gpio22_pins[] = { 22 }; 119 + static unsigned gpio23_pins[] = { 23 }; 120 + static unsigned gpio24_pins[] = { 24 }; 121 + static unsigned gpio25_pins[] = { 25 }; 122 + static unsigned gpio26_pins[] = { 26 }; 123 + static unsigned gpio27_pins[] = { 27 }; 124 + static unsigned gpio28_pins[] = { 28 }; 125 + static unsigned gpio29_pins[] = { 29 }; 126 + static unsigned gpio30_pins[] = { 30 }; 127 + static unsigned gpio31_pins[] = { 31 }; 128 + static unsigned uart1_grp_pins[] = { 30, 31, 32, 33 }; 129 + 130 + #define BCM6368_GROUP(n) \ 131 + { \ 132 + .name = #n, \ 133 + .pins = n##_pins, \ 134 + .num_pins = ARRAY_SIZE(n##_pins), \ 135 + } 136 + 137 + static struct bcm6368_pingroup bcm6368_groups[] = { 138 + BCM6368_GROUP(gpio0), 139 + BCM6368_GROUP(gpio1), 140 + BCM6368_GROUP(gpio2), 141 + BCM6368_GROUP(gpio3), 142 + BCM6368_GROUP(gpio4), 143 + BCM6368_GROUP(gpio5), 144 + BCM6368_GROUP(gpio6), 145 + BCM6368_GROUP(gpio7), 146 + BCM6368_GROUP(gpio8), 147 + BCM6368_GROUP(gpio9), 148 + BCM6368_GROUP(gpio10), 149 + BCM6368_GROUP(gpio11), 150 + BCM6368_GROUP(gpio12), 151 + BCM6368_GROUP(gpio13), 152 + BCM6368_GROUP(gpio14), 153 + BCM6368_GROUP(gpio15), 154 + BCM6368_GROUP(gpio16), 155 + BCM6368_GROUP(gpio17), 156 + BCM6368_GROUP(gpio18), 157 + BCM6368_GROUP(gpio19), 158 + BCM6368_GROUP(gpio20), 159 + BCM6368_GROUP(gpio21), 160 + BCM6368_GROUP(gpio22), 161 + BCM6368_GROUP(gpio23), 162 + BCM6368_GROUP(gpio24), 163 + BCM6368_GROUP(gpio25), 164 + BCM6368_GROUP(gpio26), 165 + BCM6368_GROUP(gpio27), 166 + BCM6368_GROUP(gpio28), 167 + BCM6368_GROUP(gpio29), 168 + BCM6368_GROUP(gpio30), 169 + BCM6368_GROUP(gpio31), 170 + BCM6368_GROUP(uart1_grp), 171 + }; 172 + 173 + static const char * const analog_afe_0_groups[] = { 174 + "gpio0", 175 + }; 176 + 177 + static const char * const analog_afe_1_groups[] = { 178 + "gpio1", 179 + }; 180 + 181 + static const char * const sys_irq_groups[] = { 182 + "gpio2", 183 + }; 184 + 185 + static const char * const serial_led_data_groups[] = { 186 + "gpio3", 187 + }; 188 + 189 + static const char * const serial_led_clk_groups[] = { 190 + "gpio4", 191 + }; 192 + 193 + static const char * const inet_led_groups[] = { 194 + "gpio5", 195 + }; 196 + 197 + static const char * const ephy0_led_groups[] = { 198 + "gpio6", 199 + }; 200 + 201 + static const char * const ephy1_led_groups[] = { 202 + "gpio7", 203 + }; 204 + 205 + static const char * const ephy2_led_groups[] = { 206 + "gpio8", 207 + }; 208 + 209 + static const char * const ephy3_led_groups[] = { 210 + "gpio9", 211 + }; 212 + 213 + static const char * const robosw_led_data_groups[] = { 214 + "gpio10", 215 + }; 216 + 217 + static const char * const robosw_led_clk_groups[] = { 218 + "gpio11", 219 + }; 220 + 221 + static const char * const robosw_led0_groups[] = { 222 + "gpio12", 223 + }; 224 + 225 + static const char * const robosw_led1_groups[] = { 226 + "gpio13", 227 + }; 228 + 229 + static const char * const usb_device_led_groups[] = { 230 + "gpio14", 231 + }; 232 + 233 + static const char * const pci_req1_groups[] = { 234 + "gpio16", 235 + }; 236 + 237 + static const char * const pci_gnt1_groups[] = { 238 + "gpio17", 239 + }; 240 + 241 + static const char * const pci_intb_groups[] = { 242 + "gpio18", 243 + }; 244 + 245 + static const char * const pci_req0_groups[] = { 246 + "gpio19", 247 + }; 248 + 249 + static const char * const pci_gnt0_groups[] = { 250 + "gpio20", 251 + }; 252 + 253 + static const char * const pcmcia_cd1_groups[] = { 254 + "gpio22", 255 + }; 256 + 257 + static const char * const pcmcia_cd2_groups[] = { 258 + "gpio23", 259 + }; 260 + 261 + static const char * const pcmcia_vs1_groups[] = { 262 + "gpio24", 263 + }; 264 + 265 + static const char * const pcmcia_vs2_groups[] = { 266 + "gpio25", 267 + }; 268 + 269 + static const char * const ebi_cs2_groups[] = { 270 + "gpio26", 271 + }; 272 + 273 + static const char * const ebi_cs3_groups[] = { 274 + "gpio27", 275 + }; 276 + 277 + static const char * const spi_cs2_groups[] = { 278 + "gpio28", 279 + }; 280 + 281 + static const char * const spi_cs3_groups[] = { 282 + "gpio29", 283 + }; 284 + 285 + static const char * const spi_cs4_groups[] = { 286 + "gpio30", 287 + }; 288 + 289 + static const char * const spi_cs5_groups[] = { 290 + "gpio31", 291 + }; 292 + 293 + static const char * const uart1_groups[] = { 294 + "uart1_grp", 295 + }; 296 + 297 + #define BCM6368_FUN(n, out) \ 298 + { \ 299 + .name = #n, \ 300 + .groups = n##_groups, \ 301 + .num_groups = ARRAY_SIZE(n##_groups), \ 302 + .dir_out = out, \ 303 + } 304 + 305 + #define BCM6368_BASEMODE_FUN(n, val, out) \ 306 + { \ 307 + .name = #n, \ 308 + .groups = n##_groups, \ 309 + .num_groups = ARRAY_SIZE(n##_groups), \ 310 + .basemode = BCM6368_BASEMODE_##val, \ 311 + .dir_out = out, \ 312 + } 313 + 314 + static const struct bcm6368_function bcm6368_funcs[] = { 315 + BCM6368_FUN(analog_afe_0, 1), 316 + BCM6368_FUN(analog_afe_1, 1), 317 + BCM6368_FUN(sys_irq, 1), 318 + BCM6368_FUN(serial_led_data, 1), 319 + BCM6368_FUN(serial_led_clk, 1), 320 + BCM6368_FUN(inet_led, 1), 321 + BCM6368_FUN(ephy0_led, 1), 322 + BCM6368_FUN(ephy1_led, 1), 323 + BCM6368_FUN(ephy2_led, 1), 324 + BCM6368_FUN(ephy3_led, 1), 325 + BCM6368_FUN(robosw_led_data, 1), 326 + BCM6368_FUN(robosw_led_clk, 1), 327 + BCM6368_FUN(robosw_led0, 1), 328 + BCM6368_FUN(robosw_led1, 1), 329 + BCM6368_FUN(usb_device_led, 1), 330 + BCM6368_FUN(pci_req1, 0), 331 + BCM6368_FUN(pci_gnt1, 0), 332 + BCM6368_FUN(pci_intb, 0), 333 + BCM6368_FUN(pci_req0, 0), 334 + BCM6368_FUN(pci_gnt0, 0), 335 + BCM6368_FUN(pcmcia_cd1, 0), 336 + BCM6368_FUN(pcmcia_cd2, 0), 337 + BCM6368_FUN(pcmcia_vs1, 0), 338 + BCM6368_FUN(pcmcia_vs2, 0), 339 + BCM6368_FUN(ebi_cs2, 1), 340 + BCM6368_FUN(ebi_cs3, 1), 341 + BCM6368_FUN(spi_cs2, 1), 342 + BCM6368_FUN(spi_cs3, 1), 343 + BCM6368_FUN(spi_cs4, 1), 344 + BCM6368_FUN(spi_cs5, 1), 345 + BCM6368_BASEMODE_FUN(uart1, UART1, 0x6), 346 + }; 347 + 348 + static int bcm6368_pinctrl_get_group_count(struct pinctrl_dev *pctldev) 349 + { 350 + return ARRAY_SIZE(bcm6368_groups); 351 + } 352 + 353 + static const char *bcm6368_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 354 + unsigned group) 355 + { 356 + return bcm6368_groups[group].name; 357 + } 358 + 359 + static int bcm6368_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 360 + unsigned group, const unsigned **pins, 361 + unsigned *num_pins) 362 + { 363 + *pins = bcm6368_groups[group].pins; 364 + *num_pins = bcm6368_groups[group].num_pins; 365 + 366 + return 0; 367 + } 368 + 369 + static int bcm6368_pinctrl_get_func_count(struct pinctrl_dev *pctldev) 370 + { 371 + return ARRAY_SIZE(bcm6368_funcs); 372 + } 373 + 374 + static const char *bcm6368_pinctrl_get_func_name(struct pinctrl_dev *pctldev, 375 + unsigned selector) 376 + { 377 + return bcm6368_funcs[selector].name; 378 + } 379 + 380 + static int bcm6368_pinctrl_get_groups(struct pinctrl_dev *pctldev, 381 + unsigned selector, 382 + const char * const **groups, 383 + unsigned * const num_groups) 384 + { 385 + *groups = bcm6368_funcs[selector].groups; 386 + *num_groups = bcm6368_funcs[selector].num_groups; 387 + 388 + return 0; 389 + } 390 + 391 + static int bcm6368_pinctrl_set_mux(struct pinctrl_dev *pctldev, 392 + unsigned selector, unsigned group) 393 + { 394 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 395 + struct bcm6368_priv *priv = pc->driver_data; 396 + const struct bcm6368_pingroup *pg = &bcm6368_groups[group]; 397 + const struct bcm6368_function *fun = &bcm6368_funcs[selector]; 398 + int i, pin; 399 + 400 + if (fun->basemode) { 401 + unsigned int mask = 0; 402 + 403 + for (i = 0; i < pg->num_pins; i++) { 404 + pin = pg->pins[i]; 405 + if (pin < BCM63XX_BANK_GPIOS) 406 + mask |= BIT(pin); 407 + } 408 + 409 + regmap_update_bits(pc->regs, BCM6368_MODE_REG, mask, 0); 410 + regmap_field_write(priv->overlays, fun->basemode); 411 + } else { 412 + pin = pg->pins[0]; 413 + 414 + if (bcm6368_pins[pin].drv_data) 415 + regmap_field_write(priv->overlays, 416 + BCM6368_BASEMODE_GPIO); 417 + 418 + regmap_update_bits(pc->regs, BCM6368_MODE_REG, BIT(pin), 419 + BIT(pin)); 420 + } 421 + 422 + for (pin = 0; pin < pg->num_pins; pin++) { 423 + struct pinctrl_gpio_range *range; 424 + int hw_gpio = bcm6368_pins[pin].number; 425 + 426 + range = pinctrl_find_gpio_range_from_pin(pctldev, hw_gpio); 427 + if (range) { 428 + struct gpio_chip *gc = range->gc; 429 + 430 + if (fun->dir_out & BIT(pin)) 431 + gc->direction_output(gc, hw_gpio, 0); 432 + else 433 + gc->direction_input(gc, hw_gpio); 434 + } 435 + } 436 + 437 + return 0; 438 + } 439 + 440 + static int bcm6368_gpio_request_enable(struct pinctrl_dev *pctldev, 441 + struct pinctrl_gpio_range *range, 442 + unsigned offset) 443 + { 444 + struct bcm63xx_pinctrl *pc = pinctrl_dev_get_drvdata(pctldev); 445 + struct bcm6368_priv *priv = pc->driver_data; 446 + 447 + if (offset >= BCM63XX_BANK_GPIOS && !bcm6368_pins[offset].drv_data) 448 + return 0; 449 + 450 + /* disable all functions using this pin */ 451 + if (offset < BCM63XX_BANK_GPIOS) 452 + regmap_update_bits(pc->regs, BCM6368_MODE_REG, BIT(offset), 0); 453 + 454 + if (bcm6368_pins[offset].drv_data) 455 + regmap_field_write(priv->overlays, BCM6368_BASEMODE_GPIO); 456 + 457 + return 0; 458 + } 459 + 460 + static struct pinctrl_ops bcm6368_pctl_ops = { 461 + .dt_free_map = pinctrl_utils_free_map, 462 + .dt_node_to_map = pinconf_generic_dt_node_to_map_pin, 463 + .get_group_name = bcm6368_pinctrl_get_group_name, 464 + .get_group_pins = bcm6368_pinctrl_get_group_pins, 465 + .get_groups_count = bcm6368_pinctrl_get_group_count, 466 + }; 467 + 468 + static struct pinmux_ops bcm6368_pmx_ops = { 469 + .get_function_groups = bcm6368_pinctrl_get_groups, 470 + .get_function_name = bcm6368_pinctrl_get_func_name, 471 + .get_functions_count = bcm6368_pinctrl_get_func_count, 472 + .gpio_request_enable = bcm6368_gpio_request_enable, 473 + .set_mux = bcm6368_pinctrl_set_mux, 474 + .strict = true, 475 + }; 476 + 477 + static const struct bcm63xx_pinctrl_soc bcm6368_soc = { 478 + .ngpios = BCM6368_NUM_GPIOS, 479 + .npins = ARRAY_SIZE(bcm6368_pins), 480 + .pctl_ops = &bcm6368_pctl_ops, 481 + .pins = bcm6368_pins, 482 + .pmx_ops = &bcm6368_pmx_ops, 483 + }; 484 + 485 + static int bcm6368_pinctrl_probe(struct platform_device *pdev) 486 + { 487 + struct reg_field overlays = REG_FIELD(BCM6368_BASEMODE_REG, 0, 15); 488 + struct device *dev = &pdev->dev; 489 + struct bcm63xx_pinctrl *pc; 490 + struct bcm6368_priv *priv; 491 + int err; 492 + 493 + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); 494 + if (!priv) 495 + return -ENOMEM; 496 + 497 + err = bcm63xx_pinctrl_probe(pdev, &bcm6368_soc, (void *) priv); 498 + if (err) 499 + return err; 500 + 501 + pc = platform_get_drvdata(pdev); 502 + 503 + priv->overlays = devm_regmap_field_alloc(dev, pc->regs, overlays); 504 + if (IS_ERR(priv->overlays)) 505 + return PTR_ERR(priv->overlays); 506 + 507 + return 0; 508 + } 509 + 510 + static const struct of_device_id bcm6368_pinctrl_match[] = { 511 + { .compatible = "brcm,bcm6368-pinctrl", }, 512 + { /* sentinel */ } 513 + }; 514 + 515 + static struct platform_driver bcm6368_pinctrl_driver = { 516 + .probe = bcm6368_pinctrl_probe, 517 + .driver = { 518 + .name = "bcm6368-pinctrl", 519 + .of_match_table = bcm6368_pinctrl_match, 520 + }, 521 + }; 522 + 523 + builtin_platform_driver(bcm6368_pinctrl_driver);
+109
drivers/pinctrl/bcm/pinctrl-bcm63xx.c
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Driver for BCM63xx GPIO unit (pinctrl + GPIO) 4 + * 5 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 6 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 7 + */ 8 + 9 + #include <linux/gpio/regmap.h> 10 + #include <linux/mfd/syscon.h> 11 + #include <linux/mod_devicetable.h> 12 + #include <linux/of.h> 13 + #include <linux/platform_device.h> 14 + 15 + #include "pinctrl-bcm63xx.h" 16 + 17 + #define BCM63XX_BANK_SIZE 4 18 + 19 + #define BCM63XX_DIROUT_REG 0x04 20 + #define BCM63XX_DATA_REG 0x0c 21 + 22 + static int bcm63xx_reg_mask_xlate(struct gpio_regmap *gpio, 23 + unsigned int base, unsigned int offset, 24 + unsigned int *reg, unsigned int *mask) 25 + { 26 + unsigned int line = offset % BCM63XX_BANK_GPIOS; 27 + unsigned int stride = offset / BCM63XX_BANK_GPIOS; 28 + 29 + *reg = base - stride * BCM63XX_BANK_SIZE; 30 + *mask = BIT(line); 31 + 32 + return 0; 33 + } 34 + 35 + static const struct of_device_id bcm63xx_gpio_of_match[] = { 36 + { .compatible = "brcm,bcm6318-gpio", }, 37 + { .compatible = "brcm,bcm6328-gpio", }, 38 + { .compatible = "brcm,bcm6358-gpio", }, 39 + { .compatible = "brcm,bcm6362-gpio", }, 40 + { .compatible = "brcm,bcm6368-gpio", }, 41 + { .compatible = "brcm,bcm63268-gpio", }, 42 + { /* sentinel */ } 43 + }; 44 + 45 + static int bcm63xx_gpio_probe(struct device *dev, struct device_node *node, 46 + const struct bcm63xx_pinctrl_soc *soc, 47 + struct bcm63xx_pinctrl *pc) 48 + { 49 + struct gpio_regmap_config grc = {0}; 50 + 51 + grc.parent = dev; 52 + grc.fwnode = &node->fwnode; 53 + grc.ngpio = soc->ngpios; 54 + grc.ngpio_per_reg = BCM63XX_BANK_GPIOS; 55 + grc.regmap = pc->regs; 56 + grc.reg_dat_base = BCM63XX_DATA_REG; 57 + grc.reg_dir_out_base = BCM63XX_DIROUT_REG; 58 + grc.reg_set_base = BCM63XX_DATA_REG; 59 + grc.reg_mask_xlate = bcm63xx_reg_mask_xlate; 60 + 61 + return PTR_ERR_OR_ZERO(devm_gpio_regmap_register(dev, &grc)); 62 + } 63 + 64 + int bcm63xx_pinctrl_probe(struct platform_device *pdev, 65 + const struct bcm63xx_pinctrl_soc *soc, 66 + void *driver_data) 67 + { 68 + struct device *dev = &pdev->dev; 69 + struct bcm63xx_pinctrl *pc; 70 + struct device_node *node; 71 + int err; 72 + 73 + pc = devm_kzalloc(dev, sizeof(*pc), GFP_KERNEL); 74 + if (!pc) 75 + return -ENOMEM; 76 + 77 + platform_set_drvdata(pdev, pc); 78 + 79 + pc->dev = dev; 80 + pc->driver_data = driver_data; 81 + 82 + pc->regs = syscon_node_to_regmap(dev->parent->of_node); 83 + if (IS_ERR(pc->regs)) 84 + return PTR_ERR(pc->regs); 85 + 86 + pc->pctl_desc.name = dev_name(dev); 87 + pc->pctl_desc.pins = soc->pins; 88 + pc->pctl_desc.npins = soc->npins; 89 + pc->pctl_desc.pctlops = soc->pctl_ops; 90 + pc->pctl_desc.pmxops = soc->pmx_ops; 91 + pc->pctl_desc.owner = THIS_MODULE; 92 + 93 + pc->pctl_dev = devm_pinctrl_register(dev, &pc->pctl_desc, pc); 94 + if (IS_ERR(pc->pctl_dev)) 95 + return PTR_ERR(pc->pctl_dev); 96 + 97 + for_each_child_of_node(dev->parent->of_node, node) { 98 + if (of_match_node(bcm63xx_gpio_of_match, node)) { 99 + err = bcm63xx_gpio_probe(dev, node, soc, pc); 100 + if (err) { 101 + dev_err(dev, "could not add GPIO chip\n"); 102 + of_node_put(node); 103 + return err; 104 + } 105 + } 106 + } 107 + 108 + return 0; 109 + }
+43
drivers/pinctrl/bcm/pinctrl-bcm63xx.h
··· 1 + // SPDX-License-Identifier: GPL-2.0+ 2 + /* 3 + * Copyright (C) 2021 Álvaro Fernández Rojas <noltari@gmail.com> 4 + * Copyright (C) 2016 Jonas Gorski <jonas.gorski@gmail.com> 5 + */ 6 + 7 + #ifndef __PINCTRL_BCM63XX_H__ 8 + #define __PINCTRL_BCM63XX_H__ 9 + 10 + #include <linux/pinctrl/pinctrl.h> 11 + 12 + #define BCM63XX_BANK_GPIOS 32 13 + 14 + struct bcm63xx_pinctrl_soc { 15 + struct pinctrl_ops *pctl_ops; 16 + struct pinmux_ops *pmx_ops; 17 + 18 + const struct pinctrl_pin_desc *pins; 19 + unsigned npins; 20 + 21 + unsigned int ngpios; 22 + }; 23 + 24 + struct bcm63xx_pinctrl { 25 + struct device *dev; 26 + struct regmap *regs; 27 + 28 + struct pinctrl_desc pctl_desc; 29 + struct pinctrl_dev *pctl_dev; 30 + 31 + void *driver_data; 32 + }; 33 + 34 + static inline unsigned int bcm63xx_bank_pin(unsigned int pin) 35 + { 36 + return pin % BCM63XX_BANK_GPIOS; 37 + } 38 + 39 + int bcm63xx_pinctrl_probe(struct platform_device *pdev, 40 + const struct bcm63xx_pinctrl_soc *soc, 41 + void *driver_data); 42 + 43 + #endif /* __PINCTRL_BCM63XX_H__ */
+9
include/linux/gpio/driver.h
··· 624 624 bool gpiochip_irqchip_irq_valid(const struct gpio_chip *gc, 625 625 unsigned int offset); 626 626 627 + #ifdef CONFIG_GPIOLIB_IRQCHIP 627 628 int gpiochip_irqchip_add_domain(struct gpio_chip *gc, 628 629 struct irq_domain *domain); 630 + #else 631 + static inline int gpiochip_irqchip_add_domain(struct gpio_chip *gc, 632 + struct irq_domain *domain) 633 + { 634 + WARN_ON(1); 635 + return -EINVAL; 636 + } 637 + #endif 629 638 630 639 int gpiochip_generic_request(struct gpio_chip *gc, unsigned int offset); 631 640 void gpiochip_generic_free(struct gpio_chip *gc, unsigned int offset);
+4
include/linux/gpio/regmap.h
··· 4 4 #define _LINUX_GPIO_REGMAP_H 5 5 6 6 struct device; 7 + struct fwnode_handle; 7 8 struct gpio_regmap; 8 9 struct irq_domain; 9 10 struct regmap; ··· 17 16 * @parent: The parent device 18 17 * @regmap: The regmap used to access the registers 19 18 * given, the name of the device is used 19 + * @fwnode: (Optional) The firmware node. 20 + * If not given, the fwnode of the parent is used. 20 21 * @label: (Optional) Descriptive name for GPIO controller. 21 22 * If not given, the name of the device is used. 22 23 * @ngpio: Number of GPIOs ··· 60 57 struct gpio_regmap_config { 61 58 struct device *parent; 62 59 struct regmap *regmap; 60 + struct fwnode_handle *fwnode; 63 61 64 62 const char *label; 65 63 int ngpio;