bf527-ezkit.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * U-Boot - main board file
  3. *
  4. * Copyright (c) 2005-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <common.h>
  9. #include <config.h>
  10. #include <command.h>
  11. #include <net.h>
  12. #include <netdev.h>
  13. #include <asm/blackfin.h>
  14. #include <asm/gpio.h>
  15. #include <asm/mach-common/bits/otp.h>
  16. DECLARE_GLOBAL_DATA_PTR;
  17. int checkboard(void)
  18. {
  19. printf("Board: ADI BF527 EZ-Kit board\n");
  20. printf(" Support: http://blackfin.uclinux.org/\n");
  21. return 0;
  22. }
  23. #ifdef CONFIG_BFIN_MAC
  24. static void board_init_enetaddr(uchar *mac_addr)
  25. {
  26. /* the MAC is stored in OTP memory page 0xDF */
  27. uint32_t ret;
  28. uint64_t otp_mac;
  29. ret = bfrom_OtpRead(0xDF, OTP_LOWER_HALF, &otp_mac);
  30. if (!(ret & OTP_MASTER_ERROR)) {
  31. uchar *otp_mac_p = (uchar *)&otp_mac;
  32. for (ret = 0; ret < 6; ++ret)
  33. mac_addr[ret] = otp_mac_p[5 - ret];
  34. if (is_valid_ethaddr(mac_addr))
  35. eth_setenv_enetaddr("ethaddr", mac_addr);
  36. }
  37. }
  38. int board_eth_init(bd_t *bis)
  39. {
  40. return bfin_EMAC_initialize(bis);
  41. }
  42. #endif
  43. int misc_init_r(void)
  44. {
  45. #ifdef CONFIG_BFIN_MAC
  46. uchar enetaddr[6];
  47. if (!eth_getenv_enetaddr("ethaddr", enetaddr))
  48. board_init_enetaddr(enetaddr);
  49. #endif
  50. return 0;
  51. }
  52. #ifdef CONFIG_USB_BLACKFIN
  53. void board_musb_init(void)
  54. {
  55. /*
  56. * BF527 EZ-KITs require PG13 to be high for HOST mode
  57. */
  58. gpio_request(GPIO_PG13, "musb-vbus");
  59. gpio_direction_output(GPIO_PG13, 1);
  60. }
  61. #endif