From patchwork Thu Jun 25 14:01:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Van Asbroeck X-Patchwork-Id: 11625461 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE562912 for ; Thu, 25 Jun 2020 14:03:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8746A206B7 for ; Thu, 25 Jun 2020 14:03:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QORe2W2X"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hmNv5x9s" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8746A206B7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vWJUKjsmN4Xr3yr5ti/N4h5FYxWlIR3BDEUemzqmRHQ=; b=QORe2W2XhmViFTIXmbLZGOa675 WMbPUqlG2kbsOZMI3b7he3m1TrshoF51TxRU6jAK/8PmZ0oJtAze+dSCHpOqZNuTp+pjVIxAVjb6c R/mm47+1qITwG5SxJryJ+4pXiDcbwEYI9F0gqCQ5LFVdnlhdCDJ0vXcRBmuDwNKjLhqc5uPBbI/N7 vieGf/ddxHfPQcSkf2Q8ZufYQ3maVStMu9yRR3fgJcOBr/GXqDBrfrPrmftt0Q+AWvTooidljPrxZ en63M5zc3qIMNy/A1Rto8iq0fsS/apXZxsZe3ttyBWL4qh0hlb0+CylUmcqIjb20KDG5pUXEwerrx oVFhXpHg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1joSRK-0008NL-Bm; Thu, 25 Jun 2020 14:01:18 +0000 Received: from mail-qt1-x843.google.com ([2607:f8b0:4864:20::843]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1joSRF-0008MH-Vy for linux-arm-kernel@lists.infradead.org; Thu, 25 Jun 2020 14:01:15 +0000 Received: by mail-qt1-x843.google.com with SMTP id d27so4650249qtg.4 for ; Thu, 25 Jun 2020 07:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PkUOCHj9LFPphlCPOdfGOi9fMJfRayuqn+rFrknXVfo=; b=hmNv5x9szlld8JEWZ03cdBMaku4rI3pLsqaeB8MNK/OlxUZA8CPqCjcPHY7kA/hAAG 0vPkM+TjO/RkE+9JWh8ZIuGRKPxqRA0dbRdc7gZLZLqdJfbS4EpbSmSCahWYsJJaA/cy 0TnJdn2mGusb3TWccflxCvSq5M7nPVgRzQ3c3Z3ci6fMPxXA091+LAxT7M+gMvwXuUx6 H0RAzgEL2f6cJcLflRTupK2HR/H3+ugUMctTff20lwkcLoJRxnLoHL5bEVAKxEQB49/0 JNe7b3zXfhrxlExK4wv99znqCJzo14Z35Dxth6ylMlUF0VfVn2qbvotdOW+p7DZFkH/U sX5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PkUOCHj9LFPphlCPOdfGOi9fMJfRayuqn+rFrknXVfo=; b=byV8pm5kCGlzBw4vsZ1DVWQ3QTKEMcIF78PkBPUr9bcVcMyVVMS2ytyNCOdQpwgKnw vfU77gWGGJvu+A6mJbh2IbVBFmNY39ubIAsaWoJM2Z67g/o66/hAg21UsRqs9yoeo3rg WkUbg0RjgpLbUQh+/IB5pciOCjDeJYanIyuUOpbWL3K9XpBW9FVKPvDOlNBov4Qv+Umm cZ+PvhiHF345AyzkbTNyzmRIDMQJbd+Q1yZ+XhbjiUeaw1ShrJTy7ppBn3TH0BQWLIVP YzJHTBLM6fWr3Ck+eAS5wVdISRWXSWVLRqoK/5iV2eQQ+L2Qe6gsazcbUl9QOFifzde9 XACA== X-Gm-Message-State: AOAM5321Z2RWKAeRGvqVCT/ioy2ZP3O0RTgqfCsM1Yzlk5gRa/KBP3Uq wkBPbCO4Z+kqhacLNJ0t/dQ= X-Google-Smtp-Source: ABdhPJz0TnsQuAj2jQwYLjbicbfNVB1Hjk7FRyAAAWCBwd9Iio2s6flRsVSg3FsUXtCMMDxVSM+P5A== X-Received: by 2002:ac8:6d17:: with SMTP id o23mr17470321qtt.127.1593093672273; Thu, 25 Jun 2020 07:01:12 -0700 (PDT) Received: from localhost.localdomain ([72.53.229.195]) by smtp.gmail.com with ESMTPSA id f4sm5337691qtv.59.2020.06.25.07.01.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 07:01:11 -0700 (PDT) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: shawnguo@kernel.org, fugang.duan@nxp.com Subject: [PATCH v4 2/2] ARM: imx6plus: enable internal routing of clk_enet_ref where possible Date: Thu, 25 Jun 2020 10:01:05 -0400 Message-Id: <20200625140105.14999-2-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200625140105.14999-1-TheSven73@gmail.com> References: <20200625140105.14999-1-TheSven73@gmail.com> X-Spam-Note: CRM114 invocation failed X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:843 listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [thesven73[at]gmail.com] 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [thesven73[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sascha Hauer , linux-kernel@vger.kernel.org, NXP Linux Team , Pengutronix Kernel Team , Fabio Estevam , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On imx6, the ethernet reference clock (clk_enet_ref) can be generated by either the imx6, or an external source (e.g. an oscillator or the PHY). When generated by the imx6, the clock source (from ANATOP) must be routed to the input of clk_enet_ref via two pads on the SoC, typically via a dedicated track on the PCB. On an imx6 plus however, there is a new setting which enables this clock to be routed internally on the SoC, from its ANATOP clock source, straight to clk_enet_ref, without having to go through the SoC pads. Board designs where the clock is generated by the imx6 should not be affected by routing the clock internally. Therefore on a plus, we can enable internal routing by default. Signed-off-by: Sven Van Asbroeck Reviewed-by: Fugang Duan --- v3 -> v4: - avoid double-check for IS_ERR(gpr) by including Fabio Estevam's patch. v2 -> v3: - remove check for imx6q, which is already implied when of_machine_is_compatible("fsl,imx6qp") v1 -> v2: - Fabio Estevam: use of_machine_is_compatible() to determine if we are running on an imx6 plus. To: Shawn Guo To: Andy Duan Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org arch/arm/mach-imx/mach-imx6q.c | 14 ++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 15 insertions(+) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index ae89ad93ca83..07cfe0d349c3 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -204,6 +204,20 @@ static void __init imx6q_1588_init(void) regmap_update_bits(gpr, IOMUXC_GPR1, IMX6Q_GPR1_ENET_CLK_SEL_MASK, clksel); + /* + * On imx6 plus, enet_ref from ANATOP/CCM can be internally routed to + * be the PTP clock source, instead of having to be routed through + * pads. + * Board designs which route the ANATOP/CCM clock through pads are + * unaffected when routing happens internally. So on these designs, + * route internally by default. + */ + if (clksel == IMX6Q_GPR1_ENET_CLK_SEL_ANATOP && + of_machine_is_compatible("fsl,imx6qp")) + regmap_update_bits(gpr, IOMUXC_GPR5, + IMX6Q_GPR5_ENET_TXCLK_SEL, + IMX6Q_GPR5_ENET_TXCLK_SEL); + clk_put(enet_ref); put_ptp_clk: clk_put(ptp_clk); diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h index d4b5e527a7a3..eb65d48da0df 100644 --- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h +++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h @@ -240,6 +240,7 @@ #define IMX6Q_GPR4_IPU_RD_CACHE_CTL BIT(0) #define IMX6Q_GPR5_L2_CLK_STOP BIT(8) +#define IMX6Q_GPR5_ENET_TXCLK_SEL BIT(9) #define IMX6Q_GPR5_SATA_SW_PD BIT(10) #define IMX6Q_GPR5_SATA_SW_RST BIT(11)