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