Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: SE7206 build fixes.

A number of API changes happened underneath the 7206 patches, update
for everything that broke.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>

+54 -153
+11 -33
arch/sh/boards/se/7206/irq.c
··· 6 6 * Hitachi SolutionEngine Support. 7 7 * 8 8 */ 9 - 10 - #include <linux/config.h> 11 9 #include <linux/init.h> 12 10 #include <linux/irq.h> 13 - #include <asm/irq.h> 14 - #include <asm/io.h> 11 + #include <linux/io.h> 12 + #include <linux/irq.h> 15 13 #include <asm/se7206.h> 16 14 17 15 #define INTSTS0 0x31800000 ··· 17 19 #define INTMSK0 0x31800004 18 20 #define INTMSK1 0x31800006 19 21 #define INTSEL 0x31800008 20 - 21 - /* shutdown is same as "disable" */ 22 - #define shutdown_se7206_irq disable_se7206_irq 23 22 24 23 static void disable_se7206_irq(unsigned int irq) 25 24 { ··· 79 84 ctrl_outw(msk1, INTMSK1); 80 85 } 81 86 82 - static unsigned int startup_se7206_irq(unsigned int irq) 83 - { 84 - enable_se7206_irq(irq); 85 - return 0; /* never anything pending */ 86 - } 87 - 88 - static void ack_se7206_irq(unsigned int irq) 89 - { 90 - disable_se7206_irq(irq); 91 - } 92 - 93 - static void end_se7206_irq(unsigned int irq) 87 + static void eoi_se7206_irq(unsigned int irq) 94 88 { 95 89 unsigned short sts0,sts1; 96 90 ··· 105 121 ctrl_outw(sts1, INTSTS1); 106 122 } 107 123 108 - static struct hw_interrupt_type se7206_irq_type = { 109 - .typename = "SE7206 FPGA-IRQ", 110 - .startup = startup_se7206_irq, 111 - .shutdown = shutdown_se7206_irq, 112 - .enable = enable_se7206_irq, 113 - .disable = disable_se7206_irq, 114 - .ack = ack_se7206_irq, 115 - .end = end_se7206_irq, 124 + static struct irq_chip se7206_irq_chip __read_mostly = { 125 + .name = "SE7206-FPGA-IRQ", 126 + .mask = disable_se7206_irq, 127 + .unmask = enable_se7206_irq, 128 + .mask_ack = disable_se7206_irq, 129 + .eoi = eoi_se7206_irq, 116 130 }; 117 131 118 132 static void make_se7206_irq(unsigned int irq) 119 133 { 120 134 disable_irq_nosync(irq); 121 - irq_desc[irq].handler = &se7206_irq_type; 135 + set_irq_chip_and_handler_name(irq, &se7206_irq_chip, 136 + handle_level_irq, "level"); 122 137 disable_se7206_irq(irq); 123 138 } 124 139 ··· 136 153 ctrl_outw(0x0000,INTSTS1); /* Clear INTSTS1 */ 137 154 /* IRQ0=LAN, IRQ1=ATA, IRQ3=SLT,PCM */ 138 155 ctrl_outw(0x0001,INTSEL); 139 - } 140 - 141 - int se7206_irq_demux(int irq) 142 - { 143 - return irq; 144 156 }
+1 -2
arch/sh/boards/se/7206/setup.c
··· 10 10 11 11 #include <linux/init.h> 12 12 #include <linux/platform_device.h> 13 - #include <asm/io.h> 14 13 #include <asm/se7206.h> 14 + #include <asm/io.h> 15 15 #include <asm/machvec.h> 16 16 17 17 static struct resource smc91x_resources[] = { ··· 72 72 .mv_outsl = se7206_outsl, 73 73 74 74 .mv_init_irq = init_se7206_IRQ, 75 - .mv_irq_demux = se7206_irq_demux, 76 75 #ifdef CONFIG_HEARTBEAT 77 76 .mv_heartbeat = heartbeat_se, 78 77 #endif
+2
arch/sh/kernel/sys_sh.c
··· 50 50 51 51 EXPORT_SYMBOL(shm_align_mask); 52 52 53 + #ifdef CONFIG_MMU 53 54 /* 54 55 * To avoid cache aliases, we map the shared page with same color. 55 56 */ ··· 136 135 addr = COLOUR_ALIGN(addr, pgoff); 137 136 } 138 137 } 138 + #endif /* CONFIG_MMU */ 139 139 140 140 static inline long 141 141 do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
+5 -58
arch/sh/kernel/timers/timer-cmt.c
··· 96 96 return count; 97 97 } 98 98 99 - static irqreturn_t cmt_timer_interrupt(int irq, void *dev_id, 100 - struct pt_regs *regs) 99 + static irqreturn_t cmt_timer_interrupt(int irq, void *dev_id) 101 100 { 102 101 unsigned long timer_status; 103 102 ··· 113 114 * locally disabled. -arca 114 115 */ 115 116 write_seqlock(&xtime_lock); 116 - handle_timer_tick(regs); 117 + handle_timer_tick(); 117 118 write_sequnlock(&xtime_lock); 118 119 119 120 return IRQ_HANDLED; ··· 122 123 static struct irqaction cmt_irq = { 123 124 .name = "timer", 124 125 .handler = cmt_timer_interrupt, 125 - .flags = SA_INTERRUPT, 126 + .flags = IRQF_DISABLED, 126 127 .mask = CPU_MASK_NONE, 127 128 }; 128 - 129 - /* 130 - * Hah! We'll see if this works (switching from usecs to nsecs). 131 - */ 132 - static unsigned long cmt_timer_get_frequency(void) 133 - { 134 - u32 freq; 135 - struct timespec ts1, ts2; 136 - unsigned long diff_nsec; 137 - unsigned long factor; 138 - 139 - /* Setup the timer: We don't want to generate interrupts, just 140 - * have it count down at its natural rate. 141 - */ 142 - 143 - ctrl_outw(ctrl_inw(CMT_CMSTR) & ~0x01, CMT_CMSTR); 144 - ctrl_outw(CMT_CMCSR_CALIB, CMT_CMCSR_0); 145 - ctrl_outw(0xffff, CMT_CMCOR_0); 146 - ctrl_outw(0xffff, CMT_CMCNT_0); 147 - 148 - rtc_sh_get_time(&ts2); 149 - 150 - do { 151 - rtc_sh_get_time(&ts1); 152 - } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 153 - 154 - /* actually start the timer */ 155 - ctrl_outw(ctrl_inw(CMT_CMSTR) | 0x01, CMT_CMSTR); 156 - 157 - do { 158 - rtc_sh_get_time(&ts2); 159 - } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 160 - 161 - freq = 0xffff - ctrl_inw(CMT_CMCNT_0); 162 - if (ts2.tv_nsec < ts1.tv_nsec) { 163 - ts2.tv_nsec += 1000000000; 164 - ts2.tv_sec--; 165 - } 166 - 167 - diff_nsec = (ts2.tv_sec - ts1.tv_sec) * 1000000000 + (ts2.tv_nsec - ts1.tv_nsec); 168 - 169 - /* this should work well if the RTC has a precision of n Hz, where 170 - * n is an integer. I don't think we have to worry about the other 171 - * cases. */ 172 - factor = (1000000000 + diff_nsec/2) / diff_nsec; 173 - 174 - if (factor * diff_nsec > 1100000000 || 175 - factor * diff_nsec < 900000000) 176 - panic("weird RTC (diff_nsec %ld)", diff_nsec); 177 - 178 - return freq * factor; 179 - } 180 129 181 130 static void cmt_clk_init(struct clk *clk) 182 131 { ··· 192 245 .init = cmt_timer_init, 193 246 .start = cmt_timer_start, 194 247 .stop = cmt_timer_stop, 195 - .get_frequency = cmt_timer_get_frequency, 248 + #ifndef CONFIG_GENERIC_TIME 196 249 .get_offset = cmt_timer_get_offset, 250 + #endif 197 251 }; 198 252 199 253 struct sys_timer cmt_timer = { 200 254 .name = "cmt", 201 255 .ops = &cmt_timer_ops, 202 256 }; 203 -
+5 -57
arch/sh/kernel/timers/timer-mtu2.c
··· 98 98 return count; 99 99 } 100 100 101 - static irqreturn_t mtu2_timer_interrupt(int irq, void *dev_id, 102 - struct pt_regs *regs) 101 + static irqreturn_t mtu2_timer_interrupt(int irq, void *dev_id) 103 102 { 104 103 unsigned long timer_status; 105 104 ··· 109 110 110 111 /* Do timer tick */ 111 112 write_seqlock(&xtime_lock); 112 - handle_timer_tick(regs); 113 + handle_timer_tick(); 113 114 write_sequnlock(&xtime_lock); 114 115 115 116 return IRQ_HANDLED; ··· 118 119 static struct irqaction mtu2_irq = { 119 120 .name = "timer", 120 121 .handler = mtu2_timer_interrupt, 121 - .flags = SA_INTERRUPT, 122 + .flags = IRQF_DISABLED, 122 123 .mask = CPU_MASK_NONE, 123 124 }; 124 - 125 - /* 126 - * Hah! We'll see if this works (switching from usecs to nsecs). 127 - */ 128 - static unsigned long mtu2_timer_get_frequency(void) 129 - { 130 - u32 freq; 131 - struct timespec ts1, ts2; 132 - unsigned long diff_nsec; 133 - unsigned long factor; 134 - 135 - /* Setup the timer: We don't want to generate interrupts, just 136 - * have it count down at its natural rate. 137 - */ 138 - 139 - ctrl_outb(ctrl_inb(MTU2_TSTR) & ~MTU2_TSTR_CST1, MTU2_TSTR); 140 - ctrl_outb(MTU2_TCR_CALIB, MTU2_TCR_1); 141 - ctrl_outb(ctrl_inb(MTU2_TIER_1) & ~MTU2_TIER_TGIEA, MTU2_TIER_1); 142 - ctrl_outw(0, MTU2_TCNT_1); 143 - 144 - rtc_get_time(&ts2); 145 - 146 - do { 147 - rtc_get_time(&ts1); 148 - } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 149 - 150 - /* actually start the timer */ 151 - ctrl_outw(ctrl_inw(CMT_CMSTR) | 0x01, CMT_CMSTR); 152 - 153 - do { 154 - rtc_get_time(&ts2); 155 - } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec); 156 - 157 - freq = ctrl_inw(MTU2_TCNT_0); 158 - if (ts2.tv_nsec < ts1.tv_nsec) { 159 - ts2.tv_nsec += 1000000000; 160 - ts2.tv_sec--; 161 - } 162 - 163 - diff_nsec = (ts2.tv_sec - ts1.tv_sec) * 1000000000 + (ts2.tv_nsec - ts1.tv_nsec); 164 - 165 - /* this should work well if the RTC has a precision of n Hz, where 166 - * n is an integer. I don't think we have to worry about the other 167 - * cases. */ 168 - factor = (1000000000 + diff_nsec/2) / diff_nsec; 169 - 170 - if (factor * diff_nsec > 1100000000 || 171 - factor * diff_nsec < 900000000) 172 - panic("weird RTC (diff_nsec %ld)", diff_nsec); 173 - 174 - return freq * factor; 175 - } 176 125 177 126 static unsigned int divisors[] = { 1, 4, 16, 64, 1, 1, 256 }; 178 127 ··· 197 250 .init = mtu2_timer_init, 198 251 .start = mtu2_timer_start, 199 252 .stop = mtu2_timer_stop, 200 - .get_frequency = mtu2_timer_get_frequency, 253 + #ifndef CONFIG_GENERIC_TIME 201 254 .get_offset = mtu2_timer_get_offset, 255 + #endif 202 256 }; 203 257 204 258 struct sys_timer mtu2_timer = {
+10 -2
arch/sh/kernel/traps.c
··· 107 107 die(str, regs, err); 108 108 } 109 109 110 - static int handle_unaligned_notify_count = 10; 111 - 112 110 /* 113 111 * try and fix up kernelspace address errors 114 112 * - userspace errors just cause EFAULT to be returned, resulting in SEGV ··· 345 347 #define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4) 346 348 #define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4) 347 349 350 + /* 351 + * XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit 352 + * opcodes.. 353 + */ 354 + #ifndef CONFIG_CPU_SH2A 355 + static int handle_unaligned_notify_count = 10; 356 + 348 357 static int handle_unaligned_access(u16 instruction, struct pt_regs *regs) 349 358 { 350 359 u_int rm; ··· 488 483 regs->pc += 2; 489 484 return ret; 490 485 } 486 + #endif /* CONFIG_CPU_SH2A */ 491 487 492 488 #ifdef CONFIG_CPU_HAS_SR_RB 493 489 #define lookup_exception_vector(x) \ ··· 507 501 { 508 502 unsigned long error_code = 0; 509 503 mm_segment_t oldfs; 504 + #ifndef CONFIG_CPU_SH2A 510 505 u16 instruction; 511 506 int tmp; 507 + #endif 512 508 513 509 /* Intentional ifdef */ 514 510 #ifdef CONFIG_CPU_HAS_SR_RB
+6
include/asm-sh/cpu-sh2/timer.h
··· 1 + #ifndef __ASM_CPU_SH2_TIMER_H 2 + #define __ASM_CPU_SH2_TIMER_H 3 + 4 + /* Nothing needed yet */ 5 + 6 + #endif /* __ASM_CPU_SH2_TIMER_H */
+13
include/asm-sh/se7206.h
··· 1 + #ifndef __ASM_SH_SE7206_H 2 + #define __ASM_SH_SE7206_H 3 + 4 + #define PA_SMSC 0x30000000 5 + #define PA_MRSHPC 0x34000000 6 + #define PA_LED 0x31400000 7 + 8 + void init_se7206_IRQ(void); 9 + 10 + #define __IO_PREFIX se7206 11 + #include <asm/io_generic.h> 12 + 13 + #endif /* __ASM_SH_SE7206_H */
+1 -1
include/asm-sh/timer.h
··· 22 22 23 23 #define TICK_SIZE (tick_nsec / 1000) 24 24 25 - extern struct sys_timer tmu_timer; 25 + extern struct sys_timer tmu_timer, cmt_timer, mtu2_timer; 26 26 extern struct sys_timer *sys_timer; 27 27 28 28 #ifndef CONFIG_GENERIC_TIME