2018-11-29 06:33:23

by Ryder Lee

[permalink] [raw]
Subject: [RESEND PATCH 1/4] dt-bindings: mtd: mtk-quadspi: update bindings for MT7629 SoC

This updates bindings for the MT7629 SPI-NOR controller.

Signed-off-by: Ryder Lee <[email protected]>
---
Documentation/devicetree/bindings/mtd/mtk-quadspi.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt b/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt
index 56d3668..a12e3b5 100644
--- a/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt
+++ b/Documentation/devicetree/bindings/mtd/mtk-quadspi.txt
@@ -1,4 +1,4 @@
-* Serial NOR flash controller for MTK MT81xx (and similar)
+* Serial NOR flash controller for MediaTek SoCs

Required properties:
- compatible: For mt8173, compatible should be "mediatek,mt8173-nor",
@@ -10,6 +10,7 @@ Required properties:
"mediatek,mt2712-nor", "mediatek,mt8173-nor"
"mediatek,mt7622-nor", "mediatek,mt8173-nor"
"mediatek,mt7623-nor", "mediatek,mt8173-nor"
+ "mediatek,mt7629-nor", "mediatek,mt8173-nor"
"mediatek,mt8173-nor"
- reg: physical base address and length of the controller's register
- clocks: the phandle of the clocks needed by the nor controller
--
1.9.1



2018-11-29 06:30:56

by Ryder Lee

[permalink] [raw]
Subject: [RESEND PATCH 2/4] mtd: spi-nor: mtk-quadspi: use ofpart for parsing partitions

From: Guochun Mao <[email protected]>

Replace mtd_device_register with mtd_device_parse_register for
parsing partitions and add ofpart support.

Signed-off-by: Guochun Mao <[email protected]>
Tested-by: Ryder Lee <[email protected]>
---
drivers/mtd/spi-nor/mtk-quadspi.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index 5442993..2278677 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -118,6 +118,8 @@ struct mtk_nor {
struct clk *nor_clk;
};

+static const char * const probes[] = { "ofpart", NULL };
+
static void mtk_nor_set_read_mode(struct mtk_nor *mtk_nor)
{
struct spi_nor *nor = &mtk_nor->nor;
@@ -457,7 +459,7 @@ static int mtk_nor_init(struct mtk_nor *mtk_nor,
if (ret)
return ret;

- return mtd_device_register(&nor->mtd, NULL, 0);
+ return mtd_device_parse_register(&nor->mtd, probes, NULL, NULL, 0);
}

static int mtk_nor_drv_probe(struct platform_device *pdev)
--
1.9.1


2018-11-29 06:30:59

by Ryder Lee

[permalink] [raw]
Subject: [RESEND PATCH 3/4] mtd: spi-nor: mtk-quadspi: add SNOR_HWCAPS_READ for capcity setting

From: Guochun Mao <[email protected]>

SNOR_HWCAPS_READ is a basic read mode for both flash and controller,
it should be supported, so add the capcity for mtk-quadspi.

Signed-off-by: Guochun Mao <[email protected]>
Tested-by: Ryder Lee <[email protected]>
---
drivers/mtd/spi-nor/mtk-quadspi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/mtk-quadspi.c b/drivers/mtd/spi-nor/mtk-quadspi.c
index 2278677..c198fd2 100644
--- a/drivers/mtd/spi-nor/mtk-quadspi.c
+++ b/drivers/mtd/spi-nor/mtk-quadspi.c
@@ -433,7 +433,8 @@ static int mtk_nor_init(struct mtk_nor *mtk_nor,
struct device_node *flash_node)
{
const struct spi_nor_hwcaps hwcaps = {
- .mask = SNOR_HWCAPS_READ_FAST |
+ .mask = SNOR_HWCAPS_READ |
+ SNOR_HWCAPS_READ_FAST |
SNOR_HWCAPS_READ_1_1_2 |
SNOR_HWCAPS_PP,
};
--
1.9.1


2018-11-29 06:31:08

by Ryder Lee

[permalink] [raw]
Subject: [RESEND PATCH 4/4] mtd: spi-nor: mtk-quadspi: rename config to a common one

The quadspi is a generic communication interface which could be shared
with other MediaTek SoCs. Hence rename it to a common one.

Signed-off-by: Ryder Lee <[email protected]>
---
drivers/mtd/spi-nor/Kconfig | 16 ++++++++--------
drivers/mtd/spi-nor/Makefile | 2 +-
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/mtd/spi-nor/Kconfig b/drivers/mtd/spi-nor/Kconfig
index 6cc9c92..2062611 100644
--- a/drivers/mtd/spi-nor/Kconfig
+++ b/drivers/mtd/spi-nor/Kconfig
@@ -7,14 +7,6 @@ menuconfig MTD_SPI_NOR

if MTD_SPI_NOR

-config MTD_MT81xx_NOR
- tristate "Mediatek MT81xx SPI NOR flash controller"
- depends on HAS_IOMEM
- help
- This enables access to SPI NOR flash, using MT81xx SPI NOR flash
- controller. This controller does not support generic SPI BUS, it only
- supports SPI NOR Flash.
-
config MTD_SPI_NOR_USE_4K_SECTORS
bool "Use small 4096 B erase sectors"
default y
@@ -86,6 +78,14 @@ config SPI_NXP_SPIFI
Flash. Enable this option if you have a device with a SPIFI
controller and want to access the Flash as a mtd device.

+config SPI_MTK_QUADSPI
+ tristate "MediaTek Quad SPI controller"
+ depends on HAS_IOMEM
+ help
+ This enables support for the Quad SPI controller in master mode.
+ This controller does not support generic SPI. It only supports
+ SPI NOR.
+
config SPI_INTEL_SPI
tristate

diff --git a/drivers/mtd/spi-nor/Makefile b/drivers/mtd/spi-nor/Makefile
index f4c61d2..7f4b6f6 100644
--- a/drivers/mtd/spi-nor/Makefile
+++ b/drivers/mtd/spi-nor/Makefile
@@ -5,7 +5,7 @@ obj-$(CONFIG_SPI_ATMEL_QUADSPI) += atmel-quadspi.o
obj-$(CONFIG_SPI_CADENCE_QUADSPI) += cadence-quadspi.o
obj-$(CONFIG_SPI_FSL_QUADSPI) += fsl-quadspi.o
obj-$(CONFIG_SPI_HISI_SFC) += hisi-sfc.o
-obj-$(CONFIG_MTD_MT81xx_NOR) += mtk-quadspi.o
+obj-$(CONFIG_SPI_MTK_QUADSPI) += mtk-quadspi.o
obj-$(CONFIG_SPI_NXP_SPIFI) += nxp-spifi.o
obj-$(CONFIG_SPI_INTEL_SPI) += intel-spi.o
obj-$(CONFIG_SPI_INTEL_SPI_PCI) += intel-spi-pci.o
--
1.9.1


2018-12-06 14:38:22

by Boris Brezillon

[permalink] [raw]
Subject: Re: [RESEND PATCH 2/4] mtd: spi-nor: mtk-quadspi: use ofpart for parsing partitions

On Thu, 29 Nov 2018 14:29:54 +0800
Ryder Lee <[email protected]> wrote:

> From: Guochun Mao <[email protected]>
>
> Replace mtd_device_register with mtd_device_parse_register for
> parsing partitions and add ofpart support.

What's the problem with the default partition parser table [1]?

[1]https://elixir.bootlin.com/linux/latest/source/drivers/mtd/mtdpart.c#L793

2018-12-07 05:45:15

by Guochun Mao

[permalink] [raw]
Subject: Re: [RESEND PATCH 2/4] mtd: spi-nor: mtk-quadspi: use ofpart for parsing partitions

On Thu, 2018-12-06 at 15:36 +0100, Boris Brezillon wrote:
> On Thu, 29 Nov 2018 14:29:54 +0800
> Ryder Lee <[email protected]> wrote:
>
> > From: Guochun Mao <[email protected]>
> >
> > Replace mtd_device_register with mtd_device_parse_register for
> > parsing partitions and add ofpart support.
>
> What's the problem with the default partition parser table [1]?
>
> [1]https://elixir.bootlin.com/linux/latest/source/drivers/mtd/mtdpart.c#L793

No problem here.
This patch can be dropped.
Please help review others.

Thanks.



2018-12-11 22:48:42

by Rob Herring

[permalink] [raw]
Subject: Re: [RESEND PATCH 1/4] dt-bindings: mtd: mtk-quadspi: update bindings for MT7629 SoC

On Thu, 29 Nov 2018 14:29:53 +0800, Ryder Lee wrote:
> This updates bindings for the MT7629 SPI-NOR controller.
>
> Signed-off-by: Ryder Lee <[email protected]>
> ---
> Documentation/devicetree/bindings/mtd/mtk-quadspi.txt | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>

Reviewed-by: Rob Herring <[email protected]>