0076-mtd-nand-add-power-domains-to-the-mediatek-driver.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 5dc0d474396e04e6c140d71f0e113eb1c03501c5 Mon Sep 17 00:00:00 2001
  2. From: John Crispin <john@phrozen.org>
  3. Date: Tue, 17 May 2016 05:44:10 +0200
  4. Subject: [PATCH 076/102] mtd: nand: add power domains to the mediatek driver
  5. Signed-off-by: John Crispin <john@phrozen.org>
  6. ---
  7. drivers/mtd/nand/mtk_nand.c | 13 ++++++++++++-
  8. 1 file changed, 12 insertions(+), 1 deletion(-)
  9. --- a/drivers/mtd/nand/mtk_nand.c
  10. +++ b/drivers/mtd/nand/mtk_nand.c
  11. @@ -16,6 +16,7 @@
  12. #include <linux/platform_device.h>
  13. #include <linux/dma-mapping.h>
  14. +#include <linux/pm_runtime.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/delay.h>
  17. #include <linux/clk.h>
  18. @@ -102,6 +103,7 @@
  19. #define NFI_MASTER_STA (0x224)
  20. #define MASTER_STA_MASK (0x0FFF)
  21. #define NFI_EMPTY_THRESH (0x23C)
  22. +#define NFI_ACCCON1 (0x244)
  23. #define MTK_NAME "mtk-nand"
  24. #define KB(x) ((x) * 1024UL)
  25. @@ -539,6 +541,8 @@ static void mtk_nfc_bad_mark_swap(struct
  26. struct mtk_nfc_nand_chip *nand = to_mtk_nand(chip);
  27. u32 bad_pos = nand->bad_mark.pos;
  28. + return;
  29. +
  30. if (raw)
  31. bad_pos += nand->bad_mark.sec * mtk_data_len(chip);
  32. else
  33. @@ -946,7 +950,8 @@ static int mtk_nfc_read_oob_std(struct m
  34. static inline void mtk_nfc_hw_init(struct mtk_nfc *nfc)
  35. {
  36. - nfi_writel(nfc, 0x10804211, NFI_ACCCON);
  37. + nfi_writel(nfc, 0x30c77fff, NFI_ACCCON);
  38. + nfi_writel(nfc, 0xC03222, NFI_ACCCON1);
  39. nfi_writew(nfc, 0xf1, NFI_CNRNB);
  40. nfi_writew(nfc, PAGEFMT_8K_16K, NFI_PAGEFMT);
  41. @@ -1328,6 +1333,9 @@ static int mtk_nfc_probe(struct platform
  42. goto clk_disable;
  43. }
  44. + pm_runtime_enable(dev);
  45. + pm_runtime_get_sync(dev);
  46. +
  47. platform_set_drvdata(pdev, nfc);
  48. ret = mtk_nfc_nand_chips_init(dev, nfc);
  49. @@ -1362,6 +1370,9 @@ static int mtk_nfc_remove(struct platfor
  50. mtk_ecc_release(nfc->ecc);
  51. mtk_nfc_disable_clk(&nfc->clk);
  52. + pm_runtime_put_sync(&pdev->dev);
  53. + pm_runtime_disable(&pdev->dev);
  54. +
  55. return 0;
  56. }