From patchwork Sat Mar 12 22:50:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Green X-Patchwork-Id: 530 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:23 -0000 Delivered-To: patches@linaro.org Received: by 10.224.45.75 with SMTP id d11cs13751qaf; Sat, 12 Mar 2011 14:50:51 -0800 (PST) Received: by 10.227.204.195 with SMTP id fn3mr240238wbb.36.1299970250403; Sat, 12 Mar 2011 14:50:50 -0800 (PST) Received: from mail-wy0-f178.google.com (mail-wy0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id d3si10980797wbe.24.2011.03.12.14.50.49 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:50:50 -0800 (PST) Received-SPF: pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of andy.warmcat.com@googlemail.com designates 74.125.82.178 as permitted sender) smtp.mail=andy.warmcat.com@googlemail.com; dkim=pass (test mode) header.i=@googlemail.com Received: by mail-wy0-f178.google.com with SMTP id 26so4062942wyj.37 for ; Sat, 12 Mar 2011 14:50:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:sender:from:subject:to:cc:date:message-id :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding; bh=KW1CNL9qEKyJleHvP96/rRcufyFBZthKkdNbq/4smCY=; b=BgMIbtHF7dOrBr3mc0oW8cs3QrxDNkR2bcqLLB0NDCu+nzd9Ps5k/z+qxFOkYQXTSu XK2DP712jvQ+XrlTew9CE4dCJXc4ZZVGpdMUP2SVRtLaTbPODv95Nh8gdkPDEaNVki2L k47O2oX9Vm1g8r69izfvEEbFiyWdzD7S0GyFQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=sender:from:subject:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-type:content-transfer-encoding; b=G6KbAZxcKlgikdFdGZuuPIT8l7mgW1lk7cd6IcUcMMQsS+rPbdhyWuZzy0Z+EuZ3wS eK4BtdMbB1phDcjKSrporcO9F5Qx/7x+R5xxbfvoQkMQtzkD1L8aDFNfcaNze7tNXgr/ 1diQDHniILWpMAYF1oxww+VcH/doRpqP3/5Lc= Received: by 10.216.140.147 with SMTP id e19mr9491903wej.49.1299970249587; Sat, 12 Mar 2011 14:50:49 -0800 (PST) Received: from otae.warmcat.com (s15404224.onlinehome-server.info [87.106.134.80]) by mx.google.com with ESMTPS id j49sm2977661wer.38.2011.03.12.14.50.48 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 12 Mar 2011 14:50:49 -0800 (PST) Sender: Andy Green From: Andy Green Subject: [RFC PATCH 2/5] OMAP2+: add cpu id register to MAC address helper To: linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: patches@linaro.org, Andy Green Date: Sat, 12 Mar 2011 22:50:47 +0000 Message-ID: <20110312225047.27728.1835.stgit@otae.warmcat.com> In-Reply-To: <20110312224440.27728.60593.stgit@otae.warmcat.com> References: <20110312224440.27728.60593.stgit@otae.warmcat.com> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Introduce a generic helper function that can set a MAC address using data from the OMAP unqiue CPU ID register. Signed-off-by: Andy Green --- arch/arm/mach-omap2/id.c | 13 +++++++++++++ arch/arm/mach-omap2/include/mach/id.h | 1 + 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 5f9086c..fc69ec5 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c @@ -506,3 +506,16 @@ void __init omap2_set_globals_tap(struct omap_globals *omap2_globals) else tap_prod_id = 0x0208; } + + +void omap2_die_id_to_mac(u8 *mac, int length) +{ + struct omap_die_id odi; + + omap_get_die_id(&odi); + memcpy(mac, &odi.id_0, length); + + /* mark it as not multicast and outside official 80211 MAC namespace */ + + mac[0] = (mac[0] & ~1) | 2; +} diff --git a/arch/arm/mach-omap2/include/mach/id.h b/arch/arm/mach-omap2/include/mach/id.h index 02ed3aa..72e10eb 100644 --- a/arch/arm/mach-omap2/include/mach/id.h +++ b/arch/arm/mach-omap2/include/mach/id.h @@ -18,5 +18,6 @@ struct omap_die_id { }; void omap_get_die_id(struct omap_die_id *odi); +void omap2_die_id_to_mac(u8 *mac, int length); #endif