linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Mason <jon.mason@broadcom.com>
To: "Rafał Miłecki" <rafal@milecki.pl>
Cc: David Miller <davem@davemloft.net>,
	BCM Kernel Feedback <bcm-kernel-feedback-list@broadcom.com>,
	Network Development <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	Zac Schroff <zschroff@broadcom.com>
Subject: Re: [PATCH v2 1/2] net: ethernet: bgmac: init sequence bug
Date: Fri, 3 Feb 2017 17:34:48 -0500	[thread overview]
Message-ID: <CAC3K-4q7XObojqPppn=Qvps=BDMAQOfgxMBrci3VJrX+Pc73AQ@mail.gmail.com> (raw)
In-Reply-To: <8b0979e4-7202-869f-95b3-ab5d0381ed69@milecki.pl>

On Fri, Feb 3, 2017 at 4:41 PM, Rafał Miłecki <rafal@milecki.pl> wrote:
> On 02/03/2017 10:08 PM, Jon Mason wrote:
>>
>> @@ -61,15 +60,20 @@ static bool platform_bgmac_clk_enabled(struct bgmac
>> *bgmac)
>>
>>  static void platform_bgmac_clk_enable(struct bgmac *bgmac, u32 flags)
>>  {
>> -       bgmac_idm_write(bgmac, BCMA_IOCTL,
>> -                       (BCMA_IOCTL_CLK | BCMA_IOCTL_FGC | flags));
>> +       u32 val;
>> +
>> +       val = bgmac_idm_read(bgmac, BCMA_IOCTL);
>> +       /* Some bits of BCMA_IOCTL set by HW/ATF and should not change */
>> +       val |= flags & ~(BGMAC_AWCACHE | BGMAC_ARCACHE | BGMAC_AWUSER |
>> +                        BGMAC_ARUSER);
>> +       val |= BGMAC_CLK_EN;
>>         bgmac_idm_read(bgmac, BCMA_IOCTL);
>
>
> This read was previously following write op most likely to flush it or
> something. I don't think it makes any sense to read after read.

Actually, that is sloppy coding on my part.  It should have a write
prior to the read to match what was there before.

I find it odd that it worked when I tested this patch.  It makes me
wonder if this "modify, reset, modify" series is really necessary
after all.  The docs indicate that writing a 0 to the reset brings it
out of reset.  I do not see any code that puts the HW in reset.  So,
unless the bootloader puts the HW in reset or it is in the reset state
by default, this seems like unnecessary code.  I can add some CYA
logic to read and see if it is in reset, toggle the bit, and then just
do the CLK enable.  Thoughts?

Thanks,
Jon

  reply	other threads:[~2017-02-03 22:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-03 21:08 [PATCH v2 0/2] net: ethernet: bgmac: bug fixes Jon Mason
2017-02-03 21:08 ` [PATCH v2 1/2] net: ethernet: bgmac: init sequence bug Jon Mason
2017-02-03 21:41   ` Rafał Miłecki
2017-02-03 22:34     ` Jon Mason [this message]
2017-02-03 21:08 ` [PATCH v2 2/2] net: ethernet: bgmac: mac address change bug Jon Mason
2017-02-03 21:44   ` Rafał Miłecki
2017-02-03 21:49     ` Florian Fainelli

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='CAC3K-4q7XObojqPppn=Qvps=BDMAQOfgxMBrci3VJrX+Pc73AQ@mail.gmail.com' \
    --to=jon.mason@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rafal@milecki.pl \
    --cc=zschroff@broadcom.com \
    /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;
as well as URLs for NNTP newsgroup(s).