Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5cd10349
Commit
5cd10349
authored
Oct 09, 2004
by
Russell King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ARM] Separate out footbridge DC21285 and ISA timer implementations.
parent
8570a650
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
175 additions
and
131 deletions
+175
-131
arch/arm/mach-footbridge/Makefile
arch/arm/mach-footbridge/Makefile
+5
-2
arch/arm/mach-footbridge/arch.c
arch/arm/mach-footbridge/arch.c
+1
-4
arch/arm/mach-footbridge/common.h
arch/arm/mach-footbridge/common.h
+9
-0
arch/arm/mach-footbridge/dc21285-timer.c
arch/arm/mach-footbridge/dc21285-timer.c
+64
-0
arch/arm/mach-footbridge/isa-timer.c
arch/arm/mach-footbridge/isa-timer.c
+93
-0
arch/arm/mach-footbridge/time.c
arch/arm/mach-footbridge/time.c
+3
-125
No files found.
arch/arm/mach-footbridge/Makefile
View file @
5cd10349
...
...
@@ -18,8 +18,11 @@ leds-$(CONFIG_ARCH_CO285) += ebsa285-leds.o
leds-$(CONFIG_ARCH_EBSA285)
+=
ebsa285-leds.o
leds-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-leds.o
obj-$(CONFIG_ARCH_CATS)
+=
cats-hw.o
obj-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-hw.o
obj-$(CONFIG_ARCH_CATS)
+=
cats-hw.o isa-timer.o
obj-$(CONFIG_ARCH_CO285)
+=
dc21285-timer.o
obj-$(CONFIG_ARCH_EBSA285)
+=
dc21285-timer.o
obj-$(CONFIG_ARCH_NETWINDER)
+=
netwinder-hw.o isa-timer.o
obj-$(CONFIG_ARCH_PERSONAL_SERVER)
+=
dc21285-timer.o
obj-$(CONFIG_PCI)
+=
$
(
pci-y
)
obj-$(CONFIG_LEDS)
+=
$
(
leds-y
)
arch/arm/mach-footbridge/arch.c
View file @
5cd10349
...
...
@@ -20,10 +20,7 @@
#include <asm/mach/arch.h>
extern
void
footbridge_map_io
(
void
);
extern
void
footbridge_init_irq
(
void
);
extern
struct
sys_timer
footbridge_timer
;
extern
struct
sys_timer
isa_timer
;
#include "common.h"
unsigned
int
mem_fclk_21285
=
50000000
;
...
...
arch/arm/mach-footbridge/common.h
0 → 100644
View file @
5cd10349
extern
struct
sys_timer
footbridge_timer
;
extern
struct
sys_timer
isa_timer
;
extern
void
isa_rtc_init
(
void
);
extern
void
footbridge_map_io
(
void
);
extern
void
footbridge_init_irq
(
void
);
arch/arm/mach-footbridge/dc21285-timer.c
0 → 100644
View file @
5cd10349
/*
* linux/arch/arm/mach-footbridge/dc21285-timer.c
*
* Copyright (C) 1998 Russell King.
* Copyright (C) 1998 Phil Blundell
*/
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/irq.h>
#include <asm/hardware/dec21285.h>
#include <asm/mach/time.h>
#include "common.h"
/*
* Footbridge timer 1 support.
*/
static
unsigned
long
timer1_latch
;
static
unsigned
long
timer1_gettimeoffset
(
void
)
{
unsigned
long
value
=
timer1_latch
-
*
CSR_TIMER1_VALUE
;
return
((
tick_nsec
/
1000
)
*
value
)
/
timer1_latch
;
}
static
irqreturn_t
timer1_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
*
CSR_TIMER1_CLR
=
0
;
timer_tick
(
regs
);
return
IRQ_HANDLED
;
}
static
struct
irqaction
footbridge_timer_irq
=
{
.
name
=
"Timer1 timer tick"
,
.
handler
=
timer1_interrupt
,
.
flags
=
SA_INTERRUPT
,
};
/*
* Set up timer interrupt.
*/
static
void
__init
footbridge_timer_init
(
void
)
{
isa_rtc_init
();
timer1_latch
=
(
mem_fclk_21285
+
8
*
HZ
)
/
(
16
*
HZ
);
*
CSR_TIMER1_CLR
=
0
;
*
CSR_TIMER1_LOAD
=
timer1_latch
;
*
CSR_TIMER1_CNTL
=
TIMER_CNTL_ENABLE
|
TIMER_CNTL_AUTORELOAD
|
TIMER_CNTL_DIV16
;
setup_irq
(
IRQ_TIMER1
,
&
footbridge_timer_irq
);
}
struct
sys_timer
footbridge_timer
=
{
.
init
=
footbridge_timer_init
,
.
offset
=
timer1_gettimeoffset
,
};
arch/arm/mach-footbridge/isa-timer.c
0 → 100644
View file @
5cd10349
/*
* linux/arch/arm/mach-footbridge/isa-timer.c
*
* Copyright (C) 1998 Russell King.
* Copyright (C) 1998 Phil Blundell
*/
#include <linux/init.h>
#include <linux/interrupt.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mach/time.h>
#include "common.h"
/*
* ISA timer tick support
*/
#define mSEC_10_from_14 ((14318180 + 100) / 200)
static
unsigned
long
isa_gettimeoffset
(
void
)
{
int
count
;
static
int
count_p
=
(
mSEC_10_from_14
/
6
);
/* for the first call after boot */
static
unsigned
long
jiffies_p
=
0
;
/*
* cache volatile jiffies temporarily; we have IRQs turned off.
*/
unsigned
long
jiffies_t
;
/* timer count may underflow right here */
outb_p
(
0x00
,
0x43
);
/* latch the count ASAP */
count
=
inb_p
(
0x40
);
/* read the latched count */
/*
* We do this guaranteed double memory access instead of a _p
* postfix in the previous port access. Wheee, hackady hack
*/
jiffies_t
=
jiffies
;
count
|=
inb_p
(
0x40
)
<<
8
;
/* Detect timer underflows. If we haven't had a timer tick since
the last time we were called, and time is apparently going
backwards, the counter must have wrapped during this routine. */
if
((
jiffies_t
==
jiffies_p
)
&&
(
count
>
count_p
))
count
-=
(
mSEC_10_from_14
/
6
);
else
jiffies_p
=
jiffies_t
;
count_p
=
count
;
count
=
(((
mSEC_10_from_14
/
6
)
-
1
)
-
count
)
*
(
tick_nsec
/
1000
);
count
=
(
count
+
(
mSEC_10_from_14
/
6
)
/
2
)
/
(
mSEC_10_from_14
/
6
);
return
count
;
}
static
irqreturn_t
isa_timer_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
timer_tick
(
regs
);
return
IRQ_HANDLED
;
}
static
struct
irqaction
isa_timer_irq
=
{
.
name
=
"ISA timer tick"
,
.
handler
=
isa_timer_interrupt
,
.
flags
=
SA_INTERRUPT
,
};
static
void
__init
isa_timer_init
(
void
)
{
isa_rtc_init
();
/* enable PIT timer */
/* set for periodic (4) and LSB/MSB write (0x30) */
outb
(
0x34
,
0x43
);
outb
((
mSEC_10_from_14
/
6
)
&
0xFF
,
0x40
);
outb
((
mSEC_10_from_14
/
6
)
>>
8
,
0x40
);
setup_irq
(
IRQ_ISA_TIMER
,
&
isa_timer_irq
);
}
struct
sys_timer
isa_timer
=
{
.
init
=
isa_timer_init
,
.
offset
=
isa_gettimeoffset
,
};
arch/arm/mach-footbridge/time.c
View file @
5cd10349
...
...
@@ -19,75 +19,18 @@
#include <linux/timex.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/mc146818rtc.h>
#include <linux/bcd.h>
#include <asm/hardware/dec21285.h>
#include <asm/hardware.h>
#include <asm/irq.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#include <asm/io.h>
#include <asm/hardware/clps7111.h>
#include <asm/mach/time.h>
#include "common.h"
static
int
rtc_base
;
#define mSEC_10_from_14 ((14318180 + 100) / 200)
static
unsigned
long
isa_gettimeoffset
(
void
)
{
int
count
;
static
int
count_p
=
(
mSEC_10_from_14
/
6
);
/* for the first call after boot */
static
unsigned
long
jiffies_p
=
0
;
/*
* cache volatile jiffies temporarily; we have IRQs turned off.
*/
unsigned
long
jiffies_t
;
/* timer count may underflow right here */
outb_p
(
0x00
,
0x43
);
/* latch the count ASAP */
count
=
inb_p
(
0x40
);
/* read the latched count */
/*
* We do this guaranteed double memory access instead of a _p
* postfix in the previous port access. Wheee, hackady hack
*/
jiffies_t
=
jiffies
;
count
|=
inb_p
(
0x40
)
<<
8
;
/* Detect timer underflows. If we haven't had a timer tick since
the last time we were called, and time is apparently going
backwards, the counter must have wrapped during this routine. */
if
((
jiffies_t
==
jiffies_p
)
&&
(
count
>
count_p
))
count
-=
(
mSEC_10_from_14
/
6
);
else
jiffies_p
=
jiffies_t
;
count_p
=
count
;
count
=
(((
mSEC_10_from_14
/
6
)
-
1
)
-
count
)
*
(
tick_nsec
/
1000
);
count
=
(
count
+
(
mSEC_10_from_14
/
6
)
/
2
)
/
(
mSEC_10_from_14
/
6
);
return
count
;
}
static
irqreturn_t
isa_timer_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
timer_tick
(
regs
);
return
IRQ_HANDLED
;
}
static
unsigned
long
__init
get_isa_cmos_time
(
void
)
{
unsigned
int
year
,
mon
,
day
,
hour
,
min
,
sec
;
...
...
@@ -133,8 +76,7 @@ static unsigned long __init get_isa_cmos_time(void)
return
mktime
(
year
,
mon
,
day
,
hour
,
min
,
sec
);
}
static
int
set_isa_cmos_time
(
void
)
static
int
set_isa_cmos_time
(
void
)
{
int
retval
=
0
;
int
real_seconds
,
real_minutes
,
cmos_minutes
;
...
...
@@ -186,34 +128,7 @@ set_isa_cmos_time(void)
return
retval
;
}
static
unsigned
long
timer1_latch
;
static
unsigned
long
timer1_gettimeoffset
(
void
)
{
unsigned
long
value
=
timer1_latch
-
*
CSR_TIMER1_VALUE
;
return
((
tick_nsec
/
1000
)
*
value
)
/
timer1_latch
;
}
static
irqreturn_t
timer1_interrupt
(
int
irq
,
void
*
dev_id
,
struct
pt_regs
*
regs
)
{
*
CSR_TIMER1_CLR
=
0
;
timer_tick
(
regs
);
return
IRQ_HANDLED
;
}
static
struct
irqaction
footbridge_timer_irq
=
{
.
flags
=
SA_INTERRUPT
};
/*
* Set up timer interrupt.
*/
static
void
__init
footbridge_timer_init
(
void
)
void
__init
isa_rtc_init
(
void
)
{
if
(
machine_is_co285
()
||
machine_is_personal_server
())
...
...
@@ -262,41 +177,4 @@ static void __init footbridge_timer_init(void)
}
else
rtc_base
=
0
;
}
if
(
machine_is_ebsa285
()
||
machine_is_co285
()
||
machine_is_personal_server
())
{
timer1_latch
=
(
mem_fclk_21285
+
8
*
HZ
)
/
(
16
*
HZ
);
*
CSR_TIMER1_CLR
=
0
;
*
CSR_TIMER1_LOAD
=
timer1_latch
;
*
CSR_TIMER1_CNTL
=
TIMER_CNTL_ENABLE
|
TIMER_CNTL_AUTORELOAD
|
TIMER_CNTL_DIV16
;
footbridge_timer_irq
.
name
=
"Timer1 Timer Tick"
;
footbridge_timer_irq
.
handler
=
timer1_interrupt
;
setup_irq
(
IRQ_TIMER1
,
&
footbridge_timer_irq
);
}
else
{
/* enable PIT timer */
/* set for periodic (4) and LSB/MSB write (0x30) */
outb
(
0x34
,
0x43
);
outb
((
mSEC_10_from_14
/
6
)
&
0xFF
,
0x40
);
outb
((
mSEC_10_from_14
/
6
)
>>
8
,
0x40
);
footbridge_timer_irq
.
name
=
"ISA Timer Tick"
;
footbridge_timer_irq
.
handler
=
isa_timer_interrupt
;
setup_irq
(
IRQ_ISA_TIMER
,
&
footbridge_timer_irq
);
}
}
struct
sys_timer
footbridge_timer
=
{
.
init
=
footbridge_timer_init
,
.
offset
=
timer1_gettimeoffset
,
};
struct
sys_timer
isa_timer
=
{
.
init
=
footbridge_timer_init
,
.
offset
=
isa_gettimeoffset
,
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment