2 * Copyright (C) ADMtek Incorporated.
3 * Copyright (C) 2005 Jeroen Vreeken (pe1rxq@amsat.org)
6 #include <linux/autoconf.h>
7 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/init.h>
12 extern struct pci_ops adm5120_pci_ops
;
14 #define ADM5120_CODE 0x12000000
15 #define ADM5120_CODE_PQFP 0x20000000
17 #define PCI_CMM_IOACC_EN 0x1
18 #define PCI_CMM_MEMACC_EN 0x2
19 #define PCI_CMM_MASTER_EN 0x4
21 (PCI_CMM_IOACC_EN | PCI_CMM_MEMACC_EN | PCI_CMM_MASTER_EN)
23 #define PCI_DEF_CACHE_LINE_SZ 4
26 struct resource pci_io_resource
= {
27 .name
= "PCI IO space",
30 .flags
= IORESOURCE_IO
33 struct resource pci_mem_resource
= {
34 .name
= "PCI memory space",
37 .flags
= IORESOURCE_MEM
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
,
46 int __init
pcibios_map_irq(struct pci_dev
*dev
, u8 slot
, u8 pin
)
48 if (slot
< 2 || slot
> 4)
53 static void adm5120_pci_fixup(struct pci_dev
*dev
)
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);
64 DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID
, PCI_ANY_ID
, adm5120_pci_fixup
);
67 int pcibios_plat_dev_init(struct pci_dev
*dev
)
72 static int __init
adm5120_pci_setup(void)
75 if ((*(volatile u32
*)(KSEG1ADDR(ADM5120_CODE
))) & ADM5120_CODE_PQFP
) {
76 printk("System has no PCI BIOS (ADM5120 PQFP)\n");
79 printk("System has PCI BIOS (ADM5120 BGA)\n");
81 /* Avoid ISA compat ranges. */
82 PCIBIOS_MIN_IO
= 0x00000000;
83 PCIBIOS_MIN_MEM
= 0x00000000;
85 /* Set I/O resource limits. */
86 ioport_resource
.end
= 0x1fffffff;
87 iomem_resource
.end
= 0xffffffff;
89 register_pci_controller(&adm5120_controller
);
93 subsys_initcall(adm5120_pci_setup
);