diff options
author | Ryan Harkin <ryan.harkin@linaro.org> | 2015-10-29 12:23:12 +0000 |
---|---|---|
committer | Ryan Harkin <ryan.harkin@linaro.org> | 2015-11-23 10:23:04 +0000 |
commit | 8713ece9246c5d8d163cd3d566777e8db5c357e8 (patch) | |
tree | c4f8c0c733d44ca5601399f01fe429116eb0df45 | |
parent | 2715a61246871062aca5afee290952ecdb3162eb (diff) |
HACK: vexpress64: add reset supportarmlt-20151123-001armlt-15.1115.11
This is a HACK because I've copy/pasted code from vexpress_common.
The proper solution is to break out the code from vexpress_common
so we can share bits between 32- and 64-bit ports.
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
-rw-r--r-- | board/armltd/vexpress64/vexpress64.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c index ee1f2088ee..13de3670a4 100644 --- a/board/armltd/vexpress64/vexpress64.c +++ b/board/armltd/vexpress64/vexpress64.c @@ -57,11 +57,45 @@ void dram_init_banksize(void) #endif } +#define SYS_CFG_START (1 << 31) +#define SYS_CFG_WRITE (1 << 30) +#define SYS_CFG_REBOOT (9 << 20) +#define SYS_CFG_SITE_MB (0 << 16) + +#define SYS_CFG_ERR (1 << 1) +#define SYS_CFG_COMPLETE (1 << 0) + +int v2m_cfg_write(u32 devfn, u32 data) +{ + /* Configuration interface broken? */ + u32 val; + + devfn |= SYS_CFG_START | SYS_CFG_WRITE; + + val = readl(V2M_SYS_CFGSTAT); + writel(val & ~SYS_CFG_COMPLETE, V2M_SYS_CFGSTAT); + + writel(data, V2M_SYS_CFGDATA); + writel(devfn, V2M_SYS_CFGCTRL); + + do { + val = readl(V2M_SYS_CFGSTAT); + } while (val == 0); + + return !!(val & SYS_CFG_ERR); +} /* * Board specific reset that is system reset. */ void reset_cpu(ulong addr) { + if (v2m_cfg_write(SYS_CFG_REBOOT | SYS_CFG_SITE_MB, 0)) + printf("Unable to reboot\n"); + else + /* The reset doesn't happen immediately */ + /* Delay while the motherboard gets around to it */ + /* rather than while(1) to hang forever, in case something went wrong */ + mdelay(1000); } /* |