diff options
author | Simon Glass <sjg@chromium.org> | 2011-06-13 10:50:03 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:25 -0700 |
commit | 5c2fff9cbcee866dcf0ec4530cc4e0a8bef87c37 (patch) | |
tree | cfc1240cfd3da0457e040115112cade752e75cca /common/fdt_decode.c | |
parent | 36483023bfc0f5f957da787652812b1acb7d6a66 (diff) |
fdt: tegra2: Use aliases to select USB ports
USB port numbering was previously ad-hoc according to the position of the
ports in the FDT file. This change defines aliases to control this
explicitly: usb0, usb1, ...
BUG=chromium-os:11623
TEST=usb start; run usb_boot
Change-Id: Ifed6e1e9e21750bd0edf5d2bddc4afd3468ad7f4
Reviewed-on: http://gerrit.chromium.org/gerrit/2538
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'common/fdt_decode.c')
-rw-r--r-- | common/fdt_decode.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/common/fdt_decode.c b/common/fdt_decode.c index e5a3ed5e59..670fa1687b 100644 --- a/common/fdt_decode.c +++ b/common/fdt_decode.c @@ -271,6 +271,24 @@ int fdt_decode_next_compatible(const void *blob, int node, return fdt_node_offset_by_compatible(blob, node, compat_names[id]); } +int fdt_decode_next_alias(const void *blob, const char *name, + enum fdt_compat_id id, int *upto) +{ +#define MAX_STR_LEN 20 + char str[MAX_STR_LEN + 20]; + int node, err; + + sprintf(str, "%.*s%d", MAX_STR_LEN, name, *upto); + (*upto)++; + node = find_alias_node(blob, str); + if (node < 0) + return node; + err = fdt_node_check_compatible(blob, node, compat_names[id]); + if (err < 0) + return err; + return err ? -FDT_ERR_MISSING : node; +} + int fdt_decode_get_spi_switch(const void *blob, struct fdt_spi_uart *config) { int node, uart_node; |