/*
 *  linux/include/asm-arm/arch-davinci/io.h
 *
 *  Copyright (C) 2004 Texas Instruments.
 *
 *  This program is free software; you can redistribute  it and/or modify it
 *  under  the terms of  the GNU General  Public License as published by the
 *  Free Software Foundation;  either version 2 of the  License, or (at your
 *  option) any later version.
 *
 *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
 *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
 *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
 *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
 *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
 *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
 *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
 *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *  You should have received a copy of the  GNU General Public License along
 *  with this program; if not, write  to the Free Software Foundation, Inc.,
 *  675 Mass Ave, Cambridge, MA 02139, USA.
 *
 */

#ifndef __ASM_ARCH_IO_H
#define __ASM_ARCH_IO_H

#define IO_SPACE_LIMIT 0xffffffff

/*
 * ----------------------------------------------------------------------------
 * I/O mapping
 * ----------------------------------------------------------------------------
 */
#define IO_PHYS	        0x01800000
#define IO_VIRT	        0xe0800000
#define IO_SIZE	        SZ_8M                      /*--- 0x10000000 - 0x01800000 = 0xE8000000 ---*/
#define io_p2v(pa)      (((pa) & (IO_SIZE-1)) + IO_VIRT)
#define io_v2p(va)      (((va) & (IO_SIZE-1)) + IO_PHYS)
#define IO_ADDRESS(x)   io_p2v(x)
#define __REG(x)	    (*((volatile unsigned long *)io_p2v(x)))

#define IRAM_PHYS       0x00000000 /* ARM Internal RAM (Data) */
#define IRAM_VIRT       0xe1400000
/*--- #define IRAM_SIZE       SZ_16K ---*/
#define IRAM_SIZE       SZ_1M
#define iram_p2v(pa)    (((pa) & (IRAM_SIZE-1)) + IRAM_VIRT + IRAM_PHYS)
#define iram_v2p(va)    (((va) & (IRAM_SIZE-1)) + IRAM_PHYS)
#define IRAM_ADDRESS(x) iram_p2v(x)

#define IO_PHYS_EMIF    0x02000000
#define IO_VIRT_EMIF    0xe2000000
#define EMIF_SIZE       SZ_32M
#define emif_p2v(pa)    (((pa) & (EMIF_SIZE-1)) + IO_VIRT_EMIF)
#define emif_v2p(va)    (((va) & (EMIF_SIZE-1)) + IO_PHYS_EMIF)
#define EMIF_ADDRESS(x) emif_p2v(x)

/*
 * We don't actually have real ISA nor PCI buses, but there is so many
 * drivers out there that might just work if we fake them...
 */
#define PCIO_BASE       0
#define __io(a)			((void __iomem *)(PCIO_BASE + (a)))
#define __mem_pci(a)	(a)
#define __mem_isa(a)	(a)

#endif /* __ASM_ARCH_IO_H */


