2.6.12 SD card patch

This forum is for users of Microchip MPUs and who are interested in using Linux OS.

Moderator: nferre

bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

2.6.12 SD card patch

Fri Jul 15, 2005 8:57 pm

http://projects.drzeus.cx/wbsd/download ... 6.12.patch

has anyone got this to work on EK?

The at91rm9200_mci.c needs some setup work.
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

Fri Jul 15, 2005 11:23 pm

ok, its working. i mounted a 1g lexar. also moved some big files to a usb drive from SD and back. then erase some files on SD.
It is in 1-bit mode.
looked at the debug messages, no errors.

verry nice. :P
Colonel Sammy
Location: Warwick, England
Posts: 7
Joined: Wed Jun 15, 2005 8:58 pm

SD cards, MMC cards

Tue Jul 19, 2005 10:01 am

You may be lucky to have it working - our EK appears to have a problem communicating directly with an MMC card - if I turn on MCI debugging then it appears to fail with a CRC error on the first DMA transfer (same for two different MMC cards) - this appears to go away if I adapt the code so that it doesn't use interrupts so there's something wrong with the driver - possibly some kind of timing thing that might affect some boards but not others :(

Havn't tried the SD patch yet - did you need to change any other code to get it working?

Malcolm
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

Wed Jul 27, 2005 10:57 pm

1. download 2.6.12.2 from kernel.org enable all the mci and fat stuff, video off
2. apply the patch from http://maxim.org.za/AT91RM9200/2.6/
3. compile and fix head.s , test bootup with 2.6 edited ramdisk from http://www.applieddata.net ie edit consloe startup to ttyS0 etc
4. download at91rm9200_mci.c and mci.c and some other files from http://www.kwikbyte.com SD 'howto'. and also the DR patch , link is in kwikbyte.
5. define the debug defines in the 2 files for a *lot* of messages.
the card will mount at this point. you will see mci not registered msg on boot but then later see the device registered.
6. i'm cleaning up the init so that the ancillary par ports are correct.

mount -tvfat /dev/discs/disc0/part1 /mnt

on the sandisk types-
if you get a fat not found , try once more as it flushes the mci on first try.
i did not see that on the lexar.
i am in the 4 bit mode, actually wanted the 1bit but no time to mod the driver.
hope i remember it all.

I think the MMC will no longer operate but who cares, we can't buy them locally anyway.

:o
Last edited by bruce vicknair on Mon Aug 15, 2005 5:08 pm, edited 1 time in total.
awm129
Location: Herndon, VA
Posts: 6
Joined: Tue Aug 09, 2005 3:06 pm

Thu Aug 11, 2005 4:37 pm

what version of cross are you using to compile the 2.6 kernel? I get assembly errors with 2.95.3. Something about :

usr/initramfs_data.S:29: Error: Unknown pseudo-op: `.incbin'

I'm in the process of downloading cross-3.2 now, I hope it has better results...

Thanks!
/andy
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

Thu Aug 11, 2005 8:35 pm

i use the tools on this iso. Works perfect on both 2.4 and 2.6 kernel builds. also busybox and user apps. I have not used the dynamic libs, my target apps are static.

http://www.embeddedarm.com/downloads/Li ... s-7200.iso


I have slimed down my target now using busybox. I mount the sd in /etc/init.d/rcS

it works perfect every time . i think the old 'mount' i used was creating occasional problem. busybox mount works super.

the link for kwickbyte how to looks broken now.

so i'll attach the files i'm using ( use the dr patch first, then replace thse two files)
i've slowed the sdclk to 7.5 mhz, 24mhz is not what i want to put in a -40 to 100C application.

i can' run a pgm directly fromm the mci, have to copy it first to ramdisk. not sure why: open read, write to the sd path works. may be a permissions thing, not sure for now.
Last edited by bruce vicknair on Thu Aug 11, 2005 8:56 pm, edited 1 time in total.
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

Thu Aug 11, 2005 8:53 pm

forgot to mention, i also removed the EK mux and ran straight mmc traces as in my target. the spi socket is still functional and will boot u-boot.
awm129
Location: Herndon, VA
Posts: 6
Joined: Tue Aug 09, 2005 3:06 pm

Fri Aug 12, 2005 7:17 pm

don't suppose you have an active link for the 2.6 ramdisk you're using, the one above seems to be broken....
I'm getting a:
[root @ AT91RM9200EK]# mount -tvfat /dev/discs/disc0/part1 /mnt
mount: Mounting /dev/discs/disc0/part1 on /mnt failed: No such device

so I'm hoping its just becasue I'm still using the old 2.4 ramdisk. The kernel sees the card on boot and can even see how big it is... i just can't mount it.

Also did you have u-boot issues when you went to 2.6? I had to hack the u-boot source to get it to pass the correct board id to the kernel.

try mounting with the -o exec option... that may fix your executable problem
thanks for the post!
/andy
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

ramdisk - head.s

Mon Aug 15, 2005 5:07 pm

a better solution for the ramdisk i found is to use busybox with a new clean ramdisk..

2.6 ramdisk from scratch: on your desktop as root(mine is suse 9.2, dont buy 9.3)
dd if=/dev/zero of=tmp/ramdisk bs=8388k count=1
mkfs.ext2 -i 1024 -F tmp/ramdisk
sync
mount -o loop tmp/ramdisk /tmp/mnt
df

download latest busybox.net:
change ./config ( i use make menuconfig) to point to your tools, install path to tmp/mnt
remember to select 2.6 insmod in menuconfig.
make install

you need /etc/inet.d/rcS and inittab. see busybox docs
sync
umount tmp/mnt
cd tmp/ramdisk
gzip ramdisk
cp ramdisk.gz /tftpboot


the other ramdisk worked but is so bloated with system V.
ramdisk attached, head.s add 3 lines, i'll try the -o in mount.

[IN HEAD.S]------------
ENTRY(stext)
msr cpsr_c, #PSR_F_BIT | PSR_I_BIT | MODE_SVC @ ensure svc mode
@ and irqs disabled
************* ADD these 3 lines in head.s
mov r1, #250 @ fix for at91rm9200ek board ID
add r1, r1, #250
add r1, r1, #205 @ ID=705
*************
bl __lookup_processor_type @ r5=procinfo r9=cpuid
movs r10, r5 @ invalid processor (r5=0)?
beq __error_p @ yes, error 'p'
bl __lookup_machine_type @ r5=machinfo
movs r8, r5 @ invalid machine
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

uImage 2.6.12 kernel

Mon Aug 15, 2005 5:56 pm

use with the above ramdisk.. over 1 meg so adjust the load area for ramdisk to 21180000

bootargs=root=/dev/ram rw ramdisk_size=15360 mem=32M initrd=0x21180000,6000000 console=ttyS0,115200n8
(i know the ramdisk size in bootarg is incorrect , i'll fix it eventually)

tftp 21000000 uImage
tftp 21180000 ramdisk.gz
bootm 2100000

you get a fat file error on first attempt, (flushing the MCI)but it will always mount on the 2nd try. I'll look at a flush when time available.
:!:
NOTE!!!!!! the bbs would not allow a bin file without extention to upload, so simply rename uImage.zip to uImage. do not attempt to unzip...
:!:
Jay2
Location: Quebec, Canada
Posts: 6
Joined: Thu Sep 01, 2005 9:40 pm

Sat Sep 03, 2005 6:01 am

Just for clarifications:

Will this patch enable us to use SD over the 2.4 kernel? or it will only work on 2.6? Is adaptation possible/easy?

Also, in order to use this, do I need to have full 4 data wires connected? We are curently designing our board, and would like to use SD in 1 bit mode, (MCCK, MCCDA, MCDA0), as the other MSDAx will be used on SSC0 instead.

Will this patch work, or is 4 bit mode mandatory?

Thanks,
Jerome Marchand
ArmUS team.
bruce vicknair
Contact:
Location: tomball, tx
Posts: 60
Joined: Wed Jan 26, 2005 3:24 am

Sat Sep 03, 2005 6:24 am

don't know about the 2.4 kernel. possibly you could manually patch.

i looked at the code and one bit seems doable but could not get it to work in by just changing a few defs, we changed our design to use 4 bit mode.


on the ramdisk/busybox: now using shared libs and all is working excellent.

Return to “LINUX”

Who is online

Users browsing this forum: Google [Bot] and 2 guests