stm32f746-disco.c 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * (C) Copyright 2016
  3. * Vikas Manocha, <vikas.manocha@st.com>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #include <common.h>
  8. #include <dm.h>
  9. #include <ram.h>
  10. #include <asm/io.h>
  11. #include <asm/armv7m.h>
  12. #include <asm/arch/stm32.h>
  13. #include <asm/arch/gpio.h>
  14. #include <dm/platdata.h>
  15. #include <dm/platform_data/serial_stm32x7.h>
  16. #include <asm/arch/stm32_periph.h>
  17. #include <asm/arch/stm32_defs.h>
  18. #include <asm/arch/syscfg.h>
  19. DECLARE_GLOBAL_DATA_PTR;
  20. int dram_init(void)
  21. {
  22. struct udevice *dev;
  23. struct ram_info ram;
  24. int rv;
  25. rv = uclass_get_device(UCLASS_RAM, 0, &dev);
  26. if (rv) {
  27. debug("DRAM init failed: %d\n", rv);
  28. return rv;
  29. }
  30. rv = ram_get_info(dev, &ram);
  31. if (rv) {
  32. debug("Cannot get DRAM size: %d\n", rv);
  33. return rv;
  34. }
  35. debug("SDRAM base=%lx, size=%x\n", ram.base, ram.size);
  36. gd->ram_size = ram.size;
  37. /*
  38. * Fill in global info with description of SRAM configuration
  39. */
  40. gd->bd->bi_dram[0].start = CONFIG_SYS_RAM_BASE;
  41. gd->bd->bi_dram[0].size = ram.size;
  42. return rv;
  43. }
  44. #ifdef CONFIG_ETH_DESIGNWARE
  45. static int stmmac_setup(void)
  46. {
  47. clock_setup(SYSCFG_CLOCK_CFG);
  48. /* Set >RMII mode */
  49. STM32_SYSCFG->pmc |= SYSCFG_PMC_MII_RMII_SEL;
  50. clock_setup(STMMAC_CLOCK_CFG);
  51. return 0;
  52. }
  53. int board_early_init_f(void)
  54. {
  55. stmmac_setup();
  56. return 0;
  57. }
  58. #endif
  59. u32 get_board_rev(void)
  60. {
  61. return 0;
  62. }
  63. int board_init(void)
  64. {
  65. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  66. return 0;
  67. }