genode/repos/base-hw/src/core/include/spec/cortex_a9/scu.h
Johannes Schlatow 3df03fbc41 base-hw: fix SCU initialization for zynq-based boards
The old implementation cleared all other bits in the SCU control
register when enabling the SCU, which broke the kernel startup on zynq-
based boards.
By only raising the enable bit, we can keep the initial/default state
e.g. as set up by uboot.

Fixes #1953
2016-05-23 15:49:56 +02:00

72 lines
1.3 KiB
C++

/*
* \brief Snoop control unit
* \author Martin Stein
* \author Stefan Kalkowski
* \date 2015-12-15
*/
/*
* Copyright (C) 2015-2016 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
/* Genode includes */
#include <util/mmio.h>
/* local includes */
#include <board.h>
namespace Genode {
class Scu;
}
class Genode::Scu : Genode::Mmio
{
private:
struct Cr : Register<0x0, 32>
{
struct Enable : Bitfield<0, 1> { };
};
struct Dcr : Register<0x30, 32>
{
struct Bit_0 : Bitfield<0, 1> { };
};
struct Iassr : Register<0xc, 32>
{
struct Cpu0_way : Bitfield<0, 4> { };
struct Cpu1_way : Bitfield<4, 4> { };
struct Cpu2_way : Bitfield<8, 4> { };
struct Cpu3_way : Bitfield<12, 4> { };
};
Board &_board;
public:
Scu(Board & board) : Mmio(Board::SCU_MMIO_BASE), _board(board) { }
void invalidate()
{
Iassr::access_t iassr = 0;
for (Iassr::access_t way = 0; way <= Iassr::Cpu0_way::mask();
way++) {
Iassr::Cpu0_way::set(iassr, way);
Iassr::Cpu1_way::set(iassr, way);
Iassr::Cpu2_way::set(iassr, way);
Iassr::Cpu3_way::set(iassr, way);
write<Iassr>(iassr);
}
}
void enable()
{
if (_board.errata(Board::ARM_764369)) write<Dcr::Bit_0>(1);
write<Cr::Enable>(1);
}
};