All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: gadget: aspeed: Fix probe regression
@ 2022-10-17  5:30 Joel Stanley
  2022-10-17 20:40 ` Zev Weiss
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Stanley @ 2022-10-17  5:30 UTC (permalink / raw)
  To: Felipe Balbi, Greg Kroah-Hartman, Alan Stern, Benjamin Herrenschmidt
  Cc: Andrew Jeffery, linux-usb, linux-aspeed, linux-kernel, Zev Weiss,
	Jae Hyun Yoo, stable

Since commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets"),
the gadget devices are proper driver core devices, which caused each
device to request pinmux settings:

 aspeed_vhub 1e6a0000.usb-vhub: Initialized virtual hub in USB2 mode
 aspeed-g5-pinctrl 1e6e2080.pinctrl: pin A7 already requested by 1e6a0000.usb-vhub; cannot claim for gadget.0
 aspeed-g5-pinctrl 1e6e2080.pinctrl: pin-232 (gadget.0) status -22
 aspeed-g5-pinctrl 1e6e2080.pinctrl: could not request pin 232 (A7) from group USB2AD  on device aspeed-g5-pinctrl
 g_mass_storage gadget.0: Error applying setting, reverse things back

The vhub driver has already claimed the pins, so prevent the gadgets
from requesting them too by setting the magic of_node_reused flag. This
causes the driver core to skip the mux request.

Reported-by: Zev Weiss <zev@bewilderbeest.net>
Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets")
Cc: stable@vger.kernel.org
Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/usb/gadget/udc/aspeed-vhub/dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/udc/aspeed-vhub/dev.c b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
index b0dfca43fbdc..4f3bc27c1c62 100644
--- a/drivers/usb/gadget/udc/aspeed-vhub/dev.c
+++ b/drivers/usb/gadget/udc/aspeed-vhub/dev.c
@@ -591,6 +591,7 @@ int ast_vhub_init_dev(struct ast_vhub *vhub, unsigned int idx)
 		d->gadget.max_speed = USB_SPEED_HIGH;
 	d->gadget.speed = USB_SPEED_UNKNOWN;
 	d->gadget.dev.of_node = vhub->pdev->dev.of_node;
+	d->gadget.dev.of_node_reused = true;
 
 	rc = usb_add_gadget_udc(d->port_dev, &d->gadget);
 	if (rc != 0)
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: aspeed: Fix probe regression
  2022-10-17  5:30 [PATCH] usb: gadget: aspeed: Fix probe regression Joel Stanley
@ 2022-10-17 20:40 ` Zev Weiss
  2022-10-17 20:59   ` Jae Hyun Yoo
  0 siblings, 1 reply; 3+ messages in thread
From: Zev Weiss @ 2022-10-17 20:40 UTC (permalink / raw)
  To: Joel Stanley
  Cc: Felipe Balbi, Greg Kroah-Hartman, Alan Stern,
	Benjamin Herrenschmidt, Andrew Jeffery, linux-usb, linux-aspeed,
	linux-kernel, Jae Hyun Yoo, stable

On Sun, Oct 16, 2022 at 10:30:06PM PDT, Joel Stanley wrote:
>Since commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets"),
>the gadget devices are proper driver core devices, which caused each
>device to request pinmux settings:
>
> aspeed_vhub 1e6a0000.usb-vhub: Initialized virtual hub in USB2 mode
> aspeed-g5-pinctrl 1e6e2080.pinctrl: pin A7 already requested by 1e6a0000.usb-vhub; cannot claim for gadget.0
> aspeed-g5-pinctrl 1e6e2080.pinctrl: pin-232 (gadget.0) status -22
> aspeed-g5-pinctrl 1e6e2080.pinctrl: could not request pin 232 (A7) from group USB2AD  on device aspeed-g5-pinctrl
> g_mass_storage gadget.0: Error applying setting, reverse things back
>
>The vhub driver has already claimed the pins, so prevent the gadgets
>from requesting them too by setting the magic of_node_reused flag. This
>causes the driver core to skip the mux request.
>
>Reported-by: Zev Weiss <zev@bewilderbeest.net>
>Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
>Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets")
>Cc: stable@vger.kernel.org
>Signed-off-by: Joel Stanley <joel@jms.id.au>

Thanks Joel!

Tested-by: Zev Weiss <zev@bewilderbeest.net>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] usb: gadget: aspeed: Fix probe regression
  2022-10-17 20:40 ` Zev Weiss
@ 2022-10-17 20:59   ` Jae Hyun Yoo
  0 siblings, 0 replies; 3+ messages in thread
From: Jae Hyun Yoo @ 2022-10-17 20:59 UTC (permalink / raw)
  To: Joel Stanley, Zev Weiss
  Cc: Felipe Balbi, Greg Kroah-Hartman, Alan Stern,
	Benjamin Herrenschmidt, Andrew Jeffery, linux-usb, linux-aspeed,
	linux-kernel, stable

On 10/17/2022 1:40 PM, Zev Weiss wrote:
> On Sun, Oct 16, 2022 at 10:30:06PM PDT, Joel Stanley wrote:
>> Since commit fc274c1e9973 ("USB: gadget: Add a new bus for gadgets"),
>> the gadget devices are proper driver core devices, which caused each
>> device to request pinmux settings:
>>
>> aspeed_vhub 1e6a0000.usb-vhub: Initialized virtual hub in USB2 mode
>> aspeed-g5-pinctrl 1e6e2080.pinctrl: pin A7 already requested by 
>> 1e6a0000.usb-vhub; cannot claim for gadget.0
>> aspeed-g5-pinctrl 1e6e2080.pinctrl: pin-232 (gadget.0) status -22
>> aspeed-g5-pinctrl 1e6e2080.pinctrl: could not request pin 232 (A7) 
>> from group USB2AD  on device aspeed-g5-pinctrl
>> g_mass_storage gadget.0: Error applying setting, reverse things back
>>
>> The vhub driver has already claimed the pins, so prevent the gadgets
>> from requesting them too by setting the magic of_node_reused flag. This
>> causes the driver core to skip the mux request.
>>
>> Reported-by: Zev Weiss <zev@bewilderbeest.net>
>> Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>
>> Fixes: fc274c1e9973 ("USB: gadget: Add a new bus for gadgets")
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Joel Stanley <joel@jms.id.au>
> 
> Thanks Joel!
> 
> Tested-by: Zev Weiss <zev@bewilderbeest.net>

It works for my AST2600 build targets too. Thanks Joel!

Tested-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-17 21:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-17  5:30 [PATCH] usb: gadget: aspeed: Fix probe regression Joel Stanley
2022-10-17 20:40 ` Zev Weiss
2022-10-17 20:59   ` Jae Hyun Yoo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.