public inbox for linux-tegra@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] tegra: Implement pre-console putc() for fdt warning
@ 2012-03-09  2:52 Simon Glass
       [not found] ` <1331261577-21099-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Glass @ 2012-03-09  2:52 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Warren, Stephen Warren, Simon Glass,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

When there is not device tree file available to U-Boot, we panic.
Implement board_pre_console_putc() so that this panic will be displayed
on the serial console.

Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 arch/arm/cpu/armv7/tegra2/board.c |   58 +++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/armv7/tegra2/board.c
index 349d50e..4ca1e1f 100644
--- a/arch/arm/cpu/armv7/tegra2/board.c
+++ b/arch/arm/cpu/armv7/tegra2/board.c
@@ -23,9 +23,11 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <ns16550.h>
 #include "ap20.h"
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
+#include <asm/arch/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/tegra2.h>
 #include <asm/arch/pmc.h>
@@ -37,6 +39,7 @@ enum {
 	UARTA	= 1 << 0,
 	UARTB	= 1 << 1,
 	UARTD	= 1 << 3,
+	UART_ALL = 0xf,
 	UART_COUNT = 4,
 };
 
@@ -149,3 +152,58 @@ void enable_caches(void)
 	dcache_enable();
 }
 #endif
+
+
+/*
+ * Possible UART locations: we ignore UARTC at 0x70006200 and UARTE at
+ * 0x70006400, since we don't have code to init them
+ */
+static u32 uart_reg_addr[] = {
+	NV_PA_APB_UARTA_BASE,
+	NV_PA_APB_UARTB_BASE,
+	NV_PA_APB_UARTD_BASE,
+	0
+};
+
+#ifdef CONFIG_PRE_CONSOLE_PUTC
+/*
+ * This is called when we have no console. About the only reason that this
+ * happen is if we don't have a valid fdt. So we don't know what kind of
+ * Tegra board we are. We blindly try to print a message every which way we
+ * know.
+ */
+void board_pre_console_putc(int ch)
+{
+	int uart_ids = UART_ALL;	/* turn it all on! */
+	u32 *uart_addr;
+	int clock_freq, multiplier, baudrate, divisor;
+
+	/* Try to enable all possible UARTs */
+	setup_uarts(uart_ids);
+
+	/*
+	 * Seaboard has a UART switch on PI3. We might be a Seaboard,
+	 * so flip it!
+	 */
+#ifdef CONFIG_SPI_UART_SWITCH
+	gpio_direction_output(GPIO_PI3, 0);
+#endif
+
+	/*
+	 * Now send the string out all the Tegra UARTs. We don't try all
+	 * possible configurations, but this could be added if required.
+	 */
+	clock_freq = CONFIG_DEFAULT_NS16550_CLK;
+	multiplier = CONFIG_DEFAULT_NS16550_MULT;
+	baudrate = CONFIG_BAUDRATE;
+	divisor = (clock_freq + (baudrate * (multiplier / 2))) /
+			(multiplier * baudrate);
+
+	for (uart_addr = uart_reg_addr; *uart_addr; uart_addr++) {
+		NS16550_init((NS16550_t)*uart_addr, divisor);
+		NS16550_putc((NS16550_t)*uart_addr, ch);
+		if (ch == '\n')
+			NS16550_putc((NS16550_t)*uart_addr, '\r');
+	}
+}
+#endif
-- 
1.7.7.3

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

* [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards
       [not found] ` <1331261577-21099-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2012-03-09  2:52   ` Simon Glass
       [not found]     ` <1331261577-21099-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2012-03-09  3:25   ` [U-Boot] [PATCH 1/2] tegra: Implement pre-console putc() for fdt warning Mike Frysinger
  1 sibling, 1 reply; 6+ messages in thread
From: Simon Glass @ 2012-03-09  2:52 UTC (permalink / raw)
  To: U-Boot Mailing List
  Cc: Tom Warren, Stephen Warren, Simon Glass,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

This is used to display panic messages before the console is active.


Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 include/configs/tegra2-common.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/configs/tegra2-common.h b/include/configs/tegra2-common.h
index e6f385f..6ced617 100644
--- a/include/configs/tegra2-common.h
+++ b/include/configs/tegra2-common.h
@@ -68,11 +68,18 @@
  */
 #define V_NS16550_CLK			216000000	/* 216MHz (pllp_out0) */
 
+/* Default serial clock and multiplier */
+#define CONFIG_DEFAULT_NS16550_CLK	V_NS16550_CLK
+#define CONFIG_DEFAULT_NS16550_MULT	16
+
 #define CONFIG_SYS_NS16550
 #define CONFIG_SYS_NS16550_SERIAL
 #define CONFIG_SYS_NS16550_REG_SIZE	(-4)
 #define CONFIG_SYS_NS16550_CLK		V_NS16550_CLK
 
+/* We use this for a warning message when no device tree is present */
+#define CONFIG_PRE_CONSOLE_PUTC
+
 /*
  * select serial console configuration
  */
-- 
1.7.7.3

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

* Re: [U-Boot] [PATCH 1/2] tegra: Implement pre-console putc() for fdt warning
       [not found] ` <1331261577-21099-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2012-03-09  2:52   ` [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards Simon Glass
@ 2012-03-09  3:25   ` Mike Frysinger
  1 sibling, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2012-03-09  3:25 UTC (permalink / raw)
  To: u-boot-0aAXYlwwYIKGBzrmiIFOJg
  Cc: Simon Glass, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren,
	Tom Warren

[-- Attachment #1: Type: Text/Plain, Size: 187 bytes --]

On Thursday 08 March 2012 21:52:56 Simon Glass wrote:
> --- a/arch/arm/cpu/armv7/tegra2/board.c
> +++ b/arch/arm/cpu/armv7/tegra2/board.c
>
> +static u32 uart_reg_addr[] = {

const
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards
       [not found]     ` <1331261577-21099-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2012-03-09  8:48       ` Olof Johansson
  2012-03-09 16:57       ` Stephen Warren
  1 sibling, 0 replies; 6+ messages in thread
From: Olof Johansson @ 2012-03-09  8:48 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Warren, Stephen Warren,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA, Stephen Warren

Hi,

On Thu, Mar 8, 2012 at 6:52 PM, Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org> wrote:
> This is used to display panic messages before the console is active.
>
>
> Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Please don't send u-boot patches to linux-tegra.


Thanks,

-Olof

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

* Re: [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards
       [not found]     ` <1331261577-21099-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  2012-03-09  8:48       ` Olof Johansson
@ 2012-03-09 16:57       ` Stephen Warren
  2012-03-09 18:24         ` Simon Glass
  1 sibling, 1 reply; 6+ messages in thread
From: Stephen Warren @ 2012-03-09 16:57 UTC (permalink / raw)
  To: Simon Glass
  Cc: U-Boot Mailing List, Tom Warren,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

On 03/08/2012 07:52 PM, Simon Glass wrote:
> This is used to display panic messages before the console is active.
> 
> Signed-off-by: Simon Glass <sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

I applied both these patches on top of u-boot-tegra/master, built for
Ventana, and loaded/ran u-boot.bin, and don't see any useful serial
output; there's a bit of periodic binary spew. u-boot-dtb.bin works as
expected.

So, these patches don't appear to solve the problem.

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

* Re: [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards
  2012-03-09 16:57       ` Stephen Warren
@ 2012-03-09 18:24         ` Simon Glass
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2012-03-09 18:24 UTC (permalink / raw)
  To: Stephen Warren; +Cc: linux-tegra, U-Boot Mailing List, Tom Warren

Hi Stephen,

On Fri, Mar 9, 2012 at 8:57 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> On 03/08/2012 07:52 PM, Simon Glass wrote:
>> This is used to display panic messages before the console is active.
>>
>> Signed-off-by: Simon Glass <sjg@chromium.org>
>
> I applied both these patches on top of u-boot-tegra/master, built for
> Ventana, and loaded/ran u-boot.bin, and don't see any useful serial
> output; there's a bit of periodic binary spew. u-boot-dtb.bin works as
> expected.

I don't have a ventana but I think Seaboard is equivalent. I will test
on that and figure out what piece is missing.

>
> So, these patches don't appear to solve the problem.

They do in our tree, but I will take a look.

Regards,
Simon

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

end of thread, other threads:[~2012-03-09 18:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-09  2:52 [PATCH 1/2] tegra: Implement pre-console putc() for fdt warning Simon Glass
     [not found] ` <1331261577-21099-1-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-09  2:52   ` [PATCH 2/2] tegra: Enable pre-console putc() for Tegra boards Simon Glass
     [not found]     ` <1331261577-21099-2-git-send-email-sjg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2012-03-09  8:48       ` Olof Johansson
2012-03-09 16:57       ` Stephen Warren
2012-03-09 18:24         ` Simon Glass
2012-03-09  3:25   ` [U-Boot] [PATCH 1/2] tegra: Implement pre-console putc() for fdt warning Mike Frysinger

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