1*4a6b2ebbSryo /* $NetBSD: ixp425_a4x_space.c,v 1.4 2018/03/16 17:56:32 ryo Exp $ */ 2fb2c5211Sscw 3fb2c5211Sscw /* 4fb2c5211Sscw * Copyright 2003 Wasabi Systems, Inc. 5fb2c5211Sscw * All rights reserved. 6fb2c5211Sscw * 7fb2c5211Sscw * Written by Steve C. Woodford for Wasabi Systems, Inc. 8fb2c5211Sscw * 9fb2c5211Sscw * Redistribution and use in source and binary forms, with or without 10fb2c5211Sscw * modification, are permitted provided that the following conditions 11fb2c5211Sscw * are met: 12fb2c5211Sscw * 1. Redistributions of source code must retain the above copyright 13fb2c5211Sscw * notice, this list of conditions and the following disclaimer. 14fb2c5211Sscw * 2. Redistributions in binary form must reproduce the above copyright 15fb2c5211Sscw * notice, this list of conditions and the following disclaimer in the 16fb2c5211Sscw * documentation and/or other materials provided with the distribution. 17fb2c5211Sscw * 3. All advertising materials mentioning features or use of this software 18fb2c5211Sscw * must display the following acknowledgement: 19fb2c5211Sscw * This product includes software developed for the NetBSD Project by 20fb2c5211Sscw * Wasabi Systems, Inc. 21fb2c5211Sscw * 4. The name of Wasabi Systems, Inc. may not be used to endorse 22fb2c5211Sscw * or promote products derived from this software without specific prior 23fb2c5211Sscw * written permission. 24fb2c5211Sscw * 25fb2c5211Sscw * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 26fb2c5211Sscw * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27fb2c5211Sscw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28fb2c5211Sscw * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 29fb2c5211Sscw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30fb2c5211Sscw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31fb2c5211Sscw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32fb2c5211Sscw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33fb2c5211Sscw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34fb2c5211Sscw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35fb2c5211Sscw * POSSIBILITY OF SUCH DAMAGE. 36fb2c5211Sscw */ 37fb2c5211Sscw 38fb2c5211Sscw /* 39fb2c5211Sscw * Bus space tag for 8/16-bit devices on 32-bit bus. 40fb2c5211Sscw * all registers are located at the address of multiple of 4. 41fb2c5211Sscw * 42fb2c5211Sscw * Based on pxa2x0_a4x_space.c 43fb2c5211Sscw */ 44fb2c5211Sscw 45fb2c5211Sscw #include <sys/cdefs.h> 46*4a6b2ebbSryo __KERNEL_RCSID(0, "$NetBSD: ixp425_a4x_space.c,v 1.4 2018/03/16 17:56:32 ryo Exp $"); 47fb2c5211Sscw 48fb2c5211Sscw #include <sys/param.h> 49fb2c5211Sscw #include <sys/systm.h> 50fb2c5211Sscw 51fb2c5211Sscw #include <uvm/uvm_extern.h> 52fb2c5211Sscw 53af51edd2Sdyoung #include <sys/bus.h> 54fb2c5211Sscw 55fb2c5211Sscw /* Prototypes for all the bus_space structure functions */ 56fb2c5211Sscw bs_protos(ixp425); 57fb2c5211Sscw bs_protos(a4x); 58fb2c5211Sscw bs_protos(generic); 59fb2c5211Sscw bs_protos(generic_armv4); 60fb2c5211Sscw bs_protos(bs_notimpl); 61fb2c5211Sscw 62fb2c5211Sscw struct bus_space ixp425_a4x_bs_tag = { 63fb2c5211Sscw /* cookie */ 64*4a6b2ebbSryo .bs_cookie = (void *) 0, 65fb2c5211Sscw 66fb2c5211Sscw /* mapping/unmapping */ 67*4a6b2ebbSryo .bs_map = ixp425_bs_map, 68*4a6b2ebbSryo .bs_unmap = ixp425_bs_unmap, 69*4a6b2ebbSryo .bs_subregion = ixp425_bs_subregion, 70fb2c5211Sscw 71fb2c5211Sscw /* allocation/deallocation */ 72*4a6b2ebbSryo .bs_alloc = ixp425_bs_alloc, /* not implemented */ 73*4a6b2ebbSryo .bs_free = ixp425_bs_free, /* not implemented */ 74fb2c5211Sscw 75fb2c5211Sscw /* get kernel virtual address */ 76*4a6b2ebbSryo .bs_vaddr = ixp425_bs_vaddr, 77fb2c5211Sscw 78fb2c5211Sscw /* mmap */ 79*4a6b2ebbSryo .bs_mmap = bs_notimpl_bs_mmap, 80fb2c5211Sscw 81fb2c5211Sscw /* barrier */ 82*4a6b2ebbSryo .bs_barrier = ixp425_bs_barrier, 83fb2c5211Sscw 84fb2c5211Sscw /* read (single) */ 85*4a6b2ebbSryo .bs_r_1 = a4x_bs_r_1, 86*4a6b2ebbSryo .bs_r_2 = a4x_bs_r_2, 87*4a6b2ebbSryo .bs_r_4 = a4x_bs_r_4, 88*4a6b2ebbSryo .bs_r_8 = bs_notimpl_bs_r_8, 89fb2c5211Sscw 90fb2c5211Sscw /* read multiple */ 91*4a6b2ebbSryo .bs_rm_1 = a4x_bs_rm_1, 92*4a6b2ebbSryo .bs_rm_2 = a4x_bs_rm_2, 93*4a6b2ebbSryo .bs_rm_4 = bs_notimpl_bs_rm_4, 94*4a6b2ebbSryo .bs_rm_8 = bs_notimpl_bs_rm_8, 95fb2c5211Sscw 96fb2c5211Sscw /* read region */ 97*4a6b2ebbSryo .bs_rr_1 = bs_notimpl_bs_rr_1, 98*4a6b2ebbSryo .bs_rr_2 = bs_notimpl_bs_rr_2, 99*4a6b2ebbSryo .bs_rr_4 = bs_notimpl_bs_rr_4, 100*4a6b2ebbSryo .bs_rr_8 = bs_notimpl_bs_rr_8, 101fb2c5211Sscw 102fb2c5211Sscw /* write (single) */ 103*4a6b2ebbSryo .bs_w_1 = a4x_bs_w_1, 104*4a6b2ebbSryo .bs_w_2 = a4x_bs_w_2, 105*4a6b2ebbSryo .bs_w_4 = a4x_bs_w_4, 106*4a6b2ebbSryo .bs_w_8 = bs_notimpl_bs_w_8, 107fb2c5211Sscw 108fb2c5211Sscw /* write multiple */ 109*4a6b2ebbSryo .bs_wm_1 = a4x_bs_wm_1, 110*4a6b2ebbSryo .bs_wm_2 = a4x_bs_wm_2, 111*4a6b2ebbSryo .bs_wm_4 = bs_notimpl_bs_wm_4, 112*4a6b2ebbSryo .bs_wm_8 = bs_notimpl_bs_wm_8, 113fb2c5211Sscw 114fb2c5211Sscw /* write region */ 115*4a6b2ebbSryo .bs_wr_1 = bs_notimpl_bs_wr_1, 116*4a6b2ebbSryo .bs_wr_2 = bs_notimpl_bs_wr_2, 117*4a6b2ebbSryo .bs_wr_4 = bs_notimpl_bs_wr_4, 118*4a6b2ebbSryo .bs_wr_8 = bs_notimpl_bs_wr_8, 119fb2c5211Sscw 120fb2c5211Sscw /* set multiple */ 121*4a6b2ebbSryo .bs_sm_1 = bs_notimpl_bs_sm_1, 122*4a6b2ebbSryo .bs_sm_2 = bs_notimpl_bs_sm_2, 123*4a6b2ebbSryo .bs_sm_4 = bs_notimpl_bs_sm_4, 124*4a6b2ebbSryo .bs_sm_8 = bs_notimpl_bs_sm_8, 125fb2c5211Sscw 126fb2c5211Sscw /* set region */ 127*4a6b2ebbSryo .bs_sr_1 = bs_notimpl_bs_sr_1, 128*4a6b2ebbSryo .bs_sr_2 = bs_notimpl_bs_sr_2, 129*4a6b2ebbSryo .bs_sr_4 = bs_notimpl_bs_sr_4, 130*4a6b2ebbSryo .bs_sr_8 = bs_notimpl_bs_sr_8, 131fb2c5211Sscw 132fb2c5211Sscw /* copy */ 133*4a6b2ebbSryo .bs_c_1 = bs_notimpl_bs_c_1, 134*4a6b2ebbSryo .bs_c_2 = bs_notimpl_bs_c_2, 135*4a6b2ebbSryo .bs_c_4 = bs_notimpl_bs_c_4, 136*4a6b2ebbSryo .bs_c_8 = bs_notimpl_bs_c_8, 137fb2c5211Sscw }; 138