brightjm n00b
Joined: 13 Feb 2012 Posts: 8
|
Posted: Tue Aug 14, 2012 1:37 pm Post subject: SD card writing issue on a new ATP / Transcend card |
|
|
The situation is as follows:
(1) The motherboard is designed with MPC8378ERDB;
The application is running on a ATP new sd card that conforms to SD 2.0 specification.
It sometimes reports error -5 (I/O) error when accessing the SD card. It could read successfully and it sometimes fails to write when the buffer length is over 512 bytes. But all is ok when the application is running on an old SD card that conforms to sd 1.1 specification (older sd card).
(2) The ESDHC host version control register is 0x01000000 (ready-only) which indicates that the vendor version number is freescale eSDHC version 1.0 and it conforms to SD host specification 1.0.
(3) The development platform provided by freescale is based on ltib packages and the linux os version is 2.6.25.
(4) The error message is like this:
end_request: I/O error, dev mmcblk0, sector 855
end_request: I/O error, dev mmcblk0, sector 727
Buffer I/O error on device mmcblk0p1, logical block 488
lost page write due to I/O error on mmcblk0p1
mmc0: Controller never released inhibit bit(s).
mmcblk0: error -5 sending read/write command
end_request: I/O error, dev mmcblk0, sector 487
Buffer I/O error on device mmcblk0p1, logical block 248
lost page write due to I/O error on mmcblk0p1
mmc0: Controller never released inhibit bit(s).
mmcblk0: error -5 sending read/write command
end_request: I/O error, dev mmcblk0, sector 247
Buffer I/O error on device mmcblk0p1, logical block 8
lost page write due to I/O error on mmcblk0p1
(5) The host controller version register is read as 0x01000000 and it indicates that the vendor version number is freescale eSDHC version 1.0 and the SD host specification version is 1.0.
It seems that the host controller capabilities is changed back after modification and eSDHC resets after modification. It keeps the same with the default value. There is description on host controller capabilities (HOSTCAPBLT).
The host controller capabilities provides the host driver with information specific to the eSDHC implmentation. The value in the register doesn't change in a software reset, and any write to this register is ignored.
(6) esdhc: Freescale Enhanced Secure Digital Host Controller driver
default sysctl register:0xa3100e00 | default caps register:0x0000e301
(7) I changed the kernel file in drivers/mmc/core.c
/*
* Sets the host clock to the highest possible frequency that
* is below "hz".
*/
void mmc_set_clock(struct mmc_host *host, unsigned int hz)
{
WARN_ON(hz < host->f_min);
if (hz > host->f_max)
hz = host->f_max;
//host->ios.clock = hz;
host->ios.clock = 25000000;
mmc_set_ios(host);
}
I Changed the working clock to 25000000 Hz from 50000000 Hz
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 0 timing 2
mmc0: clock 25000000Hz busmode 2 powermode 2 cs 0 Vdd 20 width 2 timing 2
mmc0: new high speed SD card at address b368
mmcblk0: mmc0:b368 AF SD 491520KiB
mmcblk0: p1
Any ideas on this? Thank you very much. I am badly in need of help. |
|