Skip to contentSkip to conversation

spi-nor: intel-spi: Fix Kconfig dependency to LPC_ICH

PATCH Applied Bin Meng 5 participants 12 messages Aug 25, 2017 – Oct 24, 2017

Subsystems (2)

v1 of 2 Applied Latest is v2 →

lore
Share & tools
lore

Bin Meng

author
#0 lore raw

PATCH 1/1 spi-nor: intel-spi: Fix Kconfig dependency to LPC_ICH

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

---

 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +1 -0
index bfdfb1e..e998800 100644
@@ -93,6 +93,7 @@ config SPI_INTEL_SPI_PLATFORM
 	tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
 	depends on X86
 	select SPI_INTEL_SPI
+	select LPC_ICH
 	help
 	  This enables platform support for the Intel PCH/PCU SPI
 	  controller in master mode. This controller is present in modern
Signature · 1 line
2.9.2
#1 lore raw
Quoted 14 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

---

 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +0 -0
index bfdfb1e..e998800 100644

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PLATFORM · line 96

Quoted 4 lines
drivers/mtd/spi-nor/Kconfig +1 -0
@@ -93,6 +93,7 @@ config SPI_INTEL_SPI_PLATFORM
 	tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
 	depends on X86
 	select SPI_INTEL_SPI
+	select LPC_ICH

How about

	depends on X86 && LPC_ICH

instead?

author
#2 lore raw

Hi Mika,

Quoted 22 lines · Mika Westerberg
Quoted 14 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

---

 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +0 -0
index bfdfb1e..e998800 100644

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PLATFORM · line 96

Quoted 4 lines
drivers/mtd/spi-nor/Kconfig +1 -0
@@ -93,6 +93,7 @@ config SPI_INTEL_SPI_PLATFORM
      tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
      depends on X86
      select SPI_INTEL_SPI
+     select LPC_ICH

How about

Quoted 3 lines
        depends on X86 && LPC_ICH

instead?

Other LPC_ICH users (like gpio, watchdog) use the 'select' logic, so I would prefer to keep things consistent.

Regards,
Bin

#4 lore raw
In reply to Mika Westerberg
Quoted 22 lines · Mika Westerberg
Quoted 14 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

---

  drivers/mtd/spi-nor/Kconfig | 1 +
  1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +0 -0
index bfdfb1e..e998800 100644

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PLATFORM · line 96

Quoted 4 lines
drivers/mtd/spi-nor/Kconfig +1 -0
@@ -93,6 +93,7 @@ config SPI_INTEL_SPI_PLATFORM
  	tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
  	depends on X86
  	select SPI_INTEL_SPI
+	select LPC_ICH

How about

Quoted 3 lines
	depends on X86 && LPC_ICH

instead?

I prefer Bin's version, as with your patch, the MTD SPI driver will not be "seen" / selectable, as long as the LPC_ICH support is not enabled. I've been hunting such dependencies myself a few times and find them unnecessary burden.

Thanks,
Stefan

#5 lore raw
In reply to Bin Meng

Le 25/08/2017 à 10:12, Bin Meng a écrit :

Quoted 4 lines

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

Applied to the spi-nor/next branch of l2-mtd

Thanks!

Quoted 18 lines

---

 drivers/mtd/spi-nor/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/spi-nor/Kconfig +1 -0
index bfdfb1e..e998800 100644
@@ -93,6 +93,7 @@ config SPI_INTEL_SPI_PLATFORM
 	tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
 	depends on X86
 	select SPI_INTEL_SPI
+	select LPC_ICH
 	help
 	  This enables platform support for the Intel PCH/PCU SPI
 	  controller in master mode. This controller is present in modern
#6 lore raw
Quoted 7 lines · Cyrille Pitchen
Quoted 4 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

Applied to the spi-nor/next branch of l2-mtd

This causes a build error now:

warning: (SPI_INTEL_SPI_PLATFORM && ITCO_WDT) selects LPC_ICH which has unmet direct dependencies (HAS_IOMEM && PCI) drivers/mfd/lpc_ich.c: In function 'lpc_ich_init_spi':
drivers/mfd/lpc_ich.c:1137:3: error: implicit declaration of function 'pci_bus_write_config_byte'; did you mean 'pci_write_config_byte'? [-Werror=implicit-function-declaration]

Generally speaking, using 'select' to force-enable another driver is a bad idea and causes endless problems, but if you insist on doing that, please make sure you get the right dependencies.

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

How about this:

drivers/mtd/spi-nor/Kconfig +4 -4
index 19bcb63a1ce7..b81d9b4dae7b 100644
@@ -90,7 +90,7 @@ config SPI_INTEL_SPI
        tristate
 
 config SPI_INTEL_SPI_PCI
-       tristate "Intel PCH/PCU SPI flash PCI driver" if EXPERT
+       tristate "Intel PCH/PCU SPI flash PCI driver"
        depends on X86 && PCI
        select SPI_INTEL_SPI
        help
@@ -106,10 +106,10 @@ config SPI_INTEL_SPI_PCI
          will be called intel-spi-pci.
 
 config SPI_INTEL_SPI_PLATFORM
-       tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
-       depends on X86
+       tristate "Intel PCH/PCU SPI flash platform driver"
+       depends on X86 && (PCI || COMPILE_TEST)
        select SPI_INTEL_SPI
-       select LPC_ICH
+       select LPC_ICH if PCI
        help
          This enables platform support for the Intel PCH/PCU SPI
          controller in master mode. This controller is present in modern

Arnd

#7 lore raw

Hi Arnd,

Le 13/10/2017 à 13:15, Arnd Bergmann a écrit :

Quoted 58 lines
Quoted 7 lines · Cyrille Pitchen
Quoted 4 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

Applied to the spi-nor/next branch of l2-mtd

This causes a build error now:

warning: (SPI_INTEL_SPI_PLATFORM && ITCO_WDT) selects LPC_ICH which has unmet direct dependencies (HAS_IOMEM && PCI) drivers/mfd/lpc_ich.c: In function 'lpc_ich_init_spi':
drivers/mfd/lpc_ich.c:1137:3: error: implicit declaration of function 'pci_bus_write_config_byte'; did you mean 'pci_write_config_byte'? [-Werror=implicit-function-declaration]

Generally speaking, using 'select' to force-enable another driver is a bad idea and causes endless problems, but if you insist on doing that, please make sure you get the right dependencies.

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

How about this:

drivers/mtd/spi-nor/Kconfig +4 -4
index 19bcb63a1ce7..b81d9b4dae7b 100644
@@ -90,7 +90,7 @@ config SPI_INTEL_SPI
        tristate
 
 config SPI_INTEL_SPI_PCI
-       tristate "Intel PCH/PCU SPI flash PCI driver" if EXPERT
+       tristate "Intel PCH/PCU SPI flash PCI driver"
        depends on X86 && PCI
        select SPI_INTEL_SPI
        help
@@ -106,10 +106,10 @@ config SPI_INTEL_SPI_PCI
          will be called intel-spi-pci.
 
 config SPI_INTEL_SPI_PLATFORM
-       tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
-       depends on X86
+       tristate "Intel PCH/PCU SPI flash platform driver"
+       depends on X86 && (PCI || COMPILE_TEST)
        select SPI_INTEL_SPI
-       select LPC_ICH
+       select LPC_ICH if PCI
        help
          This enables platform support for the Intel PCH/PCU SPI
          controller in master mode. This controller is present in modern
Quoted 2 lines

Arnd

The patch has been removed from spi-nor/next and updated to 'Rejected' in patchwork.

Thanks for your report.

Bin, you may have to submit another patch with the correct dependencies or maybe adopt the "depends LPC_ICH" approach as suggested by Mika.

Best regards,

Cyrille

author
#8 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Quoted 10 lines · Arnd Bergmann
Quoted 7 lines · Cyrille Pitchen
Quoted 4 lines · Bin Meng

The Intel SPI-NOR driver is dependent on LPC_ICH to get the platform data. Select it in the Kconfig.

Applied to the spi-nor/next branch of l2-mtd

Quoted 9 lines

This causes a build error now:

warning: (SPI_INTEL_SPI_PLATFORM && ITCO_WDT) selects LPC_ICH which has unmet direct dependencies (HAS_IOMEM && PCI) drivers/mfd/lpc_ich.c: In function 'lpc_ich_init_spi':
drivers/mfd/lpc_ich.c:1137:3: error: implicit declaration of function 'pci_bus_write_config_byte'; did you mean 'pci_write_config_byte'? [-Werror=implicit-function-declaration]

Thanks for your testing. However, I believe this build error cannot be seen in a real system due to x86 always has PCI on. But I see you were doing build testing with COMPILE_TEST.

Quoted 5 lines

Generally speaking, using 'select' to force-enable another driver is a bad idea and causes endless problems, but if you insist on doing that, please make sure you get the right dependencies.

Sure.

Quoted 4 lines

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

I will leave this to Mika to comment the "EXPERT" usage. If we remove this, I think that should be another patch and the documentation of this driver should be updated too.

Quoted 16 lines

How about this:

drivers/mtd/spi-nor/Kconfig +1 -1
index 19bcb63a1ce7..b81d9b4dae7b 100644
@@ -90,7 +90,7 @@ config SPI_INTEL_SPI
        tristate
 
 config SPI_INTEL_SPI_PCI
-       tristate "Intel PCH/PCU SPI flash PCI driver" if EXPERT
+       tristate "Intel PCH/PCU SPI flash PCI driver"
        depends on X86 && PCI
        select SPI_INTEL_SPI
        help

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PCI · line 112

Quoted 10 lines
drivers/mtd/spi-nor/Kconfig +3 -3
@@ -106,10 +106,10 @@ config SPI_INTEL_SPI_PCI
          will be called intel-spi-pci.
 
 config SPI_INTEL_SPI_PLATFORM
-       tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
-       depends on X86
+       tristate "Intel PCH/PCU SPI flash platform driver"
+       depends on X86 && (PCI || COMPILE_TEST)
        select SPI_INTEL_SPI
-       select LPC_ICH
+       select LPC_ICH if PCI

I think we just need do:

depends on X86 && PCI

then

select LPC_ICH

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PCI · line 115

Quoted 4 lines
drivers/mtd/spi-nor/Kconfig +0 -0
        help
          This enables platform support for the Intel PCH/PCU SPI
          controller in master mode. This controller is present in modern

Regards,
Bin

#9 lore raw
Quoted 9 lines · Bin Meng

On Fri, Oct 13, 2017 at 7:15 PM, Arnd Bergmann <[email protected]> wrote:>> On Wed, Oct 11, 2017 at 10:03 AM, Cyrille Pitchen

Quoted 7 lines

warning: (SPI_INTEL_SPI_PLATFORM && ITCO_WDT) selects LPC_ICH which has unmet direct dependencies (HAS_IOMEM && PCI) drivers/mfd/lpc_ich.c: In function 'lpc_ich_init_spi':
drivers/mfd/lpc_ich.c:1137:3: error: implicit declaration of function 'pci_bus_write_config_byte'; did you mean 'pci_write_config_byte'? [-Werror=implicit-function-declaration]

Quoted 3 lines

Thanks for your testing. However, I believe this build error cannot be seen in a real system due to x86 always has PCI on. But I see you were doing build testing with COMPILE_TEST.

I don't think there is a general dependency on PCI for x86, other than the fact that most device drivers require it and you'd normally want to enable it.

Quoted 8 lines
Quoted 4 lines

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

I will leave this to Mika to comment the "EXPERT" usage. If we remove this, I think that should be another patch and the documentation of this driver should be updated too.

Ok.

Quoted 29 lines
Quoted 16 lines

How about this:

drivers/mtd/spi-nor/Kconfig +1 -1
index 19bcb63a1ce7..b81d9b4dae7b 100644
@@ -90,7 +90,7 @@ config SPI_INTEL_SPI
        tristate
 
 config SPI_INTEL_SPI_PCI
-       tristate "Intel PCH/PCU SPI flash PCI driver" if EXPERT
+       tristate "Intel PCH/PCU SPI flash PCI driver"
        depends on X86 && PCI
        select SPI_INTEL_SPI
        help

drivers/mtd/spi-nor/Kconfig config SPI_INTEL_SPI_PCI · line 112

Quoted 10 lines
drivers/mtd/spi-nor/Kconfig +3 -3
@@ -106,10 +106,10 @@ config SPI_INTEL_SPI_PCI
          will be called intel-spi-pci.
 
 config SPI_INTEL_SPI_PLATFORM
-       tristate "Intel PCH/PCU SPI flash platform driver" if EXPERT
-       depends on X86
+       tristate "Intel PCH/PCU SPI flash platform driver"
+       depends on X86 && (PCI || COMPILE_TEST)
        select SPI_INTEL_SPI
-       select LPC_ICH
+       select LPC_ICH if PCI

I think we just need do:

Quoted 5 lines

depends on X86 && PCI

then

select LPC_ICH

Right, that would solve this particular build issue, just not allow the compile-test alternative.

We could also try to fix this more broadly, to allow compile-testing independent of X86: It is bad style to have a 'select' statement for a user-visible symbol (both in my version above, and yours).

The only connection I see between LPC_ICH and SPI_INTEL_SPI_PCI is that at the moment that MFD driver is the only thing that provides a platform device named "intel-spi", but I see no reason why the spi-nor driver needs to know about this.

In similar cases on ARM, I tend to recommend something like

config SPI_INTEL_SPI_PLATFORM
tristate "Intel PCH/PCU SPI flash platform driver" if LPC_ICH
|| COMPILE_TEST
select SPI_INTEL_SPI

and then change all the other 'select LPC_ICH' to 'depends on as well. If we leave the 'select' in place here, it might be good to remove the prompt from the LPC_ICH option and have it only selected by the other drivers.

Arnd

#10 lore raw
In reply to Bin Meng
Quoted 8 lines · Bin Meng
Quoted 4 lines

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

I will leave this to Mika to comment the "EXPERT" usage. If we remove this, I think that should be another patch and the documentation of this driver should be updated too.

Yeah, I guess we can remove that EXPERT dependency. It was added there exactly because I did not want ordinary users playing with the device and inadvertently overwrite their BIOSes (if it is not protected). I also agree it should be a separate patch. Do you want to do that or should I?

author
#11 lore raw

Hi Mika,

Quoted 10 lines · Mika Westerberg
Quoted 8 lines · Bin Meng
Quoted 4 lines

Also, the 'depends on EXPERT' statement looks misplaced, enabling EXPERT should only be there to allow you to turn extra things *off*, not to hide device drivers.

I will leave this to Mika to comment the "EXPERT" usage. If we remove this, I think that should be another patch and the documentation of this driver should be updated too.

Quoted 5 lines

Yeah, I guess we can remove that EXPERT dependency. It was added there exactly because I did not want ordinary users playing with the device and inadvertently overwrite their BIOSes (if it is not protected). I also agree it should be a separate patch. Do you want to do that or should I?

Thanks. I can prepare a patch to remove EXPERT.

Regards,
Bin