9 #define I2C_FULL_DUTY 100
10 #define I2C_HALF_DUTY 50
11 #define I2C_ADJUSTED_DUTY 45
12 #define I2C_FS_START_CON 0x601
20 .i2c_regs = (
void *)(
I2C_BASE + 0x70000),
25 .i2c_regs = (
void *)(
I2C_BASE + 0x71000),
35 .i2c_regs = (
void *)(
I2C_BASE + 0x72000),
40 .i2c_regs = (
void *)(
I2C_BASE + 0x150000),
45 .i2c_regs = (
void *)(
I2C_BASE + 0x251000),
50 .i2c_regs = (
void *)(
I2C_BASE + 0x50000),
55 .i2c_regs = (
void *)(
I2C_BASE + 0x51000),
60 .i2c_regs = (
void *)(
I2C_BASE + 0x52000),
67 "Wrong size of mtk_i2c_bus_controller");
74 #define PAD_FUNC(name, func) {GPIO(name), PAD_##name##_FUNC_##func}
124 for (
size_t i = 0; i < 2; i++) {
147 (tar_speed_high *
KHz * sample_div * 2) * clock_div);
148 i2c_freq =
I2C_CLK_HZ / (step_div * sample_div * 2 * clock_div);
149 assert(sample_div < 8 && step_div < 64 &&
150 i2c_freq <= tar_speed_high *
KHz &&
151 i2c_freq >= (tar_speed_high - 20) *
KHz);
155 (sample_div - 1) << 8 | (step_div - 1));
163 (tar_speed_low *
KHz * sample_div * 2) * clock_div);
164 i2c_freq =
I2C_CLK_HZ / (step_div * sample_div * 2 * clock_div);
165 assert(sample_div < 8 && step_div < 64 &&
166 i2c_freq <= tar_speed_low *
KHz &&
167 i2c_freq >= (tar_speed_low - 20) *
KHz);
169 (sample_div - 1) << 6 | (step_div - 1));
static void write32(void *addr, uint32_t val)
static uint32_t read32(const void *addr)
#define assert(statement)
#define DIV_ROUND_UP(x, y)
#define printk(level,...)
#define BIOS_DEBUG
BIOS_DEBUG - Verbose output.
struct mt_i2c_regs * i2c_regs