From patchwork Wed Jan 15 07:10:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loc Ho X-Patchwork-Id: 3490401 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 066E29F381 for ; Wed, 15 Jan 2014 07:12:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 384A020123 for ; Wed, 15 Jan 2014 07:12:56 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 48C35200F3 for ; Wed, 15 Jan 2014 07:12:55 +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 1W3Kdn-0003zU-Qg; Wed, 15 Jan 2014 07:11:56 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3Kdb-0004nO-2x; Wed, 15 Jan 2014 07:11:43 +0000 Received: from exprod5og109.obsmtp.com ([64.18.0.188]) by merlin.infradead.org with smtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W3KdL-0004kC-JE for linux-arm-kernel@lists.infradead.org; Wed, 15 Jan 2014 07:11:28 +0000 Received: from mail-pd0-f175.google.com ([209.85.192.175]) (using TLSv1) by exprod5ob109.postini.com ([64.18.4.12]) with SMTP ID DSNKUtY0gqaRG+Wc2YldORnmlOwts0GbiawK@postini.com; Tue, 14 Jan 2014 23:11:27 PST Received: by mail-pd0-f175.google.com with SMTP id r10so735307pdi.34 for ; Tue, 14 Jan 2014 23:10:57 -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=dvb6iezlhJkCpD620F1rVbongxttl2P7qDAXVaDWwvk=; b=QrR6T+nTaHNIOgHU2goTHlOCI58Pu3t4F5MrZ42zeNe4l06IVR/Vbdp/r8gs51zsjZ 0ofPmvgcW4gDdlCdAjwW8AYkpuFH5qylcT+jZ8ZcQMUGnkotMUxsp03ANkF+WZBTWsGa NirdLB24FsNZWIa6QJU2ygRQZQWfAA2ZtEHoT2jZFJX4sZPO4Zn+eY63fFE+b6MnH8FN QpSTXl4fzlaTsPYp+XYFj/acHle3irkuRE7GwCM8dD6Zc8t5SCrrINNoEww73fpcVLU7 7nnMGrhk4zeC2X+xo6UCyaalrAzUDaPrhEpsYOimmgSq0W/M21VRYINau7EXm40qgViX Aofg== X-Gm-Message-State: ALoCoQkVJLwBT4D9kVzYUQMQ3/mwlO6VdP+7YiTctdthC/t5tkqBylaf/zSbpLxWcrUkNXC8eBDACk2PuvXbIiOaNNK1kK+kK+EAG21xHYJfHEAN4Xw3aVq9PZ71ZxN+YG6uH73HM2mcoYELoOU6rur+3+rogYRAv/puMyVMqaR/ANMjnlY6CLz1/AzGPVG2QG7yz9ecXrNj X-Received: by 10.68.183.164 with SMTP id en4mr599337pbc.169.1389769857972; Tue, 14 Jan 2014 23:10:57 -0800 (PST) X-Received: by 10.68.183.164 with SMTP id en4mr599218pbc.169.1389769856741; Tue, 14 Jan 2014 23:10:56 -0800 (PST) Received: from localhost ([198.137.200.11]) by mx.google.com with ESMTPSA id sx8sm7698594pab.5.2014.01.14.23.10.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 14 Jan 2014 23:10:55 -0800 (PST) From: Loc Ho To: olof@lixom.net, tj@kernel.org, arnd@arndb.de Subject: [PATCH v7 1/4] PHY: Add function set_speed to generic PHY framework Date: Wed, 15 Jan 2014 00:10:37 -0700 Message-Id: <1389769840-15469-2-git-send-email-lho@apm.com> X-Mailer: git-send-email 1.5.5 In-Reply-To: <1389769840-15469-1-git-send-email-lho@apm.com> References: <1389769840-15469-1-git-send-email-lho@apm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140115_021127_773109_379DD3CA X-CRM114-Status: GOOD ( 13.83 ) X-Spam-Score: -4.2 (----) Cc: devicetree@vger.kernel.org, linux-scsi@vger.kernel.org, dmilburn@redhat.com, jcm@redhat.com, patches@apm.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.5 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 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 --- drivers/phy/phy-core.c | 21 +++++++++++++++++++++ include/linux/phy/phy.h | 8 ++++++++ 2 files changed, 29 insertions(+), 0 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 03cf8fb..b525e72 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -239,6 +239,27 @@ out: } EXPORT_SYMBOL_GPL(phy_power_off); +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; +} +EXPORT_SYMBOL_GPL(phy_set_speed); + /** * of_phy_get() - lookup and obtain a reference to a phy by phandle * @dev: device that requests this phy diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..ed2b897 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -27,6 +27,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 { @@ -34,6 +35,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; }; @@ -127,6 +129,7 @@ int phy_init(struct phy *phy); int phy_exit(struct phy *phy); int phy_power_on(struct phy *phy); int phy_power_off(struct phy *phy); +int phy_set_speed(struct phy *phy, int lane, u64 speed); struct phy *phy_get(struct device *dev, const char *string); struct phy *devm_phy_get(struct device *dev, const char *string); void phy_put(struct phy *phy); @@ -199,6 +202,11 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline int phy_set_speed(struct phy *phy, int lane, u64 speed) +{ + return -ENOSYS; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS);