2 * iop13xx custom ioremap implementation
3 * Copyright (c) 2005-2006, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
16 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 #include <linux/kernel.h>
20 #include <linux/module.h>
22 #include <mach/hardware.h>
24 void * __iomem __iop13xx_io(unsigned long io_addr)
26 void __iomem * io_virt;
29 case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA:
30 io_virt = (void *) IOP13XX_PCIE_IO_PHYS_TO_VIRT(io_addr);
32 case IOP13XX_PCIX_LOWER_IO_PA ... IOP13XX_PCIX_UPPER_IO_PA:
33 io_virt = (void *) IOP13XX_PCIX_IO_PHYS_TO_VIRT(io_addr);
41 EXPORT_SYMBOL(__iop13xx_io);
43 static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
44 size_t size, unsigned int mtype, void *caller)
46 void __iomem * retval;
49 case IOP13XX_PCIX_LOWER_MEM_RA ... IOP13XX_PCIX_UPPER_MEM_RA:
50 if (unlikely(!iop13xx_atux_mem_base))
53 retval = (void *)(iop13xx_atux_mem_base +
54 (cookie - IOP13XX_PCIX_LOWER_MEM_RA));
56 case IOP13XX_PCIE_LOWER_MEM_RA ... IOP13XX_PCIE_UPPER_MEM_RA:
57 if (unlikely(!iop13xx_atue_mem_base))
60 retval = (void *)(iop13xx_atue_mem_base +
61 (cookie - IOP13XX_PCIE_LOWER_MEM_RA));
63 case IOP13XX_PBI_LOWER_MEM_RA ... IOP13XX_PBI_UPPER_MEM_RA:
64 retval = __arm_ioremap_caller(IOP13XX_PBI_LOWER_MEM_PA +
65 (cookie - IOP13XX_PBI_LOWER_MEM_RA),
66 size, mtype, __builtin_return_address(0));
68 case IOP13XX_PCIE_LOWER_IO_PA ... IOP13XX_PCIE_UPPER_IO_PA:
69 retval = (void *) IOP13XX_PCIE_IO_PHYS_TO_VIRT(cookie);
71 case IOP13XX_PCIX_LOWER_IO_PA ... IOP13XX_PCIX_UPPER_IO_PA:
72 retval = (void *) IOP13XX_PCIX_IO_PHYS_TO_VIRT(cookie);
74 case IOP13XX_PMMR_PHYS_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_PA:
75 retval = (void *) IOP13XX_PMMR_PHYS_TO_VIRT(cookie);
78 retval = __arm_ioremap_caller(cookie, size, mtype,
85 static void __iop13xx_iounmap(volatile void __iomem *addr)
87 if (iop13xx_atue_mem_base)
88 if (addr >= (void __iomem *) iop13xx_atue_mem_base &&
89 addr < (void __iomem *) (iop13xx_atue_mem_base +
90 iop13xx_atue_mem_size))
93 if (iop13xx_atux_mem_base)
94 if (addr >= (void __iomem *) iop13xx_atux_mem_base &&
95 addr < (void __iomem *) (iop13xx_atux_mem_base +
96 iop13xx_atux_mem_size))
100 case IOP13XX_PCIE_LOWER_IO_VA ... IOP13XX_PCIE_UPPER_IO_VA:
101 case IOP13XX_PCIX_LOWER_IO_VA ... IOP13XX_PCIX_UPPER_IO_VA:
102 case IOP13XX_PMMR_VIRT_MEM_BASE ... IOP13XX_PMMR_UPPER_MEM_VA:
111 void __init iop13xx_init_early(void)
113 arch_ioremap_caller = __iop13xx_ioremap_caller;
114 arch_iounmap = __iop13xx_iounmap;