board_bcm281xx.c 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (C) 2012-2014 Broadcom Corporation
  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 as
  6. * published by the Free Software Foundation version 2.
  7. *
  8. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
  9. * kind, whether express or implied; without even the implied warranty
  10. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. */
  13. #include <linux/clocksource.h>
  14. #include <linux/of_address.h>
  15. #include <asm/mach/arch.h>
  16. #include "kona_l2_cache.h"
  17. #define SECWDOG_OFFSET 0x00000000
  18. #define SECWDOG_RESERVED_MASK 0xe2000000
  19. #define SECWDOG_WD_LOAD_FLAG_MASK 0x10000000
  20. #define SECWDOG_EN_MASK 0x08000000
  21. #define SECWDOG_SRSTEN_MASK 0x04000000
  22. #define SECWDOG_CLKS_SHIFT 20
  23. #define SECWDOG_COUNT_SHIFT 0
  24. static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
  25. {
  26. uint32_t val;
  27. void __iomem *base;
  28. struct device_node *np_wdog;
  29. np_wdog = of_find_compatible_node(NULL, NULL, "brcm,kona-wdt");
  30. if (!np_wdog) {
  31. pr_emerg("Couldn't find brcm,kona-wdt\n");
  32. return;
  33. }
  34. base = of_iomap(np_wdog, 0);
  35. if (!base) {
  36. pr_emerg("Couldn't map brcm,kona-wdt\n");
  37. return;
  38. }
  39. /* Enable watchdog with short timeout (244us). */
  40. val = readl(base + SECWDOG_OFFSET);
  41. val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
  42. val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
  43. (0x15 << SECWDOG_CLKS_SHIFT) |
  44. (0x8 << SECWDOG_COUNT_SHIFT);
  45. writel(val, base + SECWDOG_OFFSET);
  46. /* Wait for reset */
  47. while (1);
  48. }
  49. static void __init bcm281xx_init(void)
  50. {
  51. kona_l2_cache_init();
  52. }
  53. static const char * const bcm281xx_dt_compat[] = {
  54. "brcm,bcm11351", /* Have to use the first number upstreamed */
  55. NULL,
  56. };
  57. DT_MACHINE_START(BCM281XX_DT, "BCM281xx Broadcom Application Processor")
  58. .init_machine = bcm281xx_init,
  59. .restart = bcm281xx_restart,
  60. .dt_compat = bcm281xx_dt_compat,
  61. MACHINE_END