diff options
author | Kukjin Kim <kgene.kim@samsung.com> | 2011-01-06 04:44:09 -0500 |
---|---|---|
committer | Kukjin Kim <kgene.kim@samsung.com> | 2011-01-06 04:44:09 -0500 |
commit | 854bf596b3be4f4b41c5b3bd8039e4828ec1ace6 (patch) | |
tree | 27b967178723f0230043dc0b0d1436d2eb81a29d /arch/arm/mach-s3c2416 | |
parent | ab10f1dd914ad87e0370bd8b82f77dcd32b6d941 (diff) | |
parent | 13d27f05d7b2c41d59c6e4bd6fc4ea10d3302ec3 (diff) |
Merge branch 'next-s3c24xx' into for-next
Diffstat (limited to 'arch/arm/mach-s3c2416')
-rw-r--r-- | arch/arm/mach-s3c2416/Kconfig | 12 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/Makefile | 4 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/clock.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/mach-smdk2416.c | 23 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/s3c2416.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/setup-sdhci-gpio.c | 34 | ||||
-rw-r--r-- | arch/arm/mach-s3c2416/setup-sdhci.c | 61 |
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 | ||
34 | config S3C2416_SETUP_SDHCI | ||
35 | bool | ||
36 | select S3C2416_SETUP_SDHCI_GPIO | ||
37 | help | ||
38 | Internal helper functions for S3C2416 based SDHCI systems | ||
39 | |||
40 | config S3C2416_SETUP_SDHCI_GPIO | ||
41 | bool | ||
42 | help | ||
43 | Common setup code for SDHCI gpio. | ||
44 | |||
34 | menu "S3C2416 Machines" | 45 | menu "S3C2416 Machines" |
35 | 46 | ||
36 | config MACH_SMDK2416 | 47 | config 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 | |||
14 | obj-$(CONFIG_S3C2416_PM) += pm.o | 14 | obj-$(CONFIG_S3C2416_PM) += pm.o |
15 | #obj-$(CONFIG_S3C2416_DMA) += dma.o | 15 | #obj-$(CONFIG_S3C2416_DMA) += dma.o |
16 | 16 | ||
17 | # Device setup | ||
18 | obj-$(CONFIG_S3C2416_SETUP_SDHCI) += setup-sdhci.o | ||
19 | obj-$(CONFIG_S3C2416_SETUP_SDHCI_GPIO) += setup-sdhci-gpio.o | ||
20 | |||
17 | # Machine support | 21 | # Machine support |
18 | 22 | ||
19 | obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o | 23 | obj-$(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 */ | ||
42 | static struct clksrc_clk hsmmc_div[] = { | 41 | static 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[] = { | |||
61 | static struct clksrc_clk hsmmc_mux[] = { | 60 | static 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 | ||
95 | static 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 | ||
97 | static inline unsigned int s3c2416_fclk_div(unsigned long clkcon0) | 103 | static 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 | ||
170 | static 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 | |||
177 | static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = { | ||
178 | .max_width = 4, | ||
179 | .cd_type = S3C_SDHCI_CD_NONE, | ||
180 | }; | ||
181 | |||
162 | static struct platform_device *smdk2416_devices[] __initdata = { | 182 | static 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 | |||
25 | void 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 | |||
30 | void 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 | |||
29 | char *s3c2416_hsmmc_clksrcs[4] = { | ||
30 | [0] = "hsmmc", | ||
31 | [1] = "hsmmc", | ||
32 | [2] = "hsmmc-if", | ||
33 | /* [3] = "48m", - note not successfully used yet */ | ||
34 | }; | ||
35 | |||
36 | void 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 | } | ||