Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1640671ybv; Fri, 21 Feb 2020 00:50:12 -0800 (PST) X-Google-Smtp-Source: APXvYqyam7F6FCaT0twUHiL8ga0HgW/wOiXicl0+2pSQ2Udn8oeRd0C7kvcTXuq+/VSboQLAsyjG X-Received: by 2002:a54:4418:: with SMTP id k24mr1122563oiw.46.1582275012536; Fri, 21 Feb 2020 00:50:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582275012; cv=none; d=google.com; s=arc-20160816; b=yRStckpcaYRyaGXBGWwJokHNHhufF4TX0ruv7IekxCl5JKkcIHrnzS+Gz+6QxHp6a6 nxWdnDmWZpteCkH7toU21Jd/YghvCNqln0YHpArOBlr0z8slq49hKYqnouRvF3TCMXHI YqtIoTfsPNWJ5S4KCbK5QL7aXWLQjE9dlK+jeT71e7PfSilCiANIY1spr9O7OAuVI6O/ iUNu74UlWsJ2JZDustjFl/xsPIwNX9uY+Qr5+NarFH5M5Uc0WWGQamYiLsFEBuezRW5a OjV5l2oHR3q6BFu9GjE0d8MCruddx59gcLwsuttjDv/R4AmhR1CmaKLtDvjq3clZX4Jl Sl3A== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=IyyGGBz2z1IAKo3PxJ5hzFDSP5DN687tAhTr+ouJcIM=; b=qsZDjOT11sUFUx23iIFAeqNzQ/8BCCAC7/FSBiogiPJ+5rFZPiRHRQsg0LFVtwaYlv 0CevvRGCP7R9xkAokpLoxSDOjY7DaIWsJtJTwu3gQxp0gyExtMwaO3Dg2wyRPSNv/VJG z9dZFDZmmESLQBNymu0xp88IVu7Lygr7AGqueH2GJmGoGkZn5pXAk0HmwGP5AmdWFUL/ hadb2SkPrDQEbIGb/4bz/2X+sGbP5jNeEQG+/tZFZ2f/GzoD8di/UZ4CQO9/i3CVRSke CF1xgoT0ZdujOxgW7TR28KBiWKM8OvrdIYUh+j2Ukh9MVljoDyKQ3wNkCfmV19uTABcy 9jNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EZNBm5aE; 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 q5si1119908otc.104.2020.02.21.00.50.00; Fri, 21 Feb 2020 00:50: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; dkim=pass header.i=@kernel.org header.s=default header.b=EZNBm5aE; 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 S1727039AbgBUHpH (ORCPT + 99 others); Fri, 21 Feb 2020 02:45:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:40070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728243AbgBUHpD (ORCPT ); Fri, 21 Feb 2020 02:45:03 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 960BF24650; Fri, 21 Feb 2020 07:45:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582271103; bh=B57KRccJ758jF0xN74+wxNnwCOVOgwAYcSyGiizN5Pg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZNBm5aE+G6Jb2J5hvs6fK2jyZGH8DIK9zsz4U39pjNnUWpPq+ikVNzk8Q74FhjZM mNLUEZ5Asgzg5C70I0tw5SFuN+q2yAYYegB/OT4hKZBcpiC5lZqtD+2dJAgjflFOnd WxoNnKLWAjjjNobNgN6YoyVHKbmRP1tt+6Cw0XyA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Maxime Ripard , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.5 041/399] media: sun4i-csi: Deal with DRAM offset Date: Fri, 21 Feb 2020 08:36:06 +0100 Message-Id: <20200221072406.360036973@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen-Yu Tsai [ Upstream commit 249b286171fa9c358e8d5c825b48c4ebea97c498 ] On Allwinner SoCs, some high memory bandwidth devices do DMA directly over the memory bus (called MBUS), instead of the system bus. These devices include the CSI camera sensor interface, video (codec) engine, display subsystem, etc.. The memory bus has a different addressing scheme without the DRAM starting offset. Deal with this using the "interconnects" property from the device tree, or if that is not available, set dev->dma_pfn_offset to PHYS_PFN_OFFSET. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- .../platform/sunxi/sun4i-csi/sun4i_csi.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c index f36dc6258900e..b8b07c1de2a8e 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -155,6 +156,27 @@ static int sun4i_csi_probe(struct platform_device *pdev) subdev = &csi->subdev; vdev = &csi->vdev; + /* + * On Allwinner SoCs, some high memory bandwidth devices do DMA + * directly over the memory bus (called MBUS), instead of the + * system bus. The memory bus has a different addressing scheme + * without the DRAM starting offset. + * + * In some cases this can be described by an interconnect in + * the device tree. In other cases where the hardware is not + * fully understood and the interconnect is left out of the + * device tree, fall back to a default offset. + */ + if (of_find_property(csi->dev->of_node, "interconnects", NULL)) { + ret = of_dma_configure(csi->dev, csi->dev->of_node, true); + if (ret) + return ret; + } else { +#ifdef PHYS_PFN_OFFSET + csi->dev->dma_pfn_offset = PHYS_PFN_OFFSET; +#endif + } + csi->mdev.dev = csi->dev; strscpy(csi->mdev.model, "Allwinner Video Capture Device", sizeof(csi->mdev.model)); -- 2.20.1