Chinaunix首页 | 论坛 | 博客
  • 博客访问: 934059
  • 博文数量: 70
  • 博客积分: 1741
  • 博客等级: 上尉
  • 技术积分: 2476
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-05 14:46
个人简介

全志全系列芯片产品方案开发 A20/A33/A64/A40/A60/A83/A63/H3/H5/H6/H8

文章存档

2018年(1)

2012年(20)

2011年(49)

分类: LINUX

2011-12-28 00:33:28

IIC总线驱动移植
    XC2440开发板上使用的IIC设备为AT24C04和Camera,首先要让内核支持2440的IIC总线驱动,然后再将IIC设备挂接到IIC总线上。
IIC驱动文件为:drivers/i2c/host/i2c-s3c2410.c

在mach-xc2440.c中添加IIC总线驱动的支持:

加入必要的头文件:
#include

在xc2440_devices[ ]结构体中加入i2c0的platform_device:
&s3c_device_i2c0,

在xc2440_machine_init函数中加入设置i2c0的platdata函数:
s3c_i2c0_set_platdata(NULL);

配置内核,支持IIC总线驱动:
  1. Device Drivers --->
  2. <*>I2C support --->
  3. [*] Enable compatibility bits for old user-space
  4. <*> I2C device interface
  5. [*] Autoselect pertinent helper modules
  6. I2C Hardware Bus support --->
  7. <*>S3C2410 I2C Driver

内核启动时打印的调试信息:
s3c-i2c s3c2440-i2c: slave address 0x10
s3c-i2c s3c2440-i2c: bus frequency set to 97 KHz
s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter

i2c /dev entries driver

查看设备:
/dev/i2c-0


RTC驱动移植:
内核源码自带三星平台通用的RTC驱动,驱动文件为: drivers/rtc/rtc-s3c.c

在mach-xc2440.c中添加RTC设备:

xc2440_devices[ ]结构体中加入RTC的platform_device:
&s3c_device_rtc,

配置内核,支持RTC:
  1. Device Drivers --->
  2. <*>Real Time Clock --->
  3. [*]Set system time from RTC on startup and resume
  4. (rtc0) rtc used to set the system time
  5. [*]/sys/class/rtc/rtcN(sysfs)
  6. [*]/proc/driver/rtc(procfs for rtc0)
  7. [*]/dev/rtcN(character drivers)
  8. <*>Samsung S3C series SoC RTC

内核启动时打印的调试信息:
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c-rtc s3c2410-rtc: rtc core: registered s3c as rtc0


Watch Dog驱动移植
内核源码自带三星平台通用的Watch Dog驱动,驱动文件为:drivers/watchdog/s3c2410_wdt.c

在mach-xc2440.c中添加Watch Dog设备:

xc2440_devices[ ]结构体中加入WDT的platform_device:
&s3c_device_wdt,

配置内核,支持Watch Dog:
  1. Device Drivers --->
  2. [*] Watchdog Timer Support --->
  3. --- Watchdog Timer Support
  4. <*> S3C2410 Watchdog

内核启动时打印的调试信息:
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled

启动信息里提示看门狗是停止的,如果需要启动看门狗,就要修改看门狗的驱动
修改drivers/watchdog/s3c2410_wdt.c,第51行的宏值改为1:

#define CONFIG_S3C2410_WATCHDOG_ATBOOT (1)   改为1,启动看门狗
#define CONFIG_S3C2410_WATCHDOG_DEFAULT_TIME (15)  这个是系统复位的时间,根据实际情况修改

重新编译内核,下载到开发板中,会发现系统每隔15秒钟就重启一次,这是因为看门狗定时器已经开启了,系统复位时间是15秒,我们需要写一个“喂狗”程序,在系统启动时运行,防止系统重启。

将“光盘资料/源码包/驱动测试程序/watchdog”中的watchdog程序下载到文件系统中的/usr/bin目录下,并加入可执行权限,在启动脚本/etc/init.d/rcS中加入自动运行watchdog程序语句:watchdog&

阅读(3696) | 评论(0) | 转发(4) |
给主人留下些什么吧!~~