Skip to contentSkip to conversation

PATCH: at91_nand rdy_pin fix

PATCH Ivan Kuten 2 participants 4 messages May 23, 2007 – May 24, 2007

Subsystems (3)
lore
Share & tools
lore

Ivan Kuten

author
#0 lore raw

Hello,

The patch below fixes nand driver for AT91 boards which do not have NAND R/B signal connected to gpio (rdy_pin is not connected).

Patch is against 2.6.22-rc1 + corresponding at91 patch from maxim.org.za

Best regards, Ivan

---

drivers/mtd/nand/at91_nand.c 2007-05-24 00:10:01 +0300 renamed from drivers/mtd/nand/at91_nand.c 2007-05-24 00:19:57 +0300 +6 -1
diff -urN linux.orig/drivers/mtd/nand/at91_nand.c linux/drivers/mtd/nand/at91_nand.c
@@ -128,7 +128,12 @@
        nand_chip->IO_ADDR_R = host->io_base;
        nand_chip->IO_ADDR_W = host->io_base;
        nand_chip->cmd_ctrl = at91_nand_cmd_ctrl;
-       nand_chip->dev_ready = at91_nand_device_ready;
+
+       if (host->board->rdy_pin)
+               nand_chip->dev_ready = at91_nand_device_ready;
+       else
+               nand_chip->dev_ready = NULL;
+
        nand_chip->ecc.mode = NAND_ECC_SOFT;    /* enable ECC */
        nand_chip->chip_delay = 20;             /* 20us command delay time */
#1 lore raw

hi Ivan,

drivers/mtd/nand/at91_nand.c 2007-05-24 00:10:01 +0300 line 135

Quoted 6 lines
drivers/mtd/nand/at91_nand.c 2007-05-24 00:10:01 +0300 renamed from drivers/mtd/nand/at91_nand.c 2007-05-24 00:19:57 +0300 +5 -1
-       nand_chip->dev_ready = at91_nand_device_ready;
+
+       if (host->board->rdy_pin)
+               nand_chip->dev_ready = at91_nand_device_ready;
+       else
+               nand_chip->dev_ready = NULL;

Patch looks correct.

Since the at91_nand_host structure is allocated with kzalloc(), nand_chip->dev_ready is already initialized to NULL. So we don't really need the "else" part.

Regards,
Andrew Victor

author
#2 lore raw

On 24 May 2007 09:47:08 +0200
Andrew Victor wrote:

Should I re-diff or you will apply it corrected?

BR,
Ivan

Quoted 24 lines

hi Ivan,

drivers/mtd/nand/at91_nand.c 2007-05-24 00:10:01 +0300 line 135

Quoted 6 lines
drivers/mtd/nand/at91_nand.c 2007-05-24 00:10:01 +0300 renamed from drivers/mtd/nand/at91_nand.c 2007-05-24 00:19:57 +0300 +5 -1
-       nand_chip->dev_ready = at91_nand_device_ready;
+
+       if (host->board->rdy_pin)
+               nand_chip->dev_ready = at91_nand_device_ready;
+       else
+               nand_chip->dev_ready = NULL;

Patch looks correct.

Since the at91_nand_host structure is allocated with kzalloc(), nand_chip->dev_ready is already initialized to NULL. So we don't really need the "else" part.

Regards,
Andrew Victor

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author Acked-by Andrew Victor
#3 lore raw
In reply to Andrew Victor

Hi again,

Corrected according to Andrew's comments:

The patch below fixes nand driver for AT91 boards which do not have NAND R/B signal connected to gpio (rdy_pin is not connected).

Best regards,
Ivan

drivers/mtd/nand/at91_nand.c +4 -1
diff -urN linux-2.6.22-rc1-at91.orig/drivers/mtd/nand/at91_nand.c linux-2.6.22-rc1-at91/drivers/mtd/nand/at91_nand.c
@@ -128,7 +128,10 @@
 	nand_chip->IO_ADDR_R = host->io_base;
 	nand_chip->IO_ADDR_W = host->io_base;
 	nand_chip->cmd_ctrl = at91_nand_cmd_ctrl;
-	nand_chip->dev_ready = at91_nand_device_ready;
+
+	if (host->board->rdy_pin)
+		nand_chip->dev_ready = at91_nand_device_ready;
+
 	nand_chip->ecc.mode = NAND_ECC_SOFT;	/* enable ECC */
 	nand_chip->chip_delay = 20;		/* 20us command delay time */
 
Quoted 24 lines · On 24 May 2007 09:47:08 +0200 Andrew Victor wrote:

hi Ivan,

Review

Quoted 6 lines
(quoted diff) +5 -1
-       nand_chip->dev_ready = at91_nand_device_ready;
+
+       if (host->board->rdy_pin)
+               nand_chip->dev_ready = at91_nand_device_ready;
+       else
+               nand_chip->dev_ready = NULL;

Patch looks correct.

Since the at91_nand_host structure is allocated with kzalloc(), nand_chip->dev_ready is already initialized to NULL. So we don't really need the "else" part.

Regards,
Andrew Victor

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/