From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] tegra: Provide tegra_pre_console_panic() for early panics
Date: Mon, 19 Mar 2012 15:16:37 -0600 [thread overview]
Message-ID: <4F67A235.4090006@wwwdotorg.org> (raw)
In-Reply-To: <1332188824-5447-4-git-send-email-sjg@chromium.org>
On 03/19/2012 02:27 PM, Simon Glass wrote:
> This function is made available to board which want to display a message
> when a panic() occurs before the console is set up. This would otherwise
> result in a silent hang or reboot.
>
> Boards should call tegra_pre_console_panic() and pass the UARTs which
> are available and safe for a message, as well as the selected clock and
> serial multiplier values. Defaults are available as
> CONFIG_DEFAULT_NS16550_CLK and CONFIG_DEFAULT_NS16550_MULT.
...
> diff --git a/arch/arm/cpu/armv7/tegra2/board.c b/arch/arm/cpu/armv7/tegra2/board.c
...
> +void tegra_pre_console_panic(int uart_ids, unsigned clock_freq,
> + unsigned multiplier, const char *str)
> +{
> + int baudrate, divisor;
> + const u32 *uart_addr;
> +
> + /* Enable all permitted UARTs */
> + tegra_setup_uarts(uart_ids);
That call honors uart_ids. ...
> + /*
> + * Now send the string out all the selected UARTs. We don't try all
> + * possible configurations, but this could be added if required.
> + */
> + baudrate = CONFIG_BAUDRATE;
> + divisor = (clock_freq + (baudrate * (multiplier / 2))) /
> + (multiplier * baudrate);
> +
> + for (uart_addr = uart_reg_addr; *uart_addr; uart_addr++) {
Shouldn't this loop also honor uart_ids, and skip sending data to UARTS
not in uart_ids? Sure, they aren't set up above, but perhaps they were
set up elsewhere in the code and hence are capable of sending out data
anyway?
> + NS16550_t regs = (NS16550_t)*uart_addr;
> + const char *s;
> +
> + NS16550_init(regs, divisor);
> + for (s = str; *s; s++) {
> + NS16550_putc(regs, *s);
> + if (*s == '\n')
> + NS16550_putc(regs, '\r');
> + }
> + NS16550_putc(regs, '\n');
> + NS16550_putc(regs, '\r');
> + }
> +}
next prev parent reply other threads:[~2012-03-19 21:16 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 20:27 [U-Boot] [PATCH 1/5] Revert "Add board_pre_console_putc to deal with early console output" Simon Glass
2012-03-19 20:27 ` [U-Boot] [PATCH 2/5] Add board_panic_no_console() to deal with early critical errors Simon Glass
2012-03-20 22:26 ` Graeme Russ
2012-03-20 23:22 ` Simon Glass
2012-03-20 23:43 ` Graeme Russ
2012-03-21 0:06 ` Simon Glass
2012-03-21 0:34 ` Stephen Warren
2012-03-21 0:36 ` Simon Glass
2012-03-21 9:02 ` Wolfgang Denk
2012-03-21 16:17 ` Simon Glass
2012-03-21 22:48 ` Wolfgang Denk
2012-03-21 23:04 ` Wolfgang Denk
2012-03-19 20:27 ` [U-Boot] [PATCH 3/5] tegra: Export the UART setup function for use by boards Simon Glass
2012-03-21 9:04 ` Wolfgang Denk
2012-03-19 20:27 ` [U-Boot] [PATCH 4/5] tegra: Provide tegra_pre_console_panic() for early panics Simon Glass
2012-03-19 21:16 ` Stephen Warren [this message]
2012-03-19 22:55 ` Simon Glass
2012-03-19 20:27 ` [U-Boot] [PATCH 5/5] tegra: Implement board_pre_console_panic() for Seaboard Simon Glass
2012-03-19 21:18 ` Stephen Warren
2012-03-19 22:59 ` Simon Glass
2012-03-20 1:22 ` Stephen Warren
2012-03-20 1:31 ` Simon Glass
2012-03-20 1:46 ` Stephen Warren
2012-03-20 1:58 ` Simon Glass
2012-03-21 9:08 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F67A235.4090006@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox