dm: serial: ns16550: Convert to livetree
Update this driver to support a live device tree. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Marcel Ziswiler <marcel.ziswiler@toradex.com> Tested-on: Beaver, Jetson-TK1
This commit is contained in:
parent
03bc3f18b7
commit
db9f8f6ad5
|
|
@ -8,7 +8,6 @@
|
||||||
#include <clk.h>
|
#include <clk.h>
|
||||||
#include <dm.h>
|
#include <dm.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fdtdec.h>
|
|
||||||
#include <ns16550.h>
|
#include <ns16550.h>
|
||||||
#include <serial.h>
|
#include <serial.h>
|
||||||
#include <watchdog.h>
|
#include <watchdog.h>
|
||||||
|
|
@ -395,7 +394,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* try Processor Local Bus device first */
|
/* try Processor Local Bus device first */
|
||||||
addr = devfdt_get_addr(dev);
|
addr = dev_read_addr(dev);
|
||||||
#if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
|
#if defined(CONFIG_PCI) && defined(CONFIG_DM_PCI)
|
||||||
if (addr == FDT_ADDR_T_NONE) {
|
if (addr == FDT_ADDR_T_NONE) {
|
||||||
/* then try pci device */
|
/* then try pci device */
|
||||||
|
|
@ -434,11 +433,8 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
|
||||||
plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE);
|
plat->base = (unsigned long)map_physmem(addr, 0, MAP_NOCACHE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
plat->reg_offset = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
plat->reg_offset = dev_read_u32_default(dev, "reg-offset", 0);
|
||||||
"reg-offset", 0);
|
plat->reg_shift = dev_read_u32_default(dev, "reg-shift", 0);
|
||||||
plat->reg_shift = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
|
||||||
"reg-shift", 0);
|
|
||||||
|
|
||||||
err = clk_get_by_index(dev, 0, &clk);
|
err = clk_get_by_index(dev, 0, &clk);
|
||||||
if (!err) {
|
if (!err) {
|
||||||
err = clk_get_rate(&clk);
|
err = clk_get_rate(&clk);
|
||||||
|
|
@ -450,8 +446,7 @@ int ns16550_serial_ofdata_to_platdata(struct udevice *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!plat->clock)
|
if (!plat->clock)
|
||||||
plat->clock = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
|
plat->clock = dev_read_u32_default(dev, "clock-frequency",
|
||||||
"clock-frequency",
|
|
||||||
CONFIG_SYS_NS16550_CLK);
|
CONFIG_SYS_NS16550_CLK);
|
||||||
if (!plat->clock) {
|
if (!plat->clock) {
|
||||||
debug("ns16550 clock not defined\n");
|
debug("ns16550 clock not defined\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue