From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2CEADCEACEF for ; Mon, 17 Nov 2025 13:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=NCb5vrDzes9YCQnwn1dlGu0sdtfvYHfN0QUZEeqValA=; b=sjX+XpVHvAntfE lqlQLbycqwrJRk3WP8ngmghVka6vrs92XQnybIo3Z/t9psMYOOIj0oM6YG+Pa4w0ayoowh7zDfZuz mPZOiZ3hZrRAZYIA7URXhG1rcrvEPwRkge5csoVBmcrhA59gtHa82/gtkrgzP1lu0+VwGSqn/zb+j 0xIPnKmM6cwgbf35FFLNEgNzmnYywPUIFewW8u4+Cglq/8xebszwVSlxrx7q0j7P3ztv75qaht2LS X4Huy3b2C925vzc4WEL9IrWdXdzlkg/eF1xPnyAOI8jNKFWAPq7Se+/8Tz0fhyTU5MzrULBQueRGv FWEmcy88d4Ftplh63/Eg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1vKz5t-0000000GAB5-3wQE; Mon, 17 Nov 2025 13:16:33 +0000 Received: from mgamail.intel.com ([192.198.163.8]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1vKz5s-0000000GA6C-1JFt for linux-i3c@lists.infradead.org; Mon, 17 Nov 2025 13:16:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1763385392; x=1794921392; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=F1hOf+OHz4L/0RgRlBsWwlECEFD/aN0bAXal3F8UQsY=; b=WVnxlIA1eryvePhjA8S93+sm7EN0nboN4aFcs1j+SOPeGZNjbMCXURzl hr35+MDyCJGRZ6ZSzx/ycA+r8v07Bo5HfFm5SOLqJHZhH6oioqJBa+O7Q eRYZYoEh1AoX9/T+hhWLZGNrJjDIehGn29m9It13mUuET+ZH1/WIsXw1B YkHPjLhtv6LIHeKLFO5x9nJOd6NJpUorP96v1tBActs0thBjfkz4gVsRI Ct/8cm3tfNUMAlfmh3CRHAXUDvNHDmlz2bdbN2ntckXSJMTY7GX+Q8gdg 55FVsLirAmK5GxCPiaRC9OMEXhsYGqPEpcPhVT+CM87Gi0R1d5fU84EsI A==; X-CSE-ConnectionGUID: bKCItoQnQHODZVb1UroRsg== X-CSE-MsgGUID: HP2Qz48vRYGDeZwVFPvDgg== X-IronPort-AV: E=McAfee;i="6800,10657,11615"; a="83009083" X-IronPort-AV: E=Sophos;i="6.19,311,1754982000"; d="scan'208";a="83009083" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2025 05:16:32 -0800 X-CSE-ConnectionGUID: RSeT2b+STo+WJAvXpeVDjw== X-CSE-MsgGUID: yROfT9u9Rtiqm3itGLenrg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,311,1754982000"; d="scan'208";a="194549349" Received: from egrumbac-mobl6.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.244.191]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2025 05:16:30 -0800 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, linux-i3c@lists.infradead.org Subject: [PATCH V3 07/12] i3c: mipi-i3c-hci-pci: Factor out intel_reset() Date: Mon, 17 Nov 2025 15:16:03 +0200 Message-ID: <20251117131609.65988-8-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251117131609.65988-1-adrian.hunter@intel.com> References: <20251117131609.65988-1-adrian.hunter@intel.com> MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20251117_051632_360745_CE6A6C7C X-CRM114-Status: UNSURE ( 8.88 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-i3c@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-i3c" Errors-To: linux-i3c-bounces+linux-i3c=archiver.kernel.org@lists.infradead.org For neatness, factor out intel_reset(). Signed-off-by: Adrian Hunter Reviewed-by: Frank Li --- Changes in V3: Add Frank's Rev'd-by Changes in V2: Move location of intel_reset() to get a prettier diff .../master/mipi-i3c-hci/mipi-i3c-hci-pci.c | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c index 1e1f2c42bd74..b9794212b2fb 100644 --- a/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c +++ b/drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c @@ -27,6 +27,18 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida); #define INTEL_RESETS_RESET_DONE BIT(1) #define INTEL_RESETS_TIMEOUT_US (10 * USEC_PER_MSEC) +static void intel_reset(void __iomem *priv) +{ + u32 reg; + + /* Assert reset, wait for completion and release reset */ + writel(0, priv + INTEL_RESETS); + readl_poll_timeout(priv + INTEL_RESETS, reg, + reg & INTEL_RESETS_RESET_DONE, 0, + INTEL_RESETS_TIMEOUT_US); + writel(INTEL_RESETS_RESET, priv + INTEL_RESETS); +} + static void __iomem *intel_priv(struct pci_dev *pci) { resource_size_t base = pci_resource_start(pci, 0); @@ -37,19 +49,13 @@ static void __iomem *intel_priv(struct pci_dev *pci) static int intel_i3c_init(struct pci_dev *pci) { void __iomem *priv = intel_priv(pci); - u32 reg; if (!priv) return -ENOMEM; dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64)); - /* Assert reset, wait for completion and release reset */ - writel(0, priv + INTEL_RESETS); - readl_poll_timeout(priv + INTEL_RESETS, reg, - reg & INTEL_RESETS_RESET_DONE, 0, - INTEL_RESETS_TIMEOUT_US); - writel(INTEL_RESETS_RESET, priv + INTEL_RESETS); + intel_reset(priv); return 0; } -- 2.51.0 -- linux-i3c mailing list linux-i3c@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-i3c