diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/nand/am335x_spl_bch.c | 52 | ||||
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 37 |
2 files changed, 62 insertions, 27 deletions
diff --git a/drivers/mtd/nand/am335x_spl_bch.c b/drivers/mtd/nand/am335x_spl_bch.c index a8a7a66..5b189a1 100644 --- a/drivers/mtd/nand/am335x_spl_bch.c +++ b/drivers/mtd/nand/am335x_spl_bch.c @@ -49,6 +49,13 @@ static int nand_command(int block, int page, uint32_t offs, if (cmd == NAND_CMD_RESET) { hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + + /* + * Apply this short delay always to ensure that we do wait + * tWB in any case on any machine. + */ + ndelay(150); + while (!this->dev_ready(mtd)) ; return 0; @@ -78,23 +85,44 @@ static int nand_command(int block, int page, uint32_t offs, hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); - if (cmd == NAND_CMD_READ0) { - /* Latch in address */ - hwctrl(mtd, NAND_CMD_READSTART, - NAND_CTRL_CLE | NAND_CTRL_CHANGE); - hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); - /* - * Wait a while for the data to be ready - */ - while (!this->dev_ready(mtd)) - ; - } else if (cmd == NAND_CMD_RNDOUT) { + /* + * Program and erase have their own busy handlers status, sequential + * in and status need no delay. + */ + switch (cmd) { + case NAND_CMD_CACHEDPROG: + case NAND_CMD_PAGEPROG: + case NAND_CMD_ERASE1: + case NAND_CMD_ERASE2: + case NAND_CMD_SEQIN: + case NAND_CMD_RNDIN: + case NAND_CMD_STATUS: + return 0; + + case NAND_CMD_RNDOUT: + /* No ready / busy check necessary */ hwctrl(mtd, NAND_CMD_RNDOUTSTART, NAND_CTRL_CLE | - NAND_CTRL_CHANGE); + NAND_CTRL_CHANGE); + hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); + return 0; + + case NAND_CMD_READ0: + /* Latch in address */ + hwctrl(mtd, NAND_CMD_READSTART, + NAND_CTRL_CLE | NAND_CTRL_CHANGE); hwctrl(mtd, NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); } + /* + * Apply this short delay always to ensure that we do wait tWB in + * any case on any machine. + */ + ndelay(150); + + while (!this->dev_ready(mtd)) + ; + return 0; } diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 7ea4b60..7b1f429 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c @@ -81,10 +81,32 @@ static int omap_wdt_set_timeout(unsigned int timeout) return 0; } +void hw_watchdog_disable(void) +{ + struct wd_timer *wdt = (struct wd_timer *)WDT_BASE; + + /* + * Disable watchdog + */ + writel(0xAAAA, &wdt->wdtwspr); + while (readl(&wdt->wdtwwps) != 0x0) + ; + writel(0x5555, &wdt->wdtwspr); + while (readl(&wdt->wdtwwps) != 0x0) + ; +} + void hw_watchdog_init(void) { struct wd_timer *wdt = (struct wd_timer *)WDT_BASE; + /* + * Make sure the watchdog is disabled. This is unfortunately required + * because writing to various registers with the watchdog running has no + * effect. + */ + hw_watchdog_disable(); + /* initialize prescaler */ while (readl(&wdt->wdtwwps) & WDT_WWPS_PEND_WCLR) ; @@ -104,18 +126,3 @@ void hw_watchdog_init(void) while ((readl(&wdt->wdtwwps)) & WDT_WWPS_PEND_WSPR) ; } - -void hw_watchdog_disable(void) -{ - struct wd_timer *wdt = (struct wd_timer *)WDT_BASE; - - /* - * Disable watchdog - */ - writel(0xAAAA, &wdt->wdtwspr); - while (readl(&wdt->wdtwwps) != 0x0) - ; - writel(0x5555, &wdt->wdtwspr); - while (readl(&wdt->wdtwwps) != 0x0) - ; -} |