Skip to content

Commit

Permalink
sh: Finish the sh64 migration off of ARCH_USES_GETTIMEOFFSET.
Browse files Browse the repository at this point in the history
This adds sh_tmu support to the SH-5 subtypes, which subsequently allows
us to kill off time_64.c and use the now generic time_32.c. As a bonus,
SH-5 now supports highres timers and tickless for the first time.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Paul Mundt committed May 8, 2009
1 parent c2ecb4c commit add4706
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 269 deletions.
5 changes: 1 addition & 4 deletions arch/sh/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,6 @@ config ARCH_NO_VIRT_TO_BUS
config ARCH_HAS_DEFAULT_IDLE
def_bool y

config ARCH_USES_GETTIMEOFFSET
def_bool y
depends on SUPERH64

config IO_TRAPPED
bool

Expand Down Expand Up @@ -190,6 +186,7 @@ config CPU_SH4AL_DSP
config CPU_SH5
bool
select CPU_HAS_FPU
select SYS_SUPPORTS_TMU

config CPU_SHX2
bool
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/kernel/Makefile_64
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ extra-y := head_64.o init_task.o vmlinux.lds

obj-y := debugtraps.o idle.o io.o io_generic.o irq.o machvec.o process_64.o \
ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \
syscalls_64.o time_64.o topology.o traps.o traps_64.o
syscalls_64.o time_32.o topology.o traps.o traps_64.o

obj-y += cpu/ timers/
obj-$(CONFIG_VSYSCALL) += vsyscall/
Expand Down
118 changes: 118 additions & 0 deletions arch/sh/kernel/cpu/sh5/setup-sh5.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <linux/serial_sci.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/sh_timer.h>
#include <asm/addrspace.h>

static struct plat_sci_port sci_platform_data[] = {
Expand Down Expand Up @@ -64,14 +65,131 @@ static struct platform_device rtc_device = {
.resource = rtc_resources,
};

#define TMU_BLOCK_OFF 0x01020000
#define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF
#define TMU0_BASE (TMU_BASE + 0x8 + (0xc * 0x0))
#define TMU1_BASE (TMU_BASE + 0x8 + (0xc * 0x1))
#define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2))

static struct sh_timer_config tmu0_platform_data = {
.name = "TMU0",
.channel_offset = 0x04,
.timer_bit = 0,
.clk = "module_clk",
.clockevent_rating = 200,
};

static struct resource tmu0_resources[] = {
[0] = {
.name = "TMU0",
.start = TMU0_BASE,
.end = TMU0_BASE + 0xc - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_TUNI0,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device tmu0_device = {
.name = "sh_tmu",
.id = 0,
.dev = {
.platform_data = &tmu0_platform_data,
},
.resource = tmu0_resources,
.num_resources = ARRAY_SIZE(tmu0_resources),
};

static struct sh_timer_config tmu1_platform_data = {
.name = "TMU1",
.channel_offset = 0x10,
.timer_bit = 1,
.clk = "module_clk",
.clocksource_rating = 200,
};

static struct resource tmu1_resources[] = {
[0] = {
.name = "TMU1",
.start = TMU1_BASE,
.end = TMU1_BASE + 0xc - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_TUNI1,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device tmu1_device = {
.name = "sh_tmu",
.id = 1,
.dev = {
.platform_data = &tmu1_platform_data,
},
.resource = tmu1_resources,
.num_resources = ARRAY_SIZE(tmu1_resources),
};

static struct sh_timer_config tmu2_platform_data = {
.name = "TMU2",
.channel_offset = 0x1c,
.timer_bit = 2,
.clk = "module_clk",
};

static struct resource tmu2_resources[] = {
[0] = {
.name = "TMU2",
.start = TMU2_BASE,
.end = TMU2_BASE + 0xc - 1,
.flags = IORESOURCE_MEM,
},
[1] = {
.start = IRQ_TUNI2,
.flags = IORESOURCE_IRQ,
},
};

static struct platform_device tmu2_device = {
.name = "sh_tmu",
.id = 2,
.dev = {
.platform_data = &tmu2_platform_data,
},
.resource = tmu2_resources,
.num_resources = ARRAY_SIZE(tmu2_resources),
};

static struct platform_device *sh5_early_devices[] __initdata = {
&tmu0_device,
&tmu1_device,
&tmu2_device,
};

static struct platform_device *sh5_devices[] __initdata = {
&sci_device,
&rtc_device,
};

static int __init sh5_devices_setup(void)
{
int ret;

ret = platform_add_devices(sh5_early_devices,
ARRAY_SIZE(sh5_early_devices));
if (unlikely(ret != 0))
return ret;

return platform_add_devices(sh5_devices,
ARRAY_SIZE(sh5_devices));
}
__initcall(sh5_devices_setup);

void __init plat_early_device_setup(void)
{
early_platform_add_devices(sh5_early_devices,
ARRAY_SIZE(sh5_early_devices));
}
Loading

0 comments on commit add4706

Please sign in to comment.