cm-bf527.c 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 <net.h>
  11. #include <netdev.h>
  12. #include <asm/blackfin.h>
  13. #include <asm/mach-common/bits/otp.h>
  14. #include "../cm-bf537e/gpio_cfi_flash.h"
  15. DECLARE_GLOBAL_DATA_PTR;
  16. int checkboard(void)
  17. {
  18. printf("Board: Bluetechnix CM-BF527 board\n");
  19. printf(" Support: http://www.bluetechnix.at/\n");
  20. return 0;
  21. }
  22. #ifdef CONFIG_BFIN_MAC
  23. static void board_init_enetaddr(uchar *mac_addr)
  24. {
  25. /* the MAC is stored in OTP memory page 0xDF */
  26. uint32_t ret;
  27. uint64_t otp_mac;
  28. ret = bfrom_OtpRead(0xDF, OTP_LOWER_HALF, &otp_mac);
  29. if (!(ret & OTP_MASTER_ERROR)) {
  30. uchar *otp_mac_p = (uchar *)&otp_mac;
  31. for (ret = 0; ret < 6; ++ret)
  32. mac_addr[ret] = otp_mac_p[5 - ret];
  33. if (is_valid_ethaddr(mac_addr))
  34. eth_setenv_enetaddr("ethaddr", mac_addr);
  35. }
  36. }
  37. int board_eth_init(bd_t *bis)
  38. {
  39. return bfin_EMAC_initialize(bis);
  40. }
  41. #endif
  42. int misc_init_r(void)
  43. {
  44. #ifdef CONFIG_BFIN_MAC
  45. uchar enetaddr[6];
  46. if (!eth_getenv_enetaddr("ethaddr", enetaddr))
  47. board_init_enetaddr(enetaddr);
  48. #endif
  49. gpio_cfi_flash_init();
  50. return 0;
  51. }