zorro.rst 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. ========================================
  2. Writing Device Drivers for Zorro Devices
  3. ========================================
  4. :Author: Written by Geert Uytterhoeven <[email protected]>
  5. :Last revised: September 5, 2003
  6. Introduction
  7. ------------
  8. The Zorro bus is the bus used in the Amiga family of computers. Thanks to
  9. AutoConfig(tm), it's 100% Plug-and-Play.
  10. There are two types of Zorro buses, Zorro II and Zorro III:
  11. - The Zorro II address space is 24-bit and lies within the first 16 MB of the
  12. Amiga's address map.
  13. - Zorro III is a 32-bit extension of Zorro II, which is backwards compatible
  14. with Zorro II. The Zorro III address space lies outside the first 16 MB.
  15. Probing for Zorro Devices
  16. -------------------------
  17. Zorro devices are found by calling ``zorro_find_device()``, which returns a
  18. pointer to the ``next`` Zorro device with the specified Zorro ID. A probe loop
  19. for the board with Zorro ID ``ZORRO_PROD_xxx`` looks like::
  20. struct zorro_dev *z = NULL;
  21. while ((z = zorro_find_device(ZORRO_PROD_xxx, z))) {
  22. if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
  23. "My explanation"))
  24. ...
  25. }
  26. ``ZORRO_WILDCARD`` acts as a wildcard and finds any Zorro device. If your driver
  27. supports different types of boards, you can use a construct like::
  28. struct zorro_dev *z = NULL;
  29. while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {
  30. if (z->id != ZORRO_PROD_xxx1 && z->id != ZORRO_PROD_xxx2 && ...)
  31. continue;
  32. if (!zorro_request_region(z->resource.start+MY_START, MY_SIZE,
  33. "My explanation"))
  34. ...
  35. }
  36. Zorro Resources
  37. ---------------
  38. Before you can access a Zorro device's registers, you have to make sure it's
  39. not yet in use. This is done using the I/O memory space resource management
  40. functions::
  41. request_mem_region()
  42. release_mem_region()
  43. Shortcuts to claim the whole device's address space are provided as well::
  44. zorro_request_device
  45. zorro_release_device
  46. Accessing the Zorro Address Space
  47. ---------------------------------
  48. The address regions in the Zorro device resources are Zorro bus address
  49. regions. Due to the identity bus-physical address mapping on the Zorro bus,
  50. they are CPU physical addresses as well.
  51. The treatment of these regions depends on the type of Zorro space:
  52. - Zorro II address space is always mapped and does not have to be mapped
  53. explicitly using z_ioremap().
  54. Conversion from bus/physical Zorro II addresses to kernel virtual addresses
  55. and vice versa is done using::
  56. virt_addr = ZTWO_VADDR(bus_addr);
  57. bus_addr = ZTWO_PADDR(virt_addr);
  58. - Zorro III address space must be mapped explicitly using z_ioremap() first
  59. before it can be accessed::
  60. virt_addr = z_ioremap(bus_addr, size);
  61. ...
  62. z_iounmap(virt_addr);
  63. References
  64. ----------
  65. #. linux/include/linux/zorro.h
  66. #. linux/include/uapi/linux/zorro.h
  67. #. linux/include/uapi/linux/zorro_ids.h
  68. #. linux/arch/m68k/include/asm/zorro.h
  69. #. linux/drivers/zorro
  70. #. /proc/bus/zorro