diff options
Diffstat (limited to 'arch/arm/mach-omap1/include/mach')
-rw-r--r-- | arch/arm/mach-omap1/include/mach/debug-macro.S | 48 | ||||
-rw-r--r-- | arch/arm/mach-omap1/include/mach/memory.h | 53 |
2 files changed, 73 insertions, 28 deletions
diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S index 62856044eb63..2b36a281dc84 100644 --- a/arch/arm/mach-omap1/include/mach/debug-macro.S +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S | |||
@@ -13,13 +13,8 @@ | |||
13 | 13 | ||
14 | #include <linux/serial_reg.h> | 14 | #include <linux/serial_reg.h> |
15 | 15 | ||
16 | #include <asm/memory.h> | ||
17 | |||
18 | #include <plat/serial.h> | 16 | #include <plat/serial.h> |
19 | 17 | ||
20 | #define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET) | ||
21 | #define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET) | ||
22 | |||
23 | .pushsection .data | 18 | .pushsection .data |
24 | omap_uart_phys: .word 0x0 | 19 | omap_uart_phys: .word 0x0 |
25 | omap_uart_virt: .word 0x0 | 20 | omap_uart_virt: .word 0x0 |
@@ -31,26 +26,24 @@ omap_uart_virt: .word 0x0 | |||
31 | * the desired UART phys and virt addresses temporarily into | 26 | * the desired UART phys and virt addresses temporarily into |
32 | * the omap_uart_phys and omap_uart_virt above. | 27 | * the omap_uart_phys and omap_uart_virt above. |
33 | */ | 28 | */ |
34 | .macro addruart, rp, rv | 29 | .macro addruart, rp, rv, tmp |
35 | 30 | ||
36 | /* Use omap_uart_phys/virt if already configured */ | 31 | /* Use omap_uart_phys/virt if already configured */ |
37 | 9: mrc p15, 0, \rp, c1, c0 | 32 | 9: adr \rp, 99f @ get effective addr of 99f |
38 | tst \rp, #1 @ MMU enabled? | 33 | ldr \rv, [\rp] @ get absolute addr of 99f |
39 | ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled | 34 | sub \rv, \rv, \rp @ offset between the two |
40 | ldrne \rp, =omap_uart_phys @ MMU enabled | 35 | ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys |
41 | add \rv, \rp, #4 @ omap_uart_virt | 36 | sub \tmp, \rp, \rv @ make it effective |
42 | ldr \rp, [\rp, #0] | 37 | ldr \rp, [\tmp, #0] @ omap_uart_phys |
43 | ldr \rv, [\rv, #0] | 38 | ldr \rv, [\tmp, #4] @ omap_uart_virt |
44 | cmp \rp, #0 @ is port configured? | 39 | cmp \rp, #0 @ is port configured? |
45 | cmpne \rv, #0 | 40 | cmpne \rv, #0 |
46 | bne 99f @ already configured | 41 | bne 100f @ already configured |
47 | 42 | ||
48 | /* Check the debug UART configuration set in uncompress.h */ | 43 | /* Check the debug UART configuration set in uncompress.h */ |
49 | mrc p15, 0, \rp, c1, c0 | 44 | and \rp, pc, #0xff000000 |
50 | tst \rp, #1 @ MMU enabled? | 45 | ldr \rv, =OMAP_UART_INFO_OFS |
51 | ldreq \rp, =OMAP_UART_INFO @ MMU not enabled | 46 | ldr \rp, [\rp, \rv] |
52 | ldrne \rp, =omap_uart_p2v(OMAP_UART_INFO) @ MMU enabled | ||
53 | ldr \rp, [\rp, #0] | ||
54 | 47 | ||
55 | /* Select the UART to use based on the UART1 scratchpad value */ | 48 | /* Select the UART to use based on the UART1 scratchpad value */ |
56 | 10: cmp \rp, #0 @ no port configured? | 49 | 10: cmp \rp, #0 @ no port configured? |
@@ -74,17 +67,18 @@ omap_uart_virt: .word 0x0 | |||
74 | 67 | ||
75 | /* Store both phys and virt address for the uart */ | 68 | /* Store both phys and virt address for the uart */ |
76 | 98: add \rp, \rp, #0xff000000 @ phys base | 69 | 98: add \rp, \rp, #0xff000000 @ phys base |
77 | mrc p15, 0, \rv, c1, c0 | 70 | str \rp, [\tmp, #0] @ omap_uart_phys |
78 | tst \rv, #1 @ MMU enabled? | ||
79 | ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled | ||
80 | ldrne \rv, =omap_uart_phys @ MMU enabled | ||
81 | str \rp, [\rv, #0] | ||
82 | sub \rp, \rp, #0xff000000 @ phys base | 71 | sub \rp, \rp, #0xff000000 @ phys base |
83 | add \rp, \rp, #0xfe000000 @ virt base | 72 | add \rp, \rp, #0xfe000000 @ virt base |
84 | add \rv, \rv, #4 @ omap_uart_lsr | 73 | str \rp, [\tmp, #4] @ omap_uart_virt |
85 | str \rp, [\rv, #0] | ||
86 | b 9b | 74 | b 9b |
87 | 99: | 75 | |
76 | .align | ||
77 | 99: .word . | ||
78 | .word omap_uart_phys | ||
79 | .ltorg | ||
80 | |||
81 | 100: | ||
88 | .endm | 82 | .endm |
89 | 83 | ||
90 | .macro senduart,rd,rx | 84 | .macro senduart,rd,rx |
diff --git a/arch/arm/mach-omap1/include/mach/memory.h b/arch/arm/mach-omap1/include/mach/memory.h index e9b600c113ef..c6337645ba8a 100644 --- a/arch/arm/mach-omap1/include/mach/memory.h +++ b/arch/arm/mach-omap1/include/mach/memory.h | |||
@@ -2,4 +2,55 @@ | |||
2 | * arch/arm/mach-omap1/include/mach/memory.h | 2 | * arch/arm/mach-omap1/include/mach/memory.h |
3 | */ | 3 | */ |
4 | 4 | ||
5 | #include <plat/memory.h> | 5 | #ifndef __ASM_ARCH_MEMORY_H |
6 | #define __ASM_ARCH_MEMORY_H | ||
7 | |||
8 | /* | ||
9 | * Physical DRAM offset. | ||
10 | */ | ||
11 | #define PLAT_PHYS_OFFSET UL(0x10000000) | ||
12 | |||
13 | /* | ||
14 | * Bus address is physical address, except for OMAP-1510 Local Bus. | ||
15 | * OMAP-1510 bus address is translated into a Local Bus address if the | ||
16 | * OMAP bus type is lbus. We do the address translation based on the | ||
17 | * device overriding the defaults used in the dma-mapping API. | ||
18 | * Note that the is_lbus_device() test is not very efficient on 1510 | ||
19 | * because of the strncmp(). | ||
20 | */ | ||
21 | #ifdef CONFIG_ARCH_OMAP15XX | ||
22 | |||
23 | /* | ||
24 | * OMAP-1510 Local Bus address offset | ||
25 | */ | ||
26 | #define OMAP1510_LB_OFFSET UL(0x30000000) | ||
27 | |||
28 | #define virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET) | ||
29 | #define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET) | ||
30 | #define is_lbus_device(dev) (cpu_is_omap15xx() && dev && (strncmp(dev_name(dev), "ohci", 4) == 0)) | ||
31 | |||
32 | #define __arch_pfn_to_dma(dev, pfn) \ | ||
33 | ({ dma_addr_t __dma = __pfn_to_phys(pfn); \ | ||
34 | if (is_lbus_device(dev)) \ | ||
35 | __dma = __dma - PHYS_OFFSET + OMAP1510_LB_OFFSET; \ | ||
36 | __dma; }) | ||
37 | |||
38 | #define __arch_dma_to_pfn(dev, addr) \ | ||
39 | ({ dma_addr_t __dma = addr; \ | ||
40 | if (is_lbus_device(dev)) \ | ||
41 | __dma += PHYS_OFFSET - OMAP1510_LB_OFFSET; \ | ||
42 | __phys_to_pfn(__dma); \ | ||
43 | }) | ||
44 | |||
45 | #define __arch_dma_to_virt(dev, addr) ({ (void *) (is_lbus_device(dev) ? \ | ||
46 | lbus_to_virt(addr) : \ | ||
47 | __phys_to_virt(addr)); }) | ||
48 | |||
49 | #define __arch_virt_to_dma(dev, addr) ({ unsigned long __addr = (unsigned long)(addr); \ | ||
50 | (dma_addr_t) (is_lbus_device(dev) ? \ | ||
51 | virt_to_lbus(__addr) : \ | ||
52 | __virt_to_phys(__addr)); }) | ||
53 | |||
54 | #endif /* CONFIG_ARCH_OMAP15XX */ | ||
55 | |||
56 | #endif | ||