From patchwork Sun Jul 8 14:26:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 1169651 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 89DE940134 for ; Sun, 8 Jul 2012 14:33:31 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SnsSH-00057o-VX; Sun, 08 Jul 2012 14:27:22 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1SnsS8-00057Q-Cr for linux-arm-kernel@lists.infradead.org; Sun, 08 Jul 2012 14:27:14 +0000 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q68ER07q030548; Sun, 8 Jul 2012 09:27:00 -0500 Received: from DBDE71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id q68EQrm2027536; Sun, 8 Jul 2012 19:56:53 +0530 (IST) Received: from dbdp32.itg.ti.com (172.24.170.251) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 14.1.323.3; Sun, 8 Jul 2012 19:56:53 +0530 Received: from [172.24.81.158] (smtpvbd.itg.ti.com [172.24.170.250]) by dbdp32.itg.ti.com (8.13.8/8.13.8) with ESMTP id q68EQlmV028608; Sun, 8 Jul 2012 19:56:48 +0530 Message-ID: <4FF998A7.50309@ti.com> Date: Sun, 8 Jul 2012 19:56:47 +0530 From: Sekhar Nori User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20120614 Thunderbird/13.0.1 MIME-Version: 1.0 To: Heiko Schocher Subject: Re: [PATCH v5 4/7] ARM: davinci: net: davinci_emac: add OF support References: <1338373143-7467-1-git-send-email-hs@denx.de> <1338373143-7467-5-git-send-email-hs@denx.de> In-Reply-To: <1338373143-7467-5-git-send-email-hs@denx.de> X-Spam-Note: CRM114 invocation failed X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.152 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: davinci-linux-open-source@linux.davincidsp.com, Wolfgang Denk , netdev@vger.kernel.org, devicetree-discuss@lists.ozlabs.org, Grant Likely , Anatoly Sivov , linux-arm-kernel@lists.infradead.org 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 Hi Heiko, On 5/30/2012 3:49 PM, Heiko Schocher wrote: > add of support for the davinci_emac driver. > > Signed-off-by: Heiko Schocher > Cc: davinci-linux-open-source@linux.davincidsp.com > Cc: linux-arm-kernel@lists.infradead.org > Cc: devicetree-discuss@lists.ozlabs.org > Cc: netdev@vger.kernel.org > Cc: Grant Likely > Cc: Sekhar Nori > Cc: Wolfgang Denk > Cc: Anatoly Sivov > > --- > +#ifdef CONFIG_OF > +static struct emac_platform_data > + *davinci_emac_of_get_pdata(struct platform_device *pdev, > + struct emac_priv *priv) > +{ > + struct device_node *np; > + struct emac_platform_data *pdata = NULL; > + const u8 *mac_addr; > + u32 data; > + int ret; > + > + pdata = pdev->dev.platform_data; > + if (!pdata) { > + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); > + if (!pdata) > + goto nodata; > + } > + > + np = pdev->dev.of_node; > + if (!np) > + goto nodata; > + else > + pdata->version = EMAC_VERSION_2; > + > + mac_addr = of_get_mac_address(np); > + if (mac_addr) > + memcpy(pdata->mac_addr, mac_addr, ETH_ALEN); I suspect that even in the DT case, many boards will continue to read mac address from on-board EEPROMs or from an on-chip eFUSE. To take care of such cases, I propose use mac address in DT data only if no valid address is passed through platform data. The attached patch does this change. If you are OK with this modification, can you please merge it and repost just this patch for review? Please CC David Miller (davem@davemloft.net) on your next post as he is the netdev maintainer and this patch needs to be merged through him or at least needs his ack. With this modification, you can add my: Acked-by: Sekhar Nori Thanks, Sekhar ---8<---- diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c index 645618d..6b4b0fe 100644 --- a/drivers/net/ethernet/ti/davinci_emac.c +++ b/drivers/net/ethernet/ti/davinci_emac.c @@ -1795,9 +1795,11 @@ static struct emac_platform_data else pdata->version = EMAC_VERSION_2; - mac_addr = of_get_mac_address(np); - if (mac_addr) - memcpy(pdata->mac_addr, mac_addr, ETH_ALEN); + if (!is_valid_ether_addr(pdata->mac_addr)) { + mac_addr = of_get_mac_address(np); + if (mac_addr) + memcpy(pdata->mac_addr, mac_addr, ETH_ALEN); + } ret = of_property_read_u32(np, "ti,davinci-ctrl-reg-offset", &data); if (!ret)