Release 4.11 arch/arm/mach-picoxcell/common.c
/*
* Copyright (c) 2011 Picochip Ltd., Jamie Iles
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* All enquiries to support@picochip.com
*/
#include <linux/delay.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/reboot.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#define PHYS_TO_IO(x) (((x) & 0x00ffffff) | 0xfe000000)
#define PICOXCELL_PERIPH_BASE 0x80000000
#define PICOXCELL_PERIPH_LENGTH SZ_4M
#define WDT_CTRL_REG_EN_MASK (1 << 0)
#define WDT_CTRL_REG_OFFS (0x00)
#define WDT_TIMEOUT_REG_OFFS (0x04)
static void __iomem *wdt_regs;
/*
* The machine restart method can be called from an atomic context so we won't
* be able to ioremap the regs then.
*/
static void picoxcell_setup_restart(void)
{
struct device_node *np = of_find_compatible_node(NULL, NULL,
"snps,dw-apb-wdg");
if (WARN(!np, "unable to setup watchdog restart"))
return;
wdt_regs = of_iomap(np, 0);
WARN(!wdt_regs, "failed to remap watchdog regs");
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jamie Iles | 50 | 100.00% | 1 | 100.00% |
Total | 50 | 100.00% | 1 | 100.00% |
static struct map_desc io_map __initdata = {
.virtual = PHYS_TO_IO(PICOXCELL_PERIPH_BASE),
.pfn = __phys_to_pfn(PICOXCELL_PERIPH_BASE),
.length = PICOXCELL_PERIPH_LENGTH,
.type = MT_DEVICE,
};
static void __init picoxcell_map_io(void)
{
iotable_init(&io_map, 1);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jamie Iles | 17 | 100.00% | 1 | 100.00% |
Total | 17 | 100.00% | 1 | 100.00% |
static void __init picoxcell_init_machine(void)
{
picoxcell_setup_restart();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jamie Iles | 12 | 100.00% | 2 | 100.00% |
Total | 12 | 100.00% | 2 | 100.00% |
static const char *picoxcell_dt_match[] = {
"picochip,pc3x2",
"picochip,pc3x3",
NULL
};
static void picoxcell_wdt_restart(enum reboot_mode mode, const char *cmd)
{
/*
* Configure the watchdog to reset with the shortest possible timeout
* and give it chance to do the reset.
*/
if (wdt_regs) {
writel_relaxed(WDT_CTRL_REG_EN_MASK, wdt_regs + WDT_CTRL_REG_OFFS);
writel_relaxed(0, wdt_regs + WDT_TIMEOUT_REG_OFFS);
/* No sleeping, possibly atomic. */
mdelay(500);
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jamie Iles | 44 | 95.65% | 1 | 50.00% |
Robin Holt | 2 | 4.35% | 1 | 50.00% |
Total | 46 | 100.00% | 2 | 100.00% |
DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
.map_io = picoxcell_map_io,
.init_machine = picoxcell_init_machine,
.dt_compat = picoxcell_dt_match,
.restart = picoxcell_wdt_restart,
MACHINE_END
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Jamie Iles | 234 | 92.13% | 3 | 60.00% |
Rob Herring | 15 | 5.91% | 1 | 20.00% |
Robin Holt | 5 | 1.97% | 1 | 20.00% |
Total | 254 | 100.00% | 5 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.