blob: 38019e0b48e57585b0e89f23ab929c9cad5f2edc [file] [log] [blame]
Simon Glass3d750d72011-09-26 14:10:39 +00001/*
2 * Copyright (c) 2011 The Chromium OS Authors.
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02003 * SPDX-License-Identifier: GPL-2.0+
Simon Glass3d750d72011-09-26 14:10:39 +00004 */
5
6#include <common.h>
Simon Glasscd0684f2011-10-03 19:26:44 +00007#include <os.h>
Simon Glass9dd10bf2013-11-10 10:27:03 -07008#include <asm/state.h>
Simon Glass3d750d72011-09-26 14:10:39 +00009
10DECLARE_GLOBAL_DATA_PTR;
11
Simon Glassdc9f8cd2013-11-10 10:27:00 -070012void reset_cpu(ulong ignored)
Simon Glass3d750d72011-09-26 14:10:39 +000013{
Simon Glass9dd10bf2013-11-10 10:27:03 -070014 if (state_uninit())
15 os_exit(2);
16
Simon Glasscd0684f2011-10-03 19:26:44 +000017 /* This is considered normal termination for now */
18 os_exit(0);
Simon Glassdc9f8cd2013-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 Glass3d750d72011-09-26 14:10:39 +000025 return 0;
26}
27
28/* delay x useconds */
29void __udelay(unsigned long usec)
30{
Matthias Weisser0d3dd142011-11-29 12:16:40 +010031 os_usleep(usec);
Simon Glass3d750d72011-09-26 14:10:39 +000032}
33
Simon Glasse7f1eb52013-06-11 11:14:44 -070034unsigned long __attribute__((no_instrument_function)) timer_get_us(void)
Simon Glass3d750d72011-09-26 14:10:39 +000035{
Matthias Weisser0d3dd142011-11-29 12:16:40 +010036 return os_get_nsec() / 1000;
Simon Glass3d750d72011-09-26 14:10:39 +000037}
38
39int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
40{
Simon Glassdc9f8cd2013-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 Glass3d750d72011-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 Glass64371472012-12-13 20:49:11 +000058 return (void *)(gd->arch.ram_buf + paddr);
Simon Glass3d750d72011-09-26 14:10:39 +000059}
60
Simon Glasse23d2932013-04-20 08:42:37 +000061phys_addr_t map_to_sysmem(void *ptr)
62{
63 return (u8 *)ptr - gd->arch.ram_buf;
64}
65
Simon Glass3d750d72011-09-26 14:10:39 +000066void flush_dcache_range(unsigned long start, unsigned long stop)
67{
68}