From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C8D6737F00A for ; Fri, 17 Jul 2026 14:36:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784298987; cv=none; b=ivk/PLHdOPI5GgpZKiWe0unKlc/7N5nrUEqHa3+weUgZR0kwH+0MsNNrJKuh0/Prz2PLJURWrgz+AwidprLNvIm4PONbb5j54lYkwcXuFI3KWtqE8a7zk4ntvkvjgoIwP82Fwp56E0qLHzcZ+BWRy5GAN06nyAtoQIN+//IbLhE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784298987; c=relaxed/simple; bh=8ymFnmY0ZNuVBOicii49ROHHuhSo0C0r1iGUdnql0hQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UUCOqDl4NsXuMlwMdqP+rkG6iSQ4+sUp40NzxFDaio08Vv1NPty7Wc3rhdPRXMH/O6Ucxv9FSt554urAGpuJ1eQXeYPFMMne1vW9Ga+ZG+H046GD37VjHU4sP/HTtXM3qZwSyPlenqtoys+4aLgff1QFqqssScz7/OPLywlZDvY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=G1gyapQT; arc=none smtp.client-ip=209.85.214.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="G1gyapQT" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2cc73e322dbso95859265ad.1 for ; Fri, 17 Jul 2026 07:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784298985; x=1784903785; 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:content-type; bh=lAkG0oiR7Cpxcc7khZktHbhFdZU2bsEvQSvh4knDgfU=; b=G1gyapQT0llZPjMz+o9X9i4JKfOE+2iFul3mKM7E9KgO53B4VUh5pE+weMWfygFOSQ YKhlwHW5xLN4nc7GMXmRrWamHIMMxHH8MdjhYRlL7vo6HwvhK5DwQrc7BgBbARpk60kA gooRNues8kpF+jUGONVa/pMumniYa9I2ipaLBwrVNoErIT/MuA/0qiqwB9gbvQRr7cCK IDleRYpYwfOctloD6RiH86KHjplTvD+VOTelj1pZvYAoPdhCysLzclEmTk8UQNvmMLFz NvWvOM5AR3YLNQIZ3pU1766BhrIiTqkfkNPp0ggqmLXIE2lxWSS8kCE/EIpjbUIG4/3l /c9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784298985; x=1784903785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=lAkG0oiR7Cpxcc7khZktHbhFdZU2bsEvQSvh4knDgfU=; b=c0pk9nyuKemy4fE5OZdtzbPd2ZsXMXqra/SKIrvrarI6b8TG/rde/GdgVo6N8uSjSV u2kpvF4kN7DHYSF11R5iwgckGeiu6vhflN3NWY7fonFvN1vDtXOx2X1hegS1qik3fx/A /0GeN4RFQToiqc/MV1Ks53E0wWjxrkVwTmJ4xhqq6597dGkQvccLD+PI+RzFb/EaysIZ xaF77Gu2mNH1SeG/BNNvLIpYHu+oMuH4uurid0R4bXT/XilnU4Kn7PFvklBnClC6h/5B lszzxFwCqXWZjLeAjhEEIHXIFnP+H9omV2L8pcbtRacmTPdewZ6tilGxtninJ3iAc0ck aUFQ== X-Forwarded-Encrypted: i=1; AHgh+Rrr4vjYmp2/cBGXNkZ4rwC3Owuf3NgP8xs35cPvPsgICK5XtQSJT6718R2eFPhrcuGEijc3RkbuFi0nmlw=@vger.kernel.org X-Gm-Message-State: AOJu0YxxjPUf8wfbNH5eGyd0LomoKNCKXoUHkjbLO/vG+KWDyxRac5F2 3F/2yVPMrC9gguWNe44zpepeRpPiwr2N74eC7AUzSWQi9a356Ltu6EA= X-Gm-Gg: AfdE7cl6GSTluMeNBJTVXkBfa+QVAlXNblqNfdk3JXETMu2zkrZ/zxsJOX66kNDgVAF NZCEoZEDfhK05+VyUpFPxgPI4PfuXrN3w2iFbX43VWKEjlbz7/FgUwaU0E2bryhU/2+qI/TrNLB KXQZLn/mD5lFWJkoLTZuOkaNV9IqIH927fd+QFh1YAgwwz93WD9ovlyzx3DTFR0DyT50YXmnQ1S bCzWWrGjEK6VDVQYaoffTfz43vIq1ILScwAIgTq7WE9r5WdFa60WZmoBYhyort2Y35Jl1tNUeJg dZjY1Ks2sf9k43yKONuzEKInr8B/nI1cW9LP/RPKSA/j7pEioICfEj76sG0RuQfkGDFBGUF289y JPahQu0/Y6hrCl156RWd2H8jztvRb22ktCMZiVhdW8FaNNHjL4MVPhHpZNvg99tDJEhDh4Dt3H6 o5R6NzVcXrdyHQDGO18doAVv1lQH0T/ZRrZXkaefe9o0M0qnyvd3UqHaVMmtyxXUCgGF3J5tArK uEXeipiMF2VmQ== X-Received: by 2002:a17:903:1aac:b0:2c7:ebfb:618f with SMTP id d9443c01a7336-2cf34883f97mr34752935ad.14.1784298984989; Fri, 17 Jul 2026 07:36:24 -0700 (PDT) Received: from penguin.tail0a1999.ts.net (61-228-46-68.dynamic-ip.hinet.net. [61.228.46.68]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf346d9bd5sm12145695ad.45.2026.07.17.07.36.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Jul 2026 07:36:24 -0700 (PDT) From: "Shih-Yuan Lee (FourDollars)" To: Mark Brown Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Shih-Yuan Lee Subject: [PATCH v2 0/2] spi: pxa2xx: MacBook8,1 quirk and LPSS S3 resume state fixes Date: Fri, 17 Jul 2026 22:36:14 +0800 Message-Id: <20260717143616.4765-1-fourdollars@gmail.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260712162420.7453-1-fourdollars%40debian.org> References: <20260712162420.7453-1-fourdollars%40debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Shih-Yuan Lee Hi Mark, This patch series resolves two issues in the spi-pxa2xx host controller driver related to Intel LPSS SPI controllers. Patch 1 moves the forced PIO mode quirk for the Apple MacBook8,1 LPSS SPI controller from the client driver (applespi) to the host controller PCI glue driver (spi-pxa2xx-pci) where it belongs. It also fixes a runtime PM issue: when DMA is disabled, aggressive runtime clock gating causes PCIe Completion Timeouts on subsequent MMIO accesses. The fix is to only call pm_runtime_allow() if DMA is enabled. Patch 2 fixes S3 suspend/resume for Intel LPSS SPI controllers. The LPSS power domain is fully removed across S3, losing all private register state. Accessing MMIO on resume while the block is held in reset causes a PCIe Completion Timeout and a watchdog system reset. To fix this, we save the LPSS private registers in struct driver_data during suspend, de-assert resets first on resume, and restore the saved registers. Changes in v2: - Addressed feedback from Mark Brown. - Used drv_data->lpss_base together with relative offsets rather than hardcoding absolute MMIO offsets that vary between LPSS IP revisions. - Moved the register save block in suspend to after the controller is quiesced (after spi_controller_suspend() and pxa_ssp_disable()). - Store the context array lpss_priv_ctx[6] inside struct driver_data instead of struct pxa2xx_spi_controller. This keeps the changes entirely local to the core driver, preventing symbol version mismatches (disagrees about version of symbol) for other subsystem components (e.g., spi-pxa2xx-platform.ko). - Restrict the save/restore loop to the first 6 LPSS private registers (offsets 0x00 to 0x14). Offsets beyond 0x14 (except CS control at 0x18, which is re-initialised by lpss_ssp_setup()) are reserved/unimplemented on LPT platforms (such as MacBook8,1), and writing to them triggers a PCIe Completion Timeout causing a system freeze. - Added named constants for LPSS_PRIV_RESETS and the de-assert value. - Wrapped S3 suspend/resume with pm_runtime_resume_and_get() and pm_runtime_put_autosuspend() respectively. This ensures the controller is temporarily runtime-resumed to active state prior to suspend, guaranteeing the clock and power domain are active during MMIO register access, and that the private registers are consistently saved and restored across S3 sleep. - Permanently lock out runtime PM in pxa2xx_spi_probe() via pm_runtime_forbid() when DMA is disabled. This covers both static PIO and dynamic fallback to PIO and prevents userspace/udev from overriding the setting. - Call synchronize_irq() in pxa2xx_spi_runtime_suspend() to wait for active handlers on the shared interrupt line to finish before disabling the clock, avoiding unclocked MMIO register reads in ssp_int(). - Avoid duplicate can-DMA pci_info() logging by checking the pre-computed enable_dma status in probe and passing a verbose flag to can_dma(). Link: https://bugzilla.kernel.org/show_bug.cgi?id=108331 Shih-Yuan Lee (2): spi: pxa2xx: disable DMA and fix runtime PM for Apple MacBook8,1 spi: pxa2xx: restore LPSS private register state on S3 resume drivers/spi/spi-pxa2xx-pci.c | 38 +++++++++++++++++++++++-- drivers/spi/spi-pxa2xx.c | 55 +++++++++++++++++++++++++++++++++++- drivers/spi/spi-pxa2xx.h | 1 + 3 files changed, 90 insertions(+), 4 deletions(-) -- 2.39.5