From patchwork Wed Jul 20 09:15:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Riesch X-Patchwork-Id: 12923714 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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 1B4EAC43334 for ; Wed, 20 Jul 2022 09:16:39 +0000 (UTC) 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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rEOiKNngwiuedZ247dDNl+NcjlP5XOCcPt86Xs4/wlk=; b=pYP5327P2TZX8r nJd2MoPaRTlmr2vne+JZWeW9VU4WKoa7yqDTQWQm3+bhPSxxIzfutKd51j73tEm/Sg4iNX8JMz3YK pgyeFNX8C7HKh3Dhlt1A32Be73nHLiaN5o/OuxAhFjp69shnGha+m1z+lAyxdC6tv6BpIkZ3oYfOb n2Fm70BGM852asTTqLzKXSChW4mSzZEVyrAmWw5WLDfeRMDu/1yy+7MfvVJj5HZZyBUWtRtgvbbIr CsGCI3wNSWj4KP/JQaehy7se4wRhIjVzRE1Gb0jlEyn5oMlu+HoOSwlk39UlD9S6fMqp/J4I/nXya i0wTQR7oSdirK3wx51xw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE5oj-0038DR-B9; Wed, 20 Jul 2022 09:16:29 +0000 Received: from mail-db8eur05on2066.outbound.protection.outlook.com ([40.107.20.66] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oE5oB-0037hf-1g; Wed, 20 Jul 2022 09:15:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PG7ivB2Z/HAUgyaTgrEA1A0TOn5QsHDVz/AakGso/SjUvxsA/H4nr91zNo6mKZ4m/NsXZHAySt/plD+VbNTEqoKGpy1VBz4uUo8fJKcKLsArvA2oyHyKcu17vo1pIySyacGQzk1C1kPbjZqhjPZ2m6zDBVIzRIw5mMzSeodP/vhfGlm55UXENBrptoHVnLqPjGS10Hkabk+enerjQEIIFj+te3ORGgmMC3sIzg/ZcdR5A8ZjZizVKYhQ8EK0fLdCVL4LMypwMSmh9mqALaTfCt5c+hsAhBuYuGC9GE0HmNFgNP3LAGLvpW/iXowiq1uLJb4dJ9hn59IDqd9GcXf75g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=3KQrkCJyMAeEH+ynLgaEIl0E7qyivNBW6aAam3nF9Fc=; b=ehlGxTUZNM3wDZu2G2V2dnZhGl2GfEkZVOL5svnZh3EaX7jHjgQyqBJ0Amkn5e++c+jY34aw4PySnlkqkLbbc3bDuN2tb635e3AAW6DU0yMlBcEbUp38qd1dy11Sat75Zpq4TAPgZtFTzd3T225vSZPQ0X+r4K7vp+l7NJ10yxtEv6r1LT6o93T8vcrGkNE/ywthxVLX3HyQ5kK77spMbwWUc4CW36IefKymtm374I0gD2L31u2aQRCY4LUFi3r5V5mqAlVlSD45DAwbKx1uVD17SWAsqo2FI5jVqQnBCz7HVI9EsrIxRZJ+lt5+nREjylsC1ooQx/1JvlQhpFk6Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=3KQrkCJyMAeEH+ynLgaEIl0E7qyivNBW6aAam3nF9Fc=; b=e7f8ZmrJ0rXz6ioT6p8mQLzkfprgzYEqBIF5qyz59qr24yXXi3Xm2OdK9oMVJ6pUR0HDIyg6qxdcjlIhvzK+3V924wR82Vx7TWUSqcy4dwZnqZE4Vm4hpKZimJ2/bveFkeyQBfKjIELAoj1/czsgFXXmJ90UJLLBMr53rq1FfSU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from AM4PR0802MB2131.eurprd08.prod.outlook.com (2603:10a6:200:5c::22) by VI1PR08MB3934.eurprd08.prod.outlook.com (2603:10a6:803:df::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5458.18; Wed, 20 Jul 2022 09:15:46 +0000 Received: from AM4PR0802MB2131.eurprd08.prod.outlook.com ([fe80::dcaa:905c:ff8:1f5b]) by AM4PR0802MB2131.eurprd08.prod.outlook.com ([fe80::dcaa:905c:ff8:1f5b%9]) with mapi id 15.20.5458.018; Wed, 20 Jul 2022 09:15:46 +0000 From: Michael Riesch To: linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Krzysztof Kozlowski , Heiko Stuebner , Peter Geis , Michael Riesch , Sascha Hauer , Nicolas Frattaroli , Liang Chen Subject: [PATCH 2/3] phy: rockchip: add support for the rk356x variant to rockchip-inno-csidphy Date: Wed, 20 Jul 2022 11:15:26 +0200 Message-Id: <20220720091527.1270365-3-michael.riesch@wolfvision.net> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220720091527.1270365-1-michael.riesch@wolfvision.net> References: <20220720091527.1270365-1-michael.riesch@wolfvision.net> X-ClientProxiedBy: ZR0P278CA0129.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:40::8) To AM4PR0802MB2131.eurprd08.prod.outlook.com (2603:10a6:200:5c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c72e7a37-670f-4590-608b-08da6a306e19 X-MS-TrafficTypeDiagnostic: VI1PR08MB3934:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1G5qgWNC//Zw913iJC4vWMydBc3xWrIGeQM7SmsA+xUOz6ufWPsD9mSwcV5Zh+Ca3l/eflP/HSDLtXI7s9pjOubIBZYGPDmF+9mWtc9Nm4b9sDLkKIgGgGvQMDWKaKKHTOk/ZOxQtRDo96dWh2cMOMpYaFrQHu7o6S2CeOcO0nHpjFrj8uc9iq27Xvquh13ShOmkxhtGuKpoV7h6Vn4qz3GP3wAgJLEbShgVFb+kzbKTZc99X1z5evkMRd3BfymysY7PiQgrMrsvPg9sVMR6ThSB975uu0quSteQt5yxMWTPJRGEAPqH3GRyfuKw012uGb+mNNegU52XA6snpfTWBmBMVKJzXSgJVCF4MIHRs3AgSnaxxEWHpXJ19pUD8k98BvitdKn183/YhUqWHZh+2eqXJeqVQF8/TXl3Jn78AN2Z0V4/ci1xJpo7TOmVYr8qDmBjRnvS6mhtPIYy2Iep84TJsqpS+kxel1oLaDfPFUuuWVFFLxzXoKOrJTAo7wQcoggw1dEN9MPAmJbL4z6AvHqcDkgyYucmE99hZW2/nDfyitHBxeUjaFnUvMryfySfI2zqNtvzHtL5AmlG3tfi/dM7k2myINpWyr8fgQ+CRpkwp7HtxUHh7dZXRnDwRE4t1qQdKdAh6+oWu5/xdxZV5UtKc+wisq+8vEShrbiRo1Ta83Y87U0G9pAJ+k2Uc37OoLBrt19SDSOtqf5pTHoozDWqckHTl9aewKjDrq/YVp/VZ7Erg149TLBPZt9HDQzC X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM4PR0802MB2131.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(39840400004)(396003)(376002)(366004)(136003)(38100700002)(52116002)(41300700001)(6506007)(6666004)(8936002)(7416002)(5660300002)(6486002)(2616005)(478600001)(1076003)(66476007)(8676002)(66946007)(66556008)(6512007)(54906003)(316002)(4326008)(2906002)(186003)(44832011)(36756003)(86362001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +hU/suxb/OrI6V18m1Ag5LVUpw9AfXw5mX1bVCCwaCacvmL+0op1TF17ueXr0d8YyDyFYHttDooDXbEVabLsAbu1CRA/8rv9Em/uSBoT4lMG8Hd5sj0ku3sm7lmyHh9ilgK9aaIq9H0AJsiLiPJ6vj97Knb3zcl3s1hNKuwed+LSRax6x+0TzyI4sneV4sMUftgPcBpACaFwShx8wwS5XEdUz1jjMGszuIk8vSh+dNKuTyrgSqhhUylz6BAC1qhVmDfLxz9e+KO0GyLoHrIOjonHtzJ/gvja3964xfuWcr+e5XkTTTX9FjSLHb6795u7A/pxwynKCrOwA60PKM4KVGNcEEfwsttyHxpH3fwLiirNQejtEq3E3NJ2OxA0OcWgSMJP98oM38PVWBfp4qpnPBH3gYHj53fGcQSLJ9nb8KPEnlWZzctxJb92MZS1KEvxokO1OydhBpg1hoNlNxw65MU7HpCwInTj4wJgvdTWDMN/p9wyppVqNpsMq1dzpzZ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LKqDV3BiVRdriMuAh8zYuzxinRiqZWgcX9fxi8+z8ZR0g3MG9EHCR59rOFjewnc96S6fEozulrjAGg== X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: c72e7a37-670f-4590-608b-08da6a306e19 X-MS-Exchange-CrossTenant-AuthSource: AM4PR0802MB2131.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jul 2022 09:15:46.5259 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: oB0Fg1zjZeRASUGUhMLeIhAq0UU5JLKv+CQUPdnHjXtOExPs/xuPiBy9hPvVHlcnPucmRNHO28dQu4MwDhtCz+Bk5Gonc2G08wscTk7zJIY= X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB3934 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_021555_148183_DF9BF89E X-CRM114-Status: GOOD ( 11.56 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org This adds support for variant found in Rockchip RK356x SoCs. Note that only the basic operating mode is supported, in which all four CSI lines are controlled by the Rockchip ISP. Signed-off-by: Michael Riesch Reviewed-by: Heiko Stuebner --- .../phy/rockchip/phy-rockchip-inno-csidphy.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c index ca13a604ab4f..75f948bdea6a 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-csidphy.c @@ -27,6 +27,9 @@ #define RK3368_GRF_SOC_CON6_OFFSET 0x0418 +#define RK3568_GRF_VI_CON0 0x0340 +#define RK3568_GRF_VI_CON1 0x0344 + /* PHY */ #define CSIDPHY_CTRL_LANE_ENABLE 0x00 #define CSIDPHY_CTRL_LANE_ENABLE_CK BIT(6) @@ -58,9 +61,11 @@ #define RK1808_CSIDPHY_CLK_WR_THS_SETTLE 0x160 #define RK3326_CSIDPHY_CLK_WR_THS_SETTLE 0x100 #define RK3368_CSIDPHY_CLK_WR_THS_SETTLE 0x100 +#define RK3568_CSIDPHY_CLK_WR_THS_SETTLE 0x160 /* Calibration reception enable */ #define RK1808_CSIDPHY_CLK_CALIB_EN 0x168 +#define RK3568_CSIDPHY_CLK_CALIB_EN 0x168 /* * The higher 16-bit of this register is used for write protection @@ -103,6 +108,12 @@ static const struct dphy_reg rk3368_grf_dphy_regs[] = { [GRF_DPHY_CSIPHY_FORCERXMODE] = PHY_REG(RK3368_GRF_SOC_CON6_OFFSET, 4, 8), }; +static const struct dphy_reg rk3568_grf_dphy_regs[] = { + [GRF_DPHY_CSIPHY_FORCERXMODE] = PHY_REG(RK3568_GRF_VI_CON0, 4, 0), + [GRF_DPHY_CSIPHY_DATALANE_EN] = PHY_REG(RK3568_GRF_VI_CON0, 4, 4), + [GRF_DPHY_CSIPHY_CLKLANE_EN] = PHY_REG(RK3568_GRF_VI_CON0, 1, 8), +}; + struct hsfreq_range { u32 range_h; u8 cfg_bit; @@ -352,6 +363,15 @@ static const struct dphy_drv_data rk3368_mipidphy_drv_data = { .grf_regs = rk3368_grf_dphy_regs, }; +static const struct dphy_drv_data rk3568_mipidphy_drv_data = { + .pwrctl_offset = -1, + .ths_settle_offset = RK3568_CSIDPHY_CLK_WR_THS_SETTLE, + .calib_offset = RK3568_CSIDPHY_CLK_CALIB_EN, + .hsfreq_ranges = rk1808_mipidphy_hsfreq_ranges, + .num_hsfreq_ranges = ARRAY_SIZE(rk1808_mipidphy_hsfreq_ranges), + .grf_regs = rk3568_grf_dphy_regs, +}; + static const struct of_device_id rockchip_inno_csidphy_match_id[] = { { .compatible = "rockchip,px30-csi-dphy", @@ -369,6 +389,10 @@ static const struct of_device_id rockchip_inno_csidphy_match_id[] = { .compatible = "rockchip,rk3368-csi-dphy", .data = &rk3368_mipidphy_drv_data, }, + { + .compatible = "rockchip,rk3568-csi-dphy", + .data = &rk3568_mipidphy_drv_data, + }, {} }; MODULE_DEVICE_TABLE(of, rockchip_inno_csidphy_match_id);