diff options
79 files changed, 1828 insertions, 952 deletions
diff --git a/arch/ia64/include/asm/fpu.h b/arch/ia64/include/asm/fpu.h index 0c26157cffa5..b6395ad1500a 100644 --- a/arch/ia64/include/asm/fpu.h +++ b/arch/ia64/include/asm/fpu.h | |||
| @@ -6,6 +6,8 @@ | |||
| 6 | * David Mosberger-Tang <davidm@hpl.hp.com> | 6 | * David Mosberger-Tang <davidm@hpl.hp.com> |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include <linux/types.h> | ||
| 10 | |||
| 9 | /* floating point status register: */ | 11 | /* floating point status register: */ |
| 10 | #define FPSR_TRAP_VD (1 << 0) /* invalid op trap disabled */ | 12 | #define FPSR_TRAP_VD (1 << 0) /* invalid op trap disabled */ |
| 11 | #define FPSR_TRAP_DD (1 << 1) /* denormal trap disabled */ | 13 | #define FPSR_TRAP_DD (1 << 1) /* denormal trap disabled */ |
diff --git a/arch/ia64/include/asm/xen/hypervisor.h b/arch/ia64/include/asm/xen/hypervisor.h index e425227a418e..88afb54501e4 100644 --- a/arch/ia64/include/asm/xen/hypervisor.h +++ b/arch/ia64/include/asm/xen/hypervisor.h | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | #ifndef _ASM_IA64_XEN_HYPERVISOR_H | 33 | #ifndef _ASM_IA64_XEN_HYPERVISOR_H |
| 34 | #define _ASM_IA64_XEN_HYPERVISOR_H | 34 | #define _ASM_IA64_XEN_HYPERVISOR_H |
| 35 | 35 | ||
| 36 | #include <linux/err.h> | ||
| 36 | #include <xen/interface/xen.h> | 37 | #include <xen/interface/xen.h> |
| 37 | #include <xen/interface/version.h> /* to compile feature.c */ | 38 | #include <xen/interface/version.h> /* to compile feature.c */ |
| 38 | #include <xen/features.h> /* to comiple xen-netfront.c */ | 39 | #include <xen/features.h> /* to comiple xen-netfront.c */ |
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c index 086a2aeb0404..39a3cd0a4173 100644 --- a/arch/ia64/kernel/dma-mapping.c +++ b/arch/ia64/kernel/dma-mapping.c | |||
| @@ -6,6 +6,14 @@ int iommu_detected __read_mostly; | |||
| 6 | struct dma_map_ops *dma_ops; | 6 | struct dma_map_ops *dma_ops; |
| 7 | EXPORT_SYMBOL(dma_ops); | 7 | EXPORT_SYMBOL(dma_ops); |
| 8 | 8 | ||
| 9 | #define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16) | ||
| 10 | |||
| 11 | static int __init dma_init(void) | ||
| 12 | { | ||
| 13 | dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES); | ||
| 14 | } | ||
| 15 | fs_initcall(dma_init); | ||
| 16 | |||
| 9 | struct dma_map_ops *dma_get_ops(struct device *dev) | 17 | struct dma_map_ops *dma_get_ops(struct device *dev) |
| 10 | { | 18 | { |
| 11 | return dma_ops; | 19 | return dma_ops; |
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index e2bdd7b94fd9..c4a955d25451 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
| @@ -10,12 +10,16 @@ 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 | ||
| 19 | select RTC_LIB | 23 | select RTC_LIB |
| 20 | select GENERIC_ATOMIC64 | 24 | select GENERIC_ATOMIC64 |
| 21 | help | 25 | help |
| @@ -31,6 +35,9 @@ config SUPERH32 | |||
| 31 | select HAVE_FUNCTION_TRACER | 35 | select HAVE_FUNCTION_TRACER |
| 32 | select HAVE_FTRACE_MCOUNT_RECORD | 36 | select HAVE_FTRACE_MCOUNT_RECORD |
| 33 | select HAVE_DYNAMIC_FTRACE | 37 | select HAVE_DYNAMIC_FTRACE |
| 38 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | ||
| 39 | select HAVE_FTRACE_SYSCALLS | ||
| 40 | select HAVE_FUNCTION_GRAPH_TRACER | ||
| 34 | select HAVE_ARCH_KGDB | 41 | select HAVE_ARCH_KGDB |
| 35 | select ARCH_HIBERNATION_POSSIBLE if MMU | 42 | select ARCH_HIBERNATION_POSSIBLE if MMU |
| 36 | 43 | ||
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug index 39224b57c6ef..b440fd936714 100644 --- a/arch/sh/Kconfig.debug +++ b/arch/sh/Kconfig.debug | |||
| @@ -61,12 +61,14 @@ config EARLY_PRINTK | |||
| 61 | select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using | 61 | select both the EARLY_SCIF_CONSOLE and SH_STANDARD_BIOS, using |
| 62 | the kernel command line option to toggle back and forth. | 62 | the kernel command line option to toggle back and forth. |
| 63 | 63 | ||
| 64 | config DEBUG_STACKOVERFLOW | 64 | config STACK_DEBUG |
| 65 | bool "Check for stack overflows" | 65 | bool "Check for stack overflows" |
| 66 | depends on DEBUG_KERNEL && SUPERH32 | 66 | depends on DEBUG_KERNEL && SUPERH32 |
| 67 | help | 67 | help |
| 68 | This option will cause messages to be printed if free stack space | 68 | This option will cause messages to be printed if free stack space |
| 69 | drops below a certain limit. | 69 | drops below a certain limit. Saying Y here will add overhead to |
| 70 | every function call and will therefore incur a major | ||
| 71 | performance hit. Most users should say N. | ||
| 70 | 72 | ||
| 71 | config DEBUG_STACK_USAGE | 73 | config DEBUG_STACK_USAGE |
| 72 | bool "Stack utilization instrumentation" | 74 | bool "Stack utilization instrumentation" |
| @@ -123,4 +125,9 @@ config SH64_SR_WATCH | |||
| 123 | bool "Debug: set SR.WATCH to enable hardware watchpoints and trace" | 125 | bool "Debug: set SR.WATCH to enable hardware watchpoints and trace" |
| 124 | depends on SUPERH64 | 126 | depends on SUPERH64 |
| 125 | 127 | ||
| 128 | config MCOUNT | ||
| 129 | def_bool y | ||
| 130 | depends on SUPERH32 | ||
| 131 | depends on STACK_DEBUG || FUNCTION_TRACER | ||
| 132 | |||
| 126 | endmenu | 133 | endmenu |
diff --git a/arch/sh/Makefile b/arch/sh/Makefile index 75d049b03f7e..52c34bf56962 100644 --- a/arch/sh/Makefile +++ b/arch/sh/Makefile | |||
| @@ -186,6 +186,10 @@ KBUILD_CFLAGS += -pipe $(cflags-y) | |||
| 186 | KBUILD_CPPFLAGS += $(cflags-y) | 186 | KBUILD_CPPFLAGS += $(cflags-y) |
| 187 | KBUILD_AFLAGS += $(cflags-y) | 187 | KBUILD_AFLAGS += $(cflags-y) |
| 188 | 188 | ||
| 189 | ifeq ($(CONFIG_MCOUNT),y) | ||
| 190 | KBUILD_CFLAGS += -pg | ||
| 191 | endif | ||
| 192 | |||
| 189 | libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) | 193 | libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) |
| 190 | libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) | 194 | libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) |
| 191 | 195 | ||
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index 8fed45a2fb85..4fb7e48e2843 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
| @@ -304,6 +304,7 @@ static struct platform_device sh_eth_device = { | |||
| 304 | }; | 304 | }; |
| 305 | 305 | ||
| 306 | static struct r8a66597_platdata sh7724_usb0_host_data = { | 306 | static struct r8a66597_platdata sh7724_usb0_host_data = { |
| 307 | .on_chip = 1, | ||
| 307 | }; | 308 | }; |
| 308 | 309 | ||
| 309 | static struct resource sh7724_usb0_host_resources[] = { | 310 | static struct resource sh7724_usb0_host_resources[] = { |
diff --git a/arch/sh/boot/compressed/.gitignore b/arch/sh/boot/compressed/.gitignore new file mode 100644 index 000000000000..2374a83d87b2 --- /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 9531bf1b7c2f..59e2937caa2f 100644 --- a/arch/sh/boot/compressed/Makefile +++ b/arch/sh/boot/compressed/Makefile | |||
| @@ -5,9 +5,10 @@ | |||
| 5 | # | 5 | # |
| 6 | 6 | ||
| 7 | targets := vmlinux vmlinux.bin vmlinux.bin.gz \ | 7 | targets := 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 | ||
| 10 | OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc_$(BITS).o $(obj)/cache.o | 11 | OBJECTS = $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/cache.o |
| 11 | 12 | ||
| 12 | ifdef CONFIG_SH_STANDARD_BIOS | 13 | ifdef CONFIG_SH_STANDARD_BIOS |
| 13 | OBJECTS += $(obj)/../../kernel/sh_bios.o | 14 | OBJECTS += $(obj)/../../kernel/sh_bios.o |
| @@ -23,7 +24,7 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \ | |||
| 23 | 24 | ||
| 24 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) | 25 | LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) |
| 25 | 26 | ||
| 26 | ifeq ($(CONFIG_FUNCTION_TRACER),y) | 27 | ifeq ($(CONFIG_MCOUNT),y) |
| 27 | ORIG_CFLAGS := $(KBUILD_CFLAGS) | 28 | ORIG_CFLAGS := $(KBUILD_CFLAGS) |
| 28 | KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) | 29 | KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) |
| 29 | endif | 30 | endif |
| @@ -38,10 +39,22 @@ $(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 | 42 | vmlinux.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) | ||
| 50 | |||
| 51 | suffix-$(CONFIG_KERNEL_GZIP) := gz | ||
| 52 | suffix-$(CONFIG_KERNEL_BZIP2) := bz2 | ||
| 53 | suffix-$(CONFIG_KERNEL_LZMA) := lzma | ||
| 43 | 54 | ||
| 44 | OBJCOPYFLAGS += -R .empty_zero_page | 55 | OBJCOPYFLAGS += -R .empty_zero_page |
| 45 | 56 | ||
| 46 | $(obj)/piggy.o: $(obj)/piggy.S $(obj)/vmlinux.bin.gz FORCE | 57 | LDFLAGS_piggy.o := -r --format binary --oformat $(ld-bfd) -T |
| 47 | $(call if_changed,as_o_S) | 58 | |
| 59 | $(obj)/piggy.o: $(obj)/vmlinux.scr $(obj)/vmlinux.bin.$(suffix-y) FORCE | ||
| 60 | $(call if_changed,ld) | ||
diff --git a/arch/sh/boot/compressed/misc.c b/arch/sh/boot/compressed/misc.c new file mode 100644 index 000000000000..fd56a71ca9d9 --- /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 | ||
| 32 | int cache_control(unsigned int command); | ||
| 33 | |||
| 34 | extern char input_data[]; | ||
| 35 | extern int input_len; | ||
| 36 | static unsigned char *output; | ||
| 37 | |||
| 38 | static void error(char *m); | ||
| 39 | |||
| 40 | int puts(const char *); | ||
| 41 | |||
| 42 | extern int _text; /* Defined in vmlinux.lds.S */ | ||
| 43 | extern int _end; | ||
| 44 | static unsigned long free_mem_ptr; | ||
| 45 | static 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 | ||
| 66 | size_t strlen(const char *s) | ||
| 67 | { | ||
| 68 | int i = 0; | ||
| 69 | |||
| 70 | while (*s++) | ||
| 71 | i++; | ||
| 72 | return i; | ||
| 73 | } | ||
| 74 | |||
| 75 | int puts(const char *s) | ||
| 76 | { | ||
| 77 | int len = strlen(s); | ||
| 78 | sh_bios_console_write(s, len); | ||
| 79 | return len; | ||
| 80 | } | ||
| 81 | #else | ||
| 82 | int puts(const char *s) | ||
| 83 | { | ||
| 84 | /* This should be updated to use the sh-sci routines */ | ||
| 85 | return 0; | ||
| 86 | } | ||
| 87 | #endif | ||
| 88 | |||
| 89 | void* 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 | |||
| 98 | void* 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 | |||
| 108 | static 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) | ||
| 124 | long __attribute__ ((aligned(stackalign))) user_stack[STACK_SIZE]; | ||
| 125 | long *stack_start = &user_stack[STACK_SIZE]; | ||
| 126 | |||
| 127 | void 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 efdba6b29572..000000000000 --- 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 | |||
| 32 | typedef unsigned char uch; | ||
| 33 | typedef unsigned short ush; | ||
| 34 | typedef unsigned long ulg; | ||
| 35 | |||
| 36 | #define WSIZE 0x8000 /* Window size must be at least 32k, */ | ||
| 37 | /* and a power of two */ | ||
| 38 | |||
| 39 | static uch *inbuf; /* input buffer */ | ||
| 40 | static uch window[WSIZE]; /* Sliding window buffer */ | ||
| 41 | |||
| 42 | static unsigned insize = 0; /* valid bytes in inbuf */ | ||
| 43 | static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ | ||
| 44 | static 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 | |||
| 74 | static int fill_inbuf(void); | ||
| 75 | static void flush_window(void); | ||
| 76 | static void error(char *m); | ||
| 77 | |||
| 78 | extern char input_data[]; | ||
| 79 | extern int input_len; | ||
| 80 | |||
| 81 | static long bytes_out = 0; | ||
| 82 | static uch *output_data; | ||
| 83 | static unsigned long output_ptr = 0; | ||
| 84 | |||
| 85 | static void error(char *m); | ||
| 86 | |||
| 87 | int puts(const char *); | ||
| 88 | |||
| 89 | extern int _text; /* Defined in vmlinux.lds.S */ | ||
| 90 | extern int _end; | ||
| 91 | static unsigned long free_mem_ptr; | ||
| 92 | static 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 | ||
| 99 | size_t strlen(const char *s) | ||
| 100 | { | ||
| 101 | int i = 0; | ||
| 102 | |||
| 103 | while (*s++) | ||
| 104 | i++; | ||
| 105 | return i; | ||
| 106 | } | ||
| 107 | |||
| 108 | int puts(const char *s) | ||
| 109 | { | ||
| 110 | int len = strlen(s); | ||
| 111 | sh_bios_console_write(s, len); | ||
| 112 | return len; | ||
| 113 | } | ||
| 114 | #else | ||
| 115 | int puts(const char *s) | ||
| 116 | { | ||
| 117 | /* This should be updated to use the sh-sci routines */ | ||
| 118 | return 0; | ||
| 119 | } | ||
| 120 | #endif | ||
| 121 | |||
| 122 | void* 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 | |||
| 131 | void* 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 | */ | ||
| 145 | static 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 | */ | ||
| 161 | static 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 | |||
| 179 | static 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) | ||
| 189 | long user_stack [STACK_SIZE]; | ||
| 190 | long* stack_start = &user_stack[STACK_SIZE]; | ||
| 191 | |||
| 192 | void 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 2941657e18aa..000000000000 --- 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 | ||
| 17 | int 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 | |||
| 30 | typedef unsigned char uch; | ||
| 31 | typedef unsigned short ush; | ||
| 32 | typedef unsigned long ulg; | ||
| 33 | |||
| 34 | #define WSIZE 0x8000 /* Window size must be at least 32k, */ | ||
| 35 | /* and a power of two */ | ||
| 36 | |||
| 37 | static uch *inbuf; /* input buffer */ | ||
| 38 | static uch window[WSIZE]; /* Sliding window buffer */ | ||
| 39 | |||
| 40 | static unsigned insize = 0; /* valid bytes in inbuf */ | ||
| 41 | static unsigned inptr = 0; /* index of next byte to be processed in inbuf */ | ||
| 42 | static 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 | |||
| 72 | static int fill_inbuf(void); | ||
| 73 | static void flush_window(void); | ||
| 74 | static void error(char *m); | ||
| 75 | |||
| 76 | extern char input_data[]; | ||
| 77 | extern int input_len; | ||
| 78 | |||
| 79 | static long bytes_out = 0; | ||
| 80 | static uch *output_data; | ||
| 81 | static unsigned long output_ptr = 0; | ||
| 82 | |||
| 83 | static void error(char *m); | ||
| 84 | |||
| 85 | static void puts(const char *); | ||
| 86 | |||
| 87 | extern int _text; /* Defined in vmlinux.lds.S */ | ||
| 88 | extern int _end; | ||
| 89 | static unsigned long free_mem_ptr; | ||
| 90 | static unsigned long free_mem_end_ptr; | ||
| 91 | |||
| 92 | #define HEAP_SIZE 0x10000 | ||
| 93 | |||
| 94 | #include "../../../../lib/inflate.c" | ||
| 95 | |||
| 96 | void puts(const char *s) | ||
| 97 | { | ||
| 98 | } | ||
| 99 | |||
| 100 | void *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 | |||
| 110 | void *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 | */ | ||
| 124 | static 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 | */ | ||
| 140 | static 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 | |||
| 159 | static 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) | ||
| 169 | long __attribute__ ((aligned(8))) user_stack[STACK_SIZE]; | ||
| 170 | long *stack_start = &user_stack[STACK_SIZE]; | ||
| 171 | |||
| 172 | void 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 566071926b13..000000000000 --- a/arch/sh/boot/compressed/piggy.S +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | .global input_len, input_data | ||
| 2 | .data | ||
| 3 | input_len: | ||
| 4 | .long input_data_end - input_data | ||
| 5 | input_data: | ||
| 6 | .incbin "arch/sh/boot/compressed/vmlinux.bin.gz" | ||
| 7 | input_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 000000000000..f02382ae5c48 --- /dev/null +++ b/arch/sh/boot/compressed/vmlinux.scr | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | SECTIONS | ||
| 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/include/asm/ftrace.h b/arch/sh/include/asm/ftrace.h index 8fea7d8c8258..7e0bcc4d4a96 100644 --- a/arch/sh/include/asm/ftrace.h +++ b/arch/sh/include/asm/ftrace.h | |||
| @@ -11,10 +11,13 @@ extern void mcount(void); | |||
| 11 | #define MCOUNT_ADDR ((long)(mcount)) | 11 | #define MCOUNT_ADDR ((long)(mcount)) |
| 12 | 12 | ||
| 13 | #ifdef CONFIG_DYNAMIC_FTRACE | 13 | #ifdef CONFIG_DYNAMIC_FTRACE |
| 14 | #define CALLER_ADDR ((long)(ftrace_caller)) | 14 | #define CALL_ADDR ((long)(ftrace_call)) |
| 15 | #define STUB_ADDR ((long)(ftrace_stub)) | 15 | #define STUB_ADDR ((long)(ftrace_stub)) |
| 16 | #define GRAPH_ADDR ((long)(ftrace_graph_call)) | ||
| 17 | #define CALLER_ADDR ((long)(ftrace_caller)) | ||
| 16 | 18 | ||
| 17 | #define MCOUNT_INSN_OFFSET ((STUB_ADDR - CALLER_ADDR) >> 1) | 19 | #define MCOUNT_INSN_OFFSET ((STUB_ADDR - CALL_ADDR) - 4) |
| 20 | #define GRAPH_INSN_OFFSET ((CALLER_ADDR - GRAPH_ADDR) - 4) | ||
| 18 | 21 | ||
| 19 | struct dyn_arch_ftrace { | 22 | struct dyn_arch_ftrace { |
| 20 | /* No extra data needed on sh */ | 23 | /* No extra data needed on sh */ |
diff --git a/arch/sh/include/asm/hwblk.h b/arch/sh/include/asm/hwblk.h new file mode 100644 index 000000000000..c01d72cb6757 --- /dev/null +++ b/arch/sh/include/asm/hwblk.h | |||
| @@ -0,0 +1,70 @@ | |||
| 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_NR 1 | ||
| 9 | |||
| 10 | #define HWBLK_AREA_FLAG_PARENT (1 << 0) /* valid parent */ | ||
| 11 | |||
| 12 | #define HWBLK_AREA(_flags, _parent) \ | ||
| 13 | { \ | ||
| 14 | .flags = _flags, \ | ||
| 15 | .parent = _parent, \ | ||
| 16 | } | ||
| 17 | |||
| 18 | struct hwblk_area { | ||
| 19 | int cnt[HWBLK_CNT_NR]; | ||
| 20 | unsigned char parent; | ||
| 21 | unsigned char flags; | ||
| 22 | }; | ||
| 23 | |||
| 24 | #define HWBLK(_mstp, _bit, _area) \ | ||
| 25 | { \ | ||
| 26 | .mstp = (void __iomem *)_mstp, \ | ||
| 27 | .bit = _bit, \ | ||
| 28 | .area = _area, \ | ||
| 29 | } | ||
| 30 | |||
| 31 | struct hwblk { | ||
| 32 | void __iomem *mstp; | ||
| 33 | unsigned char bit; | ||
| 34 | unsigned char area; | ||
| 35 | int cnt[HWBLK_CNT_NR]; | ||
| 36 | }; | ||
| 37 | |||
| 38 | struct hwblk_info { | ||
| 39 | struct hwblk_area *areas; | ||
| 40 | int nr_areas; | ||
| 41 | struct hwblk *hwblks; | ||
| 42 | int nr_hwblks; | ||
| 43 | }; | ||
| 44 | |||
| 45 | /* Should be defined by processor-specific code */ | ||
| 46 | int arch_hwblk_init(void); | ||
| 47 | int arch_hwblk_sleep_mode(void); | ||
| 48 | |||
| 49 | int hwblk_register(struct hwblk_info *info); | ||
| 50 | int hwblk_init(void); | ||
| 51 | |||
| 52 | void hwblk_enable(struct hwblk_info *info, int hwblk); | ||
| 53 | void hwblk_disable(struct hwblk_info *info, int hwblk); | ||
| 54 | |||
| 55 | void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int cnt); | ||
| 56 | void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int cnt); | ||
| 57 | |||
| 58 | /* allow clocks to enable and disable hardware blocks */ | ||
| 59 | #define SH_HWBLK_CLK(_name, _id, _parent, _hwblk, _flags) \ | ||
| 60 | { \ | ||
| 61 | .name = _name, \ | ||
| 62 | .id = _id, \ | ||
| 63 | .parent = _parent, \ | ||
| 64 | .arch_flags = _hwblk, \ | ||
| 65 | .flags = _flags, \ | ||
| 66 | } | ||
| 67 | |||
| 68 | int sh_hwblk_clk_register(struct clk *clks, int nr); | ||
| 69 | |||
| 70 | #endif /* __ASM_SH_HWBLK_H */ | ||
diff --git a/arch/sh/include/asm/lmb.h b/arch/sh/include/asm/lmb.h new file mode 100644 index 000000000000..9b437f657ffa --- /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/suspend.h b/arch/sh/include/asm/suspend.h index b1b995370e79..5c8ea28ff7a4 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 | |||
| 14 | void sh_mobile_call_standby(unsigned long mode); | ||
| 15 | |||
| 16 | #ifdef CONFIG_CPU_IDLE | ||
| 17 | void sh_mobile_setup_cpuidle(void); | ||
| 18 | #else | ||
| 19 | static 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 6f83f2cc45c1..7d80df4f09cb 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/thread_info.h b/arch/sh/include/asm/thread_info.h index d570ac2e5cb9..5123bcaa8509 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 | ||
| 98 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); | 98 | extern struct thread_info *alloc_thread_info(struct task_struct *tsk); |
| 99 | extern void free_thread_info(struct thread_info *ti); | 99 | extern 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_FTRACE 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_FTRACE (1 << TIF_SYSCALL_FTRACE) | ||
| 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_FTRACE) | ||
| 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_FTRACE) |
| 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/cpu-sh4/cpu/sh7722.h b/arch/sh/include/cpu-sh4/cpu/sh7722.h index 738ea43c5038..48560407cbe1 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 | ||
| 224 | enum { | ||
| 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 14c8ca936781..9b36fae72324 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 | ||
| 268 | enum { | ||
| 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/kernel/Makefile_32 b/arch/sh/kernel/Makefile_32 index 9411e3e31e68..94ed99b68002 100644 --- a/arch/sh/kernel/Makefile_32 +++ b/arch/sh/kernel/Makefile_32 | |||
| @@ -29,6 +29,8 @@ obj-$(CONFIG_IO_TRAPPED) += io_trapped.o | |||
| 29 | obj-$(CONFIG_KPROBES) += kprobes.o | 29 | obj-$(CONFIG_KPROBES) += kprobes.o |
| 30 | obj-$(CONFIG_GENERIC_GPIO) += gpio.o | 30 | obj-$(CONFIG_GENERIC_GPIO) += gpio.o |
| 31 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o | 31 | obj-$(CONFIG_DYNAMIC_FTRACE) += ftrace.o |
| 32 | obj-$(CONFIG_FTRACE_SYSCALLS) += ftrace.o | ||
| 33 | obj-$(CONFIG_FUNCTION_GRAPH_TRACER) += ftrace.o | ||
| 32 | obj-$(CONFIG_DUMP_CODE) += disassemble.o | 34 | obj-$(CONFIG_DUMP_CODE) += disassemble.o |
| 33 | obj-$(CONFIG_HIBERNATION) += swsusp.o | 35 | obj-$(CONFIG_HIBERNATION) += swsusp.o |
| 34 | 36 | ||
diff --git a/arch/sh/kernel/asm-offsets.c b/arch/sh/kernel/asm-offsets.c index 99aceb28ee24..d218e808294e 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 eecad7cbd61e..3d6b9312dc47 100644 --- a/arch/sh/kernel/cpu/Makefile +++ b/arch/sh/kernel/cpu/Makefile | |||
| @@ -19,4 +19,4 @@ obj-$(CONFIG_UBC_WAKEUP) += ubc.o | |||
| 19 | obj-$(CONFIG_SH_ADC) += adc.o | 19 | obj-$(CONFIG_SH_ADC) += adc.o |
| 20 | obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o | 20 | obj-$(CONFIG_SH_CLK_CPG) += clock-cpg.o |
| 21 | 21 | ||
| 22 | obj-y += irq/ init.o clock.o | 22 | obj-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 000000000000..c0ad7d46e784 --- /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 | |||
| 10 | static DEFINE_SPINLOCK(hwblk_lock); | ||
| 11 | |||
| 12 | static 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 | |||
| 27 | static 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 | |||
| 39 | static 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 | |||
| 49 | void hwblk_cnt_inc(struct hwblk_info *info, int hwblk, int counter) | ||
| 50 | { | ||
| 51 | hwblk_mod_cnt(info, hwblk, counter, 1, 1); | ||
| 52 | } | ||
| 53 | |||
| 54 | void hwblk_cnt_dec(struct hwblk_info *info, int hwblk, int counter) | ||
| 55 | { | ||
| 56 | hwblk_mod_cnt(info, hwblk, counter, -1, 0); | ||
| 57 | } | ||
| 58 | |||
| 59 | void 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 | |||
| 78 | void 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 | |||
| 97 | struct hwblk_info *hwblk_info; | ||
| 98 | |||
| 99 | int __init hwblk_register(struct hwblk_info *info) | ||
| 100 | { | ||
| 101 | hwblk_info = info; | ||
| 102 | return 0; | ||
| 103 | } | ||
| 104 | |||
| 105 | int __init __weak arch_hwblk_init(void) | ||
| 106 | { | ||
| 107 | return 0; | ||
| 108 | } | ||
| 109 | |||
| 110 | int __weak arch_hwblk_sleep_mode(void) | ||
| 111 | { | ||
| 112 | return SUSP_SH_SLEEP; | ||
| 113 | } | ||
| 114 | |||
| 115 | int __init hwblk_init(void) | ||
| 116 | { | ||
| 117 | return arch_hwblk_init(); | ||
| 118 | } | ||
| 119 | |||
| 120 | /* allow clocks to enable and disable hardware blocks */ | ||
| 121 | static 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 | |||
| 130 | static void sh_hwblk_clk_disable(struct clk *clk) | ||
| 131 | { | ||
| 132 | if (hwblk_info) | ||
| 133 | hwblk_disable(hwblk_info, clk->arch_flags); | ||
| 134 | } | ||
| 135 | |||
| 136 | static 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 | |||
| 142 | int __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/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile index ebdd391d5f42..1d7ae38bc611 100644 --- a/arch/sh/kernel/cpu/sh4a/Makefile +++ b/arch/sh/kernel/cpu/sh4a/Makefile | |||
| @@ -25,8 +25,8 @@ clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o | |||
| 25 | clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o | 25 | clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o |
| 26 | clock-$(CONFIG_CPU_SUBTYPE_SH7786) := clock-sh7786.o | 26 | clock-$(CONFIG_CPU_SUBTYPE_SH7786) := clock-sh7786.o |
| 27 | clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o | 27 | clock-$(CONFIG_CPU_SUBTYPE_SH7343) := clock-sh7343.o |
| 28 | clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o | 28 | clock-$(CONFIG_CPU_SUBTYPE_SH7722) := clock-sh7722.o hwblk-sh7722.o |
| 29 | clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7723.o | 29 | clock-$(CONFIG_CPU_SUBTYPE_SH7723) := clock-sh7723.o hwblk-sh7723.o |
| 30 | clock-$(CONFIG_CPU_SUBTYPE_SH7724) := clock-sh7724.o | 30 | clock-$(CONFIG_CPU_SUBTYPE_SH7724) := clock-sh7724.o |
| 31 | clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7366.o | 31 | clock-$(CONFIG_CPU_SUBTYPE_SH7366) := clock-sh7366.o |
| 32 | clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o | 32 | clock-$(CONFIG_CPU_SUBTYPE_SHX3) := clock-shx3.o |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7722.c b/arch/sh/kernel/cpu/sh4a/clock-sh7722.c index 40f859354f79..1fa9e1dd1cc8 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 |
| @@ -140,35 +142,37 @@ struct clk div6_clks[] = { | |||
| 140 | SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), | 142 | SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), |
| 141 | }; | 143 | }; |
| 142 | 144 | ||
| 143 | #define MSTP(_str, _parent, _reg, _bit, _flags) \ | 145 | #define R_CLK &r_clk |
| 144 | SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _flags) | 146 | #define P_CLK &div4_clks[DIV4_P] |
| 147 | #define B_CLK &div4_clks[DIV4_B] | ||
| 148 | #define U_CLK &div4_clks[DIV4_U] | ||
| 145 | 149 | ||
| 146 | static struct clk mstp_clks[] = { | 150 | static struct clk mstp_clks[] = { |
| 147 | MSTP("uram0", &div4_clks[DIV4_U], MSTPCR0, 28, CLK_ENABLE_ON_INIT), | 151 | 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), | 152 | SH_HWBLK_CLK("xymem0", -1, B_CLK, HWBLK_XYMEM, CLK_ENABLE_ON_INIT), |
| 149 | MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0), | 153 | SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU, 0), |
| 150 | MSTP("cmt0", &r_clk, MSTPCR0, 14, 0), | 154 | SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0), |
| 151 | MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0), | 155 | SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), |
| 152 | MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0), | 156 | SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0), |
| 153 | MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 7, 0), | 157 | SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0), |
| 154 | MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 6, 0), | 158 | SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0), |
| 155 | MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 5, 0), | 159 | SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0), |
| 156 | 160 | ||
| 157 | MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0), | 161 | SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0), |
| 158 | MSTP("rtc0", &r_clk, MSTPCR1, 8, 0), | 162 | SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), |
| 159 | 163 | ||
| 160 | MSTP("sdhi0", &div4_clks[DIV4_P], MSTPCR2, 18, 0), | 164 | SH_HWBLK_CLK("sdhi0", -1, P_CLK, HWBLK_SDHI, 0), |
| 161 | MSTP("keysc0", &r_clk, MSTPCR2, 14, 0), | 165 | SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), |
| 162 | MSTP("usbf0", &div4_clks[DIV4_P], MSTPCR2, 11, 0), | 166 | SH_HWBLK_CLK("usbf0", -1, P_CLK, HWBLK_USBF, 0), |
| 163 | MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 9, 0), | 167 | SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), |
| 164 | MSTP("siu0", &div4_clks[DIV4_B], MSTPCR2, 8, 0), | 168 | SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0), |
| 165 | MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0), | 169 | SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0), |
| 166 | MSTP("jpu0", &div4_clks[DIV4_B], MSTPCR2, 6, CLK_ENABLE_ON_INIT), | 170 | SH_HWBLK_CLK("jpu0", -1, B_CLK, HWBLK_JPU, CLK_ENABLE_ON_INIT), |
| 167 | MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0), | 171 | SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0), |
| 168 | MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0), | 172 | SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0), |
| 169 | MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, CLK_ENABLE_ON_INIT), | 173 | SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU, CLK_ENABLE_ON_INIT), |
| 170 | MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, CLK_ENABLE_ON_INIT), | 174 | SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, CLK_ENABLE_ON_INIT), |
| 171 | MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0), | 175 | SH_HWBLK_CLK("lcdc0", -1, P_CLK, HWBLK_LCDC, 0), |
| 172 | }; | 176 | }; |
| 173 | 177 | ||
| 174 | int __init arch_clk_init(void) | 178 | int __init arch_clk_init(void) |
| @@ -191,7 +195,7 @@ int __init arch_clk_init(void) | |||
| 191 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); | 195 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); |
| 192 | 196 | ||
| 193 | if (!ret) | 197 | if (!ret) |
| 194 | ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); | 198 | ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); |
| 195 | 199 | ||
| 196 | return ret; | 200 | return ret; |
| 197 | } | 201 | } |
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh7723.c b/arch/sh/kernel/cpu/sh4a/clock-sh7723.c index e67c2678b8ae..bf64c78eee34 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 |
| @@ -140,60 +142,64 @@ struct clk div6_clks[] = { | |||
| 140 | SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), | 142 | SH_CLK_DIV6("video_clk", &pll_clk, VCLKCR, 0), |
| 141 | }; | 143 | }; |
| 142 | 144 | ||
| 143 | #define MSTP(_str, _parent, _reg, _bit, _force_on, _need_cpg, _need_ram) \ | 145 | #define R_CLK (&r_clk) |
| 144 | SH_CLK_MSTP32(_str, -1, _parent, _reg, _bit, _force_on * CLK_ENABLE_ON_INIT) | 146 | #define P_CLK (&div4_clks[DIV4_P]) |
| 147 | #define B_CLK (&div4_clks[DIV4_B]) | ||
| 148 | #define U_CLK (&div4_clks[DIV4_U]) | ||
| 149 | #define I_CLK (&div4_clks[DIV4_I]) | ||
| 150 | #define SH_CLK (&div4_clks[DIV4_SH]) | ||
| 145 | 151 | ||
| 146 | static struct clk mstp_clks[] = { | 152 | static struct clk mstp_clks[] = { |
| 147 | /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */ | 153 | /* See page 60 of Datasheet V1.0: Overview -> Block Diagram */ |
| 148 | MSTP("tlb0", &div4_clks[DIV4_I], MSTPCR0, 31, 1, 1, 0), | 154 | 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), | 155 | 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), | 156 | 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), | 157 | 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), | 158 | 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), | 159 | 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), | 160 | 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), | 161 | SH_HWBLK_CLK("dmac0", -1, B_CLK, HWBLK_DMAC0, 0), |
| 156 | MSTP("sh0", &div4_clks[DIV4_SH], MSTPCR0, 20, 0, 1, 0), | 162 | 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), | 163 | SH_HWBLK_CLK("hudi0", -1, P_CLK, HWBLK_HUDI, 0), |
| 158 | MSTP("ubc0", &div4_clks[DIV4_I], MSTPCR0, 17, 0, 1, 0), | 164 | SH_HWBLK_CLK("ubc0", -1, I_CLK, HWBLK_UBC, 0), |
| 159 | MSTP("tmu0", &div4_clks[DIV4_P], MSTPCR0, 15, 0, 1, 0), | 165 | SH_HWBLK_CLK("tmu0", -1, P_CLK, HWBLK_TMU0, 0), |
| 160 | MSTP("cmt0", &r_clk, MSTPCR0, 14, 0, 0, 0), | 166 | SH_HWBLK_CLK("cmt0", -1, R_CLK, HWBLK_CMT, 0), |
| 161 | MSTP("rwdt0", &r_clk, MSTPCR0, 13, 0, 0, 0), | 167 | SH_HWBLK_CLK("rwdt0", -1, R_CLK, HWBLK_RWDT, 0), |
| 162 | MSTP("dmac1", &div4_clks[DIV4_B], MSTPCR0, 12, 0, 1, 1), | 168 | SH_HWBLK_CLK("dmac1", -1, B_CLK, HWBLK_DMAC1, 0), |
| 163 | MSTP("tmu1", &div4_clks[DIV4_P], MSTPCR0, 11, 0, 1, 0), | 169 | SH_HWBLK_CLK("tmu1", -1, P_CLK, HWBLK_TMU1, 0), |
| 164 | MSTP("flctl0", &div4_clks[DIV4_P], MSTPCR0, 10, 0, 1, 0), | 170 | SH_HWBLK_CLK("flctl0", -1, P_CLK, HWBLK_FLCTL, 0), |
| 165 | MSTP("scif0", &div4_clks[DIV4_P], MSTPCR0, 9, 0, 1, 0), | 171 | SH_HWBLK_CLK("scif0", -1, P_CLK, HWBLK_SCIF0, 0), |
| 166 | MSTP("scif1", &div4_clks[DIV4_P], MSTPCR0, 8, 0, 1, 0), | 172 | SH_HWBLK_CLK("scif1", -1, P_CLK, HWBLK_SCIF1, 0), |
| 167 | MSTP("scif2", &div4_clks[DIV4_P], MSTPCR0, 7, 0, 1, 0), | 173 | SH_HWBLK_CLK("scif2", -1, P_CLK, HWBLK_SCIF2, 0), |
| 168 | MSTP("scif3", &div4_clks[DIV4_B], MSTPCR0, 6, 0, 1, 0), | 174 | SH_HWBLK_CLK("scif3", -1, B_CLK, HWBLK_SCIF3, 0), |
| 169 | MSTP("scif4", &div4_clks[DIV4_B], MSTPCR0, 5, 0, 1, 0), | 175 | SH_HWBLK_CLK("scif4", -1, B_CLK, HWBLK_SCIF4, 0), |
| 170 | MSTP("scif5", &div4_clks[DIV4_B], MSTPCR0, 4, 0, 1, 0), | 176 | SH_HWBLK_CLK("scif5", -1, B_CLK, HWBLK_SCIF5, 0), |
| 171 | MSTP("msiof0", &div4_clks[DIV4_B], MSTPCR0, 2, 0, 1, 0), | 177 | SH_HWBLK_CLK("msiof0", -1, B_CLK, HWBLK_MSIOF0, 0), |
| 172 | MSTP("msiof1", &div4_clks[DIV4_B], MSTPCR0, 1, 0, 1, 0), | 178 | SH_HWBLK_CLK("msiof1", -1, B_CLK, HWBLK_MSIOF1, 0), |
| 173 | MSTP("meram0", &div4_clks[DIV4_SH], MSTPCR0, 0, 1, 1, 0), | 179 | SH_HWBLK_CLK("meram0", -1, SH_CLK, HWBLK_MERAM, 0), |
| 174 | 180 | ||
| 175 | MSTP("i2c0", &div4_clks[DIV4_P], MSTPCR1, 9, 0, 1, 0), | 181 | SH_HWBLK_CLK("i2c0", -1, P_CLK, HWBLK_IIC, 0), |
| 176 | MSTP("rtc0", &r_clk, MSTPCR1, 8, 0, 0, 0), | 182 | SH_HWBLK_CLK("rtc0", -1, R_CLK, HWBLK_RTC, 0), |
| 177 | 183 | ||
| 178 | MSTP("atapi0", &div4_clks[DIV4_SH], MSTPCR2, 28, 0, 1, 0), | 184 | SH_HWBLK_CLK("atapi0", -1, SH_CLK, HWBLK_ATAPI, 0), |
| 179 | MSTP("adc0", &div4_clks[DIV4_P], MSTPCR2, 27, 0, 1, 0), | 185 | SH_HWBLK_CLK("adc0", -1, P_CLK, HWBLK_ADC, 0), |
| 180 | MSTP("tpu0", &div4_clks[DIV4_B], MSTPCR2, 25, 0, 1, 0), | 186 | SH_HWBLK_CLK("tpu0", -1, B_CLK, HWBLK_TPU, 0), |
| 181 | MSTP("irda0", &div4_clks[DIV4_P], MSTPCR2, 24, 0, 1, 0), | 187 | SH_HWBLK_CLK("irda0", -1, P_CLK, HWBLK_IRDA, 0), |
| 182 | MSTP("tsif0", &div4_clks[DIV4_B], MSTPCR2, 22, 0, 1, 0), | 188 | SH_HWBLK_CLK("tsif0", -1, B_CLK, HWBLK_TSIF, 0), |
| 183 | MSTP("icb0", &div4_clks[DIV4_B], MSTPCR2, 21, 0, 1, 1), | 189 | 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), | 190 | SH_HWBLK_CLK("sdhi0", -1, B_CLK, HWBLK_SDHI0, 0), |
| 185 | MSTP("sdhi1", &div4_clks[DIV4_B], MSTPCR2, 17, 0, 1, 0), | 191 | SH_HWBLK_CLK("sdhi1", -1, B_CLK, HWBLK_SDHI1, 0), |
| 186 | MSTP("keysc0", &r_clk, MSTPCR2, 14, 0, 0, 0), | 192 | SH_HWBLK_CLK("keysc0", -1, R_CLK, HWBLK_KEYSC, 0), |
| 187 | MSTP("usb0", &div4_clks[DIV4_B], MSTPCR2, 11, 0, 1, 0), | 193 | SH_HWBLK_CLK("usb0", -1, B_CLK, HWBLK_USB, 0), |
| 188 | MSTP("2dg0", &div4_clks[DIV4_B], MSTPCR2, 10, 0, 1, 1), | 194 | SH_HWBLK_CLK("2dg0", -1, B_CLK, HWBLK_2DG, 0), |
| 189 | MSTP("siu0", &div4_clks[DIV4_B], MSTPCR2, 8, 0, 1, 0), | 195 | SH_HWBLK_CLK("siu0", -1, B_CLK, HWBLK_SIU, 0), |
| 190 | MSTP("veu1", &div4_clks[DIV4_B], MSTPCR2, 6, 1, 1, 1), | 196 | SH_HWBLK_CLK("veu1", -1, B_CLK, HWBLK_VEU2H1, CLK_ENABLE_ON_INIT), |
| 191 | MSTP("vou0", &div4_clks[DIV4_B], MSTPCR2, 5, 0, 1, 1), | 197 | SH_HWBLK_CLK("vou0", -1, B_CLK, HWBLK_VOU, 0), |
| 192 | MSTP("beu0", &div4_clks[DIV4_B], MSTPCR2, 4, 0, 1, 1), | 198 | SH_HWBLK_CLK("beu0", -1, B_CLK, HWBLK_BEU, 0), |
| 193 | MSTP("ceu0", &div4_clks[DIV4_B], MSTPCR2, 3, 0, 1, 1), | 199 | SH_HWBLK_CLK("ceu0", -1, B_CLK, HWBLK_CEU, 0), |
| 194 | MSTP("veu0", &div4_clks[DIV4_B], MSTPCR2, 2, 1, 1, 1), | 200 | SH_HWBLK_CLK("veu0", -1, B_CLK, HWBLK_VEU2H0, CLK_ENABLE_ON_INIT), |
| 195 | MSTP("vpu0", &div4_clks[DIV4_B], MSTPCR2, 1, 1, 1, 1), | 201 | SH_HWBLK_CLK("vpu0", -1, B_CLK, HWBLK_VPU, CLK_ENABLE_ON_INIT), |
| 196 | MSTP("lcdc0", &div4_clks[DIV4_B], MSTPCR2, 0, 0, 1, 1), | 202 | SH_HWBLK_CLK("lcdc0", -1, B_CLK, HWBLK_LCDC, 0), |
| 197 | }; | 203 | }; |
| 198 | 204 | ||
| 199 | int __init arch_clk_init(void) | 205 | int __init arch_clk_init(void) |
| @@ -216,7 +222,7 @@ int __init arch_clk_init(void) | |||
| 216 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); | 222 | ret = sh_clk_div6_register(div6_clks, ARRAY_SIZE(div6_clks)); |
| 217 | 223 | ||
| 218 | if (!ret) | 224 | if (!ret) |
| 219 | ret = sh_clk_mstp32_register(mstp_clks, ARRAY_SIZE(mstp_clks)); | 225 | ret = sh_hwblk_clk_register(mstp_clks, ARRAY_SIZE(mstp_clks)); |
| 220 | 226 | ||
| 221 | return ret; | 227 | return ret; |
| 222 | } | 228 | } |
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 000000000000..a288b5d92341 --- /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 */ | ||
| 34 | enum { CORE_AREA, SUB_AREA, CORE_AREA_BM }; | ||
| 35 | static 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 */ | ||
| 42 | static 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 | |||
| 85 | static 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 | |||
| 92 | int 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 | |||
| 103 | int __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 000000000000..a7f4684d2032 --- /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 */ | ||
| 34 | enum { CORE_AREA, SUB_AREA, CORE_AREA_BM }; | ||
| 35 | static 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 */ | ||
| 42 | static 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 | |||
| 96 | static 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 | |||
| 103 | int 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 | |||
| 114 | int __init arch_hwblk_init(void) | ||
| 115 | { | ||
| 116 | return hwblk_register(&sh7723_hwblk_info); | ||
| 117 | } | ||
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7366.c b/arch/sh/kernel/cpu/sh4a/setup-sh7366.c index c18f7d09281b..f6d208813564 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 | ||
| 42 | static struct r8a66597_platdata r8a66597_data = { | 42 | static struct r8a66597_platdata r8a66597_data = { |
| 43 | /* This set zero to all members */ | 43 | .on_chip = 1, |
| 44 | }; | 44 | }; |
| 45 | 45 | ||
| 46 | static struct resource usb_host_resources[] = { | 46 | static struct resource usb_host_resources[] = { |
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c index e1bb80b2a27b..28516499a2c4 100644 --- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c +++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c | |||
| @@ -398,7 +398,7 @@ static struct platform_device rtc_device = { | |||
| 398 | }; | 398 | }; |
| 399 | 399 | ||
| 400 | static struct r8a66597_platdata r8a66597_data = { | 400 | static struct r8a66597_platdata r8a66597_data = { |
| 401 | /* This set zero to all members */ | 401 | .on_chip = 1, |
| 402 | }; | 402 | }; |
| 403 | 403 | ||
| 404 | static struct resource sh7723_usb_host_resources[] = { | 404 | static struct resource sh7723_usb_host_resources[] = { |
diff --git a/arch/sh/kernel/cpu/shmobile/Makefile b/arch/sh/kernel/cpu/shmobile/Makefile index 08bfa7c7db29..e8a5111e848a 100644 --- a/arch/sh/kernel/cpu/shmobile/Makefile +++ b/arch/sh/kernel/cpu/shmobile/Makefile | |||
| @@ -4,3 +4,4 @@ | |||
| 4 | 4 | ||
| 5 | # Power Management & Sleep mode | 5 | # Power Management & Sleep mode |
| 6 | obj-$(CONFIG_PM) += pm.o sleep.o | 6 | obj-$(CONFIG_PM) += pm.o sleep.o |
| 7 | obj-$(CONFIG_CPU_IDLE) += cpuidle.o | ||
diff --git a/arch/sh/kernel/cpu/shmobile/cpuidle.c b/arch/sh/kernel/cpu/shmobile/cpuidle.c new file mode 100644 index 000000000000..4afdd975cc66 --- /dev/null +++ b/arch/sh/kernel/cpu/shmobile/cpuidle.c | |||
| @@ -0,0 +1,102 @@ | |||
| 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 | |||
| 21 | static unsigned long cpuidle_mode[] = { | ||
| 22 | SUSP_SH_SLEEP, /* regular sleep mode */ | ||
| 23 | SUSP_SH_SLEEP | SUSP_SH_SF, /* sleep mode + self refresh */ | ||
| 24 | }; | ||
| 25 | |||
| 26 | static int cpuidle_sleep_enter(struct cpuidle_device *dev, | ||
| 27 | struct cpuidle_state *state) | ||
| 28 | { | ||
| 29 | unsigned long allowed_mode = arch_hwblk_sleep_mode(); | ||
| 30 | ktime_t before, after; | ||
| 31 | int requested_state = state - &dev->states[0]; | ||
| 32 | int allowed_state; | ||
| 33 | int k; | ||
| 34 | |||
| 35 | /* convert allowed mode to allowed state */ | ||
| 36 | for (k = ARRAY_SIZE(cpuidle_mode) - 1; k > 0; k--) | ||
| 37 | if (cpuidle_mode[k] == allowed_mode) | ||
| 38 | break; | ||
| 39 | |||
| 40 | allowed_state = k; | ||
| 41 | |||
| 42 | /* take the following into account for sleep mode selection: | ||
| 43 | * - allowed_state: best mode allowed by hardware (clock deps) | ||
| 44 | * - requested_state: best mode allowed by software (latencies) | ||
| 45 | */ | ||
| 46 | k = min_t(int, allowed_state, requested_state); | ||
| 47 | |||
| 48 | dev->last_state = &dev->states[k]; | ||
| 49 | before = ktime_get(); | ||
| 50 | sh_mobile_call_standby(cpuidle_mode[k]); | ||
| 51 | after = ktime_get(); | ||
| 52 | return ktime_to_ns(ktime_sub(after, before)) >> 10; | ||
| 53 | } | ||
| 54 | |||
| 55 | static struct cpuidle_device cpuidle_dev; | ||
| 56 | static struct cpuidle_driver cpuidle_driver = { | ||
| 57 | .name = "sh_idle", | ||
| 58 | .owner = THIS_MODULE, | ||
| 59 | }; | ||
| 60 | |||
| 61 | void sh_mobile_setup_cpuidle(void) | ||
| 62 | { | ||
| 63 | struct cpuidle_device *dev = &cpuidle_dev; | ||
| 64 | struct cpuidle_state *state; | ||
| 65 | int i; | ||
| 66 | |||
| 67 | cpuidle_register_driver(&cpuidle_driver); | ||
| 68 | |||
| 69 | for (i = 0; i < CPUIDLE_STATE_MAX; i++) { | ||
| 70 | dev->states[i].name[0] = '\0'; | ||
| 71 | dev->states[i].desc[0] = '\0'; | ||
| 72 | } | ||
| 73 | |||
| 74 | i = CPUIDLE_DRIVER_STATE_START; | ||
| 75 | |||
| 76 | state = &dev->states[i++]; | ||
| 77 | snprintf(state->name, CPUIDLE_NAME_LEN, "C0"); | ||
| 78 | strncpy(state->desc, "SuperH Sleep Mode", CPUIDLE_DESC_LEN); | ||
| 79 | state->exit_latency = 1; | ||
| 80 | state->target_residency = 1 * 2; | ||
| 81 | state->power_usage = 3; | ||
| 82 | state->flags = 0; | ||
| 83 | state->flags |= CPUIDLE_FLAG_SHALLOW; | ||
| 84 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
| 85 | state->enter = cpuidle_sleep_enter; | ||
| 86 | |||
| 87 | dev->safe_state = state; | ||
| 88 | |||
| 89 | state = &dev->states[i++]; | ||
| 90 | snprintf(state->name, CPUIDLE_NAME_LEN, "C1"); | ||
| 91 | strncpy(state->desc, "SuperH Sleep Mode [SF]", CPUIDLE_DESC_LEN); | ||
| 92 | state->exit_latency = 100; | ||
| 93 | state->target_residency = 1 * 2; | ||
| 94 | state->power_usage = 1; | ||
| 95 | state->flags = 0; | ||
| 96 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | ||
| 97 | state->enter = cpuidle_sleep_enter; | ||
| 98 | |||
| 99 | dev->state_count = i; | ||
| 100 | |||
| 101 | cpuidle_register_device(dev); | ||
| 102 | } | ||
diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c index 8c067adf6830..de078d24ce56 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,20 +32,17 @@ | |||
| 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 | |||
| 42 | extern const unsigned char sh_mobile_standby[]; | 39 | extern const unsigned char sh_mobile_standby[]; |
| 43 | extern const unsigned int sh_mobile_standby_size; | 40 | extern const unsigned int sh_mobile_standby_size; |
| 44 | 41 | ||
| 45 | static void sh_mobile_call_standby(unsigned long mode) | 42 | void sh_mobile_call_standby(unsigned long mode) |
| 46 | { | 43 | { |
| 47 | extern void *vbr_base; | 44 | extern void *vbr_base; |
| 48 | void *onchip_mem = (void *)0xe5200000; /* ILRAM */ | 45 | void *onchip_mem = (void *)ILRAM_BASE; |
| 49 | void (*standby_onchip_mem)(unsigned long) = onchip_mem; | 46 | void (*standby_onchip_mem)(unsigned long) = onchip_mem; |
| 50 | 47 | ||
| 51 | /* Note: Wake up from sleep may generate exceptions! | 48 | /* Note: Wake up from sleep may generate exceptions! |
| @@ -55,11 +52,6 @@ static void sh_mobile_call_standby(unsigned long mode) | |||
| 55 | if (mode & SUSP_SH_SF) | 52 | if (mode & SUSP_SH_SF) |
| 56 | asm volatile("ldc %0, vbr" : : "r" (onchip_mem) : "memory"); | 53 | asm volatile("ldc %0, vbr" : : "r" (onchip_mem) : "memory"); |
| 57 | 54 | ||
| 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 | |||
| 63 | /* Let assembly snippet in on-chip memory handle the rest */ | 55 | /* Let assembly snippet in on-chip memory handle the rest */ |
| 64 | standby_onchip_mem(mode); | 56 | standby_onchip_mem(mode); |
| 65 | 57 | ||
| @@ -85,7 +77,15 @@ static struct platform_suspend_ops sh_pm_ops = { | |||
| 85 | 77 | ||
| 86 | static int __init sh_pm_init(void) | 78 | static int __init sh_pm_init(void) |
| 87 | { | 79 | { |
| 80 | void *onchip_mem = (void *)ILRAM_BASE; | ||
| 81 | |||
| 82 | /* Copy the assembly snippet to the otherwise ununsed ILRAM */ | ||
| 83 | memcpy(onchip_mem, sh_mobile_standby, sh_mobile_standby_size); | ||
| 84 | wmb(); | ||
| 85 | ctrl_barrier(); | ||
| 86 | |||
| 88 | suspend_set_ops(&sh_pm_ops); | 87 | suspend_set_ops(&sh_pm_ops); |
| 88 | sh_mobile_setup_cpuidle(); | ||
| 89 | return 0; | 89 | return 0; |
| 90 | } | 90 | } |
| 91 | 91 | ||
diff --git a/arch/sh/kernel/entry-common.S b/arch/sh/kernel/entry-common.S index d62359cfbbe2..d62175650c54 100644 --- a/arch/sh/kernel/entry-common.S +++ b/arch/sh/kernel/entry-common.S | |||
| @@ -131,7 +131,7 @@ ENTRY(resume_userspace) | |||
| 131 | nop | 131 | nop |
| 132 | #endif | 132 | #endif |
| 133 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags | 133 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags |
| 134 | tst #_TIF_WORK_MASK, r0 | 134 | tst #(_TIF_WORK_MASK & 0xff), r0 |
| 135 | bt/s __restore_all | 135 | bt/s __restore_all |
| 136 | tst #_TIF_NEED_RESCHED, r0 | 136 | tst #_TIF_NEED_RESCHED, r0 |
| 137 | 137 | ||
| @@ -163,7 +163,7 @@ work_resched: | |||
| 163 | #endif | 163 | #endif |
| 164 | ! | 164 | ! |
| 165 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags | 165 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags |
| 166 | tst #_TIF_WORK_MASK, r0 | 166 | tst #(_TIF_WORK_MASK & 0xff), r0 |
| 167 | bt __restore_all | 167 | bt __restore_all |
| 168 | bra work_pending | 168 | bra work_pending |
| 169 | tst #_TIF_NEED_RESCHED, r0 | 169 | tst #_TIF_NEED_RESCHED, r0 |
| @@ -181,7 +181,7 @@ work_resched: | |||
| 181 | syscall_exit_work: | 181 | syscall_exit_work: |
| 182 | ! r0: current_thread_info->flags | 182 | ! r0: current_thread_info->flags |
| 183 | ! r8: current_thread_info | 183 | ! r8: current_thread_info |
| 184 | tst #_TIF_WORK_SYSCALL_MASK, r0 | 184 | tst #(_TIF_WORK_SYSCALL_MASK & 0xff), r0 |
| 185 | bt/s work_pending | 185 | bt/s work_pending |
| 186 | tst #_TIF_NEED_RESCHED, r0 | 186 | tst #_TIF_NEED_RESCHED, r0 |
| 187 | #ifdef CONFIG_TRACE_IRQFLAGS | 187 | #ifdef CONFIG_TRACE_IRQFLAGS |
| @@ -331,8 +331,12 @@ ENTRY(system_call) | |||
| 331 | ! | 331 | ! |
| 332 | get_current_thread_info r8, r10 | 332 | get_current_thread_info r8, r10 |
| 333 | mov.l @(TI_FLAGS,r8), r8 | 333 | mov.l @(TI_FLAGS,r8), r8 |
| 334 | mov #_TIF_WORK_SYSCALL_MASK, r10 | 334 | mov #(_TIF_WORK_SYSCALL_MASK & 0xff), r10 |
| 335 | mov #(_TIF_WORK_SYSCALL_MASK >> 8), r9 | ||
| 335 | tst r10, r8 | 336 | tst r10, r8 |
| 337 | shll8 r9 | ||
| 338 | bf syscall_trace_entry | ||
| 339 | tst r9, r8 | ||
| 336 | bf syscall_trace_entry | 340 | bf syscall_trace_entry |
| 337 | ! | 341 | ! |
| 338 | mov.l 2f, r8 ! Number of syscalls | 342 | mov.l 2f, r8 ! Number of syscalls |
| @@ -359,7 +363,11 @@ syscall_exit: | |||
| 359 | ! | 363 | ! |
| 360 | get_current_thread_info r8, r0 | 364 | get_current_thread_info r8, r0 |
| 361 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags | 365 | mov.l @(TI_FLAGS,r8), r0 ! current_thread_info->flags |
| 362 | tst #_TIF_ALLWORK_MASK, r0 | 366 | tst #(_TIF_ALLWORK_MASK & 0xff), r0 |
| 367 | mov #(_TIF_ALLWORK_MASK >> 8), r1 | ||
| 368 | bf syscall_exit_work | ||
| 369 | shlr8 r0 | ||
| 370 | tst r0, r1 | ||
| 363 | bf syscall_exit_work | 371 | bf syscall_exit_work |
| 364 | bra __restore_all | 372 | bra __restore_all |
| 365 | nop | 373 | nop |
diff --git a/arch/sh/kernel/ftrace.c b/arch/sh/kernel/ftrace.c index 066f37dc32a9..6647dfcb781d 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 | ||
| 22 | static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE]; | 26 | static unsigned char ftrace_replaced_code[MCOUNT_INSN_SIZE]; |
| 23 | 27 | ||
| 24 | static unsigned char ftrace_nop[4]; | 28 | static unsigned char ftrace_nop[4]; |
| @@ -131,3 +135,189 @@ 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 | ||
| 142 | extern void ftrace_graph_call(void); | ||
| 143 | |||
| 144 | static 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 | |||
| 159 | int 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 | |||
| 170 | int 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 | */ | ||
| 199 | void 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(¤t->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 | |||
| 261 | extern unsigned long __start_syscalls_metadata[]; | ||
| 262 | extern unsigned long __stop_syscalls_metadata[]; | ||
| 263 | extern unsigned long *sys_call_table; | ||
| 264 | |||
| 265 | static struct syscall_metadata **syscalls_metadata; | ||
| 266 | |||
| 267 | static 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 | |||
| 286 | #define FTRACE_SYSCALL_MAX (NR_syscalls - 1) | ||
| 287 | |||
| 288 | struct syscall_metadata *syscall_nr_to_meta(int nr) | ||
| 289 | { | ||
| 290 | if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0) | ||
| 291 | return NULL; | ||
| 292 | |||
| 293 | return syscalls_metadata[nr]; | ||
| 294 | } | ||
| 295 | |||
| 296 | void arch_init_ftrace_syscalls(void) | ||
| 297 | { | ||
| 298 | int i; | ||
| 299 | struct syscall_metadata *meta; | ||
| 300 | unsigned long **psys_syscall_table = &sys_call_table; | ||
| 301 | static atomic_t refs; | ||
| 302 | |||
| 303 | if (atomic_inc_return(&refs) != 1) | ||
| 304 | goto end; | ||
| 305 | |||
| 306 | syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * | ||
| 307 | FTRACE_SYSCALL_MAX, GFP_KERNEL); | ||
| 308 | if (!syscalls_metadata) { | ||
| 309 | WARN_ON(1); | ||
| 310 | return; | ||
| 311 | } | ||
| 312 | |||
| 313 | for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { | ||
| 314 | meta = find_syscall_meta(psys_syscall_table[i]); | ||
| 315 | syscalls_metadata[i] = meta; | ||
| 316 | } | ||
| 317 | return; | ||
| 318 | |||
| 319 | /* Paranoid: avoid overflow */ | ||
| 320 | end: | ||
| 321 | atomic_dec(&refs); | ||
| 322 | } | ||
| 323 | #endif /* CONFIG_FTRACE_SYSCALLS */ | ||
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c index 3d09062f4682..278c68c60488 100644 --- a/arch/sh/kernel/irq.c +++ b/arch/sh/kernel/irq.c | |||
| @@ -114,23 +114,6 @@ asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) | |||
| 114 | #endif | 114 | #endif |
| 115 | 115 | ||
| 116 | irq_enter(); | 116 | irq_enter(); |
| 117 | |||
| 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)); | 117 | irq = irq_demux(intc_evt2irq(irq)); |
| 135 | 118 | ||
| 136 | #ifdef CONFIG_IRQSTACKS | 119 | #ifdef CONFIG_IRQSTACKS |
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 92d7740faab1..9fee977f176b 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> |
| @@ -264,8 +265,8 @@ static void ubc_set_tracing(int asid, unsigned long pc) | |||
| 264 | * switch_to(x,y) should switch tasks from x to y. | 265 | * switch_to(x,y) should switch tasks from x to y. |
| 265 | * | 266 | * |
| 266 | */ | 267 | */ |
| 267 | struct task_struct *__switch_to(struct task_struct *prev, | 268 | __notrace_funcgraph struct task_struct * |
| 268 | struct task_struct *next) | 269 | __switch_to(struct task_struct *prev, struct task_struct *next) |
| 269 | { | 270 | { |
| 270 | #if defined(CONFIG_SH_FPU) | 271 | #if defined(CONFIG_SH_FPU) |
| 271 | unlazy_fpu(prev, task_pt_regs(prev)); | 272 | unlazy_fpu(prev, task_pt_regs(prev)); |
diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 3392e835a374..c198eceaee94 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c | |||
| @@ -34,6 +34,8 @@ | |||
| 34 | #include <asm/syscalls.h> | 34 | #include <asm/syscalls.h> |
| 35 | #include <asm/fpu.h> | 35 | #include <asm/fpu.h> |
| 36 | 36 | ||
| 37 | #include <trace/syscall.h> | ||
| 38 | |||
| 37 | /* | 39 | /* |
| 38 | * This routine will get a word off of the process kernel stack. | 40 | * This routine will get a word off of the process kernel stack. |
| 39 | */ | 41 | */ |
| @@ -459,6 +461,9 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) | |||
| 459 | */ | 461 | */ |
| 460 | ret = -1L; | 462 | ret = -1L; |
| 461 | 463 | ||
| 464 | if (unlikely(test_thread_flag(TIF_SYSCALL_FTRACE))) | ||
| 465 | ftrace_syscall_enter(regs); | ||
| 466 | |||
| 462 | if (unlikely(current->audit_context)) | 467 | if (unlikely(current->audit_context)) |
| 463 | audit_syscall_entry(audit_arch(), regs->regs[3], | 468 | audit_syscall_entry(audit_arch(), regs->regs[3], |
| 464 | regs->regs[4], regs->regs[5], | 469 | regs->regs[4], regs->regs[5], |
| @@ -475,6 +480,9 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) | |||
| 475 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), | 480 | audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), |
| 476 | regs->regs[0]); | 481 | regs->regs[0]); |
| 477 | 482 | ||
| 483 | if (unlikely(test_thread_flag(TIF_SYSCALL_FTRACE))) | ||
| 484 | ftrace_syscall_exit(regs); | ||
| 485 | |||
| 478 | step = test_thread_flag(TIF_SINGLESTEP); | 486 | step = test_thread_flag(TIF_SINGLESTEP); |
| 479 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) | 487 | if (step || test_thread_flag(TIF_SYSCALL_TRACE)) |
| 480 | tracehook_report_syscall_exit(regs, step); | 488 | tracehook_report_syscall_exit(regs, step); |
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c index dd38338553ef..ceb409bf7741 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> |
| @@ -233,39 +234,45 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn, | |||
| 233 | void __init setup_bootmem_allocator(unsigned long free_pfn) | 234 | void __init setup_bootmem_allocator(unsigned long free_pfn) |
| 234 | { | 235 | { |
| 235 | unsigned long bootmap_size; | 236 | unsigned long bootmap_size; |
| 237 | unsigned long bootmap_pages, bootmem_paddr; | ||
| 238 | u64 total_pages = (lmb_end_of_DRAM() - __MEMORY_START) >> PAGE_SHIFT; | ||
| 239 | int i; | ||
| 240 | |||
| 241 | bootmap_pages = bootmem_bootmap_pages(total_pages); | ||
| 242 | |||
| 243 | bootmem_paddr = lmb_alloc(bootmap_pages << PAGE_SHIFT, PAGE_SIZE); | ||
| 236 | 244 | ||
| 237 | /* | 245 | /* |
| 238 | * Find a proper area for the bootmem bitmap. After this | 246 | * Find a proper area for the bootmem bitmap. After this |
| 239 | * bootstrap step all allocations (until the page allocator | 247 | * bootstrap step all allocations (until the page allocator |
| 240 | * is intact) must be done via bootmem_alloc(). | 248 | * is intact) must be done via bootmem_alloc(). |
| 241 | */ | 249 | */ |
| 242 | bootmap_size = init_bootmem_node(NODE_DATA(0), free_pfn, | 250 | bootmap_size = init_bootmem_node(NODE_DATA(0), |
| 251 | bootmem_paddr >> PAGE_SHIFT, | ||
| 243 | min_low_pfn, max_low_pfn); | 252 | min_low_pfn, max_low_pfn); |
| 244 | 253 | ||
| 245 | __add_active_range(0, min_low_pfn, max_low_pfn); | 254 | /* Add active regions with valid PFNs. */ |
| 246 | register_bootmem_low_pages(); | 255 | for (i = 0; i < lmb.memory.cnt; i++) { |
| 247 | 256 | unsigned long start_pfn, end_pfn; | |
| 248 | node_set_online(0); | 257 | start_pfn = lmb.memory.region[i].base >> PAGE_SHIFT; |
| 258 | end_pfn = start_pfn + lmb_size_pages(&lmb.memory, i); | ||
| 259 | __add_active_range(0, start_pfn, end_pfn); | ||
| 260 | } | ||
| 249 | 261 | ||
| 250 | /* | 262 | /* |
| 251 | * Reserve the kernel text and | 263 | * Add all physical memory to the bootmem map and mark each |
| 252 | * Reserve the bootmem bitmap. We do this in two steps (first step | 264 | * 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 | */ | 265 | */ |
| 257 | reserve_bootmem(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, | 266 | 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 | 267 | ||
| 262 | /* | 268 | /* Reserve the sections we're already using. */ |
| 263 | * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. | 269 | for (i = 0; i < lmb.reserved.cnt; i++) |
| 264 | */ | 270 | reserve_bootmem(lmb.reserved.region[i].base, |
| 265 | if (CONFIG_ZERO_PAGE_OFFSET != 0) | 271 | lmb_size_bytes(&lmb.reserved, i), |
| 266 | reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET, | ||
| 267 | BOOTMEM_DEFAULT); | 272 | BOOTMEM_DEFAULT); |
| 268 | 273 | ||
| 274 | node_set_online(0); | ||
| 275 | |||
| 269 | sparse_memory_present_with_active_regions(0); | 276 | sparse_memory_present_with_active_regions(0); |
| 270 | 277 | ||
| 271 | #ifdef CONFIG_BLK_DEV_INITRD | 278 | #ifdef CONFIG_BLK_DEV_INITRD |
| @@ -296,12 +303,37 @@ void __init setup_bootmem_allocator(unsigned long free_pfn) | |||
| 296 | static void __init setup_memory(void) | 303 | static void __init setup_memory(void) |
| 297 | { | 304 | { |
| 298 | unsigned long start_pfn; | 305 | unsigned long start_pfn; |
| 306 | u64 base = min_low_pfn << PAGE_SHIFT; | ||
| 307 | u64 size = (max_low_pfn << PAGE_SHIFT) - base; | ||
| 299 | 308 | ||
| 300 | /* | 309 | /* |
| 301 | * Partially used pages are not usable - thus | 310 | * Partially used pages are not usable - thus |
| 302 | * we are rounding upwards: | 311 | * we are rounding upwards: |
| 303 | */ | 312 | */ |
| 304 | start_pfn = PFN_UP(__pa(_end)); | 313 | start_pfn = PFN_UP(__pa(_end)); |
| 314 | |||
| 315 | lmb_add(base, size); | ||
| 316 | |||
| 317 | /* | ||
| 318 | * Reserve the kernel text and | ||
| 319 | * Reserve the bootmem bitmap. We do this in two steps (first step | ||
| 320 | * was init_bootmem()), because this catches the (definitely buggy) | ||
| 321 | * case of us accidentally initializing the bootmem allocator with | ||
| 322 | * an invalid RAM area. | ||
| 323 | */ | ||
| 324 | lmb_reserve(__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET, | ||
| 325 | (PFN_PHYS(start_pfn) + PAGE_SIZE - 1) - | ||
| 326 | (__MEMORY_START + CONFIG_ZERO_PAGE_OFFSET)); | ||
| 327 | |||
| 328 | /* | ||
| 329 | * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET. | ||
| 330 | */ | ||
| 331 | if (CONFIG_ZERO_PAGE_OFFSET != 0) | ||
| 332 | lmb_reserve(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET); | ||
| 333 | |||
| 334 | lmb_analyze(); | ||
| 335 | lmb_dump_all(); | ||
| 336 | |||
| 305 | setup_bootmem_allocator(start_pfn); | 337 | setup_bootmem_allocator(start_pfn); |
| 306 | } | 338 | } |
| 307 | #else | 339 | #else |
| @@ -402,6 +434,7 @@ void __init setup_arch(char **cmdline_p) | |||
| 402 | nodes_clear(node_online_map); | 434 | nodes_clear(node_online_map); |
| 403 | 435 | ||
| 404 | /* Setup bootmem with available RAM */ | 436 | /* Setup bootmem with available RAM */ |
| 437 | lmb_init(); | ||
| 405 | setup_memory(); | 438 | setup_memory(); |
| 406 | sparse_init(); | 439 | sparse_init(); |
| 407 | 440 | ||
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c index fcc5de31f83b..cec610888e28 100644 --- a/arch/sh/kernel/sh_ksyms_32.c +++ b/arch/sh/kernel/sh_ksyms_32.c | |||
| @@ -106,8 +106,8 @@ EXPORT_SYMBOL(flush_dcache_page); | |||
| 106 | EXPORT_SYMBOL(clear_user_page); | 106 | EXPORT_SYMBOL(clear_user_page); |
| 107 | #endif | 107 | #endif |
| 108 | 108 | ||
| 109 | #ifdef CONFIG_FUNCTION_TRACER | 109 | #ifdef CONFIG_MCOUNT |
| 110 | EXPORT_SYMBOL(mcount); | 110 | DECLARE_EXPORT(mcount); |
| 111 | #endif | 111 | #endif |
| 112 | EXPORT_SYMBOL(csum_partial); | 112 | EXPORT_SYMBOL(csum_partial); |
| 113 | EXPORT_SYMBOL(csum_partial_copy_generic); | 113 | EXPORT_SYMBOL(csum_partial_copy_generic); |
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c index 9b352a1e3fb4..d2424b068b7b 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 */ |
| @@ -96,6 +97,7 @@ void __init time_init(void) | |||
| 96 | if (board_time_init) | 97 | if (board_time_init) |
| 97 | board_time_init(); | 98 | board_time_init(); |
| 98 | 99 | ||
| 100 | hwblk_init(); | ||
| 99 | clk_init(); | 101 | clk_init(); |
| 100 | 102 | ||
| 101 | rtc_sh_get_time(&xtime); | 103 | rtc_sh_get_time(&xtime); |
diff --git a/arch/sh/kernel/vmlinux.lds.S b/arch/sh/kernel/vmlinux.lds.S index f53c76acaede..674ed8feb8ae 100644 --- a/arch/sh/kernel/vmlinux.lds.S +++ b/arch/sh/kernel/vmlinux.lds.S | |||
| @@ -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,14 @@ 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 | . = ALIGN(PAGE_SIZE); /* Init code and data */ |
| 99 | .init.text : AT(ADDR(.init.text) - LOAD_OFFSET) { | 74 | __init_begin = .; |
| 100 | __init_begin = .; | 75 | INIT_TEXT_SECTION(PAGE_SIZE) |
| 101 | _sinittext = .; | 76 | INIT_DATA_SECTION(16) |
| 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 | |||
| 129 | #ifdef CONFIG_BLK_DEV_INITRD | ||
| 130 | . = ALIGN(PAGE_SIZE); | ||
| 131 | .init.ramfs : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { | ||
| 132 | __initramfs_start = .; | ||
| 133 | *(.init.ramfs) | ||
| 134 | __initramfs_end = .; | ||
| 135 | } | ||
| 136 | #endif | ||
| 137 | 77 | ||
| 138 | . = ALIGN(4); | 78 | . = ALIGN(4); |
| 139 | .machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) { | 79 | .machvec.init : AT(ADDR(.machvec.init) - LOAD_OFFSET) { |
| @@ -152,16 +92,11 @@ SECTIONS | |||
| 152 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA } | 92 | .exit.data : AT(ADDR(.exit.data) - LOAD_OFFSET) { EXIT_DATA } |
| 153 | 93 | ||
| 154 | . = ALIGN(PAGE_SIZE); | 94 | . = ALIGN(PAGE_SIZE); |
| 155 | .bss : AT(ADDR(.bss) - LOAD_OFFSET) { | 95 | __init_end = .; |
| 156 | __init_end = .; | 96 | BSS(PAGE_SIZE) |
| 157 | __bss_start = .; /* BSS */ | 97 | . = ALIGN(4); |
| 158 | *(.bss.page_aligned) | 98 | _ebss = .; /* uClinux MTD sucks */ |
| 159 | *(.bss) | 99 | _end = . ; |
| 160 | *(COMMON) | ||
| 161 | . = ALIGN(4); | ||
| 162 | _ebss = .; /* uClinux MTD sucks */ | ||
| 163 | _end = . ; | ||
| 164 | } | ||
| 165 | 100 | ||
| 166 | /* | 101 | /* |
| 167 | * When something in the kernel is NOT compiled as a module, the | 102 | * When something in the kernel is NOT compiled as a module, the |
| @@ -170,7 +105,7 @@ SECTIONS | |||
| 170 | * it's a module. | 105 | * it's a module. |
| 171 | */ | 106 | */ |
| 172 | /DISCARD/ : { | 107 | /DISCARD/ : { |
| 173 | *(.exitcall.exit) | 108 | EXIT_CALL |
| 174 | } | 109 | } |
| 175 | 110 | ||
| 176 | STABS_DEBUG | 111 | STABS_DEBUG |
diff --git a/arch/sh/lib/Makefile b/arch/sh/lib/Makefile index aaea580b65bb..c2b28d8b2dd1 100644 --- a/arch/sh/lib/Makefile +++ b/arch/sh/lib/Makefile | |||
| @@ -24,7 +24,7 @@ memcpy-y := memcpy.o | |||
| 24 | memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o | 24 | memcpy-$(CONFIG_CPU_SH4) := memcpy-sh4.o |
| 25 | 25 | ||
| 26 | lib-$(CONFIG_MMU) += copy_page.o clear_page.o | 26 | lib-$(CONFIG_MMU) += copy_page.o clear_page.o |
| 27 | lib-$(CONFIG_FUNCTION_TRACER) += mcount.o | 27 | lib-$(CONFIG_MCOUNT) += mcount.o |
| 28 | lib-y += $(memcpy-y) $(udivsi3-y) | 28 | lib-y += $(memcpy-y) $(udivsi3-y) |
| 29 | 29 | ||
| 30 | EXTRA_CFLAGS += -Werror | 30 | EXTRA_CFLAGS += -Werror |
diff --git a/arch/sh/lib/mcount.S b/arch/sh/lib/mcount.S index 110fbfe1831f..84a57761f17e 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; \ | ||
| 77 | 1: | ||
| 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: |
| 37 | mcount: | 88 | mcount: |
| 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 | |||
| 129 | 1: | ||
| 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 | ||
| 55 | skip_trace: | 151 | skip_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 | ||
| 165 | ftrace_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 |
| 64 | ftrace_caller: | 176 | ftrace_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: | |||
| 88 | ftrace_stub: | 213 | ftrace_stub: |
| 89 | rts | 214 | rts |
| 90 | nop | 215 | nop |
| 216 | |||
| 217 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
| 218 | .globl ftrace_graph_caller | ||
| 219 | ftrace_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 | ||
| 228 | 1: | ||
| 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 | ||
| 245 | 2: .long function_trace_stop | ||
| 246 | 3: .long skip_trace | ||
| 247 | .Lprepare_ftrace_return: | ||
| 248 | .long prepare_ftrace_return | ||
| 249 | |||
| 250 | .globl return_to_handler | ||
| 251 | return_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 | ||
| 282 | stack_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/mm/fault_32.c b/arch/sh/mm/fault_32.c index 71925946f1e1..dbbdeba2cee5 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 | ||
| 38 | static 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 | */ | ||
| 79 | static 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 area: */ | ||
| 86 | if (!(address >= VMALLOC_START && address < VMALLOC_END)) | ||
| 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 | |||
| 108 | static 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 | */ | ||
| 139 | good_area: | 185 | good_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 | */ |
| 180 | bad_area: | 226 | bad_area: |
| 181 | up_read(&mm->mmap_sem); | 227 | up_read(&mm->mmap_sem); |
| 182 | 228 | ||
diff --git a/arch/sh/mm/numa.c b/arch/sh/mm/numa.c index 095d93bec7cd..9b784fdb947c 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); | |||
| 26 | void __init setup_memory(void) | 27 | void __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 | ||
| 46 | void __init setup_bootmem_node(int nid, unsigned long start, unsigned long end) | 56 | void __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/x86/include/asm/io_apic.h b/arch/x86/include/asm/io_apic.h index daf866ed0612..330ee807f89e 100644 --- a/arch/x86/include/asm/io_apic.h +++ b/arch/x86/include/asm/io_apic.h | |||
| @@ -161,6 +161,7 @@ extern int io_apic_set_pci_routing(struct device *dev, int irq, | |||
| 161 | struct io_apic_irq_attr *irq_attr); | 161 | struct io_apic_irq_attr *irq_attr); |
| 162 | extern int (*ioapic_renumber_irq)(int ioapic, int irq); | 162 | extern int (*ioapic_renumber_irq)(int ioapic, int irq); |
| 163 | extern void ioapic_init_mappings(void); | 163 | extern void ioapic_init_mappings(void); |
| 164 | extern void ioapic_insert_resources(void); | ||
| 164 | 165 | ||
| 165 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); | 166 | extern struct IO_APIC_route_entry **alloc_ioapic_entries(void); |
| 166 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); | 167 | extern void free_ioapic_entries(struct IO_APIC_route_entry **ioapic_entries); |
| @@ -180,6 +181,7 @@ extern void ioapic_write_entry(int apic, int pin, | |||
| 180 | #define io_apic_assign_pci_irqs 0 | 181 | #define io_apic_assign_pci_irqs 0 |
| 181 | static const int timer_through_8259 = 0; | 182 | static const int timer_through_8259 = 0; |
| 182 | static inline void ioapic_init_mappings(void) { } | 183 | static inline void ioapic_init_mappings(void) { } |
| 184 | static inline void ioapic_insert_resources(void) { } | ||
| 183 | 185 | ||
| 184 | static inline void probe_nr_irqs_gsi(void) { } | 186 | static inline void probe_nr_irqs_gsi(void) { } |
| 185 | #endif | 187 | #endif |
diff --git a/arch/x86/include/asm/lguest_hcall.h b/arch/x86/include/asm/lguest_hcall.h index d31c4a684078..33600a66755f 100644 --- a/arch/x86/include/asm/lguest_hcall.h +++ b/arch/x86/include/asm/lguest_hcall.h | |||
| @@ -30,7 +30,7 @@ | |||
| 30 | #include <asm/hw_irq.h> | 30 | #include <asm/hw_irq.h> |
| 31 | #include <asm/kvm_para.h> | 31 | #include <asm/kvm_para.h> |
| 32 | 32 | ||
| 33 | /*G:031 But first, how does our Guest contact the Host to ask for privileged | 33 | /*G:030 But first, how does our Guest contact the Host to ask for privileged |
| 34 | * operations? There are two ways: the direct way is to make a "hypercall", | 34 | * operations? There are two ways: the direct way is to make a "hypercall", |
| 35 | * to make requests of the Host Itself. | 35 | * to make requests of the Host Itself. |
| 36 | * | 36 | * |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 90b5e6efa938..2284a4812b68 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
| @@ -4181,28 +4181,20 @@ fake_ioapic_page: | |||
| 4181 | } | 4181 | } |
| 4182 | } | 4182 | } |
| 4183 | 4183 | ||
| 4184 | static int __init ioapic_insert_resources(void) | 4184 | void __init ioapic_insert_resources(void) |
| 4185 | { | 4185 | { |
| 4186 | int i; | 4186 | int i; |
| 4187 | struct resource *r = ioapic_resources; | 4187 | struct resource *r = ioapic_resources; |
| 4188 | 4188 | ||
| 4189 | if (!r) { | 4189 | if (!r) { |
| 4190 | if (nr_ioapics > 0) { | 4190 | if (nr_ioapics > 0) |
| 4191 | printk(KERN_ERR | 4191 | printk(KERN_ERR |
| 4192 | "IO APIC resources couldn't be allocated.\n"); | 4192 | "IO APIC resources couldn't be allocated.\n"); |
| 4193 | return -1; | 4193 | return; |
| 4194 | } | ||
| 4195 | return 0; | ||
| 4196 | } | 4194 | } |
| 4197 | 4195 | ||
| 4198 | for (i = 0; i < nr_ioapics; i++) { | 4196 | for (i = 0; i < nr_ioapics; i++) { |
| 4199 | insert_resource(&iomem_resource, r); | 4197 | insert_resource(&iomem_resource, r); |
| 4200 | r++; | 4198 | r++; |
| 4201 | } | 4199 | } |
| 4202 | |||
| 4203 | return 0; | ||
| 4204 | } | 4200 | } |
| 4205 | |||
| 4206 | /* Insert the IO APIC resources after PCI initialization has occured to handle | ||
| 4207 | * IO APICS that are mapped in on a BAR in PCI space. */ | ||
| 4208 | late_initcall(ioapic_insert_resources); | ||
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 7bc65f0f62c4..f2bf1f73d468 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
| @@ -379,6 +379,11 @@ static void lguest_cpuid(unsigned int *ax, unsigned int *bx, | |||
| 379 | 379 | ||
| 380 | native_cpuid(ax, bx, cx, dx); | 380 | native_cpuid(ax, bx, cx, dx); |
| 381 | switch (function) { | 381 | switch (function) { |
| 382 | case 0: /* ID and highest CPUID. Futureproof a little by sticking to | ||
| 383 | * older ones. */ | ||
| 384 | if (*ax > 5) | ||
| 385 | *ax = 5; | ||
| 386 | break; | ||
| 382 | case 1: /* Basic feature request. */ | 387 | case 1: /* Basic feature request. */ |
| 383 | /* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */ | 388 | /* We only allow kernel to see SSE3, CMPXCHG16B and SSSE3 */ |
| 384 | *cx &= 0x00002201; | 389 | *cx &= 0x00002201; |
| @@ -1079,7 +1084,7 @@ static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf, | |||
| 1079 | return insn_len; | 1084 | return insn_len; |
| 1080 | } | 1085 | } |
| 1081 | 1086 | ||
| 1082 | /*G:030 Once we get to lguest_init(), we know we're a Guest. The various | 1087 | /*G:029 Once we get to lguest_init(), we know we're a Guest. The various |
| 1083 | * pv_ops structures in the kernel provide points for (almost) every routine we | 1088 | * pv_ops structures in the kernel provide points for (almost) every routine we |
| 1084 | * have to override to avoid privileged instructions. */ | 1089 | * have to override to avoid privileged instructions. */ |
| 1085 | __init void lguest_init(void) | 1090 | __init void lguest_init(void) |
diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c index 0fb56db16d18..52e62e57fedd 100644 --- a/arch/x86/pci/i386.c +++ b/arch/x86/pci/i386.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <asm/pat.h> | 35 | #include <asm/pat.h> |
| 36 | #include <asm/e820.h> | 36 | #include <asm/e820.h> |
| 37 | #include <asm/pci_x86.h> | 37 | #include <asm/pci_x86.h> |
| 38 | #include <asm/io_apic.h> | ||
| 38 | 39 | ||
| 39 | 40 | ||
| 40 | static int | 41 | static int |
| @@ -227,6 +228,12 @@ void __init pcibios_resource_survey(void) | |||
| 227 | pcibios_allocate_resources(1); | 228 | pcibios_allocate_resources(1); |
| 228 | 229 | ||
| 229 | e820_reserve_resources_late(); | 230 | e820_reserve_resources_late(); |
| 231 | /* | ||
| 232 | * Insert the IO APIC resources after PCI initialization has | ||
| 233 | * occured to handle IO APICS that are mapped in on a BAR in | ||
| 234 | * PCI space, but before trying to assign unassigned pci res. | ||
| 235 | */ | ||
| 236 | ioapic_insert_resources(); | ||
| 230 | } | 237 | } |
| 231 | 238 | ||
| 232 | /** | 239 | /** |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 43db3ea15b54..fbeefb68a31f 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
| @@ -213,7 +213,7 @@ static int virtblk_ioctl(struct block_device *bdev, fmode_t mode, | |||
| 213 | * Only allow the generic SCSI ioctls if the host can support it. | 213 | * Only allow the generic SCSI ioctls if the host can support it. |
| 214 | */ | 214 | */ |
| 215 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) | 215 | if (!virtio_has_feature(vblk->vdev, VIRTIO_BLK_F_SCSI)) |
| 216 | return -ENOIOCTLCMD; | 216 | return -ENOTTY; |
| 217 | 217 | ||
| 218 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); | 218 | return scsi_cmd_ioctl(disk->queue, disk, mode, cmd, argp); |
| 219 | } | 219 | } |
| @@ -360,6 +360,9 @@ static int __devinit virtblk_probe(struct virtio_device *vdev) | |||
| 360 | blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2); | 360 | blk_queue_max_phys_segments(vblk->disk->queue, vblk->sg_elems-2); |
| 361 | blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2); | 361 | blk_queue_max_hw_segments(vblk->disk->queue, vblk->sg_elems-2); |
| 362 | 362 | ||
| 363 | /* No need to bounce any requests */ | ||
| 364 | blk_queue_bounce_limit(vblk->disk->queue, BLK_BOUNCE_ANY); | ||
| 365 | |||
| 363 | /* No real sector limit. */ | 366 | /* No real sector limit. */ |
| 364 | blk_queue_max_sectors(vblk->disk->queue, -1U); | 367 | blk_queue_max_sectors(vblk->disk->queue, -1U); |
| 365 | 368 | ||
diff --git a/drivers/char/tty_port.c b/drivers/char/tty_port.c index 4e862a75f7ff..9769b1149f76 100644 --- a/drivers/char/tty_port.c +++ b/drivers/char/tty_port.c | |||
| @@ -267,7 +267,7 @@ int tty_port_block_til_ready(struct tty_port *port, | |||
| 267 | if (retval == 0) | 267 | if (retval == 0) |
| 268 | port->flags |= ASYNC_NORMAL_ACTIVE; | 268 | port->flags |= ASYNC_NORMAL_ACTIVE; |
| 269 | spin_unlock_irqrestore(&port->lock, flags); | 269 | spin_unlock_irqrestore(&port->lock, flags); |
| 270 | return 0; | 270 | return retval; |
| 271 | 271 | ||
| 272 | } | 272 | } |
| 273 | EXPORT_SYMBOL(tty_port_block_til_ready); | 273 | EXPORT_SYMBOL(tty_port_block_til_ready); |
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2960b6d73456..9903f270e440 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c | |||
| @@ -101,6 +101,10 @@ int drm_debugfs_create_files(struct drm_info_list *files, int count, | |||
| 101 | continue; | 101 | continue; |
| 102 | 102 | ||
| 103 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); | 103 | tmp = kmalloc(sizeof(struct drm_info_node), GFP_KERNEL); |
| 104 | if (tmp == NULL) { | ||
| 105 | ret = -1; | ||
| 106 | goto fail; | ||
| 107 | } | ||
| 104 | ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, | 108 | ent = debugfs_create_file(files[i].name, S_IFREG | S_IRUGO, |
| 105 | root, tmp, &drm_debugfs_fops); | 109 | root, tmp, &drm_debugfs_fops); |
| 106 | if (!ent) { | 110 | if (!ent) { |
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 8104ecaea26f..ffe8f4394d50 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c | |||
| @@ -134,26 +134,29 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size) | |||
| 134 | BUG_ON((size & (PAGE_SIZE - 1)) != 0); | 134 | BUG_ON((size & (PAGE_SIZE - 1)) != 0); |
| 135 | 135 | ||
| 136 | obj = kzalloc(sizeof(*obj), GFP_KERNEL); | 136 | obj = kzalloc(sizeof(*obj), GFP_KERNEL); |
| 137 | if (!obj) | ||
| 138 | goto free; | ||
| 137 | 139 | ||
| 138 | obj->dev = dev; | 140 | obj->dev = dev; |
| 139 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); | 141 | obj->filp = shmem_file_setup("drm mm object", size, VM_NORESERVE); |
| 140 | if (IS_ERR(obj->filp)) { | 142 | if (IS_ERR(obj->filp)) |
| 141 | kfree(obj); | 143 | goto free; |
| 142 | return NULL; | ||
| 143 | } | ||
| 144 | 144 | ||
| 145 | kref_init(&obj->refcount); | 145 | kref_init(&obj->refcount); |
| 146 | kref_init(&obj->handlecount); | 146 | kref_init(&obj->handlecount); |
| 147 | obj->size = size; | 147 | obj->size = size; |
| 148 | if (dev->driver->gem_init_object != NULL && | 148 | if (dev->driver->gem_init_object != NULL && |
| 149 | dev->driver->gem_init_object(obj) != 0) { | 149 | dev->driver->gem_init_object(obj) != 0) { |
| 150 | fput(obj->filp); | 150 | goto fput; |
| 151 | kfree(obj); | ||
| 152 | return NULL; | ||
| 153 | } | 151 | } |
| 154 | atomic_inc(&dev->object_count); | 152 | atomic_inc(&dev->object_count); |
| 155 | atomic_add(obj->size, &dev->object_memory); | 153 | atomic_add(obj->size, &dev->object_memory); |
| 156 | return obj; | 154 | return obj; |
| 155 | fput: | ||
| 156 | fput(obj->filp); | ||
| 157 | free: | ||
| 158 | kfree(obj); | ||
| 159 | return NULL; | ||
| 157 | } | 160 | } |
| 158 | EXPORT_SYMBOL(drm_gem_object_alloc); | 161 | EXPORT_SYMBOL(drm_gem_object_alloc); |
| 159 | 162 | ||
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c index 155a5bbce680..55bb8a82d612 100644 --- a/drivers/gpu/drm/drm_stub.c +++ b/drivers/gpu/drm/drm_stub.c | |||
| @@ -489,7 +489,7 @@ int drm_put_minor(struct drm_minor **minor_p) | |||
| 489 | */ | 489 | */ |
| 490 | void drm_put_dev(struct drm_device *dev) | 490 | void drm_put_dev(struct drm_device *dev) |
| 491 | { | 491 | { |
| 492 | struct drm_driver *driver = dev->driver; | 492 | struct drm_driver *driver; |
| 493 | struct drm_map_list *r_list, *list_temp; | 493 | struct drm_map_list *r_list, *list_temp; |
| 494 | 494 | ||
| 495 | DRM_DEBUG("\n"); | 495 | DRM_DEBUG("\n"); |
| @@ -498,6 +498,7 @@ void drm_put_dev(struct drm_device *dev) | |||
| 498 | DRM_ERROR("cleanup called no dev\n"); | 498 | DRM_ERROR("cleanup called no dev\n"); |
| 499 | return; | 499 | return; |
| 500 | } | 500 | } |
| 501 | driver = dev->driver; | ||
| 501 | 502 | ||
| 502 | drm_vblank_cleanup(dev); | 503 | drm_vblank_cleanup(dev); |
| 503 | 504 | ||
diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c index 40b75032ea47..fe949a12fe40 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c | |||
| @@ -327,7 +327,7 @@ ssize_t ttm_bo_io(struct ttm_bo_device *bdev, struct file *filp, | |||
| 327 | goto out_unref; | 327 | goto out_unref; |
| 328 | 328 | ||
| 329 | kmap_offset = dev_offset - bo->vm_node->start; | 329 | kmap_offset = dev_offset - bo->vm_node->start; |
| 330 | if (unlikely(kmap_offset) >= bo->num_pages) { | 330 | if (unlikely(kmap_offset >= bo->num_pages)) { |
| 331 | ret = -EFBIG; | 331 | ret = -EFBIG; |
| 332 | goto out_unref; | 332 | goto out_unref; |
| 333 | } | 333 | } |
| @@ -401,7 +401,7 @@ ssize_t ttm_bo_fbdev_io(struct ttm_buffer_object *bo, const char __user *wbuf, | |||
| 401 | bool dummy; | 401 | bool dummy; |
| 402 | 402 | ||
| 403 | kmap_offset = (*f_pos >> PAGE_SHIFT); | 403 | kmap_offset = (*f_pos >> PAGE_SHIFT); |
| 404 | if (unlikely(kmap_offset) >= bo->num_pages) | 404 | if (unlikely(kmap_offset >= bo->num_pages)) |
| 405 | return -EFBIG; | 405 | return -EFBIG; |
| 406 | 406 | ||
| 407 | page_offset = *f_pos & ~PAGE_MASK; | 407 | page_offset = *f_pos & ~PAGE_MASK; |
diff --git a/drivers/gpu/drm/via/via_irq.c b/drivers/gpu/drm/via/via_irq.c index c248c1d37268..5935b8842e86 100644 --- a/drivers/gpu/drm/via/via_irq.c +++ b/drivers/gpu/drm/via/via_irq.c | |||
| @@ -183,7 +183,7 @@ int via_enable_vblank(struct drm_device *dev, int crtc) | |||
| 183 | } | 183 | } |
| 184 | 184 | ||
| 185 | status = VIA_READ(VIA_REG_INTERRUPT); | 185 | status = VIA_READ(VIA_REG_INTERRUPT); |
| 186 | VIA_WRITE(VIA_REG_INTERRUPT, status & VIA_IRQ_VBLANK_ENABLE); | 186 | VIA_WRITE(VIA_REG_INTERRUPT, status | VIA_IRQ_VBLANK_ENABLE); |
| 187 | 187 | ||
| 188 | VIA_WRITE8(0x83d4, 0x11); | 188 | VIA_WRITE8(0x83d4, 0x11); |
| 189 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); | 189 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) | 0x30); |
| @@ -194,6 +194,10 @@ int via_enable_vblank(struct drm_device *dev, int crtc) | |||
| 194 | void via_disable_vblank(struct drm_device *dev, int crtc) | 194 | void via_disable_vblank(struct drm_device *dev, int crtc) |
| 195 | { | 195 | { |
| 196 | drm_via_private_t *dev_priv = dev->dev_private; | 196 | drm_via_private_t *dev_priv = dev->dev_private; |
| 197 | u32 status; | ||
| 198 | |||
| 199 | status = VIA_READ(VIA_REG_INTERRUPT); | ||
| 200 | VIA_WRITE(VIA_REG_INTERRUPT, status & ~VIA_IRQ_VBLANK_ENABLE); | ||
| 197 | 201 | ||
| 198 | VIA_WRITE8(0x83d4, 0x11); | 202 | VIA_WRITE8(0x83d4, 0x11); |
| 199 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); | 203 | VIA_WRITE8(0x83d5, VIA_READ8(0x83d5) & ~0x30); |
diff --git a/drivers/lguest/lg.h b/drivers/lguest/lg.h index 9c3138265f8e..01c591923793 100644 --- a/drivers/lguest/lg.h +++ b/drivers/lguest/lg.h | |||
| @@ -38,8 +38,6 @@ struct lguest_pages | |||
| 38 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ | 38 | #define CHANGED_GDT_TLS 4 /* Actually a subset of CHANGED_GDT */ |
| 39 | #define CHANGED_ALL 3 | 39 | #define CHANGED_ALL 3 |
| 40 | 40 | ||
| 41 | struct lguest; | ||
| 42 | |||
| 43 | struct lg_cpu { | 41 | struct lg_cpu { |
| 44 | unsigned int id; | 42 | unsigned int id; |
| 45 | struct lguest *lg; | 43 | struct lguest *lg; |
diff --git a/drivers/usb/gadget/m66592-udc.c b/drivers/usb/gadget/m66592-udc.c index 43dcf9e1af6b..0dddd2f8ff35 100644 --- a/drivers/usb/gadget/m66592-udc.c +++ b/drivers/usb/gadget/m66592-udc.c | |||
| @@ -37,7 +37,7 @@ MODULE_LICENSE("GPL"); | |||
| 37 | MODULE_AUTHOR("Yoshihiro Shimoda"); | 37 | MODULE_AUTHOR("Yoshihiro Shimoda"); |
| 38 | MODULE_ALIAS("platform:m66592_udc"); | 38 | MODULE_ALIAS("platform:m66592_udc"); |
| 39 | 39 | ||
| 40 | #define DRIVER_VERSION "18 Oct 2007" | 40 | #define DRIVER_VERSION "26 Jun 2009" |
| 41 | 41 | ||
| 42 | /* module parameters */ | 42 | /* module parameters */ |
| 43 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) | 43 | #if defined(CONFIG_SUPERH_BUILT_IN_M66592) |
| @@ -276,24 +276,27 @@ static int pipe_buffer_setting(struct m66592 *m66592, | |||
| 276 | buf_bsize = 0; | 276 | buf_bsize = 0; |
| 277 | break; | 277 | break; |
| 278 | case M66592_BULK: | 278 | case M66592_BULK: |
| 279 | bufnum = m66592->bi_bufnum + | 279 | /* isochronous pipes may be used as bulk pipes */ |
| 280 | (info->pipe - M66592_BASE_PIPENUM_BULK) * 16; | 280 | if (info->pipe > M66592_BASE_PIPENUM_BULK) |
| 281 | m66592->bi_bufnum += 16; | 281 | bufnum = info->pipe - M66592_BASE_PIPENUM_BULK; |
| 282 | else | ||
| 283 | bufnum = info->pipe - M66592_BASE_PIPENUM_ISOC; | ||
| 284 | |||
| 285 | bufnum = M66592_BASE_BUFNUM + (bufnum * 16); | ||
| 282 | buf_bsize = 7; | 286 | buf_bsize = 7; |
| 283 | pipecfg |= M66592_DBLB; | 287 | pipecfg |= M66592_DBLB; |
| 284 | if (!info->dir_in) | 288 | if (!info->dir_in) |
| 285 | pipecfg |= M66592_SHTNAK; | 289 | pipecfg |= M66592_SHTNAK; |
| 286 | break; | 290 | break; |
| 287 | case M66592_ISO: | 291 | case M66592_ISO: |
| 288 | bufnum = m66592->bi_bufnum + | 292 | bufnum = M66592_BASE_BUFNUM + |
| 289 | (info->pipe - M66592_BASE_PIPENUM_ISOC) * 16; | 293 | (info->pipe - M66592_BASE_PIPENUM_ISOC) * 16; |
| 290 | m66592->bi_bufnum += 16; | ||
| 291 | buf_bsize = 7; | 294 | buf_bsize = 7; |
| 292 | break; | 295 | break; |
| 293 | } | 296 | } |
| 294 | if (m66592->bi_bufnum > M66592_MAX_BUFNUM) { | 297 | |
| 295 | pr_err("m66592 pipe memory is insufficient(%d)\n", | 298 | if (buf_bsize && ((bufnum + 16) >= M66592_MAX_BUFNUM)) { |
| 296 | m66592->bi_bufnum); | 299 | pr_err("m66592 pipe memory is insufficient\n"); |
| 297 | return -ENOMEM; | 300 | return -ENOMEM; |
| 298 | } | 301 | } |
| 299 | 302 | ||
| @@ -313,17 +316,6 @@ static void pipe_buffer_release(struct m66592 *m66592, | |||
| 313 | if (info->pipe == 0) | 316 | if (info->pipe == 0) |
| 314 | return; | 317 | return; |
| 315 | 318 | ||
| 316 | switch (info->type) { | ||
| 317 | case M66592_BULK: | ||
| 318 | if (is_bulk_pipe(info->pipe)) | ||
| 319 | m66592->bi_bufnum -= 16; | ||
| 320 | break; | ||
| 321 | case M66592_ISO: | ||
| 322 | if (is_isoc_pipe(info->pipe)) | ||
| 323 | m66592->bi_bufnum -= 16; | ||
| 324 | break; | ||
| 325 | } | ||
| 326 | |||
| 327 | if (is_bulk_pipe(info->pipe)) { | 319 | if (is_bulk_pipe(info->pipe)) { |
| 328 | m66592->bulk--; | 320 | m66592->bulk--; |
| 329 | } else if (is_interrupt_pipe(info->pipe)) | 321 | } else if (is_interrupt_pipe(info->pipe)) |
| @@ -1603,8 +1595,6 @@ static int __init m66592_probe(struct platform_device *pdev) | |||
| 1603 | m66592->timer.data = (unsigned long)m66592; | 1595 | m66592->timer.data = (unsigned long)m66592; |
| 1604 | m66592->reg = reg; | 1596 | m66592->reg = reg; |
| 1605 | 1597 | ||
| 1606 | m66592->bi_bufnum = M66592_BASE_BUFNUM; | ||
| 1607 | |||
| 1608 | ret = request_irq(irq, m66592_irq, IRQF_DISABLED | IRQF_SHARED, | 1598 | ret = request_irq(irq, m66592_irq, IRQF_DISABLED | IRQF_SHARED, |
| 1609 | udc_name, m66592); | 1599 | udc_name, m66592); |
| 1610 | if (ret < 0) { | 1600 | if (ret < 0) { |
diff --git a/drivers/usb/gadget/m66592-udc.h b/drivers/usb/gadget/m66592-udc.h index 286ce07e7960..9a9c2bf9fbd5 100644 --- a/drivers/usb/gadget/m66592-udc.h +++ b/drivers/usb/gadget/m66592-udc.h | |||
| @@ -506,7 +506,6 @@ struct m66592 { | |||
| 506 | int interrupt; | 506 | int interrupt; |
| 507 | int isochronous; | 507 | int isochronous; |
| 508 | int num_dma; | 508 | int num_dma; |
| 509 | int bi_bufnum; /* bulk and isochronous's bufnum */ | ||
| 510 | }; | 509 | }; |
| 511 | 510 | ||
| 512 | #define gadget_to_m66592(_gadget) container_of(_gadget, struct m66592, gadget) | 511 | #define gadget_to_m66592(_gadget) container_of(_gadget, struct m66592, gadget) |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1a920c70b5a1..f21ca7d27a43 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
| @@ -336,13 +336,6 @@ config USB_R8A66597_HCD | |||
| 336 | To compile this driver as a module, choose M here: the | 336 | To compile this driver as a module, choose M here: the |
| 337 | module will be called r8a66597-hcd. | 337 | module will be called r8a66597-hcd. |
| 338 | 338 | ||
| 339 | config SUPERH_ON_CHIP_R8A66597 | ||
| 340 | boolean "Enable SuperH on-chip R8A66597 USB" | ||
| 341 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7724) | ||
| 342 | help | ||
| 343 | This driver enables support for the on-chip R8A66597 in the | ||
| 344 | SH7366, SH7723 and SH7724 processors. | ||
| 345 | |||
| 346 | config USB_WHCI_HCD | 339 | config USB_WHCI_HCD |
| 347 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" | 340 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" |
| 348 | depends on EXPERIMENTAL | 341 | depends on EXPERIMENTAL |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index e18f74946e68..82dce3e0d4d7 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
| @@ -91,43 +91,43 @@ static int r8a66597_clock_enable(struct r8a66597 *r8a66597) | |||
| 91 | u16 tmp; | 91 | u16 tmp; |
| 92 | int i = 0; | 92 | int i = 0; |
| 93 | 93 | ||
| 94 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | 94 | if (r8a66597->pdata->on_chip) { |
| 95 | #if defined(CONFIG_HAVE_CLK) | 95 | #ifdef CONFIG_HAVE_CLK |
| 96 | clk_enable(r8a66597->clk); | 96 | clk_enable(r8a66597->clk); |
| 97 | #endif | 97 | #endif |
| 98 | do { | 98 | do { |
| 99 | r8a66597_write(r8a66597, SCKE, SYSCFG0); | 99 | r8a66597_write(r8a66597, SCKE, SYSCFG0); |
| 100 | tmp = r8a66597_read(r8a66597, SYSCFG0); | 100 | tmp = r8a66597_read(r8a66597, SYSCFG0); |
| 101 | if (i++ > 1000) { | 101 | if (i++ > 1000) { |
| 102 | printk(KERN_ERR "r8a66597: register access fail.\n"); | 102 | printk(KERN_ERR "r8a66597: reg access fail.\n"); |
| 103 | return -ENXIO; | 103 | return -ENXIO; |
| 104 | } | 104 | } |
| 105 | } while ((tmp & SCKE) != SCKE); | 105 | } while ((tmp & SCKE) != SCKE); |
| 106 | r8a66597_write(r8a66597, 0x04, 0x02); | 106 | r8a66597_write(r8a66597, 0x04, 0x02); |
| 107 | #else | 107 | } else { |
| 108 | do { | 108 | do { |
| 109 | r8a66597_write(r8a66597, USBE, SYSCFG0); | 109 | r8a66597_write(r8a66597, USBE, SYSCFG0); |
| 110 | tmp = r8a66597_read(r8a66597, SYSCFG0); | 110 | tmp = r8a66597_read(r8a66597, SYSCFG0); |
| 111 | if (i++ > 1000) { | 111 | if (i++ > 1000) { |
| 112 | printk(KERN_ERR "r8a66597: register access fail.\n"); | 112 | printk(KERN_ERR "r8a66597: reg access fail.\n"); |
| 113 | return -ENXIO; | 113 | return -ENXIO; |
| 114 | } | 114 | } |
| 115 | } while ((tmp & USBE) != USBE); | 115 | } while ((tmp & USBE) != USBE); |
| 116 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); | 116 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); |
| 117 | r8a66597_mdfy(r8a66597, get_xtal_from_pdata(r8a66597->pdata), XTAL, | 117 | r8a66597_mdfy(r8a66597, get_xtal_from_pdata(r8a66597->pdata), |
| 118 | SYSCFG0); | 118 | XTAL, SYSCFG0); |
| 119 | 119 | ||
| 120 | i = 0; | 120 | i = 0; |
| 121 | r8a66597_bset(r8a66597, XCKE, SYSCFG0); | 121 | r8a66597_bset(r8a66597, XCKE, SYSCFG0); |
| 122 | do { | 122 | do { |
| 123 | msleep(1); | 123 | msleep(1); |
| 124 | tmp = r8a66597_read(r8a66597, SYSCFG0); | 124 | tmp = r8a66597_read(r8a66597, SYSCFG0); |
| 125 | if (i++ > 500) { | 125 | if (i++ > 500) { |
| 126 | printk(KERN_ERR "r8a66597: register access fail.\n"); | 126 | printk(KERN_ERR "r8a66597: reg access fail.\n"); |
| 127 | return -ENXIO; | 127 | return -ENXIO; |
| 128 | } | 128 | } |
| 129 | } while ((tmp & SCKE) != SCKE); | 129 | } while ((tmp & SCKE) != SCKE); |
| 130 | #endif /* #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) */ | 130 | } |
| 131 | 131 | ||
| 132 | return 0; | 132 | return 0; |
| 133 | } | 133 | } |
| @@ -136,15 +136,16 @@ static void r8a66597_clock_disable(struct r8a66597 *r8a66597) | |||
| 136 | { | 136 | { |
| 137 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); | 137 | r8a66597_bclr(r8a66597, SCKE, SYSCFG0); |
| 138 | udelay(1); | 138 | udelay(1); |
| 139 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | 139 | |
| 140 | #if defined(CONFIG_HAVE_CLK) | 140 | if (r8a66597->pdata->on_chip) { |
| 141 | clk_disable(r8a66597->clk); | 141 | #ifdef CONFIG_HAVE_CLK |
| 142 | #endif | 142 | clk_disable(r8a66597->clk); |
| 143 | #else | ||
| 144 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); | ||
| 145 | r8a66597_bclr(r8a66597, XCKE, SYSCFG0); | ||
| 146 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); | ||
| 147 | #endif | 143 | #endif |
| 144 | } else { | ||
| 145 | r8a66597_bclr(r8a66597, PLLC, SYSCFG0); | ||
| 146 | r8a66597_bclr(r8a66597, XCKE, SYSCFG0); | ||
| 147 | r8a66597_bclr(r8a66597, USBE, SYSCFG0); | ||
| 148 | } | ||
| 148 | } | 149 | } |
| 149 | 150 | ||
| 150 | static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) | 151 | static void r8a66597_enable_port(struct r8a66597 *r8a66597, int port) |
| @@ -205,7 +206,7 @@ static int enable_controller(struct r8a66597 *r8a66597) | |||
| 205 | 206 | ||
| 206 | r8a66597_bset(r8a66597, SIGNE | SACKE, INTENB1); | 207 | r8a66597_bset(r8a66597, SIGNE | SACKE, INTENB1); |
| 207 | 208 | ||
| 208 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) | 209 | for (port = 0; port < r8a66597->max_root_hub; port++) |
| 209 | r8a66597_enable_port(r8a66597, port); | 210 | r8a66597_enable_port(r8a66597, port); |
| 210 | 211 | ||
| 211 | return 0; | 212 | return 0; |
| @@ -218,7 +219,7 @@ static void disable_controller(struct r8a66597 *r8a66597) | |||
| 218 | r8a66597_write(r8a66597, 0, INTENB0); | 219 | r8a66597_write(r8a66597, 0, INTENB0); |
| 219 | r8a66597_write(r8a66597, 0, INTSTS0); | 220 | r8a66597_write(r8a66597, 0, INTSTS0); |
| 220 | 221 | ||
| 221 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) | 222 | for (port = 0; port < r8a66597->max_root_hub; port++) |
| 222 | r8a66597_disable_port(r8a66597, port); | 223 | r8a66597_disable_port(r8a66597, port); |
| 223 | 224 | ||
| 224 | r8a66597_clock_disable(r8a66597); | 225 | r8a66597_clock_disable(r8a66597); |
| @@ -249,11 +250,12 @@ static int is_hub_limit(char *devpath) | |||
| 249 | return ((strlen(devpath) >= 4) ? 1 : 0); | 250 | return ((strlen(devpath) >= 4) ? 1 : 0); |
| 250 | } | 251 | } |
| 251 | 252 | ||
| 252 | static void get_port_number(char *devpath, u16 *root_port, u16 *hub_port) | 253 | static void get_port_number(struct r8a66597 *r8a66597, |
| 254 | char *devpath, u16 *root_port, u16 *hub_port) | ||
| 253 | { | 255 | { |
| 254 | if (root_port) { | 256 | if (root_port) { |
| 255 | *root_port = (devpath[0] & 0x0F) - 1; | 257 | *root_port = (devpath[0] & 0x0F) - 1; |
| 256 | if (*root_port >= R8A66597_MAX_ROOT_HUB) | 258 | if (*root_port >= r8a66597->max_root_hub) |
| 257 | printk(KERN_ERR "r8a66597: Illegal root port number.\n"); | 259 | printk(KERN_ERR "r8a66597: Illegal root port number.\n"); |
| 258 | } | 260 | } |
| 259 | if (hub_port) | 261 | if (hub_port) |
| @@ -355,7 +357,8 @@ static int make_r8a66597_device(struct r8a66597 *r8a66597, | |||
| 355 | INIT_LIST_HEAD(&dev->device_list); | 357 | INIT_LIST_HEAD(&dev->device_list); |
| 356 | list_add_tail(&dev->device_list, &r8a66597->child_device); | 358 | list_add_tail(&dev->device_list, &r8a66597->child_device); |
| 357 | 359 | ||
| 358 | get_port_number(urb->dev->devpath, &dev->root_port, &dev->hub_port); | 360 | get_port_number(r8a66597, urb->dev->devpath, |
| 361 | &dev->root_port, &dev->hub_port); | ||
| 359 | if (!is_child_device(urb->dev->devpath)) | 362 | if (!is_child_device(urb->dev->devpath)) |
| 360 | r8a66597->root_hub[dev->root_port].dev = dev; | 363 | r8a66597->root_hub[dev->root_port].dev = dev; |
| 361 | 364 | ||
| @@ -420,7 +423,7 @@ static void free_usb_address(struct r8a66597 *r8a66597, | |||
| 420 | list_del(&dev->device_list); | 423 | list_del(&dev->device_list); |
| 421 | kfree(dev); | 424 | kfree(dev); |
| 422 | 425 | ||
| 423 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) { | 426 | for (port = 0; port < r8a66597->max_root_hub; port++) { |
| 424 | if (r8a66597->root_hub[port].dev == dev) { | 427 | if (r8a66597->root_hub[port].dev == dev) { |
| 425 | r8a66597->root_hub[port].dev = NULL; | 428 | r8a66597->root_hub[port].dev = NULL; |
| 426 | break; | 429 | break; |
| @@ -495,10 +498,20 @@ static void r8a66597_pipe_toggle(struct r8a66597 *r8a66597, | |||
| 495 | r8a66597_bset(r8a66597, SQCLR, pipe->pipectr); | 498 | r8a66597_bset(r8a66597, SQCLR, pipe->pipectr); |
| 496 | } | 499 | } |
| 497 | 500 | ||
| 501 | static inline unsigned short mbw_value(struct r8a66597 *r8a66597) | ||
| 502 | { | ||
| 503 | if (r8a66597->pdata->on_chip) | ||
| 504 | return MBW_32; | ||
| 505 | else | ||
| 506 | return MBW_16; | ||
| 507 | } | ||
| 508 | |||
| 498 | /* this function must be called with interrupt disabled */ | 509 | /* this function must be called with interrupt disabled */ |
| 499 | static inline void cfifo_change(struct r8a66597 *r8a66597, u16 pipenum) | 510 | static inline void cfifo_change(struct r8a66597 *r8a66597, u16 pipenum) |
| 500 | { | 511 | { |
| 501 | r8a66597_mdfy(r8a66597, MBW | pipenum, MBW | CURPIPE, CFIFOSEL); | 512 | unsigned short mbw = mbw_value(r8a66597); |
| 513 | |||
| 514 | r8a66597_mdfy(r8a66597, mbw | pipenum, mbw | CURPIPE, CFIFOSEL); | ||
| 502 | r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, pipenum); | 515 | r8a66597_reg_wait(r8a66597, CFIFOSEL, CURPIPE, pipenum); |
| 503 | } | 516 | } |
| 504 | 517 | ||
| @@ -506,11 +519,13 @@ static inline void cfifo_change(struct r8a66597 *r8a66597, u16 pipenum) | |||
| 506 | static inline void fifo_change_from_pipe(struct r8a66597 *r8a66597, | 519 | static inline void fifo_change_from_pipe(struct r8a66597 *r8a66597, |
| 507 | struct r8a66597_pipe *pipe) | 520 | struct r8a66597_pipe *pipe) |
| 508 | { | 521 | { |
| 522 | unsigned short mbw = mbw_value(r8a66597); | ||
| 523 | |||
| 509 | cfifo_change(r8a66597, 0); | 524 | cfifo_change(r8a66597, 0); |
| 510 | r8a66597_mdfy(r8a66597, MBW | 0, MBW | CURPIPE, D0FIFOSEL); | 525 | r8a66597_mdfy(r8a66597, mbw | 0, mbw | CURPIPE, D0FIFOSEL); |
| 511 | r8a66597_mdfy(r8a66597, MBW | 0, MBW | CURPIPE, D1FIFOSEL); | 526 | r8a66597_mdfy(r8a66597, mbw | 0, mbw | CURPIPE, D1FIFOSEL); |
| 512 | 527 | ||
| 513 | r8a66597_mdfy(r8a66597, MBW | pipe->info.pipenum, MBW | CURPIPE, | 528 | r8a66597_mdfy(r8a66597, mbw | pipe->info.pipenum, mbw | CURPIPE, |
| 514 | pipe->fifosel); | 529 | pipe->fifosel); |
| 515 | r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, pipe->info.pipenum); | 530 | r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, pipe->info.pipenum); |
| 516 | } | 531 | } |
| @@ -742,9 +757,13 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, | |||
| 742 | struct r8a66597_pipe *pipe, | 757 | struct r8a66597_pipe *pipe, |
| 743 | struct urb *urb) | 758 | struct urb *urb) |
| 744 | { | 759 | { |
| 745 | #if !defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
| 746 | int i; | 760 | int i; |
| 747 | struct r8a66597_pipe_info *info = &pipe->info; | 761 | struct r8a66597_pipe_info *info = &pipe->info; |
| 762 | unsigned short mbw = mbw_value(r8a66597); | ||
| 763 | |||
| 764 | /* pipe dma is only for external controlles */ | ||
| 765 | if (r8a66597->pdata->on_chip) | ||
| 766 | return; | ||
| 748 | 767 | ||
| 749 | if ((pipe->info.pipenum != 0) && (info->type != R8A66597_INT)) { | 768 | if ((pipe->info.pipenum != 0) && (info->type != R8A66597_INT)) { |
| 750 | for (i = 0; i < R8A66597_MAX_DMA_CHANNEL; i++) { | 769 | for (i = 0; i < R8A66597_MAX_DMA_CHANNEL; i++) { |
| @@ -763,8 +782,8 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, | |||
| 763 | set_pipe_reg_addr(pipe, i); | 782 | set_pipe_reg_addr(pipe, i); |
| 764 | 783 | ||
| 765 | cfifo_change(r8a66597, 0); | 784 | cfifo_change(r8a66597, 0); |
| 766 | r8a66597_mdfy(r8a66597, MBW | pipe->info.pipenum, | 785 | r8a66597_mdfy(r8a66597, mbw | pipe->info.pipenum, |
| 767 | MBW | CURPIPE, pipe->fifosel); | 786 | mbw | CURPIPE, pipe->fifosel); |
| 768 | 787 | ||
| 769 | r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, | 788 | r8a66597_reg_wait(r8a66597, pipe->fifosel, CURPIPE, |
| 770 | pipe->info.pipenum); | 789 | pipe->info.pipenum); |
| @@ -772,7 +791,6 @@ static void enable_r8a66597_pipe_dma(struct r8a66597 *r8a66597, | |||
| 772 | break; | 791 | break; |
| 773 | } | 792 | } |
| 774 | } | 793 | } |
| 775 | #endif /* #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) */ | ||
| 776 | } | 794 | } |
| 777 | 795 | ||
| 778 | /* this function must be called with interrupt disabled */ | 796 | /* this function must be called with interrupt disabled */ |
| @@ -1769,7 +1787,7 @@ static void r8a66597_timer(unsigned long _r8a66597) | |||
| 1769 | 1787 | ||
| 1770 | spin_lock_irqsave(&r8a66597->lock, flags); | 1788 | spin_lock_irqsave(&r8a66597->lock, flags); |
| 1771 | 1789 | ||
| 1772 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) | 1790 | for (port = 0; port < r8a66597->max_root_hub; port++) |
| 1773 | r8a66597_root_hub_control(r8a66597, port); | 1791 | r8a66597_root_hub_control(r8a66597, port); |
| 1774 | 1792 | ||
| 1775 | spin_unlock_irqrestore(&r8a66597->lock, flags); | 1793 | spin_unlock_irqrestore(&r8a66597->lock, flags); |
| @@ -1807,7 +1825,7 @@ static void set_address_zero(struct r8a66597 *r8a66597, struct urb *urb) | |||
| 1807 | u16 root_port, hub_port; | 1825 | u16 root_port, hub_port; |
| 1808 | 1826 | ||
| 1809 | if (usb_address == 0) { | 1827 | if (usb_address == 0) { |
| 1810 | get_port_number(urb->dev->devpath, | 1828 | get_port_number(r8a66597, urb->dev->devpath, |
| 1811 | &root_port, &hub_port); | 1829 | &root_port, &hub_port); |
| 1812 | set_devadd_reg(r8a66597, 0, | 1830 | set_devadd_reg(r8a66597, 0, |
| 1813 | get_r8a66597_usb_speed(urb->dev->speed), | 1831 | get_r8a66597_usb_speed(urb->dev->speed), |
| @@ -2082,7 +2100,7 @@ static int r8a66597_hub_status_data(struct usb_hcd *hcd, char *buf) | |||
| 2082 | 2100 | ||
| 2083 | *buf = 0; /* initialize (no change) */ | 2101 | *buf = 0; /* initialize (no change) */ |
| 2084 | 2102 | ||
| 2085 | for (i = 0; i < R8A66597_MAX_ROOT_HUB; i++) { | 2103 | for (i = 0; i < r8a66597->max_root_hub; i++) { |
| 2086 | if (r8a66597->root_hub[i].port & 0xffff0000) | 2104 | if (r8a66597->root_hub[i].port & 0xffff0000) |
| 2087 | *buf |= 1 << (i + 1); | 2105 | *buf |= 1 << (i + 1); |
| 2088 | } | 2106 | } |
| @@ -2097,11 +2115,11 @@ static void r8a66597_hub_descriptor(struct r8a66597 *r8a66597, | |||
| 2097 | { | 2115 | { |
| 2098 | desc->bDescriptorType = 0x29; | 2116 | desc->bDescriptorType = 0x29; |
| 2099 | desc->bHubContrCurrent = 0; | 2117 | desc->bHubContrCurrent = 0; |
| 2100 | desc->bNbrPorts = R8A66597_MAX_ROOT_HUB; | 2118 | desc->bNbrPorts = r8a66597->max_root_hub; |
| 2101 | desc->bDescLength = 9; | 2119 | desc->bDescLength = 9; |
| 2102 | desc->bPwrOn2PwrGood = 0; | 2120 | desc->bPwrOn2PwrGood = 0; |
| 2103 | desc->wHubCharacteristics = cpu_to_le16(0x0011); | 2121 | desc->wHubCharacteristics = cpu_to_le16(0x0011); |
| 2104 | desc->bitmap[0] = ((1 << R8A66597_MAX_ROOT_HUB) - 1) << 1; | 2122 | desc->bitmap[0] = ((1 << r8a66597->max_root_hub) - 1) << 1; |
| 2105 | desc->bitmap[1] = ~0; | 2123 | desc->bitmap[1] = ~0; |
| 2106 | } | 2124 | } |
| 2107 | 2125 | ||
| @@ -2129,7 +2147,7 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 2129 | } | 2147 | } |
| 2130 | break; | 2148 | break; |
| 2131 | case ClearPortFeature: | 2149 | case ClearPortFeature: |
| 2132 | if (wIndex > R8A66597_MAX_ROOT_HUB) | 2150 | if (wIndex > r8a66597->max_root_hub) |
| 2133 | goto error; | 2151 | goto error; |
| 2134 | if (wLength != 0) | 2152 | if (wLength != 0) |
| 2135 | goto error; | 2153 | goto error; |
| @@ -2162,12 +2180,12 @@ static int r8a66597_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, | |||
| 2162 | *buf = 0x00; | 2180 | *buf = 0x00; |
| 2163 | break; | 2181 | break; |
| 2164 | case GetPortStatus: | 2182 | case GetPortStatus: |
| 2165 | if (wIndex > R8A66597_MAX_ROOT_HUB) | 2183 | if (wIndex > r8a66597->max_root_hub) |
| 2166 | goto error; | 2184 | goto error; |
| 2167 | *(__le32 *)buf = cpu_to_le32(rh->port); | 2185 | *(__le32 *)buf = cpu_to_le32(rh->port); |
| 2168 | break; | 2186 | break; |
| 2169 | case SetPortFeature: | 2187 | case SetPortFeature: |
| 2170 | if (wIndex > R8A66597_MAX_ROOT_HUB) | 2188 | if (wIndex > r8a66597->max_root_hub) |
| 2171 | goto error; | 2189 | goto error; |
| 2172 | if (wLength != 0) | 2190 | if (wLength != 0) |
| 2173 | goto error; | 2191 | goto error; |
| @@ -2216,7 +2234,7 @@ static int r8a66597_bus_suspend(struct usb_hcd *hcd) | |||
| 2216 | 2234 | ||
| 2217 | dbg("%s", __func__); | 2235 | dbg("%s", __func__); |
| 2218 | 2236 | ||
| 2219 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) { | 2237 | for (port = 0; port < r8a66597->max_root_hub; port++) { |
| 2220 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; | 2238 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; |
| 2221 | unsigned long dvstctr_reg = get_dvstctr_reg(port); | 2239 | unsigned long dvstctr_reg = get_dvstctr_reg(port); |
| 2222 | 2240 | ||
| @@ -2247,7 +2265,7 @@ static int r8a66597_bus_resume(struct usb_hcd *hcd) | |||
| 2247 | 2265 | ||
| 2248 | dbg("%s", __func__); | 2266 | dbg("%s", __func__); |
| 2249 | 2267 | ||
| 2250 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) { | 2268 | for (port = 0; port < r8a66597->max_root_hub; port++) { |
| 2251 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; | 2269 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; |
| 2252 | unsigned long dvstctr_reg = get_dvstctr_reg(port); | 2270 | unsigned long dvstctr_reg = get_dvstctr_reg(port); |
| 2253 | 2271 | ||
| @@ -2305,16 +2323,16 @@ static struct hc_driver r8a66597_hc_driver = { | |||
| 2305 | }; | 2323 | }; |
| 2306 | 2324 | ||
| 2307 | #if defined(CONFIG_PM) | 2325 | #if defined(CONFIG_PM) |
| 2308 | static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) | 2326 | static int r8a66597_suspend(struct device *dev) |
| 2309 | { | 2327 | { |
| 2310 | struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); | 2328 | struct r8a66597 *r8a66597 = dev_get_drvdata(dev); |
| 2311 | int port; | 2329 | int port; |
| 2312 | 2330 | ||
| 2313 | dbg("%s", __func__); | 2331 | dbg("%s", __func__); |
| 2314 | 2332 | ||
| 2315 | disable_controller(r8a66597); | 2333 | disable_controller(r8a66597); |
| 2316 | 2334 | ||
| 2317 | for (port = 0; port < R8A66597_MAX_ROOT_HUB; port++) { | 2335 | for (port = 0; port < r8a66597->max_root_hub; port++) { |
| 2318 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; | 2336 | struct r8a66597_root_hub *rh = &r8a66597->root_hub[port]; |
| 2319 | 2337 | ||
| 2320 | rh->port = 0x00000000; | 2338 | rh->port = 0x00000000; |
| @@ -2323,9 +2341,9 @@ static int r8a66597_suspend(struct platform_device *pdev, pm_message_t state) | |||
| 2323 | return 0; | 2341 | return 0; |
| 2324 | } | 2342 | } |
| 2325 | 2343 | ||
| 2326 | static int r8a66597_resume(struct platform_device *pdev) | 2344 | static int r8a66597_resume(struct device *dev) |
| 2327 | { | 2345 | { |
| 2328 | struct r8a66597 *r8a66597 = dev_get_drvdata(&pdev->dev); | 2346 | struct r8a66597 *r8a66597 = dev_get_drvdata(dev); |
| 2329 | struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); | 2347 | struct usb_hcd *hcd = r8a66597_to_hcd(r8a66597); |
| 2330 | 2348 | ||
| 2331 | dbg("%s", __func__); | 2349 | dbg("%s", __func__); |
| @@ -2335,9 +2353,15 @@ static int r8a66597_resume(struct platform_device *pdev) | |||
| 2335 | 2353 | ||
| 2336 | return 0; | 2354 | return 0; |
| 2337 | } | 2355 | } |
| 2356 | |||
| 2357 | static struct dev_pm_ops r8a66597_dev_pm_ops = { | ||
| 2358 | .suspend = r8a66597_suspend, | ||
| 2359 | .resume = r8a66597_resume, | ||
| 2360 | }; | ||
| 2361 | |||
| 2362 | #define R8A66597_DEV_PM_OPS (&r8a66597_dev_pm_ops) | ||
| 2338 | #else /* if defined(CONFIG_PM) */ | 2363 | #else /* if defined(CONFIG_PM) */ |
| 2339 | #define r8a66597_suspend NULL | 2364 | #define R8A66597_DEV_PM_OPS NULL |
| 2340 | #define r8a66597_resume NULL | ||
| 2341 | #endif | 2365 | #endif |
| 2342 | 2366 | ||
| 2343 | static int __init_or_module r8a66597_remove(struct platform_device *pdev) | 2367 | static int __init_or_module r8a66597_remove(struct platform_device *pdev) |
| @@ -2348,8 +2372,9 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
| 2348 | del_timer_sync(&r8a66597->rh_timer); | 2372 | del_timer_sync(&r8a66597->rh_timer); |
| 2349 | usb_remove_hcd(hcd); | 2373 | usb_remove_hcd(hcd); |
| 2350 | iounmap((void *)r8a66597->reg); | 2374 | iounmap((void *)r8a66597->reg); |
| 2351 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 2375 | #ifdef CONFIG_HAVE_CLK |
| 2352 | clk_put(r8a66597->clk); | 2376 | if (r8a66597->pdata->on_chip) |
| 2377 | clk_put(r8a66597->clk); | ||
| 2353 | #endif | 2378 | #endif |
| 2354 | usb_put_hcd(hcd); | 2379 | usb_put_hcd(hcd); |
| 2355 | return 0; | 2380 | return 0; |
| @@ -2357,7 +2382,7 @@ static int __init_or_module r8a66597_remove(struct platform_device *pdev) | |||
| 2357 | 2382 | ||
| 2358 | static int __devinit r8a66597_probe(struct platform_device *pdev) | 2383 | static int __devinit r8a66597_probe(struct platform_device *pdev) |
| 2359 | { | 2384 | { |
| 2360 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 2385 | #ifdef CONFIG_HAVE_CLK |
| 2361 | char clk_name[8]; | 2386 | char clk_name[8]; |
| 2362 | #endif | 2387 | #endif |
| 2363 | struct resource *res = NULL, *ires; | 2388 | struct resource *res = NULL, *ires; |
| @@ -2419,15 +2444,20 @@ static int __devinit r8a66597_probe(struct platform_device *pdev) | |||
| 2419 | r8a66597->pdata = pdev->dev.platform_data; | 2444 | r8a66597->pdata = pdev->dev.platform_data; |
| 2420 | r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; | 2445 | r8a66597->irq_sense_low = irq_trigger == IRQF_TRIGGER_LOW; |
| 2421 | 2446 | ||
| 2422 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 2447 | if (r8a66597->pdata->on_chip) { |
| 2423 | snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id); | 2448 | #ifdef CONFIG_HAVE_CLK |
| 2424 | r8a66597->clk = clk_get(&pdev->dev, clk_name); | 2449 | snprintf(clk_name, sizeof(clk_name), "usb%d", pdev->id); |
| 2425 | if (IS_ERR(r8a66597->clk)) { | 2450 | r8a66597->clk = clk_get(&pdev->dev, clk_name); |
| 2426 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); | 2451 | if (IS_ERR(r8a66597->clk)) { |
| 2427 | ret = PTR_ERR(r8a66597->clk); | 2452 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", |
| 2428 | goto clean_up2; | 2453 | clk_name); |
| 2429 | } | 2454 | ret = PTR_ERR(r8a66597->clk); |
| 2455 | goto clean_up2; | ||
| 2456 | } | ||
| 2430 | #endif | 2457 | #endif |
| 2458 | r8a66597->max_root_hub = 1; | ||
| 2459 | } else | ||
| 2460 | r8a66597->max_root_hub = 2; | ||
| 2431 | 2461 | ||
| 2432 | spin_lock_init(&r8a66597->lock); | 2462 | spin_lock_init(&r8a66597->lock); |
| 2433 | init_timer(&r8a66597->rh_timer); | 2463 | init_timer(&r8a66597->rh_timer); |
| @@ -2457,8 +2487,9 @@ static int __devinit r8a66597_probe(struct platform_device *pdev) | |||
| 2457 | return 0; | 2487 | return 0; |
| 2458 | 2488 | ||
| 2459 | clean_up3: | 2489 | clean_up3: |
| 2460 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 2490 | #ifdef CONFIG_HAVE_CLK |
| 2461 | clk_put(r8a66597->clk); | 2491 | if (r8a66597->pdata->on_chip) |
| 2492 | clk_put(r8a66597->clk); | ||
| 2462 | clean_up2: | 2493 | clean_up2: |
| 2463 | #endif | 2494 | #endif |
| 2464 | usb_put_hcd(hcd); | 2495 | usb_put_hcd(hcd); |
| @@ -2473,11 +2504,10 @@ clean_up: | |||
| 2473 | static struct platform_driver r8a66597_driver = { | 2504 | static struct platform_driver r8a66597_driver = { |
| 2474 | .probe = r8a66597_probe, | 2505 | .probe = r8a66597_probe, |
| 2475 | .remove = r8a66597_remove, | 2506 | .remove = r8a66597_remove, |
| 2476 | .suspend = r8a66597_suspend, | ||
| 2477 | .resume = r8a66597_resume, | ||
| 2478 | .driver = { | 2507 | .driver = { |
| 2479 | .name = (char *) hcd_name, | 2508 | .name = (char *) hcd_name, |
| 2480 | .owner = THIS_MODULE, | 2509 | .owner = THIS_MODULE, |
| 2510 | .pm = R8A66597_DEV_PM_OPS, | ||
| 2481 | }, | 2511 | }, |
| 2482 | }; | 2512 | }; |
| 2483 | 2513 | ||
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h index d72680b433f9..eecbd917bc81 100644 --- a/drivers/usb/host/r8a66597.h +++ b/drivers/usb/host/r8a66597.h | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | #ifndef __R8A66597_H__ | 26 | #ifndef __R8A66597_H__ |
| 27 | #define __R8A66597_H__ | 27 | #define __R8A66597_H__ |
| 28 | 28 | ||
| 29 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 29 | #ifdef CONFIG_HAVE_CLK |
| 30 | #include <linux/clk.h> | 30 | #include <linux/clk.h> |
| 31 | #endif | 31 | #endif |
| 32 | 32 | ||
| @@ -193,13 +193,9 @@ | |||
| 193 | #define REW 0x4000 /* b14: Buffer rewind */ | 193 | #define REW 0x4000 /* b14: Buffer rewind */ |
| 194 | #define DCLRM 0x2000 /* b13: DMA buffer clear mode */ | 194 | #define DCLRM 0x2000 /* b13: DMA buffer clear mode */ |
| 195 | #define DREQE 0x1000 /* b12: DREQ output enable */ | 195 | #define DREQE 0x1000 /* b12: DREQ output enable */ |
| 196 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
| 197 | #define MBW 0x0800 | ||
| 198 | #else | ||
| 199 | #define MBW 0x0400 /* b10: Maximum bit width for FIFO access */ | ||
| 200 | #endif | ||
| 201 | #define MBW_8 0x0000 /* 8bit */ | 196 | #define MBW_8 0x0000 /* 8bit */ |
| 202 | #define MBW_16 0x0400 /* 16bit */ | 197 | #define MBW_16 0x0400 /* 16bit */ |
| 198 | #define MBW_32 0x0800 /* 32bit */ | ||
| 203 | #define BIGEND 0x0100 /* b8: Big endian mode */ | 199 | #define BIGEND 0x0100 /* b8: Big endian mode */ |
| 204 | #define BYTE_LITTLE 0x0000 /* little dendian */ | 200 | #define BYTE_LITTLE 0x0000 /* little dendian */ |
| 205 | #define BYTE_BIG 0x0100 /* big endifan */ | 201 | #define BYTE_BIG 0x0100 /* big endifan */ |
| @@ -405,11 +401,7 @@ | |||
| 405 | #define R8A66597_MAX_NUM_PIPE 10 | 401 | #define R8A66597_MAX_NUM_PIPE 10 |
| 406 | #define R8A66597_BUF_BSIZE 8 | 402 | #define R8A66597_BUF_BSIZE 8 |
| 407 | #define R8A66597_MAX_DEVICE 10 | 403 | #define R8A66597_MAX_DEVICE 10 |
| 408 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
| 409 | #define R8A66597_MAX_ROOT_HUB 1 | ||
| 410 | #else | ||
| 411 | #define R8A66597_MAX_ROOT_HUB 2 | 404 | #define R8A66597_MAX_ROOT_HUB 2 |
| 412 | #endif | ||
| 413 | #define R8A66597_MAX_SAMPLING 5 | 405 | #define R8A66597_MAX_SAMPLING 5 |
| 414 | #define R8A66597_RH_POLL_TIME 10 | 406 | #define R8A66597_RH_POLL_TIME 10 |
| 415 | #define R8A66597_MAX_DMA_CHANNEL 2 | 407 | #define R8A66597_MAX_DMA_CHANNEL 2 |
| @@ -487,7 +479,7 @@ struct r8a66597_root_hub { | |||
| 487 | struct r8a66597 { | 479 | struct r8a66597 { |
| 488 | spinlock_t lock; | 480 | spinlock_t lock; |
| 489 | unsigned long reg; | 481 | unsigned long reg; |
| 490 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) && defined(CONFIG_HAVE_CLK) | 482 | #ifdef CONFIG_HAVE_CLK |
| 491 | struct clk *clk; | 483 | struct clk *clk; |
| 492 | #endif | 484 | #endif |
| 493 | struct r8a66597_platdata *pdata; | 485 | struct r8a66597_platdata *pdata; |
| @@ -504,6 +496,7 @@ struct r8a66597 { | |||
| 504 | unsigned short interval_map; | 496 | unsigned short interval_map; |
| 505 | unsigned char pipe_cnt[R8A66597_MAX_NUM_PIPE]; | 497 | unsigned char pipe_cnt[R8A66597_MAX_NUM_PIPE]; |
| 506 | unsigned char dma_map; | 498 | unsigned char dma_map; |
| 499 | unsigned int max_root_hub; | ||
| 507 | 500 | ||
| 508 | struct list_head child_device; | 501 | struct list_head child_device; |
| 509 | unsigned long child_connect_map[4]; | 502 | unsigned long child_connect_map[4]; |
| @@ -550,21 +543,22 @@ static inline void r8a66597_read_fifo(struct r8a66597 *r8a66597, | |||
| 550 | unsigned long offset, u16 *buf, | 543 | unsigned long offset, u16 *buf, |
| 551 | int len) | 544 | int len) |
| 552 | { | 545 | { |
| 553 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
| 554 | unsigned long fifoaddr = r8a66597->reg + offset; | 546 | unsigned long fifoaddr = r8a66597->reg + offset; |
| 555 | unsigned long count; | 547 | unsigned long count; |
| 556 | 548 | ||
| 557 | count = len / 4; | 549 | if (r8a66597->pdata->on_chip) { |
| 558 | insl(fifoaddr, buf, count); | 550 | count = len / 4; |
| 551 | insl(fifoaddr, buf, count); | ||
| 559 | 552 | ||
| 560 | if (len & 0x00000003) { | 553 | if (len & 0x00000003) { |
| 561 | unsigned long tmp = inl(fifoaddr); | 554 | unsigned long tmp = inl(fifoaddr); |
| 562 | memcpy((unsigned char *)buf + count * 4, &tmp, len & 0x03); | 555 | memcpy((unsigned char *)buf + count * 4, &tmp, |
| 556 | len & 0x03); | ||
| 557 | } | ||
| 558 | } else { | ||
| 559 | len = (len + 1) / 2; | ||
| 560 | insw(fifoaddr, buf, len); | ||
| 563 | } | 561 | } |
| 564 | #else | ||
| 565 | len = (len + 1) / 2; | ||
| 566 | insw(r8a66597->reg + offset, buf, len); | ||
| 567 | #endif | ||
| 568 | } | 562 | } |
| 569 | 563 | ||
| 570 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, | 564 | static inline void r8a66597_write(struct r8a66597 *r8a66597, u16 val, |
| @@ -578,33 +572,33 @@ static inline void r8a66597_write_fifo(struct r8a66597 *r8a66597, | |||
| 578 | int len) | 572 | int len) |
| 579 | { | 573 | { |
| 580 | unsigned long fifoaddr = r8a66597->reg + offset; | 574 | unsigned long fifoaddr = r8a66597->reg + offset; |
| 581 | #if defined(CONFIG_SUPERH_ON_CHIP_R8A66597) | ||
| 582 | unsigned long count; | 575 | unsigned long count; |
| 583 | unsigned char *pb; | 576 | unsigned char *pb; |
| 584 | int i; | 577 | int i; |
| 585 | 578 | ||
| 586 | count = len / 4; | 579 | if (r8a66597->pdata->on_chip) { |
| 587 | outsl(fifoaddr, buf, count); | 580 | count = len / 4; |
| 581 | outsl(fifoaddr, buf, count); | ||
| 582 | |||
| 583 | if (len & 0x00000003) { | ||
| 584 | pb = (unsigned char *)buf + count * 4; | ||
| 585 | for (i = 0; i < (len & 0x00000003); i++) { | ||
| 586 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | ||
| 587 | outb(pb[i], fifoaddr + i); | ||
| 588 | else | ||
| 589 | outb(pb[i], fifoaddr + 3 - i); | ||
| 590 | } | ||
| 591 | } | ||
| 592 | } else { | ||
| 593 | int odd = len & 0x0001; | ||
| 588 | 594 | ||
| 589 | if (len & 0x00000003) { | 595 | len = len / 2; |
| 590 | pb = (unsigned char *)buf + count * 4; | 596 | outsw(fifoaddr, buf, len); |
| 591 | for (i = 0; i < (len & 0x00000003); i++) { | 597 | if (unlikely(odd)) { |
| 592 | if (r8a66597_read(r8a66597, CFIFOSEL) & BIGEND) | 598 | buf = &buf[len]; |
| 593 | outb(pb[i], fifoaddr + i); | 599 | outb((unsigned char)*buf, fifoaddr); |
| 594 | else | ||
| 595 | outb(pb[i], fifoaddr + 3 - i); | ||
| 596 | } | 600 | } |
| 597 | } | 601 | } |
| 598 | #else | ||
| 599 | int odd = len & 0x0001; | ||
| 600 | |||
| 601 | len = len / 2; | ||
| 602 | outsw(fifoaddr, buf, len); | ||
| 603 | if (unlikely(odd)) { | ||
| 604 | buf = &buf[len]; | ||
| 605 | outb((unsigned char)*buf, fifoaddr); | ||
| 606 | } | ||
| 607 | #endif | ||
| 608 | } | 602 | } |
| 609 | 603 | ||
| 610 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, | 604 | static inline void r8a66597_mdfy(struct r8a66597 *r8a66597, |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 8afcf08eba98..7e2c9774f08f 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
| @@ -1119,12 +1119,13 @@ config FB_CARILLO_RANCH | |||
| 1119 | 1119 | ||
| 1120 | config FB_INTEL | 1120 | config FB_INTEL |
| 1121 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" | 1121 | tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)" |
| 1122 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL | 1122 | depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL && EMBEDDED |
| 1123 | select FB_MODE_HELPERS | 1123 | select FB_MODE_HELPERS |
| 1124 | select FB_CFB_FILLRECT | 1124 | select FB_CFB_FILLRECT |
| 1125 | select FB_CFB_COPYAREA | 1125 | select FB_CFB_COPYAREA |
| 1126 | select FB_CFB_IMAGEBLIT | 1126 | select FB_CFB_IMAGEBLIT |
| 1127 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y | 1127 | select FB_BOOT_VESA_SUPPORT if FB_INTEL = y |
| 1128 | depends on !DRM_I915 | ||
| 1128 | help | 1129 | help |
| 1129 | This driver supports the on-board graphics built in to the Intel | 1130 | This driver supports the on-board graphics built in to the Intel |
| 1130 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. | 1131 | 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. |
| @@ -1866,7 +1867,7 @@ config FB_W100 | |||
| 1866 | 1867 | ||
| 1867 | config FB_SH_MOBILE_LCDC | 1868 | config FB_SH_MOBILE_LCDC |
| 1868 | tristate "SuperH Mobile LCDC framebuffer support" | 1869 | tristate "SuperH Mobile LCDC framebuffer support" |
| 1869 | depends on FB && SUPERH | 1870 | depends on FB && SUPERH && HAVE_CLK |
| 1870 | select FB_SYS_FILLRECT | 1871 | select FB_SYS_FILLRECT |
| 1871 | select FB_SYS_COPYAREA | 1872 | select FB_SYS_COPYAREA |
| 1872 | select FB_SYS_IMAGEBLIT | 1873 | select FB_SYS_IMAGEBLIT |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index 8f24564f77b0..98fb82f11611 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
| @@ -42,11 +42,9 @@ struct sh_mobile_lcdc_chan { | |||
| 42 | struct sh_mobile_lcdc_priv { | 42 | struct sh_mobile_lcdc_priv { |
| 43 | void __iomem *base; | 43 | void __iomem *base; |
| 44 | int irq; | 44 | int irq; |
| 45 | #ifdef CONFIG_HAVE_CLK | ||
| 46 | atomic_t clk_usecnt; | 45 | atomic_t clk_usecnt; |
| 47 | struct clk *dot_clk; | 46 | struct clk *dot_clk; |
| 48 | struct clk *clk; | 47 | struct clk *clk; |
| 49 | #endif | ||
| 50 | unsigned long lddckr; | 48 | unsigned long lddckr; |
| 51 | struct sh_mobile_lcdc_chan ch[2]; | 49 | struct sh_mobile_lcdc_chan ch[2]; |
| 52 | int started; | 50 | int started; |
| @@ -185,7 +183,6 @@ struct sh_mobile_lcdc_sys_bus_ops sh_mobile_lcdc_sys_bus_ops = { | |||
| 185 | lcdc_sys_read_data, | 183 | lcdc_sys_read_data, |
| 186 | }; | 184 | }; |
| 187 | 185 | ||
| 188 | #ifdef CONFIG_HAVE_CLK | ||
| 189 | static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv) | 186 | static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv) |
| 190 | { | 187 | { |
| 191 | if (atomic_inc_and_test(&priv->clk_usecnt)) { | 188 | if (atomic_inc_and_test(&priv->clk_usecnt)) { |
| @@ -203,10 +200,6 @@ static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv) | |||
| 203 | clk_disable(priv->clk); | 200 | clk_disable(priv->clk); |
| 204 | } | 201 | } |
| 205 | } | 202 | } |
| 206 | #else | ||
| 207 | static void sh_mobile_lcdc_clk_on(struct sh_mobile_lcdc_priv *priv) {} | ||
| 208 | static void sh_mobile_lcdc_clk_off(struct sh_mobile_lcdc_priv *priv) {} | ||
| 209 | #endif | ||
| 210 | 203 | ||
| 211 | static int sh_mobile_lcdc_sginit(struct fb_info *info, | 204 | static int sh_mobile_lcdc_sginit(struct fb_info *info, |
| 212 | struct list_head *pagelist) | 205 | struct list_head *pagelist) |
| @@ -515,7 +508,6 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
| 515 | board_cfg = &ch->cfg.board_cfg; | 508 | board_cfg = &ch->cfg.board_cfg; |
| 516 | if (board_cfg->display_off) | 509 | if (board_cfg->display_off) |
| 517 | board_cfg->display_off(board_cfg->board_data); | 510 | board_cfg->display_off(board_cfg->board_data); |
| 518 | |||
| 519 | } | 511 | } |
| 520 | 512 | ||
| 521 | /* stop the lcdc */ | 513 | /* stop the lcdc */ |
| @@ -574,9 +566,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev, | |||
| 574 | int clock_source, | 566 | int clock_source, |
| 575 | struct sh_mobile_lcdc_priv *priv) | 567 | struct sh_mobile_lcdc_priv *priv) |
| 576 | { | 568 | { |
| 577 | #ifdef CONFIG_HAVE_CLK | ||
| 578 | char clk_name[8]; | 569 | char clk_name[8]; |
| 579 | #endif | ||
| 580 | char *str; | 570 | char *str; |
| 581 | int icksel; | 571 | int icksel; |
| 582 | 572 | ||
| @@ -590,7 +580,6 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev, | |||
| 590 | 580 | ||
| 591 | priv->lddckr = icksel << 16; | 581 | priv->lddckr = icksel << 16; |
| 592 | 582 | ||
| 593 | #ifdef CONFIG_HAVE_CLK | ||
| 594 | atomic_set(&priv->clk_usecnt, -1); | 583 | atomic_set(&priv->clk_usecnt, -1); |
| 595 | snprintf(clk_name, sizeof(clk_name), "lcdc%d", pdev->id); | 584 | snprintf(clk_name, sizeof(clk_name), "lcdc%d", pdev->id); |
| 596 | priv->clk = clk_get(&pdev->dev, clk_name); | 585 | priv->clk = clk_get(&pdev->dev, clk_name); |
| @@ -598,7 +587,7 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev, | |||
| 598 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); | 587 | dev_err(&pdev->dev, "cannot get clock \"%s\"\n", clk_name); |
| 599 | return PTR_ERR(priv->clk); | 588 | return PTR_ERR(priv->clk); |
| 600 | } | 589 | } |
| 601 | 590 | ||
| 602 | if (str) { | 591 | if (str) { |
| 603 | priv->dot_clk = clk_get(&pdev->dev, str); | 592 | priv->dot_clk = clk_get(&pdev->dev, str); |
| 604 | if (IS_ERR(priv->dot_clk)) { | 593 | if (IS_ERR(priv->dot_clk)) { |
| @@ -607,7 +596,6 @@ static int sh_mobile_lcdc_setup_clocks(struct platform_device *pdev, | |||
| 607 | return PTR_ERR(priv->dot_clk); | 596 | return PTR_ERR(priv->dot_clk); |
| 608 | } | 597 | } |
| 609 | } | 598 | } |
| 610 | #endif | ||
| 611 | 599 | ||
| 612 | return 0; | 600 | return 0; |
| 613 | } | 601 | } |
| @@ -942,11 +930,9 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) | |||
| 942 | framebuffer_release(info); | 930 | framebuffer_release(info); |
| 943 | } | 931 | } |
| 944 | 932 | ||
| 945 | #ifdef CONFIG_HAVE_CLK | ||
| 946 | if (priv->dot_clk) | 933 | if (priv->dot_clk) |
| 947 | clk_put(priv->dot_clk); | 934 | clk_put(priv->dot_clk); |
| 948 | clk_put(priv->clk); | 935 | clk_put(priv->clk); |
| 949 | #endif | ||
| 950 | 936 | ||
| 951 | if (priv->base) | 937 | if (priv->base) |
| 952 | iounmap(priv->base); | 938 | iounmap(priv->base); |
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c index 193c8f0e5cc5..bcec78ffc765 100644 --- a/drivers/virtio/virtio_pci.c +++ b/drivers/virtio/virtio_pci.c | |||
| @@ -669,7 +669,7 @@ static int __init virtio_pci_init(void) | |||
| 669 | 669 | ||
| 670 | err = pci_register_driver(&virtio_pci_driver); | 670 | err = pci_register_driver(&virtio_pci_driver); |
| 671 | if (err) | 671 | if (err) |
| 672 | device_unregister(virtio_pci_root); | 672 | root_device_unregister(virtio_pci_root); |
| 673 | 673 | ||
| 674 | return err; | 674 | return err; |
| 675 | } | 675 | } |
diff --git a/include/drm/drm_pciids.h b/include/drm/drm_pciids.h index 45c18672b093..7174818c2c13 100644 --- a/include/drm/drm_pciids.h +++ b/include/drm/drm_pciids.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | {0x1002, 0x4A4F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 43 | {0x1002, 0x4A4F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| 44 | {0x1002, 0x4A50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 44 | {0x1002, 0x4A50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| 45 | {0x1002, 0x4A54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 45 | {0x1002, 0x4A54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| 46 | {0x1002, 0x4B48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | ||
| 46 | {0x1002, 0x4B49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 47 | {0x1002, 0x4B49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| 47 | {0x1002, 0x4B4A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 48 | {0x1002, 0x4B4A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| 48 | {0x1002, 0x4B4B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ | 49 | {0x1002, 0x4B4B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|RADEON_NEW_MEMMAP}, \ |
| @@ -262,6 +263,7 @@ | |||
| 262 | {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 263 | {0x1002, 0x9440, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 263 | {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 264 | {0x1002, 0x9441, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 264 | {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 265 | {0x1002, 0x9442, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 266 | {0x1002, 0x9443, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | ||
| 265 | {0x1002, 0x9444, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 267 | {0x1002, 0x9444, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 266 | {0x1002, 0x9446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ | 268 | {0x1002, 0x9446, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_NEW_MEMMAP}, \ |
| 267 | {0x1002, 0x944A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 269 | {0x1002, 0x944A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV770|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| @@ -346,12 +348,12 @@ | |||
| 346 | {0x1002, 0x9599, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \ | 348 | {0x1002, 0x9599, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_NEW_MEMMAP}, \ |
| 347 | {0x1002, 0x959B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | 349 | {0x1002, 0x959B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV635|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ |
| 348 | {0x1002, 0x95C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 350 | {0x1002, 0x95C0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 351 | {0x1002, 0x95C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 352 | {0x1002, 0x95C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 349 | {0x1002, 0x95C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 353 | {0x1002, 0x95C5, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 350 | {0x1002, 0x95C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 354 | {0x1002, 0x95C6, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 351 | {0x1002, 0x95C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 355 | {0x1002, 0x95C7, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 352 | {0x1002, 0x95C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 356 | {0x1002, 0x95C9, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 353 | {0x1002, 0x95C2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 354 | {0x1002, 0x95C4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_IS_MOBILITY|RADEON_NEW_MEMMAP}, \ | ||
| 355 | {0x1002, 0x95CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 357 | {0x1002, 0x95CC, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 356 | {0x1002, 0x95CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 358 | {0x1002, 0x95CD, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
| 357 | {0x1002, 0x95CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ | 359 | {0x1002, 0x95CE, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV620|RADEON_NEW_MEMMAP}, \ |
diff --git a/include/linux/lguest.h b/include/linux/lguest.h index 7bc1440fc473..dbf2479e808e 100644 --- a/include/linux/lguest.h +++ b/include/linux/lguest.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #define LG_CLOCK_MIN_DELTA 100UL | 11 | #define LG_CLOCK_MIN_DELTA 100UL |
| 12 | #define LG_CLOCK_MAX_DELTA ULONG_MAX | 12 | #define LG_CLOCK_MAX_DELTA ULONG_MAX |
| 13 | 13 | ||
| 14 | /*G:032 The second method of communicating with the Host is to via "struct | 14 | /*G:031 The second method of communicating with the Host is to via "struct |
| 15 | * lguest_data". Once the Guest's initialization hypercall tells the Host where | 15 | * lguest_data". Once the Guest's initialization hypercall tells the Host where |
| 16 | * this is, the Guest and Host both publish information in it. :*/ | 16 | * this is, the Guest and Host both publish information in it. :*/ |
| 17 | struct lguest_data | 17 | struct lguest_data |
diff --git a/include/linux/usb/r8a66597.h b/include/linux/usb/r8a66597.h index e9f0384fa20c..460ee3f6a2c6 100644 --- a/include/linux/usb/r8a66597.h +++ b/include/linux/usb/r8a66597.h | |||
| @@ -31,6 +31,9 @@ struct r8a66597_platdata { | |||
| 31 | /* This ops can controll port power instead of DVSTCTR register. */ | 31 | /* This ops can controll port power instead of DVSTCTR register. */ |
| 32 | void (*port_power)(int port, int power); | 32 | void (*port_power)(int port, int power); |
| 33 | 33 | ||
| 34 | /* set one = on chip controller, set zero = external controller */ | ||
| 35 | unsigned on_chip:1; | ||
| 36 | |||
| 34 | /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ | 37 | /* (external controller only) set R8A66597_PLATDATA_XTAL_nnMHZ */ |
| 35 | unsigned xtal:2; | 38 | unsigned xtal:2; |
| 36 | 39 | ||
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index cec79adbe3ea..9c543d6ac535 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h | |||
| @@ -27,6 +27,7 @@ | |||
| 27 | #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ | 27 | #define VIRTIO_NET_F_CTRL_VQ 17 /* Control channel available */ |
| 28 | #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ | 28 | #define VIRTIO_NET_F_CTRL_RX 18 /* Control channel RX mode support */ |
| 29 | #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ | 29 | #define VIRTIO_NET_F_CTRL_VLAN 19 /* Control channel VLAN filtering */ |
| 30 | #define VIRTIO_NET_F_CTRL_RX_EXTRA 20 /* Extra RX mode control support */ | ||
| 30 | 31 | ||
| 31 | #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ | 32 | #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ |
| 32 | 33 | ||
| @@ -81,14 +82,19 @@ typedef __u8 virtio_net_ctrl_ack; | |||
| 81 | #define VIRTIO_NET_ERR 1 | 82 | #define VIRTIO_NET_ERR 1 |
| 82 | 83 | ||
| 83 | /* | 84 | /* |
| 84 | * Control the RX mode, ie. promisucous and allmulti. PROMISC and | 85 | * Control the RX mode, ie. promisucous, allmulti, etc... |
| 85 | * ALLMULTI commands require an "out" sg entry containing a 1 byte | 86 | * All commands require an "out" sg entry containing a 1 byte |
| 86 | * state value, zero = disable, non-zero = enable. These commands | 87 | * state value, zero = disable, non-zero = enable. Commands |
| 87 | * are supported with the VIRTIO_NET_F_CTRL_RX feature. | 88 | * 0 and 1 are supported with the VIRTIO_NET_F_CTRL_RX feature. |
| 89 | * Commands 2-5 are added with VIRTIO_NET_F_CTRL_RX_EXTRA. | ||
| 88 | */ | 90 | */ |
| 89 | #define VIRTIO_NET_CTRL_RX 0 | 91 | #define VIRTIO_NET_CTRL_RX 0 |
| 90 | #define VIRTIO_NET_CTRL_RX_PROMISC 0 | 92 | #define VIRTIO_NET_CTRL_RX_PROMISC 0 |
| 91 | #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 | 93 | #define VIRTIO_NET_CTRL_RX_ALLMULTI 1 |
| 94 | #define VIRTIO_NET_CTRL_RX_ALLUNI 2 | ||
| 95 | #define VIRTIO_NET_CTRL_RX_NOMULTI 3 | ||
| 96 | #define VIRTIO_NET_CTRL_RX_NOUNI 4 | ||
| 97 | #define VIRTIO_NET_CTRL_RX_NOBCAST 5 | ||
| 92 | 98 | ||
| 93 | /* | 99 | /* |
| 94 | * Control the MAC filter table. | 100 | * Control the MAC filter table. |
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index 7402144bff21..75ef000613c3 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c | |||
| @@ -363,7 +363,7 @@ ftrace_trace_onoff_callback(char *glob, char *cmd, char *param, int enable) | |||
| 363 | out_reg: | 363 | out_reg: |
| 364 | ret = register_ftrace_function_probe(glob, ops, count); | 364 | ret = register_ftrace_function_probe(glob, ops, count); |
| 365 | 365 | ||
| 366 | return ret; | 366 | return ret < 0 ? ret : 0; |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | static struct ftrace_func_command ftrace_traceon_cmd = { | 369 | static struct ftrace_func_command ftrace_traceon_cmd = { |
diff --git a/sound/arm/pxa2xx-pcm-lib.c b/sound/arm/pxa2xx-pcm-lib.c index 108b643229ba..6205f37d547c 100644 --- a/sound/arm/pxa2xx-pcm-lib.c +++ b/sound/arm/pxa2xx-pcm-lib.c | |||
| @@ -75,7 +75,7 @@ int __pxa2xx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
| 75 | { | 75 | { |
| 76 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; | 76 | struct pxa2xx_runtime_data *rtd = substream->runtime->private_data; |
| 77 | 77 | ||
| 78 | if (rtd && rtd->params) | 78 | if (rtd && rtd->params && rtd->params->drcmr) |
| 79 | *rtd->params->drcmr = 0; | 79 | *rtd->params->drcmr = 0; |
| 80 | 80 | ||
| 81 | snd_pcm_set_runtime_buffer(substream, NULL); | 81 | snd_pcm_set_runtime_buffer(substream, NULL); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bbb9b42e2604..7e99763ca527 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
| @@ -4505,6 +4505,12 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
| 4505 | &dig_nid, 1); | 4505 | &dig_nid, 1); |
| 4506 | if (err < 0) | 4506 | if (err < 0) |
| 4507 | continue; | 4507 | continue; |
| 4508 | if (dig_nid > 0x7f) { | ||
| 4509 | printk(KERN_ERR "alc880_auto: invalid dig_nid " | ||
| 4510 | "connection 0x%x for NID 0x%x\n", dig_nid, | ||
| 4511 | spec->autocfg.dig_out_pins[i]); | ||
| 4512 | continue; | ||
| 4513 | } | ||
| 4508 | if (!i) | 4514 | if (!i) |
| 4509 | spec->multiout.dig_out_nid = dig_nid; | 4515 | spec->multiout.dig_out_nid = dig_nid; |
| 4510 | else { | 4516 | else { |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 235a71e5ac8d..b5ca02e2038c 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
| @@ -2197,9 +2197,12 @@ static int __init alsa_card_riptide_init(void) | |||
| 2197 | if (err < 0) | 2197 | if (err < 0) |
| 2198 | return err; | 2198 | return err; |
| 2199 | #if defined(SUPPORT_JOYSTICK) | 2199 | #if defined(SUPPORT_JOYSTICK) |
| 2200 | pci_register_driver(&joystick_driver); | 2200 | err = pci_register_driver(&joystick_driver); |
| 2201 | /* On failure unregister formerly registered audio driver */ | ||
| 2202 | if (err < 0) | ||
| 2203 | pci_unregister_driver(&driver); | ||
| 2201 | #endif | 2204 | #endif |
| 2202 | return 0; | 2205 | return err; |
| 2203 | } | 2206 | } |
| 2204 | 2207 | ||
| 2205 | static void __exit alsa_card_riptide_exit(void) | 2208 | static void __exit alsa_card_riptide_exit(void) |
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index c7b902358b7b..44b9cdc8a83b 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
| @@ -2661,7 +2661,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
| 2661 | struct usb_interface_descriptor *altsd; | 2661 | struct usb_interface_descriptor *altsd; |
| 2662 | int i, altno, err, stream; | 2662 | int i, altno, err, stream; |
| 2663 | int format; | 2663 | int format; |
| 2664 | struct audioformat *fp; | 2664 | struct audioformat *fp = NULL; |
| 2665 | unsigned char *fmt, *csep; | 2665 | unsigned char *fmt, *csep; |
| 2666 | int num; | 2666 | int num; |
| 2667 | 2667 | ||
| @@ -2734,6 +2734,18 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
| 2734 | continue; | 2734 | continue; |
| 2735 | } | 2735 | } |
| 2736 | 2736 | ||
| 2737 | /* | ||
| 2738 | * Blue Microphones workaround: The last altsetting is identical | ||
| 2739 | * with the previous one, except for a larger packet size, but | ||
| 2740 | * is actually a mislabeled two-channel setting; ignore it. | ||
| 2741 | */ | ||
| 2742 | if (fmt[4] == 1 && fmt[5] == 2 && altno == 2 && num == 3 && | ||
| 2743 | fp && fp->altsetting == 1 && fp->channels == 1 && | ||
| 2744 | fp->format == SNDRV_PCM_FORMAT_S16_LE && | ||
| 2745 | le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize) == | ||
| 2746 | fp->maxpacksize * 2) | ||
| 2747 | continue; | ||
| 2748 | |||
| 2737 | csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); | 2749 | csep = snd_usb_find_desc(alts->endpoint[0].extra, alts->endpoint[0].extralen, NULL, USB_DT_CS_ENDPOINT); |
| 2738 | /* Creamware Noah has this descriptor after the 2nd endpoint */ | 2750 | /* Creamware Noah has this descriptor after the 2nd endpoint */ |
| 2739 | if (!csep && altsd->bNumEndpoints >= 2) | 2751 | if (!csep && altsd->bNumEndpoints >= 2) |
