public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Eric Nelson <eric.nelson@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] net: fec_mxc: allow use with cache enabled
Date: Tue, 06 Mar 2012 14:21:41 -0700	[thread overview]
Message-ID: <4F567FE5.3050805@boundarydevices.com> (raw)
In-Reply-To: <201203062049.15063.marex@denx.de>

On 03/06/2012 12:49 PM, Marek Vasut wrote:
> Dear Eric Nelson,
>
>> On 03/06/2012 10:06 AM, Eric Nelson wrote:
>>> On 03/05/2012 01:06 PM, Marek Vasut wrote:
>>>> Dear Eric Nelson,
>>>>
>>   >>  <snip>
>>   >>
>>>>> + if (!fec->rbd_base) {
>>>>> + ret = -ENOMEM;
>>>>> + goto err2;
>>>>> + }
>>>>> + memset(fec->rbd_base, 0, size);
>>>>> + }
>>>>
>>>> We might want to flush the descriptors to memory after they have been
>>>> inited?
>>
>> We're also missing a flush after the call to fec_rbd_init().
>
> I think we need only one flush in the whole allocation sequence. But you're
> probably right here.

Yeah. There's no point in doing memset() and flush() just to write them
again and not flush the proper values.

>>
>> I'm inclined to move that call to right after the memset and before
>> a newly-added flush and do the same with the call to tbd_init().
>
> You mean into fec_rbd_init() ?
>

fec_tbd_init(). See below.

diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 0db5ca9..d5d0d5e 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -544,6 +544,7 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
                         goto err1;
                 }
                 memset(fec->tbd_base, 0, size);
+               fec_tbd_init(fec);
                 flush_dcache_range((unsigned)fec->tbd_base, size);
         }

@@ -560,6 +561,13 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
                         goto err2;
                 }
                 memset(fec->rbd_base, 0, size);
+               /*
+                * Initialize RxBD ring
+                */
+               if (fec_rbd_init(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE) < 0) {
+                       ret = -ENOMEM;
+                       goto err3;
+               }
                 flush_dcache_range((unsigned)fec->rbd_base,
                                    (unsigned)fec->rbd_base + size);
         }
@@ -619,16 +627,6 @@ static int fec_init(struct eth_device *dev, bd_t* bd)
         writel((uint32_t)fec->tbd_base, &fec->eth->etdsr);
         writel((uint32_t)fec->rbd_base, &fec->eth->erdsr);

-       /*
-        * Initialize RxBD/TxBD rings
-        */
-       if (fec_rbd_init(fec, FEC_RBD_NUM, FEC_MAX_PKT_SIZE) < 0) {
-               ret = -ENOMEM;
-               goto err3;
-       }
-       fec_tbd_init(fec);
-
-

  reply	other threads:[~2012-03-06 21:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <http://lists.denx.de/pipermail/u-boot/2012-March/#119217>
2012-03-05 18:36 ` [U-Boot] [PATCH V2 0/1] net: fec_mxc: allow use with cache enabled Eric Nelson
2012-03-05 18:36   ` [U-Boot] [PATCH V2] " Eric Nelson
2012-03-05 20:06     ` Marek Vasut
2012-03-05 20:19       ` Wolfgang Denk
2012-03-05 20:23         ` Marek Vasut
2012-03-06 17:06       ` Eric Nelson
2012-03-06 18:08         ` Eric Nelson
2012-03-06 19:49           ` Marek Vasut
2012-03-06 21:21             ` Eric Nelson [this message]
2012-03-06 21:38               ` Marek Vasut
2012-03-06 19:45         ` Marek Vasut
2012-03-06 21:19           ` Eric Nelson
2012-03-06 21:22             ` Marek Vasut
2012-03-06 21:28               ` Eric Nelson

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=4F567FE5.3050805@boundarydevices.com \
    --to=eric.nelson@boundarydevices.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