From patchwork Wed Nov 3 02:02:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 1550086 X-Patchwork-Delegate: sr@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=ONNinqjm; dkim-atps=neutral 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=) 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)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HkVSP6Jvlz9sRK for ; Wed, 3 Nov 2021 13:04:05 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A8DE88362C; Wed, 3 Nov 2021 03:03:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org 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=kernel.org header.i=@kernel.org header.b="ONNinqjm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A878683538; Wed, 3 Nov 2021 03:03:15 +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.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6FEDC835BE for ; Wed, 3 Nov 2021 03:03:01 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=kabel@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 435CA61108; Wed, 3 Nov 2021 02:02:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1635904980; bh=iIR1uVeUMTo0H4Jp9zCbS3chUIUu6hXSZq8Iq6vHSPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONNinqjm9pfx1rmcSGxGk0WivKGsUqfdIOgQjBQiJVET3vnO2gaSsOcxcc3ZJ7miJ 0fv7psuK23XlBiUeHfCzRkBXpUBKuv76kZeserknpbSs/H/WkuA5mKYVxIuSEl1Zrp patdtYk/IBuNEpkp1BWiLZZ/Vjds96fVVW8PNZkYjH+JFLF6JbhVNnhtSWN50uLtoL obc5THKdkYXiXgeEWwTFHY6GHooY8p2ba1DsSa6MZ6Bst6KMRh7FBM8XUCo8cMYWKB 77ijIhfsm8hl4QV6xkye8WytkuaEmP7LxCDeP02t2HP1DMhEDP5d31uebEUp7ePIYy UBJ7EQKBYmpdw== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: Stefan Roese Cc: u-boot@lists.denx.de, =?utf-8?q?Pali_Roh=C3=A1r?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH u-boot-marvell 08/11] arm: mvebu: turris_mox: Enable eth1 in U-Boot if a network module is present Date: Wed, 3 Nov 2021 03:02:41 +0100 Message-Id: <20211103020244.25428-9-kabel@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211103020244.25428-1-kabel@kernel.org> References: <20211103020244.25428-1-kabel@kernel.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.103.2 at phobos.denx.de X-Virus-Status: Clean From: Pali Rohár Enable eth1 node in U-Boot's device-tree if a network module (SFP, Topaz or Peridot) is detected. This is required for proper detection of eth1 comphy in a3700 comphy driver by the following patches. Signed-off-by: Pali Rohár Signed-off-by: Marek Behún Reviewed-by: Stefan Roese --- board/CZ.NIC/turris_mox/turris_mox.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c index 03c923969e..502f6fc010 100644 --- a/board/CZ.NIC/turris_mox/turris_mox.c +++ b/board/CZ.NIC/turris_mox/turris_mox.c @@ -46,8 +46,8 @@ DECLARE_GLOBAL_DATA_PTR; #if defined(CONFIG_OF_BOARD_FIXUP) int board_fix_fdt(void *blob) { + enum fdt_status status_pcie, status_eth1; u8 topology[MAX_MOX_MODULES]; - enum fdt_status status; int i, size, ret; /* @@ -65,6 +65,9 @@ int board_fix_fdt(void *blob) while (!(readl(ARMADA_37XX_SPI_CTRL) & 0x2)) udelay(1); + status_pcie = FDT_STATUS_DISABLED; + status_eth1 = FDT_STATUS_DISABLED; + for (i = 0; i < MAX_MOX_MODULES; ++i) { writel(0x0, ARMADA_37XX_SPI_DOUT); @@ -76,6 +79,11 @@ int board_fix_fdt(void *blob) break; topology[i] &= 0xf; + + if (topology[i] == MOX_MODULE_SFP || + topology[i] == MOX_MODULE_TOPAZ || + topology[i] == MOX_MODULE_PERIDOT) + status_eth1 = FDT_STATUS_OKAY; } size = i; @@ -83,15 +91,18 @@ int board_fix_fdt(void *blob) /* disable SPI CS1 */ clrbits_le32(ARMADA_37XX_SPI_CTRL, BIT(17)); + ret = fdt_set_status_by_alias(blob, "ethernet1", status_eth1); + if (ret < 0) + printf("Cannot set status for eth1 in U-Boot's device tree: %s!\n", + fdt_strerror(ret)); + if (size > 1 && (topology[1] == MOX_MODULE_PCI || topology[1] == MOX_MODULE_USB3 || topology[1] == MOX_MODULE_PASSPCI)) - status = FDT_STATUS_OKAY; - else - status = FDT_STATUS_DISABLED; + status_pcie = FDT_STATUS_OKAY; ret = fdt_set_status_by_compatible(blob, "marvell,armada-3700-pcie", - status); + status_pcie); if (ret < 0) { printf("Cannot set status for PCIe in U-Boot's device tree: %s!\n", fdt_strerror(ret));