From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: * X-Spam-Status: No, score=1.7 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_DBL_ABUSE_MALW autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1DA0C2D0DB for ; Tue, 28 Jan 2020 13:17:26 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9628020CC7 for ; Tue, 28 Jan 2020 13:17:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="df/Gpd0K" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9628020CC7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:To:From: Subject:Date:In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Owner; bh=ieerhoPVc2L5u2n+f5zj+jTG4b1aSpuCwTTEvubxRqk=; b=df/Gpd0KVlTN6C r7iXY2wjR4sCOBprXikyKfkfmSzJUXFnWrxReKzCYcMYmR/YzmV4PL7KpQvC2yeY3lIQFRzF8et89 SNA5UTxHcadX0Yypqi9PPywKE89CC6/Bfz+K7hKQiyFTqdvTWzVNpOrW7XwFNenl7u1TDSzmZqOpv GW+ATUxmQ/PUBEYLvtHF+eHCZKE5JUYhNmVbU0grMjPB/sdWN9sR6IVjjqpN3a9VPoqghgXSHwRvE PqqawS30n1NTo4K6vi0dOV73SAUGDAQf+mM79q4zWlrLLRaBsYEIdp8aoOMwqodlfLvBUkvADVck2 I3Xcn7PTN4bl5UPuqyrw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwQjy-0001D0-QO; Tue, 28 Jan 2020 13:17:14 +0000 Received: from mx2.suse.de ([195.135.220.15]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwQju-0001BD-PR; Tue, 28 Jan 2020 13:17:12 +0000 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 18C54B246; Tue, 28 Jan 2020 13:17:07 +0000 (UTC) In-Reply-To: <88af0fca-90d1-58ff-406d-73f185eb8b7e@gmail.com> Date: Tue, 28 Jan 2020 13:42:21 +0100 Subject: Re: [PATCH] serial: 8250_early: Add earlycon for BCM2835 aux uart From: "Nicolas Saenz Julienne" To: "Matthias Brugger" , "Lukas Wunner" , Message-Id: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200128_051711_154996_1553582E X-CRM114-Status: GOOD ( 23.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthias Brugger , Scott Branden , gregkh@linuxfoundation.org, jslaby@suse.com, linux-kernel@vger.kernel.org, Stephen Boyd , nsaenzjulienne@suse.de, Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-serial@vger.kernel.org, Ray Jui , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Sun Jan 26, 2020 at 9:20 PM, Matthias Brugger wrote: > > > On 26/01/2020 14:12, Lukas Wunner wrote: > > On Sun, Jan 26, 2020 at 01:33:14PM +0100, matthias.bgg@kernel.org wrote: > >> +#ifdef CONFIG_SERIAL_8250_CONSOLE > >> + > >> +static int __init early_bcm2835aux_setup(struct earlycon_device *device, > >> + const char *options) > >> +{ > >> + if (!device->port.membase) > >> + return -ENODEV; > >> + > >> + device->port.iotype = UPIO_MEM32; > >> + device->port.regshift = 2; > >> + > >> + return early_serial8250_setup(device, NULL); > >> +} > >> + > >> +OF_EARLYCON_DECLARE(bcm2835aux, "brcm,bcm2835-aux-uart", > >> + early_bcm2835aux_setup); > >> +#endif > > > > Does this really work? I also tried to get it working recently and > > the system just hung on boot. Looking at it with a JTAG debugger > > showed that the bcm2835aux registers were inaccessible because > > the mini UART wasn't enabled in the AUXENB register. > > > > Maybe if you use OF_EARLYCON_DECLARE, the firmware recognizes that > > serial1 is set as stdout-path and performs enablement of the mini UART? > > Or are you using U-Boot which perhaps does the enablement? > > Yes I'm using U-Boot which enables the console for me. My understanding > is that > the early console is thought as a re-use of the console the boot FW used > for > logging. AFAIK for example it does not enable any needed clocks but > expects > these to be enabled already. > > Looking on the source code of U-Boot [1] I don't see that the AUXENB is > written > somewhere, so I suppose that the FW should already has enabled the > aux-uart. > > I any case if it's just to set one bit, I think we can do that in > early_bcm2835aux_setup(). > > [1] > https://gitlab.denx.de/u-boot/u-boot/blob/master/drivers/serial/serial_bcm283x_mu.c > > > > > I also saw in the JTAG debugger that the uartclk member contained > > an incorrect value, so I'd expect that it has to be set as well in > > early_bcm2835aux_setup(). > > In my case the clock was set by U-Boot already. I'm testing this by booting directly from RPi4's bootloader. And it works as long as I add this to config.txt: enable_uart=1 gpu_freq=500 Which AFAIK blocks frequency scalin on the GPU and fixes the clock to a point where the serial is set at 115200 bauds. Ideally it'd be nice to be able to query the clock frequency, and recalculate the divisors based on that. But I don't know if it's feasible at that point in the boot process. We could maybe leave a comment explaining what is expected from the bootloader, given the different options around. Regards, Nicolas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel