Skip to content

Commit 91962fe

Browse files
author
Wolfram Sang
committed
Merge tag 'i2c-host-6.9' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux into i2c/for-mergewindow
The i801 and designware drivers received most of the changes, including refactorings and some additions. Recovery changes for the iMX and iMX-LPI2C are now utilizing the generic i2c support. The Cadence driver now supports system suspend and resume. The hisi, mpc, sh_mobile, and npcm drivers have undergone some cleanups and improvements. Meanwhile, Uwe continues his work on converting the "remove" callback to become a void function. The pca954x mux driver now supports additional configurations, such as isolating faulty channels and flushing stuck buses, among others. Support has been added for Renesas r8a779h0, i.MX95 LPI2C, and Microchip sam9x7. Meanwhile, Geert lays the groundwork for the upcoming R-Car Gen4.
2 parents 68a04ae + 06d0cb6 commit 91962fe

21 files changed

+501
-446
lines changed

Documentation/devicetree/bindings/i2c/atmel,at91sam-i2c.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ properties:
2525
- atmel,sama5d2-i2c
2626
- microchip,sam9x60-i2c
2727
- items:
28-
- const: microchip,sama7g5-i2c
28+
- enum:
29+
- microchip,sama7g5-i2c
30+
- microchip,sam9x7-i2c
2931
- const: microchip,sam9x60-i2c
3032

3133
reg:

Documentation/devicetree/bindings/i2c/i2c-imx-lpi2c.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ properties:
2424
- fsl,imx8qm-lpi2c
2525
- fsl,imx8ulp-lpi2c
2626
- fsl,imx93-lpi2c
27+
- fsl,imx95-lpi2c
2728
- const: fsl,imx7ulp-lpi2c
2829

2930
reg:

Documentation/devicetree/bindings/i2c/i2c-mpc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,6 @@ examples:
9696
interrupts = <43 2>;
9797
interrupt-parent = <&mpic>;
9898
clock-frequency = <400000>;
99-
i2c-scl-clk-low-timeout-us = <10000>;
99+
i2c-transfer-timeout-us = <10000>;
100100
};
101101
...

Documentation/devicetree/bindings/i2c/i2c-mux-pca954x.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,23 @@ properties:
7171
description: A voltage regulator supplying power to the chip. On PCA9846
7272
the regulator supplies power to VDD2 (core logic) and optionally to VDD1.
7373

74+
maxim,isolate-stuck-channel:
75+
type: boolean
76+
description: Allows to use non faulty channels while a stuck channel is
77+
isolated from the upstream bus. If not set all channels are isolated from
78+
the upstream bus until the fault is cleared.
79+
80+
maxim,send-flush-out-sequence:
81+
type: boolean
82+
description: Send a flush-out sequence to stuck auxiliary buses
83+
automatically after a stuck channel is being detected.
84+
85+
maxim,preconnection-wiggle-test-enable:
86+
type: boolean
87+
description: Send a STOP condition to the auxiliary buses when the switch
88+
register activates a channel to detect a stuck high fault. On fault the
89+
channel is isolated from the upstream bus.
90+
7491
required:
7592
- compatible
7693
- reg
@@ -95,6 +112,19 @@ allOf:
95112
"#interrupt-cells": false
96113
interrupt-controller: false
97114

115+
- if:
116+
not:
117+
properties:
118+
compatible:
119+
contains:
120+
enum:
121+
- maxim,max7357
122+
then:
123+
properties:
124+
maxim,isolate-stuck-channel: false
125+
maxim,send-flush-out-sequence: false
126+
maxim,preconnection-wiggle-test-enable: false
127+
98128
unevaluatedProperties: false
99129

100130
examples:

Documentation/devicetree/bindings/i2c/renesas,rcar-i2c.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ properties:
5353
- renesas,i2c-r8a779a0 # R-Car V3U
5454
- renesas,i2c-r8a779f0 # R-Car S4-8
5555
- renesas,i2c-r8a779g0 # R-Car V4H
56+
- renesas,i2c-r8a779h0 # R-Car V4M
5657
- const: renesas,rcar-gen4-i2c # R-Car Gen4
5758

5859
reg:

drivers/i2c/busses/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ config I2C_RCAR
12351235
depends on ARCH_RENESAS || COMPILE_TEST
12361236
select I2C_SLAVE
12371237
select I2C_SMBUS
1238-
select RESET_CONTROLLER if ARCH_RCAR_GEN3
1238+
select RESET_CONTROLLER if ARCH_RCAR_GEN3 || ARCH_RCAR_GEN4
12391239
help
12401240
If you say yes to this option, support will be included for the
12411241
R-Car I2C controller.

drivers/i2c/busses/i2c-cadence.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,6 +1176,18 @@ static int __maybe_unused cdns_i2c_runtime_suspend(struct device *dev)
11761176
return 0;
11771177
}
11781178

1179+
static int __maybe_unused cdns_i2c_suspend(struct device *dev)
1180+
{
1181+
struct cdns_i2c *xi2c = dev_get_drvdata(dev);
1182+
1183+
i2c_mark_adapter_suspended(&xi2c->adap);
1184+
1185+
if (!pm_runtime_status_suspended(dev))
1186+
return cdns_i2c_runtime_suspend(dev);
1187+
1188+
return 0;
1189+
}
1190+
11791191
/**
11801192
* cdns_i2c_init - Controller initialisation
11811193
* @id: Device private data structure
@@ -1219,7 +1231,28 @@ static int __maybe_unused cdns_i2c_runtime_resume(struct device *dev)
12191231
return 0;
12201232
}
12211233

1234+
static int __maybe_unused cdns_i2c_resume(struct device *dev)
1235+
{
1236+
struct cdns_i2c *xi2c = dev_get_drvdata(dev);
1237+
int err;
1238+
1239+
err = cdns_i2c_runtime_resume(dev);
1240+
if (err)
1241+
return err;
1242+
1243+
if (pm_runtime_status_suspended(dev)) {
1244+
err = cdns_i2c_runtime_suspend(dev);
1245+
if (err)
1246+
return err;
1247+
}
1248+
1249+
i2c_mark_adapter_resumed(&xi2c->adap);
1250+
1251+
return 0;
1252+
}
1253+
12221254
static const struct dev_pm_ops cdns_i2c_dev_pm_ops = {
1255+
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(cdns_i2c_suspend, cdns_i2c_resume)
12231256
SET_RUNTIME_PM_OPS(cdns_i2c_runtime_suspend,
12241257
cdns_i2c_runtime_resume, NULL)
12251258
};

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ void i2c_dw_disable(struct dw_i2c_dev *dev)
648648
__i2c_dw_disable(dev);
649649

650650
/* Disable all interrupts */
651-
regmap_write(dev->map, DW_IC_INTR_MASK, 0);
651+
__i2c_dw_write_intr_mask(dev, 0);
652652
regmap_read(dev->map, DW_IC_CLR_INTR, &dummy);
653653

654654
i2c_dw_release_lock(dev);

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

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@ struct reset_control;
212212
* @msg_err: error status of the current transfer
213213
* @status: i2c master status, one of STATUS_*
214214
* @abort_source: copy of the TX_ABRT_SOURCE register
215+
* @sw_mask: SW mask of DW_IC_INTR_MASK used in polling mode
215216
* @irq: interrupt number for the i2c master
216217
* @flags: platform specific flags like type of IO accessors or model
217218
* @adapter: i2c subsystem adapter node
@@ -270,6 +271,7 @@ struct dw_i2c_dev {
270271
int msg_err;
271272
unsigned int status;
272273
unsigned int abort_source;
274+
unsigned int sw_mask;
273275
int irq;
274276
u32 flags;
275277
struct i2c_adapter adapter;
@@ -303,6 +305,7 @@ struct dw_i2c_dev {
303305
#define ACCESS_INTR_MASK BIT(0)
304306
#define ACCESS_NO_IRQ_SUSPEND BIT(1)
305307
#define ARBITRATION_SEMAPHORE BIT(2)
308+
#define ACCESS_POLLING BIT(3)
306309

307310
#define MODEL_MSCC_OCELOT BIT(8)
308311
#define MODEL_BAIKAL_BT1 BIT(9)
@@ -318,7 +321,7 @@ struct dw_i2c_dev {
318321
#define AMD_UCSI_INTR_EN 0xd
319322

320323
#define TXGBE_TX_FIFO_DEPTH 4
321-
#define TXGBE_RX_FIFO_DEPTH 0
324+
#define TXGBE_RX_FIFO_DEPTH 1
322325

323326
struct i2c_dw_semaphore_callbacks {
324327
int (*probe)(struct dw_i2c_dev *dev);
@@ -351,6 +354,24 @@ static inline void __i2c_dw_disable_nowait(struct dw_i2c_dev *dev)
351354
dev->status &= ~STATUS_ACTIVE;
352355
}
353356

357+
static inline void __i2c_dw_write_intr_mask(struct dw_i2c_dev *dev,
358+
unsigned int intr_mask)
359+
{
360+
unsigned int val = dev->flags & ACCESS_POLLING ? 0 : intr_mask;
361+
362+
regmap_write(dev->map, DW_IC_INTR_MASK, val);
363+
dev->sw_mask = intr_mask;
364+
}
365+
366+
static inline void __i2c_dw_read_intr_mask(struct dw_i2c_dev *dev,
367+
unsigned int *intr_mask)
368+
{
369+
if (!(dev->flags & ACCESS_POLLING))
370+
regmap_read(dev->map, DW_IC_INTR_MASK, intr_mask);
371+
else
372+
*intr_mask = dev->sw_mask;
373+
}
374+
354375
void __i2c_dw_disable(struct dw_i2c_dev *dev);
355376

356377
extern void i2c_dw_configure_master(struct dw_i2c_dev *dev);

0 commit comments

Comments
 (0)