Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5p64x0/mach-smdk6440.c |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 2 | * |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 3 | * Copyright (c) 2009-2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.samsung.com |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 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 | #include <linux/kernel.h> |
| 12 | #include <linux/types.h> |
| 13 | #include <linux/interrupt.h> |
| 14 | #include <linux/list.h> |
| 15 | #include <linux/timer.h> |
| 16 | #include <linux/delay.h> |
| 17 | #include <linux/init.h> |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 18 | #include <linux/i2c.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 19 | #include <linux/serial_core.h> |
| 20 | #include <linux/platform_device.h> |
| 21 | #include <linux/io.h> |
| 22 | #include <linux/module.h> |
| 23 | #include <linux/clk.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 24 | #include <linux/gpio.h> |
Banajit Goswami | fec524a | 2011-02-28 20:31:27 +0530 | [diff] [blame] | 25 | #include <linux/pwm_backlight.h> |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 26 | #include <linux/fb.h> |
| 27 | |
| 28 | #include <video/platform_lcd.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 29 | |
Jamie Iles | bb3a4eb | 2011-09-27 20:53:31 +0100 | [diff] [blame^] | 30 | #include <asm/hardware/vic.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 31 | #include <asm/mach/arch.h> |
| 32 | #include <asm/mach/map.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 33 | #include <asm/irq.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 36 | #include <mach/hardware.h> |
| 37 | #include <mach/map.h> |
| 38 | #include <mach/regs-clock.h> |
| 39 | #include <mach/i2c.h> |
Banajit Goswami | fec524a | 2011-02-28 20:31:27 +0530 | [diff] [blame] | 40 | #include <mach/regs-gpio.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 41 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 42 | #include <plat/regs-serial.h> |
| 43 | #include <plat/gpio-cfg.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 44 | #include <plat/s5p6440.h> |
| 45 | #include <plat/clock.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 46 | #include <plat/devs.h> |
| 47 | #include <plat/cpu.h> |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 48 | #include <plat/iic.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 49 | #include <plat/pll.h> |
Naveen Krishna Ch | 09cae8f | 2010-05-20 11:39:53 +0900 | [diff] [blame] | 50 | #include <plat/adc.h> |
| 51 | #include <plat/ts.h> |
Sangbeom Kim | 20780fc | 2011-03-12 08:02:12 +0900 | [diff] [blame] | 52 | #include <plat/s5p-time.h> |
Banajit Goswami | 499d296 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 53 | #include <plat/backlight.h> |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 54 | #include <plat/fb.h> |
| 55 | #include <plat/regs-fb.h> |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 56 | |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 57 | #define SMDK6440_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [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 SMDK6440_ULCON_DEFAULT S3C2410_LCON_CS8 |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 65 | |
Kukjin Kim | c8def08 | 2010-07-21 09:19:51 +0900 | [diff] [blame] | 66 | #define SMDK6440_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 67 | S3C2440_UFCON_TXTRIG16 | \ |
| 68 | S3C2410_UFCON_RXTRIG8) |
| 69 | |
| 70 | static struct s3c2410_uartcfg smdk6440_uartcfgs[] __initdata = { |
| 71 | [0] = { |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 72 | .hwport = 0, |
| 73 | .flags = 0, |
| 74 | .ucon = SMDK6440_UCON_DEFAULT, |
| 75 | .ulcon = SMDK6440_ULCON_DEFAULT, |
| 76 | .ufcon = SMDK6440_UFCON_DEFAULT, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 77 | }, |
| 78 | [1] = { |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 79 | .hwport = 1, |
| 80 | .flags = 0, |
| 81 | .ucon = SMDK6440_UCON_DEFAULT, |
| 82 | .ulcon = SMDK6440_ULCON_DEFAULT, |
| 83 | .ufcon = SMDK6440_UFCON_DEFAULT, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 84 | }, |
| 85 | [2] = { |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 86 | .hwport = 2, |
| 87 | .flags = 0, |
| 88 | .ucon = SMDK6440_UCON_DEFAULT, |
| 89 | .ulcon = SMDK6440_ULCON_DEFAULT, |
| 90 | .ufcon = SMDK6440_UFCON_DEFAULT, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 91 | }, |
| 92 | [3] = { |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 93 | .hwport = 3, |
| 94 | .flags = 0, |
| 95 | .ucon = SMDK6440_UCON_DEFAULT, |
| 96 | .ulcon = SMDK6440_ULCON_DEFAULT, |
| 97 | .ufcon = SMDK6440_UFCON_DEFAULT, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 98 | }, |
| 99 | }; |
| 100 | |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 101 | /* Frame Buffer */ |
| 102 | static struct s3c_fb_pd_win smdk6440_fb_win0 = { |
| 103 | .win_mode = { |
| 104 | .left_margin = 8, |
| 105 | .right_margin = 13, |
| 106 | .upper_margin = 7, |
| 107 | .lower_margin = 5, |
| 108 | .hsync_len = 3, |
| 109 | .vsync_len = 1, |
| 110 | .xres = 800, |
| 111 | .yres = 480, |
| 112 | }, |
| 113 | .max_bpp = 32, |
| 114 | .default_bpp = 24, |
| 115 | }; |
| 116 | |
| 117 | static struct s3c_fb_platdata smdk6440_lcd_pdata __initdata = { |
| 118 | .win[0] = &smdk6440_fb_win0, |
| 119 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, |
| 120 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, |
| 121 | .setup_gpio = s5p64x0_fb_gpio_setup_24bpp, |
| 122 | }; |
| 123 | |
| 124 | /* LCD power controller */ |
| 125 | static void smdk6440_lte480_reset_power(struct plat_lcd_data *pd, |
| 126 | unsigned int power) |
| 127 | { |
| 128 | int err; |
| 129 | |
| 130 | if (power) { |
| 131 | err = gpio_request(S5P6440_GPN(5), "GPN"); |
| 132 | if (err) { |
| 133 | printk(KERN_ERR "failed to request GPN for lcd reset\n"); |
| 134 | return; |
| 135 | } |
| 136 | |
| 137 | gpio_direction_output(S5P6440_GPN(5), 1); |
| 138 | gpio_set_value(S5P6440_GPN(5), 0); |
| 139 | gpio_set_value(S5P6440_GPN(5), 1); |
| 140 | gpio_free(S5P6440_GPN(5)); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | static struct plat_lcd_data smdk6440_lcd_power_data = { |
| 145 | .set_power = smdk6440_lte480_reset_power, |
| 146 | }; |
| 147 | |
| 148 | static struct platform_device smdk6440_lcd_lte480wv = { |
| 149 | .name = "platform-lcd", |
| 150 | .dev.parent = &s3c_device_fb.dev, |
| 151 | .dev.platform_data = &smdk6440_lcd_power_data, |
| 152 | }; |
| 153 | |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 154 | static struct platform_device *smdk6440_devices[] __initdata = { |
Naveen Krishna Ch | 09cae8f | 2010-05-20 11:39:53 +0900 | [diff] [blame] | 155 | &s3c_device_adc, |
Atul Dahiya | ff7124a | 2010-07-21 17:32:56 +0900 | [diff] [blame] | 156 | &s3c_device_rtc, |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 157 | &s3c_device_i2c0, |
| 158 | &s3c_device_i2c1, |
Naveen Krishna Ch | 09cae8f | 2010-05-20 11:39:53 +0900 | [diff] [blame] | 159 | &s3c_device_ts, |
Banajit Goswami | a0cce455 | 2010-05-20 16:21:31 +0900 | [diff] [blame] | 160 | &s3c_device_wdt, |
Jassi Brar | 8418f88 | 2010-12-30 09:11:10 +0900 | [diff] [blame] | 161 | &samsung_asoc_dma, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 162 | &s5p6440_device_iis, |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 163 | &s3c_device_fb, |
| 164 | &smdk6440_lcd_lte480wv, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 165 | }; |
| 166 | |
| 167 | static struct s3c2410_platform_i2c s5p6440_i2c0_data __initdata = { |
| 168 | .flags = 0, |
| 169 | .slave_addr = 0x10, |
| 170 | .frequency = 100*1000, |
| 171 | .sda_delay = 100, |
| 172 | .cfg_gpio = s5p6440_i2c0_cfg_gpio, |
| 173 | }; |
| 174 | |
| 175 | static struct s3c2410_platform_i2c s5p6440_i2c1_data __initdata = { |
| 176 | .flags = 0, |
| 177 | .bus_num = 1, |
| 178 | .slave_addr = 0x10, |
| 179 | .frequency = 100*1000, |
| 180 | .sda_delay = 100, |
| 181 | .cfg_gpio = s5p6440_i2c1_cfg_gpio, |
Naveen Krishna Ch | 09cae8f | 2010-05-20 11:39:53 +0900 | [diff] [blame] | 182 | }; |
| 183 | |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 184 | static struct i2c_board_info smdk6440_i2c_devs0[] __initdata = { |
| 185 | { I2C_BOARD_INFO("24c08", 0x50), }, |
Jassi Brar | 149bb5b | 2010-12-21 09:46:29 +0900 | [diff] [blame] | 186 | { I2C_BOARD_INFO("wm8580", 0x1b), }, |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 187 | }; |
| 188 | |
| 189 | static struct i2c_board_info smdk6440_i2c_devs1[] __initdata = { |
| 190 | /* To be populated */ |
| 191 | }; |
| 192 | |
Banajit Goswami | 499d296 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 193 | /* LCD Backlight data */ |
| 194 | static struct samsung_bl_gpio_info smdk6440_bl_gpio_info = { |
| 195 | .no = S5P6440_GPF(15), |
| 196 | .func = S3C_GPIO_SFN(2), |
| 197 | }; |
| 198 | |
| 199 | static struct platform_pwm_backlight_data smdk6440_bl_data = { |
| 200 | .pwm_id = 1, |
| 201 | }; |
| 202 | |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 203 | static void __init smdk6440_map_io(void) |
| 204 | { |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 205 | s5p_init_io(NULL, 0, S5P64X0_SYS_ID); |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 206 | s3c24xx_init_clocks(12000000); |
| 207 | s3c24xx_init_uarts(smdk6440_uartcfgs, ARRAY_SIZE(smdk6440_uartcfgs)); |
Sangbeom Kim | 20780fc | 2011-03-12 08:02:12 +0900 | [diff] [blame] | 208 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 209 | } |
| 210 | |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 211 | static void s5p6440_set_lcd_interface(void) |
| 212 | { |
| 213 | unsigned int cfg; |
| 214 | |
| 215 | /* select TFT LCD type (RGB I/F) */ |
| 216 | cfg = __raw_readl(S5P64X0_SPCON0); |
| 217 | cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK; |
| 218 | cfg |= S5P64X0_SPCON0_LCD_SEL_RGB; |
| 219 | __raw_writel(cfg, S5P64X0_SPCON0); |
| 220 | } |
| 221 | |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 222 | static void __init smdk6440_machine_init(void) |
| 223 | { |
Naveen Krishna Chatradhi | 0804765 | 2011-08-19 21:56:10 +0900 | [diff] [blame] | 224 | s3c24xx_ts_set_platdata(NULL); |
Naveen Krishna Ch | 09cae8f | 2010-05-20 11:39:53 +0900 | [diff] [blame] | 225 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 226 | s3c_i2c0_set_platdata(&s5p6440_i2c0_data); |
| 227 | s3c_i2c1_set_platdata(&s5p6440_i2c1_data); |
Naveen Krishna Ch | 2c97886 | 2010-08-06 19:32:43 +0900 | [diff] [blame] | 228 | i2c_register_board_info(0, smdk6440_i2c_devs0, |
| 229 | ARRAY_SIZE(smdk6440_i2c_devs0)); |
| 230 | i2c_register_board_info(1, smdk6440_i2c_devs1, |
| 231 | ARRAY_SIZE(smdk6440_i2c_devs1)); |
| 232 | |
Banajit Goswami | 499d296 | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 233 | samsung_bl_set(&smdk6440_bl_gpio_info, &smdk6440_bl_data); |
| 234 | |
Ajay Kumar | 1030e5c | 2011-09-27 07:51:22 +0900 | [diff] [blame] | 235 | s5p6440_set_lcd_interface(); |
| 236 | s3c_fb_set_platdata(&smdk6440_lcd_pdata); |
| 237 | |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 238 | platform_add_devices(smdk6440_devices, ARRAY_SIZE(smdk6440_devices)); |
| 239 | } |
| 240 | |
| 241 | MACHINE_START(SMDK6440, "SMDK6440") |
| 242 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
Nicolas Pitre | 32bc820 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 243 | .atag_offset = 0x100, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 244 | |
| 245 | .init_irq = s5p6440_init_irq, |
Jamie Iles | bb3a4eb | 2011-09-27 20:53:31 +0100 | [diff] [blame^] | 246 | .handle_irq = vic_handle_irq, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 247 | .map_io = smdk6440_map_io, |
| 248 | .init_machine = smdk6440_machine_init, |
Sangbeom Kim | 20780fc | 2011-03-12 08:02:12 +0900 | [diff] [blame] | 249 | .timer = &s5p_timer, |
Kukjin Kim | d25168e | 2010-01-14 08:22:00 +0900 | [diff] [blame] | 250 | MACHINE_END |