Skip to contentSkip to conversation

Misc picoxcell features for 3.3

PATCH Superseded Jamie Iles 3 participants 10 messages Dec 12, 2011

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jamie Iles

author
#0 lore raw

cover Misc picoxcell features for 3.3

Here are a few minor picoxcell features for 3.3 to implement a restart method for the machine using Russell's new infrastructure and a couple of minor cleanups.

Jamie Iles (5):
ARM: picoxcell: remove mach/memory.h
ARM: picoxcell: don't reserve irq_descs
ARM: picoxcell: move io mappings to common.c
MAINTAINERS: add maintainer entry for Picochip picoxcell
ARM: picoxcell: implement watchdog restart

 MAINTAINERS                                   |    8 ++++
 arch/arm/mach-picoxcell/Makefile              |    1 -
 arch/arm/mach-picoxcell/common.c              |   46 ++++++++++++++++++++++++-
 arch/arm/mach-picoxcell/common.h              |    1 -
 arch/arm/mach-picoxcell/include/mach/irqs.h   |    9 +----
 arch/arm/mach-picoxcell/include/mach/memory.h |    1 -
 arch/arm/mach-picoxcell/io.c                  |   32 -----------------
 7 files changed, 55 insertions(+), 43 deletions(-)
 delete mode 100644 arch/arm/mach-picoxcell/include/mach/memory.h
 delete mode 100644 arch/arm/mach-picoxcell/io.c
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 1/5 ARM: picoxcell: remove mach/memory.h

mach/memory.h is no longer required for simple platforms so remove it for picoxcell.

---
 arch/arm/mach-picoxcell/include/mach/memory.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
 delete mode 100644 arch/arm/mach-picoxcell/include/mach/memory.h
arch/arm/mach-picoxcell/include/mach/memory.h deleted +0 -1
deleted file mode 100644
index 40a8c17..0000000
@@ -1 +0,0 @@
-/* empty */
Signature · 1 line
1.7.5.4
author
#2 lore raw

PATCH 2/5 ARM: picoxcell: don't reserve irq_descs

In reply to Jamie Iles

All irq_desc's are now dynamically allocated so we don't need to statically reserve them.

---
 arch/arm/mach-picoxcell/common.c            |    1 -
 arch/arm/mach-picoxcell/include/mach/irqs.h |    9 ++-------
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/mach-picoxcell/common.c +0 -1
index ad871bd..7d91165 100644
@@ -45,7 +45,6 @@ static void __init picoxcell_init_irq(void)
 
 DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
-	.nr_irqs	= ARCH_NR_IRQS,
 	.init_irq	= picoxcell_init_irq,
 	.handle_irq	= vic_handle_irq,
 	.timer		= &picoxcell_timer,
arch/arm/mach-picoxcell/include/mach/irqs.h +2 -7
index 4d13ed9..59eac1e 100644
@@ -1,8 +1,6 @@
 /*
  * Copyright (c) 2011 Picochip Ltd., Jamie Iles
  *
- * This file contains the hardware definitions of the picoXcell SoC devices.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -16,10 +14,7 @@
 #ifndef __MACH_IRQS_H
 #define __MACH_IRQS_H
 
-#define ARCH_NR_IRQS			64
-#define NR_IRQS				(128 + ARCH_NR_IRQS)
-
-#define IRQ_VIC0_BASE			0
-#define IRQ_VIC1_BASE			32
+/* We dynamically allocate our irq_desc's. */
+#define NR_IRQS				0
 
 #endif /* __MACH_IRQS_H */
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 2/5 ARM: picoxcell: don't reserve irq_descs

Quoted 14 lines · Jamie Iles

All irq_desc's are now dynamically allocated so we don't need to statically reserve them.

---
 arch/arm/mach-picoxcell/common.c            |    1 -
 arch/arm/mach-picoxcell/include/mach/irqs.h |    9 ++-------
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/mach-picoxcell/common.c +0 -0
index ad871bd..7d91165 100644

arch/arm/mach-picoxcell/common.c static void __init picoxcell_init_irq(void) · line 48

Quoted 4 lines
arch/arm/mach-picoxcell/common.c +0 -1
@@ -45,7 +45,6 @@ static void __init picoxcell_init_irq(void)
 
 DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
-	.nr_irqs	= ARCH_NR_IRQS,

You should probably should set this to NR_IRQS_LEGACY (16) to skip irq 0 and ISA irqs.

Quoted 17 lines
arch/arm/mach-picoxcell/common.c +0 -0
 	.init_irq	= picoxcell_init_irq,
 	.handle_irq	= vic_handle_irq,
 	.timer		= &picoxcell_timer,
arch/arm/mach-picoxcell/include/mach/irqs.h +0 -2
index 4d13ed9..59eac1e 100644
@@ -1,8 +1,6 @@
 /*
  * Copyright (c) 2011 Picochip Ltd., Jamie Iles
  *
- * This file contains the hardware definitions of the picoXcell SoC devices.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or

arch/arm/mach-picoxcell/include/mach/irqs.h line 18

Quoted 10 lines
arch/arm/mach-picoxcell/include/mach/irqs.h +2 -5
@@ -16,10 +14,7 @@
 #ifndef __MACH_IRQS_H
 #define __MACH_IRQS_H
 
-#define ARCH_NR_IRQS			64
-#define NR_IRQS				(128 + ARCH_NR_IRQS)
-
-#define IRQ_VIC0_BASE			0
-#define IRQ_VIC1_BASE			32
+/* We dynamically allocate our irq_desc's. */
+#define NR_IRQS				0

Are you selecting SPARSE_IRQ?

Rob

author
#4 lore raw

PATCH 2/5 ARM: picoxcell: don't reserve irq_descs

Hi Rob,

Quoted 16 lines · Rob Herring
Quoted 15 lines · Jamie Iles

All irq_desc's are now dynamically allocated so we don't need to statically reserve them.

---
 arch/arm/mach-picoxcell/common.c            |    1 -
 arch/arm/mach-picoxcell/include/mach/irqs.h |    9 ++-------
 2 files changed, 2 insertions(+), 8 deletions(-)
arch/arm/mach-picoxcell/common.c +0 -0
index ad871bd..7d91165 100644
@@ -45,7 +45,6 @@ static void __init picoxcell_init_irq(void)
 
Quoted 6 lines

arch/arm/mach-picoxcell/common.c static void __init picoxcell_init_irq(void) · line 48

Quoted 3 lines
arch/arm/mach-picoxcell/common.c +0 -1
 DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
-	.nr_irqs	= ARCH_NR_IRQS,

You should probably should set this to NR_IRQS_LEGACY (16) to skip irq 0 and ISA irqs.

OK, that seems reasonable. This platform won't ever have ISA support but I guess it's still worth it?

Quoted 20 lines
Quoted 20 lines
arch/arm/mach-picoxcell/common.c +0 -0
 	.init_irq	= picoxcell_init_irq,
 	.handle_irq	= vic_handle_irq,
 	.timer		= &picoxcell_timer,
arch/arm/mach-picoxcell/include/mach/irqs.h +0 -2
index 4d13ed9..59eac1e 100644
@@ -1,8 +1,6 @@
 /*
  * Copyright (c) 2011 Picochip Ltd., Jamie Iles
  *
- * This file contains the hardware definitions of the picoXcell SoC devices.
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -16,10 +14,7 @@
 #ifndef __MACH_IRQS_H
 #define __MACH_IRQS_H
 
Quoted 9 lines

arch/arm/mach-picoxcell/include/mach/irqs.h line 18

Quoted 7 lines
arch/arm/mach-picoxcell/include/mach/irqs.h +2 -5
-#define ARCH_NR_IRQS			64
-#define NR_IRQS				(128 + ARCH_NR_IRQS)
-
-#define IRQ_VIC0_BASE			0
-#define IRQ_VIC1_BASE			32
+/* We dynamically allocate our irq_desc's. */
+#define NR_IRQS				0

Are you selecting SPARSE_IRQ?

Not in the patch, but I did have it enabled locally. I'll respin this patch to select SPARSE_IRQ for picoxcell.

Thanks,

Jamie

author
#5 lore raw

PATCH 3/5 ARM: picoxcell: move io mappings to common.c

In reply to Jamie Iles

Now that we have lost our machine specific ioremap() we just have one mapping that covers all peripherals. Move this to common.c to simplify things a little.

---
 arch/arm/mach-picoxcell/Makefile |    1 -
 arch/arm/mach-picoxcell/common.c |   13 +++++++++++++
 arch/arm/mach-picoxcell/common.h |    1 -
 arch/arm/mach-picoxcell/io.c     |   32 --------------------------------
 4 files changed, 13 insertions(+), 34 deletions(-)
 delete mode 100644 arch/arm/mach-picoxcell/io.c
arch/arm/mach-picoxcell/Makefile +0 -1
index c550b63..e5ec4a8 100644
@@ -1,3 +1,2 @@
 obj-y	:= common.o
 obj-y	+= time.o
-obj-y	+= io.o
arch/arm/mach-picoxcell/common.c +13 -0
index 7d91165..88c53e0 100644
@@ -16,12 +16,25 @@
 
 #include <asm/mach/arch.h>
 #include <asm/hardware/vic.h>
+#include <asm/mach/map.h>
 
 #include <mach/map.h>
 #include <mach/picoxcell_soc.h>
 
 #include "common.h"
 
+static struct map_desc io_map __initdata = {
+	.virtual	= PHYS_TO_IO(PICOXCELL_PERIPH_BASE),
+	.pfn		= __phys_to_pfn(PICOXCELL_PERIPH_BASE),
+	.length		= PICOXCELL_PERIPH_LENGTH,
+	.type		= MT_DEVICE,
+};
+
+static void __init picoxcell_map_io(void)
+{
+	iotable_init(&io_map, 1);
+}
+
 static void __init picoxcell_init_machine(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
arch/arm/mach-picoxcell/common.h +0 -1
index 5263f0f..83d55ab 100644
@@ -13,6 +13,5 @@
 #include <asm/mach/time.h>
 
 extern struct sys_timer picoxcell_timer;
-extern void picoxcell_map_io(void);
 
 #endif /* __PICOXCELL_COMMON_H__ */
arch/arm/mach-picoxcell/io.c deleted +0 -32
deleted file mode 100644
index 39e9b9e..0000000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2011 Picochip Ltd., Jamie Iles
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * All enquiries to support at picochip.com
- */
-#include <linux/io.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/of.h>
-
-#include <asm/mach/map.h>
-
-#include <mach/map.h>
-#include <mach/picoxcell_soc.h>
-
-#include "common.h"
-
-void __init picoxcell_map_io(void)
-{
-	struct map_desc io_map = {
-		.virtual	= PHYS_TO_IO(PICOXCELL_PERIPH_BASE),
-		.pfn		= __phys_to_pfn(PICOXCELL_PERIPH_BASE),
-		.length		= PICOXCELL_PERIPH_LENGTH,
-		.type		= MT_DEVICE,
-	};
-
-	iotable_init(&io_map, 1);
-}
Signature · 1 line
1.7.5.4
author
#6 lore raw

PATCH 4/5 MAINTAINERS: add maintainer entry for Picochip picoxcell

In reply to Jamie Iles

Add maintainer entry for the picoxcell machine support and associated drivers.

---
 MAINTAINERS |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
MAINTAINERS +8 -0
index 071a996..543f5a5 100644
@@ -5114,6 +5114,14 @@ L:	linux-mtd at lists.infradead.org
 S:	Maintained
 F:	drivers/mtd/devices/phram.c
 
+PICOXCELL SUPPORT
+M:	Jamie Iles <[email protected]>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+T:	git git://github.com/jamieiles/linux-2.6-ji.git
+S:	Supported
+F:	arch/arm/mach-picoxcell
+F:	drivers/*/picoxcell*
+
 PIN CONTROL SUBSYSTEM
 M:	Linus Walleij <[email protected]>
 S:	Maintained
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH 4/5 MAINTAINERS: add maintainer entry for Picochip picoxcell

Quoted 2 lines · Jamie Iles

Add maintainer entry for the picoxcell machine support and associated drivers.

[]

MAINTAINERS

Quoted 1 line
MAINTAINERS +0 -0

[]

MAINTAINERS L: linux-mtd at lists.infradead.org · line 5123

Quoted 11 lines
MAINTAINERS +7 -0
@@ -5114,6 +5114,14 @@ L:	linux-mtd at lists.infradead.org
 S:	Maintained
 F:	drivers/mtd/devices/phram.c
 
+PICOXCELL SUPPORT
+M:	Jamie Iles <[email protected]>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+T:	git git://github.com/jamieiles/linux-2.6-ji.git
+S:	Supported
+F:	arch/arm/mach-picoxcell
+F:	drivers/*/picoxcell*

This wildcard matches only 1 directory depth level.

To match "drivers/char/hw_random/picoxcell-rng.c"
you also need to have:

F: drivers/*/*/picoxcell*

author
#8 lore raw

PATCH 4/5 MAINTAINERS: add maintainer entry for Picochip picoxcell

Quoted 20 lines · Joe Perches
Quoted 2 lines · Jamie Iles

Add maintainer entry for the picoxcell machine support and associated drivers.

[]

MAINTAINERS

Quoted 1 line
MAINTAINERS +0 -0

[]

MAINTAINERS L: linux-mtd at lists.infradead.org · line 5123

Quoted 11 lines
MAINTAINERS +7 -0
@@ -5114,6 +5114,14 @@ L:	linux-mtd at lists.infradead.org
 S:	Maintained
 F:	drivers/mtd/devices/phram.c
 
+PICOXCELL SUPPORT
+M:	Jamie Iles <[email protected]>
+L:	linux-arm-kernel at lists.infradead.org (moderated for non-subscribers)
+T:	git git://github.com/jamieiles/linux-2.6-ji.git
+S:	Supported
+F:	arch/arm/mach-picoxcell
+F:	drivers/*/picoxcell*

This wildcard matches only 1 directory depth level.

Quoted 4 lines

To match "drivers/char/hw_random/picoxcell-rng.c"
you also need to have:

F: drivers/*/*/picoxcell*

Thanks Joe, I'll update accordingly.

Jamie

author
#9 lore raw

PATCH 5/5 ARM: picoxcell: implement watchdog restart

In reply to Jamie Iles

Allow the platform to be restarted by triggering the watchdog to expire with the shortest possible expiry. This should reset the CPU core and all on-chip peripherals.

---
 arch/arm/mach-picoxcell/common.c |   32 ++++++++++++++++++++++++++++++++
 1 files changed, 32 insertions(+), 0 deletions(-)
arch/arm/mach-picoxcell/common.c +32 -0
index 88c53e0..6b39256 100644
@@ -7,6 +7,7 @@
  *
  * All enquiries to support at picochip.com
  */
+#include <linux/delay.h>
 #include <linux/irq.h>
 #include <linux/irqdomain.h>
 #include <linux/of.h>
@@ -23,6 +24,22 @@
 
 #include "common.h"
 
+#define WDT_CTRL_REG_EN_MASK	(1 << 0)
+#define WDT_CTRL_REG_OFFS	(0x00)
+#define WDT_TIMEOUT_REG_OFFS	(0x04)
+static void __iomem *wdt_regs;
+
+static void picoxcell_setup_restart(void)
+{
+	struct device_node *np = of_find_compatible_node(NULL, NULL,
+							 "snps,dw-apb-wdg");
+	if (WARN(!np, "unable to setup watchdog restart"))
+		return;
+
+	wdt_regs = of_iomap(np, 0);
+	WARN(!wdt_regs, "failed to remap watchdog regs");
+}
+
 static struct map_desc io_map __initdata = {
 	.virtual	= PHYS_TO_IO(PICOXCELL_PERIPH_BASE),
 	.pfn		= __phys_to_pfn(PICOXCELL_PERIPH_BASE),
@@ -38,6 +55,7 @@ static void __init picoxcell_map_io(void)
 static void __init picoxcell_init_machine(void)
 {
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+	picoxcell_setup_restart();
 }
 
 static const char *picoxcell_dt_match[] = {
@@ -56,6 +74,19 @@ static void __init picoxcell_init_irq(void)
 	of_irq_init(vic_of_match);
 }
 
+static void picoxcell_wdt_restart(char mode, const char *cmd)
+{
+	/*
+	 * Configure the watchdog to reset with the shortest possible timeout
+	 * and give it chance to do the reset.
+	 */
+	if (wdt_regs) {
+		__raw_writel(WDT_CTRL_REG_EN_MASK, wdt_regs + WDT_CTRL_REG_OFFS);
+		__raw_writel(0, wdt_regs + WDT_TIMEOUT_REG_OFFS);
+		mdelay(500);
+	}
+}
+
 DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.map_io		= picoxcell_map_io,
 	.init_irq	= picoxcell_init_irq,
@@ -63,4 +94,5 @@ DT_MACHINE_START(PICOXCELL, "Picochip picoXcell")
 	.timer		= &picoxcell_timer,
 	.init_machine	= picoxcell_init_machine,
 	.dt_compat	= picoxcell_dt_match,
+	.restart	= picoxcell_wdt_restart,
 MACHINE_END
Signature · 1 line
1.7.5.4