Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3073262ybt; Mon, 29 Jun 2020 14:36:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxq4iyfgvo5bieb9IeKUbxJ0tK+yVwdyvHZpqURiA4JM7m27XCx9G1Ibt5W+i0YtUIWPh7 X-Received: by 2002:a17:906:60c6:: with SMTP id f6mr3763369ejk.265.1593466560180; Mon, 29 Jun 2020 14:36:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593466560; cv=none; d=google.com; s=arc-20160816; b=RgMp/HMNqFIs4Hp0BI1t4J4TKsjE43IzHvxhMAD8Q8lO04yeUWtqT5wQ839NjozZTy hiN+ZU+87RO3Py4vVovE3gBGTIj7L7/T8EfuLUOyo28iBJCRwgwy0BX5qX0UCpFQWq4m 9Ozo/nuK5BsYtYjKXyTG4nNpjv8NKjaxd3KhZVOhFbHS5rff1c/MmeMpVoQ8qrQF9F/n tbQaY3ZwK5UQ7ZQ5FIK3KiBO6sNa4yWgSnGeZhmakvJPs0LOXReaBgu8EKoRM3ljX/VB zKbqx5oQEfvZ+GW8mnPwXv3/8DDzTXsUdZpvSH4y58BrH9tRB7FOS999DAgAZyeEmDf4 78cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=P+c5w/gtBB/waVJ8Gzi/ym8QI71VZFO8WZKMtT9tFXQ=; b=yoToZhg9vlwRTsiDyFCb377mPSIO7UQJ46djEenUsIeqn+HR0DQO6y7+1E/zKnaNl/ bRaGJgJ+D12O602a7kTU2P6fcKwuEXTaJzMq5p6ct9lB5Lb9ZHDP7wER8SMOa6jhmuRI jAELkDnoVUWoPIuwqRmIPt0L28K9WWHmEAr3Mj36GOAyoV4G8QbXgCghYkjJH8wNzt3L rXm2bUIenwmwIO8spq+DKHKnwgMIl/kpkBfuRKnrkb7SWT6fo/7wc0V8wLme/K3r0bHW xWt2P6do9DDDkIK5xkLZPi9wBPYIasf4sOjmVgKV7Str1K3sv5tRWPAHizSOMPAae0i1 /1xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rdiiVUtr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs18si439642edb.517.2020.06.29.14.35.37; Mon, 29 Jun 2020 14:36:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rdiiVUtr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730294AbgF2Ve4 (ORCPT + 99 others); Mon, 29 Jun 2020 17:34:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:60648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728579AbgF2Skz (ORCPT ); Mon, 29 Jun 2020 14:40:55 -0400 Received: from localhost (unknown [122.182.251.219]) (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 5570023730; Mon, 29 Jun 2020 09:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593424490; bh=d9CswmNYtUVd7rQ5C33DkmLgs5/8ixaRznCpZfb770M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rdiiVUtr2B4Jn/9WPFpFAjzyjBo7eHShwryL9SW0kTb3828GO77StQ5Zi+Zm7eE3V kf8sKV1rJsy9nfLP6HOhMssH6ECWJxEaAJyaTyqhAVNiVq4YbMPrhqKE1ujbLkvV6n iA2v1je6E1s66VQQkcWcFy8DDb6uFDKPHRat6hc4= Date: Mon, 29 Jun 2020 15:24:46 +0530 From: Vinod Koul To: =?iso-8859-1?Q?Andr=E9?= Przywara Cc: Amit Singh Tomar , afaerber@suse.de, manivannan.sadhasivam@linaro.org, dan.j.williams@intel.com, cristian.ciocaltea@gmail.com, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org Subject: Re: [PATCH v4 02/10] dmaengine: Actions: Add support for S700 DMA engine Message-ID: <20200629095446.GH2599@vkoul-mobl> References: <1591697830-16311-1-git-send-email-amittomer25@gmail.com> <1591697830-16311-3-git-send-email-amittomer25@gmail.com> <20200624061529.GF2324254@vkoul-mobl> <75d154d0-2962-99e6-a7c7-bf0928ec8b2a@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <75d154d0-2962-99e6-a7c7-bf0928ec8b2a@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24-06-20, 10:35, Andr? Przywara wrote: > On 24/06/2020 07:15, Vinod Koul wrote: > > 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. > > What newer SoCs? I don't think we should try to guess the future here. In a patch for adding new SoC, quite ironical I would say! > We can always introduce further abstractions later, once we actually > *know* what we are looking at. Rather if we know we are adding abstractions, why not add in a way that makes it scale better rather than rework again > Besides, I don't understand what you are after. The max frame length is > 1MB in both cases, it's just a matter of where to put FCNT_VAL, either > in FLEN or in CTRLB. And having an extra flag for that in driver data > sounds a bit over the top at the moment. Maybe, maybe not. I would rather make it support N SoC when adding support for second one rather than keep adding everytime a new SoC is added... -- ~Vinod