xref: /freebsd-src/sys/contrib/device-tree/Bindings/gpio/nxp,lpc1850-gpio.txt (revision c66ec88fed842fbaad62c30d510644ceb7bd2d71)
1*c66ec88fSEmmanuel VadotNXP LPC18xx/43xx GPIO controller Device Tree Bindings
2*c66ec88fSEmmanuel Vadot-----------------------------------------------------
3*c66ec88fSEmmanuel Vadot
4*c66ec88fSEmmanuel VadotRequired properties:
5*c66ec88fSEmmanuel Vadot- compatible		: Should be "nxp,lpc1850-gpio"
6*c66ec88fSEmmanuel Vadot- reg			: List of addresses and lengths of the GPIO controller
7*c66ec88fSEmmanuel Vadot			  register sets
8*c66ec88fSEmmanuel Vadot- reg-names		: Should be "gpio", "gpio-pin-ic", "gpio-group0-ic" and
9*c66ec88fSEmmanuel Vadot			  "gpio-gpoup1-ic"
10*c66ec88fSEmmanuel Vadot- clocks		: Phandle and clock specifier pair for GPIO controller
11*c66ec88fSEmmanuel Vadot- resets		: Phandle and reset specifier pair for GPIO controller
12*c66ec88fSEmmanuel Vadot- gpio-controller	: Marks the device node as a GPIO controller
13*c66ec88fSEmmanuel Vadot- #gpio-cells 		: Should be two:
14*c66ec88fSEmmanuel Vadot			  - The first cell is the GPIO line number
15*c66ec88fSEmmanuel Vadot			  - The second cell is used to specify polarity
16*c66ec88fSEmmanuel Vadot- interrupt-controller	: Marks the device node as an interrupt controller
17*c66ec88fSEmmanuel Vadot- #interrupt-cells	: Should be two:
18*c66ec88fSEmmanuel Vadot			  - The first cell is an interrupt number within
19*c66ec88fSEmmanuel Vadot			    0..9 range, for GPIO pin interrupts it is equal
20*c66ec88fSEmmanuel Vadot			    to 'nxp,gpio-pin-interrupt' property value of
21*c66ec88fSEmmanuel Vadot			    GPIO pin configuration, 8 is for GPIO GROUP0
22*c66ec88fSEmmanuel Vadot			    interrupt, 9 is for GPIO GROUP1 interrupt
23*c66ec88fSEmmanuel Vadot			  - The second cell is used to specify interrupt type
24*c66ec88fSEmmanuel Vadot
25*c66ec88fSEmmanuel VadotOptional properties:
26*c66ec88fSEmmanuel Vadot- gpio-ranges		: Mapping between GPIO and pinctrl
27*c66ec88fSEmmanuel Vadot
28*c66ec88fSEmmanuel VadotExample:
29*c66ec88fSEmmanuel Vadot#define LPC_GPIO(port, pin)	(port * 32 + pin)
30*c66ec88fSEmmanuel Vadot#define LPC_PIN(port, pin)	(0x##port * 32 + pin)
31*c66ec88fSEmmanuel Vadot
32*c66ec88fSEmmanuel Vadotgpio: gpio@400f4000 {
33*c66ec88fSEmmanuel Vadot	compatible = "nxp,lpc1850-gpio";
34*c66ec88fSEmmanuel Vadot	reg = <0x400f4000 0x4000>, <0x40087000 0x1000>,
35*c66ec88fSEmmanuel Vadot	      <0x40088000 0x1000>, <0x40089000 0x1000>;
36*c66ec88fSEmmanuel Vadot	reg-names = "gpio", "gpio-pin-ic",
37*c66ec88fSEmmanuel Vadot		    "gpio-group0-ic", "gpio-gpoup1-ic";
38*c66ec88fSEmmanuel Vadot	clocks = <&ccu1 CLK_CPU_GPIO>;
39*c66ec88fSEmmanuel Vadot	resets = <&rgu 28>;
40*c66ec88fSEmmanuel Vadot	gpio-controller;
41*c66ec88fSEmmanuel Vadot	#gpio-cells = <2>;
42*c66ec88fSEmmanuel Vadot	interrupt-controller;
43*c66ec88fSEmmanuel Vadot	#interrupt-cells = <2>;
44*c66ec88fSEmmanuel Vadot	gpio-ranges =	<&pinctrl LPC_GPIO(0,0)  LPC_PIN(0,0)  2>,
45*c66ec88fSEmmanuel Vadot			...
46*c66ec88fSEmmanuel Vadot			<&pinctrl LPC_GPIO(7,19) LPC_PIN(f,5)  7>;
47*c66ec88fSEmmanuel Vadot};
48*c66ec88fSEmmanuel Vadot
49*c66ec88fSEmmanuel Vadotgpio_joystick {
50*c66ec88fSEmmanuel Vadot	compatible = "gpio-keys";
51*c66ec88fSEmmanuel Vadot	...
52*c66ec88fSEmmanuel Vadot
53*c66ec88fSEmmanuel Vadot	button0 {
54*c66ec88fSEmmanuel Vadot		...
55*c66ec88fSEmmanuel Vadot		interrupt-parent = <&gpio>;
56*c66ec88fSEmmanuel Vadot		interrupts = <1 IRQ_TYPE_EDGE_BOTH>;
57*c66ec88fSEmmanuel Vadot		gpios = <&gpio LPC_GPIO(4,8) GPIO_ACTIVE_LOW>;
58*c66ec88fSEmmanuel Vadot	};
59*c66ec88fSEmmanuel Vadot};
60