* [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency
@ 2021-02-03 14:01 Bin Meng
2021-02-03 14:01 ` [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes Bin Meng
2021-02-03 14:10 ` [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Philippe Mathieu-Daudé
0 siblings, 2 replies; 4+ messages in thread
From: Bin Meng @ 2021-02-03 14:01 UTC (permalink / raw)
To: David Gibson, Greg Kurz; +Cc: Bin Meng, qemu-ppc, qemu-devel
From: Bin Meng <bin.meng@windriver.com>
At present the platform clock frequency is using a magic number.
Convert it to a macro and use it everywhere.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
hw/ppc/e500.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
index c64b5d0..672ccd5 100644
--- a/hw/ppc/e500.c
+++ b/hw/ppc/e500.c
@@ -74,6 +74,8 @@
#define MPC8544_I2C_IRQ 43
#define RTC_REGS_OFFSET 0x68
+#define PLATFORM_CLK_FREQ 400000000
+
struct boot_info
{
uint32_t dt_base;
@@ -320,8 +322,8 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
int fdt_size;
void *fdt;
uint8_t hypercall[16];
- uint32_t clock_freq = 400000000;
- uint32_t tb_freq = 400000000;
+ uint32_t clock_freq = PLATFORM_CLK_FREQ;
+ uint32_t tb_freq = PLATFORM_CLK_FREQ;
int i;
char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus";
char *soc;
@@ -890,7 +892,7 @@ void ppce500_init(MachineState *machine)
env->spr_cb[SPR_BOOKE_PIR].default_value = cs->cpu_index = i;
env->mpic_iack = pmc->ccsrbar_base + MPC8544_MPIC_REGS_OFFSET + 0xa0;
- ppc_booke_timers_init(cpu, 400000000, PPC_TIMER_E500);
+ ppc_booke_timers_init(cpu, PLATFORM_CLK_FREQ, PPC_TIMER_E500);
/* Register reset handler */
if (!i) {
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes
2021-02-03 14:01 [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Bin Meng
@ 2021-02-03 14:01 ` Bin Meng
2021-02-03 14:09 ` Philippe Mathieu-Daudé
2021-02-03 14:10 ` [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Philippe Mathieu-Daudé
1 sibling, 1 reply; 4+ messages in thread
From: Bin Meng @ 2021-02-03 14:01 UTC (permalink / raw)
To: David Gibson, Greg Kurz; +Cc: Bin Meng, qemu-ppc, qemu-devel
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.
Signed-off-by: Bin Meng <bin.meng@windriver.com>
---
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 672ccd5..e4677af 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);
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes
2021-02-03 14:01 ` [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes Bin Meng
@ 2021-02-03 14:09 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-03 14:09 UTC (permalink / raw)
To: Bin Meng, David Gibson, Greg Kurz; +Cc: Bin Meng, qemu-ppc, qemu-devel
On 2/3/21 3:01 PM, 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.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> hw/ppc/e500.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency
2021-02-03 14:01 [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Bin Meng
2021-02-03 14:01 ` [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes Bin Meng
@ 2021-02-03 14:10 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-03 14:10 UTC (permalink / raw)
To: Bin Meng, David Gibson, Greg Kurz; +Cc: Bin Meng, qemu-ppc, qemu-devel
On 2/3/21 3:01 PM, Bin Meng wrote:
> From: Bin Meng <bin.meng@windriver.com>
>
> At present the platform clock frequency is using a magic number.
> Convert it to a macro and use it everywhere.
>
> Signed-off-by: Bin Meng <bin.meng@windriver.com>
> ---
>
> hw/ppc/e500.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c
> index c64b5d0..672ccd5 100644
> --- a/hw/ppc/e500.c
> +++ b/hw/ppc/e500.c
> @@ -74,6 +74,8 @@
> #define MPC8544_I2C_IRQ 43
> #define RTC_REGS_OFFSET 0x68
>
> +#define PLATFORM_CLK_FREQ 400000000
Consider 1/ using unit in variable name and 2/ decompose:
#define PLATFORM_CLK_FREQ_HZ (400 * 1000 * 1000)
Regardless:
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-02-03 14:14 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 14:01 [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Bin Meng
2021-02-03 14:01 ` [PATCH 2/2] hw/ppc: e500: Fill in correct <clock-frequency> for the serial nodes Bin Meng
2021-02-03 14:09 ` Philippe Mathieu-Daudé
2021-02-03 14:10 ` [PATCH 1/2] hw/ppc: e500: Use a macro for the platform clock frequency Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).