2011-09-26 14:10:39 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2011 The Chromium OS Authors.
|
2013-07-08 07:37:19 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
2011-09-26 14:10:39 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2014-07-23 12:55:02 +00:00
|
|
|
#include <dm/root.h>
|
2011-10-03 19:26:44 +00:00
|
|
|
#include <os.h>
|
2013-11-10 17:27:03 +00:00
|
|
|
#include <asm/state.h>
|
2011-09-26 14:10:39 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2013-11-10 17:27:00 +00:00
|
|
|
void reset_cpu(ulong ignored)
|
2011-09-26 14:10:39 +00:00
|
|
|
{
|
2013-11-10 17:27:03 +00:00
|
|
|
if (state_uninit())
|
|
|
|
os_exit(2);
|
|
|
|
|
2014-07-23 12:55:02 +00:00
|
|
|
if (dm_uninit())
|
|
|
|
os_exit(2);
|
|
|
|
|
2011-10-03 19:26:44 +00:00
|
|
|
/* This is considered normal termination for now */
|
|
|
|
os_exit(0);
|
2013-11-10 17:27:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
|
|
|
|
{
|
|
|
|
reset_cpu(0);
|
|
|
|
|
2011-09-26 14:10:39 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* delay x useconds */
|
|
|
|
void __udelay(unsigned long usec)
|
|
|
|
{
|
2011-11-29 11:16:40 +00:00
|
|
|
os_usleep(usec);
|
2011-09-26 14:10:39 +00:00
|
|
|
}
|
|
|
|
|
2013-06-11 18:14:44 +00:00
|
|
|
unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
|
2011-09-26 14:10:39 +00:00
|
|
|
{
|
2011-11-29 11:16:40 +00:00
|
|
|
return os_get_nsec() / 1000;
|
2011-09-26 14:10:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
|
|
|
|
{
|
2013-11-10 17:27:00 +00:00
|
|
|
if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
|
|
|
|
bootstage_mark(BOOTSTAGE_ID_RUN_OS);
|
|
|
|
printf("## Transferring control to Linux (at address %08lx)...\n",
|
|
|
|
images->ep);
|
|
|
|
reset_cpu(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2011-09-26 14:10:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int cleanup_before_linux(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
|
|
|
|
{
|
2012-12-13 20:49:11 +00:00
|
|
|
return (void *)(gd->arch.ram_buf + paddr);
|
2011-09-26 14:10:39 +00:00
|
|
|
}
|
|
|
|
|
2014-02-27 20:25:55 +00:00
|
|
|
phys_addr_t map_to_sysmem(const void *ptr)
|
2013-04-20 08:42:37 +00:00
|
|
|
{
|
|
|
|
return (u8 *)ptr - gd->arch.ram_buf;
|
|
|
|
}
|
|
|
|
|
2011-09-26 14:10:39 +00:00
|
|
|
void flush_dcache_range(unsigned long start, unsigned long stop)
|
|
|
|
{
|
|
|
|
}
|