Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp422126pxb; Thu, 9 Sep 2021 04:12:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXtl7gN+JTZZWl2yvgaUmqM1UvmPlmPlc9SttgDgD7PjNTtlZYIZsiQAKeTcwqQ1JTdNKI X-Received: by 2002:a02:bb16:: with SMTP id y22mr2257316jan.129.1631185954024; Thu, 09 Sep 2021 04:12:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631185954; cv=none; d=google.com; s=arc-20160816; b=bJQ447PIwyV3GsQBnEZIMIaza5wijDuI3/H6v3RBsSa3XKRjrgzDuvKQCAjEoQZTt9 vjKLxx91Bgip/oGjlIEgjBa23QyMiGYV/tkuVER5mZhdCWKE/xFt0icOlfkXJZ4mzyqC Hnm3Aq5BK9Eoe3H7p5sF7vJwUQlptR6DqYFI8tqaMLHfczLaGzTZhq5o8WZhBANZClwy xlRWAZL1rc9k/Yk3za59pJ3X4fAu9Rzco+UrHeZ7YOTdB7gQzlzvTlysn5g1RkAOglSS lU5FsNi5kChtbp4w0fJyQVt3P5st/eWwvFNhvkLqJBGsxV5/ocsNLatplVX7BQ8U7zVG trqg== 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=b4lv3VySvMZBsmWHH8FJBjD9cy6eaPIRwRdSaXk8zrI=; b=xNvl/YZuqciwbHLSl6+Yr2MrUcUZ/e1XvxOuZhyTyUaC4jb+ChWj/mAqgZ+GBysklH 82RGvx8+ntbVa4rGN4tpsO8hNZz5A/3DmWfIYPRfemajEMhpJjsS6wCrOstYOni/7KDq /m0FDwfrnyDsTOB4HfU47aIsSbpJRddfYlhTIkM0ava2iygt4n2Woc8w2Z3sVQ7BDfKo mRVJs72jSB8c9Vt39cFwtia0z8uZ8HkFdxkyHlHjJNsT2wYgk43treemlJ70tFD6gXbX QopMG33HLKYXTem56BHw/1HLzhGooLGSyYF4jVYwBbLHANE+xpDoSFGrFH4oKoypnydi NPRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RlFR1aGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h22si1458225jal.57.2021.09.09.04.12.22; Thu, 09 Sep 2021 04:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RlFR1aGq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235303AbhIILL2 (ORCPT + 99 others); Thu, 9 Sep 2021 07:11:28 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:19056 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234932AbhIILLX (ORCPT ); Thu, 9 Sep 2021 07:11:23 -0400 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 1895CKhb012432; Thu, 9 Sep 2021 06:10:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=b4lv3VySvMZBsmWHH8FJBjD9cy6eaPIRwRdSaXk8zrI=; b=RlFR1aGqYRBHyvpzBuGunFOKTjHhtVadvc3Bey6G5KENEJYKn9RTWEIz9ozNOvRZDtMa bO/KjGA3xXrpBoB10PboEhOhJNpiU5H7A/tdp/qB49/6zP20uaRS1jN2bSzMpoNxyggO avWzk+oCBmk+HbUfB6WZjKVIyj7rg9pgUCNfhCXK/SGjQcUHpCeuQiLOV52nfQSxRRT/ Ll7iV2qeaDHuughs99Uyi/ze1Mni5VXnJPVyFigfDyWt2RUFzpZP8y5/M/xMFS/RSKaH NysHpnpNlc1Hq6O7FEegwse6kKn9+AwLlmtppPahkl7BhgtsVb47QKT6FSJoMSr4JpgB FQ== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 3ay8n60e5d-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 09 Sep 2021 06:10:11 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Thu, 9 Sep 2021 12:10:08 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.2242.12 via Frontend Transport; Thu, 9 Sep 2021 12:10:08 +0100 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.231]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 81F93B2F; Thu, 9 Sep 2021 11:10:08 +0000 (UTC) From: Lucas Tanure To: Mark Brown , Sanjay R Mehta , Nehal Bakulchandra Shah CC: , , , Lucas Tanure Subject: [PATCH 4/4] spi: amd: Check for idle bus before execute opcode Date: Thu, 9 Sep 2021 12:10:05 +0100 Message-ID: <20210909111005.304101-4-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210909111005.304101-1-tanureal@opensource.cirrus.com> References: <20210909111005.304101-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: LHnOknpLOPQwKaWdrwgOMLHszyLqAocX X-Proofpoint-GUID: LHnOknpLOPQwKaWdrwgOMLHszyLqAocX X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Check if the bus is not in use before starting the transfer Signed-off-by: Lucas Tanure --- drivers/spi/spi-amd.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-amd.c b/drivers/spi/spi-amd.c index 97838b57871c..99b2b0ccff08 100644 --- a/drivers/spi/spi-amd.c +++ b/drivers/spi/spi-amd.c @@ -115,11 +115,18 @@ static int amd_spi_busy_wait(struct amd_spi *amd_spi) return 0; } -static void amd_spi_execute_opcode(struct amd_spi *amd_spi) +static int amd_spi_execute_opcode(struct amd_spi *amd_spi) { + int ret; + + ret = amd_spi_busy_wait(amd_spi); + if (ret) + return ret; + /* Set ExecuteOpCode bit in the CTRL0 register */ amd_spi_setclear_reg32(amd_spi, AMD_SPI_CTRL0_REG, AMD_SPI_EXEC_CMD, AMD_SPI_EXEC_CMD); - amd_spi_busy_wait(amd_spi); + + return 0; } static int amd_spi_master_setup(struct spi_device *spi) -- 2.33.0