Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 1 | /* |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 2 | * U-boot - main board file |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 3 | * |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 4 | * Copyright (c) 2005-2008 Analog Devices Inc. |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 5 | * |
| 6 | * (C) Copyright 2000-2004 |
| 7 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 8 | * |
| 9 | * See file CREDITS for list of people who contributed to this |
| 10 | * project. |
| 11 | * |
| 12 | * This program is free software; you can redistribute it and/or |
| 13 | * modify it under the terms of the GNU General Public License as |
| 14 | * published by the Free Software Foundation; either version 2 of |
| 15 | * the License, or (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License |
| 23 | * along with this program; if not, write to the Free Software |
Aubrey Li | 314d22f | 2007-04-05 18:31:18 +0800 | [diff] [blame] | 24 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, |
| 25 | * MA 02110-1301 USA |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 26 | */ |
| 27 | |
| 28 | #include <common.h> |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 29 | #include <netdev.h> |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 30 | #include <asm/gpio.h> |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 31 | |
Wolfgang Denk | d112a2c | 2007-09-15 20:48:41 +0200 | [diff] [blame] | 32 | DECLARE_GLOBAL_DATA_PTR; |
| 33 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 34 | int checkboard(void) |
| 35 | { |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 36 | printf("Board: ADI BF533 Stamp board\n"); |
| 37 | printf(" Support: http://blackfin.uclinux.org/\n"); |
| 38 | return 0; |
| 39 | } |
| 40 | |
Mike Frysinger | 942f0f59 | 2008-10-11 22:38:37 -0400 | [diff] [blame] | 41 | /* PF0 and PF1 are used to switch between the ethernet and flash: |
| 42 | * PF0 PF1 |
| 43 | * flash: 0 0 |
| 44 | * ether: 1 0 |
| 45 | */ |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 46 | void swap_to(int device_id) |
| 47 | { |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 48 | gpio_request(GPIO_PF0, "eth_flash_swap"); |
| 49 | gpio_request(GPIO_PF1, "eth_flash_swap"); |
| 50 | gpio_direction_output(GPIO_PF0, device_id == ETHERNET); |
| 51 | gpio_direction_output(GPIO_PF1, 0); |
Mike Frysinger | 942f0f59 | 2008-10-11 22:38:37 -0400 | [diff] [blame] | 52 | SSYNC(); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | #if defined(CONFIG_MISC_INIT_R) |
| 56 | /* miscellaneous platform dependent initialisations */ |
| 57 | int misc_init_r(void) |
| 58 | { |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 59 | #ifdef CONFIG_STAMP_CF |
Mike Frysinger | 3ce0950 | 2009-11-30 13:08:39 -0500 | [diff] [blame] | 60 | cf_ide_init(); |
| 61 | #endif |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 62 | |
Mike Frysinger | 3ce0950 | 2009-11-30 13:08:39 -0500 | [diff] [blame] | 63 | return 0; |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 64 | } |
| 65 | #endif |
| 66 | |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 67 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 68 | |
| 69 | #define STATUS_LED_OFF 0 |
| 70 | #define STATUS_LED_ON 1 |
| 71 | |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 72 | static int gpio_setup; |
| 73 | |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 74 | static void stamp_led_set(int LED1, int LED2, int LED3) |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 75 | { |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 76 | if (!gpio_setup) { |
| 77 | gpio_request(GPIO_PF2, "boot_progress"); |
| 78 | gpio_request(GPIO_PF3, "boot_progress"); |
| 79 | gpio_request(GPIO_PF4, "boot_progress"); |
| 80 | gpio_direction_output(GPIO_PF2, LED1); |
| 81 | gpio_direction_output(GPIO_PF3, LED2); |
| 82 | gpio_direction_output(GPIO_PF4, LED3); |
| 83 | gpio_setup = 1; |
| 84 | } else { |
| 85 | gpio_set_value(GPIO_PF2, LED1); |
| 86 | gpio_set_value(GPIO_PF3, LED2); |
| 87 | gpio_set_value(GPIO_PF4, LED3); |
| 88 | } |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void show_boot_progress(int status) |
| 92 | { |
| 93 | switch (status) { |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 94 | case BOOTSTAGE_ID_CHECK_MAGIC: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 95 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON); |
| 96 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 97 | case BOOTSTAGE_ID_CHECK_HEADER: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 98 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF); |
| 99 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 100 | case BOOTSTAGE_ID_CHECK_CHECKSUM: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 101 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON); |
| 102 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 103 | case BOOTSTAGE_ID_CHECK_ARCH: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 104 | stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF); |
| 105 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 106 | case BOOTSTAGE_ID_CHECK_IMAGETYPE: |
| 107 | case BOOTSTAGE_ID_DECOMP_IMAGE: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 108 | stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON); |
| 109 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 110 | case BOOTSTAGE_ID_KERNEL_LOADED: |
| 111 | case BOOTSTAGE_ID_CHECK_BOOT_OS: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 112 | stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF); |
| 113 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 114 | case BOOTSTAGE_ID_BOOT_OS_RETURNED: |
Simon Glass | 3038f80 | 2011-12-10 11:07:57 +0000 | [diff] [blame^] | 115 | case BOOTSTAGE_ID_RD_MAGIC: |
| 116 | case BOOTSTAGE_ID_RD_HDR_CHECKSUM: |
| 117 | case BOOTSTAGE_ID_RD_CHECKSUM: |
| 118 | case BOOTSTAGE_ID_RAMDISK: |
| 119 | case BOOTSTAGE_ID_NO_RAMDISK: |
Simon Glass | 2939564 | 2011-12-10 11:07:54 +0000 | [diff] [blame] | 120 | case BOOTSTAGE_ID_RUN_OS: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 121 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF); |
| 122 | break; |
| 123 | default: |
| 124 | stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON); |
| 125 | break; |
| 126 | } |
| 127 | } |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 128 | #endif |
| 129 | |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 130 | #ifdef CONFIG_SMC91111 |
| 131 | int board_eth_init(bd_t *bis) |
| 132 | { |
| 133 | return smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 134 | } |
| 135 | #endif |