Skip to content

serial: Add Tegra Combined UART driver

Thierry Reding linux-devicetree 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest12 patches 2 repliesIn review
  2. v210 patches 0 repliesSuperseded
  3. v19 patches 10 repliesSuperseded

Changes in v3 from the cover letter

- add a patch from Bartosz Golaszewski to use devm_kstrdup_const()
- add a patch to use device-managed registration to simplify code
- introduce explicit mailbox flush API

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12mailbox: Support blocking transfers in atomic contextdrivers/mailbox/mailbox.c include/linux/mailbox_client.h include/linux/mailbox_controller.h+33 -00 replies
2/12mailbox: Allow multiple controllers per devicedrivers/mailbox/mailbox.c+2 -10 replies
3/12dt-bindings: tegra186-hsp: Add shared mailboxesDocumentation/devicetree/bindings/mailbox/nvidia,tegra186-hsp.txt include/dt-bindings/mailbox/tegra186-hsp.h+36 -50 replies
4/12mailbox: tegra-hsp: Add support for shared mailboxesdrivers/mailbox/tegra-hsp.c+443 -610 replies
5/12mailbox: tegra-hsp: Add suspend/resume supportdrivers/mailbox/tegra-hsp.c+19 -00 replies
6/12mailbox: tegra-hsp: use devm_kstrdup_const()drivers/mailbox/tegra-hsp.c+4 -320 replies
7/12mailbox: tegra-hsp: Use device-managed registration APIdrivers/mailbox/tegra-hsp.c+6 -240 replies
8/12dt-bindings: serial: Add bindings for nvidia,tegra194-tcuDocumentation/devicetree/bindings/serial/nvidia,tegra194-tcu.txt+35 -00 replies
9/12serial: Add Tegra Combined UART driverdrivers/tty/serial/Kconfig drivers/tty/serial/Makefile drivers/tty/serial/tegra-tcu.c +1 more+324 -00 replies
10/12arm64: tegra: Add nodes for TCU on Tegra194arch/arm64/boot/dts/nvidia/tegra194.dtsi+35 -30 replies
11/12arm64: tegra: Mark TCU as primary serial port on Tegra194 P2888arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi+1 -10 replies
12/12arm64: defconfig: Enable Tegra TCUarch/arm64/configs/defconfig+1 -00 replies

Reviews trailers per patch

5 of 12 patches have a Reviewed-by or Acked-by.

PatchJon HunterRob HerringThierry RedingGreg Kroah-Hartman
1/12
2/12
3/12A-b R-b A-b
4/12
5/12
6/12
7/12
8/12A-b R-b A-b
9/12A-b
10/12A-b
11/12A-b
12/12

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v3 thread

Cover letter [PATCH v3 00/12] serial: Add Tegra Combined UART driver

From: Thierry Reding <[email protected]>

Hi everyone,

this is a reworked version of Mikko's earlier proposal[0]. I've reworked the TCU driver itself so that it relies less on global variables as well as added a Kconfig option to allow the console support to be selected. I also fixed a couple of issues that manifested themselves as I was moving towards the IRQ driven mode (TCU was passing a pointer to a local variable which was getting stored in the mailbox's ring buffer and the data pointed at was becoming stale by the time the mailbox got around to dequeue it).

The biggest bulk of the changes is in the mailbox driver. This series addresses all of Jassi's comments from back at the time. One notable additional change is that shared mailboxes are now interrupt driven, which removes the need for polling mode.

Unfortunately there is still an issue because the TCU uses the mailbox in atomic context for both TTY and console modes, so we get a sleeping- while-atomic BUG when using mbox_client->tx_block = true in order to rate-limit mbox_send_message(). In order to work around this, I added a new mbox_flush() API that will allow flushing the mailbox in atomic context by using the mailbox controller's implementation of ->flush(). For Tegra HSP shared mailboxes this is done by spinning on the shared mailbox register until the receiver has marked the mailbox as empty. I have been running this locally for a couple of days now and it works perfectly.

Furthermore this series incorporates Mikko's work in progress on splitting up the mailbox controllers and allowing multiple controllers to match on the same device tree node during mbox_request_channel().

The new mbox_flush() API introduces a build-time dependency between the TCU driver and the mailbox framework, so patches 1-9 would need to go through one tree. Patch 9 was already acked by Greg, so I would suggest that Jassi pick up the first 9 patches and I pick up patches 10-12 into the Tegra tree.

Changes in v3:
- add a patch from Bartosz Golaszewski to use devm_kstrdup_const()
- add a patch to use device-managed registration to simplify code
- introduce explicit mailbox flush API

Changes in v2:
- address all of Pekka's comments regarding shared interrupts, registers that don't exist on Tegra186 and shared mailbox directionality
- add a patch to enable the TCU in the 64-bit ARM default configuration

Thanks,
Thierry

[0]: https://lore.kernel.org/patchwork/project/lkml/list/?series=357641

Bartosz Golaszewski (1):
mailbox: tegra-hsp: use devm_kstrdup_const()

Mikko Perttunen (5):
mailbox: Allow multiple controllers per device
dt-bindings: tegra186-hsp: Add shared mailboxes
dt-bindings: serial: Add bindings for nvidia,tegra194-tcu
arm64: tegra: Add nodes for TCU on Tegra194
arm64: tegra: Mark TCU as primary serial port on Tegra194 P2888

Thierry Reding (6):
mailbox: Support blocking transfers in atomic context
mailbox: tegra-hsp: Add support for shared mailboxes
mailbox: tegra-hsp: Add suspend/resume support
mailbox: tegra-hsp: Use device-managed registration API
serial: Add Tegra Combined UART driver
arm64: defconfig: Enable Tegra TCU

 .../bindings/mailbox/nvidia,tegra186-hsp.txt  |  30 +-
 .../bindings/serial/nvidia,tegra194-tcu.txt   |  35 ++
 .../arm64/boot/dts/nvidia/tegra194-p2888.dtsi |   2 +-
 arch/arm64/boot/dts/nvidia/tegra194.dtsi      |  38 +-
 arch/arm64/configs/defconfig                  |   1 +
 drivers/mailbox/mailbox.c                     |  31 +-
 drivers/mailbox/tegra-hsp.c                   | 517 +++++++++++++++---
 drivers/tty/serial/Kconfig                    |  22 +
 drivers/tty/serial/Makefile                   |   1 +
 drivers/tty/serial/tegra-tcu.c                | 298 ++++++++++
 include/dt-bindings/mailbox/tegra186-hsp.h    |  11 +
 include/linux/mailbox_client.h                |   1 +
 include/linux/mailbox_controller.h            |   4 +
 include/uapi/linux/serial_core.h              |   3 +
 14 files changed, 903 insertions(+), 91 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/nvidia,tegra194-tcu.txt
 create mode 100644 drivers/tty/serial/tegra-tcu.c
Signature · 1 line
2.19.1