您尚未登录。

#1 Re: 全志 SOC » ★★★☆☆☆ 本站精华帖汇总, 各种手册在线下载,各种开源pcb工程下载 ☆☆☆★★★ » 2020-03-07 13:04:50

感谢晕哥提供这个平台给大家交流,我也受益菲浅。reboot时开看门狗复的位

#2 Re: 全志 SOC » ★★★☆☆☆ 本站精华帖汇总, 各种手册在线下载,各种开源pcb工程下载 ☆☆☆★★★ » 2020-03-06 20:10:19

回馈社区:荔枝派Nano的linux5.2版本tf卡及spi flash reboot失败的bug调通啦,下面是patch:

diff --git a/arch/arm/mach-sunxi/sunxi.c b/arch/arm/mach-sunxi/sunxi.c
index 933b6930f0..7217d07c03 100644
--- a/arch/arm/mach-sunxi/sunxi.c
+++ b/arch/arm/mach-sunxi/sunxi.c
@@ -16,8 +16,72 @@
 #include <linux/platform_device.h>
 #include <linux/reset/sunxi.h>
 
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/delay.h>
 #include <asm/mach/arch.h>
-#include <asm/secure_cntvoff.h>
+
+enum {
+	WDOG_IRQ_EN		= 0x00,
+	WDOG_IRQ_STA		= 0x04,
+	WDOG_CTRL		= 0x10,
+	WDOG_CFG		= 0x14,
+	WDOG_MODE		= 0x18,
+};
+
+static void __iomem *wdt_base = NULL;
+
+static void suniv_restart(enum reboot_mode mode, const char *cmd) 
+{
+	if (!wdt_base)
+		return;
+	writel(0x1, wdt_base+WDOG_CFG);		//To whole system
+	writel(0x10, wdt_base+WDOG_MODE);	//interval value set 1s
+	writel(readl(wdt_base+WDOG_MODE)|(1<<0), wdt_base+WDOG_MODE);	//Enable watchdog
+	mdelay(500);
+	writel(readl(wdt_base+WDOG_CTRL)|(0xA57<<1)|(1<<0), wdt_base+WDOG_CTRL);	//writel 0xa57 at key field and restart watchdog
+	while(1){
+		mdelay(2000);
+		writel(readl(wdt_base+WDOG_CTRL)|(0xA57<<1)|(1<<0), wdt_base+WDOG_CTRL);
+	}
+}
+
+static struct of_device_id suniv_restart_ids[] = {
+	{ .compatible = "allwinner,suniv-f1c100s-wdt", .data = suniv_restart },
+	{ /*sentinel*/ }
+};
+
+static void suniv_setup_restart(void)
+{
+	const struct of_device_id *of_id;
+	struct device_node *np;
+
+	np = of_find_matching_node(NULL, suniv_restart_ids);
+	if (WARN(!np, "unable to setup watchdog restart"))
+		return;
+
+	wdt_base = of_iomap(np, 0);
+	WARN(!wdt_base, "failed to map watchdog base address");
+
+	of_id = of_match_node(suniv_restart_ids, np);
+	WARN(!of_id, "restart function not available");
+}
+
+static void __init suniv_dt_init(void)
+{
+	suniv_setup_restart();
+}
+
+static const char * const suniv_board_dt_compat[] = {
+	"allwinner,suniv-f1c100s",
+	NULL,
+};
+
+DT_MACHINE_START(SUNIV_DT, "Allwinner suniv Family")
+	.init_machine	= suniv_dt_init,
+	.restart	= suniv_restart,
+	.dt_compat	= suniv_board_dt_compat,
+MACHINE_END
 
 static const char * const sunxi_board_dt_compat[] = {
 	"allwinner,sun4i-a10",
@@ -102,11 +166,3 @@ DT_MACHINE_START(SUN9I_DT, "Allwinner sun9i Family")
 	.dt_compat	= sun9i_board_dt_compat,
 MACHINE_END
 
-static const char * const suniv_board_dt_compat[] = {
-	"allwinner,suniv-f1c100s",
-	NULL,
-};
-
-DT_MACHINE_START(SUNIV_DT, "Allwinner suniv Family")
-	.dt_compat	= suniv_board_dt_compat,
-MACHINE_END

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn