Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp745340lqb; Fri, 24 May 2024 11:47:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVheYTgJXLh2qLpMXCBm7q+zcn10uQHd9otvl3yAzMfaCm1THblHEvfPyNo7WRLPZVeZ65QTgMWerzgHiIJD+GOiL6MMQjfSqWnAbN0Cg== X-Google-Smtp-Source: AGHT+IHBqsTj4C4VTREHIvy5Lm+EFoJeCmF0i3BLM2apByKXHLrqkUddmeghDrmflTORbHPnjgSn X-Received: by 2002:a05:6214:4686:b0:6ab:99df:4107 with SMTP id 6a1803df08f44-6abcd13baedmr34398416d6.57.1716576475672; Fri, 24 May 2024 11:47:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716576475; cv=pass; d=google.com; s=arc-20160816; b=LGegjK+ReJMxEVYqhAHSSbVO6t2LKj2OhwabPIX2Apthc6wH53DzOR2fsUpFNhRv/E WKaEPhSdVDpVyaQKpl7eE6pVM9LyYg1MjcrQOMDs1sUWJL+d8v4AZx5HMR3PMlHbpsjJ 9dsmSTjUDWu14XGZgaEAVlNqjnDS9W6Ogzjphl4+PMWMm8wf3dNBQ/ZYZMuL29O1iXvv /0H6m/bab1xjWOKPgOmvBqg38CL4AJB/phsM69PihjWEJ8nlYuKKVxf90rabMZUE/3kO t+4tYFamBqd4D0Oii6E263i643EdJEKAC8iG7l6K3MoybuIya8ldpM/HgbCB3jJK5HsM xNjQ== 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=wA8wcVcwFLmtvy2VP3x9io/V3+kH7xE00SpBiNM4hDU=; fh=/Ng3a0UI21XVKr7UwKcoROfBGT0x0surrrRq7PkoGrY=; b=t+wyQE4Bcjo/Pxkn/e2HTz+8f7k0RrOC7Ay4BXphjwuTPiZMkhRg1scooYiXdf/QOX JxOt9hkkm8dTTgr5lL098pph8OFS4D9fEjelxcTO9xMPhkjgxbANuD61dqPRzJ2kl88Z Fk5g4vjRcb7FLKSQfQFzuRS/4BWgr2ci7q0tc7Ybs+/e8r6N0nF6DAJ+qIHGAfezKaHw pixBIq/3/pSRRw5fYRAzMO8LxjF7phCSnDUQacgBUHM2AZSD6dv8eY1+fJ4biNjXb7TO LXX4XdKjmrjb1vN0InuVw60m0qzU1EMUZ5PFNlGdd5LKQ5HoAE/nBF+kRRj/Qxy2V0TO bBbA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=EapH5Vzu; arc=pass (i=1 spf=pass spfdomain=raspberrypi.com dkim=pass dkdomain=raspberrypi.com dmarc=pass fromdomain=raspberrypi.com); spf=pass (google.com: domain of linux-kernel+bounces-189003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 6a1803df08f44-6ac162b5654si23436256d6.511.2024.05.24.11.47.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 11:47:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@raspberrypi.com header.s=google header.b=EapH5Vzu; arc=pass (i=1 spf=pass spfdomain=raspberrypi.com dkim=pass dkdomain=raspberrypi.com dmarc=pass fromdomain=raspberrypi.com); spf=pass (google.com: domain of linux-kernel+bounces-189003-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189003-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=raspberrypi.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id C89EF1C21772 for ; Fri, 24 May 2024 18:31:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E2FF312C539; Fri, 24 May 2024 18:28:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="EapH5Vzu" Received: from mail-wm1-f97.google.com (mail-wm1-f97.google.com [209.85.128.97]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5EAE340848 for ; Fri, 24 May 2024 18:27:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.97 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716575282; cv=none; b=Uz0BUHROnpRpMYrNzP2IxNwUNBvp+wTPzciR/Y1nEQVhQGdj3Bro8CyCpiC1ndc/Dxx8XWQQ93Di5TOxUam3ug6fbQtDsIO3yT8cIA9Q8mZK1meiQ3/hCg40aD0PmW5JAYJrWO6jS+8xg9CUSDnIx142+XGdJhsLSxXhEYs3E0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716575282; c=relaxed/simple; bh=CyDfQLvAvAnEQtfGBunWvar9mbFlVk8eB6mLlJLEUOY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Mr9n8/xWm5JRoEzQ5GROAMfFaLlkCBGYhKygDmbGuUCPBZWo/ImyGNxMqraQZ5ESLvnPfoh+dCllRtfyAUTEXqQhWZLg4+7kVRL3KjyF3zhLGSVIhHFZIvHOqlr2fzw90u3MV2cbbB8DuwHFtD7DluZUd2KFGgBZod8Uc4t7P98= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=raspberrypi.com; spf=pass smtp.mailfrom=raspberrypi.com; dkim=pass (2048-bit key) header.d=raspberrypi.com header.i=@raspberrypi.com header.b=EapH5Vzu; arc=none smtp.client-ip=209.85.128.97 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=raspberrypi.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=raspberrypi.com Received: by mail-wm1-f97.google.com with SMTP id 5b1f17b1804b1-420180b5922so41043675e9.2 for ; Fri, 24 May 2024 11:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; t=1716575275; x=1717180075; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wA8wcVcwFLmtvy2VP3x9io/V3+kH7xE00SpBiNM4hDU=; b=EapH5Vzu3Obz7Ahca2lTgBLMN9X9XWhFwgHYbmtbRXfH7GYK1sfGzsjTP8n0kR1XLu iVSiPvtLJhD/y2WKGVMcO/vSW3X2T+YdfgAKsmoWRrvUauSAk0AMFVm0Pw9I0xejzI3+ KnU/1V7gSLLv78YVq1d0C14qrNw/cnXB3dv1p1DbpH7UBv5iGhVkFlzvIoWQUIUHoo/6 ZuIosgYxpyFAGUtGxbIF7REEP92uvoPlP2a6t6Z3l6G6jqYgpHfMO3JRUAAADVSCjeNH 4ccZUzmKFtd7hVOL25cNAq+z435LauLEMx+xlT1nzZ0iJSsZJX+DAhGJgYqWOSvUBQg1 uoyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716575275; x=1717180075; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wA8wcVcwFLmtvy2VP3x9io/V3+kH7xE00SpBiNM4hDU=; b=m2XbW14i8FXIl9r7/7y++uMG30MCaJ2t5joHosxoKRTkIzics0S5RC9R2ndXk8I9+h OKjTKS938113iKovkoBUeSCIpJkpX5nt1aYnbV8K5DMCHbHB74Ou4KfRawuD1uHPIyuD 1rISRtZ99SHRbGNMpn7Mmoi3bf0GjF68V1CBfQW65Pr/5pmxZNHin5fqWvW3iqltVLQJ pLo8IqjBs3qx2VPsYCx9G/2S0MMHzanBbpS9hasviDPlezKX+xws+VCXaz/Qh3u7EYNw JX2nUFYtR8V/Bfo0PIBFilt8M7QA6o7ITtzgRGT9BAZOK4VTLOUblK+7jx3wB59pM6xB W/9g== X-Forwarded-Encrypted: i=1; AJvYcCUDRX7mJAxiQc7r2zc6NYOD052OakZG7E4O0h7o83U+P7C4L3UyUR7Y0gZzMMHDsWbYvlh8Qt60m6IyGbi20uR2x+wqGYAt7cm9v0so X-Gm-Message-State: AOJu0YxAWweG0op8mCpdpksOTS/KPXSa2TS9WCBtlVZz5qYMRLgdgCVd E9GCHlHpUy+BZhXKWGRzvCpFf4h+7mIygfxgQZGtfYPLMy1BbvdE/Ym/UBJa2t4RKhWvBdLoQSp Jj1SUlmqdX8PG0aFOULNf3R1n49jEuxhv X-Received: by 2002:a05:600c:5746:b0:420:29dd:84f8 with SMTP id 5b1f17b1804b1-42108a99ba4mr30406535e9.32.1716575275682; Fri, 24 May 2024 11:27:55 -0700 (PDT) Received: from raspberrypi.com ([188.39.149.98]) by smtp-relay.gmail.com with ESMTPS id 5b1f17b1804b1-42108905a6dsm1244535e9.9.2024.05.24.11.27.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 11:27:55 -0700 (PDT) X-Relaying-Domain: raspberrypi.com From: Dave Stevenson To: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Broadcom internal kernel review list , Ray Jui , Scott Branden , Vinod Koul , Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Ulf Hansson , Mark Brown , Christoph Hellwig , Marek Szyprowski , Robin Murphy , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , Vladimir Murzin , Phil Elwell , Stefan Wahren , Serge Semin Cc: devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dmaengine@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, iommu@lists.linux.dev, linux-sound@vger.kernel.org, Stefan Wahren , Dave Stevenson Subject: [PATCH 08/18] dmaengine: bcm2835: pass dma_chan to generic functions Date: Fri, 24 May 2024 19:26:52 +0100 Message-Id: <20240524182702.1317935-9-dave.stevenson@raspberrypi.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240524182702.1317935-1-dave.stevenson@raspberrypi.com> References: <20240524182702.1317935-1-dave.stevenson@raspberrypi.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 From: Stefan Wahren In preparation to support more platforms pass the dma_chan to the generic functions. This provides access to the DMA device and possible platform specific data. Signed-off-by: Stefan Wahren Signed-off-by: Dave Stevenson --- drivers/dma/bcm2835-dma.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index e2f9c8692e6b..aefaa1f01d7f 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -288,12 +288,13 @@ static void bcm2835_dma_desc_free(struct virt_dma_desc *vd) } static bool -bcm2835_dma_create_cb_set_length(struct bcm2835_chan *chan, +bcm2835_dma_create_cb_set_length(struct dma_chan *chan, struct bcm2835_dma_cb *control_block, size_t len, size_t period_len, size_t *total_len) { - size_t max_len = bcm2835_dma_max_frame_length(chan); + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); + size_t max_len = bcm2835_dma_max_frame_length(c); /* set the length taking lite-channel limitations into account */ control_block->length = min_t(u32, len, max_len); @@ -417,7 +418,7 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( /* set up length in control_block if requested */ if (buf_len) { /* calculate length honoring period_length */ - if (bcm2835_dma_create_cb_set_length(c, control_block, + if (bcm2835_dma_create_cb_set_length(chan, control_block, len, period_len, &total_len)) { /* add extrainfo bits in info */ @@ -485,8 +486,9 @@ static void bcm2835_dma_fill_cb_chain_with_sg( } } -static void bcm2835_dma_abort(struct bcm2835_chan *c) +static void bcm2835_dma_abort(struct dma_chan *chan) { + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); void __iomem *chan_base = c->chan_base; long int timeout = 10000; @@ -513,8 +515,9 @@ static void bcm2835_dma_abort(struct bcm2835_chan *c) writel(BCM2835_DMA_RESET, chan_base + BCM2835_DMA_CS); } -static void bcm2835_dma_start_desc(struct bcm2835_chan *c) +static void bcm2835_dma_start_desc(struct dma_chan *chan) { + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); struct virt_dma_desc *vd = vchan_next_desc(&c->vc); struct bcm2835_desc *d; @@ -533,7 +536,8 @@ static void bcm2835_dma_start_desc(struct bcm2835_chan *c) static irqreturn_t bcm2835_dma_callback(int irq, void *data) { - struct bcm2835_chan *c = data; + struct dma_chan *chan = data; + struct bcm2835_chan *c = to_bcm2835_dma_chan(chan); struct bcm2835_desc *d; unsigned long flags; @@ -566,7 +570,7 @@ static irqreturn_t bcm2835_dma_callback(int irq, void *data) vchan_cyclic_callback(&d->vd); } else if (!readl(c->chan_base + BCM2835_DMA_ADDR)) { vchan_cookie_complete(&c->desc->vd); - bcm2835_dma_start_desc(c); + bcm2835_dma_start_desc(chan); } } @@ -594,7 +598,7 @@ static int bcm2835_dma_alloc_chan_resources(struct dma_chan *chan) } return request_irq(c->irq_number, bcm2835_dma_callback, - c->irq_flags, "DMA IRQ", c); + c->irq_flags, "DMA IRQ", chan); } static void bcm2835_dma_free_chan_resources(struct dma_chan *chan) @@ -682,7 +686,7 @@ static void bcm2835_dma_issue_pending(struct dma_chan *chan) spin_lock_irqsave(&c->vc.lock, flags); if (vchan_issue_pending(&c->vc) && !c->desc) - bcm2835_dma_start_desc(c); + bcm2835_dma_start_desc(chan); spin_unlock_irqrestore(&c->vc.lock, flags); } @@ -846,7 +850,7 @@ static int bcm2835_dma_terminate_all(struct dma_chan *chan) if (c->desc) { vchan_terminate_vdesc(&c->desc->vd); c->desc = NULL; - bcm2835_dma_abort(c); + bcm2835_dma_abort(chan); } vchan_get_all_descriptors(&c->vc, &head); -- 2.34.1