From patchwork Thu Mar 17 09:39:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 8608751 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id A2B2C9F3D1 for ; Thu, 17 Mar 2016 09:39:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF9BD20304 for ; Thu, 17 Mar 2016 09:39:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8F496201DD for ; Thu, 17 Mar 2016 09:39:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935440AbcCQJjj (ORCPT ); Thu, 17 Mar 2016 05:39:39 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:55274 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935410AbcCQJje (ORCPT ); Thu, 17 Mar 2016 05:39:34 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue104) with ESMTPA (Nemesis) id 0M580s-1ZsUJU3DJe-00zGOA; Thu, 17 Mar 2016 10:39:26 +0100 From: Arnd Bergmann To: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Cc: Arnd Bergmann , Kalle Valo , Hauke Mehrtens , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] bcma: use of_dma_configure() to set initial dma mask Date: Thu, 17 Mar 2016 10:39:17 +0100 Message-Id: <1458207563-3453369-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 X-Provags-ID: V03:K0:WuwvAo3sMqlZTJr5hRjwzrlm47vNMx5zeH5CTxunfKKjYkNUsTB ZyMx2/W8JqkSCL7nHrFL8NMaCxhwvqgPtzwmqcsF/+k/xQexvqDeOfQ9HtALNZ4fzZi3PAW sig9xX40xXqHZ567b2t1ZstfXag9uAZK/PNoUhANcxAsK6Xn+DZcSlYsjmVoxqmMubvwemw MSRRmhVaav6l44nO8weww== X-UI-Out-Filterresults: notjunk:1; V01:K0:WfRSqZdSRBM=:xKyVI4T852k2M3j9ldcUhH yUDS8iJcDdVjfMefraSTMLWIcyvhod1cCdYeHDYebT9vPUDzMgndM9xJTA+HO8z/ep09D8MBI LGuSGdfjTfCT3og6Qx1p4paWSCqePGgwv2CAGAK1qTph1MfPlVorxwRb+ergl48ypygKUrBs5 d6p5KxJBlc5SP3n14GV/TKl5WHkNor5+JiNe5fcx5CGtoEccalC5z13wGvnkhMC0Yjazdg48I ESgcMJWgJ9MnfJtsU5fjo0M4GNck3o1G4CBdkvG3B//17K3FMsKCMI4+BelRz5RaM01xh6zl0 vXfBm0z3ncMpq2hrMD8xNMyRUCcORK/RABcEzp6+Lt+oW4cfL10PFfNPqn5p0J5/pV949pyA0 zXgOfyadMJYzlDjRs6thyVJeivFjMbZTbH57UP7VwXV89F7+BBIeCWRsscl5rWKgcuKxRk6RC 2xSu1pp5CxkvysfvPPuZ/GhZW9Tm5BEl61eUOVpc8xw7UXzvaXlliMzW9TIPQKSCENbtxOW/S Z4fF4bmuCoGtaRAwgqV7maUprq1poVp3OFYyLViLKSZpYzIk6h6rp2siXrxse1AfMz95PAhgA 6TW/s7sVJs+wz1rZZ4b+CHngtq6g4vEqsmVKY5MfqsOdOrofUqbbC6IULYp0+lv7CeM0lV7+B m7mpccGreOHRYp7i7t51Jdy3GCjfMoqa0a/5PPHO37NtYHhgpV3pqhnvfUW7Ue4pGgTg= Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP While fixing another bug, I noticed that bcma manually sets up a dma_mask pointer for its child devices. We have a generic helper for that now, which should be able to cope better with any variations that might be needed to deal with cache coherency, unusual DMA address offsets, iommus, or limited DMA masks, none of which are currently handled here. This changes the core to use the of_dma_configure(), like we do for platform devices that are probed directly from DT. Signed-off-by: Arnd Bergmann --- This patch needs to be tested to ensure we don't introduce regressions, and should probably go into 4.7 as a cleanup. v2: fix typo drivers/bcma/main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c index 1f635471f318..2c1798e38abd 100644 --- a/drivers/bcma/main.c +++ b/drivers/bcma/main.c @@ -209,6 +209,8 @@ static void bcma_of_fill_device(struct platform_device *parent, core->dev.of_node = node; core->irq = bcma_of_get_irq(parent, core, 0); + + of_dma_configure(&core->dev, node); } unsigned int bcma_core_irq(struct bcma_device *core, int num) @@ -248,12 +250,12 @@ void bcma_prepare_core(struct bcma_bus *bus, struct bcma_device *core) core->irq = bus->host_pci->irq; break; case BCMA_HOSTTYPE_SOC: - core->dev.dma_mask = &core->dev.coherent_dma_mask; - if (bus->host_pdev) { + if (IS_ENABLED(CONFIG_OF) && bus->host_pdev) { core->dma_dev = &bus->host_pdev->dev; core->dev.parent = &bus->host_pdev->dev; bcma_of_fill_device(bus->host_pdev, core); } else { + core->dev.dma_mask = &core->dev.coherent_dma_mask; core->dma_dev = &core->dev; } break;