1 Writing Device Drivers for Zorro Devices
2 ----------------------------------------
4 Written by Geert Uytterhoeven <geert@linux-m68k.org>
5 Last revised: February 27, 2000
11 The Zorro bus is the bus used in the Amiga family of computers. Thanks to
12 AutoConfig(tm), it's is 100% Plug-and-Play.
14 There are two types of Zorro busses, Zorro II and Zorro III:
16 - The Zorro II address space is 24-bit and lies within the first 16 MB of the
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.
23 2. Probing for Zorro Devices
24 ----------------------------
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:
30 struct zorro_dev *z = NULL;
32 while ((z = zorro_find_device(ZORRO_PROD_xxx, z))) {
33 if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
35 strcpy(z->name, "My board name");
39 `ZORRO_WILDCARD' acts as a wildcard and finds any Zorro device. If your driver
40 supports different types of boards, you can use a construct like:
42 struct zorro_dev *z = NULL;
44 while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
45 if (z->id != ZORRO_PROD_xxx1 && z->id != ZORRO_PROD_xxx2 && ...)
47 if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
56 Before you can access a Zorro device's registers, you have to make sure it's
57 not yet in use. This is done using the I/O memory space resource management
61 check_mem_region() (deprecated)
64 Shortcuts to claim the whole device's address space are provided as well:
67 zorro_check_device (deprecated)
71 4. Accessing the Zorro Address Space
72 ------------------------------------
74 The address regions in the Zorro device resources are Zorro bus address
75 regions. Due to the identity bus-physical address mapping on the Zorro bus,
76 they are CPU physical addresses as well.
78 The treatment of these regions depends on the type of Zorro space:
80 - Zorro II address space is always mapped and does not have to be mapped
81 explicitly using ioremap().
83 Conversion from bus/physical Zorro II addresses to kernel virtual addresses
84 and vice versa is done using:
86 virt_addr = ZTWO_VADDR(bus_addr);
87 bus_addr = ZTWO_PADDR(virt_addr);
89 - Zorro III address space must be mapped explicitly using ioremap() first
90 before it can be accessed:
92 virt_addr = ioremap(bus_addr, size);
97 5. Zorro Device Naming
98 ----------------------
100 Since we think generic device naming is something for userspace (zorroutils),
101 we don't keep a Zorro device name database in the kernel.
102 However, device drivers are allowed to store the expansion board name in struct
109 linux/include/linux/zorro.h
110 linux/include/linux/ioport.h
111 linux/include/asm-m68k/io.h
112 linux/include/asm-m68k/amigahw.h
113 linux/include/asm-ppc/io.h