Skip to contentSkip to conversation

mtd: rawnand: omap2: Actually prevent invalid configuration and build error

PATCH Guenter Roeck 4 participants 11 messages Feb 20, 2022 – Mar 8, 2022

Subsystems (2)
lore
Share & tools
lore

Guenter Roeck

author Tested-by
#0 lore raw
Quoted 9 lines · Roger Quadros

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 21 lines
---
 drivers/mtd/nand/raw/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/Kconfig +1 -2
index 36e697456ec4..9b078e78f3fa 100644
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
-	select MEMORY
-	select OMAP_GPMC
+	depends on OMAP_GPMC
 	help
 	  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
 	  and Keystone platforms.
Signature · 1 line
2.17.1
Tested-by
#1 lore raw
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Roger Quadros

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

Quoted 7 lines
Quoted 5 lines

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")

Thanks.

Quoted 22 lines
Quoted 22 lines
---
 drivers/mtd/nand/raw/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/Kconfig +1 -2
index 36e697456ec4..9b078e78f3fa 100644
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
-	select MEMORY
-	select OMAP_GPMC
+	depends on OMAP_GPMC
 	help
 	  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
 	  and Keystone platforms.
Signature · 1 line
2.17.1
Signature · 5 lines
~Randy

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
maintainer
#2 lore raw

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 9 lines · Guenter Roeck
Quoted 8 lines · Roger Quadros
Quoted 7 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

Quoted 17 lines

Thanks.

Quoted 14 lines
Quoted 14 lines
  
---
 drivers/mtd/nand/raw/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/Kconfig +0 -1
index 36e697456ec4..9b078e78f3fa 100644
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
-	select MEMORY
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/raw/Kconfig +1 -1
-	select OMAP_GPMC
+	depends on OMAP_GPMC
 	help
 	  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
 	  and Keystone platforms.
Signature · 1 line
2.17.1

Thanks,
Miquèl

#3 lore raw
Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Sorry, you lost me.

Quoted 16 lines

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

Quoted 8 lines

Thanks.

Quoted 5 lines
Quoted 5 lines
   
---
  drivers/mtd/nand/raw/Kconfig | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines

drivers/mtd/nand/raw/Kconfig config MTD_NAND_OMAP2 · line 45

Quoted 11 lines
drivers/mtd/nand/raw/Kconfig +1 -2
index 36e697456ec4..9b078e78f3fa 100644
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
  	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
  	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
  	depends on HAS_IOMEM
-	select MEMORY
-	select OMAP_GPMC
+	depends on OMAP_GPMC

No matter if select or depend, both result in OMAP_GPMC enabled if MTD_NAND_OMAP2={m,y}, and both suggest that OMAP_GPMC is needed for MTD_NAND_OMAP2. That conflicts with

we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed

                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If it isn't needed, why the dependency in the first place ? Also, commit 4cd335dae3cf2 states "this driver depends on OMAP_GPMC driver and uses symbols from there". Are you saying that this is not correct ?

Guenter

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#4 lore raw
In reply to Miquel Raynal

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Quoted 8 lines

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

This issue is still present i.e. we cannot enable MTD_NAND_OMAP2 driver on K3 platform since OMAP_GPMC config is hidden and not select-able by user or defconfig file.

But it is not yet a deal breaker since NAND on K3 is not yet enabled upstream.

For this I think OMAP_GPMC has to be a visible config entry and select-able from a defconfig file as I had done initially [1].

Now we have a lot of explanation to write as to why we need to do it ;)

[1] - https://lore.kernel.org/lkml/[email protected]/

Quoted 28 lines
Quoted 18 lines

Thanks.

Quoted 14 lines
Quoted 14 lines
  
---
 drivers/mtd/nand/raw/Kconfig | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/mtd/nand/raw/Kconfig +0 -1
index 36e697456ec4..9b078e78f3fa 100644
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
-	select MEMORY
Quoted 9 lines
Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/raw/Kconfig +1 -1
-	select OMAP_GPMC
+	depends on OMAP_GPMC
 	help
 	  Support for NAND flash on Texas Instruments OMAP2, OMAP3, OMAP4
 	  and Keystone platforms.
Signature · 1 line
2.17.1
Quoted 2 lines

Thanks,
Miquèl

cheers,
-roger

maintainer
#5 lore raw

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM

depends on OMAP_GPMC

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Am I missing something?

Quoted 12 lines
Quoted 7 lines

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

This issue is still present i.e. we cannot enable MTD_NAND_OMAP2 driver on K3 platform since OMAP_GPMC config is hidden and not select-able by user or defconfig file.

Quoted 6 lines

But it is not yet a deal breaker since NAND on K3 is not yet enabled upstream.

For this I think OMAP_GPMC has to be a visible config entry and select-able from a defconfig file as I had done initially [1].

Now we have a lot of explanation to write as to why we need to do it ;)

We certainly do :)

Quoted 2 lines

[1] - https://lore.kernel.org/lkml/[email protected]/

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

#6 lore raw

Hi Miquel,

