From patchwork Wed Dec 16 06:01:30 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Mundt X-Patchwork-Id: 68610 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBI6T43f022936 for ; Fri, 18 Dec 2009 06:29:07 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NKmxK-0000Kc-5p; Wed, 16 Dec 2009 06:01:50 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1NKmxJ-0000KW-2n for spi-devel-general@lists.sourceforge.net; Wed, 16 Dec 2009 06:01:49 +0000 X-ACL-Warn: Received: from 124x34x33x190.ap124.ftth.ucom.ne.jp ([124.34.33.190] helo=master.linux-sh.org) by sfi-mx-1.v28.ch3.sourceforge.com with esmtp (Exim 4.69) id 1NKmxC-0004R3-FZ for spi-devel-general@lists.sourceforge.net; Wed, 16 Dec 2009 06:01:49 +0000 Received: from localhost (unknown [127.0.0.1]) by master.linux-sh.org (Postfix) with ESMTP id BAA3B63777; Wed, 16 Dec 2009 06:01:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at linux-sh.org Received: from master.linux-sh.org ([127.0.0.1]) by localhost (master.linux-sh.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 70skMQCjrJV0; Wed, 16 Dec 2009 15:01:30 +0900 (JST) Received: by master.linux-sh.org (Postfix, from userid 500) id ADBF36377C; Wed, 16 Dec 2009 15:01:30 +0900 (JST) Date: Wed, 16 Dec 2009 15:01:30 +0900 From: Paul Mundt To: John Linn , Grant Likely Message-ID: <20091216060130.GD31265@linux-sh.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.13 (2006-08-11) X-Spam-Score: 0.2 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 1.6 RCVD_IN_SORBS_DUL RBL: SORBS: sent directly from dynamic IP address [124.34.33.190 listed in dnsbl.sorbs.net] 1.0 RDNS_DYNAMIC Delivered to trusted network by host with dynamic-looking rDNS -2.5 AWL AWL: From: address is in the auto white-list X-Headers-End: 1NKmxC-0004R3-FZ Cc: spi-devel-general@lists.sourceforge.net, richard.rojfors@mocean-labs.com, linux-kernel@vger.kernel.org Subject: [spi-devel-general] [PATCH] spi: xilinx_spi: Fix up I/O routine wrapping bogosity. 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/xilinx_spi.c b/drivers/spi/xilinx_spi.c index 9f38637..154e908 100644 --- a/drivers/spi/xilinx_spi.c +++ b/drivers/spi/xilinx_spi.c @@ -93,6 +93,26 @@ struct xilinx_spi { void (*rx_fn) (struct xilinx_spi *); }; +static void xspi_write32(u32 val, void __iomem *addr) +{ + iowrite32(val, addr); +} + +static unsigned int xspi_read32(void __iomem *addr) +{ + return ioread32(addr); +} + +static void xspi_write32_be(u32 val, void __iomem *addr) +{ + iowrite32be(val, addr); +} + +static unsigned int xspi_read32_be(void __iomem *addr) +{ + return ioread32be(addr); +} + static void xspi_tx8(struct xilinx_spi *xspi) { xspi->write_fn(*xspi->tx_ptr, xspi->regs + XSPI_TXD_OFFSET); @@ -374,11 +394,11 @@ struct spi_master *xilinx_spi_init(struct device *dev, struct resource *mem, xspi->mem = *mem; xspi->irq = irq; if (pdata->little_endian) { - xspi->read_fn = ioread32; - xspi->write_fn = iowrite32; + xspi->read_fn = xspi_read32; + xspi->write_fn = xspi_write32; } else { - xspi->read_fn = ioread32be; - xspi->write_fn = iowrite32be; + xspi->read_fn = xspi_read32_be; + xspi->write_fn = xspi_write32_be; } xspi->bits_per_word = pdata->bits_per_word; if (xspi->bits_per_word == 8) {