Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp428910pxb; Wed, 8 Sep 2021 04:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbqaC7NpVCMiG0a+cjvowLlNZW0GjsLShKDhmGLAx2gWXjta4gZ+iTNl8iST9dQyPj68Og X-Received: by 2002:a6b:f203:: with SMTP id q3mr2865342ioh.32.1631101017697; Wed, 08 Sep 2021 04:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631101017; cv=none; d=google.com; s=arc-20160816; b=HfN6bjRS4iIhWzvQt+ZV7GnvqaL9Se4XD64srXuEaSLECU/+75uoksrveM/yfYlAKQ vteTuHP6320Zuu0sUoh+NL9+znBXQdsXwf1CAykZuoPUR/c0G8LE3z70MoBrV7KjleKk pqxXp0TCZUV27tKVfLnfKHObHLsch3uChyF2+FQCrONMgbCusvo/3+X1veowK/XE017O qsKRVv8rTkWyG1LXtjdvs4k32Y2LU9bfubvZVOqaueNjxAd1IlOtkYbM9swUfle3VFC5 OZGE5kPD2OakplFYUaFIFBI1+T21rjEWVVefGeDtG15q+r75L4ofCzg6jW66vuA1FhJ+ ngcQ== 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=MoiIevtL85Y16R9q8xqo8FIaL+3c11Wqy6V7xvcx3nQ=; b=mNH0/Wj7++QQUi8UTCRpD4VPTpd1sDrHqx/IoQ+es7U4slb4LHpBnHdg6Vzk3kFBkr jt0LfSSck9HmAdzJNmwlstg/vZ+MzQdr+oeBXsjzFs4LBynu8hNIonxyb3US4Ifb+Wko ocYTauuAUnnc/GoqvVJoU8joG8nu2Xi53K3+kPCG4R8MylMNMA2KbuKR1rpnwL90IOA6 8Ggd9L9DOqkvd8JpCDNO0Tr26Nj688wLI+M+++oS/8TwipkS7u7sfpQN3Pyx23eqI07s kGtgW9qbbNLIP5jvgGZzy0VFF6gdQvgP+2Z64SagxZyLCtE2sJV2dRNSmNLNf9FEKcB3 1zqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=RR7nKv+N; 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 4si1498725jaj.45.2021.09.08.04.36.45; Wed, 08 Sep 2021 04:36:57 -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=RR7nKv+N; 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 S1351534AbhIHLg1 (ORCPT + 99 others); Wed, 8 Sep 2021 07:36:27 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:4132 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230001AbhIHLgH (ORCPT ); Wed, 8 Sep 2021 07:36:07 -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 18858Mnw005982; Wed, 8 Sep 2021 06:34:57 -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=MoiIevtL85Y16R9q8xqo8FIaL+3c11Wqy6V7xvcx3nQ=; b=RR7nKv+N0pZPRY4vr5MJpZHzfMwzkS5Hyts8I0NJRNbjM00Zk4nJdh7ZcicvAuZ/kQnK YqSrt5NFewUQDRCLGQlf4kDOWiiaJbkCU7TNKeuLNlp81NFQfchQsK2anK4e6ZxwraSh hw2dVdj6XE/wKjCd+hPDxjrnZVa8cmE9m8yHBf9V737Y7YN777K18KP2okN6CWKYuCe9 y6yUJ3DBYNQX4zm/RJkMZAWXUuFqehsX7sz++jMVK/mVqHHEmS0jXXOgZyvJ2nGLlPBn FDQOHDHuisvyJdNU4bxUf3iBi5wh2VwYvCfaC+APrPo+mnzHRfOKS7rLJYez2MdG2P55 VA== Received: from ediex02.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 3axcp997pf-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Wed, 08 Sep 2021 06:34:57 -0500 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Wed, 8 Sep 2021 12:34:55 +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; Wed, 8 Sep 2021 12:34:55 +0100 Received: from aryzen.ad.cirrus.com (unknown [198.61.64.231]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 85B752BA; Wed, 8 Sep 2021 11:34:55 +0000 (UTC) From: Lucas Tanure To: Mark Brown , Greg Kroah-Hartman , "Rafael J . Wysocki" , Sanjay R Mehta , Nehal Bakulchandra Shah CC: , , , Lucas Tanure Subject: [PATCH 07/10] spi: amd: Check for idle bus before execute opcode Date: Wed, 8 Sep 2021 12:34:48 +0100 Message-ID: <20210908113450.788452-8-tanureal@opensource.cirrus.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210908113450.788452-1-tanureal@opensource.cirrus.com> References: <20210908113450.788452-1-tanureal@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: FpF_I13L5b940pH3xbIhmrQ2qs6bdQVV X-Proofpoint-ORIG-GUID: FpF_I13L5b940pH3xbIhmrQ2qs6bdQVV 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