lantiq: add v3.10 patches
[openwrt/svn-archive/archive.git] / target / linux / lantiq / patches-3.10 / 0018-MTD-lantiq-xway-add-missing-write_buf-and-read_buf-t.patch
1 From 0e75433962d619e4f9dcab57643223d85db0b880 Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Sun, 28 Jul 2013 17:59:51 +0200
4 Subject: [PATCH 18/34] MTD: lantiq: xway: add missing write_buf and read_buf
5 to nand driver
6
7 Signed-off-by: John Crispin <blogic@openwrt.org>
8 ---
9 drivers/mtd/nand/xway_nand.c | 28 ++++++++++++++++++++++++++++
10 1 file changed, 28 insertions(+)
11
12 diff --git a/drivers/mtd/nand/xway_nand.c b/drivers/mtd/nand/xway_nand.c
13 index 8d14f1b..f813a55 100644
14 --- a/drivers/mtd/nand/xway_nand.c
15 +++ b/drivers/mtd/nand/xway_nand.c
16 @@ -136,6 +136,32 @@ static unsigned char xway_read_byte(struct mtd_info *mtd)
17 return ret;
18 }
19
20 +static void xway_read_buf(struct mtd_info *mtd, u_char *buf, int len)
21 +{
22 + struct nand_chip *this = mtd->priv;
23 + unsigned long nandaddr = (unsigned long) this->IO_ADDR_R;
24 + unsigned long flags;
25 + int i;
26 +
27 + spin_lock_irqsave(&ebu_lock, flags);
28 + for (i = 0; i < len; i++)
29 + buf[i] = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA));
30 + spin_unlock_irqrestore(&ebu_lock, flags);
31 +}
32 +
33 +static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
34 +{
35 + struct nand_chip *this = mtd->priv;
36 + unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
37 + unsigned long flags;
38 + int i;
39 +
40 + spin_lock_irqsave(&ebu_lock, flags);
41 + for (i = 0; i < len; i++)
42 + ltq_w8(buf[i], (void __iomem *)nandaddr);
43 + spin_unlock_irqrestore(&ebu_lock, flags);
44 +}
45 +
46 static int xway_nand_probe(struct platform_device *pdev)
47 {
48 struct nand_chip *this = platform_get_drvdata(pdev);
49 @@ -181,6 +207,8 @@ static struct platform_nand_data xway_nand_data = {
50 .dev_ready = xway_dev_ready,
51 .select_chip = xway_select_chip,
52 .read_byte = xway_read_byte,
53 + .read_buf = xway_read_buf,
54 + .write_buf = xway_write_buf,
55 }
56 };
57
58 --
59 1.7.10.4
60