Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4704519rwl; Mon, 3 Apr 2023 08:30:58 -0700 (PDT) X-Google-Smtp-Source: AKy350YGEzy3YnHTii5e8Dmzw8ZzRQjySD4ySWL3FLq0WxNyTkr+cS7ESTWf437tUUOQv7cP8V6r X-Received: by 2002:a17:907:d483:b0:932:ac6c:7ef9 with SMTP id vj3-20020a170907d48300b00932ac6c7ef9mr39337568ejc.22.1680535858270; Mon, 03 Apr 2023 08:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680535858; cv=none; d=google.com; s=arc-20160816; b=ui54YiBD9QoC1ip8VYNQFVYvwQkuDy1af1N0W7Zsv659PtqIsVmDb/2IzVmSaOxI8+ Z/QN4eVveDevh+PFs5+WpgIbEWcuvamDDfYYnRRAlWA2zjFQWvduNd++M05Us+X2zWD2 /ttkEb2XhvDsC51IoYeRFw6ghfVmnQVB/dI/v9qLVqJsgsAE+lYvBGSd6pWbrysYFtCx Q0abxmRxJi+l5u1mILNOFiawQh6Nx0tpJuBF7NM1xtqgoLxBvUa2KZnYMWCmQZPdP4UV oKpi7R6qYhPb1vm2p9vjU2005ydNThH4QiW+ofoXJ82X89YX6r5R8qRvdzlJ2C5V5DBI 6Hig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=DqP+QRGf+rrQD2kliDbDIMvrPOs6hCR+o4Khphli5Yg=; b=yJGwYKJPFDPIoxjSblMvVSLuMLh6e1hUUaNks8VBIUp+RcErHvDBEVjOiXEi94wSO4 HZsCGAkvedyUhlpgEWbHxIpZV/Tcq19So4LdDWLk97Ns6n+KLxl3ajhuiO8sKwaqd4wK BPzTn/YMeR+lfe9rT6B+NWLvRlMFkZwi5T/VgrbA980pI9s8wGyyH6E7Nk4krye3KzNS KJ5EE2oUnlJ83GBe+InPP1JvMk/A6/oHp7euTe/xSeUAzLnooT5sUSt4dM4lWGd8H0+x slKR0YCnnQgj6vYuqLyBnEvqXmP8kaSlwfaFmrocNRY5gzj+nABJIKhCPN2leXaVmu1l d4UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efq5ine+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d24-20020a1709067f1800b0093348ceb372si4145928ejr.742.2023.04.03.08.30.31; Mon, 03 Apr 2023 08:30:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efq5ine+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232568AbjDCPV5 (ORCPT + 99 others); Mon, 3 Apr 2023 11:21:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231494AbjDCPV4 (ORCPT ); Mon, 3 Apr 2023 11:21:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C2DE10D5; Mon, 3 Apr 2023 08:21:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1BB9161C12; Mon, 3 Apr 2023 15:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81B54C4339C; Mon, 3 Apr 2023 15:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680535312; bh=LKyj2hwPi42lkcaWN3TMXoQR+q6WYCbdhvtoyLpvRzk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=efq5ine+EsMFH+WcS5cjeha3Dry9tfLq3C8DRkJhnQrIpYlm7DOfWmNv2Bjun+nlF skJ5Xix2JZ8m02L27GMmQkrcTi4Ste4xFWP4VUnkHql7+fM2PYYvX1Pv4ZDs2wa+Zx FVcJ1epYo1ITKpgy0wkdRAjAmjK+j6r4ZmwEIHWvz0cDbjWc+tnz4lprVhBIIctxgR YZMv+njBtzNhqMzBfGS+FZEmseYz1lj5CK0bw1SM5zo0Xz4nV3de8nZRmdWJW235hq hE5ckzXtq5Cht0yWYrMK9JoeaLwClA2lCXlybofbFFBONxBOuJ/sluhGFc07EFRYYn rOexfBdNBnLxw== Received: by mail-lj1-f170.google.com with SMTP id o20so27810655ljp.3; Mon, 03 Apr 2023 08:21:52 -0700 (PDT) X-Gm-Message-State: AAQBX9f0O/ncEeTaOp5Xjd7x+f9DNFpgjSMgpWUuEQBqQ+DWUa2e2ogs vPw3rDMtoBCDlZlOBdQLfiHe4EEzVjQJYbm1gw== X-Received: by 2002:a2e:9792:0:b0:2a3:fc8:711b with SMTP id y18-20020a2e9792000000b002a30fc8711bmr10925454lji.10.1680535310524; Mon, 03 Apr 2023 08:21:50 -0700 (PDT) MIME-Version: 1.0 References: <20230403071929.360911-1-jstephan@baylibre.com> <20230403071929.360911-3-jstephan@baylibre.com> In-Reply-To: <20230403071929.360911-3-jstephan@baylibre.com> From: Chun-Kuang Hu Date: Mon, 3 Apr 2023 23:21:38 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] phy: mtk-mipi-csi: add driver for CSI phy To: Julien Stephan Cc: Phi-bang Nguyen , Louis Kuo , Chunfeng Yun , Andy Hsieh , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , "moderated list:ARM/Mediatek USB3 PHY DRIVER" , "moderated list:ARM/Mediatek USB3 PHY DRIVER" , "open list:GENERIC PHY FRAMEWORK" , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , open list , "open list:DRM DRIVERS FOR MEDIATEK" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,UPPERCASE_50_75 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Julien: Julien Stephan =E6=96=BC 2023=E5=B9=B44=E6=9C=883= =E6=97=A5 =E9=80=B1=E4=B8=80 =E4=B8=8B=E5=8D=883:20=E5=AF=AB=E9=81=93=EF=BC= =9A > > From: Phi-bang Nguyen > > This is a new driver that supports the MIPI CSI CD-PHY for mediatek > mt8365 soc > > Signed-off-by: Louis Kuo > Signed-off-by: Phi-bang Nguyen > [Julien Stephan: use regmap] > [Julien Stephan: use GENMASK] > Co-developed-by: Julien Stephan > Signed-off-by: Julien Stephan > --- > .../bindings/phy/mediatek,csi-phy.yaml | 9 +- > MAINTAINERS | 1 + > drivers/phy/mediatek/Kconfig | 8 + > drivers/phy/mediatek/Makefile | 2 + > .../phy/mediatek/phy-mtk-mipi-csi-rx-reg.h | 435 ++++++++++++++++++ > drivers/phy/mediatek/phy-mtk-mipi-csi.c | 392 ++++++++++++++++ > 6 files changed, 845 insertions(+), 2 deletions(-) > create mode 100644 drivers/phy/mediatek/phy-mtk-mipi-csi-rx-reg.h > create mode 100644 drivers/phy/mediatek/phy-mtk-mipi-csi.c > [snip] > + > +#define MIPI_RX_ANA04_CSIxA = 0x0004 Useless, so drop this. > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_LPRX_VTH_SEL_SHIFT = 0 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_LPRX_VTH_SEL_MASK = GENMASK(2, 0) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_LPRX_VTL_SEL_SHIFT = 4 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_LPRX_VTL_SEL_MASK = GENMASK(6, 4) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_HSDET_VTH_SEL_SHIFT = 8 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_HSDET_VTH_SEL_MASK = GENMASK(10, 8) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_HSDET_VTL_SEL_SHIFT = 12 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_HSDET_VTL_SEL_MASK = GENMASK(14, 12) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_VREF_SEL_SHIFT = 16 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_VREF_SEL_MASK = GENMASK(19, 16) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_MON_VREF_SEL_SHIFT = 24 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_BG_MON_VREF_SEL_MASK = GENMASK(27, 24) > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_FORCE_HSRT_EN_SHIFT = 28 > +#define MIPI_RX_ANA04_CSIxA_RG_CSIxA_FORCE_HSRT_EN_MASK = BIT(28) > + > +#define MIPI_RX_ANA08_CSIxA = 0x0008 Ditto. > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L0P_T0A_HSRT_CODE_SHIFT = 0 > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L0P_T0A_HSRT_CODE_MASK = GENMASK(4, 0) > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L0N_T0B_HSRT_CODE_SHIFT = 8 > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L0N_T0B_HSRT_CODE_MASK = GENMASK(12, 8) > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L1P_T0C_HSRT_CODE_SHIFT = 16 > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L1P_T0C_HSRT_CODE_MASK = GENMASK(20, 16) > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L1N_T1A_HSRT_CODE_SHIFT = 24 > +#define MIPI_RX_ANA08_CSIxA_RG_CSIxA_L1N_T1A_HSRT_CODE_MASK = GENMASK(28, 24) > + > +#define MIPI_RX_ANA0C_CSIxA = 0x000c Ditto. > +#define MIPI_RX_ANA0C_CSIxA_RG_CSIxA_L2P_T1B_HSRT_CODE_SHIFT = 0 > +#define MIPI_RX_ANA0C_CSIxA_RG_CSIxA_L2P_T1B_HSRT_CODE_MASK = GENMASK(4, 0) > +#define MIPI_RX_ANA0C_CSIxA_RG_CSIxA_L2N_T1C_HSRT_CODE_SHIFT = 8 > +#define MIPI_RX_ANA0C_CSIxA_RG_CSIxA_L2N_T1C_HSRT_CODE_MASK = GENMASK(12, 8) > + > +#define MIPI_RX_ANA10_CSIxA = 0x0010 Ditto. > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_DELAYCAL_EN_SHIFT = 0 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_DELAYCAL_EN_MASK = BIT(0) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_DELAYCAL_RSTB_SHIFT = 1 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_DELAYCAL_RSTB_MASK = BIT(1) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_VREF_SEL_SHIFT = 2 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L0_VREF_SEL_MASK = GENMASK(7, 2) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_DELAYCAL_EN_SHIFT = 8 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_DELAYCAL_EN_MASK = BIT(8) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_DELAYCAL_RSTB_SHIFT = 9 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_DELAYCAL_RSTB_MASK = BIT(9) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_VREF_SEL_SHIFT = 10 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L1_VREF_SEL_MASK = GENMASK(15, 10) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_DELAYCAL_EN_SHIFT = 16 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_DELAYCAL_EN_MASK = BIT(16) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_DELAYCAL_RSTB_SHIFT = 17 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_DELAYCAL_RSTB_MASK = BIT(17) > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_VREF_SEL_SHIFT = 18 > +#define MIPI_RX_ANA10_CSIxA_RG_CSIxA_DPHY_L2_VREF_SEL_MASK = GENMASK(23, 18) > +/* C-PHY fields are only available in CSIx. */ > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_CDR_DELAYCAL_EN_SHIFT = 24 > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_CDR_DELAYCAL_EN_MASK = BIT(24) > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_CDR_DELAYCAL_RSTB_SHIFT = 25 > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_CDR_DELAYCAL_RSTB_MASK = BIT(25) > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_VREF_SEL_SHIFT = 26 > +#define MIPI_RX_ANA10_CSIxA_RG_CSI0A_CPHY_T0_VREF_SEL_MASK = GENMASK(31, 26) > + > +#define MIPI_RX_ANA14_CSIxA = 0x0014 Ditto. Regards, Chun-Kuang. > +/* C-PHY fields are only available in CSIx. */ > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_CDR_DELAYCAL_EN_SHIFT = 0 > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_CDR_DELAYCAL_EN_MASK = BIT(0) > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_CDR_DELAYCAL_RSTB_SHIFT = 1 > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_CDR_DELAYCAL_RSTB_MASK = BIT(1) > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_VREF_SEL_SHIFT = 2 > +#define MIPI_RX_ANA14_CSIxA_RG_CSI0A_CPHY_T1_VREF_SEL_MASK = GENMASK(7, 2) > +