2009-03-06 14:18:06     SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

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

2009-03-06 14:18:06     SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Tim Shearer (UNITED STATES)

Message: 70541   

 

Hi Mike et al,

 

 

I'm currently experimenting with different kernel configurations in order to test SPI/MMC in different modes.  I'm usinf a cm-bf537e derived board, and release 2008r1.5-rc3.

 

 

The latest configuration is giving me a surprising problem.  When using the settings described in the wiki, but with a different chip select, I get a gpio conflict at boot time.

 

 

Device Drivers  --->

    MMC/SD Card support  --->

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

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

        (2)   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

 

 

 

At boot time, I get the following error:

 

 

mmc_pio_spi:cs_#: 0x2, baud=0x0, flag=0xff00, ctrl=0x400                       

bfin-gpio: GPIO 2 is already reserved as Peripheral by bfin-uart !             

Hardware Trace:      etc. etc.     

 

 

 

If I configure the kernel to use chip select 3 for the SPI interrupt, then I get:

 

 

mmc_pio_spi:cs_#: 0x2, baud=0x0, flag=0xff00, ctrl=0x400                       

bfin-gpio: GPIO 3 is already reserved as Peripheral by bfin-uart !             

Hardware Trace:      etc. etc.     

 

 

My /proc/gpio is as follows:

 

GPIO_0: bfin-uart               Peripheral                                     

GPIO_1: bfin-uart               Peripheral                                     

GPIO_2: bfin-uart               Peripheral                                     

GPIO_3: bfin-uart               Peripheral                                     

GPIO_7: IRQ 57          GPIO INPUT                                             

GPIO_11: mmc_pio_spi            Peripheral                                     

GPIO_12: mmc_pio_spi            Peripheral                                     

GPIO_13: mmc_pio_spi            Peripheral                                     

GPIO_32: bfin_mac               Peripheral                                     

GPIO_33: bfin_mac               Peripheral                                     

GPIO_34: bfin_mac               Peripheral                                     

GPIO_35: bfin_mac               Peripheral                                     

GPIO_36: bfin_mac               Peripheral                                     

GPIO_37: bfin_mac               Peripheral                                     

GPIO_38: bfin_mac               Peripheral                                     

GPIO_39: bfin_mac               Peripheral                                     

GPIO_40: bfin_mac               Peripheral                                     

GPIO_41: bfin_mac               Peripheral                                     

GPIO_42: bfin_mac               Peripheral                                     

GPIO_43: bfin_mac               Peripheral                                     

GPIO_44: bfin_mac               Peripheral                                     

GPIO_45: bfin_mac               Peripheral                                     

GPIO_46: bfin_mac               Peripheral                                     

GPIO_47: bfin_mac               Peripheral                                     

GPIO_48: bfin_mac               Peripheral                                     

GPIO_49: bfin_mac               Peripheral 

 

 

 

The first thing I suspected was that the SPORT device is using the PJ10 and PJ11 ios, which would cause a conflict since they double up as Chip Selects 3 and 2.  But that's not the case (SPORT is not compiled, and not listed in /dev).  It's also correct that bfin-uart has reserved gpios 2 and 3.  The fault is that the spi_mmc drive is mistakenly trying to allocate GPIO 2 as SPI Chip Sel 2, and GPIO 3 as SPI Chip Sel 3.. 

 

 

If anyone can point me in the right direction for how to fix this then it would help me greatly!

 

 

Many thanks,

 

Tim

 

 

QuoteReplyEditDelete

 

 

2009-03-06 14:59:05     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Mike Frysinger (UNITED STATES)

Message: 70545   

 

that driver is dead.  we're using the common one in trunk now.

 

otherwise, the output you show looks correct to me.  the driver interprets that # as a GPIO #, not as a SPI CS #.  you can look at the gpio.h header for the bf537 to see the mappings.

QuoteReplyEditDelete

 

 

2009-03-06 15:30:49     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Tim Shearer (UNITED STATES)

Message: 70546   

 

 

 

So what you're saying is that, for example, when using:

 

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

 

the 4 relates to the number corresponding with an io as defined in gpio.h, rather than the actual chip select number?  The limitaiton with that is the PJ ports (i.e. SPI slave select 2 and 3) aren't assigned a number in gpio.h, and therefore can't be used.

 

Incidentally, I'm downloading the trunk snapshot as I type.

 

Thanks,

 

Tim

QuoteReplyEditDelete

 

 

2009-03-06 15:43:21     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Mike Frysinger (UNITED STATES)

Message: 70548   

 

the spi_mmc driver uses a gpio as a cs

QuoteReplyEditDelete

 

 

2009-03-09 15:41:33     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Tim Shearer (UNITED STATES)

Message: 70621   

 

Following on from this, I'm now using the driver in trunk.  The actual driver itself seems to work ok, but the card detection is causing me grief. 

 

The card detect line is connected to PF7.  The interrupt is configured in the board c file, using the 2009r1 configuration on the Wiki (obviously modified to use IRQ_PF7.  I've looked at the signal on the scope, and it does exactly what one would expect: Line is high when card is inserted, drops to ground when removed.

 

Basically, the system only thinks the card is removed  after it has been removed and then reinserted.  For example:

 

(1) System boots, card is already inserted, card is detected and file-system mounted automatically (hotplug)

(2) Remove the card.  System still thinks it's inserted, and mmcblk0x device still in /dev.

(3) Reinsert card. "mmc0: SPI card removed" message displayed, and mmcblk0x devices have gone.

(4) Remove and reinsert card.  The card is detected and mounted.

(5) Repeat and scratch head.

 

Can someone tell me how the card removal is supposed to be detected... since the driver is configured with IRQF_TRIGGER_FALLING this can only call the driver's mmc_spi_detect_irq when it's inserted, not when it's removed...

 

Many thanks in advance,

 

Tim

 

 

QuoteReplyEditDelete

 

 

2009-04-17 11:27:31     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

blue hash (UNITED STATES)

Message: 72784   

 

My problem is in regards to compiling the new driver in 1.5RC3.

 

@Tim or Mike, Do I just copy the trunk /mmc folder to my build. string_helpers.h in /linux was missing, so I copied that from trunk.

 

I get the following errors.

 

drivers/mmc/card/block.c: In function ‘mmc_blk_put’:

drivers/mmc/card/block.c:86: warning: implicit declaration of function ‘disk_devt’

drivers/mmc/card/block.c: At top level:

drivers/mmc/card/block.c:95: error: expected declaration specifiers or ‘...’ before ‘fmode_t’

drivers/mmc/card/block.c: In function ‘mmc_blk_open’:

drivers/mmc/card/block.c:105: error: ‘mode’ undeclared (first use in this function)

drivers/mmc/card/block.c:105: error: (Each undeclared identifier is reported only once

drivers/mmc/card/block.c:105: error: for each function it appears in.)

drivers/mmc/card/block.c: At top level:

drivers/mmc/card/block.c:114: error: expected declaration specifiers or ‘...’ before ‘fmode_t’

drivers/mmc/card/block.c:132: warning: initialization from incompatible pointer type

drivers/mmc/card/block.c:133: warning: initialization from incompatible pointer type

drivers/mmc/card/block.c: In function ‘mmc_sd_num_wr_blocks’:

drivers/mmc/card/block.c:161: error: ‘MMC_RSP_SPI_R1’ undeclared (first use in this function)

drivers/mmc/card/block.c:166: warning: implicit declaration of function ‘mmc_host_is_spi’

drivers/mmc/card/block.c: In function ‘mmc_blk_issue_rq’:

drivers/mmc/card/block.c:232: error: ‘MMC_RSP_SPI_R1’ undeclared (first use in this function)

drivers/mmc/card/block.c:236: error: ‘MMC_RSP_SPI_R1B’ undeclared (first use in this function)

drivers/mmc/card/block.c:262: error: too few arguments to function ‘mmc_set_data_timeout’

drivers/mmc/card/block.c:330: warning: implicit declaration of function ‘__blk_end_request’

drivers/mmc/card/block.c:371: warning: implicit declaration of function ‘blk_rq_cur_bytes’

drivers/mmc/card/block.c: In function ‘mmc_blk_set_blksize’:

drivers/mmc/card/block.c:483: error: ‘MMC_RSP_SPI_R1’ undeclared (first use in this function)

make[3]: *** [drivers/mmc/card/block.o] Error 1

make[2]: *** [drivers/mmc/card] Error 2

make[1]: *** [drivers/mmc] Error 2

make: *** [drivers] Error 2

QuoteReplyEditDelete

 

 

2009-04-20 02:02:00     Re: SPI/MMC: GPIO x is already reserved as Peripheral by bfin-uart !

Mike Frysinger (UNITED STATES)

Message: 72836   

 

sorry, but not supported

Attachments

    Outcomes