Re: SPI controller hangs in 2.6 and not in 2.4 (on MPC875)
From: Vitaly Bordug <hidden>
Date: 2007-02-26 07:41:26
On Sun, 25 Feb 2007 20:51:12 +0100 DI BACCO ANTONIO - technolabs wrote:
Hi Melinda,
the problem in my case was caused by the following instructions to
allocate the buffers for SPI controller tx and rx:
rxbuffer = (u8*)m8xx_cpm_hostalloc(SPI_MAX_BUFFER_SIZE);
txbuffer = (u8*)m8xx_cpm_hostalloc(SPI_MAX_BUFFER_SIZE);
// Set the bd's rx and tx buffer address pointers
rbdf->cbd_bufaddr = virt_to_bus((void
*)rxbuffer); tbdf->cbd_bufaddr = virt_to_bus((void *)txbuffer);
I don't know why (I'm asking an opinion to Vitaly Bordug), I replaced
the allocation of rx and tx buffers with:
...->cbd_bufaddr = __pa(__get_free_page(GFP_KERNEL | GFP_DMA))Well this is just evil... even if it works :)
but it will better to use dma_alloc_coherent. In my case the use of m8xx_cpm_hostalloc led to an immediate kernel hang after giving the start command to the spi controller.
Heh, this case you'lll have to use dpram for the buffers I guess iiuc. dma_* stuff might work too but I'm not sure. Moreover, it didn't work for me in case of powerpc, where m8xx_cpm_hostalloc made as a placeholder for dma_alloc_coherent...