Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp520896ybt; Fri, 26 Jun 2020 05:19:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJziE4VxTT0hxj/bfbdkLV5dQHN5fAyVluOCuf6Yq9qWXeEU1yK6YiqMNdPmAaUhRcMW+qIc X-Received: by 2002:a17:906:6686:: with SMTP id z6mr2244660ejo.258.1593173999309; Fri, 26 Jun 2020 05:19:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1593173999; cv=pass; d=google.com; s=arc-20160816; b=aDm3mPu6yExrfa4iab20fP/WySfsq6L4SqFLgCKqhQ2sTH6W4NVTNu9oPeDQkBMrt7 Gecxc0dCzJKxCtXvuecmv+p50ETcU3fwekpoJHVJ/Ai/zdaS6Vwk80hYUCTObcpzrzgw NxKn70uXNBQmaAN+UxApQCWNbvLIgpFWIc8DRTwUREp0FE/fGfLlHIojEdzGNoAcUsvn lXVMMdaTIhXP2RXdSa8fFo1MVerh7Stbd0wv+oFN2cClB0ZB6fDUBWGsXm3w52KPXn8W 5Uj6aNHkVW+L2xQqiw5rtDY+HCjxRcWgZUrWt0mLp2BHQNIMzqxZnQ1+3ty0e+O4y5Dd 2ucQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=B0F7mIbZslTotpvzQxELAO/e4JCXtaEtUXdUu+vYoyg=; b=mken7FouCXAg1ejbVJECA8i28LjOlBwBMfBJ6uwxa4a8np/F46u3ddjgzIAl7o6IG0 Sc+g+FNULU+858c0aBiGQeFyiXmENjXgs9RY7G0KDXYZgz7R5/Csijd0xmnhN/vB+qjp nm9CmJW3v2VwStStU3GkXmKhnc5rRmnU/Pnl7GIL4xrVU9K6VYehHWhQPgOybFXIzgIh gVshbfidE9FrG2mhaVUSxINXmWxU4KSHEj9q7wAtLiuXR3v/of+5Z+tjEI3nJp7Vs2h5 MYR1MnUit/hca9GX/A2SonE5Zpbrj1CaNFYQUr742W/plFrYrRo7YNtHdA7YgiSOxSCJ UkMQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=N4DXkoXk; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq3si859656edb.486.2020.06.26.05.19.35; Fri, 26 Jun 2020 05:19:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=N4DXkoXk; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728461AbgFZL0Q (ORCPT + 99 others); Fri, 26 Jun 2020 07:26:16 -0400 Received: from mail-eopbgr00081.outbound.protection.outlook.com ([40.107.0.81]:51685 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728381AbgFZL0P (ORCPT ); Fri, 26 Jun 2020 07:26:15 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HKwCxU/1woeI+MCy3hQ36El6ByV6bWEdO+HHwo3D7S7t6i7JYygH9OrOuXo0dIgSTggdUtjCrQmYg6Qz4eYSdsBJ0uj2lVoFsG/DIilP7c1HojIXSELeA4A+zSCEA0gDKy9ugS+M54i0+XoL+1yOmk5/tDWJSXXvOyUiP6QeYyAZLCuZ1CmnqP1zIYp+FDPbo9vfcKlma2aq8S8z1U2/wWLITEK32RFINkSiX8jptGlW6yCXFwE88Crg6JNDHXoAyj6IAsV7jHo4Y8Q+6yFJLoKhmpCOjqAa6kLdcKY3DPeogMB6zb+AAthppJ2ZOsliFFpWkLW1BVLjQMxTv+rqTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B0F7mIbZslTotpvzQxELAO/e4JCXtaEtUXdUu+vYoyg=; b=OWcwUrfDk848yBl4fBUNGWb0cyD6ICmuSsCiBj01CsdrR6gooNeWjsEirrzMlmXjiJjX3NRymmrG0OkcMfk0QVFwVpb43fXMY3Ud+QFLsLkbta+V/B3YUmMTYz7vPRGHFPl2jRVh+HCgpAb1soOe5m0BHjSPxejyvV2NJA4ZjbIIM8VVb3ftJpPp1AfWT+axgx78LRnCQe/PVqbcNoNNxVyGZ5XQy6gw0vRWf4KKbyOMUGcP9nua2x7ECIJkbXRGVf434C7shGlBpb2LbelUrYesHtV1P8TWPVb2n3bNUn23pXgxvVL+zOLlgd0bOvYfC4EU4TNY64V9S3+vCGvd4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=B0F7mIbZslTotpvzQxELAO/e4JCXtaEtUXdUu+vYoyg=; b=N4DXkoXkJ4Y5G7uh6zzkNc4SMLyOTtOoOh6ko48ENUIAgOQ5rdSIuS2x1h2hBMc3S30sxIiQviv3V+/UPg1y8fHJUlFmL9SM+3UHdr/+yAbfAUtkVwSHKRe5R4Xr/D7k1sBkimcqB5KghK695DgP1H4KTWqVWCAHXeUEmMBncPo= Authentication-Results: linuxfoundation.org; dkim=none (message not signed) header.d=none;linuxfoundation.org; dmarc=none action=none header.from=oss.nxp.com; Received: from VI1PR04MB4800.eurprd04.prod.outlook.com (2603:10a6:803:5a::12) by VI1PR0402MB3919.eurprd04.prod.outlook.com (2603:10a6:803:22::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3131.21; Fri, 26 Jun 2020 11:26:10 +0000 Received: from VI1PR04MB4800.eurprd04.prod.outlook.com ([fe80::1c58:aed8:bd10:6c9e]) by VI1PR04MB4800.eurprd04.prod.outlook.com ([fe80::1c58:aed8:bd10:6c9e%3]) with mapi id 15.20.3131.021; Fri, 26 Jun 2020 11:26:10 +0000 From: Vabhav Sharma To: gregkh@linuxfoundation.org, jslaby@suse.com, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Cc: v.sethi@nxp.com, Vabhav Sharma Subject: [PATCH v2] tty: serial: fsl_lpuart: minimum baud rate support Date: Fri, 26 Jun 2020 16:50:34 +0530 Message-Id: <1593170434-13524-1-git-send-email-vabhav.sharma@oss.nxp.com> X-Mailer: git-send-email 1.9.1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SG2PR06CA0220.apcprd06.prod.outlook.com (2603:1096:4:68::28) To VI1PR04MB4800.eurprd04.prod.outlook.com (2603:10a6:803:5a::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from uefi-OptiPlex-790.ap.freescale.net (92.120.0.71) by SG2PR06CA0220.apcprd06.prod.outlook.com (2603:1096:4:68::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3109.23 via Frontend Transport; Fri, 26 Jun 2020 11:26:08 +0000 X-Mailer: git-send-email 1.9.1 X-Originating-IP: [92.120.0.71] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: a2ea0ad5-963e-4dcf-11b9-08d819c3ba16 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3919: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 0446F0FCE1 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 64cyEayee3Fnnykd/Ammn6H0f27sKLusTewBtnjDgVoZVEkuT5jeoL0TYkdm1cx+CUJYoCgQkgRe/GvYlesI2xeSgI9Ir4oJYoK4AvygaLIRzfGkZWljpT+wrZKx0LVzkC++R7gPI6W+TUXoFysULJi4WnhoF/4qrveKY9AbcVfKMUnE0O+bEBHeszlvXe4VDnygkwqhRtAqgynUfNNr5JlURQjak6XuU1zycHPRJy/5mdi6ijgzz8PCPYVCMi0x1mSYDynGOnU8hd6ZbElss/+DIiCh1xRWkwxH4MaM7fvrNW4u1bqkpO7IAQGS0WZc X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB4800.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(366004)(396003)(346002)(376002)(39860400002)(4744005)(83380400001)(316002)(5660300002)(66476007)(16526019)(186003)(86362001)(26005)(66946007)(6512007)(66556008)(2906002)(8676002)(6486002)(478600001)(6506007)(8936002)(52116002)(956004)(44832011)(2616005)(4326008)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: upLKRB/a3Sl9t1Ue/M+ml/K2q7RuGXRx1mxbDP4t6G4ldVmZBbTH+2eU5asaU5qml+Hg07JzSBvD1CNSyU3+Pqa4OpshW4y/f1B3zJqCENNAkpB0ez2hSd1NseYwgd7XHU8mNFN7lZPMRw9+uD86Ei73Hp8DQo0a6+RKxILfS1lOvIaA0e43PLTaB5o7HHQ1ZDldgMHAQ2VBNJIuN14cT7Od1JGQ9V9VRpHO0xqBevsm+hj7tGi9646uZvNwIXTDqhRKhhlv2jmyldu8h5+gNnnYnccy5tFeiSG6wQKEADoDb+lOEQYibSm+dAsxksUPIgX9TLaOS2eJqU1LrweTJ2Cps5yhJ9+GQ4RhiIswfYxiHsNVDXc5ZnJR5yqdqCLJmZTrsKRTNHyH5Tbo7TUhTEjtrzTBVBVyb3OlfaGSQU3wZte0N+JfIspdM0Rhxixp4EQUOSIbWvrITqetg+QqkrcuKFiMV2KdcCzJ68R2qHA= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2ea0ad5-963e-4dcf-11b9-08d819c3ba16 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB4800.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jun 2020 11:26:10.7069 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 66xXmHhZUAI/lvf0KmzDSolS0ajbhDcBPkvpfyLT3lzJ8NCf1EEt3UQRIWWPykrqeVwDuTk2WyEiECj2uXUn8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3919 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vabhav Sharma The formula for the baud rate is baud rate = "baud clock / ((OSR+1) × SBR) Algorithm used in function lpuart32_serial_setbrg() only changes the SBR. Even with maxmum value put in, OSR stays at 0x7 and the lowest baud rate would be ~ 2600 bps Update the algorithm to allow driver operation at 1200,2400 or 600 bps Signed-off-by: Vabhav Sharma --- V2: - Incorporated review comment from Greg --- drivers/tty/serial/fsl_lpuart.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index 90298c4..7ca6422 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -1925,6 +1925,9 @@ static void __lpuart32_serial_setbrg(struct uart_port *port, tmp_sbr++; } + if (tmp_sbr > UARTBAUD_SBR_MASK) + continue; + if (tmp_diff <= baud_diff) { baud_diff = tmp_diff; osr = tmp_osr; -- 2.7.4