xref: /freebsd/sys/contrib/device-tree/Bindings/pinctrl/rockchip,pinctrl.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel Vadot* Rockchip Pinmux Controller
2*c66ec88fSEmmanuel Vadot
3*c66ec88fSEmmanuel VadotThe Rockchip Pinmux Controller, enables the IC
4*c66ec88fSEmmanuel Vadotto share one PAD to several functional blocks. The sharing is done by
5*c66ec88fSEmmanuel Vadotmultiplexing the PAD input/output signals. For each PAD there are several
6*c66ec88fSEmmanuel Vadotmuxing options with option 0 being the use as a GPIO.
7*c66ec88fSEmmanuel Vadot
8*c66ec88fSEmmanuel VadotPlease refer to pinctrl-bindings.txt in this directory for details of the
9*c66ec88fSEmmanuel Vadotcommon pinctrl bindings used by client devices, including the meaning of the
10*c66ec88fSEmmanuel Vadotphrase "pin configuration node".
11*c66ec88fSEmmanuel Vadot
12*c66ec88fSEmmanuel VadotThe Rockchip pin configuration node is a node of a group of pins which can be
13*c66ec88fSEmmanuel Vadotused for a specific device or function. This node represents both mux and
14*c66ec88fSEmmanuel Vadotconfig of the pins in that group. The 'pins' selects the function mode(also
15*c66ec88fSEmmanuel Vadotnamed pin mode) this pin can work on and the 'config' configures various pad
16*c66ec88fSEmmanuel Vadotsettings such as pull-up, etc.
17*c66ec88fSEmmanuel Vadot
18*c66ec88fSEmmanuel VadotThe pins are grouped into up to 5 individual pin banks which need to be
19*c66ec88fSEmmanuel Vadotdefined as gpio sub-nodes of the pinmux controller.
20*c66ec88fSEmmanuel Vadot
21*c66ec88fSEmmanuel VadotRequired properties for iomux controller:
22*c66ec88fSEmmanuel Vadot  - compatible: should be
23*c66ec88fSEmmanuel Vadot		"rockchip,px30-pinctrl":    for Rockchip PX30
24*c66ec88fSEmmanuel Vadot		"rockchip,rv1108-pinctrl":  for Rockchip RV1108
25*c66ec88fSEmmanuel Vadot		"rockchip,rk2928-pinctrl":  for Rockchip RK2928
26*c66ec88fSEmmanuel Vadot		"rockchip,rk3066a-pinctrl": for Rockchip RK3066a
27*c66ec88fSEmmanuel Vadot		"rockchip,rk3066b-pinctrl": for Rockchip RK3066b
28*c66ec88fSEmmanuel Vadot		"rockchip,rk3128-pinctrl":  for Rockchip RK3128
29*c66ec88fSEmmanuel Vadot		"rockchip,rk3188-pinctrl":  for Rockchip RK3188
30*c66ec88fSEmmanuel Vadot		"rockchip,rk3228-pinctrl":  for Rockchip RK3228
31*c66ec88fSEmmanuel Vadot		"rockchip,rk3288-pinctrl":  for Rockchip RK3288
32*c66ec88fSEmmanuel Vadot		"rockchip,rk3308-pinctrl":  for Rockchip RK3308
33*c66ec88fSEmmanuel Vadot		"rockchip,rk3328-pinctrl":  for Rockchip RK3328
34*c66ec88fSEmmanuel Vadot		"rockchip,rk3368-pinctrl":  for Rockchip RK3368
35*c66ec88fSEmmanuel Vadot		"rockchip,rk3399-pinctrl":  for Rockchip RK3399
36*c66ec88fSEmmanuel Vadot
37*c66ec88fSEmmanuel Vadot  - rockchip,grf: phandle referencing a syscon providing the
38*c66ec88fSEmmanuel Vadot	 "general register files"
39*c66ec88fSEmmanuel Vadot
40*c66ec88fSEmmanuel VadotOptional properties for iomux controller:
41*c66ec88fSEmmanuel Vadot  - rockchip,pmu: phandle referencing a syscon providing the pmu registers
42*c66ec88fSEmmanuel Vadot	 as some SoCs carry parts of the iomux controller registers there.
43*c66ec88fSEmmanuel Vadot	 Required for at least rk3188 and rk3288. On the rk3368 this should
44*c66ec88fSEmmanuel Vadot	 point to the PMUGRF syscon.
45*c66ec88fSEmmanuel Vadot
46*c66ec88fSEmmanuel VadotDeprecated properties for iomux controller:
47*c66ec88fSEmmanuel Vadot  - reg: first element is the general register space of the iomux controller
48*c66ec88fSEmmanuel Vadot	 It should be large enough to contain also separate pull registers.
49*c66ec88fSEmmanuel Vadot	 second element is the separate pull register space of the rk3188.
50*c66ec88fSEmmanuel Vadot	 Use rockchip,grf and rockchip,pmu described above instead.
51*c66ec88fSEmmanuel Vadot
52*c66ec88fSEmmanuel VadotRequired properties for gpio sub nodes:
53*c66ec88fSEmmanuel Vadot  - compatible: "rockchip,gpio-bank"
54*c66ec88fSEmmanuel Vadot  - reg: register of the gpio bank (different than the iomux registerset)
55*c66ec88fSEmmanuel Vadot  - interrupts: base interrupt of the gpio bank in the interrupt controller
56*c66ec88fSEmmanuel Vadot  - clocks: clock that drives this bank
57*c66ec88fSEmmanuel Vadot  - gpio-controller: identifies the node as a gpio controller and pin bank.
58*c66ec88fSEmmanuel Vadot  - #gpio-cells: number of cells in GPIO specifier. Since the generic GPIO
59*c66ec88fSEmmanuel Vadot    binding is used, the amount of cells must be specified as 2. See generic
60*c66ec88fSEmmanuel Vadot    GPIO binding documentation for description of particular cells.
61*c66ec88fSEmmanuel Vadot  - interrupt-controller: identifies the controller node as interrupt-parent.
62*c66ec88fSEmmanuel Vadot  - #interrupt-cells: the value of this property should be 2 and the interrupt
63*c66ec88fSEmmanuel Vadot    cells should use the standard two-cell scheme described in
64*c66ec88fSEmmanuel Vadot    bindings/interrupt-controller/interrupts.txt
65*c66ec88fSEmmanuel Vadot
66*c66ec88fSEmmanuel VadotDeprecated properties for gpio sub nodes:
67*c66ec88fSEmmanuel Vadot  - compatible: "rockchip,rk3188-gpio-bank0"
68*c66ec88fSEmmanuel Vadot  - reg: second element: separate pull register for rk3188 bank0, use
69*c66ec88fSEmmanuel Vadot	 rockchip,pmu described above instead
70*c66ec88fSEmmanuel Vadot
71*c66ec88fSEmmanuel VadotRequired properties for pin configuration node:
72*c66ec88fSEmmanuel Vadot  - rockchip,pins: 3 integers array, represents a group of pins mux and config
73*c66ec88fSEmmanuel Vadot    setting. The format is rockchip,pins = <PIN_BANK PIN_BANK_IDX MUX &phandle>.
74*c66ec88fSEmmanuel Vadot    The MUX 0 means gpio and MUX 1 to N mean the specific device function.
75*c66ec88fSEmmanuel Vadot    The phandle of a node containing the generic pinconfig options
76*c66ec88fSEmmanuel Vadot    to use, as described in pinctrl-bindings.txt in this directory.
77*c66ec88fSEmmanuel Vadot
78*c66ec88fSEmmanuel VadotExamples:
79*c66ec88fSEmmanuel Vadot
80*c66ec88fSEmmanuel Vadot#include <dt-bindings/pinctrl/rockchip.h>
81*c66ec88fSEmmanuel Vadot
82*c66ec88fSEmmanuel Vadot...
83*c66ec88fSEmmanuel Vadot
84*c66ec88fSEmmanuel Vadotpinctrl@20008000 {
85*c66ec88fSEmmanuel Vadot	compatible = "rockchip,rk3066a-pinctrl";
86*c66ec88fSEmmanuel Vadot	rockchip,grf = <&grf>;
87*c66ec88fSEmmanuel Vadot
88*c66ec88fSEmmanuel Vadot	#address-cells = <1>;
89*c66ec88fSEmmanuel Vadot	#size-cells = <1>;
90*c66ec88fSEmmanuel Vadot	ranges;
91*c66ec88fSEmmanuel Vadot
92*c66ec88fSEmmanuel Vadot	gpio0: gpio0@20034000 {
93*c66ec88fSEmmanuel Vadot		compatible = "rockchip,gpio-bank";
94*c66ec88fSEmmanuel Vadot		reg = <0x20034000 0x100>;
95*c66ec88fSEmmanuel Vadot		interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
96*c66ec88fSEmmanuel Vadot		clocks = <&clk_gates8 9>;
97*c66ec88fSEmmanuel Vadot
98*c66ec88fSEmmanuel Vadot		gpio-controller;
99*c66ec88fSEmmanuel Vadot		#gpio-cells = <2>;
100*c66ec88fSEmmanuel Vadot
101*c66ec88fSEmmanuel Vadot		interrupt-controller;
102*c66ec88fSEmmanuel Vadot		#interrupt-cells = <2>;
103*c66ec88fSEmmanuel Vadot	};
104*c66ec88fSEmmanuel Vadot
105*c66ec88fSEmmanuel Vadot	...
106*c66ec88fSEmmanuel Vadot
107*c66ec88fSEmmanuel Vadot	pcfg_pull_default: pcfg_pull_default {
108*c66ec88fSEmmanuel Vadot		bias-pull-pin-default
109*c66ec88fSEmmanuel Vadot	};
110*c66ec88fSEmmanuel Vadot
111*c66ec88fSEmmanuel Vadot	uart2 {
112*c66ec88fSEmmanuel Vadot		uart2_xfer: uart2-xfer {
113*c66ec88fSEmmanuel Vadot			rockchip,pins = <1 RK_PB0 1 &pcfg_pull_default>,
114*c66ec88fSEmmanuel Vadot					<1 RK_PB1 1 &pcfg_pull_default>;
115*c66ec88fSEmmanuel Vadot		};
116*c66ec88fSEmmanuel Vadot	};
117*c66ec88fSEmmanuel Vadot};
118*c66ec88fSEmmanuel Vadot
119*c66ec88fSEmmanuel Vadotuart2: serial@20064000 {
120*c66ec88fSEmmanuel Vadot	compatible = "snps,dw-apb-uart";
121*c66ec88fSEmmanuel Vadot	reg = <0x20064000 0x400>;
122*c66ec88fSEmmanuel Vadot	interrupts = <GIC_SPI 36 IRQ_TYPE_LEVEL_HIGH>;
123*c66ec88fSEmmanuel Vadot	reg-shift = <2>;
124*c66ec88fSEmmanuel Vadot	reg-io-width = <1>;
125*c66ec88fSEmmanuel Vadot	clocks = <&mux_uart2>;
126*c66ec88fSEmmanuel Vadot
127*c66ec88fSEmmanuel Vadot	pinctrl-names = "default";
128*c66ec88fSEmmanuel Vadot	pinctrl-0 = <&uart2_xfer>;
129*c66ec88fSEmmanuel Vadot};
130*c66ec88fSEmmanuel Vadot
131*c66ec88fSEmmanuel VadotExample for rk3188:
132*c66ec88fSEmmanuel Vadot
133*c66ec88fSEmmanuel Vadot	pinctrl@20008000 {
134*c66ec88fSEmmanuel Vadot		compatible = "rockchip,rk3188-pinctrl";
135*c66ec88fSEmmanuel Vadot		rockchip,grf = <&grf>;
136*c66ec88fSEmmanuel Vadot		rockchip,pmu = <&pmu>;
137*c66ec88fSEmmanuel Vadot		#address-cells = <1>;
138*c66ec88fSEmmanuel Vadot		#size-cells = <1>;
139*c66ec88fSEmmanuel Vadot		ranges;
140*c66ec88fSEmmanuel Vadot
141*c66ec88fSEmmanuel Vadot		gpio0: gpio0@2000a000 {
142*c66ec88fSEmmanuel Vadot			compatible = "rockchip,rk3188-gpio-bank0";
143*c66ec88fSEmmanuel Vadot			reg = <0x2000a000 0x100>;
144*c66ec88fSEmmanuel Vadot			interrupts = <GIC_SPI 54 IRQ_TYPE_LEVEL_HIGH>;
145*c66ec88fSEmmanuel Vadot			clocks = <&clk_gates8 9>;
146*c66ec88fSEmmanuel Vadot
147*c66ec88fSEmmanuel Vadot			gpio-controller;
148*c66ec88fSEmmanuel Vadot			#gpio-cells = <2>;
149*c66ec88fSEmmanuel Vadot
150*c66ec88fSEmmanuel Vadot			interrupt-controller;
151*c66ec88fSEmmanuel Vadot			#interrupt-cells = <2>;
152*c66ec88fSEmmanuel Vadot		};
153*c66ec88fSEmmanuel Vadot
154*c66ec88fSEmmanuel Vadot		gpio1: gpio1@2003c000 {
155*c66ec88fSEmmanuel Vadot			compatible = "rockchip,gpio-bank";
156*c66ec88fSEmmanuel Vadot			reg = <0x2003c000 0x100>;
157*c66ec88fSEmmanuel Vadot			interrupts = <GIC_SPI 55 IRQ_TYPE_LEVEL_HIGH>;
158*c66ec88fSEmmanuel Vadot			clocks = <&clk_gates8 10>;
159*c66ec88fSEmmanuel Vadot
160*c66ec88fSEmmanuel Vadot			gpio-controller;
161*c66ec88fSEmmanuel Vadot			#gpio-cells = <2>;
162*c66ec88fSEmmanuel Vadot
163*c66ec88fSEmmanuel Vadot			interrupt-controller;
164*c66ec88fSEmmanuel Vadot			#interrupt-cells = <2>;
165*c66ec88fSEmmanuel Vadot		};
166*c66ec88fSEmmanuel Vadot
167*c66ec88fSEmmanuel Vadot		...
168*c66ec88fSEmmanuel Vadot
169*c66ec88fSEmmanuel Vadot	};
170