diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/arm/common/via82c505.c |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/arm/common/via82c505.c')
-rw-r--r-- | arch/arm/common/via82c505.c | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/arch/arm/common/via82c505.c b/arch/arm/common/via82c505.c new file mode 100644 index 000000000000..ef716a5b07ac --- /dev/null +++ b/arch/arm/common/via82c505.c | |||
@@ -0,0 +1,94 @@ | |||
1 | #include <linux/config.h> | ||
2 | #include <linux/kernel.h> | ||
3 | #include <linux/pci.h> | ||
4 | #include <linux/ptrace.h> | ||
5 | #include <linux/interrupt.h> | ||
6 | #include <linux/mm.h> | ||
7 | #include <linux/init.h> | ||
8 | #include <linux/ioport.h> | ||
9 | |||
10 | #include <asm/io.h> | ||
11 | #include <asm/system.h> | ||
12 | |||
13 | #include <asm/mach/pci.h> | ||
14 | |||
15 | #define MAX_SLOTS 7 | ||
16 | |||
17 | #define CONFIG_CMD(bus, devfn, where) (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) | ||
18 | |||
19 | static int | ||
20 | via82c505_read_config(struct pci_bus *bus, unsigned int devfn, int where, | ||
21 | int size, u32 *value) | ||
22 | { | ||
23 | outl(CONFIG_CMD(bus,devfn,where),0xCF8); | ||
24 | switch (size) { | ||
25 | case 1: | ||
26 | *value=inb(0xCFC + (where&3)); | ||
27 | break; | ||
28 | case 2: | ||
29 | *value=inw(0xCFC + (where&2)); | ||
30 | break; | ||
31 | case 4: | ||
32 | *value=inl(0xCFC); | ||
33 | break; | ||
34 | } | ||
35 | return PCIBIOS_SUCCESSFUL; | ||
36 | } | ||
37 | |||
38 | static int | ||
39 | via82c505_write_config(struct pci_bus *bus, unsigned int devfn, int where, | ||
40 | int size, u32 value) | ||
41 | { | ||
42 | outl(CONFIG_CMD(bus,devfn,where),0xCF8); | ||
43 | switch (size) { | ||
44 | case 1: | ||
45 | outb(value, 0xCFC + (where&3)); | ||
46 | break; | ||
47 | case 2: | ||
48 | outw(value, 0xCFC + (where&2)); | ||
49 | break; | ||
50 | case 4: | ||
51 | outl(value, 0xCFC); | ||
52 | break; | ||
53 | } | ||
54 | return PCIBIOS_SUCCESSFUL; | ||
55 | } | ||
56 | |||
57 | static struct pci_ops via82c505_ops = { | ||
58 | .read = via82c505_read_config, | ||
59 | .write = via82c505_write_config, | ||
60 | }; | ||
61 | |||
62 | void __init via82c505_preinit(void) | ||
63 | { | ||
64 | printk(KERN_DEBUG "PCI: VIA 82c505\n"); | ||
65 | if (!request_region(0xA8,2,"via config")) { | ||
66 | printk(KERN_WARNING"VIA 82c505: Unable to request region 0xA8\n"); | ||
67 | return; | ||
68 | } | ||
69 | if (!request_region(0xCF8,8,"pci config")) { | ||
70 | printk(KERN_WARNING"VIA 82c505: Unable to request region 0xCF8\n"); | ||
71 | release_region(0xA8, 2); | ||
72 | return; | ||
73 | } | ||
74 | |||
75 | /* Enable compatible Mode */ | ||
76 | outb(0x96,0xA8); | ||
77 | outb(0x18,0xA9); | ||
78 | outb(0x93,0xA8); | ||
79 | outb(0xd0,0xA9); | ||
80 | |||
81 | } | ||
82 | |||
83 | int __init via82c505_setup(int nr, struct pci_sys_data *sys) | ||
84 | { | ||
85 | return (nr == 0); | ||
86 | } | ||
87 | |||
88 | struct pci_bus * __init via82c505_scan_bus(int nr, struct pci_sys_data *sysdata) | ||
89 | { | ||
90 | if (nr == 0) | ||
91 | return pci_scan_bus(0, &via82c505_ops, sysdata); | ||
92 | |||
93 | return NULL; | ||
94 | } | ||