From patchwork Tue Dec 17 19:42:28 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 22611 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f199.google.com (mail-ve0-f199.google.com [209.85.128.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9B3C524005 for ; Tue, 17 Dec 2013 19:42:48 +0000 (UTC) Received: by mail-ve0-f199.google.com with SMTP id c14sf12940325vea.2 for ; Tue, 17 Dec 2013 11:42:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=uQrf3NX8KcejTob99uM0eMynfsTPjw+sR7E8FT7Wk70=; b=BzbgKUiE79EFJIYo0uo3PPuzAPe6i94cg5OFRG70YaOwchcBcQr1Ks9Hb965PiOnOw uLQ/wHaq7qtO4FvM5VSixdyENVbMAJ+NPSy93HNgmN7Npy5uegWxRXB2eTcJtd2gfxrV R4gLfshftghfhd9Okg1bNbVK3XV8nvYG1Jq9pZh3ShNYgEE5lezvUpo7udgHXCg+wwfi eW16Dc3ZDq6S6Qog72PSltWxz2NvS/YOMLjtDFMTsEEN/nvAVDz0Ig/KvsKUma3FD2K0 JnBlbmJT8j6rZ6UK26Xm7U8XmYMw/xyC1Uu/rE2PlmhPxCo2QHrJP6OnaRkBc5PCFANZ srfA== X-Gm-Message-State: ALoCoQnAjhBO6Gt9ykAM+oGo5wm8SL/TM+IOMWYkynQkiVB0hnpjefc/HyJN+jqvezseOPPvkF9w X-Received: by 10.236.133.161 with SMTP id q21mr7435944yhi.18.1387309367672; Tue, 17 Dec 2013 11:42:47 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.25.42 with SMTP id z10ls2473073qef.63.gmail; Tue, 17 Dec 2013 11:42:47 -0800 (PST) X-Received: by 10.221.18.70 with SMTP id qf6mr5491271vcb.37.1387309367559; Tue, 17 Dec 2013 11:42:47 -0800 (PST) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id gs2si5121377vdc.148.2013.12.17.11.42.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:42:47 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id ie18so4441999vcb.38 for ; Tue, 17 Dec 2013 11:42:47 -0800 (PST) X-Received: by 10.52.0.81 with SMTP id 17mr1680391vdc.50.1387309367452; Tue, 17 Dec 2013 11:42:47 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp191014ved; Tue, 17 Dec 2013 11:42:46 -0800 (PST) X-Received: by 10.50.56.38 with SMTP id x6mr3536971igp.31.1387309366327; Tue, 17 Dec 2013 11:42:46 -0800 (PST) Received: from mail-ie0-f175.google.com (mail-ie0-f175.google.com [209.85.223.175]) by mx.google.com with ESMTPS id w3si15626453igk.35.2013.12.17.11.42.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:42:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.175 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.223.175; Received: by mail-ie0-f175.google.com with SMTP id x13so8711775ief.6 for ; Tue, 17 Dec 2013 11:42:45 -0800 (PST) X-Received: by 10.50.109.132 with SMTP id hs4mr4870784igb.34.1387309365800; Tue, 17 Dec 2013 11:42:45 -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 v2sm23254399igz.3.2013.12.17.11.42.43 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Dec 2013 11:42:45 -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 Cc: Tomasz Figa , Kamil Debski , Kyungmin Park , Dinh Nguyen , Russell King , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches Subject: [PATCH v7 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls Date: Tue, 17 Dec 2013 14:42:28 -0500 Message-Id: <1387309356-17195-2-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1387309356-17195-1-git-send-email-mporter@linaro.org> References: <1387309356-17195-1-git-send-email-mporter@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: mporter@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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 Acked-by: Kishon Vijay Abraham I --- 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..e273e5a 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 int phy_get_bus_width(struct phy *phy) +{ + return phy->attrs.bus_width; +} +static inline void phy_set_bus_width(struct phy *phy, int 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 int phy_get_bus_width(struct phy *phy) +{ + return -ENOSYS; +} + +static inline void phy_set_bus_width(struct phy *phy, int bus_width) +{ + return; +} + static inline struct phy *phy_get(struct device *dev, const char *string) { return ERR_PTR(-ENOSYS);