i2c: hix5hd2: add i2c controller driver
Subsystems (2)
v2 cover i2c: hix5hd2: add i2c controller driver
v2:
Modify according to Wolfram's comments
including change vector name, coding style, return value etc.
Wei Yan (2):
i2c: hix5hd2: add devicetree documentation
i2c: hix5hd2: add i2c controller driver
Zhangfei Gao (1):
ARM: dts: hix5hd2: add i2c node
.../devicetree/bindings/i2c/i2c-hix5hd2.txt | 31 ++ arch/arm/boot/dts/hisi-x5hd2.dtsi | 60 +++ drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-hix5hd2.c | 555 ++++++++++++++++++++ 5 files changed, 657 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt create mode 100644 drivers/i2c/busses/i2c-hix5hd2.c
Signature · 1 line
1.7.9.5
PATCH v2 1/3 i2c: hix5hd2: add devicetree documentation
From: Wei Yan <[email protected]>
--- .../devicetree/bindings/i2c/i2c-hix5hd2.txt | 31 ++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt new file +31 -0
@@ -0,0 +1,31 @@ +I2C for Hisilicon hix5hd2 chipset platforms (3716,3719,3798...) + +Required properties: +- compatible: Must be "hisilicon,hix5hd2-i2c" + Specifically, the following versions of the chipset are supported: + Hi3716CV200 (support six I2C module) + Hi3719CV100 (support six I2C module) + Hi3718CV100 (support six I2C module) + Hi3719MV100 (support two I2C module) + Hi3718MV100 (support two I2C module) +- reg: physical base address of the controller and length of memory mapped + region. +- interrupts: interrupt number to the cpu. +- #address-cells = <1>; +- #size-cells = <0>; +- clocks: phandles to input clocks. + +Optional properties: +- clock-frequency: Desired I2C bus frequency in Hz, otherwise defaults to 100000 +- Child nodes conforming to i2c bus binding + +Examples: +I2C0 at f8b10000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xf8b10000 0x1000>; + interrupts = <0 38 4>; + clocks = <&clock HIX5HD2_I2C0_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; +}
Signature · 1 line
1.7.9.5
PATCH v2 1/3 i2c: hix5hd2: add devicetree documentation
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt line 10
Quoted 10 lines · On Sunday 28 September 2014 12:22:07 Zhangfei Gao wrote:
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt new file +9
-0+ +Required properties: +- compatible: Must be "hisilicon,hix5hd2-i2c" + Specifically, the following versions of the chipset are supported: + Hi3716CV200 (support six I2C module) + Hi3719CV100 (support six I2C module) + Hi3718CV100 (support six I2C module) + Hi3719MV100 (support two I2C module) + Hi3718MV100 (support two I2C module)
How do you detect the specific model? Is there a hardware register that lets you know the type?
If you have a device specific "compatible" string, you should list all the known strings.
Arnd
PATCH v2 1/3 i2c: hix5hd2: add devicetree documentation
Quoted 17 lines · Arnd Bergmann
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt line 10
Quoted 10 lines · On Sunday 28 September 2014 12:22:07 Zhangfei Gao wrote:
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt new file +9
-0+ +Required properties: +- compatible: Must be "hisilicon,hix5hd2-i2c" + Specifically, the following versions of the chipset are supported: + Hi3716CV200 (support six I2C module) + Hi3719CV100 (support six I2C module) + Hi3718CV100 (support six I2C module) + Hi3719MV100 (support two I2C module) + Hi3718MV100 (support two I2C module)How do you detect the specific model? Is there a hardware register that lets you know the type?
If you have a device specific "compatible" string, you should list all the known strings.
In fact, no need to distinguish these hardware, the only difference is i2c module number.
The same compatible is used.
These info can be removed to remove the confusion.
Thanks
PATCH v2 1/3 i2c: hix5hd2: add devicetree documentation
Quoted 18 lines · On Tuesday 30 September 2014 17:25:25 zhangfei wrote:
Quoted 17 lines · Arnd Bergmann
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt line 10
Quoted 10 lines · On Sunday 28 September 2014 12:22:07 Zhangfei Gao wrote:
Documentation/devicetree/bindings/i2c/i2c-hix5hd2.txt new file +9
-0+ +Required properties: +- compatible: Must be "hisilicon,hix5hd2-i2c" + Specifically, the following versions of the chipset are supported: + Hi3716CV200 (support six I2C module) + Hi3719CV100 (support six I2C module) + Hi3718CV100 (support six I2C module) + Hi3719MV100 (support two I2C module) + Hi3718MV100 (support two I2C module)How do you detect the specific model? Is there a hardware register that lets you know the type?
If you have a device specific "compatible" string, you should list all the known strings.
Quoted 3 lines
In fact, no need to distinguish these hardware, the only difference is i2c module number.
The same compatible is used.
Ah, so you have multiple nodes in those cases, not just one node with a variable number of I2C hosts. I was a bit confused by the description
Quoted 1 line
These info can be removed to remove the confusion.
Yes, I think that would be better, both because it avoids the confusion, and because it means you can use the driver for future machines without having to update the binding each time.
Arnd
PATCH v2 2/3 i2c: hix5hd2: add i2c controller driver
In reply to Zhangfei GaoFrom: Wei Yan <[email protected]>
I2C drivers for hix5hd2 soc series, including following chipset Hi3716CV200, Hi3719CV100, Hi3718CV100, Hi3719MV100, Hi3718MV100.
--- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-hix5hd2.c | 554 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 565 insertions(+) create mode 100644 drivers/i2c/busses/i2c-hix5hd2.c
drivers/i2c/busses/Kconfig +10 -0
@@ -77,6 +77,16 @@ config I2C_AMD8111 This driver can also be built as a module. If so, the module will be called i2c-amd8111. +config I2C_HIX5HD2 + tristate "Hix5hd2 high-speed I2C driver" + depends on ARCH_HIX5HD2 + help + Say Y here to include support for high-speed I2C controller in the + Hisilicon based hix5hd2 SoCs. + + This driver can also be built as a module. If so, the module + will be called i2c-hix5hd2. + config I2C_I801 tristate "Intel 82801 (ICH/PCH)" depends on PCI
drivers/i2c/busses/Makefile +1 -0
@@ -47,6 +47,7 @@ obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o obj-$(CONFIG_I2C_EXYNOS5) += i2c-exynos5.o obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o +obj-$(CONFIG_I2C_HIX5HD2) += i2c-hix5hd2.o obj-$(CONFIG_I2C_IBM_IIC) += i2c-ibm_iic.o obj-$(CONFIG_I2C_IMX) += i2c-imx.o obj-$(CONFIG_I2C_IOP3XX) += i2c-iop3xx.o
drivers/i2c/busses/i2c-hix5hd2.c new file +554 -0
554 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH v2 2/3 i2c: hix5hd2: add i2c controller driver
Quoted 19 lines · Zhangfei Gao
From: Wei Yan <[email protected]>
I2C drivers for hix5hd2 soc series, including following chipset Hi3716CV200, Hi3719CV100, Hi3718CV100, Hi3719MV100, Hi3718MV100.
Signed-off-by Wei Yan <[email protected]>Signed-off-by Zhangfei Gao <[email protected]>--- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-hix5hd2.c | 554 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 565 insertions(+)create mode 100644
drivers/i2c/busses/i2c-hix5hd2.cdrivers/i2c/busses/Kconfig +0
-0
drivers/i2c/busses/Kconfig config I2C_AMD8111 · line 82
Quoted 6 lines
drivers/i2c/busses/Kconfig +3
-0@@ -77,6 +77,16 @@ config I2C_AMD8111 This driver can also be built as a module. If so, the module will be called i2c-amd8111. +config I2C_HIX5HD2 + tristate "Hix5hd2 high-speed I2C driver" + depends on ARCH_HIX5HD2
Would like to remove the dependence in next version to enable compile-test. The commit 4c255791ffd6410f ("asm-generic: io: implement relaxed accessor macros as conditional wrappers") adds wrappers to asm-generic of {read,write}{b,w,l,q}_relaxed.
Thanks
PATCH v2 3/3 ARM: dts: hix5hd2: add i2c node
In reply to Zhangfei Gao--- arch/arm/boot/dts/hisi-x5hd2.dtsi | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
arch/arm/boot/dts/hisi-x5hd2.dtsi +60 -0
@@ -476,5 +476,65 @@ interrupts = <0 70 4>; clocks = <&clock HIX5HD2_SATA_CLK>; }; + + i2c0: i2c at b10000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb10000 0x1000>; + interrupts = <0 38 4>; + clocks = <&clock HIX5HD2_I2C0_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c1: i2c at b11000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb11000 0x1000>; + interrupts = <0 39 4>; + clocks = <&clock HIX5HD2_I2C1_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c2: i2c at b12000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb12000 0x1000>; + interrupts = <0 40 4>; + clocks = <&clock HIX5HD2_I2C2_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c3: i2c at b13000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb13000 0x1000>; + interrupts = <0 41 4>; + clocks = <&clock HIX5HD2_I2C3_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c4: i2c at b16000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb16000 0x1000>; + interrupts = <0 43 4>; + clocks = <&clock HIX5HD2_I2C4_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; + + i2c5: i2c at b17000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb17000 0x1000>; + interrupts = <0 44 4>; + clocks = <&clock HIX5HD2_I2C5_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + }; }; };
Signature · 1 line
1.7.9.5
PATCH v2 3/3 ARM: dts: hix5hd2: add i2c node
arch/arm/boot/dts/hisi-x5hd2.dtsi line 488
Quoted 11 lines · On Sunday 28 September 2014 12:22:09 Zhangfei Gao wrote:
arch/arm/boot/dts/hisi-x5hd2.dtsi +10
-0+ + i2c0: i2c at b10000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb10000 0x1000>; + interrupts = <0 38 4>; + clocks = <&clock HIX5HD2_I2C0_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + };
HIX5HD2_I2C0_RST is not defined anywhere, so this will result in the same build error that has required reverting a lot of patches for the 3.18 merge window.
How do you plan to deal with the dependency in the future?
Arnd
PATCH v2 3/3 ARM: dts: hix5hd2: add i2c node
Quoted 13 lines · Arnd Bergmann
arch/arm/boot/dts/hisi-x5hd2.dtsi line 488
Quoted 11 lines · On Sunday 28 September 2014 12:22:09 Zhangfei Gao wrote:
arch/arm/boot/dts/hisi-x5hd2.dtsi +10
-0+ + i2c0: i2c at b10000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb10000 0x1000>; + interrupts = <0 38 4>; + clocks = <&clock HIX5HD2_I2C0_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + };
Quoted 6 lines
HIX5HD2_I2C0_RSTis not defined anywhere, so this will result in the same build error that has required reverting a lot of patches for the 3.18 merge window.How do you plan to deal with the dependency in the future?
HIX5HD2_I2C0_RST in clock patch and already been merged through clock tree in 09/29, should be in 3.18-rc1 (not sure).
When clock patch are combined in the same rc, will send the dts patch. Sorry for the build issue.
Thanks
PATCH v2 3/3 ARM: dts: hix5hd2: add i2c node
In reply to Arnd BergmannQuoted 12 lines · Arnd Bergmann
arch/arm/boot/dts/hisi-x5hd2.dtsi line 488
Quoted 11 lines · On Sunday 28 September 2014 12:22:09 Zhangfei Gao wrote:
arch/arm/boot/dts/hisi-x5hd2.dtsi +10
-0+ + i2c0: i2c at b10000 { + compatible = "hisilicon,hix5hd2-i2c"; + reg = <0xb10000 0x1000>; + interrupts = <0 38 4>; + clocks = <&clock HIX5HD2_I2C0_RST>; + #address-cells = <1>; + #size-cells = <0>; + status = "disabled"; + };
Hi Arnd,
Quoted 3 lines
HIX5HD2_I2C0_RSTis not defined anywhere, so this will result in the same build error that has required reverting a lot of patches for the 3.18 merge window.
Sorry again for bringing so much troubles to you, Olof and Stephen. On 9/30, Mike Turquette has already accepted the clock pull request which includes the HIX5HD2_I2C0_RST definition.
Quoted 1 line
How do you plan to deal with the dependency in the future?
In the future, I will check the dependence firstly about the patches. When creating pull request tag, I will test it and make sure it works. And I will also make sure that the order of the pull request is sent correctly.
Best Regards,
Wei
Quoted 4 lines
Arnd
.