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