From patchwork Fri Oct 9 10:17:14 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 52701 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n99AVg6x024540 for ; Fri, 9 Oct 2009 10:31:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751917AbZJIKWk (ORCPT ); Fri, 9 Oct 2009 06:22:40 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753341AbZJIKWk (ORCPT ); Fri, 9 Oct 2009 06:22:40 -0400 Received: from mail-yx0-f187.google.com ([209.85.210.187]:53368 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751917AbZJIKWj (ORCPT ); Fri, 9 Oct 2009 06:22:39 -0400 Received: by yxe17 with SMTP id 17so512309yxe.33 for ; Fri, 09 Oct 2009 03:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:date:message-id :subject; bh=2MA/+9zkBmDU/qtbbmCpEhIZJjVK4s3vvrXkJTP+Z9E=; b=qLI6F6XqtDhjFmN2Ea4sWdzRIzf1jO7agEm/Bg/1bycKx/sRwtgSnGO4nX7W8RdzH6 nhpnAcyh/Jh6/kVIugsvcXc6wGK3o3wQDOBq3kTRUXD/ivGemiGi/vZ8Vy/af7FWCuXR li+pmMamw+wlje2Ur7B46/BWgqkvHaCHFmOzs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:date:message-id:subject; b=AzGjPEF9n91596Jq+EL54VMDoPKQYy5lbJo9gZEA+q5qMav24LoKQFknm1hyMCuHPy oTLAXIa809dMn45wQaz46G+aBFZG+cYYJEe4yRbS3O3g0jhHer5uAPLEA2lH3y8Efd44 GA+iaPve63bOMMKXDNl+11El90GPMLrcHChc8= Received: by 10.101.89.5 with SMTP id r5mr2904352anl.69.1255083721348; Fri, 09 Oct 2009 03:22:01 -0700 (PDT) Received: from rxone.opensource.se (49.14.32.202.bf.2iij.net [202.32.14.49]) by mx.google.com with ESMTPS id 21sm9574ywh.5.2009.10.09.03.21.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 09 Oct 2009 03:22:00 -0700 (PDT) From: Magnus Damm To: netdev@vger.kernel.org Cc: Magnus Damm , lethal@linux-sh.org, davem@davemloft.net, linux-sh@vger.kernel.org Date: Fri, 09 Oct 2009 19:17:14 +0900 Message-Id: <20091009101714.31039.91896.sendpatchset@rxone.opensource.se> Subject: [PATCH] net: allow sh_eth to get mac address through platform data Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org --- 0001/arch/sh/include/asm/sh_eth.h +++ work/arch/sh/include/asm/sh_eth.h 2009-10-07 15:04:57.000000000 +0900 @@ -7,6 +7,7 @@ struct sh_eth_plat_data { int phy; int edmac_endian; + unsigned char mac_addr[6]; unsigned no_ether_link:1; unsigned ether_link_active_low:1; }; --- 0001/drivers/net/sh_eth.c +++ work/drivers/net/sh_eth.c 2009-10-07 16:54:29.000000000 +0900 @@ -298,16 +298,20 @@ static void update_mac_address(struct ne * When you want use this device, you must set MAC address in bootloader. * */ -static void read_mac_address(struct net_device *ndev) +static void read_mac_address(struct net_device *ndev, unsigned char *mac) { u32 ioaddr = ndev->base_addr; - ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); - ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; - ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; - ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); - ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; - ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); + if (mac[0] || mac[1] || mac[2] || mac[3] || mac[4] || mac[5]) { + memcpy(ndev->dev_addr, mac, 6); + } else { + ndev->dev_addr[0] = (ctrl_inl(ioaddr + MAHR) >> 24); + ndev->dev_addr[1] = (ctrl_inl(ioaddr + MAHR) >> 16) & 0xFF; + ndev->dev_addr[2] = (ctrl_inl(ioaddr + MAHR) >> 8) & 0xFF; + ndev->dev_addr[3] = (ctrl_inl(ioaddr + MAHR) & 0xFF); + ndev->dev_addr[4] = (ctrl_inl(ioaddr + MALR) >> 8) & 0xFF; + ndev->dev_addr[5] = (ctrl_inl(ioaddr + MALR) & 0xFF); + } } struct bb_info { @@ -1427,7 +1431,7 @@ static int sh_eth_drv_probe(struct platf mdp->post_fw = POST_FW >> (devno << 1); /* read and set MAC address */ - read_mac_address(ndev); + read_mac_address(ndev, pd->mac_addr); /* First device only init */ if (!devno) {