Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4415259pxk; Wed, 30 Sep 2020 02:16:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCaYqHn60Dl7mzzyTIilDUjfMm3PiXlROZPdvq0CrrF/ZC8mni4E2lFWeOSJwHG/MV2SSD X-Received: by 2002:a50:9dc8:: with SMTP id l8mr1708598edk.58.1601457370930; Wed, 30 Sep 2020 02:16:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601457370; cv=none; d=google.com; s=arc-20160816; b=a80Atpi6+bcX7nOTt5lzOR1AWZ3D99aFA8rJyR2AXcf5JcO0GtTsldAqlBSpGI92a7 r/Nk1C2th2X7I/6V8au5qBEZuKnoOeOd/khhaFvSjov8XtgpY7MrXWNmjo9pcHO5RVU+ l3E9mfp2HJj0Liv1AgLlTS+kA50czyWpLCNYotLyYOapwmZtQ4E4mipn1VaYbEUtKYEM KRZfyTyrrw8j1pJAQOhg4TGruVShcsZHXB4YvN/k+i3VqB3O9eEjnBpj/17+73Rnh2Bt xLMB3DnC3dkbsTlOHivILkZNHVRphrpEpNSoxHW9iUZpvNB1lr/Dr1HY8TN/2+5/6VtJ yaEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5ridk5920UfMB0nCEIpCyF/07n7stscwVpGaO1rQQhA=; b=sQbul/ufREFSMDAf/lzZfUj4sxFRTRBLmDlrY7/PmzmEzu0S6ILtddEV3hf+tdieMy 8Jw2Ddy9IRpvrW7bLOcNzMs5Iq8AxhVzPmDPTMJJk4RpCLeR9/ow8mhM/Ga3HPMA4OHH mKQ7R8sHIUWgrifI2uV2z7w6XO5P8AlQuzJSLWMsmHJPDRhnoaKO6MigDu2p9qSxotWm DUAh5EZzYLt9zwwt/G07faQyRSZ2bu25ai7+ISyhaMFgWIjF0AJvRnOzW02mPYpbw9Lu x0aZHqT7CLzbiEcYpjp7q+WTbDydJwZhydrzFpFli+fseF3BzHtZ6hqEuEWQdaRx/nVL guCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="hAI/eQIp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p18si684178edy.100.2020.09.30.02.15.48; Wed, 30 Sep 2020 02:16:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b="hAI/eQIp"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728722AbgI3JOL (ORCPT + 99 others); Wed, 30 Sep 2020 05:14:11 -0400 Received: from fllv0015.ext.ti.com ([198.47.19.141]:35008 "EHLO fllv0015.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725779AbgI3JOJ (ORCPT ); Wed, 30 Sep 2020 05:14:09 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 08U9E35X034882; Wed, 30 Sep 2020 04:14:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1601457243; bh=5ridk5920UfMB0nCEIpCyF/07n7stscwVpGaO1rQQhA=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=hAI/eQIpcwJQUk0v9xFVj0B/6YmQCfL80Xrg/yduhWEsIRKVXZOIKXFFDi5MX11gu uP1TDOA+UeSEcvhtZ0zLj21Vy8JquVYtCfA16JaiksmhnfxFXsgIUZAGcHggrtQffr cr9QI/UlAe+cvcSFFMlZvY1qtlL9mbyyk6jh9tUg= Received: from DLEE106.ent.ti.com (dlee106.ent.ti.com [157.170.170.36]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 08U9E2CL111169 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 30 Sep 2020 04:14:02 -0500 Received: from DLEE106.ent.ti.com (157.170.170.36) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3; Wed, 30 Sep 2020 04:14:02 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE106.ent.ti.com (157.170.170.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1979.3 via Frontend Transport; Wed, 30 Sep 2020 04:14:02 -0500 Received: from feketebors.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 08U9DuJY116385; Wed, 30 Sep 2020 04:13:59 -0500 From: Peter Ujfalusi To: , , , , CC: , , , , , , Subject: [PATCH 01/18] dmaengine: of-dma: Add support for optional router configuration callback Date: Wed, 30 Sep 2020 12:13:55 +0300 Message-ID: <20200930091412.8020-2-peter.ujfalusi@ti.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200930091412.8020-1-peter.ujfalusi@ti.com> References: <20200930091412.8020-1-peter.ujfalusi@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Additional configuration for the DMA event router might be needed for a channel which can not be done during device_alloc_chan_resources callback since the router information is not yet present for the drivers. If there is a need for additional configuration for the channel if DMA router is in use, then the driver can implement the device_router_config callback. Signed-off-by: Peter Ujfalusi --- drivers/dma/of-dma.c | 10 ++++++++++ include/linux/dmaengine.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c index 8a4f608904b9..ec00b20ae8e4 100644 --- a/drivers/dma/of-dma.c +++ b/drivers/dma/of-dma.c @@ -75,8 +75,18 @@ static struct dma_chan *of_dma_router_xlate(struct of_phandle_args *dma_spec, ofdma->dma_router->route_free(ofdma->dma_router->dev, route_data); } else { + int ret = 0; + chan->router = ofdma->dma_router; chan->route_data = route_data; + + if (chan->device->device_router_config) + ret = chan->device->device_router_config(chan); + + if (ret) { + dma_release_channel(chan); + chan = ERR_PTR(ret); + } } /* diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index dd357a747780..d6197fe875af 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h @@ -800,6 +800,7 @@ struct dma_filter { * by tx_status * @device_alloc_chan_resources: allocate resources and return the * number of allocated descriptors + * @device_router_config: optional callback for DMA router configuration * @device_free_chan_resources: release DMA channel's resources * @device_prep_dma_memcpy: prepares a memcpy operation * @device_prep_dma_xor: prepares a xor operation @@ -874,6 +875,7 @@ struct dma_device { enum dma_residue_granularity residue_granularity; int (*device_alloc_chan_resources)(struct dma_chan *chan); + int (*device_router_config)(struct dma_chan *chan); void (*device_free_chan_resources)(struct dma_chan *chan); struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)( -- Peter Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki