From patchwork Tue Nov 19 23:53:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loc Ho X-Patchwork-Id: 3204471 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 6D30E9F243 for ; Tue, 19 Nov 2013 23:54:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A338C206ED for ; Tue, 19 Nov 2013 23:54:49 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B0CE5206EC for ; Tue, 19 Nov 2013 23:54:48 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Viv7X-0002ak-2m; Tue, 19 Nov 2013 23:54:15 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Viv7M-0006h5-LY; Tue, 19 Nov 2013 23:54:04 +0000 Received: from exprod5og107.obsmtp.com ([64.18.0.184]) by merlin.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Viv7A-0006eB-BU for linux-arm-kernel@lists.infradead.org; Tue, 19 Nov 2013 23:53:53 +0000 Received: from mail-pd0-f181.google.com ([209.85.192.181]) (using TLSv1) by exprod5ob107.postini.com ([64.18.4.12]) with SMTP ID DSNKUov5+oG3GI9YRTyGsC+we8J7G+VyLg4m@postini.com; Tue, 19 Nov 2013 15:53:52 PST Received: by mail-pd0-f181.google.com with SMTP id p10so1160606pdj.26 for ; Tue, 19 Nov 2013 15:53:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Wzk0uAvLZH0rCO8+r8w2aOcZ3Xd3UlqIsWBIZXTJIkY=; b=c480jyWcNfpRtdMQfWbrfHIJm9pbi7qsaSRDxfHbhsG62tr4cjJ5qXvziKDAkYoYeO BtTkJpEbf43sjFFPf/kJM3pdP5tRdEg/OOe96ogJknt7oZGqmzkxfA4T/a8X3t/NEHad 4FQU4hbk3W5JwE7Ua3nl5IP8x+rpB9SLrc707yesJx967PBId6SdeotrOeIHMjD9zBB7 JA9eddx7JwnQJhJiwh6pvJ40d2rHbgtNTovD8sa6eOoGK7jmuxLzrNUslz2Byej868a9 4fLH10fJBM4H7eu8glx9oquzgW+teTzFj6+PViHsmy3Psj377N8KV/Ju/jA/09UWyQmE rM0Q== X-Gm-Message-State: ALoCoQkYIkcDM0Jx1INvSvuXuCxXNVAHTzqBSIQbfd8VjoaskJ+ZlSJqlmvowGiLkIx8sPohqvrHUi4n2MYxULj+zzFbFp31wm+a2+PliIkLbrC6RZcNU5WAU6mbuZxPlhN8UB/ltWigSIGIX0eVf5QscvY1OGJc49CyPI0ZgVeyiGHFhL8shu9AeZzLEntjYzHDW9MhzPpE X-Received: by 10.68.25.229 with SMTP id f5mr13009093pbg.6.1384905210497; Tue, 19 Nov 2013 15:53:30 -0800 (PST) X-Received: by 10.68.25.229 with SMTP id f5mr13009079pbg.6.1384905210420; Tue, 19 Nov 2013 15:53:30 -0800 (PST) Received: from localhost ([198.137.200.11]) by mx.google.com with ESMTPSA id py4sm33204640pbb.33.2013.11.19.15.53.29 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Nov 2013 15:53:29 -0800 (PST) From: Loc Ho To: olof@lixom.net, tj@kernel.org, arnd@arndb.de Subject: [PATCH v2 1/4] PHY: Add function set_speed to generic PHY framework Date: Tue, 19 Nov 2013 16:53:14 -0700 Message-Id: <1384905197-3566-2-git-send-email-lho@apm.com> X-Mailer: git-send-email 1.5.5 In-Reply-To: <1384905197-3566-1-git-send-email-lho@apm.com> References: <1384905197-3566-1-git-send-email-lho@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131119_185352_684621_D6EC4977 X-CRM114-Status: GOOD ( 13.57 ) X-Spam-Score: -4.2 (----) Cc: devicetree@vger.kernel.org, linux-scsi@vger.kernel.org, jcm@redhat.com, linux-ide@vger.kernel.org, Loc Ho , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP PHY: Add function set_speed to generic PHY framework This patch adds function set_speed to the generic PHY framework operation structure. This function can be called to instruct the PHY underlying layer at specified lane to configure for specified speed in hertz. Signed-off-by: Loc Ho --- include/linux/phy/phy.h | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 9351a16..df9b1d1 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -32,6 +32,7 @@ struct phy; * @exit: operation to be performed while exiting * @power_on: powering on the phy * @power_off: powering off the phy + * @set_speed: set operation speed in hz * @owner: the module owner containing the ops */ struct phy_ops { @@ -39,6 +40,7 @@ struct phy_ops { int (*exit)(struct phy *phy); int (*power_on)(struct phy *phy); int (*power_off)(struct phy *phy); + int (*set_speed)(struct phy *phy, int lane, u64 speed); struct module *owner; }; @@ -341,4 +343,24 @@ out: return ret; } +static inline int phy_set_speed(struct phy *phy, int lane, u64 speed) +{ + int ret = -ENOTSUPP; + + mutex_lock(&phy->mutex); + if (phy->ops->set_speed) { + ret = phy->ops->set_speed(phy, lane, speed); + if (ret < 0) { + dev_err(&phy->dev, "phy set speed failed --> %d\n", + ret); + goto out; + } + } + +out: + mutex_unlock(&phy->mutex); + + return ret; +} + #endif /* __DRIVERS_PHY_H */