Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2910297lqt; Tue, 23 Apr 2024 05:38:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWGco9x18VT4bRWHlxFqscYJA8NHfCsf0PspdVh09p0ZpztCMCSjqJldNe6cxUrK/OOs5yVV/SCgmeW8188G3TXWBa0apn0NvHEOE/ALQ== X-Google-Smtp-Source: AGHT+IEBeLZXnYCAz0cSmeqQ05YvsDmAlhqkf5TZvqEwCCc2sX/Q3bQmHlxyah93wEovcl3P15NU X-Received: by 2002:a17:902:f54f:b0:1e5:1071:5631 with SMTP id h15-20020a170902f54f00b001e510715631mr20055119plf.65.1713875905725; Tue, 23 Apr 2024 05:38:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713875905; cv=pass; d=google.com; s=arc-20160816; b=xzRT32ftWsy9c/E2iT7GQUBHUbJBi1FckLj9rlsSlkxlY089PUiz/Wa0cKDq9DmjEq YzACPOljqO+6EpRFYZfvk1JEwgrWVImjBEywFrygspwQ67lq4Vsrp9fYJtMrLlinXSPl SBGMfwlfWCDZZ4xIv27jjKga0hJ5mLnnsVWmAoKpIDYVNkGANBtOnYV10ippjC8dAZBs 40Zjomap2+I6Nyu3GPNhVRg3FJntKdUXJXmBnXci71/Yot0qBVdrO7czC8XidbdndHiW gfxlIBl2PtjJXiDFwRhUA2hrAbuq9c5me4ENln9rswoZE4yPfS2Nwf5aN8f7QAlOCct0 xLuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=qJAQvcReYkKykfb7YDV3qlgrNFyxPWTmX6W3WAi2TpY=; fh=GMVtMPLlwt/lj9i49KuTObjDq8olvs384ecnCjKLSCY=; b=Zaul/rYoxiZu/uaiGf2xtZs7J5kydWOzLhCWxmmyKt+C5bwRqfw0BxTL1+HYGmlipl fbyhRJipYSa2IgTzjInVovs01Xa9LNllSksbynk0LfX+j6wtZdgjJkNa3qwuLrbuX/kJ VHj8ZN2zlZyhfP0sxIzbOn2oucgEDv7UfAyHPQtjMfcZzVBgpxS+bla0QyG7oIhRR29f eTbWzweDnZ5g0aNOj1C3lhS7omXDmT5Va/sfLlxzJY3fhtsRRmZ0NEmmCFeRxE+RQ0a8 CanR33pW6HqPXyswlEe3dR97dZZUfs7SvLyoYD1lzCI3zozf4Z5IgzZhN3IfmbrJdz6b 9ZxA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=M4ASwh+U; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-155176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155176-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u4-20020a170902e5c400b001e2c3ace272si9880325plf.99.2024.04.23.05.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 05:38:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-155176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@foss.st.com header.s=selector1 header.b=M4ASwh+U; arc=pass (i=1 spf=pass spfdomain=foss.st.com dkim=pass dkdomain=foss.st.com dmarc=pass fromdomain=foss.st.com); spf=pass (google.com: domain of linux-kernel+bounces-155176-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-155176-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foss.st.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id D0AD1285971 for ; Tue, 23 Apr 2024 12:38:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5D1DE8528B; Tue, 23 Apr 2024 12:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b="M4ASwh+U" Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F1D037E765; Tue, 23 Apr 2024 12:36:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.207.212.93 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713875793; cv=none; b=fnd5bJjrZLGFj+oKDHCPq7npofOS777RpSVup3PGFK6kHR3DS4/9BU96qtIRB7J5NcgYGWVQJwJ3bT4e1qtOAKdmL8+6ckC0AAUjLjju0/CNzEdRbA0DKfuB4ygYOvhgfsSW4yJMG7khQ7jMqtn2P0EDBG5ENK8Dvqc4rWQZLKY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713875793; c=relaxed/simple; bh=fCoyNBrgDINfQGn1FNeW8IbFCBqvIvw+6q2AJGbqVsY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Wq6VY9ttBBOVlDBd81eMSAdij0sO3fvkw50dF3Z/pvr6vOwWn4hsxtsfFB17gIDtCnCEagjnepgDChC5PR6Cvs9QOTUumisgf1AmZXxfCA3SWw2sUZPfhWysNEO8yDVJBkawW8wNxiAu3KhLsUXHG2/8nwTkwTq8pNbc6nmLbHU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com; spf=pass smtp.mailfrom=foss.st.com; dkim=pass (2048-bit key) header.d=foss.st.com header.i=@foss.st.com header.b=M4ASwh+U; arc=none smtp.client-ip=91.207.212.93 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foss.st.com Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43N8H3ql011919; Tue, 23 Apr 2024 14:36:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= selector1; bh=qJAQvcReYkKykfb7YDV3qlgrNFyxPWTmX6W3WAi2TpY=; b=M4 ASwh+U++lKh7IKpiPgXCubMEzEncw0phz8JPRWjC540afiqXaxn9iNsJ7Ghz6t0H mvEBPDnig3rAqrxT5WxzHCVN+tRRZ/U23m9WqlE7/q3+ws/pTmONXYFZDO6aHm4A 5kV0+UO4rxkDH/JEG2XRHsu9rPI1XJSw4KadJys8gMCp1OyYLNR7vhHuwF6KFRI6 Y19OJDYlU3bwbWkC2ftw08bcQD17FQA4S4TTYJOjDjzfOTgC2fQS3NJz0JVRoV3X pPK3Z9HSUsKa//LHPjM9yVTWvvueCNA0cx9L3t2X65659FKsdBFOPapNs25em+Qd Pr2YsDAkH47CJRPhrL7w== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3xm4kb3dfp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 23 Apr 2024 14:36:20 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 3FA8A40047; Tue, 23 Apr 2024 14:36:16 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 6851921A237; Tue, 23 Apr 2024 14:35:32 +0200 (CEST) Received: from localhost (10.48.86.143) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 23 Apr 2024 14:35:32 +0200 From: Amelie Delaunay To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Maxime Coquelin , Alexandre Torgue CC: , , , , , , Amelie Delaunay Subject: [PATCH 11/12] dmaengine: stm32-dma3: defer channel registration to specify channel name Date: Tue, 23 Apr 2024 14:33:01 +0200 Message-ID: <20240423123302.1550592-12-amelie.delaunay@foss.st.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240423123302.1550592-1-amelie.delaunay@foss.st.com> References: <20240423123302.1550592-1-amelie.delaunay@foss.st.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-04-23_11,2024-04-23_01,2023-05-22_02 On STM32 DMA3, channels can be reserved, so they are non available for Linux. This non-availability creates a mismatch between dma_chan id and DMA3 channel id. Use dma_async_device_channel_register() to register the channels after controller registration and change the default channel name, so that it can match the name in the Reference Manual and ease requesting a channel thanks to its name. Signed-off-by: Amelie Delaunay --- drivers/dma/stm32/stm32-dma3.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/dma/stm32/stm32-dma3.c b/drivers/dma/stm32/stm32-dma3.c index f15cc0129fc7..b6d8afd5ed34 100644 --- a/drivers/dma/stm32/stm32-dma3.c +++ b/drivers/dma/stm32/stm32-dma3.c @@ -1723,9 +1723,6 @@ static int stm32_dma3_probe(struct platform_device *pdev) chan->fifo_size = get_chan_hwcfg(i, G_FIFO_SIZE(i), hwcfgr); /* If chan->fifo_size > 0 then half of the fifo size, else no burst when no FIFO */ chan->max_burst = (chan->fifo_size) ? (1 << (chan->fifo_size + 1)) / 2 : 0; - chan->vchan.desc_free = stm32_dma3_chan_vdesc_free; - - vchan_init(&chan->vchan, dma_dev); } ret = dmaenginem_async_device_register(dma_dev); @@ -1733,14 +1730,26 @@ static int stm32_dma3_probe(struct platform_device *pdev) goto err_clk_disable; for (i = 0; i < ddata->dma_channels; i++) { + char name[12]; + if (chan_reserved & BIT(i)) continue; + chan = &ddata->chans[i]; + snprintf(name, sizeof(name), "dma%dchan%d", ddata->dma_dev.dev_id, chan->id); + + chan->vchan.desc_free = stm32_dma3_chan_vdesc_free; + vchan_init(&chan->vchan, dma_dev); + + ret = dma_async_device_channel_register(&ddata->dma_dev, &chan->vchan.chan, name); + if (ret) { + dev_err_probe(&pdev->dev, ret, "Failed to register channel %s\n", name); + goto err_clk_disable; + } + ret = platform_get_irq(pdev, i); if (ret < 0) goto err_clk_disable; - - chan = &ddata->chans[i]; chan->irq = ret; ret = devm_request_irq(&pdev->dev, chan->irq, stm32_dma3_chan_irq, 0, -- 2.25.1