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
49
#define OMAP_I2C_TIMEOUT (msecs_to_jiffies(1000))
50
50
51
51
#define OMAP_I2C_REV_REG 0x00
52
52
-
#define OMAP_I2C_IE_REG 0x04
53
53
-
#define OMAP_I2C_STAT_REG 0x08
54
54
-
#define OMAP_I2C_IV_REG 0x0c
52
52
+
#define OMAP_I2C_IE_REG 0x01
53
53
+
#define OMAP_I2C_STAT_REG 0x02
54
54
+
#define OMAP_I2C_IV_REG 0x03
55
55
/* For OMAP3 I2C_IV has changed to I2C_WE (wakeup enable) */
56
56
-
#define OMAP_I2C_WE_REG 0x0c
57
57
-
#define OMAP_I2C_SYSS_REG 0x10
58
58
-
#define OMAP_I2C_BUF_REG 0x14
59
59
-
#define OMAP_I2C_CNT_REG 0x18
60
60
-
#define OMAP_I2C_DATA_REG 0x1c
61
61
-
#define OMAP_I2C_SYSC_REG 0x20
62
62
-
#define OMAP_I2C_CON_REG 0x24
63
63
-
#define OMAP_I2C_OA_REG 0x28
64
64
-
#define OMAP_I2C_SA_REG 0x2c
65
65
-
#define OMAP_I2C_PSC_REG 0x30
66
66
-
#define OMAP_I2C_SCLL_REG 0x34
67
67
-
#define OMAP_I2C_SCLH_REG 0x38
68
68
-
#define OMAP_I2C_SYSTEST_REG 0x3c
69
69
-
#define OMAP_I2C_BUFSTAT_REG 0x40
56
56
+
#define OMAP_I2C_WE_REG 0x03
57
57
+
#define OMAP_I2C_SYSS_REG 0x04
58
58
+
#define OMAP_I2C_BUF_REG 0x05
59
59
+
#define OMAP_I2C_CNT_REG 0x06
60
60
+
#define OMAP_I2C_DATA_REG 0x07
61
61
+
#define OMAP_I2C_SYSC_REG 0x08
62
62
+
#define OMAP_I2C_CON_REG 0x09
63
63
+
#define OMAP_I2C_OA_REG 0x0a
64
64
+
#define OMAP_I2C_SA_REG 0x0b
65
65
+
#define OMAP_I2C_PSC_REG 0x0c
66
66
+
#define OMAP_I2C_SCLL_REG 0x0d
67
67
+
#define OMAP_I2C_SCLH_REG 0x0e
68
68
+
#define OMAP_I2C_SYSTEST_REG 0x0f
69
69
+
#define OMAP_I2C_BUFSTAT_REG 0x10
70
70
71
71
/* I2C Interrupt Enable Register (OMAP_I2C_IE): */
72
72
#define OMAP_I2C_IE_XDR (1 << 14) /* TX Buffer drain int enable */
···
161
161
struct device *dev;
162
162
void __iomem *base; /* virtual */
163
163
int irq;
164
164
+
int reg_shift; /* bit shift for I2C register addresses */
164
165
struct clk *iclk; /* Interface clock */
165
166
struct clk *fclk; /* Functional clock */
166
167
struct completion cmd_complete;
···
190
189
static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
191
190
int reg, u16 val)
192
191
{
193
193
-
__raw_writew(val, i2c_dev->base + reg);
192
192
+
__raw_writew(val, i2c_dev->base + (reg << i2c_dev->reg_shift));
194
193
}
195
194
196
195
static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
197
196
{
198
198
-
return __raw_readw(i2c_dev->base + reg);
197
197
+
return __raw_readw(i2c_dev->base + (reg << i2c_dev->reg_shift));
199
198
}
200
199
201
200
static int __init omap_i2c_get_clocks(struct omap_i2c_dev *dev)
···
924
923
dev->fifo_size = (dev->fifo_size / 2);
925
924
dev->b_hw = 1; /* Enable hardware fixes */
926
925
}
926
926
+
927
927
+
if (cpu_is_omap7xx())
928
928
+
dev->reg_shift = 1;
929
929
+
else
930
930
+
dev->reg_shift = 2;
927
931
928
932
/* reset ASAP, clearing any IRQs */
929
933
omap_i2c_init(dev);