From patchwork Wed Apr 5 04:03:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 96767 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp88698qgd; Tue, 4 Apr 2017 21:05:20 -0700 (PDT) X-Received: by 10.84.239.8 with SMTP id w8mr33212521plk.73.1491365120062; Tue, 04 Apr 2017 21:05:20 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1si19364023plo.277.2017.04.04.21.05.19; Tue, 04 Apr 2017 21:05:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com; spf=pass (google.com: best guess record for domain of linux-serial-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-serial-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751221AbdDEEFS (ORCPT + 3 others); Wed, 5 Apr 2017 00:05:18 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34811 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdDEEFQ (ORCPT ); Wed, 5 Apr 2017 00:05:16 -0400 Received: by mail-pf0-f194.google.com with SMTP id o126so312444pfb.1; Tue, 04 Apr 2017 21:05:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=G2nSPwbs8cI5H5NfsY4TrCLlKQZ6Q+Idx3xuEj4wz7w=; b=CfnPjP5PS4Meg9R3+8xFg+j1SNJFvLK9K3epZKmSVVQXnl014CmVUj05x0hsBk7+Cg cpJz17Z1zJSfl3Ytz5nFnNqAsRhyTjc6+uS2taYxwVeAR1uMqhY2TlGF6p03CeRvDJkh 66NSsTuThVTRy1tZM4QZYo3/sVn0O8QKmoClOpgptkLzkXRwilBvlDZ9Yf5GxsfxWUTa oPyGmvz8IjIByo+HkaAdxkX2B5vaZNqVe7ahmQZlSbZsZ3RnF6Mmw60kQs9rR562gArp HuDNwAHhz5eU34jC3A7bDYhdI61OdDLGjlNLN7Y42hdkWZ7caQfnCynAMYZAViOSKeZD Jucw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=G2nSPwbs8cI5H5NfsY4TrCLlKQZ6Q+Idx3xuEj4wz7w=; b=KM1AxLHCzXxbj6wf5b3gM9CSUTeYLkZUd6xkMJK+yltlIaqGUYg87Z4SD2k7LyGGQX MNhUHra8Ethk//vmpWdI7ND06y4rquREibV5XX5HXf1SwzX8bVNjqugmFrKSTw/bLzPd ErVriUvsTJl8AGqekSAWZHeTU25HDT8J/gp4K8wZpeQTnKiCHWACvd8WPhry+XrMg1+B qSx8PTNCyEW7ANlWg6mg0YPNCNPOhBmz03KdbrCLkOU63YUHe6DStQx6U7fR7xVVPyMx eQH6981MgD+qxM1IqV9m/sKlyM0NtnlFkNBa5NOB4pD3LrVwsMMwVpHYX1rTo8HJk2qk KO2w== X-Gm-Message-State: AFeK/H1xiFNJ+7GlR69QpHq+CkK0TisGmfx8Eroa//yDAaSJa0bUFr+YA6Vjm6aO8S28Zg== X-Received: by 10.98.217.67 with SMTP id s64mr27199798pfg.119.1491365110311; Tue, 04 Apr 2017 21:05:10 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id i15sm34250314pfj.51.2017.04.04.21.05.03 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 04 Apr 2017 21:05:09 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Wed, 05 Apr 2017 13:35:00 +0930 From: Joel Stanley To: Greg Kroah-Hartman , Jiri Slaby , Mark Rutland , Rob Herring Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Andy Shevchenko , Benjamin Herrenschmidt , Jeremy Kerr , openbmc@lists.ozlabs.org Subject: [PATCH v2 1/2] serial: 8250: Add flag so drivers can avoid THRE probe Date: Wed, 5 Apr 2017 13:33:51 +0930 Message-Id: <20170405040352.5661-2-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170405040352.5661-1-joel@jms.id.au> References: <20170405040352.5661-1-joel@jms.id.au> Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org The probing of THRE irq behaviour assumes the other end will be reading bytes out of the buffer in order to probe the port at driver init. In some cases the other end cannot be relied upon to read these bytes, so provide a flag for them to skip this step. Bit 16 was chosen as the flags are a int and the top bits are taken. Acked-by: Benjamin Herrenschmidt Signed-off-by: Joel Stanley --- drivers/tty/serial/8250/8250_port.c | 2 +- include/linux/serial_core.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 6119516ef5fc..60a6c247340f 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -2229,7 +2229,7 @@ int serial8250_do_startup(struct uart_port *port) } } - if (port->irq) { + if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { unsigned char iir1; /* * Test for UARTs that do not reassert THRE when the diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 58484fb35cc8..260245deec94 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -195,6 +195,7 @@ struct uart_port { #define UPF_NO_TXEN_TEST ((__force upf_t) (1 << 15)) #define UPF_MAGIC_MULTIPLIER ((__force upf_t) ASYNC_MAGIC_MULTIPLIER /* 16 */ ) +#define UPF_NO_THRE_TEST ((__force upf_t) (1 << 19)) /* Port has hardware-assisted h/w flow control */ #define UPF_AUTO_CTS ((__force upf_t) (1 << 20)) #define UPF_AUTO_RTS ((__force upf_t) (1 << 21))