mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 10:44:14 +08:00
0008ef9b15
The Makefile entry controlling compilation of this code is: arch/mips/lantiq/xway/vmmc.o ---> arch/mips/lantiq/xway/Makefile:obj-y += vmmc.o ...meaning that it currently is not being built as a module by anyone. Since module_platform_driver() uses the same init level priority as builtin_platform_driver() the init ordering remains unchanged with this commit. Also note that MODULE_DEVICE_TABLE is a no-op for non-modular code. We replace module.h with export.h since the file does actually use EXPORT_SYMBOL. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Cc: John Crispin <john@phrozen.org> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/13930/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
67 lines
1.5 KiB
C
67 lines
1.5 KiB
C
/*
|
|
* 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 <john@phrozen.org>
|
|
*/
|
|
|
|
#include <linux/export.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;
|
|
|
|
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 > 0) {
|
|
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-xway" },
|
|
{},
|
|
};
|
|
|
|
static struct platform_driver vmmc_driver = {
|
|
.probe = vmmc_probe,
|
|
.driver = {
|
|
.name = "lantiq,vmmc",
|
|
.of_match_table = vmmc_match,
|
|
},
|
|
};
|
|
builtin_platform_driver(vmmc_driver);
|