aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 12:43:09 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-18 12:43:09 -0400
commit515b696b282f856c3ad1679ccd658120faa387d0 (patch)
treed9d7c1185c396617f128ca23463062308d11393b /arch/sh
parentfa877c71e2136bd682b45022c96d5e073ced9f58 (diff)
parent064a16dc41be879d12bd5de5d2f9d38d890e0ee7 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (262 commits) sh: mach-ecovec24: Add user debug switch support sh: Kill off unused se_skipped in alignment trap notification code. sh: Wire up HAVE_SYSCALL_TRACEPOINTS. video: sh_mobile_lcdcfb: use both register sets for display panning video: sh_mobile_lcdcfb: implement display panning sh: Fix up sh7705 flush_dcache_page() build. sh: kfr2r09: document the PLL/FLL <-> RF relationship. sh: mach-ecovec24: need asm/clock.h. sh: mach-ecovec24: deassert usb irq on boot. sh: Add KEYSC support for EcoVec24 sh: add kycr2_delay for sh_keysc sh: cpufreq: Include CPU id in info messages. sh: multi-evt support for SH-X3 proto CPU. sh: clkfwk: remove bogus set_bus_parent() from SH7709. sh: Fix the indication point of the liquid crystal of AP-325RXA(AP3300) sh: Add EcoVec24 romImage defconfig sh: USB disable process is needed if romImage boot for EcoVec24 sh: EcoVec24: add HIZA setting for LED sh: EcoVec24: write MAC address in boot sh: Add romImage support for EcoVec24 ...
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig44
-rw-r--r--arch/sh/Kconfig.debug23
-rw-r--r--arch/sh/Makefile26
-rw-r--r--arch/sh/boards/Kconfig22
-rw-r--r--arch/sh/boards/board-ap325rxa.c10
-rw-r--r--arch/sh/boards/board-sh7785lcr.c18
-rw-r--r--arch/sh/boards/mach-ecovec24/Makefile9
-rw-r--r--arch/sh/boards/mach-ecovec24/setup.c670
-rw-r--r--arch/sh/boards/mach-highlander/setup.c7
-rw-r--r--arch/sh/boards/mach-kfr2r09/Makefile2
-rw-r--r--arch/sh/boards/mach-kfr2r09/lcd_wqvga.c332
-rw-r--r--arch/sh/boards/mach-kfr2r09/setup.c386
-rw-r--r--arch/sh/boards/mach-migor/setup.c11
-rw-r--r--arch/sh/boards/mach-se/7722/setup.c4
-rw-r--r--arch/sh/boards/mach-se/7724/setup.c110
-rw-r--r--arch/sh/boards/mach-x3proto/setup.c7
-rw-r--r--arch/sh/boot/.gitignore5
-rw-r--r--arch/sh/boot/Makefile48
-rw-r--r--arch/sh/boot/compressed/.gitignore1
-rw-r--r--arch/sh/boot/compressed/Makefile21
-rw-r--r--arch/sh/boot/compressed/head_32.S2
-rw-r--r--arch/sh/boot/compressed/misc.c149
-rw-r--r--arch/sh/boot/compressed/misc_32.c206
-rw-r--r--arch/sh/boot/compressed/misc_64.c210
-rw-r--r--arch/sh/boot/compressed/piggy.S8
-rw-r--r--arch/sh/boot/compressed/vmlinux.scr10
-rw-r--r--arch/sh/boot/romimage/Makefile19
-rw-r--r--arch/sh/boot/romimage/head.S10
-rw-r--r--arch/sh/boot/romimage/vmlinux.scr6
-rw-r--r--arch/sh/configs/ecovec24-romimage_defconfig1032
-rw-r--r--arch/sh/configs/ecovec24_defconfig1558
-rw-r--r--arch/sh/configs/kfr2r09-romimage_defconfig774
-rw-r--r--arch/sh/configs/kfr2r09_defconfig1059
-rw-r--r--arch/sh/configs/snapgear_defconfig77
-rw-r--r--arch/sh/drivers/dma/Kconfig6
-rw-r--r--arch/sh/drivers/heartbeat.c10
-rw-r--r--arch/sh/drivers/pci/pci.c4
-rw-r--r--arch/sh/include/asm/Kbuild2
-rw-r--r--arch/sh/include/asm/bug.h31
-rw-r--r--arch/sh/include/asm/bugs.h24
-rw-r--r--arch/sh/include/asm/cachectl.h19
-rw-r--r--arch/sh/include/asm/cacheflush.h114
-rw-r--r--arch/sh/include/asm/device.h16
-rw-r--r--arch/sh/include/asm/dma-sh.h1
-rw-r--r--arch/sh/include/asm/dwarf.h398
-rw-r--r--arch/sh/include/asm/entry-macros.S86
-rw-r--r--arch/sh/include/asm/ftrace.h8
-rw-r--r--arch/sh/include/asm/hardirq.h13
-rw-r--r--arch/sh/include/asm/heartbeat.h1
-rw-r--r--arch/sh/include/asm/hwblk.h72
-rw-r--r--arch/sh/include/asm/io.h16
-rw-r--r--arch/sh/include/asm/kdebug.h1
-rw-r--r--arch/sh/include/asm/kgdb.h3
-rw-r--r--arch/sh/include/asm/lmb.h6
-rw-r--r--arch/sh/include/asm/mmu_context.h2
-rw-r--r--arch/sh/include/asm/page.h24
-rw-r--r--arch/sh/include/asm/pgtable.h34
-rw-r--r--arch/sh/include/asm/pgtable_32.h30
-rw-r--r--arch/sh/include/asm/pgtable_64.h5
-rw-r--r--arch/sh/include/asm/processor.h15
-rw-r--r--arch/sh/include/asm/romimage-macros.h73
-rw-r--r--arch/sh/include/asm/sections.h1
-rw-r--r--arch/sh/include/asm/sh_keysc.h1
-rw-r--r--arch/sh/include/asm/stacktrace.h25
-rw-r--r--arch/sh/include/asm/suspend.h9
-rw-r--r--arch/sh/include/asm/syscall_32.h1
-rw-r--r--arch/sh/include/asm/system.h19
-rw-r--r--arch/sh/include/asm/system_32.h43
-rw-r--r--arch/sh/include/asm/system_64.h10
-rw-r--r--arch/sh/include/asm/thread_info.h11
-rw-r--r--arch/sh/include/asm/types.h2
-rw-r--r--arch/sh/include/asm/unistd_32.h2
-rw-r--r--arch/sh/include/asm/unistd_64.h2
-rw-r--r--arch/sh/include/asm/unwinder.h31
-rw-r--r--arch/sh/include/asm/vmlinux.lds.h17
-rw-r--r--arch/sh/include/asm/watchdog.h19
-rw-r--r--arch/sh/include/cpu-common/cpu/cacheflush.h44
-rw-r--r--arch/sh/include/cpu-sh2a/cpu/cacheflush.h34
-rw-r--r--arch/sh/include/cpu-sh3/cpu/cacheflush.h46
-rw-r--r--arch/sh/include/cpu-sh4/cpu/cacheflush.h43
-rw-r--r--arch/sh/include/cpu-sh4/cpu/dma-sh4a.h3
-rw-r--r--arch/sh/include/cpu-sh4/cpu/freq.h4
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7722.h14
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7723.h17
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7724.h17
-rw-r--r--arch/sh/include/cpu-sh4/cpu/sh7757.h243
-rw-r--r--arch/sh/include/cpu-sh5/cpu/cacheflush.h33
-rw-r--r--arch/sh/include/mach-common/mach/migor.h64
-rw-r--r--arch/sh/include/mach-common/mach/romimage.h1
-rw-r--r--arch/sh/include/mach-common/mach/sh7785lcr.h2
-rw-r--r--arch/sh/include/mach-ecovec24/mach/partner-jet-setup.txt82
-rw-r--r--arch/sh/include/mach-ecovec24/mach/romimage.h20
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/kfr2r09.h21
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt143
-rw-r--r--arch/sh/include/mach-kfr2r09/mach/romimage.h20
-rw-r--r--arch/sh/include/mach-migor/mach/migor.h14
-rw-r--r--arch/sh/kernel/Makefile44
-rw-r--r--arch/sh/kernel/Makefile_3237
-rw-r--r--arch/sh/kernel/Makefile_6419
-rw-r--r--arch/sh/kernel/asm-offsets.c1
-rw-r--r--arch/sh/kernel/cpu/Makefile2
-rw-r--r--arch/sh/kernel/cpu/hwblk.c155
-rw-r--r--arch/sh/kernel/cpu/init.c36
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c1
-rw-r--r--arch/sh/kernel/cpu/sh2/entry.S3
-rw-r--r--arch/sh/kernel/cpu/sh2/probe.c1
-rw-r--r--arch/sh/kernel/cpu/sh2a/entry.S3
-rw-r--r--arch/sh/kernel/cpu/sh2a/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7709.c11
-rw-r--r--arch/sh/kernel/cpu/sh3/entry.S102
-rw-r--r--arch/sh/kernel/cpu/sh3/ex.S4
-rw-r--r--arch/sh/kernel/cpu/sh3/probe.c2
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c21
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile9
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7722.c63
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7723.c113
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7724.c124
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh7757.c130
-rw-r--r--arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c106
-rw-r--r--arch/sh/kernel/cpu/sh4a/hwblk-sh7723.c117
-rw-r--r--arch/sh/kernel/cpu/sh4a/hwblk-sh7724.c121
-rw-r--r--arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c2019
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7366.c2
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7722.c39
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7723.c42
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7724.c43
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh7757.c513
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-shx3.c55
-rw-r--r--arch/sh/kernel/cpu/sh4a/smp-shx3.c2
-rw-r--r--arch/sh/kernel/cpu/sh5/probe.c2
-rw-r--r--arch/sh/kernel/cpu/shmobile/Makefile2
-rw-r--r--arch/sh/kernel/cpu/shmobile/cpuidle.c113
-rw-r--r--arch/sh/kernel/cpu/shmobile/pm.c42
-rw-r--r--arch/sh/kernel/cpu/shmobile/pm_runtime.c303
-rw-r--r--arch/sh/kernel/cpu/shmobile/sleep.S155
-rw-r--r--arch/sh/kernel/cpufreq.c10
-rw-r--r--arch/sh/kernel/dumpstack.c123
-rw-r--r--arch/sh/kernel/dwarf.c972
-rw-r--r--arch/sh/kernel/early_printk.c5
-rw-r--r--arch/sh/kernel/entry-common.S103
-rw-r--r--arch/sh/kernel/ftrace.c188
-rw-r--r--arch/sh/kernel/io.c97
-rw-r--r--arch/sh/kernel/io_generic.c50
-rw-r--r--arch/sh/kernel/io_trapped.c10
-rw-r--r--arch/sh/kernel/irq.c19
-rw-r--r--arch/sh/kernel/kgdb.c4
-rw-r--r--arch/sh/kernel/localtimer.c9
-rw-r--r--arch/sh/kernel/nmi_debug.c77
-rw-r--r--arch/sh/kernel/process_32.c25
-rw-r--r--arch/sh/kernel/process_64.c24
-rw-r--r--arch/sh/kernel/ptrace_32.c9
-rw-r--r--arch/sh/kernel/ptrace_64.c9
-rw-r--r--arch/sh/kernel/setup.c80
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c10
-rw-r--r--arch/sh/kernel/sh_ksyms_64.c9
-rw-r--r--arch/sh/kernel/signal_32.c12
-rw-r--r--arch/sh/kernel/signal_64.c38
-rw-r--r--arch/sh/kernel/stacktrace.c98
-rw-r--r--arch/sh/kernel/sys_sh.c43
-rw-r--r--arch/sh/kernel/syscalls_32.S2
-rw-r--r--arch/sh/kernel/syscalls_64.S2
-rw-r--r--arch/sh/kernel/time.c31
-rw-r--r--arch/sh/kernel/traps.c45
-rw-r--r--arch/sh/kernel/traps_32.c218
-rw-r--r--arch/sh/kernel/unwinder.c164
-rw-r--r--arch/sh/kernel/vmlinux.lds.S94
-rw-r--r--arch/sh/lib/Makefile4
-rw-r--r--arch/sh/lib/__clear_user.S (renamed from arch/sh/lib/clear_page.S)48
-rw-r--r--arch/sh/lib/copy_page.S11
-rw-r--r--arch/sh/lib/delay.c5
-rw-r--r--arch/sh/lib/mcount.S228
-rw-r--r--arch/sh/lib64/Makefile2
-rw-r--r--arch/sh/lib64/clear_page.S54
-rw-r--r--arch/sh/mm/Kconfig7
-rw-r--r--arch/sh/mm/Makefile68
-rw-r--r--arch/sh/mm/Makefile_3243
-rw-r--r--arch/sh/mm/Makefile_6446
-rw-r--r--arch/sh/mm/cache-sh2.c13
-rw-r--r--arch/sh/mm/cache-sh2a.c23
-rw-r--r--arch/sh/mm/cache-sh3.c25
-rw-r--r--arch/sh/mm/cache-sh4.c362
-rw-r--r--arch/sh/mm/cache-sh5.c307
-rw-r--r--arch/sh/mm/cache-sh7705.c72
-rw-r--r--arch/sh/mm/cache.c316
-rw-r--r--arch/sh/mm/fault_32.c196
-rw-r--r--arch/sh/mm/fault_64.c11
-rw-r--r--arch/sh/mm/flush-sh4.c108
-rw-r--r--arch/sh/mm/init.c50
-rw-r--r--arch/sh/mm/ioremap_32.c8
-rw-r--r--arch/sh/mm/ioremap_64.c6
-rw-r--r--arch/sh/mm/kmap.c65
-rw-r--r--arch/sh/mm/mmap.c2
-rw-r--r--arch/sh/mm/nommu.c (renamed from arch/sh/mm/tlb-nommu.c)44
-rw-r--r--arch/sh/mm/numa.c36
-rw-r--r--arch/sh/mm/pg-nommu.c38
-rw-r--r--arch/sh/mm/pg-sh4.c146
-rw-r--r--arch/sh/mm/pg-sh7705.c138
-rw-r--r--arch/sh/mm/tlb-pteaex.c28
-rw-r--r--arch/sh/mm/tlb-sh3.c27
-rw-r--r--arch/sh/mm/tlb-sh4.c37
-rw-r--r--arch/sh/mm/tlb-sh5.c21
-rw-r--r--arch/sh/mm/tlbflush_64.c22
-rw-r--r--arch/sh/oprofile/backtrace.c84
-rw-r--r--arch/sh/tools/mach-types3
204 files changed, 15741 insertions, 3050 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index e2bdd7b94fd..4df3570fe51 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -10,12 +10,17 @@ config SUPERH
10 select EMBEDDED 10 select EMBEDDED
11 select HAVE_CLK 11 select HAVE_CLK
12 select HAVE_IDE 12 select HAVE_IDE
13 select HAVE_LMB
13 select HAVE_OPROFILE 14 select HAVE_OPROFILE
14 select HAVE_GENERIC_DMA_COHERENT 15 select HAVE_GENERIC_DMA_COHERENT
15 select HAVE_IOREMAP_PROT if MMU 16 select HAVE_IOREMAP_PROT if MMU
16 select HAVE_ARCH_TRACEHOOK 17 select HAVE_ARCH_TRACEHOOK
17 select HAVE_DMA_API_DEBUG 18 select HAVE_DMA_API_DEBUG
18 select HAVE_PERF_COUNTERS 19 select HAVE_PERF_COUNTERS
20 select HAVE_KERNEL_GZIP
21 select HAVE_KERNEL_BZIP2
22 select HAVE_KERNEL_LZMA
23 select HAVE_SYSCALL_TRACEPOINTS
19 select RTC_LIB 24 select RTC_LIB
20 select GENERIC_ATOMIC64 25 select GENERIC_ATOMIC64
21 help 26 help
@@ -31,6 +36,9 @@ config SUPERH32
31 select HAVE_FUNCTION_TRACER 36 select HAVE_FUNCTION_TRACER
32 select HAVE_FTRACE_MCOUNT_RECORD 37 select HAVE_FTRACE_MCOUNT_RECORD
33 select HAVE_DYNAMIC_FTRACE 38 select HAVE_DYNAMIC_FTRACE
39 select HAVE_FUNCTION_TRACE_MCOUNT_TEST
40 select HAVE_FTRACE_SYSCALLS
41 select HAVE_FUNCTION_GRAPH_TRACER
34 select HAVE_ARCH_KGDB 42 select HAVE_ARCH_KGDB
35 select ARCH_HIBERNATION_POSSIBLE if MMU 43 select ARCH_HIBERNATION_POSSIBLE if MMU
36 44
@@ -212,6 +220,8 @@ config CPU_SHX3
212config ARCH_SHMOBILE 220config ARCH_SHMOBILE
213 bool 221 bool
214 select ARCH_SUSPEND_POSSIBLE 222 select ARCH_SUSPEND_POSSIBLE
223 select PM
224 select PM_RUNTIME
215 225
216if SUPERH32 226if SUPERH32
217 227
@@ -389,6 +399,13 @@ config CPU_SUBTYPE_SH7724
389 help 399 help
390 Select SH7724 if you have an SH-MobileR2R CPU. 400 Select SH7724 if you have an SH-MobileR2R CPU.
391 401
402config CPU_SUBTYPE_SH7757
403 bool "Support SH7757 processor"
404 select CPU_SH4A
405 select CPU_SHX2
406 help
407 Select SH7757 if you have a SH4A SH7757 CPU.
408
392config CPU_SUBTYPE_SH7763 409config CPU_SUBTYPE_SH7763
393 bool "Support SH7763 processor" 410 bool "Support SH7763 processor"
394 select CPU_SH4A 411 select CPU_SH4A
@@ -751,12 +768,31 @@ config UBC_WAKEUP
751 768
752 If unsure, say N. 769 If unsure, say N.
753 770
754config CMDLINE_BOOL 771choice
755 bool "Default bootloader kernel arguments" 772 prompt "Kernel command line"
773 optional
774 default CMDLINE_OVERWRITE
775 help
776 Setting this option allows the kernel command line arguments
777 to be set.
778
779config CMDLINE_OVERWRITE
780 bool "Overwrite bootloader kernel arguments"
781 help
782 Given string will overwrite any arguments passed in by
783 a bootloader.
784
785config CMDLINE_EXTEND
786 bool "Extend bootloader kernel arguments"
787 help
788 Given string will be concatenated with arguments passed in
789 by a bootloader.
790
791endchoice
756 792
757config CMDLINE 793config CMDLINE
758 string "Initial kernel command string" 794 string "Kernel command line arguments string"
759 depends on CMDLINE_BOOL 795 depends on CMDLINE_OVERWRITE || CMDLINE_EXTEND
760 default "console=ttySC1,115200" 796 default "console=ttySC1,115200"
761 797
762endmenu 798endmenu
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 39224b57c6e..55907af1dc2 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -38,11 +38,13 @@ config EARLY_SCIF_CONSOLE_PORT
38 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 || \ 38 default "0xffe00000" if CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7763 || \
39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \ 39 CPU_SUBTYPE_SH7722 || CPU_SUBTYPE_SH7366 || \
40 CPU_SUBTYPE_SH7343 40 CPU_SUBTYPE_SH7343
41 default "0xffea0000" if CPU_SUBTYPE_SH7785 41 default "0xfe4c0000" if CPU_SUBTYPE_SH7757
42 default "0xffeb0000" if CPU_SUBTYPE_SH7785
42 default "0xffeb0000" if CPU_SUBTYPE_SH7786 43 default "0xffeb0000" if CPU_SUBTYPE_SH7786
43 default "0xfffe8000" if CPU_SUBTYPE_SH7203 44 default "0xfffe8000" if CPU_SUBTYPE_SH7203
44 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263 45 default "0xfffe9800" if CPU_SUBTYPE_SH7206 || CPU_SUBTYPE_SH7263
45 default "0xffe80000" if CPU_SH4 46 default "0xffe80000" if CPU_SH4
47 default "0xa4000150" if CPU_SH3
46 default "0x00000000" 48 default "0x00000000"
47 49
48config EARLY_PRINTK 50config EARLY_PRINTK
@@ -61,12 +63,14 @@ config EARLY_PRINTK
61 select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using 63 select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using
62 the kernel command line option to toggle back and forth. 64 the kernel command line option to toggle back and forth.
63 65
64config DEBUG_STACKOVERFLOW 66config STACK_DEBUG
65 bool "Check for stack overflows" 67 bool "Check for stack overflows"
66 depends on DEBUG_KERNEL && SUPERH32 68 depends on DEBUG_KERNEL && SUPERH32
67 help 69 help
68 This option will cause messages to be printed if free stack space 70 This option will cause messages to be printed if free stack space
69 drops below a certain limit. 71 drops below a certain limit. Saying Y here will add overhead to
72 every function call and will therefore incur a major
73 performance hit. Most users should say N.
70 74
71config DEBUG_STACK_USAGE 75config DEBUG_STACK_USAGE
72 bool "Stack utilization instrumentation" 76 bool "Stack utilization instrumentation"
@@ -107,6 +111,14 @@ config DUMP_CODE
107 111
108 Those looking for more verbose debugging output should say Y. 112 Those looking for more verbose debugging output should say Y.
109 113
114config DWARF_UNWINDER
115 bool "Enable the DWARF unwinder for stacktraces"
116 select FRAME_POINTER
117 default n
118 help
119 Enabling this option will make stacktraces more accurate, at
120 the cost of an increase in overall kernel size.
121
110config SH_NO_BSS_INIT 122config SH_NO_BSS_INIT
111 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)" 123 bool "Avoid zeroing BSS (to speed-up startup on suitable platforms)"
112 depends on DEBUG_KERNEL 124 depends on DEBUG_KERNEL
@@ -123,4 +135,9 @@ config SH64_SR_WATCH
123 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace" 135 bool "Debug: set SR.WATCH to enable hardware watchpoints and trace"
124 depends on SUPERH64 136 depends on SUPERH64
125 137
138config MCOUNT
139 def_bool y
140 depends on SUPERH32
141 depends on STACK_DEBUG || FUNCTION_TRACER
142
126endmenu 143endmenu
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 75d049b03f7..fc51a918b31 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -136,6 +136,8 @@ machdir-$(CONFIG_SH_7751_SYSTEMH) += mach-systemh
136machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705 136machdir-$(CONFIG_SH_EDOSK7705) += mach-edosk7705
137machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander 137machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
138machdir-$(CONFIG_SH_MIGOR) += mach-migor 138machdir-$(CONFIG_SH_MIGOR) += mach-migor
139machdir-$(CONFIG_SH_KFR2R09) += mach-kfr2r09
140machdir-$(CONFIG_SH_ECOVEC) += mach-ecovec24
139machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780 141machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780
140machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto 142machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto
141machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp 143machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp
@@ -186,17 +188,27 @@ KBUILD_CFLAGS += -pipe $(cflags-y)
186KBUILD_CPPFLAGS += $(cflags-y) 188KBUILD_CPPFLAGS += $(cflags-y)
187KBUILD_AFLAGS += $(cflags-y) 189KBUILD_AFLAGS += $(cflags-y)
188 190
191ifeq ($(CONFIG_MCOUNT),y)
192 KBUILD_CFLAGS += -pg
193endif
194
195ifeq ($(CONFIG_DWARF_UNWINDER),y)
196 KBUILD_CFLAGS += -fasynchronous-unwind-tables
197endif
198
189libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 199libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
190libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) 200libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
191 201
192PHONY += maketools FORCE 202BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec \
203 zImage vmlinux.srec romImage
204PHONY += maketools $(BOOT_TARGETS) FORCE
193 205
194maketools: include/linux/version.h FORCE 206maketools: include/linux/version.h FORCE
195 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h 207 $(Q)$(MAKE) $(build)=arch/sh/tools include/asm-sh/machtypes.h
196 208
197all: $(KBUILD_IMAGE) 209all: $(KBUILD_IMAGE)
198 210
199zImage uImage uImage.srec vmlinux.srec: vmlinux 211$(BOOT_TARGETS): vmlinux
200 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 212 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
201 213
202compressed: zImage 214compressed: zImage
@@ -208,10 +220,14 @@ archclean:
208 $(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall 220 $(Q)$(MAKE) $(clean)=arch/sh/kernel/vsyscall
209 221
210define archhelp 222define archhelp
211 @echo '* zImage - Compressed kernel image' 223 @echo ' zImage - Compressed kernel image'
224 @echo ' romImage - Compressed ROM image, if supported'
212 @echo ' vmlinux.srec - Create an ELF S-record' 225 @echo ' vmlinux.srec - Create an ELF S-record'
213 @echo ' uImage - Create a bootable image for U-Boot' 226 @echo '* uImage - Alias to bootable U-Boot image'
214 @echo ' uImage.srec - Create an S-record for U-Boot' 227 @echo ' uImage.srec - Create an S-record for U-Boot'
228 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)'
229 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)'
230 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)'
215endef 231endef
216 232
217CLEAN_FILES += include/asm-sh/machtypes.h 233CLEAN_FILES += include/asm-sh/machtypes.h
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 2b1af0eefa6..aedd9deb5de 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -160,7 +160,6 @@ config SH_SH7785LCR
160 bool "SH7785LCR" 160 bool "SH7785LCR"
161 depends on CPU_SUBTYPE_SH7785 161 depends on CPU_SUBTYPE_SH7785
162 select SYS_SUPPORTS_PCI 162 select SYS_SUPPORTS_PCI
163 select IO_TRAPPED if MMU
164 163
165config SH_SH7785LCR_29BIT_PHYSMAPS 164config SH_SH7785LCR_29BIT_PHYSMAPS
166 bool "SH7785LCR 29bit physmaps" 165 bool "SH7785LCR 29bit physmaps"
@@ -171,6 +170,13 @@ config SH_SH7785LCR_29BIT_PHYSMAPS
171 DIP switch(S2-5). If you set the DIP switch for S2-5 = ON, 170 DIP switch(S2-5). If you set the DIP switch for S2-5 = ON,
172 you can access all on-board device in 29bit address mode. 171 you can access all on-board device in 29bit address mode.
173 172
173config SH_SH7785LCR_PT
174 bool "SH7785LCR prototype board on 32-bit MMU mode"
175 depends on SH_SH7785LCR && 32BIT
176 default n
177 help
178 If you use prototype board, this option is enabled.
179
174config SH_URQUELL 180config SH_URQUELL
175 bool "Urquell" 181 bool "Urquell"
176 depends on CPU_SUBTYPE_SH7786 182 depends on CPU_SUBTYPE_SH7786
@@ -193,6 +199,20 @@ config SH_AP325RXA
193 Renesas "AP-325RXA" support. 199 Renesas "AP-325RXA" support.
194 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A" 200 Compatible with ALGO SYSTEM CO.,LTD. "AP-320A"
195 201
202config SH_KFR2R09
203 bool "KFR2R09"
204 depends on CPU_SUBTYPE_SH7724
205 select ARCH_REQUIRE_GPIOLIB
206 help
207 "Kit For R2R for 2009" support.
208
209config SH_ECOVEC
210 bool "EcoVec"
211 depends on CPU_SUBTYPE_SH7724
212 select ARCH_REQUIRE_GPIOLIB
213 help
214 Renesas "R0P7724LC0011/21RL (EcoVec)" support.
215
196config SH_SH7763RDP 216config SH_SH7763RDP
197 bool "SH7763RDP" 217 bool "SH7763RDP"
198 depends on CPU_SUBTYPE_SH7763 218 depends on CPU_SUBTYPE_SH7763
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index b9c88cc519e..327d47c25a5 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -188,7 +188,7 @@ static struct sh_mobile_lcdc_info lcdc_info = {
188 .name = "LB070WV1", 188 .name = "LB070WV1",
189 .xres = 800, 189 .xres = 800,
190 .yres = 480, 190 .yres = 480,
191 .left_margin = 40, 191 .left_margin = 32,
192 .right_margin = 160, 192 .right_margin = 160,
193 .hsync_len = 8, 193 .hsync_len = 8,
194 .upper_margin = 63, 194 .upper_margin = 63,
@@ -211,7 +211,7 @@ static struct resource lcdc_resources[] = {
211 [0] = { 211 [0] = {
212 .name = "LCDC", 212 .name = "LCDC",
213 .start = 0xfe940000, /* P4-only space */ 213 .start = 0xfe940000, /* P4-only space */
214 .end = 0xfe941fff, 214 .end = 0xfe942fff,
215 .flags = IORESOURCE_MEM, 215 .flags = IORESOURCE_MEM,
216 }, 216 },
217 [1] = { 217 [1] = {
@@ -227,6 +227,9 @@ static struct platform_device lcdc_device = {
227 .dev = { 227 .dev = {
228 .platform_data = &lcdc_info, 228 .platform_data = &lcdc_info,
229 }, 229 },
230 .archdata = {
231 .hwblk_id = HWBLK_LCDC,
232 },
230}; 233};
231 234
232static void camera_power(int val) 235static void camera_power(int val)
@@ -377,6 +380,9 @@ static struct platform_device ceu_device = {
377 .dev = { 380 .dev = {
378 .platform_data = &sh_mobile_ceu_info, 381 .platform_data = &sh_mobile_ceu_info,
379 }, 382 },
383 .archdata = {
384 .hwblk_id = HWBLK_CEU,
385 },
380}; 386};
381 387
382struct spi_gpio_platform_data sdcard_cn3_platform_data = { 388struct spi_gpio_platform_data sdcard_cn3_platform_data = {
diff --git a/arch/sh/boards/board-sh7785lcr.c b/arch/sh/boards/board-sh7785lcr.c
index 42410a15d25..e5a8a2fde39 100644
--- a/arch/sh/boards/board-sh7785lcr.c
+++ b/arch/sh/boards/board-sh7785lcr.c
@@ -223,6 +223,19 @@ static struct platform_device sm501_device = {
223 .resource = sm501_resources, 223 .resource = sm501_resources,
224}; 224};
225 225
226static struct resource i2c_proto_resources[] = {
227 [0] = {
228 .start = PCA9564_PROTO_32BIT_ADDR,
229 .end = PCA9564_PROTO_32BIT_ADDR + PCA9564_SIZE - 1,
230 .flags = IORESOURCE_MEM | IORESOURCE_MEM_8BIT,
231 },
232 [1] = {
233 .start = 12,
234 .end = 12,
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
226static struct resource i2c_resources[] = { 239static struct resource i2c_resources[] = {
227 [0] = { 240 [0] = {
228 .start = PCA9564_ADDR, 241 .start = PCA9564_ADDR,
@@ -271,6 +284,11 @@ static int __init sh7785lcr_devices_setup(void)
271 i2c_register_board_info(0, sh7785lcr_i2c_devices, 284 i2c_register_board_info(0, sh7785lcr_i2c_devices,
272 ARRAY_SIZE(sh7785lcr_i2c_devices)); 285 ARRAY_SIZE(sh7785lcr_i2c_devices));
273 286
287 if (mach_is_sh7785lcr_pt()) {
288 i2c_device.resource = i2c_proto_resources;
289 i2c_device.num_resources = ARRAY_SIZE(i2c_proto_resources);
290 }
291
274 return platform_add_devices(sh7785lcr_devices, 292 return platform_add_devices(sh7785lcr_devices,
275 ARRAY_SIZE(sh7785lcr_devices)); 293 ARRAY_SIZE(sh7785lcr_devices));
276} 294}
diff --git a/arch/sh/boards/mach-ecovec24/Makefile b/arch/sh/boards/mach-ecovec24/Makefile
new file mode 100644
index 00000000000..51f85215165
--- /dev/null
+++ b/arch/sh/boards/mach-ecovec24/Makefile
@@ -0,0 +1,9 @@
1#
2# Makefile for the R0P7724LC0011/21RL (EcoVec)
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8
9obj-y := setup.o \ No newline at end of file
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
new file mode 100644
index 00000000000..96bc1698310
--- /dev/null
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -0,0 +1,670 @@
1/*
2 * Copyright (C) 2009 Renesas Solutions Corp.
3 *
4 * Kuninori Morimoto <morimoto.kuninori@renesas.com>
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/platform_device.h>
14#include <linux/mtd/physmap.h>
15#include <linux/gpio.h>
16#include <linux/interrupt.h>
17#include <linux/io.h>
18#include <linux/delay.h>
19#include <linux/usb/r8a66597.h>
20#include <linux/i2c.h>
21#include <linux/input.h>
22#include <video/sh_mobile_lcdc.h>
23#include <media/sh_mobile_ceu.h>
24#include <asm/heartbeat.h>
25#include <asm/sh_eth.h>
26#include <asm/sh_keysc.h>
27#include <asm/clock.h>
28#include <cpu/sh7724.h>
29
30/*
31 * Address Interface BusWidth
32 *-----------------------------------------
33 * 0x0000_0000 uboot 16bit
34 * 0x0004_0000 Linux romImage 16bit
35 * 0x0014_0000 MTD for Linux 16bit
36 * 0x0400_0000 Internal I/O 16/32bit
37 * 0x0800_0000 DRAM 32bit
38 * 0x1800_0000 MFI 16bit
39 */
40
41/* Heartbeat */
42static unsigned char led_pos[] = { 0, 1, 2, 3 };
43static struct heartbeat_data heartbeat_data = {
44 .regsize = 8,
45 .nr_bits = 4,
46 .bit_pos = led_pos,
47};
48
49static struct resource heartbeat_resources[] = {
50 [0] = {
51 .start = 0xA405012C, /* PTG */
52 .end = 0xA405012E - 1,
53 .flags = IORESOURCE_MEM,
54 },
55};
56
57static struct platform_device heartbeat_device = {
58 .name = "heartbeat",
59 .id = -1,
60 .dev = {
61 .platform_data = &heartbeat_data,
62 },
63 .num_resources = ARRAY_SIZE(heartbeat_resources),
64 .resource = heartbeat_resources,
65};
66
67/* MTD */
68static struct mtd_partition nor_flash_partitions[] = {
69 {
70 .name = "boot loader",
71 .offset = 0,
72 .size = (5 * 1024 * 1024),
73 .mask_flags = MTD_CAP_ROM,
74 }, {
75 .name = "free-area",
76 .offset = MTDPART_OFS_APPEND,
77 .size = MTDPART_SIZ_FULL,
78 },
79};
80
81static struct physmap_flash_data nor_flash_data = {
82 .width = 2,
83 .parts = nor_flash_partitions,
84 .nr_parts = ARRAY_SIZE(nor_flash_partitions),
85};
86
87static struct resource nor_flash_resources[] = {
88 [0] = {
89 .name = "NOR Flash",
90 .start = 0x00000000,
91 .end = 0x03ffffff,
92 .flags = IORESOURCE_MEM,
93 }
94};
95
96static struct platform_device nor_flash_device = {
97 .name = "physmap-flash",
98 .resource = nor_flash_resources,
99 .num_resources = ARRAY_SIZE(nor_flash_resources),
100 .dev = {
101 .platform_data = &nor_flash_data,
102 },
103};
104
105/* SH Eth */
106#define SH_ETH_ADDR (0xA4600000)
107#define SH_ETH_MAHR (SH_ETH_ADDR + 0x1C0)
108#define SH_ETH_MALR (SH_ETH_ADDR + 0x1C8)
109static struct resource sh_eth_resources[] = {
110 [0] = {
111 .start = SH_ETH_ADDR,
112 .end = SH_ETH_ADDR + 0x1FC,
113 .flags = IORESOURCE_MEM,
114 },
115 [1] = {
116 .start = 91,
117 .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL,
118 },
119};
120
121struct sh_eth_plat_data sh_eth_plat = {
122 .phy = 0x1f, /* SMSC LAN8700 */
123 .edmac_endian = EDMAC_LITTLE_ENDIAN,
124};
125
126static struct platform_device sh_eth_device = {
127 .name = "sh-eth",
128 .id = 0,
129 .dev = {
130 .platform_data = &sh_eth_plat,
131 },
132 .num_resources = ARRAY_SIZE(sh_eth_resources),
133 .resource = sh_eth_resources,
134};
135
136/* USB0 host */
137void usb0_port_power(int port, int power)
138{
139 gpio_set_value(GPIO_PTB4, power);
140}
141
142static struct r8a66597_platdata usb0_host_data = {
143 .on_chip = 1,
144 .port_power = usb0_port_power,
145};
146
147static struct resource usb0_host_resources[] = {
148 [0] = {
149 .start = 0xa4d80000,
150 .end = 0xa4d80124 - 1,
151 .flags = IORESOURCE_MEM,
152 },
153 [1] = {
154 .start = 65,
155 .end = 65,
156 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
157 },
158};
159
160static struct platform_device usb0_host_device = {
161 .name = "r8a66597_hcd",
162 .id = 0,
163 .dev = {
164 .dma_mask = NULL, /* not use dma */
165 .coherent_dma_mask = 0xffffffff,
166 .platform_data = &usb0_host_data,
167 },
168 .num_resources = ARRAY_SIZE(usb0_host_resources),
169 .resource = usb0_host_resources,
170};
171
172/*
173 * USB1
174 *
175 * CN5 can use both host/function,
176 * and we can determine it by checking PTB[3]
177 *
178 * This time only USB1 host is supported.
179 */
180void usb1_port_power(int port, int power)
181{
182 if (!gpio_get_value(GPIO_PTB3)) {
183 printk(KERN_ERR "USB1 function is not supported\n");
184 return;
185 }
186
187 gpio_set_value(GPIO_PTB5, power);
188}
189
190static struct r8a66597_platdata usb1_host_data = {
191 .on_chip = 1,
192 .port_power = usb1_port_power,
193};
194
195static struct resource usb1_host_resources[] = {
196 [0] = {
197 .start = 0xa4d90000,
198 .end = 0xa4d90124 - 1,
199 .flags = IORESOURCE_MEM,
200 },
201 [1] = {
202 .start = 66,
203 .end = 66,
204 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
205 },
206};
207
208static struct platform_device usb1_host_device = {
209 .name = "r8a66597_hcd",
210 .id = 1,
211 .dev = {
212 .dma_mask = NULL, /* not use dma */
213 .coherent_dma_mask = 0xffffffff,
214 .platform_data = &usb1_host_data,
215 },
216 .num_resources = ARRAY_SIZE(usb1_host_resources),
217 .resource = usb1_host_resources,
218};
219
220/* LCDC */
221static struct sh_mobile_lcdc_info lcdc_info = {
222 .ch[0] = {
223 .interface_type = RGB18,
224 .chan = LCDC_CHAN_MAINLCD,
225 .bpp = 16,
226 .lcd_cfg = {
227 .sync = 0, /* hsync and vsync are active low */
228 },
229 .lcd_size_cfg = { /* 7.0 inch */
230 .width = 152,
231 .height = 91,
232 },
233 .board_cfg = {
234 },
235 }
236};
237
238static struct resource lcdc_resources[] = {
239 [0] = {
240 .name = "LCDC",
241 .start = 0xfe940000,
242 .end = 0xfe942fff,
243 .flags = IORESOURCE_MEM,
244 },
245 [1] = {
246 .start = 106,
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251static struct platform_device lcdc_device = {
252 .name = "sh_mobile_lcdc_fb",
253 .num_resources = ARRAY_SIZE(lcdc_resources),
254 .resource = lcdc_resources,
255 .dev = {
256 .platform_data = &lcdc_info,
257 },
258 .archdata = {
259 .hwblk_id = HWBLK_LCDC,
260 },
261};
262
263/* CEU0 */
264static struct sh_mobile_ceu_info sh_mobile_ceu0_info = {
265 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
266};
267
268static struct resource ceu0_resources[] = {
269 [0] = {
270 .name = "CEU0",
271 .start = 0xfe910000,
272 .end = 0xfe91009f,
273 .flags = IORESOURCE_MEM,
274 },
275 [1] = {
276 .start = 52,
277 .flags = IORESOURCE_IRQ,
278 },
279 [2] = {
280 /* place holder for contiguous memory */
281 },
282};
283
284static struct platform_device ceu0_device = {
285 .name = "sh_mobile_ceu",
286 .id = 0, /* "ceu0" clock */
287 .num_resources = ARRAY_SIZE(ceu0_resources),
288 .resource = ceu0_resources,
289 .dev = {
290 .platform_data = &sh_mobile_ceu0_info,
291 },
292 .archdata = {
293 .hwblk_id = HWBLK_CEU0,
294 },
295};
296
297/* CEU1 */
298static struct sh_mobile_ceu_info sh_mobile_ceu1_info = {
299 .flags = SH_CEU_FLAG_USE_8BIT_BUS,
300};
301
302static struct resource ceu1_resources[] = {
303 [0] = {
304 .name = "CEU1",
305 .start = 0xfe914000,
306 .end = 0xfe91409f,
307 .flags = IORESOURCE_MEM,
308 },
309 [1] = {
310 .start = 63,
311 .flags = IORESOURCE_IRQ,
312 },
313 [2] = {
314 /* place holder for contiguous memory */
315 },
316};
317
318static struct platform_device ceu1_device = {
319 .name = "sh_mobile_ceu",
320 .id = 1, /* "ceu1" clock */
321 .num_resources = ARRAY_SIZE(ceu1_resources),
322 .resource = ceu1_resources,
323 .dev = {
324 .platform_data = &sh_mobile_ceu1_info,
325 },
326 .archdata = {
327 .hwblk_id = HWBLK_CEU1,
328 },
329};
330
331/* I2C device */
332static struct i2c_board_info i2c1_devices[] = {
333 {
334 I2C_BOARD_INFO("r2025sd", 0x32),
335 },
336};
337
338/* KEYSC */
339static struct sh_keysc_info keysc_info = {
340 .mode = SH_KEYSC_MODE_1,
341 .scan_timing = 3,
342 .delay = 50,
343 .kycr2_delay = 100,
344 .keycodes = { KEY_1, 0, 0, 0, 0,
345 KEY_2, 0, 0, 0, 0,
346 KEY_3, 0, 0, 0, 0,
347 KEY_4, 0, 0, 0, 0,
348 KEY_5, 0, 0, 0, 0,
349 KEY_6, 0, 0, 0, 0, },
350};
351
352static struct resource keysc_resources[] = {
353 [0] = {
354 .name = "KEYSC",
355 .start = 0x044b0000,
356 .end = 0x044b000f,
357 .flags = IORESOURCE_MEM,
358 },
359 [1] = {
360 .start = 79,
361 .flags = IORESOURCE_IRQ,
362 },
363};
364
365static struct platform_device keysc_device = {
366 .name = "sh_keysc",
367 .id = 0, /* keysc0 clock */
368 .num_resources = ARRAY_SIZE(keysc_resources),
369 .resource = keysc_resources,
370 .dev = {
371 .platform_data = &keysc_info,
372 },
373 .archdata = {
374 .hwblk_id = HWBLK_KEYSC,
375 },
376};
377
378static struct platform_device *ecovec_devices[] __initdata = {
379 &heartbeat_device,
380 &nor_flash_device,
381 &sh_eth_device,
382 &usb0_host_device,
383 &usb1_host_device, /* USB1 host support */
384 &lcdc_device,
385 &ceu0_device,
386 &ceu1_device,
387 &keysc_device,
388};
389
390#define EEPROM_ADDR 0x50
391static u8 mac_read(struct i2c_adapter *a, u8 command)
392{
393 struct i2c_msg msg[2];
394 u8 buf;
395 int ret;
396
397 msg[0].addr = EEPROM_ADDR;
398 msg[0].flags = 0;
399 msg[0].len = 1;
400 msg[0].buf = &command;
401
402 msg[1].addr = EEPROM_ADDR;
403 msg[1].flags = I2C_M_RD;
404 msg[1].len = 1;
405 msg[1].buf = &buf;
406
407 ret = i2c_transfer(a, msg, 2);
408 if (ret < 0) {
409 printk(KERN_ERR "error %d\n", ret);
410 buf = 0xff;
411 }
412
413 return buf;
414}
415
416#define MAC_LEN 6
417static void __init sh_eth_init(void)
418{
419 struct i2c_adapter *a = i2c_get_adapter(1);
420 struct clk *eth_clk;
421 u8 mac[MAC_LEN];
422 int i;
423
424 if (!a) {
425 pr_err("can not get I2C 1\n");
426 return;
427 }
428
429 eth_clk = clk_get(NULL, "eth0");
430 if (!eth_clk) {
431 pr_err("can not get eth0 clk\n");
432 return;
433 }
434
435 /* read MAC address frome EEPROM */
436 for (i = 0; i < MAC_LEN; i++) {
437 mac[i] = mac_read(a, 0x10 + i);
438 msleep(10);
439 }
440
441 /* clock enable */
442 clk_enable(eth_clk);
443
444 /* reset sh-eth */
445 ctrl_outl(0x1, SH_ETH_ADDR + 0x0);
446
447 /* set MAC addr */
448 ctrl_outl((mac[0] << 24) |
449 (mac[1] << 16) |
450 (mac[2] << 8) |
451 (mac[3] << 0), SH_ETH_MAHR);
452 ctrl_outl((mac[4] << 8) |
453 (mac[5] << 0), SH_ETH_MALR);
454
455 clk_put(eth_clk);
456}
457
458#define PORT_HIZA 0xA4050158
459#define IODRIVEA 0xA405018A
460static int __init arch_setup(void)
461{
462 /* enable SCIFA0 */
463 gpio_request(GPIO_FN_SCIF0_TXD, NULL);
464 gpio_request(GPIO_FN_SCIF0_RXD, NULL);
465
466 /* enable debug LED */
467 gpio_request(GPIO_PTG0, NULL);
468 gpio_request(GPIO_PTG1, NULL);
469 gpio_request(GPIO_PTG2, NULL);
470 gpio_request(GPIO_PTG3, NULL);
471 gpio_direction_output(GPIO_PTG0, 0);
472 gpio_direction_output(GPIO_PTG1, 0);
473 gpio_direction_output(GPIO_PTG2, 0);
474 gpio_direction_output(GPIO_PTG3, 0);
475 ctrl_outw((ctrl_inw(PORT_HIZA) & ~(0x1 << 1)) , PORT_HIZA);
476
477 /* enable SH-Eth */
478 gpio_request(GPIO_PTA1, NULL);
479 gpio_direction_output(GPIO_PTA1, 1);
480 mdelay(20);
481
482 gpio_request(GPIO_FN_RMII_RXD0, NULL);
483 gpio_request(GPIO_FN_RMII_RXD1, NULL);
484 gpio_request(GPIO_FN_RMII_TXD0, NULL);
485 gpio_request(GPIO_FN_RMII_TXD1, NULL);
486 gpio_request(GPIO_FN_RMII_REF_CLK, NULL);
487 gpio_request(GPIO_FN_RMII_TX_EN, NULL);
488 gpio_request(GPIO_FN_RMII_RX_ER, NULL);
489 gpio_request(GPIO_FN_RMII_CRS_DV, NULL);
490 gpio_request(GPIO_FN_MDIO, NULL);
491 gpio_request(GPIO_FN_MDC, NULL);
492 gpio_request(GPIO_FN_LNKSTA, NULL);
493
494 /* enable USB */
495 ctrl_outw(0x0000, 0xA4D80000);
496 ctrl_outw(0x0000, 0xA4D90000);
497 gpio_request(GPIO_PTB3, NULL);
498 gpio_request(GPIO_PTB4, NULL);
499 gpio_request(GPIO_PTB5, NULL);
500 gpio_direction_input(GPIO_PTB3);
501 gpio_direction_output(GPIO_PTB4, 0);
502 gpio_direction_output(GPIO_PTB5, 0);
503 ctrl_outw(0x0600, 0xa40501d4);
504 ctrl_outw(0x0600, 0xa4050192);
505
506 /* enable LCDC */
507 gpio_request(GPIO_FN_LCDD23, NULL);
508 gpio_request(GPIO_FN_LCDD22, NULL);
509 gpio_request(GPIO_FN_LCDD21, NULL);
510 gpio_request(GPIO_FN_LCDD20, NULL);
511 gpio_request(GPIO_FN_LCDD19, NULL);
512 gpio_request(GPIO_FN_LCDD18, NULL);
513 gpio_request(GPIO_FN_LCDD17, NULL);
514 gpio_request(GPIO_FN_LCDD16, NULL);
515 gpio_request(GPIO_FN_LCDD15, NULL);
516 gpio_request(GPIO_FN_LCDD14, NULL);
517 gpio_request(GPIO_FN_LCDD13, NULL);
518 gpio_request(GPIO_FN_LCDD12, NULL);
519 gpio_request(GPIO_FN_LCDD11, NULL);
520 gpio_request(GPIO_FN_LCDD10, NULL);
521 gpio_request(GPIO_FN_LCDD9, NULL);
522 gpio_request(GPIO_FN_LCDD8, NULL);
523 gpio_request(GPIO_FN_LCDD7, NULL);
524 gpio_request(GPIO_FN_LCDD6, NULL);
525 gpio_request(GPIO_FN_LCDD5, NULL);
526 gpio_request(GPIO_FN_LCDD4, NULL);
527 gpio_request(GPIO_FN_LCDD3, NULL);
528 gpio_request(GPIO_FN_LCDD2, NULL);
529 gpio_request(GPIO_FN_LCDD1, NULL);
530 gpio_request(GPIO_FN_LCDD0, NULL);
531 gpio_request(GPIO_FN_LCDDISP, NULL);
532 gpio_request(GPIO_FN_LCDHSYN, NULL);
533 gpio_request(GPIO_FN_LCDDCK, NULL);
534 gpio_request(GPIO_FN_LCDVSYN, NULL);
535 gpio_request(GPIO_FN_LCDDON, NULL);
536 gpio_request(GPIO_FN_LCDLCLK, NULL);
537 ctrl_outw((ctrl_inw(PORT_HIZA) & ~0x0001), PORT_HIZA);
538
539 gpio_request(GPIO_PTE6, NULL);
540 gpio_request(GPIO_PTU1, NULL);
541 gpio_request(GPIO_PTR1, NULL);
542 gpio_request(GPIO_PTA2, NULL);
543 gpio_direction_input(GPIO_PTE6);
544 gpio_direction_output(GPIO_PTU1, 0);
545 gpio_direction_output(GPIO_PTR1, 0);
546 gpio_direction_output(GPIO_PTA2, 0);
547
548 /* I/O buffer drive ability is low */
549 ctrl_outw((ctrl_inw(IODRIVEA) & ~0x00c0) | 0x0040 , IODRIVEA);
550
551 if (gpio_get_value(GPIO_PTE6)) {
552 /* DVI */
553 lcdc_info.clock_source = LCDC_CLK_EXTERNAL;
554 lcdc_info.ch[0].clock_divider = 1,
555 lcdc_info.ch[0].lcd_cfg.name = "DVI";
556 lcdc_info.ch[0].lcd_cfg.xres = 1280;
557 lcdc_info.ch[0].lcd_cfg.yres = 720;
558 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
559 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
560 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
561 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
562 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
563 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
564
565 gpio_set_value(GPIO_PTA2, 1);
566 gpio_set_value(GPIO_PTU1, 1);
567 } else {
568 /* Panel */
569
570 lcdc_info.clock_source = LCDC_CLK_PERIPHERAL;
571 lcdc_info.ch[0].clock_divider = 2,
572 lcdc_info.ch[0].lcd_cfg.name = "Panel";
573 lcdc_info.ch[0].lcd_cfg.xres = 800;
574 lcdc_info.ch[0].lcd_cfg.yres = 480;
575 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
576 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
577 lcdc_info.ch[0].lcd_cfg.hsync_len = 70;
578 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
579 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
580 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
581
582 gpio_set_value(GPIO_PTR1, 1);
583
584 /* FIXME
585 *
586 * LCDDON control is needed for Panel,
587 * but current sh_mobile_lcdc driver doesn't control it.
588 * It is temporary correspondence
589 */
590 gpio_request(GPIO_PTF4, NULL);
591 gpio_direction_output(GPIO_PTF4, 1);
592 }
593
594 /* enable CEU0 */
595 gpio_request(GPIO_FN_VIO0_D15, NULL);
596 gpio_request(GPIO_FN_VIO0_D14, NULL);
597 gpio_request(GPIO_FN_VIO0_D13, NULL);
598 gpio_request(GPIO_FN_VIO0_D12, NULL);
599 gpio_request(GPIO_FN_VIO0_D11, NULL);
600 gpio_request(GPIO_FN_VIO0_D10, NULL);
601 gpio_request(GPIO_FN_VIO0_D9, NULL);
602 gpio_request(GPIO_FN_VIO0_D8, NULL);
603 gpio_request(GPIO_FN_VIO0_D7, NULL);
604 gpio_request(GPIO_FN_VIO0_D6, NULL);
605 gpio_request(GPIO_FN_VIO0_D5, NULL);
606 gpio_request(GPIO_FN_VIO0_D4, NULL);
607 gpio_request(GPIO_FN_VIO0_D3, NULL);
608 gpio_request(GPIO_FN_VIO0_D2, NULL);
609 gpio_request(GPIO_FN_VIO0_D1, NULL);
610 gpio_request(GPIO_FN_VIO0_D0, NULL);
611 gpio_request(GPIO_FN_VIO0_VD, NULL);
612 gpio_request(GPIO_FN_VIO0_CLK, NULL);
613 gpio_request(GPIO_FN_VIO0_FLD, NULL);
614 gpio_request(GPIO_FN_VIO0_HD, NULL);
615 platform_resource_setup_memory(&ceu0_device, "ceu0", 4 << 20);
616
617 /* enable CEU1 */
618 gpio_request(GPIO_FN_VIO1_D7, NULL);
619 gpio_request(GPIO_FN_VIO1_D6, NULL);
620 gpio_request(GPIO_FN_VIO1_D5, NULL);
621 gpio_request(GPIO_FN_VIO1_D4, NULL);
622 gpio_request(GPIO_FN_VIO1_D3, NULL);
623 gpio_request(GPIO_FN_VIO1_D2, NULL);
624 gpio_request(GPIO_FN_VIO1_D1, NULL);
625 gpio_request(GPIO_FN_VIO1_D0, NULL);
626 gpio_request(GPIO_FN_VIO1_FLD, NULL);
627 gpio_request(GPIO_FN_VIO1_HD, NULL);
628 gpio_request(GPIO_FN_VIO1_VD, NULL);
629 gpio_request(GPIO_FN_VIO1_CLK, NULL);
630 platform_resource_setup_memory(&ceu1_device, "ceu1", 4 << 20);
631
632 /* enable KEYSC */
633 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
634 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
635 gpio_request(GPIO_FN_KEYOUT3, NULL);
636 gpio_request(GPIO_FN_KEYOUT2, NULL);
637 gpio_request(GPIO_FN_KEYOUT1, NULL);
638 gpio_request(GPIO_FN_KEYOUT0, NULL);
639 gpio_request(GPIO_FN_KEYIN0, NULL);
640
641 /* enable user debug switch */
642 gpio_request(GPIO_PTR0, NULL);
643 gpio_request(GPIO_PTR4, NULL);
644 gpio_request(GPIO_PTR5, NULL);
645 gpio_request(GPIO_PTR6, NULL);
646 gpio_direction_input(GPIO_PTR0);
647 gpio_direction_input(GPIO_PTR4);
648 gpio_direction_input(GPIO_PTR5);
649 gpio_direction_input(GPIO_PTR6);
650
651 /* enable I2C device */
652 i2c_register_board_info(1, i2c1_devices,
653 ARRAY_SIZE(i2c1_devices));
654
655 return platform_add_devices(ecovec_devices,
656 ARRAY_SIZE(ecovec_devices));
657}
658arch_initcall(arch_setup);
659
660static int __init devices_setup(void)
661{
662 sh_eth_init();
663 return 0;
664}
665device_initcall(devices_setup);
666
667
668static struct sh_machine_vector mv_ecovec __initmv = {
669 .mv_name = "R0P7724 (EcoVec)",
670};
diff --git a/arch/sh/boards/mach-highlander/setup.c b/arch/sh/boards/mach-highlander/setup.c
index 1639f891500..566e69d8d72 100644
--- a/arch/sh/boards/mach-highlander/setup.c
+++ b/arch/sh/boards/mach-highlander/setup.c
@@ -22,6 +22,7 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/usb/r8a66597.h> 24#include <linux/usb/r8a66597.h>
25#include <linux/usb/m66592.h>
25#include <net/ax88796.h> 26#include <net/ax88796.h>
26#include <asm/machvec.h> 27#include <asm/machvec.h>
27#include <mach/highlander.h> 28#include <mach/highlander.h>
@@ -60,6 +61,11 @@ static struct platform_device r8a66597_usb_host_device = {
60 .resource = r8a66597_usb_host_resources, 61 .resource = r8a66597_usb_host_resources,
61}; 62};
62 63
64static struct m66592_platdata usbf_platdata = {
65 .xtal = M66592_PLATDATA_XTAL_24MHZ,
66 .vif = 1,
67};
68
63static struct resource m66592_usb_peripheral_resources[] = { 69static struct resource m66592_usb_peripheral_resources[] = {
64 [0] = { 70 [0] = {
65 .name = "m66592_udc", 71 .name = "m66592_udc",
@@ -81,6 +87,7 @@ static struct platform_device m66592_usb_peripheral_device = {
81 .dev = { 87 .dev = {
82 .dma_mask = NULL, /* don't use dma */ 88 .dma_mask = NULL, /* don't use dma */
83 .coherent_dma_mask = 0xffffffff, 89 .coherent_dma_mask = 0xffffffff,
90 .platform_data = &usbf_platdata,
84 }, 91 },
85 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), 92 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
86 .resource = m66592_usb_peripheral_resources, 93 .resource = m66592_usb_peripheral_resources,
diff --git a/arch/sh/boards/mach-kfr2r09/Makefile b/arch/sh/boards/mach-kfr2r09/Makefile
new file mode 100644
index 00000000000..5d5867826e3
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/Makefile
@@ -0,0 +1,2 @@
1obj-y := setup.o
2obj-$(CONFIG_FB_SH_MOBILE_LCDC) += lcd_wqvga.o
diff --git a/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
new file mode 100644
index 00000000000..8ccb1cc8b58
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/lcd_wqvga.c
@@ -0,0 +1,332 @@
1/*
2 * KFR2R09 LCD panel support
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * Register settings based on the out-of-tree t33fb.c driver
7 * Copyright (C) 2008 Lineo Solutions, Inc.
8 *
9 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file COPYING in the main directory of this archive for
11 * more details.
12 */
13
14#include <linux/delay.h>
15#include <linux/err.h>
16#include <linux/fb.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/module.h>
20#include <linux/gpio.h>
21#include <video/sh_mobile_lcdc.h>
22#include <mach/kfr2r09.h>
23#include <cpu/sh7724.h>
24
25/* The on-board LCD module is a Hitachi TX07D34VM0AAA. This module is made
26 * up of a 240x400 LCD hooked up to a R61517 driver IC. The driver IC is
27 * communicating with the main port of the LCDC using an 18-bit SYS interface.
28 *
29 * The device code for this LCD module is 0x01221517.
30 */
31
32static const unsigned char data_frame_if[] = {
33 0x02, /* WEMODE: 1=cont, 0=one-shot */
34 0x00, 0x00,
35 0x00, /* EPF, DFM */
36 0x02, /* RIM[1] : 1 (18bpp) */
37};
38
39static const unsigned char data_panel[] = {
40 0x0b,
41 0x63, /* 400 lines */
42 0x04, 0x00, 0x00, 0x04, 0x11, 0x00, 0x00,
43};
44
45static const unsigned char data_timing[] = {
46 0x00, 0x00, 0x13, 0x08, 0x08,
47};
48
49static const unsigned char data_timing_src[] = {
50 0x11, 0x01, 0x00, 0x01,
51};
52
53static const unsigned char data_gamma[] = {
54 0x01, 0x02, 0x08, 0x23, 0x03, 0x0c, 0x00, 0x06, 0x00, 0x00,
55 0x01, 0x00, 0x0c, 0x23, 0x03, 0x08, 0x02, 0x06, 0x00, 0x00,
56};
57
58static const unsigned char data_power[] = {
59 0x07, 0xc5, 0xdc, 0x02, 0x33, 0x0a,
60};
61
62static unsigned long read_reg(void *sohandle,
63 struct sh_mobile_lcdc_sys_bus_ops *so)
64{
65 return so->read_data(sohandle);
66}
67
68static void write_reg(void *sohandle,
69 struct sh_mobile_lcdc_sys_bus_ops *so,
70 int i, unsigned long v)
71{
72 if (i)
73 so->write_data(sohandle, v); /* PTH4/LCDRS High [param, 17:0] */
74 else
75 so->write_index(sohandle, v); /* PTH4/LCDRS Low [cmd, 7:0] */
76}
77
78static void write_data(void *sohandle,
79 struct sh_mobile_lcdc_sys_bus_ops *so,
80 unsigned char const *data, int no_data)
81{
82 int i;
83
84 for (i = 0; i < no_data; i++)
85 write_reg(sohandle, so, 1, data[i]);
86}
87
88static unsigned long read_device_code(void *sohandle,
89 struct sh_mobile_lcdc_sys_bus_ops *so)
90{
91 unsigned long device_code;
92
93 /* access protect OFF */
94 write_reg(sohandle, so, 0, 0xb0);
95 write_reg(sohandle, so, 1, 0x00);
96
97 /* deep standby OFF */
98 write_reg(sohandle, so, 0, 0xb1);
99 write_reg(sohandle, so, 1, 0x00);
100
101 /* device code command */
102 write_reg(sohandle, so, 0, 0xbf);
103 mdelay(50);
104
105 /* dummy read */
106 read_reg(sohandle, so);
107
108 /* read device code */
109 device_code = ((read_reg(sohandle, so) & 0xff) << 24);
110 device_code |= ((read_reg(sohandle, so) & 0xff) << 16);
111 device_code |= ((read_reg(sohandle, so) & 0xff) << 8);
112 device_code |= (read_reg(sohandle, so) & 0xff);
113
114 return device_code;
115}
116
117static void write_memory_start(void *sohandle,
118 struct sh_mobile_lcdc_sys_bus_ops *so)
119{
120 write_reg(sohandle, so, 0, 0x2c);
121}
122
123static void clear_memory(void *sohandle,
124 struct sh_mobile_lcdc_sys_bus_ops *so)
125{
126 int i;
127
128 /* write start */
129 write_memory_start(sohandle, so);
130
131 /* paint it black */
132 for (i = 0; i < (240 * 400); i++)
133 write_reg(sohandle, so, 1, 0x00);
134}
135
136static void display_on(void *sohandle,
137 struct sh_mobile_lcdc_sys_bus_ops *so)
138{
139 /* access protect off */
140 write_reg(sohandle, so, 0, 0xb0);
141 write_reg(sohandle, so, 1, 0x00);
142
143 /* exit deep standby mode */
144 write_reg(sohandle, so, 0, 0xb1);
145 write_reg(sohandle, so, 1, 0x00);
146
147 /* frame memory I/F */
148 write_reg(sohandle, so, 0, 0xb3);
149 write_data(sohandle, so, data_frame_if, ARRAY_SIZE(data_frame_if));
150
151 /* display mode and frame memory write mode */
152 write_reg(sohandle, so, 0, 0xb4);
153 write_reg(sohandle, so, 1, 0x00); /* DBI, internal clock */
154
155 /* panel */
156 write_reg(sohandle, so, 0, 0xc0);
157 write_data(sohandle, so, data_panel, ARRAY_SIZE(data_panel));
158
159 /* timing (normal) */
160 write_reg(sohandle, so, 0, 0xc1);
161 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
162
163 /* timing (partial) */
164 write_reg(sohandle, so, 0, 0xc2);
165 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
166
167 /* timing (idle) */
168 write_reg(sohandle, so, 0, 0xc3);
169 write_data(sohandle, so, data_timing, ARRAY_SIZE(data_timing));
170
171 /* timing (source/VCOM/gate driving) */
172 write_reg(sohandle, so, 0, 0xc4);
173 write_data(sohandle, so, data_timing_src, ARRAY_SIZE(data_timing_src));
174
175 /* gamma (red) */
176 write_reg(sohandle, so, 0, 0xc8);
177 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
178
179 /* gamma (green) */
180 write_reg(sohandle, so, 0, 0xc9);
181 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
182
183 /* gamma (blue) */
184 write_reg(sohandle, so, 0, 0xca);
185 write_data(sohandle, so, data_gamma, ARRAY_SIZE(data_gamma));
186
187 /* power (common) */
188 write_reg(sohandle, so, 0, 0xd0);
189 write_data(sohandle, so, data_power, ARRAY_SIZE(data_power));
190
191 /* VCOM */
192 write_reg(sohandle, so, 0, 0xd1);
193 write_reg(sohandle, so, 1, 0x00);
194 write_reg(sohandle, so, 1, 0x0f);
195 write_reg(sohandle, so, 1, 0x02);
196
197 /* power (normal) */
198 write_reg(sohandle, so, 0, 0xd2);
199 write_reg(sohandle, so, 1, 0x63);
200 write_reg(sohandle, so, 1, 0x24);
201
202 /* power (partial) */
203 write_reg(sohandle, so, 0, 0xd3);
204 write_reg(sohandle, so, 1, 0x63);
205 write_reg(sohandle, so, 1, 0x24);
206
207 /* power (idle) */
208 write_reg(sohandle, so, 0, 0xd4);
209 write_reg(sohandle, so, 1, 0x63);
210 write_reg(sohandle, so, 1, 0x24);
211
212 write_reg(sohandle, so, 0, 0xd8);
213 write_reg(sohandle, so, 1, 0x77);
214 write_reg(sohandle, so, 1, 0x77);
215
216 /* TE signal */
217 write_reg(sohandle, so, 0, 0x35);
218 write_reg(sohandle, so, 1, 0x00);
219
220 /* TE signal line */
221 write_reg(sohandle, so, 0, 0x44);
222 write_reg(sohandle, so, 1, 0x00);
223 write_reg(sohandle, so, 1, 0x00);
224
225 /* column address */
226 write_reg(sohandle, so, 0, 0x2a);
227 write_reg(sohandle, so, 1, 0x00);
228 write_reg(sohandle, so, 1, 0x00);
229 write_reg(sohandle, so, 1, 0x00);
230 write_reg(sohandle, so, 1, 0xef);
231
232 /* page address */
233 write_reg(sohandle, so, 0, 0x2b);
234 write_reg(sohandle, so, 1, 0x00);
235 write_reg(sohandle, so, 1, 0x00);
236 write_reg(sohandle, so, 1, 0x01);
237 write_reg(sohandle, so, 1, 0x8f);
238
239 /* exit sleep mode */
240 write_reg(sohandle, so, 0, 0x11);
241
242 mdelay(120);
243
244 /* clear vram */
245 clear_memory(sohandle, so);
246
247 /* display ON */
248 write_reg(sohandle, so, 0, 0x29);
249 mdelay(1);
250
251 write_memory_start(sohandle, so);
252}
253
254int kfr2r09_lcd_setup(void *board_data, void *sohandle,
255 struct sh_mobile_lcdc_sys_bus_ops *so)
256{
257 /* power on */
258 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
259 gpio_set_value(GPIO_PTE4, 0); /* LCD_RST/ -> L */
260 gpio_set_value(GPIO_PTF4, 1); /* PROTECT/ -> H */
261 udelay(1100);
262 gpio_set_value(GPIO_PTE4, 1); /* LCD_RST/ -> H */
263 udelay(10);
264 gpio_set_value(GPIO_PTF4, 0); /* PROTECT/ -> L */
265 mdelay(20);
266
267 if (read_device_code(sohandle, so) != 0x01221517)
268 return -ENODEV;
269
270 pr_info("KFR2R09 WQVGA LCD Module detected.\n");
271
272 display_on(sohandle, so);
273 return 0;
274}
275
276#define CTRL_CKSW 0x10
277#define CTRL_C10 0x20
278#define CTRL_CPSW 0x80
279#define MAIN_MLED4 0x40
280#define MAIN_MSW 0x80
281
282static int kfr2r09_lcd_backlight(int on)
283{
284 struct i2c_adapter *a;
285 struct i2c_msg msg;
286 unsigned char buf[2];
287 int ret;
288
289 a = i2c_get_adapter(0);
290 if (!a)
291 return -ENODEV;
292
293 buf[0] = 0x00;
294 if (on)
295 buf[1] = CTRL_CPSW | CTRL_C10 | CTRL_CKSW;
296 else
297 buf[1] = 0;
298
299 msg.addr = 0x75;
300 msg.buf = buf;
301 msg.len = 2;
302 msg.flags = 0;
303 ret = i2c_transfer(a, &msg, 1);
304 if (ret != 1)
305 return -ENODEV;
306
307 buf[0] = 0x01;
308 if (on)
309 buf[1] = MAIN_MSW | MAIN_MLED4 | 0x0c;
310 else
311 buf[1] = 0;
312
313 msg.addr = 0x75;
314 msg.buf = buf;
315 msg.len = 2;
316 msg.flags = 0;
317 ret = i2c_transfer(a, &msg, 1);
318 if (ret != 1)
319 return -ENODEV;
320
321 return 0;
322}
323
324void kfr2r09_lcd_on(void *board_data)
325{
326 kfr2r09_lcd_backlight(1);
327}
328
329void kfr2r09_lcd_off(void *board_data)
330{
331 kfr2r09_lcd_backlight(0);
332}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
new file mode 100644
index 00000000000..c08d33fe210
--- /dev/null
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -0,0 +1,386 @@
1/*
2 * KFR2R09 board support code
3 *
4 * Copyright (C) 2009 Magnus Damm
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/init.h>
11#include <linux/platform_device.h>
12#include <linux/interrupt.h>
13#include <linux/mtd/physmap.h>
14#include <linux/mtd/onenand.h>
15#include <linux/delay.h>
16#include <linux/clk.h>
17#include <linux/gpio.h>
18#include <linux/input.h>
19#include <linux/i2c.h>
20#include <linux/usb/r8a66597.h>
21#include <video/sh_mobile_lcdc.h>
22#include <asm/clock.h>
23#include <asm/machvec.h>
24#include <asm/io.h>
25#include <asm/sh_keysc.h>
26#include <cpu/sh7724.h>
27#include <mach/kfr2r09.h>
28
29static struct mtd_partition kfr2r09_nor_flash_partitions[] =
30{
31 {
32 .name = "boot",
33 .offset = 0,
34 .size = (4 * 1024 * 1024),
35 .mask_flags = MTD_WRITEABLE, /* Read-only */
36 },
37 {
38 .name = "other",
39 .offset = MTDPART_OFS_APPEND,
40 .size = MTDPART_SIZ_FULL,
41 },
42};
43
44static struct physmap_flash_data kfr2r09_nor_flash_data = {
45 .width = 2,
46 .parts = kfr2r09_nor_flash_partitions,
47 .nr_parts = ARRAY_SIZE(kfr2r09_nor_flash_partitions),
48};
49
50static struct resource kfr2r09_nor_flash_resources[] = {
51 [0] = {
52 .name = "NOR Flash",
53 .start = 0x00000000,
54 .end = 0x03ffffff,
55 .flags = IORESOURCE_MEM,
56 }
57};
58
59static struct platform_device kfr2r09_nor_flash_device = {
60 .name = "physmap-flash",
61 .resource = kfr2r09_nor_flash_resources,
62 .num_resources = ARRAY_SIZE(kfr2r09_nor_flash_resources),
63 .dev = {
64 .platform_data = &kfr2r09_nor_flash_data,
65 },
66};
67
68static struct resource kfr2r09_nand_flash_resources[] = {
69 [0] = {
70 .name = "NAND Flash",
71 .start = 0x10000000,
72 .end = 0x1001ffff,
73 .flags = IORESOURCE_MEM,
74 }
75};
76
77static struct platform_device kfr2r09_nand_flash_device = {
78 .name = "onenand-flash",
79 .resource = kfr2r09_nand_flash_resources,
80 .num_resources = ARRAY_SIZE(kfr2r09_nand_flash_resources),
81};
82
83static struct sh_keysc_info kfr2r09_sh_keysc_info = {
84 .mode = SH_KEYSC_MODE_1, /* KEYOUT0->4, KEYIN0->4 */
85 .scan_timing = 3,
86 .delay = 10,
87 .keycodes = {
88 KEY_PHONE, KEY_CLEAR, KEY_MAIL, KEY_WWW, KEY_ENTER,
89 KEY_1, KEY_2, KEY_3, 0, KEY_UP,
90 KEY_4, KEY_5, KEY_6, 0, KEY_LEFT,
91 KEY_7, KEY_8, KEY_9, KEY_PROG1, KEY_RIGHT,
92 KEY_S, KEY_0, KEY_P, KEY_PROG2, KEY_DOWN,
93 0, 0, 0, 0, 0
94 },
95};
96
97static struct resource kfr2r09_sh_keysc_resources[] = {
98 [0] = {
99 .name = "KEYSC",
100 .start = 0x044b0000,
101 .end = 0x044b000f,
102 .flags = IORESOURCE_MEM,
103 },
104 [1] = {
105 .start = 79,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110static struct platform_device kfr2r09_sh_keysc_device = {
111 .name = "sh_keysc",
112 .id = 0, /* "keysc0" clock */
113 .num_resources = ARRAY_SIZE(kfr2r09_sh_keysc_resources),
114 .resource = kfr2r09_sh_keysc_resources,
115 .dev = {
116 .platform_data = &kfr2r09_sh_keysc_info,
117 },
118 .archdata = {
119 .hwblk_id = HWBLK_KEYSC,
120 },
121};
122
123static struct sh_mobile_lcdc_info kfr2r09_sh_lcdc_info = {
124 .clock_source = LCDC_CLK_BUS,
125 .ch[0] = {
126 .chan = LCDC_CHAN_MAINLCD,
127 .bpp = 16,
128 .interface_type = SYS18,
129 .clock_divider = 6,
130 .flags = LCDC_FLAGS_DWPOL,
131 .lcd_cfg = {
132 .name = "TX07D34VM0AAA",
133 .xres = 240,
134 .yres = 400,
135 .left_margin = 0,
136 .right_margin = 16,
137 .hsync_len = 8,
138 .upper_margin = 0,
139 .lower_margin = 1,
140 .vsync_len = 1,
141 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
142 },
143 .lcd_size_cfg = {
144 .width = 35,
145 .height = 58,
146 },
147 .board_cfg = {
148 .setup_sys = kfr2r09_lcd_setup,
149 .display_on = kfr2r09_lcd_on,
150 .display_off = kfr2r09_lcd_off,
151 },
152 .sys_bus_cfg = {
153 .ldmt2r = 0x07010904,
154 .ldmt3r = 0x14012914,
155 /* set 1s delay to encourage fsync() */
156 .deferred_io_msec = 1000,
157 },
158 }
159};
160
161static struct resource kfr2r09_sh_lcdc_resources[] = {
162 [0] = {
163 .name = "LCDC",
164 .start = 0xfe940000, /* P4-only space */
165 .end = 0xfe942fff,
166 .flags = IORESOURCE_MEM,
167 },
168 [1] = {
169 .start = 106,
170 .flags = IORESOURCE_IRQ,
171 },
172};
173
174static struct platform_device kfr2r09_sh_lcdc_device = {
175 .name = "sh_mobile_lcdc_fb",
176 .num_resources = ARRAY_SIZE(kfr2r09_sh_lcdc_resources),
177 .resource = kfr2r09_sh_lcdc_resources,
178 .dev = {
179 .platform_data = &kfr2r09_sh_lcdc_info,
180 },
181 .archdata = {
182 .hwblk_id = HWBLK_LCDC,
183 },
184};
185
186static struct r8a66597_platdata kfr2r09_usb0_gadget_data = {
187 .on_chip = 1,
188};
189
190static struct resource kfr2r09_usb0_gadget_resources[] = {
191 [0] = {
192 .start = 0x04d80000,
193 .end = 0x04d80123,
194 .flags = IORESOURCE_MEM,
195 },
196 [1] = {
197 .start = 65,
198 .end = 65,
199 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
200 },
201};
202
203static struct platform_device kfr2r09_usb0_gadget_device = {
204 .name = "r8a66597_udc",
205 .id = 0,
206 .dev = {
207 .dma_mask = NULL, /* not use dma */
208 .coherent_dma_mask = 0xffffffff,
209 .platform_data = &kfr2r09_usb0_gadget_data,
210 },
211 .num_resources = ARRAY_SIZE(kfr2r09_usb0_gadget_resources),
212 .resource = kfr2r09_usb0_gadget_resources,
213};
214
215static struct platform_device *kfr2r09_devices[] __initdata = {
216 &kfr2r09_nor_flash_device,
217 &kfr2r09_nand_flash_device,
218 &kfr2r09_sh_keysc_device,
219 &kfr2r09_sh_lcdc_device,
220};
221
222#define BSC_CS0BCR 0xfec10004
223#define BSC_CS0WCR 0xfec10024
224#define BSC_CS4BCR 0xfec10010
225#define BSC_CS4WCR 0xfec10030
226#define PORT_MSELCRB 0xa4050182
227
228#ifdef CONFIG_I2C
229static int kfr2r09_usb0_gadget_i2c_setup(void)
230{
231 struct i2c_adapter *a;
232 struct i2c_msg msg;
233 unsigned char buf[2];
234 int ret;
235
236 a = i2c_get_adapter(0);
237 if (!a)
238 return -ENODEV;
239
240 /* set bit 1 (the second bit) of chip at 0x09, register 0x13 */
241 buf[0] = 0x13;
242 msg.addr = 0x09;
243 msg.buf = buf;
244 msg.len = 1;
245 msg.flags = 0;
246 ret = i2c_transfer(a, &msg, 1);
247 if (ret != 1)
248 return -ENODEV;
249
250 buf[0] = 0;
251 msg.addr = 0x09;
252 msg.buf = buf;
253 msg.len = 1;
254 msg.flags = I2C_M_RD;
255 ret = i2c_transfer(a, &msg, 1);
256 if (ret != 1)
257 return -ENODEV;
258
259 buf[1] = buf[0] | (1 << 1);
260 buf[0] = 0x13;
261 msg.addr = 0x09;
262 msg.buf = buf;
263 msg.len = 2;
264 msg.flags = 0;
265 ret = i2c_transfer(a, &msg, 1);
266 if (ret != 1)
267 return -ENODEV;
268
269 return 0;
270}
271#else
272static int kfr2r09_usb0_gadget_i2c_setup(void)
273{
274 return -ENODEV;
275}
276#endif
277
278static int kfr2r09_usb0_gadget_setup(void)
279{
280 int plugged_in;
281
282 gpio_request(GPIO_PTN4, NULL); /* USB_DET */
283 gpio_direction_input(GPIO_PTN4);
284 plugged_in = gpio_get_value(GPIO_PTN4);
285 if (!plugged_in)
286 return -ENODEV; /* no cable plugged in */
287
288 if (kfr2r09_usb0_gadget_i2c_setup() != 0)
289 return -ENODEV; /* unable to configure using i2c */
290
291 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
292 gpio_request(GPIO_FN_PDSTATUS, NULL); /* R-standby disables USB clock */
293 gpio_request(GPIO_PTV6, NULL); /* USBCLK_ON */
294 gpio_direction_output(GPIO_PTV6, 1); /* USBCLK_ON = H */
295 msleep(20); /* wait 20ms to let the clock settle */
296 clk_enable(clk_get(NULL, "usb0"));
297 ctrl_outw(0x0600, 0xa40501d4);
298
299 return 0;
300}
301
302static int __init kfr2r09_devices_setup(void)
303{
304 /* enable SCIF1 serial port for YC401 console support */
305 gpio_request(GPIO_FN_SCIF1_RXD, NULL);
306 gpio_request(GPIO_FN_SCIF1_TXD, NULL);
307
308 /* setup NOR flash at CS0 */
309 ctrl_outl(0x36db0400, BSC_CS0BCR);
310 ctrl_outl(0x00000500, BSC_CS0WCR);
311
312 /* setup NAND flash at CS4 */
313 ctrl_outl(0x36db0400, BSC_CS4BCR);
314 ctrl_outl(0x00000500, BSC_CS4WCR);
315
316 /* setup KEYSC pins */
317 gpio_request(GPIO_FN_KEYOUT0, NULL);
318 gpio_request(GPIO_FN_KEYOUT1, NULL);
319 gpio_request(GPIO_FN_KEYOUT2, NULL);
320 gpio_request(GPIO_FN_KEYOUT3, NULL);
321 gpio_request(GPIO_FN_KEYOUT4_IN6, NULL);
322 gpio_request(GPIO_FN_KEYIN0, NULL);
323 gpio_request(GPIO_FN_KEYIN1, NULL);
324 gpio_request(GPIO_FN_KEYIN2, NULL);
325 gpio_request(GPIO_FN_KEYIN3, NULL);
326 gpio_request(GPIO_FN_KEYIN4, NULL);
327 gpio_request(GPIO_FN_KEYOUT5_IN5, NULL);
328
329 /* setup LCDC pins for SYS panel */
330 gpio_request(GPIO_FN_LCDD17, NULL);
331 gpio_request(GPIO_FN_LCDD16, NULL);
332 gpio_request(GPIO_FN_LCDD15, NULL);
333 gpio_request(GPIO_FN_LCDD14, NULL);
334 gpio_request(GPIO_FN_LCDD13, NULL);
335 gpio_request(GPIO_FN_LCDD12, NULL);
336 gpio_request(GPIO_FN_LCDD11, NULL);
337 gpio_request(GPIO_FN_LCDD10, NULL);
338 gpio_request(GPIO_FN_LCDD9, NULL);
339 gpio_request(GPIO_FN_LCDD8, NULL);
340 gpio_request(GPIO_FN_LCDD7, NULL);
341 gpio_request(GPIO_FN_LCDD6, NULL);
342 gpio_request(GPIO_FN_LCDD5, NULL);
343 gpio_request(GPIO_FN_LCDD4, NULL);
344 gpio_request(GPIO_FN_LCDD3, NULL);
345 gpio_request(GPIO_FN_LCDD2, NULL);
346 gpio_request(GPIO_FN_LCDD1, NULL);
347 gpio_request(GPIO_FN_LCDD0, NULL);
348 gpio_request(GPIO_FN_LCDRS, NULL); /* LCD_RS */
349 gpio_request(GPIO_FN_LCDCS, NULL); /* LCD_CS/ */
350 gpio_request(GPIO_FN_LCDRD, NULL); /* LCD_RD/ */
351 gpio_request(GPIO_FN_LCDWR, NULL); /* LCD_WR/ */
352 gpio_request(GPIO_FN_LCDVSYN, NULL); /* LCD_VSYNC */
353 gpio_request(GPIO_PTE4, NULL); /* LCD_RST/ */
354 gpio_direction_output(GPIO_PTE4, 1);
355 gpio_request(GPIO_PTF4, NULL); /* PROTECT/ */
356 gpio_direction_output(GPIO_PTF4, 1);
357 gpio_request(GPIO_PTU0, NULL); /* LEDSTDBY/ */
358 gpio_direction_output(GPIO_PTU0, 1);
359
360 /* setup USB function */
361 if (kfr2r09_usb0_gadget_setup() == 0)
362 platform_device_register(&kfr2r09_usb0_gadget_device);
363
364 return platform_add_devices(kfr2r09_devices,
365 ARRAY_SIZE(kfr2r09_devices));
366}
367device_initcall(kfr2r09_devices_setup);
368
369/* Return the board specific boot mode pin configuration */
370static int kfr2r09_mode_pins(void)
371{
372 /* MD0=1, MD1=1, MD2=0: Clock Mode 3
373 * MD3=0: 16-bit Area0 Bus Width
374 * MD5=1: Little Endian
375 * MD8=1: Test Mode Disabled
376 */
377 return MODE_PIN0 | MODE_PIN1 | MODE_PIN5 | MODE_PIN8;
378}
379
380/*
381 * The Machine Vector
382 */
383static struct sh_machine_vector mv_kfr2r09 __initmv = {
384 .mv_name = "kfr2r09",
385 .mv_mode_pins = kfr2r09_mode_pins,
386};
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index f9b2e4df35b..6ed1fd32369 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -98,6 +98,9 @@ static struct platform_device sh_keysc_device = {
98 .dev = { 98 .dev = {
99 .platform_data = &sh_keysc_info, 99 .platform_data = &sh_keysc_info,
100 }, 100 },
101 .archdata = {
102 .hwblk_id = HWBLK_KEYSC,
103 },
101}; 104};
102 105
103static struct mtd_partition migor_nor_flash_partitions[] = 106static struct mtd_partition migor_nor_flash_partitions[] =
@@ -276,7 +279,7 @@ static struct resource migor_lcdc_resources[] = {
276 [0] = { 279 [0] = {
277 .name = "LCDC", 280 .name = "LCDC",
278 .start = 0xfe940000, /* P4-only space */ 281 .start = 0xfe940000, /* P4-only space */
279 .end = 0xfe941fff, 282 .end = 0xfe942fff,
280 .flags = IORESOURCE_MEM, 283 .flags = IORESOURCE_MEM,
281 }, 284 },
282 [1] = { 285 [1] = {
@@ -292,6 +295,9 @@ static struct platform_device migor_lcdc_device = {
292 .dev = { 295 .dev = {
293 .platform_data = &sh_mobile_lcdc_info, 296 .platform_data = &sh_mobile_lcdc_info,
294 }, 297 },
298 .archdata = {
299 .hwblk_id = HWBLK_LCDC,
300 },
295}; 301};
296 302
297static struct clk *camera_clk; 303static struct clk *camera_clk;
@@ -379,6 +385,9 @@ static struct platform_device migor_ceu_device = {
379 .dev = { 385 .dev = {
380 .platform_data = &sh_mobile_ceu_info, 386 .platform_data = &sh_mobile_ceu_info,
381 }, 387 },
388 .archdata = {
389 .hwblk_id = HWBLK_CEU,
390 },
382}; 391};
383 392
384struct spi_gpio_platform_data sdcard_cn9_platform_data = { 393struct spi_gpio_platform_data sdcard_cn9_platform_data = {
diff --git a/arch/sh/boards/mach-se/7722/setup.c b/arch/sh/boards/mach-se/7722/setup.c
index af84904ed86..36374078e52 100644
--- a/arch/sh/boards/mach-se/7722/setup.c
+++ b/arch/sh/boards/mach-se/7722/setup.c
@@ -22,6 +22,7 @@
22#include <asm/io.h> 22#include <asm/io.h>
23#include <asm/heartbeat.h> 23#include <asm/heartbeat.h>
24#include <asm/sh_keysc.h> 24#include <asm/sh_keysc.h>
25#include <cpu/sh7722.h>
25 26
26/* Heartbeat */ 27/* Heartbeat */
27static struct heartbeat_data heartbeat_data = { 28static struct heartbeat_data heartbeat_data = {
@@ -137,6 +138,9 @@ static struct platform_device sh_keysc_device = {
137 .dev = { 138 .dev = {
138 .platform_data = &sh_keysc_info, 139 .platform_data = &sh_keysc_info,
139 }, 140 },
141 .archdata = {
142 .hwblk_id = HWBLK_KEYSC,
143 },
140}; 144};
141 145
142static struct platform_device *se7722_devices[] __initdata = { 146static struct platform_device *se7722_devices[] __initdata = {
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 15456a0773b..00973e0f8c6 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -39,7 +39,15 @@
39 * SW41 : abxx xxxx -> a = 0 : Analog monitor 39 * SW41 : abxx xxxx -> a = 0 : Analog monitor
40 * 1 : Digital monitor 40 * 1 : Digital monitor
41 * b = 0 : VGA 41 * b = 0 : VGA
42 * 1 : SVGA 42 * 1 : 720p
43 */
44
45/*
46 * about 720p
47 *
48 * When you use 1280 x 720 lcdc output,
49 * you should change OSC6 lcdc clock from 25.175MHz to 74.25MHz,
50 * and change SW41 to use 720p
43 */ 51 */
44 52
45/* Heartbeat */ 53/* Heartbeat */
@@ -158,7 +166,7 @@ static struct resource lcdc_resources[] = {
158 [0] = { 166 [0] = {
159 .name = "LCDC", 167 .name = "LCDC",
160 .start = 0xfe940000, 168 .start = 0xfe940000,
161 .end = 0xfe941fff, 169 .end = 0xfe942fff,
162 .flags = IORESOURCE_MEM, 170 .flags = IORESOURCE_MEM,
163 }, 171 },
164 [1] = { 172 [1] = {
@@ -174,6 +182,9 @@ static struct platform_device lcdc_device = {
174 .dev = { 182 .dev = {
175 .platform_data = &lcdc_info, 183 .platform_data = &lcdc_info,
176 }, 184 },
185 .archdata = {
186 .hwblk_id = HWBLK_LCDC,
187 },
177}; 188};
178 189
179/* CEU0 */ 190/* CEU0 */
@@ -205,6 +216,9 @@ static struct platform_device ceu0_device = {
205 .dev = { 216 .dev = {
206 .platform_data = &sh_mobile_ceu0_info, 217 .platform_data = &sh_mobile_ceu0_info,
207 }, 218 },
219 .archdata = {
220 .hwblk_id = HWBLK_CEU0,
221 },
208}; 222};
209 223
210/* CEU1 */ 224/* CEU1 */
@@ -236,6 +250,9 @@ static struct platform_device ceu1_device = {
236 .dev = { 250 .dev = {
237 .platform_data = &sh_mobile_ceu1_info, 251 .platform_data = &sh_mobile_ceu1_info,
238 }, 252 },
253 .archdata = {
254 .hwblk_id = HWBLK_CEU1,
255 },
239}; 256};
240 257
241/* KEYSC in SoC (Needs SW33-2 set to ON) */ 258/* KEYSC in SoC (Needs SW33-2 set to ON) */
@@ -274,6 +291,9 @@ static struct platform_device keysc_device = {
274 .dev = { 291 .dev = {
275 .platform_data = &keysc_info, 292 .platform_data = &keysc_info,
276 }, 293 },
294 .archdata = {
295 .hwblk_id = HWBLK_KEYSC,
296 },
277}; 297};
278 298
279/* SH Eth */ 299/* SH Eth */
@@ -302,15 +322,19 @@ static struct platform_device sh_eth_device = {
302 }, 322 },
303 .num_resources = ARRAY_SIZE(sh_eth_resources), 323 .num_resources = ARRAY_SIZE(sh_eth_resources),
304 .resource = sh_eth_resources, 324 .resource = sh_eth_resources,
325 .archdata = {
326 .hwblk_id = HWBLK_ETHER,
327 },
305}; 328};
306 329
307static struct r8a66597_platdata sh7724_usb0_host_data = { 330static struct r8a66597_platdata sh7724_usb0_host_data = {
331 .on_chip = 1,
308}; 332};
309 333
310static struct resource sh7724_usb0_host_resources[] = { 334static struct resource sh7724_usb0_host_resources[] = {
311 [0] = { 335 [0] = {
312 .start = 0xa4d80000, 336 .start = 0xa4d80000,
313 .end = 0xa4d800ff, 337 .end = 0xa4d80124 - 1,
314 .flags = IORESOURCE_MEM, 338 .flags = IORESOURCE_MEM,
315 }, 339 },
316 [1] = { 340 [1] = {
@@ -330,6 +354,38 @@ static struct platform_device sh7724_usb0_host_device = {
330 }, 354 },
331 .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources), 355 .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources),
332 .resource = sh7724_usb0_host_resources, 356 .resource = sh7724_usb0_host_resources,
357 .archdata = {
358 .hwblk_id = HWBLK_USB0,
359 },
360};
361
362static struct r8a66597_platdata sh7724_usb1_gadget_data = {
363 .on_chip = 1,
364};
365
366static struct resource sh7724_usb1_gadget_resources[] = {
367 [0] = {
368 .start = 0xa4d90000,
369 .end = 0xa4d90123,
370 .flags = IORESOURCE_MEM,
371 },
372 [1] = {
373 .start = 66,
374 .end = 66,
375 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW,
376 },
377};
378
379static struct platform_device sh7724_usb1_gadget_device = {
380 .name = "r8a66597_udc",
381 .id = 1, /* USB1 */
382 .dev = {
383 .dma_mask = NULL, /* not use dma */
384 .coherent_dma_mask = 0xffffffff,
385 .platform_data = &sh7724_usb1_gadget_data,
386 },
387 .num_resources = ARRAY_SIZE(sh7724_usb1_gadget_resources),
388 .resource = sh7724_usb1_gadget_resources,
333}; 389};
334 390
335static struct platform_device *ms7724se_devices[] __initdata = { 391static struct platform_device *ms7724se_devices[] __initdata = {
@@ -342,6 +398,7 @@ static struct platform_device *ms7724se_devices[] __initdata = {
342 &keysc_device, 398 &keysc_device,
343 &sh_eth_device, 399 &sh_eth_device,
344 &sh7724_usb0_host_device, 400 &sh7724_usb0_host_device,
401 &sh7724_usb1_gadget_device,
345}; 402};
346 403
347#define EEPROM_OP 0xBA206000 404#define EEPROM_OP 0xBA206000
@@ -421,9 +478,38 @@ static int __init devices_setup(void)
421 /* turn on USB clocks, use external clock */ 478 /* turn on USB clocks, use external clock */
422 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); 479 ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB);
423 480
481#ifdef CONFIG_PM
482 /* Let LED9 show STATUS2 */
483 gpio_request(GPIO_FN_STATUS2, NULL);
484
485 /* Lit LED10 show STATUS0 */
486 gpio_request(GPIO_FN_STATUS0, NULL);
487
488 /* Lit LED11 show PDSTATUS */
489 gpio_request(GPIO_FN_PDSTATUS, NULL);
490#else
491 /* Lit LED9 */
492 gpio_request(GPIO_PTJ6, NULL);
493 gpio_direction_output(GPIO_PTJ6, 1);
494 gpio_export(GPIO_PTJ6, 0);
495
496 /* Lit LED10 */
497 gpio_request(GPIO_PTJ5, NULL);
498 gpio_direction_output(GPIO_PTJ5, 1);
499 gpio_export(GPIO_PTJ5, 0);
500
501 /* Lit LED11 */
502 gpio_request(GPIO_PTJ7, NULL);
503 gpio_direction_output(GPIO_PTJ7, 1);
504 gpio_export(GPIO_PTJ7, 0);
505#endif
506
424 /* enable USB0 port */ 507 /* enable USB0 port */
425 ctrl_outw(0x0600, 0xa40501d4); 508 ctrl_outw(0x0600, 0xa40501d4);
426 509
510 /* enable USB1 port */
511 ctrl_outw(0x0600, 0xa4050192);
512
427 /* enable IRQ 0,1,2 */ 513 /* enable IRQ 0,1,2 */
428 gpio_request(GPIO_FN_INTC_IRQ0, NULL); 514 gpio_request(GPIO_FN_INTC_IRQ0, NULL);
429 gpio_request(GPIO_FN_INTC_IRQ1, NULL); 515 gpio_request(GPIO_FN_INTC_IRQ1, NULL);
@@ -546,15 +632,15 @@ static int __init devices_setup(void)
546 sh_eth_init(); 632 sh_eth_init();
547 633
548 if (sw & SW41_B) { 634 if (sw & SW41_B) {
549 /* SVGA */ 635 /* 720p */
550 lcdc_info.ch[0].lcd_cfg.xres = 800; 636 lcdc_info.ch[0].lcd_cfg.xres = 1280;
551 lcdc_info.ch[0].lcd_cfg.yres = 600; 637 lcdc_info.ch[0].lcd_cfg.yres = 720;
552 lcdc_info.ch[0].lcd_cfg.left_margin = 142; 638 lcdc_info.ch[0].lcd_cfg.left_margin = 220;
553 lcdc_info.ch[0].lcd_cfg.right_margin = 52; 639 lcdc_info.ch[0].lcd_cfg.right_margin = 110;
554 lcdc_info.ch[0].lcd_cfg.hsync_len = 96; 640 lcdc_info.ch[0].lcd_cfg.hsync_len = 40;
555 lcdc_info.ch[0].lcd_cfg.upper_margin = 24; 641 lcdc_info.ch[0].lcd_cfg.upper_margin = 20;
556 lcdc_info.ch[0].lcd_cfg.lower_margin = 2; 642 lcdc_info.ch[0].lcd_cfg.lower_margin = 5;
557 lcdc_info.ch[0].lcd_cfg.vsync_len = 2; 643 lcdc_info.ch[0].lcd_cfg.vsync_len = 5;
558 } else { 644 } else {
559 /* VGA */ 645 /* VGA */
560 lcdc_info.ch[0].lcd_cfg.xres = 640; 646 lcdc_info.ch[0].lcd_cfg.xres = 640;
diff --git a/arch/sh/boards/mach-x3proto/setup.c b/arch/sh/boards/mach-x3proto/setup.c
index 8913ae39a80..efe4cb9f8a7 100644
--- a/arch/sh/boards/mach-x3proto/setup.c
+++ b/arch/sh/boards/mach-x3proto/setup.c
@@ -17,6 +17,7 @@
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/usb/r8a66597.h> 19#include <linux/usb/r8a66597.h>
20#include <linux/usb/m66592.h>
20#include <asm/ilsel.h> 21#include <asm/ilsel.h>
21 22
22static struct resource heartbeat_resources[] = { 23static struct resource heartbeat_resources[] = {
@@ -89,6 +90,11 @@ static struct platform_device r8a66597_usb_host_device = {
89 .resource = r8a66597_usb_host_resources, 90 .resource = r8a66597_usb_host_resources,
90}; 91};
91 92
93static struct m66592_platdata usbf_platdata = {
94 .xtal = M66592_PLATDATA_XTAL_24MHZ,
95 .vif = 1,
96};
97
92static struct resource m66592_usb_peripheral_resources[] = { 98static struct resource m66592_usb_peripheral_resources[] = {
93 [0] = { 99 [0] = {
94 .name = "m66592_udc", 100 .name = "m66592_udc",
@@ -109,6 +115,7 @@ static struct platform_device m66592_usb_peripheral_device = {
109 .dev = { 115 .dev = {
110 .dma_mask = NULL, /* don't use dma */ 116 .dma_mask = NULL, /* don't use dma */
111 .coherent_dma_mask = 0xffffffff, 117 .coherent_dma_mask = 0xffffffff,
118 .platform_data = &usbf_platdata,
112 }, 119 },
113 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources), 120 .num_resources = ARRAY_SIZE(m66592_usb_peripheral_resources),
114 .resource = m66592_usb_peripheral_resources, 121 .resource = m66592_usb_peripheral_resources,
diff --git a/arch/sh/boot/.gitignore b/arch/sh/boot/.gitignore
index aad5edddf93..541087d2029 100644
--- a/arch/sh/boot/.gitignore
+++ b/arch/sh/boot/.gitignore
@@ -1,4 +1,3 @@
1zImage 1zImage
2vmlinux.srec 2vmlinux*
3uImage 3uImage*
4uImage.srec
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 78efb04c28f..a1316872be6 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -20,8 +20,13 @@ CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000
21CONFIG_ENTRY_OFFSET ?= 0x00001000 21CONFIG_ENTRY_OFFSET ?= 0x00001000
22 22
23targets := zImage vmlinux.srec uImage uImage.srec 23suffix-$(CONFIG_KERNEL_GZIP) := gz
24subdir- := compressed 24suffix-$(CONFIG_KERNEL_BZIP2) := bz2
25suffix-$(CONFIG_KERNEL_LZMA) := lzma
26
27targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma
28extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
29subdir- := compressed romimage
25 30
26$(obj)/zImage: $(obj)/compressed/vmlinux FORCE 31$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
27 $(call if_changed,objcopy) 32 $(call if_changed,objcopy)
@@ -30,6 +35,13 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
30$(obj)/compressed/vmlinux: FORCE 35$(obj)/compressed/vmlinux: FORCE
31 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 36 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
32 37
38$(obj)/romImage: $(obj)/romimage/vmlinux FORCE
39 $(call if_changed,objcopy)
40 @echo ' Kernel: $@ is ready'
41
42$(obj)/romimage/vmlinux: $(obj)/zImage FORCE
43 $(Q)$(MAKE) $(build)=$(obj)/romimage $@
44
33KERNEL_MEMORY := 0x00000000 45KERNEL_MEMORY := 0x00000000
34ifeq ($(CONFIG_PMB_FIXED),y) 46ifeq ($(CONFIG_PMB_FIXED),y)
35KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \ 47KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
@@ -40,9 +52,6 @@ KERNEL_MEMORY := $(shell /bin/bash -c 'printf "0x%08x" \
40 $$[$(CONFIG_MEMORY_START)]') 52 $$[$(CONFIG_MEMORY_START)]')
41endif 53endif
42 54
43export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
44 CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY
45
46KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \ 55KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%08x" \
47 $$[$(CONFIG_PAGE_OFFSET) + \ 56 $$[$(CONFIG_PAGE_OFFSET) + \
48 $(KERNEL_MEMORY) + \ 57 $(KERNEL_MEMORY) + \
@@ -55,19 +64,30 @@ KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
55 64
56quiet_cmd_uimage = UIMAGE $@ 65quiet_cmd_uimage = UIMAGE $@
57 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ 66 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
58 -C gzip -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \ 67 -C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
59 -n 'Linux-$(KERNELRELEASE)' -d $< $@ 68 -n 'Linux-$(KERNELRELEASE)' -d $< $@
60 69
61$(obj)/uImage: $(obj)/vmlinux.bin.gz FORCE
62 $(call if_changed,uimage)
63 @echo ' Image $@ is ready'
64
65$(obj)/vmlinux.bin: vmlinux FORCE 70$(obj)/vmlinux.bin: vmlinux FORCE
66 $(call if_changed,objcopy) 71 $(call if_changed,objcopy)
67 72
68$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 73$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
69 $(call if_changed,gzip) 74 $(call if_changed,gzip)
70 75
76$(obj)/vmlinux.bin.bz2: $(obj)/vmlinux.bin FORCE
77 $(call if_changed,bzip2)
78
79$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
80 $(call if_changed,lzma)
81
82$(obj)/uImage.bz2: $(obj)/vmlinux.bin.bz2
83 $(call if_changed,uimage,bzip2)
84
85$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
86 $(call if_changed,uimage,gzip)
87
88$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
89 $(call if_changed,uimage,lzma)
90
71OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec 91OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
72$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux 92$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
73 $(call if_changed,objcopy) 93 $(call if_changed,objcopy)
@@ -76,5 +96,9 @@ OBJCOPYFLAGS_uImage.srec := -I binary -O srec
76$(obj)/uImage.srec: $(obj)/uImage 96$(obj)/uImage.srec: $(obj)/uImage
77 $(call if_changed,objcopy) 97 $(call if_changed,objcopy)
78 98
79clean-files += uImage uImage.srec vmlinux.srec \ 99$(obj)/uImage: $(obj)/uImage.$(suffix-y)
80 vmlinux.bin vmlinux.bin.gz 100 @ln -sf $(notdir $<) $@
101 @echo ' Image $@ is ready'
102
103export CONFIG_PAGE_OFFSET CONFIG_MEMORY_START CONFIG_BOOT_LINK_OFFSET \
104 CONFIG_ZERO_PAGE_OFFSET CONFIG_ENTRY_OFFSET KERNEL_MEMORY suffix-y
diff --git a/arch/sh/boot/compressed/.gitignore b/arch/sh/boot/compressed/.gitignore
new file mode 100644
index 00000000000..2374a83d87b
--- /dev/null
+++ b/arch/sh/boot/compressed/.gitignore
@@ -0,0 +1 @@
vmlinux.bin.*
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index 9531bf1b7c2..6182eca5180 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -5,9 +5,10 @@
5# 5#
6 6
7targets := vmlinux vmlinux.bin vmlinux.bin.gz \ 7targets := vmlinux vmlinux.bin vmlinux.bin.gz \
8 head_$(BITS).o misc_$(BITS).o piggy.o 8 vmlinux.bin.bz2 vmlinux.bin.lzma \
9 head_$(BITS).o misc.o piggy.o
9 10
10OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc_$(BITS).o $(obj)/cache.o 11OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o
11 12
12ifdef CONFIG_SH_STANDARD_BIOS 13ifdef CONFIG_SH_STANDARD_BIOS
13OBJECTS += $(obj)/../../kernel/sh_bios.o 14OBJECTS += $(obj)/../../kernel/sh_bios.o
@@ -23,7 +24,7 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
23 24
24LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 25LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
25 26
26ifeq ($(CONFIG_FUNCTION_TRACER),y) 27ifeq ($(CONFIG_MCOUNT),y)
27ORIG_CFLAGS := $(KBUILD_CFLAGS) 28ORIG_CFLAGS := $(KBUILD_CFLAGS)
28KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 29KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
29endif 30endif
@@ -38,10 +39,18 @@ $(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
38$(obj)/vmlinux.bin: vmlinux FORCE 39$(obj)/vmlinux.bin: vmlinux FORCE
39 $(call if_changed,objcopy) 40 $(call if_changed,objcopy)
40 41
41$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE 42vmlinux.bin.all-y := $(obj)/vmlinux.bin
43
44$(obj)/vmlinux.bin.gz: $(vmlinux.bin.all-y) FORCE
42 $(call if_changed,gzip) 45 $(call if_changed,gzip)
46$(obj)/vmlinux.bin.bz2: $(vmlinux.bin.all-y) FORCE
47 $(call if_changed,bzip2)
48$(obj)/vmlinux.bin.lzma: $(vmlinux.bin.all-y) FORCE
49 $(call if_changed,lzma)
43 50
44OBJCOPYFLAGS += -R .empty_zero_page 51OBJCOPYFLAGS += -R .empty_zero_page
45 52
46$(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE 53LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
47 $(call if_changed,as_o_S) 54
55$(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE
56 $(call if_changed,ld)
diff --git a/arch/sh/boot/compressed/head_32.S b/arch/sh/boot/compressed/head_32.S
index 06ac31f3be8..02a30935f0b 100644
--- a/arch/sh/boot/compressed/head_32.S
+++ b/arch/sh/boot/compressed/head_32.S
@@ -22,7 +22,7 @@ startup:
22 bt clear_bss 22 bt clear_bss
23 sub r0, r2 23 sub r0, r2
24 mov.l bss_start_addr, r0 24 mov.l bss_start_addr, r0
25 mov #0xe0, r1 25 mov #0xffffffe0, r1
26 and r1, r0 ! align cache line 26 and r1, r0 ! align cache line
27 mov.l text_start_addr, r3 27 mov.l text_start_addr, r3
28 mov r0, r1 28 mov r0, r1
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c
new file mode 100644
index 00000000000..fd56a71ca9d
--- /dev/null
+++ b/arch/sh/boot/compressed/misc.c
@@ -0,0 +1,149 @@
1/*
2 * arch/sh/boot/compressed/misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for SH by Stuart Menefy, Aug 1999
10 *
11 * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
12 */
13
14#include <asm/uaccess.h>
15#include <asm/addrspace.h>
16#include <asm/page.h>
17#include <asm/sh_bios.h>
18
19/*
20 * gzip declarations
21 */
22
23#define STATIC static
24
25#undef memset
26#undef memcpy
27#define memzero(s, n) memset ((s), 0, (n))
28
29/* cache.c */
30#define CACHE_ENABLE 0
31#define CACHE_DISABLE 1
32int cache_control(unsigned int command);
33
34extern char input_data[];
35extern int input_len;
36static unsigned char *output;
37
38static void error(char *m);
39
40int puts(const char *);
41
42extern int _text; /* Defined in vmlinux.lds.S */
43extern int _end;
44static unsigned long free_mem_ptr;
45static unsigned long free_mem_end_ptr;
46
47#ifdef CONFIG_HAVE_KERNEL_BZIP2
48#define HEAP_SIZE 0x400000
49#else
50#define HEAP_SIZE 0x10000
51#endif
52
53#ifdef CONFIG_KERNEL_GZIP
54#include "../../../../lib/decompress_inflate.c"
55#endif
56
57#ifdef CONFIG_KERNEL_BZIP2
58#include "../../../../lib/decompress_bunzip2.c"
59#endif
60
61#ifdef CONFIG_KERNEL_LZMA
62#include "../../../../lib/decompress_unlzma.c"
63#endif
64
65#ifdef CONFIG_SH_STANDARD_BIOS
66size_t strlen(const char *s)
67{
68 int i = 0;
69
70 while (*s++)
71 i++;
72 return i;
73}
74
75int puts(const char *s)
76{
77 int len = strlen(s);
78 sh_bios_console_write(s, len);
79 return len;
80}
81#else
82int puts(const char *s)
83{
84 /* This should be updated to use the sh-sci routines */
85 return 0;
86}
87#endif
88
89void* memset(void* s, int c, size_t n)
90{
91 int i;
92 char *ss = (char*)s;
93
94 for (i=0;i<n;i++) ss[i] = c;
95 return s;
96}
97
98void* memcpy(void* __dest, __const void* __src,
99 size_t __n)
100{
101 int i;
102 char *d = (char *)__dest, *s = (char *)__src;
103
104 for (i=0;i<__n;i++) d[i] = s[i];
105 return __dest;
106}
107
108static void error(char *x)
109{
110 puts("\n\n");
111 puts(x);
112 puts("\n\n -- System halted");
113
114 while(1); /* Halt */
115}
116
117#ifdef CONFIG_SUPERH64
118#define stackalign 8
119#else
120#define stackalign 4
121#endif
122
123#define STACK_SIZE (4096)
124long __attribute__ ((aligned(stackalign))) user_stack[STACK_SIZE];
125long *stack_start = &user_stack[STACK_SIZE];
126
127void decompress_kernel(void)
128{
129 unsigned long output_addr;
130
131#ifdef CONFIG_SUPERH64
132 output_addr = (CONFIG_MEMORY_START + 0x2000);
133#else
134 output_addr = PHYSADDR((unsigned long)&_text+PAGE_SIZE);
135#ifdef CONFIG_29BIT
136 output_addr |= P2SEG;
137#endif
138#endif
139
140 output = (unsigned char *)output_addr;
141 free_mem_ptr = (unsigned long)&_end;
142 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
143
144 puts("Uncompressing Linux... ");
145 cache_control(CACHE_ENABLE);
146 decompress(input_data, input_len, NULL, NULL, output, NULL, error);
147 cache_control(CACHE_DISABLE);
148 puts("Ok, booting the kernel.\n");
149}
diff --git a/arch/sh/boot/compressed/misc_32.c b/arch/sh/boot/compressed/misc_32.c
deleted file mode 100644
index efdba6b2957..00000000000
--- a/arch/sh/boot/compressed/misc_32.c
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 * arch/sh/boot/compressed/misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for SH by Stuart Menefy, Aug 1999
10 *
11 * Modified to use standard LinuxSH BIOS by Greg Banks 7Jul2000
12 */
13
14#include <asm/uaccess.h>
15#include <asm/addrspace.h>
16#include <asm/page.h>
17#ifdef CONFIG_SH_STANDARD_BIOS
18#include <asm/sh_bios.h>
19#endif
20
21/*
22 * gzip declarations
23 */
24
25#define OF(args) args
26#define STATIC static
27
28#undef memset
29#undef memcpy
30#define memzero(s, n) memset ((s), 0, (n))
31
32typedef unsigned char uch;
33typedef unsigned short ush;
34typedef unsigned long ulg;
35
36#define WSIZE 0x8000 /* Window size must be at least 32k, */
37 /* and a power of two */
38
39static uch *inbuf; /* input buffer */
40static uch window[WSIZE]; /* Sliding window buffer */
41
42static unsigned insize = 0; /* valid bytes in inbuf */
43static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
44static unsigned outcnt = 0; /* bytes in output buffer */
45
46/* gzip flag byte */
47#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
48#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
49#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
50#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
51#define COMMENT 0x10 /* bit 4 set: file comment present */
52#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
53#define RESERVED 0xC0 /* bit 6,7: reserved */
54
55#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
56
57/* Diagnostic functions */
58#ifdef DEBUG
59# define Assert(cond,msg) {if(!(cond)) error(msg);}
60# define Trace(x) fprintf x
61# define Tracev(x) {if (verbose) fprintf x ;}
62# define Tracevv(x) {if (verbose>1) fprintf x ;}
63# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
64# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
65#else
66# define Assert(cond,msg)
67# define Trace(x)
68# define Tracev(x)
69# define Tracevv(x)
70# define Tracec(c,x)
71# define Tracecv(c,x)
72#endif
73
74static int fill_inbuf(void);
75static void flush_window(void);
76static void error(char *m);
77
78extern char input_data[];
79extern int input_len;
80
81static long bytes_out = 0;
82static uch *output_data;
83static unsigned long output_ptr = 0;
84
85static void error(char *m);
86
87int puts(const char *);
88
89extern int _text; /* Defined in vmlinux.lds.S */
90extern int _end;
91static unsigned long free_mem_ptr;
92static unsigned long free_mem_end_ptr;
93
94#define HEAP_SIZE 0x10000
95
96#include "../../../../lib/inflate.c"
97
98#ifdef CONFIG_SH_STANDARD_BIOS
99size_t strlen(const char *s)
100{
101 int i = 0;
102
103 while (*s++)
104 i++;
105 return i;
106}
107
108int puts(const char *s)
109{
110 int len = strlen(s);
111 sh_bios_console_write(s, len);
112 return len;
113}
114#else
115int puts(const char *s)
116{
117 /* This should be updated to use the sh-sci routines */
118 return 0;
119}
120#endif
121
122void* memset(void* s, int c, size_t n)
123{
124 int i;
125 char *ss = (char*)s;
126
127 for (i=0;i<n;i++) ss[i] = c;
128 return s;
129}
130
131void* memcpy(void* __dest, __const void* __src,
132 size_t __n)
133{
134 int i;
135 char *d = (char *)__dest, *s = (char *)__src;
136
137 for (i=0;i<__n;i++) d[i] = s[i];
138 return __dest;
139}
140
141/* ===========================================================================
142 * Fill the input buffer. This is called only when the buffer is empty
143 * and at least one byte is really needed.
144 */
145static int fill_inbuf(void)
146{
147 if (insize != 0) {
148 error("ran out of input data");
149 }
150
151 inbuf = input_data;
152 insize = input_len;
153 inptr = 1;
154 return inbuf[0];
155}
156
157/* ===========================================================================
158 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
159 * (Used for the decompressed data only.)
160 */
161static void flush_window(void)
162{
163 ulg c = crc; /* temporary variable */
164 unsigned n;
165 uch *in, *out, ch;
166
167 in = window;
168 out = &output_data[output_ptr];
169 for (n = 0; n < outcnt; n++) {
170 ch = *out++ = *in++;
171 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
172 }
173 crc = c;
174 bytes_out += (ulg)outcnt;
175 output_ptr += (ulg)outcnt;
176 outcnt = 0;
177}
178
179static void error(char *x)
180{
181 puts("\n\n");
182 puts(x);
183 puts("\n\n -- System halted");
184
185 while(1); /* Halt */
186}
187
188#define STACK_SIZE (4096)
189long user_stack [STACK_SIZE];
190long* stack_start = &user_stack[STACK_SIZE];
191
192void decompress_kernel(void)
193{
194 output_data = NULL;
195 output_ptr = PHYSADDR((unsigned long)&_text+PAGE_SIZE);
196#ifdef CONFIG_29BIT
197 output_ptr |= P2SEG;
198#endif
199 free_mem_ptr = (unsigned long)&_end;
200 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
201
202 makecrc();
203 puts("Uncompressing Linux... ");
204 gunzip();
205 puts("Ok, booting the kernel.\n");
206}
diff --git a/arch/sh/boot/compressed/misc_64.c b/arch/sh/boot/compressed/misc_64.c
deleted file mode 100644
index 2941657e18a..00000000000
--- a/arch/sh/boot/compressed/misc_64.c
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2 * arch/sh/boot/compressed/misc_64.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Adapted for SHmedia from sh by Stuart Menefy, May 2002
10 */
11
12#include <asm/uaccess.h>
13
14/* cache.c */
15#define CACHE_ENABLE 0
16#define CACHE_DISABLE 1
17int cache_control(unsigned int command);
18
19/*
20 * gzip declarations
21 */
22
23#define OF(args) args
24#define STATIC static
25
26#undef memset
27#undef memcpy
28#define memzero(s, n) memset ((s), 0, (n))
29
30typedef unsigned char uch;
31typedef unsigned short ush;
32typedef unsigned long ulg;
33
34#define WSIZE 0x8000 /* Window size must be at least 32k, */
35 /* and a power of two */
36
37static uch *inbuf; /* input buffer */
38static uch window[WSIZE]; /* Sliding window buffer */
39
40static unsigned insize = 0; /* valid bytes in inbuf */
41static unsigned inptr = 0; /* index of next byte to be processed in inbuf */
42static unsigned outcnt = 0; /* bytes in output buffer */
43
44/* gzip flag byte */
45#define ASCII_FLAG 0x01 /* bit 0 set: file probably ASCII text */
46#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
47#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
48#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
49#define COMMENT 0x10 /* bit 4 set: file comment present */
50#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
51#define RESERVED 0xC0 /* bit 6,7: reserved */
52
53#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
54
55/* Diagnostic functions */
56#ifdef DEBUG
57# define Assert(cond,msg) {if(!(cond)) error(msg);}
58# define Trace(x) fprintf x
59# define Tracev(x) {if (verbose) fprintf x ;}
60# define Tracevv(x) {if (verbose>1) fprintf x ;}
61# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
62# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
63#else
64# define Assert(cond,msg)
65# define Trace(x)
66# define Tracev(x)
67# define Tracevv(x)
68# define Tracec(c,x)
69# define Tracecv(c,x)
70#endif
71
72static int fill_inbuf(void);
73static void flush_window(void);
74static void error(char *m);
75
76extern char input_data[];
77extern int input_len;
78
79static long bytes_out = 0;
80static uch *output_data;
81static unsigned long output_ptr = 0;
82
83static void error(char *m);
84
85static void puts(const char *);
86
87extern int _text; /* Defined in vmlinux.lds.S */
88extern int _end;
89static unsigned long free_mem_ptr;
90static unsigned long free_mem_end_ptr;
91
92#define HEAP_SIZE 0x10000
93
94#include "../../../../lib/inflate.c"
95
96void puts(const char *s)
97{
98}
99
100void *memset(void *s, int c, size_t n)
101{
102 int i;
103 char *ss = (char *) s;
104
105 for (i = 0; i < n; i++)
106 ss[i] = c;
107 return s;
108}
109
110void *memcpy(void *__dest, __const void *__src, size_t __n)
111{
112 int i;
113 char *d = (char *) __dest, *s = (char *) __src;
114
115 for (i = 0; i < __n; i++)
116 d[i] = s[i];
117 return __dest;
118}
119
120/* ===========================================================================
121 * Fill the input buffer. This is called only when the buffer is empty
122 * and at least one byte is really needed.
123 */
124static int fill_inbuf(void)
125{
126 if (insize != 0) {
127 error("ran out of input data\n");
128 }
129
130 inbuf = input_data;
131 insize = input_len;
132 inptr = 1;
133 return inbuf[0];
134}
135
136/* ===========================================================================
137 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
138 * (Used for the decompressed data only.)
139 */
140static void flush_window(void)
141{
142 ulg c = crc; /* temporary variable */
143 unsigned n;
144 uch *in, *out, ch;
145
146 in = window;
147 out = &output_data[output_ptr];
148 for (n = 0; n < outcnt; n++) {
149 ch = *out++ = *in++;
150 c = crc_32_tab[((int) c ^ ch) & 0xff] ^ (c >> 8);
151 }
152 crc = c;
153 bytes_out += (ulg) outcnt;
154 output_ptr += (ulg) outcnt;
155 outcnt = 0;
156 puts(".");
157}
158
159static void error(char *x)
160{
161 puts("\n\n");
162 puts(x);
163 puts("\n\n -- System halted");
164
165 while (1) ; /* Halt */
166}
167
168#define STACK_SIZE (4096)
169long __attribute__ ((aligned(8))) user_stack[STACK_SIZE];
170long *stack_start = &user_stack[STACK_SIZE];
171
172void decompress_kernel(void)
173{
174 output_data = (uch *) (CONFIG_MEMORY_START + 0x2000);
175 free_mem_ptr = (unsigned long) &_end;
176 free_mem_end_ptr = free_mem_ptr + HEAP_SIZE;
177
178 makecrc();
179 puts("Uncompressing Linux... ");
180 cache_control(CACHE_ENABLE);
181 gunzip();
182 puts("\n");
183
184#if 0
185 /* When booting from ROM may want to do something like this if the
186 * boot loader doesn't.
187 */
188
189 /* Set up the parameters and command line */
190 {
191 volatile unsigned int *parambase =
192 (int *) (CONFIG_MEMORY_START + 0x1000);
193
194 parambase[0] = 0x1; /* MOUNT_ROOT_RDONLY */
195 parambase[1] = 0x0; /* RAMDISK_FLAGS */
196 parambase[2] = 0x0200; /* ORIG_ROOT_DEV */
197 parambase[3] = 0x0; /* LOADER_TYPE */
198 parambase[4] = 0x0; /* INITRD_START */
199 parambase[5] = 0x0; /* INITRD_SIZE */
200 parambase[6] = 0;
201
202 strcpy((char *) ((int) parambase + 0x100),
203 "console=ttySC0,38400");
204 }
205#endif
206
207 puts("Ok, booting the kernel.\n");
208
209 cache_control(CACHE_DISABLE);
210}
diff --git a/arch/sh/boot/compressed/piggy.S b/arch/sh/boot/compressed/piggy.S
deleted file mode 100644
index 566071926b1..00000000000
--- a/arch/sh/boot/compressed/piggy.S
+++ /dev/null
@@ -1,8 +0,0 @@
1 .global input_len, input_data
2 .data
3input_len:
4 .long input_data_end - input_data
5input_data:
6 .incbin "arch/sh/boot/compressed/vmlinux.bin.gz"
7input_data_end:
8 .end
diff --git a/arch/sh/boot/compressed/vmlinux.scr b/arch/sh/boot/compressed/vmlinux.scr
new file mode 100644
index 00000000000..f02382ae5c4
--- /dev/null
+++ b/arch/sh/boot/compressed/vmlinux.scr
@@ -0,0 +1,10 @@
1SECTIONS
2{
3 .rodata.compressed : {
4 input_len = .;
5 LONG(input_data_end - input_data) input_data = .;
6 *(.data)
7 output_len = . - 4;
8 input_data_end = .;
9 }
10}
diff --git a/arch/sh/boot/romimage/Makefile b/arch/sh/boot/romimage/Makefile
new file mode 100644
index 00000000000..5806eee84f6
--- /dev/null
+++ b/arch/sh/boot/romimage/Makefile
@@ -0,0 +1,19 @@
1#
2# linux/arch/sh/boot/romimage/Makefile
3#
4# create an image suitable for burning to flash from zImage
5#
6
7targets := vmlinux head.o
8
9OBJECTS = $(obj)/head.o
10LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext 0 -e romstart
11
12$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o FORCE
13 $(call if_changed,ld)
14 @:
15
16LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T
17
18$(obj)/piggy.o: $(obj)/vmlinux.scr arch/sh/boot/zImage FORCE
19 $(call if_changed,ld)
diff --git a/arch/sh/boot/romimage/head.S b/arch/sh/boot/romimage/head.S
new file mode 100644
index 00000000000..219bc626dd7
--- /dev/null
+++ b/arch/sh/boot/romimage/head.S
@@ -0,0 +1,10 @@
1/*
2 * linux/arch/sh/boot/romimage/head.S
3 *
4 * Board specific setup code, executed before zImage loader
5 */
6
7.text
8 .global romstart
9romstart:
10#include <mach/romimage.h>
diff --git a/arch/sh/boot/romimage/vmlinux.scr b/arch/sh/boot/romimage/vmlinux.scr
new file mode 100644
index 00000000000..287c08f8b4b
--- /dev/null
+++ b/arch/sh/boot/romimage/vmlinux.scr
@@ -0,0 +1,6 @@
1SECTIONS
2{
3 .text : {
4 *(.data)
5 }
6}
diff --git a/arch/sh/configs/ecovec24-romimage_defconfig b/arch/sh/configs/ecovec24-romimage_defconfig
new file mode 100644
index 00000000000..9a22c64775b
--- /dev/null
+++ b/arch/sh/configs/ecovec24-romimage_defconfig
@@ -0,0 +1,1032 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc7
4# Tue Sep 8 13:56:18 2009
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8# CONFIG_SUPERH64 is not set
9CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_BUG=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
18CONFIG_GENERIC_GPIO=y
19CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y
26CONFIG_LOCKDEP_SUPPORT=y
27CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U32 is not set
29# CONFIG_ARCH_HAS_ILOG2_U64 is not set
30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y
35
36#
37# General setup
38#
39CONFIG_EXPERIMENTAL=y
40CONFIG_BROKEN_ON_SMP=y
41CONFIG_INIT_ENV_ARG_LIMIT=32
42CONFIG_LOCALVERSION=""
43# CONFIG_LOCALVERSION_AUTO is not set
44CONFIG_HAVE_KERNEL_GZIP=y
45CONFIG_HAVE_KERNEL_BZIP2=y
46CONFIG_HAVE_KERNEL_LZMA=y
47CONFIG_KERNEL_GZIP=y
48# CONFIG_KERNEL_BZIP2 is not set
49# CONFIG_KERNEL_LZMA is not set
50CONFIG_SWAP=y
51CONFIG_SYSVIPC=y
52CONFIG_SYSVIPC_SYSCTL=y
53# CONFIG_POSIX_MQUEUE is not set
54CONFIG_BSD_PROCESS_ACCT=y
55# CONFIG_BSD_PROCESS_ACCT_V3 is not set
56# CONFIG_TASKSTATS is not set
57# CONFIG_AUDIT is not set
58
59#
60# RCU Subsystem
61#
62CONFIG_CLASSIC_RCU=y
63# CONFIG_TREE_RCU is not set
64# CONFIG_PREEMPT_RCU is not set
65# CONFIG_TREE_RCU_TRACE is not set
66# CONFIG_PREEMPT_RCU_TRACE is not set
67CONFIG_IKCONFIG=y
68CONFIG_IKCONFIG_PROC=y
69CONFIG_LOG_BUF_SHIFT=14
70CONFIG_GROUP_SCHED=y
71CONFIG_FAIR_GROUP_SCHED=y
72# CONFIG_RT_GROUP_SCHED is not set
73CONFIG_USER_SCHED=y
74# CONFIG_CGROUP_SCHED is not set
75# CONFIG_CGROUPS is not set
76CONFIG_SYSFS_DEPRECATED=y
77CONFIG_SYSFS_DEPRECATED_V2=y
78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
80CONFIG_BLK_DEV_INITRD=y
81CONFIG_INITRAMFS_SOURCE=""
82CONFIG_INITRAMFS_ROOT_UID=0
83CONFIG_INITRAMFS_ROOT_GID=0
84CONFIG_RD_GZIP=y
85# CONFIG_RD_BZIP2 is not set
86# CONFIG_RD_LZMA is not set
87CONFIG_INITRAMFS_COMPRESSION_NONE=y
88# CONFIG_INITRAMFS_COMPRESSION_GZIP is not set
89# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
90# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
91CONFIG_CC_OPTIMIZE_FOR_SIZE=y
92CONFIG_SYSCTL=y
93CONFIG_ANON_INODES=y
94CONFIG_EMBEDDED=y
95CONFIG_UID16=y
96CONFIG_SYSCTL_SYSCALL=y
97# CONFIG_KALLSYMS is not set
98CONFIG_HOTPLUG=y
99CONFIG_PRINTK=y
100CONFIG_BUG=y
101CONFIG_ELF_CORE=y
102CONFIG_BASE_FULL=y
103CONFIG_FUTEX=y
104CONFIG_EPOLL=y
105CONFIG_SIGNALFD=y
106CONFIG_TIMERFD=y
107CONFIG_EVENTFD=y
108CONFIG_SHMEM=y
109CONFIG_AIO=y
110CONFIG_HAVE_PERF_COUNTERS=y
111
112#
113# Performance Counters
114#
115# CONFIG_PERF_COUNTERS is not set
116CONFIG_VM_EVENT_COUNTERS=y
117# CONFIG_STRIP_ASM_SYMS is not set
118CONFIG_COMPAT_BRK=y
119CONFIG_SLAB=y
120# CONFIG_SLUB is not set
121# CONFIG_SLOB is not set
122# CONFIG_PROFILING is not set
123# CONFIG_MARKERS is not set
124CONFIG_HAVE_OPROFILE=y
125CONFIG_HAVE_IOREMAP_PROT=y
126CONFIG_HAVE_KPROBES=y
127CONFIG_HAVE_KRETPROBES=y
128CONFIG_HAVE_ARCH_TRACEHOOK=y
129CONFIG_HAVE_CLK=y
130CONFIG_HAVE_DMA_API_DEBUG=y
131
132#
133# GCOV-based kernel profiling
134#
135# CONFIG_GCOV_KERNEL is not set
136# CONFIG_SLOW_WORK is not set
137CONFIG_HAVE_GENERIC_DMA_COHERENT=y
138CONFIG_SLABINFO=y
139CONFIG_RT_MUTEXES=y
140CONFIG_BASE_SMALL=0
141# CONFIG_MODULES is not set
142CONFIG_BLOCK=y
143# CONFIG_LBDAF is not set
144# CONFIG_BLK_DEV_BSG is not set
145# CONFIG_BLK_DEV_INTEGRITY is not set
146
147#
148# IO Schedulers
149#
150CONFIG_IOSCHED_NOOP=y
151CONFIG_IOSCHED_AS=y
152CONFIG_IOSCHED_DEADLINE=y
153CONFIG_IOSCHED_CFQ=y
154# CONFIG_DEFAULT_AS is not set
155# CONFIG_DEFAULT_DEADLINE is not set
156CONFIG_DEFAULT_CFQ=y
157# CONFIG_DEFAULT_NOOP is not set
158CONFIG_DEFAULT_IOSCHED="cfq"
159# CONFIG_FREEZER is not set
160
161#
162# System type
163#
164CONFIG_CPU_SH4=y
165CONFIG_CPU_SH4A=y
166CONFIG_CPU_SHX2=y
167CONFIG_ARCH_SHMOBILE=y
168# CONFIG_CPU_SUBTYPE_SH7619 is not set
169# CONFIG_CPU_SUBTYPE_SH7201 is not set
170# CONFIG_CPU_SUBTYPE_SH7203 is not set
171# CONFIG_CPU_SUBTYPE_SH7206 is not set
172# CONFIG_CPU_SUBTYPE_SH7263 is not set
173# CONFIG_CPU_SUBTYPE_MXG is not set
174# CONFIG_CPU_SUBTYPE_SH7705 is not set
175# CONFIG_CPU_SUBTYPE_SH7706 is not set
176# CONFIG_CPU_SUBTYPE_SH7707 is not set
177# CONFIG_CPU_SUBTYPE_SH7708 is not set
178# CONFIG_CPU_SUBTYPE_SH7709 is not set
179# CONFIG_CPU_SUBTYPE_SH7710 is not set
180# CONFIG_CPU_SUBTYPE_SH7712 is not set
181# CONFIG_CPU_SUBTYPE_SH7720 is not set
182# CONFIG_CPU_SUBTYPE_SH7721 is not set
183# CONFIG_CPU_SUBTYPE_SH7750 is not set
184# CONFIG_CPU_SUBTYPE_SH7091 is not set
185# CONFIG_CPU_SUBTYPE_SH7750R is not set
186# CONFIG_CPU_SUBTYPE_SH7750S is not set
187# CONFIG_CPU_SUBTYPE_SH7751 is not set
188# CONFIG_CPU_SUBTYPE_SH7751R is not set
189# CONFIG_CPU_SUBTYPE_SH7760 is not set
190# CONFIG_CPU_SUBTYPE_SH4_202 is not set
191# CONFIG_CPU_SUBTYPE_SH7723 is not set
192CONFIG_CPU_SUBTYPE_SH7724=y
193# CONFIG_CPU_SUBTYPE_SH7757 is not set
194# CONFIG_CPU_SUBTYPE_SH7763 is not set
195# CONFIG_CPU_SUBTYPE_SH7770 is not set
196# CONFIG_CPU_SUBTYPE_SH7780 is not set
197# CONFIG_CPU_SUBTYPE_SH7785 is not set
198# CONFIG_CPU_SUBTYPE_SH7786 is not set
199# CONFIG_CPU_SUBTYPE_SHX3 is not set
200# CONFIG_CPU_SUBTYPE_SH7343 is not set
201# CONFIG_CPU_SUBTYPE_SH7722 is not set
202# CONFIG_CPU_SUBTYPE_SH7366 is not set
203
204#
205# Memory management options
206#
207CONFIG_QUICKLIST=y
208CONFIG_MMU=y
209CONFIG_PAGE_OFFSET=0x80000000
210CONFIG_FORCE_MAX_ZONEORDER=11
211CONFIG_MEMORY_START=0x08000000
212CONFIG_MEMORY_SIZE=0x08000000
213CONFIG_29BIT=y
214# CONFIG_X2TLB is not set
215CONFIG_VSYSCALL=y
216CONFIG_ARCH_FLATMEM_ENABLE=y
217CONFIG_ARCH_SPARSEMEM_ENABLE=y
218CONFIG_ARCH_SPARSEMEM_DEFAULT=y
219CONFIG_MAX_ACTIVE_REGIONS=1
220CONFIG_ARCH_POPULATES_NODE_MAP=y
221CONFIG_ARCH_SELECT_MEMORY_MODEL=y
222CONFIG_PAGE_SIZE_4KB=y
223# CONFIG_PAGE_SIZE_8KB is not set
224# CONFIG_PAGE_SIZE_16KB is not set
225# CONFIG_PAGE_SIZE_64KB is not set
226CONFIG_SELECT_MEMORY_MODEL=y
227CONFIG_FLATMEM_MANUAL=y
228# CONFIG_DISCONTIGMEM_MANUAL is not set
229# CONFIG_SPARSEMEM_MANUAL is not set
230CONFIG_FLATMEM=y
231CONFIG_FLAT_NODE_MEM_MAP=y
232CONFIG_SPARSEMEM_STATIC=y
233CONFIG_PAGEFLAGS_EXTENDED=y
234CONFIG_SPLIT_PTLOCK_CPUS=4
235# CONFIG_PHYS_ADDR_T_64BIT is not set
236CONFIG_ZONE_DMA_FLAG=0
237CONFIG_NR_QUICK=2
238CONFIG_HAVE_MLOCK=y
239CONFIG_HAVE_MLOCKED_PAGE_BIT=y
240CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
241
242#
243# Cache configuration
244#
245CONFIG_CACHE_WRITEBACK=y
246# CONFIG_CACHE_WRITETHROUGH is not set
247# CONFIG_CACHE_OFF is not set
248
249#
250# Processor features
251#
252CONFIG_CPU_LITTLE_ENDIAN=y
253# CONFIG_CPU_BIG_ENDIAN is not set
254CONFIG_SH_FPU=y
255# CONFIG_SH_STORE_QUEUES is not set
256CONFIG_CPU_HAS_INTEVT=y
257CONFIG_CPU_HAS_SR_RB=y
258CONFIG_CPU_HAS_FPU=y
259
260#
261# Board support
262#
263# CONFIG_SH_7724_SOLUTION_ENGINE is not set
264# CONFIG_SH_KFR2R09 is not set
265CONFIG_SH_ECOVEC=y
266
267#
268# Timer and clock configuration
269#
270# CONFIG_SH_TIMER_TMU is not set
271CONFIG_SH_TIMER_CMT=y
272CONFIG_SH_PCLK_FREQ=33333333
273CONFIG_SH_CLK_CPG=y
274# CONFIG_NO_HZ is not set
275# CONFIG_HIGH_RES_TIMERS is not set
276CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
277
278#
279# CPU Frequency scaling
280#
281# CONFIG_CPU_FREQ is not set
282
283#
284# DMA support
285#
286# CONFIG_SH_DMA is not set
287
288#
289# Companion Chips
290#
291
292#
293# Additional SuperH Device Drivers
294#
295# CONFIG_HEARTBEAT is not set
296# CONFIG_PUSH_SWITCH is not set
297
298#
299# Kernel features
300#
301# CONFIG_HZ_100 is not set
302CONFIG_HZ_250=y
303# CONFIG_HZ_300 is not set
304# CONFIG_HZ_1000 is not set
305CONFIG_HZ=250
306# CONFIG_SCHED_HRTICK is not set
307CONFIG_KEXEC=y
308# CONFIG_CRASH_DUMP is not set
309# CONFIG_SECCOMP is not set
310CONFIG_PREEMPT_NONE=y
311# CONFIG_PREEMPT_VOLUNTARY is not set
312# CONFIG_PREEMPT is not set
313CONFIG_GUSA=y
314# CONFIG_SPARSE_IRQ is not set
315
316#
317# Boot options
318#
319CONFIG_ZERO_PAGE_OFFSET=0x00001000
320CONFIG_BOOT_LINK_OFFSET=0x00800000
321CONFIG_ENTRY_OFFSET=0x00001000
322CONFIG_CMDLINE_BOOL=y
323CONFIG_CMDLINE="console=ttySC0,115200"
324
325#
326# Bus options
327#
328# CONFIG_ARCH_SUPPORTS_MSI is not set
329# CONFIG_PCCARD is not set
330
331#
332# Executable file formats
333#
334CONFIG_BINFMT_ELF=y
335# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
336# CONFIG_HAVE_AOUT is not set
337# CONFIG_BINFMT_MISC is not set
338
339#
340# Power management options (EXPERIMENTAL)
341#
342CONFIG_PM=y
343# CONFIG_PM_DEBUG is not set
344# CONFIG_SUSPEND is not set
345# CONFIG_HIBERNATION is not set
346CONFIG_PM_RUNTIME=y
347# CONFIG_CPU_IDLE is not set
348CONFIG_NET=y
349
350#
351# Networking options
352#
353CONFIG_PACKET=y
354CONFIG_PACKET_MMAP=y
355CONFIG_UNIX=y
356# CONFIG_NET_KEY is not set
357CONFIG_INET=y
358# CONFIG_IP_MULTICAST is not set
359# CONFIG_IP_ADVANCED_ROUTER is not set
360CONFIG_IP_FIB_HASH=y
361# CONFIG_IP_PNP is not set
362# CONFIG_NET_IPIP is not set
363# CONFIG_NET_IPGRE is not set
364# CONFIG_ARPD is not set
365# CONFIG_SYN_COOKIES is not set
366# CONFIG_INET_AH is not set
367# CONFIG_INET_ESP is not set
368# CONFIG_INET_IPCOMP is not set
369# CONFIG_INET_XFRM_TUNNEL is not set
370# CONFIG_INET_TUNNEL is not set
371# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
372# CONFIG_INET_XFRM_MODE_TUNNEL is not set
373# CONFIG_INET_XFRM_MODE_BEET is not set
374# CONFIG_INET_LRO is not set
375# CONFIG_INET_DIAG is not set
376# CONFIG_TCP_CONG_ADVANCED is not set
377CONFIG_TCP_CONG_CUBIC=y
378CONFIG_DEFAULT_TCP_CONG="cubic"
379# CONFIG_TCP_MD5SIG is not set
380# CONFIG_IPV6 is not set
381# CONFIG_NETWORK_SECMARK is not set
382# CONFIG_NETFILTER is not set
383# CONFIG_IP_DCCP is not set
384# CONFIG_IP_SCTP is not set
385# CONFIG_TIPC is not set
386# CONFIG_ATM is not set
387# CONFIG_BRIDGE is not set
388# CONFIG_NET_DSA is not set
389# CONFIG_VLAN_8021Q is not set
390# CONFIG_DECNET is not set
391# CONFIG_LLC2 is not set
392# CONFIG_IPX is not set
393# CONFIG_ATALK is not set
394# CONFIG_X25 is not set
395# CONFIG_LAPB is not set
396# CONFIG_ECONET is not set
397# CONFIG_WAN_ROUTER is not set
398# CONFIG_PHONET is not set
399# CONFIG_IEEE802154 is not set
400# CONFIG_NET_SCHED is not set
401# CONFIG_DCB is not set
402
403#
404# Network testing
405#
406# CONFIG_NET_PKTGEN is not set
407# CONFIG_HAMRADIO is not set
408# CONFIG_CAN is not set
409# CONFIG_IRDA is not set
410# CONFIG_BT is not set
411# CONFIG_AF_RXRPC is not set
412# CONFIG_WIRELESS is not set
413# CONFIG_WIMAX is not set
414# CONFIG_RFKILL is not set
415# CONFIG_NET_9P is not set
416
417#
418# Device Drivers
419#
420
421#
422# Generic Driver Options
423#
424CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
425CONFIG_STANDALONE=y
426CONFIG_PREVENT_FIRMWARE_BUILD=y
427CONFIG_FW_LOADER=y
428CONFIG_FIRMWARE_IN_KERNEL=y
429CONFIG_EXTRA_FIRMWARE=""
430# CONFIG_SYS_HYPERVISOR is not set
431# CONFIG_CONNECTOR is not set
432# CONFIG_MTD is not set
433# CONFIG_PARPORT is not set
434CONFIG_BLK_DEV=y
435# CONFIG_BLK_DEV_COW_COMMON is not set
436# CONFIG_BLK_DEV_LOOP is not set
437# CONFIG_BLK_DEV_NBD is not set
438# CONFIG_BLK_DEV_UB is not set
439# CONFIG_BLK_DEV_RAM is not set
440# CONFIG_CDROM_PKTCDVD is not set
441# CONFIG_ATA_OVER_ETH is not set
442# CONFIG_BLK_DEV_HD is not set
443# CONFIG_MISC_DEVICES is not set
444CONFIG_HAVE_IDE=y
445# CONFIG_IDE is not set
446
447#
448# SCSI device support
449#
450# CONFIG_RAID_ATTRS is not set
451CONFIG_SCSI=y
452CONFIG_SCSI_DMA=y
453# CONFIG_SCSI_TGT is not set
454# CONFIG_SCSI_NETLINK is not set
455CONFIG_SCSI_PROC_FS=y
456
457#
458# SCSI support type (disk, tape, CD-ROM)
459#
460CONFIG_BLK_DEV_SD=y
461# CONFIG_CHR_DEV_ST is not set
462# CONFIG_CHR_DEV_OSST is not set
463# CONFIG_BLK_DEV_SR is not set
464# CONFIG_CHR_DEV_SG is not set
465# CONFIG_CHR_DEV_SCH is not set
466# CONFIG_SCSI_MULTI_LUN is not set
467# CONFIG_SCSI_CONSTANTS is not set
468# CONFIG_SCSI_LOGGING is not set
469# CONFIG_SCSI_SCAN_ASYNC is not set
470
471#
472# SCSI Transports
473#
474# CONFIG_SCSI_SPI_ATTRS is not set
475# CONFIG_SCSI_FC_ATTRS is not set
476# CONFIG_SCSI_ISCSI_ATTRS is not set
477# CONFIG_SCSI_SAS_LIBSAS is not set
478# CONFIG_SCSI_SRP_ATTRS is not set
479# CONFIG_SCSI_LOWLEVEL is not set
480# CONFIG_SCSI_DH is not set
481# CONFIG_SCSI_OSD_INITIATOR is not set
482# CONFIG_ATA is not set
483# CONFIG_MD is not set
484CONFIG_NETDEVICES=y
485# CONFIG_DUMMY is not set
486# CONFIG_BONDING is not set
487# CONFIG_MACVLAN is not set
488# CONFIG_EQUALIZER is not set
489# CONFIG_TUN is not set
490# CONFIG_VETH is not set
491CONFIG_PHYLIB=y
492
493#
494# MII PHY device drivers
495#
496# CONFIG_MARVELL_PHY is not set
497# CONFIG_DAVICOM_PHY is not set
498# CONFIG_QSEMI_PHY is not set
499# CONFIG_LXT_PHY is not set
500# CONFIG_CICADA_PHY is not set
501# CONFIG_VITESSE_PHY is not set
502# CONFIG_SMSC_PHY is not set
503# CONFIG_BROADCOM_PHY is not set
504# CONFIG_ICPLUS_PHY is not set
505# CONFIG_REALTEK_PHY is not set
506# CONFIG_NATIONAL_PHY is not set
507# CONFIG_STE10XP is not set
508# CONFIG_LSI_ET1011C_PHY is not set
509# CONFIG_FIXED_PHY is not set
510CONFIG_MDIO_BITBANG=y
511# CONFIG_MDIO_GPIO is not set
512CONFIG_NET_ETHERNET=y
513CONFIG_MII=y
514# CONFIG_AX88796 is not set
515# CONFIG_STNIC is not set
516CONFIG_SH_ETH=y
517# CONFIG_SMC91X is not set
518# CONFIG_ETHOC is not set
519# CONFIG_SMC911X is not set
520# CONFIG_SMSC911X is not set
521# CONFIG_DNET is not set
522# CONFIG_IBM_NEW_EMAC_ZMII is not set
523# CONFIG_IBM_NEW_EMAC_RGMII is not set
524# CONFIG_IBM_NEW_EMAC_TAH is not set
525# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
526# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
527# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
528# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
529# CONFIG_B44 is not set
530# CONFIG_KS8842 is not set
531# CONFIG_NETDEV_1000 is not set
532# CONFIG_NETDEV_10000 is not set
533
534#
535# Wireless LAN
536#
537# CONFIG_WLAN_PRE80211 is not set
538# CONFIG_WLAN_80211 is not set
539
540#
541# Enable WiMAX (Networking options) to see the WiMAX drivers
542#
543
544#
545# USB Network Adapters
546#
547# CONFIG_USB_CATC is not set
548# CONFIG_USB_KAWETH is not set
549# CONFIG_USB_PEGASUS is not set
550# CONFIG_USB_RTL8150 is not set
551# CONFIG_USB_USBNET is not set
552# CONFIG_WAN is not set
553# CONFIG_PPP is not set
554# CONFIG_SLIP is not set
555# CONFIG_NETCONSOLE is not set
556# CONFIG_NETPOLL is not set
557# CONFIG_NET_POLL_CONTROLLER is not set
558# CONFIG_ISDN is not set
559# CONFIG_PHONE is not set
560
561#
562# Input device support
563#
564CONFIG_INPUT=y
565# CONFIG_INPUT_FF_MEMLESS is not set
566# CONFIG_INPUT_POLLDEV is not set
567
568#
569# Userland interfaces
570#
571# CONFIG_INPUT_MOUSEDEV is not set
572# CONFIG_INPUT_JOYDEV is not set
573# CONFIG_INPUT_EVDEV is not set
574# CONFIG_INPUT_EVBUG is not set
575
576#
577# Input Device Drivers
578#
579# CONFIG_INPUT_KEYBOARD is not set
580# CONFIG_INPUT_MOUSE is not set
581# CONFIG_INPUT_JOYSTICK is not set
582# CONFIG_INPUT_TABLET is not set
583# CONFIG_INPUT_TOUCHSCREEN is not set
584# CONFIG_INPUT_MISC is not set
585
586#
587# Hardware I/O ports
588#
589# CONFIG_SERIO is not set
590# CONFIG_GAMEPORT is not set
591
592#
593# Character devices
594#
595CONFIG_VT=y
596CONFIG_CONSOLE_TRANSLATIONS=y
597CONFIG_VT_CONSOLE=y
598CONFIG_HW_CONSOLE=y
599CONFIG_VT_HW_CONSOLE_BINDING=y
600CONFIG_DEVKMEM=y
601# CONFIG_SERIAL_NONSTANDARD is not set
602
603#
604# Serial drivers
605#
606# CONFIG_SERIAL_8250 is not set
607
608#
609# Non-8250 serial port support
610#
611CONFIG_SERIAL_SH_SCI=y
612CONFIG_SERIAL_SH_SCI_NR_UARTS=6
613CONFIG_SERIAL_SH_SCI_CONSOLE=y
614CONFIG_SERIAL_CORE=y
615CONFIG_SERIAL_CORE_CONSOLE=y
616CONFIG_UNIX98_PTYS=y
617# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
618CONFIG_LEGACY_PTYS=y
619CONFIG_LEGACY_PTY_COUNT=256
620# CONFIG_IPMI_HANDLER is not set
621CONFIG_HW_RANDOM=y
622# CONFIG_HW_RANDOM_TIMERIOMEM is not set
623# CONFIG_R3964 is not set
624# CONFIG_RAW_DRIVER is not set
625# CONFIG_TCG_TPM is not set
626CONFIG_I2C=y
627CONFIG_I2C_BOARDINFO=y
628# CONFIG_I2C_CHARDEV is not set
629CONFIG_I2C_HELPER_AUTO=y
630
631#
632# I2C Hardware Bus support
633#
634
635#
636# I2C system bus drivers (mostly embedded / system-on-chip)
637#
638# CONFIG_I2C_DESIGNWARE is not set
639# CONFIG_I2C_GPIO is not set
640# CONFIG_I2C_OCORES is not set
641CONFIG_I2C_SH_MOBILE=y
642# CONFIG_I2C_SIMTEC is not set
643
644#
645# External I2C/SMBus adapter drivers
646#
647# CONFIG_I2C_PARPORT_LIGHT is not set
648# CONFIG_I2C_TAOS_EVM is not set
649# CONFIG_I2C_TINY_USB is not set
650
651#
652# Other I2C/SMBus bus drivers
653#
654# CONFIG_I2C_PCA_PLATFORM is not set
655
656#
657# Miscellaneous I2C Chip support
658#
659# CONFIG_DS1682 is not set
660# CONFIG_SENSORS_PCF8574 is not set
661# CONFIG_PCF8575 is not set
662# CONFIG_SENSORS_PCA9539 is not set
663# CONFIG_SENSORS_TSL2550 is not set
664# CONFIG_I2C_DEBUG_CORE is not set
665# CONFIG_I2C_DEBUG_ALGO is not set
666# CONFIG_I2C_DEBUG_BUS is not set
667# CONFIG_I2C_DEBUG_CHIP is not set
668# CONFIG_SPI is not set
669
670#
671# PPS support
672#
673# CONFIG_PPS is not set
674CONFIG_ARCH_REQUIRE_GPIOLIB=y
675CONFIG_GPIOLIB=y
676CONFIG_GPIO_SYSFS=y
677
678#
679# Memory mapped GPIO expanders:
680#
681
682#
683# I2C GPIO expanders:
684#
685# CONFIG_GPIO_MAX732X is not set
686# CONFIG_GPIO_PCA953X is not set
687# CONFIG_GPIO_PCF857X is not set
688
689#
690# PCI GPIO expanders:
691#
692
693#
694# SPI GPIO expanders:
695#
696# CONFIG_W1 is not set
697# CONFIG_POWER_SUPPLY is not set
698# CONFIG_HWMON is not set
699# CONFIG_THERMAL is not set
700# CONFIG_THERMAL_HWMON is not set
701# CONFIG_WATCHDOG is not set
702CONFIG_SSB_POSSIBLE=y
703
704#
705# Sonics Silicon Backplane
706#
707# CONFIG_SSB is not set
708
709#
710# Multifunction device drivers
711#
712# CONFIG_MFD_CORE is not set
713# CONFIG_MFD_SM501 is not set
714# CONFIG_HTC_PASIC3 is not set
715# CONFIG_TPS65010 is not set
716# CONFIG_TWL4030_CORE is not set
717# CONFIG_MFD_TMIO is not set
718# CONFIG_PMIC_DA903X is not set
719# CONFIG_MFD_WM8400 is not set
720# CONFIG_MFD_WM8350_I2C is not set
721# CONFIG_MFD_PCF50633 is not set
722# CONFIG_AB3100_CORE is not set
723# CONFIG_REGULATOR is not set
724# CONFIG_MEDIA_SUPPORT is not set
725
726#
727# Graphics support
728#
729# CONFIG_VGASTATE is not set
730# CONFIG_VIDEO_OUTPUT_CONTROL is not set
731# CONFIG_FB is not set
732# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
733
734#
735# Display device support
736#
737# CONFIG_DISPLAY_SUPPORT is not set
738
739#
740# Console display driver support
741#
742CONFIG_DUMMY_CONSOLE=y
743# CONFIG_SOUND is not set
744# CONFIG_HID_SUPPORT is not set
745CONFIG_USB_SUPPORT=y
746CONFIG_USB_ARCH_HAS_HCD=y
747# CONFIG_USB_ARCH_HAS_OHCI is not set
748# CONFIG_USB_ARCH_HAS_EHCI is not set
749CONFIG_USB=y
750# CONFIG_USB_DEBUG is not set
751# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
752
753#
754# Miscellaneous USB options
755#
756# CONFIG_USB_DEVICEFS is not set
757CONFIG_USB_DEVICE_CLASS=y
758# CONFIG_USB_DYNAMIC_MINORS is not set
759# CONFIG_USB_SUSPEND is not set
760# CONFIG_USB_OTG is not set
761# CONFIG_USB_OTG_WHITELIST is not set
762# CONFIG_USB_OTG_BLACKLIST_HUB is not set
763# CONFIG_USB_MON is not set
764# CONFIG_USB_WUSB is not set
765# CONFIG_USB_WUSB_CBAF is not set
766
767#
768# USB Host Controller Drivers
769#
770# CONFIG_USB_C67X00_HCD is not set
771# CONFIG_USB_OXU210HP_HCD is not set
772# CONFIG_USB_ISP116X_HCD is not set
773# CONFIG_USB_ISP1760_HCD is not set
774# CONFIG_USB_SL811_HCD is not set
775CONFIG_USB_R8A66597_HCD=y
776# CONFIG_USB_HWA_HCD is not set
777
778#
779# USB Device Class drivers
780#
781# CONFIG_USB_ACM is not set
782# CONFIG_USB_PRINTER is not set
783# CONFIG_USB_WDM is not set
784# CONFIG_USB_TMC is not set
785
786#
787# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
788#
789
790#
791# also be needed; see USB_STORAGE Help for more info
792#
793CONFIG_USB_STORAGE=y
794# CONFIG_USB_STORAGE_DEBUG is not set
795# CONFIG_USB_STORAGE_DATAFAB is not set
796# CONFIG_USB_STORAGE_FREECOM is not set
797# CONFIG_USB_STORAGE_ISD200 is not set
798# CONFIG_USB_STORAGE_USBAT is not set
799# CONFIG_USB_STORAGE_SDDR09 is not set
800# CONFIG_USB_STORAGE_SDDR55 is not set
801# CONFIG_USB_STORAGE_JUMPSHOT is not set
802# CONFIG_USB_STORAGE_ALAUDA is not set
803# CONFIG_USB_STORAGE_ONETOUCH is not set
804# CONFIG_USB_STORAGE_KARMA is not set
805# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
806# CONFIG_USB_LIBUSUAL is not set
807
808#
809# USB Imaging devices
810#
811# CONFIG_USB_MDC800 is not set
812# CONFIG_USB_MICROTEK is not set
813
814#
815# USB port drivers
816#
817# CONFIG_USB_SERIAL is not set
818
819#
820# USB Miscellaneous drivers
821#
822# CONFIG_USB_EMI62 is not set
823# CONFIG_USB_EMI26 is not set
824# CONFIG_USB_ADUTUX is not set
825# CONFIG_USB_SEVSEG is not set
826# CONFIG_USB_RIO500 is not set
827# CONFIG_USB_LEGOTOWER is not set
828# CONFIG_USB_LCD is not set
829# CONFIG_USB_BERRY_CHARGE is not set
830# CONFIG_USB_LED is not set
831# CONFIG_USB_CYPRESS_CY7C63 is not set
832# CONFIG_USB_CYTHERM is not set
833# CONFIG_USB_IDMOUSE is not set
834# CONFIG_USB_FTDI_ELAN is not set
835# CONFIG_USB_APPLEDISPLAY is not set
836# CONFIG_USB_LD is not set
837# CONFIG_USB_TRANCEVIBRATOR is not set
838# CONFIG_USB_IOWARRIOR is not set
839# CONFIG_USB_TEST is not set
840# CONFIG_USB_ISIGHTFW is not set
841# CONFIG_USB_VST is not set
842# CONFIG_USB_GADGET is not set
843
844#
845# OTG and related infrastructure
846#
847# CONFIG_USB_GPIO_VBUS is not set
848# CONFIG_NOP_USB_XCEIV is not set
849# CONFIG_MMC is not set
850# CONFIG_MEMSTICK is not set
851# CONFIG_NEW_LEDS is not set
852# CONFIG_ACCESSIBILITY is not set
853CONFIG_RTC_LIB=y
854# CONFIG_RTC_CLASS is not set
855# CONFIG_DMADEVICES is not set
856# CONFIG_AUXDISPLAY is not set
857# CONFIG_UIO is not set
858
859#
860# TI VLYNQ
861#
862# CONFIG_STAGING is not set
863
864#
865# File systems
866#
867CONFIG_EXT2_FS=y
868# CONFIG_EXT2_FS_XATTR is not set
869# CONFIG_EXT2_FS_XIP is not set
870# CONFIG_EXT3_FS is not set
871# CONFIG_EXT4_FS is not set
872# CONFIG_REISERFS_FS is not set
873# CONFIG_JFS_FS is not set
874# CONFIG_FS_POSIX_ACL is not set
875# CONFIG_XFS_FS is not set
876# CONFIG_OCFS2_FS is not set
877# CONFIG_BTRFS_FS is not set
878CONFIG_FILE_LOCKING=y
879# CONFIG_FSNOTIFY is not set
880# CONFIG_DNOTIFY is not set
881# CONFIG_INOTIFY is not set
882# CONFIG_INOTIFY_USER is not set
883# CONFIG_QUOTA is not set
884# CONFIG_AUTOFS_FS is not set
885# CONFIG_AUTOFS4_FS is not set
886# CONFIG_FUSE_FS is not set
887
888#
889# Caches
890#
891# CONFIG_FSCACHE is not set
892
893#
894# CD-ROM/DVD Filesystems
895#
896# CONFIG_ISO9660_FS is not set
897# CONFIG_UDF_FS is not set
898
899#
900# DOS/FAT/NT Filesystems
901#
902# CONFIG_MSDOS_FS is not set
903# CONFIG_VFAT_FS is not set
904# CONFIG_NTFS_FS is not set
905
906#
907# Pseudo filesystems
908#
909CONFIG_PROC_FS=y
910CONFIG_PROC_KCORE=y
911CONFIG_PROC_SYSCTL=y
912CONFIG_PROC_PAGE_MONITOR=y
913CONFIG_SYSFS=y
914CONFIG_TMPFS=y
915# CONFIG_TMPFS_POSIX_ACL is not set
916# CONFIG_HUGETLBFS is not set
917# CONFIG_HUGETLB_PAGE is not set
918# CONFIG_CONFIGFS_FS is not set
919# CONFIG_MISC_FILESYSTEMS is not set
920# CONFIG_NETWORK_FILESYSTEMS is not set
921
922#
923# Partition Types
924#
925# CONFIG_PARTITION_ADVANCED is not set
926CONFIG_MSDOS_PARTITION=y
927CONFIG_NLS=y
928CONFIG_NLS_DEFAULT="iso8859-1"
929# CONFIG_NLS_CODEPAGE_437 is not set
930# CONFIG_NLS_CODEPAGE_737 is not set
931# CONFIG_NLS_CODEPAGE_775 is not set
932# CONFIG_NLS_CODEPAGE_850 is not set
933# CONFIG_NLS_CODEPAGE_852 is not set
934# CONFIG_NLS_CODEPAGE_855 is not set
935# CONFIG_NLS_CODEPAGE_857 is not set
936# CONFIG_NLS_CODEPAGE_860 is not set
937# CONFIG_NLS_CODEPAGE_861 is not set
938# CONFIG_NLS_CODEPAGE_862 is not set
939# CONFIG_NLS_CODEPAGE_863 is not set
940# CONFIG_NLS_CODEPAGE_864 is not set
941# CONFIG_NLS_CODEPAGE_865 is not set
942# CONFIG_NLS_CODEPAGE_866 is not set
943# CONFIG_NLS_CODEPAGE_869 is not set
944# CONFIG_NLS_CODEPAGE_936 is not set
945# CONFIG_NLS_CODEPAGE_950 is not set
946# CONFIG_NLS_CODEPAGE_932 is not set
947# CONFIG_NLS_CODEPAGE_949 is not set
948# CONFIG_NLS_CODEPAGE_874 is not set
949# CONFIG_NLS_ISO8859_8 is not set
950# CONFIG_NLS_CODEPAGE_1250 is not set
951# CONFIG_NLS_CODEPAGE_1251 is not set
952# CONFIG_NLS_ASCII is not set
953# CONFIG_NLS_ISO8859_1 is not set
954# CONFIG_NLS_ISO8859_2 is not set
955# CONFIG_NLS_ISO8859_3 is not set
956# CONFIG_NLS_ISO8859_4 is not set
957# CONFIG_NLS_ISO8859_5 is not set
958# CONFIG_NLS_ISO8859_6 is not set
959# CONFIG_NLS_ISO8859_7 is not set
960# CONFIG_NLS_ISO8859_9 is not set
961# CONFIG_NLS_ISO8859_13 is not set
962# CONFIG_NLS_ISO8859_14 is not set
963# CONFIG_NLS_ISO8859_15 is not set
964# CONFIG_NLS_KOI8_R is not set
965# CONFIG_NLS_KOI8_U is not set
966# CONFIG_NLS_UTF8 is not set
967# CONFIG_DLM is not set
968
969#
970# Kernel hacking
971#
972CONFIG_TRACE_IRQFLAGS_SUPPORT=y
973# CONFIG_PRINTK_TIME is not set
974CONFIG_ENABLE_WARN_DEPRECATED=y
975# CONFIG_ENABLE_MUST_CHECK is not set
976CONFIG_FRAME_WARN=1024
977# CONFIG_MAGIC_SYSRQ is not set
978# CONFIG_UNUSED_SYMBOLS is not set
979CONFIG_DEBUG_FS=y
980# CONFIG_HEADERS_CHECK is not set
981# CONFIG_DEBUG_KERNEL is not set
982# CONFIG_DEBUG_BUGVERBOSE is not set
983# CONFIG_DEBUG_MEMORY_INIT is not set
984# CONFIG_RCU_CPU_STALL_DETECTOR is not set
985# CONFIG_LATENCYTOP is not set
986# CONFIG_SYSCTL_SYSCALL_CHECK is not set
987CONFIG_HAVE_FUNCTION_TRACER=y
988CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
989CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
990CONFIG_HAVE_DYNAMIC_FTRACE=y
991CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
992CONFIG_HAVE_FTRACE_SYSCALLS=y
993CONFIG_TRACING_SUPPORT=y
994# CONFIG_FTRACE is not set
995# CONFIG_DYNAMIC_DEBUG is not set
996# CONFIG_DMA_API_DEBUG is not set
997# CONFIG_SAMPLES is not set
998CONFIG_HAVE_ARCH_KGDB=y
999# CONFIG_SH_STANDARD_BIOS is not set
1000# CONFIG_EARLY_SCIF_CONSOLE is not set
1001# CONFIG_DWARF_UNWINDER is not set
1002
1003#
1004# Security options
1005#
1006# CONFIG_KEYS is not set
1007# CONFIG_SECURITY is not set
1008# CONFIG_SECURITYFS is not set
1009# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1010# CONFIG_CRYPTO is not set
1011# CONFIG_BINARY_PRINTF is not set
1012
1013#
1014# Library routines
1015#
1016CONFIG_BITREVERSE=y
1017CONFIG_GENERIC_FIND_LAST_BIT=y
1018# CONFIG_CRC_CCITT is not set
1019# CONFIG_CRC16 is not set
1020# CONFIG_CRC_T10DIF is not set
1021# CONFIG_CRC_ITU_T is not set
1022CONFIG_CRC32=y
1023# CONFIG_CRC7 is not set
1024# CONFIG_LIBCRC32C is not set
1025CONFIG_ZLIB_INFLATE=y
1026CONFIG_DECOMPRESS_GZIP=y
1027CONFIG_HAS_IOMEM=y
1028CONFIG_HAS_IOPORT=y
1029CONFIG_HAS_DMA=y
1030CONFIG_HAVE_LMB=y
1031CONFIG_NLATTR=y
1032CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/configs/ecovec24_defconfig b/arch/sh/configs/ecovec24_defconfig
new file mode 100644
index 00000000000..2050a76683c
--- /dev/null
+++ b/arch/sh/configs/ecovec24_defconfig
@@ -0,0 +1,1558 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc7
4# Wed Aug 26 09:09:07 2009
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8# CONFIG_SUPERH64 is not set
9CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_BUG=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
18CONFIG_GENERIC_GPIO=y
19CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y
26CONFIG_LOCKDEP_SUPPORT=y
27CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U32 is not set
29# CONFIG_ARCH_HAS_ILOG2_U64 is not set
30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y
35
36#
37# General setup
38#
39CONFIG_EXPERIMENTAL=y
40CONFIG_BROKEN_ON_SMP=y
41CONFIG_LOCK_KERNEL=y
42CONFIG_INIT_ENV_ARG_LIMIT=32
43CONFIG_LOCALVERSION=""
44# CONFIG_LOCALVERSION_AUTO is not set
45CONFIG_HAVE_KERNEL_GZIP=y
46CONFIG_HAVE_KERNEL_BZIP2=y
47CONFIG_HAVE_KERNEL_LZMA=y
48CONFIG_KERNEL_GZIP=y
49# CONFIG_KERNEL_BZIP2 is not set
50# CONFIG_KERNEL_LZMA is not set
51CONFIG_SWAP=y
52CONFIG_SYSVIPC=y
53CONFIG_SYSVIPC_SYSCTL=y
54# CONFIG_POSIX_MQUEUE is not set
55CONFIG_BSD_PROCESS_ACCT=y
56# CONFIG_BSD_PROCESS_ACCT_V3 is not set
57# CONFIG_TASKSTATS is not set
58# CONFIG_AUDIT is not set
59
60#
61# RCU Subsystem
62#
63CONFIG_CLASSIC_RCU=y
64# CONFIG_TREE_RCU is not set
65# CONFIG_PREEMPT_RCU is not set
66# CONFIG_TREE_RCU_TRACE is not set
67# CONFIG_PREEMPT_RCU_TRACE is not set
68# CONFIG_IKCONFIG is not set
69CONFIG_LOG_BUF_SHIFT=14
70CONFIG_GROUP_SCHED=y
71CONFIG_FAIR_GROUP_SCHED=y
72# CONFIG_RT_GROUP_SCHED is not set
73CONFIG_USER_SCHED=y
74# CONFIG_CGROUP_SCHED is not set
75# CONFIG_CGROUPS is not set
76CONFIG_SYSFS_DEPRECATED=y
77CONFIG_SYSFS_DEPRECATED_V2=y
78# CONFIG_RELAY is not set
79# CONFIG_NAMESPACES is not set
80# CONFIG_BLK_DEV_INITRD is not set
81CONFIG_CC_OPTIMIZE_FOR_SIZE=y
82CONFIG_SYSCTL=y
83CONFIG_ANON_INODES=y
84CONFIG_EMBEDDED=y
85CONFIG_UID16=y
86CONFIG_SYSCTL_SYSCALL=y
87# CONFIG_KALLSYMS is not set
88CONFIG_HOTPLUG=y
89CONFIG_PRINTK=y
90CONFIG_BUG=y
91CONFIG_ELF_CORE=y
92CONFIG_BASE_FULL=y
93CONFIG_FUTEX=y
94CONFIG_EPOLL=y
95CONFIG_SIGNALFD=y
96CONFIG_TIMERFD=y
97CONFIG_EVENTFD=y
98CONFIG_SHMEM=y
99CONFIG_AIO=y
100CONFIG_HAVE_PERF_COUNTERS=y
101
102#
103# Performance Counters
104#
105# CONFIG_PERF_COUNTERS is not set
106CONFIG_VM_EVENT_COUNTERS=y
107# CONFIG_STRIP_ASM_SYMS is not set
108CONFIG_COMPAT_BRK=y
109CONFIG_SLAB=y
110# CONFIG_SLUB is not set
111# CONFIG_SLOB is not set
112# CONFIG_PROFILING is not set
113# CONFIG_MARKERS is not set
114CONFIG_HAVE_OPROFILE=y
115CONFIG_HAVE_IOREMAP_PROT=y
116CONFIG_HAVE_KPROBES=y
117CONFIG_HAVE_KRETPROBES=y
118CONFIG_HAVE_ARCH_TRACEHOOK=y
119CONFIG_HAVE_CLK=y
120CONFIG_HAVE_DMA_API_DEBUG=y
121
122#
123# GCOV-based kernel profiling
124#
125# CONFIG_GCOV_KERNEL is not set
126# CONFIG_SLOW_WORK is not set
127CONFIG_HAVE_GENERIC_DMA_COHERENT=y
128CONFIG_SLABINFO=y
129CONFIG_RT_MUTEXES=y
130CONFIG_BASE_SMALL=0
131CONFIG_MODULES=y
132# CONFIG_MODULE_FORCE_LOAD is not set
133CONFIG_MODULE_UNLOAD=y
134# CONFIG_MODULE_FORCE_UNLOAD is not set
135# CONFIG_MODVERSIONS is not set
136# CONFIG_MODULE_SRCVERSION_ALL is not set
137CONFIG_BLOCK=y
138CONFIG_LBDAF=y
139# CONFIG_BLK_DEV_BSG is not set
140# CONFIG_BLK_DEV_INTEGRITY is not set
141
142#
143# IO Schedulers
144#
145CONFIG_IOSCHED_NOOP=y
146CONFIG_IOSCHED_AS=y
147CONFIG_IOSCHED_DEADLINE=y
148CONFIG_IOSCHED_CFQ=y
149# CONFIG_DEFAULT_AS is not set
150# CONFIG_DEFAULT_DEADLINE is not set
151CONFIG_DEFAULT_CFQ=y
152# CONFIG_DEFAULT_NOOP is not set
153CONFIG_DEFAULT_IOSCHED="cfq"
154CONFIG_FREEZER=y
155
156#
157# System type
158#
159CONFIG_CPU_SH4=y
160CONFIG_CPU_SH4A=y
161CONFIG_CPU_SHX2=y
162CONFIG_ARCH_SHMOBILE=y
163# CONFIG_CPU_SUBTYPE_SH7619 is not set
164# CONFIG_CPU_SUBTYPE_SH7201 is not set
165# CONFIG_CPU_SUBTYPE_SH7203 is not set
166# CONFIG_CPU_SUBTYPE_SH7206 is not set
167# CONFIG_CPU_SUBTYPE_SH7263 is not set
168# CONFIG_CPU_SUBTYPE_MXG is not set
169# CONFIG_CPU_SUBTYPE_SH7705 is not set
170# CONFIG_CPU_SUBTYPE_SH7706 is not set
171# CONFIG_CPU_SUBTYPE_SH7707 is not set
172# CONFIG_CPU_SUBTYPE_SH7708 is not set
173# CONFIG_CPU_SUBTYPE_SH7709 is not set
174# CONFIG_CPU_SUBTYPE_SH7710 is not set
175# CONFIG_CPU_SUBTYPE_SH7712 is not set
176# CONFIG_CPU_SUBTYPE_SH7720 is not set
177# CONFIG_CPU_SUBTYPE_SH7721 is not set
178# CONFIG_CPU_SUBTYPE_SH7750 is not set
179# CONFIG_CPU_SUBTYPE_SH7091 is not set
180# CONFIG_CPU_SUBTYPE_SH7750R is not set
181# CONFIG_CPU_SUBTYPE_SH7750S is not set
182# CONFIG_CPU_SUBTYPE_SH7751 is not set
183# CONFIG_CPU_SUBTYPE_SH7751R is not set
184# CONFIG_CPU_SUBTYPE_SH7760 is not set
185# CONFIG_CPU_SUBTYPE_SH4_202 is not set
186# CONFIG_CPU_SUBTYPE_SH7723 is not set
187CONFIG_CPU_SUBTYPE_SH7724=y
188# CONFIG_CPU_SUBTYPE_SH7757 is not set
189# CONFIG_CPU_SUBTYPE_SH7763 is not set
190# CONFIG_CPU_SUBTYPE_SH7770 is not set
191# CONFIG_CPU_SUBTYPE_SH7780 is not set
192# CONFIG_CPU_SUBTYPE_SH7785 is not set
193# CONFIG_CPU_SUBTYPE_SH7786 is not set
194# CONFIG_CPU_SUBTYPE_SHX3 is not set
195# CONFIG_CPU_SUBTYPE_SH7343 is not set
196# CONFIG_CPU_SUBTYPE_SH7722 is not set
197# CONFIG_CPU_SUBTYPE_SH7366 is not set
198
199#
200# Memory management options
201#
202CONFIG_QUICKLIST=y
203CONFIG_MMU=y
204CONFIG_PAGE_OFFSET=0x80000000
205CONFIG_FORCE_MAX_ZONEORDER=11
206CONFIG_MEMORY_START=0x08000000
207CONFIG_MEMORY_SIZE=0x08000000
208CONFIG_29BIT=y
209# CONFIG_X2TLB is not set
210CONFIG_VSYSCALL=y
211CONFIG_ARCH_FLATMEM_ENABLE=y
212CONFIG_ARCH_SPARSEMEM_ENABLE=y
213CONFIG_ARCH_SPARSEMEM_DEFAULT=y
214CONFIG_MAX_ACTIVE_REGIONS=1
215CONFIG_ARCH_POPULATES_NODE_MAP=y
216CONFIG_ARCH_SELECT_MEMORY_MODEL=y
217CONFIG_PAGE_SIZE_4KB=y
218# CONFIG_PAGE_SIZE_8KB is not set
219# CONFIG_PAGE_SIZE_16KB is not set
220# CONFIG_PAGE_SIZE_64KB is not set
221CONFIG_SELECT_MEMORY_MODEL=y
222CONFIG_FLATMEM_MANUAL=y
223# CONFIG_DISCONTIGMEM_MANUAL is not set
224# CONFIG_SPARSEMEM_MANUAL is not set
225CONFIG_FLATMEM=y
226CONFIG_FLAT_NODE_MEM_MAP=y
227CONFIG_SPARSEMEM_STATIC=y
228CONFIG_PAGEFLAGS_EXTENDED=y
229CONFIG_SPLIT_PTLOCK_CPUS=4
230# CONFIG_PHYS_ADDR_T_64BIT is not set
231CONFIG_ZONE_DMA_FLAG=0
232CONFIG_NR_QUICK=2
233CONFIG_HAVE_MLOCK=y
234CONFIG_HAVE_MLOCKED_PAGE_BIT=y
235CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
236
237#
238# Cache configuration
239#
240CONFIG_CACHE_WRITEBACK=y
241# CONFIG_CACHE_WRITETHROUGH is not set
242# CONFIG_CACHE_OFF is not set
243
244#
245# Processor features
246#
247CONFIG_CPU_LITTLE_ENDIAN=y
248# CONFIG_CPU_BIG_ENDIAN is not set
249CONFIG_SH_FPU=y
250# CONFIG_SH_STORE_QUEUES is not set
251CONFIG_CPU_HAS_INTEVT=y
252CONFIG_CPU_HAS_SR_RB=y
253CONFIG_CPU_HAS_FPU=y
254
255#
256# Board support
257#
258# CONFIG_SH_7724_SOLUTION_ENGINE is not set
259# CONFIG_SH_KFR2R09 is not set
260CONFIG_SH_ECOVEC=y
261
262#
263# Timer and clock configuration
264#
265CONFIG_SH_TIMER_TMU=y
266# CONFIG_SH_TIMER_CMT is not set
267CONFIG_SH_PCLK_FREQ=33333333
268CONFIG_SH_CLK_CPG=y
269# CONFIG_NO_HZ is not set
270# CONFIG_HIGH_RES_TIMERS is not set
271CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
272
273#
274# CPU Frequency scaling
275#
276# CONFIG_CPU_FREQ is not set
277
278#
279# DMA support
280#
281# CONFIG_SH_DMA is not set
282
283#
284# Companion Chips
285#
286
287#
288# Additional SuperH Device Drivers
289#
290CONFIG_HEARTBEAT=y
291# CONFIG_PUSH_SWITCH is not set
292
293#
294# Kernel features
295#
296# CONFIG_HZ_100 is not set
297CONFIG_HZ_250=y
298# CONFIG_HZ_300 is not set
299# CONFIG_HZ_1000 is not set
300CONFIG_HZ=250
301# CONFIG_SCHED_HRTICK is not set
302# CONFIG_KEXEC is not set
303# CONFIG_CRASH_DUMP is not set
304CONFIG_SECCOMP=y
305# CONFIG_PREEMPT_NONE is not set
306# CONFIG_PREEMPT_VOLUNTARY is not set
307CONFIG_PREEMPT=y
308CONFIG_GUSA=y
309# CONFIG_SPARSE_IRQ is not set
310
311#
312# Boot options
313#
314CONFIG_ZERO_PAGE_OFFSET=0x00001000
315CONFIG_BOOT_LINK_OFFSET=0x00800000
316CONFIG_ENTRY_OFFSET=0x00001000
317CONFIG_CMDLINE_BOOL=y
318CONFIG_CMDLINE="console=tty0, console=ttySC0,115200 root=/dev/nfs ip=dhcp mem=120M memchunk.vpu=4m"
319
320#
321# Bus options
322#
323# CONFIG_ARCH_SUPPORTS_MSI is not set
324# CONFIG_PCCARD is not set
325
326#
327# Executable file formats
328#
329CONFIG_BINFMT_ELF=y
330# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
331# CONFIG_HAVE_AOUT is not set
332# CONFIG_BINFMT_MISC is not set
333
334#
335# Power management options (EXPERIMENTAL)
336#
337CONFIG_PM=y
338# CONFIG_PM_DEBUG is not set
339CONFIG_PM_SLEEP=y
340CONFIG_SUSPEND=y
341CONFIG_SUSPEND_FREEZER=y
342# CONFIG_HIBERNATION is not set
343CONFIG_PM_RUNTIME=y
344# CONFIG_CPU_IDLE is not set
345CONFIG_NET=y
346
347#
348# Networking options
349#
350CONFIG_PACKET=y
351# CONFIG_PACKET_MMAP is not set
352CONFIG_UNIX=y
353# CONFIG_NET_KEY is not set
354CONFIG_INET=y
355# CONFIG_IP_MULTICAST is not set
356CONFIG_IP_ADVANCED_ROUTER=y
357CONFIG_ASK_IP_FIB_HASH=y
358# CONFIG_IP_FIB_TRIE is not set
359CONFIG_IP_FIB_HASH=y
360# CONFIG_IP_MULTIPLE_TABLES is not set
361# CONFIG_IP_ROUTE_MULTIPATH is not set
362# CONFIG_IP_ROUTE_VERBOSE is not set
363CONFIG_IP_PNP=y
364CONFIG_IP_PNP_DHCP=y
365# CONFIG_IP_PNP_BOOTP is not set
366# CONFIG_IP_PNP_RARP is not set
367# CONFIG_NET_IPIP is not set
368# CONFIG_NET_IPGRE is not set
369# CONFIG_ARPD is not set
370# CONFIG_SYN_COOKIES is not set
371# CONFIG_INET_AH is not set
372# CONFIG_INET_ESP is not set
373# CONFIG_INET_IPCOMP is not set
374# CONFIG_INET_XFRM_TUNNEL is not set
375# CONFIG_INET_TUNNEL is not set
376# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
377# CONFIG_INET_XFRM_MODE_TUNNEL is not set
378# CONFIG_INET_XFRM_MODE_BEET is not set
379# CONFIG_INET_LRO is not set
380CONFIG_INET_DIAG=y
381CONFIG_INET_TCP_DIAG=y
382# CONFIG_TCP_CONG_ADVANCED is not set
383CONFIG_TCP_CONG_CUBIC=y
384CONFIG_DEFAULT_TCP_CONG="cubic"
385# CONFIG_TCP_MD5SIG is not set
386# CONFIG_IPV6 is not set
387# CONFIG_NETWORK_SECMARK is not set
388# CONFIG_NETFILTER is not set
389# CONFIG_IP_DCCP is not set
390# CONFIG_IP_SCTP is not set
391# CONFIG_TIPC is not set
392# CONFIG_ATM is not set
393# CONFIG_BRIDGE is not set
394# CONFIG_NET_DSA is not set
395# CONFIG_VLAN_8021Q is not set
396# CONFIG_DECNET is not set
397# CONFIG_LLC2 is not set
398# CONFIG_IPX is not set
399# CONFIG_ATALK is not set
400# CONFIG_X25 is not set
401# CONFIG_LAPB is not set
402# CONFIG_ECONET is not set
403# CONFIG_WAN_ROUTER is not set
404# CONFIG_PHONET is not set
405# CONFIG_IEEE802154 is not set
406# CONFIG_NET_SCHED is not set
407# CONFIG_DCB is not set
408
409#
410# Network testing
411#
412# CONFIG_NET_PKTGEN is not set
413# CONFIG_HAMRADIO is not set
414# CONFIG_CAN is not set
415# CONFIG_IRDA is not set
416# CONFIG_BT is not set
417# CONFIG_AF_RXRPC is not set
418CONFIG_WIRELESS=y
419# CONFIG_CFG80211 is not set
420# CONFIG_WIRELESS_OLD_REGULATORY is not set
421# CONFIG_WIRELESS_EXT is not set
422# CONFIG_LIB80211 is not set
423
424#
425# CFG80211 needs to be enabled for MAC80211
426#
427CONFIG_MAC80211_DEFAULT_PS_VALUE=0
428# CONFIG_WIMAX is not set
429# CONFIG_RFKILL is not set
430# CONFIG_NET_9P is not set
431
432#
433# Device Drivers
434#
435
436#
437# Generic Driver Options
438#
439CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
440CONFIG_STANDALONE=y
441CONFIG_PREVENT_FIRMWARE_BUILD=y
442CONFIG_FW_LOADER=y
443CONFIG_FIRMWARE_IN_KERNEL=y
444CONFIG_EXTRA_FIRMWARE=""
445# CONFIG_SYS_HYPERVISOR is not set
446# CONFIG_CONNECTOR is not set
447CONFIG_MTD=y
448# CONFIG_MTD_DEBUG is not set
449CONFIG_MTD_CONCAT=y
450CONFIG_MTD_PARTITIONS=y
451# CONFIG_MTD_TESTS is not set
452# CONFIG_MTD_REDBOOT_PARTS is not set
453CONFIG_MTD_CMDLINE_PARTS=y
454# CONFIG_MTD_AR7_PARTS is not set
455
456#
457# User Modules And Translation Layers
458#
459CONFIG_MTD_CHAR=y
460CONFIG_MTD_BLKDEVS=y
461CONFIG_MTD_BLOCK=y
462# CONFIG_FTL is not set
463# CONFIG_NFTL is not set
464# CONFIG_INFTL is not set
465# CONFIG_RFD_FTL is not set
466# CONFIG_SSFDC is not set
467# CONFIG_MTD_OOPS is not set
468
469#
470# RAM/ROM/Flash chip drivers
471#
472CONFIG_MTD_CFI=y
473# CONFIG_MTD_JEDECPROBE is not set
474CONFIG_MTD_GEN_PROBE=y
475# CONFIG_MTD_CFI_ADV_OPTIONS is not set
476CONFIG_MTD_MAP_BANK_WIDTH_1=y
477CONFIG_MTD_MAP_BANK_WIDTH_2=y
478CONFIG_MTD_MAP_BANK_WIDTH_4=y
479# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
480# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
481# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
482CONFIG_MTD_CFI_I1=y
483CONFIG_MTD_CFI_I2=y
484# CONFIG_MTD_CFI_I4 is not set
485# CONFIG_MTD_CFI_I8 is not set
486# CONFIG_MTD_CFI_INTELEXT is not set
487CONFIG_MTD_CFI_AMDSTD=y
488# CONFIG_MTD_CFI_STAA is not set
489CONFIG_MTD_CFI_UTIL=y
490# CONFIG_MTD_RAM is not set
491# CONFIG_MTD_ROM is not set
492# CONFIG_MTD_ABSENT is not set
493
494#
495# Mapping drivers for chip access
496#
497# CONFIG_MTD_COMPLEX_MAPPINGS is not set
498CONFIG_MTD_PHYSMAP=y
499# CONFIG_MTD_PHYSMAP_COMPAT is not set
500# CONFIG_MTD_PLATRAM is not set
501
502#
503# Self-contained MTD device drivers
504#
505# CONFIG_MTD_DATAFLASH is not set
506# CONFIG_MTD_M25P80 is not set
507# CONFIG_MTD_SLRAM is not set
508# CONFIG_MTD_PHRAM is not set
509# CONFIG_MTD_MTDRAM is not set
510# CONFIG_MTD_BLOCK2MTD is not set
511
512#
513# Disk-On-Chip Device Drivers
514#
515# CONFIG_MTD_DOC2000 is not set
516# CONFIG_MTD_DOC2001 is not set
517# CONFIG_MTD_DOC2001PLUS is not set
518CONFIG_MTD_NAND=y
519# CONFIG_MTD_NAND_VERIFY_WRITE is not set
520# CONFIG_MTD_NAND_ECC_SMC is not set
521# CONFIG_MTD_NAND_MUSEUM_IDS is not set
522CONFIG_MTD_NAND_IDS=y
523# CONFIG_MTD_NAND_DISKONCHIP is not set
524# CONFIG_MTD_NAND_NANDSIM is not set
525# CONFIG_MTD_NAND_PLATFORM is not set
526# CONFIG_MTD_ALAUDA is not set
527# CONFIG_MTD_ONENAND is not set
528
529#
530# LPDDR flash memory drivers
531#
532# CONFIG_MTD_LPDDR is not set
533
534#
535# UBI - Unsorted block images
536#
537CONFIG_MTD_UBI=y
538CONFIG_MTD_UBI_WL_THRESHOLD=4096
539CONFIG_MTD_UBI_BEB_RESERVE=1
540# CONFIG_MTD_UBI_GLUEBI is not set
541
542#
543# UBI debugging options
544#
545# CONFIG_MTD_UBI_DEBUG is not set
546# CONFIG_PARPORT is not set
547CONFIG_BLK_DEV=y
548# CONFIG_BLK_DEV_COW_COMMON is not set
549# CONFIG_BLK_DEV_LOOP is not set
550# CONFIG_BLK_DEV_NBD is not set
551# CONFIG_BLK_DEV_UB is not set
552CONFIG_BLK_DEV_RAM=y
553CONFIG_BLK_DEV_RAM_COUNT=4
554CONFIG_BLK_DEV_RAM_SIZE=4096
555# CONFIG_BLK_DEV_XIP is not set
556# CONFIG_CDROM_PKTCDVD is not set
557# CONFIG_ATA_OVER_ETH is not set
558# CONFIG_BLK_DEV_HD is not set
559CONFIG_MISC_DEVICES=y
560# CONFIG_ICS932S401 is not set
561# CONFIG_ENCLOSURE_SERVICES is not set
562# CONFIG_ISL29003 is not set
563# CONFIG_C2PORT is not set
564
565#
566# EEPROM support
567#
568# CONFIG_EEPROM_AT24 is not set
569# CONFIG_EEPROM_AT25 is not set
570# CONFIG_EEPROM_LEGACY is not set
571# CONFIG_EEPROM_MAX6875 is not set
572# CONFIG_EEPROM_93CX6 is not set
573CONFIG_HAVE_IDE=y
574# CONFIG_IDE is not set
575
576#
577# SCSI device support
578#
579# CONFIG_RAID_ATTRS is not set
580CONFIG_SCSI=y
581CONFIG_SCSI_DMA=y
582# CONFIG_SCSI_TGT is not set
583# CONFIG_SCSI_NETLINK is not set
584CONFIG_SCSI_PROC_FS=y
585
586#
587# SCSI support type (disk, tape, CD-ROM)
588#
589CONFIG_BLK_DEV_SD=y
590# CONFIG_CHR_DEV_ST is not set
591# CONFIG_CHR_DEV_OSST is not set
592# CONFIG_BLK_DEV_SR is not set
593# CONFIG_CHR_DEV_SG is not set
594# CONFIG_CHR_DEV_SCH is not set
595# CONFIG_SCSI_MULTI_LUN is not set
596# CONFIG_SCSI_CONSTANTS is not set
597# CONFIG_SCSI_LOGGING is not set
598# CONFIG_SCSI_SCAN_ASYNC is not set
599CONFIG_SCSI_WAIT_SCAN=m
600
601#
602# SCSI Transports
603#
604# CONFIG_SCSI_SPI_ATTRS is not set
605# CONFIG_SCSI_FC_ATTRS is not set
606# CONFIG_SCSI_ISCSI_ATTRS is not set
607# CONFIG_SCSI_SAS_LIBSAS is not set
608# CONFIG_SCSI_SRP_ATTRS is not set
609CONFIG_SCSI_LOWLEVEL=y
610# CONFIG_ISCSI_TCP is not set
611# CONFIG_LIBFC is not set
612# CONFIG_LIBFCOE is not set
613# CONFIG_SCSI_DEBUG is not set
614# CONFIG_SCSI_DH is not set
615# CONFIG_SCSI_OSD_INITIATOR is not set
616# CONFIG_ATA is not set
617# CONFIG_MD is not set
618CONFIG_NETDEVICES=y
619# CONFIG_DUMMY is not set
620# CONFIG_BONDING is not set
621# CONFIG_MACVLAN is not set
622# CONFIG_EQUALIZER is not set
623# CONFIG_TUN is not set
624# CONFIG_VETH is not set
625CONFIG_PHYLIB=y
626
627#
628# MII PHY device drivers
629#
630# CONFIG_MARVELL_PHY is not set
631# CONFIG_DAVICOM_PHY is not set
632# CONFIG_QSEMI_PHY is not set
633# CONFIG_LXT_PHY is not set
634# CONFIG_CICADA_PHY is not set
635# CONFIG_VITESSE_PHY is not set
636CONFIG_SMSC_PHY=y
637# CONFIG_BROADCOM_PHY is not set
638# CONFIG_ICPLUS_PHY is not set
639# CONFIG_REALTEK_PHY is not set
640# CONFIG_NATIONAL_PHY is not set
641# CONFIG_STE10XP is not set
642# CONFIG_LSI_ET1011C_PHY is not set
643# CONFIG_FIXED_PHY is not set
644CONFIG_MDIO_BITBANG=y
645# CONFIG_MDIO_GPIO is not set
646CONFIG_NET_ETHERNET=y
647CONFIG_MII=y
648# CONFIG_AX88796 is not set
649# CONFIG_STNIC is not set
650CONFIG_SH_ETH=y
651# CONFIG_SMC91X is not set
652# CONFIG_ENC28J60 is not set
653# CONFIG_ETHOC is not set
654# CONFIG_SMC911X is not set
655# CONFIG_SMSC911X is not set
656# CONFIG_DNET is not set
657# CONFIG_IBM_NEW_EMAC_ZMII is not set
658# CONFIG_IBM_NEW_EMAC_RGMII is not set
659# CONFIG_IBM_NEW_EMAC_TAH is not set
660# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
661# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
662# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
663# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
664# CONFIG_B44 is not set
665# CONFIG_KS8842 is not set
666# CONFIG_KS8851 is not set
667# CONFIG_NETDEV_1000 is not set
668# CONFIG_NETDEV_10000 is not set
669
670#
671# Wireless LAN
672#
673# CONFIG_WLAN_PRE80211 is not set
674# CONFIG_WLAN_80211 is not set
675
676#
677# Enable WiMAX (Networking options) to see the WiMAX drivers
678#
679
680#
681# USB Network Adapters
682#
683# CONFIG_USB_CATC is not set
684# CONFIG_USB_KAWETH is not set
685# CONFIG_USB_PEGASUS is not set
686# CONFIG_USB_RTL8150 is not set
687# CONFIG_USB_USBNET is not set
688# CONFIG_WAN is not set
689# CONFIG_PPP is not set
690# CONFIG_SLIP is not set
691# CONFIG_NETCONSOLE is not set
692# CONFIG_NETPOLL is not set
693# CONFIG_NET_POLL_CONTROLLER is not set
694# CONFIG_ISDN is not set
695# CONFIG_PHONE is not set
696
697#
698# Input device support
699#
700CONFIG_INPUT=y
701# CONFIG_INPUT_FF_MEMLESS is not set
702# CONFIG_INPUT_POLLDEV is not set
703
704#
705# Userland interfaces
706#
707# CONFIG_INPUT_MOUSEDEV is not set
708# CONFIG_INPUT_JOYDEV is not set
709CONFIG_INPUT_EVDEV=y
710# CONFIG_INPUT_EVBUG is not set
711
712#
713# Input Device Drivers
714#
715CONFIG_INPUT_KEYBOARD=y
716# CONFIG_KEYBOARD_ATKBD is not set
717# CONFIG_KEYBOARD_LKKBD is not set
718# CONFIG_KEYBOARD_GPIO is not set
719# CONFIG_KEYBOARD_MATRIX is not set
720# CONFIG_KEYBOARD_NEWTON is not set
721# CONFIG_KEYBOARD_STOWAWAY is not set
722# CONFIG_KEYBOARD_SUNKBD is not set
723CONFIG_KEYBOARD_SH_KEYSC=y
724# CONFIG_KEYBOARD_XTKBD is not set
725# CONFIG_INPUT_MOUSE is not set
726# CONFIG_INPUT_JOYSTICK is not set
727# CONFIG_INPUT_TABLET is not set
728# CONFIG_INPUT_TOUCHSCREEN is not set
729# CONFIG_INPUT_MISC is not set
730
731#
732# Hardware I/O ports
733#
734# CONFIG_SERIO is not set
735# CONFIG_GAMEPORT is not set
736
737#
738# Character devices
739#
740CONFIG_VT=y
741CONFIG_CONSOLE_TRANSLATIONS=y
742CONFIG_VT_CONSOLE=y
743CONFIG_HW_CONSOLE=y
744CONFIG_VT_HW_CONSOLE_BINDING=y
745CONFIG_DEVKMEM=y
746# CONFIG_SERIAL_NONSTANDARD is not set
747
748#
749# Serial drivers
750#
751# CONFIG_SERIAL_8250 is not set
752
753#
754# Non-8250 serial port support
755#
756# CONFIG_SERIAL_MAX3100 is not set
757CONFIG_SERIAL_SH_SCI=y
758CONFIG_SERIAL_SH_SCI_NR_UARTS=6
759CONFIG_SERIAL_SH_SCI_CONSOLE=y
760CONFIG_SERIAL_CORE=y
761CONFIG_SERIAL_CORE_CONSOLE=y
762CONFIG_UNIX98_PTYS=y
763# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
764CONFIG_LEGACY_PTYS=y
765CONFIG_LEGACY_PTY_COUNT=256
766# CONFIG_IPMI_HANDLER is not set
767CONFIG_HW_RANDOM=y
768# CONFIG_HW_RANDOM_TIMERIOMEM is not set
769# CONFIG_R3964 is not set
770# CONFIG_RAW_DRIVER is not set
771# CONFIG_TCG_TPM is not set
772CONFIG_I2C=y
773CONFIG_I2C_BOARDINFO=y
774CONFIG_I2C_CHARDEV=y
775CONFIG_I2C_HELPER_AUTO=y
776
777#
778# I2C Hardware Bus support
779#
780
781#
782# I2C system bus drivers (mostly embedded / system-on-chip)
783#
784# CONFIG_I2C_DESIGNWARE is not set
785# CONFIG_I2C_GPIO is not set
786# CONFIG_I2C_OCORES is not set
787CONFIG_I2C_SH_MOBILE=y
788# CONFIG_I2C_SIMTEC is not set
789
790#
791# External I2C/SMBus adapter drivers
792#
793# CONFIG_I2C_PARPORT_LIGHT is not set
794# CONFIG_I2C_TAOS_EVM is not set
795# CONFIG_I2C_TINY_USB is not set
796
797#
798# Other I2C/SMBus bus drivers
799#
800# CONFIG_I2C_PCA_PLATFORM is not set
801# CONFIG_I2C_STUB is not set
802
803#
804# Miscellaneous I2C Chip support
805#
806# CONFIG_DS1682 is not set
807# CONFIG_SENSORS_PCF8574 is not set
808# CONFIG_PCF8575 is not set
809# CONFIG_SENSORS_PCA9539 is not set
810# CONFIG_SENSORS_TSL2550 is not set
811# CONFIG_I2C_DEBUG_CORE is not set
812# CONFIG_I2C_DEBUG_ALGO is not set
813# CONFIG_I2C_DEBUG_BUS is not set
814# CONFIG_I2C_DEBUG_CHIP is not set
815CONFIG_SPI=y
816CONFIG_SPI_MASTER=y
817
818#
819# SPI Master Controller Drivers
820#
821CONFIG_SPI_BITBANG=y
822# CONFIG_SPI_GPIO is not set
823# CONFIG_SPI_SH_SCI is not set
824
825#
826# SPI Protocol Masters
827#
828# CONFIG_SPI_SPIDEV is not set
829# CONFIG_SPI_TLE62X0 is not set
830
831#
832# PPS support
833#
834# CONFIG_PPS is not set
835CONFIG_ARCH_REQUIRE_GPIOLIB=y
836CONFIG_GPIOLIB=y
837# CONFIG_GPIO_SYSFS is not set
838
839#
840# Memory mapped GPIO expanders:
841#
842
843#
844# I2C GPIO expanders:
845#
846# CONFIG_GPIO_MAX732X is not set
847# CONFIG_GPIO_PCA953X is not set
848# CONFIG_GPIO_PCF857X is not set
849
850#
851# PCI GPIO expanders:
852#
853
854#
855# SPI GPIO expanders:
856#
857# CONFIG_GPIO_MAX7301 is not set
858# CONFIG_GPIO_MCP23S08 is not set
859# CONFIG_W1 is not set
860# CONFIG_POWER_SUPPLY is not set
861# CONFIG_HWMON is not set
862# CONFIG_THERMAL is not set
863# CONFIG_THERMAL_HWMON is not set
864# CONFIG_WATCHDOG is not set
865CONFIG_SSB_POSSIBLE=y
866
867#
868# Sonics Silicon Backplane
869#
870# CONFIG_SSB is not set
871
872#
873# Multifunction device drivers
874#
875# CONFIG_MFD_CORE is not set
876# CONFIG_MFD_SM501 is not set
877# CONFIG_HTC_PASIC3 is not set
878# CONFIG_TPS65010 is not set
879# CONFIG_TWL4030_CORE is not set
880# CONFIG_MFD_TMIO is not set
881# CONFIG_PMIC_DA903X is not set
882# CONFIG_MFD_WM8400 is not set
883# CONFIG_MFD_WM8350_I2C is not set
884# CONFIG_MFD_PCF50633 is not set
885# CONFIG_AB3100_CORE is not set
886# CONFIG_EZX_PCAP is not set
887# CONFIG_REGULATOR is not set
888CONFIG_MEDIA_SUPPORT=y
889
890#
891# Multimedia core support
892#
893CONFIG_VIDEO_DEV=y
894CONFIG_VIDEO_V4L2_COMMON=y
895CONFIG_VIDEO_ALLOW_V4L1=y
896CONFIG_VIDEO_V4L1_COMPAT=y
897# CONFIG_DVB_CORE is not set
898CONFIG_VIDEO_MEDIA=y
899
900#
901# Multimedia drivers
902#
903# CONFIG_MEDIA_ATTACH is not set
904CONFIG_MEDIA_TUNER=y
905# CONFIG_MEDIA_TUNER_CUSTOMISE is not set
906CONFIG_MEDIA_TUNER_SIMPLE=y
907CONFIG_MEDIA_TUNER_TDA8290=y
908CONFIG_MEDIA_TUNER_TDA9887=y
909CONFIG_MEDIA_TUNER_TEA5761=y
910CONFIG_MEDIA_TUNER_TEA5767=y
911CONFIG_MEDIA_TUNER_MT20XX=y
912CONFIG_MEDIA_TUNER_XC2028=y
913CONFIG_MEDIA_TUNER_XC5000=y
914CONFIG_MEDIA_TUNER_MC44S803=y
915CONFIG_VIDEO_V4L2=y
916CONFIG_VIDEO_V4L1=y
917CONFIG_VIDEOBUF_GEN=y
918CONFIG_VIDEOBUF_DMA_CONTIG=y
919CONFIG_VIDEO_CAPTURE_DRIVERS=y
920# CONFIG_VIDEO_ADV_DEBUG is not set
921# CONFIG_VIDEO_FIXED_MINOR_RANGES is not set
922CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
923# CONFIG_VIDEO_VIVI is not set
924# CONFIG_VIDEO_CPIA is not set
925# CONFIG_VIDEO_CPIA2 is not set
926# CONFIG_VIDEO_SAA5246A is not set
927# CONFIG_VIDEO_SAA5249 is not set
928CONFIG_SOC_CAMERA=y
929# CONFIG_SOC_CAMERA_MT9M001 is not set
930# CONFIG_SOC_CAMERA_MT9M111 is not set
931# CONFIG_SOC_CAMERA_MT9T031 is not set
932# CONFIG_SOC_CAMERA_MT9V022 is not set
933# CONFIG_SOC_CAMERA_TW9910 is not set
934# CONFIG_SOC_CAMERA_PLATFORM is not set
935# CONFIG_SOC_CAMERA_OV772X is not set
936CONFIG_VIDEO_SH_MOBILE_CEU=y
937# CONFIG_V4L_USB_DRIVERS is not set
938CONFIG_RADIO_ADAPTERS=y
939# CONFIG_USB_DSBR is not set
940# CONFIG_USB_SI470X is not set
941# CONFIG_USB_MR800 is not set
942# CONFIG_RADIO_TEA5764 is not set
943# CONFIG_DAB is not set
944
945#
946# Graphics support
947#
948# CONFIG_VGASTATE is not set
949# CONFIG_VIDEO_OUTPUT_CONTROL is not set
950CONFIG_FB=y
951# CONFIG_FIRMWARE_EDID is not set
952# CONFIG_FB_DDC is not set
953# CONFIG_FB_BOOT_VESA_SUPPORT is not set
954# CONFIG_FB_CFB_FILLRECT is not set
955# CONFIG_FB_CFB_COPYAREA is not set
956# CONFIG_FB_CFB_IMAGEBLIT is not set
957# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
958CONFIG_FB_SYS_FILLRECT=y
959CONFIG_FB_SYS_COPYAREA=y
960CONFIG_FB_SYS_IMAGEBLIT=y
961# CONFIG_FB_FOREIGN_ENDIAN is not set
962CONFIG_FB_SYS_FOPS=y
963CONFIG_FB_DEFERRED_IO=y
964# CONFIG_FB_SVGALIB is not set
965# CONFIG_FB_MACMODES is not set
966# CONFIG_FB_BACKLIGHT is not set
967# CONFIG_FB_MODE_HELPERS is not set
968# CONFIG_FB_TILEBLITTING is not set
969
970#
971# Frame buffer hardware drivers
972#
973# CONFIG_FB_S1D13XXX is not set
974CONFIG_FB_SH_MOBILE_LCDC=y
975# CONFIG_FB_VIRTUAL is not set
976# CONFIG_FB_METRONOME is not set
977# CONFIG_FB_MB862XX is not set
978# CONFIG_FB_BROADSHEET is not set
979# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
980
981#
982# Display device support
983#
984# CONFIG_DISPLAY_SUPPORT is not set
985
986#
987# Console display driver support
988#
989CONFIG_DUMMY_CONSOLE=y
990CONFIG_FRAMEBUFFER_CONSOLE=y
991# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
992# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
993# CONFIG_FONTS is not set
994CONFIG_FONT_8x8=y
995CONFIG_FONT_8x16=y
996CONFIG_LOGO=y
997# CONFIG_LOGO_LINUX_MONO is not set
998# CONFIG_LOGO_LINUX_VGA16 is not set
999# CONFIG_LOGO_LINUX_CLUT224 is not set
1000# CONFIG_LOGO_SUPERH_MONO is not set
1001# CONFIG_LOGO_SUPERH_VGA16 is not set
1002CONFIG_LOGO_SUPERH_CLUT224=y
1003# CONFIG_SOUND is not set
1004CONFIG_HID_SUPPORT=y
1005CONFIG_HID=y
1006# CONFIG_HID_DEBUG is not set
1007# CONFIG_HIDRAW is not set
1008
1009#
1010# USB Input Devices
1011#
1012CONFIG_USB_HID=y
1013# CONFIG_HID_PID is not set
1014# CONFIG_USB_HIDDEV is not set
1015
1016#
1017# Special HID drivers
1018#
1019# CONFIG_HID_A4TECH is not set
1020# CONFIG_HID_APPLE is not set
1021# CONFIG_HID_BELKIN is not set
1022# CONFIG_HID_CHERRY is not set
1023# CONFIG_HID_CHICONY is not set
1024# CONFIG_HID_CYPRESS is not set
1025# CONFIG_HID_DRAGONRISE is not set
1026# CONFIG_HID_EZKEY is not set
1027# CONFIG_HID_KYE is not set
1028# CONFIG_HID_GYRATION is not set
1029# CONFIG_HID_KENSINGTON is not set
1030# CONFIG_HID_LOGITECH is not set
1031# CONFIG_HID_MICROSOFT is not set
1032# CONFIG_HID_MONTEREY is not set
1033# CONFIG_HID_NTRIG is not set
1034# CONFIG_HID_PANTHERLORD is not set
1035# CONFIG_HID_PETALYNX is not set
1036# CONFIG_HID_SAMSUNG is not set
1037# CONFIG_HID_SONY is not set
1038# CONFIG_HID_SUNPLUS is not set
1039# CONFIG_HID_GREENASIA is not set
1040# CONFIG_HID_SMARTJOYPLUS is not set
1041# CONFIG_HID_TOPSEED is not set
1042# CONFIG_HID_THRUSTMASTER is not set
1043# CONFIG_HID_ZEROPLUS is not set
1044CONFIG_USB_SUPPORT=y
1045CONFIG_USB_ARCH_HAS_HCD=y
1046# CONFIG_USB_ARCH_HAS_OHCI is not set
1047# CONFIG_USB_ARCH_HAS_EHCI is not set
1048CONFIG_USB=y
1049# CONFIG_USB_DEBUG is not set
1050# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1051
1052#
1053# Miscellaneous USB options
1054#
1055CONFIG_USB_DEVICEFS=y
1056CONFIG_USB_DEVICE_CLASS=y
1057# CONFIG_USB_DYNAMIC_MINORS is not set
1058# CONFIG_USB_SUSPEND is not set
1059# CONFIG_USB_OTG is not set
1060# CONFIG_USB_OTG_WHITELIST is not set
1061# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1062CONFIG_USB_MON=y
1063# CONFIG_USB_WUSB is not set
1064# CONFIG_USB_WUSB_CBAF is not set
1065
1066#
1067# USB Host Controller Drivers
1068#
1069# CONFIG_USB_C67X00_HCD is not set
1070# CONFIG_USB_OXU210HP_HCD is not set
1071# CONFIG_USB_ISP116X_HCD is not set
1072# CONFIG_USB_ISP1760_HCD is not set
1073# CONFIG_USB_SL811_HCD is not set
1074CONFIG_USB_R8A66597_HCD=y
1075# CONFIG_USB_HWA_HCD is not set
1076
1077#
1078# USB Device Class drivers
1079#
1080# CONFIG_USB_ACM is not set
1081# CONFIG_USB_PRINTER is not set
1082# CONFIG_USB_WDM is not set
1083# CONFIG_USB_TMC is not set
1084
1085#
1086# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1087#
1088
1089#
1090# also be needed; see USB_STORAGE Help for more info
1091#
1092CONFIG_USB_STORAGE=y
1093# CONFIG_USB_STORAGE_DEBUG is not set
1094# CONFIG_USB_STORAGE_DATAFAB is not set
1095# CONFIG_USB_STORAGE_FREECOM is not set
1096# CONFIG_USB_STORAGE_ISD200 is not set
1097# CONFIG_USB_STORAGE_USBAT is not set
1098# CONFIG_USB_STORAGE_SDDR09 is not set
1099# CONFIG_USB_STORAGE_SDDR55 is not set
1100# CONFIG_USB_STORAGE_JUMPSHOT is not set
1101# CONFIG_USB_STORAGE_ALAUDA is not set
1102# CONFIG_USB_STORAGE_ONETOUCH is not set
1103# CONFIG_USB_STORAGE_KARMA is not set
1104# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1105# CONFIG_USB_LIBUSUAL is not set
1106
1107#
1108# USB Imaging devices
1109#
1110# CONFIG_USB_MDC800 is not set
1111# CONFIG_USB_MICROTEK is not set
1112
1113#
1114# USB port drivers
1115#
1116# CONFIG_USB_SERIAL is not set
1117
1118#
1119# USB Miscellaneous drivers
1120#
1121# CONFIG_USB_EMI62 is not set
1122# CONFIG_USB_EMI26 is not set
1123# CONFIG_USB_ADUTUX is not set
1124# CONFIG_USB_SEVSEG is not set
1125# CONFIG_USB_RIO500 is not set
1126# CONFIG_USB_LEGOTOWER is not set
1127# CONFIG_USB_LCD is not set
1128# CONFIG_USB_BERRY_CHARGE is not set
1129# CONFIG_USB_LED is not set
1130# CONFIG_USB_CYPRESS_CY7C63 is not set
1131# CONFIG_USB_CYTHERM is not set
1132# CONFIG_USB_IDMOUSE is not set
1133# CONFIG_USB_FTDI_ELAN is not set
1134# CONFIG_USB_APPLEDISPLAY is not set
1135# CONFIG_USB_LD is not set
1136# CONFIG_USB_TRANCEVIBRATOR is not set
1137# CONFIG_USB_IOWARRIOR is not set
1138# CONFIG_USB_TEST is not set
1139# CONFIG_USB_ISIGHTFW is not set
1140# CONFIG_USB_VST is not set
1141# CONFIG_USB_GADGET is not set
1142
1143#
1144# OTG and related infrastructure
1145#
1146# CONFIG_USB_GPIO_VBUS is not set
1147# CONFIG_NOP_USB_XCEIV is not set
1148CONFIG_MMC=y
1149# CONFIG_MMC_DEBUG is not set
1150# CONFIG_MMC_UNSAFE_RESUME is not set
1151
1152#
1153# MMC/SD/SDIO Card Drivers
1154#
1155CONFIG_MMC_BLOCK=y
1156CONFIG_MMC_BLOCK_BOUNCE=y
1157# CONFIG_SDIO_UART is not set
1158# CONFIG_MMC_TEST is not set
1159
1160#
1161# MMC/SD/SDIO Host Controller Drivers
1162#
1163# CONFIG_MMC_SDHCI is not set
1164CONFIG_MMC_SPI=y
1165# CONFIG_MEMSTICK is not set
1166# CONFIG_NEW_LEDS is not set
1167# CONFIG_ACCESSIBILITY is not set
1168CONFIG_RTC_LIB=y
1169CONFIG_RTC_CLASS=y
1170CONFIG_RTC_HCTOSYS=y
1171CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
1172# CONFIG_RTC_DEBUG is not set
1173
1174#
1175# RTC interfaces
1176#
1177CONFIG_RTC_INTF_SYSFS=y
1178CONFIG_RTC_INTF_PROC=y
1179CONFIG_RTC_INTF_DEV=y
1180# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
1181# CONFIG_RTC_DRV_TEST is not set
1182
1183#
1184# I2C RTC drivers
1185#
1186# CONFIG_RTC_DRV_DS1307 is not set
1187# CONFIG_RTC_DRV_DS1374 is not set
1188# CONFIG_RTC_DRV_DS1672 is not set
1189# CONFIG_RTC_DRV_MAX6900 is not set
1190# CONFIG_RTC_DRV_RS5C372 is not set
1191# CONFIG_RTC_DRV_ISL1208 is not set
1192# CONFIG_RTC_DRV_X1205 is not set
1193CONFIG_RTC_DRV_PCF8563=y
1194# CONFIG_RTC_DRV_PCF8583 is not set
1195# CONFIG_RTC_DRV_M41T80 is not set
1196# CONFIG_RTC_DRV_S35390A is not set
1197# CONFIG_RTC_DRV_FM3130 is not set
1198# CONFIG_RTC_DRV_RX8581 is not set
1199# CONFIG_RTC_DRV_RX8025 is not set
1200
1201#
1202# SPI RTC drivers
1203#
1204# CONFIG_RTC_DRV_M41T94 is not set
1205# CONFIG_RTC_DRV_DS1305 is not set
1206# CONFIG_RTC_DRV_DS1390 is not set
1207# CONFIG_RTC_DRV_MAX6902 is not set
1208# CONFIG_RTC_DRV_R9701 is not set
1209# CONFIG_RTC_DRV_RS5C348 is not set
1210# CONFIG_RTC_DRV_DS3234 is not set
1211
1212#
1213# Platform RTC drivers
1214#
1215# CONFIG_RTC_DRV_DS1286 is not set
1216# CONFIG_RTC_DRV_DS1511 is not set
1217# CONFIG_RTC_DRV_DS1553 is not set
1218# CONFIG_RTC_DRV_DS1742 is not set
1219# CONFIG_RTC_DRV_STK17TA8 is not set
1220# CONFIG_RTC_DRV_M48T86 is not set
1221# CONFIG_RTC_DRV_M48T35 is not set
1222# CONFIG_RTC_DRV_M48T59 is not set
1223# CONFIG_RTC_DRV_BQ4802 is not set
1224# CONFIG_RTC_DRV_V3020 is not set
1225
1226#
1227# on-CPU RTC drivers
1228#
1229# CONFIG_RTC_DRV_SH is not set
1230# CONFIG_RTC_DRV_GENERIC is not set
1231# CONFIG_DMADEVICES is not set
1232# CONFIG_AUXDISPLAY is not set
1233CONFIG_UIO=y
1234# CONFIG_UIO_PDRV is not set
1235CONFIG_UIO_PDRV_GENIRQ=y
1236# CONFIG_UIO_SMX is not set
1237# CONFIG_UIO_SERCOS3 is not set
1238
1239#
1240# TI VLYNQ
1241#
1242# CONFIG_STAGING is not set
1243
1244#
1245# File systems
1246#
1247CONFIG_EXT2_FS=y
1248CONFIG_EXT2_FS_XATTR=y
1249CONFIG_EXT2_FS_POSIX_ACL=y
1250CONFIG_EXT2_FS_SECURITY=y
1251# CONFIG_EXT2_FS_XIP is not set
1252CONFIG_EXT3_FS=y
1253# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
1254CONFIG_EXT3_FS_XATTR=y
1255CONFIG_EXT3_FS_POSIX_ACL=y
1256CONFIG_EXT3_FS_SECURITY=y
1257# CONFIG_EXT4_FS is not set
1258CONFIG_JBD=y
1259# CONFIG_JBD_DEBUG is not set
1260CONFIG_FS_MBCACHE=y
1261# CONFIG_REISERFS_FS is not set
1262# CONFIG_JFS_FS is not set
1263CONFIG_FS_POSIX_ACL=y
1264# CONFIG_XFS_FS is not set
1265# CONFIG_GFS2_FS is not set
1266# CONFIG_OCFS2_FS is not set
1267# CONFIG_BTRFS_FS is not set
1268CONFIG_FILE_LOCKING=y
1269CONFIG_FSNOTIFY=y
1270CONFIG_DNOTIFY=y
1271CONFIG_INOTIFY=y
1272CONFIG_INOTIFY_USER=y
1273# CONFIG_QUOTA is not set
1274# CONFIG_AUTOFS_FS is not set
1275# CONFIG_AUTOFS4_FS is not set
1276# CONFIG_FUSE_FS is not set
1277
1278#
1279# Caches
1280#
1281# CONFIG_FSCACHE is not set
1282
1283#
1284# CD-ROM/DVD Filesystems
1285#
1286# CONFIG_ISO9660_FS is not set
1287# CONFIG_UDF_FS is not set
1288
1289#
1290# DOS/FAT/NT Filesystems
1291#
1292CONFIG_FAT_FS=y
1293# CONFIG_MSDOS_FS is not set
1294CONFIG_VFAT_FS=y
1295CONFIG_FAT_DEFAULT_CODEPAGE=437
1296CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1297# CONFIG_NTFS_FS is not set
1298
1299#
1300# Pseudo filesystems
1301#
1302CONFIG_PROC_FS=y
1303CONFIG_PROC_KCORE=y
1304CONFIG_PROC_SYSCTL=y
1305CONFIG_PROC_PAGE_MONITOR=y
1306CONFIG_SYSFS=y
1307CONFIG_TMPFS=y
1308# CONFIG_TMPFS_POSIX_ACL is not set
1309# CONFIG_HUGETLBFS is not set
1310# CONFIG_HUGETLB_PAGE is not set
1311# CONFIG_CONFIGFS_FS is not set
1312CONFIG_MISC_FILESYSTEMS=y
1313# CONFIG_ADFS_FS is not set
1314# CONFIG_AFFS_FS is not set
1315# CONFIG_HFS_FS is not set
1316# CONFIG_HFSPLUS_FS is not set
1317# CONFIG_BEFS_FS is not set
1318# CONFIG_BFS_FS is not set
1319# CONFIG_EFS_FS is not set
1320# CONFIG_JFFS2_FS is not set
1321# CONFIG_UBIFS_FS is not set
1322# CONFIG_CRAMFS is not set
1323# CONFIG_SQUASHFS is not set
1324# CONFIG_VXFS_FS is not set
1325# CONFIG_MINIX_FS is not set
1326# CONFIG_OMFS_FS is not set
1327# CONFIG_HPFS_FS is not set
1328# CONFIG_QNX4FS_FS is not set
1329# CONFIG_ROMFS_FS is not set
1330# CONFIG_SYSV_FS is not set
1331# CONFIG_UFS_FS is not set
1332# CONFIG_NILFS2_FS is not set
1333CONFIG_NETWORK_FILESYSTEMS=y
1334CONFIG_NFS_FS=y
1335CONFIG_NFS_V3=y
1336# CONFIG_NFS_V3_ACL is not set
1337# CONFIG_NFS_V4 is not set
1338CONFIG_ROOT_NFS=y
1339CONFIG_NFSD=y
1340CONFIG_NFSD_V3=y
1341# CONFIG_NFSD_V3_ACL is not set
1342# CONFIG_NFSD_V4 is not set
1343CONFIG_LOCKD=y
1344CONFIG_LOCKD_V4=y
1345CONFIG_EXPORTFS=y
1346CONFIG_NFS_COMMON=y
1347CONFIG_SUNRPC=y
1348# CONFIG_RPCSEC_GSS_KRB5 is not set
1349# CONFIG_RPCSEC_GSS_SPKM3 is not set
1350# CONFIG_SMB_FS is not set
1351# CONFIG_CIFS is not set
1352# CONFIG_NCP_FS is not set
1353# CONFIG_CODA_FS is not set
1354# CONFIG_AFS_FS is not set
1355
1356#
1357# Partition Types
1358#
1359# CONFIG_PARTITION_ADVANCED is not set
1360CONFIG_MSDOS_PARTITION=y
1361CONFIG_NLS=y
1362CONFIG_NLS_DEFAULT="iso8859-1"
1363CONFIG_NLS_CODEPAGE_437=y
1364# CONFIG_NLS_CODEPAGE_737 is not set
1365# CONFIG_NLS_CODEPAGE_775 is not set
1366# CONFIG_NLS_CODEPAGE_850 is not set
1367# CONFIG_NLS_CODEPAGE_852 is not set
1368# CONFIG_NLS_CODEPAGE_855 is not set
1369# CONFIG_NLS_CODEPAGE_857 is not set
1370# CONFIG_NLS_CODEPAGE_860 is not set
1371# CONFIG_NLS_CODEPAGE_861 is not set
1372# CONFIG_NLS_CODEPAGE_862 is not set
1373# CONFIG_NLS_CODEPAGE_863 is not set
1374# CONFIG_NLS_CODEPAGE_864 is not set
1375# CONFIG_NLS_CODEPAGE_865 is not set
1376# CONFIG_NLS_CODEPAGE_866 is not set
1377# CONFIG_NLS_CODEPAGE_869 is not set
1378# CONFIG_NLS_CODEPAGE_936 is not set
1379# CONFIG_NLS_CODEPAGE_950 is not set
1380CONFIG_NLS_CODEPAGE_932=y
1381# CONFIG_NLS_CODEPAGE_949 is not set
1382# CONFIG_NLS_CODEPAGE_874 is not set
1383# CONFIG_NLS_ISO8859_8 is not set
1384# CONFIG_NLS_CODEPAGE_1250 is not set
1385# CONFIG_NLS_CODEPAGE_1251 is not set
1386# CONFIG_NLS_ASCII is not set
1387CONFIG_NLS_ISO8859_1=y
1388# CONFIG_NLS_ISO8859_2 is not set
1389# CONFIG_NLS_ISO8859_3 is not set
1390# CONFIG_NLS_ISO8859_4 is not set
1391# CONFIG_NLS_ISO8859_5 is not set
1392# CONFIG_NLS_ISO8859_6 is not set
1393# CONFIG_NLS_ISO8859_7 is not set
1394# CONFIG_NLS_ISO8859_9 is not set
1395# CONFIG_NLS_ISO8859_13 is not set
1396# CONFIG_NLS_ISO8859_14 is not set
1397# CONFIG_NLS_ISO8859_15 is not set
1398# CONFIG_NLS_KOI8_R is not set
1399# CONFIG_NLS_KOI8_U is not set
1400# CONFIG_NLS_UTF8 is not set
1401# CONFIG_DLM is not set
1402
1403#
1404# Kernel hacking
1405#
1406CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1407# CONFIG_PRINTK_TIME is not set
1408CONFIG_ENABLE_WARN_DEPRECATED=y
1409# CONFIG_ENABLE_MUST_CHECK is not set
1410CONFIG_FRAME_WARN=1024
1411# CONFIG_MAGIC_SYSRQ is not set
1412# CONFIG_UNUSED_SYMBOLS is not set
1413CONFIG_DEBUG_FS=y
1414# CONFIG_HEADERS_CHECK is not set
1415# CONFIG_DEBUG_KERNEL is not set
1416# CONFIG_DEBUG_BUGVERBOSE is not set
1417# CONFIG_DEBUG_MEMORY_INIT is not set
1418# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1419# CONFIG_LATENCYTOP is not set
1420CONFIG_SYSCTL_SYSCALL_CHECK=y
1421CONFIG_HAVE_FUNCTION_TRACER=y
1422CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1423CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1424CONFIG_HAVE_DYNAMIC_FTRACE=y
1425CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1426CONFIG_HAVE_FTRACE_SYSCALLS=y
1427CONFIG_TRACING_SUPPORT=y
1428# CONFIG_FTRACE is not set
1429# CONFIG_DYNAMIC_DEBUG is not set
1430# CONFIG_DMA_API_DEBUG is not set
1431# CONFIG_SAMPLES is not set
1432CONFIG_HAVE_ARCH_KGDB=y
1433# CONFIG_SH_STANDARD_BIOS is not set
1434# CONFIG_EARLY_SCIF_CONSOLE is not set
1435# CONFIG_DWARF_UNWINDER is not set
1436
1437#
1438# Security options
1439#
1440# CONFIG_KEYS is not set
1441# CONFIG_SECURITY is not set
1442# CONFIG_SECURITYFS is not set
1443# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1444CONFIG_CRYPTO=y
1445
1446#
1447# Crypto core or helper
1448#
1449# CONFIG_CRYPTO_FIPS is not set
1450CONFIG_CRYPTO_ALGAPI=y
1451CONFIG_CRYPTO_ALGAPI2=y
1452CONFIG_CRYPTO_AEAD2=y
1453CONFIG_CRYPTO_BLKCIPHER=y
1454CONFIG_CRYPTO_BLKCIPHER2=y
1455CONFIG_CRYPTO_HASH2=y
1456CONFIG_CRYPTO_RNG2=y
1457CONFIG_CRYPTO_PCOMP=y
1458CONFIG_CRYPTO_MANAGER=y
1459CONFIG_CRYPTO_MANAGER2=y
1460# CONFIG_CRYPTO_GF128MUL is not set
1461# CONFIG_CRYPTO_NULL is not set
1462CONFIG_CRYPTO_WORKQUEUE=y
1463# CONFIG_CRYPTO_CRYPTD is not set
1464# CONFIG_CRYPTO_AUTHENC is not set
1465# CONFIG_CRYPTO_TEST is not set
1466
1467#
1468# Authenticated Encryption with Associated Data
1469#
1470# CONFIG_CRYPTO_CCM is not set
1471# CONFIG_CRYPTO_GCM is not set
1472# CONFIG_CRYPTO_SEQIV is not set
1473
1474#
1475# Block modes
1476#
1477CONFIG_CRYPTO_CBC=y
1478# CONFIG_CRYPTO_CTR is not set
1479# CONFIG_CRYPTO_CTS is not set
1480# CONFIG_CRYPTO_ECB is not set
1481# CONFIG_CRYPTO_LRW is not set
1482# CONFIG_CRYPTO_PCBC is not set
1483# CONFIG_CRYPTO_XTS is not set
1484
1485#
1486# Hash modes
1487#
1488# CONFIG_CRYPTO_HMAC is not set
1489# CONFIG_CRYPTO_XCBC is not set
1490
1491#
1492# Digest
1493#
1494# CONFIG_CRYPTO_CRC32C is not set
1495# CONFIG_CRYPTO_MD4 is not set
1496# CONFIG_CRYPTO_MD5 is not set
1497# CONFIG_CRYPTO_MICHAEL_MIC is not set
1498# CONFIG_CRYPTO_RMD128 is not set
1499# CONFIG_CRYPTO_RMD160 is not set
1500# CONFIG_CRYPTO_RMD256 is not set
1501# CONFIG_CRYPTO_RMD320 is not set
1502# CONFIG_CRYPTO_SHA1 is not set
1503# CONFIG_CRYPTO_SHA256 is not set
1504# CONFIG_CRYPTO_SHA512 is not set
1505# CONFIG_CRYPTO_TGR192 is not set
1506# CONFIG_CRYPTO_WP512 is not set
1507
1508#
1509# Ciphers
1510#
1511# CONFIG_CRYPTO_AES is not set
1512# CONFIG_CRYPTO_ANUBIS is not set
1513# CONFIG_CRYPTO_ARC4 is not set
1514# CONFIG_CRYPTO_BLOWFISH is not set
1515# CONFIG_CRYPTO_CAMELLIA is not set
1516# CONFIG_CRYPTO_CAST5 is not set
1517# CONFIG_CRYPTO_CAST6 is not set
1518# CONFIG_CRYPTO_DES is not set
1519# CONFIG_CRYPTO_FCRYPT is not set
1520# CONFIG_CRYPTO_KHAZAD is not set
1521# CONFIG_CRYPTO_SALSA20 is not set
1522# CONFIG_CRYPTO_SEED is not set
1523# CONFIG_CRYPTO_SERPENT is not set
1524# CONFIG_CRYPTO_TEA is not set
1525# CONFIG_CRYPTO_TWOFISH is not set
1526
1527#
1528# Compression
1529#
1530# CONFIG_CRYPTO_DEFLATE is not set
1531# CONFIG_CRYPTO_ZLIB is not set
1532# CONFIG_CRYPTO_LZO is not set
1533
1534#
1535# Random Number Generation
1536#
1537# CONFIG_CRYPTO_ANSI_CPRNG is not set
1538CONFIG_CRYPTO_HW=y
1539# CONFIG_BINARY_PRINTF is not set
1540
1541#
1542# Library routines
1543#
1544CONFIG_BITREVERSE=y
1545CONFIG_GENERIC_FIND_LAST_BIT=y
1546# CONFIG_CRC_CCITT is not set
1547# CONFIG_CRC16 is not set
1548CONFIG_CRC_T10DIF=y
1549CONFIG_CRC_ITU_T=y
1550CONFIG_CRC32=y
1551CONFIG_CRC7=y
1552# CONFIG_LIBCRC32C is not set
1553CONFIG_HAS_IOMEM=y
1554CONFIG_HAS_IOPORT=y
1555CONFIG_HAS_DMA=y
1556CONFIG_HAVE_LMB=y
1557CONFIG_NLATTR=y
1558CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/configs/kfr2r09-romimage_defconfig b/arch/sh/configs/kfr2r09-romimage_defconfig
new file mode 100644
index 00000000000..c0f9263e138
--- /dev/null
+++ b/arch/sh/configs/kfr2r09-romimage_defconfig
@@ -0,0 +1,774 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc6
4# Thu Aug 20 15:09:16 2009
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8# CONFIG_SUPERH64 is not set
9CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_BUG=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
18CONFIG_GENERIC_GPIO=y
19CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y
26CONFIG_LOCKDEP_SUPPORT=y
27CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U32 is not set
29# CONFIG_ARCH_HAS_ILOG2_U64 is not set
30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y
35
36#
37# General setup
38#
39CONFIG_EXPERIMENTAL=y
40CONFIG_BROKEN_ON_SMP=y
41CONFIG_INIT_ENV_ARG_LIMIT=32
42CONFIG_LOCALVERSION=""
43# CONFIG_LOCALVERSION_AUTO is not set
44CONFIG_HAVE_KERNEL_GZIP=y
45CONFIG_HAVE_KERNEL_BZIP2=y
46CONFIG_HAVE_KERNEL_LZMA=y
47CONFIG_KERNEL_GZIP=y
48# CONFIG_KERNEL_BZIP2 is not set
49# CONFIG_KERNEL_LZMA is not set
50CONFIG_SYSVIPC=y
51CONFIG_SYSVIPC_SYSCTL=y
52# CONFIG_POSIX_MQUEUE is not set
53CONFIG_BSD_PROCESS_ACCT=y
54# CONFIG_BSD_PROCESS_ACCT_V3 is not set
55# CONFIG_TASKSTATS is not set
56# CONFIG_AUDIT is not set
57
58#
59# RCU Subsystem
60#
61CONFIG_CLASSIC_RCU=y
62# CONFIG_TREE_RCU is not set
63# CONFIG_PREEMPT_RCU is not set
64# CONFIG_TREE_RCU_TRACE is not set
65# CONFIG_PREEMPT_RCU_TRACE is not set
66CONFIG_IKCONFIG=y
67CONFIG_IKCONFIG_PROC=y
68CONFIG_LOG_BUF_SHIFT=14
69CONFIG_GROUP_SCHED=y
70CONFIG_FAIR_GROUP_SCHED=y
71# CONFIG_RT_GROUP_SCHED is not set
72CONFIG_USER_SCHED=y
73# CONFIG_CGROUP_SCHED is not set
74# CONFIG_CGROUPS is not set
75CONFIG_SYSFS_DEPRECATED=y
76CONFIG_SYSFS_DEPRECATED_V2=y
77# CONFIG_RELAY is not set
78# CONFIG_NAMESPACES is not set
79CONFIG_BLK_DEV_INITRD=y
80CONFIG_INITRAMFS_SOURCE=""
81CONFIG_INITRAMFS_ROOT_UID=0
82CONFIG_INITRAMFS_ROOT_GID=0
83CONFIG_RD_GZIP=y
84# CONFIG_RD_BZIP2 is not set
85# CONFIG_RD_LZMA is not set
86# CONFIG_INITRAMFS_COMPRESSION_NONE is not set
87CONFIG_INITRAMFS_COMPRESSION_GZIP=y
88# CONFIG_INITRAMFS_COMPRESSION_BZIP2 is not set
89# CONFIG_INITRAMFS_COMPRESSION_LZMA is not set
90CONFIG_CC_OPTIMIZE_FOR_SIZE=y
91CONFIG_SYSCTL=y
92CONFIG_ANON_INODES=y
93CONFIG_EMBEDDED=y
94CONFIG_UID16=y
95CONFIG_SYSCTL_SYSCALL=y
96# CONFIG_KALLSYMS is not set
97CONFIG_HOTPLUG=y
98CONFIG_PRINTK=y
99CONFIG_BUG=y
100CONFIG_ELF_CORE=y
101CONFIG_BASE_FULL=y
102CONFIG_FUTEX=y
103CONFIG_EPOLL=y
104CONFIG_SIGNALFD=y
105CONFIG_TIMERFD=y
106CONFIG_EVENTFD=y
107CONFIG_SHMEM=y
108CONFIG_AIO=y
109CONFIG_HAVE_PERF_COUNTERS=y
110
111#
112# Performance Counters
113#
114# CONFIG_PERF_COUNTERS is not set
115CONFIG_VM_EVENT_COUNTERS=y
116# CONFIG_STRIP_ASM_SYMS is not set
117CONFIG_COMPAT_BRK=y
118CONFIG_SLAB=y
119# CONFIG_SLUB is not set
120# CONFIG_SLOB is not set
121# CONFIG_PROFILING is not set
122# CONFIG_MARKERS is not set
123CONFIG_HAVE_OPROFILE=y
124CONFIG_HAVE_IOREMAP_PROT=y
125CONFIG_HAVE_KPROBES=y
126CONFIG_HAVE_KRETPROBES=y
127CONFIG_HAVE_ARCH_TRACEHOOK=y
128CONFIG_HAVE_CLK=y
129CONFIG_HAVE_DMA_API_DEBUG=y
130
131#
132# GCOV-based kernel profiling
133#
134# CONFIG_GCOV_KERNEL is not set
135# CONFIG_SLOW_WORK is not set
136CONFIG_HAVE_GENERIC_DMA_COHERENT=y
137CONFIG_SLABINFO=y
138CONFIG_RT_MUTEXES=y
139CONFIG_BASE_SMALL=0
140# CONFIG_MODULES is not set
141# CONFIG_BLOCK is not set
142# CONFIG_FREEZER is not set
143
144#
145# System type
146#
147CONFIG_CPU_SH4=y
148CONFIG_CPU_SH4A=y
149CONFIG_CPU_SHX2=y
150CONFIG_ARCH_SHMOBILE=y
151# CONFIG_CPU_SUBTYPE_SH7619 is not set
152# CONFIG_CPU_SUBTYPE_SH7201 is not set
153# CONFIG_CPU_SUBTYPE_SH7203 is not set
154# CONFIG_CPU_SUBTYPE_SH7206 is not set
155# CONFIG_CPU_SUBTYPE_SH7263 is not set
156# CONFIG_CPU_SUBTYPE_MXG is not set
157# CONFIG_CPU_SUBTYPE_SH7705 is not set
158# CONFIG_CPU_SUBTYPE_SH7706 is not set
159# CONFIG_CPU_SUBTYPE_SH7707 is not set
160# CONFIG_CPU_SUBTYPE_SH7708 is not set
161# CONFIG_CPU_SUBTYPE_SH7709 is not set
162# CONFIG_CPU_SUBTYPE_SH7710 is not set
163# CONFIG_CPU_SUBTYPE_SH7712 is not set
164# CONFIG_CPU_SUBTYPE_SH7720 is not set
165# CONFIG_CPU_SUBTYPE_SH7721 is not set
166# CONFIG_CPU_SUBTYPE_SH7750 is not set
167# CONFIG_CPU_SUBTYPE_SH7091 is not set
168# CONFIG_CPU_SUBTYPE_SH7750R is not set
169# CONFIG_CPU_SUBTYPE_SH7750S is not set
170# CONFIG_CPU_SUBTYPE_SH7751 is not set
171# CONFIG_CPU_SUBTYPE_SH7751R is not set
172# CONFIG_CPU_SUBTYPE_SH7760 is not set
173# CONFIG_CPU_SUBTYPE_SH4_202 is not set
174# CONFIG_CPU_SUBTYPE_SH7723 is not set
175CONFIG_CPU_SUBTYPE_SH7724=y
176# CONFIG_CPU_SUBTYPE_SH7763 is not set
177# CONFIG_CPU_SUBTYPE_SH7770 is not set
178# CONFIG_CPU_SUBTYPE_SH7780 is not set
179# CONFIG_CPU_SUBTYPE_SH7785 is not set
180# CONFIG_CPU_SUBTYPE_SH7786 is not set
181# CONFIG_CPU_SUBTYPE_SHX3 is not set
182# CONFIG_CPU_SUBTYPE_SH7343 is not set
183# CONFIG_CPU_SUBTYPE_SH7722 is not set
184# CONFIG_CPU_SUBTYPE_SH7366 is not set
185
186#
187# Memory management options
188#
189CONFIG_QUICKLIST=y
190CONFIG_MMU=y
191CONFIG_PAGE_OFFSET=0x80000000
192CONFIG_FORCE_MAX_ZONEORDER=11
193CONFIG_MEMORY_START=0x08000000
194CONFIG_MEMORY_SIZE=0x08000000
195CONFIG_29BIT=y
196# CONFIG_X2TLB is not set
197CONFIG_VSYSCALL=y
198CONFIG_ARCH_FLATMEM_ENABLE=y
199CONFIG_ARCH_SPARSEMEM_ENABLE=y
200CONFIG_ARCH_SPARSEMEM_DEFAULT=y
201CONFIG_MAX_ACTIVE_REGIONS=1
202CONFIG_ARCH_POPULATES_NODE_MAP=y
203CONFIG_ARCH_SELECT_MEMORY_MODEL=y
204CONFIG_PAGE_SIZE_4KB=y
205# CONFIG_PAGE_SIZE_8KB is not set
206# CONFIG_PAGE_SIZE_16KB is not set
207# CONFIG_PAGE_SIZE_64KB is not set
208CONFIG_SELECT_MEMORY_MODEL=y
209CONFIG_FLATMEM_MANUAL=y
210# CONFIG_DISCONTIGMEM_MANUAL is not set
211# CONFIG_SPARSEMEM_MANUAL is not set
212CONFIG_FLATMEM=y
213CONFIG_FLAT_NODE_MEM_MAP=y
214CONFIG_SPARSEMEM_STATIC=y
215CONFIG_PAGEFLAGS_EXTENDED=y
216CONFIG_SPLIT_PTLOCK_CPUS=4
217# CONFIG_PHYS_ADDR_T_64BIT is not set
218CONFIG_ZONE_DMA_FLAG=0
219CONFIG_NR_QUICK=2
220CONFIG_HAVE_MLOCK=y
221CONFIG_HAVE_MLOCKED_PAGE_BIT=y
222CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
223
224#
225# Cache configuration
226#
227CONFIG_CACHE_WRITEBACK=y
228# CONFIG_CACHE_WRITETHROUGH is not set
229# CONFIG_CACHE_OFF is not set
230
231#
232# Processor features
233#
234CONFIG_CPU_LITTLE_ENDIAN=y
235# CONFIG_CPU_BIG_ENDIAN is not set
236CONFIG_SH_FPU=y
237# CONFIG_SH_STORE_QUEUES is not set
238CONFIG_CPU_HAS_INTEVT=y
239CONFIG_CPU_HAS_SR_RB=y
240CONFIG_CPU_HAS_FPU=y
241
242#
243# Board support
244#
245# CONFIG_SH_7724_SOLUTION_ENGINE is not set
246CONFIG_SH_KFR2R09=y
247# CONFIG_SH_ECOVEC is not set
248
249#
250# Timer and clock configuration
251#
252# CONFIG_SH_TIMER_TMU is not set
253CONFIG_SH_TIMER_CMT=y
254CONFIG_SH_PCLK_FREQ=33333333
255CONFIG_SH_CLK_CPG=y
256# CONFIG_NO_HZ is not set
257# CONFIG_HIGH_RES_TIMERS is not set
258CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
259
260#
261# CPU Frequency scaling
262#
263# CONFIG_CPU_FREQ is not set
264
265#
266# DMA support
267#
268# CONFIG_SH_DMA is not set
269
270#
271# Companion Chips
272#
273
274#
275# Additional SuperH Device Drivers
276#
277# CONFIG_HEARTBEAT is not set
278# CONFIG_PUSH_SWITCH is not set
279
280#
281# Kernel features
282#
283CONFIG_HZ_100=y
284# CONFIG_HZ_250 is not set
285# CONFIG_HZ_300 is not set
286# CONFIG_HZ_1000 is not set
287CONFIG_HZ=100
288# CONFIG_SCHED_HRTICK is not set
289CONFIG_KEXEC=y
290# CONFIG_CRASH_DUMP is not set
291# CONFIG_SECCOMP is not set
292CONFIG_PREEMPT_NONE=y
293# CONFIG_PREEMPT_VOLUNTARY is not set
294# CONFIG_PREEMPT is not set
295CONFIG_GUSA=y
296# CONFIG_SPARSE_IRQ is not set
297
298#
299# Boot options
300#
301CONFIG_ZERO_PAGE_OFFSET=0x00001000
302CONFIG_BOOT_LINK_OFFSET=0x00800000
303CONFIG_ENTRY_OFFSET=0x00001000
304CONFIG_CMDLINE_BOOL=y
305CONFIG_CMDLINE="console=ttySC1,115200 quiet"
306
307#
308# Bus options
309#
310# CONFIG_ARCH_SUPPORTS_MSI is not set
311# CONFIG_PCCARD is not set
312
313#
314# Executable file formats
315#
316CONFIG_BINFMT_ELF=y
317# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
318# CONFIG_HAVE_AOUT is not set
319# CONFIG_BINFMT_MISC is not set
320
321#
322# Power management options (EXPERIMENTAL)
323#
324CONFIG_PM=y
325# CONFIG_PM_DEBUG is not set
326# CONFIG_SUSPEND is not set
327# CONFIG_CPU_IDLE is not set
328CONFIG_NET=y
329
330#
331# Networking options
332#
333CONFIG_PACKET=y
334CONFIG_PACKET_MMAP=y
335CONFIG_UNIX=y
336# CONFIG_NET_KEY is not set
337CONFIG_INET=y
338# CONFIG_IP_MULTICAST is not set
339# CONFIG_IP_ADVANCED_ROUTER is not set
340CONFIG_IP_FIB_HASH=y
341# CONFIG_IP_PNP is not set
342# CONFIG_NET_IPIP is not set
343# CONFIG_NET_IPGRE is not set
344# CONFIG_ARPD is not set
345# CONFIG_SYN_COOKIES is not set
346# CONFIG_INET_AH is not set
347# CONFIG_INET_ESP is not set
348# CONFIG_INET_IPCOMP is not set
349# CONFIG_INET_XFRM_TUNNEL is not set
350# CONFIG_INET_TUNNEL is not set
351# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
352# CONFIG_INET_XFRM_MODE_TUNNEL is not set
353# CONFIG_INET_XFRM_MODE_BEET is not set
354# CONFIG_INET_LRO is not set
355# CONFIG_INET_DIAG is not set
356# CONFIG_TCP_CONG_ADVANCED is not set
357CONFIG_TCP_CONG_CUBIC=y
358CONFIG_DEFAULT_TCP_CONG="cubic"
359# CONFIG_TCP_MD5SIG is not set
360# CONFIG_IPV6 is not set
361# CONFIG_NETWORK_SECMARK is not set
362# CONFIG_NETFILTER is not set
363# CONFIG_IP_DCCP is not set
364# CONFIG_IP_SCTP is not set
365# CONFIG_TIPC is not set
366# CONFIG_ATM is not set
367# CONFIG_BRIDGE is not set
368# CONFIG_NET_DSA is not set
369# CONFIG_VLAN_8021Q is not set
370# CONFIG_DECNET is not set
371# CONFIG_LLC2 is not set
372# CONFIG_IPX is not set
373# CONFIG_ATALK is not set
374# CONFIG_X25 is not set
375# CONFIG_LAPB is not set
376# CONFIG_ECONET is not set
377# CONFIG_WAN_ROUTER is not set
378# CONFIG_PHONET is not set
379# CONFIG_IEEE802154 is not set
380# CONFIG_NET_SCHED is not set
381# CONFIG_DCB is not set
382
383#
384# Network testing
385#
386# CONFIG_NET_PKTGEN is not set
387# CONFIG_HAMRADIO is not set
388# CONFIG_CAN is not set
389# CONFIG_IRDA is not set
390# CONFIG_BT is not set
391# CONFIG_AF_RXRPC is not set
392# CONFIG_WIRELESS is not set
393# CONFIG_WIMAX is not set
394# CONFIG_RFKILL is not set
395# CONFIG_NET_9P is not set
396
397#
398# Device Drivers
399#
400
401#
402# Generic Driver Options
403#
404CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
405CONFIG_STANDALONE=y
406CONFIG_PREVENT_FIRMWARE_BUILD=y
407CONFIG_FW_LOADER=y
408CONFIG_FIRMWARE_IN_KERNEL=y
409CONFIG_EXTRA_FIRMWARE=""
410# CONFIG_SYS_HYPERVISOR is not set
411# CONFIG_CONNECTOR is not set
412# CONFIG_MTD is not set
413# CONFIG_PARPORT is not set
414# CONFIG_MISC_DEVICES is not set
415CONFIG_HAVE_IDE=y
416
417#
418# SCSI device support
419#
420# CONFIG_SCSI_DMA is not set
421# CONFIG_SCSI_NETLINK is not set
422# CONFIG_NETDEVICES is not set
423# CONFIG_ISDN is not set
424# CONFIG_PHONE is not set
425
426#
427# Input device support
428#
429CONFIG_INPUT=y
430# CONFIG_INPUT_FF_MEMLESS is not set
431# CONFIG_INPUT_POLLDEV is not set
432
433#
434# Userland interfaces
435#
436# CONFIG_INPUT_MOUSEDEV is not set
437# CONFIG_INPUT_JOYDEV is not set
438# CONFIG_INPUT_EVDEV is not set
439# CONFIG_INPUT_EVBUG is not set
440
441#
442# Input Device Drivers
443#
444# CONFIG_INPUT_KEYBOARD is not set
445# CONFIG_INPUT_MOUSE is not set
446# CONFIG_INPUT_JOYSTICK is not set
447# CONFIG_INPUT_TABLET is not set
448# CONFIG_INPUT_TOUCHSCREEN is not set
449# CONFIG_INPUT_MISC is not set
450
451#
452# Hardware I/O ports
453#
454# CONFIG_SERIO is not set
455# CONFIG_GAMEPORT is not set
456
457#
458# Character devices
459#
460CONFIG_VT=y
461CONFIG_CONSOLE_TRANSLATIONS=y
462CONFIG_VT_CONSOLE=y
463CONFIG_HW_CONSOLE=y
464CONFIG_VT_HW_CONSOLE_BINDING=y
465CONFIG_DEVKMEM=y
466# CONFIG_SERIAL_NONSTANDARD is not set
467
468#
469# Serial drivers
470#
471# CONFIG_SERIAL_8250 is not set
472
473#
474# Non-8250 serial port support
475#
476CONFIG_SERIAL_SH_SCI=y
477CONFIG_SERIAL_SH_SCI_NR_UARTS=6
478CONFIG_SERIAL_SH_SCI_CONSOLE=y
479CONFIG_SERIAL_CORE=y
480CONFIG_SERIAL_CORE_CONSOLE=y
481CONFIG_UNIX98_PTYS=y
482# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
483CONFIG_LEGACY_PTYS=y
484CONFIG_LEGACY_PTY_COUNT=256
485# CONFIG_IPMI_HANDLER is not set
486CONFIG_HW_RANDOM=y
487# CONFIG_HW_RANDOM_TIMERIOMEM is not set
488# CONFIG_R3964 is not set
489# CONFIG_TCG_TPM is not set
490CONFIG_I2C=y
491CONFIG_I2C_BOARDINFO=y
492# CONFIG_I2C_CHARDEV is not set
493CONFIG_I2C_HELPER_AUTO=y
494
495#
496# I2C Hardware Bus support
497#
498
499#
500# I2C system bus drivers (mostly embedded / system-on-chip)
501#
502# CONFIG_I2C_DESIGNWARE is not set
503# CONFIG_I2C_GPIO is not set
504# CONFIG_I2C_OCORES is not set
505CONFIG_I2C_SH_MOBILE=y
506# CONFIG_I2C_SIMTEC is not set
507
508#
509# External I2C/SMBus adapter drivers
510#
511# CONFIG_I2C_PARPORT_LIGHT is not set
512# CONFIG_I2C_TAOS_EVM is not set
513
514#
515# Other I2C/SMBus bus drivers
516#
517# CONFIG_I2C_PCA_PLATFORM is not set
518
519#
520# Miscellaneous I2C Chip support
521#
522# CONFIG_DS1682 is not set
523# CONFIG_SENSORS_PCF8574 is not set
524# CONFIG_PCF8575 is not set
525# CONFIG_SENSORS_PCA9539 is not set
526# CONFIG_SENSORS_TSL2550 is not set
527# CONFIG_I2C_DEBUG_CORE is not set
528# CONFIG_I2C_DEBUG_ALGO is not set
529# CONFIG_I2C_DEBUG_BUS is not set
530# CONFIG_I2C_DEBUG_CHIP is not set
531# CONFIG_SPI is not set
532
533#
534# PPS support
535#
536# CONFIG_PPS is not set
537CONFIG_ARCH_REQUIRE_GPIOLIB=y
538CONFIG_GPIOLIB=y
539CONFIG_GPIO_SYSFS=y
540
541#
542# Memory mapped GPIO expanders:
543#
544
545#
546# I2C GPIO expanders:
547#
548# CONFIG_GPIO_MAX732X is not set
549# CONFIG_GPIO_PCA953X is not set
550# CONFIG_GPIO_PCF857X is not set
551
552#
553# PCI GPIO expanders:
554#
555
556#
557# SPI GPIO expanders:
558#
559# CONFIG_W1 is not set
560# CONFIG_POWER_SUPPLY is not set
561# CONFIG_HWMON is not set
562# CONFIG_THERMAL is not set
563# CONFIG_THERMAL_HWMON is not set
564# CONFIG_WATCHDOG is not set
565CONFIG_SSB_POSSIBLE=y
566
567#
568# Sonics Silicon Backplane
569#
570# CONFIG_SSB is not set
571
572#
573# Multifunction device drivers
574#
575# CONFIG_MFD_CORE is not set
576# CONFIG_MFD_SM501 is not set
577# CONFIG_HTC_PASIC3 is not set
578# CONFIG_TPS65010 is not set
579# CONFIG_TWL4030_CORE is not set
580# CONFIG_MFD_TMIO is not set
581# CONFIG_PMIC_DA903X is not set
582# CONFIG_MFD_WM8400 is not set
583# CONFIG_MFD_WM8350_I2C is not set
584# CONFIG_MFD_PCF50633 is not set
585# CONFIG_AB3100_CORE is not set
586# CONFIG_REGULATOR is not set
587# CONFIG_MEDIA_SUPPORT is not set
588
589#
590# Graphics support
591#
592# CONFIG_VGASTATE is not set
593# CONFIG_VIDEO_OUTPUT_CONTROL is not set
594# CONFIG_FB is not set
595# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
596
597#
598# Display device support
599#
600# CONFIG_DISPLAY_SUPPORT is not set
601
602#
603# Console display driver support
604#
605CONFIG_DUMMY_CONSOLE=y
606# CONFIG_SOUND is not set
607# CONFIG_HID_SUPPORT is not set
608CONFIG_USB_SUPPORT=y
609CONFIG_USB_ARCH_HAS_HCD=y
610# CONFIG_USB_ARCH_HAS_OHCI is not set
611# CONFIG_USB_ARCH_HAS_EHCI is not set
612# CONFIG_USB is not set
613# CONFIG_USB_OTG_WHITELIST is not set
614# CONFIG_USB_OTG_BLACKLIST_HUB is not set
615# CONFIG_USB_GADGET_MUSB_HDRC is not set
616
617#
618# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
619#
620CONFIG_USB_GADGET=y
621# CONFIG_USB_GADGET_DEBUG_FILES is not set
622# CONFIG_USB_GADGET_DEBUG_FS is not set
623CONFIG_USB_GADGET_VBUS_DRAW=2
624CONFIG_USB_GADGET_SELECTED=y
625# CONFIG_USB_GADGET_AT91 is not set
626# CONFIG_USB_GADGET_ATMEL_USBA is not set
627# CONFIG_USB_GADGET_FSL_USB2 is not set
628# CONFIG_USB_GADGET_LH7A40X is not set
629# CONFIG_USB_GADGET_OMAP is not set
630# CONFIG_USB_GADGET_PXA25X is not set
631CONFIG_USB_GADGET_R8A66597=y
632CONFIG_USB_R8A66597=y
633# CONFIG_USB_GADGET_PXA27X is not set
634# CONFIG_USB_GADGET_S3C_HSOTG is not set
635# CONFIG_USB_GADGET_IMX is not set
636# CONFIG_USB_GADGET_S3C2410 is not set
637# CONFIG_USB_GADGET_M66592 is not set
638# CONFIG_USB_GADGET_AMD5536UDC is not set
639# CONFIG_USB_GADGET_FSL_QE is not set
640# CONFIG_USB_GADGET_CI13XXX is not set
641# CONFIG_USB_GADGET_NET2280 is not set
642# CONFIG_USB_GADGET_GOKU is not set
643# CONFIG_USB_GADGET_LANGWELL is not set
644# CONFIG_USB_GADGET_DUMMY_HCD is not set
645CONFIG_USB_GADGET_DUALSPEED=y
646# CONFIG_USB_ZERO is not set
647# CONFIG_USB_AUDIO is not set
648# CONFIG_USB_ETH is not set
649# CONFIG_USB_GADGETFS is not set
650# CONFIG_USB_FILE_STORAGE is not set
651# CONFIG_USB_G_SERIAL is not set
652# CONFIG_USB_MIDI_GADGET is not set
653# CONFIG_USB_G_PRINTER is not set
654CONFIG_USB_CDC_COMPOSITE=y
655
656#
657# OTG and related infrastructure
658#
659# CONFIG_USB_GPIO_VBUS is not set
660# CONFIG_NOP_USB_XCEIV is not set
661# CONFIG_MMC is not set
662# CONFIG_MEMSTICK is not set
663# CONFIG_NEW_LEDS is not set
664# CONFIG_ACCESSIBILITY is not set
665CONFIG_RTC_LIB=y
666# CONFIG_RTC_CLASS is not set
667# CONFIG_DMADEVICES is not set
668# CONFIG_AUXDISPLAY is not set
669# CONFIG_UIO is not set
670
671#
672# TI VLYNQ
673#
674# CONFIG_STAGING is not set
675
676#
677# File systems
678#
679CONFIG_FILE_LOCKING=y
680# CONFIG_FSNOTIFY is not set
681# CONFIG_DNOTIFY is not set
682# CONFIG_INOTIFY is not set
683# CONFIG_INOTIFY_USER is not set
684# CONFIG_QUOTA is not set
685# CONFIG_AUTOFS_FS is not set
686# CONFIG_AUTOFS4_FS is not set
687# CONFIG_FUSE_FS is not set
688
689#
690# Caches
691#
692# CONFIG_FSCACHE is not set
693
694#
695# Pseudo filesystems
696#
697CONFIG_PROC_FS=y
698CONFIG_PROC_KCORE=y
699CONFIG_PROC_SYSCTL=y
700CONFIG_PROC_PAGE_MONITOR=y
701CONFIG_SYSFS=y
702CONFIG_TMPFS=y
703# CONFIG_TMPFS_POSIX_ACL is not set
704# CONFIG_HUGETLBFS is not set
705# CONFIG_HUGETLB_PAGE is not set
706# CONFIG_CONFIGFS_FS is not set
707# CONFIG_MISC_FILESYSTEMS is not set
708# CONFIG_NETWORK_FILESYSTEMS is not set
709# CONFIG_NLS is not set
710# CONFIG_DLM is not set
711
712#
713# Kernel hacking
714#
715CONFIG_TRACE_IRQFLAGS_SUPPORT=y
716# CONFIG_PRINTK_TIME is not set
717CONFIG_ENABLE_WARN_DEPRECATED=y
718# CONFIG_ENABLE_MUST_CHECK is not set
719CONFIG_FRAME_WARN=1024
720# CONFIG_MAGIC_SYSRQ is not set
721# CONFIG_UNUSED_SYMBOLS is not set
722CONFIG_DEBUG_FS=y
723# CONFIG_HEADERS_CHECK is not set
724# CONFIG_DEBUG_KERNEL is not set
725# CONFIG_DEBUG_BUGVERBOSE is not set
726# CONFIG_DEBUG_MEMORY_INIT is not set
727# CONFIG_RCU_CPU_STALL_DETECTOR is not set
728# CONFIG_LATENCYTOP is not set
729# CONFIG_SYSCTL_SYSCALL_CHECK is not set
730CONFIG_HAVE_FUNCTION_TRACER=y
731CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
732CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
733CONFIG_HAVE_DYNAMIC_FTRACE=y
734CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
735CONFIG_HAVE_FTRACE_SYSCALLS=y
736CONFIG_TRACING_SUPPORT=y
737# CONFIG_FTRACE is not set
738# CONFIG_DYNAMIC_DEBUG is not set
739# CONFIG_DMA_API_DEBUG is not set
740# CONFIG_SAMPLES is not set
741CONFIG_HAVE_ARCH_KGDB=y
742# CONFIG_SH_STANDARD_BIOS is not set
743# CONFIG_EARLY_SCIF_CONSOLE is not set
744# CONFIG_DWARF_UNWINDER is not set
745
746#
747# Security options
748#
749# CONFIG_KEYS is not set
750# CONFIG_SECURITY is not set
751# CONFIG_SECURITYFS is not set
752# CONFIG_SECURITY_FILE_CAPABILITIES is not set
753# CONFIG_CRYPTO is not set
754# CONFIG_BINARY_PRINTF is not set
755
756#
757# Library routines
758#
759CONFIG_GENERIC_FIND_LAST_BIT=y
760# CONFIG_CRC_CCITT is not set
761# CONFIG_CRC16 is not set
762# CONFIG_CRC_T10DIF is not set
763# CONFIG_CRC_ITU_T is not set
764# CONFIG_CRC32 is not set
765# CONFIG_CRC7 is not set
766# CONFIG_LIBCRC32C is not set
767CONFIG_ZLIB_INFLATE=y
768CONFIG_DECOMPRESS_GZIP=y
769CONFIG_HAS_IOMEM=y
770CONFIG_HAS_IOPORT=y
771CONFIG_HAS_DMA=y
772CONFIG_HAVE_LMB=y
773CONFIG_NLATTR=y
774CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/configs/kfr2r09_defconfig b/arch/sh/configs/kfr2r09_defconfig
new file mode 100644
index 00000000000..cef61319d2f
--- /dev/null
+++ b/arch/sh/configs/kfr2r09_defconfig
@@ -0,0 +1,1059 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc6
4# Thu Aug 20 21:58:52 2009
5#
6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y
8# CONFIG_SUPERH64 is not set
9CONFIG_ARCH_DEFCONFIG="arch/sh/configs/shx3_defconfig"
10CONFIG_RWSEM_GENERIC_SPINLOCK=y
11CONFIG_GENERIC_BUG=y
12CONFIG_GENERIC_FIND_NEXT_BIT=y
13CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
18CONFIG_GENERIC_GPIO=y
19CONFIG_GENERIC_TIME=y
20CONFIG_GENERIC_CLOCKEVENTS=y
21CONFIG_ARCH_SUSPEND_POSSIBLE=y
22CONFIG_ARCH_HIBERNATION_POSSIBLE=y
23CONFIG_SYS_SUPPORTS_CMT=y
24CONFIG_SYS_SUPPORTS_TMU=y
25CONFIG_STACKTRACE_SUPPORT=y
26CONFIG_LOCKDEP_SUPPORT=y
27CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U32 is not set
29# CONFIG_ARCH_HAS_ILOG2_U64 is not set
30CONFIG_ARCH_NO_VIRT_TO_BUS=y
31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y
35
36#
37# General setup
38#
39CONFIG_EXPERIMENTAL=y
40CONFIG_BROKEN_ON_SMP=y
41CONFIG_LOCK_KERNEL=y
42CONFIG_INIT_ENV_ARG_LIMIT=32
43CONFIG_LOCALVERSION=""
44# CONFIG_LOCALVERSION_AUTO is not set
45CONFIG_HAVE_KERNEL_GZIP=y
46CONFIG_HAVE_KERNEL_BZIP2=y
47CONFIG_HAVE_KERNEL_LZMA=y
48CONFIG_KERNEL_GZIP=y
49# CONFIG_KERNEL_BZIP2 is not set
50# CONFIG_KERNEL_LZMA is not set
51CONFIG_SWAP=y
52CONFIG_SYSVIPC=y
53CONFIG_SYSVIPC_SYSCTL=y
54# CONFIG_POSIX_MQUEUE is not set
55CONFIG_BSD_PROCESS_ACCT=y
56# CONFIG_BSD_PROCESS_ACCT_V3 is not set
57# CONFIG_TASKSTATS is not set
58# CONFIG_AUDIT is not set
59
60#
61# RCU Subsystem
62#
63CONFIG_CLASSIC_RCU=y
64# CONFIG_TREE_RCU is not set
65# CONFIG_PREEMPT_RCU is not set
66# CONFIG_TREE_RCU_TRACE is not set
67# CONFIG_PREEMPT_RCU_TRACE is not set
68CONFIG_IKCONFIG=y
69CONFIG_IKCONFIG_PROC=y
70CONFIG_LOG_BUF_SHIFT=14
71CONFIG_GROUP_SCHED=y
72CONFIG_FAIR_GROUP_SCHED=y
73# CONFIG_RT_GROUP_SCHED is not set
74CONFIG_USER_SCHED=y
75# CONFIG_CGROUP_SCHED is not set
76# CONFIG_CGROUPS is not set
77CONFIG_SYSFS_DEPRECATED=y
78CONFIG_SYSFS_DEPRECATED_V2=y
79# CONFIG_RELAY is not set
80# CONFIG_NAMESPACES is not set
81CONFIG_BLK_DEV_INITRD=y
82CONFIG_INITRAMFS_SOURCE=""
83CONFIG_RD_GZIP=y
84# CONFIG_RD_BZIP2 is not set
85# CONFIG_RD_LZMA is not set
86CONFIG_CC_OPTIMIZE_FOR_SIZE=y
87CONFIG_SYSCTL=y
88CONFIG_ANON_INODES=y
89CONFIG_EMBEDDED=y
90CONFIG_UID16=y
91CONFIG_SYSCTL_SYSCALL=y
92# CONFIG_KALLSYMS is not set
93CONFIG_HOTPLUG=y
94CONFIG_PRINTK=y
95CONFIG_BUG=y
96CONFIG_ELF_CORE=y
97CONFIG_BASE_FULL=y
98CONFIG_FUTEX=y
99CONFIG_EPOLL=y
100CONFIG_SIGNALFD=y
101CONFIG_TIMERFD=y
102CONFIG_EVENTFD=y
103CONFIG_SHMEM=y
104CONFIG_AIO=y
105CONFIG_HAVE_PERF_COUNTERS=y
106
107#
108# Performance Counters
109#
110# CONFIG_PERF_COUNTERS is not set
111CONFIG_VM_EVENT_COUNTERS=y
112# CONFIG_STRIP_ASM_SYMS is not set
113CONFIG_COMPAT_BRK=y
114CONFIG_SLAB=y
115# CONFIG_SLUB is not set
116# CONFIG_SLOB is not set
117# CONFIG_PROFILING is not set
118# CONFIG_MARKERS is not set
119CONFIG_HAVE_OPROFILE=y
120CONFIG_HAVE_IOREMAP_PROT=y
121CONFIG_HAVE_KPROBES=y
122CONFIG_HAVE_KRETPROBES=y
123CONFIG_HAVE_ARCH_TRACEHOOK=y
124CONFIG_HAVE_CLK=y
125CONFIG_HAVE_DMA_API_DEBUG=y
126
127#
128# GCOV-based kernel profiling
129#
130# CONFIG_GCOV_KERNEL is not set
131# CONFIG_SLOW_WORK is not set
132CONFIG_HAVE_GENERIC_DMA_COHERENT=y
133CONFIG_SLABINFO=y
134CONFIG_RT_MUTEXES=y
135CONFIG_BASE_SMALL=0
136CONFIG_MODULES=y
137# CONFIG_MODULE_FORCE_LOAD is not set
138CONFIG_MODULE_UNLOAD=y
139# CONFIG_MODULE_FORCE_UNLOAD is not set
140# CONFIG_MODVERSIONS is not set
141# CONFIG_MODULE_SRCVERSION_ALL is not set
142CONFIG_BLOCK=y
143CONFIG_LBDAF=y
144# CONFIG_BLK_DEV_BSG is not set
145# CONFIG_BLK_DEV_INTEGRITY is not set
146
147#
148# IO Schedulers
149#
150CONFIG_IOSCHED_NOOP=y
151# CONFIG_IOSCHED_AS is not set
152# CONFIG_IOSCHED_DEADLINE is not set
153# CONFIG_IOSCHED_CFQ is not set
154# CONFIG_DEFAULT_AS is not set
155# CONFIG_DEFAULT_DEADLINE is not set
156# CONFIG_DEFAULT_CFQ is not set
157CONFIG_DEFAULT_NOOP=y
158CONFIG_DEFAULT_IOSCHED="noop"
159# CONFIG_FREEZER is not set
160
161#
162# System type
163#
164CONFIG_CPU_SH4=y
165CONFIG_CPU_SH4A=y
166CONFIG_CPU_SHX2=y
167CONFIG_ARCH_SHMOBILE=y
168# CONFIG_CPU_SUBTYPE_SH7619 is not set
169# CONFIG_CPU_SUBTYPE_SH7201 is not set
170# CONFIG_CPU_SUBTYPE_SH7203 is not set
171# CONFIG_CPU_SUBTYPE_SH7206 is not set
172# CONFIG_CPU_SUBTYPE_SH7263 is not set
173# CONFIG_CPU_SUBTYPE_MXG is not set
174# CONFIG_CPU_SUBTYPE_SH7705 is not set
175# CONFIG_CPU_SUBTYPE_SH7706 is not set
176# CONFIG_CPU_SUBTYPE_SH7707 is not set
177# CONFIG_CPU_SUBTYPE_SH7708 is not set
178# CONFIG_CPU_SUBTYPE_SH7709 is not set
179# CONFIG_CPU_SUBTYPE_SH7710 is not set
180# CONFIG_CPU_SUBTYPE_SH7712 is not set
181# CONFIG_CPU_SUBTYPE_SH7720 is not set
182# CONFIG_CPU_SUBTYPE_SH7721 is not set
183# CONFIG_CPU_SUBTYPE_SH7750 is not set
184# CONFIG_CPU_SUBTYPE_SH7091 is not set
185# CONFIG_CPU_SUBTYPE_SH7750R is not set
186# CONFIG_CPU_SUBTYPE_SH7750S is not set
187# CONFIG_CPU_SUBTYPE_SH7751 is not set
188# CONFIG_CPU_SUBTYPE_SH7751R is not set
189# CONFIG_CPU_SUBTYPE_SH7760 is not set
190# CONFIG_CPU_SUBTYPE_SH4_202 is not set
191# CONFIG_CPU_SUBTYPE_SH7723 is not set
192CONFIG_CPU_SUBTYPE_SH7724=y
193# CONFIG_CPU_SUBTYPE_SH7763 is not set
194# CONFIG_CPU_SUBTYPE_SH7770 is not set
195# CONFIG_CPU_SUBTYPE_SH7780 is not set
196# CONFIG_CPU_SUBTYPE_SH7785 is not set
197# CONFIG_CPU_SUBTYPE_SH7786 is not set
198# CONFIG_CPU_SUBTYPE_SHX3 is not set
199# CONFIG_CPU_SUBTYPE_SH7343 is not set
200# CONFIG_CPU_SUBTYPE_SH7722 is not set
201# CONFIG_CPU_SUBTYPE_SH7366 is not set
202
203#
204# Memory management options
205#
206CONFIG_QUICKLIST=y
207CONFIG_MMU=y
208CONFIG_PAGE_OFFSET=0x80000000
209CONFIG_FORCE_MAX_ZONEORDER=11
210CONFIG_MEMORY_START=0x08000000
211CONFIG_MEMORY_SIZE=0x08000000
212CONFIG_29BIT=y
213# CONFIG_X2TLB is not set
214CONFIG_VSYSCALL=y
215CONFIG_ARCH_FLATMEM_ENABLE=y
216CONFIG_ARCH_SPARSEMEM_ENABLE=y
217CONFIG_ARCH_SPARSEMEM_DEFAULT=y
218CONFIG_MAX_ACTIVE_REGIONS=1
219CONFIG_ARCH_POPULATES_NODE_MAP=y
220CONFIG_ARCH_SELECT_MEMORY_MODEL=y
221CONFIG_PAGE_SIZE_4KB=y
222# CONFIG_PAGE_SIZE_8KB is not set
223# CONFIG_PAGE_SIZE_16KB is not set
224# CONFIG_PAGE_SIZE_64KB is not set
225CONFIG_SELECT_MEMORY_MODEL=y
226CONFIG_FLATMEM_MANUAL=y
227# CONFIG_DISCONTIGMEM_MANUAL is not set
228# CONFIG_SPARSEMEM_MANUAL is not set
229CONFIG_FLATMEM=y
230CONFIG_FLAT_NODE_MEM_MAP=y
231CONFIG_SPARSEMEM_STATIC=y
232CONFIG_PAGEFLAGS_EXTENDED=y
233CONFIG_SPLIT_PTLOCK_CPUS=4
234# CONFIG_PHYS_ADDR_T_64BIT is not set
235CONFIG_ZONE_DMA_FLAG=0
236CONFIG_NR_QUICK=2
237CONFIG_HAVE_MLOCK=y
238CONFIG_HAVE_MLOCKED_PAGE_BIT=y
239CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
240
241#
242# Cache configuration
243#
244CONFIG_CACHE_WRITEBACK=y
245# CONFIG_CACHE_WRITETHROUGH is not set
246# CONFIG_CACHE_OFF is not set
247
248#
249# Processor features
250#
251CONFIG_CPU_LITTLE_ENDIAN=y
252# CONFIG_CPU_BIG_ENDIAN is not set
253CONFIG_SH_FPU=y
254# CONFIG_SH_STORE_QUEUES is not set
255CONFIG_CPU_HAS_INTEVT=y
256CONFIG_CPU_HAS_SR_RB=y
257CONFIG_CPU_HAS_FPU=y
258
259#
260# Board support
261#
262# CONFIG_SH_7724_SOLUTION_ENGINE is not set
263CONFIG_SH_KFR2R09=y
264# CONFIG_SH_ECOVEC is not set
265
266#
267# Timer and clock configuration
268#
269# CONFIG_SH_TIMER_TMU is not set
270CONFIG_SH_TIMER_CMT=y
271CONFIG_SH_PCLK_FREQ=33333333
272CONFIG_SH_CLK_CPG=y
273CONFIG_TICK_ONESHOT=y
274CONFIG_NO_HZ=y
275# CONFIG_HIGH_RES_TIMERS is not set
276CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
277
278#
279# CPU Frequency scaling
280#
281# CONFIG_CPU_FREQ is not set
282
283#
284# DMA support
285#
286# CONFIG_SH_DMA is not set
287
288#
289# Companion Chips
290#
291
292#
293# Additional SuperH Device Drivers
294#
295# CONFIG_HEARTBEAT is not set
296# CONFIG_PUSH_SWITCH is not set
297
298#
299# Kernel features
300#
301# CONFIG_HZ_100 is not set
302# CONFIG_HZ_250 is not set
303# CONFIG_HZ_300 is not set
304CONFIG_HZ_1000=y
305CONFIG_HZ=1000
306# CONFIG_SCHED_HRTICK is not set
307CONFIG_KEXEC=y
308# CONFIG_CRASH_DUMP is not set
309# CONFIG_SECCOMP is not set
310# CONFIG_PREEMPT_NONE is not set
311# CONFIG_PREEMPT_VOLUNTARY is not set
312CONFIG_PREEMPT=y
313CONFIG_GUSA=y
314# CONFIG_SPARSE_IRQ is not set
315
316#
317# Boot options
318#
319CONFIG_ZERO_PAGE_OFFSET=0x00001000
320CONFIG_BOOT_LINK_OFFSET=0x00800000
321CONFIG_ENTRY_OFFSET=0x00001000
322CONFIG_CMDLINE_BOOL=y
323CONFIG_CMDLINE="console=tty0 console=ttySC1,115200"
324
325#
326# Bus options
327#
328# CONFIG_ARCH_SUPPORTS_MSI is not set
329# CONFIG_PCCARD is not set
330
331#
332# Executable file formats
333#
334CONFIG_BINFMT_ELF=y
335# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
336# CONFIG_HAVE_AOUT is not set
337# CONFIG_BINFMT_MISC is not set
338
339#
340# Power management options (EXPERIMENTAL)
341#
342CONFIG_PM=y
343# CONFIG_PM_DEBUG is not set
344# CONFIG_SUSPEND is not set
345# CONFIG_HIBERNATION is not set
346CONFIG_CPU_IDLE=y
347CONFIG_CPU_IDLE_GOV_LADDER=y
348CONFIG_CPU_IDLE_GOV_MENU=y
349CONFIG_NET=y
350
351#
352# Networking options
353#
354CONFIG_PACKET=y
355CONFIG_PACKET_MMAP=y
356CONFIG_UNIX=y
357# CONFIG_NET_KEY is not set
358CONFIG_INET=y
359# CONFIG_IP_MULTICAST is not set
360# CONFIG_IP_ADVANCED_ROUTER is not set
361CONFIG_IP_FIB_HASH=y
362# CONFIG_IP_PNP is not set
363# CONFIG_NET_IPIP is not set
364# CONFIG_NET_IPGRE is not set
365# CONFIG_ARPD is not set
366# CONFIG_SYN_COOKIES is not set
367# CONFIG_INET_AH is not set
368# CONFIG_INET_ESP is not set
369# CONFIG_INET_IPCOMP is not set
370# CONFIG_INET_XFRM_TUNNEL is not set
371# CONFIG_INET_TUNNEL is not set
372# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
373# CONFIG_INET_XFRM_MODE_TUNNEL is not set
374# CONFIG_INET_XFRM_MODE_BEET is not set
375# CONFIG_INET_LRO is not set
376# CONFIG_INET_DIAG is not set
377# CONFIG_TCP_CONG_ADVANCED is not set
378CONFIG_TCP_CONG_CUBIC=y
379CONFIG_DEFAULT_TCP_CONG="cubic"
380# CONFIG_TCP_MD5SIG is not set
381# CONFIG_IPV6 is not set
382# CONFIG_NETWORK_SECMARK is not set
383# CONFIG_NETFILTER is not set
384# CONFIG_IP_DCCP is not set
385# CONFIG_IP_SCTP is not set
386# CONFIG_TIPC is not set
387# CONFIG_ATM is not set
388# CONFIG_BRIDGE is not set
389# CONFIG_NET_DSA is not set
390# CONFIG_VLAN_8021Q is not set
391# CONFIG_DECNET is not set
392# CONFIG_LLC2 is not set
393# CONFIG_IPX is not set
394# CONFIG_ATALK is not set
395# CONFIG_X25 is not set
396# CONFIG_LAPB is not set
397# CONFIG_ECONET is not set
398# CONFIG_WAN_ROUTER is not set
399# CONFIG_PHONET is not set
400# CONFIG_IEEE802154 is not set
401# CONFIG_NET_SCHED is not set
402# CONFIG_DCB is not set
403
404#
405# Network testing
406#
407# CONFIG_NET_PKTGEN is not set
408# CONFIG_HAMRADIO is not set
409# CONFIG_CAN is not set
410# CONFIG_IRDA is not set
411# CONFIG_BT is not set
412# CONFIG_AF_RXRPC is not set
413# CONFIG_WIRELESS is not set
414# CONFIG_WIMAX is not set
415# CONFIG_RFKILL is not set
416# CONFIG_NET_9P is not set
417
418#
419# Device Drivers
420#
421
422#
423# Generic Driver Options
424#
425CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
426CONFIG_STANDALONE=y
427CONFIG_PREVENT_FIRMWARE_BUILD=y
428CONFIG_FW_LOADER=y
429CONFIG_FIRMWARE_IN_KERNEL=y
430CONFIG_EXTRA_FIRMWARE=""
431# CONFIG_SYS_HYPERVISOR is not set
432# CONFIG_CONNECTOR is not set
433CONFIG_MTD=y
434# CONFIG_MTD_DEBUG is not set
435CONFIG_MTD_CONCAT=y
436CONFIG_MTD_PARTITIONS=y
437# CONFIG_MTD_TESTS is not set
438# CONFIG_MTD_REDBOOT_PARTS is not set
439CONFIG_MTD_CMDLINE_PARTS=y
440# CONFIG_MTD_AR7_PARTS is not set
441
442#
443# User Modules And Translation Layers
444#
445CONFIG_MTD_CHAR=y
446CONFIG_MTD_BLKDEVS=y
447CONFIG_MTD_BLOCK=y
448# CONFIG_FTL is not set
449# CONFIG_NFTL is not set
450# CONFIG_INFTL is not set
451# CONFIG_RFD_FTL is not set
452# CONFIG_SSFDC is not set
453# CONFIG_MTD_OOPS is not set
454
455#
456# RAM/ROM/Flash chip drivers
457#
458CONFIG_MTD_CFI=y
459# CONFIG_MTD_JEDECPROBE is not set
460CONFIG_MTD_GEN_PROBE=y
461# CONFIG_MTD_CFI_ADV_OPTIONS is not set
462CONFIG_MTD_MAP_BANK_WIDTH_1=y
463CONFIG_MTD_MAP_BANK_WIDTH_2=y
464CONFIG_MTD_MAP_BANK_WIDTH_4=y
465# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
466# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
467# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
468CONFIG_MTD_CFI_I1=y
469CONFIG_MTD_CFI_I2=y
470# CONFIG_MTD_CFI_I4 is not set
471# CONFIG_MTD_CFI_I8 is not set
472CONFIG_MTD_CFI_INTELEXT=y
473# CONFIG_MTD_CFI_AMDSTD is not set
474# CONFIG_MTD_CFI_STAA is not set
475CONFIG_MTD_CFI_UTIL=y
476# CONFIG_MTD_RAM is not set
477# CONFIG_MTD_ROM is not set
478# CONFIG_MTD_ABSENT is not set
479
480#
481# Mapping drivers for chip access
482#
483# CONFIG_MTD_COMPLEX_MAPPINGS is not set
484CONFIG_MTD_PHYSMAP=y
485# CONFIG_MTD_PHYSMAP_COMPAT is not set
486# CONFIG_MTD_PLATRAM is not set
487
488#
489# Self-contained MTD device drivers
490#
491# CONFIG_MTD_SLRAM is not set
492# CONFIG_MTD_PHRAM is not set
493# CONFIG_MTD_MTDRAM is not set
494# CONFIG_MTD_BLOCK2MTD is not set
495
496#
497# Disk-On-Chip Device Drivers
498#
499# CONFIG_MTD_DOC2000 is not set
500# CONFIG_MTD_DOC2001 is not set
501# CONFIG_MTD_DOC2001PLUS is not set
502# CONFIG_MTD_NAND is not set
503# CONFIG_MTD_ONENAND is not set
504
505#
506# LPDDR flash memory drivers
507#
508# CONFIG_MTD_LPDDR is not set
509
510#
511# UBI - Unsorted block images
512#
513CONFIG_MTD_UBI=y
514CONFIG_MTD_UBI_WL_THRESHOLD=4096
515CONFIG_MTD_UBI_BEB_RESERVE=1
516# CONFIG_MTD_UBI_GLUEBI is not set
517
518#
519# UBI debugging options
520#
521# CONFIG_MTD_UBI_DEBUG is not set
522# CONFIG_PARPORT is not set
523CONFIG_BLK_DEV=y
524# CONFIG_BLK_DEV_COW_COMMON is not set
525# CONFIG_BLK_DEV_LOOP is not set
526# CONFIG_BLK_DEV_NBD is not set
527# CONFIG_BLK_DEV_RAM is not set
528# CONFIG_CDROM_PKTCDVD is not set
529# CONFIG_ATA_OVER_ETH is not set
530# CONFIG_BLK_DEV_HD is not set
531# CONFIG_MISC_DEVICES is not set
532CONFIG_HAVE_IDE=y
533# CONFIG_IDE is not set
534
535#
536# SCSI device support
537#
538# CONFIG_RAID_ATTRS is not set
539# CONFIG_SCSI is not set
540# CONFIG_SCSI_DMA is not set
541# CONFIG_SCSI_NETLINK is not set
542# CONFIG_ATA is not set
543# CONFIG_MD is not set
544# CONFIG_NETDEVICES is not set
545# CONFIG_ISDN is not set
546# CONFIG_PHONE is not set
547
548#
549# Input device support
550#
551CONFIG_INPUT=y
552# CONFIG_INPUT_FF_MEMLESS is not set
553# CONFIG_INPUT_POLLDEV is not set
554
555#
556# Userland interfaces
557#
558# CONFIG_INPUT_MOUSEDEV is not set
559# CONFIG_INPUT_JOYDEV is not set
560CONFIG_INPUT_EVDEV=y
561# CONFIG_INPUT_EVBUG is not set
562
563#
564# Input Device Drivers
565#
566CONFIG_INPUT_KEYBOARD=y
567# CONFIG_KEYBOARD_ATKBD is not set
568# CONFIG_KEYBOARD_LKKBD is not set
569# CONFIG_KEYBOARD_GPIO is not set
570# CONFIG_KEYBOARD_MATRIX is not set
571# CONFIG_KEYBOARD_NEWTON is not set
572# CONFIG_KEYBOARD_STOWAWAY is not set
573# CONFIG_KEYBOARD_SUNKBD is not set
574CONFIG_KEYBOARD_SH_KEYSC=y
575# CONFIG_KEYBOARD_XTKBD is not set
576# CONFIG_INPUT_MOUSE is not set
577# CONFIG_INPUT_JOYSTICK is not set
578# CONFIG_INPUT_TABLET is not set
579# CONFIG_INPUT_TOUCHSCREEN is not set
580# CONFIG_INPUT_MISC is not set
581
582#
583# Hardware I/O ports
584#
585# CONFIG_SERIO is not set
586# CONFIG_GAMEPORT is not set
587
588#
589# Character devices
590#
591CONFIG_VT=y
592CONFIG_CONSOLE_TRANSLATIONS=y
593CONFIG_VT_CONSOLE=y
594CONFIG_HW_CONSOLE=y
595CONFIG_VT_HW_CONSOLE_BINDING=y
596CONFIG_DEVKMEM=y
597# CONFIG_SERIAL_NONSTANDARD is not set
598
599#
600# Serial drivers
601#
602# CONFIG_SERIAL_8250 is not set
603
604#
605# Non-8250 serial port support
606#
607CONFIG_SERIAL_SH_SCI=y
608CONFIG_SERIAL_SH_SCI_NR_UARTS=6
609CONFIG_SERIAL_SH_SCI_CONSOLE=y
610CONFIG_SERIAL_CORE=y
611CONFIG_SERIAL_CORE_CONSOLE=y
612CONFIG_UNIX98_PTYS=y
613# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
614CONFIG_LEGACY_PTYS=y
615CONFIG_LEGACY_PTY_COUNT=256
616# CONFIG_IPMI_HANDLER is not set
617CONFIG_HW_RANDOM=y
618# CONFIG_HW_RANDOM_TIMERIOMEM is not set
619# CONFIG_R3964 is not set
620# CONFIG_RAW_DRIVER is not set
621# CONFIG_TCG_TPM is not set
622CONFIG_I2C=y
623CONFIG_I2C_BOARDINFO=y
624# CONFIG_I2C_CHARDEV is not set
625CONFIG_I2C_HELPER_AUTO=y
626
627#
628# I2C Hardware Bus support
629#
630
631#
632# I2C system bus drivers (mostly embedded / system-on-chip)
633#
634# CONFIG_I2C_DESIGNWARE is not set
635# CONFIG_I2C_GPIO is not set
636# CONFIG_I2C_OCORES is not set
637CONFIG_I2C_SH_MOBILE=y
638# CONFIG_I2C_SIMTEC is not set
639
640#
641# External I2C/SMBus adapter drivers
642#
643# CONFIG_I2C_PARPORT_LIGHT is not set
644# CONFIG_I2C_TAOS_EVM is not set
645
646#
647# Other I2C/SMBus bus drivers
648#
649# CONFIG_I2C_PCA_PLATFORM is not set
650# CONFIG_I2C_STUB is not set
651
652#
653# Miscellaneous I2C Chip support
654#
655# CONFIG_DS1682 is not set
656# CONFIG_SENSORS_PCF8574 is not set
657# CONFIG_PCF8575 is not set
658# CONFIG_SENSORS_PCA9539 is not set
659# CONFIG_SENSORS_TSL2550 is not set
660# CONFIG_I2C_DEBUG_CORE is not set
661# CONFIG_I2C_DEBUG_ALGO is not set
662# CONFIG_I2C_DEBUG_BUS is not set
663# CONFIG_I2C_DEBUG_CHIP is not set
664# CONFIG_SPI is not set
665
666#
667# PPS support
668#
669# CONFIG_PPS is not set
670CONFIG_ARCH_REQUIRE_GPIOLIB=y
671CONFIG_GPIOLIB=y
672CONFIG_GPIO_SYSFS=y
673
674#
675# Memory mapped GPIO expanders:
676#
677
678#
679# I2C GPIO expanders:
680#
681# CONFIG_GPIO_MAX732X is not set
682# CONFIG_GPIO_PCA953X is not set
683# CONFIG_GPIO_PCF857X is not set
684
685#
686# PCI GPIO expanders:
687#
688
689#
690# SPI GPIO expanders:
691#
692# CONFIG_W1 is not set
693# CONFIG_POWER_SUPPLY is not set
694# CONFIG_HWMON is not set
695# CONFIG_THERMAL is not set
696# CONFIG_THERMAL_HWMON is not set
697# CONFIG_WATCHDOG is not set
698CONFIG_SSB_POSSIBLE=y
699
700#
701# Sonics Silicon Backplane
702#
703# CONFIG_SSB is not set
704
705#
706# Multifunction device drivers
707#
708# CONFIG_MFD_CORE is not set
709# CONFIG_MFD_SM501 is not set
710# CONFIG_HTC_PASIC3 is not set
711# CONFIG_TPS65010 is not set
712# CONFIG_TWL4030_CORE is not set
713# CONFIG_MFD_TMIO is not set
714# CONFIG_PMIC_DA903X is not set
715# CONFIG_MFD_WM8400 is not set
716# CONFIG_MFD_WM8350_I2C is not set
717# CONFIG_MFD_PCF50633 is not set
718# CONFIG_AB3100_CORE is not set
719# CONFIG_REGULATOR is not set
720# CONFIG_MEDIA_SUPPORT is not set
721
722#
723# Graphics support
724#
725# CONFIG_VGASTATE is not set
726# CONFIG_VIDEO_OUTPUT_CONTROL is not set
727CONFIG_FB=y
728# CONFIG_FIRMWARE_EDID is not set
729# CONFIG_FB_DDC is not set
730# CONFIG_FB_BOOT_VESA_SUPPORT is not set
731# CONFIG_FB_CFB_FILLRECT is not set
732# CONFIG_FB_CFB_COPYAREA is not set
733# CONFIG_FB_CFB_IMAGEBLIT is not set
734# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
735CONFIG_FB_SYS_FILLRECT=y
736CONFIG_FB_SYS_COPYAREA=y
737CONFIG_FB_SYS_IMAGEBLIT=y
738# CONFIG_FB_FOREIGN_ENDIAN is not set
739CONFIG_FB_SYS_FOPS=y
740CONFIG_FB_DEFERRED_IO=y
741# CONFIG_FB_SVGALIB is not set
742# CONFIG_FB_MACMODES is not set
743# CONFIG_FB_BACKLIGHT is not set
744# CONFIG_FB_MODE_HELPERS is not set
745# CONFIG_FB_TILEBLITTING is not set
746
747#
748# Frame buffer hardware drivers
749#
750# CONFIG_FB_S1D13XXX is not set
751CONFIG_FB_SH_MOBILE_LCDC=y
752# CONFIG_FB_VIRTUAL is not set
753# CONFIG_FB_METRONOME is not set
754# CONFIG_FB_MB862XX is not set
755# CONFIG_FB_BROADSHEET is not set
756# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
757
758#
759# Display device support
760#
761# CONFIG_DISPLAY_SUPPORT is not set
762
763#
764# Console display driver support
765#
766CONFIG_DUMMY_CONSOLE=y
767CONFIG_FRAMEBUFFER_CONSOLE=y
768CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
769# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
770CONFIG_FONTS=y
771# CONFIG_FONT_8x8 is not set
772# CONFIG_FONT_8x16 is not set
773# CONFIG_FONT_6x11 is not set
774# CONFIG_FONT_7x14 is not set
775# CONFIG_FONT_PEARL_8x8 is not set
776# CONFIG_FONT_ACORN_8x8 is not set
777CONFIG_FONT_MINI_4x6=y
778# CONFIG_FONT_SUN8x16 is not set
779# CONFIG_FONT_SUN12x22 is not set
780# CONFIG_FONT_10x18 is not set
781CONFIG_LOGO=y
782# CONFIG_LOGO_LINUX_MONO is not set
783# CONFIG_LOGO_LINUX_VGA16 is not set
784# CONFIG_LOGO_LINUX_CLUT224 is not set
785# CONFIG_LOGO_SUPERH_MONO is not set
786CONFIG_LOGO_SUPERH_VGA16=y
787# CONFIG_LOGO_SUPERH_CLUT224 is not set
788# CONFIG_SOUND is not set
789# CONFIG_HID_SUPPORT is not set
790CONFIG_USB_SUPPORT=y
791CONFIG_USB_ARCH_HAS_HCD=y
792# CONFIG_USB_ARCH_HAS_OHCI is not set
793# CONFIG_USB_ARCH_HAS_EHCI is not set
794# CONFIG_USB is not set
795# CONFIG_USB_OTG_WHITELIST is not set
796# CONFIG_USB_OTG_BLACKLIST_HUB is not set
797# CONFIG_USB_GADGET_MUSB_HDRC is not set
798
799#
800# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
801#
802CONFIG_USB_GADGET=y
803# CONFIG_USB_GADGET_DEBUG_FILES is not set
804# CONFIG_USB_GADGET_DEBUG_FS is not set
805CONFIG_USB_GADGET_VBUS_DRAW=2
806CONFIG_USB_GADGET_SELECTED=y
807# CONFIG_USB_GADGET_AT91 is not set
808# CONFIG_USB_GADGET_ATMEL_USBA is not set
809# CONFIG_USB_GADGET_FSL_USB2 is not set
810# CONFIG_USB_GADGET_LH7A40X is not set
811# CONFIG_USB_GADGET_OMAP is not set
812# CONFIG_USB_GADGET_PXA25X is not set
813CONFIG_USB_GADGET_R8A66597=y
814CONFIG_USB_R8A66597=y
815# CONFIG_USB_GADGET_PXA27X is not set
816# CONFIG_USB_GADGET_S3C_HSOTG is not set
817# CONFIG_USB_GADGET_IMX is not set
818# CONFIG_USB_GADGET_S3C2410 is not set
819# CONFIG_USB_GADGET_M66592 is not set
820# CONFIG_USB_GADGET_AMD5536UDC is not set
821# CONFIG_USB_GADGET_FSL_QE is not set
822# CONFIG_USB_GADGET_CI13XXX is not set
823# CONFIG_USB_GADGET_NET2280 is not set
824# CONFIG_USB_GADGET_GOKU is not set
825# CONFIG_USB_GADGET_LANGWELL is not set
826# CONFIG_USB_GADGET_DUMMY_HCD is not set
827CONFIG_USB_GADGET_DUALSPEED=y
828# CONFIG_USB_ZERO is not set
829# CONFIG_USB_AUDIO is not set
830# CONFIG_USB_ETH is not set
831# CONFIG_USB_GADGETFS is not set
832# CONFIG_USB_FILE_STORAGE is not set
833# CONFIG_USB_G_SERIAL is not set
834# CONFIG_USB_MIDI_GADGET is not set
835# CONFIG_USB_G_PRINTER is not set
836CONFIG_USB_CDC_COMPOSITE=y
837
838#
839# OTG and related infrastructure
840#
841# CONFIG_USB_GPIO_VBUS is not set
842# CONFIG_NOP_USB_XCEIV is not set
843CONFIG_MMC=y
844# CONFIG_MMC_DEBUG is not set
845# CONFIG_MMC_UNSAFE_RESUME is not set
846
847#
848# MMC/SD/SDIO Card Drivers
849#
850CONFIG_MMC_BLOCK=y
851CONFIG_MMC_BLOCK_BOUNCE=y
852# CONFIG_SDIO_UART is not set
853# CONFIG_MMC_TEST is not set
854
855#
856# MMC/SD/SDIO Host Controller Drivers
857#
858# CONFIG_MMC_SDHCI is not set
859# CONFIG_MEMSTICK is not set
860# CONFIG_NEW_LEDS is not set
861# CONFIG_ACCESSIBILITY is not set
862CONFIG_RTC_LIB=y
863CONFIG_RTC_CLASS=y
864CONFIG_RTC_HCTOSYS=y
865CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
866# CONFIG_RTC_DEBUG is not set
867
868#
869# RTC interfaces
870#
871CONFIG_RTC_INTF_SYSFS=y
872CONFIG_RTC_INTF_PROC=y
873CONFIG_RTC_INTF_DEV=y
874# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
875# CONFIG_RTC_DRV_TEST is not set
876
877#
878# I2C RTC drivers
879#
880# CONFIG_RTC_DRV_DS1307 is not set
881# CONFIG_RTC_DRV_DS1374 is not set
882# CONFIG_RTC_DRV_DS1672 is not set
883# CONFIG_RTC_DRV_MAX6900 is not set
884# CONFIG_RTC_DRV_RS5C372 is not set
885# CONFIG_RTC_DRV_ISL1208 is not set
886# CONFIG_RTC_DRV_X1205 is not set
887# CONFIG_RTC_DRV_PCF8563 is not set
888# CONFIG_RTC_DRV_PCF8583 is not set
889# CONFIG_RTC_DRV_M41T80 is not set
890# CONFIG_RTC_DRV_S35390A is not set
891# CONFIG_RTC_DRV_FM3130 is not set
892# CONFIG_RTC_DRV_RX8581 is not set
893# CONFIG_RTC_DRV_RX8025 is not set
894
895#
896# SPI RTC drivers
897#
898
899#
900# Platform RTC drivers
901#
902# CONFIG_RTC_DRV_DS1286 is not set
903# CONFIG_RTC_DRV_DS1511 is not set
904# CONFIG_RTC_DRV_DS1553 is not set
905# CONFIG_RTC_DRV_DS1742 is not set
906# CONFIG_RTC_DRV_STK17TA8 is not set
907# CONFIG_RTC_DRV_M48T86 is not set
908# CONFIG_RTC_DRV_M48T35 is not set
909# CONFIG_RTC_DRV_M48T59 is not set
910# CONFIG_RTC_DRV_BQ4802 is not set
911# CONFIG_RTC_DRV_V3020 is not set
912
913#
914# on-CPU RTC drivers
915#
916CONFIG_RTC_DRV_SH=y
917# CONFIG_RTC_DRV_GENERIC is not set
918# CONFIG_DMADEVICES is not set
919# CONFIG_AUXDISPLAY is not set
920CONFIG_UIO=y
921# CONFIG_UIO_PDRV is not set
922CONFIG_UIO_PDRV_GENIRQ=y
923# CONFIG_UIO_SMX is not set
924# CONFIG_UIO_SERCOS3 is not set
925
926#
927# TI VLYNQ
928#
929# CONFIG_STAGING is not set
930
931#
932# File systems
933#
934# CONFIG_EXT2_FS is not set
935# CONFIG_EXT3_FS is not set
936# CONFIG_EXT4_FS is not set
937# CONFIG_REISERFS_FS is not set
938# CONFIG_JFS_FS is not set
939# CONFIG_FS_POSIX_ACL is not set
940# CONFIG_XFS_FS is not set
941# CONFIG_GFS2_FS is not set
942# CONFIG_OCFS2_FS is not set
943# CONFIG_BTRFS_FS is not set
944CONFIG_FILE_LOCKING=y
945CONFIG_FSNOTIFY=y
946CONFIG_DNOTIFY=y
947# CONFIG_INOTIFY is not set
948CONFIG_INOTIFY_USER=y
949# CONFIG_QUOTA is not set
950# CONFIG_AUTOFS_FS is not set
951# CONFIG_AUTOFS4_FS is not set
952# CONFIG_FUSE_FS is not set
953
954#
955# Caches
956#
957# CONFIG_FSCACHE is not set
958
959#
960# CD-ROM/DVD Filesystems
961#
962# CONFIG_ISO9660_FS is not set
963# CONFIG_UDF_FS is not set
964
965#
966# DOS/FAT/NT Filesystems
967#
968# CONFIG_MSDOS_FS is not set
969# CONFIG_VFAT_FS is not set
970# CONFIG_NTFS_FS is not set
971
972#
973# Pseudo filesystems
974#
975CONFIG_PROC_FS=y
976CONFIG_PROC_KCORE=y
977CONFIG_PROC_SYSCTL=y
978CONFIG_PROC_PAGE_MONITOR=y
979CONFIG_SYSFS=y
980CONFIG_TMPFS=y
981# CONFIG_TMPFS_POSIX_ACL is not set
982# CONFIG_HUGETLBFS is not set
983# CONFIG_HUGETLB_PAGE is not set
984# CONFIG_CONFIGFS_FS is not set
985# CONFIG_MISC_FILESYSTEMS is not set
986# CONFIG_NETWORK_FILESYSTEMS is not set
987
988#
989# Partition Types
990#
991# CONFIG_PARTITION_ADVANCED is not set
992CONFIG_MSDOS_PARTITION=y
993# CONFIG_NLS is not set
994# CONFIG_DLM is not set
995
996#
997# Kernel hacking
998#
999CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1000# CONFIG_PRINTK_TIME is not set
1001CONFIG_ENABLE_WARN_DEPRECATED=y
1002# CONFIG_ENABLE_MUST_CHECK is not set
1003CONFIG_FRAME_WARN=1024
1004# CONFIG_MAGIC_SYSRQ is not set
1005# CONFIG_UNUSED_SYMBOLS is not set
1006CONFIG_DEBUG_FS=y
1007# CONFIG_HEADERS_CHECK is not set
1008# CONFIG_DEBUG_KERNEL is not set
1009# CONFIG_DEBUG_BUGVERBOSE is not set
1010# CONFIG_DEBUG_MEMORY_INIT is not set
1011# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1012# CONFIG_LATENCYTOP is not set
1013# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1014CONFIG_HAVE_FUNCTION_TRACER=y
1015CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1016CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1017CONFIG_HAVE_DYNAMIC_FTRACE=y
1018CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1019CONFIG_HAVE_FTRACE_SYSCALLS=y
1020CONFIG_TRACING_SUPPORT=y
1021# CONFIG_FTRACE is not set
1022# CONFIG_DYNAMIC_DEBUG is not set
1023# CONFIG_DMA_API_DEBUG is not set
1024# CONFIG_SAMPLES is not set
1025CONFIG_HAVE_ARCH_KGDB=y
1026# CONFIG_SH_STANDARD_BIOS is not set
1027# CONFIG_EARLY_SCIF_CONSOLE is not set
1028# CONFIG_DWARF_UNWINDER is not set
1029
1030#
1031# Security options
1032#
1033# CONFIG_KEYS is not set
1034# CONFIG_SECURITY is not set
1035# CONFIG_SECURITYFS is not set
1036# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1037# CONFIG_CRYPTO is not set
1038# CONFIG_BINARY_PRINTF is not set
1039
1040#
1041# Library routines
1042#
1043CONFIG_BITREVERSE=y
1044CONFIG_GENERIC_FIND_LAST_BIT=y
1045# CONFIG_CRC_CCITT is not set
1046# CONFIG_CRC16 is not set
1047# CONFIG_CRC_T10DIF is not set
1048# CONFIG_CRC_ITU_T is not set
1049CONFIG_CRC32=y
1050# CONFIG_CRC7 is not set
1051# CONFIG_LIBCRC32C is not set
1052CONFIG_ZLIB_INFLATE=y
1053CONFIG_DECOMPRESS_GZIP=y
1054CONFIG_HAS_IOMEM=y
1055CONFIG_HAS_IOPORT=y
1056CONFIG_HAS_DMA=y
1057CONFIG_HAVE_LMB=y
1058CONFIG_NLATTR=y
1059CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/configs/snapgear_defconfig b/arch/sh/configs/snapgear_defconfig
index ca3c88a8802..2be2d75adbb 100644
--- a/arch/sh/configs/snapgear_defconfig
+++ b/arch/sh/configs/snapgear_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.30 3# Linux kernel version: 2.6.31-rc6
4# Thu Jun 18 13:11:58 2009 4# Thu Aug 20 15:03:04 2009
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_SUPERH32=y 7CONFIG_SUPERH32=y
@@ -14,6 +14,7 @@ CONFIG_GENERIC_HWEIGHT=y
14CONFIG_GENERIC_HARDIRQS=y 14CONFIG_GENERIC_HARDIRQS=y
15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 15CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
16CONFIG_GENERIC_IRQ_PROBE=y 16CONFIG_GENERIC_IRQ_PROBE=y
17CONFIG_IRQ_PER_CPU=y
17# CONFIG_GENERIC_GPIO is not set 18# CONFIG_GENERIC_GPIO is not set
18CONFIG_GENERIC_TIME=y 19CONFIG_GENERIC_TIME=y
19CONFIG_GENERIC_CLOCKEVENTS=y 20CONFIG_GENERIC_CLOCKEVENTS=y
@@ -28,7 +29,9 @@ CONFIG_HAVE_LATENCYTOP_SUPPORT=y
28# CONFIG_ARCH_HAS_ILOG2_U64 is not set 29# CONFIG_ARCH_HAS_ILOG2_U64 is not set
29CONFIG_ARCH_NO_VIRT_TO_BUS=y 30CONFIG_ARCH_NO_VIRT_TO_BUS=y
30CONFIG_ARCH_HAS_DEFAULT_IDLE=y 31CONFIG_ARCH_HAS_DEFAULT_IDLE=y
32CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
31CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 33CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
34CONFIG_CONSTRUCTORS=y
32 35
33# 36#
34# General setup 37# General setup
@@ -38,6 +41,12 @@ CONFIG_BROKEN_ON_SMP=y
38CONFIG_INIT_ENV_ARG_LIMIT=32 41CONFIG_INIT_ENV_ARG_LIMIT=32
39CONFIG_LOCALVERSION="" 42CONFIG_LOCALVERSION=""
40CONFIG_LOCALVERSION_AUTO=y 43CONFIG_LOCALVERSION_AUTO=y
44CONFIG_HAVE_KERNEL_GZIP=y
45CONFIG_HAVE_KERNEL_BZIP2=y
46CONFIG_HAVE_KERNEL_LZMA=y
47CONFIG_KERNEL_GZIP=y
48# CONFIG_KERNEL_BZIP2 is not set
49# CONFIG_KERNEL_LZMA is not set
41# CONFIG_SWAP is not set 50# CONFIG_SWAP is not set
42# CONFIG_SYSVIPC is not set 51# CONFIG_SYSVIPC is not set
43# CONFIG_POSIX_MQUEUE is not set 52# CONFIG_POSIX_MQUEUE is not set
@@ -86,10 +95,12 @@ CONFIG_TIMERFD=y
86CONFIG_EVENTFD=y 95CONFIG_EVENTFD=y
87CONFIG_SHMEM=y 96CONFIG_SHMEM=y
88CONFIG_AIO=y 97CONFIG_AIO=y
98CONFIG_HAVE_PERF_COUNTERS=y
89 99
90# 100#
91# Performance Counters 101# Performance Counters
92# 102#
103# CONFIG_PERF_COUNTERS is not set
93CONFIG_VM_EVENT_COUNTERS=y 104CONFIG_VM_EVENT_COUNTERS=y
94CONFIG_PCI_QUIRKS=y 105CONFIG_PCI_QUIRKS=y
95# CONFIG_STRIP_ASM_SYMS is not set 106# CONFIG_STRIP_ASM_SYMS is not set
@@ -106,6 +117,10 @@ CONFIG_HAVE_KRETPROBES=y
106CONFIG_HAVE_ARCH_TRACEHOOK=y 117CONFIG_HAVE_ARCH_TRACEHOOK=y
107CONFIG_HAVE_CLK=y 118CONFIG_HAVE_CLK=y
108CONFIG_HAVE_DMA_API_DEBUG=y 119CONFIG_HAVE_DMA_API_DEBUG=y
120
121#
122# GCOV-based kernel profiling
123#
109# CONFIG_SLOW_WORK is not set 124# CONFIG_SLOW_WORK is not set
110CONFIG_HAVE_GENERIC_DMA_COHERENT=y 125CONFIG_HAVE_GENERIC_DMA_COHERENT=y
111CONFIG_SLABINFO=y 126CONFIG_SLABINFO=y
@@ -113,7 +128,7 @@ CONFIG_RT_MUTEXES=y
113CONFIG_BASE_SMALL=0 128CONFIG_BASE_SMALL=0
114# CONFIG_MODULES is not set 129# CONFIG_MODULES is not set
115CONFIG_BLOCK=y 130CONFIG_BLOCK=y
116# CONFIG_LBD is not set 131CONFIG_LBDAF=y
117# CONFIG_BLK_DEV_BSG is not set 132# CONFIG_BLK_DEV_BSG is not set
118# CONFIG_BLK_DEV_INTEGRITY is not set 133# CONFIG_BLK_DEV_INTEGRITY is not set
119 134
@@ -534,7 +549,11 @@ CONFIG_HAVE_IDE=y
534# 549#
535 550
536# 551#
537# Enable only one of the two stacks, unless you know what you are doing 552# You can enable one or both FireWire driver stacks.
553#
554
555#
556# See the help texts for more information.
538# 557#
539# CONFIG_FIREWIRE is not set 558# CONFIG_FIREWIRE is not set
540# CONFIG_IEEE1394 is not set 559# CONFIG_IEEE1394 is not set
@@ -686,6 +705,11 @@ CONFIG_LEGACY_PTY_COUNT=256
686CONFIG_DEVPORT=y 705CONFIG_DEVPORT=y
687# CONFIG_I2C is not set 706# CONFIG_I2C is not set
688# CONFIG_SPI is not set 707# CONFIG_SPI is not set
708
709#
710# PPS support
711#
712# CONFIG_PPS is not set
689# CONFIG_W1 is not set 713# CONFIG_W1 is not set
690# CONFIG_POWER_SUPPLY is not set 714# CONFIG_POWER_SUPPLY is not set
691# CONFIG_HWMON is not set 715# CONFIG_HWMON is not set
@@ -732,7 +756,44 @@ CONFIG_SSB_POSSIBLE=y
732# CONFIG_ACCESSIBILITY is not set 756# CONFIG_ACCESSIBILITY is not set
733# CONFIG_INFINIBAND is not set 757# CONFIG_INFINIBAND is not set
734CONFIG_RTC_LIB=y 758CONFIG_RTC_LIB=y
735# CONFIG_RTC_CLASS is not set 759CONFIG_RTC_CLASS=y
760CONFIG_RTC_HCTOSYS=y
761CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
762# CONFIG_RTC_DEBUG is not set
763
764#
765# RTC interfaces
766#
767CONFIG_RTC_INTF_SYSFS=y
768CONFIG_RTC_INTF_PROC=y
769CONFIG_RTC_INTF_DEV=y
770# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
771# CONFIG_RTC_DRV_TEST is not set
772
773#
774# SPI RTC drivers
775#
776
777#
778# Platform RTC drivers
779#
780# CONFIG_RTC_DRV_DS1286 is not set
781CONFIG_RTC_DRV_DS1302=y
782# CONFIG_RTC_DRV_DS1511 is not set
783# CONFIG_RTC_DRV_DS1553 is not set
784# CONFIG_RTC_DRV_DS1742 is not set
785# CONFIG_RTC_DRV_STK17TA8 is not set
786# CONFIG_RTC_DRV_M48T86 is not set
787# CONFIG_RTC_DRV_M48T35 is not set
788# CONFIG_RTC_DRV_M48T59 is not set
789# CONFIG_RTC_DRV_BQ4802 is not set
790# CONFIG_RTC_DRV_V3020 is not set
791
792#
793# on-CPU RTC drivers
794#
795# CONFIG_RTC_DRV_SH is not set
796# CONFIG_RTC_DRV_GENERIC is not set
736# CONFIG_DMADEVICES is not set 797# CONFIG_DMADEVICES is not set
737# CONFIG_AUXDISPLAY is not set 798# CONFIG_AUXDISPLAY is not set
738# CONFIG_UIO is not set 799# CONFIG_UIO is not set
@@ -754,6 +815,7 @@ CONFIG_EXT2_FS=y
754# CONFIG_JFS_FS is not set 815# CONFIG_JFS_FS is not set
755# CONFIG_FS_POSIX_ACL is not set 816# CONFIG_FS_POSIX_ACL is not set
756# CONFIG_XFS_FS is not set 817# CONFIG_XFS_FS is not set
818# CONFIG_GFS2_FS is not set
757# CONFIG_OCFS2_FS is not set 819# CONFIG_OCFS2_FS is not set
758# CONFIG_BTRFS_FS is not set 820# CONFIG_BTRFS_FS is not set
759CONFIG_FILE_LOCKING=y 821CONFIG_FILE_LOCKING=y
@@ -856,8 +918,11 @@ CONFIG_FRAME_WARN=1024
856# CONFIG_RCU_CPU_STALL_DETECTOR is not set 918# CONFIG_RCU_CPU_STALL_DETECTOR is not set
857# CONFIG_LATENCYTOP is not set 919# CONFIG_LATENCYTOP is not set
858CONFIG_HAVE_FUNCTION_TRACER=y 920CONFIG_HAVE_FUNCTION_TRACER=y
921CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
922CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
859CONFIG_HAVE_DYNAMIC_FTRACE=y 923CONFIG_HAVE_DYNAMIC_FTRACE=y
860CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y 924CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
925CONFIG_HAVE_FTRACE_SYSCALLS=y
861CONFIG_TRACING_SUPPORT=y 926CONFIG_TRACING_SUPPORT=y
862# CONFIG_FTRACE is not set 927# CONFIG_FTRACE is not set
863# CONFIG_DMA_API_DEBUG is not set 928# CONFIG_DMA_API_DEBUG is not set
@@ -865,6 +930,7 @@ CONFIG_TRACING_SUPPORT=y
865CONFIG_HAVE_ARCH_KGDB=y 930CONFIG_HAVE_ARCH_KGDB=y
866# CONFIG_SH_STANDARD_BIOS is not set 931# CONFIG_SH_STANDARD_BIOS is not set
867# CONFIG_EARLY_SCIF_CONSOLE is not set 932# CONFIG_EARLY_SCIF_CONSOLE is not set
933# CONFIG_DWARF_UNWINDER is not set
868 934
869# 935#
870# Security options 936# Security options
@@ -893,5 +959,6 @@ CONFIG_DECOMPRESS_GZIP=y
893CONFIG_HAS_IOMEM=y 959CONFIG_HAS_IOMEM=y
894CONFIG_HAS_IOPORT=y 960CONFIG_HAS_IOPORT=y
895CONFIG_HAS_DMA=y 961CONFIG_HAS_DMA=y
962CONFIG_HAVE_LMB=y
896CONFIG_NLATTR=y 963CONFIG_NLATTR=y
897CONFIG_GENERIC_ATOMIC64=y 964CONFIG_GENERIC_ATOMIC64=y
diff --git a/arch/sh/drivers/dma/Kconfig b/arch/sh/drivers/dma/Kconfig
index 63e9dd30b41..b91fa8dbf04 100644
--- a/arch/sh/drivers/dma/Kconfig
+++ b/arch/sh/drivers/dma/Kconfig
@@ -27,12 +27,12 @@ config NR_ONCHIP_DMA_CHANNELS
27 default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R || \ 27 default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R || \
28 CPU_SUBTYPE_SH7760 28 CPU_SUBTYPE_SH7760
29 default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7780 || \ 29 default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7780 || \
30 CPU_SUBTYPE_SH7785 30 CPU_SUBTYPE_SH7785 || CPU_SUBTYPE_SH7724
31 default "6" 31 default "6"
32 help 32 help
33 This allows you to specify the number of channels that the on-chip 33 This allows you to specify the number of channels that the on-chip
34 DMAC supports. This will be 4 for SH7091/SH7750/SH7751 and 8 for the 34 DMAC supports. This will be 4 for SH7750/SH7751/Sh7750S/SH7091 and 8 for the
35 SH7750R/SH7751R. 35 SH7750R/SH7751R/SH7760, 12 for the SH7723/SH7780/SH7785/SH7724, default is 6.
36 36
37config NR_DMA_CHANNELS_BOOL 37config NR_DMA_CHANNELS_BOOL
38 depends on SH_DMA 38 depends on SH_DMA
diff --git a/arch/sh/drivers/heartbeat.c b/arch/sh/drivers/heartbeat.c
index 938817e34e2..a9339a6174f 100644
--- a/arch/sh/drivers/heartbeat.c
+++ b/arch/sh/drivers/heartbeat.c
@@ -40,14 +40,19 @@ static inline void heartbeat_toggle_bit(struct heartbeat_data *hd,
40 if (inverted) 40 if (inverted)
41 new = ~new; 41 new = ~new;
42 42
43 new &= hd->mask;
44
43 switch (hd->regsize) { 45 switch (hd->regsize) {
44 case 32: 46 case 32:
47 new |= ioread32(hd->base) & ~hd->mask;
45 iowrite32(new, hd->base); 48 iowrite32(new, hd->base);
46 break; 49 break;
47 case 16: 50 case 16:
51 new |= ioread16(hd->base) & ~hd->mask;
48 iowrite16(new, hd->base); 52 iowrite16(new, hd->base);
49 break; 53 break;
50 default: 54 default:
55 new |= ioread8(hd->base) & ~hd->mask;
51 iowrite8(new, hd->base); 56 iowrite8(new, hd->base);
52 break; 57 break;
53 } 58 }
@@ -72,6 +77,7 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
72{ 77{
73 struct resource *res; 78 struct resource *res;
74 struct heartbeat_data *hd; 79 struct heartbeat_data *hd;
80 int i;
75 81
76 if (unlikely(pdev->num_resources != 1)) { 82 if (unlikely(pdev->num_resources != 1)) {
77 dev_err(&pdev->dev, "invalid number of resources\n"); 83 dev_err(&pdev->dev, "invalid number of resources\n");
@@ -107,6 +113,10 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
107 hd->nr_bits = ARRAY_SIZE(default_bit_pos); 113 hd->nr_bits = ARRAY_SIZE(default_bit_pos);
108 } 114 }
109 115
116 hd->mask = 0;
117 for (i = 0; i < hd->nr_bits; i++)
118 hd->mask |= (1 << hd->bit_pos[i]);
119
110 if (!hd->regsize) 120 if (!hd->regsize)
111 hd->regsize = 8; /* default access size */ 121 hd->regsize = 8; /* default access size */
112 122
diff --git a/arch/sh/drivers/pci/pci.c b/arch/sh/drivers/pci/pci.c
index 9a1c423ad16..c481df63902 100644
--- a/arch/sh/drivers/pci/pci.c
+++ b/arch/sh/drivers/pci/pci.c
@@ -295,6 +295,8 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
295 vma->vm_page_prot); 295 vma->vm_page_prot);
296} 296}
297 297
298#ifndef CONFIG_GENERIC_IOMAP
299
298static void __iomem *ioport_map_pci(struct pci_dev *dev, 300static void __iomem *ioport_map_pci(struct pci_dev *dev,
299 unsigned long port, unsigned int nr) 301 unsigned long port, unsigned int nr)
300{ 302{
@@ -346,6 +348,8 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
346} 348}
347EXPORT_SYMBOL(pci_iounmap); 349EXPORT_SYMBOL(pci_iounmap);
348 350
351#endif /* CONFIG_GENERIC_IOMAP */
352
349#ifdef CONFIG_HOTPLUG 353#ifdef CONFIG_HOTPLUG
350EXPORT_SYMBOL(pcibios_resource_to_bus); 354EXPORT_SYMBOL(pcibios_resource_to_bus);
351EXPORT_SYMBOL(pcibios_bus_to_resource); 355EXPORT_SYMBOL(pcibios_bus_to_resource);
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 43910cdf78a..e121c30f797 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,6 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += cpu-features.h 3header-y += cachectl.h cpu-features.h
4 4
5unifdef-y += unistd_32.h 5unifdef-y += unistd_32.h
6unifdef-y += unistd_64.h 6unifdef-y += unistd_64.h
diff --git a/arch/sh/include/asm/bug.h b/arch/sh/include/asm/bug.h
index c0171804016..d02c01b3e6b 100644
--- a/arch/sh/include/asm/bug.h
+++ b/arch/sh/include/asm/bug.h
@@ -2,6 +2,7 @@
2#define __ASM_SH_BUG_H 2#define __ASM_SH_BUG_H
3 3
4#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */ 4#define TRAPA_BUG_OPCODE 0xc33e /* trapa #0x3e */
5#define BUGFLAG_UNWINDER (1 << 1)
5 6
6#ifdef CONFIG_GENERIC_BUG 7#ifdef CONFIG_GENERIC_BUG
7#define HAVE_ARCH_BUG 8#define HAVE_ARCH_BUG
@@ -72,6 +73,36 @@ do { \
72 unlikely(__ret_warn_on); \ 73 unlikely(__ret_warn_on); \
73}) 74})
74 75
76#define UNWINDER_BUG() \
77do { \
78 __asm__ __volatile__ ( \
79 "1:\t.short %O0\n" \
80 _EMIT_BUG_ENTRY \
81 : \
82 : "n" (TRAPA_BUG_OPCODE), \
83 "i" (__FILE__), \
84 "i" (__LINE__), \
85 "i" (BUGFLAG_UNWINDER), \
86 "i" (sizeof(struct bug_entry))); \
87} while (0)
88
89#define UNWINDER_BUG_ON(x) ({ \
90 int __ret_unwinder_on = !!(x); \
91 if (__builtin_constant_p(__ret_unwinder_on)) { \
92 if (__ret_unwinder_on) \
93 UNWINDER_BUG(); \
94 } else { \
95 if (unlikely(__ret_unwinder_on)) \
96 UNWINDER_BUG(); \
97 } \
98 unlikely(__ret_unwinder_on); \
99})
100
101#else
102
103#define UNWINDER_BUG BUG
104#define UNWINDER_BUG_ON BUG_ON
105
75#endif /* CONFIG_GENERIC_BUG */ 106#endif /* CONFIG_GENERIC_BUG */
76 107
77#include <asm-generic/bug.h> 108#include <asm-generic/bug.h>
diff --git a/arch/sh/include/asm/bugs.h b/arch/sh/include/asm/bugs.h
index 4924ff6f543..46260fcbdf4 100644
--- a/arch/sh/include/asm/bugs.h
+++ b/arch/sh/include/asm/bugs.h
@@ -21,25 +21,25 @@ static void __init check_bugs(void)
21 21
22 current_cpu_data.loops_per_jiffy = loops_per_jiffy; 22 current_cpu_data.loops_per_jiffy = loops_per_jiffy;
23 23
24 switch (current_cpu_data.type) { 24 switch (current_cpu_data.family) {
25 case CPU_SH7619: 25 case CPU_FAMILY_SH2:
26 *p++ = '2'; 26 *p++ = '2';
27 break; 27 break;
28 case CPU_SH7201 ... CPU_MXG: 28 case CPU_FAMILY_SH2A:
29 *p++ = '2'; 29 *p++ = '2';
30 *p++ = 'a'; 30 *p++ = 'a';
31 break; 31 break;
32 case CPU_SH7705 ... CPU_SH7729: 32 case CPU_FAMILY_SH3:
33 *p++ = '3'; 33 *p++ = '3';
34 break; 34 break;
35 case CPU_SH7750 ... CPU_SH4_501: 35 case CPU_FAMILY_SH4:
36 *p++ = '4'; 36 *p++ = '4';
37 break; 37 break;
38 case CPU_SH7763 ... CPU_SHX3: 38 case CPU_FAMILY_SH4A:
39 *p++ = '4'; 39 *p++ = '4';
40 *p++ = 'a'; 40 *p++ = 'a';
41 break; 41 break;
42 case CPU_SH7343 ... CPU_SH7366: 42 case CPU_FAMILY_SH4AL_DSP:
43 *p++ = '4'; 43 *p++ = '4';
44 *p++ = 'a'; 44 *p++ = 'a';
45 *p++ = 'l'; 45 *p++ = 'l';
@@ -48,15 +48,15 @@ static void __init check_bugs(void)
48 *p++ = 's'; 48 *p++ = 's';
49 *p++ = 'p'; 49 *p++ = 'p';
50 break; 50 break;
51 case CPU_SH5_101 ... CPU_SH5_103: 51 case CPU_FAMILY_SH5:
52 *p++ = '6'; 52 *p++ = '6';
53 *p++ = '4'; 53 *p++ = '4';
54 break; 54 break;
55 case CPU_SH_NONE: 55 case CPU_FAMILY_UNKNOWN:
56 /* 56 /*
57 * Specifically use CPU_SH_NONE rather than default:, 57 * Specifically use CPU_FAMILY_UNKNOWN rather than
58 * so we're able to have the compiler whine about 58 * default:, so we're able to have the compiler whine
59 * unhandled enumerations. 59 * about unhandled enumerations.
60 */ 60 */
61 break; 61 break;
62 } 62 }
diff --git a/arch/sh/include/asm/cachectl.h b/arch/sh/include/asm/cachectl.h
new file mode 100644
index 00000000000..6ffb4b7a212
--- /dev/null
+++ b/arch/sh/include/asm/cachectl.h
@@ -0,0 +1,19 @@
1#ifndef _SH_CACHECTL_H
2#define _SH_CACHECTL_H
3
4/* Definitions for the cacheflush system call. */
5
6#define CACHEFLUSH_D_INVAL 0x1 /* invalidate (without write back) */
7#define CACHEFLUSH_D_WB 0x2 /* write back (without invalidate) */
8#define CACHEFLUSH_D_PURGE 0x3 /* writeback and invalidate */
9
10#define CACHEFLUSH_I 0x4
11
12/*
13 * Options for cacheflush system call
14 */
15#define ICACHE CACHEFLUSH_I /* flush instruction cache */
16#define DCACHE CACHEFLUSH_D_PURGE /* writeback and flush data cache */
17#define BCACHE (ICACHE|DCACHE) /* flush both caches */
18
19#endif /* _SH_CACHECTL_H */
diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index 4c5462daa74..c29918f3c81 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -3,45 +3,65 @@
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5 5
6#ifdef CONFIG_CACHE_OFF 6#include <linux/mm.h>
7
7/* 8/*
8 * Nothing to do when the cache is disabled, initial flush and explicit 9 * Cache flushing:
9 * disabling is handled at CPU init time. 10 *
11 * - flush_cache_all() flushes entire cache
12 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
13 * - flush_cache_dup mm(mm) handles cache flushing when forking
14 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
15 * - flush_cache_range(vma, start, end) flushes a range of pages
10 * 16 *
11 * See arch/sh/kernel/cpu/init.c:cache_init(). 17 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
18 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
19 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
20 * - flush_cache_sigtramp(vaddr) flushes the signal trampoline
12 */ 21 */
13#define p3_cache_init() do { } while (0) 22extern void (*local_flush_cache_all)(void *args);
14#define flush_cache_all() do { } while (0) 23extern void (*local_flush_cache_mm)(void *args);
15#define flush_cache_mm(mm) do { } while (0) 24extern void (*local_flush_cache_dup_mm)(void *args);
16#define flush_cache_dup_mm(mm) do { } while (0) 25extern void (*local_flush_cache_page)(void *args);
17#define flush_cache_range(vma, start, end) do { } while (0) 26extern void (*local_flush_cache_range)(void *args);
18#define flush_cache_page(vma, vmaddr, pfn) do { } while (0) 27extern void (*local_flush_dcache_page)(void *args);
19#define flush_dcache_page(page) do { } while (0) 28extern void (*local_flush_icache_range)(void *args);
20#define flush_icache_range(start, end) do { } while (0) 29extern void (*local_flush_icache_page)(void *args);
21#define flush_icache_page(vma,pg) do { } while (0) 30extern void (*local_flush_cache_sigtramp)(void *args);
22#define flush_dcache_mmap_lock(mapping) do { } while (0)
23#define flush_dcache_mmap_unlock(mapping) do { } while (0)
24#define flush_cache_sigtramp(vaddr) do { } while (0)
25#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
26#define __flush_wback_region(start, size) do { (void)(start); } while (0)
27#define __flush_purge_region(start, size) do { (void)(start); } while (0)
28#define __flush_invalidate_region(start, size) do { (void)(start); } while (0)
29#else
30#include <cpu/cacheflush.h>
31 31
32/* 32static inline void cache_noop(void *args) { }
33 * Consistent DMA requires that the __flush_xxx() primitives must be set 33
34 * for any of the enabled non-coherent caches (most of the UP CPUs), 34extern void (*__flush_wback_region)(void *start, int size);
35 * regardless of PIPT or VIPT cache configurations. 35extern void (*__flush_purge_region)(void *start, int size);
36 */ 36extern void (*__flush_invalidate_region)(void *start, int size);
37
38extern void flush_cache_all(void);
39extern void flush_cache_mm(struct mm_struct *mm);
40extern void flush_cache_dup_mm(struct mm_struct *mm);
41extern void flush_cache_page(struct vm_area_struct *vma,
42 unsigned long addr, unsigned long pfn);
43extern void flush_cache_range(struct vm_area_struct *vma,
44 unsigned long start, unsigned long end);
45extern void flush_dcache_page(struct page *page);
46extern void flush_icache_range(unsigned long start, unsigned long end);
47extern void flush_icache_page(struct vm_area_struct *vma,
48 struct page *page);
49extern void flush_cache_sigtramp(unsigned long address);
50
51struct flusher_data {
52 struct vm_area_struct *vma;
53 unsigned long addr1, addr2;
54};
37 55
38/* Flush (write-back only) a region (smaller than a page) */ 56#define ARCH_HAS_FLUSH_ANON_PAGE
39extern void __flush_wback_region(void *start, int size); 57extern void __flush_anon_page(struct page *page, unsigned long);
40/* Flush (write-back & invalidate) a region (smaller than a page) */ 58
41extern void __flush_purge_region(void *start, int size); 59static inline void flush_anon_page(struct vm_area_struct *vma,
42/* Flush (invalidate only) a region (smaller than a page) */ 60 struct page *page, unsigned long vmaddr)
43extern void __flush_invalidate_region(void *start, int size); 61{
44#endif 62 if (boot_cpu_data.dcache.n_aliases && PageAnon(page))
63 __flush_anon_page(page, vmaddr);
64}
45 65
46#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE 66#define ARCH_HAS_FLUSH_KERNEL_DCACHE_PAGE
47static inline void flush_kernel_dcache_page(struct page *page) 67static inline void flush_kernel_dcache_page(struct page *page)
@@ -49,7 +69,6 @@ static inline void flush_kernel_dcache_page(struct page *page)
49 flush_dcache_page(page); 69 flush_dcache_page(page);
50} 70}
51 71
52#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_CACHE_OFF)
53extern void copy_to_user_page(struct vm_area_struct *vma, 72extern void copy_to_user_page(struct vm_area_struct *vma,
54 struct page *page, unsigned long vaddr, void *dst, const void *src, 73 struct page *page, unsigned long vaddr, void *dst, const void *src,
55 unsigned long len); 74 unsigned long len);
@@ -57,23 +76,20 @@ extern void copy_to_user_page(struct vm_area_struct *vma,
57extern void copy_from_user_page(struct vm_area_struct *vma, 76extern void copy_from_user_page(struct vm_area_struct *vma,
58 struct page *page, unsigned long vaddr, void *dst, const void *src, 77 struct page *page, unsigned long vaddr, void *dst, const void *src,
59 unsigned long len); 78 unsigned long len);
60#else
61#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
62 do { \
63 flush_cache_page(vma, vaddr, page_to_pfn(page));\
64 memcpy(dst, src, len); \
65 flush_icache_user_range(vma, page, vaddr, len); \
66 } while (0)
67
68#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
69 do { \
70 flush_cache_page(vma, vaddr, page_to_pfn(page));\
71 memcpy(dst, src, len); \
72 } while (0)
73#endif
74 79
75#define flush_cache_vmap(start, end) flush_cache_all() 80#define flush_cache_vmap(start, end) flush_cache_all()
76#define flush_cache_vunmap(start, end) flush_cache_all() 81#define flush_cache_vunmap(start, end) flush_cache_all()
77 82
83#define flush_dcache_mmap_lock(mapping) do { } while (0)
84#define flush_dcache_mmap_unlock(mapping) do { } while (0)
85
86void kmap_coherent_init(void);
87void *kmap_coherent(struct page *page, unsigned long addr);
88void kunmap_coherent(void *kvaddr);
89
90#define PG_dcache_dirty PG_arch_1
91
92void cpu_cache_init(void);
93
78#endif /* __KERNEL__ */ 94#endif /* __KERNEL__ */
79#endif /* __ASM_SH_CACHEFLUSH_H */ 95#endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/include/asm/device.h b/arch/sh/include/asm/device.h
index 8688a88303e..b16debfe8c1 100644
--- a/arch/sh/include/asm/device.h
+++ b/arch/sh/include/asm/device.h
@@ -3,7 +3,9 @@
3 * 3 *
4 * This file is released under the GPLv2 4 * This file is released under the GPLv2
5 */ 5 */
6#include <asm-generic/device.h> 6
7struct dev_archdata {
8};
7 9
8struct platform_device; 10struct platform_device;
9/* allocate contiguous memory chunk and fill in struct resource */ 11/* allocate contiguous memory chunk and fill in struct resource */
@@ -12,3 +14,15 @@ int platform_resource_setup_memory(struct platform_device *pdev,
12 14
13void plat_early_device_setup(void); 15void plat_early_device_setup(void);
14 16
17#define PDEV_ARCHDATA_FLAG_INIT 0
18#define PDEV_ARCHDATA_FLAG_IDLE 1
19#define PDEV_ARCHDATA_FLAG_SUSP 2
20
21struct pdev_archdata {
22 int hwblk_id;
23#ifdef CONFIG_PM_RUNTIME
24 unsigned long flags;
25 struct list_head entry;
26 struct mutex mutex;
27#endif
28};
diff --git a/arch/sh/include/asm/dma-sh.h b/arch/sh/include/asm/dma-sh.h
index 0c8f8e14622..68a5f4cb034 100644
--- a/arch/sh/include/asm/dma-sh.h
+++ b/arch/sh/include/asm/dma-sh.h
@@ -16,6 +16,7 @@
16 16
17/* DMAOR contorl: The DMAOR access size is different by CPU.*/ 17/* DMAOR contorl: The DMAOR access size is different by CPU.*/
18#if defined(CONFIG_CPU_SUBTYPE_SH7723) || \ 18#if defined(CONFIG_CPU_SUBTYPE_SH7723) || \
19 defined(CONFIG_CPU_SUBTYPE_SH7724) || \
19 defined(CONFIG_CPU_SUBTYPE_SH7780) || \ 20 defined(CONFIG_CPU_SUBTYPE_SH7780) || \
20 defined(CONFIG_CPU_SUBTYPE_SH7785) 21 defined(CONFIG_CPU_SUBTYPE_SH7785)
21#define dmaor_read_reg(n) \ 22#define dmaor_read_reg(n) \
diff --git a/arch/sh/include/asm/dwarf.h b/arch/sh/include/asm/dwarf.h
new file mode 100644
index 00000000000..ced6795891a
--- /dev/null
+++ b/arch/sh/include/asm/dwarf.h
@@ -0,0 +1,398 @@
1/*
2 * Copyright (C) 2009 Matt Fleming <matt@console-pimps.org>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 */
9#ifndef __ASM_SH_DWARF_H
10#define __ASM_SH_DWARF_H
11
12#ifdef CONFIG_DWARF_UNWINDER
13
14/*
15 * DWARF expression operations
16 */
17#define DW_OP_addr 0x03
18#define DW_OP_deref 0x06
19#define DW_OP_const1u 0x08
20#define DW_OP_const1s 0x09
21#define DW_OP_const2u 0x0a
22#define DW_OP_const2s 0x0b
23#define DW_OP_const4u 0x0c
24#define DW_OP_const4s 0x0d
25#define DW_OP_const8u 0x0e
26#define DW_OP_const8s 0x0f
27#define DW_OP_constu 0x10
28#define DW_OP_consts 0x11
29#define DW_OP_dup 0x12
30#define DW_OP_drop 0x13
31#define DW_OP_over 0x14
32#define DW_OP_pick 0x15
33#define DW_OP_swap 0x16
34#define DW_OP_rot 0x17
35#define DW_OP_xderef 0x18
36#define DW_OP_abs 0x19
37#define DW_OP_and 0x1a
38#define DW_OP_div 0x1b
39#define DW_OP_minus 0x1c
40#define DW_OP_mod 0x1d
41#define DW_OP_mul 0x1e
42#define DW_OP_neg 0x1f
43#define DW_OP_not 0x20
44#define DW_OP_or 0x21
45#define DW_OP_plus 0x22
46#define DW_OP_plus_uconst 0x23
47#define DW_OP_shl 0x24
48#define DW_OP_shr 0x25
49#define DW_OP_shra 0x26
50#define DW_OP_xor 0x27
51#define DW_OP_skip 0x2f
52#define DW_OP_bra 0x28
53#define DW_OP_eq 0x29
54#define DW_OP_ge 0x2a
55#define DW_OP_gt 0x2b
56#define DW_OP_le 0x2c
57#define DW_OP_lt 0x2d
58#define DW_OP_ne 0x2e
59#define DW_OP_lit0 0x30
60#define DW_OP_lit1 0x31
61#define DW_OP_lit2 0x32
62#define DW_OP_lit3 0x33
63#define DW_OP_lit4 0x34
64#define DW_OP_lit5 0x35
65#define DW_OP_lit6 0x36
66#define DW_OP_lit7 0x37
67#define DW_OP_lit8 0x38
68#define DW_OP_lit9 0x39
69#define DW_OP_lit10 0x3a
70#define DW_OP_lit11 0x3b
71#define DW_OP_lit12 0x3c
72#define DW_OP_lit13 0x3d
73#define DW_OP_lit14 0x3e
74#define DW_OP_lit15 0x3f
75#define DW_OP_lit16 0x40
76#define DW_OP_lit17 0x41
77#define DW_OP_lit18 0x42
78#define DW_OP_lit19 0x43
79#define DW_OP_lit20 0x44
80#define DW_OP_lit21 0x45
81#define DW_OP_lit22 0x46
82#define DW_OP_lit23 0x47
83#define DW_OP_lit24 0x48
84#define DW_OP_lit25 0x49
85#define DW_OP_lit26 0x4a
86#define DW_OP_lit27 0x4b
87#define DW_OP_lit28 0x4c
88#define DW_OP_lit29 0x4d
89#define DW_OP_lit30 0x4e
90#define DW_OP_lit31 0x4f
91#define DW_OP_reg0 0x50
92#define DW_OP_reg1 0x51
93#define DW_OP_reg2 0x52
94#define DW_OP_reg3 0x53
95#define DW_OP_reg4 0x54
96#define DW_OP_reg5 0x55
97#define DW_OP_reg6 0x56
98#define DW_OP_reg7 0x57
99#define DW_OP_reg8 0x58
100#define DW_OP_reg9 0x59
101#define DW_OP_reg10 0x5a
102#define DW_OP_reg11 0x5b
103#define DW_OP_reg12 0x5c
104#define DW_OP_reg13 0x5d
105#define DW_OP_reg14 0x5e
106#define DW_OP_reg15 0x5f
107#define DW_OP_reg16 0x60
108#define DW_OP_reg17 0x61
109#define DW_OP_reg18 0x62
110#define DW_OP_reg19 0x63
111#define DW_OP_reg20 0x64
112#define DW_OP_reg21 0x65
113#define DW_OP_reg22 0x66
114#define DW_OP_reg23 0x67
115#define DW_OP_reg24 0x68
116#define DW_OP_reg25 0x69
117#define DW_OP_reg26 0x6a
118#define DW_OP_reg27 0x6b
119#define DW_OP_reg28 0x6c
120#define DW_OP_reg29 0x6d
121#define DW_OP_reg30 0x6e
122#define DW_OP_reg31 0x6f
123#define DW_OP_breg0 0x70
124#define DW_OP_breg1 0x71
125#define DW_OP_breg2 0x72
126#define DW_OP_breg3 0x73
127#define DW_OP_breg4 0x74
128#define DW_OP_breg5 0x75
129#define DW_OP_breg6 0x76
130#define DW_OP_breg7 0x77
131#define DW_OP_breg8 0x78
132#define DW_OP_breg9 0x79
133#define DW_OP_breg10 0x7a
134#define DW_OP_breg11 0x7b
135#define DW_OP_breg12 0x7c
136#define DW_OP_breg13 0x7d
137#define DW_OP_breg14 0x7e
138#define DW_OP_breg15 0x7f
139#define DW_OP_breg16 0x80
140#define DW_OP_breg17 0x81
141#define DW_OP_breg18 0x82
142#define DW_OP_breg19 0x83
143#define DW_OP_breg20 0x84
144#define DW_OP_breg21 0x85
145#define DW_OP_breg22 0x86
146#define DW_OP_breg23 0x87
147#define DW_OP_breg24 0x88
148#define DW_OP_breg25 0x89
149#define DW_OP_breg26 0x8a
150#define DW_OP_breg27 0x8b
151#define DW_OP_breg28 0x8c
152#define DW_OP_breg29 0x8d
153#define DW_OP_breg30 0x8e
154#define DW_OP_breg31 0x8f
155#define DW_OP_regx 0x90
156#define DW_OP_fbreg 0x91
157#define DW_OP_bregx 0x92
158#define DW_OP_piece 0x93
159#define DW_OP_deref_size 0x94
160#define DW_OP_xderef_size 0x95
161#define DW_OP_nop 0x96
162#define DW_OP_push_object_address 0x97
163#define DW_OP_call2 0x98
164#define DW_OP_call4 0x99
165#define DW_OP_call_ref 0x9a
166#define DW_OP_form_tls_address 0x9b
167#define DW_OP_call_frame_cfa 0x9c
168#define DW_OP_bit_piece 0x9d
169#define DW_OP_lo_user 0xe0
170#define DW_OP_hi_user 0xff
171
172/*
173 * Addresses used in FDE entries in the .eh_frame section may be encoded
174 * using one of the following encodings.
175 */
176#define DW_EH_PE_absptr 0x00
177#define DW_EH_PE_omit 0xff
178#define DW_EH_PE_uleb128 0x01
179#define DW_EH_PE_udata2 0x02
180#define DW_EH_PE_udata4 0x03
181#define DW_EH_PE_udata8 0x04
182#define DW_EH_PE_sleb128 0x09
183#define DW_EH_PE_sdata2 0x0a
184#define DW_EH_PE_sdata4 0x0b
185#define DW_EH_PE_sdata8 0x0c
186#define DW_EH_PE_signed 0x09
187
188#define DW_EH_PE_pcrel 0x10
189
190/*
191 * The architecture-specific register number that contains the return
192 * address in the .debug_frame table.
193 */
194#define DWARF_ARCH_RA_REG 17
195
196#ifndef __ASSEMBLY__
197/*
198 * Read either the frame pointer (r14) or the stack pointer (r15).
199 * NOTE: this MUST be inlined.
200 */
201static __always_inline unsigned long dwarf_read_arch_reg(unsigned int reg)
202{
203 unsigned long value = 0;
204
205 switch (reg) {
206 case 14:
207 __asm__ __volatile__("mov r14, %0\n" : "=r" (value));
208 break;
209 case 15:
210 __asm__ __volatile__("mov r15, %0\n" : "=r" (value));
211 break;
212 default:
213 BUG();
214 }
215
216 return value;
217}
218
219/**
220 * dwarf_cie - Common Information Entry
221 */
222struct dwarf_cie {
223 unsigned long length;
224 unsigned long cie_id;
225 unsigned char version;
226 const char *augmentation;
227 unsigned int code_alignment_factor;
228 int data_alignment_factor;
229
230 /* Which column in the rule table represents return addr of func. */
231 unsigned int return_address_reg;
232
233 unsigned char *initial_instructions;
234 unsigned char *instructions_end;
235
236 unsigned char encoding;
237
238 unsigned long cie_pointer;
239
240 struct list_head link;
241
242 unsigned long flags;
243#define DWARF_CIE_Z_AUGMENTATION (1 << 0)
244};
245
246/**
247 * dwarf_fde - Frame Description Entry
248 */
249struct dwarf_fde {
250 unsigned long length;
251 unsigned long cie_pointer;
252 struct dwarf_cie *cie;
253 unsigned long initial_location;
254 unsigned long address_range;
255 unsigned char *instructions;
256 unsigned char *end;
257 struct list_head link;
258};
259
260/**
261 * dwarf_frame - DWARF information for a frame in the call stack
262 */
263struct dwarf_frame {
264 struct dwarf_frame *prev, *next;
265
266 unsigned long pc;
267
268 struct list_head reg_list;
269
270 unsigned long cfa;
271
272 /* Valid when DW_FRAME_CFA_REG_OFFSET is set in flags */
273 unsigned int cfa_register;
274 unsigned int cfa_offset;
275
276 /* Valid when DW_FRAME_CFA_REG_EXP is set in flags */
277 unsigned char *cfa_expr;
278 unsigned int cfa_expr_len;
279
280 unsigned long flags;
281#define DWARF_FRAME_CFA_REG_OFFSET (1 << 0)
282#define DWARF_FRAME_CFA_REG_EXP (1 << 1)
283
284 unsigned long return_addr;
285};
286
287/**
288 * dwarf_reg - DWARF register
289 * @flags: Describes how to calculate the value of this register
290 */
291struct dwarf_reg {
292 struct list_head link;
293
294 unsigned int number;
295
296 unsigned long addr;
297 unsigned long flags;
298#define DWARF_REG_OFFSET (1 << 0)
299#define DWARF_VAL_OFFSET (1 << 1)
300#define DWARF_UNDEFINED (1 << 2)
301};
302
303/*
304 * Call Frame instruction opcodes.
305 */
306#define DW_CFA_advance_loc 0x40
307#define DW_CFA_offset 0x80
308#define DW_CFA_restore 0xc0
309#define DW_CFA_nop 0x00
310#define DW_CFA_set_loc 0x01
311#define DW_CFA_advance_loc1 0x02
312#define DW_CFA_advance_loc2 0x03
313#define DW_CFA_advance_loc4 0x04
314#define DW_CFA_offset_extended 0x05
315#define DW_CFA_restore_extended 0x06
316#define DW_CFA_undefined 0x07
317#define DW_CFA_same_value 0x08
318#define DW_CFA_register 0x09
319#define DW_CFA_remember_state 0x0a
320#define DW_CFA_restore_state 0x0b
321#define DW_CFA_def_cfa 0x0c
322#define DW_CFA_def_cfa_register 0x0d
323#define DW_CFA_def_cfa_offset 0x0e
324#define DW_CFA_def_cfa_expression 0x0f
325#define DW_CFA_expression 0x10
326#define DW_CFA_offset_extended_sf 0x11
327#define DW_CFA_def_cfa_sf 0x12
328#define DW_CFA_def_cfa_offset_sf 0x13
329#define DW_CFA_val_offset 0x14
330#define DW_CFA_val_offset_sf 0x15
331#define DW_CFA_val_expression 0x16
332#define DW_CFA_lo_user 0x1c
333#define DW_CFA_hi_user 0x3f
334
335/* GNU extension opcodes */
336#define DW_CFA_GNU_args_size 0x2e
337#define DW_CFA_GNU_negative_offset_extended 0x2f
338
339/*
340 * Some call frame instructions encode their operands in the opcode. We
341 * need some helper functions to extract both the opcode and operands
342 * from an instruction.
343 */
344static inline unsigned int DW_CFA_opcode(unsigned long insn)
345{
346 return (insn & 0xc0);
347}
348
349static inline unsigned int DW_CFA_operand(unsigned long insn)
350{
351 return (insn & 0x3f);
352}
353
354#define DW_EH_FRAME_CIE 0 /* .eh_frame CIE IDs are 0 */
355#define DW_CIE_ID 0xffffffff
356#define DW64_CIE_ID 0xffffffffffffffffULL
357
358/*
359 * DWARF FDE/CIE length field values.
360 */
361#define DW_EXT_LO 0xfffffff0
362#define DW_EXT_HI 0xffffffff
363#define DW_EXT_DWARF64 DW_EXT_HI
364
365extern struct dwarf_frame *dwarf_unwind_stack(unsigned long,
366 struct dwarf_frame *);
367#endif /* !__ASSEMBLY__ */
368
369#define CFI_STARTPROC .cfi_startproc
370#define CFI_ENDPROC .cfi_endproc
371#define CFI_DEF_CFA .cfi_def_cfa
372#define CFI_REGISTER .cfi_register
373#define CFI_REL_OFFSET .cfi_rel_offset
374#define CFI_UNDEFINED .cfi_undefined
375
376#else
377
378/*
379 * Use the asm comment character to ignore the rest of the line.
380 */
381#define CFI_IGNORE !
382
383#define CFI_STARTPROC CFI_IGNORE
384#define CFI_ENDPROC CFI_IGNORE
385#define CFI_DEF_CFA CFI_IGNORE
386#define CFI_REGISTER CFI_IGNORE
387#define CFI_REL_OFFSET CFI_IGNORE
388#define CFI_UNDEFINED CFI_IGNORE
389
390#ifndef __ASSEMBLY__
391static inline void dwarf_unwinder_init(void)
392{
393}
394#endif
395
396#endif /* CONFIG_DWARF_UNWINDER */
397
398#endif /* __ASM_SH_DWARF_H */
diff --git a/arch/sh/include/asm/entry-macros.S b/arch/sh/include/asm/entry-macros.S
index 3a4752a6572..cc43a55e1fc 100644
--- a/arch/sh/include/asm/entry-macros.S
+++ b/arch/sh/include/asm/entry-macros.S
@@ -7,7 +7,7 @@
7 .endm 7 .endm
8 8
9 .macro sti 9 .macro sti
10 mov #0xf0, r11 10 mov #0xfffffff0, r11
11 extu.b r11, r11 11 extu.b r11, r11
12 not r11, r11 12 not r11, r11
13 stc sr, r10 13 stc sr, r10
@@ -31,8 +31,92 @@
31#endif 31#endif
32 .endm 32 .endm
33 33
34#ifdef CONFIG_TRACE_IRQFLAGS
35
36 .macro TRACE_IRQS_ON
37 mov.l r0, @-r15
38 mov.l r1, @-r15
39 mov.l r2, @-r15
40 mov.l r3, @-r15
41 mov.l r4, @-r15
42 mov.l r5, @-r15
43 mov.l r6, @-r15
44 mov.l r7, @-r15
45
46 mov.l 7834f, r0
47 jsr @r0
48 nop
49
50 mov.l @r15+, r7
51 mov.l @r15+, r6
52 mov.l @r15+, r5
53 mov.l @r15+, r4
54 mov.l @r15+, r3
55 mov.l @r15+, r2
56 mov.l @r15+, r1
57 mov.l @r15+, r0
58 mov.l 7834f, r0
59
60 bra 7835f
61 nop
62 .balign 4
637834: .long trace_hardirqs_on
647835:
65 .endm
66 .macro TRACE_IRQS_OFF
67
68 mov.l r0, @-r15
69 mov.l r1, @-r15
70 mov.l r2, @-r15
71 mov.l r3, @-r15
72 mov.l r4, @-r15
73 mov.l r5, @-r15
74 mov.l r6, @-r15
75 mov.l r7, @-r15
76
77 mov.l 7834f, r0
78 jsr @r0
79 nop
80
81 mov.l @r15+, r7
82 mov.l @r15+, r6
83 mov.l @r15+, r5
84 mov.l @r15+, r4
85 mov.l @r15+, r3
86 mov.l @r15+, r2
87 mov.l @r15+, r1
88 mov.l @r15+, r0
89 mov.l 7834f, r0
90
91 bra 7835f
92 nop
93 .balign 4
947834: .long trace_hardirqs_off
957835:
96 .endm
97
98#else
99 .macro TRACE_IRQS_ON
100 .endm
101
102 .macro TRACE_IRQS_OFF
103 .endm
104#endif
105
34#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4) 106#if defined(CONFIG_CPU_SH2A) || defined(CONFIG_CPU_SH4)
35# define PREF(x) pref @x 107# define PREF(x) pref @x
36#else 108#else
37# define PREF(x) nop 109# define PREF(x) nop
38#endif 110#endif
111
112 /*
113 * Macro for use within assembly. Because the DWARF unwinder
114 * needs to use the frame register to unwind the stack, we
115 * need to setup r14 with the value of the stack pointer as
116 * the return address is usually on the stack somewhere.
117 */
118 .macro setup_frame_reg
119#ifdef CONFIG_DWARF_UNWINDER
120 mov r15, r14
121#endif
122 .endm
diff --git a/arch/sh/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h
index 8fea7d8c825..12f3a31f20a 100644
--- a/arch/sh/include/asm/ftrace.h
+++ b/arch/sh/include/asm/ftrace.h
@@ -4,6 +4,7 @@
4#ifdef CONFIG_FUNCTION_TRACER 4#ifdef CONFIG_FUNCTION_TRACER
5 5
6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */ 6#define MCOUNT_INSN_SIZE 4 /* sizeof mcount call */
7#define FTRACE_SYSCALL_MAX NR_syscalls
7 8
8#ifndef __ASSEMBLY__ 9#ifndef __ASSEMBLY__
9extern void mcount(void); 10extern void mcount(void);
@@ -11,10 +12,13 @@ extern void mcount(void);
11#define MCOUNT_ADDR ((long)(mcount)) 12#define MCOUNT_ADDR ((long)(mcount))
12 13
13#ifdef CONFIG_DYNAMIC_FTRACE 14#ifdef CONFIG_DYNAMIC_FTRACE
14#define CALLER_ADDR ((long)(ftrace_caller)) 15#define CALL_ADDR ((long)(ftrace_call))
15#define STUB_ADDR ((long)(ftrace_stub)) 16#define STUB_ADDR ((long)(ftrace_stub))
17#define GRAPH_ADDR ((long)(ftrace_graph_call))
18#define CALLER_ADDR ((long)(ftrace_caller))
16 19
17#define MCOUNT_INSN_OFFSET ((STUB_ADDR - CALLER_ADDR) >> 1) 20#define MCOUNT_INSN_OFFSET ((STUB_ADDR - CALL_ADDR) - 4)
21#define GRAPH_INSN_OFFSET ((CALLER_ADDR - GRAPH_ADDR) - 4)
18 22
19struct dyn_arch_ftrace { 23struct dyn_arch_ftrace {
20 /* No extra data needed on sh */ 24 /* No extra data needed on sh */
diff --git a/arch/sh/include/asm/hardirq.h b/arch/sh/include/asm/hardirq.h
index 715ee237fc7..a5be4afa790 100644
--- a/arch/sh/include/asm/hardirq.h
+++ b/arch/sh/include/asm/hardirq.h
@@ -1,16 +1,9 @@
1#ifndef __ASM_SH_HARDIRQ_H 1#ifndef __ASM_SH_HARDIRQ_H
2#define __ASM_SH_HARDIRQ_H 2#define __ASM_SH_HARDIRQ_H
3 3
4#include <linux/threads.h>
5#include <linux/irq.h>
6
7/* entry.S is sensitive to the offsets of these fields */
8typedef struct {
9 unsigned int __softirq_pending;
10} ____cacheline_aligned irq_cpustat_t;
11
12#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
13
14extern void ack_bad_irq(unsigned int irq); 4extern void ack_bad_irq(unsigned int irq);
5#define ack_bad_irq ack_bad_irq
6
7#include <asm-generic/hardirq.h>
15 8
16#endif /* __ASM_SH_HARDIRQ_H */ 9#endif /* __ASM_SH_HARDIRQ_H */
diff --git a/arch/sh/include/asm/heartbeat.h b/arch/sh/include/asm/heartbeat.h
index 724a43ed245..caaafe5a3ef 100644
--- a/arch/sh/include/asm/heartbeat.h
+++ b/arch/sh/include/asm/heartbeat.h
@@ -11,6 +11,7 @@ struct heartbeat_data {
11 unsigned int nr_bits; 11 unsigned int nr_bits;
12 struct timer_list timer; 12 struct timer_list timer;
13 unsigned int regsize; 13 unsigned int regsize;
14 unsigned int mask;
14 unsigned long flags; 15 unsigned long flags;
15}; 16};
16 17
diff --git a/arch/sh/include/asm/hwblk.h b/arch/sh/include/asm/hwblk.h
new file mode 100644
index 00000000000..5d3ccae4202
--- /dev/null
+++ b/arch/sh/include/asm/hwblk.h
@@ -0,0 +1,72 @@
1#ifndef __ASM_SH_HWBLK_H
2#define __ASM_SH_HWBLK_H
3
4#include <asm/clock.h>
5#include <asm/io.h>
6
7#define HWBLK_CNT_USAGE 0
8#define HWBLK_CNT_IDLE 1
9#define HWBLK_CNT_DEVICES 2
10#define HWBLK_CNT_NR 3
11
12#define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */
13
14#define HWBLK_AREA(_flags, _parent) \
15{ \
16 .flags = _flags, \
17 .parent = _parent, \
18}
19
20struct hwblk_area {
21 int cnt[HWBLK_CNT_NR];
22 unsigned char parent;
23 unsigned char flags;
24};
25
26#define HWBLK(_mstp, _bit, _area) \
27{ \
28 .mstp = (void __iomem *)_mstp, \
29 .bit = _bit, \
30 .area = _area, \
31}
32
33struct hwblk {
34 void __iomem *mstp;
35 unsigned char bit;
36 unsigned char area;
37 int cnt[HWBLK_CNT_NR];
38};
39
40struct hwblk_info {
41 struct hwblk_area *areas;
42 int nr_areas;
43 struct hwblk *hwblks;
44 int nr_hwblks;
45};
46
47/* Should be defined by processor-specific code */
48int arch_hwblk_init(void);
49int arch_hwblk_sleep_mode(void);
50
51int hwblk_register(struct hwblk_info *info);
52int hwblk_init(void);
53
54void hwblk_enable(struct hwblk_info *info, int hwblk);
55void hwblk_disable(struct hwblk_info *info, int hwblk);
56
57void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt);
58void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt);
59
60/* allow clocks to enable and disable hardware blocks */
61#define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \
62{ \
63 .name = _name, \
64 .id = _id, \
65 .parent = _parent, \
66 .arch_flags = _hwblk, \
67 .flags = _flags, \
68}
69
70int sh_hwblk_clk_register(struct clk *clks, int nr);
71
72#endif /* __ASM_SH_HWBLK_H */
diff --git a/arch/sh/include/asm/io.h b/arch/sh/include/asm/io.h
index 25348141674..5be45ea4dfe 100644
--- a/arch/sh/include/asm/io.h
+++ b/arch/sh/include/asm/io.h
@@ -92,8 +92,12 @@
92 92
93static inline void ctrl_delay(void) 93static inline void ctrl_delay(void)
94{ 94{
95#ifdef P2SEG 95#ifdef CONFIG_CPU_SH4
96 __raw_readw(CCN_PVR);
97#elif defined(P2SEG)
96 __raw_readw(P2SEG); 98 __raw_readw(P2SEG);
99#else
100#error "Need a dummy address for delay"
97#endif 101#endif
98} 102}
99 103
@@ -146,6 +150,7 @@ __BUILD_MEMORY_STRING(q, u64)
146#define readl_relaxed(a) readl(a) 150#define readl_relaxed(a) readl(a)
147#define readq_relaxed(a) readq(a) 151#define readq_relaxed(a) readq(a)
148 152
153#ifndef CONFIG_GENERIC_IOMAP
149/* Simple MMIO */ 154/* Simple MMIO */
150#define ioread8(a) __raw_readb(a) 155#define ioread8(a) __raw_readb(a)
151#define ioread16(a) __raw_readw(a) 156#define ioread16(a) __raw_readw(a)
@@ -166,6 +171,15 @@ __BUILD_MEMORY_STRING(q, u64)
166#define iowrite8_rep(a, s, c) __raw_writesb((a), (s), (c)) 171#define iowrite8_rep(a, s, c) __raw_writesb((a), (s), (c))
167#define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c)) 172#define iowrite16_rep(a, s, c) __raw_writesw((a), (s), (c))
168#define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c)) 173#define iowrite32_rep(a, s, c) __raw_writesl((a), (s), (c))
174#endif
175
176#define mmio_insb(p,d,c) __raw_readsb(p,d,c)
177#define mmio_insw(p,d,c) __raw_readsw(p,d,c)
178#define mmio_insl(p,d,c) __raw_readsl(p,d,c)
179
180#define mmio_outsb(p,s,c) __raw_writesb(p,s,c)
181#define mmio_outsw(p,s,c) __raw_writesw(p,s,c)
182#define mmio_outsl(p,s,c) __raw_writesl(p,s,c)
169 183
170/* synco on SH-4A, otherwise a nop */ 184/* synco on SH-4A, otherwise a nop */
171#define mmiowb() wmb() 185#define mmiowb() wmb()
diff --git a/arch/sh/include/asm/kdebug.h b/arch/sh/include/asm/kdebug.h
index 0b9f896f203..985219f9759 100644
--- a/arch/sh/include/asm/kdebug.h
+++ b/arch/sh/include/asm/kdebug.h
@@ -4,6 +4,7 @@
4/* Grossly misnamed. */ 4/* Grossly misnamed. */
5enum die_val { 5enum die_val {
6 DIE_TRAP, 6 DIE_TRAP,
7 DIE_NMI,
7 DIE_OOPS, 8 DIE_OOPS,
8}; 9};
9 10
diff --git a/arch/sh/include/asm/kgdb.h b/arch/sh/include/asm/kgdb.h
index 72704ed725e..4235e228d92 100644
--- a/arch/sh/include/asm/kgdb.h
+++ b/arch/sh/include/asm/kgdb.h
@@ -30,9 +30,6 @@ static inline void arch_kgdb_breakpoint(void)
30 __asm__ __volatile__ ("trapa #0x3c\n"); 30 __asm__ __volatile__ ("trapa #0x3c\n");
31} 31}
32 32
33/* State info */
34extern char in_nmi; /* Debounce flag to prevent NMI reentry*/
35
36#define BUFMAX 2048 33#define BUFMAX 2048
37 34
38#define CACHE_FLUSH_IS_SAFE 1 35#define CACHE_FLUSH_IS_SAFE 1
diff --git a/arch/sh/include/asm/lmb.h b/arch/sh/include/asm/lmb.h
new file mode 100644
index 00000000000..9b437f657ff
--- /dev/null
+++ b/arch/sh/include/asm/lmb.h
@@ -0,0 +1,6 @@
1#ifndef __ASM_SH_LMB_H
2#define __ASM_SH_LMB_H
3
4#define LMB_REAL_LIMIT 0
5
6#endif /* __ASM_SH_LMB_H */
diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu_context.h
index 67d8946db19..41080b173a7 100644
--- a/arch/sh/include/asm/mmu_context.h
+++ b/arch/sh/include/asm/mmu_context.h
@@ -69,7 +69,7 @@ static inline void get_mmu_context(struct mm_struct *mm, unsigned int cpu)
69 * We exhaust ASID of this version. 69 * We exhaust ASID of this version.
70 * Flush all TLB and start new cycle. 70 * Flush all TLB and start new cycle.
71 */ 71 */
72 flush_tlb_all(); 72 local_flush_tlb_all();
73 73
74#ifdef CONFIG_SUPERH64 74#ifdef CONFIG_SUPERH64
75 /* 75 /*
diff --git a/arch/sh/include/asm/page.h b/arch/sh/include/asm/page.h
index 49592c780a6..81bffc0d686 100644
--- a/arch/sh/include/asm/page.h
+++ b/arch/sh/include/asm/page.h
@@ -50,26 +50,24 @@ extern unsigned long shm_align_mask;
50extern unsigned long max_low_pfn, min_low_pfn; 50extern unsigned long max_low_pfn, min_low_pfn;
51extern unsigned long memory_start, memory_end; 51extern unsigned long memory_start, memory_end;
52 52
53extern void clear_page(void *to); 53static inline unsigned long
54pages_do_alias(unsigned long addr1, unsigned long addr2)
55{
56 return (addr1 ^ addr2) & shm_align_mask;
57}
58
59
60#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
54extern void copy_page(void *to, void *from); 61extern void copy_page(void *to, void *from);
55 62
56#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \
57 (defined(CONFIG_CPU_SH5) || defined(CONFIG_CPU_SH4) || \
58 defined(CONFIG_SH7705_CACHE_32KB))
59struct page; 63struct page;
60struct vm_area_struct; 64struct vm_area_struct;
61extern void clear_user_page(void *to, unsigned long address, struct page *page); 65
62extern void copy_user_page(void *to, void *from, unsigned long address,
63 struct page *page);
64#if defined(CONFIG_CPU_SH4)
65extern void copy_user_highpage(struct page *to, struct page *from, 66extern void copy_user_highpage(struct page *to, struct page *from,
66 unsigned long vaddr, struct vm_area_struct *vma); 67 unsigned long vaddr, struct vm_area_struct *vma);
67#define __HAVE_ARCH_COPY_USER_HIGHPAGE 68#define __HAVE_ARCH_COPY_USER_HIGHPAGE
68#endif 69extern void clear_user_highpage(struct page *page, unsigned long vaddr);
69#else 70#define clear_user_highpage clear_user_highpage
70#define clear_user_page(page, vaddr, pg) clear_page(page)
71#define copy_user_page(to, from, vaddr, pg) copy_page(to, from)
72#endif
73 71
74/* 72/*
75 * These are used to make use of C type-checking.. 73 * These are used to make use of C type-checking..
diff --git a/arch/sh/include/asm/pgtable.h b/arch/sh/include/asm/pgtable.h
index 2a011b18090..4f3efa7d5a6 100644
--- a/arch/sh/include/asm/pgtable.h
+++ b/arch/sh/include/asm/pgtable.h
@@ -36,6 +36,12 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
36#define NEFF_SIGN (1LL << (NEFF - 1)) 36#define NEFF_SIGN (1LL << (NEFF - 1))
37#define NEFF_MASK (-1LL << NEFF) 37#define NEFF_MASK (-1LL << NEFF)
38 38
39static inline unsigned long long neff_sign_extend(unsigned long val)
40{
41 unsigned long long extended = val;
42 return (extended & NEFF_SIGN) ? (extended | NEFF_MASK) : extended;
43}
44
39#ifdef CONFIG_29BIT 45#ifdef CONFIG_29BIT
40#define NPHYS 29 46#define NPHYS 29
41#else 47#else
@@ -133,27 +139,25 @@ typedef pte_t *pte_addr_t;
133 */ 139 */
134#define pgtable_cache_init() do { } while (0) 140#define pgtable_cache_init() do { } while (0)
135 141
136#if !defined(CONFIG_CACHE_OFF) && (defined(CONFIG_CPU_SH4) || \
137 defined(CONFIG_SH7705_CACHE_32KB))
138struct mm_struct;
139#define __HAVE_ARCH_PTEP_GET_AND_CLEAR
140pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep);
141#endif
142
143struct vm_area_struct; 142struct vm_area_struct;
144extern void update_mmu_cache(struct vm_area_struct * vma, 143
145 unsigned long address, pte_t pte); 144extern void __update_cache(struct vm_area_struct *vma,
145 unsigned long address, pte_t pte);
146extern void __update_tlb(struct vm_area_struct *vma,
147 unsigned long address, pte_t pte);
148
149static inline void
150update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t pte)
151{
152 __update_cache(vma, address, pte);
153 __update_tlb(vma, address, pte);
154}
155
146extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; 156extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
147extern void paging_init(void); 157extern void paging_init(void);
148extern void page_table_range_init(unsigned long start, unsigned long end, 158extern void page_table_range_init(unsigned long start, unsigned long end,
149 pgd_t *pgd); 159 pgd_t *pgd);
150 160
151#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_CPU_SH4) && defined(CONFIG_MMU)
152extern void kmap_coherent_init(void);
153#else
154#define kmap_coherent_init() do { } while (0)
155#endif
156
157/* arch/sh/mm/mmap.c */ 161/* arch/sh/mm/mmap.c */
158#define HAVE_ARCH_UNMAPPED_AREA 162#define HAVE_ARCH_UNMAPPED_AREA
159#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN 163#define HAVE_ARCH_UNMAPPED_AREA_TOPDOWN
diff --git a/arch/sh/include/asm/pgtable_32.h b/arch/sh/include/asm/pgtable_32.h
index 72ea209195b..c0d359ce337 100644
--- a/arch/sh/include/asm/pgtable_32.h
+++ b/arch/sh/include/asm/pgtable_32.h
@@ -20,7 +20,7 @@
20 * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE. 20 * - Bit 9 is reserved by everyone and used by _PAGE_PROTNONE.
21 * 21 *
22 * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages. 22 * - Bits 10 and 11 are low bits of the PPN that are reserved on >= 4K pages.
23 * Bit 10 is used for _PAGE_ACCESSED, bit 11 remains unused. 23 * Bit 10 is used for _PAGE_ACCESSED, and bit 11 is used for _PAGE_SPECIAL.
24 * 24 *
25 * - On 29 bit platforms, bits 31 to 29 are used for the space attributes 25 * - On 29 bit platforms, bits 31 to 29 are used for the space attributes
26 * and timing control which (together with bit 0) are moved into the 26 * and timing control which (together with bit 0) are moved into the
@@ -52,6 +52,7 @@
52#define _PAGE_PROTNONE 0x200 /* software: if not present */ 52#define _PAGE_PROTNONE 0x200 /* software: if not present */
53#define _PAGE_ACCESSED 0x400 /* software: page referenced */ 53#define _PAGE_ACCESSED 0x400 /* software: page referenced */
54#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */ 54#define _PAGE_FILE _PAGE_WT /* software: pagecache or swap? */
55#define _PAGE_SPECIAL 0x800 /* software: special page */
55 56
56#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1) 57#define _PAGE_SZ_MASK (_PAGE_SZ0 | _PAGE_SZ1)
57#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER) 58#define _PAGE_PR_MASK (_PAGE_RW | _PAGE_USER)
@@ -86,6 +87,14 @@
86#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */ 87#define _PAGE_PCC_ATR8 0x60000000 /* Attribute Memory space, 8 bit bus */
87#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */ 88#define _PAGE_PCC_ATR16 0x60000001 /* Attribute Memory space, 6 bit bus */
88 89
90#ifndef CONFIG_X2TLB
91/* copy the ptea attributes */
92static inline unsigned long copy_ptea_attributes(unsigned long x)
93{
94 return ((x >> 28) & 0xe) | (x & 0x1);
95}
96#endif
97
89/* Mask which drops unused bits from the PTEL value */ 98/* Mask which drops unused bits from the PTEL value */
90#if defined(CONFIG_CPU_SH3) 99#if defined(CONFIG_CPU_SH3)
91#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \ 100#define _PAGE_CLEAR_FLAGS (_PAGE_PROTNONE | _PAGE_ACCESSED| \
@@ -148,8 +157,12 @@
148# define _PAGE_SZHUGE (_PAGE_FLAGS_HARD) 157# define _PAGE_SZHUGE (_PAGE_FLAGS_HARD)
149#endif 158#endif
150 159
160/*
161 * Mask of bits that are to be preserved accross pgprot changes.
162 */
151#define _PAGE_CHG_MASK \ 163#define _PAGE_CHG_MASK \
152 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | _PAGE_DIRTY) 164 (PTE_MASK | _PAGE_ACCESSED | _PAGE_CACHABLE | \
165 _PAGE_DIRTY | _PAGE_SPECIAL)
153 166
154#ifndef __ASSEMBLY__ 167#ifndef __ASSEMBLY__
155 168
@@ -328,7 +341,7 @@ static inline void set_pte(pte_t *ptep, pte_t pte)
328#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY) 341#define pte_dirty(pte) ((pte).pte_low & _PAGE_DIRTY)
329#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED) 342#define pte_young(pte) ((pte).pte_low & _PAGE_ACCESSED)
330#define pte_file(pte) ((pte).pte_low & _PAGE_FILE) 343#define pte_file(pte) ((pte).pte_low & _PAGE_FILE)
331#define pte_special(pte) (0) 344#define pte_special(pte) ((pte).pte_low & _PAGE_SPECIAL)
332 345
333#ifdef CONFIG_X2TLB 346#ifdef CONFIG_X2TLB
334#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE) 347#define pte_write(pte) ((pte).pte_high & _PAGE_EXT_USER_WRITE)
@@ -358,8 +371,9 @@ PTE_BIT_FUNC(low, mkclean, &= ~_PAGE_DIRTY);
358PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY); 371PTE_BIT_FUNC(low, mkdirty, |= _PAGE_DIRTY);
359PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED); 372PTE_BIT_FUNC(low, mkold, &= ~_PAGE_ACCESSED);
360PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED); 373PTE_BIT_FUNC(low, mkyoung, |= _PAGE_ACCESSED);
374PTE_BIT_FUNC(low, mkspecial, |= _PAGE_SPECIAL);
361 375
362static inline pte_t pte_mkspecial(pte_t pte) { return pte; } 376#define __HAVE_ARCH_PTE_SPECIAL
363 377
364/* 378/*
365 * Macro and implementation to make a page protection as uncachable. 379 * Macro and implementation to make a page protection as uncachable.
@@ -394,13 +408,19 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
394 408
395/* to find an entry in a page-table-directory. */ 409/* to find an entry in a page-table-directory. */
396#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) 410#define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
397#define pgd_offset(mm, address) ((mm)->pgd+pgd_index(address)) 411#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
412#define __pgd_offset(address) pgd_index(address)
398 413
399/* to find an entry in a kernel page-table-directory */ 414/* to find an entry in a kernel page-table-directory */
400#define pgd_offset_k(address) pgd_offset(&init_mm, address) 415#define pgd_offset_k(address) pgd_offset(&init_mm, address)
401 416
417#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
418#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
419
402/* Find an entry in the third-level page table.. */ 420/* Find an entry in the third-level page table.. */
403#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 421#define pte_index(address) ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
422#define __pte_offset(address) pte_index(address)
423
404#define pte_offset_kernel(dir, address) \ 424#define pte_offset_kernel(dir, address) \
405 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address)) 425 ((pte_t *) pmd_page_vaddr(*(dir)) + pte_index(address))
406#define pte_offset_map(dir, address) pte_offset_kernel(dir, address) 426#define pte_offset_map(dir, address) pte_offset_kernel(dir, address)
diff --git a/arch/sh/include/asm/pgtable_64.h b/arch/sh/include/asm/pgtable_64.h
index c78990cda55..17cdbecc3ad 100644
--- a/arch/sh/include/asm/pgtable_64.h
+++ b/arch/sh/include/asm/pgtable_64.h
@@ -60,6 +60,9 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
60/* To find an entry in a kernel PGD. */ 60/* To find an entry in a kernel PGD. */
61#define pgd_offset_k(address) pgd_offset(&init_mm, address) 61#define pgd_offset_k(address) pgd_offset(&init_mm, address)
62 62
63#define __pud_offset(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
64#define __pmd_offset(address) (((address) >> PMD_SHIFT) & (PTRS_PER_PMD-1))
65
63/* 66/*
64 * PMD level access routines. Same notes as above. 67 * PMD level access routines. Same notes as above.
65 */ 68 */
@@ -80,6 +83,8 @@ static __inline__ void pmd_set(pmd_t *pmdp,pte_t *ptep)
80#define pte_index(address) \ 83#define pte_index(address) \
81 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1)) 84 ((address >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
82 85
86#define __pte_offset(address) pte_index(address)
87
83#define pte_offset_kernel(dir, addr) \ 88#define pte_offset_kernel(dir, addr) \
84 ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr))) 89 ((pte_t *) ((pmd_val(*(dir))) & PAGE_MASK) + pte_index((addr)))
85 90
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index ff7daaf9a62..017e0c1807b 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -32,7 +32,7 @@ enum cpu_type {
32 32
33 /* SH-4A types */ 33 /* SH-4A types */
34 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786, 34 CPU_SH7763, CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SH7786,
35 CPU_SH7723, CPU_SH7724, CPU_SHX3, 35 CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SHX3,
36 36
37 /* SH4AL-DSP types */ 37 /* SH4AL-DSP types */
38 CPU_SH7343, CPU_SH7722, CPU_SH7366, 38 CPU_SH7343, CPU_SH7722, CPU_SH7366,
@@ -44,6 +44,17 @@ enum cpu_type {
44 CPU_SH_NONE 44 CPU_SH_NONE
45}; 45};
46 46
47enum cpu_family {
48 CPU_FAMILY_SH2,
49 CPU_FAMILY_SH2A,
50 CPU_FAMILY_SH3,
51 CPU_FAMILY_SH4,
52 CPU_FAMILY_SH4A,
53 CPU_FAMILY_SH4AL_DSP,
54 CPU_FAMILY_SH5,
55 CPU_FAMILY_UNKNOWN,
56};
57
47/* 58/*
48 * TLB information structure 59 * TLB information structure
49 * 60 *
@@ -61,7 +72,7 @@ struct tlb_info {
61}; 72};
62 73
63struct sh_cpuinfo { 74struct sh_cpuinfo {
64 unsigned int type; 75 unsigned int type, family;
65 int cut_major, cut_minor; 76 int cut_major, cut_minor;
66 unsigned long loops_per_jiffy; 77 unsigned long loops_per_jiffy;
67 unsigned long asid_cache; 78 unsigned long asid_cache;
diff --git a/arch/sh/include/asm/romimage-macros.h b/arch/sh/include/asm/romimage-macros.h
new file mode 100644
index 00000000000..ae17a150bb5
--- /dev/null
+++ b/arch/sh/include/asm/romimage-macros.h
@@ -0,0 +1,73 @@
1#ifndef __ROMIMAGE_MACRO_H
2#define __ROMIMAGE_MACRO_H
3
4/* The LIST command is used to include comments in the script */
5.macro LIST comment
6.endm
7
8/* The ED command is used to write a 32-bit word */
9.macro ED, addr, data
10 mov.l 1f, r1
11 mov.l 2f, r0
12 mov.l r0, @r1
13 bra 3f
14 nop
15 .align 2
161 : .long \addr
172 : .long \data
183 :
19.endm
20
21/* The EW command is used to write a 16-bit word */
22.macro EW, addr, data
23 mov.l 1f, r1
24 mov.l 2f, r0
25 mov.w r0, @r1
26 bra 3f
27 nop
28 .align 2
291 : .long \addr
302 : .long \data
313 :
32.endm
33
34/* The EB command is used to write an 8-bit word */
35.macro EB, addr, data
36 mov.l 1f, r1
37 mov.l 2f, r0
38 mov.b r0, @r1
39 bra 3f
40 nop
41 .align 2
421 : .long \addr
432 : .long \data
443 :
45.endm
46
47/* The WAIT command is used to delay the execution */
48.macro WAIT, time
49 mov.l 2f, r3
501 :
51 nop
52 tst r3, r3
53 bf/s 1b
54 dt r3
55 bra 3f
56 nop
57 .align 2
582 : .long \time * 100
593 :
60.endm
61
62/* The DD command is used to read a 32-bit word */
63.macro DD, addr, addr2, nr
64 mov.l 1f, r1
65 mov.l @r1, r0
66 bra 2f
67 nop
68 .align 2
691 : .long \addr
702 :
71.endm
72
73#endif /* __ROMIMAGE_MACRO_H */
diff --git a/arch/sh/include/asm/sections.h b/arch/sh/include/asm/sections.h
index 01a4076a371..a78701da775 100644
--- a/arch/sh/include/asm/sections.h
+++ b/arch/sh/include/asm/sections.h
@@ -7,6 +7,7 @@ extern void __nosave_begin, __nosave_end;
7extern long __machvec_start, __machvec_end; 7extern long __machvec_start, __machvec_end;
8extern char __uncached_start, __uncached_end; 8extern char __uncached_start, __uncached_end;
9extern char _ebss[]; 9extern char _ebss[];
10extern char __start_eh_frame[], __stop_eh_frame[];
10 11
11#endif /* __ASM_SH_SECTIONS_H */ 12#endif /* __ASM_SH_SECTIONS_H */
12 13
diff --git a/arch/sh/include/asm/sh_keysc.h b/arch/sh/include/asm/sh_keysc.h
index b5a4dd5a972..4a65b1e40ea 100644
--- a/arch/sh/include/asm/sh_keysc.h
+++ b/arch/sh/include/asm/sh_keysc.h
@@ -7,6 +7,7 @@ struct sh_keysc_info {
7 enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode; 7 enum { SH_KEYSC_MODE_1, SH_KEYSC_MODE_2, SH_KEYSC_MODE_3 } mode;
8 int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */ 8 int scan_timing; /* 0 -> 7, see KYCR1, SCN[2:0] */
9 int delay; 9 int delay;
10 int kycr2_delay;
10 int keycodes[SH_KEYSC_MAXKEYS]; 11 int keycodes[SH_KEYSC_MAXKEYS];
11}; 12};
12 13
diff --git a/arch/sh/include/asm/stacktrace.h b/arch/sh/include/asm/stacktrace.h
new file mode 100644
index 00000000000..79701821371
--- /dev/null
+++ b/arch/sh/include/asm/stacktrace.h
@@ -0,0 +1,25 @@
1/*
2 * Copyright (C) 2009 Matt Fleming
3 *
4 * Based on:
5 * The x86 implementation - arch/x86/include/asm/stacktrace.h
6 */
7#ifndef _ASM_SH_STACKTRACE_H
8#define _ASM_SH_STACKTRACE_H
9
10/* Generic stack tracer with callbacks */
11
12struct stacktrace_ops {
13 void (*warning)(void *data, char *msg);
14 /* msg must contain %s for the symbol */
15 void (*warning_symbol)(void *data, char *msg, unsigned long symbol);
16 void (*address)(void *data, unsigned long address, int reliable);
17 /* On negative return stop dumping */
18 int (*stack)(void *data, char *name);
19};
20
21void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
22 unsigned long *stack,
23 const struct stacktrace_ops *ops, void *data);
24
25#endif /* _ASM_SH_STACKTRACE_H */
diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h
index b1b995370e7..5c8ea28ff7a 100644
--- a/arch/sh/include/asm/suspend.h
+++ b/arch/sh/include/asm/suspend.h
@@ -10,6 +10,15 @@ struct swsusp_arch_regs {
10 struct pt_regs user_regs; 10 struct pt_regs user_regs;
11 unsigned long bank1_regs[8]; 11 unsigned long bank1_regs[8];
12}; 12};
13
14void sh_mobile_call_standby(unsigned long mode);
15
16#ifdef CONFIG_CPU_IDLE
17void sh_mobile_setup_cpuidle(void);
18#else
19static inline void sh_mobile_setup_cpuidle(void) {}
20#endif
21
13#endif 22#endif
14 23
15/* flags passed to assembly suspend code */ 24/* flags passed to assembly suspend code */
diff --git a/arch/sh/include/asm/syscall_32.h b/arch/sh/include/asm/syscall_32.h
index 6f83f2cc45c..7d80df4f09c 100644
--- a/arch/sh/include/asm/syscall_32.h
+++ b/arch/sh/include/asm/syscall_32.h
@@ -65,6 +65,7 @@ static inline void syscall_get_arguments(struct task_struct *task,
65 case 3: args[2] = regs->regs[6]; 65 case 3: args[2] = regs->regs[6];
66 case 2: args[1] = regs->regs[5]; 66 case 2: args[1] = regs->regs[5];
67 case 1: args[0] = regs->regs[4]; 67 case 1: args[0] = regs->regs[4];
68 case 0:
68 break; 69 break;
69 default: 70 default:
70 BUG(); 71 BUG();
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index ab79e1f4fbe..b5c5acdc8c0 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -14,18 +14,6 @@
14 14
15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */ 15#define AT_VECTOR_SIZE_ARCH 5 /* entries in ARCH_DLINFO */
16 16
17#if defined(CONFIG_CPU_SH4A) || defined(CONFIG_CPU_SH5)
18#define __icbi() \
19{ \
20 unsigned long __addr; \
21 __addr = 0xa8000000; \
22 __asm__ __volatile__( \
23 "icbi %0\n\t" \
24 : /* no output */ \
25 : "m" (__m(__addr))); \
26}
27#endif
28
29/* 17/*
30 * A brief note on ctrl_barrier(), the control register write barrier. 18 * A brief note on ctrl_barrier(), the control register write barrier.
31 * 19 *
@@ -44,7 +32,7 @@
44#define mb() __asm__ __volatile__ ("synco": : :"memory") 32#define mb() __asm__ __volatile__ ("synco": : :"memory")
45#define rmb() mb() 33#define rmb() mb()
46#define wmb() __asm__ __volatile__ ("synco": : :"memory") 34#define wmb() __asm__ __volatile__ ("synco": : :"memory")
47#define ctrl_barrier() __icbi() 35#define ctrl_barrier() __icbi(0xa8000000)
48#define read_barrier_depends() do { } while(0) 36#define read_barrier_depends() do { } while(0)
49#else 37#else
50#define mb() __asm__ __volatile__ ("": : :"memory") 38#define mb() __asm__ __volatile__ ("": : :"memory")
@@ -181,6 +169,11 @@ BUILD_TRAP_HANDLER(breakpoint);
181BUILD_TRAP_HANDLER(singlestep); 169BUILD_TRAP_HANDLER(singlestep);
182BUILD_TRAP_HANDLER(fpu_error); 170BUILD_TRAP_HANDLER(fpu_error);
183BUILD_TRAP_HANDLER(fpu_state_restore); 171BUILD_TRAP_HANDLER(fpu_state_restore);
172BUILD_TRAP_HANDLER(nmi);
173
174#ifdef CONFIG_BUG
175extern void handle_BUG(struct pt_regs *);
176#endif
184 177
185#define arch_align_stack(x) (x) 178#define arch_align_stack(x) (x)
186 179
diff --git a/arch/sh/include/asm/system_32.h b/arch/sh/include/asm/system_32.h
index 6c68a51f1cc..607d413f616 100644
--- a/arch/sh/include/asm/system_32.h
+++ b/arch/sh/include/asm/system_32.h
@@ -14,12 +14,12 @@ do { \
14 (u32 *)&tsk->thread.dsp_status; \ 14 (u32 *)&tsk->thread.dsp_status; \
15 __asm__ __volatile__ ( \ 15 __asm__ __volatile__ ( \
16 ".balign 4\n\t" \ 16 ".balign 4\n\t" \
17 "movs.l @r2+, a0\n\t" \
17 "movs.l @r2+, a1\n\t" \ 18 "movs.l @r2+, a1\n\t" \
18 "movs.l @r2+, a0g\n\t" \ 19 "movs.l @r2+, a0g\n\t" \
19 "movs.l @r2+, a1g\n\t" \ 20 "movs.l @r2+, a1g\n\t" \
20 "movs.l @r2+, m0\n\t" \ 21 "movs.l @r2+, m0\n\t" \
21 "movs.l @r2+, m1\n\t" \ 22 "movs.l @r2+, m1\n\t" \
22 "movs.l @r2+, a0\n\t" \
23 "movs.l @r2+, x0\n\t" \ 23 "movs.l @r2+, x0\n\t" \
24 "movs.l @r2+, x1\n\t" \ 24 "movs.l @r2+, x1\n\t" \
25 "movs.l @r2+, y0\n\t" \ 25 "movs.l @r2+, y0\n\t" \
@@ -39,20 +39,20 @@ do { \
39 \ 39 \
40 __asm__ __volatile__ ( \ 40 __asm__ __volatile__ ( \
41 ".balign 4\n\t" \ 41 ".balign 4\n\t" \
42 "stc.l mod, @-r2\n\t" \ 42 "stc.l mod, @-r2\n\t" \
43 "stc.l re, @-r2\n\t" \ 43 "stc.l re, @-r2\n\t" \
44 "stc.l rs, @-r2\n\t" \ 44 "stc.l rs, @-r2\n\t" \
45 "sts.l dsr, @-r2\n\t" \ 45 "sts.l dsr, @-r2\n\t" \
46 "sts.l y1, @-r2\n\t" \ 46 "movs.l y1, @-r2\n\t" \
47 "sts.l y0, @-r2\n\t" \ 47 "movs.l y0, @-r2\n\t" \
48 "sts.l x1, @-r2\n\t" \ 48 "movs.l x1, @-r2\n\t" \
49 "sts.l x0, @-r2\n\t" \ 49 "movs.l x0, @-r2\n\t" \
50 "sts.l a0, @-r2\n\t" \ 50 "movs.l m1, @-r2\n\t" \
51 ".word 0xf653 ! movs.l a1, @-r2\n\t" \ 51 "movs.l m0, @-r2\n\t" \
52 ".word 0xf6f3 ! movs.l a0g, @-r2\n\t" \ 52 "movs.l a1g, @-r2\n\t" \
53 ".word 0xf6d3 ! movs.l a1g, @-r2\n\t" \ 53 "movs.l a0g, @-r2\n\t" \
54 ".word 0xf6c3 ! movs.l m0, @-r2\n\t" \ 54 "movs.l a1, @-r2\n\t" \
55 ".word 0xf6e3 ! movs.l m1, @-r2\n\t" \ 55 "movs.l a0, @-r2\n\t" \
56 : : "r" (__ts2)); \ 56 : : "r" (__ts2)); \
57} while (0) 57} while (0)
58 58
@@ -63,6 +63,16 @@ do { \
63#define __restore_dsp(tsk) do { } while (0) 63#define __restore_dsp(tsk) do { } while (0)
64#endif 64#endif
65 65
66#if defined(CONFIG_CPU_SH4A)
67#define __icbi(addr) __asm__ __volatile__ ( "icbi @%0\n\t" : : "r" (addr))
68#else
69#define __icbi(addr) mb()
70#endif
71
72#define __ocbp(addr) __asm__ __volatile__ ( "ocbp @%0\n\t" : : "r" (addr))
73#define __ocbi(addr) __asm__ __volatile__ ( "ocbi @%0\n\t" : : "r" (addr))
74#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb @%0\n\t" : : "r" (addr))
75
66struct task_struct *__switch_to(struct task_struct *prev, 76struct task_struct *__switch_to(struct task_struct *prev,
67 struct task_struct *next); 77 struct task_struct *next);
68 78
@@ -198,8 +208,13 @@ do { \
198}) 208})
199#endif 209#endif
200 210
211static inline reg_size_t register_align(void *val)
212{
213 return (unsigned long)(signed long)val;
214}
215
201int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, 216int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
202 struct mem_access *ma); 217 struct mem_access *ma, int);
203 218
204asmlinkage void do_address_error(struct pt_regs *regs, 219asmlinkage void do_address_error(struct pt_regs *regs,
205 unsigned long writeaccess, 220 unsigned long writeaccess,
diff --git a/arch/sh/include/asm/system_64.h b/arch/sh/include/asm/system_64.h
index 943acf5ea07..8e4a03e7966 100644
--- a/arch/sh/include/asm/system_64.h
+++ b/arch/sh/include/asm/system_64.h
@@ -37,4 +37,14 @@ do { \
37#define jump_to_uncached() do { } while (0) 37#define jump_to_uncached() do { } while (0)
38#define back_to_cached() do { } while (0) 38#define back_to_cached() do { } while (0)
39 39
40#define __icbi(addr) __asm__ __volatile__ ( "icbi %0, 0\n\t" : : "r" (addr))
41#define __ocbp(addr) __asm__ __volatile__ ( "ocbp %0, 0\n\t" : : "r" (addr))
42#define __ocbi(addr) __asm__ __volatile__ ( "ocbi %0, 0\n\t" : : "r" (addr))
43#define __ocbwb(addr) __asm__ __volatile__ ( "ocbwb %0, 0\n\t" : : "r" (addr))
44
45static inline reg_size_t register_align(void *val)
46{
47 return (unsigned long long)(signed long long)(signed long)val;
48}
49
40#endif /* __ASM_SH_SYSTEM_64_H */ 50#endif /* __ASM_SH_SYSTEM_64_H */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index d570ac2e5cb..bdeb9d46d17 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -97,7 +97,7 @@ static inline struct thread_info *current_thread_info(void)
97 97
98extern struct thread_info *alloc_thread_info(struct task_struct *tsk); 98extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
99extern void free_thread_info(struct thread_info *ti); 99extern void free_thread_info(struct thread_info *ti);
100 100
101#endif /* THREAD_SHIFT < PAGE_SHIFT */ 101#endif /* THREAD_SHIFT < PAGE_SHIFT */
102 102
103#endif /* __ASSEMBLY__ */ 103#endif /* __ASSEMBLY__ */
@@ -116,6 +116,7 @@ extern void free_thread_info(struct thread_info *ti);
116#define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */ 116#define TIF_SYSCALL_AUDIT 5 /* syscall auditing active */
117#define TIF_SECCOMP 6 /* secure computing */ 117#define TIF_SECCOMP 6 /* secure computing */
118#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */ 118#define TIF_NOTIFY_RESUME 7 /* callback before returning to user */
119#define TIF_SYSCALL_TRACEPOINT 8 /* for ftrace syscall instrumentation */
119#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */ 120#define TIF_USEDFPU 16 /* FPU was used by this task this quantum (SMP) */
120#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */ 121#define TIF_POLLING_NRFLAG 17 /* true if poll_idle() is polling TIF_NEED_RESCHED */
121#define TIF_MEMDIE 18 122#define TIF_MEMDIE 18
@@ -129,25 +130,27 @@ extern void free_thread_info(struct thread_info *ti);
129#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT) 130#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
130#define _TIF_SECCOMP (1 << TIF_SECCOMP) 131#define _TIF_SECCOMP (1 << TIF_SECCOMP)
131#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) 132#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
133#define _TIF_SYSCALL_TRACEPOINT (1 << TIF_SYSCALL_TRACEPOINT)
132#define _TIF_USEDFPU (1 << TIF_USEDFPU) 134#define _TIF_USEDFPU (1 << TIF_USEDFPU)
133#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 135#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
134#define _TIF_FREEZE (1 << TIF_FREEZE) 136#define _TIF_FREEZE (1 << TIF_FREEZE)
135 137
136/* 138/*
137 * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within a byte, or we 139 * _TIF_ALLWORK_MASK and _TIF_WORK_MASK need to fit within 2 bytes, or we
138 * blow the tst immediate size constraints and need to fix up 140 * blow the tst immediate size constraints and need to fix up
139 * arch/sh/kernel/entry-common.S. 141 * arch/sh/kernel/entry-common.S.
140 */ 142 */
141 143
142/* work to do in syscall trace */ 144/* work to do in syscall trace */
143#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \ 145#define _TIF_WORK_SYSCALL_MASK (_TIF_SYSCALL_TRACE | _TIF_SINGLESTEP | \
144 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP) 146 _TIF_SYSCALL_AUDIT | _TIF_SECCOMP | \
147 _TIF_SYSCALL_TRACEPOINT)
145 148
146/* work to do on any return to u-space */ 149/* work to do on any return to u-space */
147#define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \ 150#define _TIF_ALLWORK_MASK (_TIF_SYSCALL_TRACE | _TIF_SIGPENDING | \
148 _TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \ 151 _TIF_NEED_RESCHED | _TIF_SYSCALL_AUDIT | \
149 _TIF_SINGLESTEP | _TIF_RESTORE_SIGMASK | \ 152 _TIF_SINGLESTEP | _TIF_RESTORE_SIGMASK | \
150 _TIF_NOTIFY_RESUME) 153 _TIF_NOTIFY_RESUME | _TIF_SYSCALL_TRACEPOINT)
151 154
152/* work to do on interrupt/exception return */ 155/* work to do on interrupt/exception return */
153#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \ 156#define _TIF_WORK_MASK (_TIF_ALLWORK_MASK & ~(_TIF_SYSCALL_TRACE | \
diff --git a/arch/sh/include/asm/types.h b/arch/sh/include/asm/types.h
index c7f3c94837d..f8421f7ad63 100644
--- a/arch/sh/include/asm/types.h
+++ b/arch/sh/include/asm/types.h
@@ -11,8 +11,10 @@
11 11
12#ifdef CONFIG_SUPERH32 12#ifdef CONFIG_SUPERH32
13typedef u16 insn_size_t; 13typedef u16 insn_size_t;
14typedef u32 reg_size_t;
14#else 15#else
15typedef u32 insn_size_t; 16typedef u32 insn_size_t;
17typedef u64 reg_size_t;
16#endif 18#endif
17 19
18#endif /* __ASSEMBLY__ */ 20#endif /* __ASSEMBLY__ */
diff --git a/arch/sh/include/asm/unistd_32.h b/arch/sh/include/asm/unistd_32.h
index 61d6ad93d78..925dd40d9d5 100644
--- a/arch/sh/include/asm/unistd_32.h
+++ b/arch/sh/include/asm/unistd_32.h
@@ -132,7 +132,7 @@
132#define __NR_clone 120 132#define __NR_clone 120
133#define __NR_setdomainname 121 133#define __NR_setdomainname 121
134#define __NR_uname 122 134#define __NR_uname 122
135#define __NR_modify_ldt 123 135#define __NR_cacheflush 123
136#define __NR_adjtimex 124 136#define __NR_adjtimex 124
137#define __NR_mprotect 125 137#define __NR_mprotect 125
138#define __NR_sigprocmask 126 138#define __NR_sigprocmask 126
diff --git a/arch/sh/include/asm/unistd_64.h b/arch/sh/include/asm/unistd_64.h
index a751699afda..2b84bc916bc 100644
--- a/arch/sh/include/asm/unistd_64.h
+++ b/arch/sh/include/asm/unistd_64.h
@@ -137,7 +137,7 @@
137#define __NR_clone 120 137#define __NR_clone 120
138#define __NR_setdomainname 121 138#define __NR_setdomainname 121
139#define __NR_uname 122 139#define __NR_uname 122
140#define __NR_modify_ldt 123 140#define __NR_cacheflush 123
141#define __NR_adjtimex 124 141#define __NR_adjtimex 124
142#define __NR_mprotect 125 142#define __NR_mprotect 125
143#define __NR_sigprocmask 126 143#define __NR_sigprocmask 126
diff --git a/arch/sh/include/asm/unwinder.h b/arch/sh/include/asm/unwinder.h
new file mode 100644
index 00000000000..1e65c07b3e1
--- /dev/null
+++ b/arch/sh/include/asm/unwinder.h
@@ -0,0 +1,31 @@
1#ifndef _LINUX_UNWINDER_H
2#define _LINUX_UNWINDER_H
3
4#include <asm/stacktrace.h>
5
6struct unwinder {
7 const char *name;
8 struct list_head list;
9 int rating;
10 void (*dump)(struct task_struct *, struct pt_regs *,
11 unsigned long *, const struct stacktrace_ops *, void *);
12};
13
14extern int unwinder_init(void);
15extern int unwinder_register(struct unwinder *);
16
17extern void unwind_stack(struct task_struct *, struct pt_regs *,
18 unsigned long *, const struct stacktrace_ops *,
19 void *);
20
21extern void stack_reader_dump(struct task_struct *, struct pt_regs *,
22 unsigned long *, const struct stacktrace_ops *,
23 void *);
24
25/*
26 * Used by fault handling code to signal to the unwinder code that it
27 * should switch to a different unwinder.
28 */
29extern int unwinder_faulted;
30
31#endif /* _LINUX_UNWINDER_H */
diff --git a/arch/sh/include/asm/vmlinux.lds.h b/arch/sh/include/asm/vmlinux.lds.h
new file mode 100644
index 00000000000..244ec4ad9a7
--- /dev/null
+++ b/arch/sh/include/asm/vmlinux.lds.h
@@ -0,0 +1,17 @@
1#ifndef __ASM_SH_VMLINUX_LDS_H
2#define __ASM_SH_VMLINUX_LDS_H
3
4#include <asm-generic/vmlinux.lds.h>
5
6#ifdef CONFIG_DWARF_UNWINDER
7#define DWARF_EH_FRAME \
8 .eh_frame : AT(ADDR(.eh_frame) - LOAD_OFFSET) { \
9 VMLINUX_SYMBOL(__start_eh_frame) = .; \
10 *(.eh_frame) \
11 VMLINUX_SYMBOL(__stop_eh_frame) = .; \
12 }
13#else
14#define DWARF_EH_FRAME
15#endif
16
17#endif /* __ASM_SH_VMLINUX_LDS_H */
diff --git a/arch/sh/include/asm/watchdog.h b/arch/sh/include/asm/watchdog.h
index f024fed00a7..2fe7cee9e43 100644
--- a/arch/sh/include/asm/watchdog.h
+++ b/arch/sh/include/asm/watchdog.h
@@ -13,10 +13,18 @@
13#ifdef __KERNEL__ 13#ifdef __KERNEL__
14 14
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/io.h>
17
18#define WTCNT_HIGH 0x5a
19#define WTCSR_HIGH 0xa5
20
21#define WTCSR_CKS2 0x04
22#define WTCSR_CKS1 0x02
23#define WTCSR_CKS0 0x01
24
16#include <cpu/watchdog.h> 25#include <cpu/watchdog.h>
17#include <asm/io.h>
18 26
19/* 27/*
20 * See cpu-sh2/watchdog.h for explanation of this stupidity.. 28 * See cpu-sh2/watchdog.h for explanation of this stupidity..
21 */ 29 */
22#ifndef WTCNT_R 30#ifndef WTCNT_R
@@ -27,13 +35,6 @@
27# define WTCSR_R WTCSR 35# define WTCSR_R WTCSR
28#endif 36#endif
29 37
30#define WTCNT_HIGH 0x5a
31#define WTCSR_HIGH 0xa5
32
33#define WTCSR_CKS2 0x04
34#define WTCSR_CKS1 0x02
35#define WTCSR_CKS0 0x01
36
37/* 38/*
38 * CKS0-2 supports a number of clock division ratios. At the time the watchdog 39 * CKS0-2 supports a number of clock division ratios. At the time the watchdog
39 * is enabled, it defaults to a 41 usec overflow period .. we overload this to 40 * is enabled, it defaults to a 41 usec overflow period .. we overload this to
diff --git a/arch/sh/include/cpu-common/cpu/cacheflush.h b/arch/sh/include/cpu-common/cpu/cacheflush.h
deleted file mode 100644
index c3db00b7360..00000000000
--- a/arch/sh/include/cpu-common/cpu/cacheflush.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh2/cacheflush.h
3 *
4 * Copyright (C) 2003 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH2_CACHEFLUSH_H
11#define __ASM_CPU_SH2_CACHEFLUSH_H
12
13/*
14 * Cache flushing:
15 *
16 * - flush_cache_all() flushes entire cache
17 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
18 * - flush_cache_dup mm(mm) handles cache flushing when forking
19 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
20 * - flush_cache_range(vma, start, end) flushes a range of pages
21 *
22 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
23 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
24 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
25 *
26 * Caches are indexed (effectively) by physical address on SH-2, so
27 * we don't need them.
28 */
29#define flush_cache_all() do { } while (0)
30#define flush_cache_mm(mm) do { } while (0)
31#define flush_cache_dup_mm(mm) do { } while (0)
32#define flush_cache_range(vma, start, end) do { } while (0)
33#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
34#define flush_dcache_page(page) do { } while (0)
35#define flush_dcache_mmap_lock(mapping) do { } while (0)
36#define flush_dcache_mmap_unlock(mapping) do { } while (0)
37#define flush_icache_range(start, end) do { } while (0)
38#define flush_icache_page(vma,pg) do { } while (0)
39#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
40#define flush_cache_sigtramp(vaddr) do { } while (0)
41
42#define p3_cache_init() do { } while (0)
43
44#endif /* __ASM_CPU_SH2_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh2a/cpu/cacheflush.h b/arch/sh/include/cpu-sh2a/cpu/cacheflush.h
deleted file mode 100644
index 3d3b9205d2a..00000000000
--- a/arch/sh/include/cpu-sh2a/cpu/cacheflush.h
+++ /dev/null
@@ -1,34 +0,0 @@
1#ifndef __ASM_CPU_SH2A_CACHEFLUSH_H
2#define __ASM_CPU_SH2A_CACHEFLUSH_H
3
4/*
5 * Cache flushing:
6 *
7 * - flush_cache_all() flushes entire cache
8 * - flush_cache_mm(mm) flushes the specified mm context's cache lines
9 * - flush_cache_dup mm(mm) handles cache flushing when forking
10 * - flush_cache_page(mm, vmaddr, pfn) flushes a single page
11 * - flush_cache_range(vma, start, end) flushes a range of pages
12 *
13 * - flush_dcache_page(pg) flushes(wback&invalidates) a page for dcache
14 * - flush_icache_range(start, end) flushes(invalidates) a range for icache
15 * - flush_icache_page(vma, pg) flushes(invalidates) a page for icache
16 *
17 * Caches are indexed (effectively) by physical address on SH-2, so
18 * we don't need them.
19 */
20#define flush_cache_all() do { } while (0)
21#define flush_cache_mm(mm) do { } while (0)
22#define flush_cache_dup_mm(mm) do { } while (0)
23#define flush_cache_range(vma, start, end) do { } while (0)
24#define flush_cache_page(vma, vmaddr, pfn) do { } while (0)
25#define flush_dcache_page(page) do { } while (0)
26#define flush_dcache_mmap_lock(mapping) do { } while (0)
27#define flush_dcache_mmap_unlock(mapping) do { } while (0)
28void flush_icache_range(unsigned long start, unsigned long end);
29#define flush_icache_page(vma,pg) do { } while (0)
30#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
31#define flush_cache_sigtramp(vaddr) do { } while (0)
32
33#define p3_cache_init() do { } while (0)
34#endif /* __ASM_CPU_SH2A_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh3/cpu/cacheflush.h b/arch/sh/include/cpu-sh3/cpu/cacheflush.h
deleted file mode 100644
index 1ac27aae670..00000000000
--- a/arch/sh/include/cpu-sh3/cpu/cacheflush.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh3/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#ifndef __ASM_CPU_SH3_CACHEFLUSH_H
11#define __ASM_CPU_SH3_CACHEFLUSH_H
12
13#if defined(CONFIG_SH7705_CACHE_32KB)
14/* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the
15 * SH4. Unlike the SH4 this is a unified cache so we need to do some work
16 * in mmap when 'exec'ing a new binary
17 */
18 /* 32KB cache, 4kb PAGE sizes need to check bit 12 */
19#define CACHE_ALIAS 0x00001000
20
21#define PG_mapped PG_arch_1
22
23void flush_cache_all(void);
24void flush_cache_mm(struct mm_struct *mm);
25#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
26void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
27 unsigned long end);
28void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
29void flush_dcache_page(struct page *pg);
30void flush_icache_range(unsigned long start, unsigned long end);
31void flush_icache_page(struct vm_area_struct *vma, struct page *page);
32
33#define flush_dcache_mmap_lock(mapping) do { } while (0)
34#define flush_dcache_mmap_unlock(mapping) do { } while (0)
35
36/* SH3 has unified cache so no special action needed here */
37#define flush_cache_sigtramp(vaddr) do { } while (0)
38#define flush_icache_user_range(vma,pg,adr,len) do { } while (0)
39
40#define p3_cache_init() do { } while (0)
41
42#else
43#include <cpu-common/cpu/cacheflush.h>
44#endif
45
46#endif /* __ASM_CPU_SH3_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh4/cpu/cacheflush.h b/arch/sh/include/cpu-sh4/cpu/cacheflush.h
deleted file mode 100644
index 065306d376e..00000000000
--- a/arch/sh/include/cpu-sh4/cpu/cacheflush.h
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * include/asm-sh/cpu-sh4/cacheflush.h
3 *
4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 Paul Mundt
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 */
11#ifndef __ASM_CPU_SH4_CACHEFLUSH_H
12#define __ASM_CPU_SH4_CACHEFLUSH_H
13
14/*
15 * Caches are broken on SH-4 (unless we use write-through
16 * caching; in which case they're only semi-broken),
17 * so we need them.
18 */
19void flush_cache_all(void);
20void flush_dcache_all(void);
21void flush_cache_mm(struct mm_struct *mm);
22#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
23void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
24 unsigned long end);
25void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
26 unsigned long pfn);
27void flush_dcache_page(struct page *pg);
28
29#define flush_dcache_mmap_lock(mapping) do { } while (0)
30#define flush_dcache_mmap_unlock(mapping) do { } while (0)
31
32void flush_icache_range(unsigned long start, unsigned long end);
33void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
34 unsigned long addr, int len);
35
36#define flush_icache_page(vma,pg) do { } while (0)
37
38/* Initialization of P3 area for copy_user_page */
39void p3_cache_init(void);
40
41#define PG_mapped PG_arch_1
42
43#endif /* __ASM_CPU_SH4_CACHEFLUSH_H */
diff --git a/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h b/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
index 0ed5178fed6..f0886bc880e 100644
--- a/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
+++ b/arch/sh/include/cpu-sh4/cpu/dma-sh4a.h
@@ -16,7 +16,8 @@
16#define DMAE0_IRQ 38 16#define DMAE0_IRQ 38
17#define SH_DMAC_BASE0 0xFF608020 17#define SH_DMAC_BASE0 0xFF608020
18#define SH_DMARS_BASE 0xFF609000 18#define SH_DMARS_BASE 0xFF609000
19#elif defined(CONFIG_CPU_SUBTYPE_SH7723) 19#elif defined(CONFIG_CPU_SUBTYPE_SH7723) || \
20 defined(CONFIG_CPU_SUBTYPE_SH7724)
20#define DMTE0_IRQ 48 /* DMAC0A*/ 21#define DMTE0_IRQ 48 /* DMAC0A*/
21#define DMTE4_IRQ 40 /* DMAC0B */ 22#define DMTE4_IRQ 40 /* DMAC0B */
22#define DMTE6_IRQ 42 23#define DMTE6_IRQ 42
diff --git a/arch/sh/include/cpu-sh4/cpu/freq.h b/arch/sh/include/cpu-sh4/cpu/freq.h
index ccf1d999db6..e1e90960ee9 100644
--- a/arch/sh/include/cpu-sh4/cpu/freq.h
+++ b/arch/sh/include/cpu-sh4/cpu/freq.h
@@ -22,6 +22,10 @@
22#define MSTPCR0 0xa4150030 22#define MSTPCR0 0xa4150030
23#define MSTPCR1 0xa4150034 23#define MSTPCR1 0xa4150034
24#define MSTPCR2 0xa4150038 24#define MSTPCR2 0xa4150038
25#elif defined(CONFIG_CPU_SUBTYPE_SH7757)
26#define FRQCR 0xffc80000
27#define OSCCR 0xffc80018
28#define PLLCR 0xffc80024
25#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \ 29#elif defined(CONFIG_CPU_SUBTYPE_SH7763) || \
26 defined(CONFIG_CPU_SUBTYPE_SH7780) 30 defined(CONFIG_CPU_SUBTYPE_SH7780)
27#define FRQCR 0xffc80000 31#define FRQCR 0xffc80000
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7722.h b/arch/sh/include/cpu-sh4/cpu/sh7722.h
index 738ea43c503..48560407cbe 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7722.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7722.h
@@ -221,4 +221,18 @@ enum {
221 GPIO_FN_KEYOUT3, GPIO_FN_KEYOUT4_IN6, GPIO_FN_KEYOUT5_IN5, 221 GPIO_FN_KEYOUT3, GPIO_FN_KEYOUT4_IN6, GPIO_FN_KEYOUT5_IN5,
222}; 222};
223 223
224enum {
225 HWBLK_UNKNOWN = 0,
226 HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_URAM, HWBLK_XYMEM,
227 HWBLK_INTC, HWBLK_DMAC, HWBLK_SHYWAY, HWBLK_HUDI,
228 HWBLK_UBC, HWBLK_TMU, HWBLK_CMT, HWBLK_RWDT, HWBLK_FLCTL,
229 HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_SIO,
230 HWBLK_SIOF0, HWBLK_SIOF1, HWBLK_IIC, HWBLK_RTC,
231 HWBLK_TPU, HWBLK_IRDA, HWBLK_SDHI, HWBLK_SIM, HWBLK_KEYSC,
232 HWBLK_TSIF, HWBLK_USBF, HWBLK_2DG, HWBLK_SIU, HWBLK_VOU,
233 HWBLK_JPU, HWBLK_BEU, HWBLK_CEU, HWBLK_VEU, HWBLK_VPU,
234 HWBLK_LCDC,
235 HWBLK_NR,
236};
237
224#endif /* __ASM_SH7722_H__ */ 238#endif /* __ASM_SH7722_H__ */
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7723.h b/arch/sh/include/cpu-sh4/cpu/sh7723.h
index 14c8ca93678..9b36fae7232 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7723.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7723.h
@@ -265,4 +265,21 @@ enum {
265 GPIO_FN_IDEA1, GPIO_FN_IDEA0, 265 GPIO_FN_IDEA1, GPIO_FN_IDEA0,
266}; 266};
267 267
268enum {
269 HWBLK_UNKNOWN = 0,
270 HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_L2C, HWBLK_ILMEM, HWBLK_FPU,
271 HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
272 HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC, HWBLK_SUBC,
273 HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
274 HWBLK_FLCTL,
275 HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2,
276 HWBLK_SCIF3, HWBLK_SCIF4, HWBLK_SCIF5,
277 HWBLK_MSIOF0, HWBLK_MSIOF1, HWBLK_MERAM, HWBLK_IIC, HWBLK_RTC,
278 HWBLK_ATAPI, HWBLK_ADC, HWBLK_TPU, HWBLK_IRDA, HWBLK_TSIF, HWBLK_ICB,
279 HWBLK_SDHI0, HWBLK_SDHI1, HWBLK_KEYSC, HWBLK_USB,
280 HWBLK_2DG, HWBLK_SIU, HWBLK_VEU2H1, HWBLK_VOU, HWBLK_BEU, HWBLK_CEU,
281 HWBLK_VEU2H0, HWBLK_VPU, HWBLK_LCDC,
282 HWBLK_NR,
283};
284
268#endif /* __ASM_SH7723_H__ */ 285#endif /* __ASM_SH7723_H__ */
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7724.h b/arch/sh/include/cpu-sh4/cpu/sh7724.h
index 66fd1184359..0cd1f71a111 100644
--- a/arch/sh/include/cpu-sh4/cpu/sh7724.h
+++ b/arch/sh/include/cpu-sh4/cpu/sh7724.h
@@ -266,4 +266,21 @@ enum {
266 GPIO_FN_INTC_IRQ1, GPIO_FN_INTC_IRQ0, 266 GPIO_FN_INTC_IRQ1, GPIO_FN_INTC_IRQ0,
267}; 267};
268 268
269enum {
270 HWBLK_UNKNOWN = 0,
271 HWBLK_TLB, HWBLK_IC, HWBLK_OC, HWBLK_RSMEM, HWBLK_ILMEM, HWBLK_L2C,
272 HWBLK_FPU, HWBLK_INTC, HWBLK_DMAC0, HWBLK_SHYWAY,
273 HWBLK_HUDI, HWBLK_DBG, HWBLK_UBC,
274 HWBLK_TMU0, HWBLK_CMT, HWBLK_RWDT, HWBLK_DMAC1, HWBLK_TMU1,
275 HWBLK_SCIF0, HWBLK_SCIF1, HWBLK_SCIF2, HWBLK_SCIF3,
276 HWBLK_SCIF4, HWBLK_SCIF5, HWBLK_MSIOF0, HWBLK_MSIOF1,
277 HWBLK_KEYSC, HWBLK_RTC, HWBLK_IIC0, HWBLK_IIC1,
278 HWBLK_MMC, HWBLK_ETHER, HWBLK_ATAPI, HWBLK_TPU, HWBLK_IRDA,
279 HWBLK_TSIF, HWBLK_USB1, HWBLK_USB0, HWBLK_2DG,
280 HWBLK_SDHI0, HWBLK_SDHI1, HWBLK_VEU1, HWBLK_CEU1, HWBLK_BEU1,
281 HWBLK_2DDMAC, HWBLK_SPU, HWBLK_JPU, HWBLK_VOU,
282 HWBLK_BEU0, HWBLK_CEU0, HWBLK_VEU0, HWBLK_VPU, HWBLK_LCDC,
283 HWBLK_NR,
284};
285
269#endif /* __ASM_SH7724_H__ */ 286#endif /* __ASM_SH7724_H__ */
diff --git a/arch/sh/include/cpu-sh4/cpu/sh7757.h b/arch/sh/include/cpu-sh4/cpu/sh7757.h
new file mode 100644
index 00000000000..f4d267efad7
--- /dev/null
+++ b/arch/sh/include/cpu-sh4/cpu/sh7757.h
@@ -0,0 +1,243 @@
1#ifndef __ASM_SH7757_H__
2#define __ASM_SH7757_H__
3
4enum {
5 /* PTA */
6 GPIO_PTA7, GPIO_PTA6, GPIO_PTA5, GPIO_PTA4,
7 GPIO_PTA3, GPIO_PTA2, GPIO_PTA1, GPIO_PTA0,
8
9 /* PTB */
10 GPIO_PTB7, GPIO_PTB6, GPIO_PTB5, GPIO_PTB4,
11 GPIO_PTB3, GPIO_PTB2, GPIO_PTB1, GPIO_PTB0,
12
13 /* PTC */
14 GPIO_PTC7, GPIO_PTC6, GPIO_PTC5, GPIO_PTC4,
15 GPIO_PTC3, GPIO_PTC2, GPIO_PTC1, GPIO_PTC0,
16
17 /* PTD */
18 GPIO_PTD7, GPIO_PTD6, GPIO_PTD5, GPIO_PTD4,
19 GPIO_PTD3, GPIO_PTD2, GPIO_PTD1, GPIO_PTD0,
20
21 /* PTE */
22 GPIO_PTE7, GPIO_PTE6, GPIO_PTE5, GPIO_PTE4,
23 GPIO_PTE3, GPIO_PTE2, GPIO_PTE1, GPIO_PTE0,
24
25 /* PTF */
26 GPIO_PTF7, GPIO_PTF6, GPIO_PTF5, GPIO_PTF4,
27 GPIO_PTF3, GPIO_PTF2, GPIO_PTF1, GPIO_PTF0,
28
29 /* PTG */
30 GPIO_PTG7, GPIO_PTG6, GPIO_PTG5, GPIO_PTG4,
31 GPIO_PTG3, GPIO_PTG2, GPIO_PTG1, GPIO_PTG0,
32
33 /* PTH */
34 GPIO_PTH7, GPIO_PTH6, GPIO_PTH5, GPIO_PTH4,
35 GPIO_PTH3, GPIO_PTH2, GPIO_PTH1, GPIO_PTH0,
36
37 /* PTI */
38 GPIO_PTI7, GPIO_PTI6, GPIO_PTI5, GPIO_PTI4,
39 GPIO_PTI3, GPIO_PTI2, GPIO_PTI1, GPIO_PTI0,
40
41 /* PTJ */
42 GPIO_PTJ7, GPIO_PTJ6, GPIO_PTJ5, GPIO_PTJ4,
43 GPIO_PTJ3, GPIO_PTJ2, GPIO_PTJ1, GPIO_PTJ0,
44
45 /* PTK */
46 GPIO_PTK7, GPIO_PTK6, GPIO_PTK5, GPIO_PTK4,
47 GPIO_PTK3, GPIO_PTK2, GPIO_PTK1, GPIO_PTK0,
48
49 /* PTL */
50 GPIO_PTL7, GPIO_PTL6, GPIO_PTL5, GPIO_PTL4,
51 GPIO_PTL3, GPIO_PTL2, GPIO_PTL1, GPIO_PTL0,
52
53 /* PTM */
54 GPIO_PTM6, GPIO_PTM5, GPIO_PTM4,
55 GPIO_PTM3, GPIO_PTM2, GPIO_PTM1, GPIO_PTM0,
56
57 /* PTN */
58 GPIO_PTN7, GPIO_PTN6, GPIO_PTN5, GPIO_PTN4,
59 GPIO_PTN3, GPIO_PTN2, GPIO_PTN1, GPIO_PTN0,
60
61 /* PTO */
62 GPIO_PTO7, GPIO_PTO6, GPIO_PTO5, GPIO_PTO4,
63 GPIO_PTO3, GPIO_PTO2, GPIO_PTO1, GPIO_PTO0,
64
65 /* PTP */
66 GPIO_PTP6, GPIO_PTP5, GPIO_PTP4,
67 GPIO_PTP3, GPIO_PTP2, GPIO_PTP1, GPIO_PTP0,
68
69 /* PTQ */
70 GPIO_PTQ6, GPIO_PTQ5, GPIO_PTQ4,
71 GPIO_PTQ3, GPIO_PTQ2, GPIO_PTQ1, GPIO_PTQ0,
72
73 /* PTR */
74 GPIO_PTR7, GPIO_PTR6, GPIO_PTR5, GPIO_PTR4,
75 GPIO_PTR3, GPIO_PTR2, GPIO_PTR1, GPIO_PTR0,
76
77 /* PTS */
78 GPIO_PTS7, GPIO_PTS6, GPIO_PTS5, GPIO_PTS4,
79 GPIO_PTS3, GPIO_PTS2, GPIO_PTS1, GPIO_PTS0,
80
81 /* PTT */
82 GPIO_PTT5, GPIO_PTT4,
83 GPIO_PTT3, GPIO_PTT2, GPIO_PTT1, GPIO_PTT0,
84
85 /* PTU */
86 GPIO_PTU7, GPIO_PTU6, GPIO_PTU5, GPIO_PTU4,
87 GPIO_PTU3, GPIO_PTU2, GPIO_PTU1, GPIO_PTU0,
88
89 /* PTV */
90 GPIO_PTV7, GPIO_PTV6, GPIO_PTV5, GPIO_PTV4,
91 GPIO_PTV3, GPIO_PTV2, GPIO_PTV1, GPIO_PTV0,
92
93 /* PTW */
94 GPIO_PTW7, GPIO_PTW6, GPIO_PTW5, GPIO_PTW4,
95 GPIO_PTW3, GPIO_PTW2, GPIO_PTW1, GPIO_PTW0,
96
97 /* PTX */
98 GPIO_PTX7, GPIO_PTX6, GPIO_PTX5, GPIO_PTX4,
99 GPIO_PTX3, GPIO_PTX2, GPIO_PTX1, GPIO_PTX0,
100
101 /* PTY */
102 GPIO_PTY7, GPIO_PTY6, GPIO_PTY5, GPIO_PTY4,
103 GPIO_PTY3, GPIO_PTY2, GPIO_PTY1, GPIO_PTY0,
104
105 /* PTZ */
106 GPIO_PTZ7, GPIO_PTZ6, GPIO_PTZ5, GPIO_PTZ4,
107 GPIO_PTZ3, GPIO_PTZ2, GPIO_PTZ1, GPIO_PTZ0,
108
109
110 /* PTA (mobule: LBSC, CPG, LPC) */
111 GPIO_FN_BS, GPIO_FN_RDWR, GPIO_FN_WE1, GPIO_FN_RDY,
112 GPIO_FN_MD10, GPIO_FN_MD9, GPIO_FN_MD8,
113 GPIO_FN_LGPIO7, GPIO_FN_LGPIO6, GPIO_FN_LGPIO5, GPIO_FN_LGPIO4,
114 GPIO_FN_LGPIO3, GPIO_FN_LGPIO2, GPIO_FN_LGPIO1, GPIO_FN_LGPIO0,
115
116 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
117 GPIO_FN_D15, GPIO_FN_D14, GPIO_FN_D13, GPIO_FN_D12,
118 GPIO_FN_D11, GPIO_FN_D10, GPIO_FN_D9, GPIO_FN_D8,
119 GPIO_FN_ET0_MDC, GPIO_FN_ET0_MDIO,
120 GPIO_FN_ET1_MDC, GPIO_FN_ET1_MDIO,
121 GPIO_FN_SIM_D, GPIO_FN_SIM_CLK, GPIO_FN_SIM_RST,
122 GPIO_FN_WPSZ1, GPIO_FN_WPSZ0, GPIO_FN_FWID, GPIO_FN_FLSHSZ,
123 GPIO_FN_LPC_SPIEN, GPIO_FN_BASEL,
124
125 /* PTC (mobule: SD) */
126 GPIO_FN_SD_WP, GPIO_FN_SD_CD, GPIO_FN_SD_CLK, GPIO_FN_SD_CMD,
127 GPIO_FN_SD_D3, GPIO_FN_SD_D2, GPIO_FN_SD_D1, GPIO_FN_SD_D0,
128
129 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */
130 GPIO_FN_IRQ7, GPIO_FN_IRQ6, GPIO_FN_IRQ5, GPIO_FN_IRQ4,
131 GPIO_FN_IRQ3, GPIO_FN_IRQ2, GPIO_FN_IRQ1, GPIO_FN_IRQ0,
132 GPIO_FN_MD6, GPIO_FN_MD5, GPIO_FN_MD3, GPIO_FN_MD2,
133 GPIO_FN_MD1, GPIO_FN_MD0, GPIO_FN_ADTRG1, GPIO_FN_ADTRG0,
134
135 /* PTE (mobule: EtherC) */
136 GPIO_FN_ET0_CRS_DV, GPIO_FN_ET0_TXD1,
137 GPIO_FN_ET0_TXD0, GPIO_FN_ET0_TX_EN,
138 GPIO_FN_ET0_REF_CLK, GPIO_FN_ET0_RXD1,
139 GPIO_FN_ET0_RXD0, GPIO_FN_ET0_RX_ER,
140
141 /* PTF (mobule: EtherC) */
142 GPIO_FN_ET1_CRS_DV, GPIO_FN_ET1_TXD1,
143 GPIO_FN_ET1_TXD0, GPIO_FN_ET1_TX_EN,
144 GPIO_FN_ET1_REF_CLK, GPIO_FN_ET1_RXD1,
145 GPIO_FN_ET1_RXD0, GPIO_FN_ET1_RX_ER,
146
147 /* PTG (mobule: SYSTEM, PWMX, LPC) */
148 GPIO_FN_STATUS0, GPIO_FN_STATUS1,
149 GPIO_FN_PWX0, GPIO_FN_PWX1, GPIO_FN_PWX2, GPIO_FN_PWX3,
150 GPIO_FN_SERIRQ, GPIO_FN_CLKRUN, GPIO_FN_LPCPD, GPIO_FN_LDRQ,
151
152 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */
153 GPIO_FN_TCLK, GPIO_FN_RXD4, GPIO_FN_TXD4,
154 GPIO_FN_SP1_MOSI, GPIO_FN_SP1_MISO,
155 GPIO_FN_SP1_SCK, GPIO_FN_SP1_SCK_FB,
156 GPIO_FN_SP1_SS0, GPIO_FN_SP1_SS1,
157 GPIO_FN_SP0_SS1,
158
159 /* PTI (mobule: INTC) */
160 GPIO_FN_IRQ15, GPIO_FN_IRQ14, GPIO_FN_IRQ13, GPIO_FN_IRQ12,
161 GPIO_FN_IRQ11, GPIO_FN_IRQ10, GPIO_FN_IRQ9, GPIO_FN_IRQ8,
162
163 /* PTJ (mobule: SCIF234, SERMUX) */
164 GPIO_FN_RXD3, GPIO_FN_TXD3, GPIO_FN_RXD2, GPIO_FN_TXD2,
165 GPIO_FN_COM1_TXD, GPIO_FN_COM1_RXD,
166 GPIO_FN_COM1_RTS, GPIO_FN_COM1_CTS,
167
168 /* PTK (mobule: SERMUX) */
169 GPIO_FN_COM2_TXD, GPIO_FN_COM2_RXD,
170 GPIO_FN_COM2_RTS, GPIO_FN_COM2_CTS,
171 GPIO_FN_COM2_DTR, GPIO_FN_COM2_DSR,
172 GPIO_FN_COM2_DCD, GPIO_FN_COM2_RI,
173
174 /* PTL (mobule: SERMUX) */
175 GPIO_FN_RAC_TXD, GPIO_FN_RAC_RXD,
176 GPIO_FN_RAC_RTS, GPIO_FN_RAC_CTS,
177 GPIO_FN_RAC_DTR, GPIO_FN_RAC_DSR,
178 GPIO_FN_RAC_DCD, GPIO_FN_RAC_RI,
179
180 /* PTM (mobule: IIC, LPC) */
181 GPIO_FN_SDA6, GPIO_FN_SCL6, GPIO_FN_SDA7, GPIO_FN_SCL7,
182 GPIO_FN_WP, GPIO_FN_FMS0, GPIO_FN_FMS1,
183
184 /* PTN (mobule: SCIF234, EVC) */
185 GPIO_FN_SCK2, GPIO_FN_RTS4, GPIO_FN_RTS3, GPIO_FN_RTS2,
186 GPIO_FN_CTS4, GPIO_FN_CTS3, GPIO_FN_CTS2,
187 GPIO_FN_EVENT7, GPIO_FN_EVENT6, GPIO_FN_EVENT5, GPIO_FN_EVENT4,
188 GPIO_FN_EVENT3, GPIO_FN_EVENT2, GPIO_FN_EVENT1, GPIO_FN_EVENT0,
189
190 /* PTO (mobule: SGPIO) */
191 GPIO_FN_SGPIO0_CLK, GPIO_FN_SGPIO0_LOAD,
192 GPIO_FN_SGPIO0_DI, GPIO_FN_SGPIO0_DO,
193 GPIO_FN_SGPIO1_CLK, GPIO_FN_SGPIO1_LOAD,
194 GPIO_FN_SGPIO1_DI, GPIO_FN_SGPIO1_DO,
195
196 /* PTP (mobule: JMC, SCIF234) */
197 GPIO_FN_JMCTCK, GPIO_FN_JMCTMS, GPIO_FN_JMCTDO, GPIO_FN_JMCTDI,
198 GPIO_FN_JMCRST, GPIO_FN_SCK4, GPIO_FN_SCK3,
199
200 /* PTQ (mobule: LPC) */
201 GPIO_FN_LAD3, GPIO_FN_LAD2, GPIO_FN_LAD1, GPIO_FN_LAD0,
202 GPIO_FN_LFRAME, GPIO_FN_LRESET, GPIO_FN_LCLK,
203
204 /* PTR (mobule: GRA, IIC) */
205 GPIO_FN_DDC3, GPIO_FN_DDC2,
206 GPIO_FN_SDA8, GPIO_FN_SCL8, GPIO_FN_SDA2, GPIO_FN_SCL2,
207 GPIO_FN_SDA1, GPIO_FN_SCL1, GPIO_FN_SDA0, GPIO_FN_SCL0,
208
209 /* PTS (mobule: GRA, IIC) */
210 GPIO_FN_DDC1, GPIO_FN_DDC0,
211 GPIO_FN_SDA9, GPIO_FN_SCL9, GPIO_FN_SDA5, GPIO_FN_SCL5,
212 GPIO_FN_SDA4, GPIO_FN_SCL4, GPIO_FN_SDA3, GPIO_FN_SCL3,
213
214 /* PTT (mobule: SYSTEM, PWMX) */
215 GPIO_FN_AUDSYNC, GPIO_FN_AUDCK,
216 GPIO_FN_AUDATA3, GPIO_FN_AUDATA2,
217 GPIO_FN_AUDATA1, GPIO_FN_AUDATA0,
218 GPIO_FN_PWX7, GPIO_FN_PWX6, GPIO_FN_PWX5, GPIO_FN_PWX4,
219
220 /* PTU (mobule: LBSC, DMAC) */
221 GPIO_FN_CS6, GPIO_FN_CS5, GPIO_FN_CS4, GPIO_FN_CS0,
222 GPIO_FN_RD, GPIO_FN_WE0, GPIO_FN_A25, GPIO_FN_A24,
223 GPIO_FN_DREQ0, GPIO_FN_DACK0,
224
225 /* PTV (mobule: LBSC, DMAC) */
226 GPIO_FN_A23, GPIO_FN_A22, GPIO_FN_A21, GPIO_FN_A20,
227 GPIO_FN_A19, GPIO_FN_A18, GPIO_FN_A17, GPIO_FN_A16,
228 GPIO_FN_TEND0, GPIO_FN_DREQ1, GPIO_FN_DACK1, GPIO_FN_TEND1,
229
230 /* PTW (mobule: LBSC) */
231 GPIO_FN_A15, GPIO_FN_A14, GPIO_FN_A13, GPIO_FN_A12,
232 GPIO_FN_A11, GPIO_FN_A10, GPIO_FN_A9, GPIO_FN_A8,
233
234 /* PTX (mobule: LBSC) */
235 GPIO_FN_A7, GPIO_FN_A6, GPIO_FN_A5, GPIO_FN_A4,
236 GPIO_FN_A3, GPIO_FN_A2, GPIO_FN_A1, GPIO_FN_A0,
237
238 /* PTY (mobule: LBSC) */
239 GPIO_FN_D7, GPIO_FN_D6, GPIO_FN_D5, GPIO_FN_D4,
240 GPIO_FN_D3, GPIO_FN_D2, GPIO_FN_D1, GPIO_FN_D0,
241};
242
243#endif /* __ASM_SH7757_H__ */
diff --git a/arch/sh/include/cpu-sh5/cpu/cacheflush.h b/arch/sh/include/cpu-sh5/cpu/cacheflush.h
deleted file mode 100644
index 5a11f0b7e66..00000000000
--- a/arch/sh/include/cpu-sh5/cpu/cacheflush.h
+++ /dev/null
@@ -1,33 +0,0 @@
1#ifndef __ASM_SH_CPU_SH5_CACHEFLUSH_H
2#define __ASM_SH_CPU_SH5_CACHEFLUSH_H
3
4#ifndef __ASSEMBLY__
5
6struct vm_area_struct;
7struct page;
8struct mm_struct;
9
10extern void flush_cache_all(void);
11extern void flush_cache_mm(struct mm_struct *mm);
12extern void flush_cache_sigtramp(unsigned long vaddr);
13extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
14 unsigned long end);
15extern void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn);
16extern void flush_dcache_page(struct page *pg);
17extern void flush_icache_range(unsigned long start, unsigned long end);
18extern void flush_icache_user_range(struct vm_area_struct *vma,
19 struct page *page, unsigned long addr,
20 int len);
21
22#define flush_cache_dup_mm(mm) flush_cache_mm(mm)
23
24#define flush_dcache_mmap_lock(mapping) do { } while (0)
25#define flush_dcache_mmap_unlock(mapping) do { } while (0)
26
27#define flush_icache_page(vma, page) do { } while (0)
28void p3_cache_init(void);
29
30#endif /* __ASSEMBLY__ */
31
32#endif /* __ASM_SH_CPU_SH5_CACHEFLUSH_H */
33
diff --git a/arch/sh/include/mach-common/mach/migor.h b/arch/sh/include/mach-common/mach/migor.h
deleted file mode 100644
index e451f0229e0..00000000000
--- a/arch/sh/include/mach-common/mach/migor.h
+++ /dev/null
@@ -1,64 +0,0 @@
1#ifndef __ASM_SH_MIGOR_H
2#define __ASM_SH_MIGOR_H
3
4/*
5 * linux/include/asm-sh/migor.h
6 *
7 * Copyright (C) 2008 Renesas Solutions
8 *
9 * Portions Copyright (C) 2007 Nobuhiro Iwamatsu
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 *
15 */
16#include <asm/addrspace.h>
17
18/* GPIO */
19#define PORT_PACR 0xa4050100
20#define PORT_PDCR 0xa4050106
21#define PORT_PECR 0xa4050108
22#define PORT_PHCR 0xa405010e
23#define PORT_PJCR 0xa4050110
24#define PORT_PKCR 0xa4050112
25#define PORT_PLCR 0xa4050114
26#define PORT_PMCR 0xa4050116
27#define PORT_PRCR 0xa405011c
28#define PORT_PTCR 0xa4050140
29#define PORT_PUCR 0xa4050142
30#define PORT_PVCR 0xa4050144
31#define PORT_PWCR 0xa4050146
32#define PORT_PXCR 0xa4050148
33#define PORT_PYCR 0xa405014a
34#define PORT_PZCR 0xa405014c
35#define PORT_PADR 0xa4050120
36#define PORT_PHDR 0xa405012e
37#define PORT_PTDR 0xa4050160
38#define PORT_PWDR 0xa4050166
39
40#define PORT_HIZCRA 0xa4050158
41#define PORT_HIZCRC 0xa405015c
42
43#define PORT_MSELCRB 0xa4050182
44
45#define PORT_PSELA 0xa405014e
46#define PORT_PSELB 0xa4050150
47#define PORT_PSELC 0xa4050152
48#define PORT_PSELD 0xa4050154
49#define PORT_PSELE 0xa4050156
50
51#define PORT_HIZCRA 0xa4050158
52#define PORT_HIZCRB 0xa405015a
53#define PORT_HIZCRC 0xa405015c
54
55#define BSC_CS4BCR 0xfec10010
56#define BSC_CS6ABCR 0xfec1001c
57#define BSC_CS4WCR 0xfec10030
58
59#include <video/sh_mobile_lcdc.h>
60
61int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
62 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
63
64#endif /* __ASM_SH_MIGOR_H */
diff --git a/arch/sh/include/mach-common/mach/romimage.h b/arch/sh/include/mach-common/mach/romimage.h
new file mode 100644
index 00000000000..267e24112d8
--- /dev/null
+++ b/arch/sh/include/mach-common/mach/romimage.h
@@ -0,0 +1 @@
/* do nothing here by default */
diff --git a/arch/sh/include/mach-common/mach/sh7785lcr.h b/arch/sh/include/mach-common/mach/sh7785lcr.h
index 90011d435f3..1292ae5c21b 100644
--- a/arch/sh/include/mach-common/mach/sh7785lcr.h
+++ b/arch/sh/include/mach-common/mach/sh7785lcr.h
@@ -35,6 +35,8 @@
35#define PCA9564_ADDR 0x06000000 /* I2C */ 35#define PCA9564_ADDR 0x06000000 /* I2C */
36#define PCA9564_SIZE 0x00000100 36#define PCA9564_SIZE 0x00000100
37 37
38#define PCA9564_PROTO_32BIT_ADDR 0x14000000
39
38#define SM107_MEM_ADDR 0x10000000 40#define SM107_MEM_ADDR 0x10000000
39#define SM107_MEM_SIZE 0x00e00000 41#define SM107_MEM_SIZE 0x00e00000
40#define SM107_REG_ADDR 0x13e00000 42#define SM107_REG_ADDR 0x13e00000
diff --git a/arch/sh/include/mach-ecovec24/mach/partner-jet-setup.txt b/arch/sh/include/mach-ecovec24/mach/partner-jet-setup.txt
new file mode 100644
index 00000000000..8b8e4fa1fee
--- /dev/null
+++ b/arch/sh/include/mach-ecovec24/mach/partner-jet-setup.txt
@@ -0,0 +1,82 @@
1LIST "partner-jet-setup.txt"
2LIST "(C) Copyright 2009 Renesas Solutions Corp"
3LIST "Kuninori Morimoto <morimoto.kuninori@renesas.com>"
4LIST "--------------------------------"
5LIST "zImage (RAM boot)"
6LIST "This script can be used to boot the kernel from RAM via JTAG:"
7LIST "> < partner-jet-setup.txt"
8LIST "> RD zImage, 0xa8800000"
9LIST "> G=0xa8800000"
10LIST "--------------------------------"
11LIST "romImage (Flash boot)"
12LIST "Use the following command to burn the zImage to flash via JTAG:"
13LIST "> RD romImage, 0"
14LIST "--------------------------------"
15
16LIST "disable watchdog"
17EW 0xa4520004, 0xa507
18
19LIST "MMU"
20ED 0xff000010, 0x00000004
21
22LIST "setup clocks"
23ED 0xa4150024, 0x00004000
24ED 0xa4150000, 0x8E003508
25ED 0xa4150004, 0x00000000
26
27WAIT 1
28
29LIST "BSC"
30ED 0xff800020, 0xa5a50000
31ED 0xfec10000, 0x00000013
32ED 0xfec10004, 0x11110400
33ED 0xfec10024, 0x00000440
34
35WAIT 1
36
37LIST "setup sdram"
38ED 0xfd000108, 0x00000181
39ED 0xfd000020, 0x015B0002
40ED 0xfd000030, 0x03061502
41ED 0xfd000034, 0x02020102
42ED 0xfd000038, 0x01090305
43ED 0xfd00003c, 0x00000002
44ED 0xfd000008, 0x00000005
45ED 0xfd000018, 0x00000001
46
47WAIT 1
48
49ED 0xfd000014, 0x00000002
50ED 0xfd000060, 0x00020000
51ED 0xfd000060, 0x00030000
52ED 0xfd000060, 0x00010040
53ED 0xfd000060, 0x00000532
54ED 0xfd000014, 0x00000002
55ED 0xfd000014, 0x00000004
56ED 0xfd000014, 0x00000004
57ED 0xfd000060, 0x00000432
58ED 0xfd000060, 0x000103C0
59ED 0xfd000060, 0x00010040
60
61WAIT 1
62
63ED 0xfd000010, 0x00000001
64ED 0xfd000044, 0x00000613
65ED 0xfd000048, 0x238C003A
66ED 0xfd000014, 0x00000002
67
68LIST "Dummy read"
69DD 0x0c400000, 0x0c400000
70
71ED 0xfd000014, 0x00000002
72ED 0xfd000014, 0x00000004
73ED 0xfd000108, 0x00000080
74ED 0xfd000040, 0x00010000
75
76WAIT 1
77
78LIST "setup cache"
79ED 0xff00001c, 0x0000090b
80
81LIST "disable USB"
82EW 0xA4D80000, 0x0000
diff --git a/arch/sh/include/mach-ecovec24/mach/romimage.h b/arch/sh/include/mach-ecovec24/mach/romimage.h
new file mode 100644
index 00000000000..1c8787ecb1c
--- /dev/null
+++ b/arch/sh/include/mach-ecovec24/mach/romimage.h
@@ -0,0 +1,20 @@
1/* EcoVec board specific boot code:
2 * converts the "partner-jet-script.txt" script into assembly
3 * the assembly code is the first code to be executed in the romImage
4 */
5
6#include <asm/romimage-macros.h>
7#include "partner-jet-setup.txt"
8
9 /* execute icbi after enabling cache */
10 mov.l 1f, r0
11 icbi @r0
12
13 /* jump to cached area */
14 mova 2f, r0
15 jmp @r0
16 nop
17
18 .align 2
191 : .long 0xa8000000
202 :
diff --git a/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
new file mode 100644
index 00000000000..174374e1954
--- /dev/null
+++ b/arch/sh/include/mach-kfr2r09/mach/kfr2r09.h
@@ -0,0 +1,21 @@
1#ifndef __ASM_SH_KFR2R09_H
2#define __ASM_SH_KFR2R09_H
3
4#include <video/sh_mobile_lcdc.h>
5
6#ifdef CONFIG_FB_SH_MOBILE_LCDC
7void kfr2r09_lcd_on(void *board_data);
8void kfr2r09_lcd_off(void *board_data);
9int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
10 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
11#else
12static inline void kfr2r09_lcd_on(void *board_data) {}
13static inline void kfr2r09_lcd_off(void *board_data) {}
14static inline int kfr2r09_lcd_setup(void *board_data, void *sys_ops_handle,
15 struct sh_mobile_lcdc_sys_bus_ops *sys_ops)
16{
17 return -ENODEV;
18}
19#endif
20
21#endif /* __ASM_SH_KFR2R09_H */
diff --git a/arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt b/arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt
new file mode 100644
index 00000000000..3a65503714e
--- /dev/null
+++ b/arch/sh/include/mach-kfr2r09/mach/partner-jet-setup.txt
@@ -0,0 +1,143 @@
1LIST "partner-jet-setup.txt - 20090729 Magnus Damm"
2LIST "set up enough of the kfr2r09 hardware to boot the kernel"
3
4LIST "zImage (RAM boot)"
5LIST "This script can be used to boot the kernel from RAM via JTAG:"
6LIST "> < partner-jet-setup.txt"
7LIST "> RD zImage, 0xa8800000"
8LIST "> G=0xa8800000"
9
10LIST "romImage (Flash boot)"
11LIST "Use the following command to burn the zImage to flash via JTAG:"
12LIST "> RD romImage, 0"
13
14LIST "--------------------------------"
15
16LIST "disable watchdog"
17EW 0xa4520004, 0xa507
18
19LIST "invalidate instruction cache"
20ED 0xff00001c, 0x00000800
21
22LIST "invalidate TLBs"
23ED 0xff000010, 0x00000004
24
25LIST "select mode for cs5 + cs6"
26ED 0xff800020, 0xa5a50001
27ED 0xfec10000, 0x0000001b
28
29LIST "setup clocks"
30LIST "The PLL and FLL values are updated here for the optimal"
31LIST "RF frequency and improved reception sensitivity."
32ED 0xa4150004, 0x00000050
33ED 0xa4150000, 0x91053508
34WAIT 1
35ED 0xa4150050, 0x00000340
36ED 0xa4150024, 0x00005000
37
38LIST "setup pins"
39EB 0xa4050120, 0x00
40EB 0xa4050122, 0x00
41EB 0xa4050124, 0x00
42EB 0xa4050126, 0x00
43EB 0xa4050128, 0xA0
44EB 0xa405012A, 0x10
45EB 0xa405012C, 0x00
46EB 0xa405012E, 0x00
47EB 0xa4050130, 0x00
48EB 0xa4050132, 0x00
49EB 0xa4050134, 0x01
50EB 0xa4050136, 0x40
51EB 0xa4050138, 0x00
52EB 0xa405013A, 0x00
53EB 0xa405013C, 0x00
54EB 0xa405013E, 0x20
55EB 0xa4050160, 0x00
56EB 0xa4050162, 0x40
57EB 0xa4050164, 0x03
58EB 0xa4050166, 0x00
59EB 0xa4050168, 0x00
60EB 0xa405016A, 0x00
61EB 0xa405016C, 0x00
62
63EW 0xa405014E, 0x5660
64EW 0xa4050150, 0x0145
65EW 0xa4050152, 0x1550
66EW 0xa4050154, 0x0200
67EW 0xa4050156, 0x0040
68
69EW 0xa4050158, 0x0000
70EW 0xa405015a, 0x0000
71EW 0xa405015c, 0x0000
72EW 0xa405015e, 0x0000
73
74EW 0xa4050180, 0x0000
75EW 0xa4050182, 0x8002
76EW 0xa4050184, 0x0000
77
78EW 0xa405018a, 0x9991
79EW 0xa405018c, 0x8011
80EW 0xa405018e, 0x9550
81
82EW 0xa4050100, 0x0000
83EW 0xa4050102, 0x5540
84EW 0xa4050104, 0x0000
85EW 0xa4050106, 0x0000
86EW 0xa4050108, 0x4550
87EW 0xa405010a, 0x0130
88EW 0xa405010c, 0x0555
89EW 0xa405010e, 0x0000
90EW 0xa4050110, 0x0000
91EW 0xa4050112, 0xAAA8
92EW 0xa4050114, 0x8305
93EW 0xa4050116, 0x10F0
94EW 0xa4050118, 0x0F50
95EW 0xa405011a, 0x0000
96EW 0xa405011c, 0x0000
97EW 0xa405011e, 0x0555
98EW 0xa4050140, 0x0000
99EW 0xa4050142, 0x5141
100EW 0xa4050144, 0x5005
101EW 0xa4050146, 0xAAA9
102EW 0xa4050148, 0xFAA9
103EW 0xa405014a, 0x3000
104EW 0xa405014c, 0x0000
105
106LIST "setup sdram"
107ED 0xFD000108, 0x40000301
108ED 0xFD000020, 0x011B0002
109ED 0xFD000030, 0x03060E02
110ED 0xFD000034, 0x01020102
111ED 0xFD000038, 0x01090406
112ED 0xFD000008, 0x00000004
113ED 0xFD000040, 0x00000001
114ED 0xFD000040, 0x00000000
115ED 0xFD000018, 0x00000001
116
117WAIT 1
118
119ED 0xFD000014, 0x00000002
120ED 0xFD000060, 0x00000032
121ED 0xFD000060, 0x00020000
122ED 0xFD000014, 0x00000004
123ED 0xFD000014, 0x00000004
124ED 0xFD000010, 0x00000001
125ED 0xFD000044, 0x000004AF
126ED 0xFD000048, 0x20CF0037
127
128LIST "read 16 bytes from sdram"
129DD 0xa8000000, 0xa8000000, 1
130DD 0xa8000004, 0xa8000004, 1
131DD 0xa8000008, 0xa8000008, 1
132DD 0xa800000c, 0xa800000c, 1
133
134ED 0xFD000014, 0x00000002
135ED 0xFD000014, 0x00000004
136ED 0xFD000108, 0x40000300
137ED 0xFD000040, 0x00010000
138
139LIST "write to internal ram"
140ED 0xfd8007fc, 0
141
142LIST "setup cache"
143ED 0xff00001c, 0x0000090b
diff --git a/arch/sh/include/mach-kfr2r09/mach/romimage.h b/arch/sh/include/mach-kfr2r09/mach/romimage.h
new file mode 100644
index 00000000000..a110823f2bd
--- /dev/null
+++ b/arch/sh/include/mach-kfr2r09/mach/romimage.h
@@ -0,0 +1,20 @@
1/* kfr2r09 board specific boot code:
2 * converts the "partner-jet-script.txt" script into assembly
3 * the assembly code is the first code to be executed in the romImage
4 */
5
6#include <asm/romimage-macros.h>
7#include "partner-jet-setup.txt"
8
9 /* execute icbi after enabling cache */
10 mov.l 1f, r0
11 icbi @r0
12
13 /* jump to cached area */
14 mova 2f, r0
15 jmp @r0
16 nop
17
18 .align 2
191: .long 0xa8000000
202:
diff --git a/arch/sh/include/mach-migor/mach/migor.h b/arch/sh/include/mach-migor/mach/migor.h
new file mode 100644
index 00000000000..cee6cb88e02
--- /dev/null
+++ b/arch/sh/include/mach-migor/mach/migor.h
@@ -0,0 +1,14 @@
1#ifndef __ASM_SH_MIGOR_H
2#define __ASM_SH_MIGOR_H
3
4#define PORT_MSELCRB 0xa4050182
5#define BSC_CS4BCR 0xfec10010
6#define BSC_CS6ABCR 0xfec1001c
7#define BSC_CS4WCR 0xfec10030
8
9#include <video/sh_mobile_lcdc.h>
10
11int migor_lcd_qvga_setup(void *board_data, void *sys_ops_handle,
12 struct sh_mobile_lcdc_sys_bus_ops *sys_ops);
13
14#endif /* __ASM_SH_MIGOR_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 349d833deab..a2d0a40f384 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -1,5 +1,41 @@
1ifeq ($(CONFIG_SUPERH32),y) 1#
2include ${srctree}/arch/sh/kernel/Makefile_32 2# Makefile for the Linux/SuperH kernel.
3else 3#
4include ${srctree}/arch/sh/kernel/Makefile_64 4
5extra-y := head_$(BITS).o init_task.o vmlinux.lds
6
7ifdef CONFIG_FUNCTION_TRACER
8# Do not profile debug and lowlevel utilities
9CFLAGS_REMOVE_ftrace.o = -pg
5endif 10endif
11
12obj-y := debugtraps.o dumpstack.o idle.o io.o io_generic.o irq.o \
13 machvec.o nmi_debug.o process_$(BITS).o ptrace_$(BITS).o \
14 setup.o signal_$(BITS).o sys_sh.o sys_sh$(BITS).o \
15 syscalls_$(BITS).o time.o topology.o traps.o \
16 traps_$(BITS).o unwinder.o
17
18obj-y += cpu/
19obj-$(CONFIG_VSYSCALL) += vsyscall/
20obj-$(CONFIG_SMP) += smp.o
21obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
22obj-$(CONFIG_KGDB) += kgdb.o
23obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
24obj-$(CONFIG_MODULES) += sh_ksyms_$(BITS).o module.o
25obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
26obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
27obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
28obj-$(CONFIG_STACKTRACE) += stacktrace.o
29obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
30obj-$(CONFIG_KPROBES) += kprobes.o
31obj-$(CONFIG_GENERIC_GPIO) += gpio.o
32obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
33obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o
34obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o
35obj-$(CONFIG_DUMP_CODE) += disassemble.o
36obj-$(CONFIG_HIBERNATION) += swsusp.o
37obj-$(CONFIG_DWARF_UNWINDER) += dwarf.o
38
39obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
40
41EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32
deleted file mode 100644
index 9411e3e31e6..00000000000
--- a/arch/sh/kernel/Makefile_32
+++ /dev/null
@@ -1,37 +0,0 @@
1#
2# Makefile for the Linux/SuperH kernel.
3#
4
5extra-y := head_32.o init_task.o vmlinux.lds
6
7ifdef CONFIG_FUNCTION_TRACER
8# Do not profile debug and lowlevel utilities
9CFLAGS_REMOVE_ftrace.o = -pg
10endif
11
12obj-y := debugtraps.o idle.o io.o io_generic.o irq.o \
13 machvec.o process_32.o ptrace_32.o setup.o signal_32.o \
14 sys_sh.o sys_sh32.o syscalls_32.o time.o topology.o \
15 traps.o traps_32.o
16
17obj-y += cpu/
18obj-$(CONFIG_VSYSCALL) += vsyscall/
19obj-$(CONFIG_SMP) += smp.o
20obj-$(CONFIG_SH_STANDARD_BIOS) += sh_bios.o
21obj-$(CONFIG_KGDB) += kgdb.o
22obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
23obj-$(CONFIG_MODULES) += sh_ksyms_32.o module.o
24obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
25obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
26obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
27obj-$(CONFIG_STACKTRACE) += stacktrace.o
28obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
29obj-$(CONFIG_KPROBES) += kprobes.o
30obj-$(CONFIG_GENERIC_GPIO) += gpio.o
31obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o
32obj-$(CONFIG_DUMP_CODE) += disassemble.o
33obj-$(CONFIG_HIBERNATION) += swsusp.o
34
35obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
36
37EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/Makefile_64 b/arch/sh/kernel/Makefile_64
deleted file mode 100644
index 67b9f6c6326..00000000000
--- a/arch/sh/kernel/Makefile_64
+++ /dev/null
@@ -1,19 +0,0 @@
1extra-y := head_64.o init_task.o vmlinux.lds
2
3obj-y := debugtraps.o idle.o io.o io_generic.o irq.o machvec.o process_64.o \
4 ptrace_64.o setup.o signal_64.o sys_sh.o sys_sh64.o \
5 syscalls_64.o time.o topology.o traps.o traps_64.o
6
7obj-y += cpu/
8obj-$(CONFIG_SMP) += smp.o
9obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
10obj-$(CONFIG_MODULES) += sh_ksyms_64.o module.o
11obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
12obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
13obj-$(CONFIG_STACKTRACE) += stacktrace.o
14obj-$(CONFIG_IO_TRAPPED) += io_trapped.o
15obj-$(CONFIG_GENERIC_GPIO) += gpio.o
16
17obj-$(CONFIG_GENERIC_CLOCKEVENTS_BROADCAST) += localtimer.o
18
19EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/kernel/asm-offsets.c b/arch/sh/kernel/asm-offsets.c
index 99aceb28ee2..d218e808294 100644
--- a/arch/sh/kernel/asm-offsets.c
+++ b/arch/sh/kernel/asm-offsets.c
@@ -26,6 +26,7 @@ int main(void)
26 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 26 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
27 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count)); 27 DEFINE(TI_PRE_COUNT, offsetof(struct thread_info, preempt_count));
28 DEFINE(TI_RESTART_BLOCK,offsetof(struct thread_info, restart_block)); 28 DEFINE(TI_RESTART_BLOCK,offsetof(struct thread_info, restart_block));
29 DEFINE(TI_SIZE, sizeof(struct thread_info));
29 30
30#ifdef CONFIG_HIBERNATION 31#ifdef CONFIG_HIBERNATION
31 DEFINE(PBE_ADDRESS, offsetof(struct pbe, address)); 32 DEFINE(PBE_ADDRESS, offsetof(struct pbe, address));
diff --git a/arch/sh/kernel/cpu/Makefile b/arch/sh/kernel/cpu/Makefile
index eecad7cbd61..3d6b9312dc4 100644
--- a/arch/sh/kernel/cpu/Makefile
+++ b/arch/sh/kernel/cpu/Makefile
@@ -19,4 +19,4 @@ obj-$(CONFIG_UBC_WAKEUP) += ubc.o
19obj-$(CONFIG_SH_ADC) += adc.o 19obj-$(CONFIG_SH_ADC) += adc.o
20obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o 20obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o
21 21
22obj-y += irq/ init.o clock.o 22obj-y += irq/ init.o clock.o hwblk.o
diff --git a/arch/sh/kernel/cpu/hwblk.c b/arch/sh/kernel/cpu/hwblk.c
new file mode 100644
index 00000000000..c0ad7d46e78
--- /dev/null
+++ b/arch/sh/kernel/cpu/hwblk.c
@@ -0,0 +1,155 @@
1#include <linux/clk.h>
2#include <linux/compiler.h>
3#include <linux/slab.h>
4#include <linux/io.h>
5#include <linux/spinlock.h>
6#include <asm/suspend.h>
7#include <asm/hwblk.h>
8#include <asm/clock.h>
9
10static DEFINE_SPINLOCK(hwblk_lock);
11
12static void hwblk_area_mod_cnt(struct hwblk_info *info,
13 int area, int counter, int value, int goal)
14{
15 struct hwblk_area *hap = info->areas + area;
16
17 hap->cnt[counter] += value;
18
19 if (hap->cnt[counter] != goal)
20 return;
21
22 if (hap->flags & HWBLK_AREA_FLAG_PARENT)
23 hwblk_area_mod_cnt(info, hap->parent, counter, value, goal);
24}
25
26
27static int __hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
28 int counter, int value, int goal)
29{
30 struct hwblk *hp = info->hwblks + hwblk;
31
32 hp->cnt[counter] += value;
33 if (hp->cnt[counter] == goal)
34 hwblk_area_mod_cnt(info, hp->area, counter, value, goal);
35
36 return hp->cnt[counter];
37}
38
39static void hwblk_mod_cnt(struct hwblk_info *info, int hwblk,
40 int counter, int value, int goal)
41{
42 unsigned long flags;
43
44 spin_lock_irqsave(&hwblk_lock, flags);
45 __hwblk_mod_cnt(info, hwblk, counter, value, goal);
46 spin_unlock_irqrestore(&hwblk_lock, flags);
47}
48
49void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int counter)
50{
51 hwblk_mod_cnt(info, hwblk, counter, 1, 1);
52}
53
54void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int counter)
55{
56 hwblk_mod_cnt(info, hwblk, counter, -1, 0);
57}
58
59void hwblk_enable(struct hwblk_info *info, int hwblk)
60{
61 struct hwblk *hp = info->hwblks + hwblk;
62 unsigned long tmp;
63 unsigned long flags;
64 int ret;
65
66 spin_lock_irqsave(&hwblk_lock, flags);
67
68 ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, 1, 1);
69 if (ret == 1) {
70 tmp = __raw_readl(hp->mstp);
71 tmp &= ~(1 << hp->bit);
72 __raw_writel(tmp, hp->mstp);
73 }
74
75 spin_unlock_irqrestore(&hwblk_lock, flags);
76}
77
78void hwblk_disable(struct hwblk_info *info, int hwblk)
79{
80 struct hwblk *hp = info->hwblks + hwblk;
81 unsigned long tmp;
82 unsigned long flags;
83 int ret;
84
85 spin_lock_irqsave(&hwblk_lock, flags);
86
87 ret = __hwblk_mod_cnt(info, hwblk, HWBLK_CNT_USAGE, -1, 0);
88 if (ret == 0) {
89 tmp = __raw_readl(hp->mstp);
90 tmp |= 1 << hp->bit;
91 __raw_writel(tmp, hp->mstp);
92 }
93
94 spin_unlock_irqrestore(&hwblk_lock, flags);
95}
96
97struct hwblk_info *hwblk_info;
98
99int __init hwblk_register(struct hwblk_info *info)
100{
101 hwblk_info = info;
102 return 0;
103}
104
105int __init __weak arch_hwblk_init(void)
106{
107 return 0;
108}
109
110int __weak arch_hwblk_sleep_mode(void)
111{
112 return SUSP_SH_SLEEP;
113}
114
115int __init hwblk_init(void)
116{
117 return arch_hwblk_init();
118}
119
120/* allow clocks to enable and disable hardware blocks */
121static int sh_hwblk_clk_enable(struct clk *clk)
122{
123 if (!hwblk_info)
124 return -ENOENT;
125
126 hwblk_enable(hwblk_info, clk->arch_flags);
127 return 0;
128}
129
130static void sh_hwblk_clk_disable(struct clk *clk)
131{
132 if (hwblk_info)
133 hwblk_disable(hwblk_info, clk->arch_flags);
134}
135
136static struct clk_ops sh_hwblk_clk_ops = {
137 .enable = sh_hwblk_clk_enable,
138 .disable = sh_hwblk_clk_disable,
139 .recalc = followparent_recalc,
140};
141
142int __init sh_hwblk_clk_register(struct clk *clks, int nr)
143{
144 struct clk *clkp;
145 int ret = 0;
146 int k;
147
148 for (k = 0; !ret && (k < nr); k++) {
149 clkp = clks + k;
150 clkp->ops = &sh_hwblk_clk_ops;
151 ret |= clk_register(clkp);
152 }
153
154 return ret;
155}
diff --git a/arch/sh/kernel/cpu/init.c b/arch/sh/kernel/cpu/init.c
index ad85421099c..e932ebef473 100644
--- a/arch/sh/kernel/cpu/init.c
+++ b/arch/sh/kernel/cpu/init.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * CPU init code 4 * CPU init code
5 * 5 *
6 * Copyright (C) 2002 - 2007 Paul Mundt 6 * Copyright (C) 2002 - 2009 Paul Mundt
7 * Copyright (C) 2003 Richard Curnow 7 * Copyright (C) 2003 Richard Curnow
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General Public 9 * This file is subject to the terms and conditions of the GNU General Public
@@ -62,6 +62,37 @@ static void __init speculative_execution_init(void)
62#define speculative_execution_init() do { } while (0) 62#define speculative_execution_init() do { } while (0)
63#endif 63#endif
64 64
65#ifdef CONFIG_CPU_SH4A
66#define EXPMASK 0xff2f0004
67#define EXPMASK_RTEDS (1 << 0)
68#define EXPMASK_BRDSSLP (1 << 1)
69#define EXPMASK_MMCAW (1 << 4)
70
71static void __init expmask_init(void)
72{
73 unsigned long expmask = __raw_readl(EXPMASK);
74
75 /*
76 * Future proofing.
77 *
78 * Disable support for slottable sleep instruction
79 * and non-nop instructions in the rte delay slot.
80 */
81 expmask &= ~(EXPMASK_RTEDS | EXPMASK_BRDSSLP);
82
83 /*
84 * Enable associative writes to the memory-mapped cache array
85 * until the cache flush ops have been rewritten.
86 */
87 expmask |= EXPMASK_MMCAW;
88
89 __raw_writel(expmask, EXPMASK);
90 ctrl_barrier();
91}
92#else
93#define expmask_init() do { } while (0)
94#endif
95
65/* 2nd-level cache init */ 96/* 2nd-level cache init */
66void __uses_jump_to_uncached __attribute__ ((weak)) l2_cache_init(void) 97void __uses_jump_to_uncached __attribute__ ((weak)) l2_cache_init(void)
67{ 98{
@@ -268,11 +299,9 @@ asmlinkage void __init sh_cpu_init(void)
268 cache_init(); 299 cache_init();
269 300
270 if (raw_smp_processor_id() == 0) { 301 if (raw_smp_processor_id() == 0) {
271#ifdef CONFIG_MMU
272 shm_align_mask = max_t(unsigned long, 302 shm_align_mask = max_t(unsigned long,
273 current_cpu_data.dcache.way_size - 1, 303 current_cpu_data.dcache.way_size - 1,
274 PAGE_SIZE - 1); 304 PAGE_SIZE - 1);
275#endif
276 305
277 /* Boot CPU sets the cache shape */ 306 /* Boot CPU sets the cache shape */
278 detect_cache_shape(); 307 detect_cache_shape();
@@ -321,4 +350,5 @@ asmlinkage void __init sh_cpu_init(void)
321#endif 350#endif
322 351
323 speculative_execution_init(); 352 speculative_execution_init();
353 expmask_init();
324} 354}
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 808d99a48ef..c1508a90fc6 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -35,6 +35,7 @@ static void disable_ipr_irq(unsigned int irq)
35 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx]; 35 unsigned long addr = get_ipr_desc(irq)->ipr_offsets[p->ipr_idx];
36 /* Set the priority in IPR to 0 */ 36 /* Set the priority in IPR to 0 */
37 __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr); 37 __raw_writew(__raw_readw(addr) & (0xffff ^ (0xf << p->shift)), addr);
38 (void)__raw_readw(addr); /* Read back to flush write posting */
38} 39}
39 40
40static void enable_ipr_irq(unsigned int irq) 41static void enable_ipr_irq(unsigned int irq)
diff --git a/arch/sh/kernel/cpu/sh2/entry.S b/arch/sh/kernel/cpu/sh2/entry.S
index becc54c4569..c8a4331d9b8 100644
--- a/arch/sh/kernel/cpu/sh2/entry.S
+++ b/arch/sh/kernel/cpu/sh2/entry.S
@@ -227,8 +227,9 @@ ENTRY(sh_bios_handler)
227 mov.l @r15+, r14 227 mov.l @r15+, r14
228 add #8,r15 228 add #8,r15
229 lds.l @r15+, pr 229 lds.l @r15+, pr
230 mov.l @r15+,r15
230 rte 231 rte
231 mov.l @r15+,r15 232 nop
232 .align 2 233 .align 2
2331: .long gdb_vbr_vector 2341: .long gdb_vbr_vector
234#endif /* CONFIG_SH_STANDARD_BIOS */ 235#endif /* CONFIG_SH_STANDARD_BIOS */
diff --git a/arch/sh/kernel/cpu/sh2/probe.c b/arch/sh/kernel/cpu/sh2/probe.c
index 5916d9096b9..1db6d888388 100644
--- a/arch/sh/kernel/cpu/sh2/probe.c
+++ b/arch/sh/kernel/cpu/sh2/probe.c
@@ -29,6 +29,7 @@ int __init detect_cpu_and_cache_system(void)
29 */ 29 */
30 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED; 30 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED;
31 boot_cpu_data.icache = boot_cpu_data.dcache; 31 boot_cpu_data.icache = boot_cpu_data.dcache;
32 boot_cpu_data.family = CPU_FAMILY_SH2;
32 33
33 return 0; 34 return 0;
34} 35}
diff --git a/arch/sh/kernel/cpu/sh2a/entry.S b/arch/sh/kernel/cpu/sh2a/entry.S
index ab3903eeda5..222742ddc0d 100644
--- a/arch/sh/kernel/cpu/sh2a/entry.S
+++ b/arch/sh/kernel/cpu/sh2a/entry.S
@@ -176,8 +176,9 @@ ENTRY(sh_bios_handler)
176 movml.l @r15+,r14 176 movml.l @r15+,r14
177 add #8,r15 177 add #8,r15
178 lds.l @r15+, pr 178 lds.l @r15+, pr
179 mov.l @r15+,r15
179 rte 180 rte
180 mov.l @r15+,r15 181 nop
181 .align 2 182 .align 2
1821: .long gdb_vbr_vector 1831: .long gdb_vbr_vector
183#endif /* CONFIG_SH_STANDARD_BIOS */ 184#endif /* CONFIG_SH_STANDARD_BIOS */
diff --git a/arch/sh/kernel/cpu/sh2a/probe.c b/arch/sh/kernel/cpu/sh2a/probe.c
index e098e2f6aa0..6825d650716 100644
--- a/arch/sh/kernel/cpu/sh2a/probe.c
+++ b/arch/sh/kernel/cpu/sh2a/probe.c
@@ -15,6 +15,8 @@
15 15
16int __init detect_cpu_and_cache_system(void) 16int __init detect_cpu_and_cache_system(void)
17{ 17{
18 boot_cpu_data.family = CPU_FAMILY_SH2A;
19
18 /* All SH-2A CPUs have support for 16 and 32-bit opcodes.. */ 20 /* All SH-2A CPUs have support for 16 and 32-bit opcodes.. */
19 boot_cpu_data.flags |= CPU_HAS_OP32; 21 boot_cpu_data.flags |= CPU_HAS_OP32;
20 22
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7709.c b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
index fa30b601773..e8749505bd2 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7709.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
@@ -22,13 +22,6 @@ static int stc_multipliers[] = { 1, 2, 4, 8, 3, 6, 1, 1 };
22static int ifc_divisors[] = { 1, 2, 4, 1, 3, 1, 1, 1 }; 22static int ifc_divisors[] = { 1, 2, 4, 1, 3, 1, 1, 1 };
23static int pfc_divisors[] = { 1, 2, 4, 1, 3, 6, 1, 1 }; 23static int pfc_divisors[] = { 1, 2, 4, 1, 3, 6, 1, 1 };
24 24
25static void set_bus_parent(struct clk *clk)
26{
27 struct clk *bus_clk = clk_get(NULL, "bus_clk");
28 clk->parent = bus_clk;
29 clk_put(bus_clk);
30}
31
32static void master_clk_init(struct clk *clk) 25static void master_clk_init(struct clk *clk)
33{ 26{
34 int frqcr = ctrl_inw(FRQCR); 27 int frqcr = ctrl_inw(FRQCR);
@@ -50,9 +43,6 @@ static unsigned long module_clk_recalc(struct clk *clk)
50} 43}
51 44
52static struct clk_ops sh7709_module_clk_ops = { 45static struct clk_ops sh7709_module_clk_ops = {
53#ifdef CLOCK_MODE_0_1_2_7
54 .init = set_bus_parent,
55#endif
56 .recalc = module_clk_recalc, 46 .recalc = module_clk_recalc,
57}; 47};
58 48
@@ -78,7 +68,6 @@ static unsigned long cpu_clk_recalc(struct clk *clk)
78} 68}
79 69
80static struct clk_ops sh7709_cpu_clk_ops = { 70static struct clk_ops sh7709_cpu_clk_ops = {
81 .init = set_bus_parent,
82 .recalc = cpu_clk_recalc, 71 .recalc = cpu_clk_recalc,
83}; 72};
84 73
diff --git a/arch/sh/kernel/cpu/sh3/entry.S b/arch/sh/kernel/cpu/sh3/entry.S
index 3cb531f233f..0151933e525 100644
--- a/arch/sh/kernel/cpu/sh3/entry.S
+++ b/arch/sh/kernel/cpu/sh3/entry.S
@@ -53,10 +53,6 @@
53 * syscall # 53 * syscall #
54 * 54 *
55 */ 55 */
56#if defined(CONFIG_KGDB)
57NMI_VEC = 0x1c0 ! Must catch early for debounce
58#endif
59
60/* Offsets to the stack */ 56/* Offsets to the stack */
61OFF_R0 = 0 /* Return value. New ABI also arg4 */ 57OFF_R0 = 0 /* Return value. New ABI also arg4 */
62OFF_R1 = 4 /* New ABI: arg5 */ 58OFF_R1 = 4 /* New ABI: arg5 */
@@ -71,7 +67,6 @@ OFF_PC = (16*4)
71OFF_SR = (16*4+8) 67OFF_SR = (16*4+8)
72OFF_TRA = (16*4+6*4) 68OFF_TRA = (16*4+6*4)
73 69
74
75#define k0 r0 70#define k0 r0
76#define k1 r1 71#define k1 r1
77#define k2 r2 72#define k2 r2
@@ -113,34 +108,34 @@ OFF_TRA = (16*4+6*4)
113#if defined(CONFIG_MMU) 108#if defined(CONFIG_MMU)
114 .align 2 109 .align 2
115ENTRY(tlb_miss_load) 110ENTRY(tlb_miss_load)
116 bra call_dpf 111 bra call_handle_tlbmiss
117 mov #0, r5 112 mov #0, r5
118 113
119 .align 2 114 .align 2
120ENTRY(tlb_miss_store) 115ENTRY(tlb_miss_store)
121 bra call_dpf 116 bra call_handle_tlbmiss
122 mov #1, r5 117 mov #1, r5
123 118
124 .align 2 119 .align 2
125ENTRY(initial_page_write) 120ENTRY(initial_page_write)
126 bra call_dpf 121 bra call_handle_tlbmiss
127 mov #1, r5 122 mov #2, r5
128 123
129 .align 2 124 .align 2
130ENTRY(tlb_protection_violation_load) 125ENTRY(tlb_protection_violation_load)
131 bra call_dpf 126 bra call_do_page_fault
132 mov #0, r5 127 mov #0, r5
133 128
134 .align 2 129 .align 2
135ENTRY(tlb_protection_violation_store) 130ENTRY(tlb_protection_violation_store)
136 bra call_dpf 131 bra call_do_page_fault
137 mov #1, r5 132 mov #1, r5
138 133
139call_dpf: 134call_handle_tlbmiss:
135 setup_frame_reg
140 mov.l 1f, r0 136 mov.l 1f, r0
141 mov r5, r8 137 mov r5, r8
142 mov.l @r0, r6 138 mov.l @r0, r6
143 mov r6, r9
144 mov.l 2f, r0 139 mov.l 2f, r0
145 sts pr, r10 140 sts pr, r10
146 jsr @r0 141 jsr @r0
@@ -151,16 +146,25 @@ call_dpf:
151 lds r10, pr 146 lds r10, pr
152 rts 147 rts
153 nop 148 nop
1540: mov.l 3f, r0 1490:
155 mov r9, r6
156 mov r8, r5 150 mov r8, r5
151call_do_page_fault:
152 mov.l 1f, r0
153 mov.l @r0, r6
154
155 sti
156
157 mov.l 3f, r0
158 mov.l 4f, r1
159 mov r15, r4
157 jmp @r0 160 jmp @r0
158 mov r15, r4 161 lds r1, pr
159 162
160 .align 2 163 .align 2
1611: .long MMU_TEA 1641: .long MMU_TEA
1622: .long __do_page_fault 1652: .long handle_tlbmiss
1633: .long do_page_fault 1663: .long do_page_fault
1674: .long ret_from_exception
164 168
165 .align 2 169 .align 2
166ENTRY(address_error_load) 170ENTRY(address_error_load)
@@ -256,7 +260,7 @@ restore_all:
256 ! 260 !
257 ! Calculate new SR value 261 ! Calculate new SR value
258 mov k3, k2 ! original SR value 262 mov k3, k2 ! original SR value
259 mov #0xf0, k1 263 mov #0xfffffff0, k1
260 extu.b k1, k1 264 extu.b k1, k1
261 not k1, k1 265 not k1, k1
262 and k1, k2 ! Mask original SR value 266 and k1, k2 ! Mask original SR value
@@ -272,21 +276,12 @@ restore_all:
2726: or k0, k2 ! Set the IMASK-bits 2766: or k0, k2 ! Set the IMASK-bits
273 ldc k2, ssr 277 ldc k2, ssr
274 ! 278 !
275#if defined(CONFIG_KGDB)
276 ! Clear in_nmi
277 mov.l 6f, k0
278 mov #0, k1
279 mov.b k1, @k0
280#endif
281 mov k4, r15 279 mov k4, r15
282 rte 280 rte
283 nop 281 nop
284 282
285 .align 2 283 .align 2
2865: .long 0x00001000 ! DSP 2845: .long 0x00001000 ! DSP
287#ifdef CONFIG_KGDB
2886: .long in_nmi
289#endif
2907: .long 0x30000000 2857: .long 0x30000000
291 286
292! common exception handler 287! common exception handler
@@ -478,23 +473,6 @@ ENTRY(save_low_regs)
478! 473!
479 .balign 512,0,512 474 .balign 512,0,512
480ENTRY(handle_interrupt) 475ENTRY(handle_interrupt)
481#if defined(CONFIG_KGDB)
482 mov.l 2f, k2
483 ! Debounce (filter nested NMI)
484 mov.l @k2, k0
485 mov.l 9f, k1
486 cmp/eq k1, k0
487 bf 11f
488 mov.l 10f, k1
489 tas.b @k1
490 bt 11f
491 rte
492 nop
493 .align 2
4949: .long NMI_VEC
49510: .long in_nmi
49611:
497#endif /* defined(CONFIG_KGDB) */
498 sts pr, k3 ! save original pr value in k3 476 sts pr, k3 ! save original pr value in k3
499 mova exception_data, k0 477 mova exception_data, k0
500 478
@@ -507,13 +485,49 @@ ENTRY(handle_interrupt)
507 bsr save_regs ! needs original pr value in k3 485 bsr save_regs ! needs original pr value in k3
508 mov #-1, k2 ! default vector kept in k2 486 mov #-1, k2 ! default vector kept in k2
509 487
488 setup_frame_reg
489
490 stc sr, r0 ! get status register
491 shlr2 r0
492 and #0x3c, r0
493 cmp/eq #0x3c, r0
494 bf 9f
495 TRACE_IRQS_OFF
4969:
497
510 ! Setup return address and jump to do_IRQ 498 ! Setup return address and jump to do_IRQ
511 mov.l 4f, r9 ! fetch return address 499 mov.l 4f, r9 ! fetch return address
512 lds r9, pr ! put return address in pr 500 lds r9, pr ! put return address in pr
513 mov.l 2f, r4 501 mov.l 2f, r4
514 mov.l 3f, r9 502 mov.l 3f, r9
515 mov.l @r4, r4 ! pass INTEVT vector as arg0 503 mov.l @r4, r4 ! pass INTEVT vector as arg0
504
505 shlr2 r4
506 shlr r4
507 mov r4, r0 ! save vector->jmp table offset for later
508
509 shlr2 r4 ! vector to IRQ# conversion
510 add #-0x10, r4
511
512 cmp/pz r4 ! is it a valid IRQ?
513 bt 10f
514
515 /*
516 * We got here as a result of taking the INTEVT path for something
517 * that isn't a valid hard IRQ, therefore we bypass the do_IRQ()
518 * path and special case the event dispatch instead. This is the
519 * expected path for the NMI (and any other brilliantly implemented
520 * exception), which effectively wants regular exception dispatch
521 * but is unfortunately reported through INTEVT rather than
522 * EXPEVT. Grr.
523 */
524 mov.l 6f, r9
525 mov.l @(r0, r9), r9
516 jmp @r9 526 jmp @r9
527 mov r15, r8 ! trap handlers take saved regs in r8
528
52910:
530 jmp @r9 ! Off to do_IRQ() we go.
517 mov r15, r5 ! pass saved registers as arg1 531 mov r15, r5 ! pass saved registers as arg1
518 532
519ENTRY(exception_none) 533ENTRY(exception_none)
diff --git a/arch/sh/kernel/cpu/sh3/ex.S b/arch/sh/kernel/cpu/sh3/ex.S
index e5a0de39a2d..46610c35c23 100644
--- a/arch/sh/kernel/cpu/sh3/ex.S
+++ b/arch/sh/kernel/cpu/sh3/ex.S
@@ -48,9 +48,7 @@ ENTRY(exception_handling_table)
48 .long system_call ! Unconditional Trap /* 160 */ 48 .long system_call ! Unconditional Trap /* 160 */
49 .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */ 49 .long exception_error ! reserved_instruction (filled by trap_init) /* 180 */
50 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/ 50 .long exception_error ! illegal_slot_instruction (filled by trap_init) /*1A0*/
51ENTRY(nmi_slot) 51 .long nmi_trap_handler /* 1C0 */ ! Allow trap to debugger
52 .long kgdb_handle_exception /* 1C0 */ ! Allow trap to debugger
53ENTRY(user_break_point_trap)
54 .long break_point_trap /* 1E0 */ 52 .long break_point_trap /* 1E0 */
55 53
56 /* 54 /*
diff --git a/arch/sh/kernel/cpu/sh3/probe.c b/arch/sh/kernel/cpu/sh3/probe.c
index 10f2a760c5e..f9c7df64eb0 100644
--- a/arch/sh/kernel/cpu/sh3/probe.c
+++ b/arch/sh/kernel/cpu/sh3/probe.c
@@ -107,5 +107,7 @@ int __uses_jump_to_uncached detect_cpu_and_cache_system(void)
107 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED; 107 boot_cpu_data.dcache.flags |= SH_CACHE_COMBINED;
108 boot_cpu_data.icache = boot_cpu_data.dcache; 108 boot_cpu_data.icache = boot_cpu_data.dcache;
109 109
110 boot_cpu_data.family = CPU_FAMILY_SH3;
111
110 return 0; 112 return 0;
111} 113}
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 6c78d0a9c85..d36f0c45f55 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -57,8 +57,12 @@ int __init detect_cpu_and_cache_system(void)
57 * Setup some generic flags we can probe on SH-4A parts 57 * Setup some generic flags we can probe on SH-4A parts
58 */ 58 */
59 if (((pvr >> 16) & 0xff) == 0x10) { 59 if (((pvr >> 16) & 0xff) == 0x10) {
60 if ((cvr & 0x10000000) == 0) 60 boot_cpu_data.family = CPU_FAMILY_SH4A;
61
62 if ((cvr & 0x10000000) == 0) {
61 boot_cpu_data.flags |= CPU_HAS_DSP; 63 boot_cpu_data.flags |= CPU_HAS_DSP;
64 boot_cpu_data.family = CPU_FAMILY_SH4AL_DSP;
65 }
62 66
63 boot_cpu_data.flags |= CPU_HAS_LLSC | CPU_HAS_PERF_COUNTER; 67 boot_cpu_data.flags |= CPU_HAS_LLSC | CPU_HAS_PERF_COUNTER;
64 boot_cpu_data.cut_major = pvr & 0x7f; 68 boot_cpu_data.cut_major = pvr & 0x7f;
@@ -68,6 +72,7 @@ int __init detect_cpu_and_cache_system(void)
68 } else { 72 } else {
69 /* And some SH-4 defaults.. */ 73 /* And some SH-4 defaults.. */
70 boot_cpu_data.flags |= CPU_HAS_PTEA; 74 boot_cpu_data.flags |= CPU_HAS_PTEA;
75 boot_cpu_data.family = CPU_FAMILY_SH4;
71 } 76 }
72 77
73 /* FPU detection works for everyone */ 78 /* FPU detection works for everyone */
@@ -139,8 +144,15 @@ int __init detect_cpu_and_cache_system(void)
139 } 144 }
140 break; 145 break;
141 case 0x300b: 146 case 0x300b:
142 boot_cpu_data.type = CPU_SH7724; 147 switch (prr) {
143 boot_cpu_data.flags |= CPU_HAS_L2_CACHE; 148 case 0x20:
149 boot_cpu_data.type = CPU_SH7724;
150 boot_cpu_data.flags |= CPU_HAS_L2_CACHE;
151 break;
152 case 0x50:
153 boot_cpu_data.type = CPU_SH7757;
154 break;
155 }
144 break; 156 break;
145 case 0x4000: /* 1st cut */ 157 case 0x4000: /* 1st cut */
146 case 0x4001: /* 2nd cut */ 158 case 0x4001: /* 2nd cut */
@@ -173,9 +185,6 @@ int __init detect_cpu_and_cache_system(void)
173 boot_cpu_data.dcache.ways = 2; 185 boot_cpu_data.dcache.ways = 2;
174 186
175 break; 187 break;
176 default:
177 boot_cpu_data.type = CPU_SH_NONE;
178 break;
179 } 188 }
180 189
181 /* 190 /*
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index ebdd391d5f4..490d5dc9e37 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -3,6 +3,7 @@
3# 3#
4 4
5# CPU subtype setup 5# CPU subtype setup
6obj-$(CONFIG_CPU_SUBTYPE_SH7757) += setup-sh7757.o
6obj-$(CONFIG_CPU_SUBTYPE_SH7763) += setup-sh7763.o 7obj-$(CONFIG_CPU_SUBTYPE_SH7763) += setup-sh7763.o
7obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o
8obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o
@@ -19,15 +20,16 @@ obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o
19smp-$(CONFIG_CPU_SHX3) := smp-shx3.o 20smp-$(CONFIG_CPU_SHX3) := smp-shx3.o
20 21
21# Primary on-chip clocks (common) 22# Primary on-chip clocks (common)
23clock-$(CONFIG_CPU_SUBTYPE_SH7757) := clock-sh7757.o
22clock-$(CONFIG_CPU_SUBTYPE_SH7763) := clock-sh7763.o 24clock-$(CONFIG_CPU_SUBTYPE_SH7763) := clock-sh7763.o
23clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o 25clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o
24clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o 26clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
25clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o 27clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o
26clock-$(CONFIG_CPU_SUBTYPE_SH7786) := clock-sh7786.o 28clock-$(CONFIG_CPU_SUBTYPE_SH7786) := clock-sh7786.o
27clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o 29clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o
28clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o 30clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o hwblk-sh7722.o
29clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7723.o 31clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7723.o hwblk-sh7723.o
30clock-$(CONFIG_CPU_SUBTYPE_SH7724) := clock-sh7724.o 32clock-$(CONFIG_CPU_SUBTYPE_SH7724) := clock-sh7724.o hwblk-sh7724.o
31clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7366.o 33clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7366.o
32clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o 34clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o
33 35
@@ -35,6 +37,7 @@ clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o
35pinmux-$(CONFIG_CPU_SUBTYPE_SH7722) := pinmux-sh7722.o 37pinmux-$(CONFIG_CPU_SUBTYPE_SH7722) := pinmux-sh7722.o
36pinmux-$(CONFIG_CPU_SUBTYPE_SH7723) := pinmux-sh7723.o 38pinmux-$(CONFIG_CPU_SUBTYPE_SH7723) := pinmux-sh7723.o
37pinmux-$(CONFIG_CPU_SUBTYPE_SH7724) := pinmux-sh7724.o 39pinmux-$(CONFIG_CPU_SUBTYPE_SH7724) := pinmux-sh7724.o
40pinmux-$(CONFIG_CPU_SUBTYPE_SH7757) := pinmux-sh7757.o
38pinmux-$(CONFIG_CPU_SUBTYPE_SH7785) := pinmux-sh7785.o 41pinmux-$(CONFIG_CPU_SUBTYPE_SH7785) := pinmux-sh7785.o
39pinmux-$(CONFIG_CPU_SUBTYPE_SH7786) := pinmux-sh7786.o 42pinmux-$(CONFIG_CPU_SUBTYPE_SH7786) := pinmux-sh7786.o
40 43
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
index 40f859354f7..ea38b554dc0 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c
@@ -22,6 +22,8 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clock.h> 24#include <asm/clock.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7722.h>
25 27
26/* SH7722 registers */ 28/* SH7722 registers */
27#define FRQCR 0xa4150000 29#define FRQCR 0xa4150000
@@ -30,9 +32,6 @@
30#define SCLKBCR 0xa415000c 32#define SCLKBCR 0xa415000c
31#define IRDACLKCR 0xa4150018 33#define IRDACLKCR 0xa4150018
32#define PLLCR 0xa4150024 34#define PLLCR 0xa4150024
33#define MSTPCR0 0xa4150030
34#define MSTPCR1 0xa4150034
35#define MSTPCR2 0xa4150038
36#define DLLFRQ 0xa4150050 35#define DLLFRQ 0xa4150050
37 36
38/* Fixed 32 KHz root clock for RTC and Power Management purposes */ 37/* Fixed 32 KHz root clock for RTC and Power Management purposes */
@@ -140,35 +139,37 @@ struct clk div6_clks[] = {
140 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), 139 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0),
141}; 140};
142 141
143#define MSTP(_str, _parent, _reg, _bit, _flags) \ 142#define R_CLK &r_clk
144 SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _flags) 143#define P_CLK &div4_clks[DIV4_P]
144#define B_CLK &div4_clks[DIV4_B]
145#define U_CLK &div4_clks[DIV4_U]
145 146
146static struct clk mstp_clks[] = { 147static struct clk mstp_clks[] = {
147 MSTP("uram0", &div4_clks[DIV4_U], MSTPCR0, 28, CLK_ENABLE_ON_INIT), 148 SH_HWBLK_CLK("uram0", -1, U_CLK, HWBLK_URAM, CLK_ENABLE_ON_INIT),
148 MSTP("xymem0", &div4_clks[DIV4_B], MSTPCR0, 26, CLK_ENABLE_ON_INIT), 149 SH_HWBLK_CLK("xymem0", -1, B_CLK, HWBLK_XYMEM, CLK_ENABLE_ON_INIT),
149 MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0), 150 SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU, 0),
150 MSTP("cmt0", &r_clk, MSTPCR0, 14, 0), 151 SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
151 MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0), 152 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
152 MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0), 153 SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
153 MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0), 154 SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
154 MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0), 155 SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
155 MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0), 156 SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
156 157
157 MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0), 158 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0),
158 MSTP("rtc0", &r_clk, MSTPCR1, 8, 0), 159 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0),
159 160
160 MSTP("sdhi0", &div4_clks[DIV4_P], MSTPCR2, 18, 0), 161 SH_HWBLK_CLK("sdhi0", -1, P_CLK, HWBLK_SDHI, 0),
161 MSTP("keysc0", &r_clk, MSTPCR2, 14, 0), 162 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0),
162 MSTP("usbf0", &div4_clks[DIV4_P], MSTPCR2, 11, 0), 163 SH_HWBLK_CLK("usbf0", -1, P_CLK, HWBLK_USBF, 0),
163 MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 9, 0), 164 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0),
164 MSTP("siu0", &div4_clks[DIV4_B], MSTPCR2, 8, 0), 165 SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0),
165 MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0), 166 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0),
166 MSTP("jpu0", &div4_clks[DIV4_B], MSTPCR2, 6, CLK_ENABLE_ON_INIT), 167 SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, 0),
167 MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0), 168 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0),
168 MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0), 169 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0),
169 MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, CLK_ENABLE_ON_INIT), 170 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU, 0),
170 MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, CLK_ENABLE_ON_INIT), 171 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0),
171 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0), 172 SH_HWBLK_CLK("lcdc0", -1, P_CLK, HWBLK_LCDC, 0),
172}; 173};
173 174
174int __init arch_clk_init(void) 175int __init arch_clk_init(void)
@@ -191,7 +192,7 @@ int __init arch_clk_init(void)
191 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 192 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks));
192 193
193 if (!ret) 194 if (!ret)
194 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 195 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks));
195 196
196 return ret; 197 return ret;
197} 198}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
index e67c2678b8a..20a31c2255a 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c
@@ -22,6 +22,8 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clock.h> 24#include <asm/clock.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7723.h>
25 27
26/* SH7723 registers */ 28/* SH7723 registers */
27#define FRQCR 0xa4150000 29#define FRQCR 0xa4150000
@@ -30,9 +32,6 @@
30#define SCLKBCR 0xa415000c 32#define SCLKBCR 0xa415000c
31#define IRDACLKCR 0xa4150018 33#define IRDACLKCR 0xa4150018
32#define PLLCR 0xa4150024 34#define PLLCR 0xa4150024
33#define MSTPCR0 0xa4150030
34#define MSTPCR1 0xa4150034
35#define MSTPCR2 0xa4150038
36#define DLLFRQ 0xa4150050 35#define DLLFRQ 0xa4150050
37 36
38/* Fixed 32 KHz root clock for RTC and Power Management purposes */ 37/* Fixed 32 KHz root clock for RTC and Power Management purposes */
@@ -140,60 +139,64 @@ struct clk div6_clks[] = {
140 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), 139 SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0),
141}; 140};
142 141
143#define MSTP(_str, _parent, _reg, _bit, _force_on, _need_cpg, _need_ram) \ 142#define R_CLK (&r_clk)
144 SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _force_on * CLK_ENABLE_ON_INIT) 143#define P_CLK (&div4_clks[DIV4_P])
144#define B_CLK (&div4_clks[DIV4_B])
145#define U_CLK (&div4_clks[DIV4_U])
146#define I_CLK (&div4_clks[DIV4_I])
147#define SH_CLK (&div4_clks[DIV4_SH])
145 148
146static struct clk mstp_clks[] = { 149static struct clk mstp_clks[] = {
147 /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */ 150 /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */
148 MSTP("tlb0", &div4_clks[DIV4_I], MSTPCR0, 31, 1, 1, 0), 151 SH_HWBLK_CLK("tlb0", -1, I_CLK, HWBLK_TLB, CLK_ENABLE_ON_INIT),
149 MSTP("ic0", &div4_clks[DIV4_I], MSTPCR0, 30, 1, 1, 0), 152 SH_HWBLK_CLK("ic0", -1, I_CLK, HWBLK_IC, CLK_ENABLE_ON_INIT),
150 MSTP("oc0", &div4_clks[DIV4_I], MSTPCR0, 29, 1, 1, 0), 153 SH_HWBLK_CLK("oc0", -1, I_CLK, HWBLK_OC, CLK_ENABLE_ON_INIT),
151 MSTP("l2c0", &div4_clks[DIV4_SH], MSTPCR0, 28, 1, 1, 0), 154 SH_HWBLK_CLK("l2c0", -1, SH_CLK, HWBLK_L2C, CLK_ENABLE_ON_INIT),
152 MSTP("ilmem0", &div4_clks[DIV4_I], MSTPCR0, 27, 1, 1, 0), 155 SH_HWBLK_CLK("ilmem0", -1, I_CLK, HWBLK_ILMEM, CLK_ENABLE_ON_INIT),
153 MSTP("fpu0", &div4_clks[DIV4_I], MSTPCR0, 24, 1, 1, 0), 156 SH_HWBLK_CLK("fpu0", -1, I_CLK, HWBLK_FPU, CLK_ENABLE_ON_INIT),
154 MSTP("intc0", &div4_clks[DIV4_I], MSTPCR0, 22, 1, 1, 0), 157 SH_HWBLK_CLK("intc0", -1, I_CLK, HWBLK_INTC, CLK_ENABLE_ON_INIT),
155 MSTP("dmac0", &div4_clks[DIV4_B], MSTPCR0, 21, 0, 1, 1), 158 SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0),
156 MSTP("sh0", &div4_clks[DIV4_SH], MSTPCR0, 20, 0, 1, 0), 159 SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT),
157 MSTP("hudi0", &div4_clks[DIV4_P], MSTPCR0, 19, 0, 1, 0), 160 SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0),
158 MSTP("ubc0", &div4_clks[DIV4_I], MSTPCR0, 17, 0, 1, 0), 161 SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0),
159 MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0, 1, 0), 162 SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0),
160 MSTP("cmt0", &r_clk, MSTPCR0, 14, 0, 0, 0), 163 SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
161 MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0, 0, 0), 164 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
162 MSTP("dmac1", &div4_clks[DIV4_B], MSTPCR0, 12, 0, 1, 1), 165 SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
163 MSTP("tmu1", &div4_clks[DIV4_P], MSTPCR0, 11, 0, 1, 0), 166 SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
164 MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0), 167 SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0),
165 MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 9, 0, 1, 0), 168 SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
166 MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 8, 0, 1, 0), 169 SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
167 MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 7, 0, 1, 0), 170 SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
168 MSTP("scif3", &div4_clks[DIV4_B], MSTPCR0, 6, 0, 1, 0), 171 SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
169 MSTP("scif4", &div4_clks[DIV4_B], MSTPCR0, 5, 0, 1, 0), 172 SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
170 MSTP("scif5", &div4_clks[DIV4_B], MSTPCR0, 4, 0, 1, 0), 173 SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
171 MSTP("msiof0", &div4_clks[DIV4_B], MSTPCR0, 2, 0, 1, 0), 174 SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
172 MSTP("msiof1", &div4_clks[DIV4_B], MSTPCR0, 1, 0, 1, 0), 175 SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
173 MSTP("meram0", &div4_clks[DIV4_SH], MSTPCR0, 0, 1, 1, 0), 176 SH_HWBLK_CLK("meram0", -1, SH_CLK, HWBLK_MERAM, 0),
174 177
175 MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0, 1, 0), 178 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0),
176 MSTP("rtc0", &r_clk, MSTPCR1, 8, 0, 0, 0), 179 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0),
177 180
178 MSTP("atapi0", &div4_clks[DIV4_SH], MSTPCR2, 28, 0, 1, 0), 181 SH_HWBLK_CLK("atapi0", -1, SH_CLK, HWBLK_ATAPI, 0),
179 MSTP("adc0", &div4_clks[DIV4_P], MSTPCR2, 27, 0, 1, 0), 182 SH_HWBLK_CLK("adc0", -1, P_CLK, HWBLK_ADC, 0),
180 MSTP("tpu0", &div4_clks[DIV4_B], MSTPCR2, 25, 0, 1, 0), 183 SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0),
181 MSTP("irda0", &div4_clks[DIV4_P], MSTPCR2, 24, 0, 1, 0), 184 SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0),
182 MSTP("tsif0", &div4_clks[DIV4_B], MSTPCR2, 22, 0, 1, 0), 185 SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0),
183 MSTP("icb0", &div4_clks[DIV4_B], MSTPCR2, 21, 0, 1, 1), 186 SH_HWBLK_CLK("icb0", -1, B_CLK, HWBLK_ICB, CLK_ENABLE_ON_INIT),
184 MSTP("sdhi0", &div4_clks[DIV4_B], MSTPCR2, 18, 0, 1, 0), 187 SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0),
185 MSTP("sdhi1", &div4_clks[DIV4_B], MSTPCR2, 17, 0, 1, 0), 188 SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0),
186 MSTP("keysc0", &r_clk, MSTPCR2, 14, 0, 0, 0), 189 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0),
187 MSTP("usb0", &div4_clks[DIV4_B], MSTPCR2, 11, 0, 1, 0), 190 SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB, 0),
188 MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 10, 0, 1, 1), 191 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0),
189 MSTP("siu0", &div4_clks[DIV4_B], MSTPCR2, 8, 0, 1, 0), 192 SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0),
190 MSTP("veu1", &div4_clks[DIV4_B], MSTPCR2, 6, 1, 1, 1), 193 SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU2H1, 0),
191 MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0, 1, 1), 194 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0),
192 MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0, 1, 1), 195 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0),
193 MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0, 1, 1), 196 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0),
194 MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, 1, 1, 1), 197 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU2H0, 0),
195 MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, 1, 1, 1), 198 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0),
196 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0, 1, 1), 199 SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0),
197}; 200};
198 201
199int __init arch_clk_init(void) 202int __init arch_clk_init(void)
@@ -216,7 +219,7 @@ int __init arch_clk_init(void)
216 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 219 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks));
217 220
218 if (!ret) 221 if (!ret)
219 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 222 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks));
220 223
221 return ret; 224 return ret;
222} 225}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
index 5d5c9b95288..dfe9192be63 100644
--- a/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7724.c
@@ -22,6 +22,8 @@
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <asm/clock.h> 24#include <asm/clock.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7724.h>
25 27
26/* SH7724 registers */ 28/* SH7724 registers */
27#define FRQCRA 0xa4150000 29#define FRQCRA 0xa4150000
@@ -31,9 +33,6 @@
31#define FCLKBCR 0xa415000c 33#define FCLKBCR 0xa415000c
32#define IRDACLKCR 0xa4150018 34#define IRDACLKCR 0xa4150018
33#define PLLCR 0xa4150024 35#define PLLCR 0xa4150024
34#define MSTPCR0 0xa4150030
35#define MSTPCR1 0xa4150034
36#define MSTPCR2 0xa4150038
37#define SPUCLKCR 0xa415003c 36#define SPUCLKCR 0xa415003c
38#define FLLFRQ 0xa4150050 37#define FLLFRQ 0xa4150050
39#define LSTATS 0xa4150060 38#define LSTATS 0xa4150060
@@ -128,7 +127,7 @@ struct clk *main_clks[] = {
128 &div3_clk, 127 &div3_clk,
129}; 128};
130 129
131static int divisors[] = { 2, 0, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 }; 130static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 0, 24, 32, 36, 48, 0, 72 };
132 131
133static struct clk_div_mult_table div4_table = { 132static struct clk_div_mult_table div4_table = {
134 .divisors = divisors, 133 .divisors = divisors,
@@ -156,64 +155,67 @@ struct clk div6_clks[] = {
156 SH_CLK_DIV6("spu_clk", &div3_clk, SPUCLKCR, 0), 155 SH_CLK_DIV6("spu_clk", &div3_clk, SPUCLKCR, 0),
157}; 156};
158 157
159#define MSTP(_str, _parent, _reg, _bit, _force_on, _need_cpg, _need_ram) \ 158#define R_CLK (&r_clk)
160 SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _force_on * CLK_ENABLE_ON_INIT) 159#define P_CLK (&div4_clks[DIV4_P])
160#define B_CLK (&div4_clks[DIV4_B])
161#define I_CLK (&div4_clks[DIV4_I])
162#define SH_CLK (&div4_clks[DIV4_SH])
161 163
162static struct clk mstp_clks[] = { 164static struct clk mstp_clks[] = {
163 MSTP("tlb0", &div4_clks[DIV4_I], MSTPCR0, 31, 1, 1, 0), 165 SH_HWBLK_CLK("tlb0", -1, I_CLK, HWBLK_TLB, CLK_ENABLE_ON_INIT),
164 MSTP("ic0", &div4_clks[DIV4_I], MSTPCR0, 30, 1, 1, 0), 166 SH_HWBLK_CLK("ic0", -1, I_CLK, HWBLK_IC, CLK_ENABLE_ON_INIT),
165 MSTP("oc0", &div4_clks[DIV4_I], MSTPCR0, 29, 1, 1, 0), 167 SH_HWBLK_CLK("oc0", -1, I_CLK, HWBLK_OC, CLK_ENABLE_ON_INIT),
166 MSTP("rs0", &div4_clks[DIV4_B], MSTPCR0, 28, 1, 1, 0), 168 SH_HWBLK_CLK("rs0", -1, B_CLK, HWBLK_RSMEM, CLK_ENABLE_ON_INIT),
167 MSTP("ilmem0", &div4_clks[DIV4_I], MSTPCR0, 27, 1, 1, 0), 169 SH_HWBLK_CLK("ilmem0", -1, I_CLK, HWBLK_ILMEM, CLK_ENABLE_ON_INIT),
168 MSTP("l2c0", &div4_clks[DIV4_SH], MSTPCR0, 26, 1, 1, 0), 170 SH_HWBLK_CLK("l2c0", -1, SH_CLK, HWBLK_L2C, CLK_ENABLE_ON_INIT),
169 MSTP("fpu0", &div4_clks[DIV4_I], MSTPCR0, 24, 1, 1, 0), 171 SH_HWBLK_CLK("fpu0", -1, I_CLK, HWBLK_FPU, CLK_ENABLE_ON_INIT),
170 MSTP("intc0", &div4_clks[DIV4_P], MSTPCR0, 22, 1, 1, 0), 172 SH_HWBLK_CLK("intc0", -1, P_CLK, HWBLK_INTC, CLK_ENABLE_ON_INIT),
171 MSTP("dmac0", &div4_clks[DIV4_B], MSTPCR0, 21, 0, 1, 1), 173 SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0),
172 MSTP("sh0", &div4_clks[DIV4_SH], MSTPCR0, 20, 0, 1, 0), 174 SH_HWBLK_CLK("sh0", -1, SH_CLK, HWBLK_SHYWAY, CLK_ENABLE_ON_INIT),
173 MSTP("hudi0", &div4_clks[DIV4_P], MSTPCR0, 19, 0, 1, 0), 175 SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0),
174 MSTP("ubc0", &div4_clks[DIV4_I], MSTPCR0, 17, 0, 1, 0), 176 SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0),
175 MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0, 1, 0), 177 SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0),
176 MSTP("cmt0", &r_clk, MSTPCR0, 14, 0, 0, 0), 178 SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0),
177 MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0, 0, 0), 179 SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0),
178 MSTP("dmac1", &div4_clks[DIV4_B], MSTPCR0, 12, 0, 1, 1), 180 SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0),
179 MSTP("tmu1", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0), 181 SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0),
180 MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 9, 0, 1, 0), 182 SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0),
181 MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 8, 0, 1, 0), 183 SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0),
182 MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 7, 0, 1, 0), 184 SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0),
183 MSTP("scif3", &div4_clks[DIV4_B], MSTPCR0, 6, 0, 1, 0), 185 SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0),
184 MSTP("scif4", &div4_clks[DIV4_B], MSTPCR0, 5, 0, 1, 0), 186 SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0),
185 MSTP("scif5", &div4_clks[DIV4_B], MSTPCR0, 4, 0, 1, 0), 187 SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0),
186 MSTP("msiof0", &div4_clks[DIV4_B], MSTPCR0, 2, 0, 1, 0), 188 SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0),
187 MSTP("msiof1", &div4_clks[DIV4_B], MSTPCR0, 1, 0, 1, 0), 189 SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0),
188 190
189 MSTP("keysc0", &r_clk, MSTPCR1, 12, 0, 0, 0), 191 SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0),
190 MSTP("rtc0", &r_clk, MSTPCR1, 11, 0, 0, 0), 192 SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0),
191 MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0, 1, 0), 193 SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC0, 0),
192 MSTP("i2c1", &div4_clks[DIV4_P], MSTPCR1, 8, 0, 1, 0), 194 SH_HWBLK_CLK("i2c1", -1, P_CLK, HWBLK_IIC1, 0),
193 195
194 MSTP("mmc0", &div4_clks[DIV4_B], MSTPCR2, 29, 0, 1, 0), 196 SH_HWBLK_CLK("mmc0", -1, B_CLK, HWBLK_MMC, 0),
195 MSTP("eth0", &div4_clks[DIV4_B], MSTPCR2, 28, 0, 1, 0), 197 SH_HWBLK_CLK("eth0", -1, B_CLK, HWBLK_ETHER, 0),
196 MSTP("atapi0", &div4_clks[DIV4_B], MSTPCR2, 26, 0, 1, 0), 198 SH_HWBLK_CLK("atapi0", -1, B_CLK, HWBLK_ATAPI, 0),
197 MSTP("tpu0", &div4_clks[DIV4_B], MSTPCR2, 25, 0, 1, 0), 199 SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0),
198 MSTP("irda0", &div4_clks[DIV4_P], MSTPCR2, 24, 0, 1, 0), 200 SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0),
199 MSTP("tsif0", &div4_clks[DIV4_B], MSTPCR2, 22, 0, 1, 0), 201 SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0),
200 MSTP("usb1", &div4_clks[DIV4_B], MSTPCR2, 21, 0, 1, 1), 202 SH_HWBLK_CLK("usb1", -1, B_CLK, HWBLK_USB1, 0),
201 MSTP("usb0", &div4_clks[DIV4_B], MSTPCR2, 20, 0, 1, 1), 203 SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB0, 0),
202 MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 19, 0, 1, 1), 204 SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0),
203 MSTP("sdhi0", &div4_clks[DIV4_B], MSTPCR2, 18, 0, 1, 0), 205 SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0),
204 MSTP("sdhi1", &div4_clks[DIV4_B], MSTPCR2, 17, 0, 1, 0), 206 SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0),
205 MSTP("veu1", &div4_clks[DIV4_B], MSTPCR2, 15, 1, 1, 1), 207 SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU1, 0),
206 MSTP("ceu1", &div4_clks[DIV4_B], MSTPCR2, 13, 0, 1, 1), 208 SH_HWBLK_CLK("ceu1", -1, B_CLK, HWBLK_CEU1, 0),
207 MSTP("beu1", &div4_clks[DIV4_B], MSTPCR2, 12, 0, 1, 1), 209 SH_HWBLK_CLK("beu1", -1, B_CLK, HWBLK_BEU1, 0),
208 MSTP("2ddmac0", &div4_clks[DIV4_SH], MSTPCR2, 10, 0, 1, 1), 210 SH_HWBLK_CLK("2ddmac0", -1, SH_CLK, HWBLK_2DDMAC, 0),
209 MSTP("spu0", &div4_clks[DIV4_B], MSTPCR2, 9, 0, 1, 0), 211 SH_HWBLK_CLK("spu0", -1, B_CLK, HWBLK_SPU, 0),
210 MSTP("jpu0", &div4_clks[DIV4_B], MSTPCR2, 6, 1, 1, 1), 212 SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, 0),
211 MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0, 1, 1), 213 SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0),
212 MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0, 1, 1), 214 SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU0, 0),
213 MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0, 1, 1), 215 SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU0, 0),
214 MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, 1, 1, 1), 216 SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU0, 0),
215 MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, 1, 1, 1), 217 SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, 0),
216 MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0, 1, 1), 218 SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0),
217}; 219};
218 220
219int __init arch_clk_init(void) 221int __init arch_clk_init(void)
@@ -236,7 +238,7 @@ int __init arch_clk_init(void)
236 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); 238 ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks));
237 239
238 if (!ret) 240 if (!ret)
239 ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); 241 ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks));
240 242
241 return ret; 243 return ret;
242} 244}
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7757.c b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
new file mode 100644
index 00000000000..ddc235ca966
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/clock-sh7757.c
@@ -0,0 +1,130 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh7757.c
3 *
4 * SH7757 support for the clock framework
5 *
6 * Copyright (C) 2009 Renesas Solutions Corp.
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <asm/clock.h>
16#include <asm/freq.h>
17
18static int ifc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1,
19 16, 1, 1, 32, 1, 1, 1, 1 };
20static int sfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1,
21 16, 1, 1, 32, 1, 1, 1, 1 };
22static int bfc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1,
23 16, 1, 1, 32, 1, 1, 1, 1 };
24static int p1fc_divisors[] = { 2, 1, 4, 1, 1, 8, 1, 1,
25 16, 1, 1, 32, 1, 1, 1, 1 };
26
27static void master_clk_init(struct clk *clk)
28{
29 clk->rate = CONFIG_SH_PCLK_FREQ * 16;
30}
31
32static struct clk_ops sh7757_master_clk_ops = {
33 .init = master_clk_init,
34};
35
36static void module_clk_recalc(struct clk *clk)
37{
38 int idx = ctrl_inl(FRQCR) & 0x0000000f;
39 clk->rate = clk->parent->rate / p1fc_divisors[idx];
40}
41
42static struct clk_ops sh7757_module_clk_ops = {
43 .recalc = module_clk_recalc,
44};
45
46static void bus_clk_recalc(struct clk *clk)
47{
48 int idx = (ctrl_inl(FRQCR) >> 8) & 0x0000000f;
49 clk->rate = clk->parent->rate / bfc_divisors[idx];
50}
51
52static struct clk_ops sh7757_bus_clk_ops = {
53 .recalc = bus_clk_recalc,
54};
55
56static void cpu_clk_recalc(struct clk *clk)
57{
58 int idx = (ctrl_inl(FRQCR) >> 20) & 0x0000000f;
59 clk->rate = clk->parent->rate / ifc_divisors[idx];
60}
61
62static struct clk_ops sh7757_cpu_clk_ops = {
63 .recalc = cpu_clk_recalc,
64};
65
66static struct clk_ops *sh7757_clk_ops[] = {
67 &sh7757_master_clk_ops,
68 &sh7757_module_clk_ops,
69 &sh7757_bus_clk_ops,
70 &sh7757_cpu_clk_ops,
71};
72
73void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
74{
75 if (idx < ARRAY_SIZE(sh7757_clk_ops))
76 *ops = sh7757_clk_ops[idx];
77}
78
79static void shyway_clk_recalc(struct clk *clk)
80{
81 int idx = (ctrl_inl(FRQCR) >> 12) & 0x0000000f;
82 clk->rate = clk->parent->rate / sfc_divisors[idx];
83}
84
85static struct clk_ops sh7757_shyway_clk_ops = {
86 .recalc = shyway_clk_recalc,
87};
88
89static struct clk sh7757_shyway_clk = {
90 .name = "shyway_clk",
91 .flags = CLK_ENABLE_ON_INIT,
92 .ops = &sh7757_shyway_clk_ops,
93};
94
95/*
96 * Additional sh7757-specific on-chip clocks that aren't already part of the
97 * clock framework
98 */
99static struct clk *sh7757_onchip_clocks[] = {
100 &sh7757_shyway_clk,
101};
102
103static int __init sh7757_clk_init(void)
104{
105 struct clk *clk = clk_get(NULL, "master_clk");
106 int i;
107
108 for (i = 0; i < ARRAY_SIZE(sh7757_onchip_clocks); i++) {
109 struct clk *clkp = sh7757_onchip_clocks[i];
110
111 clkp->parent = clk;
112 clk_register(clkp);
113 clk_enable(clkp);
114 }
115
116 /*
117 * Now that we have the rest of the clocks registered, we need to
118 * force the parent clock to propagate so that these clocks will
119 * automatically figure out their rate. We cheat by handing the
120 * parent clock its current rate and forcing child propagation.
121 */
122 clk_set_rate(clk, clk_get_rate(clk));
123
124 clk_put(clk);
125
126 return 0;
127}
128
129arch_initcall(sh7757_clk_init);
130
diff --git a/arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c b/arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c
new file mode 100644
index 00000000000..a288b5d9234
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c
@@ -0,0 +1,106 @@
1/*
2 * arch/sh/kernel/cpu/sh4a/hwblk-sh7722.c
3 *
4 * SH7722 hardware block support
5 *
6 * Copyright (C) 2009 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/io.h>
24#include <asm/suspend.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7722.h>
27
28/* SH7722 registers */
29#define MSTPCR0 0xa4150030
30#define MSTPCR1 0xa4150034
31#define MSTPCR2 0xa4150038
32
33/* SH7722 Power Domains */
34enum { CORE_AREA, SUB_AREA, CORE_AREA_BM };
35static struct hwblk_area sh7722_hwblk_area[] = {
36 [CORE_AREA] = HWBLK_AREA(0, 0),
37 [CORE_AREA_BM] = HWBLK_AREA(HWBLK_AREA_FLAG_PARENT, CORE_AREA),
38 [SUB_AREA] = HWBLK_AREA(0, 0),
39};
40
41/* Table mapping HWBLK to Module Stop Bit and Power Domain */
42static struct hwblk sh7722_hwblk[HWBLK_NR] = {
43 [HWBLK_TLB] = HWBLK(MSTPCR0, 31, CORE_AREA),
44 [HWBLK_IC] = HWBLK(MSTPCR0, 30, CORE_AREA),
45 [HWBLK_OC] = HWBLK(MSTPCR0, 29, CORE_AREA),
46 [HWBLK_URAM] = HWBLK(MSTPCR0, 28, CORE_AREA),
47 [HWBLK_XYMEM] = HWBLK(MSTPCR0, 26, CORE_AREA),
48 [HWBLK_INTC] = HWBLK(MSTPCR0, 22, CORE_AREA),
49 [HWBLK_DMAC] = HWBLK(MSTPCR0, 21, CORE_AREA_BM),
50 [HWBLK_SHYWAY] = HWBLK(MSTPCR0, 20, CORE_AREA),
51 [HWBLK_HUDI] = HWBLK(MSTPCR0, 19, CORE_AREA),
52 [HWBLK_UBC] = HWBLK(MSTPCR0, 17, CORE_AREA),
53 [HWBLK_TMU] = HWBLK(MSTPCR0, 15, CORE_AREA),
54 [HWBLK_CMT] = HWBLK(MSTPCR0, 14, SUB_AREA),
55 [HWBLK_RWDT] = HWBLK(MSTPCR0, 13, SUB_AREA),
56 [HWBLK_FLCTL] = HWBLK(MSTPCR0, 10, CORE_AREA),
57 [HWBLK_SCIF0] = HWBLK(MSTPCR0, 7, CORE_AREA),
58 [HWBLK_SCIF1] = HWBLK(MSTPCR0, 6, CORE_AREA),
59 [HWBLK_SCIF2] = HWBLK(MSTPCR0, 5, CORE_AREA),
60 [HWBLK_SIO] = HWBLK(MSTPCR0, 3, CORE_AREA),
61 [HWBLK_SIOF0] = HWBLK(MSTPCR0, 2, CORE_AREA),
62 [HWBLK_SIOF1] = HWBLK(MSTPCR0, 1, CORE_AREA),
63
64 [HWBLK_IIC] = HWBLK(MSTPCR1, 9, CORE_AREA),
65 [HWBLK_RTC] = HWBLK(MSTPCR1, 8, SUB_AREA),
66
67 [HWBLK_TPU] = HWBLK(MSTPCR2, 25, CORE_AREA),
68 [HWBLK_IRDA] = HWBLK(MSTPCR2, 24, CORE_AREA),
69 [HWBLK_SDHI] = HWBLK(MSTPCR2, 18, CORE_AREA),
70 [HWBLK_SIM] = HWBLK(MSTPCR2, 16, CORE_AREA),
71 [HWBLK_KEYSC] = HWBLK(MSTPCR2, 14, SUB_AREA),
72 [HWBLK_TSIF] = HWBLK(MSTPCR2, 13, SUB_AREA),
73 [HWBLK_USBF] = HWBLK(MSTPCR2, 11, CORE_AREA),
74 [HWBLK_2DG] = HWBLK(MSTPCR2, 9, CORE_AREA_BM),
75 [HWBLK_SIU] = HWBLK(MSTPCR2, 8, CORE_AREA),
76 [HWBLK_JPU] = HWBLK(MSTPCR2, 6, CORE_AREA_BM),
77 [HWBLK_VOU] = HWBLK(MSTPCR2, 5, CORE_AREA_BM),
78 [HWBLK_BEU] = HWBLK(MSTPCR2, 4, CORE_AREA_BM),
79 [HWBLK_CEU] = HWBLK(MSTPCR2, 3, CORE_AREA_BM),
80 [HWBLK_VEU] = HWBLK(MSTPCR2, 2, CORE_AREA_BM),
81 [HWBLK_VPU] = HWBLK(MSTPCR2, 1, CORE_AREA_BM),
82 [HWBLK_LCDC] = HWBLK(MSTPCR2, 0, CORE_AREA_BM),
83};
84
85static struct hwblk_info sh7722_hwblk_info = {
86 .areas = sh7722_hwblk_area,
87 .nr_areas = ARRAY_SIZE(sh7722_hwblk_area),
88 .hwblks = sh7722_hwblk,
89 .nr_hwblks = ARRAY_SIZE(sh7722_hwblk),
90};
91
92int arch_hwblk_sleep_mode(void)
93{
94 if (!sh7722_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE])
95 return SUSP_SH_STANDBY | SUSP_SH_SF;
96
97 if (!sh7722_hwblk_area[CORE_AREA_BM].cnt[HWBLK_CNT_USAGE])
98 return SUSP_SH_SLEEP | SUSP_SH_SF;
99
100 return SUSP_SH_SLEEP;
101}
102
103int __init arch_hwblk_init(void)
104{
105 return hwblk_register(&sh7722_hwblk_info);
106}
diff --git a/arch/sh/kernel/cpu/sh4a/hwblk-sh7723.c b/arch/sh/kernel/cpu/sh4a/hwblk-sh7723.c
new file mode 100644
index 00000000000..a7f4684d203
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/hwblk-sh7723.c
@@ -0,0 +1,117 @@
1/*
2 * arch/sh/kernel/cpu/sh4a/hwblk-sh7723.c
3 *
4 * SH7723 hardware block support
5 *
6 * Copyright (C) 2009 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/io.h>
24#include <asm/suspend.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7723.h>
27
28/* SH7723 registers */
29#define MSTPCR0 0xa4150030
30#define MSTPCR1 0xa4150034
31#define MSTPCR2 0xa4150038
32
33/* SH7723 Power Domains */
34enum { CORE_AREA, SUB_AREA, CORE_AREA_BM };
35static struct hwblk_area sh7723_hwblk_area[] = {
36 [CORE_AREA] = HWBLK_AREA(0, 0),
37 [CORE_AREA_BM] = HWBLK_AREA(HWBLK_AREA_FLAG_PARENT, CORE_AREA),
38 [SUB_AREA] = HWBLK_AREA(0, 0),
39};
40
41/* Table mapping HWBLK to Module Stop Bit and Power Domain */
42static struct hwblk sh7723_hwblk[HWBLK_NR] = {
43 [HWBLK_TLB] = HWBLK(MSTPCR0, 31, CORE_AREA),
44 [HWBLK_IC] = HWBLK(MSTPCR0, 30, CORE_AREA),
45 [HWBLK_OC] = HWBLK(MSTPCR0, 29, CORE_AREA),
46 [HWBLK_L2C] = HWBLK(MSTPCR0, 28, CORE_AREA),
47 [HWBLK_ILMEM] = HWBLK(MSTPCR0, 27, CORE_AREA),
48 [HWBLK_FPU] = HWBLK(MSTPCR0, 24, CORE_AREA),
49 [HWBLK_INTC] = HWBLK(MSTPCR0, 22, CORE_AREA),
50 [HWBLK_DMAC0] = HWBLK(MSTPCR0, 21, CORE_AREA_BM),
51 [HWBLK_SHYWAY] = HWBLK(MSTPCR0, 20, CORE_AREA),
52 [HWBLK_HUDI] = HWBLK(MSTPCR0, 19, CORE_AREA),
53 [HWBLK_DBG] = HWBLK(MSTPCR0, 18, CORE_AREA),
54 [HWBLK_UBC] = HWBLK(MSTPCR0, 17, CORE_AREA),
55 [HWBLK_SUBC] = HWBLK(MSTPCR0, 16, CORE_AREA),
56 [HWBLK_TMU0] = HWBLK(MSTPCR0, 15, CORE_AREA),
57 [HWBLK_CMT] = HWBLK(MSTPCR0, 14, SUB_AREA),
58 [HWBLK_RWDT] = HWBLK(MSTPCR0, 13, SUB_AREA),
59 [HWBLK_DMAC1] = HWBLK(MSTPCR0, 12, CORE_AREA_BM),
60 [HWBLK_TMU1] = HWBLK(MSTPCR0, 11, CORE_AREA),
61 [HWBLK_FLCTL] = HWBLK(MSTPCR0, 10, CORE_AREA),
62 [HWBLK_SCIF0] = HWBLK(MSTPCR0, 9, CORE_AREA),
63 [HWBLK_SCIF1] = HWBLK(MSTPCR0, 8, CORE_AREA),
64 [HWBLK_SCIF2] = HWBLK(MSTPCR0, 7, CORE_AREA),
65 [HWBLK_SCIF3] = HWBLK(MSTPCR0, 6, CORE_AREA),
66 [HWBLK_SCIF4] = HWBLK(MSTPCR0, 5, CORE_AREA),
67 [HWBLK_SCIF5] = HWBLK(MSTPCR0, 4, CORE_AREA),
68 [HWBLK_MSIOF0] = HWBLK(MSTPCR0, 2, CORE_AREA),
69 [HWBLK_MSIOF1] = HWBLK(MSTPCR0, 1, CORE_AREA),
70 [HWBLK_MERAM] = HWBLK(MSTPCR0, 0, CORE_AREA),
71
72 [HWBLK_IIC] = HWBLK(MSTPCR1, 9, CORE_AREA),
73 [HWBLK_RTC] = HWBLK(MSTPCR1, 8, SUB_AREA),
74
75 [HWBLK_ATAPI] = HWBLK(MSTPCR2, 28, CORE_AREA_BM),
76 [HWBLK_ADC] = HWBLK(MSTPCR2, 27, CORE_AREA),
77 [HWBLK_TPU] = HWBLK(MSTPCR2, 25, CORE_AREA),
78 [HWBLK_IRDA] = HWBLK(MSTPCR2, 24, CORE_AREA),
79 [HWBLK_TSIF] = HWBLK(MSTPCR2, 22, CORE_AREA),
80 [HWBLK_ICB] = HWBLK(MSTPCR2, 21, CORE_AREA_BM),
81 [HWBLK_SDHI0] = HWBLK(MSTPCR2, 18, CORE_AREA),
82 [HWBLK_SDHI1] = HWBLK(MSTPCR2, 17, CORE_AREA),
83 [HWBLK_KEYSC] = HWBLK(MSTPCR2, 14, SUB_AREA),
84 [HWBLK_USB] = HWBLK(MSTPCR2, 11, CORE_AREA),
85 [HWBLK_2DG] = HWBLK(MSTPCR2, 10, CORE_AREA_BM),
86 [HWBLK_SIU] = HWBLK(MSTPCR2, 8, CORE_AREA),
87 [HWBLK_VEU2H1] = HWBLK(MSTPCR2, 6, CORE_AREA_BM),
88 [HWBLK_VOU] = HWBLK(MSTPCR2, 5, CORE_AREA_BM),
89 [HWBLK_BEU] = HWBLK(MSTPCR2, 4, CORE_AREA_BM),
90 [HWBLK_CEU] = HWBLK(MSTPCR2, 3, CORE_AREA_BM),
91 [HWBLK_VEU2H0] = HWBLK(MSTPCR2, 2, CORE_AREA_BM),
92 [HWBLK_VPU] = HWBLK(MSTPCR2, 1, CORE_AREA_BM),
93 [HWBLK_LCDC] = HWBLK(MSTPCR2, 0, CORE_AREA_BM),
94};
95
96static struct hwblk_info sh7723_hwblk_info = {
97 .areas = sh7723_hwblk_area,
98 .nr_areas = ARRAY_SIZE(sh7723_hwblk_area),
99 .hwblks = sh7723_hwblk,
100 .nr_hwblks = ARRAY_SIZE(sh7723_hwblk),
101};
102
103int arch_hwblk_sleep_mode(void)
104{
105 if (!sh7723_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE])
106 return SUSP_SH_STANDBY | SUSP_SH_SF;
107
108 if (!sh7723_hwblk_area[CORE_AREA_BM].cnt[HWBLK_CNT_USAGE])
109 return SUSP_SH_SLEEP | SUSP_SH_SF;
110
111 return SUSP_SH_SLEEP;
112}
113
114int __init arch_hwblk_init(void)
115{
116 return hwblk_register(&sh7723_hwblk_info);
117}
diff --git a/arch/sh/kernel/cpu/sh4a/hwblk-sh7724.c b/arch/sh/kernel/cpu/sh4a/hwblk-sh7724.c
new file mode 100644
index 00000000000..1613ad6013c
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/hwblk-sh7724.c
@@ -0,0 +1,121 @@
1/*
2 * arch/sh/kernel/cpu/sh4a/hwblk-sh7724.c
3 *
4 * SH7724 hardware block support
5 *
6 * Copyright (C) 2009 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22#include <linux/kernel.h>
23#include <linux/io.h>
24#include <asm/suspend.h>
25#include <asm/hwblk.h>
26#include <cpu/sh7724.h>
27
28/* SH7724 registers */
29#define MSTPCR0 0xa4150030
30#define MSTPCR1 0xa4150034
31#define MSTPCR2 0xa4150038
32
33/* SH7724 Power Domains */
34enum { CORE_AREA, SUB_AREA, CORE_AREA_BM };
35static struct hwblk_area sh7724_hwblk_area[] = {
36 [CORE_AREA] = HWBLK_AREA(0, 0),
37 [CORE_AREA_BM] = HWBLK_AREA(HWBLK_AREA_FLAG_PARENT, CORE_AREA),
38 [SUB_AREA] = HWBLK_AREA(0, 0),
39};
40
41/* Table mapping HWBLK to Module Stop Bit and Power Domain */
42static struct hwblk sh7724_hwblk[HWBLK_NR] = {
43 [HWBLK_TLB] = HWBLK(MSTPCR0, 31, CORE_AREA),
44 [HWBLK_IC] = HWBLK(MSTPCR0, 30, CORE_AREA),
45 [HWBLK_OC] = HWBLK(MSTPCR0, 29, CORE_AREA),
46 [HWBLK_RSMEM] = HWBLK(MSTPCR0, 28, CORE_AREA),
47 [HWBLK_ILMEM] = HWBLK(MSTPCR0, 27, CORE_AREA),
48 [HWBLK_L2C] = HWBLK(MSTPCR0, 26, CORE_AREA),
49 [HWBLK_FPU] = HWBLK(MSTPCR0, 24, CORE_AREA),
50 [HWBLK_INTC] = HWBLK(MSTPCR0, 22, CORE_AREA),
51 [HWBLK_DMAC0] = HWBLK(MSTPCR0, 21, CORE_AREA_BM),
52 [HWBLK_SHYWAY] = HWBLK(MSTPCR0, 20, CORE_AREA),
53 [HWBLK_HUDI] = HWBLK(MSTPCR0, 19, CORE_AREA),
54 [HWBLK_DBG] = HWBLK(MSTPCR0, 18, CORE_AREA),
55 [HWBLK_UBC] = HWBLK(MSTPCR0, 17, CORE_AREA),
56 [HWBLK_TMU0] = HWBLK(MSTPCR0, 15, CORE_AREA),
57 [HWBLK_CMT] = HWBLK(MSTPCR0, 14, SUB_AREA),
58 [HWBLK_RWDT] = HWBLK(MSTPCR0, 13, SUB_AREA),
59 [HWBLK_DMAC1] = HWBLK(MSTPCR0, 12, CORE_AREA_BM),
60 [HWBLK_TMU1] = HWBLK(MSTPCR0, 10, CORE_AREA),
61 [HWBLK_SCIF0] = HWBLK(MSTPCR0, 9, CORE_AREA),
62 [HWBLK_SCIF1] = HWBLK(MSTPCR0, 8, CORE_AREA),
63 [HWBLK_SCIF2] = HWBLK(MSTPCR0, 7, CORE_AREA),
64 [HWBLK_SCIF3] = HWBLK(MSTPCR0, 6, CORE_AREA),
65 [HWBLK_SCIF4] = HWBLK(MSTPCR0, 5, CORE_AREA),
66 [HWBLK_SCIF5] = HWBLK(MSTPCR0, 4, CORE_AREA),
67 [HWBLK_MSIOF0] = HWBLK(MSTPCR0, 2, CORE_AREA),
68 [HWBLK_MSIOF1] = HWBLK(MSTPCR0, 1, CORE_AREA),
69
70 [HWBLK_KEYSC] = HWBLK(MSTPCR1, 12, SUB_AREA),
71 [HWBLK_RTC] = HWBLK(MSTPCR1, 11, SUB_AREA),
72 [HWBLK_IIC0] = HWBLK(MSTPCR1, 9, CORE_AREA),
73 [HWBLK_IIC1] = HWBLK(MSTPCR1, 8, CORE_AREA),
74
75 [HWBLK_MMC] = HWBLK(MSTPCR2, 29, CORE_AREA),
76 [HWBLK_ETHER] = HWBLK(MSTPCR2, 28, CORE_AREA_BM),
77 [HWBLK_ATAPI] = HWBLK(MSTPCR2, 26, CORE_AREA_BM),
78 [HWBLK_TPU] = HWBLK(MSTPCR2, 25, CORE_AREA),
79 [HWBLK_IRDA] = HWBLK(MSTPCR2, 24, CORE_AREA),
80 [HWBLK_TSIF] = HWBLK(MSTPCR2, 22, CORE_AREA),
81 [HWBLK_USB1] = HWBLK(MSTPCR2, 21, CORE_AREA),
82 [HWBLK_USB0] = HWBLK(MSTPCR2, 20, CORE_AREA),
83 [HWBLK_2DG] = HWBLK(MSTPCR2, 19, CORE_AREA_BM),
84 [HWBLK_SDHI0] = HWBLK(MSTPCR2, 18, CORE_AREA),
85 [HWBLK_SDHI1] = HWBLK(MSTPCR2, 17, CORE_AREA),
86 [HWBLK_VEU1] = HWBLK(MSTPCR2, 15, CORE_AREA_BM),
87 [HWBLK_CEU1] = HWBLK(MSTPCR2, 13, CORE_AREA_BM),
88 [HWBLK_BEU1] = HWBLK(MSTPCR2, 12, CORE_AREA_BM),
89 [HWBLK_2DDMAC] = HWBLK(MSTPCR2, 10, CORE_AREA_BM),
90 [HWBLK_SPU] = HWBLK(MSTPCR2, 9, CORE_AREA_BM),
91 [HWBLK_JPU] = HWBLK(MSTPCR2, 6, CORE_AREA_BM),
92 [HWBLK_VOU] = HWBLK(MSTPCR2, 5, CORE_AREA_BM),
93 [HWBLK_BEU0] = HWBLK(MSTPCR2, 4, CORE_AREA_BM),
94 [HWBLK_CEU0] = HWBLK(MSTPCR2, 3, CORE_AREA_BM),
95 [HWBLK_VEU0] = HWBLK(MSTPCR2, 2, CORE_AREA_BM),
96 [HWBLK_VPU] = HWBLK(MSTPCR2, 1, CORE_AREA_BM),
97 [HWBLK_LCDC] = HWBLK(MSTPCR2, 0, CORE_AREA_BM),
98};
99
100static struct hwblk_info sh7724_hwblk_info = {
101 .areas = sh7724_hwblk_area,
102 .nr_areas = ARRAY_SIZE(sh7724_hwblk_area),
103 .hwblks = sh7724_hwblk,
104 .nr_hwblks = ARRAY_SIZE(sh7724_hwblk),
105};
106
107int arch_hwblk_sleep_mode(void)
108{
109 if (!sh7724_hwblk_area[CORE_AREA].cnt[HWBLK_CNT_USAGE])
110 return SUSP_SH_STANDBY | SUSP_SH_SF;
111
112 if (!sh7724_hwblk_area[CORE_AREA_BM].cnt[HWBLK_CNT_USAGE])
113 return SUSP_SH_SLEEP | SUSP_SH_SF;
114
115 return SUSP_SH_SLEEP;
116}
117
118int __init arch_hwblk_init(void)
119{
120 return hwblk_register(&sh7724_hwblk_info);
121}
diff --git a/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
new file mode 100644
index 00000000000..ed23b155c09
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/pinmux-sh7757.c
@@ -0,0 +1,2019 @@
1/*
2 * SH7757 (A0 step) Pinmux
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * Author : Yoshihiro Shimoda <shimoda.yoshihiro@renesas.com>
7 *
8 * Based on SH7757 Pinmux
9 * Copyright (C) 2008 Magnus Damm
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/gpio.h>
19#include <cpu/sh7757.h>
20
21enum {
22 PINMUX_RESERVED = 0,
23
24 PINMUX_DATA_BEGIN,
25 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
26 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA,
27 PTB7_DATA, PTB6_DATA, PTB5_DATA, PTB4_DATA,
28 PTB3_DATA, PTB2_DATA, PTB1_DATA, PTB0_DATA,
29 PTC7_DATA, PTC6_DATA, PTC5_DATA, PTC4_DATA,
30 PTC3_DATA, PTC2_DATA, PTC1_DATA, PTC0_DATA,
31 PTD7_DATA, PTD6_DATA, PTD5_DATA, PTD4_DATA,
32 PTD3_DATA, PTD2_DATA, PTD1_DATA, PTD0_DATA,
33 PTE7_DATA, PTE6_DATA, PTE5_DATA, PTE4_DATA,
34 PTE3_DATA, PTE2_DATA, PTE1_DATA, PTE0_DATA,
35 PTF7_DATA, PTF6_DATA, PTF5_DATA, PTF4_DATA,
36 PTF3_DATA, PTF2_DATA, PTF1_DATA, PTF0_DATA,
37 PTG7_DATA, PTG6_DATA, PTG5_DATA, PTG4_DATA,
38 PTG3_DATA, PTG2_DATA, PTG1_DATA, PTG0_DATA,
39 PTH7_DATA, PTH6_DATA, PTH5_DATA, PTH4_DATA,
40 PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA,
41 PTI7_DATA, PTI6_DATA, PTI5_DATA, PTI4_DATA,
42 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA,
43 PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, PTJ4_DATA,
44 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA,
45 PTK7_DATA, PTK6_DATA, PTK5_DATA, PTK4_DATA,
46 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA,
47 PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA,
48 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA,
49 PTM6_DATA, PTM5_DATA, PTM4_DATA,
50 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA,
51 PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA,
52 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA,
53 PTO7_DATA, PTO6_DATA, PTO5_DATA, PTO4_DATA,
54 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA,
55 PTP6_DATA, PTP5_DATA, PTP4_DATA,
56 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA,
57 PTQ6_DATA, PTQ5_DATA, PTQ4_DATA,
58 PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA,
59 PTR7_DATA, PTR6_DATA, PTR5_DATA, PTR4_DATA,
60 PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA,
61 PTS7_DATA, PTS6_DATA, PTS5_DATA, PTS4_DATA,
62 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA,
63 PTT5_DATA, PTT4_DATA,
64 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA,
65 PTU7_DATA, PTU6_DATA, PTU5_DATA, PTU4_DATA,
66 PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA,
67 PTV7_DATA, PTV6_DATA, PTV5_DATA, PTV4_DATA,
68 PTV3_DATA, PTV2_DATA, PTV1_DATA, PTV0_DATA,
69 PTW7_DATA, PTW6_DATA, PTW5_DATA, PTW4_DATA,
70 PTW3_DATA, PTW2_DATA, PTW1_DATA, PTW0_DATA,
71 PTX7_DATA, PTX6_DATA, PTX5_DATA, PTX4_DATA,
72 PTX3_DATA, PTX2_DATA, PTX1_DATA, PTX0_DATA,
73 PTY7_DATA, PTY6_DATA, PTY5_DATA, PTY4_DATA,
74 PTY3_DATA, PTY2_DATA, PTY1_DATA, PTY0_DATA,
75 PTZ7_DATA, PTZ6_DATA, PTZ5_DATA, PTZ4_DATA,
76 PTZ3_DATA, PTZ2_DATA, PTZ1_DATA, PTZ0_DATA,
77 PINMUX_DATA_END,
78
79 PINMUX_INPUT_BEGIN,
80 PTA7_IN, PTA6_IN, PTA5_IN, PTA4_IN,
81 PTA3_IN, PTA2_IN, PTA1_IN, PTA0_IN,
82 PTB7_IN, PTB6_IN, PTB5_IN, PTB4_IN,
83 PTB3_IN, PTB2_IN, PTB1_IN, PTB0_IN,
84 PTC7_IN, PTC6_IN, PTC5_IN, PTC4_IN,
85 PTC3_IN, PTC2_IN, PTC1_IN, PTC0_IN,
86 PTD7_IN, PTD6_IN, PTD5_IN, PTD4_IN,
87 PTD3_IN, PTD2_IN, PTD1_IN, PTD0_IN,
88 PTE7_IN, PTE6_IN, PTE5_IN, PTE4_IN,
89 PTE3_IN, PTE2_IN, PTE1_IN, PTE0_IN,
90 PTF7_IN, PTF6_IN, PTF5_IN, PTF4_IN,
91 PTF3_IN, PTF2_IN, PTF1_IN, PTF0_IN,
92 PTG7_IN, PTG6_IN, PTG5_IN, PTG4_IN,
93 PTG3_IN, PTG2_IN, PTG1_IN, PTG0_IN,
94 PTH7_IN, PTH6_IN, PTH5_IN, PTH4_IN,
95 PTH3_IN, PTH2_IN, PTH1_IN, PTH0_IN,
96 PTI7_IN, PTI6_IN, PTI5_IN, PTI4_IN,
97 PTI3_IN, PTI2_IN, PTI1_IN, PTI0_IN,
98 PTJ7_IN, PTJ6_IN, PTJ5_IN, PTJ4_IN,
99 PTJ3_IN, PTJ2_IN, PTJ1_IN, PTJ0_IN,
100 PTK7_IN, PTK6_IN, PTK5_IN, PTK4_IN,
101 PTK3_IN, PTK2_IN, PTK1_IN, PTK0_IN,
102 PTL7_IN, PTL6_IN, PTL5_IN, PTL4_IN,
103 PTL3_IN, PTL2_IN, PTL1_IN, PTL0_IN,
104 PTM6_IN, PTM5_IN, PTM4_IN,
105 PTM3_IN, PTM2_IN, PTM1_IN, PTM0_IN,
106 PTN7_IN, PTN6_IN, PTN5_IN, PTN4_IN,
107 PTN3_IN, PTN2_IN, PTN1_IN, PTN0_IN,
108 PTO7_IN, PTO6_IN, PTO5_IN, PTO4_IN,
109 PTO3_IN, PTO2_IN, PTO1_IN, PTO0_IN,
110 PTP6_IN, PTP5_IN, PTP4_IN,
111 PTP3_IN, PTP2_IN, PTP1_IN, PTP0_IN,
112 PTQ6_IN, PTQ5_IN, PTQ4_IN,
113 PTQ3_IN, PTQ2_IN, PTQ1_IN, PTQ0_IN,
114 PTR7_IN, PTR6_IN, PTR5_IN, PTR4_IN,
115 PTR3_IN, PTR2_IN, PTR1_IN, PTR0_IN,
116 PTS7_IN, PTS6_IN, PTS5_IN, PTS4_IN,
117 PTS3_IN, PTS2_IN, PTS1_IN, PTS0_IN,
118 PTT5_IN, PTT4_IN,
119 PTT3_IN, PTT2_IN, PTT1_IN, PTT0_IN,
120 PTU7_IN, PTU6_IN, PTU5_IN, PTU4_IN,
121 PTU3_IN, PTU2_IN, PTU1_IN, PTU0_IN,
122 PTV7_IN, PTV6_IN, PTV5_IN, PTV4_IN,
123 PTV3_IN, PTV2_IN, PTV1_IN, PTV0_IN,
124 PTW7_IN, PTW6_IN, PTW5_IN, PTW4_IN,
125 PTW3_IN, PTW2_IN, PTW1_IN, PTW0_IN,
126 PTX7_IN, PTX6_IN, PTX5_IN, PTX4_IN,
127 PTX3_IN, PTX2_IN, PTX1_IN, PTX0_IN,
128 PTY7_IN, PTY6_IN, PTY5_IN, PTY4_IN,
129 PTY3_IN, PTY2_IN, PTY1_IN, PTY0_IN,
130 PTZ7_IN, PTZ6_IN, PTZ5_IN, PTZ4_IN,
131 PTZ3_IN, PTZ2_IN, PTZ1_IN, PTZ0_IN,
132 PINMUX_INPUT_END,
133
134 PINMUX_INPUT_PULLUP_BEGIN,
135 PTU7_IN_PU, PTU6_IN_PU, PTU5_IN_PU, PTU4_IN_PU,
136 PTU3_IN_PU, PTU2_IN_PU, PTU1_IN_PU, PTU0_IN_PU,
137 PTV7_IN_PU, PTV6_IN_PU, PTV5_IN_PU, PTV4_IN_PU,
138 PTV3_IN_PU, PTV2_IN_PU, PTV1_IN_PU, PTV0_IN_PU,
139 PTW7_IN_PU, PTW6_IN_PU, PTW5_IN_PU, PTW4_IN_PU,
140 PTW3_IN_PU, PTW2_IN_PU, PTW1_IN_PU, PTW0_IN_PU,
141 PTX7_IN_PU, PTX6_IN_PU, PTX5_IN_PU, PTX4_IN_PU,
142 PTX3_IN_PU, PTX2_IN_PU, PTX1_IN_PU, PTX0_IN_PU,
143 PTY7_IN_PU, PTY6_IN_PU, PTY5_IN_PU, PTY4_IN_PU,
144 PTY3_IN_PU, PTY2_IN_PU, PTY1_IN_PU, PTY0_IN_PU,
145 PINMUX_INPUT_PULLUP_END,
146
147 PINMUX_OUTPUT_BEGIN,
148 PTA7_OUT, PTA6_OUT, PTA5_OUT, PTA4_OUT,
149 PTA3_OUT, PTA2_OUT, PTA1_OUT, PTA0_OUT,
150 PTB7_OUT, PTB6_OUT, PTB5_OUT, PTB4_OUT,
151 PTB3_OUT, PTB2_OUT, PTB1_OUT, PTB0_OUT,
152 PTC7_OUT, PTC6_OUT, PTC5_OUT, PTC4_OUT,
153 PTC3_OUT, PTC2_OUT, PTC1_OUT, PTC0_OUT,
154 PTD7_OUT, PTD6_OUT, PTD5_OUT, PTD4_OUT,
155 PTD3_OUT, PTD2_OUT, PTD1_OUT, PTD0_OUT,
156 PTE7_OUT, PTE6_OUT, PTE5_OUT, PTE4_OUT,
157 PTE3_OUT, PTE2_OUT, PTE1_OUT, PTE0_OUT,
158 PTF7_OUT, PTF6_OUT, PTF5_OUT, PTF4_OUT,
159 PTF3_OUT, PTF2_OUT, PTF1_OUT, PTF0_OUT,
160 PTG7_OUT, PTG6_OUT, PTG5_OUT, PTG4_OUT,
161 PTG3_OUT, PTG2_OUT, PTG1_OUT, PTG0_OUT,
162 PTH7_OUT, PTH6_OUT, PTH5_OUT, PTH4_OUT,
163 PTH3_OUT, PTH2_OUT, PTH1_OUT, PTH0_OUT,
164 PTI7_OUT, PTI6_OUT, PTI5_OUT, PTI4_OUT,
165 PTI3_OUT, PTI2_OUT, PTI1_OUT, PTI0_OUT,
166 PTJ7_OUT, PTJ6_OUT, PTJ5_OUT, PTJ4_OUT,
167 PTJ3_OUT, PTJ2_OUT, PTJ1_OUT, PTJ0_OUT,
168 PTK7_OUT, PTK6_OUT, PTK5_OUT, PTK4_OUT,
169 PTK3_OUT, PTK2_OUT, PTK1_OUT, PTK0_OUT,
170 PTL7_OUT, PTL6_OUT, PTL5_OUT, PTL4_OUT,
171 PTL3_OUT, PTL2_OUT, PTL1_OUT, PTL0_OUT,
172 PTM6_OUT, PTM5_OUT, PTM4_OUT,
173 PTM3_OUT, PTM2_OUT, PTM1_OUT, PTM0_OUT,
174 PTN7_OUT, PTN6_OUT, PTN5_OUT, PTN4_OUT,
175 PTN3_OUT, PTN2_OUT, PTN1_OUT, PTN0_OUT,
176 PTO7_OUT, PTO6_OUT, PTO5_OUT, PTO4_OUT,
177 PTO3_OUT, PTO2_OUT, PTO1_OUT, PTO0_OUT,
178 PTP6_OUT, PTP5_OUT, PTP4_OUT,
179 PTP3_OUT, PTP2_OUT, PTP1_OUT, PTP0_OUT,
180 PTQ6_OUT, PTQ5_OUT, PTQ4_OUT,
181 PTQ3_OUT, PTQ2_OUT, PTQ1_OUT, PTQ0_OUT,
182 PTR7_OUT, PTR6_OUT, PTR5_OUT, PTR4_OUT,
183 PTR3_OUT, PTR2_OUT, PTR1_OUT, PTR0_OUT,
184 PTS7_OUT, PTS6_OUT, PTS5_OUT, PTS4_OUT,
185 PTS3_OUT, PTS2_OUT, PTS1_OUT, PTS0_OUT,
186 PTT5_OUT, PTT4_OUT,
187 PTT3_OUT, PTT2_OUT, PTT1_OUT, PTT0_OUT,
188 PTU7_OUT, PTU6_OUT, PTU5_OUT, PTU4_OUT,
189 PTU3_OUT, PTU2_OUT, PTU1_OUT, PTU0_OUT,
190 PTV7_OUT, PTV6_OUT, PTV5_OUT, PTV4_OUT,
191 PTV3_OUT, PTV2_OUT, PTV1_OUT, PTV0_OUT,
192 PTW7_OUT, PTW6_OUT, PTW5_OUT, PTW4_OUT,
193 PTW3_OUT, PTW2_OUT, PTW1_OUT, PTW0_OUT,
194 PTX7_OUT, PTX6_OUT, PTX5_OUT, PTX4_OUT,
195 PTX3_OUT, PTX2_OUT, PTX1_OUT, PTX0_OUT,
196 PTY7_OUT, PTY6_OUT, PTY5_OUT, PTY4_OUT,
197 PTY3_OUT, PTY2_OUT, PTY1_OUT, PTY0_OUT,
198 PTZ7_OUT, PTZ6_OUT, PTZ5_OUT, PTZ4_OUT,
199 PTZ3_OUT, PTZ2_OUT, PTZ1_OUT, PTZ0_OUT,
200 PINMUX_OUTPUT_END,
201
202 PINMUX_FUNCTION_BEGIN,
203 PTA7_FN, PTA6_FN, PTA5_FN, PTA4_FN,
204 PTA3_FN, PTA2_FN, PTA1_FN, PTA0_FN,
205 PTB7_FN, PTB6_FN, PTB5_FN, PTB4_FN,
206 PTB3_FN, PTB2_FN, PTB1_FN, PTB0_FN,
207 PTC7_FN, PTC6_FN, PTC5_FN, PTC4_FN,
208 PTC3_FN, PTC2_FN, PTC1_FN, PTC0_FN,
209 PTD7_FN, PTD6_FN, PTD5_FN, PTD4_FN,
210 PTD3_FN, PTD2_FN, PTD1_FN, PTD0_FN,
211 PTE7_FN, PTE6_FN, PTE5_FN, PTE4_FN,
212 PTE3_FN, PTE2_FN, PTE1_FN, PTE0_FN,
213 PTF7_FN, PTF6_FN, PTF5_FN, PTF4_FN,
214 PTF3_FN, PTF2_FN, PTF1_FN, PTF0_FN,
215 PTG7_FN, PTG6_FN, PTG5_FN, PTG4_FN,
216 PTG3_FN, PTG2_FN, PTG1_FN, PTG0_FN,
217 PTH7_FN, PTH6_FN, PTH5_FN, PTH4_FN,
218 PTH3_FN, PTH2_FN, PTH1_FN, PTH0_FN,
219 PTI7_FN, PTI6_FN, PTI5_FN, PTI4_FN,
220 PTI3_FN, PTI2_FN, PTI1_FN, PTI0_FN,
221 PTJ7_FN, PTJ6_FN, PTJ5_FN, PTJ4_FN,
222 PTJ3_FN, PTJ2_FN, PTJ1_FN, PTJ0_FN,
223 PTK7_FN, PTK6_FN, PTK5_FN, PTK4_FN,
224 PTK3_FN, PTK2_FN, PTK1_FN, PTK0_FN,
225 PTL7_FN, PTL6_FN, PTL5_FN, PTL4_FN,
226 PTL3_FN, PTL2_FN, PTL1_FN, PTL0_FN,
227 PTM6_FN, PTM5_FN, PTM4_FN,
228 PTM3_FN, PTM2_FN, PTM1_FN, PTM0_FN,
229 PTN7_FN, PTN6_FN, PTN5_FN, PTN4_FN,
230 PTN3_FN, PTN2_FN, PTN1_FN, PTN0_FN,
231 PTO7_FN, PTO6_FN, PTO5_FN, PTO4_FN,
232 PTO3_FN, PTO2_FN, PTO1_FN, PTO0_FN,
233 PTP6_FN, PTP5_FN, PTP4_FN,
234 PTP3_FN, PTP2_FN, PTP1_FN, PTP0_FN,
235 PTQ6_FN, PTQ5_FN, PTQ4_FN,
236 PTQ3_FN, PTQ2_FN, PTQ1_FN, PTQ0_FN,
237 PTR7_FN, PTR6_FN, PTR5_FN, PTR4_FN,
238 PTR3_FN, PTR2_FN, PTR1_FN, PTR0_FN,
239 PTS7_FN, PTS6_FN, PTS5_FN, PTS4_FN,
240 PTS3_FN, PTS2_FN, PTS1_FN, PTS0_FN,
241 PTT5_FN, PTT4_FN,
242 PTT3_FN, PTT2_FN, PTT1_FN, PTT0_FN,
243 PTU7_FN, PTU6_FN, PTU5_FN, PTU4_FN,
244 PTU3_FN, PTU2_FN, PTU1_FN, PTU0_FN,
245 PTV7_FN, PTV6_FN, PTV5_FN, PTV4_FN,
246 PTV3_FN, PTV2_FN, PTV1_FN, PTV0_FN,
247 PTW7_FN, PTW6_FN, PTW5_FN, PTW4_FN,
248 PTW3_FN, PTW2_FN, PTW1_FN, PTW0_FN,
249 PTX7_FN, PTX6_FN, PTX5_FN, PTX4_FN,
250 PTX3_FN, PTX2_FN, PTX1_FN, PTX0_FN,
251 PTY7_FN, PTY6_FN, PTY5_FN, PTY4_FN,
252 PTY3_FN, PTY2_FN, PTY1_FN, PTY0_FN,
253 PTZ7_FN, PTZ6_FN, PTZ5_FN, PTZ4_FN,
254 PTZ3_FN, PTZ2_FN, PTZ1_FN, PTZ0_FN,
255
256 PS0_15_FN1, PS0_15_FN3,
257 PS0_14_FN1, PS0_14_FN3,
258 PS0_13_FN1, PS0_13_FN3,
259 PS0_12_FN1, PS0_12_FN3,
260 PS0_7_FN1, PS0_7_FN2,
261 PS0_6_FN1, PS0_6_FN2,
262 PS0_5_FN1, PS0_5_FN2,
263 PS0_4_FN1, PS0_4_FN2,
264 PS0_3_FN1, PS0_3_FN2,
265 PS0_2_FN1, PS0_2_FN2,
266 PS0_1_FN1, PS0_1_FN2,
267
268 PS1_7_FN1, PS1_7_FN3,
269 PS1_6_FN1, PS1_6_FN3,
270
271 PS2_13_FN1, PS2_13_FN3,
272 PS2_12_FN1, PS2_12_FN3,
273 PS2_1_FN1, PS2_1_FN2,
274 PS2_0_FN1, PS2_0_FN2,
275
276 PS4_15_FN1, PS4_15_FN2,
277 PS4_14_FN1, PS4_14_FN2,
278 PS4_13_FN1, PS4_13_FN2,
279 PS4_12_FN1, PS4_12_FN2,
280 PS4_11_FN1, PS4_11_FN2,
281 PS4_10_FN1, PS4_10_FN2,
282 PS4_9_FN1, PS4_9_FN2,
283 PS4_3_FN1, PS4_3_FN2,
284 PS4_2_FN1, PS4_2_FN2,
285 PS4_1_FN1, PS4_1_FN2,
286 PS4_0_FN1, PS4_0_FN2,
287
288 PS5_9_FN1, PS5_9_FN2,
289 PS5_8_FN1, PS5_8_FN2,
290 PS5_7_FN1, PS5_7_FN2,
291 PS5_6_FN1, PS5_6_FN2,
292 PS5_5_FN1, PS5_5_FN2,
293 PS5_4_FN1, PS5_4_FN2,
294
295 /* AN15 to 8 : EVENT15 to 8 */
296 PS6_7_FN_AN, PS6_7_FN_EV,
297 PS6_6_FN_AN, PS6_6_FN_EV,
298 PS6_5_FN_AN, PS6_5_FN_EV,
299 PS6_4_FN_AN, PS6_4_FN_EV,
300 PS6_3_FN_AN, PS6_3_FN_EV,
301 PS6_2_FN_AN, PS6_2_FN_EV,
302 PS6_1_FN_AN, PS6_1_FN_EV,
303 PS6_0_FN_AN, PS6_0_FN_EV,
304
305 PINMUX_FUNCTION_END,
306
307 PINMUX_MARK_BEGIN,
308 /* PTA (mobule: LBSC, CPG, LPC) */
309 BS_MARK, RDWR_MARK, WE1_MARK, RDY_MARK,
310 MD10_MARK, MD9_MARK, MD8_MARK,
311 LGPIO7_MARK, LGPIO6_MARK, LGPIO5_MARK, LGPIO4_MARK,
312 LGPIO3_MARK, LGPIO2_MARK, LGPIO1_MARK, LGPIO0_MARK,
313
314 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
315 D15_MARK, D14_MARK, D13_MARK, D12_MARK,
316 D11_MARK, D10_MARK, D9_MARK, D8_MARK,
317 ET0_MDC_MARK, ET0_MDIO_MARK, ET1_MDC_MARK, ET1_MDIO_MARK,
318 SIM_D_MARK, SIM_CLK_MARK, SIM_RST_MARK,
319 WPSZ1_MARK, WPSZ0_MARK, FWID_MARK, FLSHSZ_MARK,
320 LPC_SPIEN_MARK, BASEL_MARK,
321
322 /* PTC (mobule: SD) */
323 SD_WP_MARK, SD_CD_MARK, SD_CLK_MARK, SD_CMD_MARK,
324 SD_D3_MARK, SD_D2_MARK, SD_D1_MARK, SD_D0_MARK,
325
326 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */
327 IRQ7_MARK, IRQ6_MARK, IRQ5_MARK, IRQ4_MARK,
328 IRQ3_MARK, IRQ2_MARK, IRQ1_MARK, IRQ0_MARK,
329 MD6_MARK, MD5_MARK, MD3_MARK, MD2_MARK,
330 MD1_MARK, MD0_MARK, ADTRG1_MARK, ADTRG0_MARK,
331
332 /* PTE (mobule: EtherC) */
333 ET0_CRS_DV_MARK, ET0_TXD1_MARK,
334 ET0_TXD0_MARK, ET0_TX_EN_MARK,
335 ET0_REF_CLK_MARK, ET0_RXD1_MARK,
336 ET0_RXD0_MARK, ET0_RX_ER_MARK,
337
338 /* PTF (mobule: EtherC) */
339 ET1_CRS_DV_MARK, ET1_TXD1_MARK,
340 ET1_TXD0_MARK, ET1_TX_EN_MARK,
341 ET1_REF_CLK_MARK, ET1_RXD1_MARK,
342 ET1_RXD0_MARK, ET1_RX_ER_MARK,
343
344 /* PTG (mobule: SYSTEM, PWMX, LPC) */
345 STATUS0_MARK, STATUS1_MARK,
346 PWX0_MARK, PWX1_MARK, PWX2_MARK, PWX3_MARK,
347 SERIRQ_MARK, CLKRUN_MARK, LPCPD_MARK, LDRQ_MARK,
348
349 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */
350 TCLK_MARK, RXD4_MARK, TXD4_MARK,
351 SP1_MOSI_MARK, SP1_MISO_MARK, SP1_SCK_MARK, SP1_SCK_FB_MARK,
352 SP1_SS0_MARK, SP1_SS1_MARK, SP0_SS1_MARK,
353
354 /* PTI (mobule: INTC) */
355 IRQ15_MARK, IRQ14_MARK, IRQ13_MARK, IRQ12_MARK,
356 IRQ11_MARK, IRQ10_MARK, IRQ9_MARK, IRQ8_MARK,
357
358 /* PTJ (mobule: SCIF234, SERMUX) */
359 RXD3_MARK, TXD3_MARK, RXD2_MARK, TXD2_MARK,
360 COM1_TXD_MARK, COM1_RXD_MARK, COM1_RTS_MARK, COM1_CTS_MARK,
361
362 /* PTK (mobule: SERMUX) */
363 COM2_TXD_MARK, COM2_RXD_MARK, COM2_RTS_MARK, COM2_CTS_MARK,
364 COM2_DTR_MARK, COM2_DSR_MARK, COM2_DCD_MARK, COM2_RI_MARK,
365
366 /* PTL (mobule: SERMUX) */
367 RAC_TXD_MARK, RAC_RXD_MARK, RAC_RTS_MARK, RAC_CTS_MARK,
368 RAC_DTR_MARK, RAC_DSR_MARK, RAC_DCD_MARK, RAC_RI_MARK,
369
370 /* PTM (mobule: IIC, LPC) */
371 SDA6_MARK, SCL6_MARK, SDA7_MARK, SCL7_MARK,
372 WP_MARK, FMS0_MARK, FMS1_MARK,
373
374 /* PTN (mobule: SCIF234, EVC) */
375 SCK2_MARK, RTS4_MARK, RTS3_MARK, RTS2_MARK,
376 CTS4_MARK, CTS3_MARK, CTS2_MARK,
377 EVENT7_MARK, EVENT6_MARK, EVENT5_MARK, EVENT4_MARK,
378 EVENT3_MARK, EVENT2_MARK, EVENT1_MARK, EVENT0_MARK,
379
380 /* PTO (mobule: SGPIO) */
381 SGPIO0_CLK_MARK, SGPIO0_LOAD_MARK,
382 SGPIO0_DI_MARK, SGPIO0_DO_MARK,
383 SGPIO1_CLK_MARK, SGPIO1_LOAD_MARK,
384 SGPIO1_DI_MARK, SGPIO1_DO_MARK,
385
386 /* PTP (mobule: JMC, SCIF234) */
387 JMCTCK_MARK, JMCTMS_MARK, JMCTDO_MARK, JMCTDI_MARK,
388 JMCRST_MARK, SCK4_MARK, SCK3_MARK,
389
390 /* PTQ (mobule: LPC) */
391 LAD3_MARK, LAD2_MARK, LAD1_MARK, LAD0_MARK,
392 LFRAME_MARK, LRESET_MARK, LCLK_MARK,
393
394 /* PTR (mobule: GRA, IIC) */
395 DDC3_MARK, DDC2_MARK,
396 SDA8_MARK, SCL8_MARK, SDA2_MARK, SCL2_MARK,
397 SDA1_MARK, SCL1_MARK, SDA0_MARK, SCL0_MARK,
398
399 /* PTS (mobule: GRA, IIC) */
400 DDC1_MARK, DDC0_MARK,
401 SDA9_MARK, SCL9_MARK, SDA5_MARK, SCL5_MARK,
402 SDA4_MARK, SCL4_MARK, SDA3_MARK, SCL3_MARK,
403
404 /* PTT (mobule: SYSTEM, PWMX) */
405 AUDSYNC_MARK, AUDCK_MARK,
406 AUDATA3_MARK, AUDATA2_MARK,
407 AUDATA1_MARK, AUDATA0_MARK,
408 PWX7_MARK, PWX6_MARK, PWX5_MARK, PWX4_MARK,
409
410 /* PTU (mobule: LBSC, DMAC) */
411 CS6_MARK, CS5_MARK, CS4_MARK, CS0_MARK,
412 RD_MARK, WE0_MARK, A25_MARK, A24_MARK,
413 DREQ0_MARK, DACK0_MARK,
414
415 /* PTV (mobule: LBSC, DMAC) */
416 A23_MARK, A22_MARK, A21_MARK, A20_MARK,
417 A19_MARK, A18_MARK, A17_MARK, A16_MARK,
418 TEND0_MARK, DREQ1_MARK, DACK1_MARK, TEND1_MARK,
419
420 /* PTW (mobule: LBSC) */
421 A15_MARK, A14_MARK, A13_MARK, A12_MARK,
422 A11_MARK, A10_MARK, A9_MARK, A8_MARK,
423
424 /* PTX (mobule: LBSC) */
425 A7_MARK, A6_MARK, A5_MARK, A4_MARK,
426 A3_MARK, A2_MARK, A1_MARK, A0_MARK,
427
428 /* PTY (mobule: LBSC) */
429 D7_MARK, D6_MARK, D5_MARK, D4_MARK,
430 D3_MARK, D2_MARK, D1_MARK, D0_MARK,
431 PINMUX_MARK_END,
432};
433
434static pinmux_enum_t pinmux_data[] = {
435 /* PTA GPIO */
436 PINMUX_DATA(PTA7_DATA, PTA7_IN, PTA7_OUT),
437 PINMUX_DATA(PTA6_DATA, PTA6_IN, PTA6_OUT),
438 PINMUX_DATA(PTA5_DATA, PTA5_IN, PTA5_OUT),
439 PINMUX_DATA(PTA4_DATA, PTA4_IN, PTA4_OUT),
440 PINMUX_DATA(PTA3_DATA, PTA3_IN, PTA3_OUT),
441 PINMUX_DATA(PTA2_DATA, PTA2_IN, PTA2_OUT),
442 PINMUX_DATA(PTA1_DATA, PTA1_IN, PTA1_OUT),
443 PINMUX_DATA(PTA0_DATA, PTA0_IN, PTA0_OUT),
444
445 /* PTB GPIO */
446 PINMUX_DATA(PTB7_DATA, PTB7_IN, PTB7_OUT),
447 PINMUX_DATA(PTB6_DATA, PTB6_IN, PTB6_OUT),
448 PINMUX_DATA(PTB5_DATA, PTB5_IN, PTB5_OUT),
449 PINMUX_DATA(PTB4_DATA, PTB4_IN, PTB4_OUT),
450 PINMUX_DATA(PTB3_DATA, PTB3_IN, PTB3_OUT),
451 PINMUX_DATA(PTB2_DATA, PTB2_IN, PTB2_OUT),
452 PINMUX_DATA(PTB1_DATA, PTB1_IN, PTB1_OUT),
453 PINMUX_DATA(PTB0_DATA, PTB0_IN, PTB0_OUT),
454
455 /* PTC GPIO */
456 PINMUX_DATA(PTC7_DATA, PTC7_IN, PTC7_OUT),
457 PINMUX_DATA(PTC6_DATA, PTC6_IN, PTC6_OUT),
458 PINMUX_DATA(PTC5_DATA, PTC5_IN, PTC5_OUT),
459 PINMUX_DATA(PTC4_DATA, PTC4_IN, PTC4_OUT),
460 PINMUX_DATA(PTC3_DATA, PTC3_IN, PTC3_OUT),
461 PINMUX_DATA(PTC2_DATA, PTC2_IN, PTC2_OUT),
462 PINMUX_DATA(PTC1_DATA, PTC1_IN, PTC1_OUT),
463 PINMUX_DATA(PTC0_DATA, PTC0_IN, PTC0_OUT),
464
465 /* PTD GPIO */
466 PINMUX_DATA(PTD7_DATA, PTD7_IN, PTD7_OUT),
467 PINMUX_DATA(PTD6_DATA, PTD6_IN, PTD6_OUT),
468 PINMUX_DATA(PTD5_DATA, PTD5_IN, PTD5_OUT),
469 PINMUX_DATA(PTD4_DATA, PTD4_IN, PTD4_OUT),
470 PINMUX_DATA(PTD3_DATA, PTD3_IN, PTD3_OUT),
471 PINMUX_DATA(PTD2_DATA, PTD2_IN, PTD2_OUT),
472 PINMUX_DATA(PTD1_DATA, PTD1_IN, PTD1_OUT),
473 PINMUX_DATA(PTD0_DATA, PTD0_IN, PTD0_OUT),
474
475 /* PTE GPIO */
476 PINMUX_DATA(PTE5_DATA, PTE5_IN, PTE5_OUT),
477 PINMUX_DATA(PTE4_DATA, PTE4_IN, PTE4_OUT),
478 PINMUX_DATA(PTE3_DATA, PTE3_IN, PTE3_OUT),
479 PINMUX_DATA(PTE2_DATA, PTE2_IN, PTE2_OUT),
480 PINMUX_DATA(PTE1_DATA, PTE1_IN, PTE1_OUT),
481 PINMUX_DATA(PTE0_DATA, PTE0_IN, PTE0_OUT),
482
483 /* PTF GPIO */
484 PINMUX_DATA(PTF7_DATA, PTF7_IN, PTF7_OUT),
485 PINMUX_DATA(PTF6_DATA, PTF6_IN, PTF6_OUT),
486 PINMUX_DATA(PTF5_DATA, PTF5_IN, PTF5_OUT),
487 PINMUX_DATA(PTF4_DATA, PTF4_IN, PTF4_OUT),
488 PINMUX_DATA(PTF3_DATA, PTF3_IN, PTF3_OUT),
489 PINMUX_DATA(PTF2_DATA, PTF2_IN, PTF2_OUT),
490 PINMUX_DATA(PTF1_DATA, PTF1_IN, PTF1_OUT),
491 PINMUX_DATA(PTF0_DATA, PTF0_IN, PTF0_OUT),
492
493 /* PTG GPIO */
494 PINMUX_DATA(PTG7_DATA, PTG7_IN, PTG7_OUT),
495 PINMUX_DATA(PTG6_DATA, PTG6_IN, PTG6_OUT),
496 PINMUX_DATA(PTG5_DATA, PTG5_IN, PTG5_OUT),
497 PINMUX_DATA(PTG4_DATA, PTG4_IN, PTG4_OUT),
498 PINMUX_DATA(PTG3_DATA, PTG3_IN, PTG3_OUT),
499 PINMUX_DATA(PTG2_DATA, PTG2_IN, PTG2_OUT),
500 PINMUX_DATA(PTG1_DATA, PTG1_IN, PTG1_OUT),
501 PINMUX_DATA(PTG0_DATA, PTG0_IN, PTG0_OUT),
502
503 /* PTH GPIO */
504 PINMUX_DATA(PTH7_DATA, PTH7_IN, PTH7_OUT),
505 PINMUX_DATA(PTH6_DATA, PTH6_IN, PTH6_OUT),
506 PINMUX_DATA(PTH5_DATA, PTH5_IN, PTH5_OUT),
507 PINMUX_DATA(PTH4_DATA, PTH4_IN, PTH4_OUT),
508 PINMUX_DATA(PTH3_DATA, PTH3_IN, PTH3_OUT),
509 PINMUX_DATA(PTH2_DATA, PTH2_IN, PTH2_OUT),
510 PINMUX_DATA(PTH1_DATA, PTH1_IN, PTH1_OUT),
511 PINMUX_DATA(PTH0_DATA, PTH0_IN, PTH0_OUT),
512
513 /* PTI GPIO */
514 PINMUX_DATA(PTI7_DATA, PTI7_IN, PTI7_OUT),
515 PINMUX_DATA(PTI6_DATA, PTI6_IN, PTI6_OUT),
516 PINMUX_DATA(PTI5_DATA, PTI5_IN, PTI5_OUT),
517 PINMUX_DATA(PTI4_DATA, PTI4_IN, PTI4_OUT),
518 PINMUX_DATA(PTI3_DATA, PTI3_IN, PTI3_OUT),
519 PINMUX_DATA(PTI2_DATA, PTI2_IN, PTI2_OUT),
520 PINMUX_DATA(PTI1_DATA, PTI1_IN, PTI1_OUT),
521 PINMUX_DATA(PTI0_DATA, PTI0_IN, PTI0_OUT),
522
523 /* PTJ GPIO */
524 PINMUX_DATA(PTJ7_DATA, PTJ7_IN, PTJ7_OUT),
525 PINMUX_DATA(PTJ6_DATA, PTJ6_IN, PTJ6_OUT),
526 PINMUX_DATA(PTJ5_DATA, PTJ5_IN, PTJ5_OUT),
527 PINMUX_DATA(PTJ4_DATA, PTJ4_IN, PTJ4_OUT),
528 PINMUX_DATA(PTJ3_DATA, PTJ3_IN, PTJ3_OUT),
529 PINMUX_DATA(PTJ2_DATA, PTJ2_IN, PTJ2_OUT),
530 PINMUX_DATA(PTJ1_DATA, PTJ1_IN, PTJ1_OUT),
531 PINMUX_DATA(PTJ0_DATA, PTJ0_IN, PTJ0_OUT),
532
533 /* PTK GPIO */
534 PINMUX_DATA(PTK7_DATA, PTK7_IN, PTK7_OUT),
535 PINMUX_DATA(PTK6_DATA, PTK6_IN, PTK6_OUT),
536 PINMUX_DATA(PTK5_DATA, PTK5_IN, PTK5_OUT),
537 PINMUX_DATA(PTK4_DATA, PTK4_IN, PTK4_OUT),
538 PINMUX_DATA(PTK3_DATA, PTK3_IN, PTK3_OUT),
539 PINMUX_DATA(PTK2_DATA, PTK2_IN, PTK2_OUT),
540 PINMUX_DATA(PTK1_DATA, PTK1_IN, PTK1_OUT),
541 PINMUX_DATA(PTK0_DATA, PTK0_IN, PTK0_OUT),
542
543 /* PTL GPIO */
544 PINMUX_DATA(PTL7_DATA, PTL7_IN, PTL7_OUT),
545 PINMUX_DATA(PTL6_DATA, PTL6_IN, PTL6_OUT),
546 PINMUX_DATA(PTL5_DATA, PTL5_IN, PTL5_OUT),
547 PINMUX_DATA(PTL4_DATA, PTL4_IN, PTL4_OUT),
548 PINMUX_DATA(PTL3_DATA, PTL3_IN, PTL3_OUT),
549 PINMUX_DATA(PTL2_DATA, PTL2_IN, PTL2_OUT),
550 PINMUX_DATA(PTL1_DATA, PTL1_IN, PTL1_OUT),
551 PINMUX_DATA(PTL0_DATA, PTL0_IN, PTL0_OUT),
552
553 /* PTM GPIO */
554 PINMUX_DATA(PTM6_DATA, PTM6_IN, PTM6_OUT),
555 PINMUX_DATA(PTM5_DATA, PTM5_IN, PTM5_OUT),
556 PINMUX_DATA(PTM4_DATA, PTM4_IN, PTM4_OUT),
557 PINMUX_DATA(PTM3_DATA, PTM3_IN, PTM3_OUT),
558 PINMUX_DATA(PTM2_DATA, PTM2_IN, PTM2_OUT),
559 PINMUX_DATA(PTM1_DATA, PTM1_IN, PTM1_OUT),
560 PINMUX_DATA(PTM0_DATA, PTM0_IN, PTM0_OUT),
561
562 /* PTN GPIO */
563 PINMUX_DATA(PTN7_DATA, PTN7_IN, PTN7_OUT),
564 PINMUX_DATA(PTN6_DATA, PTN6_IN, PTN6_OUT),
565 PINMUX_DATA(PTN5_DATA, PTN5_IN, PTN5_OUT),
566 PINMUX_DATA(PTN4_DATA, PTN4_IN, PTN4_OUT),
567 PINMUX_DATA(PTN3_DATA, PTN3_IN, PTN3_OUT),
568 PINMUX_DATA(PTN2_DATA, PTN2_IN, PTN2_OUT),
569 PINMUX_DATA(PTN1_DATA, PTN1_IN, PTN1_OUT),
570 PINMUX_DATA(PTN0_DATA, PTN0_IN, PTN0_OUT),
571
572 /* PTO GPIO */
573 PINMUX_DATA(PTO7_DATA, PTO7_IN, PTO7_OUT),
574 PINMUX_DATA(PTO6_DATA, PTO6_IN, PTO6_OUT),
575 PINMUX_DATA(PTO5_DATA, PTO5_IN, PTO5_OUT),
576 PINMUX_DATA(PTO4_DATA, PTO4_IN, PTO4_OUT),
577 PINMUX_DATA(PTO3_DATA, PTO3_IN, PTO3_OUT),
578 PINMUX_DATA(PTO2_DATA, PTO2_IN, PTO2_OUT),
579 PINMUX_DATA(PTO1_DATA, PTO1_IN, PTO1_OUT),
580 PINMUX_DATA(PTO0_DATA, PTO0_IN, PTO0_OUT),
581
582 /* PTQ GPIO */
583 PINMUX_DATA(PTQ6_DATA, PTQ6_IN, PTQ6_OUT),
584 PINMUX_DATA(PTQ5_DATA, PTQ5_IN, PTQ5_OUT),
585 PINMUX_DATA(PTQ4_DATA, PTQ4_IN, PTQ4_OUT),
586 PINMUX_DATA(PTQ3_DATA, PTQ3_IN, PTQ3_OUT),
587 PINMUX_DATA(PTQ2_DATA, PTQ2_IN, PTQ2_OUT),
588 PINMUX_DATA(PTQ1_DATA, PTQ1_IN, PTQ1_OUT),
589 PINMUX_DATA(PTQ0_DATA, PTQ0_IN, PTQ0_OUT),
590
591 /* PTR GPIO */
592 PINMUX_DATA(PTR7_DATA, PTR7_IN, PTR7_OUT),
593 PINMUX_DATA(PTR6_DATA, PTR6_IN, PTR6_OUT),
594 PINMUX_DATA(PTR5_DATA, PTR5_IN, PTR5_OUT),
595 PINMUX_DATA(PTR4_DATA, PTR4_IN, PTR4_OUT),
596 PINMUX_DATA(PTR3_DATA, PTR3_IN, PTR3_OUT),
597 PINMUX_DATA(PTR2_DATA, PTR2_IN, PTR2_OUT),
598 PINMUX_DATA(PTR1_DATA, PTR1_IN, PTR1_OUT),
599 PINMUX_DATA(PTR0_DATA, PTR0_IN, PTR0_OUT),
600
601 /* PTS GPIO */
602 PINMUX_DATA(PTS7_DATA, PTS7_IN, PTS7_OUT),
603 PINMUX_DATA(PTS6_DATA, PTS6_IN, PTS6_OUT),
604 PINMUX_DATA(PTS5_DATA, PTS5_IN, PTS5_OUT),
605 PINMUX_DATA(PTS4_DATA, PTS4_IN, PTS4_OUT),
606 PINMUX_DATA(PTS3_DATA, PTS3_IN, PTS3_OUT),
607 PINMUX_DATA(PTS2_DATA, PTS2_IN, PTS2_OUT),
608 PINMUX_DATA(PTS1_DATA, PTS1_IN, PTS1_OUT),
609 PINMUX_DATA(PTS0_DATA, PTS0_IN, PTS0_OUT),
610
611 /* PTT GPIO */
612 PINMUX_DATA(PTT5_DATA, PTT5_IN, PTT5_OUT),
613 PINMUX_DATA(PTT4_DATA, PTT4_IN, PTT4_OUT),
614 PINMUX_DATA(PTT3_DATA, PTT3_IN, PTT3_OUT),
615 PINMUX_DATA(PTT2_DATA, PTT2_IN, PTT2_OUT),
616 PINMUX_DATA(PTT1_DATA, PTT1_IN, PTT1_OUT),
617 PINMUX_DATA(PTT0_DATA, PTT0_IN, PTT0_OUT),
618
619 /* PTU GPIO */
620 PINMUX_DATA(PTU7_DATA, PTU7_IN, PTU7_OUT),
621 PINMUX_DATA(PTU6_DATA, PTU6_IN, PTU6_OUT),
622 PINMUX_DATA(PTU5_DATA, PTU5_IN, PTU5_OUT),
623 PINMUX_DATA(PTU4_DATA, PTU4_IN, PTU4_OUT),
624 PINMUX_DATA(PTU3_DATA, PTU3_IN, PTU3_OUT),
625 PINMUX_DATA(PTU2_DATA, PTU2_IN, PTU2_OUT),
626 PINMUX_DATA(PTU1_DATA, PTU1_IN, PTU1_OUT),
627 PINMUX_DATA(PTU0_DATA, PTU0_IN, PTU0_OUT),
628
629 /* PTV GPIO */
630 PINMUX_DATA(PTV7_DATA, PTV7_IN, PTV7_OUT),
631 PINMUX_DATA(PTV6_DATA, PTV6_IN, PTV6_OUT),
632 PINMUX_DATA(PTV5_DATA, PTV5_IN, PTV5_OUT),
633 PINMUX_DATA(PTV4_DATA, PTV4_IN, PTV4_OUT),
634 PINMUX_DATA(PTV3_DATA, PTV3_IN, PTV3_OUT),
635 PINMUX_DATA(PTV2_DATA, PTV2_IN, PTV2_OUT),
636 PINMUX_DATA(PTV1_DATA, PTV1_IN, PTV1_OUT),
637 PINMUX_DATA(PTV0_DATA, PTV0_IN, PTV0_OUT),
638
639 /* PTW GPIO */
640 PINMUX_DATA(PTW7_DATA, PTW7_IN, PTW7_OUT),
641 PINMUX_DATA(PTW6_DATA, PTW6_IN, PTW6_OUT),
642 PINMUX_DATA(PTW5_DATA, PTW5_IN, PTW5_OUT),
643 PINMUX_DATA(PTW4_DATA, PTW4_IN, PTW4_OUT),
644 PINMUX_DATA(PTW3_DATA, PTW3_IN, PTW3_OUT),
645 PINMUX_DATA(PTW2_DATA, PTW2_IN, PTW2_OUT),
646 PINMUX_DATA(PTW1_DATA, PTW1_IN, PTW1_OUT),
647 PINMUX_DATA(PTW0_DATA, PTW0_IN, PTW0_OUT),
648
649 /* PTX GPIO */
650 PINMUX_DATA(PTX7_DATA, PTX7_IN, PTX7_OUT),
651 PINMUX_DATA(PTX6_DATA, PTX6_IN, PTX6_OUT),
652 PINMUX_DATA(PTX5_DATA, PTX5_IN, PTX5_OUT),
653 PINMUX_DATA(PTX4_DATA, PTX4_IN, PTX4_OUT),
654 PINMUX_DATA(PTX3_DATA, PTX3_IN, PTX3_OUT),
655 PINMUX_DATA(PTX2_DATA, PTX2_IN, PTX2_OUT),
656 PINMUX_DATA(PTX1_DATA, PTX1_IN, PTX1_OUT),
657 PINMUX_DATA(PTX0_DATA, PTX0_IN, PTX0_OUT),
658
659 /* PTY GPIO */
660 PINMUX_DATA(PTY7_DATA, PTY7_IN, PTY7_OUT),
661 PINMUX_DATA(PTY6_DATA, PTY6_IN, PTY6_OUT),
662 PINMUX_DATA(PTY5_DATA, PTY5_IN, PTY5_OUT),
663 PINMUX_DATA(PTY4_DATA, PTY4_IN, PTY4_OUT),
664 PINMUX_DATA(PTY3_DATA, PTY3_IN, PTY3_OUT),
665 PINMUX_DATA(PTY2_DATA, PTY2_IN, PTY2_OUT),
666 PINMUX_DATA(PTY1_DATA, PTY1_IN, PTY1_OUT),
667 PINMUX_DATA(PTY0_DATA, PTY0_IN, PTY0_OUT),
668
669 /* PTZ GPIO */
670 PINMUX_DATA(PTZ7_DATA, PTZ7_IN, PTZ7_OUT),
671 PINMUX_DATA(PTZ6_DATA, PTZ6_IN, PTZ6_OUT),
672 PINMUX_DATA(PTZ5_DATA, PTZ5_IN, PTZ5_OUT),
673 PINMUX_DATA(PTZ4_DATA, PTZ4_IN, PTZ4_OUT),
674 PINMUX_DATA(PTZ3_DATA, PTZ3_IN, PTZ3_OUT),
675 PINMUX_DATA(PTZ2_DATA, PTZ2_IN, PTZ2_OUT),
676 PINMUX_DATA(PTZ1_DATA, PTZ1_IN, PTZ1_OUT),
677 PINMUX_DATA(PTZ0_DATA, PTZ0_IN, PTZ0_OUT),
678
679 /* PTA FN */
680 PINMUX_DATA(BS_MARK, PS0_15_FN1, PTA7_FN),
681 PINMUX_DATA(LGPIO7_MARK, PS0_15_FN3, PTA7_FN),
682 PINMUX_DATA(RDWR_MARK, PS0_14_FN1, PTA6_FN),
683 PINMUX_DATA(LGPIO6_MARK, PS0_14_FN3, PTA6_FN),
684 PINMUX_DATA(WE1_MARK, PS0_13_FN1, PTA5_FN),
685 PINMUX_DATA(LGPIO5_MARK, PS0_13_FN3, PTA5_FN),
686 PINMUX_DATA(RDY_MARK, PS0_12_FN1, PTA4_FN),
687 PINMUX_DATA(LGPIO4_MARK, PS0_12_FN3, PTA4_FN),
688 PINMUX_DATA(LGPIO3_MARK, PTA3_FN),
689 PINMUX_DATA(LGPIO2_MARK, PTA2_FN),
690 PINMUX_DATA(LGPIO1_MARK, PTA1_FN),
691 PINMUX_DATA(LGPIO0_MARK, PTA0_FN),
692
693 /* PTB FN */
694 PINMUX_DATA(D15_MARK, PS0_7_FN1, PTB7_FN),
695 PINMUX_DATA(ET0_MDC_MARK, PS0_7_FN2, PTB7_FN),
696 PINMUX_DATA(D14_MARK, PS0_6_FN1, PTB6_FN),
697 PINMUX_DATA(ET0_MDIO_MARK, PS0_6_FN2, PTB6_FN),
698 PINMUX_DATA(D13_MARK, PS0_5_FN1, PTB5_FN),
699 PINMUX_DATA(ET1_MDC_MARK, PS0_5_FN2, PTB5_FN),
700 PINMUX_DATA(D12_MARK, PS0_4_FN1, PTB4_FN),
701 PINMUX_DATA(ET1_MDIO_MARK, PS0_4_FN2, PTB4_FN),
702 PINMUX_DATA(D11_MARK, PS0_3_FN1, PTB3_FN),
703 PINMUX_DATA(SIM_D_MARK, PS0_3_FN2, PTB3_FN),
704 PINMUX_DATA(D10_MARK, PS0_2_FN1, PTB2_FN),
705 PINMUX_DATA(SIM_CLK_MARK, PS0_2_FN2, PTB2_FN),
706 PINMUX_DATA(D9_MARK, PS0_1_FN1, PTB1_FN),
707 PINMUX_DATA(SIM_RST_MARK, PS0_1_FN2, PTB1_FN),
708 PINMUX_DATA(D8_MARK, PTB0_FN),
709
710 /* PTC FN */
711 PINMUX_DATA(SD_WP_MARK, PTC7_FN),
712 PINMUX_DATA(SD_CD_MARK, PTC6_FN),
713 PINMUX_DATA(SD_CLK_MARK, PTC5_FN),
714 PINMUX_DATA(SD_CMD_MARK, PTC4_FN),
715 PINMUX_DATA(SD_D3_MARK, PTC3_FN),
716 PINMUX_DATA(SD_D2_MARK, PTC2_FN),
717 PINMUX_DATA(SD_D1_MARK, PTC1_FN),
718 PINMUX_DATA(SD_D0_MARK, PTC0_FN),
719
720 /* PTD FN */
721 PINMUX_DATA(IRQ7_MARK, PS1_7_FN1, PTD7_FN),
722 PINMUX_DATA(ADTRG1_MARK, PS1_7_FN3, PTD7_FN),
723 PINMUX_DATA(IRQ6_MARK, PS1_6_FN1, PTD6_FN),
724 PINMUX_DATA(ADTRG0_MARK, PS1_6_FN3, PTD6_FN),
725 PINMUX_DATA(IRQ5_MARK, PTD5_FN),
726 PINMUX_DATA(IRQ4_MARK, PTD4_FN),
727 PINMUX_DATA(IRQ3_MARK, PTD3_FN),
728 PINMUX_DATA(IRQ2_MARK, PTD2_FN),
729 PINMUX_DATA(IRQ1_MARK, PTD1_FN),
730 PINMUX_DATA(IRQ0_MARK, PTD0_FN),
731
732 /* PTE FN */
733 PINMUX_DATA(ET0_CRS_DV_MARK, PTE7_FN),
734 PINMUX_DATA(ET0_TXD1_MARK, PTE6_FN),
735 PINMUX_DATA(ET0_TXD0_MARK, PTE5_FN),
736 PINMUX_DATA(ET0_TX_EN_MARK, PTE4_FN),
737 PINMUX_DATA(ET0_REF_CLK_MARK, PTE3_FN),
738 PINMUX_DATA(ET0_RXD1_MARK, PTE2_FN),
739 PINMUX_DATA(ET0_RXD0_MARK, PTE1_FN),
740 PINMUX_DATA(ET0_RX_ER_MARK, PTE0_FN),
741
742 /* PTF FN */
743 PINMUX_DATA(ET1_CRS_DV_MARK, PTF7_FN),
744 PINMUX_DATA(ET1_TXD1_MARK, PTF6_FN),
745 PINMUX_DATA(ET1_TXD0_MARK, PTF5_FN),
746 PINMUX_DATA(ET1_TX_EN_MARK, PTF4_FN),
747 PINMUX_DATA(ET1_REF_CLK_MARK, PTF3_FN),
748 PINMUX_DATA(ET1_RXD1_MARK, PTF2_FN),
749 PINMUX_DATA(ET1_RXD0_MARK, PTF1_FN),
750 PINMUX_DATA(ET1_RX_ER_MARK, PTF0_FN),
751
752 /* PTG FN */
753 PINMUX_DATA(PWX0_MARK, PTG7_FN),
754 PINMUX_DATA(PWX1_MARK, PTG6_FN),
755 PINMUX_DATA(STATUS0_MARK, PS2_13_FN1, PTG5_FN),
756 PINMUX_DATA(PWX2_MARK, PS2_13_FN3, PTG5_FN),
757 PINMUX_DATA(STATUS1_MARK, PS2_12_FN1, PTG4_FN),
758 PINMUX_DATA(PWX3_MARK, PS2_12_FN3, PTG4_FN),
759 PINMUX_DATA(SERIRQ_MARK, PTG3_FN),
760 PINMUX_DATA(CLKRUN_MARK, PTG2_FN),
761 PINMUX_DATA(LPCPD_MARK, PTG1_FN),
762 PINMUX_DATA(LDRQ_MARK, PTG0_FN),
763
764 /* PTH FN */
765 PINMUX_DATA(SP1_MOSI_MARK, PTH7_FN),
766 PINMUX_DATA(SP1_MISO_MARK, PTH6_FN),
767 PINMUX_DATA(SP1_SCK_MARK, PTH5_FN),
768 PINMUX_DATA(SP1_SCK_FB_MARK, PTH4_FN),
769 PINMUX_DATA(SP1_SS0_MARK, PTH3_FN),
770 PINMUX_DATA(TCLK_MARK, PTH2_FN),
771 PINMUX_DATA(RXD4_MARK, PS2_1_FN1, PTH1_FN),
772 PINMUX_DATA(SP1_SS1_MARK, PS2_1_FN2, PTH1_FN),
773 PINMUX_DATA(TXD4_MARK, PS2_0_FN1, PTH0_FN),
774 PINMUX_DATA(SP0_SS1_MARK, PS2_0_FN2, PTH0_FN),
775
776 /* PTI FN */
777 PINMUX_DATA(IRQ15_MARK, PTI7_FN),
778 PINMUX_DATA(IRQ14_MARK, PTI6_FN),
779 PINMUX_DATA(IRQ13_MARK, PTI5_FN),
780 PINMUX_DATA(IRQ12_MARK, PTI4_FN),
781 PINMUX_DATA(IRQ11_MARK, PTI3_FN),
782 PINMUX_DATA(IRQ10_MARK, PTI2_FN),
783 PINMUX_DATA(IRQ9_MARK, PTI1_FN),
784 PINMUX_DATA(IRQ8_MARK, PTI0_FN),
785
786 /* PTJ FN */
787 PINMUX_DATA(RXD3_MARK, PTJ7_FN),
788 PINMUX_DATA(TXD3_MARK, PTJ6_FN),
789 PINMUX_DATA(RXD2_MARK, PTJ5_FN),
790 PINMUX_DATA(TXD2_MARK, PTJ4_FN),
791 PINMUX_DATA(COM1_TXD_MARK, PTJ3_FN),
792 PINMUX_DATA(COM1_RXD_MARK, PTJ2_FN),
793 PINMUX_DATA(COM1_RTS_MARK, PTJ1_FN),
794 PINMUX_DATA(COM1_CTS_MARK, PTJ0_FN),
795
796 /* PTK FN */
797 PINMUX_DATA(COM2_TXD_MARK, PTK7_FN),
798 PINMUX_DATA(COM2_RXD_MARK, PTK6_FN),
799 PINMUX_DATA(COM2_RTS_MARK, PTK5_FN),
800 PINMUX_DATA(COM2_CTS_MARK, PTK4_FN),
801 PINMUX_DATA(COM2_DTR_MARK, PTK3_FN),
802 PINMUX_DATA(COM2_DSR_MARK, PTK2_FN),
803 PINMUX_DATA(COM2_DCD_MARK, PTK1_FN),
804 PINMUX_DATA(COM2_RI_MARK, PTK0_FN),
805
806 /* PTL FN */
807 PINMUX_DATA(RAC_TXD_MARK, PTL7_FN),
808 PINMUX_DATA(RAC_RXD_MARK, PTL6_FN),
809 PINMUX_DATA(RAC_RTS_MARK, PTL5_FN),
810 PINMUX_DATA(RAC_CTS_MARK, PTL4_FN),
811 PINMUX_DATA(RAC_DTR_MARK, PTL3_FN),
812 PINMUX_DATA(RAC_DSR_MARK, PTL2_FN),
813 PINMUX_DATA(RAC_DCD_MARK, PTL1_FN),
814 PINMUX_DATA(RAC_RI_MARK, PTL0_FN),
815
816 /* PTM FN */
817 PINMUX_DATA(WP_MARK, PTM6_FN),
818 PINMUX_DATA(FMS0_MARK, PTM5_FN),
819 PINMUX_DATA(FMS1_MARK, PTM4_FN),
820 PINMUX_DATA(SDA6_MARK, PTM3_FN),
821 PINMUX_DATA(SCL6_MARK, PTM2_FN),
822 PINMUX_DATA(SDA7_MARK, PTM1_FN),
823 PINMUX_DATA(SCL7_MARK, PTM0_FN),
824
825 /* PTN FN */
826 PINMUX_DATA(SCK2_MARK, PS4_15_FN1, PTN7_FN),
827 PINMUX_DATA(EVENT7_MARK, PS4_15_FN2, PTN7_FN),
828 PINMUX_DATA(RTS4_MARK, PS4_14_FN1, PTN6_FN),
829 PINMUX_DATA(EVENT6_MARK, PS4_14_FN2, PTN6_FN),
830 PINMUX_DATA(RTS3_MARK, PS4_13_FN1, PTN5_FN),
831 PINMUX_DATA(EVENT5_MARK, PS4_13_FN2, PTN5_FN),
832 PINMUX_DATA(RTS2_MARK, PS4_12_FN1, PTN4_FN),
833 PINMUX_DATA(EVENT4_MARK, PS4_12_FN2, PTN4_FN),
834 PINMUX_DATA(CTS4_MARK, PS4_11_FN1, PTN3_FN),
835 PINMUX_DATA(EVENT3_MARK, PS4_11_FN2, PTN3_FN),
836 PINMUX_DATA(CTS3_MARK, PS4_10_FN1, PTN2_FN),
837 PINMUX_DATA(EVENT2_MARK, PS4_10_FN2, PTN2_FN),
838 PINMUX_DATA(CTS2_MARK, PS4_9_FN1, PTN1_FN),
839 PINMUX_DATA(EVENT1_MARK, PS4_9_FN2, PTN1_FN),
840 PINMUX_DATA(EVENT0_MARK, PTN0_FN),
841
842 /* PTO FN */
843 PINMUX_DATA(SGPIO0_CLK_MARK, PTO7_FN),
844 PINMUX_DATA(SGPIO0_LOAD_MARK, PTO6_FN),
845 PINMUX_DATA(SGPIO0_DI_MARK, PTO5_FN),
846 PINMUX_DATA(SGPIO0_DO_MARK, PTO4_FN),
847 PINMUX_DATA(SGPIO1_CLK_MARK, PTO3_FN),
848 PINMUX_DATA(SGPIO1_LOAD_MARK, PTO2_FN),
849 PINMUX_DATA(SGPIO1_DI_MARK, PTO1_FN),
850 PINMUX_DATA(SGPIO1_DO_MARK, PTO0_FN),
851
852 /* PTP FN */
853 PINMUX_DATA(JMCTCK_MARK, PTP6_FN),
854 PINMUX_DATA(JMCTMS_MARK, PTP5_FN),
855 PINMUX_DATA(JMCTDO_MARK, PTP4_FN),
856 PINMUX_DATA(JMCTDI_MARK, PTP3_FN),
857 PINMUX_DATA(JMCRST_MARK, PTP2_FN),
858 PINMUX_DATA(SCK4_MARK, PTP1_FN),
859 PINMUX_DATA(SCK3_MARK, PTP0_FN),
860
861 /* PTQ FN */
862 PINMUX_DATA(LAD3_MARK, PTQ6_FN),
863 PINMUX_DATA(LAD2_MARK, PTQ5_FN),
864 PINMUX_DATA(LAD1_MARK, PTQ4_FN),
865 PINMUX_DATA(LAD0_MARK, PTQ3_FN),
866 PINMUX_DATA(LFRAME_MARK, PTQ2_FN),
867 PINMUX_DATA(SCK4_MARK, PTQ1_FN),
868 PINMUX_DATA(SCK3_MARK, PTQ0_FN),
869
870 /* PTR FN */
871 PINMUX_DATA(SDA8_MARK, PTR7_FN), /* DDC3? */
872 PINMUX_DATA(SCL8_MARK, PTR6_FN), /* DDC2? */
873 PINMUX_DATA(SDA2_MARK, PTR5_FN),
874 PINMUX_DATA(SCL2_MARK, PTR4_FN),
875 PINMUX_DATA(SDA1_MARK, PTR3_FN),
876 PINMUX_DATA(SCL1_MARK, PTR2_FN),
877 PINMUX_DATA(SDA0_MARK, PTR1_FN),
878 PINMUX_DATA(SCL0_MARK, PTR0_FN),
879
880 /* PTS FN */
881 PINMUX_DATA(SDA9_MARK, PTS7_FN), /* DDC1? */
882 PINMUX_DATA(SCL9_MARK, PTS6_FN), /* DDC0? */
883 PINMUX_DATA(SDA5_MARK, PTS5_FN),
884 PINMUX_DATA(SCL5_MARK, PTS4_FN),
885 PINMUX_DATA(SDA4_MARK, PTS3_FN),
886 PINMUX_DATA(SCL4_MARK, PTS2_FN),
887 PINMUX_DATA(SDA3_MARK, PTS1_FN),
888 PINMUX_DATA(SCL3_MARK, PTS0_FN),
889
890 /* PTT FN */
891 PINMUX_DATA(AUDSYNC_MARK, PTS5_FN),
892 PINMUX_DATA(AUDCK_MARK, PTS4_FN),
893 PINMUX_DATA(AUDATA3_MARK, PS4_3_FN1, PTS3_FN),
894 PINMUX_DATA(PWX7_MARK, PS4_3_FN2, PTS3_FN),
895 PINMUX_DATA(AUDATA2_MARK, PS4_2_FN1, PTS2_FN),
896 PINMUX_DATA(PWX6_MARK, PS4_2_FN2, PTS2_FN),
897 PINMUX_DATA(AUDATA1_MARK, PS4_1_FN1, PTS1_FN),
898 PINMUX_DATA(PWX5_MARK, PS4_1_FN2, PTS1_FN),
899 PINMUX_DATA(AUDATA0_MARK, PS4_0_FN1, PTS0_FN),
900 PINMUX_DATA(PWX4_MARK, PS4_0_FN2, PTS0_FN),
901
902 /* PTU FN */
903 PINMUX_DATA(CS6_MARK, PTU7_FN),
904 PINMUX_DATA(CS5_MARK, PTU6_FN),
905 PINMUX_DATA(CS4_MARK, PTU5_FN),
906 PINMUX_DATA(CS0_MARK, PTU4_FN),
907 PINMUX_DATA(RD_MARK, PTU3_FN),
908 PINMUX_DATA(WE0_MARK, PTU2_FN),
909 PINMUX_DATA(A25_MARK, PS5_9_FN1, PTU1_FN),
910 PINMUX_DATA(DREQ0_MARK, PS5_9_FN2, PTU1_FN),
911 PINMUX_DATA(A24_MARK, PS5_8_FN1, PTU0_FN),
912 PINMUX_DATA(DACK0_MARK, PS5_8_FN2, PTU0_FN),
913
914 /* PTV FN */
915 PINMUX_DATA(A23_MARK, PS5_7_FN1, PTV7_FN),
916 PINMUX_DATA(TEND0_MARK, PS5_7_FN2, PTV7_FN),
917 PINMUX_DATA(A22_MARK, PS5_6_FN1, PTV6_FN),
918 PINMUX_DATA(DREQ1_MARK, PS5_6_FN2, PTV6_FN),
919 PINMUX_DATA(A21_MARK, PS5_5_FN1, PTV5_FN),
920 PINMUX_DATA(DACK1_MARK, PS5_5_FN2, PTV5_FN),
921 PINMUX_DATA(A20_MARK, PS5_4_FN1, PTV4_FN),
922 PINMUX_DATA(TEND1_MARK, PS5_4_FN2, PTV4_FN),
923 PINMUX_DATA(A19_MARK, PTV3_FN),
924 PINMUX_DATA(A18_MARK, PTV2_FN),
925 PINMUX_DATA(A17_MARK, PTV1_FN),
926 PINMUX_DATA(A16_MARK, PTV0_FN),
927
928 /* PTW FN */
929 PINMUX_DATA(A15_MARK, PTW7_FN),
930 PINMUX_DATA(A14_MARK, PTW6_FN),
931 PINMUX_DATA(A13_MARK, PTW5_FN),
932 PINMUX_DATA(A12_MARK, PTW4_FN),
933 PINMUX_DATA(A11_MARK, PTW3_FN),
934 PINMUX_DATA(A10_MARK, PTW2_FN),
935 PINMUX_DATA(A9_MARK, PTW1_FN),
936 PINMUX_DATA(A8_MARK, PTW0_FN),
937
938 /* PTX FN */
939 PINMUX_DATA(A7_MARK, PTX7_FN),
940 PINMUX_DATA(A6_MARK, PTX6_FN),
941 PINMUX_DATA(A5_MARK, PTX5_FN),
942 PINMUX_DATA(A4_MARK, PTX4_FN),
943 PINMUX_DATA(A3_MARK, PTX3_FN),
944 PINMUX_DATA(A2_MARK, PTX2_FN),
945 PINMUX_DATA(A1_MARK, PTX1_FN),
946 PINMUX_DATA(A0_MARK, PTX0_FN),
947
948 /* PTY FN */
949 PINMUX_DATA(D7_MARK, PTY7_FN),
950 PINMUX_DATA(D6_MARK, PTY6_FN),
951 PINMUX_DATA(D5_MARK, PTY5_FN),
952 PINMUX_DATA(D4_MARK, PTY4_FN),
953 PINMUX_DATA(D3_MARK, PTY3_FN),
954 PINMUX_DATA(D2_MARK, PTY2_FN),
955 PINMUX_DATA(D1_MARK, PTY1_FN),
956 PINMUX_DATA(D0_MARK, PTY0_FN),
957};
958
959static struct pinmux_gpio pinmux_gpios[] = {
960 /* PTA */
961 PINMUX_GPIO(GPIO_PTA7, PTA7_DATA),
962 PINMUX_GPIO(GPIO_PTA6, PTA6_DATA),
963 PINMUX_GPIO(GPIO_PTA5, PTA5_DATA),
964 PINMUX_GPIO(GPIO_PTA4, PTA4_DATA),
965 PINMUX_GPIO(GPIO_PTA3, PTA3_DATA),
966 PINMUX_GPIO(GPIO_PTA2, PTA2_DATA),
967 PINMUX_GPIO(GPIO_PTA1, PTA1_DATA),
968 PINMUX_GPIO(GPIO_PTA0, PTA0_DATA),
969
970 /* PTB */
971 PINMUX_GPIO(GPIO_PTB7, PTB7_DATA),
972 PINMUX_GPIO(GPIO_PTB6, PTB6_DATA),
973 PINMUX_GPIO(GPIO_PTB5, PTB5_DATA),
974 PINMUX_GPIO(GPIO_PTB4, PTB4_DATA),
975 PINMUX_GPIO(GPIO_PTB3, PTB3_DATA),
976 PINMUX_GPIO(GPIO_PTB2, PTB2_DATA),
977 PINMUX_GPIO(GPIO_PTB1, PTB1_DATA),
978 PINMUX_GPIO(GPIO_PTB0, PTB0_DATA),
979
980 /* PTC */
981 PINMUX_GPIO(GPIO_PTC7, PTC7_DATA),
982 PINMUX_GPIO(GPIO_PTC6, PTC6_DATA),
983 PINMUX_GPIO(GPIO_PTC5, PTC5_DATA),
984 PINMUX_GPIO(GPIO_PTC4, PTC4_DATA),
985 PINMUX_GPIO(GPIO_PTC3, PTC3_DATA),
986 PINMUX_GPIO(GPIO_PTC2, PTC2_DATA),
987 PINMUX_GPIO(GPIO_PTC1, PTC1_DATA),
988 PINMUX_GPIO(GPIO_PTC0, PTC0_DATA),
989
990 /* PTD */
991 PINMUX_GPIO(GPIO_PTD7, PTD7_DATA),
992 PINMUX_GPIO(GPIO_PTD6, PTD6_DATA),
993 PINMUX_GPIO(GPIO_PTD5, PTD5_DATA),
994 PINMUX_GPIO(GPIO_PTD4, PTD4_DATA),
995 PINMUX_GPIO(GPIO_PTD3, PTD3_DATA),
996 PINMUX_GPIO(GPIO_PTD2, PTD2_DATA),
997 PINMUX_GPIO(GPIO_PTD1, PTD1_DATA),
998 PINMUX_GPIO(GPIO_PTD0, PTD0_DATA),
999
1000 /* PTE */
1001 PINMUX_GPIO(GPIO_PTE7, PTE7_DATA),
1002 PINMUX_GPIO(GPIO_PTE6, PTE6_DATA),
1003 PINMUX_GPIO(GPIO_PTE5, PTE5_DATA),
1004 PINMUX_GPIO(GPIO_PTE4, PTE4_DATA),
1005 PINMUX_GPIO(GPIO_PTE3, PTE3_DATA),
1006 PINMUX_GPIO(GPIO_PTE2, PTE2_DATA),
1007 PINMUX_GPIO(GPIO_PTE1, PTE1_DATA),
1008 PINMUX_GPIO(GPIO_PTE0, PTE0_DATA),
1009
1010 /* PTF */
1011 PINMUX_GPIO(GPIO_PTF7, PTF7_DATA),
1012 PINMUX_GPIO(GPIO_PTF6, PTF6_DATA),
1013 PINMUX_GPIO(GPIO_PTF5, PTF5_DATA),
1014 PINMUX_GPIO(GPIO_PTF4, PTF4_DATA),
1015 PINMUX_GPIO(GPIO_PTF3, PTF3_DATA),
1016 PINMUX_GPIO(GPIO_PTF2, PTF2_DATA),
1017 PINMUX_GPIO(GPIO_PTF1, PTF1_DATA),
1018 PINMUX_GPIO(GPIO_PTF0, PTF0_DATA),
1019
1020 /* PTG */
1021 PINMUX_GPIO(GPIO_PTG7, PTG7_DATA),
1022 PINMUX_GPIO(GPIO_PTG6, PTG6_DATA),
1023 PINMUX_GPIO(GPIO_PTG5, PTG5_DATA),
1024 PINMUX_GPIO(GPIO_PTG4, PTG4_DATA),
1025 PINMUX_GPIO(GPIO_PTG3, PTG3_DATA),
1026 PINMUX_GPIO(GPIO_PTG2, PTG2_DATA),
1027 PINMUX_GPIO(GPIO_PTG1, PTG1_DATA),
1028 PINMUX_GPIO(GPIO_PTG0, PTG0_DATA),
1029
1030 /* PTH */
1031 PINMUX_GPIO(GPIO_PTH7, PTH7_DATA),
1032 PINMUX_GPIO(GPIO_PTH6, PTH6_DATA),
1033 PINMUX_GPIO(GPIO_PTH5, PTH5_DATA),
1034 PINMUX_GPIO(GPIO_PTH4, PTH4_DATA),
1035 PINMUX_GPIO(GPIO_PTH3, PTH3_DATA),
1036 PINMUX_GPIO(GPIO_PTH2, PTH2_DATA),
1037 PINMUX_GPIO(GPIO_PTH1, PTH1_DATA),
1038 PINMUX_GPIO(GPIO_PTH0, PTH0_DATA),
1039
1040 /* PTI */
1041 PINMUX_GPIO(GPIO_PTI7, PTI7_DATA),
1042 PINMUX_GPIO(GPIO_PTI6, PTI6_DATA),
1043 PINMUX_GPIO(GPIO_PTI5, PTI5_DATA),
1044 PINMUX_GPIO(GPIO_PTI4, PTI4_DATA),
1045 PINMUX_GPIO(GPIO_PTI3, PTI3_DATA),
1046 PINMUX_GPIO(GPIO_PTI2, PTI2_DATA),
1047 PINMUX_GPIO(GPIO_PTI1, PTI1_DATA),
1048 PINMUX_GPIO(GPIO_PTI0, PTI0_DATA),
1049
1050 /* PTJ */
1051 PINMUX_GPIO(GPIO_PTJ7, PTJ7_DATA),
1052 PINMUX_GPIO(GPIO_PTJ6, PTJ6_DATA),
1053 PINMUX_GPIO(GPIO_PTJ5, PTJ5_DATA),
1054 PINMUX_GPIO(GPIO_PTJ4, PTJ4_DATA),
1055 PINMUX_GPIO(GPIO_PTJ3, PTJ3_DATA),
1056 PINMUX_GPIO(GPIO_PTJ2, PTJ2_DATA),
1057 PINMUX_GPIO(GPIO_PTJ1, PTJ1_DATA),
1058 PINMUX_GPIO(GPIO_PTJ0, PTJ0_DATA),
1059
1060 /* PTK */
1061 PINMUX_GPIO(GPIO_PTK7, PTK7_DATA),
1062 PINMUX_GPIO(GPIO_PTK6, PTK6_DATA),
1063 PINMUX_GPIO(GPIO_PTK5, PTK5_DATA),
1064 PINMUX_GPIO(GPIO_PTK4, PTK4_DATA),
1065 PINMUX_GPIO(GPIO_PTK3, PTK3_DATA),
1066 PINMUX_GPIO(GPIO_PTK2, PTK2_DATA),
1067 PINMUX_GPIO(GPIO_PTK1, PTK1_DATA),
1068 PINMUX_GPIO(GPIO_PTK0, PTK0_DATA),
1069
1070 /* PTL */
1071 PINMUX_GPIO(GPIO_PTL7, PTL7_DATA),
1072 PINMUX_GPIO(GPIO_PTL6, PTL6_DATA),
1073 PINMUX_GPIO(GPIO_PTL5, PTL5_DATA),
1074 PINMUX_GPIO(GPIO_PTL4, PTL4_DATA),
1075 PINMUX_GPIO(GPIO_PTL3, PTL3_DATA),
1076 PINMUX_GPIO(GPIO_PTL2, PTL2_DATA),
1077 PINMUX_GPIO(GPIO_PTL1, PTL1_DATA),
1078 PINMUX_GPIO(GPIO_PTL0, PTL0_DATA),
1079
1080 /* PTM */
1081 PINMUX_GPIO(GPIO_PTM6, PTM6_DATA),
1082 PINMUX_GPIO(GPIO_PTM5, PTM5_DATA),
1083 PINMUX_GPIO(GPIO_PTM4, PTM4_DATA),
1084 PINMUX_GPIO(GPIO_PTM3, PTM3_DATA),
1085 PINMUX_GPIO(GPIO_PTM2, PTM2_DATA),
1086 PINMUX_GPIO(GPIO_PTM1, PTM1_DATA),
1087 PINMUX_GPIO(GPIO_PTM0, PTM0_DATA),
1088
1089 /* PTN */
1090 PINMUX_GPIO(GPIO_PTN7, PTN7_DATA),
1091 PINMUX_GPIO(GPIO_PTN6, PTN6_DATA),
1092 PINMUX_GPIO(GPIO_PTN5, PTN5_DATA),
1093 PINMUX_GPIO(GPIO_PTN4, PTN4_DATA),
1094 PINMUX_GPIO(GPIO_PTN3, PTN3_DATA),
1095 PINMUX_GPIO(GPIO_PTN2, PTN2_DATA),
1096 PINMUX_GPIO(GPIO_PTN1, PTN1_DATA),
1097 PINMUX_GPIO(GPIO_PTN0, PTN0_DATA),
1098
1099 /* PTO */
1100 PINMUX_GPIO(GPIO_PTO7, PTO7_DATA),
1101 PINMUX_GPIO(GPIO_PTO6, PTO6_DATA),
1102 PINMUX_GPIO(GPIO_PTO5, PTO5_DATA),
1103 PINMUX_GPIO(GPIO_PTO4, PTO4_DATA),
1104 PINMUX_GPIO(GPIO_PTO3, PTO3_DATA),
1105 PINMUX_GPIO(GPIO_PTO2, PTO2_DATA),
1106 PINMUX_GPIO(GPIO_PTO1, PTO1_DATA),
1107 PINMUX_GPIO(GPIO_PTO0, PTO0_DATA),
1108
1109 /* PTP */
1110 PINMUX_GPIO(GPIO_PTP6, PTP6_DATA),
1111 PINMUX_GPIO(GPIO_PTP5, PTP5_DATA),
1112 PINMUX_GPIO(GPIO_PTP4, PTP4_DATA),
1113 PINMUX_GPIO(GPIO_PTP3, PTP3_DATA),
1114 PINMUX_GPIO(GPIO_PTP2, PTP2_DATA),
1115 PINMUX_GPIO(GPIO_PTP1, PTP1_DATA),
1116 PINMUX_GPIO(GPIO_PTP0, PTP0_DATA),
1117
1118 /* PTQ */
1119 PINMUX_GPIO(GPIO_PTQ6, PTQ6_DATA),
1120 PINMUX_GPIO(GPIO_PTQ5, PTQ5_DATA),
1121 PINMUX_GPIO(GPIO_PTQ4, PTQ4_DATA),
1122 PINMUX_GPIO(GPIO_PTQ3, PTQ3_DATA),
1123 PINMUX_GPIO(GPIO_PTQ2, PTQ2_DATA),
1124 PINMUX_GPIO(GPIO_PTQ1, PTQ1_DATA),
1125 PINMUX_GPIO(GPIO_PTQ0, PTQ0_DATA),
1126
1127 /* PTR */
1128 PINMUX_GPIO(GPIO_PTR7, PTR7_DATA),
1129 PINMUX_GPIO(GPIO_PTR6, PTR6_DATA),
1130 PINMUX_GPIO(GPIO_PTR5, PTR5_DATA),
1131 PINMUX_GPIO(GPIO_PTR4, PTR4_DATA),
1132 PINMUX_GPIO(GPIO_PTR3, PTR3_DATA),
1133 PINMUX_GPIO(GPIO_PTR2, PTR2_DATA),
1134 PINMUX_GPIO(GPIO_PTR1, PTR1_DATA),
1135 PINMUX_GPIO(GPIO_PTR0, PTR0_DATA),
1136
1137 /* PTS */
1138 PINMUX_GPIO(GPIO_PTS7, PTS7_DATA),
1139 PINMUX_GPIO(GPIO_PTS6, PTS6_DATA),
1140 PINMUX_GPIO(GPIO_PTS5, PTS5_DATA),
1141 PINMUX_GPIO(GPIO_PTS4, PTS4_DATA),
1142 PINMUX_GPIO(GPIO_PTS3, PTS3_DATA),
1143 PINMUX_GPIO(GPIO_PTS2, PTS2_DATA),
1144 PINMUX_GPIO(GPIO_PTS1, PTS1_DATA),
1145 PINMUX_GPIO(GPIO_PTS0, PTS0_DATA),
1146
1147 /* PTT */
1148 PINMUX_GPIO(GPIO_PTT5, PTT5_DATA),
1149 PINMUX_GPIO(GPIO_PTT4, PTT4_DATA),
1150 PINMUX_GPIO(GPIO_PTT3, PTT3_DATA),
1151 PINMUX_GPIO(GPIO_PTT2, PTT2_DATA),
1152 PINMUX_GPIO(GPIO_PTT1, PTT1_DATA),
1153 PINMUX_GPIO(GPIO_PTT0, PTT0_DATA),
1154
1155 /* PTU */
1156 PINMUX_GPIO(GPIO_PTU7, PTU7_DATA),
1157 PINMUX_GPIO(GPIO_PTU6, PTU6_DATA),
1158 PINMUX_GPIO(GPIO_PTU5, PTU5_DATA),
1159 PINMUX_GPIO(GPIO_PTU4, PTU4_DATA),
1160 PINMUX_GPIO(GPIO_PTU3, PTU3_DATA),
1161 PINMUX_GPIO(GPIO_PTU2, PTU2_DATA),
1162 PINMUX_GPIO(GPIO_PTU1, PTU1_DATA),
1163 PINMUX_GPIO(GPIO_PTU0, PTU0_DATA),
1164
1165 /* PTV */
1166 PINMUX_GPIO(GPIO_PTV7, PTV7_DATA),
1167 PINMUX_GPIO(GPIO_PTV6, PTV6_DATA),
1168 PINMUX_GPIO(GPIO_PTV5, PTV5_DATA),
1169 PINMUX_GPIO(GPIO_PTV4, PTV4_DATA),
1170 PINMUX_GPIO(GPIO_PTV3, PTV3_DATA),
1171 PINMUX_GPIO(GPIO_PTV2, PTV2_DATA),
1172 PINMUX_GPIO(GPIO_PTV1, PTV1_DATA),
1173 PINMUX_GPIO(GPIO_PTV0, PTV0_DATA),
1174
1175 /* PTW */
1176 PINMUX_GPIO(GPIO_PTW7, PTW7_DATA),
1177 PINMUX_GPIO(GPIO_PTW6, PTW6_DATA),
1178 PINMUX_GPIO(GPIO_PTW5, PTW5_DATA),
1179 PINMUX_GPIO(GPIO_PTW4, PTW4_DATA),
1180 PINMUX_GPIO(GPIO_PTW3, PTW3_DATA),
1181 PINMUX_GPIO(GPIO_PTW2, PTW2_DATA),
1182 PINMUX_GPIO(GPIO_PTW1, PTW1_DATA),
1183 PINMUX_GPIO(GPIO_PTW0, PTW0_DATA),
1184
1185 /* PTX */
1186 PINMUX_GPIO(GPIO_PTX7, PTX7_DATA),
1187 PINMUX_GPIO(GPIO_PTX6, PTX6_DATA),
1188 PINMUX_GPIO(GPIO_PTX5, PTX5_DATA),
1189 PINMUX_GPIO(GPIO_PTX4, PTX4_DATA),
1190 PINMUX_GPIO(GPIO_PTX3, PTX3_DATA),
1191 PINMUX_GPIO(GPIO_PTX2, PTX2_DATA),
1192 PINMUX_GPIO(GPIO_PTX1, PTX1_DATA),
1193 PINMUX_GPIO(GPIO_PTX0, PTX0_DATA),
1194
1195 /* PTY */
1196 PINMUX_GPIO(GPIO_PTY7, PTY7_DATA),
1197 PINMUX_GPIO(GPIO_PTY6, PTY6_DATA),
1198 PINMUX_GPIO(GPIO_PTY5, PTY5_DATA),
1199 PINMUX_GPIO(GPIO_PTY4, PTY4_DATA),
1200 PINMUX_GPIO(GPIO_PTY3, PTY3_DATA),
1201 PINMUX_GPIO(GPIO_PTY2, PTY2_DATA),
1202 PINMUX_GPIO(GPIO_PTY1, PTY1_DATA),
1203 PINMUX_GPIO(GPIO_PTY0, PTY0_DATA),
1204
1205 /* PTZ */
1206 PINMUX_GPIO(GPIO_PTZ7, PTZ7_DATA),
1207 PINMUX_GPIO(GPIO_PTZ6, PTZ6_DATA),
1208 PINMUX_GPIO(GPIO_PTZ5, PTZ5_DATA),
1209 PINMUX_GPIO(GPIO_PTZ4, PTZ4_DATA),
1210 PINMUX_GPIO(GPIO_PTZ3, PTZ3_DATA),
1211 PINMUX_GPIO(GPIO_PTZ2, PTZ2_DATA),
1212 PINMUX_GPIO(GPIO_PTZ1, PTZ1_DATA),
1213 PINMUX_GPIO(GPIO_PTZ0, PTZ0_DATA),
1214
1215 /* PTA (mobule: LBSC, CPG, LPC) */
1216 PINMUX_GPIO(GPIO_FN_BS, BS_MARK),
1217 PINMUX_GPIO(GPIO_FN_RDWR, RDWR_MARK),
1218 PINMUX_GPIO(GPIO_FN_WE1, WE1_MARK),
1219 PINMUX_GPIO(GPIO_FN_RDY, RDY_MARK),
1220 PINMUX_GPIO(GPIO_FN_MD10, MD10_MARK),
1221 PINMUX_GPIO(GPIO_FN_MD9, MD9_MARK),
1222 PINMUX_GPIO(GPIO_FN_MD8, MD8_MARK),
1223 PINMUX_GPIO(GPIO_FN_LGPIO7, LGPIO7_MARK),
1224 PINMUX_GPIO(GPIO_FN_LGPIO6, LGPIO6_MARK),
1225 PINMUX_GPIO(GPIO_FN_LGPIO5, LGPIO5_MARK),
1226 PINMUX_GPIO(GPIO_FN_LGPIO4, LGPIO4_MARK),
1227 PINMUX_GPIO(GPIO_FN_LGPIO3, LGPIO3_MARK),
1228 PINMUX_GPIO(GPIO_FN_LGPIO2, LGPIO2_MARK),
1229 PINMUX_GPIO(GPIO_FN_LGPIO1, LGPIO1_MARK),
1230 PINMUX_GPIO(GPIO_FN_LGPIO0, LGPIO0_MARK),
1231
1232 /* PTB (mobule: LBSC, EtherC, SIM, LPC) */
1233 PINMUX_GPIO(GPIO_FN_D15, D15_MARK),
1234 PINMUX_GPIO(GPIO_FN_D14, D14_MARK),
1235 PINMUX_GPIO(GPIO_FN_D13, D13_MARK),
1236 PINMUX_GPIO(GPIO_FN_D12, D12_MARK),
1237 PINMUX_GPIO(GPIO_FN_D11, D11_MARK),
1238 PINMUX_GPIO(GPIO_FN_D10, D10_MARK),
1239 PINMUX_GPIO(GPIO_FN_D9, D9_MARK),
1240 PINMUX_GPIO(GPIO_FN_D8, D8_MARK),
1241 PINMUX_GPIO(GPIO_FN_ET0_MDC, ET0_MDC_MARK),
1242 PINMUX_GPIO(GPIO_FN_ET0_MDIO, ET0_MDIO_MARK),
1243 PINMUX_GPIO(GPIO_FN_ET1_MDC, ET1_MDC_MARK),
1244 PINMUX_GPIO(GPIO_FN_ET1_MDIO, ET1_MDIO_MARK),
1245 PINMUX_GPIO(GPIO_FN_WPSZ1, WPSZ1_MARK),
1246 PINMUX_GPIO(GPIO_FN_WPSZ0, WPSZ0_MARK),
1247 PINMUX_GPIO(GPIO_FN_FWID, FWID_MARK),
1248 PINMUX_GPIO(GPIO_FN_FLSHSZ, FLSHSZ_MARK),
1249 PINMUX_GPIO(GPIO_FN_LPC_SPIEN, LPC_SPIEN_MARK),
1250 PINMUX_GPIO(GPIO_FN_BASEL, BASEL_MARK),
1251
1252 /* PTC (mobule: SD) */
1253 PINMUX_GPIO(GPIO_FN_SD_WP, SD_WP_MARK),
1254 PINMUX_GPIO(GPIO_FN_SD_CD, SD_CD_MARK),
1255 PINMUX_GPIO(GPIO_FN_SD_CLK, SD_CLK_MARK),
1256 PINMUX_GPIO(GPIO_FN_SD_CMD, SD_CMD_MARK),
1257 PINMUX_GPIO(GPIO_FN_SD_D3, SD_D3_MARK),
1258 PINMUX_GPIO(GPIO_FN_SD_D2, SD_D2_MARK),
1259 PINMUX_GPIO(GPIO_FN_SD_D1, SD_D1_MARK),
1260 PINMUX_GPIO(GPIO_FN_SD_D0, SD_D0_MARK),
1261
1262 /* PTD (mobule: INTC, SPI0, LBSC, CPG, ADC) */
1263 PINMUX_GPIO(GPIO_FN_IRQ7, IRQ7_MARK),
1264 PINMUX_GPIO(GPIO_FN_IRQ6, IRQ6_MARK),
1265 PINMUX_GPIO(GPIO_FN_IRQ5, IRQ5_MARK),
1266 PINMUX_GPIO(GPIO_FN_IRQ4, IRQ4_MARK),
1267 PINMUX_GPIO(GPIO_FN_IRQ3, IRQ3_MARK),
1268 PINMUX_GPIO(GPIO_FN_IRQ2, IRQ2_MARK),
1269 PINMUX_GPIO(GPIO_FN_IRQ1, IRQ1_MARK),
1270 PINMUX_GPIO(GPIO_FN_IRQ0, IRQ0_MARK),
1271 PINMUX_GPIO(GPIO_FN_MD6, MD6_MARK),
1272 PINMUX_GPIO(GPIO_FN_MD5, MD5_MARK),
1273 PINMUX_GPIO(GPIO_FN_MD3, MD3_MARK),
1274 PINMUX_GPIO(GPIO_FN_MD2, MD2_MARK),
1275 PINMUX_GPIO(GPIO_FN_MD1, MD1_MARK),
1276 PINMUX_GPIO(GPIO_FN_MD0, MD0_MARK),
1277 PINMUX_GPIO(GPIO_FN_ADTRG1, ADTRG1_MARK),
1278 PINMUX_GPIO(GPIO_FN_ADTRG0, ADTRG0_MARK),
1279
1280 /* PTE (mobule: EtherC) */
1281 PINMUX_GPIO(GPIO_FN_ET0_CRS_DV, ET0_CRS_DV_MARK),
1282 PINMUX_GPIO(GPIO_FN_ET0_TXD1, ET0_TXD1_MARK),
1283 PINMUX_GPIO(GPIO_FN_ET0_TXD0, ET0_TXD0_MARK),
1284 PINMUX_GPIO(GPIO_FN_ET0_TX_EN, ET0_TX_EN_MARK),
1285 PINMUX_GPIO(GPIO_FN_ET0_REF_CLK, ET0_REF_CLK_MARK),
1286 PINMUX_GPIO(GPIO_FN_ET0_RXD1, ET0_RXD1_MARK),
1287 PINMUX_GPIO(GPIO_FN_ET0_RXD0, ET0_RXD0_MARK),
1288 PINMUX_GPIO(GPIO_FN_ET0_RX_ER, ET0_RX_ER_MARK),
1289
1290 /* PTF (mobule: EtherC) */
1291 PINMUX_GPIO(GPIO_FN_ET1_CRS_DV, ET1_CRS_DV_MARK),
1292 PINMUX_GPIO(GPIO_FN_ET1_TXD1, ET1_TXD1_MARK),
1293 PINMUX_GPIO(GPIO_FN_ET1_TXD0, ET1_TXD0_MARK),
1294 PINMUX_GPIO(GPIO_FN_ET1_TX_EN, ET1_TX_EN_MARK),
1295 PINMUX_GPIO(GPIO_FN_ET1_REF_CLK, ET1_REF_CLK_MARK),
1296 PINMUX_GPIO(GPIO_FN_ET1_RXD1, ET1_RXD1_MARK),
1297 PINMUX_GPIO(GPIO_FN_ET1_RXD0, ET1_RXD0_MARK),
1298 PINMUX_GPIO(GPIO_FN_ET1_RX_ER, ET1_RX_ER_MARK),
1299
1300 /* PTG (mobule: SYSTEM, PWMX, LPC) */
1301 PINMUX_GPIO(GPIO_FN_STATUS0, STATUS0_MARK),
1302 PINMUX_GPIO(GPIO_FN_STATUS1, STATUS1_MARK),
1303 PINMUX_GPIO(GPIO_FN_PWX0, PWX0_MARK),
1304 PINMUX_GPIO(GPIO_FN_PWX1, PWX1_MARK),
1305 PINMUX_GPIO(GPIO_FN_PWX2, PWX2_MARK),
1306 PINMUX_GPIO(GPIO_FN_PWX3, PWX3_MARK),
1307 PINMUX_GPIO(GPIO_FN_SERIRQ, SERIRQ_MARK),
1308 PINMUX_GPIO(GPIO_FN_CLKRUN, CLKRUN_MARK),
1309 PINMUX_GPIO(GPIO_FN_LPCPD, LPCPD_MARK),
1310 PINMUX_GPIO(GPIO_FN_LDRQ, LDRQ_MARK),
1311
1312 /* PTH (mobule: TMU, SCIF234, SPI1, SPI0) */
1313 PINMUX_GPIO(GPIO_FN_TCLK, TCLK_MARK),
1314 PINMUX_GPIO(GPIO_FN_RXD4, RXD4_MARK),
1315 PINMUX_GPIO(GPIO_FN_TXD4, TXD4_MARK),
1316 PINMUX_GPIO(GPIO_FN_SP1_MOSI, SP1_MOSI_MARK),
1317 PINMUX_GPIO(GPIO_FN_SP1_MISO, SP1_MISO_MARK),
1318 PINMUX_GPIO(GPIO_FN_SP1_SCK, SP1_SCK_MARK),
1319 PINMUX_GPIO(GPIO_FN_SP1_SCK_FB, SP1_SCK_FB_MARK),
1320 PINMUX_GPIO(GPIO_FN_SP1_SS0, SP1_SS0_MARK),
1321 PINMUX_GPIO(GPIO_FN_SP1_SS1, SP1_SS1_MARK),
1322 PINMUX_GPIO(GPIO_FN_SP0_SS1, SP0_SS1_MARK),
1323
1324 /* PTI (mobule: INTC) */
1325 PINMUX_GPIO(GPIO_FN_IRQ15, IRQ15_MARK),
1326 PINMUX_GPIO(GPIO_FN_IRQ14, IRQ14_MARK),
1327 PINMUX_GPIO(GPIO_FN_IRQ13, IRQ13_MARK),
1328 PINMUX_GPIO(GPIO_FN_IRQ12, IRQ12_MARK),
1329 PINMUX_GPIO(GPIO_FN_IRQ11, IRQ11_MARK),
1330 PINMUX_GPIO(GPIO_FN_IRQ10, IRQ10_MARK),
1331 PINMUX_GPIO(GPIO_FN_IRQ9, IRQ9_MARK),
1332 PINMUX_GPIO(GPIO_FN_IRQ8, IRQ8_MARK),
1333
1334 /* PTJ (mobule: SCIF234, SERMUX) */
1335 PINMUX_GPIO(GPIO_FN_RXD3, RXD3_MARK),
1336 PINMUX_GPIO(GPIO_FN_TXD3, TXD3_MARK),
1337 PINMUX_GPIO(GPIO_FN_RXD2, RXD2_MARK),
1338 PINMUX_GPIO(GPIO_FN_TXD2, TXD2_MARK),
1339 PINMUX_GPIO(GPIO_FN_COM1_TXD, COM1_TXD_MARK),
1340 PINMUX_GPIO(GPIO_FN_COM1_RXD, COM1_RXD_MARK),
1341 PINMUX_GPIO(GPIO_FN_COM1_RTS, COM1_RTS_MARK),
1342 PINMUX_GPIO(GPIO_FN_COM1_CTS, COM1_CTS_MARK),
1343
1344 /* PTK (mobule: SERMUX) */
1345 PINMUX_GPIO(GPIO_FN_COM2_TXD, COM2_TXD_MARK),
1346 PINMUX_GPIO(GPIO_FN_COM2_RXD, COM2_RXD_MARK),
1347 PINMUX_GPIO(GPIO_FN_COM2_RTS, COM2_RTS_MARK),
1348 PINMUX_GPIO(GPIO_FN_COM2_CTS, COM2_CTS_MARK),
1349 PINMUX_GPIO(GPIO_FN_COM2_DTR, COM2_DTR_MARK),
1350 PINMUX_GPIO(GPIO_FN_COM2_DSR, COM2_DSR_MARK),
1351 PINMUX_GPIO(GPIO_FN_COM2_DCD, COM2_DCD_MARK),
1352 PINMUX_GPIO(GPIO_FN_COM2_RI, COM2_RI_MARK),
1353
1354 /* PTL (mobule: SERMUX) */
1355 PINMUX_GPIO(GPIO_FN_RAC_TXD, RAC_TXD_MARK),
1356 PINMUX_GPIO(GPIO_FN_RAC_RXD, RAC_RXD_MARK),
1357 PINMUX_GPIO(GPIO_FN_RAC_RTS, RAC_RTS_MARK),
1358 PINMUX_GPIO(GPIO_FN_RAC_CTS, RAC_CTS_MARK),
1359 PINMUX_GPIO(GPIO_FN_RAC_DTR, RAC_DTR_MARK),
1360 PINMUX_GPIO(GPIO_FN_RAC_DSR, RAC_DSR_MARK),
1361 PINMUX_GPIO(GPIO_FN_RAC_DCD, RAC_DCD_MARK),
1362 PINMUX_GPIO(GPIO_FN_RAC_RI, RAC_RI_MARK),
1363
1364 /* PTM (mobule: IIC, LPC) */
1365 PINMUX_GPIO(GPIO_FN_SDA6, SDA6_MARK),
1366 PINMUX_GPIO(GPIO_FN_SCL6, SCL6_MARK),
1367 PINMUX_GPIO(GPIO_FN_SDA7, SDA7_MARK),
1368 PINMUX_GPIO(GPIO_FN_SCL7, SCL7_MARK),
1369 PINMUX_GPIO(GPIO_FN_WP, WP_MARK),
1370 PINMUX_GPIO(GPIO_FN_FMS0, FMS0_MARK),
1371 PINMUX_GPIO(GPIO_FN_FMS1, FMS1_MARK),
1372
1373 /* PTN (mobule: SCIF234, EVC) */
1374 PINMUX_GPIO(GPIO_FN_SCK2, SCK2_MARK),
1375 PINMUX_GPIO(GPIO_FN_RTS4, RTS4_MARK),
1376 PINMUX_GPIO(GPIO_FN_RTS3, RTS3_MARK),
1377 PINMUX_GPIO(GPIO_FN_RTS2, RTS2_MARK),
1378 PINMUX_GPIO(GPIO_FN_CTS4, CTS4_MARK),
1379 PINMUX_GPIO(GPIO_FN_CTS3, CTS3_MARK),
1380 PINMUX_GPIO(GPIO_FN_CTS2, CTS2_MARK),
1381 PINMUX_GPIO(GPIO_FN_EVENT7, EVENT7_MARK),
1382 PINMUX_GPIO(GPIO_FN_EVENT6, EVENT6_MARK),
1383 PINMUX_GPIO(GPIO_FN_EVENT5, EVENT5_MARK),
1384 PINMUX_GPIO(GPIO_FN_EVENT4, EVENT4_MARK),
1385 PINMUX_GPIO(GPIO_FN_EVENT3, EVENT3_MARK),
1386 PINMUX_GPIO(GPIO_FN_EVENT2, EVENT2_MARK),
1387 PINMUX_GPIO(GPIO_FN_EVENT1, EVENT1_MARK),
1388 PINMUX_GPIO(GPIO_FN_EVENT0, EVENT0_MARK),
1389
1390 /* PTO (mobule: SGPIO) */
1391 PINMUX_GPIO(GPIO_FN_SGPIO0_CLK, SGPIO0_CLK_MARK),
1392 PINMUX_GPIO(GPIO_FN_SGPIO0_LOAD, SGPIO0_LOAD_MARK),
1393 PINMUX_GPIO(GPIO_FN_SGPIO0_DI, SGPIO0_DI_MARK),
1394 PINMUX_GPIO(GPIO_FN_SGPIO0_DO, SGPIO0_DO_MARK),
1395 PINMUX_GPIO(GPIO_FN_SGPIO1_CLK, SGPIO1_CLK_MARK),
1396 PINMUX_GPIO(GPIO_FN_SGPIO1_LOAD, SGPIO1_LOAD_MARK),
1397 PINMUX_GPIO(GPIO_FN_SGPIO1_DI, SGPIO1_DI_MARK),
1398 PINMUX_GPIO(GPIO_FN_SGPIO1_DO, SGPIO1_DO_MARK),
1399
1400 /* PTP (mobule: JMC, SCIF234) */
1401 PINMUX_GPIO(GPIO_FN_JMCTCK, JMCTCK_MARK),
1402 PINMUX_GPIO(GPIO_FN_JMCTMS, JMCTMS_MARK),
1403 PINMUX_GPIO(GPIO_FN_JMCTDO, JMCTDO_MARK),
1404 PINMUX_GPIO(GPIO_FN_JMCTDI, JMCTDI_MARK),
1405 PINMUX_GPIO(GPIO_FN_JMCRST, JMCRST_MARK),
1406 PINMUX_GPIO(GPIO_FN_SCK4, SCK4_MARK),
1407 PINMUX_GPIO(GPIO_FN_SCK3, SCK3_MARK),
1408
1409 /* PTQ (mobule: LPC) */
1410 PINMUX_GPIO(GPIO_FN_LAD3, LAD3_MARK),
1411 PINMUX_GPIO(GPIO_FN_LAD2, LAD2_MARK),
1412 PINMUX_GPIO(GPIO_FN_LAD1, LAD1_MARK),
1413 PINMUX_GPIO(GPIO_FN_LAD0, LAD0_MARK),
1414 PINMUX_GPIO(GPIO_FN_LFRAME, LFRAME_MARK),
1415 PINMUX_GPIO(GPIO_FN_LRESET, LRESET_MARK),
1416 PINMUX_GPIO(GPIO_FN_LCLK, LCLK_MARK),
1417
1418 /* PTR (mobule: GRA, IIC) */
1419 PINMUX_GPIO(GPIO_FN_DDC3, DDC3_MARK),
1420 PINMUX_GPIO(GPIO_FN_DDC2, DDC2_MARK),
1421 PINMUX_GPIO(GPIO_FN_SDA8, SDA8_MARK),
1422 PINMUX_GPIO(GPIO_FN_SCL8, SCL8_MARK),
1423 PINMUX_GPIO(GPIO_FN_SDA2, SDA2_MARK),
1424 PINMUX_GPIO(GPIO_FN_SCL2, SCL2_MARK),
1425 PINMUX_GPIO(GPIO_FN_SDA1, SDA1_MARK),
1426 PINMUX_GPIO(GPIO_FN_SCL1, SCL1_MARK),
1427 PINMUX_GPIO(GPIO_FN_SDA0, SDA0_MARK),
1428 PINMUX_GPIO(GPIO_FN_SCL0, SCL0_MARK),
1429
1430 /* PTS (mobule: GRA, IIC) */
1431 PINMUX_GPIO(GPIO_FN_DDC1, DDC1_MARK),
1432 PINMUX_GPIO(GPIO_FN_DDC0, DDC0_MARK),
1433 PINMUX_GPIO(GPIO_FN_SDA9, SDA9_MARK),
1434 PINMUX_GPIO(GPIO_FN_SCL9, SCL9_MARK),
1435 PINMUX_GPIO(GPIO_FN_SDA5, SDA5_MARK),
1436 PINMUX_GPIO(GPIO_FN_SCL5, SCL5_MARK),
1437 PINMUX_GPIO(GPIO_FN_SDA4, SDA4_MARK),
1438 PINMUX_GPIO(GPIO_FN_SCL4, SCL4_MARK),
1439 PINMUX_GPIO(GPIO_FN_SDA3, SDA3_MARK),
1440 PINMUX_GPIO(GPIO_FN_SCL3, SCL3_MARK),
1441
1442 /* PTT (mobule: SYSTEM, PWMX) */
1443 PINMUX_GPIO(GPIO_FN_AUDSYNC, AUDSYNC_MARK),
1444 PINMUX_GPIO(GPIO_FN_AUDCK, AUDCK_MARK),
1445 PINMUX_GPIO(GPIO_FN_AUDATA3, AUDATA3_MARK),
1446 PINMUX_GPIO(GPIO_FN_AUDATA2, AUDATA2_MARK),
1447 PINMUX_GPIO(GPIO_FN_AUDATA1, AUDATA1_MARK),
1448 PINMUX_GPIO(GPIO_FN_AUDATA0, AUDATA0_MARK),
1449 PINMUX_GPIO(GPIO_FN_PWX7, PWX7_MARK),
1450 PINMUX_GPIO(GPIO_FN_PWX6, PWX6_MARK),
1451 PINMUX_GPIO(GPIO_FN_PWX5, PWX5_MARK),
1452 PINMUX_GPIO(GPIO_FN_PWX4, PWX4_MARK),
1453
1454 /* PTU (mobule: LBSC, DMAC) */
1455 PINMUX_GPIO(GPIO_FN_CS6, CS6_MARK),
1456 PINMUX_GPIO(GPIO_FN_CS5, CS5_MARK),
1457 PINMUX_GPIO(GPIO_FN_CS4, CS4_MARK),
1458 PINMUX_GPIO(GPIO_FN_CS0, CS0_MARK),
1459 PINMUX_GPIO(GPIO_FN_RD, RD_MARK),
1460 PINMUX_GPIO(GPIO_FN_WE0, WE0_MARK),
1461 PINMUX_GPIO(GPIO_FN_A25, A25_MARK),
1462 PINMUX_GPIO(GPIO_FN_A24, A24_MARK),
1463 PINMUX_GPIO(GPIO_FN_DREQ0, DREQ0_MARK),
1464 PINMUX_GPIO(GPIO_FN_DACK0, DACK0_MARK),
1465
1466 /* PTV (mobule: LBSC, DMAC) */
1467 PINMUX_GPIO(GPIO_FN_A23, A23_MARK),
1468 PINMUX_GPIO(GPIO_FN_A22, A22_MARK),
1469 PINMUX_GPIO(GPIO_FN_A21, A21_MARK),
1470 PINMUX_GPIO(GPIO_FN_A20, A20_MARK),
1471 PINMUX_GPIO(GPIO_FN_A19, A19_MARK),
1472 PINMUX_GPIO(GPIO_FN_A18, A18_MARK),
1473 PINMUX_GPIO(GPIO_FN_A17, A17_MARK),
1474 PINMUX_GPIO(GPIO_FN_A16, A16_MARK),
1475 PINMUX_GPIO(GPIO_FN_TEND0, TEND0_MARK),
1476 PINMUX_GPIO(GPIO_FN_DREQ1, DREQ1_MARK),
1477 PINMUX_GPIO(GPIO_FN_DACK1, DACK1_MARK),
1478 PINMUX_GPIO(GPIO_FN_TEND1, TEND1_MARK),
1479
1480 /* PTW (mobule: LBSC) */
1481 PINMUX_GPIO(GPIO_FN_A16, A16_MARK),
1482 PINMUX_GPIO(GPIO_FN_A15, A15_MARK),
1483 PINMUX_GPIO(GPIO_FN_A14, A14_MARK),
1484 PINMUX_GPIO(GPIO_FN_A13, A13_MARK),
1485 PINMUX_GPIO(GPIO_FN_A12, A12_MARK),
1486 PINMUX_GPIO(GPIO_FN_A11, A11_MARK),
1487 PINMUX_GPIO(GPIO_FN_A10, A10_MARK),
1488 PINMUX_GPIO(GPIO_FN_A9, A9_MARK),
1489 PINMUX_GPIO(GPIO_FN_A8, A8_MARK),
1490
1491 /* PTX (mobule: LBSC) */
1492 PINMUX_GPIO(GPIO_FN_A7, A7_MARK),
1493 PINMUX_GPIO(GPIO_FN_A6, A6_MARK),
1494 PINMUX_GPIO(GPIO_FN_A5, A5_MARK),
1495 PINMUX_GPIO(GPIO_FN_A4, A4_MARK),
1496 PINMUX_GPIO(GPIO_FN_A3, A3_MARK),
1497 PINMUX_GPIO(GPIO_FN_A2, A2_MARK),
1498 PINMUX_GPIO(GPIO_FN_A1, A1_MARK),
1499 PINMUX_GPIO(GPIO_FN_A0, A0_MARK),
1500
1501 /* PTY (mobule: LBSC) */
1502 PINMUX_GPIO(GPIO_FN_D7, D7_MARK),
1503 PINMUX_GPIO(GPIO_FN_D6, D6_MARK),
1504 PINMUX_GPIO(GPIO_FN_D5, D5_MARK),
1505 PINMUX_GPIO(GPIO_FN_D4, D4_MARK),
1506 PINMUX_GPIO(GPIO_FN_D3, D3_MARK),
1507 PINMUX_GPIO(GPIO_FN_D2, D2_MARK),
1508 PINMUX_GPIO(GPIO_FN_D1, D1_MARK),
1509 PINMUX_GPIO(GPIO_FN_D0, D0_MARK),
1510 };
1511
1512static struct pinmux_cfg_reg pinmux_config_regs[] = {
1513 { PINMUX_CFG_REG("PACR", 0xffec0000, 16, 2) {
1514 PTA7_FN, PTA7_OUT, PTA7_IN, 0,
1515 PTA6_FN, PTA6_OUT, PTA6_IN, 0,
1516 PTA5_FN, PTA5_OUT, PTA5_IN, 0,
1517 PTA4_FN, PTA4_OUT, PTA4_IN, 0,
1518 PTA3_FN, PTA3_OUT, PTA3_IN, 0,
1519 PTA2_FN, PTA2_OUT, PTA2_IN, 0,
1520 PTA1_FN, PTA1_OUT, PTA1_IN, 0,
1521 PTA0_FN, PTA0_OUT, PTA0_IN, 0 }
1522 },
1523 { PINMUX_CFG_REG("PBCR", 0xffec0002, 16, 2) {
1524 PTB7_FN, PTB7_OUT, PTB7_IN, 0,
1525 PTB6_FN, PTB6_OUT, PTB6_IN, 0,
1526 PTB5_FN, PTB5_OUT, PTB5_IN, 0,
1527 PTB4_FN, PTB4_OUT, PTB4_IN, 0,
1528 PTB3_FN, PTB3_OUT, PTB3_IN, 0,
1529 PTB2_FN, PTB2_OUT, PTB2_IN, 0,
1530 PTB1_FN, PTB1_OUT, PTB1_IN, 0,
1531 PTB0_FN, PTB0_OUT, PTB0_IN, 0 }
1532 },
1533 { PINMUX_CFG_REG("PCCR", 0xffec0004, 16, 2) {
1534 PTC7_FN, PTC7_OUT, PTC7_IN, 0,
1535 PTC6_FN, PTC6_OUT, PTC6_IN, 0,
1536 PTC5_FN, PTC5_OUT, PTC5_IN, 0,
1537 PTC4_FN, PTC4_OUT, PTC4_IN, 0,
1538 PTC3_FN, PTC3_OUT, PTC3_IN, 0,
1539 PTC2_FN, PTC2_OUT, PTC2_IN, 0,
1540 PTC1_FN, PTC1_OUT, PTC1_IN, 0,
1541 PTC0_FN, PTC0_OUT, PTC0_IN, 0 }
1542 },
1543 { PINMUX_CFG_REG("PDCR", 0xffec0006, 16, 2) {
1544 PTD7_FN, PTD7_OUT, PTD7_IN, 0,
1545 PTD6_FN, PTD6_OUT, PTD6_IN, 0,
1546 PTD5_FN, PTD5_OUT, PTD5_IN, 0,
1547 PTD4_FN, PTD4_OUT, PTD4_IN, 0,
1548 PTD3_FN, PTD3_OUT, PTD3_IN, 0,
1549 PTD2_FN, PTD2_OUT, PTD2_IN, 0,
1550 PTD1_FN, PTD1_OUT, PTD1_IN, 0,
1551 PTD0_FN, PTD0_OUT, PTD0_IN, 0 }
1552 },
1553 { PINMUX_CFG_REG("PECR", 0xffec0008, 16, 2) {
1554 PTE7_FN, PTE7_OUT, PTE7_IN, 0,
1555 PTE6_FN, PTE6_OUT, PTE6_IN, 0,
1556 PTE5_FN, PTE5_OUT, PTE5_IN, 0,
1557 PTE4_FN, PTE4_OUT, PTE4_IN, 0,
1558 PTE3_FN, PTE3_OUT, PTE3_IN, 0,
1559 PTE2_FN, PTE2_OUT, PTE2_IN, 0,
1560 PTE1_FN, PTE1_OUT, PTE1_IN, 0,
1561 PTE0_FN, PTE0_OUT, PTE0_IN, 0 }
1562 },
1563 { PINMUX_CFG_REG("PFCR", 0xffec000a, 16, 2) {
1564 PTF7_FN, PTF7_OUT, PTF7_IN, 0,
1565 PTF6_FN, PTF6_OUT, PTF6_IN, 0,
1566 PTF5_FN, PTF5_OUT, PTF5_IN, 0,
1567 PTF4_FN, PTF4_OUT, PTF4_IN, 0,
1568 PTF3_FN, PTF3_OUT, PTF3_IN, 0,
1569 PTF2_FN, PTF2_OUT, PTF2_IN, 0,
1570 PTF1_FN, PTF1_OUT, PTF1_IN, 0,
1571 PTF0_FN, PTF0_OUT, PTF0_IN, 0 }
1572 },
1573 { PINMUX_CFG_REG("PGCR", 0xffec000c, 16, 2) {
1574 PTG7_FN, PTG7_OUT, PTG7_IN, 0,
1575 PTG6_FN, PTG6_OUT, PTG6_IN, 0,
1576 PTG5_FN, PTG5_OUT, PTG5_IN, 0,
1577 PTG4_FN, PTG4_OUT, PTG4_IN, 0,
1578 PTG3_FN, PTG3_OUT, PTG3_IN, 0,
1579 PTG2_FN, PTG2_OUT, PTG2_IN, 0,
1580 PTG1_FN, PTG1_OUT, PTG1_IN, 0,
1581 PTG0_FN, PTG0_OUT, PTG0_IN, 0 }
1582 },
1583 { PINMUX_CFG_REG("PHCR", 0xffec000e, 16, 2) {
1584 PTH7_FN, PTH7_OUT, PTH7_IN, 0,
1585 PTH6_FN, PTH6_OUT, PTH6_IN, 0,
1586 PTH5_FN, PTH5_OUT, PTH5_IN, 0,
1587 PTH4_FN, PTH4_OUT, PTH4_IN, 0,
1588 PTH3_FN, PTH3_OUT, PTH3_IN, 0,
1589 PTH2_FN, PTH2_OUT, PTH2_IN, 0,
1590 PTH1_FN, PTH1_OUT, PTH1_IN, 0,
1591 PTH0_FN, PTH0_OUT, PTH0_IN, 0 }
1592 },
1593 { PINMUX_CFG_REG("PICR", 0xffec0010, 16, 2) {
1594 PTI7_FN, PTI7_OUT, PTI7_IN, 0,
1595 PTI6_FN, PTI6_OUT, PTI6_IN, 0,
1596 PTI5_FN, PTI5_OUT, PTI5_IN, 0,
1597 PTI4_FN, PTI4_OUT, PTI4_IN, 0,
1598 PTI3_FN, PTI3_OUT, PTI3_IN, 0,
1599 PTI2_FN, PTI2_OUT, PTI2_IN, 0,
1600 PTI1_FN, PTI1_OUT, PTI1_IN, 0,
1601 PTI0_FN, PTI0_OUT, PTI0_IN, 0 }
1602 },
1603 { PINMUX_CFG_REG("PJCR", 0xffec0012, 16, 2) {
1604 PTJ7_FN, PTJ7_OUT, PTJ7_IN, 0,
1605 PTJ6_FN, PTJ6_OUT, PTJ6_IN, 0,
1606 PTJ5_FN, PTJ5_OUT, PTJ5_IN, 0,
1607 PTJ4_FN, PTJ4_OUT, PTJ4_IN, 0,
1608 PTJ3_FN, PTJ3_OUT, PTJ3_IN, 0,
1609 PTJ2_FN, PTJ2_OUT, PTJ2_IN, 0,
1610 PTJ1_FN, PTJ1_OUT, PTJ1_IN, 0,
1611 PTJ0_FN, PTJ0_OUT, PTJ0_IN, 0 }
1612 },
1613 { PINMUX_CFG_REG("PKCR", 0xffec0014, 16, 2) {
1614 PTK7_FN, PTK7_OUT, PTK7_IN, 0,
1615 PTK6_FN, PTK6_OUT, PTK6_IN, 0,
1616 PTK5_FN, PTK5_OUT, PTK5_IN, 0,
1617 PTK4_FN, PTK4_OUT, PTK4_IN, 0,
1618 PTK3_FN, PTK3_OUT, PTK3_IN, 0,
1619 PTK2_FN, PTK2_OUT, PTK2_IN, 0,
1620 PTK1_FN, PTK1_OUT, PTK1_IN, 0,
1621 PTK0_FN, PTK0_OUT, PTK0_IN, 0 }
1622 },
1623 { PINMUX_CFG_REG("PLCR", 0xffec0016, 16, 2) {
1624 PTL7_FN, PTL7_OUT, PTL7_IN, 0,
1625 PTL6_FN, PTL6_OUT, PTL6_IN, 0,
1626 PTL5_FN, PTL5_OUT, PTL5_IN, 0,
1627 PTL4_FN, PTL4_OUT, PTL4_IN, 0,
1628 PTL3_FN, PTL3_OUT, PTL3_IN, 0,
1629 PTL2_FN, PTL2_OUT, PTL2_IN, 0,
1630 PTL1_FN, PTL1_OUT, PTL1_IN, 0,
1631 PTL0_FN, PTL0_OUT, PTL0_IN, 0 }
1632 },
1633 { PINMUX_CFG_REG("PMCR", 0xffec0018, 16, 2) {
1634 0, 0, 0, 0, /* reserved: always set 1 */
1635 PTM6_FN, PTM6_OUT, PTM6_IN, 0,
1636 PTM5_FN, PTM5_OUT, PTM5_IN, 0,
1637 PTM4_FN, PTM4_OUT, PTM4_IN, 0,
1638 PTM3_FN, PTM3_OUT, PTM3_IN, 0,
1639 PTM2_FN, PTM2_OUT, PTM2_IN, 0,
1640 PTM1_FN, PTM1_OUT, PTM1_IN, 0,
1641 PTM0_FN, PTM0_OUT, PTM0_IN, 0 }
1642 },
1643 { PINMUX_CFG_REG("PNCR", 0xffec001a, 16, 2) {
1644 PTN7_FN, PTN7_OUT, PTN7_IN, 0,
1645 PTN6_FN, PTN6_OUT, PTN6_IN, 0,
1646 PTN5_FN, PTN5_OUT, PTN5_IN, 0,
1647 PTN4_FN, PTN4_OUT, PTN4_IN, 0,
1648 PTN3_FN, PTN3_OUT, PTN3_IN, 0,
1649 PTN2_FN, PTN2_OUT, PTN2_IN, 0,
1650 PTN1_FN, PTN1_OUT, PTN1_IN, 0,
1651 PTN0_FN, PTN0_OUT, PTN0_IN, 0 }
1652 },
1653 { PINMUX_CFG_REG("POCR", 0xffec001c, 16, 2) {
1654 PTO7_FN, PTO7_OUT, PTO7_IN, 0,
1655 PTO6_FN, PTO6_OUT, PTO6_IN, 0,
1656 PTO5_FN, PTO5_OUT, PTO5_IN, 0,
1657 PTO4_FN, PTO4_OUT, PTO4_IN, 0,
1658 PTO3_FN, PTO3_OUT, PTO3_IN, 0,
1659 PTO2_FN, PTO2_OUT, PTO2_IN, 0,
1660 PTO1_FN, PTO1_OUT, PTO1_IN, 0,
1661 PTO0_FN, PTO0_OUT, PTO0_IN, 0 }
1662 },
1663 { PINMUX_CFG_REG("PPCR", 0xffec001e, 16, 2) {
1664 0, 0, 0, 0, /* reserved: always set 1 */
1665 PTP6_FN, PTP6_OUT, PTP6_IN, 0,
1666 PTP5_FN, PTP5_OUT, PTP5_IN, 0,
1667 PTP4_FN, PTP4_OUT, PTP4_IN, 0,
1668 PTP3_FN, PTP3_OUT, PTP3_IN, 0,
1669 PTP2_FN, PTP2_OUT, PTP2_IN, 0,
1670 PTP1_FN, PTP1_OUT, PTP1_IN, 0,
1671 PTP0_FN, PTP0_OUT, PTP0_IN, 0 }
1672 },
1673 { PINMUX_CFG_REG("PQCR", 0xffec0020, 16, 2) {
1674 0, 0, 0, 0, /* reserved: always set 1 */
1675 PTQ6_FN, PTQ6_OUT, PTQ6_IN, 0,
1676 PTQ5_FN, PTQ5_OUT, PTQ5_IN, 0,
1677 PTQ4_FN, PTQ4_OUT, PTQ4_IN, 0,
1678 PTQ3_FN, PTQ3_OUT, PTQ3_IN, 0,
1679 PTQ2_FN, PTQ2_OUT, PTQ2_IN, 0,
1680 PTQ1_FN, PTQ1_OUT, PTQ1_IN, 0,
1681 PTQ0_FN, PTQ0_OUT, PTQ0_IN, 0 }
1682 },
1683 { PINMUX_CFG_REG("PRCR", 0xffec0022, 16, 2) {
1684 PTR7_FN, PTR7_OUT, PTR7_IN, 0,
1685 PTR6_FN, PTR6_OUT, PTR6_IN, 0,
1686 PTR5_FN, PTR5_OUT, PTR5_IN, 0,
1687 PTR4_FN, PTR4_OUT, PTR4_IN, 0,
1688 PTR3_FN, PTR3_OUT, PTR3_IN, 0,
1689 PTR2_FN, PTR2_OUT, PTR2_IN, 0,
1690 PTR1_FN, PTR1_OUT, PTR1_IN, 0,
1691 PTR0_FN, PTR0_OUT, PTR0_IN, 0 }
1692 },
1693 { PINMUX_CFG_REG("PSCR", 0xffec0024, 16, 2) {
1694 PTS7_FN, PTS7_OUT, PTS7_IN, 0,
1695 PTS6_FN, PTS6_OUT, PTS6_IN, 0,
1696 PTS5_FN, PTS5_OUT, PTS5_IN, 0,
1697 PTS4_FN, PTS4_OUT, PTS4_IN, 0,
1698 PTS3_FN, PTS3_OUT, PTS3_IN, 0,
1699 PTS2_FN, PTS2_OUT, PTS2_IN, 0,
1700 PTS1_FN, PTS1_OUT, PTS1_IN, 0,
1701 PTS0_FN, PTS0_OUT, PTS0_IN, 0 }
1702 },
1703 { PINMUX_CFG_REG("PTCR", 0xffec0026, 16, 2) {
1704 0, 0, 0, 0, /* reserved: always set 1 */
1705 0, 0, 0, 0, /* reserved: always set 1 */
1706 PTT5_FN, PTT5_OUT, PTT5_IN, 0,
1707 PTT4_FN, PTT4_OUT, PTT4_IN, 0,
1708 PTT3_FN, PTT3_OUT, PTT3_IN, 0,
1709 PTT2_FN, PTT2_OUT, PTT2_IN, 0,
1710 PTT1_FN, PTT1_OUT, PTT1_IN, 0,
1711 PTT0_FN, PTT0_OUT, PTT0_IN, 0 }
1712 },
1713 { PINMUX_CFG_REG("PUCR", 0xffec0028, 16, 2) {
1714 PTU7_FN, PTU7_OUT, PTU7_IN, PTU7_IN_PU,
1715 PTU6_FN, PTU6_OUT, PTU6_IN, PTU6_IN_PU,
1716 PTU5_FN, PTU5_OUT, PTU5_IN, PTU5_IN_PU,
1717 PTU4_FN, PTU4_OUT, PTU4_IN, PTU4_IN_PU,
1718 PTU3_FN, PTU3_OUT, PTU3_IN, PTU3_IN_PU,
1719 PTU2_FN, PTU2_OUT, PTU2_IN, PTU2_IN_PU,
1720 PTU1_FN, PTU1_OUT, PTU1_IN, PTU1_IN_PU,
1721 PTU0_FN, PTU0_OUT, PTU0_IN, PTU0_IN_PU }
1722 },
1723 { PINMUX_CFG_REG("PVCR", 0xffec002a, 16, 2) {
1724 PTV7_FN, PTV7_OUT, PTV7_IN, PTV7_IN_PU,
1725 PTV6_FN, PTV6_OUT, PTV6_IN, PTV6_IN_PU,
1726 PTV5_FN, PTV5_OUT, PTV5_IN, PTV5_IN_PU,
1727 PTV4_FN, PTV4_OUT, PTV4_IN, PTV4_IN_PU,
1728 PTV3_FN, PTV3_OUT, PTV3_IN, PTV3_IN_PU,
1729 PTV2_FN, PTV2_OUT, PTV2_IN, PTV2_IN_PU,
1730 PTV1_FN, PTV1_OUT, PTV1_IN, PTV1_IN_PU,
1731 PTV0_FN, PTV0_OUT, PTV0_IN, PTV0_IN_PU }
1732 },
1733 { PINMUX_CFG_REG("PWCR", 0xffec002c, 16, 2) {
1734 PTW7_FN, PTW7_OUT, PTW7_IN, PTW7_IN_PU,
1735 PTW6_FN, PTW6_OUT, PTW6_IN, PTW6_IN_PU,
1736 PTW5_FN, PTW5_OUT, PTW5_IN, PTW5_IN_PU,
1737 PTW4_FN, PTW4_OUT, PTW4_IN, PTW4_IN_PU,
1738 PTW3_FN, PTW3_OUT, PTW3_IN, PTW3_IN_PU,
1739 PTW2_FN, PTW2_OUT, PTW2_IN, PTW2_IN_PU,
1740 PTW1_FN, PTW1_OUT, PTW1_IN, PTW1_IN_PU,
1741 PTW0_FN, PTW0_OUT, PTW0_IN, PTW0_IN_PU }
1742 },
1743 { PINMUX_CFG_REG("PXCR", 0xffec002e, 16, 2) {
1744 PTX7_FN, PTX7_OUT, PTX7_IN, PTX7_IN_PU,
1745 PTX6_FN, PTX6_OUT, PTX6_IN, PTX6_IN_PU,
1746 PTX5_FN, PTX5_OUT, PTX5_IN, PTX5_IN_PU,
1747 PTX4_FN, PTX4_OUT, PTX4_IN, PTX4_IN_PU,
1748 PTX3_FN, PTX3_OUT, PTX3_IN, PTX3_IN_PU,
1749 PTX2_FN, PTX2_OUT, PTX2_IN, PTX2_IN_PU,
1750 PTX1_FN, PTX1_OUT, PTX1_IN, PTX1_IN_PU,
1751 PTX0_FN, PTX0_OUT, PTX0_IN, PTX0_IN_PU }
1752 },
1753 { PINMUX_CFG_REG("PYCR", 0xffec0030, 16, 2) {
1754 PTY7_FN, PTY7_OUT, PTY7_IN, PTY7_IN_PU,
1755 PTY6_FN, PTY6_OUT, PTY6_IN, PTY6_IN_PU,
1756 PTY5_FN, PTY5_OUT, PTY5_IN, PTY5_IN_PU,
1757 PTY4_FN, PTY4_OUT, PTY4_IN, PTY4_IN_PU,
1758 PTY3_FN, PTY3_OUT, PTY3_IN, PTY3_IN_PU,
1759 PTY2_FN, PTY2_OUT, PTY2_IN, PTY2_IN_PU,
1760 PTY1_FN, PTY1_OUT, PTY1_IN, PTY1_IN_PU,
1761 PTY0_FN, PTY0_OUT, PTY0_IN, PTY0_IN_PU }
1762 },
1763 { PINMUX_CFG_REG("PZCR", 0xffec0032, 16, 2) {
1764 0, PTZ7_OUT, PTZ7_IN, 0,
1765 0, PTZ6_OUT, PTZ6_IN, 0,
1766 0, PTZ5_OUT, PTZ5_IN, 0,
1767 0, PTZ4_OUT, PTZ4_IN, 0,
1768 0, PTZ3_OUT, PTZ3_IN, 0,
1769 0, PTZ2_OUT, PTZ2_IN, 0,
1770 0, PTZ1_OUT, PTZ1_IN, 0,
1771 0, PTZ0_OUT, PTZ0_IN, 0 }
1772 },
1773
1774 { PINMUX_CFG_REG("PSEL0", 0xffec0070, 16, 1) {
1775 PS0_15_FN3, PS0_15_FN1,
1776 PS0_14_FN3, PS0_14_FN1,
1777 PS0_13_FN3, PS0_13_FN1,
1778 PS0_12_FN3, PS0_12_FN1,
1779 0, 0,
1780 0, 0,
1781 0, 0,
1782 0, 0,
1783 PS0_7_FN2, PS0_7_FN1,
1784 PS0_6_FN2, PS0_6_FN1,
1785 PS0_5_FN2, PS0_5_FN1,
1786 PS0_4_FN2, PS0_4_FN1,
1787 PS0_3_FN2, PS0_3_FN1,
1788 PS0_2_FN2, PS0_2_FN1,
1789 PS0_1_FN2, PS0_1_FN1,
1790 0, 0, }
1791 },
1792 { PINMUX_CFG_REG("PSEL1", 0xffec0072, 16, 1) {
1793 0, 0,
1794 0, 0,
1795 0, 0,
1796 0, 0,
1797 0, 0,
1798 0, 0,
1799 0, 0,
1800 0, 0,
1801 PS1_7_FN1, PS1_7_FN3,
1802 PS1_6_FN1, PS1_6_FN3,
1803 0, 0,
1804 0, 0,
1805 0, 0,
1806 0, 0,
1807 0, 0,
1808 0, 0, }
1809 },
1810 { PINMUX_CFG_REG("PSEL2", 0xffec0074, 16, 1) {
1811 0, 0,
1812 0, 0,
1813 PS2_13_FN3, PS2_13_FN1,
1814 PS2_12_FN3, PS2_12_FN1,
1815 0, 0,
1816 0, 0,
1817 0, 0,
1818 0, 0,
1819 0, 0,
1820 0, 0,
1821 0, 0,
1822 0, 0,
1823 0, 0,
1824 0, 0,
1825 PS2_1_FN1, PS2_1_FN2,
1826 PS2_0_FN1, PS2_0_FN2, }
1827 },
1828 { PINMUX_CFG_REG("PSEL4", 0xffec0078, 16, 1) {
1829 PS4_15_FN2, PS4_15_FN1,
1830 PS4_14_FN2, PS4_14_FN1,
1831 PS4_13_FN2, PS4_13_FN1,
1832 PS4_12_FN2, PS4_12_FN1,
1833 PS4_11_FN2, PS4_11_FN1,
1834 PS4_10_FN2, PS4_10_FN1,
1835 PS4_9_FN2, PS4_9_FN1,
1836 0, 0,
1837 0, 0,
1838 0, 0,
1839 0, 0,
1840 0, 0,
1841 PS4_3_FN2, PS4_3_FN1,
1842 PS4_2_FN2, PS4_2_FN1,
1843 PS4_1_FN2, PS4_1_FN1,
1844 PS4_0_FN2, PS4_0_FN1, }
1845 },
1846 { PINMUX_CFG_REG("PSEL5", 0xffec007a, 16, 1) {
1847 0, 0,
1848 0, 0,
1849 0, 0,
1850 0, 0,
1851 0, 0,
1852 0, 0,
1853 PS5_9_FN1, PS5_9_FN2,
1854 PS5_8_FN1, PS5_8_FN2,
1855 PS5_7_FN1, PS5_7_FN2,
1856 PS5_6_FN1, PS5_6_FN2,
1857 PS5_5_FN1, PS5_5_FN2,
1858 0, 0,
1859 0, 0,
1860 0, 0,
1861 0, 0,
1862 0, 0, }
1863 },
1864 { PINMUX_CFG_REG("PSEL6", 0xffec007c, 16, 1) {
1865 0, 0,
1866 0, 0,
1867 0, 0,
1868 0, 0,
1869 0, 0,
1870 0, 0,
1871 0, 0,
1872 0, 0,
1873 PS6_7_FN_AN, PS6_7_FN_EV,
1874 PS6_6_FN_AN, PS6_6_FN_EV,
1875 PS6_5_FN_AN, PS6_5_FN_EV,
1876 PS6_4_FN_AN, PS6_4_FN_EV,
1877 PS6_3_FN_AN, PS6_3_FN_EV,
1878 PS6_2_FN_AN, PS6_2_FN_EV,
1879 PS6_1_FN_AN, PS6_1_FN_EV,
1880 PS6_0_FN_AN, PS6_0_FN_EV, }
1881 },
1882 {}
1883};
1884
1885static struct pinmux_data_reg pinmux_data_regs[] = {
1886 { PINMUX_DATA_REG("PADR", 0xffec0034, 8) {
1887 PTA7_DATA, PTA6_DATA, PTA5_DATA, PTA4_DATA,
1888 PTA3_DATA, PTA2_DATA, PTA1_DATA, PTA0_DATA }
1889 },
1890 { PINMUX_DATA_REG("PBDR", 0xffec0036, 8) {
1891 PTB7_DATA, PTB6_DATA, PTB5_DATA, PTB4_DATA,
1892 PTB3_DATA, PTB2_DATA, PTB1_DATA, PTB0_DATA }
1893 },
1894 { PINMUX_DATA_REG("PCDR", 0xffec0038, 8) {
1895 PTC7_DATA, PTC6_DATA, PTC5_DATA, PTC4_DATA,
1896 PTC3_DATA, PTC2_DATA, PTC1_DATA, PTC0_DATA }
1897 },
1898 { PINMUX_DATA_REG("PDDR", 0xffec003a, 8) {
1899 PTD7_DATA, PTD6_DATA, PTD5_DATA, PTD4_DATA,
1900 PTD3_DATA, PTD2_DATA, PTD1_DATA, PTD0_DATA }
1901 },
1902 { PINMUX_DATA_REG("PEDR", 0xffec003c, 8) {
1903 PTE7_DATA, PTE6_DATA, PTE5_DATA, PTE4_DATA,
1904 PTE3_DATA, PTE2_DATA, PTE1_DATA, PTE0_DATA }
1905 },
1906 { PINMUX_DATA_REG("PFDR", 0xffec003e, 8) {
1907 PTF7_DATA, PTF6_DATA, PTF5_DATA, PTF4_DATA,
1908 PTF3_DATA, PTF2_DATA, PTF1_DATA, PTF0_DATA }
1909 },
1910 { PINMUX_DATA_REG("PGDR", 0xffec0040, 8) {
1911 PTG7_DATA, PTG6_DATA, PTG5_DATA, PTG4_DATA,
1912 PTG3_DATA, PTG2_DATA, PTG1_DATA, PTG0_DATA }
1913 },
1914 { PINMUX_DATA_REG("PHDR", 0xffec0042, 8) {
1915 PTH7_DATA, PTH6_DATA, PTH5_DATA, PTH4_DATA,
1916 PTH3_DATA, PTH2_DATA, PTH1_DATA, PTH0_DATA }
1917 },
1918 { PINMUX_DATA_REG("PIDR", 0xffec0044, 8) {
1919 PTI7_DATA, PTI6_DATA, PTI5_DATA, PTI4_DATA,
1920 PTI3_DATA, PTI2_DATA, PTI1_DATA, PTI0_DATA }
1921 },
1922 { PINMUX_DATA_REG("PJDR", 0xffec0046, 8) {
1923 PTJ7_DATA, PTJ6_DATA, PTJ5_DATA, PTJ4_DATA,
1924 PTJ3_DATA, PTJ2_DATA, PTJ1_DATA, PTJ0_DATA }
1925 },
1926 { PINMUX_DATA_REG("PKDR", 0xffec0048, 8) {
1927 PTK7_DATA, PTK6_DATA, PTK5_DATA, PTK4_DATA,
1928 PTK3_DATA, PTK2_DATA, PTK1_DATA, PTK0_DATA }
1929 },
1930 { PINMUX_DATA_REG("PLDR", 0xffec004a, 8) {
1931 PTL7_DATA, PTL6_DATA, PTL5_DATA, PTL4_DATA,
1932 PTL3_DATA, PTL2_DATA, PTL1_DATA, PTL0_DATA }
1933 },
1934 { PINMUX_DATA_REG("PMDR", 0xffec004c, 8) {
1935 0, PTM6_DATA, PTM5_DATA, PTM4_DATA,
1936 PTM3_DATA, PTM2_DATA, PTM1_DATA, PTM0_DATA }
1937 },
1938 { PINMUX_DATA_REG("PNDR", 0xffec004e, 8) {
1939 PTN7_DATA, PTN6_DATA, PTN5_DATA, PTN4_DATA,
1940 PTN3_DATA, PTN2_DATA, PTN1_DATA, PTN0_DATA }
1941 },
1942 { PINMUX_DATA_REG("PODR", 0xffec0050, 8) {
1943 PTO7_DATA, PTO6_DATA, PTO5_DATA, PTO4_DATA,
1944 PTO3_DATA, PTO2_DATA, PTO1_DATA, PTO0_DATA }
1945 },
1946 { PINMUX_DATA_REG("PPDR", 0xffec0052, 8) {
1947 0, PTP6_DATA, PTP5_DATA, PTP4_DATA,
1948 PTP3_DATA, PTP2_DATA, PTP1_DATA, PTP0_DATA }
1949 },
1950 { PINMUX_DATA_REG("PQDR", 0xffec0054, 8) {
1951 0, PTQ6_DATA, PTQ5_DATA, PTQ4_DATA,
1952 PTQ3_DATA, PTQ2_DATA, PTQ1_DATA, PTQ0_DATA }
1953 },
1954 { PINMUX_DATA_REG("PRDR", 0xffec0056, 8) {
1955 PTR7_DATA, PTR6_DATA, PTR5_DATA, PTR4_DATA,
1956 PTR3_DATA, PTR2_DATA, PTR1_DATA, PTR0_DATA }
1957 },
1958 { PINMUX_DATA_REG("PSDR", 0xffec0058, 8) {
1959 PTS7_DATA, PTS6_DATA, PTS5_DATA, PTS4_DATA,
1960 PTS3_DATA, PTS2_DATA, PTS1_DATA, PTS0_DATA }
1961 },
1962 { PINMUX_DATA_REG("PTDR", 0xffec005a, 8) {
1963 0, 0, PTT5_DATA, PTT4_DATA,
1964 PTT3_DATA, PTT2_DATA, PTT1_DATA, PTT0_DATA }
1965 },
1966 { PINMUX_DATA_REG("PUDR", 0xffec005c, 8) {
1967 PTU7_DATA, PTU6_DATA, PTU5_DATA, PTU4_DATA,
1968 PTU3_DATA, PTU2_DATA, PTU1_DATA, PTU0_DATA }
1969 },
1970 { PINMUX_DATA_REG("PVDR", 0xffec005e, 8) {
1971 PTV7_DATA, PTV6_DATA, PTV5_DATA, PTV4_DATA,
1972 PTV3_DATA, PTV2_DATA, PTV1_DATA, PTV0_DATA }
1973 },
1974 { PINMUX_DATA_REG("PWDR", 0xffec0060, 8) {
1975 PTW7_DATA, PTW6_DATA, PTW5_DATA, PTW4_DATA,
1976 PTW3_DATA, PTW2_DATA, PTW1_DATA, PTW0_DATA }
1977 },
1978 { PINMUX_DATA_REG("PXDR", 0xffec0062, 8) {
1979 PTX7_DATA, PTX6_DATA, PTX5_DATA, PTX4_DATA,
1980 PTX3_DATA, PTX2_DATA, PTX1_DATA, PTX0_DATA }
1981 },
1982 { PINMUX_DATA_REG("PYDR", 0xffec0064, 8) {
1983 PTY7_DATA, PTY6_DATA, PTY5_DATA, PTY4_DATA,
1984 PTY3_DATA, PTY2_DATA, PTY1_DATA, PTY0_DATA }
1985 },
1986 { PINMUX_DATA_REG("PZDR", 0xffec0066, 8) {
1987 PTZ7_DATA, PTZ6_DATA, PTZ5_DATA, PTZ4_DATA,
1988 PTZ3_DATA, PTZ2_DATA, PTZ1_DATA, PTZ0_DATA }
1989 },
1990 { },
1991};
1992
1993static struct pinmux_info sh7757_pinmux_info = {
1994 .name = "sh7757_pfc",
1995 .reserved_id = PINMUX_RESERVED,
1996 .data = { PINMUX_DATA_BEGIN, PINMUX_DATA_END },
1997 .input = { PINMUX_INPUT_BEGIN, PINMUX_INPUT_END },
1998 .input_pu = { PINMUX_INPUT_PULLUP_BEGIN, PINMUX_INPUT_PULLUP_END },
1999 .output = { PINMUX_OUTPUT_BEGIN, PINMUX_OUTPUT_END },
2000 .mark = { PINMUX_MARK_BEGIN, PINMUX_MARK_END },
2001 .function = { PINMUX_FUNCTION_BEGIN, PINMUX_FUNCTION_END },
2002
2003 .first_gpio = GPIO_PTA7,
2004 .last_gpio = GPIO_FN_D0,
2005
2006 .gpios = pinmux_gpios,
2007 .cfg_regs = pinmux_config_regs,
2008 .data_regs = pinmux_data_regs,
2009
2010 .gpio_data = pinmux_data,
2011 .gpio_data_size = ARRAY_SIZE(pinmux_data),
2012};
2013
2014static int __init plat_pinmux_setup(void)
2015{
2016 return register_pinmux(&sh7757_pinmux_info);
2017}
2018
2019arch_initcall(plat_pinmux_setup);
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
index 1a956b1becc..4a9010bf4fd 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c
@@ -40,7 +40,7 @@ static struct platform_device iic_device = {
40}; 40};
41 41
42static struct r8a66597_platdata r8a66597_data = { 42static struct r8a66597_platdata r8a66597_data = {
43 /* This set zero to all members */ 43 .on_chip = 1,
44}; 44};
45 45
46static struct resource usb_host_resources[] = { 46static struct resource usb_host_resources[] = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
index cda76ebf87c..35097753456 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7722.c
@@ -13,9 +13,11 @@
13#include <linux/serial_sci.h> 13#include <linux/serial_sci.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/uio_driver.h> 15#include <linux/uio_driver.h>
16#include <linux/usb/m66592.h>
16#include <linux/sh_timer.h> 17#include <linux/sh_timer.h>
17#include <asm/clock.h> 18#include <asm/clock.h>
18#include <asm/mmzone.h> 19#include <asm/mmzone.h>
20#include <cpu/sh7722.h>
19 21
20static struct resource rtc_resources[] = { 22static struct resource rtc_resources[] = {
21 [0] = { 23 [0] = {
@@ -45,11 +47,18 @@ static struct platform_device rtc_device = {
45 .id = -1, 47 .id = -1,
46 .num_resources = ARRAY_SIZE(rtc_resources), 48 .num_resources = ARRAY_SIZE(rtc_resources),
47 .resource = rtc_resources, 49 .resource = rtc_resources,
50 .archdata = {
51 .hwblk_id = HWBLK_RTC,
52 },
53};
54
55static struct m66592_platdata usbf_platdata = {
56 .on_chip = 1,
48}; 57};
49 58
50static struct resource usbf_resources[] = { 59static struct resource usbf_resources[] = {
51 [0] = { 60 [0] = {
52 .name = "m66592_udc", 61 .name = "USBF",
53 .start = 0x04480000, 62 .start = 0x04480000,
54 .end = 0x044800FF, 63 .end = 0x044800FF,
55 .flags = IORESOURCE_MEM, 64 .flags = IORESOURCE_MEM,
@@ -67,9 +76,13 @@ static struct platform_device usbf_device = {
67 .dev = { 76 .dev = {
68 .dma_mask = NULL, 77 .dma_mask = NULL,
69 .coherent_dma_mask = 0xffffffff, 78 .coherent_dma_mask = 0xffffffff,
79 .platform_data = &usbf_platdata,
70 }, 80 },
71 .num_resources = ARRAY_SIZE(usbf_resources), 81 .num_resources = ARRAY_SIZE(usbf_resources),
72 .resource = usbf_resources, 82 .resource = usbf_resources,
83 .archdata = {
84 .hwblk_id = HWBLK_USBF,
85 },
73}; 86};
74 87
75static struct resource iic_resources[] = { 88static struct resource iic_resources[] = {
@@ -91,6 +104,9 @@ static struct platform_device iic_device = {
91 .id = 0, /* "i2c0" clock */ 104 .id = 0, /* "i2c0" clock */
92 .num_resources = ARRAY_SIZE(iic_resources), 105 .num_resources = ARRAY_SIZE(iic_resources),
93 .resource = iic_resources, 106 .resource = iic_resources,
107 .archdata = {
108 .hwblk_id = HWBLK_IIC,
109 },
94}; 110};
95 111
96static struct uio_info vpu_platform_data = { 112static struct uio_info vpu_platform_data = {
@@ -119,6 +135,9 @@ static struct platform_device vpu_device = {
119 }, 135 },
120 .resource = vpu_resources, 136 .resource = vpu_resources,
121 .num_resources = ARRAY_SIZE(vpu_resources), 137 .num_resources = ARRAY_SIZE(vpu_resources),
138 .archdata = {
139 .hwblk_id = HWBLK_VPU,
140 },
122}; 141};
123 142
124static struct uio_info veu_platform_data = { 143static struct uio_info veu_platform_data = {
@@ -147,6 +166,9 @@ static struct platform_device veu_device = {
147 }, 166 },
148 .resource = veu_resources, 167 .resource = veu_resources,
149 .num_resources = ARRAY_SIZE(veu_resources), 168 .num_resources = ARRAY_SIZE(veu_resources),
169 .archdata = {
170 .hwblk_id = HWBLK_VEU,
171 },
150}; 172};
151 173
152static struct uio_info jpu_platform_data = { 174static struct uio_info jpu_platform_data = {
@@ -175,6 +197,9 @@ static struct platform_device jpu_device = {
175 }, 197 },
176 .resource = jpu_resources, 198 .resource = jpu_resources,
177 .num_resources = ARRAY_SIZE(jpu_resources), 199 .num_resources = ARRAY_SIZE(jpu_resources),
200 .archdata = {
201 .hwblk_id = HWBLK_JPU,
202 },
178}; 203};
179 204
180static struct sh_timer_config cmt_platform_data = { 205static struct sh_timer_config cmt_platform_data = {
@@ -207,6 +232,9 @@ static struct platform_device cmt_device = {
207 }, 232 },
208 .resource = cmt_resources, 233 .resource = cmt_resources,
209 .num_resources = ARRAY_SIZE(cmt_resources), 234 .num_resources = ARRAY_SIZE(cmt_resources),
235 .archdata = {
236 .hwblk_id = HWBLK_CMT,
237 },
210}; 238};
211 239
212static struct sh_timer_config tmu0_platform_data = { 240static struct sh_timer_config tmu0_platform_data = {
@@ -238,6 +266,9 @@ static struct platform_device tmu0_device = {
238 }, 266 },
239 .resource = tmu0_resources, 267 .resource = tmu0_resources,
240 .num_resources = ARRAY_SIZE(tmu0_resources), 268 .num_resources = ARRAY_SIZE(tmu0_resources),
269 .archdata = {
270 .hwblk_id = HWBLK_TMU,
271 },
241}; 272};
242 273
243static struct sh_timer_config tmu1_platform_data = { 274static struct sh_timer_config tmu1_platform_data = {
@@ -269,6 +300,9 @@ static struct platform_device tmu1_device = {
269 }, 300 },
270 .resource = tmu1_resources, 301 .resource = tmu1_resources,
271 .num_resources = ARRAY_SIZE(tmu1_resources), 302 .num_resources = ARRAY_SIZE(tmu1_resources),
303 .archdata = {
304 .hwblk_id = HWBLK_TMU,
305 },
272}; 306};
273 307
274static struct sh_timer_config tmu2_platform_data = { 308static struct sh_timer_config tmu2_platform_data = {
@@ -299,6 +333,9 @@ static struct platform_device tmu2_device = {
299 }, 333 },
300 .resource = tmu2_resources, 334 .resource = tmu2_resources,
301 .num_resources = ARRAY_SIZE(tmu2_resources), 335 .num_resources = ARRAY_SIZE(tmu2_resources),
336 .archdata = {
337 .hwblk_id = HWBLK_TMU,
338 },
302}; 339};
303 340
304static struct plat_sci_port sci_platform_data[] = { 341static struct plat_sci_port sci_platform_data[] = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index b45dace9539..4caa5a7ca86 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <asm/clock.h> 19#include <asm/clock.h>
20#include <asm/mmzone.h> 20#include <asm/mmzone.h>
21#include <cpu/sh7723.h>
21 22
22static struct uio_info vpu_platform_data = { 23static struct uio_info vpu_platform_data = {
23 .name = "VPU5", 24 .name = "VPU5",
@@ -45,6 +46,9 @@ static struct platform_device vpu_device = {
45 }, 46 },
46 .resource = vpu_resources, 47 .resource = vpu_resources,
47 .num_resources = ARRAY_SIZE(vpu_resources), 48 .num_resources = ARRAY_SIZE(vpu_resources),
49 .archdata = {
50 .hwblk_id = HWBLK_VPU,
51 },
48}; 52};
49 53
50static struct uio_info veu0_platform_data = { 54static struct uio_info veu0_platform_data = {
@@ -73,6 +77,9 @@ static struct platform_device veu0_device = {
73 }, 77 },
74 .resource = veu0_resources, 78 .resource = veu0_resources,
75 .num_resources = ARRAY_SIZE(veu0_resources), 79 .num_resources = ARRAY_SIZE(veu0_resources),
80 .archdata = {
81 .hwblk_id = HWBLK_VEU2H0,
82 },
76}; 83};
77 84
78static struct uio_info veu1_platform_data = { 85static struct uio_info veu1_platform_data = {
@@ -101,6 +108,9 @@ static struct platform_device veu1_device = {
101 }, 108 },
102 .resource = veu1_resources, 109 .resource = veu1_resources,
103 .num_resources = ARRAY_SIZE(veu1_resources), 110 .num_resources = ARRAY_SIZE(veu1_resources),
111 .archdata = {
112 .hwblk_id = HWBLK_VEU2H1,
113 },
104}; 114};
105 115
106static struct sh_timer_config cmt_platform_data = { 116static struct sh_timer_config cmt_platform_data = {
@@ -133,6 +143,9 @@ static struct platform_device cmt_device = {
133 }, 143 },
134 .resource = cmt_resources, 144 .resource = cmt_resources,
135 .num_resources = ARRAY_SIZE(cmt_resources), 145 .num_resources = ARRAY_SIZE(cmt_resources),
146 .archdata = {
147 .hwblk_id = HWBLK_CMT,
148 },
136}; 149};
137 150
138static struct sh_timer_config tmu0_platform_data = { 151static struct sh_timer_config tmu0_platform_data = {
@@ -164,6 +177,9 @@ static struct platform_device tmu0_device = {
164 }, 177 },
165 .resource = tmu0_resources, 178 .resource = tmu0_resources,
166 .num_resources = ARRAY_SIZE(tmu0_resources), 179 .num_resources = ARRAY_SIZE(tmu0_resources),
180 .archdata = {
181 .hwblk_id = HWBLK_TMU0,
182 },
167}; 183};
168 184
169static struct sh_timer_config tmu1_platform_data = { 185static struct sh_timer_config tmu1_platform_data = {
@@ -195,6 +211,9 @@ static struct platform_device tmu1_device = {
195 }, 211 },
196 .resource = tmu1_resources, 212 .resource = tmu1_resources,
197 .num_resources = ARRAY_SIZE(tmu1_resources), 213 .num_resources = ARRAY_SIZE(tmu1_resources),
214 .archdata = {
215 .hwblk_id = HWBLK_TMU0,
216 },
198}; 217};
199 218
200static struct sh_timer_config tmu2_platform_data = { 219static struct sh_timer_config tmu2_platform_data = {
@@ -225,6 +244,9 @@ static struct platform_device tmu2_device = {
225 }, 244 },
226 .resource = tmu2_resources, 245 .resource = tmu2_resources,
227 .num_resources = ARRAY_SIZE(tmu2_resources), 246 .num_resources = ARRAY_SIZE(tmu2_resources),
247 .archdata = {
248 .hwblk_id = HWBLK_TMU0,
249 },
228}; 250};
229 251
230static struct sh_timer_config tmu3_platform_data = { 252static struct sh_timer_config tmu3_platform_data = {
@@ -255,6 +277,9 @@ static struct platform_device tmu3_device = {
255 }, 277 },
256 .resource = tmu3_resources, 278 .resource = tmu3_resources,
257 .num_resources = ARRAY_SIZE(tmu3_resources), 279 .num_resources = ARRAY_SIZE(tmu3_resources),
280 .archdata = {
281 .hwblk_id = HWBLK_TMU1,
282 },
258}; 283};
259 284
260static struct sh_timer_config tmu4_platform_data = { 285static struct sh_timer_config tmu4_platform_data = {
@@ -285,6 +310,9 @@ static struct platform_device tmu4_device = {
285 }, 310 },
286 .resource = tmu4_resources, 311 .resource = tmu4_resources,
287 .num_resources = ARRAY_SIZE(tmu4_resources), 312 .num_resources = ARRAY_SIZE(tmu4_resources),
313 .archdata = {
314 .hwblk_id = HWBLK_TMU1,
315 },
288}; 316};
289 317
290static struct sh_timer_config tmu5_platform_data = { 318static struct sh_timer_config tmu5_platform_data = {
@@ -315,6 +343,9 @@ static struct platform_device tmu5_device = {
315 }, 343 },
316 .resource = tmu5_resources, 344 .resource = tmu5_resources,
317 .num_resources = ARRAY_SIZE(tmu5_resources), 345 .num_resources = ARRAY_SIZE(tmu5_resources),
346 .archdata = {
347 .hwblk_id = HWBLK_TMU1,
348 },
318}; 349};
319 350
320static struct plat_sci_port sci_platform_data[] = { 351static struct plat_sci_port sci_platform_data[] = {
@@ -395,10 +426,13 @@ static struct platform_device rtc_device = {
395 .id = -1, 426 .id = -1,
396 .num_resources = ARRAY_SIZE(rtc_resources), 427 .num_resources = ARRAY_SIZE(rtc_resources),
397 .resource = rtc_resources, 428 .resource = rtc_resources,
429 .archdata = {
430 .hwblk_id = HWBLK_RTC,
431 },
398}; 432};
399 433
400static struct r8a66597_platdata r8a66597_data = { 434static struct r8a66597_platdata r8a66597_data = {
401 /* This set zero to all members */ 435 .on_chip = 1,
402}; 436};
403 437
404static struct resource sh7723_usb_host_resources[] = { 438static struct resource sh7723_usb_host_resources[] = {
@@ -424,6 +458,9 @@ static struct platform_device sh7723_usb_host_device = {
424 }, 458 },
425 .num_resources = ARRAY_SIZE(sh7723_usb_host_resources), 459 .num_resources = ARRAY_SIZE(sh7723_usb_host_resources),
426 .resource = sh7723_usb_host_resources, 460 .resource = sh7723_usb_host_resources,
461 .archdata = {
462 .hwblk_id = HWBLK_USB,
463 },
427}; 464};
428 465
429static struct resource iic_resources[] = { 466static struct resource iic_resources[] = {
@@ -445,6 +482,9 @@ static struct platform_device iic_device = {
445 .id = 0, /* "i2c0" clock */ 482 .id = 0, /* "i2c0" clock */
446 .num_resources = ARRAY_SIZE(iic_resources), 483 .num_resources = ARRAY_SIZE(iic_resources),
447 .resource = iic_resources, 484 .resource = iic_resources,
485 .archdata = {
486 .hwblk_id = HWBLK_IIC,
487 },
448}; 488};
449 489
450static struct platform_device *sh7723_devices[] __initdata = { 490static struct platform_device *sh7723_devices[] __initdata = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index a04edaab9a2..f3851fd757e 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -22,6 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <asm/clock.h> 23#include <asm/clock.h>
24#include <asm/mmzone.h> 24#include <asm/mmzone.h>
25#include <cpu/sh7724.h>
25 26
26/* Serial */ 27/* Serial */
27static struct plat_sci_port sci_platform_data[] = { 28static struct plat_sci_port sci_platform_data[] = {
@@ -103,6 +104,9 @@ static struct platform_device rtc_device = {
103 .id = -1, 104 .id = -1,
104 .num_resources = ARRAY_SIZE(rtc_resources), 105 .num_resources = ARRAY_SIZE(rtc_resources),
105 .resource = rtc_resources, 106 .resource = rtc_resources,
107 .archdata = {
108 .hwblk_id = HWBLK_RTC,
109 },
106}; 110};
107 111
108/* I2C0 */ 112/* I2C0 */
@@ -125,6 +129,9 @@ static struct platform_device iic0_device = {
125 .id = 0, /* "i2c0" clock */ 129 .id = 0, /* "i2c0" clock */
126 .num_resources = ARRAY_SIZE(iic0_resources), 130 .num_resources = ARRAY_SIZE(iic0_resources),
127 .resource = iic0_resources, 131 .resource = iic0_resources,
132 .archdata = {
133 .hwblk_id = HWBLK_IIC0,
134 },
128}; 135};
129 136
130/* I2C1 */ 137/* I2C1 */
@@ -147,6 +154,9 @@ static struct platform_device iic1_device = {
147 .id = 1, /* "i2c1" clock */ 154 .id = 1, /* "i2c1" clock */
148 .num_resources = ARRAY_SIZE(iic1_resources), 155 .num_resources = ARRAY_SIZE(iic1_resources),
149 .resource = iic1_resources, 156 .resource = iic1_resources,
157 .archdata = {
158 .hwblk_id = HWBLK_IIC1,
159 },
150}; 160};
151 161
152/* VPU */ 162/* VPU */
@@ -176,6 +186,9 @@ static struct platform_device vpu_device = {
176 }, 186 },
177 .resource = vpu_resources, 187 .resource = vpu_resources,
178 .num_resources = ARRAY_SIZE(vpu_resources), 188 .num_resources = ARRAY_SIZE(vpu_resources),
189 .archdata = {
190 .hwblk_id = HWBLK_VPU,
191 },
179}; 192};
180 193
181/* VEU0 */ 194/* VEU0 */
@@ -205,6 +218,9 @@ static struct platform_device veu0_device = {
205 }, 218 },
206 .resource = veu0_resources, 219 .resource = veu0_resources,
207 .num_resources = ARRAY_SIZE(veu0_resources), 220 .num_resources = ARRAY_SIZE(veu0_resources),
221 .archdata = {
222 .hwblk_id = HWBLK_VEU0,
223 },
208}; 224};
209 225
210/* VEU1 */ 226/* VEU1 */
@@ -234,6 +250,9 @@ static struct platform_device veu1_device = {
234 }, 250 },
235 .resource = veu1_resources, 251 .resource = veu1_resources,
236 .num_resources = ARRAY_SIZE(veu1_resources), 252 .num_resources = ARRAY_SIZE(veu1_resources),
253 .archdata = {
254 .hwblk_id = HWBLK_VEU1,
255 },
237}; 256};
238 257
239static struct sh_timer_config cmt_platform_data = { 258static struct sh_timer_config cmt_platform_data = {
@@ -266,6 +285,9 @@ static struct platform_device cmt_device = {
266 }, 285 },
267 .resource = cmt_resources, 286 .resource = cmt_resources,
268 .num_resources = ARRAY_SIZE(cmt_resources), 287 .num_resources = ARRAY_SIZE(cmt_resources),
288 .archdata = {
289 .hwblk_id = HWBLK_CMT,
290 },
269}; 291};
270 292
271static struct sh_timer_config tmu0_platform_data = { 293static struct sh_timer_config tmu0_platform_data = {
@@ -297,6 +319,9 @@ static struct platform_device tmu0_device = {
297 }, 319 },
298 .resource = tmu0_resources, 320 .resource = tmu0_resources,
299 .num_resources = ARRAY_SIZE(tmu0_resources), 321 .num_resources = ARRAY_SIZE(tmu0_resources),
322 .archdata = {
323 .hwblk_id = HWBLK_TMU0,
324 },
300}; 325};
301 326
302static struct sh_timer_config tmu1_platform_data = { 327static struct sh_timer_config tmu1_platform_data = {
@@ -328,6 +353,9 @@ static struct platform_device tmu1_device = {
328 }, 353 },
329 .resource = tmu1_resources, 354 .resource = tmu1_resources,
330 .num_resources = ARRAY_SIZE(tmu1_resources), 355 .num_resources = ARRAY_SIZE(tmu1_resources),
356 .archdata = {
357 .hwblk_id = HWBLK_TMU0,
358 },
331}; 359};
332 360
333static struct sh_timer_config tmu2_platform_data = { 361static struct sh_timer_config tmu2_platform_data = {
@@ -358,6 +386,9 @@ static struct platform_device tmu2_device = {
358 }, 386 },
359 .resource = tmu2_resources, 387 .resource = tmu2_resources,
360 .num_resources = ARRAY_SIZE(tmu2_resources), 388 .num_resources = ARRAY_SIZE(tmu2_resources),
389 .archdata = {
390 .hwblk_id = HWBLK_TMU0,
391 },
361}; 392};
362 393
363 394
@@ -389,6 +420,9 @@ static struct platform_device tmu3_device = {
389 }, 420 },
390 .resource = tmu3_resources, 421 .resource = tmu3_resources,
391 .num_resources = ARRAY_SIZE(tmu3_resources), 422 .num_resources = ARRAY_SIZE(tmu3_resources),
423 .archdata = {
424 .hwblk_id = HWBLK_TMU1,
425 },
392}; 426};
393 427
394static struct sh_timer_config tmu4_platform_data = { 428static struct sh_timer_config tmu4_platform_data = {
@@ -419,6 +453,9 @@ static struct platform_device tmu4_device = {
419 }, 453 },
420 .resource = tmu4_resources, 454 .resource = tmu4_resources,
421 .num_resources = ARRAY_SIZE(tmu4_resources), 455 .num_resources = ARRAY_SIZE(tmu4_resources),
456 .archdata = {
457 .hwblk_id = HWBLK_TMU1,
458 },
422}; 459};
423 460
424static struct sh_timer_config tmu5_platform_data = { 461static struct sh_timer_config tmu5_platform_data = {
@@ -449,6 +486,9 @@ static struct platform_device tmu5_device = {
449 }, 486 },
450 .resource = tmu5_resources, 487 .resource = tmu5_resources,
451 .num_resources = ARRAY_SIZE(tmu5_resources), 488 .num_resources = ARRAY_SIZE(tmu5_resources),
489 .archdata = {
490 .hwblk_id = HWBLK_TMU1,
491 },
452}; 492};
453 493
454/* JPU */ 494/* JPU */
@@ -478,6 +518,9 @@ static struct platform_device jpu_device = {
478 }, 518 },
479 .resource = jpu_resources, 519 .resource = jpu_resources,
480 .num_resources = ARRAY_SIZE(jpu_resources), 520 .num_resources = ARRAY_SIZE(jpu_resources),
521 .archdata = {
522 .hwblk_id = HWBLK_JPU,
523 },
481}; 524};
482 525
483static struct platform_device *sh7724_devices[] __initdata = { 526static struct platform_device *sh7724_devices[] __initdata = {
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
new file mode 100644
index 00000000000..c470e15f2e0
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -0,0 +1,513 @@
1/*
2 * SH7757 Setup
3 *
4 * Copyright (C) 2009 Renesas Solutions Corp.
5 *
6 * based on setup-sh7785.c : Copyright (C) 2007 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/platform_device.h>
13#include <linux/init.h>
14#include <linux/serial.h>
15#include <linux/serial_sci.h>
16#include <linux/io.h>
17#include <linux/mm.h>
18#include <linux/sh_timer.h>
19
20static struct sh_timer_config tmu0_platform_data = {
21 .name = "TMU0",
22 .channel_offset = 0x04,
23 .timer_bit = 0,
24 .clk = "peripheral_clk",
25 .clockevent_rating = 200,
26};
27
28static struct resource tmu0_resources[] = {
29 [0] = {
30 .name = "TMU0",
31 .start = 0xfe430008,
32 .end = 0xfe430013,
33 .flags = IORESOURCE_MEM,
34 },
35 [1] = {
36 .start = 28,
37 .flags = IORESOURCE_IRQ,
38 },
39};
40
41static struct platform_device tmu0_device = {
42 .name = "sh_tmu",
43 .id = 0,
44 .dev = {
45 .platform_data = &tmu0_platform_data,
46 },
47 .resource = tmu0_resources,
48 .num_resources = ARRAY_SIZE(tmu0_resources),
49};
50
51static struct sh_timer_config tmu1_platform_data = {
52 .name = "TMU1",
53 .channel_offset = 0x10,
54 .timer_bit = 1,
55 .clk = "peripheral_clk",
56 .clocksource_rating = 200,
57};
58
59static struct resource tmu1_resources[] = {
60 [0] = {
61 .name = "TMU1",
62 .start = 0xfe430014,
63 .end = 0xfe43001f,
64 .flags = IORESOURCE_MEM,
65 },
66 [1] = {
67 .start = 29,
68 .flags = IORESOURCE_IRQ,
69 },
70};
71
72static struct platform_device tmu1_device = {
73 .name = "sh_tmu",
74 .id = 1,
75 .dev = {
76 .platform_data = &tmu1_platform_data,
77 },
78 .resource = tmu1_resources,
79 .num_resources = ARRAY_SIZE(tmu1_resources),
80};
81
82static struct plat_sci_port sci_platform_data[] = {
83 {
84 .mapbase = 0xfe4b0000, /* SCIF2 */
85 .flags = UPF_BOOT_AUTOCONF,
86 .type = PORT_SCIF,
87 .irqs = { 40, 40, 40, 40 },
88 }, {
89 .mapbase = 0xfe4c0000, /* SCIF3 */
90 .flags = UPF_BOOT_AUTOCONF,
91 .type = PORT_SCIF,
92 .irqs = { 76, 76, 76, 76 },
93 }, {
94 .mapbase = 0xfe4d0000, /* SCIF4 */
95 .flags = UPF_BOOT_AUTOCONF,
96 .type = PORT_SCIF,
97 .irqs = { 104, 104, 104, 104 },
98 }, {
99 .flags = 0,
100 }
101};
102
103static struct platform_device sci_device = {
104 .name = "sh-sci",
105 .id = -1,
106 .dev = {
107 .platform_data = sci_platform_data,
108 },
109};
110
111static struct platform_device *sh7757_devices[] __initdata = {
112 &tmu0_device,
113 &tmu1_device,
114 &sci_device,
115};
116
117static int __init sh7757_devices_setup(void)
118{
119 return platform_add_devices(sh7757_devices,
120 ARRAY_SIZE(sh7757_devices));
121}
122arch_initcall(sh7757_devices_setup);
123
124enum {
125 UNUSED = 0,
126
127 /* interrupt sources */
128
129 IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
130 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
131 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
132 IRL0_HHLL, IRL0_HHLH, IRL0_HHHL,
133
134 IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
135 IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
136 IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
137 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL,
138 IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7,
139
140 SDHI,
141 DVC,
142 IRQ8, IRQ9, IRQ10,
143 WDT0,
144 TMU0, TMU1, TMU2, TMU2_TICPI,
145 HUDI,
146
147 ARC4,
148 DMAC0,
149 IRQ11,
150 SCIF2,
151 DMAC1_6,
152 USB0,
153 IRQ12,
154 JMC,
155 SPI1,
156 IRQ13, IRQ14,
157 USB1,
158 TMR01, TMR23, TMR45,
159 WDT1,
160 FRT,
161 LPC,
162 SCIF0, SCIF1, SCIF3,
163 PECI0I, PECI1I, PECI2I,
164 IRQ15,
165 ETHERC,
166 SPI0,
167 ADC1,
168 DMAC1_8,
169 SIM,
170 TMU3, TMU4, TMU5,
171 ADC0,
172 SCIF4,
173 IIC0_0, IIC0_1, IIC0_2, IIC0_3,
174 IIC1_0, IIC1_1, IIC1_2, IIC1_3,
175 IIC2_0, IIC2_1, IIC2_2, IIC2_3,
176 IIC3_0, IIC3_1, IIC3_2, IIC3_3,
177 IIC4_0, IIC4_1, IIC4_2, IIC4_3,
178 IIC5_0, IIC5_1, IIC5_2, IIC5_3,
179 IIC6_0, IIC6_1, IIC6_2, IIC6_3,
180 IIC7_0, IIC7_1, IIC7_2, IIC7_3,
181 IIC8_0, IIC8_1, IIC8_2, IIC8_3,
182 IIC9_0, IIC9_1, IIC9_2, IIC9_3,
183 PCIINTA,
184 PCIE,
185 SGPIO,
186
187 /* interrupt groups */
188
189 TMU012, TMU345,
190};
191
192static struct intc_vect vectors[] __initdata = {
193 INTC_VECT(SDHI, 0x480), INTC_VECT(SDHI, 0x04a0),
194 INTC_VECT(SDHI, 0x4c0),
195 INTC_VECT(DVC, 0x4e0),
196 INTC_VECT(IRQ8, 0x500), INTC_VECT(IRQ9, 0x520),
197 INTC_VECT(IRQ10, 0x540),
198 INTC_VECT(WDT0, 0x560),
199 INTC_VECT(TMU0, 0x580), INTC_VECT(TMU1, 0x5a0),
200 INTC_VECT(TMU2, 0x5c0), INTC_VECT(TMU2_TICPI, 0x5e0),
201 INTC_VECT(HUDI, 0x600),
202 INTC_VECT(ARC4, 0x620),
203 INTC_VECT(DMAC0, 0x640), INTC_VECT(DMAC0, 0x660),
204 INTC_VECT(DMAC0, 0x680), INTC_VECT(DMAC0, 0x6a0),
205 INTC_VECT(DMAC0, 0x6c0),
206 INTC_VECT(IRQ11, 0x6e0),
207 INTC_VECT(SCIF2, 0x700), INTC_VECT(SCIF2, 0x720),
208 INTC_VECT(SCIF2, 0x740), INTC_VECT(SCIF2, 0x760),
209 INTC_VECT(DMAC0, 0x780), INTC_VECT(DMAC0, 0x7a0),
210 INTC_VECT(DMAC1_6, 0x7c0), INTC_VECT(DMAC1_6, 0x7e0),
211 INTC_VECT(USB0, 0x840),
212 INTC_VECT(IRQ12, 0x880),
213 INTC_VECT(JMC, 0x8a0),
214 INTC_VECT(SPI1, 0x8c0),
215 INTC_VECT(IRQ13, 0x8e0), INTC_VECT(IRQ14, 0x900),
216 INTC_VECT(USB1, 0x920),
217 INTC_VECT(TMR01, 0xa00), INTC_VECT(TMR23, 0xa20),
218 INTC_VECT(TMR45, 0xa40),
219 INTC_VECT(WDT1, 0xa60),
220 INTC_VECT(FRT, 0xa80),
221 INTC_VECT(LPC, 0xaa0), INTC_VECT(LPC, 0xac0),
222 INTC_VECT(LPC, 0xae0), INTC_VECT(LPC, 0xb00),
223 INTC_VECT(LPC, 0xb20),
224 INTC_VECT(SCIF0, 0xb40), INTC_VECT(SCIF1, 0xb60),
225 INTC_VECT(SCIF3, 0xb80), INTC_VECT(SCIF3, 0xba0),
226 INTC_VECT(SCIF3, 0xbc0), INTC_VECT(SCIF3, 0xbe0),
227 INTC_VECT(PECI0I, 0xc00), INTC_VECT(PECI1I, 0xc20),
228 INTC_VECT(PECI2I, 0xc40),
229 INTC_VECT(IRQ15, 0xc60),
230 INTC_VECT(ETHERC, 0xc80), INTC_VECT(ETHERC, 0xca0),
231 INTC_VECT(SPI0, 0xcc0),
232 INTC_VECT(ADC1, 0xce0),
233 INTC_VECT(DMAC1_8, 0xd00), INTC_VECT(DMAC1_8, 0xd20),
234 INTC_VECT(DMAC1_8, 0xd40), INTC_VECT(DMAC1_8, 0xd60),
235 INTC_VECT(SIM, 0xd80), INTC_VECT(SIM, 0xda0),
236 INTC_VECT(SIM, 0xdc0), INTC_VECT(SIM, 0xde0),
237 INTC_VECT(TMU3, 0xe00), INTC_VECT(TMU4, 0xe20),
238 INTC_VECT(TMU5, 0xe40),
239 INTC_VECT(ADC0, 0xe60),
240 INTC_VECT(SCIF4, 0xf00), INTC_VECT(SCIF4, 0xf20),
241 INTC_VECT(SCIF4, 0xf40), INTC_VECT(SCIF4, 0xf60),
242 INTC_VECT(IIC0_0, 0x1400), INTC_VECT(IIC0_1, 0x1420),
243 INTC_VECT(IIC0_2, 0x1440), INTC_VECT(IIC0_3, 0x1460),
244 INTC_VECT(IIC1_0, 0x1480), INTC_VECT(IIC1_1, 0x14e0),
245 INTC_VECT(IIC1_2, 0x1500), INTC_VECT(IIC1_3, 0x1520),
246 INTC_VECT(IIC2_0, 0x1540), INTC_VECT(IIC2_1, 0x1560),
247 INTC_VECT(IIC2_2, 0x1580), INTC_VECT(IIC2_3, 0x1600),
248 INTC_VECT(IIC3_0, 0x1620), INTC_VECT(IIC3_1, 0x1640),
249 INTC_VECT(IIC3_2, 0x16e0), INTC_VECT(IIC3_3, 0x1700),
250 INTC_VECT(IIC4_0, 0x17c0), INTC_VECT(IIC4_1, 0x1800),
251 INTC_VECT(IIC4_2, 0x1820), INTC_VECT(IIC4_3, 0x1840),
252 INTC_VECT(IIC5_0, 0x1860), INTC_VECT(IIC5_1, 0x1880),
253 INTC_VECT(IIC5_2, 0x18a0), INTC_VECT(IIC5_3, 0x18c0),
254 INTC_VECT(IIC6_0, 0x18e0), INTC_VECT(IIC6_1, 0x1900),
255 INTC_VECT(IIC6_2, 0x1920), INTC_VECT(IIC6_3, 0x1980),
256 INTC_VECT(IIC7_0, 0x19a0), INTC_VECT(IIC7_1, 0x1a00),
257 INTC_VECT(IIC7_2, 0x1a20), INTC_VECT(IIC7_3, 0x1a40),
258 INTC_VECT(IIC8_0, 0x1a60), INTC_VECT(IIC8_1, 0x1a80),
259 INTC_VECT(IIC8_2, 0x1aa0), INTC_VECT(IIC8_3, 0x1b40),
260 INTC_VECT(IIC9_0, 0x1b60), INTC_VECT(IIC9_1, 0x1b80),
261 INTC_VECT(IIC9_2, 0x1c00), INTC_VECT(IIC9_3, 0x1c20),
262 INTC_VECT(PCIINTA, 0x1ce0),
263 INTC_VECT(PCIE, 0x1e00),
264 INTC_VECT(SGPIO, 0x1f80),
265 INTC_VECT(SGPIO, 0x1fa0),
266};
267
268static struct intc_group groups[] __initdata = {
269 INTC_GROUP(TMU012, TMU0, TMU1, TMU2, TMU2_TICPI),
270 INTC_GROUP(TMU345, TMU3, TMU4, TMU5),
271};
272
273static struct intc_mask_reg mask_registers[] __initdata = {
274 { 0xffd00044, 0xffd00064, 32, /* INTMSK0 / INTMSKCLR0 */
275 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
276
277 { 0xffd40080, 0xffd40084, 32, /* INTMSK2 / INTMSKCLR2 */
278 { IRL0_LLLL, IRL0_LLLH, IRL0_LLHL, IRL0_LLHH,
279 IRL0_LHLL, IRL0_LHLH, IRL0_LHHL, IRL0_LHHH,
280 IRL0_HLLL, IRL0_HLLH, IRL0_HLHL, IRL0_HLHH,
281 IRL0_HHLL, IRL0_HHLH, IRL0_HHHL, 0,
282 IRL4_LLLL, IRL4_LLLH, IRL4_LLHL, IRL4_LLHH,
283 IRL4_LHLL, IRL4_LHLH, IRL4_LHHL, IRL4_LHHH,
284 IRL4_HLLL, IRL4_HLLH, IRL4_HLHL, IRL4_HLHH,
285 IRL4_HHLL, IRL4_HHLH, IRL4_HHHL, 0, } },
286
287 { 0xffd40038, 0xffd4003c, 32, /* INT2MSKR / INT2MSKCR */
288 { 0, 0, 0, 0, 0, 0, 0, 0,
289 0, DMAC1_8, 0, PECI0I, LPC, FRT, WDT1, TMR45,
290 TMR23, TMR01, 0, 0, 0, 0, 0, DMAC0,
291 HUDI, 0, WDT0, SCIF3, SCIF2, SDHI, TMU345, TMU012
292 } },
293
294 { 0xffd400d0, 0xffd400d4, 32, /* INT2MSKR1 / INT2MSKCR1 */
295 { IRQ15, IRQ14, IRQ13, IRQ12, IRQ11, IRQ10, SCIF4, ETHERC,
296 IRQ9, IRQ8, SCIF1, SCIF0, USB0, 0, 0, USB1,
297 ADC1, 0, DMAC1_6, ADC0, SPI0, SIM, PECI2I, PECI1I,
298 ARC4, 0, SPI1, JMC, 0, 0, 0, DVC
299 } },
300
301 { 0xffd10038, 0xffd1003c, 32, /* INT2MSKR2 / INT2MSKCR2 */
302 { IIC4_1, IIC4_2, IIC5_0, 0, 0, 0, SGPIO, 0,
303 0, 0, 0, IIC9_2, IIC8_2, IIC8_1, IIC8_0, IIC7_3,
304 IIC7_2, IIC7_1, IIC6_3, IIC0_0, IIC0_1, IIC0_2, IIC0_3, IIC3_1,
305 IIC2_3, 0, IIC2_1, IIC9_1, IIC3_3, IIC1_0, PCIE, IIC2_2
306 } },
307
308 { 0xffd100d0, 0xff1400d4, 32, /* INT2MSKR3 / INT2MSKCR4 */
309 { 0, IIC6_1, IIC6_0, IIC5_1, IIC3_2, IIC2_0, 0, 0,
310 IIC1_3, IIC1_2, IIC9_0, IIC8_3, IIC4_3, IIC7_0, 0, IIC6_2,
311 PCIINTA, 0, IIC4_0, 0, 0, 0, 0, IIC9_3,
312 IIC3_0, 0, IIC5_3, IIC5_2, 0, 0, 0, IIC1_1
313 } },
314};
315
316#define INTPRI 0xffd00010
317#define INT2PRI0 0xffd40000
318#define INT2PRI1 0xffd40004
319#define INT2PRI2 0xffd40008
320#define INT2PRI3 0xffd4000c
321#define INT2PRI4 0xffd40010
322#define INT2PRI5 0xffd40014
323#define INT2PRI6 0xffd40018
324#define INT2PRI7 0xffd4001c
325#define INT2PRI8 0xffd400a0
326#define INT2PRI9 0xffd400a4
327#define INT2PRI10 0xffd400a8
328#define INT2PRI11 0xffd400ac
329#define INT2PRI12 0xffd400b0
330#define INT2PRI13 0xffd400b4
331#define INT2PRI14 0xffd400b8
332#define INT2PRI15 0xffd400bc
333#define INT2PRI16 0xffd10000
334#define INT2PRI17 0xffd10004
335#define INT2PRI18 0xffd10008
336#define INT2PRI19 0xffd1000c
337#define INT2PRI20 0xffd10010
338#define INT2PRI21 0xffd10014
339#define INT2PRI22 0xffd10018
340#define INT2PRI23 0xffd1001c
341#define INT2PRI24 0xffd100a0
342#define INT2PRI25 0xffd100a4
343#define INT2PRI26 0xffd100a8
344#define INT2PRI27 0xffd100ac
345#define INT2PRI28 0xffd100b0
346#define INT2PRI29 0xffd100b4
347#define INT2PRI30 0xffd100b8
348#define INT2PRI31 0xffd100bc
349
350static struct intc_prio_reg prio_registers[] __initdata = {
351 { INTPRI, 0, 32, 4, { IRQ0, IRQ1, IRQ2, IRQ3,
352 IRQ4, IRQ5, IRQ6, IRQ7 } },
353
354 { INT2PRI0, 0, 32, 8, { TMU0, TMU1, TMU2, TMU2_TICPI } },
355 { INT2PRI1, 0, 32, 8, { TMU3, TMU4, TMU5, SDHI } },
356 { INT2PRI2, 0, 32, 8, { SCIF2, SCIF3, WDT0, IRQ8 } },
357 { INT2PRI3, 0, 32, 8, { HUDI, DMAC0, ADC0, IRQ9 } },
358 { INT2PRI4, 0, 32, 8, { IRQ10, 0, TMR01, TMR23 } },
359 { INT2PRI5, 0, 32, 8, { TMR45, WDT1, FRT, LPC } },
360 { INT2PRI6, 0, 32, 8, { PECI0I, ETHERC, DMAC1_8, 0 } },
361 { INT2PRI7, 0, 32, 8, { SCIF4, 0, IRQ11, IRQ12 } },
362 { INT2PRI8, 0, 32, 8, { 0, 0, 0, DVC } },
363 { INT2PRI9, 0, 32, 8, { ARC4, 0, SPI1, JMC } },
364 { INT2PRI10, 0, 32, 8, { SPI0, SIM, PECI2I, PECI1I } },
365 { INT2PRI11, 0, 32, 8, { ADC1, IRQ13, DMAC1_6, IRQ14 } },
366 { INT2PRI12, 0, 32, 8, { USB0, 0, IRQ15, USB1 } },
367 { INT2PRI13, 0, 32, 8, { 0, 0, SCIF1, SCIF0 } },
368
369 { INT2PRI16, 0, 32, 8, { IIC2_2, 0, 0, 0 } },
370 { INT2PRI17, 0, 32, 8, { PCIE, 0, 0, IIC1_0 } },
371 { INT2PRI18, 0, 32, 8, { IIC3_3, IIC9_1, IIC2_1, IIC1_2 } },
372 { INT2PRI19, 0, 32, 8, { IIC2_3, IIC3_1, 0, IIC1_3 } },
373 { INT2PRI20, 0, 32, 8, { IIC2_0, IIC6_3, IIC7_1, IIC7_2 } },
374 { INT2PRI21, 0, 32, 8, { IIC7_3, IIC8_0, IIC8_1, IIC8_2 } },
375 { INT2PRI22, 0, 32, 8, { IIC9_2, 0, 0, 0 } },
376 { INT2PRI23, 0, 32, 8, { 0, SGPIO, IIC3_2, IIC5_1 } },
377 { INT2PRI24, 0, 32, 8, { 0, 0, 0, IIC1_1 } },
378 { INT2PRI25, 0, 32, 8, { IIC3_0, 0, IIC5_3, IIC5_2 } },
379 { INT2PRI26, 0, 32, 8, { 0, 0, 0, IIC9_3 } },
380 { INT2PRI27, 0, 32, 8, { PCIINTA, IIC6_0, IIC4_0, IIC6_1 } },
381 { INT2PRI28, 0, 32, 8, { IIC4_3, IIC7_0, 0, IIC6_2 } },
382 { INT2PRI29, 0, 32, 8, { 0, 0, IIC9_0, IIC8_3 } },
383 { INT2PRI30, 0, 32, 8, { IIC4_1, IIC4_2, IIC5_0, 0 } },
384 { INT2PRI31, 0, 32, 8, { IIC0_0, IIC0_1, IIC0_2, IIC0_3 } },
385};
386
387static DECLARE_INTC_DESC(intc_desc, "sh7757", vectors, groups,
388 mask_registers, prio_registers, NULL);
389
390/* Support for external interrupt pins in IRQ mode */
391static struct intc_vect vectors_irq0123[] __initdata = {
392 INTC_VECT(IRQ0, 0x240), INTC_VECT(IRQ1, 0x280),
393 INTC_VECT(IRQ2, 0x2c0), INTC_VECT(IRQ3, 0x300),
394};
395
396static struct intc_vect vectors_irq4567[] __initdata = {
397 INTC_VECT(IRQ4, 0x340), INTC_VECT(IRQ5, 0x380),
398 INTC_VECT(IRQ6, 0x3c0), INTC_VECT(IRQ7, 0x200),
399};
400
401static struct intc_sense_reg sense_registers[] __initdata = {
402 { 0xffd0001c, 32, 2, /* ICR1 */ { IRQ0, IRQ1, IRQ2, IRQ3,
403 IRQ4, IRQ5, IRQ6, IRQ7 } },
404};
405
406static struct intc_mask_reg ack_registers[] __initdata = {
407 { 0xffd00024, 0, 32, /* INTREQ */
408 { IRQ0, IRQ1, IRQ2, IRQ3, IRQ4, IRQ5, IRQ6, IRQ7 } },
409};
410
411static DECLARE_INTC_DESC_ACK(intc_desc_irq0123, "sh7757-irq0123",
412 vectors_irq0123, NULL, mask_registers,
413 prio_registers, sense_registers, ack_registers);
414
415static DECLARE_INTC_DESC_ACK(intc_desc_irq4567, "sh7757-irq4567",
416 vectors_irq4567, NULL, mask_registers,
417 prio_registers, sense_registers, ack_registers);
418
419/* External interrupt pins in IRL mode */
420static struct intc_vect vectors_irl0123[] __initdata = {
421 INTC_VECT(IRL0_LLLL, 0x200), INTC_VECT(IRL0_LLLH, 0x220),
422 INTC_VECT(IRL0_LLHL, 0x240), INTC_VECT(IRL0_LLHH, 0x260),
423 INTC_VECT(IRL0_LHLL, 0x280), INTC_VECT(IRL0_LHLH, 0x2a0),
424 INTC_VECT(IRL0_LHHL, 0x2c0), INTC_VECT(IRL0_LHHH, 0x2e0),
425 INTC_VECT(IRL0_HLLL, 0x300), INTC_VECT(IRL0_HLLH, 0x320),
426 INTC_VECT(IRL0_HLHL, 0x340), INTC_VECT(IRL0_HLHH, 0x360),
427 INTC_VECT(IRL0_HHLL, 0x380), INTC_VECT(IRL0_HHLH, 0x3a0),
428 INTC_VECT(IRL0_HHHL, 0x3c0),
429};
430
431static struct intc_vect vectors_irl4567[] __initdata = {
432 INTC_VECT(IRL4_LLLL, 0xb00), INTC_VECT(IRL4_LLLH, 0xb20),
433 INTC_VECT(IRL4_LLHL, 0xb40), INTC_VECT(IRL4_LLHH, 0xb60),
434 INTC_VECT(IRL4_LHLL, 0xb80), INTC_VECT(IRL4_LHLH, 0xba0),
435 INTC_VECT(IRL4_LHHL, 0xbc0), INTC_VECT(IRL4_LHHH, 0xbe0),
436 INTC_VECT(IRL4_HLLL, 0xc00), INTC_VECT(IRL4_HLLH, 0xc20),
437 INTC_VECT(IRL4_HLHL, 0xc40), INTC_VECT(IRL4_HLHH, 0xc60),
438 INTC_VECT(IRL4_HHLL, 0xc80), INTC_VECT(IRL4_HHLH, 0xca0),
439 INTC_VECT(IRL4_HHHL, 0xcc0),
440};
441
442static DECLARE_INTC_DESC(intc_desc_irl0123, "sh7757-irl0123", vectors_irl0123,
443 NULL, mask_registers, NULL, NULL);
444
445static DECLARE_INTC_DESC(intc_desc_irl4567, "sh7757-irl4567", vectors_irl4567,
446 NULL, mask_registers, NULL, NULL);
447
448#define INTC_ICR0 0xffd00000
449#define INTC_INTMSK0 0xffd00044
450#define INTC_INTMSK1 0xffd00048
451#define INTC_INTMSK2 0xffd40080
452#define INTC_INTMSKCLR1 0xffd00068
453#define INTC_INTMSKCLR2 0xffd40084
454
455void __init plat_irq_setup(void)
456{
457 /* disable IRQ3-0 + IRQ7-4 */
458 ctrl_outl(0xff000000, INTC_INTMSK0);
459
460 /* disable IRL3-0 + IRL7-4 */
461 ctrl_outl(0xc0000000, INTC_INTMSK1);
462 ctrl_outl(0xfffefffe, INTC_INTMSK2);
463
464 /* select IRL mode for IRL3-0 + IRL7-4 */
465 ctrl_outl(ctrl_inl(INTC_ICR0) & ~0x00c00000, INTC_ICR0);
466
467 /* disable holding function, ie enable "SH-4 Mode" */
468 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00200000, INTC_ICR0);
469
470 register_intc_controller(&intc_desc);
471}
472
473void __init plat_irq_setup_pins(int mode)
474{
475 switch (mode) {
476 case IRQ_MODE_IRQ7654:
477 /* select IRQ mode for IRL7-4 */
478 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00400000, INTC_ICR0);
479 register_intc_controller(&intc_desc_irq4567);
480 break;
481 case IRQ_MODE_IRQ3210:
482 /* select IRQ mode for IRL3-0 */
483 ctrl_outl(ctrl_inl(INTC_ICR0) | 0x00800000, INTC_ICR0);
484 register_intc_controller(&intc_desc_irq0123);
485 break;
486 case IRQ_MODE_IRL7654:
487 /* enable IRL7-4 but don't provide any masking */
488 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
489 ctrl_outl(0x0000fffe, INTC_INTMSKCLR2);
490 break;
491 case IRQ_MODE_IRL3210:
492 /* enable IRL0-3 but don't provide any masking */
493 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
494 ctrl_outl(0xfffe0000, INTC_INTMSKCLR2);
495 break;
496 case IRQ_MODE_IRL7654_MASK:
497 /* enable IRL7-4 and mask using cpu intc controller */
498 ctrl_outl(0x40000000, INTC_INTMSKCLR1);
499 register_intc_controller(&intc_desc_irl4567);
500 break;
501 case IRQ_MODE_IRL3210_MASK:
502 /* enable IRL0-3 and mask using cpu intc controller */
503 ctrl_outl(0x80000000, INTC_INTMSKCLR1);
504 register_intc_controller(&intc_desc_irl0123);
505 break;
506 default:
507 BUG();
508 }
509}
510
511void __init plat_mem_setup(void)
512{
513}
diff --git a/arch/sh/kernel/cpu/sh4a/setup-shx3.c b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
index 07f078961c7..e848443deeb 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-shx3.c
@@ -268,11 +268,7 @@ enum {
268 UNUSED = 0, 268 UNUSED = 0,
269 269
270 /* interrupt sources */ 270 /* interrupt sources */
271 IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH, 271 IRL, IRQ0, IRQ1, IRQ2, IRQ3,
272 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
273 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
274 IRL_HHLL, IRL_HHLH, IRL_HHHL,
275 IRQ0, IRQ1, IRQ2, IRQ3,
276 HUDII, 272 HUDII,
277 TMU0, TMU1, TMU2, TMU3, TMU4, TMU5, 273 TMU0, TMU1, TMU2, TMU3, TMU4, TMU5,
278 PCII0, PCII1, PCII2, PCII3, PCII4, 274 PCII0, PCII1, PCII2, PCII3, PCII4,
@@ -287,10 +283,7 @@ enum {
287 DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, DMAC1_DMINT9, 283 DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, DMAC1_DMINT9,
288 DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE, 284 DMAC1_DMINT10, DMAC1_DMINT11, DMAC1_DMAE,
289 IIC, VIN0, VIN1, VCORE0, ATAPI, 285 IIC, VIN0, VIN1, VCORE0, ATAPI,
290 DTU0_TEND, DTU0_AE, DTU0_TMISS, 286 DTU0, DTU1, DTU2, DTU3,
291 DTU1_TEND, DTU1_AE, DTU1_TMISS,
292 DTU2_TEND, DTU2_AE, DTU2_TMISS,
293 DTU3_TEND, DTU3_AE, DTU3_TMISS,
294 FE0, FE1, 287 FE0, FE1,
295 GPIO0, GPIO1, GPIO2, GPIO3, 288 GPIO0, GPIO1, GPIO2, GPIO3,
296 PAM, IRM, 289 PAM, IRM,
@@ -298,8 +291,8 @@ enum {
298 INTICI4, INTICI5, INTICI6, INTICI7, 291 INTICI4, INTICI5, INTICI6, INTICI7,
299 292
300 /* interrupt groups */ 293 /* interrupt groups */
301 IRL, PCII56789, SCIF0, SCIF1, SCIF2, SCIF3, 294 PCII56789, SCIF0, SCIF1, SCIF2, SCIF3,
302 DMAC0, DMAC1, DTU0, DTU1, DTU2, DTU3, 295 DMAC0, DMAC1,
303}; 296};
304 297
305static struct intc_vect vectors[] __initdata = { 298static struct intc_vect vectors[] __initdata = {
@@ -332,14 +325,14 @@ static struct intc_vect vectors[] __initdata = {
332 INTC_VECT(IIC, 0xae0), 325 INTC_VECT(IIC, 0xae0),
333 INTC_VECT(VIN0, 0xb00), INTC_VECT(VIN1, 0xb20), 326 INTC_VECT(VIN0, 0xb00), INTC_VECT(VIN1, 0xb20),
334 INTC_VECT(VCORE0, 0xb00), INTC_VECT(ATAPI, 0xb60), 327 INTC_VECT(VCORE0, 0xb00), INTC_VECT(ATAPI, 0xb60),
335 INTC_VECT(DTU0_TEND, 0xc00), INTC_VECT(DTU0_AE, 0xc20), 328 INTC_VECT(DTU0, 0xc00), INTC_VECT(DTU0, 0xc20),
336 INTC_VECT(DTU0_TMISS, 0xc40), 329 INTC_VECT(DTU0, 0xc40),
337 INTC_VECT(DTU1_TEND, 0xc60), INTC_VECT(DTU1_AE, 0xc80), 330 INTC_VECT(DTU1, 0xc60), INTC_VECT(DTU1, 0xc80),
338 INTC_VECT(DTU1_TMISS, 0xca0), 331 INTC_VECT(DTU1, 0xca0),
339 INTC_VECT(DTU2_TEND, 0xcc0), INTC_VECT(DTU2_AE, 0xce0), 332 INTC_VECT(DTU2, 0xcc0), INTC_VECT(DTU2, 0xce0),
340 INTC_VECT(DTU2_TMISS, 0xd00), 333 INTC_VECT(DTU2, 0xd00),
341 INTC_VECT(DTU3_TEND, 0xd20), INTC_VECT(DTU3_AE, 0xd40), 334 INTC_VECT(DTU3, 0xd20), INTC_VECT(DTU3, 0xd40),
342 INTC_VECT(DTU3_TMISS, 0xd60), 335 INTC_VECT(DTU3, 0xd60),
343 INTC_VECT(FE0, 0xe00), INTC_VECT(FE1, 0xe20), 336 INTC_VECT(FE0, 0xe00), INTC_VECT(FE1, 0xe20),
344 INTC_VECT(GPIO0, 0xe40), INTC_VECT(GPIO1, 0xe60), 337 INTC_VECT(GPIO0, 0xe40), INTC_VECT(GPIO1, 0xe60),
345 INTC_VECT(GPIO2, 0xe80), INTC_VECT(GPIO3, 0xea0), 338 INTC_VECT(GPIO2, 0xe80), INTC_VECT(GPIO3, 0xea0),
@@ -351,10 +344,6 @@ static struct intc_vect vectors[] __initdata = {
351}; 344};
352 345
353static struct intc_group groups[] __initdata = { 346static struct intc_group groups[] __initdata = {
354 INTC_GROUP(IRL, IRL_LLLL, IRL_LLLH, IRL_LLHL, IRL_LLHH,
355 IRL_LHLL, IRL_LHLH, IRL_LHHL, IRL_LHHH,
356 IRL_HLLL, IRL_HLLH, IRL_HLHL, IRL_HLHH,
357 IRL_HHLL, IRL_HHLH, IRL_HHHL),
358 INTC_GROUP(PCII56789, PCII5, PCII6, PCII7, PCII8, PCII9), 347 INTC_GROUP(PCII56789, PCII5, PCII6, PCII7, PCII8, PCII9),
359 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI), 348 INTC_GROUP(SCIF0, SCIF0_ERI, SCIF0_RXI, SCIF0_BRI, SCIF0_TXI),
360 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI), 349 INTC_GROUP(SCIF1, SCIF1_ERI, SCIF1_RXI, SCIF1_BRI, SCIF1_TXI),
@@ -364,10 +353,6 @@ static struct intc_group groups[] __initdata = {
364 DMAC0_DMINT3, DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE), 353 DMAC0_DMINT3, DMAC0_DMINT4, DMAC0_DMINT5, DMAC0_DMAE),
365 INTC_GROUP(DMAC1, DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8, 354 INTC_GROUP(DMAC1, DMAC1_DMINT6, DMAC1_DMINT7, DMAC1_DMINT8,
366 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11), 355 DMAC1_DMINT9, DMAC1_DMINT10, DMAC1_DMINT11),
367 INTC_GROUP(DTU0, DTU0_TEND, DTU0_AE, DTU0_TMISS),
368 INTC_GROUP(DTU1, DTU1_TEND, DTU1_AE, DTU1_TMISS),
369 INTC_GROUP(DTU2, DTU2_TEND, DTU2_AE, DTU2_TMISS),
370 INTC_GROUP(DTU3, DTU3_TEND, DTU3_AE, DTU3_TMISS),
371}; 356};
372 357
373static struct intc_mask_reg mask_registers[] __initdata = { 358static struct intc_mask_reg mask_registers[] __initdata = {
@@ -434,14 +419,14 @@ static DECLARE_INTC_DESC(intc_desc_irq, "shx3-irq", vectors_irq, groups,
434 419
435/* External interrupt pins in IRL mode */ 420/* External interrupt pins in IRL mode */
436static struct intc_vect vectors_irl[] __initdata = { 421static struct intc_vect vectors_irl[] __initdata = {
437 INTC_VECT(IRL_LLLL, 0x200), INTC_VECT(IRL_LLLH, 0x220), 422 INTC_VECT(IRL, 0x200), INTC_VECT(IRL, 0x220),
438 INTC_VECT(IRL_LLHL, 0x240), INTC_VECT(IRL_LLHH, 0x260), 423 INTC_VECT(IRL, 0x240), INTC_VECT(IRL, 0x260),
439 INTC_VECT(IRL_LHLL, 0x280), INTC_VECT(IRL_LHLH, 0x2a0), 424 INTC_VECT(IRL, 0x280), INTC_VECT(IRL, 0x2a0),
440 INTC_VECT(IRL_LHHL, 0x2c0), INTC_VECT(IRL_LHHH, 0x2e0), 425 INTC_VECT(IRL, 0x2c0), INTC_VECT(IRL, 0x2e0),
441 INTC_VECT(IRL_HLLL, 0x300), INTC_VECT(IRL_HLLH, 0x320), 426 INTC_VECT(IRL, 0x300), INTC_VECT(IRL, 0x320),
442 INTC_VECT(IRL_HLHL, 0x340), INTC_VECT(IRL_HLHH, 0x360), 427 INTC_VECT(IRL, 0x340), INTC_VECT(IRL, 0x360),
443 INTC_VECT(IRL_HHLL, 0x380), INTC_VECT(IRL_HHLH, 0x3a0), 428 INTC_VECT(IRL, 0x380), INTC_VECT(IRL, 0x3a0),
444 INTC_VECT(IRL_HHHL, 0x3c0), 429 INTC_VECT(IRL, 0x3c0),
445}; 430};
446 431
447static DECLARE_INTC_DESC(intc_desc_irl, "shx3-irl", vectors_irl, groups, 432static DECLARE_INTC_DESC(intc_desc_irl, "shx3-irl", vectors_irl, groups,
diff --git a/arch/sh/kernel/cpu/sh4a/smp-shx3.c b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
index 2b6b0d50c57..185ec3976a2 100644
--- a/arch/sh/kernel/cpu/sh4a/smp-shx3.c
+++ b/arch/sh/kernel/cpu/sh4a/smp-shx3.c
@@ -57,6 +57,8 @@ void __init plat_prepare_cpus(unsigned int max_cpus)
57{ 57{
58 int i; 58 int i;
59 59
60 local_timer_setup(0);
61
60 BUILD_BUG_ON(SMP_MSG_NR >= 8); 62 BUILD_BUG_ON(SMP_MSG_NR >= 8);
61 63
62 for (i = 0; i < SMP_MSG_NR; i++) 64 for (i = 0; i < SMP_MSG_NR; i++)
diff --git a/arch/sh/kernel/cpu/sh5/probe.c b/arch/sh/kernel/cpu/sh5/probe.c
index 92ad844b5c1..521d05b3f7b 100644
--- a/arch/sh/kernel/cpu/sh5/probe.c
+++ b/arch/sh/kernel/cpu/sh5/probe.c
@@ -34,6 +34,8 @@ int __init detect_cpu_and_cache_system(void)
34 /* CPU.VCR aliased at CIR address on SH5-101 */ 34 /* CPU.VCR aliased at CIR address on SH5-101 */
35 boot_cpu_data.type = CPU_SH5_101; 35 boot_cpu_data.type = CPU_SH5_101;
36 36
37 boot_cpu_data.family = CPU_FAMILY_SH5;
38
37 /* 39 /*
38 * First, setup some sane values for the I-cache. 40 * First, setup some sane values for the I-cache.
39 */ 41 */
diff --git a/arch/sh/kernel/cpu/shmobile/Makefile b/arch/sh/kernel/cpu/shmobile/Makefile
index 08bfa7c7db2..a39f88ea1a8 100644
--- a/arch/sh/kernel/cpu/shmobile/Makefile
+++ b/arch/sh/kernel/cpu/shmobile/Makefile
@@ -4,3 +4,5 @@
4 4
5# Power Management & Sleep mode 5# Power Management & Sleep mode
6obj-$(CONFIG_PM) += pm.o sleep.o 6obj-$(CONFIG_PM) += pm.o sleep.o
7obj-$(CONFIG_CPU_IDLE) += cpuidle.o
8obj-$(CONFIG_PM_RUNTIME) += pm_runtime.o
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c
new file mode 100644
index 00000000000..1c504bd972c
--- /dev/null
+++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c
@@ -0,0 +1,113 @@
1/*
2 * arch/sh/kernel/cpu/shmobile/cpuidle.c
3 *
4 * Cpuidle support code for SuperH Mobile
5 *
6 * Copyright (C) 2009 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <linux/suspend.h>
16#include <linux/cpuidle.h>
17#include <asm/suspend.h>
18#include <asm/uaccess.h>
19#include <asm/hwblk.h>
20
21static unsigned long cpuidle_mode[] = {
22 SUSP_SH_SLEEP, /* regular sleep mode */
23 SUSP_SH_SLEEP | SUSP_SH_SF, /* sleep mode + self refresh */
24 SUSP_SH_STANDBY | SUSP_SH_SF, /* software standby mode + self refresh */
25};
26
27static int cpuidle_sleep_enter(struct cpuidle_device *dev,
28 struct cpuidle_state *state)
29{
30 unsigned long allowed_mode = arch_hwblk_sleep_mode();
31 ktime_t before, after;
32 int requested_state = state - &dev->states[0];
33 int allowed_state;
34 int k;
35
36 /* convert allowed mode to allowed state */
37 for (k = ARRAY_SIZE(cpuidle_mode) - 1; k > 0; k--)
38 if (cpuidle_mode[k] == allowed_mode)
39 break;
40
41 allowed_state = k;
42
43 /* take the following into account for sleep mode selection:
44 * - allowed_state: best mode allowed by hardware (clock deps)
45 * - requested_state: best mode allowed by software (latencies)
46 */
47 k = min_t(int, allowed_state, requested_state);
48
49 dev->last_state = &dev->states[k];
50 before = ktime_get();
51 sh_mobile_call_standby(cpuidle_mode[k]);
52 after = ktime_get();
53 return ktime_to_ns(ktime_sub(after, before)) >> 10;
54}
55
56static struct cpuidle_device cpuidle_dev;
57static struct cpuidle_driver cpuidle_driver = {
58 .name = "sh_idle",
59 .owner = THIS_MODULE,
60};
61
62void sh_mobile_setup_cpuidle(void)
63{
64 struct cpuidle_device *dev = &cpuidle_dev;
65 struct cpuidle_state *state;
66 int i;
67
68 cpuidle_register_driver(&cpuidle_driver);
69
70 for (i = 0; i < CPUIDLE_STATE_MAX; i++) {
71 dev->states[i].name[0] = '\0';
72 dev->states[i].desc[0] = '\0';
73 }
74
75 i = CPUIDLE_DRIVER_STATE_START;
76
77 state = &dev->states[i++];
78 snprintf(state->name, CPUIDLE_NAME_LEN, "C0");
79 strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN);
80 state->exit_latency = 1;
81 state->target_residency = 1 * 2;
82 state->power_usage = 3;
83 state->flags = 0;
84 state->flags |= CPUIDLE_FLAG_SHALLOW;
85 state->flags |= CPUIDLE_FLAG_TIME_VALID;
86 state->enter = cpuidle_sleep_enter;
87
88 dev->safe_state = state;
89
90 state = &dev->states[i++];
91 snprintf(state->name, CPUIDLE_NAME_LEN, "C1");
92 strncpy(state->desc, "SuperH Sleep Mode [SF]", CPUIDLE_DESC_LEN);
93 state->exit_latency = 100;
94 state->target_residency = 1 * 2;
95 state->power_usage = 1;
96 state->flags = 0;
97 state->flags |= CPUIDLE_FLAG_TIME_VALID;
98 state->enter = cpuidle_sleep_enter;
99
100 state = &dev->states[i++];
101 snprintf(state->name, CPUIDLE_NAME_LEN, "C2");
102 strncpy(state->desc, "SuperH Mobile Standby Mode [SF]", CPUIDLE_DESC_LEN);
103 state->exit_latency = 2300;
104 state->target_residency = 1 * 2;
105 state->power_usage = 1;
106 state->flags = 0;
107 state->flags |= CPUIDLE_FLAG_TIME_VALID;
108 state->enter = cpuidle_sleep_enter;
109
110 dev->state_count = i;
111
112 cpuidle_register_device(dev);
113}
diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c
index 8c067adf683..ee3c2aaf66f 100644
--- a/arch/sh/kernel/cpu/shmobile/pm.c
+++ b/arch/sh/kernel/cpu/shmobile/pm.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/sh/kernel/cpu/sh4a/pm-sh_mobile.c 2 * arch/sh/kernel/cpu/shmobile/pm.c
3 * 3 *
4 * Power management support code for SuperH Mobile 4 * Power management support code for SuperH Mobile
5 * 5 *
@@ -32,40 +32,20 @@
32 * 32 *
33 * R-standby mode is unsupported, but will be added in the future 33 * R-standby mode is unsupported, but will be added in the future
34 * U-standby mode is low priority since it needs bootloader hacks 34 * U-standby mode is low priority since it needs bootloader hacks
35 *
36 * All modes should be tied in with cpuidle. But before that can
37 * happen we need to keep track of enabled hardware blocks so we
38 * can avoid entering sleep modes that stop clocks to hardware
39 * blocks that are in use even though the cpu core is idle.
40 */ 35 */
41 36
37#define ILRAM_BASE 0xe5200000
38
42extern const unsigned char sh_mobile_standby[]; 39extern const unsigned char sh_mobile_standby[];
43extern const unsigned int sh_mobile_standby_size; 40extern const unsigned int sh_mobile_standby_size;
44 41
45static void sh_mobile_call_standby(unsigned long mode) 42void sh_mobile_call_standby(unsigned long mode)
46{ 43{
47 extern void *vbr_base; 44 void *onchip_mem = (void *)ILRAM_BASE;
48 void *onchip_mem = (void *)0xe5200000; /* ILRAM */ 45 void (*standby_onchip_mem)(unsigned long, unsigned long) = onchip_mem;
49 void (*standby_onchip_mem)(unsigned long) = onchip_mem;
50
51 /* Note: Wake up from sleep may generate exceptions!
52 * Setup VBR to point to on-chip ram if self-refresh is
53 * going to be used.
54 */
55 if (mode & SUSP_SH_SF)
56 asm volatile("ldc %0, vbr" : : "r" (onchip_mem) : "memory");
57
58 /* Copy the assembly snippet to the otherwise ununsed ILRAM */
59 memcpy(onchip_mem, sh_mobile_standby, sh_mobile_standby_size);
60 wmb();
61 ctrl_barrier();
62 46
63 /* Let assembly snippet in on-chip memory handle the rest */ 47 /* Let assembly snippet in on-chip memory handle the rest */
64 standby_onchip_mem(mode); 48 standby_onchip_mem(mode, ILRAM_BASE);
65
66 /* Put VBR back in System RAM again */
67 if (mode & SUSP_SH_SF)
68 asm volatile("ldc %0, vbr" : : "r" (&vbr_base) : "memory");
69} 49}
70 50
71static int sh_pm_enter(suspend_state_t state) 51static int sh_pm_enter(suspend_state_t state)
@@ -85,7 +65,15 @@ static struct platform_suspend_ops sh_pm_ops = {
85 65
86static int __init sh_pm_init(void) 66static int __init sh_pm_init(void)
87{ 67{
68 void *onchip_mem = (void *)ILRAM_BASE;
69
70 /* Copy the assembly snippet to the otherwise ununsed ILRAM */
71 memcpy(onchip_mem, sh_mobile_standby, sh_mobile_standby_size);
72 wmb();
73 ctrl_barrier();
74
88 suspend_set_ops(&sh_pm_ops); 75 suspend_set_ops(&sh_pm_ops);
76 sh_mobile_setup_cpuidle();
89 return 0; 77 return 0;
90} 78}
91 79
diff --git a/arch/sh/kernel/cpu/shmobile/pm_runtime.c b/arch/sh/kernel/cpu/shmobile/pm_runtime.c
new file mode 100644
index 00000000000..7c615b17e20
--- /dev/null
+++ b/arch/sh/kernel/cpu/shmobile/pm_runtime.c
@@ -0,0 +1,303 @@
1/*
2 * arch/sh/kernel/cpu/shmobile/pm_runtime.c
3 *
4 * Runtime PM support code for SuperH Mobile
5 *
6 * Copyright (C) 2009 Magnus Damm
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/io.h>
15#include <linux/pm_runtime.h>
16#include <linux/platform_device.h>
17#include <linux/mutex.h>
18#include <asm/hwblk.h>
19
20static DEFINE_SPINLOCK(hwblk_lock);
21static LIST_HEAD(hwblk_idle_list);
22static struct work_struct hwblk_work;
23
24extern struct hwblk_info *hwblk_info;
25
26static void platform_pm_runtime_not_idle(struct platform_device *pdev)
27{
28 unsigned long flags;
29
30 /* remove device from idle list */
31 spin_lock_irqsave(&hwblk_lock, flags);
32 if (test_bit(PDEV_ARCHDATA_FLAG_IDLE, &pdev->archdata.flags)) {
33 list_del(&pdev->archdata.entry);
34 __clear_bit(PDEV_ARCHDATA_FLAG_IDLE, &pdev->archdata.flags);
35 }
36 spin_unlock_irqrestore(&hwblk_lock, flags);
37}
38
39static int __platform_pm_runtime_resume(struct platform_device *pdev)
40{
41 struct device *d = &pdev->dev;
42 struct pdev_archdata *ad = &pdev->archdata;
43 int hwblk = ad->hwblk_id;
44 int ret = -ENOSYS;
45
46 dev_dbg(d, "__platform_pm_runtime_resume() [%d]\n", hwblk);
47
48 if (d->driver && d->driver->pm && d->driver->pm->runtime_resume) {
49 hwblk_enable(hwblk_info, hwblk);
50 ret = 0;
51
52 if (test_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags)) {
53 ret = d->driver->pm->runtime_resume(d);
54 if (!ret)
55 clear_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
56 else
57 hwblk_disable(hwblk_info, hwblk);
58 }
59 }
60
61 dev_dbg(d, "__platform_pm_runtime_resume() [%d] - returns %d\n",
62 hwblk, ret);
63
64 return ret;
65}
66
67static int __platform_pm_runtime_suspend(struct platform_device *pdev)
68{
69 struct device *d = &pdev->dev;
70 struct pdev_archdata *ad = &pdev->archdata;
71 int hwblk = ad->hwblk_id;
72 int ret = -ENOSYS;
73
74 dev_dbg(d, "__platform_pm_runtime_suspend() [%d]\n", hwblk);
75
76 if (d->driver && d->driver->pm && d->driver->pm->runtime_suspend) {
77 BUG_ON(!test_bit(PDEV_ARCHDATA_FLAG_IDLE, &ad->flags));
78
79 hwblk_enable(hwblk_info, hwblk);
80 ret = d->driver->pm->runtime_suspend(d);
81 hwblk_disable(hwblk_info, hwblk);
82
83 if (!ret) {
84 set_bit(PDEV_ARCHDATA_FLAG_SUSP, &ad->flags);
85 platform_pm_runtime_not_idle(pdev);
86 hwblk_cnt_dec(hwblk_info, hwblk, HWBLK_CNT_IDLE);
87 }
88 }
89
90 dev_dbg(d, "__platform_pm_runtime_suspend() [%d] - returns %d\n",
91 hwblk, ret);
92
93 return ret;
94}
95
96static void platform_pm_runtime_work(struct work_struct *work)
97{
98 struct platform_device *pdev;
99 unsigned long flags;
100 int ret;
101
102 /* go through the idle list and suspend one device at a time */
103 do {
104 spin_lock_irqsave(&hwblk_lock, flags);
105 if (list_empty(&hwblk_idle_list))
106 pdev = NULL;
107 else
108 pdev = list_first_entry(&hwblk_idle_list,
109 struct platform_device,
110 archdata.entry);
111 spin_unlock_irqrestore(&hwblk_lock, flags);
112
113 if (pdev) {
114 mutex_lock(&pdev->archdata.mutex);
115 ret = __platform_pm_runtime_suspend(pdev);
116
117 /* at this point the platform device may be:
118 * suspended: ret = 0, FLAG_SUSP set, clock stopped
119 * failed: ret < 0, FLAG_IDLE set, clock stopped
120 */
121 mutex_unlock(&pdev->archdata.mutex);
122 } else {
123 ret = -ENODEV;
124 }
125 } while (!ret);
126}
127
128/* this function gets called from cpuidle context when all devices in the
129 * main power domain are unused but some are counted as idle, ie the hwblk
130 * counter values are (HWBLK_CNT_USAGE == 0) && (HWBLK_CNT_IDLE != 0)
131 */
132void platform_pm_runtime_suspend_idle(void)
133{
134 queue_work(pm_wq, &hwblk_work);
135}
136
137int platform_pm_runtime_suspend(struct device *dev)
138{
139 struct platform_device *pdev = to_platform_device(dev);
140 struct pdev_archdata *ad = &pdev->archdata;
141 unsigned long flags;
142 int hwblk = ad->hwblk_id;
143 int ret = 0;
144
145 dev_dbg(dev, "platform_pm_runtime_suspend() [%d]\n", hwblk);
146
147 /* ignore off-chip platform devices */
148 if (!hwblk)
149 goto out;
150
151 /* interrupt context not allowed */
152 might_sleep();
153
154 /* catch misconfigured drivers not starting with resume */
155 if (test_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags)) {
156 ret = -EINVAL;
157 goto out;
158 }
159
160 /* serialize */
161 mutex_lock(&ad->mutex);
162
163 /* disable clock */
164 hwblk_disable(hwblk_info, hwblk);
165
166 /* put device on idle list */
167 spin_lock_irqsave(&hwblk_lock, flags);
168 list_add_tail(&pdev->archdata.entry, &hwblk_idle_list);
169 __set_bit(PDEV_ARCHDATA_FLAG_IDLE, &pdev->archdata.flags);
170 spin_unlock_irqrestore(&hwblk_lock, flags);
171
172 /* increase idle count */
173 hwblk_cnt_inc(hwblk_info, hwblk, HWBLK_CNT_IDLE);
174
175 /* at this point the platform device is:
176 * idle: ret = 0, FLAG_IDLE set, clock stopped
177 */
178 mutex_unlock(&ad->mutex);
179
180out:
181 dev_dbg(dev, "platform_pm_runtime_suspend() [%d] returns %d\n",
182 hwblk, ret);
183
184 return ret;
185}
186
187int platform_pm_runtime_resume(struct device *dev)
188{
189 struct platform_device *pdev = to_platform_device(dev);
190 struct pdev_archdata *ad = &pdev->archdata;
191 int hwblk = ad->hwblk_id;
192 int ret = 0;
193
194 dev_dbg(dev, "platform_pm_runtime_resume() [%d]\n", hwblk);
195
196 /* ignore off-chip platform devices */
197 if (!hwblk)
198 goto out;
199
200 /* interrupt context not allowed */
201 might_sleep();
202
203 /* serialize */
204 mutex_lock(&ad->mutex);
205
206 /* make sure device is removed from idle list */
207 platform_pm_runtime_not_idle(pdev);
208
209 /* decrease idle count */
210 if (!test_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags) &&
211 !test_bit(PDEV_ARCHDATA_FLAG_SUSP, &pdev->archdata.flags))
212 hwblk_cnt_dec(hwblk_info, hwblk, HWBLK_CNT_IDLE);
213
214 /* resume the device if needed */
215 ret = __platform_pm_runtime_resume(pdev);
216
217 /* the driver has been initialized now, so clear the init flag */
218 clear_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags);
219
220 /* at this point the platform device may be:
221 * resumed: ret = 0, flags = 0, clock started
222 * failed: ret < 0, FLAG_SUSP set, clock stopped
223 */
224 mutex_unlock(&ad->mutex);
225out:
226 dev_dbg(dev, "platform_pm_runtime_resume() [%d] returns %d\n",
227 hwblk, ret);
228
229 return ret;
230}
231
232int platform_pm_runtime_idle(struct device *dev)
233{
234 struct platform_device *pdev = to_platform_device(dev);
235 int hwblk = pdev->archdata.hwblk_id;
236 int ret = 0;
237
238 dev_dbg(dev, "platform_pm_runtime_idle() [%d]\n", hwblk);
239
240 /* ignore off-chip platform devices */
241 if (!hwblk)
242 goto out;
243
244 /* interrupt context not allowed, use pm_runtime_put()! */
245 might_sleep();
246
247 /* suspend synchronously to disable clocks immediately */
248 ret = pm_runtime_suspend(dev);
249out:
250 dev_dbg(dev, "platform_pm_runtime_idle() [%d] done!\n", hwblk);
251 return ret;
252}
253
254static int platform_bus_notify(struct notifier_block *nb,
255 unsigned long action, void *data)
256{
257 struct device *dev = data;
258 struct platform_device *pdev = to_platform_device(dev);
259 int hwblk = pdev->archdata.hwblk_id;
260
261 /* ignore off-chip platform devices */
262 if (!hwblk)
263 return 0;
264
265 switch (action) {
266 case BUS_NOTIFY_ADD_DEVICE:
267 INIT_LIST_HEAD(&pdev->archdata.entry);
268 mutex_init(&pdev->archdata.mutex);
269 /* platform devices without drivers should be disabled */
270 hwblk_enable(hwblk_info, hwblk);
271 hwblk_disable(hwblk_info, hwblk);
272 /* make sure driver re-inits itself once */
273 __set_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags);
274 break;
275 /* TODO: add BUS_NOTIFY_BIND_DRIVER and increase idle count */
276 case BUS_NOTIFY_BOUND_DRIVER:
277 /* keep track of number of devices in use per hwblk */
278 hwblk_cnt_inc(hwblk_info, hwblk, HWBLK_CNT_DEVICES);
279 break;
280 case BUS_NOTIFY_UNBOUND_DRIVER:
281 /* keep track of number of devices in use per hwblk */
282 hwblk_cnt_dec(hwblk_info, hwblk, HWBLK_CNT_DEVICES);
283 /* make sure driver re-inits itself once */
284 __set_bit(PDEV_ARCHDATA_FLAG_INIT, &pdev->archdata.flags);
285 break;
286 case BUS_NOTIFY_DEL_DEVICE:
287 break;
288 }
289 return 0;
290}
291
292static struct notifier_block platform_bus_notifier = {
293 .notifier_call = platform_bus_notify
294};
295
296static int __init sh_pm_runtime_init(void)
297{
298 INIT_WORK(&hwblk_work, platform_pm_runtime_work);
299
300 bus_register_notifier(&platform_bus_type, &platform_bus_notifier);
301 return 0;
302}
303core_initcall(sh_pm_runtime_init);
diff --git a/arch/sh/kernel/cpu/shmobile/sleep.S b/arch/sh/kernel/cpu/shmobile/sleep.S
index baf2d7d46b0..a439e6c7824 100644
--- a/arch/sh/kernel/cpu/shmobile/sleep.S
+++ b/arch/sh/kernel/cpu/shmobile/sleep.S
@@ -16,19 +16,52 @@
16#include <asm/asm-offsets.h> 16#include <asm/asm-offsets.h>
17#include <asm/suspend.h> 17#include <asm/suspend.h>
18 18
19/*
20 * Kernel mode register usage, see entry.S:
21 * k0 scratch
22 * k1 scratch
23 * k4 scratch
24 */
25#define k0 r0
26#define k1 r1
27#define k4 r4
28
19/* manage self-refresh and enter standby mode. 29/* manage self-refresh and enter standby mode.
20 * this code will be copied to on-chip memory and executed from there. 30 * this code will be copied to on-chip memory and executed from there.
21 */ 31 */
22 32
23 .balign 4096,0,4096 33 .balign 4096,0,4096
24ENTRY(sh_mobile_standby) 34ENTRY(sh_mobile_standby)
35
36 /* save original vbr */
37 stc vbr, r1
38 mova saved_vbr, r0
39 mov.l r1, @r0
40
41 /* point vbr to our on-chip memory page */
42 ldc r5, vbr
43
44 /* save return address */
45 mova saved_spc, r0
46 sts pr, r5
47 mov.l r5, @r0
48
49 /* save sr */
50 mova saved_sr, r0
51 stc sr, r5
52 mov.l r5, @r0
53
54 /* save mode flags */
55 mova saved_mode, r0
56 mov.l r4, @r0
57
58 /* put mode flags in r0 */
25 mov r4, r0 59 mov r4, r0
26 60
27 tst #SUSP_SH_SF, r0 61 tst #SUSP_SH_SF, r0
28 bt skip_set_sf 62 bt skip_set_sf
29#ifdef CONFIG_CPU_SUBTYPE_SH7724 63#ifdef CONFIG_CPU_SUBTYPE_SH7724
30 /* DBSC: put memory in self-refresh mode */ 64 /* DBSC: put memory in self-refresh mode */
31
32 mov.l dben_reg, r4 65 mov.l dben_reg, r4
33 mov.l dben_data0, r1 66 mov.l dben_data0, r1
34 mov.l r1, @r4 67 mov.l r1, @r4
@@ -60,14 +93,6 @@ ENTRY(sh_mobile_standby)
60#endif 93#endif
61 94
62skip_set_sf: 95skip_set_sf:
63 tst #SUSP_SH_SLEEP, r0
64 bt test_standby
65
66 /* set mode to "sleep mode" */
67 bra do_sleep
68 mov #0x00, r1
69
70test_standby:
71 tst #SUSP_SH_STANDBY, r0 96 tst #SUSP_SH_STANDBY, r0
72 bt test_rstandby 97 bt test_rstandby
73 98
@@ -85,77 +110,107 @@ test_rstandby:
85 110
86test_ustandby: 111test_ustandby:
87 tst #SUSP_SH_USTANDBY, r0 112 tst #SUSP_SH_USTANDBY, r0
88 bt done_sleep 113 bt force_sleep
89 114
90 /* set mode to "u-standby mode" */ 115 /* set mode to "u-standby mode" */
91 mov #0x10, r1 116 bra do_sleep
117 mov #0x10, r1
92 118
93 /* fall-through */ 119force_sleep:
120
121 /* set mode to "sleep mode" */
122 mov #0x00, r1
94 123
95do_sleep: 124do_sleep:
96 /* setup and enter selected standby mode */ 125 /* setup and enter selected standby mode */
97 mov.l 5f, r4 126 mov.l 5f, r4
98 mov.l r1, @r4 127 mov.l r1, @r4
128again:
99 sleep 129 sleep
130 bra again
131 nop
132
133restore_jump_vbr:
134 /* setup spc with return address to c code */
135 mov.l saved_spc, k0
136 ldc k0, spc
137
138 /* restore vbr */
139 mov.l saved_vbr, k0
140 ldc k0, vbr
141
142 /* setup ssr with saved sr */
143 mov.l saved_sr, k0
144 ldc k0, ssr
145
146 /* get mode flags */
147 mov.l saved_mode, k0
100 148
101done_sleep: 149done_sleep:
102 /* reset standby mode to sleep mode */ 150 /* reset standby mode to sleep mode */
103 mov.l 5f, r4 151 mov.l 5f, k4
104 mov #0x00, r1 152 mov #0x00, k1
105 mov.l r1, @r4 153 mov.l k1, @k4
106 154
107 tst #SUSP_SH_SF, r0 155 tst #SUSP_SH_SF, k0
108 bt skip_restore_sf 156 bt skip_restore_sf
109 157
110#ifdef CONFIG_CPU_SUBTYPE_SH7724 158#ifdef CONFIG_CPU_SUBTYPE_SH7724
111 /* DBSC: put memory in auto-refresh mode */ 159 /* DBSC: put memory in auto-refresh mode */
160 mov.l dbrfpdn0_reg, k4
161 mov.l dbrfpdn0_data0, k1
162 mov.l k1, @k4
112 163
113 mov.l dbrfpdn0_reg, r4 164 nop /* sleep 140 ns */
114 mov.l dbrfpdn0_data0, r1
115 mov.l r1, @r4
116
117 /* sleep 140 ns */
118 nop
119 nop 165 nop
120 nop 166 nop
121 nop 167 nop
122 168
123 mov.l dbcmdcnt_reg, r4 169 mov.l dbcmdcnt_reg, k4
124 mov.l dbcmdcnt_data0, r1 170 mov.l dbcmdcnt_data0, k1
125 mov.l r1, @r4 171 mov.l k1, @k4
126 172
127 mov.l dbcmdcnt_reg, r4 173 mov.l dbcmdcnt_reg, k4
128 mov.l dbcmdcnt_data1, r1 174 mov.l dbcmdcnt_data1, k1
129 mov.l r1, @r4 175 mov.l k1, @k4
130 176
131 mov.l dben_reg, r4 177 mov.l dben_reg, k4
132 mov.l dben_data1, r1 178 mov.l dben_data1, k1
133 mov.l r1, @r4 179 mov.l k1, @k4
134 180
135 mov.l dbrfpdn0_reg, r4 181 mov.l dbrfpdn0_reg, k4
136 mov.l dbrfpdn0_data2, r1 182 mov.l dbrfpdn0_data2, k1
137 mov.l r1, @r4 183 mov.l k1, @k4
138#else 184#else
139 /* SBSC: set auto-refresh mode */ 185 /* SBSC: set auto-refresh mode */
140 mov.l 1f, r4 186 mov.l 1f, k4
141 mov.l @r4, r2 187 mov.l @k4, k0
142 mov.l 4f, r3 188 mov.l 4f, k1
143 and r3, r2 189 and k1, k0
144 mov.l r2, @r4 190 mov.l k0, @k4
145 mov.l 6f, r4 191 mov.l 6f, k4
146 mov.l 7f, r1 192 mov.l 8f, k0
147 mov.l 8f, r2 193 mov.l @k4, k1
148 mov.l @r4, r3 194 mov #-1, k4
149 mov #-1, r4 195 add k4, k1
150 add r4, r3 196 or k1, k0
151 or r2, r3 197 mov.l 7f, k1
152 mov.l r3, @r1 198 mov.l k0, @k1
153#endif 199#endif
154skip_restore_sf: 200skip_restore_sf:
155 rts 201 /* jump to vbr vector */
202 mov.l saved_vbr, k0
203 mov.l offset_vbr, k4
204 add k4, k0
205 jmp @k0
156 nop 206 nop
157 207
158 .balign 4 208 .balign 4
209saved_mode: .long 0
210saved_spc: .long 0
211saved_sr: .long 0
212saved_vbr: .long 0
213offset_vbr: .long 0x600
159#ifdef CONFIG_CPU_SUBTYPE_SH7724 214#ifdef CONFIG_CPU_SUBTYPE_SH7724
160dben_reg: .long 0xfd000010 /* DBEN */ 215dben_reg: .long 0xfd000010 /* DBEN */
161dben_data0: .long 0 216dben_data0: .long 0
@@ -178,12 +233,12 @@ dbcmdcnt_data1: .long 4
1787: .long 0xfe400018 /* RTCNT */ 2337: .long 0xfe400018 /* RTCNT */
1798: .long 0xa55a0000 2348: .long 0xa55a0000
180 235
236
181/* interrupt vector @ 0x600 */ 237/* interrupt vector @ 0x600 */
182 .balign 0x400,0,0x400 238 .balign 0x400,0,0x400
183 .long 0xdeadbeef 239 .long 0xdeadbeef
184 .balign 0x200,0,0x200 240 .balign 0x200,0,0x200
185 /* sh7722 will end up here in sleep mode */ 241 bra restore_jump_vbr
186 rte
187 nop 242 nop
188sh_mobile_standby_end: 243sh_mobile_standby_end:
189 244
diff --git a/arch/sh/kernel/cpufreq.c b/arch/sh/kernel/cpufreq.c
index e0590ffebd7..dce4f3ff093 100644
--- a/arch/sh/kernel/cpufreq.c
+++ b/arch/sh/kernel/cpufreq.c
@@ -82,7 +82,8 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
82 82
83 cpuclk = clk_get(NULL, "cpu_clk"); 83 cpuclk = clk_get(NULL, "cpu_clk");
84 if (IS_ERR(cpuclk)) { 84 if (IS_ERR(cpuclk)) {
85 printk(KERN_ERR "cpufreq: couldn't get CPU clk\n"); 85 printk(KERN_ERR "cpufreq: couldn't get CPU#%d clk\n",
86 policy->cpu);
86 return PTR_ERR(cpuclk); 87 return PTR_ERR(cpuclk);
87 } 88 }
88 89
@@ -95,22 +96,21 @@ static int sh_cpufreq_cpu_init(struct cpufreq_policy *policy)
95 policy->min = policy->cpuinfo.min_freq; 96 policy->min = policy->cpuinfo.min_freq;
96 policy->max = policy->cpuinfo.max_freq; 97 policy->max = policy->cpuinfo.max_freq;
97 98
98
99 /* 99 /*
100 * Catch the cases where the clock framework hasn't been wired up 100 * Catch the cases where the clock framework hasn't been wired up
101 * properly to support scaling. 101 * properly to support scaling.
102 */ 102 */
103 if (unlikely(policy->min == policy->max)) { 103 if (unlikely(policy->min == policy->max)) {
104 printk(KERN_ERR "cpufreq: clock framework rate rounding " 104 printk(KERN_ERR "cpufreq: clock framework rate rounding "
105 "not supported on this CPU.\n"); 105 "not supported on CPU#%d.\n", policy->cpu);
106 106
107 clk_put(cpuclk); 107 clk_put(cpuclk);
108 return -EINVAL; 108 return -EINVAL;
109 } 109 }
110 110
111 printk(KERN_INFO "cpufreq: Frequencies - Minimum %u.%03u MHz, " 111 printk(KERN_INFO "cpufreq: CPU#%d Frequencies - Minimum %u.%03u MHz, "
112 "Maximum %u.%03u MHz.\n", 112 "Maximum %u.%03u MHz.\n",
113 policy->min / 1000, policy->min % 1000, 113 policy->cpu, policy->min / 1000, policy->min % 1000,
114 policy->max / 1000, policy->max % 1000); 114 policy->max / 1000, policy->max % 1000);
115 115
116 return 0; 116 return 0;
diff --git a/arch/sh/kernel/dumpstack.c b/arch/sh/kernel/dumpstack.c
new file mode 100644
index 00000000000..6f5ad151340
--- /dev/null
+++ b/arch/sh/kernel/dumpstack.c
@@ -0,0 +1,123 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 * Copyright (C) 2009 Matt Fleming
5 */
6#include <linux/kallsyms.h>
7#include <linux/ftrace.h>
8#include <linux/debug_locks.h>
9#include <asm/unwinder.h>
10#include <asm/stacktrace.h>
11
12void printk_address(unsigned long address, int reliable)
13{
14 printk(" [<%p>] %s%pS\n", (void *) address,
15 reliable ? "" : "? ", (void *) address);
16}
17
18#ifdef CONFIG_FUNCTION_GRAPH_TRACER
19static void
20print_ftrace_graph_addr(unsigned long addr, void *data,
21 const struct stacktrace_ops *ops,
22 struct thread_info *tinfo, int *graph)
23{
24 struct task_struct *task = tinfo->task;
25 unsigned long ret_addr;
26 int index = task->curr_ret_stack;
27
28 if (addr != (unsigned long)return_to_handler)
29 return;
30
31 if (!task->ret_stack || index < *graph)
32 return;
33
34 index -= *graph;
35 ret_addr = task->ret_stack[index].ret;
36
37 ops->address(data, ret_addr, 1);
38
39 (*graph)++;
40}
41#else
42static inline void
43print_ftrace_graph_addr(unsigned long addr, void *data,
44 const struct stacktrace_ops *ops,
45 struct thread_info *tinfo, int *graph)
46{ }
47#endif
48
49void
50stack_reader_dump(struct task_struct *task, struct pt_regs *regs,
51 unsigned long *sp, const struct stacktrace_ops *ops,
52 void *data)
53{
54 struct thread_info *context;
55 int graph = 0;
56
57 context = (struct thread_info *)
58 ((unsigned long)sp & (~(THREAD_SIZE - 1)));
59
60 while (!kstack_end(sp)) {
61 unsigned long addr = *sp++;
62
63 if (__kernel_text_address(addr)) {
64 ops->address(data, addr, 1);
65
66 print_ftrace_graph_addr(addr, data, ops,
67 context, &graph);
68 }
69 }
70}
71
72static void
73print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
74{
75 printk(data);
76 print_symbol(msg, symbol);
77 printk("\n");
78}
79
80static void print_trace_warning(void *data, char *msg)
81{
82 printk("%s%s\n", (char *)data, msg);
83}
84
85static int print_trace_stack(void *data, char *name)
86{
87 printk("%s <%s> ", (char *)data, name);
88 return 0;
89}
90
91/*
92 * Print one address/symbol entries per line.
93 */
94static void print_trace_address(void *data, unsigned long addr, int reliable)
95{
96 printk(data);
97 printk_address(addr, reliable);
98}
99
100static const struct stacktrace_ops print_trace_ops = {
101 .warning = print_trace_warning,
102 .warning_symbol = print_trace_warning_symbol,
103 .stack = print_trace_stack,
104 .address = print_trace_address,
105};
106
107void show_trace(struct task_struct *tsk, unsigned long *sp,
108 struct pt_regs *regs)
109{
110 if (regs && user_mode(regs))
111 return;
112
113 printk("\nCall trace:\n");
114
115 unwind_stack(tsk, regs, sp, &print_trace_ops, "");
116
117 printk("\n");
118
119 if (!tsk)
120 tsk = current;
121
122 debug_show_held_locks(tsk);
123}
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
new file mode 100644
index 00000000000..bc4d8d75332
--- /dev/null
+++ b/arch/sh/kernel/dwarf.c
@@ -0,0 +1,972 @@
1/*
2 * Copyright (C) 2009 Matt Fleming <matt@console-pimps.org>
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive
6 * for more details.
7 *
8 * This is an implementation of a DWARF unwinder. Its main purpose is
9 * for generating stacktrace information. Based on the DWARF 3
10 * specification from http://www.dwarfstd.org.
11 *
12 * TODO:
13 * - DWARF64 doesn't work.
14 * - Registers with DWARF_VAL_OFFSET rules aren't handled properly.
15 */
16
17/* #define DEBUG */
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/list.h>
21#include <linux/mempool.h>
22#include <linux/mm.h>
23#include <asm/dwarf.h>
24#include <asm/unwinder.h>
25#include <asm/sections.h>
26#include <asm/unaligned.h>
27#include <asm/dwarf.h>
28#include <asm/stacktrace.h>
29
30/* Reserve enough memory for two stack frames */
31#define DWARF_FRAME_MIN_REQ 2
32/* ... with 4 registers per frame. */
33#define DWARF_REG_MIN_REQ (DWARF_FRAME_MIN_REQ * 4)
34
35static struct kmem_cache *dwarf_frame_cachep;
36static mempool_t *dwarf_frame_pool;
37
38static struct kmem_cache *dwarf_reg_cachep;
39static mempool_t *dwarf_reg_pool;
40
41static LIST_HEAD(dwarf_cie_list);
42static DEFINE_SPINLOCK(dwarf_cie_lock);
43
44static LIST_HEAD(dwarf_fde_list);
45static DEFINE_SPINLOCK(dwarf_fde_lock);
46
47static struct dwarf_cie *cached_cie;
48
49/**
50 * dwarf_frame_alloc_reg - allocate memory for a DWARF register
51 * @frame: the DWARF frame whose list of registers we insert on
52 * @reg_num: the register number
53 *
54 * Allocate space for, and initialise, a dwarf reg from
55 * dwarf_reg_pool and insert it onto the (unsorted) linked-list of
56 * dwarf registers for @frame.
57 *
58 * Return the initialised DWARF reg.
59 */
60static struct dwarf_reg *dwarf_frame_alloc_reg(struct dwarf_frame *frame,
61 unsigned int reg_num)
62{
63 struct dwarf_reg *reg;
64
65 reg = mempool_alloc(dwarf_reg_pool, GFP_ATOMIC);
66 if (!reg) {
67 printk(KERN_WARNING "Unable to allocate a DWARF register\n");
68 /*
69 * Let's just bomb hard here, we have no way to
70 * gracefully recover.
71 */
72 UNWINDER_BUG();
73 }
74
75 reg->number = reg_num;
76 reg->addr = 0;
77 reg->flags = 0;
78
79 list_add(&reg->link, &frame->reg_list);
80
81 return reg;
82}
83
84static void dwarf_frame_free_regs(struct dwarf_frame *frame)
85{
86 struct dwarf_reg *reg, *n;
87
88 list_for_each_entry_safe(reg, n, &frame->reg_list, link) {
89 list_del(&reg->link);
90 mempool_free(reg, dwarf_reg_pool);
91 }
92}
93
94/**
95 * dwarf_frame_reg - return a DWARF register
96 * @frame: the DWARF frame to search in for @reg_num
97 * @reg_num: the register number to search for
98 *
99 * Lookup and return the dwarf reg @reg_num for this frame. Return
100 * NULL if @reg_num is an register invalid number.
101 */
102static struct dwarf_reg *dwarf_frame_reg(struct dwarf_frame *frame,
103 unsigned int reg_num)
104{
105 struct dwarf_reg *reg;
106
107 list_for_each_entry(reg, &frame->reg_list, link) {
108 if (reg->number == reg_num)
109 return reg;
110 }
111
112 return NULL;
113}
114
115/**
116 * dwarf_read_addr - read dwarf data
117 * @src: source address of data
118 * @dst: destination address to store the data to
119 *
120 * Read 'n' bytes from @src, where 'n' is the size of an address on
121 * the native machine. We return the number of bytes read, which
122 * should always be 'n'. We also have to be careful when reading
123 * from @src and writing to @dst, because they can be arbitrarily
124 * aligned. Return 'n' - the number of bytes read.
125 */
126static inline int dwarf_read_addr(unsigned long *src, unsigned long *dst)
127{
128 u32 val = get_unaligned(src);
129 put_unaligned(val, dst);
130 return sizeof(unsigned long *);
131}
132
133/**
134 * dwarf_read_uleb128 - read unsigned LEB128 data
135 * @addr: the address where the ULEB128 data is stored
136 * @ret: address to store the result
137 *
138 * Decode an unsigned LEB128 encoded datum. The algorithm is taken
139 * from Appendix C of the DWARF 3 spec. For information on the
140 * encodings refer to section "7.6 - Variable Length Data". Return
141 * the number of bytes read.
142 */
143static inline unsigned long dwarf_read_uleb128(char *addr, unsigned int *ret)
144{
145 unsigned int result;
146 unsigned char byte;
147 int shift, count;
148
149 result = 0;
150 shift = 0;
151 count = 0;
152
153 while (1) {
154 byte = __raw_readb(addr);
155 addr++;
156 count++;
157
158 result |= (byte & 0x7f) << shift;
159 shift += 7;
160
161 if (!(byte & 0x80))
162 break;
163 }
164
165 *ret = result;
166
167 return count;
168}
169
170/**
171 * dwarf_read_leb128 - read signed LEB128 data
172 * @addr: the address of the LEB128 encoded data
173 * @ret: address to store the result
174 *
175 * Decode signed LEB128 data. The algorithm is taken from Appendix
176 * C of the DWARF 3 spec. Return the number of bytes read.
177 */
178static inline unsigned long dwarf_read_leb128(char *addr, int *ret)
179{
180 unsigned char byte;
181 int result, shift;
182 int num_bits;
183 int count;
184
185 result = 0;
186 shift = 0;
187 count = 0;
188
189 while (1) {
190 byte = __raw_readb(addr);
191 addr++;
192 result |= (byte & 0x7f) << shift;
193 shift += 7;
194 count++;
195
196 if (!(byte & 0x80))
197 break;
198 }
199
200 /* The number of bits in a signed integer. */
201 num_bits = 8 * sizeof(result);
202
203 if ((shift < num_bits) && (byte & 0x40))
204 result |= (-1 << shift);
205
206 *ret = result;
207
208 return count;
209}
210
211/**
212 * dwarf_read_encoded_value - return the decoded value at @addr
213 * @addr: the address of the encoded value
214 * @val: where to write the decoded value
215 * @encoding: the encoding with which we can decode @addr
216 *
217 * GCC emits encoded address in the .eh_frame FDE entries. Decode
218 * the value at @addr using @encoding. The decoded value is written
219 * to @val and the number of bytes read is returned.
220 */
221static int dwarf_read_encoded_value(char *addr, unsigned long *val,
222 char encoding)
223{
224 unsigned long decoded_addr = 0;
225 int count = 0;
226
227 switch (encoding & 0x70) {
228 case DW_EH_PE_absptr:
229 break;
230 case DW_EH_PE_pcrel:
231 decoded_addr = (unsigned long)addr;
232 break;
233 default:
234 pr_debug("encoding=0x%x\n", (encoding & 0x70));
235 UNWINDER_BUG();
236 }
237
238 if ((encoding & 0x07) == 0x00)
239 encoding |= DW_EH_PE_udata4;
240
241 switch (encoding & 0x0f) {
242 case DW_EH_PE_sdata4:
243 case DW_EH_PE_udata4:
244 count += 4;
245 decoded_addr += get_unaligned((u32 *)addr);
246 __raw_writel(decoded_addr, val);
247 break;
248 default:
249 pr_debug("encoding=0x%x\n", encoding);
250 UNWINDER_BUG();
251 }
252
253 return count;
254}
255
256/**
257 * dwarf_entry_len - return the length of an FDE or CIE
258 * @addr: the address of the entry
259 * @len: the length of the entry
260 *
261 * Read the initial_length field of the entry and store the size of
262 * the entry in @len. We return the number of bytes read. Return a
263 * count of 0 on error.
264 */
265static inline int dwarf_entry_len(char *addr, unsigned long *len)
266{
267 u32 initial_len;
268 int count;
269
270 initial_len = get_unaligned((u32 *)addr);
271 count = 4;
272
273 /*
274 * An initial length field value in the range DW_LEN_EXT_LO -
275 * DW_LEN_EXT_HI indicates an extension, and should not be
276 * interpreted as a length. The only extension that we currently
277 * understand is the use of DWARF64 addresses.
278 */
279 if (initial_len >= DW_EXT_LO && initial_len <= DW_EXT_HI) {
280 /*
281 * The 64-bit length field immediately follows the
282 * compulsory 32-bit length field.
283 */
284 if (initial_len == DW_EXT_DWARF64) {
285 *len = get_unaligned((u64 *)addr + 4);
286 count = 12;
287 } else {
288 printk(KERN_WARNING "Unknown DWARF extension\n");
289 count = 0;
290 }
291 } else
292 *len = initial_len;
293
294 return count;
295}
296
297/**
298 * dwarf_lookup_cie - locate the cie
299 * @cie_ptr: pointer to help with lookup
300 */
301static struct dwarf_cie *dwarf_lookup_cie(unsigned long cie_ptr)
302{
303 struct dwarf_cie *cie;
304 unsigned long flags;
305
306 spin_lock_irqsave(&dwarf_cie_lock, flags);
307
308 /*
309 * We've cached the last CIE we looked up because chances are
310 * that the FDE wants this CIE.
311 */
312 if (cached_cie && cached_cie->cie_pointer == cie_ptr) {
313 cie = cached_cie;
314 goto out;
315 }
316
317 list_for_each_entry(cie, &dwarf_cie_list, link) {
318 if (cie->cie_pointer == cie_ptr) {
319 cached_cie = cie;
320 break;
321 }
322 }
323
324 /* Couldn't find the entry in the list. */
325 if (&cie->link == &dwarf_cie_list)
326 cie = NULL;
327out:
328 spin_unlock_irqrestore(&dwarf_cie_lock, flags);
329 return cie;
330}
331
332/**
333 * dwarf_lookup_fde - locate the FDE that covers pc
334 * @pc: the program counter
335 */
336struct dwarf_fde *dwarf_lookup_fde(unsigned long pc)
337{
338 struct dwarf_fde *fde;
339 unsigned long flags;
340
341 spin_lock_irqsave(&dwarf_fde_lock, flags);
342
343 list_for_each_entry(fde, &dwarf_fde_list, link) {
344 unsigned long start, end;
345
346 start = fde->initial_location;
347 end = fde->initial_location + fde->address_range;
348
349 if (pc >= start && pc < end)
350 break;
351 }
352
353 /* Couldn't find the entry in the list. */
354 if (&fde->link == &dwarf_fde_list)
355 fde = NULL;
356
357 spin_unlock_irqrestore(&dwarf_fde_lock, flags);
358
359 return fde;
360}
361
362/**
363 * dwarf_cfa_execute_insns - execute instructions to calculate a CFA
364 * @insn_start: address of the first instruction
365 * @insn_end: address of the last instruction
366 * @cie: the CIE for this function
367 * @fde: the FDE for this function
368 * @frame: the instructions calculate the CFA for this frame
369 * @pc: the program counter of the address we're interested in
370 *
371 * Execute the Call Frame instruction sequence starting at
372 * @insn_start and ending at @insn_end. The instructions describe
373 * how to calculate the Canonical Frame Address of a stackframe.
374 * Store the results in @frame.
375 */
376static int dwarf_cfa_execute_insns(unsigned char *insn_start,
377 unsigned char *insn_end,
378 struct dwarf_cie *cie,
379 struct dwarf_fde *fde,
380 struct dwarf_frame *frame,
381 unsigned long pc)
382{
383 unsigned char insn;
384 unsigned char *current_insn;
385 unsigned int count, delta, reg, expr_len, offset;
386 struct dwarf_reg *regp;
387
388 current_insn = insn_start;
389
390 while (current_insn < insn_end && frame->pc <= pc) {
391 insn = __raw_readb(current_insn++);
392
393 /*
394 * Firstly, handle the opcodes that embed their operands
395 * in the instructions.
396 */
397 switch (DW_CFA_opcode(insn)) {
398 case DW_CFA_advance_loc:
399 delta = DW_CFA_operand(insn);
400 delta *= cie->code_alignment_factor;
401 frame->pc += delta;
402 continue;
403 /* NOTREACHED */
404 case DW_CFA_offset:
405 reg = DW_CFA_operand(insn);
406 count = dwarf_read_uleb128(current_insn, &offset);
407 current_insn += count;
408 offset *= cie->data_alignment_factor;
409 regp = dwarf_frame_alloc_reg(frame, reg);
410 regp->addr = offset;
411 regp->flags |= DWARF_REG_OFFSET;
412 continue;
413 /* NOTREACHED */
414 case DW_CFA_restore:
415 reg = DW_CFA_operand(insn);
416 continue;
417 /* NOTREACHED */
418 }
419
420 /*
421 * Secondly, handle the opcodes that don't embed their
422 * operands in the instruction.
423 */
424 switch (insn) {
425 case DW_CFA_nop:
426 continue;
427 case DW_CFA_advance_loc1:
428 delta = *current_insn++;
429 frame->pc += delta * cie->code_alignment_factor;
430 break;
431 case DW_CFA_advance_loc2:
432 delta = get_unaligned((u16 *)current_insn);
433 current_insn += 2;
434 frame->pc += delta * cie->code_alignment_factor;
435 break;
436 case DW_CFA_advance_loc4:
437 delta = get_unaligned((u32 *)current_insn);
438 current_insn += 4;
439 frame->pc += delta * cie->code_alignment_factor;
440 break;
441 case DW_CFA_offset_extended:
442 count = dwarf_read_uleb128(current_insn, &reg);
443 current_insn += count;
444 count = dwarf_read_uleb128(current_insn, &offset);
445 current_insn += count;
446 offset *= cie->data_alignment_factor;
447 break;
448 case DW_CFA_restore_extended:
449 count = dwarf_read_uleb128(current_insn, &reg);
450 current_insn += count;
451 break;
452 case DW_CFA_undefined:
453 count = dwarf_read_uleb128(current_insn, &reg);
454 current_insn += count;
455 regp = dwarf_frame_alloc_reg(frame, reg);
456 regp->flags |= DWARF_UNDEFINED;
457 break;
458 case DW_CFA_def_cfa:
459 count = dwarf_read_uleb128(current_insn,
460 &frame->cfa_register);
461 current_insn += count;
462 count = dwarf_read_uleb128(current_insn,
463 &frame->cfa_offset);
464 current_insn += count;
465
466 frame->flags |= DWARF_FRAME_CFA_REG_OFFSET;
467 break;
468 case DW_CFA_def_cfa_register:
469 count = dwarf_read_uleb128(current_insn,
470 &frame->cfa_register);
471 current_insn += count;
472 frame->flags |= DWARF_FRAME_CFA_REG_OFFSET;
473 break;
474 case DW_CFA_def_cfa_offset:
475 count = dwarf_read_uleb128(current_insn, &offset);
476 current_insn += count;
477 frame->cfa_offset = offset;
478 break;
479 case DW_CFA_def_cfa_expression:
480 count = dwarf_read_uleb128(current_insn, &expr_len);
481 current_insn += count;
482
483 frame->cfa_expr = current_insn;
484 frame->cfa_expr_len = expr_len;
485 current_insn += expr_len;
486
487 frame->flags |= DWARF_FRAME_CFA_REG_EXP;
488 break;
489 case DW_CFA_offset_extended_sf:
490 count = dwarf_read_uleb128(current_insn, &reg);
491 current_insn += count;
492 count = dwarf_read_leb128(current_insn, &offset);
493 current_insn += count;
494 offset *= cie->data_alignment_factor;
495 regp = dwarf_frame_alloc_reg(frame, reg);
496 regp->flags |= DWARF_REG_OFFSET;
497 regp->addr = offset;
498 break;
499 case DW_CFA_val_offset:
500 count = dwarf_read_uleb128(current_insn, &reg);
501 current_insn += count;
502 count = dwarf_read_leb128(current_insn, &offset);
503 offset *= cie->data_alignment_factor;
504 regp = dwarf_frame_alloc_reg(frame, reg);
505 regp->flags |= DWARF_VAL_OFFSET;
506 regp->addr = offset;
507 break;
508 case DW_CFA_GNU_args_size:
509 count = dwarf_read_uleb128(current_insn, &offset);
510 current_insn += count;
511 break;
512 case DW_CFA_GNU_negative_offset_extended:
513 count = dwarf_read_uleb128(current_insn, &reg);
514 current_insn += count;
515 count = dwarf_read_uleb128(current_insn, &offset);
516 offset *= cie->data_alignment_factor;
517
518 regp = dwarf_frame_alloc_reg(frame, reg);
519 regp->flags |= DWARF_REG_OFFSET;
520 regp->addr = -offset;
521 break;
522 default:
523 pr_debug("unhandled DWARF instruction 0x%x\n", insn);
524 UNWINDER_BUG();
525 break;
526 }
527 }
528
529 return 0;
530}
531
532/**
533 * dwarf_unwind_stack - recursively unwind the stack
534 * @pc: address of the function to unwind
535 * @prev: struct dwarf_frame of the previous stackframe on the callstack
536 *
537 * Return a struct dwarf_frame representing the most recent frame
538 * on the callstack. Each of the lower (older) stack frames are
539 * linked via the "prev" member.
540 */
541struct dwarf_frame * dwarf_unwind_stack(unsigned long pc,
542 struct dwarf_frame *prev)
543{
544 struct dwarf_frame *frame;
545 struct dwarf_cie *cie;
546 struct dwarf_fde *fde;
547 struct dwarf_reg *reg;
548 unsigned long addr;
549
550 /*
551 * If this is the first invocation of this recursive function we
552 * need get the contents of a physical register to get the CFA
553 * in order to begin the virtual unwinding of the stack.
554 *
555 * NOTE: the return address is guaranteed to be setup by the
556 * time this function makes its first function call.
557 */
558 if (!pc && !prev)
559 pc = (unsigned long)current_text_addr();
560
561 frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC);
562 if (!frame) {
563 printk(KERN_ERR "Unable to allocate a dwarf frame\n");
564 UNWINDER_BUG();
565 }
566
567 INIT_LIST_HEAD(&frame->reg_list);
568 frame->flags = 0;
569 frame->prev = prev;
570 frame->return_addr = 0;
571
572 fde = dwarf_lookup_fde(pc);
573 if (!fde) {
574 /*
575 * This is our normal exit path - the one that stops the
576 * recursion. There's two reasons why we might exit
577 * here,
578 *
579 * a) pc has no asscociated DWARF frame info and so
580 * we don't know how to unwind this frame. This is
581 * usually the case when we're trying to unwind a
582 * frame that was called from some assembly code
583 * that has no DWARF info, e.g. syscalls.
584 *
585 * b) the DEBUG info for pc is bogus. There's
586 * really no way to distinguish this case from the
587 * case above, which sucks because we could print a
588 * warning here.
589 */
590 goto bail;
591 }
592
593 cie = dwarf_lookup_cie(fde->cie_pointer);
594
595 frame->pc = fde->initial_location;
596
597 /* CIE initial instructions */
598 dwarf_cfa_execute_insns(cie->initial_instructions,
599 cie->instructions_end, cie, fde,
600 frame, pc);
601
602 /* FDE instructions */
603 dwarf_cfa_execute_insns(fde->instructions, fde->end, cie,
604 fde, frame, pc);
605
606 /* Calculate the CFA */
607 switch (frame->flags) {
608 case DWARF_FRAME_CFA_REG_OFFSET:
609 if (prev) {
610 reg = dwarf_frame_reg(prev, frame->cfa_register);
611 UNWINDER_BUG_ON(!reg);
612 UNWINDER_BUG_ON(reg->flags != DWARF_REG_OFFSET);
613
614 addr = prev->cfa + reg->addr;
615 frame->cfa = __raw_readl(addr);
616
617 } else {
618 /*
619 * Again, this is the first invocation of this
620 * recurisve function. We need to physically
621 * read the contents of a register in order to
622 * get the Canonical Frame Address for this
623 * function.
624 */
625 frame->cfa = dwarf_read_arch_reg(frame->cfa_register);
626 }
627
628 frame->cfa += frame->cfa_offset;
629 break;
630 default:
631 UNWINDER_BUG();
632 }
633
634 reg = dwarf_frame_reg(frame, DWARF_ARCH_RA_REG);
635
636 /*
637 * If we haven't seen the return address register or the return
638 * address column is undefined then we must assume that this is
639 * the end of the callstack.
640 */
641 if (!reg || reg->flags == DWARF_UNDEFINED)
642 goto bail;
643
644 UNWINDER_BUG_ON(reg->flags != DWARF_REG_OFFSET);
645
646 addr = frame->cfa + reg->addr;
647 frame->return_addr = __raw_readl(addr);
648
649 return frame;
650
651bail:
652 dwarf_frame_free_regs(frame);
653 mempool_free(frame, dwarf_frame_pool);
654 return NULL;
655}
656
657static int dwarf_parse_cie(void *entry, void *p, unsigned long len,
658 unsigned char *end)
659{
660 struct dwarf_cie *cie;
661 unsigned long flags;
662 int count;
663
664 cie = kzalloc(sizeof(*cie), GFP_KERNEL);
665 if (!cie)
666 return -ENOMEM;
667
668 cie->length = len;
669
670 /*
671 * Record the offset into the .eh_frame section
672 * for this CIE. It allows this CIE to be
673 * quickly and easily looked up from the
674 * corresponding FDE.
675 */
676 cie->cie_pointer = (unsigned long)entry;
677
678 cie->version = *(char *)p++;
679 UNWINDER_BUG_ON(cie->version != 1);
680
681 cie->augmentation = p;
682 p += strlen(cie->augmentation) + 1;
683
684 count = dwarf_read_uleb128(p, &cie->code_alignment_factor);
685 p += count;
686
687 count = dwarf_read_leb128(p, &cie->data_alignment_factor);
688 p += count;
689
690 /*
691 * Which column in the rule table contains the
692 * return address?
693 */
694 if (cie->version == 1) {
695 cie->return_address_reg = __raw_readb(p);
696 p++;
697 } else {
698 count = dwarf_read_uleb128(p, &cie->return_address_reg);
699 p += count;
700 }
701
702 if (cie->augmentation[0] == 'z') {
703 unsigned int length, count;
704 cie->flags |= DWARF_CIE_Z_AUGMENTATION;
705
706 count = dwarf_read_uleb128(p, &length);
707 p += count;
708
709 UNWINDER_BUG_ON((unsigned char *)p > end);
710
711 cie->initial_instructions = p + length;
712 cie->augmentation++;
713 }
714
715 while (*cie->augmentation) {
716 /*
717 * "L" indicates a byte showing how the
718 * LSDA pointer is encoded. Skip it.
719 */
720 if (*cie->augmentation == 'L') {
721 p++;
722 cie->augmentation++;
723 } else if (*cie->augmentation == 'R') {
724 /*
725 * "R" indicates a byte showing
726 * how FDE addresses are
727 * encoded.
728 */
729 cie->encoding = *(char *)p++;
730 cie->augmentation++;
731 } else if (*cie->augmentation == 'P') {
732 /*
733 * "R" indicates a personality
734 * routine in the CIE
735 * augmentation.
736 */
737 UNWINDER_BUG();
738 } else if (*cie->augmentation == 'S') {
739 UNWINDER_BUG();
740 } else {
741 /*
742 * Unknown augmentation. Assume
743 * 'z' augmentation.
744 */
745 p = cie->initial_instructions;
746 UNWINDER_BUG_ON(!p);
747 break;
748 }
749 }
750
751 cie->initial_instructions = p;
752 cie->instructions_end = end;
753
754 /* Add to list */
755 spin_lock_irqsave(&dwarf_cie_lock, flags);
756 list_add_tail(&cie->link, &dwarf_cie_list);
757 spin_unlock_irqrestore(&dwarf_cie_lock, flags);
758
759 return 0;
760}
761
762static int dwarf_parse_fde(void *entry, u32 entry_type,
763 void *start, unsigned long len,
764 unsigned char *end)
765{
766 struct dwarf_fde *fde;
767 struct dwarf_cie *cie;
768 unsigned long flags;
769 int count;
770 void *p = start;
771
772 fde = kzalloc(sizeof(*fde), GFP_KERNEL);
773 if (!fde)
774 return -ENOMEM;
775
776 fde->length = len;
777
778 /*
779 * In a .eh_frame section the CIE pointer is the
780 * delta between the address within the FDE
781 */
782 fde->cie_pointer = (unsigned long)(p - entry_type - 4);
783
784 cie = dwarf_lookup_cie(fde->cie_pointer);
785 fde->cie = cie;
786
787 if (cie->encoding)
788 count = dwarf_read_encoded_value(p, &fde->initial_location,
789 cie->encoding);
790 else
791 count = dwarf_read_addr(p, &fde->initial_location);
792
793 p += count;
794
795 if (cie->encoding)
796 count = dwarf_read_encoded_value(p, &fde->address_range,
797 cie->encoding & 0x0f);
798 else
799 count = dwarf_read_addr(p, &fde->address_range);
800
801 p += count;
802
803 if (fde->cie->flags & DWARF_CIE_Z_AUGMENTATION) {
804 unsigned int length;
805 count = dwarf_read_uleb128(p, &length);
806 p += count + length;
807 }
808
809 /* Call frame instructions. */
810 fde->instructions = p;
811 fde->end = end;
812
813 /* Add to list. */
814 spin_lock_irqsave(&dwarf_fde_lock, flags);
815 list_add_tail(&fde->link, &dwarf_fde_list);
816 spin_unlock_irqrestore(&dwarf_fde_lock, flags);
817
818 return 0;
819}
820
821static void dwarf_unwinder_dump(struct task_struct *task,
822 struct pt_regs *regs,
823 unsigned long *sp,
824 const struct stacktrace_ops *ops,
825 void *data)
826{
827 struct dwarf_frame *frame, *_frame;
828 unsigned long return_addr;
829
830 _frame = NULL;
831 return_addr = 0;
832
833 while (1) {
834 frame = dwarf_unwind_stack(return_addr, _frame);
835
836 if (_frame) {
837 dwarf_frame_free_regs(_frame);
838 mempool_free(_frame, dwarf_frame_pool);
839 }
840
841 _frame = frame;
842
843 if (!frame || !frame->return_addr)
844 break;
845
846 return_addr = frame->return_addr;
847 ops->address(data, return_addr, 1);
848 }
849}
850
851static struct unwinder dwarf_unwinder = {
852 .name = "dwarf-unwinder",
853 .dump = dwarf_unwinder_dump,
854 .rating = 150,
855};
856
857static void dwarf_unwinder_cleanup(void)
858{
859 struct dwarf_cie *cie;
860 struct dwarf_fde *fde;
861
862 /*
863 * Deallocate all the memory allocated for the DWARF unwinder.
864 * Traverse all the FDE/CIE lists and remove and free all the
865 * memory associated with those data structures.
866 */
867 list_for_each_entry(cie, &dwarf_cie_list, link)
868 kfree(cie);
869
870 list_for_each_entry(fde, &dwarf_fde_list, link)
871 kfree(fde);
872
873 kmem_cache_destroy(dwarf_reg_cachep);
874 kmem_cache_destroy(dwarf_frame_cachep);
875}
876
877/**
878 * dwarf_unwinder_init - initialise the dwarf unwinder
879 *
880 * Build the data structures describing the .dwarf_frame section to
881 * make it easier to lookup CIE and FDE entries. Because the
882 * .eh_frame section is packed as tightly as possible it is not
883 * easy to lookup the FDE for a given PC, so we build a list of FDE
884 * and CIE entries that make it easier.
885 */
886static int __init dwarf_unwinder_init(void)
887{
888 u32 entry_type;
889 void *p, *entry;
890 int count, err = 0;
891 unsigned long len;
892 unsigned int c_entries, f_entries;
893 unsigned char *end;
894 INIT_LIST_HEAD(&dwarf_cie_list);
895 INIT_LIST_HEAD(&dwarf_fde_list);
896
897 c_entries = 0;
898 f_entries = 0;
899 entry = &__start_eh_frame;
900
901 dwarf_frame_cachep = kmem_cache_create("dwarf_frames",
902 sizeof(struct dwarf_frame), 0,
903 SLAB_PANIC | SLAB_HWCACHE_ALIGN | SLAB_NOTRACK, NULL);
904
905 dwarf_reg_cachep = kmem_cache_create("dwarf_regs",
906 sizeof(struct dwarf_reg), 0,
907 SLAB_PANIC | SLAB_HWCACHE_ALIGN | SLAB_NOTRACK, NULL);
908
909 dwarf_frame_pool = mempool_create(DWARF_FRAME_MIN_REQ,
910 mempool_alloc_slab,
911 mempool_free_slab,
912 dwarf_frame_cachep);
913
914 dwarf_reg_pool = mempool_create(DWARF_REG_MIN_REQ,
915 mempool_alloc_slab,
916 mempool_free_slab,
917 dwarf_reg_cachep);
918
919 while ((char *)entry < __stop_eh_frame) {
920 p = entry;
921
922 count = dwarf_entry_len(p, &len);
923 if (count == 0) {
924 /*
925 * We read a bogus length field value. There is
926 * nothing we can do here apart from disabling
927 * the DWARF unwinder. We can't even skip this
928 * entry and move to the next one because 'len'
929 * tells us where our next entry is.
930 */
931 goto out;
932 } else
933 p += count;
934
935 /* initial length does not include itself */
936 end = p + len;
937
938 entry_type = get_unaligned((u32 *)p);
939 p += 4;
940
941 if (entry_type == DW_EH_FRAME_CIE) {
942 err = dwarf_parse_cie(entry, p, len, end);
943 if (err < 0)
944 goto out;
945 else
946 c_entries++;
947 } else {
948 err = dwarf_parse_fde(entry, entry_type, p, len, end);
949 if (err < 0)
950 goto out;
951 else
952 f_entries++;
953 }
954
955 entry = (char *)entry + len + 4;
956 }
957
958 printk(KERN_INFO "DWARF unwinder initialised: read %u CIEs, %u FDEs\n",
959 c_entries, f_entries);
960
961 err = unwinder_register(&dwarf_unwinder);
962 if (err)
963 goto out;
964
965 return 0;
966
967out:
968 printk(KERN_ERR "Failed to initialise DWARF unwinder: %d\n", err);
969 dwarf_unwinder_cleanup();
970 return -EINVAL;
971}
972early_initcall(dwarf_unwinder_init);
diff --git a/arch/sh/kernel/early_printk.c b/arch/sh/kernel/early_printk.c
index a952dcf9999..81a46145ffa 100644
--- a/arch/sh/kernel/early_printk.c
+++ b/arch/sh/kernel/early_printk.c
@@ -134,7 +134,7 @@ static void scif_sercon_init(char *s)
134 sci_out(&scif_port, SCFCR, 0x0030); /* TTRG=b'11 */ 134 sci_out(&scif_port, SCFCR, 0x0030); /* TTRG=b'11 */
135 sci_out(&scif_port, SCSCR, 0x0030); /* TE, RE */ 135 sci_out(&scif_port, SCSCR, 0x0030); /* TE, RE */
136} 136}
137#elif defined(CONFIG_CPU_SH4) 137#elif defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SH3)
138#define DEFAULT_BAUD 115200 138#define DEFAULT_BAUD 115200
139/* 139/*
140 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4 140 * Simple SCIF init, primarily aimed at SH7750 and other similar SH-4
@@ -220,8 +220,7 @@ static int __init setup_early_printk(char *buf)
220 early_console = &scif_console; 220 early_console = &scif_console;
221 221
222#if !defined(CONFIG_SH_STANDARD_BIOS) 222#if !defined(CONFIG_SH_STANDARD_BIOS)
223#if defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 223#if defined(CONFIG_CPU_SH4) || defined(CONFIG_CPU_SH3)
224 defined(CONFIG_CPU_SUBTYPE_SH7721)
225 scif_sercon_init(buf + 6); 224 scif_sercon_init(buf + 6);
226#endif 225#endif
227#endif 226#endif
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S
index d62359cfbbe..68d9223b145 100644
--- a/arch/sh/kernel/entry-common.S
+++ b/arch/sh/kernel/entry-common.S
@@ -43,9 +43,10 @@
43 * syscall # 43 * syscall #
44 * 44 *
45 */ 45 */
46#include <asm/dwarf.h>
46 47
47#if defined(CONFIG_PREEMPT) 48#if defined(CONFIG_PREEMPT)
48# define preempt_stop() cli 49# define preempt_stop() cli ; TRACE_IRQS_OFF
49#else 50#else
50# define preempt_stop() 51# define preempt_stop()
51# define resume_kernel __restore_all 52# define resume_kernel __restore_all
@@ -55,11 +56,7 @@
55 .align 2 56 .align 2
56ENTRY(exception_error) 57ENTRY(exception_error)
57 ! 58 !
58#ifdef CONFIG_TRACE_IRQFLAGS 59 TRACE_IRQS_ON
59 mov.l 2f, r0
60 jsr @r0
61 nop
62#endif
63 sti 60 sti
64 mov.l 1f, r0 61 mov.l 1f, r0
65 jmp @r0 62 jmp @r0
@@ -67,18 +64,15 @@ ENTRY(exception_error)
67 64
68 .align 2 65 .align 2
691: .long do_exception_error 661: .long do_exception_error
70#ifdef CONFIG_TRACE_IRQFLAGS
712: .long trace_hardirqs_on
72#endif
73 67
74 .align 2 68 .align 2
75ret_from_exception: 69ret_from_exception:
70 CFI_STARTPROC simple
71 CFI_DEF_CFA r14, 0
72 CFI_REL_OFFSET 17, 64
73 CFI_REL_OFFSET 15, 0
74 CFI_REL_OFFSET 14, 56
76 preempt_stop() 75 preempt_stop()
77#ifdef CONFIG_TRACE_IRQFLAGS
78 mov.l 4f, r0
79 jsr @r0
80 nop
81#endif
82ENTRY(ret_from_irq) 76ENTRY(ret_from_irq)
83 ! 77 !
84 mov #OFF_SR, r0 78 mov #OFF_SR, r0
@@ -93,6 +87,7 @@ ENTRY(ret_from_irq)
93 nop 87 nop
94ENTRY(resume_kernel) 88ENTRY(resume_kernel)
95 cli 89 cli
90 TRACE_IRQS_OFF
96 mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count 91 mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count
97 tst r0, r0 92 tst r0, r0
98 bf noresched 93 bf noresched
@@ -103,8 +98,9 @@ need_resched:
103 98
104 mov #OFF_SR, r0 99 mov #OFF_SR, r0
105 mov.l @(r0,r15), r0 ! get status register 100 mov.l @(r0,r15), r0 ! get status register
106 and #0xf0, r0 ! interrupts off (exception path)? 101 shlr r0
107 cmp/eq #0xf0, r0 102 and #(0xf0>>1), r0 ! interrupts off (exception path)?
103 cmp/eq #(0xf0>>1), r0
108 bt noresched 104 bt noresched
109 mov.l 3f, r0 105 mov.l 3f, r0
110 jsr @r0 ! call preempt_schedule_irq 106 jsr @r0 ! call preempt_schedule_irq
@@ -125,13 +121,9 @@ noresched:
125ENTRY(resume_userspace) 121ENTRY(resume_userspace)
126 ! r8: current_thread_info 122 ! r8: current_thread_info
127 cli 123 cli
128#ifdef CONFIG_TRACE_IRQFLAGS 124 TRACE_IRQS_OfF
129 mov.l 5f, r0
130 jsr @r0
131 nop
132#endif
133 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags 125 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags
134 tst #_TIF_WORK_MASK, r0 126 tst #(_TIF_WORK_MASK & 0xff), r0
135 bt/s __restore_all 127 bt/s __restore_all
136 tst #_TIF_NEED_RESCHED, r0 128 tst #_TIF_NEED_RESCHED, r0
137 129
@@ -156,14 +148,10 @@ work_resched:
156 jsr @r1 ! schedule 148 jsr @r1 ! schedule
157 nop 149 nop
158 cli 150 cli
159#ifdef CONFIG_TRACE_IRQFLAGS 151 TRACE_IRQS_OFF
160 mov.l 5f, r0
161 jsr @r0
162 nop
163#endif
164 ! 152 !
165 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags 153 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags
166 tst #_TIF_WORK_MASK, r0 154 tst #(_TIF_WORK_MASK & 0xff), r0
167 bt __restore_all 155 bt __restore_all
168 bra work_pending 156 bra work_pending
169 tst #_TIF_NEED_RESCHED, r0 157 tst #_TIF_NEED_RESCHED, r0
@@ -172,23 +160,15 @@ work_resched:
1721: .long schedule 1601: .long schedule
1732: .long do_notify_resume 1612: .long do_notify_resume
1743: .long resume_userspace 1623: .long resume_userspace
175#ifdef CONFIG_TRACE_IRQFLAGS
1764: .long trace_hardirqs_on
1775: .long trace_hardirqs_off
178#endif
179 163
180 .align 2 164 .align 2
181syscall_exit_work: 165syscall_exit_work:
182 ! r0: current_thread_info->flags 166 ! r0: current_thread_info->flags
183 ! r8: current_thread_info 167 ! r8: current_thread_info
184 tst #_TIF_WORK_SYSCALL_MASK, r0 168 tst #(_TIF_WORK_SYSCALL_MASK & 0xff), r0
185 bt/s work_pending 169 bt/s work_pending
186 tst #_TIF_NEED_RESCHED, r0 170 tst #_TIF_NEED_RESCHED, r0
187#ifdef CONFIG_TRACE_IRQFLAGS 171 TRACE_IRQS_ON
188 mov.l 5f, r0
189 jsr @r0
190 nop
191#endif
192 sti 172 sti
193 mov r15, r4 173 mov r15, r4
194 mov.l 8f, r0 ! do_syscall_trace_leave 174 mov.l 8f, r0 ! do_syscall_trace_leave
@@ -226,12 +206,25 @@ syscall_trace_entry:
226 mov.l r0, @(OFF_R0,r15) ! Return value 206 mov.l r0, @(OFF_R0,r15) ! Return value
227 207
228__restore_all: 208__restore_all:
229 mov.l 1f, r0 209 mov #OFF_SR, r0
210 mov.l @(r0,r15), r0 ! get status register
211
212 shlr2 r0
213 and #0x3c, r0
214 cmp/eq #0x3c, r0
215 bt 1f
216 TRACE_IRQS_ON
217 bra 2f
218 nop
2191:
220 TRACE_IRQS_OFF
2212:
222 mov.l 3f, r0
230 jmp @r0 223 jmp @r0
231 nop 224 nop
232 225
233 .align 2 226 .align 2
2341: .long restore_all 2273: .long restore_all
235 228
236 .align 2 229 .align 2
237syscall_badsys: ! Bad syscall number 230syscall_badsys: ! Bad syscall number
@@ -259,6 +252,7 @@ debug_trap:
259 nop 252 nop
260 bra __restore_all 253 bra __restore_all
261 nop 254 nop
255 CFI_ENDPROC
262 256
263 .align 2 257 .align 2
2641: .long debug_trap_table 2581: .long debug_trap_table
@@ -304,6 +298,7 @@ ret_from_fork:
304 * system calls and debug traps through their respective jump tables. 298 * system calls and debug traps through their respective jump tables.
305 */ 299 */
306ENTRY(system_call) 300ENTRY(system_call)
301 setup_frame_reg
307#if !defined(CONFIG_CPU_SH2) 302#if !defined(CONFIG_CPU_SH2)
308 mov.l 1f, r9 303 mov.l 1f, r9
309 mov.l @r9, r8 ! Read from TRA (Trap Address) Register 304 mov.l @r9, r8 ! Read from TRA (Trap Address) Register
@@ -321,18 +316,18 @@ ENTRY(system_call)
321 bt/s debug_trap ! it's a debug trap.. 316 bt/s debug_trap ! it's a debug trap..
322 nop 317 nop
323 318
324#ifdef CONFIG_TRACE_IRQFLAGS 319 TRACE_IRQS_ON
325 mov.l 5f, r10
326 jsr @r10
327 nop
328#endif
329 sti 320 sti
330 321
331 ! 322 !
332 get_current_thread_info r8, r10 323 get_current_thread_info r8, r10
333 mov.l @(TI_FLAGS,r8), r8 324 mov.l @(TI_FLAGS,r8), r8
334 mov #_TIF_WORK_SYSCALL_MASK, r10 325 mov #(_TIF_WORK_SYSCALL_MASK & 0xff), r10
326 mov #(_TIF_WORK_SYSCALL_MASK >> 8), r9
335 tst r10, r8 327 tst r10, r8
328 shll8 r9
329 bf syscall_trace_entry
330 tst r9, r8
336 bf syscall_trace_entry 331 bf syscall_trace_entry
337 ! 332 !
338 mov.l 2f, r8 ! Number of syscalls 333 mov.l 2f, r8 ! Number of syscalls
@@ -351,15 +346,15 @@ syscall_call:
351 ! 346 !
352syscall_exit: 347syscall_exit:
353 cli 348 cli
354#ifdef CONFIG_TRACE_IRQFLAGS 349 TRACE_IRQS_OFF
355 mov.l 6f, r0
356 jsr @r0
357 nop
358#endif
359 ! 350 !
360 get_current_thread_info r8, r0 351 get_current_thread_info r8, r0
361 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags 352 mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags
362 tst #_TIF_ALLWORK_MASK, r0 353 tst #(_TIF_ALLWORK_MASK & 0xff), r0
354 mov #(_TIF_ALLWORK_MASK >> 8), r1
355 bf syscall_exit_work
356 shlr8 r0
357 tst r0, r1
363 bf syscall_exit_work 358 bf syscall_exit_work
364 bra __restore_all 359 bra __restore_all
365 nop 360 nop
@@ -369,9 +364,5 @@ syscall_exit:
369#endif 364#endif
3702: .long NR_syscalls 3652: .long NR_syscalls
3713: .long sys_call_table 3663: .long sys_call_table
372#ifdef CONFIG_TRACE_IRQFLAGS
3735: .long trace_hardirqs_on
3746: .long trace_hardirqs_off
375#endif
3767: .long do_syscall_trace_enter 3677: .long do_syscall_trace_enter
3778: .long do_syscall_trace_leave 3688: .long do_syscall_trace_leave
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c
index 066f37dc32a..a3dcc6d5d25 100644
--- a/arch/sh/kernel/ftrace.c
+++ b/arch/sh/kernel/ftrace.c
@@ -16,9 +16,13 @@
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/kernel.h>
19#include <asm/ftrace.h> 20#include <asm/ftrace.h>
20#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/unistd.h>
23#include <trace/syscall.h>
21 24
25#ifdef CONFIG_DYNAMIC_FTRACE
22static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE]; 26static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE];
23 27
24static unsigned char ftrace_nop[4]; 28static unsigned char ftrace_nop[4];
@@ -131,3 +135,187 @@ int __init ftrace_dyn_arch_init(void *data)
131 135
132 return 0; 136 return 0;
133} 137}
138#endif /* CONFIG_DYNAMIC_FTRACE */
139
140#ifdef CONFIG_FUNCTION_GRAPH_TRACER
141#ifdef CONFIG_DYNAMIC_FTRACE
142extern void ftrace_graph_call(void);
143
144static int ftrace_mod(unsigned long ip, unsigned long old_addr,
145 unsigned long new_addr)
146{
147 unsigned char code[MCOUNT_INSN_SIZE];
148
149 if (probe_kernel_read(code, (void *)ip, MCOUNT_INSN_SIZE))
150 return -EFAULT;
151
152 if (old_addr != __raw_readl((unsigned long *)code))
153 return -EINVAL;
154
155 __raw_writel(new_addr, ip);
156 return 0;
157}
158
159int ftrace_enable_ftrace_graph_caller(void)
160{
161 unsigned long ip, old_addr, new_addr;
162
163 ip = (unsigned long)(&ftrace_graph_call) + GRAPH_INSN_OFFSET;
164 old_addr = (unsigned long)(&skip_trace);
165 new_addr = (unsigned long)(&ftrace_graph_caller);
166
167 return ftrace_mod(ip, old_addr, new_addr);
168}
169
170int ftrace_disable_ftrace_graph_caller(void)
171{
172 unsigned long ip, old_addr, new_addr;
173
174 ip = (unsigned long)(&ftrace_graph_call) + GRAPH_INSN_OFFSET;
175 old_addr = (unsigned long)(&ftrace_graph_caller);
176 new_addr = (unsigned long)(&skip_trace);
177
178 return ftrace_mod(ip, old_addr, new_addr);
179}
180#endif /* CONFIG_DYNAMIC_FTRACE */
181
182/*
183 * Hook the return address and push it in the stack of return addrs
184 * in the current thread info.
185 *
186 * This is the main routine for the function graph tracer. The function
187 * graph tracer essentially works like this:
188 *
189 * parent is the stack address containing self_addr's return address.
190 * We pull the real return address out of parent and store it in
191 * current's ret_stack. Then, we replace the return address on the stack
192 * with the address of return_to_handler. self_addr is the function that
193 * called mcount.
194 *
195 * When self_addr returns, it will jump to return_to_handler which calls
196 * ftrace_return_to_handler. ftrace_return_to_handler will pull the real
197 * return address off of current's ret_stack and jump to it.
198 */
199void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
200{
201 unsigned long old;
202 int faulted, err;
203 struct ftrace_graph_ent trace;
204 unsigned long return_hooker = (unsigned long)&return_to_handler;
205
206 if (unlikely(atomic_read(&current->tracing_graph_pause)))
207 return;
208
209 /*
210 * Protect against fault, even if it shouldn't
211 * happen. This tool is too much intrusive to
212 * ignore such a protection.
213 */
214 __asm__ __volatile__(
215 "1: \n\t"
216 "mov.l @%2, %0 \n\t"
217 "2: \n\t"
218 "mov.l %3, @%2 \n\t"
219 "mov #0, %1 \n\t"
220 "3: \n\t"
221 ".section .fixup, \"ax\" \n\t"
222 "4: \n\t"
223 "mov.l 5f, %0 \n\t"
224 "jmp @%0 \n\t"
225 " mov #1, %1 \n\t"
226 ".balign 4 \n\t"
227 "5: .long 3b \n\t"
228 ".previous \n\t"
229 ".section __ex_table,\"a\" \n\t"
230 ".long 1b, 4b \n\t"
231 ".long 2b, 4b \n\t"
232 ".previous \n\t"
233 : "=&r" (old), "=r" (faulted)
234 : "r" (parent), "r" (return_hooker)
235 );
236
237 if (unlikely(faulted)) {
238 ftrace_graph_stop();
239 WARN_ON(1);
240 return;
241 }
242
243 err = ftrace_push_return_trace(old, self_addr, &trace.depth, 0);
244 if (err == -EBUSY) {
245 __raw_writel(old, parent);
246 return;
247 }
248
249 trace.func = self_addr;
250
251 /* Only trace if the calling function expects to */
252 if (!ftrace_graph_entry(&trace)) {
253 current->curr_ret_stack--;
254 __raw_writel(old, parent);
255 }
256}
257#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
258
259#ifdef CONFIG_FTRACE_SYSCALLS
260
261extern unsigned long __start_syscalls_metadata[];
262extern unsigned long __stop_syscalls_metadata[];
263extern unsigned long *sys_call_table;
264
265static struct syscall_metadata **syscalls_metadata;
266
267static struct syscall_metadata *find_syscall_meta(unsigned long *syscall)
268{
269 struct syscall_metadata *start;
270 struct syscall_metadata *stop;
271 char str[KSYM_SYMBOL_LEN];
272
273
274 start = (struct syscall_metadata *)__start_syscalls_metadata;
275 stop = (struct syscall_metadata *)__stop_syscalls_metadata;
276 kallsyms_lookup((unsigned long) syscall, NULL, NULL, NULL, str);
277
278 for ( ; start < stop; start++) {
279 if (start->name && !strcmp(start->name, str))
280 return start;
281 }
282
283 return NULL;
284}
285
286struct syscall_metadata *syscall_nr_to_meta(int nr)
287{
288 if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0)
289 return NULL;
290
291 return syscalls_metadata[nr];
292}
293
294void arch_init_ftrace_syscalls(void)
295{
296 int i;
297 struct syscall_metadata *meta;
298 unsigned long **psys_syscall_table = &sys_call_table;
299 static atomic_t refs;
300
301 if (atomic_inc_return(&refs) != 1)
302 goto end;
303
304 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
305 FTRACE_SYSCALL_MAX, GFP_KERNEL);
306 if (!syscalls_metadata) {
307 WARN_ON(1);
308 return;
309 }
310
311 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
312 meta = find_syscall_meta(psys_syscall_table[i]);
313 syscalls_metadata[i] = meta;
314 }
315 return;
316
317 /* Paranoid: avoid overflow */
318end:
319 atomic_dec(&refs);
320}
321#endif /* CONFIG_FTRACE_SYSCALLS */
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index 4f85fffaa55..4770c241c67 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -1,12 +1,9 @@
1/* 1/*
2 * linux/arch/sh/kernel/io.c 2 * arch/sh/kernel/io.c - Machine independent I/O functions.
3 * 3 *
4 * Copyright (C) 2000 Stuart Menefy 4 * Copyright (C) 2000 - 2009 Stuart Menefy
5 * Copyright (C) 2005 Paul Mundt 5 * Copyright (C) 2005 Paul Mundt
6 * 6 *
7 * Provide real functions which expand to whatever the header file defined.
8 * Also definitions of machine independent IO functions.
9 *
10 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
12 * for more details. 9 * for more details.
@@ -18,33 +15,87 @@
18 15
19/* 16/*
20 * Copy data from IO memory space to "real" memory space. 17 * Copy data from IO memory space to "real" memory space.
21 * This needs to be optimized.
22 */ 18 */
23void memcpy_fromio(void *to, const volatile void __iomem *from, unsigned long count) 19void memcpy_fromio(void *to, const volatile void __iomem *from, unsigned long count)
24{ 20{
25 unsigned char *p = to; 21 /*
26 while (count) { 22 * Would it be worthwhile doing byte and long transfers first
27 count--; 23 * to try and get aligned?
28 *p = readb(from); 24 */
29 p++; 25#ifdef CONFIG_CPU_SH4
30 from++; 26 if ((count >= 0x20) &&
31 } 27 (((u32)to & 0x1f) == 0) && (((u32)from & 0x3) == 0)) {
28 int tmp2, tmp3, tmp4, tmp5, tmp6;
29
30 __asm__ __volatile__(
31 "1: \n\t"
32 "mov.l @%7+, r0 \n\t"
33 "mov.l @%7+, %2 \n\t"
34 "movca.l r0, @%0 \n\t"
35 "mov.l @%7+, %3 \n\t"
36 "mov.l @%7+, %4 \n\t"
37 "mov.l @%7+, %5 \n\t"
38 "mov.l @%7+, %6 \n\t"
39 "mov.l @%7+, r7 \n\t"
40 "mov.l @%7+, r0 \n\t"
41 "mov.l %2, @(0x04,%0) \n\t"
42 "mov #0x20, %2 \n\t"
43 "mov.l %3, @(0x08,%0) \n\t"
44 "sub %2, %1 \n\t"
45 "mov.l %4, @(0x0c,%0) \n\t"
46 "cmp/hi %1, %2 ! T if 32 > count \n\t"
47 "mov.l %5, @(0x10,%0) \n\t"
48 "mov.l %6, @(0x14,%0) \n\t"
49 "mov.l r7, @(0x18,%0) \n\t"
50 "mov.l r0, @(0x1c,%0) \n\t"
51 "bf.s 1b \n\t"
52 " add #0x20, %0 \n\t"
53 : "=&r" (to), "=&r" (count),
54 "=&r" (tmp2), "=&r" (tmp3), "=&r" (tmp4),
55 "=&r" (tmp5), "=&r" (tmp6), "=&r" (from)
56 : "7"(from), "0" (to), "1" (count)
57 : "r0", "r7", "t", "memory");
58 }
59#endif
60
61 if ((((u32)to | (u32)from) & 0x3) == 0) {
62 for (; count > 3; count -= 4) {
63 *(u32 *)to = *(volatile u32 *)from;
64 to += 4;
65 from += 4;
66 }
67 }
68
69 for (; count > 0; count--) {
70 *(u8 *)to = *(volatile u8 *)from;
71 to++;
72 from++;
73 }
74
75 mb();
32} 76}
33EXPORT_SYMBOL(memcpy_fromio); 77EXPORT_SYMBOL(memcpy_fromio);
34 78
35/* 79/*
36 * Copy data from "real" memory space to IO memory space. 80 * Copy data from "real" memory space to IO memory space.
37 * This needs to be optimized.
38 */ 81 */
39void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count) 82void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
40{ 83{
41 const unsigned char *p = from; 84 if ((((u32)to | (u32)from) & 0x3) == 0) {
42 while (count) { 85 for ( ; count > 3; count -= 4) {
43 count--; 86 *(volatile u32 *)to = *(u32 *)from;
44 writeb(*p, to); 87 to += 4;
45 p++; 88 from += 4;
46 to++; 89 }
47 } 90 }
91
92 for (; count > 0; count--) {
93 *(volatile u8 *)to = *(u8 *)from;
94 to++;
95 from++;
96 }
97
98 mb();
48} 99}
49EXPORT_SYMBOL(memcpy_toio); 100EXPORT_SYMBOL(memcpy_toio);
50 101
@@ -62,6 +113,8 @@ void memset_io(volatile void __iomem *dst, int c, unsigned long count)
62} 113}
63EXPORT_SYMBOL(memset_io); 114EXPORT_SYMBOL(memset_io);
64 115
116#ifndef CONFIG_GENERIC_IOMAP
117
65void __iomem *ioport_map(unsigned long port, unsigned int nr) 118void __iomem *ioport_map(unsigned long port, unsigned int nr)
66{ 119{
67 void __iomem *ret; 120 void __iomem *ret;
@@ -79,3 +132,5 @@ void ioport_unmap(void __iomem *addr)
79 sh_mv.mv_ioport_unmap(addr); 132 sh_mv.mv_ioport_unmap(addr);
80} 133}
81EXPORT_SYMBOL(ioport_unmap); 134EXPORT_SYMBOL(ioport_unmap);
135
136#endif /* CONFIG_GENERIC_IOMAP */
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index 5a7f554d9ca..4ff50723928 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -73,35 +73,19 @@ u32 generic_inl_p(unsigned long port)
73 73
74void generic_insb(unsigned long port, void *dst, unsigned long count) 74void generic_insb(unsigned long port, void *dst, unsigned long count)
75{ 75{
76 volatile u8 *port_addr; 76 __raw_readsb(__ioport_map(port, 1), dst, count);
77 u8 *buf = dst; 77 dummy_read();
78
79 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
80 while (count--)
81 *buf++ = *port_addr;
82} 78}
83 79
84void generic_insw(unsigned long port, void *dst, unsigned long count) 80void generic_insw(unsigned long port, void *dst, unsigned long count)
85{ 81{
86 volatile u16 *port_addr; 82 __raw_readsw(__ioport_map(port, 2), dst, count);
87 u16 *buf = dst;
88
89 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
90 while (count--)
91 *buf++ = *port_addr;
92
93 dummy_read(); 83 dummy_read();
94} 84}
95 85
96void generic_insl(unsigned long port, void *dst, unsigned long count) 86void generic_insl(unsigned long port, void *dst, unsigned long count)
97{ 87{
98 volatile u32 *port_addr; 88 __raw_readsl(__ioport_map(port, 4), dst, count);
99 u32 *buf = dst;
100
101 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
102 while (count--)
103 *buf++ = *port_addr;
104
105 dummy_read(); 89 dummy_read();
106} 90}
107 91
@@ -145,37 +129,19 @@ void generic_outl_p(u32 b, unsigned long port)
145 */ 129 */
146void generic_outsb(unsigned long port, const void *src, unsigned long count) 130void generic_outsb(unsigned long port, const void *src, unsigned long count)
147{ 131{
148 volatile u8 *port_addr; 132 __raw_writesb(__ioport_map(port, 1), src, count);
149 const u8 *buf = src; 133 dummy_read();
150
151 port_addr = (volatile u8 __force *)__ioport_map(port, 1);
152
153 while (count--)
154 *port_addr = *buf++;
155} 134}
156 135
157void generic_outsw(unsigned long port, const void *src, unsigned long count) 136void generic_outsw(unsigned long port, const void *src, unsigned long count)
158{ 137{
159 volatile u16 *port_addr; 138 __raw_writesw(__ioport_map(port, 2), src, count);
160 const u16 *buf = src;
161
162 port_addr = (volatile u16 __force *)__ioport_map(port, 2);
163
164 while (count--)
165 *port_addr = *buf++;
166
167 dummy_read(); 139 dummy_read();
168} 140}
169 141
170void generic_outsl(unsigned long port, const void *src, unsigned long count) 142void generic_outsl(unsigned long port, const void *src, unsigned long count)
171{ 143{
172 volatile u32 *port_addr; 144 __raw_writesl(__ioport_map(port, 4), src, count);
173 const u32 *buf = src;
174
175 port_addr = (volatile u32 __force *)__ioport_map(port, 4);
176 while (count--)
177 *port_addr = *buf++;
178
179 dummy_read(); 145 dummy_read();
180} 146}
181 147
diff --git a/arch/sh/kernel/io_trapped.c b/arch/sh/kernel/io_trapped.c
index 77dfecb6437..69be603aa2d 100644
--- a/arch/sh/kernel/io_trapped.c
+++ b/arch/sh/kernel/io_trapped.c
@@ -112,14 +112,15 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
112 struct trapped_io *tiop; 112 struct trapped_io *tiop;
113 struct resource *res; 113 struct resource *res;
114 int k, len; 114 int k, len;
115 unsigned long flags;
115 116
116 spin_lock_irq(&trapped_lock); 117 spin_lock_irqsave(&trapped_lock, flags);
117 list_for_each_entry(tiop, list, list) { 118 list_for_each_entry(tiop, list, list) {
118 voffs = 0; 119 voffs = 0;
119 for (k = 0; k < tiop->num_resources; k++) { 120 for (k = 0; k < tiop->num_resources; k++) {
120 res = tiop->resource + k; 121 res = tiop->resource + k;
121 if (res->start == offset) { 122 if (res->start == offset) {
122 spin_unlock_irq(&trapped_lock); 123 spin_unlock_irqrestore(&trapped_lock, flags);
123 return tiop->virt_base + voffs; 124 return tiop->virt_base + voffs;
124 } 125 }
125 126
@@ -127,7 +128,7 @@ void __iomem *match_trapped_io_handler(struct list_head *list,
127 voffs += roundup(len, PAGE_SIZE); 128 voffs += roundup(len, PAGE_SIZE);
128 } 129 }
129 } 130 }
130 spin_unlock_irq(&trapped_lock); 131 spin_unlock_irqrestore(&trapped_lock, flags);
131 return NULL; 132 return NULL;
132} 133}
133EXPORT_SYMBOL_GPL(match_trapped_io_handler); 134EXPORT_SYMBOL_GPL(match_trapped_io_handler);
@@ -283,7 +284,8 @@ int handle_trapped_io(struct pt_regs *regs, unsigned long address)
283 return 0; 284 return 0;
284 } 285 }
285 286
286 tmp = handle_unaligned_access(instruction, regs, &trapped_io_access); 287 tmp = handle_unaligned_access(instruction, regs,
288 &trapped_io_access, 1);
287 set_fs(oldfs); 289 set_fs(oldfs);
288 return tmp == 0; 290 return tmp == 0;
289} 291}
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 3d09062f468..60f8af4497c 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -114,24 +114,7 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs)
114#endif 114#endif
115 115
116 irq_enter(); 116 irq_enter();
117 117 irq = irq_demux(irq);
118#ifdef CONFIG_DEBUG_STACKOVERFLOW
119 /* Debugging check for stack overflow: is there less than 1KB free? */
120 {
121 long sp;
122
123 __asm__ __volatile__ ("and r15, %0" :
124 "=r" (sp) : "0" (THREAD_SIZE - 1));
125
126 if (unlikely(sp < (sizeof(struct thread_info) + STACK_WARN))) {
127 printk("do_IRQ: stack overflow: %ld\n",
128 sp - sizeof(struct thread_info));
129 dump_stack();
130 }
131 }
132#endif
133
134 irq = irq_demux(intc_evt2irq(irq));
135 118
136#ifdef CONFIG_IRQSTACKS 119#ifdef CONFIG_IRQSTACKS
137 curctx = (union irq_ctx *)current_thread_info(); 120 curctx = (union irq_ctx *)current_thread_info();
diff --git a/arch/sh/kernel/kgdb.c b/arch/sh/kernel/kgdb.c
index 305aad742ae..3e532d0d4a5 100644
--- a/arch/sh/kernel/kgdb.c
+++ b/arch/sh/kernel/kgdb.c
@@ -15,8 +15,6 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17 17
18char in_nmi = 0; /* Set during NMI to prevent re-entry */
19
20/* Macros for single step instruction identification */ 18/* Macros for single step instruction identification */
21#define OPCODE_BT(op) (((op) & 0xff00) == 0x8900) 19#define OPCODE_BT(op) (((op) & 0xff00) == 0x8900)
22#define OPCODE_BF(op) (((op) & 0xff00) == 0x8b00) 20#define OPCODE_BF(op) (((op) & 0xff00) == 0x8b00)
@@ -195,8 +193,6 @@ void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
195 regs->gbr = gdb_regs[GDB_GBR]; 193 regs->gbr = gdb_regs[GDB_GBR];
196 regs->mach = gdb_regs[GDB_MACH]; 194 regs->mach = gdb_regs[GDB_MACH];
197 regs->macl = gdb_regs[GDB_MACL]; 195 regs->macl = gdb_regs[GDB_MACL];
198
199 __asm__ __volatile__ ("ldc %0, vbr" : : "r" (gdb_regs[GDB_VBR]));
200} 196}
201 197
202void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p) 198void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
diff --git a/arch/sh/kernel/localtimer.c b/arch/sh/kernel/localtimer.c
index 96e8eaea1e6..0b04e7d4a9b 100644
--- a/arch/sh/kernel/localtimer.c
+++ b/arch/sh/kernel/localtimer.c
@@ -22,6 +22,7 @@
22#include <linux/jiffies.h> 22#include <linux/jiffies.h>
23#include <linux/percpu.h> 23#include <linux/percpu.h>
24#include <linux/clockchips.h> 24#include <linux/clockchips.h>
25#include <linux/hardirq.h>
25#include <linux/irq.h> 26#include <linux/irq.h>
26 27
27static DEFINE_PER_CPU(struct clock_event_device, local_clockevent); 28static DEFINE_PER_CPU(struct clock_event_device, local_clockevent);
@@ -33,7 +34,9 @@ void local_timer_interrupt(void)
33{ 34{
34 struct clock_event_device *clk = &__get_cpu_var(local_clockevent); 35 struct clock_event_device *clk = &__get_cpu_var(local_clockevent);
35 36
37 irq_enter();
36 clk->event_handler(clk); 38 clk->event_handler(clk);
39 irq_exit();
37} 40}
38 41
39static void dummy_timer_set_mode(enum clock_event_mode mode, 42static void dummy_timer_set_mode(enum clock_event_mode mode,
@@ -46,8 +49,10 @@ void __cpuinit local_timer_setup(unsigned int cpu)
46 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu); 49 struct clock_event_device *clk = &per_cpu(local_clockevent, cpu);
47 50
48 clk->name = "dummy_timer"; 51 clk->name = "dummy_timer";
49 clk->features = CLOCK_EVT_FEAT_DUMMY; 52 clk->features = CLOCK_EVT_FEAT_ONESHOT |
50 clk->rating = 200; 53 CLOCK_EVT_FEAT_PERIODIC |
54 CLOCK_EVT_FEAT_DUMMY;
55 clk->rating = 400;
51 clk->mult = 1; 56 clk->mult = 1;
52 clk->set_mode = dummy_timer_set_mode; 57 clk->set_mode = dummy_timer_set_mode;
53 clk->broadcast = smp_timer_broadcast; 58 clk->broadcast = smp_timer_broadcast;
diff --git a/arch/sh/kernel/nmi_debug.c b/arch/sh/kernel/nmi_debug.c
new file mode 100644
index 00000000000..ff0abbd1e65
--- /dev/null
+++ b/arch/sh/kernel/nmi_debug.c
@@ -0,0 +1,77 @@
1/*
2 * Copyright (C) 2007 Atmel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8#include <linux/delay.h>
9#include <linux/kdebug.h>
10#include <linux/notifier.h>
11#include <linux/sched.h>
12#include <linux/hardirq.h>
13
14enum nmi_action {
15 NMI_SHOW_STATE = 1 << 0,
16 NMI_SHOW_REGS = 1 << 1,
17 NMI_DIE = 1 << 2,
18 NMI_DEBOUNCE = 1 << 3,
19};
20
21static unsigned long nmi_actions;
22
23static int nmi_debug_notify(struct notifier_block *self,
24 unsigned long val, void *data)
25{
26 struct die_args *args = data;
27
28 if (likely(val != DIE_NMI))
29 return NOTIFY_DONE;
30
31 if (nmi_actions & NMI_SHOW_STATE)
32 show_state();
33 if (nmi_actions & NMI_SHOW_REGS)
34 show_regs(args->regs);
35 if (nmi_actions & NMI_DEBOUNCE)
36 mdelay(10);
37 if (nmi_actions & NMI_DIE)
38 return NOTIFY_BAD;
39
40 return NOTIFY_OK;
41}
42
43static struct notifier_block nmi_debug_nb = {
44 .notifier_call = nmi_debug_notify,
45};
46
47static int __init nmi_debug_setup(char *str)
48{
49 char *p, *sep;
50
51 register_die_notifier(&nmi_debug_nb);
52
53 if (*str != '=')
54 return 0;
55
56 for (p = str + 1; *p; p = sep + 1) {
57 sep = strchr(p, ',');
58 if (sep)
59 *sep = 0;
60 if (strcmp(p, "state") == 0)
61 nmi_actions |= NMI_SHOW_STATE;
62 else if (strcmp(p, "regs") == 0)
63 nmi_actions |= NMI_SHOW_REGS;
64 else if (strcmp(p, "debounce") == 0)
65 nmi_actions |= NMI_DEBOUNCE;
66 else if (strcmp(p, "die") == 0)
67 nmi_actions |= NMI_DIE;
68 else
69 printk(KERN_WARNING "NMI: Unrecognized action `%s'\n",
70 p);
71 if (!sep)
72 break;
73 }
74
75 return 0;
76}
77__setup("nmi_debug", nmi_debug_setup);
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 92d7740faab..0673c4746be 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -23,6 +23,7 @@
23#include <linux/tick.h> 23#include <linux/tick.h>
24#include <linux/reboot.h> 24#include <linux/reboot.h>
25#include <linux/fs.h> 25#include <linux/fs.h>
26#include <linux/ftrace.h>
26#include <linux/preempt.h> 27#include <linux/preempt.h>
27#include <asm/uaccess.h> 28#include <asm/uaccess.h>
28#include <asm/mmu_context.h> 29#include <asm/mmu_context.h>
@@ -31,15 +32,35 @@
31#include <asm/ubc.h> 32#include <asm/ubc.h>
32#include <asm/fpu.h> 33#include <asm/fpu.h>
33#include <asm/syscalls.h> 34#include <asm/syscalls.h>
35#include <asm/watchdog.h>
34 36
35int ubc_usercnt = 0; 37int ubc_usercnt = 0;
36 38
39#ifdef CONFIG_32BIT
40static void watchdog_trigger_immediate(void)
41{
42 sh_wdt_write_cnt(0xFF);
43 sh_wdt_write_csr(0xC2);
44}
45
46void machine_restart(char * __unused)
47{
48 local_irq_disable();
49
50 /* Use watchdog timer to trigger reset */
51 watchdog_trigger_immediate();
52
53 while (1)
54 cpu_sleep();
55}
56#else
37void machine_restart(char * __unused) 57void machine_restart(char * __unused)
38{ 58{
39 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ 59 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
40 asm volatile("ldc %0, sr\n\t" 60 asm volatile("ldc %0, sr\n\t"
41 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001)); 61 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
42} 62}
63#endif
43 64
44void machine_halt(void) 65void machine_halt(void)
45{ 66{
@@ -264,8 +285,8 @@ static void ubc_set_tracing(int asid, unsigned long pc)
264 * switch_to(x,y) should switch tasks from x to y. 285 * switch_to(x,y) should switch tasks from x to y.
265 * 286 *
266 */ 287 */
267struct task_struct *__switch_to(struct task_struct *prev, 288__notrace_funcgraph struct task_struct *
268 struct task_struct *next) 289__switch_to(struct task_struct *prev, struct task_struct *next)
269{ 290{
270#if defined(CONFIG_SH_FPU) 291#if defined(CONFIG_SH_FPU)
271 unlazy_fpu(prev, task_pt_regs(prev)); 292 unlazy_fpu(prev, task_pt_regs(prev));
diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
index 24de7421494..1192398ef58 100644
--- a/arch/sh/kernel/process_64.c
+++ b/arch/sh/kernel/process_64.c
@@ -425,7 +425,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
425 struct task_struct *p, struct pt_regs *regs) 425 struct task_struct *p, struct pt_regs *regs)
426{ 426{
427 struct pt_regs *childregs; 427 struct pt_regs *childregs;
428 unsigned long long se; /* Sign extension */
429 428
430#ifdef CONFIG_SH_FPU 429#ifdef CONFIG_SH_FPU
431 if(last_task_used_math == current) { 430 if(last_task_used_math == current) {
@@ -441,11 +440,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
441 440
442 *childregs = *regs; 441 *childregs = *regs;
443 442
443 /*
444 * Sign extend the edited stack.
445 * Note that thread.pc and thread.pc will stay
446 * 32-bit wide and context switch must take care
447 * of NEFF sign extension.
448 */
444 if (user_mode(regs)) { 449 if (user_mode(regs)) {
445 childregs->regs[15] = usp; 450 childregs->regs[15] = neff_sign_extend(usp);
446 p->thread.uregs = childregs; 451 p->thread.uregs = childregs;
447 } else { 452 } else {
448 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE; 453 childregs->regs[15] =
454 neff_sign_extend((unsigned long)task_stack_page(p) +
455 THREAD_SIZE);
449 } 456 }
450 457
451 childregs->regs[9] = 0; /* Set return value for child */ 458 childregs->regs[9] = 0; /* Set return value for child */
@@ -454,17 +461,6 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
454 p->thread.sp = (unsigned long) childregs; 461 p->thread.sp = (unsigned long) childregs;
455 p->thread.pc = (unsigned long) ret_from_fork; 462 p->thread.pc = (unsigned long) ret_from_fork;
456 463
457 /*
458 * Sign extend the edited stack.
459 * Note that thread.pc and thread.pc will stay
460 * 32-bit wide and context switch must take care
461 * of NEFF sign extension.
462 */
463
464 se = childregs->regs[15];
465 se = (se & NEFF_SIGN) ? (se | NEFF_MASK) : se;
466 childregs->regs[15] = se;
467
468 return 0; 464 return 0;
469} 465}
470 466
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c
index 3392e835a37..9be35f34809 100644
--- a/arch/sh/kernel/ptrace_32.c
+++ b/arch/sh/kernel/ptrace_32.c
@@ -34,6 +34,9 @@
34#include <asm/syscalls.h> 34#include <asm/syscalls.h>
35#include <asm/fpu.h> 35#include <asm/fpu.h>
36 36
37#define CREATE_TRACE_POINTS
38#include <trace/events/syscalls.h>
39
37/* 40/*
38 * This routine will get a word off of the process kernel stack. 41 * This routine will get a word off of the process kernel stack.
39 */ 42 */
@@ -459,6 +462,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs)
459 */ 462 */
460 ret = -1L; 463 ret = -1L;
461 464
465 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
466 trace_sys_enter(regs, regs->regs[0]);
467
462 if (unlikely(current->audit_context)) 468 if (unlikely(current->audit_context))
463 audit_syscall_entry(audit_arch(), regs->regs[3], 469 audit_syscall_entry(audit_arch(), regs->regs[3],
464 regs->regs[4], regs->regs[5], 470 regs->regs[4], regs->regs[5],
@@ -475,6 +481,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
475 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), 481 audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]),
476 regs->regs[0]); 482 regs->regs[0]);
477 483
484 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
485 trace_sys_exit(regs, regs->regs[0]);
486
478 step = test_thread_flag(TIF_SINGLESTEP); 487 step = test_thread_flag(TIF_SINGLESTEP);
479 if (step || test_thread_flag(TIF_SYSCALL_TRACE)) 488 if (step || test_thread_flag(TIF_SYSCALL_TRACE))
480 tracehook_report_syscall_exit(regs, step); 489 tracehook_report_syscall_exit(regs, step);
diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c
index 695097438f0..952da83903d 100644
--- a/arch/sh/kernel/ptrace_64.c
+++ b/arch/sh/kernel/ptrace_64.c
@@ -40,6 +40,9 @@
40#include <asm/syscalls.h> 40#include <asm/syscalls.h>
41#include <asm/fpu.h> 41#include <asm/fpu.h>
42 42
43#define CREATE_TRACE_POINTS
44#include <trace/events/syscalls.h>
45
43/* This mask defines the bits of the SR which the user is not allowed to 46/* This mask defines the bits of the SR which the user is not allowed to
44 change, which are everything except S, Q, M, PR, SZ, FR. */ 47 change, which are everything except S, Q, M, PR, SZ, FR. */
45#define SR_MASK (0xffff8cfd) 48#define SR_MASK (0xffff8cfd)
@@ -438,6 +441,9 @@ asmlinkage long long do_syscall_trace_enter(struct pt_regs *regs)
438 */ 441 */
439 ret = -1LL; 442 ret = -1LL;
440 443
444 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
445 trace_sys_enter(regs, regs->regs[9]);
446
441 if (unlikely(current->audit_context)) 447 if (unlikely(current->audit_context))
442 audit_syscall_entry(audit_arch(), regs->regs[1], 448 audit_syscall_entry(audit_arch(), regs->regs[1],
443 regs->regs[2], regs->regs[3], 449 regs->regs[2], regs->regs[3],
@@ -452,6 +458,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs)
452 audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]), 458 audit_syscall_exit(AUDITSC_RESULT(regs->regs[9]),
453 regs->regs[9]); 459 regs->regs[9]);
454 460
461 if (unlikely(test_thread_flag(TIF_SYSCALL_TRACEPOINT)))
462 trace_sys_exit(regs, regs->regs[9]);
463
455 if (test_thread_flag(TIF_SYSCALL_TRACE)) 464 if (test_thread_flag(TIF_SYSCALL_TRACE))
456 tracehook_report_syscall_exit(regs, 0); 465 tracehook_report_syscall_exit(regs, 0);
457} 466}
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index dd38338553e..f9d44f8e0df 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -30,6 +30,7 @@
30#include <linux/clk.h> 30#include <linux/clk.h>
31#include <linux/delay.h> 31#include <linux/delay.h>
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/lmb.h>
33#include <asm/uaccess.h> 34#include <asm/uaccess.h>
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/page.h> 36#include <asm/page.h>
@@ -48,6 +49,7 @@
48struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = { 49struct sh_cpuinfo cpu_data[NR_CPUS] __read_mostly = {
49 [0] = { 50 [0] = {
50 .type = CPU_SH_NONE, 51 .type = CPU_SH_NONE,
52 .family = CPU_FAMILY_UNKNOWN,
51 .loops_per_jiffy = 10000000, 53 .loops_per_jiffy = 10000000,
52 }, 54 },
53}; 55};
@@ -233,39 +235,45 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn,
233void __init setup_bootmem_allocator(unsigned long free_pfn) 235void __init setup_bootmem_allocator(unsigned long free_pfn)
234{ 236{
235 unsigned long bootmap_size; 237 unsigned long bootmap_size;
238 unsigned long bootmap_pages, bootmem_paddr;
239 u64 total_pages = (lmb_end_of_DRAM() - __MEMORY_START) >> PAGE_SHIFT;
240 int i;
241
242 bootmap_pages = bootmem_bootmap_pages(total_pages);
243
244 bootmem_paddr = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE);
236 245
237 /* 246 /*
238 * Find a proper area for the bootmem bitmap. After this 247 * Find a proper area for the bootmem bitmap. After this
239 * bootstrap step all allocations (until the page allocator 248 * bootstrap step all allocations (until the page allocator
240 * is intact) must be done via bootmem_alloc(). 249 * is intact) must be done via bootmem_alloc().
241 */ 250 */
242 bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, 251 bootmap_size = init_bootmem_node(NODE_DATA(0),
252 bootmem_paddr >> PAGE_SHIFT,
243 min_low_pfn, max_low_pfn); 253 min_low_pfn, max_low_pfn);
244 254
245 __add_active_range(0, min_low_pfn, max_low_pfn); 255 /* Add active regions with valid PFNs. */
246 register_bootmem_low_pages(); 256 for (i = 0; i < lmb.memory.cnt; i++) {
247 257 unsigned long start_pfn, end_pfn;
248 node_set_online(0); 258 start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT;
259 end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i);
260 __add_active_range(0, start_pfn, end_pfn);
261 }
249 262
250 /* 263 /*
251 * Reserve the kernel text and 264 * Add all physical memory to the bootmem map and mark each
252 * Reserve the bootmem bitmap. We do this in two steps (first step 265 * area as present.
253 * was init_bootmem()), because this catches the (definitely buggy)
254 * case of us accidentally initializing the bootmem allocator with
255 * an invalid RAM area.
256 */ 266 */
257 reserve_bootmem(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, 267 register_bootmem_low_pages();
258 (PFN_PHYS(free_pfn) + bootmap_size + PAGE_SIZE - 1) -
259 (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET),
260 BOOTMEM_DEFAULT);
261 268
262 /* 269 /* Reserve the sections we're already using. */
263 * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. 270 for (i = 0; i < lmb.reserved.cnt; i++)
264 */ 271 reserve_bootmem(lmb.reserved.region[i].base,
265 if (CONFIG_ZERO_PAGE_OFFSET != 0) 272 lmb_size_bytes(&lmb.reserved, i),
266 reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET,
267 BOOTMEM_DEFAULT); 273 BOOTMEM_DEFAULT);
268 274
275 node_set_online(0);
276
269 sparse_memory_present_with_active_regions(0); 277 sparse_memory_present_with_active_regions(0);
270 278
271#ifdef CONFIG_BLK_DEV_INITRD 279#ifdef CONFIG_BLK_DEV_INITRD
@@ -296,12 +304,37 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
296static void __init setup_memory(void) 304static void __init setup_memory(void)
297{ 305{
298 unsigned long start_pfn; 306 unsigned long start_pfn;
307 u64 base = min_low_pfn << PAGE_SHIFT;
308 u64 size = (max_low_pfn << PAGE_SHIFT) - base;
299 309
300 /* 310 /*
301 * Partially used pages are not usable - thus 311 * Partially used pages are not usable - thus
302 * we are rounding upwards: 312 * we are rounding upwards:
303 */ 313 */
304 start_pfn = PFN_UP(__pa(_end)); 314 start_pfn = PFN_UP(__pa(_end));
315
316 lmb_add(base, size);
317
318 /*
319 * Reserve the kernel text and
320 * Reserve the bootmem bitmap. We do this in two steps (first step
321 * was init_bootmem()), because this catches the (definitely buggy)
322 * case of us accidentally initializing the bootmem allocator with
323 * an invalid RAM area.
324 */
325 lmb_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET,
326 (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) -
327 (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET));
328
329 /*
330 * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET.
331 */
332 if (CONFIG_ZERO_PAGE_OFFSET != 0)
333 lmb_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET);
334
335 lmb_analyze();
336 lmb_dump_all();
337
305 setup_bootmem_allocator(start_pfn); 338 setup_bootmem_allocator(start_pfn);
306} 339}
307#else 340#else
@@ -372,10 +405,14 @@ void __init setup_arch(char **cmdline_p)
372 if (!memory_end) 405 if (!memory_end)
373 memory_end = memory_start + __MEMORY_SIZE; 406 memory_end = memory_start + __MEMORY_SIZE;
374 407
375#ifdef CONFIG_CMDLINE_BOOL 408#ifdef CONFIG_CMDLINE_OVERWRITE
376 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line)); 409 strlcpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
377#else 410#else
378 strlcpy(command_line, COMMAND_LINE, sizeof(command_line)); 411 strlcpy(command_line, COMMAND_LINE, sizeof(command_line));
412#ifdef CONFIG_CMDLINE_EXTEND
413 strlcat(command_line, " ", sizeof(command_line));
414 strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
415#endif
379#endif 416#endif
380 417
381 /* Save unparsed command line copy for /proc/cmdline */ 418 /* Save unparsed command line copy for /proc/cmdline */
@@ -402,6 +439,7 @@ void __init setup_arch(char **cmdline_p)
402 nodes_clear(node_online_map); 439 nodes_clear(node_online_map);
403 440
404 /* Setup bootmem with available RAM */ 441 /* Setup bootmem with available RAM */
442 lmb_init();
405 setup_memory(); 443 setup_memory();
406 sparse_init(); 444 sparse_init();
407 445
@@ -448,7 +486,7 @@ static const char *cpu_name[] = {
448 [CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770", 486 [CPU_SH7763] = "SH7763", [CPU_SH7770] = "SH7770",
449 [CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781", 487 [CPU_SH7780] = "SH7780", [CPU_SH7781] = "SH7781",
450 [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785", 488 [CPU_SH7343] = "SH7343", [CPU_SH7785] = "SH7785",
451 [CPU_SH7786] = "SH7786", 489 [CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
452 [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3", 490 [CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
453 [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103", 491 [CPU_SH5_101] = "SH5-101", [CPU_SH5_103] = "SH5-103",
454 [CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723", 492 [CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index fcc5de31f83..8dbe26b17c4 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -101,20 +101,14 @@ EXPORT_SYMBOL(flush_cache_range);
101EXPORT_SYMBOL(flush_dcache_page); 101EXPORT_SYMBOL(flush_dcache_page);
102#endif 102#endif
103 103
104#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU) && \ 104#ifdef CONFIG_MCOUNT
105 (defined(CONFIG_CPU_SH4) || defined(CONFIG_SH7705_CACHE_32KB)) 105DECLARE_EXPORT(mcount);
106EXPORT_SYMBOL(clear_user_page);
107#endif
108
109#ifdef CONFIG_FUNCTION_TRACER
110EXPORT_SYMBOL(mcount);
111#endif 106#endif
112EXPORT_SYMBOL(csum_partial); 107EXPORT_SYMBOL(csum_partial);
113EXPORT_SYMBOL(csum_partial_copy_generic); 108EXPORT_SYMBOL(csum_partial_copy_generic);
114#ifdef CONFIG_IPV6 109#ifdef CONFIG_IPV6
115EXPORT_SYMBOL(csum_ipv6_magic); 110EXPORT_SYMBOL(csum_ipv6_magic);
116#endif 111#endif
117EXPORT_SYMBOL(clear_page);
118EXPORT_SYMBOL(copy_page); 112EXPORT_SYMBOL(copy_page);
119EXPORT_SYMBOL(__clear_user); 113EXPORT_SYMBOL(__clear_user);
120EXPORT_SYMBOL(_ebss); 114EXPORT_SYMBOL(_ebss);
diff --git a/arch/sh/kernel/sh_ksyms_64.c b/arch/sh/kernel/sh_ksyms_64.c
index f5bd156ea50..d008e17eb25 100644
--- a/arch/sh/kernel/sh_ksyms_64.c
+++ b/arch/sh/kernel/sh_ksyms_64.c
@@ -30,14 +30,6 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
30EXPORT_SYMBOL(dump_fpu); 30EXPORT_SYMBOL(dump_fpu);
31EXPORT_SYMBOL(kernel_thread); 31EXPORT_SYMBOL(kernel_thread);
32 32
33#if !defined(CONFIG_CACHE_OFF) && defined(CONFIG_MMU)
34EXPORT_SYMBOL(clear_user_page);
35#endif
36
37#ifndef CONFIG_CACHE_OFF
38EXPORT_SYMBOL(flush_dcache_page);
39#endif
40
41#ifdef CONFIG_VT 33#ifdef CONFIG_VT
42EXPORT_SYMBOL(screen_info); 34EXPORT_SYMBOL(screen_info);
43#endif 35#endif
@@ -52,7 +44,6 @@ EXPORT_SYMBOL(__get_user_asm_l);
52EXPORT_SYMBOL(__get_user_asm_q); 44EXPORT_SYMBOL(__get_user_asm_q);
53EXPORT_SYMBOL(__strnlen_user); 45EXPORT_SYMBOL(__strnlen_user);
54EXPORT_SYMBOL(__strncpy_from_user); 46EXPORT_SYMBOL(__strncpy_from_user);
55EXPORT_SYMBOL(clear_page);
56EXPORT_SYMBOL(__clear_user); 47EXPORT_SYMBOL(__clear_user);
57EXPORT_SYMBOL(copy_page); 48EXPORT_SYMBOL(copy_page);
58EXPORT_SYMBOL(__copy_user); 49EXPORT_SYMBOL(__copy_user);
diff --git a/arch/sh/kernel/signal_32.c b/arch/sh/kernel/signal_32.c
index 04a21883f32..6729703547a 100644
--- a/arch/sh/kernel/signal_32.c
+++ b/arch/sh/kernel/signal_32.c
@@ -41,6 +41,16 @@ struct fdpic_func_descriptor {
41}; 41};
42 42
43/* 43/*
44 * The following define adds a 64 byte gap between the signal
45 * stack frame and previous contents of the stack. This allows
46 * frame unwinding in a function epilogue but only if a frame
47 * pointer is used in the function. This is necessary because
48 * current gcc compilers (<4.3) do not generate unwind info on
49 * SH for function epilogues.
50 */
51#define UNWINDGUARD 64
52
53/*
44 * Atomically swap in the new signal mask, and wait for a signal. 54 * Atomically swap in the new signal mask, and wait for a signal.
45 */ 55 */
46asmlinkage int 56asmlinkage int
@@ -327,7 +337,7 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size)
327 sp = current->sas_ss_sp + current->sas_ss_size; 337 sp = current->sas_ss_sp + current->sas_ss_size;
328 } 338 }
329 339
330 return (void __user *)((sp - frame_size) & -8ul); 340 return (void __user *)((sp - (frame_size+UNWINDGUARD)) & -8ul);
331} 341}
332 342
333/* These symbols are defined with the addresses in the vsyscall page. 343/* These symbols are defined with the addresses in the vsyscall page.
diff --git a/arch/sh/kernel/signal_64.c b/arch/sh/kernel/signal_64.c
index 9e5c9b1d7e9..74793c80a57 100644
--- a/arch/sh/kernel/signal_64.c
+++ b/arch/sh/kernel/signal_64.c
@@ -561,13 +561,11 @@ static int setup_frame(int sig, struct k_sigaction *ka,
561 /* Set up to return from userspace. If provided, use a stub 561 /* Set up to return from userspace. If provided, use a stub
562 already in userspace. */ 562 already in userspace. */
563 if (ka->sa.sa_flags & SA_RESTORER) { 563 if (ka->sa.sa_flags & SA_RESTORER) {
564 DEREF_REG_PR = (unsigned long) ka->sa.sa_restorer | 0x1;
565
566 /* 564 /*
567 * On SH5 all edited pointers are subject to NEFF 565 * On SH5 all edited pointers are subject to NEFF
568 */ 566 */
569 DEREF_REG_PR = (DEREF_REG_PR & NEFF_SIGN) ? 567 DEREF_REG_PR = neff_sign_extend((unsigned long)
570 (DEREF_REG_PR | NEFF_MASK) : DEREF_REG_PR; 568 ka->sa.sa_restorer | 0x1);
571 } else { 569 } else {
572 /* 570 /*
573 * Different approach on SH5. 571 * Different approach on SH5.
@@ -580,9 +578,8 @@ static int setup_frame(int sig, struct k_sigaction *ka,
580 * . being code, linker turns ShMedia bit on, always 578 * . being code, linker turns ShMedia bit on, always
581 * dereference index -1. 579 * dereference index -1.
582 */ 580 */
583 DEREF_REG_PR = (unsigned long) frame->retcode | 0x01; 581 DEREF_REG_PR = neff_sign_extend((unsigned long)
584 DEREF_REG_PR = (DEREF_REG_PR & NEFF_SIGN) ? 582 frame->retcode | 0x01);
585 (DEREF_REG_PR | NEFF_MASK) : DEREF_REG_PR;
586 583
587 if (__copy_to_user(frame->retcode, 584 if (__copy_to_user(frame->retcode,
588 (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0) 585 (void *)((unsigned long)sa_default_restorer & (~1)), 16) != 0)
@@ -596,9 +593,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
596 * Set up registers for signal handler. 593 * Set up registers for signal handler.
597 * All edited pointers are subject to NEFF. 594 * All edited pointers are subject to NEFF.
598 */ 595 */
599 regs->regs[REG_SP] = (unsigned long) frame; 596 regs->regs[REG_SP] = neff_sign_extend((unsigned long)frame);
600 regs->regs[REG_SP] = (regs->regs[REG_SP] & NEFF_SIGN) ?
601 (regs->regs[REG_SP] | NEFF_MASK) : regs->regs[REG_SP];
602 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */ 597 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */
603 598
604 /* FIXME: 599 /* FIXME:
@@ -613,8 +608,7 @@ static int setup_frame(int sig, struct k_sigaction *ka,
613 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc; 608 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->sc;
614 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc; 609 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->sc;
615 610
616 regs->pc = (unsigned long) ka->sa.sa_handler; 611 regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler);
617 regs->pc = (regs->pc & NEFF_SIGN) ? (regs->pc | NEFF_MASK) : regs->pc;
618 612
619 set_fs(USER_DS); 613 set_fs(USER_DS);
620 614
@@ -676,13 +670,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
676 /* Set up to return from userspace. If provided, use a stub 670 /* Set up to return from userspace. If provided, use a stub
677 already in userspace. */ 671 already in userspace. */
678 if (ka->sa.sa_flags & SA_RESTORER) { 672 if (ka->sa.sa_flags & SA_RESTORER) {
679 DEREF_REG_PR = (unsigned long) ka->sa.sa_restorer | 0x1;
680
681 /* 673 /*
682 * On SH5 all edited pointers are subject to NEFF 674 * On SH5 all edited pointers are subject to NEFF
683 */ 675 */
684 DEREF_REG_PR = (DEREF_REG_PR & NEFF_SIGN) ? 676 DEREF_REG_PR = neff_sign_extend((unsigned long)
685 (DEREF_REG_PR | NEFF_MASK) : DEREF_REG_PR; 677 ka->sa.sa_restorer | 0x1);
686 } else { 678 } else {
687 /* 679 /*
688 * Different approach on SH5. 680 * Different approach on SH5.
@@ -695,15 +687,14 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
695 * . being code, linker turns ShMedia bit on, always 687 * . being code, linker turns ShMedia bit on, always
696 * dereference index -1. 688 * dereference index -1.
697 */ 689 */
698 690 DEREF_REG_PR = neff_sign_extend((unsigned long)
699 DEREF_REG_PR = (unsigned long) frame->retcode | 0x01; 691 frame->retcode | 0x01);
700 DEREF_REG_PR = (DEREF_REG_PR & NEFF_SIGN) ?
701 (DEREF_REG_PR | NEFF_MASK) : DEREF_REG_PR;
702 692
703 if (__copy_to_user(frame->retcode, 693 if (__copy_to_user(frame->retcode,
704 (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0) 694 (void *)((unsigned long)sa_default_rt_restorer & (~1)), 16) != 0)
705 goto give_sigsegv; 695 goto give_sigsegv;
706 696
697 /* Cohere the trampoline with the I-cache. */
707 flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15); 698 flush_icache_range(DEREF_REG_PR-1, DEREF_REG_PR-1+15);
708 } 699 }
709 700
@@ -711,14 +702,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
711 * Set up registers for signal handler. 702 * Set up registers for signal handler.
712 * All edited pointers are subject to NEFF. 703 * All edited pointers are subject to NEFF.
713 */ 704 */
714 regs->regs[REG_SP] = (unsigned long) frame; 705 regs->regs[REG_SP] = neff_sign_extend((unsigned long)frame);
715 regs->regs[REG_SP] = (regs->regs[REG_SP] & NEFF_SIGN) ?
716 (regs->regs[REG_SP] | NEFF_MASK) : regs->regs[REG_SP];
717 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */ 706 regs->regs[REG_ARG1] = signal; /* Arg for signal handler */
718 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info; 707 regs->regs[REG_ARG2] = (unsigned long long)(unsigned long)(signed long)&frame->info;
719 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext; 708 regs->regs[REG_ARG3] = (unsigned long long)(unsigned long)(signed long)&frame->uc.uc_mcontext;
720 regs->pc = (unsigned long) ka->sa.sa_handler; 709 regs->pc = neff_sign_extend((unsigned long)ka->sa.sa_handler);
721 regs->pc = (regs->pc & NEFF_SIGN) ? (regs->pc | NEFF_MASK) : regs->pc;
722 710
723 set_fs(USER_DS); 711 set_fs(USER_DS);
724 712
diff --git a/arch/sh/kernel/stacktrace.c b/arch/sh/kernel/stacktrace.c
index 1a2a5eb76e4..c2e45c48409 100644
--- a/arch/sh/kernel/stacktrace.c
+++ b/arch/sh/kernel/stacktrace.c
@@ -13,47 +13,93 @@
13#include <linux/stacktrace.h> 13#include <linux/stacktrace.h>
14#include <linux/thread_info.h> 14#include <linux/thread_info.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <asm/unwinder.h>
16#include <asm/ptrace.h> 17#include <asm/ptrace.h>
18#include <asm/stacktrace.h>
19
20static void save_stack_warning(void *data, char *msg)
21{
22}
23
24static void
25save_stack_warning_symbol(void *data, char *msg, unsigned long symbol)
26{
27}
28
29static int save_stack_stack(void *data, char *name)
30{
31 return 0;
32}
17 33
18/* 34/*
19 * Save stack-backtrace addresses into a stack_trace buffer. 35 * Save stack-backtrace addresses into a stack_trace buffer.
20 */ 36 */
37static void save_stack_address(void *data, unsigned long addr, int reliable)
38{
39 struct stack_trace *trace = data;
40
41 if (!reliable)
42 return;
43
44 if (trace->skip > 0) {
45 trace->skip--;
46 return;
47 }
48
49 if (trace->nr_entries < trace->max_entries)
50 trace->entries[trace->nr_entries++] = addr;
51}
52
53static const struct stacktrace_ops save_stack_ops = {
54 .warning = save_stack_warning,
55 .warning_symbol = save_stack_warning_symbol,
56 .stack = save_stack_stack,
57 .address = save_stack_address,
58};
59
21void save_stack_trace(struct stack_trace *trace) 60void save_stack_trace(struct stack_trace *trace)
22{ 61{
23 unsigned long *sp = (unsigned long *)current_stack_pointer; 62 unsigned long *sp = (unsigned long *)current_stack_pointer;
24 63
25 while (!kstack_end(sp)) { 64 unwind_stack(current, NULL, sp, &save_stack_ops, trace);
26 unsigned long addr = *sp++; 65 if (trace->nr_entries < trace->max_entries)
27 66 trace->entries[trace->nr_entries++] = ULONG_MAX;
28 if (__kernel_text_address(addr)) {
29 if (trace->skip > 0)
30 trace->skip--;
31 else
32 trace->entries[trace->nr_entries++] = addr;
33 if (trace->nr_entries >= trace->max_entries)
34 break;
35 }
36 }
37} 67}
38EXPORT_SYMBOL_GPL(save_stack_trace); 68EXPORT_SYMBOL_GPL(save_stack_trace);
39 69
70static void
71save_stack_address_nosched(void *data, unsigned long addr, int reliable)
72{
73 struct stack_trace *trace = (struct stack_trace *)data;
74
75 if (!reliable)
76 return;
77
78 if (in_sched_functions(addr))
79 return;
80
81 if (trace->skip > 0) {
82 trace->skip--;
83 return;
84 }
85
86 if (trace->nr_entries < trace->max_entries)
87 trace->entries[trace->nr_entries++] = addr;
88}
89
90static const struct stacktrace_ops save_stack_ops_nosched = {
91 .warning = save_stack_warning,
92 .warning_symbol = save_stack_warning_symbol,
93 .stack = save_stack_stack,
94 .address = save_stack_address_nosched,
95};
96
40void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) 97void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
41{ 98{
42 unsigned long *sp = (unsigned long *)tsk->thread.sp; 99 unsigned long *sp = (unsigned long *)tsk->thread.sp;
43 100
44 while (!kstack_end(sp)) { 101 unwind_stack(current, NULL, sp, &save_stack_ops_nosched, trace);
45 unsigned long addr = *sp++; 102 if (trace->nr_entries < trace->max_entries)
46 103 trace->entries[trace->nr_entries++] = ULONG_MAX;
47 if (__kernel_text_address(addr)) {
48 if (in_sched_functions(addr))
49 break;
50 if (trace->skip > 0)
51 trace->skip--;
52 else
53 trace->entries[trace->nr_entries++] = addr;
54 if (trace->nr_entries >= trace->max_entries)
55 break;
56 }
57 }
58} 104}
59EXPORT_SYMBOL_GPL(save_stack_trace_tsk); 105EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 90d00e47264..8aa5d1ceaf1 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -25,6 +25,8 @@
25#include <asm/syscalls.h> 25#include <asm/syscalls.h>
26#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/unistd.h> 27#include <asm/unistd.h>
28#include <asm/cacheflush.h>
29#include <asm/cachectl.h>
28 30
29static inline long 31static inline long
30do_mmap2(unsigned long addr, unsigned long len, unsigned long prot, 32do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
@@ -179,6 +181,47 @@ asmlinkage int sys_ipc(uint call, int first, int second,
179 return -EINVAL; 181 return -EINVAL;
180} 182}
181 183
184/* sys_cacheflush -- flush (part of) the processor cache. */
185asmlinkage int sys_cacheflush(unsigned long addr, unsigned long len, int op)
186{
187 struct vm_area_struct *vma;
188
189 if ((op <= 0) || (op > (CACHEFLUSH_D_PURGE|CACHEFLUSH_I)))
190 return -EINVAL;
191
192 /*
193 * Verify that the specified address region actually belongs
194 * to this process.
195 */
196 if (addr + len < addr)
197 return -EFAULT;
198
199 down_read(&current->mm->mmap_sem);
200 vma = find_vma (current->mm, addr);
201 if (vma == NULL || addr < vma->vm_start || addr + len > vma->vm_end) {
202 up_read(&current->mm->mmap_sem);
203 return -EFAULT;
204 }
205
206 switch (op & CACHEFLUSH_D_PURGE) {
207 case CACHEFLUSH_D_INVAL:
208 __flush_invalidate_region((void *)addr, len);
209 break;
210 case CACHEFLUSH_D_WB:
211 __flush_wback_region((void *)addr, len);
212 break;
213 case CACHEFLUSH_D_PURGE:
214 __flush_purge_region((void *)addr, len);
215 break;
216 }
217
218 if (op & CACHEFLUSH_I)
219 flush_cache_all();
220
221 up_read(&current->mm->mmap_sem);
222 return 0;
223}
224
182asmlinkage int sys_uname(struct old_utsname __user *name) 225asmlinkage int sys_uname(struct old_utsname __user *name)
183{ 226{
184 int err; 227 int err;
diff --git a/arch/sh/kernel/syscalls_32.S b/arch/sh/kernel/syscalls_32.S
index f9e21fa2f59..16ba225ede8 100644
--- a/arch/sh/kernel/syscalls_32.S
+++ b/arch/sh/kernel/syscalls_32.S
@@ -139,7 +139,7 @@ ENTRY(sys_call_table)
139 .long sys_clone /* 120 */ 139 .long sys_clone /* 120 */
140 .long sys_setdomainname 140 .long sys_setdomainname
141 .long sys_newuname 141 .long sys_newuname
142 .long sys_ni_syscall /* sys_modify_ldt */ 142 .long sys_cacheflush /* x86: sys_modify_ldt */
143 .long sys_adjtimex 143 .long sys_adjtimex
144 .long sys_mprotect /* 125 */ 144 .long sys_mprotect /* 125 */
145 .long sys_sigprocmask 145 .long sys_sigprocmask
diff --git a/arch/sh/kernel/syscalls_64.S b/arch/sh/kernel/syscalls_64.S
index bf420b616ae..af6fb7410c2 100644
--- a/arch/sh/kernel/syscalls_64.S
+++ b/arch/sh/kernel/syscalls_64.S
@@ -143,7 +143,7 @@ sys_call_table:
143 .long sys_clone /* 120 */ 143 .long sys_clone /* 120 */
144 .long sys_setdomainname 144 .long sys_setdomainname
145 .long sys_newuname 145 .long sys_newuname
146 .long sys_ni_syscall /* sys_modify_ldt */ 146 .long sys_cacheflush /* x86: sys_modify_ldt */
147 .long sys_adjtimex 147 .long sys_adjtimex
148 .long sys_mprotect /* 125 */ 148 .long sys_mprotect /* 125 */
149 .long sys_sigprocmask 149 .long sys_sigprocmask
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 0e0e8581cf7..953fa161331 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -21,6 +21,7 @@
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/rtc.h> 22#include <linux/rtc.h>
23#include <asm/clock.h> 23#include <asm/clock.h>
24#include <asm/hwblk.h>
24#include <asm/rtc.h> 25#include <asm/rtc.h>
25 26
26/* Dummy RTC ops */ 27/* Dummy RTC ops */
@@ -89,21 +90,8 @@ module_init(rtc_generic_init);
89 90
90void (*board_time_init)(void); 91void (*board_time_init)(void);
91 92
92void __init time_init(void) 93static void __init sh_late_time_init(void)
93{ 94{
94 if (board_time_init)
95 board_time_init();
96
97 clk_init();
98
99 rtc_sh_get_time(&xtime);
100 set_normalized_timespec(&wall_to_monotonic,
101 -xtime.tv_sec, -xtime.tv_nsec);
102
103#ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST
104 local_timer_setup(smp_processor_id());
105#endif
106
107 /* 95 /*
108 * Make sure all compiled-in early timers register themselves. 96 * Make sure all compiled-in early timers register themselves.
109 * 97 *
@@ -116,3 +104,18 @@ void __init time_init(void)
116 early_platform_driver_register_all("earlytimer"); 104 early_platform_driver_register_all("earlytimer");
117 early_platform_driver_probe("earlytimer", 2, 0); 105 early_platform_driver_probe("earlytimer", 2, 0);
118} 106}
107
108void __init time_init(void)
109{
110 if (board_time_init)
111 board_time_init();
112
113 hwblk_init();
114 clk_init();
115
116 rtc_sh_get_time(&xtime);
117 set_normalized_timespec(&wall_to_monotonic,
118 -xtime.tv_sec, -xtime.tv_nsec);
119
120 late_time_init = sh_late_time_init;
121}
diff --git a/arch/sh/kernel/traps.c b/arch/sh/kernel/traps.c
index b3e0067db35..a8396f36bd1 100644
--- a/arch/sh/kernel/traps.c
+++ b/arch/sh/kernel/traps.c
@@ -5,18 +5,33 @@
5#include <linux/signal.h> 5#include <linux/signal.h>
6#include <linux/sched.h> 6#include <linux/sched.h>
7#include <linux/uaccess.h> 7#include <linux/uaccess.h>
8#include <linux/hardirq.h>
9#include <asm/unwinder.h>
8#include <asm/system.h> 10#include <asm/system.h>
9 11
10#ifdef CONFIG_BUG 12#ifdef CONFIG_BUG
11static void handle_BUG(struct pt_regs *regs) 13void handle_BUG(struct pt_regs *regs)
12{ 14{
15 const struct bug_entry *bug;
16 unsigned long bugaddr = regs->pc;
13 enum bug_trap_type tt; 17 enum bug_trap_type tt;
14 tt = report_bug(regs->pc, regs); 18
19 if (!is_valid_bugaddr(bugaddr))
20 goto invalid;
21
22 bug = find_bug(bugaddr);
23
24 /* Switch unwinders when unwind_stack() is called */
25 if (bug->flags & BUGFLAG_UNWINDER)
26 unwinder_faulted = 1;
27
28 tt = report_bug(bugaddr, regs);
15 if (tt == BUG_TRAP_TYPE_WARN) { 29 if (tt == BUG_TRAP_TYPE_WARN) {
16 regs->pc += instruction_size(regs->pc); 30 regs->pc += instruction_size(bugaddr);
17 return; 31 return;
18 } 32 }
19 33
34invalid:
20 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff); 35 die("Kernel BUG", regs, TRAPA_BUG_OPCODE & 0xff);
21} 36}
22 37
@@ -28,8 +43,10 @@ int is_valid_bugaddr(unsigned long addr)
28 return 0; 43 return 0;
29 if (probe_kernel_address((insn_size_t *)addr, opcode)) 44 if (probe_kernel_address((insn_size_t *)addr, opcode))
30 return 0; 45 return 0;
46 if (opcode == TRAPA_BUG_OPCODE)
47 return 1;
31 48
32 return opcode == TRAPA_BUG_OPCODE; 49 return 0;
33} 50}
34#endif 51#endif
35 52
@@ -75,3 +92,23 @@ BUILD_TRAP_HANDLER(bug)
75 92
76 force_sig(SIGTRAP, current); 93 force_sig(SIGTRAP, current);
77} 94}
95
96BUILD_TRAP_HANDLER(nmi)
97{
98 TRAP_HANDLER_DECL;
99
100 nmi_enter();
101
102 switch (notify_die(DIE_NMI, "NMI", regs, 0, vec & 0xff, SIGINT)) {
103 case NOTIFY_OK:
104 case NOTIFY_STOP:
105 break;
106 case NOTIFY_BAD:
107 die("Fatal Non-Maskable Interrupt", regs, SIGINT);
108 default:
109 printk(KERN_ALERT "Got NMI, but nobody cared. Ignoring...\n");
110 break;
111 }
112
113 nmi_exit();
114}
diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 2b772776fcd..6aba9af79ea 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -24,6 +24,7 @@
24#include <linux/kdebug.h> 24#include <linux/kdebug.h>
25#include <linux/kexec.h> 25#include <linux/kexec.h>
26#include <linux/limits.h> 26#include <linux/limits.h>
27#include <linux/proc_fs.h>
27#include <asm/system.h> 28#include <asm/system.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
29#include <asm/fpu.h> 30#include <asm/fpu.h>
@@ -44,6 +45,85 @@
44#define TRAP_ILLEGAL_SLOT_INST 13 45#define TRAP_ILLEGAL_SLOT_INST 13
45#endif 46#endif
46 47
48static unsigned long se_user;
49static unsigned long se_sys;
50static unsigned long se_half;
51static unsigned long se_word;
52static unsigned long se_dword;
53static unsigned long se_multi;
54/* bitfield: 1: warn 2: fixup 4: signal -> combinations 2|4 && 1|2|4 are not
55 valid! */
56static int se_usermode = 3;
57/* 0: no warning 1: print a warning message */
58static int se_kernmode_warn = 1;
59
60#ifdef CONFIG_PROC_FS
61static const char *se_usermode_action[] = {
62 "ignored",
63 "warn",
64 "fixup",
65 "fixup+warn",
66 "signal",
67 "signal+warn"
68};
69
70static int
71proc_alignment_read(char *page, char **start, off_t off, int count, int *eof,
72 void *data)
73{
74 char *p = page;
75 int len;
76
77 p += sprintf(p, "User:\t\t%lu\n", se_user);
78 p += sprintf(p, "System:\t\t%lu\n", se_sys);
79 p += sprintf(p, "Half:\t\t%lu\n", se_half);
80 p += sprintf(p, "Word:\t\t%lu\n", se_word);
81 p += sprintf(p, "DWord:\t\t%lu\n", se_dword);
82 p += sprintf(p, "Multi:\t\t%lu\n", se_multi);
83 p += sprintf(p, "User faults:\t%i (%s)\n", se_usermode,
84 se_usermode_action[se_usermode]);
85 p += sprintf(p, "Kernel faults:\t%i (fixup%s)\n", se_kernmode_warn,
86 se_kernmode_warn ? "+warn" : "");
87
88 len = (p - page) - off;
89 if (len < 0)
90 len = 0;
91
92 *eof = (len <= count) ? 1 : 0;
93 *start = page + off;
94
95 return len;
96}
97
98static int proc_alignment_write(struct file *file, const char __user *buffer,
99 unsigned long count, void *data)
100{
101 char mode;
102
103 if (count > 0) {
104 if (get_user(mode, buffer))
105 return -EFAULT;
106 if (mode >= '0' && mode <= '5')
107 se_usermode = mode - '0';
108 }
109 return count;
110}
111
112static int proc_alignment_kern_write(struct file *file, const char __user *buffer,
113 unsigned long count, void *data)
114{
115 char mode;
116
117 if (count > 0) {
118 if (get_user(mode, buffer))
119 return -EFAULT;
120 if (mode >= '0' && mode <= '1')
121 se_kernmode_warn = mode - '0';
122 }
123 return count;
124}
125#endif
126
47static void dump_mem(const char *str, unsigned long bottom, unsigned long top) 127static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
48{ 128{
49 unsigned long p; 129 unsigned long p;
@@ -136,6 +216,7 @@ static void die_if_no_fixup(const char * str, struct pt_regs * regs, long err)
136 regs->pc = fixup->fixup; 216 regs->pc = fixup->fixup;
137 return; 217 return;
138 } 218 }
219
139 die(str, regs, err); 220 die(str, regs, err);
140 } 221 }
141} 222}
@@ -193,6 +274,13 @@ static int handle_unaligned_ins(insn_size_t instruction, struct pt_regs *regs,
193 274
194 count = 1<<(instruction&3); 275 count = 1<<(instruction&3);
195 276
277 switch (count) {
278 case 1: se_half += 1; break;
279 case 2: se_word += 1; break;
280 case 4: se_dword += 1; break;
281 case 8: se_multi += 1; break; /* ??? */
282 }
283
196 ret = -EFAULT; 284 ret = -EFAULT;
197 switch (instruction>>12) { 285 switch (instruction>>12) {
198 case 0: /* mov.[bwl] to/from memory via r0+rn */ 286 case 0: /* mov.[bwl] to/from memory via r0+rn */
@@ -358,15 +446,8 @@ static inline int handle_delayslot(struct pt_regs *regs,
358#define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4) 446#define SH_PC_8BIT_OFFSET(instr) ((((signed char)(instr))*2) + 4)
359#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4) 447#define SH_PC_12BIT_OFFSET(instr) ((((signed short)(instr<<4))>>3) + 4)
360 448
361/*
362 * XXX: SH-2A needs this too, but it needs an overhaul thanks to mixed 32-bit
363 * opcodes..
364 */
365
366static int handle_unaligned_notify_count = 10;
367
368int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs, 449int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
369 struct mem_access *ma) 450 struct mem_access *ma, int expected)
370{ 451{
371 u_int rm; 452 u_int rm;
372 int ret, index; 453 int ret, index;
@@ -374,15 +455,13 @@ int handle_unaligned_access(insn_size_t instruction, struct pt_regs *regs,
374 index = (instruction>>8)&15; /* 0x0F00 */ 455 index = (instruction>>8)&15; /* 0x0F00 */
375 rm = regs->regs[index]; 456 rm = regs->regs[index];
376 457
377 /* shout about the first ten userspace fixups */ 458 /* shout about fixups */
378 if (user_mode(regs) && handle_unaligned_notify_count>0) { 459 if (!expected && printk_ratelimit())
379 handle_unaligned_notify_count--; 460 printk(KERN_NOTICE "Fixing up unaligned %s access "
380
381 printk(KERN_NOTICE "Fixing up unaligned userspace access "
382 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n", 461 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
462 user_mode(regs) ? "userspace" : "kernel",
383 current->comm, task_pid_nr(current), 463 current->comm, task_pid_nr(current),
384 (void *)regs->pc, instruction); 464 (void *)regs->pc, instruction);
385 }
386 465
387 ret = -EFAULT; 466 ret = -EFAULT;
388 switch (instruction&0xF000) { 467 switch (instruction&0xF000) {
@@ -538,6 +617,36 @@ asmlinkage void do_address_error(struct pt_regs *regs,
538 617
539 local_irq_enable(); 618 local_irq_enable();
540 619
620 se_user += 1;
621
622#ifndef CONFIG_CPU_SH2A
623 set_fs(USER_DS);
624 if (copy_from_user(&instruction, (u16 *)(regs->pc & ~1), 2)) {
625 set_fs(oldfs);
626 goto uspace_segv;
627 }
628 set_fs(oldfs);
629
630 /* shout about userspace fixups */
631 if (se_usermode & 1)
632 printk(KERN_NOTICE "Unaligned userspace access "
633 "in \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
634 current->comm, current->pid, (void *)regs->pc,
635 instruction);
636#endif
637
638 if (se_usermode & 2)
639 goto fixup;
640
641 if (se_usermode & 4)
642 goto uspace_segv;
643 else {
644 /* ignore */
645 regs->pc += instruction_size(instruction);
646 return;
647 }
648
649fixup:
541 /* bad PC is not something we can fix */ 650 /* bad PC is not something we can fix */
542 if (regs->pc & 1) { 651 if (regs->pc & 1) {
543 si_code = BUS_ADRALN; 652 si_code = BUS_ADRALN;
@@ -545,17 +654,8 @@ asmlinkage void do_address_error(struct pt_regs *regs,
545 } 654 }
546 655
547 set_fs(USER_DS); 656 set_fs(USER_DS);
548 if (copy_from_user(&instruction, (void __user *)(regs->pc),
549 sizeof(instruction))) {
550 /* Argh. Fault on the instruction itself.
551 This should never happen non-SMP
552 */
553 set_fs(oldfs);
554 goto uspace_segv;
555 }
556
557 tmp = handle_unaligned_access(instruction, regs, 657 tmp = handle_unaligned_access(instruction, regs,
558 &user_mem_access); 658 &user_mem_access, 0);
559 set_fs(oldfs); 659 set_fs(oldfs);
560 660
561 if (tmp==0) 661 if (tmp==0)
@@ -571,6 +671,14 @@ uspace_segv:
571 info.si_addr = (void __user *)address; 671 info.si_addr = (void __user *)address;
572 force_sig_info(SIGBUS, &info, current); 672 force_sig_info(SIGBUS, &info, current);
573 } else { 673 } else {
674 se_sys += 1;
675
676 if (se_kernmode_warn)
677 printk(KERN_NOTICE "Unaligned kernel access "
678 "on behalf of \"%s\" pid=%d pc=0x%p ins=0x%04hx\n",
679 current->comm, current->pid, (void *)regs->pc,
680 instruction);
681
574 if (regs->pc & 1) 682 if (regs->pc & 1)
575 die("unaligned program counter", regs, error_code); 683 die("unaligned program counter", regs, error_code);
576 684
@@ -584,7 +692,8 @@ uspace_segv:
584 die("insn faulting in do_address_error", regs, 0); 692 die("insn faulting in do_address_error", regs, 0);
585 } 693 }
586 694
587 handle_unaligned_access(instruction, regs, &user_mem_access); 695 handle_unaligned_access(instruction, regs,
696 &user_mem_access, 0);
588 set_fs(oldfs); 697 set_fs(oldfs);
589 } 698 }
590} 699}
@@ -858,30 +967,6 @@ void __init trap_init(void)
858 per_cpu_trap_init(); 967 per_cpu_trap_init();
859} 968}
860 969
861void show_trace(struct task_struct *tsk, unsigned long *sp,
862 struct pt_regs *regs)
863{
864 unsigned long addr;
865
866 if (regs && user_mode(regs))
867 return;
868
869 printk("\nCall trace:\n");
870
871 while (!kstack_end(sp)) {
872 addr = *sp++;
873 if (kernel_text_address(addr))
874 print_ip_sym(addr);
875 }
876
877 printk("\n");
878
879 if (!tsk)
880 tsk = current;
881
882 debug_show_held_locks(tsk);
883}
884
885void show_stack(struct task_struct *tsk, unsigned long *sp) 970void show_stack(struct task_struct *tsk, unsigned long *sp)
886{ 971{
887 unsigned long stack; 972 unsigned long stack;
@@ -904,3 +989,38 @@ void dump_stack(void)
904 show_stack(NULL, NULL); 989 show_stack(NULL, NULL);
905} 990}
906EXPORT_SYMBOL(dump_stack); 991EXPORT_SYMBOL(dump_stack);
992
993#ifdef CONFIG_PROC_FS
994/*
995 * This needs to be done after sysctl_init, otherwise sys/ will be
996 * overwritten. Actually, this shouldn't be in sys/ at all since
997 * it isn't a sysctl, and it doesn't contain sysctl information.
998 * We now locate it in /proc/cpu/alignment instead.
999 */
1000static int __init alignment_init(void)
1001{
1002 struct proc_dir_entry *dir, *res;
1003
1004 dir = proc_mkdir("cpu", NULL);
1005 if (!dir)
1006 return -ENOMEM;
1007
1008 res = create_proc_entry("alignment", S_IWUSR | S_IRUGO, dir);
1009 if (!res)
1010 return -ENOMEM;
1011
1012 res->read_proc = proc_alignment_read;
1013 res->write_proc = proc_alignment_write;
1014
1015 res = create_proc_entry("kernel_alignment", S_IWUSR | S_IRUGO, dir);
1016 if (!res)
1017 return -ENOMEM;
1018
1019 res->read_proc = proc_alignment_read;
1020 res->write_proc = proc_alignment_kern_write;
1021
1022 return 0;
1023}
1024
1025fs_initcall(alignment_init);
1026#endif
diff --git a/arch/sh/kernel/unwinder.c b/arch/sh/kernel/unwinder.c
new file mode 100644
index 00000000000..468889d958f
--- /dev/null
+++ b/arch/sh/kernel/unwinder.c
@@ -0,0 +1,164 @@
1/*
2 * Copyright (C) 2009 Matt Fleming
3 *
4 * Based, in part, on kernel/time/clocksource.c.
5 *
6 * This file provides arbitration code for stack unwinders.
7 *
8 * Multiple stack unwinders can be available on a system, usually with
9 * the most accurate unwinder being the currently active one.
10 */
11#include <linux/errno.h>
12#include <linux/list.h>
13#include <linux/spinlock.h>
14#include <linux/module.h>
15#include <asm/unwinder.h>
16#include <asm/atomic.h>
17
18/*
19 * This is the most basic stack unwinder an architecture can
20 * provide. For architectures without reliable frame pointers, e.g.
21 * RISC CPUs, it can be implemented by looking through the stack for
22 * addresses that lie within the kernel text section.
23 *
24 * Other CPUs, e.g. x86, can use their frame pointer register to
25 * construct more accurate stack traces.
26 */
27static struct list_head unwinder_list;
28static struct unwinder stack_reader = {
29 .name = "stack-reader",
30 .dump = stack_reader_dump,
31 .rating = 50,
32 .list = {
33 .next = &unwinder_list,
34 .prev = &unwinder_list,
35 },
36};
37
38/*
39 * "curr_unwinder" points to the stack unwinder currently in use. This
40 * is the unwinder with the highest rating.
41 *
42 * "unwinder_list" is a linked-list of all available unwinders, sorted
43 * by rating.
44 *
45 * All modifications of "curr_unwinder" and "unwinder_list" must be
46 * performed whilst holding "unwinder_lock".
47 */
48static struct unwinder *curr_unwinder = &stack_reader;
49
50static struct list_head unwinder_list = {
51 .next = &stack_reader.list,
52 .prev = &stack_reader.list,
53};
54
55static DEFINE_SPINLOCK(unwinder_lock);
56
57/**
58 * select_unwinder - Select the best registered stack unwinder.
59 *
60 * Private function. Must hold unwinder_lock when called.
61 *
62 * Select the stack unwinder with the best rating. This is useful for
63 * setting up curr_unwinder.
64 */
65static struct unwinder *select_unwinder(void)
66{
67 struct unwinder *best;
68
69 if (list_empty(&unwinder_list))
70 return NULL;
71
72 best = list_entry(unwinder_list.next, struct unwinder, list);
73 if (best == curr_unwinder)
74 return NULL;
75
76 return best;
77}
78
79/*
80 * Enqueue the stack unwinder sorted by rating.
81 */
82static int unwinder_enqueue(struct unwinder *ops)
83{
84 struct list_head *tmp, *entry = &unwinder_list;
85
86 list_for_each(tmp, &unwinder_list) {
87 struct unwinder *o;
88
89 o = list_entry(tmp, struct unwinder, list);
90 if (o == ops)
91 return -EBUSY;
92 /* Keep track of the place, where to insert */
93 if (o->rating >= ops->rating)
94 entry = tmp;
95 }
96 list_add(&ops->list, entry);
97
98 return 0;
99}
100
101/**
102 * unwinder_register - Used to install new stack unwinder
103 * @u: unwinder to be registered
104 *
105 * Install the new stack unwinder on the unwinder list, which is sorted
106 * by rating.
107 *
108 * Returns -EBUSY if registration fails, zero otherwise.
109 */
110int unwinder_register(struct unwinder *u)
111{
112 unsigned long flags;
113 int ret;
114
115 spin_lock_irqsave(&unwinder_lock, flags);
116 ret = unwinder_enqueue(u);
117 if (!ret)
118 curr_unwinder = select_unwinder();
119 spin_unlock_irqrestore(&unwinder_lock, flags);
120
121 return ret;
122}
123
124int unwinder_faulted = 0;
125
126/*
127 * Unwind the call stack and pass information to the stacktrace_ops
128 * functions. Also handle the case where we need to switch to a new
129 * stack dumper because the current one faulted unexpectedly.
130 */
131void unwind_stack(struct task_struct *task, struct pt_regs *regs,
132 unsigned long *sp, const struct stacktrace_ops *ops,
133 void *data)
134{
135 unsigned long flags;
136
137 /*
138 * The problem with unwinders with high ratings is that they are
139 * inherently more complicated than the simple ones with lower
140 * ratings. We are therefore more likely to fault in the
141 * complicated ones, e.g. hitting BUG()s. If we fault in the
142 * code for the current stack unwinder we try to downgrade to
143 * one with a lower rating.
144 *
145 * Hopefully this will give us a semi-reliable stacktrace so we
146 * can diagnose why curr_unwinder->dump() faulted.
147 */
148 if (unwinder_faulted) {
149 spin_lock_irqsave(&unwinder_lock, flags);
150
151 /* Make sure no one beat us to changing the unwinder */
152 if (unwinder_faulted && !list_is_singular(&unwinder_list)) {
153 list_del(&curr_unwinder->list);
154 curr_unwinder = select_unwinder();
155
156 unwinder_faulted = 0;
157 }
158
159 spin_unlock_irqrestore(&unwinder_lock, flags);
160 }
161
162 curr_unwinder->dump(task, regs, sp, ops, data);
163}
164EXPORT_SYMBOL_GPL(unwind_stack);
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S
index 0ce254bca92..a1e4ec24f1f 100644
--- a/arch/sh/kernel/vmlinux.lds.S
+++ b/arch/sh/kernel/vmlinux.lds.S
@@ -12,7 +12,7 @@ OUTPUT_ARCH(sh)
12 12
13#include <asm/thread_info.h> 13#include <asm/thread_info.h>
14#include <asm/cache.h> 14#include <asm/cache.h>
15#include <asm-generic/vmlinux.lds.h> 15#include <asm/vmlinux.lds.h>
16 16
17ENTRY(_start) 17ENTRY(_start)
18SECTIONS 18SECTIONS
@@ -50,12 +50,7 @@ SECTIONS
50 _etext = .; /* End of text section */ 50 _etext = .; /* End of text section */
51 } = 0x0009 51 } = 0x0009
52 52
53 . = ALIGN(16); /* Exception table */ 53 EXCEPTION_TABLE(16)
54 __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) {
55 __start___ex_table = .;
56 *(__ex_table)
57 __stop___ex_table = .;
58 }
59 54
60 NOTES 55 NOTES
61 RO_DATA(PAGE_SIZE) 56 RO_DATA(PAGE_SIZE)
@@ -71,69 +66,16 @@ SECTIONS
71 __uncached_end = .; 66 __uncached_end = .;
72 } 67 }
73 68
74 . = ALIGN(THREAD_SIZE); 69 RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
75 .data : AT(ADDR(.data) - LOAD_OFFSET) { /* Data */
76 *(.data.init_task)
77
78 . = ALIGN(L1_CACHE_BYTES);
79 *(.data.cacheline_aligned)
80
81 . = ALIGN(L1_CACHE_BYTES);
82 *(.data.read_mostly)
83
84 . = ALIGN(PAGE_SIZE);
85 *(.data.page_aligned)
86
87 __nosave_begin = .;
88 *(.data.nosave)
89 . = ALIGN(PAGE_SIZE);
90 __nosave_end = .;
91
92 DATA_DATA
93 CONSTRUCTORS
94 }
95 70
96 _edata = .; /* End of data section */ 71 _edata = .; /* End of data section */
97 72
98 . = ALIGN(PAGE_SIZE); /* Init code and data */ 73 DWARF_EH_FRAME
99 .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) {
100 __init_begin = .;
101 _sinittext = .;
102 INIT_TEXT
103 _einittext = .;
104 }
105
106 .init.data : AT(ADDR(.init.data) - LOAD_OFFSET) { INIT_DATA }
107
108 . = ALIGN(16);
109 .init.setup : AT(ADDR(.init.setup) - LOAD_OFFSET) {
110 __setup_start = .;
111 *(.init.setup)
112 __setup_end = .;
113 }
114
115 .initcall.init : AT(ADDR(.initcall.init) - LOAD_OFFSET) {
116 __initcall_start = .;
117 INITCALLS
118 __initcall_end = .;
119 }
120
121 .con_initcall.init : AT(ADDR(.con_initcall.init) - LOAD_OFFSET) {
122 __con_initcall_start = .;
123 *(.con_initcall.init)
124 __con_initcall_end = .;
125 }
126
127 SECURITY_INIT
128 74
129#ifdef CONFIG_BLK_DEV_INITRD 75 . = ALIGN(PAGE_SIZE); /* Init code and data */
130 . = ALIGN(PAGE_SIZE); 76 __init_begin = .;
131 .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 77 INIT_TEXT_SECTION(PAGE_SIZE)
132 __initramfs_start = .; 78 INIT_DATA_SECTION(16)
133 *(.init.ramfs)
134 __initramfs_end = .;
135 }
136#endif
137 79
138 . = ALIGN(4); 80 . = ALIGN(4);
139 .machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) { 81 .machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) {
@@ -152,25 +94,13 @@ SECTIONS
152 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA } 94 .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA }
153 95
154 . = ALIGN(PAGE_SIZE); 96 . = ALIGN(PAGE_SIZE);
155 .bss : AT(ADDR(.bss) - LOAD_OFFSET) { 97 __init_end = .;
156 __init_end = .; 98 BSS_SECTION(0, PAGE_SIZE, 4)
157 __bss_start = .; /* BSS */ 99 _ebss = .; /* uClinux MTD sucks */
158 *(.bss.page_aligned) 100 _end = . ;
159 *(.bss)
160 *(COMMON)
161 . = ALIGN(4);
162 _ebss = .; /* uClinux MTD sucks */
163 _end = . ;
164 }
165 101
166 STABS_DEBUG 102 STABS_DEBUG
167 DWARF_DEBUG 103 DWARF_DEBUG
168 104
169 /*
170 * When something in the kernel is NOT compiled as a module, the
171 * module cleanup code and data are put into these segments. Both
172 * can then be thrown away, as cleanup code is never called unless
173 * it's a module.
174 */
175 DISCARDS 105 DISCARDS
176} 106}
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile
index aaea580b65b..a969b47c546 100644
--- a/arch/sh/lib/Makefile
+++ b/arch/sh/lib/Makefile
@@ -23,8 +23,8 @@ obj-y += io.o
23memcpy-y := memcpy.o 23memcpy-y := memcpy.o
24memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o 24memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o
25 25
26lib-$(CONFIG_MMU) += copy_page.o clear_page.o 26lib-$(CONFIG_MMU) += copy_page.o __clear_user.o
27lib-$(CONFIG_FUNCTION_TRACER) += mcount.o 27lib-$(CONFIG_MCOUNT) += mcount.o
28lib-y += $(memcpy-y) $(udivsi3-y) 28lib-y += $(memcpy-y) $(udivsi3-y)
29 29
30EXTRA_CFLAGS += -Werror 30EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/lib/clear_page.S b/arch/sh/lib/__clear_user.S
index 8342bfbde64..db1dca7aad1 100644
--- a/arch/sh/lib/clear_page.S
+++ b/arch/sh/lib/__clear_user.S
@@ -8,56 +8,10 @@
8#include <linux/linkage.h> 8#include <linux/linkage.h>
9#include <asm/page.h> 9#include <asm/page.h>
10 10
11/*
12 * clear_page
13 * @to: P1 address
14 *
15 * void clear_page(void *to)
16 */
17
18/*
19 * r0 --- scratch
20 * r4 --- to
21 * r5 --- to + PAGE_SIZE
22 */
23ENTRY(clear_page)
24 mov r4,r5
25 mov.l .Llimit,r0
26 add r0,r5
27 mov #0,r0
28 !
291:
30#if defined(CONFIG_CPU_SH4)
31 movca.l r0,@r4
32 mov r4,r1
33#else
34 mov.l r0,@r4
35#endif
36 add #32,r4
37 mov.l r0,@-r4
38 mov.l r0,@-r4
39 mov.l r0,@-r4
40 mov.l r0,@-r4
41 mov.l r0,@-r4
42 mov.l r0,@-r4
43 mov.l r0,@-r4
44#if defined(CONFIG_CPU_SH4)
45 ocbwb @r1
46#endif
47 cmp/eq r5,r4
48 bf/s 1b
49 add #28,r4
50 !
51 rts
52 nop
53
54 .balign 4
55.Llimit: .long (PAGE_SIZE-28)
56
57ENTRY(__clear_user) 11ENTRY(__clear_user)
58 ! 12 !
59 mov #0, r0 13 mov #0, r0
60 mov #0xe0, r1 ! 0xffffffe0 14 mov #0xffffffe0, r1
61 ! 15 !
62 ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ] 16 ! r4..(r4+31)&~32 -------- not aligned [ Area 0 ]
63 ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ] 17 ! (r4+31)&~32..(r4+r5)&~32 -------- aligned [ Area 1 ]
diff --git a/arch/sh/lib/copy_page.S b/arch/sh/lib/copy_page.S
index 43de7e8e4e1..9d7b8bc5186 100644
--- a/arch/sh/lib/copy_page.S
+++ b/arch/sh/lib/copy_page.S
@@ -30,7 +30,9 @@ ENTRY(copy_page)
30 mov r4,r10 30 mov r4,r10
31 mov r5,r11 31 mov r5,r11
32 mov r5,r8 32 mov r5,r8
33 mov.l .Lpsz,r0 33 mov #(PAGE_SIZE >> 10), r0
34 shll8 r0
35 shll2 r0
34 add r0,r8 36 add r0,r8
35 ! 37 !
361: mov.l @r11+,r0 381: mov.l @r11+,r0
@@ -43,7 +45,6 @@ ENTRY(copy_page)
43 mov.l @r11+,r7 45 mov.l @r11+,r7
44#if defined(CONFIG_CPU_SH4) 46#if defined(CONFIG_CPU_SH4)
45 movca.l r0,@r10 47 movca.l r0,@r10
46 mov r10,r0
47#else 48#else
48 mov.l r0,@r10 49 mov.l r0,@r10
49#endif 50#endif
@@ -55,9 +56,6 @@ ENTRY(copy_page)
55 mov.l r3,@-r10 56 mov.l r3,@-r10
56 mov.l r2,@-r10 57 mov.l r2,@-r10
57 mov.l r1,@-r10 58 mov.l r1,@-r10
58#if defined(CONFIG_CPU_SH4)
59 ocbwb @r0
60#endif
61 cmp/eq r11,r8 59 cmp/eq r11,r8
62 bf/s 1b 60 bf/s 1b
63 add #28,r10 61 add #28,r10
@@ -68,9 +66,6 @@ ENTRY(copy_page)
68 rts 66 rts
69 nop 67 nop
70 68
71 .balign 4
72.Lpsz: .long PAGE_SIZE
73
74/* 69/*
75 * __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n); 70 * __kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n);
76 * Return the number of bytes NOT copied 71 * Return the number of bytes NOT copied
diff --git a/arch/sh/lib/delay.c b/arch/sh/lib/delay.c
index f3ddd2133e6..faa8f86c0db 100644
--- a/arch/sh/lib/delay.c
+++ b/arch/sh/lib/delay.c
@@ -21,13 +21,14 @@ void __delay(unsigned long loops)
21 21
22inline void __const_udelay(unsigned long xloops) 22inline void __const_udelay(unsigned long xloops)
23{ 23{
24 xloops *= 4;
24 __asm__("dmulu.l %0, %2\n\t" 25 __asm__("dmulu.l %0, %2\n\t"
25 "sts mach, %0" 26 "sts mach, %0"
26 : "=r" (xloops) 27 : "=r" (xloops)
27 : "0" (xloops), 28 : "0" (xloops),
28 "r" (HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) 29 "r" (cpu_data[raw_smp_processor_id()].loops_per_jiffy * (HZ/4))
29 : "macl", "mach"); 30 : "macl", "mach");
30 __delay(xloops); 31 __delay(++xloops);
31} 32}
32 33
33void __udelay(unsigned long usecs) 34void __udelay(unsigned long usecs)
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S
index 110fbfe1831..84a57761f17 100644
--- a/arch/sh/lib/mcount.S
+++ b/arch/sh/lib/mcount.S
@@ -1,14 +1,16 @@
1/* 1/*
2 * arch/sh/lib/mcount.S 2 * arch/sh/lib/mcount.S
3 * 3 *
4 * Copyright (C) 2008 Paul Mundt 4 * Copyright (C) 2008, 2009 Paul Mundt
5 * Copyright (C) 2008 Matt Fleming 5 * Copyright (C) 2008, 2009 Matt Fleming
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General Public 7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive 8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details. 9 * for more details.
10 */ 10 */
11#include <asm/ftrace.h> 11#include <asm/ftrace.h>
12#include <asm/thread_info.h>
13#include <asm/asm-offsets.h>
12 14
13#define MCOUNT_ENTER() \ 15#define MCOUNT_ENTER() \
14 mov.l r4, @-r15; \ 16 mov.l r4, @-r15; \
@@ -28,6 +30,55 @@
28 rts; \ 30 rts; \
29 mov.l @r15+, r4 31 mov.l @r15+, r4
30 32
33#ifdef CONFIG_STACK_DEBUG
34/*
35 * Perform diagnostic checks on the state of the kernel stack.
36 *
37 * Check for stack overflow. If there is less than 1KB free
38 * then it has overflowed.
39 *
40 * Make sure the stack pointer contains a valid address. Valid
41 * addresses for kernel stacks are anywhere after the bss
42 * (after _ebss) and anywhere in init_thread_union (init_stack).
43 */
44#define STACK_CHECK() \
45 mov #(THREAD_SIZE >> 10), r0; \
46 shll8 r0; \
47 shll2 r0; \
48 \
49 /* r1 = sp & (THREAD_SIZE - 1) */ \
50 mov #-1, r1; \
51 add r0, r1; \
52 and r15, r1; \
53 \
54 mov #TI_SIZE, r3; \
55 mov #(STACK_WARN >> 8), r2; \
56 shll8 r2; \
57 add r3, r2; \
58 \
59 /* Is the stack overflowing? */ \
60 cmp/hi r2, r1; \
61 bf stack_panic; \
62 \
63 /* If sp > _ebss then we're OK. */ \
64 mov.l .L_ebss, r1; \
65 cmp/hi r1, r15; \
66 bt 1f; \
67 \
68 /* If sp < init_stack, we're not OK. */ \
69 mov.l .L_init_thread_union, r1; \
70 cmp/hs r1, r15; \
71 bf stack_panic; \
72 \
73 /* If sp > init_stack && sp < _ebss, not OK. */ \
74 add r0, r1; \
75 cmp/hs r1, r15; \
76 bt stack_panic; \
771:
78#else
79#define STACK_CHECK()
80#endif /* CONFIG_STACK_DEBUG */
81
31 .align 2 82 .align 2
32 .globl _mcount 83 .globl _mcount
33 .type _mcount,@function 84 .type _mcount,@function
@@ -35,6 +86,19 @@
35 .type mcount,@function 86 .type mcount,@function
36_mcount: 87_mcount:
37mcount: 88mcount:
89 STACK_CHECK()
90
91#ifndef CONFIG_FUNCTION_TRACER
92 rts
93 nop
94#else
95#ifndef CONFIG_DYNAMIC_FTRACE
96 mov.l .Lfunction_trace_stop, r0
97 mov.l @r0, r0
98 tst r0, r0
99 bf ftrace_stub
100#endif
101
38 MCOUNT_ENTER() 102 MCOUNT_ENTER()
39 103
40#ifdef CONFIG_DYNAMIC_FTRACE 104#ifdef CONFIG_DYNAMIC_FTRACE
@@ -52,16 +116,69 @@ mcount_call:
52 jsr @r6 116 jsr @r6
53 nop 117 nop
54 118
119#ifdef CONFIG_FUNCTION_GRAPH_TRACER
120 mov.l .Lftrace_graph_return, r6
121 mov.l .Lftrace_stub, r7
122 cmp/eq r6, r7
123 bt 1f
124
125 mov.l .Lftrace_graph_caller, r0
126 jmp @r0
127 nop
128
1291:
130 mov.l .Lftrace_graph_entry, r6
131 mov.l .Lftrace_graph_entry_stub, r7
132 cmp/eq r6, r7
133 bt skip_trace
134
135 mov.l .Lftrace_graph_caller, r0
136 jmp @r0
137 nop
138
139 .align 2
140.Lftrace_graph_return:
141 .long ftrace_graph_return
142.Lftrace_graph_entry:
143 .long ftrace_graph_entry
144.Lftrace_graph_entry_stub:
145 .long ftrace_graph_entry_stub
146.Lftrace_graph_caller:
147 .long ftrace_graph_caller
148#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
149
150 .globl skip_trace
55skip_trace: 151skip_trace:
56 MCOUNT_LEAVE() 152 MCOUNT_LEAVE()
57 153
58 .align 2 154 .align 2
59.Lftrace_trace_function: 155.Lftrace_trace_function:
60 .long ftrace_trace_function 156 .long ftrace_trace_function
61 157
62#ifdef CONFIG_DYNAMIC_FTRACE 158#ifdef CONFIG_DYNAMIC_FTRACE
159#ifdef CONFIG_FUNCTION_GRAPH_TRACER
160/*
161 * NOTE: Do not move either ftrace_graph_call or ftrace_caller
162 * as this will affect the calculation of GRAPH_INSN_OFFSET.
163 */
164 .globl ftrace_graph_call
165ftrace_graph_call:
166 mov.l .Lskip_trace, r0
167 jmp @r0
168 nop
169
170 .align 2
171.Lskip_trace:
172 .long skip_trace
173#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
174
63 .globl ftrace_caller 175 .globl ftrace_caller
64ftrace_caller: 176ftrace_caller:
177 mov.l .Lfunction_trace_stop, r0
178 mov.l @r0, r0
179 tst r0, r0
180 bf ftrace_stub
181
65 MCOUNT_ENTER() 182 MCOUNT_ENTER()
66 183
67 .globl ftrace_call 184 .globl ftrace_call
@@ -70,9 +187,18 @@ ftrace_call:
70 jsr @r6 187 jsr @r6
71 nop 188 nop
72 189
190#ifdef CONFIG_FUNCTION_GRAPH_TRACER
191 bra ftrace_graph_call
192 nop
193#else
73 MCOUNT_LEAVE() 194 MCOUNT_LEAVE()
195#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
74#endif /* CONFIG_DYNAMIC_FTRACE */ 196#endif /* CONFIG_DYNAMIC_FTRACE */
75 197
198 .align 2
199.Lfunction_trace_stop:
200 .long function_trace_stop
201
76/* 202/*
77 * NOTE: From here on the locations of the .Lftrace_stub label and 203 * NOTE: From here on the locations of the .Lftrace_stub label and
78 * ftrace_stub itself are fixed. Adding additional data here will skew 204 * ftrace_stub itself are fixed. Adding additional data here will skew
@@ -80,7 +206,6 @@ ftrace_call:
80 * Place new labels either after the ftrace_stub body, or before 206 * Place new labels either after the ftrace_stub body, or before
81 * ftrace_caller. You have been warned. 207 * ftrace_caller. You have been warned.
82 */ 208 */
83 .align 2
84.Lftrace_stub: 209.Lftrace_stub:
85 .long ftrace_stub 210 .long ftrace_stub
86 211
@@ -88,3 +213,98 @@ ftrace_call:
88ftrace_stub: 213ftrace_stub:
89 rts 214 rts
90 nop 215 nop
216
217#ifdef CONFIG_FUNCTION_GRAPH_TRACER
218 .globl ftrace_graph_caller
219ftrace_graph_caller:
220 mov.l 2f, r0
221 mov.l @r0, r0
222 tst r0, r0
223 bt 1f
224
225 mov.l 3f, r1
226 jmp @r1
227 nop
2281:
229 /*
230 * MCOUNT_ENTER() pushed 5 registers onto the stack, so
231 * the stack address containing our return address is
232 * r15 + 20.
233 */
234 mov #20, r0
235 add r15, r0
236 mov r0, r4
237
238 mov.l .Lprepare_ftrace_return, r0
239 jsr @r0
240 nop
241
242 MCOUNT_LEAVE()
243
244 .align 2
2452: .long function_trace_stop
2463: .long skip_trace
247.Lprepare_ftrace_return:
248 .long prepare_ftrace_return
249
250 .globl return_to_handler
251return_to_handler:
252 /*
253 * Save the return values.
254 */
255 mov.l r0, @-r15
256 mov.l r1, @-r15
257
258 mov #0, r4
259
260 mov.l .Lftrace_return_to_handler, r0
261 jsr @r0
262 nop
263
264 /*
265 * The return value from ftrace_return_handler has the real
266 * address that we should return to.
267 */
268 lds r0, pr
269 mov.l @r15+, r1
270 rts
271 mov.l @r15+, r0
272
273
274 .align 2
275.Lftrace_return_to_handler:
276 .long ftrace_return_to_handler
277#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
278#endif /* CONFIG_FUNCTION_TRACER */
279
280#ifdef CONFIG_STACK_DEBUG
281 .globl stack_panic
282stack_panic:
283 mov.l .Ldump_stack, r0
284 jsr @r0
285 nop
286
287 mov.l .Lpanic, r0
288 jsr @r0
289 mov.l .Lpanic_s, r4
290
291 rts
292 nop
293
294 .align 2
295.L_ebss:
296 .long _ebss
297.L_init_thread_union:
298 .long init_thread_union
299.Lpanic:
300 .long panic
301.Lpanic_s:
302 .long .Lpanic_str
303.Ldump_stack:
304 .long dump_stack
305
306 .section .rodata
307 .align 2
308.Lpanic_str:
309 .string "Stack error"
310#endif /* CONFIG_STACK_DEBUG */
diff --git a/arch/sh/lib64/Makefile b/arch/sh/lib64/Makefile
index 334bb2da36e..1fee75aa1f9 100644
--- a/arch/sh/lib64/Makefile
+++ b/arch/sh/lib64/Makefile
@@ -11,7 +11,7 @@
11 11
12# Panic should really be compiled as PIC 12# Panic should really be compiled as PIC
13lib-y := udelay.o dbg.o panic.o memcpy.o memset.o \ 13lib-y := udelay.o dbg.o panic.o memcpy.o memset.o \
14 copy_user_memcpy.o copy_page.o clear_page.o strcpy.o strlen.o 14 copy_user_memcpy.o copy_page.o strcpy.o strlen.o
15 15
16# Extracted from libgcc 16# Extracted from libgcc
17lib-y += udivsi3.o udivdi3.o sdivsi3.o 17lib-y += udivsi3.o udivdi3.o sdivsi3.o
diff --git a/arch/sh/lib64/clear_page.S b/arch/sh/lib64/clear_page.S
deleted file mode 100644
index 007ab48ecc1..00000000000
--- a/arch/sh/lib64/clear_page.S
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 Copyright 2003 Richard Curnow, SuperH (UK) Ltd.
3
4 This file is subject to the terms and conditions of the GNU General Public
5 License. See the file "COPYING" in the main directory of this archive
6 for more details.
7
8 Tight version of memset for the case of just clearing a page. It turns out
9 that having the alloco's spaced out slightly due to the increment/branch
10 pair causes them to contend less for access to the cache. Similarly,
11 keeping the stores apart from the allocos causes less contention. => Do two
12 separate loops. Do multiple stores per loop to amortise the
13 increment/branch cost a little.
14
15 Parameters:
16 r2 : source effective address (start of page)
17
18 Always clears 4096 bytes.
19
20 Note : alloco guarded by synco to avoid TAKum03020 erratum
21
22*/
23
24 .section .text..SHmedia32,"ax"
25 .little
26
27 .balign 8
28 .global clear_page
29clear_page:
30 pta/l 1f, tr1
31 pta/l 2f, tr2
32 ptabs/l r18, tr0
33
34 movi 4096, r7
35 add r2, r7, r7
36 add r2, r63, r6
371:
38 alloco r6, 0
39 synco ! TAKum03020
40 addi r6, 32, r6
41 bgt/l r7, r6, tr1
42
43 add r2, r63, r6
442:
45 st.q r6, 0, r63
46 st.q r6, 8, r63
47 st.q r6, 16, r63
48 st.q r6, 24, r63
49 addi r6, 32, r6
50 bgt/l r7, r6, tr2
51
52 blink tr0, r63
53
54
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 2795618e4f0..64dc1ad5980 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -82,7 +82,7 @@ config 32BIT
82 82
83config PMB_ENABLE 83config PMB_ENABLE
84 bool "Support 32-bit physical addressing through PMB" 84 bool "Support 32-bit physical addressing through PMB"
85 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785) 85 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7757 || CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785)
86 select 32BIT 86 select 32BIT
87 default y 87 default y
88 help 88 help
@@ -97,7 +97,7 @@ choice
97 97
98config PMB 98config PMB
99 bool "PMB" 99 bool "PMB"
100 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785) 100 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7757 || CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785)
101 select 32BIT 101 select 32BIT
102 help 102 help
103 If you say Y here, physical addressing will be extended to 103 If you say Y here, physical addressing will be extended to
@@ -106,7 +106,8 @@ config PMB
106 106
107config PMB_FIXED 107config PMB_FIXED
108 bool "fixed PMB" 108 bool "fixed PMB"
109 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7780 || \ 109 depends on MMU && EXPERIMENTAL && (CPU_SUBTYPE_SH7757 || \
110 CPU_SUBTYPE_SH7780 || \
110 CPU_SUBTYPE_SH7785) 111 CPU_SUBTYPE_SH7785)
111 select 32BIT 112 select 32BIT
112 help 113 help
diff --git a/arch/sh/mm/Makefile b/arch/sh/mm/Makefile
index 9f4bc3d90b1..3759bf85329 100644
--- a/arch/sh/mm/Makefile
+++ b/arch/sh/mm/Makefile
@@ -1,5 +1,65 @@
1ifeq ($(CONFIG_SUPERH32),y) 1#
2include ${srctree}/arch/sh/mm/Makefile_32 2# Makefile for the Linux SuperH-specific parts of the memory manager.
3else 3#
4include ${srctree}/arch/sh/mm/Makefile_64 4
5obj-y := cache.o init.o consistent.o mmap.o
6
7cacheops-$(CONFIG_CPU_SH2) := cache-sh2.o
8cacheops-$(CONFIG_CPU_SH2A) := cache-sh2a.o
9cacheops-$(CONFIG_CPU_SH3) := cache-sh3.o
10cacheops-$(CONFIG_CPU_SH4) := cache-sh4.o flush-sh4.o
11cacheops-$(CONFIG_CPU_SH5) := cache-sh5.o flush-sh4.o
12cacheops-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o
13
14obj-y += $(cacheops-y)
15
16mmu-y := nommu.o extable_32.o
17mmu-$(CONFIG_MMU) := extable_$(BITS).o fault_$(BITS).o \
18 ioremap_$(BITS).o kmap.o tlbflush_$(BITS).o
19
20obj-y += $(mmu-y)
21obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
22
23ifdef CONFIG_DEBUG_FS
24obj-$(CONFIG_CPU_SH4) += cache-debugfs.o
5endif 25endif
26
27ifdef CONFIG_MMU
28tlb-$(CONFIG_CPU_SH3) := tlb-sh3.o
29tlb-$(CONFIG_CPU_SH4) := tlb-sh4.o
30tlb-$(CONFIG_CPU_SH5) := tlb-sh5.o
31tlb-$(CONFIG_CPU_HAS_PTEAEX) := tlb-pteaex.o
32obj-y += $(tlb-y)
33endif
34
35obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
36obj-$(CONFIG_PMB) += pmb.o
37obj-$(CONFIG_PMB_FIXED) += pmb-fixed.o
38obj-$(CONFIG_NUMA) += numa.o
39
40# Special flags for fault_64.o. This puts restrictions on the number of
41# caller-save registers that the compiler can target when building this file.
42# This is required because the code is called from a context in entry.S where
43# very few registers have been saved in the exception handler (for speed
44# reasons).
45# The caller save registers that have been saved and which can be used are
46# r2,r3,r4,r5 : argument passing
47# r15, r18 : SP and LINK
48# tr0-4 : allow all caller-save TR's. The compiler seems to be able to make
49# use of them, so it's probably beneficial to performance to save them
50# and have them available for it.
51#
52# The resources not listed below are callee save, i.e. the compiler is free to
53# use any of them and will spill them to the stack itself.
54
55CFLAGS_fault_64.o += -ffixed-r7 \
56 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 \
57 -ffixed-r13 -ffixed-r14 -ffixed-r16 -ffixed-r17 -ffixed-r19 \
58 -ffixed-r20 -ffixed-r21 -ffixed-r22 -ffixed-r23 \
59 -ffixed-r24 -ffixed-r25 -ffixed-r26 -ffixed-r27 \
60 -ffixed-r36 -ffixed-r37 -ffixed-r38 -ffixed-r39 -ffixed-r40 \
61 -ffixed-r41 -ffixed-r42 -ffixed-r43 \
62 -ffixed-r60 -ffixed-r61 -ffixed-r62 \
63 -fomit-frame-pointer
64
65EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/mm/Makefile_32 b/arch/sh/mm/Makefile_32
deleted file mode 100644
index 986a1e05583..00000000000
--- a/arch/sh/mm/Makefile_32
+++ /dev/null
@@ -1,43 +0,0 @@
1#
2# Makefile for the Linux SuperH-specific parts of the memory manager.
3#
4
5obj-y := init.o extable_32.o consistent.o mmap.o
6
7ifndef CONFIG_CACHE_OFF
8cache-$(CONFIG_CPU_SH2) := cache-sh2.o
9cache-$(CONFIG_CPU_SH2A) := cache-sh2a.o
10cache-$(CONFIG_CPU_SH3) := cache-sh3.o
11cache-$(CONFIG_CPU_SH4) := cache-sh4.o
12cache-$(CONFIG_SH7705_CACHE_32KB) += cache-sh7705.o
13endif
14
15obj-y += $(cache-y)
16
17mmu-y := tlb-nommu.o pg-nommu.o
18mmu-$(CONFIG_MMU) := fault_32.o tlbflush_32.o ioremap_32.o
19
20obj-y += $(mmu-y)
21obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
22
23ifdef CONFIG_DEBUG_FS
24obj-$(CONFIG_CPU_SH4) += cache-debugfs.o
25endif
26
27ifdef CONFIG_MMU
28tlb-$(CONFIG_CPU_SH3) := tlb-sh3.o
29tlb-$(CONFIG_CPU_SH4) := tlb-sh4.o
30tlb-$(CONFIG_CPU_HAS_PTEAEX) := tlb-pteaex.o
31obj-y += $(tlb-y)
32ifndef CONFIG_CACHE_OFF
33obj-$(CONFIG_CPU_SH4) += pg-sh4.o
34obj-$(CONFIG_SH7705_CACHE_32KB) += pg-sh7705.o
35endif
36endif
37
38obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
39obj-$(CONFIG_PMB) += pmb.o
40obj-$(CONFIG_PMB_FIXED) += pmb-fixed.o
41obj-$(CONFIG_NUMA) += numa.o
42
43EXTRA_CFLAGS += -Werror
diff --git a/arch/sh/mm/Makefile_64 b/arch/sh/mm/Makefile_64
deleted file mode 100644
index 2863ffb7006..00000000000
--- a/arch/sh/mm/Makefile_64
+++ /dev/null
@@ -1,46 +0,0 @@
1#
2# Makefile for the Linux SuperH-specific parts of the memory manager.
3#
4
5obj-y := init.o consistent.o mmap.o
6
7mmu-y := tlb-nommu.o pg-nommu.o extable_32.o
8mmu-$(CONFIG_MMU) := fault_64.o ioremap_64.o tlbflush_64.o tlb-sh5.o \
9 extable_64.o
10
11ifndef CONFIG_CACHE_OFF
12obj-y += cache-sh5.o
13endif
14
15obj-y += $(mmu-y)
16obj-$(CONFIG_DEBUG_FS) += asids-debugfs.o
17
18obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
19obj-$(CONFIG_NUMA) += numa.o
20
21EXTRA_CFLAGS += -Werror
22
23# Special flags for fault_64.o. This puts restrictions on the number of
24# caller-save registers that the compiler can target when building this file.
25# This is required because the code is called from a context in entry.S where
26# very few registers have been saved in the exception handler (for speed
27# reasons).
28# The caller save registers that have been saved and which can be used are
29# r2,r3,r4,r5 : argument passing
30# r15, r18 : SP and LINK
31# tr0-4 : allow all caller-save TR's. The compiler seems to be able to make
32# use of them, so it's probably beneficial to performance to save them
33# and have them available for it.
34#
35# The resources not listed below are callee save, i.e. the compiler is free to
36# use any of them and will spill them to the stack itself.
37
38CFLAGS_fault_64.o += -ffixed-r7 \
39 -ffixed-r8 -ffixed-r9 -ffixed-r10 -ffixed-r11 -ffixed-r12 \
40 -ffixed-r13 -ffixed-r14 -ffixed-r16 -ffixed-r17 -ffixed-r19 \
41 -ffixed-r20 -ffixed-r21 -ffixed-r22 -ffixed-r23 \
42 -ffixed-r24 -ffixed-r25 -ffixed-r26 -ffixed-r27 \
43 -ffixed-r36 -ffixed-r37 -ffixed-r38 -ffixed-r39 -ffixed-r40 \
44 -ffixed-r41 -ffixed-r42 -ffixed-r43 \
45 -ffixed-r60 -ffixed-r61 -ffixed-r62 \
46 -fomit-frame-pointer
diff --git a/arch/sh/mm/cache-sh2.c b/arch/sh/mm/cache-sh2.c
index c4e80d2b764..699a71f4632 100644
--- a/arch/sh/mm/cache-sh2.c
+++ b/arch/sh/mm/cache-sh2.c
@@ -16,7 +16,7 @@
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17#include <asm/io.h> 17#include <asm/io.h>
18 18
19void __flush_wback_region(void *start, int size) 19static void sh2__flush_wback_region(void *start, int size)
20{ 20{
21 unsigned long v; 21 unsigned long v;
22 unsigned long begin, end; 22 unsigned long begin, end;
@@ -37,7 +37,7 @@ void __flush_wback_region(void *start, int size)
37 } 37 }
38} 38}
39 39
40void __flush_purge_region(void *start, int size) 40static void sh2__flush_purge_region(void *start, int size)
41{ 41{
42 unsigned long v; 42 unsigned long v;
43 unsigned long begin, end; 43 unsigned long begin, end;
@@ -51,7 +51,7 @@ void __flush_purge_region(void *start, int size)
51 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008); 51 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
52} 52}
53 53
54void __flush_invalidate_region(void *start, int size) 54static void sh2__flush_invalidate_region(void *start, int size)
55{ 55{
56#ifdef CONFIG_CACHE_WRITEBACK 56#ifdef CONFIG_CACHE_WRITEBACK
57 /* 57 /*
@@ -82,3 +82,10 @@ void __flush_invalidate_region(void *start, int size)
82 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008); 82 CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008);
83#endif 83#endif
84} 84}
85
86void __init sh2_cache_init(void)
87{
88 __flush_wback_region = sh2__flush_wback_region;
89 __flush_purge_region = sh2__flush_purge_region;
90 __flush_invalidate_region = sh2__flush_invalidate_region;
91}
diff --git a/arch/sh/mm/cache-sh2a.c b/arch/sh/mm/cache-sh2a.c
index 24d86a79406..975899d8356 100644
--- a/arch/sh/mm/cache-sh2a.c
+++ b/arch/sh/mm/cache-sh2a.c
@@ -15,7 +15,7 @@
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/io.h> 16#include <asm/io.h>
17 17
18void __flush_wback_region(void *start, int size) 18static void sh2a__flush_wback_region(void *start, int size)
19{ 19{
20 unsigned long v; 20 unsigned long v;
21 unsigned long begin, end; 21 unsigned long begin, end;
@@ -44,7 +44,7 @@ void __flush_wback_region(void *start, int size)
44 local_irq_restore(flags); 44 local_irq_restore(flags);
45} 45}
46 46
47void __flush_purge_region(void *start, int size) 47static void sh2a__flush_purge_region(void *start, int size)
48{ 48{
49 unsigned long v; 49 unsigned long v;
50 unsigned long begin, end; 50 unsigned long begin, end;
@@ -65,7 +65,7 @@ void __flush_purge_region(void *start, int size)
65 local_irq_restore(flags); 65 local_irq_restore(flags);
66} 66}
67 67
68void __flush_invalidate_region(void *start, int size) 68static void sh2a__flush_invalidate_region(void *start, int size)
69{ 69{
70 unsigned long v; 70 unsigned long v;
71 unsigned long begin, end; 71 unsigned long begin, end;
@@ -97,13 +97,15 @@ void __flush_invalidate_region(void *start, int size)
97} 97}
98 98
99/* WBack O-Cache and flush I-Cache */ 99/* WBack O-Cache and flush I-Cache */
100void flush_icache_range(unsigned long start, unsigned long end) 100static void sh2a_flush_icache_range(void *args)
101{ 101{
102 struct flusher_data *data = args;
103 unsigned long start, end;
102 unsigned long v; 104 unsigned long v;
103 unsigned long flags; 105 unsigned long flags;
104 106
105 start = start & ~(L1_CACHE_BYTES-1); 107 start = data->addr1 & ~(L1_CACHE_BYTES-1);
106 end = (end + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1); 108 end = (data->addr2 + L1_CACHE_BYTES-1) & ~(L1_CACHE_BYTES-1);
107 109
108 local_irq_save(flags); 110 local_irq_save(flags);
109 jump_to_uncached(); 111 jump_to_uncached();
@@ -127,3 +129,12 @@ void flush_icache_range(unsigned long start, unsigned long end)
127 back_to_cached(); 129 back_to_cached();
128 local_irq_restore(flags); 130 local_irq_restore(flags);
129} 131}
132
133void __init sh2a_cache_init(void)
134{
135 local_flush_icache_range = sh2a_flush_icache_range;
136
137 __flush_wback_region = sh2a__flush_wback_region;
138 __flush_purge_region = sh2a__flush_purge_region;
139 __flush_invalidate_region = sh2a__flush_invalidate_region;
140}
diff --git a/arch/sh/mm/cache-sh3.c b/arch/sh/mm/cache-sh3.c
index 6d1dbec08ad..faef80c9813 100644
--- a/arch/sh/mm/cache-sh3.c
+++ b/arch/sh/mm/cache-sh3.c
@@ -32,7 +32,7 @@
32 * SIZE: Size of the region. 32 * SIZE: Size of the region.
33 */ 33 */
34 34
35void __flush_wback_region(void *start, int size) 35static void sh3__flush_wback_region(void *start, int size)
36{ 36{
37 unsigned long v, j; 37 unsigned long v, j;
38 unsigned long begin, end; 38 unsigned long begin, end;
@@ -71,7 +71,7 @@ void __flush_wback_region(void *start, int size)
71 * START: Virtual Address (U0, P1, or P3) 71 * START: Virtual Address (U0, P1, or P3)
72 * SIZE: Size of the region. 72 * SIZE: Size of the region.
73 */ 73 */
74void __flush_purge_region(void *start, int size) 74static void sh3__flush_purge_region(void *start, int size)
75{ 75{
76 unsigned long v; 76 unsigned long v;
77 unsigned long begin, end; 77 unsigned long begin, end;
@@ -90,11 +90,16 @@ void __flush_purge_region(void *start, int size)
90 } 90 }
91} 91}
92 92
93/* 93void __init sh3_cache_init(void)
94 * No write back please 94{
95 * 95 __flush_wback_region = sh3__flush_wback_region;
96 * Except I don't think there's any way to avoid the writeback. So we 96 __flush_purge_region = sh3__flush_purge_region;
97 * just alias it to __flush_purge_region(). dwmw2. 97
98 */ 98 /*
99void __flush_invalidate_region(void *start, int size) 99 * No write back please
100 __attribute__((alias("__flush_purge_region"))); 100 *
101 * Except I don't think there's any way to avoid the writeback.
102 * So we just alias it to sh3__flush_purge_region(). dwmw2.
103 */
104 __flush_invalidate_region = sh3__flush_purge_region;
105}
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 5cfe08dbb59..b2453bbef4c 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -14,6 +14,7 @@
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/mutex.h> 16#include <linux/mutex.h>
17#include <linux/fs.h>
17#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
18#include <asm/cacheflush.h> 19#include <asm/cacheflush.h>
19 20
@@ -25,13 +26,6 @@
25#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ 26#define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */
26#define MAX_ICACHE_PAGES 32 27#define MAX_ICACHE_PAGES 32
27 28
28static void __flush_dcache_segment_1way(unsigned long start,
29 unsigned long extent);
30static void __flush_dcache_segment_2way(unsigned long start,
31 unsigned long extent);
32static void __flush_dcache_segment_4way(unsigned long start,
33 unsigned long extent);
34
35static void __flush_cache_4096(unsigned long addr, unsigned long phys, 29static void __flush_cache_4096(unsigned long addr, unsigned long phys,
36 unsigned long exec_offset); 30 unsigned long exec_offset);
37 31
@@ -43,182 +37,56 @@ static void __flush_cache_4096(unsigned long addr, unsigned long phys,
43static void (*__flush_dcache_segment_fn)(unsigned long, unsigned long) = 37static void (*__flush_dcache_segment_fn)(unsigned long, unsigned long) =
44 (void (*)(unsigned long, unsigned long))0xdeadbeef; 38 (void (*)(unsigned long, unsigned long))0xdeadbeef;
45 39
46static void compute_alias(struct cache_info *c) 40/*
41 * Write back the range of D-cache, and purge the I-cache.
42 *
43 * Called from kernel/module.c:sys_init_module and routine for a.out format,
44 * signal handler code and kprobes code
45 */
46static void sh4_flush_icache_range(void *args)
47{ 47{
48 c->alias_mask = ((c->sets - 1) << c->entry_shift) & ~(PAGE_SIZE - 1); 48 struct flusher_data *data = args;
49 c->n_aliases = c->alias_mask ? (c->alias_mask >> PAGE_SHIFT) + 1 : 0; 49 unsigned long start, end;
50} 50 unsigned long flags, v;
51 int i;
51 52
52static void __init emit_cache_params(void) 53 start = data->addr1;
53{ 54 end = data->addr2;
54 printk("PVR=%08x CVR=%08x PRR=%08x\n",
55 ctrl_inl(CCN_PVR),
56 ctrl_inl(CCN_CVR),
57 ctrl_inl(CCN_PRR));
58 printk("I-cache : n_ways=%d n_sets=%d way_incr=%d\n",
59 boot_cpu_data.icache.ways,
60 boot_cpu_data.icache.sets,
61 boot_cpu_data.icache.way_incr);
62 printk("I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
63 boot_cpu_data.icache.entry_mask,
64 boot_cpu_data.icache.alias_mask,
65 boot_cpu_data.icache.n_aliases);
66 printk("D-cache : n_ways=%d n_sets=%d way_incr=%d\n",
67 boot_cpu_data.dcache.ways,
68 boot_cpu_data.dcache.sets,
69 boot_cpu_data.dcache.way_incr);
70 printk("D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
71 boot_cpu_data.dcache.entry_mask,
72 boot_cpu_data.dcache.alias_mask,
73 boot_cpu_data.dcache.n_aliases);
74 55
75 /* 56 /* If there are too many pages then just blow away the caches */
76 * Emit Secondary Cache parameters if the CPU has a probed L2. 57 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) {
77 */ 58 local_flush_cache_all(NULL);
78 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) { 59 return;
79 printk("S-cache : n_ways=%d n_sets=%d way_incr=%d\n",
80 boot_cpu_data.scache.ways,
81 boot_cpu_data.scache.sets,
82 boot_cpu_data.scache.way_incr);
83 printk("S-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
84 boot_cpu_data.scache.entry_mask,
85 boot_cpu_data.scache.alias_mask,
86 boot_cpu_data.scache.n_aliases);
87 } 60 }
88 61
89 if (!__flush_dcache_segment_fn) 62 /*
90 panic("unknown number of cache ways\n"); 63 * Selectively flush d-cache then invalidate the i-cache.
91} 64 * This is inefficient, so only use this for small ranges.
65 */
66 start &= ~(L1_CACHE_BYTES-1);
67 end += L1_CACHE_BYTES-1;
68 end &= ~(L1_CACHE_BYTES-1);
92 69
93/* 70 local_irq_save(flags);
94 * SH-4 has virtually indexed and physically tagged cache. 71 jump_to_uncached();
95 */
96void __init p3_cache_init(void)
97{
98 compute_alias(&boot_cpu_data.icache);
99 compute_alias(&boot_cpu_data.dcache);
100 compute_alias(&boot_cpu_data.scache);
101
102 switch (boot_cpu_data.dcache.ways) {
103 case 1:
104 __flush_dcache_segment_fn = __flush_dcache_segment_1way;
105 break;
106 case 2:
107 __flush_dcache_segment_fn = __flush_dcache_segment_2way;
108 break;
109 case 4:
110 __flush_dcache_segment_fn = __flush_dcache_segment_4way;
111 break;
112 default:
113 __flush_dcache_segment_fn = NULL;
114 break;
115 }
116 72
117 emit_cache_params(); 73 for (v = start; v < end; v += L1_CACHE_BYTES) {
118} 74 unsigned long icacheaddr;
119 75
120/* 76 __ocbwb(v);
121 * Write back the dirty D-caches, but not invalidate them.
122 *
123 * START: Virtual Address (U0, P1, or P3)
124 * SIZE: Size of the region.
125 */
126void __flush_wback_region(void *start, int size)
127{
128 unsigned long v;
129 unsigned long begin, end;
130
131 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
132 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
133 & ~(L1_CACHE_BYTES-1);
134 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
135 asm volatile("ocbwb %0"
136 : /* no output */
137 : "m" (__m(v)));
138 }
139}
140 77
141/* 78 icacheaddr = CACHE_IC_ADDRESS_ARRAY | (v &
142 * Write back the dirty D-caches and invalidate them. 79 cpu_data->icache.entry_mask);
143 *
144 * START: Virtual Address (U0, P1, or P3)
145 * SIZE: Size of the region.
146 */
147void __flush_purge_region(void *start, int size)
148{
149 unsigned long v;
150 unsigned long begin, end;
151
152 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
153 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
154 & ~(L1_CACHE_BYTES-1);
155 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
156 asm volatile("ocbp %0"
157 : /* no output */
158 : "m" (__m(v)));
159 }
160}
161 80
162/* 81 /* Clear i-cache line valid-bit */
163 * No write back please 82 for (i = 0; i < cpu_data->icache.ways; i++) {
164 */ 83 __raw_writel(0, icacheaddr);
165void __flush_invalidate_region(void *start, int size) 84 icacheaddr += cpu_data->icache.way_incr;
166{ 85 }
167 unsigned long v;
168 unsigned long begin, end;
169
170 begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
171 end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
172 & ~(L1_CACHE_BYTES-1);
173 for (v = begin; v < end; v+=L1_CACHE_BYTES) {
174 asm volatile("ocbi %0"
175 : /* no output */
176 : "m" (__m(v)));
177 } 86 }
178}
179
180/*
181 * Write back the range of D-cache, and purge the I-cache.
182 *
183 * Called from kernel/module.c:sys_init_module and routine for a.out format,
184 * signal handler code and kprobes code
185 */
186void flush_icache_range(unsigned long start, unsigned long end)
187{
188 int icacheaddr;
189 unsigned long flags, v;
190 int i;
191 87
192 /* If there are too many pages then just blow the caches */ 88 back_to_cached();
193 if (((end - start) >> PAGE_SHIFT) >= MAX_ICACHE_PAGES) { 89 local_irq_restore(flags);
194 flush_cache_all();
195 } else {
196 /* selectively flush d-cache then invalidate the i-cache */
197 /* this is inefficient, so only use for small ranges */
198 start &= ~(L1_CACHE_BYTES-1);
199 end += L1_CACHE_BYTES-1;
200 end &= ~(L1_CACHE_BYTES-1);
201
202 local_irq_save(flags);
203 jump_to_uncached();
204
205 for (v = start; v < end; v+=L1_CACHE_BYTES) {
206 asm volatile("ocbwb %0"
207 : /* no output */
208 : "m" (__m(v)));
209
210 icacheaddr = CACHE_IC_ADDRESS_ARRAY | (
211 v & cpu_data->icache.entry_mask);
212
213 for (i = 0; i < cpu_data->icache.ways;
214 i++, icacheaddr += cpu_data->icache.way_incr)
215 /* Clear i-cache line valid-bit */
216 ctrl_outl(0, icacheaddr);
217 }
218
219 back_to_cached();
220 local_irq_restore(flags);
221 }
222} 90}
223 91
224static inline void flush_cache_4096(unsigned long start, 92static inline void flush_cache_4096(unsigned long start,
@@ -244,9 +112,17 @@ static inline void flush_cache_4096(unsigned long start,
244 * Write back & invalidate the D-cache of the page. 112 * Write back & invalidate the D-cache of the page.
245 * (To avoid "alias" issues) 113 * (To avoid "alias" issues)
246 */ 114 */
247void flush_dcache_page(struct page *page) 115static void sh4_flush_dcache_page(void *arg)
248{ 116{
249 if (test_bit(PG_mapped, &page->flags)) { 117 struct page *page = arg;
118#ifndef CONFIG_SMP
119 struct address_space *mapping = page_mapping(page);
120
121 if (mapping && !mapping_mapped(mapping))
122 set_bit(PG_dcache_dirty, &page->flags);
123 else
124#endif
125 {
250 unsigned long phys = PHYSADDR(page_address(page)); 126 unsigned long phys = PHYSADDR(page_address(page));
251 unsigned long addr = CACHE_OC_ADDRESS_ARRAY; 127 unsigned long addr = CACHE_OC_ADDRESS_ARRAY;
252 int i, n; 128 int i, n;
@@ -282,13 +158,13 @@ static void __uses_jump_to_uncached flush_icache_all(void)
282 local_irq_restore(flags); 158 local_irq_restore(flags);
283} 159}
284 160
285void flush_dcache_all(void) 161static inline void flush_dcache_all(void)
286{ 162{
287 (*__flush_dcache_segment_fn)(0UL, boot_cpu_data.dcache.way_size); 163 (*__flush_dcache_segment_fn)(0UL, boot_cpu_data.dcache.way_size);
288 wmb(); 164 wmb();
289} 165}
290 166
291void flush_cache_all(void) 167static void sh4_flush_cache_all(void *unused)
292{ 168{
293 flush_dcache_all(); 169 flush_dcache_all();
294 flush_icache_all(); 170 flush_icache_all();
@@ -380,8 +256,13 @@ loop_exit:
380 * 256 *
381 * Caller takes mm->mmap_sem. 257 * Caller takes mm->mmap_sem.
382 */ 258 */
383void flush_cache_mm(struct mm_struct *mm) 259static void sh4_flush_cache_mm(void *arg)
384{ 260{
261 struct mm_struct *mm = arg;
262
263 if (cpu_context(smp_processor_id(), mm) == NO_CONTEXT)
264 return;
265
385 /* 266 /*
386 * If cache is only 4k-per-way, there are never any 'aliases'. Since 267 * If cache is only 4k-per-way, there are never any 'aliases'. Since
387 * the cache is physically tagged, the data can just be left in there. 268 * the cache is physically tagged, the data can just be left in there.
@@ -417,12 +298,21 @@ void flush_cache_mm(struct mm_struct *mm)
417 * ADDR: Virtual Address (U0 address) 298 * ADDR: Virtual Address (U0 address)
418 * PFN: Physical page number 299 * PFN: Physical page number
419 */ 300 */
420void flush_cache_page(struct vm_area_struct *vma, unsigned long address, 301static void sh4_flush_cache_page(void *args)
421 unsigned long pfn)
422{ 302{
423 unsigned long phys = pfn << PAGE_SHIFT; 303 struct flusher_data *data = args;
304 struct vm_area_struct *vma;
305 unsigned long address, pfn, phys;
424 unsigned int alias_mask; 306 unsigned int alias_mask;
425 307
308 vma = data->vma;
309 address = data->addr1;
310 pfn = data->addr2;
311 phys = pfn << PAGE_SHIFT;
312
313 if (cpu_context(smp_processor_id(), vma->vm_mm) == NO_CONTEXT)
314 return;
315
426 alias_mask = boot_cpu_data.dcache.alias_mask; 316 alias_mask = boot_cpu_data.dcache.alias_mask;
427 317
428 /* We only need to flush D-cache when we have alias */ 318 /* We only need to flush D-cache when we have alias */
@@ -462,9 +352,19 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address,
462 * Flushing the cache lines for U0 only isn't enough. 352 * Flushing the cache lines for U0 only isn't enough.
463 * We need to flush for P1 too, which may contain aliases. 353 * We need to flush for P1 too, which may contain aliases.
464 */ 354 */
465void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 355static void sh4_flush_cache_range(void *args)
466 unsigned long end)
467{ 356{
357 struct flusher_data *data = args;
358 struct vm_area_struct *vma;
359 unsigned long start, end;
360
361 vma = data->vma;
362 start = data->addr1;
363 end = data->addr2;
364
365 if (cpu_context(smp_processor_id(), vma->vm_mm) == NO_CONTEXT)
366 return;
367
468 /* 368 /*
469 * If cache is only 4k-per-way, there are never any 'aliases'. Since 369 * If cache is only 4k-per-way, there are never any 'aliases'. Since
470 * the cache is physically tagged, the data can just be left in there. 370 * the cache is physically tagged, the data can just be left in there.
@@ -492,20 +392,6 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
492 } 392 }
493} 393}
494 394
495/*
496 * flush_icache_user_range
497 * @vma: VMA of the process
498 * @page: page
499 * @addr: U0 address
500 * @len: length of the range (< page size)
501 */
502void flush_icache_user_range(struct vm_area_struct *vma,
503 struct page *page, unsigned long addr, int len)
504{
505 flush_cache_page(vma, addr, page_to_pfn(page));
506 mb();
507}
508
509/** 395/**
510 * __flush_cache_4096 396 * __flush_cache_4096
511 * 397 *
@@ -581,7 +467,49 @@ static void __flush_cache_4096(unsigned long addr, unsigned long phys,
581 * Break the 1, 2 and 4 way variants of this out into separate functions to 467 * Break the 1, 2 and 4 way variants of this out into separate functions to
582 * avoid nearly all the overhead of having the conditional stuff in the function 468 * avoid nearly all the overhead of having the conditional stuff in the function
583 * bodies (+ the 1 and 2 way cases avoid saving any registers too). 469 * bodies (+ the 1 and 2 way cases avoid saving any registers too).
470 *
471 * We want to eliminate unnecessary bus transactions, so this code uses
472 * a non-obvious technique.
473 *
474 * Loop over a cache way sized block of, one cache line at a time. For each
475 * line, use movca.a to cause the current cache line contents to be written
476 * back, but without reading anything from main memory. However this has the
477 * side effect that the cache is now caching that memory location. So follow
478 * this with a cache invalidate to mark the cache line invalid. And do all
479 * this with interrupts disabled, to avoid the cache line being accidently
480 * evicted while it is holding garbage.
481 *
482 * This also breaks in a number of circumstances:
483 * - if there are modifications to the region of memory just above
484 * empty_zero_page (for example because a breakpoint has been placed
485 * there), then these can be lost.
486 *
487 * This is because the the memory address which the cache temporarily
488 * caches in the above description is empty_zero_page. So the
489 * movca.l hits the cache (it is assumed that it misses, or at least
490 * isn't dirty), modifies the line and then invalidates it, losing the
491 * required change.
492 *
493 * - If caches are disabled or configured in write-through mode, then
494 * the movca.l writes garbage directly into memory.
584 */ 495 */
496static void __flush_dcache_segment_writethrough(unsigned long start,
497 unsigned long extent_per_way)
498{
499 unsigned long addr;
500 int i;
501
502 addr = CACHE_OC_ADDRESS_ARRAY | (start & cpu_data->dcache.entry_mask);
503
504 while (extent_per_way) {
505 for (i = 0; i < cpu_data->dcache.ways; i++)
506 __raw_writel(0, addr + cpu_data->dcache.way_incr * i);
507
508 addr += cpu_data->dcache.linesz;
509 extent_per_way -= cpu_data->dcache.linesz;
510 }
511}
512
585static void __flush_dcache_segment_1way(unsigned long start, 513static void __flush_dcache_segment_1way(unsigned long start,
586 unsigned long extent_per_way) 514 unsigned long extent_per_way)
587{ 515{
@@ -773,3 +701,47 @@ static void __flush_dcache_segment_4way(unsigned long start,
773 a3 += linesz; 701 a3 += linesz;
774 } while (a0 < a0e); 702 } while (a0 < a0e);
775} 703}
704
705extern void __weak sh4__flush_region_init(void);
706
707/*
708 * SH-4 has virtually indexed and physically tagged cache.
709 */
710void __init sh4_cache_init(void)
711{
712 unsigned int wt_enabled = !!(__raw_readl(CCR) & CCR_CACHE_WT);
713
714 printk("PVR=%08x CVR=%08x PRR=%08x\n",
715 ctrl_inl(CCN_PVR),
716 ctrl_inl(CCN_CVR),
717 ctrl_inl(CCN_PRR));
718
719 if (wt_enabled)
720 __flush_dcache_segment_fn = __flush_dcache_segment_writethrough;
721 else {
722 switch (boot_cpu_data.dcache.ways) {
723 case 1:
724 __flush_dcache_segment_fn = __flush_dcache_segment_1way;
725 break;
726 case 2:
727 __flush_dcache_segment_fn = __flush_dcache_segment_2way;
728 break;
729 case 4:
730 __flush_dcache_segment_fn = __flush_dcache_segment_4way;
731 break;
732 default:
733 panic("unknown number of cache ways\n");
734 break;
735 }
736 }
737
738 local_flush_icache_range = sh4_flush_icache_range;
739 local_flush_dcache_page = sh4_flush_dcache_page;
740 local_flush_cache_all = sh4_flush_cache_all;
741 local_flush_cache_mm = sh4_flush_cache_mm;
742 local_flush_cache_dup_mm = sh4_flush_cache_mm;
743 local_flush_cache_page = sh4_flush_cache_page;
744 local_flush_cache_range = sh4_flush_cache_range;
745
746 sh4__flush_region_init();
747}
diff --git a/arch/sh/mm/cache-sh5.c b/arch/sh/mm/cache-sh5.c
index 86762092508..467ff8e260f 100644
--- a/arch/sh/mm/cache-sh5.c
+++ b/arch/sh/mm/cache-sh5.c
@@ -20,23 +20,11 @@
20#include <asm/uaccess.h> 20#include <asm/uaccess.h>
21#include <asm/mmu_context.h> 21#include <asm/mmu_context.h>
22 22
23extern void __weak sh4__flush_region_init(void);
24
23/* Wired TLB entry for the D-cache */ 25/* Wired TLB entry for the D-cache */
24static unsigned long long dtlb_cache_slot; 26static unsigned long long dtlb_cache_slot;
25 27
26void __init p3_cache_init(void)
27{
28 /* Reserve a slot for dcache colouring in the DTLB */
29 dtlb_cache_slot = sh64_get_wired_dtlb_entry();
30}
31
32#ifdef CONFIG_DCACHE_DISABLED
33#define sh64_dcache_purge_all() do { } while (0)
34#define sh64_dcache_purge_coloured_phy_page(paddr, eaddr) do { } while (0)
35#define sh64_dcache_purge_user_range(mm, start, end) do { } while (0)
36#define sh64_dcache_purge_phy_page(paddr) do { } while (0)
37#define sh64_dcache_purge_virt_page(mm, eaddr) do { } while (0)
38#endif
39
40/* 28/*
41 * The following group of functions deal with mapping and unmapping a 29 * The following group of functions deal with mapping and unmapping a
42 * temporary page into a DTLB slot that has been set aside for exclusive 30 * temporary page into a DTLB slot that has been set aside for exclusive
@@ -56,7 +44,6 @@ static inline void sh64_teardown_dtlb_cache_slot(void)
56 local_irq_enable(); 44 local_irq_enable();
57} 45}
58 46
59#ifndef CONFIG_ICACHE_DISABLED
60static inline void sh64_icache_inv_all(void) 47static inline void sh64_icache_inv_all(void)
61{ 48{
62 unsigned long long addr, flag, data; 49 unsigned long long addr, flag, data;
@@ -214,52 +201,6 @@ static void sh64_icache_inv_user_page_range(struct mm_struct *mm,
214 } 201 }
215} 202}
216 203
217/*
218 * Invalidate a small range of user context I-cache, not necessarily page
219 * (or even cache-line) aligned.
220 *
221 * Since this is used inside ptrace, the ASID in the mm context typically
222 * won't match current_asid. We'll have to switch ASID to do this. For
223 * safety, and given that the range will be small, do all this under cli.
224 *
225 * Note, there is a hazard that the ASID in mm->context is no longer
226 * actually associated with mm, i.e. if the mm->context has started a new
227 * cycle since mm was last active. However, this is just a performance
228 * issue: all that happens is that we invalidate lines belonging to
229 * another mm, so the owning process has to refill them when that mm goes
230 * live again. mm itself can't have any cache entries because there will
231 * have been a flush_cache_all when the new mm->context cycle started.
232 */
233static void sh64_icache_inv_user_small_range(struct mm_struct *mm,
234 unsigned long start, int len)
235{
236 unsigned long long eaddr = start;
237 unsigned long long eaddr_end = start + len;
238 unsigned long current_asid, mm_asid;
239 unsigned long flags;
240 unsigned long long epage_start;
241
242 /*
243 * Align to start of cache line. Otherwise, suppose len==8 and
244 * start was at 32N+28 : the last 4 bytes wouldn't get invalidated.
245 */
246 eaddr = L1_CACHE_ALIGN(start);
247 eaddr_end = start + len;
248
249 mm_asid = cpu_asid(smp_processor_id(), mm);
250 local_irq_save(flags);
251 current_asid = switch_and_save_asid(mm_asid);
252
253 epage_start = eaddr & PAGE_MASK;
254
255 while (eaddr < eaddr_end) {
256 __asm__ __volatile__("icbi %0, 0" : : "r" (eaddr));
257 eaddr += L1_CACHE_BYTES;
258 }
259 switch_and_save_asid(current_asid);
260 local_irq_restore(flags);
261}
262
263static void sh64_icache_inv_current_user_range(unsigned long start, unsigned long end) 204static void sh64_icache_inv_current_user_range(unsigned long start, unsigned long end)
264{ 205{
265 /* The icbi instruction never raises ITLBMISS. i.e. if there's not a 206 /* The icbi instruction never raises ITLBMISS. i.e. if there's not a
@@ -287,9 +228,7 @@ static void sh64_icache_inv_current_user_range(unsigned long start, unsigned lon
287 addr += L1_CACHE_BYTES; 228 addr += L1_CACHE_BYTES;
288 } 229 }
289} 230}
290#endif /* !CONFIG_ICACHE_DISABLED */
291 231
292#ifndef CONFIG_DCACHE_DISABLED
293/* Buffer used as the target of alloco instructions to purge data from cache 232/* Buffer used as the target of alloco instructions to purge data from cache
294 sets by natural eviction. -- RPC */ 233 sets by natural eviction. -- RPC */
295#define DUMMY_ALLOCO_AREA_SIZE ((L1_CACHE_BYTES << 10) + (1024 * 4)) 234#define DUMMY_ALLOCO_AREA_SIZE ((L1_CACHE_BYTES << 10) + (1024 * 4))
@@ -541,59 +480,10 @@ static void sh64_dcache_purge_user_range(struct mm_struct *mm,
541} 480}
542 481
543/* 482/*
544 * Purge the range of addresses from the D-cache.
545 *
546 * The addresses lie in the superpage mapping. There's no harm if we
547 * overpurge at either end - just a small performance loss.
548 */
549void __flush_purge_region(void *start, int size)
550{
551 unsigned long long ullend, addr, aligned_start;
552
553 aligned_start = (unsigned long long)(signed long long)(signed long) start;
554 addr = L1_CACHE_ALIGN(aligned_start);
555 ullend = (unsigned long long) (signed long long) (signed long) start + size;
556
557 while (addr <= ullend) {
558 __asm__ __volatile__ ("ocbp %0, 0" : : "r" (addr));
559 addr += L1_CACHE_BYTES;
560 }
561}
562
563void __flush_wback_region(void *start, int size)
564{
565 unsigned long long ullend, addr, aligned_start;
566
567 aligned_start = (unsigned long long)(signed long long)(signed long) start;
568 addr = L1_CACHE_ALIGN(aligned_start);
569 ullend = (unsigned long long) (signed long long) (signed long) start + size;
570
571 while (addr < ullend) {
572 __asm__ __volatile__ ("ocbwb %0, 0" : : "r" (addr));
573 addr += L1_CACHE_BYTES;
574 }
575}
576
577void __flush_invalidate_region(void *start, int size)
578{
579 unsigned long long ullend, addr, aligned_start;
580
581 aligned_start = (unsigned long long)(signed long long)(signed long) start;
582 addr = L1_CACHE_ALIGN(aligned_start);
583 ullend = (unsigned long long) (signed long long) (signed long) start + size;
584
585 while (addr < ullend) {
586 __asm__ __volatile__ ("ocbi %0, 0" : : "r" (addr));
587 addr += L1_CACHE_BYTES;
588 }
589}
590#endif /* !CONFIG_DCACHE_DISABLED */
591
592/*
593 * Invalidate the entire contents of both caches, after writing back to 483 * Invalidate the entire contents of both caches, after writing back to
594 * memory any dirty data from the D-cache. 484 * memory any dirty data from the D-cache.
595 */ 485 */
596void flush_cache_all(void) 486static void sh5_flush_cache_all(void *unused)
597{ 487{
598 sh64_dcache_purge_all(); 488 sh64_dcache_purge_all();
599 sh64_icache_inv_all(); 489 sh64_icache_inv_all();
@@ -620,7 +510,7 @@ void flush_cache_all(void)
620 * I-cache. This is similar to the lack of action needed in 510 * I-cache. This is similar to the lack of action needed in
621 * flush_tlb_mm - see fault.c. 511 * flush_tlb_mm - see fault.c.
622 */ 512 */
623void flush_cache_mm(struct mm_struct *mm) 513static void sh5_flush_cache_mm(void *unused)
624{ 514{
625 sh64_dcache_purge_all(); 515 sh64_dcache_purge_all();
626} 516}
@@ -632,13 +522,18 @@ void flush_cache_mm(struct mm_struct *mm)
632 * 522 *
633 * Note, 'end' is 1 byte beyond the end of the range to flush. 523 * Note, 'end' is 1 byte beyond the end of the range to flush.
634 */ 524 */
635void flush_cache_range(struct vm_area_struct *vma, unsigned long start, 525static void sh5_flush_cache_range(void *args)
636 unsigned long end)
637{ 526{
638 struct mm_struct *mm = vma->vm_mm; 527 struct flusher_data *data = args;
528 struct vm_area_struct *vma;
529 unsigned long start, end;
530
531 vma = data->vma;
532 start = data->addr1;
533 end = data->addr2;
639 534
640 sh64_dcache_purge_user_range(mm, start, end); 535 sh64_dcache_purge_user_range(vma->vm_mm, start, end);
641 sh64_icache_inv_user_page_range(mm, start, end); 536 sh64_icache_inv_user_page_range(vma->vm_mm, start, end);
642} 537}
643 538
644/* 539/*
@@ -650,16 +545,23 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
650 * 545 *
651 * Note, this is called with pte lock held. 546 * Note, this is called with pte lock held.
652 */ 547 */
653void flush_cache_page(struct vm_area_struct *vma, unsigned long eaddr, 548static void sh5_flush_cache_page(void *args)
654 unsigned long pfn)
655{ 549{
550 struct flusher_data *data = args;
551 struct vm_area_struct *vma;
552 unsigned long eaddr, pfn;
553
554 vma = data->vma;
555 eaddr = data->addr1;
556 pfn = data->addr2;
557
656 sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT); 558 sh64_dcache_purge_phy_page(pfn << PAGE_SHIFT);
657 559
658 if (vma->vm_flags & VM_EXEC) 560 if (vma->vm_flags & VM_EXEC)
659 sh64_icache_inv_user_page(vma, eaddr); 561 sh64_icache_inv_user_page(vma, eaddr);
660} 562}
661 563
662void flush_dcache_page(struct page *page) 564static void sh5_flush_dcache_page(void *page)
663{ 565{
664 sh64_dcache_purge_phy_page(page_to_phys(page)); 566 sh64_dcache_purge_phy_page(page_to_phys(page));
665 wmb(); 567 wmb();
@@ -673,162 +575,47 @@ void flush_dcache_page(struct page *page)
673 * mapping, therefore it's guaranteed that there no cache entries for 575 * mapping, therefore it's guaranteed that there no cache entries for
674 * the range in cache sets of the wrong colour. 576 * the range in cache sets of the wrong colour.
675 */ 577 */
676void flush_icache_range(unsigned long start, unsigned long end) 578static void sh5_flush_icache_range(void *args)
677{ 579{
580 struct flusher_data *data = args;
581 unsigned long start, end;
582
583 start = data->addr1;
584 end = data->addr2;
585
678 __flush_purge_region((void *)start, end); 586 __flush_purge_region((void *)start, end);
679 wmb(); 587 wmb();
680 sh64_icache_inv_kernel_range(start, end); 588 sh64_icache_inv_kernel_range(start, end);
681} 589}
682 590
683/* 591/*
684 * Flush the range of user (defined by vma->vm_mm) address space starting
685 * at 'addr' for 'len' bytes from the cache. The range does not straddle
686 * a page boundary, the unique physical page containing the range is
687 * 'page'. This seems to be used mainly for invalidating an address
688 * range following a poke into the program text through the ptrace() call
689 * from another process (e.g. for BRK instruction insertion).
690 */
691void flush_icache_user_range(struct vm_area_struct *vma,
692 struct page *page, unsigned long addr, int len)
693{
694
695 sh64_dcache_purge_coloured_phy_page(page_to_phys(page), addr);
696 mb();
697
698 if (vma->vm_flags & VM_EXEC)
699 sh64_icache_inv_user_small_range(vma->vm_mm, addr, len);
700}
701
702/*
703 * For the address range [start,end), write back the data from the 592 * For the address range [start,end), write back the data from the
704 * D-cache and invalidate the corresponding region of the I-cache for the 593 * D-cache and invalidate the corresponding region of the I-cache for the
705 * current process. Used to flush signal trampolines on the stack to 594 * current process. Used to flush signal trampolines on the stack to
706 * make them executable. 595 * make them executable.
707 */ 596 */
708void flush_cache_sigtramp(unsigned long vaddr) 597static void sh5_flush_cache_sigtramp(void *vaddr)
709{ 598{
710 unsigned long end = vaddr + L1_CACHE_BYTES; 599 unsigned long end = (unsigned long)vaddr + L1_CACHE_BYTES;
711 600
712 __flush_wback_region((void *)vaddr, L1_CACHE_BYTES); 601 __flush_wback_region(vaddr, L1_CACHE_BYTES);
713 wmb(); 602 wmb();
714 sh64_icache_inv_current_user_range(vaddr, end); 603 sh64_icache_inv_current_user_range((unsigned long)vaddr, end);
715} 604}
716 605
717#ifdef CONFIG_MMU 606void __init sh5_cache_init(void)
718/*
719 * These *MUST* lie in an area of virtual address space that's otherwise
720 * unused.
721 */
722#define UNIQUE_EADDR_START 0xe0000000UL
723#define UNIQUE_EADDR_END 0xe8000000UL
724
725/*
726 * Given a physical address paddr, and a user virtual address user_eaddr
727 * which will eventually be mapped to it, create a one-off kernel-private
728 * eaddr mapped to the same paddr. This is used for creating special
729 * destination pages for copy_user_page and clear_user_page.
730 */
731static unsigned long sh64_make_unique_eaddr(unsigned long user_eaddr,
732 unsigned long paddr)
733{
734 static unsigned long current_pointer = UNIQUE_EADDR_START;
735 unsigned long coloured_pointer;
736
737 if (current_pointer == UNIQUE_EADDR_END) {
738 sh64_dcache_purge_all();
739 current_pointer = UNIQUE_EADDR_START;
740 }
741
742 coloured_pointer = (current_pointer & ~CACHE_OC_SYN_MASK) |
743 (user_eaddr & CACHE_OC_SYN_MASK);
744 sh64_setup_dtlb_cache_slot(coloured_pointer, get_asid(), paddr);
745
746 current_pointer += (PAGE_SIZE << CACHE_OC_N_SYNBITS);
747
748 return coloured_pointer;
749}
750
751static void sh64_copy_user_page_coloured(void *to, void *from,
752 unsigned long address)
753{ 607{
754 void *coloured_to; 608 local_flush_cache_all = sh5_flush_cache_all;
609 local_flush_cache_mm = sh5_flush_cache_mm;
610 local_flush_cache_dup_mm = sh5_flush_cache_mm;
611 local_flush_cache_page = sh5_flush_cache_page;
612 local_flush_cache_range = sh5_flush_cache_range;
613 local_flush_dcache_page = sh5_flush_dcache_page;
614 local_flush_icache_range = sh5_flush_icache_range;
615 local_flush_cache_sigtramp = sh5_flush_cache_sigtramp;
755 616
756 /* 617 /* Reserve a slot for dcache colouring in the DTLB */
757 * Discard any existing cache entries of the wrong colour. These are 618 dtlb_cache_slot = sh64_get_wired_dtlb_entry();
758 * present quite often, if the kernel has recently used the page
759 * internally, then given it up, then it's been allocated to the user.
760 */
761 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long)to);
762
763 coloured_to = (void *)sh64_make_unique_eaddr(address, __pa(to));
764 copy_page(from, coloured_to);
765
766 sh64_teardown_dtlb_cache_slot();
767}
768
769static void sh64_clear_user_page_coloured(void *to, unsigned long address)
770{
771 void *coloured_to;
772
773 /*
774 * Discard any existing kernel-originated lines of the wrong
775 * colour (as above)
776 */
777 sh64_dcache_purge_coloured_phy_page(__pa(to), (unsigned long)to);
778
779 coloured_to = (void *)sh64_make_unique_eaddr(address, __pa(to));
780 clear_page(coloured_to);
781
782 sh64_teardown_dtlb_cache_slot();
783}
784
785/*
786 * 'from' and 'to' are kernel virtual addresses (within the superpage
787 * mapping of the physical RAM). 'address' is the user virtual address
788 * where the copy 'to' will be mapped after. This allows a custom
789 * mapping to be used to ensure that the new copy is placed in the
790 * right cache sets for the user to see it without having to bounce it
791 * out via memory. Note however : the call to flush_page_to_ram in
792 * (generic)/mm/memory.c:(break_cow) undoes all this good work in that one
793 * very important case!
794 *
795 * TBD : can we guarantee that on every call, any cache entries for
796 * 'from' are in the same colour sets as 'address' also? i.e. is this
797 * always used just to deal with COW? (I suspect not).
798 *
799 * There are two possibilities here for when the page 'from' was last accessed:
800 * - by the kernel : this is OK, no purge required.
801 * - by the/a user (e.g. for break_COW) : need to purge.
802 *
803 * If the potential user mapping at 'address' is the same colour as
804 * 'from' there is no need to purge any cache lines from the 'from'
805 * page mapped into cache sets of colour 'address'. (The copy will be
806 * accessing the page through 'from').
807 */
808void copy_user_page(void *to, void *from, unsigned long address,
809 struct page *page)
810{
811 if (((address ^ (unsigned long) from) & CACHE_OC_SYN_MASK) != 0)
812 sh64_dcache_purge_coloured_phy_page(__pa(from), address);
813
814 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0)
815 copy_page(to, from);
816 else
817 sh64_copy_user_page_coloured(to, from, address);
818}
819 619
820/* 620 sh4__flush_region_init();
821 * 'to' is a kernel virtual address (within the superpage mapping of the
822 * physical RAM). 'address' is the user virtual address where the 'to'
823 * page will be mapped after. This allows a custom mapping to be used to
824 * ensure that the new copy is placed in the right cache sets for the
825 * user to see it without having to bounce it out via memory.
826 */
827void clear_user_page(void *to, unsigned long address, struct page *page)
828{
829 if (((address ^ (unsigned long) to) & CACHE_OC_SYN_MASK) == 0)
830 clear_page(to);
831 else
832 sh64_clear_user_page_coloured(to, address);
833} 621}
834#endif
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c
index 22dacc77882..2cadee2037a 100644
--- a/arch/sh/mm/cache-sh7705.c
+++ b/arch/sh/mm/cache-sh7705.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mman.h> 13#include <linux/mman.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/fs.h>
15#include <linux/threads.h> 16#include <linux/threads.h>
16#include <asm/addrspace.h> 17#include <asm/addrspace.h>
17#include <asm/page.h> 18#include <asm/page.h>
@@ -63,15 +64,21 @@ static inline void cache_wback_all(void)
63 * 64 *
64 * Called from kernel/module.c:sys_init_module and routine for a.out format. 65 * Called from kernel/module.c:sys_init_module and routine for a.out format.
65 */ 66 */
66void flush_icache_range(unsigned long start, unsigned long end) 67static void sh7705_flush_icache_range(void *args)
67{ 68{
69 struct flusher_data *data = args;
70 unsigned long start, end;
71
72 start = data->addr1;
73 end = data->addr2;
74
68 __flush_wback_region((void *)start, end - start); 75 __flush_wback_region((void *)start, end - start);
69} 76}
70 77
71/* 78/*
72 * Writeback&Invalidate the D-cache of the page 79 * Writeback&Invalidate the D-cache of the page
73 */ 80 */
74static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys) 81static void __flush_dcache_page(unsigned long phys)
75{ 82{
76 unsigned long ways, waysize, addrstart; 83 unsigned long ways, waysize, addrstart;
77 unsigned long flags; 84 unsigned long flags;
@@ -126,13 +133,18 @@ static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys)
126 * Write back & invalidate the D-cache of the page. 133 * Write back & invalidate the D-cache of the page.
127 * (To avoid "alias" issues) 134 * (To avoid "alias" issues)
128 */ 135 */
129void flush_dcache_page(struct page *page) 136static void sh7705_flush_dcache_page(void *arg)
130{ 137{
131 if (test_bit(PG_mapped, &page->flags)) 138 struct page *page = arg;
139 struct address_space *mapping = page_mapping(page);
140
141 if (mapping && !mapping_mapped(mapping))
142 set_bit(PG_dcache_dirty, &page->flags);
143 else
132 __flush_dcache_page(PHYSADDR(page_address(page))); 144 __flush_dcache_page(PHYSADDR(page_address(page)));
133} 145}
134 146
135void __uses_jump_to_uncached flush_cache_all(void) 147static void sh7705_flush_cache_all(void *args)
136{ 148{
137 unsigned long flags; 149 unsigned long flags;
138 150
@@ -144,44 +156,16 @@ void __uses_jump_to_uncached flush_cache_all(void)
144 local_irq_restore(flags); 156 local_irq_restore(flags);
145} 157}
146 158
147void flush_cache_mm(struct mm_struct *mm)
148{
149 /* Is there any good way? */
150 /* XXX: possibly call flush_cache_range for each vm area */
151 flush_cache_all();
152}
153
154/*
155 * Write back and invalidate D-caches.
156 *
157 * START, END: Virtual Address (U0 address)
158 *
159 * NOTE: We need to flush the _physical_ page entry.
160 * Flushing the cache lines for U0 only isn't enough.
161 * We need to flush for P1 too, which may contain aliases.
162 */
163void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
164 unsigned long end)
165{
166
167 /*
168 * We could call flush_cache_page for the pages of these range,
169 * but it's not efficient (scan the caches all the time...).
170 *
171 * We can't use A-bit magic, as there's the case we don't have
172 * valid entry on TLB.
173 */
174 flush_cache_all();
175}
176
177/* 159/*
178 * Write back and invalidate I/D-caches for the page. 160 * Write back and invalidate I/D-caches for the page.
179 * 161 *
180 * ADDRESS: Virtual Address (U0 address) 162 * ADDRESS: Virtual Address (U0 address)
181 */ 163 */
182void flush_cache_page(struct vm_area_struct *vma, unsigned long address, 164static void sh7705_flush_cache_page(void *args)
183 unsigned long pfn)
184{ 165{
166 struct flusher_data *data = args;
167 unsigned long pfn = data->addr2;
168
185 __flush_dcache_page(pfn << PAGE_SHIFT); 169 __flush_dcache_page(pfn << PAGE_SHIFT);
186} 170}
187 171
@@ -193,7 +177,19 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address,
193 * Not entirely sure why this is necessary on SH3 with 32K cache but 177 * Not entirely sure why this is necessary on SH3 with 32K cache but
194 * without it we get occasional "Memory fault" when loading a program. 178 * without it we get occasional "Memory fault" when loading a program.
195 */ 179 */
196void flush_icache_page(struct vm_area_struct *vma, struct page *page) 180static void sh7705_flush_icache_page(void *page)
197{ 181{
198 __flush_purge_region(page_address(page), PAGE_SIZE); 182 __flush_purge_region(page_address(page), PAGE_SIZE);
199} 183}
184
185void __init sh7705_cache_init(void)
186{
187 local_flush_icache_range = sh7705_flush_icache_range;
188 local_flush_dcache_page = sh7705_flush_dcache_page;
189 local_flush_cache_all = sh7705_flush_cache_all;
190 local_flush_cache_mm = sh7705_flush_cache_all;
191 local_flush_cache_dup_mm = sh7705_flush_cache_all;
192 local_flush_cache_range = sh7705_flush_cache_all;
193 local_flush_cache_page = sh7705_flush_cache_page;
194 local_flush_icache_page = sh7705_flush_icache_page;
195}
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
new file mode 100644
index 00000000000..35c37b7f717
--- /dev/null
+++ b/arch/sh/mm/cache.c
@@ -0,0 +1,316 @@
1/*
2 * arch/sh/mm/cache.c
3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2002 - 2009 Paul Mundt
6 *
7 * Released under the terms of the GNU GPL v2.0.
8 */
9#include <linux/mm.h>
10#include <linux/init.h>
11#include <linux/mutex.h>
12#include <linux/fs.h>
13#include <linux/smp.h>
14#include <linux/highmem.h>
15#include <linux/module.h>
16#include <asm/mmu_context.h>
17#include <asm/cacheflush.h>
18
19void (*local_flush_cache_all)(void *args) = cache_noop;
20void (*local_flush_cache_mm)(void *args) = cache_noop;
21void (*local_flush_cache_dup_mm)(void *args) = cache_noop;
22void (*local_flush_cache_page)(void *args) = cache_noop;
23void (*local_flush_cache_range)(void *args) = cache_noop;
24void (*local_flush_dcache_page)(void *args) = cache_noop;
25void (*local_flush_icache_range)(void *args) = cache_noop;
26void (*local_flush_icache_page)(void *args) = cache_noop;
27void (*local_flush_cache_sigtramp)(void *args) = cache_noop;
28
29void (*__flush_wback_region)(void *start, int size);
30void (*__flush_purge_region)(void *start, int size);
31void (*__flush_invalidate_region)(void *start, int size);
32
33static inline void noop__flush_region(void *start, int size)
34{
35}
36
37static inline void cacheop_on_each_cpu(void (*func) (void *info), void *info,
38 int wait)
39{
40 preempt_disable();
41 smp_call_function(func, info, wait);
42 func(info);
43 preempt_enable();
44}
45
46void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
47 unsigned long vaddr, void *dst, const void *src,
48 unsigned long len)
49{
50 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
51 !test_bit(PG_dcache_dirty, &page->flags)) {
52 void *vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
53 memcpy(vto, src, len);
54 kunmap_coherent(vto);
55 } else {
56 memcpy(dst, src, len);
57 if (boot_cpu_data.dcache.n_aliases)
58 set_bit(PG_dcache_dirty, &page->flags);
59 }
60
61 if (vma->vm_flags & VM_EXEC)
62 flush_cache_page(vma, vaddr, page_to_pfn(page));
63}
64
65void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
66 unsigned long vaddr, void *dst, const void *src,
67 unsigned long len)
68{
69 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
70 !test_bit(PG_dcache_dirty, &page->flags)) {
71 void *vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
72 memcpy(dst, vfrom, len);
73 kunmap_coherent(vfrom);
74 } else {
75 memcpy(dst, src, len);
76 if (boot_cpu_data.dcache.n_aliases)
77 set_bit(PG_dcache_dirty, &page->flags);
78 }
79}
80
81void copy_user_highpage(struct page *to, struct page *from,
82 unsigned long vaddr, struct vm_area_struct *vma)
83{
84 void *vfrom, *vto;
85
86 vto = kmap_atomic(to, KM_USER1);
87
88 if (boot_cpu_data.dcache.n_aliases && page_mapped(from) &&
89 !test_bit(PG_dcache_dirty, &from->flags)) {
90 vfrom = kmap_coherent(from, vaddr);
91 copy_page(vto, vfrom);
92 kunmap_coherent(vfrom);
93 } else {
94 vfrom = kmap_atomic(from, KM_USER0);
95 copy_page(vto, vfrom);
96 kunmap_atomic(vfrom, KM_USER0);
97 }
98
99 if (pages_do_alias((unsigned long)vto, vaddr & PAGE_MASK))
100 __flush_purge_region(vto, PAGE_SIZE);
101
102 kunmap_atomic(vto, KM_USER1);
103 /* Make sure this page is cleared on other CPU's too before using it */
104 smp_wmb();
105}
106EXPORT_SYMBOL(copy_user_highpage);
107
108void clear_user_highpage(struct page *page, unsigned long vaddr)
109{
110 void *kaddr = kmap_atomic(page, KM_USER0);
111
112 clear_page(kaddr);
113
114 if (pages_do_alias((unsigned long)kaddr, vaddr & PAGE_MASK))
115 __flush_purge_region(kaddr, PAGE_SIZE);
116
117 kunmap_atomic(kaddr, KM_USER0);
118}
119EXPORT_SYMBOL(clear_user_highpage);
120
121void __update_cache(struct vm_area_struct *vma,
122 unsigned long address, pte_t pte)
123{
124 struct page *page;
125 unsigned long pfn = pte_pfn(pte);
126
127 if (!boot_cpu_data.dcache.n_aliases)
128 return;
129
130 page = pfn_to_page(pfn);
131 if (pfn_valid(pfn) && page_mapping(page)) {
132 int dirty = test_and_clear_bit(PG_dcache_dirty, &page->flags);
133 if (dirty) {
134 unsigned long addr = (unsigned long)page_address(page);
135
136 if (pages_do_alias(addr, address & PAGE_MASK))
137 __flush_purge_region((void *)addr, PAGE_SIZE);
138 }
139 }
140}
141
142void __flush_anon_page(struct page *page, unsigned long vmaddr)
143{
144 unsigned long addr = (unsigned long) page_address(page);
145
146 if (pages_do_alias(addr, vmaddr)) {
147 if (boot_cpu_data.dcache.n_aliases && page_mapped(page) &&
148 !test_bit(PG_dcache_dirty, &page->flags)) {
149 void *kaddr;
150
151 kaddr = kmap_coherent(page, vmaddr);
152 /* XXX.. For now kunmap_coherent() does a purge */
153 /* __flush_purge_region((void *)kaddr, PAGE_SIZE); */
154 kunmap_coherent(kaddr);
155 } else
156 __flush_purge_region((void *)addr, PAGE_SIZE);
157 }
158}
159
160void flush_cache_all(void)
161{
162 cacheop_on_each_cpu(local_flush_cache_all, NULL, 1);
163}
164
165void flush_cache_mm(struct mm_struct *mm)
166{
167 cacheop_on_each_cpu(local_flush_cache_mm, mm, 1);
168}
169
170void flush_cache_dup_mm(struct mm_struct *mm)
171{
172 cacheop_on_each_cpu(local_flush_cache_dup_mm, mm, 1);
173}
174
175void flush_cache_page(struct vm_area_struct *vma, unsigned long addr,
176 unsigned long pfn)
177{
178 struct flusher_data data;
179
180 data.vma = vma;
181 data.addr1 = addr;
182 data.addr2 = pfn;
183
184 cacheop_on_each_cpu(local_flush_cache_page, (void *)&data, 1);
185}
186
187void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
188 unsigned long end)
189{
190 struct flusher_data data;
191
192 data.vma = vma;
193 data.addr1 = start;
194 data.addr2 = end;
195
196 cacheop_on_each_cpu(local_flush_cache_range, (void *)&data, 1);
197}
198
199void flush_dcache_page(struct page *page)
200{
201 cacheop_on_each_cpu(local_flush_dcache_page, page, 1);
202}
203
204void flush_icache_range(unsigned long start, unsigned long end)
205{
206 struct flusher_data data;
207
208 data.vma = NULL;
209 data.addr1 = start;
210 data.addr2 = end;
211
212 cacheop_on_each_cpu(local_flush_icache_range, (void *)&data, 1);
213}
214
215void flush_icache_page(struct vm_area_struct *vma, struct page *page)
216{
217 /* Nothing uses the VMA, so just pass the struct page along */
218 cacheop_on_each_cpu(local_flush_icache_page, page, 1);
219}
220
221void flush_cache_sigtramp(unsigned long address)
222{
223 cacheop_on_each_cpu(local_flush_cache_sigtramp, (void *)address, 1);
224}
225
226static void compute_alias(struct cache_info *c)
227{
228 c->alias_mask = ((c->sets - 1) << c->entry_shift) & ~(PAGE_SIZE - 1);
229 c->n_aliases = c->alias_mask ? (c->alias_mask >> PAGE_SHIFT) + 1 : 0;
230}
231
232static void __init emit_cache_params(void)
233{
234 printk(KERN_NOTICE "I-cache : n_ways=%d n_sets=%d way_incr=%d\n",
235 boot_cpu_data.icache.ways,
236 boot_cpu_data.icache.sets,
237 boot_cpu_data.icache.way_incr);
238 printk(KERN_NOTICE "I-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
239 boot_cpu_data.icache.entry_mask,
240 boot_cpu_data.icache.alias_mask,
241 boot_cpu_data.icache.n_aliases);
242 printk(KERN_NOTICE "D-cache : n_ways=%d n_sets=%d way_incr=%d\n",
243 boot_cpu_data.dcache.ways,
244 boot_cpu_data.dcache.sets,
245 boot_cpu_data.dcache.way_incr);
246 printk(KERN_NOTICE "D-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
247 boot_cpu_data.dcache.entry_mask,
248 boot_cpu_data.dcache.alias_mask,
249 boot_cpu_data.dcache.n_aliases);
250
251 /*
252 * Emit Secondary Cache parameters if the CPU has a probed L2.
253 */
254 if (boot_cpu_data.flags & CPU_HAS_L2_CACHE) {
255 printk(KERN_NOTICE "S-cache : n_ways=%d n_sets=%d way_incr=%d\n",
256 boot_cpu_data.scache.ways,
257 boot_cpu_data.scache.sets,
258 boot_cpu_data.scache.way_incr);
259 printk(KERN_NOTICE "S-cache : entry_mask=0x%08x alias_mask=0x%08x n_aliases=%d\n",
260 boot_cpu_data.scache.entry_mask,
261 boot_cpu_data.scache.alias_mask,
262 boot_cpu_data.scache.n_aliases);
263 }
264}
265
266void __init cpu_cache_init(void)
267{
268 compute_alias(&boot_cpu_data.icache);
269 compute_alias(&boot_cpu_data.dcache);
270 compute_alias(&boot_cpu_data.scache);
271
272 __flush_wback_region = noop__flush_region;
273 __flush_purge_region = noop__flush_region;
274 __flush_invalidate_region = noop__flush_region;
275
276 if (boot_cpu_data.family == CPU_FAMILY_SH2) {
277 extern void __weak sh2_cache_init(void);
278
279 sh2_cache_init();
280 }
281
282 if (boot_cpu_data.family == CPU_FAMILY_SH2A) {
283 extern void __weak sh2a_cache_init(void);
284
285 sh2a_cache_init();
286 }
287
288 if (boot_cpu_data.family == CPU_FAMILY_SH3) {
289 extern void __weak sh3_cache_init(void);
290
291 sh3_cache_init();
292
293 if ((boot_cpu_data.type == CPU_SH7705) &&
294 (boot_cpu_data.dcache.sets == 512)) {
295 extern void __weak sh7705_cache_init(void);
296
297 sh7705_cache_init();
298 }
299 }
300
301 if ((boot_cpu_data.family == CPU_FAMILY_SH4) ||
302 (boot_cpu_data.family == CPU_FAMILY_SH4A) ||
303 (boot_cpu_data.family == CPU_FAMILY_SH4AL_DSP)) {
304 extern void __weak sh4_cache_init(void);
305
306 sh4_cache_init();
307 }
308
309 if (boot_cpu_data.family == CPU_FAMILY_SH5) {
310 extern void __weak sh5_cache_init(void);
311
312 sh5_cache_init();
313 }
314
315 emit_cache_params();
316}
diff --git a/arch/sh/mm/fault_32.c b/arch/sh/mm/fault_32.c
index 71925946f1e..781b413ff82 100644
--- a/arch/sh/mm/fault_32.c
+++ b/arch/sh/mm/fault_32.c
@@ -2,7 +2,7 @@
2 * Page fault handler for SH with an MMU. 2 * Page fault handler for SH with an MMU.
3 * 3 *
4 * Copyright (C) 1999 Niibe Yutaka 4 * Copyright (C) 1999 Niibe Yutaka
5 * Copyright (C) 2003 - 2008 Paul Mundt 5 * Copyright (C) 2003 - 2009 Paul Mundt
6 * 6 *
7 * Based on linux/arch/i386/mm/fault.c: 7 * Based on linux/arch/i386/mm/fault.c:
8 * Copyright (C) 1995 Linus Torvalds 8 * Copyright (C) 1995 Linus Torvalds
@@ -25,18 +25,91 @@ static inline int notify_page_fault(struct pt_regs *regs, int trap)
25{ 25{
26 int ret = 0; 26 int ret = 0;
27 27
28#ifdef CONFIG_KPROBES 28 if (kprobes_built_in() && !user_mode(regs)) {
29 if (!user_mode(regs)) {
30 preempt_disable(); 29 preempt_disable();
31 if (kprobe_running() && kprobe_fault_handler(regs, trap)) 30 if (kprobe_running() && kprobe_fault_handler(regs, trap))
32 ret = 1; 31 ret = 1;
33 preempt_enable(); 32 preempt_enable();
34 } 33 }
35#endif
36 34
37 return ret; 35 return ret;
38} 36}
39 37
38static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address)
39{
40 unsigned index = pgd_index(address);
41 pgd_t *pgd_k;
42 pud_t *pud, *pud_k;
43 pmd_t *pmd, *pmd_k;
44
45 pgd += index;
46 pgd_k = init_mm.pgd + index;
47
48 if (!pgd_present(*pgd_k))
49 return NULL;
50
51 pud = pud_offset(pgd, address);
52 pud_k = pud_offset(pgd_k, address);
53 if (!pud_present(*pud_k))
54 return NULL;
55
56 pmd = pmd_offset(pud, address);
57 pmd_k = pmd_offset(pud_k, address);
58 if (!pmd_present(*pmd_k))
59 return NULL;
60
61 if (!pmd_present(*pmd))
62 set_pmd(pmd, *pmd_k);
63 else {
64 /*
65 * The page tables are fully synchronised so there must
66 * be another reason for the fault. Return NULL here to
67 * signal that we have not taken care of the fault.
68 */
69 BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k));
70 return NULL;
71 }
72
73 return pmd_k;
74}
75
76/*
77 * Handle a fault on the vmalloc or module mapping area
78 */
79static noinline int vmalloc_fault(unsigned long address)
80{
81 pgd_t *pgd_k;
82 pmd_t *pmd_k;
83 pte_t *pte_k;
84
85 /* Make sure we are in vmalloc/module/P3 area: */
86 if (!(address >= VMALLOC_START && address < P3_ADDR_MAX))
87 return -1;
88
89 /*
90 * Synchronize this task's top level page-table
91 * with the 'reference' page table.
92 *
93 * Do _not_ use "current" here. We might be inside
94 * an interrupt in the middle of a task switch..
95 */
96 pgd_k = get_TTB();
97 pmd_k = vmalloc_sync_one(pgd_k, address);
98 if (!pmd_k)
99 return -1;
100
101 pte_k = pte_offset_kernel(pmd_k, address);
102 if (!pte_present(*pte_k))
103 return -1;
104
105 return 0;
106}
107
108static int fault_in_kernel_space(unsigned long address)
109{
110 return address >= TASK_SIZE;
111}
112
40/* 113/*
41 * This routine handles page faults. It determines the address, 114 * This routine handles page faults. It determines the address,
42 * and the problem, and then passes it off to one of the appropriate 115 * and the problem, and then passes it off to one of the appropriate
@@ -46,6 +119,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
46 unsigned long writeaccess, 119 unsigned long writeaccess,
47 unsigned long address) 120 unsigned long address)
48{ 121{
122 unsigned long vec;
49 struct task_struct *tsk; 123 struct task_struct *tsk;
50 struct mm_struct *mm; 124 struct mm_struct *mm;
51 struct vm_area_struct * vma; 125 struct vm_area_struct * vma;
@@ -53,59 +127,30 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
53 int fault; 127 int fault;
54 siginfo_t info; 128 siginfo_t info;
55 129
56 /*
57 * We don't bother with any notifier callbacks here, as they are
58 * all handled through the __do_page_fault() fast-path.
59 */
60
61 tsk = current; 130 tsk = current;
131 mm = tsk->mm;
62 si_code = SEGV_MAPERR; 132 si_code = SEGV_MAPERR;
133 vec = lookup_exception_vector();
63 134
64 if (unlikely(address >= TASK_SIZE)) { 135 /*
65 /* 136 * We fault-in kernel-space virtual memory on-demand. The
66 * Synchronize this task's top level page-table 137 * 'reference' page table is init_mm.pgd.
67 * with the 'reference' page table. 138 *
68 * 139 * NOTE! We MUST NOT take any locks for this case. We may
69 * Do _not_ use "tsk" here. We might be inside 140 * be in an interrupt or a critical region, and should
70 * an interrupt in the middle of a task switch.. 141 * only copy the information from the master page table,
71 */ 142 * nothing more.
72 int offset = pgd_index(address); 143 */
73 pgd_t *pgd, *pgd_k; 144 if (unlikely(fault_in_kernel_space(address))) {
74 pud_t *pud, *pud_k; 145 if (vmalloc_fault(address) >= 0)
75 pmd_t *pmd, *pmd_k;
76
77 pgd = get_TTB() + offset;
78 pgd_k = swapper_pg_dir + offset;
79
80 if (!pgd_present(*pgd)) {
81 if (!pgd_present(*pgd_k))
82 goto bad_area_nosemaphore;
83 set_pgd(pgd, *pgd_k);
84 return; 146 return;
85 } 147 if (notify_page_fault(regs, vec))
86
87 pud = pud_offset(pgd, address);
88 pud_k = pud_offset(pgd_k, address);
89
90 if (!pud_present(*pud)) {
91 if (!pud_present(*pud_k))
92 goto bad_area_nosemaphore;
93 set_pud(pud, *pud_k);
94 return; 148 return;
95 }
96 149
97 pmd = pmd_offset(pud, address); 150 goto bad_area_nosemaphore;
98 pmd_k = pmd_offset(pud_k, address);
99 if (pmd_present(*pmd) || !pmd_present(*pmd_k))
100 goto bad_area_nosemaphore;
101 set_pmd(pmd, *pmd_k);
102
103 return;
104 } 151 }
105 152
106 mm = tsk->mm; 153 if (unlikely(notify_page_fault(regs, vec)))
107
108 if (unlikely(notify_page_fault(regs, lookup_exception_vector())))
109 return; 154 return;
110 155
111 /* Only enable interrupts if they were on before the fault */ 156 /* Only enable interrupts if they were on before the fault */
@@ -115,8 +160,8 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
115 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); 160 perf_swcounter_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address);
116 161
117 /* 162 /*
118 * If we're in an interrupt or have no user 163 * If we're in an interrupt, have no user context or are running
119 * context, we must not take the fault.. 164 * in an atomic region then we must not take the fault:
120 */ 165 */
121 if (in_atomic() || !mm) 166 if (in_atomic() || !mm)
122 goto no_context; 167 goto no_context;
@@ -132,10 +177,11 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
132 goto bad_area; 177 goto bad_area;
133 if (expand_stack(vma, address)) 178 if (expand_stack(vma, address))
134 goto bad_area; 179 goto bad_area;
135/* 180
136 * Ok, we have a good vm_area for this memory access, so 181 /*
137 * we can handle it.. 182 * Ok, we have a good vm_area for this memory access, so
138 */ 183 * we can handle it..
184 */
139good_area: 185good_area:
140 si_code = SEGV_ACCERR; 186 si_code = SEGV_ACCERR;
141 if (writeaccess) { 187 if (writeaccess) {
@@ -173,10 +219,10 @@ survive:
173 up_read(&mm->mmap_sem); 219 up_read(&mm->mmap_sem);
174 return; 220 return;
175 221
176/* 222 /*
177 * Something tried to access memory that isn't in our memory map.. 223 * Something tried to access memory that isn't in our memory map..
178 * Fix it, but check if it's kernel or user first.. 224 * Fix it, but check if it's kernel or user first..
179 */ 225 */
180bad_area: 226bad_area:
181 up_read(&mm->mmap_sem); 227 up_read(&mm->mmap_sem);
182 228
@@ -272,16 +318,15 @@ do_sigbus:
272/* 318/*
273 * Called with interrupts disabled. 319 * Called with interrupts disabled.
274 */ 320 */
275asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs, 321asmlinkage int __kprobes
276 unsigned long writeaccess, 322handle_tlbmiss(struct pt_regs *regs, unsigned long writeaccess,
277 unsigned long address) 323 unsigned long address)
278{ 324{
279 pgd_t *pgd; 325 pgd_t *pgd;
280 pud_t *pud; 326 pud_t *pud;
281 pmd_t *pmd; 327 pmd_t *pmd;
282 pte_t *pte; 328 pte_t *pte;
283 pte_t entry; 329 pte_t entry;
284 int ret = 1;
285 330
286 /* 331 /*
287 * We don't take page faults for P1, P2, and parts of P4, these 332 * We don't take page faults for P1, P2, and parts of P4, these
@@ -292,40 +337,41 @@ asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
292 pgd = pgd_offset_k(address); 337 pgd = pgd_offset_k(address);
293 } else { 338 } else {
294 if (unlikely(address >= TASK_SIZE || !current->mm)) 339 if (unlikely(address >= TASK_SIZE || !current->mm))
295 goto out; 340 return 1;
296 341
297 pgd = pgd_offset(current->mm, address); 342 pgd = pgd_offset(current->mm, address);
298 } 343 }
299 344
300 pud = pud_offset(pgd, address); 345 pud = pud_offset(pgd, address);
301 if (pud_none_or_clear_bad(pud)) 346 if (pud_none_or_clear_bad(pud))
302 goto out; 347 return 1;
303 pmd = pmd_offset(pud, address); 348 pmd = pmd_offset(pud, address);
304 if (pmd_none_or_clear_bad(pmd)) 349 if (pmd_none_or_clear_bad(pmd))
305 goto out; 350 return 1;
306 pte = pte_offset_kernel(pmd, address); 351 pte = pte_offset_kernel(pmd, address);
307 entry = *pte; 352 entry = *pte;
308 if (unlikely(pte_none(entry) || pte_not_present(entry))) 353 if (unlikely(pte_none(entry) || pte_not_present(entry)))
309 goto out; 354 return 1;
310 if (unlikely(writeaccess && !pte_write(entry))) 355 if (unlikely(writeaccess && !pte_write(entry)))
311 goto out; 356 return 1;
312 357
313 if (writeaccess) 358 if (writeaccess)
314 entry = pte_mkdirty(entry); 359 entry = pte_mkdirty(entry);
315 entry = pte_mkyoung(entry); 360 entry = pte_mkyoung(entry);
316 361
362 set_pte(pte, entry);
363
317#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SMP) 364#if defined(CONFIG_CPU_SH4) && !defined(CONFIG_SMP)
318 /* 365 /*
319 * ITLB is not affected by "ldtlb" instruction. 366 * SH-4 does not set MMUCR.RC to the corresponding TLB entry in
320 * So, we need to flush the entry by ourselves. 367 * the case of an initial page write exception, so we need to
368 * flush it in order to avoid potential TLB entry duplication.
321 */ 369 */
322 local_flush_tlb_one(get_asid(), address & PAGE_MASK); 370 if (writeaccess == 2)
371 local_flush_tlb_one(get_asid(), address & PAGE_MASK);
323#endif 372#endif
324 373
325 set_pte(pte, entry);
326 update_mmu_cache(NULL, address, entry); 374 update_mmu_cache(NULL, address, entry);
327 375
328 ret = 0; 376 return 0;
329out:
330 return ret;
331} 377}
diff --git a/arch/sh/mm/fault_64.c b/arch/sh/mm/fault_64.c
index bd63b961b2a..2b356cec248 100644
--- a/arch/sh/mm/fault_64.c
+++ b/arch/sh/mm/fault_64.c
@@ -56,16 +56,7 @@ inline void __do_tlb_refill(unsigned long address,
56 /* 56 /*
57 * Set PTEH register 57 * Set PTEH register
58 */ 58 */
59 pteh = address & MMU_VPN_MASK; 59 pteh = neff_sign_extend(address & MMU_VPN_MASK);
60
61 /* Sign extend based on neff. */
62#if (NEFF == 32)
63 /* Faster sign extension */
64 pteh = (unsigned long long)(signed long long)(signed long)pteh;
65#else
66 /* General case */
67 pteh = (pteh & NEFF_SIGN) ? (pteh | NEFF_MASK) : pteh;
68#endif
69 60
70 /* Set the ASID. */ 61 /* Set the ASID. */
71 pteh |= get_asid() << PTEH_ASID_SHIFT; 62 pteh |= get_asid() << PTEH_ASID_SHIFT;
diff --git a/arch/sh/mm/flush-sh4.c b/arch/sh/mm/flush-sh4.c
new file mode 100644
index 00000000000..cef402678f4
--- /dev/null
+++ b/arch/sh/mm/flush-sh4.c
@@ -0,0 +1,108 @@
1#include <linux/mm.h>
2#include <asm/mmu_context.h>
3#include <asm/cacheflush.h>
4
5/*
6 * Write back the dirty D-caches, but not invalidate them.
7 *
8 * START: Virtual Address (U0, P1, or P3)
9 * SIZE: Size of the region.
10 */
11static void sh4__flush_wback_region(void *start, int size)
12{
13 reg_size_t aligned_start, v, cnt, end;
14
15 aligned_start = register_align(start);
16 v = aligned_start & ~(L1_CACHE_BYTES-1);
17 end = (aligned_start + size + L1_CACHE_BYTES-1)
18 & ~(L1_CACHE_BYTES-1);
19 cnt = (end - v) / L1_CACHE_BYTES;
20
21 while (cnt >= 8) {
22 __ocbwb(v); v += L1_CACHE_BYTES;
23 __ocbwb(v); v += L1_CACHE_BYTES;
24 __ocbwb(v); v += L1_CACHE_BYTES;
25 __ocbwb(v); v += L1_CACHE_BYTES;
26 __ocbwb(v); v += L1_CACHE_BYTES;
27 __ocbwb(v); v += L1_CACHE_BYTES;
28 __ocbwb(v); v += L1_CACHE_BYTES;
29 __ocbwb(v); v += L1_CACHE_BYTES;
30 cnt -= 8;
31 }
32
33 while (cnt) {
34 __ocbwb(v); v += L1_CACHE_BYTES;
35 cnt--;
36 }
37}
38
39/*
40 * Write back the dirty D-caches and invalidate them.
41 *
42 * START: Virtual Address (U0, P1, or P3)
43 * SIZE: Size of the region.
44 */
45static void sh4__flush_purge_region(void *start, int size)
46{
47 reg_size_t aligned_start, v, cnt, end;
48
49 aligned_start = register_align(start);
50 v = aligned_start & ~(L1_CACHE_BYTES-1);
51 end = (aligned_start + size + L1_CACHE_BYTES-1)
52 & ~(L1_CACHE_BYTES-1);
53 cnt = (end - v) / L1_CACHE_BYTES;
54
55 while (cnt >= 8) {
56 __ocbp(v); v += L1_CACHE_BYTES;
57 __ocbp(v); v += L1_CACHE_BYTES;
58 __ocbp(v); v += L1_CACHE_BYTES;
59 __ocbp(v); v += L1_CACHE_BYTES;
60 __ocbp(v); v += L1_CACHE_BYTES;
61 __ocbp(v); v += L1_CACHE_BYTES;
62 __ocbp(v); v += L1_CACHE_BYTES;
63 __ocbp(v); v += L1_CACHE_BYTES;
64 cnt -= 8;
65 }
66 while (cnt) {
67 __ocbp(v); v += L1_CACHE_BYTES;
68 cnt--;
69 }
70}
71
72/*
73 * No write back please
74 */
75static void sh4__flush_invalidate_region(void *start, int size)
76{
77 reg_size_t aligned_start, v, cnt, end;
78
79 aligned_start = register_align(start);
80 v = aligned_start & ~(L1_CACHE_BYTES-1);
81 end = (aligned_start + size + L1_CACHE_BYTES-1)
82 & ~(L1_CACHE_BYTES-1);
83 cnt = (end - v) / L1_CACHE_BYTES;
84
85 while (cnt >= 8) {
86 __ocbi(v); v += L1_CACHE_BYTES;
87 __ocbi(v); v += L1_CACHE_BYTES;
88 __ocbi(v); v += L1_CACHE_BYTES;
89 __ocbi(v); v += L1_CACHE_BYTES;
90 __ocbi(v); v += L1_CACHE_BYTES;
91 __ocbi(v); v += L1_CACHE_BYTES;
92 __ocbi(v); v += L1_CACHE_BYTES;
93 __ocbi(v); v += L1_CACHE_BYTES;
94 cnt -= 8;
95 }
96
97 while (cnt) {
98 __ocbi(v); v += L1_CACHE_BYTES;
99 cnt--;
100 }
101}
102
103void __init sh4__flush_region_init(void)
104{
105 __flush_wback_region = sh4__flush_wback_region;
106 __flush_invalidate_region = sh4__flush_invalidate_region;
107 __flush_purge_region = sh4__flush_purge_region;
108}
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index fe532aeaa16..edc842ff61e 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -106,27 +106,31 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
106 pgd_t *pgd; 106 pgd_t *pgd;
107 pud_t *pud; 107 pud_t *pud;
108 pmd_t *pmd; 108 pmd_t *pmd;
109 int pgd_idx; 109 pte_t *pte;
110 int i, j, k;
110 unsigned long vaddr; 111 unsigned long vaddr;
111 112
112 vaddr = start & PMD_MASK; 113 vaddr = start;
113 end = (end + PMD_SIZE - 1) & PMD_MASK; 114 i = __pgd_offset(vaddr);
114 pgd_idx = pgd_index(vaddr); 115 j = __pud_offset(vaddr);
115 pgd = pgd_base + pgd_idx; 116 k = __pmd_offset(vaddr);
116 117 pgd = pgd_base + i;
117 for ( ; (pgd_idx < PTRS_PER_PGD) && (vaddr != end); pgd++, pgd_idx++) { 118
118 BUG_ON(pgd_none(*pgd)); 119 for ( ; (i < PTRS_PER_PGD) && (vaddr != end); pgd++, i++) {
119 pud = pud_offset(pgd, 0); 120 pud = (pud_t *)pgd;
120 BUG_ON(pud_none(*pud)); 121 for ( ; (j < PTRS_PER_PUD) && (vaddr != end); pud++, j++) {
121 pmd = pmd_offset(pud, 0); 122 pmd = (pmd_t *)pud;
122 123 for (; (k < PTRS_PER_PMD) && (vaddr != end); pmd++, k++) {
123 if (!pmd_present(*pmd)) { 124 if (pmd_none(*pmd)) {
124 pte_t *pte_table; 125 pte = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
125 pte_table = (pte_t *)alloc_bootmem_low_pages(PAGE_SIZE); 126 pmd_populate_kernel(&init_mm, pmd, pte);
126 pmd_populate_kernel(&init_mm, pmd, pte_table); 127 BUG_ON(pte != pte_offset_kernel(pmd, 0));
128 }
129 vaddr += PMD_SIZE;
130 }
131 k = 0;
127 } 132 }
128 133 j = 0;
129 vaddr += PMD_SIZE;
130 } 134 }
131} 135}
132#endif /* CONFIG_MMU */ 136#endif /* CONFIG_MMU */
@@ -137,7 +141,7 @@ void __init page_table_range_init(unsigned long start, unsigned long end,
137void __init paging_init(void) 141void __init paging_init(void)
138{ 142{
139 unsigned long max_zone_pfns[MAX_NR_ZONES]; 143 unsigned long max_zone_pfns[MAX_NR_ZONES];
140 unsigned long vaddr; 144 unsigned long vaddr, end;
141 int nid; 145 int nid;
142 146
143 /* We don't need to map the kernel through the TLB, as 147 /* We don't need to map the kernel through the TLB, as
@@ -155,7 +159,8 @@ void __init paging_init(void)
155 * pte's will be filled in by __set_fixmap(). 159 * pte's will be filled in by __set_fixmap().
156 */ 160 */
157 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK; 161 vaddr = __fix_to_virt(__end_of_fixed_addresses - 1) & PMD_MASK;
158 page_table_range_init(vaddr, 0, swapper_pg_dir); 162 end = (FIXADDR_TOP + PMD_SIZE - 1) & PMD_MASK;
163 page_table_range_init(vaddr, end, swapper_pg_dir);
159 164
160 kmap_coherent_init(); 165 kmap_coherent_init();
161 166
@@ -210,6 +215,9 @@ void __init mem_init(void)
210 high_memory = node_high_memory; 215 high_memory = node_high_memory;
211 } 216 }
212 217
218 /* Set this up early, so we can take care of the zero page */
219 cpu_cache_init();
220
213 /* clear the zero-page */ 221 /* clear the zero-page */
214 memset(empty_zero_page, 0, PAGE_SIZE); 222 memset(empty_zero_page, 0, PAGE_SIZE);
215 __flush_wback_region(empty_zero_page, PAGE_SIZE); 223 __flush_wback_region(empty_zero_page, PAGE_SIZE);
@@ -230,8 +238,6 @@ void __init mem_init(void)
230 datasize >> 10, 238 datasize >> 10,
231 initsize >> 10); 239 initsize >> 10);
232 240
233 p3_cache_init();
234
235 /* Initialize the vDSO */ 241 /* Initialize the vDSO */
236 vsyscall_init(); 242 vsyscall_init();
237} 243}
diff --git a/arch/sh/mm/ioremap_32.c b/arch/sh/mm/ioremap_32.c
index da2f4186f2c..c3250614e3a 100644
--- a/arch/sh/mm/ioremap_32.c
+++ b/arch/sh/mm/ioremap_32.c
@@ -57,14 +57,6 @@ void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
57 if (is_pci_memory_fixed_range(phys_addr, size)) 57 if (is_pci_memory_fixed_range(phys_addr, size))
58 return (void __iomem *)phys_addr; 58 return (void __iomem *)phys_addr;
59 59
60#if !defined(CONFIG_PMB_FIXED)
61 /*
62 * Don't allow anybody to remap normal RAM that we're using..
63 */
64 if (phys_addr < virt_to_phys(high_memory))
65 return NULL;
66#endif
67
68 /* 60 /*
69 * Mappings have to be page-aligned 61 * Mappings have to be page-aligned
70 */ 62 */
diff --git a/arch/sh/mm/ioremap_64.c b/arch/sh/mm/ioremap_64.c
index 828c8597219..b16843d02b7 100644
--- a/arch/sh/mm/ioremap_64.c
+++ b/arch/sh/mm/ioremap_64.c
@@ -94,7 +94,6 @@ static struct resource *shmedia_find_resource(struct resource *root,
94static void __iomem *shmedia_alloc_io(unsigned long phys, unsigned long size, 94static void __iomem *shmedia_alloc_io(unsigned long phys, unsigned long size,
95 const char *name, unsigned long flags) 95 const char *name, unsigned long flags)
96{ 96{
97 static int printed_full;
98 struct xresource *xres; 97 struct xresource *xres;
99 struct resource *res; 98 struct resource *res;
100 char *tack; 99 char *tack;
@@ -108,11 +107,8 @@ static void __iomem *shmedia_alloc_io(unsigned long phys, unsigned long size,
108 tack = xres->xname; 107 tack = xres->xname;
109 res = &xres->xres; 108 res = &xres->xres;
110 } else { 109 } else {
111 if (!printed_full) { 110 printk_once(KERN_NOTICE "%s: done with statics, "
112 printk(KERN_NOTICE "%s: done with statics, "
113 "switching to kmalloc\n", __func__); 111 "switching to kmalloc\n", __func__);
114 printed_full = 1;
115 }
116 tlen = strlen(name); 112 tlen = strlen(name);
117 tack = kmalloc(sizeof(struct resource) + tlen + 1, GFP_KERNEL); 113 tack = kmalloc(sizeof(struct resource) + tlen + 1, GFP_KERNEL);
118 if (!tack) 114 if (!tack)
diff --git a/arch/sh/mm/kmap.c b/arch/sh/mm/kmap.c
new file mode 100644
index 00000000000..16e01b5fed0
--- /dev/null
+++ b/arch/sh/mm/kmap.c
@@ -0,0 +1,65 @@
1/*
2 * arch/sh/mm/kmap.c
3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2002 - 2009 Paul Mundt
6 *
7 * Released under the terms of the GNU GPL v2.0.
8 */
9#include <linux/mm.h>
10#include <linux/init.h>
11#include <linux/mutex.h>
12#include <linux/fs.h>
13#include <linux/highmem.h>
14#include <linux/module.h>
15#include <asm/mmu_context.h>
16#include <asm/cacheflush.h>
17
18#define kmap_get_fixmap_pte(vaddr) \
19 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
20
21static pte_t *kmap_coherent_pte;
22
23void __init kmap_coherent_init(void)
24{
25 unsigned long vaddr;
26
27 /* cache the first coherent kmap pte */
28 vaddr = __fix_to_virt(FIX_CMAP_BEGIN);
29 kmap_coherent_pte = kmap_get_fixmap_pte(vaddr);
30}
31
32void *kmap_coherent(struct page *page, unsigned long addr)
33{
34 enum fixed_addresses idx;
35 unsigned long vaddr;
36
37 BUG_ON(test_bit(PG_dcache_dirty, &page->flags));
38
39 pagefault_disable();
40
41 idx = FIX_CMAP_END -
42 ((addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT);
43 vaddr = __fix_to_virt(idx);
44
45 BUG_ON(!pte_none(*(kmap_coherent_pte - idx)));
46 set_pte(kmap_coherent_pte - idx, mk_pte(page, PAGE_KERNEL));
47
48 return (void *)vaddr;
49}
50
51void kunmap_coherent(void *kvaddr)
52{
53 if (kvaddr >= (void *)FIXADDR_START) {
54 unsigned long vaddr = (unsigned long)kvaddr & PAGE_MASK;
55 enum fixed_addresses idx = __virt_to_fix(vaddr);
56
57 /* XXX.. Kill this later, here for sanity at the moment.. */
58 __flush_purge_region((void *)vaddr, PAGE_SIZE);
59
60 pte_clear(&init_mm, vaddr, kmap_coherent_pte - idx);
61 local_flush_tlb_one(get_asid(), vaddr);
62 }
63
64 pagefault_enable();
65}
diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
index 1b5fdfb4e0c..d2984fa42d3 100644
--- a/arch/sh/mm/mmap.c
+++ b/arch/sh/mm/mmap.c
@@ -14,10 +14,10 @@
14#include <asm/page.h> 14#include <asm/page.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16 16
17#ifdef CONFIG_MMU
18unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ 17unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
19EXPORT_SYMBOL(shm_align_mask); 18EXPORT_SYMBOL(shm_align_mask);
20 19
20#ifdef CONFIG_MMU
21/* 21/*
22 * To avoid cache aliases, we map the shared page with same color. 22 * To avoid cache aliases, we map the shared page with same color.
23 */ 23 */
diff --git a/arch/sh/mm/tlb-nommu.c b/arch/sh/mm/nommu.c
index 71c742b5aee..ac16c05917e 100644
--- a/arch/sh/mm/tlb-nommu.c
+++ b/arch/sh/mm/nommu.c
@@ -1,20 +1,41 @@
1/* 1/*
2 * arch/sh/mm/tlb-nommu.c 2 * arch/sh/mm/nommu.c
3 * 3 *
4 * TLB Operations for MMUless SH. 4 * Various helper routines and stubs for MMUless SH.
5 * 5 *
6 * Copyright (C) 2002 Paul Mundt 6 * Copyright (C) 2002 - 2009 Paul Mundt
7 * 7 *
8 * Released under the terms of the GNU GPL v2.0. 8 * Released under the terms of the GNU GPL v2.0.
9 */ 9 */
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/string.h>
11#include <linux/mm.h> 13#include <linux/mm.h>
12#include <asm/pgtable.h> 14#include <asm/pgtable.h>
13#include <asm/tlbflush.h> 15#include <asm/tlbflush.h>
16#include <asm/page.h>
17#include <asm/uaccess.h>
14 18
15/* 19/*
16 * Nothing too terribly exciting here .. 20 * Nothing too terribly exciting here ..
17 */ 21 */
22void copy_page(void *to, void *from)
23{
24 memcpy(to, from, PAGE_SIZE);
25}
26
27__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n)
28{
29 memcpy(to, from, n);
30 return 0;
31}
32
33__kernel_size_t __clear_user(void *to, __kernel_size_t n)
34{
35 memset(to, 0, n);
36 return 0;
37}
38
18void local_flush_tlb_all(void) 39void local_flush_tlb_all(void)
19{ 40{
20 BUG(); 41 BUG();
@@ -46,8 +67,21 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
46 BUG(); 67 BUG();
47} 68}
48 69
49void update_mmu_cache(struct vm_area_struct * vma, 70void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
50 unsigned long address, pte_t pte) 71{
72}
73
74void __init kmap_coherent_init(void)
75{
76}
77
78void *kmap_coherent(struct page *page, unsigned long addr)
79{
80 BUG();
81 return NULL;
82}
83
84void kunmap_coherent(void *kvaddr)
51{ 85{
52 BUG(); 86 BUG();
53} 87}
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c
index 095d93bec7c..9b784fdb947 100644
--- a/arch/sh/mm/numa.c
+++ b/arch/sh/mm/numa.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/bootmem.h> 11#include <linux/bootmem.h>
12#include <linux/lmb.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <linux/numa.h> 14#include <linux/numa.h>
14#include <linux/pfn.h> 15#include <linux/pfn.h>
@@ -26,6 +27,15 @@ EXPORT_SYMBOL_GPL(node_data);
26void __init setup_memory(void) 27void __init setup_memory(void)
27{ 28{
28 unsigned long free_pfn = PFN_UP(__pa(_end)); 29 unsigned long free_pfn = PFN_UP(__pa(_end));
30 u64 base = min_low_pfn << PAGE_SHIFT;
31 u64 size = (max_low_pfn << PAGE_SHIFT) - min_low_pfn;
32
33 lmb_add(base, size);
34
35 /* Reserve the LMB regions used by the kernel, initrd, etc.. */
36 lmb_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET,
37 (PFN_PHYS(free_pfn) + PAGE_SIZE - 1) -
38 (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET));
29 39
30 /* 40 /*
31 * Node 0 sets up its pgdat at the first available pfn, 41 * Node 0 sets up its pgdat at the first available pfn,
@@ -45,24 +55,23 @@ void __init setup_memory(void)
45 55
46void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) 56void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
47{ 57{
48 unsigned long bootmap_pages, bootmap_start, bootmap_size; 58 unsigned long bootmap_pages;
49 unsigned long start_pfn, free_pfn, end_pfn; 59 unsigned long start_pfn, end_pfn;
60 unsigned long bootmem_paddr;
50 61
51 /* Don't allow bogus node assignment */ 62 /* Don't allow bogus node assignment */
52 BUG_ON(nid > MAX_NUMNODES || nid == 0); 63 BUG_ON(nid > MAX_NUMNODES || nid == 0);
53 64
54 /* 65 start_pfn = start >> PAGE_SHIFT;
55 * The free pfn starts at the beginning of the range, and is
56 * advanced as necessary for pgdat and node map allocations.
57 */
58 free_pfn = start_pfn = start >> PAGE_SHIFT;
59 end_pfn = end >> PAGE_SHIFT; 66 end_pfn = end >> PAGE_SHIFT;
60 67
68 lmb_add(start, end - start);
69
61 __add_active_range(nid, start_pfn, end_pfn); 70 __add_active_range(nid, start_pfn, end_pfn);
62 71
63 /* Node-local pgdat */ 72 /* Node-local pgdat */
64 NODE_DATA(nid) = pfn_to_kaddr(free_pfn); 73 NODE_DATA(nid) = __va(lmb_alloc_base(sizeof(struct pglist_data),
65 free_pfn += PFN_UP(sizeof(struct pglist_data)); 74 SMP_CACHE_BYTES, end_pfn));
66 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data)); 75 memset(NODE_DATA(nid), 0, sizeof(struct pglist_data));
67 76
68 NODE_DATA(nid)->bdata = &bootmem_node_data[nid]; 77 NODE_DATA(nid)->bdata = &bootmem_node_data[nid];
@@ -71,16 +80,17 @@ void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end)
71 80
72 /* Node-local bootmap */ 81 /* Node-local bootmap */
73 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 82 bootmap_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
74 bootmap_start = (unsigned long)pfn_to_kaddr(free_pfn); 83 bootmem_paddr = lmb_alloc_base(bootmap_pages << PAGE_SHIFT,
75 bootmap_size = init_bootmem_node(NODE_DATA(nid), free_pfn, start_pfn, 84 PAGE_SIZE, end_pfn);
76 end_pfn); 85 init_bootmem_node(NODE_DATA(nid), bootmem_paddr >> PAGE_SHIFT,
86 start_pfn, end_pfn);
77 87
78 free_bootmem_with_active_regions(nid, end_pfn); 88 free_bootmem_with_active_regions(nid, end_pfn);
79 89
80 /* Reserve the pgdat and bootmap space with the bootmem allocator */ 90 /* Reserve the pgdat and bootmap space with the bootmem allocator */
81 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT, 91 reserve_bootmem_node(NODE_DATA(nid), start_pfn << PAGE_SHIFT,
82 sizeof(struct pglist_data), BOOTMEM_DEFAULT); 92 sizeof(struct pglist_data), BOOTMEM_DEFAULT);
83 reserve_bootmem_node(NODE_DATA(nid), free_pfn << PAGE_SHIFT, 93 reserve_bootmem_node(NODE_DATA(nid), bootmem_paddr,
84 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 94 bootmap_pages << PAGE_SHIFT, BOOTMEM_DEFAULT);
85 95
86 /* It's up */ 96 /* It's up */
diff --git a/arch/sh/mm/pg-nommu.c b/arch/sh/mm/pg-nommu.c
deleted file mode 100644
index 91ed4e695ff..00000000000
--- a/arch/sh/mm/pg-nommu.c
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 * arch/sh/mm/pg-nommu.c
3 *
4 * clear_page()/copy_page() implementation for MMUless SH.
5 *
6 * Copyright (C) 2003 Paul Mundt
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12#include <linux/init.h>
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <asm/page.h>
16#include <asm/uaccess.h>
17
18void copy_page(void *to, void *from)
19{
20 memcpy(to, from, PAGE_SIZE);
21}
22
23void clear_page(void *to)
24{
25 memset(to, 0, PAGE_SIZE);
26}
27
28__kernel_size_t __copy_user(void *to, const void *from, __kernel_size_t n)
29{
30 memcpy(to, from, n);
31 return 0;
32}
33
34__kernel_size_t __clear_user(void *to, __kernel_size_t n)
35{
36 memset(to, 0, n);
37 return 0;
38}
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
deleted file mode 100644
index 2fe14da1f83..00000000000
--- a/arch/sh/mm/pg-sh4.c
+++ /dev/null
@@ -1,146 +0,0 @@
1/*
2 * arch/sh/mm/pg-sh4.c
3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2002 - 2007 Paul Mundt
6 *
7 * Released under the terms of the GNU GPL v2.0.
8 */
9#include <linux/mm.h>
10#include <linux/init.h>
11#include <linux/mutex.h>
12#include <linux/fs.h>
13#include <linux/highmem.h>
14#include <linux/module.h>
15#include <asm/mmu_context.h>
16#include <asm/cacheflush.h>
17
18#define CACHE_ALIAS (current_cpu_data.dcache.alias_mask)
19
20#define kmap_get_fixmap_pte(vaddr) \
21 pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), (vaddr)), (vaddr)), (vaddr))
22
23static pte_t *kmap_coherent_pte;
24
25void __init kmap_coherent_init(void)
26{
27 unsigned long vaddr;
28
29 /* cache the first coherent kmap pte */
30 vaddr = __fix_to_virt(FIX_CMAP_BEGIN);
31 kmap_coherent_pte = kmap_get_fixmap_pte(vaddr);
32}
33
34static inline void *kmap_coherent(struct page *page, unsigned long addr)
35{
36 enum fixed_addresses idx;
37 unsigned long vaddr, flags;
38 pte_t pte;
39
40 inc_preempt_count();
41
42 idx = (addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT;
43 vaddr = __fix_to_virt(FIX_CMAP_END - idx);
44 pte = mk_pte(page, PAGE_KERNEL);
45
46 local_irq_save(flags);
47 flush_tlb_one(get_asid(), vaddr);
48 local_irq_restore(flags);
49
50 update_mmu_cache(NULL, vaddr, pte);
51
52 set_pte(kmap_coherent_pte - (FIX_CMAP_END - idx), pte);
53
54 return (void *)vaddr;
55}
56
57static inline void kunmap_coherent(struct page *page)
58{
59 dec_preempt_count();
60 preempt_check_resched();
61}
62
63/*
64 * clear_user_page
65 * @to: P1 address
66 * @address: U0 address to be mapped
67 * @page: page (virt_to_page(to))
68 */
69void clear_user_page(void *to, unsigned long address, struct page *page)
70{
71 __set_bit(PG_mapped, &page->flags);
72
73 clear_page(to);
74 if ((((address & PAGE_MASK) ^ (unsigned long)to) & CACHE_ALIAS))
75 __flush_wback_region(to, PAGE_SIZE);
76}
77
78void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
79 unsigned long vaddr, void *dst, const void *src,
80 unsigned long len)
81{
82 void *vto;
83
84 __set_bit(PG_mapped, &page->flags);
85
86 vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
87 memcpy(vto, src, len);
88 kunmap_coherent(vto);
89
90 if (vma->vm_flags & VM_EXEC)
91 flush_cache_page(vma, vaddr, page_to_pfn(page));
92}
93
94void copy_from_user_page(struct vm_area_struct *vma, struct page *page,
95 unsigned long vaddr, void *dst, const void *src,
96 unsigned long len)
97{
98 void *vfrom;
99
100 __set_bit(PG_mapped, &page->flags);
101
102 vfrom = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
103 memcpy(dst, vfrom, len);
104 kunmap_coherent(vfrom);
105}
106
107void copy_user_highpage(struct page *to, struct page *from,
108 unsigned long vaddr, struct vm_area_struct *vma)
109{
110 void *vfrom, *vto;
111
112 __set_bit(PG_mapped, &to->flags);
113
114 vto = kmap_atomic(to, KM_USER1);
115 vfrom = kmap_coherent(from, vaddr);
116 copy_page(vto, vfrom);
117 kunmap_coherent(vfrom);
118
119 if (((vaddr ^ (unsigned long)vto) & CACHE_ALIAS))
120 __flush_wback_region(vto, PAGE_SIZE);
121
122 kunmap_atomic(vto, KM_USER1);
123 /* Make sure this page is cleared on other CPU's too before using it */
124 smp_wmb();
125}
126EXPORT_SYMBOL(copy_user_highpage);
127
128/*
129 * For SH-4, we have our own implementation for ptep_get_and_clear
130 */
131pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
132{
133 pte_t pte = *ptep;
134
135 pte_clear(mm, addr, ptep);
136 if (!pte_not_present(pte)) {
137 unsigned long pfn = pte_pfn(pte);
138 if (pfn_valid(pfn)) {
139 struct page *page = pfn_to_page(pfn);
140 struct address_space *mapping = page_mapping(page);
141 if (!mapping || !mapping_writably_mapped(mapping))
142 __clear_bit(PG_mapped, &page->flags);
143 }
144 }
145 return pte;
146}
diff --git a/arch/sh/mm/pg-sh7705.c b/arch/sh/mm/pg-sh7705.c
deleted file mode 100644
index eaf25147194..00000000000
--- a/arch/sh/mm/pg-sh7705.c
+++ /dev/null
@@ -1,138 +0,0 @@
1/*
2 * arch/sh/mm/pg-sh7705.c
3 *
4 * Copyright (C) 1999, 2000 Niibe Yutaka
5 * Copyright (C) 2004 Alex Song
6 *
7 * This file is subject to the terms and conditions of the GNU General Public
8 * License. See the file "COPYING" in the main directory of this archive
9 * for more details.
10 *
11 */
12
13#include <linux/init.h>
14#include <linux/mman.h>
15#include <linux/mm.h>
16#include <linux/threads.h>
17#include <linux/fs.h>
18#include <asm/addrspace.h>
19#include <asm/page.h>
20#include <asm/pgtable.h>
21#include <asm/processor.h>
22#include <asm/cache.h>
23#include <asm/io.h>
24#include <asm/uaccess.h>
25#include <asm/pgalloc.h>
26#include <asm/mmu_context.h>
27#include <asm/cacheflush.h>
28
29static inline void __flush_purge_virtual_region(void *p1, void *virt, int size)
30{
31 unsigned long v;
32 unsigned long begin, end;
33 unsigned long p1_begin;
34
35
36 begin = L1_CACHE_ALIGN((unsigned long)virt);
37 end = L1_CACHE_ALIGN((unsigned long)virt + size);
38
39 p1_begin = (unsigned long)p1 & ~(L1_CACHE_BYTES - 1);
40
41 /* do this the slow way as we may not have TLB entries
42 * for virt yet. */
43 for (v = begin; v < end; v += L1_CACHE_BYTES) {
44 unsigned long p;
45 unsigned long ways, addr;
46
47 p = __pa(p1_begin);
48
49 ways = current_cpu_data.dcache.ways;
50 addr = CACHE_OC_ADDRESS_ARRAY;
51
52 do {
53 unsigned long data;
54
55 addr |= (v & current_cpu_data.dcache.entry_mask);
56
57 data = ctrl_inl(addr);
58 if ((data & CACHE_PHYSADDR_MASK) ==
59 (p & CACHE_PHYSADDR_MASK)) {
60 data &= ~(SH_CACHE_UPDATED|SH_CACHE_VALID);
61 ctrl_outl(data, addr);
62 }
63
64 addr += current_cpu_data.dcache.way_incr;
65 } while (--ways);
66
67 p1_begin += L1_CACHE_BYTES;
68 }
69}
70
71/*
72 * clear_user_page
73 * @to: P1 address
74 * @address: U0 address to be mapped
75 */
76void clear_user_page(void *to, unsigned long address, struct page *pg)
77{
78 struct page *page = virt_to_page(to);
79
80 __set_bit(PG_mapped, &page->flags);
81 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
82 clear_page(to);
83 __flush_wback_region(to, PAGE_SIZE);
84 } else {
85 __flush_purge_virtual_region(to,
86 (void *)(address & 0xfffff000),
87 PAGE_SIZE);
88 clear_page(to);
89 __flush_wback_region(to, PAGE_SIZE);
90 }
91}
92
93/*
94 * copy_user_page
95 * @to: P1 address
96 * @from: P1 address
97 * @address: U0 address to be mapped
98 */
99void copy_user_page(void *to, void *from, unsigned long address, struct page *pg)
100{
101 struct page *page = virt_to_page(to);
102
103
104 __set_bit(PG_mapped, &page->flags);
105 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) {
106 copy_page(to, from);
107 __flush_wback_region(to, PAGE_SIZE);
108 } else {
109 __flush_purge_virtual_region(to,
110 (void *)(address & 0xfffff000),
111 PAGE_SIZE);
112 copy_page(to, from);
113 __flush_wback_region(to, PAGE_SIZE);
114 }
115}
116
117/*
118 * For SH7705, we have our own implementation for ptep_get_and_clear
119 * Copied from pg-sh4.c
120 */
121pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
122{
123 pte_t pte = *ptep;
124
125 pte_clear(mm, addr, ptep);
126 if (!pte_not_present(pte)) {
127 unsigned long pfn = pte_pfn(pte);
128 if (pfn_valid(pfn)) {
129 struct page *page = pfn_to_page(pfn);
130 struct address_space *mapping = page_mapping(page);
131 if (!mapping || !mapping_writably_mapped(mapping))
132 __clear_bit(PG_mapped, &page->flags);
133 }
134 }
135
136 return pte;
137}
138
diff --git a/arch/sh/mm/tlb-pteaex.c b/arch/sh/mm/tlb-pteaex.c
index 2aab3ea934d..409b7c2b4b9 100644
--- a/arch/sh/mm/tlb-pteaex.c
+++ b/arch/sh/mm/tlb-pteaex.c
@@ -16,34 +16,16 @@
16#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
17#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
18 18
19void update_mmu_cache(struct vm_area_struct * vma, 19void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
20 unsigned long address, pte_t pte)
21{ 20{
22 unsigned long flags; 21 unsigned long flags, pteval, vpn;
23 unsigned long pteval;
24 unsigned long vpn;
25 22
26 /* Ptrace may call this routine. */ 23 /*
24 * Handle debugger faulting in for debugee.
25 */
27 if (vma && current->active_mm != vma->vm_mm) 26 if (vma && current->active_mm != vma->vm_mm)
28 return; 27 return;
29 28
30#ifndef CONFIG_CACHE_OFF
31 {
32 unsigned long pfn = pte_pfn(pte);
33
34 if (pfn_valid(pfn)) {
35 struct page *page = pfn_to_page(pfn);
36
37 if (!test_bit(PG_mapped, &page->flags)) {
38 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
39 __flush_wback_region((void *)P1SEGADDR(phys),
40 PAGE_SIZE);
41 __set_bit(PG_mapped, &page->flags);
42 }
43 }
44 }
45#endif
46
47 local_irq_save(flags); 29 local_irq_save(flags);
48 30
49 /* Set PTEH register */ 31 /* Set PTEH register */
diff --git a/arch/sh/mm/tlb-sh3.c b/arch/sh/mm/tlb-sh3.c
index 17cb7c3adf2..ace8e6d2f59 100644
--- a/arch/sh/mm/tlb-sh3.c
+++ b/arch/sh/mm/tlb-sh3.c
@@ -27,32 +27,16 @@
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
28#include <asm/cacheflush.h> 28#include <asm/cacheflush.h>
29 29
30void update_mmu_cache(struct vm_area_struct * vma, 30void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
31 unsigned long address, pte_t pte)
32{ 31{
33 unsigned long flags; 32 unsigned long flags, pteval, vpn;
34 unsigned long pteval;
35 unsigned long vpn;
36 33
37 /* Ptrace may call this routine. */ 34 /*
35 * Handle debugger faulting in for debugee.
36 */
38 if (vma && current->active_mm != vma->vm_mm) 37 if (vma && current->active_mm != vma->vm_mm)
39 return; 38 return;
40 39
41#if defined(CONFIG_SH7705_CACHE_32KB)
42 {
43 struct page *page = pte_page(pte);
44 unsigned long pfn = pte_pfn(pte);
45
46 if (pfn_valid(pfn) && !test_bit(PG_mapped, &page->flags)) {
47 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
48
49 __flush_wback_region((void *)P1SEGADDR(phys),
50 PAGE_SIZE);
51 __set_bit(PG_mapped, &page->flags);
52 }
53 }
54#endif
55
56 local_irq_save(flags); 40 local_irq_save(flags);
57 41
58 /* Set PTEH register */ 42 /* Set PTEH register */
@@ -93,4 +77,3 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
93 for (i = 0; i < ways; i++) 77 for (i = 0; i < ways; i++)
94 ctrl_outl(data, addr + (i << 8)); 78 ctrl_outl(data, addr + (i << 8));
95} 79}
96
diff --git a/arch/sh/mm/tlb-sh4.c b/arch/sh/mm/tlb-sh4.c
index f0c7b7397fa..8cf550e2570 100644
--- a/arch/sh/mm/tlb-sh4.c
+++ b/arch/sh/mm/tlb-sh4.c
@@ -15,34 +15,16 @@
15#include <asm/mmu_context.h> 15#include <asm/mmu_context.h>
16#include <asm/cacheflush.h> 16#include <asm/cacheflush.h>
17 17
18void update_mmu_cache(struct vm_area_struct * vma, 18void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
19 unsigned long address, pte_t pte)
20{ 19{
21 unsigned long flags; 20 unsigned long flags, pteval, vpn;
22 unsigned long pteval;
23 unsigned long vpn;
24 21
25 /* Ptrace may call this routine. */ 22 /*
23 * Handle debugger faulting in for debugee.
24 */
26 if (vma && current->active_mm != vma->vm_mm) 25 if (vma && current->active_mm != vma->vm_mm)
27 return; 26 return;
28 27
29#ifndef CONFIG_CACHE_OFF
30 {
31 unsigned long pfn = pte_pfn(pte);
32
33 if (pfn_valid(pfn)) {
34 struct page *page = pfn_to_page(pfn);
35
36 if (!test_bit(PG_mapped, &page->flags)) {
37 unsigned long phys = pte_val(pte) & PTE_PHYS_MASK;
38 __flush_wback_region((void *)P1SEGADDR(phys),
39 PAGE_SIZE);
40 __set_bit(PG_mapped, &page->flags);
41 }
42 }
43 }
44#endif
45
46 local_irq_save(flags); 28 local_irq_save(flags);
47 29
48 /* Set PTEH register */ 30 /* Set PTEH register */
@@ -61,9 +43,12 @@ void update_mmu_cache(struct vm_area_struct * vma,
61 */ 43 */
62 ctrl_outl(pte.pte_high, MMU_PTEA); 44 ctrl_outl(pte.pte_high, MMU_PTEA);
63#else 45#else
64 if (cpu_data->flags & CPU_HAS_PTEA) 46 if (cpu_data->flags & CPU_HAS_PTEA) {
65 /* TODO: make this look less hacky */ 47 /* The last 3 bits and the first one of pteval contains
66 ctrl_outl(((pteval >> 28) & 0xe) | (pteval & 0x1), MMU_PTEA); 48 * the PTEA timing control and space attribute bits
49 */
50 ctrl_outl(copy_ptea_attributes(pteval), MMU_PTEA);
51 }
67#endif 52#endif
68 53
69 /* Set PTEL register */ 54 /* Set PTEL register */
diff --git a/arch/sh/mm/tlb-sh5.c b/arch/sh/mm/tlb-sh5.c
index dae131243bc..fdb64e41ec5 100644
--- a/arch/sh/mm/tlb-sh5.c
+++ b/arch/sh/mm/tlb-sh5.c
@@ -117,26 +117,15 @@ int sh64_put_wired_dtlb_entry(unsigned long long entry)
117 * Load up a virtual<->physical translation for @eaddr<->@paddr in the 117 * Load up a virtual<->physical translation for @eaddr<->@paddr in the
118 * pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry). 118 * pre-allocated TLB slot @config_addr (see sh64_get_wired_dtlb_entry).
119 */ 119 */
120inline void sh64_setup_tlb_slot(unsigned long long config_addr, 120void sh64_setup_tlb_slot(unsigned long long config_addr, unsigned long eaddr,
121 unsigned long eaddr, 121 unsigned long asid, unsigned long paddr)
122 unsigned long asid,
123 unsigned long paddr)
124{ 122{
125 unsigned long long pteh, ptel; 123 unsigned long long pteh, ptel;
126 124
127 /* Sign extension */ 125 pteh = neff_sign_extend(eaddr);
128#if (NEFF == 32)
129 pteh = (unsigned long long)(signed long long)(signed long) eaddr;
130#else
131#error "Can't sign extend more than 32 bits yet"
132#endif
133 pteh &= PAGE_MASK; 126 pteh &= PAGE_MASK;
134 pteh |= (asid << PTEH_ASID_SHIFT) | PTEH_VALID; 127 pteh |= (asid << PTEH_ASID_SHIFT) | PTEH_VALID;
135#if (NEFF == 32) 128 ptel = neff_sign_extend(paddr);
136 ptel = (unsigned long long)(signed long long)(signed long) paddr;
137#else
138#error "Can't sign extend more than 32 bits yet"
139#endif
140 ptel &= PAGE_MASK; 129 ptel &= PAGE_MASK;
141 ptel |= (_PAGE_CACHABLE | _PAGE_READ | _PAGE_WRITE); 130 ptel |= (_PAGE_CACHABLE | _PAGE_READ | _PAGE_WRITE);
142 131
@@ -152,5 +141,5 @@ inline void sh64_setup_tlb_slot(unsigned long long config_addr,
152 * 141 *
153 * Teardown any existing mapping in the TLB slot @config_addr. 142 * Teardown any existing mapping in the TLB slot @config_addr.
154 */ 143 */
155inline void sh64_teardown_tlb_slot(unsigned long long config_addr) 144void sh64_teardown_tlb_slot(unsigned long long config_addr)
156 __attribute__ ((alias("__flush_tlb_slot"))); 145 __attribute__ ((alias("__flush_tlb_slot")));
diff --git a/arch/sh/mm/tlbflush_64.c b/arch/sh/mm/tlbflush_64.c
index 3ce40ea3482..2dcc48528f7 100644
--- a/arch/sh/mm/tlbflush_64.c
+++ b/arch/sh/mm/tlbflush_64.c
@@ -329,22 +329,6 @@ do_sigbus:
329 goto no_context; 329 goto no_context;
330} 330}
331 331
332void update_mmu_cache(struct vm_area_struct * vma,
333 unsigned long address, pte_t pte)
334{
335 /*
336 * This appears to get called once for every pte entry that gets
337 * established => I don't think it's efficient to try refilling the
338 * TLBs with the pages - some may not get accessed even. Also, for
339 * executable pages, it is impossible to determine reliably here which
340 * TLB they should be mapped into (or both even).
341 *
342 * So, just do nothing here and handle faults on demand. In the
343 * TLBMISS handling case, the refill is now done anyway after the pte
344 * has been fixed up, so that deals with most useful cases.
345 */
346}
347
348void local_flush_tlb_one(unsigned long asid, unsigned long page) 332void local_flush_tlb_one(unsigned long asid, unsigned long page)
349{ 333{
350 unsigned long long match, pteh=0, lpage; 334 unsigned long long match, pteh=0, lpage;
@@ -353,7 +337,7 @@ void local_flush_tlb_one(unsigned long asid, unsigned long page)
353 /* 337 /*
354 * Sign-extend based on neff. 338 * Sign-extend based on neff.
355 */ 339 */
356 lpage = (page & NEFF_SIGN) ? (page | NEFF_MASK) : page; 340 lpage = neff_sign_extend(page);
357 match = (asid << PTEH_ASID_SHIFT) | PTEH_VALID; 341 match = (asid << PTEH_ASID_SHIFT) | PTEH_VALID;
358 match |= lpage; 342 match |= lpage;
359 343
@@ -482,3 +466,7 @@ void local_flush_tlb_kernel_range(unsigned long start, unsigned long end)
482 /* FIXME: Optimize this later.. */ 466 /* FIXME: Optimize this later.. */
483 flush_tlb_all(); 467 flush_tlb_all();
484} 468}
469
470void __update_tlb(struct vm_area_struct *vma, unsigned long address, pte_t pte)
471{
472}
diff --git a/arch/sh/oprofile/backtrace.c b/arch/sh/oprofile/backtrace.c
index 9499a2914f8..2bc74de23f0 100644
--- a/arch/sh/oprofile/backtrace.c
+++ b/arch/sh/oprofile/backtrace.c
@@ -17,9 +17,43 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/kallsyms.h> 18#include <linux/kallsyms.h>
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <asm/unwinder.h>
20#include <asm/ptrace.h> 21#include <asm/ptrace.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22#include <asm/sections.h> 23#include <asm/sections.h>
24#include <asm/stacktrace.h>
25
26static void backtrace_warning_symbol(void *data, char *msg,
27 unsigned long symbol)
28{
29 /* Ignore warnings */
30}
31
32static void backtrace_warning(void *data, char *msg)
33{
34 /* Ignore warnings */
35}
36
37static int backtrace_stack(void *data, char *name)
38{
39 /* Yes, we want all stacks */
40 return 0;
41}
42
43static void backtrace_address(void *data, unsigned long addr, int reliable)
44{
45 unsigned int *depth = data;
46
47 if ((*depth)--)
48 oprofile_add_trace(addr);
49}
50
51static struct stacktrace_ops backtrace_ops = {
52 .warning = backtrace_warning,
53 .warning_symbol = backtrace_warning_symbol,
54 .stack = backtrace_stack,
55 .address = backtrace_address,
56};
23 57
24/* Limit to stop backtracing too far. */ 58/* Limit to stop backtracing too far. */
25static int backtrace_limit = 20; 59static int backtrace_limit = 20;
@@ -47,50 +81,6 @@ user_backtrace(unsigned long *stackaddr, struct pt_regs *regs)
47 return stackaddr; 81 return stackaddr;
48} 82}
49 83
50/*
51 * | | /\ Higher addresses
52 * | |
53 * --------------- stack base (address of current_thread_info)
54 * | thread info |
55 * . .
56 * | stack |
57 * --------------- saved regs->regs[15] value if valid
58 * . .
59 * --------------- struct pt_regs stored on stack (struct pt_regs *)
60 * | |
61 * . .
62 * | |
63 * --------------- ???
64 * | |
65 * | | \/ Lower addresses
66 *
67 * Thus, &pt_regs <-> stack base restricts the valid(ish) fp values
68 */
69static int valid_kernel_stack(unsigned long *stackaddr, struct pt_regs *regs)
70{
71 unsigned long stack = (unsigned long)regs;
72 unsigned long stack_base = (stack & ~(THREAD_SIZE - 1)) + THREAD_SIZE;
73
74 return ((unsigned long)stackaddr > stack) && ((unsigned long)stackaddr < stack_base);
75}
76
77static unsigned long *
78kernel_backtrace(unsigned long *stackaddr, struct pt_regs *regs)
79{
80 unsigned long addr;
81
82 /*
83 * If not a valid kernel address, keep going till we find one
84 * or the SP stops being a valid address.
85 */
86 do {
87 addr = *stackaddr++;
88 oprofile_add_trace(addr);
89 } while (valid_kernel_stack(stackaddr, regs));
90
91 return stackaddr;
92}
93
94void sh_backtrace(struct pt_regs * const regs, unsigned int depth) 84void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
95{ 85{
96 unsigned long *stackaddr; 86 unsigned long *stackaddr;
@@ -103,9 +93,9 @@ void sh_backtrace(struct pt_regs * const regs, unsigned int depth)
103 93
104 stackaddr = (unsigned long *)regs->regs[15]; 94 stackaddr = (unsigned long *)regs->regs[15];
105 if (!user_mode(regs)) { 95 if (!user_mode(regs)) {
106 while (depth-- && valid_kernel_stack(stackaddr, regs)) 96 if (depth)
107 stackaddr = kernel_backtrace(stackaddr, regs); 97 unwind_stack(NULL, regs, stackaddr,
108 98 &backtrace_ops, &depth);
109 return; 99 return;
110 } 100 }
111 101
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index fec3a53b865..6639b25d8d5 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -53,6 +53,9 @@ RSK7203 SH_RSK7203
53AP325RXA SH_AP325RXA 53AP325RXA SH_AP325RXA
54SH7763RDP SH_SH7763RDP 54SH7763RDP SH_SH7763RDP
55SH7785LCR SH_SH7785LCR 55SH7785LCR SH_SH7785LCR
56SH7785LCR_PT SH_SH7785LCR_PT
56URQUELL SH_URQUELL 57URQUELL SH_URQUELL
57ESPT SH_ESPT 58ESPT SH_ESPT
58POLARIS SH_POLARIS 59POLARIS SH_POLARIS
60KFR2R09 SH_KFR2R09
61ECOVEC SH_ECOVEC