• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include <intelblocks/cfg.h>
5 #include <drivers/i2c/designware/dw_i2c.h>
6 #include <soc/pci_devs.h>
7 
dw_i2c_soc_devfn_to_bus(unsigned int devfn)8 int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
9 {
10 	switch (devfn) {
11 	case PCH_DEVFN_I2C0:
12 		return 0;
13 	case PCH_DEVFN_I2C1:
14 		return 1;
15 	case PCH_DEVFN_I2C2:
16 		return 2;
17 	case PCH_DEVFN_I2C3:
18 		return 3;
19 	case PCH_DEVFN_I2C4:
20 		return 4;
21 	case PCH_DEVFN_I2C5:
22 		return 5;
23 	}
24 	return -1;
25 }
26 
dw_i2c_soc_bus_to_devfn(unsigned int bus)27 int dw_i2c_soc_bus_to_devfn(unsigned int bus)
28 {
29 	switch (bus) {
30 	case 0:
31 		return PCH_DEVFN_I2C0;
32 	case 1:
33 		return PCH_DEVFN_I2C1;
34 	case 2:
35 		return PCH_DEVFN_I2C2;
36 	case 3:
37 		return PCH_DEVFN_I2C3;
38 	case 4:
39 		return PCH_DEVFN_I2C4;
40 	case 5:
41 		return PCH_DEVFN_I2C5;
42 	}
43 	return -1;
44 }
45