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.
This commit is contained in:
ian 2016-02-23 02:57:45 +00:00
parent 580950437f
commit d4e60bb121

View File

@ -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);
}