1353358Sdim/* 2353358Sdim * TURBOchannel architecture calls. 3353358Sdim * 4353358Sdim * Copyright (c) Harald Koerfgen, 1998 5353358Sdim * Copyright (c) 2001, 2003, 2005, 2006 Maciej W. Rozycki 6353358Sdim * Copyright (c) 2005 James Simmons 7353358Sdim * 8353358Sdim * This file is subject to the terms and conditions of the GNU 9353358Sdim * General Public License. See the file "COPYING" in the main 10353358Sdim * directory of this archive for more details. 11353358Sdim */ 12276789Sdim#include <linux/compiler.h> 13276789Sdim#include <linux/errno.h> 14276789Sdim#include <linux/init.h> 15353358Sdim#include <linux/string.h> 16353358Sdim#include <linux/tc.h> 17353358Sdim#include <linux/types.h> 18276789Sdim 19353358Sdim#include <asm/addrspace.h> 20353358Sdim#include <asm/bootinfo.h> 21353358Sdim#include <asm/paccess.h> 22353358Sdim 23353358Sdim#include <asm/dec/interrupts.h> 24353358Sdim#include <asm/dec/prom.h> 25353358Sdim#include <asm/dec/system.h> 26353358Sdim 27353358Sdim/* 28353358Sdim * Protected read byte from TURBOchannel slot space. 29353358Sdim */ 30353358Sdimint tc_preadb(u8 *valp, void __iomem *addr) 31353358Sdim{ 32353358Sdim return get_dbe(*valp, (u8 *)addr); 33276789Sdim} 34276789Sdim 35276789Sdim/* 36353358Sdim * Get TURBOchannel bus information as specified by the spec, plus 37353358Sdim * the slot space base address and the number of slots. 38353358Sdim */ 39353358Sdimint __init tc_bus_get_info(struct tc_bus *tbus) 40353358Sdim{ 41276789Sdim if (!dec_tc_bus) 42276789Sdim return -ENXIO; 43 44 memcpy(&tbus->info, rex_gettcinfo(), sizeof(tbus->info)); 45 tbus->slot_base = CPHYSADDR((long)rex_slot_address(0)); 46 47 switch (mips_machtype) { 48 case MACH_DS5000_200: 49 tbus->num_tcslots = 7; 50 break; 51 case MACH_DS5000_2X0: 52 case MACH_DS5900: 53 tbus->ext_slot_base = 0x20000000; 54 tbus->ext_slot_size = 0x20000000; 55 fallthrough; 56 case MACH_DS5000_1XX: 57 tbus->num_tcslots = 3; 58 break; 59 case MACH_DS5000_XX: 60 tbus->num_tcslots = 2; 61 default: 62 break; 63 } 64 return 0; 65} 66 67/* 68 * Get the IRQ for the specified slot. 69 */ 70void __init tc_device_get_irq(struct tc_dev *tdev) 71{ 72 switch (tdev->slot) { 73 case 0: 74 tdev->interrupt = dec_interrupt[DEC_IRQ_TC0]; 75 break; 76 case 1: 77 tdev->interrupt = dec_interrupt[DEC_IRQ_TC1]; 78 break; 79 case 2: 80 tdev->interrupt = dec_interrupt[DEC_IRQ_TC2]; 81 break; 82 /* 83 * Yuck! DS5000/200 onboard devices 84 */ 85 case 5: 86 tdev->interrupt = dec_interrupt[DEC_IRQ_TC5]; 87 break; 88 case 6: 89 tdev->interrupt = dec_interrupt[DEC_IRQ_TC6]; 90 break; 91 default: 92 tdev->interrupt = -1; 93 break; 94 } 95} 96