From patchwork Wed Feb 28 06:16:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 878941 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zrlj174J0z9s0R for ; Wed, 28 Feb 2018 17:17:25 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hh1Mvx/N"; dkim-atps=neutral Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3zrlj13wTyzF1Wg for ; Wed, 28 Feb 2018 17:17:25 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hh1Mvx/N"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Hh1Mvx/N"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3zrlh62jv6zF1Xm for ; Wed, 28 Feb 2018 17:16:38 +1100 (AEDT) Received: by mail-pl0-x241.google.com with SMTP id d4-v6so951394pll.5 for ; Tue, 27 Feb 2018 22:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LPS34ZlDJEm23XLMBm95JVpK4ySfbTX2OqYQDL3o4z0=; b=Hh1Mvx/NC+57wLKcrQVaImz1bEN2scfNFG3pTuG+Syz5VX30/Lk2zMOvgg4ffyJMMK PDQwXTCLpjYf3iq+lCx2it73ZVrwgtFnELVaYZIFN+7sE2Qp1bU+ETvZIQ868HARvRR2 IorCKIglA1gOx/iWWaI7uDgN/iaN6BZb4jdOBKSaum+xlE+15KaD2IA/b5BKLMKpDrfA MQSkUsdZFiC1sWD5zywU6JkH0s3A2a0ObZVwYTVuVZu/dDUnUp25ods9Cow1vLWIdV+6 ZEiBfH2rkH1nitYMk72gDV+Hhwk93vr6ZD8QcM1mlCr+cklpsSqhr7W8o/+Gb4PSx6eK Aumg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=LPS34ZlDJEm23XLMBm95JVpK4ySfbTX2OqYQDL3o4z0=; b=ptHRf/MqLZwzpD5woYASryIutT7d0DpzfHjuXpLS2JYDcKTNXR9Wcc+r565ZfA7Gde vxmKM2vN5VGGd/iAgf4tgRC57bqqiSGR1mk7S/Dn5d1gkzw+kZCDQlzo9Kyu4mgmWOHu QJapnGoJ6710KvRwxQ+tfoeMBNDSPu4Wfhc01c1CIOGJw9NxqV0sZEcXQ6hdZkVbEsFJ qnNRi4Jwl5St+urfUNoMcbnxjAzNHiiDUGjDN90FYE2N4KXGkSstgoYfsjC40jFKSgKE EBrEKj8rE8koG88dGd+iARC+wHSu9T+BXBt5xDfR8nS/r35VQ4aT1iyVFItZYRjJg3Xp 48Kw== X-Gm-Message-State: APf1xPCfQ72c2YUSKb3Dkti0vPzUTsApbj1DtQKThXEzQu5jaUF2rZH6 JCqOjkJ6JbDXBS2z0yktJfjcSALJ X-Google-Smtp-Source: AG47ELvgwlMji/HgT9Y1+1w6qIHlPioCHLcl5gXGhThhWCmqMErjRRn08Wz3yNzW6wTdaqOsZjbjyw== X-Received: by 2002:a17:902:7b85:: with SMTP id w5-v6mr9509009pll.131.1519798596328; Tue, 27 Feb 2018 22:16:36 -0800 (PST) Received: from aurora.jms.id.au ([203.0.153.9]) by smtp.gmail.com with ESMTPSA id a6sm1659334pfi.22.2018.02.27.22.16.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 27 Feb 2018 22:16:35 -0800 (PST) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Wed, 28 Feb 2018 16:46:30 +1030 From: Joel Stanley To: skiboot@lists.ozlabs.org Date: Wed, 28 Feb 2018 16:46:10 +1030 Message-Id: <20180228061610.30856-3-joel@jms.id.au> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180228061610.30856-1-joel@jms.id.au> References: <20180228061610.30856-1-joel@jms.id.au> Subject: [Skiboot] [PATCH 2/2] astbmc: Enable mbox depending on scratch reg X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Cyril Bur MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- hw/ast-bmc/ast-io.c | 14 ++++++++++++++ include/ast.h | 1 + platforms/astbmc/common.c | 5 +++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/hw/ast-bmc/ast-io.c b/hw/ast-bmc/ast-io.c index cd1aba2a177a..964d41513379 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 414ff6a3d39a..2c1336b2a79b 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 243ad9461239..9cf679161e7a 100644 --- a/platforms/astbmc/common.c +++ b/platforms/astbmc/common.c @@ -207,8 +207,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 */