Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 1 | /* linux/arch/arm/mach-s5p64x0/mach-smdk6450.c |
| 2 | * |
| 3 | * Copyright (c) 2010 Samsung Electronics Co., Ltd. |
| 4 | * http://www.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 | #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> |
| 18 | #include <linux/i2c.h> |
| 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> |
| 24 | #include <linux/gpio.h> |
Banajit Goswami | b0fd644 | 2011-02-28 23:31:17 +0530 | [diff] [blame] | 25 | #include <linux/pwm_backlight.h> |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 26 | #include <linux/fb.h> |
Rajeshwari Shinde | 6640790 | 2011-12-26 16:33:00 +0900 | [diff] [blame] | 27 | #include <linux/mmc/host.h> |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 28 | |
| 29 | #include <video/platform_lcd.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 30 | |
Jamie Iles | bb3a4eb | 2011-09-27 20:53:31 +0100 | [diff] [blame] | 31 | #include <asm/hardware/vic.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 32 | #include <asm/mach/arch.h> |
| 33 | #include <asm/mach/map.h> |
| 34 | #include <asm/irq.h> |
| 35 | #include <asm/mach-types.h> |
| 36 | |
| 37 | #include <mach/hardware.h> |
| 38 | #include <mach/map.h> |
| 39 | #include <mach/regs-clock.h> |
| 40 | #include <mach/i2c.h> |
Banajit Goswami | b0fd644 | 2011-02-28 23:31:17 +0530 | [diff] [blame] | 41 | #include <mach/regs-gpio.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 42 | |
| 43 | #include <plat/regs-serial.h> |
| 44 | #include <plat/gpio-cfg.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 45 | #include <plat/clock.h> |
| 46 | #include <plat/devs.h> |
| 47 | #include <plat/cpu.h> |
| 48 | #include <plat/iic.h> |
| 49 | #include <plat/pll.h> |
| 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 | 543601f | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 53 | #include <plat/backlight.h> |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 54 | #include <plat/fb.h> |
| 55 | #include <plat/regs-fb.h> |
Rajeshwari Shinde | 6640790 | 2011-12-26 16:33:00 +0900 | [diff] [blame] | 56 | #include <plat/sdhci.h> |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 57 | |
Kukjin Kim | 95af214 | 2011-12-22 23:28:28 +0100 | [diff] [blame] | 58 | #include "common.h" |
| 59 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 60 | #define SMDK6450_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| 61 | S3C2410_UCON_RXILEVEL | \ |
| 62 | S3C2410_UCON_TXIRQMODE | \ |
| 63 | S3C2410_UCON_RXIRQMODE | \ |
| 64 | S3C2410_UCON_RXFIFO_TOI | \ |
| 65 | S3C2443_UCON_RXERR_IRQEN) |
| 66 | |
| 67 | #define SMDK6450_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 68 | |
| 69 | #define SMDK6450_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
| 70 | S3C2440_UFCON_TXTRIG16 | \ |
| 71 | S3C2410_UFCON_RXTRIG8) |
| 72 | |
| 73 | static struct s3c2410_uartcfg smdk6450_uartcfgs[] __initdata = { |
| 74 | [0] = { |
| 75 | .hwport = 0, |
| 76 | .flags = 0, |
| 77 | .ucon = SMDK6450_UCON_DEFAULT, |
| 78 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 79 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 80 | }, |
| 81 | [1] = { |
| 82 | .hwport = 1, |
| 83 | .flags = 0, |
| 84 | .ucon = SMDK6450_UCON_DEFAULT, |
| 85 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 86 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 87 | }, |
| 88 | [2] = { |
| 89 | .hwport = 2, |
| 90 | .flags = 0, |
| 91 | .ucon = SMDK6450_UCON_DEFAULT, |
| 92 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 93 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 94 | }, |
| 95 | [3] = { |
| 96 | .hwport = 3, |
| 97 | .flags = 0, |
| 98 | .ucon = SMDK6450_UCON_DEFAULT, |
| 99 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 100 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 101 | }, |
| 102 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 4 |
| 103 | [4] = { |
| 104 | .hwport = 4, |
| 105 | .flags = 0, |
| 106 | .ucon = SMDK6450_UCON_DEFAULT, |
| 107 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 108 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 109 | }, |
| 110 | #endif |
| 111 | #if CONFIG_SERIAL_SAMSUNG_UARTS > 5 |
| 112 | [5] = { |
| 113 | .hwport = 5, |
| 114 | .flags = 0, |
| 115 | .ucon = SMDK6450_UCON_DEFAULT, |
| 116 | .ulcon = SMDK6450_ULCON_DEFAULT, |
| 117 | .ufcon = SMDK6450_UFCON_DEFAULT, |
| 118 | }, |
| 119 | #endif |
| 120 | }; |
| 121 | |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 122 | /* Frame Buffer */ |
| 123 | static struct s3c_fb_pd_win smdk6450_fb_win0 = { |
| 124 | .win_mode = { |
| 125 | .left_margin = 8, |
| 126 | .right_margin = 13, |
| 127 | .upper_margin = 7, |
| 128 | .lower_margin = 5, |
| 129 | .hsync_len = 3, |
| 130 | .vsync_len = 1, |
| 131 | .xres = 800, |
| 132 | .yres = 480, |
| 133 | }, |
| 134 | .max_bpp = 32, |
| 135 | .default_bpp = 24, |
| 136 | }; |
| 137 | |
| 138 | static struct s3c_fb_platdata smdk6450_lcd_pdata __initdata = { |
| 139 | .win[0] = &smdk6450_fb_win0, |
| 140 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, |
| 141 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, |
| 142 | .setup_gpio = s5p64x0_fb_gpio_setup_24bpp, |
| 143 | }; |
| 144 | |
| 145 | /* LCD power controller */ |
| 146 | static void smdk6450_lte480_reset_power(struct plat_lcd_data *pd, |
| 147 | unsigned int power) |
| 148 | { |
| 149 | int err; |
| 150 | |
| 151 | if (power) { |
| 152 | err = gpio_request(S5P6450_GPN(5), "GPN"); |
| 153 | if (err) { |
| 154 | printk(KERN_ERR "failed to request GPN for lcd reset\n"); |
| 155 | return; |
| 156 | } |
| 157 | |
| 158 | gpio_direction_output(S5P6450_GPN(5), 1); |
| 159 | gpio_set_value(S5P6450_GPN(5), 0); |
| 160 | gpio_set_value(S5P6450_GPN(5), 1); |
| 161 | gpio_free(S5P6450_GPN(5)); |
| 162 | } |
| 163 | } |
| 164 | |
| 165 | static struct plat_lcd_data smdk6450_lcd_power_data = { |
| 166 | .set_power = smdk6450_lte480_reset_power, |
| 167 | }; |
| 168 | |
| 169 | static struct platform_device smdk6450_lcd_lte480wv = { |
| 170 | .name = "platform-lcd", |
| 171 | .dev.parent = &s3c_device_fb.dev, |
| 172 | .dev.platform_data = &smdk6450_lcd_power_data, |
| 173 | }; |
| 174 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 175 | static struct platform_device *smdk6450_devices[] __initdata = { |
| 176 | &s3c_device_adc, |
| 177 | &s3c_device_rtc, |
| 178 | &s3c_device_i2c0, |
| 179 | &s3c_device_i2c1, |
| 180 | &s3c_device_ts, |
| 181 | &s3c_device_wdt, |
Jassi Brar | be370ad | 2010-12-30 09:12:32 +0900 | [diff] [blame] | 182 | &samsung_asoc_dma, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 183 | &s5p6450_device_iis0, |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 184 | &s3c_device_fb, |
| 185 | &smdk6450_lcd_lte480wv, |
Rajeshwari Shinde | 6640790 | 2011-12-26 16:33:00 +0900 | [diff] [blame] | 186 | &s3c_device_hsmmc0, |
| 187 | &s3c_device_hsmmc1, |
| 188 | &s3c_device_hsmmc2, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 189 | /* s5p6450_device_spi0 will be added */ |
| 190 | }; |
| 191 | |
Rajeshwari Shinde | 6640790 | 2011-12-26 16:33:00 +0900 | [diff] [blame] | 192 | static struct s3c_sdhci_platdata smdk6450_hsmmc0_pdata __initdata = { |
| 193 | .cd_type = S3C_SDHCI_CD_NONE, |
| 194 | }; |
| 195 | |
| 196 | static struct s3c_sdhci_platdata smdk6450_hsmmc1_pdata __initdata = { |
| 197 | .cd_type = S3C_SDHCI_CD_NONE, |
| 198 | #if defined(CONFIG_S5P64X0_SD_CH1_8BIT) |
| 199 | .max_width = 8, |
| 200 | .host_caps = MMC_CAP_8_BIT_DATA, |
| 201 | #endif |
| 202 | }; |
| 203 | |
| 204 | static struct s3c_sdhci_platdata smdk6450_hsmmc2_pdata __initdata = { |
| 205 | .cd_type = S3C_SDHCI_CD_NONE, |
| 206 | }; |
| 207 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 208 | static struct s3c2410_platform_i2c s5p6450_i2c0_data __initdata = { |
| 209 | .flags = 0, |
| 210 | .slave_addr = 0x10, |
| 211 | .frequency = 100*1000, |
| 212 | .sda_delay = 100, |
| 213 | .cfg_gpio = s5p6450_i2c0_cfg_gpio, |
| 214 | }; |
| 215 | |
| 216 | static struct s3c2410_platform_i2c s5p6450_i2c1_data __initdata = { |
| 217 | .flags = 0, |
| 218 | .bus_num = 1, |
| 219 | .slave_addr = 0x10, |
| 220 | .frequency = 100*1000, |
| 221 | .sda_delay = 100, |
| 222 | .cfg_gpio = s5p6450_i2c1_cfg_gpio, |
| 223 | }; |
| 224 | |
| 225 | static struct i2c_board_info smdk6450_i2c_devs0[] __initdata = { |
Jassi Brar | fcf8897 | 2010-12-21 09:48:32 +0900 | [diff] [blame] | 226 | { I2C_BOARD_INFO("wm8580", 0x1b), }, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 227 | { I2C_BOARD_INFO("24c08", 0x50), }, /* Samsung KS24C080C EEPROM */ |
| 228 | }; |
| 229 | |
| 230 | static struct i2c_board_info smdk6450_i2c_devs1[] __initdata = { |
| 231 | { I2C_BOARD_INFO("24c128", 0x57), },/* Samsung S524AD0XD1 EEPROM */ |
| 232 | }; |
| 233 | |
Banajit Goswami | 543601f | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 234 | /* LCD Backlight data */ |
| 235 | static struct samsung_bl_gpio_info smdk6450_bl_gpio_info = { |
| 236 | .no = S5P6450_GPF(15), |
| 237 | .func = S3C_GPIO_SFN(2), |
| 238 | }; |
| 239 | |
| 240 | static struct platform_pwm_backlight_data smdk6450_bl_data = { |
| 241 | .pwm_id = 1, |
| 242 | }; |
| 243 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 244 | static void __init smdk6450_map_io(void) |
| 245 | { |
Kukjin Kim | 95af214 | 2011-12-22 23:28:28 +0100 | [diff] [blame] | 246 | s5p64x0_init_io(NULL, 0); |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 247 | s3c24xx_init_clocks(19200000); |
| 248 | s3c24xx_init_uarts(smdk6450_uartcfgs, ARRAY_SIZE(smdk6450_uartcfgs)); |
Sangbeom Kim | 20780fc | 2011-03-12 08:02:12 +0900 | [diff] [blame] | 249 | s5p_set_timer_source(S5P_PWM3, S5P_PWM4); |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 250 | } |
| 251 | |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 252 | static void s5p6450_set_lcd_interface(void) |
| 253 | { |
| 254 | unsigned int cfg; |
| 255 | |
| 256 | /* select TFT LCD type (RGB I/F) */ |
| 257 | cfg = __raw_readl(S5P64X0_SPCON0); |
| 258 | cfg &= ~S5P64X0_SPCON0_LCD_SEL_MASK; |
| 259 | cfg |= S5P64X0_SPCON0_LCD_SEL_RGB; |
| 260 | __raw_writel(cfg, S5P64X0_SPCON0); |
| 261 | } |
| 262 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 263 | static void __init smdk6450_machine_init(void) |
| 264 | { |
Naveen Krishna Chatradhi | 0804765 | 2011-08-19 21:56:10 +0900 | [diff] [blame] | 265 | s3c24xx_ts_set_platdata(NULL); |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 266 | |
| 267 | s3c_i2c0_set_platdata(&s5p6450_i2c0_data); |
| 268 | s3c_i2c1_set_platdata(&s5p6450_i2c1_data); |
| 269 | i2c_register_board_info(0, smdk6450_i2c_devs0, |
| 270 | ARRAY_SIZE(smdk6450_i2c_devs0)); |
| 271 | i2c_register_board_info(1, smdk6450_i2c_devs1, |
| 272 | ARRAY_SIZE(smdk6450_i2c_devs1)); |
| 273 | |
Banajit Goswami | 543601f | 2011-07-20 23:45:22 +0900 | [diff] [blame] | 274 | samsung_bl_set(&smdk6450_bl_gpio_info, &smdk6450_bl_data); |
| 275 | |
Ajay Kumar | 7301794 | 2011-09-27 07:53:20 +0900 | [diff] [blame] | 276 | s5p6450_set_lcd_interface(); |
| 277 | s3c_fb_set_platdata(&smdk6450_lcd_pdata); |
| 278 | |
Rajeshwari Shinde | 6640790 | 2011-12-26 16:33:00 +0900 | [diff] [blame] | 279 | s3c_sdhci0_set_platdata(&smdk6450_hsmmc0_pdata); |
| 280 | s3c_sdhci1_set_platdata(&smdk6450_hsmmc1_pdata); |
| 281 | s3c_sdhci2_set_platdata(&smdk6450_hsmmc2_pdata); |
| 282 | |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 283 | platform_add_devices(smdk6450_devices, ARRAY_SIZE(smdk6450_devices)); |
| 284 | } |
| 285 | |
| 286 | MACHINE_START(SMDK6450, "SMDK6450") |
| 287 | /* Maintainer: Kukjin Kim <kgene.kim@samsung.com> */ |
Nicolas Pitre | 32bc820 | 2011-07-05 22:38:17 -0400 | [diff] [blame] | 288 | .atag_offset = 0x100, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 289 | |
| 290 | .init_irq = s5p6450_init_irq, |
Jamie Iles | bb3a4eb | 2011-09-27 20:53:31 +0100 | [diff] [blame] | 291 | .handle_irq = vic_handle_irq, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 292 | .map_io = smdk6450_map_io, |
| 293 | .init_machine = smdk6450_machine_init, |
Sangbeom Kim | 20780fc | 2011-03-12 08:02:12 +0900 | [diff] [blame] | 294 | .timer = &s5p_timer, |
Kukjin Kim | 73aed8b | 2011-12-22 23:34:25 +0100 | [diff] [blame] | 295 | .restart = s5p64x0_restart, |
Kukjin Kim | 6f315cb | 2010-09-01 13:03:39 +0900 | [diff] [blame] | 296 | MACHINE_END |