mb/system76/cml-u/dt: Make use of chipset devicetree
[coreboot.git] / src / soc / intel / elkhartlake / i2c.c
blob78ee37b72dd7aa995823853b65d88c9c0e3cf07b
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;
22 case PCH_DEVFN_I2C6:
23 return 6;
24 case PCH_DEVFN_I2C7:
25 return 7;
27 return -1;
30 int dw_i2c_soc_bus_to_devfn(unsigned int bus)
32 switch (bus) {
33 case 0:
34 return PCH_DEVFN_I2C0;
35 case 1:
36 return PCH_DEVFN_I2C1;
37 case 2:
38 return PCH_DEVFN_I2C2;
39 case 3:
40 return PCH_DEVFN_I2C3;
41 case 4:
42 return PCH_DEVFN_I2C4;
43 case 5:
44 return PCH_DEVFN_I2C5;
45 case 6:
46 return PCH_DEVFN_I2C6;
47 case 7:
48 return PCH_DEVFN_I2C7;
50 return -1;