[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 03/35] sam460ex: Fix sam460ex device tree when booting
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 03/35] sam460ex: Fix sam460ex device tree when booting the Linux kernel |
Date: |
Tue, 3 Jul 2018 15:57:32 +1000 |
From: Guenter Roeck <address@hidden>
sam460ex (or at least this emulation) does not support the "ibm,cpm" power
management. As a result, Linux crashes when trying to access it. Remove
its device tree node. Also, if/when we boot the Linux kernel directly,
serial port clock frequencies in the device tree file will be unset, and
serial port initialization will fail. Add valid frequency values to
the serial ports to be able to use it. Also set valid values for the other
clock nodes otherwise set by u-boot.
Signed-off-by: Guenter Roeck <address@hidden>
Reviewed-by: BALATON Zoltan <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
hw/ppc/sam460ex.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c
index bdc53d2603..33ea51816c 100644
--- a/hw/ppc/sam460ex.c
+++ b/hw/ppc/sam460ex.c
@@ -37,6 +37,8 @@
#include "hw/i2c/smbus.h"
#include "hw/usb/hcd-ehci.h"
+#include <libfdt.h>
+
#define BINARY_DEVICE_TREE_FILE "canyonlands.dtb"
#define UBOOT_FILENAME "u-boot-sam460-20100605.bin"
/* to extract the official U-Boot bin from the updater: */
@@ -67,6 +69,10 @@
*/
#define CPU_FREQ 1150000000
+#define PLB_FREQ 230000000
+#define OPB_FREQ 115000000
+#define EBC_FREQ 115000000
+#define UART_FREQ 11059200
#define SDRAM_NR_BANKS 4
/* FIXME: See u-boot.git 8ac41e, also fix in ppc440_uc.c */
@@ -255,6 +261,7 @@ static int sam460ex_load_device_tree(hwaddr addr,
void *fdt;
uint32_t tb_freq = CPU_FREQ;
uint32_t clock_freq = CPU_FREQ;
+ int offset;
filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
if (!filename) {
@@ -308,6 +315,27 @@ static int sam460ex_load_device_tree(hwaddr addr,
qemu_fdt_setprop_cell(fdt, "/cpus/address@hidden", "timebase-frequency",
tb_freq);
+ /* Remove cpm node if it exists (it is not emulated) */
+ offset = fdt_path_offset(fdt, "/cpm");
+ if (offset >= 0) {
+ fdt_nop_node(fdt, offset);
+ }
+
+ /* set serial port clocks */
+ offset = fdt_node_offset_by_compatible(fdt, -1, "ns16550");
+ while (offset >= 0) {
+ fdt_setprop_cell(fdt, offset, "clock-frequency", UART_FREQ);
+ offset = fdt_node_offset_by_compatible(fdt, offset, "ns16550");
+ }
+
+ /* some more clocks */
+ qemu_fdt_setprop_cell(fdt, "/plb", "clock-frequency",
+ PLB_FREQ);
+ qemu_fdt_setprop_cell(fdt, "/plb/opb", "clock-frequency",
+ OPB_FREQ);
+ qemu_fdt_setprop_cell(fdt, "/plb/opb/ebc", "clock-frequency",
+ EBC_FREQ);
+
rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
g_free(fdt);
ret = fdt_size;
--
2.17.1
- [Qemu-ppc] [PULL 00/35] ppc-for-3.0 queue 20180703, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 01/35] mac_dbdma: only dump commands for debug enabled channels, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 03/35] sam460ex: Fix sam460ex device tree when booting the Linux kernel,
David Gibson <=
- [Qemu-ppc] [PULL 10/35] ppc/pnv: fix pnv_core_realize() error handling, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 02/35] mac_newworld: always enable disable_direct_reg3_writes for ADB machines, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 06/35] ppc/xics: move the instance_init handler under the ics-base class, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 11/35] target/ppc: Add do_unaligned_access hook, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 07/35] ppx/xics: introduce a parent_reset in ICSStateClass, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 20/35] target/ppc: Use MO_ALIGN for EXIWX and ECOWX, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 16/35] target/ppc: Tidy gen_conditional_store, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 09/35] ppc/xics: rework the ICS classes inheritance tree, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 19/35] target/ppc: Split out gen_st_atomic, David Gibson, 2018/07/03
- [Qemu-ppc] [PULL 22/35] target/ppc: Implement the rest of gen_ld_atomic, David Gibson, 2018/07/03