Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
io.c
Go to the documentation of this file.
1 /*
2  * iop13xx custom ioremap implementation
3  * Copyright (c) 2005-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>
21 #include <linux/io.h>
22 #include <mach/hardware.h>
23 
24 #include "pci.h"
25 
26 static void __iomem *__iop13xx_ioremap_caller(unsigned long cookie,
27  size_t size, unsigned int mtype, void *caller)
28 {
29  void __iomem * retval;
30 
31  switch (cookie) {
34  retval = NULL;
35  else
36  retval = (iop13xx_atux_mem_base +
37  (cookie - IOP13XX_PCIX_LOWER_MEM_RA));
38  break;
41  retval = NULL;
42  else
43  retval = (iop13xx_atue_mem_base +
44  (cookie - IOP13XX_PCIE_LOWER_MEM_RA));
45  break;
48  (cookie - IOP13XX_PBI_LOWER_MEM_RA),
49  size, mtype, __builtin_return_address(0));
50  break;
52  retval = IOP13XX_PMMR_PHYS_TO_VIRT(cookie);
53  break;
54  default:
55  retval = __arm_ioremap_caller(cookie, size, mtype,
56  caller);
57  }
58 
59  return retval;
60 }
61 
62 static void __iop13xx_iounmap(volatile void __iomem *addr)
63 {
65  if (addr >= (void __iomem *) iop13xx_atue_mem_base &&
66  addr < (void __iomem *) (iop13xx_atue_mem_base +
68  goto skip;
69 
71  if (addr >= (void __iomem *) iop13xx_atux_mem_base &&
72  addr < (void __iomem *) (iop13xx_atux_mem_base +
74  goto skip;
75 
76  switch ((u32) addr) {
78  goto skip;
79  }
80  __iounmap(addr);
81 
82 skip:
83  return;
84 }
85 
87 {
88  arch_ioremap_caller = __iop13xx_ioremap_caller;
89  arch_iounmap = __iop13xx_iounmap;
90 }