diff options
author | Mike Frysinger <vapier@gentoo.org> | 2010-05-05 02:07:44 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2010-07-05 04:18:18 -0400 |
commit | ce53fc660114a2c23e6e8adbc197008b36ca444d (patch) | |
tree | d898edc3bee4b2ffdf7cda31975ce6483c45c565 /arch/blackfin/cpu/initcode.c | |
parent | 53ea1505bb0686e041b6cf14e1fc4f87de04e887 (diff) | |
download | u-boot-imx-ce53fc660114a2c23e6e8adbc197008b36ca444d.zip u-boot-imx-ce53fc660114a2c23e6e8adbc197008b36ca444d.tar.gz u-boot-imx-ce53fc660114a2c23e6e8adbc197008b36ca444d.tar.bz2 |
Blackfin: set up simple NMI handlers for anomaly 05000219
Older on-chip Blackfin bootroms do not create a dummy NMI handler, so set
up one ourselves when anomaly 05000219 applies.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/cpu/initcode.c')
-rw-r--r-- | arch/blackfin/cpu/initcode.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/blackfin/cpu/initcode.c b/arch/blackfin/cpu/initcode.c index 9453d5d..007f5ce 100644 --- a/arch/blackfin/cpu/initcode.c +++ b/arch/blackfin/cpu/initcode.c @@ -101,6 +101,28 @@ static inline void serial_putc(char c) continue; } +__attribute__((always_inline)) static inline void +program_nmi_handler(void) +{ + u32 tmp1, tmp2; + + /* Older bootroms don't create a dummy NMI handler, + * so make one ourselves ASAP in case it fires. + */ + if (CONFIG_BFIN_BOOT_MODE != BFIN_BOOT_BYPASS && !ANOMALY_05000219) + return; + + asm volatile ( + "%0 = RETS;" /* Save current RETS */ + "CALL 1f;" /* Figure out current PC */ + "RTN;" /* The simple NMI handler */ + "1:" + "%1 = RETS;" /* Load addr of NMI handler */ + "RETS = %0;" /* Restore RETS */ + "[%2] = %1;" /* Write NMI handler */ + : "=r"(tmp1), "=r"(tmp2) : "ab"(EVT2) + ); +} /* Max SCLK can be 133MHz ... dividing that by (2*4) gives * us a freq of 16MHz for SPI which should generally be @@ -640,6 +662,9 @@ void initcode(ADI_BOOT_DATA *bs) { ADI_BOOT_DATA bootstruct_scratch; + /* Setup NMI handler before anything else */ + program_nmi_handler(); + serial_init(); serial_putc('A'); |