aboutsummaryrefslogtreecommitdiff
path: root/platforms
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2017-02-22 20:31:00 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-02-23 16:04:27 +1100
commitc78cd1b4d6c14d17ec202f503b4182b6fd96afbd (patch)
tree26aaebc654254dab7a106489da3ecfb71be5ac22 /platforms
parent25ab8e2ee55136cfd9f864f65686e312fd38b667 (diff)
downloadskiboot-c78cd1b4d6c14d17ec202f503b4182b6fd96afbd.zip
skiboot-c78cd1b4d6c14d17ec202f503b4182b6fd96afbd.tar.gz
skiboot-c78cd1b4d6c14d17ec202f503b4182b6fd96afbd.tar.bz2
ast-bmc: Use the mbox driver
The mbox registers are accessed via superIO, these need to be initialised. The mbox device node won't be present in the device tree hostboot passes us, so fixup the device tree. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'platforms')
-rw-r--r--platforms/astbmc/common.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 18b425b..6f29e61 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -39,6 +39,11 @@
#define BT_IO_COUNT 3
#define BT_LPC_IRQ 10
+/* MBOX config */
+#define MBOX_IO_BASE 0x1000
+#define MBOX_IO_COUNT 6
+#define MBOX_LPC_IRQ 9
+
void astbmc_ext_irq_serirq_cpld(unsigned int chip_id)
{
lpc_all_interrupts(chip_id);
@@ -191,6 +196,36 @@ static void astbmc_fixup_dt_bt(struct dt_node *lpc)
dt_add_property_cells(bt, "interrupt-parent", lpc->phandle);
}
+static void astbmc_fixup_dt_mbox(struct dt_node *lpc)
+{
+ struct dt_node *mbox;
+ char namebuf[32];
+
+ /* All P9 machines have this and no earlier machines do */
+ if (proc_gen != proc_gen_p9)
+ return;
+
+ /* First check if the mbox interface is already there */
+ dt_for_each_child(lpc, mbox) {
+ if (dt_node_is_compatible(mbox, "mbox"))
+ return;
+ }
+
+ snprintf(namebuf, sizeof(namebuf), "mbox@i%x", MBOX_IO_BASE);
+ mbox = dt_new(lpc, namebuf);
+
+ dt_add_property_cells(mbox, "reg",
+ 1, /* IO space */
+ MBOX_IO_BASE, MBOX_IO_COUNT);
+ dt_add_property_strings(mbox, "compatible", "mbox");
+
+ /* Mark it as reserved to avoid Linux trying to claim it */
+ dt_add_property_strings(mbox, "status", "reserved");
+
+ dt_add_property_cells(mbox, "interrupts", MBOX_LPC_IRQ);
+ dt_add_property_cells(mbox, "interrupt-parent", lpc->phandle);
+}
+
static void astbmc_fixup_dt_uart(struct dt_node *lpc)
{
/*
@@ -294,6 +329,9 @@ static void astbmc_fixup_dt(void)
/* BT is not in HB either */
astbmc_fixup_dt_bt(primary_lpc);
+ /* MBOX is not in HB */
+ astbmc_fixup_dt_mbox(primary_lpc);
+
/* The pel logging code needs a system-id property to work so
make sure we have one. */
astbmc_fixup_dt_system_id();
@@ -361,9 +399,13 @@ void astbmc_early_init(void)
/* Similarly, some BMCs don't configure the BT interrupt properly */
ast_setup_ibt(BT_IO_BASE, BT_LPC_IRQ);
+ ast_setup_sio_mbox(MBOX_IO_BASE, MBOX_LPC_IRQ);
+
/* Setup UART and use it as console */
uart_init();
+ mbox_init();
+
prd_init();
}