Skip to contentSkip to conversation

ehci: Replace board_prepare_usb with board_usb_init

PATCH Superseded Ramon Fried 3 participants 4 messages May 20, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ehci: Replace board_prepare_usb with board_usb_init

Use standard board_usb_init() instead of the specific board_prepare_usb.

---
v2: remove a line that sneaked in by mistake

 board/qualcomm/dragonboard410c/dragonboard410c.c | 4 ++--
 drivers/usb/host/ehci-msm.c                      | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +2 -2
index e7ead57f0d..679eab759a 100644
@@ -41,7 +41,7 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-int board_prepare_usb(enum usb_init_type type)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	static struct udevice *pmic_gpio;
 	static struct gpio_desc hub_reset, usb_sel;
@@ -90,7 +90,7 @@ int board_prepare_usb(enum usb_init_type type)
 		}
 	}
 
-	if (type == USB_INIT_HOST) {
+	if (init == USB_INIT_HOST) {
 		/* Start USB Hub */
 		dm_gpio_set_dir_flags(&hub_reset,
 				      GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);
drivers/usb/host/ehci-msm.c +2 -7
index 17bfa7c02f..db982624dc 100644
@@ -38,11 +38,6 @@ struct msm_ehci_priv {
 	struct ulpi_viewport ulpi_vp; /* ULPI Viewport */
 };
 
-int __weak board_prepare_usb(enum usb_init_type type)
-{
-	return 0;
-}
-
 static void setup_usb_phy(struct msm_ehci_priv *priv)
 {
 	/* Select and enable external configuration with USB PHY */
@@ -102,7 +97,7 @@ static int ehci_usb_probe(struct udevice *dev)
 	hcor = (struct ehci_hcor *)((phys_addr_t)hccr +
 			HC_LENGTH(ehci_readl(&(hccr)->cr_capbase)));
 
-	ret = board_prepare_usb(USB_INIT_HOST);
+	ret = board_usb_init(0, USB_INIT_HOST);
 	if (ret < 0)
 		return ret;
 
@@ -124,7 +119,7 @@ static int ehci_usb_remove(struct udevice *dev)
 
 	reset_usb_phy(p);
 
-	ret = board_prepare_usb(USB_INIT_DEVICE); /* Board specific hook */
+	ret = board_usb_init(0, USB_INIT_DEVICE); /* Board specific hook */
 	if (ret < 0)
 		return ret;
 
Signature · 1 line
2.17.0
#1 lore raw

PATCH v2 1/1 ehci: Replace board_prepare_usb with board_usb_init

Quoted 23 lines · Ramon Fried

Use standard board_usb_init() instead of the specific board_prepare_usb.

---
v2: remove a line that sneaked in by mistake

 board/qualcomm/dragonboard410c/dragonboard410c.c | 4 ++--
 drivers/usb/host/ehci-msm.c                      | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
index e7ead57f0d..679eab759a 100644
@@ -41,7 +41,7 @@ int dram_init_banksize(void)
 	return 0;
 }
 
-int board_prepare_usb(enum usb_init_type type)
+int board_usb_init(int index, enum usb_init_type init)
 {
 	static struct udevice *pmic_gpio;
 	static struct gpio_desc hub_reset, usb_sel;

board/qualcomm/dragonboard410c/dragonboard410c.c int board_prepare_usb(enum usb_init_type type) · line 96

Quoted 8 lines
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
@@ -90,7 +90,7 @@ int board_prepare_usb(enum usb_init_type type)
 		}
 	}
 
-	if (type == USB_INIT_HOST) {
+	if (init == USB_INIT_HOST) {
 		/* Start USB Hub */
 		dm_gpio_set_dir_flags(&hub_reset,
 				      GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);

Obvious question -- can this not be started by some regulator ? Then this board hook can go away altogether.

[...]

Signature · 2 lines
Best regards,
Marek Vasut
#2 lore raw

PATCH v2 1/1 ehci: Replace board_prepare_usb with board_usb_init

Quoted 27 lines · Marek Vasut
Quoted 26 lines · Ramon Fried

Use standard board_usb_init() instead of the specific board_prepare_usb.

---
v2: remove a line that sneaked in by mistake

 board/qualcomm/dragonboard410c/dragonboard410c.c | 4 ++--
 drivers/usb/host/ehci-msm.c                      | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
index e7ead57f0d..679eab759a 100644
@@ -41,7 +41,7 @@ int dram_init_banksize(void)
      return 0;
 }
 
-int board_prepare_usb(enum usb_init_type type)
+int board_usb_init(int index, enum usb_init_type init)
 {
      static struct udevice *pmic_gpio;
      static struct gpio_desc hub_reset, usb_sel;
@@ -90,7 +90,7 @@ int board_prepare_usb(enum usb_init_type type)
              }
      }
 
Quoted 8 lines

board/qualcomm/dragonboard410c/dragonboard410c.c int board_prepare_usb(enum usb_init_type type) · line 96

Quoted 5 lines
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
-     if (type == USB_INIT_HOST) {
+     if (init == USB_INIT_HOST) {
              /* Start USB Hub */
              dm_gpio_set_dir_flags(&hub_reset,
                                    GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);

Obvious question -- can this not be started by some regulator ? Then this board hook can go away altogether.

By regulator do you mean pinctrl framework ?

Quoted 6 lines

[...]

--
Best regards,
Marek Vasut

#3 lore raw

PATCH v2 1/1 ehci: Replace board_prepare_usb with board_usb_init

Quoted 36 lines · Ramon Fried
Quoted 27 lines · Marek Vasut
Quoted 26 lines · Ramon Fried

Use standard board_usb_init() instead of the specific board_prepare_usb.

---
v2: remove a line that sneaked in by mistake

 board/qualcomm/dragonboard410c/dragonboard410c.c | 4 ++--
 drivers/usb/host/ehci-msm.c                      | 9 ++-------
 2 files changed, 4 insertions(+), 9 deletions(-)
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
index e7ead57f0d..679eab759a 100644
@@ -41,7 +41,7 @@ int dram_init_banksize(void)
      return 0;
 }
 
-int board_prepare_usb(enum usb_init_type type)
+int board_usb_init(int index, enum usb_init_type init)
 {
      static struct udevice *pmic_gpio;
      static struct gpio_desc hub_reset, usb_sel;
@@ -90,7 +90,7 @@ int board_prepare_usb(enum usb_init_type type)
              }
      }
 
Quoted 8 lines

board/qualcomm/dragonboard410c/dragonboard410c.c int board_prepare_usb(enum usb_init_type type) · line 96

Quoted 5 lines
board/qualcomm/dragonboard410c/dragonboard410c.c +1 -1
-     if (type == USB_INIT_HOST) {
+     if (init == USB_INIT_HOST) {
              /* Start USB Hub */
              dm_gpio_set_dir_flags(&hub_reset,
                                    GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE);

Obvious question -- can this not be started by some regulator ? Then this board hook can go away altogether.

Quoted 1 line

By regulator do you mean pinctrl framework ?

Yes, something which would allow you to get rid of this board stuff altogether.

Signature · 2 lines
Best regards,
Marek Vasut