From nobody Tue Feb 10 23:53:35 2026 Received: from mail-pg1-f176.google.com (mail-pg1-f176.google.com [209.85.215.176]) (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 2B0311A316E for ; Mon, 9 Feb 2026 04:26:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770611208; cv=none; b=F18T1fVCN1Vsfk7Aw5dja470k13UW/Mv3jOmB/nFFVwA7o0YNXViumdnMjUBH9KzCmNseVGNX6p3o7kvzkpwJ38BWv7yFZEVX2JemdYhRHFMbC56o9aOfJPlIw46zBTpV0xxi5EVpt+yJRiEIczfmaCUe2UE1ly4auwPBpKOzAI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770611208; c=relaxed/simple; bh=SC6iyuE9FLsBLZu+us/ZdLZdILZ1PUnLg1Iepn/JC4s=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=XubyB0VqP8h0q2wHS3XGLP2R1PC+9WGtIrs/RfmiapDTCdIycOv7hx0Lcao79se1Ddrfu8/rsA8fGHbr8kP/CedXLAukbY+R8s1hLHVSts3XV06q2yFDpRv9tcnJJJR5/+XhpyYX6ucKXL4s0ls2ly7DUYPlUWoinojp7XeFPKI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b/v6Cjt0; arc=none smtp.client-ip=209.85.215.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b/v6Cjt0" Received: by mail-pg1-f176.google.com with SMTP id 41be03b00d2f7-c03ea3b9603so256787a12.2 for ; Sun, 08 Feb 2026 20:26:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770611207; x=1771216007; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oHUEf2Ny35bmzTVEALeN5/xchQqozhm4kIjHReVSHME=; b=b/v6Cjt00ylc+JP3cBTBF5J3opi5HLJvMcRufGO2lCLxi1COyDbIIZ7KVplqCqHuoq ibgR5qnsr4dTGlJ9+SMYAKNI0CZABeu0x2xbMIiROgJEbfZiYuPttujxwLJVHOqLqIIY Gd6tFRPLIDPbbiig4w1ue6/4gjlZsRdEv2XZBeL8cuBLSVg6TQjixoDF+YXcuzue1Jy1 VTcW3saKzg1qpULAHkZ0e0zojB2ddT0Zul0GIp+BkIT/ULIHl2ih+iBVIPgnP7x4w+m2 I7gg9CdPOt/bpW8z8XjFsg0oqa4cdvhMDfonnKczq7xVgg7HM0SHlReJEnI4g0+ypJmz jLJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770611207; x=1771216007; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=oHUEf2Ny35bmzTVEALeN5/xchQqozhm4kIjHReVSHME=; b=G24u6HqaN3BCW4VNKmGmO9Wpq+TQwLAKWMM2Qd5DdNFg17Enez3v+pN7+QVwwKLZWR sxWa8asi9qgjmDggvAut25hFWETzX8nblraM4WMMeiA0dC6I+qbR6Zn4NkhLgh42pYOW P04fE0DQYXfiHCuBJ2EcaSNTEWt4LDO8K5muBPxl7grTBVMPJBXSR9whXyBZKPUORO4j lhtUzaEujfomo1zJ82uCOG3DmRGgKe+VkYg1m6qzSjKKfhCtynKWYV/F+x6YgLcCN6ok y+MfNMjJEVKpgd9Th7dVJIcCTloNarACCSn4hvimjMNoMmMlsqMBt+CI1IjfGnfI/ouo kJ7w== X-Forwarded-Encrypted: i=1; AJvYcCUMvVeU+CQGaSVS5jO87o0vbXsYEWXShSxcDA9BBiuwsGtxsMU3zGqqzu/q8BXN6Ja8aBWS1J3oQXvBtQU=@vger.kernel.org X-Gm-Message-State: AOJu0Yw2FNHp0xxSXZUutluHRe1Crzm++12s59oE1Din+kfOUMrRDYqZ VBFcVDh8/dsqGZXpXDUBgGv+zA0luVAhTOZxkyfC/sZVK1CZAgEa05cLGyjJwQ== X-Gm-Gg: AZuq6aK1uK2GoIk97CDolYhN5nosyrKauxrcf7K/gmEVj+tORnUIVE7dxg3PWFLpjHQ SPA1TYyUNClsazwdWwxyC2OtHgfQK2P4HGul6nIN2oFd5gHPGBaxZk6cr1+9vR/hvaSQI83ZA+y vm/GofT4ib4vH9r9ohjLkZDPXV/AhjwoMsfR/QMR8rVinuQ95cm7cdrXfozY2POELOr7mPboDHA KMtGw/yq9COJxlLRGqnr+aYdXDb4lYdPUEdIuTcCn29rWtgsHyBiyIMpoSaKf7Xm/Y9QWgJ5g7z jNwCgfp93XvJIoqwhmuZzwECrBOjXIYWSe7yZci7UUh4kNiFf45ylYeWO6LsYJZAa8A4ZaRDaj9 LHHXfudMsKFni8m4hWxE72dEqfBpmBuMKoz6FbCM256EVztxMYMAYgOD1yj1teQl5g93WebU62z lHB1DqtE+jFNIIKxcsG44CNhj9w5RDVwdHCELkZAHRwptjtsc6ouxhRde/O/S5BA== X-Received: by 2002:a17:902:f647:b0:2aa:df82:ed85 with SMTP id d9443c01a7336-2aadf82f18dmr25398495ad.1.1770611207391; Sun, 08 Feb 2026 20:26:47 -0800 (PST) Received: from syu-OptiPlex-3010.lan ([2001:569:5a4c:2100:5b00:32df:79d4:c0a0]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a9521ebf2asm93149375ad.75.2026.02.08.20.26.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Feb 2026 20:26:47 -0800 (PST) From: Sheng Yu To: gregkh@linuxfoundation.org Cc: jirislaby@kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Sheng Yu Subject: [PATCH v2] serial: 8250: add CONFIG_SERIAL_8250_PROBE_BAUD option Date: Sun, 8 Feb 2026 20:26:43 -0800 Message-ID: <20260209042643.565418-1-yushenglive@gmail.com> X-Mailer: git-send-email 2.51.0 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" Currently, the 8250 driver defaults to 9600 baud if no console options are provided via the command line. This can result in garbled output if the firmware or bootloader has already initialized the UART to a different speed. Introduce CONFIG_SERIAL_8250_PROBE_BAUD. When enabled, the driver will attempt to read the current baud rate from the hardware registers if no options are specified, rather than forcing the 9600 default. Signed-off-by: Sheng Yu --- v2: Removed empty line accidently added. drivers/tty/serial/8250/8250_core.c | 2 +- drivers/tty/serial/8250/8250_port.c | 5 ++++- drivers/tty/serial/8250/Kconfig | 12 ++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/= 8250_core.c index 0e81f78c6063..c11b19921a1f 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -427,7 +427,7 @@ static int univ8250_console_setup(struct console *co, c= har *options) /* link port to console */ uart_port_set_cons(port, co); =20 - retval =3D serial8250_console_setup(port, options, false); + retval =3D serial8250_console_setup(port, options, IS_ENABLED(CONFIG_SERI= AL_8250_PROBE_BAUD)); if (retval !=3D 0) uart_port_set_cons(port, NULL); return retval; diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 719faf92aa8a..5309b921e7b7 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -3399,8 +3399,11 @@ int serial8250_console_setup(struct uart_port *port,= char *options, bool probe) =20 if (options) uart_parse_options(options, &baud, &parity, &bits, &flow); - else if (probe) + else if (probe) { baud =3D probe_baud(port); + pr_info("console [%s%d] probed baud rate: %d\n", + port->cons->name, port->cons->index, baud); + } =20 ret =3D uart_set_options(port, port->cons, baud, parity, bits, flow); if (ret) diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kcon= fig index c488ff6f2865..bee6a82023d4 100644 --- a/drivers/tty/serial/8250/Kconfig +++ b/drivers/tty/serial/8250/Kconfig @@ -596,3 +596,15 @@ config SERIAL_OF_PLATFORM are probed through devicetree, including Open Firmware based PowerPC systems and embedded systems on architectures using the flattened device tree format. + +config SERIAL_8250_PROBE_BAUD + bool "Probe baud rate if console options are missing" + depends on SERIAL_8250 + help + If the "console=3D" command line parameter is missing options (e.g., + "console=3DttyS0" instead of "console=3DttyS0,115200n8"), this option + allows the kernel to probe the baud rate from hardware instead of + defaulting to 9600. + + If a baud rate is explicitly provided in the options, that value + is always respected. --=20 2.51.0