Fix warnings and add more detailed informations
[openwrt.git] / target / linux / adm5120-2.6 / files / arch / mips / pci / pci-adm5120.c
1 /*
2 * Copyright (C) ADMtek Incorporated.
3 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
4 */
5
6 #include <linux/autoconf.h>
7 #include <linux/types.h>
8 #include <linux/pci.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
11
12 extern struct pci_ops adm5120_pci_ops;
13
14 #define ADM5120_CODE 0x12000000
15 #define ADM5120_CODE_PQFP 0x20000000
16
17 #define PCI_CMM_IOACC_EN 0x1
18 #define PCI_CMM_MEMACC_EN 0x2
19 #define PCI_CMM_MASTER_EN 0x4
20 #define PCI_CMM_DEF \
21 (PCI_CMM_IOACC_EN | PCI_CMM_MEMACC_EN | PCI_CMM_MASTER_EN)
22
23 #define PCI_DEF_CACHE_LINE_SZ 4
24
25
26 struct resource pci_io_resource = {
27 .name = "PCI IO space",
28 .start = 0x11500000,
29 .end = 0x115ffff0-1,
30 .flags = IORESOURCE_IO
31 };
32
33 struct resource pci_mem_resource = {
34 .name = "PCI memory space",
35 .start = 0x11400000,
36 .end = 0x11500000,
37 .flags = IORESOURCE_MEM
38 };
39
40 static struct pci_controller adm5120_controller = {
41 .pci_ops = &adm5120_pci_ops,
42 .io_resource = &pci_io_resource,
43 .mem_resource = &pci_mem_resource,
44 };
45
46 int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
47 {
48 if (slot < 2 || slot > 4)
49 return -1;
50 return slot + 4;
51 }
52
53 static void adm5120_pci_fixup(struct pci_dev *dev)
54 {
55 if (dev->devfn == 0) {
56 pci_write_config_word(dev, PCI_COMMAND, PCI_CMM_DEF);
57 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
58 PCI_DEF_CACHE_LINE_SZ);
59 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, 0);
60 pci_write_config_dword(dev, PCI_BASE_ADDRESS_1, 0);
61 }
62 }
63
64 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, adm5120_pci_fixup);
65
66
67 int pcibios_plat_dev_init(struct pci_dev *dev)
68 {
69 return 0;
70 }
71
72 static int __init adm5120_pci_setup(void)
73 {
74
75 if ((*(volatile u32 *)(KSEG1ADDR(ADM5120_CODE))) & ADM5120_CODE_PQFP) {
76 printk("System has no PCI BIOS (ADM5120 PQFP)\n");
77 return 1;
78 }
79 printk("System has PCI BIOS (ADM5120 BGA)\n");
80
81 /* Avoid ISA compat ranges. */
82 PCIBIOS_MIN_IO = 0x00000000;
83 PCIBIOS_MIN_MEM = 0x00000000;
84
85 /* Set I/O resource limits. */
86 ioport_resource.end = 0x1fffffff;
87 iomem_resource.end = 0xffffffff;
88
89 register_pci_controller(&adm5120_controller);
90 return 0;
91 }
92
93 subsys_initcall(adm5120_pci_setup);
This page took 0.050414 seconds and 5 git commands to generate.