diff options
Diffstat (limited to 'arch/arm/mach-s3c6410')
-rw-r--r-- | arch/arm/mach-s3c6410/Kconfig | 62 | ||||
-rw-r--r-- | arch/arm/mach-s3c6410/Makefile | 23 | ||||
-rw-r--r-- | arch/arm/mach-s3c6410/cpu.c | 101 | ||||
-rw-r--r-- | arch/arm/mach-s3c6410/mach-smdk6410.c | 185 | ||||
-rw-r--r-- | arch/arm/mach-s3c6410/setup-sdhci.c | 102 |
5 files changed, 473 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c6410/Kconfig b/arch/arm/mach-s3c6410/Kconfig new file mode 100644 index 000000000000..1d5010070027 --- /dev/null +++ b/arch/arm/mach-s3c6410/Kconfig | |||
@@ -0,0 +1,62 @@ | |||
1 | # arch/arm/mach-s3c6410/Kconfig | ||
2 | # | ||
3 | # Copyright 2008 Openmoko, Inc. | ||
4 | # Copyright 2008 Simtec Electronics | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | # Configuration options for the S3C6410 CPU | ||
9 | |||
10 | config CPU_S3C6410 | ||
11 | bool | ||
12 | select CPU_S3C6400_INIT | ||
13 | select CPU_S3C6400_CLOCK | ||
14 | help | ||
15 | Enable S3C6410 CPU support | ||
16 | |||
17 | config S3C6410_SETUP_SDHCI | ||
18 | bool | ||
19 | help | ||
20 | Internal helper functions for S3C6410 based SDHCI systems | ||
21 | |||
22 | config MACH_SMDK6410 | ||
23 | bool "SMDK6410" | ||
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 | ||
32 | help | ||
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 | |||
40 | choice | ||
41 | prompt "SMDK6410 MMC/SD slot setup" | ||
42 | depends on MACH_SMDK6410 | ||
43 | |||
44 | config 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 | |||
53 | config 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 | |||
62 | endchoice | ||
diff --git a/arch/arm/mach-s3c6410/Makefile b/arch/arm/mach-s3c6410/Makefile new file mode 100644 index 000000000000..2cd4f189036b --- /dev/null +++ b/arch/arm/mach-s3c6410/Makefile | |||
@@ -0,0 +1,23 @@ | |||
1 | # arch/arm/plat-s3c6410/Makefile | ||
2 | # | ||
3 | # Copyright 2008 Openmoko, Inc. | ||
4 | # Copyright 2008 Simtec Electronics | ||
5 | # | ||
6 | # Licensed under GPLv2 | ||
7 | |||
8 | obj-y := | ||
9 | obj-m := | ||
10 | obj-n := | ||
11 | obj- := | ||
12 | |||
13 | # Core support for S3C6410 system | ||
14 | |||
15 | obj-$(CONFIG_CPU_S3C6410) += cpu.o | ||
16 | |||
17 | # Helper and device support | ||
18 | |||
19 | obj-$(CONFIG_S3C6410_SETUP_SDHCI) += setup-sdhci.o | ||
20 | |||
21 | # machine support | ||
22 | |||
23 | obj-$(CONFIG_MACH_SMDK6410) += mach-smdk6410.o | ||
diff --git a/arch/arm/mach-s3c6410/cpu.c b/arch/arm/mach-s3c6410/cpu.c new file mode 100644 index 000000000000..6a73ca6b7a3a --- /dev/null +++ b/arch/arm/mach-s3c6410/cpu.c | |||
@@ -0,0 +1,101 @@ | |||
1 | /* linux/arch/arm/mach-s3c6410/cpu.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 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | |||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/interrupt.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/clk.h> | ||
20 | #include <linux/io.h> | ||
21 | #include <linux/sysdev.h> | ||
22 | #include <linux/serial_core.h> | ||
23 | #include <linux/platform_device.h> | ||
24 | |||
25 | #include <asm/mach/arch.h> | ||
26 | #include <asm/mach/map.h> | ||
27 | #include <asm/mach/irq.h> | ||
28 | |||
29 | #include <mach/hardware.h> | ||
30 | #include <asm/irq.h> | ||
31 | |||
32 | #include <plat/cpu-freq.h> | ||
33 | #include <plat/regs-serial.h> | ||
34 | |||
35 | #include <plat/cpu.h> | ||
36 | #include <plat/devs.h> | ||
37 | #include <plat/clock.h> | ||
38 | #include <plat/sdhci.h> | ||
39 | #include <plat/iic-core.h> | ||
40 | #include <plat/s3c6400.h> | ||
41 | #include <plat/s3c6410.h> | ||
42 | |||
43 | /* Initial IO mappings */ | ||
44 | |||
45 | static struct map_desc s3c6410_iodesc[] __initdata = { | ||
46 | }; | ||
47 | |||
48 | /* s3c6410_map_io | ||
49 | * | ||
50 | * register the standard cpu IO areas | ||
51 | */ | ||
52 | |||
53 | void __init s3c6410_map_io(void) | ||
54 | { | ||
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"); | ||
64 | } | ||
65 | |||
66 | void __init s3c6410_init_clocks(int xtal) | ||
67 | { | ||
68 | printk(KERN_DEBUG "%s: initialising clocks\n", __func__); | ||
69 | s3c24xx_register_baseclocks(xtal); | ||
70 | s3c64xx_register_clocks(); | ||
71 | s3c6400_register_clocks(); | ||
72 | s3c6400_setup_clocks(); | ||
73 | } | ||
74 | |||
75 | void __init s3c6410_init_irq(void) | ||
76 | { | ||
77 | /* VIC0 is missing IRQ7, VIC1 is fully populated. */ | ||
78 | s3c64xx_init_irq(~0 & ~(1 << 7), ~0); | ||
79 | } | ||
80 | |||
81 | struct sysdev_class s3c6410_sysclass = { | ||
82 | .name = "s3c6410-core", | ||
83 | }; | ||
84 | |||
85 | static struct sys_device s3c6410_sysdev = { | ||
86 | .cls = &s3c6410_sysclass, | ||
87 | }; | ||
88 | |||
89 | static int __init s3c6410_core_init(void) | ||
90 | { | ||
91 | return sysdev_class_register(&s3c6410_sysclass); | ||
92 | } | ||
93 | |||
94 | core_initcall(s3c6410_core_init); | ||
95 | |||
96 | int __init s3c6410_init(void) | ||
97 | { | ||
98 | printk("S3C6410: Initialising architecture\n"); | ||
99 | |||
100 | return sysdev_register(&s3c6410_sysdev); | ||
101 | } | ||
diff --git a/arch/arm/mach-s3c6410/mach-smdk6410.c b/arch/arm/mach-s3c6410/mach-smdk6410.c new file mode 100644 index 000000000000..3c4d47145c83 --- /dev/null +++ b/arch/arm/mach-s3c6410/mach-smdk6410.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* linux/arch/arm/mach-s3c6410/mach-smdk6410.c | ||
2 | * | ||
3 | * Copyright 2008 Openmoko, Inc. | ||
4 | * Copyright 2008 Simtec Electronics | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * http://armlinux.simtec.co.uk/ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | ||
16 | #include <linux/interrupt.h> | ||
17 | #include <linux/list.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/serial_core.h> | ||
21 | #include <linux/platform_device.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> | ||
29 | |||
30 | #include <asm/mach/arch.h> | ||
31 | #include <asm/mach/map.h> | ||
32 | #include <asm/mach/irq.h> | ||
33 | |||
34 | #include <mach/hardware.h> | ||
35 | #include <mach/regs-fb.h> | ||
36 | #include <mach/map.h> | ||
37 | |||
38 | #include <asm/irq.h> | ||
39 | #include <asm/mach-types.h> | ||
40 | |||
41 | #include <plat/regs-serial.h> | ||
42 | #include <plat/iic.h> | ||
43 | #include <plat/fb.h> | ||
44 | |||
45 | #include <plat/s3c6410.h> | ||
46 | #include <plat/clock.h> | ||
47 | #include <plat/devs.h> | ||
48 | #include <plat/cpu.h> | ||
49 | |||
50 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | ||
51 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | ||
52 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | ||
53 | |||
54 | static struct s3c2410_uartcfg smdk6410_uartcfgs[] __initdata = { | ||
55 | [0] = { | ||
56 | .hwport = 0, | ||
57 | .flags = 0, | ||
58 | .ucon = 0x3c5, | ||
59 | .ulcon = 0x03, | ||
60 | .ufcon = 0x51, | ||
61 | }, | ||
62 | [1] = { | ||
63 | .hwport = 1, | ||
64 | .flags = 0, | ||
65 | .ucon = 0x3c5, | ||
66 | .ulcon = 0x03, | ||
67 | .ufcon = 0x51, | ||
68 | }, | ||
69 | }; | ||
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 | |||
79 | static 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 | |||
97 | static struct plat_lcd_data smdk6410_lcd_power_data = { | ||
98 | .set_power = smdk6410_lcd_power_set, | ||
99 | }; | ||
100 | |||
101 | static 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 | |||
107 | static 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 */ | ||
125 | static 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 | |||
132 | struct map_desc smdk6410_iodesc[] = {}; | ||
133 | |||
134 | static 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 | |||
147 | static struct i2c_board_info i2c_devs0[] __initdata = { | ||
148 | { I2C_BOARD_INFO("24c08", 0x50), }, | ||
149 | { I2C_BOARD_INFO("WM8580", 0X1b), }, | ||
150 | }; | ||
151 | |||
152 | static struct i2c_board_info i2c_devs1[] __initdata = { | ||
153 | { I2C_BOARD_INFO("24c128", 0x57), }, /* Samsung S524AD0XD1 */ | ||
154 | }; | ||
155 | |||
156 | static void __init smdk6410_map_io(void) | ||
157 | { | ||
158 | s3c64xx_init_io(smdk6410_iodesc, ARRAY_SIZE(smdk6410_iodesc)); | ||
159 | s3c24xx_init_clocks(12000000); | ||
160 | s3c24xx_init_uarts(smdk6410_uartcfgs, ARRAY_SIZE(smdk6410_uartcfgs)); | ||
161 | } | ||
162 | |||
163 | static void __init smdk6410_machine_init(void) | ||
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 | |||
172 | platform_add_devices(smdk6410_devices, ARRAY_SIZE(smdk6410_devices)); | ||
173 | } | ||
174 | |||
175 | MACHINE_START(SMDK6410, "SMDK6410") | ||
176 | /* Maintainer: Ben Dooks <ben@fluff.org> */ | ||
177 | .phys_io = S3C_PA_UART & 0xfff00000, | ||
178 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, | ||
179 | .boot_params = S3C64XX_PA_SDRAM + 0x100, | ||
180 | |||
181 | .init_irq = s3c6410_init_irq, | ||
182 | .map_io = smdk6410_map_io, | ||
183 | .init_machine = smdk6410_machine_init, | ||
184 | .timer = &s3c24xx_timer, | ||
185 | MACHINE_END | ||
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 | |||
31 | char *s3c6410_hsmmc_clksrcs[4] = { | ||
32 | [0] = "hsmmc", | ||
33 | [1] = "hsmmc", | ||
34 | [2] = "mmc_bus", | ||
35 | /* [3] = "48m", - note not succesfully used yet */ | ||
36 | }; | ||
37 | |||
38 | void 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 | |||
55 | void 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 | |||
87 | void 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 | } | ||