Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1511277

[PATCH] staging: vc04_services: setup DMA and coherent mask

From Michael Zoran <mzoran@crowfest.net>
Newsgroups linux.kernel
Subject [PATCH] staging: vc04_services: setup DMA and coherent mask
Date 2016-10-28 19:20 +0200
Message-ID <sxiYW-2LI-23@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Setting the DMA mask is optional on 32 bit but
is mandatory on 64 bit.  Set the DMA mask and coherent
to force all DMA to be in the 32 bit address space.

This is considered a "good practice" and most drivers
already do this.

Signed-off-by: Michael Zoran <mzoran@crowfest.net>
---
 .../staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
index a5afcc5..6fa2b5a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c
@@ -97,6 +97,16 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state)
 	int slot_mem_size, frag_mem_size;
 	int err, irq, i;
 
+	/*
+	 * Setting the DMA mask is necessary in the 64 bit environment.
+	 * It isn't necessary in a 32 bit environment but is considered
+	 * a good practice.
+	 */
+	err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
+
+	if (err < 0)
+		return err;
+
 	(void)of_property_read_u32(dev->of_node, "cache-line-size",
 				   &g_cache_line_size);
 	g_fragments_size = 2 * g_cache_line_size;
-- 
2.10.1

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] staging: vc04_services: setup DMA and coherent mask Michael Zoran <mzoran@crowfest.net> - 2016-10-28 19:20 +0200
  Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Eric Anholt <eric@anholt.net> - 2016-10-31 19:40 +0100
    Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Michael Zoran <mzoran@crowfest.net> - 2016-10-31 19:50 +0100
      Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Michael Zoran <mzoran@crowfest.net> - 2016-10-31 21:00 +0100
      Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Michael Zoran <mzoran@crowfest.net> - 2016-10-31 21:00 +0100
        Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Russell King - ARM Linux <linux@armlinux.org.uk> - 2016-11-01 10:40 +0100
        Re: [PATCH] staging: vc04_services: setup DMA and coherent mask Robin Murphy <robin.murphy@arm.com> - 2016-11-01 14:00 +0100

csiph-web