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: 13729329 Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) (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 84010192B65 for ; Wed, 10 Jul 2024 13:29:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720618159; cv=none; b=kRAPRrDA+I1Yp/a+fUNPFpfbO9PPium42MhcuC5f1Qg5fGlsi+2uLVcf2RwHatC1UT0q3pPxNcoA+YURWrYVwlmNrX/CnghZofy0cTViLNzbrbYBZT8/1K7Rxm0Eh/KQ1fkJ8H8L19cp98YkNLk0NhPChx2y2GoAHgoen74yFsU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720618159; c=relaxed/simple; bh=AKISzd5iyKCiNSgNN74C2eS4DaC2iGHXlNn55yMvsmk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TBdhWUUREJPOJlbuzldFU0/fK5n/iCzEVRWqyQlhYtP0tFSQRWKH14dSZlq4ui+WqCWZ2kbSiJNYKmIsktT+ftif9qaFZLTkOXllFXlofDU+G6EhspRi1JI6BYQniVrfbwN2iJx7AX6PIZqyFF5WzEWwXCRhbgUt63WFo4N+3aw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=nkf3JSeH; arc=none smtp.client-ip=209.85.208.53 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nkf3JSeH" Received: by mail-ed1-f53.google.com with SMTP id 4fb4d7f45d1cf-5854ac817afso7690654a12.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=vger.kernel.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=nkf3JSeH1I1DFNFUTre5FkhoyHn9SKxwZE3oKyo0JM60ZJ7/YHLH1E5osfOmgB/LEC TB4DwIk63lTcnaFa/52dIU0mi/R8FpLyKNaD1vpYwVdrXOA7zHHH9qji+Phxoes3eRct N+xARu4+dS4LzV9VwEzrHcp5OEZInxpDaKM57cYhUS/cgZh7SRjh30gII4BOqMiCgqJq W/MOa+SGO5kWxLGQKvnOo9WIW2cgqLWex1j4UTUPWXeQAVwbNdMErXVGZGUnUnyxEXSW 0fJlTM8i4S9z1tKCpue9Psh4T3xzIpGZM1hB3vv8llcMn0cA0lAJlSN8IA0GAM7b7FDw EyPw== 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=uzpG5Iob//wfHtaZSngYCEJ3PxluGXL4SD8WM0NXV2DQeMp0yAD/VGFjUJZJOv13VX t91WDOWzx5eJHkZtL2kYDwXgDHDCfDxuSz0VkbGNcsFxKVT8T1mLACws++fy0xZJrvlT Kn5N3O5/VOHdsFJ1jFylYuDD6J5igPfKnTtimQyV7vxcG72vzL0SogQRE4hA2jU/Dnt1 fDXr8VN8xy6YbC4eckvdF4JKt4p40VztXJpxYyZBo0WAya9oNG5g4zMRw0go42Vo5JRs L5LKLaLuUcs2Ob64Ibg6yUIHnplLBKP++l014RYWqCcSuqKi7pBxC7mwKtTyOVSolaLd n1Bg== X-Forwarded-Encrypted: i=1; AJvYcCUwKDtRw7tneN9rogbxkvKrh7+QGn8qT7NH7/FH68hIEaNWYGacUDVl6Ijx00dOh3iBmQgeY+p9B/QbDnmPDZM3FAgbyTsWgJqYn9bmWtI0uNY= X-Gm-Message-State: AOJu0Ywe3KKgKp2J3nXi7zUfC1d3gJ6cKOWaK4cM4aubZFtjTBcQbj3S BeqDqb2RSDXg4JoafcWUHux9ta0GKA7euzZSuFct/LdUkoSFwVhzmHbEcDkqrMo= 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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: 13729330 Received: from mail-ed1-f54.google.com (mail-ed1-f54.google.com [209.85.208.54]) (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 3533A193063 for ; Wed, 10 Jul 2024 13:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720618160; cv=none; b=hhwfJ9qcAikRSRJvu//4LEAR/ddGwaarradW1GOA0+djUo5gXqsR3hSPxFfWVD7uTJe6BBM8OdOiiWVD/7SqBwxIPF5nKo1Pv8yWIUN+gsqZnLBka95dZNl8EdOV1IzFCppNLe7sNBQqQq21BruBh3HzUzVOKWAUboAGxCpKZtk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720618160; c=relaxed/simple; bh=AwciVWBN6o5FqHKJ5LPF4pXKyx3wKFnc8wjZffp2tFk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O831WxcjAB6LjaEGjjsGySTHB7uyZF/qdmVSP+ooteaI/Wdxf5BPJ2ciHfd8zIrjN58QhbAUu6wEO0oCjFILxwN9JsRgbqqQ1dvTK5LXgW2EpQuotDtNx301AFBuaadbsBghC3fKf8WLqdO5hAtTbKpcp2aWEeyvLnezr+b85hQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=l8eIPKS1; arc=none smtp.client-ip=209.85.208.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="l8eIPKS1" Received: by mail-ed1-f54.google.com with SMTP id 4fb4d7f45d1cf-585e774fd3dso8274976a12.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=vger.kernel.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=l8eIPKS1i8Pdf5MeXmKBdw1LgaZiExhpyNpbFL1SJs/RTH+H3DdMh5/VqI8OydKt08 9l+eNDz5tYRD0RkAPpoTkltbgNSzwRjgWHQkwMr5+vlpHvxMg1xlKdPPokwNKtuWRq98 X5kTJPZqw4dIUjWKEosen+HadEkaJUy7QAOnIiyoG6LRIKmXw8a574DkMaijNiMsnm6F QP62FxP0PzWSp3ikCp3/TS8PyE43nsCihhHDbQNgnpxfncJ+CLQaUC3usW0ONmLgy37u 4uMGvyrkCO1G/Zbk+s6OqpbNYMLDtvIj1nO98aFAC7fkpHmsjo4PwUBpsrQ3AvPsQYxl BrUA== 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=AAvjEX75AZlUGDYAKosy+SAkgQDVmKWMD40uemvAQgjWoZH6kbyNaPhHw6kt66W/gX 2qu2Tv09RikUQi4TL55TF4qX1szIE4pcrlXmjT4bArsxkc+4EC5sK2O2lGiJlhi+B24N jhd2uNYk6h68hKfqQiA47OVmtEEoCY/wcZeLkmHtkXRLYbF4q47pu6OGZm6tjGQs0z7V tvpR9euaUjc5urN7PHD4Btwh4oNQe2j2crhK1DfC/Gd1kdxB9aa3RnE+ESmhj0UvoBRy rbx/3ws2IgJ6O4BoErPay3RExcye2D01pqGAiqlVeegXgBwvwzAXU48P/SEhlhaHMRqa KQbQ== X-Forwarded-Encrypted: i=1; AJvYcCV2ZHf7pRdYAPs6prkknOKD8bfNwYqK1CAoT2dOOpsvnBSB6KeXZxWw5jLUhjguV7F6wu5qqkUhWskRQV+00UOK93FWz0FphRrKu7dsnn9ChiE= X-Gm-Message-State: AOJu0YwIn7FsKP8PD7hpvMgDaAphjZZ9FWVrT1lBIi83O9f6R5ISilhv uRHbtXizhPwO2MEepr1Nu6yeXXifyK2fIcFhK2l0jLs9vbU4AhDSOUt0enK+uDM= 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 Precedence: bulk X-Mailing-List: linux-samsung-soc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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,