public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] mx6: soc: Add ENET2 mac address support
Date: Wed, 20 Jan 2016 09:17:39 +0800	[thread overview]
Message-ID: <20160120011738.GB32712@linux-7smt.suse> (raw)
In-Reply-To: <1453209396-10404-1-git-send-email-ye.li@nxp.com>

On Tue, Jan 19, 2016 at 09:16:35PM +0800, Ye Li wrote:
>The i.MX6SX and i.MX6UL has two ENET controllers, add support for reading
>MAC address from fuse for ENET2.
>
>Signed-off-by: Ye Li <ye.li@nxp.com>

Reviewed-by: Peng Fan <peng.fan@nxp.com>

>---
> arch/arm/cpu/armv7/mx6/soc.c             |   32 +++++++++++++++++++++--------
> arch/arm/include/asm/arch-mx6/imx-regs.h |   19 +----------------
> 2 files changed, 24 insertions(+), 27 deletions(-)
>
>diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
>index bf5ae8c..e521bf2 100644
>--- a/arch/arm/cpu/armv7/mx6/soc.c
>+++ b/arch/arm/cpu/armv7/mx6/soc.c
>@@ -364,15 +364,29 @@ void imx_get_mac_from_fuse(int dev_id, unsigned char *mac)
> 	struct fuse_bank4_regs *fuse =
> 			(struct fuse_bank4_regs *)bank->fuse_regs;
> 
>-	u32 value = readl(&fuse->mac_addr_high);
>-	mac[0] = (value >> 8);
>-	mac[1] = value ;
>-
>-	value = readl(&fuse->mac_addr_low);
>-	mac[2] = value >> 24 ;
>-	mac[3] = value >> 16 ;
>-	mac[4] = value >> 8 ;
>-	mac[5] = value ;
>+	if ((is_cpu_type(MXC_CPU_MX6SX) || is_cpu_type(MXC_CPU_MX6UL)) && 
>+		1 == dev_id) {
>+		u32 value = readl(&fuse->mac_addr2);
>+		mac[0] = value >> 24 ;
>+		mac[1] = value >> 16 ;
>+		mac[2] = value >> 8 ;
>+		mac[3] = value ;
>+
>+		value = readl(&fuse->mac_addr_high);
>+		mac[4] = value >> 24 ;
>+		mac[5] = value >> 16 ;
>+		
>+	} else {
>+		u32 value = readl(&fuse->mac_addr_high);
>+		mac[0] = (value >> 8);
>+		mac[1] = value ;
>+
>+		value = readl(&fuse->mac_addr_low);
>+		mac[2] = value >> 24 ;
>+		mac[3] = value >> 16 ;
>+		mac[4] = value >> 8 ;
>+		mac[5] = value ;
>+	}
> 
> }
> #endif
>diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
>index f24525e..d0324a0 100644
>--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
>+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
>@@ -715,7 +715,6 @@ struct fuse_bank1_regs {
> 	u32	rsvd7[3];
> };
> 
>-#if (defined(CONFIG_MX6SX) || defined(CONFIG_MX6UL))
> struct fuse_bank4_regs {
> 	u32 sjc_resp_low;
> 	u32 rsvd0[3];
>@@ -725,29 +724,13 @@ struct fuse_bank4_regs {
> 	u32 rsvd2[3];
> 	u32 mac_addr_high;
> 	u32 rsvd3[3];
>-	u32 mac_addr2;
>+	u32 mac_addr2; /*For i.MX6SX and i.MX6UL*/
> 	u32 rsvd4[7];
> 	u32 gp1;
> 	u32 rsvd5[3];
> 	u32 gp2;
> 	u32 rsvd6[3];
> };
>-#else
>-struct fuse_bank4_regs {
>-	u32	sjc_resp_low;
>-	u32     rsvd0[3];
>-	u32     sjc_resp_high;
>-	u32     rsvd1[3];
>-	u32	mac_addr_low;
>-	u32     rsvd2[3];
>-	u32     mac_addr_high;
>-	u32	rsvd3[0xb];
>-	u32	gp1;
>-	u32	rsvd4[3];
>-	u32	gp2;
>-	u32	rsvd5[3];
>-};
>-#endif
> 
> struct aipstz_regs {
> 	u32	mprot0;
>-- 
>1.7.4.1
>
>_______________________________________________
>U-Boot mailing list
>U-Boot at lists.denx.de
>http://lists.denx.de/mailman/listinfo/u-boot

  parent reply	other threads:[~2016-01-20  1:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-19 13:16 [U-Boot] [PATCH 1/2] mx6: soc: Add ENET2 mac address support Ye Li
2016-01-19 13:16 ` [U-Boot] [PATCH 2/2] imx: mx6sxsabreauto: Add support for mx6sx SABREAUTO board Ye Li
2016-01-20  1:34   ` Peng Fan
2016-01-20  1:17 ` Peng Fan [this message]
2016-01-24 10:35 ` [U-Boot] [PATCH 1/2] mx6: soc: Add ENET2 mac address support Stefano Babic
2016-01-25  3:24   ` Ye Li

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=20160120011738.GB32712@linux-7smt.suse \
    --to=van.freenix@gmail.com \
    --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