
On 02/01/2016 04:05 PM, Simon Glass wrote: <snip>
I will take this chance to convert P2020DS to use DM. Need some guidance here. For NS16550, it needs the clock. To keep it simple, let's presume platform data is used. My trouble is the clock is not unknown at compiling time. It needs to be updated by checking the board/soc configuration after power up. The clock is only available after get_clocks() is called in init_sequance. Is there a way I can update the clocks before the driver is initialized?
York
See this commit:
858530a8 dm: tegra: Enable driver model for serial
It sets up its own clock.
Simon,
Thanks for the pointer. I actually noticed this commit but it adds some confusion to me. Take your code as an example
U_BOOT_DRIVER(serial_ns16550) = { .name = "serial_tegra20", .id = UCLASS_SERIAL, .of_match = tegra_serial_ids, .ofdata_to_platdata = tegra_serial_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct ns16550_platdata), .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, };
The name "serial_ns16550" is not directly used anywhere. So I guess you didn't have to name it as "serial_ns16550", right?
One step forward, if I want to create a new driver, say "fsl_ns16550", I will have to use ofdata_to_platdata to fill in plat->clock. But for majority powerpc SoCs, we don't use device tree. We may start to use device tree on new products. But it is probably not a good idea to force every platform to change.
Is there another way to update plat->clock?
York