Point to sample SPI for MMC card driver?

Robert S. Grimes rsg at alum.mit.edu
Wed Oct 15 20:44:03 UTC 2008


Gene Smith wrote:
>> Sorry, can't help you here, but you do want to be fairly current.
>> The libi2c SPI support has matured somewhat since I started (around
>> 4.8), and if you want to use the spi-sd-card driver, you'll need to
>> make sure you're based on at least 4.9 libi2c.  In particular, you'll
>> want to support the idle_char field of the transfer parameters
>> structure rtems_libi2c_tfr_mode_t.  See my latest posts regarding
>> "Card Specific Data".
>>
>> FWIW - I started with the powerpc/mpc5566evb SPI driver, as Sebastian
>>  suggested - I think you know the thread...
>>     
>
> Bob,
> Yes sd-card-init.c (in libbsp) and dspi.c (in libcpu) go together, right?
>   
Well, the former is the BSP code that sets up the spi-sd-card driver - I 
wrote a similar function for my BSP/application.  The latter is, I 
believe, the low-level SPI driver for the mpc55xxevb BSP.

Hmm... Looking back, I believe I've confused myself a bit.  My "SPI 
driver" is actually based on the one in powerpc/gen83xx/spi and 
libcpu/mpc83xx/spi.  Note that the former is the "low-level" code that 
is BSP-specific, while the latter is chip-specific - hence, the split 
you've noticed before.  Here is some explanation that Thomas had 
provided to me:

    Actually the mpc83xx driver is split into two parts (or three):
    - One is formed by the extended libi2c, it now supports also SPI devies.
    - Then we have the "real" driver in libcpu/mpc83xx/spi, which does
    the actual data transfers and has most of the interfaces needed.
    - And finally, since most SPI implementations need dedicated
    GPIO-lines to select the addressed hardware device, we need a small
    board specific layer. This (and the encapsulated initialization) is
    in libbsp/powerpc/gen83xx.

    I gues the last two pieces could be integrated into one for the
    virtex. If somebody wants to use the SPI with different GPIO lines
    to select the devies, the BSP should get some conditional
    compilation stuff.

As for my code to use the SD card driver, _that_ was based on the mpc55xx_sd_card_init() code.  Sorry if I've confused you on this - I'm still getting it straight myself!


> However, I don't see where mpc55xx_sd_card_init() is called. Would this 
> be called from the "predriver_hook" referred to in the readme?
>   
You know, to be honest, I don't really know where the best place is.  
For me, my BSP really supports several different variants, based on 
different FPGA configurations; only one will use the SD cards.  Factor 
in that I haven't yet mastered (or even passed the "rank novice" phase)  
autoconf/automake, I don't intend to call my equivalent in the BSP 
itself.  Instead, I'll do it in my application startup.  Not necessarily 
the "right" place to put it, but it saves me a lot of effort that I just 
cannot afford right now - the client isn't that interested...

> Thanks for the offer to answer my questions. (You will regret it :))  -gene
>   
Maybe, but then again, without a lot of help from the RTEMS community, 
I'd be dead in the water by now.  So if I can help even a little...

Take care,
-Bob

>   
>> Take care, -Bob
>>
>> P.S. Feel free to ask questions - it's still pretty fresh in my
>> mind...
>>
>>     
>>> Thanks, -gene
>>>
>>>       
>
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.com
> http://rtems.rtems.org/mailman/listinfo/rtems-users
>
>   




More information about the users mailing list