RE: [PATCH 2/21] ehci: Support for Intel Moorestown MPH and OTG host

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

 



>>>> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
>>>> index 27115b4..4e14c00 100644
>>>> --- a/drivers/usb/core/hub.c
>>>> +++ b/drivers/usb/core/hub.c
>>>> @@ -1549,6 +1549,14 @@ static void hub_free_dev(struct usb_device *udev)
>>>>   		hcd->driver->free_dev(hcd, udev);
>>>>   }
>>>>
>>>> +static void otg_notify(struct usb_device *udev, unsigned action)
>>>> +{
>>>> +	struct usb_hcd *hcd = bus_to_hcd(udev->bus);
>>>> +
>>>> +	if (hcd->otg_notify)
>>>> +		hcd->otg_notify(udev, action);
>>>> +}
>>>> +
>>>>   /**
>>>>    * usb_disconnect - disconnect a device (usbcore-internal)
>>>>    * @pdev: pointer to device being disconnected
>>>> @@ -1606,6 +1614,7 @@ void usb_disconnect(struct usb_device **pdev)
>>>>   	 * notifier chain (used by usbfs and possibly others).
>>>>   	 */
>>>>   	device_del(&udev->dev);
>>>> +	otg_notify(udev, USB_DEVICE_REMOVE);
>>>>
>>>>   	/* Free the device number and delete the parent's children[]
>>>>   	 * (or root_hub) pointer.
>>>> @@ -1829,6 +1838,7 @@ int usb_new_device(struct usb_device *udev)
>>>>   		dev_err(&udev->dev, "can't device_add, error %d\n", err);
>>>>   		goto fail;
>>>>   	}
>>>> +	otg_notify(udev, USB_DEVICE_ADD);
>>>>
>>>>   	(void) usb_create_ep_devs(&udev->dev,&udev->ep0, udev);
>>>>   	return err;
>>>
>>> Why would we need to create a new callback for every device added and
>>> removed?  Why do you need this and why doesn't the existing functions to
>>> do this type of thing work for you?
>>
>> It is needed to do notification for USB device connect/disconnect events to transceiver
>driver in OTG case.
>> Those events are important for OTG state machine maintained in transceiver driver.
>>
>I agree that these events are required to transition to a different OTG
>state. But why ->notify method
>is included in usb_hcd struct. This may lead to another private
>interface between HCD-->OTG.
>IMO, we should have this callback in otg_transceiver struct but not in
>usb_hcd struct. We may also

Hi,

Thanks for your comment.

Agree, add one callback in otg_transceiver struct instead will not only help in host side (hcd), but also device side (udc).
Will update it.

>need events like HNP FAILED, No response for HNP enable request, and NOT
>found in TPL etc. So I prefer
>to define an enum for OTG event instead of using USB_DEVICE_ADD and
>USB_DEVICE_REMOVE.

Actually I have defined some OTG events in linux/usb/intel_mid_otg.h, they are used in intel langwell/penwell otg_transceiver driver.
I think I can purpose them for common usage, only minor concern here is that maybe different platforms/otg implementations may need different events to be defined.

Hao

--
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