From patchwork Sun Dec 15 16:59:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292935 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1386A17F0 for ; Sun, 15 Dec 2019 17:00:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC69F2467D for ; Sun, 15 Dec 2019 17:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429232; bh=NPSuZ6u/sK4SlEDJ0oH9si5g4gTkgubMSRdexHBwM4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=AkvtXt1X0TMUUoZINJrtV6mKejHnCgOQS9yGTHY4510ZoXhLE1HmxZ9sQlLsdkPHD KDlBrF9BUv3/uu12/5UExX3qOIcW2Q3CAM/TB39iGUNYmqEOoKLydJswXyxutsZaOr pLhVRTUj+CZVoTf8Kg3AhedxVLrfKrrrHRaKgKNQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727024AbfLORAY (ORCPT ); Sun, 15 Dec 2019 12:00:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:54890 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726145AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 7379A2465B; Sun, 15 Dec 2019 16:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429169; bh=NPSuZ6u/sK4SlEDJ0oH9si5g4gTkgubMSRdexHBwM4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qIXQlg9wbdGZXjiEkHcQk33NuX/6vZv5AznWEx+QQaKc0cPCRXyWcreLkSlIvrxj+ 6sd709V2okmUuC+zbJ2fGCmk1U8u45MT+uN24eVRFEdfkuV9YqEW7p6hoMhjCep0J1 fgu9XM1jTDew+Zn1w/QZC4zNpROJWYtxrWrz5pSQ= Received: by wens.tw (Postfix, from userid 1000) id 1BB865F9B4; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 01/14] dt-bindings: media: sun4i-csi: Add compatible for CSI1 on A10/A20 Date: Mon, 16 Dec 2019 00:59:11 +0800 Message-Id: <20191215165924.28314-2-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CSI1 block has the same structure and layout as the CSI0 block. Differences include: - Only one channel in BT.656 instead of four in CSI0 - 10-bit raw data input vs 8-bit in CSI0 - 24-bit RGB888/YUV444 input vs 16-bit RGB565/YUV422 in CSI0 - No ISP hardware The hardware found in the A20 is the same as in the A10. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Reviewed-by: Rob Herring --- .../bindings/media/allwinner,sun4i-a10-csi.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml index d3e423fcb6c2..221fe630c7d5 100644 --- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml +++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml @@ -16,7 +16,12 @@ description: |- properties: compatible: - const: allwinner,sun7i-a20-csi0 + oneOf: + - const: allwinner,sun4i-a10-csi1 + - const: allwinner,sun7i-a20-csi0 + - items: + - const: allwinner,sun7i-a20-csi1 + - const: allwinner,sun4i-a10-csi1 reg: maxItems: 1 @@ -25,12 +30,16 @@ properties: maxItems: 1 clocks: + minItems: 2 + maxItems: 3 items: - description: The CSI interface clock - description: The CSI ISP clock - description: The CSI DRAM clock clock-names: + minItems: 2 + maxItems: 3 items: - const: bus - const: isp From patchwork Sun Dec 15 16:59:12 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292937 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F3EE13B6 for ; Sun, 15 Dec 2019 17:00:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 03DD824673 for ; Sun, 15 Dec 2019 17:00:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429235; bh=AggvsG1/GZy0NVHIzr7eHUOA85RmCqX0dOr608p8zzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=MGONcgTYs5J6samb7FYiO4+5kwUOzwEzpcK23XNHa/+RGhv++1ETzmrmyTAU/uZZP XPJS2yS/xclU42FHMLFTWpawXf0XNUFvsYV5qhhqUWn25tdAs3YnYUWm4ZxYsBWqCA LTWSet9z7O+jdooUsUVjVaSkKf4X2EOjj01VVmNI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726232AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:54860 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726130AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 61D1822B48; Sun, 15 Dec 2019 16:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429169; bh=AggvsG1/GZy0NVHIzr7eHUOA85RmCqX0dOr608p8zzA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjb8SO0ljbi+aEGO76d4lW2vkCTjPXBcJEiB5YmicJ5tnekR7Bo8nxXTjwOGFKgl0 4FTvCWTEShVqVAs4AIZqM7d7S6IEHs3SOTtLitqhccgYJ4nBWYIy4HwGXcKtZ/x8Vt ZgX9Dv1i4h3TNz0hi9zQMc5zRZ9TZPSWlvMtriio= Received: by wens.tw (Postfix, from userid 1000) id 271EE5FD21; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 02/14] dt-bindings: media: sun4i-csi: Add compatible for CSI0 on R40 Date: Mon, 16 Dec 2019 00:59:12 +0800 Message-Id: <20191215165924.28314-3-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CSI0 block in the Allwinner R40 SoC looks to be the same as the one in the A20. The register maps line up, and they support the same features. The R40 appears to support BT.1120 based on the feature overview, but it is not mentioned anywhere else. Also like the A20, the ISP is not mentioned, but the CSI special clock needs to be enabled for the hardware to function. The manual does state that the CSI special clock is the TOP clock for all CSI hardware, but currently no hardware exists for us to test if CSI1 also depends on it or not. Add a compatible string for the CSI0 block in the R40, with the A20 compatible string as a fallback. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard Acked-by: Rob Herring --- .../devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml index 221fe630c7d5..d486321b13f5 100644 --- a/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml +++ b/Documentation/devicetree/bindings/media/allwinner,sun4i-a10-csi.yaml @@ -22,6 +22,9 @@ properties: - items: - const: allwinner,sun7i-a20-csi1 - const: allwinner,sun4i-a10-csi1 + - items: + - const: allwinner,sun8i-r40-csi0 + - const: allwinner,sun7i-a20-csi0 reg: maxItems: 1 From patchwork Sun Dec 15 16:59:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292933 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F91A13B6 for ; Sun, 15 Dec 2019 17:00:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7CD402465B for ; Sun, 15 Dec 2019 17:00:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429231; bh=EvY3LwRt0f5Tvf7gcoGOEsDupUlInqW1mNCeFk7ve3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=f1HgcwIVxgPDJ5pZKZSVlmWYpgBck03kD17eaCfSkAM4EwntjxhUIgWJGB7ZalnrB g/1l2sSJQxdKe/8tH6jkxXBYV6fdRF0J55+xUgYkGpkLD/MReeuIbBD42arcx4MMS+ +ALKoWzkeexgNO6lzbcRi9Y8oqdL8ykkfzTD0ERA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727035AbfLORAZ (ORCPT ); Sun, 15 Dec 2019 12:00:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:54888 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726136AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 6FAEC24654; Sun, 15 Dec 2019 16:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429169; bh=EvY3LwRt0f5Tvf7gcoGOEsDupUlInqW1mNCeFk7ve3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qPHlms8RDy0m/MzsOfVjqrcisYEQwVZwsvvQLsGFf/yO16N1gXeFT/9lGSdDVBI2J 9WykYKUqXK28CKGeZrJh6uST59Zb+UD7f94fN6fJMsYbySt6uOdMBjzCO2SXTTM2+y crawrkADDaSicfm7uuE1/DW0batDau1NcqoaBe+I= Received: by wens.tw (Postfix, from userid 1000) id 374BC5FD34; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 03/14] media: sun4i-csi: Fix data sampling polarity handling Date: Mon, 16 Dec 2019 00:59:13 +0800 Message-Id: <20191215165924.28314-4-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CLK_POL field specifies whether data is sampled on the falling or rising edge of PCLK, not whether the data lines are active high or low. Evidence of this can be found in the timing diagram labeled "horizontal size setting and pixel clock timing". Fix the setting by checking the correct flag, V4L2_MBUS_PCLK_SAMPLE_RISING. While at it, reorder the three polarity flag checks so HSYNC and VSYNC are grouped together. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c index d6979e11a67b..8b567d0f019b 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c @@ -279,8 +279,8 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count) csi->regs + CSI_WIN_CTRL_H_REG); hsync_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH); - pclk_pol = !!(bus->flags & V4L2_MBUS_DATA_ACTIVE_HIGH); vsync_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH); + pclk_pol = !!(bus->flags & V4L2_MBUS_PCLK_SAMPLE_RISING); writel(CSI_CFG_INPUT_FMT(csi_fmt->input) | CSI_CFG_OUTPUT_FMT(csi_fmt->output) | CSI_CFG_VSYNC_POL(vsync_pol) | From patchwork Sun Dec 15 16:59:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292931 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6260414E3 for ; Sun, 15 Dec 2019 17:00:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 40BFE24673 for ; Sun, 15 Dec 2019 17:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429223; bh=YiZkGwkK67xjKvh04OG2iNzUX1jhnitIyudLUFuCRas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=jYUId+uxv6P+cv+2qcxc3q0GR4Dd77NGWs2gT0v7FFnCjZhgt6zOO87yQ0Z9wXw6E zhGM06lxKEiFGToniOHGsGYtO9hV7OLIUb9UEBNxiUZGxMnFYO/5XeqL/tPbnHL/Gr CJ1mQ5/vAjCUXFY1BJ8QpCVy/kS7IHLVYSvXL/6w= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbfLOQ7b (ORCPT ); Sun, 15 Dec 2019 11:59:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:54988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbfLOQ7a (ORCPT ); Sun, 15 Dec 2019 11:59:30 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 D472224686; Sun, 15 Dec 2019 16:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429170; bh=YiZkGwkK67xjKvh04OG2iNzUX1jhnitIyudLUFuCRas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2qlgAGADNndp5PkpCyzmH5tNeE7ulCCZUZkYrmoWcmcckE1Wso4CrFtsoe3I8oGZP ZNHOFwmac4zmMoRG3gtuQegrM6CF6zYu/34/FSIdhKlG6dD0HUzm0xPJz0T+i9ijyM oyisXQLNtZHdEJ+rJH05YPBTANwfMebPkUO5K09k= Received: by wens.tw (Postfix, from userid 1000) id 433D25FD5D; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 04/14] media: sun4i-csi: Fix [HV]sync polarity handling Date: Mon, 16 Dec 2019 00:59:14 +0800 Message-Id: <20191215165924.28314-5-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The Allwinner camera sensor interface has a different definition of [HV]sync. While the timing diagram uses the names HSYNC and VSYNC, the note following the diagram and register names use HREF and VREF. Combined they imply the hardware uses either [HV]REF or inverted [HV]SYNC. There are also registers to set horizontal skip lengths in pixels and vertical skip lengths in lines, also known as back porches. Fix the polarity handling by using the opposite polarity flag for the checks. Also rename `[hv]sync_pol` to `[hv]ref_pol` to better match the hardware register description. Fixes: 577bbf23b758 ("media: sunxi: Add A10 CSI driver") Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- .../media/platform/sunxi/sun4i-csi/sun4i_csi.h | 4 ++-- .../media/platform/sunxi/sun4i-csi/sun4i_dma.c | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h index 001c8bde006c..88d39b3554c4 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h @@ -22,8 +22,8 @@ #define CSI_CFG_INPUT_FMT(fmt) ((fmt) << 20) #define CSI_CFG_OUTPUT_FMT(fmt) ((fmt) << 16) #define CSI_CFG_YUV_DATA_SEQ(seq) ((seq) << 8) -#define CSI_CFG_VSYNC_POL(pol) ((pol) << 2) -#define CSI_CFG_HSYNC_POL(pol) ((pol) << 1) +#define CSI_CFG_VREF_POL(pol) ((pol) << 2) +#define CSI_CFG_HREF_POL(pol) ((pol) << 1) #define CSI_CFG_PCLK_POL(pol) ((pol) << 0) #define CSI_CPT_CTRL_REG 0x08 diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c index 8b567d0f019b..78fa1c535ac6 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_dma.c @@ -228,7 +228,7 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count) struct sun4i_csi *csi = vb2_get_drv_priv(vq); struct v4l2_fwnode_bus_parallel *bus = &csi->bus; const struct sun4i_csi_format *csi_fmt; - unsigned long hsync_pol, pclk_pol, vsync_pol; + unsigned long href_pol, pclk_pol, vref_pol; unsigned long flags; unsigned int i; int ret; @@ -278,13 +278,21 @@ static int sun4i_csi_start_streaming(struct vb2_queue *vq, unsigned int count) writel(CSI_WIN_CTRL_H_ACTIVE(csi->fmt.height), csi->regs + CSI_WIN_CTRL_H_REG); - hsync_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH); - vsync_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH); + /* + * This hardware uses [HV]REF instead of [HV]SYNC. Based on the + * provided timing diagrams in the manual, positive polarity + * equals active high [HV]REF. + * + * When the back porch is 0, [HV]REF is more or less equivalent + * to [HV]SYNC inverted. + */ + href_pol = !!(bus->flags & V4L2_MBUS_HSYNC_ACTIVE_LOW); + vref_pol = !!(bus->flags & V4L2_MBUS_VSYNC_ACTIVE_LOW); pclk_pol = !!(bus->flags & V4L2_MBUS_PCLK_SAMPLE_RISING); writel(CSI_CFG_INPUT_FMT(csi_fmt->input) | CSI_CFG_OUTPUT_FMT(csi_fmt->output) | - CSI_CFG_VSYNC_POL(vsync_pol) | - CSI_CFG_HSYNC_POL(hsync_pol) | + CSI_CFG_VREF_POL(vref_pol) | + CSI_CFG_HREF_POL(href_pol) | CSI_CFG_PCLK_POL(pclk_pol), csi->regs + CSI_CFG_REG); From patchwork Sun Dec 15 16:59:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292911 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 5C2DC138D for ; Sun, 15 Dec 2019 16:59:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3928024671 for ; Sun, 15 Dec 2019 16:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429195; bh=2HvYCOg9JIsgIj4BOPEnWKWDtaJsP2z/GYbgmDwmqNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZvyIw2acKTeSokpOQ8vTKhnFiVhN4NVEbrjtFyplJDcDb7lydFVoJMPJvJqHDqQu7 A2DhpbdD0rJQjzO6iZC/SXa5lwmkIwlaLiqae9sWmRDxR0AGadAo+qmxSW2lYGFetC /lIywbHEB4zeOgGNp5IPDFkv7VPHwiWgflDw+HL0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726528AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 8CB9E2467D; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=2HvYCOg9JIsgIj4BOPEnWKWDtaJsP2z/GYbgmDwmqNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R27jcToGRL+lsE9KhkS+b9kJsgcMxW/mcACduEJdBkspVYezS/MfYqQLFonqqJKc+ y+aL2h9GYXGKSYag1paOupscaZJRze034RYmdZvkF/Agko/Io4jo02no3Q1TNXMWyg WHr5rxr13Afcq2OBDXZfCyAu6XmbCxcAzLB3lA2I= Received: by wens.tw (Postfix, from userid 1000) id 47DAC5FD28; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai 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> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai 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 --- .../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 #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)); From patchwork Sun Dec 15 16:59:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292905 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0496614E3 for ; Sun, 15 Dec 2019 16:59:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D67AA22B48 for ; Sun, 15 Dec 2019 16:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429184; bh=W4t5glGIuI6Mkq6Ycv2pUewGORM2wiwOFZ3bggx6jv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Hl2lEKDOwYlqPbKQV9TTZPH13UoDwmEmo1nv/T97JmzPrXCPrR7Yjq+ehXnzMFjTi rJVRePHBMhrcA+mpuJMn7J1giUAO1WPGfeIV9hxot4H3kGk5c1anPqoAqPfyjkUwC2 HImQ2hOtFudNGkwRGBojG5hk24X/K4+76tBrClEo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726769AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55258 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726603AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 A975824685; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=W4t5glGIuI6Mkq6Ycv2pUewGORM2wiwOFZ3bggx6jv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ozlf/e8Wzk5tWmx4RKgXq6/hYKVix2AD5WHE1BCYmnN0L7xv1KbSiovqupu7vTA9Z AdHtfk+uJQZUrp7+cjJyNFav5O0StMz2ErwpKIO9ViAuwaK//YBqkQWYoQvLILo1uH D65KtD7fRPVpUxaruYilRRRc1k9RdpF7M0hrKbqs= Received: by wens.tw (Postfix, from userid 1000) id 5B36B5FD9A; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 06/14] media: sun4i-csi: Add support for A10 CSI1 camera sensor interface Date: Mon, 16 Dec 2019 00:59:16 +0800 Message-Id: <20191215165924.28314-7-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The A10/A20 Allwinner SoCs have two camera sensor interface blocks, named CSI0 and CSI1. The two have the same register layouts with slightly different features: - CSI0 has an image signal processor (ISP); CSI1 doesn't - CSI0 can support up to four separate channels under CCIR656; CSI1 can only support one - CSI0 can support up to 16-bit wide bus with YUV422; CSI1 can support up to 24-bit wide bus with YUV444 For now the driver doesn't support wide busses, nor CCIR656. So the only relevant difference is whether a clock needs to be taken and enabled for the ISP. Add structs to record the differences, tie them to the compatible strings, and deal with the ISP clock. Support for the new CSI1 hardware block is added as well. Signed-off-by: Chen-Yu Tsai Acked-by: Maxime Ripard --- .../platform/sunxi/sun4i-csi/sun4i_csi.c | 35 ++++++++++++++++--- .../platform/sunxi/sun4i-csi/sun4i_csi.h | 2 ++ 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c index b8b07c1de2a8..be2466930a49 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.c @@ -29,6 +29,12 @@ #include "sun4i_csi.h" +struct sun4i_csi_traits { + unsigned int channels; + unsigned int max_width; + bool has_isp; +}; + static const struct media_entity_operations sun4i_csi_video_entity_ops = { .link_validate = v4l2_subdev_link_validate, }; @@ -156,6 +162,10 @@ static int sun4i_csi_probe(struct platform_device *pdev) subdev = &csi->subdev; vdev = &csi->vdev; + csi->traits = of_device_get_match_data(&pdev->dev); + if (!csi->traits) + return -EINVAL; + /* * On Allwinner SoCs, some high memory bandwidth devices do DMA * directly over the memory bus (called MBUS), instead of the @@ -199,10 +209,12 @@ static int sun4i_csi_probe(struct platform_device *pdev) return PTR_ERR(csi->bus_clk); } - csi->isp_clk = devm_clk_get(&pdev->dev, "isp"); - if (IS_ERR(csi->isp_clk)) { - dev_err(&pdev->dev, "Couldn't get our ISP clock\n"); - return PTR_ERR(csi->isp_clk); + if (csi->traits->has_isp) { + csi->isp_clk = devm_clk_get(&pdev->dev, "isp"); + if (IS_ERR(csi->isp_clk)) { + dev_err(&pdev->dev, "Couldn't get our ISP clock\n"); + return PTR_ERR(csi->isp_clk); + } } csi->ram_clk = devm_clk_get(&pdev->dev, "ram"); @@ -280,8 +292,21 @@ static int sun4i_csi_remove(struct platform_device *pdev) return 0; } +struct sun4i_csi_traits sun4i_a10_csi1_traits = { + .channels = 1, + .max_width = 24, + .has_isp = false, +}; + +struct sun4i_csi_traits sun7i_a20_csi0_traits = { + .channels = 4, + .max_width = 16, + .has_isp = true, +}; + static const struct of_device_id sun4i_csi_of_match[] = { - { .compatible = "allwinner,sun7i-a20-csi0" }, + { .compatible = "allwinner,sun4i-a10-csi1", .data = &sun4i_a10_csi1_traits }, + { .compatible = "allwinner,sun7i-a20-csi0", .data = &sun7i_a20_csi0_traits }, { /* Sentinel */ } }; MODULE_DEVICE_TABLE(of, sun4i_csi_of_match); diff --git a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h index 88d39b3554c4..0f67ff652c2e 100644 --- a/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h +++ b/drivers/media/platform/sunxi/sun4i-csi/sun4i_csi.h @@ -108,6 +108,8 @@ struct sun4i_csi { /* Device resources */ struct device *dev; + const struct sun4i_csi_traits *traits; + void __iomem *regs; struct clk *bus_clk; struct clk *isp_clk; From patchwork Sun Dec 15 16:59:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292913 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A803B138D for ; Sun, 15 Dec 2019 16:59:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8571F24671 for ; Sun, 15 Dec 2019 16:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429197; bh=MFr4r0CtVaXDpNF9mGw8EkkRQEEHSJia0THm3nYQ5t0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=qFYSgzpxiuJBRU3RITHsfKrMEm8qDtLYg2QDLYWrvKPVZb6Qf/Qm649D3vqduySFU kGsyBKy+he9GXsBPaTn5atlvvXzJEos9b4oXOV1FycuEpupSU1nUSUOs8/eyuaIapx +weFOa9eM89X1JSazwqVC8BHPClcqUTyUbyVzWa8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726719AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 8E4A724681; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=MFr4r0CtVaXDpNF9mGw8EkkRQEEHSJia0THm3nYQ5t0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9ZQd6ZMMz7jiffsSEXfvTw73DPNirugBVvPAUXOy/paHURs42gUWPq9YCCZTyzGE 73uNV3nPw7bbPIHMPyjst+QdtEmUD/DDNyKIglZ0HhFAMrc4/gdXRRGFY8MWK6cvtK F2H83Iyd4O2Vtcw1WBWq4dXJMVFg8Jf+MV/kpmhM= Received: by wens.tw (Postfix, from userid 1000) id 603815FD9D; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 07/14] ARM: dts: sun4i: Add CSI1 controller and pinmux options Date: Mon, 16 Dec 2019 00:59:17 +0800 Message-Id: <20191215165924.28314-8-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CSI controller driver now supports the second CSI controller, CSI1. Add a device node for it. Pinmuxing options for the MCLK output, the standard 8-bit interface, and a secondary 24-bit interface are included. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun4i-a10.dtsi | 35 ++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10.dtsi b/arch/arm/boot/dts/sun4i-a10.dtsi index 4c268b70b735..bf531efc0610 100644 --- a/arch/arm/boot/dts/sun4i-a10.dtsi +++ b/arch/arm/boot/dts/sun4i-a10.dtsi @@ -624,6 +624,16 @@ ohci1: usb@1c1c400 { status = "disabled"; }; + csi1: csi@1c1d000 { + compatible = "allwinner,sun4i-a10-csi1"; + reg = <0x01c1d000 0x1000>; + interrupts = <43>; + clocks = <&ccu CLK_AHB_CSI1>, <&ccu CLK_DRAM_CSI1>; + clock-names = "bus", "ram"; + resets = <&ccu RST_CSI1>; + status = "disabled"; + }; + spi3: spi@1c1f000 { compatible = "allwinner,sun4i-a10-spi"; reg = <0x01c1f000 0x1000>; @@ -670,6 +680,31 @@ can0_ph_pins: can0-ph-pins { function = "can"; }; + /omit-if-no-ref/ + csi1_8bits_pg_pins: csi1-8bits-pg-pins { + pins = "PG0", "PG2", "PG3", "PG4", "PG5", + "PG6", "PG7", "PG8", "PG9", "PG10", + "PG11"; + function = "csi1"; + }; + + /omit-if-no-ref/ + csi1_24bits_ph_pins: csi1-24bits-ph-pins { + pins = "PH0", "PH1", "PH2", "PH3", "PH4", + "PH5", "PH6", "PH7", "PH8", "PH9", + "PH10", "PH11", "PH12", "PH13", "PH14", + "PH15", "PH16", "PH17", "PH18", "PH19", + "PH20", "PH21", "PH22", "PH23", "PH24", + "PH25", "PH26", "PH27"; + function = "csi1"; + }; + + /omit-if-no-ref/ + csi1_clk_pg_pin: csi1-clk-pg-pin { + pins = "PG1"; + function = "csi1"; + }; + emac_pins: emac0-pins { pins = "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", From patchwork Sun Dec 15 16:59:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292917 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8D31713B6 for ; Sun, 15 Dec 2019 17:00:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6858924673 for ; Sun, 15 Dec 2019 17:00:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429202; bh=EZHv3FHkZdfny3NSAdab5tp7Y0RDcEfbHiuBOD3ZxQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=cYwqm4WxGuTkToJVfJ4HLgCMv16NTHdqgiMnqnhk/NP9rnpBD4pAY6i4jbVE2kO+v /d36+O873YlCqkLBQgp5jD+Lam+grUucC9HO8WvXQqYXxMPlTM/SRK7b7jbmTqNSTg 3FSLLTx/Z2Ntg85dPFL7zUoPVub0QXHhEeVwbZrg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726691AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55142 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 8BAFA24676; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=EZHv3FHkZdfny3NSAdab5tp7Y0RDcEfbHiuBOD3ZxQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwiYOsuzNAWmNvP5nIpflWhBotg3GwseugwEVquZTU9FO2v2x4qdUzaotd9+R8Ibn lEkoZUXeAgGIVD6zoRRX2wwffcooRSlf5d0MTvnW7qG5mCQfXs1Yeojuh4eGsbOayX SA6PinGY+41TiMJXEbnQkX01H4aGDHi35+chg2j0= Received: by wens.tw (Postfix, from userid 1000) id 6B3535FD8D; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 08/14] ARM: dts: sun7i: Add CSI1 controller and pinmux options Date: Mon, 16 Dec 2019 00:59:18 +0800 Message-Id: <20191215165924.28314-9-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CSI controller driver now supports the second CSI controller, CSI1. Add a device node for it. Pinmuxing options for the MCLK output, the standard 8-bit interface, and a secondary 24-bit interface are included. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun7i-a20.dtsi | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20.dtsi b/arch/arm/boot/dts/sun7i-a20.dtsi index 8aebefd6accf..92b5be97085d 100644 --- a/arch/arm/boot/dts/sun7i-a20.dtsi +++ b/arch/arm/boot/dts/sun7i-a20.dtsi @@ -729,6 +729,17 @@ ohci1: usb@1c1c400 { status = "disabled"; }; + csi1: csi@1c1d000 { + compatible = "allwinner,sun7i-a20-csi1", + "allwinner,sun4i-a10-csi1"; + reg = <0x01c1d000 0x1000>; + interrupts = ; + clocks = <&ccu CLK_AHB_CSI1>, <&ccu CLK_DRAM_CSI1>; + clock-names = "bus", "ram"; + resets = <&ccu RST_CSI1>; + status = "disabled"; + }; + spi3: spi@1c1f000 { compatible = "allwinner,sun4i-a10-spi"; reg = <0x01c1f000 0x1000>; @@ -802,6 +813,31 @@ csi0_clk_pin: csi-clk-pin { function = "csi0"; }; + /omit-if-no-ref/ + csi1_8bits_pg_pins: csi1-8bits-pg-pins { + pins = "PG0", "PG2", "PG3", "PG4", "PG5", + "PG6", "PG7", "PG8", "PG9", "PG10", + "PG11"; + function = "csi1"; + }; + + /omit-if-no-ref/ + csi1_24bits_ph_pins: csi1-24bits-ph-pins { + pins = "PH0", "PH1", "PH2", "PH3", "PH4", + "PH5", "PH6", "PH7", "PH8", "PH9", + "PH10", "PH11", "PH12", "PH13", "PH14", + "PH15", "PH16", "PH17", "PH18", "PH19", + "PH20", "PH21", "PH22", "PH23", "PH24", + "PH25", "PH26", "PH27"; + function = "csi1"; + }; + + /omit-if-no-ref/ + csi1_clk_pg_pin: csi1-clk-pg-pin { + pins = "PG1"; + function = "csi1"; + }; + /omit-if-no-ref/ emac_pa_pins: emac-pa-pins { pins = "PA0", "PA1", "PA2", From patchwork Sun Dec 15 16:59:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292909 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 506B1138D for ; Sun, 15 Dec 2019 16:59:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E1B924673 for ; Sun, 15 Dec 2019 16:59:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429194; bh=XJDBfT1MU52M3nXB0FIH5aEUDPdxo5W3utk1GX6ZvZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=s2xqhN2edFaNTFDTJxzyo3WhCUt5hsygtnfAyP0vxSR643gEgHeskGQToXe8Nzk9i BtwlN8nH8xndb0v+nWelGxTaE+mnRf6AoIPbJvP3MdMuLWzQz4ldTmLv/nNw2ARym/ 43ptw5IOKbXZBV455tDzOqoh/xGk3ySZln2xBMFc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726757AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:55256 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726591AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 9A99924684; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=XJDBfT1MU52M3nXB0FIH5aEUDPdxo5W3utk1GX6ZvZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2bwAHaRcZ6+BOhTn9UUxARreLZGOTNh7g0sSK1CBJt1a5N1twqKmQOEoEIYdOdmIX T+ehJNtBF6OEyeU/hozCAzX5MCYP0K91k0sruHYnMrPOKLJ1qD8OPkVQVUEWtiw9Zt yvQfaHHpwLOPsEJBmzK2iKO4LjvLNqrJ1zr2lX7c= Received: by wens.tw (Postfix, from userid 1000) id 732195FF1A; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 09/14] ARM: dts: sun8i: r40: Add I2C pinmux options Date: Mon, 16 Dec 2019 00:59:19 +0800 Message-Id: <20191215165924.28314-10-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The R40 has five I2C controllers. Currently only I2C0 has its pinmux option defined. Add the options for the remaining four, and set them as the default, since each controller has only one possible pinmux configuration. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-r40.dtsi | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 421dfbbfd7ee..82ea0b5b0710 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -373,6 +373,26 @@ i2c0_pins: i2c0-pins { function = "i2c0"; }; + i2c1_pins: i2c1-pins { + pins = "PB18", "PB19"; + function = "i2c1"; + }; + + i2c2_pins: i2c2-pins { + pins = "PB20", "PB21"; + function = "i2c2"; + }; + + i2c3_pins: i2c3-pins { + pins = "PI0", "PI1"; + function = "i2c3"; + }; + + i2c4_pins: i2c4-pins { + pins = "PI2", "PI3"; + function = "i2c4"; + }; + mmc0_pins: mmc0-pins { pins = "PF0", "PF1", "PF2", "PF3", "PF4", "PF5"; @@ -528,6 +548,8 @@ i2c1: i2c@1c2b000 { interrupts = ; clocks = <&ccu CLK_BUS_I2C1>; resets = <&ccu RST_BUS_I2C1>; + pinctrl-0 = <&i2c1_pins>; + pinctrl-names = "default"; status = "disabled"; #address-cells = <1>; #size-cells = <0>; @@ -539,6 +561,8 @@ i2c2: i2c@1c2b400 { interrupts = ; clocks = <&ccu CLK_BUS_I2C2>; resets = <&ccu RST_BUS_I2C2>; + pinctrl-0 = <&i2c2_pins>; + pinctrl-names = "default"; status = "disabled"; #address-cells = <1>; #size-cells = <0>; @@ -550,6 +574,8 @@ i2c3: i2c@1c2b800 { interrupts = ; clocks = <&ccu CLK_BUS_I2C3>; resets = <&ccu RST_BUS_I2C3>; + pinctrl-0 = <&i2c3_pins>; + pinctrl-names = "default"; status = "disabled"; #address-cells = <1>; #size-cells = <0>; @@ -561,6 +587,8 @@ i2c4: i2c@1c2c000 { interrupts = ; clocks = <&ccu CLK_BUS_I2C4>; resets = <&ccu RST_BUS_I2C4>; + pinctrl-0 = <&i2c4_pins>; + pinctrl-names = "default"; status = "disabled"; #address-cells = <1>; #size-cells = <0>; From patchwork Sun Dec 15 16:59:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292925 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D9E0013B6 for ; Sun, 15 Dec 2019 17:00:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE2E724673 for ; Sun, 15 Dec 2019 17:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429214; bh=8CLQxknPeOFqXl41pV/zS4RQXl281ma26CPeXsgnCkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=dJfTBp88KuWd0xHW1ZwE8ATGgUMGb8CfEBdLg6tZW/LaZ9vOBKAGK0pUwR3iUhy84 xzzvfoOx4IXMxtYEcWLl6fGTA04gQTZo+Iwp6NjdAH2ZuqqELKUdi8Z+4VYlNpOveh KqZRG8aoq7KoT/urCPqOtyqzLImjM2vWj31ANqhY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbfLORAE (ORCPT ); Sun, 15 Dec 2019 12:00:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:55254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 94BFE24683; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=8CLQxknPeOFqXl41pV/zS4RQXl281ma26CPeXsgnCkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sh/yRkOaLi7Hl99lWQWsLX+sVerx9QiKoDpuTqPft6SXGg0dwfU1RFkzpWP4KPuM0 AtlsLE75cQSx0FxaqPQ9mmLWbrMTLftYtacDqN2hP2I5BxPnG3ssgHirxnLa7gIMMT vqJAg6m5IljnasaSLQLXUGzrM9vSadZz+EFxb/2U= Received: by wens.tw (Postfix, from userid 1000) id 7BEFF5FEF8; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 10/14] dt-bindings: bus: sunxi: Add R40 MBUS compatible Date: Mon, 16 Dec 2019 00:59:20 +0800 Message-Id: <20191215165924.28314-11-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai Allwinner R40 SoC also contains MBUS controller. Add compatible for it. Signed-off-by: Chen-Yu Tsai Acked-by: Rob Herring --- Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt b/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt index 2005bb486705..1d725fa03706 100644 --- a/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt +++ b/Documentation/devicetree/bindings/arm/sunxi/sunxi-mbus.txt @@ -9,6 +9,7 @@ Required properties: - compatible: Must be one of: - allwinner,sun5i-a13-mbus - allwinner,sun8i-h3-mbus + - allwinner,sun8i-r40-mbus - reg: Offset and length of the register set for the controller - clocks: phandle to the clock driving the controller - dma-ranges: See section 2.3.9 of the DeviceTree Specification From patchwork Sun Dec 15 16:59:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292927 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0878E13B6 for ; Sun, 15 Dec 2019 17:00:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DB2E02467D for ; Sun, 15 Dec 2019 17:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429215; bh=p2Yk04lSXEPWoex3Y1O8riiRlK5G3iH1Tys7J7+B3o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=BsNU8szSGufBUl5UovELRjKOe1vW6CQLLCY8GcnwAgBE1sS+mSmr6J/oFs2zzawWt ZPtWHu9PvdDztjD0TPOE3IAh+lDHDXE+deBTD6Fxx5vh5vbZcwqN6xb0M5Lh6rbk+E C6D856pzeq74bGMabKnwMMu5qX5u4ben8dvzAdy0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726944AbfLORAE (ORCPT ); Sun, 15 Dec 2019 12:00:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:55158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726540AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 9114D24682; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=p2Yk04lSXEPWoex3Y1O8riiRlK5G3iH1Tys7J7+B3o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUPNYD1OWdsrcYwcbkmcQkooPutjW5PbLh2mVYdomXCucnPWv3+MNCkcBv/slwdR+ xd06MXKjknUg224R+4jO5D97MX/f7tw07Mst6kGuUBCIHJbaSoRAt8vLNj+iECTyyX jSrik9KNfNdc16z8O53hBYQX22RjcQafO4lVD0fs= Received: by wens.tw (Postfix, from userid 1000) id 7FE985FF5A; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 11/14] ARM: dts: sun8i: r40: Add device node for CSI0 Date: Mon, 16 Dec 2019 00:59:21 +0800 Message-Id: <20191215165924.28314-12-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The CSI0 and CSI1 blocks are the same as found on the A20. However only CSI0 is supported upstream right now. Add a device node for CSI0 using the A20 compatible as a fallback, and the standard pinctrl options. Also add the MBUS interconnect. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun8i-r40.dtsi | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40.dtsi b/arch/arm/boot/dts/sun8i-r40.dtsi index 82ea0b5b0710..2d1e97cc4155 100644 --- a/arch/arm/boot/dts/sun8i-r40.dtsi +++ b/arch/arm/boot/dts/sun8i-r40.dtsi @@ -180,6 +180,20 @@ nmi_intc: interrupt-controller@1c00030 { interrupts = ; }; + csi0: csi@1c09000 { + compatible = "allwinner,sun8i-r40-csi0", + "allwinner,sun7i-a20-csi0"; + reg = <0x01c09000 0x1000>; + interrupts = ; + clocks = <&ccu CLK_BUS_CSI0>, <&ccu CLK_CSI_SCLK>, + <&ccu CLK_DRAM_CSI0>; + clock-names = "bus", "isp", "ram"; + resets = <&ccu RST_BUS_CSI0>; + interconnects = <&mbus 5>; + interconnect-names = "dma-mem"; + status = "disabled"; + }; + mmc0: mmc@1c0f000 { compatible = "allwinner,sun8i-r40-mmc", "allwinner,sun50i-a64-mmc"; @@ -355,6 +369,20 @@ clk_out_a_pin: clk-out-a-pin { function = "clk_out_a"; }; + /omit-if-no-ref/ + csi0_8bits_pins: csi0-8bits-pins { + pins = "PE0", "PE2", "PE3", "PE4", "PE5", + "PE6", "PE7", "PE8", "PE9", "PE10", + "PE11"; + function = "csi0"; + }; + + /omit-if-no-ref/ + csi0_mclk_pin: csi0-mclk-pin { + pins = "PE1"; + function = "csi0"; + }; + gmac_rgmii_pins: gmac-rgmii-pins { pins = "PA0", "PA1", "PA2", "PA3", "PA4", "PA5", "PA6", "PA7", @@ -624,6 +652,14 @@ gmac_mdio: mdio { }; }; + mbus: dram-controller@1c62000 { + compatible = "allwinner,sun8i-r40-mbus"; + reg = <0x01c62000 0x1000>; + clocks = <&ccu 155>; + dma-ranges = <0x00000000 0x40000000 0x80000000>; + #interconnect-cells = <1>; + }; + tcon_top: tcon-top@1c70000 { compatible = "allwinner,sun8i-r40-tcon-top"; reg = <0x01c70000 0x1000>; From patchwork Sun Dec 15 16:59:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292919 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF6FC13B6 for ; Sun, 15 Dec 2019 17:00:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE9B32467B for ; Sun, 15 Dec 2019 17:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429203; bh=h33d693tSXLso9w3yXgPuTbnms8ia3M5JIWMSCbNBnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=nigLNUdh/27stKBCejUbg/N7eiO7hjsGwXfCAupHTj9+SHcGwgwd2/zZsdhfHO7Qw ractdWIvv3hZauN4y+VUq1fUl++9esiebUJHSaF6xVqLdNwtVwPMgmglBmfHqxlbTJ kJlyMJvvRg3LxVl1NGKLdJNHfxIQWOfeNV3uGKpc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726671AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726536AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 8C57424679; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429171; bh=h33d693tSXLso9w3yXgPuTbnms8ia3M5JIWMSCbNBnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iRsFDfp5dTCdd8hdfb7DRsrAhuVj+MbDM6yDZ4TkQLjmR183GI2NhsimxlOkuld0l lH0YUZBtbTWtQ5bFj6cEr5Is0L7icYgGC3qZiFbLKecUsQht57C6WsG6Dm1djuqBA1 ry+oYgAq/HPx0ms2JPnZEBar9La4Kb4P63emA+ig= Received: by wens.tw (Postfix, from userid 1000) id 84BFD5FF75; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 12/14] [DO NOT MERGE] ARM: dts: sun4i: cubieboard: Enable OV7670 camera on CSI1 Date: Mon, 16 Dec 2019 00:59:22 +0800 Message-Id: <20191215165924.28314-13-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The Cubieboard has CSI1 pins exposed on one of its GPIO headers. Combined with I2C1 on the same header, a connected OV7670 based camera module can be used. Power is provided via the 5V rail on the same header. The module has onboard LDOs for the sensor's various power rails. Add a device node for the sensor, enable CSI1 and I2C1, and hook everything up. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun4i-a10-cubieboard.dts | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts index 6ca02e824acc..29bfec8fad5b 100644 --- a/arch/arm/boot/dts/sun4i-a10-cubieboard.dts +++ b/arch/arm/boot/dts/sun4i-a10-cubieboard.dts @@ -101,6 +101,25 @@ &cpu0 { cpu-supply = <®_dcdc2>; }; +&csi1 { + pinctrl-names = "default"; + pinctrl-0 = <&csi1_8bits_pg_pins>; + status = "okay"; + + port { + /* Parallel bus endpoint */ + csi_from_ov7670: endpoint { + remote-endpoint = <&ov7670_to_csi>; + bus-width = <8>; + /* driver is broken */ + hsync-active = <0>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; +}; + &de { status = "okay"; }; @@ -143,6 +162,29 @@ axp209: pmic@34 { &i2c1 { status = "okay"; + + ov7670: camera@21 { + compatible = "ovti,ov7670"; + reg = <0x21>; + pinctrl-names = "default"; + pinctrl-0 = <&csi1_clk_pg_pin>; + clocks = <&ccu CLK_CSI1>; + clock-names = "xclk"; + + reset-gpios = <&pio 7 14 GPIO_ACTIVE_LOW>; /* PH14 */ + powerdown-gpios = <&pio 7 15 GPIO_ACTIVE_HIGH>; /* PH15 */ + + port { + ov7670_to_csi: endpoint { + remote-endpoint = <&csi_from_ov7670>; + bus-width = <8>; + hsync-active = <1>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; + }; }; &ir0 { From patchwork Sun Dec 15 16:59:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292921 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D69EA14E3 for ; Sun, 15 Dec 2019 17:00:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B535124679 for ; Sun, 15 Dec 2019 17:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429205; bh=54k6tl/u+QN8VRT7KToMNhJCWuLH8xcLwdQidKHpf5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Igx/SkDtBYHVTo444ioivqZkJuntkLlgSVKG0xN4tKYJhxkM2nhBFq48yjSmPNnaf YE0MPxjqsTMiPhr3kd20Q7hdz3tUKe9YwhLCw3BkbAJGK6Hl5lWMEc2ujSFGCRL3MC U81BABkhqXOZRnk3I/KXGiFo4yuVMS5+nZCelhKo= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726971AbfLORAE (ORCPT ); Sun, 15 Dec 2019 12:00:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:55260 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726620AbfLOQ7c (ORCPT ); Sun, 15 Dec 2019 11:59:32 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 CE86424698; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429172; bh=54k6tl/u+QN8VRT7KToMNhJCWuLH8xcLwdQidKHpf5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yJz3Qqq0Q0L+/eAbbBSro1dsvZOsx30HJMSOdbCZgixRkCAA1aW+GvmImMQAkNME6 v7HDFCqqnW1x1tBZ2mIzzClD/ylIks9DAcDijQO+qJjLJfCv2ibQ0+JH2L/PwdBz/x Hcobms1QGKlvXiZ1HZgf24G0yPx9umflyAGW5WsI= Received: by wens.tw (Postfix, from userid 1000) id 918F95FFE9; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 13/14] [DO NOT MERGE] ARM: dts: sun7i: cubieboard2: Enable OV7670 camera on CSI1 Date: Mon, 16 Dec 2019 00:59:23 +0800 Message-Id: <20191215165924.28314-14-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai The Cubieboard2 has CSI1 pins exposed on one of its GPIO headers. Combined with I2C1 on the same header, a connected OV7670 based camera module can be used. Power is provided via the 5V rail on the same header. The module has onboard LDOs for the sensor's various power rails. Add a device node for the sensor, enable CSI1 and I2C1, and hook everything up. Signed-off-by: Chen-Yu Tsai --- arch/arm/boot/dts/sun7i-a20-cubieboard2.dts | 42 +++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts index b8203e4ef21c..0ff1593041eb 100644 --- a/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts +++ b/arch/arm/boot/dts/sun7i-a20-cubieboard2.dts @@ -100,6 +100,25 @@ &cpu0 { cpu-supply = <®_dcdc2>; }; +&csi1 { + pinctrl-names = "default"; + pinctrl-0 = <&csi1_8bits_pg_pins>; + status = "okay"; + + port { + /* Parallel bus endpoint */ + csi_from_ov7670: endpoint { + remote-endpoint = <&ov7670_to_csi>; + bus-width = <8>; + /* driver is broken */ + hsync-active = <0>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; +}; + &de { status = "okay"; }; @@ -142,6 +161,29 @@ axp209: pmic@34 { &i2c1 { status = "okay"; + + ov7670: camera@21 { + compatible = "ovti,ov7670"; + reg = <0x21>; + pinctrl-names = "default"; + pinctrl-0 = <&csi1_clk_pg_pin>; + clocks = <&ccu CLK_CSI1>; + clock-names = "xclk"; + + reset-gpios = <&pio 7 14 GPIO_ACTIVE_LOW>; /* PH14 */ + powerdown-gpios = <&pio 7 15 GPIO_ACTIVE_HIGH>; /* PH15 */ + + port { + ov7670_to_csi: endpoint { + remote-endpoint = <&csi_from_ov7670>; + bus-width = <8>; + hsync-active = <1>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; + }; }; &ir0 { From patchwork Sun Dec 15 16:59:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 11292915 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8C66014E3 for ; Sun, 15 Dec 2019 16:59:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A45324671 for ; Sun, 15 Dec 2019 16:59:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429198; bh=m5GPdarvxrtjsXfbUyU7e3PQz2NgpIQ560CvjxxvtEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sAocgfjrsSPDdWTj8x/UaLgmmUWwXcgGuOfMXZuGX35oZuVLe9dBDFaYj6UbPXOqT r/xWO3nUQyP5mcuCW4UPDVw2dVYDoWvufrxRAY919UVb5T0oeIE/48Y5wkhwPRQwgA /Z0NqbyijDOELspJ1tTE6Al+yXmU/EZrF4ZKUHVU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726911AbfLOQ75 (ORCPT ); Sun, 15 Dec 2019 11:59:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:55262 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726637AbfLOQ7d (ORCPT ); Sun, 15 Dec 2019 11:59:33 -0500 Received: from wens.tw (mirror2.csie.ntu.edu.tw [140.112.30.76]) (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 F1ED7246AB; Sun, 15 Dec 2019 16:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576429172; bh=m5GPdarvxrtjsXfbUyU7e3PQz2NgpIQ560CvjxxvtEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FBfdymPna5qbjaty8485LW2z9uHzMwnu9A50cgCugkkgPnwnqZTuZLMAYFFazwb/I 6/9hHMyxaSzhVCW39FqIabcI7XDijrgIRkhsX4LeJbTTpbPg5besqa6/Z3usQkY3dt dmFnfm2RRY+ciO+eprRDIY71e2cqzuzS1e3gI9MM= Received: by wens.tw (Postfix, from userid 1000) id 97FC35FF78; Mon, 16 Dec 2019 00:59:26 +0800 (CST) From: Chen-Yu Tsai To: Maxime Ripard , Mauro Carvalho Chehab , Sakari Ailus , Rob Herring , Mark Rutland Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Chen-Yu Tsai Subject: [PATCH 14/14] [DO NOT MERGE] ARM: dts: sun8i-r40: bananapi-m2-ultra: Enable OV5640 camera Date: Mon, 16 Dec 2019 00:59:24 +0800 Message-Id: <20191215165924.28314-15-wens@kernel.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191215165924.28314-1-wens@kernel.org> References: <20191215165924.28314-1-wens@kernel.org> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Chen-Yu Tsai Bananapi offers a small OV5640 based camera module, attached via an FPC connector. Add the related regulator constraints, and hook everything up. Signed-off-by: Chen-Yu Tsai --- .../boot/dts/sun8i-r40-bananapi-m2-ultra.dts | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts index 42d62d1ba1dc..86183d40c7af 100644 --- a/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts +++ b/arch/arm/boot/dts/sun8i-r40-bananapi-m2-ultra.dts @@ -113,6 +113,24 @@ &ahci { status = "okay"; }; +&csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&csi0_8bits_pins>; + status = "okay"; + + port { + /* Parallel bus endpoint */ + csi0_from_ov5640: endpoint { + remote-endpoint = <&ov5640_to_csi0>; + bus-width = <8>; + hsync-active = <1>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; +}; + &de { status = "okay"; }; @@ -164,6 +182,37 @@ axp22x: pmic@34 { #include "axp22x.dtsi" +&i2c4 { + status = "okay"; + + ov5640: camera@3c { + compatible = "ovti,ov5640"; + reg = <0x3c>; + pinctrl-names = "default"; + pinctrl-0 = <&csi0_mclk_pin>; + clocks = <&ccu CLK_CSI0_MCLK>; + clock-names = "xclk"; + + reset-gpios = <&pio 8 7 GPIO_ACTIVE_LOW>; /* PI7 */ + powerdown-gpios = <&pio 8 6 GPIO_ACTIVE_HIGH>; /* PI6 */ + AVDD-supply = <®_aldo1>; + DOVDD-supply = <®_eldo1>; + DVDD-supply = <®_eldo2>; + + port { + ov5640_to_csi0: endpoint { + remote-endpoint = <&csi0_from_ov5640>; + bus-width = <8>; + data-shift = <2>; + hsync-active = <1>; /* Active high */ + vsync-active = <1>; /* Active high */ + data-active = <1>; /* Active high */ + pclk-sample = <1>; /* Rising */ + }; + }; + }; +}; + &mmc0 { vmmc-supply = <®_dcdc1>; bus-width = <4>; @@ -209,6 +258,12 @@ &pio { vcc-pg-supply = <®_dldo1>; }; +®_aldo1 { + regulator-name = "csi-avdd"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; +}; + ®_aldo2 { regulator-min-microvolt = <2500000>; regulator-max-microvolt = <2500000>; @@ -289,6 +344,18 @@ ®_dldo4 { regulator-name = "vdd2v5-sata"; }; +®_eldo1 { + regulator-name = "csi-iovcc"; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; +}; + +®_eldo2 { + regulator-name = "csi-dvdd"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <1500000>; +}; + ®_eldo3 { regulator-min-microvolt = <1200000>; regulator-max-microvolt = <1200000>;