public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] at91sam9260/9263: add back up fot the rst(reset controller).
@ 2009-06-23 10:46 Sedji Gaouaou
  2009-06-23 12:38 ` Jean-Christophe PLAGNIOL-VILLARD
  2009-06-23 20:37 ` Stelian Pop
  0 siblings, 2 replies; 10+ messages in thread
From: Sedji Gaouaou @ 2009-06-23 10:46 UTC (permalink / raw)
  To: u-boot

On the boards at91sam9260ek, at91sam9263ek and afed9260, the rstc register was
set to 0 after being set to 500 ms for the PHY reset.
Now if back up is enable it will be set to the saved value.

Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com>
---
 board/afeb9260/afeb9260.c                 |    6 +++++-
 board/atmel/at91sam9260ek/at91sam9260ek.c |    6 +++++-
 board/atmel/at91sam9263ek/at91sam9263ek.c |    6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/board/afeb9260/afeb9260.c b/board/afeb9260/afeb9260.c
index a247663..1af02e2 100644
--- a/board/afeb9260/afeb9260.c
+++ b/board/afeb9260/afeb9260.c
@@ -81,6 +81,8 @@ static void afeb9260_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void afeb9260_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC);
 
@@ -103,6 +105,8 @@ static void afeb9260_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PA28),
 	       pin_to_controller(AT91_PIN_PA0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR);
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     AT91_RSTC_ERSTL | (0x0D << 8) |
@@ -115,7 +119,7 @@ static void afeb9260_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     AT91_RSTC_ERSTL | (0x0 << 8) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
diff --git a/board/atmel/at91sam9260ek/at91sam9260ek.c b/board/atmel/at91sam9260ek/at91sam9260ek.c
index 6bd3b44..93bc021 100644
--- a/board/atmel/at91sam9260ek/at91sam9260ek.c
+++ b/board/atmel/at91sam9260ek/at91sam9260ek.c
@@ -86,6 +86,8 @@ static void at91sam9260ek_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void at91sam9260ek_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC);
 
@@ -108,6 +110,8 @@ static void at91sam9260ek_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PA28),
 	       pin_to_controller(AT91_PIN_PA0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR);
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     (AT91_RSTC_ERSTL & (0x0D << 8)) |
@@ -120,7 +124,7 @@ static void at91sam9260ek_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     (AT91_RSTC_ERSTL & (0x0 << 8)) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 57d5c95..e41b7fa 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -91,6 +91,8 @@ static void at91sam9263ek_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void at91sam9263ek_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
 
@@ -108,6 +110,8 @@ static void at91sam9263ek_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PE26),
 	       pin_to_controller(AT91_PIN_PE0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR);
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     (AT91_RSTC_ERSTL & (0x0D << 8)) |
@@ -120,7 +124,7 @@ static void at91sam9263ek_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     (AT91_RSTC_ERSTL & (0x0 << 8)) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
-- 
1.5.3.7

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* [U-Boot] [PATCH] at91sam9260/9263: add back up fot the rst(reset controller).
@ 2009-06-24  8:32 Sedji Gaouaou
  2009-06-26 12:35 ` Stelian Pop
  2009-06-27 15:21 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 10+ messages in thread
From: Sedji Gaouaou @ 2009-06-24  8:32 UTC (permalink / raw)
  To: u-boot

On the boards at91sam9260ek, at91sam9263ek and afed9260, the rstc register was set to 0 after being set to 500 ms for the PHY reset.
Do backup the old reset length and restore it after the MACB initialisation.

Signed-off-by: Sedji Gaouaou <sedji.gaouaou@atmel.com>
---
 board/afeb9260/afeb9260.c                 |    6 +++++-
 board/atmel/at91sam9260ek/at91sam9260ek.c |    6 +++++-
 board/atmel/at91sam9263ek/at91sam9263ek.c |    6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/board/afeb9260/afeb9260.c b/board/afeb9260/afeb9260.c
index a247663..b9d0929 100644
--- a/board/afeb9260/afeb9260.c
+++ b/board/afeb9260/afeb9260.c
@@ -81,6 +81,8 @@ static void afeb9260_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void afeb9260_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC);
 
@@ -103,6 +105,8 @@ static void afeb9260_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PA28),
 	       pin_to_controller(AT91_PIN_PA0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     AT91_RSTC_ERSTL | (0x0D << 8) |
@@ -115,7 +119,7 @@ static void afeb9260_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     AT91_RSTC_ERSTL | (0x0 << 8) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
diff --git a/board/atmel/at91sam9260ek/at91sam9260ek.c b/board/atmel/at91sam9260ek/at91sam9260ek.c
index 6bd3b44..d7d60ba 100644
--- a/board/atmel/at91sam9260ek/at91sam9260ek.c
+++ b/board/atmel/at91sam9260ek/at91sam9260ek.c
@@ -86,6 +86,8 @@ static void at91sam9260ek_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void at91sam9260ek_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9260_ID_EMAC);
 
@@ -108,6 +110,8 @@ static void at91sam9260ek_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PA28),
 	       pin_to_controller(AT91_PIN_PA0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     (AT91_RSTC_ERSTL & (0x0D << 8)) |
@@ -120,7 +124,7 @@ static void at91sam9260ek_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     (AT91_RSTC_ERSTL & (0x0 << 8)) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 57d5c95..59c6a96 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -91,6 +91,8 @@ static void at91sam9263ek_nand_hw_init(void)
 #ifdef CONFIG_MACB
 static void at91sam9263ek_macb_hw_init(void)
 {
+	unsigned long rstc;
+	
 	/* Enable clock */
 	at91_sys_write(AT91_PMC_PCER, 1 << AT91SAM9263_ID_EMAC);
 
@@ -108,6 +110,8 @@ static void at91sam9263ek_macb_hw_init(void)
 	       pin_to_mask(AT91_PIN_PE26),
 	       pin_to_controller(AT91_PIN_PE0) + PIO_PUDR);
 
+	rstc = at91_sys_read(AT91_RSTC_MR) & AT91_RSTC_ERSTL;
+	
 	/* Need to reset PHY -> 500ms reset */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
 				     (AT91_RSTC_ERSTL & (0x0D << 8)) |
@@ -120,7 +124,7 @@ static void at91sam9263ek_macb_hw_init(void)
 
 	/* Restore NRST value */
 	at91_sys_write(AT91_RSTC_MR, AT91_RSTC_KEY |
-				     (AT91_RSTC_ERSTL & (0x0 << 8)) |
+				     (rstc) |
 				     AT91_RSTC_URSTEN);
 
 	/* Re-enable pull-up */
-- 
1.5.3.7

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

end of thread, other threads:[~2009-07-05 15:17 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-23 10:46 [U-Boot] [PATCH] at91sam9260/9263: add back up fot the rst(reset controller) Sedji Gaouaou
2009-06-23 12:38 ` Jean-Christophe PLAGNIOL-VILLARD
2009-06-23 20:37 ` Stelian Pop
2009-06-24  6:24   ` Sedji Gaouaou
  -- strict thread matches above, loose matches on Subject: below --
2009-06-24  8:32 Sedji Gaouaou
2009-06-26 12:35 ` Stelian Pop
2009-06-27 15:21 ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-04 23:06   ` Wolfgang Denk
2009-07-05  9:59     ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-05 15:17       ` Wolfgang Denk

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