From: "Lothar Waßmann" <LW@KARO-electronics.de>
To: "Antoine Ténart" <antoine.tenart@free-electrons.com>
Cc: sebastian.hesselbarth@gmail.com, tj@kernel.org, kishon@ti.com,
thomas.petazzoni@free-electrons.com, zmxu@marvell.com,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-ide@vger.kernel.org, alexandre.belloni@free-electrons.com,
jszhang@marvell.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v10 4/8] ata: libahci: allow to use multiple PHYs
Date: Fri, 18 Jul 2014 15:17:45 +0200 [thread overview]
Message-ID: <20140718151745.0b0114a9@ipc1.ka-ro> (raw)
In-Reply-To: <1405686607-8126-5-git-send-email-antoine.tenart@free-electrons.com>
Hi,
Antoine Ténart wrote:
> The current implementation of the libahci does not allow to use multiple
> PHYs. This patch adds the support of multiple PHYs by the libahci while
> keeping the old bindings valid for device tree compatibility.
>
> This introduce a new way of defining SATA ports in the device tree, with
> one port per sub-node. This as the advantage of allowing a per port
> configuration. Because some ports may be accessible but disabled in the
> device tree, the port_map mask is computed automatically when using
> this.
>
> Signed-off-by: Antoine Ténart <antoine.tenart@free-electrons.com>
> ---
> drivers/ata/ahci.h | 3 +-
> drivers/ata/libahci_platform.c | 179 ++++++++++++++++++++++++++++++++---------
> 2 files changed, 142 insertions(+), 40 deletions(-)
>
> diff --git a/drivers/ata/ahci.h b/drivers/ata/ahci.h
> index cb8d58926851..b0ea7b077d6e 100644
> --- a/drivers/ata/ahci.h
> +++ b/drivers/ata/ahci.h
> @@ -332,7 +332,8 @@ struct ahci_host_priv {
> bool got_runtime_pm; /* Did we do pm_runtime_get? */
> struct clk *clks[AHCI_MAX_CLKS]; /* Optional */
> struct regulator *target_pwr; /* Optional */
> - struct phy *phy; /* If platform uses phy */
> + struct phy **phys; /* If platform uses phys */
> + unsigned nphys; /* Number of phys */
> void *plat_data; /* Other platform data */
> /*
> * Optional ahci_start_engine override, if not set this gets set to the
> diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> index db9b90d876dd..2c2439b4101d 100644
> --- a/drivers/ata/libahci_platform.c
> +++ b/drivers/ata/libahci_platform.c
> @@ -39,6 +39,61 @@ static struct scsi_host_template ahci_platform_sht = {
> };
>
> /**
> + * 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;
> +
You shouldn't have to initialize rc here, or does your gcc falsely
complain about an uninitialized variable if you don't?
> + 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;
> +}
Lothar Waßmann
--
___________________________________________________________
Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996
www.karo-electronics.de | info@karo-electronics.de
___________________________________________________________
next prev parent reply other threads:[~2014-07-18 13:18 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-18 12:29 [PATCH v10 0/8] ARM: berlin: add AHCI support Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 1/8] phy: add a driver for the Berlin SATA PHY Antoine Ténart
2014-07-18 12:54 ` Varka Bhadram
2014-07-18 12:30 ` [PATCH v10 2/8] Documentation: bindings: add " Antoine Ténart
2014-07-18 17:27 ` Sergei Shtylyov
2014-07-21 9:04 ` Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 3/8] ata: libahci_platform: move port_map parameters into the AHCI structure Antoine Ténart
2014-07-18 13:47 ` Tejun Heo
2014-07-21 9:02 ` Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 4/8] ata: libahci: allow to use multiple PHYs Antoine Ténart
2014-07-18 13:17 ` Lothar Waßmann [this message]
2014-07-21 9:01 ` Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 5/8] ata: ahci_platform: add a generic AHCI compatible Antoine Ténart
2014-07-18 14:30 ` Hans de Goede
2014-07-18 12:30 ` [PATCH v10 6/8] Documentation: bindings: document the sub-nodes AHCI bindings Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 7/8] ARM: berlin: add the AHCI node for the BG2Q Antoine Ténart
2014-07-18 12:30 ` [PATCH v10 8/8] ARM: berlin: enable the eSATA interface on the BG2Q DMP Antoine Ténart
2014-07-18 13:57 ` [PATCH v10 0/8] ARM: berlin: add AHCI support Tejun Heo
2014-07-19 9:03 ` Sebastian Hesselbarth
2014-07-19 10:18 ` Hans de Goede
2014-07-19 10:31 ` Hans de Goede
2014-07-21 9:09 ` 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=20140718151745.0b0114a9@ipc1.ka-ro \
--to=lw@karo-electronics.de \
--cc=alexandre.belloni@free-electrons.com \
--cc=antoine.tenart@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=jszhang@marvell.com \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sebastian.hesselbarth@gmail.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=tj@kernel.org \
--cc=zmxu@marvell.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®