332 if (host->req->data_dir == WRITE)
333 t_size = !(host->cmd_flags & REG_DATA)
334 ? jmb38x_ms_write_data(host, buf, p_cnt)
335 : jmb38x_ms_write_reg_data(host, buf, p_cnt);
336 else
337 t_size = !(host->cmd_flags & REG_DATA)
338 ? jmb38x_ms_read_data(host, buf, p_cnt)
339 : jmb38x_ms_read_reg_data(host, buf, p_cnt);
340
341 if (host->req->long_data) {
342 kunmap_atomic(buf - p_off, KM_BIO_SRC_IRQ);
343 local_irq_restore(flags);
344 }
345
346 if (!t_size)
347 break;
348 host->block_pos += t_size;
349 length -= t_size;
350 off += t_size;
351 }
352
353 if (!length && host->req->data_dir == WRITE) {
354 if (host->cmd_flags & REG_DATA) {
355 writel(host->io_word[0], host->addr + TPC_P0);
356 writel(host->io_word[1], host->addr + TPC_P1);
357 } else if (host->io_pos) {
358 writel(host->io_word[0], host->addr + DATA);
359 }
360 }
361
362 return length;
363}
364
365static int jmb38x_ms_issue_cmd(struct memstick_host *msh)
366{
367 struct jmb38x_ms_host *host = memstick_priv(msh);
368 unsigned char *data;
369 unsigned int data_len, cmd, t_val;
370
371 if (!(STATUS_HAS_MEDIA & readl(host->addr + STATUS))) {
372 dev_dbg(&msh->dev, "no media status\n");