r8a7796 I2C integration
Subsystems (7)
cover r8a7796 I2C integration
Hi!
This enables the I2C controllers on r8a7796. The only difference to r8a7795 is the clock for channels three to six (S0D6 instead of S3D2).
Based on renesas-drivers-2016-09-13-v4.8-rc6. The DMA enablement depends on the "r8a7796 SYS-DMAC integration" series posted earlier.
CU
Uli
Ulrich Hecht (6):
i2c: rcar: add support for r8a7796 (R-Car M3-W)
clk: renesas: r8a7796: Add I2C clocks
pinctrl: sh-pfc: r8a7796: add I2C pin support
arm64: renesas: r8a7796: add I2C support
arm64: renesas: r8a7796: Enable I2C DMA
arm64: renesas: r8a7796: salvator-x: enable I2C
Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 1 + arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 12 +++ arch/arm64/boot/dts/renesas/r8a7796.dtsi | 108 +++++++++++++++++++++ drivers/clk/renesas/r8a7796-cpg-mssr.c | 7 ++ drivers/i2c/busses/i2c-rcar.c | 1 + drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 77 +++++++++++++++ 6 files changed, 206 insertions(+)
Signature · 1 line
2.9.3
PATCH 1/6 i2c: rcar: add support for r8a7796 (R-Car M3-W)
Same as r8a7795.
--- Documentation/devicetree/bindings/i2c/i2c-rcar.txt | 1 + drivers/i2c/busses/i2c-rcar.c | 1 + 2 files changed, 2 insertions(+)
Documentation/devicetree/bindings/i2c/i2c-rcar.txt +1 -0
@@ -11,6 +11,7 @@ Required properties: "renesas,i2c-r8a7793" "renesas,i2c-r8a7794" "renesas,i2c-r8a7795" + "renesas,i2c-r8a7796" - reg: physical base address of the controller and length of memory mapped region. - interrupts: interrupt specifier.
drivers/i2c/busses/i2c-rcar.c +1 -0
@@ -802,6 +802,7 @@ static const struct of_device_id rcar_i2c_dt_ids[] = { { .compatible = "renesas,i2c-r8a7793", .data = (void *)I2C_RCAR_GEN2 }, { .compatible = "renesas,i2c-r8a7794", .data = (void *)I2C_RCAR_GEN2 }, { .compatible = "renesas,i2c-r8a7795", .data = (void *)I2C_RCAR_GEN3 }, + { .compatible = "renesas,i2c-r8a7796", .data = (void *)I2C_RCAR_GEN3 }, {}, };MODULE_DEVICE_TABLE (of, rcar_i2c_dt_ids);
Signature · 1 line
2.9.3
Re: [PATCH 1/6] i2c: rcar: add support for r8a7796 (R-Car M3-W)
Quoted 3 lines · Ulrich Hecht
Same as r8a7795.
Signed-off-by Ulrich Hecht <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Wolfram Sang
AppliedRe: [PATCH 1/6] i2c: rcar: add support for r8a7796 (R-Car M3-W)
In reply to Ulrich HechtQuoted 3 lines · Ulrich Hecht
Same as r8a7795.
Signed-off-by Ulrich Hecht <[email protected]>
Applied to for-next, thanks!
PATCH 2/6 clk: renesas: r8a7796: Add I2C clocks
In reply to Ulrich Hecht--- drivers/clk/renesas/r8a7796-cpg-mssr.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/renesas/r8a7796-cpg-mssr.c +7 -0
@@ -133,6 +133,13 @@ static const struct mssr_mod_clk r8a7796_mod_clks[] __initconst = {DEF_MOD ("gpio2" ,910 ,R8A7796_CLK_S3D4 ),DEF_MOD ("gpio1" ,911 ,R8A7796_CLK_S3D4 ),DEF_MOD ("gpio0" ,912 ,R8A7796_CLK_S3D4 ), +DEF_MOD ("i2c6" ,918 ,R8A7796_CLK_S0D6 ), +DEF_MOD ("i2c5" ,919 ,R8A7796_CLK_S0D6 ), +DEF_MOD ("i2c4" ,927 ,R8A7796_CLK_S0D6 ), +DEF_MOD ("i2c3" ,928 ,R8A7796_CLK_S0D6 ), +DEF_MOD ("i2c2" ,929 ,R8A7796_CLK_S3D2 ), +DEF_MOD ("i2c1" ,930 ,R8A7796_CLK_S3D2 ), + DEF_MOD("i2c0", 931, R8A7796_CLK_S3D2), }; static const unsigned int r8a7796_crit_mod_clks[] __initconst = {
Signature · 1 line
2.9.3
Re: [PATCH 2/6] clk: renesas: r8a7796: Add I2C clocks
Quoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 3/6 pinctrl: sh-pfc: r8a7796: add I2C pin support
In reply to Ulrich Hecht--- drivers/pinctrl/sh-pfc/pfc-r8a7796.c | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r8a7796.c +77 -0
@@ -1490,6 +1490,57 @@ static const struct sh_pfc_pin pinmux_pins[] = { PINMUX_GPIO_GP_ALL(), }; +/* - I2C -------------------------------------------------------------------- */ +static const unsigned int i2c1_a_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (5 ,11 ),RCAR_GP_PIN (5 ,10 ), +}; +static const unsigned int i2c1_a_mux[] = { +SDA1_A_MARK ,SCL1_A_MARK , +}; +static const unsigned int i2c1_b_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (5 ,24 ),RCAR_GP_PIN (5 ,23 ), +}; +static const unsigned int i2c1_b_mux[] = { +SDA1_B_MARK ,SCL1_B_MARK , +}; +static const unsigned int i2c2_a_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (5 ,0 ),RCAR_GP_PIN (5 ,4 ), +}; +static const unsigned int i2c2_a_mux[] = { +SDA2_A_MARK ,SCL2_A_MARK , +}; +static const unsigned int i2c2_b_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (3 ,13 ),RCAR_GP_PIN (3 ,12 ), +}; +static const unsigned int i2c2_b_mux[] = { +SDA2_B_MARK ,SCL2_B_MARK , +}; +static const unsigned int i2c6_a_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (1 ,8 ),RCAR_GP_PIN (1 ,11 ), +}; +static const unsigned int i2c6_a_mux[] = { +SDA6_A_MARK ,SCL6_A_MARK , +}; +static const unsigned int i2c6_b_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (1 ,26 ),RCAR_GP_PIN (1 ,25 ), +}; +static const unsigned int i2c6_b_mux[] = { +SDA6_B_MARK ,SCL6_B_MARK , +}; +static const unsigned int i2c6_c_pins[] = { +/* SDA, SCL */ +RCAR_GP_PIN (0 ,15 ),RCAR_GP_PIN (0 ,14 ), +}; +static const unsigned int i2c6_c_mux[] = { +SDA6_C_MARK ,SCL6_C_MARK , +}; +/* - SCIF0 ------------------------------------------------------------------ */ static const unsigned int scif0_data_pins[] = {/* RX, TX */
@@ -1912,6 +1963,13 @@ static const unsigned int sdhi3_ds_mux[] = { };static const struct sh_pfc_pin_group pinmux_groups[] = { +SH_PFC_PIN_GROUP (i2c1_a), +SH_PFC_PIN_GROUP (i2c1_b), +SH_PFC_PIN_GROUP (i2c2_a), +SH_PFC_PIN_GROUP (i2c2_b), +SH_PFC_PIN_GROUP (i2c6_a), +SH_PFC_PIN_GROUP (i2c6_b), +SH_PFC_PIN_GROUP (i2c6_c),SH_PFC_PIN_GROUP (scif0_data),SH_PFC_PIN_GROUP (scif0_clk),SH_PFC_PIN_GROUP (scif0_ctrl),
@@ -1969,6 +2027,22 @@ static const struct sh_pfc_pin_group pinmux_groups[] = { SH_PFC_PIN_GROUP(sdhi3_ds), }; +static const char *const i2c1_groups[] = { +"i2c1_a" , +"i2c1_b" , +}; + +static const char *const i2c2_groups[] = { +"i2c2_a" , +"i2c2_b" , +}; + +static const char *const i2c6_groups[] = { +"i2c6_a" , +"i2c6_b" , +"i2c6_c" , +}; +static const char *const scif0_groups[] = {"scif0_data" ,"scif0_clk" ,
@@ -2058,6 +2132,9 @@ static const char * const sdhi3_groups[] = { };static const struct sh_pfc_function pinmux_functions[] = { +SH_PFC_FUNCTION (i2c1), +SH_PFC_FUNCTION (i2c2), +SH_PFC_FUNCTION (i2c6),SH_PFC_FUNCTION (scif0),SH_PFC_FUNCTION (scif1),SH_PFC_FUNCTION (scif2),
Signature · 1 line
2.9.3
Re: [PATCH 3/6] pinctrl: sh-pfc: r8a7796: add I2C pin support
Quoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 4/6 arm64: renesas: r8a7796: add I2C support
In reply to Ulrich Hecht--- arch/arm64/boot/dts/renesas/r8a7796.dtsi | 94 ++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+)
arch/arm64/boot/dts/renesas/r8a7796.dtsi +94 -0
@@ -17,6 +17,16 @@ #address-cells = <2>; #size-cells = <2>; + aliases { + i2c0 = &i2c0; + i2c1 = &i2c1; + i2c2 = &i2c2; + i2c3 = &i2c3; + i2c4 = &i2c4; + i2c5 = &i2c5; + i2c6 = &i2c6; + }; + psci { compatible = "arm,psci-0.2"; method = "smc";
@@ -239,6 +249,90 @@ #power-domain-cells = <1>; }; + i2c0: i2c@e6500000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe6500000 0 0x40>; + interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 931>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <110>; + status = "disabled"; + }; + + i2c1: i2c@e6508000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe6508000 0 0x40>; + interrupts = <GIC_SPI 288 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 930>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <6>; + status = "disabled"; + }; + + i2c2: i2c@e6510000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe6510000 0 0x40>; + interrupts = <GIC_SPI 286 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 929>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <6>; + status = "disabled"; + }; + + i2c3: i2c@e66d0000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe66d0000 0 0x40>; + interrupts = <GIC_SPI 290 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 928>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <110>; + status = "disabled"; + }; + + i2c4: i2c@e66d8000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe66d8000 0 0x40>; + interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 927>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <110>; + status = "disabled"; + }; + + i2c5: i2c@e66e0000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe66e0000 0 0x40>; + interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 919>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <110>; + status = "disabled"; + }; + + i2c6: i2c@e66e8000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "renesas,i2c-r8a7796"; + reg = <0 0xe66e8000 0 0x40>; + interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&cpg CPG_MOD 918>; + power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + i2c-scl-internal-delay-ns = <6>; + status = "disabled"; + }; + scif2: serial@e6e88000 { compatible = "renesas,scif-r8a7796", "renesas,rcar-gen3-scif", "renesas,scif";
Signature · 1 line
2.9.3
Re: [PATCH 4/6] arm64: renesas: r8a7796: add I2C support
Quoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Re: [PATCH 4/6] arm64: renesas: r8a7796: add I2C support
In reply to Ulrich HechtQuoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
I would like to see some testing of this with 64bit memory enabled - or some assurance there is no issue with such a configuration.
I am marking this patch and other arm64 patches in this series as Deferred for now.
Re: [PATCH 4/6] arm64: renesas: r8a7796: add I2C support
In reply to Ulrich HechtQuoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
PATCH 5/6 arm64: renesas: r8a7796: Enable I2C DMA
In reply to Ulrich Hecht--- arch/arm64/boot/dts/renesas/r8a7796.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm64/boot/dts/renesas/r8a7796.dtsi +14 -0
@@ -257,6 +257,8 @@ interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 931>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x91>, <&dmac1 0x90>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <110>; status = "disabled"; };
@@ -269,6 +271,8 @@ interrupts = <GIC_SPI 288 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 930>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x93>, <&dmac1 0x92>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <6>; status = "disabled"; };
@@ -281,6 +285,8 @@ interrupts = <GIC_SPI 286 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 929>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x95>, <&dmac1 0x94>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <6>; status = "disabled"; };
@@ -293,6 +299,8 @@ interrupts = <GIC_SPI 290 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 928>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac0 0x97>, <&dmac0 0x96>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <110>; status = "disabled"; };
@@ -305,6 +313,8 @@ interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 927>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac0 0x99>, <&dmac0 0x98>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <110>; status = "disabled"; };
@@ -317,6 +327,8 @@ interrupts = <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 919>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac0 0x9b>, <&dmac0 0x9a>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <110>; status = "disabled"; };
@@ -329,6 +341,8 @@ interrupts = <GIC_SPI 21 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 918>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac0 0x9d>, <&dmac0 0x9c>; + dma-names = "tx", "rx"; i2c-scl-internal-delay-ns = <6>; status = "disabled"; };
Signature · 1 line
2.9.3
Re: [PATCH 5/6] arm64: renesas: r8a7796: Enable I2C DMA
Hi Ulrich,
Quoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
Quoted 9 lines
--- arch/arm64/boot/dts/renesas/r8a7796.dtsi | 14 ++++++++++++++ 1 file changed, 14 insertions(+)arch/arm64/boot/dts/renesas/r8a7796.dtsi +0
-0
arch/arm64/boot/dts/renesas/r8a7796.dtsi line 261
Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a7796.dtsi +2
-0@@ -257,6 +257,8 @@ interrupts = <GIC_SPI 287 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 931>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x91>, <&dmac1 0x90>; + dma-names = "tx", "rx";
Does the firmware on your r8a7796/salvator-x support using SYS-DMAC2? (the one we have on r8a7795/salvator-x doesn't)
If yes, you may want to add those dmas, too.
arch/arm64/boot/dts/renesas/r8a7796.dtsi line 275
Quoted 9 lines
arch/arm64/boot/dts/renesas/r8a7796.dtsi +2
-0i2c-scl-internal-delay-ns = <110>; status = "disabled"; };@@ -269,6 +271,8 @@ interrupts = <GIC_SPI 288 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 930>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x93>, <&dmac1 0x92>; + dma-names = "tx", "rx";
Likewise.
arch/arm64/boot/dts/renesas/r8a7796.dtsi line 289
Quoted 9 lines
arch/arm64/boot/dts/renesas/r8a7796.dtsi +2
-0i2c-scl-internal-delay-ns = <6>; status = "disabled"; };@@ -281,6 +285,8 @@ interrupts = <GIC_SPI 286 IRQ_TYPE_LEVEL_HIGH>; clocks = <&cpg CPG_MOD 929>; power-domains = <&sysc R8A7796_PD_ALWAYS_ON>; + dmas = <&dmac1 0x95>, <&dmac1 0x94>; + dma-names = "tx", "rx";
Likewise.
arch/arm64/boot/dts/renesas/r8a7796.dtsi line 278
Quoted 3 lines
arch/arm64/boot/dts/renesas/r8a7796.dtsi +0
-0i2c-scl-internal-delay-ns = <6>; status = "disabled"; };
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
PATCH 6/6 arm64: renesas: r8a7796: salvator-x: enable I2C
In reply to Ulrich Hecht--- arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +12 -0
@@ -94,6 +94,11 @@ function = "scif_clk"; }; + i2c2_pins: i2c2 { + groups = "i2c2_a"; + function = "i2c2"; + }; + sdhi0_pins: sd0 { groups = "sdhi0_data4", "sdhi0_ctrl"; function = "sdhi0";
@@ -144,6 +149,13 @@ status = "okay"; }; +&i2c2 { + pinctrl-0 = <&i2c2_pins>; + pinctrl-names = "default"; + + status = "okay"; +}; + &wdt0 { timeout-sec = <60>; status = "okay";
Signature · 1 line
2.9.3
Re: [PATCH 6/6] arm64: renesas: r8a7796: salvator-x: enable I2C
Quoted 1 line · Ulrich Hecht
Signed-off-by Ulrich Hecht <[email protected]>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds