From patchwork Mon Jan 28 18:22:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 2057181 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id E31E0DF2A1 for ; Mon, 28 Jan 2013 18:25:17 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TztLb-0008Or-RH; Mon, 28 Jan 2013 18:22:23 +0000 Received: from quartz.orcorp.ca ([184.70.90.242]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TztLY-0008Ny-SP for linux-arm-kernel@lists.infradead.org; Mon, 28 Jan 2013 18:22:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=obsidianresearch.com; s=rsa1; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=j9F3uHQ277cvJ/R7nAV+wQQ/RYrN5KSaX48l744NcI4=; b=4i4v/HeKdC5CKRljpt9Na5JL6ezHHj4vdtCi/FOZhgi0JUhtHINo3QI+RXc3fCYNq8c6Cseqo9cZrslcK5gEF9A8XkW8JY6HaYLTPFD62xo8STaFTr3IwuhryO4zHqBi0Y9KhV2keHgWdqjWa0b9SkH1nZ2w2bX7sJjTZVAKAJQ=; Received: from [10.0.0.162] (helo=jggl.edm.orcorp.ca) by quartz.orcorp.ca with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1TztLR-00032T-7N; Mon, 28 Jan 2013 11:22:13 -0700 Received: from jgg by jggl.edm.orcorp.ca with local (Exim 4.76) (envelope-from ) id 1TztLW-0004ST-KJ; Mon, 28 Jan 2013 11:22:18 -0700 Date: Mon, 28 Jan 2013 11:22:18 -0700 From: Jason Gunthorpe To: Sebastian Hesselbarth Subject: Re: [PATCH v2 1/2] ARM: kirkwood: Ensure that kirkwood_ge0[01]_init() finds its clock Message-ID: <20130128182218.GB9436@obsidianresearch.com> References: <1359283223-23082-1-git-send-email-gmbnomis@gmail.com> <1359283223-23082-2-git-send-email-gmbnomis@gmail.com> <510506F9.3070500@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <510506F9.3070500@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Broken-Reverse-DNS: no host name found for IP address 10.0.0.162 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130128_132221_225654_84569065 X-CRM114-Status: GOOD ( 17.22 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: thomas.petazzoni@free-electrons.com, andrew@lunn.ch, mturquette@linaro.org, Simon Baatz , linux-arm-kernel@lists.infradead.org, jason@lakedaemon.net X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Sun, Jan 27, 2013 at 11:52:41AM +0100, Sebastian Hesselbarth wrote: > I agree that loosing the MAC address _is_ an issue but there must > be another way to retain it during gated ge clocks than not gate the > clocks at all. > > I can think of some ways to retain it but don't know what is the most > common with linux: > - make u-boot pass it through cmdline and let mv643xx get it from there > - have kirkwood's common code grab it before clk gates kick in The cannonical solution here is to have a DT attribute 'local-mac-address' that is filled in by the bootloader rather than attempting to pass the mac address to the kernel through the ethernet controller registers. Until the bootloaders are fixed a reasonable hack is to have the platform startup code look for an all-zeros local-mac-address in the DT and if found then copy the MAC from the ethernet registers into the DT. Then the ethernet driver can safely be a module since the MAC is captured in the DT. I've been using this patch here on top of the original Ian Molton patch. Jason: Can you include something like this as well? diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index 7048d7c..2b2cfcb 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2891,6 +2891,8 @@ static int mv643xx_eth_probe(struct platform_device *pdev) struct mv643xx_eth_private *mp; struct net_device *dev; struct resource *res; + const u8 *mac; + int len; int err; if (pdev->dev.of_node) { @@ -2912,6 +2914,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev) else pd->phy_addr = MV643XX_ETH_PHY_ADDR_DEFAULT; + mac = of_get_property(pdev->dev.of_node, "local-mac-address", &len); + if (mac && len == 6) + memcpy(pd->mac_addr, mac, sizeof pd->mac_addr); + np = of_parse_phandle(pdev->dev.of_node, "mdio", 0); if (np) { pd->shared = of_find_device_by_node(np);