openwrt/target/linux/mediatek/patches-4.4/0076-mtd-nand-add-power-domains-to-the-mediatek-driver.patch

73 lines
2.0 KiB
Diff
Raw Normal View History

From 5dc0d474396e04e6c140d71f0e113eb1c03501c5 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 17 May 2016 05:44:10 +0200
Subject: [PATCH 076/102] mtd: nand: add power domains to the mediatek driver
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/mtd/nand/mtk_nand.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/mtk_nand.c b/drivers/mtd/nand/mtk_nand.c
index 907b90c..bde1a1d 100644
--- a/drivers/mtd/nand/mtk_nand.c
+++ b/drivers/mtd/nand/mtk_nand.c
@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/dma-mapping.h>
+#include <linux/pm_runtime.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/clk.h>
@@ -102,6 +103,7 @@
#define NFI_MASTER_STA (0x224)
#define MASTER_STA_MASK (0x0FFF)
#define NFI_EMPTY_THRESH (0x23C)
+#define NFI_ACCCON1 (0x244)
#define MTK_NAME "mtk-nand"
#define KB(x) ((x) * 1024UL)
@@ -539,6 +541,8 @@ static void mtk_nfc_bad_mark_swap(struct mtd_info *mtd, uint8_t *buf, int raw)
struct mtk_nfc_nand_chip *nand = to_mtk_nand(chip);
u32 bad_pos = nand->bad_mark.pos;
+ return;
+
if (raw)
bad_pos += nand->bad_mark.sec * mtk_data_len(chip);
else
@@ -946,7 +950,8 @@ static int mtk_nfc_read_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
static inline void mtk_nfc_hw_init(struct mtk_nfc *nfc)
{
- nfi_writel(nfc, 0x10804211, NFI_ACCCON);
+ nfi_writel(nfc, 0x30c77fff, NFI_ACCCON);
+ nfi_writel(nfc, 0xC03222, NFI_ACCCON1);
nfi_writew(nfc, 0xf1, NFI_CNRNB);
nfi_writew(nfc, PAGEFMT_8K_16K, NFI_PAGEFMT);
@@ -1328,6 +1333,9 @@ static int mtk_nfc_probe(struct platform_device *pdev)
goto clk_disable;
}
+ pm_runtime_enable(dev);
+ pm_runtime_get_sync(dev);
+
platform_set_drvdata(pdev, nfc);
ret = mtk_nfc_nand_chips_init(dev, nfc);
@@ -1362,6 +1370,9 @@ static int mtk_nfc_remove(struct platform_device *pdev)
mtk_ecc_release(nfc->ecc);
mtk_nfc_disable_clk(&nfc->clk);
+ pm_runtime_put_sync(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+
return 0;
}
--
1.7.10.4