From patchwork Fri Jan 15 12:50:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363595 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp264786jap; Fri, 15 Jan 2021 04:52:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDNlHvTBipRbv3h/ddks15mXcF+tkXzevhB4lX00oWTSGN2C9EZ3qdjoIN8O/uSXYUTzfK X-Received: by 2002:a17:906:c18:: with SMTP id s24mr8452193ejf.419.1610715175253; Fri, 15 Jan 2021 04:52:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715175; cv=none; d=google.com; s=arc-20160816; b=Xwk+1qpMK3PEkckp6GXL2BdaKQz006TupWb89UlXDDaoyOyzcCld9dbmYdRPBm/Re5 iHLPXY27HvoFy+M/SQXcX/74J0/Ix/jic3vh8mx6Ci7eViAybLNeg7HJZK3MNgHXdiYx a0GT0ZuThIFWMul11oGZaLOZK9UbOPf7xBYfJRIlVfyQwIPX9e/n8frAENQ+XdCuk2zq DcoGY82wDq3GZ9pELsLuT5ShDqQ6fOwi4GlRiH4aricpM6z4ehru5y/48oFXIwKHwwBw 3CkdsdPz6PDE40e75MG2ifYQEKiCk6b1mNj+m5ojLBVfv0I3Md0v3LDuHePQdbXwL8hl mBLA== 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=hbNcO1PxaEFCNLiObWORAHVRJjozk9n2oBP+T8k1g7Q=; b=CrPrxzlVAoovf7P7iuX2r6AkXAot4wGIobwxG5G7KFrKhtpWNRTJ5ENTxP5e1Z/ebF YyWn0VqCESyc+e+5y1Ppv6Hg6MJ3FUFSTP4smu33SH+/qy6Uj9r882fIzttMDhXuKyCt uou82L7LLmo/KLfSJpBgGB3V51wqjpJqAHcKU8CDcTq/bCZFkJ/PXt2qLcQW9Z1VYGbq lO8OCgbWhZedTdSVYtatbMk9w27BstDQcRtbW3RGBOSIH7DQXZi5KrqyFMU8QFzSDHP2 rw8FjxgiMl69JvNKd6cHcDweILXQf/dpVv8nF186EEIBIB4G8ADsfycDddIjKCLBbAGE iiOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="kHE3h/6f"; 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 dp16si3572351ejc.564.2021.01.15.04.52.54; Fri, 15 Jan 2021 04:52:55 -0800 (PST) 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="kHE3h/6f"; 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 S2388026AbhAOMvy (ORCPT + 7 others); Fri, 15 Jan 2021 07:51:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733306AbhAOMvf (ORCPT ); Fri, 15 Jan 2021 07:51:35 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70147C061794 for ; Fri, 15 Jan 2021 04:50:55 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id y19so17882226iov.2 for ; Fri, 15 Jan 2021 04:50:55 -0800 (PST) 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=hbNcO1PxaEFCNLiObWORAHVRJjozk9n2oBP+T8k1g7Q=; b=kHE3h/6fYs9voS8QaFVlcBTH2loV7DSRwxyrPKKa6qHDSqUTx6BQum0C/gIP+aFMCi UohHy7QciVDcznmwhsIlqP8YKoKP3JcAGIibl3enA1nM2KhpRcU+FMN3etn8SfocCkbf bao+DMqKK33hge7kMKfBYZDQCJ91t60N9eGeGUH08K+i9CvdG+xtAZ8EahT9ea2EihZa MBv52Dq6/nbFmvBRKWWuLisM5hhbL8KLypgStfvfuOyFpzlh7MDvF6RBC5FEFJMLcDXZ Gc5nqdhGjwmGZfrmQoiP49yQFCBG2/goy6VRiGDQ+Fy5tXeDo2rpXMNGAr8gJl00AqbD EhGg== 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=hbNcO1PxaEFCNLiObWORAHVRJjozk9n2oBP+T8k1g7Q=; b=XlkZwuhaM4qIywFRK2dUp1ZQFY8k7HMtsw+acSC0N9TS6SW2pp77/OBcXVmqP5bdw3 thV0hyKiZw4fQwzARqn4xZEtV+dW+yhuL6qZDHGsx96pMcgRphalzqygGgCPemXeXLDp fc0HiM/7O33kH7LEAoQbQwxwYN3CrAqvyeIjJeomw2W/MY2XLpbXPd3D7WMZ+6leMK95 wK+MNMtS4DM0CWz8mYfsTgpGp/dxpU+d7qhp8Z3/7TV92UlA1eUQFWWkTVY2Z4zWEpRB YgEV2tkVU4DG00s0mGIIkQgfcf5hePlMta69M361Y2TWShzUDHaXjCNKk/ZHEF6b1ZKA LxXA== X-Gm-Message-State: AOAM533/fRiN/IyS9A4eOBqALS/hLxB2Fw0zgYQLibQMaUh93Z96selj EeEmV0u9Md2+m4CZwUjR1U9A6g== X-Received: by 2002:a6b:8d91:: with SMTP id p139mr8464723iod.96.1610715054774; Fri, 15 Jan 2021 04:50:54 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:54 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/7] net: ipa: rename interconnect settings Date: Fri, 15 Jan 2021 06:50:44 -0600 Message-Id: <20210115125050.20555-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Use "bandwidth" rather than "rate" in describing the average and peak values to use for IPA interconnects. They should have been named that way to begin with. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 20 ++++++++++---------- drivers/net/ipa/ipa_data-sc7180.c | 16 ++++++++-------- drivers/net/ipa/ipa_data-sdm845.c | 16 ++++++++-------- drivers/net/ipa/ipa_data.h | 10 +++++----- 4 files changed, 31 insertions(+), 31 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 135c393437f12..459c357e09678 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -109,20 +109,20 @@ static int ipa_interconnect_enable(struct ipa *ipa) int ret; data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; - ret = icc_set_bw(clock->memory_path, data->average_rate, - data->peak_rate); + ret = icc_set_bw(clock->memory_path, data->average_bandwidth, + data->peak_bandwidth); if (ret) return ret; data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(clock->imem_path, data->average_rate, - data->peak_rate); + ret = icc_set_bw(clock->imem_path, data->average_bandwidth, + data->peak_bandwidth); if (ret) goto err_memory_path_disable; data = &clock->interconnect_data[IPA_INTERCONNECT_CONFIG]; - ret = icc_set_bw(clock->config_path, data->average_rate, - data->peak_rate); + ret = icc_set_bw(clock->config_path, data->average_bandwidth, + data->peak_bandwidth); if (ret) goto err_imem_path_disable; @@ -159,12 +159,12 @@ static int ipa_interconnect_disable(struct ipa *ipa) err_imem_path_reenable: data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; - (void)icc_set_bw(clock->imem_path, data->average_rate, - data->peak_rate); + (void)icc_set_bw(clock->imem_path, data->average_bandwidth, + data->peak_bandwidth); err_memory_path_reenable: data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; - (void)icc_set_bw(clock->memory_path, data->average_rate, - data->peak_rate); + (void)icc_set_bw(clock->memory_path, data->average_bandwidth, + data->peak_bandwidth); return ret; } diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 5cc0ed77edb9c..491572c0a34dc 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -311,20 +311,20 @@ static struct ipa_mem_data ipa_mem_data = { static struct ipa_clock_data ipa_clock_data = { .core_clock_rate = 100 * 1000 * 1000, /* Hz */ - /* Interconnect rates are in 1000 byte/second units */ + /* Interconnect bandwidths are in 1000 byte/second units */ .interconnect = { [IPA_INTERCONNECT_MEMORY] = { - .peak_rate = 465000, /* 465 MBps */ - .average_rate = 80000, /* 80 MBps */ + .peak_bandwidth = 465000, /* 465 MBps */ + .average_bandwidth = 80000, /* 80 MBps */ }, - /* Average rate is unused for the next two interconnects */ + /* Average bandwidth unused for the next two interconnects */ [IPA_INTERCONNECT_IMEM] = { - .peak_rate = 68570, /* 68.570 MBps */ - .average_rate = 0, /* unused */ + .peak_bandwidth = 68570, /* 68.57 MBps */ + .average_bandwidth = 0, /* unused */ }, [IPA_INTERCONNECT_CONFIG] = { - .peak_rate = 30000, /* 30 MBps */ - .average_rate = 0, /* unused */ + .peak_bandwidth = 30000, /* 30 MBps */ + .average_bandwidth = 0, /* unused */ }, }, }; diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index f8fee8d3ca42a..c62b86171b929 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -331,20 +331,20 @@ static struct ipa_mem_data ipa_mem_data = { static struct ipa_clock_data ipa_clock_data = { .core_clock_rate = 75 * 1000 * 1000, /* Hz */ - /* Interconnect rates are in 1000 byte/second units */ + /* Interconnect bandwidths are in 1000 byte/second units */ .interconnect = { [IPA_INTERCONNECT_MEMORY] = { - .peak_rate = 600000, /* 600 MBps */ - .average_rate = 80000, /* 80 MBps */ + .peak_bandwidth = 600000, /* 600 MBps */ + .average_bandwidth = 80000, /* 80 MBps */ }, - /* Average rate is unused for the next two interconnects */ + /* Average bandwidth unused for the next two interconnects */ [IPA_INTERCONNECT_IMEM] = { - .peak_rate = 350000, /* 350 MBps */ - .average_rate = 0, /* unused */ + .peak_bandwidth = 350000, /* 350 MBps */ + .average_bandwidth = 0, /* unused */ }, [IPA_INTERCONNECT_CONFIG] = { - .peak_rate = 40000, /* 40 MBps */ - .average_rate = 0, /* unused */ + .peak_bandwidth = 40000, /* 40 MBps */ + .average_bandwidth = 0, /* unused */ }, }, }; diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 0ed5ffe2b8da0..96a9771a6cc05 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -267,13 +267,13 @@ enum ipa_interconnect_id { }; /** - * struct ipa_interconnect_data - description of IPA interconnect rates - * @peak_rate: Peak interconnect bandwidth (in 1000 byte/sec units) - * @average_rate: Average interconnect bandwidth (in 1000 byte/sec units) + * struct ipa_interconnect_data - description of IPA interconnect bandwidths + * @peak_bandwidth: Peak interconnect bandwidth (in 1000 byte/sec units) + * @average_bandwidth: Average interconnect bandwidth (in 1000 byte/sec units) */ struct ipa_interconnect_data { - u32 peak_rate; - u32 average_rate; + u32 peak_bandwidth; + u32 average_bandwidth; }; /** From patchwork Fri Jan 15 12:50:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363600 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp265825jap; Fri, 15 Jan 2021 04:54:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCAJBaGd9Ly4abdmaB8zmgCLkqXgBLn/5B28xgF7n8V1xYuhrTU60wDWp/2MvDC8bAUDs8 X-Received: by 2002:a50:ce13:: with SMTP id y19mr9500776edi.241.1610715172373; Fri, 15 Jan 2021 04:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715172; cv=none; d=google.com; s=arc-20160816; b=iI1Nub+ekr7lBIK4wMnEvSZvcGRLeL94x+NtHXiXlNpZVmRjbaGMxmO9RX3s/8yEl0 FMn86rRftfPbuTgFNIJEkhGJCeyKVC4R1fZFeI/2a1xalnmekwvFytoN0XXvEk6sP6Zs e/Tj410dCPhYowdl+DCS7Gd2lt2PqrOyhJNEzTICE+axasCMgvk19csx/CoFFMROmv+w lifUs+8BQXDYxsrMVzqbebSGk4/Toipb2zL9U+ygjA1olSxwoEZJZHiLSz00dZaTc4Ub 4DEYYMkCSQM/ljsHyhcTNpNz9GdTB0NwVh/OSpp2HLdzc973pkST6Y0qSZtj0UgtLjzI FwFA== 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=HRs/Iw+fbNuG8BHg7jc2ZIXfDTbwOS1IIxrJncMvSjg=; b=FtyGrd9Y99hSXucO4g7MHyzYHDo9hgT5OKu+TabwGuI354QxuUf7RgAJKeGt+qzxId QGYiiVO1q3d37VpJa69Tg+fCUudH9sEfmFpEjup9EXtkBbCfwjiFIqzeRNLv0sHeswOw WTm6gTAAvjha3kRj2D5xI07uMy6m4qFaKo9FdyZHFEWSy7ZnhxSMFe8M5R2oF6PKOFyO xefStXKDXe7C4eru7ZuuMZd50wNmHLdc8eNnHWESQp7ObVO7noVT3upgc26IdiFBZuPM 7Bm2vW6kHdX1Qf7U2V5ml/gp2/ALM52IXkWmhC1gU/kSSjOpWkvP1wIy/GbPK71H4h/+ C8vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vdAI/v/v"; 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 dp16si3572351ejc.564.2021.01.15.04.52.52; Fri, 15 Jan 2021 04:52:52 -0800 (PST) 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="vdAI/v/v"; 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 S2388415AbhAOMvn (ORCPT + 7 others); Fri, 15 Jan 2021 07:51:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387742AbhAOMvk (ORCPT ); Fri, 15 Jan 2021 07:51:40 -0500 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 7E6C2C061796 for ; Fri, 15 Jan 2021 04:50:56 -0800 (PST) Received: by mail-io1-xd30.google.com with SMTP id e22so17831407iom.5 for ; Fri, 15 Jan 2021 04:50:56 -0800 (PST) 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=HRs/Iw+fbNuG8BHg7jc2ZIXfDTbwOS1IIxrJncMvSjg=; b=vdAI/v/v3LmO73rs7BW4NJVaNk7yg1dQ8bxJJzj22+Vp4S361PRxFY0sNlgk5FAQZM xjuPwlEScjBhwGakNasyqKq+aUY7z6EzW6jaUEE+zmKn13gjDDxBw3yIRSolzxU4fkS/ XAmnuyimEbNkvM7Y3DOyiA5yIJsoeniAj+Djc7GEu5joK69d+NEcyCKsFDUED3qZ+8ty O4Ex/Pb+Aw4X0gFyhJrrRGrNN6ySjNubAMO2g9ALqN5nQfzjVXiUUvmTVgewFeDsPHwe FfpuEn97l0rPXPNMWHtIfW3dGosKFGLvxXAQOM88j6RBnMR6A4O4gAKh4A9HZaixo/H8 ZjZA== 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=HRs/Iw+fbNuG8BHg7jc2ZIXfDTbwOS1IIxrJncMvSjg=; b=L1BZzo5JY3xdHiW29Sh2uOJRc0rcpqn9kXOBlJB03Dxrne74lRFhAhO0RF9alnwAuU hjmJMLtcV5LwRpk3qu22R3IT6h0M0kUBKpjUejwqWbv7pZ/CwTCy0Q9xsS9nSsn13r8k m9yxHBjpjl0KD0DKc0KgV8T0EiXQbDhOQbTmYOHFL/G6kq2xPYHIN2XK0pNBlTlMOTNP q7YvOcYPy8VDX6O5K9xq7/wI7ZJhL4SaYlVAzhsRvje4M2TfdIAPPCThv5vBKMoVGzko goPi3WWV3CkQByHg5mU2qgVy0CKrDgwjxYU9mOoPC5XBKHKcirn8snCMc7dv+LZkw5na HdSw== X-Gm-Message-State: AOAM533gH9ybjU1J+2QNIcp6pTY4ReUYh9jFt+EjOaO81S+EYVC17Dsv mCUE3iYy9xgJfqxeZ/eejsKArA== X-Received: by 2002:a05:6e02:1a25:: with SMTP id g5mr10740701ile.2.1610715055898; Fri, 15 Jan 2021 04:50:55 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:55 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/7] net: ipa: don't return an error from ipa_interconnect_disable() Date: Fri, 15 Jan 2021 06:50:45 -0600 Message-Id: <20210115125050.20555-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If disabling interconnects fails there's not a lot we can do. The only two callers of ipa_interconnect_disable() ignore the return value, so just give the function a void return type. Print an error message if disabling any of the interconnects is not successful. Return (and print) only the first error seen. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 459c357e09678..baedb481fe824 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -137,36 +137,27 @@ static int ipa_interconnect_enable(struct ipa *ipa) } /* To disable an interconnect, we just its bandwidth to 0 */ -static int ipa_interconnect_disable(struct ipa *ipa) +static void ipa_interconnect_disable(struct ipa *ipa) { - const struct ipa_interconnect_data *data; struct ipa_clock *clock = ipa->clock; + int result = 0; int ret; ret = icc_set_bw(clock->memory_path, 0, 0); if (ret) - return ret; + result = ret; ret = icc_set_bw(clock->imem_path, 0, 0); - if (ret) - goto err_memory_path_reenable; + if (ret && !result) + result = ret; ret = icc_set_bw(clock->config_path, 0, 0); - if (ret) - goto err_imem_path_reenable; + if (ret && !result) + result = ret; - return 0; - -err_imem_path_reenable: - data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; - (void)icc_set_bw(clock->imem_path, data->average_bandwidth, - data->peak_bandwidth); -err_memory_path_reenable: - data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; - (void)icc_set_bw(clock->memory_path, data->average_bandwidth, - data->peak_bandwidth); - - return ret; + if (result) + dev_err(&ipa->pdev->dev, + "error %d disabling IPA interconnects\n", ret); } /* Turn on IPA clocks, including interconnects */ @@ -189,7 +180,7 @@ static int ipa_clock_enable(struct ipa *ipa) static void ipa_clock_disable(struct ipa *ipa) { clk_disable_unprepare(ipa->clock->core); - (void)ipa_interconnect_disable(ipa); + ipa_interconnect_disable(ipa); } /* Get an IPA clock reference, but only if the reference count is From patchwork Fri Jan 15 12:50:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363599 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp265799jap; Fri, 15 Jan 2021 04:54:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxa/1P9F2h9lVBm8OVAXptZKHp8fpepGFTxCsTNi6eVL5cSqgEHl8dDQiS2/0idopud2pn3 X-Received: by 2002:a17:906:a857:: with SMTP id dx23mr8733715ejb.189.1610715270707; Fri, 15 Jan 2021 04:54:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715270; cv=none; d=google.com; s=arc-20160816; b=BaeyJQsC7gXAkF7QB7lfdy+xQtoIiWbdMymPU5ybt3kTxXaJoybPvxdc4Q/ME7YuPz 9h1/y31FRXi4RG7IZWopx5JGebBt5s9D4DIXOinav56sOyyo4U3ip4Vgg4zG25UEll+U xAmkvZ/cJD3op7JF2RFMvJ9rnayOAWdD1dhIenXJ1HmBGDrefVeORPFA3x+D1ACJNE8O b8gseFJbDNA0T6QNE39SX59u9dCvj1RwxiNkAXVF+FPoZozz5VDT1OKQwCj+IHhGQJUD 4yh3ck63dRulTR7XBmuzParlpJjUH8ABd8PFrztWvvM7c7rAA3eUl2qy8cwbAIhVF8w1 oP2w== 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=TQTzRspM7VOhdUIB2fwWrTYFwF0pu0m+N8Hr60ecngE=; b=Rbi1glqcwVbVevCrbdvVAWDVAoLiD6+aT1oRWygV+ytGRzRNeKj6W00Et4+j8LXqZd NBqN0szilh634kz+I9LgnCnZbxwoUpbJG/AutWoqVV9Apcjkn6EwXsVvfdmZVERMzBmT uiDtNQCfGDVsdzfM49oXInK3cccZPdzkCMDf+nICTYKYIrfYRb+F1qYvrg4D0uLQHKmk zcVX3HQqUzKCV5qGbwlrKfnfgLVWN6malFmbPoJnL26oIVe1NXk0aYxpa5cPbLRB4Oay +hD7meatG/saqPsT5je6zPNHpxKzwHbjprikt1BhyLUrsqyY1KQDVSYGSfXrrD0CDK7d +kRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Sxp5q9+t; 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 a5si3624718ejr.334.2021.01.15.04.54.30; Fri, 15 Jan 2021 04:54:30 -0800 (PST) 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=Sxp5q9+t; 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 S2387875AbhAOMxX (ORCPT + 7 others); Fri, 15 Jan 2021 07:53:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387601AbhAOMwP (ORCPT ); Fri, 15 Jan 2021 07:52:15 -0500 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC475C061798 for ; Fri, 15 Jan 2021 04:50:57 -0800 (PST) Received: by mail-io1-xd36.google.com with SMTP id d9so17844356iob.6 for ; Fri, 15 Jan 2021 04:50:57 -0800 (PST) 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=TQTzRspM7VOhdUIB2fwWrTYFwF0pu0m+N8Hr60ecngE=; b=Sxp5q9+tUNocZDVR4IqjOqJl4SlFzviVO/ta9XLDo5muhYQjwAYGKs6k/H7hsBHiPE 4ePYTEmvbATf65HrnVhuUygPsKz8PBROu+J2ihbq2isU+nBoY5c5gVs60xCQqR4kLj/L DSVd+zcUSzRENq2/ZdGS4tzTGw+g6MTGtdEZpG0bY/7gV5EjVskYvrI0+/+oa4myKMBW b5QeBfZQveo3uNdiW6Phnhj8REONXbs9BPJWm4sYVqvICR8FP0dlv+NQnbzhdsivgJJM 1Qcm0//A5rVuJ79Aju7yfJ2UXZ5JgA0bIPIR5P2mCEdd4Luqp6KjlhqIed6lPCM+UelB iY9A== 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=TQTzRspM7VOhdUIB2fwWrTYFwF0pu0m+N8Hr60ecngE=; b=bWNWYo6znDkmCoAn4N2P4NLOeSh4mvgHtFxEWbnEBq/Y1+tXKXpytjcTUYRjYpqfZJ IHSD7eR/ot/9w4LrNhyIIIuNLn+mtdPukbxSFtuEJOOjUxYYfe/o52CgTLNr+QUJ/qfj a8hz/17tPizUuftSNpjNsNetkuWZ4Nt7R7RH2QnyGo+jfeEShhnei8ytheCwQtK5woq2 x+ndw1lPZucDaN0fJ6u4o7aou/BVbd3JdgczfLPebikVq/J46Fp0SJHWkZjjdYsKPSpO WO5SOTFhK0ge7Izj0syFODxTtBA7TZTzHaqOaNvBXH3NHjdrlC2zZmekizS82juF4ur4 pwQg== X-Gm-Message-State: AOAM531UXM+MRKIWqWyNK1lYMoyFNc2XcMCqDhQHtNR3TQ0bsJBB+4I1 Y89wSXrLyP0sLIrDwykjV9lD1Q== X-Received: by 2002:a02:23ce:: with SMTP id u197mr10176639jau.113.1610715056857; Fri, 15 Jan 2021 04:50:56 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:56 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/7] net: ipa: introduce an IPA interconnect structure Date: Fri, 15 Jan 2021 06:50:46 -0600 Message-Id: <20210115125050.20555-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Rather than having separate pointers for the memory, imem, and config interconnect paths, maintain an array of ipa_interconnect structures each of which contains a pointer to a path. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 59 +++++++++++++++++++++---------------- 1 file changed, 34 insertions(+), 25 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index baedb481fe824..2bf5af6823d8c 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -30,23 +30,27 @@ * An IPA clock reference must be held for any access to IPA hardware. */ +/** + * struct ipa_interconnect - IPA interconnect information + * @path: Interconnect path + */ +struct ipa_interconnect { + struct icc_path *path; +}; + /** * struct ipa_clock - IPA clocking information * @count: Clocking reference count * @mutex: Protects clock enable/disable * @core: IPA core clock - * @memory_path: Memory interconnect - * @imem_path: Internal memory interconnect - * @config_path: Configuration space interconnect + * @interconnect: Interconnect array * @interconnect_data: Interconnect configuration data */ struct ipa_clock { refcount_t count; struct mutex mutex; /* protects clock enable/disable */ struct clk *core; - struct icc_path *memory_path; - struct icc_path *imem_path; - struct icc_path *config_path; + struct ipa_interconnect *interconnect[IPA_INTERCONNECT_COUNT]; const struct ipa_interconnect_data *interconnect_data; }; @@ -71,24 +75,24 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev) path = ipa_interconnect_init_one(dev, "memory"); if (IS_ERR(path)) goto err_return; - clock->memory_path = path; + clock->interconnect[IPA_INTERCONNECT_MEMORY]->path = path; path = ipa_interconnect_init_one(dev, "imem"); if (IS_ERR(path)) goto err_memory_path_put; - clock->imem_path = path; + clock->interconnect[IPA_INTERCONNECT_IMEM]->path = path; path = ipa_interconnect_init_one(dev, "config"); if (IS_ERR(path)) goto err_imem_path_put; - clock->config_path = path; + clock->interconnect[IPA_INTERCONNECT_CONFIG]->path = path; return 0; err_imem_path_put: - icc_put(clock->imem_path); + icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM]->path); err_memory_path_put: - icc_put(clock->memory_path); + icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path); err_return: return PTR_ERR(path); } @@ -96,9 +100,9 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev) /* Inverse of ipa_interconnect_init() */ static void ipa_interconnect_exit(struct ipa_clock *clock) { - icc_put(clock->config_path); - icc_put(clock->imem_path); - icc_put(clock->memory_path); + icc_put(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path); + icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM]->path); + icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path); } /* Currently we only use one bandwidth level, so just "enable" interconnects */ @@ -109,29 +113,31 @@ static int ipa_interconnect_enable(struct ipa *ipa) int ret; data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; - ret = icc_set_bw(clock->memory_path, data->average_bandwidth, - data->peak_bandwidth); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, + data->average_bandwidth, data->peak_bandwidth); if (ret) return ret; data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(clock->imem_path, data->average_bandwidth, - data->peak_bandwidth); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, + data->average_bandwidth, data->peak_bandwidth); if (ret) goto err_memory_path_disable; data = &clock->interconnect_data[IPA_INTERCONNECT_CONFIG]; - ret = icc_set_bw(clock->config_path, data->average_bandwidth, - data->peak_bandwidth); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path, + data->average_bandwidth, data->peak_bandwidth); if (ret) goto err_imem_path_disable; return 0; err_imem_path_disable: - (void)icc_set_bw(clock->imem_path, 0, 0); + (void)icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, + 0, 0); err_memory_path_disable: - (void)icc_set_bw(clock->memory_path, 0, 0); + (void)icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, + 0, 0); return ret; } @@ -143,15 +149,18 @@ static void ipa_interconnect_disable(struct ipa *ipa) int result = 0; int ret; - ret = icc_set_bw(clock->memory_path, 0, 0); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, + 0, 0); if (ret) result = ret; - ret = icc_set_bw(clock->imem_path, 0, 0); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, + 0, 0); if (ret && !result) result = ret; - ret = icc_set_bw(clock->config_path, 0, 0); + ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path, + 0, 0); if (ret && !result) result = ret; From patchwork Fri Jan 15 12:50:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363598 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp265783jap; Fri, 15 Jan 2021 04:54:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJzaVIcbDerW+3ydX1UwiqCQmAb37wAe2iOQm4C3Fz3hptrUn4mE/i8T7EWIy6TO97XSkeIq X-Received: by 2002:a17:906:a008:: with SMTP id p8mr8758328ejy.117.1610715268823; Fri, 15 Jan 2021 04:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715268; cv=none; d=google.com; s=arc-20160816; b=PUusJcPffxJPpCcBxLSOeu9VaQlMA8HYmYCKQ/HLTtQegzMVzcQLuhA/PFFGvFDvsy sNMwworTX2v7fao0Ci19FkykZhjhjztmm9gjrQ+9oAa7C+rJfZ5BLK801KogZ1nkZgco IszEBExtLd9xojX2BGIOQb1xDGjvyYTP6fVOpVu/nywbdOxMuIEMfOGw6qBEVQhp8ZGV QfjFP1jJJ2utzAUUCAeBoZRFcQyjVoIn2dAxD+zvZv2ZBrLiFyQS83GRkiFvAtcu117k 2q9VAcQMQNbe/+/4xjSPBn5JhYrI6a5JeiOT+QOk/N2LgX81tVI0pLw8AoBj8jxWFNY5 nVsQ== 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=Ijl7ke0iXPO6hOHYeKFTmnnrMsXMs0BUA8XlyHgNlok=; b=oUFhYdqb/e92bsepwJGE7PI0TdQcmmMnFrQpMAcuXKdtdIqoRozK1ZCUN/gASKbQSG rCwFeEj3w/nHdSPfEoVkGP4ZqIp14+F49YRlmHHKtgKdjEC9RWM8dkeARMCEZ20nGee2 Bd8Hqfbw4H6BrpgWHLosAtmSiFBh7NmXXmrf10o6m3llLg1mFyeHhjuenHo/Afd07YsD ZI89dpMOfkvpjWT2Q63nralfk2RTvuoXQWP9oKhiOXTz6TKpluDVLN/qnqpytJRudFDW mMEj/bT6AtrdndiJys9co8+fRfQx0FDclHWGbVTMCQM8zUfHDRjGwYz+DuL19J7DfD9R hJtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mc9ADDnn; 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 a5si3624718ejr.334.2021.01.15.04.54.28; Fri, 15 Jan 2021 04:54:28 -0800 (PST) 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=Mc9ADDnn; 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 S1732283AbhAOMxQ (ORCPT + 7 others); Fri, 15 Jan 2021 07:53:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387995AbhAOMwP (ORCPT ); Fri, 15 Jan 2021 07:52:15 -0500 Received: from mail-io1-xd2c.google.com (mail-io1-xd2c.google.com [IPv6:2607:f8b0:4864:20::d2c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E5DAC06179C for ; Fri, 15 Jan 2021 04:50:58 -0800 (PST) Received: by mail-io1-xd2c.google.com with SMTP id d9so17844401iob.6 for ; Fri, 15 Jan 2021 04:50:58 -0800 (PST) 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=Ijl7ke0iXPO6hOHYeKFTmnnrMsXMs0BUA8XlyHgNlok=; b=Mc9ADDnnnwX3YZ5XXXnOTMJhwH9KTtI4eBuZCODN3bPiyrVcthEGgvuho4ikKP275X ju9isuNruW9yao4rIFQzOOr2vlQpCdgfrdm1QKyPig7bJA24AcWuERKqCV5bdpt5iY0r TLDrGUED7WassXd2c7ynjo4Eu4xKPyMsYdjTNn1jyINja8zU2Um5xb6DoH7JfGHDu5U7 zUnYVOjZAD5OQ/HslDe0CG/UzAkzbJcz/4pxnOUTKpWP2U7WFIvaFVBg10Rjiow5SvbC 01lQ+E1vaYTun/jIucQPECZczjGQNyz8Oi/J2X3GUPp4A3G03KA118K+wXRaQY5mqlfQ vP1g== 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=Ijl7ke0iXPO6hOHYeKFTmnnrMsXMs0BUA8XlyHgNlok=; b=oep92USVSKR55SqzTUOqIwthIZ5UYDw9GHkMA85hA9pyJJC2W9YZIoy3lIGW/VtJcU HffjFxfbMzo1lBTkTuh6rVR4ONEdgOLd4ezV1m0UX3ShKh5fIqGJZHHrkLsbFvkgWKAc d4+UIfalDvu/oHPvy+6wfkXuqxsqdWDbhKIvhzhPR//DkaW692vlesuq8McKHBI5c/z5 kTrziOo+/I4EfKow9bzX1t4CVkJulKvhwcWV3qE+UsB2EC0fUoNFKpHsi6Zn2vJcHptc etviVtUWQuCzRFl5J7SOPLRs1KDJuHOb95OmkZGco4FiYupVMYdRICZLl9SOjJHi4yQ1 JNUQ== X-Gm-Message-State: AOAM532b1ZwkBXgOkC1iiSnvnYrOSgd/2OAldQvg2rQYunnPb+V1d/Ur CCREd9bzg/KN9gcTeYhfeMzA2Q== X-Received: by 2002:a5e:c00e:: with SMTP id u14mr8274095iol.194.1610715057781; Fri, 15 Jan 2021 04:50:57 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:57 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/7] net: ipa: store average and peak interconnect bandwidth Date: Fri, 15 Jan 2021 06:50:47 -0600 Message-Id: <20210115125050.20555-5-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add fields in the ipa_interconnect structure to hold the average and peak bandwidth values for the interconnect. Pass the configuring data for interconnects to ipa_interconnect_init() so these values can be recorded, and use them when enabling the interconnects. There's no longer any need to keep a copy of the interconnect data after initialization. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 88 ++++++++++++++++++++++--------------- 1 file changed, 52 insertions(+), 36 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 2bf5af6823d8c..537c72b5267f6 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -33,9 +33,13 @@ /** * struct ipa_interconnect - IPA interconnect information * @path: Interconnect path + * @average_bandwidth: Average interconnect bandwidth (KB/second) + * @peak_bandwidth: Peak interconnect bandwidth (KB/second) */ struct ipa_interconnect { struct icc_path *path; + u32 average_bandwidth; + u32 peak_bandwidth; }; /** @@ -44,14 +48,12 @@ struct ipa_interconnect { * @mutex: Protects clock enable/disable * @core: IPA core clock * @interconnect: Interconnect array - * @interconnect_data: Interconnect configuration data */ struct ipa_clock { refcount_t count; struct mutex mutex; /* protects clock enable/disable */ struct clk *core; - struct ipa_interconnect *interconnect[IPA_INTERCONNECT_COUNT]; - const struct ipa_interconnect_data *interconnect_data; + struct ipa_interconnect interconnect[IPA_INTERCONNECT_COUNT]; }; static struct icc_path * @@ -61,38 +63,52 @@ ipa_interconnect_init_one(struct device *dev, const char *name) path = of_icc_get(dev, name); if (IS_ERR(path)) - dev_err(dev, "error %ld getting %s interconnect\n", - PTR_ERR(path), name); + dev_err(dev, "error %d getting %s interconnect\n", + (int)PTR_ERR(path), name); return path; } /* Initialize interconnects required for IPA operation */ -static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev) +static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, + const struct ipa_interconnect_data *data) { + struct ipa_interconnect *interconnect; struct icc_path *path; path = ipa_interconnect_init_one(dev, "memory"); if (IS_ERR(path)) goto err_return; - clock->interconnect[IPA_INTERCONNECT_MEMORY]->path = path; + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + interconnect->path = path; + interconnect->average_bandwidth = data->average_bandwidth; + interconnect->peak_bandwidth = data->peak_bandwidth; + data++; path = ipa_interconnect_init_one(dev, "imem"); if (IS_ERR(path)) goto err_memory_path_put; - clock->interconnect[IPA_INTERCONNECT_IMEM]->path = path; + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + interconnect->path = path; + interconnect->average_bandwidth = data->average_bandwidth; + interconnect->peak_bandwidth = data->peak_bandwidth; + data++; path = ipa_interconnect_init_one(dev, "config"); if (IS_ERR(path)) goto err_imem_path_put; - clock->interconnect[IPA_INTERCONNECT_CONFIG]->path = path; + interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; + interconnect->path = path; + interconnect->average_bandwidth = data->average_bandwidth; + interconnect->peak_bandwidth = data->peak_bandwidth; + data++; return 0; err_imem_path_put: - icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM]->path); + icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM].path); err_memory_path_put: - icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path); + icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY].path); err_return: return PTR_ERR(path); } @@ -100,44 +116,44 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev) /* Inverse of ipa_interconnect_init() */ static void ipa_interconnect_exit(struct ipa_clock *clock) { - icc_put(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path); - icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM]->path); - icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path); + icc_put(clock->interconnect[IPA_INTERCONNECT_CONFIG].path); + icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM].path); + icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY].path); } /* Currently we only use one bandwidth level, so just "enable" interconnects */ static int ipa_interconnect_enable(struct ipa *ipa) { - const struct ipa_interconnect_data *data; + struct ipa_interconnect *interconnect; struct ipa_clock *clock = ipa->clock; int ret; - data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, - data->average_bandwidth, data->peak_bandwidth); + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, + interconnect->peak_bandwidth); if (ret) return ret; - data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, - data->average_bandwidth, data->peak_bandwidth); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, + interconnect->peak_bandwidth); if (ret) goto err_memory_path_disable; - data = &clock->interconnect_data[IPA_INTERCONNECT_CONFIG]; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path, - data->average_bandwidth, data->peak_bandwidth); + interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; + ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, + interconnect->peak_bandwidth); if (ret) goto err_imem_path_disable; return 0; err_imem_path_disable: - (void)icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, - 0, 0); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + (void)icc_set_bw(interconnect->path, 0, 0); err_memory_path_disable: - (void)icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, - 0, 0); + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + (void)icc_set_bw(interconnect->path, 0, 0); return ret; } @@ -145,22 +161,23 @@ static int ipa_interconnect_enable(struct ipa *ipa) /* To disable an interconnect, we just its bandwidth to 0 */ static void ipa_interconnect_disable(struct ipa *ipa) { + struct ipa_interconnect *interconnect; struct ipa_clock *clock = ipa->clock; int result = 0; int ret; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_MEMORY]->path, - 0, 0); + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + ret = icc_set_bw(interconnect->path, 0, 0); if (ret) result = ret; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_IMEM]->path, - 0, 0); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ret = icc_set_bw(interconnect->path, 0, 0); if (ret && !result) result = ret; - ret = icc_set_bw(clock->interconnect[IPA_INTERCONNECT_CONFIG]->path, - 0, 0); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ret = icc_set_bw(interconnect->path, 0, 0); if (ret && !result) result = ret; @@ -286,9 +303,8 @@ ipa_clock_init(struct device *dev, const struct ipa_clock_data *data) goto err_clk_put; } clock->core = clk; - clock->interconnect_data = data->interconnect; - ret = ipa_interconnect_init(clock, dev); + ret = ipa_interconnect_init(clock, dev, data->interconnect); if (ret) goto err_kfree; From patchwork Fri Jan 15 12:50:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363596 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp265763jap; Fri, 15 Jan 2021 04:54:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJxF/f1gwrU85H9vkbcwqJo5dI3HXSUFzHcKoDSZiwRRctfjJ8VKCdESvIQR5NYpT58BrLsR X-Received: by 2002:a05:6402:3192:: with SMTP id di18mr9231535edb.332.1610715267118; Fri, 15 Jan 2021 04:54:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715267; cv=none; d=google.com; s=arc-20160816; b=c5D7iNDAAR+/k94Fp5McG8Oh9iav3IfJNr9MtyituslJQKhmA6fmlu9jpCv1PJhKlS S8XDePk+T6H0xi7nfM+1B0szye+g8Ruy7G+Lgybklh8pP5MDtX4bq9Bswi+xKh23AhYl 0WcDEO5tit2xcipKQqfjRFYubfF+LHAjcoannWGenoH7sB0OZvcsv7kgAzCX/YOGnf/g 8uYupn115TU+wWbd6YUxjkG6kdZXOikfoat1yuG+PeHeGN/w3zpVcD7pxdOD+R5EDqT2 /bHO09Zjyd4I1MJTmiGfLyRq9t6z0UEC28/ljl94DTRI0gCp+vsO3rnesugBPZb8xxwc Utsg== 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=XfRJBAuwxkFe9MRJG/5cSKWNhxAuQvwcEflUN1LY3nE=; b=wOZH98CGls3RpW/kH9CkChq393U+n4R0d75Rp/xfjqgZ12Az1jpKuEhr6lLAEOKdpV C012hSPpzpmEXkRSXl54ML3qQ0L6U5RKa500oiHIrEb8Sz7wWLYP4oDImf2yzcg7FUDq CEkJ0vdZ/m+IyMMdDCJ+Q4nG2qe7Vo98jxKj3QDVpP7ft/rPUzAq1mCtpAfgmsiBqKiH NgDrgp4l9TZj/5bmexzgUcDaVA7UYEGtJ10Qjb8Is/eAzOEHOwRzt52BBLV0R2DlUKvK IG7PF6DC55TlG+ae0i47B+11CGiL5xa7tvkrL1hn1ADo9NAW4CvwncmP+Sm0QBE2vd7X Do6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UnfYX33F; 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 a5si3624718ejr.334.2021.01.15.04.54.26; Fri, 15 Jan 2021 04:54:27 -0800 (PST) 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=UnfYX33F; 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 S2388455AbhAOMwS (ORCPT + 7 others); Fri, 15 Jan 2021 07:52:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388436AbhAOMwQ (ORCPT ); Fri, 15 Jan 2021 07:52:16 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B39FC06179E for ; Fri, 15 Jan 2021 04:50:59 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id u17so17892348iow.1 for ; Fri, 15 Jan 2021 04:50:59 -0800 (PST) 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=XfRJBAuwxkFe9MRJG/5cSKWNhxAuQvwcEflUN1LY3nE=; b=UnfYX33Fna0JZ/2Df+rkQOYbUBXHbLOe8AFwOyVCwgCfPnskCF5080GcDYg5UZqMic ppKwX00Z2MdsoiuYJtLOhzQY16GUJTypFje5NeApz+kBNwtIn7Gg349lFfLi+a9pUF/Y 0OtqPCHdH6S+gO0OojIYHXJWx8JS2jYO0Xv5phbiyhFhUw385Gl482XLLyP8LQbqKQ7T sKaQuxgblQwscKM70rwBneOmSF+WPL6FTkxT6d/ZffHk1QSybC9aLbgOopYjEcGxn/+j 6fAub15nhCmX4Qsenh1QABpwW+NJfe+Lj1x0fjnenIkYKzkYbmJERdIt+LNPJN5biOnR elQw== 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=XfRJBAuwxkFe9MRJG/5cSKWNhxAuQvwcEflUN1LY3nE=; b=e7DYwsd5GQaDZhvUdR4yHGT5KgIJiIbnqb/lopJQ971W4FHgivCiSw+TkD/4Wu7mEO S6dXCH4fZD3D93sUbR+2952l5wZd2U+E34OydAH4QMx1iHLdFcIyUAKT2octA5R721lK y8vFkag9+FrXlkrkthdEfY0ZdFQCsKboF4I/rrHUr8S84Ouj4m4TxfAIqqkr49fLeSP4 Ajxs/6TCIqXDzaY4MaVxVL7XX/uTCxVNHiYg7X4YhI/JbtG6BgL8k8VCQ8U+gt5rzDQj 6qPd2DNEdHElFVlCOlXsV/EPTMtUT8REAH15R2jaVOWb40hgw2zjVXDvEWs4vO7QbXnE VLFg== X-Gm-Message-State: AOAM532VBo+vFKS7bGlrfZ06EohDaS1uqoYEM25rPz76uto+HDZ2mA/4 tGgTtJnj1ubqLT/G/ibWTx0mVg== X-Received: by 2002:a92:154f:: with SMTP id v76mr10637337ilk.272.1610715058829; Fri, 15 Jan 2021 04:50:58 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:58 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 5/7] net: ipa: add interconnect name to configuration data Date: Fri, 15 Jan 2021 06:50:48 -0600 Message-Id: <20210115125050.20555-6-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Add the name to the configuration data for each interconnect. Use this information rather than a constant string during initialization. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 6 +++--- drivers/net/ipa/ipa_data-sc7180.c | 3 +++ drivers/net/ipa/ipa_data-sdm845.c | 3 +++ drivers/net/ipa/ipa_data.h | 2 ++ 4 files changed, 11 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 537c72b5267f6..07069dbc6d033 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -76,7 +76,7 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, struct ipa_interconnect *interconnect; struct icc_path *path; - path = ipa_interconnect_init_one(dev, "memory"); + path = ipa_interconnect_init_one(dev, data->name); if (IS_ERR(path)) goto err_return; interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; @@ -85,7 +85,7 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, interconnect->peak_bandwidth = data->peak_bandwidth; data++; - path = ipa_interconnect_init_one(dev, "imem"); + path = ipa_interconnect_init_one(dev, data->name); if (IS_ERR(path)) goto err_memory_path_put; interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; @@ -94,7 +94,7 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, interconnect->peak_bandwidth = data->peak_bandwidth; data++; - path = ipa_interconnect_init_one(dev, "config"); + path = ipa_interconnect_init_one(dev, data->name); if (IS_ERR(path)) goto err_imem_path_put; interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 491572c0a34dc..1936ecb4c1104 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -314,15 +314,18 @@ static struct ipa_clock_data ipa_clock_data = { /* Interconnect bandwidths are in 1000 byte/second units */ .interconnect = { [IPA_INTERCONNECT_MEMORY] = { + .name = "memory", .peak_bandwidth = 465000, /* 465 MBps */ .average_bandwidth = 80000, /* 80 MBps */ }, /* Average bandwidth unused for the next two interconnects */ [IPA_INTERCONNECT_IMEM] = { + .name = "imem", .peak_bandwidth = 68570, /* 68.57 MBps */ .average_bandwidth = 0, /* unused */ }, [IPA_INTERCONNECT_CONFIG] = { + .name = "config", .peak_bandwidth = 30000, /* 30 MBps */ .average_bandwidth = 0, /* unused */ }, diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index c62b86171b929..3b556b5a63406 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -334,15 +334,18 @@ static struct ipa_clock_data ipa_clock_data = { /* Interconnect bandwidths are in 1000 byte/second units */ .interconnect = { [IPA_INTERCONNECT_MEMORY] = { + .name = "memory", .peak_bandwidth = 600000, /* 600 MBps */ .average_bandwidth = 80000, /* 80 MBps */ }, /* Average bandwidth unused for the next two interconnects */ [IPA_INTERCONNECT_IMEM] = { + .name = "imem", .peak_bandwidth = 350000, /* 350 MBps */ .average_bandwidth = 0, /* unused */ }, [IPA_INTERCONNECT_CONFIG] = { + .name = "config", .peak_bandwidth = 40000, /* 40 MBps */ .average_bandwidth = 0, /* unused */ }, diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 96a9771a6cc05..d8ea6266dc6a1 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -268,10 +268,12 @@ enum ipa_interconnect_id { /** * struct ipa_interconnect_data - description of IPA interconnect bandwidths + * @name: Interconnect name (matches interconnect-name in DT) * @peak_bandwidth: Peak interconnect bandwidth (in 1000 byte/sec units) * @average_bandwidth: Average interconnect bandwidth (in 1000 byte/sec units) */ struct ipa_interconnect_data { + const char *name; u32 peak_bandwidth; u32 average_bandwidth; }; From patchwork Fri Jan 15 12:50:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363597 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp265778jap; Fri, 15 Jan 2021 04:54:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJytGYbg2jw3VVopqvVbWxC2DaM9NZkjbkFNWo5Kdf2DsQQr0kp0Qo+ZLxxh+120QPH7nZy4 X-Received: by 2002:a17:906:16cc:: with SMTP id t12mr8834695ejd.476.1610715268238; Fri, 15 Jan 2021 04:54:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715268; cv=none; d=google.com; s=arc-20160816; b=qAxqkOP2dKgselG33zidtemqaksXwErnQ+C6Ut/S7oNW23C9bgiz4LsqdyMRXVvA/C xCsUFdlsQGhn1uhdsu3voERaAtpmbI72mo70o+OSJgXLRGIqMVh4QyW9REdxC1KOIDLq TIjNar4wTRffIJ+bJkWaHuMMkrGb85poBcpDQWaLxyL/4k4o9QMHxzNYV1KDgNi8QO7L immgrBNxgPwpXG8+f8U4SpisFJG6tqbbo2GnivCxDKB1apm2UPeYFaQquo7rcnnVMJR7 rxoqSQVCpFIJd/vKnRbh8JigxIUlhZqsPl1aC2gu4nqB8qrfD4k521H71F6dYgU/5n+2 vjrA== 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=KhAlEdXMThb5bBjxNUO0atbOyb0X5NmtnPbjigJcPX0=; b=QMNFmwzKUEH4Uat1jrGpWXGci5Pga2WAkD04HPgFiX/uzojT4jf427BcIgZGBfNjBS uXZLS6BK0DiP6mcmbA0s6lSmKA0wjEMhTmmMNmZNc34+GU6VlTSdpm3OrhwiMKhrHVAh BS662YrsMCTALcqnUAX0zKdb7XXlna7qi4q+wyMhEikqX0B394Wq1Qu8wvoviVQAbOQJ 1oTFwZ1k2B684BBZf6vfIrXSE867IPE5sPY6wMfnYCjEEwCGrsIRMIQ2hYxb9kkJ8HMX B9BQXDmJUwHE7mXymE01Yy1flP5QSTPBx3Mzb6ETLDRXXbhQSwHSOdl36VxUtpuF2ga+ a71g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XcbVNYnF; 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 a5si3624718ejr.334.2021.01.15.04.54.27; Fri, 15 Jan 2021 04:54:28 -0800 (PST) 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=XcbVNYnF; 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 S1733217AbhAOMxP (ORCPT + 7 others); Fri, 15 Jan 2021 07:53:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388434AbhAOMwQ (ORCPT ); Fri, 15 Jan 2021 07:52:16 -0500 Received: from mail-io1-xd2f.google.com (mail-io1-xd2f.google.com [IPv6:2607:f8b0:4864:20::d2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 667A6C061757 for ; Fri, 15 Jan 2021 04:51:00 -0800 (PST) Received: by mail-io1-xd2f.google.com with SMTP id y19so17882636iov.2 for ; Fri, 15 Jan 2021 04:51:00 -0800 (PST) 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=KhAlEdXMThb5bBjxNUO0atbOyb0X5NmtnPbjigJcPX0=; b=XcbVNYnFm0Q9tvSFgVmPHnqvdtAxNA22pBZ5BXkb2H+gC5jMUcWwpP5qeY4iklbQHf CTt4VBlYHS+mu7cVqsu4OU71L3kgcUfIdcjpeF9/X3L0P/qHpETRfcH8j87OewHV5o0t m8Va+Ma8b+yJTHUt42VHWxho9bcQoPeVHVcawWx+uxC9R2fewQgolehSuDVaedVa4Cik VNU2InwbKumw0SsC9Bc6je3etvuCZLxXyY90SWPA+qhEbKhfL3pNOlGRg7qTaHkUr0T2 bdDm+fbT1+MYYpXrQsy7auKMO4DyIN8hVJAsaF1FMGxAKQs9GQEvX7tXI0/x3FSTiteR APEg== 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=KhAlEdXMThb5bBjxNUO0atbOyb0X5NmtnPbjigJcPX0=; b=EU9CVHu+7TJeh6pfCzDTT+KRfMDczsgicoSgrFN3xYMmnGght5gFLzar7+hM9mTubw Q6Kvo6LtyphZn7vZRHDbUl6ek2Ok7qdS9ZBw3yEXV3fGkcf5qyktVbhIuL1w9THiCguq EtElfybQ53LjaImkAkpUNtDwxemvF9wN5wLJBAB0XWsqbu8usHM8E9tqBt6PThLpLrJf kQFmcpXiVqf/Npdnd5C7ulYbrFkhezlWme+nJAsJohugEqy7PtIAz6eqsT4ZUZATqlIx UXUD6dgCko5ODAut0ibMWI17jyYNx/7dRbe9gN/aZhfC5VlZenSG//w0xGycpysizonz 8CSw== X-Gm-Message-State: AOAM531W4gTS8rs4Iss+aqSq+GBXy9OKlcvTvF3o4617AQGzH86fhOHR dUySt9lRfad3uSgCsnD6EWpaHQ== X-Received: by 2002:a92:c006:: with SMTP id q6mr10812282ild.115.1610715059855; Fri, 15 Jan 2021 04:50:59 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:50:59 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 6/7] net: ipa: clean up interconnect initialization Date: Fri, 15 Jan 2021 06:50:49 -0600 Message-Id: <20210115125050.20555-7-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Pass an the address of an IPA interconnect structure and its configuration data to ipa_interconnect_init_one() and have that function initialize all the structure's fields. Change the function to simply return an error code. Introduce ipa_interconnect_exit_one() to encapsulate the cleanup of an IPA interconnect structure. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 83 +++++++++++++++++++++---------------- 1 file changed, 47 insertions(+), 36 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index 07069dbc6d033..fbe42106fc2a8 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -56,17 +56,33 @@ struct ipa_clock { struct ipa_interconnect interconnect[IPA_INTERCONNECT_COUNT]; }; -static struct icc_path * -ipa_interconnect_init_one(struct device *dev, const char *name) +static int ipa_interconnect_init_one(struct device *dev, + struct ipa_interconnect *interconnect, + const struct ipa_interconnect_data *data) { struct icc_path *path; - path = of_icc_get(dev, name); - if (IS_ERR(path)) - dev_err(dev, "error %d getting %s interconnect\n", - (int)PTR_ERR(path), name); + path = of_icc_get(dev, data->name); + if (IS_ERR(path)) { + int ret = PTR_ERR(path); - return path; + dev_err(dev, "error %d getting %s interconnect\n", ret, + data->name); + + return ret; + } + + interconnect->path = path; + interconnect->average_bandwidth = data->average_bandwidth; + interconnect->peak_bandwidth = data->peak_bandwidth; + + return 0; +} + +static void ipa_interconnect_exit_one(struct ipa_interconnect *interconnect) +{ + icc_put(interconnect->path); + memset(interconnect, 0, sizeof(*interconnect)); } /* Initialize interconnects required for IPA operation */ @@ -74,51 +90,46 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, const struct ipa_interconnect_data *data) { struct ipa_interconnect *interconnect; - struct icc_path *path; + int ret; - path = ipa_interconnect_init_one(dev, data->name); - if (IS_ERR(path)) - goto err_return; interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - interconnect->path = path; - interconnect->average_bandwidth = data->average_bandwidth; - interconnect->peak_bandwidth = data->peak_bandwidth; - data++; + ret = ipa_interconnect_init_one(dev, interconnect, data++); + if (ret) + return ret; - path = ipa_interconnect_init_one(dev, data->name); - if (IS_ERR(path)) + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ret = ipa_interconnect_init_one(dev, interconnect, data++); + if (ret) goto err_memory_path_put; - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - interconnect->path = path; - interconnect->average_bandwidth = data->average_bandwidth; - interconnect->peak_bandwidth = data->peak_bandwidth; - data++; - path = ipa_interconnect_init_one(dev, data->name); - if (IS_ERR(path)) + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ret = ipa_interconnect_init_one(dev, interconnect, data++); + if (ret) goto err_imem_path_put; - interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; - interconnect->path = path; - interconnect->average_bandwidth = data->average_bandwidth; - interconnect->peak_bandwidth = data->peak_bandwidth; - data++; return 0; err_imem_path_put: - icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM].path); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ipa_interconnect_exit_one(interconnect); err_memory_path_put: - icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY].path); -err_return: - return PTR_ERR(path); + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + ipa_interconnect_exit_one(interconnect); + + return ret; } /* Inverse of ipa_interconnect_init() */ static void ipa_interconnect_exit(struct ipa_clock *clock) { - icc_put(clock->interconnect[IPA_INTERCONNECT_CONFIG].path); - icc_put(clock->interconnect[IPA_INTERCONNECT_IMEM].path); - icc_put(clock->interconnect[IPA_INTERCONNECT_MEMORY].path); + struct ipa_interconnect *interconnect; + + interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; + ipa_interconnect_exit_one(interconnect); + interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; + ipa_interconnect_exit_one(interconnect); + interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; + ipa_interconnect_exit_one(interconnect); } /* Currently we only use one bandwidth level, so just "enable" interconnects */ From patchwork Fri Jan 15 12:50:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 363594 Delivered-To: patch@linaro.org Received: by 2002:a02:ccad:0:0:0:0:0 with SMTP id t13csp264773jap; Fri, 15 Jan 2021 04:52:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJymvmCHMsN5IqhahewENLCwDiiVaU1eiotW6tCaf5VkfJd1hMLcRBE1+gfDC9lu77pjMpFU X-Received: by 2002:a17:906:cd06:: with SMTP id oz6mr8804259ejb.25.1610715173852; Fri, 15 Jan 2021 04:52:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715173; cv=none; d=google.com; s=arc-20160816; b=ymjykSYtftwNiSNVMUTJh0p76ocI4gGWbsRugtg3tbrQVFrbat8BifwUTtCewy6P/0 j1CSlKihkt3mGZgyzJO4xkHH19Qx6qEN/BliAenOBSluLCppNS76BsSd+bJ9HYwa1eop YM+oGbini/tjj87zcfKKa1T4oTCcAHqdVGAu9VdauvwtLCsqBkilY/ya6vvOH98abPze 037Bv27D7NT8cIa4vFj1u3bOGiLKEP8XYAI5E9aQ47cegLbLQxO+MiSqJbcWkvMgvRrA o5qQfW2kFTK8oW1AbVocDdd+o3v827Rk9LnGF41OvUI5I4Rx6eKpvzYIEw6LntZL0Tgl 85QA== 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=Fe7+Q07XvIDemNYgzpd5hvDoa6Ra86Jcn0hOhBFTqvA=; b=Oga/FP0s9CelR/DsFcs6xYs05sWkguwSyvMuCWLxx7AKwIoz1Zjo++NlNy8bLVBOlL iYc+F2YujffgB5upqqQomdbwL4n+NmitxeqCz8b1ztFX9uARjEku/HTQTBEIaEkmUt0G tx7RcCSW6zr4qcIxPTbKHZY63hbd6ZAwexa2rCxrQyR+ZYGyHw5ZeI5RK45SWCLn8+hl VJLnmZuDl4C6d9BiKUih9XYsqlkgs3lB8NQeDUI2BbZ5mL6cOdGi6JbK6sJOMJkkmuE6 urKKZq1CtsIG7F1K+YU4GPt8C3JKkAXlt7/OEGrLvdmrvlfu64L+eJxMzA+oTdI2Frqi lnvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XCg7Ra1c; 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 dp16si3572351ejc.564.2021.01.15.04.52.53; Fri, 15 Jan 2021 04:52:53 -0800 (PST) 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=XCg7Ra1c; 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 S2388439AbhAOMwA (ORCPT + 7 others); Fri, 15 Jan 2021 07:52:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388428AbhAOMv4 (ORCPT ); Fri, 15 Jan 2021 07:51:56 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77ACDC0617A1 for ; Fri, 15 Jan 2021 04:51:01 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id e22so17831832iom.5 for ; Fri, 15 Jan 2021 04:51:01 -0800 (PST) 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=Fe7+Q07XvIDemNYgzpd5hvDoa6Ra86Jcn0hOhBFTqvA=; b=XCg7Ra1cxB2rH9xWq7ElCtU+kicBeBEt56zjoDG7uCevi+Zz0lSvBvWbLpJ66bM6z/ YVXdlv5gCUXBKY8hJcHxiP3owVi+FmlrESHJ86w3NJ4zlDpmVziRiEcyr/10f7geXY9Y bHY2DgLvYi2r/Gil2B3GFIMesBTC9hIenNDn9rYp9hQXlP6VE16rIVCdYukZhJjTzbJu PslyljiEV/XuFue+Eq0G+VqhvEcQU4aYN0gEYDBfBxQmba0UCt+KGa7DcX098JtPrrbL Kk41jd8SeJTZXQBTy3Rd8MWs2OG7rsMN8pEmSbwHKC8ISON/FGsc9zTfSwGuLVc9V+vJ p//g== 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=Fe7+Q07XvIDemNYgzpd5hvDoa6Ra86Jcn0hOhBFTqvA=; b=p4T34ZaOUBdDPDzm3hIwbqE2DRMKJT6RRkcWgiEBN/0xNkZcWfjSjM+Gz5J3lZLQzW M1HiewgKJ5gWQoakSjkIfyxcmyc4YwEK6OIgidv0WQWEYCym72SGWeLID5bi14N7jjc7 iCL3NvS5EnqdncTQEw+gUgsKzKMUyE+86lU4FMMHLjNy3yV2hVzltMzff13lBapqCxK1 97wZ/uAe3ObMk7nEaBtWmNGGrnglmtRP6ZgQzCK8SaNkjOrSoyfphcSCPoXdgLF0mmsN zdkpjVkORuxJbjOOPw5U2/tIMPtLxwKB1CAn4/XdfvjRApGy2wyaw2f4lqHhVfUn7oTg EiGg== X-Gm-Message-State: AOAM533+2AvScAsllbuWDUkpKlx50sipYov4rGPry8Mg+QXhuMZkW1ty uiWlY5L7PHUnPQdYAcExiJ+KcA== X-Received: by 2002:a05:6e02:973:: with SMTP id q19mr10511266ilt.21.1610715060846; Fri, 15 Jan 2021 04:51:00 -0800 (PST) Received: from beast.localdomain (c-73-185-129-58.hsd1.mn.comcast.net. [73.185.129.58]) by smtp.gmail.com with ESMTPSA id f13sm3952450iog.18.2021.01.15.04.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Jan 2021 04:51:00 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, bjorn.andersson@linaro.org, cpratapa@codeaurora.org, subashab@codeaurora.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 7/7] net: ipa: allow arbitrary number of interconnects Date: Fri, 15 Jan 2021 06:50:50 -0600 Message-Id: <20210115125050.20555-8-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210115125050.20555-1-elder@linaro.org> References: <20210115125050.20555-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Currently we assume that the IPA hardware has exactly three interconnects. But that won't be guaranteed for all platforms, so allow any number of interconnects to be specified in the configuration data. For each platform, define an array of interconnect data entries (still associated with the IPA clock structure), and record the number of entries initialized in that array. Loop over all entries in this array when initializing, enabling, disabling, or tearing down the set of interconnects. With this change we no longer need the ipa_interconnect_id enumerated type, so get rid of it. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 113 +++++++++++++----------------- drivers/net/ipa/ipa_data-sc7180.c | 41 ++++++----- drivers/net/ipa/ipa_data-sdm845.c | 41 ++++++----- drivers/net/ipa/ipa_data.h | 14 ++-- 4 files changed, 97 insertions(+), 112 deletions(-) -- 2.20.1 diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index fbe42106fc2a8..354675a643db5 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -47,13 +47,15 @@ struct ipa_interconnect { * @count: Clocking reference count * @mutex: Protects clock enable/disable * @core: IPA core clock + * @interconnect_count: Number of elements in interconnect[] * @interconnect: Interconnect array */ struct ipa_clock { refcount_t count; struct mutex mutex; /* protects clock enable/disable */ struct clk *core; - struct ipa_interconnect interconnect[IPA_INTERCONNECT_COUNT]; + u32 interconnect_count; + struct ipa_interconnect *interconnect; }; static int ipa_interconnect_init_one(struct device *dev, @@ -90,31 +92,29 @@ static int ipa_interconnect_init(struct ipa_clock *clock, struct device *dev, const struct ipa_interconnect_data *data) { struct ipa_interconnect *interconnect; + u32 count; int ret; - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - ret = ipa_interconnect_init_one(dev, interconnect, data++); - if (ret) - return ret; + count = clock->interconnect_count; + interconnect = kcalloc(count, sizeof(*interconnect), GFP_KERNEL); + if (!interconnect) + return -ENOMEM; + clock->interconnect = interconnect; - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ret = ipa_interconnect_init_one(dev, interconnect, data++); - if (ret) - goto err_memory_path_put; - - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ret = ipa_interconnect_init_one(dev, interconnect, data++); - if (ret) - goto err_imem_path_put; + while (count--) { + ret = ipa_interconnect_init_one(dev, interconnect, data++); + if (ret) + goto out_unwind; + interconnect++; + } return 0; -err_imem_path_put: - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ipa_interconnect_exit_one(interconnect); -err_memory_path_put: - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - ipa_interconnect_exit_one(interconnect); +out_unwind: + while (interconnect-- > clock->interconnect) + ipa_interconnect_exit_one(interconnect); + kfree(clock->interconnect); + clock->interconnect = NULL; return ret; } @@ -124,12 +124,11 @@ static void ipa_interconnect_exit(struct ipa_clock *clock) { struct ipa_interconnect *interconnect; - interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; - ipa_interconnect_exit_one(interconnect); - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ipa_interconnect_exit_one(interconnect); - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - ipa_interconnect_exit_one(interconnect); + interconnect = clock->interconnect + clock->interconnect_count; + while (interconnect-- > clock->interconnect) + ipa_interconnect_exit_one(interconnect); + kfree(clock->interconnect); + clock->interconnect = NULL; } /* Currently we only use one bandwidth level, so just "enable" interconnects */ @@ -138,33 +137,23 @@ static int ipa_interconnect_enable(struct ipa *ipa) struct ipa_interconnect *interconnect; struct ipa_clock *clock = ipa->clock; int ret; + u32 i; - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, - interconnect->peak_bandwidth); - if (ret) - return ret; - - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, - interconnect->peak_bandwidth); - if (ret) - goto err_memory_path_disable; - - interconnect = &clock->interconnect[IPA_INTERCONNECT_CONFIG]; - ret = icc_set_bw(interconnect->path, interconnect->average_bandwidth, - interconnect->peak_bandwidth); - if (ret) - goto err_imem_path_disable; + interconnect = clock->interconnect; + for (i = 0; i < clock->interconnect_count; i++) { + ret = icc_set_bw(interconnect->path, + interconnect->average_bandwidth, + interconnect->peak_bandwidth); + if (ret) + goto out_unwind; + interconnect++; + } return 0; -err_imem_path_disable: - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - (void)icc_set_bw(interconnect->path, 0, 0); -err_memory_path_disable: - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - (void)icc_set_bw(interconnect->path, 0, 0); +out_unwind: + while (interconnect-- > clock->interconnect) + (void)icc_set_bw(interconnect->path, 0, 0); return ret; } @@ -175,22 +164,17 @@ static void ipa_interconnect_disable(struct ipa *ipa) struct ipa_interconnect *interconnect; struct ipa_clock *clock = ipa->clock; int result = 0; + u32 count; int ret; - interconnect = &clock->interconnect[IPA_INTERCONNECT_MEMORY]; - ret = icc_set_bw(interconnect->path, 0, 0); - if (ret) - result = ret; - - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(interconnect->path, 0, 0); - if (ret && !result) - result = ret; - - interconnect = &clock->interconnect[IPA_INTERCONNECT_IMEM]; - ret = icc_set_bw(interconnect->path, 0, 0); - if (ret && !result) - result = ret; + count = clock->interconnect_count; + interconnect = clock->interconnect + count; + while (count--) { + interconnect--; + ret = icc_set_bw(interconnect->path, 0, 0); + if (ret && !result) + result = ret; + } if (result) dev_err(&ipa->pdev->dev, @@ -314,8 +298,9 @@ ipa_clock_init(struct device *dev, const struct ipa_clock_data *data) goto err_clk_put; } clock->core = clk; + clock->interconnect_count = data->interconnect_count; - ret = ipa_interconnect_init(clock, dev, data->interconnect); + ret = ipa_interconnect_init(clock, dev, data->interconnect_data); if (ret) goto err_kfree; diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 1936ecb4c1104..997b51ceb7d76 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -309,27 +309,30 @@ static struct ipa_mem_data ipa_mem_data = { .smem_size = 0x00002000, }; +/* Interconnect bandwidths are in 1000 byte/second units */ +static struct ipa_interconnect_data ipa_interconnect_data[] = { + { + .name = "memory", + .peak_bandwidth = 465000, /* 465 MBps */ + .average_bandwidth = 80000, /* 80 MBps */ + }, + /* Average bandwidth is unused for the next two interconnects */ + { + .name = "imem", + .peak_bandwidth = 68570, /* 68.570 MBps */ + .average_bandwidth = 0, /* unused */ + }, + { + .name = "config", + .peak_bandwidth = 30000, /* 30 MBps */ + .average_bandwidth = 0, /* unused */ + }, +}; + static struct ipa_clock_data ipa_clock_data = { .core_clock_rate = 100 * 1000 * 1000, /* Hz */ - /* Interconnect bandwidths are in 1000 byte/second units */ - .interconnect = { - [IPA_INTERCONNECT_MEMORY] = { - .name = "memory", - .peak_bandwidth = 465000, /* 465 MBps */ - .average_bandwidth = 80000, /* 80 MBps */ - }, - /* Average bandwidth unused for the next two interconnects */ - [IPA_INTERCONNECT_IMEM] = { - .name = "imem", - .peak_bandwidth = 68570, /* 68.57 MBps */ - .average_bandwidth = 0, /* unused */ - }, - [IPA_INTERCONNECT_CONFIG] = { - .name = "config", - .peak_bandwidth = 30000, /* 30 MBps */ - .average_bandwidth = 0, /* unused */ - }, - }, + .interconnect_count = ARRAY_SIZE(ipa_interconnect_data), + .interconnect_data = ipa_interconnect_data, }; /* Configuration data for the SC7180 SoC. */ diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index 3b556b5a63406..88c9c3562ab79 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -329,27 +329,30 @@ static struct ipa_mem_data ipa_mem_data = { .smem_size = 0x00002000, }; +/* Interconnect bandwidths are in 1000 byte/second units */ +static struct ipa_interconnect_data ipa_interconnect_data[] = { + { + .name = "memory", + .peak_bandwidth = 600000, /* 600 MBps */ + .average_bandwidth = 80000, /* 80 MBps */ + }, + /* Average bandwidth is unused for the next two interconnects */ + { + .name = "imem", + .peak_bandwidth = 350000, /* 350 MBps */ + .average_bandwidth = 0, /* unused */ + }, + { + .name = "config", + .peak_bandwidth = 40000, /* 40 MBps */ + .average_bandwidth = 0, /* unused */ + }, +}; + static struct ipa_clock_data ipa_clock_data = { .core_clock_rate = 75 * 1000 * 1000, /* Hz */ - /* Interconnect bandwidths are in 1000 byte/second units */ - .interconnect = { - [IPA_INTERCONNECT_MEMORY] = { - .name = "memory", - .peak_bandwidth = 600000, /* 600 MBps */ - .average_bandwidth = 80000, /* 80 MBps */ - }, - /* Average bandwidth unused for the next two interconnects */ - [IPA_INTERCONNECT_IMEM] = { - .name = "imem", - .peak_bandwidth = 350000, /* 350 MBps */ - .average_bandwidth = 0, /* unused */ - }, - [IPA_INTERCONNECT_CONFIG] = { - .name = "config", - .peak_bandwidth = 40000, /* 40 MBps */ - .average_bandwidth = 0, /* unused */ - }, - }, + .interconnect_count = ARRAY_SIZE(ipa_interconnect_data), + .interconnect_data = ipa_interconnect_data, }; /* Configuration data for the SDM845 SoC. */ diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index d8ea6266dc6a1..b476fc373f7fe 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -258,14 +258,6 @@ struct ipa_mem_data { u32 smem_size; }; -/** enum ipa_interconnect_id - IPA interconnect identifier */ -enum ipa_interconnect_id { - IPA_INTERCONNECT_MEMORY, - IPA_INTERCONNECT_IMEM, - IPA_INTERCONNECT_CONFIG, - IPA_INTERCONNECT_COUNT, /* Last; not an interconnect */ -}; - /** * struct ipa_interconnect_data - description of IPA interconnect bandwidths * @name: Interconnect name (matches interconnect-name in DT) @@ -281,11 +273,13 @@ struct ipa_interconnect_data { /** * struct ipa_clock_data - description of IPA clock and interconnect rates * @core_clock_rate: Core clock rate (Hz) - * @interconnect: Array of interconnect bandwidth parameters + * @interconnect_count: Number of entries in the interconnect_data array + * @interconnect_data: IPA interconnect configuration data */ struct ipa_clock_data { u32 core_clock_rate; - struct ipa_interconnect_data interconnect[IPA_INTERCONNECT_COUNT]; + u32 interconnect_count; /* # entries in interconnect_data[] */ + const struct ipa_interconnect_data *interconnect_data; }; /**