From patchwork Fri Nov 17 13:04:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengyang Chen X-Patchwork-Id: 166166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp512045vqn; Fri, 17 Nov 2023 05:06:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IEHwREJGd2kCW8xXRJ4rAUAeP6zkt1JCa1b60vq8ERbhH+0rmci/0YmEvsKdBFN2+RIrcpg X-Received: by 2002:a05:6808:6546:b0:3a9:c647:c9ca with SMTP id fn6-20020a056808654600b003a9c647c9camr26234734oib.5.1700226394596; Fri, 17 Nov 2023 05:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700226394; cv=none; d=google.com; s=arc-20160816; b=GzDN4UihmOGSlX9whQiBNHRQ72YtkDg9HJ5QRjFpJLNq6D9OcRuCFQunvuYrrJWdVX ZlMqvKyST5FiOBk/bg9hNtoHzon9lpqCodAZx5NJyjicIQv+shgO9eb0PIcghLhPlv73 KpTvXMizDxPGFrdCYe1i58VeJWwZAo+n9SPkwTSahp6q7hbgR9pJsRhPD69Ud21cpk4S r4aORAqPF3T/4SJCJFxyjdtfwp9grztnrIJniq0e742urqF7biaH18wzG8IAG81XeGj/ iMEaVuh+sTyMmq0MG9WceocsvPk4zyiHpq4+CbyuAXqIMRWNbCv+lawPyrpM+al9meLw ghVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=QtXWSkK88NDGTHo24kx4QolaOJzBQaXayk/yxyY+NR0=; fh=BV8Hujwb2jkbQApqxKYAYslg6CAkxz1JokgInyskOW8=; b=Gm3kwkH0ySzN6EK0bxMh979gRvRDO0L3eTM9F+0hCSb7jNIOJvqawLUDwa5JxovUna cUKmBb+okocsj4D2c2btW1ThxCnfnSZzKr5u/++bittUsXO79SrZZoB3sw/PS+gTjRNi 1WDHfUkCzObVWcDAMuMLPlS/FEBHAgPj/3G83QJRvTNxFG72Q2/PbtSCOhl+Wb2qfRwg U3u8F3zk53z+vl2QYafeULjrrFLixPoS25M8WSSoHdZ7pK+0BPZ1/1CZ0KjJ03UF1mga aOO8nECjakyx6xQHCfudK3opzFrMpHvN2pmaDy0Qkf4VD2oQNVIO7dy4jLYWZVJU6bcL fF4w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id gt17-20020a0568082e9100b003a86423b91fsi606296oib.166.2023.11.17.05.06.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:06:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5D8DC81EE2F8; Fri, 17 Nov 2023 05:05:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231360AbjKQNEh (ORCPT + 30 others); Fri, 17 Nov 2023 08:04:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjKQNEf (ORCPT ); Fri, 17 Nov 2023 08:04:35 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA235D55; Fri, 17 Nov 2023 05:04:27 -0800 (PST) Received: from EXMBX165.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX165", Issuer "EXMBX165" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id 34D3C24E269; Fri, 17 Nov 2023 21:04:24 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX165.cuchost.com (172.16.6.75) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 17 Nov 2023 21:04:24 +0800 Received: from yang-virtual-machine.localdomain (183.27.97.246) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 17 Nov 2023 21:04:23 +0800 From: Shengyang Chen To: , CC: , , , , , , , , , , , , Subject: [PATCH v1 1/2] dt-bindings: phy: Add starfive,jh7110-dphy-tx Date: Fri, 17 Nov 2023 21:04:20 +0800 Message-ID: <20231117130421.79261-2-shengyang.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231117130421.79261-1-shengyang.chen@starfivetech.com> References: <20231117130421.79261-1-shengyang.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [183.27.97.246] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 17 Nov 2023 05:05:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782816591806078057 X-GMAIL-MSGID: 1782816591806078057 StarFive SoCs like the jh7110 use a MIPI D-PHY TX controller based on a M31 IP. Add a binding for it. Signed-off-by: Shengyang Chen --- .../bindings/phy/starfive,jh7110-dphy-tx.yaml | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml diff --git a/Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml b/Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml new file mode 100644 index 000000000000..850fe2e61d1d --- /dev/null +++ b/Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml @@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/starfive,jh7110-dphy-tx.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Starfive SoC MIPI D-PHY Tx Controller + +maintainers: + - Keith Zhao + - Shengyang Chen + +description: + The Starfive SoC uses the MIPI DSI D-PHY based on M31 IP to transfer + DSI data. + +properties: + compatible: + const: starfive,jh7110-dphy-tx + + reg: + maxItems: 1 + + clocks: + maxItems: 1 + + clock-names: + items: + - const: dphy_txesc + + resets: + items: + - description: DSITX_TXBYTEHS reset + - description: MIPITX_DPHY_SYS reset + - description: MIPITX_DPHY_TXBYTEHS reset + + reset-names: + items: + - const: dsi_txbytehs + - const: dphy_sys + - const: dphy_txbytehs + + power-domains: + maxItems: 1 + + "#phy-cells": + const: 0 + +required: + - compatible + - reg + - clocks + - clock-names + - resets + - reset-names + - power-domains + - "#phy-cells" + +additionalProperties: false + +examples: + - | + phy@295e0000 { + compatible = "starfive,jh7110-dphy-tx"; + reg = <0x295e0000 0x10000>; + clocks = <&voutcrg 14>; + clock-names = "dphy_txesc"; + resets = <&syscrg 7>, + <&syscrg 10>, + <&syscrg 11>; + reset-names = "dsi_txbytehs", "dphy_sys", "dphy_txbytehs"; + power-domains = <&aon_syscon 0>; + #phy-cells = <0>; + }; From patchwork Fri Nov 17 13:04:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengyang Chen X-Patchwork-Id: 166165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9910:0:b0:403:3b70:6f57 with SMTP id i16csp510395vqn; Fri, 17 Nov 2023 05:04:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IE/sYSvhaXm77FD45vn1kU0bT8yXQM1kzFx0gM8BUCII0tDxgxmRH7+3lOSSBCxs60mtVnA X-Received: by 2002:a9d:4802:0:b0:6bf:1e78:cc52 with SMTP id c2-20020a9d4802000000b006bf1e78cc52mr11489555otf.25.1700226283095; Fri, 17 Nov 2023 05:04:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700226283; cv=none; d=google.com; s=arc-20160816; b=WpfLXwHMRJgfDaXRywaBfuupsvmtYdWwTC14xqLXW1Afkz3Jet08f++Ll9iecxVsgr 0wea7SQSTf3YxGieEjwg3Ay82hRR343wCA9nHSva1KuX2MZFdK6g1i5l6y58mwLmSD9d YOBq8tEa7/rkLT8EAvZ8r8FIAprjusF3305X/HrTehkMk/BbBBuMjrm3GPklsSh7gNrW K/5X20zOvInhVvmMtAFJQ6uP3sEwKhW0hl9nAchqm1nJ7gzZJyFj+P+cpXt7CcRxzpPl nNaSXkcUEreChCPjdPlnsZHqxVIyPNauWsdzGm7kZ5tw6e+dqlj9eQCLSHA4wlBDEhsu e70A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=+vVSJXbGIEF4vr5/LMZPQ0mF7kdiA1BoZWPwNYw9crU=; fh=BV8Hujwb2jkbQApqxKYAYslg6CAkxz1JokgInyskOW8=; b=zb+3hqvhTMAqTZfgLWJG8b6Qyzsi8Ml92nYxIfQvQ/3QLjiEoOOy1gNmRDXV0WUNt7 Y/ZpPYzeATc4MV4SMqg2Fb0bUEJgYkP4msRb87pe4HBgriqpB4zFqketH43AspWkm3T7 AEYH4JrR8o0WlGoLS+3D3vLP+qRH0JeZqyW87zI+ORzdJxH5bVUjLpYUmlN87LPmDIhb ZauwHBs9XN5doXVg9MxWEaTBNG9Od/hfa0I8dIRtdrfJ5coCbGcaWS0jRTBpP3G9kuPp o1tzJQTfSWrqa/cz8xZUxywutEVkGEOpOZthkDpX9IwuB9o+MxtIEcVn+OeLWxQ0yumP /XYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id s7-20020a056830438700b006d309d2185bsi609045otv.180.2023.11.17.05.04.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Nov 2023 05:04:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id BC897829BC71; Fri, 17 Nov 2023 05:04:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345899AbjKQNEj (ORCPT + 30 others); Fri, 17 Nov 2023 08:04:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230379AbjKQNEf (ORCPT ); Fri, 17 Nov 2023 08:04:35 -0500 Received: from ex01.ufhost.com (ex01.ufhost.com [61.152.239.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1BADD52; Fri, 17 Nov 2023 05:04:27 -0800 (PST) Received: from EXMBX166.cuchost.com (unknown [175.102.18.54]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "EXMBX166", Issuer "EXMBX166" (not verified)) by ex01.ufhost.com (Postfix) with ESMTP id E572E24E26B; Fri, 17 Nov 2023 21:04:24 +0800 (CST) Received: from EXMBX171.cuchost.com (172.16.6.91) by EXMBX166.cuchost.com (172.16.6.76) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 17 Nov 2023 21:04:24 +0800 Received: from yang-virtual-machine.localdomain (183.27.97.246) by EXMBX171.cuchost.com (172.16.6.91) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Fri, 17 Nov 2023 21:04:24 +0800 From: Shengyang Chen To: , CC: , , , , , , , , , , , , Subject: [PATCH v1 2/2] phy: starfive: Add mipi dphy tx support Date: Fri, 17 Nov 2023 21:04:21 +0800 Message-ID: <20231117130421.79261-3-shengyang.chen@starfivetech.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231117130421.79261-1-shengyang.chen@starfivetech.com> References: <20231117130421.79261-1-shengyang.chen@starfivetech.com> MIME-Version: 1.0 X-Originating-IP: [183.27.97.246] X-ClientProxiedBy: EXCAS066.cuchost.com (172.16.6.26) To EXMBX171.cuchost.com (172.16.6.91) X-YovoleRuleAgent: yovoleflag X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 17 Nov 2023 05:04:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782816475158069797 X-GMAIL-MSGID: 1782816475158069797 Add mipi dphy tx support for the StarFive JH7110 SoC. It is used to transfer DSI data. Signed-off-by: Shengyang Chen --- MAINTAINERS | 7 + drivers/phy/starfive/Kconfig | 10 + drivers/phy/starfive/Makefile | 1 + drivers/phy/starfive/phy-jh7110-dphy-tx.c | 542 ++++++++++++++++++++++ 4 files changed, 560 insertions(+) create mode 100644 drivers/phy/starfive/phy-jh7110-dphy-tx.c diff --git a/MAINTAINERS b/MAINTAINERS index cfb533ec89e8..255c577afa49 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -20677,6 +20677,13 @@ S: Supported F: Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-rx.yaml F: drivers/phy/starfive/phy-jh7110-dphy-rx.c +STARFIVE JH7110 DPHY TX DRIVER +M: Keith Zhao +M: Shengyang Chen +S: Supported +F: Documentation/devicetree/bindings/phy/starfive,jh7110-dphy-tx.yaml +F: drivers/phy/starfive/phy-jh7110-dphy-tx.c + STARFIVE JH7110 MMC/SD/SDIO DRIVER M: William Qiu S: Supported diff --git a/drivers/phy/starfive/Kconfig b/drivers/phy/starfive/Kconfig index 9508e2143011..d0cdd7cb4a13 100644 --- a/drivers/phy/starfive/Kconfig +++ b/drivers/phy/starfive/Kconfig @@ -15,6 +15,16 @@ config PHY_STARFIVE_JH7110_DPHY_RX system. If M is selected, the module will be called phy-jh7110-dphy-rx.ko. +config PHY_STARFIVE_JH7110_DPHY_TX + tristate "StarFive JH7110 D-PHY TX Support" + depends on HAS_IOMEM + select GENERIC_PHY + select GENERIC_PHY_MIPI_DPHY + help + Choose this option if you have a StarFive D-PHY TX in your + system. If M is selected, the module will be called + phy-jh7110-dphy-tx.ko. + config PHY_STARFIVE_JH7110_PCIE tristate "Starfive JH7110 PCIE 2.0/USB 3.0 PHY support" depends on HAS_IOMEM diff --git a/drivers/phy/starfive/Makefile b/drivers/phy/starfive/Makefile index b391018b7c47..eedc4a6fec15 100644 --- a/drivers/phy/starfive/Makefile +++ b/drivers/phy/starfive/Makefile @@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_PHY_STARFIVE_JH7110_DPHY_RX) += phy-jh7110-dphy-rx.o +obj-$(CONFIG_PHY_STARFIVE_JH7110_DPHY_TX) += phy-jh7110-dphy-tx.o obj-$(CONFIG_PHY_STARFIVE_JH7110_PCIE) += phy-jh7110-pcie.o obj-$(CONFIG_PHY_STARFIVE_JH7110_USB) += phy-jh7110-usb.o diff --git a/drivers/phy/starfive/phy-jh7110-dphy-tx.c b/drivers/phy/starfive/phy-jh7110-dphy-tx.c new file mode 100644 index 000000000000..69aa172563e4 --- /dev/null +++ b/drivers/phy/starfive/phy-jh7110-dphy-tx.c @@ -0,0 +1,542 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * DPHY TX driver for the StarFive JH7110 SoC + * + * Copyright (C) 2023 StarFive Technology Co., Ltd. + * Author: Keith Zhao + * Author: Shengyang Chen + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define STF_DPHY_APBIFSAIF_SYSCFG(x) (x) + +#define STF_DPHY_AON_POWER_READY_N_SHIFT 0x0U +#define STF_DPHY_AON_POWER_READY_N_MASK BIT(0) +#define STF_DPHY_CFG_L0_SWAP_SEL_SHIFT 0xCU +#define STF_DPHY_CFG_L0_SWAP_SEL_MASK GENMASK(14, 12) +#define STF_DPHY_CFG_L1_SWAP_SEL_SHIFT 0xFU +#define STF_DPHY_CFG_L1_SWAP_SEL_MASK GENMASK(17, 15) +#define STF_DPHY_CFG_L2_SWAP_SEL_SHIFT 0x12U +#define STF_DPHY_CFG_L2_SWAP_SEL_MASK GENMASK(20, 18) +#define STF_DPHY_CFG_L3_SWAP_SEL_SHIFT 0x15U +#define STF_DPHY_CFG_L3_SWAP_SEL_MASK GENMASK(23, 21) +#define STF_DPHY_CFG_L4_SWAP_SEL_SHIFT 0x18U +#define STF_DPHY_CFG_L4_SWAP_SEL_MASK GENMASK(26, 24) +#define STF_DPHY_RGS_CDTX_PLL_UNLOCK_SHIFT 0x12U +#define STF_DPHY_RGS_CDTX_PLL_UNLOCK_MASK BIT(18) +#define STF_DPHY_RG_CDTX_L0N_HSTX_RES_SHIFT 0x13U +#define STF_DPHY_RG_CDTX_L0N_HSTX_RES_MASK GENMASK(23, 19) +#define STF_DPHY_RG_CDTX_L0P_HSTX_RES_SHIFT 0x18U +#define STF_DPHY_RG_CDTX_L0P_HSTX_RES_MASK GENMASK(28, 24) + +#define STF_DPHY_RG_CDTX_L1P_HSTX_RES_SHIFT 0x5U +#define STF_DPHY_RG_CDTX_L1P_HSTX_RES_MASK GENMASK(9, 5) +#define STF_DPHY_RG_CDTX_L2N_HSTX_RES_SHIFT 0xAU +#define STF_DPHY_RG_CDTX_L2N_HSTX_RES_MASK GENMASK(14, 10) +#define STF_DPHY_RG_CDTX_L2P_HSTX_RES_SHIFT 0xFU +#define STF_DPHY_RG_CDTX_L2P_HSTX_RES_MASK GENMASK(19, 15) +#define STF_DPHY_RG_CDTX_L3N_HSTX_RES_SHIFT 0x14U +#define STF_DPHY_RG_CDTX_L3N_HSTX_RES_MASK GENMASK(24, 20) +#define STF_DPHY_RG_CDTX_L3P_HSTX_RES_SHIFT 0x19U +#define STF_DPHY_RG_CDTX_L3P_HSTX_RES_MASK GENMASK(29, 25) + +#define STF_DPHY_RG_CDTX_L4N_HSTX_RES_SHIFT 0x0U +#define STF_DPHY_RG_CDTX_L4N_HSTX_RES_MASK GENMASK(4, 0) +#define STF_DPHY_RG_CDTX_L4P_HSTX_RES_SHIFT 0x5U +#define STF_DPHY_RG_CDTX_L4P_HSTX_RES_MASK GENMASK(9, 5) +#define STF_DPHY_RG_CDTX_PLL_FBK_FRA_SHIFT 0x0U +#define STF_DPHY_RG_CDTX_PLL_FBK_FRA_MASK GENMASK(23, 0) + +#define STF_DPHY_RG_CDTX_PLL_FBK_INT_SHIFT 0x0U +#define STF_DPHY_RG_CDTX_PLL_FBK_INT_MASK GENMASK(8, 0) +#define STF_DPHY_RG_CDTX_PLL_FM_EN_SHIFT 0x9U +#define STF_DPHY_RG_CDTX_PLL_FM_EN_MASK BIT(9) +#define STF_DPHY_RG_CDTX_PLL_LDO_STB_X2_EN_SHIFT 0xAU +#define STF_DPHY_RG_CDTX_PLL_LDO_STB_X2_EN_MASK BIT(10) +#define STF_DPHY_RG_CDTX_PLL_PRE_DIV_SHIFT 0xBU +#define STF_DPHY_RG_CDTX_PLL_PRE_DIV_MASK GENMASK(12, 11) + +#define STF_DPHY_RG_CDTX_PLL_SSC_EN_SHIFT 0x12U +#define STF_DPHY_RG_CDTX_PLL_SSC_EN_MASK 0x40000U + +#define STF_DPHY_RG_CLANE_HS_CLK_POST_TIME_SHIFT 0x0U +#define STF_DPHY_RG_CLANE_HS_CLK_POST_TIME_MASK GENMASK(7, 0) +#define STF_DPHY_RG_CLANE_HS_CLK_PRE_TIME_SHIFT 0x8U +#define STF_DPHY_RG_CLANE_HS_CLK_PRE_TIME_MASK GENMASK(15, 8) +#define STF_DPHY_RG_CLANE_HS_PRE_TIME_SHIFT 0x10U +#define STF_DPHY_RG_CLANE_HS_PRE_TIME_MASK GENMASK(23, 16) +#define STF_DPHY_RG_CLANE_HS_TRAIL_TIME_SHIFT 0x18U +#define STF_DPHY_RG_CLANE_HS_TRAIL_TIME_MASK GENMASK(31, 24) + +#define STF_DPHY_RG_CLANE_HS_ZERO_TIME_SHIFT 0x0U +#define STF_DPHY_RG_CLANE_HS_ZERO_TIME_MASK GENMASK(7, 0) +#define STF_DPHY_RG_DLANE_HS_PRE_TIME_SHIFT 0x8U +#define STF_DPHY_RG_DLANE_HS_PRE_TIME_MASK GENMASK(15, 8) +#define STF_DPHY_RG_DLANE_HS_TRAIL_TIME_SHIFT 0x10U +#define STF_DPHY_RG_DLANE_HS_TRAIL_TIME_MASK GENMASK(23, 16) +#define STF_DPHY_RG_DLANE_HS_ZERO_TIME_SHIFT 0x18U +#define STF_DPHY_RG_DLANE_HS_ZERO_TIME_MASK GENMASK(31, 24) + +#define STF_DPHY_RG_EXTD_CYCLE_SEL_SHIFT 0x0U +#define STF_DPHY_RG_EXTD_CYCLE_SEL_MASK GENMASK(2, 0) +#define STF_DPHY_SCFG_C_HS_PRE_ZERO_TIME_SHIFT 0x0U +#define STF_DPHY_SCFG_C_HS_PRE_ZERO_TIME_MASK GENMASK(31, 0) + +#define STF_DPHY_SCFG_DSI_TXREADY_ESC_SEL_SHIFT 0x1U +#define STF_DPHY_SCFG_DSI_TXREADY_ESC_SEL_MASK GENMASK(2, 1) +#define STF_DPHY_SCFG_PPI_C_READY_SEL_SHIFT 0x3U +#define STF_DPHY_SCFG_PPI_C_READY_SEL_MASK GENMASK(4, 3) + +#define STF_DPHY_REFCLK_IN_SEL_SHIFT 0x1AU +#define STF_DPHY_REFCLK_IN_SEL_MASK GENMASK(28, 26) +#define STF_DPHY_RESETB_SHIFT 0x1DU +#define STF_DPHY_RESETB_MASK BIT(29) + +#define STF_DPHY_REFCLK_12M 1 +#define STF_DPHY_BITRATE_ALIGN 10000000 + +#define STF_MAP_LANES_NUM 5 + +struct m31_dphy_config { + int ref_clk; + unsigned long bitrate; + u32 pll_prev_div; + u32 pll_fbk_int; + u32 pll_fbk_fra; + u32 extd_cycle_sel; + u32 dlane_hs_pre_time; + u32 dlane_hs_zero_time; + u32 dlane_hs_trail_time; + u32 clane_hs_pre_time; + u32 clane_hs_zero_time; + u32 clane_hs_trail_time; + u32 clane_hs_clk_pre_time; + u32 clane_hs_clk_post_time; +}; + +static const struct m31_dphy_config m31_dphy_configs[] = { + {12000000, 490000000, 0x0, 0xa3, 0x55 << 16 | 0x55 << 8 | 0x55, + 0x2, 0xc, 0x1d, 0x14, 0x8, 0x42, 0x12, 0x3, 0x28}, + {12000000, 680000000, 0x0, 0x71, 0x55 << 16 | 0x55 << 8 | 0x55, + 0x1, 0x8, 0x13, 0xe, 0x5, 0x2e, 0xd, 0x1, 0x16}, + {12000000, 750000000, 0x0, 0x7d, 0x0 << 16 | 0x0 << 8 | 0x0, + 0x1, 0x8, 0x16, 0xf, 0x6, 0x32, 0xe, 0x1, 0x17}, + {12000000, 900000000, 0x0, 0x96, 0x0 << 16 | 0x0 << 8 | 0x0, + 0x1, 0xa, 0x19, 0x12, 0x8, 0x3c, 0x10, 0x1, 0x19}, +}; + +struct stf_dphy_info { + /** + * @maps: + * + * Physical lanes and logic lanes mapping table. + * + * The default order is: + * [data lane 0, data lane 1, data lane 2, date lane 3, clk lane] + */ + u8 maps[STF_MAP_LANES_NUM]; +}; + +struct stf_dphy { + struct device *dev; + void __iomem *topsys; + struct clk *txesc_clk; + struct reset_control *sys_rst; + struct reset_control *txbytehs_rst; + + struct phy_configure_opts_mipi_dphy config; + + struct regulator *mipitx_1p8; + struct regulator *mipitx_0p9; + + struct phy *phy; + const struct stf_dphy_info *info; +}; + +static inline u32 stf_dphy_get_reg(void *io_addr, u32 addr, u32 shift, u32 mask) +{ + u32 tmp; + + tmp = readl(io_addr); + tmp = (tmp & mask) >> shift; + return tmp; +} + +static inline void stf_dphy_set_reg(void *io_addr, u32 addr, u32 data, u32 shift, u32 mask) +{ + u32 tmp; + + tmp = readl(io_addr + addr); + tmp &= ~mask; + tmp |= (data << shift) & mask; + writel(tmp, (io_addr + addr)); +} + +static int is_pll_locked(struct stf_dphy *dphy) +{ + int tmp = stf_dphy_get_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(8), + STF_DPHY_RGS_CDTX_PLL_UNLOCK_SHIFT, + STF_DPHY_RGS_CDTX_PLL_UNLOCK_MASK); + return !tmp; +} + +static void stf_dphy_hw_reset(struct stf_dphy *dphy, int assert) +{ + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(100), + !assert, STF_DPHY_RESETB_SHIFT, STF_DPHY_RESETB_MASK); + + if (!assert) { + /*the lock-in time of pll of M31 is 20us-50ms*/ + while ((!is_pll_locked(dphy)) && msecs_to_jiffies(50)) + ; + dev_err(dphy->dev, "MIPI dphy-tx # PLL Locked\n"); + } +} + +static int stf_dphy_configure(struct phy *phy, union phy_configure_opts *opts) +{ + struct stf_dphy *dphy; + u32 bitrate; + unsigned long alignment; + int i; + const struct m31_dphy_config *p; + const u32 STF_DPHY_AON_POWER_READY_N_active = 0; + const struct stf_dphy_info *info; + + dphy = phy_get_drvdata(phy); + info = dphy->info; + bitrate = opts->mipi_dphy.hs_clk_rate; + + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(8), 0x10, + STF_DPHY_RG_CDTX_L0N_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L0N_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L0N_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L0N_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L2N_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L2N_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L3N_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L3N_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(16), 0x10, + STF_DPHY_RG_CDTX_L4N_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L4N_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(8), 0x10, + STF_DPHY_RG_CDTX_L0P_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L0P_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L1P_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L1P_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L2P_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L2P_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(12), 0x10, + STF_DPHY_RG_CDTX_L3P_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L3P_HSTX_RES_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(16), 0x10, + STF_DPHY_RG_CDTX_L4P_HSTX_RES_SHIFT, STF_DPHY_RG_CDTX_L4P_HSTX_RES_MASK); + + alignment = STF_DPHY_BITRATE_ALIGN; + if (bitrate % alignment) + bitrate += alignment - (bitrate % alignment); + + p = m31_dphy_configs; + for (i = 0; i < ARRAY_SIZE(m31_dphy_configs); i++, p++) { + if (p->bitrate == bitrate) { + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(100), + STF_DPHY_REFCLK_12M, STF_DPHY_REFCLK_IN_SEL_SHIFT, + STF_DPHY_REFCLK_IN_SEL_MASK); + + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), + STF_DPHY_AON_POWER_READY_N_active, + STF_DPHY_AON_POWER_READY_N_SHIFT, + STF_DPHY_AON_POWER_READY_N_MASK); + + /*Lane setting*/ + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), info->maps[0], + STF_DPHY_CFG_L0_SWAP_SEL_SHIFT, + STF_DPHY_CFG_L0_SWAP_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), info->maps[1], + STF_DPHY_CFG_L1_SWAP_SEL_SHIFT, + STF_DPHY_CFG_L1_SWAP_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), info->maps[2], + STF_DPHY_CFG_L2_SWAP_SEL_SHIFT, + STF_DPHY_CFG_L2_SWAP_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), info->maps[3], + STF_DPHY_CFG_L3_SWAP_SEL_SHIFT, + STF_DPHY_CFG_L3_SWAP_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(0), info->maps[4], + STF_DPHY_CFG_L4_SWAP_SEL_SHIFT, + STF_DPHY_CFG_L4_SWAP_SEL_MASK); + /*PLL setting*/ + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(28), 0x0, + STF_DPHY_RG_CDTX_PLL_SSC_EN_SHIFT, + STF_DPHY_RG_CDTX_PLL_SSC_EN_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(24), 0x1, + STF_DPHY_RG_CDTX_PLL_LDO_STB_X2_EN_SHIFT, + STF_DPHY_RG_CDTX_PLL_LDO_STB_X2_EN_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(24), 0x1, + STF_DPHY_RG_CDTX_PLL_FM_EN_SHIFT, + STF_DPHY_RG_CDTX_PLL_FM_EN_MASK); + + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(24), + p->pll_prev_div, STF_DPHY_RG_CDTX_PLL_PRE_DIV_SHIFT, + STF_DPHY_RG_CDTX_PLL_PRE_DIV_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(24), + p->pll_fbk_int, STF_DPHY_RG_CDTX_PLL_FBK_INT_SHIFT, + STF_DPHY_RG_CDTX_PLL_FBK_INT_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(20), + p->pll_fbk_fra, STF_DPHY_RG_CDTX_PLL_FBK_FRA_SHIFT, + STF_DPHY_RG_CDTX_PLL_FBK_FRA_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(40), + p->extd_cycle_sel, STF_DPHY_RG_EXTD_CYCLE_SEL_SHIFT, + STF_DPHY_RG_EXTD_CYCLE_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(36), + p->dlane_hs_pre_time, + STF_DPHY_RG_DLANE_HS_PRE_TIME_SHIFT, + STF_DPHY_RG_DLANE_HS_PRE_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(36), + p->dlane_hs_pre_time, + STF_DPHY_RG_DLANE_HS_PRE_TIME_SHIFT, + STF_DPHY_RG_DLANE_HS_PRE_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(36), + p->dlane_hs_zero_time, + STF_DPHY_RG_DLANE_HS_ZERO_TIME_SHIFT, + STF_DPHY_RG_DLANE_HS_ZERO_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(36), + p->dlane_hs_trail_time, + STF_DPHY_RG_DLANE_HS_TRAIL_TIME_SHIFT, + STF_DPHY_RG_DLANE_HS_TRAIL_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(32), + p->clane_hs_pre_time, + STF_DPHY_RG_CLANE_HS_PRE_TIME_SHIFT, + STF_DPHY_RG_CLANE_HS_PRE_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(36), + p->clane_hs_zero_time, + STF_DPHY_RG_CLANE_HS_ZERO_TIME_SHIFT, + STF_DPHY_RG_CLANE_HS_ZERO_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(32), + p->clane_hs_trail_time, + STF_DPHY_RG_CLANE_HS_TRAIL_TIME_SHIFT, + STF_DPHY_RG_CLANE_HS_TRAIL_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(32), + p->clane_hs_clk_pre_time, + STF_DPHY_RG_CLANE_HS_CLK_PRE_TIME_SHIFT, + STF_DPHY_RG_CLANE_HS_CLK_PRE_TIME_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(32), + p->clane_hs_clk_post_time, + STF_DPHY_RG_CLANE_HS_CLK_POST_TIME_SHIFT, + STF_DPHY_RG_CLANE_HS_CLK_POST_TIME_MASK); + + break; + } + } + + return 0; +} + +static int stf_dphy_init(struct phy *phy) +{ + struct stf_dphy *dphy = phy_get_drvdata(phy); + int ret; + + stf_dphy_hw_reset(dphy, 0); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(48), 0, + STF_DPHY_SCFG_PPI_C_READY_SEL_SHIFT, STF_DPHY_SCFG_PPI_C_READY_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(48), 0, + STF_DPHY_SCFG_DSI_TXREADY_ESC_SEL_SHIFT, + STF_DPHY_SCFG_DSI_TXREADY_ESC_SEL_MASK); + stf_dphy_set_reg(dphy->topsys, STF_DPHY_APBIFSAIF_SYSCFG(44), 0x30, + STF_DPHY_SCFG_C_HS_PRE_ZERO_TIME_SHIFT, + STF_DPHY_SCFG_C_HS_PRE_ZERO_TIME_MASK); + + ret = clk_prepare_enable(dphy->txesc_clk); + if (ret) { + dev_err(dphy->dev, "Failed to prepare/enable txesc_clk\n"); + return ret; + } + + ret = reset_control_deassert(dphy->sys_rst); + if (ret) { + dev_err(dphy->dev, "Failed to deassert sys_rst\n"); + return ret; + } + + ret = reset_control_deassert(dphy->txbytehs_rst); + if (ret < 0) { + dev_err(dphy->dev, "Failed to deassert txbytehs_rst\n"); + return ret; + } + + return 0; +} + +static int stf_dphy_exit(struct phy *phy) +{ + struct stf_dphy *dphy = phy_get_drvdata(phy); + int ret; + + ret = reset_control_assert(dphy->txbytehs_rst); + if (ret < 0) { + dev_err(dphy->dev, "Failed to assert txbytehs_rst\n"); + return ret; + } + + ret = reset_control_assert(dphy->sys_rst); + if (ret) { + dev_err(dphy->dev, "Failed to assert sys_rst\n"); + return ret; + } + + clk_disable_unprepare(dphy->txesc_clk); + + stf_dphy_hw_reset(dphy, 1); + + return 0; +} + +static int stf_dphy_power_on(struct phy *phy) +{ + struct stf_dphy *dphy = phy_get_drvdata(phy); + int ret; + + ret = pm_runtime_resume_and_get(dphy->dev); + if (ret < 0) + return ret; + + ret = regulator_enable(dphy->mipitx_0p9); + if (ret) { + dev_err(dphy->dev, "Cannot enable mipitx_0p9 regulator\n"); + return ret; + } + + return 0; +} + +static int stf_dphy_validate(struct phy *phy, enum phy_mode mode, int submode, + union phy_configure_opts *opts) +{ + if (mode != PHY_MODE_MIPI_DPHY) + return -EINVAL; + + return 0; +} + +static int stf_dphy_power_off(struct phy *phy) +{ + struct stf_dphy *dphy = phy_get_drvdata(phy); + + regulator_disable(dphy->mipitx_0p9); + + pm_runtime_put_sync(dphy->dev); + + return 0; +} + +static const struct phy_ops stf_dphy_ops = { + .power_on = stf_dphy_power_on, + .power_off = stf_dphy_power_off, + .init = stf_dphy_init, + .exit = stf_dphy_exit, + .configure = stf_dphy_configure, + .validate = stf_dphy_validate, + .owner = THIS_MODULE, +}; + +static int stf_dphy_probe(struct platform_device *pdev) +{ + struct phy_provider *phy_provider; + struct stf_dphy *dphy; + int ret; + + dphy = devm_kzalloc(&pdev->dev, sizeof(*dphy), GFP_KERNEL); + if (!dphy) + return -ENOMEM; + + dphy->info = of_device_get_match_data(&pdev->dev); + + dphy->dev = &pdev->dev; + dev_set_drvdata(&pdev->dev, dphy); + + dphy->topsys = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(dphy->topsys)) { + ret = PTR_ERR(dphy->topsys); + return ret; + } + + pm_runtime_enable(&pdev->dev); + + dphy->mipitx_0p9 = devm_regulator_get(&pdev->dev, "mipi_0p9"); + if (IS_ERR(dphy->mipitx_0p9)) { + ret = PTR_ERR(dphy->mipitx_0p9); + return ret; + } + + dphy->txesc_clk = devm_clk_get(&pdev->dev, "dphy_txesc"); + if (IS_ERR(dphy->txesc_clk)) { + ret = PTR_ERR(dphy->txesc_clk); + dev_err(&pdev->dev, "txesc_clk get error\n"); + return ret; + } + + dphy->sys_rst = reset_control_get_exclusive(&pdev->dev, "dphy_sys"); + if (IS_ERR(dphy->sys_rst)) { + ret = PTR_ERR(dphy->sys_rst); + dev_err(&pdev->dev, "sys_rst get error\n"); + return ret; + } + + dphy->txbytehs_rst = reset_control_get_exclusive(&pdev->dev, "dsi_txbytehs"); + if (IS_ERR(dphy->txbytehs_rst)) { + dev_err(&pdev->dev, "Failed to get txbytehs_rst\n"); + return PTR_ERR(dphy->txbytehs_rst); + } + + dphy->phy = devm_phy_create(&pdev->dev, NULL, &stf_dphy_ops); + if (IS_ERR(dphy->phy)) { + ret = PTR_ERR(dphy->phy); + dev_err(&pdev->dev, "Failed to create phy\n"); + return ret; + } + phy_set_drvdata(dphy->phy, dphy); + + phy_provider = devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate); + if (IS_ERR(phy_provider)) { + ret = PTR_ERR(phy_provider); + dev_err(&pdev->dev, "Failed to create phy\n"); + return ret; + } + + return PTR_ERR_OR_ZERO(phy_provider); +} + +static const struct stf_dphy_info starfive_dphy_info = { + .maps = {0, 1, 2, 3, 4}, +}; + +static const struct of_device_id stf_dphy_dt_ids[] = { + { + .compatible = "starfive,jh7110-dphy-tx", + .data = &starfive_dphy_info, + }, + { /* sentinel */ }, +}; +MODULE_DEVICE_TABLE(of, stf_dphy_dt_ids); + +static struct platform_driver stf_dphy_driver = { + .driver = { + .name = "starfive-dphy-tx", + .of_match_table = stf_dphy_dt_ids, + }, + .probe = stf_dphy_probe, +}; +module_platform_driver(stf_dphy_driver); + +MODULE_AUTHOR("Keith Zhao "); +MODULE_AUTHOR("Shengyang Chen "); +MODULE_DESCRIPTION("StarFive JH7110 DPHY TX driver"); +MODULE_LICENSE("GPL");