From: Chen-Yu Tsai <wens@kernel.org> To: Maxime Ripard <mripard@kernel.org>, Mauro Carvalho Chehab <mchehab@kernel.org>, Sakari Ailus <sakari.ailus@linux.intel.com>, Rob Herring <robh+dt@kernel.org>, Mark Rutland <mark.rutland@arm.com> Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai <wens@csie.org>, Chen-Yu Tsai <wens@kernel.org>, linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org Subject: [PATCH 05/14] media: sun4i-csi: Deal with DRAM offset Date: Mon, 16 Dec 2019 00:59:15 +0800 Message-ID: <20191215165924.28314-6-wens@kernel.org> (raw) In-Reply-To: <20191215165924.28314-1-wens@kernel.org> From: Chen-Yu Tsai <wens@csie.org> 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 <wens@csie.org> --- .../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 f36dc6258900..b8b07c1de2a8 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 <linux/module.h> #include <linux/mutex.h> #include <linux/of.h> +#include <linux/of_device.h> #include <linux/of_graph.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> @@ -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.24.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply index Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-12-15 16:59 [PATCH 00/14] media: sun4i-csi: A10/A20 CSI1 and R40 CSI0 support Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 01/14] dt-bindings: media: sun4i-csi: Add compatible for CSI1 on A10/A20 Chen-Yu Tsai 2019-12-16 10:30 ` Maxime Ripard 2019-12-19 23:56 ` Rob Herring 2019-12-15 16:59 ` [PATCH 02/14] dt-bindings: media: sun4i-csi: Add compatible for CSI0 on R40 Chen-Yu Tsai 2019-12-16 10:30 ` Maxime Ripard 2019-12-19 23:57 ` Rob Herring 2019-12-15 16:59 ` [PATCH 03/14] media: sun4i-csi: Fix data sampling polarity handling Chen-Yu Tsai 2019-12-16 13:36 ` Maxime Ripard 2019-12-15 16:59 ` [PATCH 04/14] media: sun4i-csi: Fix [HV]sync " Chen-Yu Tsai 2019-12-16 13:37 ` Maxime Ripard 2019-12-15 16:59 ` Chen-Yu Tsai [this message] 2019-12-16 13:38 ` [PATCH 05/14] media: sun4i-csi: Deal with DRAM offset Maxime Ripard 2019-12-15 16:59 ` [PATCH 06/14] media: sun4i-csi: Add support for A10 CSI1 camera sensor interface Chen-Yu Tsai 2019-12-16 13:38 ` Maxime Ripard 2020-01-02 11:33 ` Sakari Ailus 2020-01-02 11:36 ` Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 07/14] ARM: dts: sun4i: Add CSI1 controller and pinmux options Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 08/14] ARM: dts: sun7i: " Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 09/14] ARM: dts: sun8i: r40: Add I2C " Chen-Yu Tsai 2019-12-16 10:29 ` Maxime Ripard 2019-12-15 16:59 ` [PATCH 10/14] dt-bindings: bus: sunxi: Add R40 MBUS compatible Chen-Yu Tsai 2019-12-19 23:58 ` Rob Herring 2019-12-15 16:59 ` [PATCH 11/14] ARM: dts: sun8i: r40: Add device node for CSI0 Chen-Yu Tsai 2019-12-16 13:39 ` Maxime Ripard 2019-12-16 13:42 ` Chen-Yu Tsai 2019-12-16 13:53 ` Maxime Ripard 2019-12-15 16:59 ` [PATCH 12/14] [DO NOT MERGE] ARM: dts: sun4i: cubieboard: Enable OV7670 camera on CSI1 Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 13/14] [DO NOT MERGE] ARM: dts: sun7i: cubieboard2: " Chen-Yu Tsai 2019-12-15 16:59 ` [PATCH 14/14] [DO NOT MERGE] ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable OV5640 camera Chen-Yu Tsai 2020-01-01 10:20 ` [PATCH 00/14] media: sun4i-csi: A10/A20 CSI1 and R40 CSI0 support Chen-Yu Tsai
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20191215165924.28314-6-wens@kernel.org \ --to=wens@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=mchehab@kernel.org \ --cc=mripard@kernel.org \ --cc=robh+dt@kernel.org \ --cc=sakari.ailus@linux.intel.com \ --cc=wens@csie.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-ARM-Kernel Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-arm-kernel/0 linux-arm-kernel/git/0.git git clone --mirror https://lore.kernel.org/linux-arm-kernel/1 linux-arm-kernel/git/1.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-arm-kernel linux-arm-kernel/ https://lore.kernel.org/linux-arm-kernel \ linux-arm-kernel@lists.infradead.org public-inbox-index linux-arm-kernel Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.infradead.lists.linux-arm-kernel AGPL code for this site: git clone https://public-inbox.org/public-inbox.git