diff mbox series

[4/5] mtd: rawnand: davinci: Add clock resource

Message ID 20241030104717.88688-5-bastien.curutchet@bootlin.com
State New
Headers show
Series Implement setup_inteface() in the DaVinci NAND controller | expand

Commit Message

Bastien Curutchet Oct. 30, 2024, 10:47 a.m. UTC
NAND controller has a reference clock but the driver doesn't use it.

Add a struct clock in the struct davinci_nand_info so it can be used
to compute timings.

Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
---
 drivers/mtd/nand/raw/davinci_nand.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Krzysztof Kozlowski Oct. 30, 2024, 11:17 a.m. UTC | #1
On 30/10/2024 11:47, Bastien Curutchet wrote:
> NAND controller has a reference clock but the driver doesn't use it.
> 
> Add a struct clock in the struct davinci_nand_info so it can be used
> to compute timings.
> 
> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
> ---
>  drivers/mtd/nand/raw/davinci_nand.c | 9 +++++++++

Where are the bindings?

>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
> index 3c0efbdd789e..11dc30c29957 100644
> --- a/drivers/mtd/nand/raw/davinci_nand.c
> +++ b/drivers/mtd/nand/raw/davinci_nand.c
> @@ -10,6 +10,7 @@
>   *   Dirk Behme <Dirk.Behme@gmail.com>
>   */
>  
> +#include <linux/clk.h>
>  #include <linux/err.h>
>  #include <linux/iopoll.h>
>  #include <linux/kernel.h>
> @@ -117,6 +118,8 @@ struct davinci_nand_info {
>  	uint32_t		mask_cle;
>  
>  	uint32_t		core_chipsel;
> +
> +	struct clk		*clk;
>  };
>  
>  static DEFINE_SPINLOCK(davinci_nand_lock);
> @@ -822,6 +825,12 @@ static int nand_davinci_probe(struct platform_device *pdev)
>  		return -EADDRNOTAVAIL;
>  	}
>  
> +	info->clk = devm_clk_get(&pdev->dev, "aemif");
> +	if (IS_ERR(info->clk)) {
> +		dev_err(&pdev->dev, "failed to get clock %ld", PTR_ERR(info->clk));

Syntax is return dev_err_probe.


Best regards,
Krzysztof
Bastien Curutchet Oct. 30, 2024, 12:20 p.m. UTC | #2
Hi Krzysztof,

On 10/30/24 12:17 PM, Krzysztof Kozlowski wrote:
> On 30/10/2024 11:47, Bastien Curutchet wrote:
>> NAND controller has a reference clock but the driver doesn't use it.
>>
>> Add a struct clock in the struct davinci_nand_info so it can be used
>> to compute timings.
>>
>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>> ---
>>   drivers/mtd/nand/raw/davinci_nand.c | 9 +++++++++
> 
> Where are the bindings?
> 

The NAND controller bindings are in 
Documentation/devicetree/bindings/mtd/davinci-nand.txt but this clock is 
defined in the AEMIF bindings in 
Documentation/devicetree/bindings/memory-controllers/ti-aemif.txt

>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
>> index 3c0efbdd789e..11dc30c29957 100644
>> --- a/drivers/mtd/nand/raw/davinci_nand.c
>> +++ b/drivers/mtd/nand/raw/davinci_nand.c
>> @@ -10,6 +10,7 @@
>>    *   Dirk Behme <Dirk.Behme@gmail.com>
>>    */
>>   
>> +#include <linux/clk.h>
>>   #include <linux/err.h>
>>   #include <linux/iopoll.h>
>>   #include <linux/kernel.h>
>> @@ -117,6 +118,8 @@ struct davinci_nand_info {
>>   	uint32_t		mask_cle;
>>   
>>   	uint32_t		core_chipsel;
>> +
>> +	struct clk		*clk;
>>   };
>>   
>>   static DEFINE_SPINLOCK(davinci_nand_lock);
>> @@ -822,6 +825,12 @@ static int nand_davinci_probe(struct platform_device *pdev)
>>   		return -EADDRNOTAVAIL;
>>   	}
>>   
>> +	info->clk = devm_clk_get(&pdev->dev, "aemif");
>> +	if (IS_ERR(info->clk)) {
>> +		dev_err(&pdev->dev, "failed to get clock %ld", PTR_ERR(info->clk));
> 
> Syntax is return dev_err_probe.
> 

Ok, I'll correct this in V2


Best regards,
Bastien
Krzysztof Kozlowski Oct. 30, 2024, 2:26 p.m. UTC | #3
On 30/10/2024 13:20, Bastien Curutchet wrote:
> Hi Krzysztof,
> 
> On 10/30/24 12:17 PM, Krzysztof Kozlowski wrote:
>> On 30/10/2024 11:47, Bastien Curutchet wrote:
>>> NAND controller has a reference clock but the driver doesn't use it.
>>>
>>> Add a struct clock in the struct davinci_nand_info so it can be used
>>> to compute timings.
>>>
>>> Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
>>> ---
>>>   drivers/mtd/nand/raw/davinci_nand.c | 9 +++++++++
>>
>> Where are the bindings?
>>
> 
> The NAND controller bindings are in 
> Documentation/devicetree/bindings/mtd/davinci-nand.txt but this clock is 
> defined in the AEMIF bindings in 
> Documentation/devicetree/bindings/memory-controllers/ti-aemif.txt

Mention this in commit msg so you get one reviewer question less...

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 3c0efbdd789e..11dc30c29957 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -10,6 +10,7 @@ 
  *   Dirk Behme <Dirk.Behme@gmail.com>
  */
 
+#include <linux/clk.h>
 #include <linux/err.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
@@ -117,6 +118,8 @@  struct davinci_nand_info {
 	uint32_t		mask_cle;
 
 	uint32_t		core_chipsel;
+
+	struct clk		*clk;
 };
 
 static DEFINE_SPINLOCK(davinci_nand_lock);
@@ -822,6 +825,12 @@  static int nand_davinci_probe(struct platform_device *pdev)
 		return -EADDRNOTAVAIL;
 	}
 
+	info->clk = devm_clk_get(&pdev->dev, "aemif");
+	if (IS_ERR(info->clk)) {
+		dev_err(&pdev->dev, "failed to get clock %ld", PTR_ERR(info->clk));
+		return PTR_ERR(info->clk);
+	}
+
 	info->pdev		= pdev;
 	info->base		= base;
 	info->vaddr		= vaddr;