socfpga.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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. * Miscellaneous platform dependent initialisations
  18. */
  19. int board_init(void)
  20. {
  21. /* Address of boot parameters for ATAG (if ATAG is used) */
  22. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  23. return 0;
  24. }
  25. /*
  26. * PHY configuration
  27. */
  28. #ifdef CONFIG_PHY_MICREL_KSZ9021
  29. int board_phy_config(struct phy_device *phydev)
  30. {
  31. int ret;
  32. /*
  33. * These skew settings for the KSZ9021 ethernet phy is required for ethernet
  34. * to work reliably on most flavors of cyclone5 boards.
  35. */
  36. ret = ksz9021_phy_extended_write(phydev,
  37. MII_KSZ9021_EXT_RGMII_RX_DATA_SKEW,
  38. 0x0);
  39. if (ret)
  40. return ret;
  41. ret = ksz9021_phy_extended_write(phydev,
  42. MII_KSZ9021_EXT_RGMII_TX_DATA_SKEW,
  43. 0x0);
  44. if (ret)
  45. return ret;
  46. ret = ksz9021_phy_extended_write(phydev,
  47. MII_KSZ9021_EXT_RGMII_CLOCK_SKEW,
  48. 0xf0f0);
  49. if (ret)
  50. return ret;
  51. if (phydev->drv->config)
  52. return phydev->drv->config(phydev);
  53. return 0;
  54. }
  55. #endif
  56. #ifdef CONFIG_USB_GADGET
  57. struct s3c_plat_otg_data socfpga_otg_data = {
  58. .regs_otg = CONFIG_USB_DWC2_REG_ADDR,
  59. .usb_gusbcfg = 0x1417,
  60. };
  61. int board_usb_init(int index, enum usb_init_type init)
  62. {
  63. return s3c_udc_probe(&socfpga_otg_data);
  64. }
  65. int g_dnl_board_usb_cable_connected(void)
  66. {
  67. return 1;
  68. }
  69. #endif