bf533-stamp.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. #include <common.h>
  12. #include <netdev.h>
  13. #include <asm/gpio.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. int checkboard(void)
  16. {
  17. printf("Board: ADI BF533 Stamp board\n");
  18. printf(" Support: http://blackfin.uclinux.org/\n");
  19. return 0;
  20. }
  21. /* PF0 and PF1 are used to switch between the ethernet and flash:
  22. * PF0 PF1
  23. * flash: 0 0
  24. * ether: 1 0
  25. */
  26. void swap_to(int device_id)
  27. {
  28. gpio_request(GPIO_PF0, "eth_flash_swap");
  29. gpio_request(GPIO_PF1, "eth_flash_swap");
  30. gpio_direction_output(GPIO_PF0, device_id == ETHERNET);
  31. gpio_direction_output(GPIO_PF1, 0);
  32. SSYNC();
  33. }
  34. #if defined(CONFIG_MISC_INIT_R)
  35. /* miscellaneous platform dependent initialisations */
  36. int misc_init_r(void)
  37. {
  38. #ifdef CONFIG_STAMP_CF
  39. cf_ide_init();
  40. #endif
  41. return 0;
  42. }
  43. #endif
  44. #ifdef CONFIG_SHOW_BOOT_PROGRESS
  45. #define STATUS_LED_OFF 0
  46. #define STATUS_LED_ON 1
  47. static int gpio_setup;
  48. static void stamp_led_set(int LED1, int LED2, int LED3)
  49. {
  50. if (!gpio_setup) {
  51. gpio_request(GPIO_PF2, "boot_progress");
  52. gpio_request(GPIO_PF3, "boot_progress");
  53. gpio_request(GPIO_PF4, "boot_progress");
  54. gpio_direction_output(GPIO_PF2, LED1);
  55. gpio_direction_output(GPIO_PF3, LED2);
  56. gpio_direction_output(GPIO_PF4, LED3);
  57. gpio_setup = 1;
  58. } else {
  59. gpio_set_value(GPIO_PF2, LED1);
  60. gpio_set_value(GPIO_PF3, LED2);
  61. gpio_set_value(GPIO_PF4, LED3);
  62. }
  63. }
  64. void show_boot_progress(int status)
  65. {
  66. switch (status) {
  67. case BOOTSTAGE_ID_CHECK_MAGIC:
  68. stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
  69. break;
  70. case BOOTSTAGE_ID_CHECK_HEADER:
  71. stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
  72. break;
  73. case BOOTSTAGE_ID_CHECK_CHECKSUM:
  74. stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
  75. break;
  76. case BOOTSTAGE_ID_CHECK_ARCH:
  77. stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
  78. break;
  79. case BOOTSTAGE_ID_CHECK_IMAGETYPE:
  80. case BOOTSTAGE_ID_DECOMP_IMAGE:
  81. stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
  82. break;
  83. case BOOTSTAGE_ID_KERNEL_LOADED:
  84. case BOOTSTAGE_ID_CHECK_BOOT_OS:
  85. stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
  86. break;
  87. case BOOTSTAGE_ID_BOOT_OS_RETURNED:
  88. case BOOTSTAGE_ID_RD_MAGIC:
  89. case BOOTSTAGE_ID_RD_HDR_CHECKSUM:
  90. case BOOTSTAGE_ID_RD_CHECKSUM:
  91. case BOOTSTAGE_ID_RAMDISK:
  92. case BOOTSTAGE_ID_NO_RAMDISK:
  93. case BOOTSTAGE_ID_RUN_OS:
  94. stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
  95. break;
  96. default:
  97. stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
  98. break;
  99. }
  100. }
  101. #endif
  102. #ifdef CONFIG_SMC91111
  103. int board_eth_init(bd_t *bis)
  104. {
  105. return smc91111_initialize(0, CONFIG_SMC91111_BASE);
  106. }
  107. #endif