Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 //
0003 // Copyright (c) 2006 Simtec Electronics
0004 //  Ben Dooks <ben@simtec.co.uk>
0005 //
0006 // Thanks to Dimity Andric (TomTom) and Steven Ryu (Samsung) for the
0007 // loans of SMDK2413 to work with.
0008 
0009 #include <linux/kernel.h>
0010 #include <linux/types.h>
0011 #include <linux/interrupt.h>
0012 #include <linux/list.h>
0013 #include <linux/timer.h>
0014 #include <linux/init.h>
0015 #include <linux/gpio.h>
0016 #include <linux/serial_core.h>
0017 #include <linux/serial_s3c.h>
0018 #include <linux/platform_device.h>
0019 #include <linux/io.h>
0020 #include <linux/memblock.h>
0021 
0022 #include <asm/mach/arch.h>
0023 #include <asm/mach/map.h>
0024 #include <asm/mach/irq.h>
0025 
0026 #include <asm/hardware/iomd.h>
0027 #include <asm/setup.h>
0028 #include <asm/irq.h>
0029 #include <asm/mach-types.h>
0030 
0031 //#include <asm/debug-ll.h>
0032 #include "hardware-s3c24xx.h"
0033 #include "regs-gpio.h"
0034 
0035 #include <linux/platform_data/usb-s3c2410_udc.h>
0036 #include <linux/platform_data/i2c-s3c2410.h>
0037 #include <linux/platform_data/fb-s3c2410.h>
0038 #include "gpio-samsung.h"
0039 #include "gpio-cfg.h"
0040 
0041 #include "devs.h"
0042 #include "cpu.h"
0043 
0044 #include "s3c24xx.h"
0045 #include "common-smdk-s3c24xx.h"
0046 
0047 static struct map_desc smdk2413_iodesc[] __initdata = {
0048 };
0049 
0050 static struct s3c2410_uartcfg smdk2413_uartcfgs[] __initdata = {
0051     [0] = {
0052         .hwport      = 0,
0053         .flags       = 0,
0054         .ucon        = 0x3c5,
0055         .ulcon       = 0x03,
0056         .ufcon       = 0x51,
0057     },
0058     [1] = {
0059         .hwport      = 1,
0060         .flags       = 0,
0061         .ucon        = 0x3c5,
0062         .ulcon       = 0x03,
0063         .ufcon       = 0x51,
0064     },
0065     /* IR port */
0066     [2] = {
0067         .hwport      = 2,
0068         .flags       = 0,
0069         .ucon        = 0x3c5,
0070         .ulcon       = 0x43,
0071         .ufcon       = 0x51,
0072     }
0073 };
0074 
0075 
0076 static struct s3c2410_udc_mach_info smdk2413_udc_cfg __initdata = {
0077     .pullup_pin = S3C2410_GPF(2),
0078 };
0079 
0080 
0081 static struct platform_device *smdk2413_devices[] __initdata = {
0082     &s3c_device_ohci,
0083     &s3c_device_wdt,
0084     &s3c_device_i2c0,
0085     &s3c_device_iis,
0086     &s3c_device_usbgadget,
0087     &s3c2412_device_dma,
0088 };
0089 
0090 static void __init smdk2413_fixup(struct tag *tags, char **cmdline)
0091 {
0092     if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
0093         memblock_add(0x30000000, SZ_64M);
0094     }
0095 }
0096 
0097 static void __init smdk2413_map_io(void)
0098 {
0099     s3c24xx_init_io(smdk2413_iodesc, ARRAY_SIZE(smdk2413_iodesc));
0100     s3c24xx_init_uarts(smdk2413_uartcfgs, ARRAY_SIZE(smdk2413_uartcfgs));
0101     s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0102 }
0103 
0104 static void __init smdk2413_init_time(void)
0105 {
0106     s3c2412_init_clocks(12000000);
0107     s3c24xx_timer_init();
0108 }
0109 
0110 static void __init smdk2413_machine_init(void)
0111 {   /* Turn off suspend on both USB ports, and switch the
0112      * selectable USB port to USB device mode. */
0113 
0114     s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
0115                   S3C2410_MISCCR_USBSUSPND0 |
0116                   S3C2410_MISCCR_USBSUSPND1, 0x0);
0117 
0118 
0119     s3c24xx_udc_set_platdata(&smdk2413_udc_cfg);
0120     s3c_i2c0_set_platdata(NULL);
0121     /* Configure the I2S pins (GPE0...GPE4) in correct mode */
0122     s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
0123                   S3C_GPIO_PULL_NONE);
0124 
0125     platform_add_devices(smdk2413_devices, ARRAY_SIZE(smdk2413_devices));
0126     smdk_machine_init();
0127 }
0128 
0129 MACHINE_START(S3C2413, "S3C2413")
0130     /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
0131     .atag_offset    = 0x100,
0132     .nr_irqs    = NR_IRQS_S3C2412,
0133 
0134     .fixup      = smdk2413_fixup,
0135     .init_irq   = s3c2412_init_irq,
0136     .map_io     = smdk2413_map_io,
0137     .init_machine   = smdk2413_machine_init,
0138     .init_time  = s3c24xx_timer_init,
0139 MACHINE_END
0140 
0141 MACHINE_START(SMDK2412, "SMDK2412")
0142     /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
0143     .atag_offset    = 0x100,
0144     .nr_irqs    = NR_IRQS_S3C2412,
0145 
0146     .fixup      = smdk2413_fixup,
0147     .init_irq   = s3c2412_init_irq,
0148     .map_io     = smdk2413_map_io,
0149     .init_machine   = smdk2413_machine_init,
0150     .init_time  = s3c24xx_timer_init,
0151 MACHINE_END
0152 
0153 MACHINE_START(SMDK2413, "SMDK2413")
0154     /* Maintainer: Ben Dooks <ben-linux@fluff.org> */
0155     .atag_offset    = 0x100,
0156     .nr_irqs    = NR_IRQS_S3C2412,
0157 
0158     .fixup      = smdk2413_fixup,
0159     .init_irq   = s3c2412_init_irq,
0160     .map_io     = smdk2413_map_io,
0161     .init_machine   = smdk2413_machine_init,
0162     .init_time  = smdk2413_init_time,
0163 MACHINE_END