Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1212203imm; Mon, 9 Jul 2018 20:13:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfYmf0fnTA1uPqIN43a5MSd7ANUg7UVUbgVwSGb3JoiZP6ZTAUWBTDMTLN83jzNkdK1AVW3 X-Received: by 2002:aa7:8713:: with SMTP id b19-v6mr23738642pfo.151.1531192432502; Mon, 09 Jul 2018 20:13:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531192432; cv=none; d=google.com; s=arc-20160816; b=RQk3XT91xxHWhzCkjqGgCU3kuFwBGwKp1RN0RlVoL3odY5Lkru67QUbkJLWgCkWllC 05dY/IGjO/vj4UJl8jVrDRsb7AqX1WrT8hwG6uaz5cXJQgHHR2mId3L48wOFihc+g6o/ o9HSX76gz9/T33780lHLfG/a9+8KamXN0n11mJllEZpn0XKabCkhwsScnVZexCet2JxU 0pUGn2GFQwg5DXlCPcFtHzlTs9VoHX5SiaUZ18FyCVgdsxvSUruCuMKNoDUiiekvTSYh 7g79fjGDvGupy9rkggf6dmHjM202XHLrByAJIJnaLoKW5uoXlnH1EOP4BN9Y6vKqfcY6 CQ+Q== 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=kxN65LLnWCMxe3o4RNjVRoyY7rvanlbbtAF0G0ruM9I=; b=sVSxTfQacsNu/4vsQ2gj/EkBcRaKc6Kaz9aUYxtYZeey+PsOmqW7VUZ1BmyrzvCFUO NvQiDmzCKHS+rDFD+3pqIaACNkbGLWkRfrnPh/IwgTevgZC4thM8GD1mVCizRemR586m qXDjASBJnui7swRPnzFnWnZ6HsSb344+CHtMRcb2sYcSRd9LPytqOd2s51Njd8RRdLbs xMuqopEwR2S2YUkclj0SDc62uMhmGLKT0q1wR0HGFbZ6qIErIw6siv2XNlKR0dNt2BQ+ zyWCn7713XTX+Jnnneltgs4uCtlwaoOaDIoK+fVM53lEZMVN7hV7JHAHmOKFHTrUkzV9 4UBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=L6xW5TL0; 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 v16-v6si15407671pgb.96.2018.07.09.20.13.37; Mon, 09 Jul 2018 20:13:52 -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=L6xW5TL0; 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 S933179AbeGJDMF (ORCPT + 99 others); Mon, 9 Jul 2018 23:12:05 -0400 Received: from mail-co1nam03on0046.outbound.protection.outlook.com ([104.47.40.46]:9488 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932998AbeGJDLz (ORCPT ); Mon, 9 Jul 2018 23:11:55 -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=kxN65LLnWCMxe3o4RNjVRoyY7rvanlbbtAF0G0ruM9I=; b=L6xW5TL0m5bOVLVFTB8G/2tZv10ehvZvO1v4/ZElmJ++lH6M59cc4o1ga5X1kea+U08xVpvAyxveZyAWzNK+snW02SlEduX9WY5CdYT02kzS/WMQ9UTlPWdOtaX4TzOBV1qQceDNnvQqoXweBUqUvvw3PjArNA7JcMBZKEML1u0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by DM5PR03MB2635.namprd03.prod.outlook.com (2603:10b6:3:43::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.22; Tue, 10 Jul 2018 03:11:46 +0000 Date: Tue, 10 Jul 2018 11:09:42 +0800 From: Jisheng Zhang To: Andy Shevchenko , Greg Kroah-Hartman , Jiri Slaby Cc: , , Subject: [PATCH v4 0/3] serial: 8250_dw: add fractional divisor support Message-ID: <20180710110942.5b0a016e@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: PR0P264CA0036.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1::24) To DM5PR03MB2635.namprd03.prod.outlook.com (2603:10b6:3:43::9) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeb42cc3-4eee-49c7-c9fd-08d5e612e2bc X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:DM5PR03MB2635; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2635;3:j8w7KZtgvgRKyzD2Ehemfwyj0XZaR+5Vb/4ukU46hFPJ0VzgsG4ujHWFwpJvvzXsW7Ay5CzAZ70kGywMTl6qW8SQBsdEqzAH6h1Cb/z3f+ThRAdAOp0Wi04cABdqeCiZgb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z64g1hT+EOFWjtbElwPqFonmfND47jReEm5FK69LWQhR+jF9Gcd8jbNhbALACHN5NL9+KBsxQHOo6kWeVZf5wCcZnGTqevMSEWaBeWxyIaaYB8xaDTGqiXAw73gBYEknYiHiHjKyjQ3dnqCic1Dd3ooWKOeDSW0keq8O9jSBwTb3ToeTpHUlctr//j0n31nM20jG4zgd7tt43wGyb8y0aILPGLjKa;4:SPDrOGwJ5hynxFhoLXE1SLQsNwBO0tbyYpkm/edjxgA0nYBLQCtCHtytM2DM5aDZVQe8YAnhdu/T0B1N/QtXudqhXtajDQvgoK2ueI9z8sn9EKgImXPV9n4WRhScAI/FJp6f3SkzZuv8g9zVROI0ozIMQDI3Qe34seu8UI55XX/lBMCkgthQpSnokEtMPcPNgDGrbS1xzZkwUpFWPuHqh911YbKeHcq2PoQps0uzpJbCwZA0UB4qBUtPqZA+qn3XpkaDHWv5Aqt+ahGB34yRFA== 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)(5005006)(8121501046)(10201501046)(93006095)(93001095)(3002001)(3231311)(944501410)(52105095)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(6072148)(201708071742011)(7699016);SRVR:DM5PR03MB2635;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2635; X-Forefront-PRVS: 0729050452 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(366004)(396003)(39850400004)(136003)(376002)(346002)(199004)(189003)(6116002)(8936002)(50466002)(8676002)(81166006)(81156014)(7736002)(305945005)(9686003)(55016002)(66066001)(50226002)(5660300001)(2906002)(97736004)(47776003)(4326008)(3846002)(53936002)(23726003)(230700001)(26005)(1076002)(105586002)(478600001)(106356001)(72206003)(7696005)(25786009)(476003)(110136005)(6506007)(386003)(486006)(33896004)(186003)(54906003)(16526019)(956004)(6666003)(316002)(86362001)(68736007)(52116002)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2635;H:xhacker.debian;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; Received-SPF: None (protection.outlook.com: synaptics.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DM5PR03MB2635;23:AoYWd6GBZ1eVk3+PmFOXsK2e4fGLtV3o+/QU5F9p+?= =?us-ascii?Q?xk9Ze9fwNDtOI1kBm9Qtv+lLwSyNWwwbLGxQ2mAaziK3OGa52lFNDeTxcxIU?= =?us-ascii?Q?MHc4Cb8y7j/f+Kzar41t6WGk7yWcBJqp6STePzpwW+OfK3jwst4xtr6Cdr9Z?= =?us-ascii?Q?FIVjET+21nFanOf2XEaKqDi88e1MCe7ypb7bh1KRFks+qN+GInl4/vLGK/jA?= =?us-ascii?Q?B10s6zM/vEnQWVprXsokr1T1gJCRs18xjxfEaXkcwzwrGTuy6kD9VvfYeY+s?= =?us-ascii?Q?FaH5zdxteDKPrPvZPB4kAFvI/07fnXh+y28RicnXE450lcNuBQ9tTvP7z3ey?= =?us-ascii?Q?AzwB0sStIfVZPAR4ubQcLod2d9kDoQLVuJH/KDP1Jj+eywWdf8aok7jIM3kp?= =?us-ascii?Q?17Ln3ijsIdEg4ucya0wfESZL8Ee/M5UUddxQ2CevNbvZ5owgwo9IEw9LlFEm?= =?us-ascii?Q?9mbd3zoWRBa7UdNkct7DoRV4OM4mapHOxBVKtxXsW9fiH6L/GIMsikrhwFLe?= =?us-ascii?Q?+PDaoZbcZ/PJkBH6WdAmkFg35/kGXoN/vpi1CoYV/YxPO2omLVLw8ae/CK7a?= =?us-ascii?Q?EzZM7eOKw91+pNTJTS8Q5X92mV/lzHeBeaBEvN8yRNSTyAeQdeSz11hnHZFG?= =?us-ascii?Q?GoOhDscpOeye9/LGAikRUFFdHeZv3bsKBvxiOEIRiu1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+4i2saPxB X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2018 03:11:46.4789 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eeb42cc3-4eee-49c7-c9fd-08d5e612e2bc X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2635 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 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