From: "Marek Behún" <kabel@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: u-boot@lists.denx.de, "Pali Rohár" <pali@kernel.org>,
"Marek Behún" <marek.behun@nic.cz>
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 [thread overview]
Message-ID: <20211103020244.25428-9-kabel@kernel.org> (raw)
In-Reply-To: <20211103020244.25428-1-kabel@kernel.org>
From: Pali Rohár <pali@kernel.org>
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 <pali@kernel.org>
Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
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));
--
2.32.0
next prev parent reply other threads:[~2021-11-03 2:04 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-03 2:02 [PATCH u-boot-marvell 00/11] Some mvebu comphy + mox + fdt_support changes Marek Behún
2021-11-03 2:02 ` [PATCH u-boot-marvell 01/11] include/linux/byteorder: Fix compilation of __constant_cpu_to_be32() Marek Behún
2021-11-12 12:40 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 02/11] treewide: Use fdt_create_phandle() where appropriate Marek Behún
2021-11-12 12:40 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 03/11] fdt_support: Remove fdt_alloc_phandle() in favor of fdt_generate_phandle() Marek Behún
2021-11-12 12:42 ` Stefan Roese
2021-11-12 17:26 ` Marek Behún
2021-11-03 2:02 ` [PATCH u-boot-marvell 04/11] fdt_support: Remove FDT_STATUS_FAIL_ERROR_CODE Marek Behún
2021-11-12 12:43 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 05/11] fdt_support: Fix comment for fdt_create_phandle() Marek Behún
2021-11-12 12:44 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 06/11] fdt_support: Add some useful functions Marek Behún
2021-11-12 13:14 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 07/11] arm: mvebu: turris_mox: Find DT nodes by compatible or alias instead of path Marek Behún
2021-11-12 13:15 ` Stefan Roese
2021-11-03 2:02 ` Marek Behún [this message]
2021-11-12 13:16 ` [PATCH u-boot-marvell 08/11] arm: mvebu: turris_mox: Enable eth1 in U-Boot if a network module is present Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 09/11] phy: marvell: a3700: Convert to official DT bindings in COMPHY driver Marek Behún
2021-11-12 13:29 ` Stefan Roese
2021-11-12 17:27 ` Marek Behún
2021-11-15 6:47 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 10/11] arm: mvebu: turris_mox: Fix unstable board topology reading Marek Behún
2021-11-12 13:30 ` Stefan Roese
2021-11-03 2:02 ` [PATCH u-boot-marvell 11/11] fdt_support: Add fdt_delete_disabled_nodes() and use in Turris MOX Marek Behún
2021-11-12 13:31 ` Stefan Roese
2021-11-11 15:36 ` [PATCH u-boot-marvell 00/11] Some mvebu comphy + mox + fdt_support changes Marek Behún
2021-11-12 9:49 ` Stefan Roese
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211103020244.25428-9-kabel@kernel.org \
--to=kabel@kernel.org \
--cc=marek.behun@nic.cz \
--cc=pali@kernel.org \
--cc=sr@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox