>-----Original Message----- >From: Barry Song [mailto:21cnbao@xxxxxxxxx] >Sent: Wednesday, September 02, 2009 3:52 PM >To: David Brownell >Cc: Song, Barry; Mike Frysinger; >dbrownell@xxxxxxxxxxxxxxxxxxxxx; dtor@xxxxxxx; >dmitry.torokhov@xxxxxxxxx; >spi-devel-general@xxxxxxxxxxxxxxxxxxxxx; >linux-input@xxxxxxxxxxxxxxx; uclinux-dist-devel@xxxxxxxxxxxxxxxxxxxx >Subject: Re: [Uclinux-dist-devel] [PATCH 2/2] add ad714x input >driver forbutton/scrollwhell/slider/touchpad > >David, >I am really surprised the kmalloc memory can keep DMA-safe. Check the >code, no matter spi_write_then_read and spi_init, they only get memory >by a simple >kmalloc(SPI_BUFSIZ, GFP_KERNEL); >I can't find map_single or dma coherent operations at all. So did I >lose something? >Thanks >Barry Get it. SPI driver need to make dma_map_single or other dma coherent operations by itself. The kmalloc memory you call only makes sure the DMA-safe but not DMA-consistent. > >On 9/2/09, David Brownell <david-b@xxxxxxxxxxx> wrote: >> On Tuesday 01 September 2009, Song, Barry wrote: >>> >> + spi_message_add_tail(&t, &m); >>> >> + ret = spi_sync(spi, &m); >>> > >>> >cant you use spi_write_then_read() ? dont let the u8* >prototype scare >>> >you, it should work with writing 16bits and then reading 16bits. >>> >>> I have never been scared by any u8* or something else. I only prefer >>> to use raw spi API, which can show the bottom level timing and SPI >>> bus feature better. >> >> In this case spi_write_then_read() is required, since >> your tx and rx buffers are on the stack and hence not >> DMA-safe. >> > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html