From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (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 05DB643CEF5 for ; Mon, 20 Jul 2026 16:21:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784564495; cv=none; b=jVxUIVDwAWJlJ57P/yMA+t9hbaJBo+N6esGhKJ0BXMDJATYKVTTrPaf6mLrdpaHvF27hAELqvTyWrOOjBz3CdXIGGDjeWkNQuxrsfqNgDuTBOBESDHRprgj9EtDQV/aNbVPXnwPtGRruv9BwUIg03Hy1A5EZH7b3xEc1TEeuzXQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784564495; c=relaxed/simple; bh=UVo5c4lR5R7fmIYod3yy0OHjJHPgUxAKWu1/O3B+npo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=kzg4Lsex0zgvwV3k1sdWdflZplcS+Nuz2XnawcP07X4i0vRfKerq70ttqVR0drbcvIXKJuhtdd2+EY15KsbC7wjKcRPG1aQhoitUA/XWaQxATwXt1AH6inqYQRcHEu0awwRCsQGBlwpVZ1mE7VahZjr7UWTRzX+M4jtc8uoNPps= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2ceab75934dso107956985ad.2 for ; Mon, 20 Jul 2026 09:21:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784564493; x=1785169293; 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=aLETP574W//JLh+FTkzjcKwtbtDnoO3wAXCceho0s4c=; b=cy2+tWyYJYUo/o3x0K/PxtZJhWzAPDFZdDi38Td/IMouOJzVgtO6JtEL6eDjFXa4NN 9m3QVtRofeENWI2BHlXMhgIX7uQN873Bsm7JrYReAOw6R3gv8tgt5yXckcfp7O0ynY4a ErbC52jLftdhm/sQZ3XdB7nmPvGKkZFWOJzU9eKJJ/YX/d4rX8bLrDHnTAqHDyegSggG CExCZhcnbL77lvCzatQqKUfyLuVw2uGHMG+DEmA2zoIeyVAEQno3UOd8Ge22dPOqlJhO KNDlnDthDCShV80BNYadB4tHk4mV8FpqDxJPEAl+3uEWOue/Q1dHeEPNrtteV2zec/b+ lQmQ== X-Forwarded-Encrypted: i=1; AHgh+Rqk33mN6KTtkLrAtY21dxPy/RSp1s1DG0OfuFfkAufdoTl0c6w/J4RDPmDFRy/hwhRm605x6YRmd9Nd+IQ=@vger.kernel.org X-Gm-Message-State: AOJu0YwmLgb2SmmRr4QCHveD2nD6AkAKVkOErbY+E2y+lUI90jlMen5h vjEDbm+2cyST3jtBXPSGRy5I9ueGLlwUT1bAEKgahEdmfvl7lzpzUyU= X-Gm-Gg: AR+sD10rhVjmnIixJsEBEiegX/2T89glGM5vBYdVhbENn6VzdusGv/7ndinU1OldQoy iKCndbzLGXP8AjClHYZZfjOEL5C7xx33eCuU2B7C4NVqFDTKDPyGVSyLFKPoaOJ3qYB8oCjAjVH thbXUF/eFGvTgR46Ed49UIdYnpUa2ChFyxu0aMineMYBBX+h23zNXrMWII6MUMuUqz0vP4BLBFj v/DR/3dbWPJfMEwHddIEh1vkVaor6yAL//MfI6YhFVpTQDwUwCQ0s/nisate+/UFPi7csOK87o1 udD+bWSmFhUi5pHYngahD3joZfkLVRX1Bjer8VQmXjnfWVLBfdw3cJlVlOm/Crr2ahO36RoENor 2YmcOD0eIwn6Ng//iqZ6TX+b3HD6cRq84zg4oQwcJwWiQN8dXFVKYCC45FooM9YnwmUdhHSNbiN LtbcGGTAMYPbpaLydYdcRpF1RlknxaKEJBe/4YK3/v+pPmqwOOkLU9DGsqEFrMYB43TVZVIx9BH P96DO1g/tUpgwKgUNUSD/58BFJ5 X-Received: by 2002:a17:902:fdae:b0:2ca:ecf6:910e with SMTP id d9443c01a7336-2cf3466a93fmr166932475ad.0.1784564493132; Mon, 20 Jul 2026 09:21:33 -0700 (PDT) Received: from penguin.tail0a1999.ts.net (61-228-16-100.dynamic-ip.hinet.net. [61.228.16.100]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf3479463bsm58467385ad.80.2026.07.20.09.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2026 09:21:32 -0700 (PDT) From: Shih-Yuan Lee To: Mark Brown Cc: Andy Shevchenko , Mika Westerberg , Lukas Wunner , Daniel Mack , Haojian Zhuang , Robert Jarzmik , linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, Shih-Yuan Lee Subject: [PATCH v16 4/7] spi: pxa2xx: lock out runtime autosuspend for Intel LPSS SPI in PIO mode Date: Tue, 21 Jul 2026 00:21:13 +0800 Message-Id: <20260720162117.32304-5-fourdollars@debian.org> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260720162117.32304-1-fourdollars@debian.org> References: <20260720162117.32304-1-fourdollars@debian.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 When operating in PIO mode on Intel LPSS SPI controllers, runtime PM autosuspend clock-gates the hardware block when idle. On subsequent transfers, MMIO accesses to trigger resume are performed before the runtime PM state machine can wake the controller, causing PCIe Completion Timeouts. This issue does not affect DMA mode, where the DMA engine holds the required resources, nor does it affect non-LPSS controllers. Lock out runtime PM autosuspend for LPSS SPI controllers specifically when operating in PIO mode. Acquire a runtime PM reference via pm_runtime_get_noresume() in pxa2xx_spi_probe() after registration, and release it via pm_runtime_put_noidle() in pxa2xx_spi_remove() before hardware teardown to ensure the runtime PM reference held in probe is released without invoking runtime_suspend on already-unclocked hardware. Signed-off-by: Shih-Yuan Lee --- drivers/spi/spi-pxa2xx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c index 6bfd3382acc3..34241a6742eb 100644 --- a/drivers/spi/spi-pxa2xx.c +++ b/drivers/spi/spi-pxa2xx.c @@ -1473,6 +1473,9 @@ int pxa2xx_spi_probe(struct device *dev, struct ssp_device *ssp, goto out_error_irq_alloc; } + if (is_lpss_ssp(drv_data) && !platform_info->enable_dma) + pm_runtime_get_noresume(dev); + return status; out_error_irq_alloc: @@ -1495,6 +1498,13 @@ void pxa2xx_spi_remove(struct device *dev) spi_unregister_controller(drv_data->controller); + /* Release the PM reference held in probe for LPSS PIO mode before + * hardware teardown so the PM core does not invoke runtime_suspend + * on already-unclocked hardware. + */ + if (is_lpss_ssp(drv_data) && !drv_data->controller_info->enable_dma) + pm_runtime_put_noidle(dev); + /* Disable SSP interrupt generation on hardware level while clock is active */ pxa2xx_spi_off(drv_data); -- 2.39.5