Skip to content

Commit

Permalink
[ARM] remove a common set of __virt_to_bus definitions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Nicolas Pitre authored and Russell King committed Nov 28, 2008
1 parent 75f4aa1 commit b5ee900
Show file tree
Hide file tree
Showing 39 changed files with 21 additions and 299 deletions.
5 changes: 5 additions & 0 deletions arch/arm/include/asm/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,11 @@ static inline void *phys_to_virt(unsigned long x)
* memory. Use of these is *deprecated* (and that doesn't mean
* use the __ prefixed forms instead.) See dma-mapping.h.
*/
#ifndef __virt_to_bus
#define __virt_to_bus __virt_to_phys
#define __bus_to_virt __phys_to_virt
#endif

static inline __deprecated unsigned long virt_to_bus(void *x)
{
return __virt_to_bus((unsigned long)x);
Expand Down
3 changes: 0 additions & 3 deletions arch/arm/mach-aaec2000/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

#define PHYS_OFFSET UL(0xf0000000)

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

/*
* The nodes are the followings:
*
Expand Down
11 changes: 0 additions & 11 deletions arch/arm/mach-at91/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,4 @@

#define PHYS_OFFSET (AT91_SDRAM_BASE)


/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif
20 changes: 1 addition & 19 deletions arch/arm/mach-clps711x/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,7 @@
*/
#define PHYS_OFFSET UL(0xc0000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/

#if defined(CONFIG_ARCH_CDB89712)

#define __virt_to_bus(x) (x)
#define __bus_to_virt(x) (x)

#elif defined (CONFIG_ARCH_AUTCPU12)

#define __virt_to_bus(x) (x)
#define __bus_to_virt(x) (x)

#else
#if !defined(CONFIG_ARCH_CDB89712) && !defined (CONFIG_ARCH_AUTCPU12)

#define __virt_to_bus(x) ((x) - PAGE_OFFSET)
#define __bus_to_virt(x) ((x) + PAGE_OFFSET)
Expand Down
7 changes: 0 additions & 7 deletions arch/arm/mach-clps7500/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@
*/
#define PHYS_OFFSET UL(0x10000000)

/*
* These are exactly the same on the RiscPC as the
* physical memory view.
*/
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

/*
* Cache flushing area - ROM
*/
Expand Down
6 changes: 0 additions & 6 deletions arch/arm/mach-davinci/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,4 @@ __arch_adjust_zones(int node, unsigned long *size, unsigned long *holes)

#endif

/*
* Bus address is physical address
*/
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif /* __ASM_ARCH_MEMORY_H */
7 changes: 0 additions & 7 deletions arch/arm/mach-ebsa110/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,6 @@
*/
#define PHYS_OFFSET UL(0x00000000)

/*
* We keep this 1:1 so that we don't interfere
* with the PCMCIA memory regions
*/
#define __virt_to_bus(x) (x)
#define __bus_to_virt(x) (x)

/*
* Cache flushing area - SRAM
*/
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/mach-ep93xx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@

#define PHYS_OFFSET UL(0x00000000)

#define __bus_to_virt(x) __phys_to_virt(x)
#define __virt_to_bus(x) __virt_to_phys(x)


#endif
9 changes: 9 additions & 0 deletions arch/arm/mach-footbridge/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@
extern unsigned long __virt_to_bus(unsigned long);
extern unsigned long __bus_to_virt(unsigned long);
#endif
#define __virt_to_bus __virt_to_bus
#define __bus_to_virt __bus_to_virt

#elif defined(CONFIG_FOOTBRIDGE_HOST)

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

Expand Down
17 changes: 0 additions & 17 deletions arch/arm/mach-h720x/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H

/*
* Page offset:
* ( 0xc0000000UL )
*/
#define PHYS_OFFSET UL(0x40000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*
* There is something to do here later !, Mar 2000, Jungjun Kim
*/

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif
10 changes: 0 additions & 10 deletions arch/arm/mach-imx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,4 @@

#define PHYS_OFFSET UL(0x08000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define __virt_to_bus(x) (x - PAGE_OFFSET + PHYS_OFFSET)
#define __bus_to_virt(x) (x - PHYS_OFFSET + PAGE_OFFSET)

#endif
9 changes: 1 addition & 8 deletions arch/arm/mach-integrator/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@
* Physical DRAM offset.
*/
#define PHYS_OFFSET UL(0x00000000)
#define BUS_OFFSET UL(0x80000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define BUS_OFFSET UL(0x80000000)
#define __virt_to_bus(x) (x - PAGE_OFFSET + BUS_OFFSET)
#define __bus_to_virt(x) (x - BUS_OFFSET + PAGE_OFFSET)

Expand Down
16 changes: 2 additions & 14 deletions arch/arm/mach-iop13xx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,6 @@
#define IOP13XX_PMMR_P_START (IOP13XX_PMMR_PHYS_MEM_BASE)
#define IOP13XX_PMMR_P_END (IOP13XX_PMMR_PHYS_MEM_BASE + IOP13XX_PMMR_SIZE)

/*
* Virtual view <-> PCI DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/

/* RAM has 1:1 mapping on the PCIe/x Busses */
#define __virt_to_bus(x) (__virt_to_phys(x))
#define __bus_to_virt(x) (__phys_to_virt(x))

static inline dma_addr_t __virt_to_lbus(unsigned long x)
{
return x + IOP13XX_PMMR_PHYS_MEM_BASE - IOP13XX_PMMR_VIRT_MEM_BASE;
Expand Down Expand Up @@ -55,7 +43,7 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
if (is_lbus_device(dev) && __is_lbus_dma(__dma)) \
__virt = __lbus_to_virt(__dma); \
else \
__virt = __bus_to_virt(__dma); \
__virt = __phys_to_virt(__dma); \
(void *)__virt; \
})

