From: Chen Baozi Subject: Re: [PATCH V2 2/2] xen: arm: implement early prink for 8250 uart Date: Wed, 3 Jul 2013 19:38:42 +0800 Message-ID: <12729221-893A-4A43-B63D-435581CC1A72@gmail.com> References: <1372770714-1657-1-git-send-email-bjzhang@suse.com> <1372770714-1657-3-git-send-email-bjzhang@suse.com> <1372849795.27768.214.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 (Mac OS X Mail 6.5 \(1508\)) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bamvor Jian Zhang Cc: andre.przywara@calxeda.com, julien.grall@linaro.org, Ian Campbell , Stefano.Stabellini@eu.citrix.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Jul 3, 2013, at 7:25 PM, Chen Baozi wrote: > = > On Jul 3, 2013, at 7:09 PM, Ian Campbell wrote: > = >> On Tue, 2013-07-02 at 21:11 +0800, Bamvor Jian Zhang wrote: >>> diff --git a/xen/arch/arm/arm32/debug-8250.inc b/xen/arch/arm/arm32/deb= ug-8250.inc >>> new file mode 100644 >>> index 0000000..c11357d >>> --- /dev/null >>> +++ b/xen/arch/arm/arm32/debug-8250.inc >>> @@ -0,0 +1,48 @@ >>> +/* >>> + * xen/arch/arm/arm32/debug-8250.inc >>> + * >>> + * 8250 specific debug code >>> + * >>> + * Bamvor Jian Zhang >>> + * Copyright (c) 2013 SUSE >>> + * >>> + * This program is free software; you can redistribute it and/or modify >>> + * it under the terms of the GNU General Public License as published by >>> + * the Free Software Foundation; either version 2 of the License, or >>> + * (at your option) any later version. >>> + * >>> + * This program is distributed in the hope that it will be useful, >>> + * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>> + * GNU General Public License for more details. >>> + */ >>> + >>> + >>> +#define UART_TX (0x00<<2) /* Out: Transmit buffer */ >>> +#define UART_LSR (0x05<<2) /* In: Line Status Register */ >> = >> Is the shift 2 on Baozi's platform too? Perhaps this could be a #define >> provided in the same style as EARLY_UART_BASE_ADDRESS or via some other >> means? > Yes, mine has the shift 2 too. It is because every register's size is 4-B= ytes on both of our platforms. > = > However, it seems this patch doesn't work on OMAP543 (I've modified EARLY= _UART_BASE_ADDRESS to 0x48020000 which is the correct address). I'm looking= for the reasons=85 After fixing a typo when modifying EARLY_UART_BASE_ADDRESS and making clean= the working tree, it works for me. Sorry for my carelessness. > = >> = >> The definitions themselves duplicate those in >> xen/drivers/char/ns16550.c, perhaps we could refactor those into a >> suitable header? > +1 > = >> = >>> + >>> +#define UART_LSR_THRE 0x20 /* Xmit holding register empty = */ >>> + >>> +/* 8250 UART wait UART to be ready to transmit >>> + * rb: register which contains the UART base address >>> + * rc: scratch register */ >>> +.macro early_uart_ready rb, rc >>> +1: >>> + ldr \rc, [\rb, #UART_LSR] /* <- UART_LSR (Line Status Reg= ister) */ >>> + tst \rc, #UART_LSR_THRE /* Check BUSY bit */ >>> + beq 1b /* Wait for the UART to be read= y */ >>> +.endm >>> + >>> +/* 8250 UART transmit character >>> + * rb: register which contains the UART base address >>> + * rt: register which contains the character to transmit */ >>> +.macro early_uart_transmit rb, rt >>> + str \rt, [\rb, #UART_TX] /* -> UART_TX */ >>> +.endm >>> + >>> +/* >>> + * Local variables: >>> + * mode: ASM >>> + * indent-tabs-mode: nil >>> + * End: >>> + */ >> = >> = > =