Skip to content

Commit

Permalink
Merge tag 'for-4.4' of git://git.osdn.jp/gitroot/uclinux-h8/linux
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
torvalds committed Nov 12, 2015
2 parents 3370b69 + f639eeb commit 7dac710
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 35 deletions.
1 change: 1 addition & 0 deletions arch/h8300/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ config H8300
select OF_EARLY_FLATTREE
select HAVE_MEMBLOCK
select HAVE_DMA_ATTRS
select CLKSRC_OF

config RWSEM_GENERIC_SPINLOCK
def_bool y
Expand Down
2 changes: 2 additions & 0 deletions arch/h8300/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
KBUILD_AFLAGS += $(aflags-y)
LDFLAGS += $(ldflags-y)

ifeq ($(CROSS_COMPILE),)
CROSS_COMPILE := h8300-unknown-linux-
endif

core-y += arch/$(ARCH)/kernel/ arch/$(ARCH)/mm/
ifneq '$(CONFIG_H8300_BUILTIN_DTB)' '""'
Expand Down
5 changes: 3 additions & 2 deletions arch/h8300/boot/compressed/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ OBJECTS = $(obj)/head.o $(obj)/misc.o
# in order to suppress error message.
#
CONFIG_MEMORY_START ?= 0x00400000
CONFIG_BOOT_LINK_OFFSET ?= 0x00140000
CONFIG_BOOT_LINK_OFFSET ?= 0x00280000
IMAGE_OFFSET := $(shell printf "0x%08x" $$(($(CONFIG_MEMORY_START)+$(CONFIG_BOOT_LINK_OFFSET))))

LIBGCC := $(shell $(CROSS-COMPILE)$(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup $(obj)/vmlinux.lds
LDFLAGS_vmlinux := -Ttext $(IMAGE_OFFSET) -estartup -T $(obj)/vmlinux.lds \
--defsym output=$(CONFIG_MEMORY_START)

$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
$(call if_changed,ld)
Expand Down
4 changes: 2 additions & 2 deletions arch/h8300/boot/compressed/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
.section .text..startup,"ax"
.global startup
startup:
mov.l #startup, sp
mov.l er0, er4
mov.l er0, sp
mov.l #__sbss, er0
mov.l #__ebss, er1
sub.l er0, er1
Expand All @@ -24,7 +24,7 @@ startup:
bne 1b
jsr @decompress_kernel
mov.l er4, er0
jmp @0x400000
jmp @output

.align 9
fake_headers_as_bzImage:
Expand Down
7 changes: 1 addition & 6 deletions arch/h8300/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ static unsigned long free_mem_end_ptr;

extern char input_data[];
extern int input_len;
static unsigned char *output;
extern char output[];

#define HEAP_SIZE 0x10000

Expand Down Expand Up @@ -56,15 +56,10 @@ void *memcpy(void *dest, const void *src, size_t n)

static void error(char *x)
{

while (1)
; /* Halt */
}

#define STACK_SIZE (4096)
long user_stack[STACK_SIZE];
long *stack_start = &user_stack[STACK_SIZE];

void decompress_kernel(void)
{
free_mem_ptr = (unsigned long)&_end;
Expand Down
2 changes: 1 addition & 1 deletion arch/h8300/boot/compressed/vmlinux.lds
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ SECTIONS
*(.bss*)
. = ALIGN(0x4) ;
__ebss = . ;
__end = . ;
}
_end = . ;
}
6 changes: 3 additions & 3 deletions arch/h8300/boot/dts/edosk2674.dts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

chosen {
bootargs = "console=ttySC2,38400";
stdout-path = <&sci2>;
stdout-path = &sci2;
};
aliases {
serial0 = &sci0;
Expand All @@ -25,13 +25,13 @@
compatible = "renesas,h8s2678-pll-clock";
clocks = <&xclk>;
#clock-cells = <0>;
reg = <0xfee03b 2>, <0xfee045 2>;
reg = <0xffff3b 1>, <0xffff45 1>;
};
core_clk: core_clk {
compatible = "renesas,h8300-div-clock";
clocks = <&pllclk>;
#clock-cells = <0>;
reg = <0xfee03b 2>;
reg = <0xffff3b 1>;
renesas,width = <3>;
};
fclk: fclk {
Expand Down
12 changes: 6 additions & 6 deletions arch/h8300/include/asm/io.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ static inline void ctrl_outl(unsigned long b, unsigned long addr)
*(volatile unsigned long *)addr = b;
}

static inline void ctrl_bclr(int b, unsigned long addr)
static inline void ctrl_bclr(int b, unsigned char *addr)
{
if (__builtin_constant_p(b))
__asm__("bclr %1,%0" : : "WU"(addr), "i"(b));
__asm__("bclr %1,%0" : "+WU"(*addr): "i"(b));
else
__asm__("bclr %w1,%0" : : "WU"(addr), "r"(b));
__asm__("bclr %w1,%0" : "+WU"(*addr): "r"(b));
}

static inline void ctrl_bset(int b, unsigned long addr)
static inline void ctrl_bset(int b, unsigned char *addr)
{
if (__builtin_constant_p(b))
__asm__("bset %1,%0" : : "WU"(addr), "i"(b));
__asm__("bset %1,%0" : "+WU"(*addr): "i"(b));
else
__asm__("bset %w1,%0" : : "WU"(addr), "r"(b));
__asm__("bset %w1,%0" : "+WU"(*addr): "r"(b));
}

#endif /* __KERNEL__ */
Expand Down
14 changes: 6 additions & 8 deletions arch/h8300/include/asm/thread_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@

#ifdef __KERNEL__

/*
* Size of kernel stack for each process. This must be a power of 2...
*/
#define THREAD_SIZE_ORDER 1
#define THREAD_SIZE 8192 /* 2 pages */

#ifndef __ASSEMBLY__

/*
Expand Down Expand Up @@ -46,14 +52,6 @@ struct thread_info {
#define init_thread_info (init_thread_union.thread_info)
#define init_stack (init_thread_union.stack)


/*
* Size of kernel stack for each process. This must be a power of 2...
*/
#define THREAD_SIZE_ORDER 1
#define THREAD_SIZE 8192 /* 2 pages */


/* how to get the thread information struct from C */
static inline struct thread_info *current_thread_info(void)
{
Expand Down
2 changes: 2 additions & 0 deletions arch/h8300/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/clk-provider.h>
#include <linux/memblock.h>
#include <linux/screen_info.h>
#include <linux/clocksource.h>

#include <asm/setup.h>
#include <asm/irq.h>
Expand Down Expand Up @@ -252,4 +253,5 @@ void __init calibrate_delay(void)
void __init time_init(void)
{
of_clk_init(NULL);
clocksource_probe();
}
4 changes: 2 additions & 2 deletions arch/h8300/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <asm-generic/vmlinux.lds.h>
#include <asm/page.h>
#include <asm/thread_info.h>

#define ROMTOP 0x000000
#define RAMTOP 0x400000
Expand Down Expand Up @@ -42,11 +43,10 @@ SECTIONS
. = RAMTOP;
_ramstart = .;
#define ADDR(x) ROMEND
#else
#endif
_sdata = . ;
__data_start = . ;
RW_DATA_SECTION(0,0,0)
RW_DATA_SECTION(0, PAGE_SIZE, THREAD_SIZE)
#if defined(CONFIG_ROMKERNEL)
#undef ADDR
#endif
Expand Down
6 changes: 5 additions & 1 deletion drivers/clk/h8300/clk-div.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static void __init h8300_div_clk_setup(struct device_node *node)
const char *parent_name;
void __iomem *divcr = NULL;
int width;
int offset;

num_parents = of_clk_get_parent_count(node);
if (num_parents < 1) {
Expand All @@ -31,11 +32,14 @@ static void __init h8300_div_clk_setup(struct device_node *node)
pr_err("%s: failed to map divide register", clk_name);
goto error;
}
offset = (unsigned long)divcr & 3;
offset = (3 - offset) * 8;
divcr = (void *)((unsigned long)divcr & ~3);

parent_name = of_clk_get_parent_name(node, 0);
of_property_read_u32(node, "renesas,width", &width);
clk = clk_register_divider(NULL, clk_name, parent_name,
CLK_SET_RATE_GATE, divcr, 0, width,
CLK_SET_RATE_GATE, divcr, offset, width,
CLK_DIVIDER_POWER_OF_TWO, &clklock);
if (!IS_ERR(clk)) {
of_clk_add_provider(node, of_clk_src_simple_get, clk);
Expand Down
10 changes: 6 additions & 4 deletions include/asm-generic/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,10 @@ static inline __must_check long __copy_to_user(void __user *to,

#define put_user(x, ptr) \
({ \
void *__p = (ptr); \
might_fault(); \
access_ok(VERIFY_WRITE, ptr, sizeof(*ptr)) ? \
__put_user(x, ptr) : \
access_ok(VERIFY_WRITE, __p, sizeof(*ptr)) ? \
__put_user((x), ((__typeof__(*(ptr)) *)__p)) : \
-EFAULT; \
})

Expand Down Expand Up @@ -225,9 +226,10 @@ extern int __put_user_bad(void) __attribute__((noreturn));

#define get_user(x, ptr) \
({ \
const void *__p = (ptr); \
might_fault(); \
access_ok(VERIFY_READ, ptr, sizeof(*ptr)) ? \
__get_user(x, ptr) : \
access_ok(VERIFY_READ, __p, sizeof(*ptr)) ? \
__get_user((x), (__typeof__(*(ptr)) *)__p) : \
-EFAULT; \
})

Expand Down

0 comments on commit 7dac710

Please sign in to comment.