From: Valentin Longchamp <valentin.longchamp@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] kirkwood: add kirkwood_mpp_save/restore functions
Date: Tue, 29 May 2012 10:44:46 +0200 [thread overview]
Message-ID: <4FC48C7E.2020408@keymile.com> (raw)
In-Reply-To: <F766E4F80769BD478052FB6533FA745D1A2FB28A29@SC-VEXCH4.marvell.com>
On 05/24/2012 10:26 AM, Prafulla Wadaskar wrote:
>
>
>> -----Original Message-----
>> From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
>> Sent: 16 May 2012 16:24
>> To: Prafulla Wadaskar; holger.brunck at keymile.com
>> Cc: Valentin Longchamp; u-boot at lists.denx.de; Holger Brunck; Prafulla
>> Wadaskar
>> Subject: [PATCH 1/3] kirkwood: add kirkwood_mpp_save/restore functions
>>
>> These 2 functions can be used in pair if one needs to set a mpp
>> configuration only for a given time and then switch back to the
>> previous
>> mpp config.
>>
>> 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 | 18 ++++++++++++++++++
>> arch/arm/include/asm/arch-kirkwood/mpp.h | 2 ++
>> 2 files changed, 20 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> index 3da6c98..43f5053 100644
>> --- a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> @@ -80,3 +80,21 @@ void kirkwood_mpp_conf(u32 *mpp_list)
>> debug("\n");
>>
>> }
>> +
>> +u32 mpp_regs[MPP_NR_REGS];
>
> This is optional feature only used in this specific case.
> No global here, this should be part of caller function.
I wanted this patch to be independant of the SPI claim bus that _currently_ is
the only one using it, but who knows in the future.
Anyway if this isn't global here, it will have to be global in the
kirkwood_spi.c driver since it would have to be shared between spi_claim_bus and
spi_release_bus.
>
>> +
>> +void kirkwood_mpp_save(void)
> This should be
> void kirkwood_mpp_save(unsigned int *mpp_ctrl, int len)
Here we save _all_ mpp registers, with direct access to the registers. With your
proposed solution, I would save it in a dynamically allocated table of size len.
That's fine for me, but I would then need to export MPP_NR_REGS, because that is
what I would pass as len arg, is that OK ?
>
>> +{
>> + int i;
>> +
>> + for (i = 0; i < MPP_NR_REGS; i++)
>> + mpp_regs[i] = readl(MPP_CTRL(i));
>> +}
>> +
>> +void kirkwood_mpp_restore(void)
> Same here
> void kirkwood_mpp_restore(unsigned int *mpp_ctrl, int len)
>
>> +{
>> + int i;
>> +
>> + for (i = 0; i < MPP_NR_REGS; i++)
>> + writel(mpp_regs[i], MPP_CTRL(i));
>> +}
>> diff --git a/arch/arm/include/asm/arch-kirkwood/mpp.h
>> b/arch/arm/include/asm/arch-kirkwood/mpp.h
>> index b3c090e..da65b4d 100644
>> --- a/arch/arm/include/asm/arch-kirkwood/mpp.h
>> +++ b/arch/arm/include/asm/arch-kirkwood/mpp.h
>> @@ -313,5 +313,7 @@
>> #define MPP_MAX 49
>>
>> void kirkwood_mpp_conf(unsigned int *mpp_list);
>> +void kirkwood_mpp_save(void);
>> +void kirkwood_mpp_restore(void);
>
> Regards..
> Prafulla . . .
next prev parent reply other threads:[~2012-05-29 8:44 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 10:53 [U-Boot] [PATCH 0/3] kirkwood spi_claim/release_bus support Valentin Longchamp
2012-05-16 10:53 ` [U-Boot] [PATCH 1/3] kirkwood: add kirkwood_mpp_save/restore functions Valentin Longchamp
2012-05-24 8:26 ` Prafulla Wadaskar
2012-05-28 22:07 ` Michael Walle
2012-05-29 12:42 ` Prafulla Wadaskar
2012-05-29 17:02 ` Michael Walle
2012-05-29 8:44 ` Valentin Longchamp [this message]
2012-05-29 10:12 ` Prafulla Wadaskar
2012-05-29 11:28 ` Valentin Longchamp
2012-05-29 12:06 ` Prafulla Wadaskar
2012-05-29 12:50 ` Valentin Longchamp
2012-05-29 13:15 ` Prafulla Wadaskar
2012-05-29 14:47 ` Marek Vasut
2012-05-30 14:28 ` [U-Boot] patchwork cleanup Prafulla Wadaskar
2012-06-01 15:27 ` Marek Vasut
2012-05-16 10:53 ` [U-Boot] [PATCH 2/3] spi/kirkwood: support spi_claim/release_bus functions Valentin Longchamp
2012-05-24 8:35 ` Prafulla Wadaskar
2012-05-29 8:32 ` Valentin Longchamp
2012-05-29 10:29 ` Prafulla Wadaskar
2012-05-29 11:32 ` Valentin Longchamp
2012-05-16 10:53 ` [U-Boot] [PATCH 3/3] spi/kirkwood: add weak functions board_spi_claim/release_bus Valentin Longchamp
2012-05-24 8:38 ` Prafulla Wadaskar
2012-05-29 8:32 ` Valentin Longchamp
2012-05-29 12:13 ` Prafulla Wadaskar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4FC48C7E.2020408@keymile.com \
--to=valentin.longchamp@keymile.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox