Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2493876imm; Mon, 24 Sep 2018 05:26:42 -0700 (PDT) X-Google-Smtp-Source: ACcGV63b9gfO8ctGFi2KxrzWjan1sBuRg9J0EbcExf3mJ5hhxaQC/k9szzy7Ly55Z1AY9LnYZ9l/ X-Received: by 2002:a17:902:9a82:: with SMTP id w2-v6mr10659541plp.109.1537792002192; Mon, 24 Sep 2018 05:26:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537792002; cv=none; d=google.com; s=arc-20160816; b=qJ52VrZT9gdL9jmCB2Qau/2QELH8ogn5bEh7REskHxABz6VhL93nB5E2pLYVVCkieK 4gpxsyjLy+6lyZ55RsHBoGMwaOFxW0TzrgaAZJXxt5mdSdGHOdA4WMKQ4OL7Cx2eDiLx fOjKM7jDCUQCDDoquxMZOkrwXNLVbWEv/WRS7lllgjskLoMUad55XJvX6VzUWXnj6WZR E2JgyXUrnamCuF2oqeuzNIJrb7KkI2fGmDsq9UhQiy4NHygWwBvIhSeVYl4+Jb6N5V/s /jbP55EliQWhpw3yTrqPVbFTq0SINg8my3w6EmwvUhBJH+gCXknFzeLcjaUzUyG4HmuX 87/w== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=CpBySHWRmn/Sm5Q/m5rW0Rava8B8C+GmwJevz0Xnb18=; b=m/+HOzbNfMjWZ3yXZ4DewAAd/MjEUXhOUoQ6ZCJ7GfpY3qUfBEZp42ZiheOJFLTO29 2C36IP8W6jjxI2eIBw7+gzdXoMpAbGkVplXFXdrDczoBTlKKkPTc+iPjb+PI0srfzc8O Z8dd77PgWN/TDkkyJgl01v7bnSiflDjEjfhrycHKza5u8OhTczRw56OgAz07JnJaTgI3 5/gr9Yh2pzc86ju1ujfip53KTvrwc6Ss88OmXgtBLzMv4bVS/Xlu4sG+fpD2PlxQfkid SKZy1WPkFGnH7M44P5dW09HCr0mT5UcsUpJ5rUloPgKB+7Lrq73qdoXWPcYFHovSrBof 4LAA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k185-v6si12359811pgk.183.2018.09.24.05.26.26; Mon, 24 Sep 2018 05:26:42 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732944AbeIXS1U (ORCPT + 99 others); Mon, 24 Sep 2018 14:27:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56960 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730683AbeIXS1T (ORCPT ); Mon, 24 Sep 2018 14:27:19 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 6AB78108B; Mon, 24 Sep 2018 12:25:26 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Simek , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Subject: [PATCH 4.14 161/173] earlycon: Initialize port->uartclk based on clock-frequency property Date: Mon, 24 Sep 2018 13:53:15 +0200 Message-Id: <20180924113126.984379184@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113114.334025954@linuxfoundation.org> References: <20180924113114.334025954@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Michal Simek commit 814453adea7d081ad8917aa0f32d6a14165a3563 upstream. On DT based platforms when current-speed property is present baudrate is setup. Also port->uartclk is initialized to bogus BASE_BAUD * 16 value. Drivers like uartps/ns16550 contain logic when baudrate and uartclk is used for baudrate calculation. The patch is reading optional clock-frequency property to replace bogus BASE_BAUD * 16 calculation to have proper baudrate calculation. [-stable comment: commit 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure") has changed 8250_early.c behavior which now tries to setup UART speed. Ignoring clock-frequency results in wrong value of calculated divisor & malformed early console output.] Fixes: 31cb9a8575ca ("earlycon: initialise baud field of earlycon device structure") Signed-off-by: Michal Simek [rmilecki: add -stable comment and Fixes tag] Signed-off-by: Rafał Miłecki Signed-off-by: Greg Kroah-Hartman --- drivers/tty/serial/earlycon.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -289,6 +289,10 @@ int __init of_setup_earlycon(const struc if (val) early_console_dev.baud = be32_to_cpu(*val); + val = of_get_flat_dt_prop(node, "clock-frequency", NULL); + if (val) + port->uartclk = be32_to_cpu(*val); + if (options) { early_console_dev.baud = simple_strtoul(options, NULL, 0); strlcpy(early_console_dev.options, options,