Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 1 | /* |
Bin Meng | 7557405 | 2016-02-05 19:30:11 -0800 | [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 | * |
Wolfgang Denk | d79de1d | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 9 | * SPDX-License-Identifier: GPL-2.0+ |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 10 | */ |
| 11 | |
| 12 | #include <common.h> |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 13 | #include <netdev.h> |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 14 | #include <asm/gpio.h> |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 15 | |
Wolfgang Denk | d112a2c | 2007-09-15 20:48:41 +0200 | [diff] [blame] | 16 | DECLARE_GLOBAL_DATA_PTR; |
| 17 | |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 18 | int checkboard(void) |
| 19 | { |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 20 | printf("Board: ADI BF533 Stamp board\n"); |
| 21 | printf(" Support: http://blackfin.uclinux.org/\n"); |
| 22 | return 0; |
| 23 | } |
| 24 | |
Mike Frysinger | 942f0f59 | 2008-10-11 22:38:37 -0400 | [diff] [blame] | 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 | */ |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 30 | void swap_to(int device_id) |
| 31 | { |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 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); |
Mike Frysinger | 942f0f59 | 2008-10-11 22:38:37 -0400 | [diff] [blame] | 36 | SSYNC(); |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 37 | } |
| 38 | |
| 39 | #if defined(CONFIG_MISC_INIT_R) |
| 40 | /* miscellaneous platform dependent initialisations */ |
| 41 | int misc_init_r(void) |
| 42 | { |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 43 | #ifdef CONFIG_STAMP_CF |
Mike Frysinger | 3ce0950 | 2009-11-30 13:08:39 -0500 | [diff] [blame] | 44 | cf_ide_init(); |
| 45 | #endif |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 46 | |
Mike Frysinger | 3ce0950 | 2009-11-30 13:08:39 -0500 | [diff] [blame] | 47 | return 0; |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 48 | } |
| 49 | #endif |
| 50 | |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 51 | #ifdef CONFIG_SHOW_BOOT_PROGRESS |
| 52 | |
| 53 | #define STATUS_LED_OFF 0 |
| 54 | #define STATUS_LED_ON 1 |
| 55 | |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 56 | static int gpio_setup; |
| 57 | |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 58 | static void stamp_led_set(int LED1, int LED2, int LED3) |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 59 | { |
Mike Frysinger | 06a5d3c | 2010-06-02 06:18:57 -0400 | [diff] [blame] | 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 | } |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | void show_boot_progress(int status) |
| 76 | { |
| 77 | switch (status) { |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 78 | case BOOTSTAGE_ID_CHECK_MAGIC: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 79 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON); |
| 80 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 81 | case BOOTSTAGE_ID_CHECK_HEADER: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 82 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF); |
| 83 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 84 | case BOOTSTAGE_ID_CHECK_CHECKSUM: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 85 | stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON); |
| 86 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 87 | case BOOTSTAGE_ID_CHECK_ARCH: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 88 | stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF); |
| 89 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 90 | case BOOTSTAGE_ID_CHECK_IMAGETYPE: |
| 91 | case BOOTSTAGE_ID_DECOMP_IMAGE: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 92 | stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON); |
| 93 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 94 | case BOOTSTAGE_ID_KERNEL_LOADED: |
| 95 | case BOOTSTAGE_ID_CHECK_BOOT_OS: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 96 | stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF); |
| 97 | break; |
Simon Glass | 53624e0 | 2012-01-14 15:24:47 +0000 | [diff] [blame] | 98 | case BOOTSTAGE_ID_BOOT_OS_RETURNED: |
Simon Glass | 3038f80 | 2011-12-10 11:07:57 +0000 | [diff] [blame] | 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: |
Simon Glass | 2939564 | 2011-12-10 11:07:54 +0000 | [diff] [blame] | 104 | case BOOTSTAGE_ID_RUN_OS: |
Aubrey.Li | 9da597f | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 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 | } |
Mike Frysinger | 9427ef8 | 2008-10-11 22:40:22 -0400 | [diff] [blame] | 112 | #endif |
| 113 | |
Ben Warren | 0fd6aae | 2009-10-04 22:37:03 -0700 | [diff] [blame] | 114 | #ifdef CONFIG_SMC91111 |
| 115 | int board_eth_init(bd_t *bis) |
| 116 | { |
| 117 | return smc91111_initialize(0, CONFIG_SMC91111_BASE); |
| 118 | } |
| 119 | #endif |