devkit3250.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Embest/Timll DevKit3250 board support
  4. *
  5. * Copyright (C) 2011-2015 Vladimir Zapolskiy <vz@mleia.com>
  6. */
  7. #include <common.h>
  8. #include <asm/arch/sys_proto.h>
  9. #include <asm/arch/clk.h>
  10. #include <asm/arch/cpu.h>
  11. #include <asm/arch/emc.h>
  12. #include <asm/arch/wdt.h>
  13. #include <asm/io.h>
  14. DECLARE_GLOBAL_DATA_PTR;
  15. static struct emc_regs *emc = (struct emc_regs *)EMC_BASE;
  16. static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE;
  17. static struct wdt_regs *wdt = (struct wdt_regs *)WDT_BASE;
  18. void reset_periph(void)
  19. {
  20. /* This function resets peripherals by triggering RESOUT_N */
  21. setbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  22. writel(WDTIM_MCTRL_RESFRC1, &wdt->mctrl);
  23. udelay(300);
  24. writel(0, &wdt->mctrl);
  25. clrbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  26. /* Such a long delay is needed to initialize SMSC phy */
  27. udelay(10000);
  28. }
  29. int board_early_init_f(void)
  30. {
  31. lpc32xx_uart_init(CONFIG_SYS_LPC32XX_UART);
  32. lpc32xx_i2c_init(1);
  33. lpc32xx_i2c_init(2);
  34. lpc32xx_ssp_init();
  35. lpc32xx_mac_init();
  36. /*
  37. * nWP may be controlled by GPO19, but unpopulated by default R23
  38. * makes no sense to configure this GPIO level, nWP is always high
  39. */
  40. lpc32xx_slc_nand_init();
  41. return 0;
  42. }
  43. int board_init(void)
  44. {
  45. /* adress of boot parameters */
  46. gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
  47. #ifdef CONFIG_SYS_FLASH_CFI
  48. /* Use 16-bit memory interface for NOR Flash */
  49. emc->stat[0].config = EMC_STAT_CONFIG_PB | EMC_STAT_CONFIG_16BIT;
  50. /* Change the NOR timings to optimum value to get maximum bandwidth */
  51. emc->stat[0].waitwen = EMC_STAT_WAITWEN(1);
  52. emc->stat[0].waitoen = EMC_STAT_WAITOEN(0);
  53. emc->stat[0].waitrd = EMC_STAT_WAITRD(12);
  54. emc->stat[0].waitpage = EMC_STAT_WAITPAGE(12);
  55. emc->stat[0].waitwr = EMC_STAT_WAITWR(5);
  56. emc->stat[0].waitturn = EMC_STAT_WAITTURN(2);
  57. #endif
  58. return 0;
  59. }
  60. int dram_init(void)
  61. {
  62. gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE,
  63. CONFIG_SYS_SDRAM_SIZE);
  64. return 0;
  65. }