blob: 585f5f14d422ab83d62a7bc93bb137005e565e71 [file] [log] [blame]
Aubrey.Li3f0606a2007-03-09 13:38:44 +08001/*
Mike Frysinger23fd9592008-10-11 22:40:22 -04002 * U-boot - main board file
Aubrey.Li3f0606a2007-03-09 13:38:44 +08003 *
Mike Frysinger23fd9592008-10-11 22:40:22 -04004 * Copyright (c) 2005-2008 Analog Devices Inc.
Aubrey.Li3f0606a2007-03-09 13:38:44 +08005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Aubrey.Li3f0606a2007-03-09 13:38:44 +080010 */
11
12#include <common.h>
Ben Warren7194ab82009-10-04 22:37:03 -070013#include <netdev.h>
Mike Frysinger6cfcf582010-06-02 06:18:57 -040014#include <asm/gpio.h>
Aubrey.Li3f0606a2007-03-09 13:38:44 +080015
Wolfgang Denk1218abf2007-09-15 20:48:41 +020016DECLARE_GLOBAL_DATA_PTR;
17
Aubrey.Li3f0606a2007-03-09 13:38:44 +080018int checkboard(void)
19{
Aubrey.Li3f0606a2007-03-09 13:38:44 +080020 printf("Board: ADI BF533 Stamp board\n");
21 printf(" Support: http://blackfin.uclinux.org/\n");
22 return 0;
23}
24
Mike Frysinger1f75d6f2008-10-11 22:38:37 -040025/* PF0 and PF1 are used to switch between the ethernet and flash:
26 * PF0 PF1
27 * flash: 0 0
28 * ether: 1 0
29 */
Aubrey.Li3f0606a2007-03-09 13:38:44 +080030void swap_to(int device_id)
31{
Mike Frysinger6cfcf582010-06-02 06:18:57 -040032 gpio_request(GPIO_PF0, "eth_flash_swap");
33 gpio_request(GPIO_PF1, "eth_flash_swap");
34 gpio_direction_output(GPIO_PF0, device_id == ETHERNET);
35 gpio_direction_output(GPIO_PF1, 0);
Mike Frysinger1f75d6f2008-10-11 22:38:37 -040036 SSYNC();
Aubrey.Li3f0606a2007-03-09 13:38:44 +080037}
38
39#if defined(CONFIG_MISC_INIT_R)
40/* miscellaneous platform dependent initialisations */
41int misc_init_r(void)
42{
Mike Frysinger5f796442009-11-30 13:08:39 -050043#ifdef CONFIG_STAMP_CF
44 cf_ide_init();
Aubrey.Li3f0606a2007-03-09 13:38:44 +080045#endif
46
Mike Frysinger5f796442009-11-30 13:08:39 -050047 return 0;
Aubrey.Li3f0606a2007-03-09 13:38:44 +080048}
49#endif
50
Mike Frysinger23fd9592008-10-11 22:40:22 -040051#ifdef CONFIG_SHOW_BOOT_PROGRESS
52
53#define STATUS_LED_OFF 0
54#define STATUS_LED_ON 1
55
Mike Frysinger6cfcf582010-06-02 06:18:57 -040056static int gpio_setup;
57
Mike Frysinger23fd9592008-10-11 22:40:22 -040058static void stamp_led_set(int LED1, int LED2, int LED3)
Aubrey.Li3f0606a2007-03-09 13:38:44 +080059{
Mike Frysinger6cfcf582010-06-02 06:18:57 -040060 if (!gpio_setup) {
61 gpio_request(GPIO_PF2, "boot_progress");
62 gpio_request(GPIO_PF3, "boot_progress");
63 gpio_request(GPIO_PF4, "boot_progress");
64 gpio_direction_output(GPIO_PF2, LED1);
65 gpio_direction_output(GPIO_PF3, LED2);
66 gpio_direction_output(GPIO_PF4, LED3);
67 gpio_setup = 1;
68 } else {
69 gpio_set_value(GPIO_PF2, LED1);
70 gpio_set_value(GPIO_PF3, LED2);
71 gpio_set_value(GPIO_PF4, LED3);
72 }
Aubrey.Li3f0606a2007-03-09 13:38:44 +080073}
74
75void show_boot_progress(int status)
76{
77 switch (status) {
Simon Glass5dc88712012-01-14 15:24:47 +000078 case BOOTSTAGE_ID_CHECK_MAGIC:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080079 stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
80 break;
Simon Glass5dc88712012-01-14 15:24:47 +000081 case BOOTSTAGE_ID_CHECK_HEADER:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080082 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
83 break;
Simon Glass5dc88712012-01-14 15:24:47 +000084 case BOOTSTAGE_ID_CHECK_CHECKSUM:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080085 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
86 break;
Simon Glass5dc88712012-01-14 15:24:47 +000087 case BOOTSTAGE_ID_CHECK_ARCH:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080088 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
89 break;
Simon Glass5dc88712012-01-14 15:24:47 +000090 case BOOTSTAGE_ID_CHECK_IMAGETYPE:
91 case BOOTSTAGE_ID_DECOMP_IMAGE:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080092 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
93 break;
Simon Glass5dc88712012-01-14 15:24:47 +000094 case BOOTSTAGE_ID_KERNEL_LOADED:
95 case BOOTSTAGE_ID_CHECK_BOOT_OS:
Aubrey.Li3f0606a2007-03-09 13:38:44 +080096 stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
97 break;
Simon Glass5dc88712012-01-14 15:24:47 +000098 case BOOTSTAGE_ID_BOOT_OS_RETURNED:
Simon Glass5e410882011-12-10 11:07:57 +000099 case BOOTSTAGE_ID_RD_MAGIC:
100 case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
101 case BOOTSTAGE_ID_RD_CHECKSUM:
102 case BOOTSTAGE_ID_RAMDISK:
103 case BOOTSTAGE_ID_NO_RAMDISK:
Simon Glass578ac1e2011-12-10 11:07:54 +0000104 case BOOTSTAGE_ID_RUN_OS:
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800105 stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
106 break;
107 default:
108 stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
109 break;
110 }
111}
Mike Frysinger23fd9592008-10-11 22:40:22 -0400112#endif
113
Ben Warren7194ab82009-10-04 22:37:03 -0700114#ifdef CONFIG_SMC91111
115int board_eth_init(bd_t *bis)
116{
117 return smc91111_initialize(0, CONFIG_SMC91111_BASE);
118}
119#endif