~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/Documentation/zorro.txt

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1                 Writing Device Drivers for Zorro Devices
  2                 ----------------------------------------
  3 
  4 Written by Geert Uytterhoeven <geert@linux-m68k.org>
  5 Last revised: February 27, 2000
  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     check_mem_region()          (deprecated)
 61     release_mem_region()
 62 
 63 Shortcuts to claim the whole device's address space are provided as well:
 64 
 65     zorro_request_device
 66     zorro_check_device          (deprecated)
 67     zorro_release_device
 68 
 69 
 70 4. Accessing the Zorro Address Space
 71 ------------------------------------
 72 
 73 The address regions in the Zorro device resources are Zorro bus address
 74 regions. Due to the identity bus-physical address mapping on the Zorro bus,
 75 they are CPU physical addresses as well.
 76 
 77 The treatment of these regions depends on the type of Zorro space:
 78 
 79   - Zorro II address space is always mapped and does not have to be mapped
 80     explicitly using ioremap().
 81     
 82     Conversion from bus/physical Zorro II addresses to kernel virtual addresses
 83     and vice versa is done using:
 84 
 85         virt_addr = ZTWO_VADDR(bus_addr);
 86         bus_addr = ZTWO_PADDR(virt_addr);
 87 
 88   - Zorro III address space must be mapped explicitly using ioremap() first
 89     before it can be accessed:
 90  
 91         virt_addr = ioremap(bus_addr, size);
 92         ...
 93         iounmap(virt_addr);
 94 
 95 
 96 5. References
 97 -------------
 98 
 99 linux/include/linux/zorro.h
100 linux/include/linux/ioport.h
101 linux/include/asm-m68k/io.h
102 linux/include/asm-m68k/amigahw.h
103 linux/include/asm-ppc/io.h
104 linux/drivers/zorro
105 /proc/bus/zorro
106 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.