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
Unified · Split
| @@ -1736,6 +1736,7 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id) · 1735 unmodified lines | ||
| 1736 | 1736 | case PCI_DEVICE_ID_INTEL_LEWISBURG_SSKU_SMBUS: |
| 1737 | 1737 | case PCI_DEVICE_ID_INTEL_DNV_SMBUS: |
| 1738 | 1738 | case PCI_DEVICE_ID_INTEL_KABYLAKE_PCH_H_SMBUS: |
| 1739 | + priv->features |= FEATURE_BLOCK_PROC; | |
| 1739 | 1740 | priv->features |= FEATURE_I2C_BLOCK_READ; |
| 1740 | 1741 | priv->features |= FEATURE_IRQ; |
| 1741 | 1742 | priv->features |= FEATURE_SMBUS_PEC; |
| @@ -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 | 356 | dma_addr_t rx_dma; |
| 357 | 357 | unsigned long time_left; |
| 358 | − void *dma_buf; | |
| 358 | + void *dma_buf = NULL; | |
| 359 | 359 | struct geni_se *se = &gi2c->se; |
| 360 | 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 | 365 | if (dma_buf) |
| 364 | 366 | geni_se_select_mode(se, GENI_SE_DMA); |
| 365 | 367 | 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 | 397 | dma_addr_t tx_dma; |
| 396 | 398 | unsigned long time_left; |
| 397 | − void *dma_buf; | |
| 399 | + void *dma_buf = NULL; | |
| 398 | 400 | struct geni_se *se = &gi2c->se; |
| 399 | 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 | 406 | if (dma_buf) |
| 403 | 407 | geni_se_select_mode(se, GENI_SE_DMA); |
| 404 | 408 | else |
| @@ -202,6 +202,7 @@ static irqreturn_t riic_tend_isr(int irq, void *data) · 201 unmodified lines | ||
| 202 | 202 | if (readb(riic->base + RIIC_ICSR2) & ICSR2_NACKF) { |
| 203 | 203 | /* We got a NACKIE */ |
| 204 | 204 | readb(riic->base + RIIC_ICDRR); /* dummy read */ |
| 205 | + riic_clear_set_bit(riic, ICSR2_NACKF, 0, RIIC_ICSR2); | |
| 205 | 206 | riic->err = -ENXIO; |
| 206 | 207 | } else if (riic->bytes_left) { |
| 207 | 208 | return IRQ_NONE; |
| @@ -33,11 +33,13 @@ struct eeprom_data { · 32 unmodified lines | ||
| 33 | 33 | u16 address_mask; |
| 34 | 34 | u8 num_address_bytes; |
| 35 | 35 | u8 idx_write_cnt; |
| 36 | + bool read_only; | |
| 36 | 37 | u8 buffer[]; |
| 37 | 38 | }; |
| 38 | 39 | |
| 39 | 40 | #define I2C_SLAVE_BYTELEN GENMASK(15, 0) |
| 40 | 41 | #define I2C_SLAVE_FLAG_ADDR16 BIT(16) |
| 42 | +#define I2C_SLAVE_FLAG_RO BIT(17) | |
| 41 | 43 | #define I2C_SLAVE_DEVICE_MAGIC(_len, _flags) ((_flags) | (_len)) |
| 42 | 44 | |
| 43 | 45 | 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 | ||
| 53 | 55 | eeprom->buffer_idx = *val | (eeprom->buffer_idx << 8); |
| 54 | 56 | eeprom->idx_write_cnt++; |
| 55 | 57 | } 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 | + } | |
| 59 | 63 | } |
| 60 | 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 | 134 | eeprom->idx_write_cnt = 0; |
| 131 | 135 | eeprom->num_address_bytes = flag_addr16 ? 2 : 1; |
| 132 | 136 | eeprom->address_mask = size - 1; |
| 137 | + eeprom->read_only = FIELD_GET(I2C_SLAVE_FLAG_RO, id->driver_data); | |
| 133 | 138 | spin_lock_init(&eeprom->buffer_lock); |
| 134 | 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 | |
| 166 | 171 | static const struct i2c_device_id i2c_slave_eeprom_id[] = { |
| 167 | 172 | { "slave-24c02", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, 0) }, |
| 173 | + { "slave-24c02ro", I2C_SLAVE_DEVICE_MAGIC(2048 / 8, I2C_SLAVE_FLAG_RO) }, | |
| 168 | 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 | 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 | }; |
| 172 | 180 | MODULE_DEVICE_TABLE(i2c, i2c_slave_eeprom_id); |