xref: /netbsd-src/sys/arch/evbarm/stand/bootimx23/boot_prep.c (revision bf9547b278baefe91669bbdb5a99d63c7986f1f6)
1*bf9547b2Sjkunz /* $Id: boot_prep.c,v 1.3 2013/02/23 16:22:39 jkunz Exp $ */
2da8587eaSjkunz 
3da8587eaSjkunz /*
4da8587eaSjkunz  * Copyright (c) 2012 The NetBSD Foundation, Inc.
5da8587eaSjkunz  * All rights reserved.
6da8587eaSjkunz  *
7da8587eaSjkunz  * This code is derived from software contributed to The NetBSD Foundation
8da8587eaSjkunz  * by Petri Laakso.
9da8587eaSjkunz  *
10da8587eaSjkunz  * Redistribution and use in source and binary forms, with or without
11da8587eaSjkunz  * modification, are permitted provided that the following conditions
12da8587eaSjkunz  * are met:
13da8587eaSjkunz  * 1. Redistributions of source code must retain the above copyright
14da8587eaSjkunz  *    notice, this list of conditions and the following disclaimer.
15da8587eaSjkunz  * 2. Redistributions in binary form must reproduce the above copyright
16da8587eaSjkunz  *    notice, this list of conditions and the following disclaimer in the
17da8587eaSjkunz  *    documentation and/or other materials provided with the distribution.
18da8587eaSjkunz  *
19da8587eaSjkunz  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20da8587eaSjkunz  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21da8587eaSjkunz  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22da8587eaSjkunz  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23da8587eaSjkunz  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24da8587eaSjkunz  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25da8587eaSjkunz  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26da8587eaSjkunz  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27da8587eaSjkunz  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28da8587eaSjkunz  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29da8587eaSjkunz  * POSSIBILITY OF SUCH DAMAGE.
30da8587eaSjkunz  */
31da8587eaSjkunz 
32da8587eaSjkunz #include <sys/param.h>
33da8587eaSjkunz #include <sys/cdefs.h>
34da8587eaSjkunz 
35da8587eaSjkunz #include <arm/imx/imx23_digctlreg.h>
36da8587eaSjkunz 
37da8587eaSjkunz #include <lib/libsa/stand.h>
38da8587eaSjkunz 
39da8587eaSjkunz #include "common.h"
40da8587eaSjkunz 
41da8587eaSjkunz /*
425379dc38Sjkunz  * Initialize i.MX23 power, clocks and DRAM.
43da8587eaSjkunz  */
44da8587eaSjkunz int
_start(void)45da8587eaSjkunz _start(void)
46da8587eaSjkunz {
47da8587eaSjkunz 
485379dc38Sjkunz 	/* Make sure timer is running. */
495379dc38Sjkunz 	REG_WR(HW_DIGCTL_BASE + HW_DIGCTL_CTRL_CLR,
50da8587eaSjkunz 	    HW_DIGCTL_CTRL_XTAL24M_GATE);
51da8587eaSjkunz 
52da8587eaSjkunz 	printf("\n\rBooting");
53da8587eaSjkunz 
54da8587eaSjkunz 	power_prep();
55da8587eaSjkunz 	putchar('.');
56da8587eaSjkunz 
57da8587eaSjkunz 	clock_prep();
58da8587eaSjkunz 	putchar('.');
59da8587eaSjkunz 
60da8587eaSjkunz 	pinctrl_prep();
61da8587eaSjkunz 	putchar('.');
62da8587eaSjkunz 
63da8587eaSjkunz 	emi_prep();
64da8587eaSjkunz 	printf("done.\n\r");
65da8587eaSjkunz 
66*bf9547b2Sjkunz 	args_prep();
67*bf9547b2Sjkunz 
68da8587eaSjkunz 	return 0;
69da8587eaSjkunz }
70