Add Altera I2C Controller Driver
Subsystems (2)
v3 cover Add Altera I2C Controller Driver
From: Thor Thayer <[email protected]>
This patch seris add the Altera I2C Controller driver for use in FPGAs.
Thor Thayer (4):
ARM: dts: socfpga: Add Altera I2C Controller to CycloneV
MAINTAINERS: Add Altera I2C Controller Driver
dt-bindings: i2c: Add Altera I2C Controller
i2c: altera: Add Altera I2C Controller driver
.../devicetree/bindings/i2c/i2c-altera.txt | 39 ++ MAINTAINERS | 5 + arch/arm/boot/dts/socfpga.dtsi | 13 +- arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 28 +- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-altera.c | 509 +++++++++++++++++++++ 7 files changed, 601 insertions(+), 4 deletions(-) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-altera.txt create mode 100644 drivers/i2c/busses/i2c-altera.c
Signature · 1 line
2.7.4
PATCH v3 1/4 ARM: dts: socfpga: Add Altera I2C Controller to CycloneV
From: Thor Thayer <[email protected]>
Add the Altera I2C Controller to the CycloneV SoCFPGA device tree.
---
v2 Remove altr, from fifo-size.
Rename compatible string to "altr,softip-i2c"
v3 Add version to commpatible string "altr,softip-i2c-v1.0"
--- arch/arm/boot/dts/socfpga.dtsi | 13 ++++++++++--- arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 28 +++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +10 -3
@@ -133,6 +133,13 @@ #address-cells = <1>; #size-cells = <0>; + clk_0: clk_0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + clock-output-names = "clk_0-clk"; + }; + osc1: osc1 { #clock-cells = <0>; compatible = "fixed-clock";
@@ -529,11 +536,11 @@ }; }; - fpga_bridge0: fpga_bridge@ff400000 { + fpga_bridge0: fpga_bridge@ff200000 { compatible = "altr,socfpga-lwhps2fpga-bridge"; - reg = <0xff400000 0x100000>; + reg = <0xff200000 0x00200000>; resets = <&rst LWHPS2FPGA_RESET>; - clocks = <&l4_main_clk>; + clocks = <&clk_0>; }; fpga_bridge1: fpga_bridge@ff500000 {
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +27 -1
@@ -68,6 +68,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; + }; &can0 {
@@ -101,7 +102,7 @@ }; &i2c0 { - status = "okay"; + status = "disabled"; clock-frequency = <100000>; /*
@@ -176,3 +177,28 @@ &usb1 { status = "okay"; }; + +&fpga_bridge0 { + reg-names = "axi_h2f_lw"; + #address-cells = <2>; + #size-cells = <1>; + ranges = <0x00000001 0x00080000 0xff280000 0x00000040>; + + i2c_0: i2c@0x100080000 { + compatible = "altr,softip-i2c-v1.0"; + reg = <0x00000001 0x00080000 0x00000040>; + interrupt-parent = <&intc>; + interrupts = <0 43 4>; + clocks = <&clk_0>; + fifo-size = <4>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + + eeprom@51 { + compatible = "atmel,24c32"; + reg = <0x51>; + pagesize = <32>; + }; + }; +};
Signature · 1 line
2.7.4
Re: [PATCHv3 1/4] ARM: dts: socfpga: Add Altera I2C Controller to CycloneV
Hi!
Quoted 36 lines · thor.thayer at linux.intel.com
From: Thor Thayer <[email protected]>
Add the Altera I2C Controller to the CycloneV SoCFPGA device tree.
Signed-off-by Thor Thayer <[email protected]>---
v2 Remove altr, from fifo-size.
Rename compatible string to "altr,softip-i2c"
v3 Add version to commpatible string "altr,softip-i2c-v1.0"--- arch/arm/boot/dts/socfpga.dtsi | 13 ++++++++++--- arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 28 +++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-)arch/arm/boot/dts/socfpga.dtsi +7
-0@@ -133,6 +133,13 @@ #address-cells = <1>; #size-cells = <0>; + clk_0: clk_0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + clock-output-names = "clk_0-clk"; + }; + osc1: osc1 { #clock-cells = <0>; compatible = "fixed-clock";@@ -529,11 +536,11 @@ }; };
arch/arm/boot/dts/socfpga.dtsi line 545
Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +3
-3- fpga_bridge0: fpga_bridge at ff400000 { + fpga_bridge0: fpga_bridge at ff200000 { compatible = "altr,socfpga-lwhps2fpga-bridge"; - reg = <0xff400000 0x100000>; + reg = <0xff200000 0x00200000>; resets = <&rst LWHPS2FPGA_RESET>; - clocks = <&l4_main_clk>; + clocks = <&clk_0>; };
Why this change? This looks wrong and unrelated. The LWHPS2FPGA bridge is at 0xff400000, so it is correct the way it is or not?
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 72
Quoted 11 lines
arch/arm/boot/dts/socfpga.dtsi +0
-0fpga_bridge1: fpga_bridge at ff500000 {arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +1
-0@@ -68,6 +68,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; + };
???
(...)
Best regards,
Steffen
Signature · 4 lines
Pengutronix e.K. | Steffen Trumtrar | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Re: [PATCHv3 1/4] ARM: dts: socfpga: Add Altera I2C Controller to CycloneV
Hi Steffen,
Quoted 41 lines · Steffen Trumtrar
Hi!
Quoted 36 lines · [email protected] writes:
From: Thor Thayer <[email protected]>
Add the Altera I2C Controller to the CycloneV SoCFPGA device tree.
Signed-off-by Thor Thayer <[email protected]>---
v2 Remove altr, from fifo-size.
Rename compatible string to "altr,softip-i2c"
v3 Add version to commpatible string "altr,softip-i2c-v1.0"--- arch/arm/boot/dts/socfpga.dtsi | 13 ++++++++++--- arch/arm/boot/dts/socfpga_cyclone5_socdk.dts | 28 +++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 4 deletions(-)arch/arm/boot/dts/socfpga.dtsi +7
-0@@ -133,6 +133,13 @@ #address-cells = <1>; #size-cells = <0>; + clk_0: clk_0 { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <50000000>; + clock-output-names = "clk_0-clk"; + }; + osc1: osc1 { #clock-cells = <0>; compatible = "fixed-clock";@@ -529,11 +536,11 @@ }; };
Quoted 14 lines
arch/arm/boot/dts/socfpga.dtsi line 545
Quoted 10 lines
arch/arm/boot/dts/socfpga.dtsi +3
-3- fpga_bridge0: fpga_bridge@ff400000 { + fpga_bridge0: fpga_bridge@ff200000 { compatible = "altr,socfpga-lwhps2fpga-bridge"; - reg = <0xff400000 0x100000>; + reg = <0xff200000 0x00200000>; resets = <&rst LWHPS2FPGA_RESET>; - clocks = <&l4_main_clk>; + clocks = <&clk_0>; };Why this change? This looks wrong and unrelated. The LWHPS2FPGA bridge is at
0xff400000, so it is correct the way it is or not?
Yes, good point. I was using the LWHPS2FPGA slave bus so I shouldn't change this one. I'll add the slave version.
Thanks,
Thor
Quoted 5 lines
Quoted 5 lines
arch/arm/boot/dts/socfpga.dtsi +0
-0fpga_bridge1: fpga_bridge@ff500000 {arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +0
-0
Quoted 9 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts line 72
Quoted 6 lines
arch/arm/boot/dts/socfpga_cyclone5_socdk.dts +1
-0@@ -68,6 +68,7 @@ regulator-min-microvolt = <3300000>; regulator-max-microvolt = <3300000>; }; + };???
Whoops. I should remove the extra space. Thanks!
Quoted 7 lines
(...)
Best regards,
Steffen
PATCH v3 2/4 MAINTAINERS: Add Altera I2C Controller Driver
In reply to [email protected]From: Thor Thayer <[email protected]>
Add maintainer for the Altera I2C Controller Driver.
---
v2&3 No change
--- MAINTAINERS | 5 +++++ 1 file changed, 5 insertions(+)
MAINTAINERS +5 -0
@@ -636,6 +636,11 @@ ALPS PS/2 TOUCHPAD DRIVER R: Pali Rohár <[email protected]> F: drivers/input/mouse/alps.* +ALTERA I2C CONTROLLER DRIVER +M: Thor Thayer <[email protected]> +S: Maintained +F: drivers/i2c/busses/i2c-altera.c + ALTERA MAILBOX DRIVER M: Ley Foon Tan <[email protected]> L: [email protected] (moderated for non-subscribers)
Signature · 1 line
2.7.4
PATCH v3 3/4 dt-bindings: i2c: Add Altera I2C Controller
In reply to [email protected]From: Thor Thayer <[email protected]>
Add the documentation to support the Altera synthesizable logic I2C Controller in FPGA.
---
v2 Change the subject to identify dt-bindings
Add synthesizable logic to description.
Change compatible string to "altr,softip-i2c" Make description of clock phandle singular since 1 clock. Remove altr, from fifo-size
Specify fifo-size is in bytes.
v3 Add version to compatible string "altr,softip-i2c-v1.0"
Add for use in FPGA in description.
--- .../devicetree/bindings/i2c/i2c-altera.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-altera.txt
Documentation/devicetree/bindings/i2c/i2c-altera.txt new file +39 -0
@@ -0,0 +1,39 @@ +* Altera I2C Controller +* This is Altera's synthesizable logic block I2C Controller for use +* in Altera's FPGAs. + +Required properties : + - compatible : should be "altr,softip-i2c-v1.0" + - reg : Offset and length of the register set for the device + - interrupts : <IRQ> where IRQ is the interrupt number. + - clocks : phandle to input clock. + - #address-cells = <1>; + - #size-cells = <0>; + +Recommended properties : + - clock-frequency : desired I2C bus clock frequency in Hz. + +Optional properties : + - fifo-size : Size of the RX and TX FIFOs in bytes. + - Child nodes conforming to i2c bus binding + +Example : + + i2c@100080000 { + compatible = "altr,softip-i2c-v1.0"; + reg = <0x00000001 0x00080000 0x00000040>; + interrupt-parent = <&intc>; + interrupts = <0 43 4>; + clocks = <&clk_0>; + clock-frequency = <100000>; + #address-cells = <1>; + #size-cells = <0>; + fifo-size = <4>; + + eeprom@51 { + compatible = "atmel,24c32"; + reg = <0x51>; + pagesize = <32>; + }; + }; +
Signature · 1 line
2.7.4
Re: [PATCHv3 3/4] dt-bindings: i2c: Add Altera I2C Controller
Quoted 15 lines · thor.thayer at linux.intel.com
From: Thor Thayer <[email protected]>
Add the documentation to support the Altera synthesizable logic I2C Controller in FPGA.
Signed-off-by Thor Thayer <[email protected]>---
v2 Change the subject to identify dt-bindings
Add synthesizable logic to description.
Change compatible string to "altr,softip-i2c" Make description of clock phandle singular since 1 clock. Remove altr, from fifo-size
Specify fifo-size is in bytes.
v3 Add version to compatible string "altr,softip-i2c-v1.0"
Add for use in FPGA in description.
Quoted 4 lines
--- .../devicetree/bindings/i2c/i2c-altera.txt | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-altera.txt
PATCH v3 4/4 i2c: altera: Add Altera I2C Controller driver
In reply to [email protected]From: Thor Thayer <[email protected]>
Add driver support for the Altera I2C Controller. The I2C controller is soft IP for use in FPGAs.
---
v2 Remove altr, from fifo-size to agree with bindings.
Change compatible string to "altr,softip-i2c"
v3 Add version to compatible string "altr,softip-i2c-v1.0"
--- drivers/i2c/busses/Kconfig | 10 + drivers/i2c/busses/Makefile | 1 + drivers/i2c/busses/i2c-altera.c | 509 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 520 insertions(+) create mode 100644 drivers/i2c/busses/i2c-altera.c
drivers/i2c/busses/Kconfig +10 -0
@@ -326,6 +326,16 @@ config I2C_POWERMAC comment "I2C system bus drivers (mostly embedded / system-on-chip)" +config I2C_ALTERA + tristate "Altera Soft IP I2C" + depends on (ARCH_SOCFPGA || NIOS2) && OF + help + If you say yes to this option, support will be included for the + Altera Soft IP I2C interfaces on SoCFPGA and Nios2 architectures. + + This driver can also be built as a module. If so, the module + will be called i2c-altera. + config I2C_AT91 tristate "Atmel AT91 I2C Two-Wire interface (TWI)" depends on ARCH_AT91
drivers/i2c/busses/Makefile +1 -0
@@ -29,6 +29,7 @@ obj-$(CONFIG_I2C_HYDRA) += i2c-hydra.o obj-$(CONFIG_I2C_POWERMAC) += i2c-powermac.o # Embedded system I2C/SMBus host controller drivers +obj-$(CONFIG_I2C_ALTERA) += i2c-altera.o obj-$(CONFIG_I2C_AT91) += i2c-at91.o obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o obj-$(CONFIG_I2C_AXXIA) += i2c-axxia.o
drivers/i2c/busses/i2c-altera.c new file +509 -0
509 lines not on this page · raw message
Signature · 1 line
2.7.4