aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-cns3xxx/devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-cns3xxx/devices.c')
-rw-r--r--arch/arm/mach-cns3xxx/devices.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c
new file mode 100644
index 000000000000..b01a30114622
--- /dev/null
+++ b/arch/arm/mach-cns3xxx/devices.c
@@ -0,0 +1,59 @@
1/*
2 * CNS3xxx common devices
3 *
4 * Copyright 2008 Cavium Networks
5 * Scott Shu
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@mvista.com>
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/io.h>
15#include <linux/init.h>
16#include <linux/compiler.h>
17#include <linux/platform_device.h>
18#include <mach/cns3xxx.h>
19#include <mach/irqs.h>
20#include "core.h"
21#include "devices.h"
22
23/*
24 * SDHCI
25 */
26static struct resource cns3xxx_sdhci_resources[] = {
27 [0] = {
28 .start = CNS3XXX_SDIO_BASE,
29 .end = CNS3XXX_SDIO_BASE + SZ_4K - 1,
30 .flags = IORESOURCE_MEM,
31 },
32 [1] = {
33 .start = IRQ_CNS3XXX_SDIO,
34 .end = IRQ_CNS3XXX_SDIO,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39static struct platform_device cns3xxx_sdhci_pdev = {
40 .name = "sdhci-cns3xxx",
41 .id = 0,
42 .num_resources = ARRAY_SIZE(cns3xxx_sdhci_resources),
43 .resource = cns3xxx_sdhci_resources,
44};
45
46void __init cns3xxx_sdhci_init(void)
47{
48 u32 __iomem *gpioa = __io(CNS3XXX_MISC_BASE_VIRT + 0x0014);
49 u32 gpioa_pins = __raw_readl(gpioa);
50
51 /* MMC/SD pins share with GPIOA */
52 gpioa_pins |= 0x1fff0004;
53 __raw_writel(gpioa_pins, gpioa);
54
55 cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO));
56 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
57
58 platform_device_register(&cns3xxx_sdhci_pdev);
59}