aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/patches-3.10/0205-lantiq-nand-lock.patch
blob: f82774d8894532969fb33dbe8bb9bafcb626a33a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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 <ben.mulvihill@gmail.com>
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 <ben.mulvihill@gmail.com>

---


--- 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)