diff options
Diffstat (limited to 'include/asm-arm/arch-ebsa285')
-rw-r--r-- | include/asm-arm/arch-ebsa285/io.h | 180 | ||||
-rw-r--r-- | include/asm-arm/arch-ebsa285/irq.h | 8 | ||||
-rw-r--r-- | include/asm-arm/arch-ebsa285/time.h | 30 |
3 files changed, 58 insertions, 160 deletions
diff --git a/include/asm-arm/arch-ebsa285/io.h b/include/asm-arm/arch-ebsa285/io.h index b23ee6863..462d6ba72 100644 --- a/include/asm-arm/arch-ebsa285/io.h +++ b/include/asm-arm/arch-ebsa285/io.h @@ -1,10 +1,11 @@ /* * linux/include/asm-arm/arch-ebsa285/io.h * - * Copyright (C) 1997,1998 Russell King + * Copyright (C) 1997-1999 Russell King * * Modifications: - * 06-Dec-1997 RMK Created. + * 06-12-1997 RMK Created. + * 07-04-1999 RMK Major cleanup */ #ifndef __ASM_ARM_ARCH_IO_H #define __ASM_ARM_ARCH_IO_H @@ -18,132 +19,33 @@ #undef ARCH_IO_DELAY #define ARCH_READWRITE -/* - * Dynamic IO functions - let the compiler - * optimize the expressions - */ -#define DECLARE_DYN_OUT(fnsuffix,instr,typ) \ -extern __inline__ void \ -__out##fnsuffix (unsigned int value, unsigned int port) \ -{ \ - __asm__ __volatile__( \ - "str%?" ##instr## " %0, [%1, %2] @ out"###fnsuffix \ - : \ - : "r" (value), "r" (PCIO_BASE), typ (port)); \ -} +#define __pci_io_addr(x) (PCIO_BASE + (unsigned int)(x)) -#define DECLARE_DYN_IN(sz,fnsuffix,instr,typ) \ -extern __inline__ unsigned sz \ -__in##fnsuffix (unsigned int port) \ -{ \ - unsigned long value; \ - __asm__ __volatile__( \ - "ldr%?" ##instr## " %0, [%1, %2] @ in"###fnsuffix \ - : "=&r" (value) \ - : "r" (PCIO_BASE), typ (port)); \ - return (unsigned sz)value; \ -} +#define __inb(p) (*(volatile unsigned char *)__pci_io_addr(p)) +#define __inl(p) (*(volatile unsigned long *)__pci_io_addr(p)) -extern __inline__ unsigned int __ioaddr (unsigned int port) \ -{ \ - return (unsigned int)(PCIO_BASE + port); \ +extern __inline__ unsigned int __inw(unsigned int port) +{ + unsigned int value; + __asm__ __volatile__( + "ldr%?h %0, [%1, %2] @ inw" + : "=&r" (value) + : "r" (PCIO_BASE), "r" (port)); + return value; } -#define DECLARE_IO(sz,fnsuffix,instr,typ) \ - DECLARE_DYN_OUT(fnsuffix,instr,typ) \ - DECLARE_DYN_IN(sz,fnsuffix,instr,typ) -DECLARE_IO(char,b,"b","Jr") -DECLARE_IO(short,w,"h","r") -DECLARE_IO(long,l,"","Jr") +#define __outb(v,p) (*(volatile unsigned char *)__pci_io_addr(p) = (v)) +#define __outl(v,p) (*(volatile unsigned long *)__pci_io_addr(p) = (v)) -#undef DECLARE_IO -#undef DECLARE_DYN_OUT -#undef DECLARE_DYN_IN - -/* - * Constant address IO functions - * - * These have to be macros for the 'J' constraint to work - - * +/-4096 immediate operand. - */ -#define __outbc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%?b %0, [%1, %2] @ outbc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ -}) - -#define __inbc(port) \ -({ \ - unsigned char result; \ - __asm__ __volatile__( \ - "ldr%?b %0, [%1, %2] @ inbc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ -}) - -#define __outwc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%?h %0, [%1, %2] @ outwc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "r" (port)); \ -}) - -#define __inwc(port) \ -({ \ - unsigned short result; \ - __asm__ __volatile__( \ - "ldr%?h %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "r" (port)); \ - result & 0xffff; \ -}) - -#define __outlc(value,port) \ -({ \ - __asm__ __volatile__( \ - "str%? %0, [%1, %2] @ outlc" \ - : \ - : "r" (value), "r" (PCIO_BASE), "Jr" (port)); \ -}) - -#define __inlc(port) \ -({ \ - unsigned long result; \ - __asm__ __volatile__( \ - "ldr%? %0, [%1, %2] @ inlc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), "Jr" (port)); \ - result; \ -}) - -#define __ioaddrc(port) \ -({ \ - unsigned long addr; \ - addr = PCIO_BASE + port; \ - addr; \ -}) - -/* - * Translated address IO functions - * - * IO address has already been translated to a virtual address - */ -#define outb_t(v,p) \ - (*(volatile unsigned char *)(p) = (v)) - -#define inb_t(p) \ - (*(volatile unsigned char *)(p)) - -#define outl_t(v,p) \ - (*(volatile unsigned long *)(p) = (v)) +extern __inline__ void __outw(unsigned int value, unsigned int port) +{ + __asm__ __volatile__( + "str%?h %0, [%1, %2] @ outw" + : : "r" (value), "r" (PCIO_BASE), "r" (port)); +} -#define inl_t(p) \ - (*(volatile unsigned long *)(p)) +#define __ioaddr(p) __pci_io_addr(p) /* * ioremap support - validate a PCI memory address, @@ -151,7 +53,7 @@ DECLARE_IO(long,l,"","Jr") * address for the page tables. */ #define valid_ioaddr(iomem,size) ((iomem) < 0x80000000 && (iomem) + (size) <= 0x80000000) -#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) +#define io_to_phys(iomem) ((iomem) + DC21285_PCI_MEM) /* * Fudge up IO addresses by this much. Once we're confident that nobody @@ -160,6 +62,8 @@ DECLARE_IO(long,l,"","Jr") */ #define IO_FUDGE_FACTOR PCIMEM_BASE +#define __pci_mem_addr(x) ((void *)(IO_FUDGE_FACTOR + (unsigned long)(x))) + /* * ioremap takes a PCI memory address, as specified in * linux/Documentation/IO-mapping.txt @@ -176,30 +80,20 @@ DECLARE_IO(long,l,"","Jr") #define ioremap_nocache(iomem_addr,size) ioremap((iomem_addr),(size)) -extern void iounmap(void *addr); +#define iounmap(_addr) do { __iounmap(__pci_mem_addr((_addr))); } while (0) -#define DECLARE_PCI_WRITE(typ,fnsuffix) \ -static inline void write##fnsuffix(unsigned typ val, unsigned int addr) \ -{ \ - *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr) = val; \ -} - -#define DECLARE_PCI_READ(typ,fnsuffix) \ -static inline unsigned typ read##fnsuffix (unsigned int addr) \ -{ \ - return *(volatile unsigned typ *)(IO_FUDGE_FACTOR + addr); \ -} +#define readb(addr) (*(volatile unsigned char *)__pci_mem_addr(addr)) +#define readw(addr) (*(volatile unsigned short *)__pci_mem_addr(addr)) +#define readl(addr) (*(volatile unsigned long *)__pci_mem_addr(addr)) -#define DECLARE_PCI(typ,fnsuffix) \ - DECLARE_PCI_WRITE(typ,fnsuffix) \ - DECLARE_PCI_READ(typ,fnsuffix) +#define writeb(b,addr) (*(volatile unsigned char *)__pci_mem_addr(addr) = (b)) +#define writew(b,addr) (*(volatile unsigned short *)__pci_mem_addr(addr) = (b)) +#define writel(b,addr) (*(volatile unsigned long *)__pci_mem_addr(addr) = (b)) -DECLARE_PCI(char,b) -DECLARE_PCI(short,w) -DECLARE_PCI(long,l) +#define memset_io(a,b,c) memset(__pci_mem_addr(a),(b),(c)) +#define memcpy_fromio(a,b,c) memcpy((a),__pci_mem_addr(b),(c)) +#define memcpy_toio(a,b,c) memcpy(__pci_mem_addr(a),(b),(c)) -#undef DECLARE_PCI -#undef DECLARE_PCI_READ -#undef DECLARE_PCI_WRITE +#define eth_io_copy_and_sum(a,b,c,d) eth_copy_and_sum((a),__pci_mem_addr(b),(c),(d)) #endif diff --git a/include/asm-arm/arch-ebsa285/irq.h b/include/asm-arm/arch-ebsa285/irq.h index ca1a55cdb..1c4bc42be 100644 --- a/include/asm-arm/arch-ebsa285/irq.h +++ b/include/asm-arm/arch-ebsa285/irq.h @@ -110,6 +110,8 @@ static void no_action(int cpl, void *dev_id, struct pt_regs *regs) } static struct irqaction irq_cascade = { no_action, 0, 0, "cascade", NULL, NULL }; +static struct resource pic1_resource = { "pic1", 0x20, 0x3f }; +static struct resource pic2_resource = { "pic2", 0xa0, 0xbf }; static __inline__ void irq_init_irq(void) { @@ -159,6 +161,8 @@ static __inline__ void irq_init_irq(void) if (isa_irq != -1) { /* * Setup, and then probe for an ISA PIC + * If the PIC is not there, then we + * ignore the PIC. */ outb(0x11, PIC_LO); outb(_ISA_IRQ(0), PIC_MASK_LO); /* IRQ number */ @@ -201,8 +205,8 @@ static __inline__ void irq_init_irq(void) irq_desc[irq].unmask = isa_unmask_pic_hi_irq; } - request_region(PIC_LO, 2, "pic1"); - request_region(PIC_HI, 2, "pic2"); + request_resource(&ioport_resource, &pic1_resource); + request_resource(&ioport_resource, &pic2_resource); setup_arm_irq(IRQ_ISA_CASCADE, &irq_cascade); setup_arm_irq(isa_irq, &irq_cascade); } diff --git a/include/asm-arm/arch-ebsa285/time.h b/include/asm-arm/arch-ebsa285/time.h index 7c5cd89c4..91e3ae284 100644 --- a/include/asm-arm/arch-ebsa285/time.h +++ b/include/asm-arm/arch-ebsa285/time.h @@ -115,6 +115,9 @@ static void isa_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction isa_timer_irq = { @@ -126,8 +129,7 @@ static struct irqaction isa_timer_irq = { NULL }; -__initfunc(static unsigned long -get_isa_cmos_time(void)) +static unsigned long __init get_isa_cmos_time(void) { unsigned int year, mon, day, hour, min, sec; int i; @@ -237,10 +239,8 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg { *CSR_TIMER1_CLR = 0; - /* Do the LEDs things on non-CATS hardware. - */ - if (!machine_is_cats()) - do_leds(); + /* Do the LEDs things */ + do_leds(); do_timer(regs); @@ -257,6 +257,9 @@ static void __ebsa285_text timer1_interrupt(int irq, void *dev_id, struct pt_reg else last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ } + + if (!user_mode(regs)) + do_profile(instruction_pointer(regs)); } static struct irqaction __ebsa285_data timer1_irq = { @@ -279,22 +282,20 @@ set_dummy_time(unsigned long secs) */ extern __inline__ void setup_timer(void) { - switch(machine_arch_type) { - case MACH_TYPE_CO285: + if (machine_arch_type == MACH_TYPE_CO285) /* * Add-in 21285s shouldn't access the RTC */ rtc_base = 0; - break; - - default: + else rtc_base = 0x70; - break; - } if (rtc_base) { int reg_d, reg_b; + /* + * Probe for the RTC. + */ reg_d = CMOS_READ(RTC_REG_D); /* @@ -314,7 +315,7 @@ extern __inline__ void setup_timer(void) CMOS_READ(RTC_REG_B) == reg_b) { /* - * Check the battery + * We have a RTC. Check the battery */ if ((reg_d & 0x80) == 0) printk(KERN_WARNING "RTC: *** warning: CMOS battery bad\n"); @@ -332,7 +333,6 @@ extern __inline__ void setup_timer(void) xtime.tv_sec = mktime(1970, 1, 1, 0, 0, 0); set_rtc_mmss = set_dummy_time; } - if (machine_is_ebsa285() || machine_is_co285()) { gettimeoffset = timer1_gettimeoffset; |