From: Markus B. <sup...@go...> - 2007-08-06 20:47:38
|
Hi, I tried to get earlyprintk running on SH7720 again and this time I was succ= essfull.=20 I don't know why it didn't work last time, because I did the same again. Everything is fine, so far. I was able to fix the error in the SH7720 setup which prevented booting. But, after that I realised that the board setup wasn't called anymore. When earlyprintk is disabled, the first lines of the bootlog are: [ =A0 =A00.000000] Linux version 2.6.23-rc1 (markus@linux-markus) (gcc vers= ion 3.4.6) #9 Fri Aug 3 11:09:01 CEST 2007 [ =A0 =A00.000000] Booting machvec: mpr2 [ =A0 =A00.000000] Magic Panel Release 2 A.2 The third line is from the board setup. After enabling earlyprintk: [ =A0 =A00.000000] Linux version 2.6.23-rc1 (markus@linux-markus) (gcc vers= ion 3.4.6) #8 Mon Aug 6 13:17:37 CEST 2007 [ =A0 =A00.000000] console [sercon0] enabled [ =A0 =A00.000000] Booting machvec: ./ Boot seemed to be quite normal, but LEDs and ethernet obviously didn't work. When I added sh_mv=3Dgeneric to the command line, the only noticeable diffe= rence was the line [ =A0 =A00.000000] Booting machvec: generic When I tried to specify any other string (including the correct mv_name) to= sh_mv=3D booting stopped after=20 [ =A0 =A00.000000] console [sercon0] enabled I added some debug outputs to get_mv_byname in machvec.c to see what strings get compared, but only=20 [ =A0 =A00.000000] ./ [ =A0 =A00.000000] <NULL> Seem to be there Problem occurs with gcc 3.4.6, 4.0.4, 4.1.2, only when earlyprintk is enabl= ed. Running "strings" on vmlinux shows that the board setup is really compiled = in. This are my changes to earlyprintk.c, but I'm really sure, they are not responsible for the problem. Can anybody reproduce this problem on another board? Any hints for fixing this bug? Regards Markus Note: This patch isn't meant for inclusion, but comments are of course wellcome. diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c index 9833493..a0ff48c 100644 =2D-- a/arch/sh/kernel/early_printk.c +++ b/arch/sh/kernel/early_printk.c @@ -13,6 +13,7 @@ #include <linux/tty.h> #include <linux/init.h> #include <linux/io.h> +#include <linux/delay.h> =20 #ifdef CONFIG_SH_STANDARD_BIOS #include <asm/sh_bios.h> @@ -62,6 +63,11 @@ static struct console bios_console =3D { #include <linux/serial_core.h> #include "../../../drivers/serial/sh-sci.h" =20 +#if defined(CONFIG_CPU_SUBTYPE_SH7720) +#define EPK_SCSMR_VALUE 0x000 +#define EPK_SCBRR_VALUE 0x00C +#endif + static struct uart_port scif_port =3D { .mapbase =3D CONFIG_EARLY_SCIF_CONSOLE_PORT, .membase =3D (char __iomem *)CONFIG_EARLY_SCIF_CONSOLE_PORT, @@ -69,7 +75,7 @@ static struct uart_port scif_port =3D { =20 static void scif_sercon_putc(int c) { =2D while (((sci_in(&scif_port, SCFDR) & 0x1f00 >> 8) =3D=3D 16)) + while (((sci_in(&scif_port, SCFDR) & 0x1f00 >> 8) >=3D 16)) ; =20 sci_out(&scif_port, SCxTDR, c); @@ -105,7 +111,24 @@ static struct console scif_console =3D { .index =3D -1, }; =20 =2D#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) +#if !defined(CONFIG_SH_STANDARD_BIOS) +#if defined(CONFIG_CPU_SUBTYPE_SH7720) +static void scif_sercon_init(char *s) +{ + ctrl_outw(0x0000, PORT_PTCR); + + sci_out(&scif_port, SCSCR, 0x0000 ); /* clear TE and RE */ + sci_out(&scif_port, SCFCR, 0x4006 ); /* reset through TCRST, TFRST, = RFRST */ + sci_out(&scif_port, SCSCR, 0x0000 ); /* select internal clock */ + sci_out(&scif_port, SCSMR, EPK_SCSMR_VALUE ); + sci_out(&scif_port, SCBRR, EPK_SCBRR_VALUE ); + + mdelay(1); + + sci_out(&scif_port, SCFCR, 0x0030 ); /* TTRG=3Db'11 */ + sci_out(&scif_port, SCSCR, 0x0030 ); /* TE, RE */ +} +#elif defined(CONFIG_CPU_SH4) #define DEFAULT_BAUD 115200 /* * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4 @@ -146,7 +169,8 @@ static void scif_sercon_init(char *s) ctrl_outw(0, scif_port.mapbase + 36); ctrl_outw(0x30, scif_port.mapbase + 8); } =2D#endif /* CONFIG_CPU_SH4 && !CONFIG_SH_STANDARD_BIOS */ +#endif /* defined(CONFIG_CPU_SUBTYPE_SH7720) */ +#endif /* !defined(CONFIG_SH_STANDARD_BIOS) */ #endif /* CONFIG_EARLY_SCIF_CONSOLE */ =20 /* @@ -186,7 +210,8 @@ int __init setup_early_printk(char *buf) if (!strncmp(buf, "serial", 6)) { early_console =3D &scif_console; =20 =2D#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SH_STANDARD_BIOS) +#if (defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SUBTYPE_SH7720)) && \ + !defined(CONFIG_SH_STANDARD_BIOS) scif_sercon_init(buf + 6); #endif } |