Skip to content

bcm2835: enable auxiliary uart1

Stephen Warren linux-arm-kernel linux-devicetree linux-serial 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 of 4 patches 0 repliesNew

2 of 4 patches are in this archive. The cover letter announces 4.

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
3/4serial: bcm2835: add auxiliary uart1 to device tree of bcm2835+0 -01 reply
3/4serial: bcm2835: add auxiliary uart1 to device tree of bcm2835+0 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] bcm2835: enable auxiliary uart1
Quoted 11 lines · Eric Anholt
Quoted 9 lines · kernel at martin.sperl.org

From: Martin Sperl <[email protected]>

The bcm2835 SOC contains an auxiliary uart, which is very close to the ns16550 with some differences.

The big difference is that the uart HW is not using an internal divider of 16 but 8, which results in an effictive baud-rate being twice the requested baud-rate.

Quoted 7 lines
Quoted 7 lines

The bcm2835-aux-uart is also special in such that it is enabled/disabled by a gate in the clock, which is managed by the clk-bcm2835-aux clock driver.

there are 2 options: * defining the clock-frequency property in the device tree to 500k instead of 250k, but this keeps the HW block disabled making the uart not work.

Why does this keep the HW block disabled?

Quoted 8 lines
Quoted 8 lines

* defining a clock in the device tree, but this results in a baud rate that is twice the requested baud-rate.

To address this this patch-set introduce a new property in the device tree to define a clock divider other than 16.

This currently just scales the clock by a factor of 16/divider.

Quoted 7 lines
Quoted 4 lines

Note that the use of fixed-factor-clock has also been proposed as a workarround, but this does not really describe the hw in the device tree so another solution was needed that allows a correct representation of the HW in the device tree.

I personally lean toward the fixed-factor-clock solution, but could go either way. Serial maintainers, what do you think?

The external fixed-factor-clock solution sounds more like a workaround than a real fix. It means that the UART driver isn't aware of what's going on and only "accidentally" works due to some manipulation of the clock values that it requests. That kind of thing almost always come back to bite you later.

Rather than adding a DT property to configure the internal clock divider, it seems best to add a new compatible value to the list it supports, and have that compatible value set up internal data that indicates divide-by-16 vs. divide-by-8. After all, the HW isn't 100% compatible with ns16550, so the DT should not say that it is. While the clock-divider property this series adds to the DT does solve the issue, it does not prevent an older piece of SW that predates this series, and hence which does not implement clock-divider, attempting to bind to this DT but fail to operate correctly since it doesn't know about the different divider.