From patchwork Fri Apr 26 18:06:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 2494651 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork1.kernel.org (Postfix) with ESMTP id EE8DA3FC64 for ; Fri, 26 Apr 2013 18:06:33 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVn2W-0001Sc-A6; Fri, 26 Apr 2013 18:06:32 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVn2R-0001Xl-8K; Fri, 26 Apr 2013 18:06:27 +0000 Received: from wolverine02.qualcomm.com ([199.106.114.251]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UVn2O-0001XR-Jv for linux-arm-kernel@lists.infradead.org; Fri, 26 Apr 2013 18:06:25 +0000 X-IronPort-AV: E=Sophos;i="4.87,559,1363158000"; d="scan'208";a="41959772" Received: from pdmz-ns-snip_115_219.qualcomm.com (HELO mostmsg01.qualcomm.com) ([199.106.115.219]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Apr 2013 11:06:20 -0700 Received: from lauraa-linux.qualcomm.com (pdmz-ns-snip_218_1.qualcomm.com [192.168.218.1]) by mostmsg01.qualcomm.com (Postfix) with ESMTPA id 3456F10004A9; Fri, 26 Apr 2013 11:06:20 -0700 (PDT) From: Laura Abbott To: linux-arm-kernel@lists.infradead.org, devicetree-discuss@lists.ozlabs.org, Catalin Marinas , Rob Herring Subject: [PATCH v2] of: Set the DMA mask to 64 bits when dma_addr_t is 64-bits Date: Fri, 26 Apr 2013 11:06:05 -0700 Message-Id: <1366999565-19498-1-git-send-email-lauraa@codeaurora.org> X-Mailer: git-send-email 1.7.8.3 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130426_140624_876351_EB804029 X-CRM114-Status: GOOD ( 12.19 ) X-Spam-Score: -4.2 (----) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-4.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [199.106.114.251 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Laura Abbott X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Currently, of_platform_device_create_pdata always sets the coherent DMA mask to 32 bits. On ARM systems without CONFIG_ZONE_DMA, arm_dma_limit gets set to ~0 or 0xFFFFFFFFFFFFFFFF on LPAE based systems. Since arm_dma_limit represents the smallest dma_mask on the system, the default of 32 bits prevents any dma_coherent allocation from succeeding unless clients manually set the dma mask first. Rather than make every client on an LPAE system set the mask, set the mask to a 64 bit value on systems with 64-bit dma addresses. Signed-off-by: Laura Abbott --- drivers/of/platform.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 0970505..c669ab4 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -214,7 +214,11 @@ struct platform_device *of_platform_device_create_pdata( #if defined(CONFIG_MICROBLAZE) dev->archdata.dma_mask = 0xffffffffUL; #endif +#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT + dev->dev.coherent_dma_mask = DMA_BIT_MASK(64); +#else dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); +#endif dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data;