mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/1] ARM i.MX35: Read reset source from CCM
@ 2016-03-21  7:47 Alexander Stein
  2016-03-29  7:07 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Stein @ 2016-03-21  7:47 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Stein

CCM has reset status bits with more detailed information than the
watchdog. Set reset source with higher priority.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 arch/arm/mach-imx/clk-imx35.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index 2433d73..af6c405 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -14,6 +14,7 @@
 #include <linux/clkdev.h>
 #include <linux/err.h>
 #include <mach/imx35-regs.h>
+#include <reset_source.h>
 
 #include "clk.h"
 
@@ -95,12 +96,31 @@ static int imx35_ccm_probe(struct device_d *dev)
 	struct arm_ahb_div *aad;
 	unsigned char *hsp_div;
 	void __iomem *base;
+	u32 reg;
 
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
 		return PTR_ERR(iores);
 	base = IOMEM(iores->start);
 
+	/* Check reset source */
+	reg = readl(base + CCM_RCSR);
+
+	switch (reg & 0x0F) {
+	case 0x00:
+		reset_source_set_priority(RESET_POR, 200);
+		break;
+	case 0x02:
+		reset_source_set_priority(RESET_JTAG, 200);
+		break;
+	case 0x04:
+		reset_source_set_priority(RESET_RST, 200);
+		break;
+	case 0x08:
+		reset_source_set_priority(RESET_WDG, 200);
+		break;
+	}
+
 	writel(0xffffffff, base + CCM_CGR0);
 	writel(0xffffffff, base + CCM_CGR1);
 	writel(0xfbffffff, base + CCM_CGR2);
-- 
2.7.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH 1/1] ARM i.MX35: Read reset source from CCM
  2016-03-21  7:47 [PATCH 1/1] ARM i.MX35: Read reset source from CCM Alexander Stein
@ 2016-03-29  7:07 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2016-03-29  7:07 UTC (permalink / raw)
  To: Alexander Stein; +Cc: barebox

On Mon, Mar 21, 2016 at 08:47:56AM +0100, Alexander Stein wrote:
> CCM has reset status bits with more detailed information than the
> watchdog. Set reset source with higher priority.
> 
> Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
> ---
>  arch/arm/mach-imx/clk-imx35.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
> index 2433d73..af6c405 100644
> --- a/arch/arm/mach-imx/clk-imx35.c
> +++ b/arch/arm/mach-imx/clk-imx35.c
> @@ -14,6 +14,7 @@
>  #include <linux/clkdev.h>
>  #include <linux/err.h>
>  #include <mach/imx35-regs.h>
> +#include <reset_source.h>
>  
>  #include "clk.h"
>  
> @@ -95,12 +96,31 @@ static int imx35_ccm_probe(struct device_d *dev)
>  	struct arm_ahb_div *aad;
>  	unsigned char *hsp_div;
>  	void __iomem *base;
> +	u32 reg;
>  
>  	iores = dev_request_mem_resource(dev, 0);
>  	if (IS_ERR(iores))
>  		return PTR_ERR(iores);
>  	base = IOMEM(iores->start);
>  
> +	/* Check reset source */
> +	reg = readl(base + CCM_RCSR);
> +
> +	switch (reg & 0x0F) {
> +	case 0x00:
> +		reset_source_set_priority(RESET_POR, 200);
> +		break;
> +	case 0x02:
> +		reset_source_set_priority(RESET_JTAG, 200);
> +		break;
> +	case 0x04:
> +		reset_source_set_priority(RESET_RST, 200);
> +		break;
> +	case 0x08:
> +		reset_source_set_priority(RESET_WDG, 200);
> +		break;
> +	}
> +
>  	writel(0xffffffff, base + CCM_CGR0);
>  	writel(0xffffffff, base + CCM_CGR1);
>  	writel(0xfbffffff, base + CCM_CGR2);
> -- 
> 2.7.3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2016-03-29  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-21  7:47 [PATCH 1/1] ARM i.MX35: Read reset source from CCM Alexander Stein
2016-03-29  7:07 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox