[PATCH v4 0/6] Add MMC/SD support for S700/S900
Amit Singh Tomar
atomar25opensource at gmail.com
Sun Nov 28 12:32:19 CET 2021
Hi,
Sorry, it took me some time to come up with v4. For v3, all the
comments are from MMC driver(patch 5/6), and tried to address in
this series(v4) with changelog mentioned in the patch (5/6)
itself.
--------------------------------------------------------
This series(v3) addresses review comments provided by Andre and Jaehoon. Earlier
in MMC driver, we were *not* checking the command response errors(for instance,
the CRC error) based on STATU register. This is now addressed in patch 5/6.
Also, MMC driver(patch 5/6) now has replaced the switch/case with if/else to
correlate MMC_RSP_Rx bitmask values with register bits as suggested by Andre.
Apart from it, there are changes in patch 2/6 to fix weird assignments to div
variable.
----------------------------------------------------------------------------------
Series(v2) has few important updates, while loading large files we found
that MMC framework puts "0x1fffe00" into DMA Frame Length(DMA_FRAME_LEN 0x000C)
but register itself is limited to 24 bits and hence it was failing.
It is due to the wrong Block count(cfg->b_max) used in driver, that should be
just 512. This is now fixed in patch 5/6.
Apart from it, as Andre pointed that we might be just overclocking the MMC/SD
clock, and to confirm this we run following test:
$ md5sum clang
349eac46cbbe28f8e44da2dce07fa7b7 clang
U-Boot => ext4load mmc 0:2 0x0 clang
503316480 bytes read in 19516 ms (24.6 MiB/s)
U-Boot => md5sum 0x0 0x1e000000
md5 for 00000000 ... 1dffffff ==> d793bb51c4a1cf83c96d1980927461ff
Even though file gets loaded but md5sum doesn't match. This is now fixed in
patch 2/6
U-Boot => ext4load mmc 0:2 0x0 clang
503316480 bytes read in 41524 ms (11.6 MiB/s)
U-Boot => md5sum 0x0 0x1e000000
md5 for 00000000 ... 1dffffff ==> 349eac46cbbe28f8e44da2dce07fa7b7
-----------------------------------------------------------------------------
At the moment on S700 based platforms, only way to load/boot the Kernel
is from Ethernet, and with these patches one can now load/boot the
Kernel from uSD card.
Patches(1/6 and 2/6) adds changes needed for MMC/SD clock. It introduces
set/get callback routine and get/set MMC/SD clock rate based on device id.
Patch 4/6 adds MMC/SD node in U-boot specific dtsi file, which is used by MMC/SD
driver to read controller base address later on.
Patch 5/6 adds driver for MMC/SD controller present on S700 SoC, and its based
on Mainline Linux driver and DMA related bits is picked and simpilified from
vendor source.
Final patch 6/6 enables the driver support along with MMC commands in
Cubieboard7 config file.
Also, while at it just took the opportunity to synchronize the S700 SoC DT with
Linux in patch 3/6.
This patch-set is tested on Cubieboard7-lite board with following results:
U-Boot 2021.01-rc1-04434-g6589149-dirty (Dec 13 2020 - 13:51:07 +0530)
cubieboard7
DRAM: 1 GiB
PSCI: v0.2
MMC: mmc at e0210000: 0
In: serial at e0126000
Out: serial at e0126000
Err: serial at e0126000
Net: eth0: ethernet at e0220000
Hit any key to stop autoboot: 0
U-Boot =>
U-Boot =>
U-Boot =>
U-Boot => mmc info
Device: mmc at e0210000
Manufacturer ID: 3
OEM: 5344
Name: SC16G
Bus Speed: 50000000
Mode: SD High Speed (50MHz)
Rd Block Len: 512
SD version 3.0
High Capacity: Yes
Capacity: 14.8 GiB
Bus Width: 4-bit
Erase Group Size: 512 Bytes
U-Boot => setenv bootargs console=ttyOWL3,115200n8 earlycon=owl,0xe0126000 init=/sbin/init root=/dev/mmcblk0p2 rw rootwait
U-Boot => setenv kernel_addr_r 0x80000;setenv fdt_addr_r 0x10000000;
U-Boot => fatload mmc 0:1 ${kernel_addr_r} image ;fatload mmc 0:1 ${fdt_addr_r} s700-cubieboard7.dtb
27480576 bytes read in 1041 ms (25.2 MiB/s)
7056 bytes read in 2 ms (3.4 MiB/s)
U-Boot => booti $kernel_addr_r - $fdt_addr_r
## Flattened Device Tree blob at 10000000
Booting using the fdt blob at 0x10000000
Loading Device Tree to 000000003df56000, end 000000003df5ab8f ... OK
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[ 0.000000] Linux version 5.7.0-rc6-00022-g99f1c330923b-dirty (amit at amit-ThinkPad-X230) (gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05), GNU ld (GNU Binutils for Ubuntu) 2.26.1) #474 SMP PREEMPT Thu Aug 13 15:27:10 IST 2020
[ 0.000000] Machine model: CubieBoard7
[ 0.000000] earlycon: owl0 at MMIO 0x00000000e0126000 (options '')
[ 0.000000] printk: bootconsole [owl0] enabled
[ 0.000000] efi: UEFI not found.
[ 0.000000] cma: Reserved 32 MiB at 0x000000003e000000
Amit Singh Tomar (6):
clk: actions: Introduce dummy get/set_rate callbacks
clk: actions: Add SD/MMC clocks
ARM: dts: sync Actions Semi S700 DT from Linux 5.10-rc7
ARM: dts: s700: add MMC/SD controller node
mmc: actions: add MMC driver for Actions OWL S700/S900
configs: Enable mmc support
arch/arm/dts/s700-u-boot.dtsi | 10 +
arch/arm/dts/s700.dtsi | 17 +-
configs/cubieboard7_defconfig | 3 +
drivers/clk/owl/clk_owl.c | 99 +++++
drivers/mmc/Kconfig | 7 +
drivers/mmc/Makefile | 1 +
drivers/mmc/owl_mmc.c | 408 ++++++++++++++++++
.../dt-bindings/power/owl-s700-powergate.h | 19 +
8 files changed, 563 insertions(+), 1 deletion(-)
create mode 100644 drivers/mmc/owl_mmc.c
create mode 100644 include/dt-bindings/power/owl-s700-powergate.h
--
2.27.0
More information about the U-Boot
mailing list