blob: ead292ce1e0d72f637a26c949ccb3d0ca9c59e9e [file] [log] [blame]
Byungho Mine1197662009-06-23 21:40:28 +09001/* 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>
Naveen Krishna Ch2211f282010-06-22 07:54:18 +090025#include <linux/input.h>
Banajit Goswamibaa0c062011-02-28 20:37:21 +053026#include <linux/pwm_backlight.h>
Byungho Mine1197662009-06-23 21:40:28 +090027
28#include <asm/mach/arch.h>
29#include <asm/mach/map.h>
30
31#include <mach/map.h>
Banajit Goswamibaa0c062011-02-28 20:37:21 +053032#include <mach/regs-gpio.h>
33
Kyungmin Park079b0322009-11-17 08:41:20 +010034#include <video/platform_lcd.h>
Byungho Mine1197662009-06-23 21:40:28 +090035
36#include <asm/irq.h>
37#include <asm/mach-types.h>
38
39#include <plat/regs-serial.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010040#include <plat/gpio-cfg.h>
Byungho Mine1197662009-06-23 21:40:28 +090041
42#include <plat/clock.h>
43#include <plat/devs.h>
44#include <plat/cpu.h>
Kyungmin Park079b0322009-11-17 08:41:20 +010045#include <plat/fb.h>
Kyungmin Park067f1312009-11-17 08:41:22 +010046#include <plat/iic.h>
Abhilash Kesavan66194a72010-06-08 17:02:08 +090047#include <plat/ata.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090048#include <plat/adc.h>
Naveen Krishna Ch2211f282010-06-22 07:54:18 +090049#include <plat/keypad.h>
Naveen Krishna Ch327b9032010-06-30 21:50:24 +090050#include <plat/ts.h>
Seungwhan Youn068b4322010-10-14 10:35:23 +090051#include <plat/audio.h>
Banajit Goswami1cad6762011-07-20 23:45:22 +090052#include <plat/backlight.h>
Ajay Kumar1c4f6d42011-07-21 01:13:53 +090053#include <plat/regs-fb-v4.h>
Byungho Mine1197662009-06-23 21:40:28 +090054
Kukjin Kimdd4153d2011-12-22 23:31:28 +010055#include "common.h"
56
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020057/* Following are default values for UCON, ULCON and UFCON UART registers */
Kukjin Kimc8def082010-07-21 09:19:51 +090058#define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020059 S3C2410_UCON_RXILEVEL | \
60 S3C2410_UCON_TXIRQMODE | \
61 S3C2410_UCON_RXIRQMODE | \
62 S3C2410_UCON_RXFIFO_TOI | \
63 S3C2443_UCON_RXERR_IRQEN)
64
Kukjin Kimc8def082010-07-21 09:19:51 +090065#define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020066
Kukjin Kimc8def082010-07-21 09:19:51 +090067#define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \
Marek Szyprowski13e51fa2010-05-18 11:30:49 +020068 S3C2440_UFCON_RXTRIG8 | \
69 S3C2440_UFCON_TXTRIG16)
Byungho Mine1197662009-06-23 21:40:28 +090070
71static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = {
72 [0] = {
73 .hwport = 0,
74 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090075 .ucon = SMDKC100_UCON_DEFAULT,
76 .ulcon = SMDKC100_ULCON_DEFAULT,
77 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090078 },
79 [1] = {
80 .hwport = 1,
81 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090082 .ucon = SMDKC100_UCON_DEFAULT,
83 .ulcon = SMDKC100_ULCON_DEFAULT,
84 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090085 },
86 [2] = {
87 .hwport = 2,
88 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090089 .ucon = SMDKC100_UCON_DEFAULT,
90 .ulcon = SMDKC100_ULCON_DEFAULT,
91 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090092 },
93 [3] = {
94 .hwport = 3,
95 .flags = 0,
Kukjin Kimc8def082010-07-21 09:19:51 +090096 .ucon = SMDKC100_UCON_DEFAULT,
97 .ulcon = SMDKC100_ULCON_DEFAULT,
98 .ufcon = SMDKC100_UFCON_DEFAULT,
Byungho Mine1197662009-06-23 21:40:28 +090099 },
100};
101
Kyungmin Park067f1312009-11-17 08:41:22 +0100102/* I2C0 */
103static struct i2c_board_info i2c_devs0[] __initdata = {
Jassi Brarb0f39c22010-11-22 15:37:19 +0900104 {I2C_BOARD_INFO("wm8580", 0x1b),},
Kyungmin Park067f1312009-11-17 08:41:22 +0100105};
106
107/* I2C1 */
108static struct i2c_board_info i2c_devs1[] __initdata = {
109};
110
Kyungmin Park079b0322009-11-17 08:41:20 +0100111/* LCD power controller */
112static void smdkc100_lcd_power_set(struct plat_lcd_data *pd,
113 unsigned int power)
114{
Kyungmin Park079b0322009-11-17 08:41:20 +0100115 if (power) {
116 /* module reset */
117 gpio_direction_output(S5PC100_GPH0(6), 1);
118 mdelay(100);
119 gpio_direction_output(S5PC100_GPH0(6), 0);
120 mdelay(10);
121 gpio_direction_output(S5PC100_GPH0(6), 1);
122 mdelay(10);
123 }
124}
125
126static struct plat_lcd_data smdkc100_lcd_power_data = {
127 .set_power = smdkc100_lcd_power_set,
128};
129
130static struct platform_device smdkc100_lcd_powerdev = {
131 .name = "platform-lcd",
132 .dev.parent = &s3c_device_fb.dev,
133 .dev.platform_data = &smdkc100_lcd_power_data,
134};
135
136/* Frame Buffer */
137static struct s3c_fb_pd_win smdkc100_fb_win0 = {
138 /* this is to ensure we use win0 */
139 .win_mode = {
Kyungmin Park079b0322009-11-17 08:41:20 +0100140 .left_margin = 8,
141 .right_margin = 13,
142 .upper_margin = 7,
143 .lower_margin = 5,
144 .hsync_len = 3,
145 .vsync_len = 1,
146 .xres = 800,
147 .yres = 480,
Maurus Cuelenaeredaf695f2010-08-10 18:02:44 -0700148 .refresh = 80,
Kyungmin Park079b0322009-11-17 08:41:20 +0100149 },
150 .max_bpp = 32,
151 .default_bpp = 16,
152};
153
154static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = {
155 .win[0] = &smdkc100_fb_win0,
156 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
157 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
158 .setup_gpio = s5pc100_fb_gpio_setup_24bpp,
159};
160
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900161static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = {
162 .setup_gpio = s5pc100_ide_setup_gpio,
163};
164
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900165static uint32_t smdkc100_keymap[] __initdata = {
166 /* KEY(row, col, keycode) */
167 KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3),
168 KEY(0, 6, KEY_4), KEY(0, 7, KEY_5),
169 KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C),
170 KEY(1, 6, KEY_D), KEY(1, 7, KEY_E)
171};
172
173static struct matrix_keymap_data smdkc100_keymap_data __initdata = {
174 .keymap = smdkc100_keymap,
175 .keymap_size = ARRAY_SIZE(smdkc100_keymap),
176};
177
178static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = {
179 .keymap_data = &smdkc100_keymap_data,
180 .rows = 2,
181 .cols = 8,
182};
183
Byungho Mine1197662009-06-23 21:40:28 +0900184static struct platform_device *smdkc100_devices[] __initdata = {
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900185 &s3c_device_adc,
Banajit Goswamic4023612010-06-18 12:12:06 +0530186 &s3c_device_cfcon,
Kyungmin Park067f1312009-11-17 08:41:22 +0100187 &s3c_device_i2c0,
188 &s3c_device_i2c1,
Kyungmin Park079b0322009-11-17 08:41:20 +0100189 &s3c_device_fb,
Kyungmin Park0c318622009-11-17 08:41:24 +0100190 &s3c_device_hsmmc0,
191 &s3c_device_hsmmc1,
192 &s3c_device_hsmmc2,
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900193 &s3c_device_ts,
Banajit Goswamic4023612010-06-18 12:12:06 +0530194 &s3c_device_wdt,
Kyungmin Park079b0322009-11-17 08:41:20 +0100195 &smdkc100_lcd_powerdev,
Jassi Brarb0f39c22010-11-22 15:37:19 +0900196 &samsung_asoc_dma,
Jassi Brar99c56e02010-05-18 16:02:44 +0900197 &s5pc100_device_iis0,
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900198 &samsung_device_keypad,
Jassi Brar99c56e02010-05-18 16:02:44 +0900199 &s5pc100_device_ac97,
Atul Dahiyafa9ce742010-07-21 17:38:23 +0900200 &s3c_device_rtc,
Sylwester Nawrockidb94a2f2010-08-09 16:55:35 +0900201 &s5p_device_fimc0,
202 &s5p_device_fimc1,
203 &s5p_device_fimc2,
Seungwhan Youn068b4322010-10-14 10:35:23 +0900204 &s5pc100_device_spdif,
Byungho Mine1197662009-06-23 21:40:28 +0900205};
206
Banajit Goswami1cad6762011-07-20 23:45:22 +0900207/* LCD Backlight data */
208static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = {
209 .no = S5PC100_GPD(0),
210 .func = S3C_GPIO_SFN(2),
211};
212
213static struct platform_pwm_backlight_data smdkc100_bl_data = {
214 .pwm_id = 0,
215};
216
Byungho Mine1197662009-06-23 21:40:28 +0900217static void __init smdkc100_map_io(void)
218{
Kukjin Kimdd4153d2011-12-22 23:31:28 +0100219 s5pc100_init_io(NULL, 0);
Byungho Mine1197662009-06-23 21:40:28 +0900220 s3c24xx_init_clocks(12000000);
221 s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs));
222}
223
224static void __init smdkc100_machine_init(void)
225{
Naveen Krishna Chatradhi08047652011-08-19 21:56:10 +0900226 s3c24xx_ts_set_platdata(NULL);
Naveen Krishna Ch327b9032010-06-30 21:50:24 +0900227
Kyungmin Park067f1312009-11-17 08:41:22 +0100228 /* I2C */
229 s3c_i2c0_set_platdata(NULL);
230 s3c_i2c1_set_platdata(NULL);
231 i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0));
232 i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1));
233
Kyungmin Park079b0322009-11-17 08:41:20 +0100234 s3c_fb_set_platdata(&smdkc100_lcd_pdata);
Abhilash Kesavan66194a72010-06-08 17:02:08 +0900235 s3c_ide_set_platdata(&smdkc100_ide_pdata);
Kyungmin Park079b0322009-11-17 08:41:20 +0100236
Naveen Krishna Ch2211f282010-06-22 07:54:18 +0900237 samsung_keypad_set_platdata(&smdkc100_keypad_data);
Kyungmin Park079b0322009-11-17 08:41:20 +0100238
Seungwhan Youn068b4322010-10-14 10:35:23 +0900239 s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD);
240
Kyungmin Park079b0322009-11-17 08:41:20 +0100241 /* LCD init */
Kyungmin Park079b0322009-11-17 08:41:20 +0100242 gpio_request(S5PC100_GPH0(6), "GPH0");
243 smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0);
Banajit Goswami1cad6762011-07-20 23:45:22 +0900244
245 samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data);
246
Byungho Mine1197662009-06-23 21:40:28 +0900247 platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices));
248}
249
250MACHINE_START(SMDKC100, "SMDKC100")
251 /* Maintainer: Byungho Min <bhmin@samsung.com> */
Nicolas Pitre02350a1f2011-07-05 22:38:17 -0400252 .atag_offset = 0x100,
Byungho Mine1197662009-06-23 21:40:28 +0900253 .init_irq = s5pc100_init_irq,
254 .map_io = smdkc100_map_io,
255 .init_machine = smdkc100_machine_init,
256 .timer = &s3c24xx_timer,
Kukjin Kim5497d2e2011-12-22 23:35:21 +0100257 .restart = s5pc100_restart,
Byungho Mine1197662009-06-23 21:40:28 +0900258MACHINE_END