Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326792
b: refs/heads/master
c: 4312a7e
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Boyd authored and David Brown committed Sep 13, 2012
1 parent dce0347 commit f53a64a
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 61 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 66a8950949c12a2600ff62e78b24f42ef8f6d28e
refs/heads/master: 4312a7ef9cd744849e16ef4bdeb7ca6beec9ec76
5 changes: 2 additions & 3 deletions trunk/arch/arm/mach-msm/board-halibut.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <linux/mtd/partitions.h>

#include "devices.h"
#include "common.h"

static struct resource smc91x_resources[] = {
[0] = {
Expand Down Expand Up @@ -66,8 +67,6 @@ static struct platform_device *devices[] __initdata = {
&smc91x_device,
};

extern struct sys_timer msm_timer;

static void __init halibut_init_early(void)
{
arch_ioremap_caller = __msm_ioremap_caller;
Expand Down Expand Up @@ -107,5 +106,5 @@ MACHINE_START(HALIBUT, "Halibut Board (QCT SURF7200A)")
.init_irq = halibut_init_irq,
.init_machine = halibut_init,
.init_late = halibut_init_late,
.timer = &msm_timer,
.timer = &msm7x01_timer,
MACHINE_END
9 changes: 4 additions & 5 deletions trunk/arch/arm/mach-msm/board-msm7x30.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@
#include "devices.h"
#include "gpiomux.h"
#include "proc_comm.h"

extern struct sys_timer msm_timer;
#include "common.h"

static void __init msm7x30_fixup(struct tag *tag, char **cmdline,
struct meminfo *mi)
Expand Down Expand Up @@ -132,7 +131,7 @@ MACHINE_START(MSM7X30_SURF, "QCT MSM7X30 SURF")
.init_irq = msm7x30_init_irq,
.init_machine = msm7x30_init,
.init_late = msm7x30_init_late,
.timer = &msm_timer,
.timer = &msm7x30_timer,
MACHINE_END

MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
Expand All @@ -143,7 +142,7 @@ MACHINE_START(MSM7X30_FFA, "QCT MSM7X30 FFA")
.init_irq = msm7x30_init_irq,
.init_machine = msm7x30_init,
.init_late = msm7x30_init_late,
.timer = &msm_timer,
.timer = &msm7x30_timer,
MACHINE_END

MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
Expand All @@ -154,5 +153,5 @@ MACHINE_START(MSM7X30_FLUID, "QCT MSM7X30 FLUID")
.init_irq = msm7x30_init_irq,
.init_machine = msm7x30_init,
.init_late = msm7x30_init_late,
.timer = &msm_timer,
.timer = &msm7x30_timer,
MACHINE_END
5 changes: 3 additions & 2 deletions trunk/arch/arm/mach-msm/board-msm8960.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <mach/msm_iomap.h>

#include "devices.h"
#include "common.h"

static void __init msm8960_fixup(struct tag *tag, char **cmdline,
struct meminfo *mi)
Expand Down Expand Up @@ -90,7 +91,7 @@ MACHINE_START(MSM8960_SIM, "QCT MSM8960 SIMULATOR")
.reserve = msm8960_reserve,
.map_io = msm8960_map_io,
.init_irq = msm8960_init_irq,
.timer = &msm_timer,
.timer = &msm8960_timer,
.handle_irq = gic_handle_irq,
.init_machine = msm8960_sim_init,
.init_late = msm8960_init_late,
Expand All @@ -101,7 +102,7 @@ MACHINE_START(MSM8960_RUMI3, "QCT MSM8960 RUMI3")
.reserve = msm8960_reserve,
.map_io = msm8960_map_io,
.init_irq = msm8960_init_irq,
.timer = &msm_timer,
.timer = &msm8960_timer,
.handle_irq = gic_handle_irq,
.init_machine = msm8960_rumi3_init,
.init_late = msm8960_init_late,
Expand Down
11 changes: 6 additions & 5 deletions trunk/arch/arm/mach-msm/board-msm8x60.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <mach/board.h>
#include <mach/msm_iomap.h>
#include "common.h"

static void __init msm8x60_fixup(struct tag *tag, char **cmdline,
struct meminfo *mi)
Expand Down Expand Up @@ -114,7 +115,7 @@ MACHINE_START(MSM8X60_RUMI3, "QCT MSM8X60 RUMI3")
.handle_irq = gic_handle_irq,
.init_machine = msm8x60_init,
.init_late = msm8x60_init_late,
.timer = &msm_timer,
.timer = &msm8x60_timer,
MACHINE_END

MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
Expand All @@ -125,7 +126,7 @@ MACHINE_START(MSM8X60_SURF, "QCT MSM8X60 SURF")
.handle_irq = gic_handle_irq,
.init_machine = msm8x60_init,
.init_late = msm8x60_init_late,
.timer = &msm_timer,
.timer = &msm8x60_timer,
MACHINE_END

MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
Expand All @@ -136,7 +137,7 @@ MACHINE_START(MSM8X60_SIM, "QCT MSM8X60 SIMULATOR")
.handle_irq = gic_handle_irq,
.init_machine = msm8x60_init,
.init_late = msm8x60_init_late,
.timer = &msm_timer,
.timer = &msm8x60_timer,
MACHINE_END

MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
Expand All @@ -147,7 +148,7 @@ MACHINE_START(MSM8X60_FFA, "QCT MSM8X60 FFA")
.handle_irq = gic_handle_irq,
.init_machine = msm8x60_init,
.init_late = msm8x60_init_late,
.timer = &msm_timer,
.timer = &msm8x60_timer,
MACHINE_END

#ifdef CONFIG_OF
Expand All @@ -158,7 +159,7 @@ DT_MACHINE_START(MSM_DT, "Qualcomm MSM (Flattened Device Tree)")
.handle_irq = gic_handle_irq,
.init_machine = msm8x60_dt_init,
.init_late = msm8x60_init_late,
.timer = &msm_timer,
.timer = &msm8x60_timer,
.dt_compat = msm8x60_fluid_match,
MACHINE_END
#endif /* CONFIG_OF */
7 changes: 3 additions & 4 deletions trunk/arch/arm/mach-msm/board-qsd8x50.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
#include <mach/mmc.h>

#include "devices.h"

extern struct sys_timer msm_timer;
#include "common.h"

static const resource_size_t qsd8x50_surf_smc91x_base __initdata = 0x70000300;
static const unsigned qsd8x50_surf_smc91x_gpio __initdata = 156;
Expand Down Expand Up @@ -201,7 +200,7 @@ MACHINE_START(QSD8X50_SURF, "QCT QSD8X50 SURF")
.init_irq = qsd8x50_init_irq,
.init_machine = qsd8x50_init,
.init_late = qsd8x50_init_late,
.timer = &msm_timer,
.timer = &qsd8x50_timer,
MACHINE_END

MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
Expand All @@ -210,5 +209,5 @@ MACHINE_START(QSD8X50A_ST1_5, "QCT QSD8X50A ST1.5")
.init_irq = qsd8x50_init_irq,
.init_machine = qsd8x50_init,
.init_late = qsd8x50_init_late,
.timer = &msm_timer,
.timer = &qsd8x50_timer,
MACHINE_END
5 changes: 2 additions & 3 deletions trunk/arch/arm/mach-msm/board-trout.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "devices.h"
#include "board-trout.h"
#include "common.h"

extern int trout_init_mmc(unsigned int);

Expand All @@ -42,8 +43,6 @@ static struct platform_device *devices[] __initdata = {
&msm_device_i2c,
};

extern struct sys_timer msm_timer;

static void __init trout_init_early(void)
{
arch_ioremap_caller = __msm_ioremap_caller;
Expand Down Expand Up @@ -111,5 +110,5 @@ MACHINE_START(TROUT, "HTC Dream")
.init_irq = trout_init_irq,
.init_machine = trout_init,
.init_late = trout_init_late,
.timer = &msm_timer,
.timer = &msm7x01_timer,
MACHINE_END
21 changes: 21 additions & 0 deletions trunk/arch/arm/mach-msm/common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef __MACH_COMMON_H
#define __MACH_COMMON_H

extern struct sys_timer msm7x01_timer;
extern struct sys_timer msm7x30_timer;
extern struct sys_timer msm8x60_timer;
extern struct sys_timer msm8960_timer;
extern struct sys_timer qsd8x50_timer;

#endif
2 changes: 0 additions & 2 deletions trunk/arch/arm/mach-msm/include/mach/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ struct msm_acpu_clock_platform_data

struct clk_lookup;

extern struct sys_timer msm_timer;

/* common init routines for use by arch/arm/mach-msm/board-*.c */

void __init msm_add_devices(void);
Expand Down
120 changes: 84 additions & 36 deletions trunk/arch/arm/mach-msm/timer.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
Expand All @@ -26,17 +26,15 @@
#include <asm/localtimer.h>
#include <asm/sched_clock.h>

#include <mach/msm_iomap.h>
#include <mach/cpu.h>
#include <mach/board.h>
#include "common.h"

#define TIMER_MATCH_VAL 0x0000
#define TIMER_COUNT_VAL 0x0004
#define TIMER_ENABLE 0x0008
#define TIMER_ENABLE_CLR_ON_MATCH_EN BIT(1)
#define TIMER_ENABLE_EN BIT(0)
#define TIMER_CLEAR 0x000C
#define DGT_CLK_CTL 0x0034
#define DGT_CLK_CTL 0x0030
#define DGT_CLK_CTL_DIV_4 0x3

#define GPT_HZ 32768
Expand Down Expand Up @@ -172,44 +170,21 @@ static notrace u32 msm_sched_clock_read(void)
return msm_clocksource.read(&msm_clocksource);
}

static void __init msm_timer_init(void)
static void __init msm_timer_init(u32 dgt_hz, int sched_bits, int irq,
bool percpu)
{
struct clock_event_device *ce = &msm_clockevent;
struct clocksource *cs = &msm_clocksource;
int res;
u32 dgt_hz;

if (cpu_is_msm7x01()) {
event_base = MSM_CSR_BASE;
source_base = MSM_CSR_BASE + 0x10;
dgt_hz = 19200000 >> MSM_DGT_SHIFT; /* 600 KHz */
cs->read = msm_read_timer_count_shift;
cs->mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT));
} else if (cpu_is_msm7x30()) {
event_base = MSM_CSR_BASE + 0x04;
source_base = MSM_CSR_BASE + 0x24;
dgt_hz = 24576000 / 4;
} else if (cpu_is_qsd8x50()) {
event_base = MSM_CSR_BASE;
source_base = MSM_CSR_BASE + 0x10;
dgt_hz = 19200000 / 4;
} else if (cpu_is_msm8x60() || cpu_is_msm8960()) {
event_base = MSM_TMR_BASE + 0x04;
/* Use CPU0's timer as the global clock source. */
source_base = MSM_TMR0_BASE + 0x24;
dgt_hz = 27000000 / 4;
writel_relaxed(DGT_CLK_CTL_DIV_4, MSM_TMR_BASE + DGT_CLK_CTL);
} else
BUG();

writel_relaxed(0, event_base + TIMER_ENABLE);
writel_relaxed(0, event_base + TIMER_CLEAR);
writel_relaxed(~0, event_base + TIMER_MATCH_VAL);
ce->cpumask = cpumask_of(0);
ce->irq = irq;

ce->irq = INT_GP_TIMER_EXP;
clockevents_config_and_register(ce, GPT_HZ, 4, 0xffffffff);
if (cpu_is_msm8x60() || cpu_is_msm8960()) {
if (percpu) {
msm_evt.percpu_evt = alloc_percpu(struct clock_event_device *);
if (!msm_evt.percpu_evt) {
pr_err("memory allocation failed for %s\n", ce->name);
Expand Down Expand Up @@ -238,10 +213,83 @@ static void __init msm_timer_init(void)
res = clocksource_register_hz(cs, dgt_hz);
if (res)
pr_err("clocksource_register failed\n");
setup_sched_clock(msm_sched_clock_read,
cpu_is_msm7x01() ? 32 - MSM_DGT_SHIFT : 32, dgt_hz);
setup_sched_clock(msm_sched_clock_read, sched_bits, dgt_hz);
}

struct sys_timer msm_timer = {
.init = msm_timer_init
static int __init msm_timer_map(phys_addr_t event, phys_addr_t source)
{
event_base = ioremap(event, SZ_64);
if (!event_base) {
pr_err("Failed to map event base\n");
return 1;
}
source_base = ioremap(source, SZ_64);
if (!source_base) {
pr_err("Failed to map source base\n");
return 1;
}
return 0;
}

static void __init msm7x01_timer_init(void)
{
struct clocksource *cs = &msm_clocksource;

if (msm_timer_map(0xc0100000, 0xc0100010))
return;
cs->read = msm_read_timer_count_shift;
cs->mask = CLOCKSOURCE_MASK((32 - MSM_DGT_SHIFT));
/* 600 KHz */
msm_timer_init(19200000 >> MSM_DGT_SHIFT, 32 - MSM_DGT_SHIFT, 7,
false);
}

struct sys_timer msm7x01_timer = {
.init = msm7x01_timer_init
};

static void __init msm7x30_timer_init(void)
{
if (msm_timer_map(0xc0100004, 0xc0100024))
return;
msm_timer_init(24576000 / 4, 32, 1, false);
}

struct sys_timer msm7x30_timer = {
.init = msm7x30_timer_init
};

static void __init msm8x60_timer_init(void)
{
if (msm_timer_map(0x02000004, 0x02040024))
return;
writel_relaxed(DGT_CLK_CTL_DIV_4, event_base + DGT_CLK_CTL);
msm_timer_init(27000000 / 4, 32, 17, true);
}

struct sys_timer msm8x60_timer = {
.init = msm8x60_timer_init
};

static void __init msm8960_timer_init(void)
{
if (msm_timer_map(0x0200A004, 0x0208A024))
return;
writel_relaxed(DGT_CLK_CTL_DIV_4, event_base + DGT_CLK_CTL);
msm_timer_init(27000000 / 4, 32, 17, true);
}

struct sys_timer msm8960_timer = {
.init = msm8960_timer_init
};

static void __init qsd8x50_timer_init(void)
{
if (msm_timer_map(0xAC100000, 0xAC100010))
return;
msm_timer_init(19200000 / 4, 32, 7, false);
}

struct sys_timer qsd8x50_timer = {
.init = qsd8x50_timer_init
};

0 comments on commit f53a64a

Please sign in to comment.