Skip to contentSkip to conversation

rockchip: enable sdcard for firefly-rk3399

PATCH New Kever Yang 4 participants 23 messages Jun 14, 2017 – Jun 25, 2017

Subsystems (3)
lore
Share & tools
lore

Kever Yang

author
#0 lore raw

cover rockchip: enable sdcard for firefly-rk3399

Update rockchip soc mmc dts nodes to use max-frequency instead of clock-min-max.
update mmc driver to use max-frequency when OF_PLATDATA enabled.

Kever Yang (7):
rockchip: rk3036: dtsi use max-frequency for mmc node
rockchip: rk3288: dtsi use max-frequency for mmc node
rockchip: rk3328: dtsi use max-frequency for mmc node
rockchip: dwmmc: use max-frequency when OF_PLATDATA enabled
rockchip: firefly-rk3399: dts: enable sdmmc device
rockchip: firefly-rk3399: enable dwmmc driver for the board Revert "mmc: dw_mmc: rockchip: select proper card clock"

 arch/arm/dts/rk3036.dtsi         | 2 +-
 arch/arm/dts/rk3288.dtsi         | 8 ++++----
 arch/arm/dts/rk3328.dtsi         | 8 ++++----
 arch/arm/dts/rk3399-firefly.dts  | 7 +++++++
 configs/firefly-rk3399_defconfig | 2 +-
 drivers/mmc/rockchip_dw_mmc.c    | 7 ++++---
 6 files changed, 21 insertions(+), 13 deletions(-)
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/7 rockchip: rk3036: dtsi use max-frequency for mmc node

Since the 'clock-freq-min-max' is deprecated, we use max-frequency.

---

 arch/arm/dts/rk3036.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/rk3036.dtsi +1 -1
