| 1 | Index: linux-3.7-rc8/arch/mips/lantiq/xway/Makefile |
| 2 | =================================================================== |
| 3 | --- linux-3.7-rc8.orig/arch/mips/lantiq/xway/Makefile 2012-12-13 13:40:23.000000000 +0100 |
| 4 | +++ linux-3.7-rc8/arch/mips/lantiq/xway/Makefile 2012-12-13 13:40:49.788556963 +0100 |
| 5 | @@ -1,5 +1,5 @@ |
| 6 | obj-y := prom.o sysctrl.o clk.o reset.o dma.o timer.o dcdc.o |
| 7 | |
| 8 | -obj-y += ath_eep.o rt_eep.o eth_mac.o |
| 9 | +obj-y += ath_eep.o rt_eep.o eth_mac.o vmmc.o |
| 10 | |
| 11 | obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o |
| 12 | Index: linux-3.7-rc8/arch/mips/lantiq/xway/vmmc.c |
| 13 | =================================================================== |
| 14 | --- /dev/null 1970-01-01 00:00:00.000000000 +0000 |
| 15 | +++ linux-3.7-rc8/arch/mips/lantiq/xway/vmmc.c 2012-12-13 13:40:30.520556476 +0100 |
| 16 | @@ -0,0 +1,63 @@ |
| 17 | +/* |
| 18 | + * This program is free software; you can redistribute it and/or modify it |
| 19 | + * under the terms of the GNU General Public License version 2 as published |
| 20 | + * by the Free Software Foundation. |
| 21 | + * |
| 22 | + * Copyright (C) 2012 John Crispin <blogic@openwrt.org> |
| 23 | + */ |
| 24 | + |
| 25 | +#include <linux/module.h> |
| 26 | +#include <linux/of_platform.h> |
| 27 | +#include <linux/of_gpio.h> |
| 28 | +#include <linux/dma-mapping.h> |
| 29 | + |
| 30 | +#include <lantiq_soc.h> |
| 31 | + |
| 32 | +static unsigned int *cp1_base = 0; |
| 33 | +unsigned int* ltq_get_cp1_base(void) |
| 34 | +{ |
| 35 | + if (!cp1_base) |
| 36 | + panic("no cp1 base was set\n"); |
| 37 | + return cp1_base; |
| 38 | +} |
| 39 | +EXPORT_SYMBOL(ltq_get_cp1_base); |
| 40 | + |
| 41 | +static int __devinit vmmc_probe(struct platform_device *pdev) |
| 42 | +{ |
| 43 | +#define CP1_SIZE (1 << 20) |
| 44 | + int gpio_count; |
| 45 | + dma_addr_t dma; |
| 46 | + cp1_base = |
| 47 | + (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC)); |
| 48 | + |
| 49 | + gpio_count = of_gpio_count(pdev->dev.of_node); |
| 50 | + while (gpio_count) { |
| 51 | + enum of_gpio_flags flags; |
| 52 | + int gpio = of_get_gpio_flags(pdev->dev.of_node, --gpio_count, &flags); |
| 53 | + if (gpio_request(gpio, "vmmc-relay")) |
| 54 | + continue; |
| 55 | + dev_info(&pdev->dev, "requested GPIO %d\n", gpio); |
| 56 | + gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); |
| 57 | + } |
| 58 | + |
| 59 | + dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base); |
| 60 | + |
| 61 | + return 0; |
| 62 | +} |
| 63 | + |
| 64 | +static const struct of_device_id vmmc_match[] = { |
| 65 | + { .compatible = "lantiq,vmmc" }, |
| 66 | + {}, |
| 67 | +}; |
| 68 | +MODULE_DEVICE_TABLE(of, vmmc_match); |
| 69 | + |
| 70 | +static struct platform_driver vmmc_driver = { |
| 71 | + .probe = vmmc_probe, |
| 72 | + .driver = { |
| 73 | + .name = "lantiq,vmmc", |
| 74 | + .owner = THIS_MODULE, |
| 75 | + .of_match_table = vmmc_match, |
| 76 | + }, |
| 77 | +}; |
| 78 | + |
| 79 | +module_platform_driver(vmmc_driver); |
| 80 | |