Skip to content

Commit dc418f6

Browse files
committed
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "Some easy but needed fixes for i2c drivers since rc1" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: bcm2835: Linking platform nodes to adapter nodes i2c: omap: raw read and write endian fix i2c: i2c-bcm-kona: Fix module build i2c: i2c-diolan-u2c: different usb endpoints for DLN-2-U2C i2c: bcm-kona: remove duplicated include i2c: davinci: raw read and write endian fix
2 parents 7224b31 + 07a27a0 commit dc418f6

File tree

5 files changed

+19
-13
lines changed

5 files changed

+19
-13
lines changed

drivers/i2c/busses/i2c-bcm-kona.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <linux/platform_device.h>
2121
#include <linux/clk.h>
2222
#include <linux/io.h>
23-
#include <linux/clk.h>
2423
#include <linux/slab.h>
2524

2625
/* Hardware register offsets and field defintions */
@@ -891,7 +890,7 @@ static const struct of_device_id bcm_kona_i2c_of_match[] = {
891890
{.compatible = "brcm,kona-i2c",},
892891
{},
893892
};
894-
MODULE_DEVICE_TABLE(of, kona_i2c_of_match);
893+
MODULE_DEVICE_TABLE(of, bcm_kona_i2c_of_match);
895894

896895
static struct platform_driver bcm_kona_i2c_driver = {
897896
.driver = {

drivers/i2c/busses/i2c-bcm2835.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
299299
strlcpy(adap->name, "bcm2835 I2C adapter", sizeof(adap->name));
300300
adap->algo = &bcm2835_i2c_algo;
301301
adap->dev.parent = &pdev->dev;
302+
adap->dev.of_node = pdev->dev.of_node;
302303

303304
bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0);
304305

drivers/i2c/busses/i2c-davinci.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = {
125125
static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev,
126126
int reg, u16 val)
127127
{
128-
__raw_writew(val, i2c_dev->base + reg);
128+
writew_relaxed(val, i2c_dev->base + reg);
129129
}
130130

131131
static inline u16 davinci_i2c_read_reg(struct davinci_i2c_dev *i2c_dev, int reg)
132132
{
133-
return __raw_readw(i2c_dev->base + reg);
133+
return readw_relaxed(i2c_dev->base + reg);
134134
}
135135

136136
/* Generate a pulse on the i2c clock pin. */

drivers/i2c/busses/i2c-diolan-u2c.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#define USB_VENDOR_ID_DIOLAN 0x0abf
2626
#define USB_DEVICE_ID_DIOLAN_U2C 0x3370
2727

28-
#define DIOLAN_OUT_EP 0x02
29-
#define DIOLAN_IN_EP 0x84
3028

3129
/* commands via USB, must match command ids in the firmware */
3230
#define CMD_I2C_READ 0x01
@@ -84,6 +82,7 @@
8482
struct i2c_diolan_u2c {
8583
u8 obuffer[DIOLAN_OUTBUF_LEN]; /* output buffer */
8684
u8 ibuffer[DIOLAN_INBUF_LEN]; /* input buffer */
85+
int ep_in, ep_out; /* Endpoints */
8786
struct usb_device *usb_dev; /* the usb device for this device */
8887
struct usb_interface *interface;/* the interface for this device */
8988
struct i2c_adapter adapter; /* i2c related things */
@@ -109,7 +108,7 @@ static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
109108
return -EINVAL;
110109

111110
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),
113112
dev->obuffer, dev->olen, &actual,
114113
DIOLAN_USB_TIMEOUT);
115114
if (!ret) {
@@ -118,7 +117,7 @@ static int diolan_usb_transfer(struct i2c_diolan_u2c *dev)
118117

119118
tmpret = usb_bulk_msg(dev->usb_dev,
120119
usb_rcvbulkpipe(dev->usb_dev,
121-
DIOLAN_IN_EP),
120+
dev->ep_in),
122121
dev->ibuffer,
123122
sizeof(dev->ibuffer), &actual,
124123
DIOLAN_USB_TIMEOUT);
@@ -210,7 +209,7 @@ static void diolan_flush_input(struct i2c_diolan_u2c *dev)
210209
int ret;
211210

212211
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),
214213
dev->ibuffer, sizeof(dev->ibuffer), &actual,
215214
DIOLAN_USB_TIMEOUT);
216215
if (ret < 0 || actual == 0)
@@ -445,16 +444,23 @@ static void diolan_u2c_free(struct i2c_diolan_u2c *dev)
445444
static int diolan_u2c_probe(struct usb_interface *interface,
446445
const struct usb_device_id *id)
447446
{
447+
struct usb_host_interface *hostif = interface->cur_altsetting;
448448
struct i2c_diolan_u2c *dev;
449449
int ret;
450450

451+
if (hostif->desc.bInterfaceNumber != 0
452+
|| hostif->desc.bNumEndpoints < 2)
453+
return -ENODEV;
454+
451455
/* allocate memory for our device state and initialize it */
452456
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
453457
if (dev == NULL) {
454458
dev_err(&interface->dev, "no memory for device state\n");
455459
ret = -ENOMEM;
456460
goto error;
457461
}
462+
dev->ep_out = hostif->endpoint[0].desc.bEndpointAddress;
463+
dev->ep_in = hostif->endpoint[1].desc.bEndpointAddress;
458464

459465
dev->usb_dev = usb_get_dev(interface_to_usbdev(interface));
460466
dev->interface = interface;

drivers/i2c/busses/i2c-omap.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,13 @@ static const u8 reg_map_ip_v2[] = {
266266
static inline void omap_i2c_write_reg(struct omap_i2c_dev *i2c_dev,
267267
int reg, u16 val)
268268
{
269-
__raw_writew(val, i2c_dev->base +
269+
writew_relaxed(val, i2c_dev->base +
270270
(i2c_dev->regs[reg] << i2c_dev->reg_shift));
271271
}
272272

273273
static inline u16 omap_i2c_read_reg(struct omap_i2c_dev *i2c_dev, int reg)
274274
{
275-
return __raw_readw(i2c_dev->base +
275+
return readw_relaxed(i2c_dev->base +
276276
(i2c_dev->regs[reg] << i2c_dev->reg_shift));
277277
}
278278

@@ -1162,9 +1162,9 @@ omap_i2c_probe(struct platform_device *pdev)
11621162
* Read the Rev hi bit-[15:14] ie scheme this is 1 indicates ver2.
11631163
* On omap1/3/2 Offset 4 is IE Reg the bit [15:14] is 0 at reset.
11641164
* Also since the omap_i2c_read_reg uses reg_map_ip_* a
1165-
* raw_readw is done.
1165+
* readw_relaxed is done.
11661166
*/
1167-
rev = __raw_readw(dev->base + 0x04);
1167+
rev = readw_relaxed(dev->base + 0x04);
11681168

11691169
dev->scheme = OMAP_I2C_SCHEME(rev);
11701170
switch (dev->scheme) {

0 commit comments

Comments
 (0)