Path: blob/master/arch/sh/kernel/cpu/sh3/setup-sh7720.c
17525 views
/*1* Setup code for SH7720, SH7721.2*3* Copyright (C) 2007 Markus Brunner, Mark Jonas4* Copyright (C) 2009 Paul Mundt5*6* Based on arch/sh/kernel/cpu/sh4/setup-sh7750.c:7*8* Copyright (C) 2006 Paul Mundt9* Copyright (C) 2006 Jamie Lenehan10*11* This file is subject to the terms and conditions of the GNU General Public12* License. See the file "COPYING" in the main directory of this archive13* for more details.14*/15#include <linux/platform_device.h>16#include <linux/init.h>17#include <linux/serial.h>18#include <linux/io.h>19#include <linux/serial_sci.h>20#include <linux/sh_timer.h>21#include <asm/rtc.h>2223static struct resource rtc_resources[] = {24[0] = {25.start = 0xa413fec0,26.end = 0xa413fec0 + 0x28 - 1,27.flags = IORESOURCE_IO,28},29[1] = {30/* Shared Period/Carry/Alarm IRQ */31.start = 20,32.flags = IORESOURCE_IRQ,33},34};3536static struct sh_rtc_platform_info rtc_info = {37.capabilities = RTC_CAP_4_DIGIT_YEAR,38};3940static struct platform_device rtc_device = {41.name = "sh-rtc",42.id = -1,43.num_resources = ARRAY_SIZE(rtc_resources),44.resource = rtc_resources,45.dev = {46.platform_data = &rtc_info,47},48};4950static struct plat_sci_port scif0_platform_data = {51.mapbase = 0xa4430000,52.flags = UPF_BOOT_AUTOCONF,53.scscr = SCSCR_RE | SCSCR_TE,54.scbrr_algo_id = SCBRR_ALGO_4,55.type = PORT_SCIF,56.irqs = { 80, 80, 80, 80 },57};5859static struct platform_device scif0_device = {60.name = "sh-sci",61.id = 0,62.dev = {63.platform_data = &scif0_platform_data,64},65};6667static struct plat_sci_port scif1_platform_data = {68.mapbase = 0xa4438000,69.flags = UPF_BOOT_AUTOCONF,70.scscr = SCSCR_RE | SCSCR_TE,71.scbrr_algo_id = SCBRR_ALGO_4,72.type = PORT_SCIF,73.irqs = { 81, 81, 81, 81 },74};7576static struct platform_device scif1_device = {77.name = "sh-sci",78.id = 1,79.dev = {80.platform_data = &scif1_platform_data,81},82};8384static struct resource usb_ohci_resources[] = {85[0] = {86.start = 0xA4428000,87.end = 0xA44280FF,88.flags = IORESOURCE_MEM,89},90[1] = {91.start = 67,92.end = 67,93.flags = IORESOURCE_IRQ,94},95};9697static u64 usb_ohci_dma_mask = 0xffffffffUL;98static struct platform_device usb_ohci_device = {99.name = "sh_ohci",100.id = -1,101.dev = {102.dma_mask = &usb_ohci_dma_mask,103.coherent_dma_mask = 0xffffffff,104},105.num_resources = ARRAY_SIZE(usb_ohci_resources),106.resource = usb_ohci_resources,107};108109static struct resource usbf_resources[] = {110[0] = {111.name = "sh_udc",112.start = 0xA4420000,113.end = 0xA44200FF,114.flags = IORESOURCE_MEM,115},116[1] = {117.name = "sh_udc",118.start = 65,119.end = 65,120.flags = IORESOURCE_IRQ,121},122};123124static struct platform_device usbf_device = {125.name = "sh_udc",126.id = -1,127.dev = {128.dma_mask = NULL,129.coherent_dma_mask = 0xffffffff,130},131.num_resources = ARRAY_SIZE(usbf_resources),132.resource = usbf_resources,133};134135static struct sh_timer_config cmt0_platform_data = {136.channel_offset = 0x10,137.timer_bit = 0,138.clockevent_rating = 125,139.clocksource_rating = 125,140};141142static struct resource cmt0_resources[] = {143[0] = {144.start = 0x044a0010,145.end = 0x044a001b,146.flags = IORESOURCE_MEM,147},148[1] = {149.start = 104,150.flags = IORESOURCE_IRQ,151},152};153154static struct platform_device cmt0_device = {155.name = "sh_cmt",156.id = 0,157.dev = {158.platform_data = &cmt0_platform_data,159},160.resource = cmt0_resources,161.num_resources = ARRAY_SIZE(cmt0_resources),162};163164static struct sh_timer_config cmt1_platform_data = {165.channel_offset = 0x20,166.timer_bit = 1,167};168169static struct resource cmt1_resources[] = {170[0] = {171.start = 0x044a0020,172.end = 0x044a002b,173.flags = IORESOURCE_MEM,174},175[1] = {176.start = 104,177.flags = IORESOURCE_IRQ,178},179};180181static struct platform_device cmt1_device = {182.name = "sh_cmt",183.id = 1,184.dev = {185.platform_data = &cmt1_platform_data,186},187.resource = cmt1_resources,188.num_resources = ARRAY_SIZE(cmt1_resources),189};190191static struct sh_timer_config cmt2_platform_data = {192.channel_offset = 0x30,193.timer_bit = 2,194};195196static struct resource cmt2_resources[] = {197[0] = {198.start = 0x044a0030,199.end = 0x044a003b,200.flags = IORESOURCE_MEM,201},202[1] = {203.start = 104,204.flags = IORESOURCE_IRQ,205},206};207208static struct platform_device cmt2_device = {209.name = "sh_cmt",210.id = 2,211.dev = {212.platform_data = &cmt2_platform_data,213},214.resource = cmt2_resources,215.num_resources = ARRAY_SIZE(cmt2_resources),216};217218static struct sh_timer_config cmt3_platform_data = {219.channel_offset = 0x40,220.timer_bit = 3,221};222223static struct resource cmt3_resources[] = {224[0] = {225.start = 0x044a0040,226.end = 0x044a004b,227.flags = IORESOURCE_MEM,228},229[1] = {230.start = 104,231.flags = IORESOURCE_IRQ,232},233};234235static struct platform_device cmt3_device = {236.name = "sh_cmt",237.id = 3,238.dev = {239.platform_data = &cmt3_platform_data,240},241.resource = cmt3_resources,242.num_resources = ARRAY_SIZE(cmt3_resources),243};244245static struct sh_timer_config cmt4_platform_data = {246.channel_offset = 0x50,247.timer_bit = 4,248};249250static struct resource cmt4_resources[] = {251[0] = {252.start = 0x044a0050,253.end = 0x044a005b,254.flags = IORESOURCE_MEM,255},256[1] = {257.start = 104,258.flags = IORESOURCE_IRQ,259},260};261262static struct platform_device cmt4_device = {263.name = "sh_cmt",264.id = 4,265.dev = {266.platform_data = &cmt4_platform_data,267},268.resource = cmt4_resources,269.num_resources = ARRAY_SIZE(cmt4_resources),270};271272static struct sh_timer_config tmu0_platform_data = {273.channel_offset = 0x02,274.timer_bit = 0,275.clockevent_rating = 200,276};277278static struct resource tmu0_resources[] = {279[0] = {280.start = 0xa412fe94,281.end = 0xa412fe9f,282.flags = IORESOURCE_MEM,283},284[1] = {285.start = 16,286.flags = IORESOURCE_IRQ,287},288};289290static struct platform_device tmu0_device = {291.name = "sh_tmu",292.id = 0,293.dev = {294.platform_data = &tmu0_platform_data,295},296.resource = tmu0_resources,297.num_resources = ARRAY_SIZE(tmu0_resources),298};299300static struct sh_timer_config tmu1_platform_data = {301.channel_offset = 0xe,302.timer_bit = 1,303.clocksource_rating = 200,304};305306static struct resource tmu1_resources[] = {307[0] = {308.start = 0xa412fea0,309.end = 0xa412feab,310.flags = IORESOURCE_MEM,311},312[1] = {313.start = 17,314.flags = IORESOURCE_IRQ,315},316};317318static struct platform_device tmu1_device = {319.name = "sh_tmu",320.id = 1,321.dev = {322.platform_data = &tmu1_platform_data,323},324.resource = tmu1_resources,325.num_resources = ARRAY_SIZE(tmu1_resources),326};327328static struct sh_timer_config tmu2_platform_data = {329.channel_offset = 0x1a,330.timer_bit = 2,331};332333static struct resource tmu2_resources[] = {334[0] = {335.start = 0xa412feac,336.end = 0xa412feb5,337.flags = IORESOURCE_MEM,338},339[1] = {340.start = 18,341.flags = IORESOURCE_IRQ,342},343};344345static struct platform_device tmu2_device = {346.name = "sh_tmu",347.id = 2,348.dev = {349.platform_data = &tmu2_platform_data,350},351.resource = tmu2_resources,352.num_resources = ARRAY_SIZE(tmu2_resources),353};354355static struct platform_device *sh7720_devices[] __initdata = {356&scif0_device,357&scif1_device,358&cmt0_device,359&cmt1_device,360&cmt2_device,361&cmt3_device,362&cmt4_device,363&tmu0_device,364&tmu1_device,365&tmu2_device,366&rtc_device,367&usb_ohci_device,368&usbf_device,369};370371static int __init sh7720_devices_setup(void)372{373return platform_add_devices(sh7720_devices,374ARRAY_SIZE(sh7720_devices));375}376arch_initcall(sh7720_devices_setup);377378static struct platform_device *sh7720_early_devices[] __initdata = {379&scif0_device,380&scif1_device,381&cmt0_device,382&cmt1_device,383&cmt2_device,384&cmt3_device,385&cmt4_device,386&tmu0_device,387&tmu1_device,388&tmu2_device,389};390391void __init plat_early_device_setup(void)392{393early_platform_add_devices(sh7720_early_devices,394ARRAY_SIZE(sh7720_early_devices));395}396397enum {398UNUSED = 0,399400/* interrupt sources */401TMU0, TMU1, TMU2, RTC,402WDT, REF_RCMI, SIM,403IRQ0, IRQ1, IRQ2, IRQ3,404USBF_SPD, TMU_SUNI, IRQ5, IRQ4,405DMAC1, LCDC, SSL,406ADC, DMAC2, USBFI, CMT,407SCIF0, SCIF1,408PINT07, PINT815, TPU, IIC,409SIOF0, SIOF1, MMC, PCC,410USBHI, AFEIF,411H_UDI,412};413414static struct intc_vect vectors[] __initdata = {415/* IRQ0->5 are handled in setup-sh3.c */416INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),417INTC_VECT(TMU2, 0x440), INTC_VECT(RTC, 0x480),418INTC_VECT(RTC, 0x4a0), INTC_VECT(RTC, 0x4c0),419INTC_VECT(SIM, 0x4e0), INTC_VECT(SIM, 0x500),420INTC_VECT(SIM, 0x520), INTC_VECT(SIM, 0x540),421INTC_VECT(WDT, 0x560), INTC_VECT(REF_RCMI, 0x580),422/* H_UDI cannot be masked */ INTC_VECT(TMU_SUNI, 0x6c0),423INTC_VECT(USBF_SPD, 0x6e0), INTC_VECT(DMAC1, 0x800),424INTC_VECT(DMAC1, 0x820), INTC_VECT(DMAC1, 0x840),425INTC_VECT(DMAC1, 0x860), INTC_VECT(LCDC, 0x900),426#if defined(CONFIG_CPU_SUBTYPE_SH7720)427INTC_VECT(SSL, 0x980),428#endif429INTC_VECT(USBFI, 0xa20), INTC_VECT(USBFI, 0xa40),430INTC_VECT(USBHI, 0xa60),431INTC_VECT(DMAC2, 0xb80), INTC_VECT(DMAC2, 0xba0),432INTC_VECT(ADC, 0xbe0), INTC_VECT(SCIF0, 0xc00),433INTC_VECT(SCIF1, 0xc20), INTC_VECT(PINT07, 0xc80),434INTC_VECT(PINT815, 0xca0), INTC_VECT(SIOF0, 0xd00),435INTC_VECT(SIOF1, 0xd20), INTC_VECT(TPU, 0xd80),436INTC_VECT(TPU, 0xda0), INTC_VECT(TPU, 0xdc0),437INTC_VECT(TPU, 0xde0), INTC_VECT(IIC, 0xe00),438INTC_VECT(MMC, 0xe80), INTC_VECT(MMC, 0xea0),439INTC_VECT(MMC, 0xec0), INTC_VECT(MMC, 0xee0),440INTC_VECT(CMT, 0xf00), INTC_VECT(PCC, 0xf60),441INTC_VECT(AFEIF, 0xfe0),442};443444static struct intc_prio_reg prio_registers[] __initdata = {445{ 0xA414FEE2UL, 0, 16, 4, /* IPRA */ { TMU0, TMU1, TMU2, RTC } },446{ 0xA414FEE4UL, 0, 16, 4, /* IPRB */ { WDT, REF_RCMI, SIM, 0 } },447{ 0xA4140016UL, 0, 16, 4, /* IPRC */ { IRQ3, IRQ2, IRQ1, IRQ0 } },448{ 0xA4140018UL, 0, 16, 4, /* IPRD */ { USBF_SPD, TMU_SUNI, IRQ5, IRQ4 } },449{ 0xA414001AUL, 0, 16, 4, /* IPRE */ { DMAC1, 0, LCDC, SSL } },450{ 0xA4080000UL, 0, 16, 4, /* IPRF */ { ADC, DMAC2, USBFI, CMT } },451{ 0xA4080002UL, 0, 16, 4, /* IPRG */ { SCIF0, SCIF1, 0, 0 } },452{ 0xA4080004UL, 0, 16, 4, /* IPRH */ { PINT07, PINT815, TPU, IIC } },453{ 0xA4080006UL, 0, 16, 4, /* IPRI */ { SIOF0, SIOF1, MMC, PCC } },454{ 0xA4080008UL, 0, 16, 4, /* IPRJ */ { 0, USBHI, 0, AFEIF } },455};456457static DECLARE_INTC_DESC(intc_desc, "sh7720", vectors, NULL,458NULL, prio_registers, NULL);459460void __init plat_irq_setup(void)461{462register_intc_controller(&intc_desc);463plat_irq_setup_sh3();464}465466467