All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-10  6:14 ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Nicolas Ferre, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Boris Brezillon, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Alexandre Belloni,
	Jean-Christophe Plagniol-Villard, Josh Wu

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled.
But if HSMC clock is controlled by NFC, so disable NFC will also disable
the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When
nand driver probed, it will check whether the chip has HSMC, if yes then
it will require a HSMC clock.

Signed-off-by: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---

 .../devicetree/bindings/mtd/atmel-nand.txt         |  4 +-
 drivers/mtd/nand/atmel_nand.c                      | 49 ++++++++++++----------
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 7d4c8eb..955a793 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -12,6 +12,7 @@ Required properties:
 - atmel,nand-cmd-offset : offset for the command latch.
 - #address-cells, #size-cells : Must be present if the device has sub-nodes
   representing partitions.
+- clocks: phandle to the peripheral clock
 
 - gpios : specifies the gpio pins to control the NAND device. detect is an
   optional gpio and may be set to 0 if not present.
@@ -38,7 +39,6 @@ Optional properties:
     - reg : should specify the address and size used for NFC command registers,
             NFC registers and NFC Sram. NFC Sram address and size can be absent
             if don't want to use it.
-    - clocks: phandle to the peripheral clock
   - Optional properties:
     - atmel,write-by-sram: boolean to enable NFC write by sram.
 
@@ -95,13 +95,13 @@ nand0: nand@40000000 {
 	compatible = "atmel,at91rm9200-nand";
 	#address-cells = <1>;
 	#size-cells = <1>;
+	clocks = <&hsmc_clk>
 	ranges;
         ...
         nfc@70000000 {
 		compatible = "atmel,sama5d3-nfc";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		clocks = <&hsmc_clk>
 		reg = <
 			0x70000000 0x10000000	/* NFC Command Registers */
 			0xffffc000 0x00000070	/* NFC HSMC regs */
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 336cc2d..9de9952 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -65,6 +65,7 @@ module_param(on_flash_bbt, int, 0);
 
 struct atmel_nand_caps {
 	bool pmecc_correct_erase_page;
+	bool has_hsmc_clk;
 };
 
 /* oob layout for large page size
@@ -101,8 +102,6 @@ struct atmel_nfc {
 	bool			use_nfc_sram;
 	bool			write_by_sram;
 
-	struct clk		*clk;
-
 	bool			is_initialized;
 	struct completion	comp_ready;
 	struct completion	comp_cmd_done;
@@ -127,6 +126,7 @@ struct atmel_nand_host {
 	struct dma_chan		*dma_chan;
 
 	struct atmel_nfc	*nfc;
+	struct clk		*clk;
 
 	struct atmel_nand_caps	*caps;
 	bool			has_pmecc;
@@ -2131,6 +2131,19 @@ static int atmel_nand_probe(struct platform_device *pdev)
 	nand_chip->IO_ADDR_R = host->io_base;
 	nand_chip->IO_ADDR_W = host->io_base;
 
+	if (host->caps->has_hsmc_clk) {
+		host->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(host->clk)) {
+			dev_err(&pdev->dev, "HSMC clock is missing, update your Device Tree");
+			res = PTR_ERR(host->clk);
+			goto err_nand_ioremap;
+		}
+
+		res = clk_prepare_enable(host->clk);
+		if (res)
+			goto err_nand_ioremap;
+	}
+
 	if (nand_nfc.is_initialized) {
 		/* NFC driver is probed and initialized */
 		host->nfc = &nand_nfc;
@@ -2296,6 +2309,9 @@ static int atmel_nand_remove(struct platform_device *pdev)
 	if (host->dma_chan)
 		dma_release_channel(host->dma_chan);
 
+	if (!IS_ERR(host->clk))
+		clk_disable_unprepare(host->clk);
+
 	platform_driver_unregister(&atmel_nand_nfc_driver);
 
 	return 0;
@@ -2303,14 +2319,22 @@ static int atmel_nand_remove(struct platform_device *pdev)
 
 static struct atmel_nand_caps at91rm9200_caps = {
 	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = false,
+};
+
+static struct atmel_nand_caps sama5d3_caps = {
+	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = true,
 };
 
 static struct atmel_nand_caps sama5d4_caps = {
 	.pmecc_correct_erase_page = true,
+	.has_hsmc_clk = true,
 };
 
 static const struct of_device_id atmel_nand_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-nand", .data = &at91rm9200_caps },
+	{ .compatible = "atmel,sama5d3-nand", .data = &sama5d3_caps },
 	{ .compatible = "atmel,sama5d4-nand", .data = &sama5d4_caps },
 	{ /* sentinel */ }
 };
@@ -2321,7 +2345,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 {
 	struct atmel_nfc *nfc = &nand_nfc;
 	struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram;
-	int ret;
 
 	nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs);
@@ -2354,31 +2377,12 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
 	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
 
-	nfc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (!IS_ERR(nfc->clk)) {
-		ret = clk_prepare_enable(nfc->clk);
-		if (ret)
-			return ret;
-	} else {
-		dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree");
-	}
-
 	nfc->is_initialized = true;
 	dev_info(&pdev->dev, "NFC is probed.\n");
 
 	return 0;
 }
 
-static int atmel_nand_nfc_remove(struct platform_device *pdev)
-{
-	struct atmel_nfc *nfc = &nand_nfc;
-
-	if (!IS_ERR(nfc->clk))
-		clk_disable_unprepare(nfc->clk);
-
-	return 0;
-}
-
 static const struct of_device_id atmel_nand_nfc_match[] = {
 	{ .compatible = "atmel,sama5d3-nfc" },
 	{ /* sentinel */ }
@@ -2391,7 +2395,6 @@ static struct platform_driver atmel_nand_nfc_driver = {
 		.of_match_table = of_match_ptr(atmel_nand_nfc_match),
 	},
 	.probe = atmel_nand_nfc_probe,
-	.remove = atmel_nand_nfc_remove,
 };
 
 static struct platform_driver atmel_nand_driver = {
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-10  6:14 ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd
  Cc: Mark Rutland, Boris Brezillon, Pawel Moll, devicetree,
	Ian Campbell, Nicolas Ferre, Josh Wu, Rob Herring,
	Alexandre Belloni, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled.
But if HSMC clock is controlled by NFC, so disable NFC will also disable
the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When
nand driver probed, it will check whether the chip has HSMC, if yes then
it will require a HSMC clock.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 .../devicetree/bindings/mtd/atmel-nand.txt         |  4 +-
 drivers/mtd/nand/atmel_nand.c                      | 49 ++++++++++++----------
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 7d4c8eb..955a793 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -12,6 +12,7 @@ Required properties:
 - atmel,nand-cmd-offset : offset for the command latch.
 - #address-cells, #size-cells : Must be present if the device has sub-nodes
   representing partitions.
+- clocks: phandle to the peripheral clock
 
 - gpios : specifies the gpio pins to control the NAND device. detect is an
   optional gpio and may be set to 0 if not present.
@@ -38,7 +39,6 @@ Optional properties:
     - reg : should specify the address and size used for NFC command registers,
             NFC registers and NFC Sram. NFC Sram address and size can be absent
             if don't want to use it.
-    - clocks: phandle to the peripheral clock
   - Optional properties:
     - atmel,write-by-sram: boolean to enable NFC write by sram.
 
@@ -95,13 +95,13 @@ nand0: nand@40000000 {
 	compatible = "atmel,at91rm9200-nand";
 	#address-cells = <1>;
 	#size-cells = <1>;
+	clocks = <&hsmc_clk>
 	ranges;
         ...
         nfc@70000000 {
 		compatible = "atmel,sama5d3-nfc";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		clocks = <&hsmc_clk>
 		reg = <
 			0x70000000 0x10000000	/* NFC Command Registers */
 			0xffffc000 0x00000070	/* NFC HSMC regs */
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 336cc2d..9de9952 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -65,6 +65,7 @@ module_param(on_flash_bbt, int, 0);
 
 struct atmel_nand_caps {
 	bool pmecc_correct_erase_page;
+	bool has_hsmc_clk;
 };
 
 /* oob layout for large page size
@@ -101,8 +102,6 @@ struct atmel_nfc {
 	bool			use_nfc_sram;
 	bool			write_by_sram;
 
-	struct clk		*clk;
-
 	bool			is_initialized;
 	struct completion	comp_ready;
 	struct completion	comp_cmd_done;
@@ -127,6 +126,7 @@ struct atmel_nand_host {
 	struct dma_chan		*dma_chan;
 
 	struct atmel_nfc	*nfc;
+	struct clk		*clk;
 
 	struct atmel_nand_caps	*caps;
 	bool			has_pmecc;
@@ -2131,6 +2131,19 @@ static int atmel_nand_probe(struct platform_device *pdev)
 	nand_chip->IO_ADDR_R = host->io_base;
 	nand_chip->IO_ADDR_W = host->io_base;
 
+	if (host->caps->has_hsmc_clk) {
+		host->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(host->clk)) {
+			dev_err(&pdev->dev, "HSMC clock is missing, update your Device Tree");
+			res = PTR_ERR(host->clk);
+			goto err_nand_ioremap;
+		}
+
+		res = clk_prepare_enable(host->clk);
+		if (res)
+			goto err_nand_ioremap;
+	}
+
 	if (nand_nfc.is_initialized) {
 		/* NFC driver is probed and initialized */
 		host->nfc = &nand_nfc;
@@ -2296,6 +2309,9 @@ static int atmel_nand_remove(struct platform_device *pdev)
 	if (host->dma_chan)
 		dma_release_channel(host->dma_chan);
 
+	if (!IS_ERR(host->clk))
+		clk_disable_unprepare(host->clk);
+
 	platform_driver_unregister(&atmel_nand_nfc_driver);
 
 	return 0;
@@ -2303,14 +2319,22 @@ static int atmel_nand_remove(struct platform_device *pdev)
 
 static struct atmel_nand_caps at91rm9200_caps = {
 	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = false,
+};
+
+static struct atmel_nand_caps sama5d3_caps = {
+	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = true,
 };
 
 static struct atmel_nand_caps sama5d4_caps = {
 	.pmecc_correct_erase_page = true,
+	.has_hsmc_clk = true,
 };
 
 static const struct of_device_id atmel_nand_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-nand", .data = &at91rm9200_caps },
+	{ .compatible = "atmel,sama5d3-nand", .data = &sama5d3_caps },
 	{ .compatible = "atmel,sama5d4-nand", .data = &sama5d4_caps },
 	{ /* sentinel */ }
 };
@@ -2321,7 +2345,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 {
 	struct atmel_nfc *nfc = &nand_nfc;
 	struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram;
-	int ret;
 
 	nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs);
@@ -2354,31 +2377,12 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
 	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
 
-	nfc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (!IS_ERR(nfc->clk)) {
-		ret = clk_prepare_enable(nfc->clk);
-		if (ret)
-			return ret;
-	} else {
-		dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree");
-	}
-
 	nfc->is_initialized = true;
 	dev_info(&pdev->dev, "NFC is probed.\n");
 
 	return 0;
 }
 
-static int atmel_nand_nfc_remove(struct platform_device *pdev)
-{
-	struct atmel_nfc *nfc = &nand_nfc;
-
-	if (!IS_ERR(nfc->clk))
-		clk_disable_unprepare(nfc->clk);
-
-	return 0;
-}
-
 static const struct of_device_id atmel_nand_nfc_match[] = {
 	{ .compatible = "atmel,sama5d3-nfc" },
 	{ /* sentinel */ }
@@ -2391,7 +2395,6 @@ static struct platform_driver atmel_nand_nfc_driver = {
 		.of_match_table = of_match_ptr(atmel_nand_nfc_match),
 	},
 	.probe = atmel_nand_nfc_probe,
-	.remove = atmel_nand_nfc_remove,
 };
 
 static struct platform_driver atmel_nand_driver = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-10  6:14 ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: linux-arm-kernel

Also add a new sama5d3_nand compatiable string for sama5d3 nand.

For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
HSMC clock enabled to work.
The NFC is a sub feature for current nand driver, it can be disabled.
But if HSMC clock is controlled by NFC, so disable NFC will also disable
the HSMC clock. then, it will make the PMECC fail to work.

So the solution is move the HSMC clock out of NFC to nand node. When
nand driver probed, it will check whether the chip has HSMC, if yes then
it will require a HSMC clock.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 .../devicetree/bindings/mtd/atmel-nand.txt         |  4 +-
 drivers/mtd/nand/atmel_nand.c                      | 49 ++++++++++++----------
 2 files changed, 28 insertions(+), 25 deletions(-)

diff --git a/Documentation/devicetree/bindings/mtd/atmel-nand.txt b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
index 7d4c8eb..955a793 100644
--- a/Documentation/devicetree/bindings/mtd/atmel-nand.txt
+++ b/Documentation/devicetree/bindings/mtd/atmel-nand.txt
@@ -12,6 +12,7 @@ Required properties:
 - atmel,nand-cmd-offset : offset for the command latch.
 - #address-cells, #size-cells : Must be present if the device has sub-nodes
   representing partitions.
+- clocks: phandle to the peripheral clock
 
 - gpios : specifies the gpio pins to control the NAND device. detect is an
   optional gpio and may be set to 0 if not present.
@@ -38,7 +39,6 @@ Optional properties:
     - reg : should specify the address and size used for NFC command registers,
             NFC registers and NFC Sram. NFC Sram address and size can be absent
             if don't want to use it.
-    - clocks: phandle to the peripheral clock
   - Optional properties:
     - atmel,write-by-sram: boolean to enable NFC write by sram.
 
@@ -95,13 +95,13 @@ nand0: nand at 40000000 {
 	compatible = "atmel,at91rm9200-nand";
 	#address-cells = <1>;
 	#size-cells = <1>;
+	clocks = <&hsmc_clk>
 	ranges;
         ...
         nfc at 70000000 {
 		compatible = "atmel,sama5d3-nfc";
 		#address-cells = <1>;
 		#size-cells = <1>;
-		clocks = <&hsmc_clk>
 		reg = <
 			0x70000000 0x10000000	/* NFC Command Registers */
 			0xffffc000 0x00000070	/* NFC HSMC regs */
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 336cc2d..9de9952 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -65,6 +65,7 @@ module_param(on_flash_bbt, int, 0);
 
 struct atmel_nand_caps {
 	bool pmecc_correct_erase_page;
+	bool has_hsmc_clk;
 };
 
 /* oob layout for large page size
@@ -101,8 +102,6 @@ struct atmel_nfc {
 	bool			use_nfc_sram;
 	bool			write_by_sram;
 
-	struct clk		*clk;
-
 	bool			is_initialized;
 	struct completion	comp_ready;
 	struct completion	comp_cmd_done;
@@ -127,6 +126,7 @@ struct atmel_nand_host {
 	struct dma_chan		*dma_chan;
 
 	struct atmel_nfc	*nfc;
+	struct clk		*clk;
 
 	struct atmel_nand_caps	*caps;
 	bool			has_pmecc;
@@ -2131,6 +2131,19 @@ static int atmel_nand_probe(struct platform_device *pdev)
 	nand_chip->IO_ADDR_R = host->io_base;
 	nand_chip->IO_ADDR_W = host->io_base;
 
+	if (host->caps->has_hsmc_clk) {
+		host->clk = devm_clk_get(&pdev->dev, NULL);
+		if (IS_ERR(host->clk)) {
+			dev_err(&pdev->dev, "HSMC clock is missing, update your Device Tree");
+			res = PTR_ERR(host->clk);
+			goto err_nand_ioremap;
+		}
+
+		res = clk_prepare_enable(host->clk);
+		if (res)
+			goto err_nand_ioremap;
+	}
+
 	if (nand_nfc.is_initialized) {
 		/* NFC driver is probed and initialized */
 		host->nfc = &nand_nfc;
@@ -2296,6 +2309,9 @@ static int atmel_nand_remove(struct platform_device *pdev)
 	if (host->dma_chan)
 		dma_release_channel(host->dma_chan);
 
+	if (!IS_ERR(host->clk))
+		clk_disable_unprepare(host->clk);
+
 	platform_driver_unregister(&atmel_nand_nfc_driver);
 
 	return 0;
@@ -2303,14 +2319,22 @@ static int atmel_nand_remove(struct platform_device *pdev)
 
 static struct atmel_nand_caps at91rm9200_caps = {
 	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = false,
+};
+
+static struct atmel_nand_caps sama5d3_caps = {
+	.pmecc_correct_erase_page = false,
+	.has_hsmc_clk = true,
 };
 
 static struct atmel_nand_caps sama5d4_caps = {
 	.pmecc_correct_erase_page = true,
+	.has_hsmc_clk = true,
 };
 
 static const struct of_device_id atmel_nand_dt_ids[] = {
 	{ .compatible = "atmel,at91rm9200-nand", .data = &at91rm9200_caps },
+	{ .compatible = "atmel,sama5d3-nand", .data = &sama5d3_caps },
 	{ .compatible = "atmel,sama5d4-nand", .data = &sama5d4_caps },
 	{ /* sentinel */ }
 };
@@ -2321,7 +2345,6 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 {
 	struct atmel_nfc *nfc = &nand_nfc;
 	struct resource *nfc_cmd_regs, *nfc_hsmc_regs, *nfc_sram;
-	int ret;
 
 	nfc_cmd_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	nfc->base_cmd_regs = devm_ioremap_resource(&pdev->dev, nfc_cmd_regs);
@@ -2354,31 +2377,12 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
 	nfc_writel(nfc->hsmc_regs, IDR, 0xffffffff);
 	nfc_readl(nfc->hsmc_regs, SR);	/* clear the NFC_SR */
 
-	nfc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (!IS_ERR(nfc->clk)) {
-		ret = clk_prepare_enable(nfc->clk);
-		if (ret)
-			return ret;
-	} else {
-		dev_warn(&pdev->dev, "NFC clock missing, update your Device Tree");
-	}
-
 	nfc->is_initialized = true;
 	dev_info(&pdev->dev, "NFC is probed.\n");
 
 	return 0;
 }
 
-static int atmel_nand_nfc_remove(struct platform_device *pdev)
-{
-	struct atmel_nfc *nfc = &nand_nfc;
-
-	if (!IS_ERR(nfc->clk))
-		clk_disable_unprepare(nfc->clk);
-
-	return 0;
-}
-
 static const struct of_device_id atmel_nand_nfc_match[] = {
 	{ .compatible = "atmel,sama5d3-nfc" },
 	{ /* sentinel */ }
@@ -2391,7 +2395,6 @@ static struct platform_driver atmel_nand_nfc_driver = {
 		.of_match_table = of_match_ptr(atmel_nand_nfc_match),
 	},
 	.probe = atmel_nand_nfc_probe,
-	.remove = atmel_nand_nfc_remove,
 };
 
 static struct platform_driver atmel_nand_driver = {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] ARM: at91: sama5/dts: move hsmc_clk out of nfc node
  2015-02-10  6:14 ` Josh Wu
  (?)
@ 2015-02-10  6:14     ` Josh Wu
  -1 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Nicolas Ferre, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Boris Brezillon, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Alexandre Belloni,
	Jean-Christophe Plagniol-Villard, Josh Wu

In sama5d3, sama5d4 chips, pmecc will use the hsmc clock. As pmecc is
part of HSMC. So move out hsmc_clk from nfc node to nand node.

Signed-off-by: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5f4144d..c0c3597 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1413,6 +1413,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand0_ale_cle>;
+			clocks = <&hsmc_clk>;
 			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			status = "disabled";
 
@@ -1425,7 +1426,6 @@
 					0xffffc000 0x00000070	/* NFC HSMC regs */
 					0x00200000 0x00100000	/* NFC SRAM banks */
 					>;
-				clocks = <&hsmc_clk>;
 			};
 		};
 	};
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index c3b07d9..9b2139a 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -281,6 +281,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand>;
+			clocks = <&hsmc_clk>;
 			status = "disabled";
 
 			nfc@90000000 {
@@ -292,7 +293,6 @@
 					0xfc05c000 0x00000070	/* NFC HSMC regs */
 					0x00100000 0x00100000	/* NFC SRAM banks */
                                          >;
-				clocks = <&hsmc_clk>;
 				atmel,write-by-sram;
 			};
 		};
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] ARM: at91: sama5/dts: move hsmc_clk out of nfc node
@ 2015-02-10  6:14     ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd
  Cc: Mark Rutland, Boris Brezillon, Pawel Moll, devicetree,
	Ian Campbell, Nicolas Ferre, Josh Wu, Rob Herring,
	Alexandre Belloni, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel

In sama5d3, sama5d4 chips, pmecc will use the hsmc clock. As pmecc is
part of HSMC. So move out hsmc_clk from nfc node to nand node.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5f4144d..c0c3597 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1413,6 +1413,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand0_ale_cle>;
+			clocks = <&hsmc_clk>;
 			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			status = "disabled";
 
@@ -1425,7 +1426,6 @@
 					0xffffc000 0x00000070	/* NFC HSMC regs */
 					0x00200000 0x00100000	/* NFC SRAM banks */
 					>;
-				clocks = <&hsmc_clk>;
 			};
 		};
 	};
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index c3b07d9..9b2139a 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -281,6 +281,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand>;
+			clocks = <&hsmc_clk>;
 			status = "disabled";
 
 			nfc@90000000 {
@@ -292,7 +293,6 @@
 					0xfc05c000 0x00000070	/* NFC HSMC regs */
 					0x00100000 0x00100000	/* NFC SRAM banks */
                                          >;
-				clocks = <&hsmc_clk>;
 				atmel,write-by-sram;
 			};
 		};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/3] ARM: at91: sama5/dts: move hsmc_clk out of nfc node
@ 2015-02-10  6:14     ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: linux-arm-kernel

In sama5d3, sama5d4 chips, pmecc will use the hsmc clock. As pmecc is
part of HSMC. So move out hsmc_clk from nfc node to nand node.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 arch/arm/boot/dts/sama5d4.dtsi | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index 5f4144d..c0c3597 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1413,6 +1413,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand0_ale_cle>;
+			clocks = <&hsmc_clk>;
 			atmel,pmecc-lookup-table-offset = <0x0 0x8000>;
 			status = "disabled";
 
@@ -1425,7 +1426,6 @@
 					0xffffc000 0x00000070	/* NFC HSMC regs */
 					0x00200000 0x00100000	/* NFC SRAM banks */
 					>;
-				clocks = <&hsmc_clk>;
 			};
 		};
 	};
diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
index c3b07d9..9b2139a 100644
--- a/arch/arm/boot/dts/sama5d4.dtsi
+++ b/arch/arm/boot/dts/sama5d4.dtsi
@@ -281,6 +281,7 @@
 			atmel,nand-has-dma;
 			pinctrl-names = "default";
 			pinctrl-0 = <&pinctrl_nand>;
+			clocks = <&hsmc_clk>;
 			status = "disabled";
 
 			nfc at 90000000 {
@@ -292,7 +293,6 @@
 					0xfc05c000 0x00000070	/* NFC HSMC regs */
 					0x00100000 0x00100000	/* NFC SRAM banks */
                                          >;
-				clocks = <&hsmc_clk>;
 				atmel,write-by-sram;
 			};
 		};
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] ARM: at91: sama5d3/dts: add sama5d3 compatiable string for nand
  2015-02-10  6:14 ` Josh Wu
  (?)
@ 2015-02-10  6:14     ` Josh Wu
  -1 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
  Cc: Nicolas Ferre, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Boris Brezillon, devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Alexandre Belloni,
	Jean-Christophe Plagniol-Villard, Josh Wu

As we introduce a new "atmel,sama5d3-nand" compatible string for
sama5d3, Apply it for sama5d3 chip.

Signed-off-by: Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index c0c3597..7b6c36f 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1398,7 +1398,7 @@
 		};
 
 		nand0: nand@60000000 {
-			compatible = "atmel,at91rm9200-nand";
+			compatible = "atmel,sama5d3-nand", "atmel,at91rm9200-nand";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] ARM: at91: sama5d3/dts: add sama5d3 compatiable string for nand
@ 2015-02-10  6:14     ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: Brian Norris, linux-mtd
  Cc: Mark Rutland, Boris Brezillon, Pawel Moll, devicetree,
	Ian Campbell, Nicolas Ferre, Josh Wu, Rob Herring,
	Alexandre Belloni, Jean-Christophe Plagniol-Villard,
	linux-arm-kernel

As we introduce a new "atmel,sama5d3-nand" compatible string for
sama5d3, Apply it for sama5d3 chip.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index c0c3597..7b6c36f 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1398,7 +1398,7 @@
 		};
 
 		nand0: nand@60000000 {
-			compatible = "atmel,at91rm9200-nand";
+			compatible = "atmel,sama5d3-nand", "atmel,at91rm9200-nand";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/3] ARM: at91: sama5d3/dts: add sama5d3 compatiable string for nand
@ 2015-02-10  6:14     ` Josh Wu
  0 siblings, 0 replies; 18+ messages in thread
From: Josh Wu @ 2015-02-10  6:14 UTC (permalink / raw)
  To: linux-arm-kernel

As we introduce a new "atmel,sama5d3-nand" compatible string for
sama5d3, Apply it for sama5d3 chip.

Signed-off-by: Josh Wu <josh.wu@atmel.com>
---

 arch/arm/boot/dts/sama5d3.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/sama5d3.dtsi b/arch/arm/boot/dts/sama5d3.dtsi
index c0c3597..7b6c36f 100644
--- a/arch/arm/boot/dts/sama5d3.dtsi
+++ b/arch/arm/boot/dts/sama5d3.dtsi
@@ -1398,7 +1398,7 @@
 		};
 
 		nand0: nand at 60000000 {
-			compatible = "atmel,at91rm9200-nand";
+			compatible = "atmel,sama5d3-nand", "atmel,at91rm9200-nand";
 			#address-cells = <1>;
 			#size-cells = <1>;
 			ranges;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
  2015-02-10  6:14 ` Josh Wu
  (?)
@ 2015-02-26  9:18     ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26  9:18 UTC (permalink / raw)
  To: Josh Wu
  Cc: Brian Norris, linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Nicolas Ferre, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Rob Herring, Pawel Moll,
	Mark Rutland, Ian Campbell, Alexandre Belloni,
	Jean-Christophe Plagniol-Villard

Hi Josh,

On Tue, 10 Feb 2015 14:14:43 +0800
Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> wrote:

> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> 
> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> HSMC clock enabled to work.
> The NFC is a sub feature for current nand driver, it can be disabled.
> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> the HSMC clock. then, it will make the PMECC fail to work.
> 
> So the solution is move the HSMC clock out of NFC to nand node. When
> nand driver probed, it will check whether the chip has HSMC, if yes then
> it will require a HSMC clock.

Do you plan to use the NAND chip without the NFC (I mean, is there a
reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the
NAND chip it is attached to, so that the hmsc clk is properly claimed.

I'm not convinced that moving a clk reference out of the controller
node can address the fact that the nand/nand-controller DT
representation is inappropriate (your embedding controller specific
information in your NAND chip definition).
I think we should reconsider this problem with a controller/chip
approach:
- which parts are representing the NAND controller: the PMECC engine,
  the NFC if available, ...
- which parts are representing the NAND chip: the EBI mem range, the
  R/B pin, the ALE/CLE information, ...

And of course, we should take the EBI/SMC rework into account ;-).

Best Regards,

Boris


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26  9:18     ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26  9:18 UTC (permalink / raw)
  To: Josh Wu
  Cc: Mark Rutland, devicetree, Pawel Moll, Ian Campbell,
	Nicolas Ferre, Rob Herring, linux-mtd, Alexandre Belloni,
	Brian Norris, Jean-Christophe Plagniol-Villard, linux-arm-kernel

Hi Josh,

On Tue, 10 Feb 2015 14:14:43 +0800
Josh Wu <josh.wu@atmel.com> wrote:

> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> 
> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> HSMC clock enabled to work.
> The NFC is a sub feature for current nand driver, it can be disabled.
> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> the HSMC clock. then, it will make the PMECC fail to work.
> 
> So the solution is move the HSMC clock out of NFC to nand node. When
> nand driver probed, it will check whether the chip has HSMC, if yes then
> it will require a HSMC clock.

Do you plan to use the NAND chip without the NFC (I mean, is there a
reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the
NAND chip it is attached to, so that the hmsc clk is properly claimed.

I'm not convinced that moving a clk reference out of the controller
node can address the fact that the nand/nand-controller DT
representation is inappropriate (your embedding controller specific
information in your NAND chip definition).
I think we should reconsider this problem with a controller/chip
approach:
- which parts are representing the NAND controller: the PMECC engine,
  the NFC if available, ...
- which parts are representing the NAND chip: the EBI mem range, the
  R/B pin, the ALE/CLE information, ...

And of course, we should take the EBI/SMC rework into account ;-).

Best Regards,

Boris


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26  9:18     ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26  9:18 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Josh,

On Tue, 10 Feb 2015 14:14:43 +0800
Josh Wu <josh.wu@atmel.com> wrote:

> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> 
> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> HSMC clock enabled to work.
> The NFC is a sub feature for current nand driver, it can be disabled.
> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> the HSMC clock. then, it will make the PMECC fail to work.
> 
> So the solution is move the HSMC clock out of NFC to nand node. When
> nand driver probed, it will check whether the chip has HSMC, if yes then
> it will require a HSMC clock.

Do you plan to use the NAND chip without the NFC (I mean, is there a
reason for not using the NFC to access the NAND ?) ?
If you don't, why don't you just wait for the NFC before probing the
NAND chip it is attached to, so that the hmsc clk is properly claimed.

I'm not convinced that moving a clk reference out of the controller
node can address the fact that the nand/nand-controller DT
representation is inappropriate (your embedding controller specific
information in your NAND chip definition).
I think we should reconsider this problem with a controller/chip
approach:
- which parts are representing the NAND controller: the PMECC engine,
  the NFC if available, ...
- which parts are representing the NAND chip: the EBI mem range, the
  R/B pin, the ALE/CLE information, ...

And of course, we should take the EBI/SMC rework into account ;-).

Best Regards,

Boris


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
  2015-02-26  9:18     ` Boris Brezillon
  (?)
@ 2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
  -1 siblings, 0 replies; 18+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-02-26 11:49 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Jean-Christophe PLAGNIOL-VILLARD, Josh Wu, Mark Rutland,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Ian Campbell,
	Nicolas FERRE, Rob Herring,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni,
	Brian Norris, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r


> On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> 
> Hi Josh,
> 
> On Tue, 10 Feb 2015 14:14:43 +0800
> Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> wrote:
> 
>> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
>> 
>> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
>> HSMC clock enabled to work.
>> The NFC is a sub feature for current nand driver, it can be disabled.
>> But if HSMC clock is controlled by NFC, so disable NFC will also disable
>> the HSMC clock. then, it will make the PMECC fail to work.
>> 
>> So the solution is move the HSMC clock out of NFC to nand node. When
>> nand driver probed, it will check whether the chip has HSMC, if yes then
>> it will require a HSMC clock.
> 
> Do you plan to use the NAND chip without the NFC (I mean, is there a
> reason for not using the NFC to access the NAND ?) ?
> If you don't, why don't you just wait for the NFC before probing the
> NAND chip it is attached to, so that the hmsc clk is properly claimed.
you can as you can have 2 Nand on the d3 but only 1 NFC

Best Regards,
J.
> 
> I'm not convinced that moving a clk reference out of the controller
> node can address the fact that the nand/nand-controller DT
> representation is inappropriate (your embedding controller specific
> information in your NAND chip definition).
> I think we should reconsider this problem with a controller/chip
> approach:
> - which parts are representing the NAND controller: the PMECC engine,
>  the NFC if available, ...
> - which parts are representing the NAND chip: the EBI mem range, the
>  R/B pin, the ALE/CLE information, ...
> 
> And of course, we should take the EBI/SMC rework into account ;-).
> 
> Best Regards,
> 
> Boris
> 
> 
> -- 
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 18+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-02-26 11:49 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Mark Rutland, devicetree, Pawel Moll, Ian Campbell,
	Nicolas FERRE, Josh Wu, Rob Herring, linux-mtd,
	Alexandre Belloni, Brian Norris,
	Jean-Christophe PLAGNIOL-VILLARD, linux-arm-kernel


> On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> 
> Hi Josh,
> 
> On Tue, 10 Feb 2015 14:14:43 +0800
> Josh Wu <josh.wu@atmel.com> wrote:
> 
>> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
>> 
>> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
>> HSMC clock enabled to work.
>> The NFC is a sub feature for current nand driver, it can be disabled.
>> But if HSMC clock is controlled by NFC, so disable NFC will also disable
>> the HSMC clock. then, it will make the PMECC fail to work.
>> 
>> So the solution is move the HSMC clock out of NFC to nand node. When
>> nand driver probed, it will check whether the chip has HSMC, if yes then
>> it will require a HSMC clock.
> 
> Do you plan to use the NAND chip without the NFC (I mean, is there a
> reason for not using the NFC to access the NAND ?) ?
> If you don't, why don't you just wait for the NFC before probing the
> NAND chip it is attached to, so that the hmsc clk is properly claimed.
you can as you can have 2 Nand on the d3 but only 1 NFC

Best Regards,
J.
> 
> I'm not convinced that moving a clk reference out of the controller
> node can address the fact that the nand/nand-controller DT
> representation is inappropriate (your embedding controller specific
> information in your NAND chip definition).
> I think we should reconsider this problem with a controller/chip
> approach:
> - which parts are representing the NAND controller: the PMECC engine,
>  the NFC if available, ...
> - which parts are representing the NAND chip: the EBI mem range, the
>  R/B pin, the ALE/CLE information, ...
> 
> And of course, we should take the EBI/SMC rework into account ;-).
> 
> Best Regards,
> 
> Boris
> 
> 
> -- 
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 18+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2015-02-26 11:49 UTC (permalink / raw)
  To: linux-arm-kernel


> On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> 
> Hi Josh,
> 
> On Tue, 10 Feb 2015 14:14:43 +0800
> Josh Wu <josh.wu@atmel.com> wrote:
> 
>> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
>> 
>> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
>> HSMC clock enabled to work.
>> The NFC is a sub feature for current nand driver, it can be disabled.
>> But if HSMC clock is controlled by NFC, so disable NFC will also disable
>> the HSMC clock. then, it will make the PMECC fail to work.
>> 
>> So the solution is move the HSMC clock out of NFC to nand node. When
>> nand driver probed, it will check whether the chip has HSMC, if yes then
>> it will require a HSMC clock.
> 
> Do you plan to use the NAND chip without the NFC (I mean, is there a
> reason for not using the NFC to access the NAND ?) ?
> If you don't, why don't you just wait for the NFC before probing the
> NAND chip it is attached to, so that the hmsc clk is properly claimed.
you can as you can have 2 Nand on the d3 but only 1 NFC

Best Regards,
J.
> 
> I'm not convinced that moving a clk reference out of the controller
> node can address the fact that the nand/nand-controller DT
> representation is inappropriate (your embedding controller specific
> information in your NAND chip definition).
> I think we should reconsider this problem with a controller/chip
> approach:
> - which parts are representing the NAND controller: the PMECC engine,
>  the NFC if available, ...
> - which parts are representing the NAND chip: the EBI mem range, the
>  R/B pin, the ALE/CLE information, ...
> 
> And of course, we should take the EBI/SMC rework into account ;-).
> 
> Best Regards,
> 
> Boris
> 
> 
> -- 
> Boris Brezillon, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
  2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
  (?)
@ 2015-02-26 12:57           ` Boris Brezillon
  -1 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26 12:57 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Josh Wu, Mark Rutland, devicetree-u79uwXL29TY76Z2rM5mHXA,
	Pawel Moll, Ian Campbell, Nicolas FERRE, Rob Herring,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Alexandre Belloni,
	Brian Norris, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Jean-Christophe,

On Thu, 26 Feb 2015 19:49:09 +0800
Jean-Christophe PLAGNIOL-VILLARD <plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org> wrote:

> 
> > On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org> wrote:
> > 
> > Hi Josh,
> > 
> > On Tue, 10 Feb 2015 14:14:43 +0800
> > Josh Wu <josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org> wrote:
> > 
> >> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> >> 
> >> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> >> HSMC clock enabled to work.
> >> The NFC is a sub feature for current nand driver, it can be disabled.
> >> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> >> the HSMC clock. then, it will make the PMECC fail to work.
> >> 
> >> So the solution is move the HSMC clock out of NFC to nand node. When
> >> nand driver probed, it will check whether the chip has HSMC, if yes then
> >> it will require a HSMC clock.
> > 
> > Do you plan to use the NAND chip without the NFC (I mean, is there a
> > reason for not using the NFC to access the NAND ?) ?
> > If you don't, why don't you just wait for the NFC before probing the
> > NAND chip it is attached to, so that the hmsc clk is properly claimed.
> you can as you can have 2 Nand on the d3 but only 1 NFC

I don't get your point ?
You can control several NAND chips with the same NFC.

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26 12:57           ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26 12:57 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD
  Cc: Mark Rutland, devicetree, Pawel Moll, Ian Campbell,
	Nicolas FERRE, Josh Wu, Rob Herring, linux-mtd,
	Alexandre Belloni, Brian Norris, linux-arm-kernel

Hi Jean-Christophe,

On Thu, 26 Feb 2015 19:49:09 +0800
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:

> 
> > On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> > 
> > Hi Josh,
> > 
> > On Tue, 10 Feb 2015 14:14:43 +0800
> > Josh Wu <josh.wu@atmel.com> wrote:
> > 
> >> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> >> 
> >> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> >> HSMC clock enabled to work.
> >> The NFC is a sub feature for current nand driver, it can be disabled.
> >> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> >> the HSMC clock. then, it will make the PMECC fail to work.
> >> 
> >> So the solution is move the HSMC clock out of NFC to nand node. When
> >> nand driver probed, it will check whether the chip has HSMC, if yes then
> >> it will require a HSMC clock.
> > 
> > Do you plan to use the NAND chip without the NFC (I mean, is there a
> > reason for not using the NFC to access the NAND ?) ?
> > If you don't, why don't you just wait for the NFC before probing the
> > NAND chip it is attached to, so that the hmsc clk is properly claimed.
> you can as you can have 2 Nand on the d3 but only 1 NFC

I don't get your point ?
You can control several NAND chips with the same NFC.

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node
@ 2015-02-26 12:57           ` Boris Brezillon
  0 siblings, 0 replies; 18+ messages in thread
From: Boris Brezillon @ 2015-02-26 12:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jean-Christophe,

On Thu, 26 Feb 2015 19:49:09 +0800
Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> wrote:

> 
> > On Feb 26, 2015, at 5:18 PM, Boris Brezillon <boris.brezillon@free-electrons.com> wrote:
> > 
> > Hi Josh,
> > 
> > On Tue, 10 Feb 2015 14:14:43 +0800
> > Josh Wu <josh.wu@atmel.com> wrote:
> > 
> >> Also add a new sama5d3_nand compatiable string for sama5d3 nand.
> >> 
> >> For sama5d3, sama5d4 chip, the pmecc became part of HSMC, they need the
> >> HSMC clock enabled to work.
> >> The NFC is a sub feature for current nand driver, it can be disabled.
> >> But if HSMC clock is controlled by NFC, so disable NFC will also disable
> >> the HSMC clock. then, it will make the PMECC fail to work.
> >> 
> >> So the solution is move the HSMC clock out of NFC to nand node. When
> >> nand driver probed, it will check whether the chip has HSMC, if yes then
> >> it will require a HSMC clock.
> > 
> > Do you plan to use the NAND chip without the NFC (I mean, is there a
> > reason for not using the NFC to access the NAND ?) ?
> > If you don't, why don't you just wait for the NFC before probing the
> > NAND chip it is attached to, so that the hmsc clk is properly claimed.
> you can as you can have 2 Nand on the d3 but only 1 NFC

I don't get your point ?
You can control several NAND chips with the same NFC.

-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-02-26 12:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-10  6:14 [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node Josh Wu
2015-02-10  6:14 ` Josh Wu
2015-02-10  6:14 ` Josh Wu
     [not found] ` <1423548885-27589-1-git-send-email-josh.wu-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
2015-02-10  6:14   ` [PATCH 2/3] ARM: at91: sama5/dts: move hsmc_clk out of nfc node Josh Wu
2015-02-10  6:14     ` Josh Wu
2015-02-10  6:14     ` Josh Wu
2015-02-10  6:14   ` [PATCH 3/3] ARM: at91: sama5d3/dts: add sama5d3 compatiable string for nand Josh Wu
2015-02-10  6:14     ` Josh Wu
2015-02-10  6:14     ` Josh Wu
2015-02-26  9:18   ` [PATCH 1/3] mtd: atmel_nand: move the hsmc_clk from nfc node to nand node Boris Brezillon
2015-02-26  9:18     ` Boris Brezillon
2015-02-26  9:18     ` Boris Brezillon
2015-02-26 11:49     ` Jean-Christophe PLAGNIOL-VILLARD
2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
2015-02-26 11:49       ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]       ` <C9CC8708-B99A-47F4-AC57-1A92B302E1C9-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2015-02-26 12:57         ` Boris Brezillon
2015-02-26 12:57           ` Boris Brezillon
2015-02-26 12:57           ` Boris Brezillon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.