Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 // linux/arch/arm/mach-s3c2440/mach-smdk2440.c
0003 //
0004 // Copyright (c) 2004-2005 Simtec Electronics
0005 //  Ben Dooks <ben@simtec.co.uk>
0006 //
0007 // http://www.fluff.org/ben/smdk2440/
0008 //
0009 // Thanks to Dimity Andric and TomTom for the loan of an SMDK2440.
0010 
0011 #include <linux/kernel.h>
0012 #include <linux/types.h>
0013 #include <linux/interrupt.h>
0014 #include <linux/list.h>
0015 #include <linux/timer.h>
0016 #include <linux/init.h>
0017 #include <linux/serial_core.h>
0018 #include <linux/serial_s3c.h>
0019 #include <linux/platform_device.h>
0020 #include <linux/io.h>
0021 
0022 #include <asm/mach/arch.h>
0023 #include <asm/mach/map.h>
0024 #include <asm/mach/irq.h>
0025 
0026 #include <asm/irq.h>
0027 #include <asm/mach-types.h>
0028 
0029 #include "regs-gpio.h"
0030 #include "gpio-samsung.h"
0031 #include "gpio-cfg.h"
0032 
0033 #include <linux/platform_data/fb-s3c2410.h>
0034 #include <linux/platform_data/i2c-s3c2410.h>
0035 
0036 #include "devs.h"
0037 #include "cpu.h"
0038 
0039 #include "s3c24xx.h"
0040 #include "common-smdk-s3c24xx.h"
0041 
0042 static struct map_desc smdk2440_iodesc[] __initdata = {
0043     /* ISA IO Space map (memory space selected by A24) */
0044 
0045     {
0046         .virtual    = (u32)S3C24XX_VA_ISA_BYTE,
0047         .pfn        = __phys_to_pfn(S3C2410_CS2),
0048         .length     = 0x10000,
0049         .type       = MT_DEVICE,
0050     }, {
0051         .virtual    = (u32)S3C24XX_VA_ISA_BYTE + 0x10000,
0052         .pfn        = __phys_to_pfn(S3C2410_CS2 + (1<<24)),
0053         .length     = SZ_4M,
0054         .type       = MT_DEVICE,
0055     }
0056 };
0057 
0058 #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK
0059 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
0060 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
0061 
0062 static struct s3c2410_uartcfg smdk2440_uartcfgs[] __initdata = {
0063     [0] = {
0064         .hwport      = 0,
0065         .flags       = 0,
0066         .ucon        = 0x3c5,
0067         .ulcon       = 0x03,
0068         .ufcon       = 0x51,
0069     },
0070     [1] = {
0071         .hwport      = 1,
0072         .flags       = 0,
0073         .ucon        = 0x3c5,
0074         .ulcon       = 0x03,
0075         .ufcon       = 0x51,
0076     },
0077     /* IR port */
0078     [2] = {
0079         .hwport      = 2,
0080         .flags       = 0,
0081         .ucon        = 0x3c5,
0082         .ulcon       = 0x43,
0083         .ufcon       = 0x51,
0084     }
0085 };
0086 
0087 /* LCD driver info */
0088 
0089 static struct s3c2410fb_display smdk2440_lcd_cfg __initdata = {
0090 
0091     .lcdcon5    = S3C2410_LCDCON5_FRM565 |
0092               S3C2410_LCDCON5_INVVLINE |
0093               S3C2410_LCDCON5_INVVFRAME |
0094               S3C2410_LCDCON5_PWREN |
0095               S3C2410_LCDCON5_HWSWP,
0096 
0097     .type       = S3C2410_LCDCON1_TFT,
0098 
0099     .width      = 240,
0100     .height     = 320,
0101 
0102     .pixclock   = 166667, /* HCLK 60 MHz, divisor 10 */
0103     .xres       = 240,
0104     .yres       = 320,
0105     .bpp        = 16,
0106     .left_margin    = 20,
0107     .right_margin   = 8,
0108     .hsync_len  = 4,
0109     .upper_margin   = 8,
0110     .lower_margin   = 7,
0111     .vsync_len  = 4,
0112 };
0113 
0114 static struct s3c2410fb_mach_info smdk2440_fb_info __initdata = {
0115     .displays   = &smdk2440_lcd_cfg,
0116     .num_displays   = 1,
0117     .default_display = 0,
0118 
0119 #if 0
0120     /* currently setup by downloader */
0121     .gpccon     = 0xaa940659,
0122     .gpccon_mask    = 0xffffffff,
0123     .gpcup      = 0x0000ffff,
0124     .gpcup_mask = 0xffffffff,
0125     .gpdcon     = 0xaa84aaa0,
0126     .gpdcon_mask    = 0xffffffff,
0127     .gpdup      = 0x0000faff,
0128     .gpdup_mask = 0xffffffff,
0129 
0130     .gpccon_reg = S3C2410_GPCCON,
0131     .gpcup_reg  = S3C2410_GPCUP,
0132     .gpdcon_reg = S3C2410_GPDCON,
0133     .gpdup_reg  = S3C2410_GPDUP,
0134 #endif
0135 
0136     .lpcsel     = ((0xCE6) & ~7) | 1<<4,
0137 };
0138 
0139 static struct platform_device *smdk2440_devices[] __initdata = {
0140     &s3c_device_ohci,
0141     &s3c_device_lcd,
0142     &s3c_device_wdt,
0143     &s3c_device_i2c0,
0144     &s3c_device_iis,
0145 };
0146 
0147 static void __init smdk2440_map_io(void)
0148 {
0149     s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc));
0150     s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs));
0151     s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0152 }
0153 
0154 static void __init smdk2440_init_time(void)
0155 {
0156     s3c2440_init_clocks(16934400);
0157     s3c24xx_timer_init();
0158 }
0159 
0160 static void __init smdk2440_machine_init(void)
0161 {
0162     s3c24xx_fb_set_platdata(&smdk2440_fb_info);
0163     s3c_i2c0_set_platdata(NULL);
0164     /* Configure the I2S pins (GPE0...GPE4) in correct mode */
0165     s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
0166                   S3C_GPIO_PULL_NONE);
0167     platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
0168     smdk_machine_init();
0169 }
0170 
0171 MACHINE_START(S3C2440, "SMDK2440")
0172     /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
0173     .atag_offset    = 0x100,
0174     .nr_irqs    = NR_IRQS_S3C2440,
0175 
0176     .init_irq   = s3c2440_init_irq,
0177     .map_io     = smdk2440_map_io,
0178     .init_machine   = smdk2440_machine_init,
0179     .init_time  = smdk2440_init_time,
0180 MACHINE_END