tangled
alpha
login
or
join now
tjh.dev
/
kernel
Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1
fork
atom
overview
issues
pulls
pipelines
Merge branch 'next-i2c-omap' into next-i2c
Ben Dooks
16 years ago
2086f848
aaa02ab5
+25
-19
1 changed file
expand all
collapse all
unified
split
drivers
i2c
busses
i2c-omap.c
+25
-19
drivers/i2c/busses/i2c-omap.c
···
49
#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
50
51
#define OMAP_I2C_REV_REG 0x00
52
-
#define OMAP_I2C_IE_REG 0x04
53
-
#define OMAP_I2C_STAT_REG 0x08
54
-
#define OMAP_I2C_IV_REG 0x0c
55
/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
56
-
#define OMAP_I2C_WE_REG 0x0c
57
-
#define OMAP_I2C_SYSS_REG 0x10
58
-
#define OMAP_I2C_BUF_REG 0x14
59
-
#define OMAP_I2C_CNT_REG 0x18
60
-
#define OMAP_I2C_DATA_REG 0x1c
61
-
#define OMAP_I2C_SYSC_REG 0x20
62
-
#define OMAP_I2C_CON_REG 0x24
63
-
#define OMAP_I2C_OA_REG 0x28
64
-
#define OMAP_I2C_SA_REG 0x2c
65
-
#define OMAP_I2C_PSC_REG 0x30
66
-
#define OMAP_I2C_SCLL_REG 0x34
67
-
#define OMAP_I2C_SCLH_REG 0x38
68
-
#define OMAP_I2C_SYSTEST_REG 0x3c
69
-
#define OMAP_I2C_BUFSTAT_REG 0x40
70
71
/* I2C Interrupt Enable Register (OMAP_I2C_IE): */
72
#define OMAP_I2C_IE_XDR (1 << 14) /* TX Buffer drain int enable */
···
161
struct device *dev;
162
void __iomem *base; /* virtual */
163
int irq;
0
164
struct clk *iclk; /* Interface clock */
165
struct clk *fclk; /* Functional clock */
166
struct completion cmd_complete;
···
190
static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
191
int reg, u16 val)
192
{
193
-
__raw_writew(val, i2c_dev->base + reg);
194
}
195
196
static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
197
{
198
-
return __raw_readw(i2c_dev->base + reg);
199
}
200
201
static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
···
924
dev->fifo_size = (dev->fifo_size / 2);
925
dev->b_hw = 1; /* Enable hardware fixes */
926
}
0
0
0
0
0
927
928
/* reset ASAP, clearing any IRQs */
929
omap_i2c_init(dev);
···
49
#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
50
51
#define OMAP_I2C_REV_REG 0x00
52
+
#define OMAP_I2C_IE_REG 0x01
53
+
#define OMAP_I2C_STAT_REG 0x02
54
+
#define OMAP_I2C_IV_REG 0x03
55
/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
56
+
#define OMAP_I2C_WE_REG 0x03
57
+
#define OMAP_I2C_SYSS_REG 0x04
58
+
#define OMAP_I2C_BUF_REG 0x05
59
+
#define OMAP_I2C_CNT_REG 0x06
60
+
#define OMAP_I2C_DATA_REG 0x07
61
+
#define OMAP_I2C_SYSC_REG 0x08
62
+
#define OMAP_I2C_CON_REG 0x09
63
+
#define OMAP_I2C_OA_REG 0x0a
64
+
#define OMAP_I2C_SA_REG 0x0b
65
+
#define OMAP_I2C_PSC_REG 0x0c
66
+
#define OMAP_I2C_SCLL_REG 0x0d
67
+
#define OMAP_I2C_SCLH_REG 0x0e
68
+
#define OMAP_I2C_SYSTEST_REG 0x0f
69
+
#define OMAP_I2C_BUFSTAT_REG 0x10
70
71
/* I2C Interrupt Enable Register (OMAP_I2C_IE): */
72
#define OMAP_I2C_IE_XDR (1 << 14) /* TX Buffer drain int enable */
···
161
struct device *dev;
162
void __iomem *base; /* virtual */
163
int irq;
164
+
int reg_shift; /* bit shift for I2C register addresses */
165
struct clk *iclk; /* Interface clock */
166
struct clk *fclk; /* Functional clock */
167
struct completion cmd_complete;
···
189
static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
190
int reg, u16 val)
191
{
192
+
__raw_writew(val, i2c_dev->base + (reg << i2c_dev->reg_shift));
193
}
194
195
static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
196
{
197
+
return __raw_readw(i2c_dev->base + (reg << i2c_dev->reg_shift));
198
}
199
200
static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
···
923
dev->fifo_size = (dev->fifo_size / 2);
924
dev->b_hw = 1; /* Enable hardware fixes */
925
}
926
+
927
+
if (cpu_is_omap7xx())
928
+
dev->reg_shift = 1;
929
+
else
930
+
dev->reg_shift = 2;
931
932
/* reset ASAP, clearing any IRQs */
933
omap_i2c_init(dev);