aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-09-05 17:30:58 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-09-05 17:30:58 -0400
commitb693ffe67363119199ffe9f2fac9119475968e8a (patch)
tree3b1e6ab0720bbfcbb3a4d58cd3a13750f830ffe8
parent14408c4f4172eafc26ff52bebb7a8ab85b1c5492 (diff)
parent4eb00c9f92202a759aadbce73ea4a947b639b5e6 (diff)
Merge branch 'sh/for-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* 'sh/for-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: i2c: fix i2c-sh_mobile timing issues sh64: resume_kernel fix for kernel oops built with CONFIG_BKL_PREEMPT=y. sh: resume_kernel fix for kernel oops built with CONFIG_BKL_PREEMPT=y. sh: fix semtimedop syscall sh: update AP325RXA defconfig sh: update Migo-R defconfig sh: fix platform_resource_setup_memory() section mismatch sh: fix kexec entry point for crash kernels sh: crash kernel resource fix sh: fix ptrace_64.c:user_disable_single_step() sh64: re-add the __strnlen_user() prototype
-rw-r--r--arch/sh/configs/ap325rxa_defconfig22
-rw-r--r--arch/sh/configs/migor_defconfig21
-rw-r--r--arch/sh/include/asm/uaccess_64.h2
-rw-r--r--arch/sh/kernel/cpu/sh5/entry.S14
-rw-r--r--arch/sh/kernel/entry-common.S27
-rw-r--r--arch/sh/kernel/machine_kexec.c2
-rw-r--r--arch/sh/kernel/ptrace_64.c2
-rw-r--r--arch/sh/kernel/setup.c6
-rw-r--r--arch/sh/kernel/sys_sh.c2
-rw-r--r--arch/sh/mm/consistent.c6
-rw-r--r--drivers/i2c/busses/i2c-sh_mobile.c271
11 files changed, 250 insertions, 125 deletions
diff --git a/arch/sh/configs/ap325rxa_defconfig b/arch/sh/configs/ap325rxa_defconfig
index 29926a9b9ce2..851c870adf3b 100644
--- a/arch/sh/configs/ap325rxa_defconfig
+++ b/arch/sh/configs/ap325rxa_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26 3# Linux kernel version: 2.6.27-rc4
4# Wed Jul 30 01:18:59 2008 4# Tue Aug 26 14:21:17 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -11,6 +11,7 @@ CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
14CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y 16CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y 17CONFIG_GENERIC_TIME=y
@@ -20,7 +21,6 @@ CONFIG_LOCKDEP_SUPPORT=y
20# CONFIG_ARCH_HAS_ILOG2_U32 is not set 21# CONFIG_ARCH_HAS_ILOG2_U32 is not set
21# CONFIG_ARCH_HAS_ILOG2_U64 is not set 22# CONFIG_ARCH_HAS_ILOG2_U64 is not set
22CONFIG_ARCH_NO_VIRT_TO_BUS=y 23CONFIG_ARCH_NO_VIRT_TO_BUS=y
23CONFIG_ARCH_SUPPORTS_AOUT=y
24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 24CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
25 25
26# 26#
@@ -58,7 +58,6 @@ CONFIG_SYSCTL=y
58CONFIG_EMBEDDED=y 58CONFIG_EMBEDDED=y
59CONFIG_UID16=y 59CONFIG_UID16=y
60CONFIG_SYSCTL_SYSCALL=y 60CONFIG_SYSCTL_SYSCALL=y
61CONFIG_SYSCTL_SYSCALL_CHECK=y
62# CONFIG_KALLSYMS is not set 61# CONFIG_KALLSYMS is not set
63CONFIG_HOTPLUG=y 62CONFIG_HOTPLUG=y
64CONFIG_PRINTK=y 63CONFIG_PRINTK=y
@@ -89,6 +88,7 @@ CONFIG_HAVE_OPROFILE=y
89# CONFIG_USE_GENERIC_SMP_HELPERS is not set 88# CONFIG_USE_GENERIC_SMP_HELPERS is not set
90CONFIG_HAVE_CLK=y 89CONFIG_HAVE_CLK=y
91CONFIG_PROC_PAGE_MONITOR=y 90CONFIG_PROC_PAGE_MONITOR=y
91CONFIG_HAVE_GENERIC_DMA_COHERENT=y
92CONFIG_SLABINFO=y 92CONFIG_SLABINFO=y
93CONFIG_RT_MUTEXES=y 93CONFIG_RT_MUTEXES=y
94# CONFIG_TINY_SHMEM is not set 94# CONFIG_TINY_SHMEM is not set
@@ -261,9 +261,10 @@ CONFIG_HZ_250=y
261# CONFIG_HZ_300 is not set 261# CONFIG_HZ_300 is not set
262# CONFIG_HZ_1000 is not set 262# CONFIG_HZ_1000 is not set
263CONFIG_HZ=250 263CONFIG_HZ=250
264# CONFIG_SCHED_HRTICK is not set 264CONFIG_SCHED_HRTICK=y
265# CONFIG_KEXEC is not set 265# CONFIG_KEXEC is not set
266# CONFIG_CRASH_DUMP is not set 266# CONFIG_CRASH_DUMP is not set
267CONFIG_SECCOMP=y
267# CONFIG_PREEMPT_NONE is not set 268# CONFIG_PREEMPT_NONE is not set
268# CONFIG_PREEMPT_VOLUNTARY is not set 269# CONFIG_PREEMPT_VOLUNTARY is not set
269CONFIG_PREEMPT=y 270CONFIG_PREEMPT=y
@@ -289,10 +290,6 @@ CONFIG_CMDLINE="console=tty1 console=ttySC5,38400 root=/dev/nfs ip=dhcp"
289# 290#
290CONFIG_BINFMT_ELF=y 291CONFIG_BINFMT_ELF=y
291# CONFIG_BINFMT_MISC is not set 292# CONFIG_BINFMT_MISC is not set
292
293#
294# Networking
295#
296CONFIG_NET=y 293CONFIG_NET=y
297 294
298# 295#
@@ -647,6 +644,7 @@ CONFIG_SSB_POSSIBLE=y
647# CONFIG_MFD_CORE is not set 644# CONFIG_MFD_CORE is not set
648# CONFIG_MFD_SM501 is not set 645# CONFIG_MFD_SM501 is not set
649# CONFIG_HTC_PASIC3 is not set 646# CONFIG_HTC_PASIC3 is not set
647# CONFIG_MFD_TMIO is not set
650 648
651# 649#
652# Multimedia devices 650# Multimedia devices
@@ -690,7 +688,10 @@ CONFIG_DUMMY_CONSOLE=y
690# CONFIG_ACCESSIBILITY is not set 688# CONFIG_ACCESSIBILITY is not set
691# CONFIG_RTC_CLASS is not set 689# CONFIG_RTC_CLASS is not set
692# CONFIG_DMADEVICES is not set 690# CONFIG_DMADEVICES is not set
693# CONFIG_UIO is not set 691CONFIG_UIO=y
692# CONFIG_UIO_PDRV is not set
693CONFIG_UIO_PDRV_GENIRQ=y
694# CONFIG_UIO_SMX is not set
694 695
695# 696#
696# File systems 697# File systems
@@ -854,6 +855,7 @@ CONFIG_FRAME_WARN=1024
854# CONFIG_DEBUG_KERNEL is not set 855# CONFIG_DEBUG_KERNEL is not set
855# CONFIG_DEBUG_BUGVERBOSE is not set 856# CONFIG_DEBUG_BUGVERBOSE is not set
856# CONFIG_DEBUG_MEMORY_INIT is not set 857# CONFIG_DEBUG_MEMORY_INIT is not set
858CONFIG_SYSCTL_SYSCALL_CHECK=y
857# CONFIG_SAMPLES is not set 859# CONFIG_SAMPLES is not set
858# CONFIG_SH_STANDARD_BIOS is not set 860# CONFIG_SH_STANDARD_BIOS is not set
859# CONFIG_EARLY_SCIF_CONSOLE is not set 861# CONFIG_EARLY_SCIF_CONSOLE is not set
diff --git a/arch/sh/configs/migor_defconfig b/arch/sh/configs/migor_defconfig
index c4b3e1d8950d..4f8b1974f2c7 100644
--- a/arch/sh/configs/migor_defconfig
+++ b/arch/sh/configs/migor_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.26 3# Linux kernel version: 2.6.27-rc4
4# Wed Jul 30 01:44:41 2008 4# Tue Aug 26 14:18:17 2008
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -11,6 +11,7 @@ CONFIG_GENERIC_BUG=y
11CONFIG_GENERIC_FIND_NEXT_BIT=y 11CONFIG_GENERIC_FIND_NEXT_BIT=y
12CONFIG_GENERIC_HWEIGHT=y 12CONFIG_GENERIC_HWEIGHT=y
13CONFIG_GENERIC_HARDIRQS=y 13CONFIG_GENERIC_HARDIRQS=y
14CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
14CONFIG_GENERIC_IRQ_PROBE=y 15CONFIG_GENERIC_IRQ_PROBE=y
15CONFIG_GENERIC_CALIBRATE_DELAY=y 16CONFIG_GENERIC_CALIBRATE_DELAY=y
16CONFIG_GENERIC_TIME=y 17CONFIG_GENERIC_TIME=y
@@ -21,7 +22,6 @@ CONFIG_LOCKDEP_SUPPORT=y
21# CONFIG_ARCH_HAS_ILOG2_U32 is not set 22# CONFIG_ARCH_HAS_ILOG2_U32 is not set
22# CONFIG_ARCH_HAS_ILOG2_U64 is not set 23# CONFIG_ARCH_HAS_ILOG2_U64 is not set
23CONFIG_ARCH_NO_VIRT_TO_BUS=y 24CONFIG_ARCH_NO_VIRT_TO_BUS=y
24CONFIG_ARCH_SUPPORTS_AOUT=y
25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 25CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
26 26
27# 27#
@@ -87,6 +87,7 @@ CONFIG_HAVE_OPROFILE=y
87# CONFIG_USE_GENERIC_SMP_HELPERS is not set 87# CONFIG_USE_GENERIC_SMP_HELPERS is not set
88CONFIG_HAVE_CLK=y 88CONFIG_HAVE_CLK=y
89CONFIG_PROC_PAGE_MONITOR=y 89CONFIG_PROC_PAGE_MONITOR=y
90CONFIG_HAVE_GENERIC_DMA_COHERENT=y
90CONFIG_SLABINFO=y 91CONFIG_SLABINFO=y
91CONFIG_RT_MUTEXES=y 92CONFIG_RT_MUTEXES=y
92# CONFIG_TINY_SHMEM is not set 93# CONFIG_TINY_SHMEM is not set
@@ -270,6 +271,7 @@ CONFIG_HZ=250
270# CONFIG_SCHED_HRTICK is not set 271# CONFIG_SCHED_HRTICK is not set
271# CONFIG_KEXEC is not set 272# CONFIG_KEXEC is not set
272# CONFIG_CRASH_DUMP is not set 273# CONFIG_CRASH_DUMP is not set
274CONFIG_SECCOMP=y
273CONFIG_PREEMPT_NONE=y 275CONFIG_PREEMPT_NONE=y
274# CONFIG_PREEMPT_VOLUNTARY is not set 276# CONFIG_PREEMPT_VOLUNTARY is not set
275# CONFIG_PREEMPT is not set 277# CONFIG_PREEMPT is not set
@@ -294,10 +296,6 @@ CONFIG_CMDLINE="console=ttySC0,115200 earlyprintk=serial ip=on"
294# 296#
295CONFIG_BINFMT_ELF=y 297CONFIG_BINFMT_ELF=y
296# CONFIG_BINFMT_MISC is not set 298# CONFIG_BINFMT_MISC is not set
297
298#
299# Networking
300#
301CONFIG_NET=y 299CONFIG_NET=y
302 300
303# 301#
@@ -649,6 +647,7 @@ CONFIG_HW_RANDOM=y
649CONFIG_I2C=y 647CONFIG_I2C=y
650CONFIG_I2C_BOARDINFO=y 648CONFIG_I2C_BOARDINFO=y
651# CONFIG_I2C_CHARDEV is not set 649# CONFIG_I2C_CHARDEV is not set
650CONFIG_I2C_HELPER_AUTO=y
652 651
653# 652#
654# I2C Hardware Bus support 653# I2C Hardware Bus support
@@ -709,6 +708,7 @@ CONFIG_SSB_POSSIBLE=y
709# CONFIG_MFD_CORE is not set 708# CONFIG_MFD_CORE is not set
710# CONFIG_MFD_SM501 is not set 709# CONFIG_MFD_SM501 is not set
711# CONFIG_HTC_PASIC3 is not set 710# CONFIG_HTC_PASIC3 is not set
711# CONFIG_MFD_TMIO is not set
712 712
713# 713#
714# Multimedia devices 714# Multimedia devices
@@ -755,6 +755,8 @@ CONFIG_USB_ARCH_HAS_HCD=y
755# CONFIG_USB is not set 755# CONFIG_USB is not set
756# CONFIG_USB_OTG_WHITELIST is not set 756# CONFIG_USB_OTG_WHITELIST is not set
757# CONFIG_USB_OTG_BLACKLIST_HUB is not set 757# CONFIG_USB_OTG_BLACKLIST_HUB is not set
758# CONFIG_USB_MUSB_HDRC is not set
759# CONFIG_USB_GADGET_MUSB_HDRC is not set
758 760
759# 761#
760# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 762# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -842,7 +844,10 @@ CONFIG_RTC_DRV_RS5C372=y
842# 844#
843CONFIG_RTC_DRV_SH=y 845CONFIG_RTC_DRV_SH=y
844# CONFIG_DMADEVICES is not set 846# CONFIG_DMADEVICES is not set
845# CONFIG_UIO is not set 847CONFIG_UIO=y
848# CONFIG_UIO_PDRV is not set
849CONFIG_UIO_PDRV_GENIRQ=y
850# CONFIG_UIO_SMX is not set
846 851
847# 852#
848# File systems 853# File systems
diff --git a/arch/sh/include/asm/uaccess_64.h b/arch/sh/include/asm/uaccess_64.h
index 81b3d515fcb3..5580fd471003 100644
--- a/arch/sh/include/asm/uaccess_64.h
+++ b/arch/sh/include/asm/uaccess_64.h
@@ -76,4 +76,6 @@ extern long __put_user_asm_l(void *, long);
76extern long __put_user_asm_q(void *, long); 76extern long __put_user_asm_q(void *, long);
77extern void __put_user_unknown(void); 77extern void __put_user_unknown(void);
78 78
79extern long __strnlen_user(const char *__s, long __n);
80
79#endif /* __ASM_SH_UACCESS_64_H */ 81#endif /* __ASM_SH_UACCESS_64_H */
diff --git a/arch/sh/kernel/cpu/sh5/entry.S b/arch/sh/kernel/cpu/sh5/entry.S
index 04c7da968146..e640c63d5811 100644
--- a/arch/sh/kernel/cpu/sh5/entry.S
+++ b/arch/sh/kernel/cpu/sh5/entry.S
@@ -2,7 +2,7 @@
2 * arch/sh/kernel/cpu/sh5/entry.S 2 * arch/sh/kernel/cpu/sh5/entry.S
3 * 3 *
4 * Copyright (C) 2000, 2001 Paolo Alberelli 4 * Copyright (C) 2000, 2001 Paolo Alberelli
5 * Copyright (C) 2004 - 2007 Paul Mundt 5 * Copyright (C) 2004 - 2008 Paul Mundt
6 * Copyright (C) 2003, 2004 Richard Curnow 6 * Copyright (C) 2003, 2004 Richard Curnow
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
@@ -923,6 +923,8 @@ ret_from_exception:
923 blink tr0, ZERO 923 blink tr0, ZERO
924 924
925resume_kernel: 925resume_kernel:
926 CLI()
927
926 pta restore_all, tr0 928 pta restore_all, tr0
927 929
928 getcon KCR0, r6 930 getcon KCR0, r6
@@ -939,19 +941,11 @@ need_resched:
939 andi r7, 0xf0, r7 941 andi r7, 0xf0, r7
940 bne r7, ZERO, tr0 942 bne r7, ZERO, tr0
941 943
942 movi ((PREEMPT_ACTIVE >> 16) & 65535), r8 944 movi preempt_schedule_irq, r7
943 shori (PREEMPT_ACTIVE & 65535), r8
944 st.l r6, TI_PRE_COUNT, r8
945
946 STI()
947 movi schedule, r7
948 ori r7, 1, r7 945 ori r7, 1, r7
949 ptabs r7, tr1 946 ptabs r7, tr1
950 blink tr1, LINK 947 blink tr1, LINK
951 948
952 st.l r6, TI_PRE_COUNT, ZERO
953 CLI()
954
955 pta need_resched, tr1 949 pta need_resched, tr1
956 blink tr1, ZERO 950 blink tr1, ZERO
957#endif 951#endif
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index 0bc17def55a7..efbb4268875e 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -92,6 +92,7 @@ ENTRY(ret_from_irq)
92 bra resume_userspace 92 bra resume_userspace
93 nop 93 nop
94ENTRY(resume_kernel) 94ENTRY(resume_kernel)
95 cli
95 mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count 96 mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count
96 tst r0, r0 97 tst r0, r0
97 bf noresched 98 bf noresched
@@ -105,28 +106,9 @@ need_resched:
105 and #0xf0, r0 ! interrupts off (exception path)? 106 and #0xf0, r0 ! interrupts off (exception path)?
106 cmp/eq #0xf0, r0 107 cmp/eq #0xf0, r0
107 bt noresched 108 bt noresched
108
109 mov.l 1f, r0
110 mov.l r0, @(TI_PRE_COUNT,r8)
111
112#ifdef CONFIG_TRACE_IRQFLAGS
113 mov.l 3f, r0 109 mov.l 3f, r0
114 jsr @r0 110 jsr @r0 ! call preempt_schedule_irq
115 nop
116#endif
117 sti
118 mov.l 2f, r0
119 jsr @r0
120 nop
121 mov #0, r0
122 mov.l r0, @(TI_PRE_COUNT,r8)
123 cli
124#ifdef CONFIG_TRACE_IRQFLAGS
125 mov.l 4f, r0
126 jsr @r0
127 nop 111 nop
128#endif
129
130 bra need_resched 112 bra need_resched
131 nop 113 nop
132 114
@@ -137,10 +119,7 @@ noresched:
137 .align 2 119 .align 2
1381: .long PREEMPT_ACTIVE 1201: .long PREEMPT_ACTIVE
1392: .long schedule 1212: .long schedule
140#ifdef CONFIG_TRACE_IRQFLAGS 1223: .long preempt_schedule_irq
1413: .long trace_hardirqs_on
1424: .long trace_hardirqs_off
143#endif
144#endif 123#endif
145 124
146ENTRY(resume_userspace) 125ENTRY(resume_userspace)
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
index 4703dff174d5..94df56b0d1f6 100644
--- a/arch/sh/kernel/machine_kexec.c
+++ b/arch/sh/kernel/machine_kexec.c
@@ -102,7 +102,7 @@ void machine_kexec(struct kimage *image)
102 102
103 /* now call it */ 103 /* now call it */
104 rnk = (relocate_new_kernel_t) reboot_code_buffer; 104 rnk = (relocate_new_kernel_t) reboot_code_buffer;
105 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg); 105 (*rnk)(page_list, reboot_code_buffer, P2SEGADDR(image->start), vbr_reg);
106} 106}
107 107
108void arch_crash_save_vmcoreinfo(void) 108void arch_crash_save_vmcoreinfo(void)
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 5922edd416db..9c6424892bd3 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -131,6 +131,8 @@ void user_enable_single_step(struct task_struct *child)
131 131
132void user_disable_single_step(struct task_struct *child) 132void user_disable_single_step(struct task_struct *child)
133{ 133{
134 struct pt_regs *regs = child->thread.uregs;
135
134 regs->sr &= ~SR_SSTEP; 136 regs->sr &= ~SR_SSTEP;
135} 137}
136 138
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index a35207655e7b..de832056bf1b 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -171,6 +171,7 @@ static void __init reserve_crashkernel(void)
171 (unsigned long)(free_mem >> 20)); 171 (unsigned long)(free_mem >> 20));
172 crashk_res.start = crash_base; 172 crashk_res.start = crash_base;
173 crashk_res.end = crash_base + crash_size - 1; 173 crashk_res.end = crash_base + crash_size - 1;
174 insert_resource(&iomem_resource, &crashk_res);
174 } 175 }
175} 176}
176#else 177#else
@@ -204,11 +205,6 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
204 request_resource(res, &data_resource); 205 request_resource(res, &data_resource);
205 request_resource(res, &bss_resource); 206 request_resource(res, &bss_resource);
206 207
207#ifdef CONFIG_KEXEC
208 if (crashk_res.start != crashk_res.end)
209 request_resource(res, &crashk_res);
210#endif
211
212 add_active_range(nid, start_pfn, end_pfn); 208 add_active_range(nid, start_pfn, end_pfn);
213} 209}
214 210
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 59cd2859ce9b..9061b86d73fa 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -170,7 +170,7 @@ asmlinkage int sys_ipc(uint call, int first, int second,
170 version = call >> 16; /* hack for backward compatibility */ 170 version = call >> 16; /* hack for backward compatibility */
171 call &= 0xffff; 171 call &= 0xffff;
172 172
173 if (call <= SEMCTL) 173 if (call <= SEMTIMEDOP)
174 switch (call) { 174 switch (call) {
175 case SEMOP: 175 case SEMOP:
176 return sys_semtimedop(first, 176 return sys_semtimedop(first,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 895bb3f335c7..64b8f7f96f9a 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -101,7 +101,7 @@ static int __init memchunk_setup(char *str)
101} 101}
102__setup("memchunk.", memchunk_setup); 102__setup("memchunk.", memchunk_setup);
103 103
104static void memchunk_cmdline_override(char *name, unsigned long *sizep) 104static void __init memchunk_cmdline_override(char *name, unsigned long *sizep)
105{ 105{
106 char *p = boot_command_line; 106 char *p = boot_command_line;
107 int k = strlen(name); 107 int k = strlen(name);
@@ -118,8 +118,8 @@ static void memchunk_cmdline_override(char *name, unsigned long *sizep)
118 } 118 }
119} 119}
120 120
121int platform_resource_setup_memory(struct platform_device *pdev, 121int __init platform_resource_setup_memory(struct platform_device *pdev,
122 char *name, unsigned long memsize) 122 char *name, unsigned long memsize)
123{ 123{
124 struct resource *r; 124 struct resource *r;
125 dma_addr_t dma_handle; 125 dma_addr_t dma_handle;
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 840e634fa31f..640cbb237328 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -31,13 +31,84 @@
31#include <linux/clk.h> 31#include <linux/clk.h>
32#include <linux/io.h> 32#include <linux/io.h>
33 33
34/* Transmit operation: */
35/* */
36/* 0 byte transmit */
37/* BUS: S A8 ACK P */
38/* IRQ: DTE WAIT */
39/* ICIC: */
40/* ICCR: 0x94 0x90 */
41/* ICDR: A8 */
42/* */
43/* 1 byte transmit */
44/* BUS: S A8 ACK D8(1) ACK P */
45/* IRQ: DTE WAIT WAIT */
46/* ICIC: -DTE */
47/* ICCR: 0x94 0x90 */
48/* ICDR: A8 D8(1) */
49/* */
50/* 2 byte transmit */
51/* BUS: S A8 ACK D8(1) ACK D8(2) ACK P */
52/* IRQ: DTE WAIT WAIT WAIT */
53/* ICIC: -DTE */
54/* ICCR: 0x94 0x90 */
55/* ICDR: A8 D8(1) D8(2) */
56/* */
57/* 3 bytes or more, +---------+ gets repeated */
58/* */
59/* */
60/* Receive operation: */
61/* */
62/* 0 byte receive - not supported since slave may hold SDA low */
63/* */
64/* 1 byte receive [TX] | [RX] */
65/* BUS: S A8 ACK | D8(1) ACK P */
66/* IRQ: DTE WAIT | WAIT DTE */
67/* ICIC: -DTE | +DTE */
68/* ICCR: 0x94 0x81 | 0xc0 */
69/* ICDR: A8 | D8(1) */
70/* */
71/* 2 byte receive [TX]| [RX] */
72/* BUS: S A8 ACK | D8(1) ACK D8(2) ACK P */
73/* IRQ: DTE WAIT | WAIT WAIT DTE */
74/* ICIC: -DTE | +DTE */
75/* ICCR: 0x94 0x81 | 0xc0 */
76/* ICDR: A8 | D8(1) D8(2) */
77/* */
78/* 3 byte receive [TX] | [RX] */
79/* BUS: S A8 ACK | D8(1) ACK D8(2) ACK D8(3) ACK P */
80/* IRQ: DTE WAIT | WAIT WAIT WAIT DTE */
81/* ICIC: -DTE | +DTE */
82/* ICCR: 0x94 0x81 | 0xc0 */
83/* ICDR: A8 | D8(1) D8(2) D8(3) */
84/* */
85/* 4 bytes or more, this part is repeated +---------+ */
86/* */
87/* */
88/* Interrupt order and BUSY flag */
89/* ___ _ */
90/* SDA ___\___XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAAAAAAAAA___/ */
91/* SCL \_/1\_/2\_/3\_/4\_/5\_/6\_/7\_/8\___/9\_____/ */
92/* */
93/* S D7 D6 D5 D4 D3 D2 D1 D0 P */
94/* ___ */
95/* WAIT IRQ ________________________________/ \___________ */
96/* TACK IRQ ____________________________________/ \_______ */
97/* DTE IRQ __________________________________________/ \_ */
98/* AL IRQ XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
99/* _______________________________________________ */
100/* BUSY __/ \_ */
101/* */
102
34enum sh_mobile_i2c_op { 103enum sh_mobile_i2c_op {
35 OP_START = 0, 104 OP_START = 0,
36 OP_TX_ONLY, 105 OP_TX_FIRST,
106 OP_TX,
37 OP_TX_STOP, 107 OP_TX_STOP,
38 OP_TX_TO_RX, 108 OP_TX_TO_RX,
39 OP_RX_ONLY, 109 OP_RX,
40 OP_RX_STOP, 110 OP_RX_STOP,
111 OP_RX_STOP_DATA,
41}; 112};
42 113
43struct sh_mobile_i2c_data { 114struct sh_mobile_i2c_data {
@@ -127,25 +198,34 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
127 spin_lock_irqsave(&pd->lock, flags); 198 spin_lock_irqsave(&pd->lock, flags);
128 199
129 switch (op) { 200 switch (op) {
130 case OP_START: 201 case OP_START: /* issue start and trigger DTE interrupt */
131 iowrite8(0x94, ICCR(pd)); 202 iowrite8(0x94, ICCR(pd));
132 break; 203 break;
133 case OP_TX_ONLY: 204 case OP_TX_FIRST: /* disable DTE interrupt and write data */
205 iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE, ICIC(pd));
134 iowrite8(data, ICDR(pd)); 206 iowrite8(data, ICDR(pd));
135 break; 207 break;
136 case OP_TX_STOP: 208 case OP_TX: /* write data */
137 iowrite8(data, ICDR(pd)); 209 iowrite8(data, ICDR(pd));
138 iowrite8(0x90, ICCR(pd));
139 iowrite8(ICIC_ALE | ICIC_TACKE, ICIC(pd));
140 break; 210 break;
141 case OP_TX_TO_RX: 211 case OP_TX_STOP: /* write data and issue a stop afterwards */
142 iowrite8(data, ICDR(pd)); 212 iowrite8(data, ICDR(pd));
213 iowrite8(0x90, ICCR(pd));
214 break;
215 case OP_TX_TO_RX: /* select read mode */
143 iowrite8(0x81, ICCR(pd)); 216 iowrite8(0x81, ICCR(pd));
144 break; 217 break;
145 case OP_RX_ONLY: 218 case OP_RX: /* just read data */
146 ret = ioread8(ICDR(pd)); 219 ret = ioread8(ICDR(pd));
147 break; 220 break;
148 case OP_RX_STOP: 221 case OP_RX_STOP: /* enable DTE interrupt, issue stop */
222 iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
223 ICIC(pd));
224 iowrite8(0xc0, ICCR(pd));
225 break;
226 case OP_RX_STOP_DATA: /* enable DTE interrupt, read data, issue stop */
227 iowrite8(ICIC_DTEE | ICIC_WAITE | ICIC_ALE | ICIC_TACKE,
228 ICIC(pd));
149 ret = ioread8(ICDR(pd)); 229 ret = ioread8(ICDR(pd));
150 iowrite8(0xc0, ICCR(pd)); 230 iowrite8(0xc0, ICCR(pd));
151 break; 231 break;
@@ -157,58 +237,120 @@ static unsigned char i2c_op(struct sh_mobile_i2c_data *pd,
157 return ret; 237 return ret;
158} 238}
159 239
240static int sh_mobile_i2c_is_first_byte(struct sh_mobile_i2c_data *pd)
241{
242 if (pd->pos == -1)
243 return 1;
244
245 return 0;
246}
247
248static int sh_mobile_i2c_is_last_byte(struct sh_mobile_i2c_data *pd)
249{
250 if (pd->pos == (pd->msg->len - 1))
251 return 1;
252
253 return 0;
254}
255
256static void sh_mobile_i2c_get_data(struct sh_mobile_i2c_data *pd,
257 unsigned char *buf)
258{
259 switch (pd->pos) {
260 case -1:
261 *buf = (pd->msg->addr & 0x7f) << 1;
262 *buf |= (pd->msg->flags & I2C_M_RD) ? 1 : 0;
263 break;
264 default:
265 *buf = pd->msg->buf[pd->pos];
266 }
267}
268
269static int sh_mobile_i2c_isr_tx(struct sh_mobile_i2c_data *pd)
270{
271 unsigned char data;
272
273 if (pd->pos == pd->msg->len)
274 return 1;
275
276 sh_mobile_i2c_get_data(pd, &data);
277
278 if (sh_mobile_i2c_is_last_byte(pd))
279 i2c_op(pd, OP_TX_STOP, data);
280 else if (sh_mobile_i2c_is_first_byte(pd))
281 i2c_op(pd, OP_TX_FIRST, data);
282 else
283 i2c_op(pd, OP_TX, data);
284
285 pd->pos++;
286 return 0;
287}
288
289static int sh_mobile_i2c_isr_rx(struct sh_mobile_i2c_data *pd)
290{
291 unsigned char data;
292 int real_pos;
293
294 do {
295 if (pd->pos <= -1) {
296 sh_mobile_i2c_get_data(pd, &data);
297
298 if (sh_mobile_i2c_is_first_byte(pd))
299 i2c_op(pd, OP_TX_FIRST, data);
300 else
301 i2c_op(pd, OP_TX, data);
302 break;
303 }
304
305 if (pd->pos == 0) {
306 i2c_op(pd, OP_TX_TO_RX, 0);
307 break;
308 }
309
310 real_pos = pd->pos - 2;
311
312 if (pd->pos == pd->msg->len) {
313 if (real_pos < 0) {
314 i2c_op(pd, OP_RX_STOP, 0);
315 break;
316 }
317 data = i2c_op(pd, OP_RX_STOP_DATA, 0);
318 } else
319 data = i2c_op(pd, OP_RX, 0);
320
321 pd->msg->buf[real_pos] = data;
322 } while (0);
323
324 pd->pos++;
325 return pd->pos == (pd->msg->len + 2);
326}
327
160static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id) 328static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
161{ 329{
162 struct platform_device *dev = dev_id; 330 struct platform_device *dev = dev_id;
163 struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev); 331 struct sh_mobile_i2c_data *pd = platform_get_drvdata(dev);
164 struct i2c_msg *msg = pd->msg; 332 unsigned char sr;
165 unsigned char data, sr; 333 int wakeup;
166 int wakeup = 0;
167 334
168 sr = ioread8(ICSR(pd)); 335 sr = ioread8(ICSR(pd));
169 pd->sr |= sr; 336 pd->sr |= sr; /* remember state */
170 337
171 dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr, 338 dev_dbg(pd->dev, "i2c_isr 0x%02x 0x%02x %s %d %d!\n", sr, pd->sr,
172 (msg->flags & I2C_M_RD) ? "read" : "write", 339 (pd->msg->flags & I2C_M_RD) ? "read" : "write",
173 pd->pos, msg->len); 340 pd->pos, pd->msg->len);
174 341
175 if (sr & (ICSR_AL | ICSR_TACK)) { 342 if (sr & (ICSR_AL | ICSR_TACK)) {
176 iowrite8(0, ICIC(pd)); /* disable interrupts */ 343 /* don't interrupt transaction - continue to issue stop */
177 wakeup = 1; 344 iowrite8(sr & ~(ICSR_AL | ICSR_TACK), ICSR(pd));
178 goto do_wakeup; 345 wakeup = 0;
179 } 346 } else if (pd->msg->flags & I2C_M_RD)
347 wakeup = sh_mobile_i2c_isr_rx(pd);
348 else
349 wakeup = sh_mobile_i2c_isr_tx(pd);
180 350
181 if (pd->pos == msg->len) { 351 if (sr & ICSR_WAIT) /* TODO: add delay here to support slow acks */
182 i2c_op(pd, OP_RX_ONLY, 0); 352 iowrite8(sr & ~ICSR_WAIT, ICSR(pd));
183 wakeup = 1;
184 goto do_wakeup;
185 }
186 353
187 if (pd->pos == -1) {
188 data = (msg->addr & 0x7f) << 1;
189 data |= (msg->flags & I2C_M_RD) ? 1 : 0;
190 } else
191 data = msg->buf[pd->pos];
192
193 if ((pd->pos == -1) || !(msg->flags & I2C_M_RD)) {
194 if (msg->flags & I2C_M_RD)
195 i2c_op(pd, OP_TX_TO_RX, data);
196 else if (pd->pos == (msg->len - 1)) {
197 i2c_op(pd, OP_TX_STOP, data);
198 wakeup = 1;
199 } else
200 i2c_op(pd, OP_TX_ONLY, data);
201 } else {
202 if (pd->pos == (msg->len - 1))
203 data = i2c_op(pd, OP_RX_STOP, 0);
204 else
205 data = i2c_op(pd, OP_RX_ONLY, 0);
206
207 msg->buf[pd->pos] = data;
208 }
209 pd->pos++;
210
211 do_wakeup:
212 if (wakeup) { 354 if (wakeup) {
213 pd->sr |= SW_DONE; 355 pd->sr |= SW_DONE;
214 wake_up(&pd->wait); 356 wake_up(&pd->wait);
@@ -219,6 +361,11 @@ static irqreturn_t sh_mobile_i2c_isr(int irq, void *dev_id)
219 361
220static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg) 362static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg)
221{ 363{
364 if (usr_msg->len == 0 && (usr_msg->flags & I2C_M_RD)) {
365 dev_err(pd->dev, "Unsupported zero length i2c read\n");
366 return -EIO;
367 }
368
222 /* Initialize channel registers */ 369 /* Initialize channel registers */
223 iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd)); 370 iowrite8(ioread8(ICCR(pd)) & ~ICCR_ICE, ICCR(pd));
224 371
@@ -233,9 +380,8 @@ static int start_ch(struct sh_mobile_i2c_data *pd, struct i2c_msg *usr_msg)
233 pd->pos = -1; 380 pd->pos = -1;
234 pd->sr = 0; 381 pd->sr = 0;
235 382
236 /* Enable all interrupts except wait */ 383 /* Enable all interrupts to begin with */
237 iowrite8(ioread8(ICIC(pd)) | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, 384 iowrite8(ICIC_WAITE | ICIC_ALE | ICIC_TACKE | ICIC_DTEE, ICIC(pd));
238 ICIC(pd));
239 return 0; 385 return 0;
240} 386}
241 387
@@ -268,25 +414,18 @@ static int sh_mobile_i2c_xfer(struct i2c_adapter *adapter,
268 if (!k) 414 if (!k)
269 dev_err(pd->dev, "Transfer request timed out\n"); 415 dev_err(pd->dev, "Transfer request timed out\n");
270 416
271 retry_count = 10; 417 retry_count = 1000;
272again: 418again:
273 val = ioread8(ICSR(pd)); 419 val = ioread8(ICSR(pd));
274 420
275 dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr); 421 dev_dbg(pd->dev, "val 0x%02x pd->sr 0x%02x\n", val, pd->sr);
276 422
277 if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) {
278 err = -EIO;
279 break;
280 }
281
282 /* the interrupt handler may wake us up before the 423 /* the interrupt handler may wake us up before the
283 * transfer is finished, so poll the hardware 424 * transfer is finished, so poll the hardware
284 * until we're done. 425 * until we're done.
285 */ 426 */
286 427 if (val & ICSR_BUSY) {
287 if (!(!(val & ICSR_BUSY) && (val & ICSR_SCLM) && 428 udelay(10);
288 (val & ICSR_SDAM))) {
289 msleep(1);
290 if (retry_count--) 429 if (retry_count--)
291 goto again; 430 goto again;
292 431
@@ -294,6 +433,12 @@ again:
294 dev_err(pd->dev, "Polling timed out\n"); 433 dev_err(pd->dev, "Polling timed out\n");
295 break; 434 break;
296 } 435 }
436
437 /* handle missing acknowledge and arbitration lost */
438 if ((val | pd->sr) & (ICSR_TACK | ICSR_AL)) {
439 err = -EIO;
440 break;
441 }
297 } 442 }
298 443
299 deactivate_ch(pd); 444 deactivate_ch(pd);