blob: e15bc17db90b0fc845cf44c0f27dd9e4cec5e51a [file] [log] [blame]
Dan Williams6df26702007-02-13 17:11:04 +01001/*
2 * iop3xx custom ioremap implementation
3 * Copyright (c) 2006, Intel Corporation.
4 *
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.
8 *
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
12 * more details.
13 *
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.
17 *
18 */
19#include <linux/kernel.h>
20#include <linux/module.h>
Russell Kingfced80c2008-09-06 12:10:45 +010021#include <linux/io.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/hardware.h>
Dan Williams6df26702007-02-13 17:11:04 +010023
24void * __iomem __iop3xx_ioremap(unsigned long cookie, size_t size,
Russell King3603ab22007-05-05 20:59:27 +010025 unsigned int mtype)
Dan Williams6df26702007-02-13 17:11:04 +010026{
27 void __iomem * retval;
28
29 switch (cookie) {
30 case IOP3XX_PCI_LOWER_IO_PA ... IOP3XX_PCI_UPPER_IO_PA:
31 retval = (void *) IOP3XX_PCI_IO_PHYS_TO_VIRT(cookie);
32 break;
33 case IOP3XX_PERIPHERAL_PHYS_BASE ... IOP3XX_PERIPHERAL_UPPER_PA:
34 retval = (void *) IOP3XX_PMMR_PHYS_TO_VIRT(cookie);
35 break;
36 default:
Russell King31aa8fd2009-12-18 11:10:03 +000037 retval = __arm_ioremap_caller(cookie, size, mtype,
38 __builtin_return_address(0));
Dan Williams6df26702007-02-13 17:11:04 +010039 }
40
41 return retval;
42}
43EXPORT_SYMBOL(__iop3xx_ioremap);
44
45void __iop3xx_iounmap(void __iomem *addr)
46{
47 extern void __iounmap(volatile void __iomem *addr);
48
49 switch ((u32) addr) {
50 case IOP3XX_PCI_LOWER_IO_VA ... IOP3XX_PCI_UPPER_IO_VA:
51 case IOP3XX_PERIPHERAL_VIRT_BASE ... IOP3XX_PERIPHERAL_UPPER_VA:
52 goto skip;
53 }
54 __iounmap(addr);
55
56skip:
57 return;
58}
59EXPORT_SYMBOL(__iop3xx_iounmap);