sparc: remove CONFIG_SUN4
While doing some easy cleanups on the sparc code I noticed that the CONFIG_SUN4 code seems to be worse than the rest - there were some "I don't know how it should work, but the current code definitely cannot work." places. And while I have seen people running Linux on machines like a SPARCstation 5 a few years ago I don't recall having seen sun4 machines, even less ones running Linux. Signed-off-by: Adrian Bunk <bunk@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
b69416b51b
commit
5110bd21b8
@ -18,7 +18,6 @@ obj-y := entry.o wof.o wuf.o etrap.o rtrap.o traps.o $(IRQ_OBJS) \
|
||||
devres-y = ../../../kernel/irq/devres.o
|
||||
|
||||
obj-$(CONFIG_PCI) += pcic.o
|
||||
obj-$(CONFIG_SUN4) += sun4setup.o
|
||||
obj-$(CONFIG_SMP) += trampoline.o smp.o sun4m_smp.o sun4d_smp.o
|
||||
obj-$(CONFIG_SUN_AUXIO) += auxio.o
|
||||
obj-$(CONFIG_SUN_PM) += apc.o pmc.o
|
||||
|
@ -143,7 +143,7 @@ void __init device_scan(void)
|
||||
#endif
|
||||
clock_stop_probe();
|
||||
|
||||
if (ARCH_SUN4C_SUN4)
|
||||
if (ARCH_SUN4C)
|
||||
sun4c_probe_memerr_reg();
|
||||
|
||||
return;
|
||||
|
@ -20,11 +20,7 @@
|
||||
#include <asm/memreg.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pgtable.h>
|
||||
#ifdef CONFIG_SUN4
|
||||
#include <asm/pgtsun4.h>
|
||||
#else
|
||||
#include <asm/pgtsun4c.h>
|
||||
#endif
|
||||
#include <asm/winmacro.h>
|
||||
#include <asm/signal.h>
|
||||
#include <asm/obio.h>
|
||||
@ -775,11 +771,7 @@ vac_linesize_patch_32: subcc %l7, 32, %l7
|
||||
* Ugly, but we cant use hardware flushing on the sun4 and we'd require
|
||||
* two instructions (Anton)
|
||||
*/
|
||||
#ifdef CONFIG_SUN4
|
||||
vac_hwflush_patch1_on: nop
|
||||
#else
|
||||
vac_hwflush_patch1_on: addcc %l7, -PAGE_SIZE, %l7
|
||||
#endif
|
||||
|
||||
vac_hwflush_patch2_on: sta %g0, [%l3 + %l7] ASI_HWFLUSHSEG
|
||||
|
||||
@ -798,42 +790,10 @@ vac_hwflush_patch2_on: sta %g0, [%l3 + %l7] ASI_HWFLUSHSEG
|
||||
! %l7 = 1 for textfault
|
||||
! We want error in %l5, vaddr in %l6
|
||||
sun4c_fault:
|
||||
#ifdef CONFIG_SUN4
|
||||
sethi %hi(sun4c_memerr_reg), %l4
|
||||
ld [%l4+%lo(sun4c_memerr_reg)], %l4 ! memerr ctrl reg addr
|
||||
ld [%l4], %l6 ! memerr ctrl reg
|
||||
ld [%l4 + 4], %l5 ! memerr vaddr reg
|
||||
andcc %l6, 0x80, %g0 ! check for error type
|
||||
st %g0, [%l4 + 4] ! clear the error
|
||||
be 0f ! normal error
|
||||
sethi %hi(AC_BUS_ERROR), %l4 ! bus err reg addr
|
||||
|
||||
call prom_halt ! something weird happened
|
||||
! what exactly did happen?
|
||||
! what should we do here?
|
||||
|
||||
0: or %l4, %lo(AC_BUS_ERROR), %l4 ! bus err reg addr
|
||||
lduba [%l4] ASI_CONTROL, %l6 ! bus err reg
|
||||
|
||||
cmp %l7, 1 ! text fault?
|
||||
be 1f ! yes
|
||||
nop
|
||||
|
||||
ld [%l1], %l4 ! load instruction that caused fault
|
||||
srl %l4, 21, %l4
|
||||
andcc %l4, 1, %g0 ! store instruction?
|
||||
|
||||
be 1f ! no
|
||||
sethi %hi(SUN4C_SYNC_BADWRITE), %l4 ! yep
|
||||
! %lo(SUN4C_SYNC_BADWRITE) = 0
|
||||
or %l4, %l6, %l6 ! set write bit to emulate sun4c
|
||||
1:
|
||||
#else
|
||||
sethi %hi(AC_SYNC_ERR), %l4
|
||||
add %l4, 0x4, %l6 ! AC_SYNC_VA in %l6
|
||||
lda [%l6] ASI_CONTROL, %l5 ! Address
|
||||
lda [%l4] ASI_CONTROL, %l6 ! Error, retained for a bit
|
||||
#endif
|
||||
|
||||
andn %l5, 0xfff, %l5 ! Encode all info into l7
|
||||
srl %l6, 14, %l4
|
||||
@ -880,12 +840,7 @@ sun4c_fault:
|
||||
or %l4, %lo(swapper_pg_dir), %l4
|
||||
sll %l6, 2, %l6
|
||||
ld [%l4 + %l6], %l4
|
||||
#ifdef CONFIG_SUN4
|
||||
sethi %hi(PAGE_MASK), %l6
|
||||
andcc %l4, %l6, %g0
|
||||
#else
|
||||
andcc %l4, PAGE_MASK, %g0
|
||||
#endif
|
||||
be sun4c_fault_fromuser
|
||||
lduXa [%l5] ASI_SEGMAP, %l4
|
||||
|
||||
@ -937,11 +892,7 @@ invalid_segment_patch1:
|
||||
ld [%l6 + 0x08], %l3 ! tmp = entry->vaddr
|
||||
|
||||
! Flush segment from the cache.
|
||||
#ifdef CONFIG_SUN4
|
||||
sethi %hi((128 * 1024)), %l7
|
||||
#else
|
||||
sethi %hi((64 * 1024)), %l7
|
||||
#endif
|
||||
9:
|
||||
vac_hwflush_patch1:
|
||||
vac_linesize_patch:
|
||||
@ -1029,12 +980,7 @@ invalid_segment_patch2:
|
||||
or %l4, %lo(swapper_pg_dir), %l4
|
||||
sll %l3, 2, %l3
|
||||
ld [%l4 + %l3], %l4
|
||||
#ifndef CONFIG_SUN4
|
||||
and %l4, PAGE_MASK, %l4
|
||||
#else
|
||||
sethi %hi(PAGE_MASK), %l6
|
||||
and %l4, %l6, %l4
|
||||
#endif
|
||||
|
||||
srl %l5, (PAGE_SHIFT - 2), %l6
|
||||
and %l6, ((SUN4C_PTRS_PER_PTE - 1) << 2), %l6
|
||||
|
@ -63,15 +63,9 @@ cputypvar_sun4m:
|
||||
|
||||
.align 4
|
||||
|
||||
#ifndef CONFIG_SUN4
|
||||
sun4_notsup:
|
||||
.asciz "Sparc-Linux sun4 needs a specially compiled kernel, turn CONFIG_SUN4 on.\n\n"
|
||||
.asciz "Sparc-Linux sun4 support does no longer exist.\n\n"
|
||||
.align 4
|
||||
#else
|
||||
sun4cdm_notsup:
|
||||
.asciz "Kernel compiled with CONFIG_SUN4 cannot run on SUN4C/SUN4M/SUN4D\nTurn CONFIG_SUN4 off.\n\n"
|
||||
.align 4
|
||||
#endif
|
||||
|
||||
sun4e_notsup:
|
||||
.asciz "Sparc-Linux sun4e support does not exist\n\n"
|
||||
@ -780,15 +774,6 @@ execute_in_high_mem:
|
||||
nop
|
||||
|
||||
found_version:
|
||||
#ifdef CONFIG_SUN4
|
||||
/* For people who try sun4 kernels, even if Configure.help advises them. */
|
||||
ld [%g7 + 0x68], %o1
|
||||
set sun4cdm_notsup, %o0
|
||||
call %o1
|
||||
nop
|
||||
b halt_me
|
||||
nop
|
||||
#endif
|
||||
/* Get the machine type via the mysterious romvec node operations. */
|
||||
|
||||
add %g7, 0x1c, %l1
|
||||
@ -1150,15 +1135,6 @@ sun4c_continue_boot:
|
||||
nop
|
||||
|
||||
sun4_init:
|
||||
#ifdef CONFIG_SUN4
|
||||
/* There, happy now Adrian? */
|
||||
set cputypval, %o2 ! Let everyone know we
|
||||
set ' ', %o0 ! are a "sun4 " architecture
|
||||
stb %o0, [%o2 + 0x4]
|
||||
|
||||
b got_prop
|
||||
nop
|
||||
#else
|
||||
sethi %hi(SUN4_PROM_VECTOR+0x84), %o1
|
||||
ld [%o1 + %lo(SUN4_PROM_VECTOR+0x84)], %o1
|
||||
set sun4_notsup, %o0
|
||||
@ -1170,7 +1146,7 @@ sun4_init:
|
||||
nop
|
||||
1: ba 1b ! Cannot exit into KMON
|
||||
nop
|
||||
#endif
|
||||
|
||||
no_sun4e_here:
|
||||
ld [%g7 + 0x68], %o1
|
||||
set sun4e_notsup, %o0
|
||||
|
@ -12,10 +12,6 @@
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/machines.h> /* Fun with Sun released architectures. */
|
||||
#ifdef CONFIG_SUN4
|
||||
#include <asm/sun4paddr.h>
|
||||
extern void sun4setup(void);
|
||||
#endif
|
||||
|
||||
struct idprom *idprom;
|
||||
static struct idprom idprom_buffer;
|
||||
@ -101,7 +97,4 @@ void __init idprom_init(void)
|
||||
idprom->id_ethaddr[0], idprom->id_ethaddr[1],
|
||||
idprom->id_ethaddr[2], idprom->id_ethaddr[3],
|
||||
idprom->id_ethaddr[4], idprom->id_ethaddr[5]);
|
||||
#ifdef CONFIG_SUN4
|
||||
sun4setup();
|
||||
#endif
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ void cpu_idle(void)
|
||||
{
|
||||
/* endless idle loop with no priority at all */
|
||||
for (;;) {
|
||||
if (ARCH_SUN4C_SUN4) {
|
||||
if (ARCH_SUN4C) {
|
||||
static int count = HZ;
|
||||
static unsigned long last_jiffies;
|
||||
static unsigned long last_faults;
|
||||
|
@ -442,7 +442,6 @@ static void __init of_console_init(void)
|
||||
|
||||
switch (prom_vers) {
|
||||
case PROM_V0:
|
||||
case PROM_SUN4:
|
||||
skip = 0;
|
||||
switch (*romvec->pv_stdout) {
|
||||
case PROMDEV_SCREEN:
|
||||
|
@ -224,12 +224,6 @@ void __init setup_arch(char **cmdline_p)
|
||||
if(!strcmp(&cputypval,"sun4e")) { sparc_cpu_model=sun4e; }
|
||||
if(!strcmp(&cputypval,"sun4u")) { sparc_cpu_model=sun4u; }
|
||||
|
||||
#ifdef CONFIG_SUN4
|
||||
if (sparc_cpu_model != sun4) {
|
||||
prom_printf("This kernel is for Sun4 architecture only.\n");
|
||||
prom_halt();
|
||||
}
|
||||
#endif
|
||||
printk("ARCH: ");
|
||||
switch(sparc_cpu_model) {
|
||||
case sun4:
|
||||
@ -263,7 +257,7 @@ void __init setup_arch(char **cmdline_p)
|
||||
boot_flags_init(*cmdline_p);
|
||||
|
||||
idprom_init();
|
||||
if (ARCH_SUN4C_SUN4)
|
||||
if (ARCH_SUN4C)
|
||||
sun4c_probe_vac();
|
||||
load_mmu();
|
||||
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include <asm/traps.h>
|
||||
#include <asm/irq.h>
|
||||
#include <asm/io.h>
|
||||
#include <asm/sun4paddr.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/machines.h>
|
||||
|
||||
@ -130,22 +129,10 @@ static void sun4c_enable_irq(unsigned int irq_nr)
|
||||
|
||||
volatile struct sun4c_timer_info *sun4c_timers;
|
||||
|
||||
#ifdef CONFIG_SUN4
|
||||
/* This is an ugly hack to work around the
|
||||
current timer code, and make it work with
|
||||
the sun4/260 intersil
|
||||
*/
|
||||
volatile struct sun4c_timer_info sun4_timer;
|
||||
#endif
|
||||
|
||||
static void sun4c_clear_clock_irq(void)
|
||||
{
|
||||
volatile unsigned int clear_intr;
|
||||
#ifdef CONFIG_SUN4
|
||||
if (idprom->id_machtype == (SM_SUN4 | SM_4_260))
|
||||
clear_intr = sun4_timer.timer_limit10;
|
||||
else
|
||||
#endif
|
||||
|
||||
clear_intr = sun4c_timers->timer_limit10;
|
||||
}
|
||||
|
||||
@ -166,11 +153,6 @@ static void __init sun4c_init_timers(irq_handler_t counter_fn)
|
||||
/* Map the Timer chip, this is implemented in hardware inside
|
||||
* the cache chip on the sun4c.
|
||||
*/
|
||||
#ifdef CONFIG_SUN4
|
||||
if (idprom->id_machtype == (SM_SUN4 | SM_4_260))
|
||||
sun4c_timers = &sun4_timer;
|
||||
else
|
||||
#endif
|
||||
sun4c_timers = ioremap(SUN_TIMER_PHYSADDR,
|
||||
sizeof(struct sun4c_timer_info));
|
||||
|
||||
@ -206,28 +188,22 @@ void __init sun4c_init_IRQ(void)
|
||||
{
|
||||
struct linux_prom_registers int_regs[2];
|
||||
int ie_node;
|
||||
struct resource phyres;
|
||||
|
||||
if (ARCH_SUN4) {
|
||||
interrupt_enable = (char *)
|
||||
ioremap(sun4_ie_physaddr, PAGE_SIZE);
|
||||
} else {
|
||||
struct resource phyres;
|
||||
ie_node = prom_searchsiblings (prom_getchild(prom_root_node),
|
||||
"interrupt-enable");
|
||||
if(ie_node == 0)
|
||||
panic("Cannot find /interrupt-enable node");
|
||||
|
||||
ie_node = prom_searchsiblings (prom_getchild(prom_root_node),
|
||||
"interrupt-enable");
|
||||
if(ie_node == 0)
|
||||
panic("Cannot find /interrupt-enable node");
|
||||
|
||||
/* Depending on the "address" property is bad news... */
|
||||
interrupt_enable = NULL;
|
||||
if (prom_getproperty(ie_node, "reg", (char *) int_regs,
|
||||
sizeof(int_regs)) != -1) {
|
||||
memset(&phyres, 0, sizeof(struct resource));
|
||||
phyres.flags = int_regs[0].which_io;
|
||||
phyres.start = int_regs[0].phys_addr;
|
||||
interrupt_enable = (char *) of_ioremap(&phyres, 0,
|
||||
int_regs[0].reg_size, "sun4c_intr");
|
||||
}
|
||||
/* Depending on the "address" property is bad news... */
|
||||
interrupt_enable = NULL;
|
||||
if (prom_getproperty(ie_node, "reg", (char *) int_regs,
|
||||
sizeof(int_regs)) != -1) {
|
||||
memset(&phyres, 0, sizeof(struct resource));
|
||||
phyres.flags = int_regs[0].which_io;
|
||||
phyres.start = int_regs[0].phys_addr;
|
||||
interrupt_enable = (char *) of_ioremap(&phyres, 0,
|
||||
int_regs[0].reg_size, "sun4c_intr");
|
||||
}
|
||||
if (!interrupt_enable)
|
||||
panic("Cannot map interrupt_enable");
|
||||
|
@ -1,75 +0,0 @@
|
||||
/* sun4setup.c: Setup the hardware address of various items in the sun4
|
||||
* architecture. Called from idprom_init
|
||||
*
|
||||
* Copyright (C) 1998 Chris G. Davis (cdavis@cois.on.ca)
|
||||
*/
|
||||
|
||||
#include <asm/page.h>
|
||||
#include <asm/oplib.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/sun4paddr.h>
|
||||
#include <asm/machines.h>
|
||||
|
||||
int sun4_memreg_physaddr;
|
||||
int sun4_ie_physaddr;
|
||||
int sun4_clock_physaddr;
|
||||
int sun4_timer_physaddr;
|
||||
int sun4_eth_physaddr;
|
||||
int sun4_si_physaddr;
|
||||
int sun4_bwtwo_physaddr;
|
||||
int sun4_zs0_physaddr;
|
||||
int sun4_zs1_physaddr;
|
||||
int sun4_dma_physaddr;
|
||||
int sun4_esp_physaddr;
|
||||
int sun4_ie_physaddr;
|
||||
|
||||
void __init sun4setup(void)
|
||||
{
|
||||
printk("Sun4 Hardware Setup v1.0 18/May/98 Chris Davis (cdavis@cois.on.ca). ");
|
||||
/*
|
||||
setup standard sun4 info
|
||||
*/
|
||||
sun4_ie_physaddr=SUN4_IE_PHYSADDR;
|
||||
|
||||
/*
|
||||
setup model specific info
|
||||
*/
|
||||
switch(idprom->id_machtype) {
|
||||
case (SM_SUN4 | SM_4_260 ):
|
||||
printk("Setup for a SUN4/260\n");
|
||||
sun4_memreg_physaddr=SUN4_200_MEMREG_PHYSADDR;
|
||||
sun4_clock_physaddr=SUN4_200_CLOCK_PHYSADDR;
|
||||
sun4_timer_physaddr=SUN4_UNUSED_PHYSADDR;
|
||||
sun4_eth_physaddr=SUN4_200_ETH_PHYSADDR;
|
||||
sun4_si_physaddr=SUN4_200_SI_PHYSADDR;
|
||||
sun4_bwtwo_physaddr=SUN4_200_BWTWO_PHYSADDR;
|
||||
sun4_dma_physaddr=SUN4_UNUSED_PHYSADDR;
|
||||
sun4_esp_physaddr=SUN4_UNUSED_PHYSADDR;
|
||||
break;
|
||||
case (SM_SUN4 | SM_4_330 ):
|
||||
printk("Setup for a SUN4/330\n");
|
||||
sun4_memreg_physaddr=SUN4_300_MEMREG_PHYSADDR;
|
||||
sun4_clock_physaddr=SUN4_300_CLOCK_PHYSADDR;
|
||||
sun4_timer_physaddr=SUN4_300_TIMER_PHYSADDR;
|
||||
sun4_eth_physaddr=SUN4_300_ETH_PHYSADDR;
|
||||
sun4_si_physaddr=SUN4_UNUSED_PHYSADDR;
|
||||
sun4_bwtwo_physaddr=SUN4_300_BWTWO_PHYSADDR;
|
||||
sun4_dma_physaddr=SUN4_300_DMA_PHYSADDR;
|
||||
sun4_esp_physaddr=SUN4_300_ESP_PHYSADDR;
|
||||
break;
|
||||
case (SM_SUN4 | SM_4_470 ):
|
||||
printk("Setup for a SUN4/470\n");
|
||||
sun4_memreg_physaddr=SUN4_400_MEMREG_PHYSADDR;
|
||||
sun4_clock_physaddr=SUN4_400_CLOCK_PHYSADDR;
|
||||
sun4_timer_physaddr=SUN4_400_TIMER_PHYSADDR;
|
||||
sun4_eth_physaddr=SUN4_400_ETH_PHYSADDR;
|
||||
sun4_si_physaddr=SUN4_UNUSED_PHYSADDR;
|
||||
sun4_bwtwo_physaddr=SUN4_400_BWTWO_PHYSADDR;
|
||||
sun4_dma_physaddr=SUN4_400_DMA_PHYSADDR;
|
||||
sun4_esp_physaddr=SUN4_400_ESP_PHYSADDR;
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||
/* See asm-sparc/uaccess.h */
|
||||
if (len > TASK_SIZE - PAGE_SIZE)
|
||||
return -ENOMEM;
|
||||
if (ARCH_SUN4C_SUN4 && len > 0x20000000)
|
||||
if (ARCH_SUN4C && len > 0x20000000)
|
||||
return -ENOMEM;
|
||||
if (!addr)
|
||||
addr = TASK_UNMAPPED_BASE;
|
||||
@ -65,7 +65,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||
|
||||
for (vmm = find_vma(current->mm, addr); ; vmm = vmm->vm_next) {
|
||||
/* At this point: (!vmm || addr < vmm->vm_end). */
|
||||
if (ARCH_SUN4C_SUN4 && addr < 0xe0000000 && 0x20000000 - len < addr) {
|
||||
if (ARCH_SUN4C && addr < 0xe0000000 && 0x20000000 - len < addr) {
|
||||
addr = PAGE_OFFSET;
|
||||
vmm = find_vma(current->mm, PAGE_OFFSET);
|
||||
}
|
||||
@ -81,7 +81,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
|
||||
|
||||
asmlinkage unsigned long sparc_brk(unsigned long brk)
|
||||
{
|
||||
if(ARCH_SUN4C_SUN4) {
|
||||
if(ARCH_SUN4C) {
|
||||
if ((brk & 0xe0000000) != (current->mm->brk & 0xe0000000))
|
||||
return current->mm->brk;
|
||||
}
|
||||
@ -221,7 +221,7 @@ out:
|
||||
|
||||
int sparc_mmap_check(unsigned long addr, unsigned long len)
|
||||
{
|
||||
if (ARCH_SUN4C_SUN4 &&
|
||||
if (ARCH_SUN4C &&
|
||||
(len > 0x20000000 ||
|
||||
(addr < 0xe0000000 && addr + len > 0x20000000)))
|
||||
return -EINVAL;
|
||||
|
@ -39,7 +39,6 @@
|
||||
#include <asm/io.h>
|
||||
#include <asm/idprom.h>
|
||||
#include <asm/machines.h>
|
||||
#include <asm/sun4paddr.h>
|
||||
#include <asm/page.h>
|
||||
#include <asm/pcic.h>
|
||||
#include <asm/irq_regs.h>
|
||||
@ -54,27 +53,6 @@ static struct mostek48t08 __iomem *mstk48t08_regs = NULL;
|
||||
static int set_rtc_mmss(unsigned long);
|
||||
static int sbus_do_settimeofday(struct timespec *tv);
|
||||
|
||||
#ifdef CONFIG_SUN4
|
||||
struct intersil *intersil_clock;
|
||||
#define intersil_cmd(intersil_reg, intsil_cmd) intersil_reg->int_cmd_reg = \
|
||||
(intsil_cmd)
|
||||
|
||||
#define intersil_intr(intersil_reg, intsil_cmd) intersil_reg->int_intr_reg = \
|
||||
(intsil_cmd)
|
||||
|
||||
#define intersil_start(intersil_reg) intersil_cmd(intersil_reg, \
|
||||
( INTERSIL_START | INTERSIL_32K | INTERSIL_NORMAL | INTERSIL_24H |\
|
||||
INTERSIL_INTR_ENABLE))
|
||||
|
||||
#define intersil_stop(intersil_reg) intersil_cmd(intersil_reg, \
|
||||
( INTERSIL_STOP | INTERSIL_32K | INTERSIL_NORMAL | INTERSIL_24H |\
|
||||
INTERSIL_INTR_ENABLE))
|
||||
|
||||
#define intersil_read_intr(intersil_reg, towhere) towhere = \
|
||||
intersil_reg->int_intr_reg
|
||||
|
||||
#endif
|
||||
|
||||
unsigned long profile_pc(struct pt_regs *regs)
|
||||
{
|
||||
extern char __copy_user_begin[], __copy_user_end[];
|
||||
@ -117,15 +95,7 @@ static irqreturn_t timer_interrupt(int dummy, void *dev_id)
|
||||
|
||||
/* Protect counter clear so that do_gettimeoffset works */
|
||||
write_seqlock(&xtime_lock);
|
||||
#ifdef CONFIG_SUN4
|
||||
if((idprom->id_machtype == (SM_SUN4 | SM_4_260)) ||
|
||||
(idprom->id_machtype == (SM_SUN4 | SM_4_110))) {
|
||||
int temp;
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
/* re-enable the irq */
|
||||
enable_pil_irq(10);
|
||||
}
|
||||
#endif
|
||||
|
||||
clear_clock_irq();
|
||||
|
||||
do_timer(1);
|
||||
@ -250,55 +220,6 @@ static void __devinit mostek_set_system_time(void)
|
||||
spin_unlock_irq(&mostek_lock);
|
||||
}
|
||||
|
||||
/* Probe for the real time clock chip on Sun4 */
|
||||
static inline void sun4_clock_probe(void)
|
||||
{
|
||||
#ifdef CONFIG_SUN4
|
||||
int temp;
|
||||
struct resource r;
|
||||
|
||||
memset(&r, 0, sizeof(r));
|
||||
if( idprom->id_machtype == (SM_SUN4 | SM_4_330) ) {
|
||||
sp_clock_typ = MSTK48T02;
|
||||
r.start = sun4_clock_physaddr;
|
||||
mstk48t02_regs = of_ioremap(&r, 0,
|
||||
sizeof(struct mostek48t02), NULL);
|
||||
mstk48t08_regs = NULL; /* To catch weirdness */
|
||||
intersil_clock = NULL; /* just in case */
|
||||
|
||||
/* Kick start the clock if it is completely stopped. */
|
||||
if (mostek_read(mstk48t02_regs + MOSTEK_SEC) & MSTK_STOP)
|
||||
kick_start_clock();
|
||||
} else if( idprom->id_machtype == (SM_SUN4 | SM_4_260)) {
|
||||
/* intersil setup code */
|
||||
printk("Clock: INTERSIL at %8x ",sun4_clock_physaddr);
|
||||
sp_clock_typ = INTERSIL;
|
||||
r.start = sun4_clock_physaddr;
|
||||
intersil_clock = (struct intersil *)
|
||||
of_ioremap(&r, 0, sizeof(*intersil_clock), "intersil");
|
||||
mstk48t02_regs = 0; /* just be sure */
|
||||
mstk48t08_regs = NULL; /* ditto */
|
||||
/* initialise the clock */
|
||||
|
||||
intersil_intr(intersil_clock,INTERSIL_INT_100HZ);
|
||||
|
||||
intersil_start(intersil_clock);
|
||||
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
while (!(temp & 0x80))
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
while (!(temp & 0x80))
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
|
||||
intersil_stop(intersil_clock);
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef CONFIG_SUN4
|
||||
static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match)
|
||||
{
|
||||
struct device_node *dp = op->node;
|
||||
@ -365,7 +286,6 @@ static int __init clock_init(void)
|
||||
* need to see the clock registers.
|
||||
*/
|
||||
fs_initcall(clock_init);
|
||||
#endif /* !CONFIG_SUN4 */
|
||||
|
||||
static void __init sbus_time_init(void)
|
||||
{
|
||||
@ -373,51 +293,8 @@ static void __init sbus_time_init(void)
|
||||
BTFIXUPSET_CALL(bus_do_settimeofday, sbus_do_settimeofday, BTFIXUPCALL_NORM);
|
||||
btfixup();
|
||||
|
||||
if (ARCH_SUN4)
|
||||
sun4_clock_probe();
|
||||
|
||||
sparc_init_timers(timer_interrupt);
|
||||
|
||||
#ifdef CONFIG_SUN4
|
||||
if(idprom->id_machtype == (SM_SUN4 | SM_4_330)) {
|
||||
mostek_set_system_time();
|
||||
} else if(idprom->id_machtype == (SM_SUN4 | SM_4_260) ) {
|
||||
/* initialise the intersil on sun4 */
|
||||
unsigned int year, mon, day, hour, min, sec;
|
||||
int temp;
|
||||
struct intersil *iregs;
|
||||
|
||||
iregs=intersil_clock;
|
||||
if(!iregs) {
|
||||
prom_printf("Something wrong, clock regs not mapped yet.\n");
|
||||
prom_halt();
|
||||
}
|
||||
|
||||
intersil_intr(intersil_clock,INTERSIL_INT_100HZ);
|
||||
disable_pil_irq(10);
|
||||
intersil_stop(iregs);
|
||||
intersil_read_intr(intersil_clock, temp);
|
||||
|
||||
temp = iregs->clk.int_csec;
|
||||
|
||||
sec = iregs->clk.int_sec;
|
||||
min = iregs->clk.int_min;
|
||||
hour = iregs->clk.int_hour;
|
||||
day = iregs->clk.int_day;
|
||||
mon = iregs->clk.int_month;
|
||||
year = MSTK_CVT_YEAR(iregs->clk.int_year);
|
||||
|
||||
enable_pil_irq(10);
|
||||
intersil_start(iregs);
|
||||
|
||||
xtime.tv_sec = mktime(year, mon, day, hour, min, sec);
|
||||
xtime.tv_nsec = (INITIAL_JIFFIES % HZ) * (NSEC_PER_SEC / HZ);
|
||||
set_normalized_timespec(&wall_to_monotonic,
|
||||
-xtime.tv_sec, -xtime.tv_nsec);
|
||||
printk("%u/%u/%u %u:%u:%u\n",day,mon,year,hour,min,sec);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Now that OBP ticker has been silenced, it is safe to enable IRQ. */
|
||||
local_irq_enable();
|
||||
}
|
||||
@ -532,43 +409,6 @@ static int set_rtc_mmss(unsigned long nowtime)
|
||||
int real_seconds, real_minutes, mostek_minutes;
|
||||
struct mostek48t02 *regs = (struct mostek48t02 *)mstk48t02_regs;
|
||||
unsigned long flags;
|
||||
#ifdef CONFIG_SUN4
|
||||
struct intersil *iregs = intersil_clock;
|
||||
int temp;
|
||||
#endif
|
||||
|
||||
/* Not having a register set can lead to trouble. */
|
||||
if (!regs) {
|
||||
#ifdef CONFIG_SUN4
|
||||
if(!iregs)
|
||||
return -1;
|
||||
else {
|
||||
temp = iregs->clk.int_csec;
|
||||
|
||||
mostek_minutes = iregs->clk.int_min;
|
||||
|
||||
real_seconds = nowtime % 60;
|
||||
real_minutes = nowtime / 60;
|
||||
if (((abs(real_minutes - mostek_minutes) + 15)/30) & 1)
|
||||
real_minutes += 30; /* correct for half hour time zone */
|
||||
real_minutes %= 60;
|
||||
|
||||
if (abs(real_minutes - mostek_minutes) < 30) {
|
||||
intersil_stop(iregs);
|
||||
iregs->clk.int_sec=real_seconds;
|
||||
iregs->clk.int_min=real_minutes;
|
||||
intersil_start(iregs);
|
||||
} else {
|
||||
printk(KERN_WARNING
|
||||
"set_rtc_mmss: can't update from %d to %d\n",
|
||||
mostek_minutes, real_minutes);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&mostek_lock, flags);
|
||||
/* Read the current RTC minutes. */
|
||||
|
Reference in New Issue
Block a user