Skip to content

Commit 1630e84

Browse files
committed
Merge tag 'sh-for-4.8' of git://git.libc.org/linux-sh
Pull arch/sh updates from Rich Felker: "These changes improve device tree support (including builtin DTB), add support for the J-Core J2 processor, an open source synthesizable reimplementation of the SH-2 ISA, resolve a longstanding sigcontext ABI mismatch issue, and fix various bugs including nommu-specific issues and minor regressions introduced in 4.6. The J-Core arch support is included here but to be usable it needs drivers that are waiting on approval/inclusion from their subsystem maintainers" * tag 'sh-for-4.8' of git://git.libc.org/linux-sh: (23 commits) sh: add device tree source for J2 FPGA on Mimas v2 board sh: add defconfig for J-Core J2 sh: use common clock framework with device tree boards sh: system call wire up sh: Delete unnecessary checks before the function call "mempool_destroy" sh: do not perform IPI-based cache flush except on boards that need it sh: add SMP support for J2 sh: SMP support for SH2 entry.S sh: add working futex atomic ops on userspace addresses for smp sh: add J2 atomics using the cas.l instruction sh: add AT_HWCAP flag for J-Core cas.l instruction sh: add support for J-Core J2 processor sh: fix build regression with CONFIG_OF && !CONFIG_OF_FLATTREE sh: allow clocksource drivers to register sched_clock backends sh: make heartbeat driver explicitly non-modular sh: make board-secureedge5410 explicitly non-modular sh: make mm/asids-debugfs explicitly non-modular sh: make time.c explicitly non-modular sh: fix futex/robust_list on nommu models sh: disable aliased page logic on NOMMU models ...
2 parents 194d6ad + e61c10e commit 1630e84

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1206
-399
lines changed

arch/sh/Kconfig

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ config SUPERH
3838
select GENERIC_IDLE_POLL_SETUP
3939
select GENERIC_CLOCKEVENTS
4040
select GENERIC_CMOS_UPDATE if SH_SH03 || SH_DREAMCAST
41+
select GENERIC_SCHED_CLOCK
4142
select GENERIC_STRNCPY_FROM_USER
4243
select GENERIC_STRNLEN_USER
4344
select HAVE_MOD_ARCH_SPECIFIC if DWARF_UNWINDER
4445
select MODULES_USE_ELF_RELA
4546
select OLD_SIGSUSPEND
4647
select OLD_SIGACTION
4748
select HAVE_ARCH_AUDITSYSCALL
49+
select HAVE_FUTEX_CMPXCHG if FUTEX
4850
select HAVE_NMI
4951
help
5052
The SuperH is a RISC processor targeted for use in embedded systems
@@ -184,6 +186,12 @@ config CPU_SH2A
184186
select CPU_SH2
185187
select UNCACHED_MAPPING
186188

189+
config CPU_J2
190+
bool
191+
select CPU_SH2
192+
select OF
193+
select OF_EARLY_FLATTREE
194+
187195
config CPU_SH3
188196
bool
189197
select CPU_HAS_INTEVT
@@ -250,6 +258,12 @@ config CPU_SUBTYPE_SH7619
250258
select CPU_SH2
251259
select SYS_SUPPORTS_SH_CMT
252260

261+
config CPU_SUBTYPE_J2
262+
bool "Support J2 processor"
263+
select CPU_J2
264+
select SYS_SUPPORTS_SMP
265+
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
266+
253267
# SH-2A Processor Support
254268

255269
config CPU_SUBTYPE_SH7201
@@ -739,6 +753,26 @@ endmenu
739753

740754
menu "Boot options"
741755

756+
config USE_BUILTIN_DTB
757+
bool "Use builtin DTB"
758+
default n
759+
depends on SH_DEVICE_TREE
760+
help
761+
Link a device tree blob for particular hardware into the kernel,
762+
suppressing use of the DTB pointer provided by the bootloader.
763+
This option should only be used with legacy bootloaders that are
764+
not capable of providing a DTB to the kernel, or for experimental
765+
hardware without stable device tree bindings.
766+
767+
config BUILTIN_DTB_SOURCE
768+
string "Source file for builtin DTB"
769+
default ""
770+
depends on USE_BUILTIN_DTB
771+
help
772+
Base name (without suffix, relative to arch/sh/boot/dts) for the
773+
a DTS file that will be used to produce the DTB linked into the
774+
kernel.
775+
742776
config ZERO_PAGE_OFFSET
743777
hex
744778
default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \

arch/sh/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ isa-y := $(isa-y)-up
3131
endif
3232

3333
cflags-$(CONFIG_CPU_SH2) := $(call cc-option,-m2,)
34+
cflags-$(CONFIG_CPU_J2) := $(call cc-option,-mj2,)
3435
cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
3536
$(call cc-option,-m2a-nofpu,) \
3637
$(call cc-option,-m4-nofpu,)
@@ -130,6 +131,8 @@ head-y := arch/sh/kernel/head_$(BITS).o
130131
core-y += arch/sh/kernel/ arch/sh/mm/ arch/sh/boards/
131132
core-$(CONFIG_SH_FPU_EMU) += arch/sh/math-emu/
132133

134+
core-$(CONFIG_USE_BUILTIN_DTB) += arch/sh/boot/dts/
135+
133136
# Mach groups
134137
machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
135138
machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx

arch/sh/boards/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ config SH_DEVICE_TREE
1111
select OF
1212
select OF_EARLY_FLATTREE
1313
select CLKSRC_OF
14+
select COMMON_CLK
1415
select GENERIC_CALIBRATE_DELAY
1516
help
1617
Select Board Described by Device Tree to build a kernel that

arch/sh/boards/board-secureedge5410.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/interrupt.h>
1515
#include <linux/timer.h>
1616
#include <linux/delay.h>
17-
#include <linux/module.h>
1817
#include <linux/sched.h>
1918
#include <asm/machvec.h>
2019
#include <mach/secureedge5410.h>
@@ -49,7 +48,7 @@ static int __init eraseconfig_init(void)
4948
irq);
5049
return 0;
5150
}
52-
module_init(eraseconfig_init);
51+
device_initcall(eraseconfig_init);
5352

5453
/*
5554
* Initialize IRQ setting

arch/sh/boards/of-generic.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,22 @@ static void __init sh_of_time_init(void)
124124

125125
static void __init sh_of_setup(char **cmdline_p)
126126
{
127+
struct device_node *root;
128+
129+
#ifdef CONFIG_USE_BUILTIN_DTB
130+
unflatten_and_copy_device_tree();
131+
#else
127132
unflatten_device_tree();
133+
#endif
128134

129135
board_time_init = sh_of_time_init;
130136

131-
sh_mv.mv_name = of_flat_dt_get_machine_name();
132-
if (!sh_mv.mv_name)
133-
sh_mv.mv_name = "Unknown SH model";
137+
sh_mv.mv_name = "Unknown SH model";
138+
root = of_find_node_by_path("/");
139+
if (root) {
140+
of_property_read_string(root, "model", &sh_mv.mv_name);
141+
of_node_put(root);
142+
}
134143

135144
sh_of_smp_probe();
136145
}

arch/sh/boot/dts/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
obj-$(CONFIG_USE_BUILTIN_DTB) += $(patsubst "%",%,$(CONFIG_BUILTIN_DTB_SOURCE)).dtb.o
2+
3+
clean-files := *.dtb.S

arch/sh/boot/dts/j2_mimas_v2.dts

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
/dts-v1/;
2+
3+
/ {
4+
compatible = "jcore,j2-soc";
5+
model = "J2 FPGA SoC on Mimas v2 board";
6+
7+
#address-cells = <1>;
8+
#size-cells = <1>;
9+
10+
interrupt-parent = <&aic>;
11+
12+
cpus {
13+
#address-cells = <1>;
14+
#size-cells = <0>;
15+
16+
cpu@0 {
17+
device_type = "cpu";
18+
compatible = "jcore,j2";
19+
reg = <0>;
20+
clock-frequency = <50000000>;
21+
d-cache-size = <8192>;
22+
i-cache-size = <8192>;
23+
d-cache-block-size = <16>;
24+
i-cache-block-size = <16>;
25+
};
26+
};
27+
28+
memory@10000000 {
29+
device_type = "memory";
30+
reg = <0x10000000 0x4000000>;
31+
};
32+
33+
aliases {
34+
serial0 = &uart0;
35+
spi0 = &spi0;
36+
};
37+
38+
chosen {
39+
stdout-path = "serial0";
40+
};
41+
42+
soc@abcd0000 {
43+
compatible = "simple-bus";
44+
ranges = <0 0xabcd0000 0x100000>;
45+
46+
#address-cells = <1>;
47+
#size-cells = <1>;
48+
49+
aic: interrupt-controller@200 {
50+
compatible = "jcore,aic1";
51+
reg = <0x200 0x10>;
52+
interrupt-controller;
53+
#interrupt-cells = <1>;
54+
};
55+
56+
cache-controller@c0 {
57+
compatible = "jcore,cache";
58+
reg = <0xc0 4>;
59+
};
60+
61+
timer@200 {
62+
compatible = "jcore,pit";
63+
reg = <0x200 0x30>;
64+
interrupts = <0x48>;
65+
};
66+
67+
spi0: spi@40 {
68+
compatible = "jcore,spi2";
69+
70+
#address-cells = <1>;
71+
#size-cells = <0>;
72+
73+
spi-max-frequency = <25000000>;
74+
75+
reg = <0x40 0x8>;
76+
77+
sdcard@0 {
78+
compatible = "mmc-spi-slot";
79+
reg = <0>;
80+
spi-max-frequency = <25000000>;
81+
voltage-ranges = <3200 3400>;
82+
mode = <0>;
83+
};
84+
};
85+
86+
uart0: serial@100 {
87+
clock-frequency = <125000000>;
88+
compatible = "xlnx,xps-uartlite-1.00.a";
89+
current-speed = <19200>;
90+
device_type = "serial";
91+
interrupts = <0x12>;
92+
port-number = <0>;
93+
reg = <0x100 0x10>;
94+
};
95+
};
96+
};

arch/sh/configs/j2_defconfig

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
CONFIG_SMP=y
2+
CONFIG_SYSVIPC=y
3+
CONFIG_POSIX_MQUEUE=y
4+
CONFIG_NO_HZ=y
5+
CONFIG_HIGH_RES_TIMERS=y
6+
CONFIG_CPU_SUBTYPE_J2=y
7+
CONFIG_MEMORY_START=0x10000000
8+
CONFIG_MEMORY_SIZE=0x04000000
9+
CONFIG_CPU_BIG_ENDIAN=y
10+
CONFIG_SH_DEVICE_TREE=y
11+
CONFIG_HZ_100=y
12+
CONFIG_CMDLINE_OVERWRITE=y
13+
CONFIG_CMDLINE="console=ttyUL0 earlycon"
14+
CONFIG_BINFMT_ELF_FDPIC=y
15+
CONFIG_BINFMT_FLAT=y
16+
CONFIG_NET=y
17+
CONFIG_PACKET=y
18+
CONFIG_UNIX=y
19+
CONFIG_INET=y
20+
CONFIG_DEVTMPFS=y
21+
CONFIG_DEVTMPFS_MOUNT=y
22+
CONFIG_NETDEVICES=y
23+
CONFIG_SERIAL_UARTLITE=y
24+
CONFIG_SERIAL_UARTLITE_CONSOLE=y
25+
CONFIG_I2C=y
26+
CONFIG_SPI=y
27+
CONFIG_SPI_JCORE=y
28+
CONFIG_WATCHDOG=y
29+
CONFIG_MMC=y
30+
CONFIG_MMC_SPI=y
31+
CONFIG_CLKSRC_JCORE_PIT=y
32+
CONFIG_JCORE_AIC=y
33+
CONFIG_EXT4_FS=y
34+
CONFIG_VFAT_FS=y
35+
CONFIG_FAT_DEFAULT_IOCHARSET="ascii"
36+
CONFIG_FAT_DEFAULT_UTF8=y
37+
CONFIG_NLS_DEFAULT="utf8"
38+
CONFIG_NLS_CODEPAGE_437=y
39+
CONFIG_NLS_ASCII=y
40+
CONFIG_NLS_UTF8=y

arch/sh/drivers/heartbeat.c

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
* for more details.
2020
*/
2121
#include <linux/init.h>
22-
#include <linux/module.h>
2322
#include <linux/platform_device.h>
2423
#include <linux/sched.h>
2524
#include <linux/timer.h>
@@ -139,26 +138,11 @@ static int heartbeat_drv_probe(struct platform_device *pdev)
139138
return mod_timer(&hd->timer, jiffies + 1);
140139
}
141140

142-
static int heartbeat_drv_remove(struct platform_device *pdev)
143-
{
144-
struct heartbeat_data *hd = platform_get_drvdata(pdev);
145-
146-
del_timer_sync(&hd->timer);
147-
iounmap(hd->base);
148-
149-
platform_set_drvdata(pdev, NULL);
150-
151-
if (!pdev->dev.platform_data)
152-
kfree(hd);
153-
154-
return 0;
155-
}
156-
157141
static struct platform_driver heartbeat_driver = {
158142
.probe = heartbeat_drv_probe,
159-
.remove = heartbeat_drv_remove,
160143
.driver = {
161-
.name = DRV_NAME,
144+
.name = DRV_NAME,
145+
.suppress_bind_attrs = true,
162146
},
163147
};
164148

@@ -167,14 +151,4 @@ static int __init heartbeat_init(void)
167151
printk(KERN_NOTICE DRV_NAME ": version %s loaded\n", DRV_VERSION);
168152
return platform_driver_register(&heartbeat_driver);
169153
}
170-
171-
static void __exit heartbeat_exit(void)
172-
{
173-
platform_driver_unregister(&heartbeat_driver);
174-
}
175-
module_init(heartbeat_init);
176-
module_exit(heartbeat_exit);
177-
178-
MODULE_VERSION(DRV_VERSION);
179-
MODULE_AUTHOR("Paul Mundt");
180-
MODULE_LICENSE("GPL v2");
154+
device_initcall(heartbeat_init);

arch/sh/include/asm/atomic.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#ifndef __ASM_SH_ATOMIC_H
22
#define __ASM_SH_ATOMIC_H
33

4+
#if defined(CONFIG_CPU_J2)
5+
6+
#include <asm-generic/atomic.h>
7+
8+
#else
9+
410
/*
511
* Atomic operations that C can't guarantee us. Useful for
612
* resource counting etc..
@@ -63,4 +69,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u)
6369
return c;
6470
}
6571

72+
#endif /* CONFIG_CPU_J2 */
73+
6674
#endif /* __ASM_SH_ATOMIC_H */

arch/sh/include/asm/barrier.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
#define wmb() mb()
3030
#define ctrl_barrier() __icbi(PAGE_OFFSET)
3131
#else
32+
#if defined(CONFIG_CPU_J2) && defined(CONFIG_SMP)
33+
#define __smp_mb() do { int tmp = 0; __asm__ __volatile__ ("cas.l %0,%0,@%1" : "+r"(tmp) : "z"(&tmp) : "memory", "t"); } while(0)
34+
#define __smp_rmb() __smp_mb()
35+
#define __smp_wmb() __smp_mb()
36+
#endif
3237
#define ctrl_barrier() __asm__ __volatile__ ("nop;nop;nop;nop;nop;nop;nop;nop")
3338
#endif
3439

0 commit comments

Comments
 (0)