From patchwork Thu Jul 5 02:44:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: warmcat X-Patchwork-Id: 9824 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 50A0023F28 for ; Thu, 5 Jul 2012 02:45:04 +0000 (UTC) Received: from mail-yx0-f180.google.com (mail-yx0-f180.google.com [209.85.213.180]) by fiordland.canonical.com (Postfix) with ESMTP id 1CC3FA185F0 for ; Thu, 5 Jul 2012 02:45:04 +0000 (UTC) Received: by mail-yx0-f180.google.com with SMTP id q6so7524937yen.11 for ; Wed, 04 Jul 2012 19:45:03 -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=3wtz9//tNuVrv0ik2xeupZH8HMDOSu5EMyEy7lsJLXo=; b=C4gPMqFEvxABs/FHD/6E42XTZHXEaFwTPbv+btFr2XW0C1j8LVuKURG9DRcGgURj/w 2zsENl+zRswpbqd3lpX04Q6deq/Ot7po5n4KkH4syAZs0i3dmViKtSzC8Mt2TUXsct0j UW9N4Z/dFClK7guvRFI3l4AmCuOhVCzjn4Icas0JNDDypfSis6CWkxQaoNavhlScKB2p GL5Wa1YEq81CM2BeF0Ly88vkOooH078zsDi+CLEc3YWIjIUO3eJOtZa6RGjX0IQL9HRu R4kpGMEwCet1Q3oVIyhSAJ3fkkLFahdQ3VtgmcjN760Zw0Jw4cN3NmKvWCAgPaKF3JNy 6UFw== Received: by 10.42.89.72 with SMTP id f8mr12587179icm.33.1341456303707; Wed, 04 Jul 2012 19:45:03 -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 v20csp60176ibb; Wed, 4 Jul 2012 19:45:00 -0700 (PDT) Received: by 10.216.213.37 with SMTP id z37mr7913050weo.132.1341456300089; Wed, 04 Jul 2012 19:45:00 -0700 (PDT) Received: from warmcat.com (warmcat.com. [87.106.134.80]) by mx.google.com with ESMTP id v15si15548979wem.76.2012.07.04.19.44.59; Wed, 04 Jul 2012 19:45:00 -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 4 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, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, linux-arm-kernel@lists.infradead.org Date: Thu, 05 Jul 2012 10:44:56 +0800 Message-ID: <20120705024454.26317.96460.stgit@build.warmcat.com> In-Reply-To: <20120705024259.26317.16000.stgit@build.warmcat.com> References: <20120705024259.26317.16000.stgit@build.warmcat.com> User-Agent: StGit/0.16-2-g0d85 MIME-Version: 1.0 X-Gm-Message-State: ALoCoQn4iWBEFWOlqbv7kgSRBSe9vq2LSAzsRISyKhMUVQqyLRM3CGy2IPX1kc3UJq6Z7gCGcnAH 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 83fb31c..06fadf4 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 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);