Hi Simon, On Wed, Jan 6, 2016 at 8:25 AM, Simon Glass <s...@chromium.org> wrote: > Hi Bin, > > On 31 December 2015 at 01:53, Bin Meng <bmeng...@gmail.com> wrote: >> This adds driver model support to lpuart serial driver. >> >> Signed-off-by: Bin Meng <bmeng...@gmail.com> >> --- >> >> doc/driver-model/serial-howto.txt | 1 - >> drivers/serial/serial_lpuart.c | 157 >> ++++++++++++++++++++++++++++++++++++++ >> 2 files changed, 157 insertions(+), 1 deletion(-) > > Reviewed-by: Simon Glass <s...@chromium.org> > > But please see below. > >>
[snip] >> +#else /* CONFIG_DM_SERIAL */ >> +static int lpuart_serial_ofdata_to_platdata(struct udevice *dev) >> +{ >> + struct lpuart_serial_platdata *plat = dev->platdata; >> + fdt_addr_t addr; >> + >> + addr = dev_get_addr(dev); >> + if (addr == FDT_ADDR_T_NONE) >> + return -EINVAL; >> + >> + plat->reg = (struct lpuart_fsl *)addr; >> + >> + return 0; >> +} >> + >> +static const struct dm_serial_ops lpuart_serial_ops = { >> +#ifdef CONFIG_LPUART_32B_REG >> + .putc = lpuart32_serial_putc, >> + .pending = lpuart32_serial_pending, >> + .getc = lpuart32_serial_getc, >> + .setbrg = lpuart32_serial_setbrg, >> +#else >> + .putc = lpuart_serial_putc, >> + .pending = lpuart_serial_pending, >> + .getc = lpuart_serial_getc, >> + .setbrg = lpuart_serial_setbrg, >> +#endif >> +}; >> + >> +static const struct udevice_id lpuart_serial_ids[] = { >> +#ifdef CONFIG_LPUART_32B_REG >> + { .compatible = "fsl,ls1021a-lpuart" }, >> +#else >> + { .compatible = "fsl,vf610-lpuart" }, >> +#endif > > Shouldn't we have both of these in there, with a .data member to > distinguish between them? Or two separate U_BOOT_DRIVER() entries each > with their own operations. Sure, will do in v2. > >> + { } >> +}; >> + >> +U_BOOT_DRIVER(serial_lpuart) = { >> + .name = "serial_lpuart", >> + .id = UCLASS_SERIAL, >> + .of_match = lpuart_serial_ids, >> + .ofdata_to_platdata = lpuart_serial_ofdata_to_platdata, >> + .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata), >> +#ifdef CONFIG_LPUART_32B_REG >> + .probe = lpuart32_serial_probe, >> +#else >> + .probe = lpuart_serial_probe, >> +#endif >> + .ops = &lpuart_serial_ops, >> + .flags = DM_FLAG_PRE_RELOC, >> +}; >> +#endif /* CONFIG_DM_SERIAL */ >> -- Regards, Bin _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot