Skip to content

Commit 6f6efdd

Browse files
ahunter6alexandrebelloni
authored andcommitted
i3c: mipi-i3c-hci-pci: Factor out intel_reset()
For neatness, factor out intel_reset(). Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Link: https://patch.msgid.link/20251128064038.55158-8-adrian.hunter@intel.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
1 parent 9dfa23c commit 6f6efdd

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

drivers/i3c/master/mipi-i3c-hci/mipi-i3c-hci-pci.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ static DEFINE_IDA(mipi_i3c_hci_pci_ida);
2727
#define INTEL_RESETS_RESET_DONE BIT(1)
2828
#define INTEL_RESETS_TIMEOUT_US (10 * USEC_PER_MSEC)
2929

30+
static void intel_reset(void __iomem *priv)
31+
{
32+
u32 reg;
33+
34+
/* Assert reset, wait for completion and release reset */
35+
writel(0, priv + INTEL_RESETS);
36+
readl_poll_timeout(priv + INTEL_RESETS, reg,
37+
reg & INTEL_RESETS_RESET_DONE, 0,
38+
INTEL_RESETS_TIMEOUT_US);
39+
writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
40+
}
41+
3042
static void __iomem *intel_priv(struct pci_dev *pci)
3143
{
3244
resource_size_t base = pci_resource_start(pci, 0);
@@ -37,19 +49,13 @@ static void __iomem *intel_priv(struct pci_dev *pci)
3749
static int intel_i3c_init(struct pci_dev *pci)
3850
{
3951
void __iomem *priv = intel_priv(pci);
40-
u32 reg;
4152

4253
if (!priv)
4354
return -ENOMEM;
4455

4556
dma_set_mask_and_coherent(&pci->dev, DMA_BIT_MASK(64));
4657

47-
/* Assert reset, wait for completion and release reset */
48-
writel(0, priv + INTEL_RESETS);
49-
readl_poll_timeout(priv + INTEL_RESETS, reg,
50-
reg & INTEL_RESETS_RESET_DONE, 0,
51-
INTEL_RESETS_TIMEOUT_US);
52-
writel(INTEL_RESETS_RESET, priv + INTEL_RESETS);
58+
intel_reset(priv);
5359

5460
return 0;
5561
}

0 commit comments

Comments
 (0)