![]() |
coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
|
#include <device/mmio.h>
#include <assert.h>
#include <console/console.h>
#include <delay.h>
#include <device/i2c_simple.h>
#include <soc/addressmap.h>
#include <soc/grf.h>
#include <soc/soc.h>
#include <soc/i2c.h>
#include <soc/clock.h>
#include <stddef.h>
#include <stdint.h>
Go to the source code of this file.
Data Structures | |
struct | rk_i2c_regs |
Macros | |
#define | RETRY_COUNT 3 |
#define | I2C_TIMEOUT_US 100000 |
#define | I2C_BUS_MAX 6 |
#define | I2C_NOACK 2 |
#define | I2C_TIMEOUT 3 |
#define | i2c_info(x...) do {if (0) printk(BIOS_DEBUG, x); } while (0) |
#define | I2C_ACT2NAK (1<<6) |
#define | I2C_NAK (1<<5) |
#define | I2C_STOP (1<<4) |
#define | I2C_START (1<<3) |
#define | I2C_MODE_TX (0<<1) |
#define | I2C_MODE_TRX (1<<1) |
#define | I2C_MODE_RX (2<<1) |
#define | I2C_EN (1<<0) |
#define | I2C_8BIT (1<<24) |
#define | I2C_16BIT (3<<24) |
#define | I2C_24BIT (7<<24) |
#define | I2C_CNT(cnt) ((cnt) & 0x3F) |
#define | I2C_NAKRCVI (1<<6) |
#define | I2C_STOPI (1<<5) |
#define | I2C_STARTI (1<<4) |
#define | I2C_MBRFI (1<<3) |
#define | I2C_MBTFI (1<<2) |
#define | I2C_BRFI (1<<1) |
#define | I2C_BTFI (1<<0) |
#define | I2C_CLEANI 0x7F |
Functions | |
static int | i2c_send_start (struct rk_i2c_regs *reg_addr) |
static int | i2c_send_stop (struct rk_i2c_regs *reg_addr) |
static int | i2c_read (struct rk_i2c_regs *reg_addr, struct i2c_msg segment) |
static int | i2c_write (struct rk_i2c_regs *reg_addr, struct i2c_msg segment) |
static int | i2c_do_xfer (void *reg_addr, struct i2c_msg segment) |
int | platform_i2c_transfer (unsigned int bus, struct i2c_msg *segments, int seg_count) |
void | i2c_init (unsigned int bus, unsigned int hz) |
Variables | |
static const uintptr_t | i2c_bus [] = IC_BASES |
#define i2c_info | ( | x... | ) | do {if (0) printk(BIOS_DEBUG, x); } while (0) |
Definition at line 207 of file i2c.c.
References i2c_msg::flags, I2C_M_RD, i2c_read(), i2c_send_start(), i2c_send_stop(), I2C_TIMEOUT, and i2c_write().
Referenced by platform_i2c_transfer().
Definition at line 236 of file i2c.c.
References assert, BIOS_DEBUG, DIV_ROUND_UP, KHz, printk, rkclk_i2c_clock_for_bus(), and write32().
|
static |
Definition at line 113 of file i2c.c.
References BIOS_ERR, i2c_msg::buf, buffer_from_fifo32(), I2C_8BIT, I2C_ACT2NAK, I2C_CLEANI, rk_i2c_regs::i2c_con, I2C_EN, i2c_info, rk_i2c_regs::i2c_ipd, I2C_MBRFI, I2C_MODE_RX, I2C_MODE_TRX, rk_i2c_regs::i2c_mrxaddr, rk_i2c_regs::i2c_mrxcnt, rk_i2c_regs::i2c_mrxraddr, I2C_NAK, I2C_NAKRCVI, I2C_NOACK, I2C_TIMEOUT, i2c_msg::len, MIN, printk, read32(), rk_i2c_regs::rxdata, i2c_msg::slave, udelay(), and write32().
Referenced by i2c_do_xfer().
|
static |
Definition at line 69 of file i2c.c.
References BIOS_ERR, I2C_CLEANI, rk_i2c_regs::i2c_con, I2C_EN, i2c_info, rk_i2c_regs::i2c_ipd, I2C_START, I2C_STARTI, I2C_TIMEOUT, I2C_TIMEOUT_US, printk, read32(), udelay(), and write32().
Referenced by i2c_do_xfer().
|
static |
Definition at line 91 of file i2c.c.
References BIOS_ERR, I2C_CLEANI, rk_i2c_regs::i2c_con, I2C_EN, i2c_info, rk_i2c_regs::i2c_ipd, I2C_STOP, I2C_STOPI, I2C_TIMEOUT, I2C_TIMEOUT_US, printk, read32(), udelay(), and write32().
Referenced by i2c_do_xfer().
|
static |
Definition at line 159 of file i2c.c.
References BIOS_ERR, i2c_msg::buf, buffer_to_fifo32_prefix(), I2C_ACT2NAK, I2C_CLEANI, rk_i2c_regs::i2c_con, I2C_EN, i2c_info, rk_i2c_regs::i2c_ipd, I2C_MBTFI, I2C_MODE_TX, rk_i2c_regs::i2c_mtxcnt, I2C_NAKRCVI, I2C_NOACK, I2C_TIMEOUT, i2c_msg::len, MIN, printk, read32(), i2c_msg::slave, rk_i2c_regs::txdata, udelay(), and write32().
Referenced by i2c_do_xfer().
Definition at line 220 of file i2c.c.
References i2c_do_xfer().
Definition at line 41 of file i2c.c.
Referenced by read_edid_from_ps8640(), and ww_ring_init().