* [U-Boot] [PATCH v2] powerpc/cpu/mpc85xx: Add MAC address for layer 2 switch
@ 2014-03-28 16:57 Codrin Ciubotariu
2014-04-23 22:10 ` York Sun
0 siblings, 1 reply; 2+ messages in thread
From: Codrin Ciubotariu @ 2014-03-28 16:57 UTC (permalink / raw)
To: u-boot
T1040RDB and T1040QDS boards have an integrated l2 switch.
The switch needs a MAC address for Layer 2 protocols
(MSTP, LLDP, LACP, etc). Setting a MAC address on l2switchaddr will add
a MAC in device-tree, under node l2switch.
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
Cc: York Sun <yorksun@freescale.com>
---
Changes v2:
- replaced board macros with SoC macro;
- added more comments;
arch/powerpc/cpu/mpc85xx/fdt.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 33bc900..35bd013 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -582,6 +582,33 @@ static void fdt_fixup_usb(void *fdt)
#define fdt_fixup_usb(x)
#endif
+#if defined(CONFIG_PPC_T1040)
+static void fdt_fixup_l2_switch(void *blob)
+{
+ uchar l2swaddr[6];
+ int node;
+
+ /* The l2switch node from device-tree has
+ * compatible string "vitesse-9953" */
+ node = fdt_node_offset_by_compatible(blob, -1, "vitesse-9953");
+ if (node == -FDT_ERR_NOTFOUND)
+ /* no l2switch node has been found */
+ return;
+
+ /* Get MAC address for the l2switch from "l2switchaddr"*/
+ if (!eth_getenv_enetaddr("l2switchaddr", l2swaddr)) {
+ printf("Warning: MAC address for l2switch not found\n");
+ memset(l2swaddr, 0, sizeof(l2swaddr));
+ }
+
+ /* Add MAC address to l2switch node */
+ fdt_setprop(blob, node, "local-mac-address", l2swaddr,
+ sizeof(l2swaddr));
+}
+#else
+#define fdt_fixup_l2_switch(x)
+#endif
+
void ft_cpu_setup(void *blob, bd_t *bd)
{
int off;
@@ -719,6 +746,8 @@ void ft_cpu_setup(void *blob, bd_t *bd)
"clock-frequency", gd->bus_clk/2, 1);
fdt_fixup_usb(blob);
+
+ fdt_fixup_l2_switch(blob);
}
/*
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread* [U-Boot] [PATCH v2] powerpc/cpu/mpc85xx: Add MAC address for layer 2 switch
2014-03-28 16:57 [U-Boot] [PATCH v2] powerpc/cpu/mpc85xx: Add MAC address for layer 2 switch Codrin Ciubotariu
@ 2014-04-23 22:10 ` York Sun
0 siblings, 0 replies; 2+ messages in thread
From: York Sun @ 2014-04-23 22:10 UTC (permalink / raw)
To: u-boot
On 03/28/2014 09:57 AM, Codrin Ciubotariu wrote:
> T1040RDB and T1040QDS boards have an integrated l2 switch.
> The switch needs a MAC address for Layer 2 protocols
> (MSTP, LLDP, LACP, etc). Setting a MAC address on l2switchaddr will add
> a MAC in device-tree, under node l2switch.
>
> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@freescale.com>
> Cc: York Sun <yorksun@freescale.com>
> ---
>
> Changes v2:
> - replaced board macros with SoC macro;
> - added more comments;
>
Applied to u-boot-mpc85xx/master, thanks.
York
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-23 22:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28 16:57 [U-Boot] [PATCH v2] powerpc/cpu/mpc85xx: Add MAC address for layer 2 switch Codrin Ciubotariu
2014-04-23 22:10 ` York Sun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox