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: releng/10.2/sys/boot/arm/at91/bootspi/main.c 163597 2006-10-21 22:44:26Z imp $ 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 46157873Simpint 47157873Simpmain(void) 48157873Simp{ 49163597Simp printf("\nBoot\n"); 50163597Simp EEInit(); 51161370Simp SPI_InitFlash(); 52163597Simp#ifdef TSC_FPGA 53163597Simp fpga_load(); 54163597Simp#endif 55157873Simp EMAC_Init(); 56157873Simp LoadBootCommands(); 57161370Simp if (getc(1) == -1) { 58161370Simp start_wdog(30); 59157873Simp ExecuteEnvironmentFunctions(); 60161370Simp } 61161370Simp Bootloader(getc); 62157873Simp return (1); 63157873Simp} 64