All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
To: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org,
	devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: nm-l0cyMroinI0@public.gmane.org,
	balbi-l0cyMroinI0@public.gmane.org,
	george.cherian-l0cyMroinI0@public.gmane.org,
	nsekhar-l0cyMroinI0@public.gmane.org,
	linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/2] phy: ti-pipe3: Fix SATA across suspend/resume
Date: Mon, 29 Dec 2014 11:53:49 +0200	[thread overview]
Message-ID: <54A124AD.2020201@ti.com> (raw)
In-Reply-To: <5498221C.6010701-l0cyMroinI0@public.gmane.org>

On 22/12/14 15:52, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Friday 19 December 2014 05:35 PM, Roger Quadros wrote:
>> Failed test case: Boot without SATA drive connected. Suspend/resume
>> the board and then connect SATA drive. It fails to enumerate.
>>
>> Due to Errata i783 "SATA Lockup After SATA DPLL Unlock/Relock"
>> we can't allow SATA DPLL to be in the unlocked state.
>> The SATA refclk (sata_ref_clk) is the source of the SATA_DPLL.
>> Till now this clock was controlled by the AHCI SATA driver and was being
>> shut off  during system suspend (if the SATA drive was not already attached)
>> causing the SATA DPLL to be unlocked and so causing errata i783.
>>
>> To prevent sata_ref_clk from being disabled, we move the control of
>> this clock from the SATA AHCI driver to the SATA PHY driver and prevent
>> it from being disabled.
>>
>> This also fixes the issue of SATA not working on OMAP5/DRA7 when
>> AHCI platform driver is built as a module.
>>
>> Signed-off-by: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi  |  4 ++--
>>  arch/arm/boot/dts/omap5.dtsi |  4 ++--
>>  drivers/phy/phy-ti-pipe3.c   | 53 +++++++++++++++++++++++++++++++-------------
>>  3 files changed, 41 insertions(+), 20 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index 63bf99b..8c35b84 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -1090,8 +1090,8 @@
>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>  				ctrl-module = <&omap_control_sata>;
>> -				clocks = <&sys_clkin1>;
>> -				clock-names = "sysclk";
>> +				clocks = <&sys_clkin1>, <&sata_ref_clk>;
>> +				clock-names = "sysclk", "refclk";
>>  				#phy-cells = <0>;
>>  			};
>>  
>> diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
>> index b321fdf..bb498e7 100644
>> --- a/arch/arm/boot/dts/omap5.dtsi
>> +++ b/arch/arm/boot/dts/omap5.dtsi
>> @@ -929,8 +929,8 @@
>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>  				ctrl-module = <&omap_control_sata>;
>> -				clocks = <&sys_clkin>;
>> -				clock-names = "sysclk";
>> +				clocks = <&sys_clkin>, <&sata_ref_clk>;
>> +				clock-names = "sysclk", "refclk";
>>  				#phy-cells = <0>;
>>  			};
>>  		};
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index e60ff14..e08edd9 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -85,6 +85,7 @@ struct ti_pipe3 {
>>  	struct pipe3_dpll_map	*dpll_map;
>>  	u8			id;
>>  	bool enabled;
>> +	bool refclk_enabled;	/* this flag is needed specifically for SATA */
>>  	spinlock_t lock;	/* serialize clock enable/disable */
>>  };
>>  
>> @@ -333,21 +334,20 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>  		}
>>  	}
>>  
>> +	phy->refclk = devm_clk_get(phy->dev, "refclk");
>> +	if (IS_ERR(phy->refclk)) {
>> +		dev_err(&pdev->dev, "unable to get refclk\n");
>> +		return PTR_ERR(phy->refclk);
>> +	}
> 
> This will break older dtbs. AFAIK, newer kernels should be compatible with
> older dtbs too. cc'ed devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org for clarification.

If I make refclk optional that still leaves SATA broken on older dtbs. Wouldn't it be better to fix the DTBs via stable instead?

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Roger Quadros <rogerq@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>, <tony@atomide.com>,
	devicetree <devicetree@vger.kernel.org>
Cc: <nm@ti.com>, <balbi@ti.com>, <george.cherian@ti.com>,
	<nsekhar@ti.com>, <linux-omap@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] phy: ti-pipe3: Fix SATA across suspend/resume
Date: Mon, 29 Dec 2014 11:53:49 +0200	[thread overview]
Message-ID: <54A124AD.2020201@ti.com> (raw)
In-Reply-To: <5498221C.6010701@ti.com>

