2009-11-06 22:30:17     mmc_spi problem!!!

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

2009-11-06 22:30:17     mmc_spi problem!!!

miaolf miao (CHINA)

Message: 82143   

 

hello everybody,I am using the bf533 board and the uClinux-dist-2009R1-RC6.The mmc_spi driver is ok,but I find it is a "full_duplex" and it do not use the DMA.The spi_bfin5xx.c code noted that "the hardware does not support full duplex DMA transfers". But if i want to use the DMA in this mode how can I do? Thank you!

TranslateQuoteReplyEditDelete

 

 

2009-11-06 22:35:35     Re: mmc_spi problem!!!

Mike Frysinger (UNITED STATES)

Message: 82144   

 

the HRM isnt lying.  you cant do full duplex w/DMA -- it's a hardware limitation.  nothing in software can magically make broken hardware work.

 

QuoteReplyEditDelete

 

 

2009-11-06 23:00:41     Re: mmc_spi problem!!!

miaolf miao (CHINA)

Message: 82145   

 

Thank you! if i want use the dma in the half duplex ,how can I do ?

TranslateQuoteReplyEditDelete

 

 

2009-11-06 23:41:27     Re: mmc_spi problem!!!

Mike Frysinger (UNITED STATES)

Message: 82146   

 

use enable_dma in the platform resources

QuoteReplyEditDelete

 

 

2009-11-07 00:12:08     Re: mmc_spi problem!!!

jiuchuan tang (CHINA)

Message: 82147   

 

Hi Mike

 

I am the colleague of miaolf.We have the save problem. I have set the  enable_dma flag of bfin5xx_spi_master and mmc's bfin5xx_spi_chip to 1,and in the " bfin_spi_pump_transfers" funtion of the code spi_bfin5xx.c,I print the state of the dma and full_duplex,like this

 

----------------------------------------------------------------------------------------------------------------------------

 

/*

 

* Try to map dma buffer and do a dma transfer.  If successful use,

 

* different way to r/w according to the enable_dma settings and if

 

* we are not doing a full duplex transfer (since the hardware does

 

* not support full duplex DMA transfers).

 

*/

 

printk("full_duplex:%d,drv_data->cur_chip->enable_dma:%d,drv_data->len:%d\n",full_duplex,drv_data->cur_chip->enable_dma,drv_data->len);

 

if (!full_duplex && drv_data->cur_chip->enable_dma

 

&& drv_data->len > 6) {

 

--------------------------------------------------------------------------------------------------------------------------

 

 

 

And the info while the kernel start is full_duplex:1,drv_data->cur_chip->enable_dma:1,drv_data->len:1 and so on

 

so I think the enable_dma flag I have set .If there is any other place to set enable_dma flag or I should change other place.

 

Thank you for you help

QuoteReplyEditDelete

 

 

2009-11-07 01:12:03     Re: mmc_spi problem!!!

Mike Frysinger (UNITED STATES)

Message: 82148   

 

i dont know what you're asking.  looks to me like you already have all the info necessary.

QuoteReplyEditDelete

 

 

2009-11-07 01:29:07     Re: mmc_spi problem!!!

jiuchuan tang (CHINA)

Message: 82149   

 

Mike,

 

I want to use the dma transfer,but in the code ,the full_duplex value is 1,so the code will not run "doing dma transfer",I want to ask why my full_duplex is 1,and how can I use the DMA transfer.

QuoteReplyEditDelete

 

 

2009-11-07 02:27:37     Re: mmc_spi problem!!!

jiuchuan tang (CHINA)

Message: 82150   

 

Mike

 

I want to use the DMA to transfer the mmc_spi data.But after I made the everything and the mmc is worked ok ,I found the debug info displayed that "doing IO transfer", so I look the code and find that the debug info is from the  bfin_spi_pump_transfers funtion,and in the funtion the condition if (!full_duplex && drv_data->cur_chip->enable_dma&& drv_data->len > 6) is 0 ,so it run the IO transfer,not DMA transfer.And when I look into it ,I find the full_duplex 's value is 1,it make the driver doing IO transfer,Now,I want the mmc to doing DMA transfer,how can I do.Thank you!

QuoteReplyEditDelete

 

 

2009-11-07 08:22:17     Re: mmc_spi problem!!!

Mike Frysinger (UNITED STATES)

Message: 82180   

 

if the SPI device needs/wants to do a full duplex SPI transaction, there's nothing you can do about it

QuoteReplyEditDelete

 

 

2009-11-08 21:23:03     Re: mmc_spi problem!!!

jiuchuan tang (CHINA)

Message: 82190   

 

Thank you Mike

 

 

 

I have some question about the MMC_SPI

 

1.MMC_SPI surport DMA and it regist DMA succeed,why it's  IO transfer not the DMA transfer in fact.

 

2. If the MMC_SPI can surport DMA transfer how can I do and how can I validate it? The half-duplex mode is ok,the hardware need which mode to surport DMA I can change the mode to surport the DMA, I want to use the DMA not the IO transfer

 

Thank you

 

 

QuoteReplyEditDelete

 

 

2009-11-08 21:33:06     Re: mmc_spi problem!!!

Yi Li (CHINA)

Message: 82192   

 

jiuchuan,

 

You can enable debug messages in the spi driver and see the output - whether the SPI is using DMA or PIO.

 

-Yi

QuoteReplyEditDelete

 

 

2009-11-08 22:25:40     Re: mmc_spi problem!!!

Robin Getz (UNITED STATES)

Message: 82193   

 

Jiuchuan:

 

You are not listening to Mike

 

- the SPI hardware on Blackfin is not capable of full duplex transactions with DMA.

 

- MMC requires full duplex tranactions.

 

- Therefore - you can not do MMC on the SPI will DMA.

 

If you need DMA - check out the SPORT as SPI, and do MMC on sport (as SPI).CONFIG_ SPI_BFIN_SPORT

 

  blackfin.uclinux.org/gf/project/uclinux-dist/tracker/?action=TrackerItemEdit&tracker_item_id=4277

 

The only think I'm not sure of is that MMC requires something other than mode 0/1.

QuoteReplyEditDelete

 

 

2009-11-09 00:53:28     Re: mmc_spi problem!!!

jiuchuan tang (CHINA)

Message: 82196   

 

Thank you Mike,Robin and Li,I have got it.

Attachments

    Outcomes