From: "Antoine Ténart" <antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: "Antoine Ténart"
<antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
kishon-l0cyMroinI0@public.gmane.org,
alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
zmxu-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"Hans de Goede"
<hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v9 3/7] ata: libahci: allow to use multiple PHYs
Date: Tue, 8 Jul 2014 19:03:53 +0200 [thread overview]
Message-ID: <20140708170353.GA16148@kwain> (raw)
In-Reply-To: <20140708134000.GC4979-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
Hello,
On Tue, Jul 08, 2014 at 09:40:00AM -0400, Tejun Heo wrote:
> (Cc'ing Hans.)
>
> On Mon, Jul 07, 2014 at 12:16:09PM +0200, Antoine Ténart wrote:
> > @@ -482,6 +482,13 @@ void ahci_save_initial_config(struct device *dev,
> > port_map &= mask_port_map;
> > }
> >
> > + /*
> > + * If port_map was filled automatically when finding port sub-nodes,
> > + * make sure we get the right set here.
> > + */
> > + if (hpriv->port_map)
> > + port_map &= hpriv->port_map;
> > +
>
> So, hpriv->port is both input and output? This is messy and can lead
> to confusing failures and there now are multiple ways to modify
> port_map. If carrying this information through ahci_host_priv is
> necessary, let's remove the direct params and introduce new input
> fields to the struct.
We just use hpriv->port_map to check port_map is valid and describes
available ports there.
hpriv->port_map is filed by the generic ahci_platform_get_resources()
function when using the new bindings and not by the drivers. port_map is
the input from the drivers.
>
> > /**
> > + * ahci_platform_enable_phys - Enable PHYs
> > + * @hpriv: host private area to store config values
> > + *
> > + * This function enables all the PHYs found in hpriv->phys, if any.
> > + * If a PHY fails to be enabled, it disables all the PHYs already
> > + * enabled in reverse order and returns an error.
> > + *
> > + * RETURNS:
> > + * 0 on success otherwise a negative error code
> > + */
> > +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
> > +{
> > + int i, rc = 0;
> > +
> > + for (i = 0; i < hpriv->nphys; i++) {
> > + rc = phy_init(hpriv->phys[i]);
> > + if (rc)
> > + goto disable_phys;
> > +
> > + rc = phy_power_on(hpriv->phys[i]);
> > + if (rc) {
> > + phy_exit(hpriv->phys[i]);
> > + goto disable_phys;
> > + }
> > + }
> > +
> > + return 0;
> > +
> > +disable_phys:
> > + while (--i >= 0) {
> > + phy_power_off(hpriv->phys[i]);
> > + phy_exit(hpriv->phys[i]);
> > + }
> > + return rc;
> > +}
> > +EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
>
> Do we need to make hpriv->phys[] dynamically allocated? We already
> have hpriv->clks[AHCI_MAX_CLKS] and it's unlikely that we're gonna
> need more than several phys per host. Let's go with a simpler fixed
> array.
>
Well, a had a review a week ago about in the PHY driver saying I should
avoid using fixed sized arrays... And it was in a driver were we know
the maximum number of PHY available.
I think in this case were the number of PHYs depends on the h/w, we should
use a dynamically allocated array.
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
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: antoine.tenart@free-electrons.com (Antoine Ténart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v9 3/7] ata: libahci: allow to use multiple PHYs
Date: Tue, 8 Jul 2014 19:03:53 +0200 [thread overview]
Message-ID: <20140708170353.GA16148@kwain> (raw)
In-Reply-To: <20140708134000.GC4979@htj.dyndns.org>
Hello,
On Tue, Jul 08, 2014 at 09:40:00AM -0400, Tejun Heo wrote:
> (Cc'ing Hans.)
>
> On Mon, Jul 07, 2014 at 12:16:09PM +0200, Antoine T?nart wrote:
> > @@ -482,6 +482,13 @@ void ahci_save_initial_config(struct device *dev,
> > port_map &= mask_port_map;
> > }
> >
> > + /*
> > + * If port_map was filled automatically when finding port sub-nodes,
> > + * make sure we get the right set here.
> > + */
> > + if (hpriv->port_map)
> > + port_map &= hpriv->port_map;
> > +
>
> So, hpriv->port is both input and output? This is messy and can lead
> to confusing failures and there now are multiple ways to modify
> port_map. If carrying this information through ahci_host_priv is
> necessary, let's remove the direct params and introduce new input
> fields to the struct.
We just use hpriv->port_map to check port_map is valid and describes
available ports there.
hpriv->port_map is filed by the generic ahci_platform_get_resources()
function when using the new bindings and not by the drivers. port_map is
the input from the drivers.
>
> > /**
> > + * ahci_platform_enable_phys - Enable PHYs
> > + * @hpriv: host private area to store config values
> > + *
> > + * This function enables all the PHYs found in hpriv->phys, if any.
> > + * If a PHY fails to be enabled, it disables all the PHYs already
> > + * enabled in reverse order and returns an error.
> > + *
> > + * RETURNS:
> > + * 0 on success otherwise a negative error code
> > + */
> > +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
> > +{
> > + int i, rc = 0;
> > +
> > + for (i = 0; i < hpriv->nphys; i++) {
> > + rc = phy_init(hpriv->phys[i]);
> > + if (rc)
> > + goto disable_phys;
> > +
> > + rc = phy_power_on(hpriv->phys[i]);
> > + if (rc) {
> > + phy_exit(hpriv->phys[i]);
> > + goto disable_phys;
> > + }
> > + }
> > +
> > + return 0;
> > +
> > +disable_phys:
> > + while (--i >= 0) {
> > + phy_power_off(hpriv->phys[i]);
> > + phy_exit(hpriv->phys[i]);
> > + }
> > + return rc;
> > +}
> > +EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
>
> Do we need to make hpriv->phys[] dynamically allocated? We already
> have hpriv->clks[AHCI_MAX_CLKS] and it's unlikely that we're gonna
> need more than several phys per host. Let's go with a simpler fixed
> array.
>
Well, a had a review a week ago about in the PHY driver saying I should
avoid using fixed sized arrays... And it was in a driver were we know
the maximum number of PHY available.
I think in this case were the number of PHYs depends on the h/w, we should
use a dynamically allocated array.
Antoine
--
Antoine T?nart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: "Antoine Ténart" <antoine.tenart@free-electrons.com>
To: Tejun Heo <tj@kernel.org>
Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>,
sebastian.hesselbarth@gmail.com, kishon@ti.com,
alexandre.belloni@free-electrons.com,
thomas.petazzoni@free-electrons.com, zmxu@marvell.com,
jszhang@marvell.com, linux-arm-kernel@lists.infradead.org,
linux-ide@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Hans de Goede" <hdegoede@redhat.com>
Subject: Re: [PATCH v9 3/7] ata: libahci: allow to use multiple PHYs
Date: Tue, 8 Jul 2014 19:03:53 +0200 [thread overview]
Message-ID: <20140708170353.GA16148@kwain> (raw)
In-Reply-To: <20140708134000.GC4979@htj.dyndns.org>
Hello,
On Tue, Jul 08, 2014 at 09:40:00AM -0400, Tejun Heo wrote:
> (Cc'ing Hans.)
>
> On Mon, Jul 07, 2014 at 12:16:09PM +0200, Antoine Ténart wrote:
> > @@ -482,6 +482,13 @@ void ahci_save_initial_config(struct device *dev,
> > port_map &= mask_port_map;
> > }
> >
> > + /*
> > + * If port_map was filled automatically when finding port sub-nodes,
> > + * make sure we get the right set here.
> > + */
> > + if (hpriv->port_map)
> > + port_map &= hpriv->port_map;
> > +
>
> So, hpriv->port is both input and output? This is messy and can lead
> to confusing failures and there now are multiple ways to modify
> port_map. If carrying this information through ahci_host_priv is
> necessary, let's remove the direct params and introduce new input
> fields to the struct.
We just use hpriv->port_map to check port_map is valid and describes
available ports there.
hpriv->port_map is filed by the generic ahci_platform_get_resources()
function when using the new bindings and not by the drivers. port_map is
the input from the drivers.
>
> > /**
> > + * ahci_platform_enable_phys - Enable PHYs
> > + * @hpriv: host private area to store config values
> > + *
> > + * This function enables all the PHYs found in hpriv->phys, if any.
> > + * If a PHY fails to be enabled, it disables all the PHYs already
> > + * enabled in reverse order and returns an error.
> > + *
> > + * RETURNS:
> > + * 0 on success otherwise a negative error code
> > + */
> > +int ahci_platform_enable_phys(struct ahci_host_priv *hpriv)
> > +{
> > + int i, rc = 0;
> > +
> > + for (i = 0; i < hpriv->nphys; i++) {
> > + rc = phy_init(hpriv->phys[i]);
> > + if (rc)
> > + goto disable_phys;
> > +
> > + rc = phy_power_on(hpriv->phys[i]);
> > + if (rc) {
> > + phy_exit(hpriv->phys[i]);
> > + goto disable_phys;
> > + }
> > + }
> > +
> > + return 0;
> > +
> > +disable_phys:
> > + while (--i >= 0) {
> > + phy_power_off(hpriv->phys[i]);
> > + phy_exit(hpriv->phys[i]);
> > + }
> > + return rc;
> > +}
> > +EXPORT_SYMBOL_GPL(ahci_platform_enable_phys);
>
> Do we need to make hpriv->phys[] dynamically allocated? We already
> have hpriv->clks[AHCI_MAX_CLKS] and it's unlikely that we're gonna
> need more than several phys per host. Let's go with a simpler fixed
> array.
>
Well, a had a review a week ago about in the PHY driver saying I should
avoid using fixed sized arrays... And it was in a driver were we know
the maximum number of PHY available.
I think in this case were the number of PHYs depends on the h/w, we should
use a dynamically allocated array.
Antoine
--
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
next prev parent reply other threads:[~2014-07-08 17:03 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-07 10:16 [PATCH v9 0/7] ARM: berlin: add AHCI support Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 1/7] phy: add a driver for the Berlin SATA PHY Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
[not found] ` <1404728173-20263-2-git-send-email-antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-07-08 12:29 ` Kishon Vijay Abraham I
2014-07-08 12:29 ` Kishon Vijay Abraham I
2014-07-08 12:29 ` Kishon Vijay Abraham I
2014-07-08 12:36 ` Antoine Ténart
2014-07-08 12:36 ` Antoine Ténart
2014-07-08 13:00 ` Sebastian Hesselbarth
2014-07-08 13:00 ` Sebastian Hesselbarth
2014-07-08 13:00 ` Sebastian Hesselbarth
2014-07-08 13:13 ` Kishon Vijay Abraham I
2014-07-08 13:13 ` Kishon Vijay Abraham I
2014-07-08 13:13 ` Kishon Vijay Abraham I
2014-07-07 10:16 ` [PATCH v9 2/7] Documentation: bindings: add " Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 3/7] ata: libahci: allow to use multiple PHYs Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-08 13:40 ` Tejun Heo
2014-07-08 13:40 ` Tejun Heo
[not found] ` <20140708134000.GC4979-Gd/HAXX7CRxy/B6EtB590w@public.gmane.org>
2014-07-08 17:03 ` Antoine Ténart [this message]
2014-07-08 17:03 ` Antoine Ténart
2014-07-08 17:03 ` Antoine Ténart
2014-07-08 17:18 ` Tejun Heo
2014-07-08 17:18 ` Tejun Heo
2014-07-08 17:18 ` Tejun Heo
2014-07-08 17:49 ` Antoine Ténart
2014-07-08 17:49 ` Antoine Ténart
2014-07-08 21:40 ` Tejun Heo
2014-07-08 21:40 ` Tejun Heo
2014-07-09 8:23 ` Antoine Ténart
2014-07-09 8:23 ` Antoine Ténart
2014-07-09 13:59 ` Tejun Heo
2014-07-09 13:59 ` Tejun Heo
2014-07-09 14:02 ` Hans de Goede
2014-07-09 14:02 ` Hans de Goede
2014-07-09 15:24 ` Alexandre Belloni
2014-07-09 15:24 ` Alexandre Belloni
2014-07-09 15:42 ` Tejun Heo
2014-07-09 15:42 ` Tejun Heo
2014-07-09 7:22 ` Hans de Goede
2014-07-09 7:22 ` Hans de Goede
2014-07-08 13:42 ` Tejun Heo
2014-07-08 13:42 ` Tejun Heo
2014-07-08 17:05 ` Antoine Ténart
2014-07-08 17:05 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 4/7] ata: ahci_platform: add a generic AHCI compatible Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 5/7] Documentation: bindings: document the sub-nodes AHCI bindings Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 6/7] ARM: berlin: add the AHCI node for the BG2Q Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
2014-07-07 10:16 ` [PATCH v9 7/7] ARM: berlin: enable the eSATA interface on the BG2Q DMP Antoine Ténart
2014-07-07 10:16 ` Antoine Ténart
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=20140708170353.GA16148@kwain \
--to=antoine.tenart-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=jszhang-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.org \
--cc=kishon-l0cyMroinI0@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-ide-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sebastian.hesselbarth-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=zmxu-eYqpPyKDWXRBDgjK7y7TUQ@public.gmane.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.