/* Convert a physical pointer to a virtual kernel pointer for /dev/mem access  */
void* xlate_dev_mem_ptr(unsigned long phys)
/* Convert a physical pointer to a virtual kernel pointer for /dev/mem access  */
void* xlate_dev_mem_ptr(unsigned long phys)
{
	void *addr;
	unsigned long start = phys & PAGE_MASK;
	if (page_is_ram(start >> PAGE_SHIFT))
		return __va(phys);
	addr = (void __force *)ioremap_cache(start, PAGE_SIZE);
	if (addr)
		addr = (void *)((unsigned long)addr | (phys & ~PAGE_MASK));
	return addr;
}