From patchwork Mon Dec 30 12:04:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 977 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1E0E13F03F for ; Mon, 30 Dec 2019 13:04:29 +0100 (CET) Received: by mail-pf1-f197.google.com with SMTP id d127sf15882388pfa.7 for ; Mon, 30 Dec 2019 04:04:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1577707468; cv=pass; d=google.com; s=arc-20160816; b=IvWKgvjtd83IMqPpmGktPaJvG19TOp1E2oDN4vIWN56O5ZB3O6D+z/MtcJALTB4/Pc 2GqMAdc8CPeCsZ8ssxCPGa5IldxszPwT2PUnh/NTYebkD08V6AOCKDRuv+mC8CdoNWnx 9OWz90Pn3Sp1LqiATEzBmrdFG6HkYHEwAEp86W0+GWcmLc2s6A1EvWgUpkzr5C/Sts/A Mp8dM4S9+pKQZG4lDgT75IimjN5HVg9fJw333PUTERB7t9TzalkcrZ1hlogtOkBnIYE8 m2U5G/jQjGUJcfAZa8elA3Jo9UGQkfqUXD4i2Ekz8IJnrgGjNn5u+5P44xe9Qevj7fAc B2VQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=atdqfH1z+jjy8btcUM2KLU3MbCxVSU0wEq3NMXh4cCQ=; b=XJkJMqgdd0nx9u0L9UeptgBymVxNyCX4gKrLpp7O6/UFD3rZ/3cmf9hCyPkHHOWwJY BFRgyYLYIvV1bLcvFTgH+OTjZdomonBHIDq7Eh5msvap9OtWE0cXi55cJhAiDWaJ8B5S clsJy4NhMCjx258+TIukit9svSrjSb4dD5ggEIWHucSgXL0gdDYUUYLLTstLZvgQu2+9 jdERlFLY2wDXmrJH1gvg6VFkAyqVdQK2DjOVzP9CqbRjdtGCvBUeojCjgVXTWLuUyR7Q 2ZbwVwobyju2ow51/MOFD7mBsq49fmHO/StNbaELT/DqgZ/ON8HtTbHk3vlXpL35p9J+ xkpg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ApXvK8JL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=atdqfH1z+jjy8btcUM2KLU3MbCxVSU0wEq3NMXh4cCQ=; b=f23FPB5w4XQ3FCa29+Ul8YMXCTr6Dxtci6ZL01vn+XuaYIbFeAoFvcsqKTDGa2DWzz RtGf0RHRwgsBy5sOJjAUjUsIOD4V+AVOJDQIG/Lb+nvPXMoi+gBNKcPs6ilzNo4dVbBC AJ18Wi+kQdg1mynleTKu8XwR7daSNafmNKFyY= 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=atdqfH1z+jjy8btcUM2KLU3MbCxVSU0wEq3NMXh4cCQ=; b=qisEAhFYccFbsfykPPifdcCScmM5Xh3K1NxHKmdbL5LQxg6S8BkiNQBWHA8TKXOFM9 mgBhpylZlI2jsh6TSwFAI8hZNVsEiFohA2AQ/6afVfJH8LW4sfHFt6XMi+Pz5gh431Da HitXetrUrYTtlz/9k5z3SCqkUW7bBkMsdD+XHmAMSIWCEARcUq+4cuHNevARNpkNOcwm RB+nWaCkyucMlk4zOPrlZZksK4YNiWEo/SVgSPjXU3VFbTkTMGxJ1USVyktf6td/1n4o YBrOIbyyDnMP5QwPCUdd9WcVw+jqfeDnwj1l4f9lVxdhUfjWz3bon2QCMioxpmCImVwh r/uA== X-Gm-Message-State: APjAAAUu6+kqQm/VBiHldQJPFgBGRCQ6QuEzB/nvgMJFWZ+eeBSNYiFw 6MUXg4tbifuoa/RYRhXMKn12dGso X-Google-Smtp-Source: APXvYqyEmixd3SdlUQX3j8hCwkE3VhHgh7xoXz4n4PJcJHIqG12QqyOouJn4oxO6eHfzRjpLHNF3fQ== X-Received: by 2002:a17:902:8e87:: with SMTP id bg7mr42026255plb.279.1577707467881; Mon, 30 Dec 2019 04:04:27 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:ba8b:: with SMTP id k11ls7180863pls.13.gmail; Mon, 30 Dec 2019 04:04:27 -0800 (PST) X-Received: by 2002:a17:902:8b89:: with SMTP id ay9mr57734147plb.309.1577707467329; Mon, 30 Dec 2019 04:04:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577707467; cv=none; d=google.com; s=arc-20160816; b=BHnlWUMDKx9t4ISzH4Yr6C7t20W/zVb3d4PGc1KfzizhTshyu/dCrL0lUwCSwTzhXg zZWCoeppp4wEtC2pG/6tYS4vHMbY8XB7S+Q77kYgjDfJ6flIpxPsHBSNh2JqMzj+vywU 1NgnqVWCmdG7VwltY+EfdcwaT0rKwBFQtXMH7oeBeBo50iGZwqG/LqjCJBKo/yf3j53M j7eqcYPVDzw6fkDCquRfGjGZSMQHgTHEvpxzVb/l1nEBcZ7aapNO1XGaYW2lIufPAPXq eJcxqRbdPf9Czrl3mHQTi4wCnLumKSYtAn+BcJ2azIqo8h+qE3lIeiJezm5pWdYwaNTv rrIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=thqmmrBPT2ITS8/+D8jQ9w02jMZLrX9dio7x6TuRY20=; b=rGEZHtb2iu/jZU64p9pCFA01vuSia2U+WO6L2VxEuwvMKu8IosoxKQ3b4dASjNCaBR +0X28YweGquJ3ctQxRF6kSTd+VSk+ELR76XopX0Yw4eEO7apW3k/vIH5bh8JUiJUnyu/ U+qHxzUO51G0BwdTOJq0vCFT3VEoB+6ocyIYSiYpettqxyy5AXbOm0iqKSlk3A4sPQeF QvxEaw5vyByTkTnUb1ZPYYYVV1hO0hSo7HwN3/bAs/k+ZHT3D1P8A4btSYTLiBVYvCt1 ehvr8ivrl3UjKLZaegjEcOEoDUDx6LCxDQe+3Jh+e8g6DjJcp1Qt//YXexg2h9zk4JSb 7LFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ApXvK8JL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d15sor37444731plr.44.2019.12.30.04.04.27 for (Google Transport Security); Mon, 30 Dec 2019 04:04:27 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; X-Received: by 2002:a17:902:8d8c:: with SMTP id v12mr46257530plo.336.1577707467013; Mon, 30 Dec 2019 04:04:27 -0800 (PST) Received: from localhost.localdomain ([49.206.202.131]) by smtp.gmail.com with ESMTPSA id n7sm24552620pjq.8.2019.12.30.04.04.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Dec 2019 04:04:26 -0800 (PST) From: Jagan Teki To: Stefano Babic , Fabio Estevam , uboot-imx@nxp.com Cc: Michael Trimarchi , u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH 2/8] board: engicam: Fix the ethernet clock initialization Date: Mon, 30 Dec 2019 17:34:03 +0530 Message-Id: <20191230120409.884-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.18.0.321.gffc6fa0e3 In-Reply-To: <20191230120409.884-1-jagan@amarulasolutions.com> References: <20191230120409.884-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=ApXvK8JL; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Michael Trimarchi According to the SOM and reference board the clock can be taken from the external pin or provided from ENET_REF_CLK. Add a new function that make the proper set according the board type. Signed-off-by: Michael Trimarchi Signed-off-by: Jagan Teki --- board/engicam/common/board.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c index 992d209cbd..6472d382c9 100644 --- a/board/engicam/common/board.c +++ b/board/engicam/common/board.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include @@ -101,6 +103,32 @@ static enum engicam_boards engicam_board_detect(void) return -EINVAL; } +static int fixup_enet_clock(enum engicam_boards board_detected) +{ + struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; + int clk_internal = 0; + + switch (board_detected) { + case IMX6Q_ICORE_MIPI: + case IMX6DL_ICORE_MIPI: + clk_internal = 1; + break; + default: + break; + } + + /* set gpr1[21] to select anatop clock */ + debug("fixup_enet_clock %d\n", clk_internal); + clrsetbits_le32(&iomuxc_regs->gpr[1], 0x1 << 21, clk_internal << 21); + + if (!clk_internal) { + /* clock is external */ + return 0; + } + + return enable_fec_anatop_clock(0, ENET_50MHZ); +} + int board_late_init(void) { enum engicam_boards board_detected = IMX6Q_ICORE; @@ -133,6 +161,7 @@ int board_late_init(void) if (board_detected < 0) hang(); + fixup_enet_clock(board_detected); setenv_fdt_file(board_detected); #ifdef CONFIG_HW_WATCHDOG