SA11x0 cleanups (mainly assabet/neponset)
Subsystems (6)
cover SA11x0 cleanups (mainly assabet/neponset)
This is a series of cleanups and improvements to the SA11x0 code, in particular the Assabet, and Assabet with the Neponset daughter board.
The main SA11x0 change is to switch to using the DEFINE_RES_xxx() for resources, which obviously reduces the lines of code quite a bit.
The Assabet-only changes reduce power consumption of the board, and illustrate why pins left as inputs when they're supposed to be outputs are bad news - while it's undriven, it floats and increases the power consumption by a measurable amount.
Neponset wise, there's fixes in here to restore it to fully working state (rather than just being buildable.) Unfortunately, genirq had seriously broken the Neponset interrupt support code by genirq having some 'improved checks' added without auditing the genirq users.
Neponset also gets ready for sparse IRQ support, meaning that its interrupt numbers are no longer statically fixed. We also move the registration of the neponset device to assabet, which helps reduce the knowledge spread of whether the board is fitted.
The random places which the NCR_0 board register is written are turned into a function call instead, so that the NCR_0 register access can be centralized and properly protected against concurrent access for this platform.
Since neponset becomes mostly self-contained, most of the boards CPLD register definitions are moved to the board file rather than exposing them in the board header file. That then paves the way to get rid of its static mapping for its own registers, using ioremap() instead.
arch/arm/mach-sa1100/assabet.c | 39 ++- arch/arm/mach-sa1100/badge4.c | 19 +- arch/arm/mach-sa1100/cerf.c | 13 +- arch/arm/mach-sa1100/collie.c | 24 +- arch/arm/mach-sa1100/generic.c | 93 +---- arch/arm/mach-sa1100/h3xxx.c | 13 +- arch/arm/mach-sa1100/hackkit.c | 7 +- arch/arm/mach-sa1100/include/mach/irqs.h | 8 - arch/arm/mach-sa1100/include/mach/neponset.h | 52 +--- arch/arm/mach-sa1100/irq.c | 7 +- arch/arm/mach-sa1100/jornada720.c | 31 +-- arch/arm/mach-sa1100/nanoengine.c | 11 +- arch/arm/mach-sa1100/neponset.c | 534 +++++++++++++++----------- arch/arm/mach-sa1100/pci-nanoengine.c | 8 +- arch/arm/mach-sa1100/pleb.c | 24 +- arch/arm/mach-sa1100/shannon.c | 7 +- arch/arm/mach-sa1100/simpad.c | 11 +- drivers/net/ethernet/smsc/smc91x.c | 2 +- drivers/pcmcia/sa1100_neponset.c | 7 +- 19 files changed, 402 insertions(+), 508 deletions(-)
PATCH 1/17 ARM: sa11x0: convert to use DEFINE_RES_xxx macros
Convert StrongARM-11x0 platforms and core SoC code to use the DEFINE_RES_xxx macros.
--- arch/arm/mach-sa1100/assabet.c | 11 +--- arch/arm/mach-sa1100/badge4.c | 19 ++----- arch/arm/mach-sa1100/cerf.c | 13 +---- arch/arm/mach-sa1100/collie.c | 24 ++------- arch/arm/mach-sa1100/generic.c | 93 ++++++--------------------------- arch/arm/mach-sa1100/h3xxx.c | 13 +---- arch/arm/mach-sa1100/hackkit.c | 7 +-- arch/arm/mach-sa1100/irq.c | 7 +-- arch/arm/mach-sa1100/jornada720.c | 31 ++--------- arch/arm/mach-sa1100/nanoengine.c | 11 +--- arch/arm/mach-sa1100/neponset.c | 39 +++----------- arch/arm/mach-sa1100/pci-nanoengine.c | 8 +-- arch/arm/mach-sa1100/pleb.c | 24 ++------- arch/arm/mach-sa1100/shannon.c | 7 +-- arch/arm/mach-sa1100/simpad.c | 11 +--- 15 files changed, 61 insertions(+), 257 deletions(-)
arch/arm/mach-sa1100/assabet.c +2 -9
@@ -152,15 +152,8 @@ static struct flash_platform_data assabet_flash_data = { };static struct resource assabet_flash_resources[] = { - { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , - }, { - .start =SA1100_CS1_PHYS , - .end =SA1100_CS1_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , - } +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M ), +DEFINE_RES_MEM (SA1100_CS1_PHYS ,SZ_32M ), };
arch/arm/mach-sa1100/badge4.c +4 -15
@@ -39,16 +39,8 @@#include "generic.h" static struct resource sa1111_resources[] = { - [0 ] = { - .start =BADGE4_SA1111_BASE , - .end =BADGE4_SA1111_BASE +0x00001fff , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =BADGE4_IRQ_GPIO_SA1111 , - .end =BADGE4_IRQ_GPIO_SA1111 , - .flags =IORESOURCE_IRQ , - }, + [0 ] =DEFINE_RES_MEM (BADGE4_SA1111_BASE ,0x2000 ), + [1 ] =DEFINE_RES_IRQ (BADGE4_IRQ_GPIO_SA1111 ), };static struct sa1111_platform_data sa1111_info = {
@@ -121,11 +113,8 @@ static struct flash_platform_data badge4_flash_data = { .nr_parts = ARRAY_SIZE(badge4_partitions), }; -static struct resource badge4_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_64M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource badge4_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_64M );static int five_v_on__initdata =0 ;
arch/arm/mach-sa1100/cerf.c +3 -10
@@ -33,11 +33,7 @@#include "generic.h" static struct resource cerfuart2_resources[] = { - [0 ] = { - .start =0x80030000 , - .end =0x8003ffff , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM (0x80030000 ,SZ_64K ), };static struct platform_device cerfuart2_device = {
@@ -87,11 +83,8 @@ static struct flash_platform_data cerf_flash_data = { .nr_parts = ARRAY_SIZE(cerf_partitions), }; -static struct resource cerf_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource cerf_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M );static void __init cerf_init_irq (void ) {
arch/arm/mach-sa1100/collie.c +4 -20
@@ -48,11 +48,7 @@#include "generic.h" static struct resource collie_scoop_resources[] = { - [0 ] = { - .start =0x40800000 , - .end =0x40800fff , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM (0x40800000 ,SZ_4K ), };static struct scoop_config collie_scoop_setup = {
@@ -221,16 +217,8 @@ device_initcall(collie_uart_init);static struct resource locomo_resources[] = { - [0 ] = { - .start =0x40000000 , - .end =0x40001fff , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =IRQ_GPIO25 , - .end =IRQ_GPIO25 , - .flags =IORESOURCE_IRQ , - }, + [0 ] =DEFINE_RES_MEM (0x40000000 ,SZ_8K ), + [1 ] =DEFINE_RES_IRQ (IRQ_GPIO25 ), };static struct locomo_platform_data locomo_info = {
@@ -303,11 +291,7 @@ static struct flash_platform_data collie_flash_data = { };static struct resource collie_flash_resources[] = { - { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , - } +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M ), };static void __init collie_init (void )
arch/arm/mach-sa1100/generic.c +16 -77
135 lines not on this page · raw message
arch/arm/mach-sa1100/h3xxx.c +3 -10
@@ -109,11 +109,8 @@ static struct flash_platform_data h3xxx_flash_data = { .nr_parts = ARRAY_SIZE(h3xxx_partitions), }; -static struct resource h3xxx_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource h3xxx_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M );/*
@@ -186,11 +183,7 @@ static struct sa1100_port_fns h3xxx_port_fns __initdata = {*/ static struct resource egpio_resources[] = { - [0 ] = { - .start =H3600_EGPIO_PHYS , - .end =H3600_EGPIO_PHYS +0x4 -1 , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM (H3600_EGPIO_PHYS ,0x4 ), };static struct htc_egpio_chip egpio_chips[] = {
arch/arm/mach-sa1100/hackkit.c +2 -5
@@ -179,11 +179,8 @@ static struct flash_platform_data hackkit_flash_data = { .nr_parts = ARRAY_SIZE(hackkit_partitions), }; -static struct resource hackkit_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource hackkit_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M );static void __init hackkit_init (void ) {
arch/arm/mach-sa1100/irq.c +2 -5
@@ -221,11 +221,8 @@ static struct irq_chip sa1100_normal_chip = { .irq_set_wake = sa1100_set_wake, }; -static struct resource irq_resource = { - .name ="irqs" , - .start =0x90050000 , - .end =0x9005ffff , -}; +static struct resource irq_resource = +DEFINE_RES_MEM_NAMED (0x90050000 ,SZ_64K ,"irqs" ); static struct sa1100irq_state { unsigned int saved;
arch/arm/mach-sa1100/jornada720.c +6 -25
@@ -174,16 +174,8 @@ static struct s1d13xxxfb_pdata s1d13xxxfb_data = { };static struct resource s1d13xxxfb_resources[] = { - [0 ] = { - .start =EPSONFBSTART , - .end =EPSONFBSTART +EPSONFBLEN -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =EPSONREGSTART , - .end =EPSONREGSTART +EPSONREGLEN -1 , - .flags =IORESOURCE_MEM , - } + [0 ] =DEFINE_RES_MEM (EPSONFBSTART ,EPSONFBLEN ), + [1 ] =DEFINE_RES_MEM (EPSONREGSTART ,EPSONREGLEN ), };static struct platform_device s1d13xxxfb_device = {
@@ -197,16 +189,8 @@ static struct platform_device s1d13xxxfb_device = { };static struct resource sa1111_resources[] = { - [0 ] = { - .start =SA1111REGSTART , - .end =SA1111REGSTART +SA1111REGLEN -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =IRQ_GPIO1 , - .end =IRQ_GPIO1 , - .flags =IORESOURCE_IRQ , - }, + [0 ] =DEFINE_RES_MEM (SA1111REGSTART ,SA1111REGLEN ), + [1 ] =DEFINE_RES_IRQ (IRQ_GPIO1 ), };static struct sa1111_platform_data sa1111_info = {
@@ -352,11 +336,8 @@ static struct flash_platform_data jornada720_flash_data = { .nr_parts = ARRAY_SIZE(jornada720_partitions), }; -static struct resource jornada720_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource jornada720_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M );static void __init jornada720_mach_init (void ) {
arch/arm/mach-sa1100/nanoengine.c +2 -9
@@ -58,15 +58,8 @@ static struct flash_platform_data nanoengine_flash_data = { };static struct resource nanoengine_flash_resources[] = { - { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , - }, { - .start =SA1100_CS1_PHYS , - .end =SA1100_CS1_PHYS +SZ_32M -1 , - .flags =IORESOURCE_MEM , - } +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_32M ), +DEFINE_RES_MEM (SA1100_CS1_PHYS ,SZ_32M ), };static struct map_desc nanoengine_io_desc[]__initdata = {
arch/arm/mach-sa1100/neponset.c +7 -32
@@ -213,11 +213,7 @@ static struct platform_driver neponset_device_driver = { };static struct resource neponset_resources[] = { - [0 ] = { - .start =0x10000000 , - .end =0x17ffffff , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM (0x10000000 ,0x08000000 ), };static struct platform_device neponset_device = {
@@ -228,16 +224,8 @@ static struct platform_device neponset_device = { };static struct resource sa1111_resources[] = { - [0 ] = { - .start =0x40000000 , - .end =0x40001fff , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =IRQ_NEPONSET_SA1111 , - .end =IRQ_NEPONSET_SA1111 , - .flags =IORESOURCE_IRQ , - }, + [0 ] =DEFINE_RES_MEM (0x40000000 ,SZ_8K ), + [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SA1111 ), };static struct sa1111_platform_data sa1111_info = {
@@ -259,23 +247,10 @@ static struct platform_device sa1111_device = { };static struct resource smc91x_resources[] = { - [0 ] = { - .name ="smc91x-regs" , - .start =SA1100_CS3_PHYS , - .end =SA1100_CS3_PHYS +0x01ffffff , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =IRQ_NEPONSET_SMC9196 , - .end =IRQ_NEPONSET_SMC9196 , - .flags =IORESOURCE_IRQ , - }, - [2 ] = { - .name ="smc91x-attrib" , - .start =SA1100_CS3_PHYS +0x02000000 , - .end =SA1100_CS3_PHYS +0x03ffffff , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS ,0x02000000 ,"smc91x-regs" ), + [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SMC9196 ), + [2 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS +0x02000000 , +0x02000000 ,"smc91x-attrib" ), };static struct platform_device smc91x_device = {
arch/arm/mach-sa1100/pci-nanoengine.c +2 -6
@@ -135,12 +135,8 @@ struct pci_bus * __init pci_nanoengine_scan_bus(int nr, struct pci_sys_data *sys &sys->resources); } -static struct resource pci_io_ports = { - .name ="PCI IO" , - .start =0x400 , - .end =0x7FF , - .flags =IORESOURCE_IO , -}; +static struct resource pci_io_ports = +DEFINE_RES_IO_NAMED (0x400 ,0x400 ,"PCI IO" );static struct resource pci_non_prefetchable_memory = { .name ="PCI non-prefetchable" ,
arch/arm/mach-sa1100/pleb.c +4 -20
@@ -37,17 +37,9 @@#define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21static struct resource smc91x_resources[] = { - [0 ] = { - .start =PLEB_ETH0_P , - .end =PLEB_ETH0_P |0x03ffffff , - .flags =IORESOURCE_MEM , - }, + [0 ] =DEFINE_RES_MEM (PLEB_ETH0_P ,0x04000000 ), #if 0 /* Autoprobe instead, to get rising/falling edge characteristic right */ - [1] = { - .start =IRQ_GPIO_ETH0_IRQ , - .end =IRQ_GPIO_ETH0_IRQ , - .flags =IORESOURCE_IRQ , - }, + [1 ] =DEFINE_RES_IRQ (IRQ_GPIO_ETH0_IRQ ), #endif };
@@ -70,16 +62,8 @@ static struct platform_device *devices[] __initdata = {* the two SA1100 lowest chip select outputs. */ static struct resource pleb_flash_resources[] = { - [0 ] = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_8M -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =SA1100_CS1_PHYS , - .end =SA1100_CS1_PHYS +SZ_8M -1 , - .flags =IORESOURCE_MEM , - } + [0 ] =DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_8M ), + [1 ] =DEFINE_RES_MEM (SA1100_CS1_PHYS ,SZ_8M ), };
arch/arm/mach-sa1100/shannon.c +2 -5
@@ -46,11 +46,8 @@ static struct flash_platform_data shannon_flash_data = { .nr_parts = ARRAY_SIZE(shannon_partitions), }; -static struct resource shannon_flash_resource = { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_4M -1 , - .flags =IORESOURCE_MEM , -}; +static struct resource shannon_flash_resource = +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_4M );static struct mcp_plat_data shannon_mcp_data = { .mccr0 =MCCR0_ADM ,
arch/arm/mach-sa1100/simpad.c +2 -9
@@ -176,15 +176,8 @@ static struct flash_platform_data simpad_flash_data = {static struct resource simpad_flash_resources [] = { - { - .start =SA1100_CS0_PHYS , - .end =SA1100_CS0_PHYS +SZ_16M -1 , - .flags =IORESOURCE_MEM , - }, { - .start =SA1100_CS1_PHYS , - .end =SA1100_CS1_PHYS +SZ_16M -1 , - .flags =IORESOURCE_MEM , - } +DEFINE_RES_MEM (SA1100_CS0_PHYS ,SZ_16M ), +DEFINE_RES_MEM (SA1100_CS1_PHYS ,SZ_16M ), };static struct mcp_plat_data simpad_mcp_data = {
Signature · 1 line
1.7.4.4
PATCH 2/17 ARM: sa11x0: assabet: deassert QMUTE to codec while codec is unpowered
In reply to Russell King - ARM Linux--- arch/arm/mach-sa1100/assabet.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-sa1100/assabet.c +2 -2
@@ -40,13 +40,13 @@#include "generic.h" #define ASSABET_BCR_DB1110 \ - (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ + (ASSABET_BCR_SPK_OFF | \ ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ ASSABET_BCR_IRDA_MD0)#define ASSABET_BCR_DB1111 \ - (ASSABET_BCR_SPK_OFF | ASSABET_BCR_QMUTE | \ + (ASSABET_BCR_SPK_OFF | \ ASSABET_BCR_LED_GREEN | ASSABET_BCR_LED_RED | \ ASSABET_BCR_RS232EN | ASSABET_BCR_LCD_12RGB | \ ASSABET_BCR_CF_BUS_OFF | ASSABET_BCR_STEREO_LB | \
Signature · 1 line
1.7.4.4
PATCH 3/17 ARM: sa11x0: assabet: avoid glitching GPIOs when setting outputs
In reply to Russell King - ARM LinuxAvoid glitching the GPIO signals during initialization, which can have undesirable effects. Ensure that the desired pin state is set before we change the GPIO pin direction to be an output.
--- arch/arm/mach-sa1100/assabet.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-sa1100/assabet.c +2 -2
@@ -202,8 +202,8 @@ static void __init assabet_init(void)/* * Ensure that the power supply is in "high power" mode. */ -GPDR |=GPIO_GPIO16 ;GPSR =GPIO_GPIO16 ; +GPDR |=GPIO_GPIO16 ;/* * Ensure that these pins are set as outputs and are driving
@@ -211,8 +211,8 @@ static void __init assabet_init(void)* the WS latch in the CPLD, and we don't float causing * excessive power drain. --rmk */ -GPDR |=GPIO_SSP_TXD |GPIO_SSP_SCLK |GPIO_SSP_SFRM ;GPCR =GPIO_SSP_TXD |GPIO_SSP_SCLK |GPIO_SSP_SFRM ; +GPDR |=GPIO_SSP_TXD |GPIO_SSP_SCLK |GPIO_SSP_SFRM ;/* * Set up registers for sleep mode.
Signature · 1 line
1.7.4.4
PATCH 4/17 ARM: sa11x0: assabet: ensure that GPIO27 is driven
In reply to Russell King - ARM LinuxGPIO27 is just connected to a CPLD input without any pull-ups or pull- downs. If GPIO27 is left as an input, it will float around mid-supply, which for CMOS inputs is the worst place for a pin to be. Ensure that this pin is driven.
--- arch/arm/mach-sa1100/assabet.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-)
arch/arm/mach-sa1100/assabet.c +8 -0
@@ -215,6 +215,14 @@ static void __init assabet_init(void)GPDR |=GPIO_SSP_TXD |GPIO_SSP_SCLK |GPIO_SSP_SFRM ;/* +* Also set GPIO27 as an output; this is used to clock UART3 +* via the FPGA and as otherwise has no pullups or pulldowns, +* so stop it floating. +*/ +GPCR =GPIO_GPIO27 ; +GPDR |=GPIO_GPIO27 ; + +/* * Set up registers for sleep mode. */ PWER =PWER_GPIO0 ;
Signature · 1 line
1.7.4.4
PATCH 5/17 ARM: sa11x0: neponset: fix interrupt setup
In reply to Russell King - ARM LinuxSince ARM was converted to genirq, the neponset IRQ implementation has gradually broken as a result of various subtle changes being introduced into genirq.
It used to be that simple IRQs did not need an IRQ chip. This is no longer the case, and genirq barfs in irq_set_handler(). Fix this by introducing a dummy no-op chip, and registering it along with the flow handler.
Neponset IRQs really don't have any masking ability - all we have is a status register to allow us to decode the source, and a three input OR gate inside a CPLD.
--- arch/arm/mach-sa1100/neponset.c | 21 +++++++++++++++++++-- 1 files changed, 19 insertions(+), 2 deletions(-)
arch/arm/mach-sa1100/neponset.c +19 -2
@@ -138,6 +138,20 @@ static struct sa1100_port_fns neponset_port_fns __devinitdata = { .get_mctrl = neponset_get_mctrl, }; +/* +* Yes, we really do not have any kind of masking or unmasking +*/ +static void nochip_noop (struct irq_data *irq) +{ +} + +static struct irq_chip nochip = { + .name ="neponset" , + .irq_ack = nochip_noop, + .irq_mask = nochip_noop, + .irq_unmask = nochip_noop, +}; +static int __devinit neponset_probe (struct platform_device *dev) {sa1100_register_uart_fns (&neponset_port_fns);
@@ -161,10 +175,13 @@ static int __devinit neponset_probe(struct platform_device *dev)* Setup other Neponset IRQs. SA1111 will be done by the * generic SA1111 code. */ -irq_set_handler (IRQ_NEPONSET_SMC9196 , handle_simple_irq); +irq_set_chip_and_handler (IRQ_NEPONSET_SMC9196 , &nochip, + handle_simple_irq);set_irq_flags (IRQ_NEPONSET_SMC9196 ,IRQF_VALID |IRQF_PROBE ); -irq_set_handler (IRQ_NEPONSET_USAR , handle_simple_irq); +irq_set_chip_and_handler (IRQ_NEPONSET_USAR , &nochip, + handle_simple_irq);set_irq_flags (IRQ_NEPONSET_USAR ,IRQF_VALID |IRQF_PROBE ); +irq_set_chip (IRQ_NEPONSET_SA1111 , &nochip);/* * Disable GPIO 0/1 drivers so the buttons work on the module.
Signature · 1 line
1.7.4.4
PATCH 6/17 ARM: sa11x0: neponset: provide function to manipulate NCR_0
In reply to Russell King - ARM LinuxRather than having direct register accesses to NCR_0 scattered amongst the code, provide a function instead. This contains the necessary race protection for this platform, ensuring that updates to this register are safe.
--- arch/arm/mach-sa1100/include/mach/neponset.h | 4 ++++ arch/arm/mach-sa1100/neponset.c | 9 +++++++++ drivers/net/ethernet/smsc/smc91x.c | 2 +- drivers/pcmcia/sa1100_neponset.c | 7 +------ 4 files changed, 15 insertions(+), 7 deletions(-)
arch/arm/mach-sa1100/include/mach/neponset.h +4 -0
@@ -71,4 +71,8 @@#define NCR_A0VPP (1<<5)#define NCR_A1VPP (1<<6) +void neponset_ncr_frob (unsigned int ,unsigned int ); +#define neponset_ncr_set (v) neponset_ncr_frob(0, v) +#define neponset_ncr_clear (v) neponset_ncr_frob(v, 0) +#endif
arch/arm/mach-sa1100/neponset.c +9 -0
@@ -20,6 +20,15 @@#include <asm/hardware/sa1111.h> #include <asm/sizes.h> +void neponset_ncr_frob (unsigned int mask,unsigned int val) +{ +unsigned long flags; + +local_irq_save (flags); +NCR_0 = (NCR_0 & ~mask) | val; +local_irq_restore (flags); +} +/* * Install handler for Neponset IRQ. Note that we have to loop here * since the ETHERNET and USAR IRQs are level based, and we need to
drivers/net/ethernet/smsc/smc91x.c +1 -1
@@ -2281,7 +2281,7 @@ static int __devinit smc_drv_probe(struct platform_device *pdev)if (ret) goto out_release_io;#if defined(CONFIG_SA1100_ASSABET ) -NCR_0 |=NCR_ENET_OSC_EN ; +neponset_ncr_set (NCR_ENET_OSC_EN );#endif platform_set_drvdata (pdev, ndev); ret =smc_enable_device (pdev);
drivers/pcmcia/sa1100_neponset.c +1 -6
@@ -94,12 +94,7 @@ neponset_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_sta ret =sa1111_pcmcia_configure_socket (skt, state);if (ret ==0 ) { -unsigned long flags; - -local_irq_save (flags); -NCR_0 = (NCR_0 & ~ncr_mask) | ncr_set; - -local_irq_restore (flags); +neponset_ncr_frob (ncr_mask, ncr_set);sa1111_set_io (s->dev, pa_dwr_mask, pa_dwr_set); }
Signature · 1 line
1.7.4.4
PATCH 7/17 ARM: sa11x0: neponset: shuffle some code around
In reply to Russell King - ARM LinuxMove the IRQ handler along side the rest of the IRQ code, and rearrange the include files.
--- arch/arm/mach-sa1100/neponset.c | 202 +++++++++++++++++++------------------- 1 files changed, 101 insertions(+), 101 deletions(-)
arch/arm/mach-sa1100/neponset.c +101 -101
@@ -2,24 +2,24 @@* linux/arch/arm/mach-sa1100/neponset.c * */ -#include <linux/kernel.h> #include <linux/init.h> -#include <linux/tty.h> #include <linux/ioport.h> -#include <linux/serial_core.h> +#include <linux/kernel.h> #include <linux/platform_device.h> +#include <linux/serial_core.h> -#include <mach/hardware.h> #include <asm/mach-types.h> #include <asm/irq.h> #include <asm/mach/map.h> #include <asm/mach/irq.h> #include <asm/mach/serial_sa1100.h> -#include <mach/assabet.h> -#include <mach/neponset.h> #include <asm/hardware/sa1111.h> #include <asm/sizes.h> +#include <mach/hardware.h> +#include <mach/assabet.h> +#include <mach/neponset.h> +void neponset_ncr_frob (unsigned int mask,unsigned int val) {unsigned long flags;
@@ -29,6 +29,64 @@ void neponset_ncr_frob(unsigned int mask, unsigned int val)local_irq_restore (flags); } +static void neponset_set_mctrl (struct uart_port *port,u_int mctrl) +{ +u_int mdm_ctl0 =MDM_CTL_0 ; + +if (port->mapbase == _Ser1UTCR0) { +if (mctrl &TIOCM_RTS ) + mdm_ctl0 &= ~MDM_CTL0_RTS2 ; +else + mdm_ctl0 |=MDM_CTL0_RTS2 ; + +if (mctrl &TIOCM_DTR ) + mdm_ctl0 &= ~MDM_CTL0_DTR2 ; +else + mdm_ctl0 |=MDM_CTL0_DTR2 ; + }else if (port->mapbase == _Ser3UTCR0) { +if (mctrl &TIOCM_RTS ) + mdm_ctl0 &= ~MDM_CTL0_RTS1 ; +else + mdm_ctl0 |=MDM_CTL0_RTS1 ; + +if (mctrl &TIOCM_DTR ) + mdm_ctl0 &= ~MDM_CTL0_DTR1 ; +else + mdm_ctl0 |=MDM_CTL0_DTR1 ; + } + +MDM_CTL_0 = mdm_ctl0; +} + +static u_int neponset_get_mctrl (struct uart_port *port) +{ +u_int ret =TIOCM_CD |TIOCM_CTS |TIOCM_DSR ; +u_int mdm_ctl1 =MDM_CTL_1 ; + +if (port->mapbase == _Ser1UTCR0) { +if (mdm_ctl1 &MDM_CTL1_DCD2 ) + ret &= ~TIOCM_CD ; +if (mdm_ctl1 &MDM_CTL1_CTS2 ) + ret &= ~TIOCM_CTS ; +if (mdm_ctl1 &MDM_CTL1_DSR2 ) + ret &= ~TIOCM_DSR ; + }else if (port->mapbase == _Ser3UTCR0) { +if (mdm_ctl1 &MDM_CTL1_DCD1 ) + ret &= ~TIOCM_CD ; +if (mdm_ctl1 &MDM_CTL1_CTS1 ) + ret &= ~TIOCM_CTS ; +if (mdm_ctl1 &MDM_CTL1_DSR1 ) + ret &= ~TIOCM_DSR ; + } + +return ret; +} + +static struct sa1100_port_fns neponset_port_fns__devinitdata = { + .set_mctrl = neponset_set_mctrl, + .get_mctrl = neponset_get_mctrl, +}; +/* * Install handler for Neponset IRQ. Note that we have to loop here * since the ETHERNET and USAR IRQs are level based, and we need to
@@ -89,64 +147,6 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc) } } -static void neponset_set_mctrl (struct uart_port *port,u_int mctrl) -{ -u_int mdm_ctl0 =MDM_CTL_0 ; - -if (port->mapbase == _Ser1UTCR0) { -if (mctrl &TIOCM_RTS ) - mdm_ctl0 &= ~MDM_CTL0_RTS2 ; -else - mdm_ctl0 |=MDM_CTL0_RTS2 ; - -if (mctrl &TIOCM_DTR ) - mdm_ctl0 &= ~MDM_CTL0_DTR2 ; -else - mdm_ctl0 |=MDM_CTL0_DTR2 ; - }else if (port->mapbase == _Ser3UTCR0) { -if (mctrl &TIOCM_RTS ) - mdm_ctl0 &= ~MDM_CTL0_RTS1 ; -else - mdm_ctl0 |=MDM_CTL0_RTS1 ; - -if (mctrl &TIOCM_DTR ) - mdm_ctl0 &= ~MDM_CTL0_DTR1 ; -else - mdm_ctl0 |=MDM_CTL0_DTR1 ; - } - -MDM_CTL_0 = mdm_ctl0; -} - -static u_int neponset_get_mctrl (struct uart_port *port) -{ -u_int ret =TIOCM_CD |TIOCM_CTS |TIOCM_DSR ; -u_int mdm_ctl1 =MDM_CTL_1 ; - -if (port->mapbase == _Ser1UTCR0) { -if (mdm_ctl1 &MDM_CTL1_DCD2 ) - ret &= ~TIOCM_CD ; -if (mdm_ctl1 &MDM_CTL1_CTS2 ) - ret &= ~TIOCM_CTS ; -if (mdm_ctl1 &MDM_CTL1_DSR2 ) - ret &= ~TIOCM_DSR ; - }else if (port->mapbase == _Ser3UTCR0) { -if (mdm_ctl1 &MDM_CTL1_DCD1 ) - ret &= ~TIOCM_CD ; -if (mdm_ctl1 &MDM_CTL1_CTS1 ) - ret &= ~TIOCM_CTS ; -if (mdm_ctl1 &MDM_CTL1_DSR1 ) - ret &= ~TIOCM_DSR ; - } - -return ret; -} - -static struct sa1100_port_fns neponset_port_fns__devinitdata = { - .set_mctrl = neponset_set_mctrl, - .get_mctrl = neponset_get_mctrl, -}; -/* * Yes, we really do not have any kind of masking or unmasking */
@@ -161,6 +161,43 @@ static struct irq_chip nochip = { .irq_unmask = nochip_noop, }; +static struct resource sa1111_resources[] = { + [0 ] =DEFINE_RES_MEM (0x40000000 ,SZ_8K ), + [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SA1111 ), +}; + +static struct sa1111_platform_data sa1111_info = { + .irq_base =IRQ_BOARD_END , +}; + +static u64 sa1111_dmamask =0xffffffffUL ; + +static struct platform_device sa1111_device = { + .name ="sa1111" , + .id =0 , + .dev = { + .dma_mask = &sa1111_dmamask, + .coherent_dma_mask =0xffffffff , + .platform_data = &sa1111_info, + }, + .num_resources =ARRAY_SIZE (sa1111_resources), + .resource = sa1111_resources, +}; + +static struct resource smc91x_resources[] = { + [0 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS ,0x02000000 ,"smc91x-regs" ), + [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SMC9196 ), + [2 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS +0x02000000 , +0x02000000 ,"smc91x-attrib" ), +}; + +static struct platform_device smc91x_device = { + .name ="smc91x" , + .id =0 , + .num_resources =ARRAY_SIZE (smc91x_resources), + .resource = smc91x_resources, +}; +static int __devinit neponset_probe (struct platform_device *dev) {sa1100_register_uart_fns (&neponset_port_fns);
@@ -249,43 +286,6 @@ static struct platform_device neponset_device = { .resource = neponset_resources, }; -static struct resource sa1111_resources[] = { - [0 ] =DEFINE_RES_MEM (0x40000000 ,SZ_8K ), - [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SA1111 ), -}; - -static struct sa1111_platform_data sa1111_info = { - .irq_base =IRQ_BOARD_END , -}; - -static u64 sa1111_dmamask =0xffffffffUL ; - -static struct platform_device sa1111_device = { - .name ="sa1111" , - .id =0 , - .dev = { - .dma_mask = &sa1111_dmamask, - .coherent_dma_mask =0xffffffff , - .platform_data = &sa1111_info, - }, - .num_resources =ARRAY_SIZE (sa1111_resources), - .resource = sa1111_resources, -}; - -static struct resource smc91x_resources[] = { - [0 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS ,0x02000000 ,"smc91x-regs" ), - [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SMC9196 ), - [2 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS +0x02000000 , -0x02000000 ,"smc91x-attrib" ), -}; - -static struct platform_device smc91x_device = { - .name ="smc91x" , - .id =0 , - .num_resources =ARRAY_SIZE (smc91x_resources), - .resource = smc91x_resources, -}; -static struct platform_device *devices[]__initdata = { &neponset_device, &sa1111_device,
Signature · 1 line
1.7.4.4
PATCH 8/17 ARM: sa11x0: neponset: add driver .owner initializer
In reply to Russell King - ARM LinuxEnsure that the driver .owner field is properly initialized.
--- arch/arm/mach-sa1100/neponset.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-sa1100/neponset.c +1 -0
@@ -272,6 +272,7 @@ static struct platform_driver neponset_device_driver = { .resume = neponset_resume, .driver = { .name = "neponset", + .owner = THIS_MODULE, }, };
Signature · 1 line
1.7.4.4
PATCH 9/17 ARM: sa11x0: neponset: save and restore MDM_CTL_0
In reply to Russell King - ARM LinuxSave and restore the modem output control register across a suspend/ resume, as well as the NCR register. Place these in a locally allocated data structure rather than needing a new static variable.
--- arch/arm/mach-sa1100/neponset.c | 53 ++++++++++++++++++++++++++++++-------- 1 files changed, 42 insertions(+), 11 deletions(-)
arch/arm/mach-sa1100/neponset.c +42 -11
@@ -1,12 +1,13 @@/* * linux/arch/arm/mach-sa1100/neponset.c -* */ #include <linux/init.h> #include <linux/ioport.h> #include <linux/kernel.h> +#include <linux/module.h> #include <linux/platform_device.h> #include <linux/serial_core.h> +#include <linux/slab.h> #include <asm/mach-types.h> #include <asm/irq.h>
@@ -20,6 +21,13 @@#include <mach/assabet.h> #include <mach/neponset.h> +struct neponset_drvdata { +#ifdef CONFIG_PM_SLEEP +u32 ncr0; +u32 mdm_ctl_0; +#endif +}; +void neponset_ncr_frob (unsigned int mask,unsigned int val) {unsigned long flags;
@@ -200,6 +208,15 @@ static struct platform_device smc91x_device = {static int __devinit neponset_probe (struct platform_device *dev) { +struct neponset_drvdata *d; +int ret; + + d =kzalloc (sizeof (*d),GFP_KERNEL ); +if (!d) { + ret = -ENOMEM ; + goto err_alloc; + } +sa1100_register_uart_fns (&neponset_port_fns);/*
@@ -234,29 +251,42 @@ static int __devinit neponset_probe(struct platform_device *dev)*/ NCR_0 =NCR_GP01_OFF ; +platform_set_drvdata (dev, d); +return 0 ; + + err_alloc: +return ret; } -#ifdef CONFIG_PM +static int __devexit neponset_remove(struct platform_device *dev) +{ +struct neponset_drvdata *d =platform_get_drvdata (dev); -/* -* LDM power management. -*/ -static unsigned int neponset_saved_state; +irq_set_chained_handler (IRQ_GPIO25 ,NULL ); + +kfree (d); + +return 0 ; +} +#ifdef CONFIG_PM static int neponset_suspend (struct platform_device *dev,pm_message_t state) { -/* -* Save state. -*/ - neponset_saved_state =NCR_0 ; +struct neponset_drvdata *d =platform_get_drvdata (dev); + + d->ncr0 =NCR_0 ; + d->mdm_ctl_0 =MDM_CTL_0 ;return 0 ; }static int neponset_resume (struct platform_device *dev) { -NCR_0 = neponset_saved_state; +struct neponset_drvdata *d =platform_get_drvdata (dev); + +NCR_0 = d->ncr0; +MDM_CTL_0 = d->mdm_ctl_0;return 0 ; }
@@ -268,6 +298,7 @@ static int neponset_resume(struct platform_device *dev)static struct platform_driver neponset_device_driver = { .probe = neponset_probe, + .remove =__devexit_p (neponset_remove), .suspend = neponset_suspend, .resume = neponset_resume, .driver = {
Signature · 1 line
1.7.4.4
PATCH 10/17 ARM: sa11x0: neponset: dynamically create neponset child devices
In reply to Russell King - ARM LinuxUse platform_device_register_full() to dynamically create the various neponset child platform devices, and place them below the neponset device itself to ensure proper PM ordering and device structure.
--- arch/arm/mach-sa1100/neponset.c | 56 +++++++++++++++++++------------------- 1 files changed, 28 insertions(+), 28 deletions(-)
arch/arm/mach-sa1100/neponset.c +28 -28
@@ -1,6 +1,7 @@/* * linux/arch/arm/mach-sa1100/neponset.c */ +#include <linux/err.h> #include <linux/init.h> #include <linux/ioport.h> #include <linux/kernel.h>
@@ -22,6 +23,8 @@#include <mach/neponset.h> struct neponset_drvdata { +struct platform_device *sa1111; +struct platform_device *smc91x;#ifdef CONFIG_PM_SLEEP u32 ncr0;u32 mdm_ctl_0;
@@ -178,20 +181,6 @@ static struct sa1111_platform_data sa1111_info = { .irq_base = IRQ_BOARD_END, }; -static u64 sa1111_dmamask =0xffffffffUL ; - -static struct platform_device sa1111_device = { - .name ="sa1111" , - .id =0 , - .dev = { - .dma_mask = &sa1111_dmamask, - .coherent_dma_mask =0xffffffff , - .platform_data = &sa1111_info, - }, - .num_resources =ARRAY_SIZE (sa1111_resources), - .resource = sa1111_resources, -}; -static struct resource smc91x_resources[] = { [0 ] =DEFINE_RES_MEM_NAMED (SA1100_CS3_PHYS ,0x02000000 ,"smc91x-regs" ), [1 ] =DEFINE_RES_IRQ (IRQ_NEPONSET_SMC9196 ),
@@ -199,16 +188,26 @@ static struct resource smc91x_resources[] = { 0x02000000, "smc91x-attrib"), }; -static struct platform_device smc91x_device = { - .name ="smc91x" , - .id =0 , - .num_resources =ARRAY_SIZE (smc91x_resources), - .resource = smc91x_resources, -}; -static int __devinit neponset_probe (struct platform_device *dev) {struct neponset_drvdata *d; +struct platform_device_info sa1111_devinfo = { + .parent = &dev->dev, + .name ="sa1111" , + .id =0 , + .res = sa1111_resources, + .num_res =ARRAY_SIZE (sa1111_resources), + .data = &sa1111_info, + .size_data =sizeof (sa1111_info), + .dma_mask =0xffffffffUL , + }; +struct platform_device_info smc91x_devinfo = { + .parent = &dev->dev, + .name ="smc91x" , + .id =0 , + .res = smc91x_resources, + .num_res =ARRAY_SIZE (smc91x_resources), + };int ret; d =kzalloc (sizeof (*d),GFP_KERNEL );
@@ -251,6 +250,9 @@ static int __devinit neponset_probe(struct platform_device *dev)*/ NCR_0 =NCR_GP01_OFF ; + d->sa1111 =platform_device_register_full (&sa1111_devinfo); + d->smc91x =platform_device_register_full (&smc91x_devinfo); +platform_set_drvdata (dev, d);return 0 ;
@@ -263,6 +265,10 @@ static int __devexit neponset_remove(struct platform_device *dev) {struct neponset_drvdata *d =platform_get_drvdata (dev); +if (!IS_ERR (d->sa1111)) +platform_device_unregister (d->sa1111); +if (!IS_ERR (d->smc91x)) +platform_device_unregister (d->smc91x);irq_set_chained_handler (IRQ_GPIO25 ,NULL );kfree (d);
@@ -318,12 +324,6 @@ static struct platform_device neponset_device = { .resource = neponset_resources, }; -static struct platform_device *devices[]__initdata = { - &neponset_device, - &sa1111_device, - &smc91x_device, -}; -extern void sa1110_mb_disable (void );static int __init neponset_init (void )
@@ -354,7 +354,7 @@ static int __init neponset_init(void)return -ENODEV ; } -return platform_add_devices (devices,ARRAY_SIZE (devices)); +return platform_device_register (&neponset_device); }subsys_initcall (neponset_init);
Signature · 1 line
1.7.4.4
PATCH 11/17 ARM: sa11x0: neponset: implement support for sparse IRQs
In reply to Russell King - ARM LinuxImplement the necessary allocation/freeing functionality to support sparse IRQs with the Neponset device. On non-sparse IRQ platforms, this allows us to dynamically allocate from within the available IRQ number space.
--- arch/arm/mach-sa1100/include/mach/irqs.h | 8 -- arch/arm/mach-sa1100/neponset.c | 111 ++++++++++++++++------------- 2 files changed, 61 insertions(+), 58 deletions(-)
arch/arm/mach-sa1100/include/mach/irqs.h +0 -8
@@ -82,11 +82,3 @@#else #define NR_IRQS (IRQ_BOARD_START)#endif - -/* -* Board specific IRQs. Define them here. -* Do not surround them with ifdefs. -*/ -#define IRQ_NEPONSET_SMC9196 (IRQ_BOARD_START + 0) -#define IRQ_NEPONSET_USAR (IRQ_BOARD_START + 1) -#define IRQ_NEPONSET_SA1111 (IRQ_BOARD_START + 2)
arch/arm/mach-sa1100/neponset.c +61 -50
205 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 12/17 ARM: sa11x0: neponset: get parent IRQ from neponset device resource
In reply to Russell King - ARM LinuxObtain the parent IRQ from the neponset device resource rather than hard-coding it into the code.
--- arch/arm/mach-sa1100/neponset.c | 20 +++++++++++++------- 1 files changed, 13 insertions(+), 7 deletions(-)
arch/arm/mach-sa1100/neponset.c +13 -7
@@ -207,7 +207,11 @@ static int __devinit neponset_probe(struct platform_device *dev) .res = smc91x_resources, .num_res = ARRAY_SIZE(smc91x_resources), }; -int ret; +int ret, irq; + + irq = ret =platform_get_irq (dev,0 ); +if (ret <0 ) + goto err_alloc; d =kzalloc (sizeof (*d),GFP_KERNEL );if (!d) {
@@ -234,16 +238,16 @@ static int __devinit neponset_probe(struct platform_device *dev)set_irq_flags (d->irq_base +NEP_IRQ_USAR ,IRQF_VALID |IRQF_PROBE );irq_set_chip (d->irq_base +NEP_IRQ_SA1111 , &nochip); -irq_set_irq_type (IRQ_GPIO25 ,IRQ_TYPE_EDGE_RISING ); -irq_set_handler_data (IRQ_GPIO25 , d); -irq_set_chained_handler (IRQ_GPIO25 , neponset_irq_handler); +irq_set_irq_type (irq,IRQ_TYPE_EDGE_RISING ); +irq_set_handler_data (irq, d); +irq_set_chained_handler (irq, neponset_irq_handler);/* * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately * something on the Neponset activates this IRQ on sleep (eth?) */ #if 0 -enable_irq_wake (IRQ_GPIO25 ); +enable_irq_wake (irq);#endif dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
@@ -275,12 +279,13 @@ static int __devinit neponset_probe(struct platform_device *dev) static int __devexit neponset_remove(struct platform_device *dev) {struct neponset_drvdata *d =platform_get_drvdata (dev); +int irq =platform_get_irq (dev,0 );if (!IS_ERR (d->sa1111))platform_device_unregister (d->sa1111);if (!IS_ERR (d->smc91x))platform_device_unregister (d->smc91x); -irq_set_chained_handler (IRQ_GPIO25 ,NULL ); +irq_set_chained_handler (irq,NULL );irq_free_descs (d->irq_base,NEP_IRQ_NR );kfree (d);
@@ -325,7 +330,8 @@ static struct platform_driver neponset_device_driver = { };static struct resource neponset_resources[] = { - [0 ] =DEFINE_RES_MEM (0x10000000 ,0x08000000 ), +DEFINE_RES_MEM (0x10000000 ,0x08000000 ), +DEFINE_RES_IRQ (IRQ_GPIO25 ), };static struct platform_device neponset_device = {
Signature · 1 line
1.7.4.4
PATCH 13/17 ARM: sa11x0: neponset: place smc91x and sa1111 resources in neponset device
In reply to Russell King - ARM LinuxComplete the neponset device resources by covering the children's memory resources in the parent neponset device.
--- arch/arm/mach-sa1100/neponset.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/mach-sa1100/neponset.c +13 -0
@@ -179,6 +179,7 @@ static struct sa1111_platform_data sa1111_info = {static int __devinit neponset_probe (struct platform_device *dev) {struct neponset_drvdata *d; +struct resource *sa1111_res, *smc91x_res;struct resource sa1111_resources[] = {DEFINE_RES_MEM (0x40000000 ,SZ_8K ), { .flags =IORESOURCE_IRQ },
@@ -213,6 +214,13 @@ static int __devinit neponset_probe(struct platform_device *dev)if (ret <0 ) goto err_alloc; + smc91x_res =platform_get_resource (dev,IORESOURCE_MEM ,1 ); + sa1111_res =platform_get_resource (dev,IORESOURCE_MEM ,2 ); +if (!smc91x_res || !sa1111_res) { + ret = -ENXIO ; + goto err_alloc; + } + d =kzalloc (sizeof (*d),GFP_KERNEL );if (!d) { ret = -ENOMEM ;
@@ -258,10 +266,13 @@ static int __devinit neponset_probe(struct platform_device *dev)/* Disable GPIO 0/1 drivers so the buttons work on the Assabet */ NCR_0 =NCR_GP01_OFF ; + sa1111_resources[0 ].parent = sa1111_res; sa1111_resources[1 ].start = d->irq_base +NEP_IRQ_SA1111 ; sa1111_resources[1 ].end = d->irq_base +NEP_IRQ_SA1111 ; d->sa1111 =platform_device_register_full (&sa1111_devinfo); + smc91x_resources[0 ].parent = smc91x_res; + smc91x_resources[1 ].parent = smc91x_res; smc91x_resources[2 ].start = d->irq_base +NEP_IRQ_SMC91X ; smc91x_resources[2 ].end = d->irq_base +NEP_IRQ_SMC91X ; d->smc91x =platform_device_register_full (&smc91x_devinfo);
@@ -331,6 +342,8 @@ static struct platform_driver neponset_device_driver = {static struct resource neponset_resources[] = {DEFINE_RES_MEM (0x10000000 ,0x08000000 ), +DEFINE_RES_MEM (0x18000000 ,0x04000000 ), +DEFINE_RES_MEM (0x40000000 ,SZ_8K ),DEFINE_RES_IRQ (IRQ_GPIO25 ), };
Signature · 1 line
1.7.4.4
PATCH 14/17 ARM: sa11x0: neponset: suspend/resume in _noirq state
In reply to Russell King - ARM LinuxSuspend and resume in the _noirq state, so that we're saving the state of the modem control signals as late as possible, and restoring them as early as possible. There's nothing to do in thaw/poweroff methods as we've already saved the necessary state.
--- arch/arm/mach-sa1100/neponset.c | 24 +++++++++++++++--------- 1 files changed, 15 insertions(+), 9 deletions(-)
arch/arm/mach-sa1100/neponset.c +15 -9
@@ -8,6 +8,7 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/pm.h> #include <linux/serial_core.h> #include <linux/slab.h>
@@ -303,10 +304,10 @@ static int __devexit neponset_remove(struct platform_device *dev)return 0 ; } -#ifdef CONFIG_PM -static int neponset_suspend (struct platform_device *dev,pm_message_t state) +#ifdef CONFIG_PM_SLEEP +static int neponset_suspend (struct device *dev) { -struct neponset_drvdata *d =platform_get_drvdata (dev); +struct neponset_drvdata *d =dev_get_drvdata (dev); d->ncr0 =NCR_0 ; d->mdm_ctl_0 =MDM_CTL_0 ;
@@ -314,9 +315,9 @@ static int neponset_suspend(struct platform_device *dev, pm_message_t state)return 0 ; } -static int neponset_resume (struct platform_device *dev) +static int neponset_resume (struct device *dev) { -struct neponset_drvdata *d =platform_get_drvdata (dev); +struct neponset_drvdata *d =dev_get_drvdata (dev);NCR_0 = d->ncr0;MDM_CTL_0 = d->mdm_ctl_0;
@@ -324,19 +325,24 @@ static int neponset_resume(struct platform_device *dev) return 0; } +static const struct dev_pm_ops neponset_pm_ops = { + .suspend_noirq = neponset_suspend, + .resume_noirq = neponset_resume, + .freeze_noirq = neponset_suspend, + .restore_noirq = neponset_resume, +}; +#define PM_OPS &neponset_pm_ops#else -#define neponset_suspend NULL -#define neponset_resume NULL +#define PM_OPS NULL#endif static struct platform_driver neponset_device_driver = { .probe = neponset_probe, .remove =__devexit_p (neponset_remove), - .suspend = neponset_suspend, - .resume = neponset_resume, .driver = { .name ="neponset" , .owner =THIS_MODULE , + .pm =PM_OPS , }, };
Signature · 1 line
1.7.4.4
PATCH 15/17 ARM: sa11x0: assabet/neponest: create neponset device in assabet.c
In reply to Russell King - ARM LinuxThe neponset board is a daughter board for the Assabet. Create the neponset platform device in assabet.c, where we don't have to wrap it with machine_is_assabet() stuff. We also create this device dynamically rather than keeping it as a static device.
--- arch/arm/mach-sa1100/assabet.c | 12 ++++++++ arch/arm/mach-sa1100/neponset.c | 56 +++++++++------------------------------ 2 files changed, 25 insertions(+), 43 deletions(-)
arch/arm/mach-sa1100/assabet.c +12 -0
@@ -197,6 +197,15 @@ static struct mcp_plat_data assabet_mcp_data = { .sclk_rate = 11981000, }; +#ifdef CONFIG_ASSABET_NEPONSET +static struct resource neponset_resources[] = { +DEFINE_RES_MEM (0x10000000 ,0x08000000 ), +DEFINE_RES_MEM (0x18000000 ,0x04000000 ), +DEFINE_RES_MEM (0x40000000 ,SZ_8K ), +DEFINE_RES_IRQ (IRQ_GPIO25 ), +}; +#endif +static void __init assabet_init (void ) {/*
@@ -247,6 +256,9 @@ static void __init assabet_init(void)#ifndef CONFIG_ASSABET_NEPONSET printk ("Warning: Neponset detected but full support " "hasn't been configured in the kernel\n" ); +#else +platform_device_register_simple ("neponset" ,0 , + neponset_resources,ARRAY_SIZE (neponset_resources));#endif }
arch/arm/mach-sa1100/neponset.c +13 -43
82 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 16/17 ARM: sa11x0: neponset: move register definitions to neponset.c
In reply to Russell King - ARM LinuxMove the board specific neponset register definitions to the board file, rather than mach/neponset.h. However, as the NCR_0 register definitions are used by some drivers, leave these behind.
--- arch/arm/mach-sa1100/include/mach/neponset.h | 48 ----------- arch/arm/mach-sa1100/neponset.c | 114 ++++++++++++++++++++----- 2 files changed, 91 insertions(+), 71 deletions(-)
arch/arm/mach-sa1100/include/mach/neponset.h +0 -48
@@ -15,54 +15,6 @@/* * Neponset definitions: */ - -#define NEPONSET_CPLD_BASE (0x10000000) -#define Nep_p2v ( x ) ((x) - NEPONSET_CPLD_BASE + 0xf3000000) -#define Nep_v2p ( x ) ((x) - 0xf3000000 + NEPONSET_CPLD_BASE) - -#define _IRR 0x10000024/* Interrupt Reason Register */ -#define _AUD_CTL 0x100000c0/* Audio controls (RW) */ -#define _MDM_CTL_0 0x100000b0/* Modem control 0 (RW) */ -#define _MDM_CTL_1 0x100000b4/* Modem control 1 (RW) */ -#define _NCR_0 0x100000a0/* Control Register (RW) */ -#define _KP_X_OUT 0x10000090/* Keypad row write (RW) */ -#define _KP_Y_IN 0x10000080/* Keypad column read (RO) */ -#define _SWPK 0x10000020/* Switch pack (RO) */ -#define _WHOAMI 0x10000000/* System ID Register (RO) */ - -#define _LEDS 0x10000010/* LEDs [31:0] (WO) */ - -#define IRR (*((volatile u_char *) Nep_p2v(_IRR))) -#define AUD_CTL (*((volatile u_char *) Nep_p2v(_AUD_CTL))) -#define MDM_CTL_0 (*((volatile u_char *) Nep_p2v(_MDM_CTL_0))) -#define MDM_CTL_1 (*((volatile u_char *) Nep_p2v(_MDM_CTL_1))) -#define NCR_0 (*((volatile u_char *) Nep_p2v(_NCR_0))) -#define KP_X_OUT (*((volatile u_char *) Nep_p2v(_KP_X_OUT))) -#define KP_Y_IN (*((volatile u_char *) Nep_p2v(_KP_Y_IN))) -#define SWPK (*((volatile u_char *) Nep_p2v(_SWPK))) -#define WHOAMI (*((volatile u_char *) Nep_p2v(_WHOAMI))) - -#define LEDS (*((volatile Word *) Nep_p2v(_LEDS))) - -#define IRR_ETHERNET (1<<0) -#define IRR_USAR (1<<1) -#define IRR_SA1111 (1<<2) - -#define AUD_SEL_1341 (1<<0) -#define AUD_MUTE_1341 (1<<1) - -#define MDM_CTL0_RTS1 (1 << 0) -#define MDM_CTL0_DTR1 (1 << 1) -#define MDM_CTL0_RTS2 (1 << 2) -#define MDM_CTL0_DTR2 (1 << 3) - -#define MDM_CTL1_CTS1 (1 << 0) -#define MDM_CTL1_DSR1 (1 << 1) -#define MDM_CTL1_DCD1 (1 << 2) -#define MDM_CTL1_CTS2 (1 << 3) -#define MDM_CTL1_DSR2 (1 << 4) -#define MDM_CTL1_DCD2 (1 << 5) -#define NCR_GP01_OFF (1<<0)#define NCR_TP_PWR_EN (1<<1)#define NCR_MS_PWR_EN (1<<2)
arch/arm/mach-sa1100/neponset.c +91 -23
218 lines not on this page · raw message
Signature · 1 line
1.7.4.4
PATCH 17/17 ARM: sa11x0: neponset: don't static map neponset registers
In reply to Russell King - ARM LinuxNow that we ioremap() the neponset register space, there's no need to static map the neponset registers. Get rid of this static mapping.
--- arch/arm/mach-sa1100/neponset.c | 7 +------ 1 files changed, 1 insertions(+), 6 deletions(-)
arch/arm/mach-sa1100/neponset.c +1 -6
@@ -434,12 +434,7 @@ static int __init neponset_init(void)subsys_initcall (neponset_init);static struct map_desc neponset_io_desc[]__initdata = { - {/* System Registers */ - .virtual =0xf3000000 , - .pfn =__phys_to_pfn (0x10000000 ), - .length =SZ_1M , - .type =MT_DEVICE - }, {/* SA-1111 */ + {/* SA-1111 */ .virtual =0xf4000000 , .pfn =__phys_to_pfn (0x40000000 ), .length =SZ_1M ,
Signature · 1 line
1.7.4.4
Nicolas Pitre
maintainercover SA11x0 cleanups (mainly assabet/neponset)
In reply to Russell King - ARM LinuxQuoted 26 lines · Russell King - ARM Linux
This is a series of cleanups and improvements to the SA11x0 code, in particular the Assabet, and Assabet with the Neponset daughter board.
The main SA11x0 change is to switch to using the
DEFINE_RES_xxx()for resources, which obviously reduces the lines of code quite a bit.The Assabet-only changes reduce power consumption of the board, and illustrate why pins left as inputs when they're supposed to be outputs are bad news - while it's undriven, it floats and increases the power consumption by a measurable amount.
Neponset wise, there's fixes in here to restore it to fully working state (rather than just being buildable.) Unfortunately, genirq had seriously broken the Neponset interrupt support code by genirq having some 'improved checks' added without auditing the genirq users.
Neponset also gets ready for sparse IRQ support, meaning that its interrupt numbers are no longer statically fixed. We also move the registration of the neponset device to assabet, which helps reduce the knowledge spread of whether the board is fitted.
The random places which the
NCR_0board register is written are turned into a function call instead, so that theNCR_0register access can be centralized and properly protected against concurrent access for this platform.
Quoted 4 lines
Since neponset becomes mostly self-contained, most of the boards CPLD register definitions are moved to the board file rather than exposing them in the board header file. That then paves the way to get rid of its static mapping for its own registers, using
ioremap()instead.
I've quickly looked through this series and this all looks sensible.
My knowledge of the SA1111 chip was never extensive, and the little I had did fade away at this point. So it might not be relevant for me to give any comment on the other series. Except that I thought that DMA was terminally broken on that chip, hence I'm surprized to see OHCI support for it.
Nicolas
cover SA11x0 cleanups (mainly assabet/neponset)
Quoted 3 lines · Nicolas Pitre
I've quickly looked through this series and this all looks sensible.
Acked-by Nicolas Pitre <[email protected]>
Thanks.
Quoted 5 lines
My knowledge of the SA1111 chip was never extensive, and the little I had did fade away at this point. So it might not be relevant for me to give any comment on the other series. Except that I thought that DMA was terminally broken on that chip, hence I'm surprized to see OHCI support for it.
It is rather badly broken, but the hack to move the kernel 1MB into SDRAM and dmabounce continues to do their jobs, making it work.
And let's also not forget that the errata documentation was (probably) one of the worst - I have this comment from years back in the code...
/*
* Don't believe the specs! Take them, throw them outside. Leave them
* there for a week. Spit on them. Walk on them. Stamp on them.
* Pour gasoline over them and finally burn them. Now think about coding.
* - The October 1999 errata (278260-007) says its bit 13, 1 to enable.
* - The Feb 2001 errata (278260-010) says that the previous errata
* (278260-009) is wrong, and its bit actually 12, fixed in spec
* 278242-003.
* - The SA1111 manual (278242) says bit 12, but 0 to enable.
* - Reality is bit 13, 1 to enable.
* -- rmk
*/
#define SKCR_OE_EN (1<<13)
In those days, we had specifications on paper!