2 * File: arch/blackfin/lib/ins.S
4 * Author: Bas Vermeulen <bas@buyways.nl>
6 * Created: Tue Mar 22 15:27:24 CEST 2005
7 * Description: Implementation of ins{bwl} for BlackFin processors using zero overhead loops.
10 * Copyright 2004-2008 Analog Devices Inc.
11 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
13 * Bugs: Enter bugs at http://blackfin.uclinux.org/
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, see the file COPYING, or write
27 * to the Free Software Foundation, Inc.,
28 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
31 #include <linux/linkage.h>
32 #include <asm/blackfin.h>
37 * Reads on the Blackfin are speculative. In Blackfin terms, this means they
38 * can be interrupted at any time (even after they have been issued on to the
39 * external bus), and re-issued after the interrupt occurs.
41 * If a FIFO is sitting on the end of the read, it will see two reads,
42 * when the core only sees one. The FIFO receives the read which is cancelled,
43 * and not delivered to the core.
45 * To solve this, interrupts are turned off before reads occur to I/O space.
46 * There are 3 versions of all these functions
47 * - turns interrupts off every read (higher overhead, but lower latency)
48 * - turns interrupts off every loop (low overhead, but longer latency)
49 * - DMA version, which do not suffer from this issue. DMA versions have
50 * different name (prefixed by dma_ ), and are located in
51 * ../kernel/bfin_dma_5xx.c
52 * Using the dma related functions are recommended for transfering large
53 * buffers in/out of FIFOs.
57 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
58 P0 = R0; /* P0 = port */
60 P1 = R1; /* P1 = address */
61 P2 = R2; /* P2 = count */
63 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2;
64 .Llong_loop_s: R0 = [P0];
71 P0 = R0; /* P0 = port */
72 P1 = R1; /* P1 = address */
73 P2 = R2; /* P2 = count */
75 LSETUP( .Llong_loop_s, .Llong_loop_e) LC0 = P2;
89 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
90 P0 = R0; /* P0 = port */
92 P1 = R1; /* P1 = address */
93 P2 = R2; /* P2 = count */
95 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2;
96 .Lword_loop_s: R0 = W[P0];
103 P0 = R0; /* P0 = port */
104 P1 = R1; /* P1 = address */
105 P2 = R2; /* P2 = count */
107 LSETUP( .Lword_loop_s, .Lword_loop_e) LC0 = P2;
121 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
122 P0 = R0; /* P0 = port */
124 P1 = R1; /* P1 = address */
125 P2 = R2; /* P2 = count */
127 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
128 .Lword8_loop_s: R0 = W[P0];
137 P0 = R0; /* P0 = port */
138 P1 = R1; /* P1 = address */
139 P2 = R2; /* P2 = count */
141 LSETUP( .Lword8_loop_s, .Lword8_loop_e) LC0 = P2;
158 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
159 P0 = R0; /* P0 = port */
161 P1 = R1; /* P1 = address */
162 P2 = R2; /* P2 = count */
164 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2;
165 .Lbyte_loop_s: R0 = B[P0];
172 P0 = R0; /* P0 = port */
173 P1 = R1; /* P1 = address */
174 P2 = R2; /* P2 = count */
176 LSETUP( .Lbyte_loop_s, .Lbyte_loop_e) LC0 = P2;
190 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
191 P0 = R0; /* P0 = port */
193 P1 = R1; /* P1 = address */
194 P2 = R2; /* P2 = count */
196 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;
197 .Llong16_loop_s: R0 = [P0];
202 .Llong16_loop_e: NOP;
206 P0 = R0; /* P0 = port */
207 P1 = R1; /* P1 = address */
208 P2 = R2; /* P2 = count */
210 LSETUP( .Llong16_loop_s, .Llong16_loop_e) LC0 = P2;