From patchwork Sun Feb 18 04:16:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561659 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 22F47C48BC4 for ; Sun, 18 Feb 2024 04:17:13 +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=SW3SXI3wLSg4n8tSfH3AZEflJCdHuhuTZ8L++2+dP+k=; b=H/p5OiogCF4BqQ rGzbAoGD3M8GuCYfl/KBsybVIa1Ys7dDE69LZ9U60Jtkz50QinY/Ols6NZmd5cWCFmmTK+cff5uxh 1s3qwfUrAOZ+Y4ESu+jc301hO3e1oCZzk94RRokjgdaXPut9X8/oZRAU+NhbPI5ZrbAGmh/wHnCcY T/8W7aeoiW806ztM9ERYMcOxoSwsu8JU+DXhkPjpMn+yQ4O0SmmdVWcvLut3xVEpvv3lacxBEq/Zf DdQwTY+B2OVSr3viwUcf0EstxyXgBVhZfKcahNTJuH3LumVGCW5pguETkFkdxIVkj5xWb6LUrf0zx rUAasVQC/d6S3AQuaW+g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc4-00000006xFj-2sPE; Sun, 18 Feb 2024 04:17:12 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYbu-00000006xCr-416w; Sun, 18 Feb 2024 04:17:04 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-68f571be9ddso4311246d6.0; Sat, 17 Feb 2024 20:17:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229821; x=1708834621; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Fq4bA2B7Uab8ElK+yYy6D/1DzFXoNcJhp7LrG8FrCM=; b=mzjuLFcIVcJJFXDNerpComH0yS4O5jBqMlp4XjURdtKjIQUf6NkKy77JOoO2Zb3jOB eFmPWUGgvcPmCpfhfSvbI2Th41lN3ejw9aBVAUQHRJ1PV9Ud4/d/t60/GlKLO4QU86TE 9dftTYezBIcce7Twd9et6VAPoumL8GQoCGkO8tcVTl5q9Ms9KJOQCyrTJEyQyvcolMLb EzjhtfoEJUBQBYq5w8FuZsEdiCq/YrvP7ciguUDLlC70l/yJJoxOIJ02/ovHsez1Yrqh x5Km+1ysPdL0clyfIX8sjKq1jdwrP5ZD/KLwfjf30iG6cfNvo3jw7qyGKPBpxNTzgeAn gEYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229821; x=1708834621; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Fq4bA2B7Uab8ElK+yYy6D/1DzFXoNcJhp7LrG8FrCM=; b=lK+NO/pS/5njhETNlrCXoIq8mnI3H8GFaBP4tQ7aFHOVvQHp6vK+BKRjXNqWNTtWQi dfhGmDFCHO3o6oPoLMHdD/6SJ7y1EW874+lTZZvJkEQnoQio1aGoxTMM9EzWNhg8EVNL 7mLUFRtXWty3CamDCG3FcBj24Kt4o1Qo+EF6OyqOzqCKc3V5Ac9urMgb4IwzCIeKotqC xmrVhzrar77q6hZkn6VY3NLPSaWWlvT5t0MH5WuH0BbITw1aAXhbSrDskN+soiqUJWfw ioVZerRuRBHHvkzVaEFlnGGAgZK5H/KeDHvkHHin5M9qSzQLhIaTcRrS4sQ42+p0OEfl dF3Q== X-Forwarded-Encrypted: i=1; AJvYcCUGUDRSfqqH+5DhSLuAGOtZYlY21k3T9olKszGsekABT4CdaihD6xqzFnkC039BJhz7+yUYUYHZxkjijxexS+hGSV0mVFMM+2He9i0lAQ== X-Gm-Message-State: AOJu0YzRPfpNGE712rKRqUzIq2yyjtqadlgU4axztQfh6hZ9uDz3R6dp 6wzjOksXPiLOgAoHwDvgIt5f4d4Q18QPq+HbD3supnLSADYLZoLwN4trohyM/uBJgg== X-Google-Smtp-Source: AGHT+IGritm84ppKVGSlKy4xkX4YLdWt7O63XdwK0HFToXgFfZ8nmKSmcea6yUr4GkBeb5ION6xPXA== X-Received: by 2002:a05:6214:21e8:b0:68f:60fd:d328 with SMTP id p8-20020a05621421e800b0068f60fdd328mr353063qvj.43.1708229821553; Sat, 17 Feb 2024 20:17:01 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:01 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Lucas Stach , Adam Ford , Krzysztof Kozlowski , Luca Ceresoli , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 1/6] dt-bindings: phy: add binding for the i.MX8MP HDMI PHY Date: Sat, 17 Feb 2024 22:16:39 -0600 Message-ID: <20240218041649.1209173-2-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201703_029964_AD49A93C X-CRM114-Status: GOOD ( 15.27 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Lucas Stach Add a DT binding for the HDMI PHY found on the i.MX8MP SoC. Signed-off-by: Lucas Stach Signed-off-by: Adam Ford Reviewed-by: Krzysztof Kozlowski Reviewed-by: Luca Ceresoli --- V5: No Change V4: No Change V3: Removed mintems at the request of Krzysztof and add his reviewed-by V2: I (Adam) tried to help move this along, so I took Lucas' patch and attempted to apply fixes based on feedback. I don't have all the history, so apologies for that. Added phy-cells to the required list and fixed an error due to the word 'binding' being in the title. --- .../bindings/phy/fsl,imx8mp-hdmi-phy.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml diff --git a/Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml b/Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml new file mode 100644 index 000000000000..c43e86a8c2e0 --- /dev/null +++ b/Documentation/devicetree/bindings/phy/fsl,imx8mp-hdmi-phy.yaml @@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/phy/fsl,imx8mp-hdmi-phy.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Freescale i.MX8MP HDMI PHY + +maintainers: + - Lucas Stach + +properties: + compatible: + enum: + - fsl,imx8mp-hdmi-phy + + reg: + maxItems: 1 + + "#clock-cells": + const: 0 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: apb + - const: ref + + "#phy-cells": + const: 0 + + power-domains: + maxItems: 1 + +required: + - compatible + - reg + - "#clock-cells" + - clocks + - clock-names + - "#phy-cells" + - power-domains + +additionalProperties: false + +examples: + - | + #include + #include + + phy@32fdff00 { + compatible = "fsl,imx8mp-hdmi-phy"; + reg = <0x32fdff00 0x100>; + clocks = <&clk IMX8MP_CLK_HDMI_APB>, + <&clk IMX8MP_CLK_HDMI_24M>; + clock-names = "apb", "ref"; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX_PHY>; + #clock-cells = <0>; + #phy-cells = <0>; + }; From patchwork Sun Feb 18 04:16:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561660 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 BEB37C5475B for ; Sun, 18 Feb 2024 04:17:14 +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=qhvPNhzA/XUMcVdz53m6cC1Kt4aAxGo2fNKVcXPLKpc=; b=Nofan/g2vnN8p4 G/CgAgo6QZCq6VSfN4G/cEzNFeVL/DQcOQCMP4wWDZG1ymYu7lqb4BT3iu/u0eBc8ZqsZV1e3tY5Z 38XSxY7iP48YUiR1g95UaNRys78vONq9zfvuQA5ZhW5W+djr2vOid8/dpNEHx+kZe7649SecKc3eD GFfEqhTbJjGF/UIujr7X9peYL2piCBIe/iD1671Ml+tioZzlol+2FPO3RvcM0ZEnUeZzS+tA4rjIG HfhJO1/kJiqYxQYm5Z9kkVRKSn0ZZvO1z8w8yEb8hh0KW4VitOzewkOAvIMjfngpUpmPSCJrphtaa YUeGjTR7ZH1QBfu6o4pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc6-00000006xH9-0yXs; Sun, 18 Feb 2024 04:17:14 +0000 Received: from mail-qv1-xf30.google.com ([2607:f8b0:4864:20::f30]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYby-00000006xDW-0ucO; Sun, 18 Feb 2024 04:17:08 +0000 Received: by mail-qv1-xf30.google.com with SMTP id 6a1803df08f44-6861538916cso19976056d6.3; Sat, 17 Feb 2024 20:17:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229824; x=1708834624; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6p07jBrcIifoejzBbOlEFNtmxBAzsMa0m8ZTjhvcA1s=; b=D3Vyx9LZMEVI3guoeJx/Pf4I8S5yGJ6U9xabkHbZGh83qHuUtcCbIM/8SMngx81AQA oDfj8mo5+oZ1hvpKH99YI5wM6wTF4PuGnHRFkuJ0/QlSuxJvi8m28RNVZDTmu+M9fsgX ZuE6VNGyOvDQPxqYHpOmZ/rdNcf7qM+BWFhYn9esitdWqALKJrlGSnWhphA4YOyoYe/t YXvWkJgT6mHFzVk5oVt9hd6LM2GRXzb59OYIIDJL749/iblwmQkoqtr86YpXU5XHeIrB GyBiojl+2Lms/waDArN3Pi2r9cIb6X+aGbR9yfJYRzstQQedDkQ/PGQnrjtSi7qOTQeF KOuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229824; x=1708834624; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6p07jBrcIifoejzBbOlEFNtmxBAzsMa0m8ZTjhvcA1s=; b=ob0MiaZXQgvhmxrbUwhQt09R7goJNP8kTxdDg4Zdv72g+orA02KGgU/uBxAlUN2Bqd xc1uTnpRHPWYa/1e8vyhtyTdJXiZ/dIGhpHIE9XfBj2R8Vk+OqeFj6IMfOPZ2w6rp+n8 iafwqUO7oRt25DOC2cTbCRlFAAQa4uHv0zVSxovVRysGUBsJyt+Guaf7SoObQknQY/RX xxj+8mVBgpAXcaf0Q/oaCzcL85f5tajZxQhiqIMf74TBCgsVIEXGO7a3XaIDdedKgMWF PHa6CPbMZQ5b3bo7mQxvTHT2nVmAwb+PTPXsvYD9tS8Nlri9EtTh0h4CuZeeKAkp1Vld q6lw== X-Forwarded-Encrypted: i=1; AJvYcCXzTYETO5jgXQI49n9T71YwIfKX8q2Cx/Dae73tr+cy068D9NDf/nGIwBcYFoslSYCVO8uPOdeudxaUpmLzU687/UtD3hxSjM1uejcJ0Q== X-Gm-Message-State: AOJu0YxgKMdKuN79RrB9N2oXm8beGPsQTCetrBRvXdaFR2mBiFK4B543 6M14RotWQCR0O9vTJ8zGtVANS9WTVXfYViJAde/L5pkw7nazejq6R9XTrRsYVdWwMg== X-Google-Smtp-Source: AGHT+IGPNgE0qV4Ojtyt2LESXJP1aTanWM+HebJZPkXfqfbPh6sBCA8s8C8/ScLYd6q3pHfhY+MVNQ== X-Received: by 2002:a0c:f312:0:b0:68f:5926:59e8 with SMTP id j18-20020a0cf312000000b0068f592659e8mr1374814qvl.38.1708229824161; Sat, 17 Feb 2024 20:17:04 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:03 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Lucas Stach , Luca Ceresoli , Richard Leitner , Marco Felsch , Alexander Stein , Frieder Schrempf , Adam Ford , Marek Vasut , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 2/6] phy: freescale: add Samsung HDMI PHY Date: Sat, 17 Feb 2024 22:16:40 -0600 Message-ID: <20240218041649.1209173-3-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201706_316271_2BC9230C X-CRM114-Status: GOOD ( 20.01 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Lucas Stach This adds the driver for the Samsung HDMI PHY found on the i.MX8MP SoC. Based on downstream implementation from Sandor Yu . According to the TRM, the PHY receives parallel data from the link and serializes it. It also sets the PLL clock needed for the TX serializer. Tested-by: Luca Ceresoli (v2) Tested-by: Richard Leitner (v2) Co-developed-by: Marco Felsch Signed-off-by: Marco Felsch Signed-off-by: Lucas Stach Tested-by: Alexander Stein Tested-by: Frieder Schrempf # Kontron BL Signed-off-by: Adam Ford Tested-by: Marek Vasut Tested-by: Luca Ceresoli --- V5: Remove an unnecessary include Migrate from of_clk_add_provider to of_clk_add_hw_provider Make const structures static Fix uninitialized variables and prevent div by 0 Mark PM functions as __maybe_unused V4: - I (Adam) added a comment in the code for clarifcation based on questions from Luca concerning a difference between the code and the ref manual. - Fixed the GENMASK on REG14 - Expanded the commit message briefly describing a bit more of what this driver does. - Removed some unnecessary include files. v3: - use GENMASK/FIELD_PREP - lowercase hex values - correct coding style v2: - use DEFINE_RUNTIME_DEV_PM_OPS --- drivers/phy/freescale/Kconfig | 6 + drivers/phy/freescale/Makefile | 1 + drivers/phy/freescale/phy-fsl-samsung-hdmi.c | 720 +++++++++++++++++++ 3 files changed, 727 insertions(+) create mode 100644 drivers/phy/freescale/phy-fsl-samsung-hdmi.c diff --git a/drivers/phy/freescale/Kconfig b/drivers/phy/freescale/Kconfig index 853958fb2c06..5c2b73042dfc 100644 --- a/drivers/phy/freescale/Kconfig +++ b/drivers/phy/freescale/Kconfig @@ -35,6 +35,12 @@ config PHY_FSL_IMX8M_PCIE Enable this to add support for the PCIE PHY as found on i.MX8M family of SOCs. +config PHY_FSL_SAMSUNG_HDMI_PHY + tristate "Samsung HDMI PHY support" + depends on OF && HAS_IOMEM + help + Enable this to add support for the Samsung HDMI PHY in i.MX8MP. + endif config PHY_FSL_LYNX_28G diff --git a/drivers/phy/freescale/Makefile b/drivers/phy/freescale/Makefile index cedb328bc4d2..c4386bfdb853 100644 --- a/drivers/phy/freescale/Makefile +++ b/drivers/phy/freescale/Makefile @@ -4,3 +4,4 @@ obj-$(CONFIG_PHY_MIXEL_LVDS_PHY) += phy-fsl-imx8qm-lvds-phy.o obj-$(CONFIG_PHY_MIXEL_MIPI_DPHY) += phy-fsl-imx8-mipi-dphy.o obj-$(CONFIG_PHY_FSL_IMX8M_PCIE) += phy-fsl-imx8m-pcie.o obj-$(CONFIG_PHY_FSL_LYNX_28G) += phy-fsl-lynx-28g.o +obj-$(CONFIG_PHY_FSL_SAMSUNG_HDMI_PHY) += phy-fsl-samsung-hdmi.o diff --git a/drivers/phy/freescale/phy-fsl-samsung-hdmi.c b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c new file mode 100644 index 000000000000..89e2c01f2ccf --- /dev/null +++ b/drivers/phy/freescale/phy-fsl-samsung-hdmi.c @@ -0,0 +1,720 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 NXP + * Copyright 2022 Pengutronix, Lucas Stach + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define PHY_REG_00 0x00 +#define PHY_REG_01 0x04 +#define PHY_REG_02 0x08 +#define PHY_REG_08 0x20 +#define PHY_REG_09 0x24 +#define PHY_REG_10 0x28 +#define PHY_REG_11 0x2c + +#define PHY_REG_12 0x30 +#define REG12_CK_DIV_MASK GENMASK(5, 4) + +#define PHY_REG_13 0x34 +#define REG13_TG_CODE_LOW_MASK GENMASK(7, 0) + +#define PHY_REG_14 0x38 +#define REG14_TOL_MASK GENMASK(7, 4) +#define REG14_RP_CODE_MASK GENMASK(3, 1) +#define REG14_TG_CODE_HIGH_MASK GENMASK(0, 0) + +#define PHY_REG_15 0x3c +#define PHY_REG_16 0x40 +#define PHY_REG_17 0x44 +#define PHY_REG_18 0x48 +#define PHY_REG_19 0x4c +#define PHY_REG_20 0x50 + +#define PHY_REG_21 0x54 +#define REG21_SEL_TX_CK_INV BIT(7) +#define REG21_PMS_S_MASK GENMASK(3, 0) + +#define PHY_REG_22 0x58 +#define PHY_REG_23 0x5c +#define PHY_REG_24 0x60 +#define PHY_REG_25 0x64 +#define PHY_REG_26 0x68 +#define PHY_REG_27 0x6c +#define PHY_REG_28 0x70 +#define PHY_REG_29 0x74 +#define PHY_REG_30 0x78 +#define PHY_REG_31 0x7c +#define PHY_REG_32 0x80 + +/* + * REG33 does not match the ref manual. According to Sandor Yu from NXP, + * "There is a doc issue on the i.MX8MP latest RM" + * REG33 is being used per guidance from Sandor + */ + +#define PHY_REG_33 0x84 +#define REG33_MODE_SET_DONE BIT(7) +#define REG33_FIX_DA BIT(1) + +#define PHY_REG_34 0x88 +#define REG34_PHY_READY BIT(7) +#define REG34_PLL_LOCK BIT(6) +#define REG34_PHY_CLK_READY BIT(5) + +#define PHY_REG_35 0x8c +#define PHY_REG_36 0x90 +#define PHY_REG_37 0x94 +#define PHY_REG_38 0x98 +#define PHY_REG_39 0x9c +#define PHY_REG_40 0xa0 +#define PHY_REG_41 0xa4 +#define PHY_REG_42 0xa8 +#define PHY_REG_43 0xac +#define PHY_REG_44 0xb0 +#define PHY_REG_45 0xb4 +#define PHY_REG_46 0xb8 +#define PHY_REG_47 0xbc + +#define PHY_PLL_DIV_REGS_NUM 6 + +struct phy_config { + u32 pixclk; + u8 pll_div_regs[PHY_PLL_DIV_REGS_NUM]; +}; + +static const struct phy_config phy_pll_cfg[] = { + { + .pixclk = 22250000, + .pll_div_regs = { 0x4b, 0xf1, 0x89, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 23750000, + .pll_div_regs = { 0x50, 0xf1, 0x86, 0x85, 0x80, 0x40 }, + }, { + .pixclk = 24000000, + .pll_div_regs = { 0x50, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 24024000, + .pll_div_regs = { 0x50, 0xf1, 0x99, 0x02, 0x80, 0x40 }, + }, { + .pixclk = 25175000, + .pll_div_regs = { 0x54, 0xfc, 0xcc, 0x91, 0x80, 0x40 }, + }, { + .pixclk = 25200000, + .pll_div_regs = { 0x54, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 26750000, + .pll_div_regs = { 0x5a, 0xf2, 0x89, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 27000000, + .pll_div_regs = { 0x5a, 0xf0, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 27027000, + .pll_div_regs = { 0x5a, 0xf2, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 29500000, + .pll_div_regs = { 0x62, 0xf4, 0x95, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 30750000, + .pll_div_regs = { 0x66, 0xf4, 0x82, 0x01, 0x88, 0x45 }, + }, { + .pixclk = 30888000, + .pll_div_regs = { 0x66, 0xf4, 0x99, 0x18, 0x88, 0x45 }, + }, { + .pixclk = 33750000, + .pll_div_regs = { 0x70, 0xf4, 0x82, 0x01, 0x80, 0x40 }, + }, { + .pixclk = 35000000, + .pll_div_regs = { 0x58, 0xb8, 0x8b, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 36000000, + .pll_div_regs = { 0x5a, 0xb0, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 36036000, + .pll_div_regs = { 0x5a, 0xb2, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 40000000, + .pll_div_regs = { 0x64, 0xb0, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 43200000, + .pll_div_regs = { 0x5a, 0x90, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 43243200, + .pll_div_regs = { 0x5a, 0x92, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 44500000, + .pll_div_regs = { 0x5c, 0x92, 0x98, 0x11, 0x84, 0x41 }, + }, { + .pixclk = 47000000, + .pll_div_regs = { 0x62, 0x94, 0x95, 0x82, 0x80, 0x40 }, + }, { + .pixclk = 47500000, + .pll_div_regs = { 0x63, 0x96, 0xa1, 0x82, 0x80, 0x40 }, + }, { + .pixclk = 50349650, + .pll_div_regs = { 0x54, 0x7c, 0xc3, 0x8f, 0x80, 0x40 }, + }, { + .pixclk = 50400000, + .pll_div_regs = { 0x54, 0x70, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 53250000, + .pll_div_regs = { 0x58, 0x72, 0x84, 0x03, 0x82, 0x41 }, + }, { + .pixclk = 53500000, + .pll_div_regs = { 0x5a, 0x72, 0x89, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 54000000, + .pll_div_regs = { 0x5a, 0x70, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 54054000, + .pll_div_regs = { 0x5a, 0x72, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 59000000, + .pll_div_regs = { 0x62, 0x74, 0x95, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 59340659, + .pll_div_regs = { 0x62, 0x74, 0xdb, 0x52, 0x88, 0x47 }, + }, { + .pixclk = 59400000, + .pll_div_regs = { 0x63, 0x70, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 61500000, + .pll_div_regs = { 0x66, 0x74, 0x82, 0x01, 0x88, 0x45 }, + }, { + .pixclk = 63500000, + .pll_div_regs = { 0x69, 0x74, 0x89, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 67500000, + .pll_div_regs = { 0x54, 0x52, 0x87, 0x03, 0x80, 0x40 }, + }, { + .pixclk = 70000000, + .pll_div_regs = { 0x58, 0x58, 0x8b, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 72000000, + .pll_div_regs = { 0x5a, 0x50, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 72072000, + .pll_div_regs = { 0x5a, 0x52, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 74176000, + .pll_div_regs = { 0x5d, 0x58, 0xdb, 0xA2, 0x88, 0x41 }, + }, { + .pixclk = 74250000, + .pll_div_regs = { 0x5c, 0x52, 0x90, 0x0d, 0x84, 0x41 }, + }, { + .pixclk = 78500000, + .pll_div_regs = { 0x62, 0x54, 0x87, 0x01, 0x80, 0x40 }, + }, { + .pixclk = 80000000, + .pll_div_regs = { 0x64, 0x50, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 82000000, + .pll_div_regs = { 0x66, 0x54, 0x82, 0x01, 0x88, 0x45 }, + }, { + .pixclk = 82500000, + .pll_div_regs = { 0x67, 0x54, 0x88, 0x01, 0x90, 0x49 }, + }, { + .pixclk = 89000000, + .pll_div_regs = { 0x70, 0x54, 0x84, 0x83, 0x80, 0x40 }, + }, { + .pixclk = 90000000, + .pll_div_regs = { 0x70, 0x54, 0x82, 0x01, 0x80, 0x40 }, + }, { + .pixclk = 94000000, + .pll_div_regs = { 0x4e, 0x32, 0xa7, 0x10, 0x80, 0x40 }, + }, { + .pixclk = 95000000, + .pll_div_regs = { 0x50, 0x31, 0x86, 0x85, 0x80, 0x40 }, + }, { + .pixclk = 98901099, + .pll_div_regs = { 0x52, 0x3a, 0xdb, 0x4c, 0x88, 0x47 }, + }, { + .pixclk = 99000000, + .pll_div_regs = { 0x52, 0x32, 0x82, 0x01, 0x88, 0x47 }, + }, { + .pixclk = 100699300, + .pll_div_regs = { 0x54, 0x3c, 0xc3, 0x8f, 0x80, 0x40 }, + }, { + .pixclk = 100800000, + .pll_div_regs = { 0x54, 0x30, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 102500000, + .pll_div_regs = { 0x55, 0x32, 0x8c, 0x05, 0x90, 0x4b }, + }, { + .pixclk = 104750000, + .pll_div_regs = { 0x57, 0x32, 0x98, 0x07, 0x90, 0x49 }, + }, { + .pixclk = 106500000, + .pll_div_regs = { 0x58, 0x32, 0x84, 0x03, 0x82, 0x41 }, + }, { + .pixclk = 107000000, + .pll_div_regs = { 0x5a, 0x32, 0x89, 0x88, 0x80, 0x40 }, + }, { + .pixclk = 108000000, + .pll_div_regs = { 0x5a, 0x30, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 108108000, + .pll_div_regs = { 0x5a, 0x32, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 118000000, + .pll_div_regs = { 0x62, 0x34, 0x95, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 118800000, + .pll_div_regs = { 0x63, 0x30, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 123000000, + .pll_div_regs = { 0x66, 0x34, 0x82, 0x01, 0x88, 0x45 }, + }, { + .pixclk = 127000000, + .pll_div_regs = { 0x69, 0x34, 0x89, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 135000000, + .pll_div_regs = { 0x70, 0x34, 0x82, 0x01, 0x80, 0x40 }, + }, { + .pixclk = 135580000, + .pll_div_regs = { 0x71, 0x39, 0xe9, 0x82, 0x9c, 0x5b }, + }, { + .pixclk = 137520000, + .pll_div_regs = { 0x72, 0x38, 0x99, 0x10, 0x85, 0x41 }, + }, { + .pixclk = 138750000, + .pll_div_regs = { 0x73, 0x35, 0x88, 0x05, 0x90, 0x4d }, + }, { + .pixclk = 140000000, + .pll_div_regs = { 0x75, 0x36, 0xa7, 0x90, 0x80, 0x40 }, + }, { + .pixclk = 144000000, + .pll_div_regs = { 0x78, 0x30, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 148352000, + .pll_div_regs = { 0x7b, 0x35, 0xdb, 0x39, 0x90, 0x45 }, + }, { + .pixclk = 148500000, + .pll_div_regs = { 0x7b, 0x35, 0x84, 0x03, 0x90, 0x45 }, + }, { + .pixclk = 154000000, + .pll_div_regs = { 0x40, 0x18, 0x83, 0x01, 0x00, 0x40 }, + }, { + .pixclk = 157000000, + .pll_div_regs = { 0x41, 0x11, 0xa7, 0x14, 0x80, 0x40 }, + }, { + .pixclk = 160000000, + .pll_div_regs = { 0x42, 0x12, 0xa1, 0x20, 0x80, 0x40 }, + }, { + .pixclk = 162000000, + .pll_div_regs = { 0x43, 0x18, 0x8b, 0x08, 0x96, 0x55 }, + }, { + .pixclk = 164000000, + .pll_div_regs = { 0x45, 0x11, 0x83, 0x82, 0x90, 0x4b }, + }, { + .pixclk = 165000000, + .pll_div_regs = { 0x45, 0x11, 0x84, 0x81, 0x90, 0x4b }, + }, { + .pixclk = 180000000, + .pll_div_regs = { 0x4b, 0x10, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 185625000, + .pll_div_regs = { 0x4e, 0x12, 0x9a, 0x95, 0x80, 0x40 }, + }, { + .pixclk = 188000000, + .pll_div_regs = { 0x4e, 0x12, 0xa7, 0x10, 0x80, 0x40 }, + }, { + .pixclk = 198000000, + .pll_div_regs = { 0x52, 0x12, 0x82, 0x01, 0x88, 0x47 }, + }, { + .pixclk = 205000000, + .pll_div_regs = { 0x55, 0x12, 0x8c, 0x05, 0x90, 0x4b }, + }, { + .pixclk = 209500000, + .pll_div_regs = { 0x57, 0x12, 0x98, 0x07, 0x90, 0x49 }, + }, { + .pixclk = 213000000, + .pll_div_regs = { 0x58, 0x12, 0x84, 0x03, 0x82, 0x41 }, + }, { + .pixclk = 216000000, + .pll_div_regs = { 0x5a, 0x10, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 216216000, + .pll_div_regs = { 0x5a, 0x12, 0xfd, 0x0c, 0x80, 0x40 }, + }, { + .pixclk = 237600000, + .pll_div_regs = { 0x63, 0x10, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 254000000, + .pll_div_regs = { 0x69, 0x14, 0x89, 0x08, 0x80, 0x40 }, + }, { + .pixclk = 277500000, + .pll_div_regs = { 0x73, 0x15, 0x88, 0x05, 0x90, 0x4d }, + }, { + .pixclk = 288000000, + .pll_div_regs = { 0x78, 0x10, 0x00, 0x00, 0x80, 0x00 }, + }, { + .pixclk = 297000000, + .pll_div_regs = { 0x7b, 0x15, 0x84, 0x03, 0x90, 0x45 }, + }, +}; + +struct reg_settings { + u8 reg; + u8 val; +}; + +static const struct reg_settings common_phy_cfg[] = { + { PHY_REG_00, 0x00 }, { PHY_REG_01, 0xd1 }, + { PHY_REG_08, 0x4f }, { PHY_REG_09, 0x30 }, + { PHY_REG_10, 0x33 }, { PHY_REG_11, 0x65 }, + /* REG12 pixclk specific */ + /* REG13 pixclk specific */ + /* REG14 pixclk specific */ + { PHY_REG_15, 0x80 }, { PHY_REG_16, 0x6c }, + { PHY_REG_17, 0xf2 }, { PHY_REG_18, 0x67 }, + { PHY_REG_19, 0x00 }, { PHY_REG_20, 0x10 }, + /* REG21 pixclk specific */ + { PHY_REG_22, 0x30 }, { PHY_REG_23, 0x32 }, + { PHY_REG_24, 0x60 }, { PHY_REG_25, 0x8f }, + { PHY_REG_26, 0x00 }, { PHY_REG_27, 0x00 }, + { PHY_REG_28, 0x08 }, { PHY_REG_29, 0x00 }, + { PHY_REG_30, 0x00 }, { PHY_REG_31, 0x00 }, + { PHY_REG_32, 0x00 }, { PHY_REG_33, 0x80 }, + { PHY_REG_34, 0x00 }, { PHY_REG_35, 0x00 }, + { PHY_REG_36, 0x00 }, { PHY_REG_37, 0x00 }, + { PHY_REG_38, 0x00 }, { PHY_REG_39, 0x00 }, + { PHY_REG_40, 0x00 }, { PHY_REG_41, 0xe0 }, + { PHY_REG_42, 0x83 }, { PHY_REG_43, 0x0f }, + { PHY_REG_44, 0x3E }, { PHY_REG_45, 0xf8 }, + { PHY_REG_46, 0x00 }, { PHY_REG_47, 0x00 } +}; + +struct fsl_samsung_hdmi_phy { + struct device *dev; + void __iomem *regs; + struct clk *apbclk; + struct clk *refclk; + + /* clk provider */ + struct clk_hw hw; + const struct phy_config *cur_cfg; +}; + +static inline struct fsl_samsung_hdmi_phy * +to_fsl_samsung_hdmi_phy(struct clk_hw *hw) +{ + return container_of(hw, struct fsl_samsung_hdmi_phy, hw); +} + +static void +fsl_samsung_hdmi_phy_configure_pixclk(struct fsl_samsung_hdmi_phy *phy, + const struct phy_config *cfg) +{ + u8 div = 0x1; + + switch (cfg->pixclk) { + case 22250000 ... 33750000: + div = 0xf; + break; + case 35000000 ... 40000000: + div = 0xb; + break; + case 43200000 ... 47500000: + div = 0x9; + break; + case 50349650 ... 63500000: + div = 0x7; + break; + case 67500000 ... 90000000: + div = 0x5; + break; + case 94000000 ... 148500000: + div = 0x3; + break; + case 154000000 ... 297000000: + div = 0x1; + break; + } + + writeb(REG21_SEL_TX_CK_INV | FIELD_PREP(REG21_PMS_S_MASK, div), + phy->regs + PHY_REG_21); +} + +static void +fsl_samsung_hdmi_phy_configure_pll_lock_det(struct fsl_samsung_hdmi_phy *phy, + const struct phy_config *cfg) +{ + u32 pclk = cfg->pixclk; + u32 fld_tg_code; + u32 pclk_khz; + u8 div = 1; + + switch (cfg->pixclk) { + case 22250000 ... 47500000: + div = 1; + break; + case 50349650 ... 99000000: + div = 2; + break; + case 100699300 ... 198000000: + div = 4; + break; + case 205000000 ... 297000000: + div = 8; + break; + } + + writeb(FIELD_PREP(REG12_CK_DIV_MASK, ilog2(div)), phy->regs + PHY_REG_12); + + /* + * Calculation for the frequency lock detector target code (fld_tg_code) + * is based on reference manual register description of PHY_REG13 + * (13.10.3.1.14.2): + * 1st) Calculate int_pllclk which is determinded by FLD_CK_DIV + * 2nd) Increase resolution to avoid rounding issues + * 3th) Do the div (256 / Freq. of int_pllclk) * 24 + * 4th) Reduce the resolution and always round up since the NXP + * settings rounding up always too. TODO: Check if that is + * correct. + */ + pclk /= div; + pclk_khz = pclk / 1000; + fld_tg_code = 256 * 1000 * 1000 / pclk_khz * 24; + fld_tg_code = DIV_ROUND_UP(fld_tg_code, 1000); + + /* FLD_TOL and FLD_RP_CODE taken from downstream driver */ + writeb(FIELD_PREP(REG13_TG_CODE_LOW_MASK, fld_tg_code), + phy->regs + PHY_REG_13); + writeb(FIELD_PREP(REG14_TOL_MASK, 2) | + FIELD_PREP(REG14_RP_CODE_MASK, 2) | + FIELD_PREP(REG14_TG_CODE_HIGH_MASK, fld_tg_code >> 8), + phy->regs + PHY_REG_14); +} + +static int fsl_samsung_hdmi_phy_configure(struct fsl_samsung_hdmi_phy *phy, + const struct phy_config *cfg) +{ + int i, ret; + u8 val; + + /* HDMI PHY init */ + writeb(REG33_FIX_DA, phy->regs + PHY_REG_33); + + /* common PHY registers */ + for (i = 0; i < ARRAY_SIZE(common_phy_cfg); i++) + writeb(common_phy_cfg[i].val, phy->regs + common_phy_cfg[i].reg); + + /* set individual PLL registers PHY_REG2 ... PHY_REG7 */ + for (i = 0; i < PHY_PLL_DIV_REGS_NUM; i++) + writeb(cfg->pll_div_regs[i], phy->regs + PHY_REG_02 + i * 4); + + fsl_samsung_hdmi_phy_configure_pixclk(phy, cfg); + fsl_samsung_hdmi_phy_configure_pll_lock_det(phy, cfg); + + writeb(REG33_FIX_DA | REG33_MODE_SET_DONE, phy->regs + PHY_REG_33); + + ret = readb_poll_timeout(phy->regs + PHY_REG_34, val, + val & REG34_PLL_LOCK, 50, 20000); + if (ret) + dev_err(phy->dev, "PLL failed to lock\n"); + + return ret; +} + +static unsigned long phy_clk_recalc_rate(struct clk_hw *hw, + unsigned long parent_rate) +{ + struct fsl_samsung_hdmi_phy *phy = to_fsl_samsung_hdmi_phy(hw); + + if (!phy->cur_cfg) + return 74250000; + + return phy->cur_cfg->pixclk; +} + +static long phy_clk_round_rate(struct clk_hw *hw, + unsigned long rate, unsigned long *parent_rate) +{ + int i; + + for (i = ARRAY_SIZE(phy_pll_cfg) - 1; i >= 0; i--) + if (phy_pll_cfg[i].pixclk <= rate) + return phy_pll_cfg[i].pixclk; + + return -EINVAL; +} + +static int phy_clk_set_rate(struct clk_hw *hw, + unsigned long rate, unsigned long parent_rate) +{ + struct fsl_samsung_hdmi_phy *phy = to_fsl_samsung_hdmi_phy(hw); + int i; + + for (i = ARRAY_SIZE(phy_pll_cfg) - 1; i >= 0; i--) + if (phy_pll_cfg[i].pixclk <= rate) + break; + + if (i < 0) + return -EINVAL; + + phy->cur_cfg = &phy_pll_cfg[i]; + + return fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); +} + +static const struct clk_ops phy_clk_ops = { + .recalc_rate = phy_clk_recalc_rate, + .round_rate = phy_clk_round_rate, + .set_rate = phy_clk_set_rate, +}; + +static int phy_clk_register(struct fsl_samsung_hdmi_phy *phy) +{ + struct device *dev = phy->dev; + struct device_node *np = dev->of_node; + struct clk_init_data init; + const char *parent_name; + struct clk *phyclk; + int ret; + + parent_name = __clk_get_name(phy->refclk); + + init.parent_names = &parent_name; + init.num_parents = 1; + init.flags = 0; + init.name = "hdmi_pclk"; + init.ops = &phy_clk_ops; + + phy->hw.init = &init; + + phyclk = devm_clk_register(dev, &phy->hw); + if (IS_ERR(phyclk)) + return dev_err_probe(dev, PTR_ERR(phyclk), + "failed to register clock\n"); + + ret = of_clk_add_hw_provider(np, of_clk_hw_simple_get, phyclk); + if (ret) + return dev_err_probe(dev, ret, + "failed to register clock provider\n"); + + return 0; +} + +static int fsl_samsung_hdmi_phy_probe(struct platform_device *pdev) +{ + struct fsl_samsung_hdmi_phy *phy; + int ret; + + phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL); + if (!phy) + return -ENOMEM; + + platform_set_drvdata(pdev, phy); + phy->dev = &pdev->dev; + + phy->regs = devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(phy->regs)) + return PTR_ERR(phy->regs); + + phy->apbclk = devm_clk_get(phy->dev, "apb"); + if (IS_ERR(phy->apbclk)) + return dev_err_probe(phy->dev, PTR_ERR(phy->apbclk), + "failed to get apb clk\n"); + + phy->refclk = devm_clk_get(phy->dev, "ref"); + if (IS_ERR(phy->refclk)) + return dev_err_probe(phy->dev, PTR_ERR(phy->refclk), + "failed to get ref clk\n"); + + ret = clk_prepare_enable(phy->apbclk); + if (ret) { + dev_err(phy->dev, "failed to enable apbclk\n"); + return ret; + } + + pm_runtime_get_noresume(phy->dev); + pm_runtime_set_active(phy->dev); + pm_runtime_enable(phy->dev); + + ret = phy_clk_register(phy); + if (ret) { + dev_err(&pdev->dev, "register clk failed\n"); + goto register_clk_failed; + } + + pm_runtime_put(phy->dev); + + return 0; + +register_clk_failed: + clk_disable_unprepare(phy->apbclk); + + return ret; +} + +static int fsl_samsung_hdmi_phy_remove(struct platform_device *pdev) +{ + of_clk_del_provider(pdev->dev.of_node); + + return 0; +} + +static int __maybe_unused fsl_samsung_hdmi_phy_suspend(struct device *dev) +{ + struct fsl_samsung_hdmi_phy *phy = dev_get_drvdata(dev); + + clk_disable_unprepare(phy->apbclk); + + return 0; +} + +static int __maybe_unused fsl_samsung_hdmi_phy_resume(struct device *dev) +{ + struct fsl_samsung_hdmi_phy *phy = dev_get_drvdata(dev); + int ret = 0; + + ret = clk_prepare_enable(phy->apbclk); + if (ret) { + dev_err(phy->dev, "failed to enable apbclk\n"); + return ret; + } + + if (phy->cur_cfg) + ret = fsl_samsung_hdmi_phy_configure(phy, phy->cur_cfg); + + return ret; + +} + +static DEFINE_RUNTIME_DEV_PM_OPS(fsl_samsung_hdmi_phy_pm_ops, + fsl_samsung_hdmi_phy_suspend, + fsl_samsung_hdmi_phy_resume, NULL); + +static const struct of_device_id fsl_samsung_hdmi_phy_of_match[] = { + { + .compatible = "fsl,imx8mp-hdmi-phy", + }, { + /* sentinel */ + } +}; +MODULE_DEVICE_TABLE(of, fsl_samsung_hdmi_phy_of_match); + +static struct platform_driver fsl_samsung_hdmi_phy_driver = { + .probe = fsl_samsung_hdmi_phy_probe, + .remove = fsl_samsung_hdmi_phy_remove, + .driver = { + .name = "fsl-samsung-hdmi-phy", + .of_match_table = fsl_samsung_hdmi_phy_of_match, + .pm = pm_ptr(&fsl_samsung_hdmi_phy_pm_ops), + }, +}; +module_platform_driver(fsl_samsung_hdmi_phy_driver); + +MODULE_AUTHOR("Sandor Yu "); +MODULE_DESCRIPTION("SAMSUNG HDMI 2.0 Transmitter PHY Driver"); +MODULE_LICENSE("GPL"); From patchwork Sun Feb 18 04:16:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561661 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 DC81CC48BC4 for ; Sun, 18 Feb 2024 04:17:19 +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=fEsf45+8UgB+D26WL+qnenHkCDawf1/XsySxNOwtBS4=; b=EVdKXHNM0MXF5u 7qbwg1/RRfABuEsJhVGVPRDw5xlN9+VdVznUK9JAR/v0kE4jKyEJk3APBbvlet/yAfqXShQ49Bc1q eedLoYzTuyNILQ5M+jFu73x5eoctdzZKRcZQJDwHrURWHswmCABm8UDioq4WMExPGwEYFkVl8oHW4 1EPfDTzzEZ76JU5Zg56MluajLmyUS9qpyNcanN2BnZl2HVB/7nQNOJE60APB8hkWN3o5B34UbwwJa s+mVT0szl5lZ5/YmXRGNhMDJPxpD+i++USeobuFySEaWNa6Aio7Mym5FhjlkILBqFLtH/q7IcrdKy kx9mFDGzlvDuB9z8e8Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYcB-00000006xKI-28JU; Sun, 18 Feb 2024 04:17:19 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc0-00000006xEA-302h; Sun, 18 Feb 2024 04:17:10 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-68f01133850so16678236d6.3; Sat, 17 Feb 2024 20:17:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229827; x=1708834627; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7kmAGwgibsE40CKblzU9xPszVIKszLetJVWs39LtLs4=; b=UT7Y3SU9bBSQMlK+qm0BPQLs/FXJvW2pXtcxOWrEp2cMHOw9j/HFeuYCoo7mL4uMUY 5X7bwBeZiWyBtAt39Wcnrg7FmkMjD828bxo776nuZ3Yw9R0th95H99f3meCgUKHU9Jrn j2104AqkTxAZxugM+M4gt0NfyhMDGo+sgKbksaDmqwie2US/yxj+0Zs6vLAhGnrX40Hj 5MddnXcxHw9g1tUA8XpMSGY9aqEoOI6q48fDrXa84diO7U1dHt87zIXu7fFEP5YZcz8C BoKA7pgiXxETvy9N2CEFiL+14+aVsoy9D7wXgkNcMvuCt1Jmy17SAzaKRYSCy6SYi0LF FYgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229827; x=1708834627; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7kmAGwgibsE40CKblzU9xPszVIKszLetJVWs39LtLs4=; b=XH4VIFXh1+UTOFx7y8D5XxG1wg6vNDA7Zgw2yzgyzYsSfRZNpp0R9uWFJ4/EFuKxlH U7xLwyQKIC6wqbk6W1SP6ABFoNqtZ7zssIIGPWrLA5j0OkEzxSz6o4vkYofR6XfEDYJ7 fDQTZtv6DggBt6vmFHPrYxNuKN2i9Jcs57LGV76u1eO1lw3rLQUZ9aq6BbKVIuhDy6wB F3NbnyCGTLNWB3gxqQMZQcWiwuYCXmInTn83mwBjtOrSUEKEiGUIwf5xAm07YSUDS6Sh tgg+ceZyS7Fs0Ntn9A2LGKBlY8q/gmP9no3ZZUoVWv8MtNspj9KdTxWH4j5YVDVzUdtB arPg== X-Forwarded-Encrypted: i=1; AJvYcCWWCqthyb3RC+2vwBfPeqZoakh0hSTidYjMsO42F8alw0Bx4pIWqxSHzP8zyUCxkKU0myDh+hR5dco4hTNXwy7Ynh/uW+LSMUokpUeSdQ== X-Gm-Message-State: AOJu0YyJebuBmwBpednAxwZ0Ds6qKllsKvnwgXMybPKD7VGV+AYU7d7w X1a6+RC5Oc53jl0yWHmWkYd/PyCQDCR7TakRKbM623XdvTMLXhKnkLZD98FZT7RAyg== X-Google-Smtp-Source: AGHT+IHf6ee0rDa6Ed2eZUrQnMvT93H3rJzSArxd7p1/1rUC8eiZBBrZK63LdjUZwJ1bDg1j0GFceg== X-Received: by 2002:ad4:5bc7:0:b0:68f:390c:270e with SMTP id t7-20020ad45bc7000000b0068f390c270emr7016310qvt.22.1708229826877; Sat, 17 Feb 2024 20:17:06 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:06 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Lucas Stach , Adam Ford , Marek Vasut , Luca Ceresoli , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 3/6] arm64: dts: imx8mp: add HDMI power-domains Date: Sat, 17 Feb 2024 22:16:41 -0600 Message-ID: <20240218041649.1209173-4-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201708_844625_13561361 X-CRM114-Status: UNSURE ( 8.89 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Lucas Stach This adds the PGC and HDMI blk-ctrl nodes providing power control for HDMI subsystem peripherals. Signed-off-by: Adam Ford Signed-off-by: Lucas Stach Tested-by: Marek Vasut Tested-by: Luca Ceresoli --- V5: No Change V4: No Change V3: The hdmi_blk_ctrl was in the wrong place, so move it to AIPS4. power-domains@ fixed to read power-domain@ V2: Add missing power-domains hdcp and hrv --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index 9ab9c057f41e..0730d4cf9bc4 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -836,6 +836,23 @@ pgc_mediamix: power-domain@10 { <&clk IMX8MP_CLK_MEDIA_APB_ROOT>; }; + pgc_hdmimix: power-domain@14 { + #power-domain-cells = <0>; + reg = ; + clocks = <&clk IMX8MP_CLK_HDMI_ROOT>, + <&clk IMX8MP_CLK_HDMI_APB>; + assigned-clocks = <&clk IMX8MP_CLK_HDMI_AXI>, + <&clk IMX8MP_CLK_HDMI_APB>; + assigned-clock-parents = <&clk IMX8MP_SYS_PLL2_500M>, + <&clk IMX8MP_SYS_PLL1_133M>; + assigned-clock-rates = <500000000>, <133000000>; + }; + + pgc_hdmi_phy: power-domain@15 { + #power-domain-cells = <0>; + reg = ; + }; + pgc_mipi_phy2: power-domain@16 { #power-domain-cells = <0>; reg = ; @@ -1889,6 +1906,27 @@ hsio_blk_ctrl: blk-ctrl@32f10000 { #power-domain-cells = <1>; #clock-cells = <0>; }; + + hdmi_blk_ctrl: blk-ctrl@32fc0000 { + compatible = "fsl,imx8mp-hdmi-blk-ctrl", "syscon"; + reg = <0x32fc0000 0x1000>; + clocks = <&clk IMX8MP_CLK_HDMI_APB>, + <&clk IMX8MP_CLK_HDMI_ROOT>, + <&clk IMX8MP_CLK_HDMI_REF_266M>, + <&clk IMX8MP_CLK_HDMI_24M>, + <&clk IMX8MP_CLK_HDMI_FDCC_TST>; + clock-names = "apb", "axi", "ref_266m", "ref_24m", "fdcc"; + power-domains = <&pgc_hdmimix>, <&pgc_hdmimix>, + <&pgc_hdmimix>, <&pgc_hdmimix>, + <&pgc_hdmimix>, <&pgc_hdmimix>, + <&pgc_hdmimix>, <&pgc_hdmi_phy>, + <&pgc_hdmimix>, <&pgc_hdmimix>; + power-domain-names = "bus", "irqsteer", "lcdif", + "pai", "pvi", "trng", + "hdmi-tx", "hdmi-tx-phy", + "hdcp", "hrv"; + #power-domain-cells = <1>; + }; }; pcie: pcie@33800000 { From patchwork Sun Feb 18 04:16:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561662 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 9B80FC54764 for ; Sun, 18 Feb 2024 04:17:26 +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=eZhl4esZqbOcN/zA6dUbMPwZ1Bx4m6yeAmzvoGVQ1mc=; b=UW4r7rppHMdVnm vT5cmHgLPS4mibndtRzu1hbOxapQvqyVHq7buzArualUUpmhUWijqJxVGQSr7CRSnEhuo0uSesDDt cotxNhFaYiJEKDtVZsoVFWKjaifIXq64NA7iGBQ/nZRwJNhy4Aa9S2WIlbCZdag0SlWHOu1HhMAD2 LkIsWzb3pIAAMAgZi0xwnncEAJ2gKDCxU0KBDjAmLdOz3SPohDxHHX3Rhd0TRDlhlg/JGrV9fVYfE gR/mOnfpLyjoK/FVvu50jwRSPRKCuJDNBYMDldxM/MWSHGxG5R76LdIEXJEZGm8wlf+zXKlU9tSOp 20PRNNLdgYBAA1TuaACw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYcI-00000006xNb-0lOE; Sun, 18 Feb 2024 04:17:26 +0000 Received: from mail-qk1-x72e.google.com ([2607:f8b0:4864:20::72e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc3-00000006xEu-0m0k; Sun, 18 Feb 2024 04:17:12 +0000 Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-783045e88a6so167373385a.0; Sat, 17 Feb 2024 20:17:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229829; x=1708834629; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7TgNxlY3gvRRH7nZvWiloXYULfJ7EBapssXw7kKBQCg=; b=FDE7b33Om9UqviebpsS2bzzdeO611DjST6MrrX6HAowBlFiyP1iwyH04gQsJWnyOoC i6ceAFsABsCaS2mwLxYZkgPUUkICnjMIYe1ENPbWVdNsTLSiyl6yUagQeBhjXeqSLscd 9KEc8yqg1MhRS+5wVRwZbFpd1pdFsryh7t1p6kUj7aHhJ5nPiqtEvqrz3QHRLJoa7/J1 bz3KQq3nwy5dfOssi0RuFYGI1Kn/xpPt8/DVMfsNfKgiu3EN0FeFdSwg+Sy8QSXVsRc0 cyh6Jss5GdNnJLSY3rpOCx9lZjvUtY4c5Anx/HYGXH+UB3NO13dCaNr+GC3MkAfld1jy GkeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229829; x=1708834629; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7TgNxlY3gvRRH7nZvWiloXYULfJ7EBapssXw7kKBQCg=; b=evwqSt4HXllv0Dqs1ruiwLL5v7zLPdUR+p5vq/GHMZeeveroNhnymbbLpAdKbKw60Z BrPHdPZkY1tu0c5Q0AlP4cbeyL9EyWGWX+eE/Mx8kJvFhFGir6ESktF3eqkZVDghhJNf 1nvfhqKyuqMvpNabSXlvO3e+K31JoXhAoteOJV/pzaYYTzcsCWKCoeOtXQuINByKVN8l ad2rjZ5lEXxZarTj3beM2gY8m1fMoxwiBlVNZ5VDbvcBRgA5LJdGGmbL73IJuM83vRAg ibmcEJadk8Yku0q59NvzFWKDocXAG5y4fGemWr82kPxWYl4JnzScZg4yi10lgB7NZnQE gDAA== X-Forwarded-Encrypted: i=1; AJvYcCUrLn0zwDylcx9DvONLjN44Fh/6SGlmPPjS0vBn2BRZS7XY0w+aQXMCZCJoiTpcJgZxiQ20u4kS7qnHs6fBI80prmI131Q0dLDjDxdJ1A== X-Gm-Message-State: AOJu0YzhZftg/7jbnf36aKM9mhA8AzHGfUENj+qhs/3E3wNm9gXjfAnb 2b4AuKPWQ9witmZWnJcb8CgCb8JSikLui3XJKffXjp5qNJo4DR9i+z4lwCy0DFUwOg== X-Google-Smtp-Source: AGHT+IE3LTX6FdxcmywHLwce1/DIOjULt90UZD1jHNFOrPnlFwig8FEHTUySRtMSIIUiW/Ulb/hCig== X-Received: by 2002:a0c:ca12:0:b0:68f:6be:9f94 with SMTP id c18-20020a0cca12000000b0068f06be9f94mr2698300qvk.12.1708229829221; Sat, 17 Feb 2024 20:17:09 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:08 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Lucas Stach , Adam Ford , Marek Vasut , Luca Ceresoli , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 4/6] arm64: dts: imx8mp: add HDMI irqsteer Date: Sat, 17 Feb 2024 22:16:42 -0600 Message-ID: <20240218041649.1209173-5-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201711_264761_A649610C X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Lucas Stach The HDMI irqsteer is a secondary interrupt controller within the HDMI subsystem that maps all HDMI peripheral IRQs into a single upstream IRQ line. Signed-off-by: Lucas Stach Signed-off-by: Adam Ford Tested-by: Marek Vasut Tested-by: Luca Ceresoli --- V5: Increase size to 4KB to match the ref manual V2: Add my (Adam) s-o-b and re-order position under AIPS4 --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index 0730d4cf9bc4..cbb15ded4a74 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1927,6 +1927,19 @@ hdmi_blk_ctrl: blk-ctrl@32fc0000 { "hdcp", "hrv"; #power-domain-cells = <1>; }; + + irqsteer_hdmi: interrupt-controller@32fc2000 { + compatible = "fsl,imx-irqsteer"; + reg = <0x32fc2000 0x1000>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <1>; + fsl,channel = <1>; + fsl,num-irqs = <64>; + clocks = <&clk IMX8MP_CLK_HDMI_APB>; + clock-names = "ipg"; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_IRQSTEER>; + }; }; pcie: pcie@33800000 { From patchwork Sun Feb 18 04:16:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561663 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 6B792C48BC4 for ; Sun, 18 Feb 2024 04:17:38 +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=X8KkkZmzZriYKF6o+TdEvUEOFvrpLIOzJCanHklKq04=; b=KY/HCIlXSZzSTm Lc2RUbswMFnmzd1SwdsU/z/JpP/xZFHh26u+SOxV4og528gNiQ01URixmoLDYqIiUiiXoQ7e0l2pO DFbj2I79myLiPDX+JaoKxh6yGSAGQztYypxQqwIa85WQ07w5b5CXyCjy9RG2URWveHmrlNtWQA0A4 lrvHRorotmgnwtgqWt4DdpKNkZ9ch5GxOFQ7O1OXvpdWGg3fVyqYZWdMY/KkjSLBrwLd0lXCOqLsf HfzXF9Y9qPSkMIH2a+HojiJWlFXDWoRWR/iToLCj1pz/jbQTl5tAFjIuRJuAmVwFVsfvmdpQ/y0uE IKHNuOU7t/KO63CKEH7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYcT-00000006xUv-41Xm; Sun, 18 Feb 2024 04:17:37 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc5-00000006xG3-0u3B; Sun, 18 Feb 2024 04:17:14 +0000 Received: by mail-qv1-xf31.google.com with SMTP id 6a1803df08f44-68f51ba7043so5271566d6.3; Sat, 17 Feb 2024 20:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229832; x=1708834632; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c/aeBIdmV1XrY4y6jgnhEUqIAA87/lYvvzwVW9/z3wo=; b=F9tHALc07UAauwTHBvekJ7l24BjPnurOOYjyWgIWFb05pIiXkARjgn08HiiGwjSqIB LE1VYw74ZxbhtPmD17lojU76eO4Z10aY1+8WJ7GslAneFkUqAgH4OF4RiVTrzJ7RuAT6 9GNCSRAEmNELq9hiL2qpeOesPZa3w+hxS2rZKplCUqKQLKhS2N2RXlGARD2lCOOVsApN 4J+WO0osIAJUyU5e2o84O8FFgMNcwInksv5MiOrVM6fhoy6Fcq5fj2SC16QM7EhOhbhr yqhQbYub1JILOOIO+bebBPjHSsQEiM0Cl73CljqEjxaroFEMD/9u95AATtnVdR+tQAtU Fg2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229832; x=1708834632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c/aeBIdmV1XrY4y6jgnhEUqIAA87/lYvvzwVW9/z3wo=; b=QuYQDaXdQEhgWk+72jnuFwsQP4Nh9iqroxfzuG+5jS20zBr1cia4tfajS4BCBL6Qw/ VcmCynZpyrZ3YlVyBYxDpUyuGX1hH89F2besHjECUGbsyJJVQn+hXRrwWmrcaTEw/uqa kQC/3IeaD8lkKcTS6BsLqilwJh0fAGxTPQXdvW2yGy9Wxzia+apQ+ZfcTf4LS+ZHsp8/ 6YipzmQ3I+xJ06wuIdbIh9RS697/Lz2VS6aI38IN8MMB+K/9ZHYR+Twk4rGgYUw+NbJm XPJE5tLm4jZj6v/NJENDxAhu/waffbfCZJFaFHpb/hqgkWyaj0RDrOFMsC28AQQ9zC2a ELkA== X-Forwarded-Encrypted: i=1; AJvYcCU9nE75CxkFzH6A+qWFxjqXjS519ZMTx6lU/cr9FpdF0xsEJufrJw+0ETxk7it5vgF9mHC1xAW54RHlU5IyUW1/PHdq0VxSaQlRqa8Apg== X-Gm-Message-State: AOJu0YzgUl8Gk8rbIJx+9YJOT9g2X0QNSa1Z/nEZVGHbJXD5jyYD5Max 8ZuwWzmhR8/cv5jgZdjMjXFxTad8rz5YBdstyh+VrZeio3byuBgivZQGxzjtVkW0Nw== X-Google-Smtp-Source: AGHT+IE+l1O/kUpQQgLps3SgnxzH9E9IVKxRsFX38onbawk5mnGPrRddcJb2C6Zr5PV5EEzAfT4lAQ== X-Received: by 2002:a0c:8b1a:0:b0:68f:5901:c76a with SMTP id q26-20020a0c8b1a000000b0068f5901c76amr1396486qva.0.1708229831817; Sat, 17 Feb 2024 20:17:11 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:11 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Lucas Stach , Adam Ford , Marek Vasut , Luca Ceresoli , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 5/6] arm64: dts: imx8mp: add HDMI display pipeline Date: Sat, 17 Feb 2024 22:16:43 -0600 Message-ID: <20240218041649.1209173-6-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201713_345997_0654BA1A X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org From: Lucas Stach This adds the DT nodes for all the peripherals that make up the HDMI display pipeline. Signed-off-by: Lucas Stach Signed-off-by: Adam Ford Tested-by: Marek Vasut Tested-by: Luca Ceresoli --- V5: No change V3: Re-ordered the HDMI parts to properly come after irqstree_hdmi inside AIPS4. Change size of LCDIF3 and PVI to match TRM sizes of 4KB. V2: I took this from Lucas' original submission with the following: Removed extra clock from HDMI-TX since it is now part of the power domain Added interrupt-parent to PVI Changed the name of the HDMI tranmitter to fsl,imx8mp-hdmi-tx Added ports to HDMI-tx --- arch/arm64/boot/dts/freescale/imx8mp.dtsi | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/arch/arm64/boot/dts/freescale/imx8mp.dtsi b/arch/arm64/boot/dts/freescale/imx8mp.dtsi index cbb15ded4a74..433ea4ae6a16 100644 --- a/arch/arm64/boot/dts/freescale/imx8mp.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mp.dtsi @@ -1940,6 +1940,100 @@ irqsteer_hdmi: interrupt-controller@32fc2000 { clock-names = "ipg"; power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_IRQSTEER>; }; + + hdmi_pvi: display-bridge@32fc4000 { + compatible = "fsl,imx8mp-hdmi-pvi"; + reg = <0x32fc4000 0x1000>; + interrupt-parent = <&irqsteer_hdmi>; + interrupts = <12>; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_PVI>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + pvi_from_lcdif3: endpoint { + remote-endpoint = <&lcdif3_to_pvi>; + }; + }; + + port@1 { + reg = <1>; + pvi_to_hdmi_tx: endpoint { + remote-endpoint = <&hdmi_tx_from_pvi>; + }; + }; + }; + }; + + lcdif3: display-controller@32fc6000 { + compatible = "fsl,imx8mp-lcdif"; + reg = <0x32fc6000 0x1000>; + interrupt-parent = <&irqsteer_hdmi>; + interrupts = <8>; + clocks = <&hdmi_tx_phy>, + <&clk IMX8MP_CLK_HDMI_APB>, + <&clk IMX8MP_CLK_HDMI_ROOT>; + clock-names = "pix", "axi", "disp_axi"; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_LCDIF>; + + port { + lcdif3_to_pvi: endpoint { + remote-endpoint = <&pvi_from_lcdif3>; + }; + }; + }; + + hdmi_tx: hdmi@32fd8000 { + compatible = "fsl,imx8mp-hdmi-tx"; + reg = <0x32fd8000 0x7eff>; + interrupt-parent = <&irqsteer_hdmi>; + interrupts = <0>; + clocks = <&clk IMX8MP_CLK_HDMI_APB>, + <&clk IMX8MP_CLK_HDMI_REF_266M>, + <&clk IMX8MP_CLK_32K>, + <&hdmi_tx_phy>; + clock-names = "iahb", "isfr", "cec", "pix"; + assigned-clocks = <&clk IMX8MP_CLK_HDMI_REF_266M>; + assigned-clock-parents = <&clk IMX8MP_SYS_PLL1_266M>; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX>; + reg-io-width = <1>; + status = "disabled"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + + hdmi_tx_from_pvi: endpoint { + remote-endpoint = <&pvi_to_hdmi_tx>; + }; + }; + + port@1 { + reg = <1>; + /* Point endpoint to the HDMI connector */ + }; + }; + }; + + hdmi_tx_phy: phy@32fdff00 { + compatible = "fsl,imx8mp-hdmi-phy"; + reg = <0x32fdff00 0x100>; + clocks = <&clk IMX8MP_CLK_HDMI_APB>, + <&clk IMX8MP_CLK_HDMI_24M>; + clock-names = "apb", "ref"; + assigned-clocks = <&clk IMX8MP_CLK_HDMI_24M>; + assigned-clock-parents = <&clk IMX8MP_CLK_24M>; + power-domains = <&hdmi_blk_ctrl IMX8MP_HDMIBLK_PD_HDMI_TX_PHY>; + #clock-cells = <0>; + #phy-cells = <0>; + status = "disabled"; + }; }; pcie: pcie@33800000 { From patchwork Sun Feb 18 04:16:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 13561664 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 B8D70C4829E for ; Sun, 18 Feb 2024 04:17:41 +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=ceLfHkfm+A8zMAz8K/Zl8vQ9z0oXJZmoZ/5OO1MzeFk=; b=aAXaSRK/OORes/ zjTYKoGWulGnLzYzLqRVVh24X8AkJMjkXizVvKhI0raMMwQSTPNJxyY+DwrNX4BleeqWcKCOtujc0 Biw0DHMcZmPHXaADSoK0ycBnJ78soHsoe2oTIm4yJ/1fKBF5nVMhA0Ogg4Dbu4WEIlHeOUV0H7t5d toWN2tBQ9T520uYClTGdM2iXHZVvAD4Bh8ZVz9CFOJZTBQ2UhPgOnJ6hmySGf/mRQycU2fwFfAps+ YtIzZNFgSyFepSWJciLgR88QzSx/NNmW7yM7QF4H8k8crr1BZCEy4khhzUNiaOVqCx5noaBNsOqcH 9Jc42mDavnMqXuFL9Www==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYcX-00000006xXB-10ds; Sun, 18 Feb 2024 04:17:41 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rbYc7-00000006xHj-2bni; Sun, 18 Feb 2024 04:17:16 +0000 Received: by mail-qv1-xf36.google.com with SMTP id 6a1803df08f44-68ca1db07ceso21046886d6.2; Sat, 17 Feb 2024 20:17:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708229834; x=1708834634; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/4DhMuxys/34mkhk6GaLGZiP3UVmIiKa+UwrnIlKa10=; b=I+8TTQoUc23/26fSfuQ8Zp+Hxy3OfSrdCZV7Xg1aEWwizRAlpdXeYxQKzHVp1AOw4w en5o4SoLTXOSUbsoxMIGHDBGOBTovV9aWhZiUZOBB64VFNbZoy5WFv3q9S/uDJ9QbzUA ojeN5KBuwtiv6B5PzQMzYq7r6SzXbPRGxw+GdgAavCnvGebNpuueEiDiy3idoK8HyeId baS9TVD5bwPGTirEzSmnL/LMm6y0ge8ou6apWDSGBNzjaOguW1OM4gOqVtxzVSVvbOin AwEJIYb0Xw25YlpPz/7eMQ2IuNrYJnKAM2WBCgvJvlyrHV1ys35FWrhE7lDD166NvIWR 0dvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708229834; x=1708834634; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/4DhMuxys/34mkhk6GaLGZiP3UVmIiKa+UwrnIlKa10=; b=gGsz6YfmdGPnj7GDE+psBw3K2ve+puvbtkKMiOgcrSbmBf9+JZ5ujrgIBSL0PKSznk P1Z/0Ozb8GqaVZkS5BYA0CyDIaThDg2uwVAQ1e9priQRhyMAjM0MsSbNAIHxxOOMPTd8 S5fWlZIYlRyuZL4M9uFCYwMW42qwhO/gLvtPjhYs1gagUqXESOyS2zXuH8Re6KAEuNaY xOLwdjcQbdqPg9y9bMK9/eEXfw10G3O2PNZOUwQVZo3/qdWWkYbUb4RGEKz/+Z3eQaTT WcST4cnnFp6lOCB84QnBSTVQ/3RPSMWwNELuJF3313hNTx16yYFQlI29TI7vL2Jw4ZCX UEQA== X-Forwarded-Encrypted: i=1; AJvYcCVCghBZRFEQIDT+dBs7IrqKC2ZHVxDsFXz+KkWQvaF0TLFuh2eaytrJqws7q/UK7nmY0XUVSNLzjpn8YqoHFlfufvzoeaym4+UoBpHnKw== X-Gm-Message-State: AOJu0Ywu1hRcBLjWRerz+TnRRcP+9LEtRWFnig/vL911RJ9T6gCrbH4w sWxwAeD0caqb0lXjnarQLKbi+dh2HoUMKDA1pHqMrtb28xfYxera3CBnv2ZIRqrplw== X-Google-Smtp-Source: AGHT+IFMXYUm3DAGvhHMCJf8i+alS/1f7k2sbGdjsuXsPkCamXEfPAlsCaqOCoDWJRS6fbld8/LKrw== X-Received: by 2002:a0c:df0d:0:b0:68d:124:4354 with SMTP id g13-20020a0cdf0d000000b0068d01244354mr11175451qvl.49.1708229834543; Sat, 17 Feb 2024 20:17:14 -0800 (PST) Received: from aford-System-Version.lan ([2601:447:d002:5be:dde9:2f2d:61e4:7364]) by smtp.gmail.com with ESMTPSA id or31-20020a056214469f00b0068eeebc4656sm1713621qvb.139.2024.02.17.20.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Feb 2024 20:17:14 -0800 (PST) From: Adam Ford To: linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org Cc: aford@beaconembedded.com, Adam Ford , Luca Ceresoli , Vinod Koul , Kishon Vijay Abraham I , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Catalin Marinas , Will Deacon , Lucas Stach , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH V5 6/6] arm64: defconfig: Enable DRM_IMX8MP_DW_HDMI_BRIDGE as module Date: Sat, 17 Feb 2024 22:16:44 -0600 Message-ID: <20240218041649.1209173-7-aford173@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240218041649.1209173-1-aford173@gmail.com> References: <20240218041649.1209173-1-aford173@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240217_201715_694301_43718AFD X-CRM114-Status: UNSURE ( 7.79 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The i.MX8M Plus has support for an HDMI transmitter. The video is genereated by lcdif3, routed to the hdmi parallel video interface, then fed to a DW HDMI bridge to support up to 4K video output. Signed-off-by: Adam Ford Reviewed-by: Luca Ceresoli Tested-by: Luca Ceresoli --- V5: Added Review and tested-by from Luca No functional change since V1 --- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig index b8adb28185ad..ccfd5e6f20eb 100644 --- a/arch/arm64/configs/defconfig +++ b/arch/arm64/configs/defconfig @@ -887,6 +887,7 @@ CONFIG_DRM_ANALOGIX_ANX7625=m CONFIG_DRM_I2C_ADV7511=m CONFIG_DRM_I2C_ADV7511_AUDIO=y CONFIG_DRM_CDNS_MHDP8546=m +CONFIG_DRM_IMX8MP_DW_HDMI_BRIDGE=m CONFIG_DRM_DW_HDMI_AHB_AUDIO=m CONFIG_DRM_DW_HDMI_CEC=m CONFIG_DRM_IMX_DCSS=m