1 // SPDX-License-Identifier: GPL-2.0-only
7 #include <linux/export.h>
8 #include <linux/of_platform.h>
9 #include <linux/of_gpio.h>
10 #include <linux/dma-mapping.h>
12 #include <lantiq_soc.h>
14 static unsigned int *cp1_base;
16 unsigned int *ltq_get_cp1_base(void)
19 panic("no cp1 base was set\n");
23 EXPORT_SYMBOL(ltq_get_cp1_base);
25 static int vmmc_probe(struct platform_device *pdev)
27 #define CP1_SIZE (1 << 20)
32 (void *) CPHYSADDR(dma_alloc_coherent(&pdev->dev, CP1_SIZE,
35 gpio_count = of_gpio_count(pdev->dev.of_node);
36 while (gpio_count > 0) {
37 enum of_gpio_flags flags;
38 int gpio = of_get_gpio_flags(pdev->dev.of_node,
39 --gpio_count, &flags);
40 if (gpio_request(gpio, "vmmc-relay"))
42 dev_info(&pdev->dev, "requested GPIO %d\n", gpio);
43 gpio_direction_output(gpio,
44 (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1));
47 dev_info(&pdev->dev, "reserved %dMB at 0x%p", CP1_SIZE >> 20, cp1_base);
52 static const struct of_device_id vmmc_match[] = {
53 { .compatible = "lantiq,vmmc-xway" },
57 static struct platform_driver vmmc_driver = {
60 .name = "lantiq,vmmc",
61 .of_match_table = vmmc_match,
64 builtin_platform_driver(vmmc_driver);