Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3784890imm; Mon, 2 Jul 2018 05:38:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfiIwbQbxKl3HwWaTe4hur8y5RIYB9C7bgy3qFIk6wfiwkYQ8BgrmVJI7SNDXwYcBzWfFbx X-Received: by 2002:a65:60cf:: with SMTP id r15-v6mr13219876pgv.41.1530535126614; Mon, 02 Jul 2018 05:38:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530535126; cv=none; d=google.com; s=arc-20160816; b=k+wN+oi8SB5NtHNUnmMiXUyFrVmV58zgXn/gadleFdcrNaKXJO+71hD5qSA8gaE8qt 1aUzm+bk7de8lAoLZ4c1Fo+2B6eMI0ZMBY1sJiX4yLX7gxtSw0GsADz73fhZJNcnLbbs +N/oJZVZmpebv/od3ycl0bU1jG7zrThMU9wQWAYoGp4oEhw4Z+NgZ98AXNlDGKuZf4Xg Kf5OGRS7h79eZXLdh5eLQbAi1PuXbQnhKRVzBM0OTNUbBBHMVHcOZdvJFN+KHw8Zz1OV y+iG9v3oiu/+ISYkqGNsNRCe+LO3457bqdPk4JjJc09FMUegow2YyfHt1iqt3gEY5moT 6u5Q== 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 :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature:arc-authentication-results; bh=0ghN6h60FCpdIRNcG7DyhCMHS/msp1/leh31kSPJQqM=; b=OMV53wonX+uUlh+zRhmKOxM3mrwwi1w0SZa908HNkWuoWEmwEJueUftMWZjpo24/9N rL+P42PliylrnuETCIWwRxkPGLDbcJR+F9A3/O2qm5jD+0/A7/6j9YoTYQ5R1l8+IL1D qmZUKI33ElwbeGp/PnLGYVpf6mUfwoX5LrQPRqwi1KxvT392DpTrnk3YPpcLLZRGgev9 6jvto15MYbR/N7ky1VmNVoO12+32EKvF8W7SsqroyG9J+sM76Vb20g5JM/q5rsbks07z trjgkhMpz3YlsTJscgcSvr4WgqN2xSxr7PyFf9w16HiKuK1OCg4T8+0ANZ7Ah/N5Ve8M sd+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@Synaptics.onmicrosoft.com header.s=selector1-synaptics-com header.b=vwhEEvyZ; 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 u190-v6si16795070pfb.325.2018.07.02.05.38.32; Mon, 02 Jul 2018 05:38:46 -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=vwhEEvyZ; 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 S933730AbeGBKHj (ORCPT + 99 others); Mon, 2 Jul 2018 06:07:39 -0400 Received: from mail-bn3nam01on0087.outbound.protection.outlook.com ([104.47.33.87]:52768 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753132AbeGBKHe (ORCPT ); Mon, 2 Jul 2018 06:07:34 -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=0ghN6h60FCpdIRNcG7DyhCMHS/msp1/leh31kSPJQqM=; b=vwhEEvyZUt4GC0UT+RyDlPZ6cIFUoYelWWi+AvjFuA3DQaZQJbyF3vTYcxyF72qOZTyZXjGDoGiad8WJhQNM1H2fspplgGXUO0NTI/SLiFABaGpQP2DsHlhLmJLwyVvKTiX1A0MWQrqXct+b7LqjidV8Szj7v7hizj17rpJ9Cog= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Jisheng.Zhang@synaptics.com; Received: from xhacker.debian (124.74.246.114) by DM5PR03MB2636.namprd03.prod.outlook.com (2603:10b6:3:43::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.906.24; Mon, 2 Jul 2018 10:07:30 +0000 Date: Mon, 2 Jul 2018 18:05:45 +0800 From: Jisheng Zhang To: Greg Kroah-Hartman , Jiri Slaby , Andy Shevchenko Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 1/2] serial: 8250: introduce get_divisor() and set_divisor() hook Message-ID: <20180702180545.7570b40b@xhacker.debian> In-Reply-To: <20180702180428.331b36c5@xhacker.debian> References: <20180702180428.331b36c5@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: TY1PR01CA0158.jpnprd01.prod.outlook.com (2603:1096:402:1::34) To DM5PR03MB2636.namprd03.prod.outlook.com (2603:10b6:3:43::10) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e0d68e52-b843-47a0-cee5-08d5e003a02d X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020);SRVR:DM5PR03MB2636; X-Microsoft-Exchange-Diagnostics: 1;DM5PR03MB2636;3:MBUssnJ4MIZp76Ta/r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8tVfdfXUxZZNZZ10y9pibSvMHiIZci1doQnUgmetFeVlXp1HD+pE0tvcUmfOXuIBZgrQpOWlpWs/Q1QMY1kmT02Ia1/w7IzchLshzvgXshgwwr2q1dzh+G/1WyqANPKT2/6EywZTjTOzyvVlcOWbzT3u2sWo9M6pP03sOs+VfUf+SYvLeiPd7Sco+k9dk44UA6nGDP131FbGD3Mi2wF6PXZoDzGQHozSafwREBG1nZt1WPjRZuEDQrNSMlnGNifwoLCMF1Xb7WFIopYF+wvVS86tq6wYOy0Sk3s3MN4C2HR/jwWSX9BUsI8nvfAg9LtGTLWDDGwcFY;4:tcSWC2peFkutmLxhvk3wLLR/AM0wJ6V42PalAWeKbaLV7qGsqaVvavH5/AqoSaXpD85V7zgyK3qUDiwyM0q+vpxR53OYiXbT/R3ilkIkhIlb8DWwTjNwtw4lk9BVgFO7bnFZ2KmHwxzPMeRko4SKxNRsXAvyjdTdBuFoPKW6C+zWDP7MapxfzTcnZ2OnHtoTCIwvvo5RsakBnFoBbljn+HI6oQiN1+rX8wVRnDLPmaW2FOcsObAmf7SzfjlkSD8gLdcKut1fhAqTYLci+hHBfQ== 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)(93006095)(93001095)(3231254)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(20161123558120)(6072148)(201708071742011)(7699016);SRVR:DM5PR03MB2636;BCL:0;PCL:0;RULEID:;SRVR:DM5PR03MB2636; X-Forefront-PRVS: 07215D0470 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(376002)(366004)(396003)(346002)(136003)(39850400004)(189003)(199004)(25786009)(50226002)(72206003)(446003)(476003)(11346002)(956004)(4326008)(52116002)(7696005)(486006)(105586002)(76176011)(106356001)(305945005)(8936002)(33896004)(7736002)(81156014)(8676002)(55016002)(9686003)(478600001)(81166006)(47776003)(68736007)(230700001)(23726003)(1076002)(6116002)(86362001)(3846002)(6666003)(5660300001)(97736004)(2906002)(6506007)(386003)(186003)(575784001)(16526019)(316002)(50466002)(26005)(53936002)(66066001)(110136005)(39210200001);DIR:OUT;SFP:1101;SCL:1;SRVR:DM5PR03MB2636;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;DM5PR03MB2636;23:XK/MNu2ppNzAeLK1x1nV5mIT1rVzGbL3DzSISB0Ek?= =?us-ascii?Q?waEiI9Z0W+uHzqE8JgKQaYZetHgUSIu9/ijhW8FJBUGVcNGGSZmTee7LfTHL?= =?us-ascii?Q?aDMf6gDJcRrS1YNwMjrf22IXbFXH5wrxa1N/8ce5whhOJc3Y6tbGF+hQXz3e?= =?us-ascii?Q?acZ/8ZWk2KVR7TDpzVyANkqfdcSHUiVPdhKjYTULMG+EdIb+Qi3kUOBHNzEb?= =?us-ascii?Q?173LV8/brc6b2Eb5Jn1cJ6HgfexLy/40Baj7j5aWr6VKYSrmUBSPzNFW1PYY?= =?us-ascii?Q?Yey0BP/xetJn/CCZlo70bPKEDdVcJR9gfaJuTjptpwbjKlo9kfyZNRVopHPi?= =?us-ascii?Q?pRENrN8GsaV2B6zPpovdGig1/tvkZgarbN2yiLZWMDbals81tUm2Y8vBEiCT?= =?us-ascii?Q?Hal8LJXw+djNcVvdzCrtBzYY3JcnDiQ92Ra4yozrpZ1ZBUCDmBINbqqmXMtq?= =?us-ascii?Q?iczX3CqF2ie05CJYQ6NL7pxa6NZNNaJA7AKDgA2f1VW4iv0f56Y+RuyGKzbQ?= =?us-ascii?Q?nYys8si+xD1cG33lcsQQnQB9iJtH3xGqSqq7Fx5Lm9EMpRR/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AKC+F4u4efZ1oXsJ2R+SDBzrQSJn2F/ZR0pGS8Sf37J0SMyHf8SZxQq/xfXO6caPOUjwlr1SuMeHs3yL5W+scEg7yyiCo49Bo34IrpwOFbNSjstP4TxmqXFQFM6bUH7wTNscbHa0KUGpR5uoyAlx5uS1wyThUMd2SzxNKKbUqvjHdYbqaDKIZdlUB8pXg4GnEkpvc0ajK44075DKrTVqzRkEB2hmn X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Jul 2018 10:07:30.2269 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0d68e52-b843-47a0-cee5-08d5e003a02d X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR03MB2636 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. Add get_divisor() and set_divisor() hook to prepare supporting this feature in next commit. Signed-off-by: Jisheng Zhang --- drivers/tty/serial/8250/8250_core.c | 4 ++++ drivers/tty/serial/8250/8250_port.c | 8 ++++++++ include/linux/serial_8250.h | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 9342fc2ee7df..da0f3849bfce 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -1035,6 +1035,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up) uart->dl_read = up->dl_read; if (up->dl_write) uart->dl_write = up->dl_write; + if (up->get_divisor) + uart->get_divisor = up->get_divisor; + if (up->set_divisor) + uart->set_divisor = up->set_divisor; if (uart->port.type != PORT_8250_CIR) { if (serial8250_isa_config != NULL) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index cf541aab2bd0..0060ec54a522 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2505,6 +2505,9 @@ static unsigned int serial8250_get_divisor(struct uart_8250_port *up, struct uart_port *port = &up->port; unsigned int quot; + if (up->get_divisor) + return up->get_divisor(up, baud, frac); + /* * Handle magic divisors for baud rates above baud_base on * SMSC SuperIO chips. @@ -2575,6 +2578,11 @@ static void serial8250_set_divisor(struct uart_port *port, unsigned int baud, { struct uart_8250_port *up = up_to_u8250p(port); + if (up->set_divisor) { + up->set_divisor(up, baud, quot, quot_frac); + return; + } + /* Workaround to enable 115200 baud on OMAP1510 internal ports */ if (is_omap1510_8250(up)) { if (baud == 115200) { diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index 76b9db71e489..5093c9ca0980 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -132,6 +132,13 @@ struct uart_8250_port { /* 8250 specific callbacks */ int (*dl_read)(struct uart_8250_port *); void (*dl_write)(struct uart_8250_port *, int); + unsigned int (*get_divisor)(struct uart_8250_port *up, + unsigned int baud, + unsigned int *frac); + void (*set_divisor)(struct uart_8250_port *up, + unsigned int baud, + unsigned int quot, + unsigned int quot_frac); struct uart_8250_em485 *em485; }; -- 2.18.0