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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id D5562C3DA42 for ; Wed, 10 Jul 2024 13:40:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Transfer-Encoding:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/5eJAZ36QjxkRUMz4rVzrACDuHjyQUanf7SLV0zRBUA=; b=wRZM5z0KT6+B7lWyOQCBnv6RNt 8FjQRLrSqX7tVvzDS7NqNMYlBBgs4baRf4OaZbEno4ncuDfLS/BPDU/Sy44mYjFJ2fEQowE7YwadN 3dms+PVdifLZ+PA8ngvKtTkRBf5Lx2odVJVq/pEYJ0mKGRe7nhXwmrGJoVZuT+IFRrDM/koVHgmmK GwUM7HeKR/GT5y94cjbiiVA99ECatifj7tdQgIUZUMPMMeLpqgV0l5va+SUCQOEtYENcO8DG89w4R IYqOsdM9hFj4tYQJjckTaWrNCfERFzfEdrZ2j297T0ulp081IijWWsfr7o/EYks6Mg8bDKudu4xwY FhyKyU0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXYd-0000000AgQ5-3gOJ; Wed, 10 Jul 2024 13:40:31 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXYK-0000000AgL6-0XTw for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 13:40:15 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 95E66619AC; Wed, 10 Jul 2024 13:40:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B976CC32781; Wed, 10 Jul 2024 13:40:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1720618810; bh=KLq/YBxo8i9fPeOf0/APuvNk+ktCben/txQXDLZ1oz8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=n3cY/H6jyMdMnJ549TffWKHs1+JXEYfbICoqs79P44zfctQKuuFn6E2W9fcY5e6nU U2zj4IVpZ5LbTS7ziu5hoQjFjmPsqnoxA9QY204M283trCeVg4K+qrdqBE25VRoCr+ bmCH+Tu+8TCQ6dNWKedmgVT9jiHAzDbMayxIld/w= Date: Wed, 10 Jul 2024 15:40:07 +0200 From: Greg Kroah-Hartman To: =?iso-8859-1?Q?Andr=E9?= Draszik Cc: Krzysztof Kozlowski , Alim Akhtar , Jiri Slaby , Peter Griffin , Tudor Ambarus , Will McVicker , Sam Protsenko , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Subject: Re: [PATCH] tty: serial: samsung: add clock comment for earlycon on gs101 Message-ID: <2024071030-gravy-backwater-88ec@gregkh> References: <20240710-samsung_tty-gs101earlycon-v1-1-bd0f8481542a@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240710-samsung_tty-gs101earlycon-v1-1-bd0f8481542a@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_064012_340933_3AFD6B6C X-CRM114-Status: GOOD ( 32.30 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Jul 10, 2024 at 02:33:29PM +0100, André Draszik wrote: > As pointed out in [1] before, the hand-over between earlycon and serial > console is fragile due to clocking issues: > > ... causing earlycon to stop to work sometime into the boot for two > reasons: > * peric0_top1_ipclk_0 requires its parent gout_cmu_peric0_ip to be > running, but because earlycon doesn't deal with clocks that > parent will be disabled when none of the other drivers that > actually deal with clocks correctly require it to be running and > the real serial driver (which does deal with clocks) hasn't taken > over yet > > The console UART, and I2C bus 8 are on the same cmu_peric0 controller, > and that cmu_peric0 has two clocks coming from cmu_top, ip and bus. For > I2C8 & UART to work, both of these clocks from cmu_top need to to be on > as they are the parent of the i2c8-(ip|pclk) and uart-(ip|pclk) each. > > The bootloader leaves those clocks running, yes. So earlycon works (for > a while). > > At some point into the boot, one of two things happens: > 1) Linux will load the i2c driver. That driver does clock handling > (correctly), it will initialise and then it has nothing to do, therefore > it disables cmu_peric0's i2c8 ip and pclk clocks. Because at that stage > nothing appears to be using the cmu_peric0's ip clock (the real serial > driver hasn't initialised yet), Linux decides to also disable the parent > ip clock coming from cmu_top. > > At this stage, the earlycon driver stops working, as the parent ip clock > of the uart ip clock is not running any more. No serial output can be > observed from this stage onwards. I think what is probably happening is > that the console uart FIFO doesn't get emptied anymore, and earlycon > will simply wait forever for space to become available in the FIFO (but > I didn't debug this). > > Anyway, the boot doesn't progress, the system appears to hang. In any > case it's not usable as we have no other means of using it at this stage > (network / usb / display etc.). > > 2) Alternatively, the UART driver will load at this stage. Again, it > will tweak the clocks and after probe it will leave its clocks disabled. > The serial console driver hasn't taken over at this stage and earlycon > is still active. Again, the system will hang, because IP and PCLK have > been disabled by the UART driver. Once the serial console is enabled, > clocks are being enabled again, but because earlycon is still waiting > for progress, the boot doesn't progress past disabling ip and pclk. It > never gets to enabling the serial console (re-enabling the clocks). > > So in both cases we get some output from earlycon, but the system hangs > once the first consumer driver of an IP attached to cmu_peric0 has > completed probing. > > ... > > If earlycon is not enabled in kernel command line, everything works > fine, the kernel buffers its messages and once the real serial console > driver starts, all messages since boot are being printed. > > As requested, add a comment to the code for posterity, so the > information is not lost. The patch referenced in the comment can be > found at [2]. That should also be in the comment in the .c file, right? Along with the git id that you feel should be reverted? thanks, greg k-h