[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140514102122.GA11140@kwain>
Date: Wed, 14 May 2014 12:21:22 +0200
From: Antoine Ténart
<antoine.tenart@...e-electrons.com>
To: Kishon Vijay Abraham I <kishon@...com>
Cc: Antoine Ténart
<antoine.tenart@...e-electrons.com>,
sebastian.hesselbarth@...il.com, tj@...nel.org,
alexandre.belloni@...e-electrons.com,
thomas.petazzoni@...e-electrons.com, zmxu@...vell.com,
jszhang@...vell.com, linux-arm-kernel@...ts.infradead.org,
linux-ide@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 1/6] phy: add a driver for the Berlin SATA PHY
Hi,
On Wed, May 14, 2014 at 03:43:03PM +0530, Kishon Vijay Abraham I wrote:
> Hi,
>
> On Wednesday 14 May 2014 03:18 PM, Antoine Ténart wrote:
[…]
> > +#define to_berlin_sata_phy_priv(desc) \
> > + container_of((desc), struct phy_berlin_priv, phys[(desc)->index])
> > +
> > +struct phy_berlin_desc {
> > + struct phy *phy;
> > + u32 val;
> > + unsigned index;
> > +};
> > +
> > +struct phy_berlin_priv {
> > + void __iomem *base;
> > + spinlock_t lock;
> > + struct phy_berlin_desc phys[BERLIN_SATA_PHY_NB];
>
> Can't we do away with hardcoding BERLIN_SATA_PHY_NB?
We can't if we want to be able to use the container_of macro in
to_berlin_sata_phy_priv(). And we want a common structure to store the
common spinlock and base address.
[…]
> > + /*
> > + * By default the PHY node is used to request and match a PHY.
> > + * We describe one PHY per sub-node here. Use the right node.
> > + */
> > + phy->dev.of_node = child;
> > +
> > + priv->phys[phy_id].phy = phy;
> > + priv->phys[phy_id].val = desc[phy_id].val;
> > + priv->phys[phy_id].index = phy_id;
> > + phy_set_drvdata(phy, &priv->phys[phy_id]);
> > +
> > + /* Make sure the PHY is off */
> > + phy_berlin_sata_power_off(phy);
> > +
> > + phy_provider = devm_of_phy_provider_register(&phy->dev,
> > + of_phy_simple_xlate);
> > + if (IS_ERR(phy_provider))
> > + return PTR_ERR(phy_provider);
>
> was this intentional? registering multiple PHY providers?
Yes. Each sub-node describe a PHY and register as a PHY provider. This
allow to reference the PHY as <&sata_phy0> and not <&sata_phy 0>. It
would be confusing to have a sub-node sata_phy0 and to use its parent
to access it.
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 linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists