aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorEzequiel Garcia <ezequiel.garcia@free-electrons.com>2013-08-12 13:14:50 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2013-08-30 16:34:53 -0400
commit3a1a344a79de3391f4122975eab1167b641668b9 (patch)
tree6dca45c2aeaa5d4ee5ac6405690d6d3cf082c330 /drivers/mtd
parent5bb653e890ca7a5b4ba9042cb60d02f7ddef8c21 (diff)
mtd: nand: pxa3xx: Support command buffer #3
Some newer controllers support a fourth command buffer. This additional command buffer allows to set an arbitrary length count, using the NDCB3.NDLENCNT field, to perform non-standard length operations such as the ONFI parameter page read. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Tested-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 6e28121d3118..b3fc146cdccf 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -197,6 +197,7 @@ struct pxa3xx_nand_info {
197 uint32_t ndcb0; 197 uint32_t ndcb0;
198 uint32_t ndcb1; 198 uint32_t ndcb1;
199 uint32_t ndcb2; 199 uint32_t ndcb2;
200 uint32_t ndcb3;
200}; 201};
201 202
202static bool use_dma = 1; 203static bool use_dma = 1;
@@ -493,9 +494,22 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
493 nand_writel(info, NDSR, NDSR_WRCMDREQ); 494 nand_writel(info, NDSR, NDSR_WRCMDREQ);
494 status &= ~NDSR_WRCMDREQ; 495 status &= ~NDSR_WRCMDREQ;
495 info->state = STATE_CMD_HANDLE; 496 info->state = STATE_CMD_HANDLE;
497
498 /*
499 * Command buffer registers NDCB{0-2} (and optionally NDCB3)
500 * must be loaded by writing directly either 12 or 16
501 * bytes directly to NDCB0, four bytes at a time.
502 *
503 * Direct write access to NDCB1, NDCB2 and NDCB3 is ignored
504 * but each NDCBx register can be read.
505 */
496 nand_writel(info, NDCB0, info->ndcb0); 506 nand_writel(info, NDCB0, info->ndcb0);
497 nand_writel(info, NDCB0, info->ndcb1); 507 nand_writel(info, NDCB0, info->ndcb1);
498 nand_writel(info, NDCB0, info->ndcb2); 508 nand_writel(info, NDCB0, info->ndcb2);
509
510 /* NDCB3 register is available in NFCv2 (Armada 370/XP SoC) */
511 if (info->variant == PXA3XX_NAND_VARIANT_ARMADA370)
512 nand_writel(info, NDCB0, info->ndcb3);
499 } 513 }
500 514
501 /* clear NDSR to let the controller exit the IRQ */ 515 /* clear NDSR to let the controller exit the IRQ */
@@ -554,6 +568,7 @@ static int prepare_command_pool(struct pxa3xx_nand_info *info, int command,
554 default: 568 default:
555 info->ndcb1 = 0; 569 info->ndcb1 = 0;
556 info->ndcb2 = 0; 570 info->ndcb2 = 0;
571 info->ndcb3 = 0;
557 break; 572 break;
558 } 573 }
559 574