2009-05-16 04:51:14 -06:00
|
|
|
/*
|
|
|
|
* linux/arch/arm/kernel/smp_scu.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2002 ARM Ltd.
|
|
|
|
* All Rights Reserved
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*/
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/io.h>
|
|
|
|
|
|
|
|
#include <asm/smp_scu.h>
|
2009-05-18 09:26:27 -06:00
|
|
|
#include <asm/cacheflush.h>
|
2009-05-16 04:51:14 -06:00
|
|
|
|
|
|
|
#define SCU_CTRL 0x00
|
|
|
|
#define SCU_CONFIG 0x04
|
|
|
|
#define SCU_CPU_STATUS 0x08
|
|
|
|
#define SCU_INVALIDATE 0x0c
|
|
|
|
#define SCU_FPGA_REVISION 0x10
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the number of CPU cores from the SCU configuration
|
|
|
|
*/
|
|
|
|
unsigned int __init scu_get_core_count(void __iomem *scu_base)
|
|
|
|
{
|
|
|
|
unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG);
|
|
|
|
return (ncores & 0x03) + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Enable the SCU
|
|
|
|
*/
|
|
|
|
void __init scu_enable(void __iomem *scu_base)
|
|
|
|
{
|
|
|
|
u32 scu_ctrl;
|
|
|
|
|
|
|
|
scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
|
|
|
|
scu_ctrl |= 1;
|
|
|
|
__raw_writel(scu_ctrl, scu_base + SCU_CTRL);
|
2009-05-18 09:26:27 -06:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure that the data accessed by CPU0 before the SCU was
|
|
|
|
* initialised is visible to the other CPUs.
|
|
|
|
*/
|
|
|
|
flush_cache_all();
|
2009-05-16 04:51:14 -06:00
|
|
|
}
|