coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
i2c.c File Reference
#include <assert.h>
#include <console/console.h>
#include <device/mmio.h>
#include <soc/i2c.h>
#include <soc/gpio.h>
Include dependency graph for i2c.c:

Go to the source code of this file.

Data Structures

struct  pad_func
 

Macros

#define PAD_FUNC(name, func)   {GPIO(name), PAD_##name##_FUNC_##func}
 

Functions

 _Static_assert (ARRAY_SIZE(mtk_i2c_bus_controller)==I2C_BUS_NUMBER, "Wrong size of mtk_i2c_bus_controller")
 
static void mtk_i2c_set_gpio_pinmux (uint8_t bus)
 
static void mtk_i2c_speed_init_soc (uint8_t bus)
 
void mtk_i2c_bus_init (uint8_t bus)
 
void mtk_i2c_dump_more_info (struct mt_i2c_regs *regs)
 

Variables

struct mtk_i2c mtk_i2c_bus_controller []
 
static const struct pad_func i2c_funcs [I2C_BUS_NUMBER][2]
 

Macro Definition Documentation

◆ PAD_FUNC

#define PAD_FUNC (   name,
  func 
)    {GPIO(name), PAD_##name##_FUNC_##func}

Definition at line 61 of file i2c.c.

Function Documentation

◆ _Static_assert()

_Static_assert ( ARRAY_SIZE(mtk_i2c_bus_controller = =I2C_BUS_NUMBER,
"Wrong size of mtk_i2c_bus_controller  
)

◆ mtk_i2c_bus_init()

void mtk_i2c_bus_init ( uint8_t  bus)

Definition at line 132 of file i2c.c.

References mtk_i2c_set_gpio_pinmux(), and mtk_i2c_speed_init_soc().

Here is the call graph for this function:

◆ mtk_i2c_dump_more_info()

void mtk_i2c_dump_more_info ( struct mt_i2c_regs regs)

Definition at line 138 of file i2c.c.

References BIOS_DEBUG, printk, and read32().

Here is the call graph for this function:

◆ mtk_i2c_set_gpio_pinmux()

static void mtk_i2c_set_gpio_pinmux ( uint8_t  bus)
static

Definition at line 94 of file i2c.c.

References assert, pad_func::func, GPIO_PULL_ENABLE, GPIO_PULL_UP, gpio_set_mode(), gpio_set_pull(), I2C_BUS_NUMBER, and i2c_funcs.

Referenced by mtk_i2c_bus_init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mtk_i2c_speed_init_soc()

static void mtk_i2c_speed_init_soc ( uint8_t  bus)
static

Definition at line 105 of file i2c.c.

References ARRAY_SIZE, assert, DIV_ROUND_UP, I2C_CLK_HZ, KHz, mtk_i2c_bus_controller, and write32().

Referenced by mtk_i2c_bus_init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ i2c_funcs

const struct pad_func i2c_funcs[I2C_BUS_NUMBER][2]
static
Initial value:
= {
{
PAD_FUNC(SDA0, SDA0),
PAD_FUNC(SCL0, SCL0),
},
{
PAD_FUNC(SDA1, SDA1),
PAD_FUNC(SCL1, SCL1),
},
{
PAD_FUNC(SDA2, SDA2),
PAD_FUNC(SCL2, SCL2),
},
{
PAD_FUNC(SDA3, SDA3),
PAD_FUNC(SCL3, SCL3),
},
{
PAD_FUNC(SDA4, SDA4),
PAD_FUNC(SCL4, SCL4),
},
{
PAD_FUNC(SDA5, SDA5),
PAD_FUNC(SCL5, SCL5),
},
{
PAD_FUNC(SDA6, SDA6),
PAD_FUNC(SCL6, SCL6),
},
}
#define PAD_FUNC(name, func)
Definition: i2c.c:61

Definition at line 53 of file i2c.c.

Referenced by mtk_i2c_set_gpio_pinmux().

◆ mtk_i2c_bus_controller

struct mtk_i2c mtk_i2c_bus_controller[]

Definition at line 1 of file i2c.c.