board_k2e.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /*
  2. * K2E EVM : Board initialization
  3. *
  4. * (C) Copyright 2014
  5. * Texas Instruments Incorporated, <www.ti.com>
  6. *
  7. * SPDX-License-Identifier: GPL-2.0+
  8. */
  9. #include <common.h>
  10. #include <asm/arch/ddr3.h>
  11. #include <asm/arch/hardware.h>
  12. #include <asm/ti-common/keystone_net.h>
  13. DECLARE_GLOBAL_DATA_PTR;
  14. unsigned int external_clk[ext_clk_count] = {
  15. [sys_clk] = 100000000,
  16. [alt_core_clk] = 100000000,
  17. [pa_clk] = 100000000,
  18. [ddr3_clk] = 100000000,
  19. [mcm_clk] = 312500000,
  20. [pcie_clk] = 100000000,
  21. [sgmii_clk] = 156250000,
  22. [xgmii_clk] = 156250000,
  23. [usb_clk] = 100000000,
  24. };
  25. static struct pll_init_data core_pll_config[] = {
  26. CORE_PLL_800,
  27. CORE_PLL_850,
  28. CORE_PLL_1000,
  29. CORE_PLL_1250,
  30. CORE_PLL_1350,
  31. CORE_PLL_1400,
  32. CORE_PLL_1500,
  33. };
  34. static struct pll_init_data pa_pll_config =
  35. PASS_PLL_1000;
  36. #ifdef CONFIG_DRIVER_TI_KEYSTONE_NET
  37. struct eth_priv_t eth_priv_cfg[] = {
  38. {
  39. .int_name = "K2E_EMAC0",
  40. .rx_flow = 0,
  41. .phy_addr = 0,
  42. .slave_port = 1,
  43. .sgmii_link_type = SGMII_LINK_MAC_PHY,
  44. },
  45. {
  46. .int_name = "K2E_EMAC1",
  47. .rx_flow = 8,
  48. .phy_addr = 1,
  49. .slave_port = 2,
  50. .sgmii_link_type = SGMII_LINK_MAC_PHY,
  51. },
  52. {
  53. .int_name = "K2E_EMAC2",
  54. .rx_flow = 16,
  55. .phy_addr = 2,
  56. .slave_port = 3,
  57. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  58. },
  59. {
  60. .int_name = "K2E_EMAC3",
  61. .rx_flow = 24,
  62. .phy_addr = 3,
  63. .slave_port = 4,
  64. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  65. },
  66. {
  67. .int_name = "K2E_EMAC4",
  68. .rx_flow = 32,
  69. .phy_addr = 4,
  70. .slave_port = 5,
  71. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  72. },
  73. {
  74. .int_name = "K2E_EMAC5",
  75. .rx_flow = 40,
  76. .phy_addr = 5,
  77. .slave_port = 6,
  78. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  79. },
  80. {
  81. .int_name = "K2E_EMAC6",
  82. .rx_flow = 48,
  83. .phy_addr = 6,
  84. .slave_port = 7,
  85. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  86. },
  87. {
  88. .int_name = "K2E_EMAC7",
  89. .rx_flow = 56,
  90. .phy_addr = 7,
  91. .slave_port = 8,
  92. .sgmii_link_type = SGMII_LINK_MAC_MAC_FORCED,
  93. },
  94. };
  95. int get_num_eth_ports(void)
  96. {
  97. return sizeof(eth_priv_cfg) / sizeof(struct eth_priv_t);
  98. }
  99. #endif
  100. #if defined(CONFIG_BOARD_EARLY_INIT_F)
  101. int board_early_init_f(void)
  102. {
  103. int speed;
  104. speed = get_max_dev_speed();
  105. init_pll(&core_pll_config[speed]);
  106. init_pll(&pa_pll_config);
  107. return 0;
  108. }
  109. #endif
  110. #ifdef CONFIG_SPL_BUILD
  111. static struct pll_init_data spl_pll_config[] = {
  112. CORE_PLL_800,
  113. };
  114. void spl_init_keystone_plls(void)
  115. {
  116. init_plls(ARRAY_SIZE(spl_pll_config), spl_pll_config);
  117. }
  118. #endif