aboutsummaryrefslogtreecommitdiffstats
path: root/arch/xtensa/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:11:46 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-09 03:11:46 -0400
commit1ea4f4f8405cc1ceec23f2d261bc3775785e6712 (patch)
treea43ced12b9acf357623088d479fa69f3f00d2997 /arch/xtensa/include
parentdea77ccdc93448d81e495a57bc1c1e97be4fdfe8 (diff)
parent70cefe765433529fc894fd1995a1d5883cb33e05 (diff)
Merge tag 'xtensa-next-20121008' of git://github.com/czankel/xtensa-linux
Pull Xtensa patchset from Chris Zankel: "The Xtensa tree has been broken for some time now, and this patchset brings it back to life. It has been part of the linux-next tree for some time. Most changes are inside the xtensa subdirectory; the other changes mostly add another rule to already existing #ifdefs to exclude Xtensa, where required. The only 'common' change is to add two more sections ('.xt.prop' and '.xt.lit') to the white list in modpost." * tag 'xtensa-next-20121008' of git://github.com/czankel/xtensa-linux: (27 commits) xtensa: Setup CROSS_COMPILE at the top xtensa: drop CONFIG_EMBEDDED_RAMDISK xtensa: fix TIOCGSERIAL and TIOCSSERIAL definitions xtensa: provide dummy gcc intrinsics xtensa: add missing symbol exports parport: disable for xtensa arch xtensa: rename MISC SR definition to avoid name clashes hisax: disable build for big-endian xtensa xtensa: fix CODA build xtensa: fix parallel make xtensa: ISS: drop unused io.c xtensa: ISS: exit simulator in case of halt or poweroff xtensa: ISS: change keyboard polling rate xtensa: ISS: add platform_pcibios_init xtensa: ISS: add dummy serial.h for ISS platform xtensa: change default platform clock frequency to 10MHz xtensa: add ARCH_WANT_OPTIONAL_GPIOLIB to xtensa config xtensa: set NO_IOPORT to 'n' by default xtensa: adopt generic io routines xtensa: fix ioremap ...
Diffstat (limited to 'arch/xtensa/include')
-rw-r--r--arch/xtensa/include/asm/io.h172
-rw-r--r--arch/xtensa/include/asm/ioctls.h4
-rw-r--r--arch/xtensa/include/asm/regs.h2
3 files changed, 24 insertions, 154 deletions
diff --git a/arch/xtensa/include/asm/io.h b/arch/xtensa/include/asm/io.h
index 4beb43c087d3..e6be5b9091c2 100644
--- a/arch/xtensa/include/asm/io.h
+++ b/arch/xtensa/include/asm/io.h
@@ -25,184 +25,54 @@
25#define XCHAL_KIO_SIZE 0x10000000 25#define XCHAL_KIO_SIZE 0x10000000
26 26
27#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x)) 27#define IOADDR(x) (XCHAL_KIO_BYPASS_VADDR + (x))
28#define IO_SPACE_LIMIT ~0
28 29
30#ifdef CONFIG_MMU
29/* 31/*
30 * swap functions to change byte order from little-endian to big-endian and 32 * Return the virtual address for the specified bus memory.
31 * vice versa.
32 */
33
34static inline unsigned short _swapw (unsigned short v)
35{
36 return (v << 8) | (v >> 8);
37}
38
39static inline unsigned int _swapl (unsigned int v)
40{
41 return (v << 24) | ((v & 0xff00) << 8) | ((v >> 8) & 0xff00) | (v >> 24);
42}
43
44/*
45 * Change virtual addresses to physical addresses and vv.
46 * These are trivial on the 1:1 Linux/Xtensa mapping
47 */
48
49static inline unsigned long virt_to_phys(volatile void * address)
50{
51 return __pa(address);
52}
53
54static inline void * phys_to_virt(unsigned long address)
55{
56 return __va(address);
57}
58
59/*
60 * virt_to_bus and bus_to_virt are deprecated.
61 */
62
63#define virt_to_bus(x) virt_to_phys(x)
64#define bus_to_virt(x) phys_to_virt(x)
65
66/*
67 * Return the virtual (cached) address for the specified bus memory.
68 * Note that we currently don't support any address outside the KIO segment. 33 * Note that we currently don't support any address outside the KIO segment.
69 */ 34 */
70 35static inline void __iomem *ioremap_nocache(unsigned long offset,
71static inline void *ioremap(unsigned long offset, unsigned long size) 36 unsigned long size)
72{ 37{
73#ifdef CONFIG_MMU
74 if (offset >= XCHAL_KIO_PADDR 38 if (offset >= XCHAL_KIO_PADDR
75 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 39 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
76 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR); 40 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_BYPASS_VADDR);
77 else 41 else
78 BUG(); 42 BUG();
79#else
80 return (void *)offset;
81#endif
82} 43}
83 44
84static inline void *ioremap_nocache(unsigned long offset, unsigned long size) 45static inline void __iomem *ioremap_cache(unsigned long offset,
46 unsigned long size)
85{ 47{
86#ifdef CONFIG_MMU
87 if (offset >= XCHAL_KIO_PADDR 48 if (offset >= XCHAL_KIO_PADDR
88 && offset < XCHAL_KIO_PADDR + XCHAL_KIO_SIZE) 49 && offset - XCHAL_KIO_PADDR < XCHAL_KIO_SIZE)
89 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR); 50 return (void*)(offset-XCHAL_KIO_PADDR+XCHAL_KIO_CACHED_VADDR);
90 else 51 else
91 BUG(); 52 BUG();
92#else
93 return (void *)offset;
94#endif
95}
96
97static inline void iounmap(void *addr)
98{
99} 53}
100 54
101/* 55#define ioremap_wc ioremap_nocache
102 * Generic I/O
103 */
104
105#define readb(addr) \
106 ({ unsigned char __v = (*(volatile unsigned char *)(addr)); __v; })
107#define readw(addr) \
108 ({ unsigned short __v = (*(volatile unsigned short *)(addr)); __v; })
109#define readl(addr) \
110 ({ unsigned int __v = (*(volatile unsigned int *)(addr)); __v; })
111#define writeb(b, addr) (void)((*(volatile unsigned char *)(addr)) = (b))
112#define writew(b, addr) (void)((*(volatile unsigned short *)(addr)) = (b))
113#define writel(b, addr) (void)((*(volatile unsigned int *)(addr)) = (b))
114 56
115static inline __u8 __raw_readb(const volatile void __iomem *addr) 57static inline void __iomem *ioremap(unsigned long offset, unsigned long size)
116{
117 return *(__force volatile __u8 *)(addr);
118}
119static inline __u16 __raw_readw(const volatile void __iomem *addr)
120{
121 return *(__force volatile __u16 *)(addr);
122}
123static inline __u32 __raw_readl(const volatile void __iomem *addr)
124{ 58{
125 return *(__force volatile __u32 *)(addr); 59 return ioremap_nocache(offset, size);
126} 60}
127static inline void __raw_writeb(__u8 b, volatile void __iomem *addr) 61
128{ 62static inline void iounmap(volatile void __iomem *addr)
129 *(__force volatile __u8 *)(addr) = b;
130}
131static inline void __raw_writew(__u16 b, volatile void __iomem *addr)
132{
133 *(__force volatile __u16 *)(addr) = b;
134}
135static inline void __raw_writel(__u32 b, volatile void __iomem *addr)
136{ 63{
137 *(__force volatile __u32 *)(addr) = b;
138} 64}
139 65#endif /* CONFIG_MMU */
140/* These are the definitions for the x86 IO instructions
141 * inb/inw/inl/outb/outw/outl, the "string" versions
142 * insb/insw/insl/outsb/outsw/outsl, and the "pausing" versions
143 * inb_p/inw_p/...
144 * The macros don't do byte-swapping.
145 */
146
147#define inb(port) readb((u8 *)((port)))
148#define outb(val, port) writeb((val),(u8 *)((unsigned long)(port)))
149#define inw(port) readw((u16 *)((port)))
150#define outw(val, port) writew((val),(u16 *)((unsigned long)(port)))
151#define inl(port) readl((u32 *)((port)))
152#define outl(val, port) writel((val),(u32 *)((unsigned long)(port)))
153
154#define inb_p(port) inb((port))
155#define outb_p(val, port) outb((val), (port))
156#define inw_p(port) inw((port))
157#define outw_p(val, port) outw((val), (port))
158#define inl_p(port) inl((port))
159#define outl_p(val, port) outl((val), (port))
160
161extern void insb (unsigned long port, void *dst, unsigned long count);
162extern void insw (unsigned long port, void *dst, unsigned long count);
163extern void insl (unsigned long port, void *dst, unsigned long count);
164extern void outsb (unsigned long port, const void *src, unsigned long count);
165extern void outsw (unsigned long port, const void *src, unsigned long count);
166extern void outsl (unsigned long port, const void *src, unsigned long count);
167
168#define IO_SPACE_LIMIT ~0
169
170#define memset_io(a,b,c) memset((void *)(a),(b),(c))
171#define memcpy_fromio(a,b,c) memcpy((a),(void *)(b),(c))
172#define memcpy_toio(a,b,c) memcpy((void *)(a),(b),(c))
173
174/* At this point the Xtensa doesn't provide byte swap instructions */
175
176#ifdef __XTENSA_EB__
177# define in_8(addr) (*(u8*)(addr))
178# define in_le16(addr) _swapw(*(u16*)(addr))
179# define in_le32(addr) _swapl(*(u32*)(addr))
180# define out_8(b, addr) *(u8*)(addr) = (b)
181# define out_le16(b, addr) *(u16*)(addr) = _swapw(b)
182# define out_le32(b, addr) *(u32*)(addr) = _swapl(b)
183#elif defined(__XTENSA_EL__)
184# define in_8(addr) (*(u8*)(addr))
185# define in_le16(addr) (*(u16*)(addr))
186# define in_le32(addr) (*(u32*)(addr))
187# define out_8(b, addr) *(u8*)(addr) = (b)
188# define out_le16(b, addr) *(u16*)(addr) = (b)
189# define out_le32(b, addr) *(u32*)(addr) = (b)
190#else
191# error processor byte order undefined!
192#endif
193
194
195/*
196 * Convert a physical pointer to a virtual kernel pointer for /dev/mem access
197 */
198#define xlate_dev_mem_ptr(p) __va(p)
199 66
200/* 67/*
201 * Convert a virtual cached pointer to an uncached pointer 68 * Generic I/O
202 */ 69 */
203#define xlate_dev_kmem_ptr(p) p 70#define readb_relaxed readb
204 71#define readw_relaxed readw
72#define readl_relaxed readl
205 73
206#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
207 75
76#include <asm-generic/io.h>
77
208#endif /* _XTENSA_IO_H */ 78#endif /* _XTENSA_IO_H */
diff --git a/arch/xtensa/include/asm/ioctls.h b/arch/xtensa/include/asm/ioctls.h
index fd1d1369a407..2aa4cd9f0cec 100644
--- a/arch/xtensa/include/asm/ioctls.h
+++ b/arch/xtensa/include/asm/ioctls.h
@@ -71,8 +71,8 @@
71#define TIOCSSOFTCAR _IOW('T', 26, unsigned int) 71#define TIOCSSOFTCAR _IOW('T', 26, unsigned int)
72#define TIOCLINUX _IOW('T', 28, char) 72#define TIOCLINUX _IOW('T', 28, char)
73#define TIOCCONS _IO('T', 29) 73#define TIOCCONS _IO('T', 29)
74#define TIOCGSERIAL _IOR('T', 30, struct serial_struct) 74#define TIOCGSERIAL 0x803C541E /*_IOR('T', 30, struct serial_struct)*/
75#define TIOCSSERIAL _IOW('T', 31, struct serial_struct) 75#define TIOCSSERIAL 0x403C541F /*_IOW('T', 31, struct serial_struct)*/
76#define TIOCPKT _IOW('T', 32, int) 76#define TIOCPKT _IOW('T', 32, int)
77# define TIOCPKT_DATA 0 77# define TIOCPKT_DATA 0
78# define TIOCPKT_FLUSHREAD 1 78# define TIOCPKT_FLUSHREAD 1
diff --git a/arch/xtensa/include/asm/regs.h b/arch/xtensa/include/asm/regs.h
index d4baed246928..a3075b12aff1 100644
--- a/arch/xtensa/include/asm/regs.h
+++ b/arch/xtensa/include/asm/regs.h
@@ -66,7 +66,7 @@
66#define ICOUNTLEVEL 237 66#define ICOUNTLEVEL 237
67#define EXCVADDR 238 67#define EXCVADDR 238
68#define CCOMPARE 240 68#define CCOMPARE 240
69#define MISC 244 69#define MISC_SR 244
70 70
71/* Special names for read-only and write-only interrupt registers. */ 71/* Special names for read-only and write-only interrupt registers. */
72 72