]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - arch/arm/mach-bcm/board_bcm281xx.c
Merge tag 'acpi-extra-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[mirror_ubuntu-zesty-kernel.git] / arch / arm / mach-bcm / board_bcm281xx.c
CommitLineData
8ac49e04 1/*
a21ea269 2 * Copyright (C) 2012-2014 Broadcom Corporation
8ac49e04
CD
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
8011657b 14#include <linux/clocksource.h>
389df036 15#include <linux/of_address.h>
8ac49e04
CD
16
17#include <asm/mach/arch.h>
8ac49e04 18
eeda4cb9 19#include "kona_l2_cache.h"
b8eb35fd 20
a21ea269
MM
21#define SECWDOG_OFFSET 0x00000000
22#define SECWDOG_RESERVED_MASK 0xe2000000
23#define SECWDOG_WD_LOAD_FLAG_MASK 0x10000000
24#define SECWDOG_EN_MASK 0x08000000
25#define SECWDOG_SRSTEN_MASK 0x04000000
26#define SECWDOG_CLKS_SHIFT 20
27#define SECWDOG_COUNT_SHIFT 0
28
29static void bcm281xx_restart(enum reboot_mode mode, const char *cmd)
257b49e3 30{
a21ea269
MM
31 uint32_t val;
32 void __iomem *base;
33 struct device_node *np_wdog;
257b49e3 34
a21ea269
MM
35 np_wdog = of_find_compatible_node(NULL, NULL, "brcm,kona-wdt");
36 if (!np_wdog) {
37 pr_emerg("Couldn't find brcm,kona-wdt\n");
38 return;
39 }
40 base = of_iomap(np_wdog, 0);
41 if (!base) {
42 pr_emerg("Couldn't map brcm,kona-wdt\n");
43 return;
257b49e3 44 }
a21ea269
MM
45
46 /* Enable watchdog with short timeout (244us). */
47 val = readl(base + SECWDOG_OFFSET);
48 val &= SECWDOG_RESERVED_MASK | SECWDOG_WD_LOAD_FLAG_MASK;
49 val |= SECWDOG_EN_MASK | SECWDOG_SRSTEN_MASK |
50 (0x15 << SECWDOG_CLKS_SHIFT) |
51 (0x8 << SECWDOG_COUNT_SHIFT);
52 writel(val, base + SECWDOG_OFFSET);
53
54 /* Wait for reset */
55 while (1);
257b49e3
MM
56}
57
0e8b860a 58static void __init bcm281xx_init(void)
8ac49e04 59{
b8eb35fd 60 kona_l2_cache_init();
8ac49e04
CD
61}
62
9c6423aa
AE
63static const char * const bcm281xx_dt_compat[] = {
64 "brcm,bcm11351", /* Have to use the first number upstreamed */
65 NULL,
66};
8ac49e04 67
9c6423aa 68DT_MACHINE_START(BCM281XX_DT, "BCM281xx Broadcom Application Processor")
0e8b860a 69 .init_machine = bcm281xx_init,
a21ea269 70 .restart = bcm281xx_restart,
9c6423aa 71 .dt_compat = bcm281xx_dt_compat,
8ac49e04 72MACHINE_END