Commit 1fe62aa7 authored by Andrey Filippov's avatar Andrey Filippov

AHCI driver is finally working with x393_sata AHCI SATA controller

parent e94696c1
......@@ -61,9 +61,10 @@ static int elphel_port_start(struct ata_port *ap)
int dbg_i;
libahci_debug_init(ap->host);
dev_info(dev, "starting port %d", ap->port_no);
dev_dbg(dev, "starting port %d", ap->port_no);
#ifdef DEBUG_EVENT_ELPHEL
libahci_debug_wait_flag();
#endif
pp = devm_kzalloc(dev, sizeof(struct ahci_port_priv), GFP_KERNEL);
if (!pp)
return -ENOMEM;
......@@ -98,10 +99,10 @@ address must be aligned to a 128-byte cache line, indicated by bits 06:00 being
*/
mem_dma = dma_map_single(dev, mem, AHCI_CMD_TBL_AR_SZ, DMA_TO_DEVICE); // maybe DMA_BIDIRECTIONAL, but currently we do not use DMA for received FISes
dev_info(dev, "ahci_elphel.c: dbg_i= 0x%08x, mem= 0x%08x, mem_dma= 0x%08x", dbg_i, (u32) mem, (u32) mem_dma);
dev_dbg(dev, "ahci_elphel.c: dbg_i= 0x%08x, mem= 0x%08x, mem_dma= 0x%08x", dbg_i, (u32) mem, (u32) mem_dma);
pp->cmd_tbl = mem + dbg_i;
pp->cmd_tbl_dma = mem_dma + dbg_i;
dev_info(dev, "ahci_elphel.c: dbg_i= 0x%08x, pp->cmd_tbl= 0x%08x, pp->cmd_tbl_dma= 0x%08x", dbg_i, (u32) pp->cmd_tbl, (u32) pp->cmd_tbl_dma);
dev_dbg(dev, "ahci_elphel.c: dbg_i= 0x%08x, pp->cmd_tbl= 0x%08x, pp->cmd_tbl_dma= 0x%08x", dbg_i, (u32) pp->cmd_tbl, (u32) pp->cmd_tbl_dma);
/*
* Set predefined addresses
......@@ -134,10 +135,10 @@ address must be aligned to a 128-byte cache line, indicated by bits 06:00 being
//libahci_debug_saxigp1_save(ap, 0x3000);
//libahci_debug_saxigp1_save(ap, 0x3000);
dev_info(dev, "flags (ATA_FLAG_xxx): %u", ap->flags);
dev_info(dev, "pflags (ATA_PFLAG_xxx): %u", ap->pflags);
dev_dbg(dev, "flags (ATA_FLAG_xxx): %u", ap->flags);
dev_dbg(dev, "pflags (ATA_PFLAG_xxx): %u", ap->pflags);
dev_info(dev, "ahci_elphel.c: Calling ahci_port_resume()");
dev_dbg(dev, "ahci_elphel.c: Calling ahci_port_resume()");
return ahci_port_resume(ap);
}
......@@ -162,7 +163,7 @@ static int elphel_parse_prop(const struct device_node *devn,
val = of_get_address(devn, 0, NULL, NULL);
if (val != NULL) {
dpriv->base_addr = be32_to_cpu(val);
dev_info(dev, "base_addr: 0x%08u", dpriv->base_addr);
dev_dbg(dev, "base_addr: 0x%08u", dpriv->base_addr);
} else {
dev_err(dev, "can not get register address");
}
......@@ -203,15 +204,15 @@ static int elphel_drv_probe(struct platform_device *pdev)
hpriv->plat_data = drv_priv;
reg_val = readl(hpriv->mmio + HOST_CAP);
dev_info(dev, "HOST CAP register: 0x%08x", reg_val);
dev_dbg(dev, "HOST CAP register: 0x%08x", reg_val);
reg_val = readl(hpriv->mmio + HOST_CTL);
dev_info(dev, "HOST GHC register: 0x%08x", reg_val);
dev_dbg(dev, "HOST GHC register: 0x%08x", reg_val);
reg_val = readl(hpriv->mmio + HOST_IRQ_STAT);
dev_info(dev, "HOST IS register: 0x%08x", reg_val);
dev_dbg(dev, "HOST IS register: 0x%08x", reg_val);
reg_val = readl(hpriv->mmio + HOST_PORTS_IMPL);
dev_info(dev, "HOST PI register: 0x%08x", reg_val);
dev_dbg(dev, "HOST PI register: 0x%08x", reg_val);
reg_val = readl(hpriv->mmio + HOST_VERSION);
dev_info(dev, "HOST VS register: 0x%08x", reg_val);
dev_dbg(dev, "HOST VS register: 0x%08x", reg_val);
phys_addr_t paddr = virt_to_phys(hpriv->mmio);
void *vaddr = phys_to_virt(paddr);
......@@ -232,7 +233,7 @@ static int elphel_drv_probe(struct platform_device *pdev)
ahci_platform_disable_resources(hpriv);
return ret;
}
dev_info(dev, "ahci platform host initialized");
dev_dbg(dev, "ahci platform host initialized");
return 0;
}
......@@ -257,7 +258,7 @@ static unsigned int elphel_read_id(struct ata_device *dev, struct ata_taskfile *
if (err_mask)
return err_mask;
dev_info(d, "elphel_read_id(): issue identify command finished\n");
dev_dbg(d, "elphel_read_id(): issue identify command finished\n");
/*dev_info(d, "dump IDENTIFY:\n");
msg_str = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!msg_str)
......
This diff is collapsed.
......@@ -745,11 +745,11 @@ unsigned int libahci_debug_state_dump(struct ata_port *ap)
return 0;
}
dev_info(dev, "dump page num: %u", page_cntr);
dev_dbg(dev, "dump page num: %u", page_cntr);
ptr = page_cntr * DUMP_LEN;
if (ptr + DUMP_LEN > SEGMENT_SIZE)
ptr = 0;
dev_info(dev, "current ptr: %u", ptr);
dev_dbg(dev, "current ptr: %u", ptr);
for (i = 0; i < GHC_SZ; i++) {
tmp = ioread32(host_mmio + 4 * i);
buf[ptr++] = tmp;
......@@ -811,7 +811,7 @@ unsigned int libahci_debug_saxigp1_save(struct ata_port *ap, size_t dump_size)
} else {
page_cntr = 0;
//bytes_copied = 0;
//dev_info(dev, "memory pool has ended, writing from beginning");
//dev_dbg(dev, "memory pool has ended, writing from beginning");
}
return page_cntr;
......@@ -820,20 +820,20 @@ EXPORT_SYMBOL_GPL(libahci_debug_saxigp1_save);
static void libahci_debug_buff_init(struct device *dev)
{
dev_info(dev, "Nothing to allocate - using elphel_buf allocated at startup");
dev_dbg(dev, "Nothing to allocate - using elphel_buf allocated at startup");
/*
mem_buff.vaddr = dmam_alloc_coherent(dev, SEGMENT_SIZE, &mem_buff.paddr, GFP_KERNEL);
if (!mem_buff.vaddr)
dev_err(dev, "unable to allocate memory");
else
dev_info(dev, "dump buffer allocated");
dev_dbg(dev, "dump buffer allocated");
*/
/*
const size_t maxigp1_start = 0x80000000; // start of MAXIGP1 physical address range
const size_t maxigp1_size = 0x3000; // size of register memory to save
*/
ioptr = ioremap_nocache(maxigp1_start, maxigp1_size);
dev_info(dev, "Mapped 0x%08x bytes from physical address 0x%08x to 0x%08x", maxigp1_size, maxigp1_start, (size_t) ioptr);
dev_dbg(dev, "Mapped 0x%08x bytes from physical address 0x%08x to 0x%08x", maxigp1_size, maxigp1_start, (size_t) ioptr);
page_cntr = 0;
}
......@@ -902,7 +902,7 @@ int libahci_debug_init_early(struct device *dev)
dev_err(dev, "unable to allocate mem for early buffer");
return -ENOMEM;
} else {
dev_info(dev, "early buffer allocated");
dev_dbg(dev, "early buffer allocated");
}
}
......
......@@ -1564,7 +1564,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
unsigned long flags;
unsigned int err_mask;
int rc;
dev_info(ap->host->dev, "libata-core.c:ata_exec_internal_sg() ap->pflags = 0x%x, link->eh_info.action=0x%08x\n",ap->pflags,link->eh_info.action);
dev_dbg(ap->host->dev, "libata-core.c:ata_exec_internal_sg() ap->pflags = 0x%x, link->eh_info.action=0x%08x\n",ap->pflags,link->eh_info.action);
spin_lock_irqsave(ap->lock, flags);
......@@ -1635,7 +1635,7 @@ unsigned ata_exec_internal_sg(struct ata_device *dev,
spin_unlock_irqrestore(ap->lock, flags);
dev_info(ap->host->dev, "libata-core.c:ata_exec_internal_sg(), timeout = 0x%x, qc->err_mask= 0x%08x, qc->flags=0x%08x, link->eh_info.action=0x%08x\n",
dev_dbg(ap->host->dev, "libata-core.c:ata_exec_internal_sg(), timeout = 0x%x, qc->err_mask= 0x%08x, qc->flags=0x%08x, link->eh_info.action=0x%08x\n",
timeout, qc->err_mask, qc->flags, link->eh_info.action);
//link->eh_info.action
if (!timeout) {
......@@ -1743,7 +1743,7 @@ unsigned ata_exec_internal(struct ata_device *dev,
{
struct scatterlist *psg = NULL, sg;
unsigned int n_elem = 0;
dev_info(dev->link->ap->host->dev, "libata-core.c ata_exec_internal()");
dev_dbg(dev->link->ap->host->dev, "libata-core.c ata_exec_internal()");
if (dma_dir != DMA_NONE) {
WARN_ON(!buf);
......@@ -1825,7 +1825,7 @@ static u32 ata_pio_mask_no_iordy(const struct ata_device *adev)
unsigned int ata_do_dev_read_id(struct ata_device *dev,
struct ata_taskfile *tf, u16 *id)
{
dev_info(dev->link->ap->host->dev, "libata-core.c ata_do_dev_read_id()");
dev_dbg(dev->link->ap->host->dev, "libata-core.c ata_do_dev_read_id()");
return ata_exec_internal(dev, tf, NULL, DMA_FROM_DEVICE,
id, sizeof(id[0]) * ATA_ID_WORDS, 0);
......@@ -4894,12 +4894,12 @@ void ata_qc_complete(struct ata_queued_cmd *qc)
* taken care of.
*/
dev_info(&qc->dev->tdev, "%s: qc->dma_dir: %d", __func__, qc->dma_dir);
dev_dbg(&qc->dev->tdev, "%s: qc->dma_dir: %d", __func__, qc->dma_dir);
if (qc->dma_dir == DMA_TO_DEVICE) {
dev_info(&qc->dev->tdev, "%s: dma_sync_sg_for_device, qc->dma_dir: %d", __func__, qc->dma_dir);
dev_dbg(&qc->dev->tdev, "%s: dma_sync_sg_for_device, qc->dma_dir: %d", __func__, qc->dma_dir);
dma_sync_sg_for_device(&qc->dev->tdev, qc->sg, qc->n_elem, qc->dma_dir);
} else if (qc->dma_dir == DMA_FROM_DEVICE) {
dev_info(&qc->dev->tdev, "%s: dma_sync_sg_for_cpu, qc->dma_dir: %d", __func__, qc->dma_dir);
dev_dbg(&qc->dev->tdev, "%s: dma_sync_sg_for_cpu, qc->dma_dir: %d", __func__, qc->dma_dir);
dma_sync_sg_for_cpu(&qc->dev->tdev, qc->sg, qc->n_elem, qc->dma_dir);
}
......@@ -5959,12 +5959,12 @@ int ata_host_start(struct ata_host *host)
int have_stop = 0;
void *start_dr = NULL;
int i, rc;
dev_info(host->ports[0]->host->dev, "libata-core.c ata_host_start(), 0x%08x\n",host->flags);
dev_dbg(host->ports[0]->host->dev, "libata-core.c ata_host_start(), 0x%08x\n",host->flags);
if (host->flags & ATA_HOST_STARTED)
return 0;
ata_finalize_port_ops(host->ops);
dev_info(host->ports[0]->host->dev, "libata-core.c ata_host_start(): ata_finalize_port_ops() DONE");
dev_dbg(host->ports[0]->host->dev, "libata-core.c ata_host_start(): ata_finalize_port_ops() DONE");
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
......@@ -5986,7 +5986,7 @@ int ata_host_start(struct ata_host *host)
if (!start_dr)
return -ENOMEM;
}
dev_info(host->ports[0]->host->dev, "libata-core.c ata_host_start(): Checked for 'have stop' = %d",have_stop);
dev_dbg(host->ports[0]->host->dev, "libata-core.c ata_host_start(): Checked for 'have stop' = %d",have_stop);
for (i = 0; i < host->n_ports; i++) {
struct ata_port *ap = host->ports[i];
......@@ -6002,14 +6002,14 @@ int ata_host_start(struct ata_host *host)
}
}
ata_eh_freeze_port(ap);
dev_info(host->ports[0]->host->dev, "ata_host_start(): freezing port %d",i);
dev_dbg(host->ports[0]->host->dev, "ata_host_start(): freezing port %d",i);
}
if (start_dr)
devres_add(host->dev, start_dr);
host->flags |= ATA_HOST_STARTED;
dev_info(host->ports[0]->host->dev, "ata_host_start() OK, host->flags = 0x%08x",host->flags);
dev_dbg(host->ports[0]->host->dev, "ata_host_start() OK, host->flags = 0x%08x",host->flags);
return 0;
err_out:
......@@ -6019,7 +6019,7 @@ int ata_host_start(struct ata_host *host)
if (ap->ops->port_stop)
ap->ops->port_stop(ap);
}
dev_info(host->ports[0]->host->dev, "ata_host_start() err_out, host->flags = 0x%08x (called port_stop)",host->flags);
dev_dbg(host->ports[0]->host->dev, "ata_host_start() err_out, host->flags = 0x%08x (called port_stop)",host->flags);
devres_free(start_dr);
return rc;
}
......
......@@ -623,7 +623,7 @@ void ata_scsi_error(struct Scsi_Host *host)
void ata_scsi_cmd_error_handler(struct Scsi_Host *host, struct ata_port *ap,
struct list_head *eh_work_q)
{
dev_info(ap->host->dev, "ata_scsi_cmd_error_handler()\n");
dev_dbg(ap->host->dev, "ata_scsi_cmd_error_handler()\n");
int i;
unsigned long flags;
......@@ -1125,7 +1125,7 @@ int ata_port_abort(struct ata_port *ap)
static void __ata_port_freeze(struct ata_port *ap)
{
WARN_ON(!ap->ops->error_handler);
dev_info(ap->host->dev, "__ata_port_freeze()\n");
dev_dbg(ap->host->dev, "__ata_port_freeze()\n");
if (ap->ops->freeze)
ap->ops->freeze(ap);
......@@ -1154,7 +1154,7 @@ int ata_port_freeze(struct ata_port *ap)
int nr_aborted;
WARN_ON(!ap->ops->error_handler);
dev_info(ap->host->dev, "libata-eh.c: ahci_port_freeze()\n");
dev_dbg(ap->host->dev, "libata-eh.c: ahci_port_freeze()\n");
__ata_port_freeze(ap);
nr_aborted = ata_port_abort(ap);
......@@ -1248,7 +1248,7 @@ void ata_eh_freeze_port(struct ata_port *ap)
{
unsigned long flags;
dev_info(ap->host->dev, "ata_eh_freeze_port()\n");
dev_dbg(ap->host->dev, "ata_eh_freeze_port()\n");
if (!ap->ops->error_handler)
return;
spin_lock_irqsave(ap->lock, flags);
......@@ -1736,7 +1736,7 @@ void ata_eh_analyze_ncq_error(struct ata_link *link)
struct ata_taskfile tf;
int tag, rc;
dev_info(link->ap->host->dev, "libata-core.c ata_eh_analyze_ncq_error(), ap->pflags = 0x%08x",ap->pflags);
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_analyze_ncq_error(), ap->pflags = 0x%08x",ap->pflags);
/* if frozen, we can't do much */
if (ap->pflags & ATA_PFLAG_FROZEN)
......@@ -2129,7 +2129,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
int tag;
u32 serror;
int rc;
dev_info(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), ehc->i.flags = 0x%08x, ehc->i.probe_mask = 0x%08x, ehc->i.action = 0x%08x, ehc->i.err_mask = 0x%08x,",
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), ehc->i.flags = 0x%08x, ehc->i.probe_mask = 0x%08x, ehc->i.action = 0x%08x, ehc->i.err_mask = 0x%08x,",
ehc->i.flags,ehc->i.probe_mask, ehc->i.action, ehc->i.err_mask);
DPRINTK("ENTER\n");
......@@ -2148,7 +2148,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
ehc->i.action |= ATA_EH_RESET;
ehc->i.err_mask |= AC_ERR_OTHER;
}
dev_info(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), rc = 0x%08x, ehc->i.probe_mask = 0x%08x, ehc->i.action = 0x%08x, ehc->i.err_mask = 0x%08x,",
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), rc = 0x%08x, ehc->i.probe_mask = 0x%08x, ehc->i.action = 0x%08x, ehc->i.err_mask = 0x%08x,",
rc, ehc->i.probe_mask, ehc->i.action, ehc->i.err_mask);
/* analyze NCQ failure */
......@@ -2160,7 +2160,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
all_err_mask |= ehc->i.err_mask;
dev_info(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), ehc->i.err_mask = 0x%08x, all_err_mask = 0x%08x",
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), ehc->i.err_mask = 0x%08x, all_err_mask = 0x%08x",
ehc->i.err_mask,all_err_mask);
for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
......@@ -2199,7 +2199,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
if (qc->flags & ATA_QCFLAG_IO)
eflags |= ATA_EFLAG_IS_IO;
}
dev_info(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), all_err_mask = 0x%08x", all_err_mask);
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), all_err_mask = 0x%08x", all_err_mask);
/* enforce default EH actions */
if (ap->pflags & ATA_PFLAG_FROZEN ||
......@@ -2233,7 +2233,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
eflags |= ATA_EFLAG_DUBIOUS_XFER;
ehc->i.action |= ata_eh_speed_down(dev, eflags, all_err_mask);
}
dev_info(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), conclusion what to do: ehc->i.action = 0x%08x", ehc->i.action);
dev_dbg(link->ap->host->dev, "libata-core.c ata_eh_link_autopsy(), conclusion what to do: ehc->i.action = 0x%08x", ehc->i.action);
DPRINTK("EXIT\n");
}
......@@ -2251,7 +2251,7 @@ static void ata_eh_link_autopsy(struct ata_link *link)
void ata_eh_autopsy(struct ata_port *ap)
{
struct ata_link *link;
dev_info(ap->host->dev, "libata-core.c ata_eh_autopsy()");
dev_dbg(ap->host->dev, "libata-core.c ata_eh_autopsy()");
ata_for_each_link(link, ap, EDGE)
ata_eh_link_autopsy(link);
......@@ -2647,7 +2647,7 @@ int ata_eh_reset(struct ata_link *link, int classify,
u32 sstatus;
int nr_unknown, rc;
dev_info(ap->host->dev, "ata_eh_reset(), link->flags = 0x%08x\n",link->flags);
dev_dbg(ap->host->dev, "ata_eh_reset(), link->flags = 0x%08x\n",link->flags);
/*
* Prepare to reset
......@@ -3733,7 +3733,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
ata_for_each_link(link, ap, EDGE) {
struct ata_eh_context *ehc = &link->eh_context;
dev_info(ap->host->dev, "ata_eh_recover(), ehc->i.action=0x%08x\n",ehc->i.action);
dev_dbg(ap->host->dev, "ata_eh_recover(), ehc->i.action=0x%08x\n",ehc->i.action);
/* re-enable link? */
if (ehc->i.action & ATA_EH_ENABLE_LINK) {
......@@ -3745,7 +3745,7 @@ int ata_eh_recover(struct ata_port *ap, ata_prereset_fn_t prereset,
}
ata_for_each_dev(dev, link, ALL) {
dev_info(ap->host->dev, "ata_eh_recover(), link->flags=0x%08x\n",link->flags);
dev_dbg(ap->host->dev, "ata_eh_recover(), link->flags=0x%08x\n",link->flags);
if (link->flags & ATA_LFLAG_NO_RETRY)
ehc->tries[dev->devno] = 1;
else
......@@ -4009,7 +4009,7 @@ void ata_do_eh(struct ata_port *ap, ata_prereset_fn_t prereset,
{
struct ata_device *dev;
int rc;
dev_info(ap->host->dev, "libata-eh.c ata_do_eh()");
dev_dbg(ap->host->dev, "libata-eh.c ata_do_eh()");
ata_eh_autopsy(ap);
ata_eh_report(ap);
......@@ -4041,7 +4041,7 @@ void ata_std_error_handler(struct ata_port *ap)
/* ignore built-in hardreset if SCR access is not available */
if (hardreset == sata_std_hardreset && !sata_scr_valid(&ap->link))
hardreset = NULL;
dev_info(ap->host->dev, "libata-eh.c ata_std_error_handler()");
dev_dbg(ap->host->dev, "libata-eh.c ata_std_error_handler()");
ata_do_eh(ap, ops->prereset, ops->softreset, hardreset, ops->postreset);
}
......@@ -4060,7 +4060,7 @@ static void ata_eh_handle_port_suspend(struct ata_port *ap)
unsigned long flags;
int rc = 0;
struct ata_device *dev;
dev_info(ap->host->dev, "ata_eh_handle_port_suspend()\n");
dev_dbg(ap->host->dev, "ata_eh_handle_port_suspend()\n");
/* are we suspending? */
spin_lock_irqsave(ap->lock, flags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment