cpu.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2011-2015 by Vladimir Zapolskiy <vz@mleia.com>
  4. */
  5. #include <common.h>
  6. #include <cpu_func.h>
  7. #include <init.h>
  8. #include <net.h>
  9. #include <netdev.h>
  10. #include <asm/arch/cpu.h>
  11. #include <asm/arch/clk.h>
  12. #include <asm/arch/wdt.h>
  13. #include <asm/arch/sys_proto.h>
  14. #include <asm/io.h>
  15. static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE;
  16. static struct wdt_regs *wdt = (struct wdt_regs *)WDT_BASE;
  17. void reset_cpu(void)
  18. {
  19. /* Enable watchdog clock */
  20. setbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  21. /* Reset pulse length is 13005 peripheral clock frames */
  22. writel(13000, &wdt->pulse);
  23. /* Force WDOG_RESET2 and RESOUT_N signal active */
  24. writel(WDTIM_MCTRL_RESFRC2 | WDTIM_MCTRL_RESFRC1 | WDTIM_MCTRL_M_RES2,
  25. &wdt->mctrl);
  26. while (1)
  27. /* NOP */;
  28. }
  29. #if defined(CONFIG_ARCH_CPU_INIT)
  30. int arch_cpu_init(void)
  31. {
  32. /*
  33. * It might be necessary to flush data cache, if U-Boot is loaded
  34. * from kickstart bootloader, e.g. from S1L loader
  35. */
  36. flush_dcache_all();
  37. return 0;
  38. }
  39. #else
  40. #error "You have to select CONFIG_ARCH_CPU_INIT"
  41. #endif
  42. #if defined(CONFIG_DISPLAY_CPUINFO)
  43. int print_cpuinfo(void)
  44. {
  45. printf("CPU: NXP LPC32XX\n");
  46. printf("CPU clock: %uMHz\n", get_hclk_pll_rate() / 1000000);
  47. printf("AHB bus clock: %uMHz\n", get_hclk_clk_rate() / 1000000);
  48. printf("Peripheral clock: %uMHz\n", get_periph_clk_rate() / 1000000);
  49. return 0;
  50. }
  51. #endif
  52. #ifdef CONFIG_LPC32XX_ETH
  53. int cpu_eth_init(struct bd_info *bis)
  54. {
  55. lpc32xx_eth_initialize(bis);
  56. return 0;
  57. }
  58. #endif