Skip to contentSkip to conversation

drivers: Add reset ctrl to drivers

PATCH Superseded Ley Foon Tan 4 participants 12 messages Jun 4, 2018 – Jun 13, 2018

Subsystems (5)

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

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

v5 change:
- 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.

History:
v1: https://patchwork.ozlabs.org/cover/905519/
v2: https://patchwork.ozlabs.org/cover/908667/
v3: https://patchwork.ozlabs.org/cover/910018/
v4: https://patchwork.ozlabs.org/cover/923883/

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 v5 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 b3f1b60..a4713eb 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 v5 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
#3 lore raw

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

Quoted 13 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(-)
include/reset.h +0 -0
index 201bafc..a7bbc1c 100644

include/reset.h struct reset_ctl_bulk { · line 80

Quoted 5 lines
include/reset.h +1 -1
@@ -77,7 +77,7 @@ struct reset_ctl_bulk {
        unsigned int count;
 };
 
-#ifdef CONFIG_DM_RESET
+#if CONFIG_IS_ENABLED(DM_RESET)

This seems like it would be more reasonable to squash into the first patch of this series.

Quoted 10 lines
include/reset.h +0 -1
 /**
  * reset_get_by_index - Get/request a reset signal by integer index.
  *
--

2.2.2

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

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

Quoted 17 lines · Joe Hershberger
Quoted 16 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(-)
include/reset.h +0 -0
index 201bafc..a7bbc1c 100644
@@ -77,7 +77,7 @@ struct reset_ctl_bulk {
        unsigned int count;
 };
 
Quoted 5 lines

include/reset.h struct reset_ctl_bulk { · line 80

Quoted 2 lines
include/reset.h +1 -1
-#ifdef CONFIG_DM_RESET
+#if CONFIG_IS_ENABLED(DM_RESET)

This seems like it would be more reasonable to squash into the first patch of this series.

We need to rename SPL_RESET_SUPPORT to SPL_DM_RESET in the first patch. Otherwise it will have redefinition of reset-class API compilation errors in SPL build if we move this patch to first patch.

Regards
Ley Foon

#5 lore raw

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

Quoted 18 lines · Ley Foon Tan
Quoted 17 lines · Joe Hershberger
Quoted 16 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(-)
include/reset.h +0 -0
index 201bafc..a7bbc1c 100644
@@ -77,7 +77,7 @@ struct reset_ctl_bulk {
        unsigned int count;
 };
 
Quoted 8 lines
Quoted 5 lines

include/reset.h struct reset_ctl_bulk { · line 80

Quoted 2 lines
include/reset.h +1 -1
-#ifdef CONFIG_DM_RESET
+#if CONFIG_IS_ENABLED(DM_RESET)

This seems like it would be more reasonable to squash into the first patch of this series.

We need to rename SPL_RESET_SUPPORT to SPL_DM_RESET in the first patch. Otherwise it will have redefinition of reset-class API compilation errors in SPL build if we move this patch to first patch.

I wasn't suggesting to switch the order, I was suggesting to combine them. Squash.

-Joe

#6 lore raw

PATCH v5 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.

---
 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
#7 lore raw

PATCH v5 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.

---
 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
#8 lore raw

PATCH v5 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.

---
 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
#9 lore raw

v5 cover drivers: Add reset ctrl to drivers

In reply to Ley Foon Tan

Hi Ley Foon,

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

Quoted 7 lines

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

v5 change:
- 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.

I think it is better to also include the earlier change logs, Also you should have a change log on each patch as well as the cover letter.

The patman tool does this for you, so I suggest you take a look at that.

Quoted 23 lines

History:
v1: https://patchwork.ozlabs.org/cover/905519/
v2: https://patchwork.ozlabs.org/cover/908667/
v3: https://patchwork.ozlabs.org/cover/910018/
v4: https://patchwork.ozlabs.org/cover/923883/

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

Regards,
Simon

#10 lore raw

v5 cover drivers: Add reset ctrl to drivers

Quoted 11 lines · Simon Glass

Hi Ley Foon,

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

Quoted 7 lines
Quoted 4 lines

v5 change:
- 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.

I think it is better to also include the earlier change logs, Also you should have a change log on each patch as well as the cover letter.

Okay, I can resend this.

Quoted 29 lines

The patman tool does this for you, so I suggest you take a look at that.

Quoted 26 lines

History:
v1: https://patchwork.ozlabs.org/cover/905519/
v2: https://patchwork.ozlabs.org/cover/908667/
v3: https://patchwork.ozlabs.org/cover/910018/
v4: https://patchwork.ozlabs.org/cover/923883/

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(-)

--
2.2.2

Regards
Ley Foon

#11 lore raw

v5 cover drivers: Add reset ctrl to drivers

Quoted 12 lines · Ley Foon Tan
Quoted 11 lines · Simon Glass

Hi Ley Foon,

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

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

v5 change:
- 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.

I think it is better to also include the earlier change logs, Also you should have a change log on each patch as well as the cover letter.

Okay, I can resend this.

Also, when you resend it, don't forget to include feedback you've already gotten. v5 has dropped my ack from v3 of net: designware: Add reset ctrl to driver. Also, if you want individual maintainers to take in part of a series like this, it's not very natural. While these are all related changes, they have no interdependencies. At very least, it seems like the network driver change could either stand alone (and not be in the series) or I should not be taking it by itself.

You don't have to resend just to add responses you've gotten, but if you do resend for another reason, you need to add the feedback you've gotten on earlier version (as long as they still apply).

-Joe

Quoted 35 lines
Quoted 29 lines

The patman tool does this for you, so I suggest you take a look at that.

Quoted 26 lines

History:
v1: https://patchwork.ozlabs.org/cover/905519/
v2: https://patchwork.ozlabs.org/cover/908667/
v3: https://patchwork.ozlabs.org/cover/910018/
v4: https://patchwork.ozlabs.org/cover/923883/

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(-)

--
2.2.2

Regards
Ley Foon
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot