parent
22d896eb21
commit
d3f058db1c
@ -0,0 +1,139 @@
|
||||
From a2479dc254ebe31c84fbcfda73f35e2321576494 Mon Sep 17 00:00:00 2001
|
||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
Date: Tue, 19 Mar 2019 13:57:38 +0800
|
||||
Subject: [PATCH 1/6] mtd: mtk ecc: move mtk ecc header file to include/mtd
|
||||
|
||||
Change-Id: I8dc1d30e21b40d68ef5efd9587012f82970156a5
|
||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
---
|
||||
drivers/mtd/nand/raw/mtk_ecc.c | 3 +--
|
||||
drivers/mtd/nand/raw/mtk_nand.c | 2 +-
|
||||
{drivers/mtd/nand/raw => include/linux/mtd}/mtk_ecc.h | 0
|
||||
3 files changed, 2 insertions(+), 3 deletions(-)
|
||||
rename {drivers/mtd/nand/raw => include/linux/mtd}/mtk_ecc.h (100%)
|
||||
|
||||
--- a/drivers/mtd/nand/raw/mtk_ecc.c
|
||||
+++ b/drivers/mtd/nand/raw/mtk_ecc.c
|
||||
@@ -23,8 +23,7 @@
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/mutex.h>
|
||||
-
|
||||
-#include "mtk_ecc.h"
|
||||
+#include <linux/mtd/mtk_ecc.h>
|
||||
|
||||
#define ECC_IDLE_MASK BIT(0)
|
||||
#define ECC_IRQ_EN BIT(0)
|
||||
--- a/drivers/mtd/nand/raw/mtk_nand.c
|
||||
+++ b/drivers/mtd/nand/raw/mtk_nand.c
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <linux/iopoll.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
-#include "mtk_ecc.h"
|
||||
+#include <linux/mtd/mtk_ecc.h>
|
||||
|
||||
/* NAND controller register definition */
|
||||
#define NFI_CNFG (0x00)
|
||||
--- /dev/null
|
||||
+++ b/include/linux/mtd/mtk_ecc.h
|
||||
@@ -0,0 +1,49 @@
|
||||
+/*
|
||||
+ * MTK SDG1 ECC controller
|
||||
+ *
|
||||
+ * Copyright (c) 2016 Mediatek
|
||||
+ * Authors: Xiaolei Li <xiaolei.li@mediatek.com>
|
||||
+ * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
|
||||
+ * This program is free software; you can redistribute it and/or modify it
|
||||
+ * under the terms of the GNU General Public License version 2 as published
|
||||
+ * by the Free Software Foundation.
|
||||
+ */
|
||||
+
|
||||
+#ifndef __DRIVERS_MTD_NAND_MTK_ECC_H__
|
||||
+#define __DRIVERS_MTD_NAND_MTK_ECC_H__
|
||||
+
|
||||
+#include <linux/types.h>
|
||||
+
|
||||
+enum mtk_ecc_mode {ECC_DMA_MODE = 0, ECC_NFI_MODE = 1};
|
||||
+enum mtk_ecc_operation {ECC_ENCODE, ECC_DECODE};
|
||||
+
|
||||
+struct device_node;
|
||||
+struct mtk_ecc;
|
||||
+
|
||||
+struct mtk_ecc_stats {
|
||||
+ u32 corrected;
|
||||
+ u32 bitflips;
|
||||
+ u32 failed;
|
||||
+};
|
||||
+
|
||||
+struct mtk_ecc_config {
|
||||
+ enum mtk_ecc_operation op;
|
||||
+ enum mtk_ecc_mode mode;
|
||||
+ dma_addr_t addr;
|
||||
+ u32 strength;
|
||||
+ u32 sectors;
|
||||
+ u32 len;
|
||||
+};
|
||||
+
|
||||
+int mtk_ecc_encode(struct mtk_ecc *, struct mtk_ecc_config *, u8 *, u32);
|
||||
+void mtk_ecc_get_stats(struct mtk_ecc *, struct mtk_ecc_stats *, int);
|
||||
+int mtk_ecc_wait_done(struct mtk_ecc *, enum mtk_ecc_operation);
|
||||
+int mtk_ecc_enable(struct mtk_ecc *, struct mtk_ecc_config *);
|
||||
+void mtk_ecc_disable(struct mtk_ecc *);
|
||||
+void mtk_ecc_adjust_strength(struct mtk_ecc *ecc, u32 *p);
|
||||
+unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc);
|
||||
+
|
||||
+struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
|
||||
+void mtk_ecc_release(struct mtk_ecc *);
|
||||
+
|
||||
+#endif
|
||||
--- a/drivers/mtd/nand/raw/mtk_ecc.h
|
||||
+++ /dev/null
|
||||
@@ -1,47 +0,0 @@
|
||||
-/* SPDX-License-Identifier: GPL-2.0 OR MIT */
|
||||
-/*
|
||||
- * MTK SDG1 ECC controller
|
||||
- *
|
||||
- * Copyright (c) 2016 Mediatek
|
||||
- * Authors: Xiaolei Li <xiaolei.li@mediatek.com>
|
||||
- * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
|
||||
- */
|
||||
-
|
||||
-#ifndef __DRIVERS_MTD_NAND_MTK_ECC_H__
|
||||
-#define __DRIVERS_MTD_NAND_MTK_ECC_H__
|
||||
-
|
||||
-#include <linux/types.h>
|
||||
-
|
||||
-enum mtk_ecc_mode {ECC_DMA_MODE = 0, ECC_NFI_MODE = 1};
|
||||
-enum mtk_ecc_operation {ECC_ENCODE, ECC_DECODE};
|
||||
-
|
||||
-struct device_node;
|
||||
-struct mtk_ecc;
|
||||
-
|
||||
-struct mtk_ecc_stats {
|
||||
- u32 corrected;
|
||||
- u32 bitflips;
|
||||
- u32 failed;
|
||||
-};
|
||||
-
|
||||
-struct mtk_ecc_config {
|
||||
- enum mtk_ecc_operation op;
|
||||
- enum mtk_ecc_mode mode;
|
||||
- dma_addr_t addr;
|
||||
- u32 strength;
|
||||
- u32 sectors;
|
||||
- u32 len;
|
||||
-};
|
||||
-
|
||||
-int mtk_ecc_encode(struct mtk_ecc *, struct mtk_ecc_config *, u8 *, u32);
|
||||
-void mtk_ecc_get_stats(struct mtk_ecc *, struct mtk_ecc_stats *, int);
|
||||
-int mtk_ecc_wait_done(struct mtk_ecc *, enum mtk_ecc_operation);
|
||||
-int mtk_ecc_enable(struct mtk_ecc *, struct mtk_ecc_config *);
|
||||
-void mtk_ecc_disable(struct mtk_ecc *);
|
||||
-void mtk_ecc_adjust_strength(struct mtk_ecc *ecc, u32 *p);
|
||||
-unsigned int mtk_ecc_get_parity_bits(struct mtk_ecc *ecc);
|
||||
-
|
||||
-struct mtk_ecc *of_mtk_ecc_get(struct device_node *);
|
||||
-void mtk_ecc_release(struct mtk_ecc *);
|
||||
-
|
||||
-#endif
|
@ -0,0 +1,31 @@
|
||||
From b341f120cfc9ca1dfd48364b7f36ac2c1fbdea43 Mon Sep 17 00:00:00 2001
|
||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
Date: Wed, 3 Apr 2019 16:30:01 +0800
|
||||
Subject: [PATCH 3/6] mtd: spinand: disable on-die ECC
|
||||
|
||||
Change-Id: I9745adaed5295202fabbe8ab8947885c57a5b847
|
||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
---
|
||||
drivers/mtd/nand/spi/core.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -552,7 +552,7 @@ static int spinand_mtd_read(struct mtd_i
|
||||
int ret = 0;
|
||||
|
||||
if (ops->mode != MTD_OPS_RAW && spinand->eccinfo.ooblayout)
|
||||
- enable_ecc = true;
|
||||
+ enable_ecc = false;
|
||||
|
||||
mutex_lock(&spinand->lock);
|
||||
|
||||
@@ -600,7 +600,7 @@ static int spinand_mtd_write(struct mtd_
|
||||
int ret = 0;
|
||||
|
||||
if (ops->mode != MTD_OPS_RAW && mtd->ooblayout)
|
||||
- enable_ecc = true;
|
||||
+ enable_ecc = false;
|
||||
|
||||
mutex_lock(&spinand->lock);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,97 @@
|
||||
From c813fbe806257c574240770ef716fbee19f7dbfa Mon Sep 17 00:00:00 2001
|
||||
From: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
Date: Thu, 6 Jun 2019 16:29:04 +0800
|
||||
Subject: [PATCH] spi: spi-mem: Mediatek: Add SPI Nand support for MT7629
|
||||
|
||||
Signed-off-by: Xiangsheng Hou <xiangsheng.hou@mediatek.com>
|
||||
---
|
||||
arch/arm/boot/dts/mt7629-rfb.dts | 45 ++++++++++++++++++++++++++++++++
|
||||
arch/arm/boot/dts/mt7629.dtsi | 22 ++++++++++++++++
|
||||
3 files changed, 79 insertions(+)
|
||||
|
||||
--- a/arch/arm/boot/dts/mt7629.dtsi
|
||||
+++ b/arch/arm/boot/dts/mt7629.dtsi
|
||||
@@ -259,6 +259,28 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ bch: ecc@1100e000 {
|
||||
+ compatible = "mediatek,mt7622-ecc";
|
||||
+ reg = <0x1100e000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 95 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFIECC_PD>;
|
||||
+ clock-names = "nfiecc_clk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ snfi: spi@1100d000 {
|
||||
+ compatible = "mediatek,mt7629-snfi";
|
||||
+ reg = <0x1100d000 0x1000>;
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>;
|
||||
+ clock-names = "nfi_clk", "spi_clk";
|
||||
+ ecc-engine = <&bch>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
spi: spi@1100a000 {
|
||||
compatible = "mediatek,mt7629-spi",
|
||||
"mediatek,mt7622-spi";
|
||||
--- a/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
+++ b/arch/arm/boot/dts/mt7629-rfb.dts
|
||||
@@ -281,6 +281,52 @@
|
||||
};
|
||||
};
|
||||
|
||||
+&bch {
|
||||
+ status = "okay";
|
||||
+};
|
||||
+
|
||||
+&snfi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "spi-nand";
|
||||
+ spi-max-frequency = <104000000>;
|
||||
+ reg = <0>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "Bootloader";
|
||||
+ reg = <0x00000 0x0100000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@100000 {
|
||||
+ label = "Config";
|
||||
+ reg = <0x100000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "factory";
|
||||
+ reg = <0x140000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1c0000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x1c0000 0x1000000>;
|
||||
+ };
|
||||
+
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&spi {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spi_pins>;
|
@ -0,0 +1,98 @@
|
||||
diff -urN a/arch/arm64/boot/dts/mediatek/mt7622.dtsi b/arch/arm64/boot/dts/mediatek/mt7622.dtsi
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622.dtsi 2020-03-02 17:16:13.700464470 +0800
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622.dtsi 2020-03-02 17:15:55.276885406 +0800
|
||||
@@ -554,6 +554,19 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
+ snfi: spi@1100d000 {
|
||||
+ compatible = "mediatek,mt7622-snfi";
|
||||
+ reg = <0 0x1100d000 0 0x1000>;
|
||||
+ interrupts = <GIC_SPI 96 IRQ_TYPE_LEVEL_LOW>;
|
||||
+ clocks = <&pericfg CLK_PERI_NFI_PD>,
|
||||
+ <&pericfg CLK_PERI_SNFI_PD>;
|
||||
+ clock-names = "nfi_clk", "spi_clk";
|
||||
+ ecc-engine = <&bch>;
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
nor_flash: spi@11014000 {
|
||||
compatible = "mediatek,mt7622-nor",
|
||||
"mediatek,mt8173-nor";
|
||||
diff -urN a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts 2020-03-02 17:16:25.492193459 +0800
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts 2020-03-02 17:16:35.243968416 +0800
|
||||
@@ -108,7 +108,7 @@
|
||||
};
|
||||
|
||||
&bch {
|
||||
- status = "disabled";
|
||||
+ status = "okay";
|
||||
};
|
||||
|
||||
&btif {
|
||||
@@ -541,6 +541,62 @@
|
||||
status = "disable";
|
||||
};
|
||||
|
||||
+&snfi {
|
||||
+ pinctrl-names = "default";
|
||||
+ pinctrl-0 = <&serial_nand_pins>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ spi_nand@0 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+ compatible = "spi-nand";
|
||||
+ spi-max-frequency = <104000000>;
|
||||
+ reg = <0>;
|
||||
+
|
||||
+ partitions {
|
||||
+ compatible = "fixed-partitions";
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <1>;
|
||||
+
|
||||
+ partition@0 {
|
||||
+ label = "Preloader";
|
||||
+ reg = <0x00000 0x0080000>;
|
||||
+ read-only;
|
||||
+ };
|
||||
+
|
||||
+ partition@80000 {
|
||||
+ label = "ATF";
|
||||
+ reg = <0x80000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@c0000 {
|
||||
+ label = "Bootloader";
|
||||
+ reg = <0xc0000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@140000 {
|
||||
+ label = "Config";
|
||||
+ reg = <0x140000 0x0080000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@1c0000 {
|
||||
+ label = "Factory";
|
||||
+ reg = <0x1c0000 0x0040000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@200000 {
|
||||
+ label = "firmware";
|
||||
+ reg = <0x200000 0x2000000>;
|
||||
+ };
|
||||
+
|
||||
+ partition@2200000 {
|
||||
+ label = "User_data";
|
||||
+ reg = <0x2200000 0x4000000>;
|
||||
+ };
|
||||
+ };
|
||||
+ };
|
||||
+};
|
||||
+
|
||||
&spi0 {
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&spic0_pins>;
|
@ -0,0 +1,32 @@
|
||||
diff --git a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
index 1ec68de..44cc80c 100644
|
||||
--- a/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
+++ b/arch/arm64/boot/dts/mediatek/mt7622-rfb1.dts
|
||||
@@ -105,6 +105,18 @@
|
||||
regulator-boot-on;
|
||||
regulator-always-on;
|
||||
};
|
||||
+
|
||||
+ wmac: wmac@18000000 {
|
||||
+ compatible = "mediatek,mt7622-wmac";
|
||||
+ reg = <0 0x18000000 0 0x100000>;
|
||||
+ interrupts = <GIC_SPI 211 IRQ_TYPE_LEVEL_LOW>;
|
||||
+
|
||||
+ mediatek,infracfg = <&infracfg>;
|
||||
+ status = "okay";
|
||||
+
|
||||
+ power-domains = <&scpsys MT7622_POWER_DOMAIN_WB>;
|
||||
+ mediatek,mtd-eeprom = <&factory 0x0000>;
|
||||
+ };
|
||||
};
|
||||
|
||||
&bch {
|
||||
@@ -579,7 +591,7 @@
|
||||
reg = <0x140000 0x0080000>;
|
||||
};
|
||||
|
||||
- partition@1c0000 {
|
||||
+ factory: partition@1c0000 {
|
||||
label = "Factory";
|
||||
reg = <0x1c0000 0x0040000>;
|
||||
};
|
Loading…
Reference in New Issue