]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/bf533-stamp/bf533-stamp.c
Add GPL-2.0+ SPDX-License-Identifier to source files
[people/ms/u-boot.git] / board / bf533-stamp / bf533-stamp.c
CommitLineData
6cb142fa 1/*
23fd959e 2 * U-boot - main board file
6cb142fa 3 *
23fd959e 4 * Copyright (c) 2005-2008 Analog Devices Inc.
6cb142fa
WD
5 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
1a459660 9 * SPDX-License-Identifier: GPL-2.0+
6cb142fa
WD
10 */
11
12#include <common.h>
7194ab80 13#include <netdev.h>
6cfcf584 14#include <asm/gpio.h>
d87080b7 15
1218abf1
WD
16DECLARE_GLOBAL_DATA_PTR;
17
3f0606ad 18int checkboard(void)
6cb142fa 19{
3f0606ad
AL
20 printf("Board: ADI BF533 Stamp board\n");
21 printf(" Support: http://blackfin.uclinux.org/\n");
6cb142fa
WD
22 return 0;
23}
24
1f75d6f0
MF
25/* PF0 and PF1 are used to switch between the ethernet and flash:
26 * PF0 PF1
27 * flash: 0 0
28 * ether: 1 0
29 */
3f0606ad 30void swap_to(int device_id)
6cb142fa 31{
6cfcf584
MF
32 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);
1f75d6f0 36 SSYNC();
6cb142fa
WD
37}
38
39#if defined(CONFIG_MISC_INIT_R)
40/* miscellaneous platform dependent initialisations */
3f0606ad 41int misc_init_r(void)
6cb142fa 42{
6cb142fa 43#ifdef CONFIG_STAMP_CF
5f79644d
MF
44 cf_ide_init();
45#endif
6cb142fa 46
5f79644d 47 return 0;
6cb142fa
WD
48}
49#endif
50
23fd959e
MF
51#ifdef CONFIG_SHOW_BOOT_PROGRESS
52
53#define STATUS_LED_OFF 0
54#define STATUS_LED_ON 1
55
6cfcf584
MF
56static int gpio_setup;
57
23fd959e 58static void stamp_led_set(int LED1, int LED2, int LED3)
6cb142fa 59{
6cfcf584
MF
60 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 }
6cb142fa
WD
73}
74
3f0606ad 75void show_boot_progress(int status)
6cb142fa 76{
8e7b703a 77 switch (status) {
5dc88716 78 case BOOTSTAGE_ID_CHECK_MAGIC:
3f0606ad 79 stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
8e7b703a 80 break;
5dc88716 81 case BOOTSTAGE_ID_CHECK_HEADER:
3f0606ad 82 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
8e7b703a 83 break;
5dc88716 84 case BOOTSTAGE_ID_CHECK_CHECKSUM:
3f0606ad 85 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
8e7b703a 86 break;
5dc88716 87 case BOOTSTAGE_ID_CHECK_ARCH:
3f0606ad 88 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
8e7b703a 89 break;
5dc88716
SG
90 case BOOTSTAGE_ID_CHECK_IMAGETYPE:
91 case BOOTSTAGE_ID_DECOMP_IMAGE:
3f0606ad 92 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
8e7b703a 93 break;
5dc88716
SG
94 case BOOTSTAGE_ID_KERNEL_LOADED:
95 case BOOTSTAGE_ID_CHECK_BOOT_OS:
3f0606ad 96 stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
8e7b703a 97 break;
5dc88716 98 case BOOTSTAGE_ID_BOOT_OS_RETURNED:
5e410883
SG
99 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:
578ac1e9 104 case BOOTSTAGE_ID_RUN_OS:
3f0606ad 105 stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
8e7b703a
WD
106 break;
107 default:
3f0606ad 108 stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
8e7b703a 109 break;
6cb142fa
WD
110 }
111}
23fd959e
MF
112#endif
113
7194ab80
BW
114#ifdef CONFIG_SMC91111
115int board_eth_init(bd_t *bis)
116{
117 return smc91111_initialize(0, CONFIG_SMC91111_BASE);
118}
119#endif