aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-s3c6410
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2008-12-18 11:17:37 -0500
committerBen Dooks <ben-linux@fluff.org>2008-12-18 11:17:37 -0500
commit56c035c9ce1f1850969778af6a4cc0b99089b6c8 (patch)
treeb6f1998be0c1e6bb623a0c55e8ba04d74bb58cf2 /arch/arm/mach-s3c6410
parent7f2754378f3522a42daafdbb9d2385f341008454 (diff)
parent438a5d42e052ec6126c5f1e24763b711210db33e (diff)
Merge branch 'next-s3c64xx-device' into next-merged
Conflicts: arch/arm/mach-s3c2440/mach-at2440evb.c
Diffstat (limited to 'arch/arm/mach-s3c6410')
-rw-r--r--arch/arm/mach-s3c6410/Kconfig41
-rw-r--r--arch/arm/mach-s3c6410/Makefile4
-rw-r--r--arch/arm/mach-s3c6410/cpu.c10
-rw-r--r--arch/arm/mach-s3c6410/mach-smdk6410.c96
-rw-r--r--arch/arm/mach-s3c6410/setup-sdhci.c102
5 files changed, 253 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig
index 75b1244cf8ab..1d5010070027 100644
--- a/arch/arm/mach-s3c6410/Kconfig
+++ b/arch/arm/mach-s3c6410/Kconfig
@@ -14,8 +14,49 @@ config CPU_S3C6410
14 help 14 help
15 Enable S3C6410 CPU support 15 Enable S3C6410 CPU support
16 16
17config S3C6410_SETUP_SDHCI
18 bool
19 help
20 Internal helper functions for S3C6410 based SDHCI systems
21
17config MACH_SMDK6410 22config MACH_SMDK6410
18 bool "SMDK6410" 23 bool "SMDK6410"
19 select CPU_S3C6410 24 select CPU_S3C6410
25 select S3C_DEV_HSMMC
26 select S3C_DEV_HSMMC1
27 select S3C_DEV_I2C1
28 select S3C_DEV_FB
29 select S3C6410_SETUP_SDHCI
30 select S3C64XX_SETUP_I2C1
31 select S3C64XX_SETUP_FB_24BPP
20 help 32 help
21 Machine support for the Samsung SMDK6410 33 Machine support for the Samsung SMDK6410
34
35# At least some of the SMDK6410s were shipped with the card detect
36# for the MMC/SD slots connected to the same input. This means that
37# either the boards need to be altered to have channel0 to an alternate
38# configuration or that only one slot can be used.
39
40choice
41 prompt "SMDK6410 MMC/SD slot setup"
42 depends on MACH_SMDK6410
43
44config SMDK6410_SD_CH0
45 bool "Use channel 0 only"
46 depends on MACH_SMDK6410
47 help
48 Select CON7 (channel 0) as the MMC/SD slot, as
49 at least some SMDK6410 boards come with the
50 resistors fitted so that the card detects for
51 channels 0 and 1 are the same.
52
53config SMDK6410_SD_CH1
54 bool "Use channel 1 only"
55 depends on MACH_SMDK6410
56 help
57 Select CON6 (channel 1) as the MMC/SD slot, as
58 at least some SMDK6410 boards come with the
59 resistors fitted so that the card detects for
60 channels 0 and 1 are the same.
61
62endchoice
diff --git a/arch/arm/mach-s3c6410/Makefile b/arch/arm/mach-s3c6410/Makefile
index 4a20a009990a..2cd4f189036b 100644
--- a/arch/arm/mach-s3c6410/Makefile
+++ b/arch/arm/mach-s3c6410/Makefile
@@ -14,6 +14,10 @@ obj- :=
14 14
15obj-$(CONFIG_CPU_S3C6410) += cpu.o 15obj-$(CONFIG_CPU_S3C6410) += cpu.o
16 16
17# Helper and device support
18
19obj-$(CONFIG_S3C6410_SETUP_SDHCI) += setup-sdhci.o
20
17# machine support 21# machine support
18 22
19obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o 23obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c
index 975cf88f0e84..6a73ca6b7a3a 100644
--- a/arch/arm/mach-s3c6410/cpu.c
+++ b/arch/arm/mach-s3c6410/cpu.c
@@ -35,6 +35,8 @@
35#include <plat/cpu.h> 35#include <plat/cpu.h>
36#include <plat/devs.h> 36#include <plat/devs.h>
37#include <plat/clock.h> 37#include <plat/clock.h>
38#include <plat/sdhci.h>
39#include <plat/iic-core.h>
38#include <plat/s3c6400.h> 40#include <plat/s3c6400.h>
39#include <plat/s3c6410.h> 41#include <plat/s3c6410.h>
40 42
@@ -51,6 +53,14 @@ static struct map_desc s3c6410_iodesc[] __initdata = {
51void __init s3c6410_map_io(void) 53void __init s3c6410_map_io(void)
52{ 54{
53 iotable_init(s3c6410_iodesc, ARRAY_SIZE(s3c6410_iodesc)); 55 iotable_init(s3c6410_iodesc, ARRAY_SIZE(s3c6410_iodesc));
56
57 /* initialise device information early */
58 s3c6410_default_sdhci0();
59 s3c6410_default_sdhci1();
60
61 /* the i2c devices are directly compatible with s3c2440 */
62 s3c_i2c0_setname("s3c2440-i2c");
63 s3c_i2c1_setname("s3c2440-i2c");
54} 64}
55 65
56void __init s3c6410_init_clocks(int xtal) 66void __init s3c6410_init_clocks(int xtal)
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c
index 9213a8ba283b..3c4d47145c83 100644
--- a/arch/arm/mach-s3c6410/mach-smdk6410.c
+++ b/arch/arm/mach-s3c6410/mach-smdk6410.c
@@ -20,18 +20,27 @@
20#include <linux/serial_core.h> 20#include <linux/serial_core.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/i2c.h>
24#include <linux/fb.h>
25#include <linux/gpio.h>
26#include <linux/delay.h>
27
28#include <video/platform_lcd.h>
23 29
24#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
25#include <asm/mach/map.h> 31#include <asm/mach/map.h>
26#include <asm/mach/irq.h> 32#include <asm/mach/irq.h>
27 33
28#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <mach/regs-fb.h>
29#include <mach/map.h> 36#include <mach/map.h>
30 37
31#include <asm/irq.h> 38#include <asm/irq.h>
32#include <asm/mach-types.h> 39#include <asm/mach-types.h>
33 40
34#include <plat/regs-serial.h> 41#include <plat/regs-serial.h>
42#include <plat/iic.h>
43#include <plat/fb.h>
35 44
36#include <plat/s3c6410.h> 45#include <plat/s3c6410.h>
37#include <plat/clock.h> 46#include <plat/clock.h>
@@ -59,9 +68,89 @@ static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = {
59 }, 68 },
60}; 69};
61 70
71/* framebuffer and LCD setup. */
72
73/* GPF15 = LCD backlight control
74 * GPF13 => Panel power
75 * GPN5 = LCD nRESET signal
76 * PWM_TOUT1 => backlight brightness
77 */
78
79static void smdk6410_lcd_power_set(struct plat_lcd_data *pd,
80 unsigned int power)
81{
82 if (power) {
83 gpio_direction_output(S3C64XX_GPF(13), 1);
84 gpio_direction_output(S3C64XX_GPF(15), 1);
85
86 /* fire nRESET on power up */
87 gpio_direction_output(S3C64XX_GPN(5), 0);
88 msleep(10);
89 gpio_direction_output(S3C64XX_GPN(5), 1);
90 msleep(1);
91 } else {
92 gpio_direction_output(S3C64XX_GPF(15), 0);
93 gpio_direction_output(S3C64XX_GPF(13), 0);
94 }
95}
96
97static struct plat_lcd_data smdk6410_lcd_power_data = {
98 .set_power = smdk6410_lcd_power_set,
99};
100
101static struct platform_device smdk6410_lcd_powerdev = {
102 .name = "platform-lcd",
103 .dev.parent = &s3c_device_fb.dev,
104 .dev.platform_data = &smdk6410_lcd_power_data,
105};
106
107static struct s3c_fb_pd_win smdk6410_fb_win0 = {
108 /* this is to ensure we use win0 */
109 .win_mode = {
110 .pixclock = 41094,
111 .left_margin = 8,
112 .right_margin = 13,
113 .upper_margin = 7,
114 .lower_margin = 5,
115 .hsync_len = 3,
116 .vsync_len = 1,
117 .xres = 800,
118 .yres = 480,
119 },
120 .max_bpp = 32,
121 .default_bpp = 16,
122};
123
124/* 405566 clocks per frame => 60Hz refresh requires 24333960Hz clock */
125static struct s3c_fb_platdata smdk6410_lcd_pdata __initdata = {
126 .setup_gpio = s3c64xx_fb_gpio_setup_24bpp,
127 .win[0] = &smdk6410_fb_win0,
128 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
129 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
130};
131
62struct map_desc smdk6410_iodesc[] = {}; 132struct map_desc smdk6410_iodesc[] = {};
63 133
64static struct platform_device *smdk6410_devices[] __initdata = { 134static struct platform_device *smdk6410_devices[] __initdata = {
135#ifdef CONFIG_SMDK6410_SD_CH0
136 &s3c_device_hsmmc0,
137#endif
138#ifdef CONFIG_SMDK6410_SD_CH1
139 &s3c_device_hsmmc1,
140#endif
141 &s3c_device_i2c0,
142 &s3c_device_i2c1,
143 &s3c_device_fb,
144 &smdk6410_lcd_powerdev,
145};
146
147static struct i2c_board_info i2c_devs0[] __initdata = {
148 { I2C_BOARD_INFO("24c08", 0x50), },
149 { I2C_BOARD_INFO("WM8580", 0X1b), },
150};
151
152static struct i2c_board_info i2c_devs1[] __initdata = {
153 { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */
65}; 154};
66 155
67static void __init smdk6410_map_io(void) 156static void __init smdk6410_map_io(void)
@@ -73,6 +162,13 @@ static void __init smdk6410_map_io(void)
73 162
74static void __init smdk6410_machine_init(void) 163static void __init smdk6410_machine_init(void)
75{ 164{
165 s3c_i2c0_set_platdata(NULL);
166 s3c_i2c1_set_platdata(NULL);
167 s3c_fb_set_platdata(&smdk6410_lcd_pdata);
168
169 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
170 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
171
76 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices)); 172 platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices));
77} 173}
78 174
diff --git a/arch/arm/mach-s3c6410/setup-sdhci.c b/arch/arm/mach-s3c6410/setup-sdhci.c
new file mode 100644
index 000000000000..0b5788bd5985
--- /dev/null
+++ b/arch/arm/mach-s3c6410/setup-sdhci.c
@@ -0,0 +1,102 @@
1/* linux/arch/arm/mach-s3c6410/setup-sdhci.c
2 *
3 * Copyright 2008 Simtec Electronics
4 * Copyright 2008 Simtec Electronics
5 * Ben Dooks <ben@simtec.co.uk>
6 * http://armlinux.simtec.co.uk/
7 *
8 * S3C6410 - Helper functions for settign up SDHCI device(s) (HSMMC)
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 <mach/gpio.h>
25#include <plat/gpio-cfg.h>
26#include <plat/regs-sdhci.h>
27#include <plat/sdhci.h>
28
29/* clock sources for the mmc bus clock, order as for the ctrl2[5..4] */
30
31char *s3c6410_hsmmc_clksrcs[4] = {
32 [0] = "hsmmc",
33 [1] = "hsmmc",
34 [2] = "mmc_bus",
35 /* [3] = "48m", - note not succesfully used yet */
36};
37
38void s3c6410_setup_sdhci0_cfg_gpio(struct platform_device *dev, int width)
39{
40 unsigned int gpio;
41 unsigned int end;
42
43 end = S3C64XX_GPG(2 + width);
44
45 /* Set all the necessary GPG pins to special-function 0 */
46 for (gpio = S3C64XX_GPG(0); gpio < end; gpio++) {
47 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
48 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
49 }
50
51 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
52 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(2));
53}
54
55void s3c6410_setup_sdhci0_cfg_card(struct platform_device *dev,
56 void __iomem *r,
57 struct mmc_ios *ios,
58 struct mmc_card *card)
59{
60 u32 ctrl2, ctrl3;
61
62 /* don't need to alter anything acording to card-type */
63
64 writel(S3C64XX_SDHCI_CONTROL4_DRIVE_9mA, r + S3C64XX_SDHCI_CONTROL4);
65
66 ctrl2 = readl(r + S3C_SDHCI_CONTROL2);
67 ctrl2 &= S3C_SDHCI_CTRL2_SELBASECLK_MASK;
68 ctrl2 |= (S3C64XX_SDHCI_CTRL2_ENSTAASYNCCLR |
69 S3C64XX_SDHCI_CTRL2_ENCMDCNFMSK |
70 S3C_SDHCI_CTRL2_ENFBCLKRX |
71 S3C_SDHCI_CTRL2_DFCNT_NONE |
72 S3C_SDHCI_CTRL2_ENCLKOUTHOLD);
73
74 if (ios->clock < 25 * 1000000)
75 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL3 |
76 S3C_SDHCI_CTRL3_FCSEL2 |
77 S3C_SDHCI_CTRL3_FCSEL1 |
78 S3C_SDHCI_CTRL3_FCSEL0);
79 else
80 ctrl3 = (S3C_SDHCI_CTRL3_FCSEL1 | S3C_SDHCI_CTRL3_FCSEL0);
81
82 printk(KERN_INFO "%s: CTRL 2=%08x, 3=%08x\n", __func__, ctrl2, ctrl3);
83 writel(ctrl2, r + S3C_SDHCI_CONTROL2);
84 writel(ctrl3, r + S3C_SDHCI_CONTROL3);
85}
86
87void s3c6410_setup_sdhci1_cfg_gpio(struct platform_device *dev, int width)
88{
89 unsigned int gpio;
90 unsigned int end;
91
92 end = S3C64XX_GPH(2 + width);
93
94 /* Set all the necessary GPG pins to special-function 0 */
95 for (gpio = S3C64XX_GPH(0); gpio < end; gpio++) {
96 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
97 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
98 }
99
100 s3c_gpio_setpull(S3C64XX_GPG(6), S3C_GPIO_PULL_UP);
101 s3c_gpio_cfgpin(S3C64XX_GPG(6), S3C_GPIO_SFN(3));
102}