Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp6916685ybp; Wed, 16 Oct 2019 00:35:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwSMJFaPzCVdK+sIIzEzIvqnzHMIMRwiLxuNsu8LZfU3kTj79UXR7chZ+6FXDueD4xfELR X-Received: by 2002:a17:906:a88e:: with SMTP id ha14mr37275719ejb.92.1571211339862; Wed, 16 Oct 2019 00:35:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571211339; cv=none; d=google.com; s=arc-20160816; b=u3GVnxWllY0szAd9cHUfWzxpbhs9YUFHNH4GcoJ9w4y+/fSVccvJW507aTh1ry0j4l SVPqEplzFudVK7blTaJJc02BiqVSiydFpTOoijZiWX4VnlQoN4IJM9b0tOYgTAl70MEs CdYbwAUpImP6uTLWwsWa7OBCl7Eo/ZojwDQzzMIvuVLHuynzvEtMJ3p1ABjfGdfRboQR aSPD0rLzfS73Ubf88KpTMfGxcSuK7RTw3OTBEMScIl5bKc1npbZw+V8i0cTlfFLHSo6D 1rW7GGtpnJnbTTY2zzFaUJsdsU5A/lcgf1zRAleudW/feVqQv+wewTjdC0bm/SwKLIos vZuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=MqCNoFXBnDQS65g3QEqNb06DM9l3Y39pluZuZL8mhfQ=; b=i6ui8rPfs0d43PLdxnHJGzCJB20vJQcKnGZDXHThlBs+zIAwXATvPU0R/tQfV3jVLB GoqptOhRCUUZ+D7i8fgxCJDiSfSHkWtfwMkGnTsOh8jIs4qPGLVkbsJU2kb/nsda2vsj 1gkj8oSdqqiZ0EzebSOE1yKWWCpq0Tt2jcZ0W9RKpUjuuyB0SBD6yON4UO7I8YmGXyB5 DAfjvm/1SKni3eJC8c02/l237+JpzBVo83YeFVFVZT3K8El3Mm0uWwd/0VkPdifv+8kU 59HCsMdSIVA+OKYFqcXIjIAsYn++bLNpvyZ2PNeF0u+7WuD6gqM2s4aEtzTQ6kO+0TVU 047Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=JzRUUJ0N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e57si16762111ede.356.2019.10.16.00.35.15; Wed, 16 Oct 2019 00:35:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=JzRUUJ0N; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390096AbfJOWrJ (ORCPT + 99 others); Tue, 15 Oct 2019 18:47:09 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46698 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728835AbfJOWrI (ORCPT ); Tue, 15 Oct 2019 18:47:08 -0400 Received: by mail-pg1-f193.google.com with SMTP id e15so5014491pgu.13 for ; Tue, 15 Oct 2019 15:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=MqCNoFXBnDQS65g3QEqNb06DM9l3Y39pluZuZL8mhfQ=; b=JzRUUJ0N7j75JfIwIlSihcUiHylr54bI1uG5EWH0+1obdUFxbvz/3Gcp0Mksm3QbSD DSqVZw4UVHxDaQO24T8/j09J3QdOIRgtDqEJFmTEVROpqXxxapfyhmLfN7QY4nk7MdEn ufhPEsGN1tPujh+8NcN+TtgLs+5SM7woNqW80= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=MqCNoFXBnDQS65g3QEqNb06DM9l3Y39pluZuZL8mhfQ=; b=DXTOsFjR1I0IfxPM+HRBFMnCOjsknsAN47aDdL6trk5ljmOzk/2cG4+KJ2WYZh4mpE 7gFwJEIrNmeAL99elv9aX3fk+diV+zI40UQxsOE50U7ldJ8UD7/HZYLNnAKi8ANSPnEz IKVQGxR6LT/dBQaO8wXwqsW6sM/T64o961UnJ/1SpvHOi4z3APKrfKvL88GHytem4P9Z FA4NWbmS7dCKeMzyqoW505tqVFB9FjlH2136KMCdjoQlPIuj5qkxYUjHyqUyOJr/u8kq lL3DF3TyOuuKwkm1b0W57aASSIL3XylNI8vnYmyys0UpQWL91RX1btPHqwBP+D40I48N odIg== X-Gm-Message-State: APjAAAW1iufU4zJPkOWvjC/h5azwOK5FZ1sqcrhfFnaE7Ry/aZL9Nt8n exrrwbv4Ori5cHC7bQioV29Hu5khw+1pfQ== X-Received: by 2002:a62:5ac3:: with SMTP id o186mr41145786pfb.20.1571179627935; Tue, 15 Oct 2019 15:47:07 -0700 (PDT) Received: from lbrmn-mmayer.ric.broadcom.com ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id e127sm23019837pfe.37.2019.10.15.15.47.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2019 15:47:07 -0700 (PDT) From: Markus Mayer To: Brian Norris , Florian Fainelli , Gregory Fong Cc: Broadcom Kernel List , ARM Kernel List , Linux Kernel Mailing List , Markus Mayer Subject: [PATCH 8/8] memory: brcmstb: dpfe: Fixup API version/commands for 7211 Date: Tue, 15 Oct 2019 15:45:13 -0700 Message-Id: <20191015224513.16969-9-mmayer@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191015224513.16969-1-mmayer@broadcom.com> References: <20191015224513.16969-1-mmayer@broadcom.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli 7211 uses a newer version of API v2 which is half way between what was defined as API v3 and what used to be called API v2 but was used with DPFE firmwares with major versions 1.x.x.x. Starting with **the new** API v2, we are no longer getting loadable firmware images, so the capability to load it is removed (like v3). To avoid spreading more confusion, map 7268/7271/7278 to the old DPFE API version 2, 7211 to the new API v2 and introduce the specific commands for that, and leave newer versions to map to API v3. Signed-off-by: Florian Fainelli Signed-off-by: Markus Mayer --- drivers/memory/brcmstb_dpfe.c | 44 ++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/drivers/memory/brcmstb_dpfe.c b/drivers/memory/brcmstb_dpfe.c index 7c6e85ad25a7..82b415be18d1 100644 --- a/drivers/memory/brcmstb_dpfe.c +++ b/drivers/memory/brcmstb_dpfe.c @@ -231,9 +231,13 @@ static struct attribute *dpfe_v3_attrs[] = { }; ATTRIBUTE_GROUPS(dpfe_v3); -/* API v2 firmware commands */ -static const struct dpfe_api dpfe_api_v2 = { - .version = 2, +/* + * Old API v2 firmware commands, as defined in the rev 0.61 specification, we + * use a version set to 1 to denote that it is not compatible with the new API + * v2 and onwards. + */ +static const struct dpfe_api dpfe_api_old_v2 = { + .version = 1, .fw_name = "dpfe.bin", .sysfs_attrs = dpfe_v2_groups, .command = { @@ -258,6 +262,30 @@ static const struct dpfe_api dpfe_api_v2 = { } }; +/* + * API v2 firmware commands, as defined in the rev 0.8 specification, named new + * v2 here + */ +static const struct dpfe_api dpfe_api_new_v2 = { + .version = 2, + .fw_name = NULL, /* We expect the firmware to have been downloaded! */ + .sysfs_attrs = dpfe_v2_groups, + .command = { + [DPFE_CMD_GET_INFO] = { + [MSG_HEADER] = DPFE_MSG_TYPE_COMMAND, + [MSG_COMMAND] = 0x101, + }, + [DPFE_CMD_GET_REFRESH] = { + [MSG_HEADER] = DPFE_MSG_TYPE_COMMAND, + [MSG_COMMAND] = 0x201, + }, + [DPFE_CMD_GET_VENDOR] = { + [MSG_HEADER] = DPFE_MSG_TYPE_COMMAND, + [MSG_COMMAND] = 0x202, + }, + } +}; + /* API v3 firmware commands */ static const struct dpfe_api dpfe_api_v3 = { .version = 3, @@ -390,7 +418,7 @@ static void __finalize_command(struct brcmstb_dpfe_priv *priv) * It depends on the API version which MBOX register we have to write to * to signal we are done. */ - release_mbox = (priv->dpfe_api->version < 3) + release_mbox = (priv->dpfe_api->version < 2) ? REG_TO_HOST_MBOX : REG_TO_DCPU_MBOX; writel_relaxed(0, priv->regs + release_mbox); } @@ -886,10 +914,10 @@ static int brcmstb_dpfe_remove(struct platform_device *pdev) static const struct of_device_id brcmstb_dpfe_of_match[] = { /* Use legacy API v2 for a select number of chips */ - { .compatible = "brcm,bcm7268-dpfe-cpu", .data = &dpfe_api_v2 }, - { .compatible = "brcm,bcm7271-dpfe-cpu", .data = &dpfe_api_v2 }, - { .compatible = "brcm,bcm7278-dpfe-cpu", .data = &dpfe_api_v2 }, - { .compatible = "brcm,bcm7211-dpfe-cpu", .data = &dpfe_api_v2 }, + { .compatible = "brcm,bcm7268-dpfe-cpu", .data = &dpfe_api_old_v2 }, + { .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 }, /* API v3 is the default going forward */ { .compatible = "brcm,dpfe-cpu", .data = &dpfe_api_v3 }, {} -- 2.17.1