cpu.c 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2011 by Vladimir Zapolskiy <vz@mleia.com>
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  17. * MA 02110-1301, USA.
  18. */
  19. #include <common.h>
  20. #include <asm/arch/cpu.h>
  21. #include <asm/arch/clk.h>
  22. #include <asm/arch/wdt.h>
  23. #include <asm/io.h>
  24. static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE;
  25. static struct wdt_regs *wdt = (struct wdt_regs *)WDT_BASE;
  26. void reset_cpu(ulong addr)
  27. {
  28. /* Enable watchdog clock */
  29. setbits_le32(&clk->timclk_ctrl, CLK_TIMCLK_WATCHDOG);
  30. /* Reset pulse length is 13005 peripheral clock frames */
  31. writel(13000, &wdt->pulse);
  32. /* Force WDOG_RESET2 and RESOUT_N signal active */
  33. writel(WDTIM_MCTRL_RESFRC2 | WDTIM_MCTRL_RESFRC1 | WDTIM_MCTRL_M_RES2,
  34. &wdt->mctrl);
  35. while (1)
  36. /* NOP */;
  37. }
  38. #if defined(CONFIG_ARCH_CPU_INIT)
  39. int arch_cpu_init(void)
  40. {
  41. /*
  42. * It might be necessary to flush data cache, if U-boot is loaded
  43. * from kickstart bootloader, e.g. from S1L loader
  44. */
  45. flush_dcache_all();
  46. return 0;
  47. }
  48. #else
  49. #error "You have to select CONFIG_ARCH_CPU_INIT"
  50. #endif
  51. #if defined(CONFIG_DISPLAY_CPUINFO)
  52. int print_cpuinfo(void)
  53. {
  54. printf("CPU: NXP LPC32XX\n");
  55. printf("CPU clock: %uMHz\n", get_hclk_pll_rate() / 1000000);
  56. printf("AHB bus clock: %uMHz\n", get_hclk_clk_rate() / 1000000);
  57. printf("Peripheral clock: %uMHz\n", get_periph_clk_rate() / 1000000);
  58. return 0;
  59. }
  60. #endif