On 22/12/14 15:52, Kishon Vijay Abraham I wrote:
> Hi Roger,
> 
> On Friday 19 December 2014 05:35 PM, Roger Quadros wrote:
>> Failed test case: Boot without SATA drive connected. Suspend/resume
>> the board and then connect SATA drive. It fails to enumerate.
>>
>> Due to Errata i783 "SATA Lockup After SATA DPLL Unlock/Relock"
>> we can't allow SATA DPLL to be in the unlocked state.
>> The SATA refclk (sata_ref_clk) is the source of the SATA_DPLL.
>> Till now this clock was controlled by the AHCI SATA driver and was being
>> shut off  during system suspend (if the SATA drive was not already attached)
>> causing the SATA DPLL to be unlocked and so causing errata i783.
>>
>> To prevent sata_ref_clk from being disabled, we move the control of
>> this clock from the SATA AHCI driver to the SATA PHY driver and prevent
>> it from being disabled.
>>
>> This also fixes the issue of SATA not working on OMAP5/DRA7 when
>> AHCI platform driver is built as a module.
>>
>> Signed-off-by: Roger Quadros <rogerq@ti.com>
>> ---
>>  arch/arm/boot/dts/dra7.dtsi  |  4 ++--
>>  arch/arm/boot/dts/omap5.dtsi |  4 ++--
>>  drivers/phy/phy-ti-pipe3.c   | 53 +++++++++++++++++++++++++++++++-------------
>>  3 files changed, 41 insertions(+), 20 deletions(-)
>>
>> diff --git a/arch/arm/boot/dts/dra7.dtsi b/arch/arm/boot/dts/dra7.dtsi
>> index 63bf99b..8c35b84 100644
>> --- a/arch/arm/boot/dts/dra7.dtsi
>> +++ b/arch/arm/boot/dts/dra7.dtsi
>> @@ -1090,8 +1090,8 @@
>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>  				ctrl-module = <&omap_control_sata>;
>> -				clocks = <&sys_clkin1>;
>> -				clock-names = "sysclk";
>> +				clocks = <&sys_clkin1>, <&sata_ref_clk>;
>> +				clock-names = "sysclk", "refclk";
>>  				#phy-cells = <0>;
>>  			};
>>  
>> diff --git a/arch/arm/boot/dts/omap5.dtsi b/arch/arm/boot/dts/omap5.dtsi
>> index b321fdf..bb498e7 100644
>> --- a/arch/arm/boot/dts/omap5.dtsi
>> +++ b/arch/arm/boot/dts/omap5.dtsi
>> @@ -929,8 +929,8 @@
>>  				      <0x4A096800 0x40>; /* pll_ctrl */
>>  				reg-names = "phy_rx", "phy_tx", "pll_ctrl";
>>  				ctrl-module = <&omap_control_sata>;
>> -				clocks = <&sys_clkin>;
>> -				clock-names = "sysclk";
>> +				clocks = <&sys_clkin>, <&sata_ref_clk>;
>> +				clock-names = "sysclk", "refclk";
>>  				#phy-cells = <0>;
>>  			};
>>  		};
>> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
>> index e60ff14..e08edd9 100644
>> --- a/drivers/phy/phy-ti-pipe3.c
>> +++ b/drivers/phy/phy-ti-pipe3.c
>> @@ -85,6 +85,7 @@ struct ti_pipe3 {
>>  	struct pipe3_dpll_map	*dpll_map;
>>  	u8			id;
>>  	bool enabled;
>> +	bool refclk_enabled;	/* this flag is needed specifically for SATA */
>>  	spinlock_t lock;	/* serialize clock enable/disable */
>>  };
>>  
>> @@ -333,21 +334,20 @@ static int ti_pipe3_probe(struct platform_device *pdev)
>>  		}
>>  	}
>>  
>> +	phy->refclk = devm_clk_get(phy->dev, "refclk");
>> +	if (IS_ERR(phy->refclk)) {
>> +		dev_err(&pdev->dev, "unable to get refclk\n");
>> +		return PTR_ERR(phy->refclk);
>> +	}
> 
> This will break older dtbs. AFAIK, newer kernels should be compatible with
> older dtbs too. cc'ed devicetree@vger.kernel.org for clarification.

If I make refclk optional that still leaves SATA broken on older dtbs. Wouldn't it be better to fix the DTBs via stable instead?

cheers,
-roger

  parent reply	other threads:[~2014-12-29  9:53 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-19 12:05 [PATCH 0/2] phy: ti-pipe3: fixes for 3.19-rc Roger Quadros
2014-12-19 12:05 ` Roger Quadros
2014-12-19 12:05 ` [PATCH 1/2] phy: ti-pipe3: Disable clocks on system suspend Roger Quadros
2014-12-19 12:05   ` Roger Quadros
2015-01-09 13:57   ` Kishon Vijay Abraham I
2015-01-09 13:57     ` Kishon Vijay Abraham I
2015-01-12  9:21     ` Roger Quadros
2015-01-12  9:21       ` Roger Quadros
2014-12-19 12:05 ` [PATCH 2/2] phy: ti-pipe3: Fix SATA across suspend/resume Roger Quadros
2014-12-19 12:05   ` Roger Quadros
2014-12-22 13:52   ` Kishon Vijay Abraham I
2014-12-22 13:52     ` Kishon Vijay Abraham I
     [not found]     ` <5498221C.6010701-l0cyMroinI0@public.gmane.org>
2014-12-29  9:53       ` Roger Quadros [this message]
2014-12-29  9:53         ` Roger Quadros
2015-01-08 11:17   ` [PATCH v2 " Roger Quadros
2015-01-08 11:17     ` Roger Quadros
2015-01-09 13:59     ` Kishon Vijay Abraham I
2015-01-09 13:59       ` Kishon Vijay Abraham I
2015-01-12  9:23       ` Roger Quadros
2015-01-12  9:23         ` Roger Quadros

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54A124AD.2020201@ti.com \
    --to=rogerq-l0cymroini0@public.gmane.org \
    --cc=balbi-l0cyMroinI0@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=george.cherian-l0cyMroinI0@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=nm-l0cyMroinI0@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.