2007-04-30 11:37:19 -07:00
|
|
|
/*
|
|
|
|
* 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>
|
2008-09-06 04:10:45 -07:00
|
|
|
#include <linux/io.h>
|
2007-04-30 11:37:19 -07:00
|
|
|
|
|
|
|
#include <asm/tlb.h>
|
2010-05-07 14:06:39 -07:00
|
|
|
#include <asm/mach/map.h>
|
2007-06-05 08:36:55 -07:00
|
|
|
|
2010-05-07 14:06:39 -07:00
|
|
|
#include <mach/common.h>
|
2009-04-14 05:04:16 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Intercept ioremap() requests for addresses in our fixed mapping regions.
|
|
|
|
*/
|
|
|
|
void __iomem *davinci_ioremap(unsigned long p, size_t size, unsigned int type)
|
|
|
|
{
|
2010-05-07 14:06:39 -07:00
|
|
|
struct map_desc *desc = davinci_soc_info.io_desc;
|
|
|
|
int desc_num = davinci_soc_info.io_desc_num;
|
|
|
|
int i;
|
2009-04-14 05:04:16 -07:00
|
|
|
|
2010-05-07 14:06:39 -07:00
|
|
|
for (i = 0; i < desc_num; i++, desc++) {
|
|
|
|
unsigned long iophys = __pfn_to_phys(desc->pfn);
|
|
|
|
unsigned long iosize = desc->length;
|
|
|
|
|
|
|
|
if (p >= iophys && (p + size) <= (iophys + iosize))
|
|
|
|
return __io(desc->virtual + p - iophys);
|
|
|
|
}
|
|
|
|
|
|
|
|
return __arm_ioremap_caller(p, size, type,
|
|
|
|
__builtin_return_address(0));
|
2009-04-14 05:04:16 -07:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(davinci_ioremap);
|
|
|
|
|
|
|
|
void davinci_iounmap(volatile void __iomem *addr)
|
2007-06-05 08:36:55 -07:00
|
|
|
{
|
2009-04-14 05:04:16 -07:00
|
|
|
unsigned long virt = (unsigned long)addr;
|
|
|
|
|
|
|
|
if (virt >= VMALLOC_START && virt < VMALLOC_END)
|
|
|
|
__iounmap(addr);
|
2007-06-05 08:36:55 -07:00
|
|
|
}
|
2009-04-14 05:04:16 -07:00
|
|
|
EXPORT_SYMBOL(davinci_iounmap);
|