1 /* SPDX-License-Identifier: GPL-2.0-only */
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>
8 /* Convert I2C bus number to PCI device and function */
9 int dw_i2c_soc_bus_to_devfn(unsigned int bus
)
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));
19 /* Convert PCI device and function to I2C bus number */
20 int dw_i2c_soc_devfn_to_bus(unsigned int devfn
)
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;