Commit 3fde80e9 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu:
  m68knommu: put ColdFire head code into .text.head section
  m68knommu: remove last use of CONFIG_FADS and CONFIG_RPXCLASSIC
  m68knommu: remove RPXCLASSIC from the m68k tree
  m68knommu: fec: remove FADS
  m68knommu: MCF5307 PIT GENERIC_CLOCKEVENTS support
  m68knommu: add read_barrier_depends() and irqs_disabled_flags()
  m68knommu: add byteswap assembly opcode for ISA A+
  m68knommu: add ffs and __ffs plattform which support ISA A+ or ISA C
  m68knommu: add sched_clock() for the DMA timer
  m68knommu: complete generic time
  m68knommu: move code within time.c
  m68knommu: m68knommu: add old stack trace method
  m68knommu: Add Coldfire DMA Timer support
  m68knommu: defconfig for M5407C3 board
  m68knommu: defconfig for M5307C3 board
  m68knommu: defconfig for M5275EVB board
  m68knommu: defconfig for M5249EVB board
  m68knommu: change to a configs directory for board configurations
parents ac9f80ad 9b0e7410
...@@ -58,10 +58,18 @@ config GENERIC_TIME ...@@ -58,10 +58,18 @@ config GENERIC_TIME
bool bool
default y default y
config GENERIC_CMOS_UPDATE
bool
default y
config TIME_LOW_RES config TIME_LOW_RES
bool bool
default y default y
config GENERIC_CLOCKEVENTS
bool
default n
config NO_IOPORT config NO_IOPORT
def_bool y def_bool y
...@@ -108,11 +116,13 @@ config M5206e ...@@ -108,11 +116,13 @@ config M5206e
config M520x config M520x
bool "MCF520x" bool "MCF520x"
select GENERIC_CLOCKEVENTS
help help
Freescale Coldfire 5207/5208 processor support. Freescale Coldfire 5207/5208 processor support.
config M523x config M523x
bool "MCF523x" bool "MCF523x"
select GENERIC_CLOCKEVENTS
help help
Freescale Coldfire 5230/1/2/4/5 processor support Freescale Coldfire 5230/1/2/4/5 processor support
...@@ -138,6 +148,7 @@ config M5275 ...@@ -138,6 +148,7 @@ config M5275
config M528x config M528x
bool "MCF528x" bool "MCF528x"
select GENERIC_CLOCKEVENTS
help help
Motorola ColdFire 5280/5282 processor support. Motorola ColdFire 5280/5282 processor support.
...@@ -161,6 +172,7 @@ endchoice ...@@ -161,6 +172,7 @@ endchoice
config M527x config M527x
bool bool
depends on (M5271 || M5275) depends on (M5271 || M5275)
select GENERIC_CLOCKEVENTS
default y default y
config COLDFIRE config COLDFIRE
...@@ -674,6 +686,9 @@ endchoice ...@@ -674,6 +686,9 @@ endchoice
if COLDFIRE if COLDFIRE
source "kernel/Kconfig.preempt" source "kernel/Kconfig.preempt"
endif endif
source "kernel/time/Kconfig"
source "mm/Kconfig" source "mm/Kconfig"
endmenu endmenu
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
# (C) Copyright 2002, Greg Ungerer <gerg@snapgear.com> # (C) Copyright 2002, Greg Ungerer <gerg@snapgear.com>
# #
KBUILD_DEFCONFIG := m5208evb_defconfig
platform-$(CONFIG_M68328) := 68328 platform-$(CONFIG_M68328) := 68328
platform-$(CONFIG_M68EZ328) := 68EZ328 platform-$(CONFIG_M68EZ328) := 68EZ328
platform-$(CONFIG_M68VZ328) := 68VZ328 platform-$(CONFIG_M68VZ328) := 68VZ328
...@@ -90,13 +92,14 @@ export PLATFORM BOARD MODEL CPUCLASS ...@@ -90,13 +92,14 @@ export PLATFORM BOARD MODEL CPUCLASS
cflags-$(CONFIG_M5206) := -m5200 cflags-$(CONFIG_M5206) := -m5200
cflags-$(CONFIG_M5206e) := -m5200 cflags-$(CONFIG_M5206e) := -m5200
cflags-$(CONFIG_M520x) := -m5307 cflags-$(CONFIG_M520x) := -m5307
cflags-$(CONFIG_M523x) := -m5307 cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
cflags-$(CONFIG_M5249) := -m5200 cflags-$(CONFIG_M5249) := -m5200
cflags-$(CONFIG_M527x) := -m5307 cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
cflags-$(CONFIG_M5272) := -m5307 cflags-$(CONFIG_M5272) := -m5307
cflags-$(CONFIG_M528x) := -m5307 cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
cflags-$(CONFIG_M528x) := $(call cc-option,-m528x,-m5307)
cflags-$(CONFIG_M5307) := -m5307 cflags-$(CONFIG_M5307) := -m5307
cflags-$(CONFIG_M532x) := -m5307 cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
cflags-$(CONFIG_M5407) := -m5200 cflags-$(CONFIG_M5407) := -m5200
cflags-$(CONFIG_M68328) := -m68000 cflags-$(CONFIG_M68328) := -m68000
cflags-$(CONFIG_M68EZ328) := -m68000 cflags-$(CONFIG_M68EZ328) := -m68000
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -33,14 +33,13 @@ static inline int set_rtc_mmss(unsigned long nowtime) ...@@ -33,14 +33,13 @@ static inline int set_rtc_mmss(unsigned long nowtime)
return -1; return -1;
} }
#ifndef CONFIG_GENERIC_CLOCKEVENTS
/* /*
* timer_interrupt() needs to keep up the real-time clock, * timer_interrupt() needs to keep up the real-time clock,
* as well as call the "do_timer()" routine every clocktick * as well as call the "do_timer()" routine every clocktick
*/ */
irqreturn_t arch_timer_interrupt(int irq, void *dummy) irqreturn_t arch_timer_interrupt(int irq, void *dummy)
{ {
/* last time the cmos clock got updated */
static long last_rtc_update=0;
if (current->pid) if (current->pid)
profile_tick(CPU_PROFILING); profile_tick(CPU_PROFILING);
...@@ -49,21 +48,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) ...@@ -49,21 +48,6 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
do_timer(1); do_timer(1);
/*
* If we have an externally synchronized Linux clock, then update
* CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
* called as close as possible to 500 ms before the new second starts.
*/
if (ntp_synced() &&
xtime.tv_sec > last_rtc_update + 660 &&
(xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
(xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
if (set_rtc_mmss(xtime.tv_sec) == 0)
last_rtc_update = xtime.tv_sec;
else
last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
}
write_sequnlock(&xtime_lock); write_sequnlock(&xtime_lock);
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
...@@ -71,8 +55,9 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy) ...@@ -71,8 +55,9 @@ irqreturn_t arch_timer_interrupt(int irq, void *dummy)
#endif #endif
return(IRQ_HANDLED); return(IRQ_HANDLED);
} }
#endif
void time_init(void) static unsigned long read_rtc_mmss(void)
{ {
unsigned int year, mon, day, hour, min, sec; unsigned int year, mon, day, hour, min, sec;
...@@ -83,10 +68,21 @@ void time_init(void) ...@@ -83,10 +68,21 @@ void time_init(void)
if ((year += 1900) < 1970) if ((year += 1900) < 1970)
year += 100; year += 100;
xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
xtime.tv_nsec = 0;
wall_to_monotonic.tv_sec = -xtime.tv_sec;
hw_timer_init(); return mktime(year, mon, day, hour, min, sec);;
}
unsigned long read_persistent_clock(void)
{
return read_rtc_mmss();
} }
int update_persistent_clock(struct timespec now)
{
return set_rtc_mmss(now.tv_sec);
}
void time_init(void)
{
hw_timer_init();
}
...@@ -103,12 +103,28 @@ asmlinkage void buserr_c(struct frame *fp) ...@@ -103,12 +103,28 @@ asmlinkage void buserr_c(struct frame *fp)
force_sig(SIGSEGV, current); force_sig(SIGSEGV, current);
} }
static void print_this_address(unsigned long addr, int i)
{
#ifdef CONFIG_KALLSYMS
printk(KERN_EMERG " [%08lx] ", addr);
print_symbol(KERN_CONT "%s\n", addr);
#else
if (i % 5)
printk(KERN_CONT " [%08lx] ", addr);
else
printk(KERN_CONT "\n" KERN_EMERG " [%08lx] ", addr);
i++;
#endif
}
int kstack_depth_to_print = 48; int kstack_depth_to_print = 48;
static void __show_stack(struct task_struct *task, unsigned long *stack) static void __show_stack(struct task_struct *task, unsigned long *stack)
{ {
unsigned long *endstack, addr; unsigned long *endstack, addr;
#ifdef CONFIG_FRAME_POINTER
unsigned long *last_stack; unsigned long *last_stack;
#endif
int i; int i;
if (!stack) if (!stack)
...@@ -126,6 +142,7 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) ...@@ -126,6 +142,7 @@ static void __show_stack(struct task_struct *task, unsigned long *stack)
printk(" %08lx", *(stack + i)); printk(" %08lx", *(stack + i));
} }
printk("\n"); printk("\n");
i = 0;
#ifdef CONFIG_FRAME_POINTER #ifdef CONFIG_FRAME_POINTER
printk(KERN_EMERG "Call Trace:\n"); printk(KERN_EMERG "Call Trace:\n");
...@@ -134,15 +151,30 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) ...@@ -134,15 +151,30 @@ static void __show_stack(struct task_struct *task, unsigned long *stack)
while (stack <= endstack && stack > last_stack) { while (stack <= endstack && stack > last_stack) {
addr = *(stack + 1); addr = *(stack + 1);
printk(KERN_EMERG " [%08lx] ", addr); print_this_address(addr, i);
print_symbol(KERN_CONT "%s\n", addr); i++;
last_stack = stack; last_stack = stack;
stack = (unsigned long *)*stack; stack = (unsigned long *)*stack;
} }
printk("\n"); printk("\n");
#else #else
printk(KERN_EMERG "CONFIG_FRAME_POINTER disabled, no symbolic call trace\n"); printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n");
while (stack <= endstack) {
addr = *stack++;
/*
* If the address is either in the text segment of the kernel,
* or in a region which is occupied by a module then it *may*
* be the address of a calling routine; if so, print it so that
* someone tracing down the cause of the crash will be able to
* figure out the call path that was taken.
*/
if (__kernel_text_address(addr)) {
print_this_address(addr, i);
i++;
}
}
printk(KERN_CONT "\n");
#endif #endif
} }
......
...@@ -62,6 +62,7 @@ SECTIONS { ...@@ -62,6 +62,7 @@ SECTIONS {
.text : { .text : {
_text = .; _text = .;
_stext = . ; _stext = . ;
HEAD_TEXT
TEXT_TEXT TEXT_TEXT
SCHED_TEXT SCHED_TEXT
LOCK_TEXT LOCK_TEXT
......
...@@ -18,7 +18,7 @@ obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o ...@@ -18,7 +18,7 @@ obj-$(CONFIG_COLDFIRE) += dma.o entry.o vectors.o
obj-$(CONFIG_M5206) += timers.o obj-$(CONFIG_M5206) += timers.o
obj-$(CONFIG_M5206e) += timers.o obj-$(CONFIG_M5206e) += timers.o
obj-$(CONFIG_M520x) += pit.o obj-$(CONFIG_M520x) += pit.o
obj-$(CONFIG_M523x) += pit.o obj-$(CONFIG_M523x) += pit.o dma_timer.o
obj-$(CONFIG_M5249) += timers.o obj-$(CONFIG_M5249) += timers.o
obj-$(CONFIG_M527x) += pit.o obj-$(CONFIG_M527x) += pit.o
obj-$(CONFIG_M5272) += timers.o obj-$(CONFIG_M5272) += timers.o
......
/*
* dma_timer.c -- Freescale ColdFire DMA Timer.
*
* Copyright (C) 2007, Benedikt Spranger <b.spranger@linutronix.de>
* Copyright (C) 2008. Sebastian Siewior, Linutronix
*
*/
#include <linux/clocksource.h>
#include <linux/io.h>
#include <asm/machdep.h>
#include <asm/coldfire.h>
#include <asm/mcfpit.h>
#include <asm/mcfsim.h>
#define DMA_TIMER_0 (0x00)
#define DMA_TIMER_1 (0x40)
#define DMA_TIMER_2 (0x80)
#define DMA_TIMER_3 (0xc0)
#define DTMR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x400)
#define DTXMR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x402)
#define DTER0 (MCF_IPSBAR + DMA_TIMER_0 + 0x403)
#define DTRR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x404)
#define DTCR0 (MCF_IPSBAR + DMA_TIMER_0 + 0x408)
#define DTCN0 (MCF_IPSBAR + DMA_TIMER_0 + 0x40c)
#define DMA_FREQ ((MCF_CLK / 2) / 16)
/* DTMR */
#define DMA_DTMR_RESTART (1 << 3)
#define DMA_DTMR_CLK_DIV_1 (1 << 1)
#define DMA_DTMR_CLK_DIV_16 (2 << 1)
#define DMA_DTMR_ENABLE (1 << 0)
static cycle_t cf_dt_get_cycles(void)
{
return __raw_readl(DTCN0);
}
static struct clocksource clocksource_cf_dt = {
.name = "coldfire_dma_timer",
.rating = 200,
.read = cf_dt_get_cycles,
.mask = CLOCKSOURCE_MASK(32),
.shift = 20,
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
};
static int __init init_cf_dt_clocksource(void)
{
/*
* We setup DMA timer 0 in free run mode. This incrementing counter is
* used as a highly precious clock source. With MCF_CLOCK = 150 MHz we
* get a ~213 ns resolution and the 32bit register will overflow almost
* every 15 minutes.
*/
__raw_writeb(0x00, DTXMR0);
__raw_writeb(0x00, DTER0);
__raw_writel(0x00000000, DTRR0);
__raw_writew(DMA_DTMR_CLK_DIV_16 | DMA_DTMR_ENABLE, DTMR0);
clocksource_cf_dt.mult = clocksource_hz2mult(DMA_FREQ,
clocksource_cf_dt.shift);
return clocksource_register(&clocksource_cf_dt);
}
arch_initcall(init_cf_dt_clocksource);
#define CYC2NS_SCALE_FACTOR 10 /* 2^10, carefully chosen */
#define CYC2NS_SCALE ((1000000 << CYC2NS_SCALE_FACTOR) / (DMA_FREQ / 1000))
static unsigned long long cycles2ns(unsigned long cycl)
{
return (unsigned long long) ((unsigned long long)cycl *
CYC2NS_SCALE) >> CYC2NS_SCALE_FACTOR;
}
unsigned long long sched_clock(void)
{
unsigned long cycl = __raw_readl(DTCN0);
return cycles2ns(cycl);
}
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/sys.h> #include <linux/sys.h>
#include <linux/linkage.h> #include <linux/linkage.h>
#include <linux/init.h>
#include <asm/asm-offsets.h> #include <asm/asm-offsets.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfcache.h> #include <asm/mcfcache.h>
...@@ -126,7 +127,7 @@ _ramend: ...@@ -126,7 +127,7 @@ _ramend:
/*****************************************************************************/ /*****************************************************************************/
.text __HEAD
/* /*
* This is the codes first entry point. This is where it all * This is the codes first entry point. This is where it all
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/clocksource.h> #include <linux/clockchips.h>
#include <asm/machdep.h> #include <asm/machdep.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/coldfire.h> #include <asm/coldfire.h>
...@@ -33,22 +33,86 @@ ...@@ -33,22 +33,86 @@
#define FREQ ((MCF_CLK / 2) / 64) #define FREQ ((MCF_CLK / 2) / 64)
#define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a)) #define TA(a) (MCF_IPSBAR + MCFPIT_BASE1 + (a))
#define INTC0 (MCF_IPSBAR + MCFICM_INTC0) #define INTC0 (MCF_IPSBAR + MCFICM_INTC0)
#define PIT_CYCLES_PER_JIFFY (FREQ / HZ)
static u32 pit_cycles_per_jiffy;
static u32 pit_cnt; static u32 pit_cnt;
/*
* Initialize the PIT timer.
*
* This is also called after resume to bring the PIT into operation again.
*/
static void init_cf_pit_timer(enum clock_event_mode mode,
struct clock_event_device *evt)
{
switch (mode) {
case CLOCK_EVT_MODE_PERIODIC:
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(PIT_CYCLES_PER_JIFFY, TA(MCFPIT_PMR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
MCFPIT_PCSR_OVW | MCFPIT_PCSR_RLD | \
MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
break;
case CLOCK_EVT_MODE_SHUTDOWN:
case CLOCK_EVT_MODE_UNUSED:
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
break;
case CLOCK_EVT_MODE_ONESHOT:
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | \
MCFPIT_PCSR_OVW | MCFPIT_PCSR_CLK64, \
TA(MCFPIT_PCSR));
break;
case CLOCK_EVT_MODE_RESUME:
/* Nothing to do here */
break;
}
}
/*
* Program the next event in oneshot mode
*
* Delta is given in PIT ticks
*/
static int cf_pit_next_event(unsigned long delta,
struct clock_event_device *evt)
{
__raw_writew(delta, TA(MCFPIT_PMR));
return 0;
}
struct clock_event_device cf_pit_clockevent = {
.name = "pit",
.features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
.set_mode = init_cf_pit_timer,
.set_next_event = cf_pit_next_event,
.shift = 32,
.irq = MCFINT_VECBASE + MCFINT_PIT1,
};
/***************************************************************************/ /***************************************************************************/
static irqreturn_t pit_tick(int irq, void *dummy) static irqreturn_t pit_tick(int irq, void *dummy)
{ {
struct clock_event_device *evt = &cf_pit_clockevent;
u16 pcsr; u16 pcsr;
/* Reset the ColdFire timer */ /* Reset the ColdFire timer */
pcsr = __raw_readw(TA(MCFPIT_PCSR)); pcsr = __raw_readw(TA(MCFPIT_PCSR));
__raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR)); __raw_writew(pcsr | MCFPIT_PCSR_PIF, TA(MCFPIT_PCSR));
pit_cnt += pit_cycles_per_jiffy; pit_cnt += PIT_CYCLES_PER_JIFFY;
return arch_timer_interrupt(irq, dummy); evt->event_handler(evt);
return IRQ_HANDLED;
} }
/***************************************************************************/ /***************************************************************************/
...@@ -72,14 +136,14 @@ static cycle_t pit_read_clk(void) ...@@ -72,14 +136,14 @@ static cycle_t pit_read_clk(void)
cycles = pit_cnt; cycles = pit_cnt;
local_irq_restore(flags); local_irq_restore(flags);
return cycles + pit_cycles_per_jiffy - pcntr; return cycles + PIT_CYCLES_PER_JIFFY - pcntr;
} }
/***************************************************************************/ /***************************************************************************/
static struct clocksource pit_clk = { static struct clocksource pit_clk = {
.name = "pit", .name = "pit",
.rating = 250, .rating = 100,
.read = pit_read_clk, .read = pit_read_clk,
.shift = 20, .shift = 20,
.mask = CLOCKSOURCE_MASK(32), .mask = CLOCKSOURCE_MASK(32),
...@@ -92,6 +156,14 @@ void hw_timer_init(void) ...@@ -92,6 +156,14 @@ void hw_timer_init(void)
{ {
u32 imr; u32 imr;
cf_pit_clockevent.cpumask = cpumask_of_cpu(smp_processor_id());
cf_pit_clockevent.mult = div_sc(FREQ, NSEC_PER_SEC, 32);
cf_pit_clockevent.max_delta_ns =
clockevent_delta2ns(0xFFFF, &cf_pit_clockevent);
cf_pit_clockevent.min_delta_ns =
clockevent_delta2ns(0x3f, &cf_pit_clockevent);
clockevents_register_device(&cf_pit_clockevent);
setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq); setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &pit_irq);
__raw_writeb(ICR_INTRCONF, INTC0 + MCFINTC_ICR0 + MCFINT_PIT1); __raw_writeb(ICR_INTRCONF, INTC0 + MCFINTC_ICR0 + MCFINT_PIT1);
...@@ -99,13 +171,6 @@ void hw_timer_init(void) ...@@ -99,13 +171,6 @@ void hw_timer_init(void)
imr &= ~MCFPIT_IMR_IBIT; imr &= ~MCFPIT_IMR_IBIT;
__raw_writel(imr, INTC0 + MCFPIT_IMR); __raw_writel(imr, INTC0 + MCFPIT_IMR);
/* Set up PIT timer 1 as poll clock */
pit_cycles_per_jiffy = FREQ / HZ;
__raw_writew(MCFPIT_PCSR_DISABLE, TA(MCFPIT_PCSR));
__raw_writew(pit_cycles_per_jiffy, TA(MCFPIT_PMR));
__raw_writew(MCFPIT_PCSR_EN | MCFPIT_PCSR_PIE | MCFPIT_PCSR_OVW |
MCFPIT_PCSR_RLD | MCFPIT_PCSR_CLK64, TA(MCFPIT_PCSR));
pit_clk.mult = clocksource_hz2mult(FREQ, pit_clk.shift); pit_clk.mult = clocksource_hz2mult(FREQ, pit_clk.shift);
clocksource_register(&pit_clk); clocksource_register(&pit_clk);
} }
......
...@@ -2,12 +2,6 @@ ...@@ -2,12 +2,6 @@
* Fast Ethernet Controller (FEC) driver for Motorola MPC8xx. * Fast Ethernet Controller (FEC) driver for Motorola MPC8xx.
* Copyright (c) 1997 Dan Malek (dmalek@jlc.net) * Copyright (c) 1997 Dan Malek (dmalek@jlc.net)
* *
* This version of the driver is specific to the FADS implementation,
* since the board contains control registers external to the processor
* for the control of the LevelOne LXT970 transceiver. The MPC860T manual
* describes connections using the internal parallel port I/O, which
* is basically all of Port D.
*
* Right now, I am very wasteful with the buffers. I allocate memory * Right now, I am very wasteful with the buffers. I allocate memory
* pages and then divide them into 2K frame buffers. This way I know I * pages and then divide them into 2K frame buffers. This way I know I
* have buffers large enough to hold one frame within one buffer descriptor. * have buffers large enough to hold one frame within one buffer descriptor.
...@@ -49,17 +43,9 @@ ...@@ -49,17 +43,9 @@
#include <asm/pgtable.h> #include <asm/pgtable.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \
defined(CONFIG_M5272) || defined(CONFIG_M528x) || \
defined(CONFIG_M520x) || defined(CONFIG_M532x)
#include <asm/coldfire.h> #include <asm/coldfire.h>
#include <asm/mcfsim.h> #include <asm/mcfsim.h>
#include "fec.h" #include "fec.h"
#else
#include <asm/8xx_immap.h>
#include <asm/mpc8xx.h>
#include "commproc.h"
#endif
#if defined(CONFIG_FEC2) #if defined(CONFIG_FEC2)
#define FEC_MAX_PORTS 2 #define FEC_MAX_PORTS 2
...@@ -67,7 +53,7 @@ ...@@ -67,7 +53,7 @@
#define FEC_MAX_PORTS 1 #define FEC_MAX_PORTS 1
#endif #endif
#if defined(CONFIG_FADS) || defined(CONFIG_RPXCLASSIC) || defined(CONFIG_M5272) #if defined(CONFIG_M5272)
#define HAVE_mii_link_interrupt #define HAVE_mii_link_interrupt
#endif #endif
...@@ -1235,14 +1221,9 @@ static phy_info_t const * const phy_info[] = { ...@@ -1235,14 +1221,9 @@ static phy_info_t const * const phy_info[] = {
/* ------------------------------------------------------------------------- */ /* ------------------------------------------------------------------------- */
#ifdef HAVE_mii_link_interrupt #ifdef HAVE_mii_link_interrupt
#ifdef CONFIG_RPXCLASSIC
static void
mii_link_interrupt(void *dev_id);
#else
static irqreturn_t static irqreturn_t
mii_link_interrupt(int irq, void * dev_id); mii_link_interrupt(int irq, void * dev_id);
#endif #endif
#endif
#if defined(CONFIG_M5272) #if defined(CONFIG_M5272)
/* /*
...@@ -1795,24 +1776,6 @@ static void __inline__ fec_request_intrs(struct net_device *dev) ...@@ -1795,24 +1776,6 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
if (request_8xxirq(FEC_INTERRUPT, fec_enet_interrupt, 0, "fec", dev) != 0) if (request_8xxirq(FEC_INTERRUPT, fec_enet_interrupt, 0, "fec", dev) != 0)
panic("Could not allocate FEC IRQ!"); panic("Could not allocate FEC IRQ!");
#ifdef CONFIG_RPXCLASSIC
/* Make Port C, bit 15 an input that causes interrupts.
*/
immap->im_ioport.iop_pcpar &= ~0x0001;
immap->im_ioport.iop_pcdir &= ~0x0001;
immap->im_ioport.iop_pcso &= ~0x0001;
immap->im_ioport.iop_pcint |= 0x0001;
cpm_install_handler(CPMVEC_PIO_PC15, mii_link_interrupt, dev);
/* Make LEDS reflect Link status.
*/
*((uint *) RPX_CSR_ADDR) &= ~BCSR2_FETHLEDMODE;
#endif
#ifdef CONFIG_FADS
if (request_8xxirq(SIU_IRQ2, mii_link_interrupt, 0, "mii", dev) != 0)
panic("Could not allocate MII IRQ!");
#endif
} }
static void __inline__ fec_get_mac(struct net_device *dev) static void __inline__ fec_get_mac(struct net_device *dev)
...@@ -1821,16 +1784,6 @@ static void __inline__ fec_get_mac(struct net_device *dev) ...@@ -1821,16 +1784,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
bd = (bd_t *)__res; bd = (bd_t *)__res;
memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN); memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN);
#ifdef CONFIG_RPXCLASSIC
/* The Embedded Planet boards have only one MAC address in
* the EEPROM, but can have two Ethernet ports. For the
* FEC port, we create another address by setting one of
* the address bits above something that would have (up to
* now) been allocated.
*/
dev->dev_adrd[3] |= 0x80;
#endif
} }
static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep) static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
...@@ -2109,13 +2062,8 @@ mii_discover_phy(uint mii_reg, struct net_device *dev) ...@@ -2109,13 +2062,8 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
/* This interrupt occurs when the PHY detects a link change. /* This interrupt occurs when the PHY detects a link change.
*/ */
#ifdef HAVE_mii_link_interrupt #ifdef HAVE_mii_link_interrupt
#ifdef CONFIG_RPXCLASSIC
static void
mii_link_interrupt(void *dev_id)
#else
static irqreturn_t static irqreturn_t
mii_link_interrupt(int irq, void * dev_id) mii_link_interrupt(int irq, void * dev_id)
#endif
{ {
struct net_device *dev = dev_id; struct net_device *dev = dev_id;
struct fec_enet_private *fep = netdev_priv(dev); struct fec_enet_private *fep = netdev_priv(dev);
......
...@@ -14,8 +14,38 @@ ...@@ -14,8 +14,38 @@
#error only <linux/bitops.h> can be included directly #error only <linux/bitops.h> can be included directly
#endif #endif
#if defined (__mcfisaaplus__) || defined (__mcfisac__)
static inline int ffs(unsigned int val)
{
if (!val)
return 0;
asm volatile(
"bitrev %0\n\t"
"ff1 %0\n\t"
: "=d" (val)
: "0" (val)
);
val++;
return val;
}
static inline int __ffs(unsigned int val)
{
asm volatile(
"bitrev %0\n\t"
"ff1 %0\n\t"
: "=d" (val)
: "0" (val)
);
return val;
}
#else
#include <asm-generic/bitops/ffs.h> #include <asm-generic/bitops/ffs.h>
#include <asm-generic/bitops/__ffs.h> #include <asm-generic/bitops/__ffs.h>
#endif
#include <asm-generic/bitops/sched.h> #include <asm-generic/bitops/sched.h>
#include <asm-generic/bitops/ffz.h> #include <asm-generic/bitops/ffz.h>
......
#ifndef _M68KNOMMU_BYTEORDER_H #ifndef _M68KNOMMU_BYTEORDER_H
#define _M68KNOMMU_BYTEORDER_H #define _M68KNOMMU_BYTEORDER_H
#include <asm/types.h> #include <linux/types.h>
#if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__)
# define __BYTEORDER_HAS_U64__ # define __BYTEORDER_HAS_U64__
# define __SWAB_64_THRU_32__ # define __SWAB_64_THRU_32__
#endif #endif
#if defined (__mcfisaaplus__) || defined (__mcfisac__)
static inline __attribute_const__ __u32 ___arch__swab32(__u32 val)
{
asm(
"byterev %0"
: "=d" (val)
: "0" (val)
);
return val;
}
#define __arch__swab32(x) ___arch__swab32(x)
#endif
#include <linux/byteorder/big_endian.h> #include <linux/byteorder/big_endian.h>
#endif /* _M68KNOMMU_BYTEORDER_H */ #endif /* _M68KNOMMU_BYTEORDER_H */
...@@ -519,25 +519,6 @@ typedef struct scc_enet { ...@@ -519,25 +519,6 @@ typedef struct scc_enet {
#define SICR_ENET_CLKRT ((uint)0x00002c00) #define SICR_ENET_CLKRT ((uint)0x00002c00)
#endif #endif
#ifdef CONFIG_RPXCLASSIC
/* Bits in parallel I/O port registers that have to be set/cleared
* to configure the pins for SCC1 use.
*/
#define PA_ENET_RXD ((ushort)0x0001)
#define PA_ENET_TXD ((ushort)0x0002)
#define PA_ENET_TCLK ((ushort)0x0200)
#define PA_ENET_RCLK ((ushort)0x0800)
#define PB_ENET_TENA ((uint)0x00001000)
#define PC_ENET_CLSN ((ushort)0x0010)
#define PC_ENET_RENA ((ushort)0x0020)
/* Control bits in the SICR to route TCLK (CLK2) and RCLK (CLK4) to
* SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
*/
#define SICR_ENET_MASK ((uint)0x000000ff)
#define SICR_ENET_CLKRT ((uint)0x0000003d)
#endif
/* SCC Event register as used by Ethernet. /* SCC Event register as used by Ethernet.
*/ */
#define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */ #define SCCE_ENET_GRA ((ushort)0x0080) /* Graceful stop complete */
......
...@@ -118,6 +118,8 @@ asmlinkage void resume(void); ...@@ -118,6 +118,8 @@ asmlinkage void resume(void);
#define smp_read_barrier_depends() do { } while(0) #define smp_read_barrier_depends() do { } while(0)
#endif #endif
#define read_barrier_depends() ((void)0)
#define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
struct __xchg_dummy { unsigned long a[100]; }; struct __xchg_dummy { unsigned long a[100]; };
...@@ -310,4 +312,13 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz ...@@ -310,4 +312,13 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz
#endif #endif
#define arch_align_stack(x) (x) #define arch_align_stack(x) (x)
static inline int irqs_disabled_flags(unsigned long flags)
{
if (flags & 0x0700)
return 0;
else
return 1;
}
#endif /* _M68KNOMMU_SYSTEM_H */ #endif /* _M68KNOMMU_SYSTEM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment