[PATCH v3] davinci: da850 EVM: read mac address from SPI flash

Rajashekhara, Sudhakar sudhakar.raj at ti.com
Tue Jul 12 06:34:38 EDT 2011


Hi,

On Mon, Jul 11, 2011 at 18:02:55, Nori, Sekhar wrote:
> Hi Sudhakar,
> 
> On Mon, Jul 11, 2011 at 14:58:21, Rajashekhara, Sudhakar wrote:
> 
> > diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
> > index a7b41bf..5bb6556 100644
> > --- a/arch/arm/mach-davinci/board-da850-evm.c
> > +++ b/arch/arm/mach-davinci/board-da850-evm.c
> > @@ -115,6 +115,25 @@ static struct spi_board_info da850evm_spi_info[] = {
> >  	},
> >  };
> >  
> > +#ifdef CONFIG_MTD
> > +static void da850_evm_m25p80_notify_add(struct mtd_info *mtd)
> > +{
> > +	char *mac_addr = davinci_soc_info.emac_pdata->mac_addr;
> > +	size_t retlen;
> > +
> > +	if (!strcmp(mtd->name, "MAC-Address")) {
> > +		mtd->read(mtd, 0, ETH_ALEN, &retlen, mac_addr);
> > +		if (retlen == ETH_ALEN)
> > +			pr_info("Read MAC addr from SPI Flash: %pM\n",
> > +				mac_addr);
> > +	}
> > +}
> > +
> > +static struct mtd_notifier da850evm_spi_notifier = {
> > +	.add	= da850_evm_m25p80_notify_add,
> > +};
> > +#endif
> > +
> >  static struct mtd_partition da850_evm_norflash_partition[] = {
> >  	{
> >  		.name           = "bootloaders + env",
> > @@ -1117,6 +1136,15 @@ static __init int da850_evm_init_cpufreq(void)
> >  static __init int da850_evm_init_cpufreq(void) { return 0; }
> >  #endif
> >  
> > +#ifdef CONFIG_MTD
> > +static void da850_evm_setup_mac_addr(void)
> > +{
> > +	register_mtd_user(&da850evm_spi_notifier);
> > +}
> > +#else
> > +static void da850_evm_setup_mac_addr(void) { }
> > +#endif
> 
> Why not combine this ifdef construct with
> earlier one?
> 

Ok. Updated patch will follow.

Regards,
Sudhakar



More information about the linux-arm-kernel mailing list