From patchwork Mon Jan 7 11:35:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 209900 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id DBACA2C0092 for ; Mon, 7 Jan 2013 22:35:45 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BBB494A030; Mon, 7 Jan 2013 12:35:40 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id HBNiDteM8aTa; Mon, 7 Jan 2013 12:35:40 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D2E974A027; Mon, 7 Jan 2013 12:35:38 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 641DD4A028 for ; Mon, 7 Jan 2013 12:35:37 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id UJ8V5AhEIiMn for ; Mon, 7 Jan 2013 12:35:36 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by theia.denx.de (Postfix) with ESMTPS id 091C74A020 for ; Mon, 7 Jan 2013 12:35:34 +0100 (CET) Received: by mail-we0-f178.google.com with SMTP id x43so10357419wey.9 for ; Mon, 07 Jan 2013 03:35:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state; bh=PhSBW2dx1VU9Gmtmfe+i51ogbtM3yllEk+A7MzY8VZ4=; b=VGZMe9Qv2UF508whmQvf1ZsUdrUpAfpUV6BuN3jfVSxv9CzdTLIxIwKJNHnxNe/3rf U+Cg0MwI0iXjBuuJ19mFoOgxGX0ePpmTUjDT12QpYf3jjzxNdpSz8TaksRxHCj/EmYi+ FoNAE+OYjAfe8iEwSunJZF9a9pFei1aBJc1SexXF0Jsk74//PUjUcwqUvLX3lM4p8YJk H9Qm8sM5duWqif+gMYZp8li1zB+ItkRWJ5IyFgjK4plXvbRD0B6X27dpe59w+5m8wIHP dldAuvvD/ISe3Fj0HhEy/LQJKF7wUO+NKy/Y9Sa8upO41nDaWjZMRrqp7IMYpGaXj9hz d9SA== X-Received: by 10.180.19.99 with SMTP id d3mr8772982wie.4.1357558532841; Mon, 07 Jan 2013 03:35:32 -0800 (PST) Received: from localhost.localdomain (11.90.21.95.dynamic.jazztel.es. [95.21.90.11]) by mx.google.com with ESMTPS id dm3sm11689184wib.9.2013.01.07.03.35.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 07 Jan 2013 03:35:31 -0800 (PST) From: Javier Martinez Canillas To: u-boot@lists.denx.de Date: Mon, 7 Jan 2013 12:35:20 +0100 Message-Id: <1357558521-19365-1-git-send-email-javier.martinez@collabora.co.uk> X-Mailer: git-send-email 1.7.7.6 X-Gm-Message-State: ALoCoQl5NJc4eePcDQGqBG0mjGJ/uF92NMsW1S0AZ6lFxAVEulp3ZKarbkHGTvaPkn2IN07TtHhj Cc: Tom Rini , Scott Wood , Javier Martinez Canillas Subject: [U-Boot] [PATCH 1/2] serial/ns16550: add an option to avoid hanging on broken platforms X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Some platforms (e.g. IGEPv2 board) has a broken ns16550 UART that does not set the TEMT bit when the transmitter is empty in SPL. This makes U-Boot to hang while waiting for TEMT to be set. Add a new option to avoid this: CONFIG_SYS_NS16550_BROKEN_TEMT 16550 UART set the Transmitter Empty (TEMT) Bit when all output has finished and the transmitter is totally empty. U-Boot waits for this bit to be set to initialize the serial console. On some broken platforms this bit is not set in SPL making U-Boot to hang while waiting for TEMT. Define this option to avoid it. Signed-off-by: Javier Martinez Canillas --- README | 8 ++++++++ drivers/serial/ns16550.c | 2 ++ 2 files changed, 10 insertions(+), 0 deletions(-) diff --git a/README b/README index 78f40df..a89861e 100644 --- a/README +++ b/README @@ -616,6 +616,14 @@ The following options need to be configured: boot loader that has already initialized the UART. Define this variable to flush the UART at init time. + CONFIG_SYS_NS16550_BROKEN_TEMT + + 16550 UART set the Transmitter Empty (TEMT) Bit when all output + has finished and the transmitter is totally empty. U-Boot waits + for this bit to be set to initialize the serial console. On some + broken platforms this bit is not set in SPL making U-Boot to + hang while waiting for TEMT. Define this option to avoid it. + - Console Interface: Depending on board, define exactly one serial port diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index bbd91ca..87a0917 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -36,8 +36,10 @@ void NS16550_init(NS16550_t com_port, int baud_divisor) { +#if (!defined(CONFIG_SYS_NS16550_BROKEN_TEMT)) while (!(serial_in(&com_port->lsr) & UART_LSR_TEMT)) ; +#endif serial_out(CONFIG_SYS_NS16550_IER, &com_port->ier); #if (defined(CONFIG_OMAP) && !defined(CONFIG_OMAP3_ZOOM2)) || \