From patchwork Thu Dec 12 13:26:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Porter X-Patchwork-Id: 22281 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f70.google.com (mail-qa0-f70.google.com [209.85.216.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id CABBC23FC9 for ; Thu, 12 Dec 2013 13:26:25 +0000 (UTC) Received: by mail-qa0-f70.google.com with SMTP id j5sf3780089qaq.1 for ; Thu, 12 Dec 2013 05:26:25 -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=J9O1IXINM9ePAnzc3FBaLlxNqDaAt7T9r0jbot49emc=; b=FWezlTa6QU4fa0hLugrylIPzi9nrYHvaUeNbO8iDho3BXnncGI6WEgF2xrJNcmI2kh 9DIL1Lcw4lPRbptyBpUF7MDOy0nfsWsC2CwSJbYYCbdj1AIPy4taINoXRBYUsQ+FnIEH phHjcMjV279SJy4/SZCv5xKtKoa+0DBSXzEGAOAfc7sUZREbkOcZ3st650aP4xXprJfB rlwD3LRApjAL37qNvvxUfShM+sMW2zsQ/EkAHQKgbLl6B4SOkedlc3+8ftLeOed6YeHb xJVaLLvH7PSjIv5K+yS5dyuJmoGJdD/6/C4XgGtCN7BWBKu99lpkKHC63eokLenu2MdY Aykw== X-Gm-Message-State: ALoCoQn0e29CAROUKVKWyhOvZcPgm02WPjvnUPxgxuKrkrbn+H9kkgcZC0tvuoh/LphDE9nYGSCv X-Received: by 10.58.213.133 with SMTP id ns5mr2655109vec.30.1386854785407; Thu, 12 Dec 2013 05:26:25 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.83.2 with SMTP id m2ls502364qey.37.gmail; Thu, 12 Dec 2013 05:26:25 -0800 (PST) X-Received: by 10.52.50.177 with SMTP id d17mr3154407vdo.23.1386854785293; Thu, 12 Dec 2013 05:26:25 -0800 (PST) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id c8si7710497vcq.63.2013.12.12.05.26.25 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 05:26:25 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.176 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.176; Received: by mail-vc0-f176.google.com with SMTP id lf12so267514vcb.21 for ; Thu, 12 Dec 2013 05:26:25 -0800 (PST) X-Received: by 10.220.11.7 with SMTP id r7mr3905731vcr.12.1386854785196; Thu, 12 Dec 2013 05:26:25 -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.220.174.196 with SMTP id u4csp354233vcz; Thu, 12 Dec 2013 05:26:24 -0800 (PST) X-Received: by 10.50.118.41 with SMTP id kj9mr8977930igb.9.1386854784491; Thu, 12 Dec 2013 05:26:24 -0800 (PST) Received: from mail-ie0-f171.google.com (mail-ie0-f171.google.com [209.85.223.171]) by mx.google.com with ESMTPS id b7si24194403icq.20.2013.12.12.05.26.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 05:26:24 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.171 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.223.171; Received: by mail-ie0-f171.google.com with SMTP id ar20so535969iec.2 for ; Thu, 12 Dec 2013 05:26:20 -0800 (PST) X-Received: by 10.43.127.4 with SMTP id gy4mr5682899icc.61.1386854779983; Thu, 12 Dec 2013 05:26:19 -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 l7sm14983106igx.2.2013.12.12.05.26.17 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 05:26:18 -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 , Russell King , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches Subject: [PATCH v5 1/9] phy: add phy_get_bus_width()/phy_set_bus_width() calls Date: Thu, 12 Dec 2013 08:26:02 -0500 Message-Id: <1386854770-2173-2-git-send-email-mporter@linaro.org> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1386854770-2173-1-git-send-email-mporter@linaro.org> References: <1386854770-2173-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.176 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);