linux/Documentation/zorro.txt
<<
alue2ot/spa3.1 2ot/form.1 2ota alue2o href="../linux+v34.16/Documenta v3/zorro.txt">alue2otimg src="../.sta c/gfx/right.png" alt=">>">alt/spa3.1altspa3 class="lxr_search">aluealue2otinput typ hidden" nam navtarget" n> ">alue2otinput typ text" nam search" id search">alue2otbutt2iotyp submit">Searchalue2oPrefs1 2ot/a>alt/spa3.1ue2o ot/div.1ue2o otform ac v3="ajax+*" method="post" onsubmit="return false;">altinput typ hidden" nam ajax_lookup" id ajax_lookup" n> ">aue2o ot/form.1aue2o otdiv class="headingbott2m">o o1t/a> Writing Device Drivers for Zorro Devices o o2t/a> ---------------------------------------- o o3t/a>ao o4t/a>Written by Geert Uytterhoeven <geert@linux-m68k.org>ao o5t/a>Last revised: September 5, 2003ao o6t/a>ao o7t/a>ao o8t/a>1. Introduc v3ao o9t/a>--------------- o > a>ao 11t/a>The Zorro bus is the bus used in the Amiga family of computers. Thanks toao 12t/a>AutoConfig(tm), it's 0% Plug-and-Play.ao 13t/a>ao 14t/a>There are two typ s of Zorro busses, Zorro II and Zorro III:ao 15t/a>ao 16t/a> - The Zorro II address space is 24-bit and li s within the first 16 MB of theao 17t/a> Amiga's address map.ao 18t/a>ao 19t/a> - Zorro III is a 32-bit extenso2ioof Zorro II, which is backwards compa bleao 20t/a> with Zorro II. The Zorro III address space li s outside the first 16 MB.ao 21t/a>ao 22t/a>ao 23t/a>2.oProbing for Zorro Devices o 24t/a>---------------------------- o 25t/a>ao 26t/a>Zorro devices are found by calling `zorro_find_device()', which returns aao 27t/a>pointer to the `next' Zorro device with the specified Zorro ID. A probe loopao 28t/a>for the board with Zorro ID `ZORRO_PROD_xxx' looks like:ao 29t/a>ao 30t/a> struc zorro_dev *z = NULL;ao 31t/a>ao 32t/a> while ((z = zorro_find_device(ZORRO_PROD_xxx, z))) {ao 33t/a> if (!zorro_request_reg v3(z->resource.start+MY_START, MY_SIZE,ao 34t/a> "My explana v3"))ao 35t/a> ...ao 36t/a> }ao 37t/a>ao 38t/a>`ZORRO_WILDCARD' acts as a wildcard and finds any Zorro device. If your driverao 39t/a>supports different typ s of boards, you can use a construc like:ao 4 > a>ao 41t/a> struc zorro_dev *z = NULL;ao 42t/a>ao 43t/a> while ((z = zorro_find_device(ZORRO_WILDCARD, z))) {ao 44t/a> if (z->id != ZORRO_PROD_xxx1 && z->id != ZORRO_PROD_xxx2 && ...)ao 45t/a> continue;ao 46t/a> if (!zorro_request_reg v3(z->resource.start+MY_START, MY_SIZE,ao 47t/a> "My explana v3"))ao 48t/a> ...ao 49t/a> }ao 5 > a>ao 51t/a>ao 52t/a>3. Zorro Resources o 53t/a>------------------ o 54t/a>ao 55t/a>Before you can access a Zorro device's reg sters, you have to make sure it'sao 56t/a>not yet in use. This is done using the I/O memory space resource managementao 57t/a>func v3s:ao 58t/a>ao 59t/a> request_mem_reg v3()ao 60t/a> release_mem_reg v3()ao 61t/a>ao 62t/a>Shortcuts to claim the whole device's address space are provided as well:ao 63t/a>ao 64t/a> zorro_request_deviceao 65t/a> zorro_release_deviceao 66t/a>ao 67t/a>ao 68t/a>4. Accessing the Zorro Address Spaceao 69t/a>------------------------------------ o 7 > a>ao 71t/a>The address reg v3s in the Zorro device resources are Zorro bus addressao 72t/a>reg v3s. Due to the identity bus-physical address mapping on the Zorro bus,ao 73t/a>they are CPU physical addresses as well.ao 74t/a>ao 75t/a>The treatment of these reg v3s depends on the typ oof Zorro space:ao 76t/a>ao 77t/a> - Zorro II address space is always mapped and does not have to be mappedao 78t/a> explicitly using z_ioremap().ao 79t/a> ao 80t/a> Converso2iofrom bus/physical Zorro II addresses to kernel virtual addressesao 81t/a> and vice versa is done using:ao 82t/a>ao 83t/a> virt_addr = ZTWO_VADDR(bus_addr);ao 84t/a> bus_addr = ZTWO_PADDR(virt_addr);ao 85t/a>ao 86t/a> - Zorro III address space must be mapped explicitly using z_ioremap() firstao 87t/a> before it can be accessed:ao 88t/a> ao 89t/a> virt_addr = z_ioremap(bus_addr, size);ao 90t/a> ...ao 91t/a> z_iounmap(virt_addr);ao 92t/a>ao 93t/a>ao 94t/a>5. References o 95t/a>------------- o 96t/a>ao 97t/a>linux/include/linux/zorro.hao 98t/a>linux/include/asm-{m68k,ppc}/zorro.hao 99t/a>linux/include/linux/zorro_ids.hao100t/a>linux/drivers/zorroao101t/a>/proc/bus/zorroao102t/a>ao103t/a> The original LXR software by the LXR communityt/a>, this experimental verso2ioby lxr@linux.not/a>. t/div.1tdiv class="subfooter"> lxr.linux.no kindly hostedoby Redpill Linpro ASt/a>, provideroof Linux consulting and opera v3s services since 1995. t/div.1 t/body.1t/html.1