On 05/12/2014 02:04 PM, Hans de Goede wrote:
From: David Lanzendörferdavid.lanzendoer...@o2s.ch
The Allwinner sunxi mmc host uses dma in bus-master mode using a built-in
designware idmac controller, which is identical to the one found in the mmc-dw
hosts. However the rest of the host is not identical to mmc-dw, it deals with
sending stop commands in hardware which makes it significantly different
from the mmc-dw devices.
HdG: Various cleanups and fixes.
Just nitpicking, but usually the above line should be added below the
original signoff, so:
Signed-off-by: David Lanzendörferdavid.lanzendoer...@o2s.ch
[hdego...@redhat.com: various cleanups and fixes]
Signed-off-by: Hans de Goedehdego...@redhat.com
As is documented in SubmittingPatches.
Gr. AvS
---
.../devicetree/bindings/mmc/sunxi-mmc.txt | 43 +
drivers/mmc/host/Kconfig |7 +
drivers/mmc/host/Makefile |2 +
drivers/mmc/host/sunxi-mmc.c | 1049
4 files changed, 1101 insertions(+)
create mode 100644 Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
create mode 100644 drivers/mmc/host/sunxi-mmc.c
diff --git a/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
new file mode 100644
index 000..91b3a34
--- /dev/null
+++ b/Documentation/devicetree/bindings/mmc/sunxi-mmc.txt
@@ -0,0 +1,43 @@
+* Allwinner sunxi MMC controller
+
+The highspeed MMC host controller on Allwinner SoCs provides an interface
+for MMC, SD and SDIO types of memory cards.
+
+Supported maximum speeds are the ones of the eMMC standard 4.5 as well
+as the speed of SD standard 3.0.
+Absolute maximum transfer rate is 200MB/s
+
+Required properties:
+ - compatible : allwinner,sun4i-a10-mmc or allwinner,sun5i-a13-mmc
+ - reg : mmc controller base registers
+ - clocks : a list with 2 phandle + clock specifier pairs
+ - clock-names : must contain ahb and mmc
+ - interrupts : mmc controller interrupt
+
+Optional properties:
+ - resets : phandle + reset specifier pair
+ - reset-names : must contain ahb
+ - for cd, bus-width and additional generic mmc parameters
+ please refer to mmc.txt within this directory
+
+Examples:
+ - Within .dtsi:
+ mmc0: mmc@01c0f000 {
+ compatible = allwinner,sun5i-a13-mmc;
+ reg =0x01c0f000 0x1000;
+ clocks =ahb_gates 8,mmc0_clk;
+ clock-names = ahb, mod;
+ interrupts =0 32 4;
+ status = disabled;
+ };
+
+ - Within dts:
+ mmc0: mmc@01c0f000 {
+ pinctrl-names = default, default;
+ pinctrl-0 =mmc0_pins_a;
+ pinctrl-1 =mmc0_cd_pin_reference_design;
+ bus-width =4;
+ cd-gpios =pio 7 1 0; /* PH1 */
+ cd-inverted;
+ status = okay;
+ };
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 8aaf8c1..d50ac1c 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -694,3 +694,10 @@ config MMC_REALTEK_PCI
help
Say Y here to include driver code to support SD/MMC card interface
of Realtek PCI-E card reader
+
+config MMC_SUNXI
+ tristate Allwinner sunxi SD/MMC Host Controller support
+ depends on ARCH_SUNXI
+ help
+ This selects support for the SD/MMC Host Controller on
+ Allwinner sunxi SoCs.
diff --git a/drivers/mmc/host/Makefile b/drivers/mmc/host/Makefile
index 0c8aa5e..c706c0f 100644
--- a/drivers/mmc/host/Makefile
+++ b/drivers/mmc/host/Makefile
@@ -53,6 +53,8 @@ obj-$(CONFIG_MMC_WMT) += wmt-sdmmc.o
obj-$(CONFIG_MMC_REALTEK_PCI) += rtsx_pci_sdmmc.o
+obj-$(CONFIG_MMC_SUNXI)+= sunxi-mmc.o
+
obj-$(CONFIG_MMC_SDHCI_PLTFM) += sdhci-pltfm.o
obj-$(CONFIG_MMC_SDHCI_CNS3XXX) += sdhci-cns3xxx.o
obj-$(CONFIG_MMC_SDHCI_ESDHC_IMX) += sdhci-esdhc-imx.o
diff --git a/drivers/mmc/host/sunxi-mmc.c b/drivers/mmc/host/sunxi-mmc.c
new file mode 100644
index 000..11bd48f
--- /dev/null
+++ b/drivers/mmc/host/sunxi-mmc.c
@@ -0,0 +1,1049 @@
+/*
+ * Driver for sunxi SD/MMC host controllers
+ * (C) Copyright 2007-2011 Reuuimlla Technology Co., Ltd.
+ * (C) Copyright 2007-2011 Aaron Maoyeleafy.m...@reuuimllatech.com
+ * (C) Copyright 2013-2014 O2S GmbHwww.o2s.ch
+ * (C) Copyright 2013-2014 David Lanzend�rferdavid.lanzendoer...@o2s.ch
+ * (C) Copyright 2013-2014 Hans de Goedehdego...@redhat.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ */
+
+#includelinux/kernel.h
+#includelinux/module.h
+#includelinux/io.h
+#includelinux/device.h
+#includelinux/interrupt.h
+#includelinux/delay.h
+#includelinux/err.h
+
+#includelinux/clk.h