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