aboutsummaryrefslogtreecommitdiff
path: root/board/CZ.NIC/turris_mox
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2021-11-26 14:57:12 +0100
committerStefan Roese <sr@denx.de>2021-12-19 09:50:47 +0100
commit6324d68039656922d077289dc4d2f4dccfde2e93 (patch)
treefeffa099c6e190b463b2854e1e5e1cb4a679221b /board/CZ.NIC/turris_mox
parentbcf6971d536793eb99e12ff857cc018963d7cd46 (diff)
downloadu-boot-6324d68039656922d077289dc4d2f4dccfde2e93.zip
u-boot-6324d68039656922d077289dc4d2f4dccfde2e93.tar.gz
u-boot-6324d68039656922d077289dc4d2f4dccfde2e93.tar.bz2
arm: mvebu: turris_mox: Enable eth1 in U-Boot if a network module is present
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> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'board/CZ.NIC/turris_mox')
-rw-r--r--board/CZ.NIC/turris_mox/turris_mox.c21
1 files 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 03c9239..502f6fc 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));