From patchwork Tue Jul 16 13:37:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Gherzan X-Patchwork-Id: 1132774 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=none (p=none dis=none) header.from=gherzan.ro Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=gherzan.ro header.i=@gherzan.ro header.b="FVwymkYW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45p1nB4PSsz9s7T for ; Tue, 16 Jul 2019 23:43:10 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 420E7C21F13; Tue, 16 Jul 2019 13:41:55 +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 1C287C21F49; Tue, 16 Jul 2019 13:39:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D45BBC21E60; Tue, 16 Jul 2019 13:38:18 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id 97169C21E49 for ; Tue, 16 Jul 2019 13:38:18 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id u25so8382573wmc.4 for ; Tue, 16 Jul 2019 06:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gherzan.ro; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FRnqnRi8Sg7Ycg+VP90bS3yOzvJ7u5H8Fm1LXwU6pYA=; b=FVwymkYWNcGkl0Eze1QJy378qF/SeyqBQiGan5j7fLT8gxC7TkNP3sPEinpvzm33zR z1u6zk23PeyS95KtgivPULf4nnCVJTy4EINbV1b0iXBFMqJ4N/RqcRwOFSS+dz6cu9gf 1S+typ05USqar4o429JxFCIRbxG/DM/VXbPyLC6LqMLahzKriKnLMt3iWi4TlM2Ja4NT 5th2xJXrDdOHWZCpolowXIwrZ7hO6kimpjBOrAy0BFwFFvxJEyFubO/p7t9Zuhg+DVC8 knIEVx+Sce6xyJN8m9egWl+qJeJVEXs/fOWL5U4SdGZhylrm4quqK2K1E1NhYEdInY69 RJcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FRnqnRi8Sg7Ycg+VP90bS3yOzvJ7u5H8Fm1LXwU6pYA=; b=G9Re7CwUKYbqkYFizWvwmZ6LztCFyRj4Q7tA3iVA8OJ3GWmiNAuhb9wSZLeq2MQ3qN n/jDUiK+R/Oppokx5C1cBk4jvaaTegM/QQQqdYTNJnkm3LKxt9RkZIbnoNoCMaLniDjf cVCCZYO/uOK+TH9WzjpQjKo1YgawlnGxmji5Qtp3v7XGsMwmj7J2XdIzYZHoYboyxLp1 4lOKKDzUJJuojlJCzNLmGO4SofdPJzE52MEEvkMm/caiBqSazMaGNVEV7TJJzKNMHSlf tmqGyUXe1n6AA1wWQ04E08EQoXWRxMceBDBKlISZLJwK0haDofstmO58VnFfSqSZuF59 4GrQ== X-Gm-Message-State: APjAAAXoctYcH54A5yLNRwATMAwdoaXaJ44ae1rgz727nhuDatokq3yZ MgiVw2oxHxiBsw/LroFtt18m+qCO X-Google-Smtp-Source: APXvYqy/JQNS6JAWgTAqxCOkZ2PLNNxl5fhSZdRFYX1US8tu1haSRg5V8yEpEaGarOB3UvfOcDP5xw== X-Received: by 2002:a7b:c933:: with SMTP id h19mr31914647wml.52.1563284297913; Tue, 16 Jul 2019 06:38:17 -0700 (PDT) Received: from localhost.localdomain ([212.36.34.46]) by smtp.gmail.com with ESMTPSA id e5sm21450292wro.41.2019.07.16.06.38.17 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 06:38:17 -0700 (PDT) From: andrei@gherzan.ro To: u-boot@lists.denx.de Date: Tue, 16 Jul 2019 14:37:58 +0100 Message-Id: <20190716133803.1174-12-andrei@gherzan.ro> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190716133803.1174-1-andrei@gherzan.ro> References: <20190716133803.1174-1-andrei@gherzan.ro> MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 16 Jul 2019 13:38:54 +0000 Cc: Fabian Vogt Subject: [U-Boot] [PATCH 11/16] bcm283x mbox: Correctly wait for space to send 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 For sending, the second mailbox is used, but previously the status register of the first one was read. --- 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 cad035e8cd..cd78966150 100644 --- a/arch/arm/mach-bcm283x/include/mach/mbox.h +++ b/arch/arm/mach-bcm283x/include/mach/mbox.h @@ -51,9 +51,12 @@ struct bcm2835_mbox_regs { u32 read; u32 rsvd0[5]; - u32 status; - u32 config; + u32 status_r; + u32 config_r; u32 write; + u32 rsvd1[5]; + u32 status_w; + u32 config_w; }; #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..f7483bf423 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->status_r); 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->status_w); 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->status_r); if (!(val & BCM2835_MBOX_STATUS_RD_EMPTY)) break; if (get_timer(0) >= endtime) {