Lines Matching refs:ctx

98 static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx)  in xgene_ahci_init_memram()  argument
100 dev_dbg(ctx->dev, "Release memory from shutdown\n"); in xgene_ahci_init_memram()
101 writel(0x0, ctx->csr_diag + CFG_MEM_RAM_SHUTDOWN); in xgene_ahci_init_memram()
102 readl(ctx->csr_diag + CFG_MEM_RAM_SHUTDOWN); /* Force a barrier */ in xgene_ahci_init_memram()
104 if (readl(ctx->csr_diag + BLOCK_MEM_RDY) != 0xFFFFFFFF) { in xgene_ahci_init_memram()
105 dev_err(ctx->dev, "failed to release memory from shutdown\n"); in xgene_ahci_init_memram()
200 struct xgene_ahci_context *ctx = hpriv->plat_data; in xgene_ahci_qc_issue() local
209 if (ctx->class[ap->port_no] == ATA_DEV_PMP) { in xgene_ahci_qc_issue()
216 if (unlikely((ctx->last_cmd[ap->port_no] == ATA_CMD_ID_ATA) || in xgene_ahci_qc_issue()
217 (ctx->last_cmd[ap->port_no] == ATA_CMD_PACKET) || in xgene_ahci_qc_issue()
218 (ctx->last_cmd[ap->port_no] == ATA_CMD_SMART))) in xgene_ahci_qc_issue()
224 ctx->last_cmd[ap->port_no] = qc->tf.command; in xgene_ahci_qc_issue()
229 static bool xgene_ahci_is_memram_inited(struct xgene_ahci_context *ctx) in xgene_ahci_is_memram_inited() argument
231 void __iomem *diagcsr = ctx->csr_diag; in xgene_ahci_is_memram_inited()
274 static void xgene_ahci_set_phy_cfg(struct xgene_ahci_context *ctx, int channel) in xgene_ahci_set_phy_cfg() argument
276 void __iomem *mmio = ctx->hpriv->mmio; in xgene_ahci_set_phy_cfg()
279 dev_dbg(ctx->dev, "port configure mmio 0x%p channel %d\n", in xgene_ahci_set_phy_cfg()
363 struct xgene_ahci_context *ctx = hpriv->plat_data; in xgene_ahci_do_hardreset() local
382 dev_warn(ctx->dev, "link has error\n"); in xgene_ahci_do_hardreset()
508 struct xgene_ahci_context *ctx = hpriv->plat_data; in xgene_ahci_softreset() local
530 ctx->class[ap->port_no] = *class; in xgene_ahci_softreset()
564 struct xgene_ahci_context *ctx = hpriv->plat_data; in xgene_ahci_hw_init() local
570 rc = xgene_ahci_init_memram(ctx); in xgene_ahci_hw_init()
575 xgene_ahci_set_phy_cfg(ctx, i); in xgene_ahci_hw_init()
580 writel(0, ctx->csr_core + INTSTATUSMASK); in xgene_ahci_hw_init()
581 val = readl(ctx->csr_core + INTSTATUSMASK); /* Force a barrier */ in xgene_ahci_hw_init()
582 dev_dbg(ctx->dev, "top level interrupt mask 0x%X value 0x%08X\n", in xgene_ahci_hw_init()
585 writel(0x0, ctx->csr_core + ERRINTSTATUSMASK); in xgene_ahci_hw_init()
586 readl(ctx->csr_core + ERRINTSTATUSMASK); /* Force a barrier */ in xgene_ahci_hw_init()
587 writel(0x0, ctx->csr_axi + INT_SLV_TMOMASK); in xgene_ahci_hw_init()
588 readl(ctx->csr_axi + INT_SLV_TMOMASK); in xgene_ahci_hw_init()
591 writel(0xffffffff, ctx->csr_core + SLVRDERRATTRIBUTES); in xgene_ahci_hw_init()
592 writel(0xffffffff, ctx->csr_core + SLVWRERRATTRIBUTES); in xgene_ahci_hw_init()
593 writel(0xffffffff, ctx->csr_core + MSTRDERRATTRIBUTES); in xgene_ahci_hw_init()
594 writel(0xffffffff, ctx->csr_core + MSTWRERRATTRIBUTES); in xgene_ahci_hw_init()
597 val = readl(ctx->csr_core + BUSCTLREG); in xgene_ahci_hw_init()
600 writel(val, ctx->csr_core + BUSCTLREG); in xgene_ahci_hw_init()
602 val = readl(ctx->csr_core + IOFMSTRWAUX); in xgene_ahci_hw_init()
605 writel(val, ctx->csr_core + IOFMSTRWAUX); in xgene_ahci_hw_init()
606 val = readl(ctx->csr_core + IOFMSTRWAUX); in xgene_ahci_hw_init()
607 dev_dbg(ctx->dev, "coherency 0x%X value 0x%08X\n", in xgene_ahci_hw_init()
613 static int xgene_ahci_mux_select(struct xgene_ahci_context *ctx) in xgene_ahci_mux_select() argument
618 if (!ctx->csr_mux) in xgene_ahci_mux_select()
621 val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG); in xgene_ahci_mux_select()
623 writel(val, ctx->csr_mux + SATA_ENET_CONFIG_REG); in xgene_ahci_mux_select()
624 val = readl(ctx->csr_mux + SATA_ENET_CONFIG_REG); in xgene_ahci_mux_select()
636 struct xgene_ahci_context *ctx; in xgene_ahci_probe() local
644 ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL); in xgene_ahci_probe()
645 if (!ctx) in xgene_ahci_probe()
648 hpriv->plat_data = ctx; in xgene_ahci_probe()
649 ctx->hpriv = hpriv; in xgene_ahci_probe()
650 ctx->dev = dev; in xgene_ahci_probe()
654 ctx->csr_core = devm_ioremap_resource(dev, res); in xgene_ahci_probe()
655 if (IS_ERR(ctx->csr_core)) in xgene_ahci_probe()
656 return PTR_ERR(ctx->csr_core); in xgene_ahci_probe()
660 ctx->csr_diag = devm_ioremap_resource(dev, res); in xgene_ahci_probe()
661 if (IS_ERR(ctx->csr_diag)) in xgene_ahci_probe()
662 return PTR_ERR(ctx->csr_diag); in xgene_ahci_probe()
666 ctx->csr_axi = devm_ioremap_resource(dev, res); in xgene_ahci_probe()
667 if (IS_ERR(ctx->csr_axi)) in xgene_ahci_probe()
668 return PTR_ERR(ctx->csr_axi); in xgene_ahci_probe()
677 ctx->csr_mux = csr; in xgene_ahci_probe()
680 dev_dbg(dev, "VAddr 0x%p Mmio VAddr 0x%p\n", ctx->csr_core, in xgene_ahci_probe()
684 if ((rc = xgene_ahci_mux_select(ctx))) { in xgene_ahci_probe()
689 if (xgene_ahci_is_memram_inited(ctx)) { in xgene_ahci_probe()