From patchwork Tue Oct 3 12:59:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 9982799 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 40485602B8 for ; Tue, 3 Oct 2017 13:14:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 305AD27F54 for ; Tue, 3 Oct 2017 13:14:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2520128617; Tue, 3 Oct 2017 13:14:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id DD13727F54 for ; Tue, 3 Oct 2017 13:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=EzuPjha4R4Y9qxRL/qVQRUqj3EnApACxp816me35PCU=; b=r9zaOZdEcvdCk+PvGsPRwzPCm2 kmVyOC0RetqPasFQd9CUVhWFMe9hlkyCpbG46IqUSKMeQMsy4dF2A/x1IRgVYsSgQZ6BXzE0cwCUK j/SJeSeBqdSeuS3DUqiiw1oRpoh497Qkn/Nu/8SjJKykKlB3k10hZEk93LEaS81Cgz5ibwgWkgMNu z7qbOMekt4b2/Nb+B0N6IxXV+3AxzH2RW/ei2WX2ZRThJZWBDSpBs3JsLx/zGc7kCqvA1IPQcX/ZX k/1Ud+NgDvqQUHLl3Bm75b6tB0NhqKxQd4XgnBqcNd501Q3TcD4fvNYVtx+uINtOLQicV3EyZa7IU rqii9eXA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dzN1v-0005pe-3V; Tue, 03 Oct 2017 13:14:35 +0000 Received: from mailout1.w1.samsung.com ([210.118.77.11]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dzMo5-0006CL-5u for linux-arm-kernel@lists.infradead.org; Tue, 03 Oct 2017 13:00:36 +0000 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20171003125946euoutp01d0f6fe8df0b21e1a20f1454c127aedbb~qEOGy7Bcy1440214402euoutp01D; Tue, 3 Oct 2017 12:59:46 +0000 (GMT) Received: from eusmges2.samsung.com (unknown [203.254.199.241]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20171003125946eucas1p1f618ab230481947f049a9ef95994d5fc~qEOGIeb8Z2153121531eucas1p1Z; Tue, 3 Oct 2017 12:59:46 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2.samsung.com (EUCPMTA) with SMTP id F2.AD.12907.1C983D95; Tue, 3 Oct 2017 13:59:45 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352~qEOFgEy1o1801418014eucas1p2M; Tue, 3 Oct 2017 12:59:45 +0000 (GMT) X-AuditID: cbfec7f1-f793a6d00000326b-14-59d389c1f386 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id E4.EE.20118.1C983D95; Tue, 3 Oct 2017 13:59:45 +0100 (BST) Received: from AMDC831.digital.local ([106.116.147.122]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OX90037B03F4NC0@eusync4.samsung.com>; Tue, 03 Oct 2017 13:59:45 +0100 (BST) From: Andrzej Pietrasiewicz To: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org Subject: [PATCHv2 1/2] drivers: phy: add calibrate method Date: Tue, 03 Oct 2017 14:59:37 +0200 Message-id: <1507035578-24945-2-git-send-email-andrzej.p@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1507035578-24945-1-git-send-email-andrzej.p@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsWy7djP87oHOy9HGsydY2Yx62U7i8XGGetZ LY61PWG3mH/kHKtF8+L1bBb9j18zW1x42sNmcf78BnaLTY+vsVrMOL+PyWLRslZmi0NT9zJa rD1yl91i6fWLTBate4+wO/B7rJm3htHj8rWLzB6bVnWyeeyfu4bdY/OSeo++LasYPY7f2M7k 8XmTXABHFJdNSmpOZllqkb5dAlfGjB3rmAq+CVQs/NXK2sB4g7eLkZNDQsBEYv+yuewQtpjE hXvr2boYuTiEBJYyStw49pkdwvnMKPHsx2NmmI7z298zgdhCAssYJWZucoYoamCSaJ2wgBEk wSZgLLH3YAcjSEJEoIVR4v2VbrBRzAJnmSUevjgENkpYwFKi8fs1FhCbRUBV4sS9/2CH8Aq4 SqxpmQ+1Tk7i5LHJrCA2p4CbxLJ1X1kg4o/ZJJob4yFsF4m7x84zQtjCE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BZJk4OKUaGGe0W7x/0LtSv0VeMGnz2Qln0w8cN+DSXb/62kZd2+7T tkaG+nqWup4vmHwdRWvKBcMXJ2g//JMVfuldszBDgb7rOgaVrH/Mp81ri6QTff/MWMn8alOt vatX/9RXU15Imqw1ahF5OiP3sSW/+s+1Fxg+smae0q7jPz5t1YXi476epg59C3leK7EUZyQa ajEXFScCANi4pqheAgAA X-CMS-MailID: 20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352 X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBQaWV0cmFzaWV3aWN6G1NSUE9MLUtlcm5lbCAo?= =?UTF-8?B?VFApG+yCvOyEseyghOyekBtTZW5pb3IgU29mdHdhcmUgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBUb21hc3ogUGlldHJhc2lld2ljehtTUlBPTC1L?= =?UTF-8?B?ZXJuZWwgKFRQKRtTYW1zdW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2Fy?= =?UTF-8?B?ZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-CMS-RootMailID: 20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352 X-RootMTR: 20171003125945eucas1p24d49f5c51ea9acd59a76314158b69352 References: <1507035578-24945-1-git-send-email-andrzej.p@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171003_060017_820422_13EB8A44 X-CRM114-Status: GOOD ( 13.80 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Felipe Balbi , Bartlomiej Zolnierkiewicz , Greg Kroah-Hartman , Russell King , Krzysztof Kozlowski , Kishon Vijay Abraham I , Rob Herring , Kukjin Kim , Andrzej Pietrasiewicz , Marek Szyprowski MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some quirky UDCs (like dwc3 on exynos) need to have heir phys calibrated e.g. for using super speed. Signed-off-by: Andrzej Pietrasiewicz --- drivers/phy/phy-core.c | 14 ++++++++++++++ include/linux/phy/phy.h | 10 ++++++++++ 2 files changed, 24 insertions(+) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index a268f4d..fdf343a 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -372,6 +372,20 @@ int phy_reset(struct phy *phy) } EXPORT_SYMBOL_GPL(phy_reset); +int phy_calibrate(struct phy *phy) +{ + int ret; + + if (!phy || !phy->ops->calibrate) + return 0; + + mutex_lock(&phy->mutex); + ret = phy->ops->calibrate(phy); + mutex_unlock(&phy->mutex); + + return ret; +} + /** * _of_phy_get() - lookup and obtain a reference to a phy by phandle * @np: device_node for which to get the phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index e694d40..87580c8 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -39,6 +39,7 @@ enum phy_mode { * @power_off: powering off the phy * @set_mode: set the mode of the phy * @reset: resetting the phy + * @calibrate: calibrate the phy * @owner: the module owner containing the ops */ struct phy_ops { @@ -48,6 +49,7 @@ struct phy_ops { int (*power_off)(struct phy *phy); int (*set_mode)(struct phy *phy, enum phy_mode mode); int (*reset)(struct phy *phy); + int (*calibrate)(struct phy *phy); struct module *owner; }; @@ -141,6 +143,7 @@ static inline void *phy_get_drvdata(struct phy *phy) int phy_power_off(struct phy *phy); int phy_set_mode(struct phy *phy, enum phy_mode mode); int phy_reset(struct phy *phy); +int phy_calibrate(struct phy *phy); static inline int phy_get_bus_width(struct phy *phy) { return phy->attrs.bus_width; @@ -262,6 +265,13 @@ static inline int phy_reset(struct phy *phy) return -ENOSYS; } +static inline int phy_calibrate(struct phy *phy) +{ + if (!phy) + return 0; + return -ENOSYS; +} + static inline int phy_get_bus_width(struct phy *phy) { return -ENOSYS;