Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp561032ybt; Sat, 13 Jun 2020 13:19:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWiAL7W34vaHVKtwnlOsiGaWhjbEq1Z2gymTE9vL4wjFGTrSYFOx5FQKXsfpmfqRB1esCY X-Received: by 2002:a50:ee08:: with SMTP id g8mr16662493eds.267.1592079564434; Sat, 13 Jun 2020 13:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592079564; cv=none; d=google.com; s=arc-20160816; b=yBsf87UQUZN4H652zwFZMI+S7vj0+qrl0AzJ4AP00IXpvBX/9tDMOFwAu8oIUQFZve pyDJ9f6goxXVby+8P2ZRhUg65+pyBVlNtDMBM8yZa2cDAFVhdzC1+R1zRnOkURypJQ7H kqDGS8jDJa99IbUNwDTvCybhwC+xRvHzIRDb45lGJWcQub0pIhwn4xdm+7j7FMWPtJqz Uqnjgo6VB5oQVyev5lglVB68STVEvd38h91PRZtB+O7EAGEiX4gjRTfl8UwRO4auBKvF BVp2w5eYGSZ8gQNTTSJ6pnzO4n2XMGSwxsrWIZ5uZzfE/HS8q2iHjmAnHgleZ/+hgItm Hihg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=XvmodwFRSbxZ4SI7zIxONP0m2KmZ4cn7dUMYubaK5Ks=; b=kX8QIRV+u5ijf0EV/KH+ZFW4QKnHIB3DwcErTtIY6tDVqmn1lScxFoj68pBb8RJtdQ osdFYXatbrYo+awymQotrGHuX1EYNUMJhQywRBM2tlLzR8xXkWl0HaBLYuRhweH8dPra 4S31YnmwTtyZX4ad80Os3Q2r0urNiPM9rYpitDZGciVK+84uHPeG0iLcAjgcjhI4GNs/ vbUBqHtkjT89aDxN08uVLnb6HRBUp5QafbBrSk/L/tocux/nmKNOzb7OymQVAsfxwbvM kHD5WvTOzDqzGeOZHYTGrHPoFc5gz47ysVaE8DtxE+YI1klJhJ7BbjwIRZnUZK7MlkNV Jv3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TVtRDFFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qh23si6054480ejb.351.2020.06.13.13.19.00; Sat, 13 Jun 2020 13:19:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TVtRDFFM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726637AbgFMURK (ORCPT + 99 others); Sat, 13 Jun 2020 16:17:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbgFMURI (ORCPT ); Sat, 13 Jun 2020 16:17:08 -0400 Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB7DC03E96F for ; Sat, 13 Jun 2020 13:17:08 -0700 (PDT) Received: by mail-qt1-x841.google.com with SMTP id z1so9786624qtn.2 for ; Sat, 13 Jun 2020 13:17:08 -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=XvmodwFRSbxZ4SI7zIxONP0m2KmZ4cn7dUMYubaK5Ks=; b=TVtRDFFMNSw/l66ad19EjvoamliFx2a/IbcJQJllefvOFy6pOlBriThoJJMflyHn9r mMfY2TQunbbGvbg5mEvBJGkEX/qtcUqXJjkDx++ZxZgiOhZz5j1wJHoHBQ1LIaINBS16 0WL4P9pN8Z1PexylK67mot7qXfFlTiHieZ96xUVBFxBWmlpHob9UgvAnei0Ar5u4sMtL ME2bQgH5o/RbrXViwgvrOhH4loFcfg2NEqYPo0DYsFu38uEBKBr//Jzu2EY/uMFAXTpA QYN2iOcVgDRuCs47X+Id4L8AAb3/F9DyZ7m7GaNO45gPGeCaXgtkosoQnMclldGinoZk GDgw== 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=XvmodwFRSbxZ4SI7zIxONP0m2KmZ4cn7dUMYubaK5Ks=; b=bGXgRK+IL+fFPS152uvTO5cfDAHUUteyB+kizNOAQA3aE7MPK7FJMgTNJ4pqcONx71 idEYJqLD0QB7qAhN9m54IesPNPbC6BjAOKgxZjtaaOD2rGjYN2WofeKXbGPnVJme63Yf MXAmXuNE7otO0dDWRGh6KNR5jDnspBYP5GWauXWOJvVqlm9IPadoM2IgFSHy8EMMrKKa yvnL64vPAez5PQXmIJ+jaV1xFoi7PMp5RL11x/dXB3EZI0UxRTwMnI9M3iHxprvtlkeP /DMIYhQhsxfXl8wQO1s0ki6VmyXi526K5IFRuf9GxIsYrhdTBUYfKGxDxdAhTZbcF6yj 2Fog== X-Gm-Message-State: AOAM531h1aRkEL3RWf4MQXJFJx1Vt7ZXyJV/62dY1n5fxQ6yAyPR+Riy gjAxo5WZWp1KOE4IDvx7EHc= X-Received: by 2002:ac8:4790:: with SMTP id k16mr9181655qtq.362.1592079427023; Sat, 13 Jun 2020 13:17:07 -0700 (PDT) Received: from localhost.localdomain ([72.53.229.195]) by smtp.gmail.com with ESMTPSA id n25sm6969264qkk.76.2020.06.13.13.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 13:17:06 -0700 (PDT) From: Sven Van Asbroeck X-Google-Original-From: Sven Van Asbroeck To: Shawn Guo Cc: Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v1] ARM: imx6plus: enable internal routing of clk_enet_ref where possible Date: Sat, 13 Jun 2020 16:17:03 -0400 Message-Id: <20200613201703.16788-1-TheSven73@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. To: Shawn Guo 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 Signed-off-by: Sven Van Asbroeck --- arch/arm/mach-imx/mach-imx6q.c | 18 ++++++++++++++++++ include/linux/mfd/syscon/imx6q-iomuxc-gpr.h | 1 + 2 files changed, 19 insertions(+) Tree: next-20200613 diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 85c084a716ab..4d22567bb650 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() && + imx_get_soc_revision() >= IMX_CHIP_REVISION_2_0) { + 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) -- 2.17.1