From nobody Thu Dec 18 14:30:36 2025 Received: from mail-il1-f181.google.com (mail-il1-f181.google.com [209.85.166.181]) (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 28A01280CCD for ; Fri, 11 Apr 2025 20:38:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403917; cv=none; b=OS7HpIq+BzUjzxzYk6wC7RsiebMt8/qfptyW92aHHOXOxVfraWHj3lB7ehORn7XTRrCTMhpacEOEgmjXj6qyNX5aR13I+ZNKa+v38k3e5SqvgECMYXQoa65tJFciK9tAXYu3Z0hfeKtGwXxBuIqis/YGNcSWge8TPelGriRL92M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403917; c=relaxed/simple; bh=kgcUq4gxhAS41S/CjHcT1RY9hEDolidwVa0J5wWVKTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lO3SLX+VQtDN1IszSvxaeLMIsQhsz5f/u2OZP0LWvpuILxmuGuHruS4aqgXLwOFMbABHkzZO/oWO/BxETWd0wyXxLVvxvRYRFdxCGgG48xJfqBylVfrzx8YVFiYm8dZUhmVtpdsUBS2mjE5k5t3KtfvLcSlG5e2kA/+UdHtvWNE= 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=viIHxl+S; arc=none smtp.client-ip=209.85.166.181 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="viIHxl+S" Received: by mail-il1-f181.google.com with SMTP id e9e14a558f8ab-3d46ef71b6cso19676425ab.3 for ; Fri, 11 Apr 2025 13:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744403914; x=1745008714; 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=qT3eKW0OgVfu/zUbqU6ev7ARx/bWRnIm3eKXRAL5nSo=; b=viIHxl+SZtwF02PI5YsOlOCPiJ24FIfJ+pCJ9eeG8IufUMlxpmaSxPJiQbgFxRPgEc SdLo6tTgugssKSzDZYngYwASkRh+AmP6hVMEyiZ1yuJa9behcZHMPgkIXjc6VV7XkxT8 LACIvamGBwcRx+96p18EFkxPz89EZ74ME9by5wP/pqgEzt2Al1u6Np+etIEOfP8wvfqQ OhSlVfELR47ZCQyg3lwgGGsYI0TRpUxVrCvWp6VTzD2ZVieS+IZUEUJgVh7xH1rb3FXo b2JN/q7Glnazk4BfJus5CuHBo5etSWnbnHn+nYiaZNa+2qI3OPa2vCwGjuXRVwg+jTOk q4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744403914; x=1745008714; 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=qT3eKW0OgVfu/zUbqU6ev7ARx/bWRnIm3eKXRAL5nSo=; b=sUDqD02o0bU6ahP59Sg+Fqj0mOgFIaj+1KfVdH/Y7vlcTrIWVhIDtGwCrzTA0G46Wc 2L8Sy3h9exbbvZdMzzTDyXjyI6tuVBRMosvWADi8ayXMxOKWCtT1iIZZHmo4LZs3jL6u LeuYC/8dKnQcI7SJhtr9R97LyGt0C5m7IeppX8pjMQ4VBk14MUwdYbbADSUu23hpg/od fvHiXPlrqtMiTdW/8mi8BYiRvYzvuijyVverzxneVH4snu/LCQcN3/a+ftgbM2p5vYE+ tyXAKOGHYwZfdz4RuoLcDTbLWpvVRhIJBZUvOtnkeNW5PhY/3kIDAdfnQ57yz+gZHqIJ VBQg== X-Forwarded-Encrypted: i=1; AJvYcCVwJdvaf61ITmi69ZPJ+cBKhA/ie7K7iwCKJ9r+ATQ9VRA2iYZ8vYY28CzF2AcZLioO2xoFt9tEP9zlgNE=@vger.kernel.org X-Gm-Message-State: AOJu0YweRg3slnht1e0yLMtg3L7JUPT+QC9xzDKC4lP1gL7pwQcP/wRw h6+FmFBLemZrlLUaJP5w/9/6qfWKv1TGSPei20+nuFnYLcytel1oBOwG0LjUNRk= X-Gm-Gg: ASbGnctS9m3oedDHUE86FDbemghf+kldKBXpjNff1sYms5pjH0sCs7KSkOiAKFxyfM4 CUtwU6XQAC1prwUKe3wNN9fZebeoXTnfm+d0NImtvsfA6/uSFD1Z1SHLMF4yNIiPFzZYYq6qMhw RNMgjwBy6jbDRdAgmHz4xAc4lrPHEjpVGEL6dyIPKHbsxyNfPncfs5L2h4T0it+2VZNnLKMDu0A JhhmtOPeTL/aQDIAlIIKN2REoUH3fuSCpSMc/BRqOvnKO/Us2PZuqzGcy6Binq9kBL62WQI55WS tlRl+OlisjeUI9bkwxonZn32dv9EaXZQmlrFNFqRxP3M1fokLCWSpMmv+K40fmmsD3aB3zuKPG7 I/aG4FS8X0rc9XQ== X-Google-Smtp-Source: AGHT+IHNU+YtLYKKg9Rbak8AqmRKKNb3APAoh0D667oTnKj2dbdwTHDE6V53boBISDwawaoWJ0qvsQ== X-Received: by 2002:a05:6e02:23c9:b0:3d4:3556:741 with SMTP id e9e14a558f8ab-3d7ec26b630mr50230125ab.17.1744403914302; Fri, 11 Apr 2025 13:38:34 -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-4f505e2ea1esm1420787173.123.2025.04.11.13.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 13:38:34 -0700 (PDT) From: Alex Elder To: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: andy.shevchenko@gmail.com, 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 v4 1/3] dt-bindings: serial: 8250: support an optional second clock Date: Fri, 11 Apr 2025 15:38:25 -0500 Message-ID: <20250411203828.1491595-2-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411203828.1491595-1-elder@riscstar.com> References: <20250411203828.1491595-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) --- .../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 Thu Dec 18 14:30:36 2025 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 55A54284B29 for ; Fri, 11 Apr 2025 20:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403918; cv=none; b=TTW1WVqKWVazeD0ZoBAtK6dsWm+dXanDJXv4e5odbOV64x3Wf100jkaS94vNKZsAk9qx3IFNF07YYUcp32uejB9VVcZ2zmOCZBEzWR4wYwFYgNGbANRPpFM35fBlqQVIVOLV3WDFjO38oSkmZ2sYNxfwAnU1USq0UXpXVStVjws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403918; c=relaxed/simple; bh=ucvbVh/yXALhRLORxO86EDtcUDjhXV2k7FhsHq1IhHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D6DxdEMxAGv9HZN/zKnBq7RHKSqg6rXokmwbuX2/9aGqIocMgVyGpV7sIJwiMHkqiVD/tdxnHJ/A/2PwtXgr6F+LcUHfw9gys3KnjtlRR4MLs/Xc1s5dhQsKGZtIY90XQBadO3ZNoumKKBxQS+3ZrFkBcxklUKEGKioSltIELW4= 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=cXU48zgF; arc=none smtp.client-ip=209.85.166.43 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="cXU48zgF" Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-85e751cffbeso192037839f.0 for ; Fri, 11 Apr 2025 13:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744403915; x=1745008715; 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=cXU48zgFWzBRuyaJqPSQBeudmkNcwJzmyHVLUhiZ1tbYhSwFqkga+JDpmeJXgbUC2H 87zLgsjwR+fwg9W162QMDCtNdGoUEH+Pxle+gYmig2qUIIB2Cn7geZ7BQ0mV2ZA64L2x vCbBm95xcBs7zspdNi6IKGYCZcYnIfl5XDZ7Qq2oIEk7LhoRa5yb9jf0gTc6hz//hjXd 71Qw9mkDv5UaooqQTqSRRSOMozh3Ge+Kc+cnMkbmafAXgIx6PfThNUYbp3/+5Mbx2znY CQQc+0BipcYgqRWpY3otAuWEumHd8vigCbubJerkibN4+m7+Bd/4ILqqkGp3t3tcb83m sdFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744403915; x=1745008715; 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=RGWTQjCbcHWzKqGz9qGwAncSBk3qBhqXC6mCycqXIIuSh0/gywWtnS30WyMwsRvw2K kiEaMWTmE4kf3GL7rpc34Qon7d0mvCLZMAhU5ry/PBlk1Kh26BiydORLSNnhjMeMSxeH 5T1/OD8NXWf6FsscUuf6HXwEjJkkFtJ8GYzoO1DrQbuYH0t/QinKD8TjCQVXOjw8Qan/ LIFYZoDnqYO+xs/f1aTx53DTPVVEArvcbzwkbie+hwOigULhOnNWghihuPVZh4PHyez4 47AT0VtiWeIG/EdXQp0SGL1L/Mn6wYT28rY27z/CYSUYfd83XGSpQiBKUSb/WavJu9hr ecfQ== X-Forwarded-Encrypted: i=1; AJvYcCUSnXJVV1TRIf0YS2fAgDlN06EtozzvyVgkpbPzyY42ehUeQQW4nXPndvL1Rr9UfIG/dH1llo2i3MkE+fs=@vger.kernel.org X-Gm-Message-State: AOJu0YwFxHX1gnTH0p/uecpjIS3e3PTdieHOVwOG+T4bkpVtSM9glBMB bNewW/3BMd4eUHDg+bM2h7meLq9SMf19fX0okvjQoaHpIPMyeP3vruIBmsFqnj8= X-Gm-Gg: ASbGncsCsTWIwE5tNUZQYeU3F+TP8u9XuhGWJ884AcZbg9E1hZiMGpsv4HeGTjj5C41 nYkC+xWKX2BsknpVKYwz/6ybBeDowlqAmZFfqMtyDN1umSwpCdPV1PzG+sb2QybVnBRw47Smvpe Rcmi22ytg/DGxblpjVcrOqzHuKFFfTa0fRb02yIVAO0XEbaFmFE2D53o3OFVwx/UzLGV7P0rgyw 5OGiJGfyihpWllHJgGQExQNj/ZcCfvykkN8sbc+BVYP0ZAcbHy6p8ONz2tXxvQcjx/PhtD4Aw95 6JHWM5dPDGlJ4cH7nIQx13cmfLSwHF0cRxjRGu1gHvTampPGRufl5ewb58jtvToJDX2a0cZvwc5 leubdO8wJES8K9k1n+w9eM+W9 X-Google-Smtp-Source: AGHT+IFI78Dq0uhLXGQ3VPmWnhBpX7t1jvh+2+h32uhUwjru/tDqrj+isW0Bsi4fpyNX4H8KLkVFTA== X-Received: by 2002:a05:6e02:258d:b0:3d0:237e:c29c with SMTP id e9e14a558f8ab-3d7ec21bdfamr43241385ab.12.1744403915441; Fri, 11 Apr 2025 13:38:35 -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-4f505e2ea1esm1420787173.123.2025.04.11.13.38.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 13:38:35 -0700 (PDT) From: Alex Elder To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: andy.shevchenko@gmail.com, 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 v4 2/3] serial: 8250_of: add support for an optional bus clock Date: Fri, 11 Apr 2025 15:38:26 -0500 Message-ID: <20250411203828.1491595-3-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411203828.1491595-1-elder@riscstar.com> References: <20250411203828.1491595-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 --- 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 Thu Dec 18 14:30:36 2025 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) (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 5FDCD280CD9 for ; Fri, 11 Apr 2025 20:38:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403920; cv=none; b=N0vdqHXYJjO8eKkoP7HVSMRA1Lna/70OGz4yXQM19uvp0y7KfURdaQtKsxVaJ0fPovKdgcLE289klSu25lY6nTIcKA7FR+EcX82iCeCrNpNjfMWaVbzagfZh+5y2AWXztgPfyC87n4evPoznWaEFDY87aQd5es7HBFk2reKk3wc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744403920; c=relaxed/simple; bh=35gorawSDcrg8QbS+s+M/Qi8sq0tSP1dR9KzDN+4gxk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mlyDsiisVI4KlkDpZ4a0S8U3NOJ7imN9urhuUs3TGSv6ju1hGcOSDXFxnJ1falRNLX1BPn4jv53oYerPDFChnaOO+vQ4Jw1U8/DCZqBXo9kDmWb2t6hqVQEl/RO82TJrL5EvKr35qUtDl7F5TahZqKJk2ARIX+7mwGo6G2WGoNY= 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=eDwCSKKl; arc=none smtp.client-ip=209.85.166.43 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="eDwCSKKl" Received: by mail-io1-f43.google.com with SMTP id ca18e2360f4ac-85d9a87660fso205313439f.1 for ; Fri, 11 Apr 2025 13:38:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=riscstar-com.20230601.gappssmtp.com; s=20230601; t=1744403916; x=1745008716; 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=0009F5O9wljpHFhP0qBedRkQq+IjHXl/vgFyYcghGBI=; b=eDwCSKKl/5z8nIEBA/pV1BfH8SeYUk3ObUlKL4xujOgbaJRP9qho0RlaXicddqh+GQ 5vxEDS4ErnL5gXD957jHRgN8BP+Y4GqAWb2iAFYenhL4IO4nDSbHJqSMVvcBAzZFjROE fArPH4wS8xz/TZcU80V02Nrb7myqz+b2roQ1Na3HFIFwjC7NIzVc6S888rfccQWA7uI0 VNuHmmRemuUysfFQjq9TE7ebzWE+Ye9NO5pcWX7QbZD4WFNz2U1mBinx6Ti1UBqzZkzu sMQmKpTdzpkp1sjjv90/0iso8M4pDKn6I/+AjGJ+4yp4dJYKpqkfviz9gZK0TEjcOrRl L+ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744403916; x=1745008716; 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=0009F5O9wljpHFhP0qBedRkQq+IjHXl/vgFyYcghGBI=; b=UEuOK+gJIe303Q55exlhEWAU34zEW2+tNkHpZMblByxJV6DrynXhWBhk+kWQT5fBrh LZFXNnMdBoO3V4w7yRS/SSxfF43XQ88gkANiU9EFoLB8MZvaN8u3dxrPQhoQU3MiKoTc 3uW7jzzyGA3zdEowB1kSjQvf88aIcaVB5u6M+M/VK+V4EYwY1MnYzyvTM+miNRdr3Qmv 1wJkvkb6HvA7rge60KfG9xUfsG9qMzHvDvrwI5c5MGlLhWxgaLPnHvWMj5XTULs9/T6Z rGE+LLNmcLxYaFREYWGjfNShCG7o8LikUUqDYFa7CS4F20QdZ3r4xFQe1XyzaEY8+HVY V68A== X-Forwarded-Encrypted: i=1; AJvYcCUCNEwsXkG4uK0tMOic2iKAHWZAbN3tHcGPfk3bOrTupPkaR4fZh/C4VANtbDCBAF742OWE/H3LQoHLxk8=@vger.kernel.org X-Gm-Message-State: AOJu0YxYxFAToGW4nCFLL7sa9EtxlK/NRRQJgQE5Rw0lKha/LFkNoqt5 khX60dxXAD2v6gDN606BzbJPATAWJdcH6J9SSwd7msmdF+HnNpXmhCVxLEFuVWs= X-Gm-Gg: ASbGncsmOaWHBzmkO2ZF/oEeh4cADHkHj/kLiMjzWuvcWupTF4pt44efMXRGe9ko5xM I8daXpWy8F3RyptGv82xJ4GsWgvLLjUHs/7tkiEczrF8+U8b2y0z84a3gZ7MKGARPVUQ4hlrWFv k0fJ+1c9X4lEDndHMUMfLv+1jrCNZjCrt3guBn5mqGGCyobT/bis9BttaJ7q3eorHduAjtUmUOf EJF6kDMu7CXlJMbELd85A5XUDpDQCY90BHyUmdbkHvKzSJr/T4zD2cS+w6NXxKW5MpMniiabvcf 8dIuwc7RmWGS307CT8bDw3SrXLUKCs9eATNRC7fH4xOg5A79nxmkXp74dDh7V1dLSvLxnJR9jnH fCYtfr9XtfM6Dfg== X-Google-Smtp-Source: AGHT+IGqHP+A8bUdxXLeOSya2xG9dcuQXpXzTMzOhzOj4n3d6/OcbE382cLJQUug9NIF/T7vU4ELFw== X-Received: by 2002:a05:6602:4816:b0:85b:35ef:b1fb with SMTP id ca18e2360f4ac-8617cb63bb2mr542148039f.2.1744403916511; Fri, 11 Apr 2025 13:38:36 -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-4f505e2ea1esm1420787173.123.2025.04.11.13.38.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Apr 2025 13:38:36 -0700 (PDT) From: Alex Elder To: gregkh@linuxfoundation.org, jirislaby@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org Cc: andy.shevchenko@gmail.com, 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 v4 3/3] serial: 8250_of: manage bus clock in suspend/resume Date: Fri, 11 Apr 2025 15:38:27 -0500 Message-ID: <20250411203828.1491595-4-elder@riscstar.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20250411203828.1491595-1-elder@riscstar.com> References: <20250411203828.1491595-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 Reviewed-by: Andy Shevchenko Reviewed-by: Yixun Lan --- drivers/tty/serial/8250/8250_of.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/tty/serial/8250/8250_of.c b/drivers/tty/serial/8250/82= 50_of.c index a90a5462aa72a..d178b6c54ea18 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; @@ -138,6 +139,7 @@ static int of_platform_serial_setup(struct platform_dev= ice *ofdev, goto err_pmruntime; } =20 + info->bus_clk =3D bus_clk; port->uartclk =3D clk_get_rate(info->clk); } /* If current-speed was set, then try not to change it. */ @@ -299,6 +301,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 +314,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