board_bcm281xx.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 <linux/of_platform.h>
  16. #include <asm/mach/arch.h>
  17. #include "kona_l2_cache.h"
  18. #define SECWDOG_OFFSET 0x00000000
  19. #define SECWDOG_RESERVED_MASK 0xe2000000
  20. #define SECWDOG_WD_LOAD_FLAG_MASK 0x10000000
  21. #define SECWDOG_EN_MASK 0x08000000
  22. #define SECWDOG_SRSTEN_MASK 0x04000000
  23. #define SECWDOG_CLKS_SHIFT 20
  24. #define SECWDOG_COUNT_SHIFT 0
  25. static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
  26. {
  27. uint32_t val;
  28. void __iomem *base;
  29. struct device_node *np_wdog;
  30. np_wdog = of_find_compatible_node(NULL, NULL, "brcm,kona-wdt");
  31. if (!np_wdog) {
  32. pr_emerg("Couldn't find brcm,kona-wdt\n");
  33. return;
  34. }
  35. base = of_iomap(np_wdog, 0);
  36. if (!base) {
  37. pr_emerg("Couldn't map brcm,kona-wdt\n");
  38. return;
  39. }
  40. /* Enable watchdog with short timeout (244us). */
  41. val = readl(base + SECWDOG_OFFSET);
  42. val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
  43. val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
  44. (0x15 << SECWDOG_CLKS_SHIFT) |
  45. (0x8 << SECWDOG_COUNT_SHIFT);
  46. writel(val, base + SECWDOG_OFFSET);
  47. /* Wait for reset */
  48. while (1);
  49. }
  50. static void __init bcm281xx_init(void)
  51. {
  52. of_platform_populate(NULL, of_default_bus_match_table, NULL,
  53. &platform_bus);
  54. kona_l2_cache_init();
  55. }
  56. static const char * const bcm281xx_dt_compat[] = {
  57. "brcm,bcm11351", /* Have to use the first number upstreamed */
  58. NULL,
  59. };
  60. DT_MACHINE_START(BCM281XX_DT, "BCM281xx Broadcom Application Processor")
  61. .init_machine = bcm281xx_init,
  62. .restart = bcm281xx_restart,
  63. .dt_compat = bcm281xx_dt_compat,
  64. MACHINE_END