Skip to content

Commit f8f44f0

Browse files
committed
Merge branch 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x
* 'sh-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-3.x: sh: sh7724: Add USBHS DMAEngine support sh: ecovec: Add renesas_usbhs support sh, exec: remove redundant set_fs(USER_DS) drivers: sh: resume enabled clocks fix dmaengine: shdma: SH_DMAC_MAX_CHANNELS message fix sh: Fix up xchg/cmpxchg corruption with gUSA RB. sh: Remove compressed kernel libgcc dependency. sh: fix wrong icache/dcache address-array start addr in cache-debugfs.
2 parents f49cc57 + 261a9af commit f8f44f0

10 files changed

Lines changed: 140 additions & 42 deletions

File tree

‎arch/sh/boards/mach-ecovec24/setup.c‎

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/io.h>
2121
#include <linux/delay.h>
2222
#include <linux/usb/r8a66597.h>
23+
#include <linux/usb/renesas_usbhs.h>
2324
#include <linux/i2c.h>
2425
#include <linux/i2c/tsc2007.h>
2526
#include <linux/spi/spi.h>
@@ -232,6 +233,52 @@ static struct platform_device usb1_common_device = {
232233
.resource = usb1_common_resources,
233234
};
234235

236+
/*
237+
* USBHS
238+
*/
239+
static int usbhs_get_id(struct platform_device *pdev)
240+
{
241+
return gpio_get_value(GPIO_PTB3);
242+
}
243+
244+
static struct renesas_usbhs_platform_info usbhs_info = {
245+
.platform_callback = {
246+
.get_id = usbhs_get_id,
247+
},
248+
.driver_param = {
249+
.buswait_bwait = 4,
250+
.detection_delay = 5,
251+
},
252+
};
253+
254+
static struct resource usbhs_resources[] = {
255+
[0] = {
256+
.start = 0xa4d90000,
257+
.end = 0xa4d90124 - 1,
258+
.flags = IORESOURCE_MEM,
259+
},
260+
[1] = {
261+
.start = 66,
262+
.end = 66,
263+
.flags = IORESOURCE_IRQ,
264+
},
265+
};
266+
267+
static struct platform_device usbhs_device = {
268+
.name = "renesas_usbhs",
269+
.id = 1,
270+
.dev = {
271+
.dma_mask = NULL, /* not use dma */
272+
.coherent_dma_mask = 0xffffffff,
273+
.platform_data = &usbhs_info,
274+
},
275+
.num_resources = ARRAY_SIZE(usbhs_resources),
276+
.resource = usbhs_resources,
277+
.archdata = {
278+
.hwblk_id = HWBLK_USB1,
279+
},
280+
};
281+
235282
/* LCDC */
236283
const static struct fb_videomode ecovec_lcd_modes[] = {
237284
{
@@ -897,6 +944,7 @@ static struct platform_device *ecovec_devices[] __initdata = {
897944
&sh_eth_device,
898945
&usb0_host_device,
899946
&usb1_common_device,
947+
&usbhs_device,
900948
&lcdc_device,
901949
&ceu0_device,
902950
&ceu1_device,

‎arch/sh/boot/compressed/Makefile‎

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
2727
$(CONFIG_BOOT_LINK_OFFSET)]')
2828
endif
2929

30-
LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name)
31-
3230
ifeq ($(CONFIG_MCOUNT),y)
3331
ORIG_CFLAGS := $(KBUILD_CFLAGS)
3432
KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
@@ -37,7 +35,25 @@ endif
3735
LDFLAGS_vmlinux := --oformat $(ld-bfd) -Ttext $(IMAGE_OFFSET) -e startup \
3836
-T $(obj)/../../kernel/vmlinux.lds
3937

40-
$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(LIBGCC) FORCE
38+
#
39+
# Pull in the necessary libgcc bits from the in-kernel implementation.
40+
#
41+
lib1funcs-$(CONFIG_SUPERH32) := ashiftrt.S ashldi3.c ashrsi3.S ashlsi3.S \
42+
lshrsi3.S
43+
lib1funcs-obj := \
44+
$(addsuffix .o, $(basename $(addprefix $(obj)/, $(lib1funcs-y))))
45+
46+
lib1funcs-dir := $(srctree)/arch/$(SRCARCH)/lib
47+
ifeq ($(BITS),64)
48+
lib1funcs-dir := $(addsuffix $(BITS), $(lib1funcs-dir))
49+
endif
50+
51+
KBUILD_CFLAGS += -I$(lib1funcs-dir)
52+
53+
$(addprefix $(obj)/,$(lib1funcs-y)): $(obj)/%: $(lib1funcs-dir)/% FORCE
54+
$(call cmd,shipped)
55+
56+
$(obj)/vmlinux: $(OBJECTS) $(obj)/piggy.o $(lib1funcs-obj) FORCE
4157
$(call if_changed,ld)
4258
@:
4359

‎arch/sh/include/asm/cmpxchg-grb.h‎

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
1515
" mov.l %2, @%1 \n\t" /* store new value */
1616
"1: mov r1, r15 \n\t" /* LOGOUT */
1717
: "=&r" (retval),
18-
"+r" (m)
19-
: "r" (val)
18+
"+r" (m),
19+
"+r" (val) /* inhibit r15 overloading */
20+
:
2021
: "memory", "r0", "r1");
2122

