From patchwork Tue May 2 07:45:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 98412 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1751455qgf; Tue, 2 May 2017 00:46:15 -0700 (PDT) X-Received: by 10.99.142.73 with SMTP id k70mr15935419pge.0.1493711175712; Tue, 02 May 2017 00:46:15 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u195si15780694pgc.315.2017.05.02.00.46.15; Tue, 02 May 2017 00:46:15 -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 S1751971AbdEBHqM (ORCPT + 3 others); Tue, 2 May 2017 03:46:12 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33397 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751781AbdEBHqK (ORCPT ); Tue, 2 May 2017 03:46:10 -0400 Received: by mail-pf0-f195.google.com with SMTP id b23so15355458pfc.0; Tue, 02 May 2017 00:46:04 -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=RbjK1naKg9qny6dfTUh8BrGAzlrbv+T7rn4MOuvFKlM=; b=ifhPDZvbK4cdCRQsyEaeguM2cRPX9vLae6zwMi94bTWBV+Mxjj4cLpk/g6JwuFIvSA IqX0gDdaBcz9xqc1Ou/OYfzxAe3j0e1sO2Dxp6wfBbG9rMXDxB09OJeWvIoVGWZ/Ndc/ NljFVxIGcI3zU6CGvFG5/kz2R5HCVOyfAVCaa3Gs3REy6fF2PqgU1uGQg0WP3XysvSmZ Spbgu2msADURyp1MCqhma875bxiEkNYv169SzPMe4tLAH3wUphsSfRce2ZD19SqqSYap 5tFMOUzdfwLQ/H8jjvjfFrBBuUA3LTxJBlRgrZsm3zOzz3R1IOk+BVNwfSjDYb7izKGl huIQ== 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=RbjK1naKg9qny6dfTUh8BrGAzlrbv+T7rn4MOuvFKlM=; b=ZJUZJRhw2HRSrOGH76v9+vfgJBvrFN2hCC+XedbcNQ6h5Q38fQvmsuBRlWVrC9cOov xypjlq0qvVIZfr3UPU1uxMSPLASEe92PbkZBLll6J8GPEJTeZfdTZCRS4q+x/6Djtq9v U6P2mrZP5ex7aXxQmxmA5YcMgSmoj2z+MQ+i5+7R7kvikQExskYRN5iyQrvFSEA/3UiO pmYJ+xow6zunm5LwvECJL5vIrHUMfxBseljcC1HfR++Vn7aJUhOyzi3hQ+4MmcGF1Hxv Wyz8FJGZer3T9OoCKTV78gE8W/ARid3jVISXnjZR1oTpZ5oGnSBE6br2XyW3yF+mEapb z3Tw== X-Gm-Message-State: AN3rC/4aFeacs2ueW/Fmlwx7KoldNG/c3nHRVcARCoxkqyOJ6NPi7YPn 9fEjXZN38quqDnhKF/zHgw== X-Received: by 10.84.253.15 with SMTP id z15mr23808658pll.186.1493711163974; Tue, 02 May 2017 00:46:03 -0700 (PDT) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id s65sm25547361pgb.34.2017.05.02.00.45.58 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 02 May 2017 00:46:03 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Tue, 02 May 2017 17:15:55 +0930 From: Joel Stanley To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Andy Shevchenko , Benjamin Herrenschmidt , Jeremy Kerr , Mark Rutland , Rob Herring , openbmc@lists.ozlabs.org Subject: [PATCH v4 1/2] serial: 8250: Add flag so drivers can avoid THRE probe Date: Tue, 2 May 2017 17:15:42 +0930 Message-Id: <20170502074543.1380-2-joel@jms.id.au> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170502074543.1380-1-joel@jms.id.au> References: <20170502074543.1380-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 19 was chosen as the flags are a int and the top bits are taken. Acked-by: Benjamin Herrenschmidt Signed-off-by: Joel Stanley --- v3: - No change v3: - Correct the bit number in the changelog v2: - No change 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))