Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1160384 > unrolled thread
| Started by | Eddie Huang <eddie.huang@mediatek.com> |
|---|---|
| First post | 2015-06-08 12:20 +0200 |
| Last post | 2015-06-18 10:20 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH 2/3] spi: mediatek: Add spi bus for Mediatek MT8173 Eddie Huang <eddie.huang@mediatek.com> - 2015-06-08 12:20 +0200
Re: [PATCH 2/3] spi: mediatek: Add spi bus for Mediatek MT8173 Eddie Huang <eddie.huang@mediatek.com> - 2015-06-18 10:20 +0200
| From | Eddie Huang <eddie.huang@mediatek.com> |
|---|---|
| Date | 2015-06-08 12:20 +0200 |
| Subject | Re: [PATCH 2/3] spi: mediatek: Add spi bus for Mediatek MT8173 |
| Message-ID | <pz2jT-3X6-9@gated-at.bofh.it> |
Hi Mark, On Fri, 2015-05-15 at 17:25 +0800, Mark Brown wrote: > On Fri, May 15, 2015 at 03:38:42PM +0800, leilk liu wrote: > > On Tue, 2015-05-12 at 17:05 +0100, Mark Brown wrote: > > > > Implement can_dma() - look for drivers providing that for examples. > > > MTK spi hardware uses the dmaengine in spi controller. According to > > datasheet, spi driver just need to enable dma register bit and write a > > physical address to relevant dma address register, so I think it may be > > complex while the driver supports can_dma. > > That's how a very large proportion of devices that work with DMA are > done - why would this be complicated? All can_dma() does is report if > DMA is possible. In include/linux/spi/spi.h, it describes if can_dma() exists and returns true, dma_tx and dma_rx must be set.But Medaitek SPI controller has its own dma hardware, which means this dma resides in the same base address range with SPI controller, and only used by SPI, so we don't implement generic DMA driver, such that can't provide dma channel and assign to dmx_tx, dmx_rx parameter. We think it's strange to implement generic dma driver for dma that only used by specific hardware.Can we just provide can_dma() function and return false ? But I think it's a little odd that there actually has dma. So can we just skip can_dma() function let it be NULL ? Eddie Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Eddie Huang <eddie.huang@mediatek.com> |
|---|---|
| Date | 2015-06-18 10:20 +0200 |
| Message-ID | <pCDdg-2KO-9@gated-at.bofh.it> |
| In reply to | #1160384 |
On Wed, 2015-06-17 at 17:35 +0100, Mark Brown wrote: > On Wed, Jun 17, 2015 at 10:10:51PM +0800, Eddie Huang wrote: > > > Our hardware limitation is: we don't have separate dma tx, rx channel > > with transfer finish interrupt, only have spi trigger operation.So the > > mediatek SPI dma full duplex operation steps are: > > 1. Set TX DMA address. > > 2. Set RX DMA address. > > 3. Set length (this step assume TX, RX are the same size). > > 4. Set TX DMA enable, RX DMA enable bit in spi config register. (not > > trigger DMA, just told spi use dma) > > 5. Trigger spi operations. > > 6. Wait spi operations finish interrupt. > > Sure, that's what I understood. > > > If tx scatterlist per list data size are 128, 4096, 256. rx scatterlist > > per list data size are 128, 4096, 256. So we need to go through above > > steps three times. If tx scatterlists per list data size are 128, 4096, > > 256. rx scatterlists per list data size are 256, 4096, 128. If we start > > sending first entry, tx size is 128, rx size is 256, this will cause > > hardware malfunction because tx, rx data length are not the same. > > > The solution I think is copy scatterlist data into one single buffer in > > mediatek spi transfer function, but I think this is odd because > > __spi_map_msg() map single buffer into scatterlist, then our driver map > > scatterlist into single buffer again. I hope this explaination is more > > clear than before. > > To repeat what I said in my last mail: there's no need to use the > scatterlists as-is, your driver can do whatever set of DMA transfers it > likes to keep the lengths of each transfer the same. Attempting to > linearise the transfers in memory isn't going to work unless you > allocate physically contiguous memory (which could get painful) and will > add substantial overhead. > > For example with your above example you could split the transfers up to > be 128, 128, 3968, 128, 128. This is a workable way. Thanks your suggestion.We will try to implement this, Eddie Thanks -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web