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: 32106 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 04F36206A0 for ; Wed, 18 Jun 2014 04:54:29 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id o8sf1066511qcw.11 for ; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=Cn/X5w9uZ+WUKAB3v41D4mBnkqjGuk2AftobaXTyx1w=; b=YOKy9thIqtfxzJnya2bwDrU8S47n6wUP6/nWJytkSu/8UwBU3p3Jh4Jk9xSmRdvwmX xeoCLTaYev+X8XWI+n9NKeylS4YUuWqk5Apls3U8AEbRmijX/0WBWFP5v4ZE1+pO6IqD ymxbqsTH8p5gEjvcbCiWS64AbZ6WLlVQuMuNaUd16eypWU9BJT+d7BMLkuQOtQ3eJJIh 4BMqQVaM5YwgvNaZdveiSMHsH/bBF2lNW0zpj6MVq74gixGMSOuFroTQWXSP47xs6TND BZR0ojo/JcTz7TeM0XKd4oK5LPHt25jFn/FvRSAs6idRBf2Yw6+NCw5Hvvg1Gs3xovLb C2pQ== X-Gm-Message-State: ALoCoQl/Zzv0hW98md4oXy2FAmDduQT7jXI1JkB7Y33RGjhckHvEexf5PCD61aOAUEbLehPkqlXM X-Received: by 10.58.199.135 with SMTP id jk7mr612334vec.22.1403067268878; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.138 with SMTP id 10ls5181179qgx.9.gmail; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) X-Received: by 10.58.123.71 with SMTP id ly7mr24917253veb.11.1403067268787; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id q13si342488vci.29.2014.06.17.21.54.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 21:54:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so294454vcb.27 for ; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) X-Received: by 10.220.190.197 with SMTP id dj5mr25210441vcb.19.1403067268695; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp256267vcb; Tue, 17 Jun 2014 21:54:28 -0700 (PDT) X-Received: by 10.68.139.194 with SMTP id ra2mr37048075pbb.20.1403067267960; Tue, 17 Jun 2014 21:54:27 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id rc6si847553pab.107.2014.06.17.21.54.27; Tue, 17 Jun 2014 21:54:27 -0700 (PDT) Received-SPF: none (google.com: devicetree-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756628AbaFREyY (ORCPT + 8 others); Wed, 18 Jun 2014 00:54:24 -0400 Received: from mail-pd0-f179.google.com ([209.85.192.179]:52065 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756586AbaFREyW (ORCPT ); Wed, 18 Jun 2014 00:54:22 -0400 Received: by mail-pd0-f179.google.com with SMTP id w10so293127pde.10 for ; Tue, 17 Jun 2014 21:54:22 -0700 (PDT) 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 Cc: linux-ide@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Zhangfei Gao 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> Sender: devicetree-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: devicetree@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zhangfei.gao@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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);