From patchwork Wed Apr 2 19:38:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [OpenWrt-Devel, 3/7] lantiq: BT Home Hub 2B support - nand driver locking Date: Wed, 02 Apr 2014 18:38:31 -0000 From: Ben Mulvihill X-Patchwork-Id: 5112 Message-Id: <1396467511.31327.41.camel@merveille.lan> To: openwrt-devel@lists.openwrt.org As a result of changeset 40310, the xway nand driver now acquires ebu_lock in the chip select function, and holds it for the entire duration of an operation until the chip is deselected. There is surely no longer any need therefore also to acquire the lock in each separate read or write function. This patch removes that code. Signed-off-by: Ben Mulvihill --- --- a/drivers/mtd/nand/xway_nand.c 2014-04-01 20:14:53.072824371 +0200 +++ b/drivers/mtd/nand/xway_nand.c 2014-04-01 21:24:52.798612391 +0200 @@ -102,7 +102,6 @@ static void xway_cmd_ctrl(struct mtd_inf { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long) this->IO_ADDR_W; - unsigned long flags; if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CLE) @@ -112,11 +111,9 @@ static void xway_cmd_ctrl(struct mtd_inf } if (cmd != NAND_CMD_NONE) { - spin_lock_irqsave(&ebu_lock, flags); writeb(cmd, (void __iomem *) (nandaddr | xway_latchcmd)); while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0) ; - spin_unlock_irqrestore(&ebu_lock, flags); } } @@ -129,12 +126,9 @@ static unsigned char xway_read_byte(stru { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long) this->IO_ADDR_R; - unsigned long flags; int ret; - spin_lock_irqsave(&ebu_lock, flags); ret = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA)); - spin_unlock_irqrestore(&ebu_lock, flags); return ret; } @@ -143,26 +137,20 @@ static void xway_read_buf(struct mtd_inf { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long) this->IO_ADDR_R; - unsigned long flags; int i; - spin_lock_irqsave(&ebu_lock, flags); for (i = 0; i < len; i++) buf[i] = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA)); - spin_unlock_irqrestore(&ebu_lock, flags); } static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len) { struct nand_chip *this = mtd->priv; unsigned long nandaddr = (unsigned long) this->IO_ADDR_W; - unsigned long flags; int i; - spin_lock_irqsave(&ebu_lock, flags); for (i = 0; i < len; i++) ltq_w8(buf[i], (void __iomem *)nandaddr); - spin_unlock_irqrestore(&ebu_lock, flags); } static int xway_nand_probe(struct platform_device *pdev)