Skip to content

Commit c440f99

Browse files
committed
Merge tag 'i2c-for-6.1-rc1-batch2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull more i2c updates from Wolfram Sang: - correct a variable type in the new pci1xxxx driver - add a new SoC to the qcom-cci driver - fix an issue with the designware driver which now got enough testing - the aspeed driver now handles busy target backends better * tag 'i2c-for-6.1-rc1-batch2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: aspeed: Assert NAK when slave is busy i2c: designware: Fix handling of real but unexpected device interrupts i2c: qcom-cci: Add MSM8226 compatible dt-bindings: i2c: qcom,i2c-cci: Document clocks for MSM8974 dt-bindings: i2c: qcom,i2c-cci: Document MSM8226 compatible i2c: microchip: pci1xxxx: Fix comparison of -EPERM against an unsigned variable
2 parents 979bb59 + fd66bd7 commit c440f99

File tree

6 files changed

+49
-6
lines changed

6 files changed

+49
-6
lines changed

Documentation/devicetree/bindings/i2c/qcom,i2c-cci.yaml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ maintainers:
1313
properties:
1414
compatible:
1515
enum:
16+
- qcom,msm8226-cci
1617
- qcom,msm8916-cci
1718
- qcom,msm8974-cci
1819
- qcom,msm8996-cci
@@ -27,11 +28,11 @@ properties:
2728
const: 0
2829

2930
clocks:
30-
minItems: 4
31+
minItems: 3
3132
maxItems: 6
3233

3334
clock-names:
34-
minItems: 4
35+
minItems: 3
3536
maxItems: 6
3637

3738
interrupts:
@@ -78,11 +79,29 @@ allOf:
7879
compatible:
7980
contains:
8081
enum:
82+
- qcom,msm8226-cci
8183
- qcom,msm8916-cci
8284
then:
8385
properties:
8486
i2c-bus@1: false
8587

88+
- if:
89+
properties:
90+
compatible:
91+
contains:
92+
enum:
93+
- qcom,msm8226-cci
94+
- qcom,msm8974-cci
95+
then:
96+
properties:
97+
clocks:
98+
maxItems: 3
99+
clock-names:
100+
items:
101+
- const: camss_top_ahb
102+
- const: cci_ahb
103+
- const: cci
104+
86105
- if:
87106
properties:
88107
compatible:

drivers/i2c/busses/i2c-aspeed.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
244244
u32 command, irq_handled = 0;
245245
struct i2c_client *slave = bus->slave;
246246
u8 value;
247+
int ret;
247248

248249
if (!slave)
249250
return 0;
@@ -311,7 +312,13 @@ static u32 aspeed_i2c_slave_irq(struct aspeed_i2c_bus *bus, u32 irq_status)
311312
break;
312313
case ASPEED_I2C_SLAVE_WRITE_REQUESTED:
313314
bus->slave_state = ASPEED_I2C_SLAVE_WRITE_RECEIVED;
314-
i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
315+
ret = i2c_slave_event(slave, I2C_SLAVE_WRITE_REQUESTED, &value);
316+
/*
317+
* Slave ACK's on this address phase already but as the backend driver
318+
* returns an errno, the bus driver should nack the next incoming byte.
319+
*/
320+
if (ret < 0)
321+
writel(ASPEED_I2CD_M_S_RX_CMD_LAST, bus->base + ASPEED_I2C_CMD_REG);
315322
break;
316323
case ASPEED_I2C_SLAVE_WRITE_RECEIVED:
317324
i2c_slave_event(slave, I2C_SLAVE_WRITE_RECEIVED, &value);

drivers/i2c/busses/i2c-designware-core.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,9 @@
126126
* status codes
127127
*/
128128
#define STATUS_IDLE 0x0
129-
#define STATUS_WRITE_IN_PROGRESS 0x1
130-
#define STATUS_READ_IN_PROGRESS 0x2
129+
#define STATUS_ACTIVE 0x1
130+
#define STATUS_WRITE_IN_PROGRESS 0x2
131+
#define STATUS_READ_IN_PROGRESS 0x4
131132

132133
/*
133134
* operation modes
@@ -334,12 +335,14 @@ void i2c_dw_disable_int(struct dw_i2c_dev *dev);
334335

335336
static inline void __i2c_dw_enable(struct dw_i2c_dev *dev)
336337
{
338+
dev->status |= STATUS_ACTIVE;
337339
regmap_write(dev->map, DW_IC_ENABLE, 1);
338340
}
339341

340342
static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
341343
{
342344
regmap_write(dev->map, DW_IC_ENABLE, 0);
345+
dev->status &= ~STATUS_ACTIVE;
343346
}
344347

345348
void __i2c_dw_disable(struct dw_i2c_dev *dev);

drivers/i2c/busses/i2c-designware-master.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,19 @@ static int i2c_dw_irq_handler_master(struct dw_i2c_dev *dev)
716716
u32 stat;
717717

718718
stat = i2c_dw_read_clear_intrbits(dev);
719+
720+
if (!(dev->status & STATUS_ACTIVE)) {
721+
/*
722+
* Unexpected interrupt in driver point of view. State
723+
* variables are either unset or stale so acknowledge and
724+
* disable interrupts for suppressing further interrupts if
725+
* interrupt really came from this HW (E.g. firmware has left
726+
* the HW active).
727+
*/
728+
regmap_write(dev->map, DW_IC_INTR_MASK, 0);
729+
return 0;
730+
}
731+
719732
if (stat & DW_IC_INTR_TX_ABRT) {
720733
dev->cmd_err |= DW_IC_ERR_TX_ABRT;
721734
dev->status = STATUS_IDLE;

drivers/i2c/busses/i2c-mchp-pci1xxxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ static void pci1xxxx_i2c_init(struct pci1xxxx_i2c *i2c)
708708
void __iomem *p2 = i2c->i2c_base + SMBUS_STATUS_REG_OFF;
709709
void __iomem *p1 = i2c->i2c_base + SMB_GPR_REG;
710710
u8 regval;
711-
u8 ret;
711+
int ret;
712712

713713
ret = set_sys_lock(i2c);
714714
if (ret == -EPERM) {

drivers/i2c/busses/i2c-qcom-cci.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ static const struct cci_data cci_v2_data = {
807807
};
808808

809809
static const struct of_device_id cci_dt_match[] = {
810+
{ .compatible = "qcom,msm8226-cci", .data = &cci_v1_data},
810811
{ .compatible = "qcom,msm8916-cci", .data = &cci_v1_data},
811812
{ .compatible = "qcom,msm8974-cci", .data = &cci_v1_5_data},
812813
{ .compatible = "qcom,msm8996-cci", .data = &cci_v2_data},

0 commit comments

Comments
 (0)