aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-12 18:26:39 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-12 18:26:39 -0500
commit7dac7102afbeb99daa454f555f1ea1f42fad2f78 (patch)
tree024bf6c2ed2fa46cab610e6012bd3dd5f45da182
parent3370b69eb0c1f6a05f9051e8fc3e8768461a80f7 (diff)
parentf639eeb4a60ce39f154753e3a745bd755e0fe084 (diff)
Merge tag 'for-4.4' of git://git.osdn.jp/gitroot/uclinux-h8/linux
Pull h8300 updates from Yoshinori Sato: "Some bug fixes" * tag 'for-4.4' of git://git.osdn.jp/gitroot/uclinux-h8/linux: h8300: enable CLKSRC_OF h8300: Don't set CROSS_COMPILE unconditionally asm-generic: {get,put}_user ptr argument evaluate only 1 time h8300: bit io fix h8300: zImage fix h8300: register address fix h8300: Fix alignment for .data h8300: unaligned divcr register support.
-rw-r--r--arch/h8300/Kconfig1
-rw-r--r--arch/h8300/Makefile2
-rw-r--r--arch/h8300/boot/compressed/Makefile5
-rw-r--r--arch/h8300/boot/compressed/head.S4
-rw-r--r--arch/h8300/boot/compressed/misc.c7
-rw-r--r--arch/h8300/boot/compressed/vmlinux.lds2
-rw-r--r--arch/h8300/boot/dts/edosk2674.dts6
-rw-r--r--arch/h8300/include/asm/io.h12
-rw-r--r--arch/h8300/include/asm/thread_info.h14
-rw-r--r--arch/h8300/kernel/setup.c2
-rw-r--r--arch/h8300/kernel/vmlinux.lds.S4
-rw-r--r--drivers/clk/h8300/clk-div.c6
-rw-r--r--include/asm-generic/uaccess.h10
13 files changed, 40 insertions, 35 deletions
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index db589167838c..dd3ac75776ad 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -16,6 +16,7 @@ config H8300
16 select OF_EARLY_FLATTREE 16 select OF_EARLY_FLATTREE
17 select HAVE_MEMBLOCK 17 select HAVE_MEMBLOCK
18 select HAVE_DMA_ATTRS 18 select HAVE_DMA_ATTRS
19 select CLKSRC_OF
19 20
20config RWSEM_GENERIC_SPINLOCK 21config RWSEM_GENERIC_SPINLOCK
21 def_bool y 22 def_bool y
diff --git a/arch/h8300/Makefile b/arch/h8300/Makefile
index 0d2d96e52d9f..e1c02ca230cb 100644
--- a/arch/h8300/Makefile
+++ b/arch/h8300/Makefile
@@ -22,7 +22,9 @@ KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
22KBUILD_AFLAGS += $(aflags-y) 22KBUILD_AFLAGS += $(aflags-y)
23LDFLAGS += $(ldflags-y) 23LDFLAGS += $(ldflags-y)
24 24
25ifeq ($(CROSS_COMPILE),)
25CROSS_COMPILE := h8300-unknown-linux- 26CROSS_COMPILE := h8300-unknown-linux-
27endif
26 28
27core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/ 29core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
28ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""' 30ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""'
diff --git a/arch/h8300/boot/compressed/Makefile b/arch/h8300/boot/compressed/Makefile
index 87d03b7ee97e..d7bc3fa7f2c6 100644
--- a/arch/h8300/boot/compressed/Makefile
+++ b/arch/h8300/boot/compressed/Makefile
@@ -14,11 +14,12 @@ OBJECTS = $(obj)/head.o $(obj)/misc.o
14# in order to suppress error message. 14# in order to suppress error message.
15# 15#
16CONFIG_MEMORY_START ?= 0x00400000 16CONFIG_MEMORY_START ?= 0x00400000
17CONFIG_BOOT_LINK_OFFSET ?= 0x00140000 17CONFIG_BOOT_LINK_OFFSET ?= 0x00280000
18IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET)))) 18IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))
19 19
20LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) 20LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
21LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds 21LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \
22 --defsym output=$(CONFIG_MEMORY_START)
22 23
23$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE 24$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
24 $(call if_changed,ld) 25 $(call if_changed,ld)
diff --git a/arch/h8300/boot/compressed/head.S b/arch/h8300/boot/compressed/head.S
index 74c0d8cc40ba..0436350c1df5 100644
--- a/arch/h8300/boot/compressed/head.S
+++ b/arch/h8300/boot/compressed/head.S
@@ -9,8 +9,8 @@
9 .section .text..startup,"ax" 9 .section .text..startup,"ax"
10 .global startup 10 .global startup
11startup: 11startup:
12 mov.l #startup, sp
12 mov.l er0, er4 13 mov.l er0, er4
13 mov.l er0, sp
14 mov.l #__sbss, er0 14 mov.l #__sbss, er0
15 mov.l #__ebss, er1 15 mov.l #__ebss, er1
16 sub.l er0, er1 16 sub.l er0, er1
@@ -24,7 +24,7 @@ startup:
24 bne 1b 24 bne 1b
25 jsr @decompress_kernel 25 jsr @decompress_kernel
26 mov.l er4, er0 26 mov.l er4, er0
27 jmp @0x400000 27 jmp @output
28 28
29 .align 9 29 .align 9
30fake_headers_as_bzImage: 30fake_headers_as_bzImage:
diff --git a/arch/h8300/boot/compressed/misc.c b/arch/h8300/boot/compressed/misc.c
index c4f2cfcb117b..6029c5351895 100644
--- a/arch/h8300/boot/compressed/misc.c
+++ b/arch/h8300/boot/compressed/misc.c
@@ -28,7 +28,7 @@ static unsigned long free_mem_end_ptr;
28 28
29extern char input_data[]; 29extern char input_data[];
30extern int input_len; 30extern int input_len;
31static unsigned char *output; 31extern char output[];
32 32
33#define HEAP_SIZE 0x10000 33#define HEAP_SIZE 0x10000
34 34
@@ -56,15 +56,10 @@ void *memcpy(void *dest, const void *src, size_t n)
56 56
57static void error(char *x) 57static void error(char *x)
58{ 58{
59
60 while (1) 59 while (1)
61 ; /* Halt */ 60 ; /* Halt */
62} 61}
63 62
64#define STACK_SIZE (4096)
65long user_stack[STACK_SIZE];
66long *stack_start = &user_stack[STACK_SIZE];
67
68void decompress_kernel(void) 63void decompress_kernel(void)
69{ 64{
70 free_mem_ptr = (unsigned long)&_end; 65 free_mem_ptr = (unsigned long)&_end;
diff --git a/arch/h8300/boot/compressed/vmlinux.lds b/arch/h8300/boot/compressed/vmlinux.lds
index a0a3a0ed54ef..44fd209db88a 100644
--- a/arch/h8300/boot/compressed/vmlinux.lds
+++ b/arch/h8300/boot/compressed/vmlinux.lds
@@ -27,6 +27,6 @@ SECTIONS
27 *(.bss*) 27 *(.bss*)
28 . = ALIGN(0x4) ; 28 . = ALIGN(0x4) ;
29 __ebss = . ; 29 __ebss = . ;
30 __end = . ;
31 } 30 }
31 _end = . ;
32} 32}
diff --git a/arch/h8300/boot/dts/edosk2674.dts b/arch/h8300/boot/dts/edosk2674.dts
index dfb5c102f8da..4ce9fa874a57 100644
--- a/arch/h8300/boot/dts/edosk2674.dts
+++ b/arch/h8300/boot/dts/edosk2674.dts
@@ -7,7 +7,7 @@
7 7
8 chosen { 8 chosen {
9 bootargs = "console=ttySC2,38400"; 9 bootargs = "console=ttySC2,38400";
10 stdout-path = <&sci2>; 10 stdout-path = &sci2;
11 }; 11 };
12 aliases { 12 aliases {
13 serial0 = &sci0; 13 serial0 = &sci0;
@@ -25,13 +25,13 @@
25 compatible = "renesas,h8s2678-pll-clock"; 25 compatible = "renesas,h8s2678-pll-clock";
26 clocks = <&xclk>; 26 clocks = <&xclk>;
27 #clock-cells = <0>; 27 #clock-cells = <0>;
28 reg = <0xfee03b 2>, <0xfee045 2>; 28 reg = <0xffff3b 1>, <0xffff45 1>;
29 }; 29 };
30 core_clk: core_clk { 30 core_clk: core_clk {
31 compatible = "renesas,h8300-div-clock"; 31 compatible = "renesas,h8300-div-clock";
32 clocks = <&pllclk>; 32 clocks = <&pllclk>;
33 #clock-cells = <0>; 33 #clock-cells = <0>;
34 reg = <0xfee03b 2>; 34 reg = <0xffff3b 1>;
35 renesas,width = <3>; 35 renesas,width = <3>;
36 }; 36 };
37 fclk: fclk { 37 fclk: fclk {
diff --git a/arch/h8300/include/asm/io.h b/arch/h8300/include/asm/io.h
index 1d09b2f2e0fe..bb837cded268 100644
--- a/arch/h8300/include/asm/io.h
+++ b/arch/h8300/include/asm/io.h
@@ -36,20 +36,20 @@ static inline void ctrl_outl(unsigned long b, unsigned long addr)
36 *(volatile unsigned long *)addr = b; 36 *(volatile unsigned long *)addr = b;
37} 37}
38 38
39static inline void ctrl_bclr(int b, unsigned long addr) 39static inline void ctrl_bclr(int b, unsigned char *addr)
40{ 40{
41 if (__builtin_constant_p(b)) 41 if (__builtin_constant_p(b))
42 __asm__("bclr %1,%0" : : "WU"(addr), "i"(b)); 42 __asm__("bclr %1,%0" : "+WU"(*addr): "i"(b));
43 else 43 else
44 __asm__("bclr %w1,%0" : : "WU"(addr), "r"(b)); 44 __asm__("bclr %w1,%0" : "+WU"(*addr): "r"(b));
45} 45}
46 46
47static inline void ctrl_bset(int b, unsigned long addr) 47static inline void ctrl_bset(int b, unsigned char *addr)
48{ 48{
49 if (__builtin_constant_p(b)) 49 if (__builtin_constant_p(b))
50 __asm__("bset %1,%0" : : "WU"(addr), "i"(b)); 50 __asm__("bset %1,%0" : "+WU"(*addr): "i"(b));
51 else 51 else
52 __asm__("bset %w1,%0" : : "WU"(addr), "r"(b)); 52 __asm__("bset %w1,%0" : "+WU"(*addr): "r"(b));
53} 53}
54 54
55#endif /* __KERNEL__ */ 55#endif /* __KERNEL__ */
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h
index 544c30785ad4..b408fe660cf8 100644
--- a/arch/h8300/include/asm/thread_info.h
+++ b/arch/h8300/include/asm/thread_info.h
@@ -13,6 +13,12 @@
13 13
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16/*
17 * Size of kernel stack for each process. This must be a power of 2...
18 */
19#define THREAD_SIZE_ORDER 1
20#define THREAD_SIZE 8192 /* 2 pages */
21
16#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
17 23
18/* 24/*
@@ -46,14 +52,6 @@ struct thread_info {
46#define init_thread_info (init_thread_union.thread_info) 52#define init_thread_info (init_thread_union.thread_info)
47#define init_stack (init_thread_union.stack) 53#define init_stack (init_thread_union.stack)
48 54
49
50/*
51 * Size of kernel stack for each process. This must be a power of 2...
52 */
53#define THREAD_SIZE_ORDER 1
54#define THREAD_SIZE 8192 /* 2 pages */
55
56
57/* how to get the thread information struct from C */ 55/* how to get the thread information struct from C */
58static inline struct thread_info *current_thread_info(void) 56static inline struct thread_info *current_thread_info(void)
59{ 57{
diff --git a/arch/h8300/kernel/setup.c b/arch/h8300/kernel/setup.c
index 0fd1fe65c0b8..c772abe6d19c 100644
--- a/arch/h8300/kernel/setup.c
+++ b/arch/h8300/kernel/setup.c
@@ -29,6 +29,7 @@
29#include <linux/clk-provider.h> 29#include <linux/clk-provider.h>
30#include <linux/memblock.h> 30#include <linux/memblock.h>
31#include <linux/screen_info.h> 31#include <linux/screen_info.h>
32#include <linux/clocksource.h>
32 33
33#include <asm/setup.h> 34#include <asm/setup.h>
34#include <asm/irq.h> 35#include <asm/irq.h>
@@ -252,4 +253,5 @@ void __init calibrate_delay(void)
252void __init time_init(void) 253void __init time_init(void)
253{ 254{
254 of_clk_init(NULL); 255 of_clk_init(NULL);
256 clocksource_probe();
255} 257}
diff --git a/arch/h8300/kernel/vmlinux.lds.S b/arch/h8300/kernel/vmlinux.lds.S
index 7c302dcf5249..cb5dfb02c88d 100644
--- a/arch/h8300/kernel/vmlinux.lds.S
+++ b/arch/h8300/kernel/vmlinux.lds.S
@@ -1,5 +1,6 @@
1#include <asm-generic/vmlinux.lds.h> 1#include <asm-generic/vmlinux.lds.h>
2#include <asm/page.h> 2#include <asm/page.h>
3#include <asm/thread_info.h>
3 4
4#define ROMTOP 0x000000 5#define ROMTOP 0x000000
5#define RAMTOP 0x400000 6#define RAMTOP 0x400000
@@ -42,11 +43,10 @@ SECTIONS
42 . = RAMTOP; 43 . = RAMTOP;
43 _ramstart = .; 44 _ramstart = .;
44#define ADDR(x) ROMEND 45#define ADDR(x) ROMEND
45#else
46#endif 46#endif
47 _sdata = . ; 47 _sdata = . ;
48 __data_start = . ; 48 __data_start = . ;
49 RW_DATA_SECTION(0,0,0) 49 RW_DATA_SECTION(0, PAGE_SIZE, THREAD_SIZE)
50#if defined(CONFIG_ROMKERNEL) 50#if defined(CONFIG_ROMKERNEL)
51#undef ADDR 51#undef ADDR
52#endif 52#endif
diff --git a/drivers/clk/h8300/clk-div.c b/drivers/clk/h8300/clk-div.c
index 1dd5d14d5dbe..d71d01157dbb 100644
--- a/drivers/clk/h8300/clk-div.c
+++ b/drivers/clk/h8300/clk-div.c
@@ -19,6 +19,7 @@ static void __init h8300_div_clk_setup(struct device_node *node)
19 const char *parent_name; 19 const char *parent_name;
20 void __iomem *divcr = NULL; 20 void __iomem *divcr = NULL;
21 int width; 21 int width;
22 int offset;
22 23
23 num_parents = of_clk_get_parent_count(node); 24 num_parents = of_clk_get_parent_count(node);
24 if (num_parents < 1) { 25 if (num_parents < 1) {
@@ -31,11 +32,14 @@ static void __init h8300_div_clk_setup(struct device_node *node)
31 pr_err("%s: failed to map divide register", clk_name); 32 pr_err("%s: failed to map divide register", clk_name);
32 goto error; 33 goto error;
33 } 34 }
35 offset = (unsigned long)divcr & 3;
36 offset = (3 - offset) * 8;
37 divcr = (void *)((unsigned long)divcr & ~3);
34 38
35 parent_name = of_clk_get_parent_name(node, 0); 39 parent_name = of_clk_get_parent_name(node, 0);
36 of_property_read_u32(node, "renesas,width", &width); 40 of_property_read_u32(node, "renesas,width", &width);
37 clk = clk_register_divider(NULL, clk_name, parent_name, 41 clk = clk_register_divider(NULL, clk_name, parent_name,
38 CLK_SET_RATE_GATE, divcr, 0, width, 42 CLK_SET_RATE_GATE, divcr, offset, width,
39 CLK_DIVIDER_POWER_OF_TWO, &clklock); 43 CLK_DIVIDER_POWER_OF_TWO, &clklock);
40 if (!IS_ERR(clk)) { 44 if (!IS_ERR(clk)) {
41 of_clk_add_provider(node, of_clk_src_simple_get, clk); 45 of_clk_add_provider(node, of_clk_src_simple_get, clk);
diff --git a/include/asm-generic/uaccess.h b/include/asm-generic/uaccess.h
index 72d8803832ff..1bfa602958f2 100644
--- a/include/asm-generic/uaccess.h
+++ b/include/asm-generic/uaccess.h
@@ -163,9 +163,10 @@ static inline __must_check long __copy_to_user(void __user *to,
163 163
164#define put_user(x, ptr) \ 164#define put_user(x, ptr) \
165({ \ 165({ \
166 void *__p = (ptr); \
166 might_fault(); \ 167 might_fault(); \
167 access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \ 168 access_ok(VERIFY_WRITE, __p, sizeof(*ptr)) ? \
168 __put_user(x, ptr) : \ 169 __put_user((x), ((__typeof__(*(ptr)) *)__p)) : \
169 -EFAULT; \ 170 -EFAULT; \
170}) 171})
171 172
@@ -225,9 +226,10 @@ extern int __put_user_bad(void) __attribute__((noreturn));
225 226
226#define get_user(x, ptr) \ 227#define get_user(x, ptr) \
227({ \ 228({ \
229 const void *__p = (ptr); \
228 might_fault(); \ 230 might_fault(); \
229 access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \ 231 access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \
230 __get_user(x, ptr) : \ 232 __get_user((x), (__typeof__(*(ptr)) *)__p) : \
231 -EFAULT; \ 233 -EFAULT; \
232}) 234})
233 235