diff options
author | Tom Rini <trini@konsulko.com> | 2020-12-14 18:57:57 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-12-14 18:57:57 -0500 |
commit | 8351a29d2df18c92d8e365cfa848218c3859f3d2 (patch) | |
tree | 5d29001be9accfb8029df9d9ed78fba196ee07b9 /drivers/pci/pci-uclass.c | |
parent | ddaa94978583d07ec515e7226e397221d8cc44c8 (diff) | |
parent | b7bbd553de0d9752f919dfc616f560f6f2504c14 (diff) |
Merge tag 'dm-pull-14dec20' of git://git.denx.de/u-boot-dm into next
Driver model tidy-up for livetree
Driver model big rename for consistency
Python 3 clean-ups for patman
Update sandbox serial driver to use membuff
Diffstat (limited to 'drivers/pci/pci-uclass.c')
-rw-r--r-- | drivers/pci/pci-uclass.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index eb07d25301..9fc13e39e8 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -49,7 +49,7 @@ struct udevice *pci_get_controller(struct udevice *dev) pci_dev_t dm_pci_get_bdf(const struct udevice *dev) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); struct udevice *bus = dev->parent; /* @@ -58,7 +58,7 @@ pci_dev_t dm_pci_get_bdf(const struct udevice *dev) * will produce a bad BDF> * * A common cause of this problem is that this function is called in the - * ofdata_to_platdata() method of @dev. Accessing the PCI bus in that + * of_to_plat() method of @dev. Accessing the PCI bus in that * method is not allowed, since it has not yet been probed. To fix this, * move that access to the probe() method of @dev instead. */ @@ -136,9 +136,9 @@ int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn, for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat && pplat->devfn == find_devfn) { *devp = dev; return 0; @@ -162,10 +162,10 @@ int dm_pci_bus_find_bdf(pci_dev_t bdf, struct udevice **devp) static int pci_device_matches_ids(struct udevice *dev, struct pci_device_id *ids) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; int i; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (!pplat) return -EINVAL; for (i = 0; ids[i].vendor != 0; i++) { @@ -218,13 +218,13 @@ static int dm_pci_bus_find_device(struct udevice *bus, unsigned int vendor, unsigned int device, int *indexp, struct udevice **devp) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; struct udevice *dev; for (device_find_first_child(bus, &dev); dev; device_find_next_child(&dev)) { - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat->vendor == vendor && pplat->device == device) { if (!(*indexp)--) { *devp = dev; @@ -261,7 +261,7 @@ int dm_pci_find_class(uint find_class, int index, struct udevice **devp) for (pci_find_first_device(&dev); dev; pci_find_next_device(&dev)) { - struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); + struct pci_child_plat *pplat = dev_get_parent_plat(dev); if (pplat->class == find_class && !index--) { *devp = dev; @@ -524,7 +524,7 @@ static void set_vga_bridge_bits(struct udevice *dev) int pci_auto_config_devices(struct udevice *bus) { struct pci_controller *hose = bus->uclass_priv; - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; unsigned int sub_bus; struct udevice *dev; int ret; @@ -548,7 +548,7 @@ int pci_auto_config_devices(struct udevice *bus) max_bus = ret; sub_bus = max(sub_bus, max_bus); - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); if (pplat->class == (PCI_CLASS_DISPLAY_VGA << 8)) set_vga_bridge_bits(dev); } @@ -744,14 +744,14 @@ static int pci_find_and_bind_driver(struct udevice *parent, /* * We could pass the descriptor to the driver as - * platdata (instead of NULL) and allow its bind() + * plat (instead of NULL) and allow its bind() * method to return -ENOENT if it doesn't support this * device. That way we could continue the search to * find another driver. For now this doesn't seem * necesssary, so just bind the first match. */ - ret = device_bind_ofnode(parent, drv, drv->name, NULL, - node, &dev); + ret = device_bind(parent, drv, drv->name, NULL, node, + &dev); if (ret) goto error; debug("%s: Match found: %s\n", __func__, drv->name); @@ -807,7 +807,7 @@ int pci_bind_bus_devices(struct udevice *bus) PCI_MAX_PCI_FUNCTIONS - 1); for (bdf = PCI_BDF(bus->seq, 0, 0); bdf <= end; bdf += PCI_BDF(0, 0, 1)) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; struct udevice *dev; ulong class; @@ -868,7 +868,7 @@ int pci_bind_bus_devices(struct udevice *bus) return ret; /* Update the platform data */ - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); pplat->devfn = PCI_MASK_BUS(bdf); pplat->vendor = vendor; pplat->device = device; @@ -1080,12 +1080,12 @@ static int pci_uclass_post_probe(struct udevice *bus) static int pci_uclass_child_post_bind(struct udevice *dev) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; if (!dev_of_valid(dev)) return 0; - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); /* Extract vendor id and device id if available */ ofnode_read_pci_vendev(dev_ofnode(dev), &pplat->vendor, &pplat->device); @@ -1441,7 +1441,7 @@ pci_addr_t dm_pci_phys_to_bus(struct udevice *dev, phys_addr_t phys_addr, } static phys_addr_t dm_pci_map_ea_virt(struct udevice *dev, int ea_off, - struct pci_child_platdata *pdata) + struct pci_child_plat *pdata) { phys_addr_t addr = 0; @@ -1472,7 +1472,7 @@ static phys_addr_t dm_pci_map_ea_virt(struct udevice *dev, int ea_off, } static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, - int ea_off, struct pci_child_platdata *pdata) + int ea_off, struct pci_child_plat *pdata) { int ea_cnt, i, entry_size; int bar_id = (bar - PCI_BASE_ADDRESS_0) >> 2; @@ -1523,7 +1523,7 @@ static void *dm_pci_map_ea_bar(struct udevice *dev, int bar, int flags, void *dm_pci_map_bar(struct udevice *dev, int bar, int flags) { - struct pci_child_platdata *pdata = dev_get_parent_platdata(dev); + struct pci_child_plat *pdata = dev_get_parent_plat(dev); struct udevice *udev = dev; pci_addr_t pci_bus_addr; u32 bar_response; @@ -1725,7 +1725,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en) bdf += PCI_BDF(0, 0, vf_offset); for (vf = 0; vf < num_vfs; vf++) { - struct pci_child_platdata *pplat; + struct pci_child_plat *pplat; ulong class; pci_bus_read_config(bus, bdf, PCI_CLASS_DEVICE, @@ -1753,7 +1753,7 @@ int pci_sriov_init(struct udevice *pdev, int vf_en) } /* Update the platform data */ - pplat = dev_get_parent_platdata(dev); + pplat = dev_get_parent_plat(dev); pplat->devfn = PCI_MASK_BUS(bdf); pplat->vendor = vendor; pplat->device = device; @@ -1796,9 +1796,8 @@ UCLASS_DRIVER(pci) = { .pre_probe = pci_uclass_pre_probe, .post_probe = pci_uclass_post_probe, .child_post_bind = pci_uclass_child_post_bind, - .per_device_auto_alloc_size = sizeof(struct pci_controller), - .per_child_platdata_auto_alloc_size = - sizeof(struct pci_child_platdata), + .per_device_auto = sizeof(struct pci_controller), + .per_child_plat_auto = sizeof(struct pci_child_plat), }; static const struct dm_pci_ops pci_bridge_ops = { |