From patchwork Wed Oct 18 09:17:34 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: 735442 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CF23CDB47E for ; Wed, 18 Oct 2023 09:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229714AbjJRJUl (ORCPT ); Wed, 18 Oct 2023 05:20:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229730AbjJRJUj (ORCPT ); Wed, 18 Oct 2023 05:20:39 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2072.outbound.protection.outlook.com [40.107.255.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801C910F; Wed, 18 Oct 2023 02:20:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mDJDBVckLy1K8NEikbabVdKnFaH0dyv90IuR3/LzyE+1jTGiPoXZBHAG9SXsNsPPu/ZKOKTvCSJpJWZp+Zymb41lB1q/IYxA/HYuingv+EobhRDdcQQiLmp84h/lelfSk7hZxMQtsXs9eJFxl5sbZ69EzOOvP6MLYFUl2waIawVFz80xtfgiq0JjrNkJDyFjzFB2ZvD92wSOjzYhtpAQn6crRH0oohDwhEO5Qt/dSozSyAGtdoQHaOi99/ishozu0omvjI+wUTQX01i7tfbKIZpSxzF6sWGXrEAumjF1Nn2Jc+ar8FiItwF60XlJDjVJTeGwVCl5FyyMtf+0JqutQg== 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=Oodax8TYaAzJcHOXnEnNzRPLBGK1BDY6xVNguxVBo6A=; b=cAVGj/6NHdGgeNoUZReLWkYlkqse5np4cW4sByvyb3YnDFl8P9shYjBnkdsmh6LsBaDY+LRCT83lTZoyayToObN+A6/lQXADpeOe0KG+SVFtBoLpoqYyW0Xzvkz3KmaruawpNnkZwk8ud3xcHPxmZtH9QLchT90pmPxHQnoO2qTQR9fIXL62JGVlcPyxGpWnxMW43UsBYoKIYy7caP6tjsKBtbk21TE4pxR+lB3r9RxRvPPDHgj/PQ1Aq8JnsW5A6XWj3xszC6Ut00gyDVQD4+NO83BN97ZE6H8eQ7S9HNV9Ba2GuwNVmzs+y5tfTpKM/stm7/jvK8Ji4z7NSVIUFw== 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=Oodax8TYaAzJcHOXnEnNzRPLBGK1BDY6xVNguxVBo6A=; b=cARu6GaM6p/ufDLEtiQrIe9qOnJ4bdl3/OOhcVnrGpIB85OfEPc/UAY247yvjz58LFSIEIyJjKJAdtUA2EGa1/FStl9PNQ5FrtYLBZqWeIVsw1//v9BudhveayJCdYWN24LNJWp0oyGcogX2XHLgZDLa4Q6475TXQJZ+g3CMSwo= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:34 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:34 +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 v3 1/6] tty: serial: 8250: Modify MOXA enum name within 8250_pci.c Date: Wed, 18 Oct 2023 17:17:34 +0800 Message-Id: <20231018091739.10125-2-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 954625ac-2f3d-45e1-353f-08dbcfbb7bcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6b8oVn1HwT+1/kh1l/FMXfQ3f3QbIDi7RfXFApn3gKh3K+BR10edVHEhD/9/gCgGBdYegTth0Ih8cIxUzWeMYEkwjtHdt9YkQssDNbkASRfKEVEZZ1kcSbyUO55cVc40J58OEfLO6VXfZGRBv3z6eT606oJcnUX5KRhHQtRLlskznf0Ul3Z4JRVWAFmSYHzekw/IjAd1twvACmEGJG3o81plQuCkBTUkLlSsk/rktcaJuEKl7sNO+x54FkODtHXn8QxyzUOkGYYrFc62QK5ZrCiwUkwXp8H8Ha3Wz1bfWPndkSGr6XFUFt9KYMF2mVJPcVSEV7Vlvp2ewHXD9oTDdFBiKxli9l7nya2RwqHMYVOdJBizPnoSdX3ekjiC48qmE2KV4e/PGSekmJc9pq8N++GXQn8wZaMCUN8lFSuLKwnlyH1VDcR6g+DYZTt8eaCM0w+vxYBOU6KLc6eey00/XLeGX/fNqz6VusJ7atJKE86zoIN83YH9C/FA41UUWQGFdlW97KwYCyTaizX10fty+/nmRrfXX67KKAwmQ0i4w/hQKrLf/fK8R0O3XZa+Shewa8B2UqT/GjH33I74O4ouDh46/nut/6CbOYkoOyfkqCbTGpWqrPxM1xzrytfJ9rSw 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(83380400001)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TK0JNDWCD86ocSQs3g1M8GgB40zBSZ1+T/9L3UkZ0kyHAPvu7fuiSSTHP7mBNzdw0Oci2k6eYSJCfcVM7FY6XQDiUnyGqm18xmyKm/bcBIL9Cz+YJch+EHNMFJPgU9IcNL3xhra5oVgdEDCikehaZqokuXroLEJt/AjgO9jOPDpqWGX4Gs7NFUgHrVCHgIj1rlKUR3lkqacNHd8h5vaIe1NokT+5pvGN9Kv3YRfj4yBaH8sSgt4tVtReb2JhbPFmNsFPwLNU5fC9xJBv0eLGt3ewataYbnPejqB64mu8HfYGhjAm9zgy3crFrDpq7QV0fk+sGqmnvUKBrZ7Cv6cVY8SWy0YNVVK1BhTzus+t23EsfNywdqgUMyC9B//cJ8oLKUXnvoQUZHEe4pIKvQjJlrR/aYdrj90mH6aaPM25ZIKRhqYJwS2zKYthIFEE7o1x1nAKr++T0nIEe8q2qoXtEyaynKMqGI+mJN0BWQNT3EiZ+j3gnhRz5Fr9UHZcSELEyJVp0jUHxHpy8AqVqjn6UlYD0X9Xjw0tyWVhK49yKY0vmVlziRQaAzKn8MiEo2whkIgqaaAbMjUCMaQ+4la8C22QYd9BCaHHPwOHu+83xw+rqzkPzoY9XxH383NL2T9CWuivOucwsm+0qSK5WsUEhJSJgkMHG3dyC0cuZGTGnfJzHN+2+4Ni/tJdvEf6wGwrI0ZqSdo8fl518sbaili3HsoV4G3HMPma0Z/y7rza7Z2fU4LlaghdB31G1lW6P2gKDcivyR4wYPbyu5Bp1fbGr7CWAXZuQDrp2KPZjroHoF9f2Mwmwh45ys+X5YIqgUxKAy1zvltX92eZ1ZUvKlY81gCSG2eo/14V0GdxRtsKT/M0IC3kwQ/GNPcVyIUydbjaO8g3Rx17gkgfNTjVrYYoxqbap2aUNNFd4Fk+Jwgc+kyMPv8LVkS4FxVRdVCXmR76Pc9fTkdXQHCf4TyxnEoVe8PPmyeFThRiOlBI25MtwR8/Ghi0IempcjM7MrcCsX8boufv7xIC8cARW8bG0VZB+BSHSU7P0Le2g0lmHJjfz+JcaWZQbVqz0L+eJzMqD/NaoMAH12LzmCaw6JgTzzuVyPGezGS8PzPZhEX+FqZApBwr6ACLgly3qOsbCe6fqnuuwkTfFfzTEx1EBbVrgcPnvcKnhnyR+gOBURzWezDnVbh2xWH8m4xK05bgbiAZbZzJtktiJpscD0mnjg5OKcAoZ2mezkmRqHL36KB6QSBvdt9fXATyVTmj/ClxQ9qXBs7GTM/hb6SRjPdUwyvHB4UaG9ZeXFdQ43BacaASDmItU/d833X/KhbLMUzJgqBHzK9p0vj81iWt2LQdAaSlfsyMKl47QdeeuhXTmresZTe0HJPvtJXULXJIZ8fMD98BBYl0kJNkjNIdkv3Qf045zSKAQO4UOffn0zqEaT+g+Rk56trjB7R9yQ9Kh/j/yfElJvmEhNTiIkYyKbwHxyVIgr2Cazciymx/+d/1mF7AW9nxDU/ecrKPhQQT4bJHyHaz3v/WjP8G1+kxQHFG3+TqS6Ix+g3X5PgIzHSr1pxrwtD7pSOHR2o2OjhZYX75+/eWtBxg9Uko85KwQu8njgTbzzVLeQ== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 954625ac-2f3d-45e1-353f-08dbcfbb7bcd X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:34.7084 (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: tuKw96f7kepiEouojW0YhrukvutX3vx/o3g+lmmwkGBqhNKQmo95iZLv+FP7H7bDXk8+9sJK4vBYDYRD4RXCDo+ZKgOOwl+r5EjBjFz2QCM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org To improve clarity, modify the MOXA enum name within pci_board_num_t. Signed-off-by: Crescent CY Hsieh Reviewed-by: Jiri Slaby --- drivers/tty/serial/8250/8250_pci.c | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index d2d547b5d..b052b286d 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -2852,9 +2852,9 @@ enum pci_board_num_t { pbn_titan_2_4000000, pbn_titan_4_4000000, pbn_titan_8_4000000, - pbn_moxa8250_2p, - pbn_moxa8250_4p, - pbn_moxa8250_8p, + pbn_moxa_2, + pbn_moxa_4, + pbn_moxa_8, }; /* @@ -3626,19 +3626,19 @@ static struct pciserial_board pci_boards[] = { .uart_offset = 0x200, .first_offset = 0x1000, }, - [pbn_moxa8250_2p] = { + [pbn_moxa_2] = { .flags = FL_BASE1, .num_ports = 2, .base_baud = 921600, .uart_offset = 0x200, }, - [pbn_moxa8250_4p] = { + [pbn_moxa_4] = { .flags = FL_BASE1, .num_ports = 4, .base_baud = 921600, .uart_offset = 0x200, }, - [pbn_moxa8250_8p] = { + [pbn_moxa_8] = { .flags = FL_BASE1, .num_ports = 8, .base_baud = 921600, @@ -5349,40 +5349,40 @@ static const struct pci_device_id serial_pci_tbl[] = { */ { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_2p }, + pbn_moxa_2 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102EL, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_2p }, + pbn_moxa_2 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_4p }, + pbn_moxa_4 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114EL, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_4p }, + pbn_moxa_4 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132EL, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_2p }, + pbn_moxa_2 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_4p }, + pbn_moxa_4 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP138E_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa8250_8p }, + pbn_moxa_8 }, /* * ADDI-DATA GmbH communication cards From patchwork Wed Oct 18 09:17:35 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: 736153 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63A2ACDB47E for ; Wed, 18 Oct 2023 09:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229843AbjJRJUz (ORCPT ); Wed, 18 Oct 2023 05:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229768AbjJRJUo (ORCPT ); Wed, 18 Oct 2023 05:20:44 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2063.outbound.protection.outlook.com [40.107.255.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C5DD10A; Wed, 18 Oct 2023 02:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UM18QL94AzFwP+uVPVftIbAcAB8K1fqRN8p8Ht1oC89FgOkjjpp2ldUqA1TiuBjnekHjM5F8h+JFr2982xNVJpJUmyaAOEkmLFr4LtxsuWo/zoQhIit0Fcdhjy0/17EsZmSXjFAVHuOIfCYK2aqGCogkHBuN1E5PwA0mCNobfyjpVESVbIdctvVaCV/sG4EJFHpYrPo+rCJ0M3C/7FvHeFSoo5ywwsDZeqN/XZEpzX2+iW/5/DGTBDjLgzO96VOg+GB0XdNCQctIkYQ3PPHbeUSMCv7NTbV0xf+21aybBJekAVShYSqqKHajOBRZ+vD4QaUmW511yZ8EQDePYlR5og== 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=bFmq/ENJYZJi+NSo7Y4miczWqQlQBePonSODucGF5ms=; b=Pt4kSxs+18CVJbvPa6Rdal2wg5q+2+8/BiqBMJSpr5gonFhFL/vEfcCnLNiHnb/hWOHuKgoDmVzC7/B/wWYEncUi43grEubB4kuz50v6ueYHbPPJ50gxQqttX1x+ckG2Cfws83EdktE3L/rWPPPkua9FW8MwEzDNxCQoKuOiz8O4gfL5aumqxGEcmb3dYG3GI7p3mx/acpUU4XSDNwjrK0kyYsPPqd4mnPuv8b0UmJIcI+j5iITCJI4DqG0Fz2iOOVY7RMY/xnjcTEVhWIX5quhTKd8INRSqSKxcCSucoNNZub+zUcbDYfCLnwbrEjWIcxPPGkyeLGKiMxGJrALtrQ== 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=bFmq/ENJYZJi+NSo7Y4miczWqQlQBePonSODucGF5ms=; b=KnT8n0Ee5jeRadCVzaL1+aWlvFykbsvurPMM0Rqe0OItNngVPBLu5rOn2Je4R7rYiAE4Rrq9q5d0EchQ0GgCZE0rKEbQJlIX+B176+g+qaC81sF+L1JoO92pQUEL/PPu9TgciIBGShNo8KtKaAMjc1T/4U/YSn11/WFc9sz3zZ8= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:38 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:38 +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 v3 2/6] tty: serial: 8250: Cleanup MOXA configurations Date: Wed, 18 Oct 2023 17:17:35 +0800 Message-Id: <20231018091739.10125-3-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 64741064-a20b-47ac-6734-08dbcfbb7df6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: v0QfhKrp+7i9Ds4AU12daXmFlIXsESCfK/VhRhrYnxcENnIkY2zPiDsmuAJJkx4a56m1g74GURCpz9IsUIJn0mmPMhIArgLJMbtKtIDmtzwyirSdJzrAFpyOnE3F9Dwljp5cZ985MQnPRekNRvDjiAdqILhWUv7UA6KroSkZTnvQKxgCHPlGkmh2FKzv8P39MwLFjqj05BxSvN4cIZtYFfHfWZtQD5HrKNdnQKQeZ80Ot9EPLf0RAQEA2ZvUQVOGsBX9t7lM5mZduq0J6/fWtcl5BA36mQkYrvIbGtI5/d/BTgVj8OHjUG1ccRyaSM8EHcX3tM1adL6OHWRZdUrZTH8D4Wg6zDDCNsfH/M1/ci6ROBY3SaLQ0QE6rKKpozBlyj47KJJhmm1HdcfykDBjte6c8A/EUQ2W8Uh8m8LoG0MqdV5lHpWAZ6RARQSqVJ+Fp4y+AVbjrlPRyF19v9LhB96VUANJd9HEuVm7kl2J/v1G3jmKHoVhkiScBI5duj6Veik92e57putRE4AU1mpDH3hnlXIXpr2BgM8eSENwXzH9blQZNSjD1sNIaSdgJU945jo7P32JIgfaKMbJZZXOujnqzV1jwQsLHEoVPi5TD0K6uwzgOT4KpbqNzmplzu+A 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6666004)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(83380400001)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: CRhjEFWI2xnfqL68gow+OcxjFWk0NX58FxDr9wxIREv7KNEbxb3C24BPtG8gV/JsGZtXFeiRAzPX7VW7Wy1u/EwwScubXFNIbbbehBH8hkT05S9hb6bymPmxjAQMKc3bqX+YYWpKbC2ulB3cmJxE0CQzXmSPK+RvRwerc35Lmqgsq9qsMlQHyUXA8DJnRNtER1TYp7yDArFJyHoBdv0nwBTbPqbg0Mr8Zl0n5VQyjXyNIfiDYjKCdNnpsKWfUdk/SsgNyJBzQ/co5lDuK5T8dxz6xUwdMa208kqGQVYD0cVYXvi+dwSzoltfjiO9heECnYYkho1tj3HAYYLxBTPt18fk8p/cat46t6meVcpDHhCYVx8jIJBlF8vluFf4hGDwGONUp7Bi5e8ZNDfWaBAkfR5hOdlu6KcldPQ5msODCMtACkFM/LWg86A3tlMHvopajrwyY8jJMlt0f2wVTZbtmjOvWfRbkjH3wyDEKJShyjGONQwtvu8KoMyA4sccEtcyapU3JhHRO7GRTYkM6WNMSg2yrPoHZtdZm5P7OAaTNgWisGdoOC8wD3jxRJBvWlqfQCmcq2pqTN3myj6mWB0aYrxPnPcAx3fpGr9ce3ai/SYkh8Cto1d1I8XerenRr+2REkDmNaOQDSXo2q/5YmQdJvnYjrHpr3XrAATnmc7o3X/Ey14fZvc+LWP67gxPIOlrkyleXxdI/iH8GnB5An1HkAEjb/Icap1Gq61+WRZfkEmDHzLrzCMme9TacZXYMaWocapTniy/Y5hErJlF2M0cndNrm6Q+GxBhWTYh2TgwLeD1vKDZGgw/rNO/Iwr/jFiZ5h2uBBchfFHAzDdnZd/V6b7m2I1nq0uvnO0+M5X2rv9S3cUI0xmYEL+M8XXs8R6XxcgnTfvfshmo7mVAb/Up+oAsVH3Lz+WDY5KL8+aaCU6SNR/HlvX7ROT/8PH1EX3w5cFZ3jkBI70Ug9ISTC/GIZolbdKWFGG51Tf9TIZGbxYppSE5zs64OEWoJp0kRP38Rj2l1b2KN0TTk6K3mlk95yOUtnNdr97g20gO7gdMPcFPXDrwwgfY+KQ6UxaVO8bswieaYvHbXIPzGE52GSAH5pgmvvJ9MWojGLLAxWD8t9UOVjI8ICvWyy4PZ7yucX+zzewcVw8fJPmNjcVioo+XL8UOGf0ynG1lFxKHqbjJSUoMKh835hnDpJ8unirpWfwZOvbSxeSkuuFDyYwn/adC3KtUF0onEBRnbSkN/hgmJYPvaUYdmlzUa3oNGQVc56QQqfE0MFVUKHtgLwxzTCqGu9GpPD5N9gOT/103RJq8bl4QTh0JX43VRve/aD4ex4+L6qPR6bcLm97nypaflFk4I43ErN4gHbexjoWMW+jtVL7x9X7o3V1IQ1lGk0puq+pGWTRbEJJm0bHGFryjwxr6e0zWWdIAHFUS7sda2llsa+8ASppycxAF6EfvH4BYN3IZeHhV5kybrkEWhTSpUvk0YRg9uVob3Xt1yHeMR7jmWnkoNbqMJV3uwQbNqqbIZETdibWZYCDv+hUo5iwSkhoX8TAuEtvVUCFCivIDnNXRfFYbXsDFz09dpKnMD2LDIIYnwRH4dm5w3KwcVAlcS2+pEg== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 64741064-a20b-47ac-6734-08dbcfbb7df6 X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:38.3636 (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: w85LRRvgtt3/g3UqVT1SO7Z2LWAw9o6ojk/XlD3sPHr7r/k2CFESDfIIjNVRq4koskTOczHORZBt7q1jAqXADmNMJjKur0c6pPMKv+LBtX8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org To improve clarity, clean up the MOXA configurations within serial_pci_tbl using PCI_VDEVICE(). Signed-off-by: Crescent CY Hsieh Reviewed-by: Jiri Slaby --- drivers/tty/serial/8250/8250_pci.c | 48 ++++++++---------------------- 1 file changed, 12 insertions(+), 36 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index b052b286d..14e2e3433 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -5347,42 +5347,18 @@ static const struct pci_device_id serial_pci_tbl[] = { /* * MOXA */ - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102E, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_2 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102EL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_2 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_4 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114EL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_4 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132EL, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_2 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_4 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP138E_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102E), pbn_moxa_2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102EL), pbn_moxa_2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114EL), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A), pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B), pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A), pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I), pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132EL), pbn_moxa_2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP138E_A), pbn_moxa_8 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A), pbn_moxa_8 }, /* * ADDI-DATA GmbH communication cards From patchwork Wed Oct 18 09:17:36 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: 735441 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61E6ACDB47E for ; Wed, 18 Oct 2023 09:20:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229810AbjJRJU6 (ORCPT ); Wed, 18 Oct 2023 05:20:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbjJRJUy (ORCPT ); Wed, 18 Oct 2023 05:20:54 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2063.outbound.protection.outlook.com [40.107.255.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00C33111; Wed, 18 Oct 2023 02:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b58SnlsDoB5vA2qagh13XTmj/uivpR6WHdPTRlT7Mo4LMdn1RGrGRIVFjXZmjO+hTcOl/6ec1Iu8L8sSGKddpEZ45Id7dHfGKnLUgf01AUyvZrUWNgal2tioQr8oi7vwNdqvviC652lDAQRBbXnbK7i2eabXUEOUBPe/pgEZDkhKoVfAUkyvLtQ/shb+D/uArndQuGi3Opop4gRuCzBhupJ9x4zwNE3QITA7Z06Oea+P4NlaT00wNIQ0Upiqod8doL+I5xF53MR3fwvlTZ8MqXrDnVP4bJLGfPWKtyboDYpeK18dtgKInbZIUv8zTpBIsZOyRnj1L08O4EpnsQ6kDw== 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=8TzAELGZcODFJp6UV+i3C2ZKh786FZQxrvBiAqGP6HU=; b=f5eLhJeeUt+BfGciePJXG5UjDHBnggVTu6d7acZ50h7V9lSorQnkIikIrOrW/rS1C2Sh9rN5UcdbUWlDgQ3sbIk8WMqgGeYkBqs0xkgiw5AF+7kC/pf6krvnvPeiqYX4cTdaUMBFg3cUqKIrgrpNSaWpPu0b4/KVWZrkrgqaO+sU/ilthRJVmW0lA1HOaptQ+5aO4cUa7fTIx+MXoOx2lC0CmwFzCgS/52E+JkjHCA1fZTRdDleiH4JfZoj5g9L43zvzw3w5BESQfJ6ehWLzWSiwuADS/y+RL4ZbcPGm5q3AhHau6A5EGiABj/bmGKSj1D0CuKfA4pQv4abH78BTmA== 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=8TzAELGZcODFJp6UV+i3C2ZKh786FZQxrvBiAqGP6HU=; b=SX4GdWDSI4me3a3lmMeMkU46KR4VdGZNR6BFysFrlP2rjKe/KXct4KBBgh2Oq01YH9h88QbrG4M9HQPDu898hYA39QlqCJBFSaLNNHdzUYgwLqIdgcmskCiGr8TSisBuUATeWYTYfKvrHz25BKMjXfrnVu+mqvwkjjVyDKjvwQM= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:41 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:41 +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 v3 3/6] tty: serial: 8250: Relocate macros within 8250_pci.c Date: Wed, 18 Oct 2023 17:17:36 +0800 Message-Id: <20231018091739.10125-4-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 877cc86a-ee95-4486-d5ea-08dbcfbb7fbd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: aV8JeNqComBQkYLjejEGBvtzyH8MAOOZrUPv34i5rq77pGahk0J3tcUQQpqEucXXricoTOvQrtXT29WPV7y4TfakVJQn4FHcdWt9f3BfLDjJ5Aqfp7PWyzdZOO8U3tbVp6W+eptioDz5hCG5uXezOrYi2fnJVpqrANHAW8EHUgymSH3lIui3HvwTCpqHzzWMk6O3u+MvH+kIzkCxkSI1KSjV/liXDX5ikrdV055GMUZby5liUACF9NNJpEEg9CTxNrAwb4D8fovooo0LRctpV+H1Im4CdMfexBadPIoh9ZXKFKICh/BPu61WERO6JK5AGc0bEY3Ov17UVT4gDjGZTnHkHHRxcP95j6MWmpWfyA7c6TH7IPbJQ94D+sN32+CrSvQoghIIDIqc+agLCy4JxrgJ9Dh+EyX0tFeC/aMDzzoLHLAXZmrzLJJl7WEoPvBaeOWNm7TNZn5dYjE7ot13DtUJQVud5TfcUjBZRDhOpvIJWzJMMRkF19bIDqhI/9QfqByBrdTHjEM5p+auk7hourI+Sczg99KxRHqNE/2qIhZWRVvTafBlQ09HPG5touaHp8zTjLvuG7V/B3JHoxAACLluu/3k0wmz+NfM5korAfE5JiDQdiOVTzR7WdZZzXhg 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6666004)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(83380400001)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: won8fXDPl4M86WYDAiGv9aEjdxxtCDIZc4bsoQ+tD/cJhkTpnvFD5o9SMoEH7mDfo2TTtuEpYvizfxETQ0NZDvTAHiMuLhbn5s1sGHza3VYhfWdqfDmgsamzXmuEGZKXWVYJEJVSdUvWyvKyEolrUGe701FCnmF3otPCigROPTcrCtG3N2V4u/VXsLZNWnMb5SLZr10oJqE5KIYj80dHqTgEbjtDVoHHSdyP5Xw6DDkqhiT6A5w/nGtCWEuf6ku/mUC71oTPa/RbpIsm4PMWCJEGXYGei1eN+GkdlOY4sdI3DihrAf1kcAWaMCi0RYM5Fw9/qMrmG4Vi1Lm27+YIm5GdKanXizd8mpCM5f09VP7fmTpnhKZlUZUsbvVDt5N1FvKrXmkPCxhwo07B2GlOho7AUBEDqsAHnofmfcvoHK/0x6R161Xw6XbrVz7pvZexiGoxbhwjczuiY5hJtVU1vFAMvvUoRxosi5DGlpPA1MEGLP7NnAudmiXXPuik/hNZxQqBcGxm4N4e74lPUV2f01xVoukZ2E4rCKEONhHWjPmJBfNXoNrHejiL/oO3iL+Sko6rXz/SMW4nVyFEEerW+iFB1WYd8wpp6fshCu88w9488IhRQvfzyMEH/p1jVumwAGMsmoixlfd1ovc8dDzcV01Wp4bCSqu8GKwVa6m2wkwV1yMRvL3GraB/WcvclBJcpBRfMp59wVokun3zjzJHaWxOL/Wbpqkg2HoMfRL5WWH766tqTIH5V9qPFiWC0JUdWOOJXjg4dxD+3hwWN2VVzPxOxu+UtN7F5xO3nMXivpyT4D+csxSvqNRC2lqhP9DeotIZc8JZRvcet8oYs2Kh74EbJ7tuOI5jg1MToITkktXa5bVIvBWVXCRQwiG4hodHRZiOveq6dgHxtJu8BD4hkORuY770P7v6OhTa5unWwqDq9IBOLrVzM8GZlWglH2QfKXPLJnDWtG8SNBC78CdENAr5JUxKzT1D0sljZYJVefCuK+pdLVFvIG16bTEk/2O8SrhzBRO94JIWl74EupEOIby1ZliqSrVjOI1n23ZRn+/WdWAc9Exmg/Hs/bWHIwpKpP8Ly24XGwMZwoHXvliU/nhk7MYT6MktyWHVEgkIem5lg8B+FaC2CU+7ahYLlEr4SGR5Ert1/62G6SEBEaeneeZfo8t2qTu1fkYa7OSU0a6OOMlm2dcoZooHhIOtAVj1KNLUOZb4YEX5qvEPY46GhkXigBMspCOoqH42PpuNEmagUbr3RTv8+xtf6phwrytwe/GitmAWWCxQoHrm2b+2j3LwqU50mFTs9ydtHd/UVtVbqtHL6LV5FhtThMYRkOHQoM2y8myG+4GxQopzzPiwHFr/d9ZEuuoSsdl+VETMYPDw218d/8YvGoFSgYm0ASQWJVVOSrTzYFTuND5AcpCoIzF4ZuzOXZpRwzzxMYhxVOtkF0Mqy6EF0kSTJFiJqMJjL9p4ZGk7mDwQEyhVsREbmTePLU0eYyt1gdcjp5dbBHgbR6uKTVcPpt4yUlI0ucHZ/VC1IvEZEwePiRP4YfXUKFoys2I8zdUGKqZhrj9hLWKX6WUGUbR2l2XncDRqr1ZXo+XKfM+KDEKVCA019VhxOg== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 877cc86a-ee95-4486-d5ea-08dbcfbb7fbd X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:41.3545 (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: ANos1YSXali1QFLv6WrZ+hhKXohu9yYaib2qKXr9tGtFSm6uOuaZW6d2c6a6ROqD58cbeb0d8YOR+hBhKzOfR04A5SRKWDcISJlx3H+uy2k= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Move PCI_DEVICE_ID macros to the top so that these macros can be used throughout 8250_pci.c Signed-off-by: Crescent CY Hsieh Reviewed-by: Jiri Slaby --- drivers/tty/serial/8250/8250_pci.c | 144 ++++++++++++++--------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 14e2e3433..ef23f1c6d 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -26,6 +26,78 @@ #include "8250.h" #include "8250_pcilib.h" +#define PCI_VENDOR_ID_SBSMODULARIO 0x124B +#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B +#define PCI_DEVICE_ID_OCTPRO 0x0001 +#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108 +#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208 +#define PCI_SUBDEVICE_ID_POCTAL232 0x0308 +#define PCI_SUBDEVICE_ID_POCTAL422 0x0408 +#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500 +#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530 +#define PCI_VENDOR_ID_ADVANTECH 0x13fe +#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66 +#define PCI_DEVICE_ID_ADVANTECH_PCI1600 0x1600 +#define PCI_DEVICE_ID_ADVANTECH_PCI1600_1611 0x1611 +#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620 +#define PCI_DEVICE_ID_ADVANTECH_PCI3618 0x3618 +#define PCI_DEVICE_ID_ADVANTECH_PCIf618 0xf618 +#define PCI_DEVICE_ID_TITAN_200I 0x8028 +#define PCI_DEVICE_ID_TITAN_400I 0x8048 +#define PCI_DEVICE_ID_TITAN_800I 0x8088 +#define PCI_DEVICE_ID_TITAN_800EH 0xA007 +#define PCI_DEVICE_ID_TITAN_800EHB 0xA008 +#define PCI_DEVICE_ID_TITAN_400EH 0xA009 +#define PCI_DEVICE_ID_TITAN_100E 0xA010 +#define PCI_DEVICE_ID_TITAN_200E 0xA012 +#define PCI_DEVICE_ID_TITAN_400E 0xA013 +#define PCI_DEVICE_ID_TITAN_800E 0xA014 +#define PCI_DEVICE_ID_TITAN_200EI 0xA016 +#define PCI_DEVICE_ID_TITAN_200EISI 0xA017 +#define PCI_DEVICE_ID_TITAN_200V3 0xA306 +#define PCI_DEVICE_ID_TITAN_400V3 0xA310 +#define PCI_DEVICE_ID_TITAN_410V3 0xA312 +#define PCI_DEVICE_ID_TITAN_800V3 0xA314 +#define PCI_DEVICE_ID_TITAN_800V3B 0xA315 +#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538 +#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6 +#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001 +#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d +#define PCI_VENDOR_ID_WCH 0x4348 +#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253 +#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453 +#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046 +#define PCI_DEVICE_ID_WCH_CH353_1S1P 0x5053 +#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053 +#define PCI_DEVICE_ID_WCH_CH355_4S 0x7173 +#define PCI_VENDOR_ID_AGESTAR 0x5372 +#define PCI_DEVICE_ID_AGESTAR_9375 0x6872 +#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a +#define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e + +#define PCIE_VENDOR_ID_WCH 0x1c00 +#define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 +#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 +#define PCIE_DEVICE_ID_WCH_CH384_8S 0x3853 +#define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253 + +#define PCI_DEVICE_ID_MOXA_CP102E 0x1024 +#define PCI_DEVICE_ID_MOXA_CP102EL 0x1025 +#define PCI_DEVICE_ID_MOXA_CP104EL_A 0x1045 +#define PCI_DEVICE_ID_MOXA_CP114EL 0x1144 +#define PCI_DEVICE_ID_MOXA_CP116E_A_A 0x1160 +#define PCI_DEVICE_ID_MOXA_CP116E_A_B 0x1161 +#define PCI_DEVICE_ID_MOXA_CP118EL_A 0x1182 +#define PCI_DEVICE_ID_MOXA_CP118E_A_I 0x1183 +#define PCI_DEVICE_ID_MOXA_CP132EL 0x1322 +#define PCI_DEVICE_ID_MOXA_CP134EL_A 0x1342 +#define PCI_DEVICE_ID_MOXA_CP138E_A 0x1381 +#define PCI_DEVICE_ID_MOXA_CP168EL_A 0x1683 + +/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ +#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 +#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 + /* * init function returns: * > 0 - number of ports @@ -1901,78 +1973,6 @@ pci_moxa_setup(struct serial_private *priv, return setup_port(priv, port, bar, offset, 0); } -#define PCI_VENDOR_ID_SBSMODULARIO 0x124B -#define PCI_SUBVENDOR_ID_SBSMODULARIO 0x124B -#define PCI_DEVICE_ID_OCTPRO 0x0001 -#define PCI_SUBDEVICE_ID_OCTPRO232 0x0108 -#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208 -#define PCI_SUBDEVICE_ID_POCTAL232 0x0308 -#define PCI_SUBDEVICE_ID_POCTAL422 0x0408 -#define PCI_SUBDEVICE_ID_SIIG_DUAL_00 0x2500 -#define PCI_SUBDEVICE_ID_SIIG_DUAL_30 0x2530 -#define PCI_VENDOR_ID_ADVANTECH 0x13fe -#define PCI_DEVICE_ID_INTEL_CE4100_UART 0x2e66 -#define PCI_DEVICE_ID_ADVANTECH_PCI1600 0x1600 -#define PCI_DEVICE_ID_ADVANTECH_PCI1600_1611 0x1611 -#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620 -#define PCI_DEVICE_ID_ADVANTECH_PCI3618 0x3618 -#define PCI_DEVICE_ID_ADVANTECH_PCIf618 0xf618 -#define PCI_DEVICE_ID_TITAN_200I 0x8028 -#define PCI_DEVICE_ID_TITAN_400I 0x8048 -#define PCI_DEVICE_ID_TITAN_800I 0x8088 -#define PCI_DEVICE_ID_TITAN_800EH 0xA007 -#define PCI_DEVICE_ID_TITAN_800EHB 0xA008 -#define PCI_DEVICE_ID_TITAN_400EH 0xA009 -#define PCI_DEVICE_ID_TITAN_100E 0xA010 -#define PCI_DEVICE_ID_TITAN_200E 0xA012 -#define PCI_DEVICE_ID_TITAN_400E 0xA013 -#define PCI_DEVICE_ID_TITAN_800E 0xA014 -#define PCI_DEVICE_ID_TITAN_200EI 0xA016 -#define PCI_DEVICE_ID_TITAN_200EISI 0xA017 -#define PCI_DEVICE_ID_TITAN_200V3 0xA306 -#define PCI_DEVICE_ID_TITAN_400V3 0xA310 -#define PCI_DEVICE_ID_TITAN_410V3 0xA312 -#define PCI_DEVICE_ID_TITAN_800V3 0xA314 -#define PCI_DEVICE_ID_TITAN_800V3B 0xA315 -#define PCI_DEVICE_ID_OXSEMI_16PCI958 0x9538 -#define PCIE_DEVICE_ID_NEO_2_OX_IBM 0x00F6 -#define PCI_DEVICE_ID_PLX_CRONYX_OMEGA 0xc001 -#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d -#define PCI_VENDOR_ID_WCH 0x4348 -#define PCI_DEVICE_ID_WCH_CH352_2S 0x3253 -#define PCI_DEVICE_ID_WCH_CH353_4S 0x3453 -#define PCI_DEVICE_ID_WCH_CH353_2S1PF 0x5046 -#define PCI_DEVICE_ID_WCH_CH353_1S1P 0x5053 -#define PCI_DEVICE_ID_WCH_CH353_2S1P 0x7053 -#define PCI_DEVICE_ID_WCH_CH355_4S 0x7173 -#define PCI_VENDOR_ID_AGESTAR 0x5372 -#define PCI_DEVICE_ID_AGESTAR_9375 0x6872 -#define PCI_DEVICE_ID_BROADCOM_TRUMANAGE 0x160a -#define PCI_DEVICE_ID_AMCC_ADDIDATA_APCI7800 0x818e - -#define PCIE_VENDOR_ID_WCH 0x1c00 -#define PCIE_DEVICE_ID_WCH_CH382_2S1P 0x3250 -#define PCIE_DEVICE_ID_WCH_CH384_4S 0x3470 -#define PCIE_DEVICE_ID_WCH_CH384_8S 0x3853 -#define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253 - -#define PCI_DEVICE_ID_MOXA_CP102E 0x1024 -#define PCI_DEVICE_ID_MOXA_CP102EL 0x1025 -#define PCI_DEVICE_ID_MOXA_CP104EL_A 0x1045 -#define PCI_DEVICE_ID_MOXA_CP114EL 0x1144 -#define PCI_DEVICE_ID_MOXA_CP116E_A_A 0x1160 -#define PCI_DEVICE_ID_MOXA_CP116E_A_B 0x1161 -#define PCI_DEVICE_ID_MOXA_CP118EL_A 0x1182 -#define PCI_DEVICE_ID_MOXA_CP118E_A_I 0x1183 -#define PCI_DEVICE_ID_MOXA_CP132EL 0x1322 -#define PCI_DEVICE_ID_MOXA_CP134EL_A 0x1342 -#define PCI_DEVICE_ID_MOXA_CP138E_A 0x1381 -#define PCI_DEVICE_ID_MOXA_CP168EL_A 0x1683 - -/* Unknown vendors/cards - this should not be in linux/pci_ids.h */ -#define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 -#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 - /* * Master list of serial port init/setup/exit quirks. * This does not describe the general nature of the port. From patchwork Wed Oct 18 09:17:37 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: 736152 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3527C46CA1 for ; Wed, 18 Oct 2023 09:21:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229994AbjJRJVC (ORCPT ); Wed, 18 Oct 2023 05:21:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229840AbjJRJUz (ORCPT ); Wed, 18 Oct 2023 05:20:55 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2063.outbound.protection.outlook.com [40.107.255.63]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2C611B; Wed, 18 Oct 2023 02:20:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WN6ZJxYw26BcpEkTwoabR2IfxLGuIV/sHvcxlwCi+k9OG+MAEqBIaxksU049oSbBzpAAWC6EJNi/eEp/YZnkdegCU/zZNq2+IeftrkOviVTy1dlAb1IqhBlEWzEf7dNKWDpo+k0OdaPsLcb/5zEt10UAtG3rOoEV9tjh/UL5MveEpqIVs3BiC4zDNZj2mOplPEI7wKEj79nCrAoHptcomYYB+ZfP5ZWTOzzDcFDdwYHCEHggOP5YCGtSuP+300HgjK67YX6TNI/T7lKkuQtLXRolZ9NzOEwHwc/6SrEz39rU2CSHIRrkWTLDP/X9CqAbknGhrFhHAIZDGgOu6rfZyg== 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=oAjUELYMBcGULCn3tUw5EcpfML3Vo2DajzAqo9cbDsY=; b=nb9xc+mMMLo6FCBLizmm7/jyE+MQIsitpgUdYprOZscIvO9JVTWzo84rDdsmoRqRI7Oj4ZF9Xrnic1iOuEXKpiXGf+LN47gZQQYE9s3ISTglMSSlIa+/0CjgPK2hUeV20RWUAqudaDzaWboCRIPJ5chUZVnev1pckhCc4S3nnDyHaF1th1Rw4i/YK1dLzGFkC7IiSrrQVk9ByDy9i4UeDZcYs7jnIx8MyKRArM/AItALrYLe1AiTXBEf+N1bAg+Y9LYAbRrugUI7vnmbG35EoP8q63UaCA984Gki6t6wdtAP/OpUZJ9jI+S0jIJmRLV7z7jizl/NUPUP3g7uxBOYyA== 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=oAjUELYMBcGULCn3tUw5EcpfML3Vo2DajzAqo9cbDsY=; b=bVTQV/WQ6J29A5ULmMiLOYP3r/LcDerHFx3ey57M8bLGPExaE/XDgl9bZewOHiQDJ90Q7NRVISlQWvsDzE8whusJ4igbVl8Zh7RJb4iKwwoTTSvelgRRvKmOpfc/X26YeSw9RJXFk3Z/LJHnon27mhObq+swr5XjQX/sN/yevns= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:44 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:44 +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 v3 4/6] tty: serial: 8250: Add support for MOXA Mini PCIe boards Date: Wed, 18 Oct 2023 17:17:37 +0800 Message-Id: <20231018091739.10125-5-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 1b953646-0ecf-4295-ce9a-08dbcfbb816f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MIIlt0+OPsX5sYv90CqVr/oeVQS6nwfw+/BNUpTQ9JBse1fXhy6KSXYK37JP4uf19iqIMcpoz3Eii12b0JiVtJmkRfEJidwcer6QXsJAj0sCOvK4AL9DB/yCPt56BNRR0z3EsB/wVskYxNbIsQRLF8VQut3KQ1zpmmQO2zjGw6uAQqh/uikH70Zsu6H8ed4wkuXxe63LbhtS146yFXybLFvRvRtox7Mm+MDLnCjKVykE4QT0Ae+DCaxAfP0TkEaTRsScbgwn5Cdg4+VNQKRE69zcGn+NcwObvoNEJLVNpMKi4N/+gmMoXaQ1/ZnBvEP+BB5L58N8OalJ8jmlI1DruYmPjw17hJW9NXmsO6JGR++1KrDFrw6qtJf2RqNA2FETXyx1rvM84/ZKyK+w55HqqBCVon2/2afbpATJu82AVN5cpbSwCccqp0zwhujAZxbCTnBK3I7+CpNRIzDj78z4pJbtxrM4YlpHxTyl49MOcbnOG3f+m/+P7lfUlBv5SwcszYiWH8Pffn0WusD1phHZvCY1yzWLm2YOFrO+jczf6Mnu3mwI2BQOkGXS48GRHgRT0kG8gM/ywtww03ZgWQhFH4NoSry7gqFlN2N3Tfujy3z7JmByzmde2H2hNeHGY50H 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6666004)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: gZbG57ydpqcyqvZ7Hg0QFah4n6cTBQOu95C7hf43ZLMtAlTwJUpD/rBkIwNl1NN6ZdHku6YRORdsWR1ukq2/sAnf/u8CAkmmGlEwhj6g1DhVmeBFRReNTsTb91ag74nzZjYhhlBtJ6ntWaavoKpL0VeqX/kQ7Rt+mxLh2lqJgkVZEfXH8LC0mEo5e38fLl0PwWtdM0qaqzw/6l26q2JkUqAfoLikJ5aNAYBPMlOS0A0VJIWmsPnsV+q2pK45ox2MPWStS507tG/PYJ3ULVmSkMDQdxygziX9xYrENy/6qG/N7w76eVXUxmVPjg4M575oz4PvuLF3N1oFDNM3RO+p9ts3gMOJhqQnz4+1NIxq3TA2HieGWvmj/6xhupQiVE17nNvhtb+Qbc3tryFz7yypEi6VaHfUe4BHHtIi06kOD+bAck57Vj4Kbki2IKZUjm8PC2fq2npBce7vcahHDOykXCq081ObnY3zybjZugEWfFJQqIsRbWlBYSgS2Hyh83N9dofxuGzArdYW4H7le8/OHtiJbl1HGi6zj0SRCmIwtcotzhsuqZd0lN3CoeLGQkp84P49L5J/dQF3nHwHBqEqzzIPoQ/jnTNdMCDGZpLBssGW4SZwk9yqDvGOFUM5ni+F6yZod4mXgVZ8COHn6r3N7pot9YfrQyj1RGjBdGCfDtLlq9fY+FOwYB1E2/Nsguq0X9kIKw/d7JPF+5iZTvag7syMi9Akjo9zegGqTkB4XFyfL+9QZOvWG7H9/PY/ucWHZr2izz+J/fh2ECiqced64vSOh8RqLV2HRsS86HB2sUpVMOYLhCRwVR82zWCGV7X9p+hwiokqNcL9zbrPMbhSvDzHFBhzY+FVA893iZlh8XYIZ1Bx3YslS2jcurGeJSSFAbOzNY2hDqEhf8u7hd7csYW3fG9um69Ho99PzvwM77TFykS4SjkCCHY0rK5N0bTgGUyLB1K6+PpI/YBIhD5S9r8ChZ+30KmZrsVUudpIMJyUaI/BawqNNHYz7txIfr7l4NrKz1Vk1pWfBQ7d8XH9VsW6ZOZ+lBeLxvG6f5cCO56TLokNp1eOJyRWtERuAxUfM5k4StrZJkuFqdzWXFJTIEpGiN+99ZIUWsp84hG4PFURNoXvUFuUzlX/YjMx6ndfgJ9qbvViPetXisdLPKO2roCFNod09S4mmjVRY3Nhx7liX5bfE9JbvJFWQ2RyeoY1LZmDXNhU6/eQxUNRIfZmRqkQCyHVkmXHmwE9E5gu1JIJ9IrsVzOBNUBTIXKfooS7ueND4fCggAjac34/1/M0SBw8ExFqs6nzmXxhTaXhT+sMM8SbsP6/1nScvoDz2CLVqvVH3uzY+q2OkXGt3jFS0ytFcEptEaK+tCRg7cI7DC7pB+TSZWrOunKFYVrL8EoDX86QmmESg2Q9NllTNNVJGsvk9V5HsV2l28Qq21k7HaBOw89Tsuf78n3TnKKTcaCJubIawYawbu9Ws6CfRqt2anfj4HkJSpAsLh3LTfbg6MQW6DZPzFtvy/G58ZWcXumsiD4Vd6ciyOSrK+UYxjSeaHXiZeAC6BT1ATQaR8LbtnRxUW7qfTOSOd14OWJpVayndaJToJaDTCG+Pt1SHxIdNA== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1b953646-0ecf-4295-ce9a-08dbcfbb816f X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:44.1952 (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: 3jU+3vuSJ1dtgJHwbbdA0Iryc8ve+2arpVIz8sOZFALXnSdqjhhH3FAC9QSkMwagxx3YT/2vvCXg4yIiQ+GbFoMsCttF5b9aAKrAFSFiCAA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org Add support for MOXA Mini PCIe serial boards: - CP102N: 2 ports | RS232 - CP104N: 4 ports | RS232 - CP112N: 2 ports | RS232/RS422/RS485 - CP114N: 4 ports | RS232/RS422/RS485 - CP132N: 2 ports | RS422/RS485 - CP134N: 4 ports | RS422/RS485 Signed-off-by: Crescent CY Hsieh Reviewed-by: Jiri Slaby --- drivers/tty/serial/8250/8250_pci.c | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index ef23f1c6d..b2be3783f 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -83,14 +83,20 @@ #define PCI_DEVICE_ID_MOXA_CP102E 0x1024 #define PCI_DEVICE_ID_MOXA_CP102EL 0x1025 +#define PCI_DEVICE_ID_MOXA_CP102N 0x1027 #define PCI_DEVICE_ID_MOXA_CP104EL_A 0x1045 +#define PCI_DEVICE_ID_MOXA_CP104N 0x1046 +#define PCI_DEVICE_ID_MOXA_CP112N 0x1121 #define PCI_DEVICE_ID_MOXA_CP114EL 0x1144 +#define PCI_DEVICE_ID_MOXA_CP114N 0x1145 #define PCI_DEVICE_ID_MOXA_CP116E_A_A 0x1160 #define PCI_DEVICE_ID_MOXA_CP116E_A_B 0x1161 #define PCI_DEVICE_ID_MOXA_CP118EL_A 0x1182 #define PCI_DEVICE_ID_MOXA_CP118E_A_I 0x1183 #define PCI_DEVICE_ID_MOXA_CP132EL 0x1322 +#define PCI_DEVICE_ID_MOXA_CP132N 0x1323 #define PCI_DEVICE_ID_MOXA_CP134EL_A 0x1342 +#define PCI_DEVICE_ID_MOXA_CP134N 0x1343 #define PCI_DEVICE_ID_MOXA_CP138E_A 0x1381 #define PCI_DEVICE_ID_MOXA_CP168EL_A 0x1683 @@ -1957,6 +1963,49 @@ pci_sunix_setup(struct serial_private *priv, return setup_port(priv, port, bar, offset, 0); } +#define MOXA_PUART_GPIO_EN 0x09 +#define MOXA_PUART_GPIO_OUT 0x0A + +#define MOXA_GPIO_PIN2 BIT(2) + +static bool pci_moxa_is_mini_pcie(unsigned short device) +{ + if (device == PCI_DEVICE_ID_MOXA_CP102N || + device == PCI_DEVICE_ID_MOXA_CP104N || + device == PCI_DEVICE_ID_MOXA_CP112N || + device == PCI_DEVICE_ID_MOXA_CP114N || + device == PCI_DEVICE_ID_MOXA_CP132N || + device == PCI_DEVICE_ID_MOXA_CP134N) + return true; + + return false; +} + +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; + u8 val; + + /* + * Enable hardware buffer to prevent break signal output when system boots up. + * This hardware buffer is only supported on Mini PCIe series. + */ + if (pci_moxa_is_mini_pcie(device)) { + /* Set GPIO direction */ + val = inb(iobar_addr + MOXA_PUART_GPIO_EN); + val |= MOXA_GPIO_PIN2; + outb(val, iobar_addr + MOXA_PUART_GPIO_EN); + /* Enable low GPIO */ + val = inb(iobar_addr + MOXA_PUART_GPIO_OUT); + val &= ~MOXA_GPIO_PIN2; + outb(val, iobar_addr + MOXA_PUART_GPIO_OUT); + } + + return num_ports; +} + static int pci_moxa_setup(struct serial_private *priv, const struct pciserial_board *board, @@ -2633,6 +2682,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = { .device = PCI_ANY_ID, .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID, + .init = pci_moxa_init, .setup = pci_moxa_setup, }, { @@ -5349,14 +5399,20 @@ static const struct pci_device_id serial_pci_tbl[] = { */ { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102E), pbn_moxa_2 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102EL), pbn_moxa_2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP102N), pbn_moxa_2 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP104N), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP112N), pbn_moxa_2 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114EL), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP114N), pbn_moxa_4 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A), pbn_moxa_8 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B), pbn_moxa_8 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A), pbn_moxa_8 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I), pbn_moxa_8 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132EL), pbn_moxa_2 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP132N), pbn_moxa_2 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A), pbn_moxa_4 }, + { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP134N), pbn_moxa_4 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP138E_A), pbn_moxa_8 }, { PCI_VDEVICE(MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A), pbn_moxa_8 }, From patchwork Wed Oct 18 09:17:38 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: 735440 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B5E7CDB482 for ; Wed, 18 Oct 2023 09:21:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230224AbjJRJVi (ORCPT ); Wed, 18 Oct 2023 05:21:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229987AbjJRJVC (ORCPT ); Wed, 18 Oct 2023 05:21:02 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2040.outbound.protection.outlook.com [40.107.255.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E073119B; Wed, 18 Oct 2023 02:20:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NBCkEyzqAsmdseXUxLMtueTriyisXNl029t9Y5DeftD5g0x9+sGFDSnMDkOgD2FCd4eiirqqof/UesuB1lLIeNsNq2DlzU8pEbVFntpCpRSytc96yA2TDzidt1Ot1qkpCm8L0M2Anymi+liavclMVwlAaQusuNNN0fr50+arZ8ZxqpFgS/MZQPfrI/rofYSldB1Bm1jdWE2ppGHrDO4aYtFJ47KkyAGWZRVkREO0rWVd28etgXblVKkuYqCifqCldU62CCpyb7NRoAT8DwXKLYlzp7/8nSbKdLk4lYwN3hPlMUlX/uXy2AEWCBtVjT4V1urT+wRV0VxnzS/+mIhoNQ== 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=NkbbBbfcEHv9MnXqSsE7CtXcIxgi6M7qgVEk7UIznBQ=; b=Zs41PM8F/yA/g8x0XFKlfAbM4vbNfXAlOaLIX8Wc3Dq4M7wYjldzRg7D+1rgDHBq15CAShK/37f5DkkqjrfEaG68pdrklXQUOGEmGlFRI4LyB726r1/sTtDlxJcUIectEuHaZMhvIIqD94pnBPNBns+PHMw+soaZbRgpMqckogXg7+EarMScy9c6Z81fJo1B2W/Yh/Rbev7jP5YYBNhkIdLIzjRZ2V9uNyGqyECAQ06W+1iJjkJ9q9SVpwnF2X3HuT4M/ob7IGjkdnHscHxcJ/zAXQ2W34pX2UpKKxFBk/rP1Pb8Fwb4/p2CjrNnSp2EIeNaE2TKKHT79PP3K2N4MA== 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=NkbbBbfcEHv9MnXqSsE7CtXcIxgi6M7qgVEk7UIznBQ=; b=i7dlSiGXfs3jN5gpvAnfOvhRiv7yh1LGo/ZH5H6t/pJiDU8XSq+0/m+5JWwqEIZQ7uE+aTU6jq7wh0OLvD6t8MDBZ4EkcDVNiyEcM+JXeag2bZOvFJ1p3rnkXl0N/z/oINciZZQ8U//bYpuTIJ44qJkqLgNm2YPOCKgnfFIqT8Y= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:49 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:49 +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 v3 5/6] tty: serial: 8250: Fix MOXA RS422/RS485 PCIe boards not work by default Date: Wed, 18 Oct 2023 17:17:38 +0800 Message-Id: <20231018091739.10125-6-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: a9a918b2-16d6-424d-73af-08dbcfbb8449 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QwYJW3cNLi+BXXY2t3K3I5b9dxn9Recd8A5ldzeIsIHQZifKJGfxDcbXz16r3JClZivQebqMTwMqUXoxmBQ6dIo6FFVPukX3Ry5+qelbIm0PGFikOrluMW/mYjKrNtukBhXiBMOAXZySj2szsG59WIs8Ogmtcg8tJjhQ+J1W0PzyeP6PB2ZukT/rbGgfqS0URBT6viapl2pa1yRm8Xmq7coWtaAIW4d5OgC+EvkmIuv/zomYGOM0tPlxDRdBUUWALQw15OL6xQEsR/2ALh1jMiwiwaHzrQN6wwM/pY6YKINS8teoQGUgVRxxZyvoLBnKtfJFd6vITsVaQKpWAsNcqBWMqdsV8Wmeg8vIA+AYQNf7W4VcygWKQ3jx2u2yUzvOLpvXLFxcZBd1JeaZtVmmykGUVjV4R+RL7jjMv0fw5FhmJW5uqcYBw344ump8yJmbkYus5+FjsLTPFc7CLQ6QSxNMDAoo8Y7JncZJPkxncwXXAUnWDQqpumes/nEB/GBhy0WO2bww33a77REY/ika1mqJ8k/MjmHPUcC5L+Mhc6RwADiD4OYqt3KCu5tTc294rTFk5A8kipNs3VokGezxiVW4e9GWKmUKPjA8VPBODYDaL1StgjRLgDIpmSVZTdx+ 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6666004)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: SFr/bINUc0mU/C23FiAv6pS0z9lYlFPELmTeQqVMqCE8thIfEP0cFtmzN1aoKL9Q2wdHZamSWGeiNdQkgSMFaxYUlRwX+0SYAEUTk/iBAKFEcb0YMbTpwxHm9f42ZuwkCkubJ97v4B5ZKNt5ni5Zj+g7p+uySVK1o5LhrtyIHgd6LCSQ6tsy51jks74lZl7nSQkMqdpUT8KCfhbFNKKckw2QffDouaavZJLWvAXGNv6gKmwYYD4ojDJhNVwIjzuJL5dPwIcMcWAtpxwY+uvHOD5Npw+s+F8FOzRJk1A/Rw/qDHIfhGcbd4FVrahfCK/q+IW1seaqWlXnbg+CFZkcYtLhpMEbnQwrLXZeT5owkPCPzV2h2EpZlJtcj9vyuqRhLUjfhItoQLI+eIXYFDaeAsh2/n/sn/lRrcdK0UVBh2ev2HqhrAzncSTn/opsr2Q8VmPYZEpPuP7L9W1PqQt+f6PtEFqnWtP5+jIPi0bNj+NYxa5hm5AAAS/8DqvKz5VORXCKAi7hIkMnDCXGo+G84wbmoK0xspQ6Q6hvQKHcNLYf+LsSJ1dwuU1I6z3jmtP6bcfNuTTpFCHIowvx1spmad0NxOu2BmMaXjBrLfmBR05GTQVjKKlwxss6ni2N/ibO/1/ShSnWbtZz/EYyFFLrZ3rI2GpWdUPmsZ6C7O1zINwRc8FqaUWOZAIu3PkUsQYyFdVqi1bhhwMil+jjZLCrwl/6ZqkcZktyT/+MoHRhm1XOC74gP0m+1Ued6VS72dgnI8QRoSPdh8NYuyFawF8peQdp31l+6IYQQo1lt+g1sFrhKd5hs77DRayyhJtER7PtHAxn6YhcnWK8qSZYtnQ7NoRfjczPbg0+XmFm9s0jelRgNxoVF+2Ek62SnVgpjzCAxAq8ixoKURdi0XYibxJdKkAnl1nrtWuDKOuhnfZvBVw4Rju9KaFrcMADwWDouAIVl978n4zBn69k43HWJd0YIYAblVJ+bEODurzROOzF3o8S3PWn3T7pzmxN+3mFmUUiD5fSpvHRXql3N+tYiUzD0w0GfcfywRertnVryWE2IBMzVt3TmLLCBsdYP642d5rNTGXdn8JPkKz0RbeMiykinq71BzvpZ5+1xRhoMk5jFAqmESakO9vUzfx/CaMo7kZ4KZax1l5K73z0CgzwAffPUlaa6sNZdVIjPasENZM/NNvgX8OSOAMKUzzq0sAixfdFqUE4pyUhRvh5jDi7hEjI2HlKS+yPdhWE2aKTcTTE04GOAnBSRTyOXivPUi5sI8p05DFy/VHTW/ZBCiQC9oQyFW4Yqq+LOUD6b5KFFVv0LtY7nTvCDCnEdXlQ0lwtNzPDWwP6GAfM2WSMIf3KfjplOYcZJcl3LgVPIM+r8ZKZGcjunaTSILaBXo76USQGKx5BFgKExv7fnqCsQDz1taessJ42/FWuyRTWP4sbtKAXQOtMtOOM9tl9JqNdzvIsbiDHfscIJc7sjyvi9M2uh1BHHLocpIBhkKX5vU6qgccwftldctfb5xynk2YQyIsAx3okb6QkCCI8j8Ndsm00CfO6SnCMpeOZqv2kcCaOhf1znwIgzKK70yYkyZ4Ssvq2VwS9l9kCobWqPtRQtkge8sAAeg== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: a9a918b2-16d6-424d-73af-08dbcfbb8449 X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:48.9647 (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: swszrXqeeOfBLjpc2E8Vwf0XgF9WgAlh7YfiX9L8W7F8QObFRSnaol2Ij1yC7GFXbtHFcDl++2jQ0NAJPOPOKlTYo/oBA5rq61zJ4E/Mxjk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 | 52 ++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index b2be3783f..29a28e72b 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1968,6 +1968,12 @@ 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 + static bool pci_moxa_is_mini_pcie(unsigned short device) { if (device == PCI_DEVICE_ID_MOXA_CP102N || @@ -1981,13 +1987,59 @@ static bool pci_moxa_is_mini_pcie(unsigned short device) return false; } +/* + * The second digit of the MOXA PCIe device ID in hexadecimal indicates + * which serial interface modes this board supports: + * + * 0x*0** - RS232 + * 0x*1** - RS232/RS422/RS485 + * 0x*3** - RS422/RS485 + * 0x*6** - RS232 + */ +static bool pci_moxa_match_second_digit(unsigned short device, + unsigned short pattern) +{ + return (device & 0x0F00) == pattern; +} + +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 &= 0x0F; + val |= mode << 4; + } else { + val &= 0xF0; + val |= 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 i; unsigned int num_ports = (device & 0x00F0) >> 4; u8 val; + /* + * For the device IDs of MOXA PCIe boards match the pattern 0x*3**, + * the initial default serial interface mode should be set to RS422. + */ + if (pci_moxa_match_second_digit(device, 0x0300)) { + 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 Wed Oct 18 09:17: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: 736151 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A73A7CDB47E for ; Wed, 18 Oct 2023 09:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229807AbjJRJVk (ORCPT ); Wed, 18 Oct 2023 05:21:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229880AbjJRJVD (ORCPT ); Wed, 18 Oct 2023 05:21:03 -0400 Received: from APC01-PSA-obe.outbound.protection.outlook.com (mail-psaapc01on2040.outbound.protection.outlook.com [40.107.255.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4DC109; Wed, 18 Oct 2023 02:20:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IGkVb6etcvkXT8cyrH43pn+awWmxzMNSS3CmhTWVgt2aTjkwa32Cwfl9SXkKMdZnOEH8cQ1jaqpPiIC4TILh7e1xkQWP+vGeu5aIsoLypwfsPGeOmCs7pk/TjdrzOCp7rSSavBNibDJM3Z0nHQ/3XCLeXFpHw4+4BNc2tuD4r9ZhIVGbG4AAmIUqr5/Y56i6099DPNbSjV2lp2MaSepdcinFjd/2+LLb0nzdO9O+8CTTP1mJm7AvrFNctP7e1oD5NutRRnr8exl9WKO7z6I0NXwrzV1Hg3ZjOoZJcToz32TWO3qby1gIMJIPXnDofDtZSjFsPsUKHWC+xZxoRmGFbQ== 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=5pgFiIzlSiWLOpPxreoLMBN5dOg4+aZsk9xdeiqTmd8=; b=C7q7Wlxc2IFH3ChGzDcp2DcFAFwkqLhFU0zfdPdms2khnprZD5E73odNxRXf0p/AfuedGvoSviKybQcb/7eippajHuTqk+ojNoi8H+LVQTx8Ehqhh8k+COpzmfo/ebLR1hTVgxjNelOQbCMwmpt65aXMjyDwAChiemWsTIhX8AMTWRlcyN3h9BZ+Tu5hCZoRse3CGdwgqwgt/6hFHd+apEj84Ev7zzWgfKJmD4+0gCe5K/CbqWu9hn/PbmiRy514AFAEOzz/WSm9r4XVe6GGClQQPDZ4UwelLLwULP1ofH+449ReW2h4KwJiYaVomc2WWCWY7eu0xFXicZOgbZdHbg== 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=5pgFiIzlSiWLOpPxreoLMBN5dOg4+aZsk9xdeiqTmd8=; b=gbl/PewuNelvjIMT1ikirgz1ayK/aegKpiwJT0C+fIPbgFvKpLaocDSH6HGQFG/kBJN/c86Jms2CSoliJAULaKfzdDcSE3O0dbcVbDodB+Mzuw9cnbDFqi7VyTvP/hKNPsrkVuoY8qoU4iHPfXXcvZA9rsUSCaun7PHG8oKuMCA= 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 SEZPR01MB4134.apcprd01.prod.exchangelabs.com (2603:1096:101:46::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.21; Wed, 18 Oct 2023 09:20:53 +0000 Received: from PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b]) by PUZPR01MB5405.apcprd01.prod.exchangelabs.com ([fe80::3f1:6c0e:dec3:714b%5]) with mapi id 15.20.6886.034; Wed, 18 Oct 2023 09:20:53 +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 v3 6/6] tty: serial: 8250: Add support for MOXA PCIe boards to switch interface between RS422/RS485 Date: Wed, 18 Oct 2023 17:17:39 +0800 Message-Id: <20231018091739.10125-7-crescentcy.hsieh@moxa.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> References: <20231018091739.10125-1-crescentcy.hsieh@moxa.com> X-ClientProxiedBy: TYCP286CA0015.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::19) To PUZPR01MB5405.apcprd01.prod.exchangelabs.com (2603:1096:301:115::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR01MB5405:EE_|SEZPR01MB4134:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f0ef1c2-2b5b-4110-6999-08dbcfbb86b5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: c53LSErJVldqrtvaKQ3drVkMZtPmdzHQp9CRbPVhGa6ZWdTPq4m1T1CgHtOfi4UQsoYEkcY/kRNCleUMCxDuAfUd/MP7aaEFg9oOdWHBqmnSdjPMubDgoLOKBHBcR5J3RKmCWBB7iSwHstcd8mmq+VV3mZdehSvrXrXK1YJIaEGvzwKjAwiC1R4AjD+VywwF6bcxSWhgjdzYeS01Xu2FstyxIxC37/fT26pIHkXH9su//NG2B3e2xFFmx9qrO/NoMa+g40u1CoC5tTV+CB9Kg+MV4MBDeA7WSlrysXYReErqsEDvsV4QlJXPnt2t56DTDrwOFRQ0SxLe7fabzkvKtnSEMzw4aK8J1DqyfufOY0sMvbtZa1ZCHl+Hly14O94rG+CC09KA7CWwC9siulDmsGglnW9iqYD6Aim8hL8hA3u1RRvbEaQLj8vFNDhfHf9Frg/sPAkoerN0MVf8QNckqnyIWIOyupTO6UOynt8cM9vjlnShGoGWSNrEBAc4N7hmoEATAr5xhbMWbsWqFBhKT+E5GT2nfJw/ciHpTw8inFEvMOC34Wq5mLegtQwHI0Uv0Xc8dECdBHp7JebXX+UTFDGNB8syIwDZRAIWiaz6Bl9IOo4V26xdziRlUGZLFjDs 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)(346002)(366004)(396003)(136003)(376002)(39860400002)(230922051799003)(64100799003)(186009)(451199024)(1800799009)(107886003)(38350700005)(6666004)(6506007)(52116002)(6512007)(6486002)(508600001)(66476007)(110136005)(316002)(26005)(36756003)(1076003)(66556008)(66946007)(2616005)(41300700001)(38100700002)(5660300002)(8936002)(4326008)(8676002)(2906002)(86362001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: my4ILQl1e05ai5DYvxV4mDx6fnnzyDF7jEZYaBH7mQ+LumZ/74xVYjfabKKus2NZqCDO7gyp/1hjwZzZ5A0Bt2JwYHVY7Z60/ttTTImbQzE57HCDfWirXOms52EpbXPVSukzkw+Gi9MeaGl8EsImodVkPe9ijdL7G7Z/u7ml5uDz1vzM6QhasyK64TtlwDDa8NMzTTchBW0s4jIVqJ+oZ/AooDDPOQnRipykbMUNPkEW2FrGkLiTWd5RSaYHsrFu2JMPEiB1CmfhwaT0u/zOYrmKcH54S/5us1BXcfGF7WTCd6GvMMax+tqH9xs7CzQocRvOiu+4bHll7lGlZCnD111SCBr6mJXKrlxl0MP/bSn4R+GOWcgZS/I2tlFbWsYXmROZdyywuJ48xKpiAMPluZ7lpPUUhCgfMmXLW+1/nJ3r4EKK/3BZx3fSLjF0MdNqgmT092L24wA1FHW7fl/tMD9/g/DY4BAulCz/g8nRq8kaReQM5Fsu2bh3jeXK/ctfrmDAEviCXu/mJaHNLqj/IkswvwNtQqxZz87uM2pDUonsJO92khg8i2EHmxGYi+Q4TcqOsFToEW8SEcdgSRB5Ao++Y3+NqlcrvKXbcU7fCJ4zKVE/HVrjzXuxvbQN1L5OJD9VzageJXOiPdm2XyE3gEf8KGtMHyFgRfpIGeG27ntdw3SCUKcJqvZphdIMcIQ1yr+WpurBEs1X8bB1A8Ll4g6M9yXVwnTxTLqXeZgY5kwyBqOGV1ZAl80YTwYdsbhuWBh5JWqYUGOcJ169iK8JDZLgEjfcV+Db9CXb7CCNsoZEtvG0RPki/LmR2fWaMLCWaz8Bv1++GU2IRdBUNKvqyovtBPS01KnZY3qbcS6FEL6cBLM/7dUzGxtF7EWcaPGriSWaRIRZgCi752Mw5A6YM2p2LAaXU2FXnkNfTQxYwsi9obiFQ19DBaU3nSX84Sono3n9HMs1kl49XO3HLIzNO0ieQnFqewvVpPcpUWFM2JBUZ9v0meLH9Amc6PslNbBR52OUImEq1h7eFrgrdBDYcI9Mcwr7r8zx8xCGc9U+Q2HylbcGgQBIqt9OzvdtoC9A37yjX2V+tF+Pt/0I9mbfA3t6Pe5CxhGMSyXtQNtifigKaBsLF5YmBY8ZxHdDjqOjFVPCSvHPSwx+U3eSpuv0yusFlOYSDzBmV7WyyTuc6Mu+obesV7pmEUVbeUlWOQ59bX8BuuosRu+QsVv5DirSou4AuaryQfRx20WavfkSX3XMgSAtz2vPf1AndTqiKkbfR9oLpAr0p9s1bn03GRkZGObZiZjtyk3/SfHxhvtiGxGHC53Zyz2bS97VEJaFfkBOATF+wjlfHy1ODF1cHaRi31Jw1XRb1j/ZpaDqkiAXj4/z//iw8W9fq6LvnLTohLsQL07KQMFxol9vSVQfSlkKLQvm7+VbzxKtWQO45NdkqnR5XC1eIjHPzmek7VzJfzq1HldZvoi0V4ml+5snv49sHGolMYHRCLAgGPvsNwFSWLJIZy6uLiO/zBDDNBDyLXGZYs6UD+b914ScipYgglcSLJzQEcAr2rI9KN1KpvEoNqU3vtQScXG1jIRKmpu35pml8SlXhUJlbHXVc2q/9DfNZQ== X-OriginatorOrg: moxa.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9f0ef1c2-2b5b-4110-6999-08dbcfbb86b5 X-MS-Exchange-CrossTenant-AuthSource: PUZPR01MB5405.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Oct 2023 09:20:53.0269 (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: /bfsLwv2cXdaLuQs/LAqPJuetff8G9L5+SECbZkUP1Oy839NnAE7oU+SaRgn+vW9St02bxVXYVuh/WFqOgDcOac0oDhH4tZCx2quooVsZ9I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR01MB4134 Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org 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 uses "SER_RS485_TERMINATE_BUS" to represent RS422 as a workaround solution: - RS232 = (no flags are set) - RS422 = SER_RS485_ENABLED | SER_RS485_TERMINATE_BUS - RS485_2W (half-duplex) = SER_RS485_ENABLED - RS485_4W (full-duplex) = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX Signed-off-by: Crescent CY Hsieh --- drivers/tty/serial/8250/8250_pci.c | 58 ++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c index 29a28e72b..098ac466b 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -1974,6 +1974,10 @@ pci_sunix_setup(struct serial_private *priv, #define MOXA_RS485_2W 0x0F #define MOXA_UIR_OFFSET 0x04 +static const struct serial_rs485 pci_moxa_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS, +}; + static bool pci_moxa_is_mini_pcie(unsigned short device) { if (device == PCI_DEVICE_ID_MOXA_CP102N || @@ -2024,6 +2028,46 @@ 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", but there is currently no dedicated flag for switching + * to RS422. As a workaround, we utilize the "SER_RS485_TERMINATE_BUS" flag to + * represent RS422. + * + * RS232 = (no flags are set) + * RS422 = SER_RS485_ENABLED | SER_RS485_TERMINATE_BUS + * 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); + unsigned short device = dev->device; + u8 mode = MOXA_RS232; + + if (rs485->flags & SER_RS485_ENABLED) { + if (rs485->flags & SER_RS485_TERMINATE_BUS) { + mode = MOXA_RS422; + } else { + if (rs485->flags & SER_RS485_RX_DURING_TX) + mode = MOXA_RS485_4W; + else + mode = MOXA_RS485_2W; + } + } else { + /* + * RS232 is not supported for MOXA PCIe boards with device IDs + * matching the pattern 0x*3**. + */ + if (pci_moxa_match_second_digit(device, 0x0300)) + return -EOPNOTSUPP; + } + + return pci_moxa_set_interface(dev, port->port_id, mode); +} + static int pci_moxa_init(struct pci_dev *dev) { unsigned short device = dev->device; @@ -2063,9 +2107,23 @@ 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 short device = dev->device; unsigned int bar = FL_GET_BASE(board->flags); int offset; + /* + * For the device IDs of MOXA PCIe boards match the pattern 0x*1** and 0x*3**, + * these boards support switching interface between RS422/RS485 using TIOCSRS485. + */ + if (pci_moxa_match_second_digit(device, 0x0100) || + pci_moxa_match_second_digit(device, 0x0300)) { + port->port.rs485_config = pci_moxa_rs485_config; + port->port.rs485_supported = pci_moxa_rs485_supported; + + if (pci_moxa_match_second_digit(device, 0x0300)) + port->port.rs485.flags |= SER_RS485_ENABLED | SER_RS485_TERMINATE_BUS; + } if (board->num_ports == 4 && idx == 3) offset = 7 * board->uart_offset; else