linux-mips
[Top] [All Lists]

[PATCH] MIPS: octeon: fix DT pruning bug with pip ports

To: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: [PATCH] MIPS: octeon: fix DT pruning bug with pip ports
From: Faidon Liambotis <paravoid@debian.org>
Date: Fri, 12 Jul 2013 01:08:09 +0300
Cc: Aaro Koskinen <aaro.koskinen@iki.fi>
Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tty.gr; s=x; h=Message-Id:Date:Subject:Cc:To:From; bh=nuAbwwn3ILsUvVp3T/u3UQ7ahsbqvjmL0UDqkennPQM=; b=NWldSZTu7+g+SmnvxWuQYjqL7yMSeT7i2PWP9TdP+pPEftWCD9LYni3ezovxUxRvJvKt+DoU13ge2/1tLtWk9LaavE1YnWQQqnauRiSqTcoqYkCq/lhtqZH7qCvoFW5/;
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
During the pruning of the device tree octeon_fdt_pip_iface() is called
for each PIP interface and every port up to the port count is removed
from the device tree. However, the count was set to the return value of
cvmx_helper_interface_enumerate() which doesn't actually return the
count but just returns zero on success. This effectively removed *all*
ports from the tree.

Use cvmx_helper_ports_on_interface() instead to fix this. This
successfully restores the 3 ports of my ERLite-3 and fixes the "kernel
assigns random MAC addresses" issue.

Signed-off-by: Faidon Liambotis <paravoid@debian.org>
---
 arch/mips/cavium-octeon/octeon-platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/mips/cavium-octeon/octeon-platform.c 
b/arch/mips/cavium-octeon/octeon-platform.c
index 389512e..250eb20 100644
--- a/arch/mips/cavium-octeon/octeon-platform.c
+++ b/arch/mips/cavium-octeon/octeon-platform.c
@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, 
u64 *pmac)
        char name_buffer[20];
        int iface;
        int p;
-       int count;
+       int count = 0;
 
-       count = cvmx_helper_interface_enumerate(idx);
+       if (cvmx_helper_interface_enumerate(idx) == 0)
+               count = cvmx_helper_ports_on_interface(idx);
 
        snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
        iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
-- 
1.8.3.2


<Prev in Thread] Current Thread [Next in Thread>