diff options
42 files changed, 5977 insertions, 250 deletions
diff --git a/Documentation/arm/00-INDEX b/Documentation/arm/00-INDEX index 7f5fc3ba9c91..ecf7d04bca26 100644 --- a/Documentation/arm/00-INDEX +++ b/Documentation/arm/00-INDEX | |||
| @@ -6,6 +6,8 @@ Interrupts | |||
| 6 | - ARM Interrupt subsystem documentation | 6 | - ARM Interrupt subsystem documentation |
| 7 | IXP2000 | 7 | IXP2000 |
| 8 | - Release Notes for Linux on Intel's IXP2000 Network Processor | 8 | - Release Notes for Linux on Intel's IXP2000 Network Processor |
| 9 | msm | ||
| 10 | - MSM specific documentation | ||
| 9 | Netwinder | 11 | Netwinder |
| 10 | - Netwinder specific documentation | 12 | - Netwinder specific documentation |
| 11 | Porting | 13 | Porting |
diff --git a/Documentation/arm/msm/gpiomux.txt b/Documentation/arm/msm/gpiomux.txt new file mode 100644 index 000000000000..67a81620adf6 --- /dev/null +++ b/Documentation/arm/msm/gpiomux.txt | |||
| @@ -0,0 +1,176 @@ | |||
| 1 | This document provides an overview of the msm_gpiomux interface, which | ||
| 2 | is used to provide gpio pin multiplexing and configuration on mach-msm | ||
| 3 | targets. | ||
| 4 | |||
| 5 | History | ||
| 6 | ======= | ||
| 7 | |||
| 8 | The first-generation API for gpio configuration & multiplexing on msm | ||
| 9 | is the function gpio_tlmm_config(). This function has a few notable | ||
| 10 | shortcomings, which led to its deprecation and replacement by gpiomux: | ||
| 11 | |||
| 12 | The 'disable' parameter: Setting the second parameter to | ||
| 13 | gpio_tlmm_config to GPIO_CFG_DISABLE tells the peripheral | ||
| 14 | processor in charge of the subsystem to perform a look-up into a | ||
| 15 | low-power table and apply the low-power/sleep setting for the pin. | ||
| 16 | As the msm family evolved this became problematic. Not all pins | ||
| 17 | have sleep settings, not all peripheral processors will accept requests | ||
| 18 | to apply said sleep settings, and not all msm targets have their gpio | ||
| 19 | subsystems managed by a peripheral processor. In order to get consistent | ||
| 20 | behavior on all targets, drivers are forced to ignore this parameter, | ||
| 21 | rendering it useless. | ||
| 22 | |||
| 23 | The 'direction' flag: for all mux-settings other than raw-gpio (0), | ||
| 24 | the output-enable bit of a gpio is hard-wired to a known | ||
| 25 | input (usually VDD or ground). For those settings, the direction flag | ||
| 26 | is meaningless at best, and deceptive at worst. In addition, using the | ||
| 27 | direction flag to change output-enable (OE) directly can cause trouble in | ||
| 28 | gpiolib, which has no visibility into gpio direction changes made | ||
| 29 | in this way. Direction control in gpio mode should be made through gpiolib. | ||
| 30 | |||
| 31 | Key Features of gpiomux | ||
| 32 | ======================= | ||
| 33 | |||
| 34 | - A consistent interface across all generations of msm. Drivers can expect | ||
| 35 | the same results on every target. | ||
| 36 | - gpiomux plays nicely with gpiolib. Functions that should belong to gpiolib | ||
| 37 | are left to gpiolib and not duplicated here. gpiomux is written with the | ||
| 38 | intent that gpio_chips will call gpiomux reference-counting methods | ||
| 39 | from their request() and free() hooks, providing full integration. | ||
| 40 | - Tabular configuration. Instead of having to call gpio_tlmm_config | ||
| 41 | hundreds of times, gpio configuration is placed in a single table. | ||
| 42 | - Per-gpio sleep. Each gpio is individually reference counted, allowing only | ||
| 43 | those lines which are in use to be put in high-power states. | ||
| 44 | - 0 means 'do nothing': all flags are designed so that the default memset-zero | ||
| 45 | equates to a sensible default of 'no configuration', preventing users | ||
| 46 | from having to provide hundreds of 'no-op' configs for unused or | ||
| 47 | unwanted lines. | ||
| 48 | |||
| 49 | Usage | ||
| 50 | ===== | ||
| 51 | |||
| 52 | To use gpiomux, provide configuration information for relevant gpio lines | ||
| 53 | in the msm_gpiomux_configs table. Since a 0 equates to "unconfigured", | ||
| 54 | only those lines to be managed by gpiomux need to be specified. Here | ||
| 55 | is a completely fictional example: | ||
| 56 | |||
| 57 | struct msm_gpiomux_config msm_gpiomux_configs[GPIOMUX_NGPIOS] = { | ||
| 58 | [12] = { | ||
| 59 | .active = GPIOMUX_VALID | GPIOMUX_DRV_8MA | GPIOMUX_FUNC_1, | ||
| 60 | .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, | ||
| 61 | }, | ||
| 62 | [34] = { | ||
| 63 | .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, | ||
| 64 | }, | ||
| 65 | }; | ||
| 66 | |||
| 67 | To indicate that a gpio is in use, call msm_gpiomux_get() to increase | ||
| 68 | its reference count. To decrease the reference count, call msm_gpiomux_put(). | ||
| 69 | |||
| 70 | The effect of this configuration is as follows: | ||
| 71 | |||
| 72 | When the system boots, gpios 12 and 34 will be initialized with their | ||
| 73 | 'suspended' configurations. All other gpios, which were left unconfigured, | ||
| 74 | will not be touched. | ||
| 75 | |||
| 76 | When msm_gpiomux_get() is called on gpio 12 to raise its reference count | ||
| 77 | above 0, its active configuration will be applied. Since no other gpio | ||
| 78 | line has a valid active configuration, msm_gpiomux_get() will have no | ||
| 79 | effect on any other line. | ||
| 80 | |||
| 81 | When msm_gpiomux_put() is called on gpio 12 or 34 to drop their reference | ||
| 82 | count to 0, their suspended configurations will be applied. | ||
| 83 | Since no other gpio line has a valid suspended configuration, no other | ||
| 84 | gpio line will be effected by msm_gpiomux_put(). Since gpio 34 has no valid | ||
| 85 | active configuration, this is effectively a no-op for gpio 34 as well, | ||
| 86 | with one small caveat, see the section "About Output-Enable Settings". | ||
| 87 | |||
| 88 | All of the GPIOMUX_VALID flags may seem like unnecessary overhead, but | ||
| 89 | they address some important issues. As unused entries (all those | ||
| 90 | except 12 and 34) are zero-filled, gpiomux needs a way to distinguish | ||
| 91 | the used fields from the unused. In addition, the all-zero pattern | ||
| 92 | is a valid configuration! Therefore, gpiomux defines an additional bit | ||
| 93 | which is used to indicate when a field is used. This has the pleasant | ||
| 94 | side-effect of allowing calls to msm_gpiomux_write to use '0' to indicate | ||
| 95 | that a value should not be changed: | ||
| 96 | |||
| 97 | msm_gpiomux_write(0, GPIOMUX_VALID, 0); | ||
| 98 | |||
| 99 | replaces the active configuration of gpio 0 with an all-zero configuration, | ||
| 100 | but leaves the suspended configuration as it was. | ||
| 101 | |||
| 102 | Static Configurations | ||
| 103 | ===================== | ||
| 104 | |||
| 105 | To install a static configuration, which is applied at boot and does | ||
| 106 | not change after that, install a configuration with a suspended component | ||
| 107 | but no active component, as in the previous example: | ||
| 108 | |||
| 109 | [34] = { | ||
| 110 | .suspended = GPIOMUX_VALID | GPIOMUX_PULL_DOWN, | ||
| 111 | }, | ||
| 112 | |||
| 113 | The suspended setting is applied during boot, and the lack of any valid | ||
| 114 | active setting prevents any other setting from being applied at runtime. | ||
| 115 | If other subsystems attempting to access the line is a concern, one could | ||
| 116 | *really* anchor the configuration down by calling msm_gpiomux_get on the | ||
| 117 | line at initialization to move the line into active mode. With the line | ||
| 118 | held, it will never be re-suspended, and with no valid active configuration, | ||
| 119 | no new configurations will be applied. | ||
| 120 | |||
| 121 | But then, if having other subsystems grabbing for the line is truly a concern, | ||
| 122 | it should be reserved with gpio_request instead, which carries an implicit | ||
| 123 | msm_gpiomux_get. | ||
| 124 | |||
| 125 | gpiomux and gpiolib | ||
| 126 | =================== | ||
| 127 | |||
