diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-07-05 22:36:34 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:58:45 -0700 |
commit | a092cc78c20fcd1f9ee298f3ead4fa0f9f1e09e3 (patch) | |
tree | 193fe1f30d4fa8dfab61c2c1f5d401baba393314 /include/fdt_decode.h | |
parent | 61199c312d28e85cc8f0ef37d1c0692c484e8bb9 (diff) |
CHROMIUM: fdt: add gpio polarity to fdt and crossystem data
The raw gpio readings are not the logical values of true/false. A gpio
may connect to device that is either high active or low active. That is,
a raw reading of 1 from low active device actually means "false". In
this context, we refer to this as a gpio's polarity. Note that a gpio
polarity may differ board by board, depending on the actual wiring of
the board.
The u-boot and the crossystem (a user space program) needs the
polarities to correctly interpret the raw gpio readings. The crossystem
needs polarities for the gpio values in the crossystem data blob that
u-boot passes to kernel (these values are "post-interpretation").
Instead, the crossystem is required to read "current" raw gpio readings
and interpret these readings to a user.
Note: I merely copied polarity configuration to kaen and aebl, but I did
not test its correctness.
BUG=chromium-os:16508
TEST=boot on Seaboard
1. Turn on Seaboard with dev switch on and rec switch off
2. Check debug output of u-boot
----------------------------------------
cros_onestop_firmware: polarity:
cros_onestop_firmware: - wpsw: 1
cros_onestop_firmware: - recsw: 0
cros_onestop_firmware: - devsw: 1
cros_onestop_firmware: gpio value:
cros_onestop_firmware: - wpsw: 1
cros_onestop_firmware: - recsw: 0
cros_onestop_firmware: - devsw: 1
----------------------------------------
2. Check /proc/device-tree/crossystem/
----------------------------------------
$ od -x polarity_write_protect_sw
0000000 0000 0100
0000004
$ od -x polarity_recovery_sw
0000000 0000 0000
0000004
$ od -x polarity_developer_sw
0000000 0000 0100
0000004
----------------------------------------
Change-Id: Ie92c31ce0abddf0271e73669b429621deaed76dd
Reviewed-on: http://gerrit.chromium.org/gerrit/3650
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'include/fdt_decode.h')
-rw-r--r-- | include/fdt_decode.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/fdt_decode.h b/include/fdt_decode.h index 620d93ee68..15236156f8 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -385,6 +385,19 @@ int fdt_decode_sdmmc(const void *blob, int node, struct fdt_sdmmc *config); char *fdt_decode_get_config_string(const void *blob, const char *prop_name); /** + * Look in the FDT for a config item with the given name and return its value + * as a 32-bit integer. The property must have at least 4 bytes of data. The + * value of the first cell is returned. + * + * @param blob FDT blob + * @param prop_name property name to look up + * @param default_val default value to return if the property is not found + * @return integer value, if found, or default_val if not + */ +int fdt_decode_get_config_int(const void *blob, const char *prop_name, + int default_val); + +/** * Returns information from the FDT about the keboard controler. This function * reads out the following attributes: * |