From patchwork Fri Jul 27 14:14:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Murphy X-Patchwork-Id: 950195 Return-Path: X-Original-To: incoming-dt@patchwork.ozlabs.org Delivered-To: patchwork-incoming-dt@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=devicetree-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41cWDg180rz9ryl for ; Sat, 28 Jul 2018 00:14:27 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732148AbeG0Pgc (ORCPT ); Fri, 27 Jul 2018 11:36:32 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:44214 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730737AbeG0Pgc (ORCPT ); Fri, 27 Jul 2018 11:36:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8002BED1; Fri, 27 Jul 2018 07:14:25 -0700 (PDT) Received: from e110467-lin.cambridge.arm.com (e110467-lin.Emea.Arm.com [10.4.12.131]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D6DA33F6A8; Fri, 27 Jul 2018 07:14:23 -0700 (PDT) From: Robin Murphy To: robh+dt@kernel.org, frowand.list@gmail.com Cc: devicetree@vger.kernel.org, iommu@lists.linux-foundation.org, hch@lst.de, m.szyprowski@samsung.com, linux-arm-kernel@lists.infradead.org, krzk@kernel.org, grygorii.strashko@ti.com Subject: [PATCH] of/platform: Initialise default DMA masks Date: Fri, 27 Jul 2018 15:14:15 +0100 Message-Id: <9ffa7f2676c25adf39e85ec8114b26500b5680f6.1532699305.git.robin.murphy@arm.com> X-Mailer: git-send-email 2.17.1.dirty Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org When of_dma_configure() was first born in 591c1ee465ce ("of: configure the platform device dma parameters"), everything DMA-related was factored out of of_platform_device_create_pdata() as seemed appropriate at the time. However, now that of_dma_configure() has grown into the generic handler for processing DMA-related properties from DT for all kinds of devices, it is no longer an appropriate place to be doing OF-platform-specific business. Since there are still plenty of platform drivers not setting their own masks and depending on the bus default, let's reinstate that inialisation in the OF-platform code itself, and restore the long-standing status quo from 0589342c2794 ("of: set dma_mask to point to coherent_dma_mask") CC: Rob Herring CC: Frank Rowand Signed-off-by: Robin Murphy Acked-by: Rob Herring --- This shouldn't strictly depend on the changes currently queued in the dma-mapping tree, so should be OK to go through the DT tree in parallel. Ideally we'd fix all DMA-capable drivers to set their masks correctly, but in the short term everyone's going to get cross about -rc1 not booting... Robin. drivers/of/platform.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 6925d993e1f0..7ba90c290a42 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -185,6 +185,9 @@ static struct platform_device *of_platform_device_create_pdata( if (!dev) goto err_clear_flag; + dev->dev.coherent_dma_mask = DMA_BIT_MASK(32); + if (!dev->dev.dma_mask) + dev->dev.dma_mask = &dev->dev.coherent_dma_mask; dev->dev.bus = &platform_bus_type; dev->dev.platform_data = platform_data; of_msi_configure(&dev->dev, dev->dev.of_node);