Received: by 2002:a05:7208:3003:b0:81:def:69cd with SMTP id f3csp4228832rba; Tue, 2 Apr 2024 10:45:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWK2nbmZ0sU74f5yDkR9Ae1rykfgRpllYyvcDlCpkikpd7emdapdo7hQzr1bU0PERkQpxecZVI8hT/MqWhE+j69eRemXStUM2fqo6jMGg== X-Google-Smtp-Source: AGHT+IG1Q2jj+7r08RduMIjGm3y2llg3U4MQoXHnkJpymwpi22w0FKYf4dyLNkxPZpSser4pE5R9 X-Received: by 2002:a05:622a:7:b0:432:f68c:1a3a with SMTP id x7-20020a05622a000700b00432f68c1a3amr361141qtw.31.1712079915814; Tue, 02 Apr 2024 10:45:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712079915; cv=pass; d=google.com; s=arc-20160816; b=VFh3arMnfpgTCi2GGpAB7LT7Lgu5bHDsQcJgHidYrCAo5baFycBDbjxhG+C6KiJVkR +YUn053vEgkdeoVHI8uT2cWQ2eopvfJZ+URUKoW0Dla47EXKKq+Mjr8Nf6nO7Mn9ugMr vcEsjjtmlAOK1lYTGEBbIiXJO0VUnv9f0wc2+9LlkEgxg/07hbGe8X+FiltNzkrwUDlq qas+ZLtJl/fZhJsVEyMnUwfIomk9qXJYppmqwES1/liWlW3t1m+g0xq7f52TQ01wWiHW ec/Nt7LI5ckswDZxfg3O7ljhF4fE27lCvW1iENVmT8XYE5Z70WkHjwCm2fx1ewhEfz3+ rw3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:cc:to:from :dkim-signature; bh=4rrp6ETByzdIBJA25gHZc6tDZQp+n0yfQSvoQtvDxQE=; fh=fZm+o0eQwFQ40Rv6GBvAPvFKhvGGLg2dIl/YeDdOBEY=; b=sZlp+gu9mF4h2vA6cdIigxjGkt0/XcuRMaDbGbIrXtFXUk/b+lD3u2y3L6rI9Gj2dK EP/E7a4laYdAsftxI9CwI06OIFRsnJDXVwhHMZW9Ui8zZeFpF3sCGrv6TW6z7ODbR5u+ smZibCfu40ws+wmUEz/4ua9eekfJaVhvB5ljyBBTesm/2+JqMJBL+Wi8hmMxi/N58qBW 2hjEKSR5zFkCvaD8zhy5K9CJdOGEXd6La9atRNU7DSYpcdpA/HizJjQOszZZ29NajPfD VOrkhEtyWRrsNmqD30FxeDByrTbt9wkNeZb8TRNPZ9y6imCgmWddDPORwKBzwoVI82NY NfkQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=AWApqeI1; arc=pass (i=1 spf=pass spfdomain=hugovil.com dkim=pass dkdomain=hugovil.com); spf=pass (google.com: domain of linux-kernel+bounces-128448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128448-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q8-20020a05622a04c800b004313b320b0bsi12618062qtx.542.2024.04.02.10.45.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 10:45:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-128448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=AWApqeI1; arc=pass (i=1 spf=pass spfdomain=hugovil.com dkim=pass dkdomain=hugovil.com); spf=pass (google.com: domain of linux-kernel+bounces-128448-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-128448-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 8E20B1C223CF for ; Tue, 2 Apr 2024 17:45:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6714515AABF; Tue, 2 Apr 2024 17:45:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="AWApqeI1" Received: from mail.hugovil.com (mail.hugovil.com [162.243.120.170]) (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 F326A159910; Tue, 2 Apr 2024 17:45:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=162.243.120.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712079906; cv=none; b=IvaXIynZ8ERpdUUw1ZDyOe3EutpEudOCIGUjNKx9b+uxFnqFBrIDZ+noFhNMyOgj4sug2hQxh41/KfDLGHxjdIZLcBHp4eoxyf+i2y9jQPmFUth5vZgyw7avf00BjPF+KKXJ7BF6qI/u2Xl3M+yYeH0cNaCWuk/3Y//UcUTE2RY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712079906; c=relaxed/simple; bh=AbpB2KHSXA2Gd4ST+SXTe7OHQwyZ+KzWtYnbWX18qYk=; h=From:To:Cc:Date:Message-Id:MIME-Version:Subject; b=Q8/bolCLIZQeW6gkscKkw95h/IrXz9q78mwOmluqCsBhSoBpcD/BCxeWnvWyLEa+nhFc65POyHxGMU6Q/s0yrzdIUBCQpp0HyC+tnaybti522Qc097jUOACWpAi7n467mNPLvDM6YXjLhr9TE00gct9LNkC79bTlx2cwbq4XXKQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com; spf=pass smtp.mailfrom=hugovil.com; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b=AWApqeI1; arc=none smtp.client-ip=162.243.120.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=hugovil.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=hugovil.com DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=hugovil.com ; s=x; h=Subject:Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Cc:To :From:subject:date:message-id:reply-to; bh=4rrp6ETByzdIBJA25gHZc6tDZQp+n0yfQSvoQtvDxQE=; b=AWApqeI1n5Vww7rSVLD1Bh+WM/ kVNwusjnrs8FY7M8UIJ1csnrv4pSvCtrjgjEEQfF1ykzfC55EwqSR+kYUNhXdYuAhHuH5sZFEV7Wm UQidp5wdC1yzZqgmHG9v1wS1Io8L66bUy4REcvGOfBHOZZZHagWILgXSSP1yVnwMQ/Ac=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:56268 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rriBy-0008FF-3O; Tue, 02 Apr 2024 13:45:02 -0400 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, andy.shevchenko@gmail.com, Hugo Villeneuve Date: Tue, 2 Apr 2024 13:43:48 -0400 Message-Id: <20240402174353.256627-1-hugo@hugovil.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 70.80.174.168 X-SA-Exim-Mail-From: hugo@hugovil.com X-Spam-Level: X-Spam-Report: * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Subject: [PATCH v3 0/5] serial: sc16is7xx: split into core and I2C/SPI parts X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.hugovil.com) From: Hugo Villeneuve Hello, this patch series splits the SPI/I2C parts for the sc16is7xx driver into separate source files (and separate I2C/SPI drivers). These changes are based on suggestions made by Andy Shevchenko following this discussion: Link: https://lore.kernel.org/all/CAHp75VebCZckUrNraYQj9k=Mrn2kbYs1Lx26f5-8rKJ3RXeh-w@mail.gmail.com/ The changes are split into multiple patches to facilitate the review process. In the end, some of them could be merged into a single patch. I have tested the changes on a custom board with two SC16IS752 DUART over a SPI interface using a Variscite IMX8MN NANO SOM. The four UARTs are configured in RS-485 mode. I did not test the changes on a real SC16is7xx using the I2C interface. But I slighly modified the driver to be able to simulate an I2C device using i2c-stub. I was then able to instantiate a virtual I2C device without disturbing existing connection/communication between real SPI devices on /dev/ttySC0 and /dev/ttySC2 (using a loopback cable). Thank you. Link: [v1] https://lore.kernel.org/lkml/20240206214208.2141067-1-hugo@hugovil.com [v2] https://lore.kernel.org/lkml/20240307161828.118495-1-hugo@hugovil.com Changes for V2: - Move port_registered[] init before the for loop to prevent bug if aborting probe when i = 0 - Since patch f7b487648986 ("lib/find: add atomic find_bit() primitives") has been dropped from linux-next/master, rework patch 2 (sc16is7xx_lines) without find_and_set_bit. Changes for V3: - Simplify sc16is7xx_lines allocation by using the IDA framework Hugo Villeneuve (5): serial: sc16is7xx: unconditionally clear line bit in sc16is7xx_remove() serial: sc16is7xx: simplify and improve Kconfig help text serial: sc16is7xx: split into core and I2C/SPI parts (core) serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_lines) serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_regcfg) drivers/tty/serial/Kconfig | 41 +++-- drivers/tty/serial/Makefile | 4 +- drivers/tty/serial/sc16is7xx.c | 255 ++++++----------------------- drivers/tty/serial/sc16is7xx.h | 41 +++++ drivers/tty/serial/sc16is7xx_i2c.c | 74 +++++++++ drivers/tty/serial/sc16is7xx_spi.c | 97 +++++++++++ 6 files changed, 288 insertions(+), 224 deletions(-) create mode 100644 drivers/tty/serial/sc16is7xx.h create mode 100644 drivers/tty/serial/sc16is7xx_i2c.c create mode 100644 drivers/tty/serial/sc16is7xx_spi.c base-commit: 39cd87c4eb2b893354f3b850f916353f2658ae6f -- 2.39.2