reset.c 1018 B

1234567891011121314151617181920212223242526272829303132333435
  1. /*
  2. * (C) Copyright 2012 Stephen Warren
  3. *
  4. * See file CREDITS for list of people who contributed to this
  5. * project.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. */
  16. #include <common.h>
  17. #include <asm/io.h>
  18. #include <asm/arch/wdog.h>
  19. #define RESET_TIMEOUT 10
  20. void reset_cpu(ulong addr)
  21. {
  22. struct bcm2835_wdog_regs *regs =
  23. (struct bcm2835_wdog_regs *)BCM2835_WDOG_PHYSADDR;
  24. uint32_t rstc;
  25. rstc = readl(&regs->rstc);
  26. rstc &= ~BCM2835_WDOG_RSTC_WRCFG_MASK;
  27. rstc |= BCM2835_WDOG_RSTC_WRCFG_FULL_RESET;
  28. writel(BCM2835_WDOG_PASSWORD | RESET_TIMEOUT, &regs->wdog);
  29. writel(BCM2835_WDOG_PASSWORD | rstc, &regs->rstc);
  30. }