linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] phy: mvebu-cp110-comphy: fix mux error check
@ 2017-09-18  8:04 Antoine Tenart
  2017-09-18  8:04 ` [PATCH 2/3] phy: mvebu-cp110-comphy: remove unused member in private struct Antoine Tenart
  2017-09-18  8:04 ` [PATCH 3/3] phy: mvebu-cp110-comphy: explicitly set the pipe selector Antoine Tenart
  0 siblings, 2 replies; 3+ messages in thread
From: Antoine Tenart @ 2017-09-18  8:04 UTC (permalink / raw)
  To: kishon
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, linux-arm-kernel, linux-kernel

The mux value is retrieved from the mvebu_comphy_get_mux() function
which returns an int. In mvebu_comphy_power_on() this int is stored to a
u32 and a check is made to ensure it's not negative. Which is wrong.
This fixes it.

Fixes: d0438bd6aa09 ("phy: add the mvebu cp110 comphy driver")
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
index 73ebad6634a7..514a1a47e1fd 100644
--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
@@ -468,8 +468,8 @@ static int mvebu_comphy_power_on(struct phy *phy)
 {
 	struct mvebu_comphy_lane *lane = phy_get_drvdata(phy);
 	struct mvebu_comphy_priv *priv = lane->priv;
-	int ret;
-	u32 mux, val;
+	int ret, mux;
+	u32 val;
 
 	mux = mvebu_comphy_get_mux(lane->id, lane->port, lane->mode);
 	if (mux < 0)
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/3] phy: mvebu-cp110-comphy: remove unused member in private struct
  2017-09-18  8:04 [PATCH 1/3] phy: mvebu-cp110-comphy: fix mux error check Antoine Tenart
@ 2017-09-18  8:04 ` Antoine Tenart
  2017-09-18  8:04 ` [PATCH 3/3] phy: mvebu-cp110-comphy: explicitly set the pipe selector Antoine Tenart
  1 sibling, 0 replies; 3+ messages in thread
From: Antoine Tenart @ 2017-09-18  8:04 UTC (permalink / raw)
  To: kishon
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, linux-arm-kernel, linux-kernel

The 'modes' member of the mvebu_comphy_priv structure is not used.
Remove it.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
index 514a1a47e1fd..365f0abf5a2f 100644
--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
@@ -152,7 +152,6 @@ struct mvebu_comphy_priv {
 	void __iomem *base;
 	struct regmap *regmap;
 	struct device *dev;
-	int modes[MVEBU_COMPHY_LANES];
 };
 
 struct mvebu_comphy_lane {
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 3/3] phy: mvebu-cp110-comphy: explicitly set the pipe selector
  2017-09-18  8:04 [PATCH 1/3] phy: mvebu-cp110-comphy: fix mux error check Antoine Tenart
  2017-09-18  8:04 ` [PATCH 2/3] phy: mvebu-cp110-comphy: remove unused member in private struct Antoine Tenart
@ 2017-09-18  8:04 ` Antoine Tenart
  1 sibling, 0 replies; 3+ messages in thread
From: Antoine Tenart @ 2017-09-18  8:04 UTC (permalink / raw)
  To: kishon
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, linux-arm-kernel, linux-kernel

The pipe selector is used to select some modes (such as USB or PCIe).
Otherwise it must be set to 0 (or "unconnected"). This patch does this
to ensure it is not set to an incompatible value when using the
supported modes (SGMII, 10GKR).

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
index 365f0abf5a2f..d3ea824b7ed0 100644
--- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
+++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c
@@ -111,6 +111,8 @@
 #define     MVEBU_COMPHY_CONF6_40B		BIT(18)
 #define MVEBU_COMPHY_SELECTOR			0x1140
 #define     MVEBU_COMPHY_SELECTOR_PHY(n)	((n) * 0x4)
+#define MVEBU_COMPHY_PIPE_SELECTOR		0x1144
+#define     MVEBU_COMPHY_PIPE_SELECTOR_PIPE(n)	((n) * 0x4)
 
 #define MVEBU_COMPHY_LANES	6
 #define MVEBU_COMPHY_PORTS	3
@@ -474,6 +476,10 @@ static int mvebu_comphy_power_on(struct phy *phy)
 	if (mux < 0)
 		return -ENOTSUPP;
 
+	regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val);
+	val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id));
+	regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val);
+
 	regmap_read(priv->regmap, MVEBU_COMPHY_SELECTOR, &val);
 	val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id));
 	val |= mux << MVEBU_COMPHY_SELECTOR_PHY(lane->id);
@@ -525,6 +531,10 @@ static int mvebu_comphy_power_off(struct phy *phy)
 	val &= ~(0xf << MVEBU_COMPHY_SELECTOR_PHY(lane->id));
 	regmap_write(priv->regmap, MVEBU_COMPHY_SELECTOR, val);
 
+	regmap_read(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, &val);
+	val &= ~(0xf << MVEBU_COMPHY_PIPE_SELECTOR_PIPE(lane->id));
+	regmap_write(priv->regmap, MVEBU_COMPHY_PIPE_SELECTOR, val);
+
 	return 0;
 }
 
-- 
2.13.5

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-09-18  8:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-18  8:04 [PATCH 1/3] phy: mvebu-cp110-comphy: fix mux error check Antoine Tenart
2017-09-18  8:04 ` [PATCH 2/3] phy: mvebu-cp110-comphy: remove unused member in private struct Antoine Tenart
2017-09-18  8:04 ` [PATCH 3/3] phy: mvebu-cp110-comphy: explicitly set the pipe selector Antoine Tenart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).