Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 81811
b: refs/heads/master
c: 4bdb0fb
h: refs/heads/master
i:
  81809: cc5bf88
  81807: 0672887
v: v3
  • Loading branch information
John W. Linville authored and David S. Miller committed Feb 1, 2008
1 parent 5466ab1 commit e6f9abd
Show file tree
Hide file tree
Showing 35 changed files with 407 additions and 994 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2da53b0134ad41b91556d2d2a322cc03487a1ab7
refs/heads/master: 4bdb0fba9e53dc263eb9601404d097dd99e60f83
4 changes: 0 additions & 4 deletions trunk/arch/m68knommu/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@ config GENERIC_CALIBRATE_DELAY
bool
default y

config GENERIC_TIME
bool
default y

config TIME_LOW_RES
bool
default y
Expand Down
22 changes: 11 additions & 11 deletions trunk/arch/m68knommu/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,17 @@ MODEL := $(model-y)
# for the selected cpu. ONLY need to define this for the non-base member
# of the family.
#
cpuclass-$(CONFIG_M5206) := coldfire
cpuclass-$(CONFIG_M5206e) := coldfire
cpuclass-$(CONFIG_M520x) := coldfire
cpuclass-$(CONFIG_M523x) := coldfire
cpuclass-$(CONFIG_M5249) := coldfire
cpuclass-$(CONFIG_M527x) := coldfire
cpuclass-$(CONFIG_M5272) := coldfire
cpuclass-$(CONFIG_M528x) := coldfire
cpuclass-$(CONFIG_M5307) := coldfire
cpuclass-$(CONFIG_M532x) := coldfire
cpuclass-$(CONFIG_M5407) := coldfire
cpuclass-$(CONFIG_M5206) := 5307
cpuclass-$(CONFIG_M5206e) := 5307
cpuclass-$(CONFIG_M520x) := 5307
cpuclass-$(CONFIG_M523x) := 5307
cpuclass-$(CONFIG_M5249) := 5307
cpuclass-$(CONFIG_M527x) := 5307
cpuclass-$(CONFIG_M5272) := 5307
cpuclass-$(CONFIG_M528x) := 5307
cpuclass-$(CONFIG_M5307) := 5307
cpuclass-$(CONFIG_M532x) := 5307
cpuclass-$(CONFIG_M5407) := 5307
cpuclass-$(CONFIG_M68328) := 68328
cpuclass-$(CONFIG_M68EZ328) := 68328
cpuclass-$(CONFIG_M68VZ328) := 68328
Expand Down
81 changes: 81 additions & 0 deletions trunk/arch/m68knommu/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <linux/timex.h>

#include <asm/machdep.h>
#include <asm/io.h>
#include <asm/irq_regs.h>

#define TICK_SIZE (tick_nsec / 1000)
Expand Down Expand Up @@ -65,6 +66,29 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
#ifdef CONFIG_HEARTBEAT
/* use power LED as a heartbeat instead -- much more useful
for debugging -- based on the version for PReP by Cort */
/* acts like an actual heart beat -- ie thump-thump-pause... */
if (mach_heartbeat) {
static unsigned cnt = 0, period = 0, dist = 0;

if (cnt == 0 || cnt == dist)
mach_heartbeat( 1 );
else if (cnt == 7 || cnt == dist+7)
mach_heartbeat( 0 );

if (++cnt > period) {
cnt = 0;
/* The hyperbolic function below modifies the heartbeat period
* length in dependency of the current (5min) load. It goes
* through the points f(0)=126, f(1)=86, f(5)=51,
* f(inf)->30. */
period = ((672<<FSHIFT)/(5*avenrun[0]+(7<<FSHIFT))) + 30;
dist = period / 4;
}
}
#endif /* CONFIG_HEARTBEAT */

write_sequnlock(&xtime_lock);
return(IRQ_HANDLED);
Expand All @@ -88,3 +112,60 @@ void time_init(void)
hw_timer_init();
}

/*
* This version of gettimeofday has near microsecond resolution.
*/
void do_gettimeofday(struct timeval *tv)
{
unsigned long flags;
unsigned long seq;
unsigned long usec, sec;

do {
seq = read_seqbegin_irqsave(&xtime_lock, flags);
usec = hw_timer_offset();
sec = xtime.tv_sec;
usec += (xtime.tv_nsec / 1000);
} while (read_seqretry_irqrestore(&xtime_lock, seq, flags));

while (usec >= 1000000) {
usec -= 1000000;
sec++;
}

tv->tv_sec = sec;
tv->tv_usec = usec;
}

EXPORT_SYMBOL(do_gettimeofday);

int do_settimeofday(struct timespec *tv)
{
time_t wtm_sec, sec = tv->tv_sec;
long wtm_nsec, nsec = tv->tv_nsec;

if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
return -EINVAL;

write_seqlock_irq(&xtime_lock);
/*
* This is revolting. We need to set the xtime.tv_usec
* correctly. However, the value in this location is
* is value at the last tick.
* Discover what correction gettimeofday
* would have done, and then undo it!
*/
nsec -= (hw_timer_offset() * 1000);

wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);

set_normalized_timespec(&xtime, sec, nsec);
set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);

ntp_clear();
write_sequnlock_irq(&xtime_lock);
clock_was_set();
return 0;
}
EXPORT_SYMBOL(do_settimeofday);
76 changes: 22 additions & 54 deletions trunk/arch/m68knommu/platform/5206/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,63 +13,28 @@
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/dma.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcftimer.h>
#include <asm/mcfsim.h>
#include <asm/mcfuart.h>
#include <asm/mcfdma.h>

