Re: [PATCH 1/4] staging: dwc2: Set a default dma_mask for platform devices

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

 



Hi Paul,

> > +	/*
> > +	 * Use reasonable defaults so platforms don't have to provide these.
> > +	 */
> > +	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);
> 
> Hmm. Is it kosher to override these in a driver and force DMA to be
> enabled?

Apparently, since a lot of drivers do it like this. This particular code
was taken from the ehci-platform driver. See also:

	http://thread.gmane.org/gmane.linux.usb.general/86066

The discussion in that thread suggests that even though this is not
quite the optimal way to do this, it is the accepted way for now and
changing it needs a bit more complicated changes and more discussion,
apparently.

> What if it has been disabled earlier on purpose, say because the
> platform does not have DMA support? You say "This still allows any
> platform code to set any more specific mask if needed", but how would
> that be done exactly?
Platform code could go over the list of platform devices and (based on the
device-tree compatible value, for example) change the mask of a device.
Admittedly, this could set a more specific mask, but not exactly disable
dma entirely. I guess this is not a usecase for the other drivers?

For the dwc2 driver, I guess the dwc2 hardware would not have dma
enabled if the system does not support it anyway?

Note that this code only runs for platform devices, so not for pci
devices, which can disable dma by not setting a dma_mask when combined
with the next patch.

Gr.

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