mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
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
This commit is contained in:
parent
cc0af6d5a6
commit
53b5393319
|
@ -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
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue