20 #define KEMPLD_I2C_PRELOW 0x0b
21 #define KEMPLD_I2C_PREHIGH 0x0c
22 #define KEMPLD_I2C_DATA 0x0e
24 #define KEMPLD_I2C_CTRL 0x0d
25 #define I2C_CTRL_IEN 0x40
26 #define I2C_CTRL_EN 0x80
28 #define KEMPLD_I2C_STAT 0x0f
29 #define I2C_STAT_IF 0x01
30 #define I2C_STAT_TIP 0x02
31 #define I2C_STAT_ARBLOST 0x20
32 #define I2C_STAT_BUSY 0x40
33 #define I2C_STAT_NACK 0x80
35 #define KEMPLD_I2C_CMD 0x0f
36 #define I2C_CMD_START 0x91
37 #define I2C_CMD_STOP 0x41
38 #define I2C_CMD_READ 0x21
39 #define I2C_CMD_WRITE 0x11
40 #define I2C_CMD_READ_ACK 0x21
41 #define I2C_CMD_READ_NACK 0x29
42 #define I2C_CMD_IACK 0x01
143 if (i2c->
pos >= msg->
len) {
174 const struct i2c_msg *
const msgs,
231 u16 prescale_corr, frequency;
248 frequency =
config->i2c_frequency;
251 "kempld_i2c: %d kHz is too high!\n",
259 prescale =
KEMPLD_CLK / (frequency * 5) - 1000;
261 prescale =
KEMPLD_CLK / (frequency * 4) - 3000;
267 prescale_corr = prescale / 1000;
268 if (prescale % 1000 >= 500)
#define printk(level,...)
void kempld_write8(const uint8_t addr, const uint8_t data)
int kempld_get_mutex(int timeout_ms)
void kempld_release_mutex(void)
uint8_t kempld_read8(const uint8_t addr)
@ KEMPLD_I2C_FREQ_STANDARD_MODE_100KHZ
static int stopwatch_expired(struct stopwatch *sw)
static void stopwatch_init_msecs_expire(struct stopwatch *sw, long ms)
static struct device_operations kempld_i2c_dev_ops
static int kempld_i2c_process(struct kempld_i2c_data *const i2c)
#define KEMPLD_I2C_PREHIGH
static int kempld_i2c_xfer(struct device *const dev, const struct i2c_msg *const msgs, const size_t num)
#define KEMPLD_I2C_PRELOW
static const struct i2c_bus_operations kempld_i2c_bus_ops
#define I2C_CMD_READ_NACK
void kempld_i2c_device_init(struct device *const dev)
#define KEMPLD_CFG_GPIO_I2C_MUX
#define KEMPLD_SPEC_GET_MAJOR(x)
#define BIOS_INFO
BIOS_INFO - Expected events.
#define BIOS_NOTICE
BIOS_NOTICE - Unexpected but relatively insignificant.
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
void scan_smbus(struct device *bus)
void(* scan_bus)(struct device *bus)
struct device_operations * ops
DEVTREE_CONST void * chip_info
int(* transfer)(struct device *, const struct i2c_msg *, size_t count)
struct i2c_msg - an I2C transaction segment beginning with START @addr: Slave address,...
enum kempld_i2c_state state
const struct i2c_msg * msg