aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-frv/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-frv/io.h')
-rw-r--r--include/asm-frv/io.h123
1 files changed, 123 insertions, 0 deletions
diff --git a/include/asm-frv/io.h b/include/asm-frv/io.h
index 48829f727242..075369b1a34b 100644
--- a/include/asm-frv/io.h
+++ b/include/asm-frv/io.h
@@ -18,6 +18,7 @@
18#ifdef __KERNEL__ 18#ifdef __KERNEL__
19 19
20#include <linux/config.h> 20#include <linux/config.h>
21#include <linux/types.h>
21#include <asm/virtconvert.h> 22#include <asm/virtconvert.h>
22#include <asm/string.h> 23#include <asm/string.h>
23#include <asm/mb-regs.h> 24#include <asm/mb-regs.h>
@@ -104,6 +105,8 @@ static inline void __insl(unsigned long addr, void *buf, int len, int swap)
104 __insl_sw(addr, buf, len); 105 __insl_sw(addr, buf, len);
105} 106}
106 107
108#define mmiowb() mb()
109
107/* 110/*
108 * make the short names macros so specific devices 111 * make the short names macros so specific devices
109 * can override them as required 112 * can override them as required
@@ -209,6 +212,10 @@ static inline uint32_t readl(const volatile void __iomem *addr)
209 return ret; 212 return ret;
210} 213}
211 214
215#define readb_relaxed readb
216#define readw_relaxed readw
217#define readl_relaxed readl
218
212static inline void writeb(uint8_t datum, volatile void __iomem *addr) 219static inline void writeb(uint8_t datum, volatile void __iomem *addr)
213{ 220{
214 __builtin_write8((volatile uint8_t __force *) addr, datum); 221 __builtin_write8((volatile uint8_t __force *) addr, datum);
@@ -268,11 +275,106 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr, unsigned l
268 275
269extern void iounmap(void __iomem *addr); 276extern void iounmap(void __iomem *addr);
270 277
278static inline void __iomem *ioport_map(unsigned long port, unsigned int nr)
279{
280 return (void __iomem *) port;
281}
282
283static inline void ioport_unmap(void __iomem *p)
284{
285}
286
271static inline void flush_write_buffers(void) 287static inline void flush_write_buffers(void)
272{ 288{
273 __asm__ __volatile__ ("membar" : : :"memory"); 289 __asm__ __volatile__ ("membar" : : :"memory");
274} 290}
275 291
292/*
293 * do appropriate I/O accesses for token type
294 */
295static inline unsigned int ioread8(void __iomem *p)
296{
297 return __builtin_read8(p);
298}
299
300static inline unsigned int ioread16(void __iomem *p)
301{
302 uint16_t ret = __builtin_read16(p);
303 if (__is_PCI_addr(p))
304 ret = _swapw(ret);
305 return ret;
306}
307
308static inline unsigned int ioread32(void __iomem *p)
309{
310 uint32_t ret = __builtin_read32(p);
311 if (__is_PCI_addr(p))
312 ret = _swapl(ret);
313 return ret;
314}
315
316static inline void iowrite8(u8 val, void __iomem *p)
317{
318 __builtin_write8(p, val);
319 if (__is_PCI_MEM(p))
320 __flush_PCI_writes();
321}
322
323static inline void iowrite16(u16 val, void __iomem *p)
324{
325 if (__is_PCI_addr(p))
326 val = _swapw(val);
327 __builtin_write16(p, val);
328 if (__is_PCI_MEM(p))
329 __flush_PCI_writes();
330}
331
332static inline void iowrite32(u32 val, void __iomem *p)
333{
334 if (__is_PCI_addr(p))
335 val = _swapl(val);
336 __builtin_write32(p, val);
337 if (__is_PCI_MEM(p))
338 __flush_PCI_writes();
339}
340
341static inline void ioread8_rep(void __iomem *p, void *dst, unsigned long count)
342{
343 io_insb((unsigned long) p, dst, count);
344}
345
346static inline void ioread16_rep(void __iomem *p, void *dst, unsigned long count)
347{
348 io_insw((unsigned long) p, dst, count);
349}
350
351static inline void ioread32_rep(void __iomem *p, void *dst, unsigned long count)
352{
353 __insl_ns((unsigned long) p, dst, count);
354}
355
356static inline void iowrite8_rep(void __iomem *p, const void *src, unsigned long count)
357{
358 io_outsb((unsigned long) p, src, count);
359}
360
361static inline void iowrite16_rep(void __iomem *p, const void *src, unsigned long count)
362{
363 io_outsw((unsigned long) p, src, count);
364}
365
366static inline void iowrite32_rep(void __iomem *p, const void *src, unsigned long count)
367{
368 __outsl_ns((unsigned long) p, src, count);
369}
370
371/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
372struct pci_dev;
373extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
374static inline void pci_iounmap(struct pci_dev *dev, void __iomem *p)
375{
376}
377
276 378
277/* 379/*
278 * Convert a physical pointer to a virtual kernel pointer for /dev/mem 380 * Convert a physical pointer to a virtual kernel pointer for /dev/mem
@@ -285,6 +387,27 @@ static inline void flush_write_buffers(void)
285 */ 387 */
286#define xlate_dev_kmem_ptr(p) p 388#define xlate_dev_kmem_ptr(p) p
287 389
390/*
391 * Check BIOS signature
392 */
393static inline int check_signature(volatile void __iomem *io_addr,
394 const unsigned char *signature, int length)
395{
396 int retval = 0;
397
398 do {
399 if (readb(io_addr) != *signature)
400 goto out;
401 io_addr++;
402 signature++;
403 length--;
404 } while (length);
405
406 retval = 1;
407out:
408 return retval;
409}
410
288#endif /* __KERNEL__ */ 411#endif /* __KERNEL__ */
289 412
290#endif /* _ASM_IO_H */ 413#endif /* _ASM_IO_H */