Skip to contentSkip to conversation

usb: ehci-omap: Drop dead code

PATCH In review Adam Ford 2 participants 4 messages Feb 12, 2022 – Feb 14, 2022

Subsystems (4)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH 1/1 usb: ehci-omap: Drop dead code

omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init is only called by the probe function, so it can be static to that function. Remove both from the header along with some additional checking for DM_USB.

arch/arm/include/asm/ehci-omap.h +0 -13
index f970bba937..2b51b5eb99 100644
@@ -123,17 +123,4 @@ struct omap_ehci {
 	u32 insreg08;		/* 0xb0 */
 };
 
-#if !CONFIG_IS_ENABLED(DM_USB) || !CONFIG_IS_ENABLED(OF_CONTROL)
-/*
- * FIXME: forward declaration of this structs needed because omap got the
- * ehci implementation backwards. move out ehci_hcd_x from board files
- */
-struct ehci_hccr;
-struct ehci_hcor;
-
-int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
-		       struct ehci_hccr **hccr, struct ehci_hcor **hcor);
-int omap_ehci_hcd_stop(void);
-#endif
-
 #endif /* _OMAP_COMMON_EHCI_H_ */
drivers/usb/host/ehci-omap.c +1 -16
index d5facf10e1..d34c0add4a 100644
@@ -163,27 +163,12 @@ static inline void omap_ehci_phy_reset(int on, int delay)
 #define omap_ehci_phy_reset(on, delay)	do {} while (0)
 #endif
 
-/* Reset is needed otherwise the kernel-driver will throw an error. */
-int omap_ehci_hcd_stop(void)
-{
-	debug("Resetting OMAP EHCI\n");
-	omap_ehci_phy_reset(1, 0);
-
-	if (omap_uhh_reset() < 0)
-		return -1;
-
-	if (omap_ehci_tll_reset() < 0)
-		return -1;
-
-	return 0;
-}
-
 /*
  * Initialize the OMAP EHCI controller and PHY.
  * Based on "drivers/usb/host/ehci-omap.c" from Linux 3.1
  * See there for additional Copyrights.
  */
-int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata)
+static int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata)
 {
 	int ret;
 	unsigned int i, reg = 0, rev = 0;
Signature · 1 line
2.32.0
author
#1 lore raw
Quoted 6 lines · Adam Ford

omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init is only called by the probe function, so it can be static to that function. Remove both from the header along with some additional checking for DM_USB.

If it's not too late to hold off on this, I'd like to resend it as part of a larger series. I have a whole series based on this that converts the driver to use the phy subsystem in an effort to remove the OMAP_EHCI_PHYx_RESET_GPIO from Kconfig that makes the driver more device-tree friendly. Rather than doing this and waiting for the reviews, merge, etc. then doing the follow-up, I'd like to just send the series to avoid confusion as to any dependent patches.

If it's too late, I'll just send the subsequent patches after this one gets reviewed and merged.

adam

Quoted 60 lines
arch/arm/include/asm/ehci-omap.h +0 -13
index f970bba937..2b51b5eb99 100644
@@ -123,17 +123,4 @@ struct omap_ehci {
        u32 insreg08;           /* 0xb0 */
 };
 
-#if !CONFIG_IS_ENABLED(DM_USB) || !CONFIG_IS_ENABLED(OF_CONTROL)
-/*
- * FIXME: forward declaration of this structs needed because omap got the
- * ehci implementation backwards. move out ehci_hcd_x from board files
- */
-struct ehci_hccr;
-struct ehci_hcor;
-
-int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata,
-                      struct ehci_hccr **hccr, struct ehci_hcor **hcor);
-int omap_ehci_hcd_stop(void);
-#endif
-
 #endif /* _OMAP_COMMON_EHCI_H_ */
drivers/usb/host/ehci-omap.c +1 -17
index d5facf10e1..d34c0add4a 100644
@@ -163,27 +163,12 @@ static inline void omap_ehci_phy_reset(int on, int delay)
 #define omap_ehci_phy_reset(on, delay) do {} while (0)
 #endif
 
-/* Reset is needed otherwise the kernel-driver will throw an error. */
-int omap_ehci_hcd_stop(void)
-{
-       debug("Resetting OMAP EHCI\n");
-       omap_ehci_phy_reset(1, 0);
-
-       if (omap_uhh_reset() < 0)
-               return -1;
-
-       if (omap_ehci_tll_reset() < 0)
-               return -1;
-
-       return 0;
-}
-
 /*
  * Initialize the OMAP EHCI controller and PHY.
  * Based on "drivers/usb/host/ehci-omap.c" from Linux 3.1
  * See there for additional Copyrights.
  */
-int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata)
+static int omap_ehci_hcd_init(int index, struct omap_usbhs_board_data *usbhs_pdata)
 {
        int ret;
        unsigned int i, reg = 0, rev = 0;
--

2.32.0

#2 lore raw
Quoted 16 lines · Adam Ford
Quoted 6 lines · Adam Ford

omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init is only called by the probe function, so it can be static to that function. Remove both from the header along with some additional checking for DM_USB.

If it's not too late to hold off on this, I'd like to resend it as part of a larger series. I have a whole series based on this that converts the driver to use the phy subsystem in an effort to remove the OMAP_EHCI_PHYx_RESET_GPIO from Kconfig that makes the driver more device-tree friendly. Rather than doing this and waiting for the reviews, merge, etc. then doing the follow-up, I'd like to just send the series to avoid confusion as to any dependent patches.

Quoted 2 lines

If it's too late, I'll just send the subsequent patches after this one gets reviewed and merged.

It is not too late, but make sure you CC someone who can actually test this EHCI OMAP stuff.

author
#3 lore raw
Quoted 18 lines · Marek Vasut
Quoted 16 lines · Adam Ford
Quoted 6 lines · Adam Ford

omap_ehci_hcd_stop appears to be dead code, and omap_ehci_hcd_init is only called by the probe function, so it can be static to that function. Remove both from the header along with some additional checking for DM_USB.

If it's not too late to hold off on this, I'd like to resend it as part of a larger series. I have a whole series based on this that converts the driver to use the phy subsystem in an effort to remove the OMAP_EHCI_PHYx_RESET_GPIO from Kconfig that makes the driver more device-tree friendly. Rather than doing this and waiting for the reviews, merge, etc. then doing the follow-up, I'd like to just send the series to avoid confusion as to any dependent patches.

Quoted 5 lines
Quoted 2 lines

If it's too late, I'll just send the subsequent patches after this one gets reviewed and merged.

It is not too late, but make sure you CC someone who can actually test this EHCI OMAP stuff.

I have an OMAP35, DM37 and an AM3517 that I'll be using for testing the OMAP3's. So far it works on the DM3730. I haven't confirmed the others yet. I'll CC any of the maintainers for the defconfig files that enable the driver or OMAP_EHCI_PHYx_RESET_GPIO.

adam