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 85A07C433EF for ; Wed, 17 Nov 2021 14:56:22 +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 5074F61B29 for ; Wed, 17 Nov 2021 14:56:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 5074F61B29 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=/QtDZTLnBD4LMN2gV27YmWQOEnK+4yrZmxf+DQSd0n8=; b=qiQdFktgxebLbQ r1YcpG99t39fifMd84BjfPxubZhuCF9R643nu05ufeCIXNGuBw8fYZo1TxMDG774Bqbw69ex++TFw kqEwL+q1XLhgCoCZPOLHr3DdKSk8yw4XcEWOXRDG//8CMD/zYmqk/c5T7voE+0Wr44GROJXD2YqtY twdncZwvTFxu33n47sEiLz1afXphXNfBq+aHow9/7ZBX76s4nB0QoqcbXfSlSsY9049p+sCo6llhi +xS9xBMzIPuLnl4xrlg1OVZWGGFKT7uPEumohyYf10qwa4XweyunjD6bBLo+iSHFiu7PcVRUFcFe0 Bui1afUs8gvCKF5aNX7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnMKj-005FaG-BB; Wed, 17 Nov 2021 14:54:45 +0000 Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mnMHy-005EQX-QC for linux-arm-kernel@lists.infradead.org; Wed, 17 Nov 2021 14:51:56 +0000 Received: by mail-wm1-x335.google.com with SMTP id i8-20020a7bc948000000b0030db7b70b6bso5035887wml.1 for ; Wed, 17 Nov 2021 06:51:52 -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=jJ51ZlH+2lE8rLSSFCiYjXjBtLDKQFWHhyS+Y+x5rso=; b=EJFSm/6QhkB5EwLlV7ulH4Kv0lZPoeIvlf0+dl+5Jp+1HqbXIpUP5HhYNmgBJTDzO1 Ru88IiQiRV4eAqbzcsN0QPoiohfoPuCd+Pn567jxPVnPEzOtHeiyILKzTlbP01ReR2Uc bp/vHtQd5g7rNOpIDNE9T5x+2qx4sfmOOzndY6n9YRO0tU0PNAbS5F1DegSTiz9aoB1r m2hgskZZ6+ErJq7hzDY7vX20m5q5Fhh90CVb6Elal0oGxqSLQkkgUWQ+9RQki3zdt7E/ lzh4nddM7Ai4INJscIUq1q58SIDV4qIm3cEqTJ4aSzavScQ68dDinTTimRTZQPhmVLw/ uvtA== 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=jJ51ZlH+2lE8rLSSFCiYjXjBtLDKQFWHhyS+Y+x5rso=; b=F0RXpfeUiiLBkoDRMJ9QV3Hk9hl1fr0pY4Ra456IUl/EYT3bs3kOR7S9w7RFxINKzE O0MyTDw6PFBFEo0RQdRoAaAm6Gat0I9nfBer2+2wK67TvowTFyt4ZsjnwDUdYvX/ImXT Mx8TyiF/S/glHmTpKSJe9/NZOy9Vxx6dklKzdFKpsp1S7fZuc2NQkix7cRhUkBnCcvRM lXvgHtlyKHu9ExtsZeRio8DI/fwZlxiLbh9g/gDi4TznfpzNXXmphkpLm8D/qbvDm7zQ 0y7MIxBdTknGbSNdRWrozk1STFQVJVyy6xBaIvQGEDVebFVJqxnWAEaBrZcVpPSjpsaa 2ttA== X-Gm-Message-State: AOAM530if1X0EzUxPig89GmI24mPsdwokW0cc4YI8/3C/uZ1sWdWaU7X /J1dd+vApqQ9iX0mzBCGl8c= X-Google-Smtp-Source: ABdhPJzHtEsTAdKaqa4gQxikWsbXFcywF/SZtl1a+gJCxhuR5b8+1mx7mQYYZoC5FJl1qFAIBeS3iQ== X-Received: by 2002:a05:600c:21d6:: with SMTP id x22mr265604wmj.194.1637160711086; Wed, 17 Nov 2021 06:51:51 -0800 (PST) Received: from localhost (a109-49-33-111.cpe.netcabo.pt. [109.49.33.111]) by smtp.gmail.com with ESMTPSA id m34sm6599446wms.25.2021.11.17.06.51.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Nov 2021 06:51:50 -0800 (PST) Mime-Version: 1.0 Date: Wed, 17 Nov 2021 14:51:48 +0000 Message-Id: Cc: , , , , , , Subject: Re: [PATCH 1/2] media: imx: imx7-media-csi: add support for imx8mq From: "Rui Miguel Silva" To: "Martin Kepplinger" , , , , References: <20211117092710.3084034-1-martin.kepplinger@puri.sm> In-Reply-To: <20211117092710.3084034-1-martin.kepplinger@puri.sm> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211117_065154_883081_8447D4D0 X-CRM114-Status: GOOD ( 27.99 ) 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 the patch. On Wed Nov 17, 2021 at 9:27 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 > --- > drivers/staging/media/imx/imx7-media-csi.c | 34 ++++++++++++++++++++-- > 1 file changed, 32 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..8619cf2fc694 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,12 @@ > #define CSI_CSICR18 0x48 > #define CSI_CSICR19 0x4c > > +enum imx_soc { > + IMX6UL = 0, > + IMX7, > + IMX8MQ, maybe instead of this enum we could use a bool in structure... > >+}; > + > struct imx7_csi { > struct device *dev; > struct v4l2_subdev sd; > @@ -189,6 +200,8 @@ struct imx7_csi { > bool is_csi2; > > struct completion last_eof_completion; > + > + enum imx_soc type; here, bool is_imx8mq? > }; > > static struct imx7_csi * > @@ -537,6 +550,16 @@ static void imx7_csi_deinit(struct imx7_csi *csi, > clk_disable_unprepare(csi->mclk); > } > > +static void imx8mq_baseaddr_switch(struct imx7_csi *csi) I think this function needs a better name. First add the imx7_csi prefix that all functions have, and also you are setting it specific to second frame and the function should not be specific to imx8. maybe something: imx7_csi_write_on_second_frame_enable, maybe? > +{ > + 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. */ > @@ -551,7 +574,11 @@ static void imx7_csi_enable(struct imx7_csi *csi) > > /* Enable the RxFIFO DMA and the CSI. */ > imx7_csi_dmareq_rff_enable(csi); > + unrelated new line. > imx7_csi_hw_enable(csi); > + > + if (csi->type == IMX8MQ) > + imx8mq_baseaddr_switch(csi); change this to new types and names? > } > > static void imx7_csi_disable(struct imx7_csi *csi) > @@ -1155,6 +1182,8 @@ static int imx7_csi_probe(struct platform_device *pdev) > if (IS_ERR(csi->regbase)) > return PTR_ERR(csi->regbase); > > + csi->type = (enum imx_soc)of_device_get_match_data(&pdev->dev); here something: csi->is_imx8mq = of_device_is_compatible(np, "fsl,imx8mq-csi"); > + > spin_lock_init(&csi->irqlock); > mutex_init(&csi->lock); > > @@ -1249,8 +1278,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 *)IMX8MQ }, and with the above you should not need to add the data field here. ------ Cheers, Rui > + { .compatible = "fsl,imx7-csi", .data = (void *)IMX7 }, > + { .compatible = "fsl,imx6ul-csi", .data = (void *)IMX6UL }, > { }, > }; > 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