From nobody Fri Dec 19 09:51:55 2025 Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (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 DE09320FA90 for ; Fri, 11 Apr 2025 15:44:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386269; cv=none; b=Gv6PEh4r5XZdSfuqJPPUyYGl/IjnYmERwCWB/rXpB1NITLAXvPgkBwuQLVXnwoyfSD09MyrLNaJdpYr7v06KzzesPGCGg0B50SapwdObDhnEflvto3xR6tnT7L4nN4UQ47blEu/wL1alHcSTKQEQqce3EnWuo+ynWuFOpympUCY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386269; c=relaxed/simple; bh=7ZoS0xY5agHPaulRb3cD8XGDbf5Uto+nLhFfKAqokok=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oNBcDsfg9mf3k+fOllMw+cZR1jrMmYe6+UEireYqoxILpbwMyttrci5zuYDQQ42WGxnSn+Ti6cpEgOd4EdAuNnS2xqXneiWMbdDI8CCu7n5BCzd275XC06eHQDMbyYtrJQoPBwhzpICYYyxdFtWs91Vr7wmi0Po8VLCaBNfuRYA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=A69/LT6O; arc=none smtp.client-ip=209.85.166.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="A69/LT6O" Received: by mail-io1-f52.google.com with SMTP id ca18e2360f4ac-86142446f3fso54612939f.2 for ; Fri, 11 Apr 2025 08:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744386266; x=1744991066; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lNEtTIi2VK5ry0lwico5I+3DkBAdLoSFhiEvmP3qbmk=; b=A69/LT6OOQYLw6YgRDIh8Ai1DI8+jzG2Hc/PYn/2+PWrr2HKTGOp2dvELDPepwMkAD G0KT/qMjkHc4SINyIzbxdG7KVNGP2at4C+E3tllBE9xpASKBknB02KI9kXbEd9SikXcF 3xvLvIZlsgbn80AQgpf/4OJIWLobGbfoFDQru8DkSPe/Gegn3hlhL8wGicZhEXzpfS+P ZGCWOkzmEIHiZ2oGJpRjCx3jot1UnyKERe13Ls6XUUVWrwpb0hgLkChOq5hsU17eW9H2 imEc9t3nHytqu2oI7j7O+JS3u2moAoh7NFlslq8EUgylGz70ell9EVs+8GCaZDpL99RP uoEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744386266; x=1744991066; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lNEtTIi2VK5ry0lwico5I+3DkBAdLoSFhiEvmP3qbmk=; b=Y8GcjCXxk43EiYlkHhQYAW5+0rHcsKCRzxmbxiS8+Kx3G2q7SQHbukLJM/jVEX+0hA IAkSvJSqWvbz4snPvdoqUvhCOS8KjyEtQp38j0IAUabEiLyPG8yrmWEUOqvqq9Pk9AP4 afiNGhnRV+nQzdUwHm4LjcpDOwYjwKxAgSz4oSup83MXtYD5Qd3q5bF9H6SCyxy8q7WH HSoHDSpjLaoCaYC7XXXi/0kxUcDYs0rXbg99xPEA8kTUaMOQT62dADDv/4O16D74xfOx bo0tb+BJxHjvSi5vmjsRxFxZDDTTkQcAifauai3MuUnw/E7TnpaPV7eDec/K7LD2XSSt B3Lg== X-Forwarded-Encrypted: i=1; AJvYcCVHll5X96OEFHSs+CyhRYTI42CFE9tU9JLuDxCDbBILBrWBo2mlFYFg0i14GKaJ9gIDsLUbST0cTrDH0a0=@vger.kernel.org X-Gm-Message-State: AOJu0YwDlT9nMmZXuCJqkgL0w0378EZQqQQr9VOGcd5iv2FJ6tsPXMAQ gjGnYsBSDFIBABuQIEq9XlNgM7doxxDfVLXtjwQ//DBa6U1EZbRo/bxYPk80yAI= X-Gm-Gg: ASbGncuQ3xJ4WuJ01vqWNNzYf9W0GmsQGTH8ML2QRXq4EyQoMzD0hycN0i4WL/klRoF qDIV7Uh40OB6IxIvfWviRp2DyyfVOsATs0nyTbio55MDXqf5LHdpStY8XG3MS16A9Y1isd6H+wP pWBjkoIhPIf2RhE/RSGlhP4kuOfIbBvx7hVPlNRCUk3xuYLVvZavMX8R5MJVCa/94OLpQJ3ZkxI LwfypQjGMpuSdoUZuU8+o8BD901DEnrCjkXz9bsp8WPuEgmgqiiJvYjyFAJqEeg0qHgDhAoiU+o DZF1r5+pocW0rm6PcCupHV/mZbaOpleOVESSVbaPFp/bcnyGrVDjinN3RwoDWYsss89ou4QYzua ofsW0VMcfYDWySQ== X-Google-Smtp-Source: AGHT+IHmZJkLUp0ElYixFb0pqy12kzxcoZbzdEnj5SOiajP/nfCU4MY0cVdJxZEZG4e9zsnEIRAxIQ== X-Received: by 2002:a05:6602:3789:b0:85e:2eba:20ad with SMTP id ca18e2360f4ac-8617cb4660cmr336071839f.2.1744386265918; Fri, 11 Apr 2025 08:44:25 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f505cf812dsm1276326173.18.2025.04.11.08.44.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:44:25 -0700 (PDT) From: Alex Elder To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: dlan@gentoo.org, benjamin.larsson@genexis.eu, bastien.curutchet@bootlin.com, andriy.shevchenko@linux.intel.com, u.kleine-koenig@baylibre.com, lkundrak@v3.sk, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 1/3] dt-bindings: serial: 8250: support an optional second clock Date: Fri, 11 Apr 2025 10:44:16 -0500 Message-ID: <20250411154419.1379529-2-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411154419.1379529-1-elder@riscstar.com> References: <20250411154419.1379529-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The SpacemiT UART driver requires a bus clock to be enabled in addition to the primary function clock. Add the option to specify two clocks for an 8250-compatible UART, named "core" and "bus". If both are needed, require them to be named. Signed-off-by: Alex Elder Reviewed-by: Rob Herring (Arm) --- v3: Added Rob's Reviewed-by tag .../devicetree/bindings/serial/8250.yaml | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/serial/8250.yaml b/Documenta= tion/devicetree/bindings/serial/8250.yaml index dc0d52920575f..33d2016b65090 100644 --- a/Documentation/devicetree/bindings/serial/8250.yaml +++ b/Documentation/devicetree/bindings/serial/8250.yaml @@ -135,7 +135,16 @@ properties: clock-frequency: true =20 clocks: - maxItems: 1 + minItems: 1 + items: + - description: The core function clock + - description: An optional bus clock + + clock-names: + minItems: 1 + items: + - const: core + - const: bus =20 resets: maxItems: 1 @@ -224,6 +233,25 @@ required: - reg - interrupts =20 +if: + properties: + compatible: + contains: + const: spacemit,k1-uart +then: + required: [clock-names] + properties: + clocks: + minItems: 2 + clock-names: + minItems: 2 +else: + properties: + clocks: + maxItems: 1 + clock-names: + maxItems: 1 + unevaluatedProperties: false =20 examples: --=20 2.45.2 From nobody Fri Dec 19 09:51:55 2025 Received: from mail-il1-f173.google.com (mail-il1-f173.google.com [209.85.166.173]) (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 F3610213E7B for ; Fri, 11 Apr 2025 15:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386269; cv=none; b=pjFaoXwehPYKeAUW3VcRGuu9M8MrnSc4ZS4TLX0cVhib90PqY4HRIxNh5d9cvWerqGkQ//WGk75P9vzaxgI/0uu2sc+QB/JLYytEbPC4VRrZy1tyE4OD29Bk8CGp4u0K4nDvYuZoSlp86iECR7jqZ4npwDN/whwUJd3LDTvNSNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386269; c=relaxed/simple; bh=ucvbVh/yXALhRLORxO86EDtcUDjhXV2k7FhsHq1IhHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iPRb/y8sq5gGdnXi8IVLv7Mo5xNkXm1MKoiq8SjRvDR3N6KodGBaIw2AKlD2Ads2o2H/G9gaSk6sk/Pv5RyF850YWJelTBllh9LdczTFJvnTBqFOlmmKorqiaQdG1jG+6APz5YdGM+HbFe89y+eKbBS3c2JIDe3dkrC5g/+VFuE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=WEAWQd6A; arc=none smtp.client-ip=209.85.166.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="WEAWQd6A" Received: by mail-il1-f173.google.com with SMTP id e9e14a558f8ab-3d439f01698so10228455ab.1 for ; Fri, 11 Apr 2025 08:44:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744386267; x=1744991067; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=0+No0irtswkb42oZgjOuCr5NaquvvHMgg0F5193JRX8=; b=WEAWQd6AlZmwszqpr2FdMHOqU8RG330klxdCeKbWOQZ57QkTE7ddQSawMK/9di0qCb jrYKhLPt/GL7IkodueJqF7EEf1Ak9KJpVD5Su8U+O+xTx2dJs7HP86tt8SvhdFwQsRTx JjD3/Gjp/wSLWWIy81VlYvqLWYhSU2mrKBLz2Tn+86LmC+jXzHxjwBAoTa9RIjS8fGSj G/Wfzpvfvzo0GfVSPHOgNGHMPMtOwifcrzrh7jAoqwGBe+xGzu4LyvnPll0MIrd3+Dbd V7xHvmPqzW5zy8fhUhcy7Y0DfJkjuk9314SZ3oF2CItb9ZLYpo6WnKl0NuwY7WuEH2Ki sgAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744386267; x=1744991067; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0+No0irtswkb42oZgjOuCr5NaquvvHMgg0F5193JRX8=; b=ZzkvdzrRswMGGe0Lrxe4z9emTWybUl14qVedhh/MAvEJaB+UcwFTUtERSeMBTgL5JA RnY63koL9QLlc290gztyAVYDW2oKhxY5WTpp3e6i5nI2hWr4HK73AeaTN4+p09ebq3Qb faU+JhfQhDMzY7zGC1rhTPv+sY7u4x9D7YT3EGxjB9EEqUYr517JKK9KkArR1BmuLP7d UQ5ZbDdumJfZFPIHXywlgyZyitB3WQ9AytP18m9CHRLkxmzvOJZ4d58IbFnkI8YG1gCY WsQ0rZFkKYMaUEoqbsnjH0Pgv7wJRlgyA49kfP1c04bp5fLQPbiywFTz6GlUAJeAmqwh 40ag== X-Forwarded-Encrypted: i=1; AJvYcCU+KKMtQJxd+S8Pq7o2/g0sEMB4w3P+0HcSRRAsOskUJeA9RlsORLzRmIpQYDYB3DnVCQTRC3bAXRkveHI=@vger.kernel.org X-Gm-Message-State: AOJu0YwP1ORjbnDoLVEjeLGBXcQuXI1qquZE3oiabt2TYTcox73GRNz8 S6dXFkcqZdeGGseuxgifls7TLEK7ENwOFOThRYV9vKzrOK98nsHJ7RvQwL98H/s= X-Gm-Gg: ASbGncsf93yrqgiJozBLvX/eMNhc6/PS/iw7evEdIDtuP8tbL2kyIXjxD3RTDAHVinp hkMZNE3rrjdj+GS4L+EzrIWCwpHMuHrgIrOFaQpnBVhvSPPNDVUXoNMnhqPCvDXJt8JbmBX1103 IO1L326T020ZJ3znp+H3n4FZj7CUGW3V0dWlXDgl6vq2NC/JKhDl+LuP+/alAbaNYg2V9YPXWCf rVcFva/e4aD3AGZJMV97aKx2S6lZ6FGLFEWxKTTDdeIDySyptQlM11K+F6D2tAhy1YqBB84dseg QeL3wzh2QIewVIUitwZG2ySx4H+g25Jg7RLQ7om38wcOJgzFqZF7Py8MTMHTKHswj3gz0cIGkfE 82iqVCsIMnN418Q== X-Google-Smtp-Source: AGHT+IFHmGeALO9Wp+63MrFrWPOF/pQKiCJFNH3pXYWduOMBqvBFciOLd/8MEHS0nwfjD94ZFGolaQ== X-Received: by 2002:a92:1304:0:b0:3d3:d08d:d526 with SMTP id e9e14a558f8ab-3d7e4d0c549mr59399825ab.11.1744386267024; Fri, 11 Apr 2025 08:44:27 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f505cf812dsm1276326173.18.2025.04.11.08.44.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:44:26 -0700 (PDT) From: Alex Elder To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: dlan@gentoo.org, benjamin.larsson@genexis.eu, bastien.curutchet@bootlin.com, andriy.shevchenko@linux.intel.com, u.kleine-koenig@baylibre.com, lkundrak@v3.sk, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/3] serial: 8250_of: add support for an optional bus clock Date: Fri, 11 Apr 2025 10:44:17 -0500 Message-ID: <20250411154419.1379529-3-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411154419.1379529-1-elder@riscstar.com> References: <20250411154419.1379529-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The SpacemiT UART requires a bus clock to be enabled, in addition to it's "normal" core clock. Look up the optional bus clock by name, and if that's found, look up the core clock using the name "core". Supplying a bus clock is optional. If no bus clock is needed, the the first/only clock is used for the core clock. Signed-off-by: Alex Elder Reviewed-by: Andy Shevchenko --- drivers/tty/serial/8250/8250_of.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/82= 50_of.c index 11c860ea80f60..a90a5462aa72a 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -123,7 +123,16 @@ static int of_platform_serial_setup(struct platform_de= vice *ofdev, =20 /* Get clk rate through clk driver if present */ if (!port->uartclk) { - info->clk =3D devm_clk_get_enabled(dev, NULL); + struct clk *bus_clk; + + bus_clk =3D devm_clk_get_optional_enabled(dev, "bus"); + if (IS_ERR(bus_clk)) { + ret =3D dev_err_probe(dev, PTR_ERR(bus_clk), "failed to get bus clock\n= "); + goto err_pmruntime; + } + + /* If the bus clock is required, core clock must be named */ + info->clk =3D devm_clk_get_enabled(dev, bus_clk ? "core" : NULL); if (IS_ERR(info->clk)) { ret =3D dev_err_probe(dev, PTR_ERR(info->clk), "failed to get clock\n"); goto err_pmruntime; --=20 2.45.2 From nobody Fri Dec 19 09:51:55 2025 Received: from mail-io1-f47.google.com (mail-io1-f47.google.com [209.85.166.47]) (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 DB455213230 for ; Fri, 11 Apr 2025 15:44:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386270; cv=none; b=ryiyok+ICjFAr4RJ/SNTdmydJZDj38SB3yvG3MKBYgPCYbtqYm6Qf7+YhvbpPFjCQPI/hLcYaiAU2O1rNtXeK3yHL27VLB560U/RY+4MlDZX8kzVjNLPbjULq9hcIfPgkUQTdvJs1t7+hPldIXeXjYJNpnqS1x/AdLlJsmosBKM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744386270; c=relaxed/simple; bh=YTCOV5qFH6rsTE5f1V8QRlk7DYXjTy4SSao1Noq3mc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PewcPR6Gqzholf3kyaNnSM4v3QofT46e3QFt3BMeK9PY0OBJumm8XR9MlvfFJj/vZiBZeCinUC9YMcYZDelfvKX/YHBNrvXgamZBhmUagQBt0OzEO9I5cJuXRWeKd1Zln3eMjjYl/KgEh32WJmnTvJrX55nAz5EikhZQ1V3PN+s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com; spf=pass smtp.mailfrom=riscstar.com; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b=WLJFZxg1; arc=none smtp.client-ip=209.85.166.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=riscstar.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=riscstar.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=riscstar-com.20230601.gappssmtp.com header.i=@riscstar-com.20230601.gappssmtp.com header.b="WLJFZxg1" Received: by mail-io1-f47.google.com with SMTP id ca18e2360f4ac-85b3f92c8dfso70021239f.2 for ; Fri, 11 Apr 2025 08:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744386268; x=1744991068; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pIR6+1UCymjCvWnHm+vRVxN4kx6Kunaak/TDrneY48s=; b=WLJFZxg1QCCV0kk3mFo2+q7h+KNKBsioJ2xaTCj2vdLR0j3oZKGIlc2MUudSE58LM7 c1IYKHrD4iwv5/OT9YZzKrwnTZ4W1FgjhXaHcshWlUAzg08NHNE/EoKYW2woOxyIF3D1 CiEV4Bc8OIfla7LUFeHOkd+g83pDscilKcVoKR0j+4PJ90Ko4fx85QxzxA48mSN3GYlc JDYbeJ2G0a1bEzlwPwrI3WRVcet6mkDykoBEMkJgszxem8MQp3uHE61SOT2oS7vPVmQb 9EkMSnANAp7FHvXbm6tDbxMiEZF7DusrAktoeFvjDtyxN0dGwNpnfGIbvUL88C0EHCB5 F4kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744386268; x=1744991068; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pIR6+1UCymjCvWnHm+vRVxN4kx6Kunaak/TDrneY48s=; b=kVvqXt1yuFXc+7G7EkyhDMx0LZrk3aWDMSB+F9d3ly1YsrRvzCBJ3d1nx+C2BAtI1k jpLVM5JjF8xNJzMAsJAnKXYd2QRWSgeqNtZruwlqeZc72nefxdUZs5gwi9jPbkNo5q3u OY8zG1nm9ewRuhl9Q/CUFjP3rSsxMlDThNSXUTWu2ZUxM0nXI0ocOyYCGFTBYjYIftEl e27eTdygIZC/93LVwkH2XwqHSQ/eDNt0pXYoaV9CHiLJ1jID0HJmMTvGNbJYvbAzNvaN c1Jc/BSDW4itZDydP2Ods/Z/J5mnLsHFTMlkdVN66I9I/+OvVkQmOWnYGI8vV/l/72to oJYg== X-Forwarded-Encrypted: i=1; AJvYcCXJHDbWqZsGTJunXxKrqVrskWe7VerXVJ5VvtaaNHX8xitaasJ/zZKgwFRQn/cLvqf5Jwn9wDWsmdVWuBs=@vger.kernel.org X-Gm-Message-State: AOJu0Yzja+PhTmBJLEbqkx3+sGTYUv7EmAYMSB3fLp/1WIAq3Ve+uFZE O8x6WKjGP9s8USjI7bw9TI0IrRfdwa5CeZZPdv4gi4H0TOZ0flDhBB3VkEYsmd0= X-Gm-Gg: ASbGncu37Zys4EY7vh8F45aWyQmsRBoPW6F2+wDkfvus3GiygdEeO++3CTN/hxCBBFi OyNKFEVdyiRSpxq51Dt8h06DBNcnW0C5v+bgE1Zynt6A4XvvL8DOuGcXAfkEmNSvrz6qMThgytF tXGWQJUAYCfARaA/pX4uSIHsqxS/LavXFfo0Wqr1GpLTua1OQjOh5v+uKKftYc0i5zknglOX0kL EWev6Clb3AhOvoV555Qp+HXBhtargTkAGzoeJl5gyeTR0vd+f1lhw6qpeVFyzthemyiYDB5Bf3W xbDqq1qmxASDEQmmHj4sJR2lY91yDH8tq81tQSNYgTutpjDlyOw+q1FD1fsnHqlSkcXbt6/yX0X ZlqdOt7gR6CYh5Q== X-Google-Smtp-Source: AGHT+IGFDCID2V9OQ58DdGxUCrdRPix2Sm9SOyZ970XE5klNUQUYc7yCAtoOB8Vh9getD8RZI/2TFA== X-Received: by 2002:a05:6e02:3601:b0:3d4:3d8c:d5b4 with SMTP id e9e14a558f8ab-3d7ec207fdbmr28814495ab.11.1744386268085; Fri, 11 Apr 2025 08:44:28 -0700 (PDT) Received: from localhost.localdomain (c-73-228-159-35.hsd1.mn.comcast.net. [73.228.159.35]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f505cf812dsm1276326173.18.2025.04.11.08.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 08:44:27 -0700 (PDT) From: Alex Elder To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: dlan@gentoo.org, benjamin.larsson@genexis.eu, bastien.curutchet@bootlin.com, andriy.shevchenko@linux.intel.com, u.kleine-koenig@baylibre.com, lkundrak@v3.sk, devicetree@vger.kernel.org, linux-serial@vger.kernel.org, spacemit@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/3] serial: 8250_of: manage bus clock in suspend/resume Date: Fri, 11 Apr 2025 10:44:18 -0500 Message-ID: <20250411154419.1379529-4-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411154419.1379529-1-elder@riscstar.com> References: <20250411154419.1379529-1-elder@riscstar.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Save the bus clock pointer in the of_serial_info structure, and use that to disable the bus clock on suspend and re-enable it on resume. Signed-off-by: Alex Elder --- v3: New patch, managing the bus clock during suspend and resume drivers/tty/serial/8250/8250_of.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/82= 50_of.c index a90a5462aa72a..8f2529f699e0a 100644 --- a/drivers/tty/serial/8250/8250_of.c +++ b/drivers/tty/serial/8250/8250_of.c @@ -24,6 +24,7 @@ =20 struct of_serial_info { struct clk *clk; + struct clk *bus_clk; struct reset_control *rst; int type; int line; @@ -123,16 +124,15 @@ static int of_platform_serial_setup(struct platform_d= evice *ofdev, =20 /* Get clk rate through clk driver if present */ if (!port->uartclk) { - struct clk *bus_clk; - - bus_clk =3D devm_clk_get_optional_enabled(dev, "bus"); - if (IS_ERR(bus_clk)) { - ret =3D dev_err_probe(dev, PTR_ERR(bus_clk), "failed to get bus clock\n= "); + info->bus_clk =3D devm_clk_get_optional_enabled(dev, "bus"); + if (IS_ERR(info->bus_clk)) { + ret =3D dev_err_probe(dev, PTR_ERR(info->bus_clk), + "failed to get bus clock\n"); goto err_pmruntime; } =20 /* If the bus clock is required, core clock must be named */ - info->clk =3D devm_clk_get_enabled(dev, bus_clk ? "core" : NULL); + info->clk =3D devm_clk_get_enabled(dev, info->bus_clk ? "core" : NULL); if (IS_ERR(info->clk)) { ret =3D dev_err_probe(dev, PTR_ERR(info->clk), "failed to get clock\n"); goto err_pmruntime; @@ -299,6 +299,7 @@ static int of_serial_suspend(struct device *dev) if (!uart_console(port) || console_suspend_enabled) { pm_runtime_put_sync(dev); clk_disable_unprepare(info->clk); + clk_disable_unprepare(info->bus_clk); } return 0; } @@ -311,6 +312,7 @@ static int of_serial_resume(struct device *dev) =20 if (!uart_console(port) || console_suspend_enabled) { pm_runtime_get_sync(dev); + clk_prepare_enable(info->bus_clk); clk_prepare_enable(info->clk); } =20 --=20 2.45.2