* [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset)
@ 2012-02-03 19:30 Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 01/17] ARM: sa11x0: convert to use DEFINE_RES_xxx macros Russell King - ARM Linux
` (17 more replies)
0 siblings, 18 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:30 UTC (permalink / raw)
To: linux-arm-kernel
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(-)
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 01/17] ARM: sa11x0: convert to use DEFINE_RES_xxx macros
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
@ 2012-02-03 19:31 ` Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 02/17] ARM: sa11x0: assabet: deassert QMUTE to codec while codec is unpowered Russell King - ARM Linux
` (16 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:31 UTC (permalink / raw)
To: linux-arm-kernel
Convert StrongARM-11x0 platforms and core SoC code to use the
DEFINE_RES_xxx macros.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
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(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 0c4b76a..642f3b3 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -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),
};
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index b07a2c0..ce2dbdf 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -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;
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 11bb6d0..c2f9ba3 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -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)
{
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index fd56521..dbe5cf7 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -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)
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 0e356bb..2b33b45 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -149,16 +149,8 @@ static void sa11x0_register_device(struct platform_device *dev, void *data)
static struct resource sa11x0udc_resources[] = {
- [0] = {
- .start = __PREG(Ser0UDCCR),
- .end = __PREG(Ser0UDCCR) + 0xffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_Ser0UDC,
- .end = IRQ_Ser0UDC,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(__PREG(Ser0UDCCR), SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_Ser0UDC),
};
static u64 sa11x0udc_dma_mask = 0xffffffffUL;
@@ -175,16 +167,8 @@ static struct platform_device sa11x0udc_device = {
};
static struct resource sa11x0uart1_resources[] = {
- [0] = {
- .start = __PREG(Ser1UTCR0),
- .end = __PREG(Ser1UTCR0) + 0xffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_Ser1UART,
- .end = IRQ_Ser1UART,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(__PREG(Ser1UTCR0), SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_Ser1UART),
};
static struct platform_device sa11x0uart1_device = {
@@ -195,16 +179,8 @@ static struct platform_device sa11x0uart1_device = {
};
static struct resource sa11x0uart3_resources[] = {
- [0] = {
- .start = __PREG(Ser3UTCR0),
- .end = __PREG(Ser3UTCR0) + 0xffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_Ser3UART,
- .end = IRQ_Ser3UART,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(__PREG(Ser3UTCR0), SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_Ser3UART),
};
static struct platform_device sa11x0uart3_device = {
@@ -215,16 +191,8 @@ static struct platform_device sa11x0uart3_device = {
};
static struct resource sa11x0mcp_resources[] = {
- [0] = {
- .start = __PREG(Ser4MCCR0),
- .end = __PREG(Ser4MCCR0) + 0xffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_Ser4MCP,
- .end = IRQ_Ser4MCP,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(__PREG(Ser4MCCR0), SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_Ser4MCP),
};
static u64 sa11x0mcp_dma_mask = 0xffffffffUL;
@@ -246,16 +214,8 @@ void sa11x0_register_mcp(struct mcp_plat_data *data)
}
static struct resource sa11x0ssp_resources[] = {
- [0] = {
- .start = 0x80070000,
- .end = 0x8007ffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_Ser4SSP,
- .end = IRQ_Ser4SSP,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(0x80070000, SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_Ser4SSP),
};
static u64 sa11x0ssp_dma_mask = 0xffffffffUL;
@@ -272,16 +232,8 @@ static struct platform_device sa11x0ssp_device = {
};
static struct resource sa11x0fb_resources[] = {
- [0] = {
- .start = 0xb0100000,
- .end = 0xb010ffff,
- .flags = IORESOURCE_MEM,
- },
- [1] = {
- .start = IRQ_LCD,
- .end = IRQ_LCD,
- .flags = IORESOURCE_IRQ,
- },
+ [0] = DEFINE_RES_MEM(0xb0100000, SZ_64K),
+ [1] = DEFINE_RES_IRQ(IRQ_LCD),
};
static struct platform_device sa11x0fb_device = {
@@ -314,23 +266,10 @@ void sa11x0_register_mtd(struct flash_platform_data *flash,
}
static struct resource sa11x0ir_resources[] = {
- {
- .start = __PREG(Ser2UTCR0),
- .end = __PREG(Ser2UTCR0) + 0x24 - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = __PREG(Ser2HSCR0),
- .end = __PREG(Ser2HSCR0) + 0x1c - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = __PREG(Ser2HSCR2),
- .end = __PREG(Ser2HSCR2) + 0x04 - 1,
- .flags = IORESOURCE_MEM,
- }, {
- .start = IRQ_Ser2ICP,
- .end = IRQ_Ser2ICP,
- .flags = IORESOURCE_IRQ,
- }
+ DEFINE_RES_MEM(__PREG(Ser2UTCR0), 0x24),
+ DEFINE_RES_MEM(__PREG(Ser2HSCR0), 0x1c),
+ DEFINE_RES_MEM(__PREG(Ser2HSCR2), 0x04),
+ DEFINE_RES_IRQ(IRQ_Ser2ICP),
};
static struct platform_device sa11x0ir_device = {
diff --git a/arch/arm/mach-sa1100/h3xxx.c b/arch/arm/mach-sa1100/h3xxx.c
index b0784c9..63150e1 100644
--- a/arch/arm/mach-sa1100/h3xxx.c
+++ b/arch/arm/mach-sa1100/h3xxx.c
@@ -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[] = {
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index 9092b3a..37d381a 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -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)
{
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index dfbf824..5d12a30 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -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;
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index 5393b06..8512cfc 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -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)
{
diff --git a/arch/arm/mach-sa1100/nanoengine.c b/arch/arm/mach-sa1100/nanoengine.c
index 85f6ee6..3923911 100644
--- a/arch/arm/mach-sa1100/nanoengine.c
+++ b/arch/arm/mach-sa1100/nanoengine.c
@@ -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 = {
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index b4fa53a..abbe859 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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 = {
diff --git a/arch/arm/mach-sa1100/pci-nanoengine.c b/arch/arm/mach-sa1100/pci-nanoengine.c
index 0d01ca7..41bb018 100644
--- a/arch/arm/mach-sa1100/pci-nanoengine.c
+++ b/arch/arm/mach-sa1100/pci-nanoengine.c
@@ -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",
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 9307df0..ca5d33b 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -37,17 +37,9 @@
#define IRQ_GPIO_ETH0_IRQ IRQ_GPIO21
static 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),
};
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 318b2b7..5fd6156 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -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,
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index e17c04d..cdb9d19 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -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 = {
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 02/17] ARM: sa11x0: assabet: deassert QMUTE to codec while codec is unpowered
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 01/17] ARM: sa11x0: convert to use DEFINE_RES_xxx macros Russell King - ARM Linux
@ 2012-02-03 19:31 ` Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 03/17] ARM: sa11x0: assabet: avoid glitching GPIOs when setting outputs Russell King - ARM Linux
` (15 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:31 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 642f3b3..3a3282e 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -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 | \
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 03/17] ARM: sa11x0: assabet: avoid glitching GPIOs when setting outputs
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 01/17] ARM: sa11x0: convert to use DEFINE_RES_xxx macros Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 02/17] ARM: sa11x0: assabet: deassert QMUTE to codec while codec is unpowered Russell King - ARM Linux
@ 2012-02-03 19:32 ` Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 04/17] ARM: sa11x0: assabet: ensure that GPIO27 is driven Russell King - ARM Linux
` (14 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:32 UTC (permalink / raw)
To: linux-arm-kernel
Avoid 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 3a3282e..6356896 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -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.
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 04/17] ARM: sa11x0: assabet: ensure that GPIO27 is driven
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (2 preceding siblings ...)
2012-02-03 19:32 ` [PATCH 03/17] ARM: sa11x0: assabet: avoid glitching GPIOs when setting outputs Russell King - ARM Linux
@ 2012-02-03 19:32 ` Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 05/17] ARM: sa11x0: neponset: fix interrupt setup Russell King - ARM Linux
` (13 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:32 UTC (permalink / raw)
To: linux-arm-kernel
GPIO27 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index 6356896..e3805d4 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -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;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 05/17] ARM: sa11x0: neponset: fix interrupt setup
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (3 preceding siblings ...)
2012-02-03 19:32 ` [PATCH 04/17] ARM: sa11x0: assabet: ensure that GPIO27 is driven Russell King - ARM Linux
@ 2012-02-03 19:32 ` Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 06/17] ARM: sa11x0: neponset: provide function to manipulate NCR_0 Russell King - ARM Linux
` (12 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:32 UTC (permalink / raw)
To: linux-arm-kernel
Since 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index abbe859..6a14d37 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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.
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 06/17] ARM: sa11x0: neponset: provide function to manipulate NCR_0
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (4 preceding siblings ...)
2012-02-03 19:32 ` [PATCH 05/17] ARM: sa11x0: neponset: fix interrupt setup Russell King - ARM Linux
@ 2012-02-03 19:33 ` Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 07/17] ARM: sa11x0: neponset: shuffle some code around Russell King - ARM Linux
` (11 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:33 UTC (permalink / raw)
To: linux-arm-kernel
Rather 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
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(-)
diff --git a/arch/arm/mach-sa1100/include/mach/neponset.h b/arch/arm/mach-sa1100/include/mach/neponset.h
index ffe2bc4..6032216 100644
--- a/arch/arm/mach-sa1100/include/mach/neponset.h
+++ b/arch/arm/mach-sa1100/include/mach/neponset.h
@@ -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
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 6a14d37..10be07e 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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
diff --git a/drivers/net/ethernet/smsc/smc91x.c b/drivers/net/ethernet/smsc/smc91x.c
index 64ad3ed..0dba050 100644
--- a/drivers/net/ethernet/smsc/smc91x.c
+++ b/drivers/net/ethernet/smsc/smc91x.c
@@ -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);
diff --git a/drivers/pcmcia/sa1100_neponset.c b/drivers/pcmcia/sa1100_neponset.c
index c95639b..4300a7f 100644
--- a/drivers/pcmcia/sa1100_neponset.c
+++ b/drivers/pcmcia/sa1100_neponset.c
@@ -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);
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 07/17] ARM: sa11x0: neponset: shuffle some code around
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (5 preceding siblings ...)
2012-02-03 19:33 ` [PATCH 06/17] ARM: sa11x0: neponset: provide function to manipulate NCR_0 Russell King - ARM Linux
@ 2012-02-03 19:33 ` Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 08/17] ARM: sa11x0: neponset: add driver .owner initializer Russell King - ARM Linux
` (10 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:33 UTC (permalink / raw)
To: linux-arm-kernel
Move the IRQ handler along side the rest of the IRQ code, and rearrange
the include files.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 202 +++++++++++++++++++-------------------
1 files changed, 101 insertions(+), 101 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 10be07e..8fcd542 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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,
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 08/17] ARM: sa11x0: neponset: add driver .owner initializer
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (6 preceding siblings ...)
2012-02-03 19:33 ` [PATCH 07/17] ARM: sa11x0: neponset: shuffle some code around Russell King - ARM Linux
@ 2012-02-03 19:33 ` Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 09/17] ARM: sa11x0: neponset: save and restore MDM_CTL_0 Russell King - ARM Linux
` (9 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:33 UTC (permalink / raw)
To: linux-arm-kernel
Ensure that the driver .owner field is properly initialized.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 8fcd542..1beaa0e 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -272,6 +272,7 @@ static struct platform_driver neponset_device_driver = {
.resume = neponset_resume,
.driver = {
.name = "neponset",
+ .owner = THIS_MODULE,
},
};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 09/17] ARM: sa11x0: neponset: save and restore MDM_CTL_0
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (7 preceding siblings ...)
2012-02-03 19:33 ` [PATCH 08/17] ARM: sa11x0: neponset: add driver .owner initializer Russell King - ARM Linux
@ 2012-02-03 19:34 ` Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 10/17] ARM: sa11x0: neponset: dynamically create neponset child devices Russell King - ARM Linux
` (8 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:34 UTC (permalink / raw)
To: linux-arm-kernel
Save 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 53 ++++++++++++++++++++++++++++++--------
1 files changed, 42 insertions(+), 11 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 1beaa0e..6f0aa91 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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 = {
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 10/17] ARM: sa11x0: neponset: dynamically create neponset child devices
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (8 preceding siblings ...)
2012-02-03 19:34 ` [PATCH 09/17] ARM: sa11x0: neponset: save and restore MDM_CTL_0 Russell King - ARM Linux
@ 2012-02-03 19:34 ` Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 11/17] ARM: sa11x0: neponset: implement support for sparse IRQs Russell King - ARM Linux
` (7 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:34 UTC (permalink / raw)
To: linux-arm-kernel
Use 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 56 +++++++++++++++++++-------------------
1 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 6f0aa91..164bc98 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 11/17] ARM: sa11x0: neponset: implement support for sparse IRQs
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (9 preceding siblings ...)
2012-02-03 19:34 ` [PATCH 10/17] ARM: sa11x0: neponset: dynamically create neponset child devices Russell King - ARM Linux
@ 2012-02-03 19:34 ` Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 12/17] ARM: sa11x0: neponset: get parent IRQ from neponset device resource Russell King - ARM Linux
` (6 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:34 UTC (permalink / raw)
To: linux-arm-kernel
Implement 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/include/mach/irqs.h | 8 --
arch/arm/mach-sa1100/neponset.c | 111 ++++++++++++++++-------------
2 files changed, 61 insertions(+), 58 deletions(-)
diff --git a/arch/arm/mach-sa1100/include/mach/irqs.h b/arch/arm/mach-sa1100/include/mach/irqs.h
index d18f21a..9e07634 100644
--- a/arch/arm/mach-sa1100/include/mach/irqs.h
+++ b/arch/arm/mach-sa1100/include/mach/irqs.h
@@ -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)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 164bc98..4768196 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -4,6 +4,7 @@
#include <linux/err.h>
#include <linux/init.h>
#include <linux/ioport.h>
+#include <linux/irq.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
@@ -11,9 +12,7 @@
#include <linux/slab.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 <asm/hardware/sa1111.h>
#include <asm/sizes.h>
@@ -22,9 +21,15 @@
#include <mach/assabet.h>
#include <mach/neponset.h>
+#define NEP_IRQ_SMC91X 0
+#define NEP_IRQ_USAR 1
+#define NEP_IRQ_SA1111 2
+#define NEP_IRQ_NR 3
+
struct neponset_drvdata {
struct platform_device *sa1111;
struct platform_device *smc91x;
+ unsigned irq_base;
#ifdef CONFIG_PM_SLEEP
u32 ncr0;
u32 mdm_ctl_0;
@@ -104,9 +109,9 @@ static struct sa1100_port_fns neponset_port_fns __devinitdata = {
* ensure that the IRQ signal is deasserted before returning. This
* is rather unfortunate.
*/
-static void
-neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
+static void neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
{
+ struct neponset_drvdata *d = irq_desc_get_handler_data(desc);
unsigned int irr;
while (1) {
@@ -141,26 +146,21 @@ neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
*/
desc->irq_data.chip->irq_ack(&desc->irq_data);
- if (irr & IRR_ETHERNET) {
- generic_handle_irq(IRQ_NEPONSET_SMC9196);
- }
+ if (irr & IRR_ETHERNET)
+ generic_handle_irq(d->irq_base + NEP_IRQ_SMC91X);
- if (irr & IRR_USAR) {
- generic_handle_irq(IRQ_NEPONSET_USAR);
- }
+ if (irr & IRR_USAR)
+ generic_handle_irq(d->irq_base + NEP_IRQ_USAR);
desc->irq_data.chip->irq_unmask(&desc->irq_data);
}
- if (irr & IRR_SA1111) {
- generic_handle_irq(IRQ_NEPONSET_SA1111);
- }
+ if (irr & IRR_SA1111)
+ generic_handle_irq(d->irq_base + NEP_IRQ_SA1111);
}
}
-/*
- * Yes, we really do not have any kind of masking or unmasking
- */
+/* Yes, we really do not have any kind of masking or unmasking */
static void nochip_noop(struct irq_data *irq)
{
}
@@ -172,25 +172,17 @@ 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 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 int __devinit neponset_probe(struct platform_device *dev)
{
struct neponset_drvdata *d;
+ struct resource sa1111_resources[] = {
+ DEFINE_RES_MEM(0x40000000, SZ_8K),
+ { .flags = IORESOURCE_IRQ },
+ };
struct platform_device_info sa1111_devinfo = {
.parent = &dev->dev,
.name = "sa1111",
@@ -201,6 +193,13 @@ static int __devinit neponset_probe(struct platform_device *dev)
.size_data = sizeof(sa1111_info),
.dma_mask = 0xffffffffUL,
};
+ struct resource smc91x_resources[] = {
+ DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS,
+ 0x02000000, "smc91x-regs"),
+ DEFINE_RES_MEM_NAMED(SA1100_CS3_PHYS + 0x02000000,
+ 0x02000000, "smc91x-attrib"),
+ { .flags = IORESOURCE_IRQ },
+ };
struct platform_device_info smc91x_devinfo = {
.parent = &dev->dev,
.name = "smc91x",
@@ -216,47 +215,59 @@ static int __devinit neponset_probe(struct platform_device *dev)
goto err_alloc;
}
- sa1100_register_uart_fns(&neponset_port_fns);
+ ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1);
+ if (ret <= 0) {
+ dev_err(&dev->dev, "unable to allocate %u irqs: %d\n",
+ NEP_IRQ_NR, ret);
+ if (ret == 0)
+ ret = -ENOMEM;
+ goto err_irq_alloc;
+ }
+
+ d->irq_base = ret;
+
+ irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip,
+ handle_simple_irq);
+ set_irq_flags(d->irq_base + NEP_IRQ_SMC91X, IRQF_VALID | IRQF_PROBE);
+ irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip,
+ handle_simple_irq);
+ set_irq_flags(d->irq_base + NEP_IRQ_USAR, IRQF_VALID | IRQF_PROBE);
+ irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip);
- /*
- * Install handler for GPIO25.
- */
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);
/*
- * We would set IRQ_GPIO25 to be a wake-up IRQ, but
- * unfortunately something on the Neponset activates
- * this IRQ on sleep (ethernet?)
+ * 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);
#endif
- /*
- * Setup other Neponset IRQs. SA1111 will be done by the
- * generic SA1111 code.
- */
- irq_set_chip_and_handler(IRQ_NEPONSET_SMC9196, &nochip,
- handle_simple_irq);
- set_irq_flags(IRQ_NEPONSET_SMC9196, IRQF_VALID | IRQF_PROBE);
- 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);
+ dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
+ d->irq_base, d->irq_base + NEP_IRQ_NR - 1);
- /*
- * Disable GPIO 0/1 drivers so the buttons work on the module.
- */
+ sa1100_register_uart_fns(&neponset_port_fns);
+
+ /* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
NCR_0 = NCR_GP01_OFF;
+ 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[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);
platform_set_drvdata(dev, d);
return 0;
+ err_irq_alloc:
+ kfree(d);
err_alloc:
return ret;
}
@@ -270,7 +281,7 @@ static int __devexit neponset_remove(struct platform_device *dev)
if (!IS_ERR(d->smc91x))
platform_device_unregister(d->smc91x);
irq_set_chained_handler(IRQ_GPIO25, NULL);
-
+ irq_free_descs(d->irq_base, NEP_IRQ_NR);
kfree(d);
return 0;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 12/17] ARM: sa11x0: neponset: get parent IRQ from neponset device resource
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (10 preceding siblings ...)
2012-02-03 19:34 ` [PATCH 11/17] ARM: sa11x0: neponset: implement support for sparse IRQs Russell King - ARM Linux
@ 2012-02-03 19:35 ` Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 13/17] ARM: sa11x0: neponset: place smc91x and sa1111 resources in neponset device Russell King - ARM Linux
` (5 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:35 UTC (permalink / raw)
To: linux-arm-kernel
Obtain the parent IRQ from the neponset device resource rather than
hard-coding it into the code.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 4768196..f4d5871 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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 = {
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 13/17] ARM: sa11x0: neponset: place smc91x and sa1111 resources in neponset device
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (11 preceding siblings ...)
2012-02-03 19:35 ` [PATCH 12/17] ARM: sa11x0: neponset: get parent IRQ from neponset device resource Russell King - ARM Linux
@ 2012-02-03 19:35 ` Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 14/17] ARM: sa11x0: neponset: suspend/resume in _noirq state Russell King - ARM Linux
` (4 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:35 UTC (permalink / raw)
To: linux-arm-kernel
Complete the neponset device resources by covering the children's
memory resources in the parent neponset device.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index f4d5871..2451a38 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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),
};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 14/17] ARM: sa11x0: neponset: suspend/resume in _noirq state
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (12 preceding siblings ...)
2012-02-03 19:35 ` [PATCH 13/17] ARM: sa11x0: neponset: place smc91x and sa1111 resources in neponset device Russell King - ARM Linux
@ 2012-02-03 19:35 ` Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 15/17] ARM: sa11x0: assabet/neponest: create neponset device in assabet.c Russell King - ARM Linux
` (3 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:35 UTC (permalink / raw)
To: linux-arm-kernel
Suspend 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 2451a38..59223ba 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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,
},
};
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 15/17] ARM: sa11x0: assabet/neponest: create neponset device in assabet.c
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (13 preceding siblings ...)
2012-02-03 19:35 ` [PATCH 14/17] ARM: sa11x0: neponset: suspend/resume in _noirq state Russell King - ARM Linux
@ 2012-02-03 19:36 ` Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 16/17] ARM: sa11x0: neponset: move register definitions to neponset.c Russell King - ARM Linux
` (2 subsequent siblings)
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:36 UTC (permalink / raw)
To: linux-arm-kernel
The 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/assabet.c | 12 ++++++++
arch/arm/mach-sa1100/neponset.c | 56 +++++++++------------------------------
2 files changed, 25 insertions(+), 43 deletions(-)
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index e3805d4..f2030bc 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -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
}
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 59223ba..2a9e1e2 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -27,6 +27,8 @@
#define NEP_IRQ_SA1111 2
#define NEP_IRQ_NR 3
+extern void sa1110_mb_disable(void);
+
struct neponset_drvdata {
struct platform_device *sa1111;
struct platform_device *smc91x;
@@ -222,6 +224,13 @@ static int __devinit neponset_probe(struct platform_device *dev)
goto err_alloc;
}
+ if (WHOAMI != 0x11) {
+ dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
+ WHOAMI);
+ ret = -ENODEV;
+ goto err_alloc;
+ }
+
d = kzalloc(sizeof(*d), GFP_KERNEL);
if (!d) {
ret = -ENOMEM;
@@ -264,6 +273,9 @@ static int __devinit neponset_probe(struct platform_device *dev)
sa1100_register_uart_fns(&neponset_port_fns);
+ /* Ensure that the memory bus request/grant signals are setup */
+ sa1110_mb_disable();
+
/* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
NCR_0 = NCR_GP01_OFF;
@@ -346,51 +358,9 @@ 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),
-};
-
-static struct platform_device neponset_device = {
- .name = "neponset",
- .id = 0,
- .num_resources = ARRAY_SIZE(neponset_resources),
- .resource = neponset_resources,
-};
-
-extern void sa1110_mb_disable(void);
-
static int __init neponset_init(void)
{
- platform_driver_register(&neponset_device_driver);
-
- /*
- * The Neponset is only present on the Assabet machine type.
- */
- if (!machine_is_assabet())
- return -ENODEV;
-
- /*
- * Ensure that the memory bus request/grant signals are setup,
- * and the grant is held in its inactive state, whether or not
- * we actually have a Neponset attached.
- */
- sa1110_mb_disable();
-
- if (!machine_has_neponset()) {
- printk(KERN_DEBUG "Neponset expansion board not present\n");
- return -ENODEV;
- }
-
- if (WHOAMI != 0x11) {
- printk(KERN_WARNING "Neponset board detected, but "
- "wrong ID: %02x\n", WHOAMI);
- return -ENODEV;
- }
-
- return platform_device_register(&neponset_device);
+ return platform_driver_register(&neponset_device_driver);
}
subsys_initcall(neponset_init);
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 16/17] ARM: sa11x0: neponset: move register definitions to neponset.c
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (14 preceding siblings ...)
2012-02-03 19:36 ` [PATCH 15/17] ARM: sa11x0: assabet/neponest: create neponset device in assabet.c Russell King - ARM Linux
@ 2012-02-03 19:36 ` Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 17/17] ARM: sa11x0: neponset: don't static map neponset registers Russell King - ARM Linux
2012-02-03 20:43 ` [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Nicolas Pitre
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:36 UTC (permalink / raw)
To: linux-arm-kernel
Move 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.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/include/mach/neponset.h | 48 -----------
arch/arm/mach-sa1100/neponset.c | 114 ++++++++++++++++++++-----
2 files changed, 91 insertions(+), 71 deletions(-)
diff --git a/arch/arm/mach-sa1100/include/mach/neponset.h b/arch/arm/mach-sa1100/include/mach/neponset.h
index 6032216..5516a52 100644
--- a/arch/arm/mach-sa1100/include/mach/neponset.h
+++ b/arch/arm/mach-sa1100/include/mach/neponset.h
@@ -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)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 2a9e1e2..3c0d4b8 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -27,9 +27,40 @@
#define NEP_IRQ_SA1111 2
#define NEP_IRQ_NR 3
+#define WHOAMI 0x00
+#define LEDS 0x10
+#define SWPK 0x20
+#define IRR 0x24
+#define KP_Y_IN 0x80
+#define KP_X_OUT 0x90
+#define NCR_0 0xa0
+#define MDM_CTL_0 0xb0
+#define MDM_CTL_1 0xb4
+#define AUD_CTL 0xc0
+
+#define IRR_ETHERNET (1 << 0)
+#define IRR_USAR (1 << 1)
+#define IRR_SA1111 (1 << 2)
+
+#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 AUD_SEL_1341 (1 << 0)
+#define AUD_MUTE_1341 (1 << 1)
+
extern void sa1110_mb_disable(void);
struct neponset_drvdata {
+ void __iomem *base;
struct platform_device *sa1111;
struct platform_device *smc91x;
unsigned irq_base;
@@ -39,19 +70,34 @@ struct neponset_drvdata {
#endif
};
+static void __iomem *nep_base;
+
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);
+ void __iomem *base = nep_base;
+
+ if (base) {
+ unsigned long flags;
+ unsigned v;
+
+ local_irq_save(flags);
+ v = readb_relaxed(base + NCR_0);
+ writeb_relaxed((v & ~mask) | val, base + NCR_0);
+ local_irq_restore(flags);
+ } else {
+ WARN(1, "nep_base unset\n");
+ }
}
static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
{
- u_int mdm_ctl0 = MDM_CTL_0;
+ void __iomem *base = nep_base;
+ u_int mdm_ctl0;
+
+ if (!base)
+ return;
+ mdm_ctl0 = readb_relaxed(base + MDM_CTL_0);
if (port->mapbase == _Ser1UTCR0) {
if (mctrl & TIOCM_RTS)
mdm_ctl0 &= ~MDM_CTL0_RTS2;
@@ -74,14 +120,19 @@ static void neponset_set_mctrl(struct uart_port *port, u_int mctrl)
mdm_ctl0 |= MDM_CTL0_DTR1;
}
- MDM_CTL_0 = mdm_ctl0;
+ writeb_relaxed(mdm_ctl0, base + MDM_CTL_0);
}
static u_int neponset_get_mctrl(struct uart_port *port)
{
+ void __iomem *base = nep_base;
u_int ret = TIOCM_CD | TIOCM_CTS | TIOCM_DSR;
- u_int mdm_ctl1 = MDM_CTL_1;
+ u_int mdm_ctl1;
+ if (!base)
+ return ret;
+
+ mdm_ctl1 = readb_relaxed(base + MDM_CTL_1);
if (port->mapbase == _Ser1UTCR0) {
if (mdm_ctl1 & MDM_CTL1_DCD2)
ret &= ~TIOCM_CD;
@@ -128,7 +179,8 @@ static void neponset_irq_handler(unsigned int irq, struct irq_desc *desc)
* active IRQ bits high. Note: there is a typo in the
* Neponset user's guide for the SA1111 IRR level.
*/
- irr = IRR ^ (IRR_ETHERNET | IRR_USAR);
+ irr = readb_relaxed(d->base + IRR);
+ irr ^= IRR_ETHERNET | IRR_USAR;
if ((irr & (IRR_ETHERNET | IRR_USAR | IRR_SA1111)) == 0)
break;
@@ -182,7 +234,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 *nep_res, *sa1111_res, *smc91x_res;
struct resource sa1111_resources[] = {
DEFINE_RES_MEM(0x40000000, SZ_8K),
{ .flags = IORESOURCE_IRQ },
@@ -213,30 +265,40 @@ static int __devinit neponset_probe(struct platform_device *dev)
};
int ret, irq;
+ if (nep_base)
+ return -EBUSY;
+
irq = ret = platform_get_irq(dev, 0);
if (ret < 0)
goto err_alloc;
+ nep_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
smc91x_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
sa1111_res = platform_get_resource(dev, IORESOURCE_MEM, 2);
- if (!smc91x_res || !sa1111_res) {
+ if (!nep_res || !smc91x_res || !sa1111_res) {
ret = -ENXIO;
goto err_alloc;
}
- if (WHOAMI != 0x11) {
- dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
- WHOAMI);
- ret = -ENODEV;
- goto err_alloc;
- }
-
d = kzalloc(sizeof(*d), GFP_KERNEL);
if (!d) {
ret = -ENOMEM;
goto err_alloc;
}
+ d->base = ioremap(nep_res->start, SZ_4K);
+ if (!d->base) {
+ ret = -ENOMEM;
+ goto err_ioremap;
+ }
+
+ if (readb_relaxed(d->base + WHOAMI) != 0x11) {
+ dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n",
+ readb_relaxed(d->base + WHOAMI));
+ ret = -ENODEV;
+ goto err_id;
+ }
+
ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1);
if (ret <= 0) {
dev_err(&dev->dev, "unable to allocate %u irqs: %d\n",
@@ -270,6 +332,7 @@ static int __devinit neponset_probe(struct platform_device *dev)
dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n",
d->irq_base, d->irq_base + NEP_IRQ_NR - 1);
+ nep_base = d->base;
sa1100_register_uart_fns(&neponset_port_fns);
@@ -277,7 +340,7 @@ static int __devinit neponset_probe(struct platform_device *dev)
sa1110_mb_disable();
/* Disable GPIO 0/1 drivers so the buttons work on the Assabet */
- NCR_0 = NCR_GP01_OFF;
+ writeb_relaxed(NCR_GP01_OFF, d->base + NCR_0);
sa1111_resources[0].parent = sa1111_res;
sa1111_resources[1].start = d->irq_base + NEP_IRQ_SA1111;
@@ -295,6 +358,9 @@ static int __devinit neponset_probe(struct platform_device *dev)
return 0;
err_irq_alloc:
+ err_id:
+ iounmap(d->base);
+ err_ioremap:
kfree(d);
err_alloc:
return ret;
@@ -311,6 +377,8 @@ static int __devexit neponset_remove(struct platform_device *dev)
platform_device_unregister(d->smc91x);
irq_set_chained_handler(irq, NULL);
irq_free_descs(d->irq_base, NEP_IRQ_NR);
+ nep_base = NULL;
+ iounmap(d->base);
kfree(d);
return 0;
@@ -321,8 +389,8 @@ static int neponset_suspend(struct device *dev)
{
struct neponset_drvdata *d = dev_get_drvdata(dev);
- d->ncr0 = NCR_0;
- d->mdm_ctl_0 = MDM_CTL_0;
+ d->ncr0 = readb_relaxed(d->base + NCR_0);
+ d->mdm_ctl_0 = readb_relaxed(d->base + MDM_CTL_0);
return 0;
}
@@ -331,8 +399,8 @@ static int neponset_resume(struct device *dev)
{
struct neponset_drvdata *d = dev_get_drvdata(dev);
- NCR_0 = d->ncr0;
- MDM_CTL_0 = d->mdm_ctl_0;
+ writeb_relaxed(d->ncr0, d->base + NCR_0);
+ writeb_relaxed(d->mdm_ctl_0, d->base + MDM_CTL_0);
return 0;
}
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 17/17] ARM: sa11x0: neponset: don't static map neponset registers
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (15 preceding siblings ...)
2012-02-03 19:36 ` [PATCH 16/17] ARM: sa11x0: neponset: move register definitions to neponset.c Russell King - ARM Linux
@ 2012-02-03 19:36 ` Russell King - ARM Linux
2012-02-03 20:43 ` [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Nicolas Pitre
17 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 19:36 UTC (permalink / raw)
To: linux-arm-kernel
Now that we ioremap() the neponset register space, there's no need
to static map the neponset registers. Get rid of this static mapping.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
arch/arm/mach-sa1100/neponset.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-sa1100/neponset.c b/arch/arm/mach-sa1100/neponset.c
index 3c0d4b8..7ffa631 100644
--- a/arch/arm/mach-sa1100/neponset.c
+++ b/arch/arm/mach-sa1100/neponset.c
@@ -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,
--
1.7.4.4
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset)
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
` (16 preceding siblings ...)
2012-02-03 19:36 ` [PATCH 17/17] ARM: sa11x0: neponset: don't static map neponset registers Russell King - ARM Linux
@ 2012-02-03 20:43 ` Nicolas Pitre
2012-02-03 20:53 ` Russell King - ARM Linux
17 siblings, 1 reply; 20+ messages in thread
From: Nicolas Pitre @ 2012-02-03 20:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, 3 Feb 2012, Russell King - ARM Linux wrote:
> 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.
I've quickly looked through this series and this all looks sensible.
Acked-by: Nicolas Pitre <nico@linaro.org>
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
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset)
2012-02-03 20:43 ` [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Nicolas Pitre
@ 2012-02-03 20:53 ` Russell King - ARM Linux
0 siblings, 0 replies; 20+ messages in thread
From: Russell King - ARM Linux @ 2012-02-03 20:53 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Feb 03, 2012 at 03:43:43PM -0500, Nicolas Pitre wrote:
> I've quickly looked through this series and this all looks sensible.
>
> Acked-by: Nicolas Pitre <nico@linaro.org>
Thanks.
> 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!
^ permalink raw reply [flat|nested] 20+ messages in thread
end of thread, other threads:[~2012-02-03 20:53 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-03 19:30 [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 01/17] ARM: sa11x0: convert to use DEFINE_RES_xxx macros Russell King - ARM Linux
2012-02-03 19:31 ` [PATCH 02/17] ARM: sa11x0: assabet: deassert QMUTE to codec while codec is unpowered Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 03/17] ARM: sa11x0: assabet: avoid glitching GPIOs when setting outputs Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 04/17] ARM: sa11x0: assabet: ensure that GPIO27 is driven Russell King - ARM Linux
2012-02-03 19:32 ` [PATCH 05/17] ARM: sa11x0: neponset: fix interrupt setup Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 06/17] ARM: sa11x0: neponset: provide function to manipulate NCR_0 Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 07/17] ARM: sa11x0: neponset: shuffle some code around Russell King - ARM Linux
2012-02-03 19:33 ` [PATCH 08/17] ARM: sa11x0: neponset: add driver .owner initializer Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 09/17] ARM: sa11x0: neponset: save and restore MDM_CTL_0 Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 10/17] ARM: sa11x0: neponset: dynamically create neponset child devices Russell King - ARM Linux
2012-02-03 19:34 ` [PATCH 11/17] ARM: sa11x0: neponset: implement support for sparse IRQs Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 12/17] ARM: sa11x0: neponset: get parent IRQ from neponset device resource Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 13/17] ARM: sa11x0: neponset: place smc91x and sa1111 resources in neponset device Russell King - ARM Linux
2012-02-03 19:35 ` [PATCH 14/17] ARM: sa11x0: neponset: suspend/resume in _noirq state Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 15/17] ARM: sa11x0: assabet/neponest: create neponset device in assabet.c Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 16/17] ARM: sa11x0: neponset: move register definitions to neponset.c Russell King - ARM Linux
2012-02-03 19:36 ` [PATCH 17/17] ARM: sa11x0: neponset: don't static map neponset registers Russell King - ARM Linux
2012-02-03 20:43 ` [PATCH 00/17] SA11x0 cleanups (mainly assabet/neponset) Nicolas Pitre
2012-02-03 20:53 ` Russell King - ARM Linux
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).