aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/omap3/beagle/beagle.c2
-rw-r--r--board/omap3/evm/evm.c2
-rw-r--r--board/omap3/overo/overo.c2
-rw-r--r--board/omap3/pandora/pandora.c2
-rw-r--r--board/omap3/zoom1/zoom1.c1
-rw-r--r--cpu/arm_cortexa8/omap3/sys_info.c26
-rw-r--r--cpu/pxa/interrupts.c46
-rw-r--r--drivers/net/mpc5xxx_fec.c23
-rw-r--r--include/asm-arm/arch-omap3/cpu.h13
-rw-r--r--include/asm-arm/arch-omap3/omap3.h1
-rw-r--r--include/asm-arm/arch-omap3/sys_proto.h1
11 files changed, 90 insertions, 29 deletions
diff --git a/board/omap3/beagle/beagle.c b/board/omap3/beagle/beagle.c
index 7377058f7..8d6065196 100644
--- a/board/omap3/beagle/beagle.c
+++ b/board/omap3/beagle/beagle.c
@@ -116,6 +116,8 @@ int misc_init_r(void)
beagle_identify();
+ dieid_num_r();
+
return 0;
}
diff --git a/board/omap3/evm/evm.c b/board/omap3/evm/evm.c
index b406312e0..3a27c8fe5 100644
--- a/board/omap3/evm/evm.c
+++ b/board/omap3/evm/evm.c
@@ -68,6 +68,8 @@ int misc_init_r(void)
setup_net_chip();
#endif
+ dieid_num_r();
+
return 0;
}
diff --git a/board/omap3/overo/overo.c b/board/omap3/overo/overo.c
index 48375ad01..37bf350e4 100644
--- a/board/omap3/overo/overo.c
+++ b/board/omap3/overo/overo.c
@@ -60,6 +60,8 @@ int misc_init_r(void)
{
power_init_r();
+ dieid_num_r();
+
return 0;
}
diff --git a/board/omap3/pandora/pandora.c b/board/omap3/pandora/pandora.c
index 3f9de991c..dfd51ecfc 100644
--- a/board/omap3/pandora/pandora.c
+++ b/board/omap3/pandora/pandora.c
@@ -77,6 +77,8 @@ int misc_init_r(void)
writel(GPIO28, &gpio5_base->setdataout);
writel(GPIO4, &gpio6_base->setdataout);
+ dieid_num_r();
+
return 0;
}
diff --git a/board/omap3/zoom1/zoom1.c b/board/omap3/zoom1/zoom1.c
index d67abf755..702f73275 100644
--- a/board/omap3/zoom1/zoom1.c
+++ b/board/omap3/zoom1/zoom1.c
@@ -61,6 +61,7 @@ int board_init(void)
int misc_init_r(void)
{
power_init_r();
+ dieid_num_r();
return 0;
}
diff --git a/cpu/arm_cortexa8/omap3/sys_info.c b/cpu/arm_cortexa8/omap3/sys_info.c
index 28a102091..b385b912b 100644
--- a/cpu/arm_cortexa8/omap3/sys_info.c
+++ b/cpu/arm_cortexa8/omap3/sys_info.c
@@ -36,6 +36,32 @@ static gpmc_csx_t *gpmc_cs_base = (gpmc_csx_t *)GPMC_CONFIG_CS0_BASE;
static sdrc_t *sdrc_base = (sdrc_t *)OMAP34XX_SDRC_BASE;
static ctrl_t *ctrl_base = (ctrl_t *)OMAP34XX_CTRL_BASE;
+/*****************************************************************
+ * dieid_num_r(void) - read and set die ID
+ *****************************************************************/
+void dieid_num_r(void)
+{
+ ctrl_id_t *id_base = (ctrl_id_t *)OMAP34XX_ID_L4_IO_BASE;
+ char *uid_s, die_id[34];
+ u32 id[4];
+
+ memset(die_id, 0, sizeof(die_id));
+
+ uid_s = getenv("dieid#");
+
+ if (uid_s == NULL) {
+ id[3] = readl(&id_base->die_id_0);
+ id[2] = readl(&id_base->die_id_1);
+ id[1] = readl(&id_base->die_id_2);
+ id[0] = readl(&id_base->die_id_3);
+ sprintf(die_id, "%08x%08x%08x%08x", id[0], id[1], id[2], id[3]);
+ setenv("dieid#", die_id);
+ uid_s = die_id;
+ }
+
+ printf("Die ID #%s\n", uid_s);
+}
+
/******************************************
* get_cpu_type(void) - extract cpu info
******************************************/
diff --git a/cpu/pxa/interrupts.c b/cpu/pxa/interrupts.c
index 40d8bf251..2bc5c50a9 100644
--- a/cpu/pxa/interrupts.c
+++ b/cpu/pxa/interrupts.c
@@ -28,6 +28,7 @@
#include <common.h>
#include <asm/arch/pxa-regs.h>
+#include <div64.h>
#ifdef CONFIG_USE_IRQ
#error: interrupts not implemented yet
@@ -41,6 +42,20 @@
#error "Timer frequency unknown - please config PXA CPU type"
#endif
+static inline unsigned long long tick_to_time(unsigned long long tick)
+{
+ tick *= CONFIG_SYS_HZ;
+ do_div(tick, TIMER_FREQ_HZ);
+ return tick;
+}
+
+static inline unsigned long long us_to_tick(unsigned long long us)
+{
+ us = us * TIMER_FREQ_HZ + 999999;
+ do_div(us, 1000000);
+ return us;
+}
+
int interrupt_init (void)
{
/* nothing happens here - we don't setup any IRQs */
@@ -75,33 +90,20 @@ void reset_timer_masked (void)
ulong get_timer_masked (void)
{
- unsigned long long ticks = get_ticks();
-
- return (((ticks / TIMER_FREQ_HZ) * 1000) +
- ((ticks % TIMER_FREQ_HZ) * 1000) / TIMER_FREQ_HZ);
+ return tick_to_time(get_ticks());
}
void udelay_masked (unsigned long usec)
{
+ unsigned long long tmp;
ulong tmo;
- ulong endtime;
- signed long diff;
-
- if (usec >= 1000) {
- tmo = usec / 1000;
- tmo *= TIMER_FREQ_HZ;
- tmo /= 1000;
- } else {
- tmo = usec * TIMER_FREQ_HZ;
- tmo /= (1000*1000);
- }
-
- endtime = get_ticks() + tmo;
-
- do {
- ulong now = get_ticks();
- diff = endtime - now;
- } while (diff >= 0);
+
+ tmo = us_to_tick(usec);
+ tmp = get_ticks() + tmo; /* get current timestamp */
+
+ while (get_ticks() < tmp) /* loop till event */
+ /*NOP*/;
+
}
/*
diff --git a/drivers/net/mpc5xxx_fec.c b/drivers/net/mpc5xxx_fec.c
index 2bf901e13..0f1d1af0e 100644
--- a/drivers/net/mpc5xxx_fec.c
+++ b/drivers/net/mpc5xxx_fec.c
@@ -281,13 +281,6 @@ static int mpc5xxx_fec_init(struct eth_device *dev, bd_t * bis)
}
fec->eth->x_cntrl = 0x00000000; /* half-duplex, heartbeat disabled */
- if (fec->xcv_type != SEVENWIRE) {
- /*
- * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
- * and do not drop the Preamble.
- */
- fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
- }
/*
* Set Opcode/Pause Duration Register
@@ -640,6 +633,15 @@ static void mpc5xxx_fec_halt(struct eth_device *dev)
*/
udelay(10);
+ /* don't leave the MII speed set to zero */
+ if (fec->xcv_type != SEVENWIRE) {
+ /*
+ * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ * and do not drop the Preamble.
+ */
+ fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ }
+
#if (DEBUG & 0x3)
printf("Ethernet task stopped\n");
#endif
@@ -897,6 +899,13 @@ int mpc5xxx_fec_initialize(bd_t * bis)
#else
#error fec->xcv_type not initialized.
#endif
+ if (fec->xcv_type != SEVENWIRE) {
+ /*
+ * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
+ * and do not drop the Preamble.
+ */
+ fec->eth->mii_speed = (((gd->ipb_clk >> 20) / 5) << 1); /* No MII for 7-wire mode */
+ }
dev->priv = (void *)fec;
dev->iobase = MPC5XXX_FEC;
diff --git a/include/asm-arm/arch-omap3/cpu.h b/include/asm-arm/arch-omap3/cpu.h
index 5b344f837..c544e0c5d 100644
--- a/include/asm-arm/arch-omap3/cpu.h
+++ b/include/asm-arm/arch-omap3/cpu.h
@@ -60,6 +60,19 @@ typedef struct ctrl {
#define OMAP3525 0x4c00
#define OMAP3530 0x0c00
+#ifndef __ASSEMBLY__
+typedef struct ctrl_id {
+ unsigned char res1[0x4];
+ unsigned int idcode; /* 0x04 */
+ unsigned int prod_id; /* 0x08 */
+ unsigned char res2[0x0C];
+ unsigned int die_id_0; /* 0x18 */
+ unsigned int die_id_1; /* 0x1C */
+ unsigned int die_id_2; /* 0x20 */
+ unsigned int die_id_3; /* 0x24 */
+} ctrl_id_t;
+#endif /* __ASSEMBLY__ */
+
/* device type */
#define DEVICE_MASK (0x7 << 8)
#define SYSBOOT_MASK 0x1F
diff --git a/include/asm-arm/arch-omap3/omap3.h b/include/asm-arm/arch-omap3/omap3.h
index 02e36d7e3..8c9656f9e 100644
--- a/include/asm-arm/arch-omap3/omap3.h
+++ b/include/asm-arm/arch-omap3/omap3.h
@@ -43,6 +43,7 @@
*/
#define OMAP34XX_CORE_L4_IO_BASE 0x48000000
#define OMAP34XX_WAKEUP_L4_IO_BASE 0x48300000
+#define OMAP34XX_ID_L4_IO_BASE 0x4830A200
#define OMAP34XX_L4_PER 0x49000000
#define OMAP34XX_L4_IO_BASE OMAP34XX_CORE_L4_IO_BASE
diff --git a/include/asm-arm/arch-omap3/sys_proto.h b/include/asm-arm/arch-omap3/sys_proto.h
index ab3e1683f..8b554bbe8 100644
--- a/include/asm-arm/arch-omap3/sys_proto.h
+++ b/include/asm-arm/arch-omap3/sys_proto.h
@@ -66,5 +66,6 @@ void sdelay(unsigned long);
void make_cs1_contiguous(void);
void omap_nand_switch_ecc(int);
void power_init_r(void);
+void dieid_num_r(void);
#endif