[PATCH] ARM: mmp: add mmc resource for sdh controllers

Philip Rakity prakity at marvell.com
Mon Dec 20 13:55:35 EST 2010


Signed-off-by: Philip Rakity <prakity at marvell.com>
---
 arch/arm/mach-mmp/include/mach/mmp2.h      |   30 ++++++++++++++++++++++++
 arch/arm/mach-mmp/include/mach/regs-apmu.h |    2 +
 arch/arm/mach-mmp/mmp2.c                   |   35 ++++++++++++++++++++++++=
++++
 3 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-mmp/include/mach/mmp2.h b/arch/arm/mach-mmp/incl=
ude/mach/mmp2.h
index dbba6e8..01f93a8 100644
--- a/arch/arm/mach-mmp/include/mach/mmp2.h
+++ b/arch/arm/mach-mmp/include/mach/mmp2.h
@@ -1,6 +1,8 @@
 #ifndef __ASM_MACH_MMP2_H
 #define __ASM_MACH_MMP2_H
=20
+#include <plat/sdhci.h>
+
 struct sys_timer;
=20
 extern struct sys_timer mmp2_timer;
@@ -22,6 +24,10 @@ extern struct pxa_device_desc mmp2_device_twsi3;
 extern struct pxa_device_desc mmp2_device_twsi4;
 extern struct pxa_device_desc mmp2_device_twsi5;
 extern struct pxa_device_desc mmp2_device_twsi6;
+extern struct pxa_device_desc mmp2_device_sdh0;
+extern struct pxa_device_desc mmp2_device_sdh1;
+extern struct pxa_device_desc mmp2_device_sdh2;
+extern struct pxa_device_desc mmp2_device_sdh3;
=20
 static inline int mmp2_add_uart(int id)
 {
@@ -63,5 +69,29 @@ static inline int mmp2_add_twsi(int id, struct i2c_pxa_p=
latform_data *data,
 	return pxa_register_device(d, data, sizeof(*data));
 }
=20
+static inline int mmp2_add_sdhost(int id, struct sdhci_pxa_platdata *data)
+{
+	struct pxa_device_desc *d =3D NULL;
+
+	switch (id) {
+	case 0:
+		d =3D &mmp2_device_sdh0;
+		break;
+	case 1:
+		d =3D &mmp2_device_sdh1;
+		break;
+	case 2:
+		d =3D &mmp2_device_sdh2;
+		break;
+	case 3:
+		d =3D &mmp2_device_sdh3;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	return pxa_register_device(d, data, sizeof(*data));
+}
+
 #endif /* __ASM_MACH_MMP2_H */
=20
diff --git a/arch/arm/mach-mmp/include/mach/regs-apmu.h b/arch/arm/mach-mmp=
/include/mach/regs-apmu.h
index ac47023..f7011ef 100644
--- a/arch/arm/mach-mmp/include/mach/regs-apmu.h
+++ b/arch/arm/mach-mmp/include/mach/regs-apmu.h
@@ -27,6 +27,8 @@
 #define APMU_DMA	APMU_REG(0x064)
 #define APMU_GEU	APMU_REG(0x068)
 #define APMU_BUS	APMU_REG(0x06c)
+#define APMU_SDH2	APMU_REG(0x0e8)
+#define APMU_SDH3	APMU_REG(0x0ec)
=20
 #define APMU_FNCLK_EN	(1 << 4)
 #define APMU_AXICLK_EN	(1 << 3)
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index 2e3dd08..8e6c3ac 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -115,6 +115,29 @@ void __init mmp2_init_irq(void)
 	mmp2_init_gpio();
 }
=20
+static void sdhc_clk_enable(struct clk *clk)
+{
+	uint32_t clk_rst;
+
+	clk_rst  =3D  __raw_readl(clk->clk_rst);
+	clk_rst |=3D clk->enable_val;
+	__raw_writel(clk_rst, clk->clk_rst);
+}
+
+static void sdhc_clk_disable(struct clk *clk)
+{
+	uint32_t clk_rst;
+
+	clk_rst  =3D  __raw_readl(clk->clk_rst);
+	clk_rst &=3D ~clk->enable_val;
+	__raw_writel(clk_rst, clk->clk_rst);
+}
+
+struct clkops sdhc_clk_ops =3D {
+	.enable		=3D sdhc_clk_enable,
+	.disable	=3D sdhc_clk_disable,
+};
+
 /* APB peripheral clocks */
 static APBC_CLK(uart1, MMP2_UART1, 1, 26000000);
 static APBC_CLK(uart2, MMP2_UART2, 1, 26000000);
@@ -128,6 +151,10 @@ static APBC_CLK(twsi5, MMP2_TWSI5, 0, 26000000);
 static APBC_CLK(twsi6, MMP2_TWSI6, 0, 26000000);
=20
 static APMU_CLK(nand, NAND, 0xbf, 100000000);
+static APMU_CLK_OPS(sdh0, SDH0, 0x1b, 200000000, &sdhc_clk_ops);
+static APMU_CLK_OPS(sdh1, SDH1, 0x1b, 200000000, &sdhc_clk_ops);
+static APMU_CLK_OPS(sdh2, SDH2, 0x1b, 200000000, &sdhc_clk_ops);
+static APMU_CLK_OPS(sdh3, SDH3, 0x1b, 200000000, &sdhc_clk_ops);
=20
 static struct clk_lookup mmp2_clkregs[] =3D {
 	INIT_CLKREG(&clk_uart1, "pxa2xx-uart.0", NULL),
@@ -141,6 +168,10 @@ static struct clk_lookup mmp2_clkregs[] =3D {
 	INIT_CLKREG(&clk_twsi5, "pxa2xx-i2c.4", NULL),
 	INIT_CLKREG(&clk_twsi6, "pxa2xx-i2c.5", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
+	INIT_CLKREG(&clk_sdh0, "sdhci-pxa.0", "PXA-SDHCLK"),
+	INIT_CLKREG(&clk_sdh1, "sdhci-pxa.1", "PXA-SDHCLK"),
+	INIT_CLKREG(&clk_sdh2, "sdhci-pxa.2", "PXA-SDHCLK"),
+	INIT_CLKREG(&clk_sdh3, "sdhci-pxa.3", "PXA-SDHCLK"),
 };
=20
 static int __init mmp2_init(void)
@@ -191,4 +222,8 @@ MMP2_DEVICE(twsi4, "pxa2xx-i2c", 3, TWSI4, 0xd4033000, =
0x70);
 MMP2_DEVICE(twsi5, "pxa2xx-i2c", 4, TWSI5, 0xd4033800, 0x70);
 MMP2_DEVICE(twsi6, "pxa2xx-i2c", 5, TWSI6, 0xd4034000, 0x70);
 MMP2_DEVICE(nand, "pxa3xx-nand", -1, NAND, 0xd4283000, 0x100, 28, 29);
+MMP2_DEVICE(sdh0, "sdhci-pxa", 0, MMC, 0xd4280000, 0x120);
+MMP2_DEVICE(sdh1, "sdhci-pxa", 1, MMC2, 0xd4280800, 0x120);
+MMP2_DEVICE(sdh2, "sdhci-pxa", 2, MMC3, 0xd4281000, 0x120);
+MMP2_DEVICE(sdh3, "sdhci-pxa", 3, MMC4, 0xd4281800, 0x120);
=20
--=20
1.6.0.4

--_002_661A407B80734B51AE40E3BA6D0B5C42marvellcom_
Content-Type: application/octet-stream;
	name="0002-ARM-mmp-add-mmc-resource-for-sdh-controllers.patch"
Content-Description: 0002-ARM-mmp-add-mmc-resource-for-sdh-controllers.patch
Content-Disposition: attachment;
	filename="0002-ARM-mmp-add-mmc-resource-for-sdh-controllers.patch";
	size=4820; creation-date="Tue, 21 Dec 2010 23:07:34 GMT";
	modification-date="Tue, 21 Dec 2010 23:07:34 GMT"
Content-Transfer-Encoding: base64

RnJvbSA4NzA5NDVlMjIzZGIzMDgwYTBkNzA2NjNlZTdjNTE2ZDEyYjZlNzUwIE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBQaGlsaXAgUmFraXR5IDxwcmFraXR5QG1hcnZlbGwuY29tPgpE
YXRlOiBNb24sIDIwIERlYyAyMDEwIDEwOjU1OjM1IC0wODAwClN1YmplY3Q6IFtQQVRDSF0gQVJN
OiBtbXA6IGFkZCBtbWMgcmVzb3VyY2UgZm9yIHNkaCBjb250cm9sbGVycwoKU2lnbmVkLW9mZi1i
eTogUGhpbGlwIFJha2l0eSA8cHJha2l0eUBtYXJ2ZWxsLmNvbT4KLS0tCiBhcmNoL2FybS9tYWNo
LW1tcC9pbmNsdWRlL21hY2gvbW1wMi5oICAgICAgfCAgIDMwICsrKysrKysrKysrKysrKysrKysr
KysrKwogYXJjaC9hcm0vbWFjaC1tbXAvaW5jbHVkZS9tYWNoL3JlZ3MtYXBtdS5oIHwgICAgMiAr
CiBhcmNoL2FybS9tYWNoLW1tcC9tbXAyLmMgICAgICAgICAgICAgICAgICAgfCAgIDM1ICsrKysr
KysrKysrKysrKysrKysrKysrKysrKysKIDMgZmlsZXMgY2hhbmdlZCwgNjcgaW5zZXJ0aW9ucygr
KSwgMCBkZWxldGlvbnM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STYsIDB4ZDQwMzQwMDAsIDB4NzApOwogTU1QMl9ERVZJQ0Uo
bmFuZCwgInB4YTN4eC1uYW5kIiwgLTEsIE5BTkQsIDB4ZDQyODMwMDAsIDB4MTAwLCAyOCwgMjkp
OworTU1QMl9ERVZJQ0Uoc2RoMCwgInNkaGNpLXB4YSIsIDAsIE1NQywgMHhkNDI4MDAwMCwgMHgx
MjApOworTU1QMl9ERVZJQ0Uoc2RoMSwgInNkaGNpLXB4YSIsIDEsIE1NQzIsIDB4ZDQyODA4MDAs
IDB4MTIwKTsKK01NUDJfREVWSUNFKHNkaDIsICJzZGhjaS1weGEiLCAyLCBNTUMzLCAweGQ0Mjgx
MDAwLCAweDEyMCk7CitNTVAyX0RFVklDRShzZGgzLCAic2RoY2ktcHhhIiwgMywgTU1DNCwgMHhk
NDI4MTgwMCwgMHgxMjApOwogCi0tIAoxLjYuMC40Cgo=

--_002_661A407B80734B51AE40E3BA6D0B5C42marvellcom_--



More information about the linux-arm-kernel mailing list