Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 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> |
Naveen Krishna Ch | 2211f28 | 2010-06-22 07:54:18 +0900 | [diff] [blame] | 25 | #include <linux/input.h> |
Banajit Goswami | baa0c06 | 2011-02-28 20:37:21 +0530 | [diff] [blame] | 26 | #include <linux/pwm_backlight.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 27 | |
| 28 | #include <asm/mach/arch.h> |
| 29 | #include <asm/mach/map.h> |
| 30 | |
| 31 | #include <mach/map.h> |
Banajit Goswami | baa0c06 | 2011-02-28 20:37:21 +0530 | [diff] [blame] | 32 | #include <mach/regs-gpio.h> |
| 33 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 34 | #include <video/platform_lcd.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 35 | |
| 36 | #include <asm/irq.h> |
| 37 | #include <asm/mach-types.h> |
| 38 | |
| 39 | #include <plat/regs-serial.h> |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 40 | #include <plat/gpio-cfg.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 41 | |
| 42 | #include <plat/clock.h> |
| 43 | #include <plat/devs.h> |
| 44 | #include <plat/cpu.h> |
| 45 | #include <plat/s5pc100.h> |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 46 | #include <plat/fb.h> |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 47 | #include <plat/iic.h> |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame] | 48 | #include <plat/ata.h> |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 49 | #include <plat/adc.h> |
Naveen Krishna Ch | 2211f28 | 2010-06-22 07:54:18 +0900 | [diff] [blame] | 50 | #include <plat/keypad.h> |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 51 | #include <plat/ts.h> |
Seungwhan Youn | 068b432 | 2010-10-14 10:35:23 +0900 | [diff] [blame] | 52 | #include <plat/audio.h> |
Banajit Goswami | 1cad676 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 53 | #include <plat/backlight.h> |
Ajay Kumar | 1c4f6d4 | 2011-07-21 01:13:53 +0900 | [diff] [blame] | 54 | #include <plat/regs-fb-v4.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 55 | |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 56 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 57 | #define SMDKC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 58 | S3C2410_UCON_RXILEVEL | \ |
| 59 | S3C2410_UCON_TXIRQMODE | \ |
| 60 | S3C2410_UCON_RXIRQMODE | \ |
| 61 | S3C2410_UCON_RXFIFO_TOI | \ |
| 62 | S3C2443_UCON_RXERR_IRQEN) |
| 63 | |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 64 | #define SMDKC100_ULCON_DEFAULT S3C2410_LCON_CS8 |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 65 | |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 66 | #define SMDKC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 67 | S3C2440_UFCON_RXTRIG8 | \ |
| 68 | S3C2440_UFCON_TXTRIG16) |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 69 | |
| 70 | static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = { |
| 71 | [0] = { |
| 72 | .hwport = 0, |
| 73 | .flags = 0, |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 74 | .ucon = SMDKC100_UCON_DEFAULT, |
| 75 | .ulcon = SMDKC100_ULCON_DEFAULT, |
| 76 | .ufcon = SMDKC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 77 | }, |
| 78 | [1] = { |
| 79 | .hwport = 1, |
| 80 | .flags = 0, |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 81 | .ucon = SMDKC100_UCON_DEFAULT, |
| 82 | .ulcon = SMDKC100_ULCON_DEFAULT, |
| 83 | .ufcon = SMDKC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 84 | }, |
| 85 | [2] = { |
| 86 | .hwport = 2, |
| 87 | .flags = 0, |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 88 | .ucon = SMDKC100_UCON_DEFAULT, |
| 89 | .ulcon = SMDKC100_ULCON_DEFAULT, |
| 90 | .ufcon = SMDKC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 91 | }, |
| 92 | [3] = { |
| 93 | .hwport = 3, |
| 94 | .flags = 0, |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 95 | .ucon = SMDKC100_UCON_DEFAULT, |
| 96 | .ulcon = SMDKC100_ULCON_DEFAULT, |
| 97 | .ufcon = SMDKC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 98 | }, |
| 99 | }; |
| 100 | |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 101 | /* I2C0 */ |
| 102 | static struct i2c_board_info i2c_devs0[] __initdata = { |
Jassi Brar | b0f39c2 | 2010-11-22 15:37:19 +0900 | [diff] [blame] | 103 | {I2C_BOARD_INFO("wm8580", 0x1b),}, |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | /* I2C1 */ |
| 107 | static struct i2c_board_info i2c_devs1[] __initdata = { |
| 108 | }; |
| 109 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 110 | /* LCD power controller */ |
| 111 | static void smdkc100_lcd_power_set(struct plat_lcd_data *pd, |
| 112 | unsigned int power) |
| 113 | { |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 114 | if (power) { |
| 115 | /* module reset */ |
| 116 | gpio_direction_output(S5PC100_GPH0(6), 1); |
| 117 | mdelay(100); |
| 118 | gpio_direction_output(S5PC100_GPH0(6), 0); |
| 119 | mdelay(10); |
| 120 | gpio_direction_output(S5PC100_GPH0(6), 1); |
| 121 | mdelay(10); |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | static struct plat_lcd_data smdkc100_lcd_power_data = { |
| 126 | .set_power = smdkc100_lcd_power_set, |
| 127 | }; |
| 128 | |
| 129 | static struct platform_device smdkc100_lcd_powerdev = { |
| 130 | .name = "platform-lcd", |
| 131 | .dev.parent = &s3c_device_fb.dev, |
| 132 | .dev.platform_data = &smdkc100_lcd_power_data, |
| 133 | }; |
| 134 | |
| 135 | /* Frame Buffer */ |
| 136 | static struct s3c_fb_pd_win smdkc100_fb_win0 = { |
| 137 | /* this is to ensure we use win0 */ |
| 138 | .win_mode = { |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 139 | .left_margin = 8, |
| 140 | .right_margin = 13, |
| 141 | .upper_margin = 7, |
| 142 | .lower_margin = 5, |
| 143 | .hsync_len = 3, |
| 144 | .vsync_len = 1, |
| 145 | .xres = 800, |
| 146 | .yres = 480, |
Maurus Cuelenaere | daf695f | 2010-08-10 18:02:44 -0700 | [diff] [blame] | 147 | .refresh = 80, |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 148 | }, |
| 149 | .max_bpp = 32, |
| 150 | .default_bpp = 16, |
| 151 | }; |
| 152 | |
| 153 | static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = { |
| 154 | .win[0] = &smdkc100_fb_win0, |
| 155 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, |
| 156 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, |
| 157 | .setup_gpio = s5pc100_fb_gpio_setup_24bpp, |
| 158 | }; |
| 159 | |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame] | 160 | static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = { |
| 161 | .setup_gpio = s5pc100_ide_setup_gpio, |
| 162 | }; |
| 163 | |
Naveen Krishna Ch | 2211f28 | 2010-06-22 07:54:18 +0900 | [diff] [blame] | 164 | static uint32_t smdkc100_keymap[] __initdata = { |
| 165 | /* KEY(row, col, keycode) */ |
| 166 | KEY(0, 3, KEY_1), KEY(0, 4, KEY_2), KEY(0, 5, KEY_3), |
| 167 | KEY(0, 6, KEY_4), KEY(0, 7, KEY_5), |
| 168 | KEY(1, 3, KEY_A), KEY(1, 4, KEY_B), KEY(1, 5, KEY_C), |
| 169 | KEY(1, 6, KEY_D), KEY(1, 7, KEY_E) |
| 170 | }; |
| 171 | |
| 172 | static struct matrix_keymap_data smdkc100_keymap_data __initdata = { |
| 173 | .keymap = smdkc100_keymap, |
| 174 | .keymap_size = ARRAY_SIZE(smdkc100_keymap), |
| 175 | }; |
| 176 | |
| 177 | static struct samsung_keypad_platdata smdkc100_keypad_data __initdata = { |
| 178 | .keymap_data = &smdkc100_keymap_data, |
| 179 | .rows = 2, |
| 180 | .cols = 8, |
| 181 | }; |
| 182 | |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 183 | static struct platform_device *smdkc100_devices[] __initdata = { |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 184 | &s3c_device_adc, |
Banajit Goswami | c402361 | 2010-06-18 12:12:06 +0530 | [diff] [blame] | 185 | &s3c_device_cfcon, |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 186 | &s3c_device_i2c0, |
| 187 | &s3c_device_i2c1, |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 188 | &s3c_device_fb, |
Kyungmin Park | 0c31862 | 2009-11-17 08:41:24 +0100 | [diff] [blame] | 189 | &s3c_device_hsmmc0, |
| 190 | &s3c_device_hsmmc1, |
| 191 | &s3c_device_hsmmc2, |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 192 | &s3c_device_ts, |
Banajit Goswami | c402361 | 2010-06-18 12:12:06 +0530 | [diff] [blame] | 193 | &s3c_device_wdt, |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 194 | &smdkc100_lcd_powerdev, |
Jassi Brar | b0f39c2 | 2010-11-22 15:37:19 +0900 | [diff] [blame] | 195 | &samsung_asoc_dma, |
Jassi Brar | 99c56e0 | 2010-05-18 16:02:44 +0900 | [diff] [blame] | 196 | &s5pc100_device_iis0, |
Naveen Krishna Ch | 2211f28 | 2010-06-22 07:54:18 +0900 | [diff] [blame] | 197 | &samsung_device_keypad, |
Jassi Brar | 99c56e0 | 2010-05-18 16:02:44 +0900 | [diff] [blame] | 198 | &s5pc100_device_ac97, |
Atul Dahiya | fa9ce74 | 2010-07-21 17:38:23 +0900 | [diff] [blame] | 199 | &s3c_device_rtc, |
Sylwester Nawrocki | db94a2f | 2010-08-09 16:55:35 +0900 | [diff] [blame] | 200 | &s5p_device_fimc0, |
| 201 | &s5p_device_fimc1, |
| 202 | &s5p_device_fimc2, |
Seungwhan Youn | 068b432 | 2010-10-14 10:35:23 +0900 | [diff] [blame] | 203 | &s5pc100_device_spdif, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 204 | }; |
| 205 | |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 206 | static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = { |
| 207 | .delay = 10000, |
| 208 | .presc = 49, |
| 209 | .oversampling_shift = 2, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 210 | }; |
| 211 | |
Banajit Goswami | 1cad676 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 212 | /* LCD Backlight data */ |
| 213 | static struct samsung_bl_gpio_info smdkc100_bl_gpio_info = { |
| 214 | .no = S5PC100_GPD(0), |
| 215 | .func = S3C_GPIO_SFN(2), |
| 216 | }; |
| 217 | |
| 218 | static struct platform_pwm_backlight_data smdkc100_bl_data = { |
| 219 | .pwm_id = 0, |
| 220 | }; |
| 221 | |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 222 | static void __init smdkc100_map_io(void) |
| 223 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 224 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 225 | s3c24xx_init_clocks(12000000); |
| 226 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); |
| 227 | } |
| 228 | |
| 229 | static void __init smdkc100_machine_init(void) |
| 230 | { |
Naveen Krishna Ch | 327b903 | 2010-06-30 21:50:24 +0900 | [diff] [blame] | 231 | s3c24xx_ts_set_platdata(&s3c_ts_platform); |
| 232 | |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 233 | /* I2C */ |
| 234 | s3c_i2c0_set_platdata(NULL); |
| 235 | s3c_i2c1_set_platdata(NULL); |
| 236 | i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); |
| 237 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); |
| 238 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 239 | s3c_fb_set_platdata(&smdkc100_lcd_pdata); |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame] | 240 | s3c_ide_set_platdata(&smdkc100_ide_pdata); |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 241 | |
Naveen Krishna Ch | 2211f28 | 2010-06-22 07:54:18 +0900 | [diff] [blame] | 242 | samsung_keypad_set_platdata(&smdkc100_keypad_data); |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 243 | |
Seungwhan Youn | 068b432 | 2010-10-14 10:35:23 +0900 | [diff] [blame] | 244 | s5pc100_spdif_setup_gpio(S5PC100_SPDIF_GPD); |
| 245 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 246 | /* LCD init */ |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 247 | gpio_request(S5PC100_GPH0(6), "GPH0"); |
| 248 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); |
Banajit Goswami | 1cad676 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 249 | |
| 250 | samsung_bl_set(&smdkc100_bl_gpio_info, &smdkc100_bl_data); |
| 251 | |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 252 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); |
| 253 | } |
| 254 | |
| 255 | MACHINE_START(SMDKC100, "SMDKC100") |
| 256 | /* Maintainer: Byungho Min <bhmin@samsung.com> */ |
Nicolas Pitre | 02350a1f | 2011-07-05 22:38:17 -0400 | [diff] [blame^] | 257 | .atag_offset = 0x100, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 258 | .init_irq = s5pc100_init_irq, |
| 259 | .map_io = smdkc100_map_io, |
| 260 | .init_machine = smdkc100_machine_init, |
| 261 | .timer = &s3c24xx_timer, |
| 262 | MACHINE_END |