From patchwork Mon May 10 17:24:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vignesh Raghavendra X-Patchwork-Id: 1476599 X-Patchwork-Delegate: lokeshvutla@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=q2EtFx47; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Ff7HX13n2z9sWD for ; Tue, 11 May 2021 03:25:44 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7B49D82EF3; Mon, 10 May 2021 19:25:22 +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="q2EtFx47"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C5D8282EDB; Mon, 10 May 2021 19:25:15 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 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 622D682EE6 for ; Mon, 10 May 2021 19:25:11 +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 14AHP9WN120171; Mon, 10 May 2021 12:25:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1620667509; bh=ldxYbn3kpNNPT0muLcUJ+D5oyVlzteMUn1bv94Xen9s=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=q2EtFx47d2FvowpoGf4qXVMt0dJeuvHSc0yJIW+XHlZMoKd3GXnCwCAFvOKWD9B07 eXu8EF4m7WZ6j8PW/Vis4Hl4nLVTAqT4dDN5VT+IdXEbQ0BOsbl8FBRI57GQAlQPJR NL7k4DM3TGt0P+zKKd4o6rVOnzcHS+DY5uPQ4beU= Received: from DFLE105.ent.ti.com (dfle105.ent.ti.com [10.64.6.26]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 14AHP9oB035672 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 10 May 2021 12:25:09 -0500 Received: from DFLE106.ent.ti.com (10.64.6.27) 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; Mon, 10 May 2021 12:25:09 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DFLE106.ent.ti.com (10.64.6.27) 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, 10 May 2021 12:25:09 -0500 Received: from ula0132425.ent.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 14AHP1nb023176; Mon, 10 May 2021 12:25:07 -0500 From: Vignesh Raghavendra To: Lokesh Vutla CC: , Nishanth Menon , Dave Gerlach , Tero Kristo , Tom Rini Subject: [PATCH 2/7] firmware: ti_sci: Implement GET_RANGE with static data Date: Mon, 10 May 2021 22:54:37 +0530 Message-ID: <20210510172442.11146-3-vigneshr@ti.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510172442.11146-1-vigneshr@ti.com> References: <20210510172442.11146-1-vigneshr@ti.com> MIME-Version: 1.0 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 2aec2e34d3..c27fbc682a 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); @@ -1667,6 +1668,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. @@ -1683,6 +1711,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); @@ -1706,6 +1739,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..2816cb2827 --- /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) + +#ifdef 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 */ + +#ifdef 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 */