From patchwork Thu Nov 19 19:01:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Mack X-Patchwork-Id: 61455 X-Patchwork-Delegate: grant.likely@secretlab.ca 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 nAJJ2np8023322 for ; Thu, 19 Nov 2009 19:02:50 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NBCGa-00057g-Tv; Thu, 19 Nov 2009 19:02:04 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by 3yr0jf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NBCGZ-00057b-BG for spi-devel-general@lists.sourceforge.net; Thu, 19 Nov 2009 19:02:03 +0000 Received-SPF: pass (29vjzd1.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 29vjzd1.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1NBCGR-0007R3-DG for spi-devel-general@lists.sourceforge.net; Thu, 19 Nov 2009 19:02:03 +0000 Received: from localhost (localhost [127.0.0.1]) by buzzloop.caiaq.de (Postfix) with ESMTP id 583B37F407B; Thu, 19 Nov 2009 20:01:45 +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 wQXUlzdNOOSm; Thu, 19 Nov 2009 20:01:42 +0100 (CET) Received: by buzzloop.caiaq.de (Postfix, from userid 1000) id 4F9237F407A; Thu, 19 Nov 2009 20:01:41 +0100 (CET) Date: Thu, 19 Nov 2009 20:01:42 +0100 From: Daniel Mack To: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Message-ID: <20091119190142.GO14091@buzzloop.caiaq.de> References: <1258627487-7408-1-git-send-email-daniel@caiaq.de> <20091119184951.GA26816@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20091119184951.GA26816@pengutronix.de> User-Agent: Mutt/1.5.20 (2009-06-14) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -1.0 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NBCGR-0007R3-DG Cc: spi-devel-general@lists.sourceforge.net, Andrew Morton , David Brownell , linux-arm-kernel@lists.infradead.org Subject: Re: [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..1b17f44 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -44,6 +44,9 @@ #define MXC_CSPIINT 0x0c #define MXC_RESET 0x1c +#define MX3_CSPISTAT 0x14 +#define MX3_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,11 @@ 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 receive buffer */ + if (cpu_is_mx31() || cpu_is_mx35()) + while (readl(spi_imx->base + MX3_CSPISTAT) & MX3_CSPISTAT_RR) + readl(spi_imx->base + MXC_CSPIRXDATA); + spi_imx->intctrl(spi_imx, 0); ret = spi_bitbang_start(&spi_imx->bitbang);