From d255fade66414271950ab605098439591a67f1ed Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Fri, 9 Feb 2018 10:56:23 +0800 Subject: core: add uclass_get_device_by_phandle_id() api Add api for who can not get phandle from a device property. Signed-off-by: Kever Yang Reviewed-by: Philipp Tomsich --- include/dm/uclass.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'include') diff --git a/include/dm/uclass.h b/include/dm/uclass.h index 3a01abc239e..a5bf3eb8318 100644 --- a/include/dm/uclass.h +++ b/include/dm/uclass.h @@ -210,6 +210,22 @@ int uclass_get_device_by_of_offset(enum uclass_id id, int node, int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node, struct udevice **devp); +/** + * uclass_get_device_by_phandle_id() - Get a uclass device by phandle id + * + * This searches the devices in the uclass for one with the given phandle id. + * + * The device is probed to activate it ready for use. + * + * @id: uclass ID to look up + * @phandle_id: the phandle id to look up + * @devp: Returns pointer to device (there is only one for each node) + * @return 0 if OK, -ENODEV if there is no device match the phandle, other + * -ve on error + */ +int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id, + struct udevice **devp); + /** * uclass_get_device_by_phandle() - Get a uclass device by phandle * -- cgit v1.2.3 From e8d5291824e27575fe71222f683579325221e0cb Mon Sep 17 00:00:00 2001 From: Mario Six Date: Mon, 12 Mar 2018 14:53:33 +0100 Subject: core: ofnode: Fix translation for #size-cells == 0 Commit 286ede6 ("drivers: core: Add translation in live tree case") made dev_get_addr always use proper bus translations for addresses read from the device tree. But this leads to problems with certain busses, e.g. I2C busses, which run into an error during translation, and hence stop working. It turns out that of_translate_address() and fdt_translate_address() stop the address translation with an error when they're asked to translate addresses for busses where #size-cells == 0 (comment from drivers/core/of_addr.c): * Note: We consider that crossing any level with #size-cells == 0 to mean * that translation is impossible (that is we are not dealing with a value * that can be mapped to a cpu physical address). This is not really specified * that way, but this is traditionally the way IBM at least do things To fix this case, we check in both the live-tree and non-live tree-case, whether the bus of the device whose address is about to be translated has size-cell size zero. If this is the case, we just read the address as a plain integer and return it, and only apply bus translations if the size-cell size if greater than zero. Signed-off-by: Mario Six Signed-off-by: Martin Fuzzey Reported-by: Martin Fuzzey Fixes: 286ede6 ("drivers: core: Add translation in live tree case") Reviewed-by: Simon Glass --- include/dm/uclass-id.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h index 07fabc3ce6c..d28fb3e23f0 100644 --- a/include/dm/uclass-id.h +++ b/include/dm/uclass-id.h @@ -19,6 +19,7 @@ enum uclass_id { UCLASS_TEST_FDT, UCLASS_TEST_BUS, UCLASS_TEST_PROBE, + UCLASS_TEST_DUMMY, UCLASS_SPI_EMUL, /* sandbox SPI device emulator */ UCLASS_I2C_EMUL, /* sandbox I2C device emulator */ UCLASS_PCI_EMUL, /* sandbox PCI device emulator */ -- cgit v1.2.3 From c960a68e200057b0e8b3aa627aa4b0c9b31ca2d8 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 21 Mar 2018 18:03:33 +0900 Subject: libfdt: move FDT_RAMDISK_OVERHEAD to image-fdt.c This macro is locally referenced in common/image-fdt.c Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- include/linux/libfdt.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'include') diff --git a/include/linux/libfdt.h b/include/linux/libfdt.h index 9e6eeadc400..eeb2344971f 100644 --- a/include/linux/libfdt.h +++ b/include/linux/libfdt.h @@ -309,7 +309,4 @@ int fdt_add_alias_regions(const void *fdt, struct fdt_region *region, int count, extern struct fdt_header *working_fdt; /* Pointer to the working fdt */ -/* adding a ramdisk needs 0x44 bytes in version 2008.10 */ -#define FDT_RAMDISK_OVERHEAD 0x80 - #endif /* _INCLUDE_LIBFDT_H_ */ -- cgit v1.2.3 From 641599a63df258c3e3cb259c75cdada0cc009d56 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Wed, 21 Mar 2018 18:03:35 +0900 Subject: image.h: add forward declaration of struct fdt_region This header needs to know 'fdt_region' is a struct for the fit_region_make_list() prototype. Signed-off-by: Masahiro Yamada Reviewed-by: Simon Glass --- include/image.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/image.h b/include/image.h index 621abf647f3..a6f82aebfee 100644 --- a/include/image.h +++ b/include/image.h @@ -21,6 +21,7 @@ /* Define this to avoid #ifdefs later on */ struct lmb; +struct fdt_region; #ifdef USE_HOSTCC #include -- cgit v1.2.3