Path: blob/master/arch/sh/kernel/cpu/sh2a/setup-mxg.c
17359 views
/*1* Renesas MX-G (R8A03022BG) Setup2*3* Copyright (C) 2008, 2009 Paul Mundt4*5* This file is subject to the terms and conditions of the GNU General Public6* License. See the file "COPYING" in the main directory of this archive7* for more details.8*/9#include <linux/platform_device.h>10#include <linux/init.h>11#include <linux/serial.h>12#include <linux/serial_sci.h>13#include <linux/sh_timer.h>1415enum {16UNUSED = 0,1718/* interrupt sources */19IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,20IRQ8, IRQ9, IRQ10, IRQ11, IRQ12, IRQ13, IRQ14, IRQ15,2122PINT0, PINT1, PINT2, PINT3, PINT4, PINT5, PINT6, PINT7,23SINT8, SINT7, SINT6, SINT5, SINT4, SINT3, SINT2, SINT1,2425SCIF0, SCIF1,2627MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3, MTU2_GROUP4, MTU2_GROUP5,28MTU2_TGI3B, MTU2_TGI3C,2930/* interrupt groups */31PINT,32};3334static struct intc_vect vectors[] __initdata = {35INTC_IRQ(IRQ0, 64), INTC_IRQ(IRQ1, 65),36INTC_IRQ(IRQ2, 66), INTC_IRQ(IRQ3, 67),37INTC_IRQ(IRQ4, 68), INTC_IRQ(IRQ5, 69),38INTC_IRQ(IRQ6, 70), INTC_IRQ(IRQ7, 71),39INTC_IRQ(IRQ8, 72), INTC_IRQ(IRQ9, 73),40INTC_IRQ(IRQ10, 74), INTC_IRQ(IRQ11, 75),41INTC_IRQ(IRQ12, 76), INTC_IRQ(IRQ13, 77),42INTC_IRQ(IRQ14, 78), INTC_IRQ(IRQ15, 79),4344INTC_IRQ(PINT0, 80), INTC_IRQ(PINT1, 81),45INTC_IRQ(PINT2, 82), INTC_IRQ(PINT3, 83),46INTC_IRQ(PINT4, 84), INTC_IRQ(PINT5, 85),47INTC_IRQ(PINT6, 86), INTC_IRQ(PINT7, 87),4849INTC_IRQ(SINT8, 94), INTC_IRQ(SINT7, 95),50INTC_IRQ(SINT6, 96), INTC_IRQ(SINT5, 97),51INTC_IRQ(SINT4, 98), INTC_IRQ(SINT3, 99),52INTC_IRQ(SINT2, 100), INTC_IRQ(SINT1, 101),5354INTC_IRQ(SCIF0, 220), INTC_IRQ(SCIF0, 221),55INTC_IRQ(SCIF0, 222), INTC_IRQ(SCIF0, 223),56INTC_IRQ(SCIF1, 224), INTC_IRQ(SCIF1, 225),57INTC_IRQ(SCIF1, 226), INTC_IRQ(SCIF1, 227),5859INTC_IRQ(MTU2_GROUP1, 228), INTC_IRQ(MTU2_GROUP1, 229),60INTC_IRQ(MTU2_GROUP1, 230), INTC_IRQ(MTU2_GROUP1, 231),61INTC_IRQ(MTU2_GROUP1, 232), INTC_IRQ(MTU2_GROUP1, 233),6263INTC_IRQ(MTU2_GROUP2, 234), INTC_IRQ(MTU2_GROUP2, 235),64INTC_IRQ(MTU2_GROUP2, 236), INTC_IRQ(MTU2_GROUP2, 237),65INTC_IRQ(MTU2_GROUP2, 238), INTC_IRQ(MTU2_GROUP2, 239),6667INTC_IRQ(MTU2_GROUP3, 240), INTC_IRQ(MTU2_GROUP3, 241),68INTC_IRQ(MTU2_GROUP3, 242), INTC_IRQ(MTU2_GROUP3, 243),6970INTC_IRQ(MTU2_TGI3B, 244),71INTC_IRQ(MTU2_TGI3C, 245),7273INTC_IRQ(MTU2_GROUP4, 246), INTC_IRQ(MTU2_GROUP4, 247),74INTC_IRQ(MTU2_GROUP4, 248), INTC_IRQ(MTU2_GROUP4, 249),75INTC_IRQ(MTU2_GROUP4, 250), INTC_IRQ(MTU2_GROUP4, 251),7677INTC_IRQ(MTU2_GROUP5, 252), INTC_IRQ(MTU2_GROUP5, 253),78INTC_IRQ(MTU2_GROUP5, 254), INTC_IRQ(MTU2_GROUP5, 255),79};8081static struct intc_group groups[] __initdata = {82INTC_GROUP(PINT, PINT0, PINT1, PINT2, PINT3,83PINT4, PINT5, PINT6, PINT7),84};8586static struct intc_prio_reg prio_registers[] __initdata = {87{ 0xfffd9418, 0, 16, 4, /* IPR01 */ { IRQ0, IRQ1, IRQ2, IRQ3 } },88{ 0xfffd941a, 0, 16, 4, /* IPR02 */ { IRQ4, IRQ5, IRQ6, IRQ7 } },89{ 0xfffd941c, 0, 16, 4, /* IPR03 */ { IRQ8, IRQ9, IRQ10, IRQ11 } },90{ 0xfffd941e, 0, 16, 4, /* IPR04 */ { IRQ12, IRQ13, IRQ14, IRQ15 } },91{ 0xfffd9420, 0, 16, 4, /* IPR05 */ { PINT, 0, 0, 0 } },92{ 0xfffd9800, 0, 16, 4, /* IPR06 */ { } },93{ 0xfffd9802, 0, 16, 4, /* IPR07 */ { } },94{ 0xfffd9804, 0, 16, 4, /* IPR08 */ { } },95{ 0xfffd9806, 0, 16, 4, /* IPR09 */ { } },96{ 0xfffd9808, 0, 16, 4, /* IPR10 */ { } },97{ 0xfffd980a, 0, 16, 4, /* IPR11 */ { } },98{ 0xfffd980c, 0, 16, 4, /* IPR12 */ { } },99{ 0xfffd980e, 0, 16, 4, /* IPR13 */ { } },100{ 0xfffd9810, 0, 16, 4, /* IPR14 */ { 0, 0, 0, SCIF0 } },101{ 0xfffd9812, 0, 16, 4, /* IPR15 */102{ SCIF1, MTU2_GROUP1, MTU2_GROUP2, MTU2_GROUP3 } },103{ 0xfffd9814, 0, 16, 4, /* IPR16 */104{ MTU2_TGI3B, MTU2_TGI3C, MTU2_GROUP4, MTU2_GROUP5 } },105};106107static struct intc_mask_reg mask_registers[] __initdata = {108{ 0xfffd9408, 0, 16, /* PINTER */109{ 0, 0, 0, 0, 0, 0, 0, 0,110PINT7, PINT6, PINT5, PINT4, PINT3, PINT2, PINT1, PINT0 } },111};112113static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,114mask_registers, prio_registers, NULL);115116static struct sh_timer_config mtu2_0_platform_data = {117.channel_offset = -0x80,118.timer_bit = 0,119.clockevent_rating = 200,120};121122static struct resource mtu2_0_resources[] = {123[0] = {124.start = 0xff801300,125.end = 0xff801326,126.flags = IORESOURCE_MEM,127},128[1] = {129.start = 228,130.flags = IORESOURCE_IRQ,131},132};133134static struct platform_device mtu2_0_device = {135.name = "sh_mtu2",136.id = 0,137.dev = {138.platform_data = &mtu2_0_platform_data,139},140.resource = mtu2_0_resources,141.num_resources = ARRAY_SIZE(mtu2_0_resources),142};143144static struct sh_timer_config mtu2_1_platform_data = {145.channel_offset = -0x100,146.timer_bit = 1,147.clockevent_rating = 200,148};149150static struct resource mtu2_1_resources[] = {151[0] = {152.start = 0xff801380,153.end = 0xff801390,154.flags = IORESOURCE_MEM,155},156[1] = {157.start = 234,158.flags = IORESOURCE_IRQ,159},160};161162static struct platform_device mtu2_1_device = {163.name = "sh_mtu2",164.id = 1,165.dev = {166.platform_data = &mtu2_1_platform_data,167},168.resource = mtu2_1_resources,169.num_resources = ARRAY_SIZE(mtu2_1_resources),170};171172static struct sh_timer_config mtu2_2_platform_data = {173.channel_offset = 0x80,174.timer_bit = 2,175.clockevent_rating = 200,176};177178static struct resource mtu2_2_resources[] = {179[0] = {180.start = 0xff801000,181.end = 0xff80100a,182.flags = IORESOURCE_MEM,183},184[1] = {185.start = 240,186.flags = IORESOURCE_IRQ,187},188};189190static struct platform_device mtu2_2_device = {191.name = "sh_mtu2",192.id = 2,193.dev = {194.platform_data = &mtu2_2_platform_data,195},196.resource = mtu2_2_resources,197.num_resources = ARRAY_SIZE(mtu2_2_resources),198};199200static struct plat_sci_port scif0_platform_data = {201.mapbase = 0xff804000,202.flags = UPF_BOOT_AUTOCONF,203.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE,204.scbrr_algo_id = SCBRR_ALGO_2,205.type = PORT_SCIF,206.irqs = { 220, 220, 220, 220 },207};208209static struct platform_device scif0_device = {210.name = "sh-sci",211.id = 0,212.dev = {213.platform_data = &scif0_platform_data,214},215};216217static struct platform_device *mxg_devices[] __initdata = {218&scif0_device,219&mtu2_0_device,220&mtu2_1_device,221&mtu2_2_device,222};223224static int __init mxg_devices_setup(void)225{226return platform_add_devices(mxg_devices,227ARRAY_SIZE(mxg_devices));228}229arch_initcall(mxg_devices_setup);230231void __init plat_irq_setup(void)232{233register_intc_controller(&intc_desc);234}235236static struct platform_device *mxg_early_devices[] __initdata = {237&scif0_device,238&mtu2_0_device,239&mtu2_1_device,240&mtu2_2_device,241};242243void __init plat_early_device_setup(void)244{245early_platform_add_devices(mxg_early_devices,246ARRAY_SIZE(mxg_early_devices));247}248249250