bf533-stamp.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. * 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
  24. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
  25. * MA 02110-1301 USA
  26. */
  27. #include <common.h>
  28. #include <netdev.h>
  29. #include <asm/gpio.h>
  30. DECLARE_GLOBAL_DATA_PTR;
  31. int checkboard(void)
  32. {
  33. printf("Board: ADI BF533 Stamp board\n");
  34. printf(" Support: http://blackfin.uclinux.org/\n");
  35. return 0;
  36. }
  37. /* PF0 and PF1 are used to switch between the ethernet and flash:
  38. * PF0 PF1
  39. * flash: 0 0
  40. * ether: 1 0
  41. */
  42. void swap_to(int device_id)
  43. {
  44. gpio_request(GPIO_PF0, "eth_flash_swap");
  45. gpio_request(GPIO_PF1, "eth_flash_swap");
  46. gpio_direction_output(GPIO_PF0, device_id == ETHERNET);
  47. gpio_direction_output(GPIO_PF1, 0);
  48. SSYNC();
  49. }
  50. #if defined(CONFIG_MISC_INIT_R)
  51. /* miscellaneous platform dependent initialisations */
  52. int misc_init_r(void)
  53. {
  54. #ifdef CONFIG_STAMP_CF
  55. cf_ide_init();
  56. #endif
  57. return 0;
  58. }
  59. #endif
  60. #ifdef CONFIG_SHOW_BOOT_PROGRESS
  61. #define STATUS_LED_OFF 0
  62. #define STATUS_LED_ON 1
  63. static int gpio_setup;
  64. static void stamp_led_set(int LED1, int LED2, int LED3)
  65. {
  66. if (!gpio_setup) {
  67. gpio_request(GPIO_PF2, "boot_progress");
  68. gpio_request(GPIO_PF3, "boot_progress");
  69. gpio_request(GPIO_PF4, "boot_progress");
  70. gpio_direction_output(GPIO_PF2, LED1);
  71. gpio_direction_output(GPIO_PF3, LED2);
  72. gpio_direction_output(GPIO_PF4, LED3);
  73. gpio_setup = 1;
  74. } else {
  75. gpio_set_value(GPIO_PF2, LED1);
  76. gpio_set_value(GPIO_PF3, LED2);
  77. gpio_set_value(GPIO_PF4, LED3);
  78. }
  79. }
  80. void show_boot_progress(int status)
  81. {
  82. switch (status) {
  83. case 1:
  84. stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_ON);
  85. break;
  86. case 2:
  87. stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_OFF);
  88. break;
  89. case 3:
  90. stamp_led_set(STATUS_LED_OFF, STATUS_LED_ON, STATUS_LED_ON);
  91. break;
  92. case 4:
  93. stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_OFF);
  94. break;
  95. case 5:
  96. case 6:
  97. stamp_led_set(STATUS_LED_ON, STATUS_LED_OFF, STATUS_LED_ON);
  98. break;
  99. case 7:
  100. case 8:
  101. stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_OFF);
  102. break;
  103. case 9:
  104. case 10:
  105. case 11:
  106. case 12:
  107. case 13:
  108. case 14:
  109. case 15:
  110. stamp_led_set(STATUS_LED_OFF, STATUS_LED_OFF, STATUS_LED_OFF);
  111. break;
  112. default:
  113. stamp_led_set(STATUS_LED_ON, STATUS_LED_ON, STATUS_LED_ON);
  114. break;
  115. }
  116. }
  117. #endif
  118. #ifdef CONFIG_SMC91111
  119. int board_eth_init(bd_t *bis)
  120. {
  121. return smc91111_initialize(0, CONFIG_SMC91111_BASE);
  122. }
  123. #endif