All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] phy: add a NO-OP phy driver
@ 2017-07-21  8:49 Jean-Jacques Hiblot
  2017-07-21  9:03 ` Marek Vasut
  2017-07-21 11:08 ` Patrice CHOTARD
  0 siblings, 2 replies; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2017-07-21  8:49 UTC (permalink / raw
  To: u-boot

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 <jjhiblot@ti.com>
---

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

diff --git a/Documentation/devicetree/bindings/phy/no-op.txt b/Documentation/devicetree/bindings/phy/no-op.txt
new file mode 100644
index 0000000..eb1a562
--- /dev/null
+++ b/Documentation/devicetree/bindings/phy/no-op.txt
@@ -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>;
+};
diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
index 7841554..68dced7 100644
--- a/drivers/phy/Kconfig
+++ b/drivers/phy/Kconfig
@@ -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
diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
index 6ce96d2..f129b5c 100644
--- a/drivers/phy/Makefile
+++ b/drivers/phy/Makefile
@@ -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
diff --git a/drivers/phy/noop-phy.c b/drivers/phy/noop-phy.c
new file mode 100644
index 0000000..14ccf86
--- /dev/null
+++ b/drivers/phy/noop-phy.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
+ * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
+ *
+ * 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,
+};
-- 
1.9.1

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

* [U-Boot] [PATCH] phy: add a NO-OP phy driver
  2017-07-21  8:49 [U-Boot] [PATCH] phy: add a NO-OP phy driver Jean-Jacques Hiblot
@ 2017-07-21  9:03 ` Marek Vasut
  2017-07-21 12:12   ` Patrick DELAUNAY
  2017-07-21 12:55   ` Jean-Jacques Hiblot
  2017-07-21 11:08 ` Patrice CHOTARD
  1 sibling, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2017-07-21  9:03 UTC (permalink / raw
  To: u-boot

On 07/21/2017 10:49 AM, Jean-Jacques Hiblot wrote:
> 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 <jjhiblot@ti.com>
> ---
> 
> 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
> 
> diff --git a/Documentation/devicetree/bindings/phy/no-op.txt b/Documentation/devicetree/bindings/phy/no-op.txt
> new file mode 100644
> index 0000000..eb1a562
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/no-op.txt
> @@ -0,0 +1,16 @@
> +NO-OP Phy driver
> +
> +The driver is used to stub PHY opeartions in a driver (USB, SATA).

operations

> +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>;
> +};
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 7841554..68dced7 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -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.

> +	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.

> +config SPL_NOOP_PHY
> +	bool "no-op phy in SPL"

DTTO

> +	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
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 6ce96d2..f129b5c 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -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
> diff --git a/drivers/phy/noop-phy.c b/drivers/phy/noop-phy.c
> new file mode 100644
> index 0000000..14ccf86
> --- /dev/null
> +++ b/drivers/phy/noop-phy.c
> @@ -0,0 +1,26 @@
> +/*
> + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
> + * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
> + *
> + * 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,
> +};
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] phy: add a NO-OP phy driver
  2017-07-21  8:49 [U-Boot] [PATCH] phy: add a NO-OP phy driver Jean-Jacques Hiblot
  2017-07-21  9:03 ` Marek Vasut
@ 2017-07-21 11:08 ` Patrice CHOTARD
  1 sibling, 0 replies; 6+ messages in thread
From: Patrice CHOTARD @ 2017-07-21 11:08 UTC (permalink / raw
  To: u-boot

Hi Jean Jacques



On 07/21/2017 10:49 AM, Jean-Jacques Hiblot wrote:
> 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 <jjhiblot@ti.com>
> ---
> 
> 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
> 
> diff --git a/Documentation/devicetree/bindings/phy/no-op.txt b/Documentation/devicetree/bindings/phy/no-op.txt
> new file mode 100644
> index 0000000..eb1a562
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/phy/no-op.txt
> @@ -0,0 +1,16 @@
> +NO-OP Phy driver
> +
> +The driver is used to stub PHY opeartions in a driver (USB, SATA).

typo opeartions

> +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>;
> +};
> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
> index 7841554..68dced7 100644
> --- a/drivers/phy/Kconfig
> +++ b/drivers/phy/Kconfig
> @@ -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
> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
> index 6ce96d2..f129b5c 100644
> --- a/drivers/phy/Makefile
> +++ b/drivers/phy/Makefile
> @@ -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
> diff --git a/drivers/phy/noop-phy.c b/drivers/phy/noop-phy.c
> new file mode 100644
> index 0000000..14ccf86
> --- /dev/null
> +++ b/drivers/phy/noop-phy.c
> @@ -0,0 +1,26 @@
> +/*
> + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
> + * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
> + *
> + * 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,
> +};
> 

This solution is more elegant ;-)

Merci

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

* [U-Boot] [PATCH] phy: add a NO-OP phy driver
  2017-07-21  9:03 ` Marek Vasut
@ 2017-07-21 12:12   ` Patrick DELAUNAY
  2017-07-21 12:55   ` Jean-Jacques Hiblot
  1 sibling, 0 replies; 6+ messages in thread
From: Patrick DELAUNAY @ 2017-07-21 12:12 UTC (permalink / raw
  To: u-boot

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 <jjhiblot@ti.com>; Patrice CHOTARD <patrice.chotard@st.com>; u-boot at lists.denx.de; sjg at chromium.org
Cc: ran.wang_1 at nxp.com; Christophe KERELLO <christophe.kerello@st.com>
Subject: Re: [U-Boot] [PATCH] phy: add a NO-OP phy driver

On 07/21/2017 10:49 AM, Jean-Jacques Hiblot wrote:
> 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 <jjhiblot@ti.com>


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

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

* [U-Boot] [PATCH] phy: add a NO-OP phy driver
  2017-07-21  9:03 ` Marek Vasut
  2017-07-21 12:12   ` Patrick DELAUNAY
@ 2017-07-21 12:55   ` Jean-Jacques Hiblot
  2017-07-21 13:30     ` Marek Vasut
  1 sibling, 1 reply; 6+ messages in thread
From: Jean-Jacques Hiblot @ 2017-07-21 12:55 UTC (permalink / raw
  To: u-boot



On 21/07/2017 11:03, Marek Vasut wrote:
> On 07/21/2017 10:49 AM, Jean-Jacques Hiblot wrote:
>> 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 <jjhiblot@ti.com>
>> ---
>>
>> 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
>>
>> diff --git a/Documentation/devicetree/bindings/phy/no-op.txt b/Documentation/devicetree/bindings/phy/no-op.txt
>> new file mode 100644
>> index 0000000..eb1a562
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/phy/no-op.txt
>> @@ -0,0 +1,16 @@
>> +NO-OP Phy driver
>> +
>> +The driver is used to stub PHY opeartions in a driver (USB, SATA).
> operations
>
>> +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>;
>> +};
>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>> index 7841554..68dced7 100644
>> --- a/drivers/phy/Kconfig
>> +++ b/drivers/phy/Kconfig
>> @@ -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.
It's not that I want to induce in sloppiness, but I can't come up with a 
better description.
Suggestions are welcome.
>
>> +	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.

>
>> +config SPL_NOOP_PHY
>> +	bool "no-op phy in SPL"
> DTTO
>
>> +	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
>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
>> index 6ce96d2..f129b5c 100644
>> --- a/drivers/phy/Makefile
>> +++ b/drivers/phy/Makefile
>> @@ -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
>> diff --git a/drivers/phy/noop-phy.c b/drivers/phy/noop-phy.c
>> new file mode 100644
>> index 0000000..14ccf86
>> --- /dev/null
>> +++ b/drivers/phy/noop-phy.c
>> @@ -0,0 +1,26 @@
>> +/*
>> + * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
>> + * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
>> + *
>> + * 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,
>> +};
>>
>

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

* [U-Boot] [PATCH] phy: add a NO-OP phy driver
  2017-07-21 12:55   ` Jean-Jacques Hiblot
@ 2017-07-21 13:30     ` Marek Vasut
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Vasut @ 2017-07-21 13:30 UTC (permalink / raw
  To: u-boot

On 07/21/2017 02:55 PM, Jean-Jacques Hiblot wrote:
> 
> 
> On 21/07/2017 11:03, Marek Vasut wrote:
>> On 07/21/2017 10:49 AM, Jean-Jacques Hiblot wrote:
>>> 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 <jjhiblot@ti.com>
>>> ---
>>>
>>> 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
>>>
>>> diff --git a/Documentation/devicetree/bindings/phy/no-op.txt
>>> b/Documentation/devicetree/bindings/phy/no-op.txt
>>> new file mode 100644
>>> index 0000000..eb1a562
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/phy/no-op.txt
>>> @@ -0,0 +1,16 @@
>>> +NO-OP Phy driver
>>> +
>>> +The driver is used to stub PHY opeartions in a driver (USB, SATA).
>> operations
>>
>>> +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>;
>>> +};
>>> diff --git a/drivers/phy/Kconfig b/drivers/phy/Kconfig
>>> index 7841554..68dced7 100644
>>> --- a/drivers/phy/Kconfig
>>> +++ b/drivers/phy/Kconfig
>>> @@ -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.
> 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 ?

>>> +    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.

You should implement a proper driver, we should not advertise this
possibility.

>>> +config SPL_NOOP_PHY
>>> +    bool "no-op phy in SPL"
>> DTTO
>>
>>> +    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
>>> diff --git a/drivers/phy/Makefile b/drivers/phy/Makefile
>>> index 6ce96d2..f129b5c 100644
>>> --- a/drivers/phy/Makefile
>>> +++ b/drivers/phy/Makefile
>>> @@ -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
>>> diff --git a/drivers/phy/noop-phy.c b/drivers/phy/noop-phy.c
>>> new file mode 100644
>>> index 0000000..14ccf86
>>> --- /dev/null
>>> +++ b/drivers/phy/noop-phy.c
>>> @@ -0,0 +1,26 @@
>>> +/*
>>> + * Copyright (C) 2017 Texas Instruments Incorporated -
>>> http://www.ti.com/
>>> + * Written by Jean-Jacques Hiblot  <jjhiblot@ti.com>
>>> + *
>>> + * 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,
>>> +};
>>>
>>
> 


-- 
Best regards,
Marek Vasut

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

end of thread, other threads:[~2017-07-21 13:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21  8:49 [U-Boot] [PATCH] phy: add a NO-OP phy driver Jean-Jacques Hiblot
2017-07-21  9:03 ` Marek Vasut
2017-07-21 12:12   ` Patrick DELAUNAY
2017-07-21 12:55   ` Jean-Jacques Hiblot
2017-07-21 13:30     ` Marek Vasut
2017-07-21 11:08 ` Patrice CHOTARD

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.