3032-arm64-Add-pdev_archdata-for-dmamask.patch 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From f7e48669bb75f3b52e9f3ce1a5d885c49b7c4712 Mon Sep 17 00:00:00 2001
  2. From: Cristian Sovaiala <cristian.sovaiala@freescale.com>
  3. Date: Thu, 4 Jun 2015 18:27:20 +0300
  4. Subject: [PATCH 32/70] arm64: Add pdev_archdata for dmamask
  5. The dma_mask for a device structure is a pointer. This pointer
  6. needs to be set up before the dma mask can actually be set. Most
  7. frameworks in the kernel take care of setting this up properly but
  8. platform devices that don't follow a regular bus structure may not
  9. ever have this set. As a result, checks such as dma_capable will
  10. always return false on a raw platform device and dma_set_mask will
  11. always return -EIO. Fix this by adding a dma_mask in the
  12. platform_device archdata and setting it to be the dma_mask. Devices
  13. used in other frameworks can change this as needed.
  14. Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
  15. ---
  16. arch/arm64/include/asm/device.h | 1 +
  17. arch/arm64/kernel/setup.c | 7 +++++++
  18. 2 files changed, 8 insertions(+)
  19. --- a/arch/arm64/include/asm/device.h
  20. +++ b/arch/arm64/include/asm/device.h
  21. @@ -25,6 +25,7 @@ struct dev_archdata {
  22. };
  23. struct pdev_archdata {
  24. + u64 dma_mask;
  25. };
  26. #endif
  27. --- a/arch/arm64/kernel/setup.c
  28. +++ b/arch/arm64/kernel/setup.c
  29. @@ -44,6 +44,7 @@
  30. #include <linux/of_platform.h>
  31. #include <linux/efi.h>
  32. #include <linux/psci.h>
  33. +#include <linux/dma-mapping.h>
  34. #include <asm/acpi.h>
  35. #include <asm/fixmap.h>
  36. @@ -381,3 +382,9 @@ static int __init topology_init(void)
  37. return 0;
  38. }
  39. subsys_initcall(topology_init);
  40. +
  41. +void arch_setup_pdev_archdata(struct platform_device *pdev)
  42. +{
  43. + pdev->archdata.dma_mask = DMA_BIT_MASK(32);
  44. + pdev->dev.dma_mask = &pdev->archdata.dma_mask;
  45. +}