stv0991.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. /*
  2. * (C) Copyright 2014
  3. * Vikas Manocha, ST Micoelectronics, vikas.manocha@st.com.
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.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/platdata.h>
  16. #include <dm/platform_data/serial_pl01x.h>
  17. DECLARE_GLOBAL_DATA_PTR;
  18. struct gpio_regs *const gpioa_regs =
  19. (struct gpio_regs *) GPIOA_BASE_ADDR;
  20. #ifndef CONFIG_OF_CONTROL
  21. static const struct pl01x_serial_platdata serial_platdata = {
  22. .base = 0x80406000,
  23. .type = TYPE_PL011,
  24. .clock = 2700 * 1000,
  25. };
  26. U_BOOT_DEVICE(stv09911_serials) = {
  27. .name = "serial_pl01x",
  28. .platdata = &serial_platdata,
  29. };
  30. #endif
  31. #ifdef CONFIG_SHOW_BOOT_PROGRESS
  32. void show_boot_progress(int progress)
  33. {
  34. printf("%i\n", progress);
  35. }
  36. #endif
  37. void enable_eth_phy(void)
  38. {
  39. /* Set GPIOA_06 pad HIGH (Appli board)*/
  40. writel(readl(&gpioa_regs->dir) | 0x40, &gpioa_regs->dir);
  41. writel(readl(&gpioa_regs->data) | 0x40, &gpioa_regs->data);
  42. }
  43. int board_eth_enable(void)
  44. {
  45. stv0991_pinmux_config(ETH_GPIOB_10_31_C_0_4);
  46. clock_setup(ETH_CLOCK_CFG);
  47. enable_eth_phy();
  48. return 0;
  49. }
  50. int board_qspi_enable(void)
  51. {
  52. stv0991_pinmux_config(QSPI_CS_CLK_PAD);
  53. clock_setup(QSPI_CLOCK_CFG);
  54. return 0;
  55. }
  56. /*
  57. * Miscellaneous platform dependent initialisations
  58. */
  59. int board_init(void)
  60. {
  61. board_eth_enable();
  62. board_qspi_enable();
  63. return 0;
  64. }
  65. int board_uart_init(void)
  66. {
  67. stv0991_pinmux_config(UART_GPIOC_30_31);
  68. clock_setup(UART_CLOCK_CFG);
  69. return 0;
  70. }
  71. #ifdef CONFIG_BOARD_EARLY_INIT_F
  72. int board_early_init_f(void)
  73. {
  74. board_uart_init();
  75. return 0;
  76. }
  77. #endif
  78. int dram_init(void)
  79. {
  80. gd->ram_size = PHYS_SDRAM_1_SIZE;
  81. return 0;
  82. }
  83. void dram_init_banksize(void)
  84. {
  85. gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
  86. gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
  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