From patchwork Mon Apr 20 02:06:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Wang X-Patchwork-Id: 214087 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E17FCC54FCB for ; Mon, 20 Apr 2020 02:06:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9419D20936 for ; Mon, 20 Apr 2020 02:06:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="fGzmuMR+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725991AbgDTCGp (ORCPT ); Sun, 19 Apr 2020 22:06:45 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:38006 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725953AbgDTCGo (ORCPT ); Sun, 19 Apr 2020 22:06:44 -0400 X-UUID: 15895ba748b741d689787e4e72c2df8f-20200420 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=apeKneLMG1hzTxdpFAt2JSCjXRLNOpzDMxDOJ9dHZ7A=; b=fGzmuMR+Truu3qv76tuPigaZ0pQwCJJio7FFkL8raPMLc4uwxHIp2LKujvWWwrievZV3O1OIGKfxwLgpq4XHzr7qrhyviSbljEadWOeGmat4Ub375ODEMSOdabJ9SLnn5YrDhVb0khviCIc4mdtKDe9+E1EGC4IfsiJKRoYjkx4=; X-UUID: 15895ba748b741d689787e4e72c2df8f-20200420 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 785955110; Mon, 20 Apr 2020 10:06:40 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs02n1.mediatek.inc (172.21.101.77) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 20 Apr 2020 10:06:34 +0800 Received: from mtkswgap22.mediatek.inc (172.21.77.33) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 20 Apr 2020 10:06:39 +0800 From: To: , , , , , , , , , , , , , CC: , , , , Sean Wang , Steven Liu , Ryder Lee Subject: [PATCH v2] tty: serial: don't do termios for BTIF Date: Mon, 20 Apr 2020 10:06:38 +0800 Message-ID: <8c47aea3aa3cce4d7484b840ddb117cd16bcf1cc.1587347988.git.sean.wang@mediatek.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-MTK: N Sender: linux-serial-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org From: Sean Wang Bluetooth Interface (BTIF) is designed dedicatedly for MediaTek SOC with BT in order to be instead of the UART interface between BT module and Host CPU, and not exported to user space to access. As the UART design, BTIF will be an APB slave and can transmit or receive data by MCU access, but doesn't provide termios function like baudrate and flow control setup. Even LCR on offset 0xC that is just a FAKELCR a. If FAKELCR[7] is equaled to 1, RBR(0x00), THR(0x00), IER(0x04) will not be readable/writable. b. If FAKELCR is equaled to 0xBF, RBR(0x00), THR(0x00), IER(0x04), IIR(0x08), and LSR(0x14) will not be readable/writable. So adding a new capability 'UART_CAP_NMOD' for the unusual unsupported case. Fixes: 1c16ae65e250 ("serial: 8250: of: Add new port type for MediaTek BTIF controller on MT7622/23 SoC") Cc: Steven Liu Signed-off-by: Sean Wang Signed-off-by: Ryder Lee -- v1->v2: no change on termios->c_cflag and refine commit message --- drivers/tty/serial/8250/8250.h | 1 + drivers/tty/serial/8250/8250_port.c | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) -- 2.25.1 diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 33ad9d6de532..250337e4e7c8 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -82,6 +82,7 @@ struct serial8250_config { #define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks: * STOP PARITY EPAR SPAR WLEN5 WLEN6 */ +#define UART_CAP_NMOD (1 << 18) /* UART doesn't do termios */ #define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */ #define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */ diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c index 0325f2e53b74..da0a8711ee3d 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -286,7 +286,7 @@ static const struct serial8250_config uart_config[] = { .tx_loadsz = 16, .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT, - .flags = UART_CAP_FIFO, + .flags = UART_CAP_FIFO | UART_CAP_NMOD, }, [PORT_NPCM] = { .name = "Nuvoton 16550", @@ -2544,6 +2544,9 @@ serial8250_do_set_termios(struct uart_port *port, struct ktermios *termios, unsigned long flags; unsigned int baud, quot, frac = 0; + if (up->capabilities & UART_CAP_NMOD) + return; + if (up->capabilities & UART_CAP_MINI) { termios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CMSPAR); if ((termios->c_cflag & CSIZE) == CS5 ||