Patchwork [U-Boot,2/2] Fixes the crippled console output on PortuxG20.

login
register
mail settings
Submitter Markus Hubig
Date Aug. 16, 2012, 6:22 p.m.
Message ID <1345141329-1084-3-git-send-email-mhubig@imko.de>
Download mbox | patch
Permalink /patch/178065/
State Accepted
Delegated to: Andreas Bießmann
Headers show

Comments

Markus Hubig - Aug. 16, 2012, 6:22 p.m.
In order to use the serial interface on the PortuxG20 we need to enable the
level converter first by setting the PC9 pin to high. The level converter needs
some time to settle so we have to use the mdelay() function to wait for some
time. Unfortunately we have no timers available at board_early_init_f() so we
enable the serial output early within board_postclk_init().

Now the U-Boot output looks fine:

| U-Boot 2012.07-00132-gaf1a3b0-dirty (Aug 16 2012 - 18:21:32)
|
| CPU: AT91SAM9G20
| Crystal frequency:   18.432 MHz
| CPU clock        :  396.288 MHz
| Master clock     :  132.096 MHz
| DRAM:  64 MiB
| WARNING: Caches not enabled
| NAND:  128 MiB
| In:    serial
| Out:   serial
| Err:   serial
| Net:   macb0
| Hit any key to stop autoboot:  0

Signed-off-by: Markus Hubig <mhubig@imko.de>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
---
 board/taskit/stamp9g20/stamp9g20.c |   21 +++++++++++++++++----
 include/configs/stamp9g20.h        |    1 +
 2 files changed, 18 insertions(+), 4 deletions(-)
Andreas Bießmann - Sept. 4, 2012, 8:10 p.m.
Dear Markus Hubig,

On 16.08.2012 20:22, Markus Hubig wrote:
> In order to use the serial interface on the PortuxG20 we need to enable the
> level converter first by setting the PC9 pin to high. The level converter needs
> some time to settle so we have to use the mdelay() function to wait for some
> time. Unfortunately we have no timers available at board_early_init_f() so we
> enable the serial output early within board_postclk_init().
>
> Now the U-Boot output looks fine:
>
> | U-Boot 2012.07-00132-gaf1a3b0-dirty (Aug 16 2012 - 18:21:32)
> |
> | CPU: AT91SAM9G20
> | Crystal frequency:   18.432 MHz
> | CPU clock        :  396.288 MHz
> | Master clock     :  132.096 MHz
> | DRAM:  64 MiB
> | WARNING: Caches not enabled
> | NAND:  128 MiB
> | In:    serial
> | Out:   serial
> | Err:   serial
> | Net:   macb0
> | Hit any key to stop autoboot:  0
>
> Signed-off-by: Markus Hubig <mhubig@imko.de>
> Cc: Andreas Bießmann <andreas.devel@googlemail.com>
> ---

applied to u-boot-atmel/master, thanks!

Best regards

Andreas Bießmann

Patch

diff --git a/board/taskit/stamp9g20/stamp9g20.c b/board/taskit/stamp9g20/stamp9g20.c
index 5e07bf8..06df0af 100644
--- a/board/taskit/stamp9g20/stamp9g20.c
+++ b/board/taskit/stamp9g20/stamp9g20.c
@@ -159,15 +159,28 @@  int board_early_init_f(void)
 	return 0;
 }
 
-int board_init(void)
+int board_postclk_init(void)
 {
-	/* Adress of boot parameters */
-	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+	/*
+	 * Initialize the serial interface here, because be need a running
+	 * timer to set PC9 to high and wait for some time to enable the
+	 * level converter of the RS232 interface on the PortuxG20 board.
+	 */
 
-	/* Enable the serial interface */
+#ifdef CONFIG_PORTUXG20
 	at91_set_gpio_output(AT91_PIN_PC9, 1);
+	mdelay(1);
+#endif
 	at91_seriald_hw_init();
 
+	return 0;
+}
+
+int board_init(void)
+{
+	/* Adress of boot parameters */
+	gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100;
+
 	stamp9G20_nand_hw_init();
 #ifdef CONFIG_MACB
 	stamp9G20_macb_hw_init();
diff --git a/include/configs/stamp9g20.h b/include/configs/stamp9g20.h
index a2a0156..a881eef 100644
--- a/include/configs/stamp9g20.h
+++ b/include/configs/stamp9g20.h
@@ -59,6 +59,7 @@ 
 #define CONFIG_INITRD_TAG		/* pass initrd param to kernel */
 #define CONFIG_SKIP_LOWLEVEL_INIT	/* U-Boot is loaded by a bootloader */
 #define CONFIG_BOARD_EARLY_INIT_f	/* call board_early_init_f() */
+#define CONFIG_BOARD_POSTCLK_INIT	/* call board_postclk_init() */
 #define CONFIG_DISPLAY_CPUINFO		/* display CPU Info at startup */
 
 /* setting board specific options */