diff options
| author | Paul Mundt <lethal@linux-sh.org> | 2009-05-08 03:12:17 -0400 |
|---|---|---|
| committer | Paul Mundt <lethal@linux-sh.org> | 2009-05-08 03:12:17 -0400 |
| commit | add47067a8ca324e9d26c4373350dc3cce7f1e7f (patch) | |
| tree | 2ee7062a8e9b42d0452b5ca2e848483366f1f598 /arch/sh/kernel/cpu/sh5 | |
| parent | c2ecb4c4a7da16288062a057b693b7b1e16aaf88 (diff) | |
sh: Finish the sh64 migration off of ARCH_USES_GETTIMEOFFSET.
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>
Diffstat (limited to 'arch/sh/kernel/cpu/sh5')
| -rw-r--r-- | arch/sh/kernel/cpu/sh5/setup-sh5.c | 118 |
1 files changed, 118 insertions, 0 deletions
diff --git a/arch/sh/kernel/cpu/sh5/setup-sh5.c b/arch/sh/kernel/cpu/sh5/setup-sh5.c index 9a362c8f3fe9..678d69bdebba 100644 --- a/arch/sh/kernel/cpu/sh5/setup-sh5.c +++ b/arch/sh/kernel/cpu/sh5/setup-sh5.c | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include <linux/serial_sci.h> | 13 | #include <linux/serial_sci.h> |
| 14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
| 15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
| 16 | #include <linux/sh_timer.h> | ||
| 16 | #include <asm/addrspace.h> | 17 | #include <asm/addrspace.h> |
| 17 | 18 | ||
| 18 | static struct plat_sci_port sci_platform_data[] = { | 19 | static struct plat_sci_port sci_platform_data[] = { |
| @@ -64,6 +65,110 @@ static struct platform_device rtc_device = { | |||
| 64 | .resource = rtc_resources, | 65 | .resource = rtc_resources, |
| 65 | }; | 66 | }; |
| 66 | 67 | ||
| 68 | #define TMU_BLOCK_OFF 0x01020000 | ||
| 69 | #define TMU_BASE PHYS_PERIPHERAL_BLOCK + TMU_BLOCK_OFF | ||
| 70 | #define TMU0_BASE (TMU_BASE + 0x8 + (0xc * 0x0)) | ||
| 71 | #define TMU1_BASE (TMU_BASE + 0x8 + (0xc * 0x1)) | ||
| 72 | #define TMU2_BASE (TMU_BASE + 0x8 + (0xc * 0x2)) | ||
| 73 | |||
| 74 | static struct sh_timer_config tmu0_platform_data = { | ||
| 75 | .name = "TMU0", | ||
| 76 | .channel_offset = 0x04, | ||
| 77 | .timer_bit = 0, | ||
| 78 | .clk = "module_clk", | ||
| 79 | .clockevent_rating = 200, | ||
| 80 | }; | ||
| 81 | |||
| 82 | static struct resource tmu0_resources[] = { | ||
| 83 | [0] = { | ||
| 84 | .name = "TMU0", | ||
| 85 | .start = TMU0_BASE, | ||
| 86 | .end = TMU0_BASE + 0xc - 1, | ||
| 87 | .flags = IORESOURCE_MEM, | ||
| 88 | }, | ||
| 89 | [1] = { | ||
| 90 | .start = IRQ_TUNI0, | ||
| 91 | .flags = IORESOURCE_IRQ, | ||
| 92 | }, | ||
| 93 | }; | ||
| 94 | |||
| 95 | static struct platform_device tmu0_device = { | ||
| 96 | .name = "sh_tmu", | ||
| 97 | .id = 0, | ||
| 98 | .dev = { | ||
| 99 | .platform_data = &tmu0_platform_data, | ||
| 100 | }, | ||
| 101 | .resource = tmu0_resources, | ||
| 102 | .num_resources = ARRAY_SIZE(tmu0_resources), | ||
| 103 | }; | ||
| 104 | |||
| 105 | static struct sh_timer_config tmu1_platform_data = { | ||
| 106 | .name = "TMU1", | ||
| 107 | .channel_offset = 0x10, | ||
| 108 | .timer_bit = 1, | ||
| 109 | .clk = "module_clk", | ||
| 110 | .clocksource_rating = 200, | ||
| 111 | }; | ||
| 112 | |||
| 113 | static struct resource tmu1_resources[] = { | ||
| 114 | [0] = { | ||
| 115 | .name = "TMU1", | ||
| 116 | .start = TMU1_BASE, | ||
| 117 | .end = TMU1_BASE + 0xc - 1, | ||
| 118 | .flags = IORESOURCE_MEM, | ||
| 119 | }, | ||
| 120 | [1] = { | ||
| 121 | .start = IRQ_TUNI1, | ||
| 122 | .flags = IORESOURCE_IRQ, | ||
| 123 | }, | ||
| 124 | }; | ||
| 125 | |||
| 126 | static struct platform_device tmu1_device = { | ||
| 127 | .name = "sh_tmu", | ||
| 128 | .id = 1, | ||
| 129 | .dev = { | ||
| 130 | .platform_data = &tmu1_platform_data, | ||
| 131 | }, | ||
| 132 | .resource = tmu1_resources, | ||
| 133 | .num_resources = ARRAY_SIZE(tmu1_resources), | ||
| 134 | }; | ||
| 135 | |||
| 136 | static struct sh_timer_config tmu2_platform_data = { | ||
| 137 | .name = "TMU2", | ||
| 138 | .channel_offset = 0x1c, | ||
| 139 | .timer_bit = 2, | ||
| 140 | .clk = "module_clk", | ||
| 141 | }; | ||
| 142 | |||
| 143 | static struct resource tmu2_resources[] = { | ||
| 144 | [0] = { | ||
| 145 | .name = "TMU2", | ||
| 146 | .start = TMU2_BASE, | ||
| 147 | .end = TMU2_BASE + 0xc - 1, | ||
| 148 | .flags = IORESOURCE_MEM, | ||
| 149 | }, | ||
| 150 | [1] = { | ||
| 151 | .start = IRQ_TUNI2, | ||
| 152 | .flags = IORESOURCE_IRQ, | ||
| 153 | }, | ||
| 154 | }; | ||
| 155 | |||
| 156 | static struct platform_device tmu2_device = { | ||
| 157 | .name = "sh_tmu", | ||
| 158 | .id = 2, | ||
| 159 | .dev = { | ||
| 160 | .platform_data = &tmu2_platform_data, | ||
| 161 | }, | ||
| 162 | .resource = tmu2_resources, | ||
| 163 | .num_resources = ARRAY_SIZE(tmu2_resources), | ||
| 164 | }; | ||
| 165 | |||
| 166 | static struct platform_device *sh5_early_devices[] __initdata = { | ||
| 167 | &tmu0_device, | ||
| 168 | &tmu1_device, | ||
| 169 | &tmu2_device, | ||
| 170 | }; | ||
| 171 | |||
| 67 | static struct platform_device *sh5_devices[] __initdata = { | 172 | static struct platform_device *sh5_devices[] __initdata = { |
| 68 | &sci_device, | 173 | &sci_device, |
| 69 | &rtc_device, | 174 | &rtc_device, |
| @@ -71,7 +176,20 @@ static struct platform_device *sh5_devices[] __initdata = { | |||
| 71 | 176 | ||
| 72 | static int __init sh5_devices_setup(void) | 177 | static int __init sh5_devices_setup(void) |
| 73 | { | 178 | { |
| 179 | int ret; | ||
| 180 | |||
| 181 | ret = platform_add_devices(sh5_early_devices, | ||
| 182 | ARRAY_SIZE(sh5_early_devices)); | ||
| 183 | if (unlikely(ret != 0)) | ||
| 184 | return ret; | ||
| 185 | |||
| 74 | return platform_add_devices(sh5_devices, | 186 | return platform_add_devices(sh5_devices, |
| 75 | ARRAY_SIZE(sh5_devices)); | 187 | ARRAY_SIZE(sh5_devices)); |
| 76 | } | 188 | } |
| 77 | __initcall(sh5_devices_setup); | 189 | __initcall(sh5_devices_setup); |
| 190 | |||
| 191 | void __init plat_early_device_setup(void) | ||
| 192 | { | ||
| 193 | early_platform_add_devices(sh5_early_devices, | ||
| 194 | ARRAY_SIZE(sh5_early_devices)); | ||
| 195 | } | ||
