From patchwork Sun Aug 3 07:34:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nikita Kiryanov X-Patchwork-Id: 375989 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 893951400A3 for ; Sun, 3 Aug 2014 17:38:02 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AFE164B5F5; Sun, 3 Aug 2014 09:37:16 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tCp3nav-dTbS; Sun, 3 Aug 2014 09:37:16 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 63F49A741C; Sun, 3 Aug 2014 09:35:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 827C74B5D2 for ; Sun, 3 Aug 2014 09:35:30 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DG-qdNvvgByt for ; Sun, 3 Aug 2014 09:35:28 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from compulab.co.il (softlayer.compulab.co.il [50.23.254.55]) by theia.denx.de (Postfix) with ESMTPS id EB8A04B14B for ; Sun, 3 Aug 2014 09:35:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=compulab.co.il; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=Ew7vOJGFx7vCcPCPJFyafhfAd3olVP7C4ucGHka8uSc=; b=eABND4O1ZdZZ/hr/KybV9mMngXWtuw1FuUhjwI/1kHrqCqR7Npbsyo+Blwb7WaDTTKXctt6yVQWUOChY6tbp+T8DGG3HNDwI2eRk3npblrieRYqSKw7u1aOGl8pLm2s1/9UjoN04W3mIEUUFdnWbYG0Wt49tkK9bDTg+nQ0zqZg=; Received: from [82.166.188.245] (port=53903 helo=zimbra-mta.compulab.co.il) by softlayer.compulab.co.il with esmtp (Exim 4.80.1) (envelope-from ) id 1XDqJw-0000qG-NY; Sun, 03 Aug 2014 10:35:08 +0300 Received: from localhost (localhost.localdomain [127.0.0.1]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 4A7F36441DB; Sun, 3 Aug 2014 10:35:07 +0300 (IDT) X-Virus-Scanned: amavisd-new at compulab.co.il Received: from zimbra-mta.compulab.co.il ([127.0.0.1]) by localhost (zimbra-mta.compulab.co.il [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id AhWDjufkirAp; Sun, 3 Aug 2014 10:35:05 +0300 (IDT) Received: from skynet.compulab.local (nikita-pc.compulab.local [192.168.11.211]) by zimbra-mta.compulab.co.il (Postfix) with ESMTP id 84A776441C9; Sun, 3 Aug 2014 10:35:04 +0300 (IDT) From: Nikita Kiryanov To: u-boot@lists.denx.de Date: Sun, 3 Aug 2014 10:34:36 +0300 Message-Id: <1407051288-17324-7-git-send-email-nikita@compulab.co.il> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1407051288-17324-1-git-send-email-nikita@compulab.co.il> References: <1407051288-17324-1-git-send-email-nikita@compulab.co.il> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - softlayer.compulab.co.il X-AntiAbuse: Original Domain - lists.denx.de X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - compulab.co.il X-Get-Message-Sender-Via: softlayer.compulab.co.il: acl_c_relayhosts_text_entry: nikita@compulab.co.il|compulab.co.il Cc: Tom Rini Subject: [U-Boot] [PATCH 06/18] sata: dwc_ahsata: implement sata_port_status X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 Cc: Tom Rini Signed-off-by: Nikita Kiryanov --- drivers/block/dwc_ahsata.c | 17 +++++++++++++++++ include/sata.h | 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/block/dwc_ahsata.c b/drivers/block/dwc_ahsata.c index 15d65d7..e122ed9 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 -1; + + if (sata_dev_desc[dev].priv == NULL) + return -1; + + 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 */ diff --git a/include/sata.h b/include/sata.h index c95dc56..38f4b4a 100644 --- a/include/sata.h +++ b/include/sata.h @@ -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_port_status(int dev, int port); extern block_dev_desc_t sata_dev_desc[];