当前位置: 技术问答>linux和unix
linux2.6.21下的I2C驱动问题
来源: 互联网 发布时间:2017-03-11
本文导语: 请各位大侠不吝赐教! 使用linux2.6.21内核,打了arm9的补丁,芯片使用ATRM9200,实时时钟芯片使用ds1307,现在想使用arm9的i2c总线驱动ds1307,在内核中选择了i2c驱动支持。并在rtc下选择了ds1307。现在可以肯定的是我的...
请各位大侠不吝赐教!
使用linux2.6.21内核,打了arm9的补丁,芯片使用ATRM9200,实时时钟芯片使用ds1307,现在想使用arm9的i2c总线驱动ds1307,在内核中选择了i2c驱动支持。并在rtc下选择了ds1307。现在可以肯定的是我的硬件电路肯定没有问题,因为我有一个原来的2.4内核的驱动,读写ds1307一点问题没有。我现在升级到2.6内核之后打印信息如下
U-Boot 1.1.1 (Aug 3 2005 - 14:31:02)
U-Boot code: 21F00000 -> 21F15C30 BSS: -> 21F19F84
RAM Configuration:
Bank #0: 20000000 32 MB
Flash: 16 MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 2 1 0
## Starting application at 0x21000000 ...
Uncompressing Linux.............................................................................. done, booting the kernel.
Linux version 2.6.21.3 (root@seawolf) (gcc version 3.4.1) #110 Mon Mar 22 16:39:30 CST 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: Atmel AT91RM9200-DK
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 179 MHz, master 59 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists. Total pages: 8128
Kernel command line: mem=32M console=ttyS0,115200 initrd=0x211A0000,6000000 root=/dev/ram0 rw
AT91: 128 gpio irqs in 4 banks
PID hash table entries: 128 (order: 7, 512 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 24096KB available (2192K code, 188K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
init i2c at91 TWI
AT91: Power Management
Generic PHY: Registered new driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 5859K
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
JFFS2: default compression mode: priority
io scheduler noop registered
io scheduler anticipatory registered (default)
Epson S1D13XXX FB Driver
s1d13xxxfb: chip not found: 20
Non-volatile memory driver v1.2
AT91 Watchdog Timer enabled (5 seconds, nowayout)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffc4000 (irq = 7) is a ATMEL_SERIAL
atmel_usart.3: ttyS3 at MMIO 0xfffc8000 (irq = 8) is a ATMEL_SERIAL
atmel_usart.4: ttyS4 at MMIO 0xfffcc000 (irq = 9) is a ATMEL_SERIAL
RAMDISK driver initialized: 16 RAM disks of 15360K size 1024 blocksize
at91 id is 2250256
eth0: Link down.
eth0: AT91 ethernet at 0xfefbc000 int=24 10-HalfDuplex (00:01:03:05:18:22)
eth0: Altima AC101L PHY
INTEL-MTD probing 16bit FLASH
Intel Flash Jffs2 Device: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Using builtin partition table
Creating 5 MTD partitions on "Intel Flash Jffs2 Device":
0x00000000-0x00020000 : "reserved for bootloader"
mtd: Giving out device 0 to reserved for bootloader
0x00020000-0x001a0000 : "reserved for kernel"
mtd: Giving out device 1 to reserved for kernel
0x001a0000-0x006a0000 : "reserved for ramdisk"
mtd: Giving out device 2 to reserved for ramdisk
0x006a0000-0x00f00000 : "jffs2"
mtd: Giving out device 3 to jffs2
0x00f00000-0x01000000 : "res1"
mtd: Giving out device 4 to res1
at91_cf: irqs det #64, io #0
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
cdiv is 148 ckdiv is 1
clock rate is 100000
adap id is 0
found normal entry for adapter 0, addr 0x68
come to smbus transfer
master_xfer[0] W, addr=0x68, len=0
at91_xfer: processing 1 messages:
#0: writing 0 byte to 0x68
my transfer compelte
master_xfer[0] W, addr=0x68, len=1
master_xfer[1] R, addr=0x68, len=8
at91_xfer: processing 2 messages:
#0: writing 1 byte to 0x68
i2c_adapter i2c-0: Client creation failed at 0x68 (-5)
at91_i2c at91_i2c: AT91 i2c bus driver.
AT91 i2c bus driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation
drivers/rtc/hctosys.c: unable to open rtc device
可以看到i2c_adapter i2c-0: Client creation failed at 0x68 (-5)的错误,驱动在这里返回了,查看了一下代码,是因为在i2c-at91.c中等待txrdy标志位时超时。
我使用示波器测量了一下ds1307的scl管教,没发现有时钟信号,哪位大侠能告诉小弟一下啊。下面为rtc-ds1307.c的代码
使用linux2.6.21内核,打了arm9的补丁,芯片使用ATRM9200,实时时钟芯片使用ds1307,现在想使用arm9的i2c总线驱动ds1307,在内核中选择了i2c驱动支持。并在rtc下选择了ds1307。现在可以肯定的是我的硬件电路肯定没有问题,因为我有一个原来的2.4内核的驱动,读写ds1307一点问题没有。我现在升级到2.6内核之后打印信息如下
U-Boot 1.1.1 (Aug 3 2005 - 14:31:02)
U-Boot code: 21F00000 -> 21F15C30 BSS: -> 21F19F84
RAM Configuration:
Bank #0: 20000000 32 MB
Flash: 16 MB
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 2 1 0
## Starting application at 0x21000000 ...
Uncompressing Linux.............................................................................. done, booting the kernel.
Linux version 2.6.21.3 (root@seawolf) (gcc version 3.4.1) #110 Mon Mar 22 16:39:30 CST 2010
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: Atmel AT91RM9200-DK
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 179 MHz, master 59 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists. Total pages: 8128
Kernel command line: mem=32M console=ttyS0,115200 initrd=0x211A0000,6000000 root=/dev/ram0 rw
AT91: 128 gpio irqs in 4 banks
PID hash table entries: 128 (order: 7, 512 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 24096KB available (2192K code, 188K data, 100K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
init i2c at91 TWI
AT91: Power Management
Generic PHY: Registered new driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
checking if image is initramfs...it isn't (no cpio magic); looks like an initrd
Freeing initrd memory: 5859K
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
JFFS2: default compression mode: priority
io scheduler noop registered
io scheduler anticipatory registered (default)
Epson S1D13XXX FB Driver
s1d13xxxfb: chip not found: 20
Non-volatile memory driver v1.2
AT91 Watchdog Timer enabled (5 seconds, nowayout)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xfffc4000 (irq = 7) is a ATMEL_SERIAL
atmel_usart.3: ttyS3 at MMIO 0xfffc8000 (irq = 8) is a ATMEL_SERIAL
atmel_usart.4: ttyS4 at MMIO 0xfffcc000 (irq = 9) is a ATMEL_SERIAL
RAMDISK driver initialized: 16 RAM disks of 15360K size 1024 blocksize
at91 id is 2250256
eth0: Link down.
eth0: AT91 ethernet at 0xfefbc000 int=24 10-HalfDuplex (00:01:03:05:18:22)
eth0: Altima AC101L PHY
INTEL-MTD probing 16bit FLASH
Intel Flash Jffs2 Device: Found 1 x16 devices at 0x0 in 16-bit bank
Intel/Sharp Extended Query Table at 0x0031
Using buffer write method
cfi_cmdset_0001: Erase suspend on write enabled
Using builtin partition table
Creating 5 MTD partitions on "Intel Flash Jffs2 Device":
0x00000000-0x00020000 : "reserved for bootloader"
mtd: Giving out device 0 to reserved for bootloader
0x00020000-0x001a0000 : "reserved for kernel"
mtd: Giving out device 1 to reserved for kernel
0x001a0000-0x006a0000 : "reserved for ramdisk"
mtd: Giving out device 2 to reserved for ramdisk
0x006a0000-0x00f00000 : "jffs2"
mtd: Giving out device 3 to jffs2
0x00f00000-0x01000000 : "res1"
mtd: Giving out device 4 to res1
at91_cf: irqs det #64, io #0
udc: at91_udc version 3 May 2006
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
cdiv is 148 ckdiv is 1
clock rate is 100000
adap id is 0
found normal entry for adapter 0, addr 0x68
come to smbus transfer
master_xfer[0] W, addr=0x68, len=0
at91_xfer: processing 1 messages:
#0: writing 0 byte to 0x68
my transfer compelte
master_xfer[0] W, addr=0x68, len=1
master_xfer[1] R, addr=0x68, len=8
at91_xfer: processing 2 messages:
#0: writing 1 byte to 0x68
i2c_adapter i2c-0: Client creation failed at 0x68 (-5)
at91_i2c at91_i2c: AT91 i2c bus driver.
AT91 i2c bus driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
ieee80211: 802.11 data/management/control stack, git-1.1.13
ieee80211: Copyright (C) 2004-2005 Intel Corporation
drivers/rtc/hctosys.c: unable to open rtc device
可以看到i2c_adapter i2c-0: Client creation failed at 0x68 (-5)的错误,驱动在这里返回了,查看了一下代码,是因为在i2c-at91.c中等待txrdy标志位时超时。
我使用示波器测量了一下ds1307的scl管教,没发现有时钟信号,哪位大侠能告诉小弟一下啊。下面为rtc-ds1307.c的代码
|
菜鸟答:
i2c-at91.c中等待txrdy标志位时超时。
你都知道原因了,就去看看为什么超时啊。
i2c-at91.c中等待txrdy标志位时超时。
你都知道原因了,就去看看为什么超时啊。
|
drivers/rtc/hctosys.c: unable to open rtc device
关键是这一句,rtc设备没工作
关键是这一句,rtc设备没工作