cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

mach-tct_hammer.c (3844B)


      1// SPDX-License-Identifier: GPL-2.0+
      2//
      3// Copyright (c) 2007 TinCanTools
      4//	David Anders <danders@amltd.com>
      5//
      6// @History:
      7// derived from linux/arch/arm/mach-s3c2410/mach-bast.c, written by
      8// Ben Dooks <ben@simtec.co.uk>
      9
     10#include <linux/gpio/machine.h>
     11#include <linux/kernel.h>
     12#include <linux/types.h>
     13#include <linux/interrupt.h>
     14#include <linux/list.h>
     15#include <linux/timer.h>
     16#include <linux/init.h>
     17#include <linux/device.h>
     18#include <linux/platform_device.h>
     19#include <linux/serial_core.h>
     20#include <linux/serial_s3c.h>
     21#include <linux/io.h>
     22
     23#include <asm/mach/arch.h>
     24#include <asm/mach/map.h>
     25#include <asm/mach/irq.h>
     26#include <asm/mach/flash.h>
     27
     28#include <asm/irq.h>
     29#include <asm/mach-types.h>
     30
     31#include <linux/platform_data/i2c-s3c2410.h>
     32#include "devs.h"
     33#include "cpu.h"
     34
     35#include <linux/mtd/mtd.h>
     36#include <linux/mtd/partitions.h>
     37#include <linux/mtd/map.h>
     38#include <linux/mtd/physmap.h>
     39
     40#include "s3c24xx.h"
     41
     42static struct resource tct_hammer_nor_resource =
     43			DEFINE_RES_MEM(0x00000000, SZ_16M);
     44
     45static struct mtd_partition tct_hammer_mtd_partitions[] = {
     46	{
     47		.name		= "System",
     48		.size		= 0x240000,
     49		.offset		= 0,
     50		.mask_flags 	= MTD_WRITEABLE,  /* force read-only */
     51	}, {
     52		.name		= "JFFS2",
     53		.size		= MTDPART_SIZ_FULL,
     54		.offset		= MTDPART_OFS_APPEND,
     55	}
     56};
     57
     58static struct physmap_flash_data tct_hammer_flash_data = {
     59	.width		= 2,
     60	.parts		= tct_hammer_mtd_partitions,
     61	.nr_parts	= ARRAY_SIZE(tct_hammer_mtd_partitions),
     62};
     63
     64static struct platform_device tct_hammer_device_nor = {
     65	.name		= "physmap-flash",
     66	.id		= 0,
     67	.dev = {
     68			.platform_data = &tct_hammer_flash_data,
     69		},
     70	.num_resources	= 1,
     71	.resource	= &tct_hammer_nor_resource,
     72};
     73
     74static struct map_desc tct_hammer_iodesc[] __initdata = {
     75};
     76
     77#define UCON S3C2410_UCON_DEFAULT
     78#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
     79#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
     80
     81static struct s3c2410_uartcfg tct_hammer_uartcfgs[] = {
     82	[0] = {
     83		.hwport	     = 0,
     84		.flags	     = 0,
     85		.ucon	     = UCON,
     86		.ulcon	     = ULCON,
     87		.ufcon	     = UFCON,
     88	},
     89	[1] = {
     90		.hwport	     = 1,
     91		.flags	     = 0,
     92		.ucon	     = UCON,
     93		.ulcon	     = ULCON,
     94		.ufcon	     = UFCON,
     95	},
     96	[2] = {
     97		.hwport	     = 2,
     98		.flags	     = 0,
     99		.ucon	     = UCON,
    100		.ulcon	     = ULCON,
    101		.ufcon	     = UFCON,
    102	}
    103};
    104
    105static struct gpiod_lookup_table tct_hammer_mmc_gpio_table = {
    106	.dev_id = "s3c2410-sdi",
    107	.table = {
    108		/* bus pins */
    109		GPIO_LOOKUP_IDX("GPIOE",  5, "bus", 0, GPIO_ACTIVE_HIGH),
    110		GPIO_LOOKUP_IDX("GPIOE",  6, "bus", 1, GPIO_ACTIVE_HIGH),
    111		GPIO_LOOKUP_IDX("GPIOE",  7, "bus", 2, GPIO_ACTIVE_HIGH),
    112		GPIO_LOOKUP_IDX("GPIOE",  8, "bus", 3, GPIO_ACTIVE_HIGH),
    113		GPIO_LOOKUP_IDX("GPIOE",  9, "bus", 4, GPIO_ACTIVE_HIGH),
    114		GPIO_LOOKUP_IDX("GPIOE", 10, "bus", 5, GPIO_ACTIVE_HIGH),
    115		{ },
    116	},
    117};
    118
    119static struct platform_device *tct_hammer_devices[] __initdata = {
    120	&s3c_device_adc,
    121	&s3c_device_wdt,
    122	&s3c_device_i2c0,
    123	&s3c_device_ohci,
    124	&s3c_device_rtc,
    125	&s3c_device_usbgadget,
    126	&s3c_device_sdi,
    127	&tct_hammer_device_nor,
    128};
    129
    130static void __init tct_hammer_map_io(void)
    131{
    132	s3c24xx_init_io(tct_hammer_iodesc, ARRAY_SIZE(tct_hammer_iodesc));
    133	s3c24xx_init_uarts(tct_hammer_uartcfgs, ARRAY_SIZE(tct_hammer_uartcfgs));
    134	s3c24xx_set_timer_source(S3C24XX_PWM3, S3C24XX_PWM4);
    135}
    136
    137static void __init tct_hammer_init_time(void)
    138{
    139	s3c2410_init_clocks(12000000);
    140	s3c24xx_timer_init();
    141}
    142
    143static void __init tct_hammer_init(void)
    144{
    145	s3c_i2c0_set_platdata(NULL);
    146	gpiod_add_lookup_table(&tct_hammer_mmc_gpio_table);
    147	platform_add_devices(tct_hammer_devices, ARRAY_SIZE(tct_hammer_devices));
    148}
    149
    150MACHINE_START(TCT_HAMMER, "TCT_HAMMER")
    151	.atag_offset	= 0x100,
    152	.nr_irqs	= NR_IRQS_S3C2410,
    153	.map_io		= tct_hammer_map_io,
    154	.init_irq	= s3c2410_init_irq,
    155	.init_machine	= tct_hammer_init,
    156	.init_time	= tct_hammer_init_time,
    157MACHINE_END