[U-Boot] Rockchip RV1108 eMMC support not working

Hi,
We have a custom board based on rv1108 evb where we are trying to add eMMC support.
Here are the changes we made so far:
arch/arm/dts/rv1108-evb.dts | 45 +++++++++++++++++++++++++++++++++++++++++ configs/evb-rv1108_defconfig | 4 ++++ include/configs/evb_rv1108.h | 14 +------------ include/configs/rv1108_common.h | 3 +++ 4 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/arch/arm/dts/rv1108-evb.dts b/arch/arm/dts/rv1108-evb.dts index ccb9969..f07f402 100644 --- a/arch/arm/dts/rv1108-evb.dts +++ b/arch/arm/dts/rv1108-evb.dts @@ -77,3 +77,48 @@ &usb_host_ohci { status = "okay"; }; + +&emmc { + pinctrl-names = "default"; + pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>; + bus-width = <8>; + cap-mmc-highspeed; + supports-emmc; + disable-wp; + non-removable; + num-slots = <1>; + status = "okay"; +}; + +&pinctrl { + pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma { + bias-disable; + drive-strength = <8>; + }; + + pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma { + bias-pull-up; + drive-strength = <8>; + }; + + emmc { + emmc_clk: emmc-clk { + rockchip,pins = <2 RK_PB6 RK_FUNC_1 &pcfg_pull_none_drv_8ma>; + }; + + emmc_cmd: emmc-cmd { + rockchip,pins = <2 RK_PB4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>; + }; + + emmc_bus8: emmc-bus8 { + rockchip,pins = <2 RK_PA0 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA1 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA2 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA3 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA5 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA6 RK_FUNC_2 &pcfg_pull_up_drv_8ma>, + <2 RK_PA7 RK_FUNC_2 &pcfg_pull_up_drv_8ma>; + }; + }; +}; diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig index 2ef041f..6c992c6 100644 --- a/configs/evb-rv1108_defconfig +++ b/configs/evb-rv1108_defconfig @@ -14,10 +14,12 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_RANDOM_UUID=y CONFIG_CMD_SF=y CONFIG_CMD_USB=y +CONFIG_CMD_MMC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_DEFAULT_DEVICE_TREE="rv1108-evb" +CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y CONFIG_SYSCON=y @@ -27,6 +29,8 @@ CONFIG_FASTBOOT_BUF_SIZE=0x08000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_ROCKCHIP_GPIO=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y diff --git a/include/configs/evb_rv1108.h b/include/configs/evb_rv1108.h index 34739c7..aa6c4b0 100644 --- a/include/configs/evb_rv1108.h +++ b/include/configs/evb_rv1108.h @@ -8,18 +8,6 @@
#include <configs/rv1108_common.h>
-/* - * Default environment settings - */ -#define CONFIG_EXTRA_ENV_SETTINGS \ - "netdev=eth0\0" \ - "ipaddr=172.16.12.50\0" \ - "serverip=172.16.12.69\0" \ - "" -#define CONFIG_BOOTCOMMAND \ - "sf probe;" \ - "sf read 0x62000000 0x140800 0x500000;" \ - "dcache off;" \ - "go 0x62000000" +#define CONFIG_SYS_MMC_ENV_DEV 0
#endif diff --git a/include/configs/rv1108_common.h b/include/configs/rv1108_common.h index 2ab3b85..cc0384e 100644 --- a/include/configs/rv1108_common.h +++ b/include/configs/rv1108_common.h @@ -17,6 +17,9 @@ #define CONFIG_SYS_TIMER_BASE 0x10350020 #define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8)
+/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER + #define CONFIG_SYS_SDRAM_BASE 0x60000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0x100000) #define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x2000000)

Hi Otavio: Otavio Salvador otavio.salvador@ossystems.com.br 于2018年10月9日周二 上午3:29写道:
Hi,
We have a custom board based on rv1108 evb where we are trying to add eMMC support.
Here are the changes we made so far:
arch/arm/dts/rv1108-evb.dts | 45 +++++++++++++++++++++++++++++++++++++++++ configs/evb-rv1108_defconfig | 4 ++++ include/configs/evb_rv1108.h | 14 +------------ include/configs/rv1108_common.h | 3 +++ 4 files changed, 53 insertions(+), 13 deletions(-)
diff --git a/arch/arm/dts/rv1108-evb.dts b/arch/arm/dts/rv1108-evb.dts index ccb9969..f07f402 100644 --- a/arch/arm/dts/rv1108-evb.dts +++ b/arch/arm/dts/rv1108-evb.dts @@ -77,3 +77,48 @@ &usb_host_ohci { status = "okay"; };
+&emmc {
- pinctrl-names = "default";
- pinctrl-0 = <&emmc_clk &emmc_cmd &emmc_bus8>;
- bus-width = <8>;
- cap-mmc-highspeed;
- supports-emmc;
- disable-wp;
- non-removable;
- num-slots = <1>;
- status = "okay";
+};
+&pinctrl {
- pcfg_pull_none_drv_8ma: pcfg-pull-none-drv-8ma {
bias-disable;
drive-strength = <8>;
- };
- pcfg_pull_up_drv_8ma: pcfg-pull-up-drv-8ma {
bias-pull-up;
drive-strength = <8>;
- };
- emmc {
emmc_clk: emmc-clk {
rockchip,pins = <2 RK_PB6 RK_FUNC_1 &pcfg_pull_none_drv_8ma>;
};
emmc_cmd: emmc-cmd {
rockchip,pins = <2 RK_PB4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
};
emmc_bus8: emmc-bus8 {
rockchip,pins = <2 RK_PA0 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA1 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA2 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA3 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA4 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA5 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA6 RK_FUNC_2 &pcfg_pull_up_drv_8ma>,
<2 RK_PA7 RK_FUNC_2 &pcfg_pull_up_drv_8ma>;
};
- };
+}; diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig index 2ef041f..6c992c6 100644 --- a/configs/evb-rv1108_defconfig +++ b/configs/evb-rv1108_defconfig @@ -14,10 +14,12 @@ CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_RANDOM_UUID=y CONFIG_CMD_SF=y CONFIG_CMD_USB=y +CONFIG_CMD_MMC=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_DEFAULT_DEVICE_TREE="rv1108-evb" +CONFIG_ENV_IS_IN_MMC=y CONFIG_NET_RANDOM_ETHADDR=y CONFIG_REGMAP=y CONFIG_SYSCON=y @@ -27,6 +29,8 @@ CONFIG_FASTBOOT_BUF_SIZE=0x08000000 CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=1 CONFIG_ROCKCHIP_GPIO=y +CONFIG_MMC_DW=y +CONFIG_MMC_DW_ROCKCHIP=y CONFIG_SYS_I2C_ROCKCHIP=y CONFIG_SPI_FLASH=y CONFIG_SPI_FLASH_BAR=y diff --git a/include/configs/evb_rv1108.h b/include/configs/evb_rv1108.h index 34739c7..aa6c4b0 100644 --- a/include/configs/evb_rv1108.h +++ b/include/configs/evb_rv1108.h @@ -8,18 +8,6 @@
#include <configs/rv1108_common.h>
-/*
- Default environment settings
- */
-#define CONFIG_EXTRA_ENV_SETTINGS \
- "netdev=eth0\0" \
- "ipaddr=172.16.12.50\0" \
- "serverip=172.16.12.69\0" \
- ""
-#define CONFIG_BOOTCOMMAND \
- "sf probe;" \
- "sf read 0x62000000 0x140800 0x500000;" \
- "dcache off;" \
- "go 0x62000000"
+#define CONFIG_SYS_MMC_ENV_DEV 0
#endif diff --git a/include/configs/rv1108_common.h b/include/configs/rv1108_common.h index 2ab3b85..cc0384e 100644 --- a/include/configs/rv1108_common.h +++ b/include/configs/rv1108_common.h @@ -17,6 +17,9 @@ #define CONFIG_SYS_TIMER_BASE 0x10350020 #define CONFIG_SYS_TIMER_COUNTER (CONFIG_SYS_TIMER_BASE + 8)
+/* MMC/SD IP block */ +#define CONFIG_BOUNCE_BUFFER
#define CONFIG_SYS_SDRAM_BASE 0x60000000 #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE + 0x100000)
#define CONFIG_SYS_LOAD_ADDR (CONFIG_SYS_SDRAM_BASE + 0x2000000)
2.7.4
With this change the eMMC driver is loaded:
U-Boot 2018.11-rc1-00097-ge89d583-dirty (Oct 08 2018 - 16:11:40 -0300)
Model: Rockchip RV1108 Evaluation board DRAM: 128 MiB APLL: 600000000 DPLL:1200000000 GPLL:384000000 MMC: dwmmc@30110000: 0 Loading Environment from MMC... *** Warning - bad CRC, using default environment
In: serial@10210000 Out: serial@10210000 Err: serial@10210000 Model: Rockchip RV1108 Evaluation board Net: Warning: ethernet@30200000 (eth0) using random MAC address - 5a:d2:06:ad:9e:ee eth0: ethernet@30200000 =>
and we can also check the 'mmc info' command:
=> mmc info Device: dwmmc@30110000 Manufacturer ID: 70 OEM: 100 Name: M6270 Bus Speed: 52000000 Mode : MMC High Speed (52MHz) Rd Block Len: 512 MMC version 5.1 High Capacity: Yes Capacity: 3.5 GiB Bus Width: 8-bit Erase Group Size: 512 KiB HC WP Group Size: 8 MiB User Capacity: 3.5 GiB WRREL Boot Capacity: 2 MiB ENH RPMB Capacity: 512 KiB ENH
I don't have a 1108 board with emmc on my hand.
the mmc info show that the eMMC has been detected. So would try other mmc commands such as: mmc read/write ?
but we are not able to save the environment to the eMMC card:
=> saveenv Saving Environment to MMC... Writing to MMC(0)... failed Failed (1)
Maybe you need a deeper dig to find the point where the error happen
=>
Any ideas?
-- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hello Andy,
On Mon, Oct 8, 2018 at 11:03 PM Andy Yan andyshrk@gmail.com wrote:
Otavio Salvador otavio.salvador@ossystems.com.br 于2018年10月9日周二 上午3:29写道: I don't have a 1108 board with emmc on my hand.
the mmc info show that the eMMC has been detected. So would try other mmc commands such as: mmc read/write ?
=> mmc read 0x62000000 0 0x10 MMC read: dev # 0, block # 0, count 16 ... 0 blocks read: ERROR
=> saveenv Saving Environment to MMC... Writing to MMC(0)... failed Failed (1)
Maybe you need a deeper dig to find the point where the error happen
Any suggestion about what I might try to debug?

Hi Otavio: I sent a mmc patch to you which I got from vincent, please have a try.
Otavio Salvador otavio.salvador@ossystems.com.br 于2018年10月9日周二 上午10:21写道:
Hello Andy,
On Mon, Oct 8, 2018 at 11:03 PM Andy Yan andyshrk@gmail.com wrote:
Otavio Salvador otavio.salvador@ossystems.com.br 于2018年10月9日周二
上午3:29写道:
I don't have a 1108 board with emmc on my hand.
the mmc info show that the eMMC has been detected. So would try other mmc commands such as: mmc read/write ?
=> mmc read 0x62000000 0 0x10 MMC read: dev # 0, block # 0, count 16 ... 0 blocks read: ERROR
=> saveenv Saving Environment to MMC... Writing to MMC(0)... failed Failed (1)
Maybe you need a deeper dig to find the point where the error happen
Any suggestion about what I might try to debug?
-- Otavio Salvador O.S. Systems http://www.ossystems.com.br http://code.ossystems.com.br Mobile: +55 (53) 9 9981-7854 Mobile: +1 (347) 903-9750
participants (2)
-
Andy Yan
-
Otavio Salvador