board_bcm281xx.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. // Copyright (C) 2012-2014 Broadcom Corporation
  3. #include <linux/clocksource.h>
  4. #include <linux/of_address.h>
  5. #include <asm/mach/arch.h>
  6. #include "kona_l2_cache.h"
  7. #define SECWDOG_OFFSET 0x00000000
  8. #define SECWDOG_RESERVED_MASK 0xe2000000
  9. #define SECWDOG_WD_LOAD_FLAG_MASK 0x10000000
  10. #define SECWDOG_EN_MASK 0x08000000
  11. #define SECWDOG_SRSTEN_MASK 0x04000000
  12. #define SECWDOG_CLKS_SHIFT 20
  13. #define SECWDOG_COUNT_SHIFT 0
  14. static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
  15. {
  16. uint32_t val;
  17. void __iomem *base;
  18. struct device_node *np_wdog;
  19. np_wdog = of_find_compatible_node(NULL, NULL, "brcm,kona-wdt");
  20. if (!np_wdog) {
  21. pr_emerg("Couldn't find brcm,kona-wdt\n");
  22. return;
  23. }
  24. base = of_iomap(np_wdog, 0);
  25. of_node_put(np_wdog);
  26. if (!base) {
  27. pr_emerg("Couldn't map brcm,kona-wdt\n");
  28. return;
  29. }
  30. /* Enable watchdog with short timeout (244us). */
  31. val = readl(base + SECWDOG_OFFSET);
  32. val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
  33. val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
  34. (0x15 << SECWDOG_CLKS_SHIFT) |
  35. (0x8 << SECWDOG_COUNT_SHIFT);
  36. writel(val, base + SECWDOG_OFFSET);
  37. /* Wait for reset */
  38. while (1);
  39. }
  40. static void __init bcm281xx_init(void)
  41. {
  42. kona_l2_cache_init();
  43. }
  44. static const char * const bcm281xx_dt_compat[] = {
  45. "brcm,bcm11351", /* Have to use the first number upstreamed */
  46. NULL,
  47. };
  48. DT_MACHINE_START(BCM281XX_DT, "BCM281xx Broadcom Application Processor")
  49. .init_machine = bcm281xx_init,
  50. .restart = bcm281xx_restart,
  51. .dt_compat = bcm281xx_dt_compat,
  52. MACHINE_END