@@ -57,8 +57,6 @@ struct jmb38x_ms_host {
5757 unsigned long timeout_jiffies ;
5858 struct timer_list timer ;
5959 struct memstick_request * req ;
60- unsigned char eject :1 ,
61- use_dma :1 ;
6260 unsigned char cmd_flags ;
6361 unsigned char io_pos ;
6462 unsigned int io_word [2 ];
@@ -95,9 +93,22 @@ struct jmb38x_ms {
9593#define HOST_CONTROL_IF_PAR4 0x1
9694#define HOST_CONTROL_IF_PAR8 0x3
9795
96+ #define STATUS_BUSY 0x00080000
97+ #define STATUS_MS_DAT7 0x00040000
98+ #define STATUS_MS_DAT6 0x00020000
99+ #define STATUS_MS_DAT5 0x00010000
100+ #define STATUS_MS_DAT4 0x00008000
101+ #define STATUS_MS_DAT3 0x00004000
102+ #define STATUS_MS_DAT2 0x00002000
103+ #define STATUS_MS_DAT1 0x00001000
104+ #define STATUS_MS_DAT0 0x00000800
98105#define STATUS_HAS_MEDIA 0x00000400
99106#define STATUS_FIFO_EMPTY 0x00000200
100107#define STATUS_FIFO_FULL 0x00000100
108+ #define STATUS_MS_CED 0x00000080
109+ #define STATUS_MS_ERR 0x00000040
110+ #define STATUS_MS_BRQ 0x00000020
111+ #define STATUS_MS_CNK 0x00000001
101112
102113#define INT_STATUS_TPC_ERR 0x00080000
103114#define INT_STATUS_CRC_ERR 0x00040000
@@ -124,7 +135,7 @@ enum {
124135 CMD_READY = 0x01 ,
125136 FIFO_READY = 0x02 ,
126137 REG_DATA = 0x04 ,
127- AUTO_GET_INT = 0x08
138+ DMA_DATA = 0x08
128139};
129140
130141static unsigned int jmb38x_ms_read_data (struct jmb38x_ms_host * host ,
@@ -367,28 +378,27 @@ static int jmb38x_ms_issue_cmd(struct memstick_host *msh)
367378 cmd |= TPC_DIR ;
368379 if (host -> req -> need_card_int )
369380 cmd |= TPC_WAIT_INT ;
370- if (host -> req -> get_int_reg )
371- cmd |= TPC_GET_INT ;
372381
373382 data = host -> req -> data ;
374383
375- host -> use_dma = !no_dma ;
384+ if (!no_dma )
385+ host -> cmd_flags |= DMA_DATA ;
376386
377387 if (host -> req -> long_data ) {
378388 data_len = host -> req -> sg .length ;
379389 } else {
380390 data_len = host -> req -> data_len ;
381- host -> use_dma = 0 ;
391+ host -> cmd_flags &= ~ DMA_DATA ;
382392 }
383393
384394 if (data_len <= 8 ) {
385395 cmd &= ~(TPC_DATA_SEL | 0xf );
386396 host -> cmd_flags |= REG_DATA ;
387397 cmd |= data_len & 0xf ;
388- host -> use_dma = 0 ;
398+ host -> cmd_flags &= ~ DMA_DATA ;
389399 }
390400
391- if (host -> use_dma ) {
401+ if (host -> cmd_flags & DMA_DATA ) {
392402 if (1 != pci_map_sg (host -> chip -> pdev , & host -> req -> sg , 1 ,
393403 host -> req -> data_dir == READ
394404 ? PCI_DMA_FROMDEVICE
@@ -451,13 +461,12 @@ static void jmb38x_ms_complete_cmd(struct memstick_host *msh, int last)
451461 readl (host -> addr + INT_STATUS ));
452462 dev_dbg (msh -> cdev .dev , "c hstatus %08x\n" , readl (host -> addr + STATUS ));
453463
454- if ( host -> req -> get_int_reg ) {
455- t_val = readl ( host -> addr + TPC_P0 );
456- host -> req -> int_reg = ( t_val & 0xff );
457- }
464+ host -> req -> int_reg = readl ( host -> addr + STATUS ) & 0xff ;
465+
466+ writel ( 0 , host -> addr + BLOCK );
467+ writel ( 0 , host -> addr + DMA_CONTROL );
458468
459- if (host -> use_dma ) {
460- writel (0 , host -> addr + DMA_CONTROL );
469+ if (host -> cmd_flags & DMA_DATA ) {
461470 pci_unmap_sg (host -> chip -> pdev , & host -> req -> sg , 1 ,
462471 host -> req -> data_dir == READ
463472 ? PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE );
@@ -509,7 +518,7 @@ static irqreturn_t jmb38x_ms_isr(int irq, void *dev_id)
509518 else
510519 host -> req -> error = - ETIME ;
511520 } else {
512- if (host -> use_dma ) {
521+ if (host -> cmd_flags & DMA_DATA ) {
513522 if (irq_status & INT_STATUS_EOTRAN )
514523 host -> cmd_flags |= FIFO_READY ;
515524 } else {
@@ -775,13 +784,10 @@ static struct memstick_host *jmb38x_ms_alloc_host(struct jmb38x_ms *jm, int cnt)
775784 snprintf (host -> host_id , DEVICE_ID_SIZE , DRIVER_NAME ":slot%d" ,
776785 host -> id );
777786 host -> irq = jm -> pdev -> irq ;
778- host -> timeout_jiffies = msecs_to_jiffies (4000 );
787+ host -> timeout_jiffies = msecs_to_jiffies (1000 );
779788 msh -> request = jmb38x_ms_request ;
780789 msh -> set_param = jmb38x_ms_set_param ;
781- /*
782- msh->caps = MEMSTICK_CAP_AUTO_GET_INT | MEMSTICK_CAP_PAR4
783- | MEMSTICK_CAP_PAR8;
784- */
790+
785791 msh -> caps = MEMSTICK_CAP_PAR4 | MEMSTICK_CAP_PAR8 ;
786792
787793 setup_timer (& host -> timer , jmb38x_ms_abort , (unsigned long )msh );
0 commit comments