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
17361736 case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS:
17371737 case PCI_DEVICE_ID_INTEL_DNV_SMBUS:
17381738 case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS:
1739+ priv->features |= FEATURE_BLOCK_PROC;
17391740 priv->features |= FEATURE_I2C_BLOCK_READ;
17401741 priv->features |= FEATURE_IRQ;
17411742 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
355355 {
356356 dma_addr_t rx_dma;
357357 unsigned long time_left;
358− void *dma_buf;
358+ void *dma_buf = NULL;
359359 struct geni_se *se = &gi2c->se;
360360 size_t len = msg->len;
361361
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+
363365 if (dma_buf)
364366 geni_se_select_mode(se, GENI_SE_DMA);
365367 else
@@ -394,11 +396,13 @@ static int geni_i2c_tx_one_msg(struct geni_i2c_dev *gi2c, struct i2c_msg *msg, · 28 unmodified lines
394396 {
395397 dma_addr_t tx_dma;
396398 unsigned long time_left;
397− void *dma_buf;
399+ void *dma_buf = NULL;
398400 struct geni_se *se = &gi2c->se;
399401 size_t len = msg->len;
400402
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+
402406 if (dma_buf)
403407 geni_se_select_mode(se, GENI_SE_DMA);
404408 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
202202 if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) {
203203 /* We got a NACKIE */
204204 readb(riic->base + RIIC_ICDRR); /* dummy read */
205+ riic_clear_set_bit(riic, ICSR2_NACKF, 0, RIIC_ICSR2);
205206 riic->err = -ENXIO;
206207 } else if (riic->bytes_left) {
207208 return IRQ_NONE;
drivers/i2c/i2c-slave-eeprom.c+11−3
@@ -33,11 +33,13 @@ struct eeprom_data { · 32 unmodified lines
3333 u16 address_mask;
3434 u8 num_address_bytes;
3535 u8 idx_write_cnt;
36+ bool read_only;
3637 u8 buffer[];
3738 };
3839
3940 #define I2C_SLAVE_BYTELEN GENMASK(15, 0)
4041 #define I2C_SLAVE_FLAG_ADDR16 BIT(16)
42+#define I2C_SLAVE_FLAG_RO BIT(17)
4143 #define I2C_SLAVE_DEVICE_MAGIC(_len, _flags) ((_flags) | (_len))
4244
4345 static 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
5355 eeprom->buffer_idx = *val | (eeprom->buffer_idx << 8);
5456 eeprom->idx_write_cnt++;
5557 } else {
56− spin_lock(&eeprom->buffer_lock);
57− eeprom->buffer[eeprom->buffer_idx++ & eeprom->address_mask] = *val;
58− spin_unlock(&eeprom->buffer_lock);
58+ if (!eeprom->read_only) {
59+ spin_lock(&eeprom->buffer_lock);
60+ eeprom->buffer[eeprom->buffer_idx++ & eeprom->address_mask] = *val;
61+ spin_unlock(&eeprom->buffer_lock);
62+ }
5963 }
6064 break;
6165
@@ -130,6 +134,7 @@ static int i2c_slave_eeprom_probe(struct i2c_client *client, const struct i2c_de · 68 unmodified lines
130134 eeprom->idx_write_cnt = 0;
131135 eeprom->num_address_bytes = flag_addr16 ? 2 : 1;
132136 eeprom->address_mask = size - 1;
137+ eeprom->read_only = FIELD_GET(I2C_SLAVE_FLAG_RO, id->driver_data);
133138 spin_lock_init(&eeprom->buffer_lock);
134139 i2c_set_clientdata(client, eeprom);
135140
@@ -165,8 +170,11 @@ static int i2c_slave_eeprom_remove(struct i2c_client *client) · 29 unmodified lines
165170
166171 static const struct i2c_device_id i2c_slave_eeprom_id[] = {
167172 { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) },
173+ { "slave-24c02ro", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, I2C_SLAVE_FLAG_RO) },
168174 { "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) },
169176 { "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) },
170178 { }
171179 };
172180 MODULE_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