Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1208534imm; Wed, 11 Jul 2018 20:11:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfbItANHbsrSp/UhOK/zP4RfAmd6lpEGmxnP3to54J+2Zu60f00ASjGKVClr/CTmexPfJbA X-Received: by 2002:a63:1d3:: with SMTP id 202-v6mr474756pgb.136.1531365091489; Wed, 11 Jul 2018 20:11:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531365091; cv=none; d=google.com; s=arc-20160816; b=jsc0jzwzNOtCeGe/UbtWB7G33ZaepK+n9/UHfLjNfAMkvjs31NMU9PraTleS1YiO0W pnGFZpnS5j8/O9+y9ec1Y1mn6GEVNquj1EcVIRZ7O/vCNJpo1VLzuSji+ZQszKvmdPZF wklHmbz67KSE/PpGFUxHgh0flMTWZ+Ce1HN1idAPbxu85ATCgXUkLKeJQDJqoK74Q5Ih w7x+AdlfEmEAwKsls0etMx6sUplz8qgwL2SlchPEbDE0pZo0NYNVxgKkCcgFnNJZYYX4 Eq0wOrCzcDPFMh66ae73GYdp+89zDhzY2vJWF8qIFvnH3vYSsQsqQUZl3bCvH08UpxRk nzbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:content-transfer-encoding:mime-version :message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=Mmfj1XqGgc3IHKaZrHgv5QQ8kUMOdf7cHrYWlV9+ZiA=; b=NHi6qTk2CiGWexX/+UGZjTz7YGRDn8kFw6Axui8UfY/s4FlHedH6RfVZKvUCW0OhlI ZnxHIA3dICkLAxNz+8Nev2C8vnY78T5bHGf0eFk6lumPIlp28r0KAPxpMsUnpy3zMLW8 1IHjpt41XWpeM/tjTzMXWj/aooC0ihhdKlqBk2AU1bPDWhtli4UZWTD0sXP/sz2GEjJ9 UZdi3iqT4xhET+NQJzaCyXfyUd1pLJcI4ddu/c0IoGlzgry4ukC6G/P4yUN+oUWwNdrp PJdbDPW4Ek1YU1TJZfvYOwqCpYRgcPkYW8xPHj9He/ksrMpuGdrXxko8IezSq7uwPCVw ctWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=oQqVWWiC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e3-v6si20754363pld.229.2018.07.11.20.11.16; Wed, 11 Jul 2018 20:11:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=oQqVWWiC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391127AbeGLCE0 (ORCPT + 99 others); Wed, 11 Jul 2018 22:04:26 -0400 Received: from mail-eopbgr730087.outbound.protection.outlook.com ([40.107.73.87]:10129 "EHLO NAM05-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726464AbeGLCEZ (ORCPT ); Wed, 11 Jul 2018 22:04:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector1-synaptics-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mmfj1XqGgc3IHKaZrHgv5QQ8kUMOdf7cHrYWlV9+ZiA=; b=oQqVWWiCGY5j2YjYO23CQ7fBTiqPY4ERhK/7xSnAmFfAVb8Xsy6NPX1hizRX1gGL+gcLKUuOCGJYrYw+dsnMrxGTmiPYI9WTE/WugvKMGuOvFl+rHu7zxClphx3u7CSrwJofjFPOmqf8iBtLl+T3YwtlyXq7pMVOGzdAo0Wcjcg= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by MWHPR03MB2639.namprd03.prod.outlook.com (2603:10b6:300:46::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.952.18; Thu, 12 Jul 2018 01:57:11 +0000 Date: Thu, 12 Jul 2018 09:55:04 +0800 From: Jisheng Zhang To: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby Cc: linux-arm-kernel@lists.infradead.org, linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 0/3] serial: 8250_dw: add fractional divisor support Message-ID: <20180712095504.4d9583ce@xhacker.debian> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Originating-IP: [124.74.246.114] X-ClientProxiedBy: MRXP264CA0025.FRAP264.PROD.OUTLOOK.COM (2603:10a6:500:14::13) To MWHPR03MB2639.namprd03.prod.outlook.com (2603:10b6:300:46::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ded1bfd4-1327-4676-64e7-08d5e79aca2b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:MWHPR03MB2639; X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2639;3:tEEN2HXEHqB1uE5+R6KJgz8dElzPRP7dgWFTiJ25vyFCVNW0Je4KzRHBX4OK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doMqw7UGcxAm1miHNpDj+g/hZ6orZ40r2urIzvm71D/RyrVZYj3LrCUiiWEeJsb5BE3ndaAuBK+jnq5oSsNYkvjbnN6ZVN3cdOjLlLizkMRX+Ot93bgHaYVIY+8TFNp1anCouZQyKmD/3pBkdXWBJmVcgr3GOBz2iUDkxV2CgK1faTYmCu0RMbVhGSiKKFm7llc5JsKStTtiz9WI68VVspAfJM00wEwRMpS/LAMUT29lrZecdmI6AvwGwhjDSfxCnD4BrSAp/EJ5UgACQSf6Mo9G4qrgDQZI;4:NPVePEUW6QCP59brOo0N4NTu+Gc73uhijMLoAsFI5ydhsTiZfIn+3jrKw5N+xJhzrWTL8oKkbxaWWSGqXRmzYNRwAQKj10ySqdoxhlx9hBLeowK1uK+J4DKMoQ9qp9jHVp3FUUmzJ/iJ3Zmaqbf2Tw9RnMq04vF4PpbKG8jSbHLOKGx3B/c1VQDh+bLIh3W/Zl4VVGzVinjhDKCxJsyNLWXCnj/gwvtNkJAlD6rPL+8wUU1VlLjQg6mFejBKRYqYV7g5j/2Ae6HeJocTPIn5fA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040522)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231311)(944501410)(52105095)(93006095)(93001095)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:MWHPR03MB2639;BCL:0;PCL:0;RULEID:;SRVR:MWHPR03MB2639; X-Forefront-PRVS: 0731AA2DE6 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(39860400002)(136003)(376002)(366004)(346002)(396003)(189003)(199004)(55016002)(9686003)(4326008)(6666003)(386003)(6506007)(105586002)(186003)(66066001)(26005)(16526019)(53936002)(106356001)(230700001)(2906002)(52116002)(50226002)(5660300001)(7696005)(33896004)(86362001)(68736007)(486006)(956004)(476003)(110136005)(7736002)(316002)(305945005)(23726003)(8936002)(6116002)(1076002)(72206003)(81156014)(97736004)(3846002)(81166006)(50466002)(478600001)(47776003)(25786009)(8676002)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:MWHPR03MB2639;H:xhacker.debian;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;MWHPR03MB2639;23:JxXFuWGfdU5vzRQZKEz6NpcPvVnhrg34NZapsR3H2?= =?us-ascii?Q?vE7bbmIEHqlDhlgjzpSrtRUb5y4XUEv6bIo7n2ApnKL/LDerxUwWSoCWKHdS?= =?us-ascii?Q?ZupX1cKxJq4hnEBAuQgOZXZZsm/asrmW19N2bOV5VT9gfgnCMYhKg8BUnNow?= =?us-ascii?Q?N/sq3gPZZHgZ0jWKKb6v54VPk5ovKDWqFgLU2NAQojvkr5saWd+tW6lwv8rH?= =?us-ascii?Q?ekPMgi+el7YX0VDDKBpTmzPqEjP1WShBhsTEyjy23632j670P2mTHYWzgaqI?= =?us-ascii?Q?FzEXV2YCOgyiXQ0yB3zs7vOVU8ytll2FHD0jlOXDptIzxtZC3di0BIGzOACK?= =?us-ascii?Q?+JVUh2kaQQ9mFEbfC4WvLQW/oyvZ81mngLWBd3F2AWkDBAH+avPA6gT7PD8g?= =?us-ascii?Q?EA4/ee+XdZc/UJL23OcbuDuWaWd9NqX5nhdcBvnVNCghCillj4WYyhbskxtd?= =?us-ascii?Q?N9zlJma3kluGBNgMy/zewLqoJoPagQVH7fvP81MkT+xcTms8yxJCYpeDu44m?= =?us-ascii?Q?mBRDBUz8px1s3OVgd8cKd/kom97NwYl2fPs4aa0RfJan+E7oU7HyClaweAQr?= =?us-ascii?Q?WYRZqXMAsurBJvWzb2bkPPzZ8uWXjO0cYjlhd0F4/bUz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diagnostics: 1;MWHPR03MB2639;6:ojO2yuAcB1VP8kW5reKHFSkAmjsh+7VdJsWZTsBu1JIgCPz8acg8b7895/J+FKSEJVb9qIgSvssaEKUN2DXeXBNd9/zwZCBho+a78jrnv+dxHdkW4UXV112H8aGexGDZm2qlW6OSYO4QP198zbu6Qx0PLYk5XNvq50gIjVq8xiJ1aJSCzq62+t5AdJ2BQokt9koGaVPLyOkbLWleeW8406y7N0WQ6GXsPXXmlpeKuwEjbJ1ByR2KumPPrdgqMu+0tmJwTmuvFFxhSOmXqGGkF4S3+7FtLLMDoizTnXZsAXUZeeYioHFzZHIw6m/4VxZftnGzQpXvdjnr7CrfNBaU1+yg1HyRG7tsz+h1Zzy6YU6iLqlXwvYOXpvszhf3P26sPn8ia7GTi/khB6w0LJT6y4SyujOXscsXva3tgfjnVh6wEhFzXjinHaWEIceoOa3CAKK/dsVuvznB3Olu3btM1g==;5:F/98KlEz86qvt/yzthRd+X6APu++vfkHARy6+FxSBNglgfAcGMHdDsZXYg/Gj3XZ02T27OhG0atdG6affcpzbzBBIdDNnEDdp855l9aJAhaokjITJjPrhtgINUSihHQZxoQZcSUAwdmLYcSBWkPLUUphR8OaxKX4k60bNhqeqlI=;24:qZjwWPd2rQYJ6FD1y9sJtO4qYPB+k4cEC2i9eRomin3cXXmNGGmztYXjvD9STo27kzML5Bx6//jS0SlQNP9Pzczyn0EOqZ3V72yfFBXENig= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;MWHPR03MB2639;7:MFPps4gf4fU+107MXVyy1m9VuUrui2FjWcEE5t06ZNu106USXOeox5XnMcQRFjD23zVRJITJQHpF51UPUOyhSLRvJurTR8ufhBdRvReWbA+g8mUn5gaedZ+JEnI47NIj14mtxjh+uSw7t4KmiffriDx3X0wAJLI/NbQbViLyDIHrZHlmrRPW+XYTNX/5Y6Diqi9rrc9Ocv8PbI71zcPGtc3uRetdDH3mL8rIWCbTUHbXXtMVl7u5MH7t8tKXwZUp X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2018 01:57:11.4364 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ded1bfd4-1327-4676-64e7-08d5e79aca2b X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR03MB2639 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org For Synopsys DesignWare 8250 uart which version >= 4.00a, there's a valid divisor latch fraction register. The fractional divisor width is 4bits ~ 6bits. patch1 introduces necessary hooks to 8250 core. patch2 exports serial8250_do_set_divisor() patch3 implements the fractional divisor support for Synopsys DW 8250. Since v5: - Add Andy's Reviewed-by tag to all patches. Since v4: - use tmp to save baud * 16 rather than calculate every time in dw8250_get_divisor() Since v3: - simplify the dw8250_get_divisor() implementation again. Since v2: - rebase to tty-next branch, since I need one patch from Andy which is in tty-next - drop the patch "serial: 8250: let serial8250_get_divisor() get uart_port * as param" since it's in tty-next now. - add a new patch to export serial8250_do_set_divisor(), and reuse it to complete dw8250_set_divisor(). - remove DW 8250 version check, since the DLF register always exists and if fractional divisor isn't supported, the register read as 0 - add comments to explain how dw8250_get_divisor() get quot and frac. - the frac calcuation is simplified with well implemented GENMASK - Add Andy's Reviewed-by tag to patch1. Since v1: - add an extra patch to let serial8250_get_divisor() get uart_port * as param - take Andy's suggestions to "integrates hooks in the same way like it's done for the rest of 8250 ones". Many thanks to Andy. Jisheng Zhang (3): serial: 8250: introduce get_divisor() and set_divisor() hook serial: 8250: export serial8250_do_set_divisor() serial: 8250_dw: add fractional divisor support drivers/tty/serial/8250/8250_core.c | 4 +++ drivers/tty/serial/8250/8250_dw.c | 45 +++++++++++++++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 30 +++++++++++++++---- include/linux/serial_8250.h | 3 ++ include/linux/serial_core.h | 7 +++++ 5 files changed, 84 insertions(+), 5 deletions(-) -- 2.18.0