aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-cns3xxx
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@mvista.com>2010-05-28 05:14:44 -0400
committerAnton Vorontsov <avorontsov@mvista.com>2010-06-08 09:37:09 -0400
commit6279d0ea928911f7c747a65e880c36a91b066805 (patch)
tree801dbd4b9cb7006f6bb628f88cb2071522f090e7 /arch/arm/mach-cns3xxx
parent5f32f7a028c9e8e032132b1818bde6cda5785a6b (diff)
ARM: cns3xxx: Add support for SDHCI controllers
CNS3xxx chips have SDHCI-compatible SDIO/SD/MMC controller. This patch adds the support using sdhci-cns3xxx driver. Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Diffstat (limited to 'arch/arm/mach-cns3xxx')
-rw-r--r--arch/arm/mach-cns3xxx/Makefile2
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c3
-rw-r--r--arch/arm/mach-cns3xxx/devices.c59
-rw-r--r--arch/arm/mach-cns3xxx/devices.h19
4 files changed, 82 insertions, 1 deletions
diff --git a/arch/arm/mach-cns3xxx/Makefile b/arch/arm/mach-cns3xxx/Makefile
index 683f11794cbe..11033f1c2e23 100644
--- a/arch/arm/mach-cns3xxx/Makefile
+++ b/arch/arm/mach-cns3xxx/Makefile
@@ -1,3 +1,3 @@
1obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o 1obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o devices.o
2obj-$(CONFIG_PCI) += pcie.o 2obj-$(CONFIG_PCI) += pcie.o
3obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o 3obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2e30c8288740..04ae1ced60f0 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -32,6 +32,7 @@
32#include <mach/cns3xxx.h> 32#include <mach/cns3xxx.h>
33#include <mach/irqs.h> 33#include <mach/irqs.h>
34#include "core.h" 34#include "core.h"
35#include "devices.h"
35 36
36/* 37/*
37 * NOR Flash 38 * NOR Flash
@@ -117,6 +118,8 @@ static void __init cns3420_init(void)
117{ 118{
118 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); 119 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
119 120
121 cns3xxx_sdhci_init();
122
120 pm_power_off = cns3xxx_power_off; 123 pm_power_off = cns3xxx_power_off;
121} 124}
122 125
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}
diff --git a/arch/arm/mach-cns3xxx/devices.h b/arch/arm/mach-cns3xxx/devices.h
new file mode 100644
index 000000000000..0735a45a3aee
--- /dev/null
+++ b/arch/arm/mach-cns3xxx/devices.h
@@ -0,0 +1,19 @@
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#ifndef __CNS3XXX_DEVICES_H_
15#define __CNS3XXX_DEVICES_H_
16
17void __init cns3xxx_sdhci_init(void);
18
19#endif /* __CNS3XXX_DEVICES_H_ */