Skip to content

Commit

Permalink
ahci_xgene: Skip the PHY and clock initialization if already configur…
Browse files Browse the repository at this point in the history
…ed by the firmware.

This patch implements the feature to skip the PHY and clock
initialization if it is already configured by the firmware.

Signed-off-by: Loc Ho <[email protected]>
Signed-off-by: Suman Tripathi <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
  • Loading branch information
suman-tripathi authored and htejun committed Sep 6, 2014
1 parent c5edfff commit 0bed13b
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion drivers/ata/ahci_xgene.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc)
return rc;
}

static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx)
{
void __iomem *diagcsr = ctx->csr_diag;

return (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 &&
readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF);
}

/**
* xgene_ahci_read_id - Read ID data from the specified device
* @dev: device
Expand Down Expand Up @@ -467,6 +475,11 @@ static int xgene_ahci_probe(struct platform_device *pdev)
return -ENODEV;
}

if (xgene_ahci_is_memram_inited(ctx)) {
dev_info(dev, "skip clock and PHY initialization\n");
goto skip_clk_phy;
}

/* Due to errata, HW requires full toggle transition */
rc = ahci_platform_enable_clks(hpriv);
if (rc)
Expand All @@ -479,7 +492,7 @@ static int xgene_ahci_probe(struct platform_device *pdev)

/* Configure the host controller */
xgene_ahci_hw_init(hpriv);

skip_clk_phy:
hpriv->flags = AHCI_HFLAG_NO_PMP | AHCI_HFLAG_NO_NCQ;

rc = ahci_platform_init_host(pdev, hpriv, &xgene_ahci_port_info);
Expand Down

0 comments on commit 0bed13b

Please sign in to comment.