From patchwork Fri Jul 6 04:09:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: warmcat X-Patchwork-Id: 9881 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2B29623E16 for ; Fri, 6 Jul 2012 04:09:56 +0000 (UTC) Received: from mail-gg0-f180.google.com (mail-gg0-f180.google.com [209.85.161.180]) by fiordland.canonical.com (Postfix) with ESMTP id CB725A181EC for ; Fri, 6 Jul 2012 04:09:55 +0000 (UTC) Received: by ggnf1 with SMTP id f1so8814002ggn.11 for ; Thu, 05 Jul 2012 21:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:subject:to :from:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-type:content-transfer-encoding :x-gm-message-state; bh=9vgDd5agmWvwGZgzgKfYxwmG14EAugEOKAbUpsJ/kaI=; b=MrVj6gEVIzvfLzqpiUujuIS9xOB9eIdmLiz5KlctI2tf0UhV4SFkpbTk/8twZa13KZ GcvMeMtTbbbplblDi+NeZJUaSYvaSKvgJ3A5vGVQo2AXngg2U9LXDbav0N2ummigILgc Z4exJNSqurUSL6xVSt/kj32d9HSNygnSntEVOnTaGAVdSbODoKSxFonf8oNXAFjWYndm UkiuZjYq1r8JEfLYLUO0lx3VhM02ioMF0TVL+zRS6FQ+gdQdCAUh4nVQf5GD7B3Wajvx 8gn1QnSNA+zUV+6BSpNn8XSKVMYFzfHwlDYzAWfb/Ooett03F5nMahsgz88vAFrsvKie UZ5w== Received: by 10.50.195.234 with SMTP id ih10mr1565817igc.0.1341547794774; Thu, 05 Jul 2012 21:09:54 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.24.148 with SMTP id v20csp4008ibb; Thu, 5 Jul 2012 21:09:53 -0700 (PDT) Received: by 10.217.1.133 with SMTP id n5mr1411585wes.4.1341547792666; Thu, 05 Jul 2012 21:09:52 -0700 (PDT) Received: from warmcat.com (warmcat.com. [87.106.134.80]) by mx.google.com with ESMTP id x58si26150244wel.60.2012.07.05.21.09.51; Thu, 05 Jul 2012 21:09:52 -0700 (PDT) Received-SPF: neutral (google.com: 87.106.134.80 is neither permitted nor denied by best guess record for domain of andy.green@linaro.org) client-ip=87.106.134.80; Authentication-Results: mx.google.com; spf=neutral (google.com: 87.106.134.80 is neither permitted nor denied by best guess record for domain of andy.green@linaro.org) smtp.mail=andy.green@linaro.org Subject: [PATCH 5 2/2] OMAP4 PANDA register ethernet and wlan for automatic mac allocation To: linux-omap@vger.kernel.org From: Andy Green Cc: s-jan@ti.com, arnd@arndb.de, patches@linaro.org, tony@atomide.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, linux-arm-kernel@lists.infradead.org Date: Fri, 06 Jul 2012 12:09:48 +0800 Message-ID: <20120706040946.6669.1040.stgit@build.warmcat.com> In-Reply-To: <20120706040938.6669.77083.stgit@build.warmcat.com> References: <20120706040938.6669.77083.stgit@build.warmcat.com> User-Agent: StGit/0.16-2-g0d85 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkj7OKdnGVv/wbcYDd9wv7sm3pmYb78rgvOzUl4NBXIANol66nqzYIyKZUOUJmFZt8P2ywJ From: Andy Green This provides the board-specific device paths needed to get the panda boardfile working with the eth-mac-platform api. On Pandaboard / ES, neither the onboard Ethernet or onboard WLAN module have onboard arrangements for MAC storage, without this series yielding randomized MAC per-boot and consequent DHCP problems, or in the case of wlan0 a MAC set by a firmware file in the rootfs which unless customized yields a MAC of 00:00:00:00:00:00. No official MAC is reserved for either network device even if you do take the approach to customize the firmware file. This gets sane, consistent MAC addresses on both devices which should stand a good probability of differing between PandaBoards. Signed-off-by: Andy Green --- arch/arm/mach-omap2/Kconfig | 1 + arch/arm/mach-omap2/board-omap4panda.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 83fb31c..61c6a3d 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -358,6 +358,7 @@ config MACH_OMAP4_PANDA select OMAP_PACKAGE_CBL select OMAP_PACKAGE_CBS select REGULATOR_FIXED_VOLTAGE if REGULATOR + select ETH_MAC_PLATFORM config MACH_PCM049 bool "OMAP4 based phyCORE OMAP4" diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c index 982fb26..75d93cc 100644 --- a/arch/arm/mach-omap2/board-omap4panda.c +++ b/arch/arm/mach-omap2/board-omap4panda.c @@ -32,7 +32,10 @@ #include #include +#include + #include +#include #include #include #include @@ -486,16 +489,43 @@ static void omap4_panda_init_rev(void) } } +/* + * These device paths represent onboard network devices which have + * no MAC address set at boot, and need synthetic ones assigning + */ +static __initdata struct eth_mac_platform panda_eth_mac_platform[] = { + + { /* smsc USB <-> Ethernet bridge */ + .device_path = "usb1/1-1/1-1.1/1-1.1:1.0", + }, + { /* wlan0 module */ + .device_path = "wl12xx", + }, + { /* terminator */ + } +}; + static void __init omap4_panda_init(void) { int package = OMAP_PACKAGE_CBS; int ret; + int n; if (omap_rev() == OMAP4430_REV_ES1_0) package = OMAP_PACKAGE_CBL; omap4_mux_init(board_mux, NULL, package); omap_panda_wlan_data.irq = gpio_to_irq(GPIO_WIFI_IRQ); + + /* + * provide MAC addresses computed from device ID for network + * devices that have no MAC address otherwise on Panda + */ + for (n = 0; n < ARRAY_SIZE(panda_eth_mac_platform) - 1; n++) + omap_die_id_to_ethernet_mac(panda_eth_mac_platform[n].mac, n); + if (eth_mac_platform_register_device_macs(panda_eth_mac_platform)) + pr_err("Unable to register eth_mac_platform devices\n"); + ret = wl12xx_set_platform_data(&omap_panda_wlan_data); if (ret) pr_err("error setting wl12xx data: %d\n", ret);