* [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support
@ 2022-04-27 21:44 Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property Michael Walle
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Michael Walle @ 2022-04-27 21:44 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King
Cc: netdev, devicetree, linux-kernel, Michael Walle
Add support to disable coma mode by a GPIO line.
Michael Walle (3):
dt-bindings: net: micrel: add coma-mode-gpios property
net: phy: micrel: move the PHY timestamping check
net: phy: micrel: add coma mode GPIO
.../devicetree/bindings/net/micrel.txt | 9 ++++++
drivers/net/phy/micrel.c | 32 ++++++++++++++++---
2 files changed, 37 insertions(+), 4 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property
2022-04-27 21:44 [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support Michael Walle
@ 2022-04-27 21:44 ` Michael Walle
2022-04-29 22:24 ` Rob Herring
2022-04-27 21:44 ` [PATCH net-next v1 2/3] net: phy: micrel: move the PHY timestamping check Michael Walle
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Michael Walle @ 2022-04-27 21:44 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King
Cc: netdev, devicetree, linux-kernel, Michael Walle
The LAN8814 has a coma mode pin which is used to put the PHY into
isolate and power-down mode. Usually strapped to be asserted by default.
A GPIO is then used to take the PHY out of this mode.
Signed-off-by: Michael Walle <michael@walle.cc>
---
Documentation/devicetree/bindings/net/micrel.txt | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/Documentation/devicetree/bindings/net/micrel.txt b/Documentation/devicetree/bindings/net/micrel.txt
index 8d157f0295a5..a9ed691ffb03 100644
--- a/Documentation/devicetree/bindings/net/micrel.txt
+++ b/Documentation/devicetree/bindings/net/micrel.txt
@@ -45,3 +45,12 @@ Optional properties:
In fiber mode, auto-negotiation is disabled and the PHY can only work in
100base-fx (full and half duplex) modes.
+
+ - coma-mode-gpios: If present the given gpio will be deasserted when the
+ PHY is probed.
+
+ Some PHYs have a COMA mode input pin which puts the PHY into
+ isolate and power-down mode. On some boards this input is connected
+ to a GPIO of the SoC.
+
+ Supported on the LAN8814.
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next v1 2/3] net: phy: micrel: move the PHY timestamping check
2022-04-27 21:44 [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property Michael Walle
@ 2022-04-27 21:44 ` Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO Michael Walle
2022-04-30 0:30 ` [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support patchwork-bot+netdevbpf
3 siblings, 0 replies; 11+ messages in thread
From: Michael Walle @ 2022-04-27 21:44 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King
Cc: netdev, devicetree, linux-kernel, Michael Walle
Both lan8814_ptp_init() and lan8814_ptp_probe_once() are only used if
PTP and PHY timestamping is enabed. Up until now the probe function just
returns early, if they are not needed. But we need the
phy_package_init_once() functionality for the coma mode GPIO setup. Move
the check into the functions itself.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/phy/micrel.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 96840695debd..b981c5eaac33 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -2729,6 +2729,10 @@ static void lan8814_ptp_init(struct phy_device *phydev)
struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv;
u32 temp;
+ if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK) ||
+ !IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING))
+ return;
+
lanphy_write_page_reg(phydev, 5, TSU_HARD_RESET, TSU_HARD_RESET_);
temp = lanphy_read_page_reg(phydev, 5, PTP_TX_MOD);
@@ -2767,6 +2771,10 @@ static int lan8814_ptp_probe_once(struct phy_device *phydev)
{
struct lan8814_shared_priv *shared = phydev->shared->priv;
+ if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK) ||
+ !IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING))
+ return 0;
+
/* Initialise shared lock for clock*/
mutex_init(&shared->shared_lock);
@@ -2843,10 +2851,6 @@ static int lan8814_probe(struct phy_device *phydev)
phydev->priv = priv;
- if (!IS_ENABLED(CONFIG_PTP_1588_CLOCK) ||
- !IS_ENABLED(CONFIG_NETWORK_PHY_TIMESTAMPING))
- return 0;
-
/* Strap-in value for PHY address, below register read gives starting
* phy address value
*/
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 21:44 [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 2/3] net: phy: micrel: move the PHY timestamping check Michael Walle
@ 2022-04-27 21:44 ` Michael Walle
2022-04-27 22:06 ` Florian Fainelli
2022-04-30 0:30 ` [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support patchwork-bot+netdevbpf
3 siblings, 1 reply; 11+ messages in thread
From: Michael Walle @ 2022-04-27 21:44 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King
Cc: netdev, devicetree, linux-kernel, Michael Walle
The LAN8814 has a coma mode pin which puts the PHY into isolate and
power-dowm mode. Unfortunately, the mode cannot be disabled by a
register. Usually, the input pin has a pull-up and connected to a GPIO
which can then be used to disable the mode. Try to get the GPIO and
deassert it.
Signed-off-by: Michael Walle <michael@walle.cc>
---
drivers/net/phy/micrel.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index b981c5eaac33..685a0ab5453c 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -32,6 +32,7 @@
#include <linux/ptp_clock.h>
#include <linux/ptp_classify.h>
#include <linux/net_tstamp.h>
+#include <linux/gpio/consumer.h>
/* Operation Mode Strap Override */
#define MII_KSZPHY_OMSO 0x16
@@ -2837,6 +2838,21 @@ static int lan8814_config_init(struct phy_device *phydev)
return 0;
}
+static int lan8814_release_coma_mode(struct phy_device *phydev)
+{
+ struct gpio_desc *gpiod;
+
+ gpiod = devm_gpiod_get_optional(&phydev->mdio.dev, "coma-mode",
+ GPIOD_OUT_HIGH_OPEN_DRAIN);
+ if (IS_ERR(gpiod))
+ return PTR_ERR(gpiod);
+
+ gpiod_set_consumer_name(gpiod, "LAN8814 coma mode");
+ gpiod_set_value_cansleep(gpiod, 0);
+
+ return 0;
+}
+
static int lan8814_probe(struct phy_device *phydev)
{
struct kszphy_priv *priv;
@@ -2859,6 +2875,10 @@ static int lan8814_probe(struct phy_device *phydev)
addr, sizeof(struct lan8814_shared_priv));
if (phy_package_init_once(phydev)) {
+ err = lan8814_release_coma_mode(phydev);
+ if (err)
+ return err;
+
err = lan8814_ptp_probe_once(phydev);
if (err)
return err;
--
2.30.2
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 21:44 ` [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO Michael Walle
@ 2022-04-27 22:06 ` Florian Fainelli
2022-04-27 22:08 ` Michael Walle
0 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2022-04-27 22:06 UTC (permalink / raw)
To: Michael Walle, David S . Miller, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit,
Russell King
Cc: netdev, devicetree, linux-kernel
On 4/27/2022 2:44 PM, Michael Walle wrote:
> The LAN8814 has a coma mode pin which puts the PHY into isolate and
> power-dowm mode. Unfortunately, the mode cannot be disabled by a
> register. Usually, the input pin has a pull-up and connected to a GPIO
> which can then be used to disable the mode. Try to get the GPIO and
> deassert it.
Poor choice of word, how about deep sleep, dormant, super isolate?
--
Florian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 22:06 ` Florian Fainelli
@ 2022-04-27 22:08 ` Michael Walle
2022-04-27 22:12 ` Florian Fainelli
0 siblings, 1 reply; 11+ messages in thread
From: Michael Walle @ 2022-04-27 22:08 UTC (permalink / raw)
To: Florian Fainelli
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King,
netdev, devicetree, linux-kernel
Am 2022-04-28 00:06, schrieb Florian Fainelli:
> On 4/27/2022 2:44 PM, Michael Walle wrote:
>> The LAN8814 has a coma mode pin which puts the PHY into isolate and
>> power-dowm mode. Unfortunately, the mode cannot be disabled by a
s/dowm/down/
>> register. Usually, the input pin has a pull-up and connected to a GPIO
>> which can then be used to disable the mode. Try to get the GPIO and
>> deassert it.
>
> Poor choice of word, how about deep sleep, dormant, super isolate?
Which one do you mean? Super isolate sounded like broadcom wording ;)
-michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 22:08 ` Michael Walle
@ 2022-04-27 22:12 ` Florian Fainelli
2022-04-27 22:17 ` Michael Walle
0 siblings, 1 reply; 11+ messages in thread
From: Florian Fainelli @ 2022-04-27 22:12 UTC (permalink / raw)
To: Michael Walle
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King,
netdev, devicetree, linux-kernel
On 4/27/22 15:08, Michael Walle wrote:
> Am 2022-04-28 00:06, schrieb Florian Fainelli:
>> On 4/27/2022 2:44 PM, Michael Walle wrote:
>>> The LAN8814 has a coma mode pin which puts the PHY into isolate and
>>> power-dowm mode. Unfortunately, the mode cannot be disabled by a
> s/dowm/down/
>
>>> register. Usually, the input pin has a pull-up and connected to a GPIO
>>> which can then be used to disable the mode. Try to get the GPIO and
>>> deassert it.
>>
>> Poor choice of word, how about deep sleep, dormant, super isolate?
>
> Which one do you mean? Super isolate sounded like broadcom wording ;)
Coma is not a great term to use IMHO. Yes Super isolate (tm) is a
Broadcom thing, and you can come out of super isolate mode with register
writes, so maybe not the best suggestion.
--
Florian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 22:12 ` Florian Fainelli
@ 2022-04-27 22:17 ` Michael Walle
2022-04-27 22:23 ` Florian Fainelli
0 siblings, 1 reply; 11+ messages in thread
From: Michael Walle @ 2022-04-27 22:17 UTC (permalink / raw)
To: Florian Fainelli
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King,
netdev, devicetree, linux-kernel
Am 2022-04-28 00:12, schrieb Florian Fainelli:
> On 4/27/22 15:08, Michael Walle wrote:
>> Am 2022-04-28 00:06, schrieb Florian Fainelli:
>>> On 4/27/2022 2:44 PM, Michael Walle wrote:
>>>> The LAN8814 has a coma mode pin which puts the PHY into isolate and
>>>> power-dowm mode. Unfortunately, the mode cannot be disabled by a
>> s/dowm/down/
>>
>>>> register. Usually, the input pin has a pull-up and connected to a
>>>> GPIO
>>>> which can then be used to disable the mode. Try to get the GPIO and
>>>> deassert it.
>>>
>>> Poor choice of word, how about deep sleep, dormant, super isolate?
>>
>> Which one do you mean? Super isolate sounded like broadcom wording ;)
>
> Coma is not a great term to use IMHO. Yes Super isolate (tm) is a
> Broadcom thing, and you can come out of super isolate mode with
> register writes, so maybe not the best suggestion.
I didn't come up with that name. It's all in the datasheets and it's
actually already used grep for "COMA_MODE" in phy/mscc. (Yes on that
one you can actually disable it with register access..). Even if
it is not a great name (which I agree), I'd use the same naming as
the datasheet and esp. the pin name.
-michael
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO
2022-04-27 22:17 ` Michael Walle
@ 2022-04-27 22:23 ` Florian Fainelli
0 siblings, 0 replies; 11+ messages in thread
From: Florian Fainelli @ 2022-04-27 22:23 UTC (permalink / raw)
To: Michael Walle
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Andrew Lunn, Heiner Kallweit, Russell King,
netdev, devicetree, linux-kernel
On 4/27/22 15:17, Michael Walle wrote:
> Am 2022-04-28 00:12, schrieb Florian Fainelli:
>> On 4/27/22 15:08, Michael Walle wrote:
>>> Am 2022-04-28 00:06, schrieb Florian Fainelli:
>>>> On 4/27/2022 2:44 PM, Michael Walle wrote:
>>>>> The LAN8814 has a coma mode pin which puts the PHY into isolate and
>>>>> power-dowm mode. Unfortunately, the mode cannot be disabled by a
>>> s/dowm/down/
>>>
>>>>> register. Usually, the input pin has a pull-up and connected to a GPIO
>>>>> which can then be used to disable the mode. Try to get the GPIO and
>>>>> deassert it.
>>>>
>>>> Poor choice of word, how about deep sleep, dormant, super isolate?
>>>
>>> Which one do you mean? Super isolate sounded like broadcom wording ;)
>>
>> Coma is not a great term to use IMHO. Yes Super isolate (tm) is a
>> Broadcom thing, and you can come out of super isolate mode with
>> register writes, so maybe not the best suggestion.
>
> I didn't come up with that name. It's all in the datasheets and it's
> actually already used grep for "COMA_MODE" in phy/mscc. (Yes on that
> one you can actually disable it with register access..). Even if
> it is not a great name (which I agree), I'd use the same naming as
> the datasheet and esp. the pin name.
OK then, makes sense to use the datasheet name.
--
Florian
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property
2022-04-27 21:44 ` [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property Michael Walle
@ 2022-04-29 22:24 ` Rob Herring
0 siblings, 0 replies; 11+ messages in thread
From: Rob Herring @ 2022-04-29 22:24 UTC (permalink / raw)
To: Michael Walle
Cc: Paolo Abeni, David S . Miller, Andrew Lunn, Rob Herring,
Jakub Kicinski, devicetree, linux-kernel, Heiner Kallweit,
Krzysztof Kozlowski, Russell King, netdev
On Wed, 27 Apr 2022 23:44:04 +0200, Michael Walle wrote:
> The LAN8814 has a coma mode pin which is used to put the PHY into
> isolate and power-down mode. Usually strapped to be asserted by default.
> A GPIO is then used to take the PHY out of this mode.
>
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> Documentation/devicetree/bindings/net/micrel.txt | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support
2022-04-27 21:44 [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support Michael Walle
` (2 preceding siblings ...)
2022-04-27 21:44 ` [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO Michael Walle
@ 2022-04-30 0:30 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 11+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-04-30 0:30 UTC (permalink / raw)
To: Michael Walle
Cc: davem, kuba, pabeni, robh+dt, krzysztof.kozlowski+dt, andrew,
hkallweit1, linux, netdev, devicetree, linux-kernel
Hello:
This series was applied to netdev/net-next.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 27 Apr 2022 23:44:03 +0200 you wrote:
> Add support to disable coma mode by a GPIO line.
>
> Michael Walle (3):
> dt-bindings: net: micrel: add coma-mode-gpios property
> net: phy: micrel: move the PHY timestamping check
> net: phy: micrel: add coma mode GPIO
>
> [...]
Here is the summary with links:
- [net-next,v1,1/3] dt-bindings: net: micrel: add coma-mode-gpios property
https://git.kernel.org/netdev/net-next/c/749c61e5b30a
- [net-next,v1,2/3] net: phy: micrel: move the PHY timestamping check
https://git.kernel.org/netdev/net-next/c/31d00ca4ce0e
- [net-next,v1,3/3] net: phy: micrel: add coma mode GPIO
https://git.kernel.org/netdev/net-next/c/738871b09250
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-04-30 0:31 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 21:44 [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 1/3] dt-bindings: net: micrel: add coma-mode-gpios property Michael Walle
2022-04-29 22:24 ` Rob Herring
2022-04-27 21:44 ` [PATCH net-next v1 2/3] net: phy: micrel: move the PHY timestamping check Michael Walle
2022-04-27 21:44 ` [PATCH net-next v1 3/3] net: phy: micrel: add coma mode GPIO Michael Walle
2022-04-27 22:06 ` Florian Fainelli
2022-04-27 22:08 ` Michael Walle
2022-04-27 22:12 ` Florian Fainelli
2022-04-27 22:17 ` Michael Walle
2022-04-27 22:23 ` Florian Fainelli
2022-04-30 0:30 ` [PATCH net-next v1 0/3] net: phy: micrel: add coma mode support patchwork-bot+netdevbpf
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.