1/* $NetBSD: ixp425_a4x_io.S,v 1.2 2005/12/11 12:16:51 christos Exp $ */ 2 3/* 4 * Copyright 2003 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Steve C. Woodford for Wasabi Systems, Inc. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 1. Redistributions of source code must retain the above copyright 13 * notice, this list of conditions and the following disclaimer. 14 * 2. Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in the 16 * documentation and/or other materials provided with the distribution. 17 * 3. All advertising materials mentioning features or use of this software 18 * must display the following acknowledgement: 19 * This product includes software developed for the NetBSD Project by 20 * Wasabi Systems, Inc. 21 * 4. The name of Wasabi Systems, Inc. may not be used to endorse 22 * or promote products derived from this software without specific prior 23 * written permission. 24 * 25 * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND 26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 27 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 28 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 29 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38/* 39 * There are simple bus space functions for IO registers mapped at 40 * 32-bit aligned positions. offset is multiplied by 4. 41 * 42 * Based loosely on pxa2x0_a2x_io.S 43 */ 44 45#include <machine/asm.h> 46 47/* 48 * bus_space I/O functions with offset*4 49 */ 50 51/* 52 * Read single 53 */ 54ENTRY(a4x_bs_r_1) 55 ldr r0, [r1, r2, LSL #2] 56 and r0, r0, #0xff 57 mov pc, lr 58 59ENTRY(a4x_bs_r_2) 60 ldr r0, [r1, r2, LSL #2] 61 mov r1, #0xff 62 orr r1, r1, r1, lsl #8 63 and r0, r0, r1 64 mov pc, lr 65 66ENTRY(a4x_bs_r_4) 67 ldr r0, [r1, r2, LSL #2] 68 mov pc, lr 69 70/* 71 * Write single 72 */ 73ENTRY(a4x_bs_w_1) 74 and r3, r3, #0xff 75 str r3, [r1, r2, LSL #2] 76 mov pc, lr 77 78ENTRY(a4x_bs_w_2) 79 mov r0, #0xff 80 orr r0, r0, r0, lsl #8 81 and r3, r3, r0 82 str r3, [r1, r2, LSL #2] 83 mov pc, lr 84 85ENTRY(a4x_bs_w_4) 86 str r3, [r1, r2, LSL #2] 87 mov pc, lr 88 89/* 90 * Read multiple 91 */ 92ENTRY(a4x_bs_rm_1) 93 add r0, r1, r2, lsl #2 94 ldr r2, [sp, #0] 95 mov r1, r3 96 teq r2, #0 97 moveq pc, lr 981: ldr r3, [r0] 99 subs r2, r2, #1 100 strb r3, [r1], #1 101 bne 1b 102 mov pc, lr 103 104ENTRY(a4x_bs_rm_2) 105 add r0, r1, r2, lsl #2 106 ldr r2, [sp, #0] 107 mov r1, r3 108 teq r2, #0 109 moveq pc, lr 1101: ldr r3, [r0] 111 subs r2, r2, #1 112 strh r3, [r1], #2 113 bne 1b 114 mov pc, lr 115 116/* 117 * Write multiple 118 */ 119ENTRY(a4x_bs_wm_1) 120 add r0, r1, r2, lsl #2 121 ldr r2, [sp, #0] 122 mov r1, r3 123 teq r2, #0 124 moveq pc, lr 1251: ldrb r3, [r1], #1 126 subs r2, r2, #1 127 str r3, [r0] 128 bne 1b 129 mov pc, lr 130 131ENTRY(a4x_bs_wm_2) 132 add r0, r1, r2, lsl #2 133 ldr r2, [sp, #0] 134 mov r1, r3 135 teq r2, #0 136 moveq pc, lr 1371: ldrh r3, [r1], #2 138 subs r2, r2, #1 139 str r3, [r0] 140 bne 1b 141 mov pc, lr 142