GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sh / kernel / io_generic.c
bloba6a24dd1efff5e1a2fed4cd365191c5612bb9e38
1 /*
2 * arch/sh/kernel/io_generic.c
4 * Copyright (C) 2000 Niibe Yutaka
5 * Copyright (C) 2005 - 2007 Paul Mundt
7 * Generic I/O routine. These can be used where a machine specific version
8 * is not required.
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
14 #include <linux/module.h>
15 #include <linux/io.h>
16 #include <asm/machvec.h>
18 #ifdef CONFIG_CPU_SH3
19 /* I'm not sure SH7709 has this kind of bug */
20 #define dummy_read() __raw_readb(0xba000000)
21 #else
22 #define dummy_read()
23 #endif
25 unsigned long generic_io_base = 0;
27 u8 generic_inb(unsigned long port)
29 return __raw_readb(__ioport_map(port, 1));
32 u16 generic_inw(unsigned long port)
34 return __raw_readw(__ioport_map(port, 2));
37 u32 generic_inl(unsigned long port)
39 return __raw_readl(__ioport_map(port, 4));
42 u8 generic_inb_p(unsigned long port)
44 unsigned long v = generic_inb(port);
46 ctrl_delay();
47 return v;
50 u16 generic_inw_p(unsigned long port)
52 unsigned long v = generic_inw(port);
54 ctrl_delay();
55 return v;
58 u32 generic_inl_p(unsigned long port)
60 unsigned long v = generic_inl(port);
62 ctrl_delay();
63 return v;
67 * insb/w/l all read a series of bytes/words/longs from a fixed port
68 * address. However as the port address doesn't change we only need to
69 * convert the port address to real address once.
72 void generic_insb(unsigned long port, void *dst, unsigned long count)
74 __raw_readsb(__ioport_map(port, 1), dst, count);
75 dummy_read();
78 void generic_insw(unsigned long port, void *dst, unsigned long count)
80 __raw_readsw(__ioport_map(port, 2), dst, count);
81 dummy_read();
84 void generic_insl(unsigned long port, void *dst, unsigned long count)
86 __raw_readsl(__ioport_map(port, 4), dst, count);
87 dummy_read();
90 void generic_outb(u8 b, unsigned long port)
92 __raw_writeb(b, __ioport_map(port, 1));
95 void generic_outw(u16 b, unsigned long port)
97 __raw_writew(b, __ioport_map(port, 2));
100 void generic_outl(u32 b, unsigned long port)
102 __raw_writel(b, __ioport_map(port, 4));
105 void generic_outb_p(u8 b, unsigned long port)
107 generic_outb(b, port);
108 ctrl_delay();
111 void generic_outw_p(u16 b, unsigned long port)
113 generic_outw(b, port);
114 ctrl_delay();
117 void generic_outl_p(u32 b, unsigned long port)
119 generic_outl(b, port);
120 ctrl_delay();
124 * outsb/w/l all write a series of bytes/words/longs to a fixed port
125 * address. However as the port address doesn't change we only need to
126 * convert the port address to real address once.
128 void generic_outsb(unsigned long port, const void *src, unsigned long count)
130 __raw_writesb(__ioport_map(port, 1), src, count);
131 dummy_read();
134 void generic_outsw(unsigned long port, const void *src, unsigned long count)
136 __raw_writesw(__ioport_map(port, 2), src, count);
137 dummy_read();
140 void generic_outsl(unsigned long port, const void *src, unsigned long count)
142 __raw_writesl(__ioport_map(port, 4), src, count);
143 dummy_read();
146 void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
148 #ifdef P1SEG
149 if (PXSEG(addr) >= P1SEG)
150 return (void __iomem *)addr;
151 #endif
153 return (void __iomem *)(addr + generic_io_base);
156 void generic_ioport_unmap(void __iomem *addr)
160 #ifndef CONFIG_GENERIC_IOMAP
161 void __iomem *ioport_map(unsigned long port, unsigned int nr)
163 void __iomem *ret;
165 ret = __ioport_map_trapped(port, nr);
166 if (ret)
167 return ret;
169 return __ioport_map(port, nr);
171 EXPORT_SYMBOL(ioport_map);
173 void ioport_unmap(void __iomem *addr)
175 sh_mv.mv_ioport_unmap(addr);
177 EXPORT_SYMBOL(ioport_unmap);
178 #endif /* CONFIG_GENERIC_IOMAP */