f82774d8894532969fb33dbe8bb9bafcb626a33a
[openwrt/openwrt.git] / target / linux / lantiq / patches-3.10 / 0205-lantiq-nand-lock.patch
1 From patchwork Wed Apr 2 19:38:31 2014
2 Content-Type: text/plain; charset="utf-8"
3 MIME-Version: 1.0
4 Content-Transfer-Encoding: 7bit
5 Subject: [OpenWrt-Devel,
6 3/7] lantiq: BT Home Hub 2B support - nand driver locking
7 Date: Wed, 02 Apr 2014 18:38:31 -0000
8 From: Ben Mulvihill <ben.mulvihill@gmail.com>
9 X-Patchwork-Id: 5112
10 Message-Id: <1396467511.31327.41.camel@merveille.lan>
11 To: openwrt-devel@lists.openwrt.org
12
13 As a result of changeset 40310, the xway nand driver
14 now acquires ebu_lock in the chip select function, and
15 holds it for the entire duration of an operation until
16 the chip is deselected. There is surely no longer any
17 need therefore also to acquire the lock in each separate
18 read or write function. This patch removes that code.
19
20 Signed-off-by: Ben Mulvihill <ben.mulvihill@gmail.com>
21
22 ---
23
24
25 --- a/drivers/mtd/nand/xway_nand.c 2014-04-01 20:14:53.072824371 +0200
26 +++ b/drivers/mtd/nand/xway_nand.c 2014-04-01 21:24:52.798612391 +0200
27 @@ -102,7 +102,6 @@ static void xway_cmd_ctrl(struct mtd_inf
28 {
29 struct nand_chip *this = mtd->priv;
30 unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
31 - unsigned long flags;
32
33 if (ctrl & NAND_CTRL_CHANGE) {
34 if (ctrl & NAND_CLE)
35 @@ -112,11 +111,9 @@ static void xway_cmd_ctrl(struct mtd_inf
36 }
37
38 if (cmd != NAND_CMD_NONE) {
39 - spin_lock_irqsave(&ebu_lock, flags);
40 writeb(cmd, (void __iomem *) (nandaddr | xway_latchcmd));
41 while ((ltq_ebu_r32(EBU_NAND_WAIT) & NAND_WAIT_WR_C) == 0)
42 ;
43 - spin_unlock_irqrestore(&ebu_lock, flags);
44 }
45 }
46
47 @@ -129,12 +126,9 @@ static unsigned char xway_read_byte(stru
48 {
49 struct nand_chip *this = mtd->priv;
50 unsigned long nandaddr = (unsigned long) this->IO_ADDR_R;
51 - unsigned long flags;
52 int ret;
53
54 - spin_lock_irqsave(&ebu_lock, flags);
55 ret = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA));
56 - spin_unlock_irqrestore(&ebu_lock, flags);
57
58 return ret;
59 }
60 @@ -143,26 +137,20 @@ static void xway_read_buf(struct mtd_inf
61 {
62 struct nand_chip *this = mtd->priv;
63 unsigned long nandaddr = (unsigned long) this->IO_ADDR_R;
64 - unsigned long flags;
65 int i;
66
67 - spin_lock_irqsave(&ebu_lock, flags);
68 for (i = 0; i < len; i++)
69 buf[i] = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA));
70 - spin_unlock_irqrestore(&ebu_lock, flags);
71 }
72
73 static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
74 {
75 struct nand_chip *this = mtd->priv;
76 unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
77 - unsigned long flags;
78 int i;
79
80 - spin_lock_irqsave(&ebu_lock, flags);
81 for (i = 0; i < len; i++)
82 ltq_w8(buf[i], (void __iomem *)nandaddr);
83 - spin_unlock_irqrestore(&ebu_lock, flags);
84 }
85
86 static int xway_nand_probe(struct platform_device *pdev)