![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/i2c.h>
Go to the source code of this file.
Data Structures | |
struct | mt_i2c_dma_regs |
struct | mtk_i2c_ac_timing |
struct | mtk_i2c |
struct | i2c_spec_values |
Macros | |
#define | I2C_TIME_CLR_VALUE 0x0000 |
#define | MAX_SAMPLE_CNT_DIV 8 |
#define | MAX_STEP_CNT_DIV 64 |
#define | MAX_HS_STEP_CNT_DIV 8 |
#define | I2C_TIME_DEFAULT_VALUE 0x0083 |
#define | I2C_STANDARD_MODE_BUFFER (1000 / 3) |
#define | I2C_FAST_MODE_BUFFER (300 / 3) |
#define | I2C_FAST_MODE_PLUS_BUFFER (20 / 3) |
Functions | |
check_member (mt_i2c_dma_regs, dma_tx_len, 0x24) | |
const struct i2c_spec_values * | mtk_i2c_get_spec (uint32_t speed) |
void | mtk_i2c_dump_more_info (struct mt_i2c_regs *regs) |
int | mtk_i2c_check_ac_timing (uint8_t bus, uint32_t clk_src, uint32_t check_speed, uint32_t step_cnt, uint32_t sample_cnt) |
int | mtk_i2c_calculate_speed (uint8_t bus, uint32_t clk_src, uint32_t target_speed, uint32_t *timing_step_cnt, uint32_t *timing_sample_cnt) |
void | mtk_i2c_speed_init (uint8_t bus, uint32_t speed) |
void | mtk_i2c_config_timing (struct mt_i2c_regs *regs, struct mtk_i2c *bus_ctrl) |
Variables | |
struct mtk_i2c | mtk_i2c_bus_controller [] |
#define I2C_FAST_MODE_BUFFER (300 / 3) |
Definition at line 125 of file i2c_common.h.
#define I2C_FAST_MODE_PLUS_BUFFER (20 / 3) |
Definition at line 126 of file i2c_common.h.
#define I2C_STANDARD_MODE_BUFFER (1000 / 3) |
Definition at line 124 of file i2c_common.h.
#define I2C_TIME_CLR_VALUE 0x0000 |
Definition at line 119 of file i2c_common.h.
#define I2C_TIME_DEFAULT_VALUE 0x0083 |
Definition at line 123 of file i2c_common.h.
#define MAX_HS_STEP_CNT_DIV 8 |
Definition at line 122 of file i2c_common.h.
#define MAX_SAMPLE_CNT_DIV 8 |
Definition at line 120 of file i2c_common.h.
#define MAX_STEP_CNT_DIV 64 |
Definition at line 121 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_HS_DEFAULT_VALUE |
Definition at line 26 of file i2c_common.h.
anonymous enum |
Definition at line 36 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_TRANS_LEN_MASK | |
I2C_TRANS_AUX_LEN_MASK | |
I2C_CONTROL_MASK |
Definition at line 51 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_APDMA_NOASYNC | |
I2C_APDMA_ASYNC |
Definition at line 57 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_HS_NACKERR | |
I2C_ACKERR | |
I2C_TRANSAC_COMP |
Definition at line 63 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_CLR_FLAG | |
I2C_SOFT_RST | |
I2C_HANDSHAKE_RST |
Definition at line 70 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
ASYNC_MODE | |
DMAACK_EN | |
ACK_ERR_DET_EN | |
DIR_CHG | |
CLK_EXT | |
DMA_EN | |
REPEATED_START_FLAG | |
STOP_FLAG |
Definition at line 77 of file i2c_common.h.
anonymous enum |
Enumerator | |
---|---|
I2C_OK | |
I2C_SET_SPEED_FAIL_OVER_SPEED | |
I2C_TRANSFER_INVALID_LENGTH | |
I2C_TRANSFER_FAIL_HS_NACKERR | |
I2C_TRANSFER_FAIL_ACKERR | |
I2C_TRANSFER_FAIL_TIMEOUT | |
I2C_TRANSFER_INVALID_ARGUMENT |
Definition at line 89 of file i2c_common.h.
enum i2c_modes |
Enumerator | |
---|---|
I2C_WRITE_MODE | |
I2C_READ_MODE | |
I2C_WRITE_READ_MODE |
Definition at line 30 of file i2c_common.h.
check_member | ( | mt_i2c_dma_regs | , |
dma_tx_len | , | ||
0x24 | |||
) |
int mtk_i2c_calculate_speed | ( | uint8_t | bus, |
uint32_t | clk_src, | ||
uint32_t | target_speed, | ||
uint32_t * | timing_step_cnt, | ||
uint32_t * | timing_sample_cnt | ||
) |
Definition at line 408 of file i2c.c.
References mtk_i2c::ac_timing, DIV_ROUND_UP, I2C_SPEED_HIGH, mtk_i2c_ac_timing::inter_clk_div, MAX_SAMPLE_CNT_DIV, mtk_i2c_bus_controller, mtk_i2c_check_ac_timing(), and mtk_i2c_max_step_cnt().
Referenced by mtk_i2c_speed_init().
int mtk_i2c_check_ac_timing | ( | uint8_t | bus, |
uint32_t | clk_src, | ||
uint32_t | check_speed, | ||
uint32_t | step_cnt, | ||
uint32_t | sample_cnt | ||
) |
Definition at line 339 of file i2c.c.
References mtk_i2c::ac_timing, DIV_ROUND_UP, mtk_i2c_ac_timing::ext, GENMASK, mtk_i2c_ac_timing::hs, mtk_i2c_ac_timing::htiming, I2C_SPEED_FAST_PLUS, I2C_TIME_DEFAULT_VALUE, mtk_i2c_ac_timing::ltiming, i2c_spec_values::max_hd_dat_ns, i2c_spec_values::min_low_ns, i2c_spec_values::min_su_dat_ns, i2c_spec_values::min_su_sta_ns, mtk_i2c_bus_controller, mtk_i2c_get_spec(), mtk_i2c_max_step_cnt(), and NSECS_PER_SEC.
Referenced by mtk_i2c_calculate_speed().
void mtk_i2c_config_timing | ( | struct mt_i2c_regs * | regs, |
struct mtk_i2c * | bus_ctrl | ||
) |
Definition at line 40 of file i2c.c.
References mtk_i2c::ac_timing, mtk_i2c_ac_timing::ext, mtk_i2c_ac_timing::hs, mtk_i2c_ac_timing::htiming, mtk_i2c_ac_timing::inter_clk_div, mtk_i2c_ac_timing::ltiming, and write32().
Referenced by mtk_i2c_speed_init().
void mtk_i2c_dump_more_info | ( | struct mt_i2c_regs * | regs | ) |
Definition at line 35 of file i2c.c.
References BIOS_DEBUG, printk, and read32().
Referenced by mtk_i2c_dump_info().
const struct i2c_spec_values* mtk_i2c_get_spec | ( | uint32_t | speed | ) |
Definition at line 45 of file i2c.c.
References fast_mode_plus_spec, fast_mode_spec, I2C_SPEED_FAST, I2C_SPEED_STANDARD, and standard_mode_spec.
Referenced by mtk_i2c_check_ac_timing().
Definition at line 494 of file i2c.c.
References mtk_i2c::ac_timing, BIOS_ERR, mtk_i2c_ac_timing::hs, I2C_BUS_NUMBER, I2C_CLK_HZ, mtk_i2c::i2c_regs, I2C_SPEED_FAST, I2C_SPEED_FAST_PLUS, I2C_TIME_CLR_VALUE, mtk_i2c_ac_timing::inter_clk_div, MAX_CLOCK_DIV, mtk_i2c_bus_controller, mtk_i2c_calculate_speed(), mtk_i2c_config_timing(), and printk.
Referenced by mtk_i2c_bus_init().
|
extern |
Definition at line 1 of file i2c.c.
Referenced by i2c_hw_reset(), mtk_i2c_bus_init(), mtk_i2c_calculate_speed(), mtk_i2c_check_ac_timing(), mtk_i2c_speed_init(), mtk_i2c_speed_init_soc(), and mtk_i2c_transfer().