linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: sebastian.hesselbarth@gmail.com (Sebastian Hesselbarth)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 1/2] ARM: kirkwood: retain MAC address for DT ethernet
Date: Thu, 03 Oct 2013 22:14:42 +0200	[thread overview]
Message-ID: <524DD032.4060308@gmail.com> (raw)
In-Reply-To: <20131003194449.GB30298@obsidianresearch.com>

On 10/03/2013 09:44 PM, Jason Gunthorpe wrote:
> On Thu, Oct 03, 2013 at 03:04:37PM -0400, Jason Cooper wrote:
>
>>> I'm wondering: is the clock really disabled if the device is not
>>> available (i.e. status == 'ok')? In other words: isn't the
>>> !of_device_is_available() test enough?
>>
>> Well, this stemmed from JasonG's scenario where the second iface is
>> shut off by the bootloader.  Although one could argue that the
>> bootloader should then update the dtb to mark that node as disabled...
>
> Right, that is what we do here, only the first eth is present in the
> dt, the second is gated and powered down (noting that Linux doesn't
> know how to power it up :()
>
> This check is only to prevent CPU lockup if the firmware has included
> a DT node for ethernet, not included the MAC address and turned off
> the clock.
>
> Sebastian, does __clk_enabled work properly for the mvebu clock
> provider? I don't see a clk_ops.is_enabled for mvebu.. (don't know
> much about clk)

(joint answer for all three above)

A node with status != "okay" means "hardware/board does not allow you
to use that port at all, i.e. no ethernet jack"; disabling the clock
just means "I don't expect _all_ users want to use this jack, but it
is connected". So there _is_ a difference here.

clk-gate, which is the underlying clk provider for our gates, does
provide .is_enabled and reads the register. I haven't tested this,
due to no KW hardware available right now, but it should test for
disabled clocks as expected.

> Also, I think you should move the pr_err above the clock test, or make
> a special pr_err for the clock test as well. Having the clock gated,
> no mac address and a dt node is still a fw bug.

Well, we have 4 cases here:
- status != "okay": skip
- of_get_mac_address() != NULL: skip (no registers read)
- !__clk_is_enabled(): skip and warn with FW_BUG about disabled
   clocks but no valid MAC address set.
- else, read registers, store MAC in DT, warn with FW_BUG about
   enabled clocks and no valid MAC address set.

Leaves missing public clk_is_enabled(), which I can provide a
patch for if Mike agrees (and I haven't missed anything without
really looking into CCF).

Sebastian

  reply	other threads:[~2013-10-03 20:14 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-03 12:44 [PATCH 1/2] ARM: kirkwood: retain MAC address for DT ethernet Sebastian Hesselbarth
2013-10-03 12:44 ` [PATCH 2/2] ARM: kirkwood: remove ethernet clock gate workaround Sebastian Hesselbarth
2013-10-03 13:50   ` Ezequiel Garcia
2013-10-03 13:47 ` [PATCH 1/2] ARM: kirkwood: retain MAC address for DT ethernet Andrew Lunn
2013-10-03 15:15   ` Sebastian Hesselbarth
2013-10-03 18:56 ` [PATCH v2 " Sebastian Hesselbarth
2013-10-03 19:02   ` Ezequiel Garcia
2013-10-03 19:04     ` Jason Cooper
2013-10-03 19:44       ` Jason Gunthorpe
2013-10-03 20:14         ` Sebastian Hesselbarth [this message]
2013-10-03 20:24         ` Andrew Lunn
2013-10-04 10:13   ` [PATCH v3] ARM: kirkwood: remove ethernet clock gate workaround Sebastian Hesselbarth
2013-10-04 10:14     ` Sebastian Hesselbarth
2013-10-04 10:17   ` [PATCH RESEND v3] ARM: kirkwood: retain MAC address for DT ethernet Sebastian Hesselbarth
2013-10-04 13:28     ` Andrew Lunn
2013-10-07 20:25     ` [PATCH v4] " Sebastian Hesselbarth
2013-10-07 23:30       ` Mike Turquette
2013-10-08 17:03       ` Jason Cooper

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=524DD032.4060308@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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).