devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Andrzej Pietrasiewicz
	<andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
	linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: Marek Szyprowski
	<m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Bartlomiej Zolnierkiewicz
	<b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Krzysztof Kozlowski
	<krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Kukjin Kim <kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
	Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>
Subject: Re: [PATCH 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800
Date: Mon, 18 Sep 2017 15:43:47 +0300	[thread overview]
Message-ID: <87vakgmb24.fsf@linux.intel.com> (raw)
In-Reply-To: <5c90f022-5cb1-c746-6015-c93a58805cfe-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 3390 bytes --]


Hi,

Andrzej Pietrasiewicz <andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> writes:
>>>>> +static int exynos5_usbdrd_phy_reset(struct phy *phy)
>>>>> +{
>>>>> +	struct phy_usb_instance *inst = phy_get_drvdata(phy);
>>>>> +	struct exynos5_usbdrd_phy *phy_drd = to_usbdrd_phy(inst);
>>>>> +
>>>>> +	return exynos5420_usbdrd_phy_calibrate(phy_drd);
>>>>> +}
>>>>> +
>>>>>    static const struct phy_ops exynos5_usbdrd_phy_ops = {
>>>>>    	.init		= exynos5_usbdrd_phy_init,
>>>>>    	.exit		= exynos5_usbdrd_phy_exit,
>>>>>    	.power_on	= exynos5_usbdrd_phy_power_on,
>>>>>    	.power_off	= exynos5_usbdrd_phy_power_off,
>>>>> +	.reset		= exynos5_usbdrd_phy_reset,
>>>>>    	.owner		= THIS_MODULE,
>>>>>    };
>>>>>    
>>>>> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
>>>>> index 03474d3..1d5836e 100644
>>>>> --- a/drivers/usb/dwc3/core.c
>>>>> +++ b/drivers/usb/dwc3/core.c
>>>>> @@ -156,9 +156,10 @@ static void __dwc3_set_mode(struct work_struct *work)
>>>>>    		} else {
>>>>>    			if (dwc->usb2_phy)
>>>>>    				otg_set_vbus(dwc->usb2_phy->otg, true);
>>>>> -			if (dwc->usb2_generic_phy)
>>>>> +			if (dwc->usb2_generic_phy) {
>>>>>    				phy_set_mode(dwc->usb2_generic_phy, PHY_MODE_USB_HOST);
>>>>> -
>>>>> +				phy_reset(dwc->usb2_generic_phy);
>>>>
>>>> it doesn't look like this is the best place to reset the phy. Also,
>>>
>>> right, phy_reset is done during initialization before phy_power_on/phy_init or
>>> in error cases.
>>>
>>>> ->reset() doesn't seem to match correctly with a calibration. That seems
>>>> to be more fitting to a ->power_on() or ->init() implementation.
>>>
>>> yeah, the initial patch seems to calibrate in phy_init(). Not sure why it's
>>> modified.
>> 
>> The original patch used a hack like below, in xhci_plat_probe():
>> 
>> +       /* Initialize and power-on USB 3.0 PHY */
>> +       xhci->shared_hcd->phy->init_count = 0;
>> +       ret = phy_init(xhci->shared_hcd->phy);
>> +       if (ret)
>> +               goto dealloc_usb3_hcd;
>> +
>> +       xhci->shared_hcd->phy->power_count = 0;
>> +       ret = phy_power_on(xhci->shared_hcd->phy);
>> +       if (ret) {
>> +               phy_exit(xhci->shared_hcd->phy);
>> +               goto dealloc_usb3_hcd;
>> +       }
>> +
>> 
>> Manually setting init_count to 0 in order for the subsequent phy_init() to
>> happen probably does not look good.
>> 
>> The calibration is clearly needed. However, I don't have any strong opinions
>> on from which place exactly to trigger the calibration process.
>> The original patch did not make it upstream, but if that patch is ok,
>> it is perfectly fine with me to drop my version and take that one instead.
>
> Me bad, I did not write about an important issue.
> The calibration must happen after usb_add_hcd(), otherwise
> usb_add_hcd() indirectly triggers overwriting the effects of calibration.

in that case, you should do that from xhci-plat indeed. I think the
whole idea with init_count is just to make sure you don't initialize it
twice.

One thing's for sure, ->reset() doesn't seem to be the matching callback
for you to use and, given your explanation above, dwc3 doesn't seem to
be the right place to fiddle with that.

Seems like we need an extension of the generic PHY framework to cope
with your requirement.

-- 
balbi

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  parent reply	other threads:[~2017-09-18 12:43 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20170918100229eucas1p24733d7108dfbcf16a59476c1efd7d56a@eucas1p2.samsung.com>
2017-09-18 10:02 ` [PATCH 0/2] dwc3 on XU3 and XU4 Andrzej Pietrasiewicz
     [not found]   ` <CGME20170918100230eucas1p29fae00c53f1106af1961a6e269740b2f@eucas1p2.samsung.com>
     [not found]     ` <1505728934-6200-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-18 10:02       ` [PATCH 1/2] ARM: dts: exynos: Add dwc3 SUSPHY quirk Andrzej Pietrasiewicz
2017-09-19 17:40         ` Krzysztof Kozlowski
2017-09-19 18:10           ` Robin Murphy
2017-09-22  8:18             ` Andrzej Pietrasiewicz
2017-09-25 18:49               ` Krzysztof Kozlowski
     [not found]   ` <CGME20170918100944eucas1p2735d3d6a6ee562b927fb9dfaeb0d4090@eucas1p2.samsung.com>
2017-09-18 10:09     ` [PATCH 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-09-18 10:38       ` Felipe Balbi
     [not found]         ` <87y3pcmgv6.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-18 11:06           ` Kishon Vijay Abraham I
2017-09-18 11:27             ` Andrzej Pietrasiewicz
2017-09-18 11:41               ` Andrzej Pietrasiewicz
     [not found]                 ` <5c90f022-5cb1-c746-6015-c93a58805cfe-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-18 12:43                   ` Felipe Balbi [this message]
     [not found]                     ` <87vakgmb24.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-09-18 14:20                       ` Andrzej Pietrasiewicz
     [not found]                         ` <7d87727a-e65e-f25b-0cdc-fe6ff0b7bb90-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-09-21 11:07                           ` Kishon Vijay Abraham I
     [not found]                             ` <CGME20171003125944eucas1p1fad23e6171786fda69ccd9419354911b@eucas1p1.samsung.com>
     [not found]                               ` <ba580a0c-36c3-b227-61ee-97637532823e-l0cyMroinI0@public.gmane.org>
2017-10-03 12:59                                 ` [PATCHv2 0/2] Andrzej Pietrasiewicz
     [not found]                                   ` <CGME20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352@eucas1p2.samsung.com>
     [not found]                                     ` <1507035578-24945-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-03 12:59                                       ` [PATCHv2 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
     [not found]                                   ` <CGME20171003125946eucas1p14569ac9f0a3a19fb3a60fd977f92a711@eucas1p1.samsung.com>
2017-10-03 12:59                                     ` [PATCHv2 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
     [not found]                                       ` <1507035578-24945-3-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05  8:00                                         ` kbuild test robot
2017-10-03 13:19                                   ` [PATCHv2 0/2] Andrzej Pietrasiewicz
2017-10-04  4:22                                   ` Kishon Vijay Abraham I
     [not found]                                     ` <b9aad201-78b9-f04b-238d-5297e6096ee7-l0cyMroinI0@public.gmane.org>
2017-10-04  7:05                                       ` [PATCHv2 0/2] dwc3 on XU3 Andrzej Pietrasiewicz
     [not found]                                         ` <CGME20171005121201eucas1p2d8e7c3bf18b24ffaa0bf9593dcffe37e@eucas1p2.samsung.com>
     [not found]                                           ` <6935498c-9788-14e6-844f-f9e8288026dc-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:11                                             ` [PATCHv3 " Andrzej Pietrasiewicz
     [not found]                                               ` <CGME20171005121201eucas1p269da2155c4257777b0c3a5b210c651f8@eucas1p2.samsung.com>
     [not found]                                                 ` <1507205511-23048-1-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:11                                                   ` [PATCHv3 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
     [not found]                                                     ` <1507205511-23048-2-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-09 10:15                                                       ` Kishon Vijay Abraham I
     [not found]                                                         ` <CGME20171009120100eucas1p2400a1ee4a7c70eed37c653de780b715d@eucas1p2.samsung.com>
     [not found]                                                           ` <6de8a17a-745b-0fa2-c39d-cdeb28fc9489-l0cyMroinI0@public.gmane.org>
2017-10-09 12:00                                                             ` [PATCHv4 0/2] dwc3 on XU3 Andrzej Pietrasiewicz
     [not found]                                                               ` <CGME20171009120101eucas1p1c79faf4b39df7f9ff622404a15922875@eucas1p1.samsung.com>
2017-10-09 12:00                                                                 ` [PATCHv4 1/2] drivers: phy: add calibrate method Andrzej Pietrasiewicz
     [not found]                                                               ` <CGME20171009120101eucas1p1066709725b5c6ca66961b85268480702@eucas1p1.samsung.com>
2017-10-09 12:00                                                                 ` [PATCHv4 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
2017-10-25 11:20                                                                   ` Kishon Vijay Abraham I
     [not found]                                                                     ` <fca01b97-eea1-cc6f-9c12-fa8d9e55d980-l0cyMroinI0@public.gmane.org>
2017-10-25 12:46                                                                       ` Felipe Balbi
2017-10-18 12:47                                                               ` [PATCHv4 0/2] dwc3 on XU3 Kishon Vijay Abraham I
2017-10-05 12:11                                                   ` [PATCHv3 2/2] phy: exynos5-usbdrd: Calibrate LOS levels for exynos5420/5800 Andrzej Pietrasiewicz
     [not found]                                                     ` <1507205511-23048-3-git-send-email-andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2017-10-05 12:28                                                       ` Sylwester Nawrocki
2017-09-18 11:19   ` [PATCH 0/2] dwc3 on XU3 and XU4 Anand Moon

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=87vakgmb24.fsf@linux.intel.com \
    --to=balbi-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=andrzej.p-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=b.zolnierkie-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=kgene-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=kishon-l0cyMroinI0@public.gmane.org \
    --cc=krzk-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).