Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp477820lqp; Wed, 12 Jun 2024 07:20:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU6Cu9rgiSNp4phpnfLsaODVb6Z11HtnVFHbXcnp9fG1ufFC1wi/n0EQuAKd57CYWNVuD158/nszfFmG/d5bga0IH+nnuyT1OLY6Tmf7A== X-Google-Smtp-Source: AGHT+IHOuEljBT2EjZZ88kiP5PxW1H57V0Q4buR1k/rRggktDJfsDpoMbzwKjQ1THlQ0rNXuInmA X-Received: by 2002:a17:902:da84:b0:1f6:e306:1786 with SMTP id d9443c01a7336-1f83b70f028mr21781925ad.54.1718202033648; Wed, 12 Jun 2024 07:20:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718202033; cv=pass; d=google.com; s=arc-20160816; b=RbhbUSiqK3barJ/tQh55MBqRnz5ybiMCvNE7kgmSoHU9y3ZAFonEHLYaAFjaCjq3r6 lYaX7RdDy1Hb6IXAPvnwa681ayRTSV0MDDQW7GUTavjP8Sp0An7af8KeSdwlGTzLmnnc 9Ls/Qtui/bI4Mhka9m9Bpa5MV2xN8xTzaWMLHxg4ic0fyQ2G0hf3R6dspkU16dVKCMsl nri+ZyGVuU2xOFxOO2En5Hxwibd2vpwHpOoE0NvyekgRMoex1iTuVaLN/MfaVu9onnfP tDlrgKfkUIscR22rKwQqVWeOosQ2FX56bY0Y7NxmoiuiR9G260eQWRRADeJdUXvKZGCQ o7rA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ehRXid+5yEA0xT7TzSIt1MaimTqtIHWJl33gJuDzaKE=; fh=CMOV/J8nDUjLmJYpLoa1tzqOpQJMTcHa98MGtA1Rq+M=; b=GHtEgrobzwglCU/Cw7aPut+UI8IKFYdza3IokmxXDKZSFLLDJHgHkedE+yKjBlVtYx 6ZVPvjLahNz0EPVWOkGpvqMqBitSLLbJ5tTJVcH61hIprV91ABjDhg2K3rf0A7ERHhzL a5b9+IYRCTMTxv3nDNy35yXK7Ob1Ch/D0l8aVEmzgGhCpomHY9UHwSt7wvJo6hIL2ID5 XCrIhuGTZeeHQCQvVY3zN7k3N2BucofoakXLf9pKMjc45wvrS1+fdxdPcsNIghBwhlfH gnExo3eTUq6FWZhG1DZlXYDCD6jFeiT8dySK117yTsUZNCGwPYwUfUsO988MZ7qk9zvn w12g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Iwz7e8sU; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-209258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209258-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f719c1a829si53064855ad.94.2024.06.12.07.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 07:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@tuxon.dev header.s=google header.b=Iwz7e8sU; arc=pass (i=1 spf=pass spfdomain=tuxon.dev dkim=pass dkdomain=tuxon.dev); spf=pass (google.com: domain of linux-kernel+bounces-209258-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209258-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 42FF7B21375 for ; Tue, 11 Jun 2024 04:52:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CE2F170833; Tue, 11 Jun 2024 04:52:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="Iwz7e8sU" Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C34FF273FD for ; Tue, 11 Jun 2024 04:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718081530; cv=none; b=lHQEYTCUF3azf5egJIUH0V6grjSLeCob7thbxgsSU6lfifRh2TEbUtoS/sAm5I5RrQrbwIJ6I0ERU1A+HGwvTEINbkuce1k/Vr/pUHDKvV+mDYTg0K9WRm6SI36iZKCQbmwhNjAa1IavYy7vs+TBXzUw5a5jWE80caAzAHwLHfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718081530; c=relaxed/simple; bh=XVLIZfIJnnMN/EUq8/G3t+XkuGYTj4SvgWh/gJs9dMA=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=KQ9myq2iF9wfeDGEdhbeqLHFcEaCaiCyxDC9l+SLvI6XlqFGVdfXfDUTjQLCAW2oZ19KROlm0cluBrSDvUqJ50KAe7+o450NdzyWUn5kWoWr+JRe1gQRDDX+yY9TZ8Uuwiy1SA4MoLFun6WV8siQ8CQ/Qb9JTw0B6IZpaGyIL8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=Iwz7e8sU; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a6ef46d25efso394773666b.0 for ; Mon, 10 Jun 2024 21:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1718081526; x=1718686326; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=ehRXid+5yEA0xT7TzSIt1MaimTqtIHWJl33gJuDzaKE=; b=Iwz7e8sUv/wWwB05SpXWDstXjC1Tu/idaYJjOsfaKVX6cEbVGrapchtyB0O10L3fqY jCEqQr7Qh3+F187z3kTKJX6siR1JuDSQThOu5gwxxnMyUHtvseeVgId2wU4n/6/6W1Qz 7rQqLjI83GhMDMCJBEtnGbEWJJ0nzzfJazepA92jD7acqB4dumENWCLAfC4XNK2Pgfjc 8YL+HooTw2fQCplPsl8Bm+D3JZ88/e/6b3tTBL6d4raBRAFHgBw/aDmEH9nbfLn56Ouu 5XokSUy/8e7yYey4lC9/bq1VcbJixtaLVam7/ZAH1O42SYeA0/HyND/P19NDceE/VuzM c6/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718081526; x=1718686326; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ehRXid+5yEA0xT7TzSIt1MaimTqtIHWJl33gJuDzaKE=; b=WP4AQqFhcAONq9CELMbcy4uUzKn/53oTtshmsg7OUMCxkg+dvFGBVfZ8Q2YquN9iGv L/OdKh/Zsrc42ZeytG2cJWeIfAR1kNmCSUvbCwPJMaM/D56SZFqFZhPzIednhw+02BHC PrlFEQlODCKczf0e7iQmpAIVIsQiV+cEkD9xbFAjWf1VOgzP7fc8G2caUE0OoPs70Ams LBThrqaXEYmQw+sXnrrPNlm5UvhSWoudPGm2OBUKuW7y2JzLMd76IYnv3cdRstLbqO6m lpxmBe62v6ZwpGw1wm+0ZGvYB03Lf6iyqoXZKWFwvyWyr1fDZ0XW0SmQHm3aGOt3ncB0 qh3A== X-Forwarded-Encrypted: i=1; AJvYcCV1QW3wJJc2SP+ydG1K/7xgrVKhxsztC8lzHxSauF7s+SAtGf+/Tq4C0XjVUqIsQqKTDVuv/LD6r2gb3fk/FXIr5nX+8ghjzbs+Cx+C X-Gm-Message-State: AOJu0YwekMepkt5OF1x3EfgfyzdPTOP8lhrnj46pNxoGeyB4O6gsE/cb oeL3gFC43fOWBVfa7E8v9ltoP8mU8/cA+YfPigt8KaKEAlWxH9pOGXPHFSaJ/GU= X-Received: by 2002:a17:906:2e82:b0:a68:379d:d623 with SMTP id a640c23a62f3a-a6cd7a84203mr640846366b.36.1718081525789; Mon, 10 Jun 2024 21:52:05 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.189]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f17561c3dsm286452366b.217.2024.06.10.21.52.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 21:52:05 -0700 (PDT) Message-ID: Date: Tue, 11 Jun 2024 07:52:03 +0300 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH/RFC 0/3] pmdomain: renesas: rmobile-sysc: Remove serial console handling Content-Language: en-US To: Geert Uytterhoeven , Ulf Hansson , Greg Kroah-Hartman , Jiri Slaby , "Rafael J . Wysocki" , Rob Herring , Saravana Kannan Cc: Claudiu Beznea , Peng Fan , linux-pm@vger.kernel.org, linux-serial@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: From: claudiu beznea In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi, Geert, On 27.05.2024 15:41, Geert Uytterhoeven wrote: > Hi all, > > Since commit a47cf07f60dcb02d ("serial: core: Call > device_set_awake_path() for console port"), the serial driver properly > handles the case where the serial console is part of the awake path, and > it looked like we could start removing special serial console handling > from PM Domain drivers like the R-Mobile SYSC PM Domain driver. > Unfortunately the devil is in the details, as usual... > > Earlycon relies on the serial port to be initialized by the firmware > and/or bootloader. Linux is not aware of any hardware dependencies that > must be met to keep the port working, and thus cannot guarantee they > stay met, until the full serial driver takes over. > > E.g. all unused clocks and unused PM Domains are disabled in a late > initcall. As this happens after the full serial driver has taken over, > the serial port's clock and/or PM Domain are no longer deemed unused, > and this is typically not a problem. > > However, if the serial port's clock or PM Domain is shared with another > device, and that other device is runtime-suspended before the full > serial driver has probed, the serial port's clock and/or PM Domain will > be disabled inadvertently. Any subsequent serial console output will > cause a crash or system lock-up. E.g. on R/SH-Mobile SoCs, the serial > ports share their PM Domain with several other I/O devices. After the > use of pwm (Armadillo-800-EVA) or i2c (KZM-A9-GT) during early boot, > before the full serial driver takes over, the PM Domain containing the > early serial port is powered down, causing a lock-up when booted with > "earlycon". > > This RFC patch series aims to provide a mechanism for handling this, and > to fix it for the PM Domain case: > 1. The first patch provides a mechanism to let the clock and/or PM > Domain subsystem or drivers handle this, by exporting the clock and > PM Domain dependencies for the serial port, as available in the > system's device tree, > 2. The second patch introduces a new flag to handle a PM domain that > must be kept powered-on during early boot, and by setting this flag > if the PM Domain contains the serial console (originally I handled > this inside rmobile-sysc, but it turned out to be easy to > generalize this to other platforms in the core PM Domain code). > 3. The third patch removes the no longer needed special console > handling from the R-Mobile SYSC PM Domain driver. > > I did not fix the similar clock issue, as it is more complex (there can > be multiple clocks, and each clock provider can have its own value of > #clock-cells), and I do not need it for Renesas ARM platforms. > > This has been tested on the APE6-EVM, Armadillo-800-EVA, and KZM-A9-GT > development boards, with and without earlycon, including s2ram with and > without no_console_suspend. > > Notes: > - This should not be needed on RZ/G3S, where each serial port device > has its own PM Domain, For the record, I've tested this series on RZ/G3S. All good with it. If any, you can add my: Tested-by: Claudiu Beznea Thank you, Claudiu Beznea > - drivers/clk/imx/clk.c and drivers/pmdomain/imx/scu-pd.c have special > handling for the of_stdout device, but is probably not affected, as > each serial port seems to share its PM Domain only with the serial > port's clock controller. > > Thanks for your comments! > > Geert Uytterhoeven (3): > earlycon: Export clock and PM Domain info from FDT > pmdomain: core: Avoid earlycon power-down > pmdomain: renesas: rmobile-sysc: Remove serial console handling > > drivers/pmdomain/core.c | 24 ++++++++++++++++-- > drivers/pmdomain/renesas/rmobile-sysc.c | 33 +------------------------ > drivers/tty/serial/earlycon.c | 14 ++++++++++- > include/linux/pm_domain.h | 4 +++ > include/linux/serial_core.h | 10 ++++++++ > 5 files changed, 50 insertions(+), 35 deletions(-) >