mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: vj <vicencb@gmail.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 4/9] omap_uart: add low level port serial initialization
Date: Sun, 10 Mar 2013 23:16:00 +0100	[thread overview]
Message-ID: <CAAMcf8AGOExgear8jxE7fLBvHB2emnWffZ5hfXE1U6LgwfqOGw@mail.gmail.com> (raw)
In-Reply-To: <20130310131601.GA11170@game.jcrosoft.org>

On Sun, Mar 10, 2013 at 2:16 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> On 00:19 Sun 10 Mar     , Vicente Bergas wrote:
>>  some sort of UART setup has to be done in order to use PUTC_LL
>>
>> Signed-off-by: Vicente Bergas <vicencb@gmail.com>
>> ---
>>  arch/arm/mach-omap/include/mach/debug_ll.h | 21 +++++++++++++++++++++
>>  1 file changed, 21 insertions(+)
>>
>> diff --git a/arch/arm/mach-omap/include/mach/debug_ll.h b/arch/arm/mach-omap/include/mach/debug_ll.h
>> index eea6eb3..9740848 100644
>> --- a/arch/arm/mach-omap/include/mach/debug_ll.h
>> +++ b/arch/arm/mach-omap/include/mach/debug_ll.h
>> @@ -45,9 +45,30 @@
>>  #endif
>>
>>  #define LSR_THRE     0x20    /* Xmit holding register empty */
>> +#define LCR_BKSE     0x80    /* Bank select enable */
>>  #define LSR          (5 << 2)
>>  #define THR          (0 << 2)
>> +#define DLL          (0 << 2)
>> +#define IER          (1 << 2)
>> +#define DLM          (1 << 2)
>> +#define FCR          (2 << 2)
>> +#define LCR          (3 << 2)
>> +#define MCR          (4 << 2)
>> +#define MDR          (8 << 2)
>>
>> +static inline void INIT_LL(void)
> where this come from?

This comes from drivers/serial/serial_ns16550.c: ns16550_serial_init_port
ns16550_serial_init_port call other functions and has local variables,
so a stack is required
INIT_LL instead is an extremly simple inline function without local
variables, so it can be called at the very beginning

from include/debug_ll.h:
"Note that several SoCs expect the UART to be initialized by a
debugger or a first stage bootloader."
INIT_LL implements the second option.

I have a question regarding code executed at the very beginning, that
is, when the stack may not be available or the binary is not at it's
link address
What are the things that can't be done in such scenario?
For example, from include/debug_ll.h:
"Be careful with PUTS_LL, it only works if the binary is running at
the link address which often is not the case during early startup."
static __inline__ void PUTS_LL(const char * str)
{
	while (*str) {
		if (*str == '\n') {
			PUTC_LL('\r');
		}
		PUTC_LL(*str);
		str++;
	}
}
What does PUTS_LL do that can't be done?


>> +{
>> +     writeb(0x00, UART_BASE + LCR);
>> +     writeb(0x00, UART_BASE + IER);
>> +     writeb(0x07, UART_BASE + MDR);
>> +     writeb(LCR_BKSE, UART_BASE + LCR);
>> +     writeb(26, UART_BASE + DLL); /* 115200 */
>> +     writeb(0, UART_BASE + DLM);
>> +     writeb(0x03, UART_BASE + LCR);
>> +     writeb(0x03, UART_BASE + MCR);
>> +     writeb(0x07, UART_BASE + FCR);
>> +     writeb(0x00, UART_BASE + MDR);
>> +}
>>  static inline void PUTC_LL(char c)
>>  {
>>       /* Wait until there is space in the FIFO */
>> --
>> 1.8.1.5
>>
>>
>> _______________________________________________
>> barebox mailing list
>> barebox@lists.infradead.org
>> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-03-10 22:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09 23:19 [PATCH 0/9] Add support for booting ArchosG9 from sd-card Vicente Bergas
2013-03-09 23:19 ` [PATCH 1/9] defaultenv-2: don't load nonexistent file Vicente Bergas
2013-03-09 23:19 ` [PATCH 2/9] omap4_romusb: rename omap4_usbboot_pdata to omap4_usbboot_data Vicente Bergas
2013-03-09 23:19 ` [PATCH 3/9] omap_uart: rename OMAP3EVM_UARTx to OMAP_UARTx Vicente Bergas
2013-03-09 23:19 ` [PATCH 4/9] omap_uart: add low level port serial initialization Vicente Bergas
2013-03-10 13:16   ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-10 22:16     ` vj [this message]
2013-03-10 22:35       ` Sascha Hauer
2013-03-10 22:44         ` vj
2013-03-10 23:01           ` Sascha Hauer
2013-03-10 23:09             ` vj
2013-03-09 23:19 ` [PATCH 5/9] panda: remove unused configuration items Vicente Bergas
2013-03-09 23:19 ` [PATCH 6/9] omap4_romusb: allow adding usb-serial when not booting from usb Vicente Bergas
2013-03-14  7:50   ` Sascha Hauer
2013-03-09 23:19 ` [PATCH 7/9] menu: avoid errors when building submenus Vicente Bergas
2013-03-10 13:16   ` Jean-Christophe PLAGNIOL-VILLARD
2013-03-10 22:29     ` vj
2013-03-11  8:50       ` Sascha Hauer
2013-03-09 23:19 ` [PATCH 8/9] archos: add atag appender for all features Vicente Bergas
2013-03-11  8:36   ` Sascha Hauer
2013-03-09 23:19 ` [PATCH 9/9] archosg9: enable booting from sd-card Vicente Bergas
2013-03-11 21:25 ` [PATCH 0/9] Add support for booting ArchosG9 " Sascha Hauer

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=CAAMcf8AGOExgear8jxE7fLBvHB2emnWffZ5hfXE1U6LgwfqOGw@mail.gmail.com \
    --to=vicencb@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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