All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers
@ 2018-05-04 10:49 Ley Foon Tan
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver Ley Foon Tan
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-05-04 10:49 UTC (permalink / raw)
  To: u-boot

Add reset ctrl to dwmmc socfpga, designware Ethernet and ns16550 serial drivers.

A reset property is an optional feature, so only print out a warning and
do not fail if a reset property is not present.
    
If a reset property is discovered, then use it to deassert, thus bringing the
IP out of reset.

This is preparation to upstream Intel Stratix 10 SoC support in [1].

v2 change:
- remove 'return' in designware emac driver
- keep reset control in socfpga_dw_mmc.c because it didn't call to common dwmmc probe
  function when in SPL.
- add reviewed-by in ns16550 patch

History:
v1: https://patchwork.ozlabs.org/cover/905519/

[1]: https://patchwork.ozlabs.org/cover/900499/

Ley Foon Tan (3):
  mmc: dwmmc: socfpga: Add reset ctrl to driver
  serial: ns16550: Add reset ctrl to driver
  net: designware: Add reset ctrl to driver

 drivers/mmc/socfpga_dw_mmc.c |   19 +++++++++++++++++++
 drivers/net/designware.c     |   11 +++++++++++
 drivers/serial/ns16550.c     |   12 ++++++++++++
 3 files changed, 42 insertions(+), 0 deletions(-)

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

* [U-Boot] [PATCH v2 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver
  2018-05-04 10:49 [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
@ 2018-05-04 10:49 ` Ley Foon Tan
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 2/3] serial: ns16550: " Ley Foon Tan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-05-04 10:49 UTC (permalink / raw)
  To: u-boot

Add code to reset all reset signals as in mmc DT node. A reset property is an optional feature,
so only print out a warning and do not fail if a reset property is not present.

If a reset property is discovered, then use it to deassert, thus bringing the
IP out of reset.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/mmc/socfpga_dw_mmc.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
index 9ace505..6458191 100644
--- a/drivers/mmc/socfpga_dw_mmc.c
+++ b/drivers/mmc/socfpga_dw_mmc.c
@@ -14,6 +14,7 @@
 #include <linux/libfdt.h>
 #include <linux/err.h>
 #include <malloc.h>
+#include <reset.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -34,6 +35,22 @@ struct dwmci_socfpga_priv_data {
 	unsigned int		smplsel;
 };
 
+static void socfpga_dwmci_reset(struct udevice *dev)
+{
+#ifdef CONFIG_DM_RESET
+	struct reset_ctl_bulk reset_bulk;
+	int ret;
+
+	ret = reset_get_bulk(dev, &reset_bulk);
+	if (ret) {
+	       dev_warn(dev, "Can't get reset: %d\n", ret);
+	       return;
+	}
+
+	reset_deassert_bulk(&reset_bulk);
+#endif
+}
+
 static void socfpga_dwmci_clksel(struct dwmci_host *host)
 {
 	struct dwmci_socfpga_priv_data *priv = host->priv;
@@ -110,6 +127,8 @@ static int socfpga_dwmmc_probe(struct udevice *dev)
 	struct dwmci_socfpga_priv_data *priv = dev_get_priv(dev);
 	struct dwmci_host *host = &priv->host;
 
+	socfpga_dwmci_reset(dev);
+
 #ifdef CONFIG_BLK
 	dwmci_setup_cfg(&plat->cfg, host, host->bus_hz, 400000);
 	host->mmc = &plat->mmc;
-- 
1.7.1

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

* [U-Boot] [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driver
  2018-05-04 10:49 [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver Ley Foon Tan
@ 2018-05-04 10:49 ` Ley Foon Tan
  2018-05-04 14:30   ` Nguyen, Dinh
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 3/3] net: designware: " Ley Foon Tan
  2018-05-07 21:18 ` [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Dinh Nguyen
  3 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-05-04 10:49 UTC (permalink / raw)
  To: u-boot

Add code to reset all reset signals as in serial DT node. A reset property is an optional feature,
so do not fail if a reset property is not present.

If a reset property is discovered, then use it to deassert, thus bringing the
IP out of reset.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
Reviewed-by: Marek Vasut <marex@denx.de>
---
 drivers/serial/ns16550.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 53550bf..457b636 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <ns16550.h>
+#include <reset.h>
 #include <serial.h>
 #include <watchdog.h>
 #include <linux/types.h>
@@ -177,6 +178,7 @@ void NS16550_init(NS16550_t com_port, int baud_divisor)
 #if defined(CONFIG_ARCH_OMAP2PLUS)
 	serial_out(0x7, &com_port->mdr1);	/* mode select reset TL16C750*/
 #endif
+
 	serial_out(UART_MCRVAL, &com_port->mcr);
 	serial_out(ns16550_getfcr(com_port), &com_port->fcr);
 	if (baud_divisor != -1)
@@ -371,6 +373,16 @@ int ns16550_serial_probe(struct udevice *dev)
 {
 	struct NS16550 *const com_port = dev_get_priv(dev);
 
+#ifdef CONFIG_DM_RESET
+	struct reset_ctl_bulk reset_bulk;
+	int ret;
+
+	ret = reset_get_bulk(dev, &reset_bulk);
+	if (!ret)
+		reset_deassert_bulk(&reset_bulk);
+
+#endif
+
 	com_port->plat = dev_get_platdata(dev);
 	NS16550_init(com_port, -1);
 
-- 
1.7.1

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

* [U-Boot] [PATCH v2 3/3] net: designware: Add reset ctrl to driver
  2018-05-04 10:49 [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver Ley Foon Tan
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 2/3] serial: ns16550: " Ley Foon Tan
@ 2018-05-04 10:49 ` Ley Foon Tan
  2018-05-04 14:30   ` Nguyen, Dinh
  2018-05-07 21:18 ` [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Dinh Nguyen
  3 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-05-04 10:49 UTC (permalink / raw)
  To: u-boot

Add code to reset all reset signals as in Ethernet DT node. A reset property is an optional feature,
so only print out a warning and do not fail if a reset property is not present.

If a reset property is discovered, then use it to deassert, thus bringing the
IP out of reset.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 drivers/net/designware.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index 765e356..03ef1eb 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -16,6 +16,7 @@
 #include <miiphy.h>
 #include <malloc.h>
 #include <pci.h>
+#include <reset.h>
 #include <linux/compiler.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
@@ -711,6 +712,16 @@ int designware_eth_probe(struct udevice *dev)
 	}
 #endif
 
+#ifdef CONFIG_DM_RESET
+	struct reset_ctl_bulk reset_bulk;
+
+	ret = reset_get_bulk(dev, &reset_bulk);
+	if (ret)
+		dev_warn(dev, "Can't get reset: %d\n", ret);
+	else
+		reset_deassert_bulk(&reset_bulk);
+#endif
+
 #ifdef CONFIG_DM_PCI
 	/*
 	 * If we are on PCI bus, either directly attached to a PCI root port,
-- 
1.7.1

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

* [U-Boot] [PATCH v2 3/3] net: designware: Add reset ctrl to driver
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 3/3] net: designware: " Ley Foon Tan
@ 2018-05-04 14:30   ` Nguyen, Dinh
  0 siblings, 0 replies; 8+ messages in thread
From: Nguyen, Dinh @ 2018-05-04 14:30 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Tan, Ley Foon
> Sent: Friday, May 4, 2018 5:49 AM
> To: u-boot at lists.denx.de
> Cc: Marek Vasut <marex@denx.de>; Ley Foon Tan <lftan.linux@gmail.com>;
> See, Chin Liang <chin.liang.see@intel.com>; Nguyen, Dinh
> <dinh.nguyen@intel.com>; Tan, Ley Foon <ley.foon.tan@intel.com>
> Subject: [PATCH v2 3/3] net: designware: Add reset ctrl to driver
> 
> Add code to reset all reset signals as in Ethernet DT node. A reset property is an
> optional feature, so only print out a warning and do not fail if a reset property is
> not present.
> 
> If a reset property is discovered, then use it to deassert, thus bringing the IP out
> of reset.
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> ---
>  drivers/net/designware.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/net/designware.c b/drivers/net/designware.c index
> 765e356..03ef1eb 100644
> --- a/drivers/net/designware.c
> +++ b/drivers/net/designware.c
> @@ -16,6 +16,7 @@
>  #include <miiphy.h>
>  #include <malloc.h>
>  #include <pci.h>
> +#include <reset.h>
>  #include <linux/compiler.h>
>  #include <linux/err.h>
>  #include <linux/kernel.h>
> @@ -711,6 +712,16 @@ int designware_eth_probe(struct udevice *dev)
>  	}
>  #endif
> 
> +#ifdef CONFIG_DM_RESET

You don't need the above wrapper. It's already checked in reset.h

> +	struct reset_ctl_bulk reset_bulk;
> +
> +	ret = reset_get_bulk(dev, &reset_bulk);
> +	if (ret)
> +		dev_warn(dev, "Can't get reset: %d\n", ret);
> +	else
> +		reset_deassert_bulk(&reset_bulk);
> +#endif
> +
>  #ifdef CONFIG_DM_PCI
>  	/*
>  	 * If we are on PCI bus, either directly attached to a PCI root port,
> --
> 1.7.1

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

* [U-Boot] [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driver
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 2/3] serial: ns16550: " Ley Foon Tan
@ 2018-05-04 14:30   ` Nguyen, Dinh
  2018-05-07  2:09     ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Nguyen, Dinh @ 2018-05-04 14:30 UTC (permalink / raw)
  To: u-boot



> -----Original Message-----
> From: Tan, Ley Foon
> Sent: Friday, May 4, 2018 5:49 AM
> To: u-boot at lists.denx.de
> Cc: Marek Vasut <marex@denx.de>; Ley Foon Tan <lftan.linux@gmail.com>;
> See, Chin Liang <chin.liang.see@intel.com>; Nguyen, Dinh
> <dinh.nguyen@intel.com>; Tan, Ley Foon <ley.foon.tan@intel.com>
> Subject: [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driver
> 
> Add code to reset all reset signals as in serial DT node. A reset property is an
> optional feature, so do not fail if a reset property is not present.
> 
> If a reset property is discovered, then use it to deassert, thus bringing the IP out
> of reset.
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
> Reviewed-by: Marek Vasut <marex@denx.de>
> ---
>  drivers/serial/ns16550.c |   12 ++++++++++++
>  1 files changed, 12 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index
> 53550bf..457b636 100644
> --- a/drivers/serial/ns16550.c
> +++ b/drivers/serial/ns16550.c
> @@ -9,6 +9,7 @@
>  #include <dm.h>
>  #include <errno.h>
>  #include <ns16550.h>
> +#include <reset.h>
>  #include <serial.h>
>  #include <watchdog.h>
>  #include <linux/types.h>
> @@ -177,6 +178,7 @@ void NS16550_init(NS16550_t com_port, int
> baud_divisor)  #if defined(CONFIG_ARCH_OMAP2PLUS)
>  	serial_out(0x7, &com_port->mdr1);	/* mode select reset
> TL16C750*/
>  #endif
> +
>  	serial_out(UART_MCRVAL, &com_port->mcr);
>  	serial_out(ns16550_getfcr(com_port), &com_port->fcr);
>  	if (baud_divisor != -1)
> @@ -371,6 +373,16 @@ int ns16550_serial_probe(struct udevice *dev)  {
>  	struct NS16550 *const com_port = dev_get_priv(dev);
> 
> +#ifdef CONFIG_DM_RESET

You don't need this wrapper.

> +	struct reset_ctl_bulk reset_bulk;
> +	int ret;
> +
> +	ret = reset_get_bulk(dev, &reset_bulk);
> +	if (!ret)
> +		reset_deassert_bulk(&reset_bulk);
> +
> +#endif
> +
>  	com_port->plat = dev_get_platdata(dev);
>  	NS16550_init(com_port, -1);
> 
> --
> 1.7.1

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

* [U-Boot] [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driver
  2018-05-04 14:30   ` Nguyen, Dinh
@ 2018-05-07  2:09     ` Ley Foon Tan
  0 siblings, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-05-07  2:09 UTC (permalink / raw)
  To: u-boot

On Fri, May 4, 2018 at 10:30 PM, Nguyen, Dinh <dinh.nguyen@intel.com> wrote:
>
>
>> -----Original Message-----
>> From: Tan, Ley Foon
>> Sent: Friday, May 4, 2018 5:49 AM
>> To: u-boot at lists.denx.de
>> Cc: Marek Vasut <marex@denx.de>; Ley Foon Tan <lftan.linux@gmail.com>;
>> See, Chin Liang <chin.liang.see@intel.com>; Nguyen, Dinh
>> <dinh.nguyen@intel.com>; Tan, Ley Foon <ley.foon.tan@intel.com>
>> Subject: [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driver
>>
>> Add code to reset all reset signals as in serial DT node. A reset property is an
>> optional feature, so do not fail if a reset property is not present.
>>
>> If a reset property is discovered, then use it to deassert, thus bringing the IP out
>> of reset.
>>
>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>> Reviewed-by: Marek Vasut <marex@denx.de>
>> ---
>>  drivers/serial/ns16550.c |   12 ++++++++++++
>>  1 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index
>> 53550bf..457b636 100644
>> --- a/drivers/serial/ns16550.c
>> +++ b/drivers/serial/ns16550.c
>> @@ -9,6 +9,7 @@
>>  #include <dm.h>
>>  #include <errno.h>
>>  #include <ns16550.h>
>> +#include <reset.h>
>>  #include <serial.h>
>>  #include <watchdog.h>
>>  #include <linux/types.h>
>> @@ -177,6 +178,7 @@ void NS16550_init(NS16550_t com_port, int
>> baud_divisor)  #if defined(CONFIG_ARCH_OMAP2PLUS)
>>       serial_out(0x7, &com_port->mdr1);       /* mode select reset
>> TL16C750*/
>>  #endif
>> +
>>       serial_out(UART_MCRVAL, &com_port->mcr);
>>       serial_out(ns16550_getfcr(com_port), &com_port->fcr);
>>       if (baud_divisor != -1)
>> @@ -371,6 +373,16 @@ int ns16550_serial_probe(struct udevice *dev)  {
>>       struct NS16550 *const com_port = dev_get_priv(dev);
>>
>> +#ifdef CONFIG_DM_RESET
>
> You don't need this wrapper.
Noted.
>
>> +     struct reset_ctl_bulk reset_bulk;
>> +     int ret;
>> +
>> +     ret = reset_get_bulk(dev, &reset_bulk);
>> +     if (!ret)
>> +             reset_deassert_bulk(&reset_bulk);
>> +
>> +#endif
>> +
>>       com_port->plat = dev_get_platdata(dev);
>>       NS16550_init(com_port, -1);
>>
>> --
>> 1.7.1
>

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

* [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers
  2018-05-04 10:49 [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
                   ` (2 preceding siblings ...)
  2018-05-04 10:49 ` [U-Boot] [PATCH v2 3/3] net: designware: " Ley Foon Tan
@ 2018-05-07 21:18 ` Dinh Nguyen
  3 siblings, 0 replies; 8+ messages in thread
From: Dinh Nguyen @ 2018-05-07 21:18 UTC (permalink / raw)
  To: u-boot

On Fri, May 4, 2018 at 5:49 AM, Ley Foon Tan <ley.foon.tan@intel.com> wrote:
> Add reset ctrl to dwmmc socfpga, designware Ethernet and ns16550 serial drivers.
>
> A reset property is an optional feature, so only print out a warning and
> do not fail if a reset property is not present.
>
> If a reset property is discovered, then use it to deassert, thus bringing the
> IP out of reset.
>
> This is preparation to upstream Intel Stratix 10 SoC support in [1].
>
> v2 change:
> - remove 'return' in designware emac driver
> - keep reset control in socfpga_dw_mmc.c because it didn't call to common dwmmc probe
>   function when in SPL.
> - add reviewed-by in ns16550 patch
>
> History:
> v1: https://patchwork.ozlabs.org/cover/905519/
>
> [1]: https://patchwork.ozlabs.org/cover/900499/
>
> Ley Foon Tan (3):
>   mmc: dwmmc: socfpga: Add reset ctrl to driver
>   serial: ns16550: Add reset ctrl to driver
>   net: designware: Add reset ctrl to driver
>
>  drivers/mmc/socfpga_dw_mmc.c |   19 +++++++++++++++++++
>  drivers/net/designware.c     |   11 +++++++++++
>  drivers/serial/ns16550.c     |   12 ++++++++++++
>  3 files changed, 42 insertions(+), 0 deletions(-)

Please run get_maintainer.pl on V3. You're forgetting to include the
maintainers on these subsystems.

Dinh

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

end of thread, other threads:[~2018-05-07 21:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-04 10:49 [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Ley Foon Tan
2018-05-04 10:49 ` [U-Boot] [PATCH v2 1/3] mmc: dwmmc: socfpga: Add reset ctrl to driver Ley Foon Tan
2018-05-04 10:49 ` [U-Boot] [PATCH v2 2/3] serial: ns16550: " Ley Foon Tan
2018-05-04 14:30   ` Nguyen, Dinh
2018-05-07  2:09     ` Ley Foon Tan
2018-05-04 10:49 ` [U-Boot] [PATCH v2 3/3] net: designware: " Ley Foon Tan
2018-05-04 14:30   ` Nguyen, Dinh
2018-05-07 21:18 ` [U-Boot] [PATCH v2 0/3] drivers: Add reset ctrl to drivers Dinh Nguyen

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.