diff mbox

[U-Boot,v4,1/5] kirkwood: add save functionality kirkwood_mpp_conf function

Message ID 1338541399-30646-1-git-send-email-valentin.longchamp@keymile.com
State Accepted, archived
Commit 8f5d7a03986ac357f95c1131074e2abaa9e3fd22
Delegated to: Prafulla Wadaskar
Headers show

Commit Message

Valentin Longchamp June 1, 2012, 9:03 a.m. UTC
If a second non NULL argument is given to the kirkwood_mpp_conf
function, it will be used to store the current configuration of the MPP
registers. mpp_save  must be a preallocated table of the same size as
mpp_list and it must be zero terminated as well.

A later call to kirkwood_mpp_conf function with this saved list as first
(mpp_conf) argment will set the configuration back.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
---
 arch/arm/cpu/arm926ejs/kirkwood/mpp.c    |   10 +++++++++-
 arch/arm/include/asm/arch-kirkwood/mpp.h |    2 +-
 2 files changed, 10 insertions(+), 2 deletions(-)

Comments

Prafulla Wadaskar June 1, 2012, 9:09 a.m. UTC | #1
> -----Original Message-----
> From: Valentin Longchamp [mailto:valentin.longchamp@keymile.com]
> Sent: 01 June 2012 14:33
> Cc: u-boot@lists.denx.de; Valentin Longchamp; Holger Brunck; Prafulla
> Wadaskar
> Subject: [PATCH v4 1/5] kirkwood: add save functionality
> kirkwood_mpp_conf function
> 
> If a second non NULL argument is given to the kirkwood_mpp_conf
> function, it will be used to store the current configuration of the
> MPP
> registers. mpp_save  must be a preallocated table of the same size as
> mpp_list and it must be zero terminated as well.
> 
> A later call to kirkwood_mpp_conf function with this saved list as
> first
> (mpp_conf) argment will set the configuration back.
> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> cc: Holger Brunck <holger.brunck@keymile.com>
> cc: Prafulla Wadaskar <prafulla@marvell.com>
> ---

Have you send just one file? I have received only one!!
No Change log, pls send all files with V4 in the patch series.

Regards..
Prafulla . . .
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
index 3da6c98..03eb2de 100644
--- a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
+++ b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
@@ -31,7 +31,7 @@  static u32 kirkwood_variant(void)
 #define MPP_CTRL(i)	(KW_MPP_BASE + (i* 4))
 #define MPP_NR_REGS	(1 + MPP_MAX/8)
 
-void kirkwood_mpp_conf(u32 *mpp_list)
+void kirkwood_mpp_conf(u32 *mpp_list, u32 *mpp_save)
 {
 	u32 mpp_ctrl[MPP_NR_REGS];
 	unsigned int variant_mask;
@@ -52,6 +52,7 @@  void kirkwood_mpp_conf(u32 *mpp_list)
 	while (*mpp_list) {
 		unsigned int num = MPP_NUM(*mpp_list);
 		unsigned int sel = MPP_SEL(*mpp_list);
+		unsigned int sel_save;
 		int shift;
 
 		if (num > MPP_MAX) {
@@ -66,6 +67,13 @@  void kirkwood_mpp_conf(u32 *mpp_list)
 		}
 
 		shift = (num & 7) << 2;
+
+		if (mpp_save) {
+			sel_save = (mpp_ctrl[num / 8] >> shift) & 0xf;
+			*mpp_save = num | (sel_save << 8) | variant_mask;
+			mpp_save++;
+		}
+
 		mpp_ctrl[num / 8] &= ~(0xf << shift);
 		mpp_ctrl[num / 8] |= sel << shift;
 
diff --git a/arch/arm/include/asm/arch-kirkwood/mpp.h b/arch/arm/include/asm/arch-kirkwood/mpp.h
index b3c090e..8e50ee7 100644
--- a/arch/arm/include/asm/arch-kirkwood/mpp.h
+++ b/arch/arm/include/asm/arch-kirkwood/mpp.h
@@ -312,6 +312,6 @@ 
 
 #define MPP_MAX			49
 
-void kirkwood_mpp_conf(unsigned int *mpp_list);
+void kirkwood_mpp_conf(u32 *mpp_list, u32 *mpp_save);
 
 #endif