Path: blob/master/arch/sh/kernel/cpu/sh4a/setup-sh7770.c
17498 views
/*1* SH7770 Setup2*3* Copyright (C) 2006 - 2008 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>14#include <linux/io.h>1516static struct plat_sci_port scif0_platform_data = {17.mapbase = 0xff923000,18.flags = UPF_BOOT_AUTOCONF,19.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,20.scbrr_algo_id = SCBRR_ALGO_2,21.type = PORT_SCIF,22.irqs = { 61, 61, 61, 61 },23};2425static struct platform_device scif0_device = {26.name = "sh-sci",27.id = 0,28.dev = {29.platform_data = &scif0_platform_data,30},31};3233static struct plat_sci_port scif1_platform_data = {34.mapbase = 0xff924000,35.flags = UPF_BOOT_AUTOCONF,36.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,37.scbrr_algo_id = SCBRR_ALGO_2,38.type = PORT_SCIF,39.irqs = { 62, 62, 62, 62 },40};4142static struct platform_device scif1_device = {43.name = "sh-sci",44.id = 1,45.dev = {46.platform_data = &scif1_platform_data,47},48};4950static struct plat_sci_port scif2_platform_data = {51.mapbase = 0xff925000,52.flags = UPF_BOOT_AUTOCONF,53.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,54.scbrr_algo_id = SCBRR_ALGO_2,55.type = PORT_SCIF,56.irqs = { 63, 63, 63, 63 },57};5859static struct platform_device scif2_device = {60.name = "sh-sci",61.id = 2,62.dev = {63.platform_data = &scif2_platform_data,64},65};6667static struct plat_sci_port scif3_platform_data = {68.mapbase = 0xff926000,69.flags = UPF_BOOT_AUTOCONF,70.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,71.scbrr_algo_id = SCBRR_ALGO_2,72.type = PORT_SCIF,73.irqs = { 64, 64, 64, 64 },74};7576static struct platform_device scif3_device = {77.name = "sh-sci",78.id = 3,79.dev = {80.platform_data = &scif3_platform_data,81},82};8384static struct plat_sci_port scif4_platform_data = {85.mapbase = 0xff927000,86.flags = UPF_BOOT_AUTOCONF,87.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,88.scbrr_algo_id = SCBRR_ALGO_2,89.type = PORT_SCIF,90.irqs = { 65, 65, 65, 65 },91};9293static struct platform_device scif4_device = {94.name = "sh-sci",95.id = 4,96.dev = {97.platform_data = &scif4_platform_data,98},99};100101static struct plat_sci_port scif5_platform_data = {102.mapbase = 0xff928000,103.flags = UPF_BOOT_AUTOCONF,104.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,105.scbrr_algo_id = SCBRR_ALGO_2,106.type = PORT_SCIF,107.irqs = { 66, 66, 66, 66 },108};109110static struct platform_device scif5_device = {111.name = "sh-sci",112.id = 5,113.dev = {114.platform_data = &scif5_platform_data,115},116};117118static struct plat_sci_port scif6_platform_data = {119.mapbase = 0xff929000,120.flags = UPF_BOOT_AUTOCONF,121.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,122.scbrr_algo_id = SCBRR_ALGO_2,123.type = PORT_SCIF,124.irqs = { 67, 67, 67, 67 },125};126127static struct platform_device scif6_device = {128.name = "sh-sci",129.id = 6,130.dev = {131.platform_data = &scif6_platform_data,132},133};134135static struct plat_sci_port scif7_platform_data = {136.mapbase = 0xff92a000,137.flags = UPF_BOOT_AUTOCONF,138.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,139.scbrr_algo_id = SCBRR_ALGO_2,140.type = PORT_SCIF,141.irqs = { 68, 68, 68, 68 },142};143144static struct platform_device scif7_device = {145.name = "sh-sci",146.id = 7,147.dev = {148.platform_data = &scif7_platform_data,149},150};151152static struct plat_sci_port scif8_platform_data = {153.mapbase = 0xff92b000,154.flags = UPF_BOOT_AUTOCONF,155.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,156.scbrr_algo_id = SCBRR_ALGO_2,157.type = PORT_SCIF,158.irqs = { 69, 69, 69, 69 },159};160161static struct platform_device scif8_device = {162.name = "sh-sci",163.id = 8,164.dev = {165.platform_data = &scif8_platform_data,166},167};168169static struct plat_sci_port scif9_platform_data = {170.mapbase = 0xff92c000,171.flags = UPF_BOOT_AUTOCONF,172.scscr = SCSCR_RE | SCSCR_TE | SCSCR_REIE | SCSCR_TOIE,173.scbrr_algo_id = SCBRR_ALGO_2,174.type = PORT_SCIF,175.irqs = { 70, 70, 70, 70 },176};177178static struct platform_device scif9_device = {179.name = "sh-sci",180.id = 9,181.dev = {182.platform_data = &scif9_platform_data,183},184};185186static struct sh_timer_config tmu0_platform_data = {187.channel_offset = 0x04,188.timer_bit = 0,189.clockevent_rating = 200,190};191192static struct resource tmu0_resources[] = {193[0] = {194.start = 0xffd80008,195.end = 0xffd80013,196.flags = IORESOURCE_MEM,197},198[1] = {199.start = 16,200.flags = IORESOURCE_IRQ,201},202};203204static struct platform_device tmu0_device = {205.name = "sh_tmu",206.id = 0,207.dev = {208.platform_data = &tmu0_platform_data,209},210.resource = tmu0_resources,211.num_resources = ARRAY_SIZE(tmu0_resources),212};213214static struct sh_timer_config tmu1_platform_data = {215.channel_offset = 0x10,216.timer_bit = 1,217.clocksource_rating = 200,218};219220static struct resource tmu1_resources[] = {221[0] = {222.start = 0xffd80014,223.end = 0xffd8001f,224.flags = IORESOURCE_MEM,225},226[1] = {227.start = 17,228.flags = IORESOURCE_IRQ,229},230};231232static struct platform_device tmu1_device = {233.name = "sh_tmu",234.id = 1,235.dev = {236.platform_data = &tmu1_platform_data,237},238.resource = tmu1_resources,239.num_resources = ARRAY_SIZE(tmu1_resources),240};241242static struct sh_timer_config tmu2_platform_data = {243.channel_offset = 0x1c,244.timer_bit = 2,245};246247static struct resource tmu2_resources[] = {248[0] = {249.start = 0xffd80020,250.end = 0xffd8002f,251.flags = IORESOURCE_MEM,252},253[1] = {254.start = 18,255.flags = IORESOURCE_IRQ,256},257};258259static struct platform_device tmu2_device = {260.name = "sh_tmu",261.id = 2,262.dev = {263.platform_data = &tmu2_platform_data,264},265.resource = tmu2_resources,266.num_resources = ARRAY_SIZE(tmu2_resources),267};268269static struct sh_timer_config tmu3_platform_data = {270.channel_offset = 0x04,271.timer_bit = 0,272};273274static struct resource tmu3_resources[] = {275[0] = {276.start = 0xffd81008,277.end = 0xffd81013,278.flags = IORESOURCE_MEM,279},280[1] = {281.start = 19,282.flags = IORESOURCE_IRQ,283},284};285286static struct platform_device tmu3_device = {287.name = "sh_tmu",288.id = 3,289.dev = {290.platform_data = &tmu3_platform_data,291},292.resource = tmu3_resources,293.num_resources = ARRAY_SIZE(tmu3_resources),294};295296static struct sh_timer_config tmu4_platform_data = {297.channel_offset = 0x10,298.timer_bit = 1,299};300301static struct resource tmu4_resources[] = {302[0] = {303.start = 0xffd81014,304.end = 0xffd8101f,305.flags = IORESOURCE_MEM,306},307[1] = {308.start = 20,309.flags = IORESOURCE_IRQ,310},311};312313static struct platform_device tmu4_device = {314.name = "sh_tmu",315.id = 4,316.dev = {317.platform_data = &tmu4_platform_data,318},319.resource = tmu4_resources,320.num_resources = ARRAY_SIZE(tmu4_resources),321};322323static struct sh_timer_config tmu5_platform_data = {324.channel_offset = 0x1c,325.timer_bit = 2,326};327328static struct resource tmu5_resources[] = {329[0] = {330.start = 0xffd81020,331.end = 0xffd8102f,332.flags = IORESOURCE_MEM,333},334[1] = {335.start = 21,336.flags = IORESOURCE_IRQ,337},338};339340static struct platform_device tmu5_device = {341.name = "sh_tmu",342.id = 5,343.dev = {344.platform_data = &tmu5_platform_data,345},346.resource = tmu5_resources,347.num_resources = ARRAY_SIZE(tmu5_resources),348};349350static struct sh_timer_config tmu6_platform_data = {351.channel_offset = 0x04,352.timer_bit = 0,353};354355static struct resource tmu6_resources[] = {356[0] = {357.start = 0xffd82008,358.end = 0xffd82013,359.flags = IORESOURCE_MEM,360},361[1] = {362.start = 22,363.flags = IORESOURCE_IRQ,364},365};366367static struct platform_device tmu6_device = {368.name = "sh_tmu",369.id = 6,370.dev = {371.platform_data = &tmu6_platform_data,372},373.resource = tmu6_resources,374.num_resources = ARRAY_SIZE(tmu6_resources),375};376377static struct sh_timer_config tmu7_platform_data = {378.channel_offset = 0x10,379.timer_bit = 1,380};381382static struct resource tmu7_resources[] = {383[0] = {384.start = 0xffd82014,385.end = 0xffd8201f,386.flags = IORESOURCE_MEM,387},388[1] = {389.start = 23,390.flags = IORESOURCE_IRQ,391},392};393394static struct platform_device tmu7_device = {395.name = "sh_tmu",396.id = 7,397.dev = {398.platform_data = &tmu7_platform_data,399},400.resource = tmu7_resources,401.num_resources = ARRAY_SIZE(tmu7_resources),402};403404static struct sh_timer_config tmu8_platform_data = {405.channel_offset = 0x1c,406.timer_bit = 2,407};408409static struct resource tmu8_resources[] = {410[0] = {411.start = 0xffd82020,412.end = 0xffd8202b,413.flags = IORESOURCE_MEM,414},415[1] = {416.start = 24,417.flags = IORESOURCE_IRQ,418},419};420421static struct platform_device tmu8_device = {422.name = "sh_tmu",423.id = 8,424.dev = {425.platform_data = &tmu8_platform_data,426},427.resource = tmu8_resources,428.num_resources = ARRAY_SIZE(tmu8_resources),429};430431static struct platform_device *sh7770_devices[] __initdata = {432&scif0_device,433&scif1_device,434&scif2_device,435&scif3_device,436&scif4_device,437&scif5_device,438&scif6_device,439&scif7_device,440&scif8_device,441&scif9_device,442&tmu0_device,443&tmu1_device,444&tmu2_device,445&tmu3_device,446&tmu4_device,447&tmu5_device,448&tmu6_device,449&tmu7_device,450&tmu8_device,451};452453static int __init sh7770_devices_setup(void)454{455return platform_add_devices(sh7770_devices,456ARRAY_SIZE(sh7770_devices));457}458arch_initcall(sh7770_devices_setup);459460static struct platform_device *sh7770_early_devices[] __initdata = {461&scif0_device,462&scif1_device,463&scif2_device,464&scif3_device,465&scif4_device,466&scif5_device,467&scif6_device,468&scif7_device,469&scif8_device,470&scif9_device,471&tmu0_device,472&tmu1_device,473&tmu2_device,474&tmu3_device,475&tmu4_device,476&tmu5_device,477&tmu6_device,478&tmu7_device,479&tmu8_device,480};481482void __init plat_early_device_setup(void)483{484early_platform_add_devices(sh7770_early_devices,485ARRAY_SIZE(sh7770_early_devices));486}487488enum {489UNUSED = 0,490491/* interrupt sources */492IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,493IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,494IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,495IRL_HHLL, IRL_HHLH, IRL_HHHL,496497IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5,498499GPIO,500TMU0, TMU1, TMU2, TMU2_TICPI,501TMU3, TMU4, TMU5, TMU5_TICPI,502TMU6, TMU7, TMU8,503HAC, IPI, SPDIF, HUDI, I2C,504DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2,505I2S0, I2S1, I2S2, I2S3,506SRC_RX, SRC_TX, SRC_SPDIF,507DU, VIDEO_IN, REMOTE, YUV, USB, ATAPI, CAN, GPS, GFX2D,508GFX3D_MBX, GFX3D_DMAC,509EXBUS_ATA,510SPI0, SPI1,511SCIF089, SCIF1234, SCIF567,512ADC,513BBDMAC_0_3, BBDMAC_4_7, BBDMAC_8_10, BBDMAC_11_14,514BBDMAC_15_18, BBDMAC_19_22, BBDMAC_23_26, BBDMAC_27,515BBDMAC_28, BBDMAC_29, BBDMAC_30, BBDMAC_31,516517/* interrupt groups */518TMU, DMAC, I2S, SRC, GFX3D, SPI, SCIF, BBDMAC,519};520521static struct intc_vect vectors[] __initdata = {522INTC_VECT(GPIO, 0x3e0),523INTC_VECT(TMU0, 0x400), INTC_VECT(TMU1, 0x420),524INTC_VECT(TMU2, 0x440), INTC_VECT(TMU2_TICPI, 0x460),525INTC_VECT(TMU3, 0x480), INTC_VECT(TMU4, 0x4a0),526INTC_VECT(TMU5, 0x4c0), INTC_VECT(TMU5_TICPI, 0x4e0),527INTC_VECT(TMU6, 0x500), INTC_VECT(TMU7, 0x520),528INTC_VECT(TMU8, 0x540),529INTC_VECT(HAC, 0x580), INTC_VECT(IPI, 0x5c0),530INTC_VECT(SPDIF, 0x5e0),531INTC_VECT(HUDI, 0x600), INTC_VECT(I2C, 0x620),532INTC_VECT(DMAC0_DMINT0, 0x640), INTC_VECT(DMAC0_DMINT1, 0x660),533INTC_VECT(DMAC0_DMINT2, 0x680),534INTC_VECT(I2S0, 0x6a0), INTC_VECT(I2S1, 0x6c0),535INTC_VECT(I2S2, 0x6e0), INTC_VECT(I2S3, 0x700),536INTC_VECT(SRC_RX, 0x720), INTC_VECT(SRC_TX, 0x740),537INTC_VECT(SRC_SPDIF, 0x760),538INTC_VECT(DU, 0x780), INTC_VECT(VIDEO_IN, 0x7a0),539INTC_VECT(REMOTE, 0x7c0), INTC_VECT(YUV, 0x7e0),540INTC_VECT(USB, 0x840), INTC_VECT(ATAPI, 0x860),541INTC_VECT(CAN, 0x880), INTC_VECT(GPS, 0x8a0),542INTC_VECT(GFX2D, 0x8c0),543INTC_VECT(GFX3D_MBX, 0x900), INTC_VECT(GFX3D_DMAC, 0x920),544INTC_VECT(EXBUS_ATA, 0x940),545INTC_VECT(SPI0, 0x960), INTC_VECT(SPI1, 0x980),546INTC_VECT(SCIF089, 0x9a0), INTC_VECT(SCIF1234, 0x9c0),547INTC_VECT(SCIF1234, 0x9e0), INTC_VECT(SCIF1234, 0xa00),548INTC_VECT(SCIF1234, 0xa20), INTC_VECT(SCIF567, 0xa40),549INTC_VECT(SCIF567, 0xa60), INTC_VECT(SCIF567, 0xa80),550INTC_VECT(SCIF089, 0xaa0), INTC_VECT(SCIF089, 0xac0),551INTC_VECT(ADC, 0xb20),552INTC_VECT(BBDMAC_0_3, 0xba0), INTC_VECT(BBDMAC_0_3, 0xbc0),553INTC_VECT(BBDMAC_0_3, 0xbe0), INTC_VECT(BBDMAC_0_3, 0xc00),554INTC_VECT(BBDMAC_4_7, 0xc20), INTC_VECT(BBDMAC_4_7, 0xc40),555INTC_VECT(BBDMAC_4_7, 0xc60), INTC_VECT(BBDMAC_4_7, 0xc80),556INTC_VECT(BBDMAC_8_10, 0xca0), INTC_VECT(BBDMAC_8_10, 0xcc0),557INTC_VECT(BBDMAC_8_10, 0xce0), INTC_VECT(BBDMAC_11_14, 0xd00),558INTC_VECT(BBDMAC_11_14, 0xd20), INTC_VECT(BBDMAC_11_14, 0xd40),559INTC_VECT(BBDMAC_11_14, 0xd60), INTC_VECT(BBDMAC_15_18, 0xd80),560INTC_VECT(BBDMAC_15_18, 0xda0), INTC_VECT(BBDMAC_15_18, 0xdc0),561INTC_VECT(BBDMAC_15_18, 0xde0), INTC_VECT(BBDMAC_19_22, 0xe00),562INTC_VECT(BBDMAC_19_22, 0xe20), INTC_VECT(BBDMAC_19_22, 0xe40),563INTC_VECT(BBDMAC_19_22, 0xe60), INTC_VECT(BBDMAC_23_26, 0xe80),564INTC_VECT(BBDMAC_23_26, 0xea0), INTC_VECT(BBDMAC_23_26, 0xec0),565INTC_VECT(BBDMAC_23_26, 0xee0), INTC_VECT(BBDMAC_27, 0xf00),566INTC_VECT(BBDMAC_28, 0xf20), INTC_VECT(BBDMAC_29, 0xf40),567INTC_VECT(BBDMAC_30, 0xf60), INTC_VECT(BBDMAC_31, 0xf80),568};569570static struct intc_group groups[] __initdata = {571INTC_GROUP(TMU, TMU0, TMU1, TMU2, TMU2_TICPI, TMU3, TMU4, TMU5,572TMU5_TICPI, TMU6, TMU7, TMU8),573INTC_GROUP(DMAC, DMAC0_DMINT0, DMAC0_DMINT1, DMAC0_DMINT2),574INTC_GROUP(I2S, I2S0, I2S1, I2S2, I2S3),575INTC_GROUP(SRC, SRC_RX, SRC_TX, SRC_SPDIF),576INTC_GROUP(GFX3D, GFX3D_MBX, GFX3D_DMAC),577INTC_GROUP(SPI, SPI0, SPI1),578INTC_GROUP(SCIF, SCIF089, SCIF1234, SCIF567),579INTC_GROUP(BBDMAC,580BBDMAC_0_3, BBDMAC_4_7, BBDMAC_8_10, BBDMAC_11_14,581BBDMAC_15_18, BBDMAC_19_22, BBDMAC_23_26, BBDMAC_27,582BBDMAC_28, BBDMAC_29, BBDMAC_30, BBDMAC_31),583};584585static struct intc_mask_reg mask_registers[] __initdata = {586{ 0xffe00040, 0xffe00044, 32, /* INT2MSKR / INT2MSKCR */587{ 0, BBDMAC, ADC, SCIF, SPI, EXBUS_ATA, GFX3D, GFX2D,588GPS, CAN, ATAPI, USB, YUV, REMOTE, VIDEO_IN, DU, SRC, I2S,589DMAC, I2C, HUDI, SPDIF, IPI, HAC, TMU, GPIO } },590};591592static struct intc_prio_reg prio_registers[] __initdata = {593{ 0xffe00000, 0, 32, 8, /* INT2PRI0 */ { GPIO, TMU0, 0, HAC } },594{ 0xffe00004, 0, 32, 8, /* INT2PRI1 */ { IPI, SPDIF, HUDI, I2C } },595{ 0xffe00008, 0, 32, 8, /* INT2PRI2 */ { DMAC, I2S, SRC, DU } },596{ 0xffe0000c, 0, 32, 8, /* INT2PRI3 */ { VIDEO_IN, REMOTE, YUV, USB } },597{ 0xffe00010, 0, 32, 8, /* INT2PRI4 */ { ATAPI, CAN, GPS, GFX2D } },598{ 0xffe00014, 0, 32, 8, /* INT2PRI5 */ { 0, GFX3D, EXBUS_ATA, SPI } },599{ 0xffe00018, 0, 32, 8, /* INT2PRI6 */ { SCIF1234, SCIF567, SCIF089 } },600{ 0xffe0001c, 0, 32, 8, /* INT2PRI7 */ { ADC, 0, 0, BBDMAC_0_3 } },601{ 0xffe00020, 0, 32, 8, /* INT2PRI8 */602{ BBDMAC_4_7, BBDMAC_8_10, BBDMAC_11_14, BBDMAC_15_18 } },603{ 0xffe00024, 0, 32, 8, /* INT2PRI9 */604{ BBDMAC_19_22, BBDMAC_23_26, BBDMAC_27, BBDMAC_28 } },605{ 0xffe00028, 0, 32, 8, /* INT2PRI10 */606{ BBDMAC_29, BBDMAC_30, BBDMAC_31 } },607{ 0xffe0002c, 0, 32, 8, /* INT2PRI11 */608{ TMU1, TMU2, TMU2_TICPI, TMU3 } },609{ 0xffe00030, 0, 32, 8, /* INT2PRI12 */610{ TMU4, TMU5, TMU5_TICPI, TMU6 } },611{ 0xffe00034, 0, 32, 8, /* INT2PRI13 */612{ TMU7, TMU8 } },613};614615static DECLARE_INTC_DESC(intc_desc, "sh7770", vectors, groups,616mask_registers, prio_registers, NULL);617618/* Support for external interrupt pins in IRQ mode */619static struct intc_vect irq_vectors[] __initdata = {620INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),621INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),622INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),623};624625static struct intc_mask_reg irq_mask_registers[] __initdata = {626{ 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */627{ IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, } },628};629630static struct intc_prio_reg irq_prio_registers[] __initdata = {631{ 0xffd00010, 0, 32, 4, /* INTPRI */ { IRQ0, IRQ1, IRQ2, IRQ3,632IRQ4, IRQ5, } },633};634635static struct intc_sense_reg irq_sense_registers[] __initdata = {636{ 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,637IRQ4, IRQ5, } },638};639640static DECLARE_INTC_DESC(intc_irq_desc, "sh7770-irq", irq_vectors,641NULL, irq_mask_registers, irq_prio_registers,642irq_sense_registers);643644/* External interrupt pins in IRL mode */645static struct intc_vect irl_vectors[] __initdata = {646INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220),647INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260),648INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0),649INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0),650INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320),651INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360),652INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0),653INTC_VECT(IRL_HHHL, 0x3c0),654};655656static struct intc_mask_reg irl3210_mask_registers[] __initdata = {657{ 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */658{ IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,659IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,660IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,661IRL_HHLL, IRL_HHLH, IRL_HHHL, } },662};663664static struct intc_mask_reg irl7654_mask_registers[] __initdata = {665{ 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */666{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,667IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,668IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,669IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,670IRL_HHLL, IRL_HHLH, IRL_HHHL, } },671};672673static DECLARE_INTC_DESC(intc_irl7654_desc, "sh7780-irl7654", irl_vectors,674NULL, irl7654_mask_registers, NULL, NULL);675676static DECLARE_INTC_DESC(intc_irl3210_desc, "sh7780-irl3210", irl_vectors,677NULL, irl3210_mask_registers, NULL, NULL);678679#define INTC_ICR0 0xffd00000680#define INTC_INTMSK0 0xffd00044681#define INTC_INTMSK1 0xffd00048682#define INTC_INTMSK2 0xffd40080683#define INTC_INTMSKCLR1 0xffd00068684#define INTC_INTMSKCLR2 0xffd40084685686void __init plat_irq_setup(void)687{688/* disable IRQ7-0 */689__raw_writel(0xff000000, INTC_INTMSK0);690691/* disable IRL3-0 + IRL7-4 */692__raw_writel(0xc0000000, INTC_INTMSK1);693__raw_writel(0xfffefffe, INTC_INTMSK2);694695/* select IRL mode for IRL3-0 + IRL7-4 */696__raw_writel(__raw_readl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);697698/* disable holding function, ie enable "SH-4 Mode" */699__raw_writel(__raw_readl(INTC_ICR0) | 0x00200000, INTC_ICR0);700701register_intc_controller(&intc_desc);702}703704void __init plat_irq_setup_pins(int mode)705{706switch (mode) {707case IRQ_MODE_IRQ:708/* select IRQ mode for IRL3-0 + IRL7-4 */709__raw_writel(__raw_readl(INTC_ICR0) | 0x00c00000, INTC_ICR0);710register_intc_controller(&intc_irq_desc);711break;712case IRQ_MODE_IRL7654:713/* enable IRL7-4 but don't provide any masking */714__raw_writel(0x40000000, INTC_INTMSKCLR1);715__raw_writel(0x0000fffe, INTC_INTMSKCLR2);716break;717case IRQ_MODE_IRL3210:718/* enable IRL0-3 but don't provide any masking */719__raw_writel(0x80000000, INTC_INTMSKCLR1);720__raw_writel(0xfffe0000, INTC_INTMSKCLR2);721break;722case IRQ_MODE_IRL7654_MASK:723/* enable IRL7-4 and mask using cpu intc controller */724__raw_writel(0x40000000, INTC_INTMSKCLR1);725register_intc_controller(&intc_irl7654_desc);726break;727case IRQ_MODE_IRL3210_MASK:728/* enable IRL0-3 and mask using cpu intc controller */729__raw_writel(0x80000000, INTC_INTMSKCLR1);730register_intc_controller(&intc_irl3210_desc);731break;732default:733BUG();734}735}736737738