Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1415930
| From | Baolin Wang <baolin.wang@linaro.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] arm64: Implement arch_setup_pdev_archdata hook |
| Date | 2016-06-07 11:30 +0200 |
| Message-ID | <rHluH-Te-55@gated-at.bofh.it> (permalink) |
| References | <rHkIh-nf-5@gated-at.bofh.it> <rHlkZ-PT-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 7 June 2016 at 17:15, Robin Murphy <robin.murphy@arm.com> wrote:
> On 07/06/16 09:29, Baolin Wang wrote:
>>
>> Now on ARM64 platform, it will set 'dummy_dma_ops' for device dma_ops if
>> it did not call 'arch_setup_dma_ops' at device creation time by issuing
>> platform_device_alloc() function, that will cause failure when setting
>> the dma mask for device.
>
>
> Yes, that's rather the whole point. DMA-capable devices are real hardware,
> therefore don't spring out of thin air without being described in DT or
> ACPI.
OK.
>
> Please elaborate on the situation that you're attempting to address here
> (please don't let it be the ongoing Designware USB catastrophe ;))
Yes, like you mentioned, we met problems at DesignWare USB3 controller
host glue, do you have any better solutions to solve this problem?
Thanks.
>
> Robin.
>
>
>> Hence We need to hook the archdata to setup proper dma_ops for these
>> devices.
>>
>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
>> ---
>> arch/arm64/mm/dma-mapping.c | 21 +++++++++++++++++++++
>> 1 file changed, 21 insertions(+)
>>
>> diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
>> index c566ec8..04e057b 100644
>> --- a/arch/arm64/mm/dma-mapping.c
>> +++ b/arch/arm64/mm/dma-mapping.c
>> @@ -26,6 +26,7 @@
>> #include <linux/dma-contiguous.h>
>> #include <linux/vmalloc.h>
>> #include <linux/swiotlb.h>
>> +#include <linux/platform_device.h>
>>
>> #include <asm/cacheflush.h>
>>
>> @@ -961,3 +962,23 @@ void arch_setup_dma_ops(struct device *dev, u64
>> dma_base, u64 size,
>> dev->archdata.dma_coherent = coherent;
>> __iommu_setup_dma_ops(dev, dma_base, size, iommu);
>> }
>> +
>> +void arch_setup_pdev_archdata(struct platform_device *pdev)
>> +{
>> + if (!pdev->dev.archdata.dma_ops)
>> + pdev->dev.archdata.dma_ops = &swiotlb_dma_ops;
>> +
>> + /*
>> + * Set default coherent_dma_mask to 32 bit. Drivers are expected
>> to
>> + * setup the correct supported mask.
>> + */
>> + if (!pdev->dev.coherent_dma_mask)
>> + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>> +
>> + /*
>> + * Set it to coherent_dma_mask by default if the architecture
>> + * code has not set it.
>> + */
>> + if (!pdev->dev.dma_mask)
>> + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
>> +}
>>
>
--
Baolin.wang
Best Regards
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] arm64: Implement arch_setup_pdev_archdata hook Baolin Wang <baolin.wang@linaro.org> - 2016-06-07 10:40 +0200
Re: [PATCH] arm64: Implement arch_setup_pdev_archdata hook Robin Murphy <robin.murphy@arm.com> - 2016-06-07 11:20 +0200
Re: [PATCH] arm64: Implement arch_setup_pdev_archdata hook Baolin Wang <baolin.wang@linaro.org> - 2016-06-07 11:30 +0200
Re: [PATCH] arm64: Implement arch_setup_pdev_archdata hook Arnd Bergmann <arnd@arndb.de> - 2016-06-09 14:50 +0200
csiph-web