All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] AT91 Reset cleanup
@ 2011-11-29 17:35 Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:42 ` Russell King - ARM Linux
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:35 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

	the following patch series will merge the ddr controler header file
	for sam9 and cap9 and cleanup the reset by

	swtich to arm_pm_restart
	fix the sam9g45 and cap9 reset
	make rstc soc independent

The following changes since commit 15327570807209b5c088382af23ed3fc47558d87:

  ARM: at91/gpio: fix display of number of irq setuped (2011-11-28 22:53:09 +0800)

are available in the git repository at:
  git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset

Jean-Christophe PLAGNIOL-VILLARD (6):
      ARM: at91: fix cap9 ddrsdr register
      ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
      ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset
      ARM: restart: at91: use new restart hook
      ARM: at91: Fix at91sam9g45 and at91cap9 reset
      ARM: at91: make rstc soc independent

 arch/arm/mach-at91/Kconfig                        |   14 +++
 arch/arm/mach-at91/Makefile                       |   14 ++-
 arch/arm/mach-at91/at91cap9.c                     |    9 +--
 arch/arm/mach-at91/at91rm9200.c                   |    4 +-
 arch/arm/mach-at91/at91sam9260.c                  |    3 +-
 arch/arm/mach-at91/at91sam9261.c                  |    3 +-
 arch/arm/mach-at91/at91sam9263.c                  |    3 +-
 arch/arm/mach-at91/at91sam9_alt_reset.S           |   16 +--
 arch/arm/mach-at91/at91sam9g45.c                  |    9 +--
 arch/arm/mach-at91/at91sam9g45_reset.S            |   40 ++++++++
 arch/arm/mach-at91/at91sam9rl.c                   |    3 +-
 arch/arm/mach-at91/generic.h                      |    5 +-
 arch/arm/mach-at91/include/mach/at91_rstc.h       |   18 +++-
 arch/arm/mach-at91/include/mach/at91cap9.h        |    2 +-
 arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h |  108 ---------------------
 arch/arm/mach-at91/include/mach/at91sam9260.h     |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9261.h     |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9263.h     |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h |   30 ++++--
 arch/arm/mach-at91/include/mach/at91sam9g45.h     |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9rl.h      |    2 +-
 arch/arm/mach-at91/include/mach/system.h          |    5 -
 arch/arm/mach-at91/pm.c                           |    9 +--
 arch/arm/mach-at91/pm.h                           |    8 +-
 arch/arm/mach-at91/pm_slowclock.S                 |    5 +-
 arch/arm/mach-at91/setup.c                        |    9 ++
 26 files changed, 142 insertions(+), 185 deletions(-)
 create mode 100644 arch/arm/mach-at91/at91sam9g45_reset.S
 delete mode 100644 arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h

Best Regards,
J.

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:42 ` Russell King - ARM Linux
  2011-11-29 17:49   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 18:46   ` Marek Vasut
  2011-11-29 17:52 ` [PATCH 1/6] ARM: at91: fix cap9 ddrsdr register Jean-Christophe PLAGNIOL-VILLARD
                   ` (5 subsequent siblings)
  6 siblings, 2 replies; 19+ messages in thread
From: Russell King - ARM Linux @ 2011-11-29 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 29, 2011 at 06:35:14PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Hi,
> 
> 	the following patch series will merge the ddr controler header file
> 	for sam9 and cap9 and cleanup the reset by
> 
> 	swtich to arm_pm_restart
> 	fix the sam9g45 and cap9 reset
> 	make rstc soc independent
> 
> The following changes since commit 15327570807209b5c088382af23ed3fc47558d87:
> 
>   ARM: at91/gpio: fix display of number of irq setuped (2011-11-28 22:53:09 +0800)
> 
> are available in the git repository at:
>   git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset
> 
> Jean-Christophe PLAGNIOL-VILLARD (6):
>       ARM: at91: fix cap9 ddrsdr register
>       ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
>       ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset
>       ARM: restart: at91: use new restart hook

Well, it looks like you've taken my work here and committed it as yourself.
That's plagerism.  Don't do it - and fix it before someone pulls your crap.

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 17:42 ` Russell King - ARM Linux
@ 2011-11-29 17:49   ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 18:46   ` Marek Vasut
  1 sibling, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:49 UTC (permalink / raw)
  To: linux-arm-kernel

On 17:42 Tue 29 Nov     , Russell King - ARM Linux wrote:
> On Tue, Nov 29, 2011 at 06:35:14PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > Hi,
> > 
> > 	the following patch series will merge the ddr controler header file
> > 	for sam9 and cap9 and cleanup the reset by
> > 
> > 	swtich to arm_pm_restart
> > 	fix the sam9g45 and cap9 reset
> > 	make rstc soc independent
> > 
> > The following changes since commit 15327570807209b5c088382af23ed3fc47558d87:
> > 
> >   ARM: at91/gpio: fix display of number of irq setuped (2011-11-28 22:53:09 +0800)
> > 
> > are available in the git repository at:
> >   git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset
> > 
> > Jean-Christophe PLAGNIOL-VILLARD (6):
> >       ARM: at91: fix cap9 ddrsdr register
> >       ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
> >       ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset
> >       ARM: restart: at91: use new restart hook
> 
> Well, it looks like you've taken my work here and committed it as yourself.
> That's plagerism.  Don't do it - and fix it before someone pulls your crap.
sorry I didn't take your work as mine

Best Regards,
J.

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

* [PATCH 1/6] ARM: at91: fix cap9 ddrsdr register
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:42 ` Russell King - ARM Linux
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:52 ` [PATCH 2/6] ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

fix AT91_DDRSDRC_MODE it's 3bit

add missing AT91_DDRSDRC_NR_14, AT91_DDRSDRC_DBW (16 and 32 bits support)

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
index 976f4a6..d21932d 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
@@ -16,7 +16,7 @@
 #define AT91CAP9_DDRSDR_H
 
 #define AT91_DDRSDRC_MR		0x00	/* Mode Register */
-#define		AT91_DDRSDRC_MODE	(0xf << 0)		/* Command Mode */
+#define		AT91_DDRSDRC_MODE	(0x7 << 0)		/* Command Mode */
 #define			AT91_DDRSDRC_MODE_NORMAL		0
 #define			AT91_DDRSDRC_MODE_NOP		1
 #define			AT91_DDRSDRC_MODE_PRECHARGE	2
@@ -42,6 +42,7 @@
 #define			AT91_DDRSDRC_NR_11	(0 << 2)
 #define			AT91_DDRSDRC_NR_12	(1 << 2)
 #define			AT91_DDRSDRC_NR_13	(2 << 2)
+#define			AT91_DDRSDRC_NR_14	(3 << 2)
 #define		AT91_DDRSDRC_CAS	(7 << 4)		/* CAS Latency */
 #define			AT91_DDRSDRC_CAS_2	(2 << 4)
 #define			AT91_DDRSDRC_CAS_3	(3 << 4)
@@ -86,6 +87,9 @@
 #define			AT91_DDRSDRC_MD_LOW_POWER_SDR	1
 #define			AT91_DDRSDRC_MD_DDR		2
 #define			AT91_DDRSDRC_MD_LOW_POWER_DDR	3
+#define		AT91_DDRSDRC_DBW	(1 << 4)		/* Data Bus Width */
+#define			AT91_DDRSDRC_DBW_32BITS		(0 <<  4)
+#define			AT91_DDRSDRC_DBW_16BITS		(1 <<  4)
 
 #define AT91_DDRSDRC_DLLR	0x20	/* DLL Information Register */
 #define		AT91_DDRSDRC_MDINC	(1 << 0)		/* Master Delay increment */
-- 
1.7.7

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

* [PATCH 2/6] ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:42 ` Russell King - ARM Linux
  2011-11-29 17:52 ` [PATCH 1/6] ARM: at91: fix cap9 ddrsdr register Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:52 ` [PATCH 3/6] ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h |  112 ---------------------
 arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h |   30 ++++--
 arch/arm/mach-at91/pm.h                           |    8 +-
 arch/arm/mach-at91/pm_slowclock.S                 |    5 +-
 4 files changed, 26 insertions(+), 129 deletions(-)
 delete mode 100644 arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h

diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
deleted file mode 100644
index d21932d..0000000
--- a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
- *
- *  (C) 2008 Andrew Victor
- *
- * DDR/SDR Controller (DDRSDRC) - System peripherals registers.
- * Based on AT91CAP9 datasheet revision B.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef AT91CAP9_DDRSDR_H
-#define AT91CAP9_DDRSDR_H
-
-#define AT91_DDRSDRC_MR		0x00	/* Mode Register */
-#define		AT91_DDRSDRC_MODE	(0x7 << 0)		/* Command Mode */
-#define			AT91_DDRSDRC_MODE_NORMAL		0
-#define			AT91_DDRSDRC_MODE_NOP		1
-#define			AT91_DDRSDRC_MODE_PRECHARGE	2
-#define			AT91_DDRSDRC_MODE_LMR		3
-#define			AT91_DDRSDRC_MODE_REFRESH	4
-#define			AT91_DDRSDRC_MODE_EXT_LMR	5
-#define			AT91_DDRSDRC_MODE_DEEP		6
-
-#define AT91_DDRSDRC_RTR	0x04	/* Refresh Timer Register */
-#define		AT91_DDRSDRC_COUNT	(0xfff << 0)		/* Refresh Timer Counter */
-
-#define AT91_DDRSDRC_CR		0x08	/* Configuration Register */
-#define		AT91_DDRSDRC_NC		(3 << 0)		/* Number of Column Bits */
-#define			AT91_DDRSDRC_NC_SDR8	(0 << 0)
-#define			AT91_DDRSDRC_NC_SDR9	(1 << 0)
-#define			AT91_DDRSDRC_NC_SDR10	(2 << 0)
-#define			AT91_DDRSDRC_NC_SDR11	(3 << 0)
-#define			AT91_DDRSDRC_NC_DDR9	(0 << 0)
-#define			AT91_DDRSDRC_NC_DDR10	(1 << 0)
-#define			AT91_DDRSDRC_NC_DDR11	(2 << 0)
-#define			AT91_DDRSDRC_NC_DDR12	(3 << 0)
-#define		AT91_DDRSDRC_NR		(3 << 2)		/* Number of Row Bits */
-#define			AT91_DDRSDRC_NR_11	(0 << 2)
-#define			AT91_DDRSDRC_NR_12	(1 << 2)
-#define			AT91_DDRSDRC_NR_13	(2 << 2)
-#define			AT91_DDRSDRC_NR_14	(3 << 2)
-#define		AT91_DDRSDRC_CAS	(7 << 4)		/* CAS Latency */
-#define			AT91_DDRSDRC_CAS_2	(2 << 4)
-#define			AT91_DDRSDRC_CAS_3	(3 << 4)
-#define			AT91_DDRSDRC_CAS_25	(6 << 4)
-#define		AT91_DDRSDRC_DLL	(1 << 7)		/* Reset DLL */
-#define		AT91_DDRSDRC_DICDS	(1 << 8)		/* Output impedance control */
-
-#define AT91_DDRSDRC_T0PR	0x0C	/* Timing 0 Register */
-#define		AT91_DDRSDRC_TRAS	(0xf <<  0)		/* Active to Precharge delay */
-#define		AT91_DDRSDRC_TRCD	(0xf <<  4)		/* Row to Column delay */
-#define		AT91_DDRSDRC_TWR	(0xf <<  8)		/* Write recovery delay */
-#define		AT91_DDRSDRC_TRC	(0xf << 12)		/* Row cycle delay */
-#define		AT91_DDRSDRC_TRP	(0xf << 16)		/* Row precharge delay */
-#define		AT91_DDRSDRC_TRRD	(0xf << 20)		/* Active BankA to BankB */
-#define		AT91_DDRSDRC_TWTR	(1   << 24)		/* Internal Write to Read delay */
-#define		AT91_DDRSDRC_TMRD	(0xf << 28)		/* Load mode to active/refresh delay */
-
-#define AT91_DDRSDRC_T1PR	0x10	/* Timing 1 Register */
-#define		AT91_DDRSDRC_TRFC	(0x1f << 0)		/* Row Cycle Delay */
-#define		AT91_DDRSDRC_TXSNR	(0xff << 8)		/* Exit self-refresh to non-read */
-#define		AT91_DDRSDRC_TXSRD	(0xff << 16)		/* Exit self-refresh to read */
-#define		AT91_DDRSDRC_TXP	(0xf  << 24)		/* Exit power-down delay */
-
-#define AT91_DDRSDRC_LPR	0x18	/* Low Power Register */
-#define		AT91_DDRSDRC_LPCB		(3 << 0)	/* Low-power Configurations */
-#define			AT91_DDRSDRC_LPCB_DISABLE		0
-#define			AT91_DDRSDRC_LPCB_SELF_REFRESH		1
-#define			AT91_DDRSDRC_LPCB_POWER_DOWN		2
-#define			AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN	3
-#define		AT91_DDRSDRC_CLKFR		(1 << 2)	/* Clock Frozen */
-#define		AT91_DDRSDRC_PASR		(7 << 4)	/* Partial Array Self Refresh */
-#define		AT91_DDRSDRC_TCSR		(3 << 8)	/* Temperature Compensated Self Refresh */
-#define		AT91_DDRSDRC_DS			(3 << 10)	/* Drive Strength */
-#define		AT91_DDRSDRC_TIMEOUT		(3 << 12)	/* Time to define when Low Power Mode is enabled */
-#define			AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES	(0 << 12)
-#define			AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES	(1 << 12)
-#define			AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES	(2 << 12)
-
-#define AT91_DDRSDRC_MDR	0x1C	/* Memory Device Register */
-#define		AT91_DDRSDRC_MD		(3 << 0)		/* Memory Device Type */
-#define			AT91_DDRSDRC_MD_SDR		0
-#define			AT91_DDRSDRC_MD_LOW_POWER_SDR	1
-#define			AT91_DDRSDRC_MD_DDR		2
-#define			AT91_DDRSDRC_MD_LOW_POWER_DDR	3
-#define		AT91_DDRSDRC_DBW	(1 << 4)		/* Data Bus Width */
-#define			AT91_DDRSDRC_DBW_32BITS		(0 <<  4)
-#define			AT91_DDRSDRC_DBW_16BITS		(1 <<  4)
-
-#define AT91_DDRSDRC_DLLR	0x20	/* DLL Information Register */
-#define		AT91_DDRSDRC_MDINC	(1 << 0)		/* Master Delay increment */
-#define		AT91_DDRSDRC_MDDEC	(1 << 1)		/* Master Delay decrement */
-#define		AT91_DDRSDRC_MDOVF	(1 << 2)		/* Master Delay Overflow */
-#define		AT91_DDRSDRC_SDCOVF	(1 << 3)		/* Slave Delay Correction Overflow */
-#define		AT91_DDRSDRC_SDCUDF	(1 << 4)		/* Slave Delay Correction Underflow */
-#define		AT91_DDRSDRC_SDERF	(1 << 5)		/* Slave Delay Correction error */
-#define		AT91_DDRSDRC_MDVAL	(0xff <<  8)		/* Master Delay value */
-#define		AT91_DDRSDRC_SDVAL	(0xff << 16)		/* Slave Delay value */
-#define		AT91_DDRSDRC_SDCVAL	(0xff << 24)		/* Slave Delay Correction value */
-
-/* Register access macros */
-#define at91_ramc_read(num, reg) \
-	at91_sys_read(AT91_DDRSDRC##num + reg)
-#define at91_ramc_write(num, reg, value) \
-	at91_sys_write(AT91_DDRSDRC##num + reg, value)
-
-
-#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
index d27b15b..e2f8da8 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -46,10 +46,10 @@
 #define			AT91_DDRSDRC_CAS_25	(6 << 4)
 #define		AT91_DDRSDRC_RST_DLL	(1 << 7)		/* Reset DLL */
 #define		AT91_DDRSDRC_DICDS	(1 << 8)		/* Output impedance control */
-#define		AT91_DDRSDRC_DIS_DLL	(1 << 9)		/* Disable DLL */
-#define		AT91_DDRSDRC_OCD	(1 << 12)		/* Off-Chip Driver */
-#define		AT91_DDRSDRC_DQMS	(1 << 16)		/* Mask Data is Shared */
-#define		AT91_DDRSDRC_ACTBST	(1 << 18)		/* Active Bank X to Burst Stop Read Access Bank Y */
+#define		AT91_DDRSDRC_DIS_DLL	(1 << 9)		/* Disable DLL [SAM9 Only] */
+#define		AT91_DDRSDRC_OCD	(1 << 12)		/* Off-Chip Driver [SAM9 Only] */
+#define		AT91_DDRSDRC_DQMS	(1 << 16)		/* Mask Data is Shared [SAM9 Only] */
+#define		AT91_DDRSDRC_ACTBST	(1 << 18)		/* Active Bank X to Burst Stop Read Access Bank Y [SAM9 Only] */
 
 #define AT91_DDRSDRC_T0PR	0x0C	/* Timing 0 Register */
 #define		AT91_DDRSDRC_TRAS	(0xf <<  0)		/* Active to Precharge delay */
@@ -59,7 +59,8 @@
 #define		AT91_DDRSDRC_TRP	(0xf << 16)		/* Row precharge delay */
 #define		AT91_DDRSDRC_TRRD	(0xf << 20)		/* Active BankA to BankB */
 #define		AT91_DDRSDRC_TWTR	(0x7 << 24)		/* Internal Write to Read delay */
-#define		AT91_DDRSDRC_RED_WRRD	(0x1 << 27)		/* Reduce Write to Read Delay */
+#define		AT91CAP9_DDRSDRC_TWTR	(1   << 24)		/* Internal Write to Read delay */
+#define		AT91_DDRSDRC_RED_WRRD	(0x1 << 27)		/* Reduce Write to Read Delay [SAM9 Only] */
 #define		AT91_DDRSDRC_TMRD	(0xf << 28)		/* Load mode to active/refresh delay */
 
 #define AT91_DDRSDRC_T1PR	0x10	/* Timing 1 Register */
@@ -68,13 +69,14 @@
 #define		AT91_DDRSDRC_TXSRD	(0xff << 16)		/* Exit self-refresh to read */
 #define		AT91_DDRSDRC_TXP	(0xf  << 24)		/* Exit power-down delay */
 
-#define AT91_DDRSDRC_T2PR	0x14	/* Timing 2 Register */
+#define AT91_DDRSDRC_T2PR	0x14	/* Timing 2 Register [SAM9 Only] */
 #define		AT91_DDRSDRC_TXARD	(0xf  << 0)		/* Exit active power down delay to read command in mode "Fast Exit" */
 #define		AT91_DDRSDRC_TXARDS	(0xf  << 4)		/* Exit active power down delay to read command in mode "Slow Exit" */
 #define		AT91_DDRSDRC_TRPA	(0xf  << 8)		/* Row Precharge All delay */
 #define		AT91_DDRSDRC_TRTP	(0x7  << 12)		/* Read to Precharge delay */
 
 #define AT91_DDRSDRC_LPR	0x1C	/* Low Power Register */
+#define AT91CAP9_DDRSDRC_LPR	0x18	/* Low Power Register */
 #define		AT91_DDRSDRC_LPCB	(3 << 0)		/* Low-power Configurations */
 #define			AT91_DDRSDRC_LPCB_DISABLE		0
 #define			AT91_DDRSDRC_LPCB_SELF_REFRESH		1
@@ -92,32 +94,40 @@
 #define		AT91_DDRSDRC_UPD_MR	(3 << 20)	 /* Update load mode register and extended mode register */
 
 #define AT91_DDRSDRC_MDR	0x20	/* Memory Device Register */
+#define AT91CAP9_DDRSDRC_MDR	0x1C	/* Memory Device Register */
 #define		AT91_DDRSDRC_MD		(3 << 0)		/* Memory Device Type */
 #define			AT91_DDRSDRC_MD_SDR		0
 #define			AT91_DDRSDRC_MD_LOW_POWER_SDR	1
+#define			AT91CAP9_DDRSDRC_MD_DDR		2
 #define			AT91_DDRSDRC_MD_LOW_POWER_DDR	3
-#define			AT91_DDRSDRC_MD_DDR2		6
+#define			AT91_DDRSDRC_MD_DDR2		6	/* [SAM9 Only] */
 #define		AT91_DDRSDRC_DBW	(1 << 4)		/* Data Bus Width */
 #define			AT91_DDRSDRC_DBW_32BITS		(0 <<  4)
 #define			AT91_DDRSDRC_DBW_16BITS		(1 <<  4)
 
 #define AT91_DDRSDRC_DLL	0x24	/* DLL Information Register */
+#define AT91CAP9_DDRSDRC_DLL	0x20	/* DLL Information Register */
 #define		AT91_DDRSDRC_MDINC	(1 << 0)		/* Master Delay increment */
 #define		AT91_DDRSDRC_MDDEC	(1 << 1)		/* Master Delay decrement */
 #define		AT91_DDRSDRC_MDOVF	(1 << 2)		/* Master Delay Overflow */
+#define		AT91CAP9_DDRSDRC_SDCOVF	(1 << 3)		/* Slave Delay Correction Overflow */
+#define		AT91CAP9_DDRSDRC_SDCUDF	(1 << 4)		/* Slave Delay Correction Underflow */
+#define		AT91CAP9_DDRSDRC_SDERF	(1 << 5)		/* Slave Delay Correction error */
 #define		AT91_DDRSDRC_MDVAL	(0xff <<  8)		/* Master Delay value */
+#define		AT91CAP9_DDRSDRC_SDVAL	(0xff << 16)		/* Slave Delay value */
+#define		AT91CAP9_DDRSDRC_SDCVAL	(0xff << 24)		/* Slave Delay Correction value */
 
-#define AT91_DDRSDRC_HS		0x2C	/* High Speed Register */
+#define AT91_DDRSDRC_HS		0x2C	/* High Speed Register [SAM9 Only] */
 #define		AT91_DDRSDRC_DIS_ATCP_RD	(1 << 2)	/* Anticip read access is disabled */
 
 #define AT91_DDRSDRC_DELAY(n)	(0x30 + (0x4 * (n)))	/* Delay I/O Register n */
 
-#define AT91_DDRSDRC_WPMR	0xE4	/* Write Protect Mode Register */
+#define AT91_DDRSDRC_WPMR	0xE4	/* Write Protect Mode Register [SAM9 Only] */
 #define		AT91_DDRSDRC_WP		(1 << 0)		/* Write protect enable */
 #define		AT91_DDRSDRC_WPKEY	(0xffffff << 8)		/* Write protect key */
 #define		AT91_DDRSDRC_KEY	(0x444452 << 8)		/* Write protect key = "DDR" */
 
-#define AT91_DDRSDRC_WPSR	0xE8	/* Write Protect Status Register */
+#define AT91_DDRSDRC_WPSR	0xE8	/* Write Protect Status Register [SAM9 Only] */
 #define		AT91_DDRSDRC_WPVS	(1 << 0)		/* Write protect violation status */
 #define		AT91_DDRSDRC_WPVSRC	(0xffff << 8)		/* Write protect violation source */
 
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index ce9a206..7eb40d2 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -25,21 +25,21 @@ static inline u32 sdram_selfrefresh_enable(void)
 								: : "r" (0))
 
 #elif defined(CONFIG_ARCH_AT91CAP9)
-#include <mach/at91cap9_ddrsdr.h>
+#include <mach/at91sam9_ddrsdr.h>
 
 
 static inline u32 sdram_selfrefresh_enable(void)
 {
 	u32 saved_lpr, lpr;
 
-	saved_lpr = at91_ramc_read(0, AT91_DDRSDRC_LPR);
+	saved_lpr = at91_ramc_read(0, AT91CAP9_DDRSDRC_LPR);
 
 	lpr = saved_lpr & ~AT91_DDRSDRC_LPCB;
-	at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
+	at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
 	return saved_lpr;
 }
 
-#define sdram_selfrefresh_disable(saved_lpr)	at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr)
+#define sdram_selfrefresh_disable(saved_lpr)	at91_ramc_write(0, AT91CAP9_DDRSDRC_LPR, saved_lpr)
 #define wait_for_interrupt_enable()		cpu_do_idle()
 
 #elif defined(CONFIG_ARCH_AT91SAM9G45)
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index f7922a4..92dfb84 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -18,9 +18,8 @@
 
 #if defined(CONFIG_ARCH_AT91RM9200)
 #include <mach/at91rm9200_mc.h>
-#elif defined(CONFIG_ARCH_AT91CAP9)
-#include <mach/at91cap9_ddrsdr.h>
-#elif defined(CONFIG_ARCH_AT91SAM9G45)
+#elif defined(CONFIG_ARCH_AT91CAP9) \
+	|| defined(CONFIG_ARCH_AT91SAM9G45)
 #include <mach/at91sam9_ddrsdr.h>
 #else
 #include <mach/at91sam9_sdramc.h>
-- 
1.7.7

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

* [PATCH 3/6] ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 preceding siblings ...)
  2011-11-29 17:52 ` [PATCH 2/6] ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:52 ` [PATCH 4/6] ARM: restart: at91: use new restart hook Jean-Christophe PLAGNIOL-VILLARD
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/Kconfig  |    9 +++++++++
 arch/arm/mach-at91/Makefile |   13 +++++++------
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 4f991f2..4275577 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -18,6 +18,9 @@ config HAVE_AT91_USART4
 config HAVE_AT91_USART5
 	bool
 
+config AT91_SAM9_ALT_RESET
+	bool
+
 menu "Atmel AT91 System-on-Chip"
 
 choice
@@ -39,6 +42,7 @@ config ARCH_AT91SAM9260
 	select HAVE_AT91_USART4
 	select HAVE_AT91_USART5
 	select HAVE_NET_MACB
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9261
 	bool "AT91SAM9261"
@@ -46,6 +50,7 @@ config ARCH_AT91SAM9261
 	select GENERIC_CLOCKEVENTS
 	select HAVE_FB_ATMEL
 	select HAVE_AT91_DBGU0
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9G10
 	bool "AT91SAM9G10"
@@ -53,6 +58,7 @@ config ARCH_AT91SAM9G10
 	select GENERIC_CLOCKEVENTS
 	select HAVE_AT91_DBGU0
 	select HAVE_FB_ATMEL
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9263
 	bool "AT91SAM9263"
@@ -61,6 +67,7 @@ config ARCH_AT91SAM9263
 	select HAVE_FB_ATMEL
 	select HAVE_NET_MACB
 	select HAVE_AT91_DBGU1
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9RL
 	bool "AT91SAM9RL"
@@ -69,6 +76,7 @@ config ARCH_AT91SAM9RL
 	select HAVE_AT91_USART3
 	select HAVE_FB_ATMEL
 	select HAVE_AT91_DBGU0
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9G20
 	bool "AT91SAM9G20"
@@ -79,6 +87,7 @@ config ARCH_AT91SAM9G20
 	select HAVE_AT91_USART4
 	select HAVE_AT91_USART5
 	select HAVE_NET_MACB
+	select AT91_SAM9_ALT_RESET
 
 config ARCH_AT91SAM9G45
 	bool "AT91SAM9G45"
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index 242174f..e8e961b 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -8,15 +8,16 @@ obj-n		:=
 obj-		:=
 
 obj-$(CONFIG_AT91_PMC_UNIT)	+= clock.o
+obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
 
 # CPU-specific support
 obj-$(CONFIG_ARCH_AT91RM9200)	+= at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
-obj-$(CONFIG_ARCH_AT91SAM9260)	+= at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9_alt_reset.o
-obj-$(CONFIG_ARCH_AT91SAM9261)	+= at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o at91sam9_alt_reset.o
-obj-$(CONFIG_ARCH_AT91SAM9G10)	+= at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o at91sam9_alt_reset.o
-obj-$(CONFIG_ARCH_AT91SAM9263)	+= at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o at91sam9_alt_reset.o
-obj-$(CONFIG_ARCH_AT91SAM9RL)	+= at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o at91sam9_alt_reset.o
-obj-$(CONFIG_ARCH_AT91SAM9G20)	+= at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o at91sam9_alt_reset.o
+obj-$(CONFIG_ARCH_AT91SAM9260)	+= at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
+obj-$(CONFIG_ARCH_AT91SAM9261)	+= at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o
+obj-$(CONFIG_ARCH_AT91SAM9G10)	+= at91sam9261.o at91sam926x_time.o at91sam9261_devices.o sam9_smc.o
+obj-$(CONFIG_ARCH_AT91SAM9263)	+= at91sam9263.o at91sam926x_time.o at91sam9263_devices.o sam9_smc.o
+obj-$(CONFIG_ARCH_AT91SAM9RL)	+= at91sam9rl.o at91sam926x_time.o at91sam9rl_devices.o sam9_smc.o
+obj-$(CONFIG_ARCH_AT91SAM9G20)	+= at91sam9260.o at91sam926x_time.o at91sam9260_devices.o sam9_smc.o
 obj-$(CONFIG_ARCH_AT91SAM9G45)	+= at91sam9g45.o at91sam926x_time.o at91sam9g45_devices.o sam9_smc.o
 obj-$(CONFIG_ARCH_AT91CAP9)	+= at91cap9.o at91sam926x_time.o at91cap9_devices.o sam9_smc.o
 obj-$(CONFIG_ARCH_AT91X40)	+= at91x40.o at91x40_time.o
-- 
1.7.7

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

* [PATCH 4/6] ARM: restart: at91: use new restart hook
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
                   ` (3 preceding siblings ...)
  2011-11-29 17:52 ` [PATCH 3/6] ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:52 ` [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 17:52 ` [PATCH 6/6] ARM: at91: make rstc soc independent Jean-Christophe PLAGNIOL-VILLARD
  6 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

From: Russell King <rmk+kernel@arm.linux.org.uk>

Rather than using a private function pointer, use the existing
arm_pm_restart function pointer instead.  We no longer need to enable
the I-cache in at91sam9_alt_reset() as the caches will now be on when
this function is called.

Update the function names to use the 'restart' terminology rather than
the 'reboot' terminology.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91cap9.c            |    4 ++--
 arch/arm/mach-at91/at91rm9200.c          |    4 ++--
 arch/arm/mach-at91/at91sam9260.c         |    2 +-
 arch/arm/mach-at91/at91sam9261.c         |    2 +-
 arch/arm/mach-at91/at91sam9263.c         |    2 +-
 arch/arm/mach-at91/at91sam9_alt_reset.S  |    9 ++-------
 arch/arm/mach-at91/at91sam9g45.c         |    4 ++--
 arch/arm/mach-at91/at91sam9rl.c          |    2 +-
 arch/arm/mach-at91/generic.h             |    3 +--
 arch/arm/mach-at91/include/mach/system.h |    5 -----
 10 files changed, 13 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 81a9f38..e484a09 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -312,7 +312,7 @@ static struct at91_gpio_bank at91cap9_gpio[] __initdata = {
 	}
 };
 
-static void at91cap9_reset(void)
+static void at91cap9_restart(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -335,7 +335,7 @@ static void __init at91cap9_ioremap_registers(void)
 
 static void __init at91cap9_initialize(void)
 {
-	at91_arch_reset = at91cap9_reset;
+	arm_pm_restart = at91cap9_restart;
 	at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
 
 	/* Register GPIO subsystem */
diff --git a/arch/arm/mach-at91/at91rm9200.c b/arch/arm/mach-at91/at91rm9200.c
index 9163d7d..99c3174 100644
--- a/arch/arm/mach-at91/at91rm9200.c
+++ b/arch/arm/mach-at91/at91rm9200.c
@@ -289,7 +289,7 @@ static struct at91_gpio_bank at91rm9200_gpio[] __initdata = {
 	}
 };
 
-static void at91rm9200_reset(void)
+static void at91rm9200_restart(char mode, const char *cmd)
 {
 	/*
 	 * Perform a hardware reset with the use of the Watchdog timer.
@@ -314,7 +314,7 @@ static void __init at91rm9200_ioremap_registers(void)
 
 static void __init at91rm9200_initialize(void)
 {
-	at91_arch_reset = at91rm9200_reset;
+	arm_pm_restart = at91rm9200_restart;
 	at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
 			| (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
 			| (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 5e25cef..9219b29 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -327,7 +327,7 @@ static void __init at91sam9260_ioremap_registers(void)
 
 static void __init at91sam9260_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
 			| (1 << AT91SAM9260_ID_IRQ2);
 
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index a0538c5..b85b9ea 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -287,7 +287,7 @@ static void __init at91sam9261_ioremap_registers(void)
 
 static void __init at91sam9261_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
 			| (1 << AT91SAM9261_ID_IRQ2);
 
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index 0d90b6a..c26e0a1 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -306,7 +306,7 @@ static void __init at91sam9263_ioremap_registers(void)
 
 static void __init at91sam9263_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
 	/* Register GPIO subsystem */
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
index e0256de..d3f931c 100644
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -14,20 +14,15 @@
  */
 
 #include <linux/linkage.h>
-#include <asm/system.h>
 #include <mach/hardware.h>
 #include <mach/at91sam9_sdramc.h>
 #include <mach/at91_rstc.h>
 
 			.arm
 
-			.globl	at91sam9_alt_reset
+			.globl	at91sam9_alt_restart
 
-at91sam9_alt_reset:	mrc	p15, 0, r0, c1, c0, 0
-			orr	r0, r0, #CR_I
-			mcr	p15, 0, r0, c1, c0, 0		@ enable I-cache
-
-			ldr	r0, .at91_va_base_sdramc	@ preload constants
+at91sam9_alt_restart:	ldr	r0, .at91_va_base_sdramc	@ preload constants
 			ldr	r1, .at91_va_base_rstc_cr
 
 			mov	r2, #1
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 72c3cce..9344da5 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -316,7 +316,7 @@ static struct at91_gpio_bank at91sam9g45_gpio[] __initdata = {
 	}
 };
 
-static void at91sam9g45_reset(void)
+static void at91sam9g45_restart(char mode, const char *cmd)
 {
 	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
 }
@@ -340,7 +340,7 @@ static void __init at91sam9g45_ioremap_registers(void)
 
 static void __init at91sam9g45_initialize(void)
 {
-	at91_arch_reset = at91sam9g45_reset;
+	arm_pm_restart = at91sam9g45_restart;
 	at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
 
 	/* Register GPIO subsystem */
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index 96247f6..d6bcb1d 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -292,7 +292,7 @@ static void __init at91sam9rl_ioremap_registers(void)
 
 static void __init at91sam9rl_initialize(void)
 {
-	at91_arch_reset = at91sam9_alt_reset;
+	arm_pm_restart = at91sam9_alt_restart;
 	at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
 
 	/* Register GPIO subsystem */
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 4030958..4866b81 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -58,7 +58,7 @@ extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
 
 /* reset */
-extern void at91sam9_alt_reset(void);
+extern void at91sam9_alt_restart(char, const char *);
 
 /* shutdown */
 extern void at91_ioremap_shdwc(u32 base_addr);
@@ -74,5 +74,4 @@ struct at91_gpio_bank {
 extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
 extern void __init at91_gpio_irq_setup(void);
 
-extern void (*at91_arch_reset)(void);
 extern int at91_extern_irq;
diff --git a/arch/arm/mach-at91/include/mach/system.h b/arch/arm/mach-at91/include/mach/system.h
index 36af14b..079eb12 100644
--- a/arch/arm/mach-at91/include/mach/system.h
+++ b/arch/arm/mach-at91/include/mach/system.h
@@ -47,13 +47,8 @@ static inline void arch_idle(void)
 #endif
 }
 
-void (*at91_arch_reset)(void);
-
 static inline void arch_reset(char mode, const char *cmd)
 {
-	/* call the CPU-specific reset function */
-	if (at91_arch_reset)
-		(at91_arch_reset)();
 }
 
 #endif
-- 
1.7.7

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

* [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
                   ` (4 preceding siblings ...)
  2011-11-29 17:52 ` [PATCH 4/6] ARM: restart: at91: use new restart hook Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  2011-11-29 22:12   ` Russell King - ARM Linux
  2011-11-29 17:52 ` [PATCH 6/6] ARM: at91: make rstc soc independent Jean-Christophe PLAGNIOL-VILLARD
  6 siblings, 1 reply; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

As on the other sam9 we to cleanly shutdown the DDR before rebooting

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/Kconfig             |    5 ++++
 arch/arm/mach-at91/Makefile            |    1 +
 arch/arm/mach-at91/at91cap9.c          |    8 +-----
 arch/arm/mach-at91/at91sam9g45.c       |    6 ----
 arch/arm/mach-at91/at91sam9g45_reset.S |   41 ++++++++++++++++++++++++++++++++
 arch/arm/mach-at91/generic.h           |    1 +
 6 files changed, 49 insertions(+), 13 deletions(-)
 create mode 100644 arch/arm/mach-at91/at91sam9g45_reset.S

diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 4275577..c5626b7 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -21,6 +21,9 @@ config HAVE_AT91_USART5
 config AT91_SAM9_ALT_RESET
 	bool
 
+config AT91_SAM9G45_ALT_RESET
+	bool
+
 menu "Atmel AT91 System-on-Chip"
 
 choice
@@ -97,6 +100,7 @@ config ARCH_AT91SAM9G45
 	select HAVE_FB_ATMEL
 	select HAVE_NET_MACB
 	select HAVE_AT91_DBGU1
+	select AT91_SAM9G45_ALT_RESET
 
 config ARCH_AT91CAP9
 	bool "AT91CAP9"
@@ -105,6 +109,7 @@ config ARCH_AT91CAP9
 	select HAVE_FB_ATMEL
 	select HAVE_NET_MACB
 	select HAVE_AT91_DBGU1
+	select AT91_SAM9G45_ALT_RESET
 
 config ARCH_AT91X40
 	bool "AT91x40"
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index e8e961b..ef07d31 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -9,6 +9,7 @@ obj-		:=
 
 obj-$(CONFIG_AT91_PMC_UNIT)	+= clock.o
 obj-$(CONFIG_AT91_SAM9_ALT_RESET) += at91sam9_alt_reset.o
+obj-$(CONFIG_AT91_SAM9G45_ALT_RESET) += at91sam9g45_reset.o
 
 # CPU-specific support
 obj-$(CONFIG_ARCH_AT91RM9200)	+= at91rm9200.o at91rm9200_time.o at91rm9200_devices.o
diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index e484a09..7b7f30b 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -21,7 +21,6 @@
 #include <mach/cpu.h>
 #include <mach/at91cap9.h>
 #include <mach/at91_pmc.h>
-#include <mach/at91_rstc.h>
 
 #include "soc.h"
 #include "generic.h"
@@ -312,11 +311,6 @@ static struct at91_gpio_bank at91cap9_gpio[] __initdata = {
 	}
 };
 
-static void at91cap9_restart(char mode, const char *cmd)
-{
-	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
-}
-
 /* --------------------------------------------------------------------
  *  AT91CAP9 processor initialization
  * -------------------------------------------------------------------- */
@@ -335,7 +329,7 @@ static void __init at91cap9_ioremap_registers(void)
 
 static void __init at91cap9_initialize(void)
 {
-	arm_pm_restart = at91cap9_restart;
+	arm_pm_restart = at91sam9g45_restart;
 	at91_extern_irq = (1 << AT91CAP9_ID_IRQ0) | (1 << AT91CAP9_ID_IRQ1);
 
 	/* Register GPIO subsystem */
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 9344da5..2d6e29f 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -18,7 +18,6 @@
 #include <asm/mach/map.h>
 #include <mach/at91sam9g45.h>
 #include <mach/at91_pmc.h>
-#include <mach/at91_rstc.h>
 #include <mach/cpu.h>
 
 #include "soc.h"
@@ -316,11 +315,6 @@ static struct at91_gpio_bank at91sam9g45_gpio[] __initdata = {
 	}
 };
 
-static void at91sam9g45_restart(char mode, const char *cmd)
-{
-	at91_sys_write(AT91_RSTC_CR, AT91_RSTC_KEY | AT91_RSTC_PROCRST | AT91_RSTC_PERRST);
-}
-
 /* --------------------------------------------------------------------
  *  AT91SAM9G45 processor initialization
  * -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
new file mode 100644
index 0000000..69c75fd
--- /dev/null
+++ b/arch/arm/mach-at91/at91sam9g45_reset.S
@@ -0,0 +1,41 @@
+/*
+ * reset AT91SAM9G45 as per errata
+ *
+ * Copyright (C) 2011 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcosoft.com>
+ *
+ * unless the SDRAM is cleanly shutdown before we hit the
+ * reset register it can be left driving the data bus and
+ * killing the chance of a subsequent boot from NAND
+ *
+ * GPLv2 Only
+ */
+
+#include <linux/linkage.h>
+#include <mach/hardware.h>
+#include <mach/at91sam9_ddrsdr.h>
+#include <mach/at91_rstc.h>
+
+			.arm
+
+			.globl	at91sam9g45_restart
+
+at91sam9g45_restart:
+			ldr	r0, .at91_va_base_sdramc0	@ preload constants
+			ldr	r1, .at91_va_base_rstc_cr
+
+			mov	r2, #1
+			mov	r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
+			ldr	r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
+
+			.balign	32				@ align to cache line
+
+			str	r2, [r0, #AT91_DDRSDRC_RTR]	@ disable DDR0 access
+			str	r3, [r0, #AT91_DDRSDRC_LPR]	@ power down DDR0
+			str	r4, [r1]			@ reset processor
+
+			b	.
+
+.at91_va_base_sdramc0:
+	.word AT91_VA_BASE_SYS + AT91_DDRSDRC0
+.at91_va_base_rstc_cr:
+	.word AT91_VA_BASE_SYS + AT91_RSTC_CR
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 4866b81..33907ce 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -59,6 +59,7 @@ extern void at91_irq_resume(void);
 
 /* reset */
 extern void at91sam9_alt_restart(char, const char *);
+extern void at91sam9g45_restart(char, const char *);
 
 /* shutdown */
 extern void at91_ioremap_shdwc(u32 base_addr);
-- 
1.7.7

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

* [PATCH 6/6] ARM: at91: make rstc soc independent
  2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
                   ` (5 preceding siblings ...)
  2011-11-29 17:52 ` [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 17:52 ` Jean-Christophe PLAGNIOL-VILLARD
  6 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-29 17:52 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/at91cap9.c                 |    1 +
 arch/arm/mach-at91/at91sam9260.c              |    1 +
 arch/arm/mach-at91/at91sam9261.c              |    1 +
 arch/arm/mach-at91/at91sam9263.c              |    1 +
 arch/arm/mach-at91/at91sam9_alt_reset.S       |    7 +++----
 arch/arm/mach-at91/at91sam9g45.c              |    1 +
 arch/arm/mach-at91/at91sam9g45_reset.S        |    7 +++----
 arch/arm/mach-at91/at91sam9rl.c               |    1 +
 arch/arm/mach-at91/generic.h                  |    1 +
 arch/arm/mach-at91/include/mach/at91_rstc.h   |   18 +++++++++++++++---
 arch/arm/mach-at91/include/mach/at91cap9.h    |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9260.h |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9261.h |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9263.h |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9g45.h |    2 +-
 arch/arm/mach-at91/include/mach/at91sam9rl.h  |    2 +-
 arch/arm/mach-at91/pm.c                       |    9 ++-------
 arch/arm/mach-at91/setup.c                    |    9 +++++++++
 18 files changed, 45 insertions(+), 24 deletions(-)

diff --git a/arch/arm/mach-at91/at91cap9.c b/arch/arm/mach-at91/at91cap9.c
index 7b7f30b..90daf48 100644
--- a/arch/arm/mach-at91/at91cap9.c
+++ b/arch/arm/mach-at91/at91cap9.c
@@ -323,6 +323,7 @@ static void __init at91cap9_map_io(void)
 static void __init at91cap9_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91CAP9_BASE_SHDWC);
+	at91_ioremap_rstc(AT91CAP9_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91CAP9_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91CAP9_BASE_SMC);
 }
diff --git a/arch/arm/mach-at91/at91sam9260.c b/arch/arm/mach-at91/at91sam9260.c
index 9219b29..22bbad7 100644
--- a/arch/arm/mach-at91/at91sam9260.c
+++ b/arch/arm/mach-at91/at91sam9260.c
@@ -321,6 +321,7 @@ static void __init at91sam9260_map_io(void)
 static void __init at91sam9260_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91SAM9260_BASE_SHDWC);
+	at91_ioremap_rstc(AT91SAM9260_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91SAM9260_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91SAM9260_BASE_SMC);
 }
diff --git a/arch/arm/mach-at91/at91sam9261.c b/arch/arm/mach-at91/at91sam9261.c
index b85b9ea..023c2ff 100644
--- a/arch/arm/mach-at91/at91sam9261.c
+++ b/arch/arm/mach-at91/at91sam9261.c
@@ -281,6 +281,7 @@ static void __init at91sam9261_map_io(void)
 static void __init at91sam9261_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91SAM9261_BASE_SHDWC);
+	at91_ioremap_rstc(AT91SAM9261_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91SAM9261_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91SAM9261_BASE_SMC);
 }
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index c26e0a1..5a7f902 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -299,6 +299,7 @@ static void __init at91sam9263_map_io(void)
 static void __init at91sam9263_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91SAM9263_BASE_SHDWC);
+	at91_ioremap_rstc(AT91SAM9263_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91SAM9263_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91SAM9263_BASE_SMC0);
 	at91sam9_ioremap_smc(1, AT91SAM9263_BASE_SMC1);
diff --git a/arch/arm/mach-at91/at91sam9_alt_reset.S b/arch/arm/mach-at91/at91sam9_alt_reset.S
index d3f931c..518e423 100644
--- a/arch/arm/mach-at91/at91sam9_alt_reset.S
+++ b/arch/arm/mach-at91/at91sam9_alt_reset.S
@@ -23,7 +23,8 @@
 			.globl	at91sam9_alt_restart
 
 at91sam9_alt_restart:	ldr	r0, .at91_va_base_sdramc	@ preload constants
-			ldr	r1, .at91_va_base_rstc_cr
+			ldr	r1, =at91_rstc_base
+			ldr	r1, [r1]
 
 			mov	r2, #1
 			mov	r3, #AT91_SDRAMC_LPCB_POWER_DOWN
@@ -33,11 +34,9 @@ at91sam9_alt_restart:	ldr	r0, .at91_va_base_sdramc	@ preload constants
 
 			str	r2, [r0, #AT91_SDRAMC_TR]	@ disable SDRAM access
 			str	r3, [r0, #AT91_SDRAMC_LPR]	@ power down SDRAM
-			str	r4, [r1]			@ reset processor
+			str	r4, [r1, #AT91_RSTC_CR]		@ reset processor
 
 			b	.
 
 .at91_va_base_sdramc:
 	.word AT91_VA_BASE_SYS + AT91_SDRAMC0
-.at91_va_base_rstc_cr:
-	.word AT91_VA_BASE_SYS + AT91_RSTC_CR
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 2d6e29f..7436c37 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -328,6 +328,7 @@ static void __init at91sam9g45_map_io(void)
 static void __init at91sam9g45_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91SAM9G45_BASE_SHDWC);
+	at91_ioremap_rstc(AT91SAM9G45_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91SAM9G45_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91SAM9G45_BASE_SMC);
 }
diff --git a/arch/arm/mach-at91/at91sam9g45_reset.S b/arch/arm/mach-at91/at91sam9g45_reset.S
index 69c75fd..0468be1 100644
--- a/arch/arm/mach-at91/at91sam9g45_reset.S
+++ b/arch/arm/mach-at91/at91sam9g45_reset.S
@@ -21,7 +21,8 @@
 
 at91sam9g45_restart:
 			ldr	r0, .at91_va_base_sdramc0	@ preload constants
-			ldr	r1, .at91_va_base_rstc_cr
+			ldr	r1, =at91_rstc_base
+			ldr	r1, [r1]
 
 			mov	r2, #1
 			mov	r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
@@ -31,11 +32,9 @@ at91sam9g45_restart:
 
 			str	r2, [r0, #AT91_DDRSDRC_RTR]	@ disable DDR0 access
 			str	r3, [r0, #AT91_DDRSDRC_LPR]	@ power down DDR0
-			str	r4, [r1]			@ reset processor
+			str	r4, [r1, #AT91_RSTC_CR]		@ reset processor
 
 			b	.
 
 .at91_va_base_sdramc0:
 	.word AT91_VA_BASE_SYS + AT91_DDRSDRC0
-.at91_va_base_rstc_cr:
-	.word AT91_VA_BASE_SYS + AT91_RSTC_CR
diff --git a/arch/arm/mach-at91/at91sam9rl.c b/arch/arm/mach-at91/at91sam9rl.c
index d6bcb1d..d2c91a8 100644
--- a/arch/arm/mach-at91/at91sam9rl.c
+++ b/arch/arm/mach-at91/at91sam9rl.c
@@ -286,6 +286,7 @@ static void __init at91sam9rl_map_io(void)
 static void __init at91sam9rl_ioremap_registers(void)
 {
 	at91_ioremap_shdwc(AT91SAM9RL_BASE_SHDWC);
+	at91_ioremap_rstc(AT91SAM9RL_BASE_RSTC);
 	at91sam926x_ioremap_pit(AT91SAM9RL_BASE_PIT);
 	at91sam9_ioremap_smc(0, AT91SAM9RL_BASE_SMC);
 }
diff --git a/arch/arm/mach-at91/generic.h b/arch/arm/mach-at91/generic.h
index 33907ce..5941334 100644
--- a/arch/arm/mach-at91/generic.h
+++ b/arch/arm/mach-at91/generic.h
@@ -58,6 +58,7 @@ extern void at91_irq_suspend(void);
 extern void at91_irq_resume(void);
 
 /* reset */
+extern void at91_ioremap_rstc(u32 base_addr);
 extern void at91sam9_alt_restart(char, const char *);
 extern void at91sam9g45_restart(char, const char *);
 
diff --git a/arch/arm/mach-at91/include/mach/at91_rstc.h b/arch/arm/mach-at91/include/mach/at91_rstc.h
index cbd2bf0..875fa33 100644
--- a/arch/arm/mach-at91/include/mach/at91_rstc.h
+++ b/arch/arm/mach-at91/include/mach/at91_rstc.h
@@ -16,13 +16,25 @@
 #ifndef AT91_RSTC_H
 #define AT91_RSTC_H
 
-#define AT91_RSTC_CR		(AT91_RSTC + 0x00)	/* Reset Controller Control Register */
+#ifndef __ASSEMBLY__
+extern void __iomem *at91_rstc_base;
+
+#define at91_rstc_read(field) \
+	__raw_readl(at91_rstc_base + field)
+
+#define at91_rstc_write(field, value) \
+	__raw_writel(value, at91_rstc_base + field);
+#else
+.extern at91_rstc_base
+#endif
+
+#define AT91_RSTC_CR		0x00			/* Reset Controller Control Register */
 #define		AT91_RSTC_PROCRST	(1 << 0)		/* Processor Reset */
 #define		AT91_RSTC_PERRST	(1 << 2)		/* Peripheral Reset */
 #define		AT91_RSTC_EXTRST	(1 << 3)		/* External Reset */
 #define		AT91_RSTC_KEY		(0xa5 << 24)		/* KEY Password */
 
-#define AT91_RSTC_SR		(AT91_RSTC + 0x04)	/* Reset Controller Status Register */
+#define AT91_RSTC_SR		0x04			/* Reset Controller Status Register */
 #define		AT91_RSTC_URSTS		(1 << 0)		/* User Reset Status */
 #define		AT91_RSTC_RSTTYP	(7 << 8)		/* Reset Type */
 #define			AT91_RSTC_RSTTYP_GENERAL	(0 << 8)
@@ -33,7 +45,7 @@
 #define		AT91_RSTC_NRSTL		(1 << 16)		/* NRST Pin Level */
 #define		AT91_RSTC_SRCMP		(1 << 17)		/* Software Reset Command in Progress */
 
-#define AT91_RSTC_MR		(AT91_RSTC + 0x08)	/* Reset Controller Mode Register */
+#define AT91_RSTC_MR		0x08			/* Reset Controller Mode Register */
 #define		AT91_RSTC_URSTEN	(1 << 0)		/* User Reset Enable */
 #define		AT91_RSTC_URSTIEN	(1 << 4)		/* User Reset Interrupt Enable */
 #define		AT91_RSTC_ERSTL		(0xf << 8)		/* External Reset Length */
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
index 4c0e2f6..61d9529 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -83,7 +83,6 @@
 #define AT91_DDRSDRC0	(0xffffe600 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffea00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_GPBR	(cpu_is_at91cap9_revB() ?	\
 			(0xfffffd50 - AT91_BASE_SYS) :	\
 			(0xfffffd60 - AT91_BASE_SYS))
@@ -96,6 +95,7 @@
 #define AT91CAP9_BASE_PIOB	0xfffff400
 #define AT91CAP9_BASE_PIOC	0xfffff600
 #define AT91CAP9_BASE_PIOD	0xfffff800
+#define AT91CAP9_BASE_RSTC	0xfffffd00
 #define AT91CAP9_BASE_SHDWC	0xfffffd10
 #define AT91CAP9_BASE_RTT	0xfffffd20
 #define AT91CAP9_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index f937c47..fa5ca27 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -83,7 +83,6 @@
 #define AT91_SDRAMC0	(0xffffea00 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffee00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_GPBR	(0xfffffd50 - AT91_BASE_SYS)
 
 #define AT91SAM9260_BASE_ECC	0xffffe800
@@ -92,6 +91,7 @@
 #define AT91SAM9260_BASE_PIOA	0xfffff400
 #define AT91SAM9260_BASE_PIOB	0xfffff600
 #define AT91SAM9260_BASE_PIOC	0xfffff800
+#define AT91SAM9260_BASE_RSTC	0xfffffd00
 #define AT91SAM9260_BASE_SHDWC	0xfffffd10
 #define AT91SAM9260_BASE_RTT	0xfffffd20
 #define AT91SAM9260_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 175604e..7cde2d3 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -68,7 +68,6 @@
 #define AT91_SDRAMC0	(0xffffea00 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffee00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_GPBR	(0xfffffd50 - AT91_BASE_SYS)
 
 #define AT91SAM9261_BASE_SMC	0xffffec00
@@ -76,6 +75,7 @@
 #define AT91SAM9261_BASE_PIOA	0xfffff400
 #define AT91SAM9261_BASE_PIOB	0xfffff600
 #define AT91SAM9261_BASE_PIOC	0xfffff800
+#define AT91SAM9261_BASE_RSTC	0xfffffd00
 #define AT91SAM9261_BASE_SHDWC	0xfffffd10
 #define AT91SAM9261_BASE_RTT	0xfffffd20
 #define AT91SAM9261_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h
index 80c9150..5949abd 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9263.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9263.h
@@ -78,7 +78,6 @@
 #define AT91_SDRAMC1	(0xffffe800 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffec00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_GPBR	(0xfffffd60 - AT91_BASE_SYS)
 
 #define AT91SAM9263_BASE_ECC0	0xffffe000
@@ -91,6 +90,7 @@
 #define AT91SAM9263_BASE_PIOC	0xfffff600
 #define AT91SAM9263_BASE_PIOD	0xfffff800
 #define AT91SAM9263_BASE_PIOE	0xfffffa00
+#define AT91SAM9263_BASE_RSTC	0xfffffd00
 #define AT91SAM9263_BASE_SHDWC	0xfffffd10
 #define AT91SAM9263_BASE_RTT0	0xfffffd20
 #define AT91SAM9263_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index f0c23c9..dd9c95e 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -90,7 +90,6 @@
 #define AT91_DDRSDRC0	(0xffffe600 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffea00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_GPBR	(0xfffffd60 - AT91_BASE_SYS)
 
 #define AT91SAM9G45_BASE_ECC	0xffffe200
@@ -102,6 +101,7 @@
 #define AT91SAM9G45_BASE_PIOC	0xfffff600
 #define AT91SAM9G45_BASE_PIOD	0xfffff800
 #define AT91SAM9G45_BASE_PIOE	0xfffffa00
+#define AT91SAM9G45_BASE_RSTC	0xfffffd00
 #define AT91SAM9G45_BASE_SHDWC	0xfffffd10
 #define AT91SAM9G45_BASE_RTT	0xfffffd20
 #define AT91SAM9G45_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index 2bb359e..d7bead7 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -72,7 +72,6 @@
 #define AT91_SDRAMC0	(0xffffea00 - AT91_BASE_SYS)
 #define AT91_MATRIX	(0xffffee00 - AT91_BASE_SYS)
 #define AT91_PMC	(0xfffffc00 - AT91_BASE_SYS)
-#define AT91_RSTC	(0xfffffd00 - AT91_BASE_SYS)
 #define AT91_SCKCR	(0xfffffd50 - AT91_BASE_SYS)
 #define AT91_GPBR	(0xfffffd60 - AT91_BASE_SYS)
 
@@ -84,6 +83,7 @@
 #define AT91SAM9RL_BASE_PIOB	0xfffff600
 #define AT91SAM9RL_BASE_PIOC	0xfffff800
 #define AT91SAM9RL_BASE_PIOD	0xfffffa00
+#define AT91SAM9RL_BASE_RSTC	0xfffffd00
 #define AT91SAM9RL_BASE_SHDWC	0xfffffd10
 #define AT91SAM9RL_BASE_RTT	0xfffffd20
 #define AT91SAM9RL_BASE_PIT	0xfffffd30
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 62ad955..1606379 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -34,7 +34,6 @@
 /*
  * Show the reason for the previous system reset.
  */
-#if defined(AT91_RSTC)
 
 #include <mach/at91_rstc.h>
 #include <mach/at91_shdwc.h>
@@ -58,10 +57,10 @@ static void __init show_reset_status(void)
 	char *reason, *r2 = reset;
 	u32 reset_type, wake_type;
 
-	if (!at91_shdwc_base)
+	if (!at91_shdwc_base || !at91_rstc_base)
 		return;
 
-	reset_type = at91_sys_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP;
+	reset_type = at91_rstc_read(AT91_RSTC_SR) & AT91_RSTC_RSTTYP;
 	wake_type = at91_shdwc_read(AT91_SHDW_SR);
 
 	switch (reset_type) {
@@ -102,10 +101,6 @@ static void __init show_reset_status(void)
 	}
 	pr_info("AT91: Starting after %s %s\n", reason, r2);
 }
-#else
-static void __init show_reset_status(void) {}
-#endif
-
 
 static int at91_pm_valid_state(suspend_state_t state)
 {
diff --git a/arch/arm/mach-at91/setup.c b/arch/arm/mach-at91/setup.c
index 242c26b..63902fb 100644
--- a/arch/arm/mach-at91/setup.c
+++ b/arch/arm/mach-at91/setup.c
@@ -299,6 +299,15 @@ void __init at91_ioremap_shdwc(u32 base_addr)
 	pm_power_off = at91sam9_poweroff;
 }
 
+void __iomem *at91_rstc_base;
+
+void __init at91_ioremap_rstc(u32 base_addr)
+{
+	at91_rstc_base = ioremap(base_addr, 16);
+	if (!at91_rstc_base)
+		panic("Impossible to ioremap at91_rstc_base\n");
+}
+
 void __init at91_initialize(unsigned long main_clock)
 {
 	at91_boot_soc.ioremap_registers();
-- 
1.7.7

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 17:42 ` Russell King - ARM Linux
  2011-11-29 17:49   ` Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 18:46   ` Marek Vasut
  2011-11-29 19:07     ` Russell King - ARM Linux
  1 sibling, 1 reply; 19+ messages in thread
From: Marek Vasut @ 2011-11-29 18:46 UTC (permalink / raw)
  To: linux-arm-kernel

> On Tue, Nov 29, 2011 at 06:35:14PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
wrote:
> > Hi,
> > 
> > 	the following patch series will merge the ddr controler header file
> > 	for sam9 and cap9 and cleanup the reset by
> > 	
> > 	swtich to arm_pm_restart
> > 	fix the sam9g45 and cap9 reset
> > 	make rstc soc independent
> > 
> > The following changes since commit 15327570807209b5c088382af23ed3fc47558d87:
> >   ARM: at91/gpio: fix display of number of irq setuped (2011-11-28
> >   22:53:09 +0800)
> > 
> > are available in the git repository at:
> >   git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset
> > 
> > Jean-Christophe PLAGNIOL-VILLARD (6):
> >       ARM: at91: fix cap9 ddrsdr register
> >       ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
> >       ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9
> >       alternative reset ARM: restart: at91: use new restart hook
> 
> Well, it looks like you've taken my work here and committed it as yourself.
> That's plagerism.  Don't do it - and fix it before someone pulls your crap.

Hey,

looking at the patch in question, it looks so trivial the clash is just 
possible. Why not just put two SoB lines there and maybe From: and be done with 
it?

M

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 18:46   ` Marek Vasut
@ 2011-11-29 19:07     ` Russell King - ARM Linux
  2011-11-29 19:23       ` Marek Vasut
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux @ 2011-11-29 19:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 29, 2011 at 07:46:13PM +0100, Marek Vasut wrote:
> > On Tue, Nov 29, 2011 at 06:35:14PM +0100, Jean-Christophe PLAGNIOL-VILLARD 
> wrote:
> > > Hi,
> > > 
> > > 	the following patch series will merge the ddr controler header file
> > > 	for sam9 and cap9 and cleanup the reset by
> > > 	
> > > 	swtich to arm_pm_restart
> > > 	fix the sam9g45 and cap9 reset
> > > 	make rstc soc independent
> > > 
> > > The following changes since commit 15327570807209b5c088382af23ed3fc47558d87:
> > >   ARM: at91/gpio: fix display of number of irq setuped (2011-11-28
> > >   22:53:09 +0800)
> > > 
> > > are available in the git repository at:
> > >   git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset
> > > 
> > > Jean-Christophe PLAGNIOL-VILLARD (6):
> > >       ARM: at91: fix cap9 ddrsdr register
> > >       ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
> > >       ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9
> > >       alternative reset ARM: restart: at91: use new restart hook
> > 
> > Well, it looks like you've taken my work here and committed it as yourself.
> > That's plagerism.  Don't do it - and fix it before someone pulls your crap.
> 
> Hey,
> 
> looking at the patch in question, it looks so trivial the clash is just 
> possible. Why not just put two SoB lines there and maybe From: and be done with 
> it?

Look closer.  The patch which was posted has my sign-off on it, it says
it's from me, but according to the commit summary, it's author is Jean-
Christophe.

So, it _is_ my patch which Jean has decided to _recommit_ into his tree
taking it from my tree _without_ _asking_ _me_ whether it was either a
good idea to do that, whether it was a finished patch, etc.

So all in all I'm pretty disgusted with Jean-Christophe over this.

I would like to see my patch updated at some point not to use
arm_pm_restart, but to use the .restart method directly, like I've been
doing for everyone else.  In other words, this patch is NOT STABLE at
the present time.

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 19:07     ` Russell King - ARM Linux
@ 2011-11-29 19:23       ` Marek Vasut
  2011-11-29 22:07         ` Russell King - ARM Linux
  0 siblings, 1 reply; 19+ messages in thread
From: Marek Vasut @ 2011-11-29 19:23 UTC (permalink / raw)
  To: linux-arm-kernel

> On Tue, Nov 29, 2011 at 07:46:13PM +0100, Marek Vasut wrote:
> > > On Tue, Nov 29, 2011 at 06:35:14PM +0100, Jean-Christophe
> > > PLAGNIOL-VILLARD
> > 
> > wrote:
> > > > Hi,
> > > > 
> > > > 	the following patch series will merge the ddr controler header 
file
> > > > 	for sam9 and cap9 and cleanup the reset by
> > > > 	
> > > > 	swtich to arm_pm_restart
> > > > 	fix the sam9g45 and cap9 reset
> > > > 	make rstc soc independent
> > > > 
> > > > The following changes since commit 
15327570807209b5c088382af23ed3fc47558d87:
> > > >   ARM: at91/gpio: fix display of number of irq setuped (2011-11-28
> > > >   22:53:09 +0800)
> > > > 
> > > > are available in the git repository at:
> > > >   git://github.com/at91linux/linux-at91.git for-arnd-3.3-reset
> > > > 
> > > > Jean-Christophe PLAGNIOL-VILLARD (6):
> > > >       ARM: at91: fix cap9 ddrsdr register
> > > >       ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h
> > > >       ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9
> > > >       alternative reset ARM: restart: at91: use new restart hook
> > > 
> > > Well, it looks like you've taken my work here and committed it as
> > > yourself. That's plagerism.  Don't do it - and fix it before someone
> > > pulls your crap.
> > 
> > Hey,
> > 
> > looking at the patch in question, it looks so trivial the clash is just
> > possible. Why not just put two SoB lines there and maybe From: and be
> > done with it?
> 
> Look closer.  The patch which was posted has my sign-off on it, it says
> it's from me, but according to the commit summary, it's author is Jean-
> Christophe.
> 
> So, it _is_ my patch which Jean has decided to _recommit_ into his tree
> taking it from my tree _without_ _asking_ _me_ whether it was either a
> good idea to do that, whether it was a finished patch, etc.

Ah ok, I see.
> 
> So all in all I'm pretty disgusted with Jean-Christophe over this.

Oh come on, calm down. Just keep an eye on him so he won't do it again and be 
done with it ;-) And Jean should certainly drop the patch if it's unfinished 
stuff.
> 
> I would like to see my patch updated at some point not to use
> arm_pm_restart, but to use the .restart method directly, like I've been
> doing for everyone else.  In other words, this patch is NOT STABLE at
> the present time.

OK

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 19:23       ` Marek Vasut
@ 2011-11-29 22:07         ` Russell King - ARM Linux
  2011-11-29 22:43           ` Marek Vasut
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux @ 2011-11-29 22:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 29, 2011 at 08:23:19PM +0100, Marek Vasut wrote:
> Just keep an eye on him so he won't do it again and be done with it ;-)
> And Jean should certainly drop the patch if it's unfinished stuff.

Oh so I should say nothing and let people take my work hand over fist.
No thanks, that's not the game I play.

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

* [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset
  2011-11-29 17:52 ` [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset Jean-Christophe PLAGNIOL-VILLARD
@ 2011-11-29 22:12   ` Russell King - ARM Linux
  2011-11-30  4:55     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 19+ messages in thread
From: Russell King - ARM Linux @ 2011-11-29 22:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 29, 2011 at 06:52:41PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> +			.globl	at91sam9g45_restart
> +
> +at91sam9g45_restart:
> +			ldr	r0, .at91_va_base_sdramc0	@ preload constants
> +			ldr	r1, .at91_va_base_rstc_cr
> +
> +			mov	r2, #1
> +			mov	r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
> +			ldr	r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
> +
> +			.balign	32				@ align to cache line
> +
> +			str	r2, [r0, #AT91_DDRSDRC_RTR]	@ disable DDR0 access
> +			str	r3, [r0, #AT91_DDRSDRC_LPR]	@ power down DDR0
> +			str	r4, [r1]			@ reset processor
> +
> +			b	.
> +
> +.at91_va_base_sdramc0:
> +	.word AT91_VA_BASE_SYS + AT91_DDRSDRC0

So is the only change between this new file and arch/arm/mach-at91/at91sam9_alt_reset.S
this line above?

arch/arm/mach-at91/at91sam9_alt_reset.S has:
        .word AT91_VA_BASE_SYS + AT91_SDRAMC0

Maybe the at91sam9_alt_reset.S version should take this as an argument so
the errata fix can be re-used on different AT91 versions, rather than
having to duplicate code just because one register address has changed.

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 22:07         ` Russell King - ARM Linux
@ 2011-11-29 22:43           ` Marek Vasut
  2011-11-29 22:48             ` Russell King - ARM Linux
  0 siblings, 1 reply; 19+ messages in thread
From: Marek Vasut @ 2011-11-29 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

> On Tue, Nov 29, 2011 at 08:23:19PM +0100, Marek Vasut wrote:
> > Just keep an eye on him so he won't do it again and be done with it ;-)
> > And Jean should certainly drop the patch if it's unfinished stuff.
> 
> Oh so I should say nothing and let people take my work hand over fist.
> No thanks, that's not the game I play.

I never said that and I understand your point clearly, don't be mistaken. What I 
meant was more like -- don't get that angry so fast and don't use so strong 
words, it's only a piece of code afterall.

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 22:43           ` Marek Vasut
@ 2011-11-29 22:48             ` Russell King - ARM Linux
  2011-11-29 23:03               ` Marek Vasut
  2011-11-30  4:46               ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 2 replies; 19+ messages in thread
From: Russell King - ARM Linux @ 2011-11-29 22:48 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Nov 29, 2011 at 11:43:30PM +0100, Marek Vasut wrote:
> > On Tue, Nov 29, 2011 at 08:23:19PM +0100, Marek Vasut wrote:
> > > Just keep an eye on him so he won't do it again and be done with it ;-)
> > > And Jean should certainly drop the patch if it's unfinished stuff.
> > 
> > Oh so I should say nothing and let people take my work hand over fist.
> > No thanks, that's not the game I play.
> 
> I never said that and I understand your point clearly, don't be mistaken. What I 
> meant was more like -- don't get that angry so fast and don't use so strong 
> words, it's only a piece of code afterall.

Sorry, I wasn't getting angry - am I not allowed to point out my disgust
at someone who's been around for quite some time making such a mistake?

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 22:48             ` Russell King - ARM Linux
@ 2011-11-29 23:03               ` Marek Vasut
  2011-11-30  4:46               ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 19+ messages in thread
From: Marek Vasut @ 2011-11-29 23:03 UTC (permalink / raw)
  To: linux-arm-kernel

> On Tue, Nov 29, 2011 at 11:43:30PM +0100, Marek Vasut wrote:
> > > On Tue, Nov 29, 2011 at 08:23:19PM +0100, Marek Vasut wrote:
> > > > Just keep an eye on him so he won't do it again and be done with it
> > > > ;-) And Jean should certainly drop the patch if it's unfinished
> > > > stuff.
> > > 
> > > Oh so I should say nothing and let people take my work hand over fist.
> > > No thanks, that's not the game I play.
> > 
> > I never said that and I understand your point clearly, don't be mistaken.
> > What I meant was more like -- don't get that angry so fast and don't use
> > so strong words, it's only a piece of code afterall.
> 
> Sorry, I wasn't getting angry - am I not allowed to point out my disgust
> at someone who's been around for quite some time making such a mistake?

Don't even the best of us make mistakes?

M

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

* [PATCH 0/6] AT91 Reset cleanup
  2011-11-29 22:48             ` Russell King - ARM Linux
  2011-11-29 23:03               ` Marek Vasut
@ 2011-11-30  4:46               ` Jean-Christophe PLAGNIOL-VILLARD
  1 sibling, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-30  4:46 UTC (permalink / raw)
  To: linux-arm-kernel

On 22:48 Tue 29 Nov     , Russell King - ARM Linux wrote:
> On Tue, Nov 29, 2011 at 11:43:30PM +0100, Marek Vasut wrote:
> > > On Tue, Nov 29, 2011 at 08:23:19PM +0100, Marek Vasut wrote:
> > > > Just keep an eye on him so he won't do it again and be done with it ;-)
> > > > And Jean should certainly drop the patch if it's unfinished stuff.
> > > 
> > > Oh so I should say nothing and let people take my work hand over fist.
> > > No thanks, that's not the game I play.
> > 
> > I never said that and I understand your point clearly, don't be mistaken. What I 
> > meant was more like -- don't get that angry so fast and don't use so strong 
> > words, it's only a piece of code afterall.
> 
> Sorry, I wasn't getting angry - am I not allowed to point out my disgust
> at someone who's been around for quite some time making such a mistake?

Russell is right I did the mistake not on purpose but I did

I apologize end of the story

Best Regards,
J.

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

* [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset
  2011-11-29 22:12   ` Russell King - ARM Linux
@ 2011-11-30  4:55     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 19+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2011-11-30  4:55 UTC (permalink / raw)
  To: linux-arm-kernel

On 22:12 Tue 29 Nov     , Russell King - ARM Linux wrote:
> On Tue, Nov 29, 2011 at 06:52:41PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > +			.globl	at91sam9g45_restart
> > +
> > +at91sam9g45_restart:
> > +			ldr	r0, .at91_va_base_sdramc0	@ preload constants
> > +			ldr	r1, .at91_va_base_rstc_cr
> > +
> > +			mov	r2, #1
> > +			mov	r3, #AT91_DDRSDRC_LPCB_POWER_DOWN
> > +			ldr	r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
> > +
> > +			.balign	32				@ align to cache line
> > +
> > +			str	r2, [r0, #AT91_DDRSDRC_RTR]	@ disable DDR0 access
> > +			str	r3, [r0, #AT91_DDRSDRC_LPR]	@ power down DDR0
> > +			str	r4, [r1]			@ reset processor
> > +
> > +			b	.
> > +
> > +.at91_va_base_sdramc0:
> > +	.word AT91_VA_BASE_SYS + AT91_DDRSDRC0
> 
> So is the only change between this new file and arch/arm/mach-at91/at91sam9_alt_reset.S
> this line above?
> 
> arch/arm/mach-at91/at91sam9_alt_reset.S has:
>         .word AT91_VA_BASE_SYS + AT91_SDRAMC0
> 
> Maybe the at91sam9_alt_reset.S version should take this as an argument so
> the errata fix can be re-used on different AT91 versions, rather than
> having to duplicate code just because one register address has changed.
its not only the register base address but also the registers offset

I get the same idea but at the end when I did it I end with more code
and the only patrt in common  are

ldr     r1, at91_va_base_rstc_cre
mov     r2, #1
ldr     r4, =AT91_RSTC_KEY | AT91_RSTC_PERRST | AT91_RSTC_PROCRST
str     r4, [r1]

so I chosse to split it

as if I want to do the second way I need to pass 5 params to the asm fucntion
and create one c function for sam9 and 9g45

Best Regards,
J.

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

end of thread, other threads:[~2011-11-30  4:55 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-29 17:35 [PATCH 0/6] AT91 Reset cleanup Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:42 ` Russell King - ARM Linux
2011-11-29 17:49   ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 18:46   ` Marek Vasut
2011-11-29 19:07     ` Russell King - ARM Linux
2011-11-29 19:23       ` Marek Vasut
2011-11-29 22:07         ` Russell King - ARM Linux
2011-11-29 22:43           ` Marek Vasut
2011-11-29 22:48             ` Russell King - ARM Linux
2011-11-29 23:03               ` Marek Vasut
2011-11-30  4:46               ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 1/6] ARM: at91: fix cap9 ddrsdr register Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 2/6] ARM: at91: merge at91cap9_ddrsdr.h in at91sam9_ddrsdr.h Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 3/6] ARM: at91: introduce AT91_SAM9_ALT_RESET to select the at91sam9 alternative reset Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 4/6] ARM: restart: at91: use new restart hook Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 5/6] ARM: at91: Fix at91sam9g45 and at91cap9 reset Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 22:12   ` Russell King - ARM Linux
2011-11-30  4:55     ` Jean-Christophe PLAGNIOL-VILLARD
2011-11-29 17:52 ` [PATCH 6/6] ARM: at91: make rstc soc independent Jean-Christophe PLAGNIOL-VILLARD

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.