From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755183AbbKRIgC (ORCPT ); Wed, 18 Nov 2015 03:36:02 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:57080 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752098AbbKRIf7 (ORCPT ); Wed, 18 Nov 2015 03:35:59 -0500 X-Greylist: delayed 79297 seconds by postgrey-1.27 at vger.kernel.org; Wed, 18 Nov 2015 03:35:58 EST From: Arnd Bergmann To: Krzysztof Kozlowski Cc: linux-arm-kernel@lists.infradead.org, Mark Brown , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, Kukjin Kim Subject: Re: [PATCH v2] SPI: s3c64xx: pass DMA arguments in platform data Date: Wed, 18 Nov 2015 09:35:20 +0100 Message-ID: <3885683.DJ7E2GgAz1@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: <564C01EF.60308@samsung.com> References: <8391350.6B0EUH1WXO@wuerfel> <4634371.Kl2EUjoTtJ@wuerfel> <564C01EF.60308@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:1hwdC6GTUBuQJ59hwU1a+LplJ8Hm5Gn8Kbd7QmOFBdnm0JhKlyC ucTtE17waOYjc6xQRfTV+LX5r/jgjTv4GdlIBR6YI8wJeSVteSf2OWXEu/XiFv6Ln4U+WDW QRMwh9SXabXiY5hszfz8KLhTYkecC625m0oNa7ajT4Xl7e1zcJE7Ffl+U7p9LkOYIQAHu/E Vtgt5RGaxgSULCJiln1MQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:CVwB/qagcfU=:XrunyWmtWZ7WKm4z2mtyD+ cJigfRY2zuPUxT0n22lH6J4yAAKAXkSMvchCwC9BRT3Qho1ktCpkbqTe1HX8pce0eQ50unBNI GXaAOQLErcpnjTBH+AaSCR5oZEnpTazMZSmJTTdc2j0bkEe6ufRdV+cKD7plTg3Nz41+1kRIn JX2g6c8Fo83dy+F4s2VAmzlBjU+l2tBizRIgIj5e9uvtM/SGqKgdzst0qzDI4l4XewecRLeTC CeGTGa9S7X3sYUs8BeJGmSsjq35UsZxBbbO8qwBL68621CfFy1cPVIX9erAcQfMBfJfjnU3Xk E/1hUjecYbp+qs7NjMUwrZQ6Lk/0AOSFAKBX2CPgohDV3NllFNd7Cr1pGva3d0xeZmECAzJ8B pGSd6MP14zmQOtJ1JiGom5e2beQhJDB/wOZUTSWPl/bib/6D5l7g5Fd1DfF2NmvQD0BnR/uya ZL/G+M6HGn9+K0YgF7nhc0SykKtkvIXJftmP0JvjGCj5GNwbcKCIPI3Xx4C/8BmfBL8h3lpnl kRZ2KaTy6mOWwnDL4e6z5lePd6PkX9dQ0nAcaA630hdvEA8qHFTPTIlVg2FoA388BvS+bya9z gGjXAfUyID02vhILnuvHr/w/JBqw55RG7UtKj/BYr1o3DFsJPSh4iBG8wSwRpCYiYBBKntXC0 gPPmINZWUCMI9ZW/lj0ax2opiVBe6p+39wrB3jWemojFUgn1BOxqv5nemEc0G0tgJLWv6bryL 8BRXjYVHsAp+hgAi Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 18 November 2015 13:43:27 Krzysztof Kozlowski wrote: > On 18.11.2015 00:48, Arnd Bergmann wrote: > > struct platform_device s3c64xx_device_spi0 = { > > @@ -1135,11 +1133,13 @@ void __init s3c64xx_spi0_set_platdata(int (*cfg_gpio)(void), int src_clk_nr, > > pd.num_cs = num_cs; > > pd.src_clk_nr = src_clk_nr; > > pd.cfg_gpio = (cfg_gpio) ? cfg_gpio : s3c64xx_spi0_cfg_gpio; > > -#if defined(CONFIG_PL330_DMA) > > - pd.filter = pl330_filter; > > -#elif defined(CONFIG_S3C64XX_PL080) > > Hmm.... why removing pl330_filter? Is it because of lack of channel > names? It looks unrelated to this patch. You are right, it's an unrelated cleanup, I'll drop this change and add the same lines there. This code was only there for mach-s5p*, which is DT-only these days and doesn't need it any more. However, there is a lot of other code that falls in the same category, and we should clean that up in a separate patch series. I'm actually thinking about moving all device definitions from plat-samsung back to mach-s3c24xx and mach-s3c64xx and then remove all devices that are unused now. I suspect we end up with an overall reduction in code size that way, and it will be much easier to keep track of how things fit together. > > - if (!sdd->pdev->dev.of_node) { > > - res = platform_get_resource(pdev, IORESOURCE_DMA, 0); > > - if (!res) { > > - dev_warn(&pdev->dev, "Unable to get SPI tx dma resource. Switching to poll mode\n"); > > - sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL; > > - } else > > - sdd->tx_dma.dmach = res->start; > > - > > - res = platform_get_resource(pdev, IORESOURCE_DMA, 1); > > - if (!res) { > > - dev_warn(&pdev->dev, "Unable to get SPI rx dma resource. Switching to poll mode\n"); > > - sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL; > > - } else > > - sdd->rx_dma.dmach = res->start; > > + if (sci && (!sci->dma_tx || !sci->dma_rx)) { > > No need for "sci" check. It cannot be NULL at this point - at the > beginning of probe it is checked already. > > > + dev_warn(&pdev->dev, "Unable to get SPI tx data. Switching to poll mode\n"); > > The message could be now more precise, like: > "Unable to get SPI rx or tx data. Switching to poll mode\n" Ok. > > + sdd->port_conf->quirks = S3C64XX_SPI_QUIRK_POLL; > > } > > The logic here is now different for DT boards. Previously such board > would not be marked as polling. Now it is always polling. If needed, > split it to separate patch. I think that was a mistake on my side, thanks for finding it. > > > > sdd->tx_dma.direction = DMA_MEM_TO_DEV; > > @@ -1197,9 +1184,10 @@ static int s3c64xx_spi_probe(struct platform_device *pdev) > > > > dev_dbg(&pdev->dev, "Samsung SoC SPI Driver loaded for Bus SPI-%d with %d Slaves attached\n", > > sdd->port_id, master->num_chipselect); > > - dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%d, Tx-%d]\n", > > + dev_dbg(&pdev->dev, "\tIOmem=[%pR]\tFIFO %dbytes\tDMA=[Rx-%p, Tx-%p]\n", > > mem_res, (FIFO_LVL_MASK(sdd) >> 1) + 1, > > - sdd->rx_dma.dmach, sdd->tx_dma.dmach); > > + sdd->cntrlr_info->dma_rx, > > + sdd->cntrlr_info->dma_tx); > > sci->dma_rx and sci->dma_tx would be equivalent but shorter. Ok. Arnd