socfpga_cyclone5.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C) 2012 Altera Corporation <www.altera.com>
  3. *
  4. * SPDX-License-Identifier: GPL-2.0+
  5. */
  6. #include <common.h>
  7. #include <asm/arch/reset_manager.h>
  8. #include <asm/io.h>
  9. #include <usb.h>
  10. #include <usb/s3c_udc.h>
  11. #include <usb_mass_storage.h>
  12. #include <micrel.h>
  13. #include <netdev.h>
  14. #include <phy.h>
  15. DECLARE_GLOBAL_DATA_PTR;
  16. /*
  17. * Print Board information
  18. */
  19. int checkboard(void)
  20. {
  21. puts("BOARD: Altera SoCFPGA Cyclone5 Board\n");
  22. return 0;
  23. }
  24. /*
  25. * Initialization function which happen at early stage of c code
  26. */
  27. int board_early_init_f(void)
  28. {
  29. return 0;
  30. }
  31. /*
  32. * Miscellaneous platform dependent initialisations
  33. */
  34. int board_init(void)
  35. {
  36. /* Address of boot parameters for ATAG (if ATAG is used) */
  37. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  38. return 0;
  39. }
  40. /*
  41. * PHY configuration
  42. */
  43. #ifdef CONFIG_PHY_MICREL_KSZ9021
  44. int board_phy_config(struct phy_device *phydev)
  45. {
  46. int ret;
  47. /*
  48. * These skew settings for the KSZ9021 ethernet phy is required for ethernet
  49. * to work reliably on most flavors of cyclone5 boards.
  50. */
  51. ret = ksz9021_phy_extended_write(phydev,
  52. MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW,
  53. 0x0);
  54. if (ret)
  55. return ret;
  56. ret = ksz9021_phy_extended_write(phydev,
  57. MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW,
  58. 0x0);
  59. if (ret)
  60. return ret;
  61. ret = ksz9021_phy_extended_write(phydev,
  62. MII_KSZ9021_EXT_RGMII_CLOCK_SKEW,
  63. 0xf0f0);
  64. if (ret)
  65. return ret;
  66. if (phydev->drv->config)
  67. return phydev->drv->config(phydev);
  68. return 0;
  69. }
  70. #endif
  71. #ifdef CONFIG_USB_GADGET
  72. struct s3c_plat_otg_data socfpga_otg_data = {
  73. .regs_otg = CONFIG_USB_DWC2_REG_ADDR,
  74. .usb_gusbcfg = 0x1417,
  75. };
  76. int board_usb_init(int index, enum usb_init_type init)
  77. {
  78. return s3c_udc_probe(&socfpga_otg_data);
  79. }
  80. int g_dnl_board_usb_cable_connected(void)
  81. {
  82. return 1;
  83. }
  84. #endif