diff options
author | Simon Glass <sjg@chromium.org> | 2011-05-15 07:19:44 -0700 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-24 10:01:32 -0700 |
commit | 889cf9258b29dfdbd325504b3860c6555db6766c (patch) | |
tree | 76b2711aa4c53a44a07b8478a7ef55a0c444844d /include | |
parent | 9db0f13eec6529dbd7f717fc167e9d7f72523a04 (diff) |
fdt: Add function to convert a compatible string into an ID
To select between different drivers we need to translate the compatible
string into an ID number which we can use to select between different
drivers for each function.
BUG=chromium-os:11623
TEST=build and boot U-Boot on Seaboard
Change-Id: I99a60f7e92a021cb7e23a85054e6b76cb9f2054c
Reviewed-on: http://gerrit.chromium.org/gerrit/957
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/fdt_decode.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/fdt_decode.h b/include/fdt_decode.h index b93bf3ad62b..303d5a8d332 100644 --- a/include/fdt_decode.h +++ b/include/fdt_decode.h @@ -39,6 +39,23 @@ typedef u32 addr_t; #define addr_to_cpu(reg) be32_to_cpu(reg) #endif +/** + * Compat types that we know about and for which we might have drivers. + * Each is named COMPAT_<dir>_<filename> where <dir> is the directory + * within drivers. + */ +enum fdt_compat_id { + COMPAT_UNKNOWN, + + COMPAT_COUNT, +}; + +/** compat items that we know about and might have drivers for */ +struct fdt_compat { + enum fdt_compat_id id; + const char *name; +}; + /* Information obtained about a UART from the FDT */ struct fdt_uart { addr_t reg; /* address of registers in physical memory */ @@ -51,6 +68,7 @@ struct fdt_uart { int enabled; /* 1 to enable, 0 to disable */ int interrupt; /* interrupt line */ int silent; /* 1 for silent UART (supresses output by default) */ + enum fdt_compat_id compat; /* our selected driver */ }; /** @@ -90,3 +108,10 @@ int fdt_decode_uart_console(const void *blob, struct fdt_uart *uart, * @param uart uart structure to examine and update */ void fdt_decode_uart_calc_divisor(struct fdt_uart *uart); + +/** + * Find the compat id for a node. This looks at the 'compat' property of + * the node and looks up the corresponding ftp_compat_id. This is used for + * determining which driver will implement the decide described by the node. + */ +enum fdt_compat_id fdt_decode_lookup(const void *blob, int node); |