1 // SPDX-License-Identifier: GPL-2.0+
3 // Copyright (C) 2006 by OpenMoko, Inc.
4 // Author: Harald Welte <laforge@openmoko.org>
5 // All rights reserved.
7 #include <linux/kernel.h>
8 #include <linux/types.h>
9 #include <linux/interrupt.h>
10 #include <linux/list.h>
11 #include <linux/timer.h>
12 #include <linux/init.h>
13 #include <linux/gpio.h>
14 #include <linux/device.h>
15 #include <linux/platform_device.h>
16 #include <linux/serial_core.h>
17 #include <linux/serial_s3c.h>
18 #include <linux/spi/spi.h>
19 #include <linux/spi/spi_gpio.h>
21 #include <linux/mtd/mtd.h>
22 #include <linux/mtd/rawnand.h>
23 #include <linux/mtd/nand_ecc.h>
24 #include <linux/mtd/partitions.h>
26 #include <asm/mach/arch.h>
27 #include <asm/mach/map.h>
28 #include <asm/mach/irq.h>
30 #include <mach/hardware.h>
32 #include <asm/mach-types.h>
34 #include <linux/platform_data/leds-s3c24xx.h>
35 #include <mach/regs-lcd.h>
37 #include <linux/platform_data/mtd-nand-s3c2410.h>
38 #include <linux/platform_data/usb-s3c2410_udc.h>
39 #include <linux/platform_data/i2c-s3c2410.h>
40 #include <mach/gpio-samsung.h>
42 #include <plat/gpio-cfg.h>
43 #include <plat/devs.h>
46 #include <plat/samsung-time.h>
49 #include "common-smdk.h"
51 static struct map_desc qt2410_iodesc[] __initdata = {
52 { 0xe0000000, __phys_to_pfn(S3C2410_CS3+0x01000000), SZ_1M, MT_DEVICE }
55 #define UCON S3C2410_UCON_DEFAULT
56 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
57 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
59 static struct s3c2410_uartcfg smdk2410_uartcfgs[] = {
85 static struct s3c2410fb_display qt2410_lcd_cfg[] __initdata = {
87 /* Configuration for 640x480 SHARP LQ080V3DG01 */
88 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
89 S3C2410_LCDCON5_INVVLINE |
90 S3C2410_LCDCON5_INVVFRAME |
91 S3C2410_LCDCON5_PWREN |
92 S3C2410_LCDCON5_HWSWP,
94 .type = S3C2410_LCDCON1_TFT,
98 .pixclock = 40000, /* HCLK/4 */
110 /* Configuration for 480x640 toppoly TD028TTEC1 */
111 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
112 S3C2410_LCDCON5_INVVLINE |
113 S3C2410_LCDCON5_INVVFRAME |
114 S3C2410_LCDCON5_PWREN |
115 S3C2410_LCDCON5_HWSWP,
117 .type = S3C2410_LCDCON1_TFT,
120 .pixclock = 40000, /* HCLK/4 */
132 /* Config for 240x320 LCD */
133 .lcdcon5 = S3C2410_LCDCON5_FRM565 |
134 S3C2410_LCDCON5_INVVLINE |
135 S3C2410_LCDCON5_INVVFRAME |
136 S3C2410_LCDCON5_PWREN |
137 S3C2410_LCDCON5_HWSWP,
139 .type = S3C2410_LCDCON1_TFT,
142 .pixclock = 100000, /* HCLK/10 */
156 static struct s3c2410fb_mach_info qt2410_fb_info __initdata = {
157 .displays = qt2410_lcd_cfg,
158 .num_displays = ARRAY_SIZE(qt2410_lcd_cfg),
159 .default_display = 0,
161 .lpcsel = ((0xCE6) & ~7) | 1<<4,
166 static struct resource qt2410_cs89x0_resources[] = {
167 [0] = DEFINE_RES_MEM(0x19000000, 17),
168 [1] = DEFINE_RES_IRQ(IRQ_EINT9),
171 static struct platform_device qt2410_cs89x0 = {
172 .name = "cirrus-cs89x0",
173 .num_resources = ARRAY_SIZE(qt2410_cs89x0_resources),
174 .resource = qt2410_cs89x0_resources,
179 static struct s3c24xx_led_platdata qt2410_pdata_led = {
180 .gpio = S3C2410_GPB(0),
181 .flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
183 .def_trigger = "timer",
186 static struct platform_device qt2410_led = {
187 .name = "s3c24xx_led",
190 .platform_data = &qt2410_pdata_led,
196 static struct spi_gpio_platform_data spi_gpio_cfg = {
197 .sck = S3C2410_GPG(7),
198 .mosi = S3C2410_GPG(6),
199 .miso = S3C2410_GPG(5),
202 static struct platform_device qt2410_spi = {
205 .dev.platform_data = &spi_gpio_cfg,
210 static struct platform_device *qt2410_devices[] __initdata = {
217 &s3c_device_usbgadget,
223 static struct mtd_partition __initdata qt2410_nand_part[] = {
230 .name = "U-Boot environment",
251 static struct s3c2410_nand_set __initdata qt2410_nand_sets[] = {
255 .nr_partitions = ARRAY_SIZE(qt2410_nand_part),
256 .partitions = qt2410_nand_part,
260 /* choose a set of timings which should suit most 512Mbit
264 static struct s3c2410_platform_nand __initdata qt2410_nand_info = {
268 .nr_sets = ARRAY_SIZE(qt2410_nand_sets),
269 .sets = qt2410_nand_sets,
270 .ecc_mode = NAND_ECC_SOFT,
275 static struct s3c2410_udc_mach_info qt2410_udc_cfg = {
278 static char tft_type = 's';
280 static int __init qt2410_tft_setup(char *str)
286 __setup("tft=", qt2410_tft_setup);
288 static void __init qt2410_map_io(void)
290 s3c24xx_init_io(qt2410_iodesc, ARRAY_SIZE(qt2410_iodesc));
291 s3c24xx_init_uarts(smdk2410_uartcfgs, ARRAY_SIZE(smdk2410_uartcfgs));
292 samsung_set_timer_source(SAMSUNG_PWM3, SAMSUNG_PWM4);
295 static void __init qt2410_init_time(void)
297 s3c2410_init_clocks(12000000);
298 samsung_timer_init();
301 static void __init qt2410_machine_init(void)
303 s3c_nand_set_platdata(&qt2410_nand_info);
306 case 'p': /* production */
307 qt2410_fb_info.default_display = 1;
310 qt2410_fb_info.default_display = 0;
312 case 's': /* small */
314 qt2410_fb_info.default_display = 2;
317 s3c24xx_fb_set_platdata(&qt2410_fb_info);
319 /* set initial state of the LED GPIO */
320 WARN_ON(gpio_request_one(S3C2410_GPB(0), GPIOF_OUT_INIT_HIGH, NULL));
321 gpio_free(S3C2410_GPB(0));
323 s3c24xx_udc_set_platdata(&qt2410_udc_cfg);
324 s3c_i2c0_set_platdata(NULL);
326 WARN_ON(gpio_request(S3C2410_GPB(5), "spi cs"));
327 gpio_direction_output(S3C2410_GPB(5), 1);
329 platform_add_devices(qt2410_devices, ARRAY_SIZE(qt2410_devices));
333 MACHINE_START(QT2410, "QT2410")
334 .atag_offset = 0x100,
335 .map_io = qt2410_map_io,
336 .init_irq = s3c2410_init_irq,
337 .init_machine = qt2410_machine_init,
338 .init_time = qt2410_init_time,