]> Git Repo - J-u-boot.git/commitdiff
Merge tag 'arc-for-2018.05' of git://git.denx.de/u-boot-arc
authorTom Rini <[email protected]>
Tue, 3 Apr 2018 12:33:15 +0000 (08:33 -0400)
committerTom Rini <[email protected]>
Tue, 3 Apr 2018 12:33:15 +0000 (08:33 -0400)
More ARC changes and fixes for v2018.05

 * Update of ARC tools to the most recent arc-2017.09
 * Fix for compile-time warning for AXS10x
 * Add support of platform-specific commands for HSDK
 * Add support for on-board SPI flash on HSDK
   Note though that for write support another series [1]
   is required. I hope that Jagan will be able to review and
   act on SPI flash improvement series before we get beyond RC1.

   Also note that to get clean build for HSDK we need to disable
   stack-usage check [2] as our current GCC erroneously tries to calculate
   stack-usage on a naked function which leads to warning.

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=35796
[2] https://patchwork.ozlabs.org/patch/894139/

16 files changed:
Makefile
arch/sandbox/dts/test.dts
cmd/cbfs.c
common/image-fdt.c
drivers/core/fdtaddr.c
drivers/core/ofnode.c
drivers/core/root.c
drivers/core/uclass.c
drivers/pinctrl/pinctrl-uclass.c
fs/cbfs/cbfs.c
include/dm/uclass-id.h
include/dm/uclass.h
include/image.h
include/linux/libfdt.h
lib/libfdt/fdt_region.c
test/dm/test-fdt.c

index 5fa14789d99f7f265385029fa55954a9157e05ae..5ab6be8889cab0a6eb5e3d86912684c3315bf2b0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,9 +3,9 @@
 #
 
 VERSION = 2018
-PATCHLEVEL = 03
+PATCHLEVEL = 05
 SUBLEVEL =
-EXTRAVERSION =
+EXTRAVERSION = -rc1
 NAME =
 
 # *DOCUMENTATION*
index b0f0ca8f19ce9104c58737ff8840aca58f26dfb3..06d0e8ce8506ae28add3fe8064c52b3583a409b9 100644 (file)
                testfdt3 = "/b-test";
                testfdt5 = "/some-bus/c-test@5";
                testfdt8 = "/a-test";
+               fdt_dummy0 = "/translation-test@8000/dev@0,0";
+               fdt_dummy1 = "/translation-test@8000/dev@1,100";
+               fdt_dummy2 = "/translation-test@8000/dev@2,200";
+               fdt_dummy3 = "/translation-test@8000/noxlatebus@3,300/dev@42";
                usb0 = &usb_0;
                usb1 = &usb_1;
                usb2 = &usb_2;
                        reg = <9 1>;
                };
        };
+
+       translation-test@8000 {
+               compatible = "simple-bus";
+               reg = <0x8000 0x4000>;
+
+               #address-cells = <0x2>;
+               #size-cells = <0x1>;
+
+               ranges = <0 0x0 0x8000 0x1000
+                         1 0x100 0x9000 0x1000
+                         2 0x200 0xA000 0x1000
+                         3 0x300 0xB000 0x1000
+                        >;
+
+               dev@0,0 {
+                       compatible = "denx,u-boot-fdt-dummy";
+                       reg = <0 0x0 0x1000>;
+               };
+
+               dev@1,100 {
+                       compatible = "denx,u-boot-fdt-dummy";
+                       reg = <1 0x100 0x1000>;
+
+               };
+
+               dev@2,200 {
+                       compatible = "denx,u-boot-fdt-dummy";
+                       reg = <2 0x200 0x1000>;
+               };
+
+
+               noxlatebus@3,300 {
+                       compatible = "simple-bus";
+                       reg = <3 0x300 0x1000>;
+
+                       #address-cells = <0x1>;
+                       #size-cells = <0x0>;
+
+                       dev@42 {
+                               compatible = "denx,u-boot-fdt-dummy";
+                               reg = <0x42>;
+                       };
+               };
+       };
 };
 
 #include "sandbox_pmic.dtsi"
index 799ba01fcc8efbfb14a6a5b5f80947e37cb23d22..736f8c4527dfb9807a7edc7443676b6869a55585 100644 (file)
@@ -22,7 +22,7 @@ static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
                return 0;
        }
        if (argc == 2) {
-               end_of_rom = (int)simple_strtoul(argv[1], &ep, 16);
+               end_of_rom = simple_strtoul(argv[1], &ep, 16);
                if (*ep) {
                        puts("\n** Invalid end of ROM **\n");
                        return 1;
index 25103ba3b5d9debdd254631b47e78705a0a0b925..3dc02a12191d515fc19e10ba3abfe8c55633d234 100644 (file)
@@ -21,6 +21,9 @@
 #define CONFIG_SYS_FDT_PAD 0x3000
 #endif
 
+/* adding a ramdisk needs 0x44 bytes in version 2008.10 */
+#define FDT_RAMDISK_OVERHEAD   0x80
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static void fdt_error(const char *msg)
index 3847dd836e30540b8a03406f7c623fbbd1bc811b..9a3b4c312af9f8eba5f0d29c8e7a9fe8122dc151 100644 (file)
@@ -49,12 +49,17 @@ fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index)
 
                reg += index * (na + ns);
 
-               /*
-                * Use the full-fledged translate function for complex
-                * bus setups.
-                */
-               addr = fdt_translate_address((void *)gd->fdt_blob,
-                                            dev_of_offset(dev), reg);
+               if (ns) {
+                       /*
+                        * Use the full-fledged translate function for complex
+                        * bus setups.
+                        */
+                       addr = fdt_translate_address((void *)gd->fdt_blob,
+                                                    dev_of_offset(dev), reg);
+               } else {
+                       /* Non translatable if #size-cells == 0 */
+                       addr = fdt_read_number(reg, na);
+               }
        } else {
                /*
                 * Use the "simple" translate function for less complex
index 4e4532651fca608ae96a0d4d7b2e8bb28bacd44f..5909a25f85645bb61f1b1b7ea58d4cbc690306ab 100644 (file)
@@ -227,13 +227,16 @@ fdt_addr_t ofnode_get_addr_index(ofnode node, int index)
                uint flags;
                u64 size;
                int na;
+               int ns;
 
                prop_val = of_get_address(ofnode_to_np(node), index, &size,
                                          &flags);
                if (!prop_val)
                        return FDT_ADDR_T_NONE;
 
-               if (IS_ENABLED(CONFIG_OF_TRANSLATE)) {
+               ns = of_n_size_cells(ofnode_to_np(node));
+
+               if (IS_ENABLED(CONFIG_OF_TRANSLATE) && ns > 0) {
                        return of_translate_address(ofnode_to_np(node), prop_val);
                } else {
                        na = of_n_addr_cells(ofnode_to_np(node));
index 3a426ab4b75f9e98ce71d7ead042aa5c7851ff28..9000ed55ca583f0c84abe81e0c209e8240fad6e2 100644 (file)
@@ -333,7 +333,8 @@ static int dm_scan_fdt_node(struct udevice *parent, const void *blob,
 
 int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
 {
-       int node, ret;
+       int ret;
+       ofnode node;
 
        ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
        if (ret) {
@@ -342,13 +343,18 @@ int dm_extended_scan_fdt(const void *blob, bool pre_reloc_only)
        }
 
        /* bind fixed-clock */
-       node = ofnode_to_offset(ofnode_path("/clocks"));
+       node = ofnode_path("/clocks");
        /* if no DT "clocks" node, no need to go further */
-       if (node < 0)
+       if (!ofnode_valid(node))
                return ret;
 
-       ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node,
-                              pre_reloc_only);
+#if CONFIG_IS_ENABLED(OF_LIVE)
+       if (of_live_active())
+               ret = dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only);
+       else
+#endif
+               ret = dm_scan_fdt_node(gd->dm_root, gd->fdt_blob, node.of_offset,
+                                      pre_reloc_only);
        if (ret)
                debug("dm_scan_fdt_node() failed: %d\n", ret);
 
index 1aedaa08f0c2ee4058d9ddf9054ee03db45937a0..628e2e13ff61c7c22168d0ec6336143152c6ce2e 100644 (file)
@@ -457,6 +457,32 @@ int uclass_get_device_by_ofnode(enum uclass_id id, ofnode node,
 }
 
 #if CONFIG_IS_ENABLED(OF_CONTROL)
