From patchwork Wed Jul 24 14:00:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Usyskin, Alexander" X-Patchwork-Id: 814849 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89907EEAB for ; Wed, 24 Jul 2024 14:09:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721830176; cv=none; b=lHuoy7++UfHfUgHZbfSIkyUzUNjtfBSNzJIczLZUuDSzhcmwq6FekAN5oUGYu4reC6HaIyxBvjD3+mGb+UFG/HMseB0ga0kwR66cfl5v81Re3kMdp+MQYfFeWmRnFXbVcy+gCjvQ3JRxl48+/tawmDrD/FOh40ZMaJNHgtrV3zw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721830176; c=relaxed/simple; bh=qWTpkyGmT+qHfbsiAtnPnaMcQltPze6qXR966ASrSdQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=r6YmFJaZqpUXnCvZCQHAXIIRmALbDA9VPMRlELS1PvM51SQbp54I7RmbBzArBPz6fXeZ9tR6RldH0UeikzWC6WkOfkPyDPcBdMusp2FwsX3SdSg8syPJffjN0rPhg0Q4dqLmArXTQ7VXs6droMcorbgHZXHb0xDvaXs8aMyYtxk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=GsMqL2Fd; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GsMqL2Fd" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721830175; x=1753366175; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qWTpkyGmT+qHfbsiAtnPnaMcQltPze6qXR966ASrSdQ=; b=GsMqL2FdQBtRfBUu7CcyDS6c3UR9jMO4/fVjEAS/jQYA65MKatf4oEzX e3YiwRfX7t0sh6Uc6P16/eBGl6KP2q9tc9cwcwJxg92P4Z/CYWH94cmLH 6A5BkBjsbvgfSRmqVkwVJ+esdl+Gdx3hrugoMxZr/26PhxAVRNpD0RA6m 6t6LOk1JUfHIy8qxWYs30dFO8HkZy8DS9WbsdyCAkepz6mi33EO6/4mhy p4L5vmfXdwytVI5H0SO7iPnCvNlrsx4fW+JSEcACBARx/cEf5esoTnfD5 cGf/jQeh7yGoBqZX1ML7ICePzZXtvCbyAHNzrYbuIZIfarnoN3VICo2yD A==; X-CSE-ConnectionGUID: 7bW8m3uwS/e3xg/Bfe7aXg== X-CSE-MsgGUID: QSLatqtWSZWaxNaEweX9Vg== X-IronPort-AV: E=McAfee;i="6700,10204,11143"; a="30173850" X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="30173850" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 07:09:35 -0700 X-CSE-ConnectionGUID: gHORDn0PTo6+/Ct2UTB5iQ== X-CSE-MsgGUID: gkvas0LWQcWE60tkqBP0wg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,233,1716274800"; d="scan'208";a="83211555" Received: from sannilnx-dsk.jer.intel.com ([10.12.231.107]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 07:09:31 -0700 From: Alexander Usyskin To: Mark Brown , Lucas De Marchi , Oded Gabbay , =?utf-8?q?Thomas_Hellstr=C3=B6m?= , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Cc: Tomas Winkler , Alexander Usyskin , Vitaly Lubart , intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-spi@vger.kernel.org, intel-gfx@lists.freedesktop.org Subject: [PATCH v2 10/12] drm/i915/spi: add support for access mode Date: Wed, 24 Jul 2024 17:00:12 +0300 Message-Id: <20240724140014.428991-11-alexander.usyskin@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240724140014.428991-1-alexander.usyskin@intel.com> References: <20240724140014.428991-1-alexander.usyskin@intel.com> Precedence: bulk X-Mailing-List: linux-spi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Check SPI access mode from GSC FW status registers and overwrite access status read from SPI descriptor, if needed. Signed-off-by: Alexander Usyskin --- drivers/gpu/drm/i915/spi/intel_spi.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/drivers/gpu/drm/i915/spi/intel_spi.c b/drivers/gpu/drm/i915/spi/intel_spi.c index 8dd4065551e2..747e43313c6f 100644 --- a/drivers/gpu/drm/i915/spi/intel_spi.c +++ b/drivers/gpu/drm/i915/spi/intel_spi.c @@ -10,6 +10,7 @@ #include "spi/intel_spi.h" #define GEN12_GUNIT_SPI_SIZE 0x80 +#define HECI_FW_STATUS_2_SPI_ACCESS_MODE BIT(3) static const struct intel_dg_spi_region regions[INTEL_DG_SPI_REGIONS] = { [0] = { .name = "DESCRIPTOR", }, @@ -22,6 +23,29 @@ static void i915_spi_release_dev(struct device *dev) { } +static bool i915_spi_writeable_override(struct drm_i915_private *dev_priv) +{ + struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev); + resource_size_t base; + bool writeable_override; + + if (IS_DG1(dev_priv)) { + base = DG1_GSC_HECI2_BASE; + } else if (IS_DG2(dev_priv)) { + base = DG2_GSC_HECI2_BASE; + } else { + dev_err(&pdev->dev, "Unknown platform\n"); + return true; + } + + writeable_override = + !(intel_uncore_read(&dev_priv->uncore, HECI_FWSTS(base, 2)) & + HECI_FW_STATUS_2_SPI_ACCESS_MODE); + if (writeable_override) + dev_info(&pdev->dev, "SPI access overridden by jumper\n"); + return writeable_override; +} + void intel_spi_init(struct drm_i915_private *dev_priv) { struct intel_dg_spi_dev *spi = &dev_priv->spi; @@ -33,6 +57,7 @@ void intel_spi_init(struct drm_i915_private *dev_priv) if (!IS_DGFX(dev_priv)) return; + spi->writeable_override = i915_spi_writeable_override(dev_priv); spi->bar.parent = &pdev->resource[0]; spi->bar.start = GEN12_GUNIT_SPI_BASE + pdev->resource[0].start; spi->bar.end = spi->bar.start + GEN12_GUNIT_SPI_SIZE - 1;