From patchwork Thu Jul 2 11:25:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192217 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1348924ilg; Thu, 2 Jul 2020 04:25:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSdUC+THc3eNcxQsDZ93mNbHiUC3le1tAC1Eb3hrd1Xo0a06EnXl4x7BrSmZfDvC4l67cP X-Received: by 2002:a05:6402:1605:: with SMTP id f5mr36156557edv.8.1593689149688; Thu, 02 Jul 2020 04:25:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593689149; cv=none; d=google.com; s=arc-20160816; b=V7aPDeY++f9RjlSG/ialrUtp44ee2/pSxHoNruJpKIo74KCoBWojw+yBT1oktOqkSI JpmM/8vSPtu0C7BZCEruegE6FiB6beevPP7OQsBb/f2U4fz0l8jmzquDrA8O2IA4ZIVj nvaPfGPerBQXTg0L3DFTSDWSIP8FwlCQ6YX3PjmXeasEZul+QnHHos+9FES/9VSKfCnY GZfMQFL0eRj7PJs+ef7qyQB6w64IxOnAtbOj4SSTJBHbnOGin0BJMoyKndwilk4UXsmO ISgz7s2Kk1wy/N4hZrLPadDTm7pNP72H5nAH4HidIwacAxXJllMbmi4qe6Z1bTMT8/cV yfZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kp2cMksA2bKPwFtLgY/MdRQdPPtTBA5vqesfT2+0hjc=; b=E/e8fcXQTjk0e9IKzH4/de9egiMIwyr+590GVdsZP7L9/eyqtY+yb1QJZRuOyT8Kyw sx/HNQIJzubph704xRGPIYGDNjIwTyCRotuGQf383odNLDTY3LrjwJSyownQ1pnNXCzL MWJJV73dvyvI9MtFsgv5fLKJugCFZWY9kx9yucyYXPahyjIXCwX2mzy+shohm8N8B591 cm6v/4AZY632MEe3MNRQkK7q93lvwe1qQnXhWO645f+UuIGT56sWAKgKTHbsz2nsy+n0 EaXdk7dHGxm1lailtd57HVujqo415HY4JCbLEY6VSvKqxYsQkqvhWXsuE78ZSfTFZORi SsKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZpOKoGgZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si4862108ejm.684.2020.07.02.04.25.49; Thu, 02 Jul 2020 04:25:49 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=ZpOKoGgZ; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1728738AbgGBLZq (ORCPT + 9 others); Thu, 2 Jul 2020 07:25:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728707AbgGBLZn (ORCPT ); Thu, 2 Jul 2020 07:25:43 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9FEC08C5C1 for ; Thu, 2 Jul 2020 04:25:43 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id t4so10693877iln.1 for ; Thu, 02 Jul 2020 04:25:43 -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=kp2cMksA2bKPwFtLgY/MdRQdPPtTBA5vqesfT2+0hjc=; b=ZpOKoGgZlAuRQs5w7DsHYa62CW16hmQWM1HcZzK51k7rMZJhv1MF74+eKeB3DU2pg1 NI63CGILl/2WsASLDtzkHVaA8SZTgeodbnefw5lVLFDFXAgqNbEgoo80GPd4m+e3isKS /jxYBRTrYTVzHBkm+nNNQy0nymA69OgsbmEfoGuN6KhUp/at28+S+Idug6ETvajRv1JI 227hCdaggbcuw5getFtTppHvKwaiVfji5Vjm3218MNLEaat/ArxfEgZTWcjgsIEutyhQ MsuH6ki5461HFzUqhcTYzDZ0T4gDlF+Bqxfa6F48UMJVynAO0RLa0v67UJwWL9D5iVDa tj+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kp2cMksA2bKPwFtLgY/MdRQdPPtTBA5vqesfT2+0hjc=; b=A5Cq8wyDELvhBIstYyhj24bvb4tmrzwbket92FHb/81L6K5WKxl2vohfvSlkh0zdid HihiQoQiu9LntBOkhJckruYlI3cmfyZRPgLSCmkGbk1DBwu0OAo1hidmvbUqAtyhnC95 lVS0rbzJXqC0OKvP76O2RSbiSiMinu0/32z9dxlC6JN7DGvHQASqdBD29M83fLHpIakd Q+4vh9QAc0DWUDXm0RjOUXNaGqa+SJGF2xzq1al5mKxsYIGnPXnaDmSHQj8qqwdFwH7a H9t3ucQlSizXH4Ee07eDkeVYCMEbmog/vms1N8Ydg/1RXpuGpcLNhOaoQo5F08/pk805 qTJQ== X-Gm-Message-State: AOAM532+98qHcEe4fRvZkaWeNThdl/QZUVLOE03e5+sIGw6l0c4YWmyl dDFdQVg4OwKRO8Z5kwgrMiKVUA== X-Received: by 2002:a92:c087:: with SMTP id h7mr11803456ile.279.1593689142638; Thu, 02 Jul 2020 04:25:42 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id c3sm4692842ilj.31.2020.07.02.04.25.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 04:25:42 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/4] net: ipa: move version test inside ipa_endpoint_program_delay() Date: Thu, 2 Jul 2020 06:25:34 -0500 Message-Id: <20200702112537.347994-2-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702112537.347994-1-elder@linaro.org> References: <20200702112537.347994-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPA version 4.2 has a hardware quirk that affects endpoint delay mode, so it isn't used there. Isolate the test that avoids using delay mode for that version inside ipa_endpoint_program_delay(), rather than making that check in the caller. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index a7b5a6407e8f..7f4bea18bd02 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -318,7 +318,9 @@ ipa_endpoint_program_delay(struct ipa_endpoint *endpoint, bool enable) { /* assert(endpoint->toward_ipa); */ - (void)ipa_endpoint_init_ctrl(endpoint, enable); + /* Delay mode doesn't work properly for IPA v4.2 */ + if (endpoint->ipa->version != IPA_VERSION_4_2) + (void)ipa_endpoint_init_ctrl(endpoint, enable); } /* Returns previous suspend state (true means it was enabled) */ @@ -1294,8 +1296,7 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) static void ipa_endpoint_program(struct ipa_endpoint *endpoint) { if (endpoint->toward_ipa) { - if (endpoint->ipa->version != IPA_VERSION_4_2) - ipa_endpoint_program_delay(endpoint, false); + ipa_endpoint_program_delay(endpoint, false); ipa_endpoint_init_hdr_ext(endpoint); ipa_endpoint_init_aggr(endpoint); ipa_endpoint_init_deaggr(endpoint); From patchwork Thu Jul 2 11:25:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192220 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1349117ilg; Thu, 2 Jul 2020 04:26:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMeE0Nru+lo9CjkKPOxoAJbCRA7dhKbdvbSxkYdjf/5ZJ7kEJmt+u9KMkbZRLl9hr6bJ+G X-Received: by 2002:a17:906:8316:: with SMTP id j22mr26447275ejx.97.1593689165020; Thu, 02 Jul 2020 04:26:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593689165; cv=none; d=google.com; s=arc-20160816; b=XrcPn7yCvmGdgogDvnCFzWwqLovoecONPqdKuTD7HhlyvnnAVzvOzki5yAWssJfmgm R/rXYPz7D1DPASEhP6qKr1DFLiVnUgBfsaaXSkRjzd5TYbv7GC9xcZRlp+inQW1eNW/U DxT+wQQDLblNS297JklDEkztQubJiXnjZ9xWup9gPrCU+nIvraZH/+6Qpki4+zkBAM0P 3dSGIWna8Rp3CUCjrJPbd48n/rW3WcqVdb75o7rPU8FSjiTb8MAXVAaSEY4ipvf5UPiv hpnSS/Obot3ttb7MkNbMTeR/iZpGStrY5X7FLOxhA34slQZuM3raT8tEVYnxV20/lvNM fP/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YLxlyC8xC2oohqQ3SQ/sJ9I/B5ThQ+eLGnUYm9WmZtk=; b=Qe/ieP9yo9fREUiw20MLOLnaraG7oBzDA9uqZG8PWPClembi+fq2Q9gf7RDmljp7oz AHP94HeKcGlGZDZZJxyuEDNdq6QDWoudYpTneIUVFgK0a5N9iKrOW0BfrEV/jkrAvqB5 dzy25aEsl0f4n3fHwR0ZhK+7IjT2w6QrK7dBZ7vxqQCNdfyUIpbTo1KPbY0ridRztX2J 2FyzvNKOehpSu2lLADzUMuDGCvigAdhi0oCTTgDAeZhxs45y6VnsAMQIHFXYDQ15CUwQ PjU20XF7RW5jFH4grOm6h6FVlsfj6pBmruZ1Q99IAO9/TVAtNUPB9JE3HHhzmqW5z6uX imbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TYz0Jvut; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si5408625ejq.119.2020.07.02.04.26.04; Thu, 02 Jul 2020 04:26:05 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=TYz0Jvut; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1728799AbgGBL0D (ORCPT + 9 others); Thu, 2 Jul 2020 07:26:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728071AbgGBLZo (ORCPT ); Thu, 2 Jul 2020 07:25:44 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61F0DC08C5C1 for ; Thu, 2 Jul 2020 04:25:44 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id k23so28412891iom.10 for ; Thu, 02 Jul 2020 04:25:44 -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=YLxlyC8xC2oohqQ3SQ/sJ9I/B5ThQ+eLGnUYm9WmZtk=; b=TYz0Jvutqptt2OJP3sa1jjDjKiNUvQZ7mxjNSqSwKzJG+Jxedzq1Xa652kPmD4t8Z+ 7mGzyY9KHnT/c4udkOl6SYTpASBxb+OtMG9CUf1bb8Z1leaRPGxwj5XnS3Dz0E3mXX1n U0U/7CnTyaaAxtohmq/XVwNuvJ8lDszu/kV5JGe4gK9OKTkzPtrpwXpkdhq+6URq60Ce 8TyjK1IQT4RornDjJu+2uPttWRudqccVmQRS2J37rFmjPYArXdt6s6GhFApJR/2R8OTh rhWpsJknpKWMP4yQ00+DpLDmoIJUkDe0mVMrQkyDJwUO3Hn1dJBOEnexF5IjJgoWYjD9 LUOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YLxlyC8xC2oohqQ3SQ/sJ9I/B5ThQ+eLGnUYm9WmZtk=; b=DKWHjQmWERAO5WIfMBQksL3h51+R9nLbUFpETMCypVdP4sqzlOE+8ZRO8R0fQCCYrK o8uG8TiSasiU0eh01Vv4BBaXiEcPK9Uiyt+eiadcpYSyIIeIP/3jgS+GUW5EEkHhYnim +zvxxv/3HftCNRZlrwF/ajyHk/WEK1qVgnN/bR3yM19iD+JOqkg2cm3Zk3FHDsVxr7Hj NB3YfMtvER8PrcFNRodRL38z83tJ3Y+TdLP7mfrl1XXDzaf/ch2bY/FzhvgyGFFDelkc RbpRELKZsAePR0gfYkJAZyq4hTWuYieBvo4HQiE8WxKjIMg9inXmtVcXR6NjLX2lrv8z ib4A== X-Gm-Message-State: AOAM530lqqjA84j98JP9mOptxQRlwjNNwM6Zg0MNoq86S5rZRI7NuiOv CqvPK5f+9Y9D+2bQQ8UXP3wqCQ== X-Received: by 2002:a02:b0d5:: with SMTP id w21mr21206761jah.27.1593689143741; Thu, 02 Jul 2020 04:25:43 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id c3sm4692842ilj.31.2020.07.02.04.25.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 04:25:43 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/4] net: ipa: always handle suspend workaround Date: Thu, 2 Jul 2020 06:25:35 -0500 Message-Id: <20200702112537.347994-3-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702112537.347994-1-elder@linaro.org> References: <20200702112537.347994-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPA version 3.5.1 has a hardware quirk that requires special handling if an RX endpoint is suspended while aggregation is active. This handling is implemented by ipa_endpoint_suspend_aggr(). Have ipa_endpoint_program_suspend() be responsible for calling ipa_endpoint_suspend_aggr() if suspend mode is being enabled on an endpoint. If the endpoint does not support aggregation, or if aggregation isn't active, this call will continue to have no effect. Move the definition of ipa_endpoint_suspend_aggr() up in the file so its definition precedes the new earlier reference to it. This requires ipa_endpoint_aggr_active() and ipa_endpoint_force_close() to be moved as well. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 125 +++++++++++++++++---------------- 1 file changed, 63 insertions(+), 62 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index 7f4bea18bd02..d6ef5b8647bf 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -323,13 +323,73 @@ ipa_endpoint_program_delay(struct ipa_endpoint *endpoint, bool enable) (void)ipa_endpoint_init_ctrl(endpoint, enable); } -/* Returns previous suspend state (true means it was enabled) */ +static bool ipa_endpoint_aggr_active(struct ipa_endpoint *endpoint) +{ + u32 mask = BIT(endpoint->endpoint_id); + struct ipa *ipa = endpoint->ipa; + u32 offset; + u32 val; + + /* assert(mask & ipa->available); */ + offset = ipa_reg_state_aggr_active_offset(ipa->version); + val = ioread32(ipa->reg_virt + offset); + + return !!(val & mask); +} + +static void ipa_endpoint_force_close(struct ipa_endpoint *endpoint) +{ + u32 mask = BIT(endpoint->endpoint_id); + struct ipa *ipa = endpoint->ipa; + + /* assert(mask & ipa->available); */ + iowrite32(mask, ipa->reg_virt + IPA_REG_AGGR_FORCE_CLOSE_OFFSET); +} + +/** + * ipa_endpoint_suspend_aggr() - Emulate suspend interrupt + * @endpoint_id: Endpoint on which to emulate a suspend + * + * Emulate suspend IPA interrupt to unsuspend an endpoint suspended + * with an open aggregation frame. This is to work around a hardware + * issue in IPA version 3.5.1 where the suspend interrupt will not be + * generated when it should be. + */ +static void ipa_endpoint_suspend_aggr(struct ipa_endpoint *endpoint) +{ + struct ipa *ipa = endpoint->ipa; + + if (!endpoint->data->aggregation) + return; + + /* Nothing to do if the endpoint doesn't have aggregation open */ + if (!ipa_endpoint_aggr_active(endpoint)) + return; + + /* Force close aggregation */ + ipa_endpoint_force_close(endpoint); + + ipa_interrupt_simulate_suspend(ipa->interrupt); +} + +/* Returns previous suspend state (true means suspend was enabled) */ static bool ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable) { + bool suspended; + /* assert(!endpoint->toward_ipa); */ - return ipa_endpoint_init_ctrl(endpoint, enable); + suspended = ipa_endpoint_init_ctrl(endpoint, enable); + + /* A client suspended with an open aggregation frame will not + * generate a SUSPEND IPA interrupt. If enabling suspend, have + * ipa_endpoint_suspend_aggr() handle this. + */ + if (enable && !suspended) + ipa_endpoint_suspend_aggr(endpoint); + + return suspended; } /* Enable or disable delay or suspend mode on all modem endpoints */ @@ -1144,29 +1204,6 @@ void ipa_endpoint_default_route_clear(struct ipa *ipa) ipa_endpoint_default_route_set(ipa, 0); } -static bool ipa_endpoint_aggr_active(struct ipa_endpoint *endpoint) -{ - u32 mask = BIT(endpoint->endpoint_id); - struct ipa *ipa = endpoint->ipa; - u32 offset; - u32 val; - - /* assert(mask & ipa->available); */ - offset = ipa_reg_state_aggr_active_offset(ipa->version); - val = ioread32(ipa->reg_virt + offset); - - return !!(val & mask); -} - -static void ipa_endpoint_force_close(struct ipa_endpoint *endpoint) -{ - u32 mask = BIT(endpoint->endpoint_id); - struct ipa *ipa = endpoint->ipa; - - /* assert(mask & ipa->available); */ - iowrite32(mask, ipa->reg_virt + IPA_REG_AGGR_FORCE_CLOSE_OFFSET); -} - /** * ipa_endpoint_reset_rx_aggr() - Reset RX endpoint with aggregation active * @endpoint: Endpoint to be reset @@ -1366,34 +1403,6 @@ void ipa_endpoint_disable_one(struct ipa_endpoint *endpoint) endpoint->endpoint_id); } -/** - * ipa_endpoint_suspend_aggr() - Emulate suspend interrupt - * @endpoint_id: Endpoint on which to emulate a suspend - * - * Emulate suspend IPA interrupt to unsuspend an endpoint suspended - * with an open aggregation frame. This is to work around a hardware - * issue in IPA version 3.5.1 where the suspend interrupt will not be - * generated when it should be. - */ -static void ipa_endpoint_suspend_aggr(struct ipa_endpoint *endpoint) -{ - struct ipa *ipa = endpoint->ipa; - - /* assert(ipa->version == IPA_VERSION_3_5_1); */ - - if (!endpoint->data->aggregation) - return; - - /* Nothing to do if the endpoint doesn't have aggregation open */ - if (!ipa_endpoint_aggr_active(endpoint)) - return; - - /* Force close aggregation */ - ipa_endpoint_force_close(endpoint); - - ipa_interrupt_simulate_suspend(ipa->interrupt); -} - void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) { struct device *dev = &endpoint->ipa->pdev->dev; @@ -1409,16 +1418,8 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) /* IPA v3.5.1 doesn't use channel stop for suspend */ stop_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; - if (!endpoint->toward_ipa && !stop_channel) { - /* Due to a hardware bug, a client suspended with an open - * aggregation frame will not generate a SUSPEND IPA - * interrupt. We work around this by force-closing the - * aggregation frame, then simulating the arrival of such - * an interrupt. - */ + if (!endpoint->toward_ipa && !stop_channel) (void)ipa_endpoint_program_suspend(endpoint, true); - ipa_endpoint_suspend_aggr(endpoint); - } ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel); if (ret) From patchwork Thu Jul 2 11:25:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192219 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1349041ilg; Thu, 2 Jul 2020 04:25:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycYjXwxDTjc2uMDKOVLApHaLCgYDOEoubg0bU/ybQ7FI3IKgwk+0nA7BfJnho0y+FdwF8v X-Received: by 2002:a17:906:c18d:: with SMTP id g13mr24494901ejz.239.1593689159570; Thu, 02 Jul 2020 04:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593689159; cv=none; d=google.com; s=arc-20160816; b=pc9htGGBHaagAFG25f1PppEFhk0v9b4CALz2H4sKOvawLLN4zNLea+u5+gKJrQ++yk nGY8ZgVc5akxtSSkdav0GuCPyTjvnoyvy/hbVtbuBJHZTOPShvmn284sUYRZrSgOtSJ/ FXhtG1C8kRwTU9UvZ0PRMpEim9WHVNT4bXYnNUxvQK49cmnqJuonMPtCwAXnJKVJekNS lW+hd/a+zkXygYvbKo2Rv+TjA3QKhUp8reDiEv9dVxo3942SlFeOOCDTal+l2xs7cYLB L+f904FmcGp/1sfXiJDxxlPerjF4FGutIbKG7CQmcw7egobEB0AzGJHAsqrf3eD6nvIn hzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rR58cBjanAUUwIaKuqJhjnKAVxmgw030sKlpPy2ZOVM=; b=oNaqQfus/Vy6N1GVOM7Q6H5c6EEicKCG5r7i+5OwDXYz9f5YSD3RX+KEHBrwkz4vgQ GJOAzPSvDq9EDhlhiCxja9KJ9JCKWI1uaczWHjwpDme1h4ffBf+LEgiVTwSF8kfLanFm wWIowZdk344k2igTmarAzUafWx4OnQDq/xRuFoo1zd8sTcG7VN4FXcdgAhAfNz/sZu0j AUoaMX2PPsCzSwEKEJvFk7cZx+zzlpUNWnwKnCpvl8n94hzyJG56RXEozrkalKKGLNOv diOPcTWUH566cA7bCCVsWza92tSoAJEZVqJP4JeT8xkRzgQiRB7uqV273be8I7zR3OtQ Gp5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dJdvXMMg; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l15si5408625ejq.119.2020.07.02.04.25.59; Thu, 02 Jul 2020 04:25:59 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=dJdvXMMg; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1728778AbgGBLZ4 (ORCPT + 9 others); Thu, 2 Jul 2020 07:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728732AbgGBLZp (ORCPT ); Thu, 2 Jul 2020 07:25:45 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ED72C08C5DC for ; Thu, 2 Jul 2020 04:25:45 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id a11so15622270ilk.0 for ; Thu, 02 Jul 2020 04:25:45 -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=rR58cBjanAUUwIaKuqJhjnKAVxmgw030sKlpPy2ZOVM=; b=dJdvXMMgpr8N4bUkWkmdBpT4XYQBJE+U6C0mgHD7bH0wNCQLXscuLv490ZHRWkOL/n sgyf9bMWAYV8RoF4fb1su+z7+g80GGo9BuGGWgO43WS+7Ol3Q9ffmMEUxb9F0xslVcS4 gQXeJS+SibKI+4p/h4LWXX1J1DhkqozTBXqu6NKVdoUvjRzg5mb7TicBkUiZl7+uaTYX Q98K0ViIPRPisdBzOTzxPUH9+b0rSaSpEjyIlN6ssnJ5vKobDk3QistVneJhbcjMH6UT gg3UoQ5rL5yWCE51BQV1VYmKJg6DeyqSIsN+D25zm0nDST+oMO/6GUBBQU0T0rLvwBTO T/sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rR58cBjanAUUwIaKuqJhjnKAVxmgw030sKlpPy2ZOVM=; b=Ts/iXOYtreiP0KvNGNQJrebdGJuhRaX90jSbKltzlLtH0K8dO8uXmpL2rJwm479U0e 7h6p8hTZxCtZeaXCzqxwdTC3mCGTSlOF1z0jXMXjcw3hvAkIVWoHFzdBPnislX3nhw+h Xwe2Knmg8vKQ4RMh6tLX7g++8iTOCQYSbTKgc2d/iowrhULNUWw8L5KtlQW4ykjvxq2q f+cux2kRXX9DoHKQhXAVnmR6oeTqKhdyQ53P/sbxm64YElcGEFzF9JSee9GmTLQu0xyI MWQkXpXS3wHV7ZuQxMCrlr8JqemjhhiO8P6m9U8HhkOHC6VyAYX7P/GM3C7G6HSwHARY puqg== X-Gm-Message-State: AOAM530pe5j5mzQs+luLYRUUSEWYwur0cetQh0XAvM6+hVtubDa15Q/N /r+dbR3jYEIDlLJRGSDttxNHMQ== X-Received: by 2002:a92:91c2:: with SMTP id e63mr11612997ill.64.1593689144910; Thu, 02 Jul 2020 04:25:44 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id c3sm4692842ilj.31.2020.07.02.04.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 04:25:44 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/4] net: ipa: move version test inside ipa_endpoint_program_suspend() Date: Thu, 2 Jul 2020 06:25:36 -0500 Message-Id: <20200702112537.347994-4-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702112537.347994-1-elder@linaro.org> References: <20200702112537.347994-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPA version 4.0+ does not support endpoint suspend. Put a test at the top of ipa_endpoint_program_suspend() that returns immediately if suspend is not supported rather than making that check in the caller. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index d6ef5b8647bf..df4202794e69 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -378,6 +378,9 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable) { bool suspended; + if (endpoint->ipa->version != IPA_VERSION_3_5_1) + return enable; /* For IPA v4.0+, no change made */ + /* assert(!endpoint->toward_ipa); */ suspended = ipa_endpoint_init_ctrl(endpoint, enable); @@ -395,26 +398,22 @@ ipa_endpoint_program_suspend(struct ipa_endpoint *endpoint, bool enable) /* Enable or disable delay or suspend mode on all modem endpoints */ void ipa_endpoint_modem_pause_all(struct ipa *ipa, bool enable) { - bool support_suspend; u32 endpoint_id; /* DELAY mode doesn't work correctly on IPA v4.2 */ if (ipa->version == IPA_VERSION_4_2) return; - /* Only IPA v3.5.1 supports SUSPEND mode on RX endpoints */ - support_suspend = ipa->version == IPA_VERSION_3_5_1; - for (endpoint_id = 0; endpoint_id < IPA_ENDPOINT_MAX; endpoint_id++) { struct ipa_endpoint *endpoint = &ipa->endpoint[endpoint_id]; if (endpoint->ee_id != GSI_EE_MODEM) continue; - /* Set TX delay mode, or for IPA v3.5.1 RX suspend mode */ + /* Set TX delay mode or RX suspend mode */ if (endpoint->toward_ipa) ipa_endpoint_program_delay(endpoint, enable); - else if (support_suspend) + else (void)ipa_endpoint_program_suspend(endpoint, enable); } } @@ -1248,8 +1247,7 @@ static int ipa_endpoint_reset_rx_aggr(struct ipa_endpoint *endpoint) gsi_channel_reset(gsi, endpoint->channel_id, false); /* Make sure the channel isn't suspended */ - if (endpoint->ipa->version == IPA_VERSION_3_5_1) - suspended = ipa_endpoint_program_suspend(endpoint, false); + suspended = ipa_endpoint_program_suspend(endpoint, false); /* Start channel and do a 1 byte read */ ret = gsi_channel_start(gsi, endpoint->channel_id); @@ -1340,8 +1338,7 @@ static void ipa_endpoint_program(struct ipa_endpoint *endpoint) ipa_endpoint_init_seq(endpoint); ipa_endpoint_init_mode(endpoint); } else { - if (endpoint->ipa->version == IPA_VERSION_3_5_1) - (void)ipa_endpoint_program_suspend(endpoint, false); + (void)ipa_endpoint_program_suspend(endpoint, false); ipa_endpoint_init_hdr_ext(endpoint); ipa_endpoint_init_aggr(endpoint); ipa_endpoint_init_hdr_metadata_mask(endpoint); @@ -1416,11 +1413,11 @@ void ipa_endpoint_suspend_one(struct ipa_endpoint *endpoint) if (!endpoint->toward_ipa) ipa_endpoint_replenish_disable(endpoint); + if (!endpoint->toward_ipa) + (void)ipa_endpoint_program_suspend(endpoint, true); + /* IPA v3.5.1 doesn't use channel stop for suspend */ stop_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; - if (!endpoint->toward_ipa && !stop_channel) - (void)ipa_endpoint_program_suspend(endpoint, true); - ret = gsi_channel_suspend(gsi, endpoint->channel_id, stop_channel); if (ret) dev_err(dev, "error %d suspending channel %u\n", ret, @@ -1437,11 +1434,11 @@ void ipa_endpoint_resume_one(struct ipa_endpoint *endpoint) if (!(endpoint->ipa->enabled & BIT(endpoint->endpoint_id))) return; + if (!endpoint->toward_ipa) + (void)ipa_endpoint_program_suspend(endpoint, false); + /* IPA v3.5.1 doesn't use channel start for resume */ start_channel = endpoint->ipa->version != IPA_VERSION_3_5_1; - if (!endpoint->toward_ipa && !start_channel) - (void)ipa_endpoint_program_suspend(endpoint, false); - ret = gsi_channel_resume(gsi, endpoint->channel_id, start_channel); if (ret) dev_err(dev, "error %d resuming channel %u\n", ret, From patchwork Thu Jul 2 11:25:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 192218 Delivered-To: patch@linaro.org Received: by 2002:a92:d244:0:0:0:0:0 with SMTP id v4csp1348937ilg; Thu, 2 Jul 2020 04:25:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLtHDojDOckJ5QtjY6WQDhi8uYnrDVtYS41FWYYiAqi5sGezPyutrwowJFmEP1FqjpxQ90 X-Received: by 2002:a50:d9cb:: with SMTP id x11mr32719605edj.93.1593689150754; Thu, 02 Jul 2020 04:25:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593689150; cv=none; d=google.com; s=arc-20160816; b=WqnaUPw2GypVMq2r3ARRhznpOpyouX2o98FAyycHQwrSzn2qqHMDmLAWBGKcCxF0VC J1H3kRsHC8rSqPKlGhxgP1AfLULeFFW9skcJlv32aArQg1Uqbp/MURVPEVb7U8GHyFoW XrHeHIpP/Qu0cj8XmMwqpIhxDz3eabMvYQJZ6/O4EF7XuQV46+ShzfgxJAD6YVzEoa8U km3WhHD7LLNcTfVmhE+tAN0r9ovAVZ6xQFVfpbmxsICKghu0b0HDgyNTugncbMcPDHPs sKj86xvcJ+9VJcXSjHj3TGYu/myshc6ETP2b3mR8dEhbrWbnTckLbs8+s7+JtsOrRBDg i/VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YkfiTq5tt8RJ4gOurpcHW32dq+36I8L6RxM8zDS/4AA=; b=aFtL8eCwuB8UGwOCjD4JvLSOIJnHJDeVrYW0IKiADp2PNH6V1xILcQ+1bONZAWF4iD uMhUaCNWU9aRHWMZL4dKKv3sQzYM7v7V9l6pHc9ieXeJRMVfob9W506vgG+mlQbiQpeF IPwKtWnAc5nOFP7osvzqtgmHIYbyoJEPAzm0CaLZRkYHXr6UCIiQoaKupnk6LysIjxhF fkA6V2wHTxUbJkdeXlHrKEO3OZbX8bIPzZJ8RcWBLgTS14Qme5TC+xctcWCd33zJ5o1w T/byuB9WN/7037kGUX9nMvCED0i0V0H+29kJ3JRYIwM0GF5XAf0WRJHPMzxCQJj8F+Rx RHEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UzH8Yakn; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d18si4862108ejm.684.2020.07.02.04.25.50; Thu, 02 Jul 2020 04:25:50 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-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=@linaro.org header.s=google header.b=UzH8Yakn; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-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 S1728755AbgGBLZt (ORCPT + 9 others); Thu, 2 Jul 2020 07:25:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728742AbgGBLZr (ORCPT ); Thu, 2 Jul 2020 07:25:47 -0400 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBC7DC08C5DC for ; Thu, 2 Jul 2020 04:25:46 -0700 (PDT) Received: by mail-il1-x143.google.com with SMTP id x9so23902476ila.3 for ; Thu, 02 Jul 2020 04:25:46 -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=YkfiTq5tt8RJ4gOurpcHW32dq+36I8L6RxM8zDS/4AA=; b=UzH8YakneCqJqH1tFEOb2nj8+dJfVaj/zytEeJIHQQDXQbYDW3bCHjw2PAtD4h3L9M LXUGkchUf/yeia6QdS1K6Mw7QQYf2JsjLsZDKBklfHly5URrJqv6kyo5729z9gdsW5H2 rmEzs2Ya3x239k5lsrHh6JbNsP97MgxaJeuQan0teDhJRh7yCQulMwB/k4nvaP3GT7/d ffsBVP4QZPA/okRwXBJCaRAXsDSzp35vPWKzHFFFPs9omWP1jFVw1fyIvJ+D+LY/VHTA rG1CtSd2M4cU/DlMv5z4KDLHPifKY7onXgD8eebB3O4lMJ7TRalXNVgyXqqbG0ktZYo0 RDVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YkfiTq5tt8RJ4gOurpcHW32dq+36I8L6RxM8zDS/4AA=; b=uYl6Bypz9fniilfsinGQ5pMaqnEmEVRVu+pZaQ6gvqoxKxboDck6knnz8DsZ7ErZEX voCKX/M4urCfcBS/Y0pY+vVDWu0oWM3/Nba487Crer4F2Qm0iNb3qyJ8505DwiABH7yi pZw7vO2xtgRcOBeu/xKwDNpzhYONkJy3kpOpL1PT84fGuJ0uZhFP0n2n+s6yQgSjm/Ll tS0mq/XBmWDbm9BLflOs05qzqS1oB8zNVChORFM7iN55tA1f0WSypsGU9Au9OxsGX6t3 KZJEj2sRBD8f5nN5voWcuWMM+2tk8yBDcKmwacUwxovnl/KOk5jMmPzmVdic5jwbyqLF I7uw== X-Gm-Message-State: AOAM532f03xngE1I15Bd/ch5mw1zq9q/3W1zHzKBSgHw6ATzY6CIbfOJ k6ol1E+VY+J81ql8FTnXzsYT8w== X-Received: by 2002:a05:6e02:6cf:: with SMTP id p15mr12241242ils.206.1593689146157; Thu, 02 Jul 2020 04:25:46 -0700 (PDT) Received: from presto.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id c3sm4692842ilj.31.2020.07.02.04.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jul 2020 04:25:45 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/4] net: ipa: simplify ipa_endpoint_program() Date: Thu, 2 Jul 2020 06:25:37 -0500 Message-Id: <20200702112537.347994-5-elder@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702112537.347994-1-elder@linaro.org> References: <20200702112537.347994-1-elder@linaro.org> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Have functions that write endpoint configuration registers return immediately if they are not valid for the direction of transfer for the endpoint. This allows most of the calls in ipa_endpoint_program() to be made unconditionally. Reorder the register writes to match the order of their definition (based on offset). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_endpoint.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) -- 2.25.1 diff --git a/drivers/net/ipa/ipa_endpoint.c b/drivers/net/ipa/ipa_endpoint.c index df4202794e69..99115a2a29ae 100644 --- a/drivers/net/ipa/ipa_endpoint.c +++ b/drivers/net/ipa/ipa_endpoint.c @@ -588,6 +588,9 @@ static void ipa_endpoint_init_hdr_metadata_mask(struct ipa_endpoint *endpoint) u32 val = 0; u32 offset; + if (endpoint->toward_ipa) + return; /* Register not valid for TX endpoints */ + offset = IPA_REG_ENDP_INIT_HDR_METADATA_MASK_N_OFFSET(endpoint_id); /* Note that HDR_ENDIANNESS indicates big endian header fields */ @@ -602,6 +605,9 @@ static void ipa_endpoint_init_mode(struct ipa_endpoint *endpoint) u32 offset = IPA_REG_ENDP_INIT_MODE_N_OFFSET(endpoint->endpoint_id); u32 val; + if (!endpoint->toward_ipa) + return; /* Register not valid for RX endpoints */ + if (endpoint->data->dma_mode) { enum ipa_endpoint_name name = endpoint->data->dma_endpoint; u32 dma_endpoint_id; @@ -760,6 +766,9 @@ static void ipa_endpoint_init_deaggr(struct ipa_endpoint *endpoint) u32 offset = IPA_REG_ENDP_INIT_DEAGGR_N_OFFSET(endpoint->endpoint_id); u32 val = 0; + if (!endpoint->toward_ipa) + return; /* Register not valid for RX endpoints */ + /* DEAGGR_HDR_LEN is 0 */ /* PACKET_OFFSET_VALID is 0 */ /* PACKET_OFFSET_LOCATION is ignored (not valid) */ @@ -774,6 +783,9 @@ static void ipa_endpoint_init_seq(struct ipa_endpoint *endpoint) u32 seq_type = endpoint->seq_type; u32 val = 0; + if (!endpoint->toward_ipa) + return; /* Register not valid for RX endpoints */ + /* Sequencer type is made up of four nibbles */ val |= u32_encode_bits(seq_type & 0xf, HPS_SEQ_TYPE_FMASK); val |= u32_encode_bits((seq_type >> 4) & 0xf, DPS_SEQ_TYPE_FMASK); @@ -1330,21 +1342,18 @@ static void ipa_endpoint_reset(struct ipa_endpoint *endpoint) static void ipa_endpoint_program(struct ipa_endpoint *endpoint) { - if (endpoint->toward_ipa) { + if (endpoint->toward_ipa) ipa_endpoint_program_delay(endpoint, false); - ipa_endpoint_init_hdr_ext(endpoint); - ipa_endpoint_init_aggr(endpoint); - ipa_endpoint_init_deaggr(endpoint); - ipa_endpoint_init_seq(endpoint); - ipa_endpoint_init_mode(endpoint); - } else { + else (void)ipa_endpoint_program_suspend(endpoint, false); - ipa_endpoint_init_hdr_ext(endpoint); - ipa_endpoint_init_aggr(endpoint); - ipa_endpoint_init_hdr_metadata_mask(endpoint); - } ipa_endpoint_init_cfg(endpoint); ipa_endpoint_init_hdr(endpoint); + ipa_endpoint_init_hdr_ext(endpoint); + ipa_endpoint_init_hdr_metadata_mask(endpoint); + ipa_endpoint_init_mode(endpoint); + ipa_endpoint_init_aggr(endpoint); + ipa_endpoint_init_deaggr(endpoint); + ipa_endpoint_init_seq(endpoint); ipa_endpoint_status(endpoint); }