From patchwork Wed Jun 24 15:22:56 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: 11623531 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 3E61D138C for ; Wed, 24 Jun 2020 15:24:54 +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 1124C20723 for ; Wed, 24 Jun 2020 15:24:54 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Y1ZGtL+7"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fLWp55cC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1124C20723 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: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:In-Reply-To:References:List-Owner; bh=SINbECPqJl+QdBuR5XaGl7MyDus8Ewp1qmm7gktHIsY=; b=Y1ZGtL+7g31oRnaHsIUUz9R5U3 9DSDr2ZffrcBF5xUh1/UQpN7/Bd0sKGIUQI6FKUYgwVuWdr4TXblhJPmutSOaZhA/vHNYpWwi3t2h Ui7zqtK7Ajf8/yejqHolywoVz0cKpNJFWAJk/iX88JeLG5WXTTzW4kqpD4BpuFxkn9gfnHaHVENeh fmvlmOtpYAo5uZ0BUMdc8To5nfxuhNam2bEVZN+u5HREnps7Jr5TmsTMqNpNbtguQsDHBDqIeO8J1 mYryPlxN1J2A5EUDYzRC2aUfyAi1ndyTBtcnuamr63831kTCV4lgo7/njwSxoGAukyAtnOeM2qfaO bjxI2FqQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo7Eu-0004qS-Oq; Wed, 24 Jun 2020 15:23:04 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo7Es-0004ot-IS for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 15:23:03 +0000 Received: by mail-qv1-xf44.google.com with SMTP id a14so1211211qvq.6 for ; Wed, 24 Jun 2020 08:23:02 -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; bh=o8WO4FwPMMVJumAcMtjFKZzBUw94gPXqNMSz5go/YzA=; b=fLWp55cC6brOr3WSJga3/tcSm/BlsyClXysj/n1kXkr6Gm1JOwArAv9EugsTxYhGmL 6fOcv6Cb6pggdB128TXaTlsWOySfTJJZ2fPiEQcDFdScieY8UDi1DBxafIlfNa2yZdaV XMA4tta+xS0e4/xANOizXBlgJoNXUi0Xs+MkspK0Gy1IaNqICBRYBVVbWbKqFlizuNn+ 2n8WjjJI1eFeDJjqoaaFAcPdai6JyjC2B6KLY3DMamJtLXeSUEWtnop14fn9elqCEGQH /M9j8ivJR3mqi+wvyKRtXRYhXX43LGEKNAnfM/652TzNUF/RUpgpUToJ/YLP2GO+PUVi 1Gtg== 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; bh=o8WO4FwPMMVJumAcMtjFKZzBUw94gPXqNMSz5go/YzA=; b=jAMbqz/ye+ZOKKEvF3EFxCeF8uHKX9zBvVbnfWJh6AkF20Ch5AKENcTtMyn0N8zP3N qnp6YjRNrumnN2DzKqveGlBQC17DMKMJa53W8fuFAPlKm2FHtNCh+bNYpgV2v6efOoIS Edq6ctG1S90aAy3MvWmsiW9PMB2QpgU5NBNGcCxT/AHcOCb+qsGs6vEWU0dcXKvUgeS/ 9BVoEmsdR7mpU8BET4Am75G5Fv/N2AAVjFewtlU7i2FAKGW8DdG05WbHczV0/KVyQRBJ XXKy14LqpUBKo+AXN+2DpSw2GBeiJjkE7P/TYifwL4Q9sOgRRaPj7/5qiDdceqZXxqSN Vc1g== X-Gm-Message-State: AOAM532k2TeJirg4RK1VBI8sr625BMqE+b+S+TxYG7Ize5L9+m1Fn+sK nko5YolgHvHExyimfHKv7LQ= X-Google-Smtp-Source: ABdhPJw+Sg4HKtlC6yNVorphDuMImKS5ITm7fR2GvW7ccjgSaqLox34vx6TRkuDqGh2xwrN9fMYagg== X-Received: by 2002:a0c:8d46:: with SMTP id s6mr31945947qvb.241.1593012180655; Wed, 24 Jun 2020 08:23:00 -0700 (PDT) Received: from localhost.localdomain ([72.53.229.195]) by smtp.gmail.com with ESMTPSA id w1sm3558521qto.0.2020.06.24.08.22.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:23:00 -0700 (PDT) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: shawnguo@kernel.org, fugang.duan@nxp.com Subject: [PATCH v3] ARM: imx6plus: enable internal routing of clk_enet_ref where possible Date: Wed, 24 Jun 2020 11:22:56 -0400 Message-Id: <20200624152256.21937-1-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 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:f44 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit [thesven73[at]gmail.com] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [thesven73[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -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 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 --- 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 | 18 ++++++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 19 insertions(+) diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 85c084a716ab..a760779b934e 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -203,6 +203,24 @@ static void __init imx6q_1588_init(void) else pr_err("failed to find fsl,imx6q-iomuxc-gpr regmap\n"); + /* + * 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")) { + if (!IS_ERR(gpr)) + regmap_update_bits(gpr, IOMUXC_GPR5, + IMX6Q_GPR5_ENET_TXCLK_SEL, + IMX6Q_GPR5_ENET_TXCLK_SEL); + else + pr_err("failed to find fsl,imx6q-iomuxc-gpr regmap\n"); + } + 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)