From d4e60bb121b2c3efbdb5a1690e77ac4d37978e1b Mon Sep 17 00:00:00 2001 From: ian Date: Tue, 23 Feb 2016 02:57:45 +0000 Subject: [PATCH] Now that we have OF_decode_addr(), with proper MD implementations, to obtain the bus space tag and handle for a uart console, use the values returned by that routine to set the global uart_bus_space_mem, instead of assuming that there will be a global variable named fdtbus_bs_tag to set it from. Also, use OF_getencprop() instead calling fdt32_to_cpu() separately. --- sys/dev/uart/uart_cpu_fdt.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/dev/uart/uart_cpu_fdt.c b/sys/dev/uart/uart_cpu_fdt.c index 6eb40f0d49da..47e6b45e2ecd 100644 --- a/sys/dev/uart/uart_cpu_fdt.c +++ b/sys/dev/uart/uart_cpu_fdt.c @@ -136,9 +136,6 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) char *cp; int err; - uart_bus_space_mem = fdtbus_bs_tag; - uart_bus_space_io = NULL; - /* Allow overriding the FDT using the environment. */ class = &uart_ns8250_class; err = uart_getenv(devtype, di, class); @@ -195,10 +192,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) if (uart_fdt_get_shift(node, &shift) != 0) shift = uart_getregshift(class); - if (OF_getprop(node, "current-speed", &br, sizeof(br)) <= 0) + if (OF_getencprop(node, "current-speed", &br, sizeof(br)) <= 0) br = 0; - else - br = fdt32_to_cpu(br); /* * Finalize configuration. @@ -212,5 +207,9 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) di->stopbits = 1; di->parity = UART_PARITY_NONE; - return (OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL)); + err = OF_decode_addr(node, 0, &di->bas.bst, &di->bas.bsh, NULL); + uart_bus_space_mem = di->bas.bst; + uart_bus_space_io = NULL; + + return (err); }