From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lindgren Subject: Re: [RFC PATCH 10/13] spi: omap2-mcspi: dma_request_slave_channel() support for DT platforms Date: Thu, 20 Sep 2012 15:09:31 -0700 Message-ID: <20120920220931.GJ28835@atomide.com> References: <1348152226-13588-1-git-send-email-mporter@ti.com> <1348152226-13588-11-git-send-email-mporter@ti.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Sekhar Nori , Grant Likely , Mark Brown , Benoit Cousson , Russell King , Vinod Koul , Rob Landley , Chris Ball , Devicetree Discuss , Linux OMAP List , Linux ARM Kernel List , Linux DaVinci Kernel List , Linux Kernel Mailing List , Linux Documentation List , Linux MMC List , Linux SPI Devel List , Arnd Bergmann , Dan Williams , Rob Herring To: Matt Porter Return-path: Content-Disposition: inline In-Reply-To: <1348152226-13588-11-git-send-email-mporter@ti.com> Sender: linux-mmc-owner@vger.kernel.org List-Id: linux-spi.vger.kernel.org * Matt Porter [120920 07:43]: > For platforms with DT populated, use dma_request_slave_channel() > to acquire the DMA channel. For !DT platforms, we fall back to > explicitly passing the omap_dma_filter_fn() to dma_request_channel(). > Once all platforms boot from DT, the dma_request_channel() path can > be dropped. > > Signed-off-by: Matt Porter > --- > drivers/spi/spi-omap2-mcspi.c | 68 +++++++++++++++++++++++++++++------------ > 1 file changed, 48 insertions(+), 20 deletions(-) > > diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c > index 9502566..1cf1072 100644 > --- a/drivers/spi/spi-omap2-mcspi.c > +++ b/drivers/spi/spi-omap2-mcspi.c > @@ -104,6 +104,9 @@ struct omap2_mcspi_dma { > > struct completion dma_tx_completion; > struct completion dma_rx_completion; > + > + char dma_rx_ch_name[14]; > + char dma_tx_ch_name[14]; > }; > > /* use PIO for small transfers, avoiding DMA setup/teardown overhead and > @@ -798,14 +801,26 @@ static int omap2_mcspi_request_dma(struct spi_device *spi) > dma_cap_zero(mask); > dma_cap_set(DMA_SLAVE, mask); > sig = mcspi_dma->dma_rx_sync_dev; > - mcspi_dma->dma_rx = dma_request_channel(mask, omap_dma_filter_fn, &sig); > + if (spi->dev.of_node) > + mcspi_dma->dma_rx = > + dma_request_slave_channel(&master->dev, > + mcspi_dma->dma_rx_ch_name); > + else > + mcspi_dma->dma_rx = > + dma_request_channel(mask, omap_dma_filter_fn, &sig); > if (!mcspi_dma->dma_rx) { > dev_err(&spi->dev, "no RX DMA engine channel for McSPI\n"); > return -EAGAIN; > } > Hmm this does not look nice.. We should be able to somehow not to care about the configuration at the mcspi driver level. Regards, Tony