2007-04-13 20:55:48 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 by Alan Korr
|
2007-04-14 01:18:06 +00:00
|
|
|
* Copyright (C) 2007 by Michael Sevakis
|
2007-04-13 20:55:48 +00:00
|
|
|
*
|
|
|
|
* All files in this archive are subject to the GNU General Public License.
|
|
|
|
* See the file COPYING in the source tree root for full license agreement.
|
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
#ifndef SYSTEM_TARGET_H
|
|
|
|
#define SYSTEM_TARGET_H
|
|
|
|
|
2007-04-14 01:18:06 +00:00
|
|
|
#include "system-arm.h"
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-09-20 08:01:56 +00:00
|
|
|
#ifdef CPU_PP
|
2007-07-26 15:07:16 +00:00
|
|
|
/* TODO: This header is actually portalplayer specific, and should be
|
|
|
|
* moved into an appropriate subdir (or even split in 2). */
|
|
|
|
|
|
|
|
#if CONFIG_CPU == PP5002
|
2007-07-31 10:56:50 +00:00
|
|
|
#define CPUFREQ_SLEEP 32768
|
2007-07-26 15:07:16 +00:00
|
|
|
#define CPUFREQ_DEFAULT 24000000
|
2007-07-31 10:56:50 +00:00
|
|
|
#define CPUFREQ_NORMAL 30000000
|
|
|
|
#define CPUFREQ_MAX 80000000
|
2007-07-26 15:07:16 +00:00
|
|
|
|
|
|
|
#else /* PP5022, PP5024 */
|
2007-07-31 20:48:49 +00:00
|
|
|
#define CPUFREQ_SLEEP 32768
|
2007-07-26 15:07:16 +00:00
|
|
|
#define CPUFREQ_DEFAULT 24000000
|
2007-07-31 10:56:50 +00:00
|
|
|
#define CPUFREQ_NORMAL 30000000
|
|
|
|
#define CPUFREQ_MAX 80000000
|
2007-07-26 15:07:16 +00:00
|
|
|
#endif
|
|
|
|
|
2007-04-14 01:18:06 +00:00
|
|
|
#define inl(a) (*(volatile unsigned long *) (a))
|
|
|
|
#define outl(a,b) (*(volatile unsigned long *) (b) = (a))
|
|
|
|
#define inb(a) (*(volatile unsigned char *) (a))
|
|
|
|
#define outb(a,b) (*(volatile unsigned char *) (b) = (a))
|
|
|
|
#define inw(a) (*(volatile unsigned short *) (a))
|
|
|
|
#define outw(a,b) (*(volatile unsigned short *) (b) = (a))
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-04-14 01:18:06 +00:00
|
|
|
static inline void udelay(unsigned usecs)
|
2007-04-13 20:55:48 +00:00
|
|
|
{
|
2007-04-14 01:18:06 +00:00
|
|
|
unsigned stop = USEC_TIMER + usecs;
|
|
|
|
while (TIME_BEFORE(USEC_TIMER, stop));
|
2007-04-13 20:55:48 +00:00
|
|
|
}
|
|
|
|
|
2007-04-14 11:15:43 +00:00
|
|
|
static inline unsigned int current_core(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* PROCESSOR_ID seems to be 32-bits:
|
|
|
|
* CPU = 0x55555555 = |01010101|01010101|01010101|01010101|
|
|
|
|
* COP = 0xaaaaaaaa = |10101010|10101010|10101010|10101010|
|
|
|
|
* ^
|
|
|
|
*/
|
|
|
|
unsigned int core;
|
|
|
|
asm volatile (
|
2007-09-29 06:17:33 +00:00
|
|
|
"ldrb %0, [%1] \n" /* Just load the LSB */
|
|
|
|
"mov %0, %0, lsr #7 \n" /* Bit 7 => index */
|
|
|
|
: "=r"(core) /* CPU=0, COP=1 */
|
|
|
|
: "r"(&PROCESSOR_ID)
|
2007-04-14 11:15:43 +00:00
|
|
|
);
|
|
|
|
return core;
|
|
|
|
}
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-09-29 06:17:33 +00:00
|
|
|
#ifdef CPU_PP502x
|
|
|
|
|
2007-09-28 10:54:27 +00:00
|
|
|
#ifndef BOOTLOADER
|
2007-09-28 10:20:02 +00:00
|
|
|
#define CACHE_FUNCTIONS_AS_CALL
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-04-14 01:18:06 +00:00
|
|
|
#define HAVE_INVALIDATE_ICACHE
|
2007-09-28 10:20:02 +00:00
|
|
|
void invalidate_icache(void);
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-04-14 01:18:06 +00:00
|
|
|
#define HAVE_FLUSH_ICACHE
|
2007-09-28 10:20:02 +00:00
|
|
|
void flush_icache(void);
|
2007-09-28 10:54:27 +00:00
|
|
|
#endif
|
2007-04-13 20:55:48 +00:00
|
|
|
|
2007-09-28 10:20:02 +00:00
|
|
|
#endif /* CPU_PP502x */
|
2007-09-20 08:01:56 +00:00
|
|
|
|
2007-09-28 10:20:02 +00:00
|
|
|
|
|
|
|
#endif /* CPU_PP */
|
2007-04-13 20:55:48 +00:00
|
|
|
|
|
|
|
#endif /* SYSTEM_TARGET_H */
|