From patchwork Fri Aug 17 08:22:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ley Foon Tan X-Patchwork-Id: 958692 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 41sGRM5DXGz9s47 for ; Fri, 17 Aug 2018 18:22:55 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 70F77C21D83; Fri, 17 Aug 2018 08:22:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 14EE6C21E12; Fri, 17 Aug 2018 08:22:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 15073C21DD3; Fri, 17 Aug 2018 08:22:19 +0000 (UTC) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by lists.denx.de (Postfix) with ESMTPS id 0BB00C21DB3 for ; Fri, 17 Aug 2018 08:22:13 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Aug 2018 01:22:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,250,1531810800"; d="scan'208";a="66908864" Received: from lftan-mobl.gar.corp.intel.com (HELO ubuntu) ([10.226.248.107]) by orsmga006.jf.intel.com with SMTP; 17 Aug 2018 01:22:09 -0700 Received: by ubuntu (sSMTP sendmail emulation); Fri, 17 Aug 2018 16:22:08 +0800 From: Ley Foon Tan To: u-boot@lists.denx.de, Marek Vasut Date: Fri, 17 Aug 2018 16:22:03 +0800 Message-Id: <1534494123-9257-2-git-send-email-ley.foon.tan@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534494123-9257-1-git-send-email-ley.foon.tan@intel.com> References: <1534494123-9257-1-git-send-email-ley.foon.tan@intel.com> Cc: Chin Liang See Subject: [U-Boot] [PATCH] arm: socfpga: stratix10: Fix mailbox urgent command with urgent register X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" According to mailbox spec, software should send urgent command with urgent register instead of COUT location. This patch write urgent command index to urgent register. Signed-off-by: Ley Foon Tan --- arch/arm/mach-socfpga/mailbox_s10.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c index cccd1a4..0d906c3 100644 --- a/arch/arm/mach-socfpga/mailbox_s10.c +++ b/arch/arm/mach-socfpga/mailbox_s10.c @@ -160,15 +160,15 @@ static __always_inline int mbox_send_cmd_common(u8 id, u32 cmd, u8 is_indirect, u32 buf_len; int ret; - ret = mbox_prepare_cmd_only(id, cmd, is_indirect, len, arg); - if (ret) - return ret; - if (urgent) { /* Read status because it is toggled */ status = MBOX_READL(MBOX_STATUS) & MBOX_STATUS_UA_MSK; - /* Send command as urgent command */ - MBOX_WRITEL(1, MBOX_URG); + /* Write urgent command to urgent register */ + MBOX_WRITEL(cmd, MBOX_URG); + } else { + ret = mbox_prepare_cmd_only(id, cmd, is_indirect, len, arg); + if (ret) + return ret; } /* write doorbell */ @@ -188,8 +188,7 @@ static __always_inline int mbox_send_cmd_common(u8 id, u32 cmd, u8 is_indirect, if (urgent) { u32 new_status = MBOX_READL(MBOX_STATUS); - /* urgent command doesn't have response */ - MBOX_WRITEL(0, MBOX_URG); + /* Urgent ACK is toggled */ if ((new_status & MBOX_STATUS_UA_MSK) ^ status) return 0;