]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
x86: apl: Take advantage of the of-platdata parent support
authorSimon Glass <sjg@chromium.org>
Sat, 3 Oct 2020 17:31:39 +0000 (11:31 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 29 Oct 2020 20:42:18 +0000 (14:42 -0600)
Now that parent devices are supported with of-platadata, we don't need the
messy code to fix up the parent pointers and allocations on Apollo Lake.
Put the code behind a condition.

Signed-off-by: Simon Glass <sjg@chromium.org>
arch/x86/cpu/apollolake/spl.c
drivers/misc/p2sb-uclass.c

index 5a53831dc6a47f2b15f5d846f00836bd92dc03e1..089b37c59f8f3f6f17b1e74c707f026c7bb55260 100644 (file)
@@ -90,7 +90,8 @@ static int apl_flash_probe(struct udevice *dev)
  */
 static int apl_flash_bind(struct udevice *dev)
 {
-       if (CONFIG_IS_ENABLED(OF_PLATDATA)) {
+       if (CONFIG_IS_ENABLED(OF_PLATDATA) &&
+           !CONFIG_IS_ENABLED(OF_PLATDATA_PARENT)) {
                struct dm_spi_slave_platdata *plat;
                struct udevice *spi;
                int ret;
index b5219df46be28a96bb3b84f4d7309600bc5b7a58..12abcff2da405adf98e3ee6f917642a34dc05db7 100644 (file)
@@ -174,19 +174,20 @@ int p2sb_set_port_id(struct udevice *dev, int portid)
        if (!CONFIG_IS_ENABLED(OF_PLATDATA))
                return -ENOSYS;
 
-       uclass_find_first_device(UCLASS_P2SB, &ps2b);
-       if (!ps2b)
-               return -EDEADLK;
-       dev->parent = ps2b;
-
-       /*
-        * We must allocate this, since when the device was bound it did not
-        * have a parent.
-        * TODO(sjg@chromium.org): Add a parent pointer to child devices in dtoc
-        */
-       dev->parent_platdata = malloc(sizeof(*pplat));
-       if (!dev->parent_platdata)
-               return -ENOMEM;
+       if (!CONFIG_IS_ENABLED(OF_PLATDATA_PARENT)) {
+               uclass_find_first_device(UCLASS_P2SB, &ps2b);
+               if (!ps2b)
+                       return -EDEADLK;
+               dev->parent = ps2b;
+
+               /*
+                * We must allocate this, since when the device was bound it did
+                * not have a parent.
+                */
+               dev->parent_platdata = malloc(sizeof(*pplat));
+               if (!dev->parent_platdata)
+                       return -ENOMEM;
+       }
        pplat = dev_get_parent_platdata(dev);
        pplat->pid = portid;