diff mbox

[6/6] plat/qemu: check device tree for RTC definitions

Message ID 1459960212-23890-7-git-send-email-clg@fr.ibm.com
State Changes Requested
Headers show

Commit Message

Cédric Le Goater April 6, 2016, 4:30 p.m. UTC
QEMU populates the device tree with devices found on the ISA
bus. Let's check that a RTC device is not already there.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
---
 platforms/astbmc/qemu.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox

Patch

diff --git a/platforms/astbmc/qemu.c b/platforms/astbmc/qemu.c
index 11d3a99339d8..6089a2812aca 100644
--- a/platforms/astbmc/qemu.c
+++ b/platforms/astbmc/qemu.c
@@ -56,6 +56,14 @@  static void qemu_dt_fixup_rtc(struct dt_node *lpc)
 	struct dt_node *rtc;
 	char namebuf[32];
 
+	/* First check if a RTC interface is already there */
+	dt_for_each_child(lpc, rtc) {
+		if (dt_node_is_compatible(rtc, "pnpPNP,b00")) {
+			prlog(PR_WARNING, "QEMU: rtc device already here\n");
+			return;
+                }
+	}
+
 	/*
 	 * Follows the structure expected by the kernel file
 	 * arch/powerpc/sysdev/rtc_cmos_setup.c