index 4f44217..ca1d5ac 100644
@@ -244,7 +244,7 @@
 	emmc: dwmmc at 1021c000 {
 		compatible = "rockchip,rk3288-dw-mshc";
 		clock-frequency = <37500000>;
-		clock-freq-min-max = <400000 37500000>;
+		max-frequency = <37500000>;
 		clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>,
 		<&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
Signature · 1 line
1.9.1
author
#4 lore raw

PATCH 2/7 rockchip: rk3288: dtsi use max-frequency for mmc node

In reply to Kever Yang

Since the 'clock-freq-min-max' is deprecated, we use max-frequency.

---

 arch/arm/dts/rk3288.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/dts/rk3288.dtsi +4 -4
index 64aa07d..da51878 100644
@@ -167,7 +167,7 @@
 
 	sdmmc: dwmmc at ff0c0000 {
 		compatible = "rockchip,rk3288-dw-mshc";
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>,
 			 <&cru SCLK_SDMMC_DRV>, <&cru SCLK_SDMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
@@ -179,7 +179,7 @@
 
 	sdio0: dwmmc at ff0d0000 {
 		compatible = "rockchip,rk3288-dw-mshc";
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDIO0>, <&cru SCLK_SDIO0>,
 			 <&cru SCLK_SDIO0_DRV>, <&cru SCLK_SDIO0_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
@@ -191,7 +191,7 @@
 
 	sdio1: dwmmc at ff0e0000 {
 		compatible = "rockchip,rk3288-dw-mshc";
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDIO1>, <&cru SCLK_SDIO1>,
 			 <&cru SCLK_SDIO1_DRV>, <&cru SCLK_SDIO1_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
@@ -203,7 +203,7 @@
 
 	emmc: dwmmc at ff0f0000 {
 		compatible = "rockchip,rk3288-dw-mshc";
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>,
 			 <&cru SCLK_EMMC_DRV>, <&cru SCLK_EMMC_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
Signature · 1 line
1.9.1
author
#7 lore raw

PATCH 3/7 rockchip: rk3328: dtsi use max-frequency for mmc node

In reply to Kever Yang

Since the 'clock-freq-min-max' is deprecated, we use max-frequency.

---

 arch/arm/dts/rk3328.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/dts/rk3328.dtsi +4 -4
index dd9cb1c..215396f 100644
@@ -418,7 +418,7 @@
 	sdmmc: rksdmmc at ff500000 {
 		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xff500000 0x0 0x4000>;
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
 		clock-names = "biu", "ciu";
 		fifo-depth = <0x100>;
@@ -429,7 +429,7 @@
 	sdio: dwmmc at ff510000 {
 		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xff510000 0x0 0x4000>;
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDIO>, <&cru SCLK_SDIO>,
 			 <&cru SCLK_SDIO_DRV>, <&cru SCLK_SDIO_SAMPLE>;
 		clock-names = "biu", "ciu", "ciu_drv", "ciu_sample";
@@ -441,7 +441,7 @@
 	emmc: rksdmmc at ff520000 {
 		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xff520000 0x0 0x4000>;
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_EMMC>, <&cru SCLK_EMMC>;
 		clock-names = "biu", "ciu";
 		fifo-depth = <0x100>;
@@ -466,7 +466,7 @@
 	sdmmc_ext: rksdmmc at ff5f0000 {
 		compatible = "rockchip,rk3328-dw-mshc", "rockchip,rk3288-dw-mshc";
 		reg = <0x0 0xff5f0000 0x0 0x4000>;
-		clock-freq-min-max = <400000 150000000>;
+		max-frequency = <150000000>;
 		clocks = <&cru HCLK_SDMMC>, <&cru SCLK_SDMMC>;
 		clock-names = "biu", "ciu";
 		fifo-depth = <0x100>;
Signature · 1 line
1.9.1
author
#10 lore raw

PATCH 4/7 rockchip: dwmmc: use max-frequency when OF_PLATDATA enabled

In reply to Kever Yang

Since the 'clock-freq-min-max' is deprecated, we use max-frequency for all rockchip SoC dwmmc controller.

---

 drivers/mmc/rockchip_dw_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/rockchip_dw_mmc.c +2 -1
index 25a21e2..7381d7f 100644
@@ -119,7 +119,8 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 	host->dev_index = 0;
 	priv->fifo_depth = dtplat->fifo_depth;
 	priv->fifo_mode = 0;
-	memcpy(priv->minmax, dtplat->clock_freq_min_max, sizeof(priv->minmax));
+	priv->minmax[0] = 400000;  /*  400 kHz */
+	priv->minmax[1] = dtplat->max_frequency;
 
 	ret = clk_get_by_index_platdata(dev, 0, dtplat->clocks, &priv->clk);
 	if (ret < 0)
Signature · 1 line
1.9.1
#11 lore raw

PATCH 4/7 rockchip: dwmmc: use max-frequency when OF_PLATDATA enabled

Quoted 8 lines · Kever Yang

Since the 'clock-freq-min-max' is deprecated, we use max-frequency for all rockchip SoC dwmmc controller.

---

 drivers/mmc/rockchip_dw_mmc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

I wonder that your earlier patches don't cause a build error though.

author
#13 lore raw

PATCH 5/7 rockchip: firefly-rk3399: dts: enable sdmmc device

In reply to Kever Yang

Enable sdmmc device and add the spl boot device sequence.

---

 arch/arm/dts/rk3399-firefly.dts | 7 +++++++
 1 file changed, 7 insertions(+)
arch/arm/dts/rk3399-firefly.dts +7 -0
index edf48fb..91d3193 100644
@@ -16,6 +16,7 @@
 
 	chosen {
 		stdout-path = &uart2;
+		u-boot,spl-boot-order = &sdhci, &sdmmc;
 	};
 
 	backlight: backlight {
@@ -590,6 +591,12 @@
 	status = "okay";
 };
 
+&sdmmc {
+	u-boot,dm-pre-reloc;
+	bus-width = <4>;
+	status = "okay";
+};
+
 &sdhci {
 	bus-width = <8>;
 	keep-power-in-suspend;
Signature · 1 line
1.9.1
author
#16 lore raw

PATCH 6/7 rockchip: firefly-rk3399: enable dwmmc driver for the board

In reply to Kever Yang

Enable mmc_dw_rockchip driver, disable CONFIG_SPL_OF_PLATDATA first for some dependence patches still not merged.

---

 configs/firefly-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/firefly-rk3399_defconfig +1 -1
index 0a4d005..889f3f9 100644
@@ -22,7 +22,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y
@@ -32,6 +31,7 @@ CONFIG_SPL_CLK=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y
Signature · 1 line
1.9.1
#17 lore raw

PATCH 6/7 rockchip: firefly-rk3399: enable dwmmc driver for the board

Quoted 4 lines · Kever Yang

Enable mmc_dw_rockchip driver, disable CONFIG_SPL_OF_PLATDATA first for some dependence patches still not merged.

Tested v2017.07-rc1 with this patch series booting off of microSD on a firefly-rk3399.

Quoted 18 lines

---

 configs/firefly-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
configs/firefly-rk3399_defconfig +0 -1
index 0a4d005..889f3f9 100644
@@ -22,7 +22,6 @@ CONFIG_CMD_USB=y
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
-CONFIG_SPL_OF_PLATDATA=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
 CONFIG_SYSCON=y

configs/firefly-rk3399_defconfig CONFIG_SPL_CLK=y · line 37

Quoted 7 lines
configs/firefly-rk3399_defconfig +1 -0
@@ -32,6 +31,7 @@ CONFIG_SPL_CLK=y
 CONFIG_ROCKCHIP_GPIO=y
 CONFIG_SYS_I2C_ROCKCHIP=y
 CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_ROCKCHIP=y
 CONFIG_DM_ETH=y

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170614/3611f77c/attachment.sig>

#18 lore raw

PATCH 6/7 rockchip: firefly-rk3399: enable dwmmc driver for the board

Quoted 4 lines · Vagrant Cascadian
Quoted 3 lines · Kever Yang

Enable mmc_dw_rockchip driver, disable CONFIG_SPL_OF_PLATDATA first for some dependence patches still not merged.

Quoted 12 lines
Quoted 1 line

Tested v2017.07-rc1 with this patch series booting off of microSD on a firefly-rk3399.

Quoted 5 lines

---

 configs/firefly-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#19 lore raw

PATCH 6/7 rockchip: firefly-rk3399: enable dwmmc driver for the board

In reply to Kever Yang
Quoted 11 lines

Enable mmc_dw_rockchip driver, disable CONFIG_SPL_OF_PLATDATA first for some dependence patches still not merged.

---

 configs/firefly-rk3399_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-rockchip/next, thanks!

author
#20 lore raw

PATCH 7/7 Revert "mmc: dw_mmc: rockchip: select proper card clock"

In reply to Kever Yang

The origin patch get rockchip dwmmc by name 'ciu', which lead to the SPL not able to remove 'clock-names' node in dts. I'm not saying this is not correct, but I would prefer to handle this in dts or clock driver to save memory for SPL. For example the rk3288 SPL size has out of memory if not enable BACK_TO_BROM option, there are many other SoCs has less internal memory than rk3288.

This reverts commit 480a9b834c661fc88217f50bdf780192c3018d66.

---

 drivers/mmc/rockchip_dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/rockchip_dw_mmc.c +2 -2
index 7381d7f..9ef6e82 100644
@@ -44,7 +44,7 @@ static uint rockchip_dwmmc_get_mmc_clk(struct dwmci_host *host, uint freq)
 
 	ret = clk_set_rate(&priv->clk, freq);
 	if (ret < 0) {
-		printf("%s: err=%d\n", __func__, ret);
+		debug("%s: err=%d\n", __func__, ret);
 		return ret;
 	}
 
@@ -126,7 +126,7 @@ static int rockchip_dwmmc_probe(struct udevice *dev)
 	if (ret < 0)
 		return ret;
 #else
-	ret = clk_get_by_name(dev, "ciu", &priv->clk);
+	ret = clk_get_by_index(dev, 0, &priv->clk);
 	if (ret < 0)
 		return ret;
 #endif
Signature · 1 line
1.9.1
#21 lore raw

PATCH 7/7 Revert "mmc: dw_mmc: rockchip: select proper card clock"

Quoted 8 lines · Kever Yang

The origin patch get rockchip dwmmc by name 'ciu', which lead to the SPL not able to remove 'clock-names' node in dts. I'm not saying this is not correct, but I would prefer to handle this in dts or clock driver to save memory for SPL. For example the rk3288 SPL size has out of memory if not enable BACK_TO_BROM option, there are many other SoCs has less internal memory than rk3288.

Quoted 7 lines

This reverts commit 480a9b834c661fc88217f50bdf780192c3018d66.

---

 drivers/mmc/rockchip_dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#22 lore raw

PATCH 7/7 Revert "mmc: dw_mmc: rockchip: select proper card clock"

In reply to Kever Yang
Quoted 8 lines

The origin patch get rockchip dwmmc by name 'ciu', which lead to the SPL not able to remove 'clock-names' node in dts. I'm not saying this is not correct, but I would prefer to handle this in dts or clock driver to save memory for SPL. For example the rk3288 SPL size has out of memory if not enable BACK_TO_BROM option, there are many other SoCs has less internal memory than rk3288.

Quoted 9 lines

This reverts commit 480a9b834c661fc88217f50bdf780192c3018d66.

---

 drivers/mmc/rockchip_dw_mmc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Applied to u-boot-rockchip/next, thanks!