blob: 185a651bec8e9b93e22f05a863efc125022cae89 [file] [log] [blame]
Aubrey.Li9da597f2007-03-09 13:38:44 +08001/*
Bin Meng75574052016-02-05 19:30:11 -08002 * U-Boot - main board file
Aubrey.Li9da597f2007-03-09 13:38:44 +08003 *
Mike Frysinger9427ef82008-10-11 22:40:22 -04004 * Copyright (c) 2005-2008 Analog Devices Inc.
Aubrey.Li9da597f2007-03-09 13:38:44 +08005 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02009 * SPDX-License-Identifier: GPL-2.0+
Aubrey.Li9da597f2007-03-09 13:38:44 +080010 */
11
12#include <common.h>
Ben Warren0fd6aae2009-10-04 22:37:03 -070013#include <netdev.h>
Mike Frysinger06a5d3c2010-06-02 06:18:57 -040014#include <asm/gpio.h>
Aubrey.Li9da597f2007-03-09 13:38:44 +080015
Wolfgang Denkd112a2c2007-09-15 20:48:41 +020016DECLARE_GLOBAL_DATA_PTR;
17
Aubrey.Li9da597f2007-03-09 13:38:44 +080018int checkboard(void)
19{
Aubrey.Li9da597f2007-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 Frysinger942f0f592008-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.Li9da597f2007-03-09 13:38:44 +080030void swap_to(int device_id)
31{
Mike Frysinger06a5d3c2010-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 Frysinger942f0f592008-10-11 22:38:37 -040036 SSYNC();
Aubrey.Li9da597f2007-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{
Aubrey.Li9da597f2007-03-09 13:38:44 +080043#ifdef CONFIG_STAMP_CF
Mike Frysinger3ce09502009-11-30 13:08:39 -050044 cf_ide_init();
45#endif
Aubrey.Li9da597f2007-03-09 13:38:44 +080046
Mike Frysinger3ce09502009-11-30 13:08:39 -050047 return 0;
Aubrey.Li9da597f2007-03-09 13:38:44 +080048}
49#endif
50
Mike Frysinger9427ef82008-10-11 22:40:22 -040051#ifdef CONFIG_SHOW_BOOT_PROGRESS
52
Uri Mashiach4892d392017-01-19 10:51:45 +020053#define CONFIG_LED_STATUS_OFF 0
54#define CONFIG_LED_STATUS_ON 1
Mike Frysinger9427ef82008-10-11 22:40:22 -040055
Mike Frysinger06a5d3c2010-06-02 06:18:57 -040056static int gpio_setup;
57
Mike Frysinger9427ef82008-10-11 22:40:22 -040058static void stamp_led_set(int LED1, int LED2, int LED3)
Aubrey.Li9da597f2007-03-09 13:38:44 +080059{
Mike Frysinger06a5d3c2010-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.Li9da597f2007-03-09 13:38:44 +080073}
74
75void show_boot_progress(int status)
76{
77 switch (status) {
Simon Glass53624e02012-01-14 15:24:47 +000078 case BOOTSTAGE_ID_CHECK_MAGIC:
Uri Mashiach4892d392017-01-19 10:51:45 +020079 stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_OFF,
80 CONFIG_LED_STATUS_ON);
Aubrey.Li9da597f2007-03-09 13:38:44 +080081 break;
Simon Glass53624e02012-01-14 15:24:47 +000082 case BOOTSTAGE_ID_CHECK_HEADER:
Uri Mashiach4892d392017-01-19 10:51:45 +020083 stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_ON,
84 CONFIG_LED_STATUS_OFF);
Aubrey.Li9da597f2007-03-09 13:38:44 +080085 break;
Simon Glass53624e02012-01-14 15:24:47 +000086 case BOOTSTAGE_ID_CHECK_CHECKSUM:
Uri Mashiach4892d392017-01-19 10:51:45 +020087 stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_ON,
88 CONFIG_LED_STATUS_ON);
Aubrey.Li9da597f2007-03-09 13:38:44 +080089 break;
Simon Glass53624e02012-01-14 15:24:47 +000090 case BOOTSTAGE_ID_CHECK_ARCH:
Uri Mashiach4892d392017-01-19 10:51:45 +020091 stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_OFF,
92 CONFIG_LED_STATUS_OFF);
Aubrey.Li9da597f2007-03-09 13:38:44 +080093 break;
Simon Glass53624e02012-01-14 15:24:47 +000094 case BOOTSTAGE_ID_CHECK_IMAGETYPE:
95 case BOOTSTAGE_ID_DECOMP_IMAGE:
Uri Mashiach4892d392017-01-19 10:51:45 +020096 stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_OFF,
97 CONFIG_LED_STATUS_ON);
Aubrey.Li9da597f2007-03-09 13:38:44 +080098 break;
Simon Glass53624e02012-01-14 15:24:47 +000099 case BOOTSTAGE_ID_KERNEL_LOADED:
100 case BOOTSTAGE_ID_CHECK_BOOT_OS:
Uri Mashiach4892d392017-01-19 10:51:45 +0200101 stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_ON,
102 CONFIG_LED_STATUS_OFF);
Aubrey.Li9da597f2007-03-09 13:38:44 +0800103 break;
Simon Glass53624e02012-01-14 15:24:47 +0000104 case BOOTSTAGE_ID_BOOT_OS_RETURNED:
Simon Glass3038f802011-12-10 11:07:57 +0000105 case BOOTSTAGE_ID_RD_MAGIC:
106 case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
107 case BOOTSTAGE_ID_RD_CHECKSUM:
108 case BOOTSTAGE_ID_RAMDISK:
109 case BOOTSTAGE_ID_NO_RAMDISK:
Simon Glass29395642011-12-10 11:07:54 +0000110 case BOOTSTAGE_ID_RUN_OS:
Uri Mashiach4892d392017-01-19 10:51:45 +0200111 stamp_led_set(CONFIG_LED_STATUS_OFF, CONFIG_LED_STATUS_OFF,
112 CONFIG_LED_STATUS_OFF);
Aubrey.Li9da597f2007-03-09 13:38:44 +0800113 break;
114 default:
Uri Mashiach4892d392017-01-19 10:51:45 +0200115 stamp_led_set(CONFIG_LED_STATUS_ON, CONFIG_LED_STATUS_ON,
116 CONFIG_LED_STATUS_ON);
Aubrey.Li9da597f2007-03-09 13:38:44 +0800117 break;
118 }
119}
Mike Frysinger9427ef82008-10-11 22:40:22 -0400120#endif
121
Ben Warren0fd6aae2009-10-04 22:37:03 -0700122#ifdef CONFIG_SMC91111
123int board_eth_init(bd_t *bis)
124{
125 return smc91111_initialize(0, CONFIG_SMC91111_BASE);
126}
127#endif