From patchwork Tue Dec 5 18:47:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 13480640 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2F912C10F05 for ; Tue, 5 Dec 2023 18:48:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=eAUjkmcwMN1AR3c6cBL58Ed0QL9ZOwIIIK016HNHX5U=; b=pHXuzXjbxR5lsX SKah/Ee4uomj43RZCKbigsR6oU78rtJ+woVnyCvj7ZCwTXxL+oLWcT/O6sjk+STiglSoArZdWhfp5 Kzuwk++/IeACOmtp6ZhCdKHXlicqZQZ13MsrDQJMBMR+ivW/Icf5mw+mvM/oq8X7KSX8EG48q2cNU 5ZhtM79TZL6KHy3InGP2snJA+It98H6RbHAJ1SLxEhVM8YzRcL93CSclx4Hz4weLq8C2W7/mI+5v9 0F+7/6SO+5xMr2HO2jczZFjKqxlUb5fCKGSoPG1Bg+vxJ6Zlb9CdNN8dDglJqSnKiRE2CXgOTt8pr W/UA2xFsc/rFZJDFSATg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAaSz-008CKE-2p; Tue, 05 Dec 2023 18:48:21 +0000 Received: from mail-oo1-xc31.google.com ([2607:f8b0:4864:20::c31]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAaSw-008CIZ-2J for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 18:48:19 +0000 Received: by mail-oo1-xc31.google.com with SMTP id 006d021491bc7-58dd5193db4so501422eaf.1 for ; Tue, 05 Dec 2023 10:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701802095; x=1702406895; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vDgn1SrDftxmBi54zNdMtJUWGA9ZxIzk+fgRKHhw/lM=; b=LMsHBj6VD0FUbZXKgKjlp+kmChjbTUWPom223j8TVJbxyH7Pvnt1u+Vs1B5R6wXWJt 7f+iH3m4+PbGx/7gnuxxItYdLoBt0aEeNtR3QGBUTLw3WXNB6R16BruDGsVxeTYpMksV Rbs6H+HoSNFrCM5qN7jIusa6Alfiuo/Ch4pZU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701802095; x=1702406895; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vDgn1SrDftxmBi54zNdMtJUWGA9ZxIzk+fgRKHhw/lM=; b=fGf5pV8heNzZSGLhLSZ/EqzMEpTO9Dhm0Muudf3aVuNVfpzKMnSQwyWfwL4mpYbDew tNKGStByg/95SCEZsv3EykcwyMgyQhE7Q570CEyqcGGtUYCYghwbJmDHYo7nujHKT8y5 6tbHxvT3Era4UOZQGad+1sjqojdVbHOM3627FgqcMePh8Qfgvxlipkcsi36c8+HPdig9 zrCpTwsQnQV3nqjv1Mgyi43VYsBbVc29N39dlPIqDzp4pR6k61Fnuj6rfFl+hmGXquLU W6x1OJOHAjMGdM6C2d2BzfhMIQ5rstkzVYsAgO+Gg7Zge55IiCKkIlLwRvxP+Fo9A8JR T2TQ== X-Gm-Message-State: AOJu0YwE9QkEqvOp4ecvoFrSeK0N6xfhRoV82LxakpguwSxFJiEpr2o3 /9NAs6ukJhnMiuRm35z410ueKQ== X-Google-Smtp-Source: AGHT+IFI1UF+i4Lmh7XXhTATcjR+n/TABBYg+KiFDvGwEmkJJjxPFfcqdC4o+UQvAJ0jSDdQON+qcg== X-Received: by 2002:a05:6359:a25:b0:16e:4d4c:68a2 with SMTP id el37-20020a0563590a2500b0016e4d4c68a2mr20644814rwb.2.1701802094712; Tue, 05 Dec 2023 10:48:14 -0800 (PST) Received: from lbrmn-mmayer.ric.broadcom.net ([192.19.161.248]) by smtp.gmail.com with ESMTPSA id m27-20020a637d5b000000b005c6746620cfsm3151046pgn.51.2023.12.05.10.48.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:13 -0800 (PST) Received: by lbrmn-mmayer.ric.broadcom.net (Postfix, from userid 1000) id DC55DD02; Tue, 5 Dec 2023 10:48:10 -0800 (PST) From: Markus Mayer To: Krzysztof Kozlowski , Florian Fainelli , Rob Herring , Conor Dooley Cc: Markus Mayer , Linux ARM Kernel List , Device Tree Mailing List , Linux Kernel Mailing List Subject: [PATCH 1/4] dt-bindings: memory: additional compatible strings for Broadcom DPFE Date: Tue, 5 Dec 2023 10:47:34 -0800 Message-ID: <20231205184741.3092376-2-mmayer@broadcom.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205184741.3092376-1-mmayer@broadcom.com> References: <20231205184741.3092376-1-mmayer@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_104818_752427_B3E7CFD4 X-CRM114-Status: GOOD ( 11.37 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add versioned compatible strings for Broadcom DPFE. These take the form brcm,dpfe-cpu-v where is a number from 1 to 4. These API version related compatible strings are more specific than the catch-all "brcm,dpfe-cpu" and more generic than chip-specific compatible strings. Signed-off-by: Markus Mayer --- .../bindings/memory-controllers/brcm,dpfe-cpu.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml b/Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml index 08cbdcddfead..6dffa7b62baf 100644 --- a/Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml +++ b/Documentation/devicetree/bindings/memory-controllers/brcm,dpfe-cpu.yaml @@ -16,6 +16,11 @@ properties: - enum: - brcm,bcm7271-dpfe-cpu - brcm,bcm7268-dpfe-cpu + - enum: + - brcm,dpfe-cpu-v1 + - brcm,dpfe-cpu-v2 + - brcm,dpfe-cpu-v3 + - brcm,dpfe-cpu-v4 - const: brcm,dpfe-cpu reg: @@ -40,7 +45,8 @@ additionalProperties: false examples: - | dpfe-cpu@f1132000 { - compatible = "brcm,bcm7271-dpfe-cpu", "brcm,dpfe-cpu"; + compatible = "brcm,bcm7271-dpfe-cpu", "brcm,dpfe-cpu-v1", + "brcm,dpfe-cpu"; reg = <0xf1132000 0x180>, <0xf1134000 0x1000>, <0xf1138000 0x4000>; From patchwork Tue Dec 5 18:47:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 13480641 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CDDF8C4167B for ; Tue, 5 Dec 2023 18:48:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+DUwFAjWDcZXsjgDENMZ4dmJOyMMetPi06A72KWmjhs=; b=VRb7K3AiKw29gB yjiYI5N28QXN2kKAfqyADfPddD5nd26TAFHnYV+s359/XgT8xPsRFyuC+aRXstv18f+g6N6XOq4Br hnV87ZSSLgHeHb78+7Jwe61+5g6yYpbWr3TlR4HnqTpGL97GBhfRRwVS7FZJV1EI9EceuDAsFadrV en9BlMUmkP5xdmmS6FkxgO4d0apWbXgqj6oZyYR9rhS1VD6OsxuatcX0/okLwSP5JweBfgpztst1s OK8yinYm5HFYjeZ0bHwGkpG+HgIMf1tkJu/6JX/6M9+lMGKbt1+a6nX+9Ny9He8YgrEG3+C4q0n7K oCCPcEY0bfO6XjGnVH1w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAaT5-008CMV-0a; Tue, 05 Dec 2023 18:48:27 +0000 Received: from mail-pf1-x42e.google.com ([2607:f8b0:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAaT3-008CKA-01 for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 18:48:26 +0000 Received: by mail-pf1-x42e.google.com with SMTP id d2e1a72fcca58-6cdf3e99621so1020460b3a.1 for ; Tue, 05 Dec 2023 10:48:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701802101; x=1702406901; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NMuwtjnej1x8HFalp3Q3/OE/xfiviC9gRjxwKKTrR6w=; b=LxKOLuvBN5YzXsngDF6GFqkSGJ7BQXs4P9T0OwASp7k+SsHgvwyFwV9ROKcYu6a6cu ByQV6SyUe03OC/yQr2Rrl33BuHI588JH/MdRqKhNyqrpJ5ZXFB3hdEIHHroqhH3TtKHL EXjjx1novAVN11+v8wR3nJkjU6rlqB0fEvhfw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701802101; x=1702406901; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NMuwtjnej1x8HFalp3Q3/OE/xfiviC9gRjxwKKTrR6w=; b=Jjg/kG2nFiRIPSKRRpxouIIhnhNQJ9axGzzXSCWqNhlWHnHKmocslQeqpJXP9Q+w1s 5oVQaqebVPuymM/WKBtVzMHBZjjyPHUQQJ8FkXiuWJC+2XgNYlyGiI+cwknzLK6KbQWq U1DAe4dp7y/ZkBOM6WuPAg0bTCLqpjdPDE6qmOtOHp6vzj11rZPncv8KUxCoJX9rq+qo ZI1tM/BS77zbHYDBXowGRjNhb9L5wbYteGONPUCOypU5RAtsjf23oIoUbOQ3/Uqqh+nG OabWlw3xjxEyG9qn0ncJG1N/MTcDBfa9dGIqGhRBkSCVIIHe6JRZ9kB1znPeFQurrr0t coGA== X-Gm-Message-State: AOJu0Yxs5Y1j3RhdPB4yBglRaQju5E18lmvWaJg+ARi8qaai7FvQ56tL CpKCqAqR+BkR97xz1uBxE9e2dA== X-Google-Smtp-Source: AGHT+IG46+Q5aksBlxRdZwdbXbmdyxxtbUSk8xgwaeO6yDd7b65xBm2D2UXEYhMABHOhQrKOMFxh8w== X-Received: by 2002:aa7:88c6:0:b0:6ce:4c49:58e4 with SMTP id k6-20020aa788c6000000b006ce4c4958e4mr8321583pff.0.1701802101086; Tue, 05 Dec 2023 10:48:21 -0800 (PST) Received: from lbrmn-mmayer.ric.broadcom.net ([192.19.161.248]) by smtp.gmail.com with ESMTPSA id k14-20020aa788ce000000b006ce5b404f5csm3213329pff.134.2023.12.05.10.48.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:20 -0800 (PST) Received: by lbrmn-mmayer.ric.broadcom.net (Postfix, from userid 1000) id 5BF12D04; Tue, 5 Dec 2023 10:48:19 -0800 (PST) From: Markus Mayer To: Krzysztof Kozlowski , Florian Fainelli , Rob Herring , Conor Dooley Cc: Markus Mayer , Linux ARM Kernel List , Device Tree Mailing List , Linux Kernel Mailing List Subject: [PATCH 2/4] memory: brcmstb_dpfe: introduce version-specific compatible strings Date: Tue, 5 Dec 2023 10:47:35 -0800 Message-ID: <20231205184741.3092376-3-mmayer@broadcom.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205184741.3092376-1-mmayer@broadcom.com> References: <20231205184741.3092376-1-mmayer@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_104825_046987_ABFE401B X-CRM114-Status: GOOD ( 11.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce compatible strings brcm,dpfe-cpu-v1 through brcm,dpfe-cpu-v3 to the Broadcom DPFE driver. Signed-off-by: Markus Mayer Reviewed-by: Florian Fainelli --- drivers/memory/brcmstb_dpfe.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index a7ab3d377206..66876b409e59 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -924,6 +924,12 @@ static const struct of_device_id brcmstb_dpfe_of_match[] = { { .compatible = "brcm,bcm7271-dpfe-cpu", .data = &dpfe_api_old_v2 }, { .compatible = "brcm,bcm7278-dpfe-cpu", .data = &dpfe_api_old_v2 }, { .compatible = "brcm,bcm7211-dpfe-cpu", .data = &dpfe_api_new_v2 }, + + /* Match specific DCPU versions */ + { .compatible = "brcm,dpfe-cpu-v1", .data = &dpfe_api_old_v2 }, + { .compatible = "brcm,dpfe-cpu-v2", .data = &dpfe_api_new_v2 }, + { .compatible = "brcm,dpfe-cpu-v3", .data = &dpfe_api_v3 }, + /* API v3 is the default going forward */ { .compatible = "brcm,dpfe-cpu", .data = &dpfe_api_v3 }, {} From patchwork Tue Dec 5 18:47:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 13480642 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 88EB2C4167B for ; Tue, 5 Dec 2023 18:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Bt1oFrUfIOeBoQF/nHvqMyNq4xwqhjazpXsx2H0uMY0=; b=uz+JMLbH35uFu2 3HD/bL0qYgP4GUmJ7avY5fT6e7nlJdGI6YtF0kglAnpQxyqicUUSNCIKtjYSs0Hzbq1oVIkC72LDy 6ReC6cj/T0z7r0/v2PYn77x3YvJVWfe8yNFLSNyhCzpYwzKgmsb/5FE5XqGsspX5DueOuYcMq0OSm 2Z7QTSVO8w89f30dihooVJxW8tnmsYszDVrazYh7y7xw8O6/mb8axQxIOn+lPsvInTo1LzBi4RuET TOTrgjoUISmeu+eJCuXClgzSDPrFKl1wUSZ0Or1BzgXlUtSanBUF+Ysr+WCcsXQQAQ1uuv61nJ7yH xJun8c/XCANKkgCyALWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAaTC-008CPK-34; Tue, 05 Dec 2023 18:48:34 +0000 Received: from mail-il1-x12a.google.com ([2607:f8b0:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAaT9-008COG-1j for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 18:48:32 +0000 Received: by mail-il1-x12a.google.com with SMTP id e9e14a558f8ab-35d626e4f79so3414925ab.0 for ; Tue, 05 Dec 2023 10:48:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701802110; x=1702406910; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=c83gTiuSNlfK6LuG6NDT4lKYycGtpFWRhFgpMEcF2f0=; b=iDu3zJ2ge5n5g8RHrSLcFaQ4+l8nB7m5wY0gTRq349fEBm5bGj+bkzrp0Ub+5sUjv0 2d8D5zvvhfJkxgaOjXGVqsKRwMLm8chlE9fKQS0CpKcpvgzkupJPfhdbGmSlmKVJ+KfC Jqtu4y91SvoQMGoh8XgeMaUVLF0EU8R3YvXFY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701802110; x=1702406910; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=c83gTiuSNlfK6LuG6NDT4lKYycGtpFWRhFgpMEcF2f0=; b=Cb/9X87wRCyTTC4pklA8APGByOArV7GTOTEBioedGdPdilQ7FEy76SXY9KoSMtAhzI zEaVoFy8na1L0/7k+RDI8bZeVor1S8iyrRt34+Uy4VPLVODI8r+2hasK/gwDJAZjsK1e E+KL/Lu7dn30coGDStYyDxCicqkRXIel1kbu6a8AqE3b7lzuU9i71JWTBtWnoprpzKSG mhQxaNjIV0qS5KEN31emncGIDC3gENONDJClxGmAGHljhkJjeBXPOey20IBpdVAYXN7U ekZ7wMRsjhMiEoBkwLPe3vEr8oi/h0iXXMTAbicKtwEanfpO+wn9uuQDliKl+qMMKZxh bcbw== X-Gm-Message-State: AOJu0Yx6g/Uc1EXbYUN4Q1zFEHJY2R/qWSbSzSjicD0aI7wb7Jw5sVu8 w+QDtN4mpK2401LUFMicTd96rQ== X-Google-Smtp-Source: AGHT+IGfGYG2l4gFdK0OsrZ02weECf9cy2uaEaj17cAMQGSoXntfIxayPGE2QlhNtQlxn10jqttbVw== X-Received: by 2002:a05:6e02:2195:b0:35d:5550:76b7 with SMTP id j21-20020a056e02219500b0035d555076b7mr13324536ila.0.1701802110636; Tue, 05 Dec 2023 10:48:30 -0800 (PST) Received: from lbrmn-mmayer.ric.broadcom.net ([192.19.161.248]) by smtp.gmail.com with ESMTPSA id bd9-20020a656e09000000b0058ee60f8e4dsm8440189pgb.34.2023.12.05.10.48.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:29 -0800 (PST) Received: by lbrmn-mmayer.ric.broadcom.net (Postfix, from userid 1000) id AD769D06; Tue, 5 Dec 2023 10:48:28 -0800 (PST) From: Markus Mayer To: Krzysztof Kozlowski , Florian Fainelli , Rob Herring , Conor Dooley Cc: Markus Mayer , Linux ARM Kernel List , Device Tree Mailing List , Linux Kernel Mailing List Subject: [PATCH 3/4] memory: brcmstb_dpfe: support DPFE API v4 Date: Tue, 5 Dec 2023 10:47:36 -0800 Message-ID: <20231205184741.3092376-4-mmayer@broadcom.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205184741.3092376-1-mmayer@broadcom.com> References: <20231205184741.3092376-1-mmayer@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_104831_572403_9F74E458 X-CRM114-Status: GOOD ( 18.96 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add support for version 4 of the DPFE API. This new version is largely identical to version 3. The main difference is that all commands now take the MHS version number as the first argument. Any other arguments have been pushed down by one (i.e. what used to be arg0 in v3 is arg1 in v4). Signed-off-by: Markus Mayer Reviewed-by: Florian Fainelli --- drivers/memory/brcmstb_dpfe.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 66876b409e59..0b0a9b85b605 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -37,6 +37,9 @@ #define DRVNAME "brcmstb-dpfe" +/* Generic constants */ +#define MHS_VERSION 0x04000000 + /* DCPU register offsets */ #define REG_DCPU_RESET 0x0 #define REG_TO_DCPU_MBOX 0x10 @@ -301,6 +304,28 @@ static const struct dpfe_api dpfe_api_v3 = { }, }; +/* API v4 firmware commands */ +static struct dpfe_api dpfe_api_v4 = { + .version = 4, + .fw_name = NULL, /* We expect the firmware to have been downloaded! */ + .sysfs_attrs = dpfe_v3_groups, /* Same as v3 */ + .command = { + [DPFE_CMD_GET_INFO] = { + [MSG_HEADER] = DPFE_MSG_TYPE_COMMAND, + [MSG_COMMAND] = 0x0101, + [MSG_ARG_COUNT] = 2, + [MSG_ARG0] = MHS_VERSION, + [MSG_ARG0 + 1] = 1, /* Now the 2nd argument */ + }, + [DPFE_CMD_GET_REFRESH] = { + [MSG_HEADER] = DPFE_MSG_TYPE_COMMAND, + [MSG_COMMAND] = 0x0202, + [MSG_ARG_COUNT] = 1, + [MSG_ARG0] = MHS_VERSION, + }, + }, +}; + static const char *get_error_text(unsigned int i) { static const char * const error_text[] = { @@ -929,8 +954,12 @@ static const struct of_device_id brcmstb_dpfe_of_match[] = { { .compatible = "brcm,dpfe-cpu-v1", .data = &dpfe_api_old_v2 }, { .compatible = "brcm,dpfe-cpu-v2", .data = &dpfe_api_new_v2 }, { .compatible = "brcm,dpfe-cpu-v3", .data = &dpfe_api_v3 }, + { .compatible = "brcm,dpfe-cpu-v4", .data = &dpfe_api_v4 }, - /* API v3 is the default going forward */ + /* + * For historical reasons, API v3 is the default if nothing else is + * specified. + */ { .compatible = "brcm,dpfe-cpu", .data = &dpfe_api_v3 }, {} }; From patchwork Tue Dec 5 18:47:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 13480643 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 56417C4167B for ; Tue, 5 Dec 2023 18:49:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LQoxMmkcnWLKXiS6edEXX/CnZCUcu7lt+jBHOnlX0CI=; b=IbXXDDxGUR5A1W RuX1iByQKuPq+j2qX7BhMzILG3yG6pgMivcbZO7d/Xl7RsAw4nxce9DMB49NKqCaDp7s/V+UwLgy+ 9+aMDWw5H2sguAAxXAJ8W/54s+jXHYtDpDWMTL/PasTTno9VdiCxGmfDSPp0G7mvPvY4gcPB7aDno +0+HuPEcqN5SL8YA1qERYciTdt9T5GChJKZnDvhSGXua423LBXcPo3KWT3VOn/rXgYlK9AZf1oBfr M9B4up1lqKw0+7AcJBGrf5G2MOUQ7uoMaEA2okqZ+355jpygHvY7fC+hSRmOv2CffwVvvsEbOAyfV g5CDp6rpCFUbqm4vpU5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rAaTl-008CZa-0L; Tue, 05 Dec 2023 18:49:09 +0000 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rAaTi-008CXZ-1k for linux-arm-kernel@lists.infradead.org; Tue, 05 Dec 2023 18:49:08 +0000 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1d0c7330ad9so1882865ad.1 for ; Tue, 05 Dec 2023 10:49:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701802143; x=1702406943; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=PAOApdPILCdz/7NHT0OHgRBW5hnPP0BdQ0o84+NjOww=; b=bi9JuyH7NZR2XBHbNygwD2q89kadL/YKBIxSOPFVaBX5TAU8Z306c5njzhZzXMAupQ QSJqpCEM9N+vu8tq43K57ZslYLJ55pSYAUZaFZntQaIpIhYCmDJw8+Td7GB/lI0BCr60 XalfaQPgq6EU8FN7X0fSbY6x63Khdy1rI613s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701802143; x=1702406943; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=PAOApdPILCdz/7NHT0OHgRBW5hnPP0BdQ0o84+NjOww=; b=JDAnel2QLlsWO5cgcxKkUG+0RdZYf0NSjatqM5lWLY7IQpZ3l9Lfsx6eSCU7bS3sX6 ZfSEZpG/Ne0H7mM+0GNIXZEFGRBiv1lzWS3Et6Ih4T653JNqD6OeBPRLHpcF81dG+Uq/ JortUbqNbQx7qEZ9QxdJFpghSrfsqWqWsYuAtrAVRJOI2ZzuE2eMCJ16vKPzuwFQcgIP 93XefIcqai/Lj2yiPejElp4eIKq+RuRZgX2VnVhPnn/43gNgazkf0Pew84El/3Ek01HI B5GJwgOEPFl2f9HL1whUfLdeWYfPcyL1U6/gz94WhauM1C5jvpfSIknbHXFXl3GMNb7S +7xQ== X-Gm-Message-State: AOJu0YzAZY5g5H2j9D80AJBvf59WblnEst9qK87ar7nsJyXB3JNgIK++ xzSpJjrFs/Z84gz6mnCoLPFYTg== X-Google-Smtp-Source: AGHT+IEZojP/nyAWpgMigLVhprQ+6SsnFxupIzO7E7slzYCKwS+2sSVt+xGjKRttOqRPDieBqvJUCA== X-Received: by 2002:a17:903:1cf:b0:1d0:83bc:5648 with SMTP id e15-20020a17090301cf00b001d083bc5648mr9728581plh.2.1701802143229; Tue, 05 Dec 2023 10:49:03 -0800 (PST) Received: from lbrmn-mmayer.ric.broadcom.net ([192.19.161.248]) by smtp.gmail.com with ESMTPSA id ik12-20020a170902ab0c00b001d06b93c66dsm7219130plb.233.2023.12.05.10.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:49:02 -0800 (PST) Received: by lbrmn-mmayer.ric.broadcom.net (Postfix, from userid 1000) id 8AAEBD08; Tue, 5 Dec 2023 10:48:37 -0800 (PST) From: Markus Mayer To: Krzysztof Kozlowski , Florian Fainelli , Rob Herring , Conor Dooley Cc: Markus Mayer , Linux ARM Kernel List , Device Tree Mailing List , Linux Kernel Mailing List Subject: [PATCH 4/4] memory: brcmstb_dpfe: introduce best-effort API detection Date: Tue, 5 Dec 2023 10:47:37 -0800 Message-ID: <20231205184741.3092376-5-mmayer@broadcom.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231205184741.3092376-1-mmayer@broadcom.com> References: <20231205184741.3092376-1-mmayer@broadcom.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231205_104906_589361_6C462D8C X-CRM114-Status: GOOD ( 22.01 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a best-effort probe function that tries all known DPFE versions to see if one might actually work. This helps in cases where device tree doesn't provide the proper version information for whatever reason. In that case, the driver may still be able to register if one of the known API versions ends up working. Caveat: we have to skip "v1" during our best effort attempts. This is due to the fact that attempting a firmware download as required by v1 will result in a memory access violation on anything but v1 hardware. This would crash the kernel. Since we don't know the HW version, we need to play it safe and skip v1. Signed-off-by: Markus Mayer Reviewed-by: Florian Fainelli --- drivers/memory/brcmstb_dpfe.c | 58 ++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 0b0a9b85b605..15f4ee3b8535 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -879,6 +879,50 @@ static int brcmstb_dpfe_resume(struct platform_device *pdev) return brcmstb_dpfe_download_firmware(priv); } +static int brcmstb_dpfe_probe_best_effort(struct platform_device *pdev) +{ + const char versioned_compat[] = "brcm,dpfe-cpu-v"; + const char v1_str[] = "-v1"; + const struct of_device_id *matches; + const struct dpfe_api *orig_dpfe_api; + struct device *dev = &pdev->dev; + struct brcmstb_dpfe_priv *priv; + int ret = -ENODEV; + + priv = dev_get_drvdata(dev); + orig_dpfe_api = priv->dpfe_api; + matches = dev->driver->of_match_table; + + /* Loop over all compatible strings */ + for (; matches->compatible[0]; matches++) { + const char *compat = matches->compatible; + /* Find the ones that start with "brcm,dpfe-cpu-v" */ + if (strstr(compat, versioned_compat) == compat) { + char *v1_ptr = strstr(compat, v1_str); + /* + * We must skip v1, since we don't know the hardware + * version and attempting a firmware download on v2 and + * newer would crash the kernel due to a memory access + * violation. + * We make sure to match "-v1" at the end of the string + * only. + */ + if (v1_ptr && v1_ptr[sizeof(v1_str)] == '\0') + continue; + priv->dpfe_api = matches->data; + /* Fingers crossed... */ + ret = brcmstb_dpfe_download_firmware(priv); + if (!ret) + return 0; + } + } + + /* It didn't work, so let's clean up. */ + priv->dpfe_api = orig_dpfe_api; + + return ret; +} + static int brcmstb_dpfe_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -923,8 +967,20 @@ static int brcmstb_dpfe_probe(struct platform_device *pdev) } ret = brcmstb_dpfe_download_firmware(priv); + if (ret && ret != -EPROBE_DEFER) { + /* + * If the information provided by Device Tree didn't work, let's + * try all known version. Maybe one will work. + */ + dev_warn(dev, + "DPFE v%d didn't work, reverting to best-effort\n", + priv->dpfe_api->version); + dev_warn(dev, + "Device Tree and / or the driver should be updated\n"); + ret = brcmstb_dpfe_probe_best_effort(pdev); + } if (ret) - return dev_err_probe(dev, ret, "Couldn't download firmware\n"); + return dev_err_probe(dev, ret, "Unable to talk to DCPU\n"); ret = sysfs_create_groups(&pdev->dev.kobj, priv->dpfe_api->sysfs_attrs); if (!ret)