mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Porting barebox to Novena: misc questions
@ 2014-03-13  2:04 Sean Cross
  2014-03-13  7:38 ` Sascha Hauer
  2014-03-13 20:43 ` Eric Bénard
  0 siblings, 2 replies; 22+ messages in thread
From: Sean Cross @ 2014-03-13  2:04 UTC (permalink / raw)
  To: barebox

Hi,

I've finally managed to get U-Boot's SPL to configure DDR3 and load
barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
build with most features turned on, and I'm running into a number of
problems.  barebox is able to load a zImage off of the FAT partition,
set up ATAGs, and jump to it.  So I have the basics done.  But there are
lots of little things that aren't working.

When I boot without an Ethernet cable plugged in, the "timeout" command
takes a very long time to complete.  It generally freezes at "Hit any
key to stop autoboot:  3" and tends to ignore input for around ten
seconds.  How can I prevent this from happening, short of compiling out
FEC support?

The "usb" command just hangs the system.  It should at least detect the
other ASIX Ethernet port.  I have &usbh1 configured identically to
sabrelite.  Is there something else I need to configure?

The "usbserial" command returns "usbserial: No such device".  Like usb,
I have &usbotg configured the same as sabrelite.  It doesn't work with
dr_mode set to either "host" or "otg".

How can I pass the correct ram size to Linux?  The comment on
barebox_arm_entry() notes that "[memsize] doesn't necessarily have to be
the full SDRAM", and indeed I notice that barebox hangs if I pass it the
full 3840 MB passed from U-Boot.  So I'm currently limiting it to 1GB in
my start_imx6dl_kosagi_novena_6dl routine.  Do I need to somehow add the
remainder as another bank somewhere?  Or modify the bank size in my
kosagi_novena_init() in board.c?

Finally, I was unable to get barebox to boot with MMU support.  For some
reason it kept trying to allocate memory just outside of allocated RAM.
 Is there any benefit to running with the MMU enabled on i.MX6?


Sean

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-13  2:04 Porting barebox to Novena: misc questions Sean Cross
@ 2014-03-13  7:38 ` Sascha Hauer
  2014-03-13 10:18   ` Sean Cross
  2014-03-13 19:42   ` Jean-Christophe PLAGNIOL-VILLARD
  2014-03-13 20:43 ` Eric Bénard
  1 sibling, 2 replies; 22+ messages in thread
From: Sascha Hauer @ 2014-03-13  7:38 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

Hi Sean,

On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> Hi,
> 
> I've finally managed to get U-Boot's SPL to configure DDR3 and load
> barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> build with most features turned on, and I'm running into a number of
> problems.  barebox is able to load a zImage off of the FAT partition,
> set up ATAGs, and jump to it.  So I have the basics done.  But there are
> lots of little things that aren't working.
> 
> When I boot without an Ethernet cable plugged in, the "timeout" command
> takes a very long time to complete.  It generally freezes at "Hit any
> key to stop autoboot:  3" and tends to ignore input for around ten
> seconds.  How can I prevent this from happening, short of compiling out
> FEC support?

Are you trying to start from network without a cable plugged in? When I
start from network without a cable I get:

running /env/bin/init...

Hit m for menu or any other key to stop autoboot:  1
blspec: blspec_scan_directory: net loader/entries
booting net
dhcp failed: Network is down
dhcp: Network is down

It indeed takes some seconds until we are sure that the link is down.
That timeout could be reduced, but we must give the phy some time to
bring up the link.

Or does this happen when you are not trying to boot from network at all?
That shouldn't happen. If it does, maybe some automount command triggers
network accesses.

> 
> The "usb" command just hangs the system.  It should at least detect the
> other ASIX Ethernet port.  I have &usbh1 configured identically to
> sabrelite.  Is there something else I need to configure?

This usually means the phys are not configured correctly. Are you
probing from devicetree?

> 
> The "usbserial" command returns "usbserial: No such device".  Like usb,
> I have &usbotg configured the same as sabrelite.  It doesn't work with
> dr_mode set to either "host" or "otg".

Ok, from devicetree it seems. I can say that there shouldn't be any bugs
in the common usb code preventing your devices from being probed. It
normally boils down to some usbmisc register setting being wrong.

> 
> How can I pass the correct ram size to Linux?  The comment on
> barebox_arm_entry() notes that "[memsize] doesn't necessarily have to be
> the full SDRAM", and indeed I notice that barebox hangs if I pass it the
> full 3840 MB passed from U-Boot.  So I'm currently limiting it to 1GB in
> my start_imx6dl_kosagi_novena_6dl routine.  Do I need to somehow add the
> remainder as another bank somewhere?  Or modify the bank size in my
> kosagi_novena_init() in board.c?

If you probe from devicetree the correct amount of memory is taken from
there. If that doesn't work (dynamic amount of memory for example) you
can set the memory in the devicetree to 0 and call arm_add_mem_device
instead.

> 
> Finally, I was unable to get barebox to boot with MMU support.  For some
> reason it kept trying to allocate memory just outside of allocated RAM.

This is related to the wrong memory setup. That should be solved when
you get that straight.

>  Is there any benefit to running with the MMU enabled on i.MX6?

Definitely, yes. barebox runs much faster with MMU enabled.

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-13  7:38 ` Sascha Hauer
@ 2014-03-13 10:18   ` Sean Cross
  2014-03-13 20:27     ` Sascha Hauer
  2014-03-13 19:42   ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-13 10:18 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 13/3/14 3:38 PM, Sascha Hauer wrote:
> Hi Sean,
> 
> On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
>> Hi,
>>
>> I've finally managed to get U-Boot's SPL to configure DDR3 and load
>> barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
>> build with most features turned on, and I'm running into a number of
>> problems.  barebox is able to load a zImage off of the FAT partition,
>> set up ATAGs, and jump to it.  So I have the basics done.  But there are
>> lots of little things that aren't working.
>>
>> When I boot without an Ethernet cable plugged in, the "timeout" command
>> takes a very long time to complete.  It generally freezes at "Hit any
>> key to stop autoboot:  3" and tends to ignore input for around ten
>> seconds.  How can I prevent this from happening, short of compiling out
>> FEC support?
> 
> Are you trying to start from network without a cable plugged in? When I
> start from network without a cable I get:
> 
> running /env/bin/init...
> 
> Hit m for menu or any other key to stop autoboot:  1
> blspec: blspec_scan_directory: net loader/entries
> booting net
> dhcp failed: Network is down
> dhcp: Network is down
> 
> It indeed takes some seconds until we are sure that the link is down.
> That timeout could be reduced, but we must give the phy some time to
> bring up the link.
> 
> Or does this happen when you are not trying to boot from network at all?
> That shouldn't happen. If it does, maybe some automount command triggers
> network accesses.

This was caused by the default environment I imported.  It set
"ip=dhcp", which I guess caused it to try and obtain an address.  I've
set it to "ip=none" for now, and the problem has gone away.

>> The "usb" command just hangs the system.  It should at least detect the
>> other ASIX Ethernet port.  I have &usbh1 configured identically to
>> sabrelite.  Is there something else I need to configure?
> 
> This usually means the phys are not configured correctly. Are you
> probing from devicetree?

I am probing from devicetree.  I don't see phys mentioned anywhere
except in the imx6qdl.dtsi file, which means that in theory there
shouldn't be anything for me to modify.

>>
>> The "usbserial" command returns "usbserial: No such device".  Like usb,
>> I have &usbotg configured the same as sabrelite.  It doesn't work with
>> dr_mode set to either "host" or "otg".
> 
> Ok, from devicetree it seems. I can say that there shouldn't be any bugs
> in the common usb code preventing your devices from being probed. It
> normally boils down to some usbmisc register setting being wrong.

I don't see any usbmisc register mentioned in any of the board bringup
files.  The first time I run usbserial it says "No such device", and
subsequent runs cause it to print out "Invalid argument".

>> How can I pass the correct ram size to Linux?  The comment on
>> barebox_arm_entry() notes that "[memsize] doesn't necessarily have to be
>> the full SDRAM", and indeed I notice that barebox hangs if I pass it the
>> full 3840 MB passed from U-Boot.  So I'm currently limiting it to 1GB in
>> my start_imx6dl_kosagi_novena_6dl routine.  Do I need to somehow add the
>> remainder as another bank somewhere?  Or modify the bank size in my
>> kosagi_novena_init() in board.c?
> 
> If you probe from devicetree the correct amount of memory is taken from
> there. If that doesn't work (dynamic amount of memory for example) you
> can set the memory in the devicetree to 0 and call arm_add_mem_device
> instead.

Thank you.  Now I've got the full memory amount showing up.

>> Finally, I was unable to get barebox to boot with MMU support.  For some
>> reason it kept trying to allocate memory just outside of allocated RAM.
> 
> This is related to the wrong memory setup. That should be solved when
> you get that straight.
> 
>>  Is there any benefit to running with the MMU enabled on i.MX6?
> 
> Definitely, yes. barebox runs much faster with MMU enabled.

If I enable the MMU but disable early MMU, it hangs with this error:

Board: Kosagi i.MX6DL Novena Board
detected i.MX6 DualLite revision 1.1
ERROR: out of memory

[<5062e9ed>] (unwind_backtrace+0x1/0x74) from [<5061c525>] (panic+0x1d/0x34)
[<5061c525>] (panic+0x1d/0x34) from [<5061cc27>] (xmemalign+0xf/0x14)
[<5061cc27>] (xmemalign+0xf/0x14) from [<5062f687>] (mmu_init+0x16b/0x1f8)
[<5062f687>] (mmu_init+0x16b/0x1f8) from [<50600797>]
(start_barebox+0x1b/0xd0)
[<50600797>] (start_barebox+0x1b/0xd0) from [<5062efcd>] (__start+0x91/0xa4)
[<5062efcd>] (__start+0x91/0xa4) from [<50600005>]
(__bare_init_start+0x1/0xc)
### ERROR ### Please RESET the board ###

If I also enable early MMU, it hangs much much earlier.  When I dug into
it, it looked like it was trying to place a TTB just outside of the
allocated memory region, for some reason.

This is with me passing SZ_1G to barebox_arm_entry().  If I pass
something small like SZ_64M, it hangs completely.  If I instead pass it
SZ_128M, it works just fine, but of course the MMU still doesn't work.


Sean

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-13  7:38 ` Sascha Hauer
  2014-03-13 10:18   ` Sean Cross
@ 2014-03-13 19:42   ` Jean-Christophe PLAGNIOL-VILLARD
  2014-03-13 20:30     ` Sascha Hauer
  1 sibling, 1 reply; 22+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-03-13 19:42 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 08:38 Thu 13 Mar     , Sascha Hauer wrote:
> Hi Sean,
> 
> On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> > Hi,
> > 
> > I've finally managed to get U-Boot's SPL to configure DDR3 and load
> > barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> > build with most features turned on, and I'm running into a number of
> > problems.  barebox is able to load a zImage off of the FAT partition,
> > set up ATAGs, and jump to it.  So I have the basics done.  But there are
> > lots of little things that aren't working.
> > 
> > When I boot without an Ethernet cable plugged in, the "timeout" command
> > takes a very long time to complete.  It generally freezes at "Hit any
> > key to stop autoboot:  3" and tends to ignore input for around ten
> > seconds.  How can I prevent this from happening, short of compiling out
> > FEC support?
> 
> Are you trying to start from network without a cable plugged in? When I
> start from network without a cable I get:
> 
> running /env/bin/init...
> 
> Hit m for menu or any other key to stop autoboot:  1
> blspec: blspec_scan_directory: net loader/entries
> booting net
> dhcp failed: Network is down
> dhcp: Network is down
> 

I get the same issue on Calao USB keys

this is quite anoying

can we fix it

Best Regards,
J.
> It indeed takes some seconds until we are sure that the link is down.
> That timeout could be reduced, but we must give the phy some time to
> bring up the link.
> 
> Or does this happen when you are not trying to boot from network at all?
> That shouldn't happen. If it does, maybe some automount command triggers
> network accesses.
> 
> > 
> > The "usb" command just hangs the system.  It should at least detect the
> > other ASIX Ethernet port.  I have &usbh1 configured identically to
> > sabrelite.  Is there something else I need to configure?
> 
> This usually means the phys are not configured correctly. Are you
> probing from devicetree?
> 
> > 
> > The "usbserial" command returns "usbserial: No such device".  Like usb,
> > I have &usbotg configured the same as sabrelite.  It doesn't work with
> > dr_mode set to either "host" or "otg".
> 
> Ok, from devicetree it seems. I can say that there shouldn't be any bugs
> in the common usb code preventing your devices from being probed. It
> normally boils down to some usbmisc register setting being wrong.
> 
> > 
> > How can I pass the correct ram size to Linux?  The comment on
> > barebox_arm_entry() notes that "[memsize] doesn't necessarily have to be
> > the full SDRAM", and indeed I notice that barebox hangs if I pass it the
> > full 3840 MB passed from U-Boot.  So I'm currently limiting it to 1GB in
> > my start_imx6dl_kosagi_novena_6dl routine.  Do I need to somehow add the
> > remainder as another bank somewhere?  Or modify the bank size in my
> > kosagi_novena_init() in board.c?
> 
> If you probe from devicetree the correct amount of memory is taken from
> there. If that doesn't work (dynamic amount of memory for example) you
> can set the memory in the devicetree to 0 and call arm_add_mem_device
> instead.
> 
> > 
> > Finally, I was unable to get barebox to boot with MMU support.  For some
> > reason it kept trying to allocate memory just outside of allocated RAM.
> 
> This is related to the wrong memory setup. That should be solved when
> you get that straight.
> 
> >  Is there any benefit to running with the MMU enabled on i.MX6?
> 
> Definitely, yes. barebox runs much faster with MMU enabled.
> 
> Sascha
> 
> -- 
> 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

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-13 10:18   ` Sean Cross
@ 2014-03-13 20:27     ` Sascha Hauer
  2014-03-14  3:35       ` Sean Cross
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-13 20:27 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Thu, Mar 13, 2014 at 06:18:44PM +0800, Sean Cross wrote:
> On 13/3/14 3:38 PM, Sascha Hauer wrote:
> > Hi Sean,
> > 
> > On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> >> Hi,
> >>
> >> I've finally managed to get U-Boot's SPL to configure DDR3 and load
> >> barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> >> build with most features turned on, and I'm running into a number of
> >> problems.  barebox is able to load a zImage off of the FAT partition,
> >> set up ATAGs, and jump to it.  So I have the basics done.  But there are
> >> lots of little things that aren't working.
> >>
> >> When I boot without an Ethernet cable plugged in, the "timeout" command
> >> takes a very long time to complete.  It generally freezes at "Hit any
> >> key to stop autoboot:  3" and tends to ignore input for around ten
> >> seconds.  How can I prevent this from happening, short of compiling out
> >> FEC support?
> > 
> > Are you trying to start from network without a cable plugged in? When I
> > start from network without a cable I get:
> > 
> > running /env/bin/init...
> > 
> > Hit m for menu or any other key to stop autoboot:  1
> > blspec: blspec_scan_directory: net loader/entries
> > booting net
> > dhcp failed: Network is down
> > dhcp: Network is down
> > 
> > It indeed takes some seconds until we are sure that the link is down.
> > That timeout could be reduced, but we must give the phy some time to
> > bring up the link.
> > 
> > Or does this happen when you are not trying to boot from network at all?
> > That shouldn't happen. If it does, maybe some automount command triggers
> > network accesses.
> 
> This was caused by the default environment I imported.  It set
> "ip=dhcp", which I guess caused it to try and obtain an address.  I've
> set it to "ip=none" for now, and the problem has gone away.
> 
> >> The "usb" command just hangs the system.  It should at least detect the
> >> other ASIX Ethernet port.  I have &usbh1 configured identically to
> >> sabrelite.  Is there something else I need to configure?
> > 
> > This usually means the phys are not configured correctly. Are you
> > probing from devicetree?
> 
> I am probing from devicetree.  I don't see phys mentioned anywhere
> except in the imx6qdl.dtsi file, which means that in theory there
> shouldn't be anything for me to modify.

