From 869340b5851cbedd747f070a580a471d112fed24 Mon Sep 17 00:00:00 2001 From: Suman Tripathi Date: Tue, 19 Aug 2014 12:01:50 +0530 Subject: [PATCH 2/3] UBUNTU: SAUCE: (no-up) ahci_xgene: Skip the PHY and clock initialization if already configured by the firmware. BugLink: http://bugs.launchpad.net/bugs/1359501 First 2 hunks of the patch applied cleanly, 3rd hunk needed to be shifted down some lines. 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 Signed-off-by: Suman Tripathi Signed-off-by: dann frazier Reference: http://www.spinics.net/lists/linux-scsi/msg77268.html Signed-off-by: Craig Magina (v7 submittal) --- drivers/ata/ahci_xgene.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index ebafa8b..3428b96 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -145,6 +145,16 @@ static unsigned int xgene_ahci_qc_issue(struct ata_queued_cmd *qc) return rc; } +static int xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx) +{ + void __iomem *diagcsr = ctx->csr_diag; + + if (readl(diagcsr + CFG_MEM_RAM_SHUTDOWN) == 0 && + readl(diagcsr + BLOCK_MEM_RDY) == 0xFFFFFFFF) + return 1; + return 0; +} + /** * xgene_ahci_read_id - Read ID data from the specified device * @dev: device @@ -468,6 +478,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) @@ -481,6 +496,8 @@ static int xgene_ahci_probe(struct platform_device *pdev) /* Configure the host controller */ xgene_ahci_hw_init(hpriv); +skip_clk_phy: + /* * Setup DMA mask. This is preliminary until the DMA range is sorted * out. -- 1.9.1