Skip to content

Commit abdebb2

Browse files
committed
Merge tag 'i2c-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c updates from Wolfram Sang: "Core: - list-based mechanisms for handling auto-detected and userspace created clients are replaced with a flag-based approach. The resulting code is much simpler as well as the locking. - i2c clients now get a default debugfs dir managed by the I2C core. Drivers don't have to maintain their own directory anymore. Driver updates: - xiic: atomic_transfer support - imx-lpi2c: DMA and target mode support - riic cleanups - npcm: better timeout handling and more precise frequency setups - davinci: remove unused platform_data - at24: add new compatibles for variants from Giantec and Puya Semiconductor (together with a new vendor prefix)" * tag 'i2c-for-6.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (52 commits) i2c: add kdoc for the new debugfs entry of clients i2c: designware: Actually make use of the I2C_DW_COMMON and I2C_DW symbol namespaces i2c: add core-managed per-client directory in debugfs i2c: Force ELAN06FA touchpad I2C bus freq to 100KHz i2c: riic: Add `riic_bus_barrier()` to check bus availability i2c: riic: Use predefined macro and simplify clock tick calculation i2c: riic: Mark riic_irqs array as const i2c: riic: Make use of devres helper to request deasserted reset line i2c: riic: Use GENMASK() macro for bitmask definitions i2c: riic: Use BIT macro consistently i2c: riic: Use local `dev` pointer in `dev_err_probe()` i2c: riic: Use dev_err_probe in probe and riic_init_hw functions i2c: riic: Introduce a separate variable for IRQ i2c: amd756: Remove superfluous TODO Revert "i2c: amd756: Fix endianness handling for word data" i2c: i801: Add lis3lv02d for Dell Precision M6800 i2c: i801: Remove unnecessary PCI function call i2c: core: Allocate temp client on the stack in i2c_detect i2c: slave-eeprom: Constify 'struct bin_attribute' i2c: imx-lpi2c: make controller available until the system enters suspend_noirq() and from resume_noirq(). ...
2 parents d12f68b + 27c3f0e commit abdebb2

27 files changed

+1714
-507
lines changed

Documentation/devicetree/bindings/eeprom/at24.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,14 @@ properties:
134134
- const: atmel,24c64
135135
- items:
136136
- enum:
137+
- giantec,gt24p128f
137138
- renesas,r1ex24128
138139
- samsung,s524ad0xd1
139140
- const: atmel,24c128
141+
- items:
142+
- enum:
143+
- puya,p24c256c
144+
- const: atmel,24c256
140145
- items:
141146
- const: microchip,24aa025e48
142147
- items:

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ properties:
2525
- samsung,exynos5250-hsi2c # Exynos5250 and Exynos5420
2626
- samsung,exynos5260-hsi2c # Exynos5260
2727
- samsung,exynos7-hsi2c # Exynos7
28+
- samsung,exynos8895-hsi2c
2829
- samsung,exynosautov9-hsi2c
2930
- items:
3031
- enum:

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ properties:
3434
- qcom,sm8450-cci
3535
- qcom,sm8550-cci
3636
- qcom,sm8650-cci
37+
- qcom,x1e80100-cci
3738
- const: qcom,msm8996-cci # CCI v2
3839

3940
"#address-cells":
@@ -224,6 +225,7 @@ allOf:
224225
enum:
225226
- qcom,sm8550-cci
226227
- qcom,sm8650-cci
228+
- qcom,x1e80100-cci
227229
then:
228230
properties:
229231
clocks:

Documentation/devicetree/bindings/i2c/renesas,riic.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ properties:
2626
- const: renesas,riic-rz # RZ/A or RZ/G2L
2727

2828
- items:
29-
- const: renesas,riic-r9a08g045 # RZ/G3S
29+
- enum:
30+
- renesas,riic-r9a08g045 # RZ/G3S
31+
- renesas,riic-r9a09g047 # RZ/G3E
3032
- const: renesas,riic-r9a09g057 # RZ/V2H(P)
3133

3234
- const: renesas,riic-r9a09g057 # RZ/V2H(P)
@@ -89,6 +91,7 @@ if:
8991
- renesas,riic-r9a07g043
9092
- renesas,riic-r9a07g044
9193
- renesas,riic-r9a07g054
94+
- renesas,riic-r9a09g057
9295
then:
9396
required:
9497
- resets

Documentation/devicetree/bindings/vendor-prefixes.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,8 @@ patternProperties:
12041204
description: PulsedLight, Inc
12051205
"^purism,.*":
12061206
description: Purism, SPC
1207+
"^puya,.*":
1208+
description: Puya Semiconductor (Shanghai) Co., Ltd.
12071209
"^qca,.*":
12081210
description: Qualcomm Atheros, Inc.
12091211
"^qcom,.*":

drivers/i2c/busses/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ config I2C_BRCMSTB
503503
tristate "BRCM Settop/DSL I2C controller"
504504
depends on ARCH_BCM2835 || ARCH_BCMBCA || ARCH_BRCMSTB || \
505505
BMIPS_GENERIC || COMPILE_TEST
506-
default y
506+
default ARCH_BCM2835 || ARCH_BCMBCA || ARCH_BRCMSTB || BMIPS_GENERIC
507507
help
508508
If you say yes to this option, support will be included for the
509509
I2C interface on the Broadcom Settop/DSL SoCs.
@@ -910,7 +910,7 @@ config I2C_MXS
910910

911911
config I2C_NOMADIK
912912
tristate "ST-Ericsson Nomadik/Ux500 I2C Controller"
913-
depends on ARM_AMBA
913+
depends on ARM_AMBA || COMPILE_TEST
914914
help
915915
If you say yes to this option, support will be included for the
916916
I2C interface from ST-Ericsson's Nomadik and Ux500 architectures,

drivers/i2c/busses/i2c-amd756.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
211211
SMB_HOST_ADDRESS);
212212
outb_p(command, SMB_HOST_COMMAND);
213213
if (read_write == I2C_SMBUS_WRITE)
214-
outw_p(data->word, SMB_HOST_DATA); /* TODO: endian???? */
214+
outw_p(data->word, SMB_HOST_DATA);
215215
size = AMD756_WORD_DATA;
216216
break;
217217
case I2C_SMBUS_BLOCK_DATA:
@@ -256,7 +256,7 @@ static s32 amd756_access(struct i2c_adapter * adap, u16 addr,
256256
data->byte = inw_p(SMB_HOST_DATA);
257257
break;
258258
case AMD756_WORD_DATA:
259-
data->word = inw_p(SMB_HOST_DATA); /* TODO: endian???? */
259+
data->word = inw_p(SMB_HOST_DATA);
260260
break;
261261
case AMD756_BLOCK_DATA:
262262
data->block[0] = inw_p(SMB_HOST_DATA) & 0x3f;

drivers/i2c/busses/i2c-davinci.c

Lines changed: 33 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
*
1212
* ----------------------------------------------------------------------------
1313
*/
14-
#include <linux/kernel.h>
15-
#include <linux/module.h>
16-
#include <linux/delay.h>
17-
#include <linux/i2c.h>
14+
1815
#include <linux/clk.h>
19-
#include <linux/errno.h>
20-
#include <linux/sched.h>
16+
#include <linux/cpufreq.h>
17+
#include <linux/delay.h>
2118
#include <linux/err.h>
19+
#include <linux/errno.h>
20+
#include <linux/gpio/consumer.h>
21+
#include <linux/i2c.h>
2222
#include <linux/interrupt.h>
23-
#include <linux/platform_device.h>
2423
#include <linux/io.h>
25-
#include <linux/slab.h>
26-
#include <linux/cpufreq.h>
27-
#include <linux/gpio/consumer.h>
28-
#include <linux/of.h>
29-
#include <linux/platform_data/i2c-davinci.h>
24+
#include <linux/kernel.h>
25+
#include <linux/module.h>
26+
#include <linux/platform_device.h>
3027
#include <linux/pm_runtime.h>
28+
#include <linux/property.h>
29+
#include <linux/sched.h>
30+
#include <linux/slab.h>
3131

3232
/* ----- global defines ----------------------------------------------- */
3333

@@ -117,6 +117,8 @@
117117
/* timeout for pm runtime autosuspend */
118118
#define DAVINCI_I2C_PM_TIMEOUT 1000 /* ms */
119119

120+
#define DAVINCI_I2C_DEFAULT_BUS_FREQ 100
121+
120122
struct davinci_i2c_dev {
121123
struct device *dev;
122124
void __iomem *base;
@@ -132,13 +134,10 @@ struct davinci_i2c_dev {
132134
#ifdef CONFIG_CPU_FREQ
133135
struct notifier_block freq_transition;
134136
#endif
135-
struct davinci_i2c_platform_data *pdata;
136-
};
137-
138-
/* default platform data to use if not supplied in the platform_device */
139-
static struct davinci_i2c_platform_data davinci_i2c_platform_data_default = {
140-
.bus_freq = 100,
141-
.bus_delay = 0,
137+
/* standard bus frequency (kHz) */
138+
unsigned int bus_freq;
139+
/* Chip has a ICPFUNC register */
140+
bool has_pfunc;
142141
};
143142

144143
static inline void davinci_i2c_write_reg(struct davinci_i2c_dev *i2c_dev,
@@ -168,14 +167,12 @@ static inline void davinci_i2c_reset_ctrl(struct davinci_i2c_dev *i2c_dev,
168167

169168
static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
170169
{
171-
struct davinci_i2c_platform_data *pdata = dev->pdata;
172170
u16 psc;
173171
u32 clk;
174172
u32 d;
175173
u32 clkh;
176174
u32 clkl;
177175
u32 input_clock = clk_get_rate(dev->clk);
178-
struct device_node *of_node = dev->dev->of_node;
179176

180177
/* NOTE: I2C Clock divider programming info
181178
* As per I2C specs the following formulas provide prescaler
@@ -209,19 +206,19 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
209206
psc++; /* better to run under spec than over */
210207
d = (psc >= 2) ? 5 : 7 - psc;
211208

212-
if (of_node && of_device_is_compatible(of_node, "ti,keystone-i2c"))
209+
if (device_is_compatible(dev->dev, "ti,keystone-i2c"))
213210
d = 6;
214211

215-
clk = ((input_clock / (psc + 1)) / (pdata->bus_freq * 1000));
212+
clk = ((input_clock / (psc + 1)) / (dev->bus_freq * 1000));
216213
/* Avoid driving the bus too fast because of rounding errors above */
217-
if (input_clock / (psc + 1) / clk > pdata->bus_freq * 1000)
214+
if (input_clock / (psc + 1) / clk > dev->bus_freq * 1000)
218215
clk++;
219216
/*
220217
* According to I2C-BUS Spec 2.1, in FAST-MODE LOW period should be at
221218
* least 1.3uS, which is not the case with 50% duty cycle. Driving HIGH
222219
* to LOW ratio as 1 to 2 is more safe.
223220
*/
224-
if (pdata->bus_freq > 100)
221+
if (dev->bus_freq > 100)
225222
clkl = (clk << 1) / 3;
226223
else
227224
clkl = (clk >> 1);
@@ -255,8 +252,6 @@ static void i2c_davinci_calc_clk_dividers(struct davinci_i2c_dev *dev)
255252
*/
256253
static int i2c_davinci_init(struct davinci_i2c_dev *dev)
257254
{
258-
struct davinci_i2c_platform_data *pdata = dev->pdata;
259-
260255
/* put I2C into reset */
261256
davinci_i2c_reset_ctrl(dev, 0);
262257

@@ -274,8 +269,7 @@ static int i2c_davinci_init(struct davinci_i2c_dev *dev)
274269
davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKL_REG));
275270
dev_dbg(dev->dev, "CLKH = %d\n",
276271
davinci_i2c_read_reg(dev, DAVINCI_I2C_CLKH_REG));
277-
dev_dbg(dev->dev, "bus_freq = %dkHz, bus_delay = %d\n",
278-
pdata->bus_freq, pdata->bus_delay);
272+
dev_dbg(dev->dev, "bus_freq = %dkHz\n", dev->bus_freq);
279273

280274

281275
/* Take the I2C module out of reset: */
@@ -309,12 +303,6 @@ static void davinci_i2c_unprepare_recovery(struct i2c_adapter *adap)
309303
i2c_davinci_init(dev);
310304
}
311305

312-
static struct i2c_bus_recovery_info davinci_i2c_gpio_recovery_info = {
313-
.recover_bus = i2c_generic_scl_recovery,
314-
.prepare_recovery = davinci_i2c_prepare_recovery,
315-
.unprepare_recovery = davinci_i2c_unprepare_recovery,
316-
};
317-
318306
static void davinci_i2c_set_scl(struct i2c_adapter *adap, int val)
319307
{
320308
struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
@@ -414,7 +402,6 @@ static int
414402
i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
415403
{
416404
struct davinci_i2c_dev *dev = i2c_get_adapdata(adap);
417-
struct davinci_i2c_platform_data *pdata = dev->pdata;
418405
u32 flag;
419406
u16 w;
420407
unsigned long time_left;
@@ -424,10 +411,6 @@ i2c_davinci_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, int stop)
424411
return -EADDRNOTAVAIL;
425412
}
426413

427-
/* Introduce a delay, required for some boards (e.g Davinci EVM) */
428-
if (pdata->bus_delay)
429-
udelay(pdata->bus_delay);
430-
431414
/* set the target address */
432415
davinci_i2c_write_reg(dev, DAVINCI_I2C_SAR_REG, msg->addr);
433416

@@ -758,8 +741,8 @@ static int davinci_i2c_probe(struct platform_device *pdev)
758741
{
759742
struct davinci_i2c_dev *dev;
760743
struct i2c_adapter *adap;
761-
struct i2c_bus_recovery_info *rinfo;
762744
int r, irq;
745+
u32 prop;
763746

764747
irq = platform_get_irq(pdev, 0);
765748
if (irq < 0)
@@ -773,29 +756,15 @@ static int davinci_i2c_probe(struct platform_device *pdev)
773756

774757
dev->dev = &pdev->dev;
775758
dev->irq = irq;
776-
dev->pdata = dev_get_platdata(&pdev->dev);
777759
platform_set_drvdata(pdev, dev);
778760

779-
if (!dev->pdata && pdev->dev.of_node) {
780-
u32 prop;
781-
782-
dev->pdata = devm_kzalloc(&pdev->dev,
783-
sizeof(struct davinci_i2c_platform_data), GFP_KERNEL);
784-
if (!dev->pdata)
785-
return -ENOMEM;
786-
787-
memcpy(dev->pdata, &davinci_i2c_platform_data_default,
788-
sizeof(struct davinci_i2c_platform_data));
789-
if (!of_property_read_u32(pdev->dev.of_node, "clock-frequency",
790-
&prop))
791-
dev->pdata->bus_freq = prop / 1000;
792-
793-
dev->pdata->has_pfunc =
794-
of_property_read_bool(pdev->dev.of_node,
795-
"ti,has-pfunc");
796-
} else if (!dev->pdata) {
797-
dev->pdata = &davinci_i2c_platform_data_default;
798-
}
761+
r = device_property_read_u32(&pdev->dev, "clock-frequency", &prop);
762+
if (r)
763+
prop = DAVINCI_I2C_DEFAULT_BUS_FREQ;
764+
765+
dev->bus_freq = prop / 1000;
766+
767+
dev->has_pfunc = device_property_present(&pdev->dev, "ti,has-pfunc");
799768

800769
dev->clk = devm_clk_get(&pdev->dev, NULL);
801770
if (IS_ERR(dev->clk))
@@ -841,25 +810,10 @@ static int davinci_i2c_probe(struct platform_device *pdev)
841810
adap->algo = &i2c_davinci_algo;
842811
adap->dev.parent = &pdev->dev;
843812
adap->timeout = DAVINCI_I2C_TIMEOUT;
844-
adap->dev.of_node = pdev->dev.of_node;
813+
adap->dev.of_node = dev_of_node(&pdev->dev);
845814

846-
if (dev->pdata->has_pfunc)
815+
if (dev->has_pfunc)
847816
adap->bus_recovery_info = &davinci_i2c_scl_recovery_info;
848-
else if (dev->pdata->gpio_recovery) {
849-
rinfo = &davinci_i2c_gpio_recovery_info;
850-
adap->bus_recovery_info = rinfo;
851-
rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl",
852-
GPIOD_OUT_HIGH_OPEN_DRAIN);
853-
if (IS_ERR(rinfo->scl_gpiod)) {
854-
r = PTR_ERR(rinfo->scl_gpiod);
855-
goto err_unuse_clocks;
856-
}
857-
rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN);
858-
if (IS_ERR(rinfo->sda_gpiod)) {
859-
r = PTR_ERR(rinfo->sda_gpiod);
860-
goto err_unuse_clocks;
861-
}
862-
}
863817

864818
adap->nr = pdev->id;
865819
r = i2c_add_numbered_adapter(adap);

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* Copyright (C) 2007 MontaVista Software Inc.
99
* Copyright (C) 2009 Provigent Ltd.
1010
*/
11+
12+
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW_COMMON"
13+
1114
#include <linux/acpi.h>
1215
#include <linux/clk.h>
1316
#include <linux/delay.h>
@@ -29,8 +32,6 @@
2932
#include <linux/types.h>
3033
#include <linux/units.h>
3134

32-
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW_COMMON"
33-
3435
#include "i2c-designware-core.h"
3536

3637
static const char *const abort_sources[] = {

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
* Copyright (C) 2007 MontaVista Software Inc.
99
* Copyright (C) 2009 Provigent Ltd.
1010
*/
11+
12+
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW"
13+
1114
#include <linux/delay.h>
1215
#include <linux/err.h>
1316
#include <linux/errno.h>
@@ -22,8 +25,6 @@
2225
#include <linux/regmap.h>
2326
#include <linux/reset.h>
2427

25-
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW"
26-
2728
#include "i2c-designware-core.h"
2829

2930
#define AMD_TIMEOUT_MIN_US 25

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
*
77
* Copyright (C) 2016 Synopsys Inc.
88
*/
9+
10+
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW"
11+
912
#include <linux/delay.h>
1013
#include <linux/err.h>
1114
#include <linux/errno.h>
@@ -16,8 +19,6 @@
1619
#include <linux/pm_runtime.h>
1720
#include <linux/regmap.h>
1821

19-
#define DEFAULT_SYMBOL_NAMESPACE "I2C_DW"
20-
2122
#include "i2c-designware-core.h"
2223

2324
static void i2c_dw_configure_fifo_slave(struct dw_i2c_dev *dev)

0 commit comments

Comments
 (0)