Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 // Copyright (C) 2012-2014 Broadcom Corporation
0003 
0004 #include <linux/clocksource.h>
0005 #include <linux/of_address.h>
0006 
0007 #include <asm/mach/arch.h>
0008 
0009 #include "kona_l2_cache.h"
0010 
0011 #define SECWDOG_OFFSET          0x00000000
0012 #define SECWDOG_RESERVED_MASK       0xe2000000
0013 #define SECWDOG_WD_LOAD_FLAG_MASK   0x10000000
0014 #define SECWDOG_EN_MASK         0x08000000
0015 #define SECWDOG_SRSTEN_MASK     0x04000000
0016 #define SECWDOG_CLKS_SHIFT      20
0017 #define SECWDOG_COUNT_SHIFT     0
0018 
0019 static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
0020 {
0021     uint32_t val;
0022     void __iomem *base;
0023     struct device_node *np_wdog;
0024 
0025     np_wdog = of_find_compatible_node(NULL, NULL, "brcm,kona-wdt");
0026     if (!np_wdog) {
0027         pr_emerg("Couldn't find brcm,kona-wdt\n");
0028         return;
0029     }
0030     base = of_iomap(np_wdog, 0);
0031     of_node_put(np_wdog);
0032     if (!base) {
0033         pr_emerg("Couldn't map brcm,kona-wdt\n");
0034         return;
0035     }
0036 
0037     /* Enable watchdog with short timeout (244us). */
0038     val = readl(base + SECWDOG_OFFSET);
0039     val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
0040     val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
0041         (0x15 << SECWDOG_CLKS_SHIFT) |
0042         (0x8 << SECWDOG_COUNT_SHIFT);
0043     writel(val, base + SECWDOG_OFFSET);
0044 
0045     /* Wait for reset */
0046     while (1);
0047 }
0048 
0049 static void __init bcm281xx_init(void)
0050 {
0051     kona_l2_cache_init();
0052 }
0053 
0054 static const char * const bcm281xx_dt_compat[] = {
0055     "brcm,bcm11351",    /* Have to use the first number upstreamed */
0056     NULL,
0057 };
0058 
0059 DT_MACHINE_START(BCM281XX_DT, "BCM281xx Broadcom Application Processor")
0060     .init_machine = bcm281xx_init,
0061     .restart = bcm281xx_restart,
0062     .dt_compat = bcm281xx_dt_compat,
0063 MACHINE_END