From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marek Vasut Date: Fri, 28 Aug 2015 12:30:23 +0200 Subject: [U-Boot] [PATCH] arm: socfpga: dm: Fix DM initialization failure after warm reset In-Reply-To: <55E03786.90607@boschrexroth.de> References: <55E01ECE.6020309@boschrexroth.de> <201508281124.12560.marex@denx.de> <55E03786.90607@boschrexroth.de> Message-ID: <201508281230.23593.marex@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday, August 28, 2015 at 12:27:18 PM, Jian Luo wrote: > Hi Marek, > > On 28.08.2015 11:24, Marek Vasut wrote: > > On Friday, August 28, 2015 at 10:41:50 AM, Jian Luo wrote: > >> gd->dm_root is not cleared in SPL after warm reset. > >> This might cause DM initilazation failure. > >> > >> Signed-off-by: Jian Luo > > > > Hi! > > > >> --- > >> > >> arch/arm/mach-socfpga/spl.c | 6 ++++++ > >> 1 file changed, 6 insertions(+) > >> > >> diff --git a/arch/arm/mach-socfpga/spl.c b/arch/arm/mach-socfpga/spl.c > >> index 13ec24b..59fe1f2 100644 > >> --- a/arch/arm/mach-socfpga/spl.c > >> +++ b/arch/arm/mach-socfpga/spl.c > >> @@ -181,5 +181,11 @@ void board_init_f(ulong dummy) > >> > >> /* Configure simple malloc base pointer into RAM. */ > >> gd->malloc_base = CONFIG_SYS_TEXT_BASE + (1024 * 1024); > >> > >> + /* > >> + * gd->dm_root might contain non-zero value after warm reset. > >> + * Clear it to avoid dm_init error > >> + */ > >> + gd->dm_root = NULL; > > > > Nit: The indent should be done with tabs, not spaces. I think the email > > got messed up somewhere along the way. > > Yes, sorry. I can't setup git send-email in our company network. > Thunderbird messed the indent up. Why not ? > > The bigger concern I have is that if you look into arch/arm/lib/crt0.S , > > you will see that the entire global data are cleared there (_main, label > > clr_gd: ) and this code is executed before the board_init_f() . > > This was my first assumption, it should be cleared in crt0.S. > I was using U-Boot to load a VxWorks image. > And wrote 1 to rstmgr ctrl in VxWorks to do a warm reset. > Afterwards the SPL hangs. Hangs in which way ? Can you share the output please ? > It did not happen if I do reset direct in U-Boot. > I'll attach a JTAG Debug to dig deeper. Neat, that'd be really awesome, thanks for looking into this ! > > Can you try tracking it down a bit more? I suspect that you might see > > dm_init_and_scan() returned error -22 , is that what you observe please? > > Yes, in dm_init() where gd->dm_root will be checked. But if you get -ENOMEM, that means somehow the malloc is broken here. I wonder if this explicit setting of gd->malloc_area is screwing something up ? Best regards, Marek Vasut