From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93B8BC433FE for ; Wed, 13 Apr 2022 08:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233159AbiDMIDd (ORCPT ); Wed, 13 Apr 2022 04:03:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233692AbiDMICy (ORCPT ); Wed, 13 Apr 2022 04:02:54 -0400 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C9461E3C8; Wed, 13 Apr 2022 01:00:32 -0700 (PDT) Received: (Authenticated sender: miquel.raynal@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id 75ED01C0014; Wed, 13 Apr 2022 08:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1649836831; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fqBnj4E/IArS778TbFuQ/LXdhPkqCVHeLCS/sR1tXo8=; b=bG4D7mAptj9IoSxJDX73pRGt2qJyJ6MhlJzmHqx4amX7xWZJm1qu7Sqa9uAf5BjVmOQ+n1 eQOk+Z5lAp9DL/AqgxiHaxckOcuNH6ZoVXUJKlMSD9bvvVeEGZE3AZkRbXEseZJ6DD6JhC IXlPYM/hmzpPEiTfbLAtLYIMIvTDgpGl7N0gi0h0pimcZ8JL4M3lvPIxtkZh4CMXcvcZlv nHQv0fqfW3xApEpSvRalk9lOx4oKbdsMPxbqJPWVjW1TYDf+FUM36obalcd06t496V77C6 k7wU9AuGnbCamtYJ3IGPqxQmZ+QnkmKIVpzhsQirtKrej+Bisik8tovOyua9iA== Date: Wed, 13 Apr 2022 10:00:26 +0200 From: Miquel Raynal To: Geert Uytterhoeven Cc: Magnus Damm , Gareth Williams , Phil Edworthy , Vinod Koul , Linux-Renesas , dmaengine , Milan Stevanovic , Jimmy Lalande , Pascal Eberhard , Thomas Petazzoni , Herve Codina , Clement Leger , Stephen Boyd , Michael Turquette , linux-clk , Viresh Kumar , Andy Shevchenko , Ilpo Jarvinen , Rob Herring , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" Subject: Re: [PATCH v10 5/9] dmaengine: dw: dmamux: Introduce RZN1 DMA router support Message-ID: <20220413100026.73e11004@xps13> In-Reply-To: References: <20220412193936.63355-1-miquel.raynal@bootlin.com> <20220412193936.63355-6-miquel.raynal@bootlin.com> Organization: Bootlin X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Geert, geert@linux-m68k.org wrote on Wed, 13 Apr 2022 09:53:09 +0200: > Hi Miquel, >=20 > On Tue, Apr 12, 2022 at 9:39 PM Miquel Raynal = wrote: > > The Renesas RZN1 DMA IP is based on a DW core, with eg. an additional > > dmamux register located in the system control area which can take up to > > 32 requests (16 per DMA controller). Each DMA channel can be wired to > > two different peripherals. > > > > We need two additional information from the 'dmas' property: the channel > > (bit in the dmamux register) that must be accessed and the value of the > > mux for this channel. > > > > Signed-off-by: Miquel Raynal =20 >=20 > Thanks for your patch! >=20 > > --- /dev/null > > +++ b/drivers/dma/dw/rzn1-dmamux.c > > @@ -0,0 +1,160 @@ > > +// SPDX-License-Identifier: GPL-2.0-only > > +/* > > + * Copyright (C) 2022 Schneider-Electric > > + * Author: Miquel Raynal > + * Based on TI crossbar driver written by Peter Ujfalusi > > + */ > > +#include > > +#include > > +#include > > +#include > > +#include > > +#include > > + > > +#define RNZ1_DMAMUX_NCELLS 6 > > +#define RZN1_DMAMUX_LINES 64 > > +#define RZN1_DMAMUX_MAX_LINES 16 > > + > > +struct rzn1_dmamux_data { > > + struct dma_router dmarouter; > > + unsigned long *used_chans; =20 >=20 > Why a pointer? >=20 > > +static int rzn1_dmamux_probe(struct platform_device *pdev) > > +{ > > + struct device_node *mux_node =3D pdev->dev.of_node; > > + const struct of_device_id *match; > > + struct device_node *dmac_node; > > + struct rzn1_dmamux_data *dmamux; > > + > > + dmamux =3D devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL= ); > > + if (!dmamux) > > + return -ENOMEM; > > + > > + dmamux->used_chans =3D devm_bitmap_zalloc(&pdev->dev, 2 * RZN1_= DMAMUX_MAX_LINES, > > + GFP_KERNEL); =20 >=20 > ... Oh, you want to allocate the bitmap separately, although you > know it's just a single long. >=20 > You might as well declare it in rzn1_dmamux_data as: >=20 > unsigned long used_chans[BITS_TO_LONGS(2 * RZN1_DMAMUX_MAX_LINES)]; I've done that in versions v1..v8 and it was explicitly requested by Ilpo that I used something more specific like a bitmap (or an idr, but I don't think it fits well here). So now I'm using a bitmap... Thanks, Miqu=C3=A8l