From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC126C433F5 for ; Thu, 18 Nov 2021 09:02:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A9BCA61AA7 for ; Thu, 18 Nov 2021 09:02:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A9BCA61AA7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:References:To:From:Subject: Cc:Message-Id:Date:Mime-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cXppaPaAJv6kmIukxzNbS6rXEHFKt1CenUNQDmm1lXc=; b=zeE+M8/9EEy+Q+ ud0xP/k0bo4pkFR3eEZIu2pHtXHF5TDvyc0r6Eqpce6jFnIojj9JjZ7Phx33l1tIXq3GaUVpWhMGy cg99DCGeGtmvzo2gsCCwS65T0t7CyaALKcrQUK32okPQnG5X3tMOyG/AoflIePUSfUOkFPkUTEAuN 12IiD7D9YWoVlRmY6WwuNsv7MYXoTIGH1b9tUCW8+WR4Y3DCLOHV2y644p53DW03Te0RmQx9zfQjQ LnrQgDbQWF8aq2z+Gjzy/9JBU+toaMBBasZk1UC7jp9DOwU1HXy6KCgYWYlemJlGBmcBCPCrFoR95 VT8PF8n2+h/RlklE9ZLg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mndI4-007Gfo-BY; Thu, 18 Nov 2021 09:01:08 +0000 Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mndI0-007GfB-Mn for linux-arm-kernel@lists.infradead.org; Thu, 18 Nov 2021 09:01:06 +0000 Received: by mail-wr1-x432.google.com with SMTP id c4so10060052wrd.9 for ; Thu, 18 Nov 2021 01:01:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:content-transfer-encoding:date:message-id:cc:subject :from:to:references:in-reply-to; bh=HoB8UigyPFgMPV3vxuTV7Mz+M/fc/B322pVo6Nb1Z/M=; b=Tkp+Hyi8/PwTDgDCb8mHGZWCuQFfKMxxxMOdGnnXMwFJkVRW9gr+p6nBSd1JUfT7v2 rGwxVTuCK59egHqpvNsqMiDQx6E9mtsQDzJzie9CSTfiPdT8BXQkAiukKa5evJvsThec qPFP3hI5LrpfL3yhpBTacL39PriVqBQQJjTJk1CFOv/L1Jk5iU96Fy+U9pqPwLxAbagN oY/hap7xdWyAxspz+v6yobF0eGU0547G9HpfzDFmhEUVszGR6X1YOF3J+RzTOhcIXhrs Uy8P8wlEsGM8vsULmfSwVe3lqpxQNl+NJtDBeOQMjDrZx/pzJAUO5MGwfIUfTaHZNP9m j/WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:content-transfer-encoding:date :message-id:cc:subject:from:to:references:in-reply-to; bh=HoB8UigyPFgMPV3vxuTV7Mz+M/fc/B322pVo6Nb1Z/M=; b=LUKt4z+R94I5def3XgYVq1rNbjWFepAUf9r8beoheIfq/lb0j+zDz4SiDu1ESLFKxv HUlRSG6quPCKPSKoEk801e1Va/exKk5Cv/MOsWCJMNb3KsRzbixFTz0ZtGk38W9qdrOh FFBxjsb57inA3dBhOg3ydIjh9pg5nj0fOW6FWUsEvB6q9WAGwwRnDfo6hQ1lsEdIiDKl UPHrodZdZe+FqEDS7gY7J1pDGdZ4UguP4AuWJbpH+ZLZzArJoRclqAeDnBhYVLyN1Ajl qbNokYYhKxSBUDDBx14y/TEeDL1Eed7rZclMMCJD8YcBtXF+XoKUSTHBVAiZExn9JpfP bpEg== X-Gm-Message-State: AOAM5327x6IfI3t8JecvZpBPRPxLxehZiC9/avrOJUEeXradw3jwQQYo PKV1enrrcx/B3j4aiCzTcIo= X-Google-Smtp-Source: ABdhPJxpXMQii2ux6+hCaETePd4TfBQSSFXNgyFjTdkHDPE54QnR1Eaeb78OxXTzBwpPO7Gb6joitQ== X-Received: by 2002:adf:9bdb:: with SMTP id e27mr29564347wrc.417.1637226063168; Thu, 18 Nov 2021 01:01:03 -0800 (PST) Received: from localhost (a109-49-33-111.cpe.netcabo.pt. [109.49.33.111]) by smtp.gmail.com with ESMTPSA id l7sm3029048wry.86.2021.11.18.01.01.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Nov 2021 01:01:02 -0800 (PST) Mime-Version: 1.0 Date: Thu, 18 Nov 2021 09:01:01 +0000 Message-Id: Cc: , , , , , , , , Subject: Re: [PATCH v2 1/2] media: imx: imx7-media-csi: add support for imx8mq From: "Rui Miguel Silva" To: "Martin Kepplinger" , , References: <20211118063347.3370678-1-martin.kepplinger@puri.sm> In-Reply-To: <20211118063347.3370678-1-martin.kepplinger@puri.sm> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211118_010104_772909_F8F53653 X-CRM114-Status: GOOD ( 24.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Martin, Thanks for this version. On Thu Nov 18, 2021 at 6:33 AM WET, Martin Kepplinger wrote: > Modeled after the NXP driver mx6s_capture.c that this driver is based on, > imx8mq needs different settings for the baseaddr_switch mechanism. Define > the needed bits and set that for imx8mq. > > Without these settings, the system will "sometimes" hang completely when > starting to stream (the interrupt will never be called). > > Signed-off-by: Martin Kepplinger LGTM Acked-by: Rui Miguel Silva ------ Cheers, Rui > --- > > revision history > ---------------- > v2: (thank you Rui and Laurent) > * rename function and enum > * remove unrealted newline > * add Laurents reviewed tag to the bindings patch > > v1: > https://lore.kernel.org/linux-media/20211117092710.3084034-1-martin.kepplinger@puri.sm/T/#t > > > > drivers/staging/media/imx/imx7-media-csi.c | 32 ++++++++++++++++++++-- > 1 file changed, 30 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c > index 2288dadb2683..1f3d9e27270d 100644 > --- a/drivers/staging/media/imx/imx7-media-csi.c > +++ b/drivers/staging/media/imx/imx7-media-csi.c > @@ -12,6 +12,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -122,6 +123,10 @@ > #define BIT_DATA_FROM_MIPI BIT(22) > #define BIT_MIPI_YU_SWAP BIT(21) > #define BIT_MIPI_DOUBLE_CMPNT BIT(20) > +#define BIT_MASK_OPTION_FIRST_FRAME (0 << 18) > +#define BIT_MASK_OPTION_CSI_EN (1 << 18) > +#define BIT_MASK_OPTION_SECOND_FRAME (2 << 18) > +#define BIT_MASK_OPTION_ON_DATA (3 << 18) > #define BIT_BASEADDR_CHG_ERR_EN BIT(9) > #define BIT_BASEADDR_SWITCH_SEL BIT(5) > #define BIT_BASEADDR_SWITCH_EN BIT(4) > @@ -154,6 +159,11 @@ > #define CSI_CSICR18 0x48 > #define CSI_CSICR19 0x4c > > +enum imx_csi_model { > + IMX7_CSI_IMX7 = 0, > + IMX7_CSI_IMX8MQ, > +}; > + > struct imx7_csi { > struct device *dev; > struct v4l2_subdev sd; > @@ -189,6 +199,8 @@ struct imx7_csi { > bool is_csi2; > > struct completion last_eof_completion; > + > + enum imx_csi_model model; > }; > > static struct imx7_csi * > @@ -537,6 +549,16 @@ static void imx7_csi_deinit(struct imx7_csi *csi, > clk_disable_unprepare(csi->mclk); > } > > +static void imx7_csi_baseaddr_switch_on_second_frame(struct imx7_csi *csi) > +{ > + u32 cr18 = imx7_csi_reg_read(csi, CSI_CSICR18); > + > + cr18 |= BIT_BASEADDR_SWITCH_EN | BIT_BASEADDR_SWITCH_SEL | > + BIT_BASEADDR_CHG_ERR_EN; > + cr18 |= BIT_MASK_OPTION_SECOND_FRAME; > + imx7_csi_reg_write(csi, cr18, CSI_CSICR18); > +} > + > static void imx7_csi_enable(struct imx7_csi *csi) > { > /* Clear the Rx FIFO and reflash the DMA controller. */ > @@ -552,6 +574,9 @@ static void imx7_csi_enable(struct imx7_csi *csi) > /* Enable the RxFIFO DMA and the CSI. */ > imx7_csi_dmareq_rff_enable(csi); > imx7_csi_hw_enable(csi); > + > + if (csi->model == IMX7_CSI_IMX8MQ) > + imx7_csi_baseaddr_switch_on_second_frame(csi); > } > > static void imx7_csi_disable(struct imx7_csi *csi) > @@ -1155,6 +1180,8 @@ static int imx7_csi_probe(struct platform_device *pdev) > if (IS_ERR(csi->regbase)) > return PTR_ERR(csi->regbase); > > + csi->model = (enum imx_csi_model)of_device_get_match_data(&pdev->dev); > + > spin_lock_init(&csi->irqlock); > mutex_init(&csi->lock); > > @@ -1249,8 +1276,9 @@ static int imx7_csi_remove(struct platform_device *pdev) > } > > static const struct of_device_id imx7_csi_of_match[] = { > - { .compatible = "fsl,imx7-csi" }, > - { .compatible = "fsl,imx6ul-csi" }, > + { .compatible = "fsl,imx8mq-csi", .data = (void *)IMX7_CSI_IMX8MQ }, > + { .compatible = "fsl,imx7-csi", .data = (void *)IMX7_CSI_IMX7 }, > + { .compatible = "fsl,imx6ul-csi", .data = (void *)IMX7_CSI_IMX7 }, > { }, > }; > MODULE_DEVICE_TABLE(of, imx7_csi_of_match); > -- > 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel