Skip to content

Commit aac3190

Browse files
committed
Merge tag 'i2c-for-6.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull more i2c updates from Wolfram Sang: - Second part of rtl9300 updates since dependencies are in now: - general cleanups - implement block read/write support - add RTL9310 support - DT schema conversion of hix5hd2 binding - namespace cleanup for i2c-algo-pca - minor simplification for mt65xx * tag 'i2c-for-6.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: dt-bindings: i2c: hisilicon,hix5hd2: convert to DT schema i2c: mt65xx: convert set_speed function to void i2c: rename wait_for_completion callback to wait_for_completion_cb i2c: rtl9300: add support for RTL9310 I2C controller dt-bindings: i2c: realtek,rtl9301-i2c: extend for RTL9310 support i2c: rtl9300: use scoped guard instead of explicit lock/unlock i2c: rtl9300: separate xfer configuration and execution i2c: rtl9300: do not set read mode on every transfer i2c: rtl9300: move setting SCL frequency to config_io i2c: rtl9300: rename internal sda_pin to sda_num dt-bindings: i2c: realtek,rtl9301-i2c: fix wording and typos i2c: rtl9300: use regmap fields and API for registers i2c: rtl9300: Implement I2C block read and write
2 parents 0ae4524 + eb4faf6 commit aac3190

File tree

9 files changed

+386
-212
lines changed

9 files changed

+386
-212
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
2+
%YAML 1.2
3+
---
4+
$id: http://devicetree.org/schemas/i2c/hisilicon,hix5hd2-i2c.yaml#
5+
$schema: http://devicetree.org/meta-schemas/core.yaml#
6+
title: I2C for HiSilicon hix5hd2 chipset platform
7+
8+
maintainers:
9+
- Wei Yan <sledge.yanwei@huawei.com>
10+
11+
allOf:
12+
- $ref: /schemas/i2c/i2c-controller.yaml#
13+
14+
properties:
15+
compatible:
16+
enum:
17+
- hisilicon,hix5hd2-i2c
18+
19+
reg:
20+
maxItems: 1
21+
22+
interrupts:
23+
maxItems: 1
24+
25+
clocks:
26+
maxItems: 1
27+
28+
clock-frequency:
29+
description: Desired I2C bus frequency in Hz
30+
default: 100000
31+
32+
required:
33+
- compatible
34+
- reg
35+
- interrupts
36+
- clocks
37+
38+
unevaluatedProperties: false
39+
40+
examples:
41+
- |
42+
#include <dt-bindings/clock/hix5hd2-clock.h>
43+
44+
i2c@f8b10000 {
45+
compatible = "hisilicon,hix5hd2-i2c";
46+
reg = <0xf8b10000 0x1000>;
47+
interrupts = <0 38 4>;
48+
clocks = <&clock HIX5HD2_I2C0_RST>;
49+
#address-cells = <1>;
50+
#size-cells = <0>;
51+
};

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

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

Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@ maintainers:
1010
- Chris Packham <chris.packham@alliedtelesis.co.nz>
1111

1212
description:
13-
The RTL9300 SoC has two I2C controllers. Each of these has an SCL line (which
13+
RTL9300 SoCs have two I2C controllers. Each of these has an SCL line (which
1414
if not-used for SCL can be a GPIO). There are 8 common SDA lines that can be
1515
assigned to either I2C controller.
16+
RTL9310 SoCs have equal capabilities but support 12 common SDA lines which
17+
can be assigned to either I2C controller.
1618

1719
properties:
1820
compatible:
@@ -23,31 +25,64 @@ properties:
2325
- realtek,rtl9302c-i2c
2426
- realtek,rtl9303-i2c
2527
- const: realtek,rtl9301-i2c
26-
- const: realtek,rtl9301-i2c
28+
- items:
29+
- enum:
30+
- realtek,rtl9311-i2c
31+
- realtek,rtl9312-i2c
32+
- realtek,rtl9313-i2c
33+
- const: realtek,rtl9310-i2c
34+
- enum:
35+
- realtek,rtl9301-i2c
36+
- realtek,rtl9310-i2c
2737

2838
reg:
2939
items:
30-
- description: Register offset and size this I2C controller.
40+
- description: Register offset and size of this I2C controller.
3141

3242
"#address-cells":
3343
const: 1
3444

3545
"#size-cells":
3646
const: 0
3747

48+
realtek,scl:
49+
$ref: /schemas/types.yaml#/definitions/uint32
50+
description:
51+
The SCL line number of this I2C controller.
52+
enum: [ 0, 1 ]
53+
3854
patternProperties:
39-
'^i2c@[0-7]$':
55+
'^i2c@[0-9ab]$':
4056
$ref: /schemas/i2c/i2c-controller.yaml
4157
unevaluatedProperties: false
4258

4359
properties:
4460
reg:
45-
description: The SDA pin associated with the I2C bus.
61+
description: The SDA line number associated with the I2C bus.
4662
maxItems: 1
4763

4864
required:
4965
- reg
5066

67+
68+
allOf:
69+
- if:
70+
properties:
71+
compatible:
72+
contains:
73+
const: realtek,rtl9310-i2c
74+
then:
75+
required:
76+
- realtek,scl
77+
- if:
78+
properties:
79+
compatible:
80+
contains:
81+
const: realtek,rtl9301-i2c
82+
then:
83+
patternProperties:
84+
'^i2c@[89ab]$': false
85+
5186
required:
5287
- compatible
5388
- reg

drivers/i2c/algos/i2c-algo-pca.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ static int i2c_debug;
3030
#define pca_clock(adap) adap->i2c_clock
3131
#define pca_set_con(adap, val) pca_outw(adap, I2C_PCA_CON, val)
3232
#define pca_get_con(adap) pca_inw(adap, I2C_PCA_CON)
33-
#define pca_wait(adap) adap->wait_for_completion(adap->data)
33+
#define pca_wait(adap) adap->wait_for_completion_cb(adap->data)
3434

3535
static void pca_reset(struct i2c_algo_pca_data *adap)
3636
{

drivers/i2c/busses/i2c-mt65xx.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ static int mtk_i2c_calculate_speed(struct mtk_i2c *i2c, unsigned int clk_src,
868868
return 0;
869869
}
870870

871-
static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
871+
static void mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
872872
{
873873
unsigned int clk_src;
874874
unsigned int step_cnt;
@@ -938,9 +938,6 @@ static int mtk_i2c_set_speed(struct mtk_i2c *i2c, unsigned int parent_clk)
938938

939939
break;
940940
}
941-
942-
943-
return 0;
944941
}
945942

946943
static void i2c_dump_register(struct mtk_i2c *i2c)
@@ -1460,11 +1457,7 @@ static int mtk_i2c_probe(struct platform_device *pdev)
14601457

14611458
strscpy(i2c->adap.name, I2C_DRV_NAME, sizeof(i2c->adap.name));
14621459

1463-
ret = mtk_i2c_set_speed(i2c, clk_get_rate(i2c->clocks[speed_clk].clk));
1464-
if (ret) {
1465-
dev_err(&pdev->dev, "Failed to set the speed.\n");
1466-
return -EINVAL;
1467-
}
1460+
mtk_i2c_set_speed(i2c, clk_get_rate(i2c->clocks[speed_clk].clk));
14681461

14691462
if (i2c->dev_comp->max_dma_support > 32) {
14701463
ret = dma_set_mask(&pdev->dev,

drivers/i2c/busses/i2c-pca-isa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static struct i2c_algo_pca_data pca_isa_data = {
9595
/* .data intentionally left NULL, not needed with ISA */
9696
.write_byte = pca_isa_writebyte,
9797
.read_byte = pca_isa_readbyte,
98-
.wait_for_completion = pca_isa_waitforcompletion,
98+
.wait_for_completion_cb = pca_isa_waitforcompletion,
9999
.reset_chip = pca_isa_resetchip,
100100
};
101101

drivers/i2c/busses/i2c-pca-platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ static int i2c_pca_pf_probe(struct platform_device *pdev)
180180
}
181181

182182
i2c->algo_data.data = i2c;
183-
i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion;
183+
i2c->algo_data.wait_for_completion_cb = i2c_pca_pf_waitforcompletion;
184184
if (i2c->gpio)
185185
i2c->algo_data.reset_chip = i2c_pca_pf_resetchip;
186186
else

0 commit comments

Comments
 (0)