From patchwork Wed Jun 18 04:54:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 4373111 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id D8298BEEAA for ; Wed, 18 Jun 2014 04:57:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F33EC2025B for ; Wed, 18 Jun 2014 04:57:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2B52C201BC for ; Wed, 18 Jun 2014 04:57:34 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wx7tm-0003St-JR; Wed, 18 Jun 2014 04:55:02 +0000 Received: from mail-pa0-f42.google.com ([209.85.220.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wx7tW-0003Lt-7T for linux-arm-kernel@lists.infradead.org; Wed, 18 Jun 2014 04:54:46 +0000 Received: by mail-pa0-f42.google.com with SMTP id lj1so323082pab.1 for ; Tue, 17 Jun 2014 21:54:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=7CzJDdj3CwhxQWzw9F3wUil6AmZRtUpO3rQSRnCxDTw=; b=R0fdF0AiK82ItL4D1hWxivzzBjTNkbrQehqWJaB6qoWO66IDG+ijfFgkCqHXMR0V+X bOXxKUvg1cNPeVU31PDalBy1Eq/jiyPaqK0PStFD1AVpkKdsjO4yuxxCJSOPsRjt6gxo acXz1rBkz2Qx50+2Rm+c/skQyFyrrpyR1xT2/mo+z75RUq1K6Z91BiBs70Vyxxoyl4tz FG9QOaUE6SQRKWPIZFOes7RhTBv5Ln8/L+qu6yXfIT2WF3s4qrcwADIeI4TZHR/D75yv +vPzCBhSFwZziATsQ3848VYEKDvEMUBuJ5j2pT2qXNUEClGoW3NC0sPa3ZwIMN3DJgB0 32hg== X-Gm-Message-State: ALoCoQl6SowqXwJJ5uUqsxl1p+Bokw0w1UDsP13YN+j7qH1ObZ7C5W0j6VRQTlIlwU3ITr767Lz4 X-Received: by 10.66.65.138 with SMTP id x10mr37677917pas.17.1403067262246; Tue, 17 Jun 2014 21:54:22 -0700 (PDT) Received: from localhost.localdomain ([180.150.148.224]) by mx.google.com with ESMTPSA id oa3sm1060507pbb.15.2014.06.17.21.54.18 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 21:54:21 -0700 (PDT) From: Zhangfei Gao To: tj@kernel.org, hdegoede@redhat.com, arnd@arndb.de, mark.rutland@arm.com Subject: [PATCH RFC 1/2] libahci_platform: add ahci_platform_get_of_property Date: Wed, 18 Jun 2014 12:54:08 +0800 Message-Id: <1403067249-8021-2-git-send-email-zhangfei.gao@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403067249-8021-1-git-send-email-zhangfei.gao@linaro.org> References: <1403067249-8021-1-git-send-email-zhangfei.gao@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140617_215446_337201_53124EEC X-CRM114-Status: GOOD ( 10.12 ) X-Spam-Score: -0.7 (/) Cc: linux-ide@vger.kernel.org, Zhangfei Gao , linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of setting hflags in different files, ahci_platform_get_of_property set hpriv->flags when ahci_platform_init_host according to property in dts. Signed-off-by: Zhangfei Gao --- .../devicetree/bindings/ata/ahci-platform.txt | 9 +++++ drivers/ata/libahci_platform.c | 39 ++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index c96d8dcf98fd..c0b9f6e76ba4 100644 --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt @@ -26,6 +26,15 @@ Optional properties: - clocks : must contain the sata, sata_ref and ahb clocks - clock-names : must contain "ahb" for the ahb clock +- no-ncq: when present, controller can't do NCQ, turning off CAP_NCQ +- 32bit-only: when present, controller can't do 64bit DMA, forcing 32bit +- no-msi: when present, no PCI MSI +- no-pmp: when present, controller can't do PMP, turning off CAP_PMP +- yes-ncq: when present,controller can do NCQ, turning on CAP_NCQ +- no-suspend: when present, controller can't do suspend +- yes-fbs: when present, controller can do FBS, turning on CAP_FBS +- no-fbs: when present, controller can't do FBS, turning off CAP_FBS + Examples: sata@ffe08000 { compatible = "snps,spear-ahci"; diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 3a5b4ed25a4f..880b9f360056 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -278,6 +278,44 @@ err_out: } EXPORT_SYMBOL_GPL(ahci_platform_get_resources); +#ifdef CONFIG_OF +static void ahci_platform_get_of_property(struct platform_device *pdev, + struct ahci_host_priv *hpriv) +{ + struct device_node *np = pdev->dev.of_node; + + if (of_device_is_available(np)) { + if (of_get_property(np, "no-ncq", NULL)) + hpriv->flags |= AHCI_HFLAG_NO_NCQ; + + if (of_get_property(np, "32bit-only", NULL)) + hpriv->flags |= AHCI_HFLAG_32BIT_ONLY; + + if (of_get_property(np, "no-msi", NULL)) + hpriv->flags |= AHCI_HFLAG_NO_MSI; + + if (of_get_property(np, "no-pmp", NULL)) + hpriv->flags |= AHCI_HFLAG_NO_PMP; + + if (of_get_property(np, "yes-ncq", NULL)) + hpriv->flags |= AHCI_HFLAG_YES_NCQ; + + if (of_get_property(np, "no-suspend", NULL)) + hpriv->flags |= AHCI_HFLAG_NO_SUSPEND; + + if (of_get_property(np, "yes-fbs", NULL)) + hpriv->flags |= AHCI_HFLAG_YES_FBS; + + if (of_get_property(np, "no-fbs", NULL)) + hpriv->flags |= AHCI_HFLAG_NO_FBS; + } +} +#else +static void ahci_platform_get_of_property(struct platform_device *pdev, + struct ahci_host_priv *hpriv) +{} +#endif /* CONFIG_OF */ + /** * ahci_platform_init_host - Bring up an ahci-platform host * @pdev: platform device pointer for the host @@ -316,6 +354,7 @@ int ahci_platform_init_host(struct platform_device *pdev, /* prepare host */ pi.private_data = (void *)host_flags; hpriv->flags |= host_flags; + ahci_platform_get_of_property(pdev, hpriv); ahci_save_initial_config(dev, hpriv, force_port_map, mask_port_map);