From patchwork Thu Dec 12 11:18:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 3331231 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 BF5A89F37A for ; Thu, 12 Dec 2013 11:19:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F372207E9 for ; Thu, 12 Dec 2013 11:19:24 +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 2FE29207CE for ; Thu, 12 Dec 2013 11:19:23 +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 1Vr4IZ-0007IT-G4; Thu, 12 Dec 2013 11:19:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr4IW-00009q-KC; Thu, 12 Dec 2013 11:19:16 +0000 Received: from mail-ig0-f175.google.com ([209.85.213.175]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Vr4IS-000088-Gk for linux-arm-kernel@lists.infradead.org; Thu, 12 Dec 2013 11:19:13 +0000 Received: by mail-ig0-f175.google.com with SMTP id j1so5030870iga.2 for ; Thu, 12 Dec 2013 03:18:51 -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=WIp9zoOyvogg7tD84ADXYmwvgSl80GgLPNgZwy2OsxU=; b=YV3EAJGJFemwg+p+cUBeeSPsnpgTGWUYY1KSGoNJJgt6Uqs9QKTxod1U1dwYSrM8+K G0xzRzFNp8dJG4hLDPN5+W7/8neEL+AH/RbCIDTc4O9kKw1SB/7KLOl+MmFssqkiCkWb SVjp1/J0ZdlwK80xMkkDvfX2gCL7no/3NW3ficvNpoAwFbPTVCU3ZX/CWkh18v893gmU E+GjGoy1ZRictxcpjwMoazOybKTjXbG09/fganlmVwB1Lx9iM93taITETKECyN1SEp5V LwfShJS7TUV+nPlH6kcoByBDP5JNBvicbZ2IfFg0MNWcQfKiODyFeCreLA5Dlh6zRfQO gkGA== X-Gm-Message-State: ALoCoQm+7B1DBv3T3i3/Gl9juGLXvDf3v92lL/U1XcXb4UgUMaq0a9kF76l6+rgbv/p4atyFDQlT X-Received: by 10.50.79.168 with SMTP id k8mr30667746igx.18.1386847130938; Thu, 12 Dec 2013 03:18:50 -0800 (PST) Received: from beef.ohporter.com (cpe-98-27-254-98.neo.res.rr.com. [98.27.254.98]) by mx.google.com with ESMTPSA id u1sm14511537ige.1.2013.12.12.03.18.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:18:50 -0800 (PST) From: Matt Porter To: Felipe Balbi , Greg Kroah-Hartman , Kishon Vijay Abraham I , Rob Herring , Pawel Moll , Mark Rutland , Kumar Gala , Ian Campbell , Christian Daudt , Paul Zimmerman Subject: [PATCH v4 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls Date: Thu, 12 Dec 2013 06:18:29 -0500 Message-Id: <1386847117-21240-2-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1386847117-21240-1-git-send-email-mporter@linaro.org> References: <1386847117-21240-1-git-send-email-mporter@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131212_061912_617841_1A51E513 X-CRM114-Status: GOOD ( 12.00 ) X-Spam-Score: -2.6 (--) Cc: Devicetree List , Kamil Debski , Linaro Patches , Tomasz Figa , Linux USB List , Linux Kernel Mailing List , Kyungmin Park , Linux ARM Kernel List 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.2 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 adds a pair of APIs that allows the generic PHY subsystem to provide information on the PHY bus width. The PHY provider driver may use phy_set_bus_width() to set the bus width that the PHY supports. The controller driver may then use phy_get_bus_width() to fetch the PHY bus width in order to properly configure the controller. Signed-off-by: Matt Porter --- include/linux/phy/phy.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index 6d72269..a0dcf2d 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -38,6 +38,14 @@ struct phy_ops { }; /** + * struct phy_attrs - represents phy attributes + * @bus_width: Data path width implemented by PHY + */ +struct phy_attrs { + u32 bus_width; +}; + +/** * struct phy - represents the phy device * @dev: phy device * @id: id of the phy device @@ -46,6 +54,7 @@ struct phy_ops { * @mutex: mutex to protect phy_ops * @init_count: used to protect when the PHY is used by multiple consumers * @power_count: used to protect when the PHY is used by multiple consumers + * @phy_attrs: used to specify PHY specific attributes */ struct phy { struct device dev; @@ -55,6 +64,7 @@ struct phy { struct mutex mutex; int init_count; int power_count; + struct phy_attrs attrs; }; /** @@ -127,6 +137,14 @@ 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); +static inline u32 phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, u32 bus_width) +{ + phy->attrs.bus_width = bus_width; +} 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 +217,16 @@ static inline int phy_power_off(struct phy *phy) return -ENOSYS; } +static inline u32 phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, u32 bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS);