Skip to contentSkip to conversation

ARM: sofpga: Add SD/MMC, clk-gate, and fix ethernet bindings

PATCH Superseded dinguyen at altera.com 3 participants 14 messages Jun 5, 2013 – Jun 12, 2013

Subsystems (9)

v6 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v6 cover ARM: sofpga: Add SD/MMC, clk-gate, and fix ethernet bindings

From: Dinh Nguyen <[email protected]>

Hi Arnd/Olof,

Can you please apply this patch series? Patch 3/6 has gotten Mike Turquette's Ack. The SD/MMC patches have been reviewed by Seungwon Jeon, Jaehoon Chung and Arnd.

Sorry, forgot to cc Arnd/Olof directly.

Thanks,
Dinh

CC Arnd Bergmann <[email protected]>
CC Olof Johansson <[email protected]>

Dinh Nguyen (6):
ARM: socfpga: dts: Add ethernet bindings for SOCFPGA
ARM: socfpga: dts: Add gate-clock bindings
ARM: socfpga: Add support to gate peripheral clocks
ARM: socfpga: Add syscon to be part of socfpga
ARM: socfpga: dts: Add support for SD/MMC
mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

 .../devicetree/bindings/clock/altr_socfpga.txt     |    7 +
 .../devicetree/bindings/mmc/socfpga-dw-mshc.txt    |   60 +++++
 arch/arm/boot/dts/socfpga.dtsi                     |  230 +++++++++++++++++++-
 arch/arm/boot/dts/socfpga_cyclone5.dts             |   26 +++
 arch/arm/boot/dts/socfpga_vt.dts                   |   17 ++
 arch/arm/mach-socfpga/Kconfig                      |    1 +
 drivers/clk/socfpga/clk.c                          |  194 ++++++++++++++++-
 drivers/mmc/host/Kconfig                           |    8 +
 drivers/mmc/host/Makefile                          |    1 +
 drivers/mmc/host/dw_mmc-exynos.c                   |    2 -
 drivers/mmc/host/dw_mmc-socfpga.c                  |  138 ++++++++++++
 drivers/mmc/host/dw_mmc.h                          |    1 +
 12 files changed, 671 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/socfpga-dw-mshc.txt
 create mode 100644 drivers/mmc/host/dw_mmc-socfpga.c
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v6 1/6 ARM: socfpga: dts: Add ethernet bindings for SOCFPGA

From: Dinh Nguyen <[email protected]>

Add entry for 2nd GMAC controller. Add the correct clocks for the GMAC.

v2:
- Moved "disabled" status to dtsi file

---
 arch/arm/boot/dts/socfpga.dtsi         |   18 ++++++++++++++++--
 arch/arm/boot/dts/socfpga_cyclone5.dts |   13 +++++++++++++
 arch/arm/boot/dts/socfpga_vt.dts       |    5 +++++
 3 files changed, 34 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +16 -2
index 16a6e13..02bb425 100644
@@ -23,6 +23,7 @@
 
 	aliases {
 		ethernet0 = &gmac0;
+		ethernet1 = &gmac1;
 		serial0 = &uart0;
 		serial1 = &uart1;
 		timer0 = &timer0;
@@ -238,13 +239,26 @@
 				};
 			};
 
-		gmac0: stmmac at ff700000 {
+		gmac0: ethernet at ff700000 {
 			compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
 			reg = <0xff700000 0x2000>;
 			interrupts = <0 115 4>;
 			interrupt-names = "macirq";
 			mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
-			phy-mode = "gmii";
+			clocks = <&emac0_clk>;
+			clock-names = "stmmaceth";
+			status = "disabled";
+		};
+
+		gmac1: ethernet at ff702000 {
+			compatible = "altr,socfpga-stmmac", "snps,dwmac-3.70a", "snps,dwmac";
+			reg = <0xff702000 0x2000>;
+			interrupts = <0 120 4>;
+			interrupt-names = "macirq";
+			mac-address = [00 00 00 00 00 00];/* Filled in by U-Boot */
+			clocks = <&emac1_clk>;
+			clock-names = "stmmaceth";
+			status = "disabled";
 		};
 
 		L2: l2-cache at fffef000 {
arch/arm/boot/dts/socfpga_cyclone5.dts +13 -0
index 2495958..973999d 100644
@@ -32,6 +32,13 @@
 		reg = <0x0 0x40000000>; /* 1GB */
 	};
 
+	aliases {
+		/* this allow the ethaddr uboot environmnet variable contents
+		 * to be added to the gmac1 device tree blob.
+		 */
+		ethernet0 = &gmac1;
+	};
+
 	soc {
 		clkmgr at ffd04000 {
 			clocks {
@@ -41,6 +48,12 @@
 			};
 		};
 
+		ethernet at ff702000 {
+			phy-mode = "rgmii";
+			phy-addr = <0xffffffff>; /* probe for phy addr */
+			status = "okay";
+		};
+
 		timer0 at ffc08000 {
 			clock-frequency = <100000000>;
 		};
arch/arm/boot/dts/socfpga_vt.dts +5 -0
index 0bf035d..d1ec0ca 100644
@@ -41,6 +41,11 @@
 			};
 		};
 
