2005-06-23 22:01:26 -07:00
|
|
|
/*
|
2006-12-10 02:18:48 -08:00
|
|
|
* include/asm-xtensa/io.h
|
2005-06-23 22:01:26 -07:00
|
|
|
*
|
|
|
|
|
* This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
|
* License. See the file "COPYING" in the main directory of this archive
|
|
|
|
|
* for more details.
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2001 - 2005 Tensilica Inc.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _XTENSA_IO_H
|
|
|
|
|
#define _XTENSA_IO_H
|
|
|
|
|
|
|
|
|
|
#include <asm/byteorder.h>
|
2007-07-23 18:43:54 -07:00
|
|
|
#include <asm/page.h>
|
2013-11-17 08:14:54 +02:00
|
|
|
#include <asm/vectors.h>
|
2012-04-18 16:20:38 -04:00
|
|
|
#include <linux/bug.h>
|
2007-08-22 10:14:51 -07:00
|
|
|
#include <linux/kernel.h>
|
2005-06-23 22:01:26 -07:00
|
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
|
2008-10-21 09:08:31 -07:00
|
|
|
#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
|
2012-09-17 05:44:40 +04:00
|
|
|
#define IO_SPACE_LIMIT ~0
|
2019-09-01 23:55:49 -07:00
|
|
|
#define PCI_IOBASE ((void __iomem *)XCHAL_KIO_BYPASS_VADDR)
|
2005-06-23 22:01:26 -07:00
|
|
|
|
2012-09-17 05:44:40 +04:00
|
|
|
#ifdef CONFIG_MMU
|
2013-12-29 11:03:30 +02:00
|
|
|
|
2015-12-10 17:05:27 -08:00
|
|
|
void __iomem *xtensa_ioremap_nocache(unsigned long addr, unsigned long size);
|
|
|
|
|
void __iomem *xtensa_ioremap_cache(unsigned long addr, unsigned long size);
|
|
|
|
|
void xtensa_iounmap(volatile void __iomem *addr);
|
|
|
|
|
|
2005-06-23 22:01:26 -07:00
|
|
|
/*
|
2012-09-17 05:44:40 +04:00
|
|
|
* Return the virtual address for the specified bus memory.
|
2005-06-23 22:01:26 -07:00
|
|
|
*/
|
2019-08-12 23:39:23 +02:00
|
|
|
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
|
2005-06-23 22:01:26 -07:00
|
|
|
{
|
2006-12-10 02:18:48 -08:00
|
|
|
if (offset >= XCHAL_KIO_PADDR
|
2012-09-17 05:44:39 +04:00
|
|
|
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
|
2006-12-10 02:18:48 -08:00
|
|
|
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
|
|
|
|
|
else
|
2015-12-10 17:05:27 -08:00
|
|
|
return xtensa_ioremap_nocache(offset, size);
|
2005-06-23 22:01:26 -07:00
|
|
|
}
|
|
|
|
|
|
2012-09-17 05:44:39 +04:00
|
|
|
static inline void __iomem *ioremap_cache(unsigned long offset,
|
|
|
|
|
unsigned long size)
|
2005-06-23 22:01:26 -07:00
|
|
|
{
|
2006-12-10 02:18:48 -08:00
|
|
|
if (offset >= XCHAL_KIO_PADDR
|
2012-09-17 05:44:39 +04:00
|
|
|
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
|
2006-12-10 02:18:48 -08:00
|
|
|
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
|
|
|
|
|
else
|
2015-12-10 17:05:27 -08:00
|
|
|
return xtensa_ioremap_cache(offset, size);
|
2005-06-23 22:01:26 -07:00
|
|
|
}
|
2015-08-10 23:07:06 -04:00
|
|
|
#define ioremap_cache ioremap_cache
|
2012-09-17 05:44:39 +04:00
|
|
|
|
|
|
|
|
static inline void iounmap(volatile void __iomem *addr)
|
2005-06-23 22:01:26 -07:00
|
|
|
{
|
2015-12-10 17:05:27 -08:00
|
|
|
unsigned long va = (unsigned long) addr;
|
|
|
|
|
|
|
|
|
|
if (!(va >= XCHAL_KIO_CACHED_VADDR &&
|
|
|
|
|
va - XCHAL_KIO_CACHED_VADDR < XCHAL_KIO_SIZE) &&
|
|
|
|
|
!(va >= XCHAL_KIO_BYPASS_VADDR &&
|
|
|
|
|
va - XCHAL_KIO_BYPASS_VADDR < XCHAL_KIO_SIZE))
|
|
|
|
|
xtensa_iounmap(addr);
|
2005-06-23 22:01:26 -07:00
|
|
|
}
|
2012-10-23 20:25:37 -07:00
|
|
|
|
|
|
|
|
#define virt_to_bus virt_to_phys
|
|
|
|
|
#define bus_to_virt phys_to_virt
|
|
|
|
|
|
2012-09-17 05:44:40 +04:00
|
|
|
#endif /* CONFIG_MMU */
|
2005-06-23 22:01:26 -07:00
|
|
|
|
2012-09-17 05:44:40 +04:00
|
|
|
#include <asm-generic/io.h>
|
|
|
|
|
|
2005-06-23 22:01:26 -07:00
|
|
|
#endif /* _XTENSA_IO_H */
|