mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
79c3c0b729
Create a structure to encapsulate SoC-specific information. This will assist in generalizing code so it can be used by different SoCs that have similar hardware but with minor differences such as having a different base address. The idea is that the code for each SoC fills out a structure with the correct information. The board-specific code then calls the SoC init routine which in turn will call a common init routine that makes a copy of the structure, maps in I/O regions, etc. After initialization, code can get a pointer to the structure by calling davinci_get_soc_info(). Eventually, the common init routine will make a copy of all of the data pointed to by the structure so the original data can be made __init_data. That way the data for SoC's that aren't being used won't consume memory for the entire life of the kernel. The structure will be extended in subsequent patches but initially, it holds the map_desc structure for any I/O regions the SoC/board wants statically mapped. Signed-off-by: Mark A. Greer <mgreer@mvista.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
38 lines
986 B
C
38 lines
986 B
C
/*
|
|
* DaVinci I/O mapping code
|
|
*
|
|
* Copyright (C) 2005-2006 Texas Instruments
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*/
|
|
|
|
#include <linux/module.h>
|
|
#include <linux/io.h>
|
|
|
|
#include <asm/tlb.h>
|
|
|
|
#define BETWEEN(p, st, sz) ((p) >= (st) && (p) < ((st) + (sz)))
|
|
#define XLATE(p, pst, vst) ((void __iomem *)((p) - (pst) + (vst)))
|
|
|
|
/*
|
|
* Intercept ioremap() requests for addresses in our fixed mapping regions.
|
|
*/
|
|
void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
|
|
{
|
|
if (BETWEEN(p, IO_PHYS, IO_SIZE))
|
|
return XLATE(p, IO_PHYS, IO_VIRT);
|
|
|
|
return __arm_ioremap(p, size, type);
|
|
}
|
|
EXPORT_SYMBOL(davinci_ioremap);
|
|
|
|
void davinci_iounmap(volatile void __iomem *addr)
|
|
{
|
|
unsigned long virt = (unsigned long)addr;
|
|
|
|
if (virt >= VMALLOC_START && virt < VMALLOC_END)
|
|
__iounmap(addr);
|
|
}
|
|
EXPORT_SYMBOL(davinci_iounmap);
|