On Mon, 25 Mar 2013, Arnd Bergmann wrote:

> On Monday 25 March 2013, Alan Stern wrote:
> > >  
> > > +     if (!dev->dev.platform_data) {
> > > +             dev->dev.platform_data = &ehci_platform_defaults;
> > > +             dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
> > > +             dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> > 
> > In view of Felipe's comment, shouldn't these last two lines be 
> > controlled by dev->dev.of_node != NULL instead?
> 
> We could do that, or alternatively like this
> 
>       if (!dev->dev.platform_data) {
>               dev->dev.platform_data = &ehci_platform_defaults;
>       if (!dev->dev.dma_mask)
>               dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
>       if (!dev->dev.coherent_dma_mask)
>               dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> 
> which would have the additional advantage that platforms can then
> call platform_device_register_resndata() to create the device
> and get a reasonable default dma mask (EHCI should always have
> 32 bit DMA, unless the platform is really screwed), rather than
> statically declaring platform devices.

That's up to platform guys.  I wasn't aware of any common practice 
whereby drivers would fill in a missing dma_mask, except in the DT 
case.

Don't forget that EHCI is theoretically capable of using 64-bit DMA.  
This may not matter for any of the platforms you're concerned about 
now, but it may matter in the future.

Alan Stern

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

Reply via email to