aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2014-11-24 14:05:00 -0500
committerFelipe Balbi <balbi@ti.com>2014-11-25 09:47:05 -0500
commit9d506fc6d2cdafdec5ce605036f5eeec9fd59657 (patch)
tree4df4e6b6490e784f6e4ed75cd3ec4c59d79c229a
parent5450ac88dcf09b258d0404b45316583806799ef4 (diff)
usb: musb: Populate new IO functions for tusb6010
Let's populate the new IO functions for tusb6010 but not use them yet. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
-rw-r--r--drivers/usb/musb/tusb6010.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c
index 69ca92d6032f..42e0cf9b170f 100644
--- a/drivers/usb/musb/tusb6010.c
+++ b/drivers/usb/musb/tusb6010.c
@@ -126,6 +126,41 @@ static void tusb_wbus_quirk(struct musb *musb, int enabled)
126 } 126 }
127} 127}
128 128
129static u32 tusb_fifo_offset(u8 epnum)
130{
131 return 0x200 + (epnum * 0x20);
132}
133
134/*
135 * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum.
136 */
137static u8 tusb_readb(const void __iomem *addr, unsigned offset)
138{
139 u16 tmp;
140 u8 val;
141
142 tmp = __raw_readw(addr + (offset & ~1));
143 if (offset & 1)
144 val = (tmp >> 8);
145 else
146 val = tmp & 0xff;
147
148 return val;
149}
150
151static void tusb_writeb(void __iomem *addr, unsigned offset, u8 data)
152{
153 u16 tmp;
154
155 tmp = __raw_readw(addr + (offset & ~1));
156 if (offset & 1)
157 tmp = (data << 8) | (tmp & 0xff);
158 else
159 tmp = (tmp & 0xff00) | data;
160
161 __raw_writew(tmp, addr + (offset & ~1));
162}
163
129/* 164/*
130 * TUSB 6010 may use a parallel bus that doesn't support byte ops; 165 * TUSB 6010 may use a parallel bus that doesn't support byte ops;
131 * so both loading and unloading FIFOs need explicit byte counts. 166 * so both loading and unloading FIFOs need explicit byte counts.
@@ -1135,9 +1170,15 @@ static int tusb_musb_exit(struct musb *musb)
1135} 1170}
1136 1171
1137static const struct musb_platform_ops tusb_ops = { 1172static const struct musb_platform_ops tusb_ops = {
1173 .quirks = MUSB_IN_TUSB,
1138 .init = tusb_musb_init, 1174 .init = tusb_musb_init,
1139 .exit = tusb_musb_exit, 1175 .exit = tusb_musb_exit,
1140 1176
1177 .fifo_offset = tusb_fifo_offset,
1178 .readb = tusb_readb,
1179 .writeb = tusb_writeb,
1180 .read_fifo = musb_read_fifo,
1181 .write_fifo = musb_write_fifo,
1141 .enable = tusb_musb_enable, 1182 .enable = tusb_musb_enable,
1142 .disable = tusb_musb_disable, 1183 .disable = tusb_musb_disable,
1143 1184