summaryrefslogtreecommitdiff
path: root/arch/arm/mach-nomadik
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2013-01-06 04:47:29 +0400
committerLinus Walleij <linus.walleij@linaro.org>2013-01-29 02:24:40 +0400
commit4fd243c6c083ea159ae1a9f9a24198c350034439 (patch)
tree8cf4746a6d0edc06aae4f2ae4b1e4d82a4b401c0 /arch/arm/mach-nomadik
parent2ad6e39867cf026e668a4c566725c2c65dbde406 (diff)
downloadlinux-4fd243c6c083ea159ae1a9f9a24198c350034439.tar.xz
ARM: nomadik: migrate MMC/SD card support to device tree
This moves over the MMC/SD card support to the device tree probe path. The special GPIO to bias the card detect line is kept, but the pin property is moved to the device tree as part of the MMC/SD card node. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'arch/arm/mach-nomadik')
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index 339496f15138..5ad301e4eb2f 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -36,6 +36,7 @@
#include <linux/of_platform.h>
#include <linux/mtd/fsmc.h>
#include <linux/gpio.h>
+#include <linux/amba/mmci.h>
#include <mach/hardware.h>
#include <mach/irqs.h>
@@ -297,6 +298,50 @@ static int __init cpu8815_eth_init(void)
}
device_initcall(cpu8815_eth_init);
+/*
+ * TODO:
+ * cannot be set from device tree, convert to a proper DT
+ * binding.
+ */
+static struct mmci_platform_data mmcsd_plat_data = {
+ .ocr_mask = MMC_VDD_29_30,
+};
+
+/*
+ * This GPIO pin turns on a line that is used to detect card insertion
+ * on this board.
+ */
+static int __init cpu8815_mmcsd_init(void)
+{
+ struct device_node *cdbias;
+ int gpio, err;
+
+ cdbias = of_find_node_by_path("/usb-s8815/mmcsd-gpio");
+ if (!cdbias) {
+ pr_info("could not find MMC/SD card detect bias node\n");
+ return 0;
+ }
+ gpio = of_get_gpio(cdbias, 0);
+ if (gpio < 0) {
+ pr_info("could not obtain MMC/SD card detect bias GPIO\n");
+ return 0;
+ }
+ err = gpio_request(gpio, "card detect bias");
+ if (err) {
+ pr_info("failed to request card detect bias GPIO %d\n", gpio);
+ return -ENODEV;
+ }
+ err = gpio_direction_output(gpio, 0);
+ if (err){
+ pr_info("failed to set GPIO %d as output, low\n", gpio);
+ return err;
+ }
+ pr_info("enabled USB-S8815 CD bias GPIO %d, low\n", gpio);
+ return 0;
+}
+device_initcall(cpu8815_mmcsd_init);
+
+
/* These are mostly to get the right device names for the clock lookups */
static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE,
@@ -319,7 +364,8 @@ static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = {
"rtc-pl031", NULL),
OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE,
"fsmc-nand", &cpu8815_nand_data),
-
+ OF_DEV_AUXDATA("arm,primecell", NOMADIK_SDI_BASE,
+ "mmci", &mmcsd_plat_data),
{ /* sentinel */ },
};