Skip to content

Commit b5ee900

Browse files
Nicolas PitreRussell King
authored andcommitted
[ARM] remove a common set of __virt_to_bus definitions
Let's provide an overridable default instead of having every machine class define __virt_to_bus and __bus_to_virt to the same thing. What most platforms are using is bus_addr == phys_addr so such is the default. One exception is ebsa110 which has no DMA what so ever, so the actual definition is not important except only for proper compilation. Also added a comment about the special footbridge bus translation. Let's also remove comments alluding to set_dma_addr which is not (and should not) be commonly used. Signed-off-by: Nicolas Pitre <nico@marvell.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
1 parent 75f4aa1 commit b5ee900

39 files changed

Lines changed: 21 additions & 299 deletions

File tree

‎arch/arm/include/asm/memory.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ static inline void *phys_to_virt(unsigned long x)
178178
* memory. Use of these is *deprecated* (and that doesn't mean
179179
* use the __ prefixed forms instead.) See dma-mapping.h.
180180
*/
181+
#ifndef __virt_to_bus
182+
#define __virt_to_bus __virt_to_phys
183+
#define __bus_to_virt __phys_to_virt
184+
#endif
185+
181186
static inline __deprecated unsigned long virt_to_bus(void *x)
182187
{
183188
return __virt_to_bus((unsigned long)x);

‎arch/arm/mach-aaec2000/include/mach/memory.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
#define PHYS_OFFSET UL(0xf0000000)
1616

17-
#define __virt_to_bus(x) __virt_to_phys(x)
18-
#define __bus_to_virt(x) __phys_to_virt(x)
19-
2017
/*
2118
* The nodes are the followings:
2219
*

‎arch/arm/mach-at91/include/mach/memory.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,4 @@
2525

2626
#define PHYS_OFFSET (AT91_SDRAM_BASE)
2727

28-
29-
/*
30-
* Virtual view <-> DMA view memory address translations
31-
* virt_to_bus: Used to translate the virtual address to an
32-
* address suitable to be passed to set_dma_addr
33-
* bus_to_virt: Used to convert an address for DMA operations
34-
* to an address that the kernel can use.
35-
*/
36-
#define __virt_to_bus(x) __virt_to_phys(x)
37-
#define __bus_to_virt(x) __phys_to_virt(x)
38-
3928
#endif

‎arch/arm/mach-clps711x/include/mach/memory.h‎

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,7 @@
2626
*/
2727
#define PHYS_OFFSET UL(0xc0000000)
2828

29-
/*
30-
* Virtual view <-> DMA view memory address translations
31-
* virt_to_bus: Used to translate the virtual address to an
32-
* address suitable to be passed to set_dma_addr
33-
* bus_to_virt: Used to convert an address for DMA operations
34-
* to an address that the kernel can use.
35-
*/
36-
37-
#if defined(CONFIG_ARCH_CDB89712)
38-
39-
#define __virt_to_bus(x) (x)
40-
#define __bus_to_virt(x) (x)
41-
42-
#elif defined (CONFIG_ARCH_AUTCPU12)
43-
44-
#define __virt_to_bus(x) (x)
45-
#define __bus_to_virt(x) (x)
46-
47-
#else
29+
#if !defined(CONFIG_ARCH_CDB89712) && !defined (CONFIG_ARCH_AUTCPU12)
4830

4931
#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
5032
#define __bus_to_virt(x) ((x) + PAGE_OFFSET)

‎arch/arm/mach-clps7500/include/mach/memory.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,6 @@
1919
*/
2020
#define PHYS_OFFSET UL(0x10000000)
2121

22-
/*
23-
* These are exactly the same on the RiscPC as the
24-
* physical memory view.
25-
*/
26-
#define __virt_to_bus(x) __virt_to_phys(x)
27-
#define __bus_to_virt(x) __phys_to_virt(x)
28-
2922
/*
3023
* Cache flushing area - ROM
3124
*/

‎arch/arm/mach-davinci/include/mach/memory.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,4 @@ __arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)
5555

5656
#endif
5757

58-
/*
59-
* Bus address is physical address
60-
*/
61-
#define __virt_to_bus(x) __virt_to_phys(x)
62-
#define __bus_to_virt(x) __phys_to_virt(x)
63-
6458
#endif /* __ASM_ARCH_MEMORY_H */

‎arch/arm/mach-ebsa110/include/mach/memory.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121
*/
2222
#define PHYS_OFFSET UL(0x00000000)
2323

24-
/*
25-
* We keep this 1:1 so that we don't interfere
26-
* with the PCMCIA memory regions
27-
*/
28-
#define __virt_to_bus(x) (x)
29-
#define __bus_to_virt(x) (x)
30-
3124
/*
3225
* Cache flushing area - SRAM
3326
*/

‎arch/arm/mach-ep93xx/include/mach/memory.h‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,4 @@
77

88
#define PHYS_OFFSET UL(0x00000000)
99

10-
#define __bus_to_virt(x) __phys_to_virt(x)
11-
#define __virt_to_bus(x) __virt_to_phys(x)
12-
13-
1410
#endif

‎arch/arm/mach-footbridge/include/mach/memory.h‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,18 @@
3030
extern unsigned long __virt_to_bus(unsigned long);
3131
extern unsigned long __bus_to_virt(unsigned long);
3232
#endif
33+
#define __virt_to_bus __virt_to_bus
34+
#define __bus_to_virt __bus_to_virt
3335

3436
#elif defined(CONFIG_FOOTBRIDGE_HOST)
3537

38+
/*
39+
* The footbridge is programmed to expose the system RAM at the corresponding
40+
* address. So, if PAGE_OFFSET is 0xc0000000, RAM appears at 0xe0000000.
41+
* If 0x80000000, then its exposed at 0xa0000000 on the bus. etc.
42+
* The only requirement is that the RAM isn't placed at bus address 0 which
43+
* would clash with VGA cards.
44+
*/
3645
#define __virt_to_bus(x) ((x) - 0xe0000000)
3746
#define __bus_to_virt(x) ((x) + 0xe0000000)
3847

‎arch/arm/mach-h720x/include/mach/memory.h‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@
77
#ifndef __ASM_ARCH_MEMORY_H
88
#define __ASM_ARCH_MEMORY_H
99

10-
/*
11-
* Page offset:
12-
* ( 0xc0000000UL )
13-
*/
1410
#define PHYS_OFFSET UL(0x40000000)
1511

16-
/*
17-
* Virtual view <-> DMA view memory address translations
18-
* virt_to_bus: Used to translate the virtual address to an
19-
* address suitable to be passed to set_dma_addr
20-
* bus_to_virt: Used to convert an address for DMA operations
21-
* to an address that the kernel can use.
22-
*
23-
* There is something to do here later !, Mar 2000, Jungjun Kim
24-
*/
25-
26-
#define __virt_to_bus(x) __virt_to_phys(x)
27-
#define __bus_to_virt(x) __phys_to_virt(x)
28-
2912
#endif

0 commit comments

Comments
 (0)