From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752109AbbJUKg5 (ORCPT ); Wed, 21 Oct 2015 06:36:57 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:55262 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750732AbbJUKgz (ORCPT ); Wed, 21 Oct 2015 06:36:55 -0400 From: Arnd Bergmann To: Masahiro Yamada Cc: Linux Kernel Mailing List , Stefan Agner , linux-serial@vger.kernel.org, linux-arm-kernel , Peter Hurley Subject: Re: console vs earlycon ? Date: Wed, 21 Oct 2015 12:36:45 +0200 Message-ID: <5490682.zH2vAEO2id@wuerfel> User-Agent: KMail/4.11.5 (Linux/3.16.0-10-generic; KDE/4.11.5; x86_64; ; ) In-Reply-To: References: <14202684.GgqlkWAZA0@wuerfel> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Provags-ID: V03:K0:CEma/pB0CluH4RdvxVibaaL+JlwtH+o4R07peQO2goN7EqM75Ww oEdNnnW7KIHqjArQQIYIjGdQuvgiq5ZcuyeKNG0YYiIT9gJ1SQwfxILG0faXdz6TpT6LEUA UQCYkXpYiIT4B9pRBow7e1SH73bHuU//Gj4rLh82ovx3RV7EpH38JIRaw/lYTN6eOHcWfaz vlrWJFYvKZcAXFzqfYRkQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:+JfNZ+0Zo6A=:VmhBhxf/Ls6Chg8uhMFw7e ykMpGQEjGCStOTCSYyJwRBpN09QpuCa/rvcyLQFMJzfkc92K9Fkk2yHlsUS/zWzZF2fxlYOkl AkuwPt/EK2hBSy36LA4PQL81h0ThtXXVIh6916eTG6R4GCxHfG/Kiam7FjXohEATUXK6mnKUd ZqIRhokba3bmNSTUOYPspJZF6smQDk0trOkylGOV5mQbkapmxAX0U+uNVNB31TBTCrmqtE3wV 8xNXJqsIi/q8uhfQtHbXmk8v6rL7DK4DkvSnC1bm2yYq6bu/lfTJwrThnbjO9OyYp4ofBRqGA x20M0nPldbKw94Ct12s/N6kTnr1KG3wIDccpCsdJt0kKctHUfXVrSUXDhxFf1SVA8+3VG848S L32YI/2gB5K0i3vSBsFhSZRuFRV6dz1UjlewrHpHjii2vDBT9kO1bgglquay74IjPmfCakjg/ AP3VOxq5G7h6uC1QrUE375a5Yo8j8YbeQxJpHq3nhN8CiV7JjX+w5S1Ul+P3eLxtFTKzBQX5K 1aF7dse0fDEYaQtPVzmVFwDf/lfsYeeLo2xwT0lYD0EwVNWhyaSkLdDxx4p0LjqRhv9OIT+7s HiHHUNR7pIx9vmAHgBZdGErf+7KBe0l7mxpy/BOYtguRBJr1rBudb/EDijwGqnoX2WzfEIGgp KEjqCGDIGkP0Ppu6kBM5rLIqA09YqU1nQue9mxrU34O8YiU7KjbZ3n0TsOM0NH7YcvK+mrgOp a8Tgwx2UZ37aMmN+ Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wednesday 21 October 2015 18:30:05 Masahiro Yamada wrote: > > > >> I am trying to implement OF_EARLYCON_DECLARE() for that. > >> > >> I was just wondering if console_initcall() should work as well. > >> > >> > >> As I said, I noticed the console_initcall() in 8250_core.c > >> only works on very limited platforms. > > > > It works with all those that use of_serial.c, right? > > I doubt it. > > > I have a board with a pure 8250-compat device working. > ( compatible = "ns16550a") > It uses of_serial.c, of course. > > > As far as I tested, it would never enable the console at console_init(). Ok, that sounds like a bug. Peter and others have changed that code a lot in the last year. I wonder if this has never worked then or if it has regressed. > The console is enabled when the UART driver is probed. > (or earlycon if "earlycon" is specified in the kernel-parameter.) Got it. Let me know if you think this interpretation is correct: * univ8250_console_match() looks for the earlycon argument format like "console=uart[8250],io|mmio|mmio32,[,]", and that would work, but we don't want to have to pass all that data when the information should already be there. * univ8250_console_setup() looks for ports that have been added by one of several other methods (including earlycon) already, but we don't do that on ARM without earlycon being enabled. * arch/powerpc/kernel/legacy_serial.c does everything we need, but does not live in architecture independent code and does a few things that we probably don't need or want there. It relies on scanning the device tree for known UART device nodes before the platform devices are added. * for console_initcall() to do the right thing, we want both the ttyS devices to get added early for console=ttyS1 to work, as well as having the preferred console work based on the stdout-property. * we parse the /chosen/stdout-path property in drivers/of/base and store the device node pointer in the global 'of_stdout' variable, but do not use it until the uart is added by the tty driver and calls of_console_check() to add the default console device. Arnd