|
10 | 10 | * http://www.gnu.org/copyleft/gpl.html |
11 | 11 | */ |
12 | 12 |
|
| 13 | +#include <linux/delay.h> |
13 | 14 | #include <linux/init.h> |
| 15 | +#include <linux/io.h> |
14 | 16 | #include <linux/irq.h> |
15 | 17 | #include <linux/irqdomain.h> |
16 | 18 | #include <linux/of.h> |
| 19 | +#include <linux/of_address.h> |
17 | 20 | #include <linux/of_irq.h> |
18 | 21 | #include <linux/of_platform.h> |
19 | 22 | #include <asm/hardware/cache-l2x0.h> |
|
23 | 26 | #include <mach/common.h> |
24 | 27 | #include <mach/hardware.h> |
25 | 28 |
|
| 29 | +void imx6q_restart(char mode, const char *cmd) |
| 30 | +{ |
| 31 | + struct device_node *np; |
| 32 | + void __iomem *wdog_base; |
| 33 | + |
| 34 | + np = of_find_compatible_node(NULL, NULL, "fsl,imx6q-wdt"); |
| 35 | + wdog_base = of_iomap(np, 0); |
| 36 | + if (!wdog_base) |
| 37 | + goto soft; |
| 38 | + |
| 39 | + imx_src_prepare_restart(); |
| 40 | + |
| 41 | + /* enable wdog */ |
| 42 | + writew_relaxed(1 << 2, wdog_base); |
| 43 | + /* write twice to ensure the request will not get ignored */ |
| 44 | + writew_relaxed(1 << 2, wdog_base); |
| 45 | + |
| 46 | + /* wait for reset to assert ... */ |
| 47 | + mdelay(500); |
| 48 | + |
| 49 | + pr_err("Watchdog reset failed to assert reset\n"); |
| 50 | + |
| 51 | + /* delay to allow the serial port to show the message */ |
| 52 | + mdelay(50); |
| 53 | + |
| 54 | +soft: |
| 55 | + /* we'll take a jump through zero as a poor second */ |
| 56 | + soft_restart(0); |
| 57 | +} |
| 58 | + |
26 | 59 | static void __init imx6q_init_machine(void) |
27 | 60 | { |
28 | 61 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
@@ -83,5 +116,5 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad (Device Tree)") |
83 | 116 | .timer = &imx6q_timer, |
84 | 117 | .init_machine = imx6q_init_machine, |
85 | 118 | .dt_compat = imx6q_dt_compat, |
86 | | - .restart = mxc_restart, |
| 119 | + .restart = imx6q_restart, |
87 | 120 | MACHINE_END |
0 commit comments