aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c2416
diff options
context:
space:
mode:
authorKukjin Kim <kgene.kim@samsung.com>2011-01-06 04:44:09 -0500
committerKukjin Kim <kgene.kim@samsung.com>2011-01-06 04:44:09 -0500
commit854bf596b3be4f4b41c5b3bd8039e4828ec1ace6 (patch)
tree27b967178723f0230043dc0b0d1436d2eb81a29d /arch/arm/mach-s3c2416
parentab10f1dd914ad87e0370bd8b82f77dcd32b6d941 (diff)
parent13d27f05d7b2c41d59c6e4bd6fc4ea10d3302ec3 (diff)
Merge branch 'next-s3c24xx' into for-next
Diffstat (limited to 'arch/arm/mach-s3c2416')
-rw-r--r--arch/arm/mach-s3c2416/Kconfig12
-rw-r--r--arch/arm/mach-s3c2416/Makefile4
-rw-r--r--arch/arm/mach-s3c2416/clock.c18
-rw-r--r--arch/arm/mach-s3c2416/mach-smdk2416.c23
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c5
-rw-r--r--arch/arm/mach-s3c2416/setup-sdhci-gpio.c34
-rw-r--r--arch/arm/mach-s3c2416/setup-sdhci.c61
7 files changed, 152 insertions, 5 deletions
diff --git a/arch/arm/mach-s3c2416/Kconfig b/arch/arm/mach-s3c2416/Kconfig
index df8d14974c90..69b48a7d1dbd 100644
--- a/arch/arm/mach-s3c2416/Kconfig
+++ b/arch/arm/mach-s3c2416/Kconfig
@@ -31,6 +31,17 @@ config S3C2416_PM
31 help 31 help
32 Internal config node to apply S3C2416 power management 32 Internal config node to apply S3C2416 power management
33 33
34config S3C2416_SETUP_SDHCI
35 bool
36 select S3C2416_SETUP_SDHCI_GPIO
37 help
38 Internal helper functions for S3C2416 based SDHCI systems
39
40config S3C2416_SETUP_SDHCI_GPIO
41 bool
42 help
43 Common setup code for SDHCI gpio.
44
34menu "S3C2416 Machines" 45menu "S3C2416 Machines"
35 46
36config MACH_SMDK2416 47config MACH_SMDK2416
@@ -42,6 +53,7 @@ config MACH_SMDK2416
42 select S3C_DEV_HSMMC1 53 select S3C_DEV_HSMMC1
43 select S3C_DEV_NAND 54 select S3C_DEV_NAND
44 select S3C_DEV_USB_HOST 55 select S3C_DEV_USB_HOST
56 select S3C2416_SETUP_SDHCI
45 select S3C2416_PM if PM 57 select S3C2416_PM if PM
46 help 58 help
47 Say Y here if you are using an SMDK2416 59 Say Y here if you are using an SMDK2416
diff --git a/arch/arm/mach-s3c2416/Makefile b/arch/arm/mach-s3c2416/Makefile
index ef038d62ffdb..7b805b279caf 100644
--- a/arch/arm/mach-s3c2416/Makefile
+++ b/arch/arm/mach-s3c2416/Makefile
@@ -14,6 +14,10 @@ obj-$(CONFIG_CPU_S3C2416) += irq.o
14obj-$(CONFIG_S3C2416_PM) += pm.o 14obj-$(CONFIG_S3C2416_PM) += pm.o
15#obj-$(CONFIG_S3C2416_DMA) += dma.o 15#obj-$(CONFIG_S3C2416_DMA) += dma.o
16 16
17# Device setup
18obj-$(CONFIG_S3C2416_SETUP_SDHCI) += setup-sdhci.o
19obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o
20
17# Machine support 21# Machine support
18 22
19obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o 23obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
diff --git a/arch/arm/mach-s3c2416/clock.c b/arch/arm/mach-s3c2416/clock.c
index 7ccf5a2a2bfc..3b02d8506e25 100644
--- a/arch/arm/mach-s3c2416/clock.c
+++ b/arch/arm/mach-s3c2416/clock.c
@@ -38,12 +38,11 @@ static unsigned int armdiv[8] = {
38 [7] = 8, 38 [7] = 8,
39}; 39};
40 40
41/* ID to hardware numbering, 0 is HSMMC1, 1 is HSMMC0 */
42static struct clksrc_clk hsmmc_div[] = { 41static struct clksrc_clk hsmmc_div[] = {
43 [0] = { 42 [0] = {
44 .clk = { 43 .clk = {
45 .name = "hsmmc-div", 44 .name = "hsmmc-div",
46 .id = 1, 45 .id = 0,
47 .parent = &clk_esysclk.clk, 46 .parent = &clk_esysclk.clk,
48 }, 47 },
49 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 }, 48 .reg_div = { .reg = S3C2416_CLKDIV2, .size = 2, .shift = 6 },
@@ -51,7 +50,7 @@ static struct clksrc_clk hsmmc_div[] = {
51 [1] = { 50 [1] = {
52 .clk = { 51 .clk = {
53 .name = "hsmmc-div", 52 .name = "hsmmc-div",
54 .id = 0, 53 .id = 1,
55 .parent = &clk_esysclk.clk, 54 .parent = &clk_esysclk.clk,
56 }, 55 },
57 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 }, 56 .reg_div = { .reg = S3C2443_CLKDIV1, .size = 2, .shift = 6 },
@@ -61,7 +60,7 @@ static struct clksrc_clk hsmmc_div[] = {
61static struct clksrc_clk hsmmc_mux[] = { 60static struct clksrc_clk hsmmc_mux[] = {
62 [0] = { 61 [0] = {
63 .clk = { 62 .clk = {
64 .id = 1, 63 .id = 0,
65 .name = "hsmmc-if", 64 .name = "hsmmc-if",
66 .ctrlbit = (1 << 6), 65 .ctrlbit = (1 << 6),
67 .enable = s3c2443_clkcon_enable_s, 66 .enable = s3c2443_clkcon_enable_s,
@@ -77,7 +76,7 @@ static struct clksrc_clk hsmmc_mux[] = {
77 }, 76 },
78 [1] = { 77 [1] = {
79 .clk = { 78 .clk = {
80 .id = 0, 79 .id = 1,
81 .name = "hsmmc-if", 80 .name = "hsmmc-if",
82 .ctrlbit = (1 << 12), 81 .ctrlbit = (1 << 12),
83 .enable = s3c2443_clkcon_enable_s, 82 .enable = s3c2443_clkcon_enable_s,
@@ -93,6 +92,13 @@ static struct clksrc_clk hsmmc_mux[] = {
93 }, 92 },
94}; 93};
95 94
95static struct clk hsmmc0_clk = {
96 .name = "hsmmc",
97 .id = 0,
98 .parent = &clk_h,
99 .enable = s3c2443_clkcon_enable_h,
100 .ctrlbit = S3C2416_HCLKCON_HSMMC0,
101};
96 102
97static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) 103static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0)
98{ 104{
@@ -130,6 +136,8 @@ void __init s3c2416_init_clocks(int xtal)
130 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++) 136 for (ptr = 0; ptr < ARRAY_SIZE(clksrcs); ptr++)
131 s3c_register_clksrc(clksrcs[ptr], 1); 137 s3c_register_clksrc(clksrcs[ptr], 1);
132 138
139 s3c24xx_register_clock(&hsmmc0_clk);
140
133 s3c_pwmclk_init(); 141 s3c_pwmclk_init();
134 142
135} 143}
diff --git a/arch/arm/mach-s3c2416/mach-smdk2416.c b/arch/arm/mach-s3c2416/mach-smdk2416.c
index 7fc366476d7e..3f83177246c7 100644
--- a/arch/arm/mach-s3c2416/mach-smdk2416.c
+++ b/arch/arm/mach-s3c2416/mach-smdk2416.c
@@ -46,6 +46,7 @@
46#include <plat/devs.h> 46#include <plat/devs.h>
47#include <plat/cpu.h> 47#include <plat/cpu.h>
48#include <plat/nand.h> 48#include <plat/nand.h>
49#include <plat/sdhci.h>
49 50
50#include <plat/regs-fb-v4.h> 51#include <plat/regs-fb-v4.h>
51#include <plat/fb.h> 52#include <plat/fb.h>
@@ -110,6 +111,13 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
110 .ucon = UCON, 111 .ucon = UCON,
111 .ulcon = ULCON | 0x50, 112 .ulcon = ULCON | 0x50,
112 .ufcon = UFCON, 113 .ufcon = UFCON,
114 },
115 [3] = {
116 .hwport = 3,
117 .flags = 0,
118 .ucon = UCON,
119 .ulcon = ULCON,
120 .ufcon = UFCON,
113 } 121 }
114}; 122};
115 123
@@ -159,6 +167,18 @@ static struct s3c_fb_platdata smdk2416_fb_platdata = {
159 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, 167 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
160}; 168};
161 169
170static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
171 .max_width = 4,
172 .cd_type = S3C_SDHCI_CD_GPIO,
173 .ext_cd_gpio = S3C2410_GPF(1),
174 .ext_cd_gpio_invert = 1,
175};
176
177static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
178 .max_width = 4,
179 .cd_type = S3C_SDHCI_CD_NONE,
180};
181
162static struct platform_device *smdk2416_devices[] __initdata = { 182static struct platform_device *smdk2416_devices[] __initdata = {
163 &s3c_device_fb, 183 &s3c_device_fb,
164 &s3c_device_wdt, 184 &s3c_device_wdt,
@@ -180,6 +200,9 @@ static void __init smdk2416_machine_init(void)
180 s3c_i2c0_set_platdata(NULL); 200 s3c_i2c0_set_platdata(NULL);
181 s3c_fb_set_platdata(&smdk2416_fb_platdata); 201 s3c_fb_set_platdata(&smdk2416_fb_platdata);
182 202
203 s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
204 s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
205
183 gpio_request(S3C2410_GPB(4), "USBHost Power"); 206 gpio_request(S3C2410_GPB(4), "USBHost Power");
184 gpio_direction_output(S3C2410_GPB(4), 1); 207 gpio_direction_output(S3C2410_GPB(4), 1);
185 208
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index 63f39cdc0972..ba7fd8737434 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -53,6 +53,7 @@
53#include <plat/s3c2416.h> 53#include <plat/s3c2416.h>
54#include <plat/devs.h> 54#include <plat/devs.h>
55#include <plat/cpu.h> 55#include <plat/cpu.h>
56#include <plat/sdhci.h>
56 57
57#include <plat/iic-core.h> 58#include <plat/iic-core.h>
58#include <plat/fb-core.h> 59#include <plat/fb-core.h>
@@ -115,6 +116,10 @@ void __init s3c2416_map_io(void)
115 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown; 116 s3c24xx_gpiocfg_default.set_pull = s3c_gpio_setpull_updown;
116 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown; 117 s3c24xx_gpiocfg_default.get_pull = s3c_gpio_getpull_updown;
117 118
119 /* initialize device information early */
120 s3c2416_default_sdhci0();
121 s3c2416_default_sdhci1();
122
118 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc)); 123 iotable_init(s3c2416_iodesc, ARRAY_SIZE(s3c2416_iodesc));
119} 124}
120 125
diff --git a/arch/arm/mach-s3c2416/setup-sdhci-gpio.c b/arch/arm/mach-s3c2416/setup-sdhci-gpio.c
new file mode 100644
index 000000000000..f65cb3ef16ce
--- /dev/null
+++ b/arch/arm/mach-s3c2416/setup-sdhci-gpio.c
@@ -0,0 +1,34 @@
1/* linux/arch/arm/plat-s3c2416/setup-sdhci-gpio.c
2 *
3 * Copyright 2010 Promwad Innovation Company
4 * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
5 *
6 * S3C2416 - Helper functions for setting up SDHCI device(s) GPIO (HSMMC)
7 *
8 * Based on mach-s3c64xx/setup-sdhci-gpio.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <linux/io.h>
20#include <linux/gpio.h>
21
22#include <mach/regs-gpio.h>
23#include <plat/gpio-cfg.h>
24
25void s3c2416_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
26{
27 s3c_gpio_cfgrange_nopull(S3C2410_GPE(5), 2 + width, S3C_GPIO_SFN(2));
28}
29
30void s3c2416_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
31{
32 s3c_gpio_cfgrange_nopull(S3C2410_GPL(0), width, S3C_GPIO_SFN(2));
33 s3c_gpio_cfgrange_nopull(S3C2410_GPL(8), 2, S3C_GPIO_SFN(2));
34}
diff --git a/arch/arm/mach-s3c2416/setup-sdhci.c b/arch/arm/mach-s3c2416/setup-sdhci.c
new file mode 100644
index 000000000000..ed34fad8f2c6
--- /dev/null
+++ b/arch/arm/mach-s3c2416/setup-sdhci.c
@@ -0,0 +1,61 @@
1/* linux/arch/arm/mach-s3c2416/setup-sdhci.c
2 *
3 * Copyright 2010 Promwad Innovation Company
4 * Yauhen Kharuzhy <yauhen.kharuzhy@promwad.com>
5 *
6 * S3C2416 - Helper functions for settign up SDHCI device(s) (HSMMC)
7 *
8 * Based on mach-s3c64xx/setup-sdhci.c
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13*/
14
15#include <linux/kernel.h>
16#include <linux/types.h>
17#include <linux/interrupt.h>
18#include <linux/platform_device.h>
19#include <linux/io.h>
20
21#include <linux/mmc/card.h>
22#include <linux/mmc/host.h>
23
24#include <plat/regs-sdhci.h>
25#include <plat/sdhci.h>
26
27/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
28
29char *s3c2416_hsmmc_clksrcs[4] = {
30 [0] = "hsmmc",
31 [1] = "hsmmc",
32 [2] = "hsmmc-if",
33 /* [3] = "48m", - note not successfully used yet */
34};
35
36void s3c2416_setup_sdhci_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 ctrl2 = __raw_readl(r + S3C_SDHCI_CONTROL2);
44 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
45 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
46 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
47 S3C_SDHCI_CTRL2_ENFBCLKRX |
48 S3C_SDHCI_CTRL2_DFCNT_NONE |
49 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
50
51 if (ios->clock < 25 * 1000000)
52 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
53 S3C_SDHCI_CTRL3_FCSEL2 |
54 S3C_SDHCI_CTRL3_FCSEL1 |
55 S3C_SDHCI_CTRL3_FCSEL0);
56 else
57 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
58
59 __raw_writel(ctrl2, r + S3C_SDHCI_CONTROL2);
60 __raw_writel(ctrl3, r + S3C_SDHCI_CONTROL3);
61}