2223
return retval;
@@ -36,8 +37,9 @@ static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
3637
" mov.b %2, @%1 \n\t" /* store new value */
3738
"1: mov r1, r15 \n\t" /* LOGOUT */
3839
: "=&r" (retval),
39-
"+r" (m)
40-
: "r" (val)
40+
"+r" (m),
41+
"+r" (val) /* inhibit r15 overloading */
42+
:
4143
: "memory" , "r0", "r1");
4244

4345
return retval;
@@ -54,13 +56,14 @@ static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
5456
" nop \n\t"
5557
" mov r15, r1 \n\t" /* r1 = saved sp */
5658
" mov #-8, r15 \n\t" /* LOGIN */
57-
" mov.l @%1, %0 \n\t" /* load old value */
58-
" cmp/eq %0, %2 \n\t"
59+
" mov.l @%3, %0 \n\t" /* load old value */
60+
" cmp/eq %0, %1 \n\t"
5961
" bf 1f \n\t" /* if not equal */
60-
" mov.l %3, @%1 \n\t" /* store new value */
62+
" mov.l %2, @%3 \n\t" /* store new value */
6163
"1: mov r1, r15 \n\t" /* LOGOUT */
62-
: "=&r" (retval)
63-
: "r" (m), "r" (old), "r" (new)
64+
: "=&r" (retval),
65+
"+r" (old), "+r" (new) /* old or new can be r15 */
66+
: "r" (m)
6467
: "memory" , "r0", "r1", "t");
6568

6669
return retval;

‎arch/sh/include/asm/processor_64.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ struct thread_struct {
150150
#define SR_USER (SR_MMU | SR_FD)
151151

152152
#define start_thread(_regs, new_pc, new_sp) \
153-
set_fs(USER_DS); \
154153
_regs->sr = SR_USER; /* User mode. */ \
155154
_regs->pc = new_pc - 4; /* Compensate syscall exit */ \
156155
_regs->pc |= 1; /* Set SHmedia ! */ \

‎arch/sh/include/cpu-sh4/cpu/sh7724.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,14 @@ enum {
298298
SHDMA_SLAVE_SCIF4_RX,
299299
SHDMA_SLAVE_SCIF5_TX,
300300
SHDMA_SLAVE_SCIF5_RX,
301+
SHDMA_SLAVE_USB0D0_TX,
302+
SHDMA_SLAVE_USB0D0_RX,
303+
SHDMA_SLAVE_USB0D1_TX,
304+
SHDMA_SLAVE_USB0D1_RX,
305+
SHDMA_SLAVE_USB1D0_TX,
306+
SHDMA_SLAVE_USB1D0_RX,
307+
SHDMA_SLAVE_USB1D1_TX,
308+
SHDMA_SLAVE_USB1D1_RX,
301309
SHDMA_SLAVE_SDHI0_TX,
302310
SHDMA_SLAVE_SDHI0_RX,
303311
SHDMA_SLAVE_SDHI1_TX,

‎arch/sh/kernel/cpu/sh4a/setup-sh7724.c‎

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,46 @@ static const struct sh_dmae_slave_config sh7724_dmae_slaves[] = {
9292
.addr = 0xa4e50024,
9393
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_8BIT),
9494
.mid_rid = 0x36,
95+
}, {
96+
.slave_id = SHDMA_SLAVE_USB0D0_TX,
97+
.addr = 0xA4D80100,
98+
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
99+
.mid_rid = 0x73,
100+
}, {
101+
.slave_id = SHDMA_SLAVE_USB0D0_RX,
102+
.addr = 0xA4D80100,
103+
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
104+
.mid_rid = 0x73,
105+
}, {
106+
.slave_id = SHDMA_SLAVE_USB0D1_TX,
107+
.addr = 0xA4D80120,
108+
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
109+
.mid_rid = 0x77,
110+
}, {
111+
.slave_id = SHDMA_SLAVE_USB0D1_RX,
112+
.addr = 0xA4D80120,
113+
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
114+
.mid_rid = 0x77,
115+
}, {
116+
.slave_id = SHDMA_SLAVE_USB1D0_TX,
117+
.addr = 0xA4D90100,
118+
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
119+
.mid_rid = 0xab,
120+
}, {
121+
.slave_id = SHDMA_SLAVE_USB1D0_RX,
122+
.addr = 0xA4D90100,
123+
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
124+
.mid_rid = 0xab,
125+
}, {
126+
.slave_id = SHDMA_SLAVE_USB1D1_TX,
127+
.addr = 0xA4D90120,
128+
.chcr = DM_FIX | SM_INC | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
129+
.mid_rid = 0xaf,
130+
}, {
131+
.slave_id = SHDMA_SLAVE_USB1D1_RX,
132+
.addr = 0xA4D90120,
133+
.chcr = DM_INC | SM_FIX | 0x800 | TS_INDEX2VAL(XMIT_SZ_32BIT),
134+
.mid_rid = 0xaf,
95135
}, {
96136
.slave_id = SHDMA_SLAVE_SDHI0_TX,
97137
.addr = 0x04ce0030,

‎arch/sh/kernel/process_32.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,6 @@ EXPORT_SYMBOL(kernel_thread);
102102
void start_thread(struct pt_regs *regs, unsigned long new_pc,
103103
unsigned long new_sp)
104104
{
105-
set_fs(USER_DS);
106-
107105
regs->pr = 0;
108106
regs->sr = SR_FD;
109107
regs->pc = new_pc;

‎arch/sh/mm/cache-debugfs.c‎

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ static int cache_seq_show(struct seq_file *file, void *iter)
2626
{
2727
unsigned int cache_type = (unsigned int)file->private;
2828
struct cache_info *cache;
29-
unsigned int waysize, way, cache_size;
30-
unsigned long ccr, base;
31-
static unsigned long addrstart = 0;
29+
unsigned int waysize, way;
30+
unsigned long ccr;
31+
unsigned long addrstart = 0;
3232

3333
/*
3434
* Go uncached immediately so we don't skew the results any
@@ -45,28 +45,13 @@ static int cache_seq_show(struct seq_file *file, void *iter)
4545
}
4646

4747
if (cache_type == CACHE_TYPE_DCACHE) {
48-
base = CACHE_OC_ADDRESS_ARRAY;
48+
addrstart = CACHE_OC_ADDRESS_ARRAY;
4949
cache = &current_cpu_data.dcache;
5050
} else {
51-
base = CACHE_IC_ADDRESS_ARRAY;
51+
addrstart = CACHE_IC_ADDRESS_ARRAY;
5252
cache = &current_cpu_data.icache;
5353
}
5454

55-
/*
56-
* Due to the amount of data written out (depending on the cache size),
57-
* we may be iterated over multiple times. In this case, keep track of
58-
* the entry position in addrstart, and rewind it when we've hit the
59-
* end of the cache.
60-
*
61-
* Likewise, the same code is used for multiple caches, so care must
62-
* be taken for bouncing addrstart back and forth so the appropriate
63-
* cache is hit.
64-
*/
65-
cache_size = cache->ways * cache->sets * cache->linesz;
66-
if (((addrstart & 0xff000000) != base) ||
67-
(addrstart & 0x00ffffff) > cache_size)
68-
addrstart = base;
69-
7055
waysize = cache->sets;
7156

7257
/*

‎drivers/dma/shdma.c‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
12211221
} else {
12221222
do {
12231223
for (i = chanirq_res->start; i <= chanirq_res->end; i++) {
1224+
if (irq_cnt >= SH_DMAC_MAX_CHANNELS) {
1225+
irq_cap = 1;
1226+
break;
1227+
}
1228+
12241229
if ((errirq_res->flags & IORESOURCE_BITS) ==
12251230
IORESOURCE_IRQ_SHAREABLE)
12261231
chan_flag[irq_cnt] = IRQF_SHARED;
@@ -1230,15 +1235,11 @@ static int __init sh_dmae_probe(struct platform_device *pdev)
12301235
"Found IRQ %d for channel %d\n",
12311236
i, irq_cnt);
12321237
chan_irq[irq_cnt++] = i;
1233-
1234-
if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
1235-
break;
12361238
}
12371239

1238-
if (irq_cnt >= SH_DMAC_MAX_CHANNELS) {
1239-
irq_cap = 1;
1240+
if (irq_cnt >= SH_DMAC_MAX_CHANNELS)
12401241
break;
1241-
}
1242+
12421243
chanirq_res = platform_get_resource(pdev,
12431244
IORESOURCE_IRQ, ++irqres);
12441245
} while (irq_cnt < pdata->channel_num && chanirq_res);

‎drivers/sh/clk/core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ static void clks_core_resume(void)
635635
struct clk *clkp;
636636

637637
list_for_each_entry(clkp, &clock_list, node) {
638-
if (likely(clkp->ops)) {
638+
if (likely(clkp->usecount && clkp->ops)) {
639639
unsigned long rate = clkp->rate;
640640

641641
if (likely(clkp->ops->set_parent))

0 commit comments

Comments
 (0)