From: Valentin Longchamp <valentin.longchamp@keymile.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/5] kirkwood: add save functionality kirkwood_mpp_conf function
Date: Fri, 01 Jun 2012 09:03:28 +0200 [thread overview]
Message-ID: <4FC86940.1030509@keymile.com> (raw)
In-Reply-To: <20120531230212.GA3093@w500.iskon.local>
Hi Luka,
On 06/01/2012 01:02 AM, Luka Perkov wrote:
> Hi Valentin,
>
> On Thu, May 31, 2012 at 04:17:52PM +0200, Valentin Longchamp wrote:
>> 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 | 14 ++++++++++++--
>> arch/arm/include/asm/arch-kirkwood/mpp.h | 2 +-
>> 2 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> index 3da6c98..158ea84 100644
>> --- a/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> +++ b/arch/arm/cpu/arm926ejs/kirkwood/mpp.c
>> @@ -31,11 +31,11 @@ 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;
>> - int i;
>> + int i, save = 0;
>>
>> variant_mask = kirkwood_variant();
>> if (!variant_mask)
>> @@ -48,10 +48,13 @@ void kirkwood_mpp_conf(u32 *mpp_list)
>> }
>> debug("\n");
>>
>> + if (mpp_save)
>> + save = 1;
>>
>> 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 +69,13 @@ void kirkwood_mpp_conf(u32 *mpp_list)
>> }
>>
>> shift = (num & 7) << 2;
>> +
>> + if (save) {
>
> Why using new variable if it's only used in one place? Why not use this
> here:
>
> if (mpp_save) {
>
> Then we don't need save variable at all.
>
Yeah you are right, I can directly test on mpp_save, since it should remain NULL
during the whole while loop if NULL at the beginning.
next prev parent reply other threads:[~2012-06-01 7:03 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-31 14:17 [U-Boot] [PATCH v3 0/5] kirkwood spi_claim/release_bus support Valentin Longchamp
2012-05-31 14:17 ` [U-Boot] [PATCH v3 1/5] kirkwood: add save functionality kirkwood_mpp_conf function Valentin Longchamp
2012-05-31 23:02 ` Luka Perkov
2012-06-01 7:03 ` Valentin Longchamp [this message]
2012-06-01 8:46 ` Prafulla Wadaskar
2012-06-01 9:03 ` [U-Boot] [PATCH v4 " Valentin Longchamp
2012-06-01 9:09 ` Prafulla Wadaskar
2012-06-01 9:25 ` [U-Boot] [PATCH v4 0/5] kirkwood spi_claim/release_bus support Valentin Longchamp
2012-06-01 11:30 ` [U-Boot] [PATCH v4 1/5] kirkwood: add save functionality kirkwood_mpp_conf function Valentin Longchamp
2012-06-01 11:31 ` [U-Boot] [PATCH v4 2/5] kirkwood: fix calls to kirkwood_mpp_conf Valentin Longchamp
2012-06-01 11:31 ` [U-Boot] [PATCH v4 3/5] kw_spi: backup and reset the MPP of the chosen CS pin Valentin Longchamp
2012-06-01 11:31 ` [U-Boot] [PATCH v4 4/5] kw_spi: support spi_claim/release_bus functions Valentin Longchamp
2012-06-01 11:31 ` [U-Boot] [PATCH v4 5/5] kw_spi: add weak functions board_spi_claim/release_bus Valentin Longchamp
2012-06-05 14:21 ` [U-Boot] [PATCH v4 5/5] wispy: " Prafulla Wadaskar
2012-06-07 9:44 ` Valentin Longchamp
2012-05-31 14:17 ` [U-Boot] [PATCH v3 2/5] kirkwood: fix calls to kirkwood_mpp_conf Valentin Longchamp
2012-05-31 14:17 ` [U-Boot] [PATCH v3 3/5] kw_spi: backup and reset the MPP of the chosen CS pin Valentin Longchamp
2012-05-31 14:17 ` [U-Boot] [PATCH v3 4/5] kw_spi: support spi_claim/release_bus functions Valentin Longchamp
2012-05-31 14:17 ` [U-Boot] [PATCH v3 5/5] kw_spi: add weak functions board_spi_claim/release_bus Valentin Longchamp
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=4FC86940.1030509@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