|
@@ -83,12 +83,12 @@ static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
|
|
|
if (ret == 0x94 + len - 1) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("R05 returned 0x%02x: I2C ACK error\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
if (ret < 0) {
|
|
|
pr_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return ret;
|
|
|
}
|
|
|
msleep(5);
|
|
@@ -118,7 +118,7 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
|
|
|
ret = dev->em28xx_write_regs(dev, 0x04, buf2, 2);
|
|
|
if (ret != 2) {
|
|
|
pr_warn("failed to trigger read from i2c address 0x%x (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return (ret < 0) ? ret : -EIO;
|
|
|
}
|
|
|
|
|
@@ -130,12 +130,12 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
|
|
|
if (ret == 0x94 + len - 1) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("R05 returned 0x%02x: I2C ACK error\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
if (ret < 0) {
|
|
|
pr_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return ret;
|
|
|
}
|
|
|
msleep(5);
|
|
@@ -143,14 +143,14 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
|
|
|
if (ret != 0x84 + len - 1) {
|
|
|
if (i2c_debug)
|
|
|
pr_warn("read from i2c device at 0x%x timed out\n",
|
|
|
- addr);
|
|
|
+ addr);
|
|
|
}
|
|
|
|
|
|
/* get the received message */
|
|
|
ret = dev->em28xx_read_reg_req_len(dev, 0x00, 4-len, buf2, len);
|
|
|
if (ret != len) {
|
|
|
pr_warn("reading from i2c device at 0x%x failed: couldn't get the received message from the bridge (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return (ret < 0) ? ret : -EIO;
|
|
|
}
|
|
|
for (i = 0; i < len; i++)
|
|
@@ -195,11 +195,11 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
if (ret != len) {
|
|
|
if (ret < 0) {
|
|
|
pr_warn("writing to i2c device at 0x%x failed (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return ret;
|
|
|
} else {
|
|
|
pr_warn("%i bytes write to i2c device at 0x%x requested, but %i bytes written\n",
|
|
|
- len, addr, ret);
|
|
|
+ len, addr, ret);
|
|
|
return -EIO;
|
|
|
}
|
|
|
}
|
|
@@ -212,12 +212,12 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
if (ret == 0x10) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("I2C ACK error on writing to addr 0x%02x\n",
|
|
|
- addr);
|
|
|
+ addr);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
if (ret < 0) {
|
|
|
pr_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return ret;
|
|
|
}
|
|
|
msleep(5);
|
|
@@ -232,12 +232,12 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
/* NOTE: these errors seem to be related to clock stretching */
|
|
|
if (i2c_debug)
|
|
|
pr_warn("write to i2c device at 0x%x timed out (status=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return -ETIMEDOUT;
|
|
|
}
|
|
|
|
|
|
pr_warn("write to i2c device at 0x%x failed with unknown error (status=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
@@ -260,7 +260,7 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
|
|
|
ret = dev->em28xx_read_reg_req_len(dev, 2, addr, buf, len);
|
|
|
if (ret < 0) {
|
|
|
pr_warn("reading from i2c device at 0x%x failed (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return ret;
|
|
|
}
|
|
|
/*
|
|
@@ -278,13 +278,13 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
|
|
|
return len;
|
|
|
if (ret < 0) {
|
|
|
pr_warn("failed to get i2c transfer status from bridge register (error=%i)\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return ret;
|
|
|
}
|
|
|
if (ret == 0x10) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("I2C ACK error on writing to addr 0x%02x\n",
|
|
|
- addr);
|
|
|
+ addr);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
|
|
@@ -292,12 +292,12 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
|
|
|
/* NOTE: these errors seem to be related to clock stretching */
|
|
|
if (i2c_debug)
|
|
|
pr_warn("write to i2c device at 0x%x timed out (status=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return -ETIMEDOUT;
|
|
|
}
|
|
|
|
|
|
pr_warn("write to i2c device at 0x%x failed with unknown error (status=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return -EIO;
|
|
|
}
|
|
|
|
|
@@ -337,11 +337,11 @@ static int em25xx_bus_B_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
if (ret != len) {
|
|
|
if (ret < 0) {
|
|
|
pr_warn("writing to i2c device at 0x%x failed (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return ret;
|
|
|
} else {
|
|
|
pr_warn("%i bytes write to i2c device at 0x%x requested, but %i bytes written\n",
|
|
|
- len, addr, ret);
|
|
|
+ len, addr, ret);
|
|
|
return -EIO;
|
|
|
}
|
|
|
}
|
|
@@ -356,7 +356,7 @@ static int em25xx_bus_B_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
else if (ret > 0) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("Bus B R08 returned 0x%02x: I2C ACK error\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
|
|
@@ -388,7 +388,7 @@ static int em25xx_bus_B_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
ret = dev->em28xx_read_reg_req_len(dev, 0x06, addr, buf, len);
|
|
|
if (ret < 0) {
|
|
|
pr_warn("reading from i2c device at 0x%x failed (error=%i)\n",
|
|
|
- addr, ret);
|
|
|
+ addr, ret);
|
|
|
return ret;
|
|
|
}
|
|
|
/*
|
|
@@ -411,7 +411,7 @@ static int em25xx_bus_B_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf,
|
|
|
else if (ret > 0) {
|
|
|
if (i2c_debug == 1)
|
|
|
pr_warn("Bus B R08 returned 0x%02x: I2C ACK error\n",
|
|
|
- ret);
|
|
|
+ ret);
|
|
|
return -ENXIO;
|
|
|
}
|
|
|
|
|
@@ -544,11 +544,11 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
|
|
if (rc < 0) {
|
|
|
if (rc == -ENXIO) {
|
|
|
if (i2c_debug > 1)
|
|
|
- printk(KERN_CONT " no device\n");
|
|
|
+ pr_cont(" no device\n");
|
|
|
rc = -ENODEV;
|
|
|
} else {
|
|
|
if (i2c_debug > 1)
|
|
|
- printk(KERN_CONT " ERROR: %i\n", rc);
|
|
|
+ pr_cont(" ERROR: %i\n", rc);
|
|
|
}
|
|
|
rt_mutex_unlock(&dev->i2c_bus_lock);
|
|
|
return rc;
|
|
@@ -558,11 +558,11 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
|
|
rc = i2c_recv_bytes(i2c_bus, msgs[i]);
|
|
|
|
|
|
if (i2c_debug > 1 && rc >= 0)
|
|
|
- printk(KERN_CONT " %*ph",
|
|
|
+ pr_cont(" %*ph",
|
|
|
msgs[i].len, msgs[i].buf);
|
|
|
} else {
|
|
|
if (i2c_debug > 1)
|
|
|
- printk(KERN_CONT " %*ph",
|
|
|
+ pr_cont(" %*ph",
|
|
|
msgs[i].len, msgs[i].buf);
|
|
|
|
|
|
/* write bytes */
|
|
@@ -570,12 +570,12 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap,
|
|
|
}
|
|
|
if (rc < 0) {
|
|
|
if (i2c_debug > 1)
|
|
|
- printk(KERN_CONT " ERROR: %i\n", rc);
|
|
|
+ pr_cont(" ERROR: %i\n", rc);
|
|
|
rt_mutex_unlock(&dev->i2c_bus_lock);
|
|
|
return rc;
|
|
|
}
|
|
|
if (i2c_debug > 1)
|
|
|
- printk(KERN_CONT "\n");
|
|
|
+ pr_cont("\n");
|
|
|
}
|
|
|
|
|
|
rt_mutex_unlock(&dev->i2c_bus_lock);
|
|
@@ -709,10 +709,10 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
|
|
|
mc_start = (data[1] << 8) + 4; /* usually 0x0004 */
|
|
|
|
|
|
pr_info("EEPROM ID = %02x %02x %02x %02x, EEPROM hash = 0x%08lx\n",
|
|
|
- data[0], data[1], data[2], data[3], dev->hash);
|
|
|
+ data[0], data[1], data[2], data[3], dev->hash);
|
|
|
pr_info("EEPROM info:\n");
|
|
|
pr_info("\tmicrocode start address = 0x%04x, boot configuration = 0x%02x\n",
|
|
|
- mc_start, data[2]);
|
|
|
+ mc_start, data[2]);
|
|
|
/*
|
|
|
* boot configuration (address 0x0002):
|
|
|
* [0] microcode download speed: 1 = 400 kHz; 0 = 100 kHz
|
|
@@ -731,7 +731,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
|
|
|
data);
|
|
|
if (err != 2) {
|
|
|
pr_err("failed to read hardware configuration data from eeprom (err=%d)\n",
|
|
|
- err);
|
|
|
+ err);
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -749,7 +749,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
|
|
|
data);
|
|
|
if (err != len) {
|
|
|
pr_err("failed to read hardware configuration data from eeprom (err=%d)\n",
|
|
|
- err);
|
|
|
+ err);
|
|
|
goto error;
|
|
|
}
|
|
|
|
|
@@ -769,7 +769,7 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
|
|
|
data[2] == 0x67 && data[3] == 0x95) {
|
|
|
dev->hash = em28xx_hash_mem(data, len, 32);
|
|
|
pr_info("EEPROM ID = %02x %02x %02x %02x, EEPROM hash = 0x%08lx\n",
|
|
|
- data[0], data[1], data[2], data[3], dev->hash);
|
|
|
+ data[0], data[1], data[2], data[3], dev->hash);
|
|
|
pr_info("EEPROM info:\n");
|
|
|
} else {
|
|
|
pr_info("unknown eeprom format or eeprom corrupted !\n");
|
|
@@ -916,7 +916,7 @@ void em28xx_do_i2c_scan(struct em28xx *dev, unsigned bus)
|
|
|
continue;
|
|
|
i2c_devicelist[i] = i;
|
|
|
pr_info("found i2c device @ 0x%x on bus %d [%s]\n",
|
|
|
- i << 1, bus, i2c_devs[i] ? i2c_devs[i] : "???");
|
|
|
+ i << 1, bus, i2c_devs[i] ? i2c_devs[i] : "???");
|
|
|
}
|
|
|
|
|
|
if (bus == dev->def_i2c_bus)
|
|
@@ -951,7 +951,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
|
|
|
retval = i2c_add_adapter(&dev->i2c_adap[bus]);
|
|
|
if (retval < 0) {
|
|
|
pr_err("%s: i2c_add_adapter failed! retval [%d]\n",
|
|
|
- __func__, retval);
|
|
|
+ __func__, retval);
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
@@ -963,7 +963,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
|
|
|
retval = em28xx_i2c_eeprom(dev, bus, &dev->eedata, &dev->eedata_len);
|
|
|
if ((retval < 0) && (retval != -ENODEV)) {
|
|
|
pr_err("%s: em28xx_i2_eeprom failed! retval [%d]\n",
|
|
|
- __func__, retval);
|
|
|
+ __func__, retval);
|
|
|
|
|
|
return retval;
|
|
|
}
|