From patchwork Fri Feb 5 16:20:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102843 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp60908lbl; Fri, 5 Feb 2016 08:21:44 -0800 (PST) X-Received: by 10.66.118.198 with SMTP id ko6mr21058459pab.122.1454689304459; Fri, 05 Feb 2016 08:21:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x16si24793583pfa.181.2016.02.05.08.21.42; Fri, 05 Feb 2016 08:21:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755992AbcBEQVg (ORCPT + 30 others); Fri, 5 Feb 2016 11:21:36 -0500 Received: from mout.kundenserver.de ([212.227.126.135]:61671 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755936AbcBEQVe (ORCPT ); Fri, 5 Feb 2016 11:21:34 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MVYxn-1aY1hD0HTr-00YyZr; Fri, 05 Feb 2016 17:21:08 +0100 From: Arnd Bergmann To: Imre Kaloz , Krzysztof Halasa Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] ARM: ixp4xx: use normal prototype for {read, write}s{b, w, l} Date: Fri, 5 Feb 2016 17:20:48 +0100 Message-Id: <1454689262-613421-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:ApAYLpGEhmn9hiRFwPq+6Ovu4Of4qcTfm3vymjWpftOhRlGT6x5 ScYqHvK9UhuxY9V10Fj+BNf5SUa34wQfT0+g9wPPuKVO1Lbohh16ezOCAjAHIyFswW8Llka QB02lk5nVMMhybCUlmkWMWFpYRfUXMsqvyE3zwcvri/F47eetmZfh8kwoamhv+iIToS5gge TWzIZpnpArHZfZTabtswQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:uamnD9zGk8g=:RbgwhrvhxdqfOferaX5ImW aDwUJ+G3pE+gv+mdNB5NkXx7p4J5oSNoJfGTwZiIurXebst3dFWtVvOYM82zNuo9/WL4A4fwH ymBUwodeIGGILztzGIvdOjOLw9tnEI72Ewt6ChIy1NeeMUB6vWjiOBTQmbIP+Gtk9p3/ealGU 0fXKgGI1GieCsoaAcCIS2v7JMwsAFWLwnYWDo7eu/Egc+3dfAvn4riYfBZl/Gq7jS7noxEozq 2CwMP5vWw42yztgs80JYi4BZRC7PvtD09qNOvqFtY9PN2xhfWXhJyf80lPZeeVgvWf7aP8f1v hq85upL3j+ubVFCkI0kZNciudS+S4dgDeSJiUGPVPl/QYLwaA8X/W6JJuC6ASJbGJDvAz1JxC 5GQAnf8oUqK4DVaTVc0zHpul2YLx4d/sHp/DZdGXlRvhVD8nP6jV4Lx8VrgX9aCV/F3OlDRZT tN0hM4ZW2cYSKiHKuAdYCBmw/6i7QONL6rDLF+NJs0BtzMq24wlb9JEngC1gC/iVg5xv1LyYA 7RgWtNF6L2YqIO1CB1zIW1R/jFFUrENmJ9E7Fgt3qajS/YdDZiEM36IXd58ovkQC4gUnuKQiT 4GZLkFjr5rsA9RKUXI82PqGr6YGFje/CymQVnbpgjIeVT6lpEz+v009SmNdYyTALe7OQiMq2n NQ2kY8CDR8ANrLSL1JhV1/Zg2ju3KJtEBAY3VgoH0cKm+B+LAsu0USFEhjyPzAFzyEdc= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ixp4xx defines the arguments to its __indirect_writesb() and other functions as pointers to fixed-size data. This is not necessarily wrong, and it works most of the time, but it causes warnings in at least one driver: drivers/net/ethernet/smsc/smc91x.c: In function 'smc_rcv': drivers/net/ethernet/smsc/smc91x.c:495:21: error: passing argument 2 of '__indirect_readsw' from incompatible pointer type [-Werror=incompatible-pointer-types] SMC_PULL_DATA(lp, data, packet_len - 4); All other definitions of the same functions pass void pointers, so doing the same here avoids the warnings. Signed-off-by: Arnd Bergmann --- arch/arm/mach-ixp4xx/include/mach/io.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) -- 2.7.0 diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index 7a0c13bf4269..d04d3ec97ac0 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h @@ -95,8 +95,10 @@ static inline void __indirect_writeb(u8 value, volatile void __iomem *p) } static inline void __indirect_writesb(volatile void __iomem *bus_addr, - const u8 *vaddr, int count) + const void *p, int count) { + const u8 *vaddr = p; + while (count--) writeb(*vaddr++, bus_addr); } @@ -118,8 +120,10 @@ static inline void __indirect_writew(u16 value, volatile void __iomem *p) } static inline void __indirect_writesw(volatile void __iomem *bus_addr, - const u16 *vaddr, int count) + const void *p, int count) { + const u16 *vaddr = p; + while (count--) writew(*vaddr++, bus_addr); } @@ -137,8 +141,9 @@ static inline void __indirect_writel(u32 value, volatile void __iomem *p) } static inline void __indirect_writesl(volatile void __iomem *bus_addr, - const u32 *vaddr, int count) + const void *p, int count) { + const u32 *vaddr = p; while (count--) writel(*vaddr++, bus_addr); } @@ -160,8 +165,10 @@ static inline u8 __indirect_readb(const volatile void __iomem *p) } static inline void __indirect_readsb(const volatile void __iomem *bus_addr, - u8 *vaddr, u32 count) + void *p, u32 count) { + u8 *vaddr = p; + while (count--) *vaddr++ = readb(bus_addr); } @@ -183,8 +190,10 @@ static inline u16 __indirect_readw(const volatile void __iomem *p) } static inline void __indirect_readsw(const volatile void __iomem *bus_addr, - u16 *vaddr, u32 count) + void *p, u32 count) { + u16 *vaddr = p; + while (count--) *vaddr++ = readw(bus_addr); } @@ -204,8 +213,10 @@ static inline u32 __indirect_readl(const volatile void __iomem *p) } static inline void __indirect_readsl(const volatile void __iomem *bus_addr, - u32 *vaddr, u32 count) + void *p, u32 count) { + u32 *vaddr = p; + while (count--) *vaddr++ = readl(bus_addr); } From patchwork Fri Feb 5 16:20:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102842 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp60951lbl; Fri, 5 Feb 2016 08:21:49 -0800 (PST) X-Received: by 10.67.30.201 with SMTP id kg9mr21166417pad.132.1454689308190; Fri, 05 Feb 2016 08:21:48 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id xg10si24727607pab.141.2016.02.05.08.21.47; Fri, 05 Feb 2016 08:21:48 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756018AbcBEQVp (ORCPT + 30 others); Fri, 5 Feb 2016 11:21:45 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:64051 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755994AbcBEQVm (ORCPT ); Fri, 5 Feb 2016 11:21:42 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0MSVlI-1aZOc329sy-00RXeu; Fri, 05 Feb 2016 17:21:15 +0100 From: Arnd Bergmann To: Imre Kaloz , Krzysztof Halasa Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 2/3] ARM: ixp4xx: avoid warning about ioport_map() macro argument processing Date: Fri, 5 Feb 2016 17:20:49 +0100 Message-Id: <1454689262-613421-2-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454689262-613421-1-git-send-email-arnd@arndb.de> References: <1454689262-613421-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:iru2NYxvqqWuEtDfzY3aokON8eP857u3RUYmcWW8aaEyuLA8Ask pE14t8xCNtvE0DHfRHghW6s63Jg/x5n/EANHfIz/8sywQDOP6e6w87gpmu3zOVEYG1GAGrX yQJN+pCVfATUFYOcVBlV8hodyqtWF3bStk5pgbwtjlrxH/0ChUunH03KFB5nPRVIzc8S4yb S/bEEnuniLKGuPO6UbmPw== X-UI-Out-Filterresults: notjunk:1; V01:K0:cZKaoc3+fY8=:418+vz9iIAzaStbMVbPINf 846WMRPmuCFKqMlbx40MVb8pXegnbcdnm4Idwl/ECQgf4StN2p8zwflGEVzdvP+b4Z94wOoDn tdzOJi7dbVMtQtu1VCYFcQFjACQT0p5qkfzONW8nJlffFJsANEaVjwxNLMywHEv6X5OW3pSli +SQRB30KCxec/rX7lUt2sainahRNbzfNArGvT1Yefb0oi075IfqyQ7bzqsHYKpP/bpaSPJa3J hsKOqwWxD4EitDC5VnCPnGT4vUoEWlu8gIpxG8vJRR8HdJvlwM6M0hrj4nuykN94uJyyqRCRp x8uQKmc5jaKbm4fOOy9hrM46kwfouJ5lW6RKlrGg+mUshHLTF5oAB3+qaxGdWokyFjBZSXSRp ugXizzknk6r4CxpyfgWXeiOOsV8DGcIDmtciVXTZnVru8l6EnapBmSjViXLw0uHg1c7DLgKjF N5wJuJgj3OSQ1HTc5VSKiA8jJueA2EAnNJu2HV/k770cvfuAjbQEcTM7VlZejgxWuDE/TpYDF I3KDIYVhz8GFiOaawyGhfyC1kfHh97yNCX2N73F00BNNsPHiksQPCtNeiLTYSVfHjAZ+rf2J2 gVDRhPKktH6/RThqUdVU8ziva5124KviJr1kLVjfHSQegJSuYAQZfgfRPXHCp62rUt7gnpXt0 2Y30r1A3vM9Df+RNk4TWATZoU48foE9eTyzJEgtnZq30c3Ja7+JecmONs6m5vumXCcvk= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We get a harmless compiler warning when building the cs89x0 driver for ixp4xx: drivers/net/ethernet/cirrus/cs89x0.c: In function 'cs89x0_ioport_probe': drivers/net/ethernet/cirrus/cs89x0.c:1602:28: warning: suggest parentheses around '+' in operand of '&' [-Wparentheses] io_mem = ioport_map(ioport & ~3, NETCARD_IO_EXTENT); Simply adding parentheses in the macro avoids the warning Signed-off-by: Arnd Bergmann --- arch/arm/mach-ixp4xx/include/mach/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.0 diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index d04d3ec97ac0..d8c2a4dc54d7 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h @@ -534,7 +534,7 @@ static inline void iowrite32_rep(void __iomem *addr, const void *vaddr, #endif } -#define ioport_map(port, nr) ((void __iomem*)(port + PIO_OFFSET)) +#define ioport_map(port, nr) ((void __iomem*)((port) + PIO_OFFSET)) #define ioport_unmap(addr) #endif /* CONFIG_PCI */ From patchwork Fri Feb 5 16:20:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102841 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp61024lbl; Fri, 5 Feb 2016 08:21:57 -0800 (PST) X-Received: by 10.98.1.203 with SMTP id 194mr21412786pfb.10.1454689317473; Fri, 05 Feb 2016 08:21:57 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si5996497pfj.30.2016.02.05.08.21.57; Fri, 05 Feb 2016 08:21:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756045AbcBEQVw (ORCPT + 30 others); Fri, 5 Feb 2016 11:21:52 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:51099 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755994AbcBEQVs (ORCPT ); Fri, 5 Feb 2016 11:21:48 -0500 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue004) with ESMTPA (Nemesis) id 0Mh8jt-1af9QA3pq5-00MIrp; Fri, 05 Feb 2016 17:21:24 +0100 From: Arnd Bergmann To: Imre Kaloz , Krzysztof Halasa Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 3/3] ARM: ixp4xx: move indirect I/O into common-pci.c Date: Fri, 5 Feb 2016 17:20:50 +0100 Message-Id: <1454689262-613421-3-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1454689262-613421-1-git-send-email-arnd@arndb.de> References: <1454689262-613421-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:rfcCc3JC/ffllu+eZs61WSl7pvbLyPnGZThjW29JsqY3WtVdFzF kIPOvtQkTFzOFT50MD2tc9eYd+zyb/U9b++u8SyyIiKZYJrwjlLccb30d9mm5P4G57ps3pr /79BfPkny4zTtEVcW7N7ny+MkKnzY53hM+eLBabsGL6+Vq15rB3kYSIS/sGcFrsThfKtOS1 i3VBQRD1PeQy+ka84QZyA== X-UI-Out-Filterresults: notjunk:1; V01:K0:/SRpgQ0RMWg=:ydChwU7sE4nXrfVK6538xm k5IxhL6GpNLRnK7dvnfTfsbLAtp3eSEG/+H7hFtytHKnHOXCJsS8AY2RrVA8RO3INBNir3xML CWrvB9O2VstBQlF0WoOFCnPCLoxTgMGzietQUzX1GdVPWVMottqY8X2tqFSEpVYln9N/bCFQ4 i9l0SEt5kZK+imRtOC0V+dKrg4a0S2SoISemiwfhAZDQ0657vvaqITWoewtlYGcSrRM417Zkt 837UVvi0REZ6sS5eBW+SnwtGO2gTq3XnnJ5TpWCCagzbIUh+zImRvFyjRrvQ6sV8VKhGsJnKu fklklnv5cxhP3r+P+dSQEVlfzeJyjaYmAkbQtX2VBc8pUFtC78giQrJGM5beCiXI8Qxxp2WNO ygUPQt6BC0Yu+EWkBwHMiqiGVX3YXg1EbB5ysNShEkNY7pISTURdf/00nUvl4KPj1WpBeODe8 sUMIrahauunxPpxNcgZCOY8uTy/6BsdhgWWElsW+V4qy5PYvf/zdZILI3FqWTAimMJ2BHDFYh +FxOu2PV6qRcw1osh3hxJk6jmtyXzLrWs7vZLv99toWOThMOU9bnUb26svncYoXgqx3s6VNks Z5wEzy8APMpmkRNJbl2mlhkmEoUfz2yhyXLKNGqttl4czxwO1qS8IQvJoHk3vhXq6Wf8O8F+n qr5ulbzG8WHlkpa64htQtA/W5fYF308xk4SzQghcLkSMW7ozboFA+4Qdaq7YV8/4XNXo= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The pointer comparison in is_pci_memory() confuses gcc, so it starts throwing bogus warnings about the use of possibly uninitialized variables: drivers/ata/ahci_qoriq.c: In function 'ahci_qoriq_hardreset': arch/arm/include/asm/io.h:101:2: error: 'px_is' may be used uninitialized in this function [-Werror=maybe-uninitialized] drivers/crypto/ixp4xx_crypto.c: In function 'aead_perform': drivers/crypto/ixp4xx_crypto.c:1072:5: error: 'lastlen' may be used uninitialized in this function [-Werror=maybe-uninitialized] The code is that gets warned about is correct, and we should not warn about this. Moving the code into a .c file makes the object files smaller and avoids the warnings. Signed-off-by: Arnd Bergmann --- arch/arm/mach-ixp4xx/common-pci.c | 98 ++++++++++++++++++++++++++++++++++ arch/arm/mach-ixp4xx/include/mach/io.h | 95 +++----------------------------- 2 files changed, 104 insertions(+), 89 deletions(-) -- 2.7.0 diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 4977296f0c78..6f5d92f88062 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c @@ -166,6 +166,104 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data) return retval; } +#ifdef CONFIG_IXP4XX_INDIRECT_PCI +void __indirect_writeb(u8 value, volatile void __iomem *p) +{ + u32 addr = (u32)p; + u32 n, byte_enables, data; + + if (!is_pci_memory(addr)) { + __raw_writeb(value, p); + return; + } + + n = addr % 4; + byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; + data = value << (8*n); + ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); +} +EXPORT_SYMBOL(__indirect_writeb); + +void __indirect_writew(u16 value, volatile void __iomem *p) +{ + u32 addr = (u32)p; + u32 n, byte_enables, data; + + if (!is_pci_memory(addr)) { + __raw_writew(value, p); + return; + } + + n = addr % 4; + byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; + data = value << (8*n); + ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); +} +EXPORT_SYMBOL(__indirect_writew); + +void __indirect_writel(u32 value, volatile void __iomem *p) +{ + u32 addr = (__force u32)p; + + if (!is_pci_memory(addr)) { + __raw_writel(value, p); + return; + } + + ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value); +} +EXPORT_SYMBOL(__indirect_writel); + +u8 __indirect_readb(const volatile void __iomem *p) +{ + u32 addr = (u32)p; + u32 n, byte_enables, data; + + if (!is_pci_memory(addr)) + return __raw_readb(p); + + n = addr % 4; + byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; + if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data)) + return 0xff; + + return data >> (8*n); +} +EXPORT_SYMBOL(__indirect_readb); + +u16 __indirect_readw(const volatile void __iomem *p) +{ + u32 addr = (u32)p; + u32 n, byte_enables, data; + + if (!is_pci_memory(addr)) + return __raw_readw(p); + + n = addr % 4; + byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; + if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data)) + return 0xffff; + + return data>>(8*n); +} +EXPORT_SYMBOL(__indirect_readw); + +u32 __indirect_readl(const volatile void __iomem *p) +{ + u32 addr = (__force u32)p; + u32 data; + + if (!is_pci_memory(addr)) + return __raw_readl(p); + + if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data)) + return 0xffffffff; + + return data; +} +EXPORT_SYMBOL(__indirect_readl); +#endif + static u32 ixp4xx_config_addr(u8 bus_num, u16 devfn, int where) { u32 addr; diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index d8c2a4dc54d7..e770858b490a 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h @@ -78,21 +78,12 @@ static inline int is_pci_memory(u32 addr) #define readsw(p, v, l) __indirect_readsw(p, v, l) #define readsl(p, v, l) __indirect_readsl(p, v, l) -static inline void __indirect_writeb(u8 value, volatile void __iomem *p) -{ - u32 addr = (u32)p; - u32 n, byte_enables, data; - - if (!is_pci_memory(addr)) { - __raw_writeb(value, p); - return; - } - - n = addr % 4; - byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; - data = value << (8*n); - ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); -} +void __indirect_writeb(u8 value, volatile void __iomem *p); +void __indirect_writew(u16 value, volatile void __iomem *p); +void __indirect_writel(u32 value, volatile void __iomem *p); +u8 __indirect_readb(const volatile void __iomem *p); +u16 __indirect_readw(const volatile void __iomem *p); +u32 __indirect_readl(const volatile void __iomem *p); static inline void __indirect_writesb(volatile void __iomem *bus_addr, const void *p, int count) @@ -103,22 +94,6 @@ static inline void __indirect_writesb(volatile void __iomem *bus_addr, writeb(*vaddr++, bus_addr); } -static inline void __indirect_writew(u16 value, volatile void __iomem *p) -{ - u32 addr = (u32)p; - u32 n, byte_enables, data; - - if (!is_pci_memory(addr)) { - __raw_writew(value, p); - return; - } - - n = addr % 4; - byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; - data = value << (8*n); - ixp4xx_pci_write(addr, byte_enables | NP_CMD_MEMWRITE, data); -} - static inline void __indirect_writesw(volatile void __iomem *bus_addr, const void *p, int count) { @@ -128,18 +103,6 @@ static inline void __indirect_writesw(volatile void __iomem *bus_addr, writew(*vaddr++, bus_addr); } -static inline void __indirect_writel(u32 value, volatile void __iomem *p) -{ - u32 addr = (__force u32)p; - - if (!is_pci_memory(addr)) { - __raw_writel(value, p); - return; - } - - ixp4xx_pci_write(addr, NP_CMD_MEMWRITE, value); -} - static inline void __indirect_writesl(volatile void __iomem *bus_addr, const void *p, int count) { @@ -148,22 +111,6 @@ static inline void __indirect_writesl(volatile void __iomem *bus_addr, writel(*vaddr++, bus_addr); } -static inline u8 __indirect_readb(const volatile void __iomem *p) -{ - u32 addr = (u32)p; - u32 n, byte_enables, data; - - if (!is_pci_memory(addr)) - return __raw_readb(p); - - n = addr % 4; - byte_enables = (0xf & ~BIT(n)) << IXP4XX_PCI_NP_CBE_BESL; - if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data)) - return 0xff; - - return data >> (8*n); -} - static inline void __indirect_readsb(const volatile void __iomem *bus_addr, void *p, u32 count) { @@ -173,22 +120,6 @@ static inline void __indirect_readsb(const volatile void __iomem *bus_addr, *vaddr++ = readb(bus_addr); } -static inline u16 __indirect_readw(const volatile void __iomem *p) -{ - u32 addr = (u32)p; - u32 n, byte_enables, data; - - if (!is_pci_memory(addr)) - return __raw_readw(p); - - n = addr % 4; - byte_enables = (0xf & ~(BIT(n) | BIT(n+1))) << IXP4XX_PCI_NP_CBE_BESL; - if (ixp4xx_pci_read(addr, byte_enables | NP_CMD_MEMREAD, &data)) - return 0xffff; - - return data>>(8*n); -} - static inline void __indirect_readsw(const volatile void __iomem *bus_addr, void *p, u32 count) { @@ -198,20 +129,6 @@ static inline void __indirect_readsw(const volatile void __iomem *bus_addr, *vaddr++ = readw(bus_addr); } -static inline u32 __indirect_readl(const volatile void __iomem *p) -{ - u32 addr = (__force u32)p; - u32 data; - - if (!is_pci_memory(addr)) - return __raw_readl(p); - - if (ixp4xx_pci_read(addr, NP_CMD_MEMREAD, &data)) - return 0xffffffff; - - return data; -} - static inline void __indirect_readsl(const volatile void __iomem *bus_addr, void *p, u32 count) {