Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/sh/kernel/pci-bigsur.c |
| 3 | * |
| 4 | * By Dustin McIntire (dustin@sensoria.com) (c)2001 |
| 5 | * |
| 6 | * Ported to new API by Paul Mundt <lethal@linux-sh.org>. |
| 7 | * |
| 8 | * May be copied or modified under the terms of the GNU General Public |
| 9 | * License. See linux/COPYING for more information. |
| 10 | * |
| 11 | * PCI initialization for the Hitachi Big Sur Evaluation Board |
| 12 | */ |
| 13 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 14 | #include <linux/kernel.h> |
| 15 | #include <linux/types.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/delay.h> |
| 18 | #include <linux/pci.h> |
| 19 | |
| 20 | #include <asm/io.h> |
| 21 | #include "pci-sh7751.h" |
| 22 | #include <asm/bigsur/bigsur.h> |
| 23 | |
| 24 | #define BIGSUR_PCI_IO 0x4000 |
| 25 | #define BIGSUR_PCI_MEM 0xfd000000 |
| 26 | |
| 27 | static struct resource sh7751_io_resource = { |
| 28 | .name = "SH7751 IO", |
| 29 | .start = BIGSUR_PCI_IO, |
| 30 | .end = BIGSUR_PCI_IO + (64*1024) - 1, |
| 31 | .flags = IORESOURCE_IO, |
| 32 | }; |
| 33 | |
| 34 | static struct resource sh7751_mem_resource = { |
| 35 | .name = "SH7751 mem", |
| 36 | .start = BIGSUR_PCI_MEM, |
| 37 | .end = BIGSUR_PCI_MEM + (64*1024*1024) - 1, |
| 38 | .flags = IORESOURCE_MEM, |
| 39 | }; |
| 40 | |
| 41 | extern struct pci_ops sh7751_pci_ops; |
| 42 | |
| 43 | struct pci_channel board_pci_channels[] = { |
| 44 | { &sh7751_pci_ops, &sh7751_io_resource, &sh7751_mem_resource, 0, 0xff }, |
| 45 | { 0, } |
| 46 | }; |
| 47 | |
| 48 | static struct sh7751_pci_address_map sh7751_pci_map = { |
| 49 | .window0 = { |
| 50 | .base = SH7751_CS3_BASE_ADDR, |
| 51 | .size = BIGSUR_LSR0_SIZE, |
| 52 | }, |
| 53 | |
| 54 | .window1 = { |
| 55 | .base = SH7751_CS3_BASE_ADDR, |
| 56 | .size = BIGSUR_LSR1_SIZE, |
| 57 | }, |
| 58 | }; |
| 59 | |
| 60 | /* |
| 61 | * Initialize the Big Sur PCI interface |
| 62 | * Setup hardware to be Central Funtion |
| 63 | * Copy the BSR regs to the PCI interface |
| 64 | * Setup PCI windows into local RAM |
| 65 | */ |
| 66 | int __init pcibios_init_platform(void) |
| 67 | { |
| 68 | return sh7751_pcic_init(&sh7751_pci_map); |
| 69 | } |
| 70 | |
| 71 | int pcibios_map_platform_irq(u8 slot, u8 pin) |
| 72 | { |
| 73 | /* |
| 74 | * The Big Sur can be used in a CPCI chassis, but the SH7751 PCI |
| 75 | * interface is on the wrong end of the board so that it can also |
| 76 | * support a V320 CPI interface chip... Therefor the IRQ mapping is |
| 77 | * somewhat use dependent... I'l assume a linear map for now, i.e. |
| 78 | * INTA=slot0,pin0... INTD=slot3,pin0... |
| 79 | */ |
| 80 | int irq = (slot + pin-1) % 4 + BIGSUR_SH7751_PCI_IRQ_BASE; |
| 81 | |
| 82 | PCIDBG(2, "PCI: Mapping Big Sur IRQ for slot %d, pin %c to irq %d\n", |
| 83 | slot, pin-1+'A', irq); |
| 84 | |
| 85 | return irq; |
| 86 | } |
| 87 | |