提交 dc383dd5 编写于 作者: N Nikita Kiryanov 提交者: Stefano Babic

sata: dwc_ahsata: implement sata_port_status

Define the new common function sata_port_status() which can be
used to query the sata driver for the state of ports, and implement it
for dwc_ahsata.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: NMarek Vasut <marex@denx.de>
Signed-off-by: NNikita Kiryanov <nikita@compulab.co.il>
上级 52658fda
...@@ -864,6 +864,23 @@ u32 ata_low_level_rw_lba28(int dev, u32 blknr, lbaint_t blkcnt, ...@@ -864,6 +864,23 @@ u32 ata_low_level_rw_lba28(int dev, u32 blknr, lbaint_t blkcnt,
return blkcnt; return blkcnt;
} }
int sata_port_status(int dev, int port)
{
struct sata_port_regs *port_mmio;
struct ahci_probe_ent *probe_ent = NULL;
if (dev < 0 || dev > (CONFIG_SYS_SATA_MAX_DEVICE - 1))
return -EINVAL;
if (sata_dev_desc[dev].priv == NULL)
return -ENODEV;
probe_ent = (struct ahci_probe_ent *)sata_dev_desc[dev].priv;
port_mmio = (struct sata_port_regs *)probe_ent->port[port].port_mmio;
return readl(&(port_mmio->ssts)) && SATA_PORT_SSTS_DET_MASK;
}
/* /*
* SATA interface between low level driver and command layer * SATA interface between low level driver and command layer
*/ */
......
...@@ -9,6 +9,7 @@ ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer); ...@@ -9,6 +9,7 @@ ulong sata_write(int dev, ulong blknr, lbaint_t blkcnt, const void *buffer);
int sata_initialize(void); int sata_initialize(void);
int __sata_initialize(void); int __sata_initialize(void);
int sata_port_status(int dev, int port);
extern block_dev_desc_t sata_dev_desc[]; extern block_dev_desc_t sata_dev_desc[];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册