Re: [PATCH v2 2/5] m68k - set up platform device for mvme147_scsi

Michael Schmitz
2022-07-13T02:05:13Z

Hi Arnd,

On 12/07/22 21:28, Michael Schmitz wrote:
>
>>> I think you actually have to use platform_device_register_full() to
>>> pass
>>> a DMA mask here: As I understand it, the dma_set_mask_and_coherent()
>>> call in the driver fails if the device is not already marked as dma
>>> capable by having an initial mask set.
>>
>> I'll take a look at that - if true, this requires the amiga-a3000-scsi
>> platform device set-up be changed in the same way (the gvp11 and a2091
>> drivers inherit the DMA mask from the Zorro bus default, so ought to
>> work OK).
>
> I think we are good with using platform_device_register_simple():
>
> setup_pdev_dma_masks() sets the DMA mask to 32 bit when allocating a
> new platform device, and platform_device_register_full() only changes
> that when passed in a non-zero mask in pdevinfo.
>
> platform_device_register_simple() leaves the pdevinfo mask zero, so
> the 32 bit default set in setup_pdev_dma_masks() survives.

Verified by having pata_falcon print the default DMA mask (0xffffffff),
then setting a 24 bit DMA mask and reading it back.

That did uncover an error I made in the gvp11 driver - the devices'
default DMA mask there is given as a 32 bit integer, but the DMA API
needs 64 bit. Will send a separate fix for that.

Cheers,

Michael

>
> Cheers,
>
>     Michael
>
>>
>> Cheers,
>>
>>     Michael
>>
>>> The way this normally works is that the device gets created with a mask
>>> that reflects the capabilities of the bus, while the driver sets a mask
>>> based on what it wants to program into the device, and the dma-mapping
>>> interfaces ensure that we only use the intersection of those.
>>>
>>>         Arnd
>>>