Skip to contentSkip to conversation

ARM: Orion: Fix Virtual/Physical mixup with watchdog

PATCH New Andrew Lunn 2 participants 2 messages Jun 18, 2012 – Jun 27, 2012

Subsystems (4)
lore
Share & tools
lore

Andrew Lunn

author maintainer
#0 lore raw

PATCH 1/1 ARM: Orion: Fix Virtual/Physical mixup with watchdog

The orion watchdog is expecting to be passed the physcial address of the hardware, and will ioremap() it to give a virtual address it will use as the base address for the hardware. However, when creating the platform resource record, a virtual address was being used.

Add the necassary #define's so we can pass the physical address as expected.

Tested on Kirkwood and Orion5x.

---
 arch/arm/mach-kirkwood/include/mach/bridge-regs.h |    1 +
 arch/arm/mach-kirkwood/include/mach/kirkwood.h    |    1 +
 arch/arm/mach-orion5x/include/mach/bridge-regs.h  |    2 +-
 arch/arm/mach-orion5x/include/mach/orion5x.h      |    1 +
 arch/arm/plat-orion/common.c                      |    2 +-
 5 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-kirkwood/include/mach/bridge-regs.h +1 -0
index 3eee37a..a115142 100644
@@ -38,6 +38,7 @@
 #define IRQ_MASK_HIGH_OFF	0x0014
 
 #define TIMER_VIRT_BASE		(BRIDGE_VIRT_BASE | 0x0300)
+#define TIMER_PHYS_BASE		(BRIDGE_PHYS_BASE | 0x0300)
 
 #define L2_CONFIG_REG		(BRIDGE_VIRT_BASE | 0x0128)
 #define L2_WRITETHROUGH		0x00000010
arch/arm/mach-kirkwood/include/mach/kirkwood.h +1 -0
index fede3d5..c5b6851 100644
@@ -80,6 +80,7 @@
 #define  UART1_VIRT_BASE	(DEV_BUS_VIRT_BASE | 0x2100)
 
 #define BRIDGE_VIRT_BASE	(KIRKWOOD_REGS_VIRT_BASE | 0x20000)
+#define BRIDGE_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x20000)
 
 #define CRYPTO_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x30000)
 
arch/arm/mach-orion5x/include/mach/bridge-regs.h +1 -1
index 96484bc..11a3c1e 100644
@@ -35,5 +35,5 @@
 #define MAIN_IRQ_MASK		(ORION5X_BRIDGE_VIRT_BASE | 0x204)
 
 #define TIMER_VIRT_BASE		(ORION5X_BRIDGE_VIRT_BASE | 0x300)
-
+#define TIMER_PHYS_BASE		(ORION5X_BRIDGE_PHYS_BASE | 0x300)
 #endif
arch/arm/mach-orion5x/include/mach/orion5x.h +1 -0
index 2745f5d..683e085 100644
@@ -82,6 +82,7 @@
 #define  UART1_VIRT_BASE		(ORION5X_DEV_BUS_VIRT_BASE | 0x2100)
 
 #define ORION5X_BRIDGE_VIRT_BASE	(ORION5X_REGS_VIRT_BASE | 0x20000)
+#define ORION5X_BRIDGE_PHYS_BASE	(ORION5X_REGS_PHYS_BASE | 0x20000)
 
 #define ORION5X_PCI_VIRT_BASE		(ORION5X_REGS_VIRT_BASE | 0x30000)
 
arch/arm/plat-orion/common.c +1 -1
index 61fd837..c179378 100644
@@ -582,7 +582,7 @@ void __init orion_spi_1_init(unsigned long mapbase)
  * Watchdog
  ****************************************************************************/
 static struct resource orion_wdt_resource =
-		DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
+		DEFINE_RES_MEM(TIMER_PHYS_BASE, 0x28);
 
 static struct platform_device orion_wdt_device = {
 	.name		= "orion_wdt",
Signature · 1 line
1.7.10
#1 lore raw

PATCH 1/1 ARM: Orion: Fix Virtual/Physical mixup with watchdog

Quoted 5 lines · Andrew Lunn

The orion watchdog is expecting to be passed the physcial address of the hardware, and will ioremap() it to give a virtual address it will use as the base address for the hardware. However, when creating the platform resource record, a virtual address was being used.

Quoted 7 lines

Add the necassary #define's so we can pass the physical address as expected.

Tested on Kirkwood and Orion5x.

Quoted 71 lines
---
 arch/arm/mach-kirkwood/include/mach/bridge-regs.h |    1 +
 arch/arm/mach-kirkwood/include/mach/kirkwood.h    |    1 +
 arch/arm/mach-orion5x/include/mach/bridge-regs.h  |    2 +-
 arch/arm/mach-orion5x/include/mach/orion5x.h      |    1 +
 arch/arm/plat-orion/common.c                      |    2 +-
 5 files changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-kirkwood/include/mach/bridge-regs.h +1 -0
index 3eee37a..a115142 100644
@@ -38,6 +38,7 @@
 #define IRQ_MASK_HIGH_OFF	0x0014
 
 #define TIMER_VIRT_BASE		(BRIDGE_VIRT_BASE | 0x0300)
+#define TIMER_PHYS_BASE		(BRIDGE_PHYS_BASE | 0x0300)
 
 #define L2_CONFIG_REG		(BRIDGE_VIRT_BASE | 0x0128)
 #define L2_WRITETHROUGH		0x00000010
arch/arm/mach-kirkwood/include/mach/kirkwood.h +1 -0
index fede3d5..c5b6851 100644
@@ -80,6 +80,7 @@
 #define  UART1_VIRT_BASE	(DEV_BUS_VIRT_BASE | 0x2100)
 
 #define BRIDGE_VIRT_BASE	(KIRKWOOD_REGS_VIRT_BASE | 0x20000)
+#define BRIDGE_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x20000)
 
 #define CRYPTO_PHYS_BASE	(KIRKWOOD_REGS_PHYS_BASE | 0x30000)
 
arch/arm/mach-orion5x/include/mach/bridge-regs.h +1 -1
index 96484bc..11a3c1e 100644
@@ -35,5 +35,5 @@
 #define MAIN_IRQ_MASK		(ORION5X_BRIDGE_VIRT_BASE | 0x204)
 
 #define TIMER_VIRT_BASE		(ORION5X_BRIDGE_VIRT_BASE | 0x300)
-
+#define TIMER_PHYS_BASE		(ORION5X_BRIDGE_PHYS_BASE | 0x300)
 #endif
arch/arm/mach-orion5x/include/mach/orion5x.h +1 -0
index 2745f5d..683e085 100644
@@ -82,6 +82,7 @@
 #define  UART1_VIRT_BASE		(ORION5X_DEV_BUS_VIRT_BASE | 0x2100)
 
 #define ORION5X_BRIDGE_VIRT_BASE	(ORION5X_REGS_VIRT_BASE | 0x20000)
+#define ORION5X_BRIDGE_PHYS_BASE	(ORION5X_REGS_PHYS_BASE | 0x20000)
 
 #define ORION5X_PCI_VIRT_BASE		(ORION5X_REGS_VIRT_BASE | 0x30000)
 
arch/arm/plat-orion/common.c +1 -1
index 61fd837..c179378 100644
@@ -582,7 +582,7 @@ void __init orion_spi_1_init(unsigned long mapbase)
  * Watchdog
  ****************************************************************************/
 static struct resource orion_wdt_resource =
-		DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
+		DEFINE_RES_MEM(TIMER_PHYS_BASE, 0x28);
 
 static struct platform_device orion_wdt_device = {
 	.name		= "orion_wdt",
Signature · 1 line
1.7.10