+int uclass_get_device_by_phandle_id(enum uclass_id id, uint phandle_id,
+                                   struct udevice **devp)
+{
+       struct udevice *dev;
+       struct uclass *uc;
+       int ret;
+
+       *devp = NULL;
+       ret = uclass_get(id, &uc);
+       if (ret)
+               return ret;
+
+       list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+               uint phandle;
+
+               phandle = dev_read_phandle(dev);
+
+               if (phandle == phandle_id) {
+                       *devp = dev;
+                       return uclass_get_device_tail(dev, ret, devp);
+               }
+       }
+
+       return -ENODEV;
+}
+
 int uclass_get_device_by_phandle(enum uclass_id id, struct udevice *parent,
                                 const char *name, struct udevice **devp)
 {
index 6a73a0679b0a2caca9d675a73af5bebf669bbd99..a0a326a142f0aeb2ed06c5f8c61702e8b1927733 100644 (file)
@@ -12,6 +12,7 @@
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
 #include <dm/util.h>
+#include <dm/of_access.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -63,16 +64,13 @@ static int pinctrl_config_one(struct udevice *config)
  */
 static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
 {
-       const void *fdt = gd->fdt_blob;
-       int node = dev_of_offset(dev);
        char propname[32]; /* long enough */
        const fdt32_t *list;
        uint32_t phandle;
-       int config_node;
        struct udevice *config;
        int state, size, i, ret;
 
-       state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
+       state = dev_read_stringlist_search(dev, "pinctrl-names", statename);
        if (state < 0) {
                char *end;
                /*
@@ -85,22 +83,15 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
        }
 
        snprintf(propname, sizeof(propname), "pinctrl-%d", state);
-       list = fdt_getprop(fdt, node, propname, &size);
+       list = dev_read_prop(dev, propname, &size);
        if (!list)
                return -EINVAL;
 
        size /= sizeof(*list);
        for (i = 0; i < size; i++) {
                phandle = fdt32_to_cpu(*list++);
-
-               config_node = fdt_node_offset_by_phandle(fdt, phandle);
-               if (config_node < 0) {
-                       dev_err(dev, "prop %s index %d invalid phandle\n",
-                               propname, i);
-                       return -EINVAL;
-               }
-               ret = uclass_get_device_by_of_offset(UCLASS_PINCONFIG,
-                                                    config_node, &config);
+               ret = uclass_get_device_by_phandle_id(UCLASS_PINCONFIG, phandle,
+                                                     &config);
                if (ret)
                        return ret;
 
index 6e1107d751bc63b7c0603bda218234c41d8cd03d..46da8f134fa77aecf9e48f7a5921186cdcd5bfe5 100644 (file)
@@ -168,9 +168,9 @@ static int file_cbfs_load_header(uintptr_t end_of_rom,
                                 struct cbfs_header *header)
 {
        struct cbfs_header *header_in_rom;
+       int32_t offset = *(u32 *)(end_of_rom - 3);
 
-       header_in_rom = (struct cbfs_header *)(uintptr_t)
-                       *(u32 *)(end_of_rom - 3);
+       header_in_rom = (struct cbfs_header *)(end_of_rom + offset + 1);
        swap_header(header, header_in_rom);
 
        if (header->magic != good_magic || header->offset >
index 07fabc3ce6cf67d0dc45c85ef598ecd6247c41d7..d28fb3e23f01f78e746c13c17c25bb11df33d448 100644 (file)
@@ -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 */
index 3a01abc239ea9d48d869361c871939634cf24fa3..a5bf3eb831868b7f5e3efd75e2d505da4078df37 100644 (file)
@@ -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
  *
index 621abf647f3b5d7710f24183b70fe8284fae7e68..a6f82aebfee024366e3ea11c90d7ed9c8d6c0893 100644 (file)
@@ -21,6 +21,7 @@
 
 /* Define this to avoid #ifdefs later on */
 struct lmb;
+struct fdt_region;
 
 #ifdef USE_HOSTCC
 #include <sys/types.h>
index 9e6eeadc400f86a66b19fc557a3194c641f8ce3c..eeb2344971f3ff9489ae454647bb4f951bf170df 100644 (file)
@@ -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_ */
index 70914a4e9b6039e9b0fc308cbbd8232379b8bf5b..054c4b302f44a5facfeb51e6b2065051bdd07e38 100644 (file)
@@ -14,8 +14,6 @@
 #include "fdt_host.h"
 #endif
 
-#include "libfdt_internal.h"
-
 #define FDT_MAX_DEPTH  32
 
 static int str_in_list(const char *str, char * const list[], int count)
index 920ccbf016dc291e93c2bf5ea2c1a4123d60381c..0d11bfdb2f97dd19fc021573a734c054a6c43b04 100644 (file)
@@ -419,3 +419,46 @@ static int dm_test_first_next_ok_device(struct unit_test_state *uts)
        return 0;
 }
 DM_TEST(dm_test_first_next_ok_device, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+static const struct udevice_id fdt_dummy_ids[] = {
+       { .compatible = "denx,u-boot-fdt-dummy", },
+       { }
+};
+
+UCLASS_DRIVER(fdt_dummy) = {
+       .name           = "fdt_dummy",
+       .id             = UCLASS_TEST_DUMMY,
+       .flags          = DM_UC_FLAG_SEQ_ALIAS,
+};
+
+U_BOOT_DRIVER(fdt_dummy_drv) = {
+       .name   = "fdt_dummy_drv",
+       .of_match       = fdt_dummy_ids,
+       .id     = UCLASS_TEST_DUMMY,
+};
+
+static int dm_test_fdt_translation(struct unit_test_state *uts)
+{
+       struct udevice *dev;
+
+       /* Some simple translations */
+       ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 0, true, &dev));
+       ut_asserteq_str("dev@0,0", dev->name);
+       ut_asserteq(0x8000, dev_read_addr(dev));
+
+       ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 1, true, &dev));
+       ut_asserteq_str("dev@1,100", dev->name);
+       ut_asserteq(0x9000, dev_read_addr(dev));
+
+       ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 2, true, &dev));
+       ut_asserteq_str("dev@2,200", dev->name);
+       ut_asserteq(0xA000, dev_read_addr(dev));
+
+       /* No translation for busses with #size-cells == 0 */
+       ut_assertok(uclass_find_device_by_seq(UCLASS_TEST_DUMMY, 3, true, &dev));
+       ut_asserteq_str("dev@42", dev->name);
+       ut_asserteq(0x42, dev_read_addr(dev));
+
+       return 0;
+}
+DM_TEST(dm_test_fdt_translation, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
This page took 0.061127 seconds and 4 git commands to generate.