From a33193c74edf933eece849fdd69f7fc69e7236d9 Mon Sep 17 00:00:00 2001 From: Anton Vorontsov Date: Fri, 28 May 2010 13:14:44 +0400 Subject: [PATCH] --- yaml --- r: 201535 b: refs/heads/master c: 6279d0ea928911f7c747a65e880c36a91b066805 h: refs/heads/master i: 201533: ded78f1756f2485ca2077a7411d97475b51f4d24 201531: bfa36b0fdf42eac8f97e5adac7473c5e812ba695 201527: 818bc5d3fe414825191c4856a10afdde39f60ae5 201519: 5ed46412d0191786a0946369107b7c7d8a50a429 201503: 4eb3dad029be014e8504a38c36be0c5a88c867c4 201471: a90e29614ea0e44241216af0bec0ba31fe52054f v: v3 --- [refs] | 2 +- trunk/arch/arm/mach-cns3xxx/Makefile | 2 +- trunk/arch/arm/mach-cns3xxx/cns3420vb.c | 3 ++ trunk/arch/arm/mach-cns3xxx/devices.c | 59 +++++++++++++++++++++++++ trunk/arch/arm/mach-cns3xxx/devices.h | 19 ++++++++ 5 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 trunk/arch/arm/mach-cns3xxx/devices.c create mode 100644 trunk/arch/arm/mach-cns3xxx/devices.h diff --git a/[refs] b/[refs] index 45dc4363bf66..c0e04ad7b8b9 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 5f32f7a028c9e8e032132b1818bde6cda5785a6b +refs/heads/master: 6279d0ea928911f7c747a65e880c36a91b066805 diff --git a/trunk/arch/arm/mach-cns3xxx/Makefile b/trunk/arch/arm/mach-cns3xxx/Makefile index 683f11794cbe..11033f1c2e23 100644 --- a/trunk/arch/arm/mach-cns3xxx/Makefile +++ b/trunk/arch/arm/mach-cns3xxx/Makefile @@ -1,3 +1,3 @@ -obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o +obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o devices.o obj-$(CONFIG_PCI) += pcie.o obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o diff --git a/trunk/arch/arm/mach-cns3xxx/cns3420vb.c b/trunk/arch/arm/mach-cns3xxx/cns3420vb.c index 2e30c8288740..04ae1ced60f0 100644 --- a/trunk/arch/arm/mach-cns3xxx/cns3420vb.c +++ b/trunk/arch/arm/mach-cns3xxx/cns3420vb.c @@ -32,6 +32,7 @@ #include #include #include "core.h" +#include "devices.h" /* * NOR Flash @@ -117,6 +118,8 @@ static void __init cns3420_init(void) { platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); + cns3xxx_sdhci_init(); + pm_power_off = cns3xxx_power_off; } diff --git a/trunk/arch/arm/mach-cns3xxx/devices.c b/trunk/arch/arm/mach-cns3xxx/devices.c new file mode 100644 index 000000000000..b01a30114622 --- /dev/null +++ b/trunk/arch/arm/mach-cns3xxx/devices.c @@ -0,0 +1,59 @@ +/* + * CNS3xxx common devices + * + * Copyright 2008 Cavium Networks + * Scott Shu + * Copyright 2010 MontaVista Software, LLC. + * Anton Vorontsov + * + * This file 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. + */ + +#include +#include +#include +#include +#include +#include +#include "core.h" +#include "devices.h" + +/* + * SDHCI + */ +static struct resource cns3xxx_sdhci_resources[] = { + [0] = { + .start = CNS3XXX_SDIO_BASE, + .end = CNS3XXX_SDIO_BASE + SZ_4K - 1, + .flags = IORESOURCE_MEM, + }, + [1] = { + .start = IRQ_CNS3XXX_SDIO, + .end = IRQ_CNS3XXX_SDIO, + .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device cns3xxx_sdhci_pdev = { + .name = "sdhci-cns3xxx", + .id = 0, + .num_resources = ARRAY_SIZE(cns3xxx_sdhci_resources), + .resource = cns3xxx_sdhci_resources, +}; + +void __init cns3xxx_sdhci_init(void) +{ + u32 __iomem *gpioa = __io(CNS3XXX_MISC_BASE_VIRT + 0x0014); + u32 gpioa_pins = __raw_readl(gpioa); + + /* MMC/SD pins share with GPIOA */ + gpioa_pins |= 0x1fff0004; + __raw_writel(gpioa_pins, gpioa); + + cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO)); + cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO)); + + platform_device_register(&cns3xxx_sdhci_pdev); +} diff --git a/trunk/arch/arm/mach-cns3xxx/devices.h b/trunk/arch/arm/mach-cns3xxx/devices.h new file mode 100644 index 000000000000..0735a45a3aee --- /dev/null +++ b/trunk/arch/arm/mach-cns3xxx/devices.h @@ -0,0 +1,19 @@ +/* + * CNS3xxx common devices + * + * Copyright 2008 Cavium Networks + * Scott Shu + * Copyright 2010 MontaVista Software, LLC. + * Anton Vorontsov + * + * This file 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. + */ + +#ifndef __CNS3XXX_DEVICES_H_ +#define __CNS3XXX_DEVICES_H_ + +void __init cns3xxx_sdhci_init(void); + +#endif /* __CNS3XXX_DEVICES_H_ */