mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
hw/ppc/e500: Move clock and TB frequency to machine class
Different machines have different frequencies so make this configurable in machine class instead of using a hard coded constant. Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu> Acked-by: Bernhard Beschow <shentey@gmail.com> Message-ID: <431166f96ff12ff3dbc670d40544974415f11305.1748012109.git.balaton@eik.bme.hu> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
8cab2354a2
commit
ea585b1022
4 changed files with 17 additions and 9 deletions
|
@ -79,8 +79,6 @@
|
|||
#define MPC85XX_ESDHC_IRQ 72
|
||||
#define RTC_REGS_OFFSET 0x68
|
||||
|
||||
#define PLATFORM_CLK_FREQ_HZ (400 * 1000 * 1000)
|
||||
|
||||
struct boot_info
|
||||
{
|
||||
uint32_t dt_base;
|
||||
|
@ -120,7 +118,7 @@ static uint32_t *pci_map_create(void *fdt, uint32_t mpic, int first_slot,
|
|||
}
|
||||
|
||||
static void dt_serial_create(void *fdt, unsigned long long offset,
|
||||
const char *soc, const char *mpic,
|
||||
const char *soc, uint32_t freq, const char *mpic,
|
||||
const char *alias, int idx, bool defcon)
|
||||
{
|
||||
char *ser;
|
||||
|
@ -131,7 +129,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", PLATFORM_CLK_FREQ_HZ);
|
||||
qemu_fdt_setprop_cell(fdt, ser, "clock-frequency", 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);
|
||||
|
@ -382,8 +380,7 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
|
|||
int fdt_size;
|
||||
void *fdt;
|
||||
uint8_t hypercall[16];
|
||||
uint32_t clock_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
uint32_t tb_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
uint32_t clock_freq, tb_freq;
|
||||
int i;
|
||||
char compatible_sb[] = "fsl,mpc8544-immr\0simple-bus";
|
||||
char *soc;
|
||||
|
@ -484,6 +481,9 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
|
|||
if (kvmppc_get_hasidle(env)) {
|
||||
qemu_fdt_setprop(fdt, "/hypervisor", "has-idle", NULL, 0);
|
||||
}
|
||||
} else {
|
||||
clock_freq = pmc->clock_freq;
|
||||
tb_freq = pmc->tb_freq;
|
||||
}
|
||||
|
||||
/* Create CPU nodes */
|
||||
|
@ -564,12 +564,12 @@ static int ppce500_load_device_tree(PPCE500MachineState *pms,
|
|||
*/
|
||||
if (serial_hd(1)) {
|
||||
dt_serial_create(fdt, MPC8544_SERIAL1_REGS_OFFSET,
|
||||
soc, mpic, "serial1", 1, false);
|
||||
soc, pmc->clock_freq, mpic, "serial1", 1, false);
|
||||
}
|
||||
|
||||
if (serial_hd(0)) {
|
||||
dt_serial_create(fdt, MPC8544_SERIAL0_REGS_OFFSET,
|
||||
soc, mpic, "serial0", 0, true);
|
||||
soc, pmc->clock_freq, mpic, "serial0", 0, true);
|
||||
}
|
||||
|
||||
/* i2c */
|
||||
|
@ -968,7 +968,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, PLATFORM_CLK_FREQ_HZ, PPC_TIMER_E500);
|
||||
ppc_booke_timers_init(cpu, pmc->tb_freq, PPC_TIMER_E500);
|
||||
|
||||
/* Register reset handler */
|
||||
if (!i) {
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "hw/platform-bus.h"
|
||||
#include "qom/object.h"
|
||||
|
||||
#define PLATFORM_CLK_FREQ_HZ (400 * 1000 * 1000)
|
||||
|
||||
struct PPCE500MachineState {
|
||||
/*< private >*/
|
||||
MachineState parent_obj;
|
||||
|
@ -37,6 +39,8 @@ struct PPCE500MachineClass {
|
|||
hwaddr pci_mmio_base;
|
||||
hwaddr pci_mmio_bus_base;
|
||||
hwaddr spin_base;
|
||||
uint32_t clock_freq;
|
||||
uint32_t tb_freq;
|
||||
};
|
||||
|
||||
void ppce500_init(MachineState *machine);
|
||||
|
|
|
@ -93,6 +93,8 @@ static void e500plat_machine_class_init(ObjectClass *oc, const void *data)
|
|||
pmc->pci_mmio_base = 0xC00000000ULL;
|
||||
pmc->pci_mmio_bus_base = 0xE0000000ULL;
|
||||
pmc->spin_base = 0xFEF000000ULL;
|
||||
pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
|
||||
mc->desc = "generic paravirt e500 platform";
|
||||
mc->init = e500plat_init;
|
||||
|
|
|
@ -55,6 +55,8 @@ static void mpc8544ds_machine_class_init(ObjectClass *oc, const void *data)
|
|||
pmc->pci_mmio_bus_base = 0xC0000000ULL;
|
||||
pmc->pci_pio_base = 0xE1000000ULL;
|
||||
pmc->spin_base = 0xEF000000ULL;
|
||||
pmc->clock_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
pmc->tb_freq = PLATFORM_CLK_FREQ_HZ;
|
||||
|
||||
mc->desc = "mpc8544ds";
|
||||
mc->init = mpc8544ds_init;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue