Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp301464rwe; Wed, 24 Aug 2022 00:54:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR7pxKB8yoB7gO3vu1Vm8XUPklTFBRKYaQcIyV5kDj4TfRCWjzJJ+pP3Ard73tWYx3AWajmp X-Received: by 2002:a05:6402:90e:b0:443:ec4b:2b03 with SMTP id g14-20020a056402090e00b00443ec4b2b03mr6493125edz.71.1661327670570; Wed, 24 Aug 2022 00:54:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661327670; cv=none; d=google.com; s=arc-20160816; b=TcPcBiIXmOPS2bUjtuH+9kRcB6XDQTsRtLwm/hd4p1KaTqVtp3oQ925I956nni+zza 641hH+WPNxgDTl2xuWJr1zPy+h73rUnp8LE8urWXnPt7oaYvuJmMOEevBvDgspfM3xAZ EcTpmRWB404vm9/NVqzvJXkbNlKaitK7gXP6tVc0Wrncv0kl36KHmVuSLwiVEyon52UH sJp8OgSZ6x6G8fHQBamsEXb/fDal+7mPGgZRk9ahBD+My4Y1OY3LYvFOpiCuMPx2WkCo 6I53wr0pUkMK9ASl7IhgW1IwcYAi2axkeJoph5FjTU1J5Yw+c7vTi1ZvwD/P3ut0g5v8 Uj2g== 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=mXR0KixPQ/lBO+EWh54bXMgPh0YFUuVE//HwjiDSNp4TyeDlCDb4X6iRYCxs/30Bbw /KkxxBdBGXl8JB4H8G4Y3YA+BeH2H+omB4G+mVdBHkilozITOgHIjfFP7X/fB1FBDSR6 7ar6rfwcZNCXPKMb7mLYLy84dfsroccYBpcyCX1QyFt9O9E5YB1GD1Hzk00lFD3I2Lxf 83QBW5i1WMVJM6dYfu+Aro3pcJAUvfKW9gl3CJViVzQQ6t0GErynf+rNPRNUt34j9TIz 1XKB+jdr5K0x5kSxKeseshnor3F3AegqOtJjDDP7/uxTW2EjWurUvAOivOG2lF1fCLT7 1X6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ME7dxaRD; 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 k2-20020aa7d2c2000000b0043e7c42de10si3246630edr.268.2022.08.24.00.54.04; Wed, 24 Aug 2022 00:54:30 -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=ME7dxaRD; 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 S235470AbiHXHJB (ORCPT + 99 others); Wed, 24 Aug 2022 03:09:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235371AbiHXHIs (ORCPT ); Wed, 24 Aug 2022 03:08:48 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5974F93507; Wed, 24 Aug 2022 00:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1661324926; x=1692860926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=00HIFvltqoK2q6RN6iEVaq/z31zM0MweFlDQWbq1aXU=; b=ME7dxaRD34xEGEqx6VfciUK0786tcQjbfSPs5lVtmO3UamovGcnSwVl7 kgDYZG7txtxR276RXrTzloKdVyA2Em3XUmOAgeLKj2hb6VTGA/TtLfdg+ +SUTQcyzNtst6RQq/qAWBjUQ0wGWzsojjO3x3Tosn50XpuXeE2w5AMfSV W20vbmREw+TcjVUvcb4SqZ0P9DEtjkUNSrpLm6UQpv6MdllSBK1AUdLNM 3MVAbcKIwZ4j9TdMLQJrEXl5HEu3T30vbd1g7gP83JNYCWtx11qRjnK+m iC1+7K0MWVD1HnxDO65sm3LtCqnA4hpgwFSrnfkbJZRcZ4pGi45sDC+JT Q==; X-IronPort-AV: E=Sophos;i="5.93,260,1654585200"; d="scan'208";a="170677322" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Aug 2022 00:08:45 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Wed, 24 Aug 2022 00:08:45 -0700 Received: from wendy.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Wed, 24 Aug 2022 00:08:43 -0700 From: Conor Dooley To: Jassi Brar , Rob Herring , Krzysztof Kozlowski CC: Conor Dooley , Daire McNamara , , , Subject: [PATCH v2 3/3] mailbox: mpfs: account for mbox offsets while sending Date: Wed, 24 Aug 2022 08:08:12 +0100 Message-ID: <20220824070810.52219-4-conor.dooley@microchip.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220824070810.52219-1-conor.dooley@microchip.com> References: <20220824070810.52219-1-conor.dooley@microchip.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 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,URIBL_BLOCKED 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