Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1745622lql; Wed, 13 Mar 2024 07:10:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjITdRw8Zzvzb4r+/DjoC0jPEBq3Y09NZQ/yby0UzmFFxvg6neGKAXT0DTIKyK6X+GtxIZei37HCb2HHQD+ir2dkQE5+vejbORIzQ5pw== X-Google-Smtp-Source: AGHT+IEtM4DvhDmrPlAlmRRViYKsPZmqQW+BiMCAfSaU7QiuC3m7eYgbabl1Qyd8aqxzN1qFkpWg X-Received: by 2002:a17:90a:fd01:b0:29c:2e85:a86c with SMTP id cv1-20020a17090afd0100b0029c2e85a86cmr5630225pjb.39.1710339041085; Wed, 13 Mar 2024 07:10:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710339041; cv=pass; d=google.com; s=arc-20160816; b=DWihO0KknOL6fNFubmvFG3KAGGHrM/CqQbRBxz6zjLKpg1R4peLOSEsCavqC/rU2pv QH1hYI2sUGcLDPO2hNvolLQQMynjZ0Zl6ct97iMsGJIU7HwCB23n11BhWuh6A/iGnf7I ca5fl2FguXq/UheRVMnKwvSVIMMtO1F/2Wc8sWn3YShWif7SPwFs0BwQUu5/PiGf8UDL wOB/Uc3wNdryI8GFUZ57NXC61SjcBqSLbau9hNI3MPSdRmsxyRQhRAGsDtUtnZ5PFePh XdsK4n1Z8VacM/ne+E/LRRs7BEY0GwKrJkXXH6tOQmrMLA5SxyuhDF6tYYJo2CHXawV0 9xdQ== 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=2aA326qloufGfA/9FJeIrf9CjXOtqN0+M89y+6rWqCo=; fh=uKZoh7NDqbtTbIjoI9m5lu6e5CHZMQNMeTAO4j7c8i4=; b=cqQbLgMTfXZbRa3wVtTscAYQY9tpB/fZDI4Cf0qlh2ZUzCZdqwknNc+Mey8zAz89CI FyOjhJ1Yx2liY20uYYnI9tJZHHHU9JG/YmNngcINtWaNM4zkuj7C2D+bNxR0n5R3kNKR M+Erk1X1tKwyfJ/fe9uaRX0/b8GggcgOpsC3N7ey610F8RIPLLs1gtet8R8pbZSKTjJe ia561sA1RiZhjJCL+KI0HMHwkK6RkDXT5t7z/Pn6ctSg8+Y5KlPhdJjlB6o9nhodwL5I zLqnN1nJZn8vjIbVvDvVH+X8GNBrg4WMQ26p8xetyb2pYdcqk2cmPxg0XOgKfEQxYb0Q HSlQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=CPdAylgc; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-101597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id oj5-20020a17090b4d8500b0029b9d828c4fsi1571002pjb.86.2024.03.13.07.10.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 07:10:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=CPdAylgc; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-101597-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101597-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.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 643E5289149 for ; Wed, 13 Mar 2024 14:10:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 94FFE50271; Wed, 13 Mar 2024 14:09:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="CPdAylgc" Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (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 6F2524D134 for ; Wed, 13 Mar 2024 14:09:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710338943; cv=none; b=G3btPkfVtnbV+3zHGfWHbBKukHnTHtr9nnk8clDxt0ouSgkxy1na2587+uPSzb984TbaxxiTLppENIRAqvrIEUq829IGLazomFum/ekX1928FEAhFc5fvzccG2vX8tKN/tsAk3kGrXAu9BkKykvbhiLS1znsqYeoVlsG7k23X7c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710338943; c=relaxed/simple; bh=cxjZSR8LRDYJ/W/QF37SUMynPidomrXSkI+hkRn0XJk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dfFP5MB21SH6XrgymHq4oXHv2hBOZgqItVDb2AQ1jNyNYzKF7MqueVi8zphc7Gtr3NEtDfhNe1aEBZNXgd8MrHnwT0D1rK8VBL6e0ApN2Xgv58fMLs46Na0f00UHaMKk/tto1xf6zwHU8KvapCHPHdkJnLW05/EzCPdgAGmtKS0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=CPdAylgc; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-a45c006ab82so145160966b.3 for ; Wed, 13 Mar 2024 07:09:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1710338940; x=1710943740; 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=2aA326qloufGfA/9FJeIrf9CjXOtqN0+M89y+6rWqCo=; b=CPdAylgchuHZicfW3zJDNEgvIO3Z4iq+PaefWzT5AfmAnMWOP70oHgXi8J2rSqC6Xy LOkp22dpQhEmSCs0Dl+CYVZWQ2NHMIHZbJT8TsH7pEFIWR2ixgTO2bk1eKe6fMeYu/2i TIi+sAocolWuiVLCVD86rvJKm+ZxWtyiGNq2oTyxIqH/yo2vMI4rY5GsFzTLtbkWIsfd fS72wQGVgv7Pbk2As6TEf2+XPZvElAtSggs+vxXc1oHFzG9azCwBLbOzorc7vd5g3aVh GaQiC98UCZ4wwXnjopvQaKJ/8jc9Wif3eUsXu35u7vROZzfQCsUDoQ1n6BLWs6Nv6hC9 dqVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710338940; x=1710943740; 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=2aA326qloufGfA/9FJeIrf9CjXOtqN0+M89y+6rWqCo=; b=rcHBPEkn8TW9GZu6qcoE4qFjeUM/p8dUUHu5DFva1sBCnPNykkFUdSQMm4i4HPgpBi ULyIaN9IIozudASVf/H7xXtK9lUqCcqoNxoxsnli5OI+W57W/QCaj2niBBW84Ow/4RUU yaBa8pCl3ZZZLyWyPpgr6zRQQ9VZTbVp8t6nazumd0ve57IZMomAjGEPTWp97ax40e5R acckyBNodAhbEDjajTdgjpNthr/JjCoWiK4KkzTvBj4tAPlT6dFWHptEHhsm0AB97QGX 7DSUFontIqevFrGHX2VfJSZGeg55WvDdN72PRhsnZoVBJH6hulA3zEsBwyEtxb7nDdT2 /xNQ== X-Forwarded-Encrypted: i=1; AJvYcCXBQsV30uNshaR01PpK8OUmaUCL+FMOHeYX/MI5JxnAtRI/l9BMBFgq04syTPogO1eDsXq7t5CFZ/pVWJLhwLINOTUp6XHokTgy0Wu8 X-Gm-Message-State: AOJu0Ywu+BRxC11oVm4KWq6G49MdyJyNXutZc/U9Da+ld8xgtTctqjZJ 0dEXhA5e+CNBRTsb2HpNjJ4faVRzXf8e0uPchQpHlmSO+7499YtSTPTU2tBKK7U= X-Received: by 2002:a17:907:94c1:b0:a46:181f:c1c3 with SMTP id dn1-20020a17090794c100b00a46181fc1c3mr5229468ejc.70.1710338939952; Wed, 13 Mar 2024 07:08:59 -0700 (PDT) Received: from localhost (host-82-56-173-172.retail.telecomitalia.it. [82.56.173.172]) by smtp.gmail.com with ESMTPSA id l23-20020a170906a41700b00a440ec600e3sm4885228ejz.121.2024.03.13.07.08.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 07:08:59 -0700 (PDT) From: Andrea della Porta To: Vinod Koul , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Florian Fainelli , Ray Jui , Scott Branden , Broadcom internal kernel review list , Saenz Julienne , dmaengine@vger.kernel.org, devicetree@vger.kernel.org, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, dave.stevenson@raspberrypi.com Cc: Phil Elwell , Maxime Ripard , Stefan Wahren , Dom Cobley , Andrea della Porta Subject: [PATCH v2 09/15] dmaengine: bcm2835: make address increment platform independent Date: Wed, 13 Mar 2024 15:08:34 +0100 Message-ID: <0bf87ad0dc970c34199fd6bc6dbd19b47d382066.1710226514.git.andrea.porta@suse.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Actually the criteria to increment source & destination address doesn't based on platform specific bits. It's just the DMA transfer direction which is translated into the info bits. So introduce two new helper functions and get the rid of these platform specifics. Signed-off-by: Stefan Wahren Signed-off-by: Andrea della Porta --- drivers/dma/bcm2835-dma.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/drivers/dma/bcm2835-dma.c b/drivers/dma/bcm2835-dma.c index b633c40142fe..6f896bb1a4fe 100644 --- a/drivers/dma/bcm2835-dma.c +++ b/drivers/dma/bcm2835-dma.c @@ -274,6 +274,24 @@ static u32 bcm2835_dma_prepare_cb_extra(struct bcm2835_chan *c, return result; } +static inline bool need_src_incr(enum dma_transfer_direction direction) +{ + return direction != DMA_DEV_TO_MEM; +} + +static inline bool need_dst_incr(enum dma_transfer_direction direction) +{ + switch (direction) { + case DMA_MEM_TO_MEM: + case DMA_DEV_TO_MEM: + return true; + default: + break; + } + + return false; +} + static void bcm2835_dma_free_cb_chain(struct bcm2835_desc *desc) { size_t i; @@ -355,10 +373,8 @@ static inline size_t bcm2835_dma_count_frames_for_sg(struct bcm2835_chan *c, * @cyclic: it is a cyclic transfer * @info: the default info bits to apply per controlblock * @frames: number of controlblocks to allocate - * @src: the src address to assign (if the S_INC bit is set - * in @info, then it gets incremented) - * @dst: the dst address to assign (if the D_INC bit is set - * in @info, then it gets incremented) + * @src: the src address to assign + * @dst: the dst address to assign * @buf_len: the full buffer length (may also be 0) * @period_len: the period length when to apply @finalextrainfo * in addition to the last transfer @@ -430,9 +446,9 @@ static struct bcm2835_desc *bcm2835_dma_create_cb_chain( d->cb_list[frame - 1].cb->next = cb_entry->paddr; /* update src and dst and length */ - if (src && (info & BCM2835_DMA_S_INC)) + if (src && need_src_incr(direction)) src += control_block->length; - if (dst && (info & BCM2835_DMA_D_INC)) + if (dst && need_dst_incr(direction)) dst += control_block->length; /* Length of total transfer */ -- 2.35.3