aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/Kconfig24
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/irq.c173
-rw-r--r--arch/sh/boards/renesas/rts7751r2d/setup.c8
-rw-r--r--arch/sh/drivers/pci/ops-rts7751r2d.c8
4 files changed, 151 insertions, 62 deletions
diff --git a/arch/sh/boards/renesas/rts7751r2d/Kconfig b/arch/sh/boards/renesas/rts7751r2d/Kconfig
index 7780d1fb13ff..925a7aa861a7 100644
--- a/arch/sh/boards/renesas/rts7751r2d/Kconfig
+++ b/arch/sh/boards/renesas/rts7751r2d/Kconfig
@@ -2,10 +2,28 @@ if SH_RTS7751R2D
2 2
3menu "RTS7751R2D options" 3menu "RTS7751R2D options"
4 4
5config RTS7751R2D_REV11 5choice
6 bool "RTS7751R2D Rev. 1.1 board support" 6 prompt "R2D Board Revision"
7 default RTS7751R2D_PLUS
8
9config RTS7751R2D_PLUS
10 bool "R2D-PLUS"
11 help
12 Selecting this option will configure the kernel for R2D-PLUS.
13
14 R2D-PLUS is the smaller of the two R2D board versions, equipped
15 with a single PCI slot.
16
17config RTS7751R2D_1
18 bool "R2D-1"
7 help 19 help
8 Selecting this option will support version rev. 1.1. 20 Selecting this option will configure the kernel for R2D-1.
21
22 R2D-1 is the larger of the two R2D board versions, equipped
23 with two PCI slots.
24
25endchoice
26
9endmenu 27endmenu
10 28
11endif 29endif
diff --git a/arch/sh/boards/renesas/rts7751r2d/irq.c b/arch/sh/boards/renesas/rts7751r2d/irq.c
index b97c25de3a41..e89932903caf 100644
--- a/arch/sh/boards/renesas/rts7751r2d/irq.c
+++ b/arch/sh/boards/renesas/rts7751r2d/irq.c
@@ -1,9 +1,10 @@
1/* 1/*
2 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c 2 * linux/arch/sh/boards/renesas/rts7751r2d/irq.c
3 * 3 *
4 * Copyright (C) 2007 Magnus Damm
4 * Copyright (C) 2000 Kazumoto Kojima 5 * Copyright (C) 2000 Kazumoto Kojima
5 * 6 *
6 * Renesas Technology Sales RTS7751R2D Support. 7 * Renesas Technology Sales RTS7751R2D Support, R2D-PLUS and R2D-1.
7 * 8 *
8 * Modified for RTS7751R2D by 9 * Modified for RTS7751R2D by
9 * Atom Create Engineering Co., Ltd. 2002. 10 * Atom Create Engineering Co., Ltd. 2002.
@@ -16,67 +17,141 @@
16#include <asm/voyagergx.h> 17#include <asm/voyagergx.h>
17#include <asm/rts7751r2d.h> 18#include <asm/rts7751r2d.h>
18 19
19#if defined(CONFIG_RTS7751R2D_REV11) 20#define R2D_NR_IRL 13
20static int mask_pos[] = {11, 9, 8, 12, 10, 6, 5, 4, 7, 14, 13, 0, 0, 0, 0};
21#else
22static int mask_pos[] = {6, 11, 9, 8, 12, 10, 5, 4, 7, 14, 13, 0, 0, 0, 0};
23#endif
24 21
25static void enable_rts7751r2d_irq(unsigned int irq) 22enum {
26{ 23 UNUSED = 0,
27 /* Set priority in IPR back to original value */
28 ctrl_outw(ctrl_inw(IRLCNTR1) | (1 << mask_pos[irq]), IRLCNTR1);
29}
30 24
31static void disable_rts7751r2d_irq(unsigned int irq) 25 /* board specific interrupt sources (R2D-1 and R2D-PLUS) */
32{ 26 EXT, /* EXT_INT0-3 */
33 /* Set the priority in IPR to 0 */ 27 RTC_T, RTC_A, /* Real Time Clock */
34 ctrl_outw(ctrl_inw(IRLCNTR1) & (0xffff ^ (1 << mask_pos[irq])), 28 AX88796, /* Ethernet controller (R2D-1 board) */
35 IRLCNTR1); 29 KEY, /* Key input (R2D-PLUS board) */
36} 30 SDCARD, /* SD Card */
31 CF_CD, CF_IDE, /* CF Card Detect + CF IDE */
32 SM501, /* SM501 aka Voyager */
33 PCI_INTD_RTL8139, /* Ethernet controller */
34 PCI_INTC_PCI1520, /* Cardbus/PCMCIA bridge */
35 PCI_INTB_RTL8139, /* Ethernet controller with HUB (R2D-PLUS board) */
36 PCI_INTB_SLOT, /* PCI Slot 3.3v (R2D-1 board) */
37 PCI_INTA_SLOT, /* PCI Slot 3.3v */
38 TP, /* Touch Panel */
39};
40
41#ifdef CONFIG_RTS7751R2D_1
42
43/* Vectors for R2D-1 */
44static struct intc_vect vectors_r2d_1[] __initdata = {
45 INTC_IRQ(EXT, IRQ_EXT),
46 INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
47 INTC_IRQ(AX88796, IRQ_AX88796), INTC_IRQ(SDCARD, IRQ_SDCARD),
48 INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE), /* ng */
49 INTC_IRQ(SM501, IRQ_VOYAGER),
50 INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
51 INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
52 INTC_IRQ(PCI_INTB_SLOT, IRQ_PCI_INTB),
53 INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
54 INTC_IRQ(TP, IRQ_TP),
55};
56
57/* IRLMSK mask register layout for R2D-1 */
58static struct intc_mask_reg mask_registers_r2d_1[] __initdata = {
59 { 0xa4000000, 0, 16, /* IRLMSK */
60 { TP, PCI_INTA_SLOT, PCI_INTB_SLOT,
61 PCI_INTC_PCI1520, PCI_INTD_RTL8139,
62 SM501, CF_IDE, CF_CD, SDCARD, AX88796,
63 RTC_A, RTC_T, 0, 0, 0, EXT } },
64};
65
66/* IRLn to IRQ table for R2D-1 */
67static unsigned char irl2irq_r2d_1[R2D_NR_IRL] __initdata = {
68 IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
69 IRQ_VOYAGER, IRQ_AX88796, IRQ_RTC_A, IRQ_RTC_T,
70 IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
71 IRQ_TP,
72};
73
74static __initdata DECLARE_INTC_DESC(intc_desc_r2d_1, "r2d-1",
75 vectors_r2d_1, NULL, NULL,
76 mask_registers_r2d_1, NULL, NULL);
77
78#endif /* CONFIG_RTS7751R2D_1 */
79
80#ifdef CONFIG_RTS7751R2D_PLUS
81
82/* Vectors for R2D-PLUS */
83static struct intc_vect vectors_r2d_plus[] __initdata = {
84 INTC_IRQ(EXT, IRQ_EXT),
85 INTC_IRQ(RTC_T, IRQ_RTC_T), INTC_IRQ(RTC_A, IRQ_RTC_A),
86 INTC_IRQ(KEY, IRQ_KEY), INTC_IRQ(SDCARD, IRQ_SDCARD),
87 INTC_IRQ(CF_CD, IRQ_CF_CD), INTC_IRQ(CF_IDE, IRQ_CF_IDE),
88 INTC_IRQ(SM501, IRQ_VOYAGER),
89 INTC_IRQ(PCI_INTD_RTL8139, IRQ_PCI_INTD),
90 INTC_IRQ(PCI_INTC_PCI1520, IRQ_PCI_INTC),
91 INTC_IRQ(PCI_INTB_RTL8139, IRQ_PCI_INTB),
92 INTC_IRQ(PCI_INTA_SLOT, IRQ_PCI_INTA),
93 INTC_IRQ(TP, IRQ_TP),
94};
95
96/* IRLMSK mask register layout for R2D-PLUS */
97static struct intc_mask_reg mask_registers_r2d_plus[] __initdata = {
98 { 0xa4000000, 0, 16, /* IRLMSK */
99 { TP, PCI_INTA_SLOT, PCI_INTB_RTL8139,
100 PCI_INTC_PCI1520, PCI_INTD_RTL8139,
101 SM501, CF_IDE, CF_CD, SDCARD, KEY,
102 RTC_A, RTC_T, 0, 0, 0, EXT } },
103};
104
105/* IRLn to IRQ table for R2D-PLUS */
106static unsigned char irl2irq_r2d_plus[R2D_NR_IRL] __initdata = {
107 IRQ_PCI_INTD, IRQ_CF_IDE, IRQ_CF_CD, IRQ_PCI_INTC,
108 IRQ_VOYAGER, IRQ_KEY, IRQ_RTC_A, IRQ_RTC_T,
109 IRQ_SDCARD, IRQ_PCI_INTA, IRQ_PCI_INTB, IRQ_EXT,
110 IRQ_TP,
111};
112
113static __initdata DECLARE_INTC_DESC(intc_desc_r2d_plus, "r2d-plus",
114 vectors_r2d_plus, NULL, NULL,
115 mask_registers_r2d_plus, NULL, NULL);
116
117#endif /* CONFIG_RTS7751R2D_PLUS */
118
119static unsigned char irl2irq[R2D_NR_IRL];
37 120
38int rts7751r2d_irq_demux(int irq) 121int rts7751r2d_irq_demux(int irq)
39{ 122{
40 return irq; 123 if (irq >= R2D_NR_IRL || !irl2irq[irq])
41} 124 return irq;
42 125
43static struct irq_chip rts7751r2d_irq_chip __read_mostly = { 126 return irl2irq[irq];
44 .name = "rts7751r2d", 127}
45 .mask = disable_rts7751r2d_irq,
46 .unmask = enable_rts7751r2d_irq,
47 .mask_ack = disable_rts7751r2d_irq,
48};
49 128
50/* 129/*
51 * Initialize IRQ setting 130 * Initialize IRQ setting
52 */ 131 */
53void __init init_rts7751r2d_IRQ(void) 132void __init init_rts7751r2d_IRQ(void)
54{ 133{
55 int i; 134 struct intc_desc *d;
56 135
57 /* IRL0=KEY Input 136 switch (ctrl_inw(PA_BVERREG)) {
58 * IRL1=Ethernet 137#ifdef CONFIG_RTS7751R2D_PLUS
59 * IRL2=CF Card 138 case 0x10:
60 * IRL3=CF Card Insert 139 printk(KERN_INFO "Using R2D-PLUS interrupt controller.\n");
61 * IRL4=PCMCIA 140 d = &intc_desc_r2d_plus;
62 * IRL5=VOYAGER 141 memcpy(irl2irq, irl2irq_r2d_plus, R2D_NR_IRL);
63 * IRL6=RTC Alarm 142 break;
64 * IRL7=RTC Timer 143#endif
65 * IRL8=SD Card 144#ifdef CONFIG_RTS7751R2D_1
66 * IRL9=PCI Slot #1 145 case 0x11:
67 * IRL10=PCI Slot #2 146 printk(KERN_INFO "Using R2D-1 interrupt controller.\n");
68 * IRL11=Extention #0 147 d = &intc_desc_r2d_1;
69 * IRL12=Extention #1 148 memcpy(irl2irq, irl2irq_r2d_1, R2D_NR_IRL);
70 * IRL13=Extention #2 149 break;
71 * IRL14=Extention #3 150#endif
72 */ 151 default:
73 152 return;
74 for (i=0; i<15; i++) {
75 disable_irq_nosync(i);
76 set_irq_chip_and_handler_name(i, &rts7751r2d_irq_chip,
77 handle_level_irq, "level");
78 enable_rts7751r2d_irq(i);
79 } 153 }
80 154
155 register_intc_controller(d);
81 setup_voyagergx_irq(); 156 setup_voyagergx_irq();
82} 157}
diff --git a/arch/sh/boards/renesas/rts7751r2d/setup.c b/arch/sh/boards/renesas/rts7751r2d/setup.c
index 4d1bbd30e52b..90703d5d1230 100644
--- a/arch/sh/boards/renesas/rts7751r2d/setup.c
+++ b/arch/sh/boards/renesas/rts7751r2d/setup.c
@@ -54,11 +54,7 @@ static struct resource cf_ide_resources[] = {
54 .flags = IORESOURCE_MEM, 54 .flags = IORESOURCE_MEM,
55 }, 55 },
56 [2] = { 56 [2] = {
57#ifdef CONFIG_RTS7751R2D_REV11 57 .start = IRQ_CF_IDE,
58 .start = 1,
59#else
60 .start = 2,
61#endif
62 .flags = IORESOURCE_IRQ, 58 .flags = IORESOURCE_IRQ,
63 }, 59 },
64}; 60};
@@ -147,7 +143,7 @@ static int __init rts7751r2d_devices_setup(void)
147{ 143{
148 int ret; 144 int ret;
149 145
150 if (ctrl_inw(PA_BVERREG) == 0x10) { /* only working on R2D-PLUS */ 146 if (ctrl_inw(PA_BVERREG) == 0x10) { /* R2D-PLUS */
151 ret = platform_device_register(&cf_ide_device); 147 ret = platform_device_register(&cf_ide_device);
152 if (ret) 148 if (ret)
153 return ret; 149 return ret;
diff --git a/arch/sh/drivers/pci/ops-rts7751r2d.c b/arch/sh/drivers/pci/ops-rts7751r2d.c
index 4a518d948049..ec8430c8d2d1 100644
--- a/arch/sh/drivers/pci/ops-rts7751r2d.c
+++ b/arch/sh/drivers/pci/ops-rts7751r2d.c
@@ -19,10 +19,10 @@
19#include "pci-sh4.h" 19#include "pci-sh4.h"
20 20
21static u8 rts7751r2d_irq_tab[] __initdata = { 21static u8 rts7751r2d_irq_tab[] __initdata = {
22 IRQ_PCISLOT1, 22 IRQ_PCI_INTA,
23 IRQ_PCISLOT2, 23 IRQ_PCI_INTB,
24 IRQ_PCMCIA, 24 IRQ_PCI_INTC,
25 IRQ_PCIETH, 25 IRQ_PCI_INTD,
26}; 26};
27 27
28int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin) 28int __init pcibios_map_platform_irq(struct pci_dev *pdev, u8 slot, u8 pin)