Skip to contentSkip to conversation

drivers: Add reset ctrl to drivers

PATCH New Ley Foon Tan 4 participants 15 messages Jun 14, 2018 – Jul 10, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

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

v6:
- Include change history to patches and cover letter
- Added Joe's Acked-by in designware emac patch.

v5: https://patchwork.ozlabs.org/cover/924857/
- Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
- Change to use CONFIG_IS_ENABLED(DM_RESET) in reset.h
- Added Simon's Reviewed-by in dwmmc, 16550 serial and designware emac patches.

v4: https://patchwork.ozlabs.org/cover/923883/
- Add patch to check CONFIG_SPL_RESET_SUPPORT in reset.h

v3: https://patchwork.ozlabs.org/cover/910018/
- remove #ifdef CONFIG_DM_RESET switch
- add maintainer emails

v2: https://patchwork.ozlabs.org/cover/908667/
- 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

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

Ley Foon Tan (5):
reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)
mmc: dwmmc: socfpga: Add reset ctrl to driver
serial: ns16550: Add reset ctrl to driver
net: designware: Add reset ctrl to driver

 arch/arm/mach-stm32mp/Kconfig |  2 +-
 common/spl/Kconfig            |  2 +-
 drivers/Makefile              |  2 +-
 drivers/mmc/socfpga_dw_mmc.c  | 17 +++++++++++++++++
 drivers/net/designware.c      |  8 ++++++++
 drivers/serial/ns16550.c      |  8 ++++++++
 include/reset.h               |  2 +-
 7 files changed, 37 insertions(+), 4 deletions(-)
Signature · 1 line
2.2.2
#1 lore raw

PATCH v6 1/5 reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET

Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET, so can use CONFIG_IS_ENABLED(DM_RESET) checking in reset.h later.

---
 arch/arm/mach-stm32mp/Kconfig | 2 +-
 common/spl/Kconfig            | 2 +-
 drivers/Makefile              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-stm32mp/Kconfig +1 -1
index abceede..898ad6b 100644
@@ -13,7 +13,7 @@ config SPL
 	select SPL_OF_TRANSLATE
 	select SPL_PINCTRL
 	select SPL_REGMAP
-	select SPL_RESET_SUPPORT
+	select SPL_DM_RESET
 	select SPL_SERIAL_SUPPORT
 	select SPL_SYSCON
 	select SPL_DRIVERS_MISC_SUPPORT
common/spl/Kconfig +1 -1
index 431710a..bf301a9 100644
@@ -577,7 +577,7 @@ config SPL_POST_MEM_SUPPORT
 	  performed before booting. This enables the drivers in post/drivers
 	  as part of an SPL build.
 
-config SPL_RESET_SUPPORT
+config SPL_DM_RESET
 	bool "Support reset drivers"
 	depends on SPL
 	help
drivers/Makefile +1 -1
index a213ea9..66834c3 100644
@@ -28,7 +28,7 @@ obj-$(CONFIG_ARMADA_XP) += ddr/marvell/axp/
 obj-$(CONFIG_ALTERA_SDRAM) += ddr/altera/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/
 obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/
-obj-$(CONFIG_SPL_RESET_SUPPORT) += reset/
+obj-$(CONFIG_SPL_DM_RESET) += reset/
 obj-$(CONFIG_SPL_MTD_SUPPORT) += mtd/
 obj-$(CONFIG_SPL_ONENAND_SUPPORT) += mtd/onenand/
 obj-$(CONFIG_SPL_UBI) += mtd/ubispl/
Signature · 1 line
2.2.2
#2 lore raw

PATCH v6 1/5 reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET

Quoted 9 lines · Ley Foon Tan

Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET, so can use CONFIG_IS_ENABLED(DM_RESET) checking in reset.h later.

---
 arch/arm/mach-stm32mp/Kconfig | 2 +-
 common/spl/Kconfig            | 2 +-
 drivers/Makefile              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
#3 lore raw

PATCH v6 1/5 reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET

In reply to Ley Foon Tan
Quoted 5 lines · Ley Foon Tan

Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET, so can use CONFIG_IS_ENABLED(DM_RESET) checking in reset.h later.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180710/37d9f8d4/attachment.sig>
#4 lore raw

PATCH v6 2/5 include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)

In reply to Ley Foon Tan

Change to use CONFIG_IS_ENABLED(DM_RESET), so this can work in SPL build (CONFIG_SPL_DM_RESET) and U-boot build (CONFIG_DM_RESET).

---
 include/reset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/reset.h +1 -1
index 201bafc..a7bbc1c 100644
@@ -77,7 +77,7 @@ struct reset_ctl_bulk {
 	unsigned int count;
 };
 
-#ifdef CONFIG_DM_RESET
+#if CONFIG_IS_ENABLED(DM_RESET)
 /**
  * reset_get_by_index - Get/request a reset signal by integer index.
  *
Signature · 1 line
2.2.2
#5 lore raw

PATCH v6 2/5 include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)

Quoted 8 lines · Ley Foon Tan

Change to use CONFIG_IS_ENABLED(DM_RESET), so this can work in SPL build (CONFIG_SPL_DM_RESET) and U-boot build (CONFIG_DM_RESET).

---
 include/reset.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#6 lore raw

PATCH v6 2/5 include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)

In reply to Ley Foon Tan
Quoted 5 lines · Ley Foon Tan

Change to use CONFIG_IS_ENABLED(DM_RESET), so this can work in SPL build (CONFIG_SPL_DM_RESET) and U-boot build (CONFIG_DM_RESET).

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180710/c0718074/attachment.sig>
#7 lore raw

PATCH v6 3/5 mmc: dwmmc: socfpga: Add reset ctrl to driver

In reply to 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.

---
v3:
- Removed #ifdef CONFIG_DM_RESET switch.

v5:
- Added Simon's Reviewed-by.

---
 drivers/mmc/socfpga_dw_mmc.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
drivers/mmc/socfpga_dw_mmc.c +17 -0
index d0a0362..4be4eb5 100644
@@ -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
#8 lore raw

PATCH v6 3/5 mmc: dwmmc: socfpga: Add reset ctrl to driver

Quoted 8 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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180710/92906865/attachment.sig>
#9 lore raw

PATCH v6 4/5 serial: ns16550: Add reset ctrl to driver

In reply to 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.

---
v2:
- Added Marek's Reviewed-by.

v5:
- Added Simon's Reviewed-by.

---
 drivers/serial/ns16550.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/serial/ns16550.c +8 -0
index 53550bf..9c80090 100644
@@ -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
#10 lore raw

PATCH v6 4/5 serial: ns16550: Add reset ctrl to driver

Quoted 9 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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180710/342092fc/attachment.sig>
#11 lore raw

PATCH v6 5/5 net: designware: Add reset ctrl to driver

In reply to 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.

---
v2:
- Removed 'return' when failed to reset.

v5:
- Added Simon's Reviewed-by.

v6:
- Added Joe's Acked-by.

---
 drivers/net/designware.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/net/designware.c +8 -0
index cf12521..6797691 100644
@@ -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
#12 lore raw

PATCH v6 5/5 net: designware: Add reset ctrl to driver

Quoted 9 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.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180710/cb049cec/attachment.sig>
#13 lore raw

v6 cover drivers: Add reset ctrl to drivers

In reply to Ley Foon Tan
Quoted 48 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.

v6:
- Include change history to patches and cover letter
- Added Joe's Acked-by in designware emac patch.

v5: https://patchwork.ozlabs.org/cover/924857/
- Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
- Change to use CONFIG_IS_ENABLED(DM_RESET) in reset.h
- Added Simon's Reviewed-by in dwmmc, 16550 serial and designware emac patches.

v4: https://patchwork.ozlabs.org/cover/923883/
- Add patch to check CONFIG_SPL_RESET_SUPPORT in reset.h

v3: https://patchwork.ozlabs.org/cover/910018/
- remove #ifdef CONFIG_DM_RESET switch
- add maintainer emails

v2: https://patchwork.ozlabs.org/cover/908667/
- 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

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

Ley Foon Tan (5):
reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)
mmc: dwmmc: socfpga: Add reset ctrl to driver
serial: ns16550: Add reset ctrl to driver
net: designware: Add reset ctrl to driver

 arch/arm/mach-stm32mp/Kconfig |  2 +-
 common/spl/Kconfig            |  2 +-
 drivers/Makefile              |  2 +-
 drivers/mmc/socfpga_dw_mmc.c  | 17 +++++++++++++++++
 drivers/net/designware.c      |  8 ++++++++
 drivers/serial/ns16550.c      |  8 ++++++++
 include/reset.h               |  2 +-
 7 files changed, 37 insertions(+), 4 deletions(-)
Quoted 3 lines

--
2.2.2

Hi Tom

Can help to merge this series of patches?

Thanks.

Regards
Ley Foon

#14 lore raw

v6 cover drivers: Add reset ctrl to drivers

Quoted 49 lines · Ley Foon Tan
Quoted 48 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.

v6:
- Include change history to patches and cover letter
- Added Joe's Acked-by in designware emac patch.

v5: https://patchwork.ozlabs.org/cover/924857/
- Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
- Change to use CONFIG_IS_ENABLED(DM_RESET) in reset.h
- Added Simon's Reviewed-by in dwmmc, 16550 serial and designware emac patches.

v4: https://patchwork.ozlabs.org/cover/923883/
- Add patch to check CONFIG_SPL_RESET_SUPPORT in reset.h

v3: https://patchwork.ozlabs.org/cover/910018/
- remove #ifdef CONFIG_DM_RESET switch
- add maintainer emails

v2: https://patchwork.ozlabs.org/cover/908667/
- 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

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

Ley Foon Tan (5):
reset: Rename CONFIG_SPL_RESET_SUPPORT to CONFIG_SPL_DM_RESET
include: reset: Change to use CONFIG_IS_ENABLED(DM_RESET)
mmc: dwmmc: socfpga: Add reset ctrl to driver
serial: ns16550: Add reset ctrl to driver
net: designware: Add reset ctrl to driver

 arch/arm/mach-stm32mp/Kconfig |  2 +-
 common/spl/Kconfig            |  2 +-
 drivers/Makefile              |  2 +-
 drivers/mmc/socfpga_dw_mmc.c  | 17 +++++++++++++++++
 drivers/net/designware.c      |  8 ++++++++
 drivers/serial/ns16550.c      |  8 ++++++++
 include/reset.h               |  2 +-
 7 files changed, 37 insertions(+), 4 deletions(-)
Quoted 7 lines
Quoted 3 lines

--
2.2.2

Hi Tom

Can help to merge this series of patches?

I suspect I will take these shortly after the release, thanks for being patient!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180706/f610421d/attachment.sig>