From nobody Sat Feb 7 18:20:31 2026 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) (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 41EC4748F for ; Sun, 1 Feb 2026 04:37:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769920668; cv=none; b=J9+cECbqiufnELnA1MF6c1fTG5VJb3/avfbIov0G8nYIUav07UGwLZlZ8xqRMC1f203hCAhWTAbPWOdkRyIypuKurCn/0UVGx3mgmm70+ydWzwkE/RSMkKzgDcl0e6esWQbEjcV5WmdszkLRGdeBy6MDdOuJlqatdTaZduUSlCc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769920668; c=relaxed/simple; bh=l75NC+dMGo52Z/lqI8Tklxzk49YVO9S4uo0C8MSPvQQ=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Z9BvbjpFoGZiS3E2oqDhS/kV5EjYmAkEN5ANHgYakl3Zg0RRYkX0tgk/jp4sxXfgUyyhL/s/jTO1MY4paJ1Mxga3F8KyJVntEOagPynqKsngm77LmZq9/qIJ/8jDuLJrtY8HSAnSEcAK60tPY1vVVJ/7UFklRF9g4unJbrqt4Us= 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=Ss/8O/Cm; arc=none smtp.client-ip=209.85.215.177 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="Ss/8O/Cm" Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-c629a31d1d0so328995a12.1 for ; Sat, 31 Jan 2026 20:37:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769920666; x=1770525466; 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=Lro5M12HN28kueqyuSddo9Mm5/79VAOOVxaIFPHYvAw=; b=Ss/8O/Cmp5+nwNJAeFMNuG3jtzWaCOxQNn5v5+GZeGPwA/GP/3B1KkTaZSvUE2zQTw 6qQ5h8oDJtm68KdcgIGwilbMcUu+lMwCEZBhvQIQscsR5vzHC2Jbkh1tGjqVJZJDs+qN bipVo0dP/34UKHx0NkHjnqcHQNydpuN0DPwZWUSnNYYbcfRPrbEKfj5JJsLUoOGCbYpP g0xFOMr8D9h3fdTd7K+4jOOsZsvmAQyuxvwh6B9LGlbFZaxrcQxi886WuQKom+VmVhJE oRv6vv5OyYPa1qt+QyALzJmmdLZr8St9uJsueu2PxjoViJmQoW4WukuEFCTFZfgtTCiT b1cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769920666; x=1770525466; 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=Lro5M12HN28kueqyuSddo9Mm5/79VAOOVxaIFPHYvAw=; b=qryopJLi51aEk4a/jwc6kdCLVoNfOwOjhVAbZFa5EjZMHw3SeCXSTxkvhYrr0k6pPl JMxMVZrRLypM2h1pYbBAw/P1zfGCQLuJ981ZLEeZs4jRAkn2tiVpphjn6uiokQi/Ru4+ kGyxP8CYOswRJtQIevFyWrkWSj+1FqiKki9Au9TeC/R+eFs7YGW9PHuCqaATo4wipj7Y roVeEep5QFeq0KYq616JFcfSuOXtdrk3TAnh+pHhSJiERuE0K3cMS73mPQ/QOB22cb5I vcrDjOypaudtMjOafNNUY9H3/FzojUlqkBW5rs/sHgzEx30fVtlitJnOuRUmSBEFTmsL KBfQ== X-Forwarded-Encrypted: i=1; AJvYcCVBJESHZpI+9rgANJ7zQ5dtTfjgKaPquiNucM0IiA6f0twLT6bU5URqA6pjzT8PhMccfScXigAW8bpKR2g=@vger.kernel.org X-Gm-Message-State: AOJu0YxwVdvE6Cn2xv5tUnmussdw6ypbLY1Flbd/r4O5oUf1q0xPalXx LU4e0Hgueyj6XK2Tb/SIoIs+ijdq2pOgT6t7QoKSfqV0Oq2Cqton83uE X-Gm-Gg: AZuq6aK9ojFDX4By0qeX75CnEhV4WIa4jcmEI/iJnvAYz35h2OaRsLpRF8pmFiEqfCY sftFeOAIyePyNcDXbqfPcHm9azvZLEx59Gr6gdBiUH9RYURAViFzszAcMdrIIr2SN3XpBcgrsLO mtZVsEtKRRrcXWOpAxJX/Bp665KlvlM2RoVEKXvvBl3Q4Zp1O5JG2pBHr1dDrkeV9SDiGbMSYRD pPVkYy1XysO8iJnhqvZIMdvZMeKn83CSz6wp0OMkYBolWSIv/V3JoSVg8xaRjKmrFiuNOddYdQt t7yL3lVQDOfS0uM83YbmNknHX7OK6BVvcuGoVUZnbmXsscnC/uIgXY/KEPwifXQjkpSybsiiUd6 TliOjq1jblZe+WiYBGz3N9f5P/nPTgkdu04zwMAP2Q5MyV4poKmQM+f+856ryvb4rlK/ZudtYxq sjcKr9Ywr6XzkfuqwzC43ydClfcvlu4TVOiAnAFO+uiAkXU9TiVqvmotGlh/f8NA== X-Received: by 2002:a05:6a00:bd02:b0:81f:e791:ea3d with SMTP id d2e1a72fcca58-823ab42ec6emr5920465b3a.0.1769920666442; Sat, 31 Jan 2026 20:37:46 -0800 (PST) Received: from syu-OptiPlex-3010.lan ([2001:569:5a4c:2100:4f8c:995d:2e16:10c7]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379bfcaadsm13229401b3a.37.2026.01.31.20.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jan 2026 20:37:46 -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] serial: 8250: add CONFIG_SERIAL_8250_PROBE_BAUD option Date: Sat, 31 Jan 2026 20:36:14 -0800 Message-ID: <20260201043615.524435-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 --- 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