main.c revision 269111
1161370Simp/*- 2161370Simp * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3157873Simp * 4161370Simp * Redistribution and use in source and binary forms, with or without 5161370Simp * modification, are permitted provided that the following conditions 6161370Simp * are met: 7161370Simp * 1. Redistributions of source code must retain the above copyright 8161370Simp * notice, this list of conditions and the following disclaimer. 9161370Simp * 2. Redistributions in binary form must reproduce the above copyright 10161370Simp * notice, this list of conditions and the following disclaimer in the 11161370Simp * documentation and/or other materials provided with the distribution. 12157873Simp * 13161370Simp * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14161370Simp * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15161370Simp * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16161370Simp * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17161370Simp * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18161370Simp * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19161370Simp * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20161370Simp * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21161370Simp * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22161370Simp * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23157873Simp * 24161370Simp * This software is derived from software provided by kwikbyte without 25161370Simp * copyright as follows: 26157873Simp * 27157873Simp * No warranty, expressed or implied, is included with this software. It is 28157873Simp * provided "AS IS" and no warranty of any kind including statutory or aspects 29157873Simp * relating to merchantability or fitness for any purpose is provided. All 30157873Simp * intellectual property rights of others is maintained with the respective 31157873Simp * owners. This software is not copyrighted and is intended for reference 32157873Simp * only. 33157873Simp * 34157873Simp * $FreeBSD: head/sys/boot/arm/at91/bootspi/main.c 269111 2014-07-26 03:33:19Z ian $ 35161370Simp */ 36157873Simp 37157873Simp#include "env_vars.h" 38161370Simp#include "at91rm9200.h" 39157873Simp#include "at91rm9200_lowlevel.h" 40157873Simp#include "loader_prompt.h" 41157873Simp#include "emac.h" 42157873Simp#include "lib.h" 43161370Simp#include "spi_flash.h" 44163597Simp#include "ee.h" 45157873Simp 46269111Sianint main(void); 47269111Sian 48157873Simpint 49157873Simpmain(void) 50157873Simp{ 51163597Simp printf("\nBoot\n"); 52163597Simp EEInit(); 53161370Simp SPI_InitFlash(); 54163597Simp#ifdef TSC_FPGA 55163597Simp fpga_load(); 56163597Simp#endif 57157873Simp EMAC_Init(); 58157873Simp LoadBootCommands(); 59161370Simp if (getc(1) == -1) { 60161370Simp start_wdog(30); 61157873Simp ExecuteEnvironmentFunctions(); 62161370Simp } 63161370Simp Bootloader(getc); 64157873Simp return (1); 65157873Simp} 66