platform/u-boot: Make bcm2708 mailbox code functional
* Functional == compiles. Needs tested :-)
This commit is contained in:
parent
5906dbb4d4
commit
5eeb4163fa
@ -37,8 +37,8 @@ BootMergeObject boot_arch_$(TARGET_KERNEL_ARCH).o :
|
|||||||
arch_framebuffer_bcm2708.cpp
|
arch_framebuffer_bcm2708.cpp
|
||||||
arch_framebuffer_pxa.cpp
|
arch_framebuffer_pxa.cpp
|
||||||
arch_framebuffer_omap3.cpp
|
arch_framebuffer_omap3.cpp
|
||||||
arch_cpu.cpp
|
|
||||||
arch_mailbox_bcm2708.cpp
|
arch_mailbox_bcm2708.cpp
|
||||||
|
arch_cpu.cpp
|
||||||
arch_mmu.cpp
|
arch_mmu.cpp
|
||||||
arch_start_kernel.S
|
arch_start_kernel.S
|
||||||
|
|
||||||
|
@ -109,14 +109,14 @@ check_cpu_features()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
extern "C" void
|
||||||
arch_cpu_memory_read_barrier(void)
|
arch_cpu_memory_read_barrier(void)
|
||||||
{
|
{
|
||||||
asm volatile ("" : : : "memory");
|
asm volatile ("" : : : "memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
extern "C" void
|
||||||
arch_cpu_memory_write_barrier(void)
|
arch_cpu_memory_write_barrier(void)
|
||||||
{
|
{
|
||||||
asm volatile ("" : : : "memory");
|
asm volatile ("" : : : "memory");
|
||||||
|
@ -11,38 +11,10 @@
|
|||||||
|
|
||||||
#include "arch_mailbox.h"
|
#include "arch_mailbox.h"
|
||||||
|
|
||||||
#include <arch_cpu.h>
|
#include "arch_cpu.h"
|
||||||
|
|
||||||
#include "bcm2708.h"
|
#include "bcm2708.h"
|
||||||
|
|
||||||
|
|
||||||
//extern addr_t gPeripheralBase;
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//static inline addr_t
|
|
||||||
//convert_mailbox_reg(addr_t reg)
|
|
||||||
//{
|
|
||||||
// return gPeripheralBase + ARM_CTRL_0_MAILBOX_BASE + reg;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//static inline void
|
|
||||||
//write_mailbox_reg(addr_t reg, uint32 value)
|
|
||||||
//{
|
|
||||||
// arch_cpu_memory_write_barrier();
|
|
||||||
// *(volatile uint32*)convert_mailbox_reg(reg) = value;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//static inline uint32
|
|
||||||
//read_mailbox_reg(addr_t reg)
|
|
||||||
//{
|
|
||||||
// uint32 result = *(volatile uint32*)convert_mailbox_reg(reg);
|
|
||||||
// arch_cpu_memory_read_barrier();
|
|
||||||
// return result;
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
class ArchMailboxArmBCM2708 : public ArchMailbox {
|
class ArchMailboxArmBCM2708 : public ArchMailbox {
|
||||||
public:
|
public:
|
||||||
ArchMailboxArmBCM2708(addr_t base)
|
ArchMailboxArmBCM2708(addr_t base)
|
||||||
@ -52,6 +24,10 @@ public:
|
|||||||
|
|
||||||
virtual status_t Write(uint8 channel, uint32 value);
|
virtual status_t Write(uint8 channel, uint32 value);
|
||||||
virtual status_t Read(uint8 channel, uint32& value);
|
virtual status_t Read(uint8 channel, uint32& value);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void RegisterWrite(addr_t reg, uint32 value);
|
||||||
|
uint32 RegisterRead(addr_t reg);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -66,11 +42,11 @@ status_t
|
|||||||
ArchMailboxArmBCM2708::Write(uint8 channel, uint32 value)
|
ArchMailboxArmBCM2708::Write(uint8 channel, uint32 value)
|
||||||
{
|
{
|
||||||
// We have to wait for the mailbox to drain if it is marked full.
|
// We have to wait for the mailbox to drain if it is marked full.
|
||||||
//while ((read_mailbox_reg(ARM_MAILBOX_STATUS) & ARM_MAILBOX_FULL) != 0)
|
while ((RegisterRead(ARM_MAILBOX_STATUS) & ARM_MAILBOX_FULL) != 0)
|
||||||
// ;
|
;
|
||||||
|
|
||||||
//value &= ARM_MAILBOX_DATA_MASK;
|
value &= ARM_MAILBOX_DATA_MASK;
|
||||||
//write_mailbox_reg(ARM_MAILBOX_WRITE, value | channel);
|
RegisterWrite(ARM_MAILBOX_WRITE, value | channel);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,20 +54,37 @@ ArchMailboxArmBCM2708::Write(uint8 channel, uint32 value)
|
|||||||
status_t
|
status_t
|
||||||
ArchMailboxArmBCM2708::Read(uint8 channel, uint32& value)
|
ArchMailboxArmBCM2708::Read(uint8 channel, uint32& value)
|
||||||
{
|
{
|
||||||
//while (true) {
|
while (true) {
|
||||||
// // Wait for something to arrive in the mailbox.
|
// Wait for something to arrive in the mailbox.
|
||||||
// if ((read_mailbox_reg(ARM_MAILBOX_STATUS) & ARM_MAILBOX_EMPTY) != 0)
|
if ((RegisterRead(ARM_MAILBOX_STATUS) & ARM_MAILBOX_EMPTY) != 0)
|
||||||
// continue;
|
continue;
|
||||||
|
|
||||||
// value = read_mailbox_reg(ARM_MAILBOX_READ);
|
value = RegisterRead(ARM_MAILBOX_READ);
|
||||||
// if ((value & ARM_MAILBOX_CHANNEL_MASK) != channel) {
|
if ((value & ARM_MAILBOX_CHANNEL_MASK) != channel) {
|
||||||
// // Not for us, retry.
|
// Not for us, retry.
|
||||||
// continue;
|
continue;
|
||||||
// }
|
}
|
||||||
|
|
||||||
// break;
|
break;
|
||||||
//}
|
}
|
||||||
|
|
||||||
//value &= ARM_MAILBOX_DATA_MASK;
|
value &= ARM_MAILBOX_DATA_MASK;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
uint32
|
||||||
|
ArchMailboxArmBCM2708::RegisterRead(addr_t reg)
|
||||||
|
{
|
||||||
|
uint32 result = *(volatile uint32*)(fBase + ARM_CTRL_0_MAILBOX_BASE + reg);
|
||||||
|
arch_cpu_memory_read_barrier();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ArchMailboxArmBCM2708::RegisterWrite(addr_t reg, uint32 value)
|
||||||
|
{
|
||||||
|
arch_cpu_memory_write_barrier();
|
||||||
|
*(volatile uint32*)(fBase + ARM_CTRL_0_MAILBOX_BASE + reg) = value;
|
||||||
|
}
|
||||||
|
@ -20,8 +20,7 @@ arch_mailbox_init()
|
|||||||
{
|
{
|
||||||
#if defined(BOARD_CPU_BCM2708)
|
#if defined(BOARD_CPU_BCM2708)
|
||||||
extern ArchMailbox *arch_get_mailbox_arm_bcm2708(addr_t base);
|
extern ArchMailbox *arch_get_mailbox_arm_bcm2708(addr_t base);
|
||||||
#warning ARM: Add gPeripheralBase to ARM_CTRL_0_MAILBOX_BASE
|
gMailbox = arch_get_mailbox_arm_bcm2708(DEVICE_BASE);
|
||||||
gMailbox = arch_get_mailbox_arm_bcm2708(ARM_CTRL_0_MAILBOX_BASE);
|
|
||||||
#endif
|
#endif
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user