public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Marcel Ziswiler <marcel@ziswiler.com>
To: linux-mtd@lists.infradead.org
Subject: PXA3xx NAND Driver Questions
Date: Mon, 1 Dec 2008 14:52:19 +0000 (UTC)	[thread overview]
Message-ID: <loom.20081201T144959-313@post.gmane.org> (raw)

Hi there

Looking at drivers/mtd/nand/pxa3xx_nand.c lines 470 and 482 (see below) I
noticed that the sizes in the __raw_{read|write}sl() calls are left shifted by
two meaning multiplied by 4. Unfortunately I could not find an accurate
description of those __raw_{read|write}sl() calls, them being in ARM assembly I
assume they just read and write a block of IO memory. Now my first question:
Does this multiply by 4 really make sense? Aren't sizes usually specified in
bytes everywhere?

463 static int handle_data_pio(struct pxa3xx_nand_info *info)
464 {
465         int ret, timeout = CHIP_DELAY_TIMEOUT;
466
467         switch (info->state) {
468         case STATE_PIO_WRITING:
469                 __raw_writesl(info->mmio_base + NDDB, info->data_buff,
470                                 info->data_size << 2);
471
472                 enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD);
473
474                 ret = wait_for_completion_timeout(&info->cmd_complete,
 timeout);
475                 if (!ret) {
476                         printk(KERN_ERR "program command time out\n");
477                         return -1;
478                 }
479                 break;
480         case STATE_PIO_READING:
481                 __raw_readsl(info->mmio_base + NDDB, info->data_buff,
482                                 info->data_size << 2);
483                 break;
484         default:
485                 printk(KERN_ERR "%s: invalid state %d\n", __func__,
486                                 info->state);
487                 return -EINVAL;
488         }
489
490         info->state = STATE_READY;
491         return 0;
492 }

My second question is concerning operation without DMA. This currently seems to
be broken (e.g. if I load the module with use_dma set to 0, see below line 170)
it does not even recognize the NAND chip. Has anybody else tried this lately? It
worked just fine with the pre-mainline version using the manual {read,
write}_fifo_pio() calls.

170 static int use_dma = 1;
171 module_param(use_dma, bool, 0444);
172 MODULE_PARM_DESC(use_dma, "enable DMA for data transfering to/from NAND
 HW");

Cheers

Marcel

                 reply	other threads:[~2008-12-01 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=loom.20081201T144959-313@post.gmane.org \
    --to=marcel@ziswiler.com \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox