Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 //
0003 // Copyright (c) 2007 TinCanTools
0004 //  David Anders <danders@amltd.com>
0005 //
0006 // @History:
0007 // derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
0008 // Ben Dooks <ben@simtec.co.uk>
0009 
0010 #include <linux/gpio/machine.h>
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/device.h>
0018 #include <linux/platform_device.h>
0019 #include <linux/serial_core.h>
0020 #include <linux/serial_s3c.h>
0021 #include <linux/io.h>
0022 
0023 #include <asm/mach/arch.h>
0024 #include <asm/mach/map.h>
0025 #include <asm/mach/irq.h>
0026 #include <asm/mach/flash.h>
0027 
0028 #include <asm/irq.h>
0029 #include <asm/mach-types.h>
0030 
0031 #include <linux/platform_data/i2c-s3c2410.h>
0032 #include "devs.h"
0033 #include "cpu.h"
0034 
0035 #include <linux/mtd/mtd.h>
0036 #include <linux/mtd/partitions.h>
0037 #include <linux/mtd/map.h>
0038 #include <linux/mtd/physmap.h>
0039 
0040 #include "s3c24xx.h"
0041 
0042 static struct resource tct_hammer_nor_resource =
0043             DEFINE_RES_MEM(0x00000000, SZ_16M);
0044 
0045 static struct mtd_partition tct_hammer_mtd_partitions[] = {
0046     {
0047         .name       = "System",
0048         .size       = 0x240000,
0049         .offset     = 0,
0050         .mask_flags     = MTD_WRITEABLE,  /* force read-only */
0051     }, {
0052         .name       = "JFFS2",
0053         .size       = MTDPART_SIZ_FULL,
0054         .offset     = MTDPART_OFS_APPEND,
0055     }
0056 };
0057 
0058 static struct physmap_flash_data tct_hammer_flash_data = {
0059     .width      = 2,
0060     .parts      = tct_hammer_mtd_partitions,
0061     .nr_parts   = ARRAY_SIZE(tct_hammer_mtd_partitions),
0062 };
0063 
0064 static struct platform_device tct_hammer_device_nor = {
0065     .name       = "physmap-flash",
0066     .id     = 0,
0067     .dev = {
0068             .platform_data = &tct_hammer_flash_data,
0069         },
0070     .num_resources  = 1,
0071     .resource   = &tct_hammer_nor_resource,
0072 };
0073 
0074 static struct map_desc tct_hammer_iodesc[] __initdata = {
0075 };
0076 
0077 #define UCON S3C2410_UCON_DEFAULT
0078 #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
0079 #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
0080 
0081 static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
0082     [0] = {
0083         .hwport      = 0,
0084         .flags       = 0,
0085         .ucon        = UCON,
0086         .ulcon       = ULCON,
0087         .ufcon       = UFCON,
0088     },
0089     [1] = {
0090         .hwport      = 1,
0091         .flags       = 0,
0092         .ucon        = UCON,
0093         .ulcon       = ULCON,
0094         .ufcon       = UFCON,
0095     },
0096     [2] = {
0097         .hwport      = 2,
0098         .flags       = 0,
0099         .ucon        = UCON,
0100         .ulcon       = ULCON,
0101         .ufcon       = UFCON,
0102     }
0103 };
0104 
0105 static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
0106     .dev_id = "s3c2410-sdi",
0107     .table = {
0108         /* bus pins */
0109         GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
0110         GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
0111         GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
0112         GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
0113         GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
0114         GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
0115         { },
0116     },
0117 };
0118 
0119 static struct platform_device *tct_hammer_devices[] __initdata = {
0120     &s3c_device_adc,
0121     &s3c_device_wdt,
0122     &s3c_device_i2c0,
0123     &s3c_device_ohci,
0124     &s3c_device_rtc,
0125     &s3c_device_usbgadget,
0126     &s3c_device_sdi,
0127     &tct_hammer_device_nor,
0128 };
0129 
0130 static void __init tct_hammer_map_io(void)
0131 {
0132     s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
0133     s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
0134     s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
0135 }
0136 
0137 static void __init tct_hammer_init_time(void)
0138 {
0139     s3c2410_init_clocks(12000000);
0140     s3c24xx_timer_init();
0141 }
0142 
0143 static void __init tct_hammer_init(void)
0144 {
0145     s3c_i2c0_set_platdata(NULL);
0146     gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
0147     platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
0148 }
0149 
0150 MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
0151     .atag_offset    = 0x100,
0152     .nr_irqs    = NR_IRQS_S3C2410,
0153     .map_io     = tct_hammer_map_io,
0154     .init_irq   = s3c2410_init_irq,
0155     .init_machine   = tct_hammer_init,
0156     .init_time  = tct_hammer_init_time,
0157 MACHINE_END