| 1 |
|
| 2 |
|
| 3 |
#include <device/device.h> |
| 4 |
#include <device/pci_def.h> |
| 5 |
#include <drivers/i2c/designware/dw_i2c.h> |
| 6 |
#include <soc/pci_devs.h> |
| 7 |
|
| 8 |
|
| 9 |
int dw_i2c_soc_bus_to_devfn(unsigned int bus) |
| 10 |
{ |
| 11 |
if (bus <= 3) |
| 12 |
return PCI_DEVFN(PCH_DEV_SLOT_SIO1, bus); |
| 13 |
else if (bus >= 4 && bus <= 7) |
| 14 |
return PCI_DEVFN(PCH_DEV_SLOT_SIO2, (bus - 4)); |
| 15 |
else |
| 16 |
return -1; |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
int dw_i2c_soc_devfn_to_bus(unsigned int devfn) |
| 21 |
{ |
| 22 |
if (PCI_SLOT(devfn) == PCH_DEV_SLOT_SIO1) |
| 23 |
return PCI_FUNC(devfn); |
| 24 |
else if (PCI_SLOT(devfn) == PCH_DEV_SLOT_SIO2) |
| 25 |
return PCI_FUNC(devfn) + 4; |
| 26 |
else |
| 27 |
return -1; |
| 28 |
} |