Forum Discussion
uClinux MMC SPI Driver
Just to let everyone know, an MMC SPI Driver for Alteras SPI Core (modified) is in the works.. currently, cards can be recognized, read/write, and even partitioned.. but some bugs are being worked out. If anyone is interested in an early release, let me know....
56 Replies
- Altera_Forum
Honored Contributor
Hi J,
There is a new spi driver dir in kernel 2.6.16 . Maybe you want to look at it. - Altera_Forum
Honored Contributor
I wish I knew about this before I began... I wrote all my low-level routines. Is there a driver for the NIOS SPI Core, or not yet? I will probably release the driver with my own SPI Support, and then work on integrating it with the SPI layer after...
- Altera_Forum
Honored Contributor
I didn't notice it when I was working on 2.6.16-rc4.
But there is no NIOS SPI. That's OK to usr your own. - Altera_Forum
Honored Contributor
I have completed an initial revision of the MMC SPI driver, it can be checked out/dl'ed from:
http://via.dynalias.org/svn/uclinux/patche..._mmc/tags/0.1.1 (http://via.dynalias.org/svn/uclinux/patches/nios_mmc/tags/0.1.1) This the latest stable release, and the latest is always in trunk/. Read the README file for installation instructions. The files are in the form of diff patches based on the 2.6.16 kernel (see hippos buildroot guide). Please PLEASE PLEASE post your feedback if you use this driver in THIS THREAD. This is a much more complicated driver compared to the EPCS Driver I released, so I need more feedback. Note to hippo: When the driver seems stable, could you please get this in the uClinux tree? I will keep adding diff patches on the base version until then. Also, you guys can just get my complete 2.6.16 kernel tree if you want from the /svn/uclinux/linux-2.6.16 directory using SVN. - Altera_Forum
Honored Contributor
J.
Awesome, it is a hardwork. Sure, I will add it soon. It is very helpful to keep a svn access, too. - Altera_Forum
Honored Contributor
Thanks hippo,
I forgot to add this; there is support for a status LED, configured via make menuconfig. I STRONGLY suggest those who want to use the driver to enable this feature. The reason why is currently, there is no DMAing of data. So if you are transferring any files that are reasonably large (>1 MB), your uClinux system will lock up whenever the IO Scheduler kicks in to actually do the transfer. With the LED enabled, you can see when the MMC Card is being accessed, so you know why it locks up periodically. Also, card insertion/removal is fine if it's not done in the middle of a transfer. Make sure you mount/unmount al filesystems properly before removing a card, or it will crash the kernel. Im' not sure if this is a uClinux bug or a bug in the driver. If you want to see what I mean, create/mount a filesystem on the MMC card, mount it and write a couple of files to it. Wait until it's done, and then eject the card. If you try and do an 'ls' while you are inside the filesystem, it will hang because the dev. node is no longer active. This is a relatively minor bug though. The overall speed is more of an issue if anything. Suggestions are welcomed. - Altera_Forum
Honored Contributor
..there seems to be a problem with large files. If you try to do a 'dd' command with something like 10 Megs for a filesize, something goes wrong, but it doesn't even seem to get to into the MMC Driver before it crashes. If anyone has any suggestions, or can replicate the same thing, let me know..
- Altera_Forum
Honored Contributor
You may check the scatter list management. I will check on my hardware, too.
- Altera_Forum
Honored Contributor
I executed this command which causes it to crash:
# dd if=/dev/zero of=./zero_file bs=1024 count=1000 I don't think it's the MMC driver because I tried this on a mounted CF card, and it failed as well. This means it's either something in the kernel, or something else in my hardware (RAM likely). I am using 2.6.16.1. Could you try this when you get some time hippo? I'm quite sure it's not MMC because I can view debugging messages, as well as my status LED, and it doesn't even enter the MMC routines. Maybe the kernel bails because of lack of memory, but I don't get any errors on the console. I also don't think it's hardware because I downloaded a previous kernel build using 2.6.11 with a CF driver, and tried writing 10 Megs using the same command, and it worked without a problem. I couldn't try the MMC Driver because the MMC layer changed a bit. The only other thing I can think of is that I'm using an older version of busybox, so maybe it doesn't like the new kernel.. - Altera_Forum
Honored Contributor
I repeated the tests on a usb disk with kernel 2.6.16.1. It had page allocation failure for very large files (>200MB). I am checking other kernels.