Skip to contentSkip to conversation

socfpga: Enable SD/MMC support

PATCH RESEND Superseded dinguyen at altera.com 2 participants 7 messages Jan 6, 2014 – Jan 8, 2014

Subsystems (7)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover socfpga: Enable SD/MMC support

From: Dinh Nguyen <[email protected]>

RESEND: Apologies, resending to all appropriate ml's.

Hi,

This is v8 of the patch series to enable SD/MMC on the SOCFPGA platform.

V8 differences from v7:

* For the sdmmc_clk's clk-phase binding property, use the actually degree for the clock's phase shift.

Dinh Nguyen (4):
clk: socfpga: Add a clk-phase property to the "altr,socfpga-gate-clk"
dts: socfpga: Add support for SD/MMC on the SOCFPGA platform
mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc
ARM: socfpga_defconfig: enable SD/MMC support

 .../devicetree/bindings/clock/altr_socfpga.txt     |    5 +
 arch/arm/boot/dts/socfpga.dtsi                     |   14 +-
 arch/arm/boot/dts/socfpga_arria5.dtsi              |   11 ++
 arch/arm/boot/dts/socfpga_cyclone5.dtsi            |   11 ++
 arch/arm/boot/dts/socfpga_vt.dts                   |   11 ++
 arch/arm/configs/socfpga_defconfig                 |    2 +
 drivers/clk/socfpga/clk-gate.c                     |   69 ++++++++++
 drivers/mmc/host/Kconfig                           |    8 --
 drivers/mmc/host/dw_mmc-socfpga.c                  |  138 --------------------
 9 files changed, 122 insertions(+), 147 deletions(-)
 delete mode 100644 drivers/mmc/host/dw_mmc-socfpga.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH RESEND v8 1/4 clk: socfpga: Add a clk-phase property to the "altr, socfpga-gate-clk"

From: Dinh Nguyen <[email protected]>

The clk-phase property is used to represent the 2 clock phase values that is needed for the SD/MMC driver. Add a prepare function to the clk_ops, that will use the syscon driver to set sdmmc_clk's phase shift that is located in the system manager.

---
v8: Use degrees in the clk-phase binding property
v7: Add dts property to represent the clk phase of the sdmmc_clk. Add a
prepare function to the gate clk that will toggle clock phase setting. Remove the "altr,socfpga-sdmmc-sdr-clk" clock type.
v6: Add a new clock type "altr,socfpga-sdmmc-sdr-clk" that will be used to
set the phase shift settings.
v5: Use the "snps,dw-mshc" binding
v4: Use the sdmmc_clk prepare function to set the phase shift settings
v3: Not use the syscon driver because as of 3.13-rc1, the syscon driver is
loaded after the clock driver.
v2: Use the syscon driver

---
 .../devicetree/bindings/clock/altr_socfpga.txt     |    5 ++
 arch/arm/boot/dts/socfpga.dtsi                     |    1 +
 drivers/clk/socfpga/clk-gate.c                     |   68 ++++++++++++++++++++
 3 files changed, 74 insertions(+)
Documentation/devicetree/bindings/clock/altr_socfpga.txt +5 -0
index 0045433..5dfd145 100644
@@ -23,3 +23,8 @@ Optional properties:
         and the bit index.
 - div-reg : For "socfpga-gate-clk", div-reg contains the divider register, bit shift,
         and width.
+- clk-phase : For the sdmmc_clk, contains the value of the clock phase that controls
+	the SDMMC CIU clock. The first value is the clk_sample(smpsel), and the second
+	value is the cclk_in_drv(drvsel). The clk-phase is used to enable the correct
+	hold/delay times that is needed for the SD/MMC CIU clock. The values of both
+	can be 0-315 degrees, in 45 degree increments.
arch/arm/boot/dts/socfpga.dtsi +1 -0
index f936476..e776512 100644
@@ -413,6 +413,7 @@
 						compatible = "altr,socfpga-gate-clk";
 						clocks = <&f2s_periph_ref_clk>, <&main_nand_sdmmc_clk>, <&per_nand_mmc_clk>;
 						clk-gate = <0xa0 8>;
+						clk-phase = <0 135>;
 					};
 
 					nand_x_clk: nand_x_clk {
drivers/clk/socfpga/clk-gate.c +68 -0

100 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#2 lore raw

PATCH RESEND v8 2/4 dts: socfpga: Add support for SD/MMC on the SOCFPGA platform

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Use the "snps,dw-mshc" binding to enable the dw_mmc driver. Add the "syscon" binding to the "altr,sys-mgr" node. The clock driver can use the syscon driver to toggle the register for the SD/MMC clock phase shift settings.

---
v8: none
v7: Use the standard "snps,dw-mshc" binding. Remove "altr,socfpga-sdmmc-sdr-clk".
v6: Add documentation for "altr,socfpga-sdmmc-sdr-clk". Add "syscon" to the sysmgr binding.
v5: Use the "snps,dw-mshc" binding
v4: Re-use "rockchip,rk2928-dw-mshc" binding
v3: none
v2: none

---
 arch/arm/boot/dts/socfpga.dtsi          |   13 ++++++++++++-
 arch/arm/boot/dts/socfpga_arria5.dtsi   |   11 +++++++++++
 arch/arm/boot/dts/socfpga_cyclone5.dtsi |   11 +++++++++++
 arch/arm/boot/dts/socfpga_vt.dts        |   11 +++++++++++
 4 files changed, 45 insertions(+), 1 deletion(-)
arch/arm/boot/dts/socfpga.dtsi +12 -1
index e776512..433bfbc 100644
@@ -470,6 +470,17 @@
 			cache-level = <2>;
 		};
 
+		mmc: dwmmc0 at ff704000 {
+			compatible = "snps,dw-mshc";
+			reg = <0xff704000 0x1000>;
+			interrupts = <0 139 4>;
+			fifo-depth = <0x400>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&l4_mp_clk>, <&sdmmc_clk>;
+			clock-names = "biu", "ciu";
+		};
+
 		/* Local timer */
 		timer at fffec600 {
 			compatible = "arm,cortex-a9-twd-timer";
@@ -524,7 +535,7 @@
 		};
 
 		sysmgr at ffd08000 {
-				compatible = "altr,sys-mgr";
+				compatible = "altr,sys-mgr", "syscon";
 				reg = <0xffd08000 0x4000>;
 			};
 	};
arch/arm/boot/dts/socfpga_arria5.dtsi +11 -0
index a85b404..6c87b70 100644
@@ -27,6 +27,17 @@
 			};
 		};
 
+		dwmmc0 at ff704000 {
+			num-slots = <1>;
+			supports-highspeed;
+			broken-cd;
+
+			slot at 0 {
+				reg = <0>;
+				bus-width = <4>;
+			};
+		};
+
 		serial0 at ffc02000 {
 			clock-frequency = <100000000>;
 		};
arch/arm/boot/dts/socfpga_cyclone5.dtsi +11 -0
index a8716f6..ca41b0e 100644
@@ -28,6 +28,17 @@
 			};
 		};
 
+		dwmmc0 at ff704000 {
+			num-slots = <1>;
+			supports-highspeed;
+			broken-cd;
+
+			slot at 0 {
+				reg = <0>;
+				bus-width = <4>;
+			};
+		};
+
 		ethernet at ff702000 {
 			phy-mode = "rgmii";
 			phy-addr = <0xffffffff>; /* probe for phy addr */
arch/arm/boot/dts/socfpga_vt.dts +11 -0
index d1ec0ca..222313f 100644
@@ -41,6 +41,17 @@
 			};
 		};
 
+		dwmmc0 at ff704000 {
+			num-slots = <1>;
+			supports-highspeed;
+			broken-cd;
+
+			slot at 0 {
+				reg = <0>;
+				bus-width = <4>;
+			};
+		};
+
 		ethernet at ff700000 {
 			phy-mode = "gmii";
 			status = "okay";
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH RESEND v8 3/4 mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

It turns now that the only really platform specific code that is needed for SOCFPGA is using the SDMMC_CMD_USE_HOLD_REG in the prepare_command function. Since the Rockchip already has this functionality, re-use the code that is already in dw_mmc-pltfm.c.

---
v8: none
v7: none
v6: none
v5: none
v4: Remove dw_mmc-socfpga platform specific code
v3: none
v2: none

---
 drivers/mmc/host/Kconfig          |    8 ---
 drivers/mmc/host/dw_mmc-socfpga.c |  138 -------------------------------------
 2 files changed, 146 deletions(-)
 delete mode 100644 drivers/mmc/host/dw_mmc-socfpga.c
drivers/mmc/host/Kconfig +0 -8
index 7fc5099..6737a4f 100644
@@ -567,14 +567,6 @@ config MMC_DW_EXYNOS
 	  Synopsys DesignWare Memory Card Interface driver. Select this option
 	  for platforms based on Exynos4 and Exynos5 SoC's.
 
-config MMC_DW_SOCFPGA
-	tristate "SOCFPGA specific extensions for Synopsys DW Memory Card Interface"
-	depends on MMC_DW && MFD_SYSCON
-	select MMC_DW_PLTFM
-	help
-	  This selects support for Altera SoCFPGA specific extensions to the
-	  Synopsys DesignWare Memory Card Interface driver.
-
 config MMC_DW_PCI
 	tristate "Synopsys Designware MCI support on PCI bus"
 	depends on MMC_DW && PCI
drivers/mmc/host/dw_mmc-socfpga.c deleted +0 -138

138 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#4 lore raw

PATCH RESEND v8 3/4 mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc

Quoted 6 lines · dinguyen at altera.com
---
 drivers/mmc/host/Kconfig          |    8 ---
 drivers/mmc/host/dw_mmc-socfpga.c |  138 -------------------------------------
 2 files changed, 146 deletions(-)
 delete mode 100644 drivers/mmc/host/dw_mmc-socfpga.c

Isn't a Makefile affected when you remove a config option and the whole source file which depends on the option? Running

git grep MMC_DW_SOCFPGA

on v3.13-rc7-55-gef350bb7c5e0 suggests that drivers/mmc/host/Makefile needs an update as well.

virtually yours
Gerhard Sittig

Signature · 3 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr. 5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
#5 lore raw

PATCH RESEND v8 3/4 mmc: dw_mmc-socfpga: Remove the SOCFPGA specific platform for dw_mmc

Hi Gerhard,

Quoted 8 lines · Gerhard Sittig
Quoted 6 lines · dinguyen at altera.com
---
 drivers/mmc/host/Kconfig          |    8 ---
 drivers/mmc/host/dw_mmc-socfpga.c |  138 -------------------------------------
 2 files changed, 146 deletions(-)
 delete mode 100644 drivers/mmc/host/dw_mmc-socfpga.c
Quoted 7 lines

Isn't a Makefile affected when you remove a config option and the whole source file which depends on the option? Running

git grep MMC_DW_SOCFPGA

on v3.13-rc7-55-gef350bb7c5e0 suggests that drivers/mmc/host/Makefile needs an update as well.

Yes, thanks for catching that. Will fix in v9.

Dinh

Quoted 4 lines

virtually yours
Gerhard Sittig

#6 lore raw

PATCH RESEND v8 4/4 ARM: socfpga_defconfig: enable SD/MMC support

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Enables the dw_mmc driver for SOCFPGA.

---
v8: none
v7: none
v6: none
v5: Add dw_mmc driver into socfpga_defconfig
v4: none
v3: none
v2: none

---
 arch/arm/configs/socfpga_defconfig |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/socfpga_defconfig +2 -0
index 4e1ce21..8fff96ba 100644
@@ -82,3 +82,5 @@ CONFIG_DEBUG_INFO=y
 CONFIG_ENABLE_DEFAULT_TRACERS=y
 CONFIG_DEBUG_USER=y
 CONFIG_XZ_DEC=y
+CONFIG_MMC=y
+CONFIG_MMC_DW=y
Signature · 1 line
1.7.9.5