mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-25 06:00:43 +00:00
x86: apl: Take advantage of the of-platdata parent support
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>
This commit is contained in:
parent
d07f31aea0
commit
bb44ebdd0f
2 changed files with 15 additions and 13 deletions
|
@ -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;
|
||||
|
|
|
@ -174,19 +174,20 @@ int p2sb_set_port_id(struct udevice *dev, int portid)
|
|||
if (!CONFIG_IS_ENABLED(OF_PLATDATA))
|
||||
return -ENOSYS;
|
||||
|
||||
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.
|
||||
* TODO(sjg@chromium.org): Add a parent pointer to child devices in dtoc
|
||||
* 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue