diff options
author | Hemant Pedanekar <hemantp@ti.com> | 2009-06-24 00:45:47 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-08-26 03:57:01 -0400 |
commit | 9eb7115bcc423ae022ebf1844820d58a77c2d435 (patch) | |
tree | 02d47e10e7f3c8c45f147b296ecfcec872f49f41 /arch/arm/mach-davinci/include/mach | |
parent | 3e25d5f4fd7515a0a1e6b68025c483f53196a98c (diff) |
davinci: Move IO device mapping macros from io.h to hardware.h
This patch takes out IO mapping macros from mach/io.h and puts them in
mach/hardware.h avoiding need to include mach/io.h in various files such as
serial.h, vmalloc.h etc.
The main reason to avoid inclusion of mach/io.h is, when default in/out macros
are overridden by machine specific functions (e.g., in case of PCI I/O), they
result into linker error. An example snippet and error snapshot is listed below.
Following code in mach/io.h:
#define inl(p) my_inl()
static inline unsigned int my_inl(unsigned int addr)
{
if (IS_PCI_IO(addr))
return pci_inl ();
else
return le32_to_cpu(__raw_readl(__typesafe_io(addr)));
}
leads to error:
LD arch/arm/boot/compressed/vmlinux
arch/arm/boot/compressed/misc.o: In function `my_inl':
misc.c:(.text+0x2744): undefined reference to `pci_inl'
make[2]: *** [arch/arm/boot/compressed/vmlinux] Error 1
This is because mach/io.h gets included in arch/arm/boot/compressed/misc.c
through mach/serial.h but pci.c file, which defines 'pci_inl' doesn't get built
into compressed vmlinux.
Signed-off-by: Hemant Pedanekar <hemantp@ti.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-davinci/include/mach')
-rw-r--r-- | arch/arm/mach-davinci/include/mach/hardware.h | 17 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/io.h | 23 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/serial.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-davinci/include/mach/vmalloc.h | 2 |
4 files changed, 21 insertions, 23 deletions
diff --git a/arch/arm/mach-davinci/include/mach/hardware.h b/arch/arm/mach-davinci/include/mach/hardware.h index 48c77934d519..41c89386e39b 100644 --- a/arch/arm/mach-davinci/include/mach/hardware.h +++ b/arch/arm/mach-davinci/include/mach/hardware.h | |||
@@ -24,4 +24,21 @@ | |||
24 | /* System control register offsets */ | 24 | /* System control register offsets */ |
25 | #define DM64XX_VDD3P3V_PWDN 0x48 | 25 | #define DM64XX_VDD3P3V_PWDN 0x48 |
26 | 26 | ||
27 | /* | ||
28 | * I/O mapping | ||
29 | */ | ||
30 | #define IO_PHYS 0x01c00000 | ||
31 | #define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */ | ||
32 | #define IO_SIZE 0x00400000 | ||
33 | #define IO_VIRT (IO_PHYS + IO_OFFSET) | ||
34 | #define io_v2p(va) ((va) - IO_OFFSET) | ||
35 | #define __IO_ADDRESS(x) ((x) + IO_OFFSET) | ||
36 | #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) | ||
37 | |||
38 | #ifdef __ASSEMBLER__ | ||
39 | #define IOMEM(x) x | ||
40 | #else | ||
41 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
42 | #endif | ||
43 | |||
27 | #endif /* __ASM_ARCH_HARDWARE_H */ | 44 | #endif /* __ASM_ARCH_HARDWARE_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/io.h b/arch/arm/mach-davinci/include/mach/io.h index 2479785405af..62b0a90309ad 100644 --- a/arch/arm/mach-davinci/include/mach/io.h +++ b/arch/arm/mach-davinci/include/mach/io.h | |||
@@ -14,18 +14,6 @@ | |||
14 | #define IO_SPACE_LIMIT 0xffffffff | 14 | #define IO_SPACE_LIMIT 0xffffffff |
15 | 15 | ||
16 | /* | 16 | /* |
17 | * ---------------------------------------------------------------------------- | ||
18 | * I/O mapping | ||
19 | * ---------------------------------------------------------------------------- | ||
20 | */ | ||
21 | #define IO_PHYS 0x01c00000 | ||
22 | #define IO_OFFSET 0xfd000000 /* Virtual IO = 0xfec00000 */ | ||
23 | #define IO_SIZE 0x00400000 | ||
24 | #define IO_VIRT (IO_PHYS + IO_OFFSET) | ||
25 | #define io_v2p(va) ((va) - IO_OFFSET) | ||
26 | #define __IO_ADDRESS(x) ((x) + IO_OFFSET) | ||
27 | |||
28 | /* | ||
29 | * We don't actually have real ISA nor PCI buses, but there is so many | 17 | * We don't actually have real ISA nor PCI buses, but there is so many |
30 | * drivers out there that might just work if we fake them... | 18 | * drivers out there that might just work if we fake them... |
31 | */ | 19 | */ |
@@ -33,19 +21,12 @@ | |||
33 | #define __mem_pci(a) (a) | 21 | #define __mem_pci(a) (a) |
34 | #define __mem_isa(a) (a) | 22 | #define __mem_isa(a) (a) |
35 | 23 | ||
36 | #define IO_ADDRESS(pa) IOMEM(__IO_ADDRESS(pa)) | 24 | #ifndef __ASSEMBLER__ |
37 | |||
38 | #ifdef __ASSEMBLER__ | ||
39 | #define IOMEM(x) x | ||
40 | #else | ||
41 | #define IOMEM(x) ((void __force __iomem *)(x)) | ||
42 | |||
43 | #define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t) | 25 | #define __arch_ioremap(p, s, t) davinci_ioremap(p, s, t) |
44 | #define __arch_iounmap(v) davinci_iounmap(v) | 26 | #define __arch_iounmap(v) davinci_iounmap(v) |
45 | 27 | ||
46 | void __iomem *davinci_ioremap(unsigned long phys, size_t size, | 28 | void __iomem *davinci_ioremap(unsigned long phys, size_t size, |
47 | unsigned int type); | 29 | unsigned int type); |
48 | void davinci_iounmap(volatile void __iomem *addr); | 30 | void davinci_iounmap(volatile void __iomem *addr); |
49 | 31 | #endif | |
50 | #endif /* __ASSEMBLER__ */ | ||
51 | #endif /* __ASM_ARCH_IO_H */ | 32 | #endif /* __ASM_ARCH_IO_H */ |
diff --git a/arch/arm/mach-davinci/include/mach/serial.h b/arch/arm/mach-davinci/include/mach/serial.h index 57e68e610ee9..a584697a9e70 100644 --- a/arch/arm/mach-davinci/include/mach/serial.h +++ b/arch/arm/mach-davinci/include/mach/serial.h | |||
@@ -11,7 +11,7 @@ | |||
11 | #ifndef __ASM_ARCH_SERIAL_H | 11 | #ifndef __ASM_ARCH_SERIAL_H |
12 | #define __ASM_ARCH_SERIAL_H | 12 | #define __ASM_ARCH_SERIAL_H |
13 | 13 | ||
14 | #include <mach/io.h> | 14 | #include <mach/hardware.h> |
15 | 15 | ||
16 | #define DAVINCI_MAX_NR_UARTS 3 | 16 | #define DAVINCI_MAX_NR_UARTS 3 |
17 | #define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) | 17 | #define DAVINCI_UART0_BASE (IO_PHYS + 0x20000) |
diff --git a/arch/arm/mach-davinci/include/mach/vmalloc.h b/arch/arm/mach-davinci/include/mach/vmalloc.h index ad51625b6609..d49646a8e206 100644 --- a/arch/arm/mach-davinci/include/mach/vmalloc.h +++ b/arch/arm/mach-davinci/include/mach/vmalloc.h | |||
@@ -8,7 +8,7 @@ | |||
8 | * is licensed "as is" without any warranty of any kind, whether express | 8 | * is licensed "as is" without any warranty of any kind, whether express |
9 | * or implied. | 9 | * or implied. |
10 | */ | 10 | */ |
11 | #include <mach/io.h> | 11 | #include <mach/hardware.h> |
12 | 12 | ||
13 | /* Allow vmalloc range until the IO virtual range minus a 2M "hole" */ | 13 | /* Allow vmalloc range until the IO virtual range minus a 2M "hole" */ |
14 | #define VMALLOC_END (IO_VIRT - (2<<20)) | 14 | #define VMALLOC_END (IO_VIRT - (2<<20)) |