io{read,write}{16,32} expand to
        *addr = cpu_to_le{16,32}(cpu_to_be{16,32}(val))
and
        val = be{16,32}_to_cpu(le{16,32}_to_cpu(*addr))

While it should rather be:
        *addr = cpu_to_be{16,32}(val)
and
        val = be{16,32}_to_cpu(*addr)

The current implementation works on litte-endian targets but breaks on on
big-endian targets, this patch fixes it.

Signed-off-by: Lars-Peter Clausen <[email protected]>
---
 arch/lm32/include/asm/pci.h |   86 -------------------------------------------
 arch/lm32/mm/kmap.c         |   81 ----------------------------------------
 include/asm-generic/io.h    |    8 ++--
 3 files changed, 4 insertions(+), 171 deletions(-)
 delete mode 100644 arch/lm32/mm/kmap.c

diff --git a/arch/lm32/include/asm/pci.h b/arch/lm32/include/asm/pci.h
index b544613..e69de29 100644
--- a/arch/lm32/include/asm/pci.h
+++ b/arch/lm32/include/asm/pci.h
@@ -1,86 +0,0 @@
-/*
- * Based on:
- * linux/include/asm-xtensa/pci.h
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2001 - 2005 Tensilica Inc.
- */
-
-// TODO: lm32 does not support PCI
-
-#ifndef _LM32_ASM_PCI_H
-#define _LM32_ASM_PCI_H
-
-#ifdef __KERNEL__
-
-/* Can be used to override the logic in pci_scan_bus for skipping
- * already-configured bus numbers - to be used for buggy BIOSes
- * or architectures with incomplete PCI setup by the loader
- */
-
-#define pcibios_assign_all_busses()    0
-
-extern struct pci_controller* pcibios_alloc_controller(void);
-
-static inline void pcibios_set_master(struct pci_dev *dev)
-{
-       /* No special bus mastering setup handling */
-}
-
-static inline void pcibios_penalize_isa_irq(int irq)
-{
-       /* We don't do dynamic PCI IRQ allocation */
-}
-
-/* Assume some values. (We should revise them, if necessary) */
-
-#define PCIBIOS_MIN_IO         0x2000
-#define PCIBIOS_MIN_MEM                0x10000000
-
-/* Dynamic DMA mapping stuff.
- * Xtensa has everything mapped statically like x86.
- */
-
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <asm/scatterlist.h>
-#include <linux/string.h>
-#include <asm/io.h>
-
-struct pci_dev;
-
-/* The PCI address space does equal the physical memory address space.
- * The networking and block device layers use this boolean for bounce buffer
- * decisions.
- */
-
-#define PCI_DMA_BUS_IS_PHYS    (1)
-
-/* pci_unmap_{page,single} is a no-op, so */
-#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
-#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
-#define pci_unmap_addr(PTR, ADDR_NAME)         (0)
-#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL)        do { } while (0)
-#define pci_ubnmap_len(PTR, LEN_NAME)          (0)
-#define pci_unmap_len_set(PTR, LEN_NAME, VAL)  do { } while (0)
-
-/* We cannot access memory above 4GB */
-#define pci_dac_dma_supported(pci_dev, mask)   (0)
-
-static inline int pcibios_add_platform_entries(struct pci_dev *dev)
-{
-       return 0;
-}
-
-#endif /* __KERNEL__ */
-
-/* Implement the pci_ DMA API in terms of the generic device dma_ one */
-//#include <asm-generic/pci-dma-compat.h>
-
-/* Generic PCI */
-#include <asm-generic/pci.h>
-
-#endif
diff --git a/arch/lm32/mm/kmap.c b/arch/lm32/mm/kmap.c
deleted file mode 100644
index 2f52264..0000000
--- a/arch/lm32/mm/kmap.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * (C) Copyright 2007
- *     Theobroma Systems <www.theobroma-systems.com>
- *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
- */
-
-/*
- *  linux/arch/lm32/mm/kmap.c
- *
- *  Based on:
- *
- *  linux/arch/m68knommu/mm/kmap.c
- *  Copyright (C) 2000 Lineo, <[email protected]>
- *  Copyright (C) 2000-2002 David McCullough <[email protected]>
- */
-
-#include <linux/mm.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/slab.h>
-#include <linux/vmalloc.h>
-
-#include <asm/setup.h>
-#include <asm/segment.h>
-#include <asm/page.h>
-#include <asm/pgalloc.h>
-#include <asm/io.h>
-#include <asm/system.h>
-
-#undef DEBUG
-
-/*
- * Map some physical address range into the kernel address space.
- */
-void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
-{
-       return (void *)physaddr;
-}
-
-/*
- * Unmap a ioremap()ed region again.
- */
-void iounmap(void *addr)
-{
-}
-
-/*
- * __iounmap unmaps nearly everything, so be careful
- * it doesn't free currently pointer/page tables anymore but it
- * wans't used anyway and might be added later.
- */
-void __iounmap(void *addr, unsigned long size)
-{
-}
-
-/*
- * Set new cache mode for some kernel address space.
- * The caller must push data for that range itself, if such data may already
- * be in the cache.
- */
-void kernel_set_cachemode(void *addr, unsigned long size, int cmode)
-{
-}
diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 4644c9a..5d93735 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -244,15 +244,15 @@ static inline void writesb(const void __iomem *addr, 
const void *buf, int len)
 #ifndef CONFIG_GENERIC_IOMAP
 #define ioread8(addr)          readb(addr)
 #define ioread16(addr)         readw(addr)
-#define ioread16be(addr)       be16_to_cpu(ioread16(addr))
+#define ioread16be(addr)       be16_to_cpu(__raw_readw(addr))
 #define ioread32(addr)         readl(addr)
-#define ioread32be(addr)       be32_to_cpu(ioread32(addr))
+#define ioread32be(addr)       be32_to_cpu(__raw_readl(addr))
 
 #define iowrite8(v, addr)      writeb((v), (addr))
 #define iowrite16(v, addr)     writew((v), (addr))
-#define iowrite16be(v, addr)   iowrite16(be16_to_cpu(v), (addr))
+#define iowrite16be(v, addr)   __raw_writew(be16_to_cpu(v), (addr))
 #define iowrite32(v, addr)     writel((v), (addr))
-#define iowrite32be(v, addr)   iowrite32(be32_to_cpu(v), (addr))
+#define iowrite32be(v, addr)   __raw_writel(be32_to_cpu(v), (addr))
 
 #define ioread8_rep(p, dst, count) \
        insb((unsigned long) (p), (dst), (count))
-- 
1.7.2.3

_______________________________________________
http://lists.milkymist.org/listinfo.cgi/devel-milkymist.org
IRC: #milkymist@Freenode
Twitter: www.twitter.com/milkymistvj
Ideas? http://milkymist.uservoice.com

Reply via email to