Quoted 53 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 
Quoted 3 lines

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

No that is not true. Other platforms that need MTD_NAND_OMAP2 are explicitly selecting OMAP_GPMC
i.e. in arch/arm/mach-omap2/Kconfig

Quoted 13 lines
drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
 	depends on OMAP_GPMC
 

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Quoted 1 line

Am I missing something?

MTD_NAND_OMAP2 NAND controller is a submodule of the OMAP GPMC IP. So it cannot work without OMAP_GPMC driver.

Hope this clarifies the doubts.

Quoted 20 lines
Quoted 13 lines
Quoted 8 lines

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

This issue is still present i.e. we cannot enable MTD_NAND_OMAP2 driver on K3 platform since OMAP_GPMC config is hidden and not select-able by user or defconfig file.

Quoted 6 lines

But it is not yet a deal breaker since NAND on K3 is not yet enabled upstream.

For this I think OMAP_GPMC has to be a visible config entry and select-able from a defconfig file as I had done initially [1].

Now we have a lot of explanation to write as to why we need to do it ;)

Quoted 7 lines

We certainly do :)

Quoted 2 lines

[1] - https://lore.kernel.org/lkml/[email protected]/

Thanks,
Miquèl

cheers,
-roger

maintainer
#7 lore raw

Hi Roger,

[email protected] wrote on Mon, 7 Mar 2022 14:25:48 +0200:

Quoted 56 lines

Hi Miquel,

Quoted 53 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 
Quoted 7 lines
Quoted 3 lines

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

No that is not true. Other platforms that need MTD_NAND_OMAP2 are explicitly selecting OMAP_GPMC
i.e. in arch/arm/mach-omap2/Kconfig

Okay, in this case the fix is fine but we will need to clean this up in a second time.

Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
 	depends on OMAP_GPMC
 
Quoted 8 lines
Quoted 5 lines

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Am I missing something?

MTD_NAND_OMAP2 NAND controller is a submodule of the OMAP GPMC IP. So it cannot work without OMAP_GPMC driver.

I didn't remember exactly but in that case it's okay, I was just surprised by the "select GPMC if ARCH_K3" but indeed with this explanation it makes more sense.

Quoted 1 line

Hope this clarifies the doubts.

Yes, thanks. I will send the fix to Linus then.

Cheers,
Miquèl

#8 lore raw

Hi Miquel,

Quoted 68 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Mon, 7 Mar 2022 14:25:48 +0200:

Quoted 56 lines

Hi Miquel,

Quoted 53 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 
Quoted 7 lines
Quoted 3 lines

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

No that is not true. Other platforms that need MTD_NAND_OMAP2 are explicitly selecting OMAP_GPMC
i.e. in arch/arm/mach-omap2/Kconfig

Quoted 2 lines

Okay, in this case the fix is fine but we will need to clean this up in a second time.

What clean up are you implying here? Those legacy platform might need OMAP_GPMC for booting so they select it. There is nothing much we can do there.

What is left to do now is make user/defconfig files to enable OMAP_GPMC driver so other platforms that don't need OMAP_GPMC for basic operation can still enable them later via defconfig or manually by user.

Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
 	depends on OMAP_GPMC
 
Quoted 8 lines
Quoted 5 lines

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Am I missing something?

MTD_NAND_OMAP2 NAND controller is a submodule of the OMAP GPMC IP. So it cannot work without OMAP_GPMC driver.

I didn't remember exactly but in that case it's okay, I was just surprised by the "select GPMC if ARCH_K3" but indeed with this explanation it makes more sense.

Quoted 6 lines
Quoted 1 line

Hope this clarifies the doubts.

Yes, thanks. I will send the fix to Linus then.

Cheers,
Miquèl

cheers,
-roger

maintainer
#9 lore raw

Hi Roger,

[email protected] wrote on Mon, 7 Mar 2022 23:05:47 +0200:

Quoted 71 lines

Hi Miquel,

Quoted 68 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Mon, 7 Mar 2022 14:25:48 +0200:

Quoted 63 lines

Hi Miquel,

Quoted 53 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 
Quoted 3 lines

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

No that is not true. Other platforms that need MTD_NAND_OMAP2 are explicitly selecting OMAP_GPMC
i.e. in arch/arm/mach-omap2/Kconfig

Quoted 5 lines
Quoted 2 lines

Okay, in this case the fix is fine but we will need to clean this up in a second time.

What clean up are you implying here? Those legacy platform might need OMAP_GPMC for booting so they select it. There is nothing much we can do there.

If all the board that need the OMAP_GPMC select it, then we should just take care that the K3 architecture does not behave differently unless there is a good reason to do it differently. AFAIR you told me this architecture did not select OMAP_GPMC yet.

Quoted 3 lines

What is left to do now is make user/defconfig files to enable OMAP_GPMC driver so other platforms that don't need OMAP_GPMC for basic operation can still enable them later via defconfig or manually by user.

And yes, that is also what I meant to be "cleaned up" :)

Quoted 23 lines
Quoted 23 lines
Quoted 8 lines
Quoted 8 lines
drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
 	depends on OMAP_GPMC
 
Quoted 8 lines
Quoted 5 lines

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Am I missing something?

MTD_NAND_OMAP2 NAND controller is a submodule of the OMAP GPMC IP. So it cannot work without OMAP_GPMC driver.

I didn't remember exactly but in that case it's okay, I was just surprised by the "select GPMC if ARCH_K3" but indeed with this explanation it makes more sense.

Quoted 1 line

Hope this clarifies the doubts.

Quoted 7 lines
Quoted 4 lines

Yes, thanks. I will send the fix to Linus then.

Cheers,
Miquèl

cheers,
-roger

Thanks,
Miquèl

maintainer
#10 lore raw
In reply to Roger Quadros

Hi Roger,

[email protected] wrote on Mon, 7 Mar 2022 14:25:48 +0200:

Quoted 56 lines

Hi Miquel,

Quoted 53 lines · Miquel Raynal

Hi Roger,

[email protected] wrote on Sat, 5 Mar 2022 00:50:14 +0200:

Quoted 28 lines

Hi Miquel,

Quoted 16 lines · Miquel Raynal

Hi Guenter, Roger,

[email protected] wrote on Sat, 26 Feb 2022 22:55:28 -0800:

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Roger Quadros
Quoted 9 lines

The root of the problem is that we are selecting symbols that have dependencies. This can cause random configurations that can fail. The cleanest solution is to avoid using select.

This driver uses interfaces from the OMAP_GPMC driver so we have to depend on it instead.

Fixes 4cd335dae3cf ("mtd: rawnand: omap2: Prevent invalid configuration and build error")
Quoted 8 lines
Quoted 3 lines
Quoted 1 line

Sorry for noticing that just now, but there is still a problem with this patch: we now always compile-in the OMAP_GPMC driver whenever we need the NAND controller, even though it is not needed. This grows the kernel for no reason.

Quoted 8 lines

Sorry, I did not understand what you meant.

We no longer explicitly enable OMAP_GPMC since we dropped the "select". This fixes all build issues that were reported recently.

MTD_NAND_OMAP2 will not be enabled if OMAP_GPMC is not since we added the "depends on". This fixes the original build issue that we started to fix with select initially.

Yes, this side is fine.

In the initial commit, you proposed:

drivers/mtd/nand/raw/Kconfig +1 -0
@@ -42,7 +42,8 @@ config MTD_NAND_OMAP2
        tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
        depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
        depends on HAS_IOMEM
+       select OMAP_GPMC if ARCH_K3
 
Quoted 7 lines
Quoted 3 lines

Which creates a dependency over OMAP_GPMC only for a single architecture. Which means that other OMAP platforms do not necessarily need OMAP_GPMC for the NAND controller to work. Now, you propose:

No that is not true. Other platforms that need MTD_NAND_OMAP2 are explicitly selecting OMAP_GPMC
i.e. in arch/arm/mach-omap2/Kconfig

Ok, in this case the fix is legit, but as you said there is certainly some clean up to do on this side in a second time.

Quoted 12 lines
Quoted 12 lines
drivers/mtd/nand/raw/Kconfig +0 -0
@@ -42,8 +42,7 @@ config MTD_NAND_OMAP2
 	tristate "OMAP2, OMAP3, OMAP4 and Keystone NAND controller"
 	depends on ARCH_OMAP2PLUS || ARCH_KEYSTONE || ARCH_K3 || COMPILE_TEST
 	depends on HAS_IOMEM
 	depends on OMAP_GPMC
 

This means any of the other OMAP architectures will compile the GPMC driver even though they might not need it, which would unnecessarily increase the kernel size.

Quoted 6 lines
Quoted 1 line

Am I missing something?

MTD_NAND_OMAP2 NAND controller is a submodule of the OMAP GPMC IP. So it cannot work without OMAP_GPMC driver.

Hope this clarifies the doubts.

I was not sure anymore if there was a proper hardware dependency here because of the "select GPMC if ARCH_K3" addition. But your clarification make this more understandable now.

I will send the fix to Linus.

Cheers,
Miquèl

Quoted 29 lines
Quoted 19 lines
Quoted 12 lines
Quoted 7 lines

In fact, Roger once said:

"We will figure out how to enable OMAP_GPMC for K3 architecture some other way."

It turns out this is not what was finally proposed. Could we try yet another solution?

This issue is still present i.e. we cannot enable MTD_NAND_OMAP2 driver on K3 platform since OMAP_GPMC config is hidden and not select-able by user or defconfig file.

Quoted 6 lines

But it is not yet a deal breaker since NAND on K3 is not yet enabled upstream.

For this I think OMAP_GPMC has to be a visible config entry and select-able from a defconfig file as I had done initially [1].

Now we have a lot of explanation to write as to why we need to do it ;)

Quoted 7 lines

We certainly do :)

Quoted 2 lines

[1] - https://lore.kernel.org/lkml/[email protected]/

Thanks,
Miquèl

cheers,
-roger