Page MenuHomeFreeBSD

Allow the FDT uart driver to select witch device node to use
ClosedPublic

Authored by andrew on Sep 3 2015, 4:57 PM.

Details

Summary

Some upstream dts files lack a stdout in /choosen. In these cases
we default to serial0, however this may be incorrect. This adds
support to set the node we should use in loader.

An example of this would be to add the following to loader.conf:
hw.fdt.console="/smb/uart@f7113000"

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

andrew updated this revision to Diff 8460.Sep 3 2015, 4:57 PM
andrew retitled this revision from to Allow the FDT uart driver to select witch device node to use.
andrew updated this object.
andrew edited the test plan for this revision. (Show Details)
andrew added reviewers: ARM, MIPS.
imp added a comment.Sep 3 2015, 5:33 PM

Generally I like this, though hw.fdt.console seems limiting. hw.uart.console already exists, and also lets you set UART parameters. I see that we do this to a limited extent for current-speed below and hard-wire 8:1:N. We've done this for a long time, so I don't know how important it is, but I thought I'd point out the inconsistency.

sys/dev/uart/uart_cpu_fdt.c
156 ↗(On Diff #8460)

There are other things than /chose/stdin /chosen/stdout. Perhaps you should limit things explicitly to those?

166–167 ↗(On Diff #8460)

I'm torn. Is there some reason we don't do this when the user has specified a node that doesn't exist (eg node == -1 when cp != NULL)

andrew added a comment.Sep 3 2015, 6:25 PM

We could follow the stdout-path bindings [1] in this node, but this would need us to parse them first.

I'm also open to a better name for the environment variable.

[1] https://www.kernel.org/doc/Documentation/devicetree/bindings/chosen.txt

sys/dev/uart/uart_cpu_fdt.c
156 ↗(On Diff #8460)

This is just changing the indentation of existing code, there is extra data in some of these, but that is out of the scope for this change.

166–167 ↗(On Diff #8460)

The user could disable the fdt console with this by setting it to an invalid node, e.g. hw.fdt.console="none"

This revision was automatically updated to reflect the committed changes.