All of lore.kernel.org
 help / color / mirror / Atom feed
From: Albert ARIBAUD <albert.aribaud@free.fr>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2 3/6] mv_egiga: bugfix: DMA issue fixed using volatile
Date: Fri, 09 Jul 2010 11:54:11 +0200	[thread overview]
Message-ID: <4C36F1C3.5060806@free.fr> (raw)
In-Reply-To: <F766E4F80769BD478052FB6533FA745D19A4A5D416@SC-VEXCH4.marvell.com>

Le 09/07/2010 11:16, Prafulla Wadaskar a ?crit :
>
>
>> -----Original Message-----
>> From: u-boot-bounces at lists.denx.de
>> [mailto:u-boot-bounces at lists.denx.de] On Behalf Of Albert Aribaud
>> Sent: Friday, July 09, 2010 12:04 PM
>> To: u-boot at lists.denx.de
>> Subject: [U-Boot] [PATCH V2 3/6] mv_egiga: bugfix: DMA issue
>> fixed using volatile
>
> For each patch post, there must be some informative explanation about a patch that helps everybody to understand the objective of the patch, this is mostly applicable for all your patches
>
> Change log is something different, that is for developers and reviewers, that will not reflect on the repository after acceptance.
>
>>
>>
>> Signed-off-by: Albert Aribaud<albert.aribaud@free.fr>
>> ---
>>   drivers/net/mv_egiga.c |    2 +-
>>   drivers/net/mv_egiga.h |  206
>> ++++++++++++++++++++++++------------------------
>>   2 files changed, 104 insertions(+), 104 deletions(-)
>>
>> diff --git a/drivers/net/mv_egiga.c b/drivers/net/mv_egiga.c
>> index 0da4c4b..96e6a5a 100644
>> --- a/drivers/net/mv_egiga.c
>> +++ b/drivers/net/mv_egiga.c
>> @@ -177,7 +177,7 @@ static int smi_reg_write(char *devname,
>> u8 phy_adr, u8 reg_ofs, u16 data)
>>   }
>>
>>   /* Stop and checks all queues */
>> -static void stop_queue(u32 * qreg)
>> +static void stop_queue(volatile u32 * qreg)
>>   {
>>   	u32 reg_data;
>>
>> diff --git a/drivers/net/mv_egiga.h b/drivers/net/mv_egiga.h
>> index 61c3157..c49bf40 100644
>> --- a/drivers/net/mv_egiga.h
>> +++ b/drivers/net/mv_egiga.h
>> @@ -342,108 +342,108 @@
>>
>>   /* structures represents Controller registers */
>>   struct mv_egiga_barsz {
>> -	u32 bar;
>> -	u32 size;
>> +	volatile u32 bar;
>> +	volatile u32 size;
>
> May be, making all volatile solves problem at your end, that does not mean it is solution.
> Mostly all registers are accessed as volatile (readl/writel), register pointers are also volatile.
>
> I agree with you and suspect some code related to DMA pipes initialization has problem that's breaking it's functionality on Orion5X.
>
> I think we should debug on this to fix the bug correctly.
>
> Regards..
> Prafulla . .

I have debugged the issue when it happened and found out that the it is 
not really about doing volatile accesses, but about doing accesses 
out-of-order: the compiler intermixes writes from adjacent source code 
lines, which causes the write to the DMA start bit to occur before 
writes to the descriptors are done. Apparently qualifying the struct 
members volatile has an effect or write order that readl/writel have not.

I'll do a detailed comparison of disassembled code with and without the 
volatile qualifiers.

Amicalement,
-- 
Albert.

  reply	other threads:[~2010-07-09  9:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-09  6:34 [U-Boot] [PATCH V2 0/6] Marvell egiga multiple SoC support Albert Aribaud
2010-07-09  6:34 ` [U-Boot] [PATCH V2 1/6] net: rename: kirkwood_egiga as mv_egiga Albert Aribaud
2010-07-09  6:34   ` [U-Boot] [PATCH V2 2/6] mv_egiga: support SoCs other than kirkwood Albert Aribaud
2010-07-09  6:34     ` [U-Boot] [PATCH V2 3/6] mv_egiga: bugfix: DMA issue fixed using volatile Albert Aribaud
2010-07-09  6:34       ` [U-Boot] [PATCH V2 4/6] mv_egiga: only randomize MAC on kirkwood Albert Aribaud
2010-07-09  6:34         ` [U-Boot] [PATCH V2 5/6] mv_egiga: add support for orion5x egiga controller Albert Aribaud
2010-07-09  6:34           ` [U-Boot] [PATCH V2 6/6] edminiv2: add ethernet support Albert Aribaud
2010-07-09  8:58         ` [U-Boot] [PATCH V2 4/6] mv_egiga: only randomize MAC on kirkwood Prafulla Wadaskar
2010-07-09  9:17           ` Albert ARIBAUD
2010-07-09  9:16       ` [U-Boot] [PATCH V2 3/6] mv_egiga: bugfix: DMA issue fixed using volatile Prafulla Wadaskar
2010-07-09  9:54         ` Albert ARIBAUD [this message]
2010-07-09 11:11           ` Prafulla Wadaskar
2010-07-09 11:53             ` Albert ARIBAUD
2010-07-09 13:00               ` Albert ARIBAUD
2010-07-10  6:41                 ` Prafulla Wadaskar
2010-07-09 11:51           ` [U-Boot] mv_egiga: effect on making struct members volatile(was: [PATCH V2 3/6] mv_egiga: bugfix: DMA issue fixed using volatile) Albert ARIBAUD
2010-07-09  9:08   ` [U-Boot] [PATCH V2 1/6] net: rename: kirkwood_egiga as mv_egiga 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=4C36F1C3.5060806@free.fr \
    --to=albert.aribaud@free.fr \
    --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 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.