Merge branch 'stable' of git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux...
[deliverable/linux.git] / arch / arm / common / via82c505.c
CommitLineData
1da177e4
LT
1#include <linux/kernel.h>
2#include <linux/pci.h>
1da177e4
LT
3#include <linux/interrupt.h>
4#include <linux/mm.h>
5#include <linux/init.h>
6#include <linux/ioport.h>
fced80c7 7#include <linux/io.h>
1da177e4 8
1da177e4
LT
9
10#include <asm/mach/pci.h>
11
12#define MAX_SLOTS 7
13
14#define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3))
15
16static int
17via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where,
18 int size, u32 *value)
19{
20 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
21 switch (size) {
22 case 1:
23 *value=inb(0xCFC + (where&3));
24 break;
25 case 2:
26 *value=inw(0xCFC + (where&2));
27 break;
28 case 4:
29 *value=inl(0xCFC);
30 break;
31 }
32 return PCIBIOS_SUCCESSFUL;
33}
34
35static int
36via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where,
37 int size, u32 value)
38{
39 outl(CONFIG_CMD(bus,devfn,where),0xCF8);
40 switch (size) {
41 case 1:
42 outb(value, 0xCFC + (where&3));
43 break;
44 case 2:
45 outw(value, 0xCFC + (where&2));
46 break;
47 case 4:
48 outl(value, 0xCFC);
49 break;
50 }
51 return PCIBIOS_SUCCESSFUL;
52}
53
c23bfc38 54struct pci_ops via82c505_ops = {
1da177e4
LT
55 .read = via82c505_read_config,
56 .write = via82c505_write_config,
57};
58
59void __init via82c505_preinit(void)
60{
61 printk(KERN_DEBUG "PCI: VIA 82c505\n");
62 if (!request_region(0xA8,2,"via config")) {
63 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n");
64 return;
65 }
66 if (!request_region(0xCF8,8,"pci config")) {
67 printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n");
68 release_region(0xA8, 2);
69 return;
70 }
71
72 /* Enable compatible Mode */
73 outb(0x96,0xA8);
74 outb(0x18,0xA9);
75 outb(0x93,0xA8);
76 outb(0xd0,0xA9);
77
78}
79
80int __init via82c505_setup(int nr, struct pci_sys_data *sys)
81{
82 return (nr == 0);
83}
This page took 0.606161 seconds and 5 git commands to generate.