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: 174165 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3635511vqy; Tue, 5 Dec 2023 10:48:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmJchERXcPHON5S+PPilyhHanMfKwJOflQon8Uajii2dSlitQcbyW6/o3V6fMPNslaY+zQ X-Received: by 2002:a05:6358:7206:b0:16d:fcf8:ea7 with SMTP id h6-20020a056358720600b0016dfcf80ea7mr8004377rwa.16.1701802108471; Tue, 05 Dec 2023 10:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701802108; cv=none; d=google.com; s=arc-20160816; b=m52A+q1AIlZEvrUvPwSseFI6zDYjCSitnwHuRwZ/bcK9abLyfLUpunvO0LOQSzGsDF QmT++7FZR1+onTFsRxlIpUxiv8lzqWJv6O4d5gEDplQhoSh6LFKWJt3vpPtMJe2QSea3 z92OrEZr6nQjhma1TsJal/8yWsoir/k/zyA7mAH8wXo5YmkVVfhtDrFm5p0uxu83Vuel lNW/UtuBS9UJmyxxtd71S/F6nqZ+kAigZRpRd1vhm9KcrHRuOvbx/xDj3weVnCSpTQCL HZnBQiZGZUEKFTWYboF6/voNMCj1juwSyTxEIyRgRgxkgrOTGNZqHINt0htD16h4j2rf g1xg== 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=vDgn1SrDftxmBi54zNdMtJUWGA9ZxIzk+fgRKHhw/lM=; fh=JtBfHkLwU5057B0nnGl+wIE10FqpQSpetKyOLDjQ+JQ=; b=oxzGvgmoPw2sfPY3PKiqTvm1++vjyNWmSKqTarTJrx9UaiINQF5JF4jRxqQ7PbDg4j K43NqNJ4DxPO8rRYDs7lxbWClkyT9kZSWjs+lP8h27AU3CIp5OG3kcS+W8Z1aQIu32lE qwDNT6Tuxi1awIg5vXTzLcPkPN7bws0Jm1OloPGcOBrpfpZztTzvrDg79yG8lMpATbnr ZjerbQvq4FDVhrNvJlttjlpgLuDJ2WdvywQs1r3U+pK97JBllsPyb4ntXuPPJ1Mvuag0 Hmxv+xbrBPQI2gpSXUoTCNeRpzvIBWGMsxpJZ45vPvlbljtPkzdLVbj4FEm9+SJkl8Qn NRTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QtEMLXZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id g10-20020a656cca000000b005c1cd597808si10816761pgw.692.2023.12.05.10.48.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=QtEMLXZR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A8F3180ACC5C; Tue, 5 Dec 2023 10:48:21 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232142AbjLESsM (ORCPT + 99 others); Tue, 5 Dec 2023 13:48:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232103AbjLESsK (ORCPT ); Tue, 5 Dec 2023 13:48:10 -0500 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A56DBD44 for ; Tue, 5 Dec 2023 10:48:15 -0800 (PST) Received: by mail-oo1-xc30.google.com with SMTP id 006d021491bc7-58de9deec94so470730eaf.0 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=vger.kernel.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=QtEMLXZR5fcHbcLUT4m6kHVdo/6Rk4WgCFLe8+Wzei1nyhxKG/CO046VvhXG5s+von i3FjB3oStaA7mNvXRZGy7c6bkqfPvM/chff/5l6veCF/5LNhLxvkaXtVHBuHbxniBrUD eY0/r2q+GWA2SxnfRdJZVdIspWd058+ENn784= 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=GXSz1B6kJm0wmb9H+qvFX08DWyEyDt43VlpEWue6lxnf/xKaztOVRVQNiSR0yNCaX1 y9scQ/Z0+1YVNOKmKN2v1DrSswdeo4UYm3FQZRb60vNAjqLd1CV9bSpgSNO05eVHL2vS gYQJ5thBf6jFJYsCw95+dzAS1J3AHv4EZKHkHBCslEq+vpB+j8RjPBrbxJIomNr5M231 JxFAcFYULgDze4vaa5r8sIlZoGCetfZPAABtgkJ2+sVvuzPGAv1J2abqMUai7kW83Rqb QYJ8sn4Rmgr8opWrunau06bOCRrk16ATYeUiWz9/pXJP3LGrb5RfwqVFW2hIxRvZZxg/ OuTA== X-Gm-Message-State: AOJu0YxqXaHiZsAqjrSCRPXCOzFG42+nO+Vroby63MSCAbCNbbJekGKy lpANW0mzqy9m4HYqFof/ICfQ0g== 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 10:48:22 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784468848115355079 X-GMAIL-MSGID: 1784468848115355079 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: 174166 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3635529vqy; Tue, 5 Dec 2023 10:48:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGFw0ia9rnqkWee4KA97WReP5WGX81/RwMYEzvekoUHX4OXFcAuY31gzHwuwXsvapeAlsXC X-Received: by 2002:a17:90a:e654:b0:286:6cc1:864e with SMTP id ep20-20020a17090ae65400b002866cc1864emr1323479pjb.51.1701802111474; Tue, 05 Dec 2023 10:48:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701802111; cv=none; d=google.com; s=arc-20160816; b=YgQ+7UxF1G55pFKa9QkIhJLCbI4ZK/aKQhr7MItLrBhgHn929teSD7f+6QLiOEI65d aKlzJ/Qzoex+zjTN6dy45S6bP/kWCHD3lGbHrULqrghzcsJEPu9n7ot/nAtrxGhnSbvM w0i7MJbj47nzFXniKdQlkvvAg03AKqjDNYteWS2nvRG9Pl2Tm7QDhwRNxbXMdTVz2vfV TCAKSNxXObSlkePJP6BELQOIF1UlNP5fgIQodxjAXtBfLHElAk+q+V60OI8bY25TJTps gINbWDQ5HE52YATBTV2pqnqrQxFXaLKspONU2ZalxPx49Au8IwBI6dVVsIKLDO9DTblL tNtQ== 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=NMuwtjnej1x8HFalp3Q3/OE/xfiviC9gRjxwKKTrR6w=; fh=JtBfHkLwU5057B0nnGl+wIE10FqpQSpetKyOLDjQ+JQ=; b=rIg93yy8+HG7ymLYnYP25m44IHjHQ/cZbIm5KBUQcDe9vgNk5ve/U7JtVyMUeFzXR7 05ljwvkeyvKsTtZoAcuSfT/fHB07KJ65hqdfhBUP+Tj19aIr+aAgqkU1Jn0lPgHxG5qG iGlmbK1hY27Z6yuTn0xqip2jV7J2sX8Tm5xKo6Wo+ZDr7CRtYfpDYHuChqexhDBbkIJe jV2LPGmDYkBv9qTIN6wyu7YwUKQcEWwHNTUnCBHATQnG0K2xe61Jm1fbnbLKkJ+y9H73 9Lak4Ybb+mcpXTJy5P9fsWAUwbfSFnjplEOY89dsLUzpz6NsyLsq6Tb27eLc/RCT56K/ jXzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=gpEQpc62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id jj3-20020a170903048300b001d0b693adf9si2785947plb.39.2023.12.05.10.48.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=gpEQpc62; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 2AFBA80309DA; Tue, 5 Dec 2023 10:48:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232254AbjLESsU (ORCPT + 99 others); Tue, 5 Dec 2023 13:48:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232202AbjLESsR (ORCPT ); Tue, 5 Dec 2023 13:48:17 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED6AD42 for ; Tue, 5 Dec 2023 10:48:21 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-6ce6f4d3dafso166663b3a.0 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=vger.kernel.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=gpEQpc62O1bItJgwaYS33n3QRx0bg7SaxQZ+UbpjC8QwzanI0+gn9nayYjx+p3VEoQ IOVL8qx7o7ZF9TzF+j1URzR9MJsJemhepUEQv3HX9DxZVfv4p/Dz14OMvIJQPzqmJ44h QClHW7S4s88WtIOGPEeT8fAwTPMDdNWD4o/Sw= 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=A2bRA4FX6MfA9wjhv3Yy2W0UH5syAQoo4TclehP3mpYxMGLNXpHXrwgj760v0jxfYB h7QAw6X8coMIU06mpKHL/oR2NysWdAogH9qMhPB6SvvSNxHgsFt5INlEWFbX9aTH0YOg tBAc5etcViwnI9uOjsw5vjBetu4Gqi1gMluNPxwOcg7cvxQCzBOblfzlQMJ81uq4fo6O mcVqinZ2JBI3R6XVQ3OGuJReRCcTSYnmvQDya4sNVUT30Bzya+6LKaGBc9cMgER/VxFO Qiq+oBiRtSGH4gCfvf9fgh/zfr5TfFP66AYYtKBPA2BNmR01a3hyRiCkzsYvIIpapkxH df4Q== X-Gm-Message-State: AOJu0Yx31D755pfRZgNvPvzXK/P6NYvY0HXqRjXT+A5DxFyQhNTVycIq fqPuoQVYqR/nTY65uQ30LEo5gw== 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-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 05 Dec 2023 10:48:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784468850680726067 X-GMAIL-MSGID: 1784468850680726067 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: 174167 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3635609vqy; Tue, 5 Dec 2023 10:48:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IG0ViLAox4YMP5e3Hw+Gud13MKKaEVU2q6UCxAgqX29Vz+bvUFlAy5Oe2Ebe5aR7YhsVj4z X-Received: by 2002:a17:902:cec8:b0:1d0:ce26:7ea1 with SMTP id d8-20020a170902cec800b001d0ce267ea1mr575218plg.44.1701802124017; Tue, 05 Dec 2023 10:48:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701802123; cv=none; d=google.com; s=arc-20160816; b=j4O3UvFZ3pzSbZ/Jdp+jgtFuo+Grxfw/dK9USmSXcKt8ZSLe9jAoGMtUpXt/1F3gJN 9+dPbvi6dPNV4TqvC2icgfeusWUULYTvGrlZEilpFK5SuiUhbtkX6pmKhEZmq7yS9/RA 5Cgn94+4IkKJwqIG29r4XgITDl0zW2WBnm46Zjj6DUwAUptG0bsArrfU+1pN2N4nj7h8 xZ0aSmBr4sM39LDh/TWjm7Qh4BVaQdeEZmo8ARqD36hcKM4t/JR8K6mCfq07S8OIUpts wScKVZW3m/wZuQ9wUgV0PWm+iOs/k/fGDBfldQ9wlUFkQpDdvc/8p2bvYV4iBE8deAAr MjIA== 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=c83gTiuSNlfK6LuG6NDT4lKYycGtpFWRhFgpMEcF2f0=; fh=JtBfHkLwU5057B0nnGl+wIE10FqpQSpetKyOLDjQ+JQ=; b=XQkVnmxQsGxobytgx7CER9VrJz/R7iea3PQEgaflLM3SjCyhgfR9LDgxCyEeTPxnJP Y+ARNZIJl2+fbdgfhjIvNLJ9UavRSe42LfEEVp+nrPJCNBhbxPhpbGen5ppieGBO5nYF cThGMni7Llkh+mJf2qftIPHrBOdzohXu2BDwn338bt0Uc73O6RFVWBtZhv0yVry80STG x76fMxeYDiXsB07YMHVp+NGqoUK4AXwtg37nDp5BBV9zXFusJVCbr2LyR8zCZgNHEh4g lDzlNG1016PdE2HvWtp9WEyr8b57/ROoPRInpk8PJkzbU8bI8CibeszBqlZe+R8EZqNd 6ofQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Sd1uSfKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id m22-20020a170902bb9600b001d08bbcf772si4666717pls.362.2023.12.05.10.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:48:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=Sd1uSfKe; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9730081EA5F9; Tue, 5 Dec 2023 10:48:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232256AbjLESsc (ORCPT + 99 others); Tue, 5 Dec 2023 13:48:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235059AbjLESs0 (ORCPT ); Tue, 5 Dec 2023 13:48:26 -0500 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71C90D62 for ; Tue, 5 Dec 2023 10:48:31 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-35d559a71d8so4595045ab.1 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=vger.kernel.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=Sd1uSfKeg/vkyrL7j+/8c8WoxdnHmQ94waLtsfDQly9ykwlOR7CW5OVXw9//l1UmB7 sbdpANDp7hAgHPBb3XYD5a5jzrNuKK87Xlw2M3gKE1BcOed9zJmYRHsdmpzAmvKHwPRq IAl1Z0mGy1taoEqa7iD5PYMf+07ubTz/JQOkg= 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=qUy6ZHHJbI45yVdqf7AaLJj7PS/7iepZh7YuKA/Gjpv//dr8Pt78JqAAoJH91/dtxo hhSaPS/PmWpVgkKNNwFRklFsTiqctll9MXlRuRk5LWoBz35ot0LInoqtekf/LoTpkbJS o61cXPTS4VecKR7SD0lXw023DEMHylhxL4vpK0pR32ez3Pb4XRXF7Cdxgvi3P5cLxEMf InBrV/JwK/vB9iBYnT+nY8HzCM74yqWjS8MapV8awwfbhHxhZyoYnB0t7V2gXlDsJI/O MSQa/gD2ovxxjbtz5hzPaeoJ5rGbhKpxKeaMZnMa0x7RPlFH6hi8PpxdyJUMbk1ruqD0 HaEA== X-Gm-Message-State: AOJu0Yy9EmgYZh1HrDa7pyi1T5jX1S1sBA4xC9AI5Vcozm4ff+3D2n7B RjC5aGR9y3NnCGUyB+4b0/adXQ== 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Tue, 05 Dec 2023 10:48:41 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784468831019503699 X-GMAIL-MSGID: 1784468864222562961 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: 174168 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3635865vqy; Tue, 5 Dec 2023 10:49:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU8eGKNQS/N18BGYJ1Uww8ykXTSv2oSAt58AUpW9oqhT2HDo1gweoJGqF5wYP9VJ5OcTJs X-Received: by 2002:a05:6a21:788b:b0:18b:d823:5362 with SMTP id bf11-20020a056a21788b00b0018bd8235362mr3949648pzc.48.1701802156330; Tue, 05 Dec 2023 10:49:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701802156; cv=none; d=google.com; s=arc-20160816; b=hiQe0D1eTfIszE6Tv5UfFlwSnmX2sQ878+/KUTJv4fKLF/CVtqDG2ep8sJ+xIQ9t2K VaByju5TI/SidIu1Fh3bFpE4e52r6jLUDbhSE6waa/W3Ijo+e2JZ5/cDL9EvXn+n7tO5 QYUrlJJgpndUJBtTX/ldW7JLo3rPAsIA/uZW3nWP2yHK1pT/zBshsImYljpaA729IQF5 JPa8ga3NKxRWhRX5At3CEiUeOT094zYAGw5fJ/mvQZ25sETR2EvsiNPRiZBAQjTaNnOC numTVaKx44oIzB+lKuKK+KAR9u3FPK1Z4RdZ8OYGQdHHX5wHbe9a8h43iqtYSd4NIu+J 8a5g== 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=PAOApdPILCdz/7NHT0OHgRBW5hnPP0BdQ0o84+NjOww=; fh=JtBfHkLwU5057B0nnGl+wIE10FqpQSpetKyOLDjQ+JQ=; b=EmqJQJ7THv1kowXisjo2ZHPX9U647Fv4LYIjbVqjETri+atB5KL8ymFQjgXnGpzum9 VLi/qB+Ikwv6FKgLtS3UsDLZEMfq538H+1QSVvM7xUU7zS0o9nqwe8gs5hn1CbvlhoWu /i2RmGrUEAjGRrpDcuX4HJXsaxPGcvUeUAmjQ1HOFZNHoTnRayl9+zJDNcue4eC7NKgt qtYHhSvTsiZYDWzQILj7+1KFSxhrvePLloEHQgPH6RDdWRLN1TxRI/jxVdKcm6fKrof0 5ZKozmr8Bfx50pukYzUOdKBBSlQC/GjMS3ZgXQRlKYeV/131TseLIw+U6XO/grKfpgPu F52g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=X3OP25Y9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id l6-20020a056a00140600b006cb63513372si9789019pfu.12.2023.12.05.10.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 10:49:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=X3OP25Y9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 176A180ACC55; Tue, 5 Dec 2023 10:49:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235173AbjLEStD (ORCPT + 99 others); Tue, 5 Dec 2023 13:49:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345430AbjLESs5 (ORCPT ); Tue, 5 Dec 2023 13:48:57 -0500 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A4BD1A2 for ; Tue, 5 Dec 2023 10:49:04 -0800 (PST) Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d072f50a44so10046145ad.0 for ; Tue, 05 Dec 2023 10:49:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1701802143; x=1702406943; darn=vger.kernel.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=X3OP25Y9cGtbJfxd/TpsfVR5t5AMcrx/bRiB811CBgxscBISvPbkE8Qxdxn/E/ee8f d1IIsu88aXlGnr2n5/Eh5ozyuumTFbEhOu4V2pfu1d8+efJgUiLG7kIJS23upwVl88+5 y1XvRxGzRPoHyQIR5D6LsHM/wUI84w1gRWP6s= 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=tPKPbB8OawCCd29hVTW8A3SRNL0fQ7v8tQVaCsgJK9w9nXbUMz5PAgo45nhxMnvnIe 2S9uCGD0M34P7+z53LLAkfE1YF5rDZ00jb7HZJN0kHBjcLjJqQ5C2X0cQTKd+rumcJh0 Erv4PZp11RFlgafnxtcMRCQjPPTMZfD5kppz1I2LLOi6IY91IhInv7PoWRzDnOaw6E0L F/8oYehiyVjclBpWhUWaYA1RCm5XCXSwOcuq8JIxmgGYogltPZlCvBioZeEcdLjI2NTw 2SWVTSt0FsfkHiJwnsIikyxUfMQo58QgeOGdnw3FIc+c4DlKeIz4yU4HqsQCOOdoXoYd eGdA== X-Gm-Message-State: AOJu0YzosoD4ni9WZzJuDGSpkN6jV5904TheZ1Z7kgQ+1jf5zd776qzn lsNdv4C8SkfZR22wAZZdgSZCng== 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-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Tue, 05 Dec 2023 10:49:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784468898069863799 X-GMAIL-MSGID: 1784468898069863799 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)