From patchwork Tue Dec 22 03:37:28 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 69227 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBM3hPAr015927 for ; Tue, 22 Dec 2009 03:43:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751210AbZLVDnX (ORCPT ); Mon, 21 Dec 2009 22:43:23 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752309AbZLVDnX (ORCPT ); Mon, 21 Dec 2009 22:43:23 -0500 Received: from mail-gx0-f211.google.com ([209.85.217.211]:37841 "EHLO mail-gx0-f211.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751063AbZLVDnW (ORCPT ); Mon, 21 Dec 2009 22:43:22 -0500 Received: by gxk3 with SMTP id 3so151567gxk.1 for ; Mon, 21 Dec 2009 19:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=1KbKfdHDO0dJlVu1mUAEMI5N0WjQz6Pgh630Qmw5iPk=; b=f96MVNyWQ3nx765cfTPxLK3qO3a6ic4MoCHKhC0W/KuO1MXLdJGu8AeBQ4R8pvcqmQ K4Gs2W37utX7a7RVDRo25oKirupEfEaNoR12BHgGb6l7jZJXUJvcC5uOXJgkgRkLYgX5 8lzbs9R7U23hFwrnldJST+LnTr5IkOHt8b/5M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=RiNcyhFyt9qTngKa+I0jGVbn594Fu/FS9nynb1k/duCKoj8idjTE9bcIMj9BYiMVMB YHF9OcZ6GmQMPTIh/8R7uc/RUmNeBDCwZoodveNzCPPlK1Snic2FHivqsDEc0iJSQC1U exDhUm9ejuIvO8XuvTNkoq9zTK/OzyMGi7ybg= Received: by 10.101.165.16 with SMTP id s16mr12848726ano.60.1261453401971; Mon, 21 Dec 2009 19:43:21 -0800 (PST) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 8sm2648698yxb.43.2009.12.21.19.43.19 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 21 Dec 2009 19:43:21 -0800 (PST) From: Magnus Damm To: Magnus Damm , linux-sh@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org Date: Tue, 22 Dec 2009 12:37:28 +0900 Message-Id: <20091222033728.7243.23141.sendpatchset@rxone.opensource.se> Subject: [PATCH] sh-sci: earlyprintk zero uartclk fix Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org --- 0014/drivers/serial/sh-sci.c +++ work/drivers/serial/sh-sci.c 2009-12-21 21:53:07.000000000 +0900 @@ -902,11 +902,20 @@ static void sci_shutdown(struct uart_por static void sci_set_termios(struct uart_port *port, struct ktermios *termios, struct ktermios *old) { - unsigned int status, baud, smr_val; + unsigned int status, baud, smr_val, max_baud; int t = -1; - baud = uart_get_baud_rate(port, termios, old, 0, port->uartclk/16); - if (likely(baud)) + /* earlyprintk comes here early on with port->uartclk set to zero. + * the clock framework is not up and running at this point so here + * we assume that 115200 is the maximum baud rate. please note that + * the baud rate is not programmed during earlyprintk - it is assumed + * that the previous boot loader has enabled required clocks and + * setup the baud rate generator hardware for us already. + */ + max_baud = port->uartclk ? port->uartclk / 16 : 115200; + + baud = uart_get_baud_rate(port, termios, old, 0, max_baud); + if (likely(baud && port->uartclk)) t = SCBRR_VALUE(baud, port->uartclk); do {