Message ID | 20231205184741.3092376-4-mmayer@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> 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 <rfc822;chrisfriedt@gmail.com> + 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 <rfc822;linux-kernel@vger.kernel.org>); 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 <linux-kernel@vger.kernel.org>; Tue, 5 Dec 2023 10:48:31 -0800 (PST) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-35d559a71d8so4595045ab.1 for <linux-kernel@vger.kernel.org>; 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 <mmayer@broadcom.com> To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, Florian Fainelli <florian.fainelli@broadcom.com>, Rob Herring <robh+dt@kernel.org>, Conor Dooley <conor+dt@kernel.org> Cc: Markus Mayer <mmayer@broadcom.com>, Linux ARM Kernel List <linux-arm-kernel@lists.infradead.org>, Device Tree Mailing List <devicetree@vger.kernel.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org> 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 Content-Transfer-Encoding: 8bit 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: <linux-kernel.vger.kernel.org> 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 |
Series |
memory: brcmstb_dpfe: support DPFE API v4
|
|
Commit Message
Markus Mayer
Dec. 5, 2023, 6:47 p.m. UTC
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 <mmayer@broadcom.com>
---
drivers/memory/brcmstb_dpfe.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
Comments
On 12/5/23 10:47, Markus Mayer wrote: > 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 <mmayer@broadcom.com> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
On 05/12/2023 19:47, Markus Mayer wrote: > 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 <mmayer@broadcom.com> > --- ... > + > 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 }, > No, use SoC specific compatible. Best regards, Krzysztof
On 12/6/2023 3:10 AM, Krzysztof Kozlowski wrote: > On 05/12/2023 19:47, Markus Mayer wrote: >> 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 <mmayer@broadcom.com> >> --- > > ... > >> + >> 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 }, >> > > No, use SoC specific compatible. This is not that simple because for a given SoC, the API implemented by the firmware can change, in fact it has changed over the lifetime of a given SoC as firmware updates get rolled out. Arguably the dialect spoken by the firmware should not have changed and we told the firmware team about that but it basically went nowhere and here we are. The Device Tree gets populated by the boot loader which figures out which API is spoken and places one of those compatible strings accordingly for the kernel to avoid having to do any sort of run-time detection which is slow and completely unnecessary when we can simply tell it ahead of time what to use.
On 06/12/2023 17:18, Florian Fainelli wrote: > > > On 12/6/2023 3:10 AM, Krzysztof Kozlowski wrote: >> On 05/12/2023 19:47, Markus Mayer wrote: >>> 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 <mmayer@broadcom.com> >>> --- >> >> ... >> >>> + >>> 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 }, >>> >> >> No, use SoC specific compatible. > > This is not that simple because for a given SoC, the API implemented by > the firmware can change, in fact it has changed over the lifetime of a > given SoC as firmware updates get rolled out. Arguably the dialect > spoken by the firmware should not have changed and we told the firmware > team about that but it basically went nowhere and here we are. > > The Device Tree gets populated by the boot loader which figures out > which API is spoken and places one of those compatible strings > accordingly for the kernel to avoid having to do any sort of run-time > detection which is slow and completely unnecessary when we can simply > tell it ahead of time what to use. Thanks for providing justification, quite reasonable. A pity that none of the commit msgs answered this way. Best regards, Krzysztof
On Wed, 6 Dec 2023 at 09:32, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> wrote: > > On 06/12/2023 17:18, Florian Fainelli wrote: > > > > > > On 12/6/2023 3:10 AM, Krzysztof Kozlowski wrote: > >> On 05/12/2023 19:47, Markus Mayer wrote: > >>> 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 <mmayer@broadcom.com> > >> > >> ... > >> > >>> + > >>> 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 }, > >>> > >> > >> No, use SoC specific compatible. > > > > This is not that simple because for a given SoC, the API implemented by > > the firmware can change, in fact it has changed over the lifetime of a > > given SoC as firmware updates get rolled out. Arguably the dialect > > spoken by the firmware should not have changed and we told the firmware > > team about that but it basically went nowhere and here we are. > > > > The Device Tree gets populated by the boot loader which figures out > > which API is spoken and places one of those compatible strings > > accordingly for the kernel to avoid having to do any sort of run-time > > detection which is slow and completely unnecessary when we can simply > > tell it ahead of time what to use. > > Thanks for providing justification, quite reasonable. A pity that none > of the commit msgs answered this way. The real pity is how this API was designed, making all of this necessary in the first place. We can definitely spell out more clearly in the commit messages what is going on and why all of this is needed. I'll pull all the pieces together from the various responses. As long as there's a way we can reasonably implement what we need, we'll be happy. > Best regards, > Krzysztof
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 }, {} };