From patchwork Thu Nov 24 10:02:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 25418 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3300251wrr; Thu, 24 Nov 2022 02:08:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf4uxb+UCYxFui/OwP//5V1llJcLaSrGRm4OmkMm8LLQoNxtPhKm2+bxtJCbUR1ZFfhLhnCh X-Received: by 2002:a17:906:c18c:b0:7b2:8a6e:c569 with SMTP id g12-20020a170906c18c00b007b28a6ec569mr27317257ejz.582.1669284521448; Thu, 24 Nov 2022 02:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669284521; cv=none; d=google.com; s=arc-20160816; b=VjXLcty6zB/L+x3pWY6axuEbsCZwWUptTDFA3GJgWz6IG/PfiwmvGRIimTSVX/RJhd cANOo8G7FruUsskSMYz3ylc8dBwqAlxl8LK/OJ+bdPsBA0qyoDhckNhmQ4PBb1LyDhT+ kPy7DvaPY7vB4YAlpnSyHrHyYqpeymtDjmnYciu/uFD3ORF8Sav0bbrY+dyaHYrGSeUP Do+5tvJmRVY9lS4GPGBWC2owSRA01Ffy1dqsiz2fz2Ck1cbOQeAUR1zIRhR8I2W5S9Z2 1eVTwWUiFgEYQq2ynNTG4+tzmVlKen67CbTG1oBk646p2vprK19X2vGxDkVKrC7GwzZT NCxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=jSOZ36Rg8ZtCE7SCbEU2hjbnj/WgKpo2k18A2Q3f3HQzjODOBeEcPKL8S3TupIleio y8oui80tFZxVG4jP1r1K91GzE5Tp7jIDLy949K893XSmxyf/oC64vq1IoDhNfw0liuog RHNVTrNHt/MAMNyikyWynXM6ZE6Geb44L4eZuPnJMLrM3PSlS5c/1zRYM4HJFsStwKco ynunYznQ/i4lZBlwpiDweCl4KwZ0OQSHTC1/tuD8pTE2I/EIJ4zuj7a8Yar647yjqbmD yYE/CU3S0i/cXO7yU+n/dTyqpYWrA1rxg9CjLg10mOjHms1Wb3F32AAA0lY+V+R+BTDJ S0sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ecx7bTcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dr19-20020a170907721300b007ba9c182888si564706ejc.386.2022.11.24.02.08.17; Thu, 24 Nov 2022 02:08:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Ecx7bTcO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229967AbiKXKCv (ORCPT + 99 others); Thu, 24 Nov 2022 05:02:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbiKXKCq (ORCPT ); Thu, 24 Nov 2022 05:02:46 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58BBA2B605 for ; Thu, 24 Nov 2022 02:02:42 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id e13so1854273edj.7 for ; Thu, 24 Nov 2022 02:02:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=Ecx7bTcOSXvqqMzZgKieAhLzr4QI6sOZ0G5WhPbqjpli2YJygDJoBB1T3p9uSK20ZA /srPeIHVf8B9M2Eppw/ZGUAp/7t4jj0FPpOeY54uTDstfB80eZd9mpt8+DarOrGJz2W/ 0kwgmSOb/mTNsWZEnWN+T9WSly8I00SpZyltg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JpY3UV91PSJQHvgfwYlnFBFz1OoDDcdlR+QZ0N6B/hM=; b=RJxJwgxdOq4/8POOXMdzsQQWp1wcEBwrV2oydMmw4ENan8QKTdp0MZ4lcFtIBmJl3i NtHQT5USNvDnV/SEp+33EwewI4CyQ9vKClBoJnRxRmt5mxFXUUoGNrrwScbibNQn9sFB AAm3+4tRP3uxZaYDgBLan4zmDlZdtchrNfiGy/Ye45mKCJY79UuhnJN+FDDfJ/aDHcyN DrSjWkm4zGUSIND1pmQ3J44ygq0S+euzXT/JmppMkKv+tIltWUGqGcJ5OztBsWHQO2Ta X1YUgqKr26oDBCXt3umT/1OXfeCr2Bp+zBq5CoRwoTmDrM9v5wM017ytc4NtsTmlfVSr hYdw== X-Gm-Message-State: ANoB5pm9awqiQU4w3ktFG2kJ5hxUVyYYCtSsqc+KfkeAL/iQH7dkJRN6 qJvHf83PK4KMuCrpsiO4pNiAGTCOTKYajw== X-Received: by 2002:a05:6402:2421:b0:461:524f:a8f4 with SMTP id t33-20020a056402242100b00461524fa8f4mr28270833eda.260.1669284160934; Thu, 24 Nov 2022 02:02:40 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:2a85:84f4:13a1:b293]) by smtp.gmail.com with ESMTPSA id i29-20020a50d75d000000b0046a44b2b5e6sm335548edj.32.2022.11.24.02.02.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 02:02:40 -0800 (PST) From: Ricardo Ribalda Date: Thu, 24 Nov 2022 11:02:18 +0100 Subject: [PATCH v2 1/2] earlycon: Replace simple_strtoul with kstrtouint MIME-Version: 1.0 Message-Id: <20221123-serial-clk-v2-1-9c03ce8940d8@chromium.org> References: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> In-Reply-To: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> To: Greg Kroah-Hartman , Jiri Slaby , Jonathan Corbet Cc: Ricardo Ribalda , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1229; i=ribalda@chromium.org; h=from:subject:message-id; bh=BxupyuW9bNdLBDym2TmyvusXWxEqDYH/mW0kqKjxYbU=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjf0E3cz6hfTxPtG8dan4pVp0sHPvMZBTj4KHwf/E4 JrvN/HyJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY39BNwAKCRDRN9E+zzrEiDX9D/ 0TLkdFaNvc8KoF6EAzsYlDq3afSMn+zDYidrCvj3RXOx8empIqK7qgqXQFKeJR341BKHycrGMAHPr4 pl3cDfhOnKNZCm2M67PjNA/6heNjqNfnQVQf83fGx9FTgu4JX1QDaW7H7ESwOlAwrn5yZYCTIKyNY8 rBvWrVlzWp96Ad5s9mliNERtS1KSra9ejrhGSUDL75ngsJJcP3HgTpc8pkHxZT9poCT+pAR+R7cerG UvS+XP4XhTRkJMaN0QBIsnXR70HBBXss9VaJi3FzSJDfiKfHLTaAFFnjJuDLD/toqGhEUaCxFumX7J na2EYcIxuWjw9eGatEVm4+NVj2yxMRlRxAgbZn878IGtoj00gmQFYuR51lNqWhxCEa/KaedIq+7r3M I3momJlTlfvRnpFKDu872JUYuOWj2So5r3SQY4dO4RVJb7U4EREUmEEjML94oriCcP4F/8g8qD2Vbf MUWC95f5nu3H6leo/uaTaG7qme2CzlE9MXh2vecsnQeQAvSr+iMriRSh6txVBz/67EdohpG9+6NjVZ qJF+kHesFphNbQciwvCf1x0zlQJ6AKXCvLiPKwrATGsAEDORg3n5/Ad2s5cVe8gWLxvYqpmM9leoWy 94l/m+4+SjwWWzssZvf4ImOi2bzm+9YkOygrn4hkSzAi20clncDehiVaetkA== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750371686071976538?= X-GMAIL-MSGID: =?utf-8?q?1750371686071976538?= Baud rate is declared as unsigned integer. Use the right function. Signed-off-by: Ricardo Ribalda diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index a5f380584cda..5b73da9487b1 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -120,7 +120,9 @@ static int __init parse_options(struct earlycon_device *device, char *options) } if (options) { - device->baud = simple_strtoul(options, NULL, 0); + if (kstrtouint(options, 0, &device->baud) < 0) + pr_warn("[%s] unsupported earlycon baud rate option\n", + options); length = min(strcspn(options, " ") + 1, (size_t)(sizeof(device->options))); strscpy(device->options, options, length); @@ -303,7 +305,9 @@ int __init of_setup_earlycon(const struct earlycon_id *match, port->uartclk = be32_to_cpu(*val); if (options) { - early_console_dev.baud = simple_strtoul(options, NULL, 0); + if (kstrtouint(options, 0, &early_console_dev.baud) < 0) + pr_warn("[%s] unsupported earlycon baud rate options\n", + options); strscpy(early_console_dev.options, options, sizeof(early_console_dev.options)); } From patchwork Thu Nov 24 10:02:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 25419 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp3300250wrr; Thu, 24 Nov 2022 02:08:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf7XYi22wxRKL506AFjdRAMGpaGRbwpsgAgg+RFfjJEHH+Okrzkx5NQRSd9lbjDjp+GYf6q+ X-Received: by 2002:a63:5325:0:b0:470:6559:a538 with SMTP id h37-20020a635325000000b004706559a538mr10781107pgb.427.1669284521198; Thu, 24 Nov 2022 02:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669284521; cv=none; d=google.com; s=arc-20160816; b=MtX1W9NdIIphxmW2VB8iJyZIKG/u6rVbGHk+dV/98OaLb4QDkNxuy3Xk+CnneapMDh 0dofzXXszvPjK1CGVUIwP/zn3fyLznpJjQEQisP60F/2c8/Cm1QomWcF37wR3VMq7Bes 3zmVnqDpQXnVsbmtEmzwvxdC7xSDWWYqO+cNnbYt+qa7iLixILn8G9bTE0U37vyxwMx3 gqcwImxzLOO7LHZcxJcBW97x11gOikTZA7PwiEfwxJIJ+62nMNbffLhtS85+LTxKWZ06 tA8JXj7ZAjMd7peMEkJLYPyVnhWXji+KFjIbedr0nxoHPPO1SvniSGXcz/1uOd82BDft mbbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=+nO9Vy3fwrjuAAleBhHMp2gpM4FHmEXbBSGqIubhkXQ=; b=IcJjwRv87yJQmrqdOUN8ZDmtS1VHyZT9xLgo2CBMosjyYe2RBjusIXd8x0ybaGTml4 sJCGaIxUWp8c+fNo4pTVLBrmGPCNHZmwDAeLVew45WcCqLcOvdpI3js9on9xcsxCmn0+ MXlYwv+rNm2POWhUXvQgm7+EXkAeZ2mwcC8LFUZjuFFJ86VK8mcamdtLval2Ov8rftr/ Oq8kPa6lTR5dGKQ5i2W7rEVVMqJMGV4qZCO6PoH3zu4Zj/MA/SyAk4teGSAa3WnzApze FblfFfxO5QUoaJew/hEZzRkJ+N55b0TcMGRYCfNjzROlpU7bMK+07Og/FcXZtF4yJOp7 G9fQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IYiKyuG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x10-20020a170902ec8a00b00178431e112asi649612plg.449.2022.11.24.02.08.26; Thu, 24 Nov 2022 02:08:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="IYiKyuG/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230038AbiKXKCy (ORCPT + 99 others); Thu, 24 Nov 2022 05:02:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbiKXKCs (ORCPT ); Thu, 24 Nov 2022 05:02:48 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56CA71C121 for ; Thu, 24 Nov 2022 02:02:43 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id ud5so3049258ejc.4 for ; Thu, 24 Nov 2022 02:02:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+nO9Vy3fwrjuAAleBhHMp2gpM4FHmEXbBSGqIubhkXQ=; b=IYiKyuG/XZATFbUZnH36r+Oy0z+GIPoTPYSJhl1AcG/3XI8GGKbYm/CkEX7wg69WLN KQmtEWNDJ+7EfTvitoma90jso3B2cMp5eTGFUOZN3OHa0jsihBS1E6qcC9LZIeJL8HkD Pb3bUzqu5hvvKxpWsVuOku3ERM3WB82+Y6kLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+nO9Vy3fwrjuAAleBhHMp2gpM4FHmEXbBSGqIubhkXQ=; b=xrN9zIEU+Ev2dd6ihVXOtw9w/dOnRgjLjIz4UOgyF9aksaDpl0bO2LyGTcoIKNGceU 4u2z/cDr7lQ2wNGEfkg7ufhXQHvPquqiHFLO7dWUXEENhJJzWYd1j+VOiQfDLCViAnA6 pXzkrp31x2WPpPBu13djLWvS2kWf0RyqkSD9dn+0/b9Gzlf0Ft5ShOkugnXyLzkrDP3v UXHyVOM0nqIqGregAS1XGfFAA+keekM8n/T/Sgrj0MpzhcN66NV3p0BJMJkHAzlEexI5 l8ncJmgsecZwFMdE6Zer3nGeYp1UbONfyM6MgP2+NIhWc3vNiMxdgp4sXUbkdw6EC1Jw uuIw== X-Gm-Message-State: ANoB5pneTM+D9ttTdwCCmNFnEki5LBEKBrQoAt71zIhw9Wc8f2slzz8H 2JXQNKHkUMbmG07piLcsuvUt8Q== X-Received: by 2002:a17:907:80cd:b0:7bb:35b4:777d with SMTP id io13-20020a17090780cd00b007bb35b4777dmr1875336ejc.302.1669284161929; Thu, 24 Nov 2022 02:02:41 -0800 (PST) Received: from alco.roam.corp.google.com ([2620:0:1059:10:2a85:84f4:13a1:b293]) by smtp.gmail.com with ESMTPSA id i29-20020a50d75d000000b0046a44b2b5e6sm335548edj.32.2022.11.24.02.02.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 02:02:41 -0800 (PST) From: Ricardo Ribalda Date: Thu, 24 Nov 2022 11:02:19 +0100 Subject: [PATCH v2 2/2] earlycon: Let users set the clock frequency MIME-Version: 1.0 Message-Id: <20221123-serial-clk-v2-2-9c03ce8940d8@chromium.org> References: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> In-Reply-To: <20221123-serial-clk-v2-0-9c03ce8940d8@chromium.org> To: Greg Kroah-Hartman , Jiri Slaby , Jonathan Corbet Cc: Ricardo Ribalda , linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2648; i=ribalda@chromium.org; h=from:subject:message-id; bh=GlzxTbonDjobCDC3muIMtEy4z/d1wWcFQi0sGS7Ze3M=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjf0E4cqJyUa0NGKEMHf8aC+joQ7el/D694QZq89aQ 2GbUHESJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY39BOAAKCRDRN9E+zzrEiGEdEA Ch5v0zJ+TqOsTTaZUU7j93gNYqnfSYf7UJArX7kocRTbBKo6bFkTPHjR4fyqquZCXGjZI75ziQEiM3 f906Fnl0YiINUkMOEV1eDTg0x+w9wla37We0ngUYdiQDYV+Db1MPVdwW/B6afyhNE9DlTDCFeTVEuc F1E/eI8CkvNiZactTfcZ3roCljsU/8ZL+ywLFGaCqLZ+hhVYF5Bvizzda9vQ7yPcvc2JF8EGz8mzKj ODw3Vf5iapLOzTS3OqCdtFdkNf5anTryD2ul+saYiNYhPOAy9kQbB+zTuXMDT2M7nft0/sevTHvM/G rm8WtcANRFlk0REqhAXTAs1+fADq8g1FzqND4XwPAA8B37eA1LTnSJr4C999DuRYa9qVCsq4WQg+LR PcHdEe8rgW058ww4yYzD4VMhd9ekcmHqTgUwNam3sF1PvrSeprQ4p9AvtDw6QaVSr8A2vYewzuIXdR cpnLl1bh0Djy1M0IPwQ4vCJd9O0zu8COjRHCP63SCGjqRmJ500zTOwin6gOiJZ22tMedzP1gKWyQOw 3GInPSAPzvm0R3TESW8HwSZhvXXgfZr16WPXEkf1RwtZPhFRUqlNm8rwRUWBCkXGCUxE9pr7nc9JA/ O29slWnPzT2uTyA5behSWax26SouNwAHpOsyYv+oxv8Pc1NoKTaFbFXmISag== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750371662522889240?= X-GMAIL-MSGID: =?utf-8?q?1750371686028668948?= Some platforms, namely AMD Picasso, use non standard uart clocks (48M), witch makes it impossible to use with earlycon. Let the user select its own frequency. Signed-off-by: Ricardo Ribalda diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index a465d5242774..9efb6c3b0486 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -1182,10 +1182,10 @@ specified, the serial port must already be setup and configured. - uart[8250],io,[,options] - uart[8250],mmio,[,options] - uart[8250],mmio32,[,options] - uart[8250],mmio32be,[,options] + uart[8250],io,[,options[,uartclk]] + uart[8250],mmio,[,options[,uartclk]] + uart[8250],mmio32,[,options[,uartclk]] + uart[8250],mmio32be,[,options[,uartclk]] uart[8250],0x[,options] Start an early, polled-mode console on the 8250/16550 UART at the specified I/O port or MMIO address. @@ -1194,7 +1194,9 @@ If none of [io|mmio|mmio32|mmio32be], is assumed to be equivalent to 'mmio'. 'options' are specified in the same format described for "console=ttyS"; if - unspecified, the h/w is not initialized. + unspecified, the h/w is not initialized. 'uartclk' is + the uart clock frequency; if unspecified, it is set + to 'BASE_BAUD' * 16. pl011, pl011,mmio32, diff --git a/drivers/tty/serial/earlycon.c b/drivers/tty/serial/earlycon.c index 5b73da9487b1..2db92d36351b 100644 --- a/drivers/tty/serial/earlycon.c +++ b/drivers/tty/serial/earlycon.c @@ -120,9 +120,15 @@ static int __init parse_options(struct earlycon_device *device, char *options) } if (options) { + char *uartclk; + if (kstrtouint(options, 0, &device->baud) < 0) pr_warn("[%s] unsupported earlycon baud rate option\n", options); + uartclk = strchr(options, ','); + if (uartclk && kstrtouint(uartclk, 0, &port->uartclk) < 0) + pr_warn("[%s] unsupported earlycon uart clkrate option\n", + options); length = min(strcspn(options, " ") + 1, (size_t)(sizeof(device->options))); strscpy(device->options, options, length); @@ -141,7 +147,8 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match) buf = NULL; spin_lock_init(&port->lock); - port->uartclk = BASE_BAUD * 16; + if (!port->uartclk) + port->uartclk = BASE_BAUD * 16; if (port->mapbase) port->membase = earlycon_map(port->mapbase, 64);