Linux-Serial Archive mirror
 help / color / mirror / Atom feed
From: Hugo Villeneuve <hugo@hugovil.com>
To: gregkh@linuxfoundation.org, jirislaby@kernel.org,
	peterz@infradead.org, mingo@kernel.org
Cc: linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	hugo@hugovil.com, andy.shevchenko@gmail.com,
	Hugo Villeneuve <hvilleneuve@dimonoff.com>
Subject: [PATCH v4 0/5] serial: sc16is7xx: split into core and I2C/SPI parts
Date: Tue,  9 Apr 2024 11:42:48 -0400	[thread overview]
Message-ID: <20240409154253.3043822-1-hugo@hugovil.com> (raw)

From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

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 slightly 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
      [v3] https://lore.kernel.org/lkml/20240402174353.256627-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

Changes for V4:
Changes after Andy S. review comments:
- Fix commit description
- Fix includes for IWYU
- Add Reviewed-by tag (Andy) for patches 1 and 5
- Add exported symbols to SERIAL_NXP_SC16IS7XX namespace
- Fix Kconfig deps
- Keep Kconfig SERIAL_SC16IS7XX_CORE
- Convert to a single Kconfig entry and automatically selects
  I2C and SPI interfaces if available.
- Merge patches 2 and 3
- Add NXP and UART keywords to Kconfig description
- Remove __maybe_unused from of_device_id
- Simplify I2C init/exit with module_i2c_driver()
- Simplify SPI init/exit with module_spi_driver()

Hugo Villeneuve (5):
  serial: sc16is7xx: add proper sched.h include for sched_set_fifo()
  serial: sc16is7xx: unconditionally clear line bit in
    sc16is7xx_remove()
  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         |  47 ++----
 drivers/tty/serial/Makefile        |   2 +
 drivers/tty/serial/sc16is7xx.c     | 261 +++++++----------------------
 drivers/tty/serial/sc16is7xx.h     |  41 +++++
 drivers/tty/serial/sc16is7xx_i2c.c |  67 ++++++++
 drivers/tty/serial/sc16is7xx_spi.c |  90 ++++++++++
 6 files changed, 277 insertions(+), 231 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: fec50db7033ea478773b159e0e2efb135270e3b7
-- 
2.39.2


             reply	other threads:[~2024-04-09 15:46 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-09 15:42 Hugo Villeneuve [this message]
2024-04-09 15:42 ` [PATCH v4 1/5] serial: sc16is7xx: add proper sched.h include for sched_set_fifo() Hugo Villeneuve
2024-04-09 15:42 ` [PATCH v4 2/5] serial: sc16is7xx: unconditionally clear line bit in sc16is7xx_remove() Hugo Villeneuve
2024-04-09 15:42 ` [PATCH v4 3/5] serial: sc16is7xx: split into core and I2C/SPI parts (core) Hugo Villeneuve
2024-04-23 10:01   ` Geert Uytterhoeven
2024-04-23 10:02     ` Geert Uytterhoeven
2024-04-23 10:37       ` Andy Shevchenko
2024-04-23 13:15         ` Hugo Villeneuve
2024-04-23 10:36     ` Andy Shevchenko
2024-04-23 13:11       ` Geert Uytterhoeven
2024-04-23 15:34         ` Hugo Villeneuve
2024-05-23  7:33         ` Geert Uytterhoeven
2024-05-23 23:56           ` Hugo Villeneuve
2024-05-24  7:47             ` Geert Uytterhoeven
2024-04-23 13:14     ` Hugo Villeneuve
2024-04-30 13:03       ` Hugo Villeneuve
2024-04-09 15:42 ` [PATCH v4 4/5] serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_lines) Hugo Villeneuve
2024-04-09 15:42 ` [PATCH v4 5/5] serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_regcfg) Hugo Villeneuve

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240409154253.3043822-1-hugo@hugovil.com \
    --to=hugo@hugovil.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hvilleneuve@dimonoff.com \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).