public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Richard Retanubun <RichardRetanubun@RuggedCom.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] ICACHE in core initialization to improve u-boot boot time: Breaks booting with i2c code while executing in flash.
Date: Tue, 19 Oct 2010 12:03:31 -0400	[thread overview]
Message-ID: <4CBDC153.30008@RuggedCom.com> (raw)
In-Reply-To: <20100420193754.2a13f9c4.kim.phillips@freescale.com>

Hi Kim,

I recently rebased our platform from uboot 2009.11 to 2010.09 and tried out the ICACHE improvements you made
in commit 1a2e203b31d33fb720f2cf1033b241ad36ab405a

It does not work on our platform (similar to MPC8360EMDS). I think this is specific to our platform because
we need to initialize i2c and use i2c while still executing from flash in checkboard()) to read and parse a board-id i2c-eeprom
to support a unified uboot binary for multiple board flavors.

I pasted checkboard code below; none of the underlying code uses malloc, just static buffer allocations.

Just an FYI mostly, I am okay with not having ICACHE for our board while in uboot.
Just curious if you know of a reason from the limited explanation I've provided.

Also, as a general rule, does uboot accept hosting custom non-eval-platform boards?
I'm tempted to mainline our code (mostly contained under /board/$company_name/...)

Thanks for your time

- Richard


/* ------------------- gd->board_type is identified here -------------------- */
int checkboard(void)
{
	int rc = -EINVAL;
	int i  = -1;
	int nbytes = 0;
	char pnbuf[512] = {0};


	rc = -EINVAL; /* Initialize return code */

	/*
	 * Based on code from cm5200, called while u-boot is executing in flash,
	 * thus things like malloc are not allowed.
	*/

	/*
	 * We need I2C to access HW ID data from EEPROM, so we call i2c_init()
	 * here despite the fact that it will be called again later on. We
	 * also use a little trick to silence I2C-related output.
	 */
	gd->flags |= GD_FLG_SILENT;
	i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
	gd->flags &= ~GD_FLG_SILENT;

	/* Reset i2c controller(s) to clear any stuck-bus conditions */
	i2c_bus_reset(CONFIG_SYS_IMMR + CONFIG_SYS_I2C_OFFSET);
#if defined(CONFIG_SYS_I2C2_OFFSET)
	i2c_bus_reset(CONFIG_SYS_IMMR + CONFIG_SYS_I2C2_OFFSET);
#endif /* CONFIG_SYS_I2C2_OFFSET */
	/* Print a message to stay off the i2c bus for devices to settle */
	puts("I2C:   Reset\n");

	rc = rc_id_board_from_esig(); /* fills in gd->board_type */
	if (rc == 0) {
		printf("BOARD: %s [%08lX]\n",
			rc_get_string_from_board_type(gd->board_type),
			gd->board_type);
	} else {

		/* BAD PARTNUMBER OR BAD I2C ACCESS, REBOOT */
		printf("BOARD: FAILED IDENTIFICATION, error %d\n", rc);
	}

	/* Always return 0, otherwise u-boot will halt and ask for reset */
	return 0;
}

  reply	other threads:[~2010-10-19 16:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 22:36 [U-Boot] [PATCH 3/3] mpc83xx: turn on icache in core initialization to improve u-boot boot time Kim Phillips
2010-04-16 17:06 ` Michael Zaidman
2010-04-19 20:23   ` Kim Phillips
2010-04-19 20:19     ` Scott Wood
2010-04-19 22:34       ` Kim Phillips
2010-04-19 22:35         ` Scott Wood
2010-04-19 20:30 ` Timur Tabi
2010-04-19 20:41   ` Scott Wood
2010-04-19 21:05     ` Timur Tabi
2010-04-19 21:37       ` Kim Phillips
2010-04-20  1:39         ` Timur Tabi
2010-04-21  0:37           ` [U-Boot] [PATCH 3/3 v2] " Kim Phillips
2010-10-19 16:03             ` Richard Retanubun [this message]
2010-10-20 19:50               ` [U-Boot] ICACHE in core initialization to improve u-boot boot time: Breaks booting with i2c code while executing in flash Wolfgang Denk
2010-10-27 17:42                 ` Richard Retanubun

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=4CBDC153.30008@RuggedCom.com \
    --to=richardretanubun@ruggedcom.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