From patchwork Tue Apr 14 04:34:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 18028 X-Patchwork-Delegate: lethal@linux-sh.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3E59Dhh024119 for ; Tue, 14 Apr 2009 05:09:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751186AbZDNFJN (ORCPT ); Tue, 14 Apr 2009 01:09:13 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751201AbZDNFJM (ORCPT ); Tue, 14 Apr 2009 01:09:12 -0400 Received: from mail.renesas.com ([202.234.163.13]:57143 "EHLO mail06.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751186AbZDNFJM (ORCPT ); Tue, 14 Apr 2009 01:09:12 -0400 X-AuditID: ac14038a-0000000b00001ca1-7e-49e41a766105 Received: from guardian01.idc.renesas.com ([172.20.8.200]) by mail06.idc.renesas.com (sendmail) with ESMTP id n3E5992e007496; Tue, 14 Apr 2009 14:09:09 +0900 (JST) Received: (from root@localhost) by guardian01.idc.renesas.com with id n3E59A1g006879; Tue, 14 Apr 2009 14:09:10 +0900 (JST) Received: from mta02.idc.renesas.com (localhost [127.0.0.1]) by mta02.idc.renesas.com with ESMTP id n3E59Bf8003551; Tue, 14 Apr 2009 14:09:11 +0900 (JST) Received: from PG10870.renesas.com ([172.30.8.159]) by ims05.idc.renesas.com (Sendmail) with ESMTPA id <0KI20094NRN9E2@ims05.idc.renesas.com>; Tue, 14 Apr 2009 14:09:09 +0900 (JST) Date: Tue, 14 Apr 2009 13:34:52 +0900 From: Kuninori Morimoto Subject: [PATCH] sh-sci: fix SCBRR value calculation To: Paul Mundt Cc: SH-Linux , RSO iwamatsu Message-id: MIME-version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-type: text/plain; charset=US-ASCII User-Agent: SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL/10.7 Emacs/22.1 (i386-mingw-nt5.1.2600) MULE/5.0 (SAKAKI) Meadow/3.00-dev (KIKU) X-Brightmail-Tracker: AAAAAA== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Signed-off-by: Kuninori Morimoto --- >> Iwamatsu-san Please check this patch to make sure it doesn't break any boards. I checked this patch by AP325 (for SCIFA) and Diamond Head (for SCIF) It works well But I don't know about some strange Hitachi ULSI board with magical clock settings. drivers/serial/sh-sci.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index d0aa82d..f8c0b87 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h @@ -761,9 +761,9 @@ static inline int sci_rxd_in(struct uart_port *port) static inline int scbrr_calc(struct uart_port *port, int bps, int clk) { if (port->type == PORT_SCIF) - return (clk+16*bps)/(32*bps)-1; + return (clk/(32*bps)) - 1; else - return ((clk*2)+16*bps)/(16*bps)-1; + return ((clk*2)/(16*bps)) - 1; } #define SCBRR_VALUE(bps, clk) scbrr_calc(port, bps, clk) #elif defined(__H8300H__) || defined(__H8300S__)