Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp1706873rwb; Fri, 5 Aug 2022 06:37:12 -0700 (PDT) X-Google-Smtp-Source: AA6agR6LeoMFcZjsxM+M2rcmtch6Vh8rF289JEMJkVQqBiaoLt7NsfW1XLsYSBDQVGCuzBYaj+/L X-Received: by 2002:a17:907:7e94:b0:730:aa9c:cb6a with SMTP id qb20-20020a1709077e9400b00730aa9ccb6amr5116152ejc.257.1659706631998; Fri, 05 Aug 2022 06:37:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659706631; cv=none; d=google.com; s=arc-20160816; b=MoE2RljY0OKN9voh0YCutERAFEoX5uGeNi4ZKHte0XcJiSaZXM6yiuL/ll1Gosj6Ro kOSgavgJb0QhAZN293hEqSJ/mO/cVgx9DRBAr4g/4ZDQn3tLEzC+nf4dsfaq6MxhRh6Q dDuAM05cpic1zFCEvBvEFiIBqRn0jK3r2NdpCykja9s8lX1/MDeifX/0jktXiCjxoKaz WzMtbIJCxr1ysB1Gt0RyIaCkuqeDj3gqHIfrzXVLRPBZp+z/1VLcXJzaKps4U5vP+134 8g+rKF0B3zBWR+b/FYhE04LP8w+Rz94DV9OjUtlq+4YUHNprCIGaNPGmiw+QCG9O1bou Suew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lqd+6PTgA3YzVAhi5aqPxRdSS9rv/8RFple6WkAf3xg=; b=LU+QadJvv46+adSmmPmBb8e0rmYSSWihkBvqhATjVnyJvkDxT7bJJWr0SQ2Vo2D+tq +wSpTI8eMQhhdjbV4RIAnQwUIDMSDHDJ7rahd1Rj1HWFY0LEKqItrY5qWVfiPkFLk4iG YKnwudvo/OW1ap6ux+jzVw+F1xbdWoa5BnD2Kn+W/tBlrkwb0Bb7Yy2h51LmEjIfBiCJ ZxAfB17PPCL6f6yq3h8hc81gS3OEvFSZrb5tSI3UX/2AdFijUbt0KjbgUKMBNQhu5L3Y Glpm+mCC5v0OpzI76uJEWcs4wKhdrj+b/Wwo3zJvuK/w/NgL0gFnm+NunWIhYUNPBNtZ 4ZQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=RraV3IGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m20-20020a056402511400b0043db3c4b3b8si4500316edd.28.2022.08.05.06.36.47; Fri, 05 Aug 2022 06:37:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=RraV3IGM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235203AbiHEM4J (ORCPT + 99 others); Fri, 5 Aug 2022 08:56:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240797AbiHEMz7 (ORCPT ); Fri, 5 Aug 2022 08:55:59 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E46D622B2C; Fri, 5 Aug 2022 05:55:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1659704158; x=1691240158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=00HIFvltqoK2q6RN6iEVaq/z31zM0MweFlDQWbq1aXU=; b=RraV3IGMPEPO0sAR7YsDZoKVqoWmR4QV2iEaHdBgTNKAQEzDYLAL62O7 BiBbB7AMWyqX/Zk7jk3ZAo74HIzorcuezUd7I79+QNWV3ktGOX00yaekG BIUb6FVXw+7gWIej7dC69Np8Bkb2fB/x7gC5vR1Xnh33zbShVUdIj/eBs 3KhovI6mKLXFONzuo4nTVGiQIs398TgwEdV0OM7QWmFpCflvposJpzm1G yJOtMDxFcblrN2D4EtfmzjanWfu+T/6FIIh+QtkfhhTIz2SmVt+7NQdMU OYk/msjDJZ8EcgxJp2FRsiGZmECyIZ8z+shSp1YD4ib159SDTNibbgsUE A==; X-IronPort-AV: E=Sophos;i="5.93,216,1654585200"; d="scan'208";a="175226525" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 05 Aug 2022 05:55:58 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.28; Fri, 5 Aug 2022 05:55:57 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2375.17 via Frontend Transport; Fri, 5 Aug 2022 05:55:56 -0700 From: Conor Dooley To: Jassi Brar , Rob Herring , Krzysztof Kozlowski CC: Conor Dooley , Daire McNamara , , , Subject: [PATCH 3/3] mailbox: mpfs: account for mbox offsets while sending Date: Fri, 5 Aug 2022 13:56:19 +0100 Message-ID: <20220805125618.733628-4-conor.dooley@microchip.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220805125618.733628-1-conor.dooley@microchip.com> References: <20220805125618.733628-1-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mailbox offset is not only used for receiving messages, but it is also used by messages sent to the system controller by Linux that have a payload, such as the "digital signature service". It is also overloaded by certain other services (reprogramming of the FPGA fabric, see Link:) to have a meaning other than the offset the system controller should read from. When the driver was written, no such services of the latter type were in use & those of the former used an offset of zero so this has gone un-noticed. Link: https://www.microsemi.com/document-portal/doc_download/1245815-polarfire-fpga-and-polarfire-soc-fpga-system-services-user-guide # Section 5.2 Fixes: 83d7b1560810 ("mbox: add polarfire soc system controller mailbox") Signed-off-by: Conor Dooley --- drivers/mailbox/mailbox-mpfs.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mailbox/mailbox-mpfs.c b/drivers/mailbox/mailbox-mpfs.c index e432a8f0d148..cfacb3f320a6 100644 --- a/drivers/mailbox/mailbox-mpfs.c +++ b/drivers/mailbox/mailbox-mpfs.c @@ -100,21 +100,20 @@ static int mpfs_mbox_send_data(struct mbox_chan *chan, void *data) for (index = 0; index < (msg->cmd_data_size / 4); index++) writel_relaxed(word_buf[index], - mbox->mbox_base + index * 0x4); + mbox->mbox_base + msg->mbox_offset + index * 0x4); if (extra_bits) { u8 i; u8 byte_off = ALIGN_DOWN(msg->cmd_data_size, 4); u8 *byte_buf = msg->cmd_data + byte_off; - val = readl_relaxed(mbox->mbox_base + index * 0x4); + val = readl_relaxed(mbox->mbox_base + msg->mbox_offset + index * 0x4); for (i = 0u; i < extra_bits; i++) { val &= ~(0xffu << (i * 8u)); val |= (byte_buf[i] << (i * 8u)); } - writel_relaxed(val, - mbox->mbox_base + index * 0x4); + writel_relaxed(val, mbox->mbox_base + msg->mbox_offset + index * 0x4); } } -- 2.36.1