Add TH1520 eMMC/SD controller support
cover Add TH1520 eMMC/SD controller support
Hi list,
I want to introduce support for DesignWare SDHCI host controller on Alibaba TH1520 SoC. The driver based on mainline Linux and Revyos U-boot drivers. Work with eMMC and SD was tested on a LicheePi 4A board.
I would like to point out that the TH1520's SDHCI controller is very similar to Rockchip's IPs those already have U-boot driver - rockchip_sdhci.c
Also on Linux, T-head and Rockchip SDHCI controllers use a common driver - sdhci-of-dwcmshc.c
At my glance we have two options:
- leave TH1520 in a separate driver
- stretch this driver on rockchip_sdhc
I chose the first option for now. And would be glad to hear your thoughts.
Best regards,
Maksim
Maksim Kiselev (1):
mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
drivers/mmc/Kconfig | 12 + drivers/mmc/Makefile | 1 + drivers/mmc/snps_sdhci.c | 464 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 477 insertions(+) create mode 100644 drivers/mmc/snps_sdhci.c
Signature · 1 line
2.40.1
RFC PATCH 1/1 mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
--- drivers/mmc/Kconfig | 12 + drivers/mmc/Makefile | 1 + drivers/mmc/snps_sdhci.c | 464 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 477 insertions(+) create mode 100644 drivers/mmc/snps_sdhci.c
drivers/mmc/Kconfig +12 -0
@@ -671,6 +671,18 @@ config MMC_SDHCI_S5P If unsure, say N. +config MMC_SDHCI_SNPS + bool "Synopsys DesignWare SDHCI controller" + depends on MMC_SDHCI + depends on DM_MMC + help + Support for DesignWare SDHCI host controller on Alibaba TH1520 SoC. + This is a highly configurable and programmable, high performance + Mobile Storage Host Controller (MSHC) with AXI as the bus interface + for data transfer. + + If unsure, say N. + config MMC_SDHCI_STI bool "SDHCI support for STMicroelectronics SoC" depends on MMC_SDHCI && OF_CONTROL
drivers/mmc/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_MMC_SDHCI_NPCM) += npcm_sdhci.o obj-$(CONFIG_MMC_SDHCI_PIC32) += pic32_sdhci.o obj-$(CONFIG_MMC_SDHCI_ROCKCHIP) += rockchip_sdhci.o obj-$(CONFIG_MMC_SDHCI_S5P) += s5p_sdhci.o +obj-$(CONFIG_MMC_SDHCI_SNPS) += snps_sdhci.o obj-$(CONFIG_MMC_SDHCI_STI) += sti_sdhci.o obj-$(CONFIG_MMC_SDHCI_TANGIER) += tangier_sdhci.o obj-$(CONFIG_MMC_SDHCI_TEGRA) += tegra_mmc.o
drivers/mmc/snps_sdhci.c new file +464 -0
464 lines not on this page · raw message
Signature · 1 line
2.40.1
Re: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
Quoted 3 lines · Maksim Kiselev
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>
Thank you for driving the TH1520 support forward.
Locally I updated the Lichee Pi4A device-tree based on the Linux device-tree and built th1520_lpi4a_defconfig with
CONFIG_CMD_MMC=yCONFIG_MMC=yCONFIG_MMC_SDHCI=yCONFIG_MMC_SDHCI_SNPS=y
I tested reading from eMMC and SD-card as well as writing to SD-card and found no problems.
Re: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
i, Heinrich!
вт, 2 апр. 2024 г. в 17:47, Heinrich Schuchardt
<[email protected]>:
Quoted 8 lines · Maksim Kiselev
Quoted 3 lines
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>Thank you for driving the TH1520 support forward.
Quoted 7 lines
Locally I updated the Lichee Pi4A device-tree based on the Linux device-tree and built
th1520_lpi4a_defconfigwith
CONFIG_CMD_MMC=yCONFIG_MMC=yCONFIG_MMC_SDHCI=yCONFIG_MMC_SDHCI_SNPS=y
You can also enable following options:CONFIG_MMC_IO_VOLTAGE=yCONFIG_MMC_UHS_SUPPORT=yCONFIG_MMC_HS400_ES_SUPPORT=yCONFIG_MMC_HS400_SUPPORT=y
For HS400_ES mode also needs to add mmc-hs400-enhanced-strobe line to the emmc node in the Lichee's DT.
HS200/HS400/HS400_ES modes work fine with eMMC on my Lichee Pi4A board. MicroSD works fine at UHS SDR104 too.
Bus Speed for both devices is 198MHz
Quoted 4 lines
I tested reading from eMMC and SD-card as well as writing to SD-card and found no problems.
Tested-by Heinrich Schuchardt <[email protected]>
Thanks for testing!
Re: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
Maxim Kiselev <[email protected]> schrieb am Di., 2. Apr. 2024, 19:19:
Quoted 20 lines
i, Heinrich!
вт, 2 апр. 2024 г. в 17:47, Heinrich Schuchardt
<[email protected]>:Quoted 8 lines · Maksim Kiselev
Quoted 3 lines
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>Thank you for driving the TH1520 support forward.
Quoted 7 lines
Locally I updated the Lichee Pi4A device-tree based on the Linux device-tree and built
th1520_lpi4a_defconfigwith
CONFIG_CMD_MMC=yCONFIG_MMC=yCONFIG_MMC_SDHCI=yCONFIG_MMC_SDHCI_SNPS=y
Quoted 9 lines
You can also enable following options:
CONFIG_MMC_IO_VOLTAGE=yCONFIG_MMC_UHS_SUPPORT=yCONFIG_MMC_HS400_ES_SUPPORT=yCONFIG_MMC_HS400_SUPPORT=yFor
HS400_ESmode also needs to addmmc-hs400-enhanced-strobeline to the emmc node in the Lichee's DT.
Could you, please, send a patch series with all these changes.
Best regards
Heinrich
Quoted 12 lines
HS200/HS400/HS400_ES modes work fine with eMMC on my Lichee Pi4A board. MicroSD works fine at UHS SDR104 too.
Bus Speed for both devices is 198MHz
Quoted 4 lines
I tested reading from eMMC and SD-card as well as writing to SD-card and found no problems.
Tested-by Heinrich Schuchardt <[email protected]>Thanks for testing!
Re: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
In reply to Maksim KiselevQuoted 20 lines · Maksim Kiselev
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>--- drivers/mmc/Kconfig | 12 + drivers/mmc/Makefile | 1 + drivers/mmc/snps_sdhci.c | 464 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 477 insertions(+) create mode 100644 drivers/mmc/snps_sdhci.cdrivers/mmc/Kconfig +2
-0@@ -671,6 +671,18 @@ config MMC_SDHCI_S5P If unsure, say N. +config MMC_SDHCI_SNPS + bool "Synopsys DesignWare SDHCI controller"
drivers/mmc/Kconfig config MMC_SDHCI_S5P · line 685
Quoted 10 lines
drivers/mmc/Kconfig +10
-0+ depends on MMC_SDHCI + depends on DM_MMC + help + Support for DesignWare SDHCI host controller on Alibaba TH1520 SoC. + This is a highly configurable and programmable, high performance + Mobile Storage Host Controller (MSHC) with AXI as the bus interface + for data transfer. + + If unsure, say N. +
Why not use MMC_DW?
--Sean
[Embedded World 2024, SECO SpA]<https://www.messe-ticket.de/Nuernberg/embeddedworld2024/Register/ew24517689>
Re: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
Hi, Sean
вт, 2 апр. 2024 г. в 18:39, Sean Anderson <[email protected]>:
Quoted 20 lines · Maksim Kiselev
Quoted 18 lines
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>---
drivers/mmc/Kconfig| 12 +drivers/mmc/Makefile| 1 +drivers/mmc/snps_sdhci.c| 464 +++++++++++++++++++++++++++++++++++++++3 files changed, 477 insertions(+)create mode 100644
drivers/mmc/snps_sdhci.cdrivers/mmc/Kconfig +0
-0@@ -671,6 +671,18 @@ config MMC_SDHCI_S5PIf unsure, say N.
Quoted 14 lines
drivers/mmc/Kconfig config MMC_SDHCI_S5P · line 685
Quoted 12 lines
drivers/mmc/Kconfig +12
-0+config MMC_SDHCI_SNPS + bool "Synopsys DesignWare SDHCI controller" + depends on MMC_SDHCI + depends on DM_MMC + help + Support for DesignWare SDHCI host controller on Alibaba TH1520 SoC. + This is a highly configurable and programmable, high performance + Mobile Storage Host Controller (MSHC) with AXI as the bus interface + for data transfer. + + If unsure, say N. +Why not use
MMC_DW?
That driver looks completely different. As I notice in the cover letter, the MMC_SDHCI_ROCKCHIP driver is closer to TH1520 driver.
https://lore.kernel.org/u-boot/[email protected]/
Their IP blocks look very similar.
Moreover, on Linux, Rockchip SDHCI controllers (ex. rockchip,rk3588-dwcmshc) and the TH1520 controller live in the same driver - sdhci-of-dwcmshc.c
We could do the same for U-boot. It will require to get rid of Rockchip specific defines that come from asm/arch-rockchip/hardware.h. And maybe rename the rockchip_sdhci.c driver to sdhci-of-dwcmshc.c.
That's why I mark this series as RFC. So I'm willing to discuss any option.
Quoted 4 lines
--Sean
[Embedded World 2024, SECO SpA]<https://www.messe-ticket.de/Nuernberg/embeddedworld2024/Register/ew24517689>
Cheers,
Maksim
RE: [RFC PATCH v1 1/1] mmc: snps_sdhci: Add sdhci driver support for TH1520 SoC
Hi,
Quoted 48 lines
-----Original Message-----
From: Maxim Kiselev <[email protected]>
Sent: Wednesday, April 3, 2024 3:57 AM
To: Sean Anderson <[email protected]>
Cc: Tom Rini <[email protected]>; Peng Fan <[email protected]>; Jaehoon Chung <[email protected]>; Marek Vasut <[email protected]>; Paul Barker <[email protected]>; Kever Yang <[email protected]>; Peter Geis <[email protected]>; Oleksandr Suvorov <[email protected]>; Stefan Roese <[email protected]>; [email protected]
Subject: Re: [RFC PATCH v1 1/1] mmc:snps_sdhci: Add sdhci driver support for TH1520 SoCHi, Sean
вт, 2 апр. 2024 г. в 18:39, Sean Anderson <[email protected]>:
Quoted 20 lines · Maksim Kiselev
Quoted 18 lines
Add support for DesignWare SDHCI host controller on Alibaba TH1520 SoC
Signed-off-by Maksim Kiselev <[email protected]>---
drivers/mmc/Kconfig| 12 +drivers/mmc/Makefile| 1 +drivers/mmc/snps_sdhci.c| 464 +++++++++++++++++++++++++++++++++++++++3 files changed, 477 insertions(+)create mode 100644
drivers/mmc/snps_sdhci.cdrivers/mmc/Kconfig +0
-0@@ -671,6 +671,18 @@ config MMC_SDHCI_S5PIf unsure, say N.
Quoted 14 lines
drivers/mmc/Kconfig config MMC_SDHCI_S5P · line 685
Quoted 12 lines
drivers/mmc/Kconfig +12
-0+config MMC_SDHCI_SNPS + bool "Synopsys DesignWare SDHCI controller" + depends on MMC_SDHCI + depends on DM_MMC + help + Support for DesignWare SDHCI host controller on Alibaba TH1520 SoC. + This is a highly configurable and programmable, high performance + Mobile Storage Host Controller (MSHC) with AXI as the bus interface + for data transfer. + + If unsure, say N. +Why not use
MMC_DW?
Quoted 7 lines
That driver looks completely different. As I notice in the cover letter, the
MMC_SDHCI_ROCKCHIPdriver is closer to TH1520 driver.
https://lore.kernel.org/u-boot/[email protected]/Their IP blocks look very similar.
Moreover, on Linux, Rockchip SDHCI controllers (ex. rockchip,rk3588-dwcmshc) and the TH1520 controller live in the same driver -sdhci-of-dwcmshc.c
Right. I didn't have its TRM. AFAIK, It's a different IP with DW_MMC.
Quoted 4 lines
We could do the same for U-boot. It will require to get rid of Rockchip specific defines that come from
asm/arch-rockchip/hardware.h. And maybe rename therockchip_sdhci.cdriver tosdhci-of-dwcmshc.c.
In u-boot, rochkip_sdhci.c is including the specific rockchip code. (rockchip header..) So I think that it can be a huge refactoring to use both SoC.
But if it's possible, I think that it can be reusable.
Quoted 11 lines
That's why I mark this series as RFC. So I'm willing to discuss any option.
Quoted 4 lines
--Sean
[Embedded World 2024, SECO SpA]<https://www.messe-
ticket.de/Nuernberg/embeddedworld2024/Register/ew24517689>
Cheers,
Maksim