/***************************************************************************/

void coldfire_reset(void);

/***************************************************************************/

static struct mcf_platform_uart m5206_uart_platform[] = {
{
.mapbase = MCF_MBAR + MCFUART_BASE1,
.irq = 73,
},
{
.mapbase = MCF_MBAR + MCFUART_BASE2,
.irq = 74,
},
{ },
};

static struct platform_device m5206_uart = {
.name = "mcfuart",
.id = 0,
.dev.platform_data = m5206_uart_platform,
};

static struct platform_device *m5206_devices[] __initdata = {
&m5206_uart,
/*
* DMA channel base address table.
*/
unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
MCF_MBAR + MCFDMA_BASE0,
MCF_MBAR + MCFDMA_BASE1,
};

/***************************************************************************/

static void __init m5206_uart_init_line(int line, int irq)
{
if (line == 0) {
writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
} else if (line == 1) {
writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
}
}

static void __init m5206_uarts_init(void)
{
const int nrlines = ARRAY_SIZE(m5206_uart_platform);
int line;

for (line = 0; (line < nrlines); line++)
m5206_uart_init_line(line, m5206_uart_platform[line].irq);
}
unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];

/***************************************************************************/

Expand Down Expand Up @@ -109,21 +74,24 @@ void mcf_settimericr(unsigned int timer, unsigned int level)

/***************************************************************************/

void __init config_BSP(char *commandp, int size)
int mcf_timerirqpending(int timer)
{
mcf_setimr(MCFSIM_IMR_MASKALL);
mach_reset = coldfire_reset;
unsigned int imr = 0;

switch (timer) {
case 1: imr = MCFSIM_IMR_TIMER1; break;
case 2: imr = MCFSIM_IMR_TIMER2; break;
default: break;
}
return (mcf_getipr() & imr);
}

/***************************************************************************/

static int __init init_BSP(void)
void config_BSP(char *commandp, int size)
{
m5206_uarts_init();
platform_add_devices(m5206_devices, ARRAY_SIZE(m5206_devices));
return 0;
mcf_setimr(MCFSIM_IMR_MASKALL);
mach_reset = coldfire_reset;
}

arch_initcall(init_BSP);

/***************************************************************************/
80 changes: 23 additions & 57 deletions trunk/arch/m68knommu/platform/5206e/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@

#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <asm/dma.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfsim.h>
Expand All @@ -24,51 +23,15 @@ void coldfire_reset(void);

/***************************************************************************/

static struct mcf_platform_uart m5206e_uart_platform[] = {
{
.mapbase = MCF_MBAR + MCFUART_BASE1,
.irq = 73,
},
{
.mapbase = MCF_MBAR + MCFUART_BASE2,
.irq = 74,
},
{ },
};

static struct platform_device m5206e_uart = {
.name = "mcfuart",
.id = 0,
.dev.platform_data = m5206e_uart_platform,
};

static struct platform_device *m5206e_devices[] __initdata = {
&m5206e_uart,
/*
* DMA channel base address table.
*/
unsigned int dma_base_addr[MAX_M68K_DMA_CHANNELS] = {
MCF_MBAR + MCFDMA_BASE0,
MCF_MBAR + MCFDMA_BASE1,
};

/***************************************************************************/

static void __init m5206_uart_init_line(int line, int irq)
{
if (line == 0) {
writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI1, MCF_MBAR + MCFSIM_UART1ICR);
writeb(irq, MCFUART_BASE1 + MCFUART_UIVR);
mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART1);
} else if (line == 1) {
writel(MCFSIM_ICR_LEVEL6 | MCFSIM_ICR_PRI2, MCF_MBAR + MCFSIM_UART2ICR);
writeb(irq, MCFUART_BASE2 + MCFUART_UIVR);
mcf_setimr(mcf_getimr() & ~MCFSIM_IMR_UART2);
}
}

static void __init m5206e_uarts_init(void)
{
const int nrlines = ARRAY_SIZE(m5206e_uart_platform);
int line;

for (line = 0; (line < nrlines); line++)
m5206e_uart_init_line(line, m5206e_uart_platform[line].irq);
}
unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];

/***************************************************************************/

Expand Down Expand Up @@ -108,7 +71,21 @@ void mcf_settimericr(unsigned int timer, unsigned int level)

/***************************************************************************/

void __init config_BSP(char *commandp, int size)
int mcf_timerirqpending(int timer)
{
unsigned int imr = 0;

switch (timer) {
case 1: imr = MCFSIM_IMR_TIMER1; break;
case 2: imr = MCFSIM_IMR_TIMER2; break;
default: break;
}
return (mcf_getipr() & imr);
}

/***************************************************************************/

void config_BSP(char *commandp, int size)
{
mcf_setimr(MCFSIM_IMR_MASKALL);

Expand All @@ -122,14 +99,3 @@ void __init config_BSP(char *commandp, int size)
}

/***************************************************************************/

static int __init init_BSP(void)
{
m5206e_uarts_init();
platform_add_devices(m5206e_devices, ARRAY_SIZE(m5206e_devices));
return 0;
}

arch_initcall(init_BSP);

/***************************************************************************/
Loading

0 comments on commit e6f9abd

Please sign in to comment.