From patchwork Tue Jul 16 11:09:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Brugger X-Patchwork-Id: 1132599 X-Patchwork-Delegate: matthias.bgg@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=kernel.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="FiHx3lJR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45nyNY48Vzz9sNT for ; Tue, 16 Jul 2019 21:10:05 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2F3E5C21DA2; Tue, 16 Jul 2019 11:10:03 +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=T_DKIM_INVALID 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 A46B2C21C29; Tue, 16 Jul 2019 11:10:00 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EE7CBC21C29; Tue, 16 Jul 2019 11:09:58 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by lists.denx.de (Postfix) with ESMTPS id 81E6FC21BE5 for ; Tue, 16 Jul 2019 11:09:58 +0000 (UTC) Received: from ziggy.de (unknown [37.223.141.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AD28B21721; Tue, 16 Jul 2019 11:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1563275397; bh=+DEbcq6PuEbR7p3HoQpA0/NZtSQBXFgUnMu5WKFLf5s=; h=From:To:Cc:Subject:Date:From; b=FiHx3lJRfSB+yBTRD7gaiRvGvWvQ5aUOhdfiTtt090tCXA2DPwJG7OPngCQl+UBBU HanF0LFlSoCmZ965hDqETQV60lBLxO95lGPOUOvgIRj7jMJjsDzY6IsT0pZDcebRwn 0XcS+cTjbq8PC0H9gQN7RRzXrMhUBDcrpVM5lKnE= From: matthias.bgg@kernel.org To: albert.u.boot@aribaud.net, swarren@wwwdotorg.org Date: Tue, 16 Jul 2019 13:09:47 +0200 Message-Id: <20190716110947.32603-1-matthias.bgg@kernel.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Cc: fvogt@suse.com, agraf@csgraf.de, berkus+github@metta.systems, Matthias Brugger , u-boot@lists.denx.de Subject: [U-Boot] [PATCH] ARM: bcm283x mbox: Fix send status 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Fabian Vogt Before we can send a message to the mailbox we have to check that there is space to do so. Therefore we poll the status register. But up to now the wrong status register, the one of mailbox 0, was checked. Fix this by polling the status regiser of mailbox 1. Signed-off-by: Fabian Vogt [mb: rename registers and update commit message] Signed-off-by: Matthias Brugger Acked-by: Stephen Warren --- arch/arm/mach-bcm283x/include/mach/mbox.h | 7 +++++-- arch/arm/mach-bcm283x/mbox.c | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-bcm283x/include/mach/mbox.h b/arch/arm/mach-bcm283x/include/mach/mbox.h index e3a893e49c..f892803558 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -46,9 +46,12 @@ struct bcm2835_mbox_regs { u32 read; u32 rsvd0[5]; - u32 status; - u32 config; + u32 mail0_status; + u32 mail0_config; u32 write; + u32 rsvd1[5]; + u32 mail1_status; + u32 mail1_config; }; #define BCM2835_MBOX_STATUS_WR_FULL 0x80000000 diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c index 1642ebd103..3c67f68c17 100644 --- a/arch/arm/mach-bcm283x/mbox.c +++ b/arch/arm/mach-bcm283x/mbox.c @@ -27,7 +27,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Drain any stale responses */ for (;;) { - val = readl(®s->status); + val = readl(®s->mail0_status); if (val & BCM2835_MBOX_STATUS_RD_EMPTY) break; if (get_timer(0) >= endtime) { @@ -40,7 +40,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Wait for space to send */ for (;;) { - val = readl(®s->status); + val = readl(®s->mail1_status); if (!(val & BCM2835_MBOX_STATUS_WR_FULL)) break; if (get_timer(0) >= endtime) { @@ -58,7 +58,7 @@ int bcm2835_mbox_call_raw(u32 chan, u32 send, u32 *recv) /* Wait for the response */ for (;;) { - val = readl(®s->status); + val = readl(®s->mail0_status); if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY)) break; if (get_timer(0) >= endtime) {