diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2014-08-20 15:08:53 +0300 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2014-09-09 15:32:32 +0200 |
commit | dc383dd58300e2430e9ad61f6aced2e2d42d16b7 (patch) | |
tree | c854e90dbc0d89bd3af647c1b26cfb34a9d5cf63 /drivers/block | |
parent | 52658fda7abc4319ff7f8fe934d2e7c0a32202d7 (diff) | |
download | u-boot-dc383dd58300e2430e9ad61f6aced2e2d42d16b7.tar.gz |
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: Marek Vasut <marex@denx.de>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/dwc_ahsata.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c index 15d65d77f3..29f478bfbe 100644 --- a/drivers/block/dwc_ahsata.c +++ b/drivers/block/dwc_ahsata.c @@ -864,6 +864,23 @@ u32 ata_low_level_rw_lba28(int dev, u32 blknr, lbaint_t 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 */ |