Skip to content

Commit 3fd784f

Browse files
masahir0ystorulf
authored andcommitted
mmc: uniphier-sd: add UniPhier SD/eMMC controller driver
Here is another TMIO MMC variant found in Socionext UniPhier SoCs. As commit b614749 ("mmc: tmio: split core functionality, DMA and MFD glue") said, these MMC controllers use the IP from Panasonic. However, the MMC controller in the TMIO (Toshiba Mobile IO) MFD chip was the first upstreamed user of this IP. The common driver code for this IP is now called 'tmio-mmc-core' in Linux although it is a historical misnomer. Anyway, this driver select's MMC_TMIO_CORE to borrow the common code from tmio-mmc-core.c Older UniPhier SoCs (LD4, Pro4, sLD8) support the external DMA engine like renesas_sdhi_sys_dmac.c. The difference is UniPhier SoCs use a single DMA channel whereas Renesas chips request separate channels for RX and TX. Newer UniPhier SoCs (Pro5 and later) support the internal DMA engine like renesas_sdhi_internal_dmac.c The register map is almost the same, so I guess Renesas and Socionext use the same internal DMA hardware. The main difference is, the register offsets are doubled for Renesas. Renesas Socionext SDHI UniPhier DM_CM_DTRAN_MODE 0x820 0x410 DM_CM_DTRAN_CTRL 0x828 0x414 DM_CM_RST 0x830 0x418 DM_CM_INFO1 0x840 0x420 DM_CM_INFO1_MASK 0x848 0x424 DM_CM_INFO2 0x850 0x428 DM_CM_INFO2_MASK 0x858 0x42c DM_DTRAN_ADDR 0x880 0x440 DM_DTRAN_ADDREX --- 0x444 This comes from the difference of host->bus_shift; 2 for Renesas SoCs, and 1 for UniPhier SoCs. Also, the datasheet for UniPhier SoCs defines DM_DTRAN_ADDR and DM_DTRAN_ADDREX as two separate registers. It could be possible to factor out the DMA common code by introducing some hooks to cope with platform quirks, but this patch does not touch that for now. Signed-off-by: Masahiro Yamada <[email protected]> Acked-by: Wolfram Sang <[email protected]> Signed-off-by: Ulf Hansson <[email protected]>
1 parent fb19fdf commit 3fd784f

File tree

4 files changed

+705
-0
lines changed

4 files changed

+705
-0
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2195,6 +2195,7 @@ F: drivers/clk/uniphier/
21952195
F: drivers/gpio/gpio-uniphier.c
21962196
F: drivers/i2c/busses/i2c-uniphier*
21972197
F: drivers/irqchip/irq-uniphier-aidet.c
2198+
F: drivers/mmc/host/uniphier-sd.c
21982199
F: drivers/pinctrl/uniphier/
21992200
F: drivers/reset/reset-uniphier.c
22002201
F: drivers/tty/serial/8250/8250_uniphier.c

drivers/mmc/host/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,16 @@ config MMC_SDHI_INTERNAL_DMAC
631631
using on-chip bus mastering. This supports the controllers
632632
found in arm64 based SoCs.
633633

634+
config MMC_UNIPHIER
635+
tristate "UniPhier SD/eMMC Host Controller support"
636+
depends on ARCH_UNIPHIER || COMPILE_TEST
637+
depends on OF
638+
select MMC_TMIO_CORE
639+
help
640+
This provides support for the SD/eMMC controller found in
641+
UniPhier SoCs. The eMMC variant of this controller is used
642+
only for 32-bit SoCs.
643+
634644
config MMC_CB710
635645
tristate "ENE CB710 MMC/SD Interface support"
636646
depends on PCI

drivers/mmc/host/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ obj-$(CONFIG_MMC_TMIO_CORE) += tmio_mmc_core.o
4242
obj-$(CONFIG_MMC_SDHI) += renesas_sdhi_core.o
4343
obj-$(CONFIG_MMC_SDHI_SYS_DMAC) += renesas_sdhi_sys_dmac.o
4444
obj-$(CONFIG_MMC_SDHI_INTERNAL_DMAC) += renesas_sdhi_internal_dmac.o
45+
obj-$(CONFIG_MMC_UNIPHIER) += uniphier-sd.o
4546
obj-$(CONFIG_MMC_CB710) += cb710-mmc.o
4647
obj-$(CONFIG_MMC_VIA_SDMMC) += via-sdmmc.o
4748
octeon-mmc-objs := cavium.o cavium-octeon.o

0 commit comments

Comments
 (0)