Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | * Toshiba RBTX4927 specific interrupt handlers |
| 3 | * |
| 4 | * Author: MontaVista Software, Inc. |
| 5 | * source@mvista.com |
| 6 | * |
| 7 | * Copyright 2001-2002 MontaVista Software Inc. |
| 8 | * |
| 9 | * This program is free software; you can redistribute it and/or modify it |
| 10 | * under the terms of the GNU General Public License as published by the |
| 11 | * Free Software Foundation; either version 2 of the License, or (at your |
| 12 | * option) any later version. |
| 13 | * |
| 14 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED |
| 15 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 17 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 18 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 19 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 20 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR |
| 22 | * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE |
| 23 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | * |
| 25 | * You should have received a copy of the GNU General Public License along |
| 26 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 27 | * 675 Mass Ave, Cambridge, MA 02139, USA. |
| 28 | */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 29 | /* |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 30 | IRQ Device |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | 00 RBTX4927-ISA/00 |
| 32 | 01 RBTX4927-ISA/01 PS2/Keyboard |
| 33 | 02 RBTX4927-ISA/02 Cascade RBTX4927-ISA (irqs 8-15) |
| 34 | 03 RBTX4927-ISA/03 |
| 35 | 04 RBTX4927-ISA/04 |
| 36 | 05 RBTX4927-ISA/05 |
| 37 | 06 RBTX4927-ISA/06 |
| 38 | 07 RBTX4927-ISA/07 |
| 39 | 08 RBTX4927-ISA/08 |
| 40 | 09 RBTX4927-ISA/09 |
| 41 | 10 RBTX4927-ISA/10 |
| 42 | 11 RBTX4927-ISA/11 |
| 43 | 12 RBTX4927-ISA/12 PS2/Mouse (not supported at this time) |
| 44 | 13 RBTX4927-ISA/13 |
| 45 | 14 RBTX4927-ISA/14 IDE |
| 46 | 15 RBTX4927-ISA/15 |
| 47 | |
| 48 | 16 TX4927-CP0/00 Software 0 |
| 49 | 17 TX4927-CP0/01 Software 1 |
| 50 | 18 TX4927-CP0/02 Cascade TX4927-CP0 |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 51 | 19 TX4927-CP0/03 Multiplexed -- do not use |
| 52 | 20 TX4927-CP0/04 Multiplexed -- do not use |
| 53 | 21 TX4927-CP0/05 Multiplexed -- do not use |
| 54 | 22 TX4927-CP0/06 Multiplexed -- do not use |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 55 | 23 TX4927-CP0/07 CPU TIMER |
| 56 | |
| 57 | 24 TX4927-PIC/00 |
| 58 | 25 TX4927-PIC/01 |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 59 | 26 TX4927-PIC/02 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 60 | 27 TX4927-PIC/03 Cascade RBTX4927-IOC |
| 61 | 28 TX4927-PIC/04 |
| 62 | 29 TX4927-PIC/05 RBTX4927 RTL-8019AS ethernet |
| 63 | 30 TX4927-PIC/06 |
| 64 | 31 TX4927-PIC/07 |
| 65 | 32 TX4927-PIC/08 TX4927 SerialIO Channel 0 |
| 66 | 33 TX4927-PIC/09 TX4927 SerialIO Channel 1 |
| 67 | 34 TX4927-PIC/10 |
| 68 | 35 TX4927-PIC/11 |
| 69 | 36 TX4927-PIC/12 |
| 70 | 37 TX4927-PIC/13 |
| 71 | 38 TX4927-PIC/14 |
| 72 | 39 TX4927-PIC/15 |
| 73 | 40 TX4927-PIC/16 TX4927 PCI PCI-C |
| 74 | 41 TX4927-PIC/17 |
| 75 | 42 TX4927-PIC/18 |
| 76 | 43 TX4927-PIC/19 |
| 77 | 44 TX4927-PIC/20 |
| 78 | 45 TX4927-PIC/21 |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 79 | 46 TX4927-PIC/22 TX4927 PCI PCI-ERR |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 80 | 47 TX4927-PIC/23 TX4927 PCI PCI-PMA (not used) |
| 81 | 48 TX4927-PIC/24 |
| 82 | 49 TX4927-PIC/25 |
| 83 | 50 TX4927-PIC/26 |
| 84 | 51 TX4927-PIC/27 |
| 85 | 52 TX4927-PIC/28 |
| 86 | 53 TX4927-PIC/29 |
| 87 | 54 TX4927-PIC/30 |
| 88 | 55 TX4927-PIC/31 |
| 89 | |
| 90 | 56 RBTX4927-IOC/00 FPCIB0 PCI-D PJ4/A PJ5/B SB/C PJ6/D PJ7/A (SouthBridge/NotUsed) [RTL-8139=PJ4] |
| 91 | 57 RBTX4927-IOC/01 FPCIB0 PCI-C PJ4/D PJ5/A SB/B PJ6/C PJ7/D (SouthBridge/NotUsed) [RTL-8139=PJ5] |
| 92 | 58 RBTX4927-IOC/02 FPCIB0 PCI-B PJ4/C PJ5/D SB/A PJ6/B PJ7/C (SouthBridge/IDE/pin=1,INTR) [RTL-8139=NotSupported] |
| 93 | 59 RBTX4927-IOC/03 FPCIB0 PCI-A PJ4/B PJ5/C SB/D PJ6/A PJ7/B (SouthBridge/USB/pin=4) [RTL-8139=PJ6] |
| 94 | 60 RBTX4927-IOC/04 |
| 95 | 61 RBTX4927-IOC/05 |
| 96 | 62 RBTX4927-IOC/06 |
| 97 | 63 RBTX4927-IOC/07 |
| 98 | |
Ralf Baechle | 42a3b4f | 2005-09-03 15:56:17 -0700 | [diff] [blame] | 99 | NOTES: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | SouthBridge/INTR is mapped to SouthBridge/A=PCI-B/#58 |
| 101 | SouthBridge/ISA/pin=0 no pci irq used by this device |
| 102 | SouthBridge/IDE/pin=1 no pci irq used by this device, using INTR via ISA IRQ14 |
| 103 | SouthBridge/USB/pin=4 using pci irq SouthBridge/D=PCI-A=#59 |
| 104 | SouthBridge/PMC/pin=0 no pci irq used by this device |
| 105 | SuperIO/PS2/Keyboard, using INTR via ISA IRQ1 |
| 106 | SuperIO/PS2/Mouse, using INTR via ISA IRQ12 (mouse not currently supported) |
| 107 | JP7 is not bus master -- do NOT use -- only 4 pci bus master's allowed -- SouthBridge, JP4, JP5, JP6 |
| 108 | */ |
| 109 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 110 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 111 | #include <linux/types.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | #include <linux/interrupt.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | #include <asm/io.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 114 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
Atsushi Nemoto | c87abd7 | 2007-08-02 23:36:02 +0900 | [diff] [blame] | 115 | #include <asm/i8259.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | #endif |
Atsushi Nemoto | 22b1d70 | 2008-07-11 00:31:36 +0900 | [diff] [blame^] | 117 | #include <asm/txx9/rbtx4927.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG 0 |
| 120 | #define TOSHIBA_RBTX4927_IRQ_IOC_RAW_END 7 |
| 121 | |
| 122 | #define TOSHIBA_RBTX4927_IRQ_IOC_BEG ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_BEG) /* 56 */ |
| 123 | #define TOSHIBA_RBTX4927_IRQ_IOC_END ((TX4927_IRQ_PIC_END+1)+TOSHIBA_RBTX4927_IRQ_IOC_RAW_END) /* 63 */ |
| 124 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | #define TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC TX4927_IRQ_NEST_EXT_ON_PIC |
| 126 | #define TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC (TOSHIBA_RBTX4927_IRQ_IOC_BEG+2) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 127 | |
| 128 | extern int tx4927_using_backplane; |
| 129 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq); |
| 131 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 133 | #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" |
Ralf Baechle | 94dee17 | 2006-07-02 14:41:42 +0100 | [diff] [blame] | 134 | static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { |
Atsushi Nemoto | 70d21cd | 2007-01-15 00:07:25 +0900 | [diff] [blame] | 135 | .name = TOSHIBA_RBTX4927_IOC_NAME, |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame] | 136 | .ack = toshiba_rbtx4927_irq_ioc_disable, |
| 137 | .mask = toshiba_rbtx4927_irq_ioc_disable, |
| 138 | .mask_ack = toshiba_rbtx4927_irq_ioc_disable, |
| 139 | .unmask = toshiba_rbtx4927_irq_ioc_enable, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 140 | }; |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 141 | #define TOSHIBA_RBTX4927_IOC_INTR_ENAB (void __iomem *)0xbc002000UL |
| 142 | #define TOSHIBA_RBTX4927_IOC_INTR_STAT (void __iomem *)0xbc002006UL |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 143 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 144 | int toshiba_rbtx4927_irq_nested(int sw_irq) |
| 145 | { |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 146 | u8 level3; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 147 | |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 148 | level3 = readb(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | if (level3) { |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 150 | sw_irq = TOSHIBA_RBTX4927_IRQ_IOC_BEG + fls(level3) - 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 152 | if (sw_irq == TOSHIBA_RBTX4927_IRQ_NEST_ISA_ON_IOC && |
| 153 | tx4927_using_backplane) { |
| 154 | int irq = i8259_irq(); |
| 155 | if (irq >= 0) |
| 156 | sw_irq = irq; |
| 157 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 158 | #endif |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 159 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 160 | return (sw_irq); |
| 161 | } |
| 162 | |
Thomas Gleixner | 4e45171 | 2007-08-28 09:03:01 +0000 | [diff] [blame] | 163 | static struct irqaction toshiba_rbtx4927_irq_ioc_action = { |
| 164 | .handler = no_action, |
| 165 | .flags = IRQF_SHARED, |
| 166 | .mask = CPU_MASK_NONE, |
| 167 | .name = TOSHIBA_RBTX4927_IOC_NAME |
| 168 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | static void __init toshiba_rbtx4927_irq_ioc_init(void) |
| 171 | { |
| 172 | int i; |
| 173 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 174 | for (i = TOSHIBA_RBTX4927_IRQ_IOC_BEG; |
Atsushi Nemoto | 1603b5a | 2006-11-02 02:08:36 +0900 | [diff] [blame] | 175 | i <= TOSHIBA_RBTX4927_IRQ_IOC_END; i++) |
Atsushi Nemoto | 1417836 | 2006-11-14 01:13:18 +0900 | [diff] [blame] | 176 | set_irq_chip_and_handler(i, &toshiba_rbtx4927_irq_ioc_type, |
| 177 | handle_level_irq); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 178 | |
| 179 | setup_irq(TOSHIBA_RBTX4927_IRQ_NEST_IOC_ON_PIC, |
| 180 | &toshiba_rbtx4927_irq_ioc_action); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 183 | static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq) |
| 184 | { |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 185 | unsigned char v; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 186 | |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 187 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | v |= (1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 189 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 190 | } |
| 191 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 192 | static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq) |
| 193 | { |
Atsushi Nemoto | b29eee4 | 2008-04-16 02:00:45 +0900 | [diff] [blame] | 194 | unsigned char v; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 196 | v = readb(TOSHIBA_RBTX4927_IOC_INTR_ENAB); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 197 | v &= ~(1 << (irq - TOSHIBA_RBTX4927_IRQ_IOC_BEG)); |
Atsushi Nemoto | a02eb8d | 2007-08-28 00:28:09 +0900 | [diff] [blame] | 198 | writeb(v, TOSHIBA_RBTX4927_IOC_INTR_ENAB); |
| 199 | mmiowb(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 200 | } |
| 201 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 202 | void __init arch_init_irq(void) |
| 203 | { |
| 204 | extern void tx4927_irq_init(void); |
| 205 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | tx4927_irq_init(); |
| 207 | toshiba_rbtx4927_irq_ioc_init(); |
| 208 | #ifdef CONFIG_TOSHIBA_FPCIB0 |
Atsushi Nemoto | c87abd7 | 2007-08-02 23:36:02 +0900 | [diff] [blame] | 209 | if (tx4927_using_backplane) |
| 210 | init_i8259_irqs(); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 211 | #endif |
Atsushi Nemoto | c87abd7 | 2007-08-02 23:36:02 +0900 | [diff] [blame] | 212 | /* Onboard 10M Ether: High Active */ |
| 213 | set_irq_type(RBTX4927_RTL_8019_IRQ, IRQF_TRIGGER_HIGH); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 214 | } |