Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / drivers / memstick / host / tifm_ms.c
blob2f311491b434b58fb0f78c2ad2793586bd58157e
1 /*
2 * TI FlashMedia driver
4 * Copyright (C) 2007 Alex Dubov <oakad@yahoo.com>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
10 * Special thanks to Carlos Corbacho for providing various MemoryStick cards
11 * that made this driver possible.
15 #include <linux/tifm.h>
16 #include <linux/memstick.h>
17 #include <linux/highmem.h>
18 #include <linux/scatterlist.h>
19 #include <linux/log2.h>
20 #include <asm/io.h>
22 #define DRIVER_NAME "tifm_ms"
23 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
24 #define DRIVER_VERSION "0.1"
25 =======
26 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
28 static int no_dma;
29 module_param(no_dma, bool, 0644);
31 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
32 #define TIFM_MS_TIMEOUT 0x00100
33 #define TIFM_MS_BADCRC 0x00200
34 #define TIFM_MS_EOTPC 0x01000
35 #define TIFM_MS_INT 0x02000
37 /* The meaning of the bit majority in this constant is unknown. */
38 #define TIFM_MS_SERIAL 0x04010
39 =======
41 * Some control bits of TIFM appear to conform to Sony's reference design,
42 * so I'm just assuming they all are.
44 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
46 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
47 #define TIFM_MS_SYS_LATCH 0x00100
48 #define TIFM_MS_SYS_NOT_RDY 0x00800
49 #define TIFM_MS_SYS_DATA 0x10000
50 =======
51 #define TIFM_MS_STAT_DRQ 0x04000
52 #define TIFM_MS_STAT_MSINT 0x02000
53 #define TIFM_MS_STAT_RDY 0x01000
54 #define TIFM_MS_STAT_CRC 0x00200
55 #define TIFM_MS_STAT_TOE 0x00100
56 #define TIFM_MS_STAT_EMP 0x00020
57 #define TIFM_MS_STAT_FUL 0x00010
58 #define TIFM_MS_STAT_CED 0x00008
59 #define TIFM_MS_STAT_ERR 0x00004
60 #define TIFM_MS_STAT_BRQ 0x00002
61 #define TIFM_MS_STAT_CNK 0x00001
63 #define TIFM_MS_SYS_DMA 0x10000
64 #define TIFM_MS_SYS_RESET 0x08000
65 #define TIFM_MS_SYS_SRAC 0x04000
66 #define TIFM_MS_SYS_INTEN 0x02000
67 #define TIFM_MS_SYS_NOCRC 0x01000
68 #define TIFM_MS_SYS_INTCLR 0x00800
69 #define TIFM_MS_SYS_MSIEN 0x00400
70 #define TIFM_MS_SYS_FCLR 0x00200
71 #define TIFM_MS_SYS_FDIR 0x00100
72 #define TIFM_MS_SYS_DAM 0x00080
73 #define TIFM_MS_SYS_DRM 0x00040
74 #define TIFM_MS_SYS_DRQSL 0x00020
75 #define TIFM_MS_SYS_REI 0x00010
76 #define TIFM_MS_SYS_REO 0x00008
77 #define TIFM_MS_SYS_BSY_MASK 0x00007
79 #define TIFM_MS_SYS_FIFO (TIFM_MS_SYS_INTEN | TIFM_MS_SYS_MSIEN \
80 | TIFM_MS_SYS_FCLR | TIFM_MS_SYS_BSY_MASK)
81 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
83 /* Hardware flags */
84 enum {
85 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
86 CMD_READY = 0x0001,
87 FIFO_READY = 0x0002,
88 CARD_READY = 0x0004,
89 DATA_CARRY = 0x0008
90 =======
91 CMD_READY = 0x01,
92 FIFO_READY = 0x02,
93 CARD_INT = 0x04
94 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
97 struct tifm_ms {
98 struct tifm_dev *dev;
99 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
100 unsigned short eject:1,
101 no_dma:1;
102 unsigned short cmd_flags;
103 =======
104 struct timer_list timer;
105 struct memstick_request *req;
106 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
107 unsigned int mode_mask;
108 unsigned int block_pos;
109 unsigned long timeout_jiffies;
110 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
112 struct timer_list timer;
113 struct memstick_request *req;
114 =======
115 unsigned char eject:1,
116 use_dma:1;
117 unsigned char cmd_flags;
118 unsigned char io_pos;
119 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
120 unsigned int io_word;
123 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
124 static void tifm_ms_read_fifo(struct tifm_ms *host, unsigned int fifo_offset,
125 struct page *pg, unsigned int page_off,
126 unsigned int length)
127 =======
128 static unsigned int tifm_ms_read_data(struct tifm_ms *host,
129 unsigned char *buf, unsigned int length)
130 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
132 struct tifm_dev *sock = host->dev;
133 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
134 unsigned int cnt = 0, off = 0;
135 unsigned char *buf = kmap_atomic(pg, KM_BIO_DST_IRQ) + page_off;
136 =======
137 unsigned int off = 0;
139 while (host->io_pos && length) {
140 buf[off++] = host->io_word & 0xff;
141 host->io_word >>= 8;
142 length--;
143 host->io_pos--;
145 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
147 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
148 if (host->cmd_flags & DATA_CARRY) {
149 while ((fifo_offset & 3) && length) {
150 =======
151 if (!length)
152 return off;
154 while (!(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) {
155 if (length < 4)
156 break;
157 *(unsigned int *)(buf + off) = __raw_readl(sock->addr
158 + SOCK_MS_DATA);
159 length -= 4;
160 off += 4;
163 if (length
164 && !(TIFM_MS_STAT_EMP & readl(sock->addr + SOCK_MS_STATUS))) {
165 host->io_word = readl(sock->addr + SOCK_MS_DATA);
166 for (host->io_pos = 4; host->io_pos; --host->io_pos) {
167 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
168 buf[off++] = host->io_word & 0xff;
169 host->io_word >>= 8;
170 length--;
171 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
172 fifo_offset++;
173 =======
174 if (!length)
175 break;
176 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
178 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
179 if (!(fifo_offset & 3))
180 host->cmd_flags &= ~DATA_CARRY;
181 if (!length)
182 return;
183 =======
184 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
187 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
188 do {
189 host->io_word = readl(sock->addr + SOCK_FIFO_ACCESS
190 + fifo_offset);
191 cnt = 4;
192 while (length && cnt) {
193 buf[off++] = (host->io_word >> 8) & 0xff;
194 cnt--;
195 length--;
197 fifo_offset += 4 - cnt;
198 } while (length);
200 if (cnt)
201 host->cmd_flags |= DATA_CARRY;
203 kunmap_atomic(buf - page_off, KM_BIO_DST_IRQ);
204 =======
205 return off;
206 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
209 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
210 static void tifm_ms_write_fifo(struct tifm_ms *host, unsigned int fifo_offset,
211 struct page *pg, unsigned int page_off,
212 unsigned int length)
213 =======
214 static unsigned int tifm_ms_write_data(struct tifm_ms *host,
215 unsigned char *buf, unsigned int length)
216 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
218 struct tifm_dev *sock = host->dev;
219 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
220 unsigned int cnt = 0, off = 0;
221 unsigned char *buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + page_off;
222 =======
223 unsigned int off = 0;
224 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
226 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
227 if (host->cmd_flags & DATA_CARRY) {
228 while (fifo_offset & 3) {
229 host->io_word |= buf[off++] << (8 * (fifo_offset & 3));
230 =======
231 if (host->io_pos) {
232 while (host->io_pos < 4 && length) {
233 host->io_word |= buf[off++] << (host->io_pos * 8);
234 host->io_pos++;
235 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
236 length--;
237 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
238 fifo_offset++;
239 =======
240 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
242 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
243 if (!(fifo_offset & 3)) {
244 writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS
245 + fifo_offset - 4);
247 host->cmd_flags &= ~DATA_CARRY;
249 if (!length)
250 return;
251 =======
252 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
255 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
256 do {
257 cnt = 4;
258 =======
259 if (host->io_pos == 4
260 && !(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) {
261 writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM),
262 sock->addr + SOCK_MS_SYSTEM);
263 writel(host->io_word, sock->addr + SOCK_MS_DATA);
264 host->io_pos = 0;
265 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
266 host->io_word = 0;
267 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
268 while (length && cnt) {
269 host->io_word |= buf[off++] << (4 - cnt);
270 cnt--;
271 length--;
273 fifo_offset += 4 - cnt;
274 if (!cnt)
275 writel(host->io_word, sock->addr + SOCK_FIFO_ACCESS
276 + fifo_offset - 4);
278 } while (length);
280 if (cnt)
281 host->cmd_flags |= DATA_CARRY;
282 =======
283 } else if (host->io_pos) {
284 return off;
286 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
288 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
289 kunmap_atomic(buf - page_off, KM_BIO_SRC_IRQ);
291 =======
292 if (!length)
293 return off;
294 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
296 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
297 static void tifm_ms_move_block(struct tifm_ms *host, unsigned int length)
299 unsigned int t_size;
300 unsigned int off = host->req->sg.offset + host->block_pos;
301 unsigned int p_off, p_cnt;
302 struct page *pg;
303 unsigned long flags;
304 =======
305 while (!(TIFM_MS_STAT_FUL & readl(sock->addr + SOCK_MS_STATUS))) {
306 if (length < 4)
307 break;
308 writel(TIFM_MS_SYS_FDIR | readl(sock->addr + SOCK_MS_SYSTEM),
309 sock->addr + SOCK_MS_SYSTEM);
310 __raw_writel(*(unsigned int *)(buf + off),
311 sock->addr + SOCK_MS_DATA);
312 length -= 4;
313 off += 4;
315 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
317 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
318 dev_dbg(&host->dev->dev, "moving block\n");
319 local_irq_save(flags);
320 t_size = length;
321 while (t_size) {
322 pg = nth_page(sg_page(&host->req->sg), off >> PAGE_SHIFT);
323 p_off = offset_in_page(off);
324 p_cnt = PAGE_SIZE - p_off;
325 p_cnt = min(p_cnt, t_size);
326 =======
327 switch (length) {
328 case 3:
329 host->io_word |= buf[off + 2] << 16;
330 host->io_pos++;
331 case 2:
332 host->io_word |= buf[off + 1] << 8;
333 host->io_pos++;
334 case 1:
335 host->io_word |= buf[off];
336 host->io_pos++;
338 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
340 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
341 if (host->req->data_dir == WRITE)
342 tifm_ms_write_fifo(host, length - t_size,
343 pg, p_off, p_cnt);
344 else
345 tifm_ms_read_fifo(host, length - t_size,
346 pg, p_off, p_cnt);
347 =======
348 off += host->io_pos;
349 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
351 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
352 t_size -= p_cnt;
354 local_irq_restore(flags);
355 =======
356 return off;
357 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
360 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
361 static int tifm_ms_transfer_data(struct tifm_ms *host, int skip)
362 =======
363 static unsigned int tifm_ms_transfer_data(struct tifm_ms *host)
364 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
366 struct tifm_dev *sock = host->dev;
367 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
368 unsigned int length = host->req->sg.length - host->block_pos;
369 =======
370 unsigned int length;
371 unsigned int off;
372 unsigned int t_size, p_off, p_cnt;
373 unsigned char *buf;
374 struct page *pg;
375 unsigned long flags = 0;
377 if (host->req->long_data) {
378 length = host->req->sg.length - host->block_pos;
379 off = host->req->sg.offset + host->block_pos;
380 } else {
381 length = host->req->data_len - host->block_pos;
382 off = 0;
384 dev_dbg(&sock->dev, "fifo data transfer, %d, %d\n", length,
385 host->block_pos);
387 while (length) {
388 if (host->req->long_data) {
389 pg = nth_page(sg_page(&host->req->sg),
390 off >> PAGE_SHIFT);
391 p_off = offset_in_page(off);
392 p_cnt = PAGE_SIZE - p_off;
393 p_cnt = min(p_cnt, length);
395 local_irq_save(flags);
396 buf = kmap_atomic(pg, KM_BIO_SRC_IRQ) + p_off;
397 } else {
398 buf = host->req->data + host->block_pos;
399 p_cnt = host->req->data_len - host->block_pos;
401 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
403 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
404 if (!length)
405 return 1;
406 =======
407 t_size = host->req->data_dir == WRITE
408 ? tifm_ms_write_data(host, buf, p_cnt)
409 : tifm_ms_read_data(host, buf, p_cnt);
410 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
412 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
413 if (length > TIFM_FIFO_SIZE)
414 length = TIFM_FIFO_SIZE;
415 =======
416 if (host->req->long_data) {
417 kunmap_atomic(buf - p_off, KM_BIO_SRC_IRQ);
418 local_irq_restore(flags);
420 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
422 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
423 if (!skip) {
424 tifm_ms_move_block(host, length);
425 host->block_pos += length;
426 =======
427 if (!t_size)
428 break;
429 host->block_pos += t_size;
430 length -= t_size;
431 off += t_size;
432 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
435 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
436 if ((host->req->data_dir == READ)
437 && (host->block_pos == host->req->sg.length))
438 return 1;
440 writel(ilog2(length) - 2, sock->addr + SOCK_FIFO_PAGE_SIZE);
441 if (host->req->data_dir == WRITE)
442 writel((1 << 8) | TIFM_DMA_TX, sock->addr + SOCK_DMA_CONTROL);
443 else
444 writel((1 << 8), sock->addr + SOCK_DMA_CONTROL);
445 =======
446 dev_dbg(&sock->dev, "fifo data transfer, %d remaining\n", length);
447 if (!length && (host->req->data_dir == WRITE)) {
448 if (host->io_pos) {
449 writel(TIFM_MS_SYS_FDIR
450 | readl(sock->addr + SOCK_MS_SYSTEM),
451 sock->addr + SOCK_MS_SYSTEM);
452 writel(host->io_word, sock->addr + SOCK_MS_DATA);
454 writel(TIFM_MS_SYS_FDIR
455 | readl(sock->addr + SOCK_MS_SYSTEM),
456 sock->addr + SOCK_MS_SYSTEM);
457 writel(0, sock->addr + SOCK_MS_DATA);
458 } else {
459 readl(sock->addr + SOCK_MS_DATA);
461 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
463 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
464 return 0;
465 =======
466 return length;
467 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
470 static int tifm_ms_issue_cmd(struct tifm_ms *host)
472 struct tifm_dev *sock = host->dev;
473 unsigned char *data;
474 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
475 unsigned int data_len = 0, cmd = 0, cmd_mask = 0, cnt, tval = 0;
476 =======
477 unsigned int data_len, cmd, sys_param;
478 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
480 host->cmd_flags = 0;
481 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
482 =======
483 host->block_pos = 0;
484 host->io_pos = 0;
485 host->io_word = 0;
486 host->cmd_flags = 0;
487 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
489 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
490 if (host->req->io_type == MEMSTICK_IO_SG) {
491 if (!host->no_dma) {
492 if (1 != tifm_map_sg(sock, &host->req->sg, 1,
493 host->req->data_dir == READ
494 ? PCI_DMA_FROMDEVICE
495 : PCI_DMA_TODEVICE)) {
496 host->req->error = -ENOMEM;
497 return host->req->error;
499 data_len = sg_dma_len(&host->req->sg);
500 } else
501 data_len = host->req->sg.length;
503 writel(TIFM_FIFO_INT_SETALL,
504 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
505 writel(TIFM_FIFO_ENABLE,
506 sock->addr + SOCK_FIFO_CONTROL);
507 writel(TIFM_FIFO_INTMASK,
508 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
509 =======
510 data = host->req->data;
511 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
513 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
514 if (!host->no_dma) {
515 writel(ilog2(data_len) - 2,
516 sock->addr + SOCK_FIFO_PAGE_SIZE);
517 writel(sg_dma_address(&host->req->sg),
518 sock->addr + SOCK_DMA_ADDRESS);
519 if (host->req->data_dir == WRITE)
520 writel((1 << 8) | TIFM_DMA_TX | TIFM_DMA_EN,
521 sock->addr + SOCK_DMA_CONTROL);
522 else
523 writel((1 << 8) | TIFM_DMA_EN,
524 sock->addr + SOCK_DMA_CONTROL);
525 } else {
526 tifm_ms_transfer_data(host,
527 host->req->data_dir == READ);
529 =======
530 host->use_dma = !no_dma;
531 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
533 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
534 cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM);
535 cmd_mask |= TIFM_MS_SYS_DATA | TIFM_MS_SYS_NOT_RDY;
536 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
537 } else if (host->req->io_type == MEMSTICK_IO_VAL) {
538 data = host->req->data;
539 =======
540 if (host->req->long_data) {
541 data_len = host->req->sg.length;
542 if (!is_power_of_2(data_len))
543 host->use_dma = 0;
544 } else {
545 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
546 data_len = host->req->data_len;
547 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
548 =======
549 host->use_dma = 0;
551 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
553 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
554 cmd_mask = host->mode_mask | 0x2607; /* unknown constant */
556 if (host->req->data_dir == WRITE) {
557 cmd_mask |= TIFM_MS_SYS_LATCH;
558 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
559 for (cnt = 0; (data_len - cnt) >= 4; cnt += 4) {
560 writel(TIFM_MS_SYS_LATCH
561 | readl(sock->addr + SOCK_MS_SYSTEM),
562 sock->addr + SOCK_MS_SYSTEM);
563 __raw_writel(*(unsigned int *)(data + cnt),
564 sock->addr + SOCK_MS_DATA);
565 dev_dbg(&sock->dev, "writing %x\n",
566 *(int *)(data + cnt));
568 switch (data_len - cnt) {
569 case 3:
570 tval |= data[cnt + 2] << 16;
571 case 2:
572 tval |= data[cnt + 1] << 8;
573 case 1:
574 tval |= data[cnt];
575 writel(TIFM_MS_SYS_LATCH
576 | readl(sock->addr + SOCK_MS_SYSTEM),
577 sock->addr + SOCK_MS_SYSTEM);
578 writel(tval, sock->addr + SOCK_MS_DATA);
579 dev_dbg(&sock->dev, "writing %x\n", tval);
581 =======
582 writel(TIFM_FIFO_INT_SETALL,
583 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
584 writel(TIFM_FIFO_ENABLE,
585 sock->addr + SOCK_FIFO_CONTROL);
587 if (host->use_dma) {
588 if (1 != tifm_map_sg(sock, &host->req->sg, 1,
589 host->req->data_dir == READ
590 ? PCI_DMA_FROMDEVICE
591 : PCI_DMA_TODEVICE)) {
592 host->req->error = -ENOMEM;
593 return host->req->error;
595 data_len = sg_dma_len(&host->req->sg);
596 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
598 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
599 writel(TIFM_MS_SYS_LATCH
600 | readl(sock->addr + SOCK_MS_SYSTEM),
601 sock->addr + SOCK_MS_SYSTEM);
602 writel(0, sock->addr + SOCK_MS_DATA);
603 dev_dbg(&sock->dev, "writing %x\n", 0);
604 =======
605 writel(ilog2(data_len) - 2,
606 sock->addr + SOCK_FIFO_PAGE_SIZE);
607 writel(TIFM_FIFO_INTMASK,
608 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
609 sys_param = TIFM_DMA_EN | (1 << 8);
610 if (host->req->data_dir == WRITE)
611 sys_param |= TIFM_DMA_TX;
613 writel(TIFM_FIFO_INTMASK,
614 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
615 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
617 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
618 } else
619 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
620 =======
621 writel(sg_dma_address(&host->req->sg),
622 sock->addr + SOCK_DMA_ADDRESS);
623 writel(sys_param, sock->addr + SOCK_DMA_CONTROL);
624 } else {
625 writel(host->mode_mask | TIFM_MS_SYS_FIFO,
626 sock->addr + SOCK_MS_SYSTEM);
627 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
629 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
630 cmd_mask = readl(sock->addr + SOCK_MS_SYSTEM);
631 cmd_mask &= ~TIFM_MS_SYS_DATA;
632 cmd_mask |= TIFM_MS_SYS_NOT_RDY;
633 dev_dbg(&sock->dev, "mask %x\n", cmd_mask);
634 writel(cmd_mask, sock->addr + SOCK_MS_SYSTEM);
635 } else
636 BUG();
637 =======
638 writel(TIFM_FIFO_MORE,
639 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_SET);
641 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
643 mod_timer(&host->timer, jiffies + host->timeout_jiffies);
644 writel(TIFM_CTRL_LED | readl(sock->addr + SOCK_CONTROL),
645 sock->addr + SOCK_CONTROL);
646 host->req->error = 0;
648 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
649 =======
650 sys_param = readl(sock->addr + SOCK_MS_SYSTEM);
651 sys_param |= TIFM_MS_SYS_INTCLR;
653 if (host->use_dma)
654 sys_param |= TIFM_MS_SYS_DMA;
655 else
656 sys_param &= ~TIFM_MS_SYS_DMA;
658 writel(sys_param, sock->addr + SOCK_MS_SYSTEM);
660 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
661 cmd = (host->req->tpc & 0xf) << 12;
662 cmd |= data_len;
663 writel(cmd, sock->addr + SOCK_MS_COMMAND);
665 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
666 dev_dbg(&sock->dev, "executing TPC %x, %x\n", cmd, cmd_mask);
667 =======
668 dev_dbg(&sock->dev, "executing TPC %x, %x\n", cmd, sys_param);
669 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
670 return 0;
673 static void tifm_ms_complete_cmd(struct tifm_ms *host)
675 struct tifm_dev *sock = host->dev;
676 struct memstick_host *msh = tifm_get_drvdata(sock);
677 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
678 unsigned int tval = 0, data_len;
679 unsigned char *data;
680 =======
681 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
682 int rc;
684 del_timer(&host->timer);
685 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
686 if (host->req->io_type == MEMSTICK_IO_SG) {
687 if (!host->no_dma)
688 tifm_unmap_sg(sock, &host->req->sg, 1,
689 host->req->data_dir == READ
690 ? PCI_DMA_FROMDEVICE
691 : PCI_DMA_TODEVICE);
692 } else if (host->req->io_type == MEMSTICK_IO_VAL) {
693 writel(~TIFM_MS_SYS_DATA & readl(sock->addr + SOCK_MS_SYSTEM),
694 sock->addr + SOCK_MS_SYSTEM);
696 data = host->req->data;
697 data_len = host->req->data_len;
698 =======
699 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
701 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
702 if (host->req->data_dir == READ) {
703 for (rc = 0; (data_len - rc) >= 4; rc += 4)
704 *(int *)(data + rc)
705 = __raw_readl(sock->addr
706 + SOCK_MS_DATA);
708 if (data_len - rc)
709 tval = readl(sock->addr + SOCK_MS_DATA);
710 switch (data_len - rc) {
711 case 3:
712 data[rc + 2] = (tval >> 16) & 0xff;
713 case 2:
714 data[rc + 1] = (tval >> 8) & 0xff;
715 case 1:
716 data[rc] = tval & 0xff;
718 readl(sock->addr + SOCK_MS_DATA);
721 =======
722 if (host->use_dma)
723 tifm_unmap_sg(sock, &host->req->sg, 1,
724 host->req->data_dir == READ
725 ? PCI_DMA_FROMDEVICE
726 : PCI_DMA_TODEVICE);
727 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
729 writel((~TIFM_CTRL_LED) & readl(sock->addr + SOCK_CONTROL),
730 sock->addr + SOCK_CONTROL);
732 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
733 =======
734 dev_dbg(&sock->dev, "TPC complete\n");
735 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
736 do {
737 rc = memstick_next_req(msh, &host->req);
738 } while (!rc && tifm_ms_issue_cmd(host));
741 static int tifm_ms_check_status(struct tifm_ms *host)
743 if (!host->req->error) {
744 if (!(host->cmd_flags & CMD_READY))
745 return 1;
746 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
747 if ((host->req->io_type == MEMSTICK_IO_SG)
748 && !(host->cmd_flags & FIFO_READY))
749 =======
750 if (!(host->cmd_flags & FIFO_READY))
751 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
752 return 1;
753 if (host->req->need_card_int
754 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
755 && !(host->cmd_flags & CARD_READY))
756 =======
757 && !(host->cmd_flags & CARD_INT))
758 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
759 return 1;
761 return 0;
764 /* Called from interrupt handler */
765 static void tifm_ms_data_event(struct tifm_dev *sock)
767 struct tifm_ms *host;
768 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
769 unsigned int fifo_status = 0;
770 =======
771 unsigned int fifo_status = 0, host_status = 0;
772 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
773 int rc = 1;
775 spin_lock(&sock->lock);
776 host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock));
777 fifo_status = readl(sock->addr + SOCK_DMA_FIFO_STATUS);
778 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
779 dev_dbg(&sock->dev, "data event: fifo_status %x, flags %x\n",
780 fifo_status, host->cmd_flags);
781 =======
782 host_status = readl(sock->addr + SOCK_MS_STATUS);
783 dev_dbg(&sock->dev,
784 "data event: fifo_status %x, host_status %x, flags %x\n",
785 fifo_status, host_status, host->cmd_flags);
786 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
788 if (host->req) {
789 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
790 if (fifo_status & TIFM_FIFO_READY) {
791 if (!host->no_dma || tifm_ms_transfer_data(host, 0)) {
792 =======
793 if (host->use_dma && (fifo_status & 1)) {
794 host->cmd_flags |= FIFO_READY;
795 rc = tifm_ms_check_status(host);
797 if (!host->use_dma && (fifo_status & TIFM_FIFO_MORE)) {
798 if (!tifm_ms_transfer_data(host)) {
799 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
800 host->cmd_flags |= FIFO_READY;
801 rc = tifm_ms_check_status(host);
806 writel(fifo_status, sock->addr + SOCK_DMA_FIFO_STATUS);
807 if (!rc)
808 tifm_ms_complete_cmd(host);
810 spin_unlock(&sock->lock);
814 /* Called from interrupt handler */
815 static void tifm_ms_card_event(struct tifm_dev *sock)
817 struct tifm_ms *host;
818 unsigned int host_status = 0;
819 int rc = 1;
821 spin_lock(&sock->lock);
822 host = memstick_priv((struct memstick_host *)tifm_get_drvdata(sock));
823 host_status = readl(sock->addr + SOCK_MS_STATUS);
824 dev_dbg(&sock->dev, "host event: host_status %x, flags %x\n",
825 host_status, host->cmd_flags);
827 if (host->req) {
828 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
829 if (host_status & TIFM_MS_TIMEOUT)
830 =======
831 if (host_status & TIFM_MS_STAT_TOE)
832 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
833 host->req->error = -ETIME;
834 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
835 else if (host_status & TIFM_MS_BADCRC)
836 =======
837 else if (host_status & TIFM_MS_STAT_CRC)
838 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
839 host->req->error = -EILSEQ;
841 if (host->req->error) {
842 writel(TIFM_FIFO_INT_SETALL,
843 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
844 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
847 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
848 if (host_status & TIFM_MS_EOTPC)
849 =======
850 if (host_status & TIFM_MS_STAT_RDY)
851 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
852 host->cmd_flags |= CMD_READY;
853 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
854 if (host_status & TIFM_MS_INT)
855 host->cmd_flags |= CARD_READY;
856 =======
858 if (host_status & TIFM_MS_STAT_MSINT)
859 host->cmd_flags |= CARD_INT;
860 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
862 rc = tifm_ms_check_status(host);
866 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
867 writel(TIFM_MS_SYS_NOT_RDY | readl(sock->addr + SOCK_MS_SYSTEM),
868 sock->addr + SOCK_MS_SYSTEM);
869 writel((~TIFM_MS_SYS_DATA) & readl(sock->addr + SOCK_MS_SYSTEM),
870 =======
871 writel(TIFM_MS_SYS_INTCLR | readl(sock->addr + SOCK_MS_SYSTEM),
872 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
873 sock->addr + SOCK_MS_SYSTEM);
875 if (!rc)
876 tifm_ms_complete_cmd(host);
878 spin_unlock(&sock->lock);
879 return;
882 static void tifm_ms_request(struct memstick_host *msh)
884 struct tifm_ms *host = memstick_priv(msh);
885 struct tifm_dev *sock = host->dev;
886 unsigned long flags;
887 int rc;
889 spin_lock_irqsave(&sock->lock, flags);
890 if (host->req) {
891 printk(KERN_ERR "%s : unfinished request detected\n",
892 sock->dev.bus_id);
893 spin_unlock_irqrestore(&sock->lock, flags);
894 tifm_eject(host->dev);
895 return;
898 if (host->eject) {
899 do {
900 rc = memstick_next_req(msh, &host->req);
901 if (!rc)
902 host->req->error = -ETIME;
903 } while (!rc);
904 spin_unlock_irqrestore(&sock->lock, flags);
905 return;
908 do {
909 rc = memstick_next_req(msh, &host->req);
910 } while (!rc && tifm_ms_issue_cmd(host));
912 spin_unlock_irqrestore(&sock->lock, flags);
913 return;
916 static void tifm_ms_set_param(struct memstick_host *msh,
917 enum memstick_param param,
918 int value)
920 struct tifm_ms *host = memstick_priv(msh);
921 struct tifm_dev *sock = host->dev;
922 unsigned long flags;
924 spin_lock_irqsave(&sock->lock, flags);
926 switch (param) {
927 case MEMSTICK_POWER:
928 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
929 /* this is set by card detection mechanism */
930 =======
931 /* also affected by media detection mechanism */
932 if (value == MEMSTICK_POWER_ON) {
933 host->mode_mask = TIFM_MS_SYS_SRAC | TIFM_MS_SYS_REI;
934 writel(TIFM_MS_SYS_RESET, sock->addr + SOCK_MS_SYSTEM);
935 writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR,
936 sock->addr + SOCK_MS_SYSTEM);
937 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
938 } else if (value == MEMSTICK_POWER_OFF) {
939 writel(TIFM_MS_SYS_FCLR | TIFM_MS_SYS_INTCLR,
940 sock->addr + SOCK_MS_SYSTEM);
941 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
943 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
944 break;
945 case MEMSTICK_INTERFACE:
946 if (value == MEMSTICK_SERIAL) {
947 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
948 host->mode_mask = TIFM_MS_SERIAL;
949 =======
950 host->mode_mask = TIFM_MS_SYS_SRAC | TIFM_MS_SYS_REI;
951 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
952 writel((~TIFM_CTRL_FAST_CLK)
953 & readl(sock->addr + SOCK_CONTROL),
954 sock->addr + SOCK_CONTROL);
955 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
956 } else if (value == MEMSTICK_PARALLEL) {
957 =======
958 } else if (value == MEMSTICK_PAR4) {
959 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
960 host->mode_mask = 0;
961 writel(TIFM_CTRL_FAST_CLK
962 | readl(sock->addr + SOCK_CONTROL),
963 sock->addr + SOCK_CONTROL);
965 break;
968 spin_unlock_irqrestore(&sock->lock, flags);
971 static void tifm_ms_abort(unsigned long data)
973 struct tifm_ms *host = (struct tifm_ms *)data;
975 dev_dbg(&host->dev->dev, "status %x\n",
976 readl(host->dev->addr + SOCK_MS_STATUS));
977 printk(KERN_ERR
978 "%s : card failed to respond for a long period of time "
979 "(%x, %x)\n",
980 host->dev->dev.bus_id, host->req ? host->req->tpc : 0,
981 host->cmd_flags);
983 tifm_eject(host->dev);
986 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
987 static int tifm_ms_initialize_host(struct tifm_ms *host)
989 struct tifm_dev *sock = host->dev;
990 struct memstick_host *msh = tifm_get_drvdata(sock);
992 host->mode_mask = TIFM_MS_SERIAL;
993 writel(0x8000, sock->addr + SOCK_MS_SYSTEM);
994 writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM);
995 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
996 if (tifm_has_ms_pif(sock))
997 msh->caps |= MEMSTICK_CAP_PARALLEL;
999 return 0;
1002 =======
1003 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1004 static int tifm_ms_probe(struct tifm_dev *sock)
1006 struct memstick_host *msh;
1007 struct tifm_ms *host;
1008 int rc = -EIO;
1010 if (!(TIFM_SOCK_STATE_OCCUPIED
1011 & readl(sock->addr + SOCK_PRESENT_STATE))) {
1012 printk(KERN_WARNING "%s : card gone, unexpectedly\n",
1013 sock->dev.bus_id);
1014 return rc;
1017 msh = memstick_alloc_host(sizeof(struct tifm_ms), &sock->dev);
1018 if (!msh)
1019 return -ENOMEM;
1021 host = memstick_priv(msh);
1022 tifm_set_drvdata(sock, msh);
1023 host->dev = sock;
1024 host->timeout_jiffies = msecs_to_jiffies(1000);
1025 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1026 host->no_dma = no_dma;
1027 =======
1028 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1030 setup_timer(&host->timer, tifm_ms_abort, (unsigned long)host);
1032 msh->request = tifm_ms_request;
1033 msh->set_param = tifm_ms_set_param;
1034 sock->card_event = tifm_ms_card_event;
1035 sock->data_event = tifm_ms_data_event;
1036 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1037 rc = tifm_ms_initialize_host(host);
1038 =======
1039 if (tifm_has_ms_pif(sock))
1040 msh->caps |= MEMSTICK_CAP_PAR4;
1041 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1043 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1044 if (!rc)
1045 rc = memstick_add_host(msh);
1046 =======
1047 rc = memstick_add_host(msh);
1048 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1049 if (!rc)
1050 return 0;
1052 memstick_free_host(msh);
1053 return rc;
1056 static void tifm_ms_remove(struct tifm_dev *sock)
1058 struct memstick_host *msh = tifm_get_drvdata(sock);
1059 struct tifm_ms *host = memstick_priv(msh);
1060 int rc = 0;
1061 unsigned long flags;
1063 spin_lock_irqsave(&sock->lock, flags);
1064 host->eject = 1;
1065 if (host->req) {
1066 del_timer(&host->timer);
1067 writel(TIFM_FIFO_INT_SETALL,
1068 sock->addr + SOCK_DMA_FIFO_INT_ENABLE_CLEAR);
1069 writel(TIFM_DMA_RESET, sock->addr + SOCK_DMA_CONTROL);
1070 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1071 if ((host->req->io_type == MEMSTICK_IO_SG) && !host->no_dma)
1072 =======
1073 if (host->use_dma)
1074 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1075 tifm_unmap_sg(sock, &host->req->sg, 1,
1076 host->req->data_dir == READ
1077 ? PCI_DMA_TODEVICE
1078 : PCI_DMA_FROMDEVICE);
1079 host->req->error = -ETIME;
1081 do {
1082 rc = memstick_next_req(msh, &host->req);
1083 if (!rc)
1084 host->req->error = -ETIME;
1085 } while (!rc);
1087 spin_unlock_irqrestore(&sock->lock, flags);
1089 memstick_remove_host(msh);
1090 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1092 writel(0x0200 | TIFM_MS_SYS_NOT_RDY, sock->addr + SOCK_MS_SYSTEM);
1093 writel(0xffffffff, sock->addr + SOCK_MS_STATUS);
1095 =======
1096 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1097 memstick_free_host(msh);
1100 #ifdef CONFIG_PM
1102 static int tifm_ms_suspend(struct tifm_dev *sock, pm_message_t state)
1104 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1105 =======
1106 struct memstick_host *msh = tifm_get_drvdata(sock);
1108 memstick_suspend_host(msh);
1109 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1110 return 0;
1113 static int tifm_ms_resume(struct tifm_dev *sock)
1115 struct memstick_host *msh = tifm_get_drvdata(sock);
1116 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1117 struct tifm_ms *host = memstick_priv(msh);
1119 tifm_ms_initialize_host(host);
1120 memstick_detect_change(msh);
1121 =======
1122 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1124 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1125 =======
1126 memstick_resume_host(msh);
1127 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1128 return 0;
1131 #else
1133 #define tifm_ms_suspend NULL
1134 #define tifm_ms_resume NULL
1136 #endif /* CONFIG_PM */
1138 static struct tifm_device_id tifm_ms_id_tbl[] = {
1139 { TIFM_TYPE_MS }, { 0 }
1142 static struct tifm_driver tifm_ms_driver = {
1143 .driver = {
1144 .name = DRIVER_NAME,
1145 .owner = THIS_MODULE
1147 .id_table = tifm_ms_id_tbl,
1148 .probe = tifm_ms_probe,
1149 .remove = tifm_ms_remove,
1150 .suspend = tifm_ms_suspend,
1151 .resume = tifm_ms_resume
1154 static int __init tifm_ms_init(void)
1156 return tifm_register_driver(&tifm_ms_driver);
1159 static void __exit tifm_ms_exit(void)
1161 tifm_unregister_driver(&tifm_ms_driver);
1164 MODULE_AUTHOR("Alex Dubov");
1165 MODULE_DESCRIPTION("TI FlashMedia MemoryStick driver");
1166 MODULE_LICENSE("GPL");
1167 MODULE_DEVICE_TABLE(tifm, tifm_ms_id_tbl);
1168 <<<<<<< HEAD:drivers/memstick/host/tifm_ms.c
1169 MODULE_VERSION(DRIVER_VERSION);
1170 =======
1171 >>>>>>> 264e3e889d86e552b4191d69bb60f4f3b383135a:drivers/memstick/host/tifm_ms.c
1173 module_init(tifm_ms_init);
1174 module_exit(tifm_ms_exit);