From 871480933a1c28f8a9fed4c4d34d06c439a7a422 Mon Sep 17 00:00:00 2001 From: Srikant Patnaik Date: Sun, 11 Jan 2015 12:28:04 +0530 Subject: Moved, renamed, and deleted files The original directory structure was scattered and unorganized. Changes are basically to make it look like kernel structure. --- arch/arm/mach-footbridge/Kconfig | 97 +++ arch/arm/mach-footbridge/Makefile | 28 + arch/arm/mach-footbridge/Makefile.boot | 4 + arch/arm/mach-footbridge/cats-hw.c | 95 +++ arch/arm/mach-footbridge/cats-pci.c | 58 ++ arch/arm/mach-footbridge/common.c | 272 ++++++++ arch/arm/mach-footbridge/common.h | 11 + arch/arm/mach-footbridge/dc21285-timer.c | 114 ++++ arch/arm/mach-footbridge/dc21285.c | 393 ++++++++++++ arch/arm/mach-footbridge/dma.c | 57 ++ arch/arm/mach-footbridge/ebsa285-leds.c | 138 +++++ arch/arm/mach-footbridge/ebsa285-pci.c | 48 ++ arch/arm/mach-footbridge/ebsa285.c | 26 + .../arm/mach-footbridge/include/mach/debug-macro.S | 56 ++ .../arm/mach-footbridge/include/mach/entry-macro.S | 107 ++++ arch/arm/mach-footbridge/include/mach/hardware.h | 103 +++ arch/arm/mach-footbridge/include/mach/io.h | 31 + arch/arm/mach-footbridge/include/mach/irqs.h | 98 +++ arch/arm/mach-footbridge/include/mach/isa-dma.h | 25 + arch/arm/mach-footbridge/include/mach/memory.h | 69 +++ arch/arm/mach-footbridge/include/mach/timex.h | 18 + arch/arm/mach-footbridge/include/mach/uncompress.h | 38 ++ arch/arm/mach-footbridge/isa-irq.c | 183 ++++++ arch/arm/mach-footbridge/isa-rtc.c | 57 ++ arch/arm/mach-footbridge/isa-timer.c | 44 ++ arch/arm/mach-footbridge/isa.c | 101 +++ arch/arm/mach-footbridge/netwinder-hw.c | 687 +++++++++++++++++++++ arch/arm/mach-footbridge/netwinder-leds.c | 138 +++++ arch/arm/mach-footbridge/netwinder-pci.c | 62 ++ arch/arm/mach-footbridge/personal-pci.c | 57 ++ arch/arm/mach-footbridge/personal.c | 24 + 31 files changed, 3239 insertions(+) create mode 100644 arch/arm/mach-footbridge/Kconfig create mode 100644 arch/arm/mach-footbridge/Makefile create mode 100644 arch/arm/mach-footbridge/Makefile.boot create mode 100644 arch/arm/mach-footbridge/cats-hw.c create mode 100644 arch/arm/mach-footbridge/cats-pci.c create mode 100644 arch/arm/mach-footbridge/common.c create mode 100644 arch/arm/mach-footbridge/common.h create mode 100644 arch/arm/mach-footbridge/dc21285-timer.c create mode 100644 arch/arm/mach-footbridge/dc21285.c create mode 100644 arch/arm/mach-footbridge/dma.c create mode 100644 arch/arm/mach-footbridge/ebsa285-leds.c create mode 100644 arch/arm/mach-footbridge/ebsa285-pci.c create mode 100644 arch/arm/mach-footbridge/ebsa285.c create mode 100644 arch/arm/mach-footbridge/include/mach/debug-macro.S create mode 100644 arch/arm/mach-footbridge/include/mach/entry-macro.S create mode 100644 arch/arm/mach-footbridge/include/mach/hardware.h create mode 100644 arch/arm/mach-footbridge/include/mach/io.h create mode 100644 arch/arm/mach-footbridge/include/mach/irqs.h create mode 100644 arch/arm/mach-footbridge/include/mach/isa-dma.h create mode 100644 arch/arm/mach-footbridge/include/mach/memory.h create mode 100644 arch/arm/mach-footbridge/include/mach/timex.h create mode 100644 arch/arm/mach-footbridge/include/mach/uncompress.h create mode 100644 arch/arm/mach-footbridge/isa-irq.c create mode 100644 arch/arm/mach-footbridge/isa-rtc.c create mode 100644 arch/arm/mach-footbridge/isa-timer.c create mode 100644 arch/arm/mach-footbridge/isa.c create mode 100644 arch/arm/mach-footbridge/netwinder-hw.c create mode 100644 arch/arm/mach-footbridge/netwinder-leds.c create mode 100644 arch/arm/mach-footbridge/netwinder-pci.c create mode 100644 arch/arm/mach-footbridge/personal-pci.c create mode 100644 arch/arm/mach-footbridge/personal.c (limited to 'arch/arm/mach-footbridge') diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig new file mode 100644 index 00000000..f643ef81 --- /dev/null +++ b/arch/arm/mach-footbridge/Kconfig @@ -0,0 +1,97 @@ +if ARCH_FOOTBRIDGE + +menu "Footbridge Implementations" + +config ARCH_CATS + bool "CATS" + select CLKEVT_I8253 + select CLKSRC_I8253 + select FOOTBRIDGE_HOST + select ISA + select ISA_DMA + select PCI + help + Say Y here if you intend to run this kernel on the CATS. + + Saying N will reduce the size of the Footbridge kernel. + +config ARCH_PERSONAL_SERVER + bool "Compaq Personal Server" + select FOOTBRIDGE_HOST + select ISA + select ISA_DMA + select PCI + ---help--- + Say Y here if you intend to run this kernel on the Compaq + Personal Server. + + Saying N will reduce the size of the Footbridge kernel. + + The Compaq Personal Server is not available for purchase. + There are no product plans beyond the current research + prototypes at this time. Information is available at: + + + + If you have any questions or comments about the Compaq Personal + Server, send e-mail to . + +config ARCH_EBSA285_ADDIN + bool "EBSA285 (addin mode)" + select ARCH_EBSA285 + select FOOTBRIDGE_ADDIN + help + Say Y here if you intend to run this kernel on the EBSA285 card + in addin mode. + + Saying N will reduce the size of the Footbridge kernel. + +config ARCH_EBSA285_HOST + bool "EBSA285 (host mode)" + select ARCH_EBSA285 + select FOOTBRIDGE_HOST + select ISA + select ISA_DMA + select PCI + help + Say Y here if you intend to run this kernel on the EBSA285 card + in host ("central function") mode. + + Saying N will reduce the size of the Footbridge kernel. + +config ARCH_NETWINDER + bool "NetWinder" + select CLKEVT_I8253 + select CLKSRC_I8253 + select FOOTBRIDGE_HOST + select ISA + select ISA_DMA + select PCI + help + Say Y here if you intend to run this kernel on the Rebel.COM + NetWinder. Information about this machine can be found at: + + + + Saying N will reduce the size of the Footbridge kernel. + +endmenu + +# Footbridge support +config FOOTBRIDGE + bool + +# Footbridge in host mode +config FOOTBRIDGE_HOST + bool + +# Footbridge in addin mode +config FOOTBRIDGE_ADDIN + bool + +# EBSA285 board in either host or addin mode +config ARCH_EBSA285 + select ARCH_MAY_HAVE_PC_FDC + bool + +endif diff --git a/arch/arm/mach-footbridge/Makefile b/arch/arm/mach-footbridge/Makefile new file mode 100644 index 00000000..3afb1b25 --- /dev/null +++ b/arch/arm/mach-footbridge/Makefile @@ -0,0 +1,28 @@ +# +# Makefile for the linux kernel. +# + +# Object file lists. + +obj-y := common.o dc21285.o dma.o isa-irq.o +obj-m := +obj-n := +obj- := + +pci-$(CONFIG_ARCH_CATS) += cats-pci.o +pci-$(CONFIG_ARCH_EBSA285_HOST) += ebsa285-pci.o +pci-$(CONFIG_ARCH_NETWINDER) += netwinder-pci.o +pci-$(CONFIG_ARCH_PERSONAL_SERVER) += personal-pci.o + +leds-$(CONFIG_ARCH_EBSA285) += ebsa285-leds.o +leds-$(CONFIG_ARCH_NETWINDER) += netwinder-leds.o + +obj-$(CONFIG_ARCH_CATS) += cats-hw.o isa-timer.o +obj-$(CONFIG_ARCH_EBSA285) += ebsa285.o dc21285-timer.o +obj-$(CONFIG_ARCH_NETWINDER) += netwinder-hw.o isa-timer.o +obj-$(CONFIG_ARCH_PERSONAL_SERVER) += personal.o dc21285-timer.o + +obj-$(CONFIG_PCI) +=$(pci-y) +obj-$(CONFIG_LEDS) +=$(leds-y) + +obj-$(CONFIG_ISA) += isa.o isa-rtc.o diff --git a/arch/arm/mach-footbridge/Makefile.boot b/arch/arm/mach-footbridge/Makefile.boot new file mode 100644 index 00000000..ff0a4b5b --- /dev/null +++ b/arch/arm/mach-footbridge/Makefile.boot @@ -0,0 +1,4 @@ + zreladdr-y += 0x00008000 +params_phys-y := 0x00000100 +initrd_phys-y := 0x00800000 + diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c new file mode 100644 index 00000000..25b45360 --- /dev/null +++ b/arch/arm/mach-footbridge/cats-hw.c @@ -0,0 +1,95 @@ +/* + * linux/arch/arm/mach-footbridge/cats-hw.c + * + * CATS machine fixup + * + * Copyright (C) 1998, 1999 Russell King, Phil Blundell + */ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "common.h" + +#define CFG_PORT 0x370 +#define INDEX_PORT (CFG_PORT) +#define DATA_PORT (CFG_PORT + 1) + +static int __init cats_hw_init(void) +{ + if (machine_is_cats()) { + /* Set Aladdin to CONFIGURE mode */ + outb(0x51, CFG_PORT); + outb(0x23, CFG_PORT); + + /* Select logical device 3 */ + outb(0x07, INDEX_PORT); + outb(0x03, DATA_PORT); + + /* Set parallel port to DMA channel 3, ECP+EPP1.9, + enable EPP timeout */ + outb(0x74, INDEX_PORT); + outb(0x03, DATA_PORT); + + outb(0xf0, INDEX_PORT); + outb(0x0f, DATA_PORT); + + outb(0xf1, INDEX_PORT); + outb(0x07, DATA_PORT); + + /* Select logical device 4 */ + outb(0x07, INDEX_PORT); + outb(0x04, DATA_PORT); + + /* UART1 high speed mode */ + outb(0xf0, INDEX_PORT); + outb(0x02, DATA_PORT); + + /* Select logical device 5 */ + outb(0x07, INDEX_PORT); + outb(0x05, DATA_PORT); + + /* UART2 high speed mode */ + outb(0xf0, INDEX_PORT); + outb(0x02, DATA_PORT); + + /* Set Aladdin to RUN mode */ + outb(0xbb, CFG_PORT); + } + + return 0; +} + +__initcall(cats_hw_init); + +/* + * CATS uses soft-reboot by default, since + * hard reboots fail on early boards. + */ +static void __init +fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi) +{ + screen_info.orig_video_lines = 25; + screen_info.orig_video_points = 16; + screen_info.orig_y = 24; +} + +MACHINE_START(CATS, "Chalice-CATS") + /* Maintainer: Philip Blundell */ + .atag_offset = 0x100, + .restart_mode = 's', + .fixup = fixup_cats, + .map_io = footbridge_map_io, + .init_irq = footbridge_init_irq, + .timer = &isa_timer, + .restart = footbridge_restart, +MACHINE_END diff --git a/arch/arm/mach-footbridge/cats-pci.c b/arch/arm/mach-footbridge/cats-pci.c new file mode 100644 index 00000000..32321f66 --- /dev/null +++ b/arch/arm/mach-footbridge/cats-pci.c @@ -0,0 +1,58 @@ +/* + * linux/arch/arm/mach-footbridge/cats-pci.c + * + * PCI bios-type initialisation for PCI machines + * + * Bits taken from various places. + */ +#include +#include +#include + +#include +#include +#include + +/* cats host-specific stuff */ +static int irqmap_cats[] __initdata = { IRQ_PCI, IRQ_IN0, IRQ_IN1, IRQ_IN3 }; + +static int __init cats_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ + if (dev->irq >= 255) + return -1; /* not a valid interrupt. */ + + if (dev->irq >= 128) + return dev->irq & 0x1f; + + if (dev->irq >= 1 && dev->irq <= 4) + return irqmap_cats[dev->irq - 1]; + + if (dev->irq != 0) + printk("PCI: device %02x:%02x has unknown irq line %x\n", + dev->bus->number, dev->devfn, dev->irq); + + return -1; +} + +/* + * why not the standard PCI swizzle? does this prevent 4-port tulip + * cards being used (ie, pci-pci bridge based cards)? + */ +static struct hw_pci cats_pci __initdata = { + .swizzle = NULL, + .map_irq = cats_map_irq, + .nr_controllers = 1, + .setup = dc21285_setup, + .scan = dc21285_scan_bus, + .preinit = dc21285_preinit, + .postinit = dc21285_postinit, +}; + +static int __init cats_pci_init(void) +{ + if (machine_is_cats()) + pci_common_init(&cats_pci); + return 0; +} + +subsys_initcall(cats_pci_init); diff --git a/arch/arm/mach-footbridge/common.c b/arch/arm/mach-footbridge/common.c new file mode 100644 index 00000000..3e6aaa63 --- /dev/null +++ b/arch/arm/mach-footbridge/common.c @@ -0,0 +1,272 @@ +/* + * linux/arch/arm/mach-footbridge/common.c + * + * Copyright (C) 1998-2000 Russell King, Dave Gilbert. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "common.h" + +unsigned int mem_fclk_21285 = 50000000; + +EXPORT_SYMBOL(mem_fclk_21285); + +static int __init early_fclk(char *arg) +{ + mem_fclk_21285 = simple_strtoul(arg, NULL, 0); + return 0; +} + +early_param("mem_fclk_21285", early_fclk); + +static int __init parse_tag_memclk(const struct tag *tag) +{ + mem_fclk_21285 = tag->u.memclk.fmemclk; + return 0; +} + +__tagtable(ATAG_MEMCLK, parse_tag_memclk); + +/* + * Footbridge IRQ translation table + * Converts from our IRQ numbers into FootBridge masks + */ +static const int fb_irq_mask[] = { + IRQ_MASK_UART_RX, /* 0 */ + IRQ_MASK_UART_TX, /* 1 */ + IRQ_MASK_TIMER1, /* 2 */ + IRQ_MASK_TIMER2, /* 3 */ + IRQ_MASK_TIMER3, /* 4 */ + IRQ_MASK_IN0, /* 5 */ + IRQ_MASK_IN1, /* 6 */ + IRQ_MASK_IN2, /* 7 */ + IRQ_MASK_IN3, /* 8 */ + IRQ_MASK_DOORBELLHOST, /* 9 */ + IRQ_MASK_DMA1, /* 10 */ + IRQ_MASK_DMA2, /* 11 */ + IRQ_MASK_PCI, /* 12 */ + IRQ_MASK_SDRAMPARITY, /* 13 */ + IRQ_MASK_I2OINPOST, /* 14 */ + IRQ_MASK_PCI_ABORT, /* 15 */ + IRQ_MASK_PCI_SERR, /* 16 */ + IRQ_MASK_DISCARD_TIMER, /* 17 */ + IRQ_MASK_PCI_DPERR, /* 18 */ + IRQ_MASK_PCI_PERR, /* 19 */ +}; + +static void fb_mask_irq(struct irq_data *d) +{ + *CSR_IRQ_DISABLE = fb_irq_mask[_DC21285_INR(d->irq)]; +} + +static void fb_unmask_irq(struct irq_data *d) +{ + *CSR_IRQ_ENABLE = fb_irq_mask[_DC21285_INR(d->irq)]; +} + +static struct irq_chip fb_chip = { + .irq_ack = fb_mask_irq, + .irq_mask = fb_mask_irq, + .irq_unmask = fb_unmask_irq, +}; + +static void __init __fb_init_irq(void) +{ + unsigned int irq; + + /* + * setup DC21285 IRQs + */ + *CSR_IRQ_DISABLE = -1; + *CSR_FIQ_DISABLE = -1; + + for (irq = _DC21285_IRQ(0); irq < _DC21285_IRQ(20); irq++) { + irq_set_chip_and_handler(irq, &fb_chip, handle_level_irq); + set_irq_flags(irq, IRQF_VALID | IRQF_PROBE); + } +} + +void __init footbridge_init_irq(void) +{ + __fb_init_irq(); + + if (!footbridge_cfn_mode()) + return; + + if (machine_is_ebsa285()) + /* The following is dependent on which slot + * you plug the Southbridge card into. We + * currently assume that you plug it into + * the right-hand most slot. + */ + isa_init_irq(IRQ_PCI); + + if (machine_is_cats()) + isa_init_irq(IRQ_IN2); + + if (machine_is_netwinder()) + isa_init_irq(IRQ_IN3); +} + +/* + * Common mapping for all systems. Note that the outbound write flush is + * commented out since there is a "No Fix" problem with it. Not mapping + * it means that we have extra bullet protection on our feet. + */ +static struct map_desc fb_common_io_desc[] __initdata = { + { + .virtual = ARMCSR_BASE, + .pfn = __phys_to_pfn(DC21285_ARMCSR_BASE), + .length = ARMCSR_SIZE, + .type = MT_DEVICE, + }, { + .virtual = XBUS_BASE, + .pfn = __phys_to_pfn(0x40000000), + .length = XBUS_SIZE, + .type = MT_DEVICE, + } +}; + +/* + * The mapping when the footbridge is in host mode. We don't map any of + * this when we are in add-in mode. + */ +static struct map_desc ebsa285_host_io_desc[] __initdata = { +#if defined(CONFIG_ARCH_FOOTBRIDGE) && defined(CONFIG_FOOTBRIDGE_HOST) + { + .virtual = PCIMEM_BASE, + .pfn = __phys_to_pfn(DC21285_PCI_MEM), + .length = PCIMEM_SIZE, + .type = MT_DEVICE, + }, { + .virtual = PCICFG0_BASE, + .pfn = __phys_to_pfn(DC21285_PCI_TYPE_0_CONFIG), + .length = PCICFG0_SIZE, + .type = MT_DEVICE, + }, { + .virtual = PCICFG1_BASE, + .pfn = __phys_to_pfn(DC21285_PCI_TYPE_1_CONFIG), + .length = PCICFG1_SIZE, + .type = MT_DEVICE, + }, { + .virtual = PCIIACK_BASE, + .pfn = __phys_to_pfn(DC21285_PCI_IACK), + .length = PCIIACK_SIZE, + .type = MT_DEVICE, + }, { + .virtual = PCIO_BASE, + .pfn = __phys_to_pfn(DC21285_PCI_IO), + .length = PCIO_SIZE, + .type = MT_DEVICE, + }, +#endif +}; + +void __init footbridge_map_io(void) +{ + /* + * Set up the common mapping first; we need this to + * determine whether we're in host mode or not. + */ + iotable_init(fb_common_io_desc, ARRAY_SIZE(fb_common_io_desc)); + + /* + * Now, work out what we've got to map in addition on this + * platform. + */ + if (footbridge_cfn_mode()) + iotable_init(ebsa285_host_io_desc, ARRAY_SIZE(ebsa285_host_io_desc)); +} + +void footbridge_restart(char mode, const char *cmd) +{ + if (mode == 's') { + /* Jump into the ROM */ + soft_restart(0x41000000); + } else { + /* + * Force the watchdog to do a CPU reset. + * + * After making sure that the watchdog is disabled + * (so we can change the timer registers) we first + * enable the timer to autoreload itself. Next, the + * timer interval is set really short and any + * current interrupt request is cleared (so we can + * see an edge transition). Finally, TIMER4 is + * enabled as the watchdog. + */ + *CSR_SA110_CNTL &= ~(1 << 13); + *CSR_TIMER4_CNTL = TIMER_CNTL_ENABLE | + TIMER_CNTL_AUTORELOAD | + TIMER_CNTL_DIV16; + *CSR_TIMER4_LOAD = 0x2; + *CSR_TIMER4_CLR = 0; + *CSR_SA110_CNTL |= (1 << 13); + } +} + +#ifdef CONFIG_FOOTBRIDGE_ADDIN + +static inline unsigned long fb_bus_sdram_offset(void) +{ + return *CSR_PCISDRAMBASE & 0xfffffff0; +} + +/* + * These two functions convert virtual addresses to PCI addresses and PCI + * addresses to virtual addresses. Note that it is only legal to use these + * on memory obtained via get_zeroed_page or kmalloc. + */ +unsigned long __virt_to_bus(unsigned long res) +{ + WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory); + + return res + (fb_bus_sdram_offset() - PAGE_OFFSET); +} +EXPORT_SYMBOL(__virt_to_bus); + +unsigned long __bus_to_virt(unsigned long res) +{ + res = res - (fb_bus_sdram_offset() - PAGE_OFFSET); + + WARN_ON(res < PAGE_OFFSET || res >= (unsigned long)high_memory); + + return res; +} +EXPORT_SYMBOL(__bus_to_virt); + +unsigned long __pfn_to_bus(unsigned long pfn) +{ + return __pfn_to_phys(pfn) + (fb_bus_sdram_offset() - PHYS_OFFSET); +} +EXPORT_SYMBOL(__pfn_to_bus); + +unsigned long __bus_to_pfn(unsigned long bus) +{ + return __phys_to_pfn(bus - (fb_bus_sdram_offset() - PHYS_OFFSET)); +} +EXPORT_SYMBOL(__bus_to_pfn); + +#endif diff --git a/arch/arm/mach-footbridge/common.h b/arch/arm/mach-footbridge/common.h new file mode 100644 index 00000000..c9767b89 --- /dev/null +++ b/arch/arm/mach-footbridge/common.h @@ -0,0 +1,11 @@ + +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); + +extern void isa_init_irq(unsigned int irq); +extern void footbridge_restart(char, const char *); diff --git a/arch/arm/mach-footbridge/dc21285-timer.c b/arch/arm/mach-footbridge/dc21285-timer.c new file mode 100644 index 00000000..3b541964 --- /dev/null +++ b/arch/arm/mach-footbridge/dc21285-timer.c @@ -0,0 +1,114 @@ +/* + * linux/arch/arm/mach-footbridge/dc21285-timer.c + * + * Copyright (C) 1998 Russell King. + * Copyright (C) 1998 Phil Blundell + */ +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "common.h" + +static cycle_t cksrc_dc21285_read(struct clocksource *cs) +{ + return cs->mask - *CSR_TIMER2_VALUE; +} + +static int cksrc_dc21285_enable(struct clocksource *cs) +{ + *CSR_TIMER2_LOAD = cs->mask; + *CSR_TIMER2_CLR = 0; + *CSR_TIMER2_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_DIV16; + return 0; +} + +static void cksrc_dc21285_disable(struct clocksource *cs) +{ + *CSR_TIMER2_CNTL = 0; +} + +static struct clocksource cksrc_dc21285 = { + .name = "dc21285_timer2", + .rating = 200, + .read = cksrc_dc21285_read, + .enable = cksrc_dc21285_enable, + .disable = cksrc_dc21285_disable, + .mask = CLOCKSOURCE_MASK(24), + .flags = CLOCK_SOURCE_IS_CONTINUOUS, +}; + +static void ckevt_dc21285_set_mode(enum clock_event_mode mode, + struct clock_event_device *c) +{ + switch (mode) { + case CLOCK_EVT_MODE_RESUME: + case CLOCK_EVT_MODE_PERIODIC: + *CSR_TIMER1_CLR = 0; + *CSR_TIMER1_LOAD = (mem_fclk_21285 + 8 * HZ) / (16 * HZ); + *CSR_TIMER1_CNTL = TIMER_CNTL_ENABLE | TIMER_CNTL_AUTORELOAD | + TIMER_CNTL_DIV16; + break; + + default: + *CSR_TIMER1_CNTL = 0; + break; + } +} + +static struct clock_event_device ckevt_dc21285 = { + .name = "dc21285_timer1", + .features = CLOCK_EVT_FEAT_PERIODIC, + .rating = 200, + .irq = IRQ_TIMER1, + .set_mode = ckevt_dc21285_set_mode, +}; + +static irqreturn_t timer1_interrupt(int irq, void *dev_id) +{ + struct clock_event_device *ce = dev_id; + + *CSR_TIMER1_CLR = 0; + + ce->event_handler(ce); + + return IRQ_HANDLED; +} + +static struct irqaction footbridge_timer_irq = { + .name = "dc21285_timer1", + .handler = timer1_interrupt, + .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, + .dev_id = &ckevt_dc21285, +}; + +/* + * Set up timer interrupt. + */ +static void __init footbridge_timer_init(void) +{ + struct clock_event_device *ce = &ckevt_dc21285; + + clocksource_register_hz(&cksrc_dc21285, (mem_fclk_21285 + 8) / 16); + + setup_irq(ce->irq, &footbridge_timer_irq); + + clockevents_calc_mult_shift(ce, mem_fclk_21285, 5); + ce->max_delta_ns = clockevent_delta2ns(0xffffff, ce); + ce->min_delta_ns = clockevent_delta2ns(0x000004, ce); + ce->cpumask = cpumask_of(smp_processor_id()); + + clockevents_register_device(ce); +} + +struct sys_timer footbridge_timer = { + .init = footbridge_timer_init, +}; diff --git a/arch/arm/mach-footbridge/dc21285.c b/arch/arm/mach-footbridge/dc21285.c new file mode 100644 index 00000000..e17e11de --- /dev/null +++ b/arch/arm/mach-footbridge/dc21285.c @@ -0,0 +1,393 @@ +/* + * linux/arch/arm/kernel/dec21285.c: PCI functions for DC21285 + * + * Copyright (C) 1998-2001 Russell King + * Copyright (C) 1998-2000 Phil Blundell + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include