bg0900.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * PPC-AG BG0900 board
  4. *
  5. * Copyright (C) 2013 Marek Vasut <marex@denx.de>
  6. */
  7. #include <common.h>
  8. #include <asm/gpio.h>
  9. #include <asm/io.h>
  10. #include <asm/arch/imx-regs.h>
  11. #include <asm/arch/iomux-mx28.h>
  12. #include <asm/arch/clock.h>
  13. #include <asm/arch/sys_proto.h>
  14. #include <linux/mii.h>
  15. #include <miiphy.h>
  16. #include <netdev.h>
  17. #include <errno.h>
  18. DECLARE_GLOBAL_DATA_PTR;
  19. /*
  20. * Functions
  21. */
  22. int board_early_init_f(void)
  23. {
  24. /* IO0 clock at 480MHz */
  25. mxs_set_ioclk(MXC_IOCLK0, 480000);
  26. /* IO1 clock at 480MHz */
  27. mxs_set_ioclk(MXC_IOCLK1, 480000);
  28. /* SSP2 clock at 160MHz */
  29. mxs_set_sspclk(MXC_SSPCLK2, 160000, 0);
  30. return 0;
  31. }
  32. int dram_init(void)
  33. {
  34. return mxs_dram_init();
  35. }
  36. int board_init(void)
  37. {
  38. /* Adress of boot parameters */
  39. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  40. return 0;
  41. }
  42. #ifdef CONFIG_CMD_NET
  43. int board_eth_init(bd_t *bis)
  44. {
  45. struct mxs_clkctrl_regs *clkctrl_regs =
  46. (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
  47. struct eth_device *dev;
  48. int ret;
  49. ret = cpu_eth_init(bis);
  50. /* BG0900 uses ENET_CLK PAD to drive FEC clock */
  51. writel(CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN,
  52. &clkctrl_regs->hw_clkctrl_enet);
  53. /* Reset FEC PHYs */
  54. gpio_direction_output(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 0);
  55. udelay(200);
  56. gpio_set_value(MX28_PAD_ENET0_RX_CLK__GPIO_4_13, 1);
  57. ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
  58. if (ret) {
  59. puts("FEC MXS: Unable to init FEC0\n");
  60. return ret;
  61. }
  62. dev = eth_get_dev_by_name("FEC0");
  63. if (!dev) {
  64. puts("FEC MXS: Unable to get FEC0 device entry\n");
  65. return -EINVAL;
  66. }
  67. return ret;
  68. }
  69. #endif