mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 00:47:26 +00:00
dm: pci: Add a dm_ prefix to pci_get_bdf()
Most driver model PCI functions have a dm_ prefix. At some point, when the old code is converted to driver model and the old functions are removed, we will drop that prefix. For consistency, we should use the dm_ prefix for all driver model functions. Update pci_get_bdf() accordingly. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
2b81e8a3c8
commit
21ccce1ba5
8 changed files with 19 additions and 17 deletions
|
@ -584,7 +584,7 @@ static int designware_eth_probe(struct udevice *dev)
|
||||||
* or via a PCI bridge, fill in platdata before we probe the hardware.
|
* or via a PCI bridge, fill in platdata before we probe the hardware.
|
||||||
*/
|
*/
|
||||||
if (device_is_on_pci_bus(dev)) {
|
if (device_is_on_pci_bus(dev)) {
|
||||||
pci_dev_t bdf = pci_get_bdf(dev);
|
pci_dev_t bdf = dm_pci_get_bdf(dev);
|
||||||
|
|
||||||
dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &iobase);
|
dm_pci_read_config32(dev, PCI_BASE_ADDRESS_0, &iobase);
|
||||||
iobase &= PCI_BASE_ADDRESS_MEM_MASK;
|
iobase &= PCI_BASE_ADDRESS_MEM_MASK;
|
||||||
|
|
|
@ -5628,8 +5628,8 @@ static int e1000_eth_probe(struct udevice *dev)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
hw->name = dev->name;
|
hw->name = dev->name;
|
||||||
ret = e1000_init_one(hw, trailing_strtol(dev->name), pci_get_bdf(dev),
|
ret = e1000_init_one(hw, trailing_strtol(dev->name),
|
||||||
plat->enetaddr);
|
dm_pci_get_bdf(dev), plat->enetaddr);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf(pr_fmt("failed to initialize card: %d\n"), ret);
|
printf(pr_fmt("failed to initialize card: %d\n"), ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -424,7 +424,7 @@ int pch_gbe_probe(struct udevice *dev)
|
||||||
pci_dev_t devno;
|
pci_dev_t devno;
|
||||||
u32 iobase;
|
u32 iobase;
|
||||||
|
|
||||||
devno = pci_get_bdf(dev);
|
devno = dm_pci_get_bdf(dev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The priv structure contains the descriptors and frame buffers which
|
* The priv structure contains the descriptors and frame buffers which
|
||||||
|
|
|
@ -576,7 +576,7 @@ int rtl8169_eth_recv(struct udevice *dev, int flags, uchar **packetp)
|
||||||
{
|
{
|
||||||
struct rtl8169_private *priv = dev_get_priv(dev);
|
struct rtl8169_private *priv = dev_get_priv(dev);
|
||||||
|
|
||||||
return rtl_recv_common(pci_get_bdf(dev), priv->iobase, packetp);
|
return rtl_recv_common(dm_pci_get_bdf(dev), priv->iobase, packetp);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static int rtl_recv(struct eth_device *dev)
|
static int rtl_recv(struct eth_device *dev)
|
||||||
|
@ -661,7 +661,8 @@ int rtl8169_eth_send(struct udevice *dev, void *packet, int length)
|
||||||
{
|
{
|
||||||
struct rtl8169_private *priv = dev_get_priv(dev);
|
struct rtl8169_private *priv = dev_get_priv(dev);
|
||||||
|
|
||||||
return rtl_send_common(pci_get_bdf(dev), priv->iobase, packet, length);
|
return rtl_send_common(dm_pci_get_bdf(dev), priv->iobase, packet,
|
||||||
|
length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -837,7 +838,7 @@ static int rtl8169_eth_start(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct eth_pdata *plat = dev_get_platdata(dev);
|
struct eth_pdata *plat = dev_get_platdata(dev);
|
||||||
|
|
||||||
rtl8169_common_start(pci_get_bdf(dev), plat->enetaddr);
|
rtl8169_common_start(dm_pci_get_bdf(dev), plat->enetaddr);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1130,10 +1131,10 @@ static int rtl8169_eth_probe(struct udevice *dev)
|
||||||
region = 1;
|
region = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pci_read_config32(pci_get_bdf(dev), PCI_BASE_ADDRESS_0 + region * 4,
|
pci_read_config32(dm_pci_get_bdf(dev), PCI_BASE_ADDRESS_0 + region * 4,
|
||||||
&iobase);
|
&iobase);
|
||||||
iobase &= ~0xf;
|
iobase &= ~0xf;
|
||||||
priv->iobase = (int)pci_mem_to_phys(pci_get_bdf(dev), iobase);
|
priv->iobase = (int)pci_mem_to_phys(dm_pci_get_bdf(dev), iobase);
|
||||||
|
|
||||||
ret = rtl_init(priv->iobase, dev->name, plat->enetaddr);
|
ret = rtl_init(priv->iobase, dev->name, plat->enetaddr);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
|
|
|
@ -61,7 +61,7 @@ struct udevice *pci_get_controller(struct udevice *dev)
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
pci_dev_t pci_get_bdf(struct udevice *dev)
|
pci_dev_t dm_pci_get_bdf(struct udevice *dev)
|
||||||
{
|
{
|
||||||
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
|
struct pci_child_platdata *pplat = dev_get_parent_platdata(dev);
|
||||||
struct udevice *bus = dev->parent;
|
struct udevice *bus = dev->parent;
|
||||||
|
@ -225,7 +225,8 @@ int dm_pci_write_config(struct udevice *dev, int offset, unsigned long value,
|
||||||
|
|
||||||
for (bus = dev; device_is_on_pci_bus(bus);)
|
for (bus = dev; device_is_on_pci_bus(bus);)
|
||||||
bus = bus->parent;
|
bus = bus->parent;
|
||||||
return pci_bus_write_config(bus, pci_get_bdf(dev), offset, value, size);
|
return pci_bus_write_config(bus, dm_pci_get_bdf(dev), offset, value,
|
||||||
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -290,7 +291,7 @@ int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep,
|
||||||
|
|
||||||
for (bus = dev; device_is_on_pci_bus(bus);)
|
for (bus = dev; device_is_on_pci_bus(bus);)
|
||||||
bus = bus->parent;
|
bus = bus->parent;
|
||||||
return pci_bus_read_config(bus, pci_get_bdf(dev), offset, valuep,
|
return pci_bus_read_config(bus, dm_pci_get_bdf(dev), offset, valuep,
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,7 +404,7 @@ int pci_auto_config_devices(struct udevice *bus)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
debug("%s: device %s\n", __func__, dev->name);
|
debug("%s: device %s\n", __func__, dev->name);
|
||||||
ret = pciauto_config_device(hose, pci_get_bdf(dev));
|
ret = pciauto_config_device(hose, dm_pci_get_bdf(dev));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
max_bus = ret;
|
max_bus = ret;
|
||||||
|
|
|
@ -34,5 +34,5 @@ pci_dev_t pci_find_devices(struct pci_device_id *ids, int index)
|
||||||
|
|
||||||
if (pci_find_device_id(ids, index, &dev))
|
if (pci_find_device_id(ids, index, &dev))
|
||||||
return -1;
|
return -1;
|
||||||
return pci_get_bdf(dev);
|
return dm_pci_get_bdf(dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ static int ehci_pci_probe(struct udevice *dev)
|
||||||
struct ehci_hccr *hccr;
|
struct ehci_hccr *hccr;
|
||||||
struct ehci_hcor *hcor;
|
struct ehci_hcor *hcor;
|
||||||
|
|
||||||
ehci_pci_common_init(pci_get_bdf(dev), &hccr, &hcor);
|
ehci_pci_common_init(dm_pci_get_bdf(dev), &hccr, &hcor);
|
||||||
|
|
||||||
return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
|
return ehci_register(dev, hccr, hcor, NULL, 0, USB_INIT_HOST);
|
||||||
}
|
}
|
||||||
|
|
|
@ -862,12 +862,12 @@ struct dm_pci_ops {
|
||||||
#define pci_get_ops(dev) ((struct dm_pci_ops *)(dev)->driver->ops)
|
#define pci_get_ops(dev) ((struct dm_pci_ops *)(dev)->driver->ops)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_get_bdf() - Get the BDF value for a device
|
* dm_pci_get_bdf() - Get the BDF value for a device
|
||||||
*
|
*
|
||||||
* @dev: Device to check
|
* @dev: Device to check
|
||||||
* @return bus/device/function value (see PCI_BDF())
|
* @return bus/device/function value (see PCI_BDF())
|
||||||
*/
|
*/
|
||||||
pci_dev_t pci_get_bdf(struct udevice *dev);
|
pci_dev_t dm_pci_get_bdf(struct udevice *dev);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pci_bind_bus_devices() - scan a PCI bus and bind devices
|
* pci_bind_bus_devices() - scan a PCI bus and bind devices
|
||||||
|
|
Loading…
Reference in a new issue