Received: by 10.213.65.68 with SMTP id h4csp151778imn; Fri, 23 Mar 2018 01:20:29 -0700 (PDT) X-Google-Smtp-Source: AG47ELvqtNDLCNPyRzEgB7RKyiMr8RGYqpeotvta3myYAbzSwfswlr42YLsFcQmXPy+fXJPNVZGj X-Received: by 10.99.96.66 with SMTP id u63mr20421767pgb.22.1521793229194; Fri, 23 Mar 2018 01:20:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521793229; cv=none; d=google.com; s=arc-20160816; b=eNqeVebHcAJ6857Eh4n9+J53z7GShHw1BKKRQBaCybPXNRLqKxJxeHomOQgJnFxUyd QkhBpc8CMID4NDLvYWi3szvqqOjEaa7T5f5YmNrxotJfWhcAMdn73lMisWdKNT+6h8l+ 9wLhHrblobXUZgRGDN1GkCeqTxKQkGM2w+Of/8geA0hfIpdaQPL8KvWKSvPMSa2wH30a BI+J3VyKytSpPFqp+n9Ade2UikiklhrqOp89TpTCQv4cY2N9bZRbWMewmrHgyy1hoC/W GX/Hb/W71H5sr1AtP1ho0uKhCg+jhjPxVXglVWNwzkc+8+dsvmzmBQlFY514BN9YoBDc 6FFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=D8MlsKcKg8Tym8quOW4k9cn8qH1S2EHiG9Rf+Vf+w7w=; b=Gp2OGHF04iB0QezX1e+daWxED1wVc53ksJrdjz+e9kzEqTzR8vCqR32cavZJRiohGP CX0RMXGK7qiMtaOm13MbdSoCar6zCVf3mpW1GjhXV7TYWCW8lOdtxQk5GEo5MabnzG0/ V/tXPm1DdFUVYcM5AjSUGIvaiMm8+SsPVoo6RHVUd4hs2N9Ct/ZyNzqy00zJNWPzoPaT J4HOUGWBmEKodxOOdY0IXPKWKMebkm3dru4vwqfoSZUS+io1NOuWub0UvCE9nsbheY3g eJq77T4IRb2RdxoZISbrva9NEFuE9D+l6f4JcAF5jE2JhGS3ZZffWL2ek3mXqqDzaO8M 51YQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11-v6si4991109plx.631.2018.03.23.01.20.14; Fri, 23 Mar 2018 01:20:29 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751765AbeCWITT (ORCPT + 99 others); Fri, 23 Mar 2018 04:19:19 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:52578 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751479AbeCWITR (ORCPT ); Fri, 23 Mar 2018 04:19:17 -0400 Received: by mail-wm0-f66.google.com with SMTP id l9so1969476wmh.2 for ; Fri, 23 Mar 2018 01:19:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=D8MlsKcKg8Tym8quOW4k9cn8qH1S2EHiG9Rf+Vf+w7w=; b=qX77FhutSbhmIqNowmabVvnBqe8tloWVMSm4DOXyCvS3ytunOL8UcfXipVtBqMVmxe PQNy1Ihchw8ItgoUCJ0nvc+ezfOqNZn9g2lFuhkorgXxrnF9vxN6jy+Ld3iskgJbLGLh pCv0hDBLRoNUawDajZLD40z/X63rGyac47LPpAnoNwgs/PmFqhyI669kA8LD8iZRy5YV Y+rjjAZ32RSTZFPK3HAhePrIpF16JJa/SRDkys8Sq31Hd3HzuIrG1IuCwRjK84UywARt mlWytNgggtvfDRmRj5WMDBegJm62oVfM7PDGCzjL0cVR1GuOR6jLoa3HqTU6zPyqOlLu CgsA== X-Gm-Message-State: AElRT7HCsT751PpVhb5UCpzAuCVyliE6yYhhMVtw+yP6aIjWzrKwwcwm oYavij3uQlxTVvh1ZQvxmYqpz2XuSlA= X-Received: by 10.80.192.72 with SMTP id u8mr22999903edd.16.1521793155501; Fri, 23 Mar 2018 01:19:15 -0700 (PDT) Received: from shalem.localdomain (546A5441.cm-12-3b.dynamic.ziggo.nl. [84.106.84.65]) by smtp.gmail.com with ESMTPSA id 6sm5475919edm.14.2018.03.23.01.19.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Mar 2018 01:19:14 -0700 (PDT) Subject: Re: [PATCH] ata: ahci-platform: add reset control support To: Kunihiko Hayashi , Tejun Heo , Rob Herring , Mark Rutland Cc: linux-ide@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <1521768653-11824-1-git-send-email-hayashi.kunihiko@socionext.com> From: Hans de Goede Message-ID: <87cd10b9-38f8-4e16-cfcf-425e92fc126c@redhat.com> Date: Fri, 23 Mar 2018 09:19:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <1521768653-11824-1-git-send-email-hayashi.kunihiko@socionext.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 23-03-18 02:30, Kunihiko Hayashi wrote: > 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. > > Signed-off-by: Kunihiko Hayashi Patch looks good to me: Reviewed-by: Hans de Goede Regards, Hans > --- > .../devicetree/bindings/ata/ahci-platform.txt | 1 + > drivers/ata/ahci.h | 1 + > drivers/ata/libahci_platform.c | 24 +++++++++++++++++++--- > 3 files changed, 23 insertions(+), 3 deletions(-) > > 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 749fd94..47ec77a2 100644 > --- a/drivers/ata/ahci.h > +++ b/drivers/ata/ahci.h > @@ -347,6 +347,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 341d0ef..3130db9 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); > > @@ -239,12 +248,15 @@ EXPORT_SYMBOL_GPL(ahci_platform_enable_resources); > * following order: > * 1) Phys > * 2) Clocks (through ahci_platform_disable_clks) > - * 3) Regulator > + * 3) Resets > + * 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); > @@ -393,6 +405,12 @@ struct ahci_host_priv *ahci_platform_get_resources(struct platform_device *pdev) > hpriv->clks[i] = clk; > } > > + 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); > > /* >