Blackfin: update on-chip ROM API
This brings the API for the on-chip ROM in line with the toolchain and hardware documentation. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
7633903bff
commit
9372c32148
@ -92,14 +92,6 @@
|
||||
|
||||
#define BOOTROM_CAPS_ADI_BOOT_STRUCTS 1
|
||||
|
||||
/* Not available on initial BF54x or BF52x */
|
||||
#if (defined(__ADSPBF54x__) && __SILICON_REVISION__ < 1) || \
|
||||
(defined(__ADSPBF52x__) && __SILICON_REVISION__ < 2)
|
||||
#define BOOTROM_CAPS_SYSCONTROL 0
|
||||
#else
|
||||
#define BOOTROM_CAPS_SYSCONTROL 1
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef BOOTROM_FOLLOWS_C_ABI
|
||||
@ -108,9 +100,21 @@
|
||||
#ifndef BOOTROM_CAPS_ADI_BOOT_STRUCTS
|
||||
#define BOOTROM_CAPS_ADI_BOOT_STRUCTS 0
|
||||
#endif
|
||||
#ifndef BOOTROM_CAPS_SYSCONTROL
|
||||
#define BOOTROM_CAPS_SYSCONTROL 0
|
||||
#endif
|
||||
|
||||
/* Possible syscontrol action flags */
|
||||
#define SYSCTRL_READ 0x00000000 /* read registers */
|
||||
#define SYSCTRL_WRITE 0x00000001 /* write registers */
|
||||
#define SYSCTRL_SYSRESET 0x00000002 /* perform system reset */
|
||||
#define SYSCTRL_CORERESET 0x00000004 /* perform core reset */
|
||||
#define SYSCTRL_SOFTRESET 0x00000006 /* perform core and system reset */
|
||||
#define SYSCTRL_VRCTL 0x00000010 /* read/write VR_CTL register */
|
||||
#define SYSCTRL_EXTVOLTAGE 0x00000020 /* VDDINT supplied externally */
|
||||
#define SYSCTRL_INTVOLTAGE 0x00000000 /* VDDINT generated by on-chip regulator */
|
||||
#define SYSCTRL_OTPVOLTAGE 0x00000040 /* For Factory Purposes Only */
|
||||
#define SYSCTRL_PLLCTL 0x00000100 /* read/write PLL_CTL register */
|
||||
#define SYSCTRL_PLLDIV 0x00000200 /* read/write PLL_DIV register */
|
||||
#define SYSCTRL_LOCKCNT 0x00000400 /* read/write PLL_LOCKCNT register */
|
||||
#define SYSCTRL_PLLSTAT 0x00000800 /* read/write PLL_STAT register */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
@ -132,25 +136,26 @@ typedef struct ADI_SYSCTRL_VALUES {
|
||||
#ifndef _BOOTROM_SYSCONTROL
|
||||
#define _BOOTROM_SYSCONTROL 0
|
||||
#endif
|
||||
static uint32_t (* const syscontrol)(uint32_t action_flags, ADI_SYSCTRL_VALUES *power_settings, void *reserved) = (void *)_BOOTROM_SYSCONTROL;
|
||||
static uint32_t (* const bfrom_SysControl)(uint32_t action_flags, ADI_SYSCTRL_VALUES *power_settings, void *reserved) = (void *)_BOOTROM_SYSCONTROL;
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/* Possible syscontrol action flags */
|
||||
#define SYSCTRL_READ 0x00000000 /* read registers */
|
||||
#define SYSCTRL_WRITE 0x00000001 /* write registers */
|
||||
#define SYSCTRL_SYSRESET 0x00000002 /* perform system reset */
|
||||
#define SYSCTRL_SOFTRESET 0x00000004 /* perform core and system reset */
|
||||
#define SYSCTRL_VRCTL 0x00000010 /* read/write VR_CTL register */
|
||||
#define SYSCTRL_EXTVOLTAGE 0x00000020 /* VDDINT supplied externally */
|
||||
#define SYSCTRL_INTVOLTAGE 0x00000000 /* VDDINT generated by on-chip regulator */
|
||||
#define SYSCTRL_OTPVOLTAGE 0x00000040 /* For Factory Purposes Only */
|
||||
#define SYSCTRL_PLLCTL 0x00000100 /* read/write PLL_CTL register */
|
||||
#define SYSCTRL_PLLDIV 0x00000200 /* read/write PLL_DIV register */
|
||||
#define SYSCTRL_LOCKCNT 0x00000400 /* read/write PLL_LOCKCNT register */
|
||||
#define SYSCTRL_PLLSTAT 0x00000800 /* read/write PLL_STAT register */
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
/* We need a dedicated function since we need to screw with the stack pointer
|
||||
* when resetting. The on-chip ROM will save/restore registers on the stack
|
||||
* when doing a system reset, so the stack cannot be outside of the chip.
|
||||
*/
|
||||
__attribute__((__noreturn__))
|
||||
static inline void bfrom_SoftReset(void *new_stack)
|
||||
{
|
||||
while (1)
|
||||
__asm__ __volatile__(
|
||||
"sp = %[stack];"
|
||||
"jump (%[bfrom_syscontrol]);"
|
||||
: : [bfrom_syscontrol] "p"(bfrom_SysControl),
|
||||
"q0"(SYSCTRL_SOFTRESET),
|
||||
"q1"(0),
|
||||
"q2"(NULL),
|
||||
[stack] "p"(new_stack)
|
||||
);
|
||||
}
|
||||
|
||||
/* Structures for working with LDRs and boot rom callbacks */
|
||||
typedef struct ADI_BOOT_HEADER {
|
||||
|
@ -9,9 +9,9 @@
|
||||
|
||||
#include "bootrom.h"
|
||||
|
||||
static uint32_t (* const otp_command)(uint32_t command, uint32_t value) = (void *)_BOOTROM_OTP_COMMAND;
|
||||
static uint32_t (* const otp_read)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_READ;
|
||||
static uint32_t (* const otp_write)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_WRITE;
|
||||
static uint32_t (* const bfrom_OtpCommand)(uint32_t command, uint32_t value) = (void *)_BOOTROM_OTP_COMMAND;
|
||||
static uint32_t (* const bfrom_OtpRead)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_READ;
|
||||
static uint32_t (* const bfrom_OtpWrite)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)_BOOTROM_OTP_WRITE;
|
||||
|
||||
#endif
|
||||
|
||||
@ -24,8 +24,7 @@ static uint32_t (* const otp_write)(uint32_t page, uint32_t flags, uint64_t *pag
|
||||
#define OTP_UPPER_HALF 0x00000001
|
||||
#define OTP_NO_ECC 0x00000010 /* do not use ECC */
|
||||
#define OTP_LOCK 0x00000020 /* sets page protection bit for page */
|
||||
#define OTP_ACCESS_READ 0x00001000
|
||||
#define OTP_ACCESS_READWRITE 0x00002000
|
||||
#define OTP_CHECK_FOR_PREV_WRITE 0x00000080
|
||||
|
||||
/* Return values for all functions */
|
||||
#define OTP_SUCCESS 0x00000000
|
||||
|
Loading…
Reference in New Issue
Block a user