mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH V2] arm: mxs: get MAC from OCOTP for MX28EVK
@ 2012-06-14 13:13 Wolfram Sang
  2012-06-14 14:10 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2012-06-14 13:13 UTC (permalink / raw)
  To: barebox; +Cc: Wolfram Sang

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

V2: rewrote code according to Sascha's style guide ;)

 arch/arm/boards/freescale-mx28-evk/mx28-evk.c |   30 +++++++++++++++++++++++--
 arch/arm/mach-mxs/Kconfig                     |    1 +
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
index 9168ed8..fc395a0 100644
--- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
+++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
@@ -22,17 +22,18 @@
 #include <init.h>
 #include <mci.h>
 #include <io.h>
+#include <net.h>
 
 #include <mach/clock.h>
 #include <mach/imx-regs.h>
 #include <mach/iomux-imx28.h>
 #include <mach/mci.h>
+#include <mach/fb.h>
+#include <mach/ocotp.h>
 
 #include <asm/armlinux.h>
 #include <asm/mmu.h>
 
-#include <mach/fb.h>
-
 #include <generated/mach-types.h>
 
 #define MX28EVK_FEC_PHY_RESET_GPIO	141
@@ -118,6 +119,27 @@ static struct mxs_mci_platform_data mci_pdata = {
 };
 
 /* fec */
+void mx28_evk_get_ethaddr(void)
+{
+	u8 mac_ocotp[3], mac[6];
+	int ret;
+
+	ret = mxs_ocotp_read(mac_ocotp, 3, 0);
+	if (ret != 3) {
+		pr_err("Reading MAC from OCOTP failed!\n");
+		return;
+	}
+
+	mac[0] = 0x00;
+	mac[1] = 0x04;
+	mac[2] = 0x9f;
+	mac[3] = mac_ocotp[2];
+	mac[4] = mac_ocotp[1];
+	mac[5] = mac_ocotp[0];
+
+	eth_register_ethaddr(0, mac);
+}
+
 static void __init mx28_evk_fec_reset(void)
 {
 	mdelay(1);
@@ -208,6 +230,10 @@ static int mx28_evk_devices_init(void)
 	add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
 			   IORESOURCE_MEM, &mx28_evk_fb_pdata);
 
+	add_generic_device("ocotp", 0, NULL, IMX_OCOTP_BASE, 0,
+			IORESOURCE_MEM, NULL);
+	mx28_evk_get_ethaddr(); /* must be after registering ocotp */
+
 	imx_enable_enetclk();
 	mx28_evk_fec_reset();
 	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
index 3348a3c..57bd556 100644
--- a/arch/arm/mach-mxs/Kconfig
+++ b/arch/arm/mach-mxs/Kconfig
@@ -61,6 +61,7 @@ config MACH_TX28
 
 config MACH_MX28EVK
 	bool "mx28-evk"
+	select MXS_OCOTP
 	help
 	  Say Y here if you are using the Freescale i.MX28-EVK board
 
-- 
1.7.10


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH V2] arm: mxs: get MAC from OCOTP for MX28EVK
  2012-06-14 13:13 [PATCH V2] arm: mxs: get MAC from OCOTP for MX28EVK Wolfram Sang
@ 2012-06-14 14:10 ` Sascha Hauer
  2012-06-14 14:17   ` Wolfram Sang
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2012-06-14 14:10 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: barebox

On Thu, Jun 14, 2012 at 03:13:03PM +0200, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> V2: rewrote code according to Sascha's style guide ;)
> 
>  arch/arm/boards/freescale-mx28-evk/mx28-evk.c |   30 +++++++++++++++++++++++--
>  arch/arm/mach-mxs/Kconfig                     |    1 +
>  2 files changed, 29 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> index 9168ed8..fc395a0 100644
> --- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> +++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> @@ -22,17 +22,18 @@
>  #include <init.h>
>  #include <mci.h>
>  #include <io.h>
> +#include <net.h>
>  
>  #include <mach/clock.h>
>  #include <mach/imx-regs.h>
>  #include <mach/iomux-imx28.h>
>  #include <mach/mci.h>
> +#include <mach/fb.h>
> +#include <mach/ocotp.h>
>  
>  #include <asm/armlinux.h>
>  #include <asm/mmu.h>
>  
> -#include <mach/fb.h>
> -
>  #include <generated/mach-types.h>
>  
>  #define MX28EVK_FEC_PHY_RESET_GPIO	141
> @@ -118,6 +119,27 @@ static struct mxs_mci_platform_data mci_pdata = {
>  };
>  
>  /* fec */
> +void mx28_evk_get_ethaddr(void)

static?

Sascha

> +{
> +	u8 mac_ocotp[3], mac[6];
> +	int ret;
> +
> +	ret = mxs_ocotp_read(mac_ocotp, 3, 0);
> +	if (ret != 3) {
> +		pr_err("Reading MAC from OCOTP failed!\n");
> +		return;
> +	}
> +
> +	mac[0] = 0x00;
> +	mac[1] = 0x04;
> +	mac[2] = 0x9f;
> +	mac[3] = mac_ocotp[2];
> +	mac[4] = mac_ocotp[1];
> +	mac[5] = mac_ocotp[0];
> +
> +	eth_register_ethaddr(0, mac);
> +}
> +
>  static void __init mx28_evk_fec_reset(void)
>  {
>  	mdelay(1);
> @@ -208,6 +230,10 @@ static int mx28_evk_devices_init(void)
>  	add_generic_device("stmfb", 0, NULL, IMX_FB_BASE, 4096,
>  			   IORESOURCE_MEM, &mx28_evk_fb_pdata);
>  
> +	add_generic_device("ocotp", 0, NULL, IMX_OCOTP_BASE, 0,
> +			IORESOURCE_MEM, NULL);
> +	mx28_evk_get_ethaddr(); /* must be after registering ocotp */
> +
>  	imx_enable_enetclk();
>  	mx28_evk_fec_reset();
>  	add_generic_device("fec_imx", 0, NULL, IMX_FEC0_BASE, 0,
> diff --git a/arch/arm/mach-mxs/Kconfig b/arch/arm/mach-mxs/Kconfig
> index 3348a3c..57bd556 100644
> --- a/arch/arm/mach-mxs/Kconfig
> +++ b/arch/arm/mach-mxs/Kconfig
> @@ -61,6 +61,7 @@ config MACH_TX28
>  
>  config MACH_MX28EVK
>  	bool "mx28-evk"
> +	select MXS_OCOTP
>  	help
>  	  Say Y here if you are using the Freescale i.MX28-EVK board
>  
> -- 
> 1.7.10
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH V2] arm: mxs: get MAC from OCOTP for MX28EVK
  2012-06-14 14:10 ` Sascha Hauer
@ 2012-06-14 14:17   ` Wolfram Sang
  0 siblings, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2012-06-14 14:17 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox


[-- Attachment #1.1: Type: text/plain, Size: 1571 bytes --]

On Thu, Jun 14, 2012 at 04:10:16PM +0200, Sascha Hauer wrote:
> On Thu, Jun 14, 2012 at 03:13:03PM +0200, Wolfram Sang wrote:
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > ---
> > 
> > V2: rewrote code according to Sascha's style guide ;)
> > 
> >  arch/arm/boards/freescale-mx28-evk/mx28-evk.c |   30 +++++++++++++++++++++++--
> >  arch/arm/mach-mxs/Kconfig                     |    1 +
> >  2 files changed, 29 insertions(+), 2 deletions(-)
> > 
> > diff --git a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> > index 9168ed8..fc395a0 100644
> > --- a/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> > +++ b/arch/arm/boards/freescale-mx28-evk/mx28-evk.c
> > @@ -22,17 +22,18 @@
> >  #include <init.h>
> >  #include <mci.h>
> >  #include <io.h>
> > +#include <net.h>
> >  
> >  #include <mach/clock.h>
> >  #include <mach/imx-regs.h>
> >  #include <mach/iomux-imx28.h>
> >  #include <mach/mci.h>
> > +#include <mach/fb.h>
> > +#include <mach/ocotp.h>
> >  
> >  #include <asm/armlinux.h>
> >  #include <asm/mmu.h>
> >  
> > -#include <mach/fb.h>
> > -
> >  #include <generated/mach-types.h>
> >  
> >  #define MX28EVK_FEC_PHY_RESET_GPIO	141
> > @@ -118,6 +119,27 @@ static struct mxs_mci_platform_data mci_pdata = {
> >  };
> >  
> >  /* fec */
> > +void mx28_evk_get_ethaddr(void)
> 
> static?

Yes :/

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2012-06-14 14:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-14 13:13 [PATCH V2] arm: mxs: get MAC from OCOTP for MX28EVK Wolfram Sang
2012-06-14 14:10 ` Sascha Hauer
2012-06-14 14:17   ` Wolfram Sang

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