mbox series

[v4,0/4] memory: omap-gpmc: Add AM64 SoC support

Message ID 20211221131757.2030-1-rogerq@kernel.org
Headers show
Series memory: omap-gpmc: Add AM64 SoC support | expand

Message

Roger Quadros Dec. 21, 2021, 1:17 p.m. UTC
Hi,

TI's AM64 SoC contains one GPMC module. Add driver support for it.

cheers,
-roger

Changelog:
v4
- move compatible match table to header file so it can be used by
GPMC driver even when NAND driver is not enabled or as a module.
GPMC driver is always enabled as built-in.
- Select OMAP_GPMC driver from MTD_NAND_OMAP2 driver config as
OMAP_GPMC is not essential for ARCH_K3 boot.

v3
- use compatible match table for checking for NAND controller node in
GPMC driver.

v2
- update DT binding doc to make reg-names and power-domains property
required only for specific SoC.

Roger Quadros (4):
  dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
  memory: omap-gpmc: Add support for GPMC on AM64 SoC
  memory: omap-gpmc: Use a compatible match table when checking for NAND
    controller
  mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3

 .../bindings/memory-controllers/ti,gpmc.yaml  | 23 +++++++++-
 drivers/memory/omap-gpmc.c                    | 46 ++++++++++++++-----
 drivers/mtd/nand/raw/Kconfig                  |  1 +
 drivers/mtd/nand/raw/omap2.c                  |  5 +-
 include/linux/platform_data/mtd-nand-omap2.h  |  9 +++-
 5 files changed, 67 insertions(+), 17 deletions(-)

Comments

Roger Quadros Dec. 21, 2021, 8:01 p.m. UTC | #1
Hi Miquel,

On 21/12/2021 15:17, Roger Quadros wrote:
> As more compatibles can be added to the GPMC NAND controller driver
> use a compatible match table.
> 
> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> Signed-off-by: Roger Quadros <rogerq@kernel.org>
> ---
>  drivers/memory/omap-gpmc.c                   | 6 +++++-
>  drivers/mtd/nand/raw/omap2.c                 | 5 +----

Will need your Ack for this one as well. Thanks :)


>  include/linux/platform_data/mtd-nand-omap2.h | 9 ++++++++-
>  3 files changed, 14 insertions(+), 6 deletions(-)

cheers,
-roger

> 
> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> index 624153048182..d19ffc895e5b 100644
> --- a/drivers/memory/omap-gpmc.c
> +++ b/drivers/memory/omap-gpmc.c
> @@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>  	u32 val;
>  	struct gpio_desc *waitpin_desc = NULL;
>  	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
> +	bool is_nand = false;
>  
>  	if (of_property_read_u32(child, "reg", &cs) < 0) {
>  		dev_err(&pdev->dev, "%pOF has no 'reg' property\n",
> @@ -2183,7 +2184,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>  		}
>  	}
>  
> -	if (of_device_is_compatible(child, "ti,omap2-nand")) {
> +	if (of_match_node(omap_nand_ids, child))
> +		is_nand = true;
> +
> +	if (is_nand) {
>  		/* NAND specific setup */
>  		val = 8;
>  		of_property_read_u32(child, "nand-bus-width", &val);
> diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
> index b26d4947af02..e6dd8b4cf0d2 100644
> --- a/drivers/mtd/nand/raw/omap2.c
> +++ b/drivers/mtd/nand/raw/omap2.c
> @@ -2352,10 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)
>  	return ret;
>  }
>  
> -static const struct of_device_id omap_nand_ids[] = {
> -	{ .compatible = "ti,omap2-nand", },
> -	{},
> -};
> +/* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */
>  MODULE_DEVICE_TABLE(of, omap_nand_ids);
>  
>  static struct platform_driver omap_nand_driver = {
> diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
> index de6ada739121..92f011805ad4 100644
> --- a/include/linux/platform_data/mtd-nand-omap2.h
> +++ b/include/linux/platform_data/mtd-nand-omap2.h
> @@ -7,6 +7,7 @@
>  #define	_MTD_NAND_OMAP2_H
>  
>  #include <linux/mtd/partitions.h>
> +#include <linux/mod_devicetable.h>
>  
>  #define	GPMC_BCH_NUM_REMAINDER	8
>  
> @@ -61,4 +62,10 @@ struct gpmc_nand_regs {
>  	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
>  	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
>  };
> -#endif
> +
> +static const struct of_device_id omap_nand_ids[] = {
> +	{ .compatible = "ti,omap2-nand", },
> +	{},
> +};
> +
> +#endif /* _MTD_NAND_OMAP2_H */
>
Miquel Raynal Dec. 22, 2021, 2:18 p.m. UTC | #2
Hi Roger,

rogerq@kernel.org wrote on Tue, 21 Dec 2021 22:01:28 +0200:

> Hi Miquel,
> 
> On 21/12/2021 15:17, Roger Quadros wrote:
> > As more compatibles can be added to the GPMC NAND controller driver
> > use a compatible match table.
> > 
> > Cc: Miquel Raynal <miquel.raynal@bootlin.com>
> > Signed-off-by: Roger Quadros <rogerq@kernel.org>
> > ---
> >  drivers/memory/omap-gpmc.c                   | 6 +++++-
> >  drivers/mtd/nand/raw/omap2.c                 | 5 +----  
> 
> Will need your Ack for this one as well. Thanks :)
> 
> 
> >  include/linux/platform_data/mtd-nand-omap2.h | 9 ++++++++-
> >  3 files changed, 14 insertions(+), 6 deletions(-)  
> 
> cheers,
> -roger
> 
> > 
> > diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
> > index 624153048182..d19ffc895e5b 100644
> > --- a/drivers/memory/omap-gpmc.c
> > +++ b/drivers/memory/omap-gpmc.c
> > @@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
> >  	u32 val;
> >  	struct gpio_desc *waitpin_desc = NULL;
> >  	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
> > +	bool is_nand = false;
> >  
> >  	if (of_property_read_u32(child, "reg", &cs) < 0) {
> >  		dev_err(&pdev->dev, "%pOF has no 'reg' property\n",
> > @@ -2183,7 +2184,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
> >  		}
> >  	}
> >  
> > -	if (of_device_is_compatible(child, "ti,omap2-nand")) {
> > +	if (of_match_node(omap_nand_ids, child))
> > +		is_nand = true;
> > +
> > +	if (is_nand) {

nitpick: why this intermediate variable?

Otherwise for the NAND bits:

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

> >  		/* NAND specific setup */
> >  		val = 8;
> >  		of_property_read_u32(child, "nand-bus-width", &val);
> > diff --git a/drivers/mtd/nand/raw/omap2.c b/drivers/mtd/nand/raw/omap2.c
> > index b26d4947af02..e6dd8b4cf0d2 100644
> > --- a/drivers/mtd/nand/raw/omap2.c
> > +++ b/drivers/mtd/nand/raw/omap2.c
> > @@ -2352,10 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)
> >  	return ret;
> >  }
> >  
> > -static const struct of_device_id omap_nand_ids[] = {
> > -	{ .compatible = "ti,omap2-nand", },
> > -	{},
> > -};
> > +/* omap_nand_ids defined in linux/platform_data/mtd-nand-omap2.h */
> >  MODULE_DEVICE_TABLE(of, omap_nand_ids);
> >  
> >  static struct platform_driver omap_nand_driver = {
> > diff --git a/include/linux/platform_data/mtd-nand-omap2.h b/include/linux/platform_data/mtd-nand-omap2.h
> > index de6ada739121..92f011805ad4 100644
> > --- a/include/linux/platform_data/mtd-nand-omap2.h
> > +++ b/include/linux/platform_data/mtd-nand-omap2.h
> > @@ -7,6 +7,7 @@
> >  #define	_MTD_NAND_OMAP2_H
> >  
> >  #include <linux/mtd/partitions.h>
> > +#include <linux/mod_devicetable.h>
> >  
> >  #define	GPMC_BCH_NUM_REMAINDER	8
> >  
> > @@ -61,4 +62,10 @@ struct gpmc_nand_regs {
> >  	void __iomem	*gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER];
> >  	void __iomem	*gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER];
> >  };
> > -#endif
> > +
> > +static const struct of_device_id omap_nand_ids[] = {
> > +	{ .compatible = "ti,omap2-nand", },
> > +	{},
> > +};
> > +
> > +#endif /* _MTD_NAND_OMAP2_H */
> >   


Thanks,
Miquèl
Krzysztof Kozlowski Dec. 22, 2021, 3:49 p.m. UTC | #3
On 22/12/2021 15:18, Miquel Raynal wrote:
> Hi Roger,
> 
> rogerq@kernel.org wrote on Tue, 21 Dec 2021 22:01:28 +0200:
> 
>> Hi Miquel,
>>
>> On 21/12/2021 15:17, Roger Quadros wrote:
>>> As more compatibles can be added to the GPMC NAND controller driver
>>> use a compatible match table.
>>>
>>> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
>>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>>> ---
>>>  drivers/memory/omap-gpmc.c                   | 6 +++++-
>>>  drivers/mtd/nand/raw/omap2.c                 | 5 +----  
>>
>> Will need your Ack for this one as well. Thanks :)
>>
>>
>>>  include/linux/platform_data/mtd-nand-omap2.h | 9 ++++++++-
>>>  3 files changed, 14 insertions(+), 6 deletions(-)  
>>
>> cheers,
>> -roger
>>
>>>
>>> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
>>> index 624153048182..d19ffc895e5b 100644
>>> --- a/drivers/memory/omap-gpmc.c
>>> +++ b/drivers/memory/omap-gpmc.c
>>> @@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>>>  	u32 val;
>>>  	struct gpio_desc *waitpin_desc = NULL;
>>>  	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
>>> +	bool is_nand = false;
>>>  
>>>  	if (of_property_read_u32(child, "reg", &cs) < 0) {
>>>  		dev_err(&pdev->dev, "%pOF has no 'reg' property\n",
>>> @@ -2183,7 +2184,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>>>  		}
>>>  	}
>>>  
>>> -	if (of_device_is_compatible(child, "ti,omap2-nand")) {
>>> +	if (of_match_node(omap_nand_ids, child))
>>> +		is_nand = true;
>>> +
>>> +	if (is_nand) {
> 
> nitpick: why this intermediate variable?
> 

Indeed, it looks useless. I think it is left-over from previous version.
I will remove it while applying.


Best regards,
Krzysztof
Krzysztof Kozlowski Dec. 22, 2021, 3:52 p.m. UTC | #4
On Tue, 21 Dec 2021 15:17:53 +0200, Roger Quadros wrote:
> TI's AM64 SoC contains one GPMC module. Add driver support for it.
> 
> cheers,
> -roger
> 
> Changelog:
> v4
> - move compatible match table to header file so it can be used by
> GPMC driver even when NAND driver is not enabled or as a module.
> GPMC driver is always enabled as built-in.
> - Select OMAP_GPMC driver from MTD_NAND_OMAP2 driver config as
> OMAP_GPMC is not essential for ARCH_K3 boot.
> 
> [...]

Applied, thanks!

[1/4] dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
      commit: 4892242784786f3cbaa3b79ea03f8b0c145f6cfd
[2/4] memory: omap-gpmc: Add support for GPMC on AM64 SoC
      commit: 7e58accf4547b75070e5cc1e04f97e890d7f719a
[3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
      commit: f2f8115fe8b390af27d013411045bd712a812103
[4/4] mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3
      commit: 5784260892e5b808e1317843f71d4b787ad1f4b7

Best regards,
Roger Quadros Dec. 22, 2021, 5:04 p.m. UTC | #5
On 22/12/2021 17:49, Krzysztof Kozlowski wrote:
> On 22/12/2021 15:18, Miquel Raynal wrote:
>> Hi Roger,
>>
>> rogerq@kernel.org wrote on Tue, 21 Dec 2021 22:01:28 +0200:
>>
>>> Hi Miquel,
>>>
>>> On 21/12/2021 15:17, Roger Quadros wrote:
>>>> As more compatibles can be added to the GPMC NAND controller driver
>>>> use a compatible match table.
>>>>
>>>> Cc: Miquel Raynal <miquel.raynal@bootlin.com>
>>>> Signed-off-by: Roger Quadros <rogerq@kernel.org>
>>>> ---
>>>>  drivers/memory/omap-gpmc.c                   | 6 +++++-
>>>>  drivers/mtd/nand/raw/omap2.c                 | 5 +----  
>>>
>>> Will need your Ack for this one as well. Thanks :)
>>>
>>>
>>>>  include/linux/platform_data/mtd-nand-omap2.h | 9 ++++++++-
>>>>  3 files changed, 14 insertions(+), 6 deletions(-)  
>>>
>>> cheers,
>>> -roger
>>>
>>>>
>>>> diff --git a/drivers/memory/omap-gpmc.c b/drivers/memory/omap-gpmc.c
>>>> index 624153048182..d19ffc895e5b 100644
>>>> --- a/drivers/memory/omap-gpmc.c
>>>> +++ b/drivers/memory/omap-gpmc.c
>>>> @@ -2091,6 +2091,7 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>>>>  	u32 val;
>>>>  	struct gpio_desc *waitpin_desc = NULL;
>>>>  	struct gpmc_device *gpmc = platform_get_drvdata(pdev);
>>>> +	bool is_nand = false;
>>>>  
>>>>  	if (of_property_read_u32(child, "reg", &cs) < 0) {
>>>>  		dev_err(&pdev->dev, "%pOF has no 'reg' property\n",
>>>> @@ -2183,7 +2184,10 @@ static int gpmc_probe_generic_child(struct platform_device *pdev,
>>>>  		}
>>>>  	}
>>>>  
>>>> -	if (of_device_is_compatible(child, "ti,omap2-nand")) {
>>>> +	if (of_match_node(omap_nand_ids, child))
>>>> +		is_nand = true;
>>>> +
>>>> +	if (is_nand) {
>>
>> nitpick: why this intermediate variable?
>>
> 
> Indeed, it looks useless. I think it is left-over from previous version.
> I will remove it while applying.

You are right. Thanks for saving me a re-spin Krzysztof :)

cheers,
-roger
Romain Naour April 15, 2022, 8:59 a.m. UTC | #6
Hello,

Le 21/12/2021 à 14:17, Roger Quadros a écrit :
> Hi,
> 
> TI's AM64 SoC contains one GPMC module. Add driver support for it.

What's the status of the GPMC interface on K3 architecture, especially for AM65,
AM62 and other Jacinto 7 CPU devices ?

TI currently don't recommend to use it for now even if there are still some GPMC
use case with FPGA devices:

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/994191/am6442-am64x-gpmc-support

This patch series add omap-gpmc support for AM64 Soc but as of kernel 5.18-rc2,
there is no devicetree using ti,am64-gpmc.

This patch seems missing (at least):
https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=ti-linux-5.10.y&id=55c102a75d399896c7396229cd687bf97afb5cf6

Thanks!

Best regards,
Romain

> 
> cheers,
> -roger
> 
> Changelog:
> v4
> - move compatible match table to header file so it can be used by
> GPMC driver even when NAND driver is not enabled or as a module.
> GPMC driver is always enabled as built-in.
> - Select OMAP_GPMC driver from MTD_NAND_OMAP2 driver config as
> OMAP_GPMC is not essential for ARCH_K3 boot.
> 
> v3
> - use compatible match table for checking for NAND controller node in
> GPMC driver.
> 
> v2
> - update DT binding doc to make reg-names and power-domains property
> required only for specific SoC.
> 
> Roger Quadros (4):
>   dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
>   memory: omap-gpmc: Add support for GPMC on AM64 SoC
>   memory: omap-gpmc: Use a compatible match table when checking for NAND
>     controller
>   mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3
> 
>  .../bindings/memory-controllers/ti,gpmc.yaml  | 23 +++++++++-
>  drivers/memory/omap-gpmc.c                    | 46 ++++++++++++++-----
>  drivers/mtd/nand/raw/Kconfig                  |  1 +
>  drivers/mtd/nand/raw/omap2.c                  |  5 +-
>  include/linux/platform_data/mtd-nand-omap2.h  |  9 +++-
>  5 files changed, 67 insertions(+), 17 deletions(-)
>
Grygorii Strashko April 15, 2022, 1:06 p.m. UTC | #7
On 15/04/2022 11:59, Romain Naour wrote:
> Hello,
> 
> Le 21/12/2021 à 14:17, Roger Quadros a écrit :
>> Hi,
>>
>> TI's AM64 SoC contains one GPMC module. Add driver support for it.
> 
> What's the status of the GPMC interface on K3 architecture, especially for AM65,
> AM62 and other Jacinto 7 CPU devices ?
> 
> TI currently don't recommend to use it for now even if there are still some GPMC
> use case with FPGA devices:
> 
> https://e2e.ti.com/support/processors-group/processors/f/processors-forum/994191/am6442-am64x-gpmc-support
> 
> This patch series add omap-gpmc support for AM64 Soc but as of kernel 5.18-rc2,
> there is no devicetree using ti,am64-gpmc.
> 
> This patch seems missing (at least):
> https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=ti-linux-5.10.y&id=55c102a75d399896c7396229cd687bf97afb5cf6

It's not how LKML development process works - driver changes has to be sent first
and then DT changes  as they accepted by different maintainers and through different trees.

> 
> Thanks!
> 
> Best regards,
> Romain
> 
>>
>> cheers,
>> -roger
>>
>> Changelog:
>> v4
>> - move compatible match table to header file so it can be used by
>> GPMC driver even when NAND driver is not enabled or as a module.
>> GPMC driver is always enabled as built-in.
>> - Select OMAP_GPMC driver from MTD_NAND_OMAP2 driver config as
>> OMAP_GPMC is not essential for ARCH_K3 boot.
>>
>> v3
>> - use compatible match table for checking for NAND controller node in
>> GPMC driver.
>>
>> v2
>> - update DT binding doc to make reg-names and power-domains property
>> required only for specific SoC.
>>
>> Roger Quadros (4):
>>    dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
>>    memory: omap-gpmc: Add support for GPMC on AM64 SoC
>>    memory: omap-gpmc: Use a compatible match table when checking for NAND
>>      controller
>>    mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3
>>
>>   .../bindings/memory-controllers/ti,gpmc.yaml  | 23 +++++++++-
>>   drivers/memory/omap-gpmc.c                    | 46 ++++++++++++++-----
>>   drivers/mtd/nand/raw/Kconfig                  |  1 +
>>   drivers/mtd/nand/raw/omap2.c                  |  5 +-
>>   include/linux/platform_data/mtd-nand-omap2.h  |  9 +++-
>>   5 files changed, 67 insertions(+), 17 deletions(-)
>>
>
Romain Naour May 13, 2022, 8:49 a.m. UTC | #8
Hi,

Le 15/04/2022 à 15:06, Grygorii Strashko a écrit :
> 
> 
> On 15/04/2022 11:59, Romain Naour wrote:
>> Hello,
>>
>> Le 21/12/2021 à 14:17, Roger Quadros a écrit :
>>> Hi,
>>>
>>> TI's AM64 SoC contains one GPMC module. Add driver support for it.
>>
>> What's the status of the GPMC interface on K3 architecture, especially for AM65,
>> AM62 and other Jacinto 7 CPU devices ?
>>
>> TI currently don't recommend to use it for now even if there are still some GPMC
>> use case with FPGA devices:
>>
>> https://e2e.ti.com/support/processors-group/processors/f/processors-forum/994191/am6442-am64x-gpmc-support
>>
>>
>> This patch series add omap-gpmc support for AM64 Soc but as of kernel 5.18-rc2,
>> there is no devicetree using ti,am64-gpmc.
>>
>> This patch seems missing (at least):
>> https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/commit/?h=ti-linux-5.10.y&id=55c102a75d399896c7396229cd687bf97afb5cf6
>>
> 
> It's not how LKML development process works - driver changes has to be sent first
> and then DT changes  as they accepted by different maintainers and through
> different trees.

Ok, I understand.

DT changes are still under review [1] and are not yet merged in 5.18-rc6.

Sorry for the noise.

[1] https://lkml.org/lkml/2022/2/4/320

Best regards,
Romain


> 
>>
>> Thanks!
>>
>> Best regards,
>> Romain
>>
>>>
>>> cheers,
>>> -roger
>>>
>>> Changelog:
>>> v4
>>> - move compatible match table to header file so it can be used by
>>> GPMC driver even when NAND driver is not enabled or as a module.
>>> GPMC driver is always enabled as built-in.
>>> - Select OMAP_GPMC driver from MTD_NAND_OMAP2 driver config as
>>> OMAP_GPMC is not essential for ARCH_K3 boot.
>>>
>>> v3
>>> - use compatible match table for checking for NAND controller node in
>>> GPMC driver.
>>>
>>> v2
>>> - update DT binding doc to make reg-names and power-domains property
>>> required only for specific SoC.
>>>
>>> Roger Quadros (4):
>>>    dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
>>>    memory: omap-gpmc: Add support for GPMC on AM64 SoC
>>>    memory: omap-gpmc: Use a compatible match table when checking for NAND
>>>      controller
>>>    mtd: rawnand: omap2: Select GPMC device driver for ARCH_K3
>>>
>>>   .../bindings/memory-controllers/ti,gpmc.yaml  | 23 +++++++++-
>>>   drivers/memory/omap-gpmc.c                    | 46 ++++++++++++++-----
>>>   drivers/mtd/nand/raw/Kconfig                  |  1 +
>>>   drivers/mtd/nand/raw/omap2.c                  |  5 +-
>>>   include/linux/platform_data/mtd-nand-omap2.h  |  9 +++-
>>>   5 files changed, 67 insertions(+), 17 deletions(-)
>>>
>>
>