From patchwork Tue Jul 3 04:22:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: warmcat X-Patchwork-Id: 9777 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 1C1D523E42 for ; Tue, 3 Jul 2012 04:22:48 +0000 (UTC) Received: from mail-yw0-f50.google.com (mail-yw0-f50.google.com [209.85.213.50]) by fiordland.canonical.com (Postfix) with ESMTP id CAEEAA18075 for ; Tue, 3 Jul 2012 04:22:47 +0000 (UTC) Received: by yhjj63 with SMTP id j63so5931578yhj.37 for ; Mon, 02 Jul 2012 21:22:47 -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=iGwJ87ULvMcHlv8poVEDYdvJAID1Wj55cFXdCr34RJg=; b=mxcm6KPgWbkc4xFaN5oERFtrGlbItdhzAc112taauRmQctSBGv+EJha2bPyX93TAJY IvZy+44kAmdS4pG+4vUWfHTlSEx6Zk52/JKx9+pgd+dGKCpe79FmbmaLdX/umENaXTMQ REHGxVWLdxA/qO8pbfdK2C5tk9Pt4brpavE8iieAFt9ZmRodyH2eSt0zAobY+7eyt+PM vbQK2atKx5Lo8Su7lWxMzwDSbnnKcMcgH2bSPdZQQtQ0Mf1liJA+WbBdsGPWBC9lbbPW GwpbUCA7S+rgIAy7/Awc3bgistgw1F3j85fZWOmNlLxKFhlhZBFXgp6ygTmPh7KJmRWC Vx1Q== Received: by 10.50.40.193 with SMTP id z1mr9228410igk.0.1341289367137; Mon, 02 Jul 2012 21:22:47 -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 v20csp34897ibb; Mon, 2 Jul 2012 21:22:46 -0700 (PDT) Received: by 10.180.86.194 with SMTP id r2mr21748887wiz.15.1341289365762; Mon, 02 Jul 2012 21:22:45 -0700 (PDT) Received: from warmcat.com (warmcat.com. [87.106.134.80]) by mx.google.com with ESMTP id w3si25931210wiz.27.2012.07.02.21.22.45; Mon, 02 Jul 2012 21:22:45 -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 3 3/4] 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, rostedt@goodmis.org, linux-arm-kernel@lists.infradead.org Date: Tue, 03 Jul 2012 12:22:41 +0800 Message-ID: <20120703042239.32697.50704.stgit@build.warmcat.com> In-Reply-To: <20120703041937.32697.46015.stgit@build.warmcat.com> References: <20120703041937.32697.46015.stgit@build.warmcat.com> User-Agent: StGit/0.16-2-g0d85 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQkPIa9/fa4/56cFaiFrRvVgX5ggsUVprR74DhQjg0XVYuoyAM9v/AWSOCdv4jV5ReAIPnpE From: Andy Green This provides the board-specific device paths needed to get the panda boardfile working with the 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 5e95aa6..e17eed1 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig @@ -348,6 +348,7 @@ config MACH_OMAP4_PANDA select OMAP_PACKAGE_CBL select OMAP_PACKAGE_CBS select REGULATOR_FIXED_VOLTAGE if REGULATOR + select 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..b028141 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 mac_platform panda_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_mac_platform) - 1; n++) + omap_die_id_to_ethernet_mac(panda_mac_platform[n].mac, n); + if (mac_platform_register_device_macs(panda_mac_platform)) + pr_err("Unable to register mac_platform devices\n"); + ret = wl12xx_set_platform_data(&omap_panda_wlan_data); if (ret) pr_err("error setting wl12xx data: %d\n", ret);