Path: blob/master/arch/blackfin/include/asm/bfrom.h
15126 views
/* Blackfin on-chip ROM API1*2* Copyright 2008 Analog Devices Inc.3*4* Licensed under the GPL-2 or later.5*/67#ifndef __BFROM_H__8#define __BFROM_H__910#include <linux/types.h>1112/* Possible syscontrol action flags */13#define SYSCTRL_READ 0x00000000 /* read registers */14#define SYSCTRL_WRITE 0x00000001 /* write registers */15#define SYSCTRL_SYSRESET 0x00000002 /* perform system reset */16#define SYSCTRL_CORERESET 0x00000004 /* perform core reset */17#define SYSCTRL_SOFTRESET 0x00000006 /* perform core and system reset */18#define SYSCTRL_VRCTL 0x00000010 /* read/write VR_CTL register */19#define SYSCTRL_EXTVOLTAGE 0x00000020 /* VDDINT supplied externally */20#define SYSCTRL_INTVOLTAGE 0x00000000 /* VDDINT generated by on-chip regulator */21#define SYSCTRL_OTPVOLTAGE 0x00000040 /* For Factory Purposes Only */22#define SYSCTRL_PLLCTL 0x00000100 /* read/write PLL_CTL register */23#define SYSCTRL_PLLDIV 0x00000200 /* read/write PLL_DIV register */24#define SYSCTRL_LOCKCNT 0x00000400 /* read/write PLL_LOCKCNT register */25#define SYSCTRL_PLLSTAT 0x00000800 /* read/write PLL_STAT register */2627typedef struct ADI_SYSCTRL_VALUES {28uint16_t uwVrCtl;29uint16_t uwPllCtl;30uint16_t uwPllDiv;31uint16_t uwPllLockCnt;32uint16_t uwPllStat;33} ADI_SYSCTRL_VALUES;3435static uint32_t (* const bfrom_SysControl)(uint32_t action_flags, ADI_SYSCTRL_VALUES *power_settings, void *reserved) = (void *)0xEF000038;3637/* We need a dedicated function since we need to screw with the stack pointer38* when resetting. The on-chip ROM will save/restore registers on the stack39* when doing a system reset, so the stack cannot be outside of the chip.40*/41__attribute__((__noreturn__))42static inline void bfrom_SoftReset(void *new_stack)43{44while (1)45/*46* We don't declare the SP as clobbered on purpose, since47* it confuses the heck out of the compiler, and this function48* never returns49*/50__asm__ __volatile__(51"sp = %[stack];"52"jump (%[bfrom_syscontrol]);"53: : [bfrom_syscontrol] "p"(bfrom_SysControl),54"q0"(SYSCTRL_SOFTRESET),55"q1"(0),56"q2"(NULL),57[stack] "p"(new_stack)58);59}6061/* OTP Functions */62static uint32_t (* const bfrom_OtpCommand)(uint32_t command, uint32_t value) = (void *)0xEF000018;63static uint32_t (* const bfrom_OtpRead)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)0xEF00001A;64static uint32_t (* const bfrom_OtpWrite)(uint32_t page, uint32_t flags, uint64_t *page_content) = (void *)0xEF00001C;6566/* otp command: defines for "command" */67#define OTP_INIT 0x0000000168#define OTP_CLOSE 0x000000026970/* otp read/write: defines for "flags" */71#define OTP_LOWER_HALF 0x00000000 /* select upper/lower 64-bit half (bit 0) */72#define OTP_UPPER_HALF 0x0000000173#define OTP_NO_ECC 0x00000010 /* do not use ECC */74#define OTP_LOCK 0x00000020 /* sets page protection bit for page */75#define OTP_CHECK_FOR_PREV_WRITE 0x000000807677/* Return values for all functions */78#define OTP_SUCCESS 0x0000000079#define OTP_MASTER_ERROR 0x00180#define OTP_WRITE_ERROR 0x00381#define OTP_READ_ERROR 0x00582#define OTP_ACC_VIO_ERROR 0x00983#define OTP_DATA_MULT_ERROR 0x01184#define OTP_ECC_MULT_ERROR 0x02185#define OTP_PREV_WR_ERROR 0x04186#define OTP_DATA_SB_WARN 0x10087#define OTP_ECC_SB_WARN 0x2008889#endif909192