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 X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22826C433E0 for ; Wed, 24 Jun 2020 06:17:25 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4A2C2078A for ; Wed, 24 Jun 2020 06:17:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PLYaSHEH"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="k8BvXRaz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E4A2C2078A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HQ0MjD50JnsNoDG6afDSKqcCDiDlIRLqAKYZObMMeIw=; b=PLYaSHEHvbKLHBpEwARZNRpen rSZgo5NKQWOczwcWUNEpiZfx6I+Rs6A38txUpwgZ+58roxyaGJbmm8aYOyPTJUYcZIyBzfDERBS69 JKPW8GwNMoN7guJRUM3Fh4TYo36IVTxi0CrfjgHhmyj7ufJ2bEBWEDL2S6hkW6wwZ+WDFWlTYOQMs VCep3rlLK+b6pa9Ed8nX+9J3n+MR7zhgpi6B6oYEJ/0NGvlhDSUb1/kDkXQVxxQ9tiYAKzx3/UPFT WjGfINWVnIIh4jOYwi5hmTecoiG8OUnho7umMx+osXnpLTJ7jDSLzUYSQvNu6/CYOwHtv7ascoF9A H3VefjCbA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnyh7-0003sg-L5; Wed, 24 Jun 2020 06:15:37 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jnyh4-0003sB-M7; Wed, 24 Jun 2020 06:15:35 +0000 Received: from localhost (unknown [171.61.66.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 225022078A; Wed, 24 Jun 2020 06:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592979334; bh=+2ifJ5qyTzzo8WHwSQDmoxhEJggCz1bEjLqjCJez3qY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=k8BvXRazexy8f25Y8p2nmzQZmuOsD1OjLnJBHPxcjmfE7/O/5MKS5PNKZGZ7yMwsA AWxbO/39muxLIQGZCjTOnM+4OD/lCYDGEJGyTAuk/ypdloPBdZAj1SJYTSb5tOm5t3 Gn1lrqsTL6R4nCXa9PxgNPU6/qd0L14eOk8ZYvbc= Date: Wed, 24 Jun 2020 11:45:29 +0530 From: Vinod Koul To: Amit Singh Tomar Subject: Re: [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine Message-ID: <20200624061529.GF2324254@vkoul-mobl> References: <1591697830-16311-1-git-send-email-amittomer25@gmail.com> <1591697830-16311-3-git-send-email-amittomer25@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1591697830-16311-3-git-send-email-amittomer25@gmail.com> X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: andre.przywara@arm.com, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, cristian.ciocaltea@gmail.com, manivannan.sadhasivam@linaro.org, dmaengine@vger.kernel.org, dan.j.williams@intel.com, afaerber@suse.de, linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Amit, On 09-06-20, 15:47, Amit Singh Tomar wrote: > @@ -372,6 +383,7 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan, > struct dma_slave_config *sconfig, > bool is_cyclic) > { > + struct owl_dma *od = to_owl_dma(vchan->vc.chan.device); > u32 mode, ctrlb; > > mode = OWL_DMA_MODE_PW(0); > @@ -427,14 +439,26 @@ static inline int owl_dma_cfg_lli(struct owl_dma_vchan *vchan, > lli->hw[OWL_DMADESC_DADDR] = dst; > lli->hw[OWL_DMADESC_SRC_STRIDE] = 0; > lli->hw[OWL_DMADESC_DST_STRIDE] = 0; > - /* > - * Word starts from offset 0xC is shared between frame length > - * (max frame length is 1MB) and frame count, where first 20 > - * bits are for frame length and rest of 12 bits are for frame > - * count. > - */ > - lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20; > - lli->hw[OWL_DMADESC_CTRLB] = ctrlb; > + > + if (od->devid == S700_DMA) { > + /* Max frame length is 1MB */ > + lli->hw[OWL_DMADESC_FLEN] = len; > + /* > + * On S700, word starts from offset 0x1C is shared between > + * frame count and ctrlb, where first 12 bits are for frame > + * count and rest of 20 bits are for ctrlb. > + */ > + lli->hw[OWL_DMADESC_CTRLB] = FCNT_VAL | ctrlb; > + } else { > + /* > + * On S900, word starts from offset 0xC is shared between > + * frame length (max frame length is 1MB) and frame count, > + * where first 20 bits are for frame length and rest of > + * 12 bits are for frame count. > + */ > + lli->hw[OWL_DMADESC_FLEN] = len | FCNT_VAL << 20; > + lli->hw[OWL_DMADESC_CTRLB] = ctrlb; Unfortunately this wont scale, we will keep adding new conditions for newer SoC's! So rather than this why not encode max frame length in driver_data rather than S900_DMA/S700_DMA.. In future one can add values for newer SoC and not code above logic again. > +static const struct of_device_id owl_dma_match[] = { > + { .compatible = "actions,s900-dma", .data = (void *)S900_DMA,}, > + { .compatible = "actions,s700-dma", .data = (void *)S700_DMA,}, Is the .compatible documented, Documentation patch should come before the driver use patch in a series > static int owl_dma_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > struct owl_dma *od; > int ret, i, nr_channels, nr_requests; > + const struct of_device_id *of_id = > + of_match_device(owl_dma_match, &pdev->dev); You care about driver_data rather than of_id, so using of_device_get_match_data() would be better.. > od = devm_kzalloc(&pdev->dev, sizeof(*od), GFP_KERNEL); > if (!od) > @@ -1083,6 +1116,8 @@ static int owl_dma_probe(struct platform_device *pdev) > dev_info(&pdev->dev, "dma-channels %d, dma-requests %d\n", > nr_channels, nr_requests); > > + od->devid = (enum owl_dma_id)(uintptr_t)of_id->data; Funny casts, I dont think you need uintptr_t! -- ~Vinod _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel