Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24911
b: refs/heads/master
c: 8fe833c
h: refs/heads/master
i:
  24909: 1cf12d3
  24907: c3c20a3
  24903: 6fac780
  24895: aed9b2c
v: v3
  • Loading branch information
Richard Purdie authored and Linus Torvalds committed Mar 31, 2006
1 parent 9a6ba3b commit a65db1d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6d0cf3e0480f6be9232854387794443d1a904d6d
refs/heads/master: 8fe833c1b010489b71b082e553b1dfa80ef81061
26 changes: 25 additions & 1 deletion trunk/drivers/mtd/nand/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
#include <linux/mtd/compatmac.h>
#include <linux/interrupt.h>
#include <linux/bitops.h>
#include <linux/leds.h>
#include <asm/io.h>

#ifdef CONFIG_MTD_PARTITIONS
Expand Down Expand Up @@ -515,6 +516,8 @@ static int nand_block_checkbad (struct mtd_info *mtd, loff_t ofs, int getchip, i
return nand_isbad_bbt (mtd, ofs, allowbbt);
}

DEFINE_LED_TRIGGER(nand_led_trigger);

/*
* Wait for the ready pin, after a command
* The timeout is catched later.
Expand All @@ -524,12 +527,14 @@ static void nand_wait_ready(struct mtd_info *mtd)
struct nand_chip *this = mtd->priv;
unsigned long timeo = jiffies + 2;

led_trigger_event(nand_led_trigger, LED_FULL);
/* wait until command is processed or timeout occures */
do {
if (this->dev_ready(mtd))
return;
break;
touch_softlockup_watchdog();
} while (time_before(jiffies, timeo));
led_trigger_event(nand_led_trigger, LED_OFF);
}

/**
Expand Down Expand Up @@ -817,6 +822,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
else
timeo += (HZ * 20) / 1000;

led_trigger_event(nand_led_trigger, LED_FULL);

/* Apply this short delay always to ensure that we do wait tWB in
* any case on any machine. */
ndelay (100);
Expand All @@ -840,6 +847,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state)
}
cond_resched();
}
led_trigger_event(nand_led_trigger, LED_OFF);

status = (int) this->read_byte(mtd);
return status;
}
Expand Down Expand Up @@ -2724,6 +2733,21 @@ void nand_release (struct mtd_info *mtd)
EXPORT_SYMBOL_GPL (nand_scan);
EXPORT_SYMBOL_GPL (nand_release);


static int __init nand_base_init(void)
{
led_trigger_register_simple("nand-disk", &nand_led_trigger);
return 0;
}

static void __exit nand_base_exit(void)
{
led_trigger_unregister_simple(nand_led_trigger);
}

module_init(nand_base_init);
module_exit(nand_base_exit);

MODULE_LICENSE ("GPL");
MODULE_AUTHOR ("Steven J. Hill <sjhill@realitydiluted.com>, Thomas Gleixner <tglx@linutronix.de>");
MODULE_DESCRIPTION ("Generic NAND flash driver code");

0 comments on commit a65db1d

Please sign in to comment.