+		ethernet at ff700000 {
+			phy-mode = "gmii";
+			status = "okay";
+		};
+
 		timer0 at ffc08000 {
 			clock-frequency = <7000000>;
 		};
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v6 2/6 ARM: socfpga: dts: Add gate-clock bindings

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add bindings for "socfpga-gate-clk" clocks. These clocks directly feed the peripherals.

---
 .../devicetree/bindings/clock/altr_socfpga.txt     |    7 +
 arch/arm/boot/dts/socfpga.dtsi                     |  199 ++++++++++++++++++++
 2 files changed, 206 insertions(+)
Documentation/devicetree/bindings/clock/altr_socfpga.txt +7 -0
index bd0c841..0045433 100644
@@ -9,6 +9,9 @@ Required properties:
 	"altr,socfpga-pll-clock" - for a PLL clock
 	"altr,socfpga-perip-clock" - The peripheral clock divided from the
 		PLL clock.
+	"altr,socfpga-gate-clk" - Clocks that directly feed peripherals and
+		can get gated.
+
 - reg : shall be the control register offset from CLOCK_MANAGER's base for the clock.
 - clocks : shall be the input parent clock phandle for the clock. This is
 	either an oscillator or a pll output.
@@ -16,3 +19,7 @@ Required properties:
 
 Optional properties:
 - fixed-divider : If clocks have a fixed divider value, use this property.
+- clk-gate : For "socfpga-gate-clk", clk-gate contains the gating register
+        and the bit index.
+- div-reg : For "socfpga-gate-clk", div-reg contains the divider register, bit shift,
+        and width.
arch/arm/boot/dts/socfpga.dtsi +199 -0

211 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#3 lore raw

PATCH v6 3/6 ARM: socfpga: Add support to gate peripheral clocks

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add support to gate the clocks that directly feed peripherals. For clocks with multiple parents, add the ability to determine the correct parent, and also set parents. Also add support to calculate and set the clocks' rate.

v4:
- Add Acked-by: Mike Turquette

v3:
- Addressed comments from Pavel

v2:
- Fix space/indent errors
- Add streq for strcmp == 0

---
 drivers/clk/socfpga/clk.c |  194 ++++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 185 insertions(+), 9 deletions(-)
drivers/clk/socfpga/clk.c +185 -9
index bd11315..5bb848c 100644
@@ -24,15 +24,17 @@
 #include <linux/of.h>
 
 /* Clock Manager offsets */
-#define CLKMGR_CTRL    0x0
-#define CLKMGR_BYPASS 0x4
+#define CLKMGR_CTRL	0x0
+#define CLKMGR_BYPASS	0x4
+#define CLKMGR_L4SRC	0x70
+#define CLKMGR_PERPLL_SRC	0xAC
 
 /* Clock bypass bits */
-#define MAINPLL_BYPASS (1<<0)
-#define SDRAMPLL_BYPASS (1<<1)
-#define SDRAMPLL_SRC_BYPASS (1<<2)
-#define PERPLL_BYPASS (1<<3)
-#define PERPLL_SRC_BYPASS (1<<4)
+#define MAINPLL_BYPASS		(1<<0)
+#define SDRAMPLL_BYPASS		(1<<1)
+#define SDRAMPLL_SRC_BYPASS	(1<<2)
+#define PERPLL_BYPASS		(1<<3)
+#define PERPLL_SRC_BYPASS	(1<<4)
 
 #define SOCFPGA_PLL_BG_PWRDWN		0
 #define SOCFPGA_PLL_EXT_ENA		1
@@ -41,6 +43,17 @@
 #define SOCFPGA_PLL_DIVF_SHIFT	3
 #define SOCFPGA_PLL_DIVQ_MASK		0x003F0000
 #define SOCFPGA_PLL_DIVQ_SHIFT	16
+#define SOCFGPA_MAX_PARENTS	3
+
+#define SOCFPGA_L4_MP_CLK		"l4_mp_clk"
+#define SOCFPGA_L4_SP_CLK		"l4_sp_clk"
+#define SOCFPGA_NAND_CLK		"nand_clk"
+#define SOCFPGA_NAND_X_CLK		"nand_x_clk"
+#define SOCFPGA_MMC_CLK			"mmc_clk"
+#define SOCFPGA_DB_CLK			"gpio_db_clk"
+
+#define div_mask(width)	((1 << (width)) - 1)
+#define streq(a, b) (strcmp((a), (b)) == 0)
 
 extern void __iomem *clk_mgr_base_addr;
 
@@ -49,6 +62,9 @@ struct socfpga_clk {
 	char *parent_name;
 	char *clk_name;
 	u32 fixed_div;
+	void __iomem *div_reg;
+	u32 width;	/* only valid if div_reg != 0 */
+	u32 shift;	/* only valid if div_reg != 0 */
 };
 #define to_socfpga_clk(p) container_of(p, struct socfpga_clk, hw.hw)
 
@@ -132,8 +148,9 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
 
 	socfpga_clk->hw.hw.init = &init;
 
-	if (strcmp(clk_name, "main_pll") || strcmp(clk_name, "periph_pll") ||
-			strcmp(clk_name, "sdram_pll")) {
+	if (streq(clk_name, "main_pll") ||
+		streq(clk_name, "periph_pll") ||
+		streq(clk_name, "sdram_pll")) {
 		socfpga_clk->hw.bit_idx = SOCFPGA_PLL_EXT_ENA;
 		clk_pll_ops.enable = clk_gate_ops.enable;
 		clk_pll_ops.disable = clk_gate_ops.disable;
@@ -148,6 +165,159 @@ static __init struct clk *socfpga_clk_init(struct device_node *node,
 	return clk;
 }
 
+static u8 socfpga_clk_get_parent(struct clk_hw *hwclk)
+{
+	u32 l4_src;
+	u32 perpll_src;
+
+	if (streq(hwclk->init->name, SOCFPGA_L4_MP_CLK)) {
+		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
+		return l4_src &= 0x1;
+	}
+	if (streq(hwclk->init->name, SOCFPGA_L4_SP_CLK)) {
+		l4_src = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
+		return !!(l4_src & 2);
+	}
+
+	perpll_src = readl(clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
+	if (streq(hwclk->init->name, SOCFPGA_MMC_CLK))
+		return perpll_src &= 0x3;
+	if (streq(hwclk->init->name, SOCFPGA_NAND_CLK) ||
+			streq(hwclk->init->name, SOCFPGA_NAND_X_CLK))
+			return (perpll_src >> 2) & 3;
+
+	/* QSPI clock */
+	return (perpll_src >> 4) & 3;
+
+}
+
+static int socfpga_clk_set_parent(struct clk_hw *hwclk, u8 parent)
+{
+	u32 src_reg;
+
+	if (streq(hwclk->init->name, SOCFPGA_L4_MP_CLK)) {
+		src_reg = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
+		src_reg &= ~0x1;
+		src_reg |= parent;
+		writel(src_reg, clk_mgr_base_addr + CLKMGR_L4SRC);
+	} else if (streq(hwclk->init->name, SOCFPGA_L4_SP_CLK)) {
+		src_reg = readl(clk_mgr_base_addr + CLKMGR_L4SRC);
+		src_reg &= ~0x2;
+		src_reg |= (parent << 1);
+		writel(src_reg, clk_mgr_base_addr + CLKMGR_L4SRC);
+	} else {
+		src_reg = readl(clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
+		if (streq(hwclk->init->name, SOCFPGA_MMC_CLK)) {
+			src_reg &= ~0x3;
+			src_reg |= parent;
+		} else if (streq(hwclk->init->name, SOCFPGA_NAND_CLK) ||
+			streq(hwclk->init->name, SOCFPGA_NAND_X_CLK)) {
+			src_reg &= ~0xC;
+			src_reg |= (parent << 2);
+		} else {/* QSPI clock */
+			src_reg &= ~0x30;
+			src_reg |= (parent << 4);
+		}
+		writel(src_reg, clk_mgr_base_addr + CLKMGR_PERPLL_SRC);
+	}
+
+	return 0;
+}
+
+static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
+	unsigned long parent_rate)
+{
+	struct socfpga_clk *socfpgaclk = to_socfpga_clk(hwclk);
+	u32 div = 1, val;
+
+	if (socfpgaclk->fixed_div)
+		div = socfpgaclk->fixed_div;
+	else if (socfpgaclk->div_reg) {
+		val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
+		val &= div_mask(socfpgaclk->width);
+		if (streq(hwclk->init->name, SOCFPGA_DB_CLK))
+			div = val + 1;
+		else
+			div = (1 << val);
+	}
+
+	return parent_rate / div;
+}
+
+static struct clk_ops gateclk_ops = {
+	.recalc_rate = socfpga_clk_recalc_rate,
+	.get_parent = socfpga_clk_get_parent,
+	.set_parent = socfpga_clk_set_parent,
+};
+
+static void __init socfpga_gate_clk_init(struct device_node *node,
+	const struct clk_ops *ops)
+{
+	u32 clk_gate[2];
+	u32 div_reg[3];
+	u32 fixed_div;
+	struct clk *clk;
+	struct socfpga_clk *socfpga_clk;
+	const char *clk_name = node->name;
+	const char *parent_name[SOCFGPA_MAX_PARENTS];
+	struct clk_init_data init;
+	int rc;
+	int i = 0;
+
+	socfpga_clk = kzalloc(sizeof(*socfpga_clk), GFP_KERNEL);
+	if (WARN_ON(!socfpga_clk))
+		return;
+
+	rc = of_property_read_u32_array(node, "clk-gate", clk_gate, 2);
+	if (rc)
+		clk_gate[0] = 0;
+
+	if (clk_gate[0]) {
+		socfpga_clk->hw.reg = clk_mgr_base_addr + clk_gate[0];
+		socfpga_clk->hw.bit_idx = clk_gate[1];
+
+		gateclk_ops.enable = clk_gate_ops.enable;
+		gateclk_ops.disable = clk_gate_ops.disable;
+	}
+
+	rc = of_property_read_u32(node, "fixed-divider", &fixed_div);
+	if (rc)
+		socfpga_clk->fixed_div = 0;
+	else
+		socfpga_clk->fixed_div = fixed_div;
+
+	rc = of_property_read_u32_array(node, "div-reg", div_reg, 3);
+	if (!rc) {
+		socfpga_clk->div_reg = clk_mgr_base_addr + div_reg[0];
+		socfpga_clk->shift = div_reg[1];
+		socfpga_clk->width = div_reg[2];
+	} else {
+		socfpga_clk->div_reg = 0;
+	}
+
+	of_property_read_string(node, "clock-output-names", &clk_name);
+
+	init.name = clk_name;
+	init.ops = ops;
+	init.flags = 0;
+	while (i < SOCFGPA_MAX_PARENTS && (parent_name[i] =
+			of_clk_get_parent_name(node, i)) != NULL)
+		i++;
+
+	init.parent_names = parent_name;
+	init.num_parents = i;
+	socfpga_clk->hw.hw.init = &init;
+
+	clk = clk_register(NULL, &socfpga_clk->hw.hw);
+	if (WARN_ON(IS_ERR(clk))) {
+		kfree(socfpga_clk);
+		return;
+	}
+	rc = of_clk_add_provider(node, of_clk_src_simple_get, clk);
+	if (WARN_ON(rc))
+		return;
+}
+
 static void __init socfpga_pll_init(struct device_node *node)
 {
 	socfpga_clk_init(node, &clk_pll_ops);
@@ -160,6 +330,12 @@ static void __init socfpga_periph_init(struct device_node *node)
 }
 CLK_OF_DECLARE(socfpga_periph, "altr,socfpga-perip-clk", socfpga_periph_init);
 
+static void __init socfpga_gate_init(struct device_node *node)
+{
+	socfpga_gate_clk_init(node, &gateclk_ops);
+}
+CLK_OF_DECLARE(socfpga_gate, "altr,socfpga-gate-clk", socfpga_gate_init);
+
 void __init socfpga_init_clocks(void)
 {
 	struct clk *clk;
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v6 4/6 ARM: socfpga: Add syscon to be part of socfpga

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

SOCFPGA has a system manager register block can be accessed by using the syscon driver.

Cc Pavel Machek <[email protected]>
Cc Arnd Bergmann <[email protected]>
Cc Olof Johansson <[email protected]>
---
 arch/arm/mach-socfpga/Kconfig |    1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-socfpga/Kconfig +1 -0
index 566e804..07dff6f 100644
@@ -13,5 +13,6 @@ config ARCH_SOCFPGA
 	select GPIO_PL061 if GPIOLIB
 	select HAVE_ARM_SCU
 	select HAVE_SMP
+	select MFD_SYSCON
 	select SPARSE_IRQ
 	select USE_OF
Signature · 1 line
1.7.9.5
#5 lore raw

PATCH v6 4/6 ARM: socfpga: Add syscon to be part of socfpga

Quoted 6 lines · dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

SOCFPGA has a system manager register block can be accessed by using the syscon driver.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#6 lore raw

PATCH v6 5/6 ARM: socfpga: dts: Add support for SD/MMC

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add bindings for SD/MMC for SOCFPGA.
Add "syscon" to the "altr,sys-mgr" binding.

v2:
- Add "syscon" to "altr,sys-mgr"
- Remove pwr-en field

---
 .../devicetree/bindings/mmc/socfpga-dw-mshc.txt    |   60 ++++++++++++++++++++
 arch/arm/boot/dts/socfpga.dtsi                     |   13 ++++-
 arch/arm/boot/dts/socfpga_cyclone5.dts             |   13 +++++
 arch/arm/boot/dts/socfpga_vt.dts                   |   12 ++++
 4 files changed, 97 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mmc/socfpga-dw-mshc.txt
Documentation/devicetree/bindings/mmc/socfpga-dw-mshc.txt new file +60 -0
new file mode 100644
index 0000000..9d7062c
@@ -0,0 +1,60 @@
+* Altera SOCFPGA specific extensions to the Synopsis Designware Mobile
+  Storage Host Controller
+
+Required Properties:
+
+* compatible: should be
+	- "altr,socfpga-dw-mshc": for controllers with Altera SOCFPGA
+	  specific extentions.
+
+* altr,dw-mshc-ciu-div: Specifies the divider value for the card interface
+  unit (ciu) clock. The value should be (n-1). For Altera's SOCFPGA, the divider
+  value is fixed at 3, which mean parent_clock/4.
+
+* altr,dw-mshc-sdr-timing: Specifies the value of CIU clock phase shift value
+  in transmit mode and CIU clock phase shift value in receive mode for single
+  data rate mode operation. Refer notes below for the order of the cells and the
+  valid values.
+
+  Notes for the sdr-timing values:
+
+    The order of the cells should be
+      - First Cell: CIU clock phase shift value for RX mode, smplsel bits in
+	the system manager SDMMC control group.
+      - Second Cell: CIU clock phase shift value for TX mode, drvsel bits in
+	the system manager SDMMC control group.
+
+    Valid values for SDR CIU clock timing for SOCFPGA:
+      - valid value for tx phase shift and rx phase shift is 0 to 7.
+
+Required properties for a slot:
+
+* bus-width: Data width for card slot. 4-bit or 8-bit data.
+
+Example:
+
+  The MSHC controller node can be split into two portions, SoC specific and
+  board specific portions as listed below.
+
+	dwmmc0 at ff704000 {
+		compatible = "altr,socfpga-dw-mshc";
+		reg = <0xff704000 0x1000>;
+		interrupts = <0 139 4>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+	};
+
+	dwmmc0 at ff704000 {
+		num-slots = <1>;
+		supports-highspeed;
+		broken-cd;
+		fifo-depth = <0x400>;
+		altr,dw-mshc-ciu-div = <3>;
+      		altr,dw-mshc-sdr-timing = <0 3>;
+
+		slot at 0 {
+			reg = <0>;
+			bus-width = <4>;
+		};
+	};
+
arch/arm/boot/dts/socfpga.dtsi +12 -1
index bee62a2..dbf7f22 100644
@@ -468,6 +468,17 @@
 			cache-level = <2>;
 		};
 
+		mmc: dwmmc0 at ff704000 {
+			compatible = "altr,socfpga-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";
@@ -521,7 +532,7 @@
 			};
 
 		sysmgr at ffd08000 {
-				compatible = "altr,sys-mgr";
+				compatible = "altr,sys-mgr", "syscon";
 				reg = <0xffd08000 0x4000>;
 			};
 	};
arch/arm/boot/dts/socfpga_cyclone5.dts +13 -0
index 973999d..1853cb1 100644
@@ -54,6 +54,19 @@
 			status = "okay";
 		};
 
+		dwmmc0 at ff704000 {
+			num-slots = <1>;
+			supports-highspeed;
+			broken-cd;
+			altr,dw-mshc-ciu-div = <3>;
+			altr,dw-mshc-sdr-timing = <0 3>;
+
+			slot at 0 {
+				reg = <0>;
+				bus-width = <4>;
+			};
+		};
+
 		timer0 at ffc08000 {
 			clock-frequency = <100000000>;
 		};
arch/arm/boot/dts/socfpga_vt.dts +12 -0
index d1ec0ca..d93deb0 100644
@@ -46,6 +46,18 @@
 			status = "okay";
 		};
 
+		dwmmc0 at ff704000 {
+			num-slots = <1>;
+			supports-highspeed;
+			broken-cd;
+			altr,dw-mshc-ciu-div = <3>;
+
+			slot at 0 {
+				reg = <0>;
+				bus-width = <4>;
+			};
+		};
+
 		timer0 at ffc08000 {
 			clock-frequency = <7000000>;
 		};
Signature · 1 line
1.7.9.5
#7 lore raw

PATCH v6 5/6 ARM: socfpga: dts: Add support for SD/MMC

Hi,

Quoted 11 lines · dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add bindings for SD/MMC for SOCFPGA.
Add "syscon" to the "altr,sys-mgr" binding.

This looks reasonable to me, but you should always cc bindings updates like these both to the devicetree-discuss mailing list and Rob Herring/Grant Likely, and in this case since it's for MMC bindings, the linux-mmc list should also be on cc.

-Olof

#8 lore raw

PATCH v6 6/6 mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

In reply to dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define.

CC Seungwon Jeon <[email protected]>
CC Jaehoon Chung <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Olof Johansson <[email protected]>
CC Pavel Machek <[email protected]>

v4:
- Fix up SYSMGR_SDMMC_CTRL_SET macro

v3:
- Addressed comments from Seugwon, Jaehoon, and Pavel
- Use clk_disable_unprepare/clk_prepare_enable

v2:
- Use syscon and regmap
- Avoid divide by zero
- Remove the need to set PWR_EN

---
 drivers/mmc/host/Kconfig          |    8 +++
 drivers/mmc/host/Makefile         |    1 +
 drivers/mmc/host/dw_mmc-exynos.c  |    2 -
 drivers/mmc/host/dw_mmc-socfpga.c |  138 +++++++++++++++++++++++++++++++++++++
 drivers/mmc/host/dw_mmc.h         |    1 +
 5 files changed, 148 insertions(+), 2 deletions(-)
 create mode 100644 drivers/mmc/host/dw_mmc-socfpga.c
drivers/mmc/host/Kconfig +8 -0
index 9ab8f8d..1be2289 100644
@@ -556,6 +556,14 @@ 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
+	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/Makefile +1 -0
index cd32280..67718c1 100644
@@ -42,6 +42,7 @@ obj-$(CONFIG_SDH_BFIN)		+= bfin_sdh.o
 obj-$(CONFIG_MMC_DW)		+= dw_mmc.o
 obj-$(CONFIG_MMC_DW_PLTFM)	+= dw_mmc-pltfm.o
 obj-$(CONFIG_MMC_DW_EXYNOS)	+= dw_mmc-exynos.o
+obj-$(CONFIG_MMC_DW_SOCFPGA)	+= dw_mmc-socfpga.o
 obj-$(CONFIG_MMC_DW_PCI)	+= dw_mmc-pci.o
 obj-$(CONFIG_MMC_SH_MMCIF)	+= sh_mmcif.o
 obj-$(CONFIG_MMC_JZ4740)	+= jz4740_mmc.o
drivers/mmc/host/dw_mmc-exynos.c +0 -2
index f013e7e..866edef 100644
@@ -31,8 +31,6 @@
 					SDMMC_CLKSEL_CCLK_DRIVE(y) |	\
 					SDMMC_CLKSEL_CCLK_DIVIDER(z))
 
-#define SDMMC_CMD_USE_HOLD_REG		BIT(29)
-
 #define EXYNOS4210_FIXED_CIU_CLK_DIV	2
 #define EXYNOS4412_FIXED_CIU_CLK_DIV	4
 
drivers/mmc/host/dw_mmc-socfpga.c new file +138 -0

138 lines not on this page · raw message

drivers/mmc/host/dw_mmc.h +1 -0
index 0b74189..3700cb2 100644
@@ -111,6 +111,7 @@
 #define SDMMC_INT_ERROR			0xbfc2
 /* Command register defines */
 #define SDMMC_CMD_START			BIT(31)
+#define SDMMC_CMD_USE_HOLD_REG	BIT(29)
 #define SDMMC_CMD_CCS_EXP		BIT(23)
 #define SDMMC_CMD_CEATA_RD		BIT(22)
 #define SDMMC_CMD_UPD_CLK		BIT(21)
Signature · 1 line
1.7.9.5
#9 lore raw

PATCH v6 6/6 mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

Hi!

Quoted 7 lines

From: Dinh Nguyen <[email protected]>

Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define.

Thanks!
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#10 lore raw

PATCH v6 6/6 mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

In reply to dinguyen at altera.com

Hi,

Quoted 6 lines · On Wed, Jun 05, 2013 at 10:02:58AM -0500, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define.

Quoted 7 lines
CC Seungwon Jeon <[email protected]>
CC Jaehoon Chung <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Olof Johansson <[email protected]>
CC Pavel Machek <[email protected]>

This one should be sent to (and applied by) Chris Ball, the MMC maintainer. The driver is standalone and can go in independently on the platform code that will configure it, so he can merge it without dependencies.

-Olof

#11 lore raw

PATCH v6 6/6 mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

Hi Olof,

Quoted 17 lines · Olof Johansson

Hi,

Quoted 6 lines · On Wed, Jun 05, 2013 at 10:02:58AM -0500, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define.

Quoted 7 lines
CC Seungwon Jeon <[email protected]>
CC Jaehoon Chung <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Olof Johansson <[email protected]>
CC Pavel Machek <[email protected]>
Quoted 5 lines

This one should be sent to (and applied by) Chris Ball, the MMC maintainer. The driver is standalone and can go in independently on the platform code that will configure it, so he can merge it without dependencies.

Thanks Olof. I will send to Chris Ball. I kinda thought that since Jaehoon and Seungwon were maintainers of the dw_mmc driver that I didn't need to send to Chris.

Dinh

Quoted 4 lines

-Olof

#12 lore raw

PATCH v6 6/6 mmc: dw_mmc: Add support DW SD/MMC driver on SOCFPGA

Quoted 22 lines · Dinh Nguyen

Hi Olof,

Quoted 19 lines · Olof Johansson

Hi,

Quoted 6 lines · On Wed, Jun 05, 2013 at 10:02:58AM -0500, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

Add platform specific functionality for the DW SD/MMC driver for SoCFPGA. Move SDMMC_CMD_USE_HOLD_REG to dw_mmc.h so other platforms can use this define.

Quoted 7 lines
CC Seungwon Jeon <[email protected]>
CC Jaehoon Chung <[email protected]>
CC Arnd Bergmann <[email protected]>
CC Olof Johansson <[email protected]>
CC Pavel Machek <[email protected]>
Quoted 7 lines
Quoted 3 lines

This one should be sent to (and applied by) Chris Ball, the MMC maintainer. The driver is standalone and can go in independently on the platform code that will configure it, so he can merge it without dependencies.

Thanks Olof. I will send to Chris Ball. I kinda thought that since Jaehoon and Seungwon were maintainers of the dw_mmc driver that I didn't need to send to Chris.

Ah, no, it should probably go up through his tree in this case. It's still good to have their Acked-by though, since they know the details of the DW side.

-Olof

#13 lore raw

v6 cover ARM: sofpga: Add SD/MMC, clk-gate, and fix ethernet bindings

In reply to dinguyen at altera.com
Quoted 8 lines · dinguyen at altera.com

From: Dinh Nguyen <[email protected]>

Hi Arnd/Olof,

Can you please apply this patch series? Patch 3/6 has gotten Mike Turquette's Ack. The SD/MMC patches have been reviewed by Seungwon Jeon, Jaehoon Chung and Arnd.

Sorry, forgot to cc Arnd/Olof directly.

Hi,

I have applied patches 1-4, the first two to next/dt, the latter to next/soc.

See comments on patch 5 and 6. I don't expect either to be controversial, but please repost them with the needed cc:s just in case -- there's still some time to get it in for 3.11. In particular patch 6 should be applied by Chris Ball to the MMC tree.

-Olof