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>
4 #include <intelblocks/cfg.h>
6 #include <soc/pci_devs.h>
7 
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 
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 }
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