2 * arch/blackfin/lib/ins.S - ins{bwl} using hardware loops
4 * Copyright 2004-2008 Analog Devices Inc.
5 * Copyright (C) 2005 Bas Vermeulen, BuyWays BV <bas@buyways.nl>
6 * Licensed under the GPL-2 or later.
9 #include <asm/blackfin.h>
18 call ___ipipe_disable_root_irqs_hw; \
21 # define CLI_INNER_NOP
23 # define DO_CLI cli R3;
24 # define CLI_INNER_NOP nop; nop; nop;
30 call ___ipipe_enable_root_irqs_hw; \
34 # define DO_STI 2: sti R3;
37 #ifdef CONFIG_BFIN_INS_LOWOVERHEAD
38 # define CLI_OUTER DO_CLI;
39 # define STI_OUTER DO_STI;
42 # define STI_INNER nop; 2: nop;
49 # define CLI_INNER 1: DO_CLI; CLI_INNER_NOP;
50 # define STI_INNER DO_STI;
54 * Reads on the Blackfin are speculative. In Blackfin terms, this means they
55 * can be interrupted at any time (even after they have been issued on to the
56 * external bus), and re-issued after the interrupt occurs.
58 * If a FIFO is sitting on the end of the read, it will see two reads,
59 * when the core only sees one. The FIFO receives the read which is cancelled,
60 * and not delivered to the core.
62 * To solve this, interrupts are turned off before reads occur to I/O space.
63 * There are 3 versions of all these functions
64 * - turns interrupts off every read (higher overhead, but lower latency)
65 * - turns interrupts off every loop (low overhead, but longer latency)
66 * - DMA version, which do not suffer from this issue. DMA versions have
67 * different name (prefixed by dma_ ), and are located in
68 * ../kernel/bfin_dma_5xx.c
69 * Using the dma related functions are recommended for transfering large
70 * buffers in/out of FIFOs.
73 #define COMMON_INS(func, ops) \
74 .section .text._ins##func; \
76 P0 = R0; /* P0 = port */ \
77 CLI_OUTER; /* 3 instructions before first read access */ \
78 P1 = R1; /* P1 = address */ \
79 P2 = R2; /* P2 = count */ \
82 LSETUP(1f, 2f) LC0 = P2; \