drivers: Add reset ctrl to drivers
Subsystems (2)
v4 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.
v4 change:
- Add patch to check CONFIG_SPL_RESET_SUPPORT in reset.h
History:
v1: https://patchwork.ozlabs.org/cover/905519/
v2: https://patchwork.ozlabs.org/cover/908667/
v3: https://patchwork.ozlabs.org/cover/910018/
Ley Foon Tan (4):
include: reset: check CONFIG_SPL_RESET_SUPPORT
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 | 17 +++++++++++++++++ drivers/net/designware.c | 8 ++++++++ drivers/serial/ns16550.c | 8 ++++++++ include/reset.h | 3 ++- 4 files changed, 35 insertions(+), 1 deletion(-)
Signature · 1 line
2.2.2
PATCH v4 1/4 include: reset: check CONFIG_SPL_RESET_SUPPORT
Add checking for CONFIG_SPL_RESET_SUPPORT to fix compilation error when CONFIG_DM_RESET is enabled but CONFIG_SPL_RESET_SUPPORT is disabled in SPL build.
--- include/reset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/reset.h +2 -1
@@ -77,7 +77,8 @@ struct reset_ctl_bulk {unsigned int count; }; -#ifdef CONFIG_DM_RESET +#if (!defined(CONFIG_SPL_BUILD ) && defined(CONFIG_DM_RESET )) || \ + (defined(CONFIG_SPL_RESET_SUPPORT ) && defined(CONFIG_DM_RESET ))/** * reset_get_by_index - Get/request a reset signal by integer index. *
Signature · 1 line
2.2.2
PATCH v4 1/4 include: reset: check CONFIG_SPL_RESET_SUPPORT
Hi,
Quoted 14 lines · Ley Foon Tan
Add checking for
CONFIG_SPL_RESET_SUPPORTto fix compilation error whenCONFIG_DM_RESETis enabled butCONFIG_SPL_RESET_SUPPORTis disabled in SPL build.Signed-off-by Ley Foon Tan <[email protected]>--- include/reset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)include/reset.h +0
-0
include/reset.h struct reset_ctl_bulk { · line 81
Quoted 6 lines
include/reset.h +2
-1@@ -77,7 +77,8 @@ struct reset_ctl_bulk {unsigned int count; }; -#ifdef CONFIG_DM_RESET +#if (!defined(CONFIG_SPL_BUILD ) && defined(CONFIG_DM_RESET )) || \ + (defined(CONFIG_SPL_RESET_SUPPORT ) && defined(CONFIG_DM_RESET ))
CONFIG_SPL_RESET_SUPPORT should move to Kconfig
Also it should be renamed to CONFIG_SPL_DM_RESET
so that you can use:
#if CONFIG_IS_ENABLED(DM_RESET)
Quoted 6 lines
include/reset.h +0
-1/** * reset_get_by_index - Get/request a reset signal by integer index. * -- 2.2.2
Regards,
Simon
PATCH v4 1/4 include: reset: check CONFIG_SPL_RESET_SUPPORT
Quoted 20 lines · Simon Glass
Hi,
Quoted 17 lines · Ley Foon Tan
Add checking for
CONFIG_SPL_RESET_SUPPORTto fix compilation error whenCONFIG_DM_RESETis enabled butCONFIG_SPL_RESET_SUPPORTis disabled in SPL build.Signed-off-by Ley Foon Tan <[email protected]>--- include/reset.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)include/reset.h +0
-0@@ -77,7 +77,8 @@ struct reset_ctl_bulk {unsigned int count; };
Quoted 5 lines
include/reset.h struct reset_ctl_bulk { · line 81
Quoted 3 lines
include/reset.h +2
-1-#ifdef CONFIG_DM_RESET +#if (!defined(CONFIG_SPL_BUILD ) && defined(CONFIG_DM_RESET )) || \ + (defined(CONFIG_SPL_RESET_SUPPORT ) && defined(CONFIG_DM_RESET ))
CONFIG_SPL_RESET_SUPPORTshould move toKconfig
This config is in Kconfig already.
Quoted 2 lines
Also it should be renamed to
CONFIG_SPL_DM_RESET
Okay.
Quoted 4 lines
so that you can use:
#if
CONFIG_IS_ENABLED(DM_RESET)
Okay, will send new patch for this.
Regards
Ley Foon
PATCH v4 2/4 mmc: dwmmc: socfpga: Add reset ctrl to driver
In reply to Ley Foon TanAdd 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 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/mmc/socfpga_dw_mmc.c +17 -0
@@ -13,6 +13,7 @@#include <linux/libfdt.h> #include <linux/err.h> #include <malloc.h> +#include <reset.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -33,6 +34,20 @@ struct dwmci_socfpga_priv_data {unsigned int smplsel; }; +static void socfpga_dwmci_reset (struct udevice *dev) +{ +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); +} +static void socfpga_dwmci_clksel (struct dwmci_host *host) {struct dwmci_socfpga_priv_data *priv = host->priv;
@@ -109,6 +124,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
2.2.2
PATCH v4 2/4 mmc: dwmmc: socfpga: Add reset ctrl to driver
Quoted 10 lines · Ley Foon Tan
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 <[email protected]>--- drivers/mmc/socfpga_dw_mmc.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
PATCH v4 3/4 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 | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/serial/ns16550.c +8 -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 )
@@ -370,6 +372,12 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)int ns16550_serial_probe (struct udevice *dev) {struct NS16550 *const com_port =dev_get_priv (dev); +struct reset_ctl_bulk reset_bulk; +int ret; + + ret =reset_get_bulk (dev, &reset_bulk); +if (!ret) +reset_deassert_bulk (&reset_bulk); com_port->plat =dev_get_platdata (dev);NS16550_init (com_port,-1 );
Signature · 1 line
2.2.2
PATCH v4 3/4 serial: ns16550: Add reset ctrl to driver
Quoted 12 lines · Ley Foon Tan
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 <[email protected]>Reviewed-by Marek Vasut <[email protected]>--- drivers/serial/ns16550.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Quoted 13 lines
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>
drivers/serial/ns16550.c void NS16550_init(NS16550_t com_port, int baud_divisor) · line 181
Quoted 4 lines
drivers/serial/ns16550.c +1
-0@@ -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 +
Unrelated change?
Quoted 19 lines
drivers/serial/ns16550.c +6
-1serial_out (UART_MCRVAL , &com_port->mcr);serial_out (ns16550_getfcr (com_port), &com_port->fcr);if (baud_divisor !=-1 )@@ -370,6 +372,12 @@ static int ns16550_serial_setbrg(struct udevice *dev, int baudrate)int ns16550_serial_probe (struct udevice *dev) {struct NS16550 *const com_port =dev_get_priv (dev); +struct reset_ctl_bulk reset_bulk; +int ret; + + ret =reset_get_bulk (dev, &reset_bulk); +if (!ret) +reset_deassert_bulk (&reset_bulk); com_port->plat =dev_get_platdata (dev);NS16550_init (com_port,-1 ); --2.2.2
PATCH v4 4/4 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 | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/designware.c +8 -0
@@ -15,6 +15,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>
@@ -664,6 +665,7 @@ int designware_eth_probe(struct udevice *dev)u32 iobase = pdata->iobase;ulong ioaddr;int ret; +struct reset_ctl_bulk reset_bulk;#ifdef CONFIG_CLK int i, err, clock_nb;
@@ -710,6 +712,12 @@ int designware_eth_probe(struct udevice *dev) }#endif + 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); +#ifdef CONFIG_DM_PCI /* * If we are on PCI bus, either directly attached to a PCI root port,
Signature · 1 line
2.2.2
PATCH v4 4/4 net: designware: Add reset ctrl to driver
Quoted 10 lines · Ley Foon Tan
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 <[email protected]>--- drivers/net/designware.c | 8 ++++++++ 1 file changed, 8 insertions(+)
PATCH v4 4/4 net: designware: Add reset ctrl to driver
In reply to Ley Foon TanQuoted 7 lines · Ley Foon Tan
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 <[email protected]>