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: 328462 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp813074ils; Thu, 19 Nov 2020 14:42:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJw247wiEt1YFkA5AiRaRfS2BWE9Q8Biuf625RTcwOiIm/t5ibnCh2/eEF+ekJL9hF6gXOpc X-Received: by 2002:aa7:d298:: with SMTP id w24mr8181808edq.82.1605825741627; Thu, 19 Nov 2020 14:42:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605825741; cv=none; d=google.com; s=arc-20160816; b=NXdz8ZVinC3IJAxpNXLjmstGgjFhOgYsgLLlZnvsQ0n6bYBOqNmXRruy40O6QCZgOw Q7JbeBuQ745MxcSkbIQORIDSPxvshgP4VCOQWmPyVa8ePqgt48soVBRzy911n2degzCh Jh1MiBs2Ow3CMfhOUf+pgioczWLJxFfvZukxpTl/yS1dkOpsEPypo96Q4HIRGFCBbCXZ qRwDRALQly0KWBQyG8m+RbWcsNe5sEdgIBT0vnjRUVkBsL60Q0k/HBw5tQsfTNALLL/B 5Miu1FKXNRvKVRHA54QN1OnGvwEwiulyxei6wq0/zFWPsWNjq9QqgFQGpRN9wDPvDVrn iYBw== 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=Wz7gXC8ze/fDTzyrxDiiPOcQHm+Sr4yptt5JBx9VBH0=; b=UOvDNuovVWXvWQJFzfOc1gZq0n38k5cQy8/1EtekgjRqlk9cGLz8RNduOjDle8uI4Z tqqrUknCzJ9yuDH1pS9AynxaRuei2F/cwbdq6pCFeVUGNxTBIcXyCX2EuL2BzRsHnX2+ cV8yKFecS6QCwDrDZPTHLi8Adg0ZtHZN9rRVXJspuFpmYtYhG9ppS3zEAAWcGOSPqzSy lpn8Hj9rXhUjegPolVzwGUCTe1RkZfyufAevYFKIdSw8cGeTwRj1kDVu3yFuX6Nf4Ima lhW4Vl4VD+sI5fmJDFAk4NCAB5/4Ek9ud0fYHTV2Y3bl+0PQiIzuGVPeV4rgE9iiy54N vKrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Y/fqlOr0"; 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 y8si627511ejw.297.2020.11.19.14.42.21; Thu, 19 Nov 2020 14:42:21 -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="Y/fqlOr0"; 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 S1726754AbgKSWkt (ORCPT + 8 others); 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-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 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(-) -- 2.20.1 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: 328464 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp813087ils; Thu, 19 Nov 2020 14:42:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJzcDWd9O/ba6cJiyZVCzsRTclMbtLezV56oJsn+VpvviGeQRIgzT89z8dEBYKfmtZBuR+Nl X-Received: by 2002:a17:907:11d9:: with SMTP id va25mr12011157ejb.431.1605825743396; Thu, 19 Nov 2020 14:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605825743; cv=none; d=google.com; s=arc-20160816; b=PJhLXtcFt/0G8GjNy86bJYDlxr87hLoA+aNozcZHQG5ZNhRroS+6v9pc2rdNkAPD75 9nIl9gPKsXU2SoBxQF0dgvZec63Z741kzmJ5TLmoMz3pEZ82RXID+eeAj9aa+QD7acsb bH8eK0VRrOaxO+D5/0EI6ZiVsJRFFL0NVTJHr8O90FshxhtSeXSSE9druvjEbo5DbjDb oZP5M6G12dItEVDAdnqGzjBYDxgIHP8bYjT33GM5SL6VepxprW6Cbne236Ggn2FSfFG1 5H8bYggjKxYtxVISVNiopjpd9RKf0pUlZanlM7kMG8AkDIzVchj4pdR8RTkdcs2LcrrW lusg== 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=4R2ny0eNytCOsjqToYvvw7xFj0yITV9HLKMp6fS2QIY=; b=zuYUkkhkbx8TY8BMR/To5MXea5GDyNepRmu2T5TPVyysR7exK5UxBrEbEe/2Zv3kUO TDrMaITcBnvzveTh1f/rK8sW/l95aBJCDYxXaLAlnHGp5Q3ZCl3QKyYHEkGSVEPP3BWt idc5VMOJFw+P8SPDYtloI++vKT6YTTscKR3U2JlUy6Q7oFniTJTAty8OfLwfIczBi0NO rI/qxCRnxB98Dyj3HCX4u6JFn3Zq2PTI2nfo/Vzh/SZxXSTRj3biIs2QofwT4M66dRb5 dAMw+c9BmTat0D7qQ0XWHPFuZv5sTW+Z00UjbLfLxHLdy58egJVEW33xBeAwzQS464ij mieA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/z87x2Z"; 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 y8si627511ejw.297.2020.11.19.14.42.23; Thu, 19 Nov 2020 14:42:23 -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="R/z87x2Z"; 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 S1726878AbgKSWkz (ORCPT + 8 others); 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-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 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(+) -- 2.20.1 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: 328463 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:5ce:0:0:0:0 with SMTP id l14csp813082ils; Thu, 19 Nov 2020 14:42:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxp5EwIXHoNAwRzFdKpRUcPBFnfxKBhq6K79ZuYG+upTKb6OF7gKNlSQsK/G07724DItcvM X-Received: by 2002:a17:906:46d2:: with SMTP id k18mr29252336ejs.33.1605825743017; Thu, 19 Nov 2020 14:42:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605825743; cv=none; d=google.com; s=arc-20160816; b=BCBZYnqWYn4MMWLQJ2CTfh+f/grE+9rIpXfgqasm0wPt3E6NqbZJC9/lGEcFnkB0jm rORGC7wxufcAUGBwWyDmw2b/b0RJIhfFSyo5NNAIEUWPwWB+w6EThgpyk8kRfWRYUypM vVEWE4MQS6HVBgJEvJTMCoTltXrzu9A0kZjO7v/zhdwhFLmmuHIN6gTwOl7kqDEZvN6L DOAC70moo+pLA46QiVenJr1pZEJl+MNlEitasvGQMUZViEXzyZcQev272SzrozYWtb+D eEeEaLZ+6A5XKcrz326my6N5Vu+qDJLTLQkVEvExIBSzoDpSDyTy8QGp89h2NtX18DF2 QeVQ== 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=OOSsF7KnxFiHnRY0GY2iUK6XWu8gB3i6mV+T4+SlcUs=; b=vGIwihEpTBINcYiLpMomkjigV2BhHQ5lZQDGdEk1LYHaOvMRsxLgV5el/8NXAQPO+H lDM0FlCDrTu/VEZVIG3kekHsz21102L3V3vt9Xc7cNAcMXRTgOPWfpQys3eXHSW432s/ nSJm/sJKWXos93bqYndYOadAFWsS77gE0c0k5mkTVf00iLJM2TT9pBImj65yGZxKtsP6 c9RfnTH+Rt/kQgG+HxQKngnKGyiLYpjU67m8ww2H+UmsU0fBk81W09ip3LWoUOPgWAkx hmPDo/Y7iK/hlU4bbzJ2dxyVWB8OgM5GDMBoWsnaO73xg2Vj7lEC3ZMzNZaXimju5PIT UFUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R95lTJA4; 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 y8si627511ejw.297.2020.11.19.14.42.22; Thu, 19 Nov 2020 14:42:23 -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=R95lTJA4; 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 S1726920AbgKSWkz (ORCPT + 8 others); 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-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 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(-) -- 2.20.1 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; }