2013-06-04 14:48:23

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH, RFC 2/2] USB: host: make USB_ARCH_HAS_?HCI obsolete

The three options USB_ARCH_HAS_{EHCI,OHCI,XHCI} are all well beyond
their recommended shelf life. They have caused numerous build failures
over the years because they are never completely correct, and with
the move to splitting out the platform specific back-ends out of the
driver, there is no real need for them any more. Also, the use of making
USB_ARCH_HAS_HCD depend on it is questionable since one can always enable
dummy_hc these days.

This patch enables them unconditionally for all platforms and
architectures, which means it is now possible to build host controller
drivers for machines that are known not to come with this hardware,
but that is just how we treat most other drivers.

In order to minimise the impact on existing architecture code and
defconfig files, all the Kconfig are left present for now. All platforms
that currently do 'select USB_ARCH_HAS_*' should subsequently be changed
not to select that. All drivers depending on USB_ARCH_HAS_HCD should
be changed to depend on USB_SUPPORT instead.

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: Alan Stern <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Sarah Sharp <[email protected]>
---
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 92e1dc9..654cd81 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -2,59 +2,15 @@
# USB device configuration
#

-# many non-PCI SOC chips embed OHCI
+# These are unused now, remove them once they are no longer selected
config USB_ARCH_HAS_OHCI
- boolean
- # ARM:
- default y if SA1111
- default y if ARCH_OMAP
- default y if ARCH_S3C24XX
- default y if PXA27x
- default y if PXA3xx
- default y if ARCH_EP93XX
- default y if ARCH_AT91
- default y if MFD_TC6393XB
- default y if ARCH_W90X900
- default y if ARCH_DAVINCI_DA8XX
- default y if ARCH_CNS3XXX
- default y if PLAT_SPEAR
- default y if ARCH_EXYNOS
- # PPC:
- default y if STB03xxx
- default y if PPC_MPC52xx
- # MIPS:
- default y if MIPS_ALCHEMY
- default y if MACH_JZ4740
- # more:
- default PCI
-
-# some non-PCI hcds implement EHCI
+ def_bool HAS_IOMEM
+
config USB_ARCH_HAS_EHCI
- boolean
- default y if FSL_SOC
- default y if PPC_MPC512x
- default y if ARCH_IXP4XX
- default y if ARCH_W90X900
- default y if ARCH_AT91
- default y if ARCH_MXC
- default y if ARCH_MXS
- default y if ARCH_OMAP3
- default y if ARCH_CNS3XXX
- default y if ARCH_VT8500
- default y if PLAT_SPEAR
- default y if PLAT_S5P
- default y if ARCH_MSM
- default y if MICROBLAZE
- default y if SPARC_LEON
- default y if ARCH_MMP
- default y if MACH_LOONGSON1
- default y if PLAT_ORION
- default PCI
-
-# some non-PCI HCDs implement xHCI
+ def_bool HAS_IOMEM
+
config USB_ARCH_HAS_XHCI
- boolean
- default PCI
+ def_bool HAS_IOMEM

menuconfig USB_SUPPORT
bool "USB support"
@@ -71,19 +27,8 @@ config USB_COMMON
default y
depends on USB || USB_GADGET

-# Host-side USB depends on having a host controller
-# NOTE: dummy_hcd is always an option, but it's ignored here ...
-# NOTE: SL-811 option should be board-specific ...
config USB_ARCH_HAS_HCD
- boolean
- default y if USB_ARCH_HAS_OHCI
- default y if USB_ARCH_HAS_EHCI
- default y if USB_ARCH_HAS_XHCI
- default y if PCMCIA && !M32R # sl811_cs
- default y if ARM # SL-811
- default y if BLACKFIN # SL-811
- default y if SUPERH # r8a66597-hcd
- default PCI
+ def_bool HAS_IOMEM

# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
config USB
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index e060ecf..045f9d27 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -17,7 +17,7 @@ config USB_C67X00_HCD

config USB_XHCI_HCD
tristate "xHCI HCD (USB 3.0) support"
- depends on USB_ARCH_HAS_XHCI
+ depends on PCI
---help---
The eXtensible Host Controller Interface (xHCI) is standard for USB 3.0
"SuperSpeed" host controller hardware.
@@ -43,7 +43,6 @@ endif # USB_XHCI_HCD

config USB_EHCI_HCD
tristate "EHCI HCD (USB 2.0) support"
- depends on USB_ARCH_HAS_EHCI
---help---
The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
"high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
@@ -361,7 +360,6 @@ config USB_FUSBH200_HCD

config USB_OHCI_HCD
tristate "OHCI HCD (USB 1.1) support"
- depends on USB_ARCH_HAS_OHCI
select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
depends on USB_ISP1301 || !ARCH_LPC32XX
---help---


2013-06-04 15:22:04

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH, RFC 2/2] USB: host: make USB_ARCH_HAS_?HCI obsolete

On Tue, 4 Jun 2013, Arnd Bergmann wrote:

> The three options USB_ARCH_HAS_{EHCI,OHCI,XHCI} are all well beyond
> their recommended shelf life. They have caused numerous build failures
> over the years because they are never completely correct, and with
> the move to splitting out the platform specific back-ends out of the
> driver, there is no real need for them any more. Also, the use of making
> USB_ARCH_HAS_HCD depend on it is questionable since one can always enable
> dummy_hc these days.
>
> This patch enables them unconditionally for all platforms and
> architectures, which means it is now possible to build host controller
> drivers for machines that are known not to come with this hardware,
> but that is just how we treat most other drivers.
>
> In order to minimise the impact on existing architecture code and
> defconfig files, all the Kconfig are left present for now. All platforms
> that currently do 'select USB_ARCH_HAS_*' should subsequently be changed
> not to select that. All drivers depending on USB_ARCH_HAS_HCD should
> be changed to depend on USB_SUPPORT instead.

This is a good idea.

> diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> index 92e1dc9..654cd81 100644
> --- a/drivers/usb/Kconfig
> +++ b/drivers/usb/Kconfig

> -# some non-PCI HCDs implement xHCI

> @@ -71,19 +27,8 @@ config USB_COMMON
> default y
> depends on USB || USB_GADGET
>
> -# Host-side USB depends on having a host controller
> -# NOTE: dummy_hcd is always an option, but it's ignored here ...
> -# NOTE: SL-811 option should be board-specific ...
> config USB_ARCH_HAS_HCD
> - boolean
> - default y if USB_ARCH_HAS_OHCI
> - default y if USB_ARCH_HAS_EHCI
> - default y if USB_ARCH_HAS_XHCI
> - default y if PCMCIA && !M32R # sl811_cs
> - default y if ARM # SL-811
> - default y if BLACKFIN # SL-811
> - default y if SUPERH # r8a66597-hcd
> - default PCI
> + def_bool HAS_IOMEM

Instead of doing this, it makes more sense to enable USB_ARCH_HAS_HCD
whenever host-side USB is enabled. In other words,

def_bool USB

The HAS_IOMEM won't matter, because USB is defined only when
USB_SUPPORT is enabled, and USB_SUPPORT already depends on HAS_IOMEM.

Of course, it will then be necessary to remove the dependency on
USB_ARCH_HAS_HCD from the "config USB" entry. Which is exactly what
you're trying to accomplish, anyway.

> diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> index e060ecf..045f9d27 100644
> --- a/drivers/usb/host/Kconfig
> +++ b/drivers/usb/host/Kconfig
> @@ -17,7 +17,7 @@ config USB_C67X00_HCD
>
> config USB_XHCI_HCD
> tristate "xHCI HCD (USB 3.0) support"
> - depends on USB_ARCH_HAS_XHCI
> + depends on PCI

You probably don't want to add this dependency. After all, one of the
comments removed above points out that there are non-PCI xHCI
controllers.

Alan Stern

2013-06-04 15:38:57

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH, RFC 2/2] USB: host: make USB_ARCH_HAS_?HCI obsolete

On Tuesday 04 June 2013 11:22:01 Alan Stern wrote:
>
> Instead of doing this, it makes more sense to enable USB_ARCH_HAS_HCD
> whenever host-side USB is enabled. In other words,
>
> def_bool USB

The problem with this is that a lot of drivers (24 to be exact) are defined
like

config INPUT_ATI_REMOTE2
tristate "ATI / Philips USB RF remote control"
depends on USB_ARCH_HAS_HCD
select USB

so that would create a circular dependency unless we change all of them
at once. I did that when creating this patch, but then decided to
revert it for now and do smaller steps.

We could do

config USB_ARCH_HAS_HCD
def_bool USB_SUPPORT

or

config USB_ARCH_HAS_HCD
def_bool y

which would both have the exact same behavior as 'def_bool HAS_IOMEM'.

> The HAS_IOMEM won't matter, because USB is defined only when
> USB_SUPPORT is enabled, and USB_SUPPORT already depends on HAS_IOMEM.

Right.

> Of course, it will then be necessary to remove the dependency on
> USB_ARCH_HAS_HCD from the "config USB" entry. Which is exactly what
> you're trying to accomplish, anyway.

That dependency is redundant already, and should certainly be
removed now.

> > diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
> > index e060ecf..045f9d27 100644
> > --- a/drivers/usb/host/Kconfig
> > +++ b/drivers/usb/host/Kconfig
> > @@ -17,7 +17,7 @@ config USB_C67X00_HCD
> >
> > config USB_XHCI_HCD
> > tristate "xHCI HCD (USB 3.0) support"
> > - depends on USB_ARCH_HAS_XHCI
> > + depends on PCI
>
> You probably don't want to add this dependency. After all, one of the
> comments removed above points out that there are non-PCI xHCI
> controllers.

Yes, that was a mistake. I noticed this myself but forgot to edit
the file again.

Arnd

2013-06-04 16:58:35

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH, RFC 2/2] USB: host: make USB_ARCH_HAS_?HCI obsolete

On Tue, 4 Jun 2013, Arnd Bergmann wrote:

> On Tuesday 04 June 2013 11:22:01 Alan Stern wrote:
> >
> > Instead of doing this, it makes more sense to enable USB_ARCH_HAS_HCD
> > whenever host-side USB is enabled. In other words,
> >
> > def_bool USB
>
> The problem with this is that a lot of drivers (24 to be exact) are defined
> like
>
> config INPUT_ATI_REMOTE2
> tristate "ATI / Philips USB RF remote control"
> depends on USB_ARCH_HAS_HCD
> select USB

Oops. That's a problem.

> so that would create a circular dependency unless we change all of them
> at once. I did that when creating this patch, but then decided to
> revert it for now and do smaller steps.

Okay. Changing those 24 should be the next step.

> We could do
>
> config USB_ARCH_HAS_HCD
> def_bool USB_SUPPORT
>
> or
>
> config USB_ARCH_HAS_HCD
> def_bool y
>
> which would both have the exact same behavior as 'def_bool HAS_IOMEM'.

I'm in favor of "def_bool y".

Alan Stern

2013-06-04 17:40:41

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH, RFC 2/2] USB: host: make USB_ARCH_HAS_?HCI obsolete

On Tuesday 04 June 2013, Alan Stern wrote:
> On Tue, 4 Jun 2013, Arnd Bergmann wrote:
> > so that would create a circular dependency unless we change all of them
> > at once. I did that when creating this patch, but then decided to
> > revert it for now and do smaller steps.
>
> Okay. Changing those 24 should be the next step.

Yes, and we can remove the various 'select USB_ARCH_HAS_*' from arch
code at the same time. Since there is no hurry, I would suggest doing
that after 3.11-rc1 so we don't have to worry about dependencies.

> > We could do
> >
> > config USB_ARCH_HAS_HCD
> > def_bool USB_SUPPORT
> >
> > or
> >
> > config USB_ARCH_HAS_HCD
> > def_bool y
> >
> > which would both have the exact same behavior as 'def_bool HAS_IOMEM'.
>
> I'm in favor of "def_bool y".

Ok. And I'll use 'bool' for the 'USB_ARCH_HAS_?HCI' symbols since we
don't care about the value any more.

Arnd

2013-06-04 17:42:28

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH v2] usb: host: make USB_ARCH_HAS_?HCI obsolete

The three options USB_ARCH_HAS_{EHCI,OHCI,XHCI} are all well beyond
their recommended shelf life. They have caused numerous build failures
over the years because they are never completely correct, and with
the move to splitting out the platform specific back-ends out of the
driver, there is no real need for them any more. Also, the use of making
USB_ARCH_HAS_HCD depend on it is questionable since one can always enable
dummy_hc these days.

This patch enables them unconditionally for all platforms and
architectures, which means it is now possible to build host controller
drivers for machines that are known not to come with this hardware,
but that is just how we treat most other drivers.

In order to minimise the impact on existing architecture code and
defconfig files, all the Kconfig are left present for now. All platforms
that currently do 'select USB_ARCH_HAS_*' should subsequently be changed
not to select that. All drivers depending on USB_ARCH_HAS_HCD should
be changed to depend on USB_SUPPORT instead.

Signed-off-by: Arnd Bergmann <[email protected]>
Cc: [email protected]
Cc: Alan Stern <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Sarah Sharp <[email protected]>
---
drivers/usb/Kconfig | 69 ++++--------------------------------------
drivers/usb/host/Kconfig | 3 ---
2 files changed, 7 insertions(+), 65 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 92e1dc9..73f62ca 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -2,59 +2,15 @@
# USB device configuration
#

-# many non-PCI SOC chips embed OHCI
+# These are unused now, remove them once they are no longer selected
config USB_ARCH_HAS_OHCI
- boolean
- # ARM:
- default y if SA1111
- default y if ARCH_OMAP
- default y if ARCH_S3C24XX
- default y if PXA27x
- default y if PXA3xx
- default y if ARCH_EP93XX
- default y if ARCH_AT91
- default y if MFD_TC6393XB
- default y if ARCH_W90X900
- default y if ARCH_DAVINCI_DA8XX
- default y if ARCH_CNS3XXX
- default y if PLAT_SPEAR
- default y if ARCH_EXYNOS
- # PPC:
- default y if STB03xxx
- default y if PPC_MPC52xx
- # MIPS:
- default y if MIPS_ALCHEMY
- default y if MACH_JZ4740
- # more:
- default PCI
-
-# some non-PCI hcds implement EHCI
+ bool
+
config USB_ARCH_HAS_EHCI
- boolean
- default y if FSL_SOC
- default y if PPC_MPC512x
- default y if ARCH_IXP4XX
- default y if ARCH_W90X900
- default y if ARCH_AT91
- default y if ARCH_MXC
- default y if ARCH_MXS
- default y if ARCH_OMAP3
- default y if ARCH_CNS3XXX
- default y if ARCH_VT8500
- default y if PLAT_SPEAR
- default y if PLAT_S5P
- default y if ARCH_MSM
- default y if MICROBLAZE
- default y if SPARC_LEON
- default y if ARCH_MMP
- default y if MACH_LOONGSON1
- default y if PLAT_ORION
- default PCI
-
-# some non-PCI HCDs implement xHCI
+ bool
+
config USB_ARCH_HAS_XHCI
- boolean
- default PCI
+ bool

menuconfig USB_SUPPORT
bool "USB support"
@@ -71,19 +27,8 @@ config USB_COMMON
default y
depends on USB || USB_GADGET

-# Host-side USB depends on having a host controller
-# NOTE: dummy_hcd is always an option, but it's ignored here ...
-# NOTE: SL-811 option should be board-specific ...
config USB_ARCH_HAS_HCD
- boolean
- default y if USB_ARCH_HAS_OHCI
- default y if USB_ARCH_HAS_EHCI
- default y if USB_ARCH_HAS_XHCI
- default y if PCMCIA && !M32R # sl811_cs
- default y if ARM # SL-811
- default y if BLACKFIN # SL-811
- default y if SUPERH # r8a66597-hcd
- default PCI
+ def_bool y

# ARM SA1111 chips have a non-PCI based "OHCI-compatible" USB host interface.
config USB
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index e060ecf..254191f 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -17,7 +17,6 @@ config USB_C67X00_HCD

config USB_XHCI_HCD
tristate "xHCI HCD (USB 3.0) support"
- depends on USB_ARCH_HAS_XHCI
---help---
The eXtensible Host Controller Interface (xHCI) is standard for USB 3.0
"SuperSpeed" host controller hardware.
@@ -43,7 +42,6 @@ endif # USB_XHCI_HCD

config USB_EHCI_HCD
tristate "EHCI HCD (USB 2.0) support"
- depends on USB_ARCH_HAS_EHCI
---help---
The Enhanced Host Controller Interface (EHCI) is standard for USB 2.0
"high speed" (480 Mbit/sec, 60 Mbyte/sec) host controller hardware.
@@ -361,7 +359,6 @@ config USB_FUSBH200_HCD

config USB_OHCI_HCD
tristate "OHCI HCD (USB 1.1) support"
- depends on USB_ARCH_HAS_OHCI
select ISP1301_OMAP if MACH_OMAP_H2 || MACH_OMAP_H3
depends on USB_ISP1301 || !ARCH_LPC32XX
---help---

2013-06-04 18:11:35

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH v2] usb: host: make USB_ARCH_HAS_?HCI obsolete

On Tue, 4 Jun 2013, Arnd Bergmann wrote:

> The three options USB_ARCH_HAS_{EHCI,OHCI,XHCI} are all well beyond
> their recommended shelf life. They have caused numerous build failures
> over the years because they are never completely correct, and with
> the move to splitting out the platform specific back-ends out of the
> driver, there is no real need for them any more. Also, the use of making
> USB_ARCH_HAS_HCD depend on it is questionable since one can always enable
> dummy_hc these days.
>
> This patch enables them unconditionally for all platforms and
> architectures, which means it is now possible to build host controller
> drivers for machines that are known not to come with this hardware,
> but that is just how we treat most other drivers.
>
> In order to minimise the impact on existing architecture code and
> defconfig files, all the Kconfig are left present for now. All platforms
> that currently do 'select USB_ARCH_HAS_*' should subsequently be changed
> not to select that. All drivers depending on USB_ARCH_HAS_HCD should
> be changed to depend on USB_SUPPORT instead.

Acked-by: Alan Stern <[email protected]>