1 /* linux/arch/arm/mach-s3c2410/mach-qt2410.c
3 * Copyright (C) 2006 by OpenMoko, Inc.
4 * Author: Harald Welte <laforge@openmoko.org>
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 #include <linux/kernel.h>
25 #include <linux/types.h>
26 #include <linux/interrupt.h>
27 #include <linux/list.h>
28 #include <linux/timer.h>
29 #include <linux/init.h>
30 #include <linux/platform_device.h>
31 #include <linux/serial_core.h>
32 #include <linux/spi/spi.h>
33 #include <linux/spi/spi_bitbang.h>
35 #include <linux/mtd/mtd.h>
36 #include <linux/mtd/nand.h>
37 #include <linux/mtd/nand_ecc.h>
38 #include <linux/mtd/partitions.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/map.h>
42 #include <asm/mach/irq.h>
44 #include <asm/hardware.h>
47 #include <asm/mach-types.h>
49 #include <asm/arch/regs-gpio.h>
50 #include <asm/arch/leds-gpio.h>
51 #include <asm/arch/regs-serial.h>
52 #include <asm/arch/fb.h>
53 #include <asm/arch/nand.h>
54 #include <asm/arch/udc.h>
55 #include <asm/arch/spi.h>
56 #include <asm/arch/spi-gpio.h>
58 #include <asm/plat-s3c24xx/common-smdk.h>
59 #include <asm/plat-s3c24xx/devs.h>
60 #include <asm/plat-s3c24xx/cpu.h>
61 #include <asm/plat-s3c24xx/pm.h>
63 static struct map_desc qt2410_iodesc
[] __initdata
= {
64 { 0xe0000000, __phys_to_pfn(S3C2410_CS3
+0x01000000), SZ_1M
, MT_DEVICE
}
67 #define UCON S3C2410_UCON_DEFAULT
68 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
69 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
71 static struct s3c2410_uartcfg smdk2410_uartcfgs
[] = {
97 /* Configuration for 640x480 SHARP LQ080V3DG01 */
98 static struct s3c2410fb_mach_info qt2410_biglcd_cfg __initdata
= {
101 .lcdcon1
= S3C2410_LCDCON1_TFT16BPP
|
102 S3C2410_LCDCON1_TFT
|
103 S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */
105 .lcdcon2
= S3C2410_LCDCON2_VBPD(18) | /* 19 */
106 S3C2410_LCDCON2_LINEVAL(479) |
107 S3C2410_LCDCON2_VFPD(10) | /* 11 */
108 S3C2410_LCDCON2_VSPW(14), /* 15 */
110 .lcdcon3
= S3C2410_LCDCON3_HBPD(43) | /* 44 */
111 S3C2410_LCDCON3_HOZVAL(639) | /* 640 */
112 S3C2410_LCDCON3_HFPD(115), /* 116 */
114 .lcdcon4
= S3C2410_LCDCON4_MVAL(0) |
115 S3C2410_LCDCON4_HSPW(95), /* 96 */
117 .lcdcon5
= S3C2410_LCDCON5_FRM565
|
118 S3C2410_LCDCON5_INVVLINE
|
119 S3C2410_LCDCON5_INVVFRAME
|
120 S3C2410_LCDCON5_PWREN
|
121 S3C2410_LCDCON5_HWSWP
,
124 .lpcsel
= ((0xCE6) & ~7) | 1<<4,
148 /* Configuration for 480x640 toppoly TD028TTEC1 */
149 static struct s3c2410fb_mach_info qt2410_prodlcd_cfg __initdata
= {
152 .lcdcon1
= S3C2410_LCDCON1_TFT16BPP
|
153 S3C2410_LCDCON1_TFT
|
154 S3C2410_LCDCON1_CLKVAL(0x01), /* HCLK/4 */
156 .lcdcon2
= S3C2410_LCDCON2_VBPD(1) | /* 2 */
157 S3C2410_LCDCON2_LINEVAL(639) |/* 640 */
158 S3C2410_LCDCON2_VFPD(3) | /* 4 */
159 S3C2410_LCDCON2_VSPW(1), /* 2 */
161 .lcdcon3
= S3C2410_LCDCON3_HBPD(7) | /* 8 */
162 S3C2410_LCDCON3_HOZVAL(479) | /* 479 */
163 S3C2410_LCDCON3_HFPD(23), /* 24 */
165 .lcdcon4
= S3C2410_LCDCON4_MVAL(0) |
166 S3C2410_LCDCON4_HSPW(7), /* 8 */
168 .lcdcon5
= S3C2410_LCDCON5_FRM565
|
169 S3C2410_LCDCON5_INVVLINE
|
170 S3C2410_LCDCON5_INVVFRAME
|
171 S3C2410_LCDCON5_PWREN
|
172 S3C2410_LCDCON5_HWSWP
,
175 .lpcsel
= ((0xCE6) & ~7) | 1<<4,
199 /* Config for 240x320 LCD */
200 static struct s3c2410fb_mach_info qt2410_lcd_cfg __initdata
= {
203 .lcdcon1
= S3C2410_LCDCON1_TFT16BPP
|
204 S3C2410_LCDCON1_TFT
|
205 S3C2410_LCDCON1_CLKVAL(0x04),
207 .lcdcon2
= S3C2410_LCDCON2_VBPD(1) |
208 S3C2410_LCDCON2_LINEVAL(319) |
209 S3C2410_LCDCON2_VFPD(6) |
210 S3C2410_LCDCON2_VSPW(3),
212 .lcdcon3
= S3C2410_LCDCON3_HBPD(12) |
213 S3C2410_LCDCON3_HOZVAL(239) |
214 S3C2410_LCDCON3_HFPD(7),
216 .lcdcon4
= S3C2410_LCDCON4_MVAL(0) |
217 S3C2410_LCDCON4_HSPW(3),
219 .lcdcon5
= S3C2410_LCDCON5_FRM565
|
220 S3C2410_LCDCON5_INVVLINE
|
221 S3C2410_LCDCON5_INVVFRAME
|
222 S3C2410_LCDCON5_PWREN
|
223 S3C2410_LCDCON5_HWSWP
,
226 .lpcsel
= ((0xCE6) & ~7) | 1<<4,
252 static struct resource qt2410_cs89x0_resources
[] = {
255 .end
= 0x19000000 + 16,
256 .flags
= IORESOURCE_MEM
,
261 .flags
= IORESOURCE_IRQ
,
265 static struct platform_device qt2410_cs89x0
= {
266 .name
= "cirrus-cs89x0",
267 .num_resources
= ARRAY_SIZE(qt2410_cs89x0_resources
),
268 .resource
= qt2410_cs89x0_resources
,
273 static struct s3c24xx_led_platdata qt2410_pdata_led
= {
274 .gpio
= S3C2410_GPB0
,
275 .flags
= S3C24XX_LEDF_ACTLOW
| S3C24XX_LEDF_TRISTATE
,
277 .def_trigger
= "timer",
280 static struct platform_device qt2410_led
= {
281 .name
= "s3c24xx_led",
284 .platform_data
= &qt2410_pdata_led
,
290 static void spi_gpio_cs(struct s3c2410_spigpio_info
*spi
, int cs
)
293 case BITBANG_CS_ACTIVE
:
294 s3c2410_gpio_setpin(S3C2410_GPB5
, 0);
296 case BITBANG_CS_INACTIVE
:
297 s3c2410_gpio_setpin(S3C2410_GPB5
, 1);
302 static struct s3c2410_spigpio_info spi_gpio_cfg
= {
303 .pin_clk
= S3C2410_GPG7
,
304 .pin_mosi
= S3C2410_GPG6
,
305 .pin_miso
= S3C2410_GPG5
,
306 .chip_select
= &spi_gpio_cs
,
310 static struct platform_device qt2410_spi
= {
311 .name
= "s3c24xx-spi-gpio",
314 .platform_data
= &spi_gpio_cfg
,
320 static struct platform_device
*qt2410_devices
[] __initdata
= {
327 &s3c_device_usbgadget
,
333 static struct mtd_partition qt2410_nand_part
[] = {
340 .name
= "U-Boot environment",
361 static struct s3c2410_nand_set qt2410_nand_sets
[] = {
365 .nr_partitions
= ARRAY_SIZE(qt2410_nand_part
),
366 .partitions
= qt2410_nand_part
,
370 /* choose a set of timings which should suit most 512Mbit
374 static struct s3c2410_platform_nand qt2410_nand_info
= {
378 .nr_sets
= ARRAY_SIZE(qt2410_nand_sets
),
379 .sets
= qt2410_nand_sets
,
384 static struct s3c2410_udc_mach_info qt2410_udc_cfg
= {
387 static char tft_type
= 's';
389 static int __init
qt2410_tft_setup(char *str
)
395 __setup("tft=", qt2410_tft_setup
);
397 static void __init
qt2410_map_io(void)
399 s3c24xx_init_io(qt2410_iodesc
, ARRAY_SIZE(qt2410_iodesc
));
400 s3c24xx_init_clocks(12*1000*1000);
401 s3c24xx_init_uarts(smdk2410_uartcfgs
, ARRAY_SIZE(smdk2410_uartcfgs
));
404 static void __init
qt2410_machine_init(void)
406 s3c_device_nand
.dev
.platform_data
= &qt2410_nand_info
;
409 case 'p': /* production */
410 s3c24xx_fb_set_platdata(&qt2410_prodlcd_cfg
);
413 s3c24xx_fb_set_platdata(&qt2410_biglcd_cfg
);
415 case 's': /* small */
417 s3c24xx_fb_set_platdata(&qt2410_lcd_cfg
);
421 s3c2410_gpio_cfgpin(S3C2410_GPB0
, S3C2410_GPIO_OUTPUT
);
422 s3c2410_gpio_setpin(S3C2410_GPB0
, 1);
424 s3c24xx_udc_set_platdata(&qt2410_udc_cfg
);
426 s3c2410_gpio_cfgpin(S3C2410_GPB5
, S3C2410_GPIO_OUTPUT
);
428 platform_add_devices(qt2410_devices
, ARRAY_SIZE(qt2410_devices
));
432 MACHINE_START(QT2410
, "QT2410")
433 .phys_io
= S3C2410_PA_UART
,
434 .io_pg_offst
= (((u32
)S3C24XX_VA_UART
) >> 18) & 0xfffc,
435 .boot_params
= S3C2410_SDRAM_PA
+ 0x100,
436 .map_io
= qt2410_map_io
,
437 .init_irq
= s3c24xx_init_irq
,
438 .init_machine
= qt2410_machine_init
,
439 .timer
= &s3c24xx_timer
,