diff options
author | Linus Walleij <linus.walleij@linaro.org> | 2013-01-05 19:47:29 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2013-01-28 17:24:40 -0500 |
commit | 4fd243c6c083ea159ae1a9f9a24198c350034439 (patch) | |
tree | 8cf4746a6d0edc06aae4f2ae4b1e4d82a4b401c0 /arch/arm/mach-nomadik | |
parent | 2ad6e39867cf026e668a4c566725c2c65dbde406 (diff) |
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.c | 48 |
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 @@ | |||
36 | #include <linux/of_platform.h> | 36 | #include <linux/of_platform.h> |
37 | #include <linux/mtd/fsmc.h> | 37 | #include <linux/mtd/fsmc.h> |
38 | #include <linux/gpio.h> | 38 | #include <linux/gpio.h> |
39 | #include <linux/amba/mmci.h> | ||
39 | 40 | ||
40 | #include <mach/hardware.h> | 41 | #include <mach/hardware.h> |
41 | #include <mach/irqs.h> | 42 | #include <mach/irqs.h> |
@@ -297,6 +298,50 @@ static int __init cpu8815_eth_init(void) | |||
297 | } | 298 | } |
298 | device_initcall(cpu8815_eth_init); | 299 | device_initcall(cpu8815_eth_init); |
299 | 300 | ||
301 | /* | ||
302 | * TODO: | ||
303 | * cannot be set from device tree, convert to a proper DT | ||
304 | * binding. | ||
305 | */ | ||
306 | static struct mmci_platform_data mmcsd_plat_data = { | ||
307 | .ocr_mask = MMC_VDD_29_30, | ||
308 | }; | ||
309 | |||
310 | /* | ||
311 | * This GPIO pin turns on a line that is used to detect card insertion | ||
312 | * on this board. | ||
313 | */ | ||
314 | static int __init cpu8815_mmcsd_init(void) | ||
315 | { | ||
316 | struct device_node *cdbias; | ||
317 | int gpio, err; | ||
318 | |||
319 | cdbias = of_find_node_by_path("/usb-s8815/mmcsd-gpio"); | ||
320 | if (!cdbias) { | ||
321 | pr_info("could not find MMC/SD card detect bias node\n"); | ||
322 | return 0; | ||
323 | } | ||
324 | gpio = of_get_gpio(cdbias, 0); | ||
325 | if (gpio < 0) { | ||
326 | pr_info("could not obtain MMC/SD card detect bias GPIO\n"); | ||
327 | return 0; | ||
328 | } | ||
329 | err = gpio_request(gpio, "card detect bias"); | ||
330 | if (err) { | ||
331 | pr_info("failed to request card detect bias GPIO %d\n", gpio); | ||
332 | return -ENODEV; | ||
333 | } | ||
334 | err = gpio_direction_output(gpio, 0); | ||
335 | if (err){ | ||
336 | pr_info("failed to set GPIO %d as output, low\n", gpio); | ||
337 | return err; | ||
338 | } | ||
339 | pr_info("enabled USB-S8815 CD bias GPIO %d, low\n", gpio); | ||
340 | return 0; | ||
341 | } | ||
342 | device_initcall(cpu8815_mmcsd_init); | ||
343 | |||
344 | |||
300 | /* These are mostly to get the right device names for the clock lookups */ | 345 | /* These are mostly to get the right device names for the clock lookups */ |
301 | static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { | 346 | static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { |
302 | OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE, | 347 | OF_DEV_AUXDATA("st,nomadik-gpio", NOMADIK_GPIO0_BASE, |
@@ -319,7 +364,8 @@ static struct of_dev_auxdata cpu8815_auxdata_lookup[] __initdata = { | |||
319 | "rtc-pl031", NULL), | 364 | "rtc-pl031", NULL), |
320 | OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE, | 365 | OF_DEV_AUXDATA("stericsson,fsmc-nand", NOMADIK_FSMC_BASE, |
321 | "fsmc-nand", &cpu8815_nand_data), | 366 | "fsmc-nand", &cpu8815_nand_data), |
322 | 367 | OF_DEV_AUXDATA("arm,primecell", NOMADIK_SDI_BASE, | |
368 | "mmci", &mmcsd_plat_data), | ||
323 | { /* sentinel */ }, | 369 | { /* sentinel */ }, |
324 | }; | 370 | }; |
325 | 371 | ||