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=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham 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 34FFBC47082 for ; Mon, 7 Jun 2021 14:18:23 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 49CC161029 for ; Mon, 7 Jun 2021 14:18:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 49CC161029 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A47BB81CDE; Mon, 7 Jun 2021 16:18:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="VZrWX3ul"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CCAC882E2F; Mon, 7 Jun 2021 16:18:08 +0200 (CEST) Received: from fllv0016.ext.ti.com (fllv0016.ext.ti.com [198.47.19.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A2E1E81CDE for ; Mon, 7 Jun 2021 16:18:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=vigneshr@ti.com Received: from lelv0265.itg.ti.com ([10.180.67.224]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 157EI13G126935 for ; Mon, 7 Jun 2021 09:18:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1623075481; bh=OKkMqpcOkKGKF/kKmfs6rYc1KbZ/Ynu0ng//aWMAt5A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=VZrWX3ulpgnntHWPRKXkdwUP7WDVa+rwRqB2mLHytVdrSo9nx59iiIPjcwCKcBJMI xoqT4T2j4lrKlCcYuLORodQ4uXIKInMllIoi70W7upCE7WB3AW3/K9zgKQ+50vOg6v 7fuKHi0ZLxLVAyntxPJ17lQ+opWS2fbdysJxS8bc= Received: from DFLE113.ent.ti.com (dfle113.ent.ti.com [10.64.6.34]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 157EI1ox055371 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 7 Jun 2021 09:18:01 -0500 Received: from DFLE105.ent.ti.com (10.64.6.26) by DFLE113.ent.ti.com (10.64.6.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Mon, 7 Jun 2021 09:18:01 -0500 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE105.ent.ti.com (10.64.6.26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2 via Frontend Transport; Mon, 7 Jun 2021 09:18:01 -0500 Received: from ula0132425.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 157EHtHe111045; Mon, 7 Jun 2021 09:18:00 -0500 From: Vignesh Raghavendra To: Lokesh Vutla CC: Vignesh Raghavendra , Subject: [PATCH v2 2/7] firmware: ti_sci: Implement GET_RANGE with static data Date: Mon, 7 Jun 2021 19:47:48 +0530 Message-ID: <20210607141753.28796-3-vigneshr@ti.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210607141753.28796-1-vigneshr@ti.com> References: <20210607141753.28796-1-vigneshr@ti.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.4 at phobos.denx.de X-Virus-Status: Clean In case of R5 SPL, GET_RANGE API service is not available (as DM services are not yet up), therefore service such calls locally using per SoC static data. Signed-off-by: Vignesh Raghavendra --- drivers/firmware/ti_sci.c | 36 +++++++++++ drivers/firmware/ti_sci_static_data.h | 92 +++++++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 drivers/firmware/ti_sci_static_data.h diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 4671a5e3a8..0318da208e 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -23,6 +23,7 @@ #include #include "ti_sci.h" +#include "ti_sci_static_data.h" /* List of all TI SCI devices active in system */ static LIST_HEAD(ti_sci_list); @@ -1668,6 +1669,33 @@ fail: return ret; } +static int __maybe_unused +ti_sci_get_resource_range_static(u32 dev_id, u8 subtype, u16 *range_start, + u16 *range_num) +{ + struct ti_sci_resource_static_data *data; + int i = 0; + + while (1) { + data = &rm_static_data[i]; + + if (!data->dev_id) + return -EINVAL; + + if (data->dev_id != dev_id || data->subtype != subtype) { + i++; + continue; + } + + *range_start = data->range_start; + *range_num = data->range_num; + + return 0; + } + + return -EINVAL; +} + /** * ti_sci_cmd_get_resource_range - Get a range of resources assigned to host * that is same as ti sci interface host. @@ -1684,6 +1712,11 @@ static int ti_sci_cmd_get_resource_range(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u16 *range_start, u16 *range_num) { + if (CONFIG_IS_ENABLED(TI_K3_RAW_RM)) + return ti_sci_get_resource_range_static(dev_id, subtype, + range_start, + range_num); + return ti_sci_get_resource_range(handle, dev_id, subtype, TI_SCI_IRQ_SECONDARY_HOST_INVALID, range_start, range_num); @@ -1707,6 +1740,9 @@ int ti_sci_cmd_get_resource_range_from_shost(const struct ti_sci_handle *handle, u32 dev_id, u8 subtype, u8 s_host, u16 *range_start, u16 *range_num) { + if (CONFIG_IS_ENABLED(TI_K3_RAW_RM)) + return -EINVAL; + return ti_sci_get_resource_range(handle, dev_id, subtype, s_host, range_start, range_num); } diff --git a/drivers/firmware/ti_sci_static_data.h b/drivers/firmware/ti_sci_static_data.h new file mode 100644 index 0000000000..3c506e667a --- /dev/null +++ b/drivers/firmware/ti_sci_static_data.h @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +/* + * Copyright (C) 2021 Texas Instruments Incorporated - http://www.ti.com/ + * + */ + +#ifndef __TI_SCI_STATIC_DATA_H +#define __TI_SCI_STATIC_DATA_H + +struct ti_sci_resource_static_data { + u32 dev_id; + u16 range_start; + u16 range_num; + u8 subtype; +}; + +#if IS_ENABLED(CONFIG_K3_DM_FW) + +#if IS_ENABLED(CONFIG_TARGET_J721E_R5_EVM) +static struct ti_sci_resource_static_data rm_static_data[] = { + /* Free rings */ + { + .dev_id = 235, + .subtype = 1, + .range_start = 124, + .range_num = 32, + }, + /* TX channels */ + { + .dev_id = 236, + .subtype = 13, + .range_start = 6, + .range_num = 2, + }, + /* RX channels */ + { + .dev_id = 236, + .subtype = 10, + .range_start = 6, + .range_num = 2, + }, + /* RX Free flows */ + { + .dev_id = 236, + .subtype = 0, + .range_start = 60, + .range_num = 8, + }, + { }, +}; +#endif /* CONFIG_TARGET_J721E_R5_EVM */ + +#if IS_ENABLED(CONFIG_TARGET_J7200_R5_EVM) +static struct ti_sci_resource_static_data rm_static_data[] = { + /* Free rings */ + { + .dev_id = 235, + .subtype = 1, + .range_start = 144, + .range_num = 32, + }, + /* TX channels */ + { + .dev_id = 236, + .subtype = 13, + .range_start = 7, + .range_num = 2, + }, + /* RX channels */ + { + .dev_id = 236, + .subtype = 10, + .range_start = 7, + .range_num = 2, + }, + /* RX Free flows */ + { + .dev_id = 236, + .subtype = 0, + .range_start = 60, + .range_num = 8, + }, + { }, +}; +#endif /* CONFIG_TARGET_J7200_R5_EVM */ + +#else +static struct ti_sci_resource_static_data rm_static_data[] = { + { }, +}; +#endif /* CONFIG_K3_DM_FW */ +#endif /* __TI_SCI_STATIC_DATA_H */ -- 2.31.1