blackfin architecture
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>
2007-05-06 17:50:22 -04:00
|
|
|
/*
|
|
|
|
* File: arch/blackfin/oprofile/op_model_bf533.c
|
|
|
|
* Based on:
|
|
|
|
* Author: Anton Blanchard <anton@au.ibm.com>
|
|
|
|
*
|
|
|
|
* Created:
|
|
|
|
* Description:
|
|
|
|
*
|
|
|
|
* Modified:
|
|
|
|
* Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
|
|
|
|
* 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/oprofile.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/smp.h>
|
|
|
|
#include <linux/interrupt.h>
|
2007-07-12 10:58:21 -04:00
|
|
|
#include <linux/ptrace.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/io.h>
|
blackfin architecture
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>
2007-05-06 17:50:22 -04:00
|
|
|
#include <asm/system.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/blackfin.h>
|
|
|
|
|
|
|
|
#include "op_blackfin.h"
|
|
|
|
|
|
|
|
#define PM_ENABLE 0x01;
|
|
|
|
#define PM_CTL1_ENABLE 0x18
|
|
|
|
#define PM_CTL0_ENABLE 0xC000
|
|
|
|
#define COUNT_EDGE_ONLY 0x3000000
|
|
|
|
|
|
|
|
static int oprofile_running;
|
|
|
|
|
|
|
|
static unsigned curr_pfctl, curr_count[2];
|
|
|
|
|
|
|
|
static int bfin533_reg_setup(struct op_counter_config *ctr)
|
|
|
|
{
|
|
|
|
unsigned int pfctl = ctr_read();
|
|
|
|
unsigned int count[2];
|
|
|
|
|
|
|
|
/* set Blackfin perf monitor regs with ctr */
|
|
|
|
if (ctr[0].enabled) {
|
|
|
|
pfctl |= (PM_CTL0_ENABLE | ((char)ctr[0].event << 5));
|
|
|
|
count[0] = 0xFFFFFFFF - ctr[0].count;
|
|
|
|
curr_count[0] = count[0];
|
|
|
|
}
|
|
|
|
if (ctr[1].enabled) {
|
|
|
|
pfctl |= (PM_CTL1_ENABLE | ((char)ctr[1].event << 16));
|
|
|
|
count[1] = 0xFFFFFFFF - ctr[1].count;
|
|
|
|
curr_count[1] = count[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
pr_debug("ctr[0].enabled=%d,ctr[1].enabled=%d,ctr[0].event<<5=0x%x,ctr[1].event<<16=0x%x\n", ctr[0].enabled, ctr[1].enabled, ctr[0].event << 5, ctr[1].event << 16);
|
|
|
|
pfctl |= COUNT_EDGE_ONLY;
|
|
|
|
curr_pfctl = pfctl;
|
|
|
|
|
|
|
|
pr_debug("write 0x%x to pfctl\n", pfctl);
|
|
|
|
ctr_write(pfctl);
|
|
|
|
count_write(count);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int bfin533_start(struct op_counter_config *ctr)
|
|
|
|
{
|
|
|
|
unsigned int pfctl = ctr_read();
|
|
|
|
|
|
|
|
pfctl |= PM_ENABLE;
|
|
|
|
curr_pfctl = pfctl;
|
|
|
|
|
|
|
|
ctr_write(pfctl);
|
|
|
|
|
|
|
|
oprofile_running = 1;
|
|
|
|
pr_debug("start oprofile counter \n");
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void bfin533_stop(void)
|
|
|
|
{
|
|
|
|
int pfctl;
|
|
|
|
|
|
|
|
pfctl = ctr_read();
|
|
|
|
pfctl &= ~PM_ENABLE;
|
|
|
|
/* freeze counters */
|
|
|
|
ctr_write(pfctl);
|
|
|
|
|
|
|
|
oprofile_running = 0;
|
|
|
|
pr_debug("stop oprofile counter \n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static int get_kernel(void)
|
|
|
|
{
|
|
|
|
int ipend, is_kernel;
|
|
|
|
|
|
|
|
ipend = bfin_read_IPEND();
|
|
|
|
|
|
|
|
/* test bit 15 */
|
|
|
|
is_kernel = ((ipend & 0x8000) != 0);
|
|
|
|
|
|
|
|
return is_kernel;
|
|
|
|
}
|
|
|
|
|
|
|
|
int pm_overflow_handler(int irq, struct pt_regs *regs)
|
|
|
|
{
|
|
|
|
int is_kernel;
|
|
|
|
int i, cpu;
|
|
|
|
unsigned int pc, pfctl;
|
|
|
|
unsigned int count[2];
|
|
|
|
|
2008-04-22 21:39:01 -04:00
|
|
|
pr_debug("get interrupt in %s\n", __func__);
|
blackfin architecture
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>
2007-05-06 17:50:22 -04:00
|
|
|
if (oprofile_running == 0) {
|
|
|
|
pr_debug("error: entering interrupt when oprofile is stopped.\n\r");
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
is_kernel = get_kernel();
|
|
|
|
cpu = smp_processor_id();
|
|
|
|
pc = regs->pc;
|
|
|
|
pfctl = ctr_read();
|
|
|
|
|
|
|
|
/* read the two event counter regs */
|
|
|
|
count_read(count);
|
|
|
|
|
|
|
|
/* if the counter overflows, add sample to oprofile buffer */
|
|
|
|
for (i = 0; i < 2; ++i) {
|
|
|
|
if (oprofile_running) {
|
|
|
|
oprofile_add_sample(regs, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* reset the perfmon counter */
|
|
|
|
ctr_write(curr_pfctl);
|
|
|
|
count_write(curr_count);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct op_bfin533_model op_model_bfin533 = {
|
|
|
|
.reg_setup = bfin533_reg_setup,
|
|
|
|
.start = bfin533_start,
|
|
|
|
.stop = bfin533_stop,
|
|
|
|
.num_counters = 2,
|
|
|
|
.name = "blackfin/bf533"
|
|
|
|
};
|