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 /Documentation/zorro.txt |
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 'Documentation/zorro.txt')
-rw-r--r-- | Documentation/zorro.txt | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/Documentation/zorro.txt b/Documentation/zorro.txt new file mode 100644 index 000000000000..d5829d14774a --- /dev/null +++ b/Documentation/zorro.txt | |||
@@ -0,0 +1,102 @@ | |||
1 | Writing Device Drivers for Zorro Devices | ||
2 | ---------------------------------------- | ||
3 | |||
4 | Written by Geert Uytterhoeven <geert@linux-m68k.org> | ||
5 | Last revised: September 5, 2003 | ||
6 | |||
7 | |||
8 | 1. Introduction | ||
9 | --------------- | ||
10 | |||
11 | The Zorro bus is the bus used in the Amiga family of computers. Thanks to | ||
12 | AutoConfig(tm), it's 100% Plug-and-Play. | ||
13 | |||
14 | There are two types of Zorro busses, Zorro II and Zorro III: | ||
15 | |||
16 | - The Zorro II address space is 24-bit and lies within the first 16 MB of the | ||
17 | Amiga's address map. | ||
18 | |||
19 | - Zorro III is a 32-bit extension of Zorro II, which is backwards compatible | ||
20 | with Zorro II. The Zorro III address space lies outside the first 16 MB. | ||
21 | |||
22 | |||
23 | 2. Probing for Zorro Devices | ||
24 | ---------------------------- | ||
25 | |||
26 | Zorro devices are found by calling `zorro_find_device()', which returns a | ||
27 | pointer to the `next' Zorro device with the specified Zorro ID. A probe loop | ||
28 | for the board with Zorro ID `ZORRO_PROD_xxx' looks like: | ||
29 | |||
30 | struct zorro_dev *z = NULL; | ||
31 | |||
32 | while ((z = zorro_find_device(ZORRO_PROD_xxx, z))) { | ||
33 | if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE, | ||
34 | "My explanation")) | ||
35 | ... | ||
36 | } | ||
37 | |||
38 | `ZORRO_WILDCARD' acts as a wildcard and finds any Zorro device. If your driver | ||
39 | supports different types of boards, you can use a construct like: | ||
40 | |||
41 | struct zorro_dev *z = NULL; | ||
42 | |||
43 | while ((z = zorro_find_device(ZORRO_WILDCARD, z))) { | ||
44 | if (z->id != ZORRO_PROD_xxx1 && z->id != ZORRO_PROD_xxx2 && ...) | ||
45 | continue; | ||
46 | if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE, | ||
47 | "My explanation")) | ||
48 | ... | ||
49 | } | ||
50 | |||
51 | |||
52 | 3. Zorro Resources | ||
53 | ------------------ | ||
54 | |||
55 | Before you can access a Zorro device's registers, you have to make sure it's | ||
56 | not yet in use. This is done using the I/O memory space resource management | ||
57 | functions: | ||
58 | |||
59 | request_mem_region() | ||
60 | release_mem_region() | ||
61 | |||
62 | Shortcuts to claim the whole device's address space are provided as well: | ||
63 | |||
64 | zorro_request_device | ||
65 | zorro_release_device | ||
66 | |||
67 | |||
68 | 4. Accessing the Zorro Address Space | ||
69 | ------------------------------------ | ||
70 | |||
71 | The address regions in the Zorro device resources are Zorro bus address | ||
72 | regions. Due to the identity bus-physical address mapping on the Zorro bus, | ||
73 | they are CPU physical addresses as well. | ||
74 | |||
75 | The treatment of these regions depends on the type of Zorro space: | ||
76 | |||
77 | - Zorro II address space is always mapped and does not have to be mapped | ||
78 | explicitly using z_ioremap(). | ||
79 | |||
80 | Conversion from bus/physical Zorro II addresses to kernel virtual addresses | ||
81 | and vice versa is done using: | ||
82 | |||
83 | virt_addr = ZTWO_VADDR(bus_addr); | ||
84 | bus_addr = ZTWO_PADDR(virt_addr); | ||
85 | |||
86 | - Zorro III address space must be mapped explicitly using z_ioremap() first | ||
87 | before it can be accessed: | ||
88 | |||
89 | virt_addr = z_ioremap(bus_addr, size); | ||
90 | ... | ||
91 | z_iounmap(virt_addr); | ||
92 | |||
93 | |||
94 | 5. References | ||
95 | ------------- | ||
96 | |||
97 | linux/include/linux/zorro.h | ||
98 | linux/include/asm-{m68k,ppc}/zorro.h | ||
99 | linux/include/linux/zorro_ids.h | ||
100 | linux/drivers/zorro | ||
101 | /proc/bus/zorro | ||
102 | |||