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