blob: c8d693361378754e72947ea1573bc87b0644ad0c [file] [log] [blame]
Wolfgang Denk7b64fef2006-10-24 14:21:16 +02001/*
2 * Copyright (C) 2006 Atmel Corporation
3 *
Wolfgang Denk1a459662013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Wolfgang Denk7b64fef2006-10-24 14:21:16 +02005 */
6#ifndef __ASM_AVR32_IO_H
7#define __ASM_AVR32_IO_H
8
Stefan Roesef2302d42008-08-06 14:05:38 +02009#include <asm/types.h>
10
Wolfgang Denk7b64fef2006-10-24 14:21:16 +020011#ifdef __KERNEL__
12
13/*
14 * Generic IO read/write. These perform native-endian accesses. Note
15 * that some architectures will want to re-define __raw_{read,write}w.
16 */
17extern void __raw_writesb(unsigned int addr, const void *data, int bytelen);
18extern void __raw_writesw(unsigned int addr, const void *data, int wordlen);
19extern void __raw_writesl(unsigned int addr, const void *data, int longlen);
20
21extern void __raw_readsb(unsigned int addr, void *data, int bytelen);
22extern void __raw_readsw(unsigned int addr, void *data, int wordlen);
23extern void __raw_readsl(unsigned int addr, void *data, int longlen);
24
25#define __raw_writeb(v,a) (*(volatile unsigned char *)(a) = (v))
26#define __raw_writew(v,a) (*(volatile unsigned short *)(a) = (v))
27#define __raw_writel(v,a) (*(volatile unsigned int *)(a) = (v))
28
29#define __raw_readb(a) (*(volatile unsigned char *)(a))
30#define __raw_readw(a) (*(volatile unsigned short *)(a))
31#define __raw_readl(a) (*(volatile unsigned int *)(a))
32
33/* As long as I/O is only performed in P4 (or possibly P3), we're safe */
34#define writeb(v,a) __raw_writeb(v,a)
35#define writew(v,a) __raw_writew(v,a)
36#define writel(v,a) __raw_writel(v,a)
37
38#define readb(a) __raw_readb(a)
39#define readw(a) __raw_readw(a)
40#define readl(a) __raw_readl(a)
41
42/*
43 * Bad read/write accesses...
44 */
45extern void __readwrite_bug(const char *fn);
46
47#define IO_SPACE_LIMIT 0xffffffff
48
49/*
50 * All I/O is memory mapped, so these macros doesn't make very much sense
51 */
52#define outb(v,p) __raw_writeb(v, p)
53#define outw(v,p) __raw_writew(cpu_to_le16(v),p)
54#define outl(v,p) __raw_writel(cpu_to_le32(v),p)
55
56#define inb(p) ({ unsigned int __v = __raw_readb(p); __v; })
57#define inw(p) ({ unsigned int __v = __le16_to_cpu(__raw_readw(p)); __v; })
58#define inl(p) ({ unsigned int __v = __le32_to_cpu(__raw_readl(p)); __v; })
59
Olav Morkena38de082009-01-23 12:56:28 +010060#include <asm/arch/addrspace.h>
61/* Provides virt_to_phys, phys_to_virt, cached, uncached, map_physmem */
Wolfgang Denk7b64fef2006-10-24 14:21:16 +020062
63#endif /* __KERNEL__ */
64
Haiying Wang3a197b22007-02-21 16:52:31 +010065static inline void sync(void)
66{
67}
68
Haavard Skinnemoen4d7d6932007-12-13 12:56:33 +010069/*
Haavard Skinnemoen4d7d6932007-12-13 12:56:33 +010070 * Take down a mapping set up by map_physmem().
71 */
72static inline void unmap_physmem(void *vaddr, unsigned long len)
73{
74
75}
76
Wolfgang Denk7b64fef2006-10-24 14:21:16 +020077#endif /* __ASM_AVR32_IO_H */