1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35#ifndef __MUSB_LINUX_PLATFORM_ARCH_H__
36#define __MUSB_LINUX_PLATFORM_ARCH_H__
37
38#ifndef __UBOOT__
39#include <linux/io.h>
40#else
41#include <asm/io.h>
42#endif
43
44#if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
45 && !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \
46 && !defined(CONFIG_PPC64) && !defined(CONFIG_BLACKFIN) \
47 && !defined(CONFIG_MIPS) && !defined(CONFIG_M68K)
48static inline void readsl(const void __iomem *addr, void *buf, int len)
49 { insl((unsigned long)addr, buf, len); }
50static inline void readsw(const void __iomem *addr, void *buf, int len)
51 { insw((unsigned long)addr, buf, len); }
52static inline void readsb(const void __iomem *addr, void *buf, int len)
53 { insb((unsigned long)addr, buf, len); }
54
55static inline void writesl(const void __iomem *addr, const void *buf, int len)
56 { outsl((unsigned long)addr, buf, len); }
57static inline void writesw(const void __iomem *addr, const void *buf, int len)
58 { outsw((unsigned long)addr, buf, len); }
59static inline void writesb(const void __iomem *addr, const void *buf, int len)
60 { outsb((unsigned long)addr, buf, len); }
61
62#endif
63
64#ifndef CONFIG_BLACKFIN
65
66
67
68static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
69 { return __raw_readw(addr + offset); }
70
71static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
72 { return __raw_readl(addr + offset); }
73
74
75static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
76 { __raw_writew(data, addr + offset); }
77
78static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
79 { __raw_writel(data, addr + offset); }
80
81
82#if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE)
83
84
85
86
87static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
88{
89 u16 tmp;
90 u8 val;
91
92 tmp = __raw_readw(addr + (offset & ~1));
93 if (offset & 1)
94 val = (tmp >> 8);
95 else
96 val = tmp & 0xff;
97
98 return val;
99}
100
101static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
102{
103 u16 tmp;
104
105 tmp = __raw_readw(addr + (offset & ~1));
106 if (offset & 1)
107 tmp = (data << 8) | (tmp & 0xff);
108 else
109 tmp = (tmp & 0xff00) | data;
110
111 __raw_writew(tmp, addr + (offset & ~1));
112}
113
114#else
115
116static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
117 { return __raw_readb(addr + offset); }
118
119static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
120 { __raw_writeb(data, addr + offset); }
121
122#endif
123
124#else
125
126static inline u8 musb_readb(const void __iomem *addr, unsigned offset)
127 { return (u8) (bfin_read16(addr + offset)); }
128
129static inline u16 musb_readw(const void __iomem *addr, unsigned offset)
130 { return bfin_read16(addr + offset); }
131
132static inline u32 musb_readl(const void __iomem *addr, unsigned offset)
133 { return (u32) (bfin_read16(addr + offset)); }
134
135static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data)
136 { bfin_write16(addr + offset, (u16) data); }
137
138static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data)
139 { bfin_write16(addr + offset, data); }
140
141static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data)
142 { bfin_write16(addr + offset, (u16) data); }
143
144#endif
145
146#endif
147