Re: [PATCH] usb: chipidea: reuse the platform_data to store the ci info

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

 



On Thu, Aug 13, 2015 at 11:01:18AM -0400, Alan Stern wrote:
> On Thu, 13 Aug 2015, Peter Chen wrote:
> 
> > > > Alan, do you have any suggestions? Currently, IP core driver and ehci
> > > > core both takes its internal structure as driver data. Thanks.
> > > 
> > > It's not just ehci-hcd: The USB core stores the hcd address as driver 
> > > data.  usb_create_shared_hcd() does:
> > > 
> > > 		dev_set_drvdata(dev, hcd);
> > > 
> > > (The core uses this value only in usb_hcd_platform_shutdown(), but 
> > > other platform-glue drivers also store the hcd address there.)
> > > 
> > > The standard answer is to put the Chipidea private data in the
> > > ehci_ci_priv structure.  That's what it's meant for.
> > > 
> > > Is that okay for you?
> > 
> > Thanks, Alan. It is ok for ehci glue layer as a separate driver.
> > But it is not ok for the drivers like having all hcd/gadget/otg
> > part together, the IP core driver's suspend/resume/remove,
> > sysfs will use driver's private data, unless the ehci platform
> > device as child for IP core device, but it is not for gadget.
> > 
> > If there is no better solution, I will use Rong's solution.
> 
> In the old days, a single device could be a USB host controller and
> nothing else.  Then later, a single device could be either a host
> controller or a device controller.  Now a single device can be both.
> 
> Obviously this causes problems for our original design, where the 
> device's drvdata stored a pointer to the hcd structure or the udc 
> structure.
> 
> In principle, the drvdata should point to something that contains
> pointers to both the hcd and udc structures.  Maybe also an otg
> structure.  That would require a lot of changes to existing code but it
> might be worthwhile.
> 

Yes, the core device drvdata should contain standard hcd, gadget,
otg structure together. Currently, the gadget is child device
for core device, it is reasonable the same for hcd, and we can
create device for chipidea host to achieve it. The dwc3 driver
does the similar things.

Below is the reference device hierarchy for current IP driver:

		Glue Layer Device
		       |
		       |
		       |
		 IP  Core Device
		   	|    
		   |----|----|
		   |	|    |
		Gadget	hcd  otg

Alan/Felipe, what do you think?

> Felipe, what do you think?
> 
> Alan Stern
> 

-- 

Best Regards,
Peter Chen
--
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