I can try to reproduce this tomorrow on a sabrelite board.

> Board: Kosagi i.MX6DL Novena Board
> detected i.MX6 DualLite revision 1.1
> ERROR: out of memory
> 
> [<5062e9ed>] (unwind_backtrace+0x1/0x74) from [<5061c525>] (panic+0x1d/0x34)
> [<5061c525>] (panic+0x1d/0x34) from [<5061cc27>] (xmemalign+0xf/0x14)
> [<5061cc27>] (xmemalign+0xf/0x14) from [<5062f687>] (mmu_init+0x16b/0x1f8)
> [<5062f687>] (mmu_init+0x16b/0x1f8) from [<50600797>]
> (start_barebox+0x1b/0xd0)
> [<50600797>] (start_barebox+0x1b/0xd0) from [<5062efcd>] (__start+0x91/0xa4)
> [<5062efcd>] (__start+0x91/0xa4) from [<50600005>]
> (__bare_init_start+0x1/0xc)
> ### ERROR ### Please RESET the board ###
> 
> If I also enable early MMU, it hangs much much earlier.  When I dug into
> it, it looked like it was trying to place a TTB just outside of the
> allocated memory region, for some reason.
> 
> This is with me passing SZ_1G to barebox_arm_entry().  If I pass
> something small like SZ_64M, it hangs completely.  If I instead pass it
> SZ_128M, it works just fine, but of course the MMU still doesn't work.

I suspect you have some memory setting that doesn't work in your
.config. Could you post it? Particularly the addresses in your backtrace
are outside the reachable memory (0x10000000 + 1GiB = 0x50000000). This
should not happen. Do you have CONFIG_RELOCATABLE enabled? If not, make
sure CONFIG_ARCH_TEXT_BASE is inside the memory you pass to
barebox_arm_entry(). Otherwise the autodetection for usable malloc area
space might produce wrong results.

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-13 19:42   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2014-03-13 20:30     ` Sascha Hauer
  2014-03-14  3:03       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-13 20:30 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Thu, Mar 13, 2014 at 08:42:52PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 08:38 Thu 13 Mar     , Sascha Hauer wrote:
> > Hi Sean,
> > 
> > On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> > > Hi,
> > > 
> > > I've finally managed to get U-Boot's SPL to configure DDR3 and load
> > > barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> > > build with most features turned on, and I'm running into a number of
> > > problems.  barebox is able to load a zImage off of the FAT partition,
> > > set up ATAGs, and jump to it.  So I have the basics done.  But there are
> > > lots of little things that aren't working.
> > > 
> > > When I boot without an Ethernet cable plugged in, the "timeout" command
> > > takes a very long time to complete.  It generally freezes at "Hit any
> > > key to stop autoboot:  3" and tends to ignore input for around ten
> > > seconds.  How can I prevent this from happening, short of compiling out
> > > FEC support?
> > 
> > Are you trying to start from network without a cable plugged in? When I
> > start from network without a cable I get:
> > 
> > running /env/bin/init...
> > 
> > Hit m for menu or any other key to stop autoboot:  1
> > blspec: blspec_scan_directory: net loader/entries
> > booting net
> > dhcp failed: Network is down
> > dhcp: Network is down
> > 
> 
> I get the same issue on Calao USB keys
> 
> this is quite anoying
> 
> can we fix it

Well if we try booting from network then we have to wait until it's
clear that there's no link.

It may be that I don't understand the actual problem or issue.

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-13  2:04 Porting barebox to Novena: misc questions Sean Cross
  2014-03-13  7:38 ` Sascha Hauer
@ 2014-03-13 20:43 ` Eric Bénard
  2014-03-13 21:26   ` Sascha Hauer
  1 sibling, 1 reply; 22+ messages in thread
From: Eric Bénard @ 2014-03-13 20:43 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

Hi,

Le Thu, 13 Mar 2014 10:04:35 +0800,
Sean Cross <xobs@kosagi.com> a écrit :
> I've finally managed to get U-Boot's SPL to configure DDR3 and load
> barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> build with most features turned on, and I'm running into a number of
> problems.  barebox is able to load a zImage off of the FAT partition,
> set up ATAGs, and jump to it.  So I have the basics done.  But there are
> lots of little things that aren't working.
> 
> When I boot without an Ethernet cable plugged in, the "timeout" command
> takes a very long time to complete.  It generally freezes at "Hit any
> key to stop autoboot:  3" and tends to ignore input for around ten
> seconds.  How can I prevent this from happening, short of compiling out
> FEC support?
> 
that's very similar to what I reported here :
http://lists.infradead.org/pipermail/barebox/2014-February/018005.html

I didn't yet had time to investigate more based on Sascha's answer but
that's on my todo list.

Eric

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-13 20:43 ` Eric Bénard
@ 2014-03-13 21:26   ` Sascha Hauer
  2014-03-14  3:13     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-13 21:26 UTC (permalink / raw)
  To: Eric Bénard; +Cc: barebox

On Thu, Mar 13, 2014 at 09:43:07PM +0100, Eric Bénard wrote:
> Hi,
> 
> Le Thu, 13 Mar 2014 10:04:35 +0800,
> Sean Cross <xobs@kosagi.com> a écrit :
> > I've finally managed to get U-Boot's SPL to configure DDR3 and load
> > barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> > build with most features turned on, and I'm running into a number of
> > problems.  barebox is able to load a zImage off of the FAT partition,
> > set up ATAGs, and jump to it.  So I have the basics done.  But there are
> > lots of little things that aren't working.
> > 
> > When I boot without an Ethernet cable plugged in, the "timeout" command
> > takes a very long time to complete.  It generally freezes at "Hit any
> > key to stop autoboot:  3" and tends to ignore input for around ten
> > seconds.  How can I prevent this from happening, short of compiling out
> > FEC support?
> > 
> that's very similar to what I reported here :
> http://lists.infradead.org/pipermail/barebox/2014-February/018005.html
> 
> I didn't yet had time to investigate more based on Sascha's answer but
> that's on my todo list.

Ok, got it. The following fixes this. Looking at the netconsole it seems
some love is needed. Right now it only seems to work when port and ip
are set in the right order.

Sascha

--------------8<----------------------------------

From e4616cba4ec41ebc0d9e0419fd094984209ddbd1 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Thu, 13 Mar 2014 22:09:47 +0100
Subject: [PATCH] netconsole: bail out when no connection is opened

When no connection is opened we should not call into
the networking stack. Otherwise it can happen that we
delay further execution until the network stack detected
a link (or timed out bringing the link up).

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/netconsole.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/net/netconsole.c b/net/netconsole.c
index 2ab19de..86a68e1 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -81,6 +81,9 @@ static int nc_getc(struct console_device *cdev)
 					struct nc_priv, cdev);
 	unsigned char c;
 
+	if (!priv->con)
+		return 0;
+
 	while (!kfifo_len(priv->fifo))
 		net_poll();
 
@@ -94,6 +97,9 @@ static int nc_tstc(struct console_device *cdev)
 	struct nc_priv *priv = container_of(cdev,
 					struct nc_priv, cdev);
 
+	if (!priv->con)
+		return 0;
+
 	if (priv->busy)
 		return kfifo_len(priv->fifo) ? 1 : 0;
 
-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-13 20:30     ` Sascha Hauer
@ 2014-03-14  3:03       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 22+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-03-14  3:03 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 21:30 Thu 13 Mar     , Sascha Hauer wrote:
> On Thu, Mar 13, 2014 at 08:42:52PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 08:38 Thu 13 Mar     , Sascha Hauer wrote:
> > > Hi Sean,
> > > 
> > > On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> > > > Hi,
> > > > 
> > > > I've finally managed to get U-Boot's SPL to configure DDR3 and load
> > > > barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> > > > build with most features turned on, and I'm running into a number of
> > > > problems.  barebox is able to load a zImage off of the FAT partition,
> > > > set up ATAGs, and jump to it.  So I have the basics done.  But there are
> > > > lots of little things that aren't working.
> > > > 
> > > > When I boot without an Ethernet cable plugged in, the "timeout" command
> > > > takes a very long time to complete.  It generally freezes at "Hit any
> > > > key to stop autoboot:  3" and tends to ignore input for around ten
> > > > seconds.  How can I prevent this from happening, short of compiling out
> > > > FEC support?
> > > 
> > > Are you trying to start from network without a cable plugged in? When I
> > > start from network without a cable I get:
> > > 
> > > running /env/bin/init...
> > > 
> > > Hit m for menu or any other key to stop autoboot:  1
> > > blspec: blspec_scan_directory: net loader/entries
> > > booting net
> > > dhcp failed: Network is down
> > > dhcp: Network is down
> > > 
> > 
> > I get the same issue on Calao USB keys
> > 
> > this is quite anoying
> > 
> > can we fix it
> 
> Well if we try booting from network then we have to wait until it's
> clear that there's no link.
> 
> It may be that I don't understand the actual problem or issue.

I do agree if you try to boot on the network we have to wait the xs of timeout

The problem is that you have now a timeout even beofre the autoboot timeout
and even before to try to boot

I did not investigate further but the problem is there

Best Regards,
J.
> 
> Sascha
> 
> -- 
> 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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-13 21:26   ` Sascha Hauer
@ 2014-03-14  3:13     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 22+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2014-03-14  3:13 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 22:26 Thu 13 Mar     , Sascha Hauer wrote:
> On Thu, Mar 13, 2014 at 09:43:07PM +0100, Eric Bénard wrote:
> > Hi,
> > 
> > Le Thu, 13 Mar 2014 10:04:35 +0800,
> > Sean Cross <xobs@kosagi.com> a écrit :
> > > I've finally managed to get U-Boot's SPL to configure DDR3 and load
> > > barebox off of a FAT partition on an i.MX6DL.  I also have a barebox
> > > build with most features turned on, and I'm running into a number of
> > > problems.  barebox is able to load a zImage off of the FAT partition,
> > > set up ATAGs, and jump to it.  So I have the basics done.  But there are
> > > lots of little things that aren't working.
> > > 
> > > When I boot without an Ethernet cable plugged in, the "timeout" command
> > > takes a very long time to complete.  It generally freezes at "Hit any
> > > key to stop autoboot:  3" and tends to ignore input for around ten
> > > seconds.  How can I prevent this from happening, short of compiling out
> > > FEC support?
> > > 
> > that's very similar to what I reported here :
> > http://lists.infradead.org/pipermail/barebox/2014-February/018005.html
> > 
> > I didn't yet had time to investigate more based on Sascha's answer but
> > that's on my todo list.
> 
> Ok, got it. The following fixes this. Looking at the netconsole it seems
> some love is needed. Right now it only seems to work when port and ip
> are set in the right order.

I'm going to give a try on it too later this week

Best Regards,
J.
> 
> Sascha
> 
> --------------8<----------------------------------
> 
> From e4616cba4ec41ebc0d9e0419fd094984209ddbd1 Mon Sep 17 00:00:00 2001
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Date: Thu, 13 Mar 2014 22:09:47 +0100
> Subject: [PATCH] netconsole: bail out when no connection is opened
> 
> When no connection is opened we should not call into
> the networking stack. Otherwise it can happen that we
> delay further execution until the network stack detected
> a link (or timed out bringing the link up).
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  net/netconsole.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/netconsole.c b/net/netconsole.c
> index 2ab19de..86a68e1 100644
> --- a/net/netconsole.c
> +++ b/net/netconsole.c
> @@ -81,6 +81,9 @@ static int nc_getc(struct console_device *cdev)
>  					struct nc_priv, cdev);
>  	unsigned char c;
>  
> +	if (!priv->con)
> +		return 0;
> +
>  	while (!kfifo_len(priv->fifo))
>  		net_poll();
>  
> @@ -94,6 +97,9 @@ static int nc_tstc(struct console_device *cdev)
>  	struct nc_priv *priv = container_of(cdev,
>  					struct nc_priv, cdev);
>  
> +	if (!priv->con)
> +		return 0;
> +
>  	if (priv->busy)
>  		return kfifo_len(priv->fifo) ? 1 : 0;
>  
> -- 
> 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

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-13 20:27     ` Sascha Hauer
@ 2014-03-14  3:35       ` Sean Cross
  2014-03-14  8:22         ` Sascha Hauer
  0 siblings, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-14  3:35 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 14/3/14 4:27 AM, Sascha Hauer wrote:
> On Thu, Mar 13, 2014 at 06:18:44PM +0800, Sean Cross wrote:
>> On 13/3/14 3:38 PM, Sascha Hauer wrote:
>>> Hi Sean,
>>>
>>> On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
>>>> The "usb" command just hangs the system.  It should at least detect the
>>>> other ASIX Ethernet port.  I have &usbh1 configured identically to
>>>> sabrelite.  Is there something else I need to configure?
>>>
>>> This usually means the phys are not configured correctly. Are you
>>> probing from devicetree?
>>
>> I am probing from devicetree.  I don't see phys mentioned anywhere
>> except in the imx6qdl.dtsi file, which means that in theory there
>> shouldn't be anything for me to modify.
> 
> I can try to reproduce this tomorrow on a sabrelite board.
> 
>> Board: Kosagi i.MX6DL Novena Board
>> detected i.MX6 DualLite revision 1.1
>> ERROR: out of memory
>>
>> [<5062e9ed>] (unwind_backtrace+0x1/0x74) from [<5061c525>] (panic+0x1d/0x34)
>> [<5061c525>] (panic+0x1d/0x34) from [<5061cc27>] (xmemalign+0xf/0x14)
>> [<5061cc27>] (xmemalign+0xf/0x14) from [<5062f687>] (mmu_init+0x16b/0x1f8)
>> [<5062f687>] (mmu_init+0x16b/0x1f8) from [<50600797>]
>> (start_barebox+0x1b/0xd0)
>> [<50600797>] (start_barebox+0x1b/0xd0) from [<5062efcd>] (__start+0x91/0xa4)
>> [<5062efcd>] (__start+0x91/0xa4) from [<50600005>]
>> (__bare_init_start+0x1/0xc)
>> ### ERROR ### Please RESET the board ###
>>
>> If I also enable early MMU, it hangs much much earlier.  When I dug into
>> it, it looked like it was trying to place a TTB just outside of the
>> allocated memory region, for some reason.
>>
>> This is with me passing SZ_1G to barebox_arm_entry().  If I pass
>> something small like SZ_64M, it hangs completely.  If I instead pass it
>> SZ_128M, it works just fine, but of course the MMU still doesn't work.
> 
> I suspect you have some memory setting that doesn't work in your
> .config. Could you post it? Particularly the addresses in your backtrace
> are outside the reachable memory (0x10000000 + 1GiB = 0x50000000). This
> should not happen. Do you have CONFIG_RELOCATABLE enabled? If not, make
> sure CONFIG_ARCH_TEXT_BASE is inside the memory you pass to
> barebox_arm_entry(). Otherwise the autodetection for usable malloc area
> space might produce wrong results.

You're on the right track.  Earlier on I started calling
barebox_arm_entry(0x10000000 + 0x800000, SZ_1G, fdt), because otherwise
it would fail in mysterious ways.  Now that I've got ram passing working
correctly, I've set it back to 0x10000000, and I'm able to get further.
 I've also increased the MALLOC_SIZE from 8MB to 64MB, which has made
some out-of-memory errors go away.

Now, it gets much further, even with CONFIG_MMU_EARLY enabled.  Now it
crashes with an error that I see SabreSD was getting at one point, but
I'm not sure how they resolved it:

Board: Kosagi i.MX6DL Novena Board
detected i.MX6 DualLite revision 1.1
BUG: failure at arch/arm/cpu/mmu.c:122/find_pte()!
BUG!
[<4fa2e9cd>] (unwind_backtrace+0x1/0x74) from [<4fa1c525>] (panic+0x1d/0x34)
[<4fa1c525>] (panic+0x1d/0x34) from [<4fa2f485>] (remap_range+0x29/0x88)
[<4fa2f485>] (remap_range+0x29/0x88) from [<4fa2f751>]
(dma_alloc_coherent+0x2d/0x34)
[<4fa2f751>] (dma_alloc_coherent+0x2d/0x34) from [<4fa0d689>]
(ehci_register+0x41/0xa8)
[<4fa0d689>] (ehci_register+0x41/0xa8) from [<4fa0936f>]
(imx_chipidea_probe+0x123/0x168)
[<4fa0936f>] (imx_chipidea_probe+0x123/0x168) from [<4fa07de7>]
(platform_probe+0x9/0xa)
[<4fa07de7>] (platform_probe+0x9/0xa) from [<4fa07bf9>]
(device_probe+0x11/0x44)
[<4fa07bf9>] (device_probe+0x11/0x44) from [<4fa07c53>]
(match.part.3+0x27/0x30)
[<4fa07c53>] (match.part.3+0x27/0x30) from [<4fa07cb5>]
(register_driver+0x59/0x74)
[<4fa07cb5>] (register_driver+0x59/0x74) from [<4fa00797>]
(start_barebox+0x1b/0xd0)
[<4fa00797>] (start_barebox+0x1b/0xd0) from [<4fa2efbd>] (__start+0xa1/0xb4)
[<4fa2efbd>] (__start+0xa1/0xb4) from [<4fa00005>]
(__bare_init_start+0x1/0xc)
### ERROR ### Please RESET the board ###

It's nice to see a USB error message in there -- it makes me think the
two problems might be related.  However, USB still doesn't work with the
MMU disabled, even after fixing the RAM addresses.

Here is the contents of my .config file:

#
# Automatically generated file; DO NOT EDIT.
# Barebox/arm 2014.03.0 Configuration
#
CONFIG_ARM=y
CONFIG_ARM_LINUX=y

#
# System Type
#
# CONFIG_BUILTIN_DTB is not set
# CONFIG_ARCH_AT91 is not set
# CONFIG_ARCH_BCM2835 is not set
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_EP93XX is not set
# CONFIG_ARCH_HIGHBANK is not set
CONFIG_ARCH_IMX=y
# CONFIG_ARCH_MVEBU is not set
# CONFIG_ARCH_MXS is not set
# CONFIG_ARCH_NETX is not set
# CONFIG_ARCH_NOMADIK is not set
# CONFIG_ARCH_OMAP is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_SOCFPGA is not set
# CONFIG_ARCH_S3C24xx is not set
# CONFIG_ARCH_S5PCxx is not set
# CONFIG_ARCH_S3C64xx is not set
# CONFIG_ARCH_VERSATILE is not set
# CONFIG_ARCH_VEXPRESS is not set
# CONFIG_ARCH_TEGRA is not set
# CONFIG_ARCH_ZYNQ is not set

#
# Processor Type
#
CONFIG_CPU_32=y
CONFIG_CPU_V7=y
CONFIG_CPU_32v7=y

#
# processor features
#
# CONFIG_BOOT_ENDIANNESS_SWITCH is not set
CONFIG_ARCH_TEXT_BASE=0x00908400
CONFIG_BAREBOX_MAX_IMAGE_SIZE=0xffffffff
CONFIG_ARCH_IMX_IMXIMAGE=y

#
# Freescale i.MX System-on-Chip
#
CONFIG_ARCH_IMX6=y
CONFIG_IMX_MULTI_BOARDS=y
# CONFIG_MACH_TX25 is not set
# CONFIG_MACH_EFIKA_MX_SMARTBOOK is not set
# CONFIG_MACH_FREESCALE_MX51_PDK is not set
# CONFIG_MACH_FREESCALE_MX53_LOCO is not set
# CONFIG_MACH_TQMA53 is not set
# CONFIG_MACH_FREESCALE_MX53_VMX53 is not set
# CONFIG_MACH_PHYTEC_PFLA02 is not set
# CONFIG_MACH_DFI_FS700_M60 is not set
# CONFIG_MACH_GUF_SANTARO is not set
# CONFIG_MACH_REALQ7 is not set
# CONFIG_MACH_GK802 is not set
CONFIG_MACH_KOSAGI_NOVENA=y
# CONFIG_MACH_TQMA6X is not set
# CONFIG_MACH_SABRELITE is not set
# CONFIG_MACH_SABRESD is not set
# CONFIG_MACH_NITROGEN6X is not set
# CONFIG_MACH_SOLIDRUN_HUMMINGBOARD is not set
# CONFIG_MACH_UDOO is not set

#
# Board specific settings
#

#
# i.MX specific settings
#
CONFIG_ARCH_IMX_USBLOADER=y
# CONFIG_IMX_IIM is not set
CONFIG_IMX_OCOTP=y
CONFIG_ARM_ASM_UNIFIED=y
CONFIG_AEABI=y
CONFIG_THUMB2_BAREBOX=y
# CONFIG_ARM_BOARD_APPEND_ATAG is not set

#
# Arm specific settings
#
CONFIG_CMD_ARM_CPUINFO=y
CONFIG_CMD_ARM_MMUINFO=y
# CONFIG_CPU_V7_DCACHE_SKIP is not set
CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y
CONFIG_ARM_EXCEPTIONS=y
CONFIG_ARM_UNWIND=y
CONFIG_DEFCONFIG_LIST="$ARCH_DEFCONFIG"
CONFIG_GREGORIAN_CALENDER=y
CONFIG_HAS_KALLSYMS=y
CONFIG_HAS_MODULES=y
CONFIG_CMD_MEMORY=y
CONFIG_ENV_HANDLING=y
CONFIG_GENERIC_GPIO=y
CONFIG_BOOTM=y
CONFIG_BLOCK=y
CONFIG_BLOCK_WRITE=y
CONFIG_FILETYPE=y
CONFIG_BINFMT=y
CONFIG_UIMAGE=y
CONFIG_GLOBALVAR=y
CONFIG_STDDEV=y
CONFIG_BAREBOX_UPDATE=y

#
# General Settings
#
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
CONFIG_BANNER=y
CONFIG_MEMINFO=y
CONFIG_ENVIRONMENT_VARIABLES=y

#
# memory layout
#
CONFIG_HAVE_PBL_IMAGE=y
CONFIG_HAVE_PBL_MULTI_IMAGES=y
CONFIG_HAVE_IMAGE_COMPRESSION=y
CONFIG_PBL_IMAGE=y
CONFIG_PBL_MULTI_IMAGES=y
CONFIG_PBL_RELOCATABLE=y
CONFIG_IMAGE_COMPRESSION=y
# CONFIG_IMAGE_COMPRESSION_LZ4 is not set
CONFIG_IMAGE_COMPRESSION_LZO=y
# CONFIG_IMAGE_COMPRESSION_GZIP is not set
# CONFIG_IMAGE_COMPRESSION_NONE is not set
CONFIG_MMU=y
CONFIG_MMU_EARLY=y
CONFIG_HAVE_CONFIGURABLE_TEXT_BASE=y
CONFIG_TEXT_BASE=0x17800000
CONFIG_BAREBOX_MAX_PBL_SIZE=0xffffffff
CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0xffffffff
CONFIG_STACK_SIZE=0x400000
CONFIG_MALLOC_SIZE=0x4000000
CONFIG_BROKEN=y
CONFIG_EXPERIMENTAL=y
# CONFIG_MALLOC_DLMALLOC is not set
CONFIG_MALLOC_TLSF=y
# CONFIG_MODULES is not set
CONFIG_KALLSYMS=y
CONFIG_RELOCATABLE=y
# CONFIG_PANIC_HANG is not set
CONFIG_PROMPT="barebox:"
CONFIG_BAUDRATE=115200
CONFIG_LONGHELP=y
CONFIG_CBSIZE=128
CONFIG_SHELL_HUSH=y
# CONFIG_SHELL_SIMPLE is not set
# CONFIG_SHELL_NONE is not set
CONFIG_GLOB=y
CONFIG_GLOB_SORT=y
CONFIG_PROMPT_HUSH_PS2="> "
CONFIG_HUSH_FANCY_PROMPT=y
CONFIG_HUSH_GETOPT=y
CONFIG_CMDLINE_EDITING=y
CONFIG_AUTO_COMPLETE=y
CONFIG_MENU=y
CONFIG_PASSWORD=y
CONFIG_PASSWORD_DEFAULT=""
CONFIG_PASSWD_SUM_MD5=y
# CONFIG_PASSWD_SUM_SHA1 is not set
# CONFIG_PASSWD_SUM_SHA256 is not set
CONFIG_DYNAMIC_CRC_TABLE=y
CONFIG_ERRNO_MESSAGES=y
CONFIG_TIMESTAMP=y
CONFIG_BLSPEC=y
CONFIG_KERNEL_INSTALL_TARGET=y
CONFIG_CONSOLE_FULL=y
# CONFIG_CONSOLE_SIMPLE is not set
# CONFIG_CONSOLE_NONE is not set
# CONFIG_CONSOLE_ACTIVATE_FIRST is not set
CONFIG_CONSOLE_ACTIVATE_ALL=y
# CONFIG_CONSOLE_ACTIVATE_NONE is not set
CONFIG_PARTITION=y
CONFIG_PARTITION_DISK=y
CONFIG_PARTITION_DISK_DOS=y
CONFIG_PARTITION_DISK_EFI=y
CONFIG_PARTITION_DISK_EFI_GPT_NO_FORCE=y
CONFIG_PARTITION_DISK_EFI_GPT_COMPARE=y
CONFIG_DEFAULT_ENVIRONMENT=y
# CONFIG_DEFAULT_COMPRESSION_GZIP is not set
CONFIG_DEFAULT_COMPRESSION_LZO=y
# CONFIG_DEFAULT_COMPRESSION_NONE is not set
CONFIG_HAVE_DEFAULT_ENVIRONMENT_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW_DFU=y
CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/kosagi-novena/env"
CONFIG_BAREBOXENV_TARGET=y
CONFIG_BAREBOXCRC32_TARGET=y
CONFIG_POLLER=y
CONFIG_RESET_SOURCE=y

#
# Debugging
#
CONFIG_COMPILE_LOGLEVEL=6
CONFIG_DEFAULT_LOGLEVEL=7
# CONFIG_DEBUG_INFO is not set
# CONFIG_DEBUG_LL is not set
CONFIG_DEBUG_IMX_UART_PORT=1
# CONFIG_DEBUG_INITCALLS is not set
CONFIG_HAS_DEBUG_LL=y
CONFIG_COMMAND_SUPPORT=y
# CONFIG_HAS_POWEROFF is not set

#
# commands
#

#
# scripting
#
CONFIG_CMD_EDIT=y
CONFIG_CMD_SLEEP=y
CONFIG_CMD_MSLEEP=y
CONFIG_CMD_SAVEENV=y
CONFIG_CMD_LOADENV=y
CONFIG_CMD_EXPORT=y
CONFIG_CMD_PRINTENV=y
CONFIG_CMD_READLINE=y
CONFIG_CMD_READF=y
CONFIG_CMD_LET=y
CONFIG_CMD_TRUE=y
CONFIG_CMD_FALSE=y
CONFIG_CMD_MENU=y
CONFIG_CMD_MENU_MANAGEMENT=y
CONFIG_CMD_LOGIN=y
CONFIG_CMD_PASSWD=y
# CONFIG_PASSWD_MODE_HIDE is not set
CONFIG_PASSWD_MODE_STAR=y
# CONFIG_PASSWD_MODE_CLEAR is not set
CONFIG_CMD_TIME=y
CONFIG_CMD_GLOBAL=y

#
# file commands
#
CONFIG_CMD_LS=y
CONFIG_CMD_RM=y
CONFIG_CMD_CAT=y
CONFIG_CMD_MKDIR=y
CONFIG_CMD_RMDIR=y
CONFIG_CMD_CP=y
CONFIG_CMD_PWD=y
CONFIG_CMD_CD=y
CONFIG_CMD_MOUNT=y
CONFIG_CMD_UMOUNT=y
CONFIG_CMD_AUTOMOUNT=y
CONFIG_CMD_BASENAME=y
CONFIG_CMD_DIRNAME=y
CONFIG_CMD_LN=y
CONFIG_CMD_READLINK=y
CONFIG_CMD_FILETYPE=y

#
# console
#
CONFIG_CMD_CLEAR=y
CONFIG_CMD_ECHO=y
CONFIG_CMD_ECHO_E=y

#
# memory
#
CONFIG_CMD_LOADB=y
CONFIG_CMD_LOADY=y
CONFIG_CMD_LOADS=y
CONFIG_CMD_SAVES=y
CONFIG_CMD_MEMINFO=y
CONFIG_CMD_IOMEM=y
CONFIG_CMD_MD=y
CONFIG_CMD_MW=y
CONFIG_CMD_MM=y
CONFIG_CMD_MEMCMP=y
CONFIG_CMD_MEMCPY=y
CONFIG_CMD_MEMSET=y
CONFIG_CMD_CRC=y
CONFIG_CMD_CRC_CMP=y
CONFIG_CMD_DIGEST=y
CONFIG_CMD_MD5SUM=y
CONFIG_CMD_SHA1SUM=y
CONFIG_CMD_SHA256SUM=y
CONFIG_CMD_SHA224SUM=y

#
# flash
#
CONFIG_CMD_FLASH=y

#
# booting
#
CONFIG_CMD_BOOTM=y
CONFIG_CMD_BOOTM_SHOW_TYPE=y
CONFIG_CMD_BOOTM_VERBOSE=y
CONFIG_CMD_BOOTM_INITRD=y
CONFIG_CMD_BOOTM_OFTREE=y
CONFIG_CMD_BOOTM_OFTREE_UIMAGE=y
CONFIG_CMD_BOOTM_AIMAGE=y
CONFIG_CMD_UIMAGE=y
CONFIG_CMD_BOOTZ=y
CONFIG_CMD_BOOTU=y
CONFIG_FLEXIBLE_BOOTARGS=y
CONFIG_CMD_BOOT=y
CONFIG_CMD_RESET=y
CONFIG_CMD_GO=y
CONFIG_CMD_OFTREE=y
CONFIG_CMD_OF_PROPERTY=y
CONFIG_CMD_OF_NODE=y

#
# testing
#
CONFIG_CMD_MEMTEST=y

#
# video command
#
CONFIG_CMD_SPLASH=y
CONFIG_CMD_BAREBOX_UPDATE=y
CONFIG_CMD_TIMEOUT=y
CONFIG_CMD_PARTITION=y
CONFIG_CMD_TEST=y
CONFIG_CMD_VERSION=y
CONFIG_CMD_HELP=y
CONFIG_CMD_MAGICVAR=y
CONFIG_CMD_MAGICVAR_HELP=y
CONFIG_CMD_DEVINFO=y
CONFIG_CMD_GPIO=y
CONFIG_CMD_UNCOMPRESS=y
CONFIG_CMD_I2C=y
CONFIG_CMD_SPI=y
CONFIG_CMD_LED=y
CONFIG_CMD_LED_TRIGGER=y
CONFIG_CMD_USB=y
CONFIG_CMD_CLK=y
CONFIG_CMD_DETECT=y
CONFIG_CMD_WD=y
CONFIG_CMD_WD_DEFAULT_TIMOUT=0
CONFIG_NET=y
CONFIG_NET_DHCP=y
CONFIG_NET_NFS=y
CONFIG_NET_PING=y
CONFIG_NET_NETCONSOLE=y
CONFIG_NET_RESOLV=y
CONFIG_NET_IFUP=y
CONFIG_NET_CMD_IFUP=y

#
# Drivers
#
CONFIG_OFTREE=y
CONFIG_OFTREE_MEM_GENERIC=y
CONFIG_DTC=y
CONFIG_OFDEVICE=y
CONFIG_OF_NET=y
CONFIG_OF_GPIO=y
CONFIG_OF_BAREBOX_DRIVERS=y

#
# serial drivers
#
# CONFIG_DRIVER_SERIAL_ARM_DCC is not set
CONFIG_DRIVER_SERIAL_IMX=y
# CONFIG_DRIVER_SERIAL_NS16550 is not set
# CONFIG_DRIVER_SERIAL_CADENCE is not set
CONFIG_ARCH_HAS_FEC_IMX=y

#
# Network drivers
#
# CONFIG_DRIVER_NET_CALXEDA_XGMAC is not set
# CONFIG_DRIVER_NET_DESIGNWARE is not set
# CONFIG_DRIVER_NET_ETHOC is not set
# CONFIG_DRIVER_NET_FEC_IMX is not set
# CONFIG_DRIVER_NET_KS8851_MLL is not set
# CONFIG_DRIVER_NET_MICREL is not set
# CONFIG_DRIVER_NET_SMC911X is not set
# CONFIG_DRIVER_NET_SMC91111 is not set

#
# phylib
#
# CONFIG_NET_USB is not set

#
# SPI drivers
#
CONFIG_SPI=y
CONFIG_DRIVER_SPI_IMX=y
CONFIG_DRIVER_SPI_IMX_2_3=y
CONFIG_I2C=y
CONFIG_I2C_ALGOBIT=y

#
# I2C Hardware Bus support
#
CONFIG_I2C_GPIO=y
CONFIG_I2C_IMX=y
# CONFIG_MTD is not set
CONFIG_DISK=y
CONFIG_DISK_WRITE=y

#
# drive types
#
CONFIG_DISK_ATA=y
CONFIG_DISK_AHCI=y
CONFIG_DISK_AHCI_IMX=y

#
# interface types
#
# CONFIG_DISK_INTF_PLATFORM_IDE is not set
CONFIG_USB=y
CONFIG_USB_IMX_CHIPIDEA=y
CONFIG_USB_IMX_PHY=y
CONFIG_USB_EHCI=y
CONFIG_USB_ULPI=y
CONFIG_USB_STORAGE=y
CONFIG_USB_HAVE_GADGET_DRIVER=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DUALSPEED=y
CONFIG_USB_GADGET_DRIVER_ARC=y

#
# USB Gadget drivers
#
CONFIG_USB_GADGET_DFU=y
CONFIG_USB_GADGET_SERIAL=y
CONFIG_VIDEO=y
CONFIG_DRIVER_VIDEO_SIMPLEFB=y
CONFIG_MCI=y

#
# --- Feature list ---
#
CONFIG_MCI_STARTUP=y
CONFIG_MCI_INFO=y
CONFIG_MCI_WRITE=y
CONFIG_MCI_MMC_BOOT_PARTITIONS=y

#
# --- MCI host drivers ---
#
# CONFIG_MCI_DW is not set
CONFIG_MCI_IMX_ESDHC=y
# CONFIG_MCI_IMX_ESDHC_PIO is not set
# CONFIG_MCI_SPI is not set
CONFIG_HAVE_CLK=y
CONFIG_CLKDEV_LOOKUP=y
CONFIG_COMMON_CLK=y

#
# MFD
#
# CONFIG_MFD_LP3972 is not set
# CONFIG_MFD_MC13XXX is not set
# CONFIG_MFD_MC34704 is not set
# CONFIG_MFD_MC9SDZ60 is not set
CONFIG_MFD_STMPE=y
CONFIG_MFD_SYSCON=y
# CONFIG_MFD_TWL4030 is not set
# CONFIG_MFD_TWL6030 is not set

#
# Misc devices
#
CONFIG_JTAG=y
CONFIG_SRAM=y
CONFIG_LED=y
CONFIG_LED_GPIO=y
CONFIG_LED_PWM=y
CONFIG_LED_GPIO_OF=y
# CONFIG_LED_GPIO_RGB is not set
# CONFIG_LED_GPIO_BICOLOR is not set
CONFIG_LED_TRIGGERS=y

#
# EEPROM support
#
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_AT24 is not set

#
# Input device support
#
CONFIG_KEYBOARD_GPIO=y
# CONFIG_KEYBOARD_IMX_KEYPAD is not set
# CONFIG_KEYBOARD_QT1070 is not set
CONFIG_WATCHDOG_IMX_RESET_SOURCE=y
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_IMX=y
CONFIG_PWM=y
CONFIG_PWM_IMX=y

#
# DMA support
#
CONFIG_MXS_APBH_DMA=y
CONFIG_GPIOLIB=y

#
# GPIO
#
CONFIG_GPIO_GENERIC=y
CONFIG_GPIO_GENERIC_PLATFORM=y
CONFIG_GPIO_IMX=y
# CONFIG_GPIO_OMAP is not set
CONFIG_GPIO_STMPE=y
# CONFIG_GPIO_DESIGNWARE is not set
# CONFIG_W1 is not set
CONFIG_PINCTRL=y
CONFIG_PINCTRL_IMX_IOMUX_V3=y
CONFIG_PINCTRL_SINGLE=y

#
# Bus devices
#
CONFIG_IMX_WEIM=y

#
# Filesystem support
#
CONFIG_FS=y
CONFIG_FS_AUTOMOUNT=y
CONFIG_FS_CRAMFS=y
CONFIG_FS_EXT4=y
CONFIG_FS_RAMFS=y
CONFIG_FS_DEVFS=y
# CONFIG_FS_TFTP is not set
# CONFIG_FS_NFS is not set
CONFIG_FS_FAT=y
CONFIG_FS_FAT_WRITE=y
CONFIG_FS_FAT_LFN=y
# CONFIG_FS_BPKFS is not set
CONFIG_FS_UIMAGEFS=y

#
# Library routines
#
CONFIG_PARAMETER=y
CONFIG_UNCOMPRESS=y
CONFIG_ZLIB=y
# CONFIG_BZLIB is not set
# CONFIG_LZ4_DECOMPRESS is not set
# CONFIG_GENERIC_FIND_NEXT_BIT is not set
CONFIG_PROCESS_ESCAPE_SEQUENCE=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_QSORT=y
CONFIG_XYMODEM=y
CONFIG_STMP_DEVICE=y

#
# Library gui routines
#
CONFIG_IMAGE_RENDERER=y
CONFIG_BMP=y
# CONFIG_PNG is not set
CONFIG_CRC32=y
CONFIG_CRC16=y
CONFIG_DIGEST=y
CONFIG_MD5=y
CONFIG_SHA1=y
CONFIG_SHA224=y
CONFIG_SHA256=y


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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-14  3:35       ` Sean Cross
@ 2014-03-14  8:22         ` Sascha Hauer
  2014-03-17  4:28           ` Sean Cross
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-14  8:22 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Fri, Mar 14, 2014 at 11:35:12AM +0800, Sean Cross wrote:
> On 14/3/14 4:27 AM, Sascha Hauer wrote:
> > On Thu, Mar 13, 2014 at 06:18:44PM +0800, Sean Cross wrote:
> >> On 13/3/14 3:38 PM, Sascha Hauer wrote:
> >>> Hi Sean,
> >>>
> >>> On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
> >>>> The "usb" command just hangs the system.  It should at least detect the
> >>>> other ASIX Ethernet port.  I have &usbh1 configured identically to
> >>>> sabrelite.  Is there something else I need to configure?
> >>>
> >>> This usually means the phys are not configured correctly. Are you
> >>> probing from devicetree?
> >>
> >> I am probing from devicetree.  I don't see phys mentioned anywhere
> >> except in the imx6qdl.dtsi file, which means that in theory there
> >> shouldn't be anything for me to modify.
> > 
> > I can try to reproduce this tomorrow on a sabrelite board.
> > 
> >> Board: Kosagi i.MX6DL Novena Board
> >> detected i.MX6 DualLite revision 1.1
> >> ERROR: out of memory
> >>
> >> [<5062e9ed>] (unwind_backtrace+0x1/0x74) from [<5061c525>] (panic+0x1d/0x34)
> >> [<5061c525>] (panic+0x1d/0x34) from [<5061cc27>] (xmemalign+0xf/0x14)
> >> [<5061cc27>] (xmemalign+0xf/0x14) from [<5062f687>] (mmu_init+0x16b/0x1f8)
> >> [<5062f687>] (mmu_init+0x16b/0x1f8) from [<50600797>]
> >> (start_barebox+0x1b/0xd0)
> >> [<50600797>] (start_barebox+0x1b/0xd0) from [<5062efcd>] (__start+0x91/0xa4)
> >> [<5062efcd>] (__start+0x91/0xa4) from [<50600005>]
> >> (__bare_init_start+0x1/0xc)
> >> ### ERROR ### Please RESET the board ###
> >>
> >> If I also enable early MMU, it hangs much much earlier.  When I dug into
> >> it, it looked like it was trying to place a TTB just outside of the
> >> allocated memory region, for some reason.
> >>
> >> This is with me passing SZ_1G to barebox_arm_entry().  If I pass
> >> something small like SZ_64M, it hangs completely.  If I instead pass it
> >> SZ_128M, it works just fine, but of course the MMU still doesn't work.
> > 
> > I suspect you have some memory setting that doesn't work in your
> > .config. Could you post it? Particularly the addresses in your backtrace
> > are outside the reachable memory (0x10000000 + 1GiB = 0x50000000). This
> > should not happen. Do you have CONFIG_RELOCATABLE enabled? If not, make
> > sure CONFIG_ARCH_TEXT_BASE is inside the memory you pass to
> > barebox_arm_entry(). Otherwise the autodetection for usable malloc area
> > space might produce wrong results.
> 
> You're on the right track.  Earlier on I started calling
> barebox_arm_entry(0x10000000 + 0x800000, SZ_1G, fdt), because otherwise
> it would fail in mysterious ways.  Now that I've got ram passing working
> correctly, I've set it back to 0x10000000, and I'm able to get further.
>  I've also increased the MALLOC_SIZE from 8MB to 64MB, which has made
> some out-of-memory errors go away.
> 
> Now, it gets much further, even with CONFIG_MMU_EARLY enabled.  Now it
> crashes with an error that I see SabreSD was getting at one point, but
> I'm not sure how they resolved it:
> 
> Board: Kosagi i.MX6DL Novena Board
> detected i.MX6 DualLite revision 1.1
> BUG: failure at arch/arm/cpu/mmu.c:122/find_pte()!
> BUG!

This can mean that dma_alloc_coherent() is called too early, before
mmu_init(). That's quite unlikely since the chipidea probe is in
device_initcall, way after mmu_initcall. Other possibility is that
mmu_init failed due to missing memory banks.

Please apply "ARM: MMU: Add some debugging aids and hints" I just sent
to the list. It adds more sanity checks and hopefully gives more clue
what is wrong.

> CONFIG_PBL_IMAGE=y
> CONFIG_PBL_MULTI_IMAGES=y
> CONFIG_PBL_RELOCATABLE=y
> CONFIG_IMAGE_COMPRESSION=y
> # CONFIG_IMAGE_COMPRESSION_LZ4 is not set
> CONFIG_IMAGE_COMPRESSION_LZO=y
> # CONFIG_IMAGE_COMPRESSION_GZIP is not set
> # CONFIG_IMAGE_COMPRESSION_NONE is not set
> CONFIG_MMU=y
> CONFIG_MMU_EARLY=y
> CONFIG_HAVE_CONFIGURABLE_TEXT_BASE=y
> CONFIG_TEXT_BASE=0x17800000
> CONFIG_BAREBOX_MAX_PBL_SIZE=0xffffffff
> CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0xffffffff
> CONFIG_STACK_SIZE=0x400000

This is too much 0x8000 should be enough.

> CONFIG_MALLOC_SIZE=0x4000000

You can also set this to 0x0 in which case barebox will pick a memory
region inside available SDRAM.

Your stack size / malloc size settings shouldn't make problems though.

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-14  8:22         ` Sascha Hauer
@ 2014-03-17  4:28           ` Sean Cross
  2014-03-17  7:18             ` Sascha Hauer
  0 siblings, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-17  4:28 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 14/3/14 4:22 PM, Sascha Hauer wrote:
> On Fri, Mar 14, 2014 at 11:35:12AM +0800, Sean Cross wrote:
>> On 14/3/14 4:27 AM, Sascha Hauer wrote:
>>> On Thu, Mar 13, 2014 at 06:18:44PM +0800, Sean Cross wrote:
>>>> On 13/3/14 3:38 PM, Sascha Hauer wrote:
>>>>> Hi Sean,
>>>>>
>>>>> On Thu, Mar 13, 2014 at 10:04:35AM +0800, Sean Cross wrote:
>>>>>> The "usb" command just hangs the system.  It should at least detect the
>>>>>> other ASIX Ethernet port.  I have &usbh1 configured identically to
>>>>>> sabrelite.  Is there something else I need to configure?
>>>>>
>>>>> This usually means the phys are not configured correctly. Are you
>>>>> probing from devicetree?
>>>>
>>>> I am probing from devicetree.  I don't see phys mentioned anywhere
>>>> except in the imx6qdl.dtsi file, which means that in theory there
>>>> shouldn't be anything for me to modify.
>>>
>>> I can try to reproduce this tomorrow on a sabrelite board.
>>>
>>>> Board: Kosagi i.MX6DL Novena Board
>>>> detected i.MX6 DualLite revision 1.1
>>>> ERROR: out of memory
>>>>
>>>> [<5062e9ed>] (unwind_backtrace+0x1/0x74) from [<5061c525>] (panic+0x1d/0x34)
>>>> [<5061c525>] (panic+0x1d/0x34) from [<5061cc27>] (xmemalign+0xf/0x14)
>>>> [<5061cc27>] (xmemalign+0xf/0x14) from [<5062f687>] (mmu_init+0x16b/0x1f8)
>>>> [<5062f687>] (mmu_init+0x16b/0x1f8) from [<50600797>]
>>>> (start_barebox+0x1b/0xd0)
>>>> [<50600797>] (start_barebox+0x1b/0xd0) from [<5062efcd>] (__start+0x91/0xa4)
>>>> [<5062efcd>] (__start+0x91/0xa4) from [<50600005>]
>>>> (__bare_init_start+0x1/0xc)
>>>> ### ERROR ### Please RESET the board ###
>>>>
>>>> If I also enable early MMU, it hangs much much earlier.  When I dug into
>>>> it, it looked like it was trying to place a TTB just outside of the
>>>> allocated memory region, for some reason.
>>>>
>>>> This is with me passing SZ_1G to barebox_arm_entry().  If I pass
>>>> something small like SZ_64M, it hangs completely.  If I instead pass it
>>>> SZ_128M, it works just fine, but of course the MMU still doesn't work.
>>>
>>> I suspect you have some memory setting that doesn't work in your
>>> .config. Could you post it? Particularly the addresses in your backtrace
>>> are outside the reachable memory (0x10000000 + 1GiB = 0x50000000). This
>>> should not happen. Do you have CONFIG_RELOCATABLE enabled? If not, make
>>> sure CONFIG_ARCH_TEXT_BASE is inside the memory you pass to
>>> barebox_arm_entry(). Otherwise the autodetection for usable malloc area
>>> space might produce wrong results.
>>
>> You're on the right track.  Earlier on I started calling
>> barebox_arm_entry(0x10000000 + 0x800000, SZ_1G, fdt), because otherwise
>> it would fail in mysterious ways.  Now that I've got ram passing working
>> correctly, I've set it back to 0x10000000, and I'm able to get further.
>>  I've also increased the MALLOC_SIZE from 8MB to 64MB, which has made
>> some out-of-memory errors go away.
>>
>> Now, it gets much further, even with CONFIG_MMU_EARLY enabled.  Now it
>> crashes with an error that I see SabreSD was getting at one point, but
>> I'm not sure how they resolved it:
>>
>> Board: Kosagi i.MX6DL Novena Board
>> detected i.MX6 DualLite revision 1.1
>> BUG: failure at arch/arm/cpu/mmu.c:122/find_pte()!
>> BUG!
> 
> This can mean that dma_alloc_coherent() is called too early, before
> mmu_init(). That's quite unlikely since the chipidea probe is in
> device_initcall, way after mmu_initcall. Other possibility is that
> mmu_init failed due to missing memory banks.
> 
> Please apply "ARM: MMU: Add some debugging aids and hints" I just sent
> to the list. It adds more sanity checks and hopefully gives more clue
> what is wrong.
> 
>> CONFIG_PBL_IMAGE=y
>> CONFIG_PBL_MULTI_IMAGES=y
>> CONFIG_PBL_RELOCATABLE=y
>> CONFIG_IMAGE_COMPRESSION=y
>> # CONFIG_IMAGE_COMPRESSION_LZ4 is not set
>> CONFIG_IMAGE_COMPRESSION_LZO=y
>> # CONFIG_IMAGE_COMPRESSION_GZIP is not set
>> # CONFIG_IMAGE_COMPRESSION_NONE is not set
>> CONFIG_MMU=y
>> CONFIG_MMU_EARLY=y
>> CONFIG_HAVE_CONFIGURABLE_TEXT_BASE=y
>> CONFIG_TEXT_BASE=0x17800000
>> CONFIG_BAREBOX_MAX_PBL_SIZE=0xffffffff
>> CONFIG_BAREBOX_MAX_BARE_INIT_SIZE=0xffffffff
>> CONFIG_STACK_SIZE=0x400000
> 
> This is too much 0x8000 should be enough.
> 
>> CONFIG_MALLOC_SIZE=0x4000000
> 
> You can also set this to 0x0 in which case barebox will pick a memory
> region inside available SDRAM.
> 
> Your stack size / malloc size settings shouldn't make problems though.

Hi Sascha,

I've applied the patch you sent, along with a separate modification that
prints out the progress of request_sdram_region:

diff --git a/common/memory.c b/common/memory.c
index c82bbaa..d509af7 100644
--- a/common/memory.c
+++ b/common/memory.c
@@ -145,14 +145,20 @@ struct resource *request_sdram_region(const char
*name, re
 {
        struct memory_bank *bank;

+       printf("Trying to request region %s (from 0x%08lx:0x%08lx):",
+               name, start, start + size - 1);
        for_each_memory_bank(bank) {
                struct resource *res;

                res = request_region(bank->res, name, start, start +
size - 1);
-               if (res)
+               if (res) {
+                       printf(" ok\n");
                        return res;
+               }
+               printf(" no");
        }

+       printf(" fail\n");
        return NULL;
 }

Here is the resulting output and BUG from this run:

barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014


Board: Kosagi i.MX6DL Novena Board
detected i.MX6 DualLite revision 1.1
Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
mmu: Memory banks:
mmu: #0 0x10000000 - 0xffffffff
BUG: failure at arch/arm/cpu/mmu.c:153/find_pte()!
BUG!
[<4fe2e9cd>] (unwind_backtrace+0x1/0x74) from [<4fe1c525>] (panic+0x1d/0x34)
[<4fe1c525>] (panic+0x1d/0x34) from [<4fe2f4d5>] (remap_range+0x65/0xdc)
[<4fe2f4d5>] (remap_range+0x65/0xdc) from [<4fe2f7d1>]
(dma_alloc_coherent+0x2d/0x34)
[<4fe2f7d1>] (dma_alloc_coherent+0x2d/0x34) from [<4fe0d689>]
(ehci_register+0x41/0xa8)
[<4fe0d689>] (ehci_register+0x41/0xa8) from [<4fe0936f>]
(imx_chipidea_probe+0x123/0x168)
[<4fe0936f>] (imx_chipidea_probe+0x123/0x168) from [<4fe07de7>]
(platform_probe+0x9/0xa)
[<4fe07de7>] (platform_probe+0x9/0xa) from [<4fe07bf9>]
(device_probe+0x11/0x44)
[<4fe07bf9>] (device_probe+0x11/0x44) from [<4fe07c53>]
(match.part.3+0x27/0x30)
[<4fe07c53>] (match.part.3+0x27/0x30) from [<4fe07cb5>]
(register_driver+0x59/0x74)
[<4fe07cb5>] (register_driver+0x59/0x74) from [<4fe00797>]
(start_barebox+0x1b/0xd0)
[<4fe00797>] (start_barebox+0x1b/0xd0) from [<4fe2efc5>] (__start+0xa9/0xbc)
[<4fe2efc5>] (__start+0xa9/0xbc) from [<4fe00005>]
(__bare_init_start+0x1/0xc)
### ERROR ### Please RESET the board ###



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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-17  4:28           ` Sean Cross
@ 2014-03-17  7:18             ` Sascha Hauer
  2014-03-17  7:31               ` Alexander Aring
  2014-03-17  7:44               ` Sean Cross
  0 siblings, 2 replies; 22+ messages in thread
From: Sascha Hauer @ 2014-03-17  7:18 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
> Here is the resulting output and BUG from this run:
> 
> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
> 
> 
> Board: Kosagi i.MX6DL Novena Board
> detected i.MX6 DualLite revision 1.1
> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
> mmu: Memory banks:
> mmu: #0 0x10000000 - 0xffffffff

So you have one memory bank that starts at 0x10000000 which is the
standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
specified this in your devicetree? It should contain the correct size.
It could also be that we do not parse #ddress-cells / #size-cells
correctly (in case one of these is not 1 in your devicetree).

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-17  7:18             ` Sascha Hauer
@ 2014-03-17  7:31               ` Alexander Aring
  2014-03-17  7:44               ` Sean Cross
  1 sibling, 0 replies; 22+ messages in thread
From: Alexander Aring @ 2014-03-17  7:31 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On Mon, Mar 17, 2014 at 08:18:58AM +0100, Sascha Hauer wrote:
> On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
> > Here is the resulting output and BUG from this run:
> > 
> > barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
> > 
> > 
> > Board: Kosagi i.MX6DL Novena Board
> > detected i.MX6 DualLite revision 1.1
> > Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
> > Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
> > Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
> > Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
> > Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
> > Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
> > mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
> > mmu: Memory banks:
> > mmu: #0 0x10000000 - 0xffffffff
> 
> So you have one memory bank that starts at 0x10000000 which is the
> standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
> specified this in your devicetree? It should contain the correct size.
> It could also be that we do not parse #ddress-cells / #size-cells
> correctly (in case one of these is not 1 in your devicetree).
> 

does this smells like an error case which we should handle with a slightly
eprintf? :-)

- Alex

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-17  7:18             ` Sascha Hauer
  2014-03-17  7:31               ` Alexander Aring
@ 2014-03-17  7:44               ` Sean Cross
  2014-03-17 10:53                 ` Sascha Hauer
  1 sibling, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-17  7:44 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 17/3/14 3:18 PM, Sascha Hauer wrote:
> On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
>> Here is the resulting output and BUG from this run:
>>
>> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
>>
>>
>> Board: Kosagi i.MX6DL Novena Board
>> detected i.MX6 DualLite revision 1.1
>> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
>> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
>> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
>> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
>> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
>> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
>> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
>> mmu: Memory banks:
>> mmu: #0 0x10000000 - 0xffffffff
> 
> So you have one memory bank that starts at 0x10000000 which is the
> standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
> specified this in your devicetree? It should contain the correct size.
> It could also be that we do not parse #ddress-cells / #size-cells
> correctly (in case one of these is not 1 in your devicetree).

There is no "memory" node in my .dts file, so it's inheriting the
default "memory { device_type = "memory"; reg = <0 0>; };" from
skeleton.dtsi.  I add memory in my board.c file:

static int kosagi_novena_mem_init(void)
{
        /* Pull out RAM capacity, which was stored here in lowlevel.c */
        arm_add_mem_device("ram0", 0x10000000, readl(MX6_SRC_BASE_ADDR +
0x20));
        return 0;
}
mem_initcall(kosagi_novena_mem_init);


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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-17  7:44               ` Sean Cross
@ 2014-03-17 10:53                 ` Sascha Hauer
  2014-03-18  3:35                   ` Sean Cross
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-17 10:53 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Mon, Mar 17, 2014 at 03:44:15PM +0800, Sean Cross wrote:
> On 17/3/14 3:18 PM, Sascha Hauer wrote:
> > On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
> >> Here is the resulting output and BUG from this run:
> >>
> >> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
> >>
> >>
> >> Board: Kosagi i.MX6DL Novena Board
> >> detected i.MX6 DualLite revision 1.1
> >> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
> >> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
> >> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
> >> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
> >> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
> >> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
> >> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
> >> mmu: Memory banks:
> >> mmu: #0 0x10000000 - 0xffffffff
> > 
> > So you have one memory bank that starts at 0x10000000 which is the
> > standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
> > specified this in your devicetree? It should contain the correct size.
> > It could also be that we do not parse #ddress-cells / #size-cells
> > correctly (in case one of these is not 1 in your devicetree).
> 
> There is no "memory" node in my .dts file, so it's inheriting the
> default "memory { device_type = "memory"; reg = <0 0>; };" from
> skeleton.dtsi.

Ok, that's fine.

> I add memory in my board.c file:
> 
> static int kosagi_novena_mem_init(void)
> {
>         /* Pull out RAM capacity, which was stored here in lowlevel.c */
>         arm_add_mem_device("ram0", 0x10000000, readl(MX6_SRC_BASE_ADDR +
> 0x20));

Are you sure the readl returns the proper memory size? How about
replacing this with a hardcoded value for testing?

Sascha

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-17 10:53                 ` Sascha Hauer
@ 2014-03-18  3:35                   ` Sean Cross
  2014-03-18  8:36                     ` Sascha Hauer
  0 siblings, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-18  3:35 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 17/3/14 6:53 PM, Sascha Hauer wrote:
> On Mon, Mar 17, 2014 at 03:44:15PM +0800, Sean Cross wrote:
>> On 17/3/14 3:18 PM, Sascha Hauer wrote:
>>> On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
>>>> Here is the resulting output and BUG from this run:
>>>>
>>>> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
>>>>
>>>>
>>>> Board: Kosagi i.MX6DL Novena Board
>>>> detected i.MX6 DualLite revision 1.1
>>>> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
>>>> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
>>>> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
>>>> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
>>>> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
>>>> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
>>>> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
>>>> mmu: Memory banks:
>>>> mmu: #0 0x10000000 - 0xffffffff
>>>
>>> So you have one memory bank that starts at 0x10000000 which is the
>>> standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
>>> specified this in your devicetree? It should contain the correct size.
>>> It could also be that we do not parse #ddress-cells / #size-cells
>>> correctly (in case one of these is not 1 in your devicetree).
>>
>> There is no "memory" node in my .dts file, so it's inheriting the
>> default "memory { device_type = "memory"; reg = <0 0>; };" from
>> skeleton.dtsi.
> 
> Ok, that's fine.
> 
>> I add memory in my board.c file:
>>
>> static int kosagi_novena_mem_init(void)
>> {
>>         /* Pull out RAM capacity, which was stored here in lowlevel.c */
>>         arm_add_mem_device("ram0", 0x10000000, readl(MX6_SRC_BASE_ADDR +
>> 0x20));
> 
> Are you sure the readl returns the proper memory size? How about
> replacing this with a hardcoded value for testing?

That's very good thinking.  I'm guessing there's a fencepost error
somewhere.  It works if I set it to SZ_1GB, but not when I include the
full amount.  I've tried printing the value stored in that register, and
it is correct.

This works:

        arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
SZ_128M);

This does not:

        arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
SZ_128M + 1);

Is there something special about the address 0xf8000000?


Sean

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-18  3:35                   ` Sean Cross
@ 2014-03-18  8:36                     ` Sascha Hauer
  2014-03-18  8:43                       ` Sean Cross
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-18  8:36 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Tue, Mar 18, 2014 at 11:35:26AM +0800, Sean Cross wrote:
> On 17/3/14 6:53 PM, Sascha Hauer wrote:
> > On Mon, Mar 17, 2014 at 03:44:15PM +0800, Sean Cross wrote:
> >> On 17/3/14 3:18 PM, Sascha Hauer wrote:
> >>> On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
> >>>> Here is the resulting output and BUG from this run:
> >>>>
> >>>> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
> >>>>
> >>>>
> >>>> Board: Kosagi i.MX6DL Novena Board
> >>>> detected i.MX6 DualLite revision 1.1
> >>>> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
> >>>> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
> >>>> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
> >>>> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
> >>>> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
> >>>> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
> >>>> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
> >>>> mmu: Memory banks:
> >>>> mmu: #0 0x10000000 - 0xffffffff
> >>>
> >>> So you have one memory bank that starts at 0x10000000 which is the
> >>> standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
> >>> specified this in your devicetree? It should contain the correct size.
> >>> It could also be that we do not parse #ddress-cells / #size-cells
> >>> correctly (in case one of these is not 1 in your devicetree).
> >>
> >> There is no "memory" node in my .dts file, so it's inheriting the
> >> default "memory { device_type = "memory"; reg = <0 0>; };" from
> >> skeleton.dtsi.
> > 
> > Ok, that's fine.
> > 
> >> I add memory in my board.c file:
> >>
> >> static int kosagi_novena_mem_init(void)
> >> {
> >>         /* Pull out RAM capacity, which was stored here in lowlevel.c */
> >>         arm_add_mem_device("ram0", 0x10000000, readl(MX6_SRC_BASE_ADDR +
> >> 0x20));
> > 
> > Are you sure the readl returns the proper memory size? How about
> > replacing this with a hardcoded value for testing?
> 
> That's very good thinking.  I'm guessing there's a fencepost error
> somewhere.  It works if I set it to SZ_1GB, but not when I include the
> full amount.  I've tried printing the value stored in that register, and
> it is correct.
> 
> This works:
> 
>         arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
> SZ_128M);
> 
> This does not:
> 
>         arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
> SZ_128M + 1);
> 
> Is there something special about the address 0xf8000000?

The memory start and size should be aligned to 1MiB. Otherwise the MMU
code doesn't work. I didn't bother to catch this because all real memory
fulfills this requirement. There's nothing special with 0xf8000000, I
just tried:

arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_128M + SZ_1M);

and this works on a board I have here (although that board doesn't even
have that amount of memory)

Sascha


-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-18  8:36                     ` Sascha Hauer
@ 2014-03-18  8:43                       ` Sean Cross
  2014-03-18  8:58                         ` Sascha Hauer
  0 siblings, 1 reply; 22+ messages in thread
From: Sean Cross @ 2014-03-18  8:43 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 18/3/14 4:36 PM, Sascha Hauer wrote:
> On Tue, Mar 18, 2014 at 11:35:26AM +0800, Sean Cross wrote:
>> On 17/3/14 6:53 PM, Sascha Hauer wrote:
>>> On Mon, Mar 17, 2014 at 03:44:15PM +0800, Sean Cross wrote:
>>>> On 17/3/14 3:18 PM, Sascha Hauer wrote:
>>>>> On Mon, Mar 17, 2014 at 12:28:28PM +0800, Sean Cross wrote:
>>>>>> Here is the resulting output and BUG from this run:
>>>>>>
>>>>>> barebox 2014.03.0-00628-g7fed07d-dirty #158 Mon Mar 17 12:25:45 SGT 2014
>>>>>>
>>>>>>
>>>>>> Board: Kosagi i.MX6DL Novena Board
>>>>>> detected i.MX6 DualLite revision 1.1
>>>>>> Trying to request region ttb (from 0x4fff4000:0x4fff7fff): ok
>>>>>> Trying to request region malloc space (from 0x4be00000:0x4fdfffff): ok
>>>>>> Trying to request region barebox (from 0x4fe00000:0x4fe4b4a7): ok
>>>>>> Trying to request region barebox data (from 0x4fe4b4a8:0x4fe5c8f7): ok
>>>>>> Trying to request region bss (from 0x4fe5c8f8:0x4fe6214f): ok
>>>>>> Trying to request region stack (from 0x4fff8000:0x4fffffff): ok
>>>>>> mmu: find_pte: TTB for address 0x4cd1e000 is not of type table
>>>>>> mmu: Memory banks:
>>>>>> mmu: #0 0x10000000 - 0xffffffff
>>>>>
>>>>> So you have one memory bank that starts at 0x10000000 which is the
>>>>> standard SDRAM base for i.MX6. Good. But why is the size 0? Have you
>>>>> specified this in your devicetree? It should contain the correct size.
>>>>> It could also be that we do not parse #ddress-cells / #size-cells
>>>>> correctly (in case one of these is not 1 in your devicetree).
>>>>
>>>> There is no "memory" node in my .dts file, so it's inheriting the
>>>> default "memory { device_type = "memory"; reg = <0 0>; };" from
>>>> skeleton.dtsi.
>>>
>>> Ok, that's fine.
>>>
>>>> I add memory in my board.c file:
>>>>
>>>> static int kosagi_novena_mem_init(void)
>>>> {
>>>>         /* Pull out RAM capacity, which was stored here in lowlevel.c */
>>>>         arm_add_mem_device("ram0", 0x10000000, readl(MX6_SRC_BASE_ADDR +
>>>> 0x20));
>>>
>>> Are you sure the readl returns the proper memory size? How about
>>> replacing this with a hardcoded value for testing?
>>
>> That's very good thinking.  I'm guessing there's a fencepost error
>> somewhere.  It works if I set it to SZ_1GB, but not when I include the
>> full amount.  I've tried printing the value stored in that register, and
>> it is correct.
>>
>> This works:
>>
>>         arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
>> SZ_128M);
>>
>> This does not:
>>
>>         arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M +
>> SZ_128M + 1);
>>
>> Is there something special about the address 0xf8000000?
> 
> The memory start and size should be aligned to 1MiB. Otherwise the MMU
> code doesn't work. I didn't bother to catch this because all real memory
> fulfills this requirement. There's nothing special with 0xf8000000, I
> just tried:
> 
> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_128M + SZ_1M);
> 
> and this works on a board I have here (although that board doesn't even
> have that amount of memory)

Oh, I didn't realize there was a requirement to align to the nearest
megabyte.

In that case, you're right.  I tried this, and it works:

arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M
- SZ_1M);

However, this fails:

arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M);


Sean

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

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

* Re: Porting barebox to Novena: misc questions
  2014-03-18  8:43                       ` Sean Cross
@ 2014-03-18  8:58                         ` Sascha Hauer
  2014-03-18  9:04                           ` Sean Cross
  0 siblings, 1 reply; 22+ messages in thread
From: Sascha Hauer @ 2014-03-18  8:58 UTC (permalink / raw)
  To: Sean Cross; +Cc: barebox

On Tue, Mar 18, 2014 at 04:43:32PM +0800, Sean Cross wrote:
> > arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_128M + SZ_1M);
> > 
> > and this works on a board I have here (although that board doesn't even
> > have that amount of memory)
> 
> Oh, I didn't realize there was a requirement to align to the nearest
> megabyte.
> 
> In that case, you're right.  I tried this, and it works:
> 
> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M
> - SZ_1M);
> 
> However, this fails:
> 
> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M);

You are really exploring corner cases here ;)

Try this:

--------------------------8<--------------------

From 4a84905c61d4a4a895c83f4f156f60a7258e6413 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Tue, 18 Mar 2014 09:53:18 +0100
Subject: [PATCH] ARM: MMU: Fix memory reaching to the end of address space

For memory reaching the end of the address space
phys + bank->size overflows to 0. Fix this by right shifting
phys and bank->size before adding them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/cpu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
index 84daa3d..bf0141b 100644
--- a/arch/arm/cpu/mmu.c
+++ b/arch/arm/cpu/mmu.c
@@ -200,7 +200,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
 {
 	unsigned long phys = (unsigned long)bank->start;
 	unsigned long ttb_start = phys >> 20;
-	unsigned long ttb_end = (phys + bank->size) >> 20;
+	unsigned long ttb_end = (phys >> 20) + (bank->size >> 20);
 	unsigned long num_ptes = bank->size >> 10;
 	int i, pte;
 	u32 *ptes;
-- 
1.9.0

-- 
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] 22+ messages in thread

* Re: Porting barebox to Novena: misc questions
  2014-03-18  8:58                         ` Sascha Hauer
@ 2014-03-18  9:04                           ` Sean Cross
  0 siblings, 0 replies; 22+ messages in thread
From: Sean Cross @ 2014-03-18  9:04 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 18/3/14 4:58 PM, Sascha Hauer wrote:
> On Tue, Mar 18, 2014 at 04:43:32PM +0800, Sean Cross wrote:
>>> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_128M + SZ_1M);
>>>
>>> and this works on a board I have here (although that board doesn't even
>>> have that amount of memory)
>>
>> Oh, I didn't realize there was a requirement to align to the nearest
>> megabyte.
>>
>> In that case, you're right.  I tried this, and it works:
>>
>> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M
>> - SZ_1M);
>>
>> However, this fails:
>>
>> arm_add_mem_device("ram0", 0x10000000, SZ_2G + SZ_1G + SZ_512M + SZ_256M);
> 
> You are really exploring corner cases here ;)
> 
> Try this:
> 
> --------------------------8<--------------------
> 
> From 4a84905c61d4a4a895c83f4f156f60a7258e6413 Mon Sep 17 00:00:00 2001
> From: Sascha Hauer <s.hauer@pengutronix.de>
> Date: Tue, 18 Mar 2014 09:53:18 +0100
> Subject: [PATCH] ARM: MMU: Fix memory reaching to the end of address space
> 
> For memory reaching the end of the address space
> phys + bank->size overflows to 0. Fix this by right shifting
> phys and bank->size before adding them.
> 
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/cpu/mmu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/mmu.c b/arch/arm/cpu/mmu.c
> index 84daa3d..bf0141b 100644
> --- a/arch/arm/cpu/mmu.c
> +++ b/arch/arm/cpu/mmu.c
> @@ -200,7 +200,7 @@ static int arm_mmu_remap_sdram(struct memory_bank *bank)
>  {
>  	unsigned long phys = (unsigned long)bank->start;
>  	unsigned long ttb_start = phys >> 20;
> -	unsigned long ttb_end = (phys + bank->size) >> 20;
> +	unsigned long ttb_end = (phys >> 20) + (bank->size >> 20);
>  	unsigned long num_ptes = bank->size >> 10;
>  	int i, pte;
>  	u32 *ptes;
> 


That fixes the problem for booting with the MMU enabled.  Now I can use
the entire memory range.  Go ahead and add my tested-by:

Tested-by: Sean Cross <xobs@kosagi.com>

It's certainly looking a whole lot better now.  The board still suffers
from quirks, such as the 10-second delay during boot when the network
driver is enabled and the cable is unplugged (even if I have 'ip=none'
in my env/config file), and the following crash when I try to start up
USB now:

barebox@Kosagi i.MX6DL Novena Board:/ usb
USB: scanning bus for devices...
unable to handle paging request at address 0x4fe4bc03
pc : [<4fe0ce76>]    lr : [<4fe09171>]
sp : 4ffffd88  ip : 00000016  fp : 4fffff10
r10: 4cca08f4  r9 : 4fe4b6b8  r8 : 00200200
r7 : 00100100  r6 : 4fe4aa14  r5 : 00000000  r4 : 4be19f6c
r3 : 4fe4bc00  r2 : 00010011  r1 : 80088000  r0 : 00000000
Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32
[<4fe0ce76>] (ehci_init+0x62/0xcc) from [<4fe08d5f>]
(usb_host_detect+0x83/0xb4)
[<4fe08d5f>] (usb_host_detect+0x83/0xb4) from [<4fe08dbd>]
(usb_rescan+0x2d/0x50)
[<4fe08dbd>] (usb_rescan+0x2d/0x50) from [<4fe1a5cd>] (do_usb+0x25/0x2c)
[<4fe1a5cd>] (do_usb+0x25/0x2c) from [<4fe029bd>]
(execute_command+0x21/0x48)
[<4fe029bd>] (execute_command+0x21/0x48) from [<4fe06efb>]
(run_list_real+0x54b/0x618)
[<4fe06efb>] (run_list_real+0x54b/0x618) from [<4fe06877>]
(parse_stream_outer+0x107/0x19c)
[<4fe06877>] (parse_stream_outer+0x107/0x19c) from [<4fe070cd>]
(run_shell+0x29/0x54)
[<4fe070cd>] (run_shell+0x29/0x54) from [<4fe00815>]
(start_barebox+0x99/0xd0)
[<4fe00815>] (start_barebox+0x99/0xd0) from [<4fe2eb05>] (__start+0xa9/0xbc)
[<4fe2eb05>] (__start+0xa9/0xbc) from [<4fe00005>]
(__bare_init_start+0x1/0xc)

[<4fe2e50d>] (unwind_backtrace+0x1/0x74) from [<4fe1c68d>] (panic+0x1d/0x34)
[<4fe1c68d>] (panic+0x1d/0x34) from [<4fe2e9c1>] (do_exception+0xd/0x10)
[<4fe2e9c1>] (do_exception+0xd/0x10) from [<4fe2ea29>]
(do_data_abort+0x21/0x2c)
[<4fe2ea29>] (do_data_abort+0x21/0x2c) from [<4fe2e6e8>]
(data_abort+0x48/0x60)

But the mystery of the MMU has been solved.


Sean

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

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

end of thread, other threads:[~2014-03-18  9:04 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-13  2:04 Porting barebox to Novena: misc questions Sean Cross
2014-03-13  7:38 ` Sascha Hauer
2014-03-13 10:18   ` Sean Cross
2014-03-13 20:27     ` Sascha Hauer
2014-03-14  3:35       ` Sean Cross
2014-03-14  8:22         ` Sascha Hauer
2014-03-17  4:28           ` Sean Cross
2014-03-17  7:18             ` Sascha Hauer
2014-03-17  7:31               ` Alexander Aring
2014-03-17  7:44               ` Sean Cross
2014-03-17 10:53                 ` Sascha Hauer
2014-03-18  3:35                   ` Sean Cross
2014-03-18  8:36                     ` Sascha Hauer
2014-03-18  8:43                       ` Sean Cross
2014-03-18  8:58                         ` Sascha Hauer
2014-03-18  9:04                           ` Sean Cross
2014-03-13 19:42   ` Jean-Christophe PLAGNIOL-VILLARD
2014-03-13 20:30     ` Sascha Hauer
2014-03-14  3:03       ` Jean-Christophe PLAGNIOL-VILLARD
2014-03-13 20:43 ` Eric Bénard
2014-03-13 21:26   ` Sascha Hauer
2014-03-14  3:13     ` Jean-Christophe PLAGNIOL-VILLARD

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