e1000: Add device IDs of blade version of the 82571 quad port
[pv_ops_mirror.git] / arch / arm / common / via82c505.c
blob79a8206e62ac3f01a214a242036dc5ebadd9dc36
1 #include <linux/kernel.h>
2 #include <linux/pci.h>
3 #include <linux/interrupt.h>
4 #include <linux/mm.h>
5 #include <linux/init.h>
6 #include <linux/ioport.h>
8 #include <asm/io.h>
9 #include <asm/system.h>
11 #include <asm/mach/pci.h>
13 #define MAX_SLOTS 7
15 #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
17 static int
18 via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
19 int size, u32 *value)
21 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
22 switch (size) {
23 case 1:
24 *value=inb(0xCFC + (where&3));
25 break;
26 case 2:
27 *value=inw(0xCFC + (where&2));
28 break;
29 case 4:
30 *value=inl(0xCFC);
31 break;
33 return PCIBIOS_SUCCESSFUL;
36 static int
37 via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
38 int size, u32 value)
40 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
41 switch (size) {
42 case 1:
43 outb(value, 0xCFC + (where&3));
44 break;
45 case 2:
46 outw(value, 0xCFC + (where&2));
47 break;
48 case 4:
49 outl(value, 0xCFC);
50 break;
52 return PCIBIOS_SUCCESSFUL;
55 static struct pci_ops via82c505_ops = {
56 .read = via82c505_read_config,
57 .write = via82c505_write_config,
60 void __init via82c505_preinit(void)
62 printk(KERN_DEBUG "PCI: VIA 82c505\n");
63 if (!request_region(0xA8,2,"via config")) {
64 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
65 return;
67 if (!request_region(0xCF8,8,"pci config")) {
68 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
69 release_region(0xA8, 2);
70 return;
73 /* Enable compatible Mode */
74 outb(0x96,0xA8);
75 outb(0x18,0xA9);
76 outb(0x93,0xA8);
77 outb(0xd0,0xA9);
81 int __init via82c505_setup(int nr, struct pci_sys_data *sys)
83 return (nr == 0);
86 struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata)
88 if (nr == 0)
89 return pci_scan_bus(0, &via82c505_ops, sysdata);
91 return NULL;