2008-12-29 06:05:08     SPI SD/MMC => uClinux2009R1_pre

Document created by Aaronwu Employee on Aug 9, 2013
Version 1Show Document
  • View in full screen mode

2008-12-29 06:05:08     SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67147   

 

Hi,

 

only a small question,

how can i set the SPI-SD/MMC driver in kernel-config ?

where can i set the SPI-Chip select ?

 

Thank you for help,

 

- Patrick

TranslateQuoteReplyEditDelete

 

 

2008-12-29 21:59:52     Re: SPI SD/MMC => uClinux2009R1_pre

Tony Liu (CHINA)

Message: 67164   

 

Patrick Hotz,

 

Device Drivers  --->

    MMC/SD Card support  --->

        <*> MMC/SD for SPI support (EXPERIMENTAL)

        SPI driver (Blackfin SPI bus directly)  --->

        (4)   SPI chip select signal for MMC/SD card

        (20000000) SPI clock limit for MMC/SD transfers

        [*]     MMC/SD Card detect support (EXPERIMENTAL)

        (55)      IRQ# for card detection

 

 

(4)   SPI chip select signal for MMC/SD card  -> mean using PF4 as spi select.

 

 

 

For detail pls visit:

 

http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:spi_mmc&s[]=mmc

 

 

 

 

QuoteReplyEditDelete

 

 

2008-12-30 02:57:51     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67175   

 

Thats my problem.....

I cant find such a menue in kernel-config.

 

In "Device Drivers -->

        MMC/SD/SDIO card support -->

           (*) MMC debugging

           ( ) Allow unsafe resume

           MMC/SD/SDIO Card Drivers

           (*) MMC block device driver

              (*) Use bounce buffer for simple hosts

           ( ) SDIO UART/GPS class support

           ( ) MMC host test driver

           MMC/SD/SDIO Host Controller Driver

           ( ) Secure Digital Host Controller Interface support

           (*) MMC/SD/SDIO over SPI

                  => but there is nothing to choose <=

 

Patrick

TranslateQuoteReplyEditDelete

 

 

2008-12-30 05:33:27     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67200   

 

I have just looked at the "...drivers/mmc/..." folder.

There is no folder like "spi_mmc" as in the dist-2008R1.5....

 

Copy the "spi_mmc" folder into the trunk version and adding it to the Makefile/Kconfig shows this problem:

....

drivers/mmc/spi_mmc/spi_mmc_core.c: In Function "spi_mmc_process_request"

drivers/mmc/spi_mmc/spi_mmc_core.c:368: Fehler: Implizite Deklaration der Funktion "end_that_request_first"

drivers/mmc/spi_mmc/spi_mmc_core.c:371: Fehler: Implizite Deklaration der Funktion "end_that_request_last"

drivers/mmc/spi_mmc/spi_mmc_core.c: In Funktion "spi_mmc_make_request"

drivers/mmc/spi_mmc/spi_mmc_core.c:513: Fehler: zu viele Argumente für Funktion "bio_endio"

drivers/mmc/spi_mmc/spi_mmc_core.c: Auf höchster ebene:

drivers/mmc/spi_mmc/spi_mmc_core.c:960: Warnung: Initialisierung von inkomplatiblem Zeigertyp

drivers/mmc/spi_mmc/spi_mmc_core.c:961: Warnung: Initialisierung von inkomplatiblem Zeigertyp

drivers/mmc/spi_mmc/spi_mmc_core.c:964: Warnung: Initialisierung von inkomplatiblem Zeigertyp

make[4]: *** [drivers/mmc/spi_mmc_core.o] Fehler

....

 

is there somebody who can help me?

 

 

 

best regards

- Patrick

TranslateQuoteReplyEditDelete

 

 

2008-12-30 15:50:41     Re: SPI SD/MMC => uClinux2009R1_pre

Mike Frysinger (UNITED STATES)

Message: 67218   

 

copying spi mmc code from trunk to 2008R1.5 isnt going to work

 

QuoteReplyEditDelete

 

 

2009-01-02 03:09:47     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67281   

 

Hi Mike,

 

thank you for your reply.

What can i do to get the SPI-MMC/SD Driver running?

I was very surprised that there is no way to set the values for the card.

 

 

 

Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-02 03:43:51     Re: SPI SD/MMC => uClinux2009R1_pre

Mike Frysinger (UNITED STATES)

Message: 67284   

 

either use the driver in 2008R1.5 in standalone mode (i.e. no other spi device) or use svn trunk

QuoteReplyEditDelete

 

 

2009-01-02 04:46:11     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67286   

 

I use the svn trunk which i have downloaded one week ago....

but there is noting to choose the spi_mmc

 

Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-02 07:09:33     Re: SPI SD/MMC => uClinux2009R1_pre

Mike Frysinger (UNITED STATES)

Message: 67301   

 

yes there is ... you already found it:

           (*) MMC/SD/SDIO over SPI

 

all board settings are in the board resources file like any other driver

QuoteReplyEditDelete

 

 

2009-01-02 08:24:31     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67305   

 

Hi Mike,

 

now i know the problem....

the board info (tcm-bf537.c) is not right,

there is the spi_mmc config with "CONFIG_SPI_MMC" and not "CONFIG_MMC_SPI" like the "stamp.c"

Can you explain me what i have to change in the "tcm-bf537.c" file to get the driver running?

I have tried to change the "CONFIG_SPI_MMC" into "CONFIG_MMC_CONFIG" but in uClinux there is no device like spi_mmc.

 

 

 

Regards

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-04 12:38:24     Re: SPI SD/MMC => uClinux2009R1_pre

Mike Frysinger (UNITED STATES)

Message: 67333   

 

only the bf537-stamp has been tested

QuoteReplyEditDelete

 

 

2009-01-05 04:36:11     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67373   

 

Mike,

 

can you give me an example how i can copy the right sourcecode in the tcm-bf537.c file?

What is the way to get it running?

 

 

Regards

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-05 17:55:15     Re: SPI SD/MMC => uClinux2009R1_pre

Mike Frysinger (UNITED STATES)

Message: 67391   

 

refer to the stamp.c file.  spi mmc should work on the bf537-stamp.

QuoteReplyEditDelete

 

 

2009-01-09 10:30:02     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67727   

 

Hi Mike,

 

i have copied the the two parts in stamp.c which contains "CONFIG_MMC_SPI" (the part with the "modalias = " and so on, and the part with the "bfin_mmc_spi_Init")

 

the uCLinux boot shows:

 

.....

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_7

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

mmc_spi spi0.4: ASSUMING 3.2-3.4 V slot power

mmc_spi spi0.4: SD/MMC host mmc0, no DMA, no WP, no poweroff

TCP cubic registered

NET: Registered protocol family 17

rtc-bfin rtc-bfin: setting system clock to 2009-01-09 16:20:34 UTC (1231518034)

mmc_spi spi0.4: requested mode not fully supported

mmc_spi spi0.4: can't change chip-select polarity

VFS: Mounted root (ext2 filesystem).

Freeing unused kernel memory: 108k freed

......

 

i have tried to change the chip-select but anytime the boot shows the same....

i need the chip-select 1 and this one is not used by another device.....

 

my current svn is 5971.....

what i can do?

 

Regards

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-12 05:34:32     Re: SPI SD/MMC => uClinux2009R1_pre

Yi Li (CHINA)

Message: 67786   

 

Patrick,

 

Please ignore these two lines:

 

"mmc_spi spi0.4: requested mode not fully supported

mmc_spi spi0.4: can't change chip-select polarity"

 

They are just warnings. When mmc-spi driver probe for new card, it will try several settings. Some setting will fail and give these messages -- these messages are misleading.

 

To check whether mmc-spi driver works, you may look at:

 

root:/> cat /proc/interrupts                                                  

[snip]                                         

55:         72      GPIO  mmc-spi-detect

 

And insert a new card, there will be messages like:

 

"mmc_spi spi0.4: requested mode not fully supported                            

mmc_spi spi0.4: can't change chip-select polarity                             

mmc0: host does not support reading read-only switch. assuming write-enable.  

mmc0: new SDHC card on SPI                                                    

mmcblk0: mmc0:0000 SDC   3.51 GiB                                             

mmcblk0: p1   "

 

I've updated the wiki doc to add this information: http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:spi_mmc

 

-Yi

 

 

 

 

 

 

 

 

QuoteReplyEditDelete

 

 

2009-01-12 06:14:00     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67789   

 

Hi Yi,

 

I have added the Setting in Kernel-Config and the board file.

My problem is that the SD-Card bred an error...

 

"mmc_spi spi0.1: requested mode not fully supported

mmc_spi spi0.1: can't change chip-select polarity

mmc0: error -84 whilst initialising SD card"

 

I think the Interrupts and the gpios looks ok....

 

root:/> cat /proc/gpio

....

GPIO_10:        mmc_spi                 Peripheral

....

GPIO_30:        gpio-irq80              GPIO INPUT

....

 

root:/dev> cat /proc/interrupts

  6:     127007      CORE  Blackfin Core Timer

10:          1      INTN  rtc-bfin

18:          0      INTN  BFIN_UART_RX

19:         67      INTN  BFIN_UART_TX

24:       1567      INTN  EMAC_RX

80:         12      GPIO  mmc-spi-detect

Err:          0

 

Do you know the reason for this error?

 

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-12 07:43:34     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67800   

 

OK, i think the problem is my 1GB SD-Card from CnMemory....

I have tried another one with 4GB and the Driver detects the card.

 

mmc_spi spi0.1: requested mode not fully supported

mmc_spi spi0.1: can't change chip-select polarity

mmc0: host does not support reading read-only switch. assuming write-enable.

mmc0: new SDHC card on SPI

mmcblk0: mmc0:0000    3.75 GiB

mmcblk0:

 

root:/>

 

But where can I find the Card?

I have a FAT Filesystem and 64kByte Clusters.

in "dev/" there is no "mmcblk0"-device....

 

root:/dev> ls

bfin-dma            gpio24              gpio43              mtdblock1

console             gpio25              gpio44              mtdblock2

cpu_dma_latency     gpio26              gpio45              mtdblock3

full                gpio27              gpio46              network_latency

gpio0               gpio28              gpio47              network_throughput

gpio1               gpio29              gpio5               null

gpio10              gpio3               gpio6               ptmx

gpio11              gpio30              gpio7               pts

gpio12              gpio31              gpio8               random

gpio13              gpio32              gpio9               root

gpio14              gpio33              kmsg                rtc0

gpio15              gpio34              mem                 sport0

gpio16              gpio35              mtd0                sport1

gpio17              gpio36              mtd0ro              tty

gpio18              gpio37              mtd1                ttyBF0

gpio19              gpio38              mtd1ro              ttyBF1

gpio2               gpio39              mtd2                urandom

gpio20              gpio4               mtd2ro              watchdog

gpio21              gpio40              mtd3                zero

gpio22              gpio41              mtd3ro

gpio23              gpio42              mtdblock0

root:/dev>

 

 

 

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-12 22:16:13     Re: SPI SD/MMC => uClinux2009R1_pre

Yi Li (CHINA)

Message: 67838   

 

Patrick,

 

Please check the following:

 

1. Make sure CONFIG_MMC_BLOCK is set

 

2. Make sure "mdev" has been set up for hotplug event:

 

root:/> cat /proc/sys/kernel/hotplug                                          

/bin/mdev

 

3. If everything OK, in the /sys tree, I would see:

 

root:/> cat /sys/class/mmc_host/mmc0/mmc0\:0000/block/mmcblk0/uevent          

MAJOR=179                                                                     

MINOR=0                                                                       

DEVTYPE=disk

 

4. If there is no partition on the disk, run "fdisk /dev/mmcblk0" to create a patition.

 

-Yi

 

 

 

 

QuoteReplyEditDelete

 

 

2009-01-13 02:42:03     Re: SPI SD/MMC => uClinux2009R1_pre

Patrick Hotz (GERMANY)

Message: 67842   

 

Hi,

 

the SD-Card is running now....

I have changed the board-file:

- the "platform_data" in "CONFIG_MMC_SPI" I have changed to "NULL" => now the driver works without any interrupt (in my board there is no signal by the SD-Card Slot)

 

The Boot shows:

"mmc0: host does not support reading read-only switch. assuming write-enable.

mmc0: new SD card on SPI

mmcblk0: mmc0:0000    3.75 GiB

mmcblk0:"

 

In "/dev" I can see the "mmcblk0" although the boot shows no partition.

 

But the essential thing i need is to save files at the card... and this works fine now...

 

 

 

Thank you very much,

 

- Patrick

TranslateQuoteReplyEditDelete

 

 

2009-01-13 10:32:39     Re: SPI SD/MMC => uClinux2009R1_pre

Wolfgang Muees (GERMANY)

Message: 67887   

 

My problem is that the SD-Card bred an error...

 

mmc0: error -84 whilst initialising SD card"

 

Do you know the reason for this error?

 

Yes. This card does send its data not on SPI byte boundaries, but with a bit offset. I have not managed to come up with an easy non-performance-killing fix for this behaviour. Oh if the SPI framework would have a function to do a  1..7 bits SPI transfer!

 

regards

 

Wolfgang

TranslateQuoteReplyEditDelete

 

 

2009-01-13 10:38:09     Re: SPI SD/MMC => uClinux2009R1_pre

Wolfgang Muees (GERMANY)

Message: 67890   

 

In "/dev" I can see the "mmcblk0" although the boot shows no partition.

 

My mdev.conf contains:

 

# SD cards

mmcblk[0-9] 0:0 0664 */opt/auerswald/scripts/hotplug-sd

mmcblk[0-9]p[1-9] 0:0 0664 */opt/auerswald/scripts/hotplug-sd

 

My hotplug-sd contains:

 

#!/bin/sh

 

SD_MPOINT=/data/mnt/sdcard

 

case "$ACTION" in

        add|"")

                mkdir -p $SD_MPOINT

                mount -t vfat $MDEV $SD_MPOINT

                ;;

        remove)

                umount $SD_MPOINT

                rmdir $SD_MPOINT

                ;;

esac

 

 

This script will mount SD card with and without partition.

 

regards

Wolfgang

Attachments

    Outcomes