From nobody Thu Nov 13 16:28:16 2025 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4d6m0d08g7z6H66F; Thu, 13 Nov 2025 16:28:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d6m0c6M1xz3gcf; Thu, 13 Nov 2025 16:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763051296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qf0U+zxRiS896DtN5uTg7TIuCaXY9lDzJYG8qtuGCOg=; b=fr6KtD+YeN6q1SPod7eMiCXrKdOQfK4f8IGS9ejd2eFpgp6dQxmeiv1aXW2AYxNBWdsA65 cNqDX+vwBcKUCeFh4AZsQzOHLbSipA/WCIPVd/XJr6tnCW51gthVon/GN2S/dDdz2DE/hm bfqtLWaX3FtINNl2QwxFRAOSzm7vmx3JqcmwW2zoItI9ClIlJYsrDEIgeC/bKxhxCY6ToH c3nXqjJ0b5RhSCCTeNB6yo89vais39iyKR86ZydxV4mx7govuUVGFV1pmzjQujz04oIni2 LNLJiFNDtPNekF5WBPbRsDGRLGfgTBWVyXiUS2xMf0bmadZf7YO7BSEGQWh/ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1763051296; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qf0U+zxRiS896DtN5uTg7TIuCaXY9lDzJYG8qtuGCOg=; b=B0g1D1F+ojxrWFNFVaPKOrDGGLIOCy6dzENFStDFSuv698VJl1JMrcYaAVxnllswgNiXk3 C4KM0OH8WZN7o05YgmJtDkFG8Fo3qw9/Yrmln/p1aRJq0gAMi1WbXbZLCZt32UFy9KsYRb 3LXeWslsOh8jDPqUFZSxX0mEiuAKpm74pL7AV2PAExVLFYaxbTPWsSnvGt7nljEME11IF/ BjA4rvwBxY8guA06ycsPb2aDOUJLUwrOAl9/ZTKwKYsmVFE9Fp0HC61KgZs68SihExYyta X2hDCbUGCut+32tgRNNw9hP4+qX5XWTDvRqqvdY+8pvRVxFUgTyrz67zdI2woA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1763051296; a=rsa-sha256; cv=none; b=qtI6tYZLmv6VoGCA5bWYAgFldHf3f3YP/8ZAb/QCrBcxofJC4ITpncYNsZ4lBQ6QXktkg2 xqXmlPeS+BJjjeaFBtgGOxs72ncpU2ltwVwohhQDwFGMtQzgm83aWj1nKl/ItZyE1fVw7W RLanuDqz39AVUS/JP153UE7h0FCjkX0/VpsDu5JlzSVulg6YGSxn1kQhaqVIdzWWEZ41Y4 QktUlQjbb596buQG71rdsp+0sbAU4z2k5dNRAxJSf/PqXq+c1upKunhszOvgRpUcsjRrUp kLMvKqN9REWOMVBOL3T6npqLSqcMki72dv4Uv8uacSWSKB+o6buoiopw1OZdXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d6m0c5ncqzCL2; Thu, 13 Nov 2025 16:28:16 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5ADGSGD7053481; Thu, 13 Nov 2025 16:28:16 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5ADGSGJV053478; Thu, 13 Nov 2025 16:28:16 GMT (envelope-from git) Date: Thu, 13 Nov 2025 16:28:16 GMT Message-Id: <202511131628.5ADGSGJV053478@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: c03593716fb1 - stable/15 - uart: provide and use default rclk for JH7110 UART List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: c03593716fb13a776778993a83d6385497b373e8 Auto-Submitted: auto-generated The branch stable/15 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=c03593716fb13a776778993a83d6385497b373e8 commit c03593716fb13a776778993a83d6385497b373e8 Author: Mitchell Horne AuthorDate: 2025-10-14 18:02:40 +0000 Commit: Mitchell Horne CommitDate: 2025-11-13 16:24:48 +0000 uart: provide and use default rclk for JH7110 UART A regression in the u-boot-provided JH7110 device tree leaves the uart incorrectly configured. The issue arises when a baud rate is specified ('current-speed' property), but the rclk value is not ('clock-frequency'). Previous releases, e.g. v2025.04, provided both. The alternative way to retrieve this value is to query the parent clock, but our clk framework is not available during early console probing and configuration. In this instance, we end up defaulting to DEFAULT_RCLK in ns8250_init(), which is the wrong value. The relevant uart class (uart_snps) should provide a default rclk in its definition, but it does not. Add a new variant class with the correct default rclk of 24000000. Finally, uart_cpu_fdt_probe() needs to be updated to actually query this default value when it does not find a 'clock-frequency' property. This was simply missing; the ACPI uart bus behaves identically, see uart_acpi_probe(). PR: 289978 Reported by: rdunkle@smallcatbrain.com MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D53119 (cherry picked from commit 6de1c50e78a826abc08660e4c3ac10f1ddba9ba2) --- sys/dev/uart/uart_bus_fdt.c | 6 ++++++ sys/dev/uart/uart_dev_snps.c | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/sys/dev/uart/uart_bus_fdt.c b/sys/dev/uart/uart_bus_fdt.c index 431f2962adb2..e9a7e04e4e0c 100644 --- a/sys/dev/uart/uart_bus_fdt.c +++ b/sys/dev/uart/uart_bus_fdt.c @@ -238,6 +238,12 @@ uart_cpu_fdt_probe(struct uart_class **classp, bus_space_tag_t *bst, clk = 0; } + /* + * Grab the default rclk from the uart class. + */ + if (clk == 0) + clk = class->uc_rclk; + /* * Retrieve serial attributes. */ diff --git a/sys/dev/uart/uart_dev_snps.c b/sys/dev/uart/uart_dev_snps.c index 6067920e3c2a..0372a220282b 100644 --- a/sys/dev/uart/uart_dev_snps.c +++ b/sys/dev/uart/uart_dev_snps.c @@ -113,7 +113,17 @@ struct uart_class uart_snps_class = { .uc_rclk = 0, }; +struct uart_class uart_snps_jh7110_class = { + "snps", + snps_methods, + sizeof(struct snps_softc), + .uc_ops = &uart_ns8250_ops, + .uc_range = 8, + .uc_rclk = 24000000, +}; + static struct ofw_compat_data compat_data[] = { + { "starfive,jh7110-uart", (uintptr_t)&uart_snps_jh7110_class }, { "snps,dw-apb-uart", (uintptr_t)&uart_snps_class }, { "marvell,armada-38x-uart", (uintptr_t)&uart_snps_class }, { NULL, (uintptr_t)NULL }