All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Rini <trini@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot, v2, 5/6] da850: add support to read mac address from spi flash
Date: Mon, 5 Dec 2011 15:38:45 -0700	[thread overview]
Message-ID: <4EDD47F5.1040106@ti.com> (raw)
In-Reply-To: <1318066118-20152-6-git-send-email-manjunath.hadli@ti.com>

On 01/-10/-28163 12:59 PM, Hadli wrote:

> From: Manjunath Hadli <manjunath.hadli@ti.com>
> 
> add support to read mac address from spi flash if env variable
> is not set. This is supported only on L138 boards based on da850
> SOC. Introduced a macro CONFIG_MAC_ADDR_IN_SPIFLASH indicating
> where to look mac address for.
> 
> Signed-off-by: Manjunathappa, Prakash <prakash.pm@ti.com>
> Signed-off-by: Manjunath Hadli <manjunath.hadli@ti.com>

Sorry for the very late reply. gmail ate this email on me it seems.

[snip]
> +static int get_mac_addr(u8 *addr)
> +{
> +	struct spi_flash *flash;
> +	int ret;
> +
> +
> +	flash = spi_flash_probe(CFG_MAC_ADDR_SPI_BUS, CFG_MAC_ADDR_SPI_CS,
> +			CFG_MAC_ADDR_SPI_MAX_HZ, CFG_MAC_ADDR_SPI_MODE);
> +	if (!flash) {
> +		printf(" Error - unable to probe SPI flash.\n");

Leading space in the printf.

> +		ret = -1;
> +		goto err_probe;
> +	}
> +
> +	ret = spi_flash_read(flash, CFG_MAC_ADDR_OFFSET, 6, addr);
> +	if (ret) {
> +		printf("Error - unable to read MAC address from SPI flash.\n");
> +		goto err_read;
> +	}
> +
> +err_read:
> +	/* cannot call free currently since the free function calls free() for
> +	 * spi_flash structure though it is not directly allocated through
> +	 * malloc()
> +	 */
> +err_probe:
> +	return ret;
> +}

We never called malloc() so it doesn't make sense to comment about not
being able to call free() here.  In fact, we should just do a 'return
-1'  after the printf here.

> +#endif
> +
>  void dsp_lpsc_on(unsigned domain, unsigned int id)
>  {
>  	dv_reg_p mdstat, mdctl, ptstat, ptcmd;
> @@ -220,7 +261,25 @@ static void dspwake(void)
>  
>  int misc_init_r(void)
>  {
> +	uchar buff[8];
> +	int ret;

Potential unused variable warnings here.

-- 
Tom

  reply	other threads:[~2011-12-05 22:38 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-08  9:28 [U-Boot] [PATCH v2 0/6] da850: add board specific functions manjunath.hadli at ti.com
2011-10-08  9:28 ` [U-Boot] [PATCH v2 1/6] da850: add new config file for AM18xx manjunath.hadli at ti.com
2011-10-08  9:28 ` [U-Boot] [PATCH v2 2/6] da850: rename config file to represent OMAP-L138 manjunath.hadli at ti.com
2011-10-08  9:28 ` [U-Boot] [PATCH v2 3/6] da850: pass board revision info to kernel manjunath.hadli at ti.com
2011-10-08  9:28 ` [U-Boot] [PATCH v2 4/6] da850: revert cache disable patch manjunath.hadli at ti.com
2011-10-08 12:56   ` Laurence Withers
2011-10-11  6:46     ` Hadli, Manjunath
2011-10-08  9:28 ` [U-Boot] [PATCH v2 5/6] da850: add support to read mac address from spi flash manjunath.hadli at ti.com
2011-12-05 22:38   ` Tom Rini [this message]
2011-10-08  9:28 ` [U-Boot] [PATCH v2 6/6] da850: read MAC address from I2C EEPROM on AM18xx EVM manjunath.hadli at ti.com
2011-10-08 12:58 ` [U-Boot] [PATCH v2 0/6] da850: add board specific functions Laurence Withers
2011-10-11  6:51   ` Hadli, Manjunath

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=4EDD47F5.1040106@ti.com \
    --to=trini@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.