From patchwork Fri Oct 27 06:24:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crescent CY Hsieh X-Patchwork-Id: 158771 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp397650vqb; Thu, 26 Oct 2023 23:26:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUYqS8t6JWZSIVP+JT8ashUJ9DngGOOFi8T13QGHx1nldOfEoGn33MkFuzprt9j+v7ogG5 X-Received: by 2002:a81:b247:0:b0:58e:a9d3:bf98 with SMTP id q68-20020a81b247000000b0058ea9d3bf98mr1493743ywh.27.1698387994824; Thu, 26 Oct 2023 23:26:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698387994; cv=pass; d=google.com; s=arc-20160816; b=nrfgja4q/JM+Xjn4v76XMLyLvNPqDqWITl04/wcBJ+bEnmSC09i/XoP94DrUpg0GrK S20oIixLj82hDFA7QTdurRdooSciTxhKAi2JhbmFj0PTNo6hnpIVqGDKEaKo8X1dHhwH rjv9gvMuUlrTW1ok8Ag+pWqq3JdeZ7CInbd306L9vibSb2P0jac3eMpEL8y4AcVvwFDk fNfpI+5VsK3thtzwkO92m06qEeY+0tPKmiQ/7umbq79+l9m9sJtbl/Fur9C8QAM0Lc9v Jurj6RpjKZr48wyo4rR2Gc/BTiRWjWYylEky43e+Q5zF5q+7ACSndsBG2AfgEHnTU7a+ +zPQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y9l1w2+8VjOrBlskqMt7yo18vaGBhUWmQAJn+1ysJ1c=; fh=9IbzxucUBWcgEvhe+WtoxtT+FpcGkFAf3REsKls7q2A=; b=mJRDfdg1eoFJF0N3Z+37N6m4YT4FNIKyUTPm2CfuHZh09A5FZN0UT3tUyTBsWVI/7T JwWpdtvH10nmC7HXbZydP7D9oNlQu65a/EBFU38InNB1wReEVHrpPxLJqWk0rXEiBBrc BrliY88j8WTPivSnFELgtHKWN2NIIYmb9MUgEWYj8Nlon3Vr16eE0NIfMaW+KtUjgyp3 xuCqmCxAQT8OHUdXLkXB9RW790pCpf7g2+abDCF23Bzm3rJNiM/xtEdaW+VkQFfowhRm tl0oVWGLO+l5EDhYoAF+7gpb7GDnIu9OPmVI3PNriCpCqQeK6fT6n/863Z6sraoFyoYE RJvQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@moxa.com header.s=selector1 header.b=K38rieJd; arc=pass (i=1 spf=pass spfdomain=moxa.com dkim=pass dkdomain=moxa.com dmarc=pass fromdomain=moxa.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=moxa.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i2-20020a816d02000000b005a7b8cb374dsi1481585ywc.38.2023.10.26.23.26.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 23:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@moxa.com header.s=selector1 header.b=K38rieJd; arc=pass (i=1 spf=pass spfdomain=moxa.com dkim=pass dkdomain=moxa.com dmarc=pass fromdomain=moxa.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=moxa.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1B28182DC625; Thu, 26 Oct 2023 23:26:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234963AbjJ0G0F (ORCPT + 26 others); Fri, 27 Oct 2023 02:26:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229604AbjJ0G0B (ORCPT ); Fri, 27 Oct 2023 02:26:01 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2047.outbound.protection.outlook.com [40.107.255.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A961B2; Thu, 26 Oct 2023 23:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Chay0qxpPCstQftwvA75S6brTGR4tCOMlEDzlHeI9e5tSl1tWkh2U5eLJT9q5lP//6Lk+iJn/gVVfSz8ziTAalEHmGNrd7SJG4MaZibY0uCJs/K8CqPzMSxcn8KMHZrK6Wl2L+Bf/ymwDKwrxDEhtiU7vpC+6qPRCwUjrnU/UHQXxU3WmMHAS6J0PWD6XJ5h1BKevD6a/+WHT4OKwFPju+if1d98WRcDXy5FTSj3OVQJ4NL177lthPFGe40pzz68t5pQRAzoDhRYnQ2zgyUpfZioUbwEIbezW1UCseH1+kE2fTMun+e/RrxVMu0W/hfw2WQwOo7OI6IBGitwIvj3+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=y9l1w2+8VjOrBlskqMt7yo18vaGBhUWmQAJn+1ysJ1c=; b=gxuJ7H5ff1mYr/KSSDu5Bkt73UprVAo7tNyz7r/d0yXGjJCKkRVrxSFUhws3vRIXKsTSEKtbQL93HlQHv+kuxtbWih38iM4Isc7OmlP1AGgX7LKck0aaVQcOiKCQY7ynC/qhYim3WBW/h/Guj/8bxx7KRa16gaEpJbCI/JK0SjFtwSpk7JJSJqj0oCgwpwRscbrbZAZB64E6ASesWN4CywyWlvlaaVAq8QbszhrCF5xtbPNFcEIsypSUi86EqQ+VfHthlMj/6wbgWugM0vZb6vnnsiEcgygg5f5wY4U7ks+QLQMEjHrnrSnDkMI6oan1rFzFLrBZG8Fc5n0sSQ323w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=moxa.com; dmarc=pass action=none header.from=moxa.com; dkim=pass header.d=moxa.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=moxa.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y9l1w2+8VjOrBlskqMt7yo18vaGBhUWmQAJn+1ysJ1c=; b=K38rieJdsCoI5+8mLplfzMy1JTJrkQaDxABbfxeq/6vTYWrhKoFiXyExWhkGGN8UGX/zaA4Ary0uf3XxY6IKEzDbiaUeIzMPmPXzzOFfmU/WUcndY3rsYaYjHmxBkfTCl4mLu9hbfLLc/GKJzhsIcLmnbXzLSCmfNzp1GjHiyRU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=moxa.com; Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) by TY2PR0101MB3696.apcprd01.prod.exchangelabs.com (2603:1096:404:8009::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.23; Fri, 27 Oct 2023 06:25:55 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::7723:9ad4:633e:fe0d]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::7723:9ad4:633e:fe0d%5]) with mapi id 15.20.6907.032; Fri, 27 Oct 2023 06:25:55 +0000 From: Crescent CY Hsieh To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Crescent CY Hsieh Subject: [PATCH 1/2] tty: serial: 8250: Fix MOXA RS422/RS485 PCIe boards not work by default Date: Fri, 27 Oct 2023 14:24:39 +0800 Message-Id: <20231027062440.7749-2-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027062440.7749-1-crescentcy.hsieh@moxa.com> References: <20231027062440.7749-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYAPR01CA0119.jpnprd01.prod.outlook.com (2603:1096:404:2a::35) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|TY2PR0101MB3696:EE_ X-MS-Office365-Filtering-Correlation-Id: 211858a5-fcc4-4122-1483-08dbd6b59354 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m4kRvcY1QrpHjOM56jPgAXku/aep8MISR9fEyZSma6bh6f/OZmUUnEA3vPw9XR3pBUs/qHKcq5m3+vbu9M/08hufmvxxreEpZ1EvQBAq/YvPSidRPddmcuOSW0o8a3IoN6/FOw7NDmSb+c8cQR/P1KK58TqAyNWnJZhqQMuOgc5yNwEaq6MVZrdTl2+K2eVdMx6L8ce5bcR6oMeKIIDHAVHZgDvj0ZnPsINDbcnV1d9dztzWjzdRV6nofRDjG/Lk81YKb1uLZmsVo9xxyoMPRFWmscPRXSIqjy8ttZzQw6nwzPhebqzubkIHvqHW1mwUuZAcNddjjDhttHA+mOAAZOPKQJB+2bunnzEThKYViRyT744FS1KWx6Qp/PUxrVQ5KxWYOeCV+89G2FAJHZO+usxwG+lPlEMzwqicsdqP597qvzmUGMcFa6XHw0OCcWUkdm2VIF+Lp0DxTbI81ypTfsRZoXX75LJ+tefDEOaIjP8q1x5Canqkfd1n3RNA9niyLiPe3YLiCWykaQZ/dNrLUGAAYljsmrvA3bR56bsGgpLQEa/5ffqntGtt7ZdGanhGlNk0scjiz7OeXUNdxkuM3v5BXu4vvpPYs3ceYhjUSNaNDH9Kcz68hBU/L5Sk2Deu X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR01MB5405.apcprd01.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(366004)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(26005)(38100700002)(83380400001)(4326008)(41300700001)(8676002)(8936002)(66556008)(2906002)(66946007)(5660300002)(110136005)(66476007)(86362001)(316002)(478600001)(38350700005)(36756003)(52116002)(6666004)(6486002)(6506007)(2616005)(1076003)(107886003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lXopcSbmkcqN55ggVpAaEdKDRXcGOVr3HLF7ze48cCycIOrDz3z+uPsBK6Mx+YtAX+sX8BVyzko6gg7cO+/92OhApyoqDRA8QWYMEpxgHrxEyvDcI5w4XGgTd0ptyEyw8vurttchSnLpqgCT+Vcs0lLMsSwWtPVOYbLZ1Z96fuvga8Lgo4jCxE+G8K6nf3oh08I9nHrlWLD1f7DkQfBSRd94+bHZaPf9c9y8Py8+oLg8w1VaoWyQ/qCP05AA6cqBWzUCEZAMbcMP/oU38qggyP0KT2u1UzKc3PI9N1iAnsVfMNZowRTjS6HpksLM5fgY/9rM5R8IOLpj3YPaGm5ssrYrxCEzqBgvBdw6v5yr+VJzPnDBF/jyaiTGIBzGXYcLuUcVKzQqMT/R5KZ4a8/AhuzX4pxhV3aGGglVbACZ1gFdAS0CUrrXz195ffUIoIazMnsQiSXjPx+ZTePpImaj3vd4K+ZyP6RKnQJSKhDor5nLpiQMt5T+afVYW85w8UeNTLqkyAvJEPozTvipgQAFG2LVxfz167HjPaFbY/xsw/X1RMTCY2onzSMMrAtDPyinDCv3aRdxt2L26vA6KCqoyTGeTvpRUeT9kRWbzOkMWAm20DMRA+swMPYiuDR/X7+9Iry54WtVrV29GIrfgu1/OCdzNGDsMMIBeWPQwXg8fysLu2vnYNnRYtoM2pX6m5H3PD0n9Ufstr6jz2P+5ni7/LtojOkv8v5w6FVEnEgtJRNL61daoagmyJubj8/uHC/xyFYNkGrnGL06t4Ol9PzqdqQxNR73LSK8Jk5BLULyHSMn8pUsYKrXwSaDvXbx6w1rR4yQw3yb7J/glrRs2GKU5HxQ5VjGXMTHzJXCpZzhNbO95Lt+/jkP8mTIY9/3gjsKPOmGcjcUv6cQtiPqGfjXbpx62U4ZXuP8Ya5c8j7Uo5xDGVhOmJAP/LZjVZuBstWjYo6dqc9WbnEBxUS0IPeWgIhLIQRCxCGu1x4tNTcMCxOb0lYQVCjejCOLVtX70X4u1epVUXpFrnZSA4XFLms/7UpcauyQTHYQ5qSGNFq/y487KM7GgSVzTHatl7Bm0n6hgWy2jgrfHDGo2aH7j3SUb/Zgue8YU7Zmnk2EHZH3Pwy32+QpOlF75X3AfwoIaCL0ngtQolN+3s0b5+L3+eHilyn5ulKXi+j4eLVPCVQMaccBu3t4FhDBcMKQ1NCg/5PDCd2TA0Fiwu/U8KLoZe+bRGPJhxqCeS8b09/xCymfo0b7LyiGDPFmlmz6OCKC7TNT+zUvcsWcEWrEsBKAY+5Ex2+NY8UGkLmCT3+cqk7C5QY7Ry6Tsa7Z7b45ntRMKCdqPh+xKjwwxck1ikcdTNGi6ydlg3/4Dzw9PtAoYhG4QpFOJE5/4KUJxZZfBIQw2Qo/G0cCm8+kw/z1YKQlhRCUQsDbansyyxExFP1xZEyUQMOnk36EQgByvy/11dIYqxMgTIiRWCspsqhJyYCh5/QGO6jhOI1T8jdZGwwJ8i8i1h5drtZw93z6fP1gwVEq92RBbT8K++O6xQCtGPwO1kn4VQG51qLOI3HsHRebyLFBTQvkKrDysH0Nz98KJP/iMUORlAypASSFLh7LBK+R3nE9Kg== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 211858a5-fcc4-4122-1483-08dbd6b59354 X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 06:25:55.3980 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5571c7d4-286b-47f6-9dd5-0aa688773c8e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: FXnfOtl8jh3PTCJNbh7JzNk6xNP/nyarxuSIEShFKxUeBa0kDLgIIe2RbePpvMtk5KC+DU/xy5pJOIGfW8qQJdSYbUc0Bj5LD3Ky79x0eX4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR0101MB3696 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 23:26:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780888890277514694 X-GMAIL-MSGID: 1780888890277514694 MOXA PCIe RS422/RS485 boards will not function by default because of the initial default serial interface of all MOXA PCIe boards is set to RS232. This patch fixes the problem above by setting the initial default serial interface to RS422 for those MOXA RS422/RS485 PCIe boards. Signed-off-by: Crescent CY Hsieh Reviewed-by: Jiri Slaby --- drivers/tty/serial/8250/8250_pci.c | 58 +++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index b2be3783f..66a2450da 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -1968,6 +1969,20 @@ pci_sunix_setup(struct serial_private *priv, #define MOXA_GPIO_PIN2 BIT(2) +#define MOXA_RS232 0x00 +#define MOXA_RS422 0x01 +#define MOXA_RS485_4W 0x0B +#define MOXA_RS485_2W 0x0F +#define MOXA_UIR_OFFSET 0x04 +#define MOXA_EVEN_RS_MASK GENMASK(3, 0) +#define MOXA_ODD_RS_MASK GENMASK(7, 4) + +enum { + MOXA_SUPP_RS232 = BIT(0), + MOXA_SUPP_RS422 = BIT(1), + MOXA_SUPP_RS485 = BIT(2), +}; + static bool pci_moxa_is_mini_pcie(unsigned short device) { if (device == PCI_DEVICE_ID_MOXA_CP102N || @@ -1981,13 +1996,54 @@ static bool pci_moxa_is_mini_pcie(unsigned short device) return false; } +u32 pci_moxa_supported_rs(struct pci_dev *dev) +{ + switch (dev->device & 0x0F00) { + case 0x0000: + case 0x0600: + return MOXA_SUPP_RS232; + case 0x0100: + return MOXA_SUPP_RS232 | MOXA_SUPP_RS422 | MOXA_SUPP_RS485; + case 0x0300: + return MOXA_SUPP_RS422 | MOXA_SUPP_RS485; + } + return 0; +} + +static int pci_moxa_set_interface(const struct pci_dev *dev, + unsigned int port_idx, + u8 mode) +{ + resource_size_t iobar_addr = pci_resource_start(dev, 2); + resource_size_t UIR_addr = iobar_addr + MOXA_UIR_OFFSET + port_idx / 2; + u8 val; + + val = inb(UIR_addr); + + if (port_idx % 2) { + val &= ~MOXA_ODD_RS_MASK; + val |= FIELD_PREP(MOXA_ODD_RS_MASK, mode); + } else { + val &= ~MOXA_EVEN_RS_MASK; + val |= FIELD_PREP(MOXA_EVEN_RS_MASK, mode); + } + outb(val, UIR_addr); + + return 0; +} + static int pci_moxa_init(struct pci_dev *dev) { unsigned short device = dev->device; resource_size_t iobar_addr = pci_resource_start(dev, 2); - unsigned int num_ports = (device & 0x00F0) >> 4; + unsigned int num_ports = (device & 0x00F0) >> 4, i; u8 val; + if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) { + for (i = 0; i < num_ports; ++i) + pci_moxa_set_interface(dev, i, MOXA_RS422); + } + /* * Enable hardware buffer to prevent break signal output when system boots up. * This hardware buffer is only supported on Mini PCIe series. From patchwork Fri Oct 27 06:24:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crescent CY Hsieh X-Patchwork-Id: 158772 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp397705vqb; Thu, 26 Oct 2023 23:26:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFKLVnMzdd6XCy7Fce98P23VrpsrYe9qSItTnXU9o3py/n+vbjIhsjBaVeykpW9LLRN1H+9 X-Received: by 2002:a25:aa26:0:b0:da0:338f:794c with SMTP id s35-20020a25aa26000000b00da0338f794cmr1579221ybi.60.1698388003339; Thu, 26 Oct 2023 23:26:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698388003; cv=pass; d=google.com; s=arc-20160816; b=MoYjrH03on/u1n36DQyz5lq/TrjLFrKj47fQgJt5c4yDoSFxuXipsksOsx/dGsJ26w oNGZ0j94dpjmjiN2ry1U1HT+TH2LrRL3+FWX/ls4OtDlyWrASkp4BDLG22yRpXtiRdb2 EN+cpcN9klwBmDRamjWy8LIU7e8NZxFZYDN6XcsR+OR/i+ElVrTViiJgHeVVl9NuZP1M KvsHLDebYngzAbff9kmKlf6aOJdvPMZnjJKHzkF6OC4qsBVjKnxqOKVD76m818RcZaWM Cbf+LMK+FL2n+y8Cei55OL4aPI82Kg9ILwqhvJtoQ5LA4CW+WBQ13bDYGse6S5uhQFD6 bK3g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RQuwfcdwvDk7+NEdwyTeLgQHdxtao0W9cy9DzMlH1RI=; fh=9IbzxucUBWcgEvhe+WtoxtT+FpcGkFAf3REsKls7q2A=; b=bczXIz8ZZKP1Y1tm86eqLhcoQPcRYqKXhKUm9Bdnodhm7+ii3i/ePygmlDVZveJhHl sJcUeko6KyGvuIL7yZEEDPPQZ8rohtNpGQB9TJZ3l3guSvmqV7Zg2o3Bzdx20hQoOB5Z jqJd/lF+3ovzfv/Hf7asX/WtHy/jyw2Ke2iq6R9oKQfF/vBJw0hjVKLv/wYxZZkP5H/p GrVmZGo2l+xvxnse1SscL9YjxwktPBX1FWgM2dyfc0Jg3OdfIB4h+vKO3S43bBfZrPNI /JQnEdY2ePHCHvFgPpyDRTDpFFFs41Y7mBT7WjZ7QDLPihmx/q6kLAF/BofC4Ea4Wd4m CnAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@moxa.com header.s=selector1 header.b=FRKhQe7z; arc=pass (i=1 spf=pass spfdomain=moxa.com dkim=pass dkdomain=moxa.com dmarc=pass fromdomain=moxa.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=moxa.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id p13-20020a25420d000000b00da160dbe3a2si1212000yba.355.2023.10.26.23.26.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Oct 2023 23:26:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@moxa.com header.s=selector1 header.b=FRKhQe7z; arc=pass (i=1 spf=pass spfdomain=moxa.com dkim=pass dkdomain=moxa.com dmarc=pass fromdomain=moxa.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=moxa.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 0398D80234CF; Thu, 26 Oct 2023 23:26:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345255AbjJ0G0S (ORCPT + 26 others); Fri, 27 Oct 2023 02:26:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234971AbjJ0G0O (ORCPT ); Fri, 27 Oct 2023 02:26:14 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2081.outbound.protection.outlook.com [40.107.255.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C08C3D55; Thu, 26 Oct 2023 23:26:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idjKXGqN3iD4/TreW63PmmXu3DazHdjN5aix2HCAP8Kqm98gUvBMEx6XKFJ23I8Ejrd+FpIY41d3Ub735gQFKCcui+aMj80/4Ob+H9J1HNz/WmK2bIsdDbV9m47WvIo6+/FEZ10eHidsDwNFeDc3mlxG22w8P5iEQSJN6+pbfNLvAl41g/86ZEs9gYKvvEn72RQU7y8HSKl4fcc78EX3s4QC1aFvpsVwTm1Ux7gdKkPR6/QCh6mqSOOPZ66n3jybwOF6D/1Io2lg7GTa1Yu5pQQBSr3xsx5sMcfFGd6Lsc8dk/FViL2KBOTrKt4l8dojxMLEySpAEDinfV7/4QXGog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RQuwfcdwvDk7+NEdwyTeLgQHdxtao0W9cy9DzMlH1RI=; b=mtKd3GVXf9j5+dEeiVIcM5FVqaU0tMllDHhBu/NlJy03/sHC6bDpNVI0clxX3Ujf/KBuUJEACSyk4y9wsPIXng4zmZgveAcKHKanYdytojxRxhEcdoJscHExhKE/ZcUxkq+ZiI3QVZenSI5x0392D6GkiLAzCrQ1ciDLgd+CO2IioFWotMUVXNhrCdu7isC0PavK46hDbtjtTwsVrcVtRJQkLO4/0WI/HXsxJYeEvA98n06sr0EqasGxbUhQE5VUEFDuv6H24G7PL53wfQcYEwN/OL95JNu7N4UYZDKRzjRCr6R9yQ6lZ7PbupqYu9cNvqxoP4ElQMNLjtv/cO4tqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=moxa.com; dmarc=pass action=none header.from=moxa.com; dkim=pass header.d=moxa.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=moxa.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RQuwfcdwvDk7+NEdwyTeLgQHdxtao0W9cy9DzMlH1RI=; b=FRKhQe7zTPwCfR9Wqm9+0EML5M0mRZfn5NR1UrR97kTTye1qQEmz08DjJXL2dyUngN7UCy11wkmHrOWjnYxV69irh8IGIaB7LjBvMd1IwuRZNmBm4sEcOg/rpnWyyC3SzhazHi37KnWaimz9fuAkdyjZ05rl8VSchVj/KfrT8Ng= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=moxa.com; Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) by TY2PR0101MB3696.apcprd01.prod.exchangelabs.com (2603:1096:404:8009::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.23; Fri, 27 Oct 2023 06:26:03 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::7723:9ad4:633e:fe0d]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::7723:9ad4:633e:fe0d%5]) with mapi id 15.20.6907.032; Fri, 27 Oct 2023 06:26:03 +0000 From: Crescent CY Hsieh To: Greg Kroah-Hartman , Jiri Slaby Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, Crescent CY Hsieh Subject: [PATCH 2/2] tty: serial: 8250: Add support for MOXA PCIe boards to switch interface Date: Fri, 27 Oct 2023 14:24:40 +0800 Message-Id: <20231027062440.7749-3-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231027062440.7749-1-crescentcy.hsieh@moxa.com> References: <20231027062440.7749-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYAPR01CA0119.jpnprd01.prod.outlook.com (2603:1096:404:2a::35) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|TY2PR0101MB3696:EE_ X-MS-Office365-Filtering-Correlation-Id: e3b4dd18-f1d7-46b4-8a52-08dbd6b59835 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bu22/YizHU4jC+pmxw3EqB7iGvTACbxDapteMjAXD25kmGnECAcbirWkYmhDzab/6bVtQzq6K/MroKMCkrFxyh76E6vyTJ8mAgBAKBLn1MXzQnfXf3qsjoqlap9sB+gHUwml7LTeMVwOeiXrXhvOG03qZvS6fWHqUe/xHz7IVQyHc5B/qYm8Ov1DacoLOK6AXAQpzr85UvvMOV5gHiQ8936O9kj+Zda3TOJeDPKR7eElldu4nC/VF1Fz9+M+j9qNo8sg9oGS4E/ywhEKcsuYk2SWiYNBvFopqKfRi7Xs2ybMUUoa2EUu9Oa7cmiB1yyy449nEzWZBDAZyLhkZeQ4BR9XITA+Y2MPtVi0vyUM1XUJIhq5dRAZm5IhLpk7qALdwyjP5utBFasCSWkJDtAzeL5SHY74MlCbrWBx/pZ9JmHlyK2Eb/0nt8ohipkknlOhvmOhl3JpBVp3xZXQ3wUeTowp6VADtKvYLmvJjxlnPUPcFKEzKr3BAZQHT57N5yJUX2uGWV0sTbNlFuvhdjX2QvOgc1Bl3beEm7rhttWPkx4pPMtsocokKAKF+I2eCQn5nD/ANMhRHEcKJFP67gPTajES1FDoe+FnX3gAfBnif3FWZiaThyOCt7oHKt4kvZgo X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR01MB5405.apcprd01.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230031)(39850400004)(366004)(346002)(376002)(396003)(136003)(230922051799003)(451199024)(1800799009)(186009)(64100799003)(26005)(38100700002)(83380400001)(4326008)(41300700001)(8676002)(8936002)(66556008)(2906002)(66946007)(5660300002)(110136005)(66476007)(86362001)(316002)(478600001)(38350700005)(36756003)(52116002)(6666004)(6486002)(6506007)(2616005)(1076003)(107886003)(6512007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Jpncsyrj59C9Tn6OO88EsS1vgjt2A5Wabp3FikyB7xZyU6/0d/kpHmvrBhVKsfo/0tf8FIUYgL9i5EL1nPUeWzx1yNW7yCWGwwxUA/ri8QTBum6GV5sVgnznC1DITQllkT6/ScLNQi3E7t19BUKzhPFfMYO2WOLNJ7P1ZW/netUyHOGZZ8YqT6iKz677cFk1/84cexc0YtJ0natXpQZiFcHijz/EJQFT23YlTVXjFGs42Xp74r5W3QK0V9dZaLG4YalN6OuwjZxyjMh26KOA9FrbyMeAGXU2VrOzI/I/oBnok53jdq5ps1/OVnWEHDSOAbsMDUYOpcYEHC2gHhPH9P/F8MObdiLkYhMiN17YRPTlgsHQ1aksfHbGmMR4ljA16CtE4DiKjrtyIJnr4ldv5CG+Vl7aqMG6EJzcc336ippUkjMHzTMjRkjH/QcMcm28zRcGTgBkXCtmb/LOEp1zhFqGqQxSHCGAaQL78PM2oHAnOJDm2cNZJdHTX1yiskbQiyo6MjkXGbBRdcgoF2r8+nZPlZcHeRxl8RF5XD3hVIjl9bEsgbhPHhaQbslLyVPgh+v3a+r6hGfDZ3uWwcmJtHhSJV/kDiXgZEs7Ye3Gw36QT6JBZwOyAxZrm6jDxQQBQY50S5o+SgUk+660rQvX6zLssdgL/45hAfusrbX0Y3y4akAJxRdmwgL0vj6+Qa7Wr9esWXVvVGEndVGm5pPNdCKNp28hj6bLR5hSAyukAngkMpj1x1IrjsWG8GOsPyBiojuSutzWJ81pYP1ftWwQSxaWONZEHkU2xHzzlGmtGE4QA5bVATkVyeWf2ZZNDaOeAbGoiTKYEjsklhYfkyxb+5VqZfFi34lTUAp+M0pQ5uSt+eKckZilVMo+ZUm9n3+Hn8GQ+wOx4fZaAubzza3qbKLjcoDv3gE81nWUPpGwOl69g7gfaV0sOYRuHoj7Cv9NE8W2sN06OSLOwIKHoQ+CWPlMzyZrH8EQ9Q8eVvNfM6+FZWIDXLfA4pHzpfttyvRPstOVIPedBCWQGXsb/WhSh+QlRFR5+xFC9wZAQijQGI9cXUEZ6HZgiDr3OPEjAIoNNVTkgmRhbOjQdNvwtKVAoZbi3l1auJWiFoSk/J/M3tDrf9ZZT+NmkXvmFKkPS/5QdNXYIS/UL9LRGiAE5fA5ugfVoRn9FXhocuU0G5O4KtPFg4N3miCg4MxF2RyVRc6GEzaZFFnVZ/XN7muuBGDu0ANSIBrOjQEiAOquJ988db3wOtK7Vbk0TkyQaaxYOuI93EygJGmZzkFz8v7SMh9eF2ATE7/Awg4IPH/S8jsXt7qIYA0tv8/GcifTCBDvcF2Co51w9bc7RQztBtTzJngwys9jAaS9VTJiaQaCJRjbMTBn8kBufO3BZSfjqnyifOBqteNAAyI509/grcQsmzdthc3r/0o15Fd26JNdgDryGggMWW1zQajjU3tmlI2oGooWunzSyCWhh4bHHzth0zcBuKDuV79AD6s21mkhrcMhzevFKYAqo6waYe1kJgx8zyxeDsNINcs9dgk4ppgKZrzWhNZSp04dQbHbs9kGkGNGNNbgQn8j2bMwUIB0nNOi9dHC2SX6rCnahiNYMQykqQUP9w== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3b4dd18-f1d7-46b4-8a52-08dbd6b59835 X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 06:26:03.6145 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 5571c7d4-286b-47f6-9dd5-0aa688773c8e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 4mA9LG0GyX6E9YVWU4IBbVCJNC4bPGsCQCjZcGPj8d+ZPSbCPaBHlfewfSD3szf2McENJE26mNxB2RKjUxnE5qA0Nh4XKbUNIojHn/0Y+BI= X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY2PR0101MB3696 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 26 Oct 2023 23:26:40 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780888898471484439 X-GMAIL-MSGID: 1780888898471484439 MOXA PCIe boards have 4 serial interfaces and don't require additional stuff to switch between interfaces: - RS232 - RS422 - RS485_2W (half-duplex) - RS485_4W (full-duplex) By using ioctl command "TIOCRS485", it can switch between default interface and RS485 if supported. That means, for RS422/RS485 board, it can switch between RS422 and RS485 by setting the flags within struct serial_rs485. However, for the RS232/RS422/RS485 board, it can only switch between RS232 and RS485, there's no flag for switching interface into RS422. This patch adds a flag call "SER_RS422_ENALBED" in serial.h and modifies serial_core.c to make it possible to switch interface between RS232, RS422 and RS485. Signed-off-by: Crescent CY Hsieh --- drivers/tty/serial/8250/8250_pci.c | 44 ++++++++++++++++++++++++++++++ drivers/tty/serial/serial_core.c | 21 ++++++++++++-- include/uapi/linux/serial.h | 4 +++ 3 files changed, 66 insertions(+), 3 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 66a2450da..6eabf6bf5 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1983,6 +1983,10 @@ enum { MOXA_SUPP_RS485 = BIT(2), }; +static const struct serial_rs485 pci_moxa_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RX_DURING_TX | SER_RS422_ENABLED, +}; + static bool pci_moxa_is_mini_pcie(unsigned short device) { if (device == PCI_DEVICE_ID_MOXA_CP102N || @@ -2032,6 +2036,37 @@ static int pci_moxa_set_interface(const struct pci_dev *dev, return 0; } +/* + * MOXA PCIe boards support switching the serial interface using the ioctl + * command "TIOCSRS485". + * + * RS232 = (no flags are set) + * RS422 = SER_RS422_ENABLED + * RS485_2W (half-duplex) = SER_RS485_ENABLED + * RS485_4W (full-duplex) = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX + */ +static int pci_moxa_rs485_config(struct uart_port *port, + struct ktermios *termios, + struct serial_rs485 *rs485) +{ + struct pci_dev *dev = to_pci_dev(port->dev); + u8 mode = MOXA_RS232; + + if (rs485->flags & SER_RS485_ENABLED) { + if (rs485->flags & SER_RS485_RX_DURING_TX) + mode = MOXA_RS485_4W; + else + mode = MOXA_RS485_2W; + } else if (rs485->flags & SER_RS422_ENABLED) { + mode = MOXA_RS422; + } else { + if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) + return -ENODEV; + } + + return pci_moxa_set_interface(dev, port->port_id, mode); +} + static int pci_moxa_init(struct pci_dev *dev) { unsigned short device = dev->device; @@ -2067,9 +2102,18 @@ pci_moxa_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *port, int idx) { + struct pci_dev *dev = priv->dev; unsigned int bar = FL_GET_BASE(board->flags); int offset; + if (pci_moxa_supported_rs(dev) & MOXA_SUPP_RS485) { + port->port.rs485_config = pci_moxa_rs485_config; + port->port.rs485_supported = pci_moxa_rs485_supported; + + if (!(pci_moxa_supported_rs(dev) & MOXA_SUPP_RS232)) + port->port.rs485.flags = SER_RS422_ENABLED; + } + if (board->num_ports == 4 && idx == 3) offset = 7 * board->uart_offset; else diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c index 831d03361..e4ea0e428 100644 --- a/drivers/tty/serial/serial_core.c +++ b/drivers/tty/serial/serial_core.c @@ -1305,7 +1305,7 @@ static int uart_get_icount(struct tty_struct *tty, #define SER_RS485_LEGACY_FLAGS (SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | \ SER_RS485_RTS_AFTER_SEND | SER_RS485_RX_DURING_TX | \ - SER_RS485_TERMINATE_BUS) + SER_RS485_TERMINATE_BUS | SER_RS422_ENABLED) static int uart_check_rs485_flags(struct uart_port *port, struct serial_rs485 *rs485) { @@ -1371,11 +1371,26 @@ static void uart_sanitize_serial_rs485(struct uart_port *port, struct serial_rs4 { u32 supported_flags = port->rs485_supported.flags; - if (!(rs485->flags & SER_RS485_ENABLED)) { + if (!(rs485->flags & SER_RS485_ENABLED) && !(rs485->flags & SER_RS422_ENABLED)) { memset(rs485, 0, sizeof(*rs485)); return; } + /* Pick sane setting if the user enables both interfaces */ + if (rs485->flags & SER_RS485_ENABLED && rs485->flags & SER_RS422_ENABLED) { + dev_warn_ratelimited(port->dev, + "%s (%d): Invalid serial interface setting, using RS485 instead\n", + port->name, port->line); + rs485->flags &= ~(SER_RS422_ENABLED); + } + + /* Clear other bits and return if enable RS422 */ + if (rs485->flags & SER_RS422_ENABLED) { + memset(rs485, 0, sizeof(*rs485)); + rs485->flags |= SER_RS422_ENABLED; + return; + } + /* Pick sane settings if the user hasn't */ if ((supported_flags & (SER_RS485_RTS_ON_SEND|SER_RS485_RTS_AFTER_SEND)) && !(rs485->flags & SER_RS485_RTS_ON_SEND) == @@ -1400,7 +1415,7 @@ static void uart_sanitize_serial_rs485(struct uart_port *port, struct serial_rs4 static void uart_set_rs485_termination(struct uart_port *port, const struct serial_rs485 *rs485) { - if (!(rs485->flags & SER_RS485_ENABLED)) + if (!(rs485->flags & SER_RS485_ENABLED) && !(rs485->flags & SER_RS422_ENABLED)) return; gpiod_set_value_cansleep(port->rs485_term_gpio, diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h index 53bc1af67..427609fd5 100644 --- a/include/uapi/linux/serial.h +++ b/include/uapi/linux/serial.h @@ -137,6 +137,8 @@ struct serial_icounter_struct { * * %SER_RS485_ADDRB - Enable RS485 addressing mode. * * %SER_RS485_ADDR_RECV - Receive address filter (enables @addr_recv). Requires %SER_RS485_ADDRB. * * %SER_RS485_ADDR_DEST - Destination address (enables @addr_dest). Requires %SER_RS485_ADDRB. + * + * * %SER_RS422_ENABLED - RS422 enabled. */ struct serial_rs485 { __u32 flags; @@ -149,6 +151,8 @@ struct serial_rs485 { #define SER_RS485_ADDR_RECV (1 << 7) #define SER_RS485_ADDR_DEST (1 << 8) +#define SER_RS422_ENABLED (1 << 9) + __u32 delay_rts_before_send; __u32 delay_rts_after_send;