Date: Fri, 12 Apr 2024 17:21:09 GMT From: Ka Ho Ng <khng@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 53b5393319dd - main - uart_snps: Register a device xref for UARTs Message-ID: <202404121721.43CHL9B6086446@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by khng: URL: https://cgit.FreeBSD.org/src/commit/?id=53b5393319dd7b54d63e8bf9aa82e48618552ecb commit 53b5393319dd7b54d63e8bf9aa82e48618552ecb Author: Ka Ho Ng <khng@FreeBSD.org> AuthorDate: 2024-04-12 16:56:42 +0000 Commit: Ka Ho Ng <khng@FreeBSD.org> CommitDate: 2024-04-12 17:04:23 +0000 uart_snps: Register a device xref for UARTs This is useful for other drivers to be able to find the UART (such as the case of UARTs where hardware flow control lines are handled by another device.) Sponsored by: Juniper Networks, Inc. MFC after: 1 week Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D44532 --- sys/dev/uart/uart_dev_snps.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/sys/dev/uart/uart_dev_snps.c b/sys/dev/uart/uart_dev_snps.c index b6efd1948b3e..6067920e3c2a 100644 --- a/sys/dev/uart/uart_dev_snps.c +++ b/sys/dev/uart/uart_dev_snps.c @@ -223,6 +223,22 @@ snps_probe(device_t dev) return (BUS_PROBE_VENDOR); } +static int +snps_attach(device_t dev) +{ + phandle_t node; + int ret; + + ret = uart_bus_attach(dev); + if (ret == 0) { + node = ofw_bus_get_node(dev); + /* Set up phandle to dev mapping */ + OF_device_register_xref(OF_xref_from_node(node), dev); + } + + return (ret); +} + static int snps_detach(device_t dev) { @@ -269,7 +285,7 @@ snps_detach(device_t dev) static device_method_t snps_bus_methods[] = { /* Device interface */ DEVMETHOD(device_probe, snps_probe), - DEVMETHOD(device_attach, uart_bus_attach), + DEVMETHOD(device_attach, snps_attach), DEVMETHOD(device_detach, snps_detach), DEVMETHOD_END };help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404121721.43CHL9B6086446>
