All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-03-30 14:30 ` Sekhar Nori
  0 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2018-03-30 14:30 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Richard Weinberger, David Woodhouse, Brian Norris, Marek Vasut,
	Cyrille Pitchen, Sekhar Nori, linux-mtd, linux-kernel,
	Linux ARM Mailing List, David Lechner, Bartosz Golaszewski

NAND itself is an asynchronous interface, it does not have any
clock input. DaVinci NAND driver acquires clock for AEMIF
(asynchronous external memory interface) which is an on-chip
IP to which NAND is connected.

The same clock is also enabled in AEMIF driver (either present
drivers/memory or from machine code for some older platforms).
AEMIF timing must be initialized before NAND can be accessed.
This ensures that AEMIF clock is enabled too.

Remove the superfluous clock acquisition and enable in DaVinci
NAND driver.

Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
boot and DM644x EVM in legacy boot.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
Hi Boris,

If/when this patch gets accepted, it will nice to put this on
an immutable branch others can merge. There is potential cleanup
in drivers/clock and in DaVinci machine code that will depend
on this.

Thanks,
Sekhar

 drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 0f09518d980f..7255a0d94374 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -27,7 +27,6 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
-#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
@@ -55,7 +54,6 @@ struct davinci_nand_info {
 	struct nand_chip	chip;
 
 	struct device		*dev;
-	struct clk		*clk;
 
 	bool			is_readmode;
 
@@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	/* Use board-specific ECC config */
 	info->chip.ecc.mode	= pdata->ecc_mode;
 
-	ret = -EINVAL;
-
-	info->clk = devm_clk_get(&pdev->dev, "aemif");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
-		return ret;
-	}
-
-	ret = clk_prepare_enable(info->clk);
-	if (ret < 0) {
-		dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
-			ret);
-		goto err_clk_enable;
-	}
-
 	spin_lock_irq(&davinci_nand_lock);
 
 	/* put CSxNAND into NAND mode */
@@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
 	if (ret < 0) {
 		dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
-		goto err;
+		return ret;
 	}
 
 	switch (info->chip.ecc.mode) {
@@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	nand_cleanup(&info->chip);
 
 err:
-	clk_disable_unprepare(info->clk);
-
-err_clk_enable:
 	spin_lock_irq(&davinci_nand_lock);
 	if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
 		ecc4_busy = false;
@@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
 
 	nand_release(nand_to_mtd(&info->chip));
 
-	clk_disable_unprepare(info->clk);
-
 	return 0;
 }
 
-- 
2.16.2

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

* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-03-30 14:30 ` Sekhar Nori
  0 siblings, 0 replies; 10+ messages in thread
From: Sekhar Nori @ 2018-03-30 14:30 UTC (permalink / raw)
  To: linux-arm-kernel

NAND itself is an asynchronous interface, it does not have any
clock input. DaVinci NAND driver acquires clock for AEMIF
(asynchronous external memory interface) which is an on-chip
IP to which NAND is connected.

The same clock is also enabled in AEMIF driver (either present
drivers/memory or from machine code for some older platforms).
AEMIF timing must be initialized before NAND can be accessed.
This ensures that AEMIF clock is enabled too.

Remove the superfluous clock acquisition and enable in DaVinci
NAND driver.

Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
boot and DM644x EVM in legacy boot.

Signed-off-by: Sekhar Nori <nsekhar@ti.com>
---
Hi Boris,

If/when this patch gets accepted, it will nice to put this on
an immutable branch others can merge. There is potential cleanup
in drivers/clock and in DaVinci machine code that will depend
on this.

Thanks,
Sekhar

 drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 0f09518d980f..7255a0d94374 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -27,7 +27,6 @@
 #include <linux/module.h>
 #include <linux/platform_device.h>
 #include <linux/err.h>
-#include <linux/clk.h>
 #include <linux/io.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
@@ -55,7 +54,6 @@ struct davinci_nand_info {
 	struct nand_chip	chip;
 
 	struct device		*dev;
-	struct clk		*clk;
 
 	bool			is_readmode;
 
@@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	/* Use board-specific ECC config */
 	info->chip.ecc.mode	= pdata->ecc_mode;
 
-	ret = -EINVAL;
-
-	info->clk = devm_clk_get(&pdev->dev, "aemif");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
-		return ret;
-	}
-
-	ret = clk_prepare_enable(info->clk);
-	if (ret < 0) {
-		dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
-			ret);
-		goto err_clk_enable;
-	}
-
 	spin_lock_irq(&davinci_nand_lock);
 
 	/* put CSxNAND into NAND mode */
@@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
 	if (ret < 0) {
 		dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
-		goto err;
+		return ret;
 	}
 
 	switch (info->chip.ecc.mode) {
@@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
 	nand_cleanup(&info->chip);
 
 err:
-	clk_disable_unprepare(info->clk);
-
-err_clk_enable:
 	spin_lock_irq(&davinci_nand_lock);
 	if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
 		ecc4_busy = false;
@@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
 
 	nand_release(nand_to_mtd(&info->chip));
 
-	clk_disable_unprepare(info->clk);
-
 	return 0;
 }
 
-- 
2.16.2

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

* Re: [PATCH] mtd: nand: davinci: don't acquire and enable clock
  2018-03-30 14:30 ` Sekhar Nori
@ 2018-04-02  7:01   ` Boris Brezillon
  -1 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-02  7:01 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: David Lechner, Bartosz Golaszewski, Richard Weinberger,
	linux-kernel, Marek Vasut, linux-mtd, Cyrille Pitchen,
	Brian Norris, David Woodhouse, Linux ARM Mailing List

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted,

I'll probably queue it just after v4.17-rc1 is out if nobody complains
about the change.

> it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.

Sure, I can do that. 

-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-04-02  7:01   ` Boris Brezillon
  0 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-02  7:01 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted,

I'll probably queue it just after v4.17-rc1 is out if nobody complains
about the change.

> it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.

Sure, I can do that. 

-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH] mtd: nand: davinci: don't acquire and enable clock
  2018-03-30 14:30 ` Sekhar Nori
@ 2018-04-02  7:03   ` Boris Brezillon
  -1 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-02  7:03 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: David Lechner, Bartosz Golaszewski, Richard Weinberger,
	linux-kernel, Marek Vasut, linux-mtd, Cyrille Pitchen,
	Brian Norris, David Woodhouse, Linux ARM Mailing List

Oh, one more thing: now that we moved parallel/raw NAND code in the raw
subdir, the subject prefix should be "mtd: rawnand: <driver>: ". No need
to send a new version for that, I'll fix it when applying, just wanted
to let you know.

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.
> 
> Thanks,
> Sekhar
> 
>  drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 0f09518d980f..7255a0d94374 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -27,7 +27,6 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/err.h>
> -#include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/mtd/rawnand.h>
>  #include <linux/mtd/partitions.h>
> @@ -55,7 +54,6 @@ struct davinci_nand_info {
>  	struct nand_chip	chip;
>  
>  	struct device		*dev;
> -	struct clk		*clk;
>  
>  	bool			is_readmode;
>  
> @@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	/* Use board-specific ECC config */
>  	info->chip.ecc.mode	= pdata->ecc_mode;
>  
> -	ret = -EINVAL;
> -
> -	info->clk = devm_clk_get(&pdev->dev, "aemif");
> -	if (IS_ERR(info->clk)) {
> -		ret = PTR_ERR(info->clk);
> -		dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
> -		return ret;
> -	}
> -
> -	ret = clk_prepare_enable(info->clk);
> -	if (ret < 0) {
> -		dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
> -			ret);
> -		goto err_clk_enable;
> -	}
> -
>  	spin_lock_irq(&davinci_nand_lock);
>  
>  	/* put CSxNAND into NAND mode */
> @@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
>  	if (ret < 0) {
>  		dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
> -		goto err;
> +		return ret;
>  	}
>  
>  	switch (info->chip.ecc.mode) {
> @@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	nand_cleanup(&info->chip);
>  
>  err:
> -	clk_disable_unprepare(info->clk);
> -
> -err_clk_enable:
>  	spin_lock_irq(&davinci_nand_lock);
>  	if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
>  		ecc4_busy = false;
> @@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
>  
>  	nand_release(nand_to_mtd(&info->chip));
>  
> -	clk_disable_unprepare(info->clk);
> -
>  	return 0;
>  }
>  



-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-04-02  7:03   ` Boris Brezillon
  0 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-02  7:03 UTC (permalink / raw)
  To: linux-arm-kernel

Oh, one more thing: now that we moved parallel/raw NAND code in the raw
subdir, the subject prefix should be "mtd: rawnand: <driver>: ". No need
to send a new version for that, I'll fix it when applying, just wanted
to let you know.

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.
> 
> Thanks,
> Sekhar
> 
>  drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
> 
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 0f09518d980f..7255a0d94374 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -27,7 +27,6 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/err.h>
> -#include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/mtd/rawnand.h>
>  #include <linux/mtd/partitions.h>
> @@ -55,7 +54,6 @@ struct davinci_nand_info {
>  	struct nand_chip	chip;
>  
>  	struct device		*dev;
> -	struct clk		*clk;
>  
>  	bool			is_readmode;
>  
> @@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	/* Use board-specific ECC config */
>  	info->chip.ecc.mode	= pdata->ecc_mode;
>  
> -	ret = -EINVAL;
> -
> -	info->clk = devm_clk_get(&pdev->dev, "aemif");
> -	if (IS_ERR(info->clk)) {
> -		ret = PTR_ERR(info->clk);
> -		dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
> -		return ret;
> -	}
> -
> -	ret = clk_prepare_enable(info->clk);
> -	if (ret < 0) {
> -		dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
> -			ret);
> -		goto err_clk_enable;
> -	}
> -
>  	spin_lock_irq(&davinci_nand_lock);
>  
>  	/* put CSxNAND into NAND mode */
> @@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
>  	if (ret < 0) {
>  		dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
> -		goto err;
> +		return ret;
>  	}
>  
>  	switch (info->chip.ecc.mode) {
> @@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  	nand_cleanup(&info->chip);
>  
>  err:
> -	clk_disable_unprepare(info->clk);
> -
> -err_clk_enable:
>  	spin_lock_irq(&davinci_nand_lock);
>  	if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
>  		ecc4_busy = false;
> @@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
>  
>  	nand_release(nand_to_mtd(&info->chip));
>  
> -	clk_disable_unprepare(info->clk);
> -
>  	return 0;
>  }
>  



-- 
Boris Brezillon, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH] mtd: nand: davinci: don't acquire and enable clock
  2018-03-30 14:30 ` Sekhar Nori
@ 2018-04-25  8:53   ` Bartosz Golaszewski
  -1 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  8:53 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: Boris Brezillon, Richard Weinberger, David Woodhouse,
	Brian Norris, Marek Vasut, Cyrille Pitchen, linux-mtd,
	Linux Kernel Mailing List, Linux ARM Mailing List, David Lechner,
	Bartosz Golaszewski

2018-03-30 16:30 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
>
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
>
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
>
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
>
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.
>
> Thanks,
> Sekhar
>
>  drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 0f09518d980f..7255a0d94374 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -27,7 +27,6 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/err.h>
> -#include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/mtd/rawnand.h>
>  #include <linux/mtd/partitions.h>
> @@ -55,7 +54,6 @@ struct davinci_nand_info {
>         struct nand_chip        chip;
>
>         struct device           *dev;
> -       struct clk              *clk;
>
>         bool                    is_readmode;
>
> @@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         /* Use board-specific ECC config */
>         info->chip.ecc.mode     = pdata->ecc_mode;
>
> -       ret = -EINVAL;
> -
> -       info->clk = devm_clk_get(&pdev->dev, "aemif");
> -       if (IS_ERR(info->clk)) {
> -               ret = PTR_ERR(info->clk);
> -               dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
> -               return ret;
> -       }
> -
> -       ret = clk_prepare_enable(info->clk);
> -       if (ret < 0) {
> -               dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
> -                       ret);
> -               goto err_clk_enable;
> -       }
> -
>         spin_lock_irq(&davinci_nand_lock);
>
>         /* put CSxNAND into NAND mode */
> @@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
>         if (ret < 0) {
>                 dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
> -               goto err;
> +               return ret;
>         }
>
>         switch (info->chip.ecc.mode) {
> @@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         nand_cleanup(&info->chip);
>
>  err:
> -       clk_disable_unprepare(info->clk);
> -
> -err_clk_enable:
>         spin_lock_irq(&davinci_nand_lock);
>         if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
>                 ecc4_busy = false;
> @@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
>
>         nand_release(nand_to_mtd(&info->chip));
>
> -       clk_disable_unprepare(info->clk);
> -
>         return 0;
>  }
>
> --
> 2.16.2
>

Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-04-25  8:53   ` Bartosz Golaszewski
  0 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2018-04-25  8:53 UTC (permalink / raw)
  To: linux-arm-kernel

2018-03-30 16:30 GMT+02:00 Sekhar Nori <nsekhar@ti.com>:
> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
>
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
>
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
>
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
>
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
>
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.
>
> Thanks,
> Sekhar
>
>  drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
>  1 file changed, 1 insertion(+), 24 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 0f09518d980f..7255a0d94374 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -27,7 +27,6 @@
>  #include <linux/module.h>
>  #include <linux/platform_device.h>
>  #include <linux/err.h>
> -#include <linux/clk.h>
>  #include <linux/io.h>
>  #include <linux/mtd/rawnand.h>
>  #include <linux/mtd/partitions.h>
> @@ -55,7 +54,6 @@ struct davinci_nand_info {
>         struct nand_chip        chip;
>
>         struct device           *dev;
> -       struct clk              *clk;
>
>         bool                    is_readmode;
>
> @@ -703,22 +701,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         /* Use board-specific ECC config */
>         info->chip.ecc.mode     = pdata->ecc_mode;
>
> -       ret = -EINVAL;
> -
> -       info->clk = devm_clk_get(&pdev->dev, "aemif");
> -       if (IS_ERR(info->clk)) {
> -               ret = PTR_ERR(info->clk);
> -               dev_dbg(&pdev->dev, "unable to get AEMIF clock, err %d\n", ret);
> -               return ret;
> -       }
> -
> -       ret = clk_prepare_enable(info->clk);
> -       if (ret < 0) {
> -               dev_dbg(&pdev->dev, "unable to enable AEMIF clock, err %d\n",
> -                       ret);
> -               goto err_clk_enable;
> -       }
> -
>         spin_lock_irq(&davinci_nand_lock);
>
>         /* put CSxNAND into NAND mode */
> @@ -732,7 +714,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         ret = nand_scan_ident(mtd, pdata->mask_chipsel ? 2 : 1, NULL);
>         if (ret < 0) {
>                 dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
> -               goto err;
> +               return ret;
>         }
>
>         switch (info->chip.ecc.mode) {
> @@ -838,9 +820,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
>         nand_cleanup(&info->chip);
>
>  err:
> -       clk_disable_unprepare(info->clk);
> -
> -err_clk_enable:
>         spin_lock_irq(&davinci_nand_lock);
>         if (info->chip.ecc.mode == NAND_ECC_HW_SYNDROME)
>                 ecc4_busy = false;
> @@ -859,8 +838,6 @@ static int nand_davinci_remove(struct platform_device *pdev)
>
>         nand_release(nand_to_mtd(&info->chip));
>
> -       clk_disable_unprepare(info->clk);
> -
>         return 0;
>  }
>
> --
> 2.16.2
>

Tested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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

* Re: [PATCH] mtd: nand: davinci: don't acquire and enable clock
  2018-03-30 14:30 ` Sekhar Nori
@ 2018-04-26 18:01   ` Boris Brezillon
  -1 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-26 18:01 UTC (permalink / raw)
  To: Sekhar Nori
  Cc: David Lechner, Bartosz Golaszewski, Richard Weinberger,
	linux-kernel, Marek Vasut, linux-mtd, Cyrille Pitchen,
	Brian Norris, David Woodhouse, Linux ARM Mailing List

Hi Sekhar,

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.

I prepared the nand/davinci-clock tag for you to fetch if needed. I'll
merge it into the nand/next branch soon.

Thanks,

Boris 

The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:

  Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)

are available in the git repository at:

  git://git.infradead.org/linux-mtd.git tags/nand/davinci-clock

for you to fetch changes up to a8e3923ab57192547ffad01d78939c5c0d5d0c30:

  mtd: rawnand: davinci: don't acquire and enable clock (2018-04-26 19:55:40 +0200)

----------------------------------------------------------------
Prepare things for davinci clk driver cleanup

----------------------------------------------------------------
Sekhar Nori (1):
      mtd: rawnand: davinci: don't acquire and enable clock

 drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

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

* [PATCH] mtd: nand: davinci: don't acquire and enable clock
@ 2018-04-26 18:01   ` Boris Brezillon
  0 siblings, 0 replies; 10+ messages in thread
From: Boris Brezillon @ 2018-04-26 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sekhar,

On Fri, 30 Mar 2018 20:00:51 +0530
Sekhar Nori <nsekhar@ti.com> wrote:

> NAND itself is an asynchronous interface, it does not have any
> clock input. DaVinci NAND driver acquires clock for AEMIF
> (asynchronous external memory interface) which is an on-chip
> IP to which NAND is connected.
> 
> The same clock is also enabled in AEMIF driver (either present
> drivers/memory or from machine code for some older platforms).
> AEMIF timing must be initialized before NAND can be accessed.
> This ensures that AEMIF clock is enabled too.
> 
> Remove the superfluous clock acquisition and enable in DaVinci
> NAND driver.
> 
> Tested on K2L, K2HK, K2E, DA850 EVM, DA850 LCDK in device-tree
> boot and DM644x EVM in legacy boot.
> 
> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
> ---
> Hi Boris,
> 
> If/when this patch gets accepted, it will nice to put this on
> an immutable branch others can merge. There is potential cleanup
> in drivers/clock and in DaVinci machine code that will depend
> on this.

I prepared the nand/davinci-clock tag for you to fetch if needed. I'll
merge it into the nand/next branch soon.

Thanks,

Boris 

The following changes since commit 60cc43fc888428bb2f18f08997432d426a243338:

  Linux 4.17-rc1 (2018-04-15 18:24:20 -0700)

are available in the git repository at:

  git://git.infradead.org/linux-mtd.git tags/nand/davinci-clock

for you to fetch changes up to a8e3923ab57192547ffad01d78939c5c0d5d0c30:

  mtd: rawnand: davinci: don't acquire and enable clock (2018-04-26 19:55:40 +0200)

----------------------------------------------------------------
Prepare things for davinci clk driver cleanup

----------------------------------------------------------------
Sekhar Nori (1):
      mtd: rawnand: davinci: don't acquire and enable clock

 drivers/mtd/nand/raw/davinci_nand.c | 25 +------------------------
 1 file changed, 1 insertion(+), 24 deletions(-)

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

end of thread, other threads:[~2018-04-26 18:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-30 14:30 [PATCH] mtd: nand: davinci: don't acquire and enable clock Sekhar Nori
2018-03-30 14:30 ` Sekhar Nori
2018-04-02  7:01 ` Boris Brezillon
2018-04-02  7:01   ` Boris Brezillon
2018-04-02  7:03 ` Boris Brezillon
2018-04-02  7:03   ` Boris Brezillon
2018-04-25  8:53 ` Bartosz Golaszewski
2018-04-25  8:53   ` Bartosz Golaszewski
2018-04-26 18:01 ` Boris Brezillon
2018-04-26 18:01   ` 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.