Skip to contentSkip to conversation

SATA for r8a7795, Salvator-X

PATCH Superseded Ulrich Hecht 3 participants 15 messages Dec 14, 2015 – Dec 16, 2015

Subsystems (5)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover SATA for r8a7795, Salvator-X

Hi!

This is an adaptation of the patch set from the BSP, adjusted to the new PFC and MSTP clock models. Applied on top of renesas-drivers, this works great for me.

CU
Uli

Kouei Abe (3):
arm64: dts: r8a7795: Add SATA controller node
arm64: dts: salvator-x: Enable SATA controller
arm64: defconfig: Add Renesas R-Car SATA driver for R-Car Gen3 SoCs

Takeshi Kihara (1):
pinctrl: sh-pfc: r8a7795: Add SATA support

Ulrich Hecht (2):
clk: shmobile: r8a7795: Add SATA0 clock
pinctrl: sh-pfc: r8a7795: add SATA0 pin conf to DT

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 11 ++++++++++
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           |  8 ++++++++
 arch/arm64/configs/defconfig                       |  1 +
 drivers/clk/shmobile/r8a7795-cpg-mssr.c            |  1 +
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c               | 24 ++++++++++++++++++++++
 5 files changed, 45 insertions(+)
Signature · 1 line
2.6.3
#1 lore raw

PATCH 1/6 clk: shmobile: r8a7795: Add SATA0 clock

---
 drivers/clk/shmobile/r8a7795-cpg-mssr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/shmobile/r8a7795-cpg-mssr.c +1 -0
index 05479e6..ad4d9fd 100644
@@ -159,6 +159,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
 	DEF_MOD("gpio2",		 910,	R8A7795_CLK_CP),
 	DEF_MOD("gpio1",		 911,	R8A7795_CLK_CP),
 	DEF_MOD("gpio0",		 912,	R8A7795_CLK_CP),
+	DEF_MOD("sata0",		 915,	R8A7795_CLK_S3D2),
 	DEF_MOD("i2c6",			 918,	R8A7795_CLK_S3D2),
 	DEF_MOD("i2c5",			 919,	R8A7795_CLK_S3D2),
 	DEF_MOD("i2c4",			 927,	R8A7795_CLK_S3D2),
Signature · 1 line
2.6.3
#2 lore raw

PATCH 1/6 clk: shmobile: r8a7795: Add SATA0 clock

Quoted 10 lines · Ulrich Hecht
---
 drivers/clk/shmobile/r8a7795-cpg-mssr.c | 1 +
 1 file changed, 1 insertion(+)
drivers/clk/shmobile/r8a7795-cpg-mssr.c +0 -0
index 05479e6..ad4d9fd 100644

drivers/clk/shmobile/r8a7795-cpg-mssr.c static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = { · line 162

Quoted 4 lines
drivers/clk/shmobile/r8a7795-cpg-mssr.c +1 -0
@@ -159,6 +159,7 @@ static const struct mssr_mod_clk r8a7795_mod_clks[] __initconst = {
        DEF_MOD("gpio2",                 910,   R8A7795_CLK_CP),
        DEF_MOD("gpio1",                 911,   R8A7795_CLK_CP),
        DEF_MOD("gpio0",                 912,   R8A7795_CLK_CP),
+       DEF_MOD("sata0",                 915,   R8A7795_CLK_S3D2),

My datasheet says 815?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#3 lore raw

PATCH 2/6 arm64: dts: r8a7795: Add SATA controller node

In reply to Ulrich Hecht

From: Kouei Abe <[email protected]>

This adds SATA device node to r8a7795.dtsi.

[uli: adjusted for new MSTP clock scheme]
---
 arch/arm64/boot/dts/renesas/r8a7795.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795.dtsi +8 -0
index c018423..7d4707e 100644
@@ -972,5 +972,13 @@
 				};
 			};
 		};
+
+		sata: sata at ee300000 {
+			compatible = "renesas,sata-r8a7795";
+			reg = <0 0xee300000 0 0x1fff>;
+			interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 915>;
+			status = "disabled";
+		};
 	};
 };
Signature · 1 line
2.6.3
#4 lore raw

PATCH 2/6 arm64: dts: r8a7795: Add SATA controller node

Quoted 5 lines · Ulrich Hecht
arch/arm64/boot/dts/renesas/r8a7795.dtsi +0 -0
index c018423..7d4707e 100644

arch/arm64/boot/dts/renesas/r8a7795.dtsi line 980

Quoted 9 lines
arch/arm64/boot/dts/renesas/r8a7795.dtsi +6 -0
@@ -972,5 +972,13 @@
                                };
                        };
                };
+
+               sata: sata at ee300000 {
+                       compatible = "renesas,sata-r8a7795";
+                       reg = <0 0xee300000 0 0x1fff>;
+                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 915>;

My datasheet says 815.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#5 lore raw

PATCH 2/6 arm64: dts: r8a7795: Add SATA controller node

Quoted 18 lines · Geert Uytterhoeven
Quoted 5 lines · Ulrich Hecht
arch/arm64/boot/dts/renesas/r8a7795.dtsi +0 -0
index c018423..7d4707e 100644

arch/arm64/boot/dts/renesas/r8a7795.dtsi line 980

Quoted 9 lines
arch/arm64/boot/dts/renesas/r8a7795.dtsi +6 -0
@@ -972,5 +972,13 @@
                                };
                        };
                };
+
+               sata: sata at ee300000 {
+                       compatible = "renesas,sata-r8a7795";
+                       reg = <0 0xee300000 0 0x1fff>;
+                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 915>;

My datasheet says 815.

So does the BSP, I must have misread that.

Simon, should I send an incremental patch for this one with v2?

CU
Uli

#6 lore raw

PATCH 2/6 arm64: dts: r8a7795: Add SATA controller node

Quoted 21 lines · Ulrich Hecht
Quoted 18 lines · Geert Uytterhoeven
Quoted 5 lines · Ulrich Hecht
arch/arm64/boot/dts/renesas/r8a7795.dtsi +0 -0
index c018423..7d4707e 100644

arch/arm64/boot/dts/renesas/r8a7795.dtsi line 980

Quoted 9 lines
arch/arm64/boot/dts/renesas/r8a7795.dtsi +6 -0
@@ -972,5 +972,13 @@
                                };
                        };
                };
+
+               sata: sata at ee300000 {
+                       compatible = "renesas,sata-r8a7795";
+                       reg = <0 0xee300000 0 0x1fff>;
+                       interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>;
+                       clocks = <&cpg CPG_MOD 915>;

My datasheet says 815.

Quoted 3 lines

So does the BSP, I must have misread that.

Simon, should I send an incremental patch for this one with v2?

Please send an incremental patch, though I may well squash it into what I already have queued up depending on when it arrives.

#7 lore raw

PATCH 3/6 arm64: dts: salvator-x: Enable SATA controller

In reply to Ulrich Hecht

From: Kouei Abe <[email protected]>

This enables SATA device in r8a7795-salvator-x.dts.

---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +4 -0
index 0c67442..297c9f0 100644
@@ -268,6 +268,10 @@
 	};
 };
 
+&sata {
+	status = "okay";
+};
+
 &ssi1 {
 	shared-pin;
 };
Signature · 1 line
2.6.3
#8 lore raw

PATCH 4/6 pinctrl: sh-pfc: r8a7795: Add SATA support

In reply to Ulrich Hecht

From: Takeshi Kihara <[email protected]>

This patch adds SATA0 pinmux support to r8a7795 SoC.

[uli: adjusted for new PFC driver]
---
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
drivers/pinctrl/sh-pfc/pfc-r8a7795.c +24 -0
index 35e0172..d036c92 100644
@@ -2492,6 +2492,22 @@ static const unsigned int msiof3_rxd_d_mux[] = {
 	MSIOF3_RXD_D_MARK,
 };
 
+/* - SATA --------------------------------------------------------------------*/
+static const unsigned int sata0_devslp_a_pins[] = {
+	/* DEVSLP */
+	RCAR_GP_PIN(6, 16),
+};
+static const unsigned int sata0_devslp_a_mux[] = {
+	SATA_DEVSLP_A_MARK,
+};
+static const unsigned int sata0_devslp_b_pins[] = {
+	/* DEVSLP */
+	RCAR_GP_PIN(4, 6),
+};
+static const unsigned int sata0_devslp_b_mux[] = {
+	SATA_DEVSLP_B_MARK,
+};
+
 /* - SCIF0 ------------------------------------------------------------------ */
 static const unsigned int scif0_data_pins[] = {
 	/* RX, TX */
@@ -3020,6 +3036,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(msiof3_ss1_d),
 	SH_PFC_PIN_GROUP(msiof3_txd_d),
 	SH_PFC_PIN_GROUP(msiof3_rxd_d),
+	SH_PFC_PIN_GROUP(sata0_devslp_a),
+	SH_PFC_PIN_GROUP(sata0_devslp_b),
 	SH_PFC_PIN_GROUP(scif0_data),
 	SH_PFC_PIN_GROUP(scif0_clk),
 	SH_PFC_PIN_GROUP(scif0_ctrl),
@@ -3267,6 +3285,11 @@ static const char * const msiof3_groups[] = {
 	"msiof3_rxd_d",
 };
 
+static const char * const sata0_groups[] = {
+	"sata0_devslp_a",
+	"sata0_devslp_b",
+};
+
 static const char * const scif0_groups[] = {
 	"scif0_data",
 	"scif0_clk",
@@ -3358,6 +3381,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(msiof1),
 	SH_PFC_FUNCTION(msiof2),
 	SH_PFC_FUNCTION(msiof3),
+	SH_PFC_FUNCTION(sata0),
 	SH_PFC_FUNCTION(scif0),
 	SH_PFC_FUNCTION(scif1),
 	SH_PFC_FUNCTION(scif2),
Signature · 1 line
2.6.3
#9 lore raw

PATCH 4/6 pinctrl: sh-pfc: r8a7795: Add SATA support

Quoted 7 lines · Ulrich Hecht

From: Takeshi Kihara <[email protected]>

This patch adds SATA0 pinmux support to r8a7795 SoC.

[uli: adjusted for new PFC driver]

Thanks, queued for v4.5.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#10 lore raw

PATCH 5/6 pinctrl: sh-pfc: r8a7795: add SATA0 pin conf to DT

In reply to Ulrich Hecht
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +7 -0
index 297c9f0..3d6c1e0 100644
@@ -140,6 +140,10 @@
 	pinctrl-0 = <&scif_clk_pins>;
 	pinctrl-names = "default";
 
+	sata0_pins: sata0 {
+		renesas,groups = "sata0_devslp_a";
+		renesas,function = "sata0";
+	};
 	scif1_pins: scif1 {
 		renesas,groups = "scif1_data_a", "scif1_ctrl";
 		renesas,function = "scif1";
@@ -269,6 +273,9 @@
 };
 
 &sata {
+	pinctrl-0 = <&sata0_pins>;
+	pinctrl-names = "default";
+
 	status = "okay";
 };
 
Signature · 1 line
2.6.3
#11 lore raw

PATCH 5/6 pinctrl: sh-pfc: r8a7795: add SATA0 pin conf to DT

Hi Ulrich,

Quoted 10 lines · Ulrich Hecht
---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0
index 297c9f0..3d6c1e0 100644

arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts line 144

Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +2 -0
@@ -140,6 +140,10 @@
        pinctrl-0 = <&scif_clk_pins>;
        pinctrl-names = "default";
 
+       sata0_pins: sata0 {
+               renesas,groups = "sata0_devslp_a";

This pin is GP6_16, which is used for USB-OTG on Salvator-X, according to the schematics?
It looks like the SATA DEVSLP feature is not used at all on Salvator-X.

Upon closer look, using the feature (on a board where the pin is connected) would need a driver update, as the SATAEDEVSLPR register is not present on R-Car Gen2, and thus not yet handled by the driver.

Hence I expect SATA to work fine without any pinctrl, and this patch should just be dropped?

Can you please check? Thanks!

Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +2 -0
+               renesas,function = "sata0";
+       };
        scif1_pins: scif1 {
                renesas,groups = "scif1_data_a", "scif1_ctrl";
                renesas,function = "scif1";

arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts line 280

Quoted 8 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +3 -0
@@ -269,6 +273,9 @@
 };
 
 &sata {
+       pinctrl-0 = <&sata0_pins>;
+       pinctrl-names = "default";
+
        status = "okay";
 };

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#12 lore raw

PATCH 5/6 pinctrl: sh-pfc: r8a7795: add SATA0 pin conf to DT

Quoted 4 lines · Geert Uytterhoeven

Hence I expect SATA to work fine without any pinctrl, and this patch should just be dropped?

Can you please check? Thanks!

Works just fine without. I'll drop it.

CU
Uli

#13 lore raw

PATCH 6/6 arm64: defconfig: Add Renesas R-Car SATA driver for R-Car Gen3 SoCs

In reply to Ulrich Hecht

From: Kouei Abe <[email protected]>

This adds Renesas sata_rcar driver to defconfig.

---
 arch/arm64/configs/defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
index f239a2e..bdbe783 100644
@@ -93,6 +93,7 @@ CONFIG_SATA_AHCI=y
 CONFIG_SATA_AHCI_PLATFORM=y
 CONFIG_AHCI_CEVA=y
 CONFIG_AHCI_XGENE=y
+CONFIG_SATA_RCAR=y
 CONFIG_PATA_PLATFORM=y
 CONFIG_PATA_OF_PLATFORM=y
 CONFIG_NETDEVICES=y
Signature · 1 line
2.6.3
#14 lore raw

cover SATA for r8a7795, Salvator-X

In reply to Ulrich Hecht
Quoted 6 lines · Ulrich Hecht

Hi!

This is an adaptation of the patch set from the BSP, adjusted to the new PFC and MSTP clock models. Applied on top of renesas-drivers, this works great for me.

Quoted 8 lines

CU
Uli

Kouei Abe (3):
arm64: dts: r8a7795: Add SATA controller node
arm64: dts: salvator-x: Enable SATA controller
arm64: defconfig: Add Renesas R-Car SATA driver for R-Car Gen3 SoCs

Thanks, I have queued up the above three arm64 patches for v4.5. Please send incremental updates if changes need to be made.

The remaining patches, below, can probably be guided into next by Geert.

Quoted 23 lines

Takeshi Kihara (1):
pinctrl: sh-pfc: r8a7795: Add SATA support

Ulrich Hecht (2):
clk: shmobile: r8a7795: Add SATA0 clock
pinctrl: sh-pfc: r8a7795: add SATA0 pin conf to DT

 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 11 ++++++++++
 arch/arm64/boot/dts/renesas/r8a7795.dtsi           |  8 ++++++++
 arch/arm64/configs/defconfig                       |  1 +
 drivers/clk/shmobile/r8a7795-cpg-mssr.c            |  1 +
 drivers/pinctrl/sh-pfc/pfc-r8a7795.c               | 24 ++++++++++++++++++++++
 5 files changed, 45 insertions(+)
Signature · 6 lines
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html