Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id A57F5C43458 for ; Tue, 30 Jun 2026 12:53:28 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5839284B24; Tue, 30 Jun 2026 14:50:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=qualcomm.com header.i=@qualcomm.com header.b="D0sB6xAP"; dkim=pass (2048-bit key; unprotected) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="Xuqq2wFW"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 54A2D849FB; Tue, 30 Jun 2026 10:09:48 +0200 (CEST) Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E511884857 for ; Tue, 30 Jun 2026 10:09:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=varadarajan.narayanan@oss.qualcomm.com Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 65U6CL0p1090597 for ; Tue, 30 Jun 2026 08:09:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= TGIDCRhMHBvhmluQ53f6OtsnpeZ5pTrRbLZ4bh1xykI=; b=D0sB6xAP7svhNrqK 80MQWKL/sL2C0QPu90lxXufrfxCGS17XDzn7cPZNvLaNgPeKjyk/XjbyNWsUvwLA 407gzUXP0BNf4+AEB5QC3zW36GjdkoS2lLmX7yNuAwtNXG5TaKCR3rWmVLPBRvVn 1fcpQI3TcHXzOWXXxmW7BW3w1GSJqLrQUypzvJuLhqCATRwgs/GNMpycA5p85Brl 6+Fw5C1Q7mFMsx2HoqMBazWbLgUy2Kw0T6OEAQB9fLphTYfl+mLwFeJboVwcw+Uh nAIfaNNLzpDOjq90FaX4jNqx8KPIGfvpgkCbDMAtlok8FPdtY+/kc0lxjbH19f59 lPcRxQ== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4f45k5s5n9-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 30 Jun 2026 08:09:44 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-30cb5001ed8so4360932eec.1 for ; Tue, 30 Jun 2026 01:09:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1782806983; x=1783411783; darn=lists.denx.de; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=TGIDCRhMHBvhmluQ53f6OtsnpeZ5pTrRbLZ4bh1xykI=; b=Xuqq2wFWCqQkDO86rFBjAKQj6TSOKLBYH3z8cKzj47vc9SH/GBTLTzmo0qHv+dwnpj T8Rh5bCMPQF7XUWWzqT8Cw8k9lVQ9g9KJc9OvVejcKaIpMPjKyd4+/h4mVfbCECxBski fU8O8jOnqdnjcXUR2V4hMVK+tc5CYKXQcuyfag/XI9YU6J7iB4t+m527dN1t56h3+ePP YWCDdQC5euIDtD3gYIiaQ4cYsA6WZqPvOiis1lx8hJalxFgv4Jf2Wg78xemFs263rF+J sUM9yU6L+EYZF4OMpqtzdzxyGbPt4RpdrJ/CyXRsIP32vkmsW5uDhIKcvm9pNRTZ5S8Y Td+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782806983; x=1783411783; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=TGIDCRhMHBvhmluQ53f6OtsnpeZ5pTrRbLZ4bh1xykI=; b=tJtw5Ofj7X4U+SrrLLZNwi+2//bFfmHHafcrz300ue9FpbSd39ctVrSvHP0g5BJCIx Zp5mgrjWjtwMiwwyDPuTnehSY5H81wdABe1TxMSGwJYoZF5acLTAU0/yEEEmIOJ8CESF zu8mEl+V9yfd8bKfm2z6BHb0fdnGvq9Yvn6OjwcR2yVbL7IwPlXDPz4/otihHFQJIv2k LsAquBXHbJ8462D6RGPMG1nUx5yAbUgCiYwzS3kqRcgWOdvhJupkr4HA1+MdRonkoub5 dXp9sbi/Q7xRpV+x/slNCPYiaEDZpzQuFgofBZ6I4sulYNrkSMpDeZOV4e5KAJLTyOjc RGPQ== X-Gm-Message-State: AOJu0YziV4hmXAVpXop6bMUDaN1M7o1QT66Qz0ruEWTzaFp/2jpxezGJ VGc337R3ppXYPbZ8Ne4kq1iKfEZnXNWJgr7DigsPV0oMoMJedSriqbDuSFI2tv5Cq9DVa0q6QyU chTlLYxisx8OGf1RTgKPVpYa5hn52nKEI31N0iHnP+V+c5Dg8wl+StC9Y X-Gm-Gg: AfdE7clq1e0xBuXqEKFYfQvaH+LR3Cr+9OhK0CF+9ZbOFfuhJl3DWmsPItgURAFBVyI prp6FZ1Xx2gmb+7GUH6bZrZVCw6CWIpee4VlegXn+kWWXrjSL25TW7gXYV1Gb+AoJ1VPJ5NDP7/ ES3jIQYraf8Qnlap/N7VOMO1hfLNoednj5meQC5/zJJmKRIqrfFdJdmOukwgBYotypi03qZwBb7 1cJsBuxpwfZUc6N551i/Q3Nm16BaEgXWJ5UieAl3mE0NKTjNFuk5jgxNlZnnT8DXtoLSfXDMF2D YIXaw0CADu6FjEHh0QklHLAMd3YC4Ox2Y0+c0bUBHbx2HGane/CseqOc0BYCb6WUxYkp88+gu2A SbYdpWNUPomO/NWnV67/IC4yjWjtFtNN/d6d5wTLE13kaJ4hTl48n7ljXVgtAn4r0vbvi1O4K9I ppg9RYxGP05EkDDUiRjt0i9IMZORzTXJACOjEtEs+b X-Received: by 2002:a05:7301:fa13:b0:30e:d8ae:308b with SMTP id 5a478bee46e88-30ee137b505mr1993735eec.13.1782806982993; Tue, 30 Jun 2026 01:09:42 -0700 (PDT) X-Received: by 2002:a05:7301:fa13:b0:30e:d8ae:308b with SMTP id 5a478bee46e88-30ee137b505mr1993686eec.13.1782806982336; Tue, 30 Jun 2026 01:09:42 -0700 (PDT) Received: from hu-varada-blr.qualcomm.com (blr-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com. [103.229.18.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-30ee3264f52sm5415816eec.28.2026.06.30.01.09.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jun 2026 01:09:41 -0700 (PDT) From: Varadarajan Narayanan Date: Tue, 30 Jun 2026 13:38:26 +0530 Subject: [PATCH v7 04/11] misc: qcom_geni: Add minicore support MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260630-fix-edl-v7-4-1dcb0d2a347c@oss.qualcomm.com> References: <20260630-fix-edl-v7-0-1dcb0d2a347c@oss.qualcomm.com> In-Reply-To: <20260630-fix-edl-v7-0-1dcb0d2a347c@oss.qualcomm.com> To: u-boot@lists.denx.de, Sumit Garg , u-boot-qcom@groups.io Cc: Tom Rini , Sumit Garg , Simon Glass , Lukasz Majewski , Casey Connolly , Neil Armstrong , Luca Weiss , Danila Tikhonov , Jens Reidel , Aswin Murugan , David Wronek , Balaji Selvanathan , Peng Fan , Neha Malcom Francis , Anshul Dalal , Mateus Lima Alves , Jamie Gibbons , Leo Yu-Chi Liang , Quentin Schulz , Tien Fong Chee , Andrew Davis , Hrushikesh Salunke , Alexey Charkov , Alif Zakuan Yuslaimi , Mattijs Korpershoek , Dinesh Maniyam , Rayagonda Kokatanur , Tingting Meng , Alice Guo , Marek Vasut , Ilias Apalodimas , James Hilliard , Richard Genoud , Sughosh Ganu , Philip Molloy , Jaehoon Chung , Varadarajan Narayanan X-Mailer: b4 0.14.3 X-Authority-Analysis: v=2.4 cv=AqDeGu9P c=1 sm=1 tr=0 ts=6a4379c8 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=Ou0eQOY4+eZoSc0qltEV5Q==:17 a=IkcTkHD0fZMA:10 a=FelO9ux0wxsA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=EUspDBNiAAAA:8 a=cm27Pg_UAAAA:8 a=cQ2vkqh8qupFpVM6Gu4A:9 a=QEXdDO2ut3YA:10 a=PxkB5W3o20Ba91AHUih5:22 X-Proofpoint-GUID: 6b7fQqRfv3IE2ngvOUAxscdfY21qkdIq X-Proofpoint-ORIG-GUID: 6b7fQqRfv3IE2ngvOUAxscdfY21qkdIq X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNjMwMDA3MSBTYWx0ZWRfX0EFF/fmvzOsc tLivVL/c6DyZmDUIc+H/tcaPz4gLGb5Eb6dGo9Lv/31Sc8bqcSpu7FI65U1+LUsVCYkz8YrKDGl u3unr9zYy4xFnQ0nyVGt7BsqcrkMmCIEafC71JljrPmso07Nu0RUk3wJZUE89a0qVRIRBvnbgag fYjrCR9mKgf51MoQpk8dKwiTNm29J8qHA7gBEHm1GcXML/h7GXfJ4DkRmigX0nUUWpow/V8LD+6 pQmbnDgU/DYCtqgWyroMEw0L9lv5TCJ8uNqIdIh10Un/tGOz7FdZDfsiqwcd4iC2b376sgKIAy8 Yw50utA3o+5xbk7EWFElokDRTTbsbtBQ8GeDwYlgeCT+GjZCI8YOiSAnj6437ST0Bz8CymbPUko F2rTY8YMbOvx4M7D7AE9harVvF6lmixx8zOat0xNub3YQC7N3Brm2h88rl8yurqJEHVk3GH5xa5 vtYQsxZsFn80PJPKnjQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwNjMwMDA3MSBTYWx0ZWRfXzYv2MG0tkjSO zrz63ugNx5Q53IBUKsuWuqdaFRCntFivdyb1rKY4QRgdebJ8m0lBUPliRPR25uanNnN21hvF3kT ywtO/jAM4AaQhAlxB4uD41UREHJAxsc= X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.125,FMLib:17.12.100.49 definitions=2026-06-30_02,2026-06-26_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 impostorscore=0 suspectscore=0 spamscore=0 phishscore=0 priorityscore=1501 lowpriorityscore=0 malwarescore=0 bulkscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2606300071 X-Mailman-Approved-At: Tue, 30 Jun 2026 14:50:53 +0200 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.8 at phobos.denx.de X-Virus-Status: Clean The qcom_geni driver reads an ELF from storage and configures a set of registers and programs the firmware to the GENI Serial Engine (GENI-SE) wrapper device for the expected functionality. Unlike the GENI-SE wrapper found in MSM SoCs, the IPQ5210's GENI-SE wrapper is pre-configured for one of the functions defined in 'enum geni_se_protocol_type'. Hence, the firmware download is not needed. Only the register configuration part is needed. Earlier, the boot stages before U-Boot would configure the GENI-SE (to access UART/SPI etc). Since for IPQ5210 U-Boot SPL, the previous stage (i.e. boot ROM) doesn't do that modify the driver to do the register configuration part alone without reading an ELF from the storage. Reviewed-by: Balaji Selvanathan Reviewed-by: Simon Glass Signed-off-by: Varadarajan Narayanan --- drivers/misc/Kconfig | 6 +++ drivers/misc/Makefile | 1 + drivers/misc/qcom_geni-minicore.c | 102 ++++++++++++++++++++++++++++++++++++++ drivers/misc/qcom_geni.c | 100 ++++++++++++++++++++++++++++++++----- include/soc/qcom/geni-se.h | 5 ++ include/soc/qcom/qup-fw-load.h | 12 +++++ 6 files changed, 214 insertions(+), 12 deletions(-) diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index ea785793d18..4317bde7406 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig @@ -93,6 +93,12 @@ config QCOM_GENI for providing a common interface for various peripherals like UART, I2C, SPI, etc. +config QCOM_GENI_MINICORE + bool "Support minicores in Qualcomm Generic Interface (GENI) driver" + depends on QCOM_GENI + help + Enable support for minicores in Qualcomm GENI and its peripherals. + config ROCKCHIP_EFUSE bool "Rockchip e-fuse support" depends on MISC diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index e2170212e5a..2daccbba74d 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile @@ -66,6 +66,7 @@ obj-$(CONFIG_QFW_SMBIOS) += qfw_smbios.o obj-$(CONFIG_SANDBOX) += qfw_sandbox.o endif obj-$(CONFIG_QCOM_GENI) += qcom_geni.o +obj-$(CONFIG_QCOM_GENI_MINICORE) += qcom_geni-minicore.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_EFUSE) += rockchip-efuse.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_OTP) += rockchip-otp.o obj-$(CONFIG_$(PHASE_)ROCKCHIP_IODOMAIN) += rockchip-io-domain.o diff --git a/drivers/misc/qcom_geni-minicore.c b/drivers/misc/qcom_geni-minicore.c new file mode 100644 index 00000000000..33bc61ddf35 --- /dev/null +++ b/drivers/misc/qcom_geni-minicore.c @@ -0,0 +1,102 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. + */ + +#include +#include + +/* + * Register configuration for the QUP minicores to setup the corresponding + * functionality of SPI/I2C/UART. + */ +static u8 cfg_reg_idx[] = { + /* 0 to 18 */ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + /* 64 to 113 */ + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, + 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, + 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, + 112, 113, +}; + +static u32 spi_cfg_val[] = { + /* 0 to 18 */ + 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00240E78, 0x00011088, + 0x00240007, 0x00000000, 0x00000000, 0x0001000A, 0x00000300, 0x00000000, + 0x00000000, 0x00000000, 0x00154400, 0x001483A0, 0x00AA8128, 0x00641002, + 0x00004000, + /* 64 to 113 */ + 0x00000201, 0x0001FE05, 0x0002C2E7, 0x0A435C00, 0x0010011A, 0x08800000, + 0x00000000, 0x100CAC00, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x000018E4, 0x00000000, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0007F807, 0x000FFEFE, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00200000, 0x00000004, 0x00000009, 0x0007F807, 0x000FFEFE, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00C0033F, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000055, +}; + +static u32 uart_cfg_val[] = { + /* 0 to 18 */ + 0x00000024, 0x00000000, 0x00000024, 0x00000000, 0x00019A00, 0x00400000, + 0x00E00000, 0x00010020, 0x00000000, 0x00000000, 0x00000300, 0x00000700, + 0x00000400, 0x00000000, 0x00000000, 0x00C00000, 0x00000000, 0x00C00024, + 0x00000B00, + /* 64 to 113 */ + 0x00020231, 0x0000CE05, 0x000360E7, 0x0941E6A8, 0x00100510, 0x42C01E51, + 0x00000401, 0x002E8400, 0x1694581A, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x0000031C, 0x00000000, + 0x0000000F, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00081C06, 0x00004010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x0000000D, 0x00000000, 0x00081C06, 0x00004010, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00C02415, 0x0000000E, 0x00000001, + 0x00000001, 0x00000000, 0x00C00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000055, +}; + +static u32 i2c_cfg_val[] = { + /* 0 to 18 */ + 0x00000090, 0x00000000, 0x00000090, 0x00000000, 0x00038028, 0x00084080, + 0x00000343, 0x00010000, 0x00000000, 0x00001A00, 0x00000100, 0x00000000, + 0x00000000, 0x00000000, 0x00808008, 0x001C0020, 0x00000000, 0x00020000, + 0x00000000, + /* 64 to 113 */ + 0x00000201, 0x0001FC01, 0x00036222, 0x09C01FFC, 0x00100120, 0x02C00000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000409, 0x00000003, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x0007F8FE, 0x000FFEFE, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x0007F807, 0x000FFEFE, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00C00000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000055, +}; + +struct qup_mini_core_info qup_mini_cores[] = { + { + .serial_protocol = GENI_SE_SPI, + .fw_version = 0xb02, + .cfg_version = 0x9, + .cfg_count = ARRAY_SIZE(spi_cfg_val), + .cfg_val = spi_cfg_val, + .cfg_idx = cfg_reg_idx, + }, { + .serial_protocol = GENI_SE_UART, + .fw_version = 0x405, + .cfg_version = 0xa, + .cfg_count = ARRAY_SIZE(uart_cfg_val), + .cfg_val = uart_cfg_val, + .cfg_idx = cfg_reg_idx, + }, { + .serial_protocol = GENI_SE_I2C, + .fw_version = 0x204, + .cfg_version = 0x9, + .cfg_count = ARRAY_SIZE(i2c_cfg_val), + .cfg_val = i2c_cfg_val, + .cfg_idx = cfg_reg_idx, + }, { + .serial_protocol = GENI_SE_INVALID_PROTO, + }, +}; diff --git a/drivers/misc/qcom_geni.c b/drivers/misc/qcom_geni.c index a62ae6a2478..40044e5d48a 100644 --- a/drivers/misc/qcom_geni.c +++ b/drivers/misc/qcom_geni.c @@ -34,8 +34,15 @@ struct qup_se_rsc { struct geni_se_plat { bool need_firmware_load; +#if IS_ENABLED(CONFIG_QCOM_GENI_MINICORE) + bool is_mini_core; +#endif }; +#if IS_ENABLED(CONFIG_QCOM_GENI_MINICORE) +extern struct qup_mini_core_info qup_mini_cores[]; +#endif + /** * geni_enable_interrupts() Enable interrupts. * @rsc: Pointer to a structure representing SE-related resources. @@ -163,16 +170,53 @@ static void geni_config_common_control(struct qup_se_rsc *rsc) COMMON_CSR_SLV_CLK_CGC_ON_BMASK); } -static int load_se_firmware(struct qup_se_rsc *rsc, struct elf_se_hdr *hdr) +static int load_se_firmware(struct qup_se_rsc *rsc, bool elf, void *info) { + struct elf_se_hdr *hdr, tmp_hdr; const u32 *fw_val_arr, *cfg_val_arr; const u8 *cfg_idx_arr; u32 i, reg_value, mask, ramn_cnt; int ret; - fw_val_arr = (const u32 *)((u8 *)hdr + hdr->fw_offset); - cfg_idx_arr = (const u8 *)hdr + hdr->cfg_idx_offset; - cfg_val_arr = (const u32 *)((u8 *)hdr + hdr->cfg_val_offset); + if (elf) { + hdr = info; + fw_val_arr = (const u32 *)((u8 *)hdr + hdr->fw_offset); + cfg_idx_arr = (const u8 *)hdr + hdr->cfg_idx_offset; + cfg_val_arr = (const u32 *)((u8 *)hdr + hdr->cfg_val_offset); + } else if (IS_ENABLED(CONFIG_QCOM_GENI_MINICORE)) { + /* + * Minicore controllers come with pre-configured functionality + * and don't need a firmware download and just need the register + * configuration. Hence, skipping the firmware part and setting + * up just the register configuration related information. + */ + struct qup_mini_core_info *qmc = info; + + for (; qmc->serial_protocol != GENI_SE_INVALID_PROTO; qmc++) + if (qmc->serial_protocol == rsc->protocol) + break; + + if (qmc->serial_protocol == GENI_SE_INVALID_PROTO) { + dev_err(rsc->dev, "Invalid MINICORE protocol (%d)\n", + rsc->protocol); + return -EINVAL; + } + + tmp_hdr.magic = MAGIC_NUM_SE; + tmp_hdr.version = 1; + tmp_hdr.serial_protocol = rsc->protocol; + tmp_hdr.fw_version = qmc->fw_version; + tmp_hdr.cfg_version = qmc->cfg_version; + tmp_hdr.fw_size_in_items = qmc->cfg_ram_count; + tmp_hdr.cfg_size_in_items = qmc->cfg_count; + hdr = &tmp_hdr; + fw_val_arr = (const u32 *)qmc->cfg_ram; + cfg_idx_arr = (const u8 *)qmc->cfg_idx; + cfg_val_arr = (const u32 *)qmc->cfg_val; + } else { + dev_err(rsc->dev, "Neither fw nor register settings found\n"); + return -EINVAL; + } geni_config_common_control(rsc); @@ -350,8 +394,9 @@ int qcom_geni_load_firmware(phys_addr_t qup_base, { struct qup_se_rsc rsc; struct elf_se_hdr *hdr; + bool elf; int ret; - void *fw; + void *fw, *info; rsc.dev = dev; rsc.base = qup_base; @@ -377,15 +422,22 @@ int qcom_geni_load_firmware(phys_addr_t qup_base, /* The firmware blob is the private data of the GENI wrapper (parent) */ fw = dev_get_priv(dev->parent); - ret = read_elf(&rsc, fw, &hdr); - if (ret) { - dev_err(dev, "Failed to read ELF: %d\n", ret); - return ret; + if (IS_ELF(*(Elf32_Ehdr *)fw)) { + ret = read_elf(&rsc, fw, &hdr); + if (ret) { + dev_err(dev, "Failed to read ELF: %d\n", ret); + return ret; + } + elf = true; + info = hdr; + } else { + elf = false; + info = fw; } dev_info(dev, "Loading QUP firmware...\n"); - return load_se_firmware(&rsc, hdr); + return load_se_firmware(&rsc, elf, info); } /* @@ -414,6 +466,11 @@ static int geni_se_of_to_plat(struct udevice *dev) if (proto == GENI_SE_INVALID_PROTO) plat->need_firmware_load = true; + +#if IS_ENABLED(CONFIG_QCOM_GENI_MINICORE) + if (readl(res.start + SE_HW_PARAM_2) & GENI_USE_MINICORES) + plat->is_mini_core = true; +#endif } return 0; @@ -473,7 +530,7 @@ static int probe_children_load_firmware(struct udevice *dev) ret = 0; /* Find the device for this ofnode, or bind it */ if (device_find_global_by_ofnode(child, &child_dev)) - ret = lists_bind_fdt(dev, child, &child_dev, NULL, false); + ret = lists_bind_fdt(dev, child, &child_dev, NULL, false); if (ret) { /* Skip nodes that don't have drivers */ debug("Failed to probe child %s: %d\n", ofnode_get_name(child), ret); @@ -492,7 +549,7 @@ static int probe_children_load_firmware(struct udevice *dev) * Load firmware for QCOM GENI peripherals from the dedicated partition on storage and bind/probe * all the peripheral devices that need firmware to be loaded. */ -static int qcom_geni_fw_initialise(void) +int qcom_geni_fw_initialise(void) { debug("Loading firmware for QCOM GENI SE\n"); struct udevice *geni_wrapper, *blk_dev; @@ -518,6 +575,12 @@ static int qcom_geni_fw_initialise(void) return 0; } +#if IS_ENABLED(CONFIG_QCOM_GENI_MINICORE) + if (plat->is_mini_core) { + fw_buf = qup_mini_cores; + goto mini_core; + } +#endif ret = find_qupfw_part(&blk_dev, &part_info); if (ret) { pr_err("QUP firmware partition not found\n"); @@ -544,6 +607,9 @@ static int qcom_geni_fw_initialise(void) return 0; } +#if IS_ENABLED(CONFIG_QCOM_GENI_MINICORE) +mini_core: +#endif /* * OK! Firmware is loaded, now bind and probe remaining children. They will attempt to load * firmware during probe. Do this for each GENI SE wrapper that needs firmware loading. @@ -563,7 +629,14 @@ static int qcom_geni_fw_initialise(void) return 0; } +#if CONFIG_XPL_BUILD +int qcom_geni_fw_probe(struct udevice *dev) +{ + return qcom_geni_fw_initialise(); +} +#else EVENT_SPY_SIMPLE(EVT_LAST_STAGE_INIT, qcom_geni_fw_initialise); +#endif static const struct udevice_id geni_ids[] = { { .compatible = "qcom,geni-se-qup" }, @@ -577,4 +650,7 @@ U_BOOT_DRIVER(geni_se_qup) = { .of_to_plat = geni_se_of_to_plat, .plat_auto = sizeof(struct geni_se_plat), .flags = DM_FLAG_DEFAULT_PD_CTRL_OFF, +#if CONFIG_XPL_BUILD + .probe = qcom_geni_fw_probe, +#endif }; diff --git a/include/soc/qcom/geni-se.h b/include/soc/qcom/geni-se.h index fc9a8e82cd8..3063b37010d 100644 --- a/include/soc/qcom/geni-se.h +++ b/include/soc/qcom/geni-se.h @@ -77,8 +77,12 @@ enum geni_se_protocol_type { #define SE_IRQ_EN 0xe1c #define SE_HW_PARAM_0 0xe24 #define SE_HW_PARAM_1 0xe28 +#define SE_HW_PARAM_2 0xe2c #define SE_DMA_GENERAL_CFG 0xe30 +/* SE_HW_PARAM_2 fields */ +#define GENI_USE_MINICORES BIT(12) + /* GENI_DFS_IF_CFG fields */ #define DFS_IF_EN BIT(0) @@ -248,6 +252,7 @@ enum geni_se_protocol_type { /* SE_HW_PARAM_0 fields */ #define TX_FIFO_WIDTH_MSK GENMASK(29, 24) #define TX_FIFO_WIDTH_SHFT 24 + /* * For QUP HW Version >= 3.10 Tx fifo depth support is increased * to 256bytes and corresponding bits are 16 to 23 diff --git a/include/soc/qcom/qup-fw-load.h b/include/soc/qcom/qup-fw-load.h index a67a93c72a4..b329a18ef22 100644 --- a/include/soc/qcom/qup-fw-load.h +++ b/include/soc/qcom/qup-fw-load.h @@ -14,6 +14,7 @@ #define GENI_INIT_CFG_REVISION 0x0 #define GENI_S_INIT_CFG_REVISION 0x4 #define GENI_FORCE_DEFAULT_REG 0x20 +#define GENI_OUTPUT_CTRL 0x24 #define GENI_CGC_CTRL 0x28 #define GENI_CFG_REG0 0x100 @@ -173,6 +174,17 @@ struct elf_se_hdr { struct udevice; +struct qup_mini_core_info { + u16 serial_protocol; + u16 fw_version; + u16 cfg_version; + u16 cfg_count; + u32 *cfg_val; + u8 *cfg_idx; + u32 *cfg_ram; + u32 cfg_ram_count; +}; + int qcom_geni_load_firmware(phys_addr_t qup_base, struct udevice *dev); #endif /* _LINUX_QCOM_QUP_FW_LOAD */ -- 2.34.1