diff options
Diffstat (limited to 'arch/mips/alchemy/devboards/pb1500/platform.c')
-rw-r--r-- | arch/mips/alchemy/devboards/pb1500/platform.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/arch/mips/alchemy/devboards/pb1500/platform.c b/arch/mips/alchemy/devboards/pb1500/platform.c index 42b0e6b8cd58..9f0b5a0b4795 100644 --- a/arch/mips/alchemy/devboards/pb1500/platform.c +++ b/arch/mips/alchemy/devboards/pb1500/platform.c | |||
@@ -19,11 +19,56 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/platform_device.h> | ||
22 | #include <asm/mach-au1x00/au1000.h> | 23 | #include <asm/mach-au1x00/au1000.h> |
23 | #include <asm/mach-db1x00/bcsr.h> | 24 | #include <asm/mach-db1x00/bcsr.h> |
24 | 25 | ||
25 | #include "../platform.h" | 26 | #include "../platform.h" |
26 | 27 | ||
28 | static int pb1500_map_pci_irq(const struct pci_dev *d, u8 slot, u8 pin) | ||
29 | { | ||
30 | if ((slot < 12) || (slot > 13) || pin == 0) | ||
31 | return -1; | ||
32 | if (slot == 12) | ||
33 | return (pin == 1) ? AU1500_PCI_INTA : 0xff; | ||
34 | if (slot == 13) { | ||
35 | switch (pin) { | ||
36 | case 1: return AU1500_PCI_INTA; | ||
37 | case 2: return AU1500_PCI_INTB; | ||
38 | case 3: return AU1500_PCI_INTC; | ||
39 | case 4: return AU1500_PCI_INTD; | ||
40 | } | ||
41 | } | ||
42 | return -1; | ||
43 | } | ||
44 | |||
45 | static struct resource alchemy_pci_host_res[] = { | ||
46 | [0] = { | ||
47 | .start = AU1500_PCI_PHYS_ADDR, | ||
48 | .end = AU1500_PCI_PHYS_ADDR + 0xfff, | ||
49 | .flags = IORESOURCE_MEM, | ||
50 | }, | ||
51 | }; | ||
52 | |||
53 | static struct alchemy_pci_platdata pb1500_pci_pd = { | ||
54 | .board_map_irq = pb1500_map_pci_irq, | ||
55 | .pci_cfg_set = PCI_CONFIG_AEN | PCI_CONFIG_R2H | PCI_CONFIG_R1H | | ||
56 | PCI_CONFIG_CH | | ||
57 | #if defined(__MIPSEB__) | ||
58 | PCI_CONFIG_SIC_HWA_DAT | PCI_CONFIG_SM, | ||
59 | #else | ||
60 | 0, | ||
61 | #endif | ||
62 | }; | ||
63 | |||
64 | static struct platform_device pb1500_pci_host = { | ||
65 | .dev.platform_data = &pb1500_pci_pd, | ||
66 | .name = "alchemy-pci", | ||
67 | .id = 0, | ||
68 | .num_resources = ARRAY_SIZE(alchemy_pci_host_res), | ||
69 | .resource = alchemy_pci_host_res, | ||
70 | }; | ||
71 | |||
27 | static int __init pb1500_dev_init(void) | 72 | static int __init pb1500_dev_init(void) |
28 | { | 73 | { |
29 | int swapped; | 74 | int swapped; |
@@ -41,7 +86,8 @@ static int __init pb1500_dev_init(void) | |||
41 | 86 | ||
42 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; | 87 | swapped = bcsr_read(BCSR_STATUS) & BCSR_STATUS_DB1000_SWAPBOOT; |
43 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); | 88 | db1x_register_norflash(64 * 1024 * 1024, 4, swapped); |
89 | platform_device_register(&pb1500_pci_host); | ||
44 | 90 | ||
45 | return 0; | 91 | return 0; |
46 | } | 92 | } |
47 | device_initcall(pb1500_dev_init); | 93 | arch_initcall(pb1500_dev_init); |