memory: omap-gpmc: Add AM64 SoC support
Subsystems (6)
Roger Quadros
maintainerv3 cover memory: omap-gpmc: Add AM64 SoC support
Hi,
TI's AM64 SoC contains one GPMC module. Add driver support for it.
cheers,
-roger
Changelog:
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
arm64: arch_k3: Select GPMC device driver
.../bindings/memory-controllers/ti,gpmc.yaml | 23 ++++++++- arch/arm64/Kconfig.platforms | 1 + drivers/memory/omap-gpmc.c | 48 ++++++++++++++----- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 ++ 5 files changed, 66 insertions(+), 13 deletions(-)
Signature · 1 line
2.17.1
Roger Quadros
maintainerPATCH v3 1/4 dt-bindings: memory-controllers: ti,gpmc: Add compatible for AM64
AM64 SoC contains the GPMC module. Add compatible for it.
Newer SoCs don't necessarily map GPMC data region at the same place as legacy SoCs. Add reg-names "data", to provide this information to the device driver.
--- .../bindings/memory-controllers/ti,gpmc.yaml | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/memory-controllers/ti,gpmc.yaml +22 -1
@@ -23,13 +23,20 @@ properties: items: - enum: - ti,am3352-gpmc + - ti,am64-gpmc - ti,omap2420-gpmc - ti,omap2430-gpmc - ti,omap3430-gpmc - ti,omap4430-gpmc reg: - maxItems: 1 + minItems: 1 + maxItems: 2 + + reg-names: + items: + - const: cfg + - const: data interrupts: maxItems: 1
@@ -44,6 +51,9 @@ properties: items: - const: fck + power-domains: + maxItems: 1 + dmas: items: - description: DMA channel for GPMC NAND prefetch
@@ -133,6 +143,17 @@ required: - "#address-cells" - "#size-cells" +allOf: + - if: + properties: + compatible: + contains: + const: ti,am64-gpmc + then: + required: + - reg-names + - power-domains + additionalProperties: false examples:
Signature · 1 line
2.17.1
Roger Quadros
maintainerPATCH v3 2/4 memory: omap-gpmc: Add support for GPMC on AM64 SoC
In reply to Roger QuadrosThe TI's AM64 SoC has the GPMC module. Add compatible for it.
Traditionally GPMC external addresses have always been mapped to first 1GB physical address. However newer platforms, can have it mapped at different locations. Support this address provision via device tree.
--- drivers/memory/omap-gpmc.c | 40 ++++++++++++++++++++++++++++---------- 1 file changed, 30 insertions(+), 10 deletions(-)
drivers/memory/omap-gpmc.c +30 -10
@@ -237,6 +237,7 @@ struct gpmc_device {struct omap3_gpmc_regs context;int nirqs; unsigned int is_suspended:1; +struct resource *data; };static struct irq_domain *gpmc_irq_domain;
@@ -1456,12 +1457,18 @@ static void gpmc_mem_exit(void) } } -static void gpmc_mem_init (void ) +static void gpmc_mem_init (struct gpmc_device *gpmc) {int cs; - gpmc_mem_root.start =GPMC_MEM_START ; - gpmc_mem_root.end =GPMC_MEM_END ; +if (!gpmc->data) { +/* All legacy devices have same data IO window */ + gpmc_mem_root.start =GPMC_MEM_START ; + gpmc_mem_root.end =GPMC_MEM_END ; + }else { + gpmc_mem_root.start = gpmc->data->start; + gpmc_mem_root.end = gpmc->data->end; + }/* Reserve all regions that has been set up by bootloader */ for (cs =0 ; cs < gpmc_cs_num; cs++) {
@@ -1888,6 +1895,7 @@ static const struct of_device_id gpmc_dt_ids[] = { { .compatible = "ti,omap3430-gpmc" }, /* omap3430 & omap3630 */ { .compatible = "ti,omap4430-gpmc" }, /* omap4430 & omap4460 & omap543x */ { .compatible = "ti,am3352-gpmc" }, /* am335x devices */ + { .compatible = "ti,am64-gpmc" }, { } };
@@ -2502,13 +2510,25 @@ static int gpmc_probe(struct platform_device *pdev) gpmc->dev = &pdev->dev;platform_set_drvdata (pdev, gpmc); - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!res) -return -ENOENT ; + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"cfg" ); +if (!res) { +/* legacy DT */ + gpmc_base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (gpmc_base)) +return PTR_ERR (gpmc_base); + }else { + gpmc_base =devm_ioremap_resource (&pdev->dev, res); +if (IS_ERR (gpmc_base)) +return PTR_ERR (gpmc_base); + + res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"data" ); +if (!res) { +dev_err (&pdev->dev,"couldn't get data reg resource\n" ); +return -ENOENT ; + } - gpmc_base =devm_ioremap_resource (&pdev->dev, res); -if (IS_ERR (gpmc_base)) -return PTR_ERR (gpmc_base); + gpmc->data = res; + } res =platform_get_resource (pdev,IORESOURCE_IRQ ,0 );if (!res) {
@@ -2562,7 +2582,7 @@ static int gpmc_probe(struct platform_device *pdev)dev_info (gpmc->dev,"GPMC revision %d.%d\n" ,GPMC_REVISION_MAJOR (l),GPMC_REVISION_MINOR (l)); -gpmc_mem_init (); +gpmc_mem_init (gpmc); rc =gpmc_gpio_init (gpmc);if (rc) goto gpio_init_failed;
Signature · 1 line
2.17.1
Roger Quadros
maintainerPATCH v3 3/4 memory: omap-gpmc: Use a compatible match table when checking for NAND controller
In reply to Roger QuadrosAs more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)
drivers/memory/omap-gpmc.c +7 -1
@@ -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,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 ) +if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);
drivers/mtd/nand/raw/omap2.c +1 -1
@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; } -static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };
include/linux/platform_data/mtd-nand-omap2.h +5 -0
@@ -61,4 +61,9 @@ struct gpmc_nand_regs {void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER ]; void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; }; + +#if defined(CONFIG_MTD_NAND_OMAP2 ) +extern const struct of_device_id omap_nand_ids[]; +#endif +#endif
Signature · 1 line
2.17.1
Re: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Quoted 23 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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",
drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 5 lines
drivers/memory/omap-gpmc.c +1
-1@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )
if (IS_ENABLED()) is preferred. If needed, you could make omap_nand_ids symbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).
Quoted 13 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0
drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 8 lines
drivers/mtd/nand/raw/omap2.c +1
-1@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; } -static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };
I think OMAP2 NAND driver can be a module, so this should have EXPORT_SYMBOL.
Quoted 6 lines
include/linux/platform_data/mtd-nand-omap2.h +0
-0
include/linux/platform_data/mtd-nand-omap2.h struct gpmc_nand_regs { · line 69
Quoted 9 lines
include/linux/platform_data/mtd-nand-omap2.h +5
-0@@ -61,4 +61,9 @@ struct gpmc_nand_regs {void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER ]; void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER]; }; + +#if defined(CONFIG_MTD_NAND_OMAP2 ) +extern const struct of_device_id omap_nand_ids[]; +#endif +#endif
Best regards,
Krzysztof
Roger Quadros
maintainerRe: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Quoted 27 lines · Krzysztof Kozlowski
Quoted 26 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } }
Quoted 7 lines
drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 2 lines
drivers/memory/omap-gpmc.c +1
-1-if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )if (
IS_ENABLED()) is preferred. If needed, you could makeomap_nand_idssymbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).
OK.
Quoted 17 lines
Quoted 17 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; }
Quoted 8 lines
drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 5 lines
drivers/mtd/nand/raw/omap2.c +1
-1-static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };I think OMAP2 NAND driver can be a module, so this should have
EXPORT_SYMBOL.
Indeed. Good catch!
Quoted 12 lines
Quoted 12 lines
include/linux/platform_data/mtd-nand-omap2.h +3
-0@@ -61,4 +61,9 @@ struct gpmc_nand_regs {void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER ];void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER ]; }; + +#if defined(CONFIG_MTD_NAND_OMAP2 ) +extern const struct of_device_id omap_nand_ids[];
Quoted 9 lines
include/linux/platform_data/mtd-nand-omap2.h struct gpmc_nand_regs { · line 69
Quoted 4 lines
include/linux/platform_data/mtd-nand-omap2.h +2
-0+#endif +#endif Best regards,
Krzysztof
cheers,
-roger
Roger Quadros
maintainerRe: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
In reply to Krzysztof KozlowskiQuoted 51 lines · Krzysztof Kozlowski
Quoted 23 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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",drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 5 lines
drivers/memory/omap-gpmc.c +1
-1@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )if (
IS_ENABLED()) is preferred. If needed, you could makeomap_nand_idssymbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).Quoted 16 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; }
Quoted 8 lines
drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 5 lines
drivers/mtd/nand/raw/omap2.c +1
-1-static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };I think OMAP2 NAND driver can be a module, so this should have
EXPORT_SYMBOL.
To make it work in all combinations (e.g. omap_gpmc built in and nand/raw/omap2.c as module) I had to define omap_nand_ids table as static in the linux/platform_data/mtd-nand-omap2.h header.
EXPORT_SYMBOL will of course be not required there. ;)
Quoted 12 lines
Quoted 12 lines
include/linux/platform_data/mtd-nand-omap2.h +3
-0@@ -61,4 +61,9 @@ struct gpmc_nand_regs {void __iomem *gpmc_bch_result5[GPMC_BCH_NUM_REMAINDER ];void __iomem *gpmc_bch_result6[GPMC_BCH_NUM_REMAINDER ]; }; + +#if defined(CONFIG_MTD_NAND_OMAP2 ) +extern const struct of_device_id omap_nand_ids[];
Quoted 9 lines
include/linux/platform_data/mtd-nand-omap2.h struct gpmc_nand_regs { · line 69
Quoted 4 lines
include/linux/platform_data/mtd-nand-omap2.h +2
-0+#endif +#endif Best regards,
Krzysztof
cheers,
-roger
Re: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Quoted 63 lines · Roger Quadros
Quoted 51 lines · Krzysztof Kozlowski
Quoted 23 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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",drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 5 lines
drivers/memory/omap-gpmc.c +1
-1@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )if (
IS_ENABLED()) is preferred. If needed, you could makeomap_nand_idssymbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).Quoted 16 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; }Quoted 8 lines
drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 5 lines
drivers/mtd/nand/raw/omap2.c +1
-1-static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };I think OMAP2 NAND driver can be a module, so this should have
EXPORT_SYMBOL.
Quoted 6 lines
To make it work in all combinations (e.g.
omap_gpmcbuilt in andnand/raw/omap2.cas module) I had to defineomap_nand_idstable as static in thelinux/platform_data/mtd-nand-omap2.hheader.
EXPORT_SYMBOLwill of course be not required there. ;)
Which case exactly does it require to be static in the header?
Best regards,
Krzysztof
Roger Quadros
maintainerRe: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Quoted 64 lines · Krzysztof Kozlowski
Quoted 63 lines · Roger Quadros
Quoted 59 lines · Krzysztof Kozlowski
Quoted 23 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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",drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 5 lines
drivers/memory/omap-gpmc.c +1
-1@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )if (
IS_ENABLED()) is preferred. If needed, you could makeomap_nand_idssymbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).Quoted 13 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 8 lines
drivers/mtd/nand/raw/omap2.c +1
-1@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; } -static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };I think OMAP2 NAND driver can be a module, so this should have
EXPORT_SYMBOL.
Quoted 7 lines
Quoted 6 lines
To make it work in all combinations (e.g.
omap_gpmcbuilt in andnand/raw/omap2.cas module) I had to defineomap_nand_idstable as static in thelinux/platform_data/mtd-nand-omap2.hheader.
EXPORT_SYMBOLwill of course be not required there. ;)Which case exactly does it require to be static in the header?
Maybe there is a better way to do it.
e.g. If omap_gpmc.c is built-in and nand/raw/omap2.c is not built or built as a module, what better way we can use?
--
cheers,
-roger
Re: [PATCH v3 3/4] memory: omap-gpmc: Use a compatible match table when checking for NAND controller
Quoted 71 lines · Roger Quadros
Quoted 68 lines · Krzysztof Kozlowski
Quoted 67 lines · Roger Quadros
Quoted 51 lines · Krzysztof Kozlowski
Quoted 23 lines · Roger Quadros
As more compatibles can be added to the GPMC NAND controller driver use a compatible match table.
Signed-off-by Roger Quadros <[email protected]>--- drivers/memory/omap-gpmc.c | 8 +++++++- drivers/mtd/nand/raw/omap2.c | 2 +- include/linux/platform_data/mtd-nand-omap2.h | 5 +++++ 3 files changed, 13 insertions(+), 2 deletions(-)drivers/memory/omap-gpmc.c +1
-0@@ -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",drivers/memory/omap-gpmc.c static int gpmc_probe_generic_child(struct platform_device *pdev, · line 2187
Quoted 5 lines
drivers/memory/omap-gpmc.c +1
-1@@ -2183,7 +2184,12 @@ static int gpmc_probe_generic_child(struct platform_device *pdev, } } -if (of_device_is_compatible (child,"ti,omap2-nand" )) { +#if defined(CONFIG_MTD_NAND_OMAP2 )if (
IS_ENABLED()) is preferred. If needed, you could makeomap_nand_idssymbol visible always (so without ifdef around it), because extern structure should not have impact when not defined (if I recall correctly...).Quoted 16 lines
drivers/memory/omap-gpmc.c +5
-0+if (of_match_node (omap_nand_ids, child)) + is_nand = true; +#endif + +if (is_nand) {/* NAND specific setup */ val =8 ;of_property_read_u32 (child,"nand-bus-width" , &val);drivers/mtd/nand/raw/omap2.c +0
-0@@ -2352,7 +2352,7 @@ static int omap_nand_remove(struct platform_device *pdev)return ret; }Quoted 8 lines
drivers/mtd/nand/raw/omap2.c static int omap_nand_remove(struct platform_device *pdev) · line 2358
Quoted 5 lines
drivers/mtd/nand/raw/omap2.c +1
-1-static const struct of_device_id omap_nand_ids[] = { +const struct of_device_id omap_nand_ids[] = { { .compatible ="ti,omap2-nand" , }, {}, };I think OMAP2 NAND driver can be a module, so this should have
EXPORT_SYMBOL.To make it work in all combinations (e.g.
omap_gpmcbuilt in andnand/raw/omap2.cas module) I had to defineomap_nand_idstable as static in thelinux/platform_data/mtd-nand-omap2.hheader.
Quoted 7 lines
Quoted 3 lines
Quoted 2 lines
EXPORT_SYMBOLwill of course be not required there. ;)Which case exactly does it require to be static in the header?
Maybe there is a better way to do it.
e.g. Ifomap_gpmc.cis built-in andnand/raw/omap2.cis not built or built as a module, what better way we can use?
Ah, you are right, that is the tricky configuration. It could be a separate built-in source file which is being selected by OMAP_GPMC and MTD_NAND_OMAP2, but it would be also an overkill for one-item array.
I guess your solution with header is the easiest.
Best regards,
Krzysztof
Roger Quadros
maintainerPATCH v3 4/4 arm64: arch_k3: Select GPMC device driver
In reply to Roger QuadrosThe GPMC controller is present on some K3 SoCs. It provides access to NOR/NAND flashes and asynchronous SRAM-like memories and ASICs.
--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig.platforms +1 -0
@@ -122,6 +122,7 @@ config ARCH_K3 select TI_SCI_INTR_IRQCHIP select TI_SCI_INTA_IRQCHIP select TI_K3_SOCINFO + select OMAP_GPMC help This enables support for Texas Instruments' K3 multicore SoC architecture.
Signature · 1 line
2.17.1
Re: [PATCH v3 4/4] arm64: arch_k3: Select GPMC device driver
Quoted 9 lines · Roger Quadros
The GPMC controller is present on some K3 SoCs. It provides access to NOR/NAND flashes and asynchronous SRAM-like memories and ASICs.
Signed-off-by Roger Quadros <[email protected]>--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
FWIW:
Other option would be to make it "default ARCH_K3" in OMAP_GPMC, but this is fine for me.
Best regards,
Krzysztof
Re: [PATCH v3 4/4] arm64: arch_k3: Select GPMC device driver
In reply to Roger QuadrosQuoted 14 lines · Roger Quadros
The GPMC controller is present on some K3 SoCs. It provides access to NOR/NAND flashes and asynchronous SRAM-like memories and ASICs.
Signed-off-by Roger Quadros <[email protected]>--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)arch/arm64/Kconfig.platforms +0
-0
arch/arm64/Kconfig.platforms config ARCH_K3 · line 125
Quoted 4 lines
arch/arm64/Kconfig.platforms +1
-0@@ -122,6 +122,7 @@ config ARCH_K3 select TI_SCI_INTR_IRQCHIP select TI_SCI_INTA_IRQCHIP select TI_K3_SOCINFO + select OMAP_GPMC
I dont think GPMC should be part of the select list here. instead defconfig patch is prefered. the existance and usage of the same are limited and it is NOT a core functional component required to boot up a K3 platform.
Signature · 3 lines
Regards, Nishanth Menon Key (0xDDB5849D1736249D)/Fingerprint: F8A2 8693 54EB 8232 17A3 1A34 DDB5 849D 1736 249D
Roger Quadros
maintainerRe: [PATCH v3 4/4] arm64: arch_k3: Select GPMC device driver
Nishanth,
Quoted 10 lines · Nishanth Menon
Quoted 9 lines · Roger Quadros
The GPMC controller is present on some K3 SoCs. It provides access to NOR/NAND flashes and asynchronous SRAM-like memories and ASICs.
Signed-off-by Roger Quadros <[email protected]>--- arch/arm64/Kconfig.platforms | 1 + 1 file changed, 1 insertion(+)
Quoted 14 lines
arch/arm64/Kconfig.platforms config ARCH_K3 · line 125
Quoted 9 lines
arch/arm64/Kconfig.platforms +1
-0@@ -122,6 +122,7 @@ config ARCH_K3 select TI_SCI_INTR_IRQCHIP select TI_SCI_INTA_IRQCHIP select TI_K3_SOCINFO + select OMAP_GPMCI dont think GPMC should be part of the select list here. instead defconfig patch is prefered. the existance and usage of the same are limited and it is NOT a core functional component required to boot up a K3 platform.
Since OMAP_GPMC is not visible it cannot be enabled via defconfig file. I tried to make it visible in earlier revision of this patchset but it looks like OMAP_GPMC config was meant to be not a visible option form the beginning.
All legacy platforms have been selecting it in some way or the other but I agree with you that selecting it at SOC level may not be the best option.
If not here, any suggestions where should I select it from? Maybe from mtd/nand/raw/Kconfig if GPMC NAND driver is enabled?
cheers,
-roger