Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3163434ybi; Fri, 5 Jul 2019 03:00:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqwUq5C6s2dV2Bbz7TNRps0X8AawiKGb2UExk+vTxp80Xb7Xxn6EiL3mzpKro+dqMNK+u/hz X-Received: by 2002:a63:490a:: with SMTP id w10mr4392222pga.6.1562320846411; Fri, 05 Jul 2019 03:00:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562320846; cv=none; d=google.com; s=arc-20160816; b=DkcV+3WEHbxwjc3tvhLe3kUWI3Elpc9GJHmCF0XDjLXPY0A/2+jIYK4BzagD2ze8OC NwCwQOFIXI9UOo8/bVFJ3dVcKdJ6XVpI+RNtlb+dEIaox/IpFHesZPRlBTZQMUr2FIHD ujC0WqpEQ4+EAzDlSDo+ukfsOChTPAivdFqSqgMDMlkf+21cNDKFq50ZX65JgDaNiR2p E/A5HFImlwMCR1n/Hck06PkMLuwZVdMoioZgCiD0QZFb1Wf9wJeiJW1Dm47aSlfnUJ9C yj8BHCSO/vAStTDCmNWd0UBvIx2A2luDDQGefvitDTrqIu2MKVQI13Iu4e1PnCooDoLg xOGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=QADSqiPugBfPEgEw9j6Pmb9m4CDTvYwwauTQ3uTrasM=; b=Vwq7YgHjF06LyyyrHNFglckKCzluH9dHn2rGKPE+qtnlVM6y6QH75hWNjTwSriQOp+ rwVSPm6pJpoOhCX15/IDvzurj+Zi8+21B25grb2dV4pvHNycKo/EfmxHyUhbKSdvadKo Vp2xnlvXHvPNhllgp+yLRFqFRvauauBn8yO/ehGmb2h3qLijOZlln69KejObFQtbz6bL cJA5FNCBbPPSNFu2dU7GNdX0dGLdqVrOw/dnGn1hq9PiEcVpXcA285GJUZqa8X6jvkrc /fU7hdtoZnL3yp6RvbQppDakKed2zkCYVYjO9qWs2aiaOLsqPcNbuP56vJED+bioXdYB D1cA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t184si9041196pgd.211.2019.07.05.03.00.30; Fri, 05 Jul 2019 03:00:46 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbfGEJ6H (ORCPT + 99 others); Fri, 5 Jul 2019 05:58:07 -0400 Received: from mga18.intel.com ([134.134.136.126]:42367 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728167AbfGEJ6F (ORCPT ); Fri, 5 Jul 2019 05:58:05 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Jul 2019 02:58:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,454,1557212400"; d="scan'208";a="166448204" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 05 Jul 2019 02:58:01 -0700 Received: by black.fi.intel.com (Postfix, from userid 1001) id D7768361; Fri, 5 Jul 2019 12:58:00 +0300 (EEST) From: Mika Westerberg To: linux-kernel@vger.kernel.org Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , "Rafael J . Wysocki" , Len Brown , Lukas Wunner , Mario.Limonciello@dell.com, Anthony Wong , Mika Westerberg , linux-acpi@vger.kernel.org Subject: [PATCH 2/8] thunderbolt: Move NVM upgrade support flag to struct icm Date: Fri, 5 Jul 2019 12:57:54 +0300 Message-Id: <20190705095800.43534-3-mika.westerberg@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190705095800.43534-1-mika.westerberg@linux.intel.com> References: <20190705095800.43534-1-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is depends on the controller and on the platform/CPU we are running. Move it to struct icm so we can set it per controller. Signed-off-by: Mika Westerberg --- drivers/thunderbolt/icm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c index fbdcef56a676..2a56d9478b34 100644 --- a/drivers/thunderbolt/icm.c +++ b/drivers/thunderbolt/icm.c @@ -55,6 +55,7 @@ * @safe_mode: ICM is in safe mode * @max_boot_acl: Maximum number of preboot ACL entries (%0 if not supported) * @rpm: Does the controller support runtime PM (RTD3) + * @can_upgrade_nvm: Can the NVM firmware be upgrade on this controller * @is_supported: Checks if we can support ICM on this controller * @cio_reset: Trigger CIO reset * @get_mode: Read and return the ICM firmware mode (optional) @@ -74,6 +75,7 @@ struct icm { int vnd_cap; bool safe_mode; bool rpm; + bool can_upgrade_nvm; bool (*is_supported)(struct tb *tb); int (*cio_reset)(struct tb *tb); int (*get_mode)(struct tb *tb); @@ -1913,12 +1915,7 @@ static int icm_start(struct tb *tb) if (IS_ERR(tb->root_switch)) return PTR_ERR(tb->root_switch); - /* - * NVM upgrade has not been tested on Apple systems and they - * don't provide images publicly either. To be on the safe side - * prevent root switch NVM upgrade on Macs for now. - */ - tb->root_switch->no_nvm_upgrade = x86_apple_machine; + tb->root_switch->no_nvm_upgrade = !icm->can_upgrade_nvm; tb->root_switch->rpm = icm->rpm; ret = tb_switch_add(tb->root_switch); @@ -2021,6 +2018,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) switch (nhi->pdev->device) { case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI: case PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI: + icm->can_upgrade_nvm = true; icm->is_supported = icm_fr_is_supported; icm->get_route = icm_fr_get_route; icm->save_devices = icm_fr_save_devices; @@ -2038,6 +2036,13 @@ struct tb *icm_probe(struct tb_nhi *nhi) case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_NHI: case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_NHI: icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; + /* + * NVM upgrade has not been tested on Apple systems and + * they don't provide images publicly either. To be on + * the safe side prevent root switch NVM upgrade on Macs + * for now. + */ + icm->can_upgrade_nvm = !x86_apple_machine; icm->is_supported = icm_ar_is_supported; icm->cio_reset = icm_ar_cio_reset; icm->get_mode = icm_ar_get_mode; @@ -2054,6 +2059,7 @@ struct tb *icm_probe(struct tb_nhi *nhi) case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_NHI: case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_NHI: icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; + icm->can_upgrade_nvm = true; icm->is_supported = icm_ar_is_supported; icm->cio_reset = icm_tr_cio_reset; icm->get_mode = icm_ar_get_mode; -- 2.20.1