soc/intel/xeon_sp/chip_common: Improve the domain ID
[coreboot2.git] / src / soc / intel / jasperlake / i2c.c
blobc13a1a60995fc702352148f066cbaf4ca219cba0
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/device.h>
4 #include <drivers/i2c/designware/dw_i2c.h>
5 #include <soc/pci_devs.h>
7 int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
9 switch (devfn) {
10 case PCH_DEVFN_I2C0:
11 return 0;
12 case PCH_DEVFN_I2C1:
13 return 1;
14 case PCH_DEVFN_I2C2:
15 return 2;
16 case PCH_DEVFN_I2C3:
17 return 3;
18 case PCH_DEVFN_I2C4:
19 return 4;
20 case PCH_DEVFN_I2C5:
21 return 5;
23 return -1;
26 int dw_i2c_soc_bus_to_devfn(unsigned int bus)
28 switch (bus) {
29 case 0:
30 return PCH_DEVFN_I2C0;
31 case 1:
32 return PCH_DEVFN_I2C1;
33 case 2:
34 return PCH_DEVFN_I2C2;
35 case 3:
36 return PCH_DEVFN_I2C3;
37 case 4:
38 return PCH_DEVFN_I2C4;
39 case 5:
40 return PCH_DEVFN_I2C5;
42 return -1;