sc_sps_1.c 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * SchulerControl GmbH, SC_SPS_1 module
  4. *
  5. * Copyright (C) 2012 Marek Vasut <marex@denx.de>
  6. * on behalf of DENX Software Engineering GmbH
  7. */
  8. #include <common.h>
  9. #include <asm/gpio.h>
  10. #include <asm/io.h>
  11. #include <asm/arch/imx-regs.h>
  12. #include <asm/arch/iomux-mx28.h>
  13. #include <asm/arch/clock.h>
  14. #include <asm/arch/sys_proto.h>
  15. #include <linux/mii.h>
  16. #include <miiphy.h>
  17. #include <netdev.h>
  18. #include <errno.h>
  19. DECLARE_GLOBAL_DATA_PTR;
  20. /*
  21. * Functions
  22. */
  23. int board_early_init_f(void)
  24. {
  25. /* IO0 clock at 480MHz */
  26. mxs_set_ioclk(MXC_IOCLK0, 480000);
  27. /* IO1 clock at 480MHz */
  28. mxs_set_ioclk(MXC_IOCLK1, 480000);
  29. /* SSP0 clock at 96MHz */
  30. mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
  31. /* SSP2 clock at 96MHz */
  32. mxs_set_sspclk(MXC_SSPCLK2, 96000, 0);
  33. #ifdef CONFIG_CMD_USB
  34. mxs_iomux_setup_pad(MX28_PAD_AUART1_CTS__USB0_OVERCURRENT);
  35. mxs_iomux_setup_pad(MX28_PAD_AUART2_TX__GPIO_3_9 |
  36. MXS_PAD_4MA | MXS_PAD_3V3 | MXS_PAD_NOPULL);
  37. gpio_direction_output(MX28_PAD_AUART2_TX__GPIO_3_9, 1);
  38. #endif
  39. return 0;
  40. }
  41. int board_init(void)
  42. {
  43. /* Adress of boot parameters */
  44. gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
  45. return 0;
  46. }
  47. int dram_init(void)
  48. {
  49. return mxs_dram_init();
  50. }
  51. #ifdef CONFIG_CMD_MMC
  52. int board_mmc_init(bd_t *bis)
  53. {
  54. return mxsmmc_initialize(bis, 0, NULL, NULL);
  55. }
  56. #endif
  57. #ifdef CONFIG_CMD_NET
  58. int board_eth_init(bd_t *bis)
  59. {
  60. struct mxs_clkctrl_regs *clkctrl_regs =
  61. (struct mxs_clkctrl_regs *)MXS_CLKCTRL_BASE;
  62. int ret;
  63. ret = cpu_eth_init(bis);
  64. clrsetbits_le32(&clkctrl_regs->hw_clkctrl_enet,
  65. CLKCTRL_ENET_TIME_SEL_MASK,
  66. CLKCTRL_ENET_TIME_SEL_RMII_CLK | CLKCTRL_ENET_CLK_OUT_EN);
  67. ret = fecmxc_initialize_multi(bis, 0, 0, MXS_ENET0_BASE);
  68. if (ret) {
  69. printf("FEC MXS: Unable to init FEC0\n");
  70. return ret;
  71. }
  72. ret = fecmxc_initialize_multi(bis, 1, 1, MXS_ENET1_BASE);
  73. if (ret) {
  74. printf("FEC MXS: Unable to init FEC1\n");
  75. return ret;
  76. }
  77. return ret;
  78. }
  79. #endif