Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3505214imm; Mon, 4 Jun 2018 04:52:15 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJArk6Njf4QoSYUBPrQWOFzIuo1ri4UFbJvif0NyN6b88IKoA6SNda72GvKCrM2TJbryZr5 X-Received: by 2002:a65:52c8:: with SMTP id z8-v6mr17230469pgp.46.1528113135672; Mon, 04 Jun 2018 04:52:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528113135; cv=none; d=google.com; s=arc-20160816; b=VLijWoTphS8WRS3eaok2HduAp9V2KNImuzaRb7DUkLKRlLAw6YDOQ2hYjVbY5wuoxN aYXn5JZz2yVeOvOqHeB/Tb5mpezHhqBNigTzIjaZOhRgqbUjZt2kV10/Mpa/Wv8J10uc rjM1qv/i9vPUC7lxlri7oTIVMK7rldhhE+wZKHXS2/ju5nXdv2mDzVVo4dduRrQs6Prf T08loyt7rhpt6VBAXlg5SxXV+L95Ds8D6aA5/9VYt2CGgxuVZFG0ehLU1CKvDZ2FxG9x zIgAH3OH2/bCz8PMKfR0RfLWw1UlbRtAxJ8CL0bc82U2wmLussK+McfHUjFTWZjpecEa 1NKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=LQvRF5Xouj01R2+IgKe7lJA3HtIrpG8M/0MNFpBKE6E=; b=xAhuZMzCATLFL4/Wz8gFr5aOMupN/C1uBTyxfarJJS5vAvD1RT1FTblhPUE4BmGltz Grujd4687b/HUrZdLP4+5Ym+mRc8YrmZY+tmxdezI8aE4c3SYy28bMScrk6OB6cUyNlg O8NJLYEy8jgaoERQXRFpXLBSG0CWQZ/UeUHkcPS7ZiHOilgCHokytONPvXh+Jslg5OeG 37ZaOKAF97LgnNsxpiKdsWLjbzhBw8QiKR8bWaOGP7gOSQH4X353WIkweLJNcTSD3Rtd GtC4poyFbET+UwKmN/j/F+KWTOyacs25wsAN2NS0kG7O3VtJzsb+L56gHOtiTu9itQfN 1Utw== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=U0HFn/GL; 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 e5-v6si36986671pgn.339.2018.06.04.04.52.01; Mon, 04 Jun 2018 04:52:15 -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=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=U0HFn/GL; 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 S1752340AbeFDLuk (ORCPT + 99 others); Mon, 4 Jun 2018 07:50:40 -0400 Received: from mail.micronovasrl.com ([212.103.203.10]:45910 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbeFDLuj (ORCPT ); Mon, 4 Jun 2018 07:50:39 -0400 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 8B908B00287 for ; Mon, 4 Jun 2018 13:50:37 +0200 (CEST) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=content-transfer-encoding:content-language:content-type :content-type:in-reply-to:mime-version:user-agent:date:date :message-id:from:from:references:to:subject:subject; s=dkim; t= 1528113036; x=1528977037; bh=yHSVY4pI0ILpC/4cKWMv8T1PFpCZif0Co1s NR2B8PAo=; b=U0HFn/GLHni8EXo5+Gc09p1M9jbotEu8RU0YoSMMQcxOUrvtFVj BKZFzJn6vu6SXqnUqMW8ym0oWJ6dxtAiklrI3rJe/rTE20W+RjlyBhv206zbgxCQ DshgoOTQhiWkAnO11B39QcPc46mMKmiAHgysqUdK45WiGlo3na5GvSTc= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Ix2U2Hty1fN8 for ; Mon, 4 Jun 2018 13:50:36 +0200 (CEST) Received: from [192.168.2.109] (62-11-51-166.dialup.tiscali.it [62.11.51.166]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 22932B00142; Mon, 4 Jun 2018 13:50:33 +0200 (CEST) Subject: Re: [PATCH 4/8] serial: 8250: Handle case port doesn't have TEMT interrupt using em485. To: Andy Shevchenko , Greg Kroah-Hartman Cc: Jiri Slaby , Kees Cook , Matthias Brugger , Allen Pais , Sean Young , Ed Blake , Stefan Potyra , Philipp Zabel , Joshua Scott , Vignesh R , Rolf Evers-Fischer , Aaron Sierra , Rafael Gago , Joel Stanley , Sean Wang , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180601124021.102970-1-giulio.benetti@micronovasrl.com> <20180601124021.102970-5-giulio.benetti@micronovasrl.com> <3a66327727d9bf2ce5adf8ef0f1fcc1fffeaa4ec.camel@linux.intel.com> <4a7148d5-ab2c-425d-afdc-08ddd3c522c2@micronovasrl.com> <2a2f547d787db9d593bb7fe3ad9c833836e23749.camel@linux.intel.com> From: Giulio Benetti Message-ID: <2c61887c-53e0-1ece-9f4a-89250134f083@micronovasrl.com> Date: Mon, 4 Jun 2018 13:50:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <2a2f547d787db9d593bb7fe3ad9c833836e23749.camel@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: it Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Il 04/06/2018 13:38, Andy Shevchenko ha scritto: > On Mon, 2018-06-04 at 12:50 +0200, Giulio Benetti wrote: >> Hi, >> >> Il 04/06/2018 12:17, Andy Shevchenko ha scritto: >>> On Fri, 2018-06-01 at 14:40 +0200, Giulio Benetti wrote: >>>> Some 8250 ports only have TEMT interrupt, so current >>>> implementation >>>> can't work for ports without it. The only chance to make it work >>>> is to >>>> loop-read on LSR register. >>>> >>>> With NO TEMT interrupt check if both TEMT and THRE are set looping >>>> on >>>> LSR register. >>>> --- a/drivers/tty/serial/8250/8250_dw.c >>>> +++ b/drivers/tty/serial/8250/8250_dw.c >>>> - int ret = serial8250_em485_init(up); >>>> + int ret = serial8250_em485_init(up, false); >>> >>> Is true for all possible DW configured types? Or it's your >>> particular >>> case? >>> >> >> I've checked on Synopsis Designware 8250 datasheet and it's not >> supported. >> Here is datasheet I went through: >> https://linux-sunxi.org/images/d/d2/Dw_apb_uart_db.pdf >> >> There seems not to be TEMT interrupt, I use it under sunxi SoC and on >> their datasheet(A20 for example), they don't report that interrupt >> too. >> So it seems to be valid for all DW configured types, anyway I don't >> know >> how many IP reviews there could be of that peripheral. > > This is an excerpt from the document you referred to: > > --- 8< --- 8< --- > > 6 TEMT R Transmitter Empty bit. If in FIFO mode (FIFO_MODE != NONE) and > FIFOs enabled (FCR[0] set to one), this bit is set whenever the > Transmitter Shift Register and the FIFO are both empty. If in non-FIFO > mode or FIFOs are disabled, this bit is set whenever the Transmitter > Holding Register and the Transmitter Shift Register are both empty. > > Reset Value: 0x1 > > --- 8< --- 8< --- > > > If I'm reading this correctly the support is there. Or otherwise, care > to point exact paragraph needs to be read and checked? In the beginning I thought the same as you but unfortunately LSR is only a status register and IER doesn't have corresponding TEMT bit to enable an interrupt on TEMT triggering. On OMAP instead there is a specific interrupt bound to TEMT LSR flag. And THRE interrupt is not enough because shift register won't be empty when it triggers, so you would loose some bit of last byte to be transmitted. -- Giulio Benetti CTO MICRONOVA SRL Sede: Via A. Niedda 3 - 35010 Vigonza (PD) Tel. 049/8931563 - Fax 049/8931346 Cod.Fiscale - P.IVA 02663420285 Capitale Sociale € 26.000 i.v. Iscritta al Reg. Imprese di Padova N. 02663420285 Numero R.E.A. 258642