Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp2038149imm; Fri, 6 Jul 2018 10:40:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpd+HkIiXo3ooI0xCN9s8aCsWOj7ivVKzPVmoUFEuDIgkbtiK1naBAroRlYQ5AyCtaUDsfEZ X-Received: by 2002:a17:902:1566:: with SMTP id b35-v6mr11289031plh.107.1530898850150; Fri, 06 Jul 2018 10:40:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530898850; cv=none; d=google.com; s=arc-20160816; b=h3oNDigT3L674E9RBtRqtR3vh4Lm7UaXElENTJnwVwteDMmD2e5Og8PtZT8K2lSBBK mqBCrgfXeBEjulgBnMFO2veoUY/fk8L9yD/GIT5efBZLvmQMfr0cuFLYahsUtdtGJHOX VAk4t+DE9F18Oujit8AmEj2cn5IUFyWzsTo7oDoBIheKHsr73HYVMxFAkRymCa0Qlutb ECuq6Y5U9KkBkkHSq14ZfudziX7jVyqXxL+ptwNa2tJSJqDQNLtGSWxkM4GD4hKbyFLi aHBR9IcTPPSQfSj9BUWQKbbXfiyiqxBaXd6Gm+MLucPNGNWUCc3B550zYIs3SL9HCjL2 X+Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:date:cc:to:from:subject :message-id:arc-authentication-results; bh=DpFnGKhiPQbL8n31u+4YBe038E+xVy5yEE7oOd6RtUc=; b=tuBiBrmgm/IRMirKd5urKe7aogM7DzzuADW7Y3LbuFYUt8AZ2gfHaEMTEflxua8NLB r5J9W1Dy27xyV6QVRXXd83X5qUXB/9eIXmMt6OXFfH2AW1J7757mgBc2byZ5ozZwbKQw PPei1mKJEueiN7CeKEX0PyxOdSiYGUkkjo6Yz042hwKxxi6ePeXybeakOzmW2PJAHy2R juIExlceMFRTxowuPjerAjBaKHAz5/Rx4H47wWlvgQMA230/Xo+1VQLQvUKQ/tSYswqk LtDXiubzkLDofNATGpMs4TU+1MigJ4yRZE3U1KdXi73gSl77RZcw2v0UY6wfVVzjqdZj oo6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 17-v6si188907pgw.648.2018.07.06.10.40.35; Fri, 06 Jul 2018 10:40:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934174AbeGFRjh (ORCPT + 99 others); Fri, 6 Jul 2018 13:39:37 -0400 Received: from mga07.intel.com ([134.134.136.100]:62173 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933633AbeGFRjd (ORCPT ); Fri, 6 Jul 2018 13:39:33 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Jul 2018 10:39:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,317,1526367600"; d="scan'208";a="53120091" Received: from smile.fi.intel.com (HELO smile) ([10.237.72.86]) by fmsmga008.fm.intel.com with ESMTP; 06 Jul 2018 10:39:30 -0700 Message-ID: <891eef6922d6ed2c69fa28241d047ae8fded7804.camel@linux.intel.com> Subject: Re: [PATCH v2 3/3] serial: 8250_dw: add fractional divisor support From: Andy Shevchenko To: Jisheng Zhang Cc: Greg Kroah-Hartman , Jiri Slaby , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Date: Fri, 06 Jul 2018 20:39:30 +0300 In-Reply-To: <20180705145458.7e7d9b9f@xhacker.debian> References: <20180704165908.4bb8b090@xhacker.debian> <20180704170310.56772d77@xhacker.debian> <20180705143921.6a8aeb50@xhacker.debian> <20180705145458.7e7d9b9f@xhacker.debian> Organization: Intel Finland Oy Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.1-2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2018-07-05 at 14:54 +0800, Jisheng Zhang wrote: > On Thu, 5 Jul 2018 14:39:21 +0800 Jisheng Zhang wrote: > > > > > > > > > > + serial_port_out(p, UART_LCR, up->lcr | UART_LCR_DLAB); > > > > + serial_dl_write(up, quot); > > > > > > At some point it would be a helper, I think. We can call > > > serial8250_do_set_divisor() here. So, perhaps we might export > > > it. > > > > serial8250_do_set_divisor will drop the frac, that's not we want ;) > > > > And most importantly, serial8250_do_set_divisor() will set a wrong > BRD(I) > for fractional capable DW uarts. For example, clk = 25MHZ, baud = > 115200. > > In fractional capable DW uarts, we should set BRD(I) as > 25000000/(16*115200) = 13 > > but serial8250_do_set_divisor() will set BRD(I) as > DIV_ROUND_CLOSEST(25*1000000, 16*115200)) = 14 How come? It doesn't do any calculus (for DW 8250), it just writes few registers based on input. -- Andy Shevchenko Intel Finland Oy