From patchwork Tue Apr 16 12:55:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 790134 Received: from mout.perfora.net (mout.perfora.net [74.208.4.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C90B212BE8D; Tue, 16 Apr 2024 12:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272215; cv=none; b=YJYPTu8dNYOX0UwR6rUmxFnA+FLuDpg/5Siwxveayg+s5lQRKtwd2dbw5YWNFm1TNTCjYuOTnhaWVNVzdR+5qWPOgm1gjerSxZMMWiur3DcoKWDfmtSq5exrg3xZJEnHXvHqiQGZOQ5ll0DA5QPVaDWoAMY9kDySY2NShkxz69c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272215; c=relaxed/simple; bh=ZIhUJYvk/wOqSM1Ia5ds5H6P5YLEAb5YuO7xaYAFlVI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MVEfwmYzidSKE8ZlRRWp4o1UTKavYUEUz/cwEieHbiHLK87GlaeM2tOicYfQSF2s4ohRrvIGM1JLDYZB4fxjVQuofjI+J6pFRbtnz1DPSvvQE2W6m/U/96rsqTp0m954lKqC8iOmiOAosTcI+Ciyk4CP0VmTA+PqpxhMdR7AOeM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=F7SqsJJ4; arc=none smtp.client-ip=74.208.4.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="F7SqsJJ4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1713272196; x=1713876996; i=parker@finest.io; bh=/pMNEblpoORPGqBosh2QqloC4JBppA9VbN2iUpBE/p8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=F7SqsJJ44Ke/3ripWDqYM6t6r0/HLxveQjdJBTp90pbWNw6f7xcKT4x/ef7HUAaG q+OE6VfaWed4SFPu/kdTvogcwSsLkv5QA3YeqsnoHxTGvzFG2kb6zBuVie/ByLogh UwCC1dRUE6MlqHChi9WZMmbL0LKX+paNnk8WAihNpiBttfumbPBjLqfQYyNLCegma 5M1I/exxJz1GfxIDz4uDBSDfzKzd6OHztJasRCs02XifdQPwLVTUpAZcK8mv6EHnn jNKv0xlGwF2ev8a4l8jakCv3dGLl4jutKvmMr9QYOpzFhaX7wPqbyvorvL2CvRYay OQWOSb3AVoTgtEbhlA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0Lan9S-1scchQ0Eh6-00cy8L; Tue, 16 Apr 2024 14:56:36 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v3 1/8] serial: exar: adding missing CTI and Exar PCI ids Date: Tue, 16 Apr 2024 08:55:28 -0400 Message-ID: <7c3d8e795a864dd9b0a00353b722060dc27c4e09.1713270624.git.pnewman@connecttech.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:/xHh/AkH89Z8uGkzl5PbTvHd7qBh0BgC800ou4B0KmtKs6cDYjz HbOFWxvfzTXW9n7JjOTkKQXMzE/QhwqP6fmXRvSBRFsTD0tTNRtbfKzDIVK3nhpURdGeDD4 JfH1FYENDaGag5mrE4JwuNjnLIwjI2qyawEyh3cT21j1dk1xZWcuAgUdNLrP2loO/XXkaXJ ti71253uQEFfSAkbmGCeQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:q/udNzQOnbI=;shTdRZPHhz1v4L9TEhcRavEEyX3 HhiWhZav0LU1ooDIfslUgonWfaxmqsrSHFBT5ya4t7mlS/GrQbDy95FyVOj8ciS4BZtnW1HQI TLc+ndgCMLDarGf66tVa0rQUYf2+Q9dNsGp1o3rE/nIQIUu5jV8P3xx1OQyorfSEf3dwP7CDn kj5bpygksnKyqf1Yq/eU0m9hwG44chATqzPV11xln+KFZyaZFtLw3QQdZu2sygjKy7YaHF8Yj IlUoXwPwVTjGFjGUGVYRyNqIRiv533CCjwi4a35dbxQD6dmBTiNsKqHdcDQjvh5TK4nE8Zn1g eiZp/ytmzQFfuTTuvFMj9OPUf/Dqz/s/971Ho4ybjmz60WwnIukxgyzYGZj3uFGlH9DMFMaLj ZtrqrQFFN9CASjdoGiS8W4ev59qK8vsiWQISrFdFtJas0P5qxg0Et2JHiqW4wcbrU1mxkHHWk nH1rSLSTcD+AHU0Tedw+9x5Lhq+5AsDuxtwQlZFmyBzLH+P3a7woGHCQexHwE8Exur1tUEraz +CRQ7pqRO4+0xYKv9d9NO8z9M9LszxyRtfRCb4q5WVmD/8RrSDACmKk64T7ocuIOZ2pIbNKdw yJAaosb70AqjYB46Fs7vS9ed/LG5Gly1+enPdnTbAiwhwRr7p7PGeYW0Cxa3/3PkzouM9BPg7 MloAoeaY8l96PRZw5cnOkSQWHiddgIejbVnSV2tLvnGWXqfpYhNSOktE4/zU0vL9wAx2396wZ LVX9eVdddMwhwXwtAmb02wWZ8UvlzqD55jrfBUefLJiJJCSCDctEyE= From: Parker Newman - Added Connect Tech and Exar IDs not already in pci_ids.h Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) -- 2.43.2 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 0440df7de1ed..4d1e07343d0b 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -46,8 +46,50 @@ #define PCI_DEVICE_ID_COMMTECH_4228PCIE 0x0021 #define PCI_DEVICE_ID_COMMTECH_4222PCIE 0x0022 +#define PCI_VENDOR_ID_CONNECT_TECH 0x12c4 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_SP_OPTO 0x0340 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_SP_OPTO_A 0x0341 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_SP_OPTO_B 0x0342 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_XPRS 0x0350 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XPRS_A 0x0351 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XPRS_B 0x0352 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS 0x0353 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_16_XPRS_A 0x0354 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_16_XPRS_B 0x0355 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_XPRS_OPTO 0x0360 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XPRS_OPTO_A 0x0361 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XPRS_OPTO_B 0x0362 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP 0x0370 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_232 0x0371 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_485 0x0372 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_SP 0x0373 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_6_2_SP 0x0374 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_6_SP 0x0375 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_SP_232_NS 0x0376 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_XP_OPTO_LEFT 0x0380 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_2_XP_OPTO_RIGHT 0x0381 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_XP_OPTO 0x0382 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_4_4_XPRS_OPTO 0x0392 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP 0x03A0 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232 0x03A1 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_485 0x03A2 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_UART_8_XPRS_LP_232_NS 0x03A3 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XEG001 0x0602 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_BASE 0x1000 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_2 0x1002 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_4 0x1004 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_8 0x1008 +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_12 0x100C +#define PCI_SUBDEVICE_ID_CONNECT_TECH_PCIE_XR35X_16 0x1010 +#define PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X 0x110c +#define PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X 0x110d +#define PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16 0x1110 + #define PCI_DEVICE_ID_EXAR_XR17V4358 0x4358 #define PCI_DEVICE_ID_EXAR_XR17V8358 0x8358 +#define PCI_DEVICE_ID_EXAR_XR17V252 0x0252 +#define PCI_DEVICE_ID_EXAR_XR17V254 0x0254 +#define PCI_DEVICE_ID_EXAR_XR17V258 0x0258 #define PCI_SUBDEVICE_ID_USR_2980 0x0128 #define PCI_SUBDEVICE_ID_USR_2981 0x0129 From patchwork Tue Apr 16 12:55:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 790133 Received: from mout.perfora.net (mout.perfora.net [74.208.4.197]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BF77628E6; Tue, 16 Apr 2024 12:56:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.197 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272216; cv=none; b=Gitk+3BrnqYkjjcG4MNaJl9Ey20E7UbErwvlxg2/7kbvLvAZ0AqxhlrO2TuBpcZCVBl0OBKGHVcKf58WCwEaQUt+ymkvlE/tY4f5DWDxt5As9NtxAdmv+71rLSnT1Tl0QS22geLWlrzBFa7Bu24BYL6yRnyb1XLbYCkTsv/G11g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272216; c=relaxed/simple; bh=p0pbcjOGrW9R0+xZei0K9xOJ4ALbve9BFZcsgFbKluk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ae0poVs9sM5Xo7eYAS2haEpyIO6HPO6Cdz0eX0OLzkvK63V2ZK2h6ROywqy6bRhFdR+/Bk0oly98lAVao7yZQI84ZaCgLo8Xols3inKK4ftVwx+m79yMfozswUYVyB9VWATv9syu3qerVrch82d0tO08Kpz7S79MplC4E6g3VjI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=nOxbeoRm; arc=none smtp.client-ip=74.208.4.197 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="nOxbeoRm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1713272196; x=1713876996; i=parker@finest.io; bh=IIhBmpy4z0+P4cIvEA/H163fhCoG79SjvbrHTTat3eE=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=nOxbeoRmjImYJx18ovcJd9LmW8W7QjtH7lNq1KvBzQJPfEhnQJ4YwnFf7ab3hdcC xwk8tTg8ctqG9ySZm9Q916CVCz15Guyu8X0i19LGf/wnIhCNCbBwXLRRgD4LEiMjO YL54fSJdirtkv5RqPZxsTBQJkeA4NAKuFWBvnr7IwNR97EPmXBOww1jtNg6mzM27i JHNIBgF2jhH4j3InIKHoQghAKknacahZE2vP95tNE8dMYgOxN/+oknfRSmqW9a8oP NwjkxbSG99N6bDMQSm0Z/dRqMUrpIQ9FeAco5+7sa5ZfQTl54M6FHPUCotw+Z+b+D soa1X1leyzOs4Qe5nA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0M87rr-1sjR8X1Up7-015JhU; Tue, 16 Apr 2024 14:56:36 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v3 2/8] serial: exar: remove old Connect Tech setup Date: Tue, 16 Apr 2024 08:55:29 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:tUm/cSDLboyH1ISWswfOkWKv27rJSe9V8B/rZvcDNSuobuuQYpd lvvyW3yEbQRVS7uA2VfbI1RR4cQ+WF4G3p4THBjga0M9GlaeKZk90iqlT4N2f6EZnVoRbDk minojfnFEP8flDehuE/1Gvm1Oz+r+A5G7XgoD9YGPrESP989cLZdPVLquhEYYGplc0+fS/0 m39kdFlVtbotjlx6nuX6Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:obspGj4EhAw=;JJTplzmRPYtAgS6qB35fBIkvE// BeTnDT8OFK8HkAKi6Xs6BUdWEbOdKyWq1kk7jykPmoDP/RK3BRnme4qKLD8CdKkczYAy1baux 8NX+vbZAtaXqQVahvntl3VuBfLcgRCYg3UBVgXyKChlYBVQFBEugpj2Gb8aGVgoR1cmY2AKsG jviVEJjlwM2ZJ/kAPwU6QLwppG4A75B0IPexF+DZzonk0ZrfUi0hSsa+9h/odJo8Q225qiiqQ nEoZnOmLRsooeOnUko/ErZ5ahgVhzsQtREGm75zkxX6ZAM3VEjSRhb9sr6hG0QePhktWVzo2/ we2Y2rE2trC1u/BsX68spkDAlgUZGUlTqmQM7StQhLnoPxFU9ouQMEjT2DLFlidIP2LCtsAUP 9aad47PU6m0yGl9f7L7ZA4IlcPDzbd6UQkjtK/m+Go0xj/OV8eEqmnWnSaEqit7gnlfg13cx5 J4xZyDb5n4sPJDvDUve9hiWej/uIhNl+Ze21baK2/bh84PFXH3g/TsidlXssSNZz8jFMoqEpu HFKioHHmNIQwoe4SqcVGJDT53LNdaSnGIPwWf1o30cEfmRz0d1aeFz36oATqsWrL0Pyo1snIK h7w/wfyGZQmDKsdelNA8wCMzBiN+evBPYNgDA7DRijenOvm96HSSdIWEYdfISF0lJUOt5Klp6 3DTS5XPoraUTfJsJlvAhbrnN5RgDXX0RvP79fBmIPfy7mqS9lm9e1MHINJZ/g+Ifu0D/eeACL nDIi0pYXsKQ1O+ZhaQKDEm+OsIeW6Gyf0CRB7b2NKUyC5BL/o+qGc4= From: Parker Newman Preparatory patch removing existing Connect Tech setup code and CONNECT_DEVICE macro. Changes in v3: - Split code removals to own patch Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 37 ----------------------------- 1 file changed, 37 deletions(-) -- 2.43.2 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 4d1e07343d0b..3565b880f512 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -357,17 +357,6 @@ pci_fastcom335_setup(struct exar8250 *priv, struct pci_dev *pcidev, return 0; } -static int -pci_connect_tech_setup(struct exar8250 *priv, struct pci_dev *pcidev, - struct uart_8250_port *port, int idx) -{ - unsigned int offset = idx * 0x200; - unsigned int baud = 1843200; - - port->port.uartclk = baud * 16; - return default_setup(priv, pcidev, idx, offset, port); -} - static int pci_xr17c154_setup(struct exar8250 *priv, struct pci_dev *pcidev, struct uart_8250_port *port, int idx) @@ -848,10 +837,6 @@ static const struct exar8250_board pbn_fastcom335_8 = { .setup = pci_fastcom335_setup, }; -static const struct exar8250_board pbn_connect = { - .setup = pci_connect_tech_setup, -}; - static const struct exar8250_board pbn_exar_ibm_saturn = { .num_ports = 1, .setup = pci_xr17c154_setup, @@ -896,15 +881,6 @@ static const struct exar8250_board pbn_exar_XR17V8358 = { .exit = pci_xr17v35x_exit, }; -#define CONNECT_DEVICE(devid, sdevid, bd) { \ - PCI_DEVICE_SUB( \ - PCI_VENDOR_ID_EXAR, \ - PCI_DEVICE_ID_EXAR_##devid, \ - PCI_SUBVENDOR_ID_CONNECT_TECH, \ - PCI_SUBDEVICE_ID_CONNECT_TECH_PCI_##sdevid), 0, 0, \ - (kernel_ulong_t)&bd \ - } - #define EXAR_DEVICE(vend, devid, bd) { PCI_DEVICE_DATA(vend, devid, &bd) } #define IBM_DEVICE(devid, sdevid, bd) { \ @@ -934,19 +910,6 @@ static const struct pci_device_id exar_pci_tbl[] = { EXAR_DEVICE(ACCESSIO, COM_4SM, pbn_exar_XR17C15x), EXAR_DEVICE(ACCESSIO, COM_8SM, pbn_exar_XR17C15x), - CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect), - CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect), - CONNECT_DEVICE(XR17C158, UART_8_232, pbn_connect), - CONNECT_DEVICE(XR17C152, UART_1_1, pbn_connect), - CONNECT_DEVICE(XR17C154, UART_2_2, pbn_connect), - CONNECT_DEVICE(XR17C158, UART_4_4, pbn_connect), - CONNECT_DEVICE(XR17C152, UART_2, pbn_connect), - CONNECT_DEVICE(XR17C154, UART_4, pbn_connect), - CONNECT_DEVICE(XR17C158, UART_8, pbn_connect), - CONNECT_DEVICE(XR17C152, UART_2_485, pbn_connect), - CONNECT_DEVICE(XR17C154, UART_4_485, pbn_connect), - CONNECT_DEVICE(XR17C158, UART_8_485, pbn_connect), - IBM_DEVICE(XR17C152, SATURN_SERIAL_ONE_PORT, pbn_exar_ibm_saturn), /* USRobotics USR298x-OEM PCI Modems */ From patchwork Tue Apr 16 12:55:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 790132 Received: from mout.perfora.net (mout.perfora.net [74.208.4.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B60D212BF15; Tue, 16 Apr 2024 12:56:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272217; cv=none; b=PvCEHE55no3KhZo1CaZOBoID4/36D9g5SxY3ktU3/3tK5cDgqLZFcTuSQzvxdvVD5o+wqSJFjJoCF3OSYjKnw8C39W3SbBA4CwPDfodEItS2fDAa/anvJSA+ni8cLQu4EMHK7TTAJncGpLwbZOzZBK/weVSHb01NHD8w4KmdIfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272217; c=relaxed/simple; bh=L0bwfC7QPhgn8nVwSuegcUdEIriV44jAxrlwA2aq5c0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HYKwgar4jXvlR7ghaWaQid5R+6pFIwb2l7b9zV+LfH6kncQQhGSBGANhdAtu6GWV44UsmpFI4Ge0H7Z/qwWo3DDQ39i3wrJBEd3XavbcsVg1kqk0ucCnsfeod1a4Z2Y3qpwuVb8b5s/GBKSTZdjUsW2Woi5r+Wx8gZcfyE3/RFM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=ieObK0E0; arc=none smtp.client-ip=74.208.4.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="ieObK0E0" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1713272197; x=1713876997; i=parker@finest.io; bh=mTpO0cGiHBKqJRh0o/22NMtUp4Gs856K6CxolXkEPh8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=ieObK0E0v6lboH7g9dZor/h29uZfJqxU/0wuV78NzDvtJdYCauN9mBkF0XEOkLmh yL6uNVrod1j2xx+ZRWzRhawLCJ4Wnfo3PERzokjla7LFdp4+SgUoeq7HeUcdHOGR+ SwKgfCqAxDqdtVlA7p0z7r8oB/xvdF4RsfW3tyYJznhue9rNre+BMWTtheN6mGZQj 1nKx9oAt9v+ME/39GHVxD7hCYU4bUXp69wBsS2INhwT5b2dovbJut5qjRZsLYvT3D IlTByh/+1shVDVyss6+kdUotk1G8/FEpQSRjlGS9dapOW3e4h093+7BuG6tfs93da 5jTkw1AazMIv/5x1rA== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0LkNen-1sTaH81BE3-00m0QQ; Tue, 16 Apr 2024 14:56:37 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v3 5/8] serial: exar: moved generic_rs485 further up in 8250_exar.c Date: Tue, 16 Apr 2024 08:55:32 -0400 Message-ID: X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:GqCZO7Z93IKq1C/aerb2hYCsxQYB1t8YENfP/S8qxEtpnUdsE0H Tn0jVn6erNub9waiGGs7+IUub0CryZOSn0+zwk1BRe1WZU1P+LNXfbwn51wSFkl6Zk6lVwG 0A8N36FJdhlGVWHaOc61gNnAyI3pYbZhi+j9gi7+32+ICow6yDoDVHY5rxpfctCY2hnkHlh 0fpx6hlDLjznNBPiZ2WCw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:J5uH9/3EKuQ=;U9TNMJS12lgnpmTEANSvnUuQjMY cJGgBTZV8u4iHkjBxWEpVLdD27Udc2q1Cgjc+UcAfz1fVg5ZRH0JZNqUpTb2EtIF25O/vYXEp 1i6MKG3jM9UaxeZhamV4s9ojgibrdaG52g/138SdmDLeKNkjkGDbVy0O1Ea2lHWhVg5z1NiLS 0lgBNJWpkt79gozRMsq7aYiQ8cqmMm6XUBo2w7fjNuKoMuAjcCIfNP7wa/+Mk8edz5YmL5lWF yHHU19DNCMYvKNNj9ONaZGupFfh82LOwVunEpb2ubOHKmVFtkAyv7dCi3nFj9OF2wVDtOxTS9 PTCiPMAJtnJt1ikuPcTSRNpsRuqNYRRt4RzRYVeKBVk/R981kkXVxsSxItOIhEKVVj92iINSH UOnYiHlXk8ZT1wENtpDO96yDvwGLvUpJCha+gBx13v+W/W3cjKPjJZwNpNTGpm1me+geBD61J IjnAvokY32/CoNsvy1l2WeAb05s7yqIDvYlMCNsAwkS7vOE7y1PIU84dtnw8fYOPlDMx5BaMo 1vaGT+V/KKprbi34RKn9qVbNUH89PPWWSSCiO0spakfy5SM4UFR9pi3N0JAksOSptsogCbzD2 qN25iIIbwIakp1DC6TpCZM2UNltqSE9R36EJ8FPL1jn1ad0wtZcWlFI3MayjJdtOvXIAQOcs5 zFkbva+meSjOdCkhaNRtCpNDGm4Z+XXpH7Goou9XYo0hc8qFBQsseZ4tMGdRD6mIK7dURfeBC A0Cp3UsNai7tBzTJE72KnvmOx50oc17/f2uLPEC6dOyYNSiwWPsyX8= From: Parker Newman Preparatory patch moving generic_rs485_config and generic_rs485_supported higher in the file to allow for CTI setup functions to use it. Changes in v3: - split into separate preparatory patch Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) -- 2.43.2 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index cf7900bd2974..7e47a4145c7b 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -197,6 +197,31 @@ struct exar8250 { int line[]; }; +static int generic_rs485_config(struct uart_port *port, struct ktermios *termios, + struct serial_rs485 *rs485) +{ + bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); + u8 __iomem *p = port->membase; + u8 value; + + value = readb(p + UART_EXAR_FCTR); + if (is_rs485) + value |= UART_FCTR_EXAR_485; + else + value &= ~UART_FCTR_EXAR_485; + + writeb(value, p + UART_EXAR_FCTR); + + if (is_rs485) + writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); + + return 0; +} + +static const struct serial_rs485 generic_rs485_supported = { + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND, +}; + static void exar_pm(struct uart_port *port, unsigned int state, unsigned int old) { /* @@ -458,27 +483,6 @@ static void xr17v35x_unregister_gpio(struct uart_8250_port *port) port->port.private_data = NULL; } -static int generic_rs485_config(struct uart_port *port, struct ktermios *termios, - struct serial_rs485 *rs485) -{ - bool is_rs485 = !!(rs485->flags & SER_RS485_ENABLED); - u8 __iomem *p = port->membase; - u8 value; - - value = readb(p + UART_EXAR_FCTR); - if (is_rs485) - value |= UART_FCTR_EXAR_485; - else - value &= ~UART_FCTR_EXAR_485; - - writeb(value, p + UART_EXAR_FCTR); - - if (is_rs485) - writeb(UART_EXAR_RS485_DLY(4), p + UART_MSR); - - return 0; -} - static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termios, struct serial_rs485 *rs485) { @@ -517,10 +521,6 @@ static int sealevel_rs485_config(struct uart_port *port, struct ktermios *termio return 0; } -static const struct serial_rs485 generic_rs485_supported = { - .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND, -}; - static const struct exar8250_platform exar8250_default_platform = { .register_gpio = xr17v35x_register_gpio, .unregister_gpio = xr17v35x_unregister_gpio, From patchwork Tue Apr 16 12:55:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parker Newman X-Patchwork-Id: 790131 Received: from mout.perfora.net (mout.perfora.net [74.208.4.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B301E12C7FA; Tue, 16 Apr 2024 12:56:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.208.4.194 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272219; cv=none; b=b9zB4TPO/HVpNXgIKI9rUU7IYSewF/Co/I7zX0QxnS8p7U1UoWXf83IqDDYogin73ghfIhGo0la9hWOHHTkfpcnIayghaZA+TdrcIFdliNby8VCBm5OOoWFRGDGHoj9cKrryOJE3dwTvx7luOYp+ZWXGkQk2P+molsYLqMmxJeI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713272219; c=relaxed/simple; bh=BeHbDLxRX4WOrHYa4ThT+3HJ8zBUg6fW2R74rAnsV38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tVR5wdFdSMic4xKez7LMslkdYgJ1APH1bqZwS81blo7L/tdMeo8mMzRThgkaCE+R51O2QpmpGqEsCAazmCAn3AaXvvDJUy375dmjNwLnlHNb1EoASM48qvGoYrv2xldbAaszDc9FeZw2gw+mAMDj80XivsqrJ+NGH90FOGYmxtc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io; spf=pass smtp.mailfrom=finest.io; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b=EWYhDEmy; arc=none smtp.client-ip=74.208.4.194 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=finest.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=finest.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=finest.io header.i=parker@finest.io header.b="EWYhDEmy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=finest.io; s=s1-ionos; t=1713272198; x=1713876998; i=parker@finest.io; bh=kAv0oBFkgwwU3Vt2YCqpLc+ik9GcQOdElLHJtyXfBOo=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=EWYhDEmySObpxDKJlYLm19HJhmWDuGRRG7zLtQ+qS8WdDpBpzpSiAxEk2FogTDKq JDTZD05z/D04Hnt/UvQ4/KvKZgkJfSTQKbPUfdDnznn1cf5qcotxk87hRZ6+oa0mK zF1hxawKorfmyFSRu/N0HomgvXvOcT62xSeMSTOkb/+kY+y0KmlUiy1GD5edooMJI 0ba2PcJSk26I35eMprZ+kDNUXAeE5ZcM3YrnsuQqLfuuSruhYrK0Y59AYvLSTaGCo EiKy8p/uZQk5E11ukcjaPSI7ZUsRUthZNMBycLfsA/bYKw9JOS6nmmP2pCGynUwmh RgaFX/mrfD6yEeRWSw== X-UI-Sender-Class: 55c96926-9e95-11ee-ae09-1f7a4046a0f6 Received: from finest.io ([98.159.241.229]) by mrelay.perfora.net (mreueus002 [74.208.5.2]) with ESMTPSA (Nemesis) id 0M5uwh-1shFHT0wnJ-017VYa; Tue, 16 Apr 2024 14:56:38 +0200 From: Parker Newman To: Greg Kroah-Hartman , Jiri Slaby , linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Parker Newman Subject: [PATCH v3 8/8] serial: exar: fix: fix crash during shutdown if setup fails Date: Tue, 16 Apr 2024 08:55:35 -0400 Message-ID: <1a21fffe403d7181e0404db1ed92140c306f97b7.1713270624.git.pnewman@connecttech.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-serial@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Provags-ID: V03:K1:Aix2Gfbz3WAlz2Z+lR82+NyyweP0ySGfxPJud5y3h/eaUD+TfCK tNX9oGSruoLdOu9OVjQ9Uo+0rMlWuAnj6QsQuf3NDwyJeJenh9G0YNuqjDrvxGC9To3Prd5 jnZUmHyyBgT1l7zjRXaSm1ujrg3CmsH+J0VneP9UY/0irnodH4Aa//OhmPjPqbOQZeA8qvd qvFGMX5q3L8Sz2gc/pDIg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:R9jOjENT1WY=;ejdCrwwafJxLraDIM3YWdGe5Gf8 TGgftdLfb0YEcoJYUk0MjEIP5PuK3s748EFwOTKaLY+Pq67vKwXlBwwF6Qr2vRrcq7L3SIdyI ysVumb/Co+kA88d4EnuG+4x/6O0tWghnHZXILOYGY+grItIiuXDDBue+YGPsojqQe/vQFCu5j AnM5ofSPS1mRszGgXFvhgtEyU56eKQwL/kQPAumflvQARki2PgJ4EtskR9xbqSQuv0Lv64oH1 4BHQXvS8+9kES+adbpXhgmg8qJx0KNTUNBRlc2QE3qzfSZqa67dmyl9sG1+75pkPjusK5YWqO dbNGBATZ2m8olWBCF3w/91oDCqfQZ5sASj4VQ+iFfbEMhI9UE5bX+ve05LagaY3wxSKdQD57K 85LMfFDKXgdBsYuNP3iCqh0/eKX7k8Ut8ntFm/p+/9WiPYFFbN41dn+hjOFfmhhCK+KAaBpLC EnvcA5GERyQum/2sHmHkh2gkjT+K4S7xvi9KNWBmRztfGF4+MFs929LvBWT/MZ1c29emR83Ao RZSvao8gY2jnbrYQvmBdmHxzFDr0qHlmjqS9mOZTXXjDpb1+S+bUJdhSFTpIzFsWz0Ak0iQdR Csqskd5/909oaQ3kbEe042qJU62/boQ1w7xDTaMMdUARd0u1l2ktaUbvJtXIjCHJLGpYZC/4Q OV4ZW0lBaNndXjHuKj0L55EB0NoyqPeg+rN9YX4gufMj9w9ko44hKulEjeQX/xzkmNgQVOt0V eiF47/CMa5tfT5XvMX9PeNVTtTPxP1P+frurlBoSXwIT7gPCDQTyvg= From: Parker Newman If a port fails to register with serial8250_register_8250_port() the kernel can crash when shutting down or module removal. This is because "priv->line[i]" will be set to a negative error code and in the exar_pci_remove() function serial8250_unregister_port() is called without checking if the "priv->line[i]" value is valid. Signed-off-by: Parker Newman --- drivers/tty/serial/8250/8250_exar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.43.2 diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c index 501b9f3e9c89..f5a395ed69d1 100644 --- a/drivers/tty/serial/8250/8250_exar.c +++ b/drivers/tty/serial/8250/8250_exar.c @@ -1671,7 +1671,8 @@ static void exar_pci_remove(struct pci_dev *pcidev) unsigned int i; for (i = 0; i < priv->nr; i++) - serial8250_unregister_port(priv->line[i]); + if (priv->line[i] >= 0) + serial8250_unregister_port(priv->line[i]); /* Ensure that every init quirk is properly torn down */ if (priv->board->exit)