1 # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2 # Copyright (C) Sunplus Co., Ltd.
5 $id: http://devicetree.org/schemas/pinctrl/sunplus,sp7021-pinctrl.yaml#
6 $schema: http://devicetree.org/meta-schemas/core.yaml#
8 title: Sunplus SP7021 Pin Controller
11 - Dvorkin Dmitry <dvorkin@tibbo.com>
12 - Wells Lu <wellslutw@gmail.com>
15 The Sunplus SP7021 pin controller is used to control SoC pins. Please
16 refer to pinctrl-bindings.txt in this directory for details of the common
17 pinctrl bindings used by client devices.
19 SP7021 has 99 digital GPIO pins which are numbered from GPIO 0 to 98. All
20 are multiplexed with some special function pins. SP7021 has 3 types of
21 special function pins:
23 (1) function-group pins:
25 If control-field SPI_FLASH_SEL is set to 1, GPIO 83, 84, 86 and 87
26 will be pins of SPI-NOR flash. If it is set to 2, GPIO 76, 78, 79
27 and 81 will be pins of SPI-NOR flash.
30 If control-bit UA0_SEL is set to 1, GPIO 88 and 89 will be TX and
31 RX pins of UART_0 (UART channel 0).
34 If control-bit EMMC_SEL is set to 1, GPIO 72, 73, 74, 75, 76, 77,
35 78, 79, 80, 81 will be pins of an eMMC device.
37 Properties "function" and "groups" are used to select function-group
40 (2) fully pin-mux (like phone exchange mux) pins:
41 GPIO 8 to 71 are 'fully pin-mux' pins. Any pins of peripherals of
42 SP7021 (ex: UART_1, UART_2, UART_3, UART_4, I2C_0, I2C_1, and etc.)
43 can be routed to any pins of fully pin-mux pins.
45 Ex 1 (UART channel 1):
46 If control-field UA1_TX_SEL is set to 3, TX pin of UART_1 will be
47 routed to GPIO 10 (3 - 1 + 8 = 10).
48 If control-field UA1_RX_SEL is set to 4, RX pin of UART_1 will be
49 routed to GPIO 11 (4 - 1 + 8 = 11).
50 If control-field UA1_RTS_SEL is set to 5, RTS pin of UART_1 will
51 be routed to GPIO 12 (5 - 1 + 8 = 12).
52 If control-field UA1_CTS_SEL is set to 6, CTS pin of UART_1 will
53 be routed to GPIO 13 (6 - 1 + 8 = 13).
56 If control-field I2C0_CLK_SEL is set to 20, CLK pin of I2C_0 will
57 be routed to GPIO 27 (20 - 1 + 8 = 27).
58 If control-field I2C0_DATA_SEL is set to 21, DATA pin of I2C_0
59 will be routed to GPIO 28 (21 - 1 + 9 = 28).
61 Totally, SP7021 has 120 peripheral pins. The peripheral pins can be
62 routed to any of 64 'fully pin-mux' pins.
64 (3) I/O processor pins
65 SP7021 has a built-in I/O processor.
66 Any GPIO pins (GPIO 0 to 98) can be set to pins of I/O processor.
68 Vendor property "sunplus,pins" is used to select "fully pin-mux" pins,
69 "I/O processor pins" and "digital GPIO" pins.
71 The device node of pin controller of Sunplus SP7021 has following
76 const: sunplus,sp7021-pctl
85 - description: the MOON2 registers
86 - description: the GPIOXT registers
87 - description: the FIRST registers
88 - description: the MOON1 registers
107 A pinctrl node should contain at least one subnodes representing the
108 pins or function-pins group available on the machine. Each subnode
109 will list the pins it needs, and how they should be configured.
111 Pinctrl node's client devices use subnodes for desired pin
112 configuration. Client device subnodes use below standard properties.
113 $ref: pinmux-node.yaml#
118 Define 'sunplus,pins' which are used by pinctrl node's client
121 It consists of one or more integers which represents the config
122 setting for corresponding pin. Each integer defines a individual
125 Bit 32~24: defines GPIO number. Its range is 0 ~ 98.
126 Bit 23~16: defines types: (1) fully pin-mux pins
127 (2) IO processor pins
128 (3) digital GPIO pins
129 Bit 15~8: defines pins of peripherals (which are defined in
130 'include/dt-binging/pinctrl/sppctl.h').
131 Bit 7~0: defines types or initial-state of digital GPIO pins.
133 Please use macro SPPCTL_IOPAD to define the integers for pins.
135 $ref: /schemas/types.yaml#/definitions/uint32-array
139 Define pin-function which is used by pinctrl node's client device.
140 The name should be one of string in the following enumeration.
141 $ref: /schemas/types.yaml#/definitions/string
142 enum: [ SPI_FLASH, SPI_FLASH_4BIT, SPI_NAND, CARD0_EMMC, SD_CARD,
143 UA0, FPGA_IFX, HDMI_TX, LCDIF, USB0_OTG, USB1_OTG ]
147 Define pin-group in a specified pin-function.
148 The name should be one of string in the following enumeration.
149 $ref: /schemas/types.yaml#/definitions/string
150 enum: [ SPI_FLASH1, SPI_FLASH2, SPI_FLASH_4BIT1, SPI_FLASH_4BIT2,
151 SPI_NAND, CARD0_EMMC, SD_CARD, UA0, FPGA_IFX, HDMI_TX1,
152 HDMI_TX2, HDMI_TX3, LCDIF, USB0_OTG, USB1_OTG ]
156 This is a vendor specific property. It is used to disable pins
157 which are not used by pinctrl node's client device.
158 Some pins may be enabled by boot-loader. We can use this
159 property to disable them.
160 $ref: /schemas/types.yaml#/definitions/uint32-array
162 additionalProperties: false
289 additionalProperties: false
292 - $ref: pinctrl.yaml#
296 #include <dt-bindings/pinctrl/sppctl-sp7021.h>
299 compatible = "sunplus,sp7021-pctl";
300 reg = <0x9c000100 0x100>, <0x9c000300 0x100>,
301 <0x9c0032e4 0x1c>, <0x9c000080 0x20>;
302 reg-names = "moon2", "gpioxt", "first", "moon1";
305 clocks = <&clkc 0x83>;
306 resets = <&rstc 0x73>;
314 function = "SPI_NAND";
320 SPPCTL_IOPAD(11, SPPCTL_PCTL_G_PMUX, MUXF_UA1_TX, 0)
321 SPPCTL_IOPAD(10, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RX, 0)
327 SPPCTL_IOPAD(20, SPPCTL_PCTL_G_PMUX, MUXF_UA1_TX, 0)
328 SPPCTL_IOPAD(21, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RX, 0)
329 SPPCTL_IOPAD(22, SPPCTL_PCTL_G_PMUX, MUXF_UA1_RTS, 0)
330 SPPCTL_IOPAD(23, SPPCTL_PCTL_G_PMUX, MUXF_UA1_CTS, 0)
335 function = "CARD0_EMMC";
336 groups = "CARD0_EMMC";
340 function = "SD_CARD";
342 sunplus,pins = < SPPCTL_IOPAD(91, SPPCTL_PCTL_G_GPIO, 0, 0) >;
346 function = "HDMI_TX";
350 function = "HDMI_TX";
354 function = "HDMI_TX";
360 SPPCTL_IOPAD(49,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_CLK_OUT,0)
361 SPPCTL_IOPAD(44,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDC,0)
362 SPPCTL_IOPAD(43,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_MAC_SMI_MDIO,0)
363 SPPCTL_IOPAD(52,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXEN,0)
364 SPPCTL_IOPAD(50,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD0,0)
365 SPPCTL_IOPAD(51,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_TXD1,0)
366 SPPCTL_IOPAD(46,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_CRSDV,0)
367 SPPCTL_IOPAD(47,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD0,0)
368 SPPCTL_IOPAD(48,SPPCTL_PCTL_G_PMUX,MUXF_L2SW_P0_MAC_RMII_RXD1,0)
373 MUXF_L2SW_P0_MAC_RMII_RXER