0016-MTD-lantiq-xway-add-missing-write_buf-and-read_buf-t.patch 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 65df9d63eaee02c25e879b33dd42aceb78e57842 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 16/36] MTD: lantiq: xway: add missing write_buf and read_buf
  5. to nand driver
  6. Signed-off-by: John Crispin <blogic@openwrt.org>
  7. ---
  8. drivers/mtd/nand/xway_nand.c | 28 ++++++++++++++++++++++++++++
  9. 1 file changed, 28 insertions(+)
  10. --- a/drivers/mtd/nand/xway_nand.c
  11. +++ b/drivers/mtd/nand/xway_nand.c
  12. @@ -136,6 +136,32 @@ static unsigned char xway_read_byte(stru
  13. return ret;
  14. }
  15. +static void xway_read_buf(struct mtd_info *mtd, u_char *buf, int len)
  16. +{
  17. + struct nand_chip *this = mtd->priv;
  18. + unsigned long nandaddr = (unsigned long) this->IO_ADDR_R;
  19. + unsigned long flags;
  20. + int i;
  21. +
  22. + spin_lock_irqsave(&ebu_lock, flags);
  23. + for (i = 0; i < len; i++)
  24. + buf[i] = ltq_r8((void __iomem *)(nandaddr | NAND_READ_DATA));
  25. + spin_unlock_irqrestore(&ebu_lock, flags);
  26. +}
  27. +
  28. +static void xway_write_buf(struct mtd_info *mtd, const u_char *buf, int len)
  29. +{
  30. + struct nand_chip *this = mtd->priv;
  31. + unsigned long nandaddr = (unsigned long) this->IO_ADDR_W;
  32. + unsigned long flags;
  33. + int i;
  34. +
  35. + spin_lock_irqsave(&ebu_lock, flags);
  36. + for (i = 0; i < len; i++)
  37. + ltq_w8(buf[i], (void __iomem *)(nandaddr | NAND_WRITE_DATA));
  38. + spin_unlock_irqrestore(&ebu_lock, flags);
  39. +}
  40. +
  41. static int xway_nand_probe(struct platform_device *pdev)
  42. {
  43. struct nand_chip *this = platform_get_drvdata(pdev);
  44. @@ -177,6 +203,8 @@ static struct platform_nand_data xway_na
  45. .dev_ready = xway_dev_ready,
  46. .select_chip = xway_select_chip,
  47. .read_byte = xway_read_byte,
  48. + .read_buf = xway_read_buf,
  49. + .write_buf = xway_write_buf,
  50. }
  51. };