You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.3 KiB
87 lines
2.3 KiB
11 years ago
|
From 45aa29b444db4b0bf9ff49f8b9ca010608a6825b Mon Sep 17 00:00:00 2001
|
||
12 years ago
|
From: John Crispin <blogic@openwrt.org>
|
||
|
Date: Wed, 13 Mar 2013 10:04:01 +0100
|
||
11 years ago
|
Subject: [PATCH 07/34] MIPS: lantiq: handle vmmc memory reservation
|
||
12 years ago
|
|
||
11 years ago
|
Signed-off-by: John Crispin <blogic@openwrt.org>
|
||
12 years ago
|
---
|
||
11 years ago
|
arch/mips/lantiq/xway/Makefile | 2 ++
|
||
12 years ago
|
arch/mips/lantiq/xway/vmmc.c | 63 ++++++++++++++++++++++++++++++++++++++++
|
||
11 years ago
|
2 files changed, 65 insertions(+)
|
||
12 years ago
|
create mode 100644 arch/mips/lantiq/xway/vmmc.c
|
||
|
|
||
|
--- a/arch/mips/lantiq/xway/Makefile
|
||
|
+++ b/arch/mips/lantiq/xway/Makefile
|
||
11 years ago
|
@@ -1,3 +1,5 @@
|
||
12 years ago
|
obj-y := prom.o sysctrl.o clk.o reset.o dma.o gptu.o dcdc.o
|
||
|
|
||
11 years ago
|
+obj-y += vmmc.o
|
||
|
+
|
||
12 years ago
|
obj-$(CONFIG_XRX200_PHY_FW) += xrx200_phy_fw.o
|
||
|
--- /dev/null
|
||
|
+++ b/arch/mips/lantiq/xway/vmmc.c
|
||
|
@@ -0,0 +1,63 @@
|
||
|
+/*
|
||
|
+ * This program is free software; you can redistribute it and/or modify it
|
||
|
+ * under the terms of the GNU General Public License version 2 as published
|
||
|
+ * by the Free Software Foundation.
|
||
|
+ *
|
||
|
+ * Copyright (C) 2012 John Crispin <blogic@openwrt.org>
|
||
|
+ */
|
||
|
+
|
||
|
+#include <linux/module.h>
|
||
|
+#include <linux/of_platform.h>
|
||
|
+#include <linux/of_gpio.h>
|
||
|
+#include <linux/dma-mapping.h>
|
||
|
+
|
||
|
+#include <lantiq_soc.h>
|
||
|
+
|
||
|
+static unsigned int *cp1_base = 0;
|
||
|
+unsigned int* ltq_get_cp1_base(void)
|
||
|
+{
|
||
|
+ if (!cp1_base)
|
||
|
+ panic("no cp1 base was set\n");
|
||
|
+ return cp1_base;
|
||
|
+}
|
||
|
+EXPORT_SYMBOL(ltq_get_cp1_base);
|
||
|
+
|
||
|
+static int vmmc_probe(struct platform_device *pdev)
|
||
|
+{
|
||
|
+#define CP1_SIZE (1 << 20)
|
||
|
+ int gpio_count;
|
||
|
+ dma_addr_t dma;
|
||
|
+ cp1_base =
|
||
|
+ (void*)CPHYSADDR(dma_alloc_coherent(NULL, CP1_SIZE, &dma, GFP_ATOMIC));
|
||
|
+
|
||
|
+ gpio_count = of_gpio_count(pdev->dev.of_node);
|
||
|
+ while (gpio_count) {
|
||
|
+ enum of_gpio_flags flags;
|
||
|
+ int gpio = of_get_gpio_flags(pdev->dev.of_node, --gpio_count, &flags);
|
||
|
+ if (gpio_request(gpio, "vmmc-relay"))
|
||
|
+ continue;
|
||
|
+ dev_info(&pdev->dev, "requested GPIO %d\n", gpio);
|
||
|
+ gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1));
|
||
|
+ }
|
||
|
+
|
||
|
+ dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);
|
||
|
+
|
||
|
+ return 0;
|
||
|
+}
|
||
|
+
|
||
|
+static const struct of_device_id vmmc_match[] = {
|
||
|
+ { .compatible = "lantiq,vmmc" },
|
||
|
+ {},
|
||
|
+};
|
||
|
+MODULE_DEVICE_TABLE(of, vmmc_match);
|
||
|
+
|
||
|
+static struct platform_driver vmmc_driver = {
|
||
|
+ .probe = vmmc_probe,
|
||
|
+ .driver = {
|
||
|
+ .name = "lantiq,vmmc",
|
||
|
+ .owner = THIS_MODULE,
|
||
|
+ .of_match_table = vmmc_match,
|
||
|
+ },
|
||
|
+};
|
||
|
+
|
||
|
+module_platform_driver(vmmc_driver);
|