]>
Commit | Line | Data |
---|---|---|
e119766f BM |
1 | /* linux/arch/arm/mach-s5pc100/mach-smdkc100.c |
2 | * | |
3 | * Copyright 2009 Samsung Electronics Co. | |
4 | * Author: Byungho Min <bhmin@samsung.com> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | * | |
10 | */ | |
11 | ||
12 | #include <linux/kernel.h> | |
13 | #include <linux/types.h> | |
14 | #include <linux/interrupt.h> | |
15 | #include <linux/list.h> | |
16 | #include <linux/timer.h> | |
17 | #include <linux/init.h> | |
18 | #include <linux/serial_core.h> | |
19 | #include <linux/platform_device.h> | |
20 | #include <linux/io.h> | |
21 | #include <linux/gpio.h> | |
22 | #include <linux/i2c.h> | |
23 | #include <linux/fb.h> | |
24 | #include <linux/delay.h> | |
25 | ||
26 | #include <asm/mach/arch.h> | |
27 | #include <asm/mach/map.h> | |
28 | ||
29 | #include <mach/map.h> | |
079b0324 KP |
30 | #include <mach/regs-fb.h> |
31 | #include <video/platform_lcd.h> | |
e119766f BM |
32 | |
33 | #include <asm/irq.h> | |
34 | #include <asm/mach-types.h> | |
35 | ||
36 | #include <plat/regs-serial.h> | |
079b0324 KP |
37 | #include <plat/gpio-cfg.h> |
38 | #include <plat/regs-gpio.h> | |
e119766f BM |
39 | |
40 | #include <plat/clock.h> | |
41 | #include <plat/devs.h> | |
42 | #include <plat/cpu.h> | |
43 | #include <plat/s5pc100.h> | |
079b0324 | 44 | #include <plat/fb.h> |
067f131d | 45 | #include <plat/iic.h> |
e119766f BM |
46 | |
47 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) | |
48 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) | |
49 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) | |
50 | ||
51 | static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = { | |
52 | [0] = { | |
53 | .hwport = 0, | |
54 | .flags = 0, | |
55 | .ucon = 0x3c5, | |
56 | .ulcon = 0x03, | |
57 | .ufcon = 0x51, | |
58 | }, | |
59 | [1] = { | |
60 | .hwport = 1, | |
61 | .flags = 0, | |
62 | .ucon = 0x3c5, | |
63 | .ulcon = 0x03, | |
64 | .ufcon = 0x51, | |
65 | }, | |
66 | [2] = { | |
67 | .hwport = 2, | |
68 | .flags = 0, | |
69 | .ucon = 0x3c5, | |
70 | .ulcon = 0x03, | |
71 | .ufcon = 0x51, | |
72 | }, | |
73 | [3] = { | |
74 | .hwport = 3, | |
75 | .flags = 0, | |
76 | .ucon = 0x3c5, | |
77 | .ulcon = 0x03, | |
78 | .ufcon = 0x51, | |
79 | }, | |
80 | }; | |
81 | ||
067f131d KP |
82 | /* I2C0 */ |
83 | static struct i2c_board_info i2c_devs0[] __initdata = { | |
84 | }; | |
85 | ||
86 | /* I2C1 */ | |
87 | static struct i2c_board_info i2c_devs1[] __initdata = { | |
88 | }; | |
89 | ||
079b0324 KP |
90 | /* LCD power controller */ |
91 | static void smdkc100_lcd_power_set(struct plat_lcd_data *pd, | |
92 | unsigned int power) | |
93 | { | |
94 | /* backlight */ | |
95 | gpio_direction_output(S5PC100_GPD(0), power); | |
96 | ||
97 | if (power) { | |
98 | /* module reset */ | |
99 | gpio_direction_output(S5PC100_GPH0(6), 1); | |
100 | mdelay(100); | |
101 | gpio_direction_output(S5PC100_GPH0(6), 0); | |
102 | mdelay(10); | |
103 | gpio_direction_output(S5PC100_GPH0(6), 1); | |
104 | mdelay(10); | |
105 | } | |
106 | } | |
107 | ||
108 | static struct plat_lcd_data smdkc100_lcd_power_data = { | |
109 | .set_power = smdkc100_lcd_power_set, | |
110 | }; | |
111 | ||
112 | static struct platform_device smdkc100_lcd_powerdev = { | |
113 | .name = "platform-lcd", | |
114 | .dev.parent = &s3c_device_fb.dev, | |
115 | .dev.platform_data = &smdkc100_lcd_power_data, | |
116 | }; | |
117 | ||
118 | /* Frame Buffer */ | |
119 | static struct s3c_fb_pd_win smdkc100_fb_win0 = { | |
120 | /* this is to ensure we use win0 */ | |
121 | .win_mode = { | |
122 | .refresh = 70, | |
123 | .pixclock = (8+13+3+800)*(7+5+1+480), | |
124 | .left_margin = 8, | |
125 | .right_margin = 13, | |
126 | .upper_margin = 7, | |
127 | .lower_margin = 5, | |
128 | .hsync_len = 3, | |
129 | .vsync_len = 1, | |
130 | .xres = 800, | |
131 | .yres = 480, | |
132 | }, | |
133 | .max_bpp = 32, | |
134 | .default_bpp = 16, | |
135 | }; | |
136 | ||
137 | static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = { | |
138 | .win[0] = &smdkc100_fb_win0, | |
139 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, | |
140 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, | |
141 | .setup_gpio = s5pc100_fb_gpio_setup_24bpp, | |
142 | }; | |
143 | ||
e119766f BM |
144 | static struct map_desc smdkc100_iodesc[] = {}; |
145 | ||
146 | static struct platform_device *smdkc100_devices[] __initdata = { | |
067f131d KP |
147 | &s3c_device_i2c0, |
148 | &s3c_device_i2c1, | |
079b0324 | 149 | &s3c_device_fb, |
0c318628 KP |
150 | &s3c_device_hsmmc0, |
151 | &s3c_device_hsmmc1, | |
152 | &s3c_device_hsmmc2, | |
079b0324 | 153 | &smdkc100_lcd_powerdev, |
e119766f BM |
154 | }; |
155 | ||
156 | static void __init smdkc100_map_io(void) | |
157 | { | |
158 | s5pc1xx_init_io(smdkc100_iodesc, ARRAY_SIZE(smdkc100_iodesc)); | |
159 | s3c24xx_init_clocks(12000000); | |
160 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); | |
161 | } | |
162 | ||
163 | static void __init smdkc100_machine_init(void) | |
164 | { | |
067f131d KP |
165 | /* I2C */ |
166 | s3c_i2c0_set_platdata(NULL); | |
167 | s3c_i2c1_set_platdata(NULL); | |
168 | i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); | |
169 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); | |
170 | ||
079b0324 KP |
171 | s3c_fb_set_platdata(&smdkc100_lcd_pdata); |
172 | ||
173 | /* LCD init */ | |
174 | gpio_request(S5PC100_GPD(0), "GPD"); | |
175 | gpio_request(S5PC100_GPH0(6), "GPH0"); | |
176 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); | |
e119766f BM |
177 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); |
178 | } | |
179 | ||
180 | MACHINE_START(SMDKC100, "SMDKC100") | |
181 | /* Maintainer: Byungho Min <bhmin@samsung.com> */ | |
b0cc3031 | 182 | .phys_io = S5PC100_PA_UART & 0xfff00000, |
e119766f BM |
183 | .io_pg_offst = (((u32)S5PC1XX_VA_UART) >> 18) & 0xfffc, |
184 | .boot_params = S5PC100_PA_SDRAM + 0x100, | |
185 | ||
186 | .init_irq = s5pc100_init_irq, | |
187 | .map_io = smdkc100_map_io, | |
188 | .init_machine = smdkc100_machine_init, | |
189 | .timer = &s3c24xx_timer, | |
190 | MACHINE_END |