Received: by 10.223.185.116 with SMTP id b49csp1832787wrg; Thu, 15 Feb 2018 02:16:58 -0800 (PST) X-Google-Smtp-Source: AH8x2270IEycgN483PJdCn8RuLbVymggm6XlF0qY/5nqu8JKaSHuh6UkFhI6GMyWHf+ImocI4+rP X-Received: by 10.101.100.147 with SMTP id e19mr1828028pgv.88.1518689818366; Thu, 15 Feb 2018 02:16:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518689818; cv=none; d=google.com; s=arc-20160816; b=dcSFHHlSGByGE7mIv1swywYl8k4D6itRAHj2SzU+2BdbBQw0OskcEjNLIClZAfD7pI f+y1YqdMpP9A1g3EjIcfPfMvdkCgG/HydS3s7pYNlwAcNyyrWsTdEkiEnWJn381wZ2bL M5afr7foAmdTIP2hladCulW6RwS0Ogp+qmPOLbc9IxHXv/POMepJOi94sn4o28R1Rc9G DeNg9K0USQ+HXfFg4gwYO5bi/cnEWKhqtw9qemO+WUtj/5LBNhn/heaSI69gWePv3W0z koPkV8OWB+KERLoU8JugTM/5fGzsL6OL6POGIAB09aaue5HH63OugwQ6mwLL4OOylpB1 W3mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=uIR3Rq5QT8yjcfPdH3bll6ekRCm1yQr5O8eEgomdRpo=; b=zwMaUKxXDfWCab8LXGBbOPDYM2zuZJ5dhV7LJAeKCR5vhSTRffPpBigj4fuUsj3Vro jQcAbw8dFpQxsSfpKuu1C23dWMS7DJjL4710+eZOZrLVqbUY2IQ8lU2HJaZwwcrFhmGT VZKs/6k0tej6jeZQkZYKABgfem1YkCaj28kurVzrOrj2U39rhQ3jNw2Bb2Fdz82jBjFS 90V9ioUO/sgxf2cIJkykYV68RFgnr9Tl5oaa1Y+JwMfPEMXc35U+mnVK8f359JZEb+CH +5tsBHMLIkQomEL9t3yoUrfAlLNYZBzoo7xEzIgkV/4JgJ3+VjT4mCM3IeZJ/apYvxxn oL1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ifExlxwg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si8185108pgr.386.2018.02.15.02.16.43; Thu, 15 Feb 2018 02:16:58 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=ifExlxwg; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755426AbeBOKP3 (ORCPT + 99 others); Thu, 15 Feb 2018 05:15:29 -0500 Received: from mail-oi0-f53.google.com ([209.85.218.53]:44306 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbeBOKP1 (ORCPT ); Thu, 15 Feb 2018 05:15:27 -0500 Received: by mail-oi0-f53.google.com with SMTP id b3so18666055oib.11; Thu, 15 Feb 2018 02:15:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=uIR3Rq5QT8yjcfPdH3bll6ekRCm1yQr5O8eEgomdRpo=; b=ifExlxwgG5ahgNpUgjJ1TijebahpI+k+W/wGPoi4wnLDn0iblz7rQpqzeicjMQgbeN rQGkG63kLtLTITc+0z4wp0NE029Wk5qMiGcZU4jcZMk8MI1rDFuFvpaiy9vXe0HZs/NO FdQzY82K7+8d0fyIfY3bJ4P52SWv+0vVifdt+X5v+NvdOHLuhJXn4x9hHfopgtE4LI6V j//LqdDPEeqj6mnJCEGVYS/UPoVrXY5rapTCMtyZZ5/VTnM9GOccR/S9WB9Ma9t44Lff cH3zhP8YbEAKYImkzNISA1oLFDXL27KQDS02TynT+x49p52nEfHvC6BsUrnQBzU+PvMg k0FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=uIR3Rq5QT8yjcfPdH3bll6ekRCm1yQr5O8eEgomdRpo=; b=V1JMY0dSqA7xFi3Zfq3imh+xN05T3J7C8oJpt6d7TBqZxnEmEB+vmixEl2iUXPzlBe PI0ir9y+scE/1iNf52r0c8/YQHXMh4/sHTpcyey8gis5WDUJ5af3wYz2gkzTeMWUt0gc sfwfMMxGcg5ZD2tpcFHfBFy/x7KY6XaYoubhkklTflI6AKLngKFZGS/tjd0TWcW57NxP 9KIfBudJX8z8ni0bAlhlLI6WRYF+J8j7CSiWFrvFPXwGNl3+Klr465iW0RN8Yrhy7f70 AD6mcJLYMLcfRg4LtEcUlzpUN6cC85LEoE/nA1CfyauJAkb8bjlQKOODOxGLVqTKWZfL T1xA== X-Gm-Message-State: APf1xPDQukwfAA3Uf824M6CWqztOK1YkvmEkhGlH6JC/P4u4S7hQuMWn w369jnvAPEGZ+H/sUJ0DqpsgmiQHjoAunlcGHA== X-Received: by 10.202.252.68 with SMTP id a65mr1434626oii.256.1518689726765; Thu, 15 Feb 2018 02:15:26 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.39.138 with HTTP; Thu, 15 Feb 2018 02:15:26 -0800 (PST) In-Reply-To: <11dff5a3498949118b883b39be028611@NTILML02.nuvoton.com> References: <20180212044810.23547-1-joel@jms.id.au> <11dff5a3498949118b883b39be028611@NTILML02.nuvoton.com> From: Avi Fishman Date: Thu, 15 Feb 2018 12:15:26 +0200 Message-ID: Subject: Re: [PATCH] serial: 8250: Add Nuvoton NPCM UART To: Joel Stanley , Andy Shevchenko Cc: Greg Kroah-Hartman , Rob Herring , Mark Rutland , linux-serial@vger.kernel.org, devicetree , AP MS30 Linux Kernel community , Jeremy Kerr , Tomer Maimon Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: joel.stan@gmail.com [mailto:joel.stan@gmail.com] On Behalf Of Joel Stanley > Sent: Thursday, February 15, 2018 4:00 AM > > On Wed, Feb 14, 2018 at 3:22 AM, Andy Shevchenko wrote: >> On Mon, Feb 12, 2018 at 6:48 AM, Joel Stanley wrote: >>> The Nuvoton UART is almost compatible with the 8250 driver when >>> probed via the 8250_of driver, however it requires some extra >>> configuration at startup. >> >> >>> + [PORT_NPCM] = { >>> + .name = "Nuvoton 16550", >>> + .fifo_size = 16, >>> + .tx_loadsz = 16, >>> + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_10 | >>> + UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, >>> + .rxtrig_bytes = {1, 4, 8, 14}, >>> + .flags = UART_CAP_FIFO, >> >>> + >> >> Redundant. > > You are referring to the extra whitespace? > >>> + }, >> >>> + /* >>> + * Nuvoton calls the scratch register 'UART_TOR' (timeout >>> + * register). Enable it, and set TIOC (timeout interrupt >>> + * comparator) to be 0x20 for correct operation. >>> + */ >>> + serial_port_out(port, UART_NPCM_TOR, UART_NPCM_TOIE | >>> + 0x20); >> >>> +/* Nuvoton NPCM UARTs have a custom divisor calculation */ >>> + return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud + 2) - 2; >> >> Is there any link to datasheet? > > I have a copy of the datasheet under NDA. The Nuvoton guys might be able to help you out. Avi? In the spec the calculation is as follows: BaudOut = Selected UART Clock Source / ( 16 * [Divisor + 2] ) To translate it to our code is: baud = port->uartclk / (16 * (Divisor + 2) ) So it should calculate without the "+ 2" inside as follow: + return DIV_ROUND_CLOSEST(port->uartclk, 16 * baud) - 2; In order to get the spec you can add somthing like that: "For getting the NPCM7XX Data Sheet please contact bmc_marketing@nuvoton.com". BTW Andy, Intel has our Data Sheet under NDA, you can ask Mihm James . > >> >>> +/* Nuvoton UART */ >>> +#define PORT_NPCM 118 >> >> We have gaps there. #40 is perfect place for this one. > > Ok, I will move it up. Thanks for the review. > > Cheers, > > Joel >