Skip to content

Commit

Permalink
sh: Consolidate MTU2/CMT/TMU timer platform data.
Browse files Browse the repository at this point in the history
All of the SH timers use a roughly identical structure for platform data,
which presently is broken out for each block. Consolidate all of these
definitions, as there is no reason for them to be broken out in the first
place.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed May 3, 2009
1 parent d43a41b commit 46a12f7
Show file tree
Hide file tree
Showing 17 changed files with 69 additions and 97 deletions.
6 changes: 3 additions & 3 deletions arch/sh/kernel/cpu/sh2/setup-sh7619.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>
#include <linux/io.h>

enum {
Expand Down Expand Up @@ -111,7 +111,7 @@ static struct platform_device eth_device = {
.resource = eth_resources,
};

static struct sh_cmt_config cmt0_platform_data = {
static struct sh_timer_config cmt0_platform_data = {
.name = "CMT0",
.channel_offset = 0x02,
.timer_bit = 0,
Expand Down Expand Up @@ -143,7 +143,7 @@ static struct platform_device cmt0_device = {
.num_resources = ARRAY_SIZE(cmt0_resources),
};

static struct sh_cmt_config cmt1_platform_data = {
static struct sh_timer_config cmt1_platform_data = {
.name = "CMT1",
.channel_offset = 0x08,
.timer_bit = 1,
Expand Down
8 changes: 4 additions & 4 deletions arch/sh/kernel/cpu/sh2a/setup-mxg.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_mtu2.h>
#include <linux/sh_timer.h>

enum {
UNUSED = 0,
Expand Down Expand Up @@ -114,7 +114,7 @@ static struct intc_mask_reg mask_registers[] __initdata = {
static DECLARE_INTC_DESC(intc_desc, "mxg", vectors, groups,
mask_registers, prio_registers, NULL);

static struct sh_mtu2_config mtu2_0_platform_data = {
static struct sh_timer_config mtu2_0_platform_data = {
.name = "MTU2_0",
.channel_offset = -0x80,
.timer_bit = 0,
Expand Down Expand Up @@ -145,7 +145,7 @@ static struct platform_device mtu2_0_device = {
.num_resources = ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_mtu2_config mtu2_1_platform_data = {
static struct sh_timer_config mtu2_1_platform_data = {
.name = "MTU2_1",
.channel_offset = -0x100,
.timer_bit = 1,
Expand Down Expand Up @@ -176,7 +176,7 @@ static struct platform_device mtu2_1_device = {
.num_resources = ARRAY_SIZE(mtu2_1_resources),
};

static struct sh_mtu2_config mtu2_2_platform_data = {
static struct sh_timer_config mtu2_2_platform_data = {
.name = "MTU2_2",
.channel_offset = 0x80,
.timer_bit = 2,
Expand Down
8 changes: 4 additions & 4 deletions arch/sh/kernel/cpu/sh2a/setup-sh7201.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_mtu2.h>
#include <linux/sh_timer.h>
#include <linux/io.h>

enum {
Expand Down Expand Up @@ -251,7 +251,7 @@ static struct platform_device rtc_device = {
.resource = rtc_resources,
};

static struct sh_mtu2_config mtu2_0_platform_data = {
static struct sh_timer_config mtu2_0_platform_data = {
.name = "MTU2_0",
.channel_offset = -0x80,
.timer_bit = 0,
Expand Down Expand Up @@ -282,7 +282,7 @@ static struct platform_device mtu2_0_device = {
.num_resources = ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_mtu2_config mtu2_1_platform_data = {
static struct sh_timer_config mtu2_1_platform_data = {
.name = "MTU2_1",
.channel_offset = -0x100,
.timer_bit = 1,
Expand Down Expand Up @@ -313,7 +313,7 @@ static struct platform_device mtu2_1_device = {
.num_resources = ARRAY_SIZE(mtu2_1_resources),
};

static struct sh_mtu2_config mtu2_2_platform_data = {
static struct sh_timer_config mtu2_2_platform_data = {
.name = "MTU2_2",
.channel_offset = 0x80,
.timer_bit = 2,
Expand Down
11 changes: 5 additions & 6 deletions arch/sh/kernel/cpu/sh2a/setup-sh7203.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_cmt.h>
#include <linux/sh_mtu2.h>
#include <linux/sh_timer.h>
#include <linux/io.h>

enum {
Expand Down Expand Up @@ -208,7 +207,7 @@ static struct platform_device sci_device = {
},
};

static struct sh_cmt_config cmt0_platform_data = {
static struct sh_timer_config cmt0_platform_data = {
.name = "CMT0",
.channel_offset = 0x02,
.timer_bit = 0,
Expand Down Expand Up @@ -240,7 +239,7 @@ static struct platform_device cmt0_device = {
.num_resources = ARRAY_SIZE(cmt0_resources),
};

static struct sh_cmt_config cmt1_platform_data = {
static struct sh_timer_config cmt1_platform_data = {
.name = "CMT1",
.channel_offset = 0x08,
.timer_bit = 1,
Expand Down Expand Up @@ -272,7 +271,7 @@ static struct platform_device cmt1_device = {
.num_resources = ARRAY_SIZE(cmt1_resources),
};

static struct sh_mtu2_config mtu2_0_platform_data = {
static struct sh_timer_config mtu2_0_platform_data = {
.name = "MTU2_0",
.channel_offset = -0x80,
.timer_bit = 0,
Expand Down Expand Up @@ -303,7 +302,7 @@ static struct platform_device mtu2_0_device = {
.num_resources = ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_mtu2_config mtu2_1_platform_data = {
static struct sh_timer_config mtu2_1_platform_data = {
.name = "MTU2_1",
.channel_offset = -0x100,
.timer_bit = 1,
Expand Down
13 changes: 6 additions & 7 deletions arch/sh/kernel/cpu/sh2a/setup-sh7206.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
#include <linux/init.h>
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/sh_cmt.h>
#include <linux/sh_mtu2.h>
#include <linux/sh_timer.h>
#include <linux/io.h>

enum {
Expand Down Expand Up @@ -168,7 +167,7 @@ static struct platform_device sci_device = {
},
};

static struct sh_cmt_config cmt0_platform_data = {
static struct sh_timer_config cmt0_platform_data = {
.name = "CMT0",
.channel_offset = 0x02,
.timer_bit = 0,
Expand Down Expand Up @@ -200,7 +199,7 @@ static struct platform_device cmt0_device = {
.num_resources = ARRAY_SIZE(cmt0_resources),
};

static struct sh_cmt_config cmt1_platform_data = {
static struct sh_timer_config cmt1_platform_data = {
.name = "CMT1",
.channel_offset = 0x08,
.timer_bit = 1,
Expand Down Expand Up @@ -232,7 +231,7 @@ static struct platform_device cmt1_device = {
.num_resources = ARRAY_SIZE(cmt1_resources),
};

static struct sh_mtu2_config mtu2_0_platform_data = {
static struct sh_timer_config mtu2_0_platform_data = {
.name = "MTU2_0",
.channel_offset = -0x80,
.timer_bit = 0,
Expand Down Expand Up @@ -263,7 +262,7 @@ static struct platform_device mtu2_0_device = {
.num_resources = ARRAY_SIZE(mtu2_0_resources),
};

static struct sh_mtu2_config mtu2_1_platform_data = {
static struct sh_timer_config mtu2_1_platform_data = {
.name = "MTU2_1",
.channel_offset = -0x100,
.timer_bit = 1,
Expand Down Expand Up @@ -294,7 +293,7 @@ static struct platform_device mtu2_1_device = {
.num_resources = ARRAY_SIZE(mtu2_1_resources),
};

static struct sh_mtu2_config mtu2_2_platform_data = {
static struct sh_timer_config mtu2_2_platform_data = {
.name = "MTU2_2",
.channel_offset = 0x80,
.timer_bit = 2,
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/kernel/cpu/sh4a/setup-sh7343.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/uio_driver.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>
#include <asm/clock.h>

static struct resource iic0_resources[] = {
Expand Down Expand Up @@ -141,7 +141,7 @@ static struct platform_device jpu_device = {
.num_resources = ARRAY_SIZE(jpu_resources),
};

static struct sh_cmt_config cmt_platform_data = {
static struct sh_timer_config cmt_platform_data = {
.name = "CMT",
.channel_offset = 0x60,
.timer_bit = 5,
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/kernel/cpu/sh4a/setup-sh7366.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <linux/serial.h>
#include <linux/serial_sci.h>
#include <linux/uio_driver.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>
#include <asm/clock.h>

static struct resource iic_resources[] = {
Expand Down Expand Up @@ -148,7 +148,7 @@ static struct platform_device veu1_device = {
.num_resources = ARRAY_SIZE(veu1_resources),
};

static struct sh_cmt_config cmt_platform_data = {
static struct sh_timer_config cmt_platform_data = {
.name = "CMT",
.channel_offset = 0x60,
.timer_bit = 5,
Expand Down
11 changes: 5 additions & 6 deletions arch/sh/kernel/cpu/sh4a/setup-sh7722.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
#include <linux/serial_sci.h>
#include <linux/mm.h>
#include <linux/uio_driver.h>
#include <linux/sh_cmt.h>
#include <linux/sh_tmu.h>
#include <linux/sh_timer.h>
#include <asm/clock.h>
#include <asm/mmzone.h>

Expand Down Expand Up @@ -178,7 +177,7 @@ static struct platform_device jpu_device = {
.num_resources = ARRAY_SIZE(jpu_resources),
};

static struct sh_cmt_config cmt_platform_data = {
static struct sh_timer_config cmt_platform_data = {
.name = "CMT",
.channel_offset = 0x60,
.timer_bit = 5,
Expand Down Expand Up @@ -210,7 +209,7 @@ static struct platform_device cmt_device = {
.num_resources = ARRAY_SIZE(cmt_resources),
};

static struct sh_tmu_config tmu0_platform_data = {
static struct sh_timer_config tmu0_platform_data = {
.name = "TMU0",
.channel_offset = 0x04,
.timer_bit = 0,
Expand Down Expand Up @@ -241,7 +240,7 @@ static struct platform_device tmu0_device = {
.num_resources = ARRAY_SIZE(tmu0_resources),
};

static struct sh_tmu_config tmu1_platform_data = {
static struct sh_timer_config tmu1_platform_data = {
.name = "TMU1",
.channel_offset = 0x10,
.timer_bit = 1,
Expand Down Expand Up @@ -272,7 +271,7 @@ static struct platform_device tmu1_device = {
.num_resources = ARRAY_SIZE(tmu1_resources),
};

static struct sh_tmu_config tmu2_platform_data = {
static struct sh_timer_config tmu2_platform_data = {
.name = "TMU2",
.channel_offset = 0x1c,
.timer_bit = 2,
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/kernel/cpu/sh4a/setup-sh7723.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include <linux/mm.h>
#include <linux/serial_sci.h>
#include <linux/uio_driver.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>
#include <asm/clock.h>
#include <asm/mmzone.h>

Expand Down Expand Up @@ -101,7 +101,7 @@ static struct platform_device veu1_device = {
.num_resources = ARRAY_SIZE(veu1_resources),
};

static struct sh_cmt_config cmt_platform_data = {
static struct sh_timer_config cmt_platform_data = {
.name = "CMT",
.channel_offset = 0x60,
.timer_bit = 5,
Expand Down
4 changes: 2 additions & 2 deletions arch/sh/kernel/cpu/sh4a/setup-sh7724.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <linux/mm.h>
#include <linux/serial_sci.h>
#include <linux/uio_driver.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>
#include <linux/io.h>
#include <asm/clock.h>
#include <asm/mmzone.h>
Expand Down Expand Up @@ -230,7 +230,7 @@ static struct platform_device veu1_device = {
.num_resources = ARRAY_SIZE(veu1_resources),
};

static struct sh_cmt_config cmt_platform_data = {
static struct sh_timer_config cmt_platform_data = {
.name = "CMT",
.channel_offset = 0x60,
.timer_bit = 5,
Expand Down
14 changes: 7 additions & 7 deletions drivers/clocksource/sh_cmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <linux/err.h>
#include <linux/clocksource.h>
#include <linux/clockchips.h>
#include <linux/sh_cmt.h>
#include <linux/sh_timer.h>

struct sh_cmt_priv {
void __iomem *mapbase;
Expand Down Expand Up @@ -59,7 +59,7 @@ static DEFINE_SPINLOCK(sh_cmt_lock);

static inline unsigned long sh_cmt_read(struct sh_cmt_priv *p, int reg_nr)
{
struct sh_cmt_config *cfg = p->pdev->dev.platform_data;
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
void __iomem *base = p->mapbase;
unsigned long offs;

Expand All @@ -83,7 +83,7 @@ static inline unsigned long sh_cmt_read(struct sh_cmt_priv *p, int reg_nr)
static inline void sh_cmt_write(struct sh_cmt_priv *p, int reg_nr,
unsigned long value)
{
struct sh_cmt_config *cfg = p->pdev->dev.platform_data;
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
void __iomem *base = p->mapbase;
unsigned long offs;

Expand Down Expand Up @@ -131,7 +131,7 @@ static unsigned long sh_cmt_get_counter(struct sh_cmt_priv *p,

static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)
{
struct sh_cmt_config *cfg = p->pdev->dev.platform_data;
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
unsigned long flags, value;

/* start stop register shared by multiple timer channels */
Expand All @@ -149,7 +149,7 @@ static void sh_cmt_start_stop_ch(struct sh_cmt_priv *p, int start)

static int sh_cmt_enable(struct sh_cmt_priv *p, unsigned long *rate)
{
struct sh_cmt_config *cfg = p->pdev->dev.platform_data;
struct sh_timer_config *cfg = p->pdev->dev.platform_data;
int ret;

/* enable clock */
Expand Down Expand Up @@ -560,7 +560,7 @@ int sh_cmt_register(struct sh_cmt_priv *p, char *name,

static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
{
struct sh_cmt_config *cfg = pdev->dev.platform_data;
struct sh_timer_config *cfg = pdev->dev.platform_data;
struct resource *res;
int irq, ret;
ret = -ENXIO;
Expand Down Expand Up @@ -638,7 +638,7 @@ static int sh_cmt_setup(struct sh_cmt_priv *p, struct platform_device *pdev)
static int __devinit sh_cmt_probe(struct platform_device *pdev)
{
struct sh_cmt_priv *p = platform_get_drvdata(pdev);
struct sh_cmt_config *cfg = pdev->dev.platform_data;
struct sh_timer_config *cfg = pdev->dev.platform_data;
int ret;

if (p) {
Expand Down
Loading

0 comments on commit 46a12f7

Please sign in to comment.