diff options
author | Eric Miao <eric.miao@marvell.com> | 2009-04-13 02:43:25 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2009-06-04 22:21:42 -0400 |
commit | f23d4911319fdebffd0529b31bb66d324ef287e6 (patch) | |
tree | 4f197538492fd2364dbbcc1ff7f36c63f2aa7641 /drivers | |
parent | 9fa7eb283c5cdc2b0f4a8cfe6387ed82e5e9a3d3 (diff) |
[ARM] pxa: add platform device ID table to pxa i2c driver
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-pxa.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c index acc7143d9655..e4ee8835b97f 100644 --- a/drivers/i2c/busses/i2c-pxa.c +++ b/drivers/i2c/busses/i2c-pxa.c | |||
@@ -34,12 +34,26 @@ | |||
34 | #include <linux/err.h> | 34 | #include <linux/err.h> |
35 | #include <linux/clk.h> | 35 | #include <linux/clk.h> |
36 | 36 | ||
37 | #include <mach/hardware.h> | ||
38 | #include <asm/irq.h> | 37 | #include <asm/irq.h> |
39 | #include <asm/io.h> | 38 | #include <asm/io.h> |
40 | #include <mach/i2c.h> | 39 | #include <mach/i2c.h> |
41 | 40 | ||
42 | /* | 41 | /* |
42 | * I2C register offsets will be shifted 0 or 1 bit left, depending on | ||
43 | * different SoCs | ||
44 | */ | ||
45 | #define REG_SHIFT_0 (0 << 0) | ||
46 | #define REG_SHIFT_1 (1 << 0) | ||
47 | #define REG_SHIFT(d) ((d) & 0x1) | ||
48 | |||
49 | static const struct platform_device_id i2c_pxa_id_table[] = { | ||
50 | { "pxa2xx-i2c", REG_SHIFT_1 }, | ||
51 | { "pxa3xx-pwri2c", REG_SHIFT_0 }, | ||
52 | { }, | ||
53 | }; | ||
54 | MODULE_DEVICE_TABLE(platform, i2c_pxa_id_table); | ||
55 | |||
56 | /* | ||
43 | * I2C registers and bit definitions | 57 | * I2C registers and bit definitions |
44 | */ | 58 | */ |
45 | #define IBMR (0x00) | 59 | #define IBMR (0x00) |
@@ -985,6 +999,7 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
985 | struct pxa_i2c *i2c; | 999 | struct pxa_i2c *i2c; |
986 | struct resource *res; | 1000 | struct resource *res; |
987 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; | 1001 | struct i2c_pxa_platform_data *plat = dev->dev.platform_data; |
1002 | struct platform_device_id *id = platform_get_device_id(dev); | ||
988 | int ret; | 1003 | int ret; |
989 | int irq; | 1004 | int irq; |
990 | 1005 | ||
@@ -1028,7 +1043,7 @@ static int i2c_pxa_probe(struct platform_device *dev) | |||
1028 | ret = -EIO; | 1043 | ret = -EIO; |
1029 | goto eremap; | 1044 | goto eremap; |
1030 | } | 1045 | } |
1031 | i2c->reg_shift = (cpu_is_pxa3xx() && (dev->id == 1)) ? 0 : 1; | 1046 | i2c->reg_shift = REG_SHIFT(id->driver_data); |
1032 | 1047 | ||
1033 | i2c->iobase = res->start; | 1048 | i2c->iobase = res->start; |
1034 | i2c->iosize = res_len(res); | 1049 | i2c->iosize = res_len(res); |
@@ -1150,6 +1165,7 @@ static struct platform_driver i2c_pxa_driver = { | |||
1150 | .name = "pxa2xx-i2c", | 1165 | .name = "pxa2xx-i2c", |
1151 | .owner = THIS_MODULE, | 1166 | .owner = THIS_MODULE, |
1152 | }, | 1167 | }, |
1168 | .id_table = i2c_pxa_id_table, | ||
1153 | }; | 1169 | }; |
1154 | 1170 | ||
1155 | static int __init i2c_adap_pxa_init(void) | 1171 | static int __init i2c_adap_pxa_init(void) |