drivers: Add reset ctrl to drivers
Subsystems (2)
v2 cover drivers: Add reset ctrl to drivers
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(-)
PATCH v2 1/3 mmc: dwmmc: socfpga: Add reset ctrl to driver
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.
--- drivers/mmc/socfpga_dw_mmc.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/mmc/socfpga_dw_mmc.c +19 -0
@@ -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;
Signature · 1 line
1.7.1
PATCH v2 2/3 serial: ns16550: Add reset ctrl to driver
In reply to Ley Foon TanAdd 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.
--- drivers/serial/ns16550.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/serial/ns16550.c +12 -0
@@ -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 );
Signature · 1 line
1.7.1
Nguyen
PATCH v2 2/3 serial: ns16550: Add reset ctrl to driver
Quoted 45 lines
-----Original Message-----
From: Tan, Ley Foon
Sent: Friday, May 4, 2018 5:49 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Nguyen, Dinh <[email protected]>; Tan, Ley Foon <[email protected]>
Subject: [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driverAdd 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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>--- drivers/serial/ns16550.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)drivers/serial/ns16550.c index renamed from drivers/serial/ns16550.c +0
-053550bf..457b636 100644
drivers/serial/ns16550.c +1
-0@@ -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*/
#endifdrivers/serial/ns16550.c +1
-0+serial_out (UART_MCRVAL , &com_port->mcr);serial_out (ns16550_getfcr (com_port), &com_port->fcr);if (baud_divisor !=-1 )
drivers/serial/ns16550.c int ns16550_serial_probe(struct udevice *dev) { · line 375
Quoted 3 lines
drivers/serial/ns16550.c +1
-0@@ -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.
Quoted 14 lines
drivers/serial/ns16550.c +9
-1+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
PATCH v2 2/3 serial: ns16550: Add reset ctrl to driver
Quoted 47 lines · Dinh
Quoted 47 lines
-----Original Message-----
From: Tan, Ley Foon
Sent: Friday, May 4, 2018 5:49 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Nguyen, Dinh <[email protected]>; Tan, Ley Foon <[email protected]>
Subject: [PATCH v2 2/3] serial: ns16550: Add reset ctrl to driverAdd 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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>--- drivers/serial/ns16550.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-)drivers/serial/ns16550.c index renamed from drivers/serial/ns16550.c +0
-053550bf..457b636 100644
drivers/serial/ns16550.c +1
-0@@ -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*/
#endifdrivers/serial/ns16550.c +1
-0+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);
Quoted 3 lines
drivers/serial/ns16550.c int ns16550_serial_probe(struct udevice *dev) · line 376
Quoted 1 line
drivers/serial/ns16550.c +1
-0+#ifdef CONFIG_DM_RESET You don't need this wrapper.
Noted.
Quoted 16 lines
Quoted 15 lines
drivers/serial/ns16550.c +9
-1+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
PATCH v2 3/3 net: designware: Add reset ctrl to driver
In reply to Ley Foon TanAdd 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.
--- drivers/net/designware.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
drivers/net/designware.c +11 -0
@@ -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,
Signature · 1 line
1.7.1
Nguyen
PATCH v2 3/3 net: designware: Add reset ctrl to driver
Quoted 36 lines
-----Original Message-----
From: Tan, Ley Foon
Sent: Friday, May 4, 2018 5:49 AM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Ley Foon Tan <[email protected]>; See, Chin Liang <[email protected]>; Nguyen, Dinh <[email protected]>; Tan, Ley Foon <[email protected]>
Subject: [PATCH v2 3/3] net: designware: Add reset ctrl to driverAdd 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 <[email protected]>--- drivers/net/designware.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)drivers/net/designware.c index renamed from drivers/net/designware.c +0
-0765e356..03ef1eb 100644
drivers/net/designware.c +1
-0@@ -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>
drivers/net/designware.c int designware_eth_probe(struct udevice *dev) · line 715
Quoted 4 lines
drivers/net/designware.c +1
-0@@ -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
Quoted 14 lines
drivers/net/designware.c +9
-1+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
v2 cover drivers: Add reset ctrl to drivers
In reply to Ley Foon TanQuoted 26 lines · Ley Foon Tan
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 insocfpga_dw_mmc.cbecause it didn't call to common dwmmc probe function when in SPL.
- add reviewed-by in ns16550 patchHistory:
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
Quoted 4 lines
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