diff options
Diffstat (limited to 'arch/mips/pnx8550/common')
| -rw-r--r-- | arch/mips/pnx8550/common/Makefile | 26 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/int.c | 236 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/pci.c | 134 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/platform.c | 133 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/proc.c | 110 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/prom.c | 128 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/reset.c | 40 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/setup.c | 144 | ||||
| -rw-r--r-- | arch/mips/pnx8550/common/time.c | 151 | 
9 files changed, 0 insertions, 1102 deletions
diff --git a/arch/mips/pnx8550/common/Makefile b/arch/mips/pnx8550/common/Makefile deleted file mode 100644 index f8ce695dc54..00000000000 --- a/arch/mips/pnx8550/common/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# -# Per Hallsmark, per.hallsmark@mvista.com -# -# ######################################################################## -# -# This program is free software; you can distribute it and/or modify it -# under the terms of the GNU General Public License (Version 2) as -# published by the Free Software Foundation. -# -# This program is distributed in the hope it will be useful, but WITHOUT -# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or -# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License -# for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. -# -# ####################################################################### -# -# Makefile for the PNX8550 specific kernel interface routines -# under Linux. -# - -obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o -obj-$(CONFIG_PCI) += pci.o diff --git a/arch/mips/pnx8550/common/int.c b/arch/mips/pnx8550/common/int.c deleted file mode 100644 index cfed5051dc6..00000000000 --- a/arch/mips/pnx8550/common/int.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * - * Copyright (C) 2005 Embedded Alley Solutions, Inc - * Ported to 2.6. - * - * Per Hallsmark, per.hallsmark@mvista.com - * Copyright (C) 2000, 2001 MIPS Technologies, Inc. - * Copyright (C) 2001 Ralf Baechle - * - * Cleaned up and bug fixing: Pete Popov, ppopov@embeddedalley.com - * - *  This program is free software; you can distribute it and/or modify it - *  under the terms of the GNU General Public License (Version 2) as - *  published by the Free Software Foundation. - * - *  This program is distributed in the hope it will be useful, but WITHOUT - *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License - *  for more details. - * - *  You should have received a copy of the GNU General Public License along - *  with this program; if not, write to the Free Software Foundation, Inc., - *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - */ -#include <linux/compiler.h> -#include <linux/init.h> -#include <linux/irq.h> -#include <linux/sched.h> -#include <linux/interrupt.h> -#include <linux/kernel_stat.h> -#include <linux/random.h> -#include <linux/module.h> - -#include <asm/io.h> -#include <int.h> -#include <uart.h> - -/* default prio for interrupts */ -/* first one is a no-no so therefore always prio 0 (disabled) */ -static char gic_prio[PNX8550_INT_GIC_TOTINT] = { -	0, 1, 1, 1, 1, 15, 1, 1, 1, 1,	//   0 -  9 -	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	//  10 - 19 -	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	//  20 - 29 -	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	//  30 - 39 -	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	//  40 - 49 -	1, 1, 1, 1, 1, 1, 1, 1, 2, 1,	//  50 - 59 -	1, 1, 1, 1, 1, 1, 1, 1, 1, 1,	//  60 - 69 -	1			//  70 -}; - -static void hw0_irqdispatch(int irq) -{ -	/* find out which interrupt */ -	irq = PNX8550_GIC_VECTOR_0 >> 3; - -	if (irq == 0) { -		printk("hw0_irqdispatch: irq 0, spurious interrupt?\n"); -		return; -	} -	do_IRQ(PNX8550_INT_GIC_MIN + irq); -} - - -static void timer_irqdispatch(int irq) -{ -	irq = (0x01c0 & read_c0_config7()) >> 6; - -	if (unlikely(irq == 0)) { -		printk("timer_irqdispatch: irq 0, spurious interrupt?\n"); -		return; -	} - -	if (irq & 0x1) -		do_IRQ(PNX8550_INT_TIMER1); -	if (irq & 0x2) -		do_IRQ(PNX8550_INT_TIMER2); -	if (irq & 0x4) -		do_IRQ(PNX8550_INT_TIMER3); -} - -asmlinkage void plat_irq_dispatch(void) -{ -	unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; - -	if (pending & STATUSF_IP2) -		hw0_irqdispatch(2); -	else if (pending & STATUSF_IP7) { -		if (read_c0_config7() & 0x01c0) -			timer_irqdispatch(7); -	} else -		spurious_interrupt(); -} - -static inline void modify_cp0_intmask(unsigned clr_mask, unsigned set_mask) -{ -	unsigned long status = read_c0_status(); - -	status &= ~((clr_mask & 0xFF) << 8); -	status |= (set_mask & 0xFF) << 8; - -	write_c0_status(status); -} - -static inline void mask_gic_int(unsigned int irq_nr) -{ -	/* interrupt disabled, bit 26(WE_ENABLE)=1 and bit 16(enable)=0 */ -	PNX8550_GIC_REQ(irq_nr) = 1<<28; /* set priority to 0 */ -} - -static inline void unmask_gic_int(unsigned int irq_nr) -{ -	/* set prio mask to lower four bits and enable interrupt */ -	PNX8550_GIC_REQ(irq_nr) = (1<<26 | 1<<16) | (1<<28) | gic_prio[irq_nr]; -} - -static inline void mask_irq(unsigned int irq_nr) -{ -	if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { -		modify_cp0_intmask(1 << irq_nr, 0); -	} else if ((PNX8550_INT_GIC_MIN <= irq_nr) && -		(irq_nr <= PNX8550_INT_GIC_MAX)) { -		mask_gic_int(irq_nr - PNX8550_INT_GIC_MIN); -	} else if ((PNX8550_INT_TIMER_MIN <= irq_nr) && -		(irq_nr <= PNX8550_INT_TIMER_MAX)) { -		modify_cp0_intmask(1 << 7, 0); -	} else { -		printk("mask_irq: irq %d doesn't exist!\n", irq_nr); -	} -} - -static inline void unmask_irq(unsigned int irq_nr) -{ -	if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { -		modify_cp0_intmask(0, 1 << irq_nr); -	} else if ((PNX8550_INT_GIC_MIN <= irq_nr) && -		(irq_nr <= PNX8550_INT_GIC_MAX)) { -		unmask_gic_int(irq_nr - PNX8550_INT_GIC_MIN); -	} else if ((PNX8550_INT_TIMER_MIN <= irq_nr) && -		(irq_nr <= PNX8550_INT_TIMER_MAX)) { -		modify_cp0_intmask(0, 1 << 7); -	} else { -		printk("mask_irq: irq %d doesn't exist!\n", irq_nr); -	} -} - -int pnx8550_set_gic_priority(int irq, int priority) -{ -	int gic_irq = irq-PNX8550_INT_GIC_MIN; -	int prev_priority = PNX8550_GIC_REQ(gic_irq) & 0xf; - -        gic_prio[gic_irq] = priority; -	PNX8550_GIC_REQ(gic_irq) |= (0x10000000 | gic_prio[gic_irq]); - -	return prev_priority; -} - -static struct irq_chip level_irq_type = { -	.name =		"PNX Level IRQ", -	.ack =		mask_irq, -	.mask =		mask_irq, -	.mask_ack =	mask_irq, -	.unmask =	unmask_irq, -}; - -static struct irqaction gic_action = { -	.handler =	no_action, -	.flags =	IRQF_DISABLED, -	.name =		"GIC", -}; - -static struct irqaction timer_action = { -	.handler =	no_action, -	.flags =	IRQF_DISABLED | IRQF_TIMER, -	.name =		"Timer", -}; - -void __init arch_init_irq(void) -{ -	int i; -	int configPR; - -	for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) { -		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq); -		mask_irq(i);	/* mask the irq just in case  */ -	} - -	/* init of GIC/IPC interrupts */ -	/* should be done before cp0 since cp0 init enables the GIC int */ -	for (i = PNX8550_INT_GIC_MIN; i <= PNX8550_INT_GIC_MAX; i++) { -		int gic_int_line = i - PNX8550_INT_GIC_MIN; -		if (gic_int_line == 0 ) -			continue;	// don't fiddle with int 0 -		/* -		 * enable change of TARGET, ENABLE and ACTIVE_LOW bits -		 * set TARGET        0 to route through hw0 interrupt -		 * set ACTIVE_LOW    0 active high  (correct?) -		 * -		 * We really should setup an interrupt description table -		 * to do this nicely. -		 * Note, PCI INTA is active low on the bus, but inverted -		 * in the GIC, so to us it's active high. -		 */ -		PNX8550_GIC_REQ(i - PNX8550_INT_GIC_MIN) = 0x1E000000; - -		/* mask/priority is still 0 so we will not get any -		 * interrupts until it is unmasked */ - -		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq); -	} - -	/* Priority level 0 */ -	PNX8550_GIC_PRIMASK_0 = PNX8550_GIC_PRIMASK_1 = 0; - -	/* Set int vector table address */ -	PNX8550_GIC_VECTOR_0 = PNX8550_GIC_VECTOR_1 = 0; - -	set_irq_chip_and_handler(MIPS_CPU_GIC_IRQ, &level_irq_type, -				 handle_level_irq); -	setup_irq(MIPS_CPU_GIC_IRQ, &gic_action); - -	/* init of Timer interrupts */ -	for (i = PNX8550_INT_TIMER_MIN; i <= PNX8550_INT_TIMER_MAX; i++) -		set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq); - -	/* Stop Timer 1-3 */ -	configPR = read_c0_config7(); -	configPR |= 0x00000038; -	write_c0_config7(configPR); - -	set_irq_chip_and_handler(MIPS_CPU_TIMER_IRQ, &level_irq_type, -				 handle_level_irq); -	setup_irq(MIPS_CPU_TIMER_IRQ, &timer_action); -} - -EXPORT_SYMBOL(pnx8550_set_gic_priority); diff --git a/arch/mips/pnx8550/common/pci.c b/arch/mips/pnx8550/common/pci.c deleted file mode 100644 index 98e86ddb86c..00000000000 --- a/arch/mips/pnx8550/common/pci.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * - * BRIEF MODULE DESCRIPTION - * - * Author: source@mvista.com - * - *  This program is free software; you can distribute it and/or modify it - *  under the terms of the GNU General Public License (Version 2) as - *  published by the Free Software Foundation. - * - *  This program is distributed in the hope it will be useful, but WITHOUT - *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License - *  for more details. - * - *  You should have received a copy of the GNU General Public License along - *  with this program; if not, write to the Free Software Foundation, Inc., - *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - */ -#include <linux/types.h> -#include <linux/pci.h> -#include <linux/kernel.h> -#include <linux/init.h> - -#include <pci.h> -#include <glb.h> -#include <nand.h> - -static struct resource pci_io_resource = { -	.start	= PNX8550_PCIIO + 0x1000,	/* reserve regacy I/O space */ -	.end	= PNX8550_PCIIO + PNX8550_PCIIO_SIZE, -	.name	= "pci IO space", -	.flags	= IORESOURCE_IO -}; - -static struct resource pci_mem_resource = { -	.start	= PNX8550_PCIMEM, -	.end	= PNX8550_PCIMEM + PNX8550_PCIMEM_SIZE - 1, -	.name	= "pci memory space", -	.flags	= IORESOURCE_MEM -}; - -extern struct pci_ops pnx8550_pci_ops; - -static struct pci_controller pnx8550_controller = { -	.pci_ops	= &pnx8550_pci_ops, -	.io_map_base	= PNX8550_PORT_BASE, -	.io_resource	= &pci_io_resource, -	.mem_resource	= &pci_mem_resource, -}; - -/* Return the total size of DRAM-memory, (RANK0 + RANK1) */ -static inline unsigned long get_system_mem_size(void) -{ -	/* Read IP2031_RANK0_ADDR_LO */ -	unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010); -	/* Read IP2031_RANK1_ADDR_HI */ -	unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018); - -	return dram_r1_hi - dram_r0_lo + 1; -} - -static int __init pnx8550_pci_setup(void) -{ -	int pci_mem_code; -	int mem_size = get_system_mem_size() >> 20; - -	/* Clear the Global 2 Register, PCI Inta Output Enable Registers -	   Bit 1:Enable DAC Powerdown -	  -> 0:DACs are enabled and are working normally -	     1:DACs are powerdown -	   Bit 0:Enable of PCI inta output -	  -> 0 = Disable PCI inta output -	     1 = Enable PCI inta output -	*/ -	PNX8550_GLB2_ENAB_INTA_O = 0; - -	/* Calc the PCI mem size code */ -	if (mem_size >= 128) -		pci_mem_code = SIZE_128M; -	else if (mem_size >= 64) -		pci_mem_code = SIZE_64M; -	else if (mem_size >= 32) -		pci_mem_code = SIZE_32M; -	else -		pci_mem_code = SIZE_16M; - -	/* Set PCI_XIO registers */ -	outl(pci_mem_resource.start, PCI_BASE | PCI_BASE1_LO); -	outl(pci_mem_resource.end + 1, PCI_BASE | PCI_BASE1_HI); -	outl(pci_io_resource.start, PCI_BASE | PCI_BASE2_LO); -	outl(pci_io_resource.end, PCI_BASE | PCI_BASE2_HI); - -	/* Send memory transaction via PCI_BASE2 */ -	outl(0x00000001, PCI_BASE | PCI_IO); - -	/* Unlock the setup register */ -	outl(0xca, PCI_BASE | PCI_UNLOCKREG); - -	/* -	 * BAR0 of PNX8550 (pci base 10) must be zero in order for ide -	 * to work, and in order for bus_to_baddr to work without any -	 * hacks. -	 */ -	outl(0x00000000, PCI_BASE | PCI_BASE10); - -	/* -	 *These two bars are set by default or the boot code. -	 * However, it's safer to set them here so we're not boot -	 * code dependent. -	 */ -	outl(0x1be00000, PCI_BASE | PCI_BASE14);  /* PNX MMIO */ -	outl(PNX8550_NAND_BASE_ADDR, PCI_BASE | PCI_BASE18);  /* XIO      */ - -	outl(PCI_EN_TA | -	     PCI_EN_PCI2MMI | -	     PCI_EN_XIO | -	     PCI_SETUP_BASE18_SIZE(SIZE_32M) | -	     PCI_SETUP_BASE18_EN | -	     PCI_SETUP_BASE14_EN | -	     PCI_SETUP_BASE10_PREF | -	     PCI_SETUP_BASE10_SIZE(pci_mem_code) | -	     PCI_SETUP_CFGMANAGE_EN | -	     PCI_SETUP_PCIARB_EN, -	     PCI_BASE | -	     PCI_SETUP);	/* PCI_SETUP */ -	outl(0x00000000, PCI_BASE | PCI_CTRL);	/* PCI_CONTROL */ - -	register_pci_controller(&pnx8550_controller); - -	return 0; -} - -arch_initcall(pnx8550_pci_setup); diff --git a/arch/mips/pnx8550/common/platform.c b/arch/mips/pnx8550/common/platform.c deleted file mode 100644 index 5264cc09a27..00000000000 --- a/arch/mips/pnx8550/common/platform.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Platform device support for NXP PNX8550 SoCs - * - * Copyright 2005, Embedded Alley Solutions, Inc - * - * Based on arch/mips/au1000/common/platform.c - * Platform device support for Au1x00 SoCs. - * - * Copyright 2004, Matt Porter <mporter@kernel.crashing.org> - * - * This file is licensed under the terms of the GNU General Public - * License version 2.  This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ -#include <linux/device.h> -#include <linux/dma-mapping.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/resource.h> -#include <linux/serial.h> -#include <linux/serial_pnx8xxx.h> -#include <linux/platform_device.h> - -#include <int.h> -#include <usb.h> -#include <uart.h> - -static struct resource pnx8550_usb_ohci_resources[] = { -	[0] = { -		.start		= PNX8550_USB_OHCI_OP_BASE, -		.end		= PNX8550_USB_OHCI_OP_BASE + -				  PNX8550_USB_OHCI_OP_LEN, -		.flags		= IORESOURCE_MEM, -	}, -	[1] = { -		.start		= PNX8550_INT_USB, -		.end		= PNX8550_INT_USB, -		.flags		= IORESOURCE_IRQ, -	}, -}; - -static struct resource pnx8550_uart_resources[] = { -	[0] = { -		.start		= PNX8550_UART_PORT0, -		.end		= PNX8550_UART_PORT0 + 0xfff, -		.flags		= IORESOURCE_MEM, -	}, -	[1] = { -		.start		= PNX8550_UART_INT(0), -		.end		= PNX8550_UART_INT(0), -		.flags		= IORESOURCE_IRQ, -	}, -	[2] = { -		.start		= PNX8550_UART_PORT1, -		.end		= PNX8550_UART_PORT1 + 0xfff, -		.flags		= IORESOURCE_MEM, -	}, -	[3] = { -		.start		= PNX8550_UART_INT(1), -		.end		= PNX8550_UART_INT(1), -		.flags		= IORESOURCE_IRQ, -	}, -}; - -struct pnx8xxx_port pnx8xxx_ports[] = { -	[0] = { -		.port   = { -			.type		= PORT_PNX8XXX, -			.iotype		= UPIO_MEM, -			.membase	= (void __iomem *)PNX8550_UART_PORT0, -			.mapbase	= PNX8550_UART_PORT0, -			.irq		= PNX8550_UART_INT(0), -			.uartclk	= 3692300, -			.fifosize	= 16, -			.flags		= UPF_BOOT_AUTOCONF, -			.line		= 0, -		}, -	}, -	[1] = { -		.port   = { -			.type		= PORT_PNX8XXX, -			.iotype		= UPIO_MEM, -			.membase	= (void __iomem *)PNX8550_UART_PORT1, -			.mapbase	= PNX8550_UART_PORT1, -			.irq		= PNX8550_UART_INT(1), -			.uartclk	= 3692300, -			.fifosize	= 16, -			.flags		= UPF_BOOT_AUTOCONF, -			.line		= 1, -		}, -	}, -}; - -/* The dmamask must be set for OHCI to work */ -static u64 ohci_dmamask = DMA_BIT_MASK(32); - -static u64 uart_dmamask = DMA_BIT_MASK(32); - -static struct platform_device pnx8550_usb_ohci_device = { -	.name		= "pnx8550-ohci", -	.id		= -1, -	.dev = { -		.dma_mask		= &ohci_dmamask, -		.coherent_dma_mask	= DMA_BIT_MASK(32), -	}, -	.num_resources	= ARRAY_SIZE(pnx8550_usb_ohci_resources), -	.resource	= pnx8550_usb_ohci_resources, -}; - -static struct platform_device pnx8550_uart_device = { -	.name		= "pnx8xxx-uart", -	.id		= -1, -	.dev = { -		.dma_mask		= &uart_dmamask, -		.coherent_dma_mask	= DMA_BIT_MASK(32), -		.platform_data = pnx8xxx_ports, -	}, -	.num_resources	= ARRAY_SIZE(pnx8550_uart_resources), -	.resource	= pnx8550_uart_resources, -}; - -static struct platform_device *pnx8550_platform_devices[] __initdata = { -	&pnx8550_usb_ohci_device, -	&pnx8550_uart_device, -}; - -static int __init pnx8550_platform_init(void) -{ -	return platform_add_devices(pnx8550_platform_devices, -			            ARRAY_SIZE(pnx8550_platform_devices)); -} - -arch_initcall(pnx8550_platform_init); diff --git a/arch/mips/pnx8550/common/proc.c b/arch/mips/pnx8550/common/proc.c deleted file mode 100644 index 3bba5ec828e..00000000000 --- a/arch/mips/pnx8550/common/proc.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - *  This program is free software; you can distribute it and/or modify it - *  under the terms of the GNU General Public License (Version 2) as - *  published by the Free Software Foundation. - * - *  This program is distributed in the hope it will be useful, but WITHOUT - *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License - *  for more details. - * - *  You should have received a copy of the GNU General Public License along - *  with this program; if not, write to the Free Software Foundation, Inc., - *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - */ -#include <linux/init.h> -#include <linux/proc_fs.h> -#include <linux/irq.h> -#include <linux/sched.h> -#include <linux/interrupt.h> -#include <linux/kernel_stat.h> -#include <linux/random.h> - -#include <asm/io.h> -#include <int.h> -#include <uart.h> - - -static int pnx8550_timers_read(char* page, char** start, off_t offset, int count, int* eof, void* data) -{ -        int len = 0; -	int configPR = read_c0_config7(); - -        if (offset==0) { -		len += sprintf(&page[len], "Timer:       count,  compare, tc, status\n"); -                len += sprintf(&page[len], "    1: %11i, %8i,  %1i, %s\n", -			       read_c0_count(), read_c0_compare(), -			      (configPR>>6)&0x1, ((configPR>>3)&0x1)? "off":"on"); -                len += sprintf(&page[len], "    2: %11i, %8i,  %1i, %s\n", -			       read_c0_count2(), read_c0_compare2(), -			      (configPR>>7)&0x1, ((configPR>>4)&0x1)? "off":"on"); -                len += sprintf(&page[len], "    3: %11i, %8i,  %1i, %s\n", -			       read_c0_count3(), read_c0_compare3(), -			      (configPR>>8)&0x1, ((configPR>>5)&0x1)? "off":"on"); -        } - -        return len; -} - -static int pnx8550_registers_read(char* page, char** start, off_t offset, int count, int* eof, void* data) -{ -        int len = 0; - -        if (offset==0) { -                len += sprintf(&page[len], "config1:   %#10.8x\n", read_c0_config1()); -                len += sprintf(&page[len], "config2:   %#10.8x\n", read_c0_config2()); -                len += sprintf(&page[len], "config3:   %#10.8x\n", read_c0_config3()); -                len += sprintf(&page[len], "configPR:  %#10.8x\n", read_c0_config7()); -                len += sprintf(&page[len], "status:    %#10.8x\n", read_c0_status()); -                len += sprintf(&page[len], "cause:     %#10.8x\n", read_c0_cause()); -                len += sprintf(&page[len], "count:     %#10.8x\n", read_c0_count()); -                len += sprintf(&page[len], "count_2:   %#10.8x\n", read_c0_count2()); -                len += sprintf(&page[len], "count_3:   %#10.8x\n", read_c0_count3()); -                len += sprintf(&page[len], "compare:   %#10.8x\n", read_c0_compare()); -                len += sprintf(&page[len], "compare_2: %#10.8x\n", read_c0_compare2()); -                len += sprintf(&page[len], "compare_3: %#10.8x\n", read_c0_compare3()); -        } - -        return len; -} - -static struct proc_dir_entry* pnx8550_dir; -static struct proc_dir_entry* pnx8550_timers; -static struct proc_dir_entry* pnx8550_registers; - -static int pnx8550_proc_init( void ) -{ - -	// Create /proc/pnx8550 -        pnx8550_dir = proc_mkdir("pnx8550", NULL); -        if (!pnx8550_dir) { -                printk(KERN_ERR "Can't create pnx8550 proc dir\n"); -                return -1; -        } - -	// Create /proc/pnx8550/timers -        pnx8550_timers = create_proc_read_entry( -		"timers", -		0, -		pnx8550_dir, -		pnx8550_timers_read, -		NULL); - -        if (!pnx8550_timers) -                printk(KERN_ERR "Can't create pnx8550 timers proc file\n"); - -	// Create /proc/pnx8550/registers -        pnx8550_registers = create_proc_read_entry( -		"registers", -		0, -		pnx8550_dir, -		pnx8550_registers_read, -		NULL); - -        if (!pnx8550_registers) -                printk(KERN_ERR "Can't create pnx8550 registers proc file\n"); - -	return 0; -} - -__initcall(pnx8550_proc_init); diff --git a/arch/mips/pnx8550/common/prom.c b/arch/mips/pnx8550/common/prom.c deleted file mode 100644 index 32f70097c3c..00000000000 --- a/arch/mips/pnx8550/common/prom.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * - * Per Hallsmark, per.hallsmark@mvista.com - * - * Based on jmr3927/common/prom.c - * - * 2004 (c) MontaVista Software, Inc. This file is licensed under the - * terms of the GNU General Public License version 2. This program is - * licensed "as is" without any warranty of any kind, whether express - * or implied. - */ -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/string.h> -#include <linux/serial_pnx8xxx.h> - -#include <asm/bootinfo.h> -#include <uart.h> - -/* #define DEBUG_CMDLINE */ - -extern int prom_argc; -extern char **prom_argv, **prom_envp; - -typedef struct -{ -    char *name; -/*    char *val; */ -}t_env_var; - - -char * prom_getcmdline(void) -{ -	return &(arcs_cmdline[0]); -} - -void __init prom_init_cmdline(void) -{ -	int i; - -	arcs_cmdline[0] = '\0'; -	for (i = 0; i < prom_argc; i++) { -		strcat(arcs_cmdline, prom_argv[i]); -		strcat(arcs_cmdline, " "); -	} -} - -char *prom_getenv(char *envname) -{ -	/* -	 * Return a pointer to the given environment variable. -	 * Environment variables are stored in the form of "memsize=64". -	 */ - -	t_env_var *env = (t_env_var *)prom_envp; -	int i; - -	i = strlen(envname); - -	while(env->name) { -		if(strncmp(envname, env->name, i) == 0) { -			return(env->name + strlen(envname) + 1); -		} -		env++; -	} -	return(NULL); -} - -inline unsigned char str2hexnum(unsigned char c) -{ -	if(c >= '0' && c <= '9') -		return c - '0'; -	if(c >= 'a' && c <= 'f') -		return c - 'a' + 10; -	if(c >= 'A' && c <= 'F') -		return c - 'A' + 10; -	return 0; /* foo */ -} - -inline void str2eaddr(unsigned char *ea, unsigned char *str) -{ -	int i; - -	for(i = 0; i < 6; i++) { -		unsigned char num; - -		if((*str == '.') || (*str == ':')) -			str++; -		num = str2hexnum(*str++) << 4; -		num |= (str2hexnum(*str++)); -		ea[i] = num; -	} -} - -int get_ethernet_addr(char *ethernet_addr) -{ -        char *ethaddr_str; - -        ethaddr_str = prom_getenv("ethaddr"); -	if (!ethaddr_str) { -	        printk("ethaddr not set in boot prom\n"); -		return -1; -	} -	str2eaddr(ethernet_addr, ethaddr_str); -	return 0; -} - -void __init prom_free_prom_memory(void) -{ -} - -extern int pnx8550_console_port; - -/* used by early printk */ -void prom_putchar(char c) -{ -	if (pnx8550_console_port != -1) { -		/* Wait until FIFO not full */ -		while( ((ip3106_fifo(UART_BASE, pnx8550_console_port) & PNX8XXX_UART_FIFO_TXFIFO) >> 16) >= 16) -			; -		/* Send one char */ -		ip3106_fifo(UART_BASE, pnx8550_console_port) = c; -	} -} - -EXPORT_SYMBOL(get_ethernet_addr); -EXPORT_SYMBOL(str2eaddr); diff --git a/arch/mips/pnx8550/common/reset.c b/arch/mips/pnx8550/common/reset.c deleted file mode 100644 index e7a12ff304b..00000000000 --- a/arch/mips/pnx8550/common/reset.c +++ /dev/null @@ -1,40 +0,0 @@ -/*. - * - * ######################################################################## - * - *  This program is free software; you can distribute it and/or modify it - *  under the terms of the GNU General Public License (Version 2) as - *  published by the Free Software Foundation. - * - *  This program is distributed in the hope it will be useful, but WITHOUT - *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License - *  for more details. - * - *  You should have received a copy of the GNU General Public License along - *  with this program; if not, write to the Free Software Foundation, Inc., - *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - * - * ######################################################################## - * - * Reset the PNX8550 board. - * - */ -#include <linux/kernel.h> - -#include <asm/processor.h> -#include <asm/reboot.h> -#include <glb.h> - -void pnx8550_machine_restart(char *command) -{ -	PNX8550_RST_CTL = PNX8550_RST_DO_SW_RST; -} - -void pnx8550_machine_halt(void) -{ -	while (1) { -		if (cpu_wait) -			cpu_wait(); -	} -} diff --git a/arch/mips/pnx8550/common/setup.c b/arch/mips/pnx8550/common/setup.c deleted file mode 100644 index 43cb3945fdb..00000000000 --- a/arch/mips/pnx8550/common/setup.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - * - * 2.6 port, Embedded Alley Solutions, Inc - * - *  Based on Per Hallsmark, per.hallsmark@mvista.com - * - *  This program is free software; you can distribute it and/or modify it - *  under the terms of the GNU General Public License (Version 2) as - *  published by the Free Software Foundation. - * - *  This program is distributed in the hope it will be useful, but WITHOUT - *  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - *  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License - *  for more details. - * - *  You should have received a copy of the GNU General Public License along - *  with this program; if not, write to the Free Software Foundation, Inc., - *  59 Temple Place - Suite 330, Boston MA 02111-1307, USA. - */ -#include <linux/init.h> -#include <linux/sched.h> -#include <linux/ioport.h> -#include <linux/irq.h> -#include <linux/mm.h> -#include <linux/delay.h> -#include <linux/interrupt.h> -#include <linux/serial_pnx8xxx.h> -#include <linux/pm.h> - -#include <asm/cpu.h> -#include <asm/bootinfo.h> -#include <asm/irq.h> -#include <asm/mipsregs.h> -#include <asm/reboot.h> -#include <asm/pgtable.h> -#include <asm/time.h> - -#include <glb.h> -#include <int.h> -#include <pci.h> -#include <uart.h> -#include <nand.h> - -extern void __init board_setup(void); -extern void pnx8550_machine_restart(char *); -extern void pnx8550_machine_halt(void); -extern struct resource ioport_resource; -extern struct resource iomem_resource; -extern char *prom_getcmdline(void); - -struct resource standard_io_resources[] = { -	{ -		.start	= 0x00, -		.end	= 0x1f, -		.name	= "dma1", -		.flags	= IORESOURCE_BUSY -	}, { -		.start	= 0x40, -		.end	= 0x5f, -		.name	= "timer", -		.flags	= IORESOURCE_BUSY -	}, { -		.start	= 0x80, -		.end	= 0x8f, -		.name	= "dma page reg", -		.flags	= IORESOURCE_BUSY -	}, { -		.start	= 0xc0, -		.end	= 0xdf, -		.name	= "dma2", -		.flags	= IORESOURCE_BUSY -	}, -}; - -#define STANDARD_IO_RESOURCES ARRAY_SIZE(standard_io_resources) - -extern struct resource pci_io_resource; -extern struct resource pci_mem_resource; - -/* Return the total size of DRAM-memory, (RANK0 + RANK1) */ -unsigned long get_system_mem_size(void) -{ -	/* Read IP2031_RANK0_ADDR_LO */ -	unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010); -	/* Read IP2031_RANK1_ADDR_HI */ -	unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018); - -	return dram_r1_hi - dram_r0_lo + 1; -} - -int pnx8550_console_port = -1; - -void __init plat_mem_setup(void) -{ -	int i; -	char* argptr; - -	board_setup();  /* board specific setup */ - -        _machine_restart = pnx8550_machine_restart; -        _machine_halt = pnx8550_machine_halt; -        pm_power_off = pnx8550_machine_halt; - -	/* Clear the Global 2 Register, PCI Inta Output Enable Registers -	   Bit 1:Enable DAC Powerdown -	  -> 0:DACs are enabled and are working normally -	     1:DACs are powerdown -	   Bit 0:Enable of PCI inta output -	  -> 0 = Disable PCI inta output -	     1 = Enable PCI inta output -	*/ -	PNX8550_GLB2_ENAB_INTA_O = 0; - -	/* IO/MEM resources. */ -	set_io_port_base(PNX8550_PORT_BASE); -	ioport_resource.start = 0; -	ioport_resource.end = ~0; -	iomem_resource.start = 0; -	iomem_resource.end = ~0; - -	/* Request I/O space for devices on this board */ -	for (i = 0; i < STANDARD_IO_RESOURCES; i++) -		request_resource(&ioport_resource, standard_io_resources + i); - -	/* Place the Mode Control bit for GPIO pin 16 in primary function */ -	/* Pin 16 is used by UART1, UA1_TX                                */ -	outl((PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_16_BIT) | -			(PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_17_BIT), -			PNX8550_GPIO_MC1); - -	argptr = prom_getcmdline(); -	if ((argptr = strstr(argptr, "console=ttyS")) != NULL) { -		argptr += strlen("console=ttyS"); -		pnx8550_console_port = *argptr == '0' ? 0 : 1; - -		/* We must initialize the UART (console) before early printk */ -		/* Set LCR to 8-bit and BAUD to 38400 (no 5)                */ -		ip3106_lcr(UART_BASE, pnx8550_console_port) = -			PNX8XXX_UART_LCR_8BIT; -		ip3106_baud(UART_BASE, pnx8550_console_port) = 5; -	} - -	return; -} diff --git a/arch/mips/pnx8550/common/time.c b/arch/mips/pnx8550/common/time.c deleted file mode 100644 index 8836c6203df..00000000000 --- a/arch/mips/pnx8550/common/time.c +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright 2001, 2002, 2003 MontaVista Software Inc. - * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net - * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org) - * - * Common time service routines for MIPS machines. See - * Documents/MIPS/README.txt. - * - * This program is free software; you can redistribute  it and/or modify it - * under  the terms of  the GNU General  Public License as published by the - * Free Software Foundation;  either version 2 of the  License, or (at your - * option) any later version. - */ -#include <linux/types.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/sched.h> -#include <linux/param.h> -#include <linux/time.h> -#include <linux/timer.h> -#include <linux/smp.h> -#include <linux/kernel_stat.h> -#include <linux/spinlock.h> -#include <linux/interrupt.h> - -#include <asm/bootinfo.h> -#include <asm/cpu.h> -#include <asm/time.h> -#include <asm/hardirq.h> -#include <asm/div64.h> -#include <asm/debug.h> - -#include <int.h> -#include <cm.h> - -static unsigned long cpj; - -static cycle_t hpt_read(struct clocksource *cs) -{ -	return read_c0_count2(); -} - -static struct clocksource pnx_clocksource = { -	.name		= "pnx8xxx", -	.rating		= 200, -	.read		= hpt_read, -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS, -}; - -static irqreturn_t pnx8xxx_timer_interrupt(int irq, void *dev_id) -{ -	struct clock_event_device *c = dev_id; - -	/* clear MATCH, signal the event */ -	c->event_handler(c); - -	return IRQ_HANDLED; -} - -static struct irqaction pnx8xxx_timer_irq = { -	.handler	= pnx8xxx_timer_interrupt, -	.flags		= IRQF_DISABLED | IRQF_PERCPU | IRQF_TIMER, -	.name		= "pnx8xxx_timer", -}; - -static irqreturn_t monotonic_interrupt(int irq, void *dev_id) -{ -	/* Timer 2 clear interrupt */ -	write_c0_compare2(-1); -	return IRQ_HANDLED; -} - -static struct irqaction monotonic_irqaction = { -	.handler = monotonic_interrupt, -	.flags = IRQF_DISABLED | IRQF_TIMER, -	.name = "Monotonic timer", -}; - -static int pnx8xxx_set_next_event(unsigned long delta, -				struct clock_event_device *evt) -{ -	write_c0_compare(delta); -	return 0; -} - -static struct clock_event_device pnx8xxx_clockevent = { -	.name		= "pnx8xxx_clockevent", -	.features	= CLOCK_EVT_FEAT_ONESHOT, -	.set_next_event = pnx8xxx_set_next_event, -}; - -static inline void timer_ack(void) -{ -	write_c0_compare(cpj); -} - -__init void plat_time_init(void) -{ -	unsigned int configPR; -	unsigned int n; -	unsigned int m; -	unsigned int p; -	unsigned int pow2p; - -	pnx8xxx_clockevent.cpumask = cpu_none_mask; -	clockevents_register_device(&pnx8xxx_clockevent); -	clocksource_register(&pnx_clocksource); - -	/* Timer 1 start */ -	configPR = read_c0_config7(); -	configPR &= ~0x00000008; -	write_c0_config7(configPR); - -	/* Timer 2 start */ -	configPR = read_c0_config7(); -	configPR &= ~0x00000010; -	write_c0_config7(configPR); - -	/* Timer 3 stop */ -	configPR = read_c0_config7(); -	configPR |= 0x00000020; -	write_c0_config7(configPR); - - -        /* PLL0 sets MIPS clock (PLL1 <=> TM1, PLL6 <=> TM2, PLL5 <=> mem) */ -        /* (but only if CLK_MIPS_CTL select value [bits 3:1] is 1:  FIXME) */ - -        n = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_N_MASK) >> 16; -        m = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_M_MASK) >> 8; -        p = (PNX8550_CM_PLL0_CTL & PNX8550_CM_PLL_P_MASK) >> 2; -	pow2p = (1 << p); - -	db_assert(m != 0 && pow2p != 0); - -        /* -	 * Compute the frequency as in the PNX8550 User Manual 1.0, p.186 -	 * (a.k.a. 8-10).  Divide by HZ for a timer offset that results in -	 * HZ timer interrupts per second. -	 */ -	mips_hpt_frequency = 27UL * ((1000000UL * n)/(m * pow2p)); -	cpj = DIV_ROUND_CLOSEST(mips_hpt_frequency, HZ); -	write_c0_count(0); -	timer_ack(); - -	/* Setup Timer 2 */ -	write_c0_count2(0); -	write_c0_compare2(0xffffffff); - -	setup_irq(PNX8550_INT_TIMER1, &pnx8xxx_timer_irq); -	setup_irq(PNX8550_INT_TIMER2, &monotonic_irqaction); -}  | 
