From patchwork Wed Jul 10 13:29:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13729318 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 B9FC6C3DA42 for ; Wed, 10 Jul 2024 13:29:47 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sXpfd2wmtmBO96JF5yDlmVCc6EbK2CgZGn/Nuo/rMog=; b=TGnpK/OmQ7/7ioWNFCwlPsFoZM +0IY/MpgNtas3CFb07dsK/1A1qw1+0Cxot1TReP9c1V8fWWFvTwjpq+WFLrH5eKFll43fzPSgGs/a jcMUrVB7Nz//acE69feFWatUBk2mpwgrK3++KTAwPksvRrv+tBEaa2NWR/2uzk8p0eoF09qIiStlt yesZO92fus4zR+4LStHzLxnyQvwmHhItJdV5etCjswXh1bSQ4wyjZUzR0Bzc+fb2w9Jh6E4HTHa54 yLf9oTvolQCkLilDOgAJahmk0rQXlNGhMKMrwxaDJQxHAwFpp04cr+WFqbGmoIcGweHGuPVxORULz 9wC9nPLA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXO4-0000000AeEr-0p2q; Wed, 10 Jul 2024 13:29:36 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXNm-0000000Ae9P-0t5o for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 13:29:20 +0000 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-595712c49ebso2336022a12.0 for ; Wed, 10 Jul 2024 06:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720618156; x=1721222956; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sXpfd2wmtmBO96JF5yDlmVCc6EbK2CgZGn/Nuo/rMog=; b=i+qa2P1ZP63QxdaNCLZag3901BeFEaKkUJTPQBPWf36x244QA910mN9F/RhRJr0fM3 pciONbTaBKKhuR1XvQJb8iBKQWnLrhrFW4zM9kCCe+hGLyitA8aomgTDSH0Z1zNyRNOC 5UmBUhEs78akQ9DQ49985lpzRBzBDvmndEXjxIN7AMF05MvWoEDyQz29yleoAmFZfgiz w58qu7tSZkv/4LknL3zGPsYQVCGcLHFxTaJEjHRqH8Mumve3sEVK3r8XudO3DxeyEIpj txbv9vWeXaigi4hJCFFBB48rlJS2PKgPss3qvc07FlOWiZZBHwo0a2FuYcBdKoahSfY5 BYjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720618156; x=1721222956; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sXpfd2wmtmBO96JF5yDlmVCc6EbK2CgZGn/Nuo/rMog=; b=sNmxR2WKnLfmPFcPNt6KbWs8cArsuOr6W4jpc8kzzYFsRckfsIyhPos5zecRcvtjhd CrORUbXSs6ga10UGG3vziKnASJMRGzwbcCW5czHg0M4X3fDEK0KbLILIZVxtXBJIYxym ag80bd1aK4UGfQlZBNKgAqfFvh/LqWwbHoYKy/SIFvzHzQJP6dMtnYmVXgvJFWnlQLei hj/7dugAWvb+v9/5krXfAZQTF8SAaTMJGqxqwk15oSXfeox5TxT1WLfg/u3I0fbvnbnS +NZtxNvll+s+k7FThzS1EN3xWVgSoVARLByHdMnPSgOrPhq5VdCSAntH1+HRKl7Ws6Jz tfjA== X-Forwarded-Encrypted: i=1; AJvYcCWCkpv9s9puwq3pd/p8hmFOR8ifmOn9UdKCRoOU7CyrLgfVagZ8oaaSNaKjyjVz41QlfXyyBo0XWbvYGok1TJpyD1c6c6P1DgbLcvNq72sl2THdOxI= X-Gm-Message-State: AOJu0YxT1sPWe7wprri8Vqa7X9oBrOPxfBUI3ZgDS4qJcgjBPCZPK+um MhVWTUlFBQ0fBwl/FnMMawQxuvCZ1sEuId0pt9O+/EmIdqMBx01YL2isb5+OvVY= X-Google-Smtp-Source: AGHT+IFdiZRQ6U4xwH4ESlWOcT7tTqHneAgzJZJftzH/4QoiYntL7Tm+hCt6+4O1lTffIWQm0nWIMw== X-Received: by 2002:a05:6402:34c8:b0:595:7c14:18da with SMTP id 4fb4d7f45d1cf-5957c141933mr3328492a12.34.1720618155985; Wed, 10 Jul 2024 06:29:15 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bd45a162sm2204844a12.68.2024.07.10.06.29.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 06:29:15 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Wed, 10 Jul 2024 14:29:14 +0100 Subject: [PATCH v3 1/2] dt-bindings: serial: samsung: fix maxItems for gs101 & document earlycon requirements MIME-Version: 1.0 Message-Id: <20240710-gs101-non-essential-clocks-2-v3-1-5dcb8d040d1c@linaro.org> References: <20240710-gs101-non-essential-clocks-2-v3-0-5dcb8d040d1c@linaro.org> In-Reply-To: <20240710-gs101-non-essential-clocks-2-v3-0-5dcb8d040d1c@linaro.org> To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Griffin , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Sam Protsenko , Tudor Ambarus Cc: Will McVicker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, =?utf-8?q?An?= =?utf-8?q?dr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_062918_478620_63EEDB26 X-CRM114-Status: GOOD ( 13.73 ) 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 While gs101 needs exactly two clocks for the UART, the schema doesn't currently limit the maximum number to this and instead the default of five from this schema is applied. Update the schema accordingly. Also, as pointed out in [1] before, the hand-over between earlycon and serial console is fragile due to clocking issues, at least on Google Tensor gs101. Therefore, document the clocking requirements for earlycon in the description for posterity, so the information is not lost. Link: https://lore.kernel.org/all/d45de3b2bb6b48653842cf1f74e58889ed6783ae.camel@linaro.org/ [1] Signed-off-by: André Draszik --- Documentation/devicetree/bindings/serial/samsung_uart.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Documentation/devicetree/bindings/serial/samsung_uart.yaml b/Documentation/devicetree/bindings/serial/samsung_uart.yaml index 0f0131026911..2435c3d92158 100644 --- a/Documentation/devicetree/bindings/serial/samsung_uart.yaml +++ b/Documentation/devicetree/bindings/serial/samsung_uart.yaml @@ -145,6 +145,20 @@ allOf: - samsung,uart-fifosize properties: reg-io-width: false + clocks: + description: | + Note that for earlycon to work, the respective ipclk and pclk need + to be running! The bootloader normally leaves them enabled, but the + serial driver will start handling those clocks before the console + driver takes over from earlycon, breaking earlycon. If earlycon is + required, please revert the patch "clk: samsung: gs101: don't mark + non-essential (UART) clocks critical" locally first to mark them + CLK_IS_CRITICAL and avoid this problem. + maxItems: 2 + clock-names: + items: + - const: uart + - const: clk_uart_baud0 unevaluatedProperties: false From patchwork Wed Jul 10 13:29:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Draszik?= X-Patchwork-Id: 13729319 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 90BDCC3DA42 for ; Wed, 10 Jul 2024 13:30:04 +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:Cc:To:In-Reply-To:References :Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=B1ovYW2wp1YdZUcVm4+EsuNX58Iw+I3DZAQaUJWfuBU=; b=OIJtctHrWKt6UviNx54ZRGzfmb +Zui4LmCkWsZx+mhPgXAhzKVVrlA3B5cnK369UgzGnV0kuXWpygxs98LGPthCuTgsWQgJoB+uQ2Ag Vrj1UhItSWc6tiDrd5Xc977WVN/1wfpR5MgW9eKpR0Ke4oQP2wBMMXgMrW3gHUZGV7NouGsQZyfqI d2FXsbAVxzxBXDzPbuDnVwuQca1pokLS5bTX3i2WRRHjPpgyKxGj8aIqJ85y2fFlPSHvYc/nSBqDl xWj+MHu9Q0+wGzYAqp1RQ/ckl1pJogFGe/TFHZNZ2uHofSwpYXsRfvk/R+56asv48M/eXiuuzbCSy dqTd9j9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXOI-0000000AeLh-1607; Wed, 10 Jul 2024 13:29:50 +0000 Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRXNm-0000000Ae9d-39K5 for linux-arm-kernel@lists.infradead.org; Wed, 10 Jul 2024 13:29:20 +0000 Received: by mail-ed1-x533.google.com with SMTP id 4fb4d7f45d1cf-58ef19aa6c4so6991902a12.2 for ; Wed, 10 Jul 2024 06:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720618156; x=1721222956; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=B1ovYW2wp1YdZUcVm4+EsuNX58Iw+I3DZAQaUJWfuBU=; b=vXar3sBteNQGnZnRr8EBaiKDRxc49tAekSove1o05Pwgzpmvqbh/kkwdah6ixFOXuF BCOCl27b5hs+GTNal+jh2r8z+q1b2shbj+svPFXvUOiQE182fLjqiO7pax7TMo0Mmp6P vOe+FUxwKEZYt2Hc9QAEPdHNSMQPQs/v0I4CwvmD7e8QUkW5swG5rDea4tPXaZ9G/DhA rjcZyghm67ay/lXz4rjr5Io1JC26CfGegugq2ufqqHcRLAGH3yP5ok/slwxO6rb0NB84 zM+Bn3G86ia9UuE/RRr5FwxPam6d9EThjVyHkJwXWdGAbJmqqtcxt6jiNDw5NLzrT09y E5ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720618156; x=1721222956; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=B1ovYW2wp1YdZUcVm4+EsuNX58Iw+I3DZAQaUJWfuBU=; b=DeFVNIJJ6+Ytd7/pbxJi+Z1YTzuPe1MMpfCTNuvkSi7KBa2wj/5y6mrDU3caXjiR8d B3oyv4iymVcnrUVgf5zJGMNbgD75TBKTkBY58hGz6+qCmm6Y0l4/PZaJA1bHWBO2W0xw q6XNRcanxuWAC1DHDdZWNf75g9/939tD3xxahTOb0g4M+PDSOYQavTkqDaor3X7gBlMM vmcRzKnws7Yzxdbe9hf7mCWZgDb9nLvN89d/Bdw+jiYfxEEOYg+K7yDHkL+lESFjajtN P/HJd8+bWWxKM4zBngPPAQXSndOVK7I89EBaBOPouHfNz7zWkPC4msl9UphbQA35s7S1 KMLw== X-Forwarded-Encrypted: i=1; AJvYcCVOCAF2tTNPad5a6pqFBmywbgHKKxTHhjjlhSkip0Sd9bLgwTOzoyLrkg2RoykOqEZde77CgR0E700LVswD5qkl0ogPI6wLiC2bJMA7vNym3vm0nZQ= X-Gm-Message-State: AOJu0YxjT3a4+WOiwBps8RlVV88w5OoUfy8zehwk7x6t7lkYY39tlhLw yXEwJbxXzyd3EQ5kPzSamRwLIrvSrz2O2m5jBlBZfNyVW4RXmCb/2AJMxRAe8lw= X-Google-Smtp-Source: AGHT+IH0wfyOVdRhcW2jRiu8H4odPRc9NSHsemNyYVnlGxE+R2CgMqKnHWhRuSXSeVw2EKEQKgf1Pw== X-Received: by 2002:a05:6402:31e6:b0:58c:804a:6ee2 with SMTP id 4fb4d7f45d1cf-594bb56ea1cmr3092624a12.20.1720618156425; Wed, 10 Jul 2024 06:29:16 -0700 (PDT) Received: from puffmais.c.googlers.com (8.239.204.35.bc.googleusercontent.com. [35.204.239.8]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-594bd45a162sm2204844a12.68.2024.07.10.06.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jul 2024 06:29:16 -0700 (PDT) From: =?utf-8?q?Andr=C3=A9_Draszik?= Date: Wed, 10 Jul 2024 14:29:15 +0100 Subject: [PATCH v3 2/2] clk: samsung: gs101: don't mark non-essential (UART) clocks critical MIME-Version: 1.0 Message-Id: <20240710-gs101-non-essential-clocks-2-v3-2-5dcb8d040d1c@linaro.org> References: <20240710-gs101-non-essential-clocks-2-v3-0-5dcb8d040d1c@linaro.org> In-Reply-To: <20240710-gs101-non-essential-clocks-2-v3-0-5dcb8d040d1c@linaro.org> To: Greg Kroah-Hartman , Jiri Slaby , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Peter Griffin , Sylwester Nawrocki , Chanwoo Choi , Alim Akhtar , Michael Turquette , Stephen Boyd , Sam Protsenko , Tudor Ambarus Cc: Will McVicker , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org, =?utf-8?q?An?= =?utf-8?q?dr=C3=A9_Draszik?= X-Mailer: b4 0.13.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240710_062918_843811_8A9A8E5C X-CRM114-Status: GOOD ( 17.46 ) 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 The peric0_top1_ipclk_0 and peric0_top1_pclk_0 are the clocks going to peric0/uart_usi, with pclk being the bus clock. Without pclk running, any bus access will hang. Unfortunately, in commit d97b6c902a40 ("arm64: dts: exynos: gs101: update USI UART to use peric0 clocks") the gs101 DT ended up specifying an incorrect pclk in the respective node and instead the two clocks here were marked as critical. Since then, the DT has been updated to use the correct clock in commit 21e4e8807bfc ("arm64: dts: exynos: gs101: use correct clocks for usi_uart") and the driver here should be corrected and the work-around removed. Note that this commit has the side-effect of 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 * hand-over between earlycon and serial driver appears to be fragile and clocks get enabled and disabled a few times, which also causes register access to hang while earlycon is still active (A wordier explanation can also be found in [1]) Nonetheless we shouldn't keep these clocks running unconditionally just for earlycon. Clocks should be disabled where possible. If earlycon is required in the future, e.g. for debug, this commit can simply be reverted (locally!). Link: https://lore.kernel.org/all/d45de3b2bb6b48653842cf1f74e58889ed6783ae.camel@linaro.org/ [1] Fixes: 893f133a040b ("clk: samsung: gs101: add support for cmu_peric0") Signed-off-by: André Draszik Reviewed-by: Tudor Ambarus Reviewed-by: Sam Protsenko --- v3: - add git commit SHA1s (Krzysztof) - add link to wordier description of earlycon issue v2: - commit message typo fixed - collect Reviewed-by: tags --- drivers/clk/samsung/clk-gs101.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/clk/samsung/clk-gs101.c b/drivers/clk/samsung/clk-gs101.c index 85098c61c15e..9769c00b6ca8 100644 --- a/drivers/clk/samsung/clk-gs101.c +++ b/drivers/clk/samsung/clk-gs101.c @@ -3946,20 +3946,18 @@ static const struct samsung_gate_clock peric0_gate_clks[] __initconst = { "gout_peric0_peric0_top0_pclk_9", "mout_peric0_bus_user", CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP0_IPCLKPORT_PCLK_9, 21, 0, 0), - /* Disabling this clock makes the system hang. Mark the clock as critical. */ GATE(CLK_GOUT_PERIC0_PERIC0_TOP1_IPCLK_0, "gout_peric0_peric0_top1_ipclk_0", "dout_peric0_usi0_uart", CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP1_IPCLKPORT_IPCLK_0, - 21, CLK_IS_CRITICAL, 0), + 21, 0, 0), GATE(CLK_GOUT_PERIC0_PERIC0_TOP1_IPCLK_2, "gout_peric0_peric0_top1_ipclk_2", "dout_peric0_usi14_usi", CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP1_IPCLKPORT_IPCLK_2, 21, CLK_SET_RATE_PARENT, 0), - /* Disabling this clock makes the system hang. Mark the clock as critical. */ GATE(CLK_GOUT_PERIC0_PERIC0_TOP1_PCLK_0, "gout_peric0_peric0_top1_pclk_0", "mout_peric0_bus_user", CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP1_IPCLKPORT_PCLK_0, - 21, CLK_IS_CRITICAL, 0), + 21, 0, 0), GATE(CLK_GOUT_PERIC0_PERIC0_TOP1_PCLK_2, "gout_peric0_peric0_top1_pclk_2", "mout_peric0_bus_user", CLK_CON_GAT_GOUT_BLK_PERIC0_UID_PERIC0_TOP1_IPCLKPORT_PCLK_2,