Path: blob/master/arch/sh/kernel/cpu/sh4/setup-sh4-202.c
37217 views
/*1* SH4-202 Setup2*3* Copyright (C) 2006 Paul Mundt4* Copyright (C) 2009 Magnus Damm5*6* This file is subject to the terms and conditions of the GNU General Public7* License. See the file "COPYING" in the main directory of this archive8* for more details.9*/10#include <linux/platform_device.h>11#include <linux/init.h>12#include <linux/serial.h>13#include <linux/serial_sci.h>14#include <linux/sh_timer.h>15#include <linux/io.h>1617static struct plat_sci_port scif0_platform_data = {18.mapbase = 0xffe80000,19.flags = UPF_BOOT_AUTOCONF,20.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,21.scbrr_algo_id = SCBRR_ALGO_2,22.type = PORT_SCIF,23.irqs = { 40, 41, 43, 42 },24};2526static struct platform_device scif0_device = {27.name = "sh-sci",28.id = 0,29.dev = {30.platform_data = &scif0_platform_data,31},32};3334static struct sh_timer_config tmu0_platform_data = {35.channel_offset = 0x04,36.timer_bit = 0,37.clockevent_rating = 200,38};3940static struct resource tmu0_resources[] = {41[0] = {42.start = 0xffd80008,43.end = 0xffd80013,44.flags = IORESOURCE_MEM,45},46[1] = {47.start = 16,48.flags = IORESOURCE_IRQ,49},50};5152static struct platform_device tmu0_device = {53.name = "sh_tmu",54.id = 0,55.dev = {56.platform_data = &tmu0_platform_data,57},58.resource = tmu0_resources,59.num_resources = ARRAY_SIZE(tmu0_resources),60};6162static struct sh_timer_config tmu1_platform_data = {63.channel_offset = 0x10,64.timer_bit = 1,65.clocksource_rating = 200,66};6768static struct resource tmu1_resources[] = {69[0] = {70.start = 0xffd80014,71.end = 0xffd8001f,72.flags = IORESOURCE_MEM,73},74[1] = {75.start = 17,76.flags = IORESOURCE_IRQ,77},78};7980static struct platform_device tmu1_device = {81.name = "sh_tmu",82.id = 1,83.dev = {84.platform_data = &tmu1_platform_data,85},86.resource = tmu1_resources,87.num_resources = ARRAY_SIZE(tmu1_resources),88};8990static struct sh_timer_config tmu2_platform_data = {91.channel_offset = 0x1c,92.timer_bit = 2,93};9495static struct resource tmu2_resources[] = {96[0] = {97.start = 0xffd80020,98.end = 0xffd8002f,99.flags = IORESOURCE_MEM,100},101[1] = {102.start = 18,103.flags = IORESOURCE_IRQ,104},105};106107static struct platform_device tmu2_device = {108.name = "sh_tmu",109.id = 2,110.dev = {111.platform_data = &tmu2_platform_data,112},113.resource = tmu2_resources,114.num_resources = ARRAY_SIZE(tmu2_resources),115};116117static struct platform_device *sh4202_devices[] __initdata = {118&scif0_device,119&tmu0_device,120&tmu1_device,121&tmu2_device,122};123124static int __init sh4202_devices_setup(void)125{126return platform_add_devices(sh4202_devices,127ARRAY_SIZE(sh4202_devices));128}129arch_initcall(sh4202_devices_setup);130131static struct platform_device *sh4202_early_devices[] __initdata = {132&scif0_device,133&tmu0_device,134&tmu1_device,135&tmu2_device,136};137138void __init plat_early_device_setup(void)139{140early_platform_add_devices(sh4202_early_devices,141ARRAY_SIZE(sh4202_early_devices));142}143144enum {145UNUSED = 0,146147/* interrupt sources */148IRL0, IRL1, IRL2, IRL3, /* only IRLM mode supported */149HUDI, TMU0, TMU1, TMU2, RTC, SCIF, WDT,150};151152static struct intc_vect vectors[] __initdata = {153INTC_VECT(HUDI, 0x600),154INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),155INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2, 0x460),156INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0),157INTC_VECT(RTC, 0x4c0),158INTC_VECT(SCIF, 0x700), INTC_VECT(SCIF, 0x720),159INTC_VECT(SCIF, 0x740), INTC_VECT(SCIF, 0x760),160INTC_VECT(WDT, 0x560),161};162163static struct intc_prio_reg prio_registers[] __initdata = {164{ 0xffd00004, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },165{ 0xffd00008, 0, 16, 4, /* IPRB */ { WDT, 0, 0, 0 } },166{ 0xffd0000c, 0, 16, 4, /* IPRC */ { 0, 0, SCIF, HUDI } },167{ 0xffd00010, 0, 16, 4, /* IPRD */ { IRL0, IRL1, IRL2, IRL3 } },168};169170static DECLARE_INTC_DESC(intc_desc, "sh4-202", vectors, NULL,171NULL, prio_registers, NULL);172173static struct intc_vect vectors_irlm[] __initdata = {174INTC_VECT(IRL0, 0x240), INTC_VECT(IRL1, 0x2a0),175INTC_VECT(IRL2, 0x300), INTC_VECT(IRL3, 0x360),176};177178static DECLARE_INTC_DESC(intc_desc_irlm, "sh4-202_irlm", vectors_irlm, NULL,179NULL, prio_registers, NULL);180181void __init plat_irq_setup(void)182{183register_intc_controller(&intc_desc);184}185186#define INTC_ICR 0xffd00000UL187#define INTC_ICR_IRLM (1<<7)188189void __init plat_irq_setup_pins(int mode)190{191switch (mode) {192case IRQ_MODE_IRQ: /* individual interrupt mode for IRL3-0 */193__raw_writew(__raw_readw(INTC_ICR) | INTC_ICR_IRLM, INTC_ICR);194register_intc_controller(&intc_desc_irlm);195break;196default:197BUG();198}199}200201202