]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - board/bf533-stamp/bf533-stamp.c
karo: tx6ul: configure JTAG_* pads for JTAG function unless disabled by env. variable
[karo-tx-uboot.git] / board / bf533-stamp / bf533-stamp.c
1 /*
2  * U-boot - main board file
3  *
4  * Copyright (c) 2005-2008 Analog Devices Inc.
5  *
6  * (C) Copyright 2000-2004
7  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8  *
9  * SPDX-License-Identifier:     GPL-2.0+
10  */
11
12 #include <common.h>
13 #include <netdev.h>
14 #include <asm/gpio.h>
15
16 DECLARE_GLOBAL_DATA_PTR;
17
18 int checkboard(void)
19 {
20         printf("Board: ADI BF533 Stamp board\n");
21         printf("       Support: http://blackfin.uclinux.org/\n");
22         return 0;
23 }
24
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  */
30 void swap_to(int device_id)
31 {
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);
36         SSYNC();
37 }
38
39 #if defined(CONFIG_MISC_INIT_R)
40 /* miscellaneous platform dependent initialisations */
41 int misc_init_r(void)
42 {
43 #ifdef CONFIG_STAMP_CF
44         cf_ide_init();
45 #endif
46
47         return 0;
48 }
49 #endif
50
51 #ifdef CONFIG_SHOW_BOOT_PROGRESS
52
53 #define STATUS_LED_OFF 0
54 #define STATUS_LED_ON  1
55
56 static int gpio_setup;
57
58 static void stamp_led_set(int LED1, int LED2, int LED3)
59 {
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         }
73 }
74
75 void show_boot_progress(int status)
76 {
77         switch (status) {
78         case BOOTSTAGE_ID_CHECK_MAGIC:
79                 stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
80                 break;
81         case BOOTSTAGE_ID_CHECK_HEADER:
82                 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
83                 break;
84         case BOOTSTAGE_ID_CHECK_CHECKSUM:
85                 stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
86                 break;
87         case BOOTSTAGE_ID_CHECK_ARCH:
88                 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
89                 break;
90         case BOOTSTAGE_ID_CHECK_IMAGETYPE:
91         case BOOTSTAGE_ID_DECOMP_IMAGE:
92                 stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
93                 break;
94         case BOOTSTAGE_ID_KERNEL_LOADED:
95         case BOOTSTAGE_ID_CHECK_BOOT_OS:
96                 stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
97                 break;
98         case BOOTSTAGE_ID_BOOT_OS_RETURNED:
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:
104         case BOOTSTAGE_ID_RUN_OS:
105                 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 }
112 #endif
113
114 #ifdef CONFIG_SMC91111
115 int board_eth_init(bd_t *bis)
116 {
117         return smc91111_initialize(0, CONFIG_SMC91111_BASE);
118 }
119 #endif