From patchwork Thu Nov 19 10:44:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 61273 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id nAJAkCCj031947 for ; Thu, 19 Nov 2009 10:46:12 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NB4W2-0006Jg-Nc; Thu, 19 Nov 2009 10:45:30 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.123] helo=mx.sourceforge.net) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NB4W1-0006JT-E7 for spi-devel-general@lists.sourceforge.net; Thu, 19 Nov 2009 10:45:29 +0000 Received-SPF: pass (3b2kzd1.ch3.sourceforge.com: domain of caiaq.de designates 212.112.241.133 as permitted sender) client-ip=212.112.241.133; envelope-from=daniel@caiaq.de; helo=buzzloop.caiaq.de; Received: from buzzloop.caiaq.de ([212.112.241.133]) by 3b2kzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1NB4Vv-0003so-UL for spi-devel-general@lists.sourceforge.net; Thu, 19 Nov 2009 10:45:29 +0000 Received: from localhost (localhost [127.0.0.1]) by buzzloop.caiaq.de (Postfix) with ESMTP id 915EE7F407B; Thu, 19 Nov 2009 11:45:11 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at buzzloop.caiaq.de Received: from buzzloop.caiaq.de ([127.0.0.1]) by localhost (buzzloop.caiaq.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5w0kF2-+Tmyn; Thu, 19 Nov 2009 11:44:53 +0100 (CET) Received: from localhost.localdomain (pd95699b2.dip0.t-ipconnect.de [217.86.153.178]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by buzzloop.caiaq.de (Postfix) with ESMTPSA id 1AD497F407A; Thu, 19 Nov 2009 11:44:53 +0100 (CET) From: Daniel Mack To: linux-arm-kernel@lists.infradead.org Date: Thu, 19 Nov 2009 11:44:47 +0100 Message-Id: <1258627487-7408-1-git-send-email-daniel@caiaq.de> X-Mailer: git-send-email 1.6.5.2 MIME-Version: 1.0 X-Spam-Score: -2.0 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.4 NO_DNS_FOR_FROM DNS: Envelope sender has no MX or A DNS records -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -2.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NB4Vv-0003so-UL Cc: David Brownell , Daniel Mack , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , spi-devel-general@lists.sourceforge.net, Andrew Morton Subject: [spi-devel-general] [PATCH] SPI: drain MXC SPI transfer buffer when probing device X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: spi-devel-general-bounces@lists.sourceforge.net diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 89c22ef..a3894fd 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -42,8 +42,11 @@ #define MXC_CSPITXDATA 0x04 #define MXC_CSPICTRL 0x08 #define MXC_CSPIINT 0x0c +#define MXC_CSPISTAT 0x14 #define MXC_RESET 0x1c +#define MXC_CSPISTAT_RR (1 << 3) + /* generic defines to abstract from the different register layouts */ #define MXC_INT_RR (1 << 0) /* Receive data ready interrupt */ #define MXC_INT_TE (1 << 1) /* Transmit FIFO empty interrupt */ @@ -593,6 +596,10 @@ static int __init spi_imx_probe(struct platform_device *pdev) if (!cpu_is_mx31() || !cpu_is_mx35()) writel(1, spi_imx->base + MXC_RESET); + /* drain the buffer */ + while (readl(spi_imx->base + MXC_CSPISTAT) & MXC_CSPISTAT_RR) + readl(spi_imx->base + MXC_CSPIRXDATA); + spi_imx->intctrl(spi_imx, 0); ret = spi_bitbang_start(&spi_imx->bitbang);