1e5723e0eSPaul Mundt /* 2ac919986SMagnus Damm * SH3 Setup code for SH7710, SH7712 3e5723e0eSPaul Mundt * 4*56d604deSPaul Mundt * Copyright (C) 2006 - 2009 Paul Mundt 59465a54fSNobuhiro Iwamatsu * Copyright (C) 2007 Nobuhiro Iwamatsu 6e5723e0eSPaul Mundt * 7e5723e0eSPaul Mundt * This file is subject to the terms and conditions of the GNU General Public 8e5723e0eSPaul Mundt * License. See the file "COPYING" in the main directory of this archive 9e5723e0eSPaul Mundt * for more details. 10e5723e0eSPaul Mundt */ 11e5723e0eSPaul Mundt #include <linux/platform_device.h> 12e5723e0eSPaul Mundt #include <linux/init.h> 1328b146c8SMagnus Damm #include <linux/irq.h> 14e5723e0eSPaul Mundt #include <linux/serial.h> 1596de1a8fSPaul Mundt #include <linux/serial_sci.h> 16ad89f87aSPaul Mundt #include <asm/rtc.h> 17e5723e0eSPaul Mundt 1828b146c8SMagnus Damm enum { 1928b146c8SMagnus Damm UNUSED = 0, 2028b146c8SMagnus Damm 2128b146c8SMagnus Damm /* interrupt sources */ 2228b146c8SMagnus Damm IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, 23*56d604deSPaul Mundt DMAC1, SCIF0, SCIF1, DMAC2, IPSEC, 2428b146c8SMagnus Damm EDMAC0, EDMAC1, EDMAC2, 25*56d604deSPaul Mundt SIOF0, SIOF1, 2628b146c8SMagnus Damm 27*56d604deSPaul Mundt TMU0, TMU1, TMU2, 28*56d604deSPaul Mundt RTC, WDT, REF, 2928b146c8SMagnus Damm }; 3028b146c8SMagnus Damm 315c37e025SMagnus Damm static struct intc_vect vectors[] __initdata = { 32a276e588SMagnus Damm /* IRQ0->5 are handled in setup-sh3.c */ 33*56d604deSPaul Mundt INTC_VECT(DMAC1, 0x800), INTC_VECT(DMAC1, 0x820), 34*56d604deSPaul Mundt INTC_VECT(DMAC1, 0x840), INTC_VECT(DMAC1, 0x860), 35*56d604deSPaul Mundt INTC_VECT(SCIF0, 0x880), INTC_VECT(SCIF0, 0x8a0), 36*56d604deSPaul Mundt INTC_VECT(SCIF0, 0x8c0), INTC_VECT(SCIF0, 0x8e0), 37*56d604deSPaul Mundt INTC_VECT(SCIF1, 0x900), INTC_VECT(SCIF1, 0x920), 38*56d604deSPaul Mundt INTC_VECT(SCIF1, 0x940), INTC_VECT(SCIF1, 0x960), 39*56d604deSPaul Mundt INTC_VECT(DMAC2, 0xb80), INTC_VECT(DMAC2, 0xba0), 40ac919986SMagnus Damm #ifdef CONFIG_CPU_SUBTYPE_SH7710 4128b146c8SMagnus Damm INTC_VECT(IPSEC, 0xbe0), 42ac919986SMagnus Damm #endif 4328b146c8SMagnus Damm INTC_VECT(EDMAC0, 0xc00), INTC_VECT(EDMAC1, 0xc20), 4428b146c8SMagnus Damm INTC_VECT(EDMAC2, 0xc40), 45*56d604deSPaul Mundt INTC_VECT(SIOF0, 0xe00), INTC_VECT(SIOF0, 0xe20), 46*56d604deSPaul Mundt INTC_VECT(SIOF0, 0xe40), INTC_VECT(SIOF0, 0xe60), 47*56d604deSPaul Mundt INTC_VECT(SIOF1, 0xe80), INTC_VECT(SIOF1, 0xea0), 48*56d604deSPaul Mundt INTC_VECT(SIOF1, 0xec0), INTC_VECT(SIOF1, 0xee0), 4928b146c8SMagnus Damm INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420), 5028b146c8SMagnus Damm INTC_VECT(TMU2, 0x440), 51*56d604deSPaul Mundt INTC_VECT(RTC, 0x480), INTC_VECT(RTC, 0x4a0), 52*56d604deSPaul Mundt INTC_VECT(RTC, 0x4c0), 5328b146c8SMagnus Damm INTC_VECT(WDT, 0x560), 5428b146c8SMagnus Damm INTC_VECT(REF, 0x580), 5528b146c8SMagnus Damm }; 5628b146c8SMagnus Damm 575c37e025SMagnus Damm static struct intc_prio_reg prio_registers[] __initdata = { 586ef5fb2cSMagnus Damm { 0xfffffee2, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } }, 596ef5fb2cSMagnus Damm { 0xfffffee4, 0, 16, 4, /* IPRB */ { WDT, REF, 0, 0 } }, 606ef5fb2cSMagnus Damm { 0xa4000016, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } }, 616ef5fb2cSMagnus Damm { 0xa4000018, 0, 16, 4, /* IPRD */ { 0, 0, IRQ5, IRQ4 } }, 626ef5fb2cSMagnus Damm { 0xa400001a, 0, 16, 4, /* IPRE */ { DMAC1, SCIF0, SCIF1 } }, 63995d538aSMagnus Damm { 0xa4080000, 0, 16, 4, /* IPRF */ { IPSEC, DMAC2 } }, 646ef5fb2cSMagnus Damm { 0xa4080002, 0, 16, 4, /* IPRG */ { EDMAC0, EDMAC1, EDMAC2 } }, 656ef5fb2cSMagnus Damm { 0xa4080004, 0, 16, 4, /* IPRH */ { 0, 0, 0, SIOF0 } }, 666ef5fb2cSMagnus Damm { 0xa4080006, 0, 16, 4, /* IPRI */ { 0, 0, SIOF1 } }, 6728b146c8SMagnus Damm }; 6828b146c8SMagnus Damm 69*56d604deSPaul Mundt static DECLARE_INTC_DESC(intc_desc, "sh7710", vectors, NULL, 707f3edee8SMagnus Damm NULL, prio_registers, NULL); 7128b146c8SMagnus Damm 7228b146c8SMagnus Damm static struct resource rtc_resources[] = { 7328b146c8SMagnus Damm [0] = { 7428b146c8SMagnus Damm .start = 0xa413fec0, 7528b146c8SMagnus Damm .end = 0xa413fec0 + 0x1e, 7628b146c8SMagnus Damm .flags = IORESOURCE_IO, 7728b146c8SMagnus Damm }, 7828b146c8SMagnus Damm [1] = { 7928b146c8SMagnus Damm .start = 20, 8028b146c8SMagnus Damm .flags = IORESOURCE_IRQ, 8128b146c8SMagnus Damm }, 8228b146c8SMagnus Damm }; 8328b146c8SMagnus Damm 84ad89f87aSPaul Mundt static struct sh_rtc_platform_info rtc_info = { 85ad89f87aSPaul Mundt .capabilities = RTC_CAP_4_DIGIT_YEAR, 86ad89f87aSPaul Mundt }; 87ad89f87aSPaul Mundt 8828b146c8SMagnus Damm static struct platform_device rtc_device = { 8928b146c8SMagnus Damm .name = "sh-rtc", 9028b146c8SMagnus Damm .id = -1, 9128b146c8SMagnus Damm .num_resources = ARRAY_SIZE(rtc_resources), 9228b146c8SMagnus Damm .resource = rtc_resources, 93ad89f87aSPaul Mundt .dev = { 94ad89f87aSPaul Mundt .platform_data = &rtc_info, 95ad89f87aSPaul Mundt }, 9628b146c8SMagnus Damm }; 9728b146c8SMagnus Damm 98e5723e0eSPaul Mundt static struct plat_sci_port sci_platform_data[] = { 99e5723e0eSPaul Mundt { 100e5723e0eSPaul Mundt .mapbase = 0xa4400000, 101e5723e0eSPaul Mundt .flags = UPF_BOOT_AUTOCONF, 102e5723e0eSPaul Mundt .type = PORT_SCIF, 103*56d604deSPaul Mundt .irqs = { 52, 52, 52, 52 }, 104e5723e0eSPaul Mundt }, { 10528b146c8SMagnus Damm .mapbase = 0xa4410000, 1069465a54fSNobuhiro Iwamatsu .flags = UPF_BOOT_AUTOCONF, 1079465a54fSNobuhiro Iwamatsu .type = PORT_SCIF, 108*56d604deSPaul Mundt .irqs = { 56, 56, 56, 56 }, 1099465a54fSNobuhiro Iwamatsu }, { 1109465a54fSNobuhiro Iwamatsu 111e5723e0eSPaul Mundt .flags = 0, 112e5723e0eSPaul Mundt } 113e5723e0eSPaul Mundt }; 114e5723e0eSPaul Mundt 115e5723e0eSPaul Mundt static struct platform_device sci_device = { 116e5723e0eSPaul Mundt .name = "sh-sci", 117e5723e0eSPaul Mundt .id = -1, 118e5723e0eSPaul Mundt .dev = { 119e5723e0eSPaul Mundt .platform_data = sci_platform_data, 120e5723e0eSPaul Mundt }, 121e5723e0eSPaul Mundt }; 122e5723e0eSPaul Mundt 123e5723e0eSPaul Mundt static struct platform_device *sh7710_devices[] __initdata = { 124e5723e0eSPaul Mundt &sci_device, 12528b146c8SMagnus Damm &rtc_device, 126e5723e0eSPaul Mundt }; 127e5723e0eSPaul Mundt 128e5723e0eSPaul Mundt static int __init sh7710_devices_setup(void) 129e5723e0eSPaul Mundt { 130e5723e0eSPaul Mundt return platform_add_devices(sh7710_devices, 131e5723e0eSPaul Mundt ARRAY_SIZE(sh7710_devices)); 132e5723e0eSPaul Mundt } 133e5723e0eSPaul Mundt __initcall(sh7710_devices_setup); 1349465a54fSNobuhiro Iwamatsu 13590015c89SMagnus Damm void __init plat_irq_setup(void) 1369465a54fSNobuhiro Iwamatsu { 13728b146c8SMagnus Damm register_intc_controller(&intc_desc); 138a276e588SMagnus Damm plat_irq_setup_sh3(); 1399465a54fSNobuhiro Iwamatsu } 140