From patchwork Wed Jun 24 15:05:21 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: 11623487 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 0BC6F14F6 for ; Wed, 24 Jun 2020 15:09:47 +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 D941D206C0 for ; Wed, 24 Jun 2020 15:09:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="2mPY4KHO"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="rUWJCnEU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D941D206C0 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=jL4r4ZNxHoR7l3En05/52I1iwH/7i2QbXefx1TvbReQ=; b=2mPY4KHO1K6vZZ/mPRer8/yHgi aQ1zFLBAUx4LB0amL/+1siRicKR48xL3Jsr//E1Ga+SFw5KN4+L4Y4LpksrX3iOsxHk6M2OUu7l/E PCoUEDEgwbwFgmVi9PiVuVzzkA9jtDsgltNZBXFjyHw2dXy7OMPbsOXEJgOit23kktlLH90+Xo1HJ DOMeuaEBAS9VjSzJsRPRPZ8xkSVpY7hmjxirMAufvD/2P8l8wFHgtOuQpcJotyWdHmRjnj78VSdZA VDzjBjrf6QMec2JOzxx1BXGcN7p5hX3HcyoSlGaviuglITO9xSZkKOFQ/LpvT07EHqegmQadLdFel cYDAmTdw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo6z9-0003ob-JN; Wed, 24 Jun 2020 15:06:48 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jo6xu-00035V-A7 for linux-arm-kernel@lists.infradead.org; Wed, 24 Jun 2020 15:05:32 +0000 Received: by mail-qt1-x844.google.com with SMTP id z2so1922744qts.5 for ; Wed, 24 Jun 2020 08:05:27 -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=E2QT93q4mAHQ58Ta5MG1RGkPeXgSEsXRWz8vivK18vY=; b=rUWJCnEUxL1RvWBYcZKsFagVzZ6RLMKVyhk5QTpU9kLslfZjSvrNUZE7PdQ5RxDD0P YgOA8IDgoRJYQ6doK+Kmn4wJp1BUCsL2EvsAClcifu7NGqOxL4Wna4A65LbMbA/zXSAo YJLyTiyHw84/1y/mS7tD0H5gncGOuqiBBsXp8Ct5eSWGJHG5bzSXFOjSCFwL0oTKYJ1I 9/25K65Q8GS3GQ3p6O9TuDf7hVhGfAxNsgt2gchdNg/3g9rn5kUSP7uLZhi0pqgz+Peh poW+m/N88G7lC+jUnELmccQkQ3SkgUV8Kl9SA9BGzDH5TFV1Q5dbR+qdk+oW/j4sR4hB 1i8Q== 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=E2QT93q4mAHQ58Ta5MG1RGkPeXgSEsXRWz8vivK18vY=; b=Bvc4y+Vj7cmUote5fkswcrppjlXNZy5+CBgIEHjHi/NQfGryCQkKFuHWbFfCdVEt3k gECYm9xisV/DujlFuRzVKA+iyVEy75jnFgQmDRVq7OsV1ayERdqiAtPJTy9QCmnF8fPa uwO5wncWKy80itxTc5UEdmfxVWw1sMd0a9ByD/mSiq0VplJ1PTUa022hrpaAn6RSw2hD 9/Vh99HY1VIyBcPU/oYR3KnEHnIZjgvHrBNZbJFgS0XGMmpo2IBQOh/+XD7HgCU7pdXE zpesd6dslx5XnoxmK3T4wdb+iweimAh0EUQJsvi0r+Tr9MphRv3zBbNVcUEtcKF/dyLa 6cwg== X-Gm-Message-State: AOAM531vvpj/IihUl8iihk+np88Ag6kUDxjLWozXJlO32hm9JRRpJd8D cKfq4uXRZTz2Yc6ZLCQ8lSA= X-Google-Smtp-Source: ABdhPJw5x001LVdx99+WaRNGHXQcZtR3Mby0dQmiZDxwN8hW4lPaEGLzCbnZ64vJmPdEZnBwKRDplw== X-Received: by 2002:aed:25fd:: with SMTP id y58mr21018796qtc.310.1593011125659; Wed, 24 Jun 2020 08:05:25 -0700 (PDT) Received: from localhost.localdomain ([72.53.229.195]) by smtp.gmail.com with ESMTPSA id x26sm3434088qtp.54.2020.06.24.08.05.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jun 2020 08:05:25 -0700 (PDT) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: shawnguo@kernel.org, fugang.duan@nxp.com Subject: [PATCH v2] ARM: imx6plus: enable internal routing of clk_enet_ref where possible Date: Wed, 24 Jun 2020 11:05:21 -0400 Message-Id: <20200624150521.12196-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:844 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 --- 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..2380329ed0b2 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 && cpu_is_imx6q() && + 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)