Expand All @@ -66,7 +54,7 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
if (is_lbus_device(dev) && __is_lbus_virt(__virt)) \
__dma = __virt_to_lbus(__virt); \
else \
__dma = __virt_to_bus(__virt); \
__dma = __virt_to_phys(__virt); \
__dma; \
})

Expand Down
11 changes: 0 additions & 11 deletions arch/arm/mach-iop32x/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,4 @@
*/
#define PHYS_OFFSET UL(0xa0000000)

/*
* Virtual view <-> PCI DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define __virt_to_bus(x) (__virt_to_phys(x))
#define __bus_to_virt(x) (__phys_to_virt(x))


#endif
11 changes: 0 additions & 11 deletions arch/arm/mach-iop33x/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,4 @@
*/
#define PHYS_OFFSET UL(0x00000000)

/*
* Virtual view <-> PCI DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define __virt_to_bus(x) (__virt_to_phys(x))
#define __bus_to_virt(x) (__phys_to_virt(x))


#endif
7 changes: 0 additions & 7 deletions arch/arm/mach-ixp2000/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@

#define PHYS_OFFSET UL(0x00000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#include <mach/ixp2000-regs.h>

#define __virt_to_bus(v) \
Expand Down
13 changes: 0 additions & 13 deletions arch/arm/mach-ixp23xx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
*/
#define PHYS_OFFSET (0x00000000)


/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#ifndef __ASSEMBLY__

#define __virt_to_bus(v) \
({ unsigned int ret; \
ret = ((__virt_to_phys(v) - 0x00000000) + \
Expand All @@ -43,6 +33,3 @@
#define arch_is_coherent() 1

#endif


#endif
12 changes: 0 additions & 12 deletions arch/arm/mach-ixp4xx/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,4 @@ void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);

#endif

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*
* These are dummies for now.
*/
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif
4 changes: 0 additions & 4 deletions arch/arm/mach-kirkwood/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@

#define PHYS_OFFSET UL(0x00000000)

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)


#endif
5 changes: 0 additions & 5 deletions arch/arm/mach-ks8695/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ extern struct bus_type platform_bus_type;
(dma_addr_t)__virt_to_phys(x) : (dma_addr_t)__virt_to_bus(x); })
#define __arch_page_to_dma(dev, x) __arch_virt_to_dma(dev, page_address(x))

#else

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif

#endif
Expand Down
3 changes: 0 additions & 3 deletions arch/arm/mach-l7200/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
*/
#define PHYS_OFFSET UL(0xf0000000)

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

/*
* Cache flushing area - ROM
*/
Expand Down
10 changes: 0 additions & 10 deletions arch/arm/mach-lh7a40x/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@
*/
#define PHYS_OFFSET UL(0xc0000000)

/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
* address suitable to be passed to set_dma_addr
* bus_to_virt: Used to convert an address for DMA operations
* to an address that the kernel can use.
*/
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#ifdef CONFIG_DISCONTIGMEM

/*
Expand Down
4 changes: 0 additions & 4 deletions arch/arm/mach-loki/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@

#define PHYS_OFFSET UL(0x00000000)

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)


#endif
4 changes: 0 additions & 4 deletions arch/arm/mach-msm/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,5 @@
/* physical offset of RAM */
#define PHYS_OFFSET UL(0x10000000)

/* bus address and physical addresses are identical */
#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)

#endif

4 changes: 0 additions & 4 deletions arch/arm/mach-mv78xx0/include/mach/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@

#define PHYS_OFFSET UL(0x00000000)

#define __virt_to_bus(x) __virt_to_phys(x)
#define __bus_to_virt(x) __phys_to_virt(x)


#endif
Loading

0 comments on commit b5ee900

Please sign in to comment.