From: gregory.clement@free-electrons.com (Gregory CLEMENT)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v3 4/6] phy: add support for USB cluster on the Armada 375 SoC
Date: Thu, 13 Nov 2014 12:46:45 +0100 [thread overview]
Message-ID: <54649A25.6050304@free-electrons.com> (raw)
In-Reply-To: <54644C92.8000900@ti.com>
Hi,
[...]
>> +
>> +static struct armada375_cluster_phy usb_cluster_phy;
>
> don't use global variables.
>> +
>> +static int armada375_usb_phy_init(struct phy *phy)
>> +{
>> + struct armada375_cluster_phy *cluster_phy = phy_get_drvdata(phy);
>> + u32 reg;
>> +
>> + reg = readl(cluster_phy->reg);
>> + if (cluster_phy->use_usb3)
>> + reg |= USB2_PHY_CONFIG_DISABLE;
>> + else
>> + reg &= ~USB2_PHY_CONFIG_DISABLE;
>> + writel(reg, cluster_phy->reg);
>> +
>> + return 0;
>> +}
>> +
>> +static struct phy_ops armada375_usb_phy_ops = {
>> + .init = armada375_usb_phy_init,
>> + .owner = THIS_MODULE,
>> +};
>> +
>> +/*
>> + * Only one controller can use this PHY. We shouldn't have the case
>> + * when two controllers want to use this PHY. But if this case occurs
>> + * then we provide a phy to the first one and return an error for the
>> + * next one. This error has also to be an error returned by
>> + * devm_phy_optional_get() so different from ENODEV for USB2. In the
>> + * USB3 case it still optional and we use ENODEV.
>> + */
>> +static struct phy *armada375_usb_phy_xlate(struct device *dev,
>> + struct of_phandle_args *args)
>> +{
>> +
>> + /*
>> + * Either the phy had never been requested and then the first usb
>> + * claiming it can get it, or it had already been requested in
>> + * this case, we only allow to use it with the same configuration.
>> + */
>
> You can dynamically create usb_cluster_phy in probe and then invoke
> platform_set_drvdata by passing *usb_cluster_phy. Then you can invoke
> platform_get_drvdata here to get *usb_cluster_phy.
>
> While fixing this also add yourself as Maintainer of this file.
I am taking into account your comment and I am going to send a new version soon.
Thanks,
Gregory
>
> Thanks
> Kishon
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>
Cc: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Sebastian Hesselbarth
<sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Thomas Petazzoni
<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Ezequiel Garcia
<ezequiel.garcia-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Lior Amsalem <alior-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Tawfik Bayouk <tawfik-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Nadav Haklai <nadavh-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Grant Likely
<grant.likely-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3 4/6] phy: add support for USB cluster on the Armada 375 SoC
Date: Thu, 13 Nov 2014 12:46:45 +0100 [thread overview]
Message-ID: <54649A25.6050304@free-electrons.com> (raw)
In-Reply-To: <54644C92.8000900-l0cyMroinI0@public.gmane.org>
Hi,
[...]
>> +
>> +static struct armada375_cluster_phy usb_cluster_phy;
>
> don't use global variables.
>> +
>> +static int armada375_usb_phy_init(struct phy *phy)
>> +{
>> + struct armada375_cluster_phy *cluster_phy = phy_get_drvdata(phy);
>> + u32 reg;
>> +
>> + reg = readl(cluster_phy->reg);
>> + if (cluster_phy->use_usb3)
>> + reg |= USB2_PHY_CONFIG_DISABLE;
>> + else
>> + reg &= ~USB2_PHY_CONFIG_DISABLE;
>> + writel(reg, cluster_phy->reg);
>> +
>> + return 0;
>> +}
>> +
>> +static struct phy_ops armada375_usb_phy_ops = {
>> + .init = armada375_usb_phy_init,
>> + .owner = THIS_MODULE,
>> +};
>> +
>> +/*
>> + * Only one controller can use this PHY. We shouldn't have the case
>> + * when two controllers want to use this PHY. But if this case occurs
>> + * then we provide a phy to the first one and return an error for the
>> + * next one. This error has also to be an error returned by
>> + * devm_phy_optional_get() so different from ENODEV for USB2. In the
>> + * USB3 case it still optional and we use ENODEV.
>> + */
>> +static struct phy *armada375_usb_phy_xlate(struct device *dev,
>> + struct of_phandle_args *args)
>> +{
>> +
>> + /*
>> + * Either the phy had never been requested and then the first usb
>> + * claiming it can get it, or it had already been requested in
>> + * this case, we only allow to use it with the same configuration.
>> + */
>
> You can dynamically create usb_cluster_phy in probe and then invoke
> platform_set_drvdata by passing *usb_cluster_phy. Then you can invoke
> platform_get_drvdata here to get *usb_cluster_phy.
>
> While fixing this also add yourself as Maintainer of this file.
I am taking into account your comment and I am going to send a new version soon.
Thanks,
Gregory
>
> Thanks
> Kishon
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Gregory CLEMENT <gregory.clement@free-electrons.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Jason Cooper <jason@lakedaemon.net>, Andrew Lunn <andrew@lunn.ch>,
Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
Ezequiel Garcia <ezequiel.garcia@free-electrons.com>,
linux-arm-kernel@lists.infradead.org,
Lior Amsalem <alior@marvell.com>,
Tawfik Bayouk <tawfik@marvell.com>,
Nadav Haklai <nadavh@marvell.com>,
Mark Rutland <mark.rutland@arm.com>,
devicetree@vger.kernel.org,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 4/6] phy: add support for USB cluster on the Armada 375 SoC
Date: Thu, 13 Nov 2014 12:46:45 +0100 [thread overview]
Message-ID: <54649A25.6050304@free-electrons.com> (raw)
In-Reply-To: <54644C92.8000900@ti.com>
Hi,
[...]
>> +
>> +static struct armada375_cluster_phy usb_cluster_phy;
>
> don't use global variables.
>> +
>> +static int armada375_usb_phy_init(struct phy *phy)
>> +{
>> + struct armada375_cluster_phy *cluster_phy = phy_get_drvdata(phy);
>> + u32 reg;
>> +
>> + reg = readl(cluster_phy->reg);
>> + if (cluster_phy->use_usb3)
>> + reg |= USB2_PHY_CONFIG_DISABLE;
>> + else
>> + reg &= ~USB2_PHY_CONFIG_DISABLE;
>> + writel(reg, cluster_phy->reg);
>> +
>> + return 0;
>> +}
>> +
>> +static struct phy_ops armada375_usb_phy_ops = {
>> + .init = armada375_usb_phy_init,
>> + .owner = THIS_MODULE,
>> +};
>> +
>> +/*
>> + * Only one controller can use this PHY. We shouldn't have the case
>> + * when two controllers want to use this PHY. But if this case occurs
>> + * then we provide a phy to the first one and return an error for the
>> + * next one. This error has also to be an error returned by
>> + * devm_phy_optional_get() so different from ENODEV for USB2. In the
>> + * USB3 case it still optional and we use ENODEV.
>> + */
>> +static struct phy *armada375_usb_phy_xlate(struct device *dev,
>> + struct of_phandle_args *args)
>> +{
>> +
>> + /*
>> + * Either the phy had never been requested and then the first usb
>> + * claiming it can get it, or it had already been requested in
>> + * this case, we only allow to use it with the same configuration.
>> + */
>
> You can dynamically create usb_cluster_phy in probe and then invoke
> platform_set_drvdata by passing *usb_cluster_phy. Then you can invoke
> platform_get_drvdata here to get *usb_cluster_phy.
>
> While fixing this also add yourself as Maintainer of this file.
I am taking into account your comment and I am going to send a new version soon.
Thanks,
Gregory
>
> Thanks
> Kishon
>
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
next prev parent reply other threads:[~2014-11-13 11:46 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 9:57 [PATCH v3 0/6] Add support for USB cluster(PHY muxer) on the Armada 375 Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 1/6] phy: Use PTR_ERR_OR_ZERO to fix warning raised by coccinelle Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 2/6] Phy: DT binding documentation for Marvell MVEBU SATA phy Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 3/6] Phy: DT binding documentation for the Armada 375 USB cluster binding Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 4/6] phy: add support for USB cluster on the Armada 375 SoC Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-13 6:15 ` Kishon Vijay Abraham I
2014-11-13 6:15 ` Kishon Vijay Abraham I
2014-11-13 6:15 ` Kishon Vijay Abraham I
2014-11-13 11:46 ` Gregory CLEMENT [this message]
2014-11-13 11:46 ` Gregory CLEMENT
2014-11-13 11:46 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 5/6] ARM: mvebu: add Device Tree description of USB cluster controller on Armada 375 Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
2014-11-12 9:57 ` [PATCH v3 6/6] ARM: mvebu: add PHY support to the dts for the USB controllers " Gregory CLEMENT
2014-11-12 9:57 ` Gregory CLEMENT
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54649A25.6050304@free-electrons.com \
--to=gregory.clement@free-electrons.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.