Skip to content

Commit e8df5a0

Browse files
committed
Merge tag 'i2c-for-7.1-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull more i2c updates from Wolfram Sang: - cx92755: convert I2C bindings to DT schema - mediatek: add optional bus power management during transfers - pxa: handle early bus busy condition - MAINTAINERS: update I2C RUST entry * tag 'i2c-for-7.1-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: MAINTAINERS: add Rust I2C tree and update Igor Korotin's email i2c: mediatek: add bus regulator control for power saving dt-bindings: i2c: cnxt,cx92755-i2c: Convert to DT schema i2c: pxa: handle 'Early Bus Busy' condition on Armada 3700
2 parents 5fb4fde + 79fc229 commit e8df5a0

6 files changed

Lines changed: 76 additions & 33 deletions

File tree

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,7 @@ Herbert Xu <[email protected]>
338338
339339
340340
341+
341342
342343
343344
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/i2c/cnxt,cx92755-i2c.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
7+
title: Conexant Digicolor I2C controller
8+
9+
allOf:
10+
- $ref: /schemas/i2c/i2c-controller.yaml#
11+
12+
maintainers:
13+
- Baruch Siach <[email protected]>
14+
15+
properties:
16+
compatible:
17+
const: cnxt,cx92755-i2c
18+
19+
reg:
20+
maxItems: 1
21+
22+
interrupts:
23+
maxItems: 1
24+
25+
clocks:
26+
maxItems: 1
27+
28+
clock-frequency:
29+
default: 100000
30+
31+
required:
32+
- compatible
33+
- reg
34+
- interrupts
35+
- clocks
36+
37+
unevaluatedProperties: false
38+
39+
examples:
40+
- |
41+
i2c@f0000120 {
42+
compatible = "cnxt,cx92755-i2c";
43+
reg = <0xf0000120 0x10>;
44+
interrupts = <28>;
45+
clocks = <&main_clk>;
46+
clock-frequency = <100000>;
47+
#address-cells = <1>;
48+
#size-cells = <0>;
49+
};

Documentation/devicetree/bindings/i2c/i2c-digicolor.txt

Lines changed: 0 additions & 25 deletions
This file was deleted.

MAINTAINERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12115,11 +12115,12 @@ F: include/uapi/linux/i2c-*.h
1211512115
F: include/uapi/linux/i2c.h
1211612116

1211712117
I2C SUBSYSTEM [RUST]
12118-
M: Igor Korotin <igor.korotin[email protected]>
12118+
M: Igor Korotin <igor.korotin@linux.dev>
1211912119
R: Danilo Krummrich <[email protected]>
1212012120
R: Daniel Almeida <[email protected]>
1212112121
1212212122
S: Maintained
12123+
T: git https://github.com/ikrtn/linux.git rust-i2c-next
1212312124
F: rust/kernel/i2c.rs
1212412125
F: samples/rust/rust_driver_i2c.rs
1212512126
F: samples/rust/rust_i2c_client.rs

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/module.h>
2222
#include <linux/of.h>
2323
#include <linux/platform_device.h>
24+
#include <linux/regulator/consumer.h>
2425
#include <linux/scatterlist.h>
2526
#include <linux/sched.h>
2627
#include <linux/slab.h>
@@ -1244,9 +1245,15 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
12441245
bool write_then_read_en = false;
12451246
struct mtk_i2c *i2c = i2c_get_adapdata(adap);
12461247

1248+
if (i2c->adap.bus_regulator) {
1249+
ret = regulator_enable(i2c->adap.bus_regulator);
1250+
if (ret)
1251+
return ret;
1252+
}
1253+
12471254
ret = clk_bulk_enable(I2C_MT65XX_CLK_MAX, i2c->clocks);
12481255
if (ret)
1249-
return ret;
1256+
goto err_regulator;
12501257

12511258
i2c->auto_restart = i2c->dev_comp->auto_restart;
12521259

@@ -1301,6 +1308,10 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,
13011308

13021309
err_exit:
13031310
clk_bulk_disable(I2C_MT65XX_CLK_MAX, i2c->clocks);
1311+
err_regulator:
1312+
if (i2c->adap.bus_regulator)
1313+
regulator_disable(i2c->adap.bus_regulator);
1314+
13041315
return ret;
13051316
}
13061317

drivers/i2c/busses/i2c-pxa.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
#define ISR_GCAD (1 << 8) /* general call address detected */
7272
#define ISR_SAD (1 << 9) /* slave address detected */
7373
#define ISR_BED (1 << 10) /* bus error no ACK/NAK */
74+
#define ISR_A3700_EBB (1 << 11) /* early bus busy for armada 3700 */
7475

7576
#define ILCR_SLV_SHIFT 0
7677
#define ILCR_SLV_MASK (0x1FF << ILCR_SLV_SHIFT)
@@ -263,6 +264,7 @@ struct pxa_i2c {
263264
bool highmode_enter;
264265
u32 fm_mask;
265266
u32 hs_mask;
267+
u32 busy_mask;
266268

267269
struct i2c_bus_recovery_info recovery;
268270
struct pinctrl *pinctrl;
@@ -430,7 +432,7 @@ static int i2c_pxa_wait_bus_not_busy(struct pxa_i2c *i2c)
430432

431433
while (1) {
432434
isr = readl(_ISR(i2c));
433-
if (!(isr & (ISR_IBB | ISR_UB)))
435+
if (!(isr & i2c->busy_mask))
434436
return 0;
435437

436438
if (isr & ISR_SAD)
@@ -467,7 +469,7 @@ static int i2c_pxa_wait_master(struct pxa_i2c *i2c)
467469
* quick check of the i2c lines themselves to ensure they've
468470
* gone high...
469471
*/
470-
if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) == 0 &&
472+
if ((readl(_ISR(i2c)) & i2c->busy_mask) == 0 &&
471473
readl(_IBMR(i2c)) == (IBMR_SCLS | IBMR_SDAS)) {
472474
if (i2c_debug > 0)
473475
dev_dbg(&i2c->adap.dev, "%s: done\n", __func__);
@@ -488,7 +490,7 @@ static int i2c_pxa_set_master(struct pxa_i2c *i2c)
488490
if (i2c_debug)
489491
dev_dbg(&i2c->adap.dev, "setting to bus master\n");
490492

491-
if ((readl(_ISR(i2c)) & (ISR_UB | ISR_IBB)) != 0) {
493+
if ((readl(_ISR(i2c)) & i2c->busy_mask) != 0) {
492494
dev_dbg(&i2c->adap.dev, "%s: unit is busy\n", __func__);
493495
if (!i2c_pxa_wait_master(i2c)) {
494496
dev_dbg(&i2c->adap.dev, "%s: error: unit busy\n", __func__);
@@ -514,7 +516,7 @@ static int i2c_pxa_wait_slave(struct pxa_i2c *i2c)
514516
dev_dbg(&i2c->adap.dev, "%s: %ld: ISR=%08x, ICR=%08x, IBMR=%02x\n",
515517
__func__, (long)jiffies, readl(_ISR(i2c)), readl(_ICR(i2c)), readl(_IBMR(i2c)));
516518

517-
if ((readl(_ISR(i2c)) & (ISR_UB|ISR_IBB)) == 0 ||
519+
if ((readl(_ISR(i2c)) & i2c->busy_mask) == 0 ||
518520
(readl(_ISR(i2c)) & ISR_SAD) != 0 ||
519521
(readl(_ICR(i2c)) & ICR_SCLE) == 0) {
520522
if (i2c_debug > 1)
@@ -1177,7 +1179,7 @@ static int i2c_pxa_pio_set_master(struct pxa_i2c *i2c)
11771179
/*
11781180
* Wait for the bus to become free.
11791181
*/
1180-
while (timeout-- && readl(_ISR(i2c)) & (ISR_IBB | ISR_UB))
1182+
while (timeout-- && readl(_ISR(i2c)) & i2c->busy_mask)
11811183
udelay(1000);
11821184

11831185
if (timeout < 0) {
@@ -1322,7 +1324,7 @@ static void i2c_pxa_unprepare_recovery(struct i2c_adapter *adap)
13221324
* handing control of the bus back to avoid the bus changing state.
13231325
*/
13241326
isr = readl(_ISR(i2c));
1325-
if (isr & (ISR_UB | ISR_IBB)) {
1327+
if (isr & i2c->busy_mask) {
13261328
dev_dbg(&i2c->adap.dev,
13271329
"recovery: resetting controller, ISR=0x%08x\n", isr);
13281330
i2c_pxa_do_reset(i2c);
@@ -1479,6 +1481,10 @@ static int i2c_pxa_probe(struct platform_device *dev)
14791481
i2c->fm_mask = pxa_reg_layout[i2c_type].fm;
14801482
i2c->hs_mask = pxa_reg_layout[i2c_type].hs;
14811483

1484+
i2c->busy_mask = ISR_UB | ISR_IBB;
1485+
if (i2c_type == REGS_A3700)
1486+
i2c->busy_mask |= ISR_A3700_EBB;
1487+
14821488
if (i2c_type != REGS_CE4100)
14831489
i2c->reg_isar = i2c->reg_base + pxa_reg_layout[i2c_type].isar;
14841490

0 commit comments

Comments
 (0)