[Skiboot] [PATCH 3/6] plat/qemu: use astbmc_fixup_dt_uart()

Cédric Le Goater clg at fr.ibm.com
Thu Apr 7 02:30:09 AEST 2016


This is the exact same code.

Signed-off-by: Cédric Le Goater <clg at fr.ibm.com>
---
 platforms/astbmc/astbmc.h |  1 +
 platforms/astbmc/common.c |  2 +-
 platforms/astbmc/qemu.c   | 43 +------------------------------------------
 3 files changed, 3 insertions(+), 43 deletions(-)

diff --git a/platforms/astbmc/astbmc.h b/platforms/astbmc/astbmc.h
index cc85d477c92e..1c00a3dee697 100644
--- a/platforms/astbmc/astbmc.h
+++ b/platforms/astbmc/astbmc.h
@@ -37,6 +37,7 @@ extern void astbmc_early_init(void);
 extern int64_t astbmc_ipmi_reboot(void);
 extern int64_t astbmc_ipmi_power_down(uint64_t request);
 extern struct dt_node *astbmc_get_primary_lpc(void);
+extern void astbmc_fixup_dt_uart(struct dt_node *lpc);
 extern void astbmc_init(void);
 extern void astbmc_ext_irq_serirq_cpld(unsigned int chip_id);
 extern int pnor_init(void);
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 99acde9e88c1..d0bcf7dba08f 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -187,7 +187,7 @@ static void astbmc_fixup_dt_bt(struct dt_node *lpc)
 	dt_add_property_cells(bt, "interrupt-parent", lpc->phandle);
 }
 
-static void astbmc_fixup_dt_uart(struct dt_node *lpc)
+void astbmc_fixup_dt_uart(struct dt_node *lpc)
 {
 	/*
 	 * The official OF ISA/LPC binding is a bit odd, it prefixes
diff --git a/platforms/astbmc/qemu.c b/platforms/astbmc/qemu.c
index 07903eb03b89..2f316df80a5a 100644
--- a/platforms/astbmc/qemu.c
+++ b/platforms/astbmc/qemu.c
@@ -36,47 +36,6 @@ static void qemu_init(void)
 	lpc_rtc_init();
 }
 
-static void qemu_dt_fixup_uart(struct dt_node *lpc)
-{
-	/*
-	 * The official OF ISA/LPC binding is a bit odd, it prefixes
-	 * the unit address for IO with "i". It uses 2 cells, the first
-	 * one indicating IO vs. Memory space (along with bits to
-	 * represent aliasing).
-	 *
-	 * We pickup that binding and add to it "2" as a indication
-	 * of FW space.
-	 *
-	 * TODO: Probe the UART instead if the LPC bus allows for it
-	 */
-	struct dt_node *uart;
-	char namebuf[32];
-#define UART_IO_BASE	0x3f8
-#define UART_IO_COUNT	8
-#define UART_LPC_IRQ	4
-
-	snprintf(namebuf, sizeof(namebuf), "serial at i%x", UART_IO_BASE);
-	uart = dt_new(lpc, namebuf);
-
-	dt_add_property_cells(uart, "reg",
-			      1, /* IO space */
-			      UART_IO_BASE, UART_IO_COUNT);
-	dt_add_property_strings(uart, "compatible",
-				"ns16550",
-				"pnpPNP,501");
-	dt_add_property_cells(uart, "clock-frequency", 1843200);
-	dt_add_property_cells(uart, "current-speed", 115200);
-	dt_add_property_cells(uart, "interrupts", UART_LPC_IRQ);
-	dt_add_property_cells(uart, "interrupt-parent", lpc->phandle);
-
-	/*
-	 * This is needed by Linux for some obscure reasons,
-	 * we'll eventually need to sanitize it but in the meantime
-	 * let's make sure it's there
-	 */
-	dt_add_property_strings(uart, "device_type", "serial");
-}
-
 /*
  * This adds the legacy RTC device to the device-tree
  * for Linux to use
@@ -106,7 +65,7 @@ static void qemu_dt_fixup(void)
 		return;
 
 	qemu_dt_fixup_rtc(primary_lpc);
-	qemu_dt_fixup_uart(primary_lpc);
+	astbmc_fixup_dt_uart(primary_lpc);
 }
 
 static void qemu_ext_irq_serirq_cpld(unsigned int chip_id)
-- 
2.1.4



More information about the Skiboot mailing list