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: 22270 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f69.google.com (mail-oa0-f69.google.com [209.85.219.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9C59C23FE0 for ; Thu, 12 Dec 2013 11:18:52 +0000 (UTC) Received: by mail-oa0-f69.google.com with SMTP id h16sf963743oag.0 for ; Thu, 12 Dec 2013 03:18:52 -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=WIp9zoOyvogg7tD84ADXYmwvgSl80GgLPNgZwy2OsxU=; b=dv0Nasfv+FJ9tiSwkYNGsi0Oo/7FrcPznWIjyboI6qKA3J6QEEsvF2CySGryQset+A JcjArzYnaC8atNY+UL5/hTkO69P0vUFApD6XaeqFvbFkNiRbev5lBYZH6nw3Gbe+k8Ms CsXIljhODcAFf437lDK00WHZHp+3/DORPg5+bbFWX4L0c7UOxsAnBO534BpEsFThzO6V cQT9DcP9Ok6ltLjNRktIiddiCeciojgjj+WtFBrGjg8a1nxKyHIWabMzbD6MMriI6bxJ 4sFRf6fTBtME91VnRCIXsE3r5aVEJcl57LoEA/wMeZPWgeL8OwZGH4+PL3CIjalhZKoW tX0w== X-Gm-Message-State: ALoCoQnH3gzx3Ir2Ll68nv4Ok4jZ2Y9zXRjM5S2bVKDD5m0RR7wKWB2MV1WFs4sVtex8u4pY0/mA X-Received: by 10.50.164.198 with SMTP id ys6mr12613277igb.5.1386847132201; Thu, 12 Dec 2013 03:18:52 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.47.9 with SMTP id z9ls434285qem.79.gmail; Thu, 12 Dec 2013 03:18:52 -0800 (PST) X-Received: by 10.58.146.71 with SMTP id ta7mr3294952veb.23.1386847132083; Thu, 12 Dec 2013 03:18:52 -0800 (PST) Received: from mail-vb0-f47.google.com (mail-vb0-f47.google.com [209.85.212.47]) by mx.google.com with ESMTPS id w7si7589513vcr.92.2013.12.12.03.18.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:18:52 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.47 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.47; Received: by mail-vb0-f47.google.com with SMTP id q12so166664vbe.6 for ; Thu, 12 Dec 2013 03:18:52 -0800 (PST) X-Received: by 10.221.19.5 with SMTP id qi5mr3269991vcb.15.1386847132004; Thu, 12 Dec 2013 03:18:52 -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 u4csp345862vcz; Thu, 12 Dec 2013 03:18:51 -0800 (PST) X-Received: by 10.43.172.4 with SMTP id nw4mr5697338icc.25.1386847131246; Thu, 12 Dec 2013 03:18:51 -0800 (PST) Received: from mail-ie0-f177.google.com (mail-ie0-f177.google.com [209.85.223.177]) by mx.google.com with ESMTPS id z7si10910016igl.59.2013.12.12.03.18.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 12 Dec 2013 03:18:51 -0800 (PST) Received-SPF: neutral (google.com: 209.85.223.177 is neither permitted nor denied by best guess record for domain of mporter@linaro.org) client-ip=209.85.223.177; Received: by mail-ie0-f177.google.com with SMTP id tp5so322704ieb.36 for ; Thu, 12 Dec 2013 03:18:51 -0800 (PST) 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 Cc: Tomasz Figa , Kamil Debski , Kyungmin Park , Linux USB List , Linux ARM Kernel List , Linux Kernel Mailing List , Devicetree List , Linaro Patches 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-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.212.47 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 --- 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);