diff options
author | Simon Arlott <simon@fire.lp0.eu> | 2012-09-28 00:10:11 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-10-01 02:05:22 -0400 |
commit | e1b2dc70cd5b00e17c703163a463d82354b1cc76 (patch) | |
tree | fc013a598baa611ba6651b760f8a03347b2d6e47 /Documentation/devicetree | |
parent | b0e181d0944e858ae0cacf808752e791894c5651 (diff) |
pinctrl: add bcm2835 driver
The BCM2835 GPIO module is a combined GPIO controller, (GPIO) interrupt
controller, and pinmux/control device.
Original driver by Simon Arlott.
Rewrite including GPIO chip device by Chris Boot.
Upstreaming changes by Stephen Warren:
* Wrote DT binding documentation.
* Changed brcm,function to an integer to more directly match the
datasheet, and to match brcm,pins being an integer.
* Implemented pull-up/down pin config.
* Removed read-only DT property and related code. The restriction this
implemented are driven by the board, not the GPIO HW block, so don't
really make sense of a HW block binding, were in general incomplete
(since they could only know about the few pins hard-coded into the
Raspberry Pi B board design and not the uncommitted GPIOS), and are
better represented simply by not writing incorrect data into pin
configuration nodes.
* Don't set GPIO_IN function select in gpio_request_enable() to avoid
glitches; defer this to gpio_set_direction(). Consequently, removed
empty bcm2835_pmx_gpio_request_enable().
* Simplified enabled_irq_map[]; make it explicitly 1 entry per bank.
* Lifted use of enabled_irq_map[] outside the per-interrupt loop in
IRQ handler, thus fixing an issue where the code was indexing into
enabled_irq_map[] by intra-bank GPIO ID, not global GPIO ID.
* Removed locking in IRQ handler, since all other code uses
spin_lock_irqsave() and so guarantees it doesn't run concurrently
with the handler.
* Moved duplicated BUILD_BUG_ON()s into probe(). Also check size of
bcm2835_gpio_pins[].
* Remove range-checking from bcm2835_pctl_get_groups_count() since we've
decided to trust the pinctrl core.
* Made bcm2835_pmx_gpio_disable_free() call bcm2835_pinctrl_fsel_set()
directly for simplicity.
* Fixed body of dt_free_map() to match latest dt_node_to_map().
* Removed GPIO ownership check from bcm2835_pmx_enable() since the pinctrl
core owns doing this.
* Made irq_chip and pinctrl_gpio_range .name == MODULE_NAME so it's more
descriptive.
* Simplified remove(); removed call to non-existent
pinctrl_remove_gpio_range(), remove early return on error.
* Don't force gpiochip's base to 0. Set gpio_range.base to gpiochip's
base GPIO number.
* Error-handling cleanups in probe().
* Switched to module_platform_driver() rather than open-coding.
* Made pin, group, and function names lower-case.
* s/broadcom/brcm/ in DT property names.
* s/2708/2835/.
* Fixed a couple minor checkpatch warnings, and other minor cleanup.
Signed-off-by: Simon Arlott <simon@fire.lp0.eu>
Signed-off-by: Chris Boot <bootc@bootc.net>
Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'Documentation/devicetree')
-rw-r--r-- | Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt b/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt new file mode 100644 index 000000000000..8edc20e1b09e --- /dev/null +++ b/Documentation/devicetree/bindings/pinctrl/brcm,bcm2835-gpio.txt | |||
@@ -0,0 +1,74 @@ | |||
1 | Broadcom BCM2835 GPIO (and pinmux) controller | ||
2 | |||
3 | The BCM2835 GPIO module is a combined GPIO controller, (GPIO) interrupt | ||
4 | controller, and pinmux/control device. | ||
5 | |||
6 | Required properties: | ||
7 | - compatible: "brcm,bcm2835-gpio" | ||
8 | - reg: Should contain the physical address of the GPIO module's registes. | ||
9 | - gpio-controller: Marks the device node as a GPIO controller. | ||
10 | - #gpio-cells : Should be two. The first cell is the pin number and the | ||
11 | second cell is used to specify optional parameters: | ||
12 | - bit 0 specifies polarity (0 for normal, 1 for inverted) | ||
13 | - interrupts : The interrupt outputs from the controller. One interrupt per | ||
14 | individual bank followed by the "all banks" interrupt. | ||
15 | - interrupt-controller: Marks the device node as an interrupt controller. | ||
16 | - #interrupt-cells : Should be 2. | ||
17 | The first cell is the GPIO number. | ||
18 | The second cell is used to specify flags: | ||
19 | bits[3:0] trigger type and level flags: | ||
20 | 1 = low-to-high edge triggered. | ||
21 | 2 = high-to-low edge triggered. | ||
22 | 4 = active high level-sensitive. | ||
23 | 8 = active low level-sensitive. | ||
24 | Valid combinations are 1, 2, 3, 4, 8. | ||
25 | |||
26 | Please refer to ../gpio/gpio.txt for a general description of GPIO bindings. | ||
27 | |||
28 | Please refer to pinctrl-bindings.txt in this directory for details of the | ||
29 | common pinctrl bindings used by client devices, including the meaning of the | ||
30 | phrase "pin configuration node". | ||
31 | |||
32 | Each pin configuration node lists the pin(s) to which it applies, and one or | ||
33 | more of the mux function to select on those pin(s), and pull-up/down | ||
34 | configuration. Each subnode only affects those parameters that are explicitly | ||
35 | listed. In other words, a subnode that lists only a mux function implies no | ||
36 | information about any pull configuration. Similarly, a subnode that lists only | ||
37 | a pul parameter implies no information about the mux function. | ||
38 | |||
39 | Required subnode-properties: | ||
40 | - brcm,pins: An array of cells. Each cell contains the ID of a pin. Valid IDs | ||
41 | are the integer GPIO IDs; 0==GPIO0, 1==GPIO1, ... 53==GPIO53. | ||
42 | |||
43 | Optional subnode-properties: | ||
44 | - brcm,function: Integer, containing the function to mux to the pin(s): | ||
45 | 0: GPIO in | ||
46 | 1: GPIO out | ||
47 | 2: alt5 | ||
48 | 3: alt4 | ||
49 | 4: alt0 | ||
50 | 5: alt1 | ||
51 | 6: alt2 | ||
52 | 7: alt3 | ||
53 | - brcm,pull: Integer, representing the pull-down/up to apply to the pin(s): | ||
54 | 0: none | ||
55 | 1: down | ||
56 | 2: up | ||
57 | |||
58 | Each of brcm,function and brcm,pull may contain either a single value which | ||
59 | will be applied to all pins in brcm,pins, or 1 value for each entry in | ||
60 | brcm,pins. | ||
61 | |||
62 | Example: | ||
63 | |||
64 | gpio: gpio { | ||
65 | compatible = "brcm,bcm2835-gpio"; | ||
66 | reg = <0x2200000 0xb4>; | ||
67 | interrupts = <2 17>, <2 19>, <2 18>, <2 20>; | ||
68 | |||
69 | gpio-controller; | ||
70 | #gpio-cells = <2>; | ||
71 | |||
72 | interrupt-controller; | ||
73 | #interrupt-cells = <2>; | ||
74 | }; | ||