From patchwork Tue Feb 6 21:42:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugo Villeneuve X-Patchwork-Id: 20027 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp1854210dyb; Tue, 6 Feb 2024 14:15:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHids1sTH3yJlP2mPsmc+kgwybJQnhbt/wUmVjk1NtZJKMiD+++MiY99hMW+l5IOGzFs3ZF X-Received: by 2002:ac8:59c8:0:b0:42c:3a1f:652c with SMTP id f8-20020ac859c8000000b0042c3a1f652cmr2614006qtf.56.1707257724461; Tue, 06 Feb 2024 14:15:24 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707257724; cv=pass; d=google.com; s=arc-20160816; b=Z6vizJOCxKmXYlwXzcwN0ZKIVqQgyoj0fIui1Pk40aIoDonmZiLZJ558x2FTvIoqcx Kps/R0JchUUMnf5siSA5nAwqOUBLbJwO8fSaTwKnYZJw+1n32+aY0ADc90g+9tm1GsN8 iiDbds3zmZVpXeItRutIKspkvN3RnDyUp8/34E2tqJUAsXFv2/qOfNjaXL4/nyOzTG8H 5882zfAYhssBRMmKRIFA/sGLK9dW8uUHZHoqEdBmlVzUmvCqZh/5Uh28WUzLkEhKMrFe oJTlvpqDxe1J1BFK4lYbi9+KRKCF+x9KqwlkxNr6pZ2qnAVmusHoenynp+fWYuLBGOLe UZyA== 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=t5ACsjfeWK+CXyvqFoni4DQqe1wDkuuTlLq8NUvOmK4=; fh=j3prnoX5qK7Ej2Gb+Auf/eUFzqU6oTasOSjZEp12zDc=; b=RaaFhAaGO0xGBa4+GKMzHIfhXhm+93i4sqjTaj99M3kEoJUuUJO3wwSUTW63kXgYN4 +Q5o8eyGrf4uS7Oiz+mVfhvxRiO87dWTjQo3ELXKxDmyN9ysnGubEPJlMaJ7dzT1nsL+ jl0DOnRKeXuCoaHYEIGLdrhznTQkht6Tsfd4Xyd45EjTMV8B6aC/en8E+Fh1WyacNY+C qjujGWOvVUN9cvqD3OWJxJSijDKVwmvsky7M//hEFDlPtlnzjx/GEV32MDzJCVKrH7ZC L9zYTRlgvRfFRIdY5+VEMLcShd8OyuFSu3v+wca9EiJ6hyr8R6UtMWHpti5RvatZTuQe j7xw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@hugovil.com header.s=x header.b=Y8OaEty5; arc=pass (i=1 spf=pass spfdomain=hugovil.com dkim=pass dkdomain=hugovil.com); spf=pass (google.com: domain of linux-kernel+bounces-55680-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55680-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCVTxPRrvEV9ib//HF/KTdzD87FvVGqaAoJTRNWewVuYgI38m5YYsUlCjdw4e2GwflGWWpJ8sEEEM+gwwOf2YqSOVDlaGw== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id q7-20020a05622a04c700b0042c3d3325fesi694059qtx.748.2024.02.06.14.15.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 14:15:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-55680-ouuuleilei=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=Y8OaEty5; arc=pass (i=1 spf=pass spfdomain=hugovil.com dkim=pass dkdomain=hugovil.com); spf=pass (google.com: domain of linux-kernel+bounces-55680-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-55680-ouuuleilei=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 E4FCF1C247A8 for ; Tue, 6 Feb 2024 22:15:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 129DE1CD20; Tue, 6 Feb 2024 22:14:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=hugovil.com header.i=@hugovil.com header.b="Y8OaEty5" 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 2FC421BF40; Tue, 6 Feb 2024 22:14:35 +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=1707257678; cv=none; b=d2qiAfpQgWpfL820MxCoNMjmkgVpfNPXG4k0WSi7GYuD8bIbdqeOfEoFRdjCI08gdmy+8FfkjHbtRNNSgj/9L8JCsJTzXkodfvDfTNFN27t4IpVu9du8PEbQ8jPJZSJbU+ntgv2JyeHEZ0or/O80JyGkMpLkgghm2NWHwPzGf6c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707257678; c=relaxed/simple; bh=Q5I7J+08Nn3BO065gykwRL7HeIo0M74BEk0jB9ySsjY=; h=From:To:Cc:Date:Message-Id:MIME-Version:Subject; b=dtIu7cezhxDQvsieDmr7LuS6LILQqj7uDyIEb3oLH4GC5ZBTgbZauuCm3afE3MN2k1jvGUeCI55rEG1ZlfYzwFCF5ql9jIwKyewqYMV+dnjvaTmv0WXSiUcNnpa5XXdB0BALeA6gqKnc09onPlRmqROcnXNaq4vFLy3ttLF/1gI= 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=Y8OaEty5; 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=t5ACsjfeWK+CXyvqFoni4DQqe1wDkuuTlLq8NUvOmK4=; b=Y8OaEty5rF4Tg1UH3gzkNe7TQG 3BvhE5zyzLlkgREzpTzKZ0llCrBfiGp6f5Cn4h5/zl7SbgC8XdnqEaoH+HVsfFgE5+LtGNlBgXFnE fG83F1ReDum9YicGrv3UjI3uxTB0otfWt7pthjfLKBYNLjE6N7YdhwcKDwjbkRkvAgI8=; Received: from modemcable168.174-80-70.mc.videotron.ca ([70.80.174.168]:41434 helo=pettiford.lan) by mail.hugovil.com with esmtpa (Exim 4.92) (envelope-from ) id 1rXTCl-0006XX-2N; Tue, 06 Feb 2024 16:42:11 -0500 From: Hugo Villeneuve To: gregkh@linuxfoundation.org, jirislaby@kernel.org Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, hugo@hugovil.com, Hugo Villeneuve Date: Tue, 6 Feb 2024 16:42:04 -0500 Message-Id: <20240206214208.2141067-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 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 * -0.0 T_SCC_BODY_TEXT_LINE No description available. Subject: [PATCH 0/4] 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) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790189476071439957 X-GMAIL-MSGID: 1790189476071439957 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 patches are multiple, simply to facilitate the review process. In the end, they could be merged into a single patch. This patch series depends on the the following patch (in linux-next/stable): commit f7b487648986 ("lib/find: add atomic find_bit() primitives") 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. Hugo Villeneuve (4): 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 | 242 ++++++----------------------- drivers/tty/serial/sc16is7xx.h | 41 +++++ drivers/tty/serial/sc16is7xx_i2c.c | 74 +++++++++ drivers/tty/serial/sc16is7xx_spi.c | 97 ++++++++++++ 6 files changed, 279 insertions(+), 220 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: 52b56990d214c7403b20f691ac61861a37c0f0db