Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp1985426imw; Sat, 16 Jul 2022 21:12:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tBTcROVgDCeaEWJ7wCnuePSrQisDPXZf+B3cghzu0gfyHRTUQq4XQHvqTaTdNj5ws8bduc X-Received: by 2002:aa7:d9ce:0:b0:43a:6758:7652 with SMTP id v14-20020aa7d9ce000000b0043a67587652mr29469646eds.351.1658031162042; Sat, 16 Jul 2022 21:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658031162; cv=none; d=google.com; s=arc-20160816; b=MlKuHY2AQUsyox6zXOtNenZOem3SPXp7vFVZazAipDfwLuTmvXCaXSyMr9p69kSmNG bHVC+bkFSKMWTxNdabJPcr2VQATDLcuUSCcSYYuGniU/3lr92ZcWJvavKBu9guM7MQpd Bh02kidGyCWtZZZWEo4RXQFdvci7QKled87RFnvZMPjK64Woqdmi58qG9YbP4U1apr3P 2v0guaMx9XN5JfX2/p5tCLRiDrZ1ZueIvz/jTYOqjGoF69UQj5bL9+DPDE+fPtaywd87 G2VomYiMk6O3nA+OVf1L+MR3KA2FrwHAkuc9VspZAoDxRNDsUvij/7e8XBECRmT1V5/O 5+EQ== 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=Y1Z7tiCUOCROwXa2SQqXBTnkJtu9davb+q/iCGv2BZ8=; b=XINuH+U3RzMLLZgfhllaudRQjvI0T7k5zTNgH5tyTy+/2kyI7SBxldeg4Cw2gYUc5G lMU4uGCb+7ZmFaqqgIwU3C9KWJ+Nssewn6/Y/6lYQOZ7vfv508ifLe/buuDwLSDgjwM8 J024txNhelVjzt1AP/9MrkYPciCCiUNzeAKg8hudkvwfwpbHV8FxL9sOgOO/8//lnJar UbfdQ444fFfhTwuHPTPr3d4PbXwn1z/kICtWxQjsG0iGB09J96gpb5tYQ+wLT1a01xDP DP2h+QCPtuSlCjMmtnsKjDmVjoVDHPlU/PdErr1e7ksUTj1OUKvLQUUQWmm/U/VzGacV Dohw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PGXDojd3; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a17090658d100b00711f63ebdb3si14299640ejs.565.2022.07.16.21.12.17; Sat, 16 Jul 2022 21:12:42 -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=@linaro.org header.s=google header.b=PGXDojd3; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233033AbiGQDsY (ORCPT + 99 others); Sat, 16 Jul 2022 23:48:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232809AbiGQDsJ (ORCPT ); Sat, 16 Jul 2022 23:48:09 -0400 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1F9F17A8C for ; Sat, 16 Jul 2022 20:48:08 -0700 (PDT) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-10bf634bc50so15757562fac.3 for ; Sat, 16 Jul 2022 20:48:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y1Z7tiCUOCROwXa2SQqXBTnkJtu9davb+q/iCGv2BZ8=; b=PGXDojd3zELY6mETwkMfKCyQ2Bl53TCqJ5W1D4jlWj/DprutvEUs4mSMnMnohxw8Zd JLlN1rb5zIHKjLk3bz/gBS3DUJzTq1DA6d4xKM37lAnrsX5n7tSm9GXJIaJjfHbmL1aa iwOQCkSWgJUlX+qnO4MKbs5YtYddnMScjRN8M7hPdiTvSh1SAwXcGH5iKvlOZuYSOVaa IgfClQZxUJDGFZQGlYPZkDSibYMZN/PqYLaj/ULpShPcVIqzB5TbVrqrl2E7ARkXsTqv NAD2yJY5zZDglwjBOQHyCCjPwoccMrMs9WOjlMcXaDSDNMlzh1/BKxMNsgyQv6mK523P 2ZwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y1Z7tiCUOCROwXa2SQqXBTnkJtu9davb+q/iCGv2BZ8=; b=xRxWcuF2enUilSPgPagITbHJR3U8xgaRL9ZuvuoK5Me5Uduy4hhLMd05EW1SFWqmVf z61UIuqhxpdzOsKvG7SrYNNRUCSHM3FbTTkAy3l1nicfvXOyt+ICMEx/iYiMWO6ImtZ+ 5e/Dq1eH0GAs7dDR8TDTxQhw4neg3YBqLdP1PlrP2ZeEIPuk+t/1komyRw9U98qnbMfO m3MaZXWM47kERQJ4H1/uzqVia/q9jnpH/X62L4k531RRnWe5l74fQ/1v3Z/IHA6Pz7Am VQqva1RbfMQwSdZKqvSarQLipoNlFHau8bFnQnrHbw/R2t8OqFhaMT4BIeVGy6WFJs36 8PAw== X-Gm-Message-State: AJIora/6E0wCcKxVBS7TOgI8tly6EERUlqloor6JN8/UbgYOLT0DmLsb hj3jBzGY9w+JYJ/IdYDjbtMEvg== X-Received: by 2002:a05:6808:f02:b0:33a:59a3:3a12 with SMTP id m2-20020a0568080f0200b0033a59a33a12mr3954211oiw.181.1658029688441; Sat, 16 Jul 2022 20:48:08 -0700 (PDT) Received: from ripper.. (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id e65-20020aca3744000000b0033a169f9282sm3004515oia.52.2022.07.16.20.48.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Jul 2022 20:48:08 -0700 (PDT) From: Bjorn Andersson To: Bjorn Andersson , Konrad Dybcio , Vinod Koul , Wolfram Sang Cc: linux-arm-msm@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] i2c: qcom-geni: Propagate GENI_ABORT_DONE to geni_i2c_abort_xfer() Date: Sat, 16 Jul 2022 20:50:26 -0700 Message-Id: <20220717035027.2135106-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220717035027.2135106-1-bjorn.andersson@linaro.org> References: <20220717035027.2135106-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Waiting for M_CMD_ABORT_EN in geni_i2c_abort_xfer() races with the interrupt handler which will read and clear the abort bit, the result is that every abort attempt takes 1 second and is followed by a message about the abort having times out. Introduce a new state variable to carry the abort_done state from the interrupt handler back to geni_i2c_abort_xfer(). Signed-off-by: Bjorn Andersson --- drivers/i2c/busses/i2c-qcom-geni.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-qcom-geni.c b/drivers/i2c/busses/i2c-qcom-geni.c index 3bec7c782824..e212e7ae7ad2 100644 --- a/drivers/i2c/busses/i2c-qcom-geni.c +++ b/drivers/i2c/busses/i2c-qcom-geni.c @@ -97,6 +97,7 @@ struct geni_i2c_dev { struct dma_chan *tx_c; struct dma_chan *rx_c; bool gpi_mode; + bool abort_done; }; struct geni_i2c_err_log { @@ -203,9 +204,14 @@ static void geni_i2c_err(struct geni_i2c_dev *gi2c, int err) dev_dbg(gi2c->se.dev, "len:%d, slv-addr:0x%x, RD/WR:%d\n", gi2c->cur->len, gi2c->cur->addr, gi2c->cur->flags); - if (err != NACK && err != GENI_ABORT_DONE) { + switch (err) { + case GENI_ABORT_DONE: + gi2c->abort_done = true; + break; + default: dev_err(gi2c->se.dev, "%s\n", gi2c_log[err].msg); geni_i2c_err_misc(gi2c); + break; } } @@ -311,21 +317,21 @@ static irqreturn_t geni_i2c_irq(int irq, void *dev) static void geni_i2c_abort_xfer(struct geni_i2c_dev *gi2c) { - u32 val; unsigned long time_left = ABORT_TIMEOUT; unsigned long flags; spin_lock_irqsave(&gi2c->lock, flags); geni_i2c_err(gi2c, GENI_TIMEOUT); gi2c->cur = NULL; + gi2c->abort_done = false; geni_se_abort_m_cmd(&gi2c->se); spin_unlock_irqrestore(&gi2c->lock, flags); + do { time_left = wait_for_completion_timeout(&gi2c->done, time_left); - val = readl_relaxed(gi2c->se.base + SE_GENI_M_IRQ_STATUS); - } while (!(val & M_CMD_ABORT_EN) && time_left); + } while (!gi2c->abort_done && time_left); - if (!(val & M_CMD_ABORT_EN)) + if (!time_left) dev_err(gi2c->se.dev, "Timeout abort_m_cmd\n"); } -- 2.35.1