Received: by 10.223.185.116 with SMTP id b49csp37017wrg; Fri, 2 Mar 2018 13:09:12 -0800 (PST) X-Google-Smtp-Source: AG47ELvklGHUi2XccVabxClRivsIFN7m89cRpOU19mgnadeUcmz7QeNwfSC9bLGt1CzmJGFSq0pr X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr6131858pld.28.1520024951972; Fri, 02 Mar 2018 13:09:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520024951; cv=none; d=google.com; s=arc-20160816; b=cwIegv0b1YosSVF3/COlRSSLJchWGb/E5Sk/GwxEoBIYMGdlHQhIanNKvl9iOorYmY GBQQQB71pkxnjJ/qJPqV39rmGuClhut7RTUVgGoqyCJAMSqpaamR89J3GXQC4KsMCQTF Kj3cEkFXG04EjzDezvjP6lfU7zUON8NUDWPzAxMT4WbVOHevYAkS26l7bB740boNOkEd hcgrjjzdp6WZM86HQXofb7eojL4fnKqkE4ivHQ3KKwlX0nXWJRN6BxXoKCTgjAqJMAWn Wt5/I6v6+zOUc+TH/BsF/z68V5rlThdi2rGMFiX7NVLZcm2krm+zD7bDsHw1MCtcA73a eZUQ== 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 :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=nU3GjIQkjZypVpWEmHMR4D47DyorMa4HDmMMLhKIUTs=; b=VJy/k3zzzHSMLAKm++VJ/KNjQ3+MttsEPsl9ZHb1LNgWvnZ3ir8KHwj2WMpr/E7CmJ 2LfsJ2V+w0tVoKBfL7T2Ji9jB8Bo9brDF3iELzk9qPlYQ5V093PIXiMEFo6BT57r9vi9 UqZ8W99dkgBns9+eM67/9kKiqN4mPc5WEDqvnfJDOBtsQ7A1unB41XH97BtijMvQlwta +a3vXxBEFnZnXb3UK5BNkP2JyxKEG27buWbfDF1wOlm1JIr6tdrgqmJK93acmOcIuapc U6J0Ypzrbh5YPmJFnfYRN5III5dXo25HcWi28IytYepep4XmE6ZMC4C3qCkpSxyDBoa6 uLgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GJwB21hi; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si4500884pgr.640.2018.03.02.13.08.57; Fri, 02 Mar 2018 13:09:11 -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=@chromium.org header.s=google header.b=GJwB21hi; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1947286AbeCBSfu (ORCPT + 99 others); Fri, 2 Mar 2018 13:35:50 -0500 Received: from mail-ua0-f170.google.com ([209.85.217.170]:38923 "EHLO mail-ua0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423170AbeCBSfs (ORCPT ); Fri, 2 Mar 2018 13:35:48 -0500 Received: by mail-ua0-f170.google.com with SMTP id e25so6649440uam.6 for ; Fri, 02 Mar 2018 10:35:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nU3GjIQkjZypVpWEmHMR4D47DyorMa4HDmMMLhKIUTs=; b=GJwB21hiaPTtR1jUh1QlDl90FriL5sPd6mIizVrp8DNdB0SSB6OnlzcFHt4p0afkPY F7fvXELbYCez/lfoYmA6SYnI3/flfSnoJGwBEHL8ZIM0w/imTRUJR5ocFfncTXSjPo2b 1lg5K8Idg0rDWUN3v53F7DBSuOKd4YGMgeU3A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nU3GjIQkjZypVpWEmHMR4D47DyorMa4HDmMMLhKIUTs=; b=WTkD2kGTvZLEkjDq0aCurpQ8fDEqqAwSjiLAKmY6oqz3V3JDX6kIgfg7/psrc1wdMT hGbmVqdeqCF0D52X9HOMRXLyxLtJPbe476WMyC7gVYD7RpqJ+HLvrHXb+SqwCfcf0V4N mEyouaBKf7t+IVocUWww2RedVLilK/EE74G+XuhRYvhCGK29asr36XvfkBwNqk6EcWZy Uf4e4WK2uvLkC6NMZg/vvIBYZqPh5dnwA3EMKR6R8Q4H3PPY1DvgKueW4iCGXcr4O8aT HI+GZzW/3rwZEAgm/HhWspy6ToI6dkw+bOOkb5txBcsxhI50z5QAUvKVBJK3Xtl8ubQn +t7g== X-Gm-Message-State: APf1xPBhuNFur78L0JiYm9kzdOpmGrgbS1VWNxiooRTcHU7OxvgHUqm2 mrkECIig3NPUCFkPON2ZpbNGaABiCmzlIVoTBknZig== X-Received: by 10.176.83.88 with SMTP id y24mr4261851uay.121.1520015747011; Fri, 02 Mar 2018 10:35:47 -0800 (PST) MIME-Version: 1.0 References: <20180301184335.248378-1-djkurtz@chromium.org> In-Reply-To: From: Daniel Kurtz Date: Fri, 02 Mar 2018 18:35:35 +0000 Message-ID: Subject: Re: [PATCH v2] earlycon: Allow specifying a uartclk in options To: Andy Shevchenko Cc: adurbin@chromium.org, Brian Norris , Jonathan Corbet , Greg Kroah-Hartman , jslaby@suse.com, mingo@kernel.org, Thomas Gleixner , Christoffer Dall , Paul McKenney , marc.zyngier@arm.com, frederic@kernel.org, dwmw@amazon.co.uk, tom.saeger@oracle.com, zohar@linux.vnet.ibm.com, alexander.levin@verizon.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org 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 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: > > "earlycon simply does not utilize the information". > > > > earlycon parses iotype, mapbase and baud (from options). However, it is > > hard-coded to assume that the clock used to generate 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. > > > > This patch attempts to add a way to inform earlycon about this clock. 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. > And it should not require that for sure! > I would look to this later. It's late here. I need to do a bit of > research for the answer. > > 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. > 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. 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. 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(). 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. Thanks, -Dan