From patchwork Wed Aug 22 12:13:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 144828 Delivered-To: patch@linaro.org Received: by 2002:a50:c01b:0:0:0:0:0 with SMTP id r27-v6csp617996edb; Wed, 22 Aug 2018 05:13:31 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwJFgOq804SxxiJoZA47PN3Gz+dKPa2+XH+NjuJQ8juuTg9ci526yczr7eyEzpvoUP57EVb X-Received: by 2002:a17:902:292b:: with SMTP id g40-v6mr10540994plb.223.1534940010935; Wed, 22 Aug 2018 05:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534940010; cv=none; d=google.com; s=arc-20160816; b=bFhhiw4wqUxL+SwTgWFhDdtdIrLphSGUiQRzDm/q7HxjV1YfrC1fO1yWrOkAmyDIMz 9SKQ5DzEKM1fiowRiBNLFqok9UZe1N2oTAb5t34LQCp1bdojNmcatKMo0183Rd179JoQ Vz/CpgJGdi28ActrIFmVNqdAnw1GoQHPRVyIyQKdShtoS39SeAj/ETnxo3lCO4SVSbOg FdD/XEBtYxStrHHMCWLwWAiJPqMiFNxytDzAuK+EjZW4eCwMiZwPdCHP1mFwt4NwJoXb deMkGicnpn+wCdZpmPUn4Jhrwm8USOkck9q1AEXiHrYrV3CnKSJ2xgRFqxXpPIabqax3 4+/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=l+hmNQPzIVjCsm5zRE0URerGPzLqgF/rGMhLagHjKRU=; b=y8QFmNJS3uC4ZofdbXOyp9qWrynhTzw06VeO5U5Yupv4PlVSODsPLc5izTzfakLTVL S6E7lM+Bs/TsEqyeJzYpMBhaFwRv1Vh5Ou9tYhNZuRt3q/lhVBSq/5mh/zSUxEs0Bpxu 7C0Q5TryT4wKpr9Jmdh3h3uTk8Mm0rDh4hu3GhQcdoR8sw/D+waLeub+ILrA6GixECaS jDxflh1pMkwE1wyj76ZOTncJ8GNHTXVQ4c/F2gDcB+ehQ4W+iYl8e6smg+tYEjRUTS9W WwJkjNp+awB7twbwbBgpb2M+xoxgZ911/D31wU5g5BWC5k49KZ8QVOxguF9LZam9bVRB 3Klg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z13-v6si1746093pfc.118.2018.08.22.05.13.30; Wed, 22 Aug 2018 05:13:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728721AbeHVPiJ (ORCPT + 32 others); Wed, 22 Aug 2018 11:38:09 -0400 Received: from mx.socionext.com ([202.248.49.38]:50748 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728634AbeHVPiI (ORCPT ); Wed, 22 Aug 2018 11:38:08 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 22 Aug 2018 21:13:25 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 8AE7518020D; Wed, 22 Aug 2018 21:13:25 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 22 Aug 2018 21:13:25 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 2EB8C1A0E11; Wed, 22 Aug 2018 21:13:25 +0900 (JST) From: Kunihiko Hayashi To: Tejun Heo , Hans de Goede , Rob Herring , Mark Rutland , linux-ide@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , Thierry Reding , Matthias Brugger , Patrice Chotard , Maxime Ripard Subject: [PATCH v2 1/3] ata: add an extra argument to ahci_platform_get_resources() Date: Wed, 22 Aug 2018 21:13:01 +0900 Message-Id: <1534939983-16264-2-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an extra argument to ahci_platform_get_resources(), that is for the bitmap representing the resource to get in this function. Currently there is no resources to be defined, so all the callers set '0' to the argument. Suggested-by: Hans de Goede Cc: Thierry Reding Cc: Matthias Brugger Cc: Patrice Chotard Cc: Maxime Ripard Signed-off-by: Kunihiko Hayashi --- drivers/ata/ahci_brcm.c | 2 +- drivers/ata/ahci_ceva.c | 2 +- drivers/ata/ahci_da850.c | 2 +- drivers/ata/ahci_dm816.c | 2 +- drivers/ata/ahci_imx.c | 2 +- drivers/ata/ahci_mtk.c | 2 +- drivers/ata/ahci_mvebu.c | 2 +- drivers/ata/ahci_platform.c | 2 +- drivers/ata/ahci_qoriq.c | 2 +- drivers/ata/ahci_seattle.c | 2 +- drivers/ata/ahci_st.c | 2 +- drivers/ata/ahci_sunxi.c | 2 +- drivers/ata/ahci_tegra.c | 2 +- drivers/ata/ahci_xgene.c | 2 +- drivers/ata/libahci_platform.c | 4 +++- include/linux/ahci_platform.h | 2 +- 16 files changed, 18 insertions(+), 16 deletions(-) -- 2.7.4 diff --git a/drivers/ata/ahci_brcm.c b/drivers/ata/ahci_brcm.c index ea43081..f3d5577 100644 --- a/drivers/ata/ahci_brcm.c +++ b/drivers/ata/ahci_brcm.c @@ -425,7 +425,7 @@ static int brcm_ahci_probe(struct platform_device *pdev) brcm_sata_phys_enable(priv); - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); hpriv->plat_data = priv; diff --git a/drivers/ata/ahci_ceva.c b/drivers/ata/ahci_ceva.c index 5ecc9d4..dc78c98 100644 --- a/drivers/ata/ahci_ceva.c +++ b/drivers/ata/ahci_ceva.c @@ -213,7 +213,7 @@ static int ceva_ahci_probe(struct platform_device *pdev) cevapriv->ahci_pdev = pdev; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_da850.c b/drivers/ata/ahci_da850.c index 9b34dff..ebaa657 100644 --- a/drivers/ata/ahci_da850.c +++ b/drivers/ata/ahci_da850.c @@ -171,7 +171,7 @@ static int ahci_da850_probe(struct platform_device *pdev) u32 mpy; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_dm816.c b/drivers/ata/ahci_dm816.c index fbd827c..89509c3 100644 --- a/drivers/ata/ahci_dm816.c +++ b/drivers/ata/ahci_dm816.c @@ -148,7 +148,7 @@ static int ahci_dm816_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_imx.c b/drivers/ata/ahci_imx.c index 6822e2f..b00799d 100644 --- a/drivers/ata/ahci_imx.c +++ b/drivers/ata/ahci_imx.c @@ -1127,7 +1127,7 @@ static int imx_ahci_probe(struct platform_device *pdev) return ret; } - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_mtk.c b/drivers/ata/ahci_mtk.c index 0ae6971..8bc1a26 100644 --- a/drivers/ata/ahci_mtk.c +++ b/drivers/ata/ahci_mtk.c @@ -142,7 +142,7 @@ static int mtk_ahci_probe(struct platform_device *pdev) if (!plat) return -ENOMEM; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c index 72d90b4..f9cb51b 100644 --- a/drivers/ata/ahci_mvebu.c +++ b/drivers/ata/ahci_mvebu.c @@ -158,7 +158,7 @@ static int ahci_mvebu_probe(struct platform_device *pdev) const struct mbus_dram_target_info *dram; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 99f9a89..5709273 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -43,7 +43,7 @@ static int ahci_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_qoriq.c b/drivers/ata/ahci_qoriq.c index cfdef4d..ce59253 100644 --- a/drivers/ata/ahci_qoriq.c +++ b/drivers/ata/ahci_qoriq.c @@ -250,7 +250,7 @@ static int ahci_qoriq_probe(struct platform_device *pdev) struct resource *res; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_seattle.c b/drivers/ata/ahci_seattle.c index 1d31c0c..e57b6f9 100644 --- a/drivers/ata/ahci_seattle.c +++ b/drivers/ata/ahci_seattle.c @@ -164,7 +164,7 @@ static int ahci_seattle_probe(struct platform_device *pdev) int rc; struct ahci_host_priv *hpriv; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_st.c b/drivers/ata/ahci_st.c index bc345f2..21c5c44 100644 --- a/drivers/ata/ahci_st.c +++ b/drivers/ata/ahci_st.c @@ -156,7 +156,7 @@ static int st_ahci_probe(struct platform_device *pdev) if (!drv_data) return -ENOMEM; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); hpriv->plat_data = drv_data; diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c index b264374..631610b 100644 --- a/drivers/ata/ahci_sunxi.c +++ b/drivers/ata/ahci_sunxi.c @@ -181,7 +181,7 @@ static int ahci_sunxi_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_tegra.c b/drivers/ata/ahci_tegra.c index 64d8484..004f260 100644 --- a/drivers/ata/ahci_tegra.c +++ b/drivers/ata/ahci_tegra.c @@ -494,7 +494,7 @@ static int tegra_ahci_probe(struct platform_device *pdev) int ret; unsigned int i; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/ahci_xgene.c b/drivers/ata/ahci_xgene.c index ad58da7..7e157e1 100644 --- a/drivers/ata/ahci_xgene.c +++ b/drivers/ata/ahci_xgene.c @@ -759,7 +759,7 @@ static int xgene_ahci_probe(struct platform_device *pdev) &xgene_ahci_v2_port_info }; int rc; - hpriv = ahci_platform_get_resources(pdev); + hpriv = ahci_platform_get_resources(pdev, 0); if (IS_ERR(hpriv)) return PTR_ERR(hpriv); diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 30cc8f1..6abc1cd 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -332,6 +332,7 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, /** * ahci_platform_get_resources - Get platform resources * @pdev: platform device to get resources for + * @flags: bitmap representing the resource to get * * This function allocates an ahci_host_priv struct, and gets the following * resources, storing a reference to them inside the returned struct: @@ -345,7 +346,8 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, * RETURNS: * The allocated ahci_host_priv on success, otherwise an ERR_PTR value */ -struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) +struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, + unsigned int flags) { struct device *dev = &pdev->dev; struct ahci_host_priv *hpriv; diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h index 1b0a17b..6490be1 100644 --- a/include/linux/ahci_platform.h +++ b/include/linux/ahci_platform.h @@ -30,7 +30,7 @@ void ahci_platform_disable_regulators(struct ahci_host_priv *hpriv); int ahci_platform_enable_resources(struct ahci_host_priv *hpriv); void ahci_platform_disable_resources(struct ahci_host_priv *hpriv); struct ahci_host_priv *ahci_platform_get_resources( - struct platform_device *pdev); + struct platform_device *pdev, unsigned int flags); int ahci_platform_init_host(struct platform_device *pdev, struct ahci_host_priv *hpriv, const struct ata_port_info *pi_template, From patchwork Wed Aug 22 12:13:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 144829 Delivered-To: patch@linaro.org Received: by 2002:a50:c01b:0:0:0:0:0 with SMTP id r27-v6csp618035edb; Wed, 22 Aug 2018 05:13:33 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxVe/rS3SyXKxQvQRWjHPcbYbiNdKI0yLbD2kRIYHo7yAys7CzWBjhoTOOGY5NmyNsF39BH X-Received: by 2002:a17:902:7845:: with SMTP id e5-v6mr53162154pln.197.1534940013106; Wed, 22 Aug 2018 05:13:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534940013; cv=none; d=google.com; s=arc-20160816; b=uoN5CrFTVfWDKyHfb1cYJ7KG13o8uiCTWg9skWoouqINDPXDWG5HfIdxa2MARakSeI sDtzOecloY7DJSLDHUnbpUm6CpFEB5Qw7R1qMw2z96SABWKe5c+0z58scxNmuUfZUBaK GgbOfgn9PFAJbInA1Dr2fm4nlb9CdGW5r3Fcv9yCh3A9u1zeu0Y5/SUMKJStvZYtGIUJ S0QJOki0UzeGRD55UH59hnHuI2TDde2E3eG5XF8mE5gRgR9xac5XWrdaiS91J60zSobG yGkI8b2W+zFbG0M37CSsjdTriGPuiKNXOxNB89NKJUupcVnAsI7Vc8k6DoBnXuNtcdyy b0vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=lnXD+rvb2SE2PGVdVcKNcSSXf9aqluj2fiGi7OaooPY=; b=MB36uadl7pNYVjsWbUCnIdAzI6vbIJB3BssNMJIr/MM8oXNS+jSKTK03kCDFuy9cXE MHbDJZm4t4zSRI/hCpAdqDn2BYcUoNueI3uM4Og2Dd9UXDL/LBbWsv246wXv0fkouzwe Yo1Ud/jDIlWpjYXzt8+4eyBD56BmXdhWPGTQQXlI1oDBi9eqNSJm3xJu7rAfF12yHEpF iuQ2M78SWg/SnVXcT7fCN56rRvxjCAcFuTpMy2BEn53LUdudK9nbzRYfBzjovcNY2UEL HkZiFf+UcpZV1lvkT3ifriLF4BWQAJ9z//Aw+wGv1eG2jKDJi8hfaQUeTrQ3K5gQuyvF jbAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z188-v6si1788266pfb.26.2018.08.22.05.13.32; Wed, 22 Aug 2018 05:13:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728796AbeHVPiK (ORCPT + 32 others); Wed, 22 Aug 2018 11:38:10 -0400 Received: from mx.socionext.com ([202.248.49.38]:50745 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727777AbeHVPiJ (ORCPT ); Wed, 22 Aug 2018 11:38:09 -0400 Received: from unknown (HELO kinkan-ex.css.socionext.com) ([172.31.9.52]) by mx.socionext.com with ESMTP; 22 Aug 2018 21:13:27 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by kinkan-ex.css.socionext.com (Postfix) with ESMTP id 93C2A18020D; Wed, 22 Aug 2018 21:13:27 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 22 Aug 2018 21:13:27 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 2EE291A0E11; Wed, 22 Aug 2018 21:13:27 +0900 (JST) From: Kunihiko Hayashi To: Tejun Heo , Hans de Goede , Rob Herring , Mark Rutland , linux-ide@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , Thierry Reding Subject: [PATCH v2 2/3] ata: libahci_platform: add reset control support Date: Wed, 22 Aug 2018 21:13:02 +0900 Message-Id: <1534939983-16264-3-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add support to get and control a list of resets for the device as optional and shared. These resets must be kept de-asserted until the device is enabled. This is specified as shared because some SoCs like UniPhier series have common reset controls with all ahci controller instances. However, according to Thierry's view, https://www.spinics.net/lists/linux-ide/msg55357.html some hardware-specific drivers already use their own resets, and the common reset make a path to occur double controls of resets. The ahci_platform_get_resources() can get and control the reset only when the second argument includes AHCI_PLATFORM_GET_RESETS bit. Suggested-by: Hans de Goede Cc: Thierry Reding Signed-off-by: Kunihiko Hayashi --- .../devicetree/bindings/ata/ahci-platform.txt | 1 + drivers/ata/ahci.h | 1 + drivers/ata/libahci_platform.c | 31 ++++++++++++++++++---- include/linux/ahci_platform.h | 2 ++ 4 files changed, 30 insertions(+), 5 deletions(-) -- 2.7.4 diff --git a/Documentation/devicetree/bindings/ata/ahci-platform.txt b/Documentation/devicetree/bindings/ata/ahci-platform.txt index c760ecb..f4006d3 100644 --- a/Documentation/devicetree/bindings/ata/ahci-platform.txt +++ b/Documentation/devicetree/bindings/ata/ahci-platform.txt @@ -30,6 +30,7 @@ compatible: Optional properties: - dma-coherent : Present if dma operations are coherent - clocks : a list of phandle + clock specifier pairs +- resets : a list of phandle + reset specifier pairs - target-supply : regulator for SATA target power - phys : reference to the SATA PHY node - phy-names : must be "sata-phy" diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h index 1609eba..6a1515f 100644 --- a/drivers/ata/ahci.h +++ b/drivers/ata/ahci.h @@ -350,6 +350,7 @@ struct ahci_host_priv { u32 em_msg_type; /* EM message type */ bool got_runtime_pm; /* Did we do pm_runtime_get? */ struct clk *clks[AHCI_MAX_CLKS]; /* Optional */ + struct reset_control *rsts; /* Optional */ struct regulator **target_pwrs; /* Optional */ /* * If platform uses PHYs. There is a 1:1 relation between the port number and diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c index 6abc1cd..6817143 100644 --- a/drivers/ata/libahci_platform.c +++ b/drivers/ata/libahci_platform.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "ahci.h" static void ahci_host_stop(struct ata_host *host); @@ -195,7 +196,8 @@ EXPORT_SYMBOL_GPL(ahci_platform_disable_regulators); * following order: * 1) Regulator * 2) Clocks (through ahci_platform_enable_clks) - * 3) Phys + * 3) Resets + * 4) Phys * * If resource enabling fails at any point the previous enabled resources * are disabled in reverse order. @@ -215,12 +217,19 @@ int ahci_platform_enable_resources(struct ahci_host_priv *hpriv) if (rc) goto disable_regulator; - rc = ahci_platform_enable_phys(hpriv); + rc = reset_control_deassert(hpriv->rsts); if (rc) goto disable_clks; + rc = ahci_platform_enable_phys(hpriv); + if (rc) + goto disable_resets; + return 0; +disable_resets: + reset_control_assert(hpriv->rsts); + disable_clks: ahci_platform_disable_clks(hpriv); @@ -238,13 +247,16 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources); * This function disables all ahci_platform managed resources in the * following order: * 1) Phys - * 2) Clocks (through ahci_platform_disable_clks) - * 3) Regulator + * 2) Resets + * 3) Clocks (through ahci_platform_disable_clks) + * 4) Regulator */ void ahci_platform_disable_resources(struct ahci_host_priv *hpriv) { ahci_platform_disable_phys(hpriv); + reset_control_assert(hpriv->rsts); + ahci_platform_disable_clks(hpriv); ahci_platform_disable_regulators(hpriv); @@ -341,7 +353,8 @@ static int ahci_platform_get_regulator(struct ahci_host_priv *hpriv, u32 port, * 2) regulator for controlling the targets power (optional) * 3) 0 - AHCI_MAX_CLKS clocks, as specified in the devs devicetree node, * or for non devicetree enabled platforms a single clock - * 4) phys (optional) + * 4) resets, if flags has AHCI_PLATFORM_GET_RESETS (optional) + * 5) phys (optional) * * RETURNS: * The allocated ahci_host_priv on success, otherwise an ERR_PTR value @@ -395,6 +408,14 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev, hpriv->clks[i] = clk; } + if (flags & AHCI_PLATFORM_GET_RESETS) { + hpriv->rsts = devm_reset_control_array_get_optional_shared(dev); + if (IS_ERR(hpriv->rsts)) { + rc = PTR_ERR(hpriv->rsts); + goto err_out; + } + } + hpriv->nports = child_nodes = of_get_child_count(dev->of_node); /* diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h index 6490be1..eaedca5f 100644 --- a/include/linux/ahci_platform.h +++ b/include/linux/ahci_platform.h @@ -43,4 +43,6 @@ int ahci_platform_resume_host(struct device *dev); int ahci_platform_suspend(struct device *dev); int ahci_platform_resume(struct device *dev); +#define AHCI_PLATFORM_GET_RESETS 0x01 + #endif /* _AHCI_PLATFORM_H */ From patchwork Wed Aug 22 12:13:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kunihiko Hayashi X-Patchwork-Id: 144830 Delivered-To: patch@linaro.org Received: by 2002:a50:c01b:0:0:0:0:0 with SMTP id r27-v6csp618123edb; Wed, 22 Aug 2018 05:13:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYFF3A0tPdSzfi53OtoIREW383rPT+VeKu6MnTsLHmTUBZIwywzyacYyD2ngrEg0Ekh7YQU X-Received: by 2002:a17:902:bd87:: with SMTP id q7-v6mr6660742pls.254.1534940019043; Wed, 22 Aug 2018 05:13:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534940019; cv=none; d=google.com; s=arc-20160816; b=JoiWitCIDAE9ie4vBwyi96t94ggQLNth9UJTsIWfAGDdBm75TQdjGdYi6RCFh7AOYi bvFOKeejcUQ2w0nMM8h70kTCmjxQS3AGcT5p1THPkaWpbZRwObX28FhfHsROs1ZgD2bE rVDLPUy+PhFFKjtL2H+K97BVtm0XRWwM92q+z9SIsZqM4dMQLKeLX83aAJ4P9xpuUwX6 0SE47GLhBbdzkYenByZj/LIDRn4t47vt2AcaL3OrGubzqn9Ypn1vpyjCFJL0UIWlVm+x 3n77fQZf3ue727+tfTruMS4F7FzwywBSlTJg+4pZC8HeLRPKzQX/mtdH+2Au7cEJ/+SY y2PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=y4HYAmRK8katSTUiTWv+VTpZrdWqdK/GJ8gwUJtQA7o=; b=ve4Dfby184hHCFIGoZQxI55SZl/Sku/sifEu7BkeRTi1eY7SxWo83wJ0XRLrO/7567 iVNOWz8lLxeELGn2/1zDccW62/o55Om3u3ErImvf3s/VIYEVdi58RPnkfITN/Demvv0c 8+OcZfL2els4XxxYiZFV9YUh8GwG6wBNgw9pV2l3thnbx1Tj4m2KbGPOg4xKodiOaRTn lBEpGg2Zn1iK34O5ttJg0W2eC9aVPLaU9RGkTzwO+f9JNwpfW8YMWZ5END7LlRijBkP9 YqlBOQc5KfBNtbdYdp/JATj7bCGFoAi65OWDmy42+Y8eJtIACsp1v04WzgppAYs3yKUj 2SpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w4-v6si1574960pgw.478.2018.08.22.05.13.38; Wed, 22 Aug 2018 05:13:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728851AbeHVPiR (ORCPT + 32 others); Wed, 22 Aug 2018 11:38:17 -0400 Received: from mx.socionext.com ([202.248.49.38]:50748 "EHLO mx.socionext.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728546AbeHVPiK (ORCPT ); Wed, 22 Aug 2018 11:38:10 -0400 Received: from unknown (HELO iyokan-ex.css.socionext.com) ([172.31.9.54]) by mx.socionext.com with ESMTP; 22 Aug 2018 21:13:29 +0900 Received: from mail.mfilter.local (m-filter-1 [10.213.24.61]) by iyokan-ex.css.socionext.com (Postfix) with ESMTP id 2822B600AA; Wed, 22 Aug 2018 21:13:29 +0900 (JST) Received: from 172.31.9.51 (172.31.9.51) by m-FILTER with ESMTP; Wed, 22 Aug 2018 21:13:29 +0900 Received: from plum.e01.socionext.com (unknown [10.213.132.32]) by kinkan.css.socionext.com (Postfix) with ESMTP id 78DA01A0E11; Wed, 22 Aug 2018 21:13:28 +0900 (JST) From: Kunihiko Hayashi To: Tejun Heo , Hans de Goede , Rob Herring , Mark Rutland , linux-ide@vger.kernel.org Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Kunihiko Hayashi , Thierry Reding Subject: [PATCH v2 3/3] ata: ahci_platform: enable to get and control reset Date: Wed, 22 Aug 2018 21:13:03 +0900 Message-Id: <1534939983-16264-4-git-send-email-hayashi.kunihiko@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> References: <1534939983-16264-1-git-send-email-hayashi.kunihiko@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Unlike SoC-specific driver, generic ahci_platform driver doesn't have any chances to control resets. This adds AHCI_PLATFORM_GET_RESETS to ahci_platform_get_resources() on the generic driver to enable reset control support. Suggested-by: Hans de Goede Cc: Thierry Reding Signed-off-by: Kunihiko Hayashi --- drivers/ata/ahci_platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 5709273..ddd9308 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -43,7 +43,8 @@ static int ahci_probe(struct platform_device *pdev) struct ahci_host_priv *hpriv; int rc; - hpriv = ahci_platform_get_resources(pdev, 0); + hpriv = ahci_platform_get_resources(pdev, + AHCI_PLATFORM_GET_RESETS); if (IS_ERR(hpriv)) return PTR_ERR(hpriv);