Linux MIPS Architecture development
 help / color / mirror / Atom feed
* [PATCH] MIPS: octeon: fix DT pruning bug with pip ports
@ 2013-07-11 22:08 Faidon Liambotis
  2013-07-14 19:09 ` Aaro Koskinen
  2013-07-18 17:45 ` David Daney
  0 siblings, 2 replies; 3+ messages in thread
From: Faidon Liambotis @ 2013-07-11 22:08 UTC (permalink / raw)
  To: Ralf Baechle, linux-mips; +Cc: Aaro Koskinen

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: octeon: fix DT pruning bug with pip ports
  2013-07-11 22:08 [PATCH] MIPS: octeon: fix DT pruning bug with pip ports Faidon Liambotis
@ 2013-07-14 19:09 ` Aaro Koskinen
  2013-07-18 17:45 ` David Daney
  1 sibling, 0 replies; 3+ messages in thread
From: Aaro Koskinen @ 2013-07-14 19:09 UTC (permalink / raw)
  To: Faidon Liambotis; +Cc: Ralf Baechle, linux-mips

On Fri, Jul 12, 2013 at 01:08:09AM +0300, Faidon Liambotis wrote:
> 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>

Tested-by: Aaro Koskinen <aaro.koskinen@iki.fi>

Thanks,

A.

> ---
>  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
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] MIPS: octeon: fix DT pruning bug with pip ports
  2013-07-11 22:08 [PATCH] MIPS: octeon: fix DT pruning bug with pip ports Faidon Liambotis
  2013-07-14 19:09 ` Aaro Koskinen
@ 2013-07-18 17:45 ` David Daney
  1 sibling, 0 replies; 3+ messages in thread
From: David Daney @ 2013-07-18 17:45 UTC (permalink / raw)
  To: Faidon Liambotis, Ralf Baechle; +Cc: linux-mips, Aaro Koskinen

On 07/11/2013 03:08 PM, Faidon Liambotis wrote:
> 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>

Yes, this seems to be correct.  It doesn't seem to break my ebt3000 
board so...

Acked-by: David Daney <david.daney@cavium.com>

Ralf, please try to get it merged for 3.11, thanks.



> ---
>   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);
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-18 17:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-11 22:08 [PATCH] MIPS: octeon: fix DT pruning bug with pip ports Faidon Liambotis
2013-07-14 19:09 ` Aaro Koskinen
2013-07-18 17:45 ` David Daney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox