Message ID | 1612362288-22216-2-git-send-email-bmeng.cn@gmail.com |
---|---|
State | New |
Headers | show |
Series | [v2,1/2] hw/ppc: e500: Use a macro for the platform clock frequency | expand |
On Wed, Feb 03, 2021 at 10:24:48PM +0800, Bin Meng wrote: > From: Bin Meng <bin.meng@windriver.com> > > At present the <clock-frequency> property of the serial node is > populated with value zero. U-Boot's ns16550 driver is not happy > about this, so let's fill in a meaningful value. Are you sure this is correct - that is that the serial clock is really the same as the overall system clock? Quite often there's some kind of divider in between. > > Signed-off-by: Bin Meng <bin.meng@windriver.com> > Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> > > --- > > (no changes since v1) > > hw/ppc/e500.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c > index c795276..01517a6 100644 > --- a/hw/ppc/e500.c > +++ b/hw/ppc/e500.c > @@ -126,7 +126,7 @@ static void dt_serial_create(void *fdt, unsigned long long offset, > qemu_fdt_setprop_string(fdt, ser, "compatible", "ns16550"); > qemu_fdt_setprop_cells(fdt, ser, "reg", offset, 0x100); > qemu_fdt_setprop_cell(fdt, ser, "cell-index", idx); > - qemu_fdt_setprop_cell(fdt, ser, "clock-frequency", 0); > + qemu_fdt_setprop_cell(fdt, ser, "clock-frequency", PLATFORM_CLK_FREQ_HZ); > qemu_fdt_setprop_cells(fdt, ser, "interrupts", 42, 2); > qemu_fdt_setprop_phandle(fdt, ser, "interrupt-parent", mpic); > qemu_fdt_setprop_string(fdt, "/aliases", alias, ser);
On Thu, Feb 4, 2021 at 12:58 PM David Gibson <david@gibson.dropbear.id.au> wrote: > > On Wed, Feb 03, 2021 at 10:24:48PM +0800, Bin Meng wrote: > > From: Bin Meng <bin.meng@windriver.com> > > > > At present the <clock-frequency> property of the serial node is > > populated with value zero. U-Boot's ns16550 driver is not happy > > about this, so let's fill in a meaningful value. > > Are you sure this is correct - that is that the serial clock is really > the same as the overall system clock? Quite often there's some kind > of divider in between. > Yes, see the U-Boot codes include/configs/qemu-ppce500.h #define CONFIG_SYS_NS16550_CLK (get_bus_freq(0)) get_bus_freq(0) eventually returns the platform clock frequency which is 400MHz. But the value doesn't matter anyway for QEMU. We don't emulate any baud rate specific thing for a serial port. We only need a sane value that is non-zero. Regards, Bin
On Thu, Feb 04, 2021 at 01:05:19PM +0800, Bin Meng wrote: > On Thu, Feb 4, 2021 at 12:58 PM David Gibson > <david@gibson.dropbear.id.au> wrote: > > > > On Wed, Feb 03, 2021 at 10:24:48PM +0800, Bin Meng wrote: > > > From: Bin Meng <bin.meng@windriver.com> > > > > > > At present the <clock-frequency> property of the serial node is > > > populated with value zero. U-Boot's ns16550 driver is not happy > > > about this, so let's fill in a meaningful value. > > > > Are you sure this is correct - that is that the serial clock is really > > the same as the overall system clock? Quite often there's some kind > > of divider in between. > > > > Yes, see the U-Boot codes include/configs/qemu-ppce500.h > > #define CONFIG_SYS_NS16550_CLK (get_bus_freq(0)) > > get_bus_freq(0) eventually returns the platform clock frequency which is 400MHz. > > But the value doesn't matter anyway for QEMU. We don't emulate any > baud rate specific thing for a serial port. We only need a sane value > that is non-zero. Understood. Applied to ppc-for-6.0.
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index c795276..01517a6 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -126,7 +126,7 @@ static void dt_serial_create(void *fdt, unsigned long long offset, qemu_fdt_setprop_string(fdt, ser, "compatible", "ns16550"); qemu_fdt_setprop_cells(fdt, ser, "reg", offset, 0x100); qemu_fdt_setprop_cell(fdt, ser, "cell-index", idx); - qemu_fdt_setprop_cell(fdt, ser, "clock-frequency", 0); + qemu_fdt_setprop_cell(fdt, ser, "clock-frequency", PLATFORM_CLK_FREQ_HZ); qemu_fdt_setprop_cells(fdt, ser, "interrupts", 42, 2); qemu_fdt_setprop_phandle(fdt, ser, "interrupt-parent", mpic); qemu_fdt_setprop_string(fdt, "/aliases", alias, ser);