stv0991.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2014, STMicroelectronics - All Rights Reserved
  4. * Author(s): Vikas Manocha, <vikas.manocha@st.com> for STMicroelectronics.
  5. */
  6. #include <common.h>
  7. #include <dm.h>
  8. #include <miiphy.h>
  9. #include <asm/arch/stv0991_periph.h>
  10. #include <asm/arch/stv0991_defs.h>
  11. #include <asm/arch/hardware.h>
  12. #include <asm/arch/gpio.h>
  13. #include <netdev.h>
  14. #include <asm/io.h>
  15. #include <dm/platform_data/serial_pl01x.h>
  16. DECLARE_GLOBAL_DATA_PTR;
  17. struct gpio_regs *const gpioa_regs =
  18. (struct gpio_regs *) GPIOA_BASE_ADDR;
  19. #ifndef CONFIG_OF_CONTROL
  20. static const struct pl01x_serial_platdata serial_platdata = {
  21. .base = 0x80406000,
  22. .type = TYPE_PL011,
  23. .clock = 2700 * 1000,
  24. };
  25. U_BOOT_DEVICE(stv09911_serials) = {
  26. .name = "serial_pl01x",
  27. .platdata = &serial_platdata,
  28. };
  29. #endif
  30. #ifdef CONFIG_SHOW_BOOT_PROGRESS
  31. void show_boot_progress(int progress)
  32. {
  33. printf("%i\n", progress);
  34. }
  35. #endif
  36. void enable_eth_phy(void)
  37. {
  38. /* Set GPIOA_06 pad HIGH (Appli board)*/
  39. writel(readl(&gpioa_regs->dir) | 0x40, &gpioa_regs->dir);
  40. writel(readl(&gpioa_regs->data) | 0x40, &gpioa_regs->data);
  41. }
  42. int board_eth_enable(void)
  43. {
  44. stv0991_pinmux_config(ETH_GPIOB_10_31_C_0_4);
  45. clock_setup(ETH_CLOCK_CFG);
  46. enable_eth_phy();
  47. return 0;
  48. }
  49. int board_qspi_enable(void)
  50. {
  51. stv0991_pinmux_config(QSPI_CS_CLK_PAD);
  52. clock_setup(QSPI_CLOCK_CFG);
  53. return 0;
  54. }
  55. /*
  56. * Miscellaneous platform dependent initialisations
  57. */
  58. int board_init(void)
  59. {
  60. board_eth_enable();
  61. board_qspi_enable();
  62. return 0;
  63. }
  64. int board_uart_init(void)
  65. {
  66. stv0991_pinmux_config(UART_GPIOC_30_31);
  67. clock_setup(UART_CLOCK_CFG);
  68. return 0;
  69. }
  70. #ifdef CONFIG_BOARD_EARLY_INIT_F
  71. int board_early_init_f(void)
  72. {
  73. board_uart_init();
  74. return 0;
  75. }
  76. #endif
  77. int dram_init(void)
  78. {
  79. gd->ram_size = PHYS_SDRAM_1_SIZE;
  80. return 0;
  81. }
  82. int dram_init_banksize(void)
  83. {
  84. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  85. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  86. return 0;
  87. }
  88. #ifdef CONFIG_CMD_NET
  89. int board_eth_init(bd_t *bis)
  90. {
  91. int ret = 0;
  92. #if defined(CONFIG_ETH_DESIGNWARE)
  93. u32 interface = PHY_INTERFACE_MODE_MII;
  94. if (designware_initialize(GMAC_BASE_ADDR, interface) >= 0)
  95. ret++;
  96. #endif
  97. return ret;
  98. }
  99. #endif