2006-03-12 01:12:27 +00:00
|
|
|
/*
|
2008-10-12 02:40:22 +00:00
|
|
|
* U-boot - main board file
|
2006-03-12 01:12:27 +00:00
|
|
|
*
|
2008-10-12 02:40:22 +00:00
|
|
|
* Copyright (c) 2005-2008 Analog Devices Inc.
|
2006-03-12 01:12:27 +00:00
|
|
|
*
|
|
|
|
* (C) Copyright 2000-2004
|
|
|
|
* Wolfgang Denk, DENX Software Engineering, wd@denx.de.
|
|
|
|
*
|
|
|
|
* See file CREDITS for list of people who contributed to this
|
|
|
|
* project.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of
|
|
|
|
* the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
2007-04-05 10:31:18 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
|
|
|
|
* MA 02110-1301 USA
|
2006-03-12 01:12:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2009-10-05 05:37:03 +00:00
|
|
|
#include <netdev.h>
|
2007-03-11 16:25:14 +00:00
|
|
|
#include <asm/io.h>
|
2007-03-09 05:38:44 +00:00
|
|
|
#include "bf533-stamp.h"
|
2006-03-31 16:32:53 +00:00
|
|
|
|
2007-09-15 18:48:41 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2007-03-09 05:38:44 +00:00
|
|
|
int checkboard(void)
|
2006-03-12 01:12:27 +00:00
|
|
|
{
|
2007-03-09 05:38:44 +00:00
|
|
|
printf("Board: ADI BF533 Stamp board\n");
|
|
|
|
printf(" Support: http://blackfin.uclinux.org/\n");
|
2006-03-12 01:12:27 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2008-10-12 02:38:37 +00:00
|
|
|
/* PF0 and PF1 are used to switch between the ethernet and flash:
|
|
|
|
* PF0 PF1
|
|
|
|
* flash: 0 0
|
|
|
|
* ether: 1 0
|
|
|
|
*/
|
2007-03-09 05:38:44 +00:00
|
|
|
void swap_to(int device_id)
|
2006-03-12 01:12:27 +00:00
|
|
|
{
|
2008-10-12 02:38:37 +00:00
|
|
|
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | PF1 | PF0);
|
|
|
|
SSYNC();
|
|
|
|
bfin_write_FIO_FLAG_C(PF1);
|
|
|
|
if (device_id == ETHERNET)
|
|
|
|
bfin_write_FIO_FLAG_S(PF0);
|
|
|
|
else if (device_id == FLASH)
|
|
|
|
bfin_write_FIO_FLAG_C(PF0);
|
|
|
|
else
|
|
|
|
printf("Unknown device to switch\n");
|
|
|
|
SSYNC();
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#if defined(CONFIG_MISC_INIT_R)
|
|
|
|
/* miscellaneous platform dependent initialisations */
|
2007-03-09 05:38:44 +00:00
|
|
|
int misc_init_r(void)
|
2006-03-12 01:12:27 +00:00
|
|
|
{
|
|
|
|
#ifdef CONFIG_STAMP_CF
|
2009-11-30 18:08:39 +00:00
|
|
|
cf_ide_init();
|
|
|
|
#endif
|
2006-03-12 01:12:27 +00:00
|
|
|
|
2009-11-30 18:08:39 +00:00
|
|
|
return 0;
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2008-10-12 02:40:22 +00:00
|
|
|
#ifdef CONFIG_SHOW_BOOT_PROGRESS
|
|
|
|
|
|
|
|
#define STATUS_LED_OFF 0
|
|
|
|
#define STATUS_LED_ON 1
|
|
|
|
|
|
|
|
static void stamp_led_set(int LED1, int LED2, int LED3)
|
2006-03-12 01:12:27 +00:00
|
|
|
{
|
2008-10-12 02:40:22 +00:00
|
|
|
bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4));
|
|
|
|
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4));
|
2006-03-12 01:55:22 +00:00
|
|
|
|
|
|
|
if (LED1 == STATUS_LED_OFF)
|
2006-03-12 01:12:27 +00:00
|
|
|
*pFIO_FLAG_S = PF2;
|
|
|
|
else
|
|
|
|
*pFIO_FLAG_C = PF2;
|
2006-03-12 01:55:22 +00:00
|
|
|
if (LED2 == STATUS_LED_OFF)
|
2006-03-12 01:12:27 +00:00
|
|
|
*pFIO_FLAG_S = PF3;
|
|
|
|
else
|
|
|
|
*pFIO_FLAG_C = PF3;
|
2006-03-12 01:55:22 +00:00
|
|
|
if (LED3 == STATUS_LED_OFF)
|
2006-03-12 01:12:27 +00:00
|
|
|
*pFIO_FLAG_S = PF4;
|
|
|
|
else
|
|
|
|
*pFIO_FLAG_C = PF4;
|
2008-02-05 00:26:55 +00:00
|
|
|
SSYNC();
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
|
2007-03-09 05:38:44 +00:00
|
|
|
void show_boot_progress(int status)
|
2006-03-12 01:12:27 +00:00
|
|
|
{
|
2006-03-12 01:55:22 +00:00
|
|
|
switch (status) {
|
|
|
|
case 1:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 3:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
case 6:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
case 8:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
case 10:
|
|
|
|
case 11:
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
case 14:
|
|
|
|
case 15:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
|
|
|
default:
|
2007-03-09 05:38:44 +00:00
|
|
|
stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
|
2006-03-12 01:55:22 +00:00
|
|
|
break;
|
2006-03-12 01:12:27 +00:00
|
|
|
}
|
|
|
|
}
|
2008-10-12 02:40:22 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_STATUS_LED
|
|
|
|
#include <status_led.h>
|
|
|
|
|
|
|
|
static void set_led(int pf, int state)
|
|
|
|
{
|
|
|
|
switch (state) {
|
|
|
|
case STATUS_LED_OFF: bfin_write_FIO_FLAG_S(pf); break;
|
|
|
|
case STATUS_LED_BLINKING: bfin_write_FIO_FLAG_T(pf); break;
|
|
|
|
case STATUS_LED_ON: bfin_write_FIO_FLAG_C(pf); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void set_leds(led_id_t mask, int state)
|
|
|
|
{
|
|
|
|
if (mask & 0x1) set_led(PF2, state);
|
|
|
|
if (mask & 0x2) set_led(PF3, state);
|
|
|
|
if (mask & 0x4) set_led(PF4, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
void __led_init(led_id_t mask, int state)
|
|
|
|
{
|
|
|
|
bfin_write_FIO_INEN(bfin_read_FIO_INEN() & ~(PF2 | PF3 | PF4));
|
|
|
|
bfin_write_FIO_DIR(bfin_read_FIO_DIR() | (PF2 | PF3 | PF4));
|
|
|
|
}
|
|
|
|
|
|
|
|
void __led_set(led_id_t mask, int state)
|
|
|
|
{
|
|
|
|
set_leds(mask, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
void __led_toggle(led_id_t mask)
|
|
|
|
{
|
|
|
|
set_leds(mask, STATUS_LED_BLINKING);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
2009-10-05 05:37:03 +00:00
|
|
|
|
|
|
|
#ifdef CONFIG_SMC91111
|
|
|
|
int board_eth_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return smc91111_initialize(0, CONFIG_SMC91111_BASE);
|
|
|
|
}
|
|
|
|
#endif
|