History

Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux

Pull more i2c updates from Wolfram Sang: - make Lenovo Yoga C630 boot now that the dependencies are merged - restore BlockProcessCall for i801, accidently removed in this merge window - a bugfix for the riic driver - an improvement to the slave-eeprom driver which should have been in the first pull request but sadly got lost in the process * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: slave-eeprom: Add read only mode i2c: i801: Bring back Block Process Call support for certain platforms i2c: riic: Clear NACK in tend isr i2c: qcom-geni: Disable DMA processing on the Lenovo Yoga C630

Linus Torvalds committed 7 years ago

Commit 9ecb3e12 parents 4d2af08 11af27f4 files · +21 −7Browse files

Unified · Split

4 files
  1. drivers/i2c/busses/i2c-i801.c +1 −0
  2. drivers/i2c/busses/i2c-qcom-geni.c +8 −4
  3. drivers/i2c/busses/i2c-riic.c +1 −0
  4. drivers/i2c/i2c-slave-eeprom.c +11 −3
drivers/i2c/busses/i2c-i801.c+1−0
@@ -1736,6 +1736,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1735 unmodified lines
1736 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS:1736 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS:
1737 case PCI_DEVICE_ID_INTEL_DNV_SMBUS:1737 case PCI_DEVICE_ID_INTEL_DNV_SMBUS:
1738 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:1738 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:
1739 priv->features |= FEATURE_BLOCK_PROC;
1739 priv->features |= FEATURE_I2C_BLOCK_READ;1740 priv->features |= FEATURE_I2C_BLOCK_READ;
1740 priv->features |= FEATURE_IRQ;1741 priv->features |= FEATURE_IRQ;
1741 priv->features |= FEATURE_SMBUS_PEC;1742 priv->features |= FEATURE_SMBUS_PEC;
drivers/i2c/busses/i2c-qcom-geni.c+8−4
@@ -355,11 +355,13 @@ static int geni_i2c_rx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 354 unmodified lines
355{355{
356 dma_addr_t rx_dma;356 dma_addr_t rx_dma;
357 unsigned long time_left;357 unsigned long time_left;
358 void *dma_buf;358 void *dma_buf = NULL;
359 struct geni_se *se = &gi2c->se;359 struct geni_se *se = &gi2c->se;
360 size_t len = msg->len;360 size_t len = msg->len;
361 361
362 dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);362 if (!of_machine_is_compatible("lenovo,yoga-c630"))
363 dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
364
363 if (dma_buf)365 if (dma_buf)
364 geni_se_select_mode(se, GENI_SE_DMA);366 geni_se_select_mode(se, GENI_SE_DMA);
365 else367 else
@@ -394,11 +396,13 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 28 unmodified lines
394{396{
395 dma_addr_t tx_dma;397 dma_addr_t tx_dma;
396 unsigned long time_left;398 unsigned long time_left;
397 void *dma_buf;399 void *dma_buf = NULL;
398 struct geni_se *se = &gi2c->se;400 struct geni_se *se = &gi2c->se;
399 size_t len = msg->len;401 size_t len = msg->len;
400 402
401 dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);403 if (!of_machine_is_compatible("lenovo,yoga-c630"))
404 dma_buf = i2c_get_dma_safe_msg_buf(msg, 32);
405
402 if (dma_buf)406 if (dma_buf)
403 geni_se_select_mode(se, GENI_SE_DMA);407 geni_se_select_mode(se, GENI_SE_DMA);
404 else408 else
drivers/i2c/busses/i2c-riic.c+1−0
@@ -202,6 +202,7 @@ static irqreturn_t riic_tend_isr(int irq, void *data) · 201 unmodified lines
202 if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) {202 if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) {
203 /* We got a NACKIE */203 /* We got a NACKIE */
204 readb(riic->base + RIIC_ICDRR); /* dummy read */204 readb(riic->base + RIIC_ICDRR); /* dummy read */
205 riic_clear_set_bit(riic, ICSR2_NACKF, 0, RIIC_ICSR2);
205 riic->err = -ENXIO;206 riic->err = -ENXIO;
206 } else if (riic->bytes_left) {207 } else if (riic->bytes_left) {
207 return IRQ_NONE;208 return IRQ_NONE;
drivers/i2c/i2c-slave-eeprom.c+11−3
@@ -33,11 +33,13 @@ struct eeprom_data { · 32 unmodified lines
33 u16 address_mask;33 u16 address_mask;
34 u8 num_address_bytes;34 u8 num_address_bytes;
35 u8 idx_write_cnt;35 u8 idx_write_cnt;
36 bool read_only;
36 u8 buffer[];37 u8 buffer[];
37};38};
38 39
39#define I2C_SLAVE_BYTELEN GENMASK(15, 0)40#define I2C_SLAVE_BYTELEN GENMASK(15, 0)
40#define I2C_SLAVE_FLAG_ADDR16 BIT(16)41#define I2C_SLAVE_FLAG_ADDR16 BIT(16)
42#define I2C_SLAVE_FLAG_RO BIT(17)
41#define I2C_SLAVE_DEVICE_MAGIC(_len, _flags) ((_flags) | (_len))43#define I2C_SLAVE_DEVICE_MAGIC(_len, _flags) ((_flags) | (_len))
42 44
43static int i2c_slave_eeprom_slave_cb(struct i2c_client *client,45static int i2c_slave_eeprom_slave_cb(struct i2c_client *client,
@@ -53,9 +55,11 @@ static int i2c_slave_eeprom_slave_cb(struct i2c_client *client, · 9 unmodified lines
53 eeprom->buffer_idx = *val | (eeprom->buffer_idx << 8);55 eeprom->buffer_idx = *val | (eeprom->buffer_idx << 8);
54 eeprom->idx_write_cnt++;56 eeprom->idx_write_cnt++;
55 } else {57 } else {
56 spin_lock(&eeprom->buffer_lock);58 if (!eeprom->read_only) {
57 eeprom->buffer[eeprom->buffer_idx++ & eeprom->address_mask] = *val;59 spin_lock(&eeprom->buffer_lock);
58 spin_unlock(&eeprom->buffer_lock);60 eeprom->buffer[eeprom->buffer_idx++ & eeprom->address_mask] = *val;
61 spin_unlock(&eeprom->buffer_lock);
62 }
59 }63 }
60 break;64 break;
61 65
@@ -130,6 +134,7 @@ static int i2c_slave_eeprom_probe(struct i2c_client *client, const struct i2c_de · 68 unmodified lines
130 eeprom->idx_write_cnt = 0;134 eeprom->idx_write_cnt = 0;
131 eeprom->num_address_bytes = flag_addr16 ? 2 : 1;135 eeprom->num_address_bytes = flag_addr16 ? 2 : 1;
132 eeprom->address_mask = size - 1;136 eeprom->address_mask = size - 1;
137 eeprom->read_only = FIELD_GET(I2C_SLAVE_FLAG_RO, id->driver_data);
133 spin_lock_init(&eeprom->buffer_lock);138 spin_lock_init(&eeprom->buffer_lock);
134 i2c_set_clientdata(client, eeprom);139 i2c_set_clientdata(client, eeprom);
135 140
@@ -165,8 +170,11 @@ static int i2c_slave_eeprom_remove(struct i2c_client *client) · 29 unmodified lines
165 170
166static const struct i2c_device_id i2c_slave_eeprom_id[] = {171static const struct i2c_device_id i2c_slave_eeprom_id[] = {
167 { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) },172 { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) },
173 { "slave-24c02ro", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, I2C_SLAVE_FLAG_RO) },
168 { "slave-24c32", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16) },174 { "slave-24c32", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16) },
175 { "slave-24c32ro", I2C_SLAVE_DEVICE_MAGIC(32768 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
169 { "slave-24c64", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16) },176 { "slave-24c64", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16) },
177 { "slave-24c64ro", I2C_SLAVE_DEVICE_MAGIC(65536 / 8, I2C_SLAVE_FLAG_ADDR16 | I2C_SLAVE_FLAG_RO) },
170 { }178 { }
171};179};
172MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id);180MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t