diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-06-15 01:55:58 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-06-15 01:55:58 +0000 |
commit | 53b3988d474435254a3b053a68bb24ce9e439295 (patch) | |
tree | f8da8e40f01f4ad02bbd76b8c9920749b118235f /arch/arm/kernel | |
parent | b0cb48abe83d1a4389ea938bf624f8baa82c5047 (diff) |
Merge with 2.3.99-pre9.
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r-- | arch/arm/kernel/Makefile | 2 | ||||
-rw-r--r-- | arch/arm/kernel/iic.c | 248 | ||||
-rw-r--r-- | arch/arm/kernel/traps.c | 6 |
3 files changed, 4 insertions, 252 deletions
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile index d8f14a756..a129ca2f6 100644 --- a/arch/arm/kernel/Makefile +++ b/arch/arm/kernel/Makefile @@ -34,7 +34,7 @@ obj- := export-objs := armksyms.o dma.o ecard.o hw-footbridge.o leds-$(MACHINE).o -obj-$(CONFIG_ARCH_ACORN) += dma.o ecard.o iic.o fiq.o time-acorn.o +obj-$(CONFIG_ARCH_ACORN) += dma.o ecard.o fiq.o time-acorn.o obj-$(CONFIG_DEBUG_LL) += debug-$(PROCESSOR).o obj-$(CONFIG_MODULES) += armksyms.o obj-$(CONFIG_LEDS) += leds-$(MACHINE).o diff --git a/arch/arm/kernel/iic.c b/arch/arm/kernel/iic.c deleted file mode 100644 index c9a672a32..000000000 --- a/arch/arm/kernel/iic.c +++ /dev/null @@ -1,248 +0,0 @@ -/* - * linux/arch/arm/kernel/iic.c - * - * Copyright (C) 1995, 1996 Russell King - * - * IIC is used to get the current time from the CMOS rtc. - */ - -#include <linux/delay.h> -#include <linux/errno.h> - -#include <asm/system.h> -#include <asm/hardware.h> -#include <asm/io.h> -#include <asm/ioc.h> - -#define FORCE_ONES 0xdc - -/* - * if delay loop has been calibrated then us that, - * else use IOC timer 1. - */ -static void iic_delay(void) -{ - extern unsigned long loops_per_sec; - if (loops_per_sec != (1 << 12)) { - udelay(100); /* was 10 */ - return; - } else { - unsigned long flags; - save_flags_cli(flags); - - outb(254, IOC_T1LTCHL); - outb(255, IOC_T1LTCHH); - outb(0, IOC_T1GO); - outb(1<<6, IOC_IRQCLRA); /* clear T1 irq */ - outb(10, IOC_T1LTCHL); /* was 4 */ - outb(0, IOC_T1LTCHH); - outb(0, IOC_T1GO); - while ((inb(IOC_IRQSTATA) & (1<<6)) == 0); - restore_flags(flags); - } -} - -#define IIC_INIT() dat = (inb(IOC_CONTROL) | FORCE_ONES) & ~3 -#define IIC_SET_DAT outb(dat|=1, IOC_CONTROL); -#define IIC_CLR_DAT outb(dat&=~1, IOC_CONTROL); -#define IIC_SET_CLK outb(dat|=2, IOC_CONTROL); -#define IIC_CLR_CLK outb(dat&=~2, IOC_CONTROL); -#define IIC_DELAY iic_delay(); -#define IIC_READ_DATA() (inb(IOC_CONTROL) & 1) - -static inline void iic_set_lines(int clk, int dat) -{ - int old; - - old = inb(IOC_CONTROL) | FORCE_ONES; - - old &= ~3; - - if (clk) - old |= 2; - if (dat) - old |= 1; - - outb(old, IOC_CONTROL); - - iic_delay(); -} - -static inline unsigned int iic_read_data(void) -{ - return inb(IOC_CONTROL) & 1; -} - -/* - * C: ==~~_ - * D: =~~__ - */ -static inline void iic_start(void) -{ - unsigned int dat; - - IIC_INIT(); - - IIC_SET_DAT - IIC_DELAY - IIC_SET_CLK - IIC_DELAY - - IIC_CLR_DAT - IIC_DELAY - IIC_CLR_CLK - IIC_DELAY -} - -/* - * C: __~~ - * D: =__~ - */ -static inline void iic_stop(void) -{ - unsigned int dat; - - IIC_INIT(); - - IIC_CLR_DAT - IIC_DELAY - IIC_SET_CLK - IIC_DELAY - IIC_SET_DAT - IIC_DELAY -} - -/* - * C: __~_ - * D: =___ - */ -static inline void iic_acknowledge(void) -{ - unsigned int dat; - - IIC_INIT(); - - IIC_CLR_DAT - IIC_DELAY - IIC_SET_CLK - IIC_DELAY - IIC_CLR_CLK - IIC_DELAY -} - -/* - * C: __~_ - * D: =~H~ - */ -static inline int iic_is_acknowledged(void) -{ - unsigned int dat, ack_bit; - - IIC_INIT(); - - IIC_SET_DAT - IIC_DELAY - IIC_SET_CLK - IIC_DELAY - - ack_bit = IIC_READ_DATA(); - - IIC_CLR_CLK - IIC_DELAY - - return ack_bit == 0; -} - -/* - * C: _~__~__~__~__~__~__~__~_ - * D: =DDXDDXDDXDDXDDXDDXDDXDD - */ -static void iic_sendbyte(unsigned int b) -{ - unsigned int dat, i; - - IIC_INIT(); - - for (i = 0; i < 8; i++) { - if (b & 128) - IIC_SET_DAT - else - IIC_CLR_DAT - IIC_DELAY - - IIC_SET_CLK - IIC_DELAY - IIC_CLR_CLK - IIC_DELAY - - b <<= 1; - } -} - -/* - * C: __~_~_~_~_~_~_~_~_ - * D: =~HHHHHHHHHHHHHHHH - */ -static unsigned char iic_recvbyte(void) -{ - unsigned int dat, i, in; - - IIC_INIT(); - - IIC_SET_DAT - IIC_DELAY - - in = 0; - for (i = 0; i < 8; i++) { - IIC_SET_CLK - IIC_DELAY - - in = (in << 1) | IIC_READ_DATA(); - - IIC_CLR_CLK - IIC_DELAY - } - - return in; -} - -int iic_control (unsigned char addr, unsigned char loc, unsigned char *buf, int len) -{ - int i, err = -EIO; - - iic_start(); - iic_sendbyte(addr & 0xfe); - if (!iic_is_acknowledged()) - goto error; - - iic_sendbyte(loc); - if (!iic_is_acknowledged()) - goto error; - - if (addr & 1) { - iic_stop(); - iic_start(); - iic_sendbyte(addr|1); - if (!iic_is_acknowledged()) - goto error; - - for (i = 0; i < len - 1; i++) { - buf[i] = iic_recvbyte(); - iic_acknowledge(); - } - buf[i] = iic_recvbyte(); - } else { - for (i = 0; i < len; i++) { - iic_sendbyte(buf[i]); - - if (!iic_is_acknowledged()) - goto error; - } - } - - err = 0; -error: - iic_stop(); - - return err; -} diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 18d9931ee..1d692dd35 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -399,13 +399,13 @@ void __bug(const char *file, int line, void *data) printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line); if (data) printk(KERN_CRIT"extra data = %p\n", data); - *(int *)0 = 0; + BUG(); } void __readwrite_bug(const char *fn) { printk("%s called, but not implemented", fn); - *(int *)0 = 0; + BUG(); } void __pte_error(const char *file, int line, unsigned long val) @@ -436,7 +436,7 @@ void abort(void) printk(KERN_CRIT "abort() called from %p! (Please " "report to rmk@arm.linux.org.uk)\n", lr); - *(int *)0 = 0; + BUG(); /* if that doesn't kill us, halt */ panic("Oops failed to kill thread"); |