From patchwork Thu Nov 19 22:40:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11919101 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7114CC6379D for ; Thu, 19 Nov 2020 22:41:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0AD2122267 for ; Thu, 19 Nov 2020 22:41:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Y/fqlOr0" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726754AbgKSWkt (ORCPT ); Thu, 19 Nov 2020 17:40:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726198AbgKSWks (ORCPT ); Thu, 19 Nov 2020 17:40:48 -0500 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAF6FC0613CF for ; Thu, 19 Nov 2020 14:40:47 -0800 (PST) Received: by mail-io1-xd44.google.com with SMTP id m9so7882167iox.10 for ; Thu, 19 Nov 2020 14:40:47 -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=Wz7gXC8ze/fDTzyrxDiiPOcQHm+Sr4yptt5JBx9VBH0=; b=Y/fqlOr0kTK4g+x9HK55Xee5JYJKvPMPwwKHsYB+9lFJlEX7Zg9vD1vyDfLz5tNkWP H5wEEUt701tK4zz3+QHBbdmFYEEQXesa8bWieBCxCLu0OqMM33eBmDHz7Wo2Nl64tYVh 0TRq/4j49ZUlBbedAYcWWYooOijiEtdu5m1wj7xv++C8/fKd0T6QA1jRFnGTCYm6KvB1 o/MeyYyt77frxvIoD0XDzNgc03W+ye9Au3MRRmTd2rEtrGPSAMZT+W1Ley5NqyCKs0uZ FpYMUc6191gljBQZ+a5wK17TRrrjOp4n77JMQhk4P/51WHEeDv9u22MxTOgCt2rMZMUl 2dqQ== 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=Wz7gXC8ze/fDTzyrxDiiPOcQHm+Sr4yptt5JBx9VBH0=; b=N4LTZY8O8QNiNaN6zrraVJ9SGDrE4APjpe3ts5+ko37WNnqP++m/fzSogkqCTHmLJh kGqcenPUACpM4S67B3JMD3+NBhkNNCP+U6OzMWdeJA7gC8uPYghjb6G/dI9DsWkkxUmk WuZieEokoyzXvzfJWymTVP7Y+Nuu/ZGuZmJbPPDCLqQ3xvT0v4bffg1irwUagPlFxqm0 Ry07Xm+ONMa9oJknJt97VqzAhF4JeEThydsVcctHqNgzX7VKX9QM9EsLclclfjX3uFu0 RmSo/lryQgQdZpITmPnJ07d7ClF7ILHOiqA9dqmc57JIWTwInjDKMeHjm19y7ygFsZAp z4SQ== X-Gm-Message-State: AOAM533qaAk0ZAJGcxQzTJIKsh7XYm6Lj7sXwlgejiqrOTHt/ygtnLPp 0vDBQsieGp3YHHz+63f/kP6kIQ== X-Google-Smtp-Source: ABdhPJymIWKuw0w/AMzcZYge4ePtKwYp/8M71guyt/RTUVUtkJ1C7excrhNy5gH4TWvBk86pGX/DBQ== X-Received: by 2002:a6b:6217:: with SMTP id f23mr15683303iog.201.1605825647335; Thu, 19 Nov 2020 14:40:47 -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 b4sm587797ile.13.2020.11.19.14.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 14:40:46 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/3] net: ipa: define clock and interconnect data Date: Thu, 19 Nov 2020 16:40:39 -0600 Message-Id: <20201119224041.16066-2-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119224041.16066-1-elder@linaro.org> References: <20201119224041.16066-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Define a new type of configuration data, used to initialize the IPA core clock and interconnects. This is the first of three patches, and defines the data types and interface but doesn't yet use them. Switch the return value if there is no matching configuration data to ENODEV instead of ENOTSUPP (to avoid using the nonstandard errno). Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 7 ++++++- drivers/net/ipa/ipa_clock.h | 5 ++++- drivers/net/ipa/ipa_data.h | 31 ++++++++++++++++++++++++++++++- drivers/net/ipa/ipa_main.c | 21 ++++++++++----------- 4 files changed, 50 insertions(+), 14 deletions(-) diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index a2c0fde058199..ef343669280ef 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -13,6 +13,7 @@ #include "ipa.h" #include "ipa_clock.h" #include "ipa_modem.h" +#include "ipa_data.h" /** * DOC: IPA Clocking @@ -49,6 +50,7 @@ * @memory_path: Memory interconnect * @imem_path: Internal memory interconnect * @config_path: Configuration space interconnect + * @interconnect_data: Interconnect configuration data */ struct ipa_clock { refcount_t count; @@ -57,6 +59,7 @@ struct ipa_clock { struct icc_path *memory_path; struct icc_path *imem_path; struct icc_path *config_path; + const struct ipa_interconnect_data *interconnect_data; }; static struct icc_path * @@ -257,7 +260,8 @@ u32 ipa_clock_rate(struct ipa *ipa) } /* Initialize IPA clocking */ -struct ipa_clock *ipa_clock_init(struct device *dev) +struct ipa_clock * +ipa_clock_init(struct device *dev, const struct ipa_clock_data *data) { struct ipa_clock *clock; struct clk *clk; @@ -282,6 +286,7 @@ struct ipa_clock *ipa_clock_init(struct device *dev) goto err_clk_put; } clock->core = clk; + clock->interconnect_data = data->interconnect; ret = ipa_interconnect_init(clock, dev); if (ret) diff --git a/drivers/net/ipa/ipa_clock.h b/drivers/net/ipa/ipa_clock.h index 1d70f1de3875b..1fe634760e59d 100644 --- a/drivers/net/ipa/ipa_clock.h +++ b/drivers/net/ipa/ipa_clock.h @@ -9,6 +9,7 @@ struct device; struct ipa; +struct ipa_clock_data; /** * ipa_clock_rate() - Return the current IPA core clock rate @@ -21,10 +22,12 @@ u32 ipa_clock_rate(struct ipa *ipa); /** * ipa_clock_init() - Initialize IPA clocking * @dev: IPA device + * @data: Clock configuration data * * Return: A pointer to an ipa_clock structure, or a pointer-coded error */ -struct ipa_clock *ipa_clock_init(struct device *dev); +struct ipa_clock *ipa_clock_init(struct device *dev, + const struct ipa_clock_data *data); /** * ipa_clock_exit() - Inverse of ipa_clock_init() diff --git a/drivers/net/ipa/ipa_data.h b/drivers/net/ipa/ipa_data.h index 83c4b78373efb..0ed5ffe2b8da0 100644 --- a/drivers/net/ipa/ipa_data.h +++ b/drivers/net/ipa/ipa_data.h @@ -241,7 +241,7 @@ struct ipa_resource_data { }; /** - * struct ipa_mem - description of IPA memory regions + * struct ipa_mem_data - description of IPA memory regions * @local_count: number of regions defined in the local[] array * @local: array of IPA-local memory region descriptors * @imem_addr: physical address of IPA region within IMEM @@ -258,6 +258,34 @@ 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 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 { + u32 peak_rate; + u32 average_rate; +}; + +/** + * struct ipa_clock_data - description of IPA clock and interconnect rates + * @core_clock_rate: Core clock rate (Hz) + * @interconnect: Array of interconnect bandwidth parameters + */ +struct ipa_clock_data { + u32 core_clock_rate; + struct ipa_interconnect_data interconnect[IPA_INTERCONNECT_COUNT]; +}; + /** * struct ipa_data - combined IPA/GSI configuration data * @version: IPA hardware version @@ -273,6 +301,7 @@ struct ipa_data { const struct ipa_gsi_endpoint_data *endpoint_data; const struct ipa_resource_data *resource_data; const struct ipa_mem_data *mem_data; + const struct ipa_clock_data *clock_data; }; extern const struct ipa_data ipa_data_sdm845; diff --git a/drivers/net/ipa/ipa_main.c b/drivers/net/ipa/ipa_main.c index 3fb9c5d90b70e..468ab1acc20e0 100644 --- a/drivers/net/ipa/ipa_main.c +++ b/drivers/net/ipa/ipa_main.c @@ -728,6 +728,14 @@ static int ipa_probe(struct platform_device *pdev) ipa_validate_build(); + /* Get configuration data early; needed for clock initialization */ + data = of_device_get_match_data(dev); + if (!data) { + /* This is really IPA_VALIDATE (should never happen) */ + dev_err(dev, "matched hardware not supported\n"); + return -ENODEV; + } + /* If we need Trust Zone, make sure it's available */ modem_init = of_property_read_bool(dev->of_node, "modem-init"); if (!modem_init) @@ -748,22 +756,13 @@ static int ipa_probe(struct platform_device *pdev) /* The clock and interconnects might not be ready when we're * probed, so might return -EPROBE_DEFER. */ - clock = ipa_clock_init(dev); + clock = ipa_clock_init(dev, data->clock_data); if (IS_ERR(clock)) { ret = PTR_ERR(clock); goto err_rproc_put; } - /* No more EPROBE_DEFER. Get our configuration data */ - data = of_device_get_match_data(dev); - if (!data) { - /* This is really IPA_VALIDATE (should never happen) */ - dev_err(dev, "matched hardware not supported\n"); - ret = -ENOTSUPP; - goto err_clock_exit; - } - - /* Allocate and initialize the IPA structure */ + /* No more EPROBE_DEFER. Allocate and initialize the IPA structure */ ipa = kzalloc(sizeof(*ipa), GFP_KERNEL); if (!ipa) { ret = -ENOMEM; From patchwork Thu Nov 19 22:40:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11919107 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BBD1C64E75 for ; Thu, 19 Nov 2020 22:41:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C0632224D for ; Thu, 19 Nov 2020 22:41:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R/z87x2Z" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726878AbgKSWkz (ORCPT ); Thu, 19 Nov 2020 17:40:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726529AbgKSWku (ORCPT ); Thu, 19 Nov 2020 17:40:50 -0500 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A062C0613D4 for ; Thu, 19 Nov 2020 14:40:49 -0800 (PST) Received: by mail-io1-xd43.google.com with SMTP id r1so7881229iob.13 for ; Thu, 19 Nov 2020 14:40:49 -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=4R2ny0eNytCOsjqToYvvw7xFj0yITV9HLKMp6fS2QIY=; b=R/z87x2ZYzGvDpZBP1BsgoS92JpA1eUs6xi8CcUAv/txyTA5TZKdw4xF+rEwMxmLB4 Cnrl/JEqGJnhvHay8Y7hicOJ8mdaP/s3iJ/1+xLwDAURbVtuXaGJXI+2OafnYk81STuk 14+uFm4uzRnELrjzPiQMBax3Ln9Ujn2AZRqAVkHf9MKQ3ICwTL/xYAlhu9p4fvOGOoEP fnA23dV4RHpagOItr/q5QkWnuHuUOWqNUmz9plWkJfYWufdUgx1HbWEcWyxxYX1P+Pjf x/7FKR6l5KJbxxB/76y2DACBTDx54faF0zuUYR4mXFfuUlByHJLg/FUlRyK0dq/hxcmh wYIw== 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=4R2ny0eNytCOsjqToYvvw7xFj0yITV9HLKMp6fS2QIY=; b=CjvMwhh9WaNH4dX4SOA8d1cLW3R+jK4j854MmcFrJ0fKyKYyyO/dZ4/I/KCGfv3USJ zxflN5DLpnfssWMz2V9xoGX5NJHQde2C5CzRd6X/592+wKan3P9b3ZyrYpODx93tS8gr Jro+SRE0hnjOV/7yImAe37m7Z9mh3tP3rki3VEgTLnNkJxEf+8LtZP4AjtP6WxlhD0in 9zxguanX1hpIsxrSoxwqhNnJQLP8K0PHrifidlgQPjWUTd4wLjHgza/NtATc6SvRpfHR tKky2sQfZr8X/BeyDZpIg2Yaze272CjAsToGbBr+2MpM1Zw4weRyNyOYVrbcdfzC8tWr UBCg== X-Gm-Message-State: AOAM533XrOdfWXtC8zwhRTu6odfvbX9wCErJ3k45QbldQZ+5gKOZsSpi ABdKuoTX/rZBofFJ2wQrDHdJFQ== X-Google-Smtp-Source: ABdhPJz/JAW+LKnwbhIroeL7GZKmLRwRvHIK21KvGw6ga1qQr/wE0hAdXHkXGm83OcdEeHSm4fPhLQ== X-Received: by 2002:a05:6638:a27:: with SMTP id 7mr11425145jao.25.1605825648579; Thu, 19 Nov 2020 14:40:48 -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 b4sm587797ile.13.2020.11.19.14.40.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 14:40:47 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 2/3] net: ipa: populate clock and interconnect data Date: Thu, 19 Nov 2020 16:40:40 -0600 Message-Id: <20201119224041.16066-3-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119224041.16066-1-elder@linaro.org> References: <20201119224041.16066-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Populate the core clock rate and interconnect average and peak bandwidth data for SDM845 and SC7180 in their configuration data files. At this point we still don't *use* this data. Note that SC7180 actually defines a new core clock rate (100 MHz instead of 75 MHz) and new interconnect bandwidth values. They will be activated in the next commit, which uses the configured values rather than the fixed constants. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_data-sc7180.c | 21 +++++++++++++++++++++ drivers/net/ipa/ipa_data-sdm845.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/net/ipa/ipa_data-sc7180.c b/drivers/net/ipa/ipa_data-sc7180.c index 37dada4da6808..5cc0ed77edb9c 100644 --- a/drivers/net/ipa/ipa_data-sc7180.c +++ b/drivers/net/ipa/ipa_data-sc7180.c @@ -309,6 +309,26 @@ static struct ipa_mem_data ipa_mem_data = { .smem_size = 0x00002000, }; +static struct ipa_clock_data ipa_clock_data = { + .core_clock_rate = 100 * 1000 * 1000, /* Hz */ + /* Interconnect rates are in 1000 byte/second units */ + .interconnect = { + [IPA_INTERCONNECT_MEMORY] = { + .peak_rate = 465000, /* 465 MBps */ + .average_rate = 80000, /* 80 MBps */ + }, + /* Average rate is unused for the next two interconnects */ + [IPA_INTERCONNECT_IMEM] = { + .peak_rate = 68570, /* 68.570 MBps */ + .average_rate = 0, /* unused */ + }, + [IPA_INTERCONNECT_CONFIG] = { + .peak_rate = 30000, /* 30 MBps */ + .average_rate = 0, /* unused */ + }, + }, +}; + /* Configuration data for the SC7180 SoC. */ const struct ipa_data ipa_data_sc7180 = { .version = IPA_VERSION_4_2, @@ -316,4 +336,5 @@ const struct ipa_data ipa_data_sc7180 = { .endpoint_data = ipa_gsi_endpoint_data, .resource_data = &ipa_resource_data, .mem_data = &ipa_mem_data, + .clock_data = &ipa_clock_data, }; diff --git a/drivers/net/ipa/ipa_data-sdm845.c b/drivers/net/ipa/ipa_data-sdm845.c index bd92b619e7fec..f8fee8d3ca42a 100644 --- a/drivers/net/ipa/ipa_data-sdm845.c +++ b/drivers/net/ipa/ipa_data-sdm845.c @@ -329,6 +329,26 @@ static struct ipa_mem_data ipa_mem_data = { .smem_size = 0x00002000, }; +static struct ipa_clock_data ipa_clock_data = { + .core_clock_rate = 75 * 1000 * 1000, /* Hz */ + /* Interconnect rates are in 1000 byte/second units */ + .interconnect = { + [IPA_INTERCONNECT_MEMORY] = { + .peak_rate = 600000, /* 600 MBps */ + .average_rate = 80000, /* 80 MBps */ + }, + /* Average rate is unused for the next two interconnects */ + [IPA_INTERCONNECT_IMEM] = { + .peak_rate = 350000, /* 350 MBps */ + .average_rate = 0, /* unused */ + }, + [IPA_INTERCONNECT_CONFIG] = { + .peak_rate = 40000, /* 40 MBps */ + .average_rate = 0, /* unused */ + }, + }, +}; + /* Configuration data for the SDM845 SoC. */ const struct ipa_data ipa_data_sdm845 = { .version = IPA_VERSION_3_5_1, @@ -336,4 +356,5 @@ const struct ipa_data ipa_data_sdm845 = { .endpoint_data = ipa_gsi_endpoint_data, .resource_data = &ipa_resource_data, .mem_data = &ipa_mem_data, + .clock_data = &ipa_clock_data, }; From patchwork Thu Nov 19 22:40:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 11919103 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 275D1C64E69 for ; Thu, 19 Nov 2020 22:41:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C983D20BED for ; Thu, 19 Nov 2020 22:41:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="R95lTJA4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726920AbgKSWkz (ORCPT ); Thu, 19 Nov 2020 17:40:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726791AbgKSWkv (ORCPT ); Thu, 19 Nov 2020 17:40:51 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EB6DC0617A7 for ; Thu, 19 Nov 2020 14:40:50 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id y9so6896215ilb.0 for ; Thu, 19 Nov 2020 14:40:50 -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=OOSsF7KnxFiHnRY0GY2iUK6XWu8gB3i6mV+T4+SlcUs=; b=R95lTJA4IP1J1OO+QCE2nzBGjLaWqo+e9QFoqUa3A7O7xI3pKQ4r0uG4HT4Jz67IUm whiNfCSA+tDFO3KaafhnjbDo2y6/qPsh7rhnFGHRTv8Lq8dQ8VuTLi7ld4o0kc/6gFql cxzbEoCamnJ6ymEaOUox37s6nEcaowVc5XJmlmbXm/Xjv5MDpLy5q/NRoxRP1M8cEOFg ORv161ukmdMhWu8OMMAgnUp799EYwsrg4rCWaMZzTtgt3ZrhKLurZg5TEtdOftIrAlGi XOv1qy/ClMZXVjO2fdH7ywR3Umxx3n+JILYv4Gx0wmjFBQm0NjloTdfFRLmkDcDP4pWV +oBg== 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=OOSsF7KnxFiHnRY0GY2iUK6XWu8gB3i6mV+T4+SlcUs=; b=lBH7orBWwjvGV/YjlowydYgHuc/Sl1MvVMogYvjp1EaOcdBvXPfDaORoHI8vuLe4fB RQv+ou/CISRDn+agkGHwrM2dP/o9QcT8E4nAZlSZtpzdiCxMAsiJjaCmihGZ7dCGm2lQ dfgK0+ALipvbYo4shLsyKTbHqSG4fMnW66NEn95mnjswsGAvl4AzEdEXPZLXwPNWB8hS 3QUJjHlKRvdl+r2Tea0Ps2O0iCTMT+c3Y+/U94uk4U2GJo7S1y99MsDlcJYfk6PIYWfA A/qDfs0tJqJgmBSc/QxUVFidD9jcD3Y5M3SBOkF8bzX1+bBeBXP1cgpCiUrnVdSt9Wiv dE+A== X-Gm-Message-State: AOAM533v1ilFHAJmL5yOjqPo9dFnlr+JqSX/HTxlik5iKDTcTmEGTO6o XAFNLEwFx1vgbfN6QuiEr27oLA== X-Google-Smtp-Source: ABdhPJza97JlcTNihMoQGiobgh1N6Iww+mRwBtUxxzJD3ZmxFQlJhkmVeLvYXNTgwB3M+a/Cm8ma2A== X-Received: by 2002:a05:6e02:92f:: with SMTP id o15mr23878207ilt.169.1605825649701; Thu, 19 Nov 2020 14:40:49 -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 b4sm587797ile.13.2020.11.19.14.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Nov 2020 14:40:49 -0800 (PST) From: Alex Elder To: davem@davemloft.net, kuba@kernel.org Cc: evgreen@chromium.org, subashab@codeaurora.org, cpratapa@codeaurora.org, bjorn.andersson@linaro.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/3] net: ipa: use config data for clocking Date: Thu, 19 Nov 2020 16:40:41 -0600 Message-Id: <20201119224041.16066-4-elder@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201119224041.16066-1-elder@linaro.org> References: <20201119224041.16066-1-elder@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Stop assuming a fixed IPA core clock rate and interconnect bandwidths. Use the configuration data defined for these things instead. Get rid of the previously-used constants. Signed-off-by: Alex Elder --- drivers/net/ipa/ipa_clock.c | 40 ++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/drivers/net/ipa/ipa_clock.c b/drivers/net/ipa/ipa_clock.c index ef343669280ef..9dcf16f399b7a 100644 --- a/drivers/net/ipa/ipa_clock.c +++ b/drivers/net/ipa/ipa_clock.c @@ -30,18 +30,6 @@ * An IPA clock reference must be held for any access to IPA hardware. */ -#define IPA_CORE_CLOCK_RATE (75UL * 1000 * 1000) /* Hz */ - -/* Interconnect path bandwidths (each times 1000 bytes per second) */ -#define IPA_MEMORY_AVG (80 * 1000) /* 80 MBps */ -#define IPA_MEMORY_PEAK (600 * 1000) - -#define IPA_IMEM_AVG (80 * 1000) -#define IPA_IMEM_PEAK (350 * 1000) - -#define IPA_CONFIG_AVG (40 * 1000) -#define IPA_CONFIG_PEAK (40 * 1000) - /** * struct ipa_clock - IPA clocking information * @count: Clocking reference count @@ -116,18 +104,25 @@ static void ipa_interconnect_exit(struct ipa_clock *clock) /* 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_clock *clock = ipa->clock; int ret; - ret = icc_set_bw(clock->memory_path, IPA_MEMORY_AVG, IPA_MEMORY_PEAK); + data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; + ret = icc_set_bw(clock->memory_path, data->average_rate, + data->peak_rate); if (ret) return ret; - ret = icc_set_bw(clock->imem_path, IPA_IMEM_AVG, IPA_IMEM_PEAK); + data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; + ret = icc_set_bw(clock->memory_path, data->average_rate, + data->peak_rate); if (ret) goto err_memory_path_disable; - ret = icc_set_bw(clock->config_path, IPA_CONFIG_AVG, IPA_CONFIG_PEAK); + data = &clock->interconnect_data[IPA_INTERCONNECT_CONFIG]; + ret = icc_set_bw(clock->memory_path, data->average_rate, + data->peak_rate); if (ret) goto err_imem_path_disable; @@ -144,6 +139,7 @@ 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) { + const struct ipa_interconnect_data *data; struct ipa_clock *clock = ipa->clock; int ret; @@ -162,9 +158,13 @@ static int ipa_interconnect_disable(struct ipa *ipa) return 0; err_imem_path_reenable: - (void)icc_set_bw(clock->imem_path, IPA_IMEM_AVG, IPA_IMEM_PEAK); + data = &clock->interconnect_data[IPA_INTERCONNECT_IMEM]; + (void)icc_set_bw(clock->imem_path, data->average_rate, + data->peak_rate); err_memory_path_reenable: - (void)icc_set_bw(clock->memory_path, IPA_MEMORY_AVG, IPA_MEMORY_PEAK); + data = &clock->interconnect_data[IPA_INTERCONNECT_MEMORY]; + (void)icc_set_bw(clock->memory_path, data->average_rate, + data->peak_rate); return ret; } @@ -273,10 +273,10 @@ ipa_clock_init(struct device *dev, const struct ipa_clock_data *data) return ERR_CAST(clk); } - ret = clk_set_rate(clk, IPA_CORE_CLOCK_RATE); + ret = clk_set_rate(clk, data->core_clock_rate); if (ret) { - dev_err(dev, "error %d setting core clock rate to %lu\n", - ret, IPA_CORE_CLOCK_RATE); + dev_err(dev, "error %d setting core clock rate to %u\n", + ret, data->core_clock_rate); goto err_clk_put; }