coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i2c.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
5 #include <soc/pci_devs.h>
6 
7 int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
8 {
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  }
23  return -1;
24 }
25 
26 int dw_i2c_soc_bus_to_devfn(unsigned int bus)
27 {
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;
41  }
42  return -1;
43 }
int dw_i2c_soc_bus_to_devfn(unsigned int bus)
Definition: i2c.c:36
int dw_i2c_soc_devfn_to_bus(unsigned int devfn)
Definition: i2c.c:13
#define PCH_DEVFN_I2C5
Definition: pci_devs.h:163
#define PCH_DEVFN_I2C0
Definition: pci_devs.h:134
#define PCH_DEVFN_I2C3
Definition: pci_devs.h:137
#define PCH_DEVFN_I2C4
Definition: pci_devs.h:162
#define PCH_DEVFN_I2C2
Definition: pci_devs.h:136
#define PCH_DEVFN_I2C1
Definition: pci_devs.h:135
Definition: device.h:76