All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top
  2018-08-15 18:01 [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top Ley Foon Tan
@ 2018-08-15 10:13 ` Marek Vasut
  2018-08-15 10:28   ` Ley Foon Tan
  2018-08-15 18:01 ` [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver Ley Foon Tan
  1 sibling, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2018-08-15 10:13 UTC (permalink / raw)
  To: u-boot

On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
> Move reset manager node to top, so reset driver can be load before
> other drivers. Peripheral drivers have dependency on reset framework
> to reset the hardware.
> 
> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>

This will break the next time you sync DTs with Linux, NAK.
The reset manager should just load when it's needed by other drivers. If
it doesn't work that way, something is seriously broken and that is what
needs to be fixed.

> ---
>  arch/arm/dts/socfpga_stratix10.dtsi | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/arm/dts/socfpga_stratix10.dtsi b/arch/arm/dts/socfpga_stratix10.dtsi
> index ccd3f32..748a436 100644
> --- a/arch/arm/dts/socfpga_stratix10.dtsi
> +++ b/arch/arm/dts/socfpga_stratix10.dtsi
> @@ -87,6 +87,14 @@
>  			reg = <0xffd10000 0x1000>;
>  		};
>  
> +		rst: rstmgr at ffd11000 {
> +			#reset-cells = <1>;
> +			compatible = "altr,rst-mgr";
> +			reg = <0xffd11000 0x1000>;
> +			altr,modrst-offset = <0x20>;
> +			u-boot,dm-pre-reloc;
> +		};
> +
>  		gmac0: ethernet at ff800000 {
>  			compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
>  			reg = <0xff800000 0x2000>;
> @@ -234,14 +242,6 @@
>  			reg = <0xffe00000 0x100000>;
>  		};
>  
> -		rst: rstmgr at ffd11000 {
> -			#reset-cells = <1>;
> -			compatible = "altr,rst-mgr";
> -			reg = <0xffd11000 0x1000>;
> -			altr,modrst-offset = <0x20>;
> -			u-boot,dm-pre-reloc;
> -		};
> -
>  		spi0: spi at ffda4000 {
>  			compatible = "snps,dw-apb-ssi";
>  			#address-cells = <1>;
> 


-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver
  2018-08-15 18:01 ` [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver Ley Foon Tan
@ 2018-08-15 10:13   ` Marek Vasut
  2018-08-15 10:22     ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2018-08-15 10:13 UTC (permalink / raw)
  To: u-boot

On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
> Add code to reset all reset signals as in usb 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/usb/host/dwc2.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
> index cbe065b..b77e0c6 100644
> --- a/drivers/usb/host/dwc2.c
> +++ b/drivers/usb/host/dwc2.c
> @@ -15,6 +15,7 @@
>  #include <wait_bit.h>
>  #include <asm/io.h>
>  #include <power/regulator.h>
> +#include <reset.h>
>  
>  #include "dwc2.h"
>  
> @@ -1124,12 +1125,28 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
>  	}
>  }
>  
> +static void dwc2_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 int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
>  {
>  	struct dwc2_core_regs *regs = priv->regs;
>  	uint32_t snpsid;
>  	int i, j;
>  
> +	dwc2_reset(dev);
> +
>  	snpsid = readl(&regs->gsnpsid);
>  	dev_info(dev, "Core Release: %x.%03x\n",
>  		 snpsid >> 12 & 0xf, snpsid & 0xfff);
> 

.remove() should assert the reset again.

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver
  2018-08-15 10:13   ` Marek Vasut
@ 2018-08-15 10:22     ` Ley Foon Tan
  0 siblings, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-08-15 10:22 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex@denx.de> wrote:
> On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
>> Add code to reset all reset signals as in usb 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/usb/host/dwc2.c | 17 +++++++++++++++++
>>  1 file changed, 17 insertions(+)
>>
>> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
>> index cbe065b..b77e0c6 100644
>> --- a/drivers/usb/host/dwc2.c
>> +++ b/drivers/usb/host/dwc2.c
>> @@ -15,6 +15,7 @@
>>  #include <wait_bit.h>
>>  #include <asm/io.h>
>>  #include <power/regulator.h>
>> +#include <reset.h>
>>
>>  #include "dwc2.h"
>>
>> @@ -1124,12 +1125,28 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
>>       }
>>  }
>>
>> +static void dwc2_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 int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
>>  {
>>       struct dwc2_core_regs *regs = priv->regs;
>>       uint32_t snpsid;
>>       int i, j;
>>
>> +     dwc2_reset(dev);
>> +
>>       snpsid = readl(&regs->gsnpsid);
>>       dev_info(dev, "Core Release: %x.%03x\n",
>>                snpsid >> 12 & 0xf, snpsid & 0xfff);
>>
>
> .remove() should assert the reset again.
Okay. Will add it.

Regards
Ley Foon

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

* [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top
  2018-08-15 10:13 ` Marek Vasut
@ 2018-08-15 10:28   ` Ley Foon Tan
  2018-08-15 10:31     ` Marek Vasut
  0 siblings, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-08-15 10:28 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex@denx.de> wrote:
> On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
>> Move reset manager node to top, so reset driver can be load before
>> other drivers. Peripheral drivers have dependency on reset framework
>> to reset the hardware.
>>
>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>
> This will break the next time you sync DTs with Linux, NAK.
> The reset manager should just load when it's needed by other drivers. If
> it doesn't work that way, something is seriously broken and that is what
> needs to be fixed.
Yes, seem that it doesn't load the reset manager driver automatically
when other driver depend on it.
Notice this issue when enable reset framework in GPIO, GPIO driver is
loaded at very beginning before go to command prompt.
Found this can work in SPL, but not in U-boot (load reset manager
driver automatically).


Regards
Ley Foon

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

* [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top
  2018-08-15 10:28   ` Ley Foon Tan
@ 2018-08-15 10:31     ` Marek Vasut
  2018-08-15 10:37       ` Ley Foon Tan
  0 siblings, 1 reply; 8+ messages in thread
From: Marek Vasut @ 2018-08-15 10:31 UTC (permalink / raw)
  To: u-boot

On 08/15/2018 12:28 PM, Ley Foon Tan wrote:
> On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex@denx.de> wrote:
>> On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
>>> Move reset manager node to top, so reset driver can be load before
>>> other drivers. Peripheral drivers have dependency on reset framework
>>> to reset the hardware.
>>>
>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>>
>> This will break the next time you sync DTs with Linux, NAK.
>> The reset manager should just load when it's needed by other drivers. If
>> it doesn't work that way, something is seriously broken and that is what
>> needs to be fixed.
> Yes, seem that it doesn't load the reset manager driver automatically
> when other driver depend on it.
> Notice this issue when enable reset framework in GPIO, GPIO driver is
> loaded at very beginning before go to command prompt.
> Found this can work in SPL, but not in U-boot (load reset manager
> driver automatically).

That's probably because you're using the reset in .bind instead of
.probe , as it should be used ? .bind is ONLY for binding the driver
with the DM core.

-- 
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top
  2018-08-15 10:31     ` Marek Vasut
@ 2018-08-15 10:37       ` Ley Foon Tan
  0 siblings, 0 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-08-15 10:37 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 15, 2018 at 6:31 PM, Marek Vasut <marex@denx.de> wrote:
> On 08/15/2018 12:28 PM, Ley Foon Tan wrote:
>> On Wed, Aug 15, 2018 at 6:13 PM, Marek Vasut <marex@denx.de> wrote:
>>> On 08/15/2018 08:01 PM, Ley Foon Tan wrote:
>>>> Move reset manager node to top, so reset driver can be load before
>>>> other drivers. Peripheral drivers have dependency on reset framework
>>>> to reset the hardware.
>>>>
>>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>>>
>>> This will break the next time you sync DTs with Linux, NAK.
>>> The reset manager should just load when it's needed by other drivers. If
>>> it doesn't work that way, something is seriously broken and that is what
>>> needs to be fixed.
>> Yes, seem that it doesn't load the reset manager driver automatically
>> when other driver depend on it.
>> Notice this issue when enable reset framework in GPIO, GPIO driver is
>> loaded at very beginning before go to command prompt.
>> Found this can work in SPL, but not in U-boot (load reset manager
>> driver automatically).
>
> That's probably because you're using the reset in .bind instead of
> .probe , as it should be used ? .bind is ONLY for binding the driver
> with the DM core.
>
Yes, you are right.
Will fix that.

Regards
Ley Foon

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

* [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top
@ 2018-08-15 18:01 Ley Foon Tan
  2018-08-15 10:13 ` Marek Vasut
  2018-08-15 18:01 ` [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver Ley Foon Tan
  0 siblings, 2 replies; 8+ messages in thread
From: Ley Foon Tan @ 2018-08-15 18:01 UTC (permalink / raw)
  To: u-boot

Move reset manager node to top, so reset driver can be load before
other drivers. Peripheral drivers have dependency on reset framework
to reset the hardware.

Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
---
 arch/arm/dts/socfpga_stratix10.dtsi | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/arm/dts/socfpga_stratix10.dtsi b/arch/arm/dts/socfpga_stratix10.dtsi
index ccd3f32..748a436 100644
--- a/arch/arm/dts/socfpga_stratix10.dtsi
+++ b/arch/arm/dts/socfpga_stratix10.dtsi
@@ -87,6 +87,14 @@
 			reg = <0xffd10000 0x1000>;
 		};
 
+		rst: rstmgr at ffd11000 {
+			#reset-cells = <1>;
+			compatible = "altr,rst-mgr";
+			reg = <0xffd11000 0x1000>;
+			altr,modrst-offset = <0x20>;
+			u-boot,dm-pre-reloc;
+		};
+
 		gmac0: ethernet at ff800000 {
 			compatible = "altr,socfpga-stmmac", "snps,dwmac-3.74a", "snps,dwmac";
 			reg = <0xff800000 0x2000>;
@@ -234,14 +242,6 @@
 			reg = <0xffe00000 0x100000>;
 		};
 
-		rst: rstmgr at ffd11000 {
-			#reset-cells = <1>;
-			compatible = "altr,rst-mgr";
-			reg = <0xffd11000 0x1000>;
-			altr,modrst-offset = <0x20>;
-			u-boot,dm-pre-reloc;
-		};
-
 		spi0: spi at ffda4000 {
 			compatible = "snps,dw-apb-ssi";
 			#address-cells = <1>;
-- 
2.2.2

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

* [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver
  2018-08-15 18:01 [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top Ley Foon Tan
  2018-08-15 10:13 ` Marek Vasut
@ 2018-08-15 18:01 ` Ley Foon Tan
  2018-08-15 10:13   ` Marek Vasut
  1 sibling, 1 reply; 8+ messages in thread
From: Ley Foon Tan @ 2018-08-15 18:01 UTC (permalink / raw)
  To: u-boot

Add code to reset all reset signals as in usb 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/usb/host/dwc2.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index cbe065b..b77e0c6 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -15,6 +15,7 @@
 #include <wait_bit.h>
 #include <asm/io.h>
 #include <power/regulator.h>
+#include <reset.h>
 
 #include "dwc2.h"
 
@@ -1124,12 +1125,28 @@ int _submit_int_msg(struct dwc2_priv *priv, struct usb_device *dev,
 	}
 }
 
+static void dwc2_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 int dwc2_init_common(struct udevice *dev, struct dwc2_priv *priv)
 {
 	struct dwc2_core_regs *regs = priv->regs;
 	uint32_t snpsid;
 	int i, j;
 
+	dwc2_reset(dev);
+
 	snpsid = readl(&regs->gsnpsid);
 	dev_info(dev, "Core Release: %x.%03x\n",
 		 snpsid >> 12 & 0xf, snpsid & 0xfff);
-- 
2.2.2

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

end of thread, other threads:[~2018-08-15 18:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 18:01 [U-Boot] [PATCH] arm: dts: socfpga: stratix10: Move reset manager node to top Ley Foon Tan
2018-08-15 10:13 ` Marek Vasut
2018-08-15 10:28   ` Ley Foon Tan
2018-08-15 10:31     ` Marek Vasut
2018-08-15 10:37       ` Ley Foon Tan
2018-08-15 18:01 ` [U-Boot] [PATCH] usb: dwc2: Add reset ctrl to driver Ley Foon Tan
2018-08-15 10:13   ` Marek Vasut
2018-08-15 10:22     ` Ley Foon Tan

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.