Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3952507ybl; Mon, 26 Aug 2019 03:11:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqxJtz9InU9YBocouXeqQwHFwa49nXKpKk07UDt8mr5/f1I1R2KdH+FamX64qwzMRRghNYb+ X-Received: by 2002:a17:902:1a4:: with SMTP id b33mr2634059plb.141.1566814279768; Mon, 26 Aug 2019 03:11:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566814279; cv=none; d=google.com; s=arc-20160816; b=A0HnTl4bc3Q5Q8tVVT6tz2gOnrivPmD0bNCns1+9Awp9KCWSp2GmLKKObWO1r+f8EJ 9LxCaOnur5dQsEl8645RC546wLMvd7rpDgjzabF4LxIClwx31Dthc1NgIX1MCoDCcoJY TNCKZdcwKOTW3t5Vk8GrWO1ncuydC4x2Wug+Ia9pwSSDwgBUcUSNcyZd5uIuANZryoBy XKSdQH4+n9TuN/amNBqrmy96sR95Vy5kXuzWQUX+Dvh2DHLayUzYNtY9Fwv+O9la6abk wrGCSICEx7hMS9z9TSqEIEMHEHIpvL+Z3eBhMQuEeMLBfFYb5RiJv1vofgWeQF+Nq5nS mHzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=4/G5wg4DJNiOKBA319u2NGoaV2LPWGLsqRRCL6/5HbQ=; b=viGVglT7ezRrjcLCa2YZgoaXPlfVxvuEDhWWiGu0fvUlXFwoWpiLwpY90e0fbbkDG6 FV4fmG4kNQnWK66UwVz43YkAZ7mtZaOLQIaKp8OiBV6b4hEX84BR+sMX4wgiBEqDW9a5 af7yz4WlVtJlo09OqYoc9aHAc2qmLEy/LS0gu65YF6vxgA0/qXbwGQSEGtY9PA39zY9A RGIc+8FZyS+pETCtD90+sPsk4xrhCwmunrNj2a6ZUijGbHdilagjXsN6ypO4EyaJWQ0y Af+JS0QBuwmm60Ew/R/Ruz5q8FLL5tDZcqdJ48+MY3kyPR7jfLY/ecGOts0CiZvbfjD6 Dhzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QvjxXF7z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si8568076pgg.155.2019.08.26.03.11.02; Mon, 26 Aug 2019 03:11:19 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=QvjxXF7z; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730287AbfHZIzl (ORCPT + 99 others); Mon, 26 Aug 2019 04:55:41 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46312 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730134AbfHZIzj (ORCPT ); Mon, 26 Aug 2019 04:55:39 -0400 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20190826085537euoutp013a815b2874aaad24efd0f10936c22a53~_bSesIOEy1606616066euoutp01k for ; Mon, 26 Aug 2019 08:55:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20190826085537euoutp013a815b2874aaad24efd0f10936c22a53~_bSesIOEy1606616066euoutp01k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1566809737; bh=4/G5wg4DJNiOKBA319u2NGoaV2LPWGLsqRRCL6/5HbQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=QvjxXF7zVrmfXunVZqkZ4ls/9lxHpgBFLiopFUbjZzdEcpgvUurcbFNEbEjxmWwTA mK/MtritHyvmnE3JAAd85YS4XiqvZJVtNQ2lC/VtDX5X5PqyOUNTVKZAon/H0mcKha 3D2jx8p2t6jZOpNk8ZBMVbKd3Ctz+DTkHbpw5yWo= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20190826085536eucas1p1943cfcfb3497665cba5f208d711d68db~_bSd0SaSu2548625486eucas1p15; Mon, 26 Aug 2019 08:55:36 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id BF.79.04374.88E936D5; Mon, 26 Aug 2019 09:55:36 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190826085535eucas1p290033f348e272069bffd17dbad137cfe~_bSdA_5zZ0746807468eucas1p2b; Mon, 26 Aug 2019 08:55:35 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20190826085535eusmtrp2c82f1e0dd63676a43fb028d6db854908~_bScy0dBl3154031540eusmtrp2F; Mon, 26 Aug 2019 08:55:35 +0000 (GMT) X-AuditID: cbfec7f5-4ddff70000001116-14-5d639e88d97b Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 9C.E7.04117.78E936D5; Mon, 26 Aug 2019 09:55:35 +0100 (BST) Received: from [106.120.50.63] (unknown [106.120.50.63]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20190826085534eusmtip287a9a55fd9201dbd54a99efc6132d4d9~_bScSNjKf2034120341eusmtip2V; Mon, 26 Aug 2019 08:55:34 +0000 (GMT) Subject: Re: [PATCH v2 1/2 RESEND] usb: core: phy: add support for PHY calibration To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Martin Blumenstingl , Mathias Nyman , Felipe Balbi , Bartlomiej Zolnierkiewicz , Krzysztof Kozlowski , Jochen Sprickerhof , Anand Moon From: Marek Szyprowski Message-ID: Date: Mon, 26 Aug 2019 10:55:33 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190808094128.27213-2-m.szyprowski@samsung.com> Content-Transfer-Encoding: 7bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA02SbUhTYRTHe3bv7r1a0+tUPJkUDFQqX1pJ3LTMwmLUh/rQlyzJq17U1Cmb 07Qvli/NISa+lK6a4csUy7clpmKLNtDMcr4QmWSaOElxIWhCoZbbxfLb73+e/+F/zuGhMLFF 6E0lyTM4hZxNkRDOeFf/r+FAtS4u+kj3RzHTUdUmZPoL50gmr66NYBo2viLGYmknmfHexwRT ZTEKmFp9Aca0dkySTH/tIM7kGSqEEbtlPdopUmYtLSdldX0LApmhuYiQvX7ynJSVdDYjWXvn Ji5bMey/TEU5n4znUpIyOUVweIxz4otPZiJ91PuW2jSD56IlTw2iKKBDoO/OOQ1ypsR0E4KN od9CXqwiGNZOC3ixgmC9vBjTICdHx8KrbVcjgtXqeZwXNgRmYxeyu9zpK/Bswkra2YOOgPqG L4TdhNElGHS+XXKYCFoKGpuGsLOIDod8m8URgdO+MLZhdDR70tehZ4mPFtFuMFg9h9vZacs/ 22AW2hmjD8BL22OMZy+YnKtxzA30LAnT3cs4P3ckWHP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CjAwajEw5tQmhwrxJpYVlyZe4hRgoNZSYQ3Rz8xVog3JbGyKrUoP76o NCe1+BCjKdBzE5mlRJPzgaklryTe0NTQ3MLS0NzY3NjMQkmct0PgYIyQQHpiSWp2ampBahFM HxMHp1QD48L/mfLVgTtm6rpHyXKJB2cUuFxL2ZzREOjrNmuV65vDapYN+Zxtm6f4HoqVK/xp tfrh0t0r36vqvlsaUZryjvUoi7r5FvYvN29uffRPlcPq9XO7qPpoiQpuV+k6f+lffHMuXuXx f6+W8OYvX07lr9U9e5YxVXw9fnajgNX87WE5ntHX3l5tV2Ipzkg01GIuKk4EAKvISLj1AgAA X-CMS-MailID: 20190826085535eucas1p290033f348e272069bffd17dbad137cfe X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190808094146eucas1p2a5a88ce5e7a87d47c4bcececab4df9a5 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190808094146eucas1p2a5a88ce5e7a87d47c4bcececab4df9a5 References: <20190808094128.27213-1-m.szyprowski@samsung.com> <20190808094128.27213-2-m.szyprowski@samsung.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Greg On 2019-08-08 11:41, Marek Szyprowski wrote: > Some PHYs (for example Exynos5 USB3.0 DRD PHY) require calibration to be > done after every USB HCD reset. Generic PHY framework has been already > extended with phy_calibrate() function in commit 36914111e682 ("drivers: > phy: add calibrate method"). This patch adds support for it to generic > PHY handling code in USB HCD core. > > Signed-off-by: Marek Szyprowski > Tested-by: Anand Moon > Tested-by: Jochen Sprickerhof Greg: any chance to give it this a try in -next? If not, maybe You can point someone whose review will help? > --- > drivers/usb/core/hcd.c | 7 +++++++ > drivers/usb/core/phy.c | 21 +++++++++++++++++++++ > drivers/usb/core/phy.h | 1 + > 3 files changed, 29 insertions(+) > > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c > index 88533938ce19..b89936c1df23 100644 > --- a/drivers/usb/core/hcd.c > +++ b/drivers/usb/core/hcd.c > @@ -2291,6 +2291,9 @@ int hcd_bus_resume(struct usb_device *rhdev, pm_message_t msg) > hcd->state = HC_STATE_RESUMING; > status = hcd->driver->bus_resume(hcd); > clear_bit(HCD_FLAG_WAKEUP_PENDING, &hcd->flags); > + if (status == 0) > + status = usb_phy_roothub_calibrate(hcd->phy_roothub); > + > if (status == 0) { > struct usb_device *udev; > int port1; > @@ -2864,6 +2867,10 @@ int usb_add_hcd(struct usb_hcd *hcd, > } > hcd->rh_pollable = 1; > > + retval = usb_phy_roothub_calibrate(hcd->phy_roothub); > + if (retval) > + goto err_hcd_driver_setup; > + > /* NOTE: root hub and controller capabilities may not be the same */ > if (device_can_wakeup(hcd->self.controller) > && device_can_wakeup(&hcd->self.root_hub->dev)) > diff --git a/drivers/usb/core/phy.c b/drivers/usb/core/phy.c > index 7580493b867a..fb1588e7c282 100644 > --- a/drivers/usb/core/phy.c > +++ b/drivers/usb/core/phy.c > @@ -151,6 +151,27 @@ int usb_phy_roothub_set_mode(struct usb_phy_roothub *phy_roothub, > } > EXPORT_SYMBOL_GPL(usb_phy_roothub_set_mode); > > +int usb_phy_roothub_calibrate(struct usb_phy_roothub *phy_roothub) > +{ > + struct usb_phy_roothub *roothub_entry; > + struct list_head *head; > + int err; > + > + if (!phy_roothub) > + return 0; > + > + head = &phy_roothub->list; > + > + list_for_each_entry(roothub_entry, head, list) { > + err = phy_calibrate(roothub_entry->phy); > + if (err) > + return err; > + } > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(usb_phy_roothub_calibrate); > + > int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub) > { > struct usb_phy_roothub *roothub_entry; > diff --git a/drivers/usb/core/phy.h b/drivers/usb/core/phy.h > index dad564e2d2d4..20a267cd986b 100644 > --- a/drivers/usb/core/phy.h > +++ b/drivers/usb/core/phy.h > @@ -18,6 +18,7 @@ int usb_phy_roothub_exit(struct usb_phy_roothub *phy_roothub); > > int usb_phy_roothub_set_mode(struct usb_phy_roothub *phy_roothub, > enum phy_mode mode); > +int usb_phy_roothub_calibrate(struct usb_phy_roothub *phy_roothub); > int usb_phy_roothub_power_on(struct usb_phy_roothub *phy_roothub); > void usb_phy_roothub_power_off(struct usb_phy_roothub *phy_roothub); > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland