diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-bcm-kona.c | 3 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-bcm2835.c | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-davinci.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-diolan-u2c.c | 16 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-imx.c | 4 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-omap.c | 30 | ||||
-rw-r--r-- | drivers/i2c/i2c-mux.c | 2 |
7 files changed, 46 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-bcm-kona.c b/drivers/i2c/busses/i2c-bcm-kona.c index 036cf03aeb61..18a74a6751a9 100644 --- a/drivers/i2c/busses/i2c-bcm-kona.c +++ b/drivers/i2c/busses/i2c-bcm-kona.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
21 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/clk.h> | ||
24 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
25 | 24 | ||
26 | /* Hardware register offsets and field defintions */ | 25 | /* Hardware register offsets and field defintions */ |
@@ -891,7 +890,7 @@ static const struct of_device_id bcm_kona_i2c_of_match[] = { | |||
891 | {.compatible = "brcm,kona-i2c",}, | 890 | {.compatible = "brcm,kona-i2c",}, |
892 | {}, | 891 | {}, |
893 | }; | 892 | }; |
894 | MODULE_DEVICE_TABLE(of, kona_i2c_of_match); | 893 | MODULE_DEVICE_TABLE(of, bcm_kona_i2c_of_match); |
895 | 894 | ||
896 | static struct platform_driver bcm_kona_i2c_driver = { | 895 | static struct platform_driver bcm_kona_i2c_driver = { |
897 | .driver = { | 896 | .driver = { |
diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index d7e8600f31fb..77df97b932af 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c | |||
@@ -299,6 +299,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev) | |||
299 | strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name)); | 299 | strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name)); |
300 | adap->algo = &bcm2835_i2c_algo; | 300 | adap->algo = &bcm2835_i2c_algo; |
301 | adap->dev.parent = &pdev->dev; | 301 | adap->dev.parent = &pdev->dev; |
302 | adap->dev.of_node = pdev->dev.of_node; | ||
302 | 303 | ||
303 | bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0); | 304 | bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0); |
304 | 305 | ||
diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index ff05d9fef4a8..af0b5830303d 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c | |||
@@ -125,12 +125,12 @@ static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = { | |||
125 | static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev, | 125 | static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev, |
126 | int reg, u16 val) | 126 | int reg, u16 val) |
127 | { | 127 | { |
128 | __raw_writew(val, i2c_dev->base + reg); | 128 | writew_relaxed(val, i2c_dev->base + reg); |
129 | } | 129 | } |
130 | 130 | ||
131 | static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg) | 131 | static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg) |
132 | { | 132 | { |
133 | return __raw_readw(i2c_dev->base + reg); | 133 | return readw_relaxed(i2c_dev->base + reg); |
134 | } | 134 | } |
135 | 135 | ||
136 | /* Generate a pulse on the i2c clock pin. */ | 136 | /* Generate a pulse on the i2c clock pin. */ |
diff --git a/drivers/i2c/busses/i2c-diolan-u2c.c b/drivers/i2c/busses/i2c-diolan-u2c.c index dae3ddfe7619..721f7ebf9a3b 100644 --- a/drivers/i2c/busses/i2c-diolan-u2c.c +++ b/drivers/i2c/busses/i2c-diolan-u2c.c | |||
@@ -25,8 +25,6 @@ | |||
25 | #define USB_VENDOR_ID_DIOLAN 0x0abf | 25 | #define USB_VENDOR_ID_DIOLAN 0x0abf |
26 | #define USB_DEVICE_ID_DIOLAN_U2C 0x3370 | 26 | #define USB_DEVICE_ID_DIOLAN_U2C 0x3370 |
27 | 27 | ||
28 | #define DIOLAN_OUT_EP 0x02 | ||
29 | #define DIOLAN_IN_EP 0x84 | ||
30 | 28 | ||
31 | /* commands via USB, must match command ids in the firmware */ | 29 | /* commands via USB, must match command ids in the firmware */ |
32 | #define CMD_I2C_READ 0x01 | 30 | #define CMD_I2C_READ 0x01 |
@@ -84,6 +82,7 @@ | |||
84 | struct i2c_diolan_u2c { | 82 | struct i2c_diolan_u2c { |
85 | u8 obuffer[DIOLAN_OUTBUF_LEN]; /* output buffer */ | 83 | u8 obuffer[DIOLAN_OUTBUF_LEN]; /* output buffer */ |
86 | u8 ibuffer[DIOLAN_INBUF_LEN]; /* input buffer */ | 84 | u8 ibuffer[DIOLAN_INBUF_LEN]; /* input buffer */ |
85 | int ep_in, ep_out; /* Endpoints */ | ||
87 | struct usb_device *usb_dev; /* the usb device for this device */ | 86 | struct usb_device *usb_dev; /* the usb device for this device */ |
88 | struct usb_interface *interface;/* the interface for this device */ | 87 | struct usb_interface *interface;/* the interface for this device */ |
89 | struct i2c_adapter adapter; /* i2c related things */ | 88 | struct i2c_adapter adapter; /* i2c related things */ |
@@ -109,7 +108,7 @@ static int diolan_usb_transfer(struct i2c_diolan_u2c *dev) | |||
109 | return -EINVAL; | 108 | return -EINVAL; |
110 | 109 | ||
111 | ret = usb_bulk_msg(dev->usb_dev, | 110 | ret = usb_bulk_msg(dev->usb_dev, |
112 | usb_sndbulkpipe(dev->usb_dev, DIOLAN_OUT_EP), | 111 | usb_sndbulkpipe(dev->usb_dev, dev->ep_out), |
113 | dev->obuffer, dev->olen, &actual, | 112 | dev->obuffer, dev->olen, &actual, |
114 | DIOLAN_USB_TIMEOUT); | 113 | DIOLAN_USB_TIMEOUT); |
115 | if (!ret) { | 114 | if (!ret) { |
@@ -118,7 +117,7 @@ static int diolan_usb_transfer(struct i2c_diolan_u2c *dev) | |||
118 | 117 | ||
119 | tmpret = usb_bulk_msg(dev->usb_dev, | 118 | tmpret = usb_bulk_msg(dev->usb_dev, |
120 | usb_rcvbulkpipe(dev->usb_dev, | 119 | usb_rcvbulkpipe(dev->usb_dev, |
121 | DIOLAN_IN_EP), | 120 | dev->ep_in), |
122 | dev->ibuffer, | 121 | dev->ibuffer, |
123 | sizeof(dev->ibuffer), &actual, | 122 | sizeof(dev->ibuffer), &actual, |
124 | DIOLAN_USB_TIMEOUT); | 123 | DIOLAN_USB_TIMEOUT); |
@@ -210,7 +209,7 @@ static void diolan_flush_input(struct i2c_diolan_u2c *dev) | |||
210 | int ret; | 209 | int ret; |
211 | 210 | ||
212 | ret = usb_bulk_msg(dev->usb_dev, | 211 | ret = usb_bulk_msg(dev->usb_dev, |
213 | usb_rcvbulkpipe(dev->usb_dev, DIOLAN_IN_EP), | 212 | usb_rcvbulkpipe(dev->usb_dev, dev->ep_in), |
214 | dev->ibuffer, sizeof(dev->ibuffer), &actual, | 213 | dev->ibuffer, sizeof(dev->ibuffer), &actual, |
215 | DIOLAN_USB_TIMEOUT); | 214 | DIOLAN_USB_TIMEOUT); |
216 | if (ret < 0 || actual == 0) | 215 | if (ret < 0 || actual == 0) |
@@ -445,9 +444,14 @@ static void diolan_u2c_free(struct i2c_diolan_u2c *dev) | |||
445 | static int diolan_u2c_probe(struct usb_interface *interface, | 444 | static int diolan_u2c_probe(struct usb_interface *interface, |
446 | const struct usb_device_id *id) | 445 | const struct usb_device_id *id) |
447 | { | 446 | { |
447 | struct usb_host_interface *hostif = interface->cur_altsetting; | ||
448 | struct i2c_diolan_u2c *dev; | 448 | struct i2c_diolan_u2c *dev; |
449 | int ret; | 449 | int ret; |
450 | 450 | ||
451 | if (hostif->desc.bInterfaceNumber != 0 | ||
452 | || hostif->desc.bNumEndpoints < 2) | ||
453 | return -ENODEV; | ||
454 | |||
451 | /* allocate memory for our device state and initialize it */ | 455 | /* allocate memory for our device state and initialize it */ |
452 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 456 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
453 | if (dev == NULL) { | 457 | if (dev == NULL) { |
@@ -455,6 +459,8 @@ static int diolan_u2c_probe(struct usb_interface *interface, | |||
455 | ret = -ENOMEM; | 459 | ret = -ENOMEM; |
456 | goto error; | 460 | goto error; |
457 | } | 461 | } |
462 | dev->ep_out = hostif->endpoint[0].desc.bEndpointAddress; | ||
463 | dev->ep_in = hostif->endpoint[1].desc.bEndpointAddress; | ||
458 | 464 | ||
459 | dev->usb_dev = usb_get_dev(interface_to_usbdev(interface)); | 465 | dev->usb_dev = usb_get_dev(interface_to_usbdev(interface)); |
460 | dev->interface = interface; | 466 | dev->interface = interface; |
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index 1d7efa3169cd..d0cfbb4cb964 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c | |||
@@ -312,7 +312,9 @@ static int i2c_imx_start(struct imx_i2c_struct *i2c_imx) | |||
312 | 312 | ||
313 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); | 313 | dev_dbg(&i2c_imx->adapter.dev, "<%s>\n", __func__); |
314 | 314 | ||
315 | clk_prepare_enable(i2c_imx->clk); | 315 | result = clk_prepare_enable(i2c_imx->clk); |
316 | if (result) | ||
317 | return result; | ||
316 | imx_i2c_write_reg(i2c_imx->ifdr, i2c_imx, IMX_I2C_IFDR); | 318 | imx_i2c_write_reg(i2c_imx->ifdr, i2c_imx, IMX_I2C_IFDR); |
317 | /* Enable I2C controller */ | 319 | /* Enable I2C controller */ |
318 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); | 320 | imx_i2c_write_reg(i2c_imx->hwdata->i2sr_clr_opcode, i2c_imx, IMX_I2C_I2SR); |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index a6a891d7970d..90dcc2eaac5f 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -266,13 +266,13 @@ static const u8 reg_map_ip_v2[] = { | |||
266 | static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, | 266 | static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev, |
267 | int reg, u16 val) | 267 | int reg, u16 val) |
268 | { | 268 | { |
269 | __raw_writew(val, i2c_dev->base + | 269 | writew_relaxed(val, i2c_dev->base + |
270 | (i2c_dev->regs[reg] << i2c_dev->reg_shift)); | 270 | (i2c_dev->regs[reg] << i2c_dev->reg_shift)); |
271 | } | 271 | } |
272 | 272 | ||
273 | static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) | 273 | static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg) |
274 | { | 274 | { |
275 | return __raw_readw(i2c_dev->base + | 275 | return readw_relaxed(i2c_dev->base + |
276 | (i2c_dev->regs[reg] << i2c_dev->reg_shift)); | 276 | (i2c_dev->regs[reg] << i2c_dev->reg_shift)); |
277 | } | 277 | } |
278 | 278 | ||
@@ -1037,6 +1037,20 @@ static const struct i2c_algorithm omap_i2c_algo = { | |||
1037 | }; | 1037 | }; |
1038 | 1038 | ||
1039 | #ifdef CONFIG_OF | 1039 | #ifdef CONFIG_OF |
1040 | static struct omap_i2c_bus_platform_data omap2420_pdata = { | ||
1041 | .rev = OMAP_I2C_IP_VERSION_1, | ||
1042 | .flags = OMAP_I2C_FLAG_NO_FIFO | | ||
1043 | OMAP_I2C_FLAG_SIMPLE_CLOCK | | ||
1044 | OMAP_I2C_FLAG_16BIT_DATA_REG | | ||
1045 | OMAP_I2C_FLAG_BUS_SHIFT_2, | ||
1046 | }; | ||
1047 | |||
1048 | static struct omap_i2c_bus_platform_data omap2430_pdata = { | ||
1049 | .rev = OMAP_I2C_IP_VERSION_1, | ||
1050 | .flags = OMAP_I2C_FLAG_BUS_SHIFT_2 | | ||
1051 | OMAP_I2C_FLAG_FORCE_19200_INT_CLK, | ||
1052 | }; | ||
1053 | |||
1040 | static struct omap_i2c_bus_platform_data omap3_pdata = { | 1054 | static struct omap_i2c_bus_platform_data omap3_pdata = { |
1041 | .rev = OMAP_I2C_IP_VERSION_1, | 1055 | .rev = OMAP_I2C_IP_VERSION_1, |
1042 | .flags = OMAP_I2C_FLAG_BUS_SHIFT_2, | 1056 | .flags = OMAP_I2C_FLAG_BUS_SHIFT_2, |
@@ -1055,6 +1069,14 @@ static const struct of_device_id omap_i2c_of_match[] = { | |||
1055 | .compatible = "ti,omap3-i2c", | 1069 | .compatible = "ti,omap3-i2c", |
1056 | .data = &omap3_pdata, | 1070 | .data = &omap3_pdata, |
1057 | }, | 1071 | }, |
1072 | { | ||
1073 | .compatible = "ti,omap2430-i2c", | ||
1074 | .data = &omap2430_pdata, | ||
1075 | }, | ||
1076 | { | ||
1077 | .compatible = "ti,omap2420-i2c", | ||
1078 | .data = &omap2420_pdata, | ||
1079 | }, | ||
1058 | { }, | 1080 | { }, |
1059 | }; | 1081 | }; |
1060 | MODULE_DEVICE_TABLE(of, omap_i2c_of_match); | 1082 | MODULE_DEVICE_TABLE(of, omap_i2c_of_match); |
@@ -1140,9 +1162,9 @@ omap_i2c_probe(struct platform_device *pdev) | |||
1140 | * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2. | 1162 | * Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2. |
1141 | * On omap1/3/2 Offset 4 is IE Reg the bit [15:14] is 0 at reset. | 1163 | * On omap1/3/2 Offset 4 is IE Reg the bit [15:14] is 0 at reset. |
1142 | * Also since the omap_i2c_read_reg uses reg_map_ip_* a | 1164 | * Also since the omap_i2c_read_reg uses reg_map_ip_* a |
1143 | * raw_readw is done. | 1165 | * readw_relaxed is done. |
1144 | */ | 1166 | */ |
1145 | rev = __raw_readw(dev->base + 0x04); | 1167 | rev = readw_relaxed(dev->base + 0x04); |
1146 | 1168 | ||
1147 | dev->scheme = OMAP_I2C_SCHEME(rev); | 1169 | dev->scheme = OMAP_I2C_SCHEME(rev); |
1148 | switch (dev->scheme) { | 1170 | switch (dev->scheme) { |
diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c index 797e3117bef7..2d0847b6be62 100644 --- a/drivers/i2c/i2c-mux.c +++ b/drivers/i2c/i2c-mux.c | |||
@@ -139,6 +139,8 @@ struct i2c_adapter *i2c_add_mux_adapter(struct i2c_adapter *parent, | |||
139 | priv->adap.algo = &priv->algo; | 139 | priv->adap.algo = &priv->algo; |
140 | priv->adap.algo_data = priv; | 140 | priv->adap.algo_data = priv; |
141 | priv->adap.dev.parent = &parent->dev; | 141 | priv->adap.dev.parent = &parent->dev; |
142 | priv->adap.retries = parent->retries; | ||
143 | priv->adap.timeout = parent->timeout; | ||
142 | 144 | ||
143 | /* Sanity check on class */ | 145 | /* Sanity check on class */ |
144 | if (i2c_mux_parent_classes(parent) & class) | 146 | if (i2c_mux_parent_classes(parent) & class) |