Commit 58eb57ac authored by Sergei Poselenov's avatar Sergei Poselenov
Browse files

RT #72064. Moved reset_cpu() into common CM3 code. Removed target-specific

reset_cpu().
parent c649e71d
......@@ -42,16 +42,3 @@ int print_cpuinfo(void)
return 0;
}
/*
* Perform the low-level reset.
* Note that we need for this function to reside in RAM since it
* will be used to self-upgrade U-boot in eNMV.
*/
void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
reset_cpu(ulong addr)
{
cortex_m3_reset_cpu(addr);
}
......@@ -97,24 +97,22 @@ void hw_watchdog_reset(void)
*/
void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
cortex_m3_reset_cpu(ulong addr)
reset_cpu(ulong addr)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
/*
* Perform reset but keep priority group unchanged.
*/
scb->aircr = (CM3_AIRCR_VECTKEY << CM3_AIRCR_VECTKEY_SHIFT) |
(scb->aircr &
(CM3_AIRCR_PRIGROUP_MSK << CM3_AIRCR_PRIGROUP_SHIFT)) |
CM3_AIRCR_SYSRESET;
CM3_SCB_REGS->aircr = (CM3_AIRCR_VECTKEY << CM3_AIRCR_VECTKEY_SHIFT) |
(CM3_SCB_REGS->aircr &
(CM3_AIRCR_PRIGROUP_MSK << CM3_AIRCR_PRIGROUP_SHIFT))
| CM3_AIRCR_SYSRESET;
}
/*
* Dump the registers on an exception we don't know how to process.
*/
unsigned char cortex_m3_irq_vec_get(void)
u8 cortex_m3_irq_vec_get(void)
{
volatile struct cm3_scb *scb = (volatile struct cm3_scb *)CM3_SCB_BASE;
return scb->icsr & CM3_ICSR_VECTACT_MSK;
return CM3_SCB_REGS->icsr & CM3_ICSR_VECTACT_MSK;
}
......@@ -42,15 +42,3 @@ int print_cpuinfo(void)
return 0;
}
/*
* Perform the low-level reset.
* Note that we need for this function to reside in RAM since it
* will be used to self-upgrade U-boot in eNMV.
*/
void __attribute__((section(".ramcode")))
__attribute__ ((long_call))
reset_cpu(ulong addr)
{
cortex_m3_reset_cpu(addr);
}
......@@ -36,6 +36,7 @@ struct cm3_scb {
uint32_t vtor; /* Vector Table Offset Register */
uint32_t aircr; /* App Interrupt and Reset Control Register */
};
#define CM3_SCB_REGS ((volatile struct cm3_scb *)CM3_SCB_BASE)
#define CM3_AIRCR_VECTKEY 0x5fa
#define CM3_AIRCR_VECTKEY_SHIFT 16
......@@ -59,8 +60,6 @@ struct cm3_systick {
#define CM3_SYSTICK_LOAD_RELOAD_MSK (0x00FFFFFF)
#define CM3_SYSTICK_CTRL_EN 1
void __attribute__((section(".ramcode"))) __attribute__ ((long_call))
cortex_m3_reset_cpu(ulong addr);
unsigned char cortex_m3_irq_vec_get(void);
u8 cortex_m3_irq_vec_get(void);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment