Received: by 10.223.185.116 with SMTP id b49csp806993wrg; Sat, 3 Mar 2018 07:57:25 -0800 (PST) X-Google-Smtp-Source: AG47ELsXS4tP6IuraxXOM34P2nSXYRA57e4Ufbxoq+nqGl9YlCDpY71xXE1W1qw/VDvTviYM4tBf X-Received: by 10.101.90.10 with SMTP id y10mr7600216pgs.34.1520092645647; Sat, 03 Mar 2018 07:57:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520092645; cv=none; d=google.com; s=arc-20160816; b=rrTezlAuScm3PNI/gu28tUXBbEw+uFHn94pN/n1wwMpFFV2X/EeTWTTIOhZKtRx8em O9IYrKbk/cfeZWAgvB5HWJUwErPXIb23tuMjyhGJn87ynxHKLIoLQz9Vs7NAH1MFYRgq nJEfKBVgkMezUmzHgp59SX1Oy9tY+5i9pw+shiBtPhriAPg4bTUJiJyMcFzwFOUlsKoX KgBPXG1GpZDifPOpFn+ZxRxnC9qawVZgOmNjLa6E3abw5MgA+BAn7PJgq3Jp6schqTD5 k+kQR9oqd8UDvKY9ScTmFGHIUc8plWp4JHKa9tDbP/LyNMlO0hzG8CI5gba4DRZlFI4Q ZlGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=yiPWoJMV1T3F4uyGDeFvvSQuBs7cD78MykuqNCi2ytA=; b=xBt10PeGlS3ln3VN4e2GR9IeAQkGJ+H22eUZVFhfyIBAzm6tMy6LKA+WGnwEZztVxc EFIllct9LRng15weVUeQD4ozjn0e/gWEsP+mNlib8WI8LCu/qyA/5Fhg5xwiwfqi1yMG xvWQHu0bkDtFoznnvNjG09Riv0a/QJf+GfxFzoOwGYALcj0fiP8CtvkmU70v3ucRmW5y C1DSFRUaG3aWTNTvefgl5Ys4PUtzv2ySuoTCqnX5QDX1IgzscjhMAajAsNVm+yN4jUnG QTrS0hr6jy2BWIg7Un0Rl8wDPthsbRndhRxqsCvyIT1UlCKMnuwn9b1pQTQZ2t3DjuPR 5Z1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UuORIC92; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b8si5632853pgt.383.2018.03.03.07.57.09; Sat, 03 Mar 2018 07:57:25 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UuORIC92; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932097AbeCCP41 (ORCPT + 99 others); Sat, 3 Mar 2018 10:56:27 -0500 Received: from mail-qk0-f181.google.com ([209.85.220.181]:43521 "EHLO mail-qk0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751898AbeCCP4Z (ORCPT ); Sat, 3 Mar 2018 10:56:25 -0500 Received: by mail-qk0-f181.google.com with SMTP id j4so15664752qke.10; Sat, 03 Mar 2018 07:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=yiPWoJMV1T3F4uyGDeFvvSQuBs7cD78MykuqNCi2ytA=; b=UuORIC9292vSDn03C3/KZhJ64oZb5nCms4/Wgo+oI1Fc6w+LezV/TvbHHU68b0yIWj gm3kX3pwPzXisuDxJKZqg98qN0VekLaMHBnaInqBQo9AvYhHEigq/rP7xNkfYxabudHo m8Hjkrp7o+ETYJ/I1io3iSIN0LYFXiIn3yrsNzAswdjAOOVotQMVXsWya65xObUsT4rz MIK1hNaHHdpTD7PD3XITIhWmEXOD6olhAqabAVM5yvYqCA0gQZ2NbYTIWCh3OqfyrSGg 2ambAx4DvM/MI2uL54rHdFY32aDZ0sqeqrGxON7zAuociuINsv5pbfHHex3m06g3UXL8 53rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=yiPWoJMV1T3F4uyGDeFvvSQuBs7cD78MykuqNCi2ytA=; b=WX7hMcDkke2c5ffD+Aq88uC3ALGjSkKO1Idqdj0n6o0ZAEVU/pbjC91vZZniHBpKe9 JStJy5vuRouFwa9D9EoN2Iy/fj2c75fZCXkNk0CFBFH6bMTvHOTBP9RYU0vsDjZQYCsO Jv5VsNc6iz4Z57s/sEnd/mg/OA/l3idnfyGcPupXbMP8IiBzT9McRPabhUXzqU+qlQ5j jy2tZiCHYCO6233S0st4AWwaeLEjwCq/tl5RoZ88XsDaTzqqKna84FHqKkunOMc2envK 8X3+DsjVnYY/QR6K3GYzRJQppe7ka0DrpHxvMcip0u5+BO1Q+VYiD6n77GXsgsN+pct0 x2vQ== X-Gm-Message-State: AElRT7GL1dOD4eOqX9BbarQJ9lqNGkEojat2nHDsTd+I8VCw4mVV1PCA n4QrqBThJhXoE48CbxLVY4zv8Y1kLQnpjKHSHpY= X-Received: by 10.55.207.82 with SMTP id e79mr4461364qkj.219.1520092584672; Sat, 03 Mar 2018 07:56:24 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Sat, 3 Mar 2018 07:56:24 -0800 (PST) In-Reply-To: References: <20180301184335.248378-1-djkurtz@chromium.org> From: Andy Shevchenko Date: Sat, 3 Mar 2018 17:56:24 +0200 Message-ID: Subject: Re: [PATCH v2] earlycon: Allow specifying a uartclk in options To: Daniel Kurtz Cc: Aaron Durbin , Brian Norris , Jonathan Corbet , Greg Kroah-Hartman , Jiri Slaby , Ingo Molnar , Thomas Gleixner , Christoffer Dall , Paul McKenney , Marc Zyngier , Frederic Weisbecker , David Woodhouse , Tom Saeger , Mimi Zohar , "Levin, Alexander (Sasha Levin)" , Linux Documentation List , Linux Kernel Mailing List , "open list:SERIAL DRIVERS" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 2, 2018 at 8:35 PM, Daniel Kurtz wrote: > On Thu, Mar 1, 2018 at 1:02 PM Andy Shevchenko > wrote: >> On Thu, Mar 1, 2018 at 9:22 PM, Daniel Kurtz wrote: >> > On Thu, Mar 1, 2018 at 11:47 AM Andy Shevchenko < > andy.shevchenko@gmail.com> >> > wrote: > the UART bitclock > is >> > always "BASE_BAUD * 16" (1843200). While this may be true for many > UARTs, >> > it isn't true for AMD's CZ/ST which has a 8250_dw and uses a fixed 48 > MHz >> > clock. The main 8250_dw driver uses devm_clk_get to get the "baudclk" > and >> > uses its rate to initialize uartclk. For AMD CZ/ST, this "baudclk" is >> > actually a set up in acpi_apd.c when there is an acpi match for > "AMD0020", >> > with a rate read from the .fixed_clk_rate param of the corresponding >> > apd_device_desc. > As >> > noted above, the information is actually already in the kernel and used > by >> > 8250_dw - I would happy be to hear recommendations for wiring this data >> > into earlycon that doesn't require adding another command line arg. Brief look at the code shows that ->setup() call back is executed after setting initial (which is hardcoded) clock. What you need is to either create another type of earlycon for your device with accompanied ->setup() callback, or patch 8250_early.c. >> > I see that support was also added recently to earlycon to let it use > ACPI >> > SPCR to choose a console and configure its parameters... but AFAICT, > this >> > path also doesn't allow specifying the uart clock. It does specify baudrate. It means it's _firmware_ responsibility to configure UART device properly. >> Fix your firmware then. It should set console to 115200 like (almost) >> everyone does. >> Okay, configures a necessary IPs to feed UART with expected 1.8432M clock. > > The console is 115200 when it is enabled. However, the firmware does not > always enable it by default. Another firmware bug. > The problem is that the UART IP block has a fixed 48 MHz input clock, but > earlycon assumes this clock is always 1843200. > I looked a bit further, and I think this patch (or something similar) is > still required to teach generic earlycon how to handle an explicit > port->uartclk (ie, one that is not 1843200). > The extended string can then be explicitly set on the kernel command line > for this kind of hardware. No. > In addition, we can add another patch with a new quirk detector in > drivers/acpi/spcr.c:acpi_parse_spcr() to handle this hardware. > acpi_parse_spcr() can then use the extended option string to pass in the > appropriate UART clock to setup_eralycon(). Definitely no. It's not defined in SPCR spec. > This would again allow a user to just use the simple command line parameter > "earlycon" if the device's firmware has a correctly confiured ACPI SPCR > table. NAK to the patch, see above alternatives. -- With Best Regards, Andy Shevchenko