1221420Sdes/*- 2146998Sdes * Copyright (c) 2006 M. Warner Losh. All rights reserved. 3146998Sdes * 4146998Sdes * Redistribution and use in source and binary forms, with or without 5146998Sdes * modification, are permitted provided that the following conditions 6146998Sdes * are met: 7146998Sdes * 1. Redistributions of source code must retain the above copyright 8146998Sdes * notice, this list of conditions and the following disclaimer. 9146998Sdes * 2. Redistributions in binary form must reproduce the above copyright 10146998Sdes * notice, this list of conditions and the following disclaimer in the 11146998Sdes * documentation and/or other materials provided with the distribution. 12146998Sdes * 13146998Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14146998Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15146998Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16146998Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17146998Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18146998Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19146998Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20146998Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21146998Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22146998Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23146998Sdes * 24146998Sdes */ 25146998Sdes 26146998Sdes#include <sys/cdefs.h> 27146998Sdes__FBSDID("$FreeBSD: releng/10.2/sys/boot/arm/at91/boot2/kb920x_board.c 183635 2008-10-05 23:39:28Z imp $"); 28146998Sdes 29221420Sdes#include <sys/param.h> 30221420Sdes 31221420Sdes#include "emac.h" 32146998Sdes#include "lib.h" 33146998Sdes#include "board.h" 34146998Sdes#include "sd-card.h" 35146998Sdes 36146998Sdesunsigned char mac[6] = { 0x42, 0x53, 0x44, 0, 0, 1 }; 37146998Sdes 38146998Sdesstatic void 39146998SdesMacFromEE() 40146998Sdes{ 41146998Sdes uint32_t sig; 42146998Sdes sig = 0; 43146998Sdes ReadEEPROM(12 * 1024, (uint8_t *)&sig, sizeof(sig)); 44146998Sdes if (sig != 0x92021054) 45146998Sdes return; 46146998Sdes ReadEEPROM(12 * 1024 + 4, mac, 6); 47146998Sdes printf("MAC %x:%x:%x:%x:%x:%x\n", mac[0], 48146998Sdes mac[1], mac[2], mac[3], mac[4], mac[5]); 49146998Sdes} 50146998Sdes 51146998Sdesvoid 52221420Sdesboard_init(void) 53221420Sdes{ 54146998Sdes InitEEPROM(); 55146998Sdes MacFromEE(); 56146998Sdes EMAC_Init(); 57146998Sdes EMAC_SetMACAddress(mac); 58 while (sdcard_init() == 0) 59 printf("Looking for SD card\n"); 60} 61 62int 63drvread(void *buf, unsigned lba, unsigned nblk) 64{ 65 return (MCI_read((char *)buf, lba << 9, nblk << 9)); 66} 67