2007-04-30 14:37:19 -04: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 07:10:45 -04:00
|
|
|
#include <linux/io.h>
|
2007-04-30 14:37:19 -04:00
|
|
|
|
|
|
|
#include <asm/tlb.h>
|
2007-06-05 11:36:55 -04:00
|
|
|
|
2009-04-14 08:04:16 -04:00
|
|
|
#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);
|
|
|
|
|
2009-12-18 06:10:03 -05:00
|
|
|
return __arm_ioremap_caller(p, size, type, __builtin_return_address(0));
|
2009-04-14 08:04:16 -04:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL(davinci_ioremap);
|
|
|
|
|
|
|
|
void davinci_iounmap(volatile void __iomem *addr)
|
2007-06-05 11:36:55 -04:00
|
|
|
{
|
2009-04-14 08:04:16 -04:00
|
|
|
unsigned long virt = (unsigned long)addr;
|
|
|
|
|
|
|
|
if (virt >= VMALLOC_START && virt < VMALLOC_END)
|
|
|
|
__iounmap(addr);
|
2007-06-05 11:36:55 -04:00
|
|
|
}
|
2009-04-14 08:04:16 -04:00
|
|
|
EXPORT_SYMBOL(davinci_iounmap);
|