blob: 3f4005b5d70b2ae3055c149ccb0eb536129d11b3 [file] [log] [blame]
Simon Glass4b0730d2011-09-26 14:10:39 +00001/*
2 * Copyright (c) 2011 The Chromium OS Authors.
Wolfgang Denk1a459662013-07-08 09:37:19 +02003 * SPDX-License-Identifier: GPL-2.0+
Simon Glass4b0730d2011-09-26 14:10:39 +00004 */
5
6#include <common.h>
Simon Glass7a9219c2011-10-03 19:26:44 +00007#include <os.h>
Simon Glass5c2859c2013-11-10 10:27:03 -07008#include <asm/state.h>
Simon Glass4b0730d2011-09-26 14:10:39 +00009
10DECLARE_GLOBAL_DATA_PTR;
11
Simon Glass88bd0e92013-11-10 10:27:00 -070012void reset_cpu(ulong ignored)
Simon Glass4b0730d2011-09-26 14:10:39 +000013{
Simon Glass5c2859c2013-11-10 10:27:03 -070014 if (state_uninit())
15 os_exit(2);
16
Simon Glass7a9219c2011-10-03 19:26:44 +000017 /* This is considered normal termination for now */
18 os_exit(0);
Simon Glass88bd0e92013-11-10 10:27:00 -070019}
20
21int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
22{
23 reset_cpu(0);
24
Simon Glass4b0730d2011-09-26 14:10:39 +000025 return 0;
26}
27
28/* delay x useconds */
29void __udelay(unsigned long usec)
30{
Matthias Weisserd99a6872011-11-29 12:16:40 +010031 os_usleep(usec);
Simon Glass4b0730d2011-09-26 14:10:39 +000032}
33
Simon Glasse2ee1002013-06-11 11:14:44 -070034unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
Simon Glass4b0730d2011-09-26 14:10:39 +000035{
Matthias Weisserd99a6872011-11-29 12:16:40 +010036 return os_get_nsec() / 1000;
Simon Glass4b0730d2011-09-26 14:10:39 +000037}
38
39int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
40{
Simon Glass88bd0e92013-11-10 10:27:00 -070041 if (flag & (BOOTM_STATE_OS_GO | BOOTM_STATE_OS_FAKE_GO)) {
42 bootstage_mark(BOOTSTAGE_ID_RUN_OS);
43 printf("## Transferring control to Linux (at address %08lx)...\n",
44 images->ep);
45 reset_cpu(0);
46 }
47
48 return 0;
Simon Glass4b0730d2011-09-26 14:10:39 +000049}
50
51int cleanup_before_linux(void)
52{
53 return 0;
54}
55
56void *map_physmem(phys_addr_t paddr, unsigned long len, unsigned long flags)
57{
Simon Glass8ee666a2012-12-13 20:49:11 +000058 return (void *)(gd->arch.ram_buf + paddr);
Simon Glass4b0730d2011-09-26 14:10:39 +000059}
60
Simon Glass66bd1cf2014-02-27 13:25:55 -070061phys_addr_t map_to_sysmem(const void *ptr)
Simon Glass781adb52013-04-20 08:42:37 +000062{
63 return (u8 *)ptr - gd->arch.ram_buf;
64}
65
Simon Glass4b0730d2011-09-26 14:10:39 +000066void flush_dcache_range(unsigned long start, unsigned long stop)
67{
68}