[PATCH 0/6] Add MMC/SD support for S700

Amit Singh Tomar
2020-12-13T10:08:30Z

From: Amit Singh Tomar <amittomer25@gmail.com>

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
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 | 94 ++++++
drivers/clk/owl/clk_owl.h | 2 +
drivers/mmc/Kconfig | 7 +
drivers/mmc/Makefile | 1 +
drivers/mmc/owl_mmc.c | 404 +++++++++++++++++++++++++
include/dt-bindings/power/owl-s700-powergate.h | 19 ++
9 files changed, 556 insertions(+), 1 deletion(-)
create mode 100644 drivers/mmc/owl_mmc.c
create mode 100644 include/dt-bindings/power/owl-s700-powergate.h

--
2.7.4