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> |
| 25 | |
| 26 | #include <asm/mach/arch.h> |
| 27 | #include <asm/mach/map.h> |
| 28 | |
| 29 | #include <mach/map.h> |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 30 | #include <mach/regs-fb.h> |
| 31 | #include <video/platform_lcd.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 32 | |
| 33 | #include <asm/irq.h> |
| 34 | #include <asm/mach-types.h> |
| 35 | |
| 36 | #include <plat/regs-serial.h> |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 37 | #include <plat/gpio-cfg.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 38 | |
| 39 | #include <plat/clock.h> |
| 40 | #include <plat/devs.h> |
| 41 | #include <plat/cpu.h> |
| 42 | #include <plat/s5pc100.h> |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 43 | #include <plat/fb.h> |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 44 | #include <plat/iic.h> |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame^] | 45 | #include <plat/ata.h> |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 46 | |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 47 | /* Following are default values for UCON, ULCON and UFCON UART registers */ |
| 48 | #define S5PC100_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \ |
| 49 | S3C2410_UCON_RXILEVEL | \ |
| 50 | S3C2410_UCON_TXIRQMODE | \ |
| 51 | S3C2410_UCON_RXIRQMODE | \ |
| 52 | S3C2410_UCON_RXFIFO_TOI | \ |
| 53 | S3C2443_UCON_RXERR_IRQEN) |
| 54 | |
| 55 | #define S5PC100_ULCON_DEFAULT S3C2410_LCON_CS8 |
| 56 | |
| 57 | #define S5PC100_UFCON_DEFAULT (S3C2410_UFCON_FIFOMODE | \ |
| 58 | S3C2440_UFCON_RXTRIG8 | \ |
| 59 | S3C2440_UFCON_TXTRIG16) |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 60 | |
| 61 | static struct s3c2410_uartcfg smdkc100_uartcfgs[] __initdata = { |
| 62 | [0] = { |
| 63 | .hwport = 0, |
| 64 | .flags = 0, |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 65 | .ucon = S5PC100_UCON_DEFAULT, |
| 66 | .ulcon = S5PC100_ULCON_DEFAULT, |
| 67 | .ufcon = S5PC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 68 | }, |
| 69 | [1] = { |
| 70 | .hwport = 1, |
| 71 | .flags = 0, |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 72 | .ucon = S5PC100_UCON_DEFAULT, |
| 73 | .ulcon = S5PC100_ULCON_DEFAULT, |
| 74 | .ufcon = S5PC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 75 | }, |
| 76 | [2] = { |
| 77 | .hwport = 2, |
| 78 | .flags = 0, |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 79 | .ucon = S5PC100_UCON_DEFAULT, |
| 80 | .ulcon = S5PC100_ULCON_DEFAULT, |
| 81 | .ufcon = S5PC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 82 | }, |
| 83 | [3] = { |
| 84 | .hwport = 3, |
| 85 | .flags = 0, |
Marek Szyprowski | 13e51fa | 2010-05-18 11:30:49 +0200 | [diff] [blame] | 86 | .ucon = S5PC100_UCON_DEFAULT, |
| 87 | .ulcon = S5PC100_ULCON_DEFAULT, |
| 88 | .ufcon = S5PC100_UFCON_DEFAULT, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 89 | }, |
| 90 | }; |
| 91 | |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 92 | /* I2C0 */ |
| 93 | static struct i2c_board_info i2c_devs0[] __initdata = { |
| 94 | }; |
| 95 | |
| 96 | /* I2C1 */ |
| 97 | static struct i2c_board_info i2c_devs1[] __initdata = { |
| 98 | }; |
| 99 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 100 | /* LCD power controller */ |
| 101 | static void smdkc100_lcd_power_set(struct plat_lcd_data *pd, |
| 102 | unsigned int power) |
| 103 | { |
| 104 | /* backlight */ |
| 105 | gpio_direction_output(S5PC100_GPD(0), power); |
| 106 | |
| 107 | if (power) { |
| 108 | /* module reset */ |
| 109 | gpio_direction_output(S5PC100_GPH0(6), 1); |
| 110 | mdelay(100); |
| 111 | gpio_direction_output(S5PC100_GPH0(6), 0); |
| 112 | mdelay(10); |
| 113 | gpio_direction_output(S5PC100_GPH0(6), 1); |
| 114 | mdelay(10); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | static struct plat_lcd_data smdkc100_lcd_power_data = { |
| 119 | .set_power = smdkc100_lcd_power_set, |
| 120 | }; |
| 121 | |
| 122 | static struct platform_device smdkc100_lcd_powerdev = { |
| 123 | .name = "platform-lcd", |
| 124 | .dev.parent = &s3c_device_fb.dev, |
| 125 | .dev.platform_data = &smdkc100_lcd_power_data, |
| 126 | }; |
| 127 | |
| 128 | /* Frame Buffer */ |
| 129 | static struct s3c_fb_pd_win smdkc100_fb_win0 = { |
| 130 | /* this is to ensure we use win0 */ |
| 131 | .win_mode = { |
Marek Szyprowski | 08d08fa | 2010-05-18 11:30:48 +0200 | [diff] [blame] | 132 | .pixclock = 1000000000000ULL / ((8+13+3+800)*(7+5+1+480)*80), |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 133 | .left_margin = 8, |
| 134 | .right_margin = 13, |
| 135 | .upper_margin = 7, |
| 136 | .lower_margin = 5, |
| 137 | .hsync_len = 3, |
| 138 | .vsync_len = 1, |
| 139 | .xres = 800, |
| 140 | .yres = 480, |
| 141 | }, |
| 142 | .max_bpp = 32, |
| 143 | .default_bpp = 16, |
| 144 | }; |
| 145 | |
| 146 | static struct s3c_fb_platdata smdkc100_lcd_pdata __initdata = { |
| 147 | .win[0] = &smdkc100_fb_win0, |
| 148 | .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB, |
| 149 | .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC, |
| 150 | .setup_gpio = s5pc100_fb_gpio_setup_24bpp, |
| 151 | }; |
| 152 | |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame^] | 153 | static struct s3c_ide_platdata smdkc100_ide_pdata __initdata = { |
| 154 | .setup_gpio = s5pc100_ide_setup_gpio, |
| 155 | }; |
| 156 | |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 157 | static struct platform_device *smdkc100_devices[] __initdata = { |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame^] | 158 | &s3c_device_cfcon, |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 159 | &s3c_device_i2c0, |
| 160 | &s3c_device_i2c1, |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 161 | &s3c_device_fb, |
Kyungmin Park | 0c31862 | 2009-11-17 08:41:24 +0100 | [diff] [blame] | 162 | &s3c_device_hsmmc0, |
| 163 | &s3c_device_hsmmc1, |
| 164 | &s3c_device_hsmmc2, |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 165 | &smdkc100_lcd_powerdev, |
Jassi Brar | 99c56e0 | 2010-05-18 16:02:44 +0900 | [diff] [blame] | 166 | &s5pc100_device_iis0, |
| 167 | &s5pc100_device_ac97, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 168 | }; |
| 169 | |
| 170 | static void __init smdkc100_map_io(void) |
| 171 | { |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 172 | s5p_init_io(NULL, 0, S5P_VA_CHIPID); |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 173 | s3c24xx_init_clocks(12000000); |
| 174 | s3c24xx_init_uarts(smdkc100_uartcfgs, ARRAY_SIZE(smdkc100_uartcfgs)); |
| 175 | } |
| 176 | |
| 177 | static void __init smdkc100_machine_init(void) |
| 178 | { |
Kyungmin Park | 067f131 | 2009-11-17 08:41:22 +0100 | [diff] [blame] | 179 | /* I2C */ |
| 180 | s3c_i2c0_set_platdata(NULL); |
| 181 | s3c_i2c1_set_platdata(NULL); |
| 182 | i2c_register_board_info(0, i2c_devs0, ARRAY_SIZE(i2c_devs0)); |
| 183 | i2c_register_board_info(1, i2c_devs1, ARRAY_SIZE(i2c_devs1)); |
| 184 | |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 185 | s3c_fb_set_platdata(&smdkc100_lcd_pdata); |
Abhilash Kesavan | 66194a7 | 2010-06-08 17:02:08 +0900 | [diff] [blame^] | 186 | s3c_ide_set_platdata(&smdkc100_ide_pdata); |
Kyungmin Park | 079b032 | 2009-11-17 08:41:20 +0100 | [diff] [blame] | 187 | |
| 188 | /* LCD init */ |
| 189 | gpio_request(S5PC100_GPD(0), "GPD"); |
| 190 | gpio_request(S5PC100_GPH0(6), "GPH0"); |
| 191 | smdkc100_lcd_power_set(&smdkc100_lcd_power_data, 0); |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 192 | platform_add_devices(smdkc100_devices, ARRAY_SIZE(smdkc100_devices)); |
| 193 | } |
| 194 | |
| 195 | MACHINE_START(SMDKC100, "SMDKC100") |
| 196 | /* Maintainer: Byungho Min <bhmin@samsung.com> */ |
Marek Szyprowski | acc8470 | 2010-05-20 07:51:08 +0200 | [diff] [blame] | 197 | .phys_io = S3C_PA_UART & 0xfff00000, |
| 198 | .io_pg_offst = (((u32)S3C_VA_UART) >> 18) & 0xfffc, |
| 199 | .boot_params = S5P_PA_SDRAM + 0x100, |
Byungho Min | e119766 | 2009-06-23 21:40:28 +0900 | [diff] [blame] | 200 | .init_irq = s5pc100_init_irq, |
| 201 | .map_io = smdkc100_map_io, |
| 202 | .init_machine = smdkc100_machine_init, |
| 203 | .timer = &s3c24xx_timer, |
| 204 | MACHINE_END |