aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2018-02-28 16:46:10 +1030
committerStewart Smith <stewart@linux.ibm.com>2018-10-24 19:02:59 +1100
commit3b7aaba71f6d553bc31d86c135669c1b255199a4 (patch)
tree3684f24b7ef96b81a1b626a2458985e093c364e8
parentdd8b717f30a453f6c2c2ac7464dcaa21ebed0bb6 (diff)
downloadskiboot-3b7aaba71f6d553bc31d86c135669c1b255199a4.zip
skiboot-3b7aaba71f6d553bc31d86c135669c1b255199a4.tar.gz
skiboot-3b7aaba71f6d553bc31d86c135669c1b255199a4.tar.bz2
astbmc: Enable mbox depending on scratch reg
[ Upstream commit b09e48ffcdbffca97f7f6ebc2135a9e82dc5d9e9 ] P8 boxes can opt in for mbox pnor support if they set the scratch register bit to indicate it is supported. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--hw/ast-bmc/ast-io.c14
-rw-r--r--include/ast.h1
-rw-r--r--platforms/astbmc/common.c5
3 files changed, 18 insertions, 2 deletions
diff --git a/hw/ast-bmc/ast-io.c b/hw/ast-bmc/ast-io.c
index cd1aba2..964d415 100644
--- a/hw/ast-bmc/ast-io.c
+++ b/hw/ast-bmc/ast-io.c
@@ -116,6 +116,7 @@
*/
#define BMC_SIO_SCR29 0x29
+#define BMC_SIO_SCR29_MBOX 0x08
#define BMC_SIO_SCR29_MEMBOOT 0x10
enum {
@@ -427,6 +428,19 @@ bool ast_is_ahb_lpc_pnor(void)
return !(boot_flags & BMC_SIO_SCR29_MEMBOOT);
}
+bool ast_scratch_reg_is_mbox(void)
+{
+ uint8_t boot_version;
+ uint8_t boot_flags;
+
+ boot_version = bmc_sio_inb(BMC_SIO_SCR28);
+ if (boot_version != BOOT_FLAGS_VERSION)
+ return false;
+
+ boot_flags = bmc_sio_inb(BMC_SIO_SCR29);
+ return boot_flags & BMC_SIO_SCR29_MBOX;
+}
+
void ast_setup_ibt(uint16_t io_base, uint8_t irq)
{
uint32_t v;
diff --git a/include/ast.h b/include/ast.h
index 414ff6a..2c1336b 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -82,6 +82,7 @@ int ast_copy_from_ahb(void *dst, uint32_t reg, uint32_t len);
void ast_io_init(void);
bool ast_is_ahb_lpc_pnor(void);
bool ast_is_mbox_pnor(void);
+bool ast_scratch_reg_is_mbox(void);
/* UART configuration */
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index 470ab5d..6c9f97d 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -213,8 +213,9 @@ 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)
+ /* All P9 machines use mbox. P8 machines can indicate they support
+ * it using the scratch register */
+ if (proc_gen != proc_gen_p9 && !ast_scratch_reg_is_mbox())
return;
/* First check if the mbox interface is already there */