mirror of
https://github.com/torvalds/linux.git
synced 2024-11-02 10:11:36 +00:00
1394f03221
This adds support for the Analog Devices Blackfin processor architecture, and currently supports the BF533, BF532, BF531, BF537, BF536, BF534, and BF561 (Dual Core) devices, with a variety of development platforms including those avaliable from Analog Devices (BF533-EZKit, BF533-STAMP, BF537-STAMP, BF561-EZKIT), and Bluetechnix! Tinyboards. The Blackfin architecture was jointly developed by Intel and Analog Devices Inc. (ADI) as the Micro Signal Architecture (MSA) core and introduced it in December of 2000. Since then ADI has put this core into its Blackfin processor family of devices. The Blackfin core has the advantages of a clean, orthogonal,RISC-like microprocessor instruction set. It combines a dual-MAC (Multiply/Accumulate), state-of-the-art signal processing engine and single-instruction, multiple-data (SIMD) multimedia capabilities into a single instruction-set architecture. The Blackfin architecture, including the instruction set, is described by the ADSP-BF53x/BF56x Blackfin Processor Programming Reference http://blackfin.uclinux.org/gf/download/frsrelease/29/2549/Blackfin_PRM.pdf The Blackfin processor is already supported by major releases of gcc, and there are binary and source rpms/tarballs for many architectures at: http://blackfin.uclinux.org/gf/project/toolchain/frs There is complete documentation, including "getting started" guides available at: http://docs.blackfin.uclinux.org/ which provides links to the sources and patches you will need in order to set up a cross-compiling environment for bfin-linux-uclibc This patch, as well as the other patches (toolchain, distribution, uClibc) are actively supported by Analog Devices Inc, at: http://blackfin.uclinux.org/ We have tested this on LTP, and our test plan (including pass/fails) can be found at: http://docs.blackfin.uclinux.org/doku.php?id=testing_the_linux_kernel [m.kozlowski@tuxland.pl: balance parenthesis in blackfin header files] Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl> Signed-off-by: Aubrey Li <aubrey.li@analog.com> Signed-off-by: Jie Zhang <jie.zhang@analog.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
254 lines
5.1 KiB
ArmAsm
254 lines
5.1 KiB
ArmAsm
/*
|
|
* File: arch/blackfin/mach-common/cache.S
|
|
* Based on:
|
|
* Author: LG Soft India
|
|
*
|
|
* Created:
|
|
* Description: cache control support
|
|
*
|
|
* Modified:
|
|
* Copyright 2004-2006 Analog Devices Inc.
|
|
*
|
|
* Bugs: Enter bugs at http://blackfin.uclinux.org/
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see the file COPYING, or write
|
|
* to the Free Software Foundation, Inc.,
|
|
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <linux/linkage.h>
|
|
#include <asm/cplb.h>
|
|
#include <asm/entry.h>
|
|
#include <asm/blackfin.h>
|
|
#include <asm/cache.h>
|
|
|
|
.text
|
|
.align 2
|
|
ENTRY(_cache_invalidate)
|
|
|
|
/*
|
|
* Icache or DcacheA or DcacheB Invalidation
|
|
* or any combination thereof
|
|
* R0 has bits
|
|
* CPLB_ENABLE_ICACHE_P,CPLB_ENABLE_DCACHE_P,CPLB_ENABLE_DCACHE2_P
|
|
* set as required
|
|
*/
|
|
[--SP] = R7;
|
|
|
|
R7 = R0;
|
|
CC = BITTST(R7,CPLB_ENABLE_ICACHE_P);
|
|
IF !CC JUMP .Lno_icache;
|
|
[--SP] = RETS;
|
|
CALL _icache_invalidate;
|
|
RETS = [SP++];
|
|
.Lno_icache:
|
|
CC = BITTST(R7,CPLB_ENABLE_DCACHE_P);
|
|
IF !CC JUMP .Lno_dcache_a;
|
|
R0 = 0; /* specifies bank A */
|
|
[--SP] = RETS;
|
|
CALL _dcache_invalidate;
|
|
RETS = [SP++];
|
|
.Lno_dcache_a:
|
|
CC = BITTST(R7,CPLB_ENABLE_DCACHE2_P);
|
|
IF !CC JUMP .Lno_dcache_b;
|
|
R0 = 0;
|
|
BITSET(R0, 23); /* specifies bank B */
|
|
[--SP] = RETS;
|
|
CALL _dcache_invalidate;
|
|
RETS = [SP++];
|
|
.Lno_dcache_b:
|
|
R7 = [SP++];
|
|
RTS;
|
|
|
|
/* Invalidate the Entire Instruction cache by
|
|
* disabling IMC bit
|
|
*/
|
|
ENTRY(_icache_invalidate)
|
|
ENTRY(_invalidate_entire_icache)
|
|
[--SP] = ( R7:5);
|
|
|
|
P0.L = (IMEM_CONTROL & 0xFFFF);
|
|
P0.H = (IMEM_CONTROL >> 16);
|
|
R7 = [P0];
|
|
|
|
/* Clear the IMC bit , All valid bits in the instruction
|
|
* cache are set to the invalid state
|
|
*/
|
|
BITCLR(R7,IMC_P);
|
|
CLI R6;
|
|
SSYNC; /* SSYNC required before invalidating cache. */
|
|
.align 8;
|
|
[P0] = R7;
|
|
SSYNC;
|
|
STI R6;
|
|
|
|
/* Configures the instruction cache agian */
|
|
R6 = (IMC | ENICPLB);
|
|
R7 = R7 | R6;
|
|
|
|
CLI R6;
|
|
SSYNC; /* SSYNC required before writing to IMEM_CONTROL. */
|
|
.align 8;
|
|
[P0] = R7;
|
|
SSYNC;
|
|
STI R6;
|
|
|
|
( R7:5) = [SP++];
|
|
RTS;
|
|
|
|
/*
|
|
* blackfin_cache_flush_range(start, end)
|
|
* Invalidate all cache lines assocoiated with this
|
|
* area of memory.
|
|
*
|
|
* start: Start address
|
|
* end: End address
|
|
*/
|
|
ENTRY(_blackfin_icache_flush_range)
|
|
R2 = -L1_CACHE_BYTES;
|
|
R2 = R0 & R2;
|
|
P0 = R2;
|
|
P1 = R1;
|
|
CSYNC;
|
|
IFLUSH [P0];
|
|
1:
|
|
IFLUSH [P0++];
|
|
CC = P0 < P1 (iu);
|
|
IF CC JUMP 1b (bp);
|
|
IFLUSH [P0];
|
|
SSYNC;
|
|
RTS;
|
|
|
|
/*
|
|
* blackfin_icache_dcache_flush_range(start, end)
|
|
* FLUSH all cache lines assocoiated with this
|
|
* area of memory.
|
|
*
|
|
* start: Start address
|
|
* end: End address
|
|
*/
|
|
|
|
ENTRY(_blackfin_icache_dcache_flush_range)
|
|
R2 = -L1_CACHE_BYTES;
|
|
R2 = R0 & R2;
|
|
P0 = R2;
|
|
P1 = R1;
|
|
CSYNC;
|
|
IFLUSH [P0];
|
|
1:
|
|
FLUSH [P0];
|
|
IFLUSH [P0++];
|
|
CC = P0 < P1 (iu);
|
|
IF CC JUMP 1b (bp);
|
|
IFLUSH [P0];
|
|
FLUSH [P0];
|
|
SSYNC;
|
|
RTS;
|
|
|
|
/* Throw away all D-cached data in specified region without any obligation to
|
|
* write them back. However, we must clean the D-cached entries around the
|
|
* boundaries of the start and/or end address is not cache aligned.
|
|
*
|
|
* Start: start address,
|
|
* end : end address.
|
|
*/
|
|
|
|
ENTRY(_blackfin_dcache_invalidate_range)
|
|
R2 = -L1_CACHE_BYTES;
|
|
R2 = R0 & R2;
|
|
P0 = R2;
|
|
P1 = R1;
|
|
CSYNC;
|
|
FLUSHINV[P0];
|
|
1:
|
|
FLUSHINV[P0++];
|
|
CC = P0 < P1 (iu);
|
|
IF CC JUMP 1b (bp);
|
|
|
|
/* If the data crosses a cache line, then we'll be pointing to
|
|
* the last cache line, but won't have flushed/invalidated it yet,
|
|
* so do one more.
|
|
*/
|
|
FLUSHINV[P0];
|
|
SSYNC;
|
|
RTS;
|
|
|
|
/* Invalidate the Entire Data cache by
|
|
* clearing DMC[1:0] bits
|
|
*/
|
|
ENTRY(_invalidate_entire_dcache)
|
|
ENTRY(_dcache_invalidate)
|
|
[--SP] = ( R7:6);
|
|
|
|
P0.L = (DMEM_CONTROL & 0xFFFF);
|
|
P0.H = (DMEM_CONTROL >> 16);
|
|
R7 = [P0];
|
|
|
|
/* Clear the DMC[1:0] bits, All valid bits in the data
|
|
* cache are set to the invalid state
|
|
*/
|
|
BITCLR(R7,DMC0_P);
|
|
BITCLR(R7,DMC1_P);
|
|
CLI R6;
|
|
SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
|
|
.align 8;
|
|
[P0] = R7;
|
|
SSYNC;
|
|
STI R6;
|
|
|
|
/* Configures the data cache again */
|
|
|
|
R6 = DMEM_CNTR;
|
|
R7 = R7 | R6;
|
|
|
|
CLI R6;
|
|
SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */
|
|
.align 8;
|
|
[P0] = R7;
|
|
SSYNC;
|
|
STI R6;
|
|
|
|
( R7:6) = [SP++];
|
|
RTS;
|
|
|
|
ENTRY(_blackfin_dcache_flush_range)
|
|
R2 = -L1_CACHE_BYTES;
|
|
R2 = R0 & R2;
|
|
P0 = R2;
|
|
P1 = R1;
|
|
CSYNC;
|
|
FLUSH[P0];
|
|
1:
|
|
FLUSH[P0++];
|
|
CC = P0 < P1 (iu);
|
|
IF CC JUMP 1b (bp);
|
|
|
|
/* If the data crosses a cache line, then we'll be pointing to
|
|
* the last cache line, but won't have flushed it yet, so do
|
|
* one more.
|
|
*/
|
|
FLUSH[P0];
|
|
SSYNC;
|
|
RTS;
|
|
|
|
ENTRY(_blackfin_dflush_page)
|
|
P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT);
|
|
P0 = R0;
|
|
CSYNC;
|
|
FLUSH[P0];
|
|
LSETUP (.Lfl1, .Lfl1) LC0 = P1;
|
|
.Lfl1: FLUSH [P0++];
|
|
SSYNC;
|
|
RTS;
|