diff options
Diffstat (limited to 'arch/arm/mach-ixp4xx')
49 files changed, 1102 insertions, 734 deletions
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig index 6f991c5ae86..c342dc4e8a4 100644 --- a/arch/arm/mach-ixp4xx/Kconfig +++ b/arch/arm/mach-ixp4xx/Kconfig @@ -1,9 +1,5 @@  if ARCH_IXP4XX -config ARCH_SUPPORTS_BIG_ENDIAN -	bool -	default y -  menu "Intel IXP4xx Implementation Options"  comment "IXP4xx Platforms" @@ -179,6 +175,25 @@ config MACH_GTWX5715  		"High Speed" UART is n/c (as far as I can tell)  		20 Pin ARM/Xscale JTAG interface on J2 +config MACH_DEVIXP +	bool "Omicron DEVIXP" +	help +	  Say 'Y' here if you want your kernel to support the DEVIXP +	  board from OMICRON electronics GmbH. + +config MACH_MICCPT +	bool "Omicron MICCPT" +	select PCI +	help +	  Say 'Y' here if you want your kernel to support the MICCPT +	  board from OMICRON electronics GmbH. + +config MACH_MIC256 +	bool "Omicron MIC256" +	help +	  Say 'Y' here if you want your kernel to support the MIC256 +	  board from OMICRON electronics GmbH. +  comment "IXP4xx Options"  config IXP4XX_INDIRECT_PCI @@ -215,7 +230,6 @@ config IXP4XX_QMGR  config IXP4XX_NPE  	tristate "IXP4xx Network Processor Engine support" -	select HOTPLUG  	select FW_LOADER  	help  	  This driver supports IXP4xx built-in network coprocessors diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile index d807fc367dd..eded94c96dd 100644 --- a/arch/arm/mach-ixp4xx/Makefile +++ b/arch/arm/mach-ixp4xx/Makefile @@ -10,6 +10,7 @@ obj-pci-$(CONFIG_MACH_AVILA)		+= avila-pci.o  obj-pci-$(CONFIG_MACH_IXDPG425)		+= ixdpg425-pci.o  obj-pci-$(CONFIG_ARCH_ADI_COYOTE)	+= coyote-pci.o  obj-pci-$(CONFIG_MACH_GTWX5715)		+= gtwx5715-pci.o +obj-pci-$(CONFIG_MACH_MICCPT)		+= miccpt-pci.o  obj-pci-$(CONFIG_MACH_NSLU2)		+= nslu2-pci.o  obj-pci-$(CONFIG_MACH_NAS100D)		+= nas100d-pci.o  obj-pci-$(CONFIG_MACH_DSMG600)		+= dsmg600-pci.o @@ -25,6 +26,9 @@ obj-$(CONFIG_MACH_AVILA)	+= avila-setup.o  obj-$(CONFIG_MACH_IXDPG425)	+= coyote-setup.o  obj-$(CONFIG_ARCH_ADI_COYOTE)	+= coyote-setup.o  obj-$(CONFIG_MACH_GTWX5715)	+= gtwx5715-setup.o +obj-$(CONFIG_MACH_DEVIXP)	+= omixp-setup.o +obj-$(CONFIG_MACH_MICCPT)	+= omixp-setup.o +obj-$(CONFIG_MACH_MIC256)	+= omixp-setup.o  obj-$(CONFIG_MACH_NSLU2)	+= nslu2-setup.o  obj-$(CONFIG_MACH_NAS100D)	+= nas100d-setup.o  obj-$(CONFIG_MACH_DSMG600)      += dsmg600-setup.o diff --git a/arch/arm/mach-ixp4xx/Makefile.boot b/arch/arm/mach-ixp4xx/Makefile.boot index d84c5807a43..9c7af91d93d 100644 --- a/arch/arm/mach-ixp4xx/Makefile.boot +++ b/arch/arm/mach-ixp4xx/Makefile.boot @@ -1,3 +1,3 @@ -   zreladdr-y	:= 0x00008000 +   zreladdr-y	+= 0x00008000  params_phys-y	:= 0x00000100 diff --git a/arch/arm/mach-ixp4xx/avila-pci.c b/arch/arm/mach-ixp4xx/avila-pci.c index 845e1b50054..548c7d43ade 100644 --- a/arch/arm/mach-ixp4xx/avila-pci.c +++ b/arch/arm/mach-ixp4xx/avila-pci.c @@ -39,14 +39,14 @@  void __init avila_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init avila_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[IRQ_LINES] = {  		IXP4XX_GPIO_IRQ(INTA), @@ -65,10 +65,9 @@ static int __init avila_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci avila_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= avila_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= avila_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/avila-setup.c b/arch/arm/mach-ixp4xx/avila-setup.c index 73745ff102d..6beec150c06 100644 --- a/arch/arm/mach-ixp4xx/avila-setup.c +++ b/arch/arm/mach-ixp4xx/avila-setup.c @@ -165,10 +165,15 @@ static void __init avila_init(void)  MACHINE_START(AVILA, "Gateworks Avila Network Platform")  	/* Maintainer: Deepak Saxena <dsaxena@plexity.net> */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= avila_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END   /* @@ -180,10 +185,15 @@ MACHINE_END  MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")  	/* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= avila_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END  #endif diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 24498a932ba..4977296f0c7 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c @@ -26,12 +26,12 @@  #include <linux/delay.h>  #include <linux/device.h>  #include <linux/io.h> +#include <linux/export.h>  #include <asm/dma-mapping.h>  #include <asm/cputype.h>  #include <asm/irq.h>  #include <asm/sizes.h> -#include <asm/system.h>  #include <asm/mach/pci.h>  #include <mach/hardware.h> @@ -54,7 +54,7 @@ unsigned long ixp4xx_pci_reg_base = 0;   * these transactions are atomic or we will end up   * with corrupt data on the bus or in a driver.   */ -static DEFINE_SPINLOCK(ixp4xx_pci_lock); +static DEFINE_RAW_SPINLOCK(ixp4xx_pci_lock);  /*   * Read from PCI config space @@ -62,10 +62,10 @@ static DEFINE_SPINLOCK(ixp4xx_pci_lock);  static void crp_read(u32 ad_cbe, u32 *data)  {  	unsigned long flags; -	spin_lock_irqsave(&ixp4xx_pci_lock, flags); +	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);  	*PCI_CRP_AD_CBE = ad_cbe;  	*data = *PCI_CRP_RDATA; -	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); +	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);  }  /* @@ -74,10 +74,10 @@ static void crp_read(u32 ad_cbe, u32 *data)  static void crp_write(u32 ad_cbe, u32 data)  {   	unsigned long flags; -	spin_lock_irqsave(&ixp4xx_pci_lock, flags); +	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);  	*PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;  	*PCI_CRP_WDATA = data; -	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); +	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);  }  static inline int check_master_abort(void) @@ -101,7 +101,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)  	int retval = 0;  	int i; -	spin_lock_irqsave(&ixp4xx_pci_lock, flags); +	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);  	*PCI_NP_AD = addr; @@ -118,7 +118,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)  	if(check_master_abort())  		retval = 1; -	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); +	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);  	return retval;  } @@ -127,7 +127,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)  	unsigned long flags;  	int retval = 0; -	spin_lock_irqsave(&ixp4xx_pci_lock, flags); +	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);  	*PCI_NP_AD = addr; @@ -140,7 +140,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)  	if(check_master_abort())  		retval = 1; -	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); +	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);  	return retval;  } @@ -149,7 +149,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)  	unsigned long flags;  	int retval = 0; -	spin_lock_irqsave(&ixp4xx_pci_lock, flags); +	raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);  	*PCI_NP_AD = addr; @@ -162,7 +162,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)  	if(check_master_abort())  		retval = 1; -	spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); +	raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);  	return retval;  } @@ -315,60 +315,15 @@ static int abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *r  	return 0;  } - -/* - * Setup DMA mask to 64MB on PCI devices. Ignore all other devices. - */ -static int ixp4xx_pci_platform_notify(struct device *dev) -{ -	if(dev->bus == &pci_bus_type) { -		*dev->dma_mask =  SZ_64M - 1; -		dev->coherent_dma_mask = SZ_64M - 1; -		dmabounce_register_dev(dev, 2048, 4096); -	} -	return 0; -} - -static int ixp4xx_pci_platform_notify_remove(struct device *dev) -{ -	if(dev->bus == &pci_bus_type) { -		dmabounce_unregister_dev(dev); -	} -	return 0; -} - -int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) -{ -	return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M); -} - -/* - * Only first 64MB of memory can be accessed via PCI. - * We use GFP_DMA to allocate safe buffers to do map/unmap. - * This is really ugly and we need a better way of specifying - * DMA-capable regions of memory. - */ -void __init ixp4xx_adjust_zones(unsigned long *zone_size, -	unsigned long *zhole_size) -{ -	unsigned int sz = SZ_64M >> PAGE_SHIFT; - -	/* -	 * Only adjust if > 64M on current system -	 */ -	if (zone_size[0] <= sz) -		return; - -	zone_size[1] = zone_size[0] - sz; -	zone_size[0] = sz; -	zhole_size[1] = zhole_size[0]; -	zhole_size[0] = 0; -} -  void __init ixp4xx_pci_preinit(void)  {  	unsigned long cpuid = read_cpuid_id(); +#ifdef CONFIG_IXP4XX_INDIRECT_PCI +	pcibios_min_mem = 0x10000000; /* 1 GB of indirect PCI MMIO space */ +#else +	pcibios_min_mem = 0x48000000; /* 64 MB of PCI MMIO space */ +#endif  	/*  	 * Determine which PCI read method to use.  	 * Rev 0 IXP425 requires workaround. @@ -415,7 +370,8 @@ void __init ixp4xx_pci_preinit(void)  		local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET);  		local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + SZ_16M);  		local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + SZ_32M); -		local_write_config(PCI_BASE_ADDRESS_3, 4, PHYS_OFFSET + SZ_48M); +		local_write_config(PCI_BASE_ADDRESS_3, 4, +					PHYS_OFFSET + SZ_32M + SZ_16M);  		/*  		 * Enable CSR window at 64 MiB to allow PCI masters @@ -427,6 +383,7 @@ void __init ixp4xx_pci_preinit(void)  		 * Enable the IO window to be way up high, at 0xfffffc00  		 */  		local_write_config(PCI_BASE_ADDRESS_5, 4, 0xfffffc01); +		local_write_config(0x40, 4, 0x000080FF); /* No TRDY time limit */  	} else {  		printk("PCI: IXP4xx is target - No bus scan performed\n");  	} @@ -488,29 +445,11 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)  	request_resource(&ioport_resource, &res[0]);  	request_resource(&iomem_resource, &res[1]); -	sys->resource[0] = &res[0]; -	sys->resource[1] = &res[1]; -	sys->resource[2] = NULL; - -	platform_notify = ixp4xx_pci_platform_notify; -	platform_notify_remove = ixp4xx_pci_platform_notify_remove; +	pci_add_resource_offset(&sys->resources, &res[0], sys->io_offset); +	pci_add_resource_offset(&sys->resources, &res[1], sys->mem_offset);  	return 1;  } -struct pci_bus * __devinit ixp4xx_scan_bus(int nr, struct pci_sys_data *sys) -{ -	return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys); -} - -int dma_set_coherent_mask(struct device *dev, u64 mask) -{ -	if (mask >= SZ_64M - 1) -		return 0; - -	return -EIO; -} -  EXPORT_SYMBOL(ixp4xx_pci_read);  EXPORT_SYMBOL(ixp4xx_pci_write); - diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index 0bce09799d1..fc4b7b24265 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c @@ -17,29 +17,43 @@  #include <linux/mm.h>  #include <linux/init.h>  #include <linux/serial.h> -#include <linux/sched.h>  #include <linux/tty.h>  #include <linux/platform_device.h>  #include <linux/serial_core.h>  #include <linux/interrupt.h>  #include <linux/bitops.h>  #include <linux/time.h> -#include <linux/timex.h>  #include <linux/clocksource.h>  #include <linux/clockchips.h>  #include <linux/io.h> - +#include <linux/export.h> +#include <linux/gpio.h> +#include <linux/cpu.h> +#include <linux/pci.h> +#include <linux/sched_clock.h>  #include <mach/udc.h>  #include <mach/hardware.h> +#include <mach/io.h>  #include <asm/uaccess.h>  #include <asm/pgtable.h>  #include <asm/page.h>  #include <asm/irq.h> - +#include <asm/system_misc.h>  #include <asm/mach/map.h>  #include <asm/mach/irq.h>  #include <asm/mach/time.h> +#define IXP4XX_TIMER_FREQ 66666000 + +/* + * The timer register doesn't allow to specify the two least significant bits of + * the timeout value and assumes them being zero. So make sure IXP4XX_LATCH is + * the best value with the two least significant bits unset. + */ +#define IXP4XX_LATCH DIV_ROUND_CLOSEST(IXP4XX_TIMER_FREQ, \ +				       (IXP4XX_OST_RELOAD_MASK + 1) * HZ) * \ +			(IXP4XX_OST_RELOAD_MASK + 1) +  static void __init ixp4xx_clocksource_init(void);  static void __init ixp4xx_clockevent_init(void);  static struct clock_event_device clockevent_ixp4xx; @@ -49,29 +63,26 @@ static struct clock_event_device clockevent_ixp4xx;   *************************************************************************/  static struct map_desc ixp4xx_io_desc[] __initdata = {  	{	/* UART, Interrupt ctrl, GPIO, timers, NPEs, MACs, USB .... */ -		.virtual	= IXP4XX_PERIPHERAL_BASE_VIRT, +		.virtual	= (unsigned long)IXP4XX_PERIPHERAL_BASE_VIRT,  		.pfn		= __phys_to_pfn(IXP4XX_PERIPHERAL_BASE_PHYS),  		.length		= IXP4XX_PERIPHERAL_REGION_SIZE,  		.type		= MT_DEVICE  	}, {	/* Expansion Bus Config Registers */ -		.virtual	= IXP4XX_EXP_CFG_BASE_VIRT, +		.virtual	= (unsigned long)IXP4XX_EXP_CFG_BASE_VIRT,  		.pfn		= __phys_to_pfn(IXP4XX_EXP_CFG_BASE_PHYS),  		.length		= IXP4XX_EXP_CFG_REGION_SIZE,  		.type		= MT_DEVICE  	}, {	/* PCI Registers */ -		.virtual	= IXP4XX_PCI_CFG_BASE_VIRT, +		.virtual	= (unsigned long)IXP4XX_PCI_CFG_BASE_VIRT,  		.pfn		= __phys_to_pfn(IXP4XX_PCI_CFG_BASE_PHYS),  		.length		= IXP4XX_PCI_CFG_REGION_SIZE,  		.type		= MT_DEVICE -	}, -#ifdef CONFIG_DEBUG_LL -	{	/* Debug UART mapping */ -		.virtual	= IXP4XX_DEBUG_UART_BASE_VIRT, -		.pfn		= __phys_to_pfn(IXP4XX_DEBUG_UART_BASE_PHYS), -		.length		= IXP4XX_DEBUG_UART_REGION_SIZE, +	}, {	/* Queue Manager */ +		.virtual	= (unsigned long)IXP4XX_QMGR_BASE_VIRT, +		.pfn		= __phys_to_pfn(IXP4XX_QMGR_BASE_PHYS), +		.length		= IXP4XX_QMGR_REGION_SIZE,  		.type		= MT_DEVICE -	} -#endif +	},  };  void __init ixp4xx_map_io(void) @@ -79,6 +90,44 @@ void __init ixp4xx_map_io(void)    	iotable_init(ixp4xx_io_desc, ARRAY_SIZE(ixp4xx_io_desc));  } +/* + * GPIO-functions + */ +/* + * The following converted to the real HW bits the gpio_line_config + */ +/* GPIO pin types */ +#define IXP4XX_GPIO_OUT 		0x1 +#define IXP4XX_GPIO_IN  		0x2 + +/* GPIO signal types */ +#define IXP4XX_GPIO_LOW			0 +#define IXP4XX_GPIO_HIGH		1 + +/* GPIO Clocks */ +#define IXP4XX_GPIO_CLK_0		14 +#define IXP4XX_GPIO_CLK_1		15 + +static void gpio_line_config(u8 line, u32 direction) +{ +	if (direction == IXP4XX_GPIO_IN) +		*IXP4XX_GPIO_GPOER |= (1 << line); +	else +		*IXP4XX_GPIO_GPOER &= ~(1 << line); +} + +static void gpio_line_get(u8 line, int *value) +{ +	*value = (*IXP4XX_GPIO_GPINR >> line) & 0x1; +} + +static void gpio_line_set(u8 line, int value) +{ +	if (value == IXP4XX_GPIO_HIGH) +	    *IXP4XX_GPIO_GPOUTR |= (1 << line); +	else if (value == IXP4XX_GPIO_LOW) +	    *IXP4XX_GPIO_GPOUTR &= ~(1 << line); +}  /*************************************************************************   * IXP4xx chipset IRQ handling @@ -104,7 +153,7 @@ static signed char irq2gpio[32] = {  	 7,  8,  9, 10, 11, 12, -1, -1,  }; -int gpio_to_irq(int gpio) +static int ixp4xx_gpio_to_irq(struct gpio_chip *chip, unsigned gpio)  {  	int irq; @@ -114,22 +163,10 @@ int gpio_to_irq(int gpio)  	}  	return -EINVAL;  } -EXPORT_SYMBOL(gpio_to_irq); - -int irq_to_gpio(unsigned int irq) -{ -	int gpio = (irq < 32) ? irq2gpio[irq] : -EINVAL; - -	if (gpio == -1) -		return -EINVAL; - -	return gpio; -} -EXPORT_SYMBOL(irq_to_gpio); -static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type) +static int ixp4xx_set_irq_type(struct irq_data *d, unsigned int type)  { -	int line = irq2gpio[irq]; +	int line = irq2gpio[d->irq];  	u32 int_style;  	enum ixp4xx_irq_type irq_type;  	volatile u32 *int_reg; @@ -166,9 +203,9 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)  	}  	if (irq_type == IXP4XX_IRQ_EDGE) -		ixp4xx_irq_edge |= (1 << irq); +		ixp4xx_irq_edge |= (1 << d->irq);  	else -		ixp4xx_irq_edge &= ~(1 << irq); +		ixp4xx_irq_edge &= ~(1 << d->irq);  	if (line >= 8) {	/* pins 8-15 */  		line -= 8; @@ -187,22 +224,22 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)  	*int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));  	/* Configure the line as an input */ -	gpio_line_config(irq2gpio[irq], IXP4XX_GPIO_IN); +	gpio_line_config(irq2gpio[d->irq], IXP4XX_GPIO_IN);  	return 0;  } -static void ixp4xx_irq_mask(unsigned int irq) +static void ixp4xx_irq_mask(struct irq_data *d)  { -	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) -		*IXP4XX_ICMR2 &= ~(1 << (irq - 32)); +	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32) +		*IXP4XX_ICMR2 &= ~(1 << (d->irq - 32));  	else -		*IXP4XX_ICMR &= ~(1 << irq); +		*IXP4XX_ICMR &= ~(1 << d->irq);  } -static void ixp4xx_irq_ack(unsigned int irq) +static void ixp4xx_irq_ack(struct irq_data *d)  { -	int line = (irq < 32) ? irq2gpio[irq] : -1; +	int line = (d->irq < 32) ? irq2gpio[d->irq] : -1;  	if (line >= 0)  		*IXP4XX_GPIO_GPISR = (1 << line); @@ -212,29 +249,35 @@ static void ixp4xx_irq_ack(unsigned int irq)   * Level triggered interrupts on GPIO lines can only be cleared when the   * interrupt condition disappears.   */ -static void ixp4xx_irq_unmask(unsigned int irq) +static void ixp4xx_irq_unmask(struct irq_data *d)  { -	if (!(ixp4xx_irq_edge & (1 << irq))) -		ixp4xx_irq_ack(irq); +	if (!(ixp4xx_irq_edge & (1 << d->irq))) +		ixp4xx_irq_ack(d); -	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) -		*IXP4XX_ICMR2 |= (1 << (irq - 32)); +	if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && d->irq >= 32) +		*IXP4XX_ICMR2 |= (1 << (d->irq - 32));  	else -		*IXP4XX_ICMR |= (1 << irq); +		*IXP4XX_ICMR |= (1 << d->irq);  }  static struct irq_chip ixp4xx_irq_chip = {  	.name		= "IXP4xx", -	.ack		= ixp4xx_irq_ack, -	.mask		= ixp4xx_irq_mask, -	.unmask		= ixp4xx_irq_unmask, -	.set_type	= ixp4xx_set_irq_type, +	.irq_ack	= ixp4xx_irq_ack, +	.irq_mask	= ixp4xx_irq_mask, +	.irq_unmask	= ixp4xx_irq_unmask, +	.irq_set_type	= ixp4xx_set_irq_type,  };  void __init ixp4xx_init_irq(void)  {  	int i = 0; +	/* +	 * ixp4xx does not implement the XScale PWRMODE register +	 * so it must not call cpu_do_idle(). +	 */ +	cpu_idle_poll_ctrl(true); +  	/* Route all sources to IRQ instead of FIQ */  	*IXP4XX_ICLR = 0x0; @@ -251,8 +294,8 @@ void __init ixp4xx_init_irq(void)          /* Default to all level triggered */  	for(i = 0; i < NR_IRQS; i++) { -		set_irq_chip(i, &ixp4xx_irq_chip); -		set_irq_handler(i, handle_level_irq); +		irq_set_chip_and_handler(i, &ixp4xx_irq_chip, +					 handle_level_irq);  		set_irq_flags(i, IRQF_VALID);  	}  } @@ -278,7 +321,7 @@ static irqreturn_t ixp4xx_timer_interrupt(int irq, void *dev_id)  static struct irqaction ixp4xx_timer_irq = {  	.name		= "timer1", -	.flags		= IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL, +	.flags		= IRQF_TIMER | IRQF_IRQPOLL,  	.handler	= ixp4xx_timer_interrupt,  	.dev_id		= &clockevent_ixp4xx,  }; @@ -301,10 +344,6 @@ void __init ixp4xx_timer_init(void)  	ixp4xx_clockevent_init();  } -struct sys_timer ixp4xx_timer = { -	.init		= ixp4xx_timer_init, -}; -  static struct pxa2xx_udc_mach_info ixp4xx_udc_info;  void __init ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info) @@ -374,12 +413,56 @@ static struct platform_device *ixp46x_devices[] __initdata = {  unsigned long ixp4xx_exp_bus_size;  EXPORT_SYMBOL(ixp4xx_exp_bus_size); +static int ixp4xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) +{ +	gpio_line_config(gpio, IXP4XX_GPIO_IN); + +	return 0; +} + +static int ixp4xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, +					int level) +{ +	gpio_line_set(gpio, level); +	gpio_line_config(gpio, IXP4XX_GPIO_OUT); + +	return 0; +} + +static int ixp4xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio) +{ +	int value; + +	gpio_line_get(gpio, &value); + +	return value; +} + +static void ixp4xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, +				  int value) +{ +	gpio_line_set(gpio, value); +} + +static struct gpio_chip ixp4xx_gpio_chip = { +	.label			= "IXP4XX_GPIO_CHIP", +	.direction_input	= ixp4xx_gpio_direction_input, +	.direction_output	= ixp4xx_gpio_direction_output, +	.get			= ixp4xx_gpio_get_value, +	.set			= ixp4xx_gpio_set_value, +	.to_irq			= ixp4xx_gpio_to_irq, +	.base			= 0, +	.ngpio			= 16, +}; +  void __init ixp4xx_sys_init(void)  {  	ixp4xx_exp_bus_size = SZ_16M;  	platform_add_devices(ixp4xx_devices, ARRAY_SIZE(ixp4xx_devices)); +	gpiochip_add(&ixp4xx_gpio_chip); +  	if (cpu_is_ixp46x()) {  		int region; @@ -399,41 +482,30 @@ void __init ixp4xx_sys_init(void)  }  /* - * clocksource + * sched_clock()   */ -static cycle_t ixp4xx_get_cycles(struct clocksource *cs) +static u64 notrace ixp4xx_read_sched_clock(void)  {  	return *IXP4XX_OSTS;  } -static struct clocksource clocksource_ixp4xx = { -	.name 		= "OSTS", -	.rating		= 200, -	.read		= ixp4xx_get_cycles, -	.mask		= CLOCKSOURCE_MASK(32), -	.shift 		= 20, -	.flags		= CLOCK_SOURCE_IS_CONTINUOUS, -}; +/* + * clocksource + */ -unsigned long ixp4xx_timer_freq = FREQ; -EXPORT_SYMBOL(ixp4xx_timer_freq); -static void __init ixp4xx_clocksource_init(void) +static cycle_t ixp4xx_clocksource_read(struct clocksource *c)  { -	clocksource_ixp4xx.mult = -		clocksource_hz2mult(ixp4xx_timer_freq, -				    clocksource_ixp4xx.shift); -	clocksource_register(&clocksource_ixp4xx); +	return *IXP4XX_OSTS;  } -/* - * sched_clock() - */ -unsigned long long sched_clock(void) +unsigned long ixp4xx_timer_freq = IXP4XX_TIMER_FREQ; +EXPORT_SYMBOL(ixp4xx_timer_freq); +static void __init ixp4xx_clocksource_init(void)  { -	cycle_t cyc = ixp4xx_get_cycles(NULL); -	struct clocksource *cs = &clocksource_ixp4xx; +	sched_clock_register(ixp4xx_read_sched_clock, 32, ixp4xx_timer_freq); -	return clocksource_cyc2ns(cyc, cs->mult, cs->shift); +	clocksource_mmio_init(NULL, "OSTS", ixp4xx_timer_freq, 200, 32, +			ixp4xx_clocksource_read);  }  /* @@ -457,7 +529,7 @@ static void ixp4xx_set_mode(enum clock_event_mode mode,  	switch (mode) {  	case CLOCK_EVT_MODE_PERIODIC: -		osrt = LATCH & ~IXP4XX_OST_RELOAD_MASK; +		osrt = IXP4XX_LATCH & ~IXP4XX_OST_RELOAD_MASK;   		opts = IXP4XX_OST_ENABLE;  		break;  	case CLOCK_EVT_MODE_ONESHOT: @@ -484,20 +556,117 @@ static struct clock_event_device clockevent_ixp4xx = {  	.name		= "ixp4xx timer1",  	.features       = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,  	.rating         = 200, -	.shift		= 24,  	.set_mode	= ixp4xx_set_mode,  	.set_next_event	= ixp4xx_set_next_event,  };  static void __init ixp4xx_clockevent_init(void)  { -	clockevent_ixp4xx.mult = div_sc(FREQ, NSEC_PER_SEC, -					clockevent_ixp4xx.shift); -	clockevent_ixp4xx.max_delta_ns = -		clockevent_delta2ns(0xfffffffe, &clockevent_ixp4xx); -	clockevent_ixp4xx.min_delta_ns = -		clockevent_delta2ns(0xf, &clockevent_ixp4xx);  	clockevent_ixp4xx.cpumask = cpumask_of(0); +	clockevents_config_and_register(&clockevent_ixp4xx, IXP4XX_TIMER_FREQ, +					0xf, 0xfffffffe); +} + +void ixp4xx_restart(enum reboot_mode mode, const char *cmd) +{ +	if (mode == REBOOT_SOFT) { +		/* Jump into ROM at address 0 */ +		soft_restart(0); +	} else { +		/* Use on-chip reset capability */ -	clockevents_register_device(&clockevent_ixp4xx); +		/* set the "key" register to enable access to +		 * "timer" and "enable" registers +		 */ +		*IXP4XX_OSWK = IXP4XX_WDT_KEY; + +		/* write 0 to the timer register for an immediate reset */ +		*IXP4XX_OSWT = 0; + +		*IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; +	} +} + +#ifdef CONFIG_PCI +static int ixp4xx_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) +{ +	return (dma_addr + size) > SZ_64M; +} + +static int ixp4xx_platform_notify_remove(struct device *dev) +{ +	if (dev_is_pci(dev)) +		dmabounce_unregister_dev(dev); + +	return 0; +} +#endif + +/* + * Setup DMA mask to 64MB on PCI devices and 4 GB on all other things. + */ +static int ixp4xx_platform_notify(struct device *dev) +{ +	dev->dma_mask = &dev->coherent_dma_mask; + +#ifdef CONFIG_PCI +	if (dev_is_pci(dev)) { +		dev->coherent_dma_mask = DMA_BIT_MASK(28); /* 64 MB */ +		dmabounce_register_dev(dev, 2048, 4096, ixp4xx_needs_bounce); +		return 0; +	} +#endif + +	dev->coherent_dma_mask = DMA_BIT_MASK(32); +	return 0; +} + +int dma_set_coherent_mask(struct device *dev, u64 mask) +{ +	if (dev_is_pci(dev)) +		mask &= DMA_BIT_MASK(28); /* 64 MB */ + +	if ((mask & DMA_BIT_MASK(28)) == DMA_BIT_MASK(28)) { +		dev->coherent_dma_mask = mask; +		return 0; +	} + +	return -EIO;		/* device wanted sub-64MB mask */ +} +EXPORT_SYMBOL(dma_set_coherent_mask); + +#ifdef CONFIG_IXP4XX_INDIRECT_PCI +/* + * In the case of using indirect PCI, we simply return the actual PCI + * address and our read/write implementation use that to drive the + * access registers. If something outside of PCI is ioremap'd, we + * fallback to the default. + */ + +static void __iomem *ixp4xx_ioremap_caller(phys_addr_t addr, size_t size, +					   unsigned int mtype, void *caller) +{ +	if (!is_pci_memory(addr)) +		return __arm_ioremap_caller(addr, size, mtype, caller); + +	return (void __iomem *)addr; +} + +static void ixp4xx_iounmap(void __iomem *addr) +{ +	if (!is_pci_memory((__force u32)addr)) +		__iounmap(addr); +} +#endif + +void __init ixp4xx_init_early(void) +{ +	platform_notify = ixp4xx_platform_notify; +#ifdef CONFIG_PCI +	platform_notify_remove = ixp4xx_platform_notify_remove; +#endif +#ifdef CONFIG_IXP4XX_INDIRECT_PCI +	arch_ioremap_caller = ixp4xx_ioremap_caller; +	arch_iounmap = ixp4xx_iounmap; +#endif  } diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c index b978ea8bd6f..5d14ce2aee6 100644 --- a/arch/arm/mach-ixp4xx/coyote-pci.c +++ b/arch/arm/mach-ixp4xx/coyote-pci.c @@ -32,12 +32,12 @@  void __init coyote_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT0_INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(SLOT1_INTA), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init coyote_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	if (slot == SLOT0_DEVID)  		return IXP4XX_GPIO_IRQ(SLOT0_INTA); @@ -48,10 +48,9 @@ static int __init coyote_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci coyote_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit =        coyote_pci_preinit, -	.swizzle =        pci_std_swizzle,  	.setup =          ixp4xx_setup, -	.scan =           ixp4xx_scan_bus,  	.map_irq =        coyote_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c index 355e3de3873..820cae8608f 100644 --- a/arch/arm/mach-ixp4xx/coyote-setup.c +++ b/arch/arm/mach-ixp4xx/coyote-setup.c @@ -110,10 +110,15 @@ static void __init coyote_init(void)  MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= coyote_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END  #endif @@ -125,10 +130,12 @@ MACHINE_END  MACHINE_START(IXDPG425, "Intel IXDPG425")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= coyote_init, +	.restart	= ixp4xx_restart,  MACHINE_END  #endif diff --git a/arch/arm/mach-ixp4xx/dsmg600-pci.c b/arch/arm/mach-ixp4xx/dsmg600-pci.c index fa70fed462b..8dca7693772 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-pci.c +++ b/arch/arm/mach-ixp4xx/dsmg600-pci.c @@ -35,16 +35,16 @@  void __init dsmg600_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTF), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTF), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init dsmg600_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[MAX_DEV][IRQ_LINES] = {  		{ IXP4XX_GPIO_IRQ(INTE), -1, -1 }, @@ -62,10 +62,9 @@ static int __init dsmg600_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci __initdata dsmg600_pci = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= dsmg600_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= dsmg600_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c index d398229cfaa..43ee06d3abe 100644 --- a/arch/arm/mach-ixp4xx/dsmg600-setup.c +++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c @@ -16,7 +16,7 @@   * Author: Rod Whitby <rod@whitby.id.au>   * Maintainers: http://www.nslu2-linux.org/   */ - +#include <linux/gpio.h>  #include <linux/irq.h>  #include <linux/jiffies.h>  #include <linux/timer.h> @@ -26,12 +26,14 @@  #include <linux/reboot.h>  #include <linux/i2c.h>  #include <linux/i2c-gpio.h> +#include <linux/gpio.h> + +#include <mach/hardware.h>  #include <asm/mach-types.h>  #include <asm/mach/arch.h>  #include <asm/mach/flash.h>  #include <asm/mach/time.h> -#include <asm/gpio.h>  #define DSMG600_SDA_PIN		5  #define DSMG600_SCL_PIN		4 @@ -160,11 +162,8 @@ static struct platform_device *dsmg600_devices[] __initdata = {  static void dsmg600_power_off(void)  { -	/* enable the pwr cntl gpio */ -	gpio_line_config(DSMG600_PO_GPIO, IXP4XX_GPIO_OUT); - -	/* poweroff */ -	gpio_line_set(DSMG600_PO_GPIO, IXP4XX_GPIO_HIGH); +	/* enable the pwr cntl and drive it high */ +	gpio_direction_output(DSMG600_PO_GPIO, 1);  }  /* This is used to make sure the power-button pusher is serious.  The button @@ -201,7 +200,7 @@ static void dsmg600_power_handler(unsigned long data)  			ctrl_alt_del();  			/* Change the state of the power LED to "blink" */ -			gpio_line_set(DSMG600_LED_PWR_GPIO, IXP4XX_GPIO_LOW); +			gpio_set_value(DSMG600_LED_PWR_GPIO, 0);  		} else {  			power_button_countdown = PBUTTON_HOLDDOWN_COUNT;  		} @@ -227,9 +226,38 @@ static void __init dsmg600_timer_init(void)      ixp4xx_timer_init();  } -static struct sys_timer dsmg600_timer = { -    .init   = dsmg600_timer_init, -}; +static int __init dsmg600_gpio_init(void) +{ +	if (!machine_is_dsmg600()) +		return 0; + +	gpio_request(DSMG600_RB_GPIO, "reset button"); +	if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, +		IRQF_TRIGGER_LOW, "DSM-G600 reset button", NULL) < 0) { + +		printk(KERN_DEBUG "Reset Button IRQ %d not available\n", +			gpio_to_irq(DSMG600_RB_GPIO)); +	} + +	/* +	 * The power button on the D-Link DSM-G600 is on GPIO 15, but +	 * it cannot handle interrupts on that GPIO line.  So we'll +	 * have to poll it with a kernel timer. +	 */ + +	/* Make sure that the power button GPIO is set up as an input */ +	gpio_request(DSMG600_PB_GPIO, "power button"); +	gpio_direction_input(DSMG600_PB_GPIO); +	/* Request poweroff GPIO line */ +	gpio_request(DSMG600_PO_GPIO, "power off button"); + +	/* Set the initial value for the power button IRQ handler */ +	power_button_countdown = PBUTTON_HOLDDOWN_COUNT; + +	mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500)); +	return 0; +} +device_initcall(dsmg600_gpio_init);  static void __init dsmg600_init(void)  { @@ -254,34 +282,18 @@ static void __init dsmg600_init(void)  	platform_add_devices(dsmg600_devices, ARRAY_SIZE(dsmg600_devices));  	pm_power_off = dsmg600_power_off; - -	if (request_irq(gpio_to_irq(DSMG600_RB_GPIO), &dsmg600_reset_handler, -		IRQF_DISABLED | IRQF_TRIGGER_LOW, -		"DSM-G600 reset button", NULL) < 0) { - -		printk(KERN_DEBUG "Reset Button IRQ %d not available\n", -			gpio_to_irq(DSMG600_RB_GPIO)); -	} - -	/* The power button on the D-Link DSM-G600 is on GPIO 15, but -	 * it cannot handle interrupts on that GPIO line.  So we'll -	 * have to poll it with a kernel timer. -	 */ - -	/* Make sure that the power button GPIO is set up as an input */ -	gpio_line_config(DSMG600_PB_GPIO, IXP4XX_GPIO_IN); - -	/* Set the initial value for the power button IRQ handler */ -	power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - -	mod_timer(&dsmg600_power_timer, jiffies + msecs_to_jiffies(500));  }  MACHINE_START(DSMG600, "D-Link DSM-G600 RevA")  	/* Maintainer: www.nslu2-linux.org */ -	.boot_params	= 0x00000100, +	.atag_offset	= 0x100,  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer          = &dsmg600_timer, +	.init_time	= dsmg600_timer_init,  	.init_machine	= dsmg600_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/fsg-pci.c b/arch/arm/mach-ixp4xx/fsg-pci.c index 5a810c93062..fd4a8625b4a 100644 --- a/arch/arm/mach-ixp4xx/fsg-pci.c +++ b/arch/arm/mach-ixp4xx/fsg-pci.c @@ -32,13 +32,13 @@  void __init fsg_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init fsg_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[IRQ_LINES] = {  		IXP4XX_GPIO_IRQ(INTC), @@ -59,10 +59,9 @@ static int __init fsg_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci fsg_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit =	  fsg_pci_preinit, -	.swizzle =	  pci_std_swizzle,  	.setup =	  ixp4xx_setup, -	.scan =		  ixp4xx_scan_bus,  	.map_irq =	  fsg_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c index 727ee39ce11..5c4b0c4a1b3 100644 --- a/arch/arm/mach-ixp4xx/fsg-setup.c +++ b/arch/arm/mach-ixp4xx/fsg-setup.c @@ -14,7 +14,7 @@   * Maintainers: http://www.nslu2-linux.org/   *   */ - +#include <linux/gpio.h>  #include <linux/if_ether.h>  #include <linux/irq.h>  #include <linux/serial.h> @@ -27,7 +27,6 @@  #include <asm/mach-types.h>  #include <asm/mach/arch.h>  #include <asm/mach/flash.h> -#include <asm/gpio.h>  #define FSG_SDA_PIN		12  #define FSG_SCL_PIN		13 @@ -209,16 +208,14 @@ static void __init fsg_init(void)  	platform_add_devices(fsg_devices, ARRAY_SIZE(fsg_devices));  	if (request_irq(gpio_to_irq(FSG_RB_GPIO), &fsg_reset_handler, -			IRQF_DISABLED | IRQF_TRIGGER_LOW, -			"FSG reset button", NULL) < 0) { +			IRQF_TRIGGER_LOW, "FSG reset button", NULL) < 0) {  		printk(KERN_DEBUG "Reset Button IRQ %d not available\n",  			gpio_to_irq(FSG_RB_GPIO));  	}  	if (request_irq(gpio_to_irq(FSG_SB_GPIO), &fsg_power_handler, -			IRQF_DISABLED | IRQF_TRIGGER_LOW, -			"FSG power button", NULL) < 0) { +			IRQF_TRIGGER_LOW, "FSG power button", NULL) < 0) {  		printk(KERN_DEBUG "Power Button IRQ %d not available\n",  			gpio_to_irq(FSG_SB_GPIO)); @@ -271,9 +268,14 @@ static void __init fsg_init(void)  MACHINE_START(FSG, "Freecom FSG-3")  	/* Maintainer: www.nslu2-linux.org */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= fsg_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/gateway7001-pci.c b/arch/arm/mach-ixp4xx/gateway7001-pci.c index 7e93a0975c4..d9d6cc08970 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-pci.c +++ b/arch/arm/mach-ixp4xx/gateway7001-pci.c @@ -29,13 +29,14 @@  void __init gateway7001_pci_preinit(void)  { -	set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO10, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO11, IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init gateway7001_map_irq(const struct pci_dev *dev, u8 slot, +	u8 pin)  {  	if (slot == 1)  		return IRQ_IXP4XX_GPIO11; @@ -46,10 +47,9 @@ static int __init gateway7001_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci gateway7001_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit =        gateway7001_pci_preinit, -	.swizzle =        pci_std_swizzle,  	.setup =          ixp4xx_setup, -	.scan =           ixp4xx_scan_bus,  	.map_irq =        gateway7001_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/gateway7001-setup.c b/arch/arm/mach-ixp4xx/gateway7001-setup.c index 9dc0b4eaa65..3d24b3fcee8 100644 --- a/arch/arm/mach-ixp4xx/gateway7001-setup.c +++ b/arch/arm/mach-ixp4xx/gateway7001-setup.c @@ -97,9 +97,14 @@ static void __init gateway7001_init(void)  MACHINE_START(GATEWAY7001, "Gateway 7001 AP")  	/* Maintainer: Imre Kaloz <kaloz@openwrt.org> */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= gateway7001_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END  #endif diff --git a/arch/arm/mach-ixp4xx/goramo_mlr.c b/arch/arm/mach-ixp4xx/goramo_mlr.c index d0e4861ac03..80bd9d6d04d 100644 --- a/arch/arm/mach-ixp4xx/goramo_mlr.c +++ b/arch/arm/mach-ixp4xx/goramo_mlr.c @@ -4,6 +4,7 @@   */  #include <linux/delay.h> +#include <linux/gpio.h>  #include <linux/hdlc.h>  #include <linux/i2c-gpio.h>  #include <linux/io.h> @@ -12,10 +13,10 @@  #include <linux/pci.h>  #include <linux/serial_8250.h>  #include <asm/mach-types.h> -#include <asm/system.h>  #include <asm/mach/arch.h>  #include <asm/mach/flash.h>  #include <asm/mach/pci.h> +#include <asm/system_info.h>  #define SLOT_ETHA		0x0B	/* IDSEL = AD21 */  #define SLOT_ETHB		0x0C	/* IDSEL = AD20 */ @@ -79,19 +80,19 @@ static u8 control_value;  static void set_scl(u8 value)  { -	gpio_line_set(GPIO_SCL, !!value); +	gpio_set_value(GPIO_SCL, !!value);  	udelay(3);  }  static void set_sda(u8 value)  { -	gpio_line_set(GPIO_SDA, !!value); +	gpio_set_value(GPIO_SDA, !!value);  	udelay(3);  }  static void set_str(u8 value)  { -	gpio_line_set(GPIO_STR, !!value); +	gpio_set_value(GPIO_STR, !!value);  	udelay(3);  } @@ -108,8 +109,8 @@ static void output_control(void)  {  	int i; -	gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT); +	gpio_direction_output(GPIO_SCL, 1); +	gpio_direction_output(GPIO_SDA, 1);  	for (i = 0; i < 8; i++) {  		set_scl(0); @@ -151,8 +152,8 @@ static int hss_set_clock(int port, unsigned int clock_type)  static irqreturn_t hss_dcd_irq(int irq, void *pdev)  { -	int i, port = (irq == IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N)); -	gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i); +	int port = (irq == IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N)); +	int i = gpio_get_value(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N);  	set_carrier_cb_tab[port](pdev, !i);  	return IRQ_HANDLED;  } @@ -168,7 +169,7 @@ static int hss_open(int port, void *pdev,  	else  		irq = IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N); -	gpio_line_get(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N, &i); +	i = gpio_get_value(port ? GPIO_HSS1_DCD_N : GPIO_HSS0_DCD_N);  	set_carrier_cb(pdev, !i);  	set_carrier_cb_tab[!!port] = set_carrier_cb; @@ -181,7 +182,7 @@ static int hss_open(int port, void *pdev,  	set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 0);  	output_control(); -	gpio_line_set(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 0); +	gpio_set_value(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 0);  	return 0;  } @@ -193,7 +194,7 @@ static void hss_close(int port, void *pdev)  	set_control(port ? CONTROL_HSS1_DTR_N : CONTROL_HSS0_DTR_N, 1);  	output_control(); -	gpio_line_set(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 1); +	gpio_set_value(port ? GPIO_HSS1_RTS_N : GPIO_HSS0_RTS_N, 1);  } @@ -330,7 +331,7 @@ static struct platform_device device_hss_tab[] = {  }; -static struct platform_device *device_tab[6] __initdata = { +static struct platform_device *device_tab[7] __initdata = {  	&device_flash,		/* index 0 */  }; @@ -413,15 +414,23 @@ static void __init gmlr_init(void)  	if (hw_bits & CFG_HW_HAS_EEPROM)  		device_tab[devices++] = &device_i2c; /* max index 6 */ -	gpio_line_config(GPIO_SCL, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_SDA, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_STR, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_HSS0_RTS_N, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_HSS1_RTS_N, IXP4XX_GPIO_OUT); -	gpio_line_config(GPIO_HSS0_DCD_N, IXP4XX_GPIO_IN); -	gpio_line_config(GPIO_HSS1_DCD_N, IXP4XX_GPIO_IN); -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N), IRQ_TYPE_EDGE_BOTH); -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N), IRQ_TYPE_EDGE_BOTH); +	gpio_request(GPIO_SCL, "SCL/clock"); +	gpio_request(GPIO_SDA, "SDA/data"); +	gpio_request(GPIO_STR, "strobe"); +	gpio_request(GPIO_HSS0_RTS_N, "HSS0 RTS"); +	gpio_request(GPIO_HSS1_RTS_N, "HSS1 RTS"); +	gpio_request(GPIO_HSS0_DCD_N, "HSS0 DCD"); +	gpio_request(GPIO_HSS1_DCD_N, "HSS1 DCD"); + +	gpio_direction_output(GPIO_SCL, 1); +	gpio_direction_output(GPIO_SDA, 1); +	gpio_direction_output(GPIO_STR, 0); +	gpio_direction_output(GPIO_HSS0_RTS_N, 1); +	gpio_direction_output(GPIO_HSS1_RTS_N, 1); +	gpio_direction_input(GPIO_HSS0_DCD_N); +	gpio_direction_input(GPIO_HSS1_DCD_N); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS0_DCD_N), IRQ_TYPE_EDGE_BOTH); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_HSS1_DCD_N), IRQ_TYPE_EDGE_BOTH);  	set_control(CONTROL_HSS0_DTR_N, 1);  	set_control(CONTROL_HSS1_DTR_N, 1); @@ -441,10 +450,10 @@ static void __init gmlr_init(void)  #ifdef CONFIG_PCI  static void __init gmlr_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_NEC), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_MPCI), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_NEC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(GPIO_IRQ_MPCI), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } @@ -462,7 +471,7 @@ static void __init gmlr_pci_postinit(void)  	}  } -static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init gmlr_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	switch(slot) {  	case SLOT_ETHA:	return IXP4XX_GPIO_IRQ(GPIO_IRQ_ETHA); @@ -474,11 +483,10 @@ static int __init gmlr_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  static struct hw_pci gmlr_hw_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= gmlr_pci_preinit,  	.postinit	= gmlr_pci_postinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= gmlr_map_irq,  }; @@ -497,8 +505,13 @@ subsys_initcall(gmlr_pci_init);  MACHINE_START(GORAMO_MLR, "MultiLink")  	/* Maintainer: Krzysztof Halasa */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= gmlr_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/gtwx5715-pci.c b/arch/arm/mach-ixp4xx/gtwx5715-pci.c index 25d2c333c20..551d114c9e1 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-pci.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-pci.c @@ -43,13 +43,13 @@   */  void __init gtwx5715_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init gtwx5715_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	int rc = -1; @@ -67,10 +67,9 @@ static int __init gtwx5715_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci gtwx5715_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit =        gtwx5715_pci_preinit, -	.swizzle =        pci_std_swizzle,  	.setup =          ixp4xx_setup, -	.scan =           ixp4xx_scan_bus,  	.map_irq =        gtwx5715_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c index 77abead3622..16a12994fb5 100644 --- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c +++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c @@ -165,10 +165,15 @@ static void __init gtwx5715_init(void)  MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")  	/* Maintainer: George Joseph */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= gtwx5715_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/include/mach/cpu.h b/arch/arm/mach-ixp4xx/include/mach/cpu.h index b2ef65db0e9..ebc0ba31ce8 100644 --- a/arch/arm/mach-ixp4xx/include/mach/cpu.h +++ b/arch/arm/mach-ixp4xx/include/mach/cpu.h @@ -14,6 +14,7 @@  #ifndef __ASM_ARCH_CPU_H__  #define __ASM_ARCH_CPU_H__ +#include <linux/io.h>  #include <asm/cputype.h>  /* Processor id value in CP15 Register 0 */ @@ -37,7 +38,7 @@  static inline u32 ixp4xx_read_feature_bits(void)  { -	u32 val = ~*IXP4XX_EXP_CFG2; +	u32 val = ~__raw_readl(IXP4XX_EXP_CFG2);  	if (cpu_is_ixp42x_rev_a0())  		return IXP42X_FEATURE_MASK & ~(IXP4XX_FEATURE_RCOMP | @@ -51,7 +52,7 @@ static inline u32 ixp4xx_read_feature_bits(void)  static inline void ixp4xx_write_feature_bits(u32 value)  { -	*IXP4XX_EXP_CFG2 = ~value; +	__raw_writel(~value, IXP4XX_EXP_CFG2);  }  #endif  /* _ASM_ARCH_CPU_H */ diff --git a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S b/arch/arm/mach-ixp4xx/include/mach/debug-macro.S deleted file mode 100644 index b974a49c0af..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/debug-macro.S +++ /dev/null @@ -1,26 +0,0 @@ -/* arch/arm/mach-ixp4xx/include/mach/debug-macro.S - * - * Debugging macro include header - * - *  Copyright (C) 1994-1999 Russell King - *  Moved from linux/arch/arm/kernel/debug.S by Ben Dooks - * - * 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. -*/ - -                .macro  addruart, rp, rv -#ifdef __ARMEB__ -                mov     \rp, #3         @ Uart regs are at off set of 3 if -					@ byte writes used - Big Endian. -#else -		mov	\rp, #0 -#endif -                orr     \rv, \rp, #0xff000000	@ virtual -		orr	\rv, \rv, #0x00b00000 -                orr     \rp, \rp, #0xc8000000	@ physical -                .endm - -#define UART_SHIFT	2 -#include <asm/hardware/debug-8250.S> diff --git a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S index f2e14e94ed1..79adf83e2c3 100644 --- a/arch/arm/mach-ixp4xx/include/mach/entry-macro.S +++ b/arch/arm/mach-ixp4xx/include/mach/entry-macro.S @@ -9,15 +9,9 @@   */  #include <mach/hardware.h> -		.macro	disable_fiq -		.endm -  		.macro  get_irqnr_preamble, base, tmp  		.endm -		.macro  arch_ret_to_user, tmp1, tmp2 -		.endm -  		.macro	get_irqnr_and_base, irqnr, irqstat, base, tmp  		ldr	\irqstat, =(IXP4XX_INTC_BASE_VIRT+IXP4XX_ICIP_OFFSET)  		ldr	\irqstat, [\irqstat]		@ get interrupts diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h deleted file mode 100644 index a5f87ded2f2..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/gpio.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/gpio.h - * - * IXP4XX GPIO wrappers for arch-neutral GPIO calls - * - * Written by Milan Svoboda <msvoboda@ra.rockwell.com> - * Based on PXA implementation by Philipp Zabel <philipp.zabel@gmail.com> - * - * 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. - * - * This program is distributed in the hope that 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 - * - */ - -#ifndef __ASM_ARCH_IXP4XX_GPIO_H -#define __ASM_ARCH_IXP4XX_GPIO_H - -#include <linux/kernel.h> -#include <mach/hardware.h> - -static inline int gpio_request(unsigned gpio, const char *label) -{ -	return 0; -} - -static inline void gpio_free(unsigned gpio) -{ -	might_sleep(); - -	return; -} - -static inline int gpio_direction_input(unsigned gpio) -{ -	gpio_line_config(gpio, IXP4XX_GPIO_IN); -	return 0; -} - -static inline int gpio_direction_output(unsigned gpio, int level) -{ -	gpio_line_set(gpio, level); -	gpio_line_config(gpio, IXP4XX_GPIO_OUT); -	return 0; -} - -static inline int gpio_get_value(unsigned gpio) -{ -	int value; - -	gpio_line_get(gpio, &value); - -	return value; -} - -static inline void gpio_set_value(unsigned gpio, int value) -{ -	gpio_line_set(gpio, value); -} - -#include <asm-generic/gpio.h>			/* cansleep wrappers */ - -extern int gpio_to_irq(int gpio); -extern int irq_to_gpio(unsigned int irq); - -#endif - diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h index 8138371c406..034bb2a1b80 100644 --- a/arch/arm/mach-ixp4xx/include/mach/hardware.h +++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h @@ -17,19 +17,12 @@  #ifndef __ASM_ARCH_HARDWARE_H__  #define __ASM_ARCH_HARDWARE_H__ -#define PCIBIOS_MIN_IO		0x00001000  #ifdef CONFIG_IXP4XX_INDIRECT_PCI -#define PCIBIOS_MIN_MEM		0x10000000 /* 1 GB of indirect PCI MMIO space */  #define PCIBIOS_MAX_MEM		0x4FFFFFFF  #else -#define PCIBIOS_MIN_MEM		0x48000000 /* 64 MB of PCI MMIO space */  #define PCIBIOS_MAX_MEM		0x4BFFFFFF  #endif -#define ARCH_HAS_DMA_SET_COHERENT_MASK - -#define pcibios_assign_all_busses()	1 -  /* Register locations and bits */  #include "ixp4xx-regs.h" diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h index de274a1f19d..559c69a4773 100644 --- a/arch/arm/mach-ixp4xx/include/mach/io.h +++ b/arch/arm/mach-ixp4xx/include/mach/io.h @@ -17,8 +17,6 @@  #include <mach/hardware.h> -#define IO_SPACE_LIMIT 0x0000ffff -  extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);  extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); @@ -41,11 +39,7 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);   *    but in some cases the performance hit is acceptable. In addition, you   *    cannot mmap() PCI devices in this case.   */ -#ifndef	CONFIG_IXP4XX_INDIRECT_PCI - -#define __mem_pci(a)		(a) - -#else +#ifdef	CONFIG_IXP4XX_INDIRECT_PCI  /*   * In the case of using indirect PCI, we simply return the actual PCI @@ -54,29 +48,12 @@ extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);   * fallback to the default.   */ +extern unsigned long pcibios_min_mem;  static inline int is_pci_memory(u32 addr)  { -	return (addr >= PCIBIOS_MIN_MEM) && (addr <= 0x4FFFFFFF); -} - -static inline void __iomem * __indirect_ioremap(unsigned long addr, size_t size, -						unsigned int mtype) -{ -	if (!is_pci_memory(addr)) -		return __arm_ioremap(addr, size, mtype); - -	return (void __iomem *)addr; +	return (addr >= pcibios_min_mem) && (addr <= 0x4FFFFFFF);  } -static inline void __indirect_iounmap(void __iomem *addr) -{ -	if (!is_pci_memory((__force u32)addr)) -		__iounmap(addr); -} - -#define __arch_ioremap(a, s, f)		__indirect_ioremap(a, s, f) -#define __arch_iounmap(a)		__indirect_iounmap(a) -  #define writeb(v, p)			__indirect_writeb(v, p)  #define writew(v, p)			__indirect_writew(v, p)  #define writel(v, p)			__indirect_writel(v, p) diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h b/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h new file mode 100644 index 00000000000..cf03614d250 --- /dev/null +++ b/arch/arm/mach-ixp4xx/include/mach/ixp46x_ts.h @@ -0,0 +1,81 @@ +/* + * PTP 1588 clock using the IXP46X + * + * Copyright (C) 2010 OMICRON electronics GmbH + * + *  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. + * + *  This program is distributed in the hope that 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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _IXP46X_TS_H_ +#define _IXP46X_TS_H_ + +#define DEFAULT_ADDEND 0xF0000029 +#define TICKS_NS_SHIFT 4 + +struct ixp46x_channel_ctl { +	u32 ch_control;  /* 0x40 Time Synchronization Channel Control */ +	u32 ch_event;    /* 0x44 Time Synchronization Channel Event */ +	u32 tx_snap_lo;  /* 0x48 Transmit Snapshot Low Register */ +	u32 tx_snap_hi;  /* 0x4C Transmit Snapshot High Register */ +	u32 rx_snap_lo;  /* 0x50 Receive Snapshot Low Register */ +	u32 rx_snap_hi;  /* 0x54 Receive Snapshot High Register */ +	u32 src_uuid_lo; /* 0x58 Source UUID0 Low Register */ +	u32 src_uuid_hi; /* 0x5C Sequence Identifier/Source UUID0 High */ +}; + +struct ixp46x_ts_regs { +	u32 control;     /* 0x00 Time Sync Control Register */ +	u32 event;       /* 0x04 Time Sync Event Register */ +	u32 addend;      /* 0x08 Time Sync Addend Register */ +	u32 accum;       /* 0x0C Time Sync Accumulator Register */ +	u32 test;        /* 0x10 Time Sync Test Register */ +	u32 unused;      /* 0x14 */ +	u32 rsystime_lo; /* 0x18 RawSystemTime_Low Register */ +	u32 rsystime_hi; /* 0x1C RawSystemTime_High Register */ +	u32 systime_lo;  /* 0x20 SystemTime_Low Register */ +	u32 systime_hi;  /* 0x24 SystemTime_High Register */ +	u32 trgt_lo;     /* 0x28 TargetTime_Low Register */ +	u32 trgt_hi;     /* 0x2C TargetTime_High Register */ +	u32 asms_lo;     /* 0x30 Auxiliary Slave Mode Snapshot Low  */ +	u32 asms_hi;     /* 0x34 Auxiliary Slave Mode Snapshot High */ +	u32 amms_lo;     /* 0x38 Auxiliary Master Mode Snapshot Low */ +	u32 amms_hi;     /* 0x3C Auxiliary Master Mode Snapshot High */ + +	struct ixp46x_channel_ctl channel[3]; +}; + +/* 0x00 Time Sync Control Register Bits */ +#define TSCR_AMM (1<<3) +#define TSCR_ASM (1<<2) +#define TSCR_TTM (1<<1) +#define TSCR_RST (1<<0) + +/* 0x04 Time Sync Event Register Bits */ +#define TSER_SNM (1<<3) +#define TSER_SNS (1<<2) +#define TTIPEND  (1<<1) + +/* 0x40 Time Synchronization Channel Control Register Bits */ +#define MASTER_MODE   (1<<0) +#define TIMESTAMP_ALL (1<<1) + +/* 0x44 Time Synchronization Channel Event Register Bits */ +#define TX_SNAPSHOT_LOCKED (1<<0) +#define RX_SNAPSHOT_LOCKED (1<<1) + +/* The ptp_ixp46x module will set this variable */ +extern int ixp46x_phc_index; + +#endif diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h index 97c530f66e7..c5bae9c035d 100644 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h @@ -30,51 +30,43 @@   *   * 0x50000000	0x10000000	ioremap'd	EXP BUS   * - * 0x6000000	0x00004000	ioremap'd	QMgr + * 0xC8000000	0x00013000	0xFEF00000	On-Chip Peripherals   * - * 0xC0000000	0x00001000	0xffbff000	PCI CFG + * 0xC0000000	0x00001000	0xFEF13000	PCI CFG   * - * 0xC4000000	0x00001000	0xffbfe000	EXP CFG + * 0xC4000000	0x00001000	0xFEF14000	EXP CFG   * - * 0xC8000000	0x00013000	0xffbeb000	On-Chip Peripherals + * 0x60000000	0x00004000	0xFEF15000	QMgr   */  /*   * Queue Manager   */ -#define IXP4XX_QMGR_BASE_PHYS		(0x60000000) -#define IXP4XX_QMGR_REGION_SIZE		(0x00004000) +#define IXP4XX_QMGR_BASE_PHYS		0x60000000 +#define IXP4XX_QMGR_BASE_VIRT		IOMEM(0xFEF15000) +#define IXP4XX_QMGR_REGION_SIZE		0x00004000  /* - * Expansion BUS Configuration registers + * Peripheral space, including debug UART. Must be section-aligned so that + * it can be used with the low-level debug code.   */ -#define IXP4XX_EXP_CFG_BASE_PHYS	(0xC4000000) -#define IXP4XX_EXP_CFG_BASE_VIRT	(0xFFBFE000) -#define IXP4XX_EXP_CFG_REGION_SIZE	(0x00001000) +#define IXP4XX_PERIPHERAL_BASE_PHYS	0xC8000000 +#define IXP4XX_PERIPHERAL_BASE_VIRT	IOMEM(0xFEF00000) +#define IXP4XX_PERIPHERAL_REGION_SIZE	0x00013000  /*   * PCI Config registers   */ -#define IXP4XX_PCI_CFG_BASE_PHYS	(0xC0000000) -#define	IXP4XX_PCI_CFG_BASE_VIRT	(0xFFBFF000) -#define IXP4XX_PCI_CFG_REGION_SIZE	(0x00001000) - -/* - * Peripheral space - */ -#define IXP4XX_PERIPHERAL_BASE_PHYS	(0xC8000000) -#define IXP4XX_PERIPHERAL_BASE_VIRT	(0xFFBEB000) -#define IXP4XX_PERIPHERAL_REGION_SIZE	(0x00013000) +#define IXP4XX_PCI_CFG_BASE_PHYS	0xC0000000 +#define IXP4XX_PCI_CFG_BASE_VIRT	IOMEM(0xFEF13000) +#define IXP4XX_PCI_CFG_REGION_SIZE	0x00001000  /* - * Debug UART - * - * This is basically a remap of UART1 into a region that is section - * aligned so that it * can be used with the low-level debug code. + * Expansion BUS Configuration registers   */ -#define	IXP4XX_DEBUG_UART_BASE_PHYS	(0xC8000000) -#define	IXP4XX_DEBUG_UART_BASE_VIRT	(0xffb00000) -#define	IXP4XX_DEBUG_UART_REGION_SIZE	(0x00001000) +#define IXP4XX_EXP_CFG_BASE_PHYS	0xC4000000 +#define IXP4XX_EXP_CFG_BASE_VIRT	0xFEF14000 +#define IXP4XX_EXP_CFG_REGION_SIZE	0x00001000  #define IXP4XX_EXP_CS0_OFFSET	0x00  #define IXP4XX_EXP_CS1_OFFSET   0x04 @@ -92,7 +84,7 @@  /*   * Expansion Bus Controller registers.   */ -#define IXP4XX_EXP_REG(x) ((volatile u32 *)(IXP4XX_EXP_CFG_BASE_VIRT+(x))) +#define IXP4XX_EXP_REG(x) ((volatile u32 __iomem *)(IXP4XX_EXP_CFG_BASE_VIRT+(x)))  #define IXP4XX_EXP_CS0      IXP4XX_EXP_REG(IXP4XX_EXP_CS0_OFFSET)  #define IXP4XX_EXP_CS1      IXP4XX_EXP_REG(IXP4XX_EXP_CS1_OFFSET) diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h deleted file mode 100644 index 0136eaa2922..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/memory.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/memory.h - * - * Copyright (c) 2001-2004 MontaVista Software, Inc. - */ - -#ifndef __ASM_ARCH_MEMORY_H -#define __ASM_ARCH_MEMORY_H - -#include <asm/sizes.h> - -/* - * Physical DRAM offset. - */ -#define PHYS_OFFSET	UL(0x00000000) - -#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI) - -void ixp4xx_adjust_zones(unsigned long *size, unsigned long *holes); - -#define arch_adjust_zones(size, holes) \ -	ixp4xx_adjust_zones(size, holes) - -#define ISA_DMA_THRESHOLD (SZ_64M - 1) -#define MAX_DMA_ADDRESS		(PAGE_OFFSET + SZ_64M) - -#endif - -#endif diff --git a/arch/arm/mach-ixp4xx/include/mach/platform.h b/arch/arm/mach-ixp4xx/include/mach/platform.h index e824c02c825..75c4c6572ad 100644 --- a/arch/arm/mach-ixp4xx/include/mach/platform.h +++ b/arch/arm/mach-ixp4xx/include/mach/platform.h @@ -13,6 +13,8 @@  #ifndef __ASSEMBLY__ +#include <linux/reboot.h> +  #include <asm/types.h>  #ifndef	__ARMEB__ @@ -89,8 +91,6 @@ struct ixp4xx_pata_data {  	void __iomem	*cs1;  }; -struct sys_timer; -  #define IXP4XX_ETH_NPEA		0x00  #define IXP4XX_ETH_NPEB		0x10  #define IXP4XX_ETH_NPEC		0x20 @@ -121,53 +121,15 @@ extern unsigned long ixp4xx_timer_freq;   * Functions used by platform-level setup code   */  extern void ixp4xx_map_io(void); +extern void ixp4xx_init_early(void);  extern void ixp4xx_init_irq(void);  extern void ixp4xx_sys_init(void);  extern void ixp4xx_timer_init(void); -extern struct sys_timer ixp4xx_timer; +extern void ixp4xx_restart(enum reboot_mode, const char *);  extern void ixp4xx_pci_preinit(void);  struct pci_sys_data;  extern int ixp4xx_setup(int nr, struct pci_sys_data *sys); -extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys); - -/* - * GPIO-functions - */ -/* - * The following converted to the real HW bits the gpio_line_config - */ -/* GPIO pin types */ -#define IXP4XX_GPIO_OUT 		0x1 -#define IXP4XX_GPIO_IN  		0x2 - -/* GPIO signal types */ -#define IXP4XX_GPIO_LOW			0 -#define IXP4XX_GPIO_HIGH		1 - -/* GPIO Clocks */ -#define IXP4XX_GPIO_CLK_0		14 -#define IXP4XX_GPIO_CLK_1		15 - -static inline void gpio_line_config(u8 line, u32 direction) -{ -	if (direction == IXP4XX_GPIO_IN) -		*IXP4XX_GPIO_GPOER |= (1 << line); -	else -		*IXP4XX_GPIO_GPOER &= ~(1 << line); -} - -static inline void gpio_line_get(u8 line, int *value) -{ -	*value = (*IXP4XX_GPIO_GPINR >> line) & 0x1; -} - -static inline void gpio_line_set(u8 line, int value) -{ -	if (value == IXP4XX_GPIO_HIGH) -	    *IXP4XX_GPIO_GPOUTR |= (1 << line); -	else if (value == IXP4XX_GPIO_LOW) -	    *IXP4XX_GPIO_GPOUTR &= ~(1 << line); -} +extern struct pci_ops ixp4xx_ops;  #endif // __ASSEMBLY__ diff --git a/arch/arm/mach-ixp4xx/include/mach/qmgr.h b/arch/arm/mach-ixp4xx/include/mach/qmgr.h index 9e7cad2d54c..4de8da536db 100644 --- a/arch/arm/mach-ixp4xx/include/mach/qmgr.h +++ b/arch/arm/mach-ixp4xx/include/mach/qmgr.h @@ -86,7 +86,7 @@ void qmgr_release_queue(unsigned int queue);  static inline void qmgr_put_entry(unsigned int queue, u32 val)  { -	extern struct qmgr_regs __iomem *qmgr_regs; +	struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  #if DEBUG_QMGR  	BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ @@ -99,7 +99,7 @@ static inline void qmgr_put_entry(unsigned int queue, u32 val)  static inline u32 qmgr_get_entry(unsigned int queue)  {  	u32 val; -	extern struct qmgr_regs __iomem *qmgr_regs; +	const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  	val = __raw_readl(&qmgr_regs->acc[queue][0]);  #if DEBUG_QMGR  	BUG_ON(!qmgr_queue_descs[queue]); /* not yet requested */ @@ -112,14 +112,14 @@ static inline u32 qmgr_get_entry(unsigned int queue)  static inline int __qmgr_get_stat1(unsigned int queue)  { -	extern struct qmgr_regs __iomem *qmgr_regs; +	const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  	return (__raw_readl(&qmgr_regs->stat1[queue >> 3])  		>> ((queue & 7) << 2)) & 0xF;  }  static inline int __qmgr_get_stat2(unsigned int queue)  { -	extern struct qmgr_regs __iomem *qmgr_regs; +	const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  	BUG_ON(queue >= HALF_QUEUES);  	return (__raw_readl(&qmgr_regs->stat2[queue >> 4])  		>> ((queue & 0xF) << 1)) & 0x3; @@ -145,7 +145,7 @@ static inline int qmgr_stat_empty(unsigned int queue)   */  static inline int qmgr_stat_below_low_watermark(unsigned int queue)  { -	extern struct qmgr_regs __iomem *qmgr_regs; +	const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  	if (queue >= HALF_QUEUES)  		return (__raw_readl(&qmgr_regs->statne_h) >>  			(queue - HALF_QUEUES)) & 0x01; @@ -172,7 +172,7 @@ static inline int qmgr_stat_above_high_watermark(unsigned int queue)   */  static inline int qmgr_stat_full(unsigned int queue)  { -	extern struct qmgr_regs __iomem *qmgr_regs; +	const struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  	if (queue >= HALF_QUEUES)  		return (__raw_readl(&qmgr_regs->statf_h) >>  			(queue - HALF_QUEUES)) & 0x01; diff --git a/arch/arm/mach-ixp4xx/include/mach/system.h b/arch/arm/mach-ixp4xx/include/mach/system.h deleted file mode 100644 index 54c0af7fa2d..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/system.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/system.h - * - * Copyright (C) 2002 Intel Corporation. - * - * 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 <mach/hardware.h> - -static inline void arch_idle(void) -{ -	/* ixp4xx does not implement the XScale PWRMODE register, -	 * so it must not call cpu_do_idle() here. -	 */ -#if 0 -	cpu_do_idle(); -#endif -} - - -static inline void arch_reset(char mode, const char *cmd) -{ -	if ( 1 && mode == 's') { -		/* Jump into ROM at address 0 */ -		cpu_reset(0); -	} else { -		/* Use on-chip reset capability */ - -		/* set the "key" register to enable access to -		 * "timer" and "enable" registers -		 */ -		*IXP4XX_OSWK = IXP4XX_WDT_KEY; - -		/* write 0 to the timer register for an immediate reset */ -		*IXP4XX_OSWT = 0; - -		*IXP4XX_OSWE = IXP4XX_WDT_RESET_ENABLE | IXP4XX_WDT_COUNT_ENABLE; -	} -} - diff --git a/arch/arm/mach-ixp4xx/include/mach/timex.h b/arch/arm/mach-ixp4xx/include/mach/timex.h deleted file mode 100644 index 2c3f93c3eb7..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/timex.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/timex.h - *  - */ - -#include <mach/hardware.h> - -/* - * We use IXP425 General purpose timer for our timer needs, it runs at  - * 66.66... MHz. We do a convulted calculation of CLOCK_TICK_RATE b/c the - * timer register ignores the bottom 2 bits of the LATCH value. - */ -#define FREQ 66666000 -#define CLOCK_TICK_RATE (((FREQ / HZ & ~IXP4XX_OST_RELOAD_MASK) + 1) * HZ) - diff --git a/arch/arm/mach-ixp4xx/include/mach/udc.h b/arch/arm/mach-ixp4xx/include/mach/udc.h index 80d6da2eafa..7bd8b96c884 100644 --- a/arch/arm/mach-ixp4xx/include/mach/udc.h +++ b/arch/arm/mach-ixp4xx/include/mach/udc.h @@ -2,7 +2,7 @@   * arch/arm/mach-ixp4xx/include/mach/udc.h   *   */ -#include <asm/mach/udc_pxa2xx.h> +#include <linux/platform_data/pxa2xx_udc.h>  extern void ixp4xx_set_udc_info(struct pxa2xx_udc_mach_info *info); diff --git a/arch/arm/mach-ixp4xx/include/mach/uncompress.h b/arch/arm/mach-ixp4xx/include/mach/uncompress.h index 2db0078a8cf..7b25c0225e4 100644 --- a/arch/arm/mach-ixp4xx/include/mach/uncompress.h +++ b/arch/arm/mach-ixp4xx/include/mach/uncompress.h @@ -19,7 +19,7 @@  #define TX_DONE (UART_LSR_TEMT|UART_LSR_THRE) -static volatile u32* uart_base; +volatile u32* uart_base;  static inline void putc(int c)  { @@ -41,7 +41,8 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)  	 * Some boards are using UART2 as console  	 */  	if (machine_is_adi_coyote() || machine_is_gtwx5715() || -			 machine_is_gateway7001() || machine_is_wg302v2()) +	    machine_is_gateway7001() || machine_is_wg302v2() || +	    machine_is_devixp() || machine_is_miccpt() || machine_is_mic256())  		uart_base = (volatile u32*) IXP4XX_UART2_BASE_PHYS;  	else  		uart_base = (volatile u32*) IXP4XX_UART1_BASE_PHYS; @@ -52,6 +53,4 @@ static __inline__ void __arch_decomp_setup(unsigned long arch_id)   */  #define arch_decomp_setup()	__arch_decomp_setup(arch_id) -#define arch_decomp_wdog() -  #endif diff --git a/arch/arm/mach-ixp4xx/include/mach/vmalloc.h b/arch/arm/mach-ixp4xx/include/mach/vmalloc.h deleted file mode 100644 index 9bcd64d5985..00000000000 --- a/arch/arm/mach-ixp4xx/include/mach/vmalloc.h +++ /dev/null @@ -1,5 +0,0 @@ -/* - * arch/arm/mach-ixp4xx/include/mach/vmalloc.h - */ -#define VMALLOC_END       (0xff000000UL) - diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c index 1ba165a6eda..318424dd3c5 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c @@ -36,14 +36,14 @@  void __init ixdp425_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init ixdp425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[IRQ_LINES] = {  		IXP4XX_GPIO_IRQ(INTA), @@ -60,10 +60,9 @@ static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci ixdp425_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= ixdp425_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= ixdp425_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c index 14078338678..e7b8befa872 100644 --- a/arch/arm/mach-ixp4xx/ixdp425-setup.c +++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c @@ -20,6 +20,7 @@  #include <linux/mtd/nand.h>  #include <linux/mtd/partitions.h>  #include <linux/delay.h> +#include <linux/gpio.h>  #include <asm/types.h>  #include <asm/setup.h>  #include <asm/memory.h> @@ -60,9 +61,6 @@ static struct platform_device ixdp425_flash = {  #if defined(CONFIG_MTD_NAND_PLATFORM) || \      defined(CONFIG_MTD_NAND_PLATFORM_MODULE) -#ifdef CONFIG_MTD_PARTITIONS -const char *part_probes[] = { "cmdlinepart", NULL }; -  static struct mtd_partition ixdp425_partitions[] = {  	{  		.name	= "ixp400 NAND FS 0", @@ -74,7 +72,6 @@ static struct mtd_partition ixdp425_partitions[] = {  		.size	= MTDPART_SIZ_FULL  	},  }; -#endif  static void  ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl) @@ -84,10 +81,10 @@ ixdp425_flash_nand_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctrl)  	if (ctrl & NAND_CTRL_CHANGE) {  		if (ctrl & NAND_NCE) { -			gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_LOW); +			gpio_set_value(IXDP425_NAND_NCE_PIN, 0);  			udelay(5);  		} else -			gpio_line_set(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_HIGH); +			gpio_set_value(IXDP425_NAND_NCE_PIN, 1);  		offset = (ctrl & NAND_CLE) ? IXDP425_NAND_CMD_BYTE : 0;  		offset |= (ctrl & NAND_ALE) ? IXDP425_NAND_ADDR_BYTE : 0; @@ -102,12 +99,8 @@ static struct platform_nand_data ixdp425_flash_nand_data = {  	.chip = {  		.nr_chips		= 1,  		.chip_delay		= 30, -		.options		= NAND_NO_AUTOINCR, -#ifdef CONFIG_MTD_PARTITIONS -		.part_probe_types 	= part_probes,  		.partitions	 	= ixdp425_partitions,  		.nr_partitions	 	= ARRAY_SIZE(ixdp425_partitions), -#endif  	},  	.ctrl = {  		.cmd_ctrl 		= ixdp425_flash_nand_cmd_ctrl @@ -235,7 +228,8 @@ static void __init ixdp425_init(void)  	ixdp425_flash_nand_resource.start = IXP4XX_EXP_BUS_BASE(3),  	ixdp425_flash_nand_resource.end   = IXP4XX_EXP_BUS_BASE(3) + 0x10 - 1; -	gpio_line_config(IXDP425_NAND_NCE_PIN, IXP4XX_GPIO_OUT); +	gpio_request(IXDP425_NAND_NCE_PIN, "NAND NCE pin"); +	gpio_direction_output(IXDP425_NAND_NCE_PIN, 0);  	/* Configure expansion bus for NAND Flash */  	*IXP4XX_EXP_CS3 = IXP4XX_EXP_BUS_CS_EN | @@ -258,10 +252,15 @@ static void __init ixdp425_init(void)  MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= ixdp425_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END  #endif @@ -269,10 +268,14 @@ MACHINE_END  MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= ixdp425_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif  MACHINE_END  #endif @@ -280,10 +283,14 @@ MACHINE_END  MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= ixdp425_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif  MACHINE_END  #endif @@ -291,9 +298,13 @@ MACHINE_END  MACHINE_START(KIXRP435, "Intel KIXRP435 Reference Platform")  	/* Maintainer: MontaVista Software, Inc. */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= ixdp425_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif  MACHINE_END  #endif diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c index 4ed7ac61492..1f8717ba13d 100644 --- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c +++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c @@ -25,13 +25,13 @@  void __init ixdpg425_pci_preinit(void)  { -	set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO6, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO7, IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init ixdpg425_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init ixdpg425_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	if (slot == 12 || slot == 13)  		return IRQ_IXP4XX_GPIO7; @@ -42,10 +42,9 @@ static int __init ixdpg425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci ixdpg425_pci __initdata = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit =        ixdpg425_pci_preinit, -	.swizzle =        pci_std_swizzle,  	.setup =          ixp4xx_setup, -	.scan =           ixp4xx_scan_bus,  	.map_irq =        ixdpg425_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/ixp4xx_npe.c b/arch/arm/mach-ixp4xx/ixp4xx_npe.c index a17ed79207a..d4eb09a6286 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_npe.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_npe.c @@ -116,7 +116,11 @@  /* NPE mailbox_status value for reset */  #define RESET_MBOX_STAT			0x0000F0F0 -const char *npe_names[] = { "NPE-A", "NPE-B", "NPE-C" }; +#define NPE_A_FIRMWARE "NPE-A" +#define NPE_B_FIRMWARE "NPE-B" +#define NPE_C_FIRMWARE "NPE-C" + +const char *npe_names[] = { NPE_A_FIRMWARE, NPE_B_FIRMWARE, NPE_C_FIRMWARE };  #define print_npe(pri, npe, fmt, ...)					\  	printk(pri "%s: " fmt, npe_name(npe), ## __VA_ARGS__) @@ -724,6 +728,9 @@ module_exit(npe_cleanup_module);  MODULE_AUTHOR("Krzysztof Halasa");  MODULE_LICENSE("GPL v2"); +MODULE_FIRMWARE(NPE_A_FIRMWARE); +MODULE_FIRMWARE(NPE_B_FIRMWARE); +MODULE_FIRMWARE(NPE_C_FIRMWARE);  EXPORT_SYMBOL(npe_names);  EXPORT_SYMBOL(npe_running); diff --git a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c index bfdbe4b5a3c..9d1b6b7c394 100644 --- a/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c +++ b/arch/arm/mach-ixp4xx/ixp4xx_qmgr.c @@ -14,7 +14,7 @@  #include <linux/module.h>  #include <mach/qmgr.h> -struct qmgr_regs __iomem *qmgr_regs; +static struct qmgr_regs __iomem *qmgr_regs = IXP4XX_QMGR_BASE_VIRT;  static struct resource *mem_res;  static spinlock_t qmgr_lock;  static u32 used_sram_bitmap[4]; /* 128 16-dword pages */ @@ -265,6 +265,11 @@ void qmgr_release_queue(unsigned int queue)  	       qmgr_queue_descs[queue], queue);  	qmgr_queue_descs[queue][0] = '\x0';  #endif + +	while ((addr = qmgr_get_entry(queue))) +		printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", +		       queue, addr); +  	__raw_writel(0, &qmgr_regs->sram[queue]);  	used_sram_bitmap[0] &= ~mask[0]; @@ -275,10 +280,6 @@ void qmgr_release_queue(unsigned int queue)  	spin_unlock_irq(&qmgr_lock);  	module_put(THIS_MODULE); - -	while ((addr = qmgr_get_entry(queue))) -		printk(KERN_ERR "qmgr: released queue %i not empty: 0x%08X\n", -		       queue, addr);  }  static int qmgr_init(void) @@ -292,12 +293,6 @@ static int qmgr_init(void)  	if (mem_res == NULL)  		return -EBUSY; -	qmgr_regs = ioremap(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE); -	if (qmgr_regs == NULL) { -		err = -ENOMEM; -		goto error_map; -	} -  	/* reset qmgr registers */  	for (i = 0; i < 4; i++) {  		__raw_writel(0x33333333, &qmgr_regs->stat1[i]); @@ -346,8 +341,6 @@ static int qmgr_init(void)  error_irq2:  	free_irq(IRQ_IXP4XX_QM1, NULL);  error_irq: -	iounmap(qmgr_regs); -error_map:  	release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);  	return err;  } @@ -358,7 +351,6 @@ static void qmgr_remove(void)  	free_irq(IRQ_IXP4XX_QM2, NULL);  	synchronize_irq(IRQ_IXP4XX_QM1);  	synchronize_irq(IRQ_IXP4XX_QM2); -	iounmap(qmgr_regs);  	release_mem_region(IXP4XX_QMGR_BASE_PHYS, IXP4XX_QMGR_REGION_SIZE);  } @@ -368,7 +360,6 @@ module_exit(qmgr_remove);  MODULE_LICENSE("GPL v2");  MODULE_AUTHOR("Krzysztof Halasa"); -EXPORT_SYMBOL(qmgr_regs);  EXPORT_SYMBOL(qmgr_set_irq);  EXPORT_SYMBOL(qmgr_enable_irq);  EXPORT_SYMBOL(qmgr_disable_irq); diff --git a/arch/arm/mach-ixp4xx/miccpt-pci.c b/arch/arm/mach-ixp4xx/miccpt-pci.c new file mode 100644 index 00000000000..d114ccd2017 --- /dev/null +++ b/arch/arm/mach-ixp4xx/miccpt-pci.c @@ -0,0 +1,77 @@ +/* + * arch/arm/mach-ixp4xx/miccpt-pci.c + * + * MICCPT board-level PCI initialization + * + * Copyright (C) 2002 Intel Corporation. + * Copyright (C) 2003-2004 MontaVista Software, Inc. + * Copyright (C) 2006 OMICRON electronics GmbH + * + * Author: Michael Jochum <michael.jochum@omicron.at> + * + * 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 <linux/kernel.h> +#include <linux/pci.h> +#include <linux/init.h> +#include <linux/delay.h> +#include <linux/irq.h> +#include <asm/mach/pci.h> +#include <asm/irq.h> +#include <mach/hardware.h> +#include <asm/mach-types.h> + +#define MAX_DEV		4 +#define IRQ_LINES	4 + +/* PCI controller GPIO to IRQ pin mappings */ +#define INTA		1 +#define INTB		2 +#define INTC		3 +#define INTD		4 + + +void __init miccpt_pci_preinit(void) +{ +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); +	ixp4xx_pci_preinit(); +} + +static int __init miccpt_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) +{ +	static int pci_irq_table[IRQ_LINES] = { +		IXP4XX_GPIO_IRQ(INTA), +		IXP4XX_GPIO_IRQ(INTB), +		IXP4XX_GPIO_IRQ(INTC), +		IXP4XX_GPIO_IRQ(INTD) +	}; + +	if (slot >= 1 && slot <= MAX_DEV && pin >= 1 && pin <= IRQ_LINES) +		return pci_irq_table[(slot + pin - 2) % 4]; + +	return -1; +} + +struct hw_pci miccpt_pci __initdata = { +	.nr_controllers = 1, +	.ops		= &ixp4xx_ops, +	.preinit	= miccpt_pci_preinit, +	.setup		= ixp4xx_setup, +	.map_irq	= miccpt_map_irq, +}; + +int __init miccpt_pci_init(void) +{ +	if (machine_is_miccpt()) +		pci_common_init(&miccpt_pci); +	return 0; +} + +subsys_initcall(miccpt_pci_init); diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c index d0cea34cf61..8f0eba0a680 100644 --- a/arch/arm/mach-ixp4xx/nas100d-pci.c +++ b/arch/arm/mach-ixp4xx/nas100d-pci.c @@ -33,15 +33,15 @@  void __init nas100d_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTD), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTE), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init nas100d_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[MAX_DEV][IRQ_LINES] = {  		{ IXP4XX_GPIO_IRQ(INTA), -1, -1 }, @@ -58,10 +58,9 @@ static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci __initdata nas100d_pci = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= nas100d_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= nas100d_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c index f18fee74887..4e0f762bc65 100644 --- a/arch/arm/mach-ixp4xx/nas100d-setup.c +++ b/arch/arm/mach-ixp4xx/nas100d-setup.c @@ -17,7 +17,7 @@   * Maintainers: http://www.nslu2-linux.org/   *   */ - +#include <linux/gpio.h>  #include <linux/if_ether.h>  #include <linux/irq.h>  #include <linux/jiffies.h> @@ -32,7 +32,6 @@  #include <asm/mach-types.h>  #include <asm/mach/arch.h>  #include <asm/mach/flash.h> -#include <asm/gpio.h>  #define NAS100D_SDA_PIN		5  #define NAS100D_SCL_PIN		6 @@ -185,11 +184,8 @@ static void nas100d_power_off(void)  {  	/* This causes the box to drop the power and go dead. */ -	/* enable the pwr cntl gpio */ -	gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT); - -	/* do the deed */ -	gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH); +	/* enable the pwr cntl gpio and assert power off */ +	gpio_direction_output(NAS100D_PO_GPIO, 1);  }  /* This is used to make sure the power-button pusher is serious.  The button @@ -226,7 +222,7 @@ static void nas100d_power_handler(unsigned long data)  			ctrl_alt_del();  			/* Change the state of the power LED to "blink" */ -			gpio_line_set(NAS100D_LED_PWR_GPIO, IXP4XX_GPIO_LOW); +			gpio_set_value(NAS100D_LED_PWR_GPIO, 0);  		} else {  			power_button_countdown = PBUTTON_HOLDDOWN_COUNT;  		} @@ -243,6 +239,33 @@ static irqreturn_t nas100d_reset_handler(int irq, void *dev_id)  	return IRQ_HANDLED;  } +static int __init nas100d_gpio_init(void) +{ +	if (!machine_is_nas100d()) +		return 0; + +	/* +	 * The power button on the Iomega NAS100d is on GPIO 14, but +	 * it cannot handle interrupts on that GPIO line.  So we'll +	 * have to poll it with a kernel timer. +	 */ + +	/* Request the power off GPIO */ +	gpio_request(NAS100D_PO_GPIO, "power off"); + +	/* Make sure that the power button GPIO is set up as an input */ +	gpio_request(NAS100D_PB_GPIO, "power button"); +	gpio_direction_input(NAS100D_PB_GPIO); + +	/* Set the initial value for the power button IRQ handler */ +	power_button_countdown = PBUTTON_HOLDDOWN_COUNT; + +	mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); + +	return 0; +} +device_initcall(nas100d_gpio_init); +  static void __init nas100d_init(void)  {  	uint8_t __iomem *f; @@ -272,26 +295,12 @@ static void __init nas100d_init(void)  	pm_power_off = nas100d_power_off;  	if (request_irq(gpio_to_irq(NAS100D_RB_GPIO), &nas100d_reset_handler, -		IRQF_DISABLED | IRQF_TRIGGER_LOW, -		"NAS100D reset button", NULL) < 0) { +		IRQF_TRIGGER_LOW, "NAS100D reset button", NULL) < 0) {  		printk(KERN_DEBUG "Reset Button IRQ %d not available\n",  			gpio_to_irq(NAS100D_RB_GPIO));  	} -	/* The power button on the Iomega NAS100d is on GPIO 14, but -	 * it cannot handle interrupts on that GPIO line.  So we'll -	 * have to poll it with a kernel timer. -	 */ - -	/* Make sure that the power button GPIO is set up as an input */ -	gpio_line_config(NAS100D_PB_GPIO, IXP4XX_GPIO_IN); - -	/* Set the initial value for the power button IRQ handler */ -	power_button_countdown = PBUTTON_HOLDDOWN_COUNT; - -	mod_timer(&nas100d_power_timer, jiffies + msecs_to_jiffies(500)); -  	/*  	 * Map in a portion of the flash and read the MAC address.  	 * Since it is stored in BE in the flash itself, we need to @@ -314,9 +323,14 @@ static void __init nas100d_init(void)  MACHINE_START(NAS100D, "Iomega NAS 100d")  	/* Maintainer: www.nslu2-linux.org */ -	.boot_params	= 0x00000100, +	.atag_offset	= 0x100,  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer          = &ixp4xx_timer, +	.init_time	= ixp4xx_timer_init,  	.init_machine	= nas100d_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c index 1eb5a90470b..032defe111a 100644 --- a/arch/arm/mach-ixp4xx/nslu2-pci.c +++ b/arch/arm/mach-ixp4xx/nslu2-pci.c @@ -32,13 +32,13 @@  void __init nslu2_pci_preinit(void)  { -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTC), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init nslu2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	static int pci_irq_table[IRQ_LINES] = {  		IXP4XX_GPIO_IRQ(INTA), @@ -54,10 +54,9 @@ static int __init nslu2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci __initdata nslu2_pci = {  	.nr_controllers = 1, +	.ops		= &ixp4xx_ops,  	.preinit	= nslu2_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= nslu2_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c index f79b62eb761..88c025f52d8 100644 --- a/arch/arm/mach-ixp4xx/nslu2-setup.c +++ b/arch/arm/mach-ixp4xx/nslu2-setup.c @@ -16,7 +16,7 @@   * Maintainers: http://www.nslu2-linux.org/   *   */ - +#include <linux/gpio.h>  #include <linux/if_ether.h>  #include <linux/irq.h>  #include <linux/serial.h> @@ -30,7 +30,6 @@  #include <asm/mach/arch.h>  #include <asm/mach/flash.h>  #include <asm/mach/time.h> -#include <asm/gpio.h>  #define NSLU2_SDA_PIN		7  #define NSLU2_SCL_PIN		6 @@ -198,11 +197,8 @@ static void nslu2_power_off(void)  {  	/* This causes the box to drop the power and go dead. */ -	/* enable the pwr cntl gpio */ -	gpio_line_config(NSLU2_PO_GPIO, IXP4XX_GPIO_OUT); - -	/* do the deed */ -	gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH); +	/* enable the pwr cntl gpio and assert power off */ +	gpio_direction_output(NSLU2_PO_GPIO, 1);  }  static irqreturn_t nslu2_power_handler(int irq, void *dev_id) @@ -224,6 +220,16 @@ static irqreturn_t nslu2_reset_handler(int irq, void *dev_id)  	return IRQ_HANDLED;  } +static int __init nslu2_gpio_init(void) +{ +	if (!machine_is_nslu2()) +		return 0; + +	/* Request the power off GPIO */ +	return gpio_request(NSLU2_PO_GPIO, "power off"); +} +device_initcall(nslu2_gpio_init); +  static void __init nslu2_timer_init(void)  {      /* The xtal on this machine is non-standard. */ @@ -233,10 +239,6 @@ static void __init nslu2_timer_init(void)      ixp4xx_timer_init();  } -static struct sys_timer nslu2_timer = { -    .init   = nslu2_timer_init, -}; -  static void __init nslu2_init(void)  {  	uint8_t __iomem *f; @@ -263,16 +265,14 @@ static void __init nslu2_init(void)  	pm_power_off = nslu2_power_off;  	if (request_irq(gpio_to_irq(NSLU2_RB_GPIO), &nslu2_reset_handler, -		IRQF_DISABLED | IRQF_TRIGGER_LOW, -		"NSLU2 reset button", NULL) < 0) { +		IRQF_TRIGGER_LOW, "NSLU2 reset button", NULL) < 0) {  		printk(KERN_DEBUG "Reset Button IRQ %d not available\n",  			gpio_to_irq(NSLU2_RB_GPIO));  	}  	if (request_irq(gpio_to_irq(NSLU2_PB_GPIO), &nslu2_power_handler, -		IRQF_DISABLED | IRQF_TRIGGER_HIGH, -		"NSLU2 power button", NULL) < 0) { +		IRQF_TRIGGER_HIGH, "NSLU2 power button", NULL) < 0) {  		printk(KERN_DEBUG "Power Button IRQ %d not available\n",  			gpio_to_irq(NSLU2_PB_GPIO)); @@ -300,9 +300,14 @@ static void __init nslu2_init(void)  MACHINE_START(NSLU2, "Linksys NSLU2")  	/* Maintainer: www.nslu2-linux.org */ -	.boot_params	= 0x00000100, +	.atag_offset	= 0x100,  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer          = &nslu2_timer, +	.init_time	= nslu2_timer_init,  	.init_machine	= nslu2_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/omixp-setup.c b/arch/arm/mach-ixp4xx/omixp-setup.c new file mode 100644 index 00000000000..2d494b45437 --- /dev/null +++ b/arch/arm/mach-ixp4xx/omixp-setup.c @@ -0,0 +1,279 @@ +/* + * arch/arm/mach-ixp4xx/omixp-setup.c + * + * omicron ixp4xx board setup + *      Copyright (C) 2009 OMICRON electronics GmbH + * + * based nslu2-setup.c, ixdp425-setup.c: + *      Copyright (C) 2003-2004 MontaVista Software, Inc. + * + * 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 <linux/kernel.h> +#include <linux/serial.h> +#include <linux/serial_8250.h> +#include <linux/mtd/mtd.h> +#include <linux/mtd/partitions.h> +#include <linux/leds.h> + +#include <asm/setup.h> +#include <asm/memory.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/flash.h> + +#include <mach/hardware.h> + +static struct resource omixp_flash_resources[] = { +	{ +		.flags	= IORESOURCE_MEM, +	}, { +		.flags	= IORESOURCE_MEM, +	}, +}; + +static struct mtd_partition omixp_partitions[] = { +	{ +		.name =		"Recovery Bootloader", +		.size =		0x00020000, +		.offset =	0, +	}, { +		.name =		"Calibration Data", +		.size =		0x00020000, +		.offset =	0x00020000, +	}, { +		.name =		"Recovery FPGA", +		.size =		0x00020000, +		.offset =	0x00040000, +	}, { +		.name =		"Release Bootloader", +		.size =		0x00020000, +		.offset =	0x00060000, +	}, { +		.name =		"Release FPGA", +		.size =		0x00020000, +		.offset =	0x00080000, +	}, { +		.name =		"Kernel", +		.size =		0x00160000, +		.offset =	0x000a0000, +	}, { +		.name =		"Filesystem", +		.size =		0x00C00000, +		.offset =	0x00200000, +	}, { +		.name =		"Persistent Storage", +		.size =		0x00200000, +		.offset =	0x00E00000, +	}, +}; + +static struct flash_platform_data omixp_flash_data[] = { +	{ +		.map_name	= "cfi_probe", +		.parts		= omixp_partitions, +		.nr_parts	= ARRAY_SIZE(omixp_partitions), +	}, { +		.map_name	= "cfi_probe", +		.parts		= NULL, +		.nr_parts	= 0, +	}, +}; + +static struct platform_device omixp_flash_device[] = { +	{ +		.name		= "IXP4XX-Flash", +		.id		= 0, +		.dev = { +			.platform_data = &omixp_flash_data[0], +		}, +		.resource = &omixp_flash_resources[0], +		.num_resources = 1, +	}, { +		.name		= "IXP4XX-Flash", +		.id		= 1, +		.dev = { +			.platform_data = &omixp_flash_data[1], +		}, +		.resource = &omixp_flash_resources[1], +		.num_resources = 1, +	}, +}; + +/* Swap UART's - These boards have the console on UART2. The following + * configuration is used: + *      ttyS0 .. UART2 + *      ttyS1 .. UART1 + * This way standard images can be used with the kernel that expect + * the console on ttyS0. + */ +static struct resource omixp_uart_resources[] = { +	{ +		.start		= IXP4XX_UART2_BASE_PHYS, +		.end		= IXP4XX_UART2_BASE_PHYS + 0x0fff, +		.flags		= IORESOURCE_MEM, +	}, { +		.start		= IXP4XX_UART1_BASE_PHYS, +		.end		= IXP4XX_UART1_BASE_PHYS + 0x0fff, +		.flags		= IORESOURCE_MEM, +	}, +}; + +static struct plat_serial8250_port omixp_uart_data[] = { +	{ +		.mapbase	= IXP4XX_UART2_BASE_PHYS, +		.membase	= (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, +		.irq		= IRQ_IXP4XX_UART2, +		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, +		.iotype		= UPIO_MEM, +		.regshift	= 2, +		.uartclk	= IXP4XX_UART_XTAL, +	}, { +		.mapbase	= IXP4XX_UART1_BASE_PHYS, +		.membase	= (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET, +		.irq		= IRQ_IXP4XX_UART1, +		.flags		= UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, +		.iotype		= UPIO_MEM, +		.regshift	= 2, +		.uartclk	= IXP4XX_UART_XTAL, +	}, { +		/* list termination */ +	} +}; + +static struct platform_device omixp_uart = { +	.name			= "serial8250", +	.id			= PLAT8250_DEV_PLATFORM, +	.dev.platform_data	= omixp_uart_data, +	.num_resources		= 2, +	.resource		= omixp_uart_resources, +}; + +static struct gpio_led mic256_led_pins[] = { +	{ +		.name		= "LED-A", +		.gpio		= 7, +	}, +}; + +static struct gpio_led_platform_data mic256_led_data = { +	.num_leds		= ARRAY_SIZE(mic256_led_pins), +	.leds			= mic256_led_pins, +}; + +static struct platform_device mic256_leds = { +	.name			= "leds-gpio", +	.id			= -1, +	.dev.platform_data	= &mic256_led_data, +}; + +/* Built-in 10/100 Ethernet MAC interfaces */ +static struct eth_plat_info ixdp425_plat_eth[] = { +	{ +		.phy		= 0, +		.rxq		= 3, +		.txreadyq	= 20, +	}, { +		.phy		= 1, +		.rxq		= 4, +		.txreadyq	= 21, +	}, +}; + +static struct platform_device ixdp425_eth[] = { +	{ +		.name			= "ixp4xx_eth", +		.id			= IXP4XX_ETH_NPEB, +		.dev.platform_data	= ixdp425_plat_eth, +	}, { +		.name			= "ixp4xx_eth", +		.id			= IXP4XX_ETH_NPEC, +		.dev.platform_data	= ixdp425_plat_eth + 1, +	}, +}; + + +static struct platform_device *devixp_pldev[] __initdata = { +	&omixp_uart, +	&omixp_flash_device[0], +	&ixdp425_eth[0], +	&ixdp425_eth[1], +}; + +static struct platform_device *mic256_pldev[] __initdata = { +	&omixp_uart, +	&omixp_flash_device[0], +	&mic256_leds, +	&ixdp425_eth[0], +	&ixdp425_eth[1], +}; + +static struct platform_device *miccpt_pldev[] __initdata = { +	&omixp_uart, +	&omixp_flash_device[0], +	&omixp_flash_device[1], +	&ixdp425_eth[0], +	&ixdp425_eth[1], +}; + +static void __init omixp_init(void) +{ +	ixp4xx_sys_init(); + +	/* 16MiB Boot Flash */ +	omixp_flash_resources[0].start = IXP4XX_EXP_BUS_BASE(0); +	omixp_flash_resources[0].end   = IXP4XX_EXP_BUS_END(0); + +	/* 32 MiB Data Flash */ +	omixp_flash_resources[1].start = IXP4XX_EXP_BUS_BASE(2); +	omixp_flash_resources[1].end   = IXP4XX_EXP_BUS_END(2); + +	if (machine_is_devixp()) +		platform_add_devices(devixp_pldev, ARRAY_SIZE(devixp_pldev)); +	else if (machine_is_miccpt()) +		platform_add_devices(miccpt_pldev, ARRAY_SIZE(miccpt_pldev)); +	else if (machine_is_mic256()) +		platform_add_devices(mic256_pldev, ARRAY_SIZE(mic256_pldev)); +} + +#ifdef CONFIG_MACH_DEVIXP +MACHINE_START(DEVIXP, "Omicron DEVIXP") +	.atag_offset    = 0x100, +	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early, +	.init_irq	= ixp4xx_init_irq, +	.init_time	= ixp4xx_timer_init, +	.init_machine	= omixp_init, +	.restart	= ixp4xx_restart, +MACHINE_END +#endif + +#ifdef CONFIG_MACH_MICCPT +MACHINE_START(MICCPT, "Omicron MICCPT") +	.atag_offset    = 0x100, +	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early, +	.init_irq	= ixp4xx_init_irq, +	.init_time	= ixp4xx_timer_init, +	.init_machine	= omixp_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart, +MACHINE_END +#endif + +#ifdef CONFIG_MACH_MIC256 +MACHINE_START(MIC256, "Omicron MIC256") +	.atag_offset    = 0x100, +	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early, +	.init_irq	= ixp4xx_init_irq, +	.init_time	= ixp4xx_timer_init, +	.init_machine	= omixp_init, +	.restart	= ixp4xx_restart, +MACHINE_END +#endif diff --git a/arch/arm/mach-ixp4xx/vulcan-pci.c b/arch/arm/mach-ixp4xx/vulcan-pci.c index f3111c6840e..a4220fa5e0c 100644 --- a/arch/arm/mach-ixp4xx/vulcan-pci.c +++ b/arch/arm/mach-ixp4xx/vulcan-pci.c @@ -38,12 +38,12 @@ void __init vulcan_pci_preinit(void)  	pr_info("Vulcan PCI: limiting CardBus memory size to %dMB\n",  		(int)(pci_cardbus_mem_size >> 20));  #endif -	set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init vulcan_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init vulcan_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	if (slot == 1)  		return IXP4XX_GPIO_IRQ(INTA); @@ -56,10 +56,9 @@ static int __init vulcan_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci vulcan_pci __initdata = {  	.nr_controllers	= 1, +	.ops		= &ixp4xx_ops,  	.preinit	= vulcan_pci_preinit, -	.swizzle	= pci_std_swizzle,  	.setup		= ixp4xx_setup, -	.scan		= ixp4xx_scan_bus,  	.map_irq	= vulcan_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/vulcan-setup.c b/arch/arm/mach-ixp4xx/vulcan-setup.c index 4e72cfdd3c4..d599e354ca5 100644 --- a/arch/arm/mach-ixp4xx/vulcan-setup.c +++ b/arch/arm/mach-ixp4xx/vulcan-setup.c @@ -163,6 +163,7 @@ static struct platform_device vulcan_max6369 = {  static struct w1_gpio_platform_data vulcan_w1_gpio_pdata = {  	.pin			= 14, +	.ext_pullup_enable_pin	= -EINVAL,  };  static struct platform_device vulcan_w1_gpio = { @@ -237,8 +238,13 @@ static void __init vulcan_init(void)  MACHINE_START(ARCOM_VULCAN, "Arcom/Eurotech Vulcan")  	/* Maintainer: Marc Zyngier <maz@misterjones.org> */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= vulcan_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END diff --git a/arch/arm/mach-ixp4xx/wg302v2-pci.c b/arch/arm/mach-ixp4xx/wg302v2-pci.c index 9b59ed03b15..c92e5b82af3 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-pci.c +++ b/arch/arm/mach-ixp4xx/wg302v2-pci.c @@ -29,13 +29,13 @@  void __init wg302v2_pci_preinit(void)  { -	set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); -	set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO8, IRQ_TYPE_LEVEL_LOW); +	irq_set_irq_type(IRQ_IXP4XX_GPIO9, IRQ_TYPE_LEVEL_LOW);  	ixp4xx_pci_preinit();  } -static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin) +static int __init wg302v2_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)  {  	if (slot == 1)  		return IRQ_IXP4XX_GPIO8; @@ -46,10 +46,9 @@ static int __init wg302v2_map_irq(struct pci_dev *dev, u8 slot, u8 pin)  struct hw_pci wg302v2_pci __initdata = {  	.nr_controllers = 1, +	.ops = &ixp4xx_ops,  	.preinit =        wg302v2_pci_preinit, -	.swizzle =        pci_std_swizzle,  	.setup =          ixp4xx_setup, -	.scan =           ixp4xx_scan_bus,  	.map_irq =        wg302v2_map_irq,  }; diff --git a/arch/arm/mach-ixp4xx/wg302v2-setup.c b/arch/arm/mach-ixp4xx/wg302v2-setup.c index 5d148c7bc4f..8f9ea2f3a9a 100644 --- a/arch/arm/mach-ixp4xx/wg302v2-setup.c +++ b/arch/arm/mach-ixp4xx/wg302v2-setup.c @@ -98,9 +98,14 @@ static void __init wg302v2_init(void)  MACHINE_START(WG302V2, "Netgear WG302 v2 / WAG302 v2")  	/* Maintainer: Imre Kaloz <kaloz@openwrt.org> */  	.map_io		= ixp4xx_map_io, +	.init_early	= ixp4xx_init_early,  	.init_irq	= ixp4xx_init_irq, -	.timer		= &ixp4xx_timer, -	.boot_params	= 0x0100, +	.init_time	= ixp4xx_timer_init, +	.atag_offset	= 0x100,  	.init_machine	= wg302v2_init, +#if defined(CONFIG_PCI) +	.dma_zone_size	= SZ_64M, +#endif +	.restart	= ixp4xx_restart,  MACHINE_END  #endif  | 
