1 From 12ec61455ea440c164c3ff777adbedea350b1e08 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Wed, 13 Mar 2013 10:04:01 +0100
4 Subject: [PATCH 19/22] owrt: lantiq: handle vmmc memory reservation
7 arch/mips/lantiq/xway/Makefile | 2 +-
8 arch/mips/lantiq/xway/vmmc.c | 63 ++++++++++++++++++++++++++++++++++++++++
9 2 files changed, 64 insertions(+), 1 deletion(-)
10 create mode 100644 arch/mips/lantiq/xway/vmmc.c
12 --- a/arch/mips/lantiq/xway/Makefile
13 +++ b/arch/mips/lantiq/xway/Makefile
15 obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
18 +obj-y += eth_mac.o vmmc.o
19 obj-$(CONFIG_PCI) += ath_eep.o rt_eep.o pci-ath-fixup.o
21 obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
23 +++ b/arch/mips/lantiq/xway/vmmc.c
26 + * This program is free software; you can redistribute it and/or modify it
27 + * under the terms of the GNU General Public License version 2 as published
28 + * by the Free Software Foundation.
30 + * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
33 +#include <linux/module.h>
34 +#include <linux/of_platform.h>
35 +#include <linux/of_gpio.h>
36 +#include <linux/dma-mapping.h>
38 +#include <lantiq_soc.h>
40 +static unsigned int *cp1_base = 0;
41 +unsigned int* ltq_get_cp1_base(void)
44 + panic("no cp1 base was set\n");
47 +EXPORT_SYMBOL(ltq_get_cp1_base);
49 +static int vmmc_probe(struct platform_device *pdev)
51 +#define CP1_SIZE (1 << 20)
55 + (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC));
57 + gpio_count = of_gpio_count(pdev->dev.of_node);
58 + while (gpio_count) {
59 + enum of_gpio_flags flags;
60 + int gpio = of_get_gpio_flags(pdev->dev.of_node, --gpio_count, &flags);
61 + if (gpio_request(gpio, "vmmc-relay"))
63 + dev_info(&pdev->dev, "requested GPIO %d\n", gpio);
64 + gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1));
67 + dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);
72 +static const struct of_device_id vmmc_match[] = {
73 + { .compatible = "lantiq,vmmc" },
76 +MODULE_DEVICE_TABLE(of, vmmc_match);
78 +static struct platform_driver vmmc_driver = {
79 + .probe = vmmc_probe,
81 + .name = "lantiq,vmmc",
82 + .owner = THIS_MODULE,
83 + .of_match_table = vmmc_match,
87 +module_platform_driver(vmmc_driver);