From patchwork Thu Mar 6 09:19:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 25789 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pb0-f69.google.com (mail-pb0-f69.google.com [209.85.160.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D6987203C3 for ; Thu, 6 Mar 2014 09:21:40 +0000 (UTC) Received: by mail-pb0-f69.google.com with SMTP id md12sf5771792pbc.4 for ; Thu, 06 Mar 2014 01:21:40 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe:content-type; bh=ZjHDqR+x5HYqSYMaKmfFReSeQL6gs6QQ9Z+H2g4EGYk=; b=da9C3imRWSEaLmIf3FPfkAlHlAcGksRDPVlAtUXigZ+DBBskw3FzQV5kuMGIIC7I32 ViG7EN/Ys0fVTkaw9GEAw7LHk3cSeCqLIFxXr7IbOvT1TPtdpQcDu3h9vkco1bG94j7e bezXFSZy8QuYX4AfwdJZVy61uqBp6MXgf3dWRWkOhPtLh+NAbuqh7Kjn50VGHbIhm+SK BzRFZdbTR1Z+NRt4G8NeQwGZvT/F0kU9kkgKDYN8dkROPRlOcr+kJdGdM6YmvprHH0JV QWvY+J7PYeI4CnTTdtUeRAUgCmqlVCpa+p/sp8OoER3Newz2kNSI6HN2S8V7kC+DExgV 4JZQ== X-Gm-Message-State: ALoCoQn5v56jFXlxHf0ugh/g59eizIPskxiHbEFuv4aO0l3AV4P7aFr1oRAzVQ9FmGZkq7Q/RlaQ X-Received: by 10.66.240.4 with SMTP id vw4mr4807720pac.10.1394097700081; Thu, 06 Mar 2014 01:21:40 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls645988qgd.86.gmail; Thu, 06 Mar 2014 01:21:39 -0800 (PST) X-Received: by 10.52.188.41 with SMTP id fx9mr7086682vdc.19.1394097699934; Thu, 06 Mar 2014 01:21:39 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id w1si982054vet.11.2014.03.06.01.21.39 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Mar 2014 01:21:39 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so2365330veb.10 for ; Thu, 06 Mar 2014 01:21:39 -0800 (PST) X-Received: by 10.58.165.68 with SMTP id yw4mr4442815veb.17.1394097699843; Thu, 06 Mar 2014 01:21:39 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.78.9 with SMTP id i9csp25125vck; Thu, 6 Mar 2014 01:21:39 -0800 (PST) X-Received: by 10.68.12.74 with SMTP id w10mr13112709pbb.39.1394097698923; Thu, 06 Mar 2014 01:21:38 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id tm9si4527688pab.47.2014.03.06.01.21.38; Thu, 06 Mar 2014 01:21:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752829AbaCFJVV (ORCPT + 26 others); Thu, 6 Mar 2014 04:21:21 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:46226 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752734AbaCFJVQ (ORCPT ); Thu, 6 Mar 2014 04:21:16 -0500 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id s269Kbn3025017; Thu, 6 Mar 2014 03:20:37 -0600 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id s269KasS003305; Thu, 6 Mar 2014 03:20:36 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.174.1; Thu, 6 Mar 2014 03:20:36 -0600 Received: from ula0393909.itg.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id s269K8N3031770; Thu, 6 Mar 2014 03:20:33 -0600 From: Santosh Shilimkar To: CC: , , Santosh Shilimkar , Greg Kroah-Hartman , Russell King , Arnd Bergmann , Olof Johansson , Grant Likely , Rob Herring , Catalin Marinas , Linus Walleij , Grygorii Strashko Subject: [PATCH 5/7] of: Add set_arch_dma_coherent_ops() and setup coherent dma_ops Date: Thu, 6 Mar 2014 17:19:56 +0800 Message-ID: <1394097598-17622-6-git-send-email-santosh.shilimkar@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1394097598-17622-1-git-send-email-santosh.shilimkar@ti.com> References: <1394097598-17622-1-git-send-email-santosh.shilimkar@ti.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: santosh.shilimkar@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add set_arch_dma_coherent_ops() for architectures to setup coherent dma_ops. Update dt_dma_configure() to look for a "dma-coherent" property in the device's node, and its ancestors If this property is found, we call set_arch_dma_coherent_ops() per device to apply coherent DMA configuartion. The set_arch_dma_coherent_ops() is declared as __weak and it's expected that the arch's needing it will imlepment it. Cc: Greg Kroah-Hartman Cc: Russell King Cc: Arnd Bergmann Cc: Olof Johansson Cc: Grant Likely Cc: Rob Herring Cc: Catalin Marinas Cc: Linus Walleij Signed-off-by: Grygorii Strashko Signed-off-by: Santosh Shilimkar --- drivers/of/platform.c | 5 +++++ include/linux/dma-mapping.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 53bb12f..272e390 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -255,6 +255,11 @@ static void dt_dma_configure(struct device *dev) dev_err(dev, "failed to set coherent DMA mask %pad\n", &dma_mask); } + + if (of_dma_is_coherent(dev->of_node)) { + set_arch_dma_coherent_ops(dev); + dev_dbg(dev, "device is dma coherent\n"); + } } /** diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index fd4aee2..c7d9b1b 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h @@ -123,6 +123,13 @@ static inline int dma_coerce_mask_and_coherent(struct device *dev, u64 mask) extern u64 dma_get_required_mask(struct device *dev); +#ifndef set_arch_dma_coherent_ops +static inline int set_arch_dma_coherent_ops(struct device *dev) +{ + return 0; +} +#endif + static inline unsigned int dma_get_max_seg_size(struct device *dev) { return dev->dma_parms ? dev->dma_parms->max_segment_size : 65536;