From patchwork Mon Jul 26 20:11:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 485863 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4140783jao; Mon, 26 Jul 2021 13:12:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzd1EtgZAiWfMy0uS3lx7RUFoVe0579S+FUltxJXVKSEHNqkyWbi9Rz/Kvq2xSAFFToEkHJ X-Received: by 2002:a5e:8619:: with SMTP id z25mr16165704ioj.13.1627330321218; Mon, 26 Jul 2021 13:12:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627330321; cv=none; d=google.com; s=arc-20160816; b=N/9atPqYfStkA+agZT4o4k8YwU2wvF074ywyC6SUX6niLtsAfcjOPODOAnmep+OFqg dt/ef+wfV8vCXn9XkGAogpWjtjTXvcaq+EXkTbyBF7EVcnDk4XG31FLhLYqYdy96ettl qJdykEF86odgLpffAVoy+R/SjWMjCdQi+sgnsmpTN1ppw0OHUGBfrxNKovpqKyxmQzWs cLmTHUawNXwoTCK8zIeh8nWJUchduen29gQVWE4gOSjXqDNzQi83uHJQUr2Xebod6AwS UeIaFaL2fKiDcJVyBW5pXm6FpKp128Kbgei/jHd0ZAnzADICAz55zJXPplKfG8WBtvhG rpuA== 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=tgL3Uie/Qodtk8KimI/KjJUNL3yMSDvJaxriDsuLyK0=; b=apa5+bQqe12ymnWJMBmHiTy/5NWvjAJ47FqivMQsR+SrSBJvj7xlsPkTRHl/5qF93l 4Gw/Bmyb7XMqknV+3d6qqDLv+YJcv8LK44B5WR++xjQqOyopZhJ93mafrTo1ziXDnWO+ wJm155xB8W1Msm20KJi+zILcnNMVNK4Yim92c3YH082RiAPPSNkvPRfETaRHa5nQtmN3 4+cwQyftwt9tgsQeztnGLPb0+DlJ290+TH+u76YRUtYZp5QgrCoMfizmo1PYNwLwRoRE qesyu8eSpQEOIaVz0EHiIRtBP0eI5eeNeoF42UBJ++tlzEe+UnWLLlWqnarVZQekn2Fa rbPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=cQF7DY0o; 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 y1si863413jao.99.2021.07.26.13.12.01; Mon, 26 Jul 2021 13:12:01 -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=cQF7DY0o; 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 S232816AbhGZTbP (ORCPT + 8 others); Mon, 26 Jul 2021 15:31:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232486AbhGZTbM (ORCPT ); Mon, 26 Jul 2021 15:31:12 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01E0CC061760 for ; Mon, 26 Jul 2021 13:11:41 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id z3so10133012ile.12 for ; Mon, 26 Jul 2021 13:11:40 -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=tgL3Uie/Qodtk8KimI/KjJUNL3yMSDvJaxriDsuLyK0=; b=cQF7DY0oNsgCjN5SXuOfOtTqGXx/ZwRX3G7x0ovIpW16FEMLLNWJRfWv/4qO4IVTBn U0ERKBCaBBN6ddwSJm+U1CqH+eq/IgjAKFH8ji0L9LSisD26l0CfYxEUNeBW7CKdqNxU Ssxd+Jw6wtZcudul6K35cOkw6RAZW6YwNgGDulFHaREEJBqoNshfIUMFPcbfaKhkPT4Q gNB1cQ3HhJABXAkvnKHws3o9PObrgGdcrbRYvVSwACjh5yu0iyhB9p8GdXkGo3ieD2AR TTpBGbEO2B6r/ojJOeZLpoOBikue/d2h/PVzISjSAYXlVfAOj+6uTa7a6s5bF8Uh80/W PRhA== 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=tgL3Uie/Qodtk8KimI/KjJUNL3yMSDvJaxriDsuLyK0=; b=YojzWEvQCzozqZDg61MALbc+6HSqve6NMD2zl/qJllP8khawoOTRTg+FObpHZECsEW MpCOaJU6StB0EI9r2y+CEChyF/isWjZS8xYEdOqZnviLkKnyiIQg024TY6Pp+X2g64J2 E8qoYAO3ckkrkhlZvKuSwwsxsNJBb8M+TyT70R7qPHLJ9hcM2AT2ivtka10jFHThugrg rJnsy7MmkWMbUxWh6Y5L/DKCh6W0h1QI0bTqsb4MzJXaKGGMTElV/EXN4CQCAPX/ohWe GJc+b6eDHGdOuc2IFU00gPjuBpsi/atvCS7SegCG4ylJR7JV6vuhyHMsQLw8zlkNdzdv 5QzA== X-Gm-Message-State: AOAM533hoBBcseW9s3Fonk8Ok8kJAUxeIgOq+CY51ny8FRtPaBLkbrzK FIYgaAzU+J4BFAv+ijYNzvZJcw== X-Received: by 2002:a05:6e02:5ad:: with SMTP id k13mr14042115ils.284.1627330300432; Mon, 26 Jul 2021 13:11:40 -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 z10sm425964iln.8.2021.07.26.13.11.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 13:11:40 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/5] net: ipa: kill ipa_modem_setup() Date: Mon, 26 Jul 2021 15:11:32 -0500 Message-Id: <20210726201136.502800-2-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210726201136.502800-1-elder@linaro.org> References: <20210726201136.502800-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The functions ipa_modem_setup() and ipa_modem_teardown() are trivial wrappers that call ipa_qmi_setup() and ipa_qmi_teardown(). Just call the QMI functions directly, and get rid of the wrappers. Improve the documentation of what setting up QMI does. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 4 ++-- drivers/net/ipa/ipa_modem.c | 10 ---------- drivers/net/ipa/ipa_modem.h | 4 ---- drivers/net/ipa/ipa_qmi.c | 6 ++---- drivers/net/ipa/ipa_qmi.h | 19 +++++++++++++++++++ 5 files changed, 23 insertions(+), 20 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 9810c61a03202..91e2ec3a0c133 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -167,7 +167,7 @@ int ipa_setup(struct ipa *ipa) ipa_endpoint_default_route_set(ipa, exception_endpoint->endpoint_id); /* We're all set. Now prepare for communication with the modem */ - ret = ipa_modem_setup(ipa); + ret = ipa_qmi_setup(ipa); if (ret) goto err_default_route_clear; @@ -204,7 +204,7 @@ static void ipa_teardown(struct ipa *ipa) struct ipa_endpoint *exception_endpoint; struct ipa_endpoint *command_endpoint; - ipa_modem_teardown(ipa); + ipa_qmi_teardown(ipa); ipa_endpoint_default_route_clear(ipa); exception_endpoint = ipa->name_map[IPA_ENDPOINT_AP_LAN_RX]; ipa_endpoint_disable_one(exception_endpoint); diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index af9aedbde717a..5cb60e2ea6042 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -377,13 +377,3 @@ void ipa_modem_deconfig(struct ipa *ipa) ipa->notifier = NULL; memset(&ipa->nb, 0, sizeof(ipa->nb)); } - -int ipa_modem_setup(struct ipa *ipa) -{ - return ipa_qmi_setup(ipa); -} - -void ipa_modem_teardown(struct ipa *ipa) -{ - ipa_qmi_teardown(ipa); -} diff --git a/drivers/net/ipa/ipa_modem.h b/drivers/net/ipa/ipa_modem.h index 2de3e216d1d43..5e6e3d234454a 100644 --- a/drivers/net/ipa/ipa_modem.h +++ b/drivers/net/ipa/ipa_modem.h @@ -7,7 +7,6 @@ #define _IPA_MODEM_H_ struct ipa; -struct ipa_endpoint; struct net_device; struct sk_buff; @@ -25,7 +24,4 @@ void ipa_modem_exit(struct ipa *ipa); int ipa_modem_config(struct ipa *ipa); void ipa_modem_deconfig(struct ipa *ipa); -int ipa_modem_setup(struct ipa *ipa); -void ipa_modem_teardown(struct ipa *ipa); - #endif /* _IPA_MODEM_H_ */ diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index 4661105ce7ab2..90f3aec55b365 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -467,10 +467,7 @@ static const struct qmi_ops ipa_client_ops = { .new_server = ipa_client_new_server, }; -/* This is called by ipa_setup(). We can be informed via remoteproc that - * the modem has shut down, in which case this function will be called - * again to prepare for it coming back up again. - */ +/* Set up for QMI message exchange */ int ipa_qmi_setup(struct ipa *ipa) { struct ipa_qmi *ipa_qmi = &ipa->qmi; @@ -526,6 +523,7 @@ int ipa_qmi_setup(struct ipa *ipa) return ret; } +/* Tear down IPA QMI handles */ void ipa_qmi_teardown(struct ipa *ipa) { cancel_work_sync(&ipa->qmi.init_driver_work); diff --git a/drivers/net/ipa/ipa_qmi.h b/drivers/net/ipa/ipa_qmi.h index b6f2055d35a68..856ef629ccc8d 100644 --- a/drivers/net/ipa/ipa_qmi.h +++ b/drivers/net/ipa/ipa_qmi.h @@ -39,7 +39,26 @@ struct ipa_qmi { bool indication_sent; }; +/** + * ipa_qmi_setup() - Set up for QMI message exchange + * @ipa: IPA pointer + * + * This is called at the end of ipa_setup(), to prepare for the exchange + * of QMI messages that perform a "handshake" between the AP and modem. + * When the modem QMI server announces its presence, an AP request message + * supplies operating parameters to be used to the modem, and the modem + * acknowledges receipt of those parameters. The modem will not touch the + * IPA hardware until this handshake is complete. + * + * If the modem crashes (or shuts down) a new handshake begins when the + * modem's QMI server is started again. + */ int ipa_qmi_setup(struct ipa *ipa); + +/** + * ipa_qmi_teardown() - Tear down IPA QMI handles + * @ipa: IPA pointer + */ void ipa_qmi_teardown(struct ipa *ipa); #endif /* !_IPA_QMI_H_ */ From patchwork Mon Jul 26 20:11:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 485859 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4140671jao; Mon, 26 Jul 2021 13:11:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7HjOwTOY6K8WArn46+s3F9uZgVLnO2GAdUGKZhGuvi6UMMWGgNeUBG/Dgjm8MxAOYkcqQ X-Received: by 2002:a05:6638:3048:: with SMTP id u8mr17913618jak.91.1627330310079; Mon, 26 Jul 2021 13:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627330310; cv=none; d=google.com; s=arc-20160816; b=XmEbwv4jtZkAo6kKPX0iZu6Qde8ARyFLEyIX6X3oG2SrHOGP2xp8J6ZyhUYPyqhTn+ vHcpkhzf5SFPv35Lwj3l/160xnx0pzK1VQ3heVOAtxYmXEUO9YsNGqOdfkOS1XKRy4ye nBY14Aioo8/7DMhepfSxg+YyuEzl1RaWuz4YJ6UhI64CzAgovxqIS0DM2AboubQVp3YB o2z2/LuWZ/NMFm2YmRGDXi8qyPWPgSmpzr+rJ0bYMDeWZzD3lVq1MA0k/+gbvvBTSLic GSi+KeIokuuTvtDZSaf+3i+VzKlGglzMyuPvOBKwiq1CqcFGQzug/Qj3Z5x6W2oYTowl RgVw== 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=EcVZ6uLqTzi0vdrkZnez1ZLjp+fPM1xVTEzZ6l8/XNI=; b=u11THK4KavT8WENZnK2aP8EJs/2svK+qi0QxD+A0A9uN/DhvB13pCIb3lJZaEFOJsF Y+iRrQchq+Fm9ETIvg3OI5HgGrdq28l3bM1iYFeojY9QU1Gyc+WglplyGzlMw3XWUx7s H1gBvmzUD5xKadN8qZ4b23IwN8iS7j/uFQUhW9bGSwpXNFm3tKajNNRI2Y2rm27XR3u0 no3FeCtpR50Sv6VmPVU1ZdAcB2e65UGSfLoABidJ82NFt8vBQh4JkU4pfypqRdtJzmBs YhbVOt1HS6yprGjUZFGgayo+u7jBg8oyIIofHqJJ1/i8GLiKWS5YimFEYj1wRv2OrZbF xQJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AxxmeeSi; 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 t5si901893ile.92.2021.07.26.13.11.49; Mon, 26 Jul 2021 13:11: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=AxxmeeSi; 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 S232504AbhGZTbS (ORCPT + 8 others); Mon, 26 Jul 2021 15:31:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232611AbhGZTbN (ORCPT ); Mon, 26 Jul 2021 15:31:13 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C915DC061757 for ; Mon, 26 Jul 2021 13:11:41 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id r18so13489000iot.4 for ; Mon, 26 Jul 2021 13:11:41 -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=EcVZ6uLqTzi0vdrkZnez1ZLjp+fPM1xVTEzZ6l8/XNI=; b=AxxmeeSipjWwNHuPrxNL0tCah1QB5ybdW2X9RExe2+Z8tejjZ3MrFEClHVWyen21Uw uRU7A98eEfnESa/BS91Ict2LBJ0mJC4F8pX/KIID1KZLY2yX4zIacOSl2T0bLACuCBqv vVob5+VFUGmlLuRohhKoqEYo+eA6Rez68jsNyqlMYoLcSAS87NPsdu3O5tzsP3pX6gB7 TZPoyFPvoYiQFXjRBS56rhq/39bKvjuqL4+WaIUFzqRlD0wx+Q8okc86e2vuS6Agz6cw KwDOX6DZLvioR/iwoBRMjBYmQLjuPfkS1cxC63d31OI5oUSArbZCOL2t5J3jAx4BmYU+ 8taA== 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=EcVZ6uLqTzi0vdrkZnez1ZLjp+fPM1xVTEzZ6l8/XNI=; b=adDvAgERcAIdGnQV8HBVlrwmz7V1HfY8qZoHhzpBaNZ319zt/2BdfDUEvZ+VYG5M+o ns+MfVGdkIaMenI9WAC6H0Q6BZk/Q3BlxJTaCRVY2/NQ1muxfQKMeDdJ7us3kxuw1Rml 9cB9tgwSUpI7GJ37OAcUlVTj7w5hzCtnqfmhhYD8wXB9ao52285whs7kA+vnbCehWRpW Fc+bN1WLl4PVdCoUj9E3hVahv6TpDrwtz9kcsJJy7RSibig5aBqIRYAeGjXgJSt4Rw+j yTIfELCq+hbb5ddLlTNy3O9ya0OLf0+c6JFfJXsaDdUhAcdwW7HsYEntVj8mOcmDtaev KCZw== X-Gm-Message-State: AOAM532FugVOnZ8E1kDbKz87R5wj30OzJ9YY1LlLFlNcAqAYZ9eiZFTd yxRgRZzbsAPEiFX1dpFaqeG9LA== X-Received: by 2002:a05:6638:130d:: with SMTP id r13mr18115683jad.103.1627330301265; Mon, 26 Jul 2021 13:11:41 -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 z10sm425964iln.8.2021.07.26.13.11.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 13:11:40 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/5] net: ipa: configure memory regions early Date: Mon, 26 Jul 2021 15:11:33 -0500 Message-Id: <20210726201136.502800-3-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210726201136.502800-1-elder@linaro.org> References: <20210726201136.502800-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org IPA-resident memory is one of the most primitive resources that needs initialization, so call init_mem_config() early in ipa_config(). This is in preparation for initializing the IPA-resident microcontroller earlier. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 91e2ec3a0c133..8768e52854d08 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -471,31 +471,31 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) ipa_hardware_config(ipa, data); - ret = ipa_endpoint_config(ipa); - if (ret) - goto err_hardware_deconfig; - ret = ipa_mem_config(ipa); if (ret) - goto err_endpoint_deconfig; + goto err_hardware_deconfig; + + ret = ipa_endpoint_config(ipa); + if (ret) + goto err_mem_deconfig; ipa_table_config(ipa); /* No deconfig required */ /* Assign resource limitation to each group; no deconfig required */ ret = ipa_resource_config(ipa, data->resource_data); if (ret) - goto err_mem_deconfig; + goto err_endpoint_deconfig; ret = ipa_modem_config(ipa); if (ret) - goto err_mem_deconfig; + goto err_endpoint_deconfig; return 0; -err_mem_deconfig: - ipa_mem_deconfig(ipa); err_endpoint_deconfig: ipa_endpoint_deconfig(ipa); +err_mem_deconfig: + ipa_mem_deconfig(ipa); err_hardware_deconfig: ipa_hardware_deconfig(ipa); ipa_clock_put(ipa); @@ -510,8 +510,8 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) static void ipa_deconfig(struct ipa *ipa) { ipa_modem_deconfig(ipa); - ipa_mem_deconfig(ipa); ipa_endpoint_deconfig(ipa); + ipa_mem_deconfig(ipa); ipa_hardware_deconfig(ipa); ipa_clock_put(ipa); } From patchwork Mon Jul 26 20:11:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 485860 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4140681jao; Mon, 26 Jul 2021 13:11:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzqFkaawts172aVlRcPBxekcEOOQWWM6uBcRlhI5ao7X799wOpLi2fVNaiOFGK3qKGXcUD X-Received: by 2002:a05:6638:1907:: with SMTP id p7mr18250819jal.93.1627330310903; Mon, 26 Jul 2021 13:11:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627330310; cv=none; d=google.com; s=arc-20160816; b=uj7Mn3/16yU/AsbE2NnjzvrNbQzr3/YWgntbNmdaks1bwYTtaPUNdPwiZ3MEBqi44h +XWts5kR9/Qzup2QArF110EZamq/j2Hc/VgPpd5q45Zemuu26APq1VIqwqZADhluRVqT vRmwmNHmnGwmB9PCv1LGB0Lg37XiAeVjtAYduF+OoSCgJSvaloIXqEekYS9eUFd5Y7HV i+ZhbLoyYjxd92GasI9+XBbqCACUhJg8aExRz5vms54fRmTpO3wDWGdY4ul27dv7g0ia VMDywt5oRvTKKXAzcoJVAEW58vUTAKHzsbFOHLHor76gjFApi4hGx6FjJ9iG1gEm2tRG m4fw== 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=70xPSqNfg1+zmAwitXIzdSa5it5L29wIVFAOMsoUpsw=; b=bfwPrz9bqIFMB0eT/zA3Vjwu3WaILnCMewkmKUSu2xweWYJminBMIf3sf3pN74tkXs nL4Q+hd1a2DQbkwZsvaDwDNxEALU9tvooITMdnAhpOFWsWKAC0D96A5kY33RTgckuOM4 zzkURJooOaQa34xrlvmYccb4BPzNtvPGB0tN31bOCMgA02ExCox2xJoJr84DUyXFjioB y/sFIHZ33kTjbNWPZpZQFIgXKzgC0WAimzhY7CpIuxWjVsUE7dbud8vq5QrVJZnEG6Ru ozyjW4qTvhVHj2uxivs6mQxdMQ6PBO1Gcc/UIQO7e4JuS9aFV6PJqCSMWtipOGHpULjD zMsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kmeELVZO; 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 t5si901893ile.92.2021.07.26.13.11.50; Mon, 26 Jul 2021 13:11: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=kmeELVZO; 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 S233081AbhGZTbU (ORCPT + 8 others); Mon, 26 Jul 2021 15:31:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232699AbhGZTbO (ORCPT ); Mon, 26 Jul 2021 15:31:14 -0400 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB577C061760 for ; Mon, 26 Jul 2021 13:11:42 -0700 (PDT) Received: by mail-io1-xd34.google.com with SMTP id y9so13493129iox.2 for ; Mon, 26 Jul 2021 13:11:42 -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=70xPSqNfg1+zmAwitXIzdSa5it5L29wIVFAOMsoUpsw=; b=kmeELVZO1w1FfLVOV0oVQ0Y48DMhb3hXmNIWBBj5AI0X5tEtv632yCXjqcCN+HA7RG mMOzzWca9GME13opR7/E/OZCi2PsVeUm07ISJC6WTCpyfGropvN6FudACSVrnYxR71SY rZUQ2aELTnxvANKFwPF04hEaU3Ye38XI9CrQ1XN7UsIDx226nGcUqPuRcJEROLqEBcWc lQZIp8eNyTY+10dUeVpkU6tuCk0IcbCZ4HTkPcuTZaC4CbuZUiJdZLSnHqCoVI51pOPy QhjuYkNuUJEpPmklbl4mKzEgXzWoZrLxXMv5loeYeF5/KBCyQ6kSZP6sffBTn0rj9yiU WUFg== 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=70xPSqNfg1+zmAwitXIzdSa5it5L29wIVFAOMsoUpsw=; b=DJfa+4SL6tNHU/+ZH7fmsfLKrAWlXUQPdknp/XcT4P51g4JlHo5c2ED6SwPsbA4AKb Pj0JUaHdnc6BqwRf2tp+2uan2rrfv6YduI5wz5nY+sxXP7KFpQtzh9AiUJ1obCGuj256 y9LcPyJH38JyxhHaaoOiWEK7JXxDoOADBuKBYu+ova54FVmi6PbbUb5fkqvuBaKmL8mQ YVPKy3h8SQc401pD4dAH3CWLUApbwBFK4nX6W/ddCy85TiNJNhRiuIXce67SX0XyGLFF PGsvPuJKQVG15UeTYNixn5B/vCHF5IlbWK5486+6uVqSjWjmHupSCAhzq7jiNyfcQs+C 3f/g== X-Gm-Message-State: AOAM531E7f2PXSBV7tKzrNU1NUfRxYcDfxMUlVsufA0DhwnZM7GwmJN1 WyjyHMMDIzNO8NM9nt0hZV8Q5g== X-Received: by 2002:a02:c8d0:: with SMTP id q16mr18184847jao.110.1627330302221; Mon, 26 Jul 2021 13:11: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 z10sm425964iln.8.2021.07.26.13.11.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 13:11:41 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/5] net: ipa: set up IPA interrupts earlier Date: Mon, 26 Jul 2021 15:11:34 -0500 Message-Id: <20210726201136.502800-4-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210726201136.502800-1-elder@linaro.org> References: <20210726201136.502800-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Initialization of the IPA driver has several phases: - "init" phase can be done without any access to IPA hardware - "config" phase requires the IPA hardware to be clocked - "setup" phase requires the GSI layer to be functional Currently, initialization for the IPA interrupt handling code occurs in the setup phase. It requires access to the IPA hardware but does not need GSI, so it can be moved to the config phase instead. Call the interrupt configuration function early in ipa_config() rather than from ipa_setup(). Rename ipa_interrupt_setup() to be ipa_interrupt_config(), and ipa_interrupt_teardown() to be ipa_interupt_deconfig(), so their names properly indicate when they get called. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_interrupt.c | 8 ++++---- drivers/net/ipa/ipa_interrupt.h | 8 ++++---- drivers/net/ipa/ipa_main.c | 24 ++++++++++++++---------- 3 files changed, 22 insertions(+), 18 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_interrupt.c b/drivers/net/ipa/ipa_interrupt.c index c46df0b7c4e50..46a983aeebc8b 100644 --- a/drivers/net/ipa/ipa_interrupt.c +++ b/drivers/net/ipa/ipa_interrupt.c @@ -231,8 +231,8 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq) interrupt->handler[ipa_irq] = NULL; } -/* Set up the IPA interrupt framework */ -struct ipa_interrupt *ipa_interrupt_setup(struct ipa *ipa) +/* Configure the IPA interrupt framework */ +struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa) { struct device *dev = &ipa->pdev->dev; struct ipa_interrupt *interrupt; @@ -281,8 +281,8 @@ struct ipa_interrupt *ipa_interrupt_setup(struct ipa *ipa) return ERR_PTR(ret); } -/* Tear down the IPA interrupt framework */ -void ipa_interrupt_teardown(struct ipa_interrupt *interrupt) +/* Inverse of ipa_interrupt_config() */ +void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt) { struct device *dev = &interrupt->ipa->pdev->dev; int ret; diff --git a/drivers/net/ipa/ipa_interrupt.h b/drivers/net/ipa/ipa_interrupt.h index d5c486a6800d9..231390cea52a2 100644 --- a/drivers/net/ipa/ipa_interrupt.h +++ b/drivers/net/ipa/ipa_interrupt.h @@ -86,17 +86,17 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt); void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); /** - * ipa_interrupt_setup() - Set up the IPA interrupt framework + * ipa_interrupt_config() - Configure the IPA interrupt framework * @ipa: IPA pointer * * Return: Pointer to IPA SMP2P info, or a pointer-coded error */ -struct ipa_interrupt *ipa_interrupt_setup(struct ipa *ipa); +struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa); /** - * ipa_interrupt_teardown() - Tear down the IPA interrupt framework + * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config() * @interrupt: IPA interrupt structure */ -void ipa_interrupt_teardown(struct ipa_interrupt *interrupt); +void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt); #endif /* _IPA_INTERRUPT_H_ */ diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 8768e52854d08..c26acd8b1cb91 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -124,11 +124,6 @@ int ipa_setup(struct ipa *ipa) if (ret) return ret; - ipa->interrupt = ipa_interrupt_setup(ipa); - if (IS_ERR(ipa->interrupt)) { - ret = PTR_ERR(ipa->interrupt); - goto err_gsi_teardown; - } ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, ipa_suspend_handler); @@ -188,8 +183,6 @@ int ipa_setup(struct ipa *ipa) err_uc_teardown: ipa_uc_teardown(ipa); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); - ipa_interrupt_teardown(ipa->interrupt); -err_gsi_teardown: gsi_teardown(&ipa->gsi); return ret; @@ -214,7 +207,6 @@ static void ipa_teardown(struct ipa *ipa) (void)device_init_wakeup(&ipa->pdev->dev, false); ipa_uc_teardown(ipa); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); - ipa_interrupt_teardown(ipa->interrupt); gsi_teardown(&ipa->gsi); } @@ -475,9 +467,16 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) if (ret) goto err_hardware_deconfig; - ret = ipa_endpoint_config(ipa); - if (ret) + ipa->interrupt = ipa_interrupt_config(ipa); + if (IS_ERR(ipa->interrupt)) { + ret = PTR_ERR(ipa->interrupt); + ipa->interrupt = NULL; goto err_mem_deconfig; + } + + ret = ipa_endpoint_config(ipa); + if (ret) + goto err_interrupt_deconfig; ipa_table_config(ipa); /* No deconfig required */ @@ -494,6 +493,9 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) err_endpoint_deconfig: ipa_endpoint_deconfig(ipa); +err_interrupt_deconfig: + ipa_interrupt_deconfig(ipa->interrupt); + ipa->interrupt = NULL; err_mem_deconfig: ipa_mem_deconfig(ipa); err_hardware_deconfig: @@ -511,6 +513,8 @@ static void ipa_deconfig(struct ipa *ipa) { ipa_modem_deconfig(ipa); ipa_endpoint_deconfig(ipa); + ipa_interrupt_deconfig(ipa->interrupt); + ipa->interrupt = NULL; ipa_mem_deconfig(ipa); ipa_hardware_deconfig(ipa); ipa_clock_put(ipa); From patchwork Mon Jul 26 20:11:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 485861 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4140740jao; Mon, 26 Jul 2021 13:11:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi6KwahHMLTUozuVh8PWHU3YBLKs+By5GWYwNOvERtd/Bv/ZdHKM0Ozqv8IyJwlmazH5+b X-Received: by 2002:a92:d790:: with SMTP id d16mr14490321iln.185.1627330317676; Mon, 26 Jul 2021 13:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627330317; cv=none; d=google.com; s=arc-20160816; b=uxqeI3VTb1sHP4ZwZj9VkCzzWUQNq+PBY+btryDa9wyL/vL8Uniy0tRxHFNkUMQycd 4llINladzqv/7YIWW19tQA8ExokQquYd2zhMOfX4uJq26qdd0zUyj8jI2WNfl2D5Vaof eyN6hTa158+KSVblnl3Rmu3odEpv6YsUHzYrijoGtyTxBSihrmNlZQi8NVWesADxEK75 Kg9JEeDYz6RYOPTIou/O4BoFKYIDWg3P7O/nMCagkP4n0u/1hsuPtFck54k4BQmBsbaG R3gbOO/JZSYXZfCMlq49D/BT+/ABxsoDPZR/8YNsAkYJyNF7oKI0ocM9oIfW7tlYmf1I DXhA== 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=CbkpeKrOfcqmDReVdepadZw98qDLwbHdY24550v6RHA=; b=Za0bxAMQ1471ZBe9GB5LgoHefHfnMnFNBCObsrAOl/uTUB80SmSnsTksrg3NwFgssk 3z/9mUhVnueP6hJY7Bsi6fmRh80bjHgz3MFBp5sBfOVcvACpPvMXHCysyTnF54KyA+Cy n44hEMmO0OAdP5c5qqTH68SjDqsNTfpUvXjKRITjCBD80yVhOThrkgqRaboeD6+8BEW3 +MsUkkCUmHhq6CpQWs1JfCea7fy0MKyObR47yHqrjRECJQvxyC8AdXx+XV2LwzwHa8XX nmYgAFAYmXtWJlVHuUUB97ibz3wxf3DDbBK/ghHecQ4RHzVwkRvtd+vWudyvDzSTo6ST dkeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AQPJguyq; 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 y1si863413jao.99.2021.07.26.13.11.57; Mon, 26 Jul 2021 13:11:57 -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=AQPJguyq; 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 S233327AbhGZTbX (ORCPT + 8 others); Mon, 26 Jul 2021 15:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232824AbhGZTbP (ORCPT ); Mon, 26 Jul 2021 15:31:15 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B090FC061764 for ; Mon, 26 Jul 2021 13:11:43 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id y200so13536052iof.1 for ; Mon, 26 Jul 2021 13:11: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=CbkpeKrOfcqmDReVdepadZw98qDLwbHdY24550v6RHA=; b=AQPJguyqnk15W1iKAm7vTy+8YvOzRvF4v3NbIy9lw//R6tq0F2Kdpk+IoriqiFhC3/ WFm9CmoCF7nqbO1cDRXEX9NdDHYiPorqP7I/VQamTaUfEbwLcFBXUVB628bnOr5FWdJU 2gjCVwzRfDBy5b4e/6C5/Yl4cf/Bw/4r2j9tq3ec+O+gmkDZRufEFMipV1n/yioUto6H WJcHqSpf5swMnTb/q06zPQuYfIfb+ddiwOtvA8snSF3cZsIoCcRM0UmHJs8+XDAcyp25 q2XWvIgXc7gMo84uEVSte7cjQ/19IUs8xUVRmkDRASTzlI453mH1IRx7djVmTPueQP9f L78w== 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=CbkpeKrOfcqmDReVdepadZw98qDLwbHdY24550v6RHA=; b=Rasb4yFBwQ048nXL8OWL65R9hGqbo6UiFPG5ps71n+7kiZAZK16fmsoWIqPVe4+pMe mdbJKkdonBMcvXR7AiJcNRBVJvFRJRheHT2dbLf8AmZJGn5lizEAVA2EcOn1O2KEmSdX /raMCOLCKuxkUvVmosluMBA2JeNQOvDyo7pamqJmPAIDnDpBSJoIpIJywfr7Cp/Als4A nvIbHjhyPdVPxf5E/6qakXf043Vz6auYDuADCUh9OYxi8uJYRfoEe7T6qQR46qkDZulU Emiurn8P3Zhf9UfbE4Azhy5zHxOpzjomKwFLrWDbH+8JCsEVh/+rCNF3vL3CdXEpSPmD ZIBQ== X-Gm-Message-State: AOAM530W/PD2hm1+X308THjsZ94v9kLPd641i/LiFUjZ8Dlea5StWEt6 uGeEYDiypl9Lq1x4LmLB4LJmow== X-Received: by 2002:a05:6602:2424:: with SMTP id g4mr16349955iob.189.1627330303103; Mon, 26 Jul 2021 13:11: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 z10sm425964iln.8.2021.07.26.13.11.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 13:11:42 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/5] net: ipa: set up the microcontroller earlier Date: Mon, 26 Jul 2021 15:11:35 -0500 Message-Id: <20210726201136.502800-5-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210726201136.502800-1-elder@linaro.org> References: <20210726201136.502800-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Initializing up the IPA-resident microcontroller requires the IPA clock, and sets up two IPA interrupt handlers, but this does not require GSI access. The interrupt handlers also require the clock to be enabled, and require the IPA memory regions to be configured, but neither requires GSI access. As a result, the microcontroller can be initialized during the "config" rather than "setup" phase of IPA initialization. Initialize the microcontroller in ipa_config() rather than ipa_setup(), and rename the called function ipa_uc_config(). Do the inverse in ipa_deconfig() rather than ipa_teardown(), and rename the function for that case ipa_uc_deconfig(). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_main.c | 12 ++++++------ drivers/net/ipa/ipa_uc.c | 8 ++++---- drivers/net/ipa/ipa_uc.h | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index c26acd8b1cb91..d83322bf9e7e5 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -127,11 +127,9 @@ int ipa_setup(struct ipa *ipa) ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND, ipa_suspend_handler); - ipa_uc_setup(ipa); - ret = device_init_wakeup(dev, true); if (ret) - goto err_uc_teardown; + goto err_interrupt_remove; ipa_endpoint_setup(ipa); @@ -180,8 +178,7 @@ int ipa_setup(struct ipa *ipa) err_endpoint_teardown: ipa_endpoint_teardown(ipa); (void)device_init_wakeup(dev, false); -err_uc_teardown: - ipa_uc_teardown(ipa); +err_interrupt_remove: ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); gsi_teardown(&ipa->gsi); @@ -205,7 +202,6 @@ static void ipa_teardown(struct ipa *ipa) ipa_endpoint_disable_one(command_endpoint); ipa_endpoint_teardown(ipa); (void)device_init_wakeup(&ipa->pdev->dev, false); - ipa_uc_teardown(ipa); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND); gsi_teardown(&ipa->gsi); } @@ -474,6 +470,8 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) goto err_mem_deconfig; } + ipa_uc_config(ipa); + ret = ipa_endpoint_config(ipa); if (ret) goto err_interrupt_deconfig; @@ -494,6 +492,7 @@ static int ipa_config(struct ipa *ipa, const struct ipa_data *data) err_endpoint_deconfig: ipa_endpoint_deconfig(ipa); err_interrupt_deconfig: + ipa_uc_deconfig(ipa); ipa_interrupt_deconfig(ipa->interrupt); ipa->interrupt = NULL; err_mem_deconfig: @@ -513,6 +512,7 @@ static void ipa_deconfig(struct ipa *ipa) { ipa_modem_deconfig(ipa); ipa_endpoint_deconfig(ipa); + ipa_uc_deconfig(ipa); ipa_interrupt_deconfig(ipa->interrupt); ipa->interrupt = NULL; ipa_mem_deconfig(ipa); diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index fd9219863234c..8b5e75711b644 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -162,8 +162,8 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) } } -/* ipa_uc_setup() - Set up the microcontroller */ -void ipa_uc_setup(struct ipa *ipa) +/* Configure the IPA microcontroller subsystem */ +void ipa_uc_config(struct ipa *ipa) { /* The microcontroller needs the IPA clock running until it has * completed its initialization. It signals this by sending an @@ -180,8 +180,8 @@ void ipa_uc_setup(struct ipa *ipa) ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); } -/* Inverse of ipa_uc_setup() */ -void ipa_uc_teardown(struct ipa *ipa) +/* Inverse of ipa_uc_config() */ +void ipa_uc_deconfig(struct ipa *ipa) { ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); diff --git a/drivers/net/ipa/ipa_uc.h b/drivers/net/ipa/ipa_uc.h index e8510899a3f0a..cb0a224022f58 100644 --- a/drivers/net/ipa/ipa_uc.h +++ b/drivers/net/ipa/ipa_uc.h @@ -9,16 +9,16 @@ struct ipa; /** - * ipa_uc_setup() - set up the IPA microcontroller subsystem + * ipa_uc_config() - Configure the IPA microcontroller subsystem * @ipa: IPA pointer */ -void ipa_uc_setup(struct ipa *ipa); +void ipa_uc_config(struct ipa *ipa); /** - * ipa_uc_teardown() - inverse of ipa_uc_setup() + * ipa_uc_deconfig() - Inverse of ipa_uc_config() * @ipa: IPA pointer */ -void ipa_uc_teardown(struct ipa *ipa); +void ipa_uc_deconfig(struct ipa *ipa); /** * ipa_uc_panic_notifier() From patchwork Mon Jul 26 20:11:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 485862 Delivered-To: patch@linaro.org Received: by 2002:a02:c94a:0:0:0:0:0 with SMTP id u10csp4140752jao; Mon, 26 Jul 2021 13:11:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWlXEpANKCTPX31/7pCVSTVpRgvBSNjevTx/74iiQutvQPapN8sdWuahnUL5/eI39R3fYC X-Received: by 2002:a05:6638:25c7:: with SMTP id u7mr17957103jat.26.1627330319091; Mon, 26 Jul 2021 13:11:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627330319; cv=none; d=google.com; s=arc-20160816; b=bqeQD1dOyfo4VEwVzwl67VQXBfM/mbH5b14sMdVoEdGNfPZ+QydU0ULeHmRJiUGYFl +ur49iwHvd37llUUIj6TwrNJQ40bUkKEUcJgix0qgWS/pRPc5iKewY17rWU7xh6F0CfF BtPTBTvi1KNcjovpFGteNh5kYsI0OrHBAuXutdmTnwEptglPSVMaNhKx22pvu+rvSDOk 3YwWEJrvgIyN6ak63XgdvfLxoAZU+3AdTYrlVOwyMGulGC0OX4He/nHvAZRuMUF7/Etz KN4iFtmFylZ/culHLl2QPG54SQPgowbRrEbvSicwH6Pm1OVDVCw9y0k15qa/NPB2YMBZ pT9Q== 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=GDDMRio70MsWS94GuAHc1YhRqb1pVovQbxMWDHgB+9E=; b=k22bH3GoOwIICFFRtGGqg5YJ559i3/p4KFahO0xFL14Sym6hhzpKvvbrQ7hmB8RtnT ilaonJgNZC1Ib0JE6JM1qYnap8iaSoEx1V0HFMGDINvZS9PEPDYsnTlvNZ6kQEwsRvff CCakRzopuwusOY1H+OtW0cbGVhCHI8TqvSNYJGaTAamR5dj7SSTCzarCEhnjD/92Ockf pL137IvubAAUtPDKyoqhR//ym68Rlao38GGrrEbGnLk1jzMdQvZZ17SMx+hX3knirOfp XBKLXr1uwaZS3/1hLGnOV7FMHY3sKbGK3qI1aRHIx14fG/pPaO9D1ZN0JvY7xvRv59pE 1ZKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jQ80Cojn; 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 y1si863413jao.99.2021.07.26.13.11.58; Mon, 26 Jul 2021 13:11: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=jQ80Cojn; 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 S233175AbhGZTbV (ORCPT + 8 others); Mon, 26 Jul 2021 15:31:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232888AbhGZTbQ (ORCPT ); Mon, 26 Jul 2021 15:31:16 -0400 Received: from mail-il1-x135.google.com (mail-il1-x135.google.com [IPv6:2607:f8b0:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8363BC061757 for ; Mon, 26 Jul 2021 13:11:44 -0700 (PDT) Received: by mail-il1-x135.google.com with SMTP id r1so10152618iln.6 for ; Mon, 26 Jul 2021 13:11: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=GDDMRio70MsWS94GuAHc1YhRqb1pVovQbxMWDHgB+9E=; b=jQ80CojneeeAhv1iHm/DGQgnPPBEYcpjRGJYTRw86tTeGSm0XUbSyEQioJ1Hz3BP4r iJbF+Mevyio3G2rqkAkahbYOs9UCV2CHRYutVc5sJTD5SNsxp2RylmrPdi/2t19wAX6e snpqxYpc8RXTaZyqfvWQzbAtC1me90h7GaZOQ2KWsJ3vGHOWTnbl00w+PZLKQ2X8ElCb Nf5YLXQkl76f+zkLTgN9WhzFVkc+4+3mfp5XKrRIEam8/YHiYbnZWrQH5EUrYU7IDu6u MkDufVf8u5qNelZCDk8KGarKmozzj+ZCO3GcW9anZS643gG9yqtFwA3sNltnVd+65i+X HsVA== 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=GDDMRio70MsWS94GuAHc1YhRqb1pVovQbxMWDHgB+9E=; b=JlR/34t2gsCyrPpJaznOMPOom6R/9daNOyHFWiQpX/2mMmLXevS0GhLiIKdV4ZoXhF f4aOxJ3O5d8QD4vRQt0J/eZxAPawRABHp1lRW1z/aLRfK6CUJ5rzqJSOmjUl8VCD9Cfl 1vHGDjHNiBftvsrCZ7+jAXj4unAQesTAraF4aIB15c1jiytvXR6JduHwE7lcEQE86SEz 6hfmV7jN7oeUhpdXEWZuUGQ7HA4pi3hfV6+/3W2h+jinA8LqeWqtlSvI0139oIpbFwGJ Ksuyh1jaRDTUFVBtvsMR0Uze3jDf2bSirmWlpT/766csr33eOhX6W7mrpiGuiIEVpYkw wFLw== X-Gm-Message-State: AOAM5311Es73VBQd1wFl1KJQ/Z3br6k5l/0x7xWtqApKxhG2jIQOWAcU RtTpRCrYA+AnlB5oWZ02GDc/RA== X-Received: by 2002:a05:6e02:12e3:: with SMTP id l3mr9924095iln.6.1627330303948; Mon, 26 Jul 2021 13:11: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 z10sm425964iln.8.2021.07.26.13.11.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Jul 2021 13:11:43 -0700 (PDT) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: bjorn.andersson@linaro.org, evgreen@chromium.org, cpratapa@codeaurora.org, subashab@codeaurora.org, elder@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/5] net: ipa: introduce ipa_uc_clock() Date: Mon, 26 Jul 2021 15:11:36 -0500 Message-Id: <20210726201136.502800-6-elder@linaro.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210726201136.502800-1-elder@linaro.org> References: <20210726201136.502800-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The first time it's booted, the modem loads and starts the IPA-resident microcontroller. Once the microcontroller has completed its initialization, it notifies the AP it's "ready" by sending an INIT_COMPLETED response message. Until it receives that microcontroller message, the AP must ensure the IPA core clock remains operational. Currently, a "proxy" clock reference is taken in ipa_uc_config(), dropping it again once the message is received. However there could be a long delay between when ipa_config() completes and when modem actually starts. And because the microcontroller gets loaded by the modem, there's no need to get the modem "proxy clock" until the first time it starts. Create a new function ipa_uc_clock() which takes the "proxy" clock reference for the microcontroller. Call it when we get remoteproc SSR notification that the modem is about to start. Keep an additional flag to record whether this proxy clock reference needs to be dropped at shutdown time, and issue a warning if we get the microcontroller message either before the clock reference is taken, or after it has already been dropped. Drop the nearby use of "hh" length modifiers, which are no longer encouraged in the kernel. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa.h | 2 ++ drivers/net/ipa/ipa_modem.c | 2 ++ drivers/net/ipa/ipa_uc.c | 44 +++++++++++++++++++++++-------------- drivers/net/ipa/ipa_uc.h | 14 ++++++++++++ 4 files changed, 45 insertions(+), 17 deletions(-) -- 2.27.0 diff --git a/drivers/net/ipa/ipa.h b/drivers/net/ipa/ipa.h index 744406832a774..71ba996096bb9 100644 --- a/drivers/net/ipa/ipa.h +++ b/drivers/net/ipa/ipa.h @@ -51,6 +51,7 @@ enum ipa_flag { * @table_addr: DMA address of filter/route table content * @table_virt: Virtual address of filter/route table content * @interrupt: IPA Interrupt information + * @uc_clocked: true if clock is active by proxy for microcontroller * @uc_loaded: true after microcontroller has reported it's ready * @reg_addr: DMA address used for IPA register access * @reg_virt: Virtual address used for IPA register access @@ -95,6 +96,7 @@ struct ipa { __le64 *table_virt; struct ipa_interrupt *interrupt; + bool uc_clocked; bool uc_loaded; dma_addr_t reg_addr; diff --git a/drivers/net/ipa/ipa_modem.c b/drivers/net/ipa/ipa_modem.c index 5cb60e2ea6042..c851e2cf12552 100644 --- a/drivers/net/ipa/ipa_modem.c +++ b/drivers/net/ipa/ipa_modem.c @@ -19,6 +19,7 @@ #include "ipa_modem.h" #include "ipa_smp2p.h" #include "ipa_qmi.h" +#include "ipa_uc.h" #define IPA_NETDEV_NAME "rmnet_ipa%d" #define IPA_NETDEV_TAILROOM 0 /* for padding by mux layer */ @@ -314,6 +315,7 @@ static int ipa_modem_notify(struct notifier_block *nb, unsigned long action, switch (action) { case QCOM_SSR_BEFORE_POWERUP: dev_info(dev, "received modem starting event\n"); + ipa_uc_clock(ipa); ipa_smp2p_notify_reset(ipa); break; diff --git a/drivers/net/ipa/ipa_uc.c b/drivers/net/ipa/ipa_uc.c index 8b5e75711b644..f88ee02457d49 100644 --- a/drivers/net/ipa/ipa_uc.c +++ b/drivers/net/ipa/ipa_uc.c @@ -131,7 +131,7 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) if (shared->event == IPA_UC_EVENT_ERROR) dev_err(dev, "microcontroller error event\n"); else if (shared->event != IPA_UC_EVENT_LOG_INFO) - dev_err(dev, "unsupported microcontroller event %hhu\n", + dev_err(dev, "unsupported microcontroller event %u\n", shared->event); /* The LOG_INFO event can be safely ignored */ } @@ -140,23 +140,28 @@ static void ipa_uc_event_handler(struct ipa *ipa, enum ipa_irq_id irq_id) static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) { struct ipa_uc_mem_area *shared = ipa_uc_shared(ipa); + struct device *dev = &ipa->pdev->dev; /* An INIT_COMPLETED response message is sent to the AP by the * microcontroller when it is operational. Other than this, the AP * should only receive responses from the microcontroller when it has * sent it a request message. * - * We can drop the clock reference taken in ipa_uc_setup() once we + * We can drop the clock reference taken in ipa_uc_clock() once we * know the microcontroller has finished its initialization. */ switch (shared->response) { case IPA_UC_RESPONSE_INIT_COMPLETED: - ipa->uc_loaded = true; - ipa_clock_put(ipa); + if (ipa->uc_clocked) { + ipa->uc_loaded = true; + ipa_clock_put(ipa); + ipa->uc_clocked = false; + } else { + dev_warn(dev, "unexpected init_completed response\n"); + } break; default: - dev_warn(&ipa->pdev->dev, - "unsupported microcontroller response %hhu\n", + dev_warn(dev, "unsupported microcontroller response %u\n", shared->response); break; } @@ -165,16 +170,7 @@ static void ipa_uc_response_hdlr(struct ipa *ipa, enum ipa_irq_id irq_id) /* Configure the IPA microcontroller subsystem */ void ipa_uc_config(struct ipa *ipa) { - /* The microcontroller needs the IPA clock running until it has - * completed its initialization. It signals this by sending an - * INIT_COMPLETED response message to the AP. This could occur after - * we have finished doing the rest of the IPA initialization, so we - * need to take an extra "proxy" reference, and hold it until we've - * received that signal. (This reference is dropped in - * ipa_uc_response_hdlr(), above.) - */ - ipa_clock_get(ipa); - + ipa->uc_clocked = false; ipa->uc_loaded = false; ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_0, ipa_uc_event_handler); ipa_interrupt_add(ipa->interrupt, IPA_IRQ_UC_1, ipa_uc_response_hdlr); @@ -185,10 +181,24 @@ void ipa_uc_deconfig(struct ipa *ipa) { ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1); ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0); - if (!ipa->uc_loaded) + if (ipa->uc_clocked) ipa_clock_put(ipa); } +/* Take a proxy clock reference for the microcontroller */ +void ipa_uc_clock(struct ipa *ipa) +{ + static bool already; + + if (already) + return; + already = true; /* Only do this on first boot */ + + /* This clock reference dropped in ipa_uc_response_hdlr() above */ + ipa_clock_get(ipa); + ipa->uc_clocked = true; +} + /* Send a command to the microcontroller */ static void send_uc_command(struct ipa *ipa, u32 command, u32 command_param) { diff --git a/drivers/net/ipa/ipa_uc.h b/drivers/net/ipa/ipa_uc.h index cb0a224022f58..14e4e1115aa79 100644 --- a/drivers/net/ipa/ipa_uc.h +++ b/drivers/net/ipa/ipa_uc.h @@ -20,6 +20,20 @@ void ipa_uc_config(struct ipa *ipa); */ void ipa_uc_deconfig(struct ipa *ipa); +/** + * ipa_uc_clock() - Take a proxy clock reference for the microcontroller + * @ipa: IPA pointer + * + * The first time the modem boots, it loads firmware for and starts the + * IPA-resident microcontroller. The microcontroller signals that it + * has completed its initialization by sending an INIT_COMPLETED response + * message to the AP. The AP must ensure the IPA core clock is operating + * until it receives this message, and to do so we take a "proxy" clock + * reference on its behalf here. Once we receive the INIT_COMPLETED + * message (in ipa_uc_response_hdlr()) we drop this clock reference. + */ +void ipa_uc_clock(struct ipa *ipa); + /** * ipa_uc_panic_notifier() * @ipa: IPA pointer