#include <acpi/acpigen.h>
#include <device/mmio.h>
#include <console/console.h>
#include <device/device.h>
#include <device/i2c_bus.h>
#include <device/i2c_simple.h>
#include <string.h>
#include <timer.h>
#include <types.h>
#include "dw_i2c.h"
Go to the source code of this file.
|
enum | {
DEFAULT_SDA_HOLD_TIME = 300
, MIN_SS_SCL_HIGHTIME = 4000
, MIN_SS_SCL_LOWTIME = 4700
, MIN_FS_SCL_HIGHTIME = 600
,
MIN_FS_SCL_LOWTIME = 1300
, MIN_FP_SCL_HIGHTIME = 260
, MIN_FP_SCL_LOWTIME = 500
, MIN_HS_SCL_HIGHTIME = 60
,
MIN_HS_SCL_LOWTIME = 160
} |
|
enum | {
CONTROL_MASTER_MODE = (1 << 0)
, CONTROL_SPEED_SS = (1 << 1)
, CONTROL_SPEED_FS = (2 << 1)
, CONTROL_SPEED_HS = (3 << 1)
,
CONTROL_SPEED_MASK = (3 << 1)
, CONTROL_10BIT_SLAVE = (1 << 3)
, CONTROL_10BIT_MASTER = (1 << 4)
, CONTROL_RESTART_ENABLE = (1 << 5)
,
CONTROL_SLAVE_DISABLE = (1 << 6)
} |
|
enum | { CMD_DATA_CMD = (1 << 8)
, CMD_DATA_STOP = (1 << 9)
} |
|
enum | {
STATUS_ACTIVITY = (1 << 0)
, STATUS_TX_FIFO_NOT_FULL = (1 << 1)
, STATUS_TX_FIFO_EMPTY = (1 << 2)
, STATUS_RX_FIFO_NOT_EMPTY = (1 << 3)
,
STATUS_RX_FIFO_FULL = (1 << 4)
, STATUS_MASTER_ACTIVITY = (1 << 5)
, STATUS_SLAVE_ACTIVITY = (1 << 6)
} |
|
enum | { ENABLE_CONTROLLER = (1 << 0)
} |
|
enum | {
INTR_STAT_RX_UNDER = (1 << 0)
, INTR_STAT_RX_OVER = (1 << 1)
, INTR_STAT_RX_FULL = (1 << 2)
, INTR_STAT_TX_OVER = (1 << 3)
,
INTR_STAT_TX_EMPTY = (1 << 4)
, INTR_STAT_RD_REQ = (1 << 5)
, INTR_STAT_TX_ABORT = (1 << 6)
, INTR_STAT_RX_DONE = (1 << 7)
,
INTR_STAT_ACTIVITY = (1 << 8)
, INTR_STAT_STOP_DET = (1 << 9)
, INTR_STAT_START_DET = (1 << 10)
, INTR_STAT_GEN_CALL = (1 << 11)
} |
|
|
static const struct i2c_descriptor * | get_bus_descriptor (enum i2c_speed speed) |
|
static const struct soc_clock * | get_soc_descriptor (int ic_clk) |
|
static int | counts_from_time (const struct freq *f, int ns) |
|
static int | counts_from_freq (const struct freq *fast, const struct freq *slow) |
|
static void | dw_i2c_enable (struct dw_i2c_regs *regs) |
|
static enum cb_err | dw_i2c_disable (struct dw_i2c_regs *regs) |
|
static enum cb_err | dw_i2c_wait_for_bus_idle (struct dw_i2c_regs *regs) |
|
static enum cb_err | dw_i2c_transfer_byte (struct dw_i2c_regs *regs, const struct i2c_msg *segment, size_t byte, int send_stop) |
|
static enum cb_err | _dw_i2c_transfer (unsigned int bus, const struct i2c_msg *segments, size_t count) |
|
static enum cb_err | dw_i2c_transfer (unsigned int bus, const struct i2c_msg *msg, size_t count) |
|
int | platform_i2c_transfer (unsigned int bus, struct i2c_msg *msg, int count) |
|
static enum cb_err | dw_i2c_set_speed_config (unsigned int bus, const struct dw_i2c_speed_config *config) |
|
static enum cb_err | dw_i2c_gen_config_rise_fall_time (struct dw_i2c_regs *regs, enum i2c_speed speed, const struct dw_i2c_bus_config *bcfg, int ic_clk, struct dw_i2c_speed_config *config) |
|
enum cb_err | dw_i2c_gen_speed_config (uintptr_t dw_i2c_addr, enum i2c_speed speed, const struct dw_i2c_bus_config *bcfg, struct dw_i2c_speed_config *config) |
|
static enum cb_err | dw_i2c_set_speed (unsigned int bus, enum i2c_speed speed, const struct dw_i2c_bus_config *bcfg) |
|
enum cb_err | dw_i2c_init (unsigned int bus, const struct dw_i2c_bus_config *bcfg) |
|
static void | dw_i2c_acpi_write_speed_config (const struct dw_i2c_speed_config *config) |
|
void | dw_i2c_dev_init (struct device *dev) |
|
void | dw_i2c_acpi_fill_ssdt (const struct device *dev) |
|
static int | dw_i2c_dev_transfer (struct device *dev, const struct i2c_msg *msg, size_t count) |
|
◆ DW_I2C_COMP_TYPE
#define DW_I2C_COMP_TYPE 0x44570140 |
◆ DW_I2C_FLUSH_TIMEOUT_US
#define DW_I2C_FLUSH_TIMEOUT_US 160000 |
◆ DW_I2C_TIMEOUT_US
#define DW_I2C_TIMEOUT_US 10000 |
◆ anonymous enum
Enumerator |
---|
DEFAULT_SDA_HOLD_TIME | |
MIN_SS_SCL_HIGHTIME | |
MIN_SS_SCL_LOWTIME | |
MIN_FS_SCL_HIGHTIME | |
MIN_FS_SCL_LOWTIME | |
MIN_FP_SCL_HIGHTIME | |
MIN_FP_SCL_LOWTIME | |
MIN_HS_SCL_HIGHTIME | |
MIN_HS_SCL_LOWTIME | |
Definition at line 20 of file dw_i2c.c.
◆ anonymous enum
Enumerator |
---|
CONTROL_MASTER_MODE | |
CONTROL_SPEED_SS | |
CONTROL_SPEED_FS | |
CONTROL_SPEED_HS | |
CONTROL_SPEED_MASK | |
CONTROL_10BIT_SLAVE | |
CONTROL_10BIT_MASTER | |
CONTROL_RESTART_ENABLE | |
CONTROL_SLAVE_DISABLE | |
Definition at line 45 of file dw_i2c.c.
◆ anonymous enum
Enumerator |
---|
CMD_DATA_CMD | |
CMD_DATA_STOP | |
Definition at line 58 of file dw_i2c.c.
◆ anonymous enum
Enumerator |
---|
STATUS_ACTIVITY | |
STATUS_TX_FIFO_NOT_FULL | |
STATUS_TX_FIFO_EMPTY | |
STATUS_RX_FIFO_NOT_EMPTY | |
STATUS_RX_FIFO_FULL | |
STATUS_MASTER_ACTIVITY | |
STATUS_SLAVE_ACTIVITY | |
Definition at line 64 of file dw_i2c.c.
◆ anonymous enum
Enumerator |
---|
ENABLE_CONTROLLER | |
Definition at line 75 of file dw_i2c.c.
◆ anonymous enum
Enumerator |
---|
INTR_STAT_RX_UNDER | |
INTR_STAT_RX_OVER | |
INTR_STAT_RX_FULL | |
INTR_STAT_TX_OVER | |
INTR_STAT_TX_EMPTY | |
INTR_STAT_RD_REQ | |
INTR_STAT_TX_ABORT | |
INTR_STAT_RX_DONE | |
INTR_STAT_ACTIVITY | |
INTR_STAT_STOP_DET | |
INTR_STAT_START_DET | |
INTR_STAT_GEN_CALL | |
Definition at line 80 of file dw_i2c.c.
◆ _dw_i2c_transfer()
◆ counts_from_freq()
static int counts_from_freq |
( |
const struct freq * |
fast, |
|
|
const struct freq * |
slow |
|
) |
| |
|
static |
◆ counts_from_time()
static int counts_from_time |
( |
const struct freq * |
f, |
|
|
int |
ns |
|
) |
| |
|
static |
◆ dw_i2c_acpi_fill_ssdt()
void dw_i2c_acpi_fill_ssdt |
( |
const struct device * |
dev | ) |
|
Definition at line 802 of file dw_i2c.c.
References acpi_device_path(), acpigen_write_scope(), acpigen_write_scope_end(), CB_SUCCESS, dw_i2c_acpi_write_speed_config(), dw_i2c_base_address(), dw_i2c_gen_speed_config(), dw_i2c_get_soc_cfg(), dw_i2c_soc_dev_to_bus(), DW_I2C_SPEED_CONFIG_COUNT, I2C_SPEED_FAST, dw_i2c_bus_config::speed, dw_i2c_speed_config::speed, and dw_i2c_bus_config::speed_config.
◆ dw_i2c_acpi_write_speed_config()
◆ dw_i2c_dev_init()
◆ dw_i2c_dev_transfer()
static int dw_i2c_dev_transfer |
( |
struct device * |
dev, |
|
|
const struct i2c_msg * |
msg, |
|
|
size_t |
count |
|
) |
| |
|
static |
◆ dw_i2c_disable()
◆ dw_i2c_enable()
◆ dw_i2c_gen_config_rise_fall_time()
◆ dw_i2c_gen_speed_config()
◆ dw_i2c_init()
◆ dw_i2c_set_speed()
◆ dw_i2c_set_speed_config()
◆ dw_i2c_transfer()
◆ dw_i2c_transfer_byte()
◆ dw_i2c_wait_for_bus_idle()
◆ get_bus_descriptor()
◆ get_soc_descriptor()
static const struct soc_clock* get_soc_descriptor |
( |
int |
ic_clk | ) |
|
|
static |
◆ platform_i2c_transfer()
int platform_i2c_transfer |
( |
unsigned int |
bus, |
|
|
struct i2c_msg * |
msg, |
|
|
int |
count |
|
) |
| |
◆ __packed
◆ dw_i2c_bus_ops
Initial value:= {
}
static int dw_i2c_dev_transfer(struct device *dev, const struct i2c_msg *msg, size_t count)
Definition at line 845 of file dw_i2c.c.
◆ soc_clocks
Initial value:= {
{
.clk_speed_mhz = 120,
.freq = {
.ticks = 120,
.ns = 1000,
},
},
{
.clk_speed_mhz = 133,
.freq = {
.ticks = 400,
.ns = 3000,
},
},
{
.clk_speed_mhz = 150,
.freq = {
.ticks = 600,
.ns = 4000,
},
},
{
.clk_speed_mhz = 216,
.freq = {
.ticks = 1080,
.ns = 5000,
},
},
}
Referenced by get_soc_descriptor().
◆ speed_descriptors