dnp5370.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * U-Boot - main board file
  3. *
  4. * (C) Copyright 2010 3ality Digital Systems
  5. *
  6. * Copyright (c) 2005-2008 Analog Devices Inc.
  7. *
  8. * (C) Copyright 2000-2004
  9. * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  10. *
  11. * SPDX-License-Identifier: GPL-2.0+
  12. */
  13. #include <common.h>
  14. #include <config.h>
  15. #include <asm/blackfin.h>
  16. #include <net.h>
  17. #include <netdev.h>
  18. #include <asm/gpio.h>
  19. static void disable_external_watchdog(void)
  20. {
  21. #ifdef CONFIG_DNP5370_EXT_WD_DISABLE
  22. /* disable external HW watchdog with PH13 = WD1 = 1 */
  23. gpio_request(GPIO_PH13, "ext_wd");
  24. gpio_direction_output(GPIO_PH13, 1);
  25. #endif
  26. }
  27. int checkboard(void)
  28. {
  29. printf("Board: SSV DilNet DNP5370\n");
  30. return 0;
  31. }
  32. #ifdef CONFIG_BFIN_MAC
  33. static void board_init_enetaddr(uchar *mac_addr)
  34. {
  35. #ifndef CONFIG_SYS_NO_FLASH
  36. /* we cram the MAC in the last flash sector */
  37. uchar *board_mac_addr = (uchar *)0x202F0000;
  38. if (is_valid_ethaddr(board_mac_addr)) {
  39. memcpy(mac_addr, board_mac_addr, 6);
  40. eth_setenv_enetaddr("ethaddr", mac_addr);
  41. }
  42. #endif
  43. }
  44. int board_eth_init(bd_t *bis)
  45. {
  46. return bfin_EMAC_initialize(bis);
  47. }
  48. #endif
  49. /* miscellaneous platform dependent initialisations */
  50. int misc_init_r(void)
  51. {
  52. disable_external_watchdog();
  53. #ifdef CONFIG_BFIN_MAC
  54. uchar enetaddr[6];
  55. if (!eth_getenv_enetaddr("ethaddr", enetaddr))
  56. board_init_enetaddr(enetaddr);
  57. #endif
  58. #ifndef CONFIG_SYS_NO_FLASH
  59. /* we use the last sector for the MAC address / POST LDR */
  60. extern flash_info_t flash_info[];
  61. flash_protect(FLAG_PROTECT_SET, 0x202F0000, 0x202FFFFF, &flash_info[0]);
  62. #endif
  63. return 0;
  64. }