2005-06-24 13:01:26 +08:00
|
|
|
/*
|
2006-12-10 18:18:48 +08:00
|
|
|
* include/asm-xtensa/io.h
|
2005-06-24 13:01:26 +08: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
|
|
|
|
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
#include <asm/byteorder.h>
|
2007-07-24 09:43:54 +08:00
|
|
|
#include <asm/page.h>
|
2012-04-19 04:20:38 +08:00
|
|
|
#include <linux/bug.h>
|
2007-08-23 01:14:51 +08:00
|
|
|
#include <linux/kernel.h>
|
2005-06-24 13:01:26 +08:00
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
|
2008-10-22 00:08:31 +08:00
|
|
|
#define XCHAL_KIO_CACHED_VADDR 0xe0000000
|
|
|
|
#define XCHAL_KIO_BYPASS_VADDR 0xf0000000
|
2006-12-10 18:18:48 +08:00
|
|
|
#define XCHAL_KIO_PADDR 0xf0000000
|
2008-10-22 00:08:31 +08:00
|
|
|
#define XCHAL_KIO_SIZE 0x10000000
|
|
|
|
|
|
|
|
#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
|
2012-09-17 09:44:40 +08:00
|
|
|
#define IO_SPACE_LIMIT ~0
|
2005-06-24 13:01:26 +08:00
|
|
|
|
2012-09-17 09:44:40 +08:00
|
|
|
#ifdef CONFIG_MMU
|
2005-06-24 13:01:26 +08:00
|
|
|
/*
|
2012-09-17 09:44:40 +08:00
|
|
|
* Return the virtual address for the specified bus memory.
|
2006-12-10 18:18:48 +08:00
|
|
|
* Note that we currently don't support any address outside the KIO segment.
|
2005-06-24 13:01:26 +08:00
|
|
|
*/
|
2012-09-17 09:44:39 +08:00
|
|
|
static inline void __iomem *ioremap_nocache(unsigned long offset,
|
|
|
|
unsigned long size)
|
2005-06-24 13:01:26 +08:00
|
|
|
{
|
2006-12-10 18:18:48 +08:00
|
|
|
if (offset >= XCHAL_KIO_PADDR
|
2012-09-17 09:44:39 +08:00
|
|
|
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
|
2006-12-10 18:18:48 +08:00
|
|
|
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
|
|
|
|
else
|
|
|
|
BUG();
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
2012-09-17 09:44:39 +08:00
|
|
|
static inline void __iomem *ioremap_cache(unsigned long offset,
|
|
|
|
unsigned long size)
|
2005-06-24 13:01:26 +08:00
|
|
|
{
|
2006-12-10 18:18:48 +08:00
|
|
|
if (offset >= XCHAL_KIO_PADDR
|
2012-09-17 09:44:39 +08:00
|
|
|
&& offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
|
2006-12-10 18:18:48 +08:00
|
|
|
return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
|
|
|
|
else
|
|
|
|
BUG();
|
2005-06-24 13:01:26 +08:00
|
|
|
}
|
|
|
|
|
2012-09-17 09:44:39 +08:00
|
|
|
#define ioremap_wc ioremap_nocache
|
|
|
|
|
|
|
|
static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
|
|
|
|
{
|
|
|
|
return ioremap_nocache(offset, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void iounmap(volatile void __iomem *addr)
|
2005-06-24 13:01:26 +08:00
|
|
|
{
|
|
|
|
}
|
2012-09-17 09:44:40 +08:00
|
|
|
#endif /* CONFIG_MMU */
|
2005-06-24 13:01:26 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic I/O
|
|
|
|
*/
|
2012-09-17 09:44:40 +08:00
|
|
|
#define readb_relaxed readb
|
|
|
|
#define readw_relaxed readw
|
|
|
|
#define readl_relaxed readl
|
2005-06-24 13:01:26 +08:00
|
|
|
|
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
|
2012-09-17 09:44:40 +08:00
|
|
|
#include <asm-generic/io.h>
|
|
|
|
|
2005-06-24 13:01:26 +08:00
|
|
|
#endif /* _XTENSA_IO_H */
|