public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Andreas Müller" <schnitzeltony@gmx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] overo: add SPL support
Date: Tue, 20 Dec 2011 02:03:01 +0100	[thread overview]
Message-ID: <201112200203.01529.schnitzeltony@gmx.de> (raw)
In-Reply-To: <201112152212.59968.schnitzeltony@gmx.de>

On Thursday, December 15, 2011 10:12:59 PM Andreas M?ller wrote:
> On Thu, Dec 15, 2011 at 7:34 AM, Andreas M?ller <schnitzeltony@gmx.de> wrote:
> > I tried the following (as you can see I already commented out the
> > i2c-read-
> 
> write
> 
> > for test):
> > 
> > int get_board_revision(void)
> > {
> > #ifdef CONFIG_DRIVER_OMAP34XX_I2C
> > 
> >        i2c_set_bus_num(TWL4030_I2C_BUS);
> >        /*data = 0x01;
> >        i2c_write(0x4B, 0x29, 1, &data, 1);
> >        data = 0x0c;
> >        i2c_write(0x4B, 0x2b, 1, &data, 1);
> >        i2c_read(0x4B, 0x2a, 1, &data, 1);*/
> > 
> > #endif
> > ....
> > }
> > 
> > SPL Boot process hangs on i2c_set_bus_num ( tested by removing
> > 
> > i2c_set_bus_num -> proper operation ) with console freeze:
> > | U-Boot SPL 2011.12-rc1-00004-g06e42c6-dirty (Dec 15 2011 - 14:03:34)
> > | Texas Instruments Revision detection unimplemented
> > 
> > The call stack for get_board_revision() is for SPL
> > 
> > s_init()
> > mem_init()
> > do_sdrc_init(..)
> > get_board_mem_timings(..)
> > get_board_revision(..)
> > 
> > It seems that the call to i2c_set_bus_num comes too early.
> 
> Sorry for spamming but I face black magic:
> 
> I added debug messages in omap24xx_i2c.c / i2c_set_bus_num().
> 
> * Version 1:
> 
> int i2c_set_bus_num(unsigned int bus)
> {
> 	puts("i2c_set_bus_num called 1\n");
> 	if ((bus < 0) || (bus >= I2C_BUS_MAX)) {
> 		printf("Bad bus: %d\n", bus);
> 		return -1;
> 	}
> 	printf("Bus: %d\n", bus);
> 
> #if I2C_BUS_MAX == 3
> 	if (bus == 2) {
> 		puts("i2c_set_bus_num called 2\n");
> 		i2c_base = (struct i2c *)I2C_BASE3;
> 		puts("i2c_set_bus_num called 3\n");
> 	}
> 	else
> #endif
> 	if (bus == 1) {
> 		puts("i2c_set_bus_num called 4\n");
> 		i2c_base = (struct i2c *)I2C_BASE2;
> 		puts("i2c_set_bus_num called 5\n");
> 	}
> 	else {
> 		puts("i2c_set_bus_num called 6\n");
> 		i2c_base = (struct i2c *)I2C_BASE1;
> 		puts("i2c_set_bus_num called 7\n");
> 	}
> 
> 	puts("i2c_set_bus_num called 8\n");
> -->	current_bus = bus;
> 
> 	puts("i2c_set_bus_num called 9\n");
> 	if (!bus_initialized[current_bus])
> 		i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> 
> 	return 0;
> }
> 
> leads to
> 
> i2c_set_bus_num called 1
> Bus: 0
> i2c_set_bus_num called 6
> i2c_set_bus_num called 7
> i2c_set_bus_num called 8
> 
> 
> * Version 2:
> 
> int i2c_set_bus_num(unsigned int bus)
> {
> 	puts("i2c_set_bus_num called 1\n");
> 	if ((bus < 0) || (bus >= I2C_BUS_MAX)) {
> 		printf("Bad bus: %d\n", bus);
> 		return -1;
> 	}
> 	printf("Bus: %d\n", bus);
> -->	printf("CurrentBus: %d\n", current_bus);
> 	printf("AdrCurrentBus: %X\n", &current_bus);
> 
> #if I2C_BUS_MAX == 3
> 	if (bus == 2) {
> 		puts("i2c_set_bus_num called 2\n");
> 		i2c_base = (struct i2c *)I2C_BASE3;
> 		puts("i2c_set_bus_num called 3\n");
> 	}
> 	else
> #endif
> 	if (bus == 1) {
> 		puts("i2c_set_bus_num called 4\n");
> 		i2c_base = (struct i2c *)I2C_BASE2;
> 		puts("i2c_set_bus_num called 5\n");
> 	}
> 	else {
> 		puts("i2c_set_bus_num called 6\n");
> 		i2c_base = (struct i2c *)I2C_BASE1;
> 		puts("i2c_set_bus_num called 7\n");
> 	}
> 
> 	puts("i2c_set_bus_num called 8\n");
> 	current_bus = bus;
> 
> 	puts("i2c_set_bus_num called 9\n");
> 	if (!bus_initialized[current_bus])
> 		i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
> 
> 	return 0;
> }
> 
> leads to
> 
> i2c_set_bus_num called 1
> Bus: 0
> 
> 
> It seems that accessing 'current_bus' causes trouble. Has anybody an
> explanation for that? I don't think this is related to i2c or overo. For a
> better picture I attached memory mappings.
> 
'objdump -dSt' shows (the memory mappings I attached were not really helpful - 
sorry next time I know):

    4020ae14 l     O .data      00000004 i2c_base
    80000068 l     O .bss       00000004 current_bus
    8000006c l     O .bss       0000000c bus_initialized

'i2c_base' is correctly located in SRAM but 'current_bus' and 'bus_initialized' 
are located in CS0 SDRAM which is at the time of call not yet initalized. This 
fits to the crash behaviour: Accessing 'i2c_base' does not cause trouble.
How can I move 'current_bus' and 'bus_initialized' to SRAM?

Andreas

  reply	other threads:[~2011-12-20  1:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-15 14:34 [U-Boot] [PATCH] overo: add SPL support Andreas Müller
2011-12-15 18:32 ` Tom Rini
2011-12-15 21:12   ` Andreas Müller
2011-12-20  1:03     ` Andreas Müller [this message]
2011-12-20  1:08       ` Tom Rini
2011-12-20  1:15         ` Andreas Müller
2011-12-20  5:43         ` Wolfgang Denk
2011-12-20  5:45           ` Tom Rini
2011-12-20 11:41             ` Wolfgang Denk
2011-12-20 11:53               ` Andreas Müller
2011-12-20 12:06                 ` Wolfgang Denk
2011-12-20 12:39                   ` Andreas Müller
2011-12-20 16:36                     ` Aneesh V
2011-12-20 21:17                     ` Wolfgang Denk
2011-12-20 12:20                 ` Igor Grinberg
2011-12-20 13:55                   ` Steve Sakoman
2011-12-21  1:00                     ` Andreas Müller
  -- strict thread matches above, loose matches on Subject: below --
2011-12-14 16:27 Andreas Müller
2011-12-14 17:24 ` Steve Sakoman
2011-12-14 23:00   ` Andreas Müller

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=201112200203.01529.schnitzeltony@gmx.de \
    --to=schnitzeltony@gmx.de \
    --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