From patchwork Mon Mar 18 15:15:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Douglas Gilbert X-Patchwork-Id: 2293771 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 5888ADF215 for ; Mon, 18 Mar 2013 15:40:09 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHc75-0001CY-Sv; Mon, 18 Mar 2013 15:36:40 +0000 Received: from smtp.infotech.no ([82.134.31.41]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UHbn0-0002R8-Sx for linux-arm-kernel@lists.infradead.org; Mon, 18 Mar 2013 15:15:56 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.infotech.no (Postfix) with ESMTP id EA26D2041C2; Mon, 18 Mar 2013 16:15:50 +0100 (CET) X-Virus-Scanned: by amavisd-new-2.6.6 (20110518) (Debian) at infotech.no Received: from smtp.infotech.no ([127.0.0.1]) by localhost (smtp.infotech.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eisQlIkBP+3A; Mon, 18 Mar 2013 16:15:44 +0100 (CET) Received: from [192.168.48.66] (unknown [199.91.210.155]) by smtp.infotech.no (Postfix) with ESMTPA id 203342041BD; Mon, 18 Mar 2013 16:15:38 +0100 (CET) Message-ID: <51472F81.9060803@interlog.com> Date: Mon, 18 Mar 2013 11:15:13 -0400 From: Douglas Gilbert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 MIME-Version: 1.0 To: "Yang, Wenyou" Subject: Re: [PATCH Resend v5 00/16] spi/spi-atmel: add dmaengine support for atmel spi controller and to test the device tree support References: <1361925297-11854-1-git-send-email-wenyou.yang@atmel.com> In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130318_111555_242657_C6FF3FA9 X-CRM114-Status: GOOD ( 21.10 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "richard.genoud@gmail.com" , "plagnioj@jcrosoft.com" , "Lin, JM" , "Ferre, Nicolas" , "grant.likely@secretlab.ca" , Robert Nelson , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: dgilbert@interlog.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Tue, Feb 26, 2013 at 6:34 PM, Wenyou Yang wrote: > Hi All, > > This set of patches is to add dmaengine support for atmel spi and to test > device tree support. > > The work is based on Nicolas and Richard's work. > > Because the Atmel DMA device tree support hasn't on mainline, to > at91sam9x5ek and at91sam9n12ek > with dma support, it doesn't work on the dmaengine mode, only on PIO mode > so far. > > It has been tested as below: > 1./tested on v3.8, by using mtd utils, "mount", "umount" and "cp" > commands. > 2./tested on "spi/next" git tree after removing commit "spi: make sure all > transfer has proper speed set". > 3./tested by using Documentation/spi/spidev_test.c on "/dev/spidev". > 4./tested on on at91sam9x5ek, at91sam9m10g45ek, at91sam9263ek and > at91sam9g20ek boards I took a different approach to testing this patch. Try the world's most common SPI device, namely a (micro)SD card. There are a few issues. The mmc_spi driver isn't very DT friendly. I added some DT SPI attributes, patch attached. In my case cd-inverted was needed. Also I ran into a boot sequence problem since my hardware boots of a microSD card using the MCI interface. I was using a second microSD for SPI testing. at91bootstrap and u-boot (plus the kernel image) are on my MCI microSD card and they got the kernel booting. However since the kernel probes SPI before MCI, then by the time of the rootfs remount, my SPI microSD card had overtaken the /dev/mmcblk0 device node leading to some confusion. There are several ways of coping with this problem and I took an easy one: making mmc_spi a module. Just wondering if there are any DT mechanisms to cope with these "order of probing" type problems? And data transfers to and from that microSD card using SPI were slow, as in 200 kB/sec (should be closer to 1 MB/sec). So Atmel, when are we getting DMA working for the AT91SAM9x5 family? Doug Gilbert diff --git a/drivers/mmc/host/of_mmc_spi.c b/drivers/mmc/host/of_mmc_spi.c index d720b5e..c06abb2 100644 --- a/drivers/mmc/host/of_mmc_spi.c +++ b/drivers/mmc/host/of_mmc_spi.c @@ -64,6 +64,11 @@ static int of_mmc_spi_get_cd(struct device *dev) return of_mmc_spi_read_gpio(dev, CD_GPIO); } +static int of_mmc_spi_get_cd_inv(struct device *dev) +{ + return ! of_mmc_spi_read_gpio(dev, CD_GPIO); +} + static int of_mmc_spi_get_ro(struct device *dev) { return of_mmc_spi_read_gpio(dev, WP_GPIO); @@ -140,17 +145,26 @@ struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi) oms->alow_gpios[i] = true; } - if (gpio_is_valid(oms->gpios[CD_GPIO])) - oms->pdata.get_cd = of_mmc_spi_get_cd; + if (gpio_is_valid(oms->gpios[CD_GPIO])) { + if (of_get_property(np, "cd-inverted", NULL)) + oms->pdata.get_cd = of_mmc_spi_get_cd_inv; + else + oms->pdata.get_cd = of_mmc_spi_get_cd; + } if (gpio_is_valid(oms->gpios[WP_GPIO])) oms->pdata.get_ro = of_mmc_spi_get_ro; - oms->detect_irq = irq_of_parse_and_map(np, 0); - if (oms->detect_irq != 0) { - oms->pdata.init = of_mmc_spi_init; - oms->pdata.exit = of_mmc_spi_exit; - } else { + if (of_get_property(np, "np-removable", NULL)) + oms->pdata.caps |= MMC_CAP_NONREMOVABLE; + else if (of_get_property(np, "broken-cd", NULL)) oms->pdata.caps |= MMC_CAP_NEEDS_POLL; + else { + oms->detect_irq = irq_of_parse_and_map(np, 0); + if (oms->detect_irq != 0) { + oms->pdata.init = of_mmc_spi_init; + oms->pdata.exit = of_mmc_spi_exit; + } else + oms->pdata.caps |= MMC_CAP_NEEDS_POLL; } dev->platform_data = &oms->pdata; -- 1.7.10.4