* [PATCH 03/11] m68k: set arch_gettimeoffset directly
From: Stephen Warren @ 2012-11-08 21:01 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352408516-21988-1-git-send-email-swarren@wwwdotorg.org>
From: Stephen Warren <swarren@nvidia.com>
remove m68k's mach_gettimeoffset function pointer, and instead directly
set the arch_gettimeoffset function pointer. This requires multiplying
all function results by 1000, since the removed m68k_gettimeoffset() did
this. Also, s/unsigned long/u32/ just to make the function prototypes
exactly match that of arch_gettimeoffset.
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Philip Blundell <philb@gnu.org>
Cc: Joshua Thompson <funaho@jurai.org>
Cc: Sam Creasey <sammy@sammy.net>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/m68k/amiga/config.c | 10 +++++-----
arch/m68k/apollo/config.c | 9 ++++-----
arch/m68k/atari/config.c | 4 ++--
arch/m68k/atari/time.c | 6 +++---
arch/m68k/bvme6000/config.c | 10 +++++-----
arch/m68k/hp300/config.c | 2 +-
arch/m68k/hp300/time.c | 4 ++--
arch/m68k/hp300/time.h | 2 +-
arch/m68k/include/asm/machdep.h | 2 +-
arch/m68k/kernel/setup_mm.c | 1 -
arch/m68k/kernel/time.c | 9 ---------
arch/m68k/mac/config.c | 4 ++--
arch/m68k/mac/via.c | 4 ++--
arch/m68k/mvme147/config.c | 8 ++++----
arch/m68k/mvme16x/config.c | 8 ++++----
arch/m68k/q40/config.c | 8 ++++----
arch/m68k/sun3/config.c | 4 ++--
arch/m68k/sun3/intersil.c | 4 ++--
arch/m68k/sun3x/config.c | 2 +-
arch/m68k/sun3x/time.c | 2 +-
arch/m68k/sun3x/time.h | 2 +-
21 files changed, 47 insertions(+), 58 deletions(-)
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index ee01b7a..b819390 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -95,7 +95,7 @@ static void amiga_sched_init(irq_handler_t handler);
static void amiga_get_model(char *model);
static void amiga_get_hardware_list(struct seq_file *m);
/* amiga specific timer functions */
-static unsigned long amiga_gettimeoffset(void);
+static u32 amiga_gettimeoffset(void);
extern void amiga_mksound(unsigned int count, unsigned int ticks);
static void amiga_reset(void);
extern void amiga_init_sound(void);
@@ -377,7 +377,7 @@ void __init config_amiga(void)
mach_init_IRQ = amiga_init_IRQ;
mach_get_model = amiga_get_model;
mach_get_hardware_list = amiga_get_hardware_list;
- mach_gettimeoffset = amiga_gettimeoffset;
+ arch_gettimeoffset = amiga_gettimeoffset;
/*
* default MAX_DMA=0xffffffff on all machines. If we don't do so, the SCSI
@@ -482,10 +482,10 @@ static void __init amiga_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000
/* This is always executed with interrupts disabled. */
-static unsigned long amiga_gettimeoffset(void)
+static u32 amiga_gettimeoffset(void)
{
unsigned short hi, lo, hi2;
- unsigned long ticks, offset = 0;
+ u32 ticks, offset = 0;
/* read CIA B timer A current value */
hi = ciab.tahi;
@@ -507,7 +507,7 @@ static unsigned long amiga_gettimeoffset(void)
ticks = jiffy_ticks - ticks;
ticks = (10000 * ticks) / jiffy_ticks;
- return ticks + offset;
+ return (ticks + offset) * 1000;
}
static void amiga_reset(void) __noreturn;
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index f5565d6..3ea56b9 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -26,7 +26,7 @@ u_long apollo_model;
extern void dn_sched_init(irq_handler_t handler);
extern void dn_init_IRQ(void);
-extern unsigned long dn_gettimeoffset(void);
+extern u32 dn_gettimeoffset(void);
extern int dn_dummy_hwclk(int, struct rtc_time *);
extern int dn_dummy_set_clock_mmss(unsigned long);
extern void dn_dummy_reset(void);
@@ -151,7 +151,7 @@ void __init config_apollo(void)
mach_sched_init=dn_sched_init; /* */
mach_init_IRQ=dn_init_IRQ;
- mach_gettimeoffset = dn_gettimeoffset;
+ arch_gettimeoffset = dn_gettimeoffset;
mach_max_dma_address = 0xffffffff;
mach_hwclk = dn_dummy_hwclk; /* */
mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
@@ -203,10 +203,9 @@ void dn_sched_init(irq_handler_t timer_routine)
pr_err("Couldn't register timer interrupt\n");
}
-unsigned long dn_gettimeoffset(void) {
-
+u32 dn_gettimeoffset(void)
+{
return 0xdeadbeef;
-
}
int dn_dummy_hwclk(int op, struct rtc_time *t) {
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index d8eb327..037c11c 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -74,7 +74,7 @@ static void atari_heartbeat(int on);
/* atari specific timer functions (in time.c) */
extern void atari_sched_init(irq_handler_t);
-extern unsigned long atari_gettimeoffset (void);
+extern u32 atari_gettimeoffset(void);
extern int atari_mste_hwclk (int, struct rtc_time *);
extern int atari_tt_hwclk (int, struct rtc_time *);
extern int atari_mste_set_clock_mmss (unsigned long);
@@ -204,7 +204,7 @@ void __init config_atari(void)
mach_init_IRQ = atari_init_IRQ;
mach_get_model = atari_get_model;
mach_get_hardware_list = atari_get_hardware_list;
- mach_gettimeoffset = atari_gettimeoffset;
+ arch_gettimeoffset = atari_gettimeoffset;
mach_reset = atari_reset;
mach_max_dma_address = 0xffffff;
#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
diff --git a/arch/m68k/atari/time.c b/arch/m68k/atari/time.c
index c0cc68a..da8f981 100644
--- a/arch/m68k/atari/time.c
+++ b/arch/m68k/atari/time.c
@@ -42,9 +42,9 @@ atari_sched_init(irq_handler_t timer_routine)
#define TICK_SIZE 10000
/* This is always executed with interrupts disabled. */
-unsigned long atari_gettimeoffset (void)
+u32 atari_gettimeoffset(void)
{
- unsigned long ticks, offset = 0;
+ u32 ticks, offset = 0;
/* read MFP timer C current value */
ticks = st_mfp.tim_dt_c;
@@ -57,7 +57,7 @@ unsigned long atari_gettimeoffset (void)
ticks = INT_TICKS - ticks;
ticks = ticks * 10000L / INT_TICKS;
- return ticks + offset;
+ return (ticks + offset) * 1000;
}
diff --git a/arch/m68k/bvme6000/config.c b/arch/m68k/bvme6000/config.c
index 0bf850a..8943aa4 100644
--- a/arch/m68k/bvme6000/config.c
+++ b/arch/m68k/bvme6000/config.c
@@ -38,7 +38,7 @@
static void bvme6000_get_model(char *model);
extern void bvme6000_sched_init(irq_handler_t handler);
-extern unsigned long bvme6000_gettimeoffset (void);
+extern u32 bvme6000_gettimeoffset(void);
extern int bvme6000_hwclk (int, struct rtc_time *);
extern int bvme6000_set_clock_mmss (unsigned long);
extern void bvme6000_reset (void);
@@ -110,7 +110,7 @@ void __init config_bvme6000(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = bvme6000_sched_init;
mach_init_IRQ = bvme6000_init_IRQ;
- mach_gettimeoffset = bvme6000_gettimeoffset;
+ arch_gettimeoffset = bvme6000_gettimeoffset;
mach_hwclk = bvme6000_hwclk;
mach_set_clock_mmss = bvme6000_set_clock_mmss;
mach_reset = bvme6000_reset;
@@ -216,13 +216,13 @@ void bvme6000_sched_init (irq_handler_t timer_routine)
* results...
*/
-unsigned long bvme6000_gettimeoffset (void)
+u32 bvme6000_gettimeoffset(void)
{
volatile RtcPtr_t rtc = (RtcPtr_t)BVME_RTC_BASE;
volatile PitRegsPtr pit = (PitRegsPtr)BVME_PIT_BASE;
unsigned char msr = rtc->msr & 0xc0;
unsigned char t1int, t1op;
- unsigned long v = 800000, ov;
+ u32 v = 800000, ov;
rtc->msr = 0; /* Ensure timer registers accessible */
@@ -246,7 +246,7 @@ unsigned long bvme6000_gettimeoffset (void)
v += 10000; /* Int pending, + 10ms */
rtc->msr = msr;
- return v;
+ return v * 1000;
}
/*
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index bf16af1..b7609f7 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -251,7 +251,7 @@ void __init config_hp300(void)
mach_sched_init = hp300_sched_init;
mach_init_IRQ = hp300_init_IRQ;
mach_get_model = hp300_get_model;
- mach_gettimeoffset = hp300_gettimeoffset;
+ arch_gettimeoffset = hp300_gettimeoffset;
mach_hwclk = hp300_hwclk;
mach_get_ss = hp300_get_ss;
mach_reset = hp300_reset;
diff --git a/arch/m68k/hp300/time.c b/arch/m68k/hp300/time.c
index 29a71be..749543b 100644
--- a/arch/m68k/hp300/time.c
+++ b/arch/m68k/hp300/time.c
@@ -46,7 +46,7 @@ static irqreturn_t hp300_tick(int irq, void *dev_id)
return vector(irq, NULL);
}
-unsigned long hp300_gettimeoffset(void)
+u32 hp300_gettimeoffset(void)
{
/* Read current timer 1 value */
unsigned char lsb, msb1, msb2;
@@ -59,7 +59,7 @@ unsigned long hp300_gettimeoffset(void)
/* A carry happened while we were reading. Read it again */
lsb = in_8(CLOCKBASE + 7);
ticks = INTVAL - ((msb2 << 8) | lsb);
- return (USECS_PER_JIFFY * ticks) / INTVAL;
+ return ((USECS_PER_JIFFY * ticks) / INTVAL) * 1000;
}
void __init hp300_sched_init(irq_handler_t vector)
diff --git a/arch/m68k/hp300/time.h b/arch/m68k/hp300/time.h
index 7b98242..f5583ec 100644
--- a/arch/m68k/hp300/time.h
+++ b/arch/m68k/hp300/time.h
@@ -1,2 +1,2 @@
extern void hp300_sched_init(irq_handler_t vector);
-extern unsigned long hp300_gettimeoffset(void);
+extern u32 hp300_gettimeoffset(void);
diff --git a/arch/m68k/include/asm/machdep.h b/arch/m68k/include/asm/machdep.h
index 825c1c8..953ca21 100644
--- a/arch/m68k/include/asm/machdep.h
+++ b/arch/m68k/include/asm/machdep.h
@@ -3,6 +3,7 @@
#include <linux/seq_file.h>
#include <linux/interrupt.h>
+#include <linux/time.h>
struct pt_regs;
struct mktime;
@@ -16,7 +17,6 @@ extern void (*mach_init_IRQ) (void);
extern void (*mach_get_model) (char *model);
extern void (*mach_get_hardware_list) (struct seq_file *m);
/* machine dependent timer functions */
-extern unsigned long (*mach_gettimeoffset)(void);
extern int (*mach_hwclk)(int, struct rtc_time*);
extern unsigned int (*mach_get_ss)(void);
extern int (*mach_get_rtc_pll)(struct rtc_pll_info *);
diff --git a/arch/m68k/kernel/setup_mm.c b/arch/m68k/kernel/setup_mm.c
index d872ce4..80cfbe5 100644
--- a/arch/m68k/kernel/setup_mm.c
+++ b/arch/m68k/kernel/setup_mm.c
@@ -84,7 +84,6 @@ void (*mach_init_IRQ) (void) __initdata = NULL;
void (*mach_get_model) (char *model);
void (*mach_get_hardware_list) (struct seq_file *m);
/* machine dependent timer functions */
-unsigned long (*mach_gettimeoffset) (void);
int (*mach_hwclk) (int, struct rtc_time*);
EXPORT_SYMBOL(mach_hwclk);
int (*mach_set_clock_mmss) (unsigned long);
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index c2994c8..bea6bcf 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -82,11 +82,6 @@ void read_persistent_clock(struct timespec *ts)
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-static u32 m68k_gettimeoffset(void)
-{
- return mach_gettimeoffset() * 1000;
-}
-
static int __init rtc_init(void)
{
struct platform_device *pdev;
@@ -104,9 +99,5 @@ module_init(rtc_init);
void __init time_init(void)
{
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
- arch_gettimeoffset = m68k_gettimeoffset;
-#endif
-
mach_sched_init(timer_interrupt);
}
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index d9f62e0..afb95d5 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -52,7 +52,7 @@ struct mac_booter_data mac_bi_data;
static unsigned long mac_orig_videoaddr;
/* Mac specific timer functions */
-extern unsigned long mac_gettimeoffset(void);
+extern u32 mac_gettimeoffset(void);
extern int mac_hwclk(int, struct rtc_time *);
extern int mac_set_clock_mmss(unsigned long);
extern void iop_preinit(void);
@@ -177,7 +177,7 @@ void __init config_mac(void)
mach_sched_init = mac_sched_init;
mach_init_IRQ = mac_init_IRQ;
mach_get_model = mac_get_model;
- mach_gettimeoffset = mac_gettimeoffset;
+ arch_gettimeoffset = mac_gettimeoffset;
mach_hwclk = mac_hwclk;
mach_set_clock_mmss = mac_set_clock_mmss;
mach_reset = mac_reset;
diff --git a/arch/m68k/mac/via.c b/arch/m68k/mac/via.c
index 2d85662..5d1458b 100644
--- a/arch/m68k/mac/via.c
+++ b/arch/m68k/mac/via.c
@@ -327,7 +327,7 @@ void via_debug_dump(void)
* TBI: get time offset between scheduling timer ticks
*/
-unsigned long mac_gettimeoffset (void)
+u32 mac_gettimeoffset(void)
{
unsigned long ticks, offset = 0;
@@ -341,7 +341,7 @@ unsigned long mac_gettimeoffset (void)
ticks = MAC_CLOCK_TICK - ticks;
ticks = ticks * 10000L / MAC_CLOCK_TICK;
- return ticks + offset;
+ return (ticks + offset) * 1000;
}
/*
diff --git a/arch/m68k/mvme147/config.c b/arch/m68k/mvme147/config.c
index a41c091..1c62628 100644
--- a/arch/m68k/mvme147/config.c
+++ b/arch/m68k/mvme147/config.c
@@ -37,7 +37,7 @@
static void mvme147_get_model(char *model);
extern void mvme147_sched_init(irq_handler_t handler);
-extern unsigned long mvme147_gettimeoffset (void);
+extern u32 mvme147_gettimeoffset(void);
extern int mvme147_hwclk (int, struct rtc_time *);
extern int mvme147_set_clock_mmss (unsigned long);
extern void mvme147_reset (void);
@@ -88,7 +88,7 @@ void __init config_mvme147(void)
mach_max_dma_address = 0x01000000;
mach_sched_init = mvme147_sched_init;
mach_init_IRQ = mvme147_init_IRQ;
- mach_gettimeoffset = mvme147_gettimeoffset;
+ arch_gettimeoffset = mvme147_gettimeoffset;
mach_hwclk = mvme147_hwclk;
mach_set_clock_mmss = mvme147_set_clock_mmss;
mach_reset = mvme147_reset;
@@ -127,7 +127,7 @@ void mvme147_sched_init (irq_handler_t timer_routine)
/* This is always executed with interrupts disabled. */
/* XXX There are race hazards in this code XXX */
-unsigned long mvme147_gettimeoffset (void)
+u32 mvme147_gettimeoffset(void)
{
volatile unsigned short *cp = (volatile unsigned short *)0xfffe1012;
unsigned short n;
@@ -137,7 +137,7 @@ unsigned long mvme147_gettimeoffset (void)
n = *cp;
n -= PCC_TIMER_PRELOAD;
- return (unsigned long)n * 25 / 4;
+ return ((unsigned long)n * 25 / 4) * 1000;
}
static int bcd2int (unsigned char b)
diff --git a/arch/m68k/mvme16x/config.c b/arch/m68k/mvme16x/config.c
index b6d7d8a..080a342 100644
--- a/arch/m68k/mvme16x/config.c
+++ b/arch/m68k/mvme16x/config.c
@@ -43,7 +43,7 @@ static MK48T08ptr_t volatile rtc = (MK48T08ptr_t)MVME_RTC_BASE;
static void mvme16x_get_model(char *model);
extern void mvme16x_sched_init(irq_handler_t handler);
-extern unsigned long mvme16x_gettimeoffset (void);
+extern u32 mvme16x_gettimeoffset(void);
extern int mvme16x_hwclk (int, struct rtc_time *);
extern int mvme16x_set_clock_mmss (unsigned long);
extern void mvme16x_reset (void);
@@ -289,7 +289,7 @@ void __init config_mvme16x(void)
mach_max_dma_address = 0xffffffff;
mach_sched_init = mvme16x_sched_init;
mach_init_IRQ = mvme16x_init_IRQ;
- mach_gettimeoffset = mvme16x_gettimeoffset;
+ arch_gettimeoffset = mvme16x_gettimeoffset;
mach_hwclk = mvme16x_hwclk;
mach_set_clock_mmss = mvme16x_set_clock_mmss;
mach_reset = mvme16x_reset;
@@ -405,9 +405,9 @@ void mvme16x_sched_init (irq_handler_t timer_routine)
/* This is always executed with interrupts disabled. */
-unsigned long mvme16x_gettimeoffset (void)
+u32 mvme16x_gettimeoffset(void)
{
- return (*(volatile unsigned long *)0xfff42008);
+ return (*(volatile u32 *)0xfff42008) * 1000;
}
int bcd2int (unsigned char b)
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 1adb5b7..658542b 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -40,7 +40,7 @@ extern void q40_init_IRQ(void);
static void q40_get_model(char *model);
extern void q40_sched_init(irq_handler_t handler);
-static unsigned long q40_gettimeoffset(void);
+static u32 q40_gettimeoffset(void);
static int q40_hwclk(int, struct rtc_time *);
static unsigned int q40_get_ss(void);
static int q40_set_clock_mmss(unsigned long);
@@ -170,7 +170,7 @@ void __init config_q40(void)
mach_sched_init = q40_sched_init;
mach_init_IRQ = q40_init_IRQ;
- mach_gettimeoffset = q40_gettimeoffset;
+ arch_gettimeoffset = q40_gettimeoffset;
mach_hwclk = q40_hwclk;
mach_get_ss = q40_get_ss;
mach_get_rtc_pll = q40_get_rtc_pll;
@@ -204,9 +204,9 @@ int q40_parse_bootinfo(const struct bi_record *rec)
}
-static unsigned long q40_gettimeoffset(void)
+static u32 q40_gettimeoffset(void)
{
- return 5000 * (ql_ticks != 0);
+ return 5000 * (ql_ticks != 0) * 1000;
}
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 2ca25bd..f59ec58 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -36,7 +36,7 @@
char sun3_reserved_pmeg[SUN3_PMEGS_NUM];
-extern unsigned long sun3_gettimeoffset(void);
+extern u32 sun3_gettimeoffset(void);
static void sun3_sched_init(irq_handler_t handler);
extern void sun3_get_model (char* model);
extern int sun3_hwclk(int set, struct rtc_time *t);
@@ -141,7 +141,7 @@ void __init config_sun3(void)
mach_sched_init = sun3_sched_init;
mach_init_IRQ = sun3_init_IRQ;
mach_reset = sun3_reboot;
- mach_gettimeoffset = sun3_gettimeoffset;
+ arch_gettimeoffset = sun3_gettimeoffset;
mach_get_model = sun3_get_model;
mach_hwclk = sun3_hwclk;
mach_halt = sun3_halt;
diff --git a/arch/m68k/sun3/intersil.c b/arch/m68k/sun3/intersil.c
index 94fe801..889829e 100644
--- a/arch/m68k/sun3/intersil.c
+++ b/arch/m68k/sun3/intersil.c
@@ -23,9 +23,9 @@
#define START_VAL (INTERSIL_RUN | INTERSIL_INT_ENABLE | INTERSIL_24H_MODE)
/* does this need to be implemented? */
-unsigned long sun3_gettimeoffset(void)
+u32 sun3_gettimeoffset(void)
{
- return 1;
+ return 1000;
}
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index dd306c8..0532d64 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -48,7 +48,7 @@ void __init config_sun3x(void)
mach_sched_init = sun3x_sched_init;
mach_init_IRQ = sun3_init_IRQ;
- mach_gettimeoffset = sun3x_gettimeoffset;
+ arch_gettimeoffset = sun3x_gettimeoffset;
mach_reset = sun3x_reboot;
mach_hwclk = sun3x_hwclk;
diff --git a/arch/m68k/sun3x/time.c b/arch/m68k/sun3x/time.c
index 1d0a724..c8eb08a 100644
--- a/arch/m68k/sun3x/time.c
+++ b/arch/m68k/sun3x/time.c
@@ -71,7 +71,7 @@ int sun3x_hwclk(int set, struct rtc_time *t)
return 0;
}
/* Not much we can do here */
-unsigned long sun3x_gettimeoffset (void)
+u32 sun3x_gettimeoffset(void)
{
return 0L;
}
diff --git a/arch/m68k/sun3x/time.h b/arch/m68k/sun3x/time.h
index 6909e12..a4f9126 100644
--- a/arch/m68k/sun3x/time.h
+++ b/arch/m68k/sun3x/time.h
@@ -2,7 +2,7 @@
#define SUN3X_TIME_H
extern int sun3x_hwclk(int set, struct rtc_time *t);
-unsigned long sun3x_gettimeoffset (void);
+u32 sun3x_gettimeoffset(void);
void sun3x_sched_init(irq_handler_t vector);
struct mostek_dt {
--
1.7.0.4
^ permalink raw reply related
* [PATCH 02/11] time: convert arch_gettimeoffset to a pointer
From: Stephen Warren @ 2012-11-08 21:01 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352408516-21988-1-git-send-email-swarren@wwwdotorg.org>
From: Stephen Warren <swarren@nvidia.com>
Currently, whenever CONFIG_ARCH_USES_GETTIMEOFFSET is enabled, each
arch core provides a single implementation of arch_gettimeoffset(). In
many cases, different sub-architectures, different machines, or
different timer providers exist, and so the arch ends up implementing
arch_gettimeoffset() as a call-through-pointer anyway. Examples are
ARM, Cris, M68K, and it's arguable that the remaining architectures,
M32R and Blackfin, should be doing this anyway.
Modify arch_gettimeoffset so that it itself is a function pointer, which
the arch initializes. This will allow later changes to move the
initialization of this function into individual machine support or timer
drivers. This is particularly useful for code in drivers/clocksource
which should rely on an arch-independant mechanism to register their
implementation of arch_gettimeoffset().
This patch also converts the Cris architecture to set arch_gettimeoffset
directly to the final implementation in time_init(), because Cris already
had separate time_init() functions per sub-architecture. M68K and ARM
are converted to set arch_gettimeoffset the final implementation in later
patches, because they already have function pointers in place for this
purpose.
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: Hirokazu Takata <takata@linux-m32r.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/kernel/time.c | 6 +++++-
arch/blackfin/kernel/time.c | 6 +++++-
arch/cris/arch-v10/kernel/time.c | 6 ++++--
arch/cris/kernel/time.c | 11 -----------
arch/m32r/kernel/time.c | 4 +++-
arch/m68k/kernel/time.c | 16 ++++++++++------
include/linux/time.h | 4 +---
kernel/time/timekeeping.c | 20 +++++++++++++++++---
8 files changed, 45 insertions(+), 28 deletions(-)
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 09be0c3..b0190b4 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -70,7 +70,7 @@ EXPORT_SYMBOL(profile_pc);
#endif
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-u32 arch_gettimeoffset(void)
+static u32 arm_gettimeoffset(void)
{
if (system_timer->offset != NULL)
return system_timer->offset() * 1000;
@@ -164,6 +164,10 @@ device_initcall(timer_init_syscore_ops);
void __init time_init(void)
{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = arm_gettimeoffset;
+#endif
+
system_timer = machine_desc->timer;
system_timer->init();
sched_clock_postinit();
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index 2310b24..3126b92 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -85,7 +85,7 @@ time_sched_init(irqreturn_t(*timer_routine) (int, void *))
/*
* Should return useconds since last timer tick
*/
-u32 arch_gettimeoffset(void)
+static u32 blackfin_gettimeoffset(void)
{
unsigned long offset;
unsigned long clocks_per_jiffy;
@@ -141,6 +141,10 @@ void read_persistent_clock(struct timespec *ts)
void __init time_init(void)
{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = blackfin_gettimeoffset;
+#endif
+
#ifdef CONFIG_RTC_DRV_BFIN
/* [#2663] hack to filter junk RTC values that would cause
* userspace to have to deal with time values greater than
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index 162892f..fce7c54 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -55,9 +55,9 @@ unsigned long get_ns_in_jiffie(void)
return ns;
}
-unsigned long do_slow_gettimeoffset(void)
+static u32 cris_v10_gettimeoffset(void)
{
- unsigned long count;
+ u32 count;
/* The timer interrupt comes from Etrax timer 0. In order to get
* better precision, we check the current value. It might have
@@ -191,6 +191,8 @@ static struct irqaction irq2 = {
void __init
time_init(void)
{
+ arch_gettimeoffset = cris_v10_gettimeoffset;
+
/* probe for the RTC and read it if it exists
* Before the RTC can be probed the loops_per_usec variable needs
* to be initialized to make usleep work. A better value for
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index b063c92..fe6acda 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -39,17 +39,6 @@
extern unsigned long loops_per_jiffy; /* init/main.c */
unsigned long loops_per_usec;
-
-#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-extern unsigned long do_slow_gettimeoffset(void);
-static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
-
-u32 arch_gettimeoffset(void)
-{
- return do_gettimeoffset();
-}
-#endif
-
int set_rtc_mmss(unsigned long nowtime)
{
D(printk(KERN_DEBUG "set_rtc_mmss(%lu)\n", nowtime));
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 84dd040..1a15f81 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -57,7 +57,7 @@ extern void smp_local_timer_interrupt(void);
static unsigned long latch;
-u32 arch_gettimeoffset(void)
+static u32 m32r_gettimeoffset(void)
{
unsigned long elapsed_time = 0; /* [us] */
@@ -165,6 +165,8 @@ void read_persistent_clock(struct timespec *ts)
void __init time_init(void)
{
+ arch_gettimeoffset = m32r_gettimeoffset;
+
#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
|| defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
|| defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
diff --git a/arch/m68k/kernel/time.c b/arch/m68k/kernel/time.c
index 5d0bcaa..c2994c8 100644
--- a/arch/m68k/kernel/time.c
+++ b/arch/m68k/kernel/time.c
@@ -80,14 +80,9 @@ void read_persistent_clock(struct timespec *ts)
}
}
-void __init time_init(void)
-{
- mach_sched_init(timer_interrupt);
-}
-
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-u32 arch_gettimeoffset(void)
+static u32 m68k_gettimeoffset(void)
{
return mach_gettimeoffset() * 1000;
}
@@ -106,3 +101,12 @@ static int __init rtc_init(void)
module_init(rtc_init);
#endif /* CONFIG_ARCH_USES_GETTIMEOFFSET */
+
+void __init time_init(void)
+{
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+ arch_gettimeoffset = m68k_gettimeoffset;
+#endif
+
+ mach_sched_init(timer_interrupt);
+}
diff --git a/include/linux/time.h b/include/linux/time.h
index 4d358e9..05e32a7 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -142,9 +142,7 @@ void timekeeping_inject_sleeptime(struct timespec *delta);
* finer then tick granular time.
*/
#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
-extern u32 arch_gettimeoffset(void);
-#else
-static inline u32 arch_gettimeoffset(void) { return 0; }
+extern u32 (*arch_gettimeoffset)(void);
#endif
extern void do_gettimeofday(struct timeval *tv);
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e424970..9d00ace 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -140,6 +140,20 @@ static void tk_setup_internals(struct timekeeper *tk, struct clocksource *clock)
}
/* Timekeeper helper functions. */
+
+#ifdef CONFIG_ARCH_USES_GETTIMEOFFSET
+u32 (*arch_gettimeoffset)(void);
+
+u32 gettimeoffset(void)
+{
+ if (likely(arch_gettimeoffset))
+ return arch_gettimeoffset();
+ return 0;
+}
+#else
+static inline u32 gettimeoffset(void) { return 0; }
+#endif
+
static inline s64 timekeeping_get_ns(struct timekeeper *tk)
{
cycle_t cycle_now, cycle_delta;
@@ -157,7 +171,7 @@ static inline s64 timekeeping_get_ns(struct timekeeper *tk)
nsec >>= tk->shift;
/* If arch requires, add in gettimeoffset() */
- return nsec + arch_gettimeoffset();
+ return nsec + gettimeoffset();
}
static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
@@ -177,7 +191,7 @@ static inline s64 timekeeping_get_ns_raw(struct timekeeper *tk)
nsec = clocksource_cyc2ns(cycle_delta, clock->mult, clock->shift);
/* If arch requires, add in gettimeoffset() */
- return nsec + arch_gettimeoffset();
+ return nsec + gettimeoffset();
}
/* must hold write on timekeeper.lock */
@@ -211,7 +225,7 @@ static void timekeeping_forward_now(struct timekeeper *tk)
tk->xtime_nsec += cycle_delta * tk->mult;
/* If arch requires, add in gettimeoffset() */
- tk->xtime_nsec += (u64)arch_gettimeoffset() << tk->shift;
+ tk->xtime_nsec += (u64)gettimeoffset() << tk->shift;
tk_normalize_xtime(tk);
--
1.7.0.4
^ permalink raw reply related
* [PATCH 01/11] cris: move usec/nsec conversion to do_slow_gettimeoffset
From: Stephen Warren @ 2012-11-08 21:01 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352408516-21988-1-git-send-email-swarren@wwwdotorg.org>
From: Stephen Warren <swarren@nvidia.com>
Move usec to nsec conversion from arch_gettimeoffset() to
do_slow_gettimeoffset(); in a future patch, do_slow_gettimeoffset()
will be used directly as the implementation of arch_gettimeoffset(),
so needs to perform all required calculations.
Cc: Mikael Starvik <starvik@axis.com>
Cc: Jesper Nilsson <jesper.nilsson@axis.com>
Cc: linux-cris-kernel at axis.com
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/cris/arch-v10/kernel/time.c | 4 ++--
arch/cris/kernel/time.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/cris/arch-v10/kernel/time.c b/arch/cris/arch-v10/kernel/time.c
index bcffcb6..162892f 100644
--- a/arch/cris/arch-v10/kernel/time.c
+++ b/arch/cris/arch-v10/kernel/time.c
@@ -65,8 +65,8 @@ unsigned long do_slow_gettimeoffset(void)
*/
count = *R_TIMER0_DATA;
- /* Convert timer value to usec */
- return (TIMER0_DIV - count) * ((NSEC_PER_SEC/1000)/HZ)/TIMER0_DIV;
+ /* Convert timer value to nsec */
+ return (TIMER0_DIV - count) * (NSEC_PER_SEC/HZ)/TIMER0_DIV;
}
/* Excerpt from the Etrax100 HSDD about the built-in watchdog:
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 277ffc4..b063c92 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -46,7 +46,7 @@ static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;
u32 arch_gettimeoffset(void)
{
- return do_gettimeoffset() * 1000;
+ return do_gettimeoffset();
}
#endif
--
1.7.0.4
^ permalink raw reply related
* [PATCH] ARM: delete struct sys_timer
From: Stephen Warren @ 2012-11-08 21:01 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352408516-21988-1-git-send-email-swarren@wwwdotorg.org>
From: Stephen Warren <swarren@nvidia.com>
Now that the only field in struct sys_timer is .init, delete the struct,
and replace the machine descriptor .timer field with the initialization
function itself.
This will enable moving timer drivers into drivers/clocksource without
having to place a public prototype of each struct sys_timer object into
include/linux; the intent is to create a single of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html
RFC: This will be quite a large patch since it'll end up touching tens
or hundreds of ARM board files, timer drivers, etc. Perhaps it'd be
better to create patches that:
1) Add .init_time field to machine descriptor, update ARM's time_init to
use that if present, else fall back to .timer.init.
2) 1 patch per ARM sub-architecture to convert to from .timer to
.init_time.
3) Remove sys_timer and machine descriptor .timer field.
For now, this patch only converts Tegra as an example of my intent.
Signed-off-by: Stephen Warren <swarren@nvidia.com>
---
arch/arm/include/asm/mach/arch.h | 3 +--
arch/arm/include/asm/mach/time.h | 16 ----------------
arch/arm/kernel/time.c | 9 +--------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +-----
7 files changed, 6 insertions(+), 34 deletions(-)
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 917d4fc..308ad7d 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -12,7 +12,6 @@
struct tag;
struct meminfo;
-struct sys_timer;
struct pt_regs;
struct smp_operations;
#ifdef CONFIG_SMP
@@ -48,7 +47,7 @@ struct machine_desc {
void (*map_io)(void);/* IO mapping function */
void (*init_early)(void);
void (*init_irq)(void);
- struct sys_timer *timer; /* system tick timer */
+ void (*init_time)(void);
void (*init_machine)(void);
void (*init_late)(void);
#ifdef CONFIG_MULTI_IRQ_HANDLER
diff --git a/arch/arm/include/asm/mach/time.h b/arch/arm/include/asm/mach/time.h
index d316d76..90c12e1 100644
--- a/arch/arm/include/asm/mach/time.h
+++ b/arch/arm/include/asm/mach/time.h
@@ -10,22 +10,6 @@
#ifndef __ASM_ARM_MACH_TIME_H
#define __ASM_ARM_MACH_TIME_H
-/*
- * This is our kernel timer structure.
- *
- * - init
- * Initialise the kernels jiffy timer source, claim interrupt
- * using setup_irq. This is called early on during initialisation
- * while interrupts are still disabled on the local CPU.
- * - offset
- * Return the timer offset in microseconds since the last timer
- * interrupt. Note: this must take account of any unprocessed
- * timer interrupt which may be pending.
- */
-struct sys_timer {
- void (*init)(void);
-};
-
extern void timer_tick(void);
struct timespec;
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 0b51a7c..955d92d 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -30,11 +30,6 @@
#include <asm/mach/arch.h>
#include <asm/mach/time.h>
-/*
- * Our system timer.
- */
-static struct sys_timer *system_timer;
-
#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
/* this needs a better home */
@@ -120,8 +115,6 @@ int __init register_persistent_clock(clock_access_fn read_boot,
void __init time_init(void)
{
- system_timer = machine_desc->timer;
- system_timer->init();
+ machine_desc->init_time();
sched_clock_postinit();
}
-
diff --git a/arch/arm/mach-tegra/board-dt-tegra20.c b/arch/arm/mach-tegra/board-dt-tegra20.c
index 22f5a9b..3777b03 100644
--- a/arch/arm/mach-tegra/board-dt-tegra20.c
+++ b/arch/arm/mach-tegra/board-dt-tegra20.c
@@ -192,7 +192,7 @@ DT_MACHINE_START(TEGRA_DT, "nVidia Tegra20 (Flattened Device Tree)")
.init_early = tegra20_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra_dt_init,
.init_late = tegra_dt_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board-dt-tegra30.c b/arch/arm/mach-tegra/board-dt-tegra30.c
index cd30338..08d3b19 100644
--- a/arch/arm/mach-tegra/board-dt-tegra30.c
+++ b/arch/arm/mach-tegra/board-dt-tegra30.c
@@ -104,7 +104,7 @@ DT_MACHINE_START(TEGRA30_DT, "NVIDIA Tegra30 (Flattened Device Tree)")
.init_early = tegra30_init_early,
.init_irq = tegra_dt_init_irq,
.handle_irq = gic_handle_irq,
- .timer = &tegra_sys_timer,
+ .init_time = tegra_init_timer,
.init_machine = tegra30_dt_init,
.init_late = tegra_init_late,
.restart = tegra_assert_system_reset,
diff --git a/arch/arm/mach-tegra/board.h b/arch/arm/mach-tegra/board.h
index 91fbe73..744cdd2 100644
--- a/arch/arm/mach-tegra/board.h
+++ b/arch/arm/mach-tegra/board.h
@@ -55,5 +55,5 @@ static inline int harmony_pcie_init(void) { return 0; }
void __init tegra_paz00_wifikill_init(void);
-extern struct sys_timer tegra_sys_timer;
+extern void tegra_init_timer(void);
#endif
diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index e4863f3..b0036e5 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -168,7 +168,7 @@ static const struct of_device_id rtc_match[] __initconst = {
{}
};
-static void __init tegra_init_timer(void)
+void __init tegra_init_timer(void)
{
struct device_node *np;
struct clk *clk;
@@ -273,10 +273,6 @@ static void __init tegra_init_timer(void)
register_persistent_clock(NULL, tegra_read_persistent_clock);
}
-struct sys_timer tegra_sys_timer = {
- .init = tegra_init_timer,
-};
-
#ifdef CONFIG_PM
static u32 usec_config;
--
1.7.0.4
^ permalink raw reply related
* [RFC PATCH 00/11] arch_gettimeoffset and ARM timer rework
From: Stephen Warren @ 2012-11-08 21:01 UTC (permalink / raw)
To: linux-arm-kernel
From: Stephen Warren <swarren@nvidia.com>
The overall aim of this series is to allow ARM (or indeed any) timer
drivers to be moved into drivers/clocksource without requiring a
struct or function prototype for each individual driver in include/linux.
The intent is eventually to create a single e.g. of_clocksource_init()
function that determines which timer driver to initialize by scanning
the device dtree, much like the proposed irqchip_init() at:
http://www.spinics.net/lists/arm-kernel/msg203686.html
This requires some rework prior to implementing of_clocksource_init():
ARM uses struct sys_timer to represent the individual machine's timer
driver. Many of the patches in this series are ARM-specific changes to
get rid of this struct, leaving just a single init function instead.
One function pointer in the struct provides the implementation of
arch_gettimeoffset(). Removing the struct and moving drivers into the
generic drivers/clocksource directory requires an arch-agnostic way of
registering the implementation of this function. The first few patches
in the series provide that, and rework various architectures to make use
of this facility rather than implementing the same thing themselves.
It would probably be easiest to merge this whole series through the
arm-soc tree. Anything else would require some co-ordination.
Stephen Warren (11):
cris: move usec/nsec conversion to do_slow_gettimeoffset
time: convert arch_gettimeoffset to a pointer
m68k: set arch_gettimeoffset directly
ARM: set arch_gettimeoffset directly
ARM: at91: convert timer suspend/resume to clock_event_device
ARM: pxa: convert timer suspend/resume to clock_event_device
ARM: sa1100: convert timer suspend/resume to clock_event_device
ARM: ux500: convert timer suspend/resume to clock_event_device
ARM: samsung: register syscore_ops for timer resume directly
ARM: remove struct sys_timer suspend and resume fields
ARM: delete struct sys_timer
arch/arm/include/asm/mach/arch.h | 3 +-
arch/arm/include/asm/mach/time.h | 30 ------------
arch/arm/kernel/time.c | 53 +----------------------
arch/arm/mach-at91/at91sam926x_time.c | 47 +++++++++++---------
arch/arm/mach-at91/at91x40_time.c | 8 ++-
arch/arm/mach-ebsa110/core.c | 7 ++-
arch/arm/mach-ep93xx/core.c | 23 +++++-----
arch/arm/mach-h720x/common.c | 6 +-
arch/arm/mach-h720x/common.h | 2 +-
arch/arm/mach-h720x/cpu-h7201.c | 3 +-
arch/arm/mach-h720x/cpu-h7202.c | 3 +-
arch/arm/mach-pxa/time.c | 76 ++++++++++++++++----------------
arch/arm/mach-rpc/time.c | 6 +-
arch/arm/mach-sa1100/time.c | 66 ++++++++++++++--------------
arch/arm/mach-tegra/board-dt-tegra20.c | 2 +-
arch/arm/mach-tegra/board-dt-tegra30.c | 2 +-
arch/arm/mach-tegra/board.h | 2 +-
arch/arm/mach-tegra/timer.c | 6 +--
arch/arm/mach-ux500/timer.c | 7 ---
arch/arm/plat-samsung/time.c | 14 ++++--
arch/blackfin/kernel/time.c | 6 ++-
arch/cris/arch-v10/kernel/time.c | 10 +++--
arch/cris/kernel/time.c | 11 -----
arch/m32r/kernel/time.c | 4 +-
arch/m68k/amiga/config.c | 10 ++--
arch/m68k/apollo/config.c | 9 ++--
arch/m68k/atari/config.c | 4 +-
arch/m68k/atari/time.c | 6 +-
arch/m68k/bvme6000/config.c | 10 ++--
arch/m68k/hp300/config.c | 2 +-
arch/m68k/hp300/time.c | 4 +-
arch/m68k/hp300/time.h | 2 +-
arch/m68k/include/asm/machdep.h | 2 +-
arch/m68k/kernel/setup_mm.c | 1 -
arch/m68k/kernel/time.c | 15 ++----
arch/m68k/mac/config.c | 4 +-
arch/m68k/mac/via.c | 4 +-
arch/m68k/mvme147/config.c | 8 ++--
arch/m68k/mvme16x/config.c | 8 ++--
arch/m68k/q40/config.c | 8 ++--
arch/m68k/sun3/config.c | 4 +-
arch/m68k/sun3/intersil.c | 4 +-
arch/m68k/sun3x/config.c | 2 +-
arch/m68k/sun3x/time.c | 2 +-
arch/m68k/sun3x/time.h | 2 +-
drivers/clocksource/nomadik-mtu.c | 33 ++++++++-----
include/linux/time.h | 4 +-
kernel/time/timekeeping.c | 20 +++++++-
48 files changed, 249 insertions(+), 316 deletions(-)
^ permalink raw reply
* [RFC] arm: memtest
From: Alexander Holler @ 2012-11-08 20:48 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
I've recently discovered the lack of the command line parameter memtest
for ARM. So I've made a patch.
But I have some questions:
1. arch/x86/mm/memtest.c looks platform independ.
The only thing why I don't use it for arm, is because it uses 64bit
pointers. Maybe it could be moved to mm/memtest.c. If so, the
memtest32.c I'm using (basically a copy of memtest.c) could be moved
there too.
2. Because the below memtest32.c is basically a copy of
arch/x86/mm/memtest.c, I'm not sure if the mapping from physical to
virtual locations there does fit (always) for ARM too. I know almost as
much about the in-kernel memory organization on x86 as on ARM, which is
not really that much (some theory about TLBs, some source code
explorations, ..., but I'm working on it). ;)
3. I've just implemented a test for all the memory which is marked as
free, leaving all reserved memory untested. But even if a full memory
test could only be done in the boot-loader, I think at least some of the
memory the kernel reserves for itself (e.g. for modules) could be tested
too. I just haven't searched how/where this could be done. Maybe someone
else has a hint or even a patch for the below patch.
4. I don't have an ARM box with bad memory. So my tests are a bit
limited. Maybe someone else could do a test with real bad memory.
Anyway, I would still prefer to have at least the possibility to test
some of the memory using the kernel instead of none at all. So if nobody
offers a better solution, I would be glad if the below patch would find
some friends. ;)
Regards,
Alexander
Here is how dmesg does look like (memtest=4):
--------- no error ---------
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] 0000000000 - 0000004000 pattern ffffffff
[ 0.000000] 0000000000 - 0000004000 pattern 55555555
[ 0.000000] 0000000000 - 0000004000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 000054c000 - 0007ffb000 pattern 00000000
[ 0.000000] 000054c000 - 0007ffb000 pattern ffffffff
[ 0.000000] 000054c000 - 0007ffb000 pattern 55555555
[ 0.000000] 000054c000 - 0007ffb000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 000054c000 - 0007ffb000 pattern 00000000
[ 0.000000] Memory: 128MB = 128MB total
[ 0.000000] Memory: 125648k/125648k available, 5424k reserved, 0K highmem
--------- no error ---------
--------- error inected (by sw) ---------
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] 0000000000 - 0000004000 pattern ffffffff
[ 0.000000] 0000000000 - 0000004000 pattern 55555555
[ 0.000000] 0000000000 - 0000004000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 000054c000 - 0007ffb000 pattern 00000000
[ 0.000000] 00000000 bad mem addr 0000600000 - 0000600014 reserved
[ 0.000000] 0000600014 - 0007ffb000 pattern 00000000
[ 0.000000] 000054c000 - 0000600000 pattern ffffffff
[ 0.000000] 0000600014 - 0007ffb000 pattern ffffffff
[ 0.000000] 000054c000 - 0000600000 pattern 55555555
[ 0.000000] 0000600014 - 0007ffb000 pattern 55555555
[ 0.000000] 000054c000 - 0000600000 pattern aaaaaaaa
[ 0.000000] 0000600014 - 0007ffb000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 000054c000 - 0000600000 pattern 00000000
[ 0.000000] 0000600014 - 0007ffb000 pattern 00000000
[ 0.000000] Memory: 128MB = 128MB total
[ 0.000000] Memory: 125648k/125648k available, 5424k reserved, 0K highmem
--------- error inected (by sw) ---------
--------- with hole (mem=99M at 0x0 mem=28M at 0x6400000) ---------
[ 0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] 0000000000 - 0000004000 pattern ffffffff
[ 0.000000] 0000000000 - 0000004000 pattern 55555555
[ 0.000000] 0000000000 - 0000004000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 0000000000 - 0000004000 pattern 00000000
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 000054c000 - 0006300000 pattern 00000000
[ 0.000000] 000054c000 - 0006300000 pattern ffffffff
[ 0.000000] 000054c000 - 0006300000 pattern 55555555
[ 0.000000] 000054c000 - 0006300000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 000054c000 - 0006300000 pattern 00000000
[ 0.000000] early_memtest: # of tests: 4
[ 0.000000] 0006400000 - 0007ffb000 pattern 00000000
[ 0.000000] 0006400000 - 0007ffb000 pattern ffffffff
[ 0.000000] 0006400000 - 0007ffb000 pattern 55555555
[ 0.000000] 0006400000 - 0007ffb000 pattern aaaaaaaa
[ 0.000000] early_memtest: wipe out test pattern from memory
[ 0.000000] 0006400000 - 0007ffb000 pattern 00000000
[ 0.000000] Memory: 99MB 28MB = 127MB total
[ 0.000000] Memory: 124624k/124624k available, 5424k reserved, 0K highmem
--------- with hole (mem=99M at 0x0 mem=28M at 0x6400000) ---------
From 3034a0d2fc71c8edef43d0d04b3be0ffad484fca Mon Sep 17 00:00:00 2001
From: Alexander Holler <holler@ahsoftware.de>
Date: Wed, 31 Oct 2012 22:24:04 +0100
Subject: [PATCH] arm: add memtest
Signed-off-by: Alexander Holler <holler@ahsoftware.de>
---
arch/arm/mm/Kconfig | 11 ++++
arch/arm/mm/Makefile | 2 +
arch/arm/mm/init.c | 36 +++++++++++++-
arch/arm/mm/memtest32.c | 126
+++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 173 insertions(+), 2 deletions(-)
create mode 100644 arch/arm/mm/memtest32.c
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 101b968..b14941f 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -874,3 +874,14 @@ config ARCH_HAS_BARRIERS
help
This option allows the use of custom mandatory barriers
included via the mach/barriers.h file.
+
+config MEMTEST
+ bool "Memtest"
+ ---help---
+ This option adds a kernel parameter 'memtest', which allows memtest
+ to be set.
+ memtest=0, mean disabled; -- default
+ memtest=1, mean do 1 test pattern;
+ ...
+ memtest=4, mean do 4 test patterns.
+ If you are unsure how to answer this question, answer N.
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index 8a9c4cb..8cbfda1 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -96,3 +96,5 @@ obj-$(CONFIG_CACHE_FEROCEON_L2) += cache-feroceon-l2.o
obj-$(CONFIG_CACHE_L2X0) += cache-l2x0.o
obj-$(CONFIG_CACHE_XSC3L2) += cache-xsc3l2.o
obj-$(CONFIG_CACHE_TAUROS2) += cache-tauros2.o
+
+obj-$(CONFIG_MEMTEST) += memtest32.o
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 9aec41f..0941946 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -584,6 +584,10 @@ static void __init free_highpages(void)
#endif
}
+#ifdef CONFIG_MEMTEST
+extern void early_memtest32(unsigned long start, unsigned long end);
+#endif
+
/*
* mem_init() marks the free areas in the mem_map and tells us how much
* memory is free. This is done after various parts of the system have
@@ -618,6 +622,9 @@ void __init mem_init(void)
reserved_pages = free_pages = 0;
for_each_bank(i, &meminfo) {
+#ifdef CONFIG_MEMTEST
+ phys_addr_t memtest_start = 0xffffffff, memtest_end;
+#endif
struct membank *bank = &meminfo.bank[i];
unsigned int pfn1, pfn2;
struct page *page, *end;
@@ -629,12 +636,37 @@ void __init mem_init(void)
end = pfn_to_page(pfn2 - 1) + 1;
do {
- if (PageReserved(page))
+ if (PageReserved(page)) {
reserved_pages++;
- else if (!page_count(page))
+#ifdef CONFIG_MEMTEST
+ /* something has cut a hole */
+ if (memtest_start != 0xffffffff) {
+ early_memtest32(memtest_start, memtest_end);
+ memtest_start = 0xffffffff;
+ }
+#endif
+ } else if (!page_count(page)) {
free_pages++;
+#ifdef CONFIG_MEMTEST
+ if (memtest_start == 0xffffffff) {
+ /* start of a block for memtest */
+ memtest_start = page_to_phys(page);
+ } else if (memtest_end != page_to_phys(page)) {
+ /* hole detected, call memtest */
+ early_memtest32(memtest_start, memtest_end);
+ /* and start with new values */
+ memtest_start = page_to_phys(page);
+ }
+ memtest_end = page_to_phys(page)+PAGE_SIZE;
+#endif
+ }
page++;
} while (page < end);
+#ifdef CONFIG_MEMTEST
+ if (memtest_start != 0xffffffff)
+ early_memtest32(memtest_start, memtest_end);
+ /* if bad memory was found, reserved_pages is wrong (without bad mem) */
+#endif
}
/*
diff --git a/arch/arm/mm/memtest32.c b/arch/arm/mm/memtest32.c
new file mode 100644
index 0000000..1564b5b
--- /dev/null
+++ b/arch/arm/mm/memtest32.c
@@ -0,0 +1,126 @@
+/* This is just a checkpatch'ed copy of arch/x86/mm/memtest.c modified
to use 32bit */
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/types.h>
+#include <linux/mm.h>
+#include <linux/smp.h>
+#include <linux/init.h>
+#include <linux/pfn.h>
+#include <linux/memblock.h>
+
+static u32 patterns[] __initdata = {
+ 0,
+ 0xffffffffUL,
+ 0x55555555UL,
+ 0xaaaaaaaaUL,
+ 0x11111111UL,
+ 0x22222222UL,
+ 0x44444444UL,
+ 0x88888888UL,
+ 0x33333333UL,
+ 0x66666666UL,
+ 0x99999999UL,
+ 0xccccccccUL,
+ 0x77777777UL,
+ 0xbbbbbbbbUL,
+ 0xddddddddUL,
+ 0xeeeeeeeeUL,
+ 0x7a6c7258UL, /* yeah ;-) */
+};
+
+static void __init reserve_bad_mem(u32 pattern, u32 start_bad, u32 end_bad)
+{
+ pr_info(" %08lx bad mem addr %010lx - %010lx reserved\n",
+ (unsigned long) pattern,
+ (unsigned long) start_bad,
+ (unsigned long) end_bad);
+ memblock_reserve(start_bad, end_bad - start_bad);
+}
+
+static void __init memtest(u32 pattern, u32 start_phys, u32 size)
+{
+ u32 *p, *start, *end;
+ u32 start_bad, last_bad;
+ u32 start_phys_aligned;
+ const size_t incr = sizeof(pattern);
+
+ start_phys_aligned = ALIGN(start_phys, incr);
+ start = __va(start_phys_aligned);
+ end = start + (size - (start_phys_aligned - start_phys)) / incr;
+ start_bad = 0;
+ last_bad = 0;
+
+ for (p = start; p < end; p++)
+ *p = pattern;
+
+ for (p = start; p < end; p++, start_phys_aligned += incr) {
+ if (*p == pattern)
+ continue;
+ if (start_phys_aligned == last_bad + incr) {
+ last_bad += incr;
+ continue;
+ }
+ if (start_bad)
+ reserve_bad_mem(pattern, start_bad, last_bad + incr);
+ start_bad = last_bad = start_phys_aligned;
+ }
+ if (start_bad)
+ reserve_bad_mem(pattern, start_bad, last_bad + incr);
+}
+
+static void __init do_one_pass(u32 pattern, u32 start, u32 end)
+{
+ u64 i;
+ phys_addr_t this_start, this_end;
+
+ for_each_free_mem_range(i, MAX_NUMNODES, &this_start, &this_end, NULL) {
+ this_start = clamp_t(phys_addr_t, this_start, start, end);
+ this_end = clamp_t(phys_addr_t, this_end, start, end);
+ if (this_start < this_end) {
+ pr_info(" %010lx - %010lx pattern %08lx\n",
+ (unsigned long)this_start,
+ (unsigned long)this_end,
+ (unsigned long)cpu_to_be32(pattern));
+ memtest(pattern, this_start, this_end - this_start);
+ }
+ }
+}
+
+/* default is disabled */
+static int memtest_pattern __initdata;
+
+static int __init parse_memtest(char *arg)
+{
+ ssize_t ret __always_unused;
+
+ if (arg)
+ ret = kstrtoint(arg, 0, &memtest_pattern);
+ else
+ memtest_pattern = ARRAY_SIZE(patterns);
+
+ return 0;
+}
+
+early_param("memtest", parse_memtest);
+
+void __init early_memtest32(unsigned long start, unsigned long end)
+{
+ unsigned int i;
+ unsigned int idx = 0;
+
+ if (!memtest_pattern)
+ return;
+
+ pr_info("early_memtest: # of tests: %d\n", memtest_pattern);
+ for (i = 0; i < memtest_pattern; i++) {
+ idx = i % ARRAY_SIZE(patterns);
+ do_one_pass(patterns[idx], start, end);
+ }
+
+ if (idx > 0) {
+ pr_info("early_memtest: wipe out test pattern from memory\n");
+ /* additional test with pattern 0 will do this */
+ do_one_pass(0, start, end);
+ }
+}
--
1.7.8.6
^ permalink raw reply related
* [PATCH 11/15] ARM: OMAP: timer: Interchange clksrc and clkevt for AM33XX
From: Jon Hunter @ 2012-11-08 20:41 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1351859566-24818-12-git-send-email-vaibhav.bedia@ti.com>
On 11/02/2012 07:32 AM, Vaibhav Bedia wrote:
> AM33XX has only one usable timer in the WKUP domain.
> Currently the timer instance in WKUP domain is used
> as the clockevent and the timer in non-WKUP domain
> as the clocksource. The timer in WKUP domain can keep
> running in suspend from a 32K clock and hence serve
> as the persistent clock. To enable this, interchange
> the timers used as clocksource and clockevent for
> AM33XX. A subsequent patch will add suspend-resume
> support for the clockevent to ensure that there are
> no issues with timekeeping.
>
> Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
> ---
> arch/arm/mach-omap2/timer.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
> index 565e575..6584ee0 100644
> --- a/arch/arm/mach-omap2/timer.c
> +++ b/arch/arm/mach-omap2/timer.c
> @@ -460,7 +460,7 @@ OMAP_SYS_TIMER(3_secure)
> #endif
>
> #ifdef CONFIG_SOC_AM33XX
> -OMAP_SYS_TIMER_INIT(3_am33xx, 1, OMAP4_MPU_SOURCE, 2, OMAP4_MPU_SOURCE)
> +OMAP_SYS_TIMER_INIT(3_am33xx, 2, OMAP4_MPU_SOURCE, 1, OMAP4_MPU_SOURCE)
> OMAP_SYS_TIMER(3_am33xx)
> #endif
By the way, for v3.8 (assuming that timer DT patches go in, currently
queued in Tony's master), when booting with DT the clock-source and
clock-events will be selected by timer feature and not ID. So you may
wish to rebase on top of Tony's master.
Cheers
Jon
^ permalink raw reply
* linux-next: manual merge of the arm-soc tree with the l2-mtd and pinctrl trees
From: Stephen Rothwell @ 2012-11-08 20:27 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201211081511.54467.arnd@arndb.de>
Hi Arnd,
On Thu, 8 Nov 2012 15:11:54 +0000 Arnd Bergmann <arnd@arndb.de> wrote:
>
> I think this one turned out wrong, and is missing this part:
>
> diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
> index 5ccdf53..69769b7 100644
> --- a/arch/arm/mach-nomadik/board-nhk8815.c
> +++ b/arch/arm/mach-nomadik/board-nhk8815.c
> @@ -26,7 +26,6 @@
> #include <linux/pinctrl/machine.h>
> #include <linux/platform_data/pinctrl-nomadik.h>
> #include <linux/platform_data/clocksource-nomadik-mtu.h>
> -#include <linux/platform_data/mtd-nomadik-nand.h>
> #include <asm/hardware/vic.h>
> #include <asm/sizes.h>
> #include <asm/mach-types.h>
>
>
> The mtd-nomadik-nand.h inclusion was removed in the l2-mtd tree, but
> moved to a different line in the arm-soc tree. It needs to be removed
> because the header is gone now.
Thanks for that. I have now fixed up my fix up :-)
--
Cheers,
Stephen Rothwell sfr at canb.auug.org.au
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121109/f7ec4720/attachment.sig>
^ permalink raw reply
* [PATCH] ARM: versatile: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/mach-versatile/pci.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 2f84f40..3936a11 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -82,12 +82,9 @@ static void __iomem *__pci_addr(struct pci_bus *bus,
/*
* Trap out illegal values
*/
- if (offset > 255)
- BUG();
- if (busnr > 255)
- BUG();
- if (devfn > 255)
- BUG();
+ BUG_ON(offset > 255);
+ BUG_ON(busnr > 255);
+ BUG_ON(devfn > 255);
return VERSATILE_PCI_CFG_VIRT_BASE + ((busnr << 16) |
(PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | offset);
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: dma: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/mach-rpc/dma.c | 3 +--
arch/arm/mach-s3c64xx/dma.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index 85883b2..92e22ba 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -265,8 +265,7 @@ static void floppy_enable_dma(unsigned int chan, dma_t *dma)
unsigned int fiqhandler_length;
struct pt_regs regs;
- if (fdma->dma.sg)
- BUG();
+ BUG_ON(fdma->dma.sg);
if (fdma->dma.dma_mode == DMA_MODE_READ) {
extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
diff --git a/arch/arm/mach-s3c64xx/dma.c b/arch/arm/mach-s3c64xx/dma.c
index f2a7a17..585c2ae 100644
--- a/arch/arm/mach-s3c64xx/dma.c
+++ b/arch/arm/mach-s3c64xx/dma.c
@@ -603,8 +603,7 @@ static irqreturn_t s3c64xx_dma_irq(int irq, void *pw)
&& buff->next != chan->next)
buff = buff->next;
- if (!buff)
- BUG();
+ BUG_ON(!buff);
if (buff == chan->next)
buff = chan->end;
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: OMAP1: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/mach-omap1/board-fsample.c | 3 +--
arch/arm/mach-omap1/board-h2.c | 3 +--
arch/arm/mach-omap1/board-h3.c | 3 +--
arch/arm/mach-omap1/board-perseus2.c | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 8b5800a..7ca6cc4 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -307,8 +307,7 @@ static void __init omap_fsample_init(void)
fsample_init_smc91x();
- if (gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0)
- BUG();
+ BUG_ON(gpio_request(FSAMPLE_NAND_RB_GPIO_PIN, "NAND ready") < 0);
gpio_direction_input(FSAMPLE_NAND_RB_GPIO_PIN);
omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 9134b64..4953cf7 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -412,8 +412,7 @@ static void __init h2_init(void)
h2_nand_resource.end = h2_nand_resource.start = OMAP_CS2B_PHYS;
h2_nand_resource.end += SZ_4K - 1;
- if (gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
- BUG();
+ BUG_ON(gpio_request(H2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
gpio_direction_input(H2_NAND_RB_GPIO_PIN);
omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index bf213d1..563ba16 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -406,8 +406,7 @@ static void __init h3_init(void)
nand_resource.end = nand_resource.start = OMAP_CS2B_PHYS;
nand_resource.end += SZ_4K - 1;
- if (gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0)
- BUG();
+ BUG_ON(gpio_request(H3_NAND_RB_GPIO_PIN, "NAND ready") < 0);
gpio_direction_input(H3_NAND_RB_GPIO_PIN);
/* GPIO10 Func_MUX_CTRL reg bit 29:27, Configure V2 to mode1 as GPIO */
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index 030bd48..67c2612 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -275,8 +275,7 @@ static void __init omap_perseus2_init(void)
perseus2_init_smc91x();
- if (gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0)
- BUG();
+ BUG_ON(gpio_request(P2_NAND_RB_GPIO_PIN, "NAND ready") < 0);
gpio_direction_input(P2_NAND_RB_GPIO_PIN);
omap_cfg_reg(L3_1610_FLASH_CS2B_OE);
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: integrator: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/mach-integrator/pci_v3.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index bbeca59..85938de 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -191,12 +191,9 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus,
/*
* Trap out illegal values
*/
- if (offset > 255)
- BUG();
- if (busnr > 255)
- BUG();
- if (devfn > 255)
- BUG();
+ BUG_ON(offset > 255);
+ BUG_ON(busnr > 255);
+ BUG_ON(devfn > 255);
if (busnr == 0) {
int slot = PCI_SLOT(devfn);
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: EXYNOS: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/mach-exynos/common.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-exynos/common.c b/arch/arm/mach-exynos/common.c
index 4e577f6..6a55a5a 100644
--- a/arch/arm/mach-exynos/common.c
+++ b/arch/arm/mach-exynos/common.c
@@ -465,10 +465,8 @@ static void __init combiner_cascade_irq(unsigned int combiner_nr, unsigned int i
else
max_nr = EXYNOS4_MAX_COMBINER_NR;
- if (combiner_nr >= max_nr)
- BUG();
- if (irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0)
- BUG();
+ BUG_ON(combiner_nr >= max_nr);
+ BUG_ON(irq_set_handler_data(irq, &combiner_data[combiner_nr]) != 0);
irq_set_chained_handler(irq, combiner_handle_cascade_irq);
}
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: kprobes: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/kernel/kprobes-test.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/arm/kernel/kprobes-test.c b/arch/arm/kernel/kprobes-test.c
index 1862d8f..0fb370d 100644
--- a/arch/arm/kernel/kprobes-test.c
+++ b/arch/arm/kernel/kprobes-test.c
@@ -1212,8 +1212,7 @@ static int register_test_probe(struct test_probe *probe)
{
int ret;
- if (probe->registered)
- BUG();
+ BUG_ON(probe->registered);
ret = register_kprobe(&probe->kprobe);
if (ret >= 0) {
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: gic: use BUG_ON where possible
From: Sasha Levin @ 2012-11-08 20:23 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352406191-14303-1-git-send-email-sasha.levin@oracle.com>
Just use BUG_ON() instead of constructions such as:
if (...)
BUG()
A simplified version of the semantic patch that makes this transformation
is as follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
@@
- if (e) BUG();
+ BUG_ON(e);
// </smpl>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
arch/arm/common/gic.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index aa52699..f0b8a10 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -336,10 +336,8 @@ static struct irq_chip gic_chip = {
void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
{
- if (gic_nr >= MAX_GIC_NR)
- BUG();
- if (irq_set_handler_data(irq, &gic_data[gic_nr]) != 0)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
+ BUG_ON(irq_set_handler_data(irq, &gic_data[gic_nr]) != 0);
irq_set_chained_handler(irq, gic_handle_cascade_irq);
}
@@ -421,8 +419,7 @@ static void gic_dist_save(unsigned int gic_nr)
void __iomem *dist_base;
int i;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
gic_irqs = gic_data[gic_nr].gic_irqs;
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
@@ -456,8 +453,7 @@ static void gic_dist_restore(unsigned int gic_nr)
unsigned int i;
void __iomem *dist_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
gic_irqs = gic_data[gic_nr].gic_irqs;
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
@@ -493,8 +489,7 @@ static void gic_cpu_save(unsigned int gic_nr)
void __iomem *dist_base;
void __iomem *cpu_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
cpu_base = gic_data_cpu_base(&gic_data[gic_nr]);
@@ -519,8 +514,7 @@ static void gic_cpu_restore(unsigned int gic_nr)
void __iomem *dist_base;
void __iomem *cpu_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
cpu_base = gic_data_cpu_base(&gic_data[gic_nr]);
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: OMAP4: TWL: mux sys_drm_msecure as output for PMIC
From: Nishanth Menon @ 2012-11-08 20:10 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121108192834.GA2962@arwen.pp.htv.fi>
On 21:28-20121108, Felipe Balbi wrote:
> Hi,
>
> On Thu, Nov 08, 2012 at 11:08:50AM -0800, Kevin Hilman wrote:
> > From: Kevin Hilman <khilman@ti.com>
> >
> > On OMAP4 boards using the TWL6030 PMIC, the sys_drm_msecure is
> > connected to the MSECURE input of the TWL6030 PMIC. This signal
> > controls the secure-mode operation of the PMIC. If its not mux'd
> > correctly, some functionality of the PMIC will not be accessible since
> > the PMIC will be in secure mode.
> >
> > For example, if the TWL RTC is in secure mode, most of its registers
> > are read-only, meaning (re)programming the RTC (e.g. for wakeup from
> > suspend) will fail.
> >
> > To fix, ensure the signal is properly mux'd as output when TWL is
> > intialized.
> >
> > This fix is required when using recent versions of u-boot (>= v2012.04.01)
> > since u-boot is no longer setting the default mux for this pin.
> >
> > Signed-off-by: Kevin Hilman <khilman@ti.com>
> > ---
> > Based on v3.7-rc4. Targetted as a fix for v3.7.
> >
> > A correponding DT fix for this is needed as well, but that will be part of
> > a bigger series to get PM working with DT boot and needs to include other
> > pins like sys_nirq1.
> >
> > arch/arm/mach-omap2/twl-common.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> > index 635e109..96cae8b 100644
> > --- a/arch/arm/mach-omap2/twl-common.c
> > +++ b/arch/arm/mach-omap2/twl-common.c
> > @@ -73,6 +73,7 @@ void __init omap4_pmic_init(const char *pmic_type,
> > {
> > /* PMIC part*/
> > omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
> > + omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
> > omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
> >
> > /* Register additional devices on i2c1 bus if needed */
>
> not entirely related to $SUBJECT but this essentially means we're
> dropping the security feature whenever Linux runs.
Unless we intend to remove RTC driver in it's entirety and implement RTC
time change update in secure driver, current twl rtc driver was never
meant to exist with RTC time updates only in trustzone mode. Neither does
it drop any security feature when ever Linux runs- msecure pin has not
been used for any other purpose to my knowledge with Linux. So, this
change does not change the status quo we are currently in,
>
> Shouldn't we try to change that pin at register write boundaries so we
> keep the secure feature enabled until we know we're going to write to
> the HW ?
>
> Maybe it could even be done later through pinctrl, perhaps ?
That might be a better solution I agree. We might be locking down to a
specific pin name here, which could potentially change in a future SoC.
The right approach IMHO would be omap_gpio_mux equivalent.
Example change for OMAP5 purely from a board perspective(gerrit warning):
http://review.omapzoom.org/#/c/23819/5/arch/arm/mach-omap2/board-omap5evm.c,unified
Further, depending on how it is hooked on a different board (not that I
have seen any different other than msecure), it might even be hooked on
to another GPIO, making this scenario not scaling to "theoretical board
configuration".
--
Regards,
Nishanth Menon
^ permalink raw reply
* [GIT PULL] ARM: OMAP: Timer and Counter DT Updates for v3.8
From: Jon Hunter @ 2012-11-08 19:47 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121108173824.GE6801@atomide.com>
On 11/08/2012 11:38 AM, Tony Lindgren wrote:
> * Jon Hunter <jon-hunter@ti.com> [121108 09:21]:
>>
>> On 11/07/2012 05:44 PM, Tony Lindgren wrote:
>>
>> That's a bugger. I completely missed your patch last week sorry (I will blame the Danish
>> beer) and had clearly not folded in to my testing!
>
> :)
>
>>> I guess we should apply the following fix somewhere or
>>> do we need to check other places too?
>>
>> I will re-test your master branch today and put it through my dmtimer tests to double check.
>> However, in general I did ensure that we checked pdata was not NULL before accessing when
>> I introduced the dt stuff. In my changelog [1] I had ...
>>
>> "5. When device-tree is present the platform_data structure will be NULL and so check for
>> this."
>>
>> I just need to make sure that get_context_loss_count() is not called before checking it is
>> populated.
>
> OK
>
>
>>> +
>>> + if (pdata) {
>>> + timer->capability = pdata->timer_capability;
>>
>> You don't need this it is already handled a few lines before.
>>
>>> + timer->get_context_loss_count = pdata->get_context_loss_count;
>>
>> We could probably move this too. For example ...
>
> OK yeah makes sense to me.
>
> Regards,
>
> Tony
>
>> diff --git a/arch/arm/plat-omap/dmtimer.c b/arch/arm/plat-omap/dmtimer.c
>> index 38c12ef..9dca23e 100644
>> --- a/arch/arm/plat-omap/dmtimer.c
>> +++ b/arch/arm/plat-omap/dmtimer.c
>> @@ -799,12 +799,11 @@ static int __devinit omap_dm_timer_probe(struct platform_device *pdev)
>> timer->id = pdev->id;
>> timer->capability = pdata->timer_capability;
>> timer->reserved = omap_dm_timer_reserved_systimer(timer->id);
>> + timer->get_context_loss_count = pdata->get_context_loss_count;
>> }
>>
>> timer->irq = irq->start;
>> timer->pdev = pdev;
>> - timer->capability = pdata->timer_capability;
>> - timer->get_context_loss_count = pdata->get_context_loss_count;
>>
>> /* Skip pm_runtime_enable for OMAP1 */
>> if (!(timer->capability & OMAP_TIMER_NEEDS_RESET)) {
I have tested the dmtimers with this on the 3430-beagle and 4430-panda
with and without device tree and is working fine.
Do you want to generate the patch or me?
Cheers
Jon
>> [1] http://marc.info/?l=linux-omap&m=135065877008624&w=2
^ permalink raw reply
* [PATCH] ARM: OMAP4: TWL: mux sys_drm_msecure as output for PMIC
From: Felipe Balbi @ 2012-11-08 19:28 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <1352401730-4269-1-git-send-email-khilman@deeprootsystems.com>
Hi,
On Thu, Nov 08, 2012 at 11:08:50AM -0800, Kevin Hilman wrote:
> From: Kevin Hilman <khilman@ti.com>
>
> On OMAP4 boards using the TWL6030 PMIC, the sys_drm_msecure is
> connected to the MSECURE input of the TWL6030 PMIC. This signal
> controls the secure-mode operation of the PMIC. If its not mux'd
> correctly, some functionality of the PMIC will not be accessible since
> the PMIC will be in secure mode.
>
> For example, if the TWL RTC is in secure mode, most of its registers
> are read-only, meaning (re)programming the RTC (e.g. for wakeup from
> suspend) will fail.
>
> To fix, ensure the signal is properly mux'd as output when TWL is
> intialized.
>
> This fix is required when using recent versions of u-boot (>= v2012.04.01)
> since u-boot is no longer setting the default mux for this pin.
>
> Signed-off-by: Kevin Hilman <khilman@ti.com>
> ---
> Based on v3.7-rc4. Targetted as a fix for v3.7.
>
> A correponding DT fix for this is needed as well, but that will be part of
> a bigger series to get PM working with DT boot and needs to include other
> pins like sys_nirq1.
>
> arch/arm/mach-omap2/twl-common.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
> index 635e109..96cae8b 100644
> --- a/arch/arm/mach-omap2/twl-common.c
> +++ b/arch/arm/mach-omap2/twl-common.c
> @@ -73,6 +73,7 @@ void __init omap4_pmic_init(const char *pmic_type,
> {
> /* PMIC part*/
> omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
> + omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
> omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
>
> /* Register additional devices on i2c1 bus if needed */
not entirely related to $SUBJECT but this essentially means we're
dropping the security feature whenever Linux runs.
Shouldn't we try to change that pin at register write boundaries so we
keep the secure feature enabled until we know we're going to write to
the HW ?
Maybe it could even be done later through pinctrl, perhaps ?
--
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20121108/e5d88f69/attachment.sig>
^ permalink raw reply
* [PATCH 5/7] ARM: OMAP2+: WDT: move init; add read_reset_sources pdata function pointer
From: Paul Walmsley @ 2012-11-08 19:26 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121016013213.21844.20016.stgit@dusk.lan>
On Mon, 15 Oct 2012, Paul Walmsley wrote:
> The OMAP watchdog timer driver directly calls a function exported by
> code in arch/arm/mach-omap2. This is not good; it tightly couples
> this driver to the mach-omap2 integration code. Instead, add a
> temporary platform_data function pointer to abstract this function
> call. A subsequent patch will convert the watchdog driver to use this
> function pointer.
>
> This patch also moves the device creation code out of
> arch/arm/mach-omap2/devices.c and into arch/arm/mach-omap2/wd_timer.c.
> This is another step towards the removal of
> arch/arm/mach-omap2/devices.c.
>
> Signed-off-by: Paul Walmsley <paul@pwsan.com>
> Cc: Wim Van Sebroeck <wim@iguana.be>
This patch missed the change from commit
6e152231995aa4ed5eafd87a6a8348563248f843 ("ARM: OMAP: avoid build wdt
platform device if with dt support") to skip the mach-omap2/ device build
if the DT blob was present. This resulted in the watchdog getting
probed twice. This didn't result in any problems, aside from a
message in the kernel log.
Anyway, here's an update with that change added.
- Paul
From: Paul Walmsley <paul@pwsan.com>
Date: Mon, 29 Oct 2012 20:49:44 -0600
Subject: [PATCH] ARM: OMAP2+: WDT: move init; add read_reset_sources pdata
function pointer
The OMAP watchdog timer driver directly calls a function exported by
code in arch/arm/mach-omap2. This is not good; it tightly couples
this driver to the mach-omap2 integration code. Instead, add a
temporary platform_data function pointer to abstract this function
call. A subsequent patch will convert the watchdog driver to use this
function pointer.
This patch also moves the device creation code out of
arch/arm/mach-omap2/devices.c and into arch/arm/mach-omap2/wd_timer.c.
This is another step towards the removal of
arch/arm/mach-omap2/devices.c.
Cc: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Wim Van Sebroeck <wim@iguana.be>
[paul at pwsan.com: skip wd_timer device creation when DT blob is present]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
---
arch/arm/mach-omap1/devices.c | 21 ++++++++++++---
arch/arm/mach-omap2/devices.c | 26 ------------------
arch/arm/mach-omap2/wd_timer.c | 35 +++++++++++++++++++++++-
include/linux/platform_data/omap-wd-timer.h | 38 +++++++++++++++++++++++++++
4 files changed, 90 insertions(+), 30 deletions(-)
create mode 100644 include/linux/platform_data/omap-wd-timer.h
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 645668e..7450318 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -17,6 +17,8 @@
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
+#include <linux/platform_data/omap-wd-timer.h>
+
#include <asm/mach/map.h>
#include <mach/tc.h>
@@ -448,18 +450,31 @@ static struct resource wdt_resources[] = {
};
static struct platform_device omap_wdt_device = {
- .name = "omap_wdt",
- .id = -1,
+ .name = "omap_wdt",
+ .id = -1,
.num_resources = ARRAY_SIZE(wdt_resources),
.resource = wdt_resources,
};
static int __init omap_init_wdt(void)
{
+ struct omap_wd_timer_platform_data pdata;
+ int ret;
+
if (!cpu_is_omap16xx())
return -ENODEV;
- return platform_device_register(&omap_wdt_device);
+ pdata.read_reset_sources = omap1_get_reset_sources;
+
+ ret = platform_device_register(&omap_wdt_device);
+ if (!ret) {
+ ret = platform_device_add_data(&omap_wdt_device, &pdata,
+ sizeof(pdata));
+ if (ret)
+ platform_device_del(&omap_wdt_device);
+ }
+
+ return ret;
}
subsys_initcall(omap_init_wdt);
#endif
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 2ad491d..cf365c3 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -646,29 +646,3 @@ static int __init omap2_init_devices(void)
return 0;
}
arch_initcall(omap2_init_devices);
-
-#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
-static int __init omap_init_wdt(void)
-{
- int id = -1;
- struct platform_device *pdev;
- struct omap_hwmod *oh;
- char *oh_name = "wd_timer2";
- char *dev_name = "omap_wdt";
-
- if (!cpu_class_is_omap2() || of_have_populated_dt())
- return 0;
-
- oh = omap_hwmod_lookup(oh_name);
- if (!oh) {
- pr_err("Could not look up wd_timer%d hwmod\n", id);
- return -EINVAL;
- }
-
- pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0);
- WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
- dev_name, oh->name);
- return 0;
-}
-subsys_initcall(omap_init_wdt);
-#endif
diff --git a/arch/arm/mach-omap2/wd_timer.c b/arch/arm/mach-omap2/wd_timer.c
index f6b6c37..5a8629f 100644
--- a/arch/arm/mach-omap2/wd_timer.c
+++ b/arch/arm/mach-omap2/wd_timer.c
@@ -11,10 +11,14 @@
#include <linux/io.h>
#include <linux/err.h>
-#include "omap_hwmod.h"
+#include <linux/platform_data/omap-wd-timer.h>
+#include "omap_hwmod.h"
+#include "omap_device.h"
#include "wd_timer.h"
#include "common.h"
+#include "prm.h"
+#include "soc.h"
/*
* In order to avoid any assumptions from bootloader regarding WDT
@@ -99,3 +103,32 @@ int omap2_wd_timer_reset(struct omap_hwmod *oh)
return (c == MAX_MODULE_SOFTRESET_WAIT) ? -ETIMEDOUT :
omap2_wd_timer_disable(oh);
}
+
+static int __init omap_init_wdt(void)
+{
+ int id = -1;
+ struct platform_device *pdev;
+ struct omap_hwmod *oh;
+ char *oh_name = "wd_timer2";
+ char *dev_name = "omap_wdt";
+ struct omap_wd_timer_platform_data pdata;
+
+ if (!cpu_class_is_omap2() || of_have_populated_dt())
+ return 0;
+
+ oh = omap_hwmod_lookup(oh_name);
+ if (!oh) {
+ pr_err("Could not look up wd_timer%d hwmod\n", id);
+ return -EINVAL;
+ }
+
+ pdata.read_reset_sources = prm_read_reset_sources;
+
+ pdev = omap_device_build(dev_name, id, oh, &pdata,
+ sizeof(struct omap_wd_timer_platform_data),
+ NULL, 0, 0);
+ WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
+ dev_name, oh->name);
+ return 0;
+}
+subsys_initcall(omap_init_wdt);
diff --git a/include/linux/platform_data/omap-wd-timer.h b/include/linux/platform_data/omap-wd-timer.h
new file mode 100644
index 0000000..d75f5f8
--- /dev/null
+++ b/include/linux/platform_data/omap-wd-timer.h
@@ -0,0 +1,38 @@
+/*
+ * OMAP2+ WDTIMER-specific function prototypes
+ *
+ * Copyright (C) 2012 Texas Instruments, Inc.
+ * Paul Walmsley
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#ifndef __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
+#define __LINUX_PLATFORM_DATA_OMAP_WD_TIMER_H
+
+#include <linux/types.h>
+
+/*
+ * Standardized OMAP reset source bits
+ *
+ * This is a subset of the ones listed in arch/arm/mach-omap2/prm.h
+ * and are the only ones needed in the watchdog driver.
+ */
+#define OMAP_MPU_WD_RST_SRC_ID_SHIFT 3
+
+/**
+ * struct omap_wd_timer_platform_data - WDTIMER integration to the host SoC
+ * @read_reset_sources - fn ptr for the SoC to indicate the last reset cause
+ *
+ * The function pointed to by @read_reset_sources must return its data
+ * in a standard format - search for RST_SRC_ID_SHIFT in
+ * arch/arm/mach-omap2
+ */
+struct omap_wd_timer_platform_data {
+ u32 (*read_reset_sources)(void);
+};
+
+#endif
--
1.7.10.4
^ permalink raw reply related
* [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
From: Jon Hunter @ 2012-11-08 19:16 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <79CD15C6BA57404B839C016229A409A83EB68799@DBDE01.ent.ti.com>
On 11/08/2012 12:59 PM, Hiremath, Vaibhav wrote:
> On Fri, Nov 09, 2012 at 00:24:23, Hunter, Jon wrote:
>>
>> On 11/08/2012 01:59 AM, Igor Grinberg wrote:
>>
>> [snip]
>>
>>> There is no reliable way to determine which source should be used in runtime
>>> for boards that do not have the 32k oscillator wired.
>>
>> So thinking about this some more and given that we are moving away from
>> board files, if a board does not provide a 32kHz clock source, then this
>> should be reflected in the device-tree source file for that board.
>> Hence, at boot time we should be able to determine if a 32kHz clock
>> source can be used.
>>
>
> Let me feed some more thoughts here :)
>
> The way it is being detected currently is based on timer idle status bit.
> I am worried that, this is the only option we have.
Why not use device-tree to indicate the presence of a 32k clock source?
This seems like a board level configuration and so device-tree seems to
be the perfect place for this IMO.
Jon
^ permalink raw reply
* [PATCH] ARM: OMAP4: TWL: mux sys_drm_msecure as output for PMIC
From: Kevin Hilman @ 2012-11-08 19:08 UTC (permalink / raw)
To: linux-arm-kernel
From: Kevin Hilman <khilman@ti.com>
On OMAP4 boards using the TWL6030 PMIC, the sys_drm_msecure is
connected to the MSECURE input of the TWL6030 PMIC. This signal
controls the secure-mode operation of the PMIC. If its not mux'd
correctly, some functionality of the PMIC will not be accessible since
the PMIC will be in secure mode.
For example, if the TWL RTC is in secure mode, most of its registers
are read-only, meaning (re)programming the RTC (e.g. for wakeup from
suspend) will fail.
To fix, ensure the signal is properly mux'd as output when TWL is
intialized.
This fix is required when using recent versions of u-boot (>= v2012.04.01)
since u-boot is no longer setting the default mux for this pin.
Signed-off-by: Kevin Hilman <khilman@ti.com>
---
Based on v3.7-rc4. Targetted as a fix for v3.7.
A correponding DT fix for this is needed as well, but that will be part of
a bigger series to get PM working with DT boot and needs to include other
pins like sys_nirq1.
arch/arm/mach-omap2/twl-common.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-omap2/twl-common.c b/arch/arm/mach-omap2/twl-common.c
index 635e109..96cae8b 100644
--- a/arch/arm/mach-omap2/twl-common.c
+++ b/arch/arm/mach-omap2/twl-common.c
@@ -73,6 +73,7 @@ void __init omap4_pmic_init(const char *pmic_type,
{
/* PMIC part*/
omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
+ omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
/* Register additional devices on i2c1 bus if needed */
--
1.8.0
^ permalink raw reply related
* [PATCH] ARM: OMAP2+: timer: remove CONFIG_OMAP_32K_TIMER
From: Hiremath, Vaibhav @ 2012-11-08 18:59 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <509BFFDF.9040605@ti.com>
On Fri, Nov 09, 2012 at 00:24:23, Hunter, Jon wrote:
>
> On 11/08/2012 01:59 AM, Igor Grinberg wrote:
>
> [snip]
>
> > There is no reliable way to determine which source should be used in runtime
> > for boards that do not have the 32k oscillator wired.
>
> So thinking about this some more and given that we are moving away from
> board files, if a board does not provide a 32kHz clock source, then this
> should be reflected in the device-tree source file for that board.
> Hence, at boot time we should be able to determine if a 32kHz clock
> source can be used.
>
Let me feed some more thoughts here :)
The way it is being detected currently is based on timer idle status bit.
I am worried that, this is the only option we have.
You can also refer to the implementation, so that it will help us to
conclude on this -
http://arago-project.org/git/projects/?p=linux-am33x.git;a=commitdiff;h=58abec6ac010f4f8818caa4a52d16c4802e14acc
Note that this is based on v3.2 kernel (+ additional patches), you should
look the implementation of function omap_dm_timer_switch_src().
Thanks,
Vaibhav
^ permalink raw reply
* [PATCH] ARM: setup_mm_for_reboot(): use flush_cache_louis()
From: Nicolas Pitre @ 2012-11-08 18:56 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <20121108162613.GB16373@mudshark.cambridge.arm.com>
On Thu, 8 Nov 2012, Will Deacon wrote:
> I checked all of the switch_mm implementations and it looks like
> !CONFIG_CPU_HAS_ASID implies the TLB flush in all cases, so this looks fine
> to me.
>
> Acked-by: Will Deacon <will.deacon@arm.com>
Submitted as patch 7573/1.
Thanks!
Nicolas
^ permalink raw reply
* vexpress issues in next-20121029
From: Pawel Moll @ 2012-11-08 18:54 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <509AC63C.1070309@wwwdotorg.org>
On Wed, 2012-11-07 at 20:36 +0000, Stephen Warren wrote:
> On 10/29/2012 02:24 PM, Stephen Warren wrote:
> > 2) With those calls commented out, I find that
> > vexpress_sysreg_init_leds() is device_initcall, and so executes even
> > when not running on vexpress HW. This crashes on Tegra (which I have
> > converted to single-zImage locally).
>
> This issue still appears to be present in next-20121107.
Yes, sorry about that - last week I've posted patches adding a generic
memory mapped leds driver and using it instead, but haven't managed to
get any comments from the maintainers. I've pinged them today and if I
hear nothing till tomorrow, I'll remove the offending code from
vexpress-sysreg.c completely and wait will this stuff till next cycle.
Pawe?
^ permalink raw reply
* [Xen-devel] BUG: ARM build failures due to Xen
From: konrad @ 2012-11-08 18:54 UTC (permalink / raw)
To: linux-arm-kernel
Sorry about top posting - on the phone. I will send to Linus tomorrow.
Ian Campbell <ian.campbell@citrix.com> wrote:
>On Thu, 2012-11-08 at 15:28 +0000, Arnd Bergmann wrote:
>> On Tuesday 06 November 2012, Russell King - ARM Linux wrote:
>> > My build system is giving me the following errors against an OMAP4
>> > randconfig build against the latest Linus' kernel plus arm-soc:
>> >
>> > ERROR: "privcmd_call" [drivers/xen/xen-privcmd.ko] undefined!
>> > make[2]: *** [__modpost] Error 1
>> > make[2]: Target `_modpost' not remade because of errors.
>> > make[1]: *** [modules] Error 2
>> > make: *** [sub-make] Error 2
>> > make: Target `uImage' not remade because of errors.
>> > make: Target `modules' not remade because of errors.
>> >
>> > Full build results and configuration are here:
>> >
>> > http://www.arm.linux.org.uk/developer/build/result.php?type=build&idx=2627
>> > http://www.arm.linux.org.uk/developer/build/file.php?type=config&idx=2627
>> >
>>
>> I can reproduce the same thing with mainline v3.7-rc4.
>> 8<------
>> xen/arm: export privcmd_call
>
>Thanks, Konrad posted a fix for this on Tuesday which covers a few other
>cases too: http://marc.info/?l=linux-kernel&m=135224075902642&w=2 I
>added Russell to my response but forgot to add l-a-k@ too, sorry.
>
>Is one of you going to pick it up and send to mainline?
>
>Ian.
>
>> privcmd_call may get called from a module, so it has to be exported.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>>
>> diff --git a/arch/arm/xen/enlighten.c b/arch/arm/xen/enlighten.c
>> index 59bcb96..ff5e300 100644
>> --- a/arch/arm/xen/enlighten.c
>> +++ b/arch/arm/xen/enlighten.c
>> @@ -17,6 +17,9 @@
>> #include <linux/of_irq.h>
>> #include <linux/of_address.h>
>>
>> +/* from hypercall.S */
>> +EXPORT_SYMBOL_GPL(privcmd_call);
>> +
>> struct start_info _xen_start_info;
>> struct start_info *xen_start_info = &_xen_start_info;
>> EXPORT_SYMBOL_GPL(xen_start_info);
>>
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel at lists.xen.org
>> http://lists.xen.org/xen-devel
>
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox