* [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address
@ 2010-07-06 1:10 Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 1/3] omap: Add new interface omap_get_die_id Kan-Ru Chen
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2010-07-06 1:10 UTC (permalink / raw)
To: linux-omap; +Cc: Thomas Weber, Kan-Ru Chen, Tony Lindgren
This patch series add the omap_get_die_id interface and use that
function to construct a MAC address for use by dm9000.
Kan-Ru Chen (3):
omap: Add new interface omap_get_die_id
omap: Use omap_get_die_id() to get the DIE ids
omap: Devkit8000: Use DIE id to initialize dm9000 MAC address
arch/arm/mach-omap2/board-devkit8000.c | 14 ++++++++++++++
arch/arm/mach-omap2/id.c | 24 ++++++++++++++++--------
arch/arm/mach-omap2/include/mach/id.h | 22 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 8 deletions(-)
create mode 100644 arch/arm/mach-omap2/include/mach/id.h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCHv2 1/3] omap: Add new interface omap_get_die_id
2010-07-06 1:10 [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
@ 2010-07-06 1:10 ` Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 2/3] omap: Use omap_get_die_id() to get the DIE ids Kan-Ru Chen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2010-07-06 1:10 UTC (permalink / raw)
To: linux-omap; +Cc: Thomas Weber, Kan-Ru Chen, Tony Lindgren
Allow DIE id to be get and used by others.
Signed-off-by: Kan-Ru Chen <kanru@0xlab.org>
---
arch/arm/mach-omap2/id.c | 10 ++++++++++
arch/arm/mach-omap2/include/mach/id.h | 22 ++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/include/mach/id.h
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 37b8a1a..80bd1cd 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -25,6 +25,8 @@
#include <plat/control.h>
#include <plat/cpu.h>
+#include <mach/id.h>
+
static struct omap_chip_id omap_chip;
static unsigned int omap_revision;
@@ -102,6 +104,14 @@ static struct omap_id omap_ids[] __initdata = {
static void __iomem *tap_base;
static u16 tap_prod_id;
+void omap_get_die_id(struct omap_die_id *odi)
+{
+ odi->id_0 = read_tap_reg(OMAP_TAP_DIE_ID_0);
+ odi->id_1 = read_tap_reg(OMAP_TAP_DIE_ID_1);
+ odi->id_2 = read_tap_reg(OMAP_TAP_DIE_ID_2);
+ odi->id_3 = read_tap_reg(OMAP_TAP_DIE_ID_3);
+}
+
void __init omap24xx_check_revision(void)
{
int i, j;
diff --git a/arch/arm/mach-omap2/include/mach/id.h b/arch/arm/mach-omap2/include/mach/id.h
new file mode 100644
index 0000000..02ed3aa
--- /dev/null
+++ b/arch/arm/mach-omap2/include/mach/id.h
@@ -0,0 +1,22 @@
+/*
+ * OMAP2 CPU identification code
+ *
+ * Copyright (C) 2010 Kan-Ru Chen <kanru@0xlab.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#ifndef OMAP2_ARCH_ID_H
+#define OMAP2_ARCH_ID_H
+
+struct omap_die_id {
+ u32 id_0;
+ u32 id_1;
+ u32 id_2;
+ u32 id_3;
+};
+
+void omap_get_die_id(struct omap_die_id *odi);
+
+#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv2 2/3] omap: Use omap_get_die_id() to get the DIE ids
2010-07-06 1:10 [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 1/3] omap: Add new interface omap_get_die_id Kan-Ru Chen
@ 2010-07-06 1:10 ` Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 3/3] omap: Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
2010-07-07 12:09 ` [PATCHv2 0/3] " Tony Lindgren
3 siblings, 0 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2010-07-06 1:10 UTC (permalink / raw)
To: linux-omap; +Cc: Thomas Weber, Kan-Ru Chen, Tony Lindgren
Signed-off-by: Kan-Ru Chen <kanru@0xlab.org>
---
arch/arm/mach-omap2/id.c | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 80bd1cd..4e11801 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -118,24 +118,22 @@ void __init omap24xx_check_revision(void)
u32 idcode, prod_id;
u16 hawkeye;
u8 dev_type, rev;
+ struct omap_die_id odi;
idcode = read_tap_reg(OMAP_TAP_IDCODE);
prod_id = read_tap_reg(tap_prod_id);
hawkeye = (idcode >> 12) & 0xffff;
rev = (idcode >> 28) & 0x0f;
dev_type = (prod_id >> 16) & 0x0f;
+ omap_get_die_id(&odi);
pr_debug("OMAP_TAP_IDCODE 0x%08x REV %i HAWKEYE 0x%04x MANF %03x\n",
idcode, rev, hawkeye, (idcode >> 1) & 0x7ff);
- pr_debug("OMAP_TAP_DIE_ID_0: 0x%08x\n",
- read_tap_reg(OMAP_TAP_DIE_ID_0));
+ pr_debug("OMAP_TAP_DIE_ID_0: 0x%08x\n", odi.id_0);
pr_debug("OMAP_TAP_DIE_ID_1: 0x%08x DEV_REV: %i\n",
- read_tap_reg(OMAP_TAP_DIE_ID_1),
- (read_tap_reg(OMAP_TAP_DIE_ID_1) >> 28) & 0xf);
- pr_debug("OMAP_TAP_DIE_ID_2: 0x%08x\n",
- read_tap_reg(OMAP_TAP_DIE_ID_2));
- pr_debug("OMAP_TAP_DIE_ID_3: 0x%08x\n",
- read_tap_reg(OMAP_TAP_DIE_ID_3));
+ odi.id_1, (odi.id_1 >> 28) & 0xf);
+ pr_debug("OMAP_TAP_DIE_ID_2: 0x%08x\n", odi.id_2);
+ pr_debug("OMAP_TAP_DIE_ID_3: 0x%08x\n", odi.id_3);
pr_debug("OMAP_TAP_PROD_ID_0: 0x%08x DEV_TYPE: %i\n",
prod_id, dev_type);
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCHv2 3/3] omap: Devkit8000: Use DIE id to initialize dm9000 MAC address
2010-07-06 1:10 [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 1/3] omap: Add new interface omap_get_die_id Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 2/3] omap: Use omap_get_die_id() to get the DIE ids Kan-Ru Chen
@ 2010-07-06 1:10 ` Kan-Ru Chen
2010-07-07 12:09 ` [PATCHv2 0/3] " Tony Lindgren
3 siblings, 0 replies; 5+ messages in thread
From: Kan-Ru Chen @ 2010-07-06 1:10 UTC (permalink / raw)
To: linux-omap; +Cc: Thomas Weber, Kan-Ru Chen, Tony Lindgren
The devkit8000 boards often come with empty EEPROM thus without
valid ethernet MAC address. The DIE id to MAC formula is copied from
u-boot.
Signed-off-by: Kan-Ru Chen <kanru@0xlab.org>
---
arch/arm/mach-omap2/board-devkit8000.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 922b746..51774d2 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -33,6 +33,7 @@
#include <linux/i2c/twl.h>
#include <mach/hardware.h>
+#include <mach/id.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
@@ -560,6 +561,9 @@ static struct platform_device omap_dm9000_dev = {
static void __init omap_dm9000_init(void)
{
+ unsigned char *eth_addr = omap_dm9000_platdata.dev_addr;
+ struct omap_die_id odi;
+
if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) {
printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n",
OMAP_DM9000_GPIO_IRQ);
@@ -567,6 +571,16 @@ static void __init omap_dm9000_init(void)
}
gpio_direction_input(OMAP_DM9000_GPIO_IRQ);
+
+ /* init the mac address using DIE id */
+ omap_get_die_id(&odi);
+
+ eth_addr[0] = 0x02; /* locally administered */
+ eth_addr[1] = odi.id_1 & 0xff;
+ eth_addr[2] = (odi.id_0 & 0xff000000) >> 24;
+ eth_addr[3] = (odi.id_0 & 0x00ff0000) >> 16;
+ eth_addr[4] = (odi.id_0 & 0x0000ff00) >> 8;
+ eth_addr[5] = (odi.id_0 & 0x000000ff);
}
static struct platform_device *devkit8000_devices[] __initdata = {
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address
2010-07-06 1:10 [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
` (2 preceding siblings ...)
2010-07-06 1:10 ` [PATCHv2 3/3] omap: Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
@ 2010-07-07 12:09 ` Tony Lindgren
3 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2010-07-07 12:09 UTC (permalink / raw)
To: Kan-Ru Chen; +Cc: linux-omap, Thomas Weber
* Kan-Ru Chen <kanru@0xlab.org> [100706 04:09]:
> This patch series add the omap_get_die_id interface and use that
> function to construct a MAC address for use by dm9000.
Thanks, I've applied these into omap for-next branch.
Regards,
Tony
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-07 12:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-06 1:10 [PATCHv2 0/3] Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 1/3] omap: Add new interface omap_get_die_id Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 2/3] omap: Use omap_get_die_id() to get the DIE ids Kan-Ru Chen
2010-07-06 1:10 ` [PATCHv2 3/3] omap: Devkit8000: Use DIE id to initialize dm9000 MAC address Kan-Ru Chen
2010-07-07 12:09 ` [PATCHv2 0/3] " Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).