Received: by 10.223.176.5 with SMTP id f5csp1195787wra; Sat, 27 Jan 2018 18:41:12 -0800 (PST) X-Google-Smtp-Source: AH8x226K8BmaUbACl2vLHSH/OMomsvCuw6i/7WEKWb1Wjo7u8+J6gVJZ8VcamM4QkAtg1Tn/PvVr X-Received: by 10.98.197.3 with SMTP id j3mr22791678pfg.93.1517107272217; Sat, 27 Jan 2018 18:41:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517107272; cv=none; d=google.com; s=arc-20160816; b=Go0/5hl6083Debc1Jax5IDZnkYmVtTWUevwsCDnFBL4S0KP6McgnMUnzXKdv3SATZm lJXlItZr7GimVh+I4YqIDU4N5CcrjbeJYLna0y0zDIQpRelqnkHi1wgqRD4NoDOqzfk7 D7Lq1mZwTjHLK1ZygHVJkFbjrNCHXAbuZo5SYPU27C/vPe14w/wB0xBPsNY0qaty3NL/ xJQ/tenCsX3Oksiq7SX3z3ukRRqq2uE23dsfj/j6erEtqtJfEaizn92X4jvi648Ff8hN 992Sqd6UphgpeeDR8uXoOOAQjeoxhV+Ih3W9RZ2xN4kD0X1ljvngIbQ1Rhs63600+dbr Lr4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=1wq1v/C3dmsaitpCFhB9XSzRoLopPBwCTkjabKOpZa8=; b=INT33M9ysa3Oxbfm0WQPGQ4KPwYn+/bD8bml3I0/5vm6os/IrcEevG03yhpSTnrMaP cQY5GG1uFMuTy7hKoENsdsNF8ABZMTPgW+i5CABYxEacFW2E37fzNSSmZxkPzuTLMAaN 2avV1Q/qjT2WofxUlGFR36jPL3nWSOPfqEjovEzf+n5bcrSXZO60H0eiqoeCkz77kuAD BM+wqG3MJpp1dq006lZwTIjmcorElwRtZ7TtgINVf/pLCoheOaiDtjVmemVljgIgWgYg NcUFc/C7IRX6lF8QhDHJh2oOSwSoJTYGUTx9DZZjDjfBJ/qUagb/JYd3TWlF7z5mRoTH KtpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n26si1210243pge.266.2018.01.27.18.40.48; Sat, 27 Jan 2018 18:41:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752582AbeA1CkO (ORCPT + 99 others); Sat, 27 Jan 2018 21:40:14 -0500 Received: from out20-27.mail.aliyun.com ([115.124.20.27]:42786 "EHLO out20-27.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751251AbeA1CkM (ORCPT ); Sat, 27 Jan 2018 21:40:12 -0500 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.08642541|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01l07440;MF=yong.deng@magewell.com;NM=1;PH=DS;RN=25;RT=25;SR=0;TI=SMTPD_---.AZwoDTe_1517107191; Received: from DESKTOP-VTELE9L(mailfrom:yong.deng@magewell.com fp:180.109.205.110) by smtp.aliyun-inc.com(10.147.40.200); Sun, 28 Jan 2018 10:39:52 +0800 Date: Sun, 28 Jan 2018 10:39:29 +0800 From: Yong To: Linus Walleij Cc: Maxime Ripard , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Chen-Yu Tsai , "David S. Miller" , Greg Kroah-Hartman , Hans Verkuil , Randy Dunlap , Stanimir Varbanov , Hugues Fruchet , Yannick Fertre , Philipp Zabel , Arnd Bergmann , Benjamin Gaignard , Ramesh Shanmugasundaram , Sakari Ailus , Rick Chang , linux-media@vger.kernel.org, "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux ARM , "linux-kernel@vger.kernel.org" , linux-sunxi , megous@megous.com Subject: Re: [PATCH v6 2/2] media: V3s: Add support for Allwinner CSI. Message-Id: <20180128103929.421eb809821f101ee1c6cb60@magewell.com> In-Reply-To: References: <1516695531-23349-1-git-send-email-yong.deng@magewell.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Sat, 27 Jan 2018 17:14:26 +0100 Linus Walleij wrote: > On Tue, Jan 23, 2018 at 9:18 AM, Yong Deng wrote: > > > Allwinner V3s SoC features two CSI module. CSI0 is used for MIPI CSI-2 > > interface and CSI1 is used for parallel interface. This is not > > documented in datasheet but by test and guess. > > > > This patch implement a v4l2 framework driver for it. > > > > Currently, the driver only support the parallel interface. MIPI-CSI2, > > ISP's support are not included in this patch. > > > > Tested-by: Maxime Ripard > > Signed-off-by: Yong Deng > > This is cool stuff :) > > > +void sun6i_csi_update_buf_addr(struct sun6i_csi *csi, dma_addr_t addr) > > +{ > > + struct sun6i_csi_dev *sdev = sun6i_csi_to_dev(csi); > > + /* transform physical address to bus address */ > > + dma_addr_t bus_addr = addr - PHYS_OFFSET; > > I am sorry if this is an unjustified drive-by comment. Maybe you > have already investigate other ways to do this. > > Accessing PHYS_OFFSET directly seems unintuitive > and not good practice. > > But normally an dma_addr_t only comes from some > function inside such as: > dma_alloc_coherent() for a contigous buffer which is coherent > in physical memory, or from some buffer <= 64KB that > is switching ownership between device and CPU explicitly > with dma_map* or so. Did you check with > Documentation/DMA-API.txt? The dma_addr_t here comes from v4l2 vb2 and it's already 'mapped'. Maybe the dma-mapping code of sunXi does not do conversion between device and CPU. I'm not familiar with this. Maxime, do you have any idea about this? Can we get bus address directly from dma_alloc_coherent or dma_map* at the system layer but not doing the conversion per driver? Yong