linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* reboot of mpc8270 sometimes fails
@ 2007-10-09 10:23 Theo Gjaltema
  0 siblings, 0 replies; 5+ messages in thread
From: Theo Gjaltema @ 2007-10-09 10:23 UTC (permalink / raw)
  To: linux-ppc-embedded

hi,

I have an MPC8270 based board with linux 2.4.25 kernel (denx) and 
ramdisk (subset of ELDK3.1.1).
The system works fine, but sometimes after performing a reboot the 
system hangs after terminating the kernel and uboot doesn't come up.
Does someone have a clue about this?

Thanks,
   Theo.

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

* Re: reboot of mpc8270 sometimes fails
@ 2007-10-31 20:14 Matvejchikov Ilya
  2007-11-01 18:02 ` Theo Gjaltema
  0 siblings, 1 reply; 5+ messages in thread
From: Matvejchikov Ilya @ 2007-10-31 20:14 UTC (permalink / raw)
  To: linuxppc-embedded, Theo Gjaltema

Hi!

I thik that m8260_restart in 2.4 kernel is broken. Try to get it from
the 2.6 kernel, or look at this.

 /* The 8260 has an internal 1-second timer update register that
@@ -112,21 +123,16 @@ m8260_get_rtc_time(void)
 static void
 m8260_restart(char *cmd)
 {
-	extern void m8260_gorom(bd_t *bi, uint addr);
-	uint	startaddr;
-
-	/* Most boot roms have a warmstart as the second instruction
-	 * of the reset vector.  If that doesn't work for you, change this
-	 * or the reboot program to send a proper address.
-	 */
-	startaddr = 0xff000104;
-
-	if (cmd != NULL) {
-		if (!strncmp(cmd, "startaddr=", 10))
-			startaddr = simple_strtoul(&cmd[10], NULL, 0);
-	}
-
-	m8260_gorom((unsigned int)__pa(__res), startaddr);
+	__volatile__ unsigned char dummy;
+	
+	local_irq_disable();
+	((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= 0x00000001;
+
+	/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
+	mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
+	dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
+	printk("Restart failed\n");
+	while (1) ;
 }

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

* Re: reboot of mpc8270 sometimes fails
  2007-10-31 20:14 reboot of mpc8270 sometimes fails Matvejchikov Ilya
@ 2007-11-01 18:02 ` Theo Gjaltema
  0 siblings, 0 replies; 5+ messages in thread
From: Theo Gjaltema @ 2007-11-01 18:02 UTC (permalink / raw)
  To: matvejchikov; +Cc: linuxppc-embedded

Hi!

I solved our problem a different way: I added a reset of the CPM just 
before calling te m8260_gorom().
The effect is that the message "rebooting" which was often followed by a 
strange character is now cut short ("reboo"), but uboot is always 
comming up afterwards. I've tested this by adding a "reboot" command in 
an S script in rc3.d. The system with the unpatched kernel failed 
aboutonce every 30 times it rebooted, with the patch it continued 
rebooting correctly for 3 days (then I stopped the tests by hand).

The code for rebooting the CPM was obtained from the freescale manuals 
of the mpc8270.
Anyone interested in the actual patch?

Theo.

Matvejchikov Ilya schreef:
> Hi!
>
> I thik that m8260_restart in 2.4 kernel is broken. Try to get it from
> the 2.6 kernel, or look at this.
>
>  /* The 8260 has an internal 1-second timer update register that
> @@ -112,21 +123,16 @@ m8260_get_rtc_time(void)
>  static void
>  m8260_restart(char *cmd)
>  {
> -	extern void m8260_gorom(bd_t *bi, uint addr);
> -	uint	startaddr;
> -
> -	/* Most boot roms have a warmstart as the second instruction
> -	 * of the reset vector.  If that doesn't work for you, change this
> -	 * or the reboot program to send a proper address.
> -	 */
> -	startaddr = 0xff000104;
> -
> -	if (cmd != NULL) {
> -		if (!strncmp(cmd, "startaddr=", 10))
> -			startaddr = simple_strtoul(&cmd[10], NULL, 0);
> -	}
> -
> -	m8260_gorom((unsigned int)__pa(__res), startaddr);
> +	__volatile__ unsigned char dummy;
> +	
> +	local_irq_disable();
> +	((cpm2_map_t *) cpm2_immr)->im_clkrst.car_rmr |= 0x00000001;
> +
> +	/* Clear the ME,EE,IR & DR bits in MSR to cause checkstop */
> +	mtmsr(mfmsr() & ~(MSR_ME | MSR_EE | MSR_IR | MSR_DR));
> +	dummy = ((cpm2_map_t *) cpm2_immr)->im_clkrst.res[0];
> +	printk("Restart failed\n");
> +	while (1) ;
>  }
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
>   

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

* reboot of mpc8270 sometimes fails
@ 2007-11-22  4:24 lobo fan
  2007-12-04  8:42 ` Theo Gjaltema
  0 siblings, 1 reply; 5+ messages in thread
From: lobo fan @ 2007-11-22  4:24 UTC (permalink / raw)
  To: linuxppc-embedded@ozlabs.org

[-- Attachment #1: Type: text/plain, Size: 114 bytes --]

Hi Theo,
Could you please give me the patch? I am very interested in your patch.

-- 
Thanks.

Best Regards,
Lobo

[-- Attachment #2: Type: text/html, Size: 167 bytes --]

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

* Re: reboot of mpc8270 sometimes fails
  2007-11-22  4:24 lobo fan
@ 2007-12-04  8:42 ` Theo Gjaltema
  0 siblings, 0 replies; 5+ messages in thread
From: Theo Gjaltema @ 2007-12-04  8:42 UTC (permalink / raw)
  To: lobo fan; +Cc: linuxppc-embedded@ozlabs.org

Index: m8260_setup.c
===================================================================
RCS file: /home/.dbCVS_linux/kernel_2_4_25/arch/ppc/kernel/m8260_setup.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -c -r1.1.1.2 -r1.2
*** m8260_setup.c	2006/11/17 07:58:49	1.1.1.2
--- m8260_setup.c	2007/10/08 07:53:54	1.2
***************
*** 148,154 ****
--- 148,164 ----
  		if (!strncmp(cmd, "startaddr=", 10))
  			startaddr = simple_strtoul(&cmd[10], NULL, 0);
  	}
+ #if defined (CONFIG_8260)
+ 	{
+ #include <asm-ppc/cpm_8260.h>
+ 	    volatile	cpm8260_t	*cp = &((immap_t *)IMAP_ADDR)->im_cpm;
  
+ 	    cp->cp_cpcr = (CPM_CR_RST | CPM_CR_FLG);   /* see page 14.17 $14.4.2 of the CPM manual */
+ 	    
+ 	    while (cp->cp_cpcr & CPM_CR_FLG);          /* Wait for it (should be 2 clocks). */
+ 
+ 	}
+ #endif
  	m8260_gorom((unsigned int)__pa(__res), startaddr);
  }
  




lobo fan schreef:
> Hi Theo,
> Could you please give me the patch? I am very interested in your patch.
>
> -- 
> Thanks.
>
> Best Regards,
> Lobo
> ------------------------------------------------------------------------
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded

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

end of thread, other threads:[~2007-12-04  8:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-31 20:14 reboot of mpc8270 sometimes fails Matvejchikov Ilya
2007-11-01 18:02 ` Theo Gjaltema
  -- strict thread matches above, loose matches on Subject: below --
2007-11-22  4:24 lobo fan
2007-12-04  8:42 ` Theo Gjaltema
2007-10-09 10:23 Theo Gjaltema

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).