blob: 558b248627768d9fbd9bb68fa026853184c14edc [file] [log] [blame]
Paul Mundt32351a22007-03-12 14:38:59 +09001/*
Magnus Damm897cfcd2007-09-10 12:06:03 +09002 * Renesas Solutions Highlander R7785RP Support.
Paul Mundt32351a22007-03-12 14:38:59 +09003 *
4 * Copyright (C) 2002 Atom Create Engineering Co., Ltd.
Paul Mundt03bbc0e2008-01-15 16:55:55 +09005 * Copyright (C) 2006 - 2008 Paul Mundt
Magnus Damm897cfcd2007-09-10 12:06:03 +09006 * Copyright (C) 2007 Magnus Damm
Paul Mundt32351a22007-03-12 14:38:59 +09007 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
Magnus Damm897cfcd2007-09-10 12:06:03 +090013#include <linux/irq.h>
14#include <linux/io.h>
Paul Mundt7639a452008-10-20 13:02:48 +090015#include <mach/highlander.h>
Paul Mundt32351a22007-03-12 14:38:59 +090016
Magnus Damm897cfcd2007-09-10 12:06:03 +090017enum {
18 UNUSED = 0,
19
Paul Mundt03bbc0e2008-01-15 16:55:55 +090020 /* FPGA specific interrupt sources */
21 CF, /* Compact Flash */
22 SMBUS, /* SMBUS */
23 TP, /* Touch panel */
24 RTC, /* RTC Alarm */
25 TH_ALERT, /* Temperature sensor */
26 AX88796, /* Ethernet controller */
27
28 /* external bus connector */
29 EXT0, EXT1, EXT2, EXT3, EXT4, EXT5, EXT6, EXT7,
Magnus Damm897cfcd2007-09-10 12:06:03 +090030};
31
32static struct intc_vect vectors[] __initdata = {
33 INTC_IRQ(CF, IRQ_CF),
Paul Mundt03bbc0e2008-01-15 16:55:55 +090034 INTC_IRQ(SMBUS, IRQ_SMBUS),
35 INTC_IRQ(TP, IRQ_TP),
36 INTC_IRQ(RTC, IRQ_RTC),
37 INTC_IRQ(TH_ALERT, IRQ_TH_ALERT),
38
39 INTC_IRQ(EXT0, IRQ_EXT0), INTC_IRQ(EXT1, IRQ_EXT1),
40 INTC_IRQ(EXT2, IRQ_EXT2), INTC_IRQ(EXT3, IRQ_EXT3),
41
42 INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5),
43 INTC_IRQ(EXT6, IRQ_EXT6), INTC_IRQ(EXT7, IRQ_EXT7),
44
Magnus Damm897cfcd2007-09-10 12:06:03 +090045 INTC_IRQ(AX88796, IRQ_AX88796),
46};
47
48static struct intc_mask_reg mask_registers[] __initdata = {
49 { 0xa4000010, 0, 16, /* IRLMCR1 */
Paul Mundt03bbc0e2008-01-15 16:55:55 +090050 { 0, 0, 0, 0, CF, AX88796, SMBUS, TP,
51 RTC, 0, TH_ALERT, 0, 0, 0, 0, 0 } },
52 { 0xa4000012, 0, 16, /* IRLMCR2 */
53 { 0, 0, 0, 0, 0, 0, 0, 0,
54 EXT7, EXT6, EXT5, EXT4, EXT3, EXT2, EXT1, EXT0 } },
Magnus Damm897cfcd2007-09-10 12:06:03 +090055};
56
57static unsigned char irl2irq[HL_NR_IRL] __initdata = {
Paul Mundt03bbc0e2008-01-15 16:55:55 +090058 0, IRQ_CF, IRQ_EXT4, IRQ_EXT5,
59 IRQ_EXT6, IRQ_EXT7, IRQ_SMBUS, IRQ_TP,
60 IRQ_RTC, IRQ_TH_ALERT, IRQ_AX88796, IRQ_EXT0,
61 IRQ_EXT1, IRQ_EXT2, IRQ_EXT3,
Magnus Damm897cfcd2007-09-10 12:06:03 +090062};
63
64static DECLARE_INTC_DESC(intc_desc, "r7785rp", vectors,
Paul Mundt427c7272008-01-15 16:58:19 +090065 NULL, mask_registers, NULL, NULL);
Magnus Damm897cfcd2007-09-10 12:06:03 +090066
Paul Mundtae8a5342008-04-25 17:58:21 +090067unsigned char * __init highlander_plat_irq_setup(void)
Paul Mundt32351a22007-03-12 14:38:59 +090068{
Paul Mundt9d56dd32010-01-26 12:58:40 +090069 if ((__raw_readw(0xa4000158) & 0xf000) != 0x1000)
Magnus Damm897cfcd2007-09-10 12:06:03 +090070 return NULL;
71
72 printk(KERN_INFO "Using r7785rp interrupt controller.\n");
73
Paul Mundt9d56dd32010-01-26 12:58:40 +090074 __raw_writew(0x0000, PA_IRLSSR1); /* FPGA IRLSSR1(CF_CD clear) */
Paul Mundt32351a22007-03-12 14:38:59 +090075
76 /* Setup the FPGA IRL */
Paul Mundt9d56dd32010-01-26 12:58:40 +090077 __raw_writew(0x0000, PA_IRLPRA); /* FPGA IRLA */
78 __raw_writew(0xe598, PA_IRLPRB); /* FPGA IRLB */
79 __raw_writew(0x7060, PA_IRLPRC); /* FPGA IRLC */
80 __raw_writew(0x0000, PA_IRLPRD); /* FPGA IRLD */
81 __raw_writew(0x4321, PA_IRLPRE); /* FPGA IRLE */
82 __raw_writew(0xdcba, PA_IRLPRF); /* FPGA IRLF */
Paul Mundt32351a22007-03-12 14:38:59 +090083
Magnus Damm897cfcd2007-09-10 12:06:03 +090084 register_intc_controller(&intc_desc);
85 return irl2irq;
Paul Mundt32351a22007-03-12 14:38:59 +090086}