From patchwork Fri Feb 14 16:08:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alifer Moraes X-Patchwork-Id: 1238146 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=qKjm1kmP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48JywP43Jbz9sWj for ; Sat, 15 Feb 2020 03:08:18 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE2128126F; Fri, 14 Feb 2020 17:07:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="qKjm1kmP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7CE3A8125C; Fri, 14 Feb 2020 17:07:56 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BFD438124F for ; Fri, 14 Feb 2020 17:07:53 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alifer.wsdm@gmail.com Received: by mail-qk1-x743.google.com with SMTP id p7so9665188qkh.10 for ; Fri, 14 Feb 2020 08:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=hD9De07CfQut8JQaLiABYzHRTwsr/J+2033phAveIlQ=; b=qKjm1kmPjCcTZhehc7Mr6PHPGtmGVEoMUJqBEUINt0lONz2SfxjDRlP+0y02plsZJS SEKn7zFHBP4dOV5qNWQgs6hyaxBmO3I74st52fVOs8HR/w2qG517/HDTqADidhckrshf 0HHsepuzKC8RkSibVv0oHNusIZdl13G4ZXur8Ak4jrNoMASpm3azWET5gtlrneMA06On OTfhu4cOgTLYfinK8HMoEMjBlKq04OeIg38getE6TJhxrOr6mhRZ6pMplMNj4UcM7JKK ceAN6II9+6wCq9CBTgSfg8WnXsRLXoOElZDzxJ03kWV3QTl54qtC33bHI18bCJ5Ha7m/ i+Zg== 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=hD9De07CfQut8JQaLiABYzHRTwsr/J+2033phAveIlQ=; b=nNNkUX65y1U31TN98//w4RpsfAVr/494kDHCEQvSRNUIXVCLCix0Ux0EhscPmjbzsC 2278y9zNs8+ikjTS1xSrEyN/bRFYDDHPmFcTHMlg/HWeZjV9/woIphUnBCDX1aTqF9qW 2VPuSS/Y4TvarBKKO75HLc6hFDjS3dMh3CGEPVvCAOdCT0ckAmGfE9waHy2XM0YFe1Pk hANfn2TCg3QGagjDr6NnpyxBPtDKafjWZf+bTgxfGUxgh8kTqXbRGwNpji6jz3e1eCIl 1qEPNOf2His3AckXFGFtYH09ocRotFuHj/r5DY+bBDNEy4qS5+8NNu84h6XOvCzRMN6d FG+Q== X-Gm-Message-State: APjAAAW7f1XHW60uHy97UybCfXu975fqcLkrBjyBKAz+LvAnbdu7w4ld 6XqNv18W5b84bZNCpdA1+V8= X-Google-Smtp-Source: APXvYqxMKnVXJSBR61+ssnzKyvyhTlIXYzC+J+0zl5RNVDtVP66OfFGgu6aXmzV9byECk94tzO/atw== X-Received: by 2002:a37:c07:: with SMTP id 7mr3283689qkm.414.1581696472591; Fri, 14 Feb 2020 08:07:52 -0800 (PST) Received: from L-E5450.nxp.com ([177.221.114.206]) by smtp.gmail.com with ESMTPSA id m17sm1330165qki.128.2020.02.14.08.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 08:07:50 -0800 (PST) From: Alifer Moraes To: sbabic@denx.de Cc: lukma@denx.de, festevam@gmail.com, uboot-imx@nxp.com, peng.fan@nxp.com, u-boot@lists.denx.de, Alifer Moraes Subject: [PATCH 1/3] clk: imx: imx8mn: add enet clk Date: Fri, 14 Feb 2020 13:08:27 -0300 Message-Id: <20200214160829.27994-1-alifer.wsdm@gmail.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Add enet ref/timer/PHY_REF/root clk wich are required to make enet work properly Signed-off-by: Alifer Moraes --- drivers/clk/imx/clk-imx8mn.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index eb43971ae6..103ba770ed 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -80,6 +80,17 @@ static const char *imx8mn_ahb_sels[] = {"clock-osc-24m", "sys_pll1_133m", "sys_p static const char *imx8mn_enet_axi_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_250m", "sys_pll2_200m", "audio_pll1_out", "video_pll1_out", "sys_pll3_out", }; +#ifndef CONFIG_SPL_BUILD +static const char *imx8mn_enet_ref_sels[] = {"clock-osc-24m", "sys_pll2_125m", "sys_pll2_50m", "sys_pll2_100m", + "sys_pll1_160m", "audio_pll1_out", "video_pll1_out", "clk_ext4", }; + +static const char *imx8mn_enet_timer_sels[] = {"clock-osc-24m", "sys_pll2_100m", "audio_pll1_out", "clk_ext1", "clk_ext2", + "clk_ext3", "clk_ext4", "video_pll1_out", }; + +static const char *imx8mn_enet_phy_sels[] = {"clock-osc-24m", "sys_pll2_50m", "sys_pll2_125m", "sys_pll2_200m", + "sys_pll2_500m", "video_pll1_out", "audio_pll2_out", }; +#endif + static const char *imx8mn_nand_usdhc_sels[] = {"clock-osc-24m", "sys_pll1_266m", "sys_pll1_800m", "sys_pll2_200m", "sys_pll1_133m", "sys_pll3_out", "sys_pll2_250m", "audio_pll1_out", }; @@ -363,6 +374,14 @@ static int imx8mn_clk_probe(struct udevice *dev) clk_dm(IMX8MN_CLK_USDHC3_ROOT, imx_clk_gate4("usdhc3_root_clk", "usdhc3", base + 0x45e0, 0)); +/* clks not needed in SPL stage */ +#ifndef CONFIG_SPL_BUILD + clk_dm(IMX8MN_CLK_ENET_REF, imx8m_clk_composite("enet_ref", imx8mn_enet_ref_sels, base + 0xa980)); + clk_dm(IMX8MN_CLK_ENET_TIMER, imx8m_clk_composite("enet_timer", imx8mn_enet_timer_sels, base + 0xaa00)); + clk_dm(IMX8MN_CLK_ENET_PHY_REF, imx8m_clk_composite("enet_phy", imx8mn_enet_phy_sels, base + 0xaa80)); + clk_dm(IMX8MN_CLK_ENET1_ROOT, imx_clk_gate4("enet1_root_clk", "enet_axi", base + 0x40a0, 0)); +#endif + #ifdef CONFIG_SPL_BUILD struct clk *clkp, *clkp1; From patchwork Fri Feb 14 16:08:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alifer Moraes X-Patchwork-Id: 1238147 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=un3dcx5P; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48JywW5Z8yz9sRm for ; Sat, 15 Feb 2020 03:08:27 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CDF5E81271; Fri, 14 Feb 2020 17:08:04 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="un3dcx5P"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5DA7A8124F; Fri, 14 Feb 2020 17:08:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qv1-xf43.google.com (mail-qv1-xf43.google.com [IPv6:2607:f8b0:4864:20::f43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 0366F8124F for ; Fri, 14 Feb 2020 17:07:58 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alifer.wsdm@gmail.com Received: by mail-qv1-xf43.google.com with SMTP id dc14so4497768qvb.9 for ; Fri, 14 Feb 2020 08:07:57 -0800 (PST) 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=2sHf+evuMUCDRz66PMxliXGL/Xc9W1H3jjR+wCBLlHE=; b=un3dcx5PHnOBKEMSrXfHL+Kzy57gGX0OvtAMot/PPcNVjkgBd2d4dO8GBCioP1S1lV Sw3w4ulsHjsqKMwWXE64iP2x2ohuIBALmCTGqJ3+yO0NxasrBiHgJ1TbdFm90K4nIWIL hP+D/NFNvPqN0dZK6lX/SggWj7J87pfUyk/JSXRNHT1WOiR5Dofzs+mpX/3jdY772rXD OIK4c6VOwAM7dGj3dbkggjkmP0WJ4hva2N4m9PdPpzDJCChDv2fL771Sx6fpgNGLlim3 GyhKxyBwibHpu14Sx1JjK43DKDG6pmFXJGGzb7RAmQ+VVJ2N5YCjGUqeQ1MNK+F9xyU5 ZoLg== 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=2sHf+evuMUCDRz66PMxliXGL/Xc9W1H3jjR+wCBLlHE=; b=JtsQFN9ZIkVxiudVJo3ZBfntMW36j8U9bU+tZk1daTB9Ny9pG5P0tVGNfbqzGKPerR mgYNAVq3xOUbv2FGLLPYsdfj/IFKoA5L9XvdNlCHPJ4PuF2x81lZfBA51WWe+Q1Z6ZIL tVd3IULnFm2n+62ya5D7wYFsxT4ov3Ed8nPoal8nK7ocuGNMp2LOKcLIvCMgJI3P1cBn +EFS8dg8H9USitBAMgURNVx3ZEmvSh09yQBZ4XMySBp71AfOZmi8UYptWknggplqg2MA IwjmLxW5hKto1vN0wQQ7DwRQ9ODxgB5hDDaD4cz5w6CTTEww9KEpqn2mcyH06A5lZqZo yyHQ== X-Gm-Message-State: APjAAAWo+eKSf1C6unmXPNE3J353ok41IWjM2MougfTONu12/uHrWvPT 4saMQn1Ff3UTF2IwFV0aKvU= X-Google-Smtp-Source: APXvYqz38rkdsFU0+tFFlM/LEKqaQXw7lW1UbBKeE5GDMLTYZ7+qPPWfQhbjmhCuLCyjFSFZ0J8QzA== X-Received: by 2002:ad4:46ce:: with SMTP id g14mr2802981qvw.67.1581696476868; Fri, 14 Feb 2020 08:07:56 -0800 (PST) Received: from L-E5450.nxp.com ([177.221.114.206]) by smtp.gmail.com with ESMTPSA id m17sm1330165qki.128.2020.02.14.08.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 08:07:55 -0800 (PST) From: Alifer Moraes To: sbabic@denx.de Cc: lukma@denx.de, festevam@gmail.com, uboot-imx@nxp.com, peng.fan@nxp.com, u-boot@lists.denx.de, Alifer Moraes Subject: [PATCH 2/3] clk: imx: imx8mn: add set_parent callback Date: Fri, 14 Feb 2020 13:08:28 -0300 Message-Id: <20200214160829.27994-2-alifer.wsdm@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214160829.27994-1-alifer.wsdm@gmail.com> References: <20200214160829.27994-1-alifer.wsdm@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Add set_parent callback, then assigned-clock-parents in dts could work properly Signed-off-by: Alifer Moraes --- drivers/clk/imx/clk-imx8mn.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c index 103ba770ed..2abd9a3810 100644 --- a/drivers/clk/imx/clk-imx8mn.c +++ b/drivers/clk/imx/clk-imx8mn.c @@ -175,11 +175,30 @@ static int imx8mn_clk_enable(struct clk *clk) return __imx8mn_clk_enable(clk, 1); } +static int imx8mn_clk_set_parent(struct clk *clk, struct clk *parent) +{ + struct clk *c, *cp; + int ret; + + debug("%s(#%lu), parent: %lu\n", __func__, clk->id, parent->id); + + ret = clk_get_by_id(clk->id, &c); + if (ret) + return ret; + + ret = clk_get_by_id(parent->id, &cp); + if (ret) + return ret; + + return clk_set_parent(c, cp); +} + static struct clk_ops imx8mn_clk_ops = { .set_rate = imx8mn_clk_set_rate, .get_rate = imx8mn_clk_get_rate, .enable = imx8mn_clk_enable, .disable = imx8mn_clk_disable, + .set_parent = imx8mn_clk_set_parent, }; static int imx8mn_clk_probe(struct udevice *dev) From patchwork Fri Feb 14 16:08:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alifer Moraes X-Patchwork-Id: 1238148 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=uNVESopL; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48Jywn4VZcz9sWr for ; Sat, 15 Feb 2020 03:08:41 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEDB58127F; Fri, 14 Feb 2020 17:08:13 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="uNVESopL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5058081282; Fri, 14 Feb 2020 17:08:12 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3285781277 for ; Fri, 14 Feb 2020 17:08:05 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=alifer.wsdm@gmail.com Received: by mail-qt1-x844.google.com with SMTP id r5so7270011qtt.9 for ; Fri, 14 Feb 2020 08:08:05 -0800 (PST) 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=WKKSOE8lvmMEQ2aApUMPHlIE544YWEQPwwbYhLjwXRc=; b=uNVESopLuZHPJ+vLspxWQdEO6jGz4bo8hYWb49brv1js2u5EgRq/IivRUxVWJ95dUJ IWjMNooKRrKcplNfJb6VpAapJwy8to0XEKjuBNOEJK+rZd29xo3loxLmUKN7d9nwPcX8 htw6VaiQbEChy7tPftQd1yTW1G85IBYPdSLSQ3+qfO3Ux4a9HrqSb/Aj5UNJ5ZxIQA0g CmfljBSIn7YuLeNUKBvTmt4C1m7FfSblDuerysVWmbIYHgTVsSN4P4H+NUpyxNLAW1fZ uBmzQ5SoC1STJrxEwTfzaC+R4U8/FTdJPava0DvGZWXQQd48GJ3cAi6wPJtTkgN6uP9D rxSQ== 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=WKKSOE8lvmMEQ2aApUMPHlIE544YWEQPwwbYhLjwXRc=; b=e227cvUQrb7/ZtqeExRjDg/ITcIe9phLJT7PsmvWuRoMbb0kSxYiDZes4Bq6Ci6koy 93pEi9g9ZIFILT+7q44Kot+ZRpR/uhvtwBLaDfTHBFLN+Kk9bTHkZfUTEnp5sehnijgP qdbhUjz8EkpQ837QTer7+OheiOUOf6S4JzUQKcM4TERg6rpwEq8piniFAIaOVRuLcCj+ WOYcYHi//h0g5eLWbZkgrs/Yan73E484kwGyt3bgMBOXf5poOXrBx7qfPGyR31n+VCmX 05aiOefE7MUb59YNucTESb9LSLYWE8dQT4g/29u9EXq5y6DqolrNXlGrGusHFyIGr3b5 NlFg== X-Gm-Message-State: APjAAAUtHbILv0oxqi6VfJreWeh5O70UZZK4G7thu6+UxiJU+g3eEmpN hcFYPOavPDGbMBeq+IAYe1k= X-Google-Smtp-Source: APXvYqyPHp6tPEGkE4/Xxs2sZy8JMldWjm3+S+FJyu8Zx28YjAa4Ch+Tx7LG7B2dJfGpjU7A69bdlA== X-Received: by 2002:ac8:5205:: with SMTP id r5mr3212047qtn.230.1581696481157; Fri, 14 Feb 2020 08:08:01 -0800 (PST) Received: from L-E5450.nxp.com ([177.221.114.206]) by smtp.gmail.com with ESMTPSA id m17sm1330165qki.128.2020.02.14.08.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Feb 2020 08:08:00 -0800 (PST) From: Alifer Moraes To: sbabic@denx.de Cc: lukma@denx.de, festevam@gmail.com, uboot-imx@nxp.com, peng.fan@nxp.com, u-boot@lists.denx.de, Alifer Moraes Subject: [PATCH 3/3] imx: imx8mn-evk: enable ethernet Date: Fri, 14 Feb 2020 13:08:29 -0300 Message-Id: <20200214160829.27994-3-alifer.wsdm@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200214160829.27994-1-alifer.wsdm@gmail.com> References: <20200214160829.27994-1-alifer.wsdm@gmail.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Enable ethernet on i.MX 8MN EVK Signed-off-by: Alifer Moraes --- arch/arm/dts/imx8mn-ddr4-evk.dts | 2 ++ board/freescale/imx8mn_evk/imx8mn_evk.c | 36 +++++++++++++++++++++++++ configs/imx8mn_ddr4_evk_defconfig | 8 ++++++ include/configs/imx8mn_evk.h | 2 ++ 4 files changed, 48 insertions(+) diff --git a/arch/arm/dts/imx8mn-ddr4-evk.dts b/arch/arm/dts/imx8mn-ddr4-evk.dts index 9b2c1727a8..53ce10b13d 100644 --- a/arch/arm/dts/imx8mn-ddr4-evk.dts +++ b/arch/arm/dts/imx8mn-ddr4-evk.dts @@ -165,6 +165,8 @@ pinctrl-0 = <&pinctrl_fec1>; phy-mode = "rgmii-id"; phy-handle = <ðphy0>; + phy-reset-gpios = <&gpio4 22 GPIO_ACTIVE_LOW>; + phy-reset-duration = <10>; fsl,magic-packet; status = "okay"; diff --git a/board/freescale/imx8mn_evk/imx8mn_evk.c b/board/freescale/imx8mn_evk/imx8mn_evk.c index 4f33c0e7c9..9ff1dc8555 100644 --- a/board/freescale/imx8mn_evk/imx8mn_evk.c +++ b/board/freescale/imx8mn_evk/imx8mn_evk.c @@ -4,6 +4,10 @@ */ #include +#include +#include +#include +#include DECLARE_GLOBAL_DATA_PTR; @@ -14,8 +18,40 @@ int dram_init(void) return 0; } +#if IS_ENABLED(CONFIG_FEC_MXC) +static int setup_fec(void) +{ + struct iomuxc_gpr_base_regs *gpr = + (struct iomuxc_gpr_base_regs *)IOMUXC_GPR_BASE_ADDR; + + /* Use 125M anatop REF_CLK1 for ENET1, not from external */ + clrsetbits_le32(&gpr->gpr[1], 0x2000, 0); + + return 0; +} + +int board_phy_config(struct phy_device *phydev) +{ + /* enable rgmii rxc skew and phy mode select to RGMII copper */ + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x1f); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x8); + + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x00); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x82ee); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1d, 0x05); + phy_write(phydev, MDIO_DEVAD_NONE, 0x1e, 0x100); + + if (phydev->drv->config) + phydev->drv->config(phydev); + return 0; +} +#endif + int board_init(void) { + if (IS_ENABLED(CONFIG_FEC_MXC)) + setup_fec(); + return 0; } diff --git a/configs/imx8mn_ddr4_evk_defconfig b/configs/imx8mn_ddr4_evk_defconfig index e3f99896a6..0e21283d58 100644 --- a/configs/imx8mn_ddr4_evk_defconfig +++ b/configs/imx8mn_ddr4_evk_defconfig @@ -43,6 +43,9 @@ CONFIG_CMD_FUSE=y CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +CONFIG_CMD_DHCP=y +CONFIG_CMD_MII=y +CONFIG_CMD_PING=y CONFIG_CMD_CACHE=y CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT2=y @@ -67,7 +70,12 @@ CONFIG_DM_MMC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_ESDHC_IMX=y CONFIG_PHYLIB=y +CONFIG_PHY_ATHEROS=y CONFIG_DM_ETH=y +CONFIG_PHY_GIGE=y +CONFIG_FEC_MXC=y +CONFIG_MII=y +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_PINCTRL=y CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_IMX8M=y diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h index ce73ca6b0a..bfc1a55637 100644 --- a/include/configs/imx8mn_evk.h +++ b/include/configs/imx8mn_evk.h @@ -149,4 +149,6 @@ #define CONFIG_SYS_I2C_SPEED 100000 +#define FEC_QUIRK_ENET_MAC + #endif