diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2009-11-17 02:41:23 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-11-30 20:33:17 -0500 |
commit | 86cd4f5f83acbfa481c513c74666ad360b49d73b (patch) | |
tree | fadf026dc26dc06b7d6fc3d8405aa96795db23e9 /arch/arm/mach-s5pc100 | |
parent | 067f131d09d89bd56864f1f4b3144cc778024b33 (diff) |
ARM: S5PC1xx: add platform helpers for SDHCI host controllers
Samsung S5PC100 has 3 SDHCI controllers compatible with the one known from
previous SoCs series. Add required platform setup and support code that
the devices can be used with sdhci-s3c driver.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'arch/arm/mach-s5pc100')
-rw-r--r-- | arch/arm/mach-s5pc100/Kconfig | 6 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/cpu.c | 3 | ||||
-rw-r--r-- | arch/arm/mach-s5pc100/setup-sdhci.c | 65 |
4 files changed, 78 insertions, 0 deletions
diff --git a/arch/arm/mach-s5pc100/Kconfig b/arch/arm/mach-s5pc100/Kconfig index 36e7e0046c15..21b182121945 100644 --- a/arch/arm/mach-s5pc100/Kconfig +++ b/arch/arm/mach-s5pc100/Kconfig | |||
@@ -14,6 +14,12 @@ config CPU_S5PC100 | |||
14 | help | 14 | help |
15 | Enable S5PC100 CPU support | 15 | Enable S5PC100 CPU support |
16 | 16 | ||
17 | config S5PC100_SETUP_SDHCI | ||
18 | bool | ||
19 | select S5PC1XX_SETUP_SDHCI_GPIO | ||
20 | help | ||
21 | Internal helper functions for S5PC100 based SDHCI systems | ||
22 | |||
17 | config MACH_SMDKC100 | 23 | config MACH_SMDKC100 |
18 | bool "SMDKC100" | 24 | bool "SMDKC100" |
19 | select CPU_S5PC100 | 25 | select CPU_S5PC100 |
diff --git a/arch/arm/mach-s5pc100/Makefile b/arch/arm/mach-s5pc100/Makefile index afc89b381d7a..809ff10f768f 100644 --- a/arch/arm/mach-s5pc100/Makefile +++ b/arch/arm/mach-s5pc100/Makefile | |||
@@ -13,5 +13,9 @@ obj- := | |||
13 | 13 | ||
14 | obj-$(CONFIG_CPU_S5PC100) += cpu.o | 14 | obj-$(CONFIG_CPU_S5PC100) += cpu.o |
15 | 15 | ||
16 | # Helper and device support | ||
17 | |||
18 | obj-$(CONFIG_S5PC100_SETUP_SDHCI) += setup-sdhci.o | ||
19 | |||
16 | # machine support | 20 | # machine support |
17 | obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o | 21 | obj-$(CONFIG_MACH_SMDKC100) += mach-smdkc100.o |
diff --git a/arch/arm/mach-s5pc100/cpu.c b/arch/arm/mach-s5pc100/cpu.c index 1319e3d0ec39..d79e7574a852 100644 --- a/arch/arm/mach-s5pc100/cpu.c +++ b/arch/arm/mach-s5pc100/cpu.c | |||
@@ -75,6 +75,9 @@ void __init s5pc100_map_io(void) | |||
75 | iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); | 75 | iotable_init(s5pc100_iodesc, ARRAY_SIZE(s5pc100_iodesc)); |
76 | 76 | ||
77 | /* initialise device information early */ | 77 | /* initialise device information early */ |
78 | s5pc100_default_sdhci0(); | ||
79 | s5pc100_default_sdhci1(); | ||
80 | s5pc100_default_sdhci2(); | ||
78 | 81 | ||
79 | /* the i2c devices are directly compatible with s3c2440 */ | 82 | /* the i2c devices are directly compatible with s3c2440 */ |
80 | s3c_i2c0_setname("s3c2440-i2c"); | 83 | s3c_i2c0_setname("s3c2440-i2c"); |
diff --git a/arch/arm/mach-s5pc100/setup-sdhci.c b/arch/arm/mach-s5pc100/setup-sdhci.c new file mode 100644 index 000000000000..4385986a3da0 --- /dev/null +++ b/arch/arm/mach-s5pc100/setup-sdhci.c | |||
@@ -0,0 +1,65 @@ | |||
1 | /* linux/arch/arm/mach-s5pc100/setup-sdhci.c | ||
2 | * | ||
3 | * Copyright 2008 Samsung Electronics | ||
4 | * | ||
5 | * S5PC100 - Helper functions for settign up SDHCI device(s) (HSMMC) | ||
6 | * | ||
7 | * Based on mach-s3c6410/setup-sdhci.c | ||
8 | * | ||
9 | * This program 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/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/io.h> | ||
19 | |||
20 | #include <linux/mmc/card.h> | ||
21 | #include <linux/mmc/host.h> | ||
22 | |||
23 | #include <plat/regs-sdhci.h> | ||
24 | #include <plat/sdhci.h> | ||
25 | |||
26 | /* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */ | ||
27 | |||
28 | char *s5pc100_hsmmc_clksrcs[4] = { | ||
29 | [0] = "hsmmc", | ||
30 | [1] = "hsmmc", | ||
31 | /* [2] = "mmc_bus", not yet succesfuuly used yet */ | ||
32 | /* [3] = "48m", - note not succesfully used yet */ | ||
33 | }; | ||
34 | |||
35 | |||
36 | void s5pc100_setup_sdhci0_cfg_card(struct platform_device *dev, | ||
37 | void __iomem *r, | ||
38 | struct mmc_ios *ios, | ||
39 | struct mmc_card *card) | ||
40 | { | ||
41 | u32 ctrl2, ctrl3; | ||
42 | |||
43 | /* don't need to alter anything acording to card-type */ | ||
44 | |||
45 | writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4); | ||
46 | |||
47 | ctrl2 = readl(r + S3C_SDHCI_CONTROL2); | ||
48 | ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK; | ||
49 | ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR | | ||
50 | S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK | | ||
51 | S3C_SDHCI_CTRL2_ENFBCLKRX | | ||
52 | S3C_SDHCI_CTRL2_DFCNT_NONE | | ||
53 | S3C_SDHCI_CTRL2_ENCLKOUTHOLD); | ||
54 | |||
55 | if (ios->clock < 25 * 1000000) | ||
56 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 | | ||
57 | S3C_SDHCI_CTRL3_FCSEL2 | | ||
58 | S3C_SDHCI_CTRL3_FCSEL1 | | ||
59 | S3C_SDHCI_CTRL3_FCSEL0); | ||
60 | else | ||
61 | ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0); | ||
62 | |||
63 | writel(ctrl2, r + S3C_SDHCI_CONTROL2); | ||
64 | writel(ctrl3, r + S3C_SDHCI_CONTROL3); | ||
65 | } | ||