exynos4412 看门狗不能用解决方法

我也遇到这个问题,发现unsigned long freq = clk_get_rate(wdt_clock);函数返回0所以我怀疑是看门狗时钟没有初始化。最后通过修改内核源码,看门狗正常了。

解决方法:
1、在clock-exynos4.c的数组static struct clk exynos4_init_clocks[]中添加

{
  .name         = "watchdog",
  .parent         = &exynos4_clk_pclk_acp,
  .enable         = exynos4_clk_ip_perir_ctrl,
  .ctrlbit        = (1 << 14),
}

2、然后在s3c2410_wdt.c中将
ifdef CONFIG_CPU_FREQ 改成 #if 0

3、然后在s3c2410_wdt.c中将
if (get_user(new_margin, p))
    return -EFAULT;
if (s3c2410wdt_set_heartbeat(new_margin))
改成
if (s3c2410wdt_set_heartbeat(argp))
最终使看门狗正常工作。

看门狗测试程序:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <linux/types.h>
#include <linux/watchdog.h>
int main(void)
{
int fd = open("/dev/watchdog", O_WRONLY);
int* timeout = 0;
int count = 0;

if (fd == -1) 
{
  perror("watchdog");
  exit(EXIT_FAILURE);
}
ioctl(fd, WDIOC_SETTIMEOUT, 5);
while (1) 
{
  //ioctl(fd, WDIOC_KEEPALIVE, 0);
  printf("feel dog %d\r\n",count++);
  sleep(1);
}
close(fd);
return 0;

}



原文章出处:http://bbs.topeetboard.com/forum.php?mod=viewthread&tid=2190

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值