phy: add a NO-OP phy driver
Subsystems (2)
PATCH 1/1 phy: add a NO-OP phy driver
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
---
Following the email thread '[PATCH 1/1] dm: phy: add missing #ifdef CONFIG_PHY', here is a patch to add support for a no-op phy.
Jean-Jacques
Documentation/devicetree/bindings/phy/no-op.txt | 16 +++++++++++++++ drivers/phy/Kconfig | 18 +++++++++++++++++ drivers/phy/Makefile | 1 + drivers/phy/noop-phy.c | 26 +++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/no-op.txt create mode 100644 drivers/phy/noop-phy.c
Documentation/devicetree/bindings/phy/no-op.txt new file +16 -0
@@ -0,0 +1,16 @@ +NO-OP Phy driver + +The driver is used to stub PHY opeartions in a driver (USB, SATA). +This is useful when the PHY driver for a particular hardware doesn't exist yet +(the hardware is initialized by the platform code). + +Required properties: +- compatible : must contain "noop-phy" +- #phy-cells : must contain <0> + +Example: + +noop_phy { + compatible = "noop-phy"; + #phy-cells = <0>; +};
drivers/phy/Kconfig +18 -0
@@ -41,6 +41,24 @@ config PHY_SANDBOX This select a dummy sandbox PHY driver. It used only to implement the unit tests for the phy framework +config NOOP_PHY + bool "no-op phy" + depends on PHY + help + Support for a no-op PHY + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + +config SPL_NOOP_PHY + bool "no-op phy in SPL" + depends on SPL_PHY + help + Support for a no-op PHY in SPL + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + config PIPE3_PHY bool "Support omap's PIPE3 PHY" depends on PHY && ARCH_OMAP2PLUS
drivers/phy/Makefile +1 -0
@@ -6,5 +6,6 @@ # obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o +obj-$(CONFIG_$(SPL_)NOOP_PHY) += noop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.o
drivers/phy/noop-phy.c new file +26 -0
@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ +* Written by Jean-Jacques Hiblot <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <dm/device.h> +#include <generic-phy.h> + +static const struct udevice_id noop_phy_ids[] = { + { .compatible ="noop-phy" }, + { } +}; + +static struct phy_ops noop_phy_ops = { +}; + +U_BOOT_DRIVER (noop_phy) = { + .name ="noop_phy" , + .id =UCLASS_PHY , + .of_match = noop_phy_ids, + .ops = &noop_phy_ops, +};
Signature · 1 line
1.9.1
PATCH 1/1 phy: add a NO-OP phy driver
Quoted 27 lines · Jean-Jacques Hiblot
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Following the email thread '[PATCH 1/1] dm: phy: add missing #ifdef
CONFIG_PHY', here is a patch to add support for a no-op phy.Jean-Jacques
Documentation/devicetree/bindings/phy/no-op.txt | 16 +++++++++++++++ drivers/phy/Kconfig | 18 +++++++++++++++++ drivers/phy/Makefile | 1 + drivers/phy/noop-phy.c | 26 +++++++++++++++++++++++++ 4 files changed, 61 insertions(+) create mode 100644 Documentation/devicetree/bindings/phy/no-op.txt create mode 100644 drivers/phy/noop-phy.cDocumentation/devicetree/bindings/phy/no-op.txt new file +0
-0
Documentation/devicetree/bindings/phy/no-op.txt line 3
Quoted 3 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +3
-0@@ -0,0 +1,16 @@ +NO-OP Phy driver + +The driver is used to stub PHY opeartions in a driver (USB, SATA).
operations
Quoted 18 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +13
-0+This is useful when the PHY driver for a particular hardware doesn't exist yet +(the hardware is initialized by the platform code). + +Required properties: +- compatible : must contain "noop-phy" +- #phy-cells : must contain <0> + +Example: + +noop_phy { + compatible = "noop-phy"; + #phy-cells = <0>; +};drivers/phy/Kconfig +0
-0
drivers/phy/Kconfig config PHY_SANDBOX · line 45
Quoted 5 lines
drivers/phy/Kconfig +2
-0@@ -41,6 +41,24 @@ config PHY_SANDBOX This select a dummy sandbox PHY driver. It used only to implement the unit tests for the phy framework +config NOOP_PHY + bool "no-op phy"
Please fix the option description, this is quite sloppy.
drivers/phy/Kconfig config PHY_SANDBOX · line 51
Quoted 6 lines
drivers/phy/Kconfig +6
-0+ depends on PHY + help + Support for a no-op PHY + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY).
This really is only useful if there is no dedicated PHY.
drivers/phy/Kconfig config PHY_SANDBOX · line 54
Quoted 2 lines
drivers/phy/Kconfig +2
-0+config SPL_NOOP_PHY + bool "no-op phy in SPL"
DTTO
Quoted 54 lines
drivers/phy/Kconfig +7
-0+ depends on SPL_PHY + help + Support for a no-op PHY in SPL + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + config PIPE3_PHY bool "Support omap's PIPE3 PHY" depends on PHY && ARCH_OMAP2PLUSdrivers/phy/Makefile +1
-0@@ -6,5 +6,6 @@ # obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o +obj-$(CONFIG_$(SPL_)NOOP_PHY) += noop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.odrivers/phy/noop-phy.c new file +26
-0@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ +* Written by Jean-Jacques Hiblot <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <dm/device.h> +#include <generic-phy.h> + +static const struct udevice_id noop_phy_ids[] = { + { .compatible ="noop-phy" }, + { } +}; + +static struct phy_ops noop_phy_ops = { +}; + +U_BOOT_DRIVER (noop_phy) = { + .name ="noop_phy" , + .id =UCLASS_PHY , + .of_match = noop_phy_ids, + .ops = &noop_phy_ops, +};
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 phy: add a NO-OP phy driver
Hi Marek and Jean-Jacques,
-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Marek Vasut
Sent: vendredi 21 juillet 2017 11:03
To: Jean-Jacques Hiblot <[email protected]>; Patrice CHOTARD <[email protected]>; u-boot at lists.denx.de; sjg at chromium.org
Cc: ran.wang_1 at nxp.com; Christophe KERELLO <[email protected]>
Subject: Re: [U-Boot] [PATCH] phy: add a NO-OP phy driver
Quoted 5 lines · Jean-Jacques Hiblot
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
Signed-off-by Jean-Jacques Hiblot <[email protected]>
So with this patch we have noop PHY driver
But that don't solve all the issues:
1/ compilation issue
=> dependency need to be added to avoid to modify all defconfig
In drivers/usb/host/Kconfig
Add select PHY
For USB_EHCI_GENERIC and USB_OHCI_GENERIC
PS: I don't sure that solve issue for all the case (is USB is activated in SPL for boards)
2/ execution need to be protected
In all driver, we have de sequence
err = generic_phy_get_by_index(dev, 0, &priv->phy);
if (err) {
if (err != -ENOENT) {
error("failed to get usb phy\n");
goto reset_err;
}
}
err = generic_phy_init(&priv->phy);
if (err) {
error("failed to init usb phy\n");
goto reset_err;
}=> the priv->phy can be invalid (if ENOENT error)
int generic_phy_init(struct phy *phy) int generic_phy_reset(struct phy *phy) int generic_phy_exit(struct phy *phy) int generic_phy_power_on(struct phy *phy) int generic_phy_power_off(struct phy *phy)
need to be protected for invalid phy
Regards
Patrick
PATCH 1/1 phy: add a NO-OP phy driver
In reply to Marek VasutQuoted 54 lines · Marek Vasut
Quoted 27 lines · Jean-Jacques Hiblot
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Following the email thread '[PATCH 1/1] dm: phy: add missing #ifdef
CONFIG_PHY', here is a patch to add support for a no-op phy.Jean-Jacques
Documentation/devicetree/bindings/phy/no-op.txt | 16 +++++++++++++++ drivers/phy/Kconfig | 18 +++++++++++++++++ drivers/phy/Makefile | 1 + drivers/phy/noop-phy.c | 26 +++++++++++++++++++++++++ 4 files changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/phy/no-op.txtcreate mode 100644drivers/phy/noop-phy.cDocumentation/devicetree/bindings/phy/no-op.txt new file +0
-0Documentation/devicetree/bindings/phy/no-op.txt line 3
Quoted 3 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +3
-0@@ -0,0 +1,16 @@ +NO-OP Phy driver + +The driver is used to stub PHY opeartions in a driver (USB, SATA).operations
Quoted 21 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +13
-0+This is useful when the PHY driver for a particular hardware doesn't exist yet +(the hardware is initialized by the platform code). + +Required properties: +- compatible : must contain "noop-phy" +- #phy-cells : must contain <0> + +Example: + +noop_phy { + compatible = "noop-phy"; + #phy-cells = <0>; +};drivers/phy/Kconfig +0
-0@@ -41,6 +41,24 @@ config PHY_SANDBOX This select a dummy sandbox PHY driver. It used only to implement the unit tests for the phy framework
Quoted 3 lines
drivers/phy/Kconfig config PHY_SANDBOX · line 45
Quoted 2 lines
drivers/phy/Kconfig +2
-0+config NOOP_PHY + bool "no-op phy"Please fix the option description, this is quite sloppy.
It's not that I want to induce in sloppiness, but I can't come up with a better description.
Suggestions are welcome.
Quoted 8 lines
drivers/phy/Kconfig config PHY_SANDBOX · line 51
Quoted 7 lines
drivers/phy/Kconfig +6
-0+ depends on PHY + help + Support for a no-op PHY + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY).This really is only useful if there is no dedicated PHY.
Also during the transition from platform code to DM code for the PHY. It allows setting up the 'client' driver first, and then the PHY driver.
Quoted 60 lines
drivers/phy/Kconfig config PHY_SANDBOX · line 54
Quoted 3 lines
drivers/phy/Kconfig +2
-0+config SPL_NOOP_PHY + bool "no-op phy in SPL"DTTO
Quoted 54 lines
drivers/phy/Kconfig +7
-0+ depends on SPL_PHY + help + Support for a no-op PHY in SPL + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + config PIPE3_PHY bool "Support omap's PIPE3 PHY" depends on PHY && ARCH_OMAP2PLUSdrivers/phy/Makefile +1
-0@@ -6,5 +6,6 @@ # obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o +obj-$(CONFIG_$(SPL_)NOOP_PHY) += noop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.odrivers/phy/noop-phy.c new file +26
-0@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ +* Written by Jean-Jacques Hiblot <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <dm/device.h> +#include <generic-phy.h> + +static const struct udevice_id noop_phy_ids[] = { + { .compatible ="noop-phy" }, + { } +}; + +static struct phy_ops noop_phy_ops = { +}; + +U_BOOT_DRIVER (noop_phy) = { + .name ="noop_phy" , + .id =UCLASS_PHY , + .of_match = noop_phy_ids, + .ops = &noop_phy_ops, +};
PATCH 1/1 phy: add a NO-OP phy driver
Quoted 64 lines · Jean-Jacques Hiblot
Quoted 53 lines · Marek Vasut
Quoted 30 lines · Jean-Jacques Hiblot
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Following the email thread '[PATCH 1/1] dm: phy: add missing #ifdef
CONFIG_PHY',
here is a patch to add support for a no-op phy.Jean-Jacques
Documentation/devicetree/bindings/phy/no-op.txt | 16 +++++++++++++++ drivers/phy/Kconfig | 18 +++++++++++++++++ drivers/phy/Makefile | 1 + drivers/phy/noop-phy.c | 26 +++++++++++++++++++++++++ 4 files changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/phy/no-op.txtcreate mode 100644drivers/phy/noop-phy.cDocumentation/devicetree/bindings/phy/no-op.txt new file +0
-0Documentation/devicetree/bindings/phy/no-op.txt line 3
Quoted 3 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +3
-0@@ -0,0 +1,16 @@ +NO-OP Phy driver + +The driver is used to stub PHY opeartions in a driver (USB, SATA).operations
Quoted 17 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +1
-0+This is useful when the PHY driver for a particular hardware doesn'texist yet
Documentation/devicetree/bindings/phy/no-op.txt new file +12
-0+(the hardware is initialized by the platform code). + +Required properties: +- compatible : must contain "noop-phy" +- #phy-cells : must contain <0> + +Example: + +noop_phy { + compatible = "noop-phy"; + #phy-cells = <0>; +};drivers/phy/Kconfig +0
-1--- a/drivers/phy/KconfigQuoted 8 lines
Quoted 7 lines
+++ b/drivers/phy/Kconfig
drivers/phy/Kconfig +0
-0@@ -41,6 +41,24 @@ config PHY_SANDBOX This select a dummy sandbox PHY driver. It used only toimplement
the unit tests for the phy framework
+configNOOP_PHY
+ bool "no-op phy"Please fix the option description, this is quite sloppy.
Quoted 3 lines
It's not that I want to induce in sloppiness, but I can't come up with a better description.
Suggestions are welcome.
NOP USB PHY driver or something ?
Quoted 10 lines
Quoted 8 lines
Quoted 7 lines
drivers/phy/Kconfig +6
-0+ depends on PHY + help + Support for a no-op PHY + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardwarePHY).
This really is only useful if there is no dedicated PHY.
Also during the transition from platform code to DM code for the PHY. It allows setting up the 'client' driver first, and then the PHY driver.
You should implement a proper driver, we should not advertise this possibility.
Quoted 61 lines
Quoted 60 lines
drivers/phy/Kconfig config PHY_SANDBOX · line 54
Quoted 2 lines
drivers/phy/Kconfig +2
-0+config SPL_NOOP_PHY + bool "no-op phy in SPL"DTTO
Quoted 55 lines
drivers/phy/Kconfig +6
-0+ depends on SPL_PHY + help + Support for a no-op PHY in SPL + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardwarePHY).
drivers/phy/Kconfig +1
-0+ config PIPE3_PHY bool "Support omap's PIPE3 PHY" depends on PHY && ARCH_OMAP2PLUSdrivers/phy/Makefile +1
-0@@ -6,5 +6,6 @@ # obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o +obj-$(CONFIG_$(SPL_)NOOP_PHY) += noop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.odrivers/phy/noop-phy.c new file +2
-0@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Written by Jean-Jacques Hiblot <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */drivers/phy/noop-phy.c new file +20
-0+ +#include <common.h> +#include <dm.h> +#include <dm/device.h> +#include <generic-phy.h> + +static const struct udevice_id noop_phy_ids[] = { + { .compatible ="noop-phy" }, + { } +}; + +static struct phy_ops noop_phy_ops = { +}; + +U_BOOT_DRIVER (noop_phy) = { + .name ="noop_phy" , + .id =UCLASS_PHY , + .of_match = noop_phy_ids, + .ops = &noop_phy_ops, +};
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 phy: add a NO-OP phy driver
In reply to Jean-Jacques HiblotHi Jean Jacques
Quoted 27 lines · Jean-Jacques Hiblot
The no-op phy driver is useful when a driver uses the phy framework but no PHY driver is available for the hardware (or the hardware has no PHY).
Signed-off-by Jean-Jacques Hiblot <[email protected]>---
Following the email thread '[PATCH 1/1] dm: phy: add missing #ifdef
CONFIG_PHY', here is a patch to add support for a no-op phy.Jean-Jacques
Documentation/devicetree/bindings/phy/no-op.txt | 16 +++++++++++++++ drivers/phy/Kconfig | 18 +++++++++++++++++ drivers/phy/Makefile | 1 + drivers/phy/noop-phy.c | 26 +++++++++++++++++++++++++ 4 files changed, 61 insertions(+)create mode 100644
Documentation/devicetree/bindings/phy/no-op.txtcreate mode 100644drivers/phy/noop-phy.cDocumentation/devicetree/bindings/phy/no-op.txt new file +0
-0
Documentation/devicetree/bindings/phy/no-op.txt line 3
Quoted 3 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +3
-0@@ -0,0 +1,16 @@ +NO-OP Phy driver + +The driver is used to stub PHY opeartions in a driver (USB, SATA).
typo opeartions
Quoted 76 lines
Documentation/devicetree/bindings/phy/no-op.txt new file +13
-0+This is useful when the PHY driver for a particular hardware doesn't exist yet +(the hardware is initialized by the platform code). + +Required properties: +- compatible : must contain "noop-phy" +- #phy-cells : must contain <0> + +Example: + +noop_phy { + compatible = "noop-phy"; + #phy-cells = <0>; +};drivers/phy/Kconfig +18
-0@@ -41,6 +41,24 @@ config PHY_SANDBOX This select a dummy sandbox PHY driver. It used only to implement the unit tests for the phy framework +config NOOP_PHY + bool "no-op phy" + depends on PHY + help + Support for a no-op PHY + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + +config SPL_NOOP_PHY + bool "no-op phy in SPL" + depends on SPL_PHY + help + Support for a no-op PHY in SPL + + This is useful when a driver uses the PHY framework but no driver + has yet been written for the PHY (or if there is no hardware PHY). + config PIPE3_PHY bool "Support omap's PIPE3 PHY" depends on PHY && ARCH_OMAP2PLUSdrivers/phy/Makefile +1
-0@@ -6,5 +6,6 @@ # obj-$(CONFIG_$(SPL_)PHY) += phy-uclass.o +obj-$(CONFIG_$(SPL_)NOOP_PHY) += noop-phy.o obj-$(CONFIG_PHY_SANDBOX) += sandbox-phy.o obj-$(CONFIG_$(SPL_)PIPE3_PHY) += ti-pipe3-phy.odrivers/phy/noop-phy.c new file +16
-0@@ -0,0 +1,26 @@ +/* +* Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/ +* Written by Jean-Jacques Hiblot <[email protected]> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <dm.h> +#include <dm/device.h> +#include <generic-phy.h> + +static const struct udevice_id noop_phy_ids[] = { + { .compatible ="noop-phy" }, + { } +};
drivers/phy/noop-phy.c line 26
Quoted 10 lines
drivers/phy/noop-phy.c new file +10
-0+ +static struct phy_ops noop_phy_ops = { +}; + +U_BOOT_DRIVER (noop_phy) = { + .name ="noop_phy" , + .id =UCLASS_PHY , + .of_match = noop_phy_ids, + .ops = &noop_phy_ops, +};
This solution is more elegant ;-)
Merci