Re: [PATCH v2 4/4] usb: refine phy notify operation during connection and disconnection

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 8 Oct 2012, Peter Chen wrote:

> At commit 925aa46ba963a4da6d8ee6ab1d04a02ffa8db62b, Richard Zhao
> <richard.zhao@xxxxxxxxxxxxx> adds the phy notification callback
> when port change occurs. In fact, this phy notification should
> be added according to below rules:
> 
> 1. Only set HW_USBPHY_CTRL.ENHOSTDISCONDETECT
> during high speed host mode.
> 2. Do not set HW_USBPHY_CTRL.ENHOSTDISCONDETECT
> during the reset and speed negotiation period.
> 3. Do not set HW_USBPHY_CTRL.ENHOSTDISCONDETECT
> during host suspend/resume sequence.
> 
> Please refer: i.mx23RM(page: 413) for below rules.
> http://www.freescale.com/files/dsp/doc/ref_manual/IMX23RM.pdf
> 
> Freescale i.MX SoC, i.mx23, i.mx28 and i.mx6(i.mx6SL does not
> need to follow the 3rd rule) need to follow above rules.
> 
> Current code set connect notification (HW_USBPHY_CTRL.ENHOSTDISCONDETECT)
> at hub_port_connect_change, it conflicts with above the 2th rule.
> 
> The correct notification setting method should be:
> 1. Set connect notify after the second bus reset.
> 2. Set disconnect notify after disconnection.

Simply reading this patch shows that it contains at least two errors.

> @@ -4187,6 +4190,10 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
>  		}
>  	}
>  
> +	if (hcd->phy && !hdev->parent &&
> +		!(portstatus & USB_PORT_STAT_CONNECTION))
> +			usb_phy_notify_disconnect(hcd->phy, udev->speed);

What happens if udev is NULL (see the test in the next statement)?

> +
>  	/* Disconnect any existing devices under this port */
>  	if (udev)
>  		usb_disconnect(&hub->ports[port1 - 1]->child);
> @@ -4212,13 +4219,6 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
>  		}
>  	}
>  
> -	if (hcd->phy && !hdev->parent) {
> -		if (portstatus & USB_PORT_STAT_CONNECTION)
> -			usb_phy_notify_connect(hcd->phy, port1);
> -		else
> -			usb_phy_notify_disconnect(hcd->phy, port1);

Is the second argument supposed to be a port number, like here, or a
speed value, like above?  Clearly something is wrong, either in the old
code or in the new code.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux