Skip to content

Commit

Permalink
astbmc: Enable mbox depending on scratch reg
Browse files Browse the repository at this point in the history
[ Upstream commit b09e48f ]

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>
  • Loading branch information
shenki authored and stewartsmith committed Oct 24, 2018
1 parent dd8b717 commit 3b7aaba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
14 changes: 14 additions & 0 deletions hw/ast-bmc/ast-io.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
*/

#define BMC_SIO_SCR29 0x29
#define BMC_SIO_SCR29_MBOX 0x08
#define BMC_SIO_SCR29_MEMBOOT 0x10

enum {
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions include/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
5 changes: 3 additions & 2 deletions platforms/astbmc/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 3b7aaba

Please sign in to comment.