0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/kernel.h>
0009 #include <linux/types.h>
0010 #include <linux/interrupt.h>
0011 #include <linux/list.h>
0012 #include <linux/timer.h>
0013 #include <linux/init.h>
0014 #include <linux/serial_core.h>
0015 #include <linux/serial_s3c.h>
0016 #include <linux/platform_device.h>
0017 #include <linux/io.h>
0018 #include <linux/mtd/partitions.h>
0019 #include <linux/gpio.h>
0020 #include <linux/fb.h>
0021 #include <linux/delay.h>
0022
0023 #include <asm/mach/arch.h>
0024 #include <asm/mach/map.h>
0025 #include <asm/mach/irq.h>
0026
0027 #include <video/samsung_fimd.h>
0028 #include <asm/irq.h>
0029 #include <asm/mach-types.h>
0030
0031 #include "hardware-s3c24xx.h"
0032 #include "regs-gpio.h"
0033 #include "regs-s3c2443-clock.h"
0034 #include "gpio-samsung.h"
0035
0036 #include <linux/platform_data/leds-s3c24xx.h>
0037 #include <linux/platform_data/i2c-s3c2410.h>
0038
0039 #include "gpio-cfg.h"
0040 #include "devs.h"
0041 #include "cpu.h"
0042 #include <linux/platform_data/mtd-nand-s3c2410.h>
0043 #include "sdhci.h"
0044 #include <linux/platform_data/usb-s3c2410_udc.h>
0045 #include <linux/platform_data/s3c-hsudc.h>
0046
0047 #include "fb.h"
0048
0049 #include "s3c24xx.h"
0050 #include "common-smdk-s3c24xx.h"
0051
0052 static struct map_desc smdk2416_iodesc[] __initdata = {
0053
0054
0055 {
0056 .virtual = (u32)S3C24XX_VA_ISA_BYTE,
0057 .pfn = __phys_to_pfn(S3C2410_CS2),
0058 .length = 0x10000,
0059 .type = MT_DEVICE,
0060 }, {
0061 .virtual = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
0062 .pfn = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
0063 .length = SZ_4M,
0064 .type = MT_DEVICE,
0065 }
0066 };
0067
0068 #define UCON (S3C2410_UCON_DEFAULT | \
0069 S3C2440_UCON_PCLK | \
0070 S3C2443_UCON_RXERR_IRQEN)
0071
0072 #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE)
0073
0074 #define UFCON (S3C2410_UFCON_RXTRIG8 | \
0075 S3C2410_UFCON_FIFOMODE | \
0076 S3C2440_UFCON_TXTRIG16)
0077
0078 static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
0079 [0] = {
0080 .hwport = 0,
0081 .flags = 0,
0082 .ucon = UCON,
0083 .ulcon = ULCON,
0084 .ufcon = UFCON,
0085 },
0086 [1] = {
0087 .hwport = 1,
0088 .flags = 0,
0089 .ucon = UCON,
0090 .ulcon = ULCON,
0091 .ufcon = UFCON,
0092 },
0093
0094 [2] = {
0095 .hwport = 2,
0096 .flags = 0,
0097 .ucon = UCON,
0098 .ulcon = ULCON | 0x50,
0099 .ufcon = UFCON,
0100 },
0101 [3] = {
0102 .hwport = 3,
0103 .flags = 0,
0104 .ucon = UCON,
0105 .ulcon = ULCON,
0106 .ufcon = UFCON,
0107 }
0108 };
0109
0110 static void smdk2416_hsudc_gpio_init(void)
0111 {
0112 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_UP);
0113 s3c_gpio_setpull(S3C2410_GPF(2), S3C_GPIO_PULL_NONE);
0114 s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(1));
0115 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 0);
0116 }
0117
0118 static void smdk2416_hsudc_gpio_uninit(void)
0119 {
0120 s3c2410_modify_misccr(S3C2416_MISCCR_SEL_SUSPND, 1);
0121 s3c_gpio_setpull(S3C2410_GPH(14), S3C_GPIO_PULL_NONE);
0122 s3c_gpio_cfgpin(S3C2410_GPH(14), S3C_GPIO_SFN(0));
0123 }
0124
0125 static struct s3c24xx_hsudc_platdata smdk2416_hsudc_platdata = {
0126 .epnum = 9,
0127 .gpio_init = smdk2416_hsudc_gpio_init,
0128 .gpio_uninit = smdk2416_hsudc_gpio_uninit,
0129 };
0130
0131 static struct s3c_fb_pd_win smdk2416_fb_win[] = {
0132 [0] = {
0133 .default_bpp = 16,
0134 .max_bpp = 32,
0135 .xres = 800,
0136 .yres = 480,
0137 },
0138 };
0139
0140 static struct fb_videomode smdk2416_lcd_timing = {
0141 .pixclock = 41094,
0142 .left_margin = 8,
0143 .right_margin = 13,
0144 .upper_margin = 7,
0145 .lower_margin = 5,
0146 .hsync_len = 3,
0147 .vsync_len = 1,
0148 .xres = 800,
0149 .yres = 480,
0150 };
0151
0152 static void s3c2416_fb_gpio_setup_24bpp(void)
0153 {
0154 unsigned int gpio;
0155
0156 for (gpio = S3C2410_GPC(1); gpio <= S3C2410_GPC(4); gpio++) {
0157 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
0158 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
0159 }
0160
0161 for (gpio = S3C2410_GPC(8); gpio <= S3C2410_GPC(15); gpio++) {
0162 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
0163 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
0164 }
0165
0166 for (gpio = S3C2410_GPD(0); gpio <= S3C2410_GPD(15); gpio++) {
0167 s3c_gpio_cfgpin(gpio, S3C_GPIO_SFN(2));
0168 s3c_gpio_setpull(gpio, S3C_GPIO_PULL_NONE);
0169 }
0170 }
0171
0172 static struct s3c_fb_platdata smdk2416_fb_platdata = {
0173 .win[0] = &smdk2416_fb_win[0],
0174 .vtiming = &smdk2416_lcd_timing,
0175 .setup_gpio = s3c2416_fb_gpio_setup_24bpp,
0176 .vidcon0 = VIDCON0_VIDOUT_RGB | VIDCON0_PNRMODE_RGB,
0177 .vidcon1 = VIDCON1_INV_HSYNC | VIDCON1_INV_VSYNC,
0178 };
0179
0180 static struct s3c_sdhci_platdata smdk2416_hsmmc0_pdata __initdata = {
0181 .max_width = 4,
0182 .cd_type = S3C_SDHCI_CD_GPIO,
0183 .ext_cd_gpio = S3C2410_GPF(1),
0184 .ext_cd_gpio_invert = 1,
0185 };
0186
0187 static struct s3c_sdhci_platdata smdk2416_hsmmc1_pdata __initdata = {
0188 .max_width = 4,
0189 .cd_type = S3C_SDHCI_CD_NONE,
0190 };
0191
0192 static struct platform_device *smdk2416_devices[] __initdata = {
0193 &s3c_device_fb,
0194 &s3c_device_wdt,
0195 &s3c_device_ohci,
0196 &s3c_device_i2c0,
0197 &s3c_device_hsmmc0,
0198 &s3c_device_hsmmc1,
0199 &s3c_device_usb_hsudc,
0200 &s3c2443_device_dma,
0201 };
0202
0203 static void __init smdk2416_init_time(void)
0204 {
0205 s3c2416_init_clocks(12000000);
0206 s3c24xx_timer_init();
0207 }
0208
0209 static void __init smdk2416_map_io(void)
0210 {
0211 s3c24xx_init_io(smdk2416_iodesc, ARRAY_SIZE(smdk2416_iodesc));
0212 s3c24xx_init_uarts(smdk2416_uartcfgs, ARRAY_SIZE(smdk2416_uartcfgs));
0213 s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0214 }
0215
0216 static void __init smdk2416_machine_init(void)
0217 {
0218 s3c_i2c0_set_platdata(NULL);
0219 s3c_fb_set_platdata(&smdk2416_fb_platdata);
0220
0221 s3c_sdhci0_set_platdata(&smdk2416_hsmmc0_pdata);
0222 s3c_sdhci1_set_platdata(&smdk2416_hsmmc1_pdata);
0223
0224 s3c24xx_hsudc_set_platdata(&smdk2416_hsudc_platdata);
0225
0226 gpio_request(S3C2410_GPB(4), "USBHost Power");
0227 gpio_direction_output(S3C2410_GPB(4), 1);
0228
0229 gpio_request(S3C2410_GPB(3), "Display Power");
0230 gpio_direction_output(S3C2410_GPB(3), 1);
0231
0232 gpio_request(S3C2410_GPB(1), "Display Reset");
0233 gpio_direction_output(S3C2410_GPB(1), 1);
0234
0235 platform_add_devices(smdk2416_devices, ARRAY_SIZE(smdk2416_devices));
0236 smdk_machine_init();
0237 }
0238
0239 MACHINE_START(SMDK2416, "SMDK2416")
0240
0241 .atag_offset = 0x100,
0242 .nr_irqs = NR_IRQS_S3C2416,
0243
0244 .init_irq = s3c2416_init_irq,
0245 .map_io = smdk2416_map_io,
0246 .init_machine = smdk2416_machine_init,
0247 .init_time = smdk2416_init_time,
0248 MACHINE_END