Skip to content

Commit c17414a

Browse files
committed
Merge tag 'sh-for-v6.5-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux
Pull sh updates from Adrian Glaubitz: "Fix a compiler warning in the J2 probing code and a fix by Sergey Shtylyov to avoid using IRQ0 on SH3 and SH4 targets. Masahiro Yamada made some clean-up in the build system to address reports by the 0day bot. The most notable changes come from Artur Rojek who addressed a number of issues in the DMA code, in particular a fix for the DMA channel offset calculation that was introduced in in 7f47c71 ("sh: dma: More legacy cpu dma chainsawing.") in 2012! Together with another change to correct the number of DMA channels for each SuperH SoC according to specification, Artur's series unbreaks the kernel on the SH7709 SoC allowing Linux to boot on the HP Jornada 680 handheld again. Summary: - Provide unxlate_dev_mem_ptr() in asm/io.h - dma: Correct the number of DMA channels for SH7709 - dma: Drop incorrect SH_DMAC_BASE1 definition for SH4 - dma: Fix DMA channel offset calculation - Remove compiler flag duplication - Refactor header include path addition - Move build rule for cchips/hd6446x/ to arch/sh/Kbuild - Fix -Wmissing-include-dirs warnings for various platforms - Avoid using IRQ0 on SH3 and SH4 - j2: Use ioremap() to translate device tree address into kernel memory" * tag 'sh-for-v6.5-tag1' of git://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux: sh: Provide unxlate_dev_mem_ptr() in asm/io.h sh: dma: Correct the number of DMA channels for SH7709 sh: dma: Drop incorrect SH_DMAC_BASE1 definition for SH4 sh: dma: Fix DMA channel offset calculation sh: Remove compiler flag duplication sh: Refactor header include path addition sh: Move build rule for cchips/hd6446x/ to arch/sh/Kbuild sh: Fix -Wmissing-include-dirs warnings for various platforms sh: Avoid using IRQ0 on SH3 and SH4 sh: j2: Use ioremap() to translate device tree address into kernel memory
2 parents 7afb9d7 + 7497840 commit c17414a

14 files changed

Lines changed: 66 additions & 54 deletions

File tree

arch/sh/Kbuild

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ obj-y += kernel/ mm/ boards/
33
obj-$(CONFIG_SH_FPU_EMU) += math-emu/
44
obj-$(CONFIG_USE_BUILTIN_DTB) += boot/dts/
55

6+
obj-$(CONFIG_HD6446X_SERIES) += cchips/hd6446x/
7+
68
# for cleaning
79
subdir- += boot

arch/sh/Makefile

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,34 +116,15 @@ export ld-bfd
116116

117117
# Mach groups
118118
machdir-$(CONFIG_SOLUTION_ENGINE) += mach-se
119-
machdir-$(CONFIG_SH_HP6XX) += mach-hp6xx
120119
machdir-$(CONFIG_SH_DREAMCAST) += mach-dreamcast
121120
machdir-$(CONFIG_SH_SH03) += mach-sh03
122-
machdir-$(CONFIG_SH_RTS7751R2D) += mach-r2d
123-
machdir-$(CONFIG_SH_HIGHLANDER) += mach-highlander
124121
machdir-$(CONFIG_SH_MIGOR) += mach-migor
125-
machdir-$(CONFIG_SH_AP325RXA) += mach-ap325rxa
126122
machdir-$(CONFIG_SH_KFR2R09) += mach-kfr2r09
127123
machdir-$(CONFIG_SH_ECOVEC) += mach-ecovec24
128-
machdir-$(CONFIG_SH_SDK7780) += mach-sdk7780
129124
machdir-$(CONFIG_SH_SDK7786) += mach-sdk7786
130125
machdir-$(CONFIG_SH_X3PROTO) += mach-x3proto
131-
machdir-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp
132-
machdir-$(CONFIG_SH_SH4202_MICRODEV) += mach-microdev
133126
machdir-$(CONFIG_SH_LANDISK) += mach-landisk
134-
machdir-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2
135-
machdir-$(CONFIG_SH_RSK) += mach-rsk
136-
137-
ifneq ($(machdir-y),)
138-
core-y += $(addprefix arch/sh/boards/, \
139-
$(filter-out ., $(patsubst %,%/,$(machdir-y))))
140-
endif
141-
142-
# Common machine type headers. Not part of the arch/sh/boards/ hierarchy.
143-
machdir-y += mach-common
144-
145-
# Companion chips
146-
core-$(CONFIG_HD6446X_SERIES) += arch/sh/cchips/hd6446x/
127+
machdir-y += mach-common
147128

148129
#
149130
# CPU header paths
@@ -164,11 +145,8 @@ cpuincdir-y += cpu-common # Must be last
164145

165146
drivers-y += arch/sh/drivers/
166147

167-
cflags-y += $(foreach d, $(cpuincdir-y), -I $(srctree)/arch/sh/include/$(d)) \
168-
$(foreach d, $(machdir-y), -I $(srctree)/arch/sh/include/$(d))
169-
148+
KBUILD_CPPFLAGS += $(addprefix -I $(srctree)/arch/sh/include/, $(cpuincdir-y) $(machdir-y))
170149
KBUILD_CFLAGS += -pipe $(cflags-y)
171-
KBUILD_CPPFLAGS += $(cflags-y)
172150
KBUILD_AFLAGS += $(cflags-y)
173151

174152
ifeq ($(CONFIG_MCOUNT),y)

arch/sh/boards/Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,22 @@ obj-$(CONFIG_SH_APSH4A3A) += board-apsh4a3a.o
1818
obj-$(CONFIG_SH_APSH4AD0A) += board-apsh4ad0a.o
1919

2020
obj-$(CONFIG_SH_DEVICE_TREE) += of-generic.o
21+
22+
obj-$(CONFIG_SOLUTION_ENGINE) += mach-se/
23+
obj-$(CONFIG_SH_HP6XX) += mach-hp6xx/
24+
obj-$(CONFIG_SH_DREAMCAST) += mach-dreamcast/
25+
obj-$(CONFIG_SH_SH03) += mach-sh03/
26+
obj-$(CONFIG_SH_RTS7751R2D) += mach-r2d/
27+
obj-$(CONFIG_SH_HIGHLANDER) += mach-highlander/
28+
obj-$(CONFIG_SH_MIGOR) += mach-migor/
29+
obj-$(CONFIG_SH_AP325RXA) += mach-ap325rxa/
30+
obj-$(CONFIG_SH_KFR2R09) += mach-kfr2r09/
31+
obj-$(CONFIG_SH_ECOVEC) += mach-ecovec24/
32+
obj-$(CONFIG_SH_SDK7780) += mach-sdk7780/
33+
obj-$(CONFIG_SH_SDK7786) += mach-sdk7786/
34+
obj-$(CONFIG_SH_X3PROTO) += mach-x3proto/
35+
obj-$(CONFIG_SH_SH7763RDP) += mach-sh7763rdp/
36+
obj-$(CONFIG_SH_SH4202_MICRODEV)+= mach-microdev/
37+
obj-$(CONFIG_SH_LANDISK) += mach-landisk/
38+
obj-$(CONFIG_SH_LBOX_RE2) += mach-lboxre2/
39+
obj-$(CONFIG_SH_RSK) += mach-rsk/

arch/sh/drivers/dma/Kconfig

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,19 @@ config SH_DMA_API
2828
config NR_ONCHIP_DMA_CHANNELS
2929
int
3030
depends on SH_DMA
31-
default "4" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7751 || \
32-
CPU_SUBTYPE_SH7750S || CPU_SUBTYPE_SH7091
31+
default "4" if CPU_SUBTYPE_SH7709 || CPU_SUBTYPE_SH7750 || \
32+
CPU_SUBTYPE_SH7750S || CPU_SUBTYPE_SH7751 || \
33+
CPU_SUBTYPE_SH7091
3334
default "8" if CPU_SUBTYPE_SH7750R || CPU_SUBTYPE_SH7751R || \
3435
CPU_SUBTYPE_SH7760
35-
default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7780 || \
36-
CPU_SUBTYPE_SH7785 || CPU_SUBTYPE_SH7724
36+
default "12" if CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7724 || \
37+
CPU_SUBTYPE_SH7780 || CPU_SUBTYPE_SH7785
3738
default "6"
3839
help
3940
This allows you to specify the number of channels that the on-chip
40-
DMAC supports. This will be 4 for SH7750/SH7751/Sh7750S/SH7091 and 8 for the
41-
SH7750R/SH7751R/SH7760, 12 for the SH7723/SH7780/SH7785/SH7724, default is 6.
41+
DMAC supports. This will be 4 for SH7709/SH7750/SH7750S/SH7751/SH7091,
42+
8 for SH7750R/SH7751R/SH7760, and 12 for SH7723/SH7724/SH7780/SH7785.
43+
Default is 6.
4244

4345
config SH_DMABRG
4446
bool "SH7760 DMABRG support"

arch/sh/drivers/dma/dma-sh.c

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,18 @@
1818
#include <cpu/dma-register.h>
1919
#include <cpu/dma.h>
2020

21+
/*
22+
* Some of the SoCs feature two DMAC modules. In such a case, the channels are
23+
* distributed equally among them.
24+
*/
25+
#ifdef SH_DMAC_BASE1
26+
#define SH_DMAC_NR_MD_CH (CONFIG_NR_ONCHIP_DMA_CHANNELS / 2)
27+
#else
28+
#define SH_DMAC_NR_MD_CH CONFIG_NR_ONCHIP_DMA_CHANNELS
29+
#endif
30+
31+
#define SH_DMAC_CH_SZ 0x10
32+
2133
/*
2234
* Define the default configuration for dual address memory-memory transfer.
2335
* The 0x400 value represents auto-request, external->external.
@@ -29,7 +41,7 @@ static unsigned long dma_find_base(unsigned int chan)
2941
unsigned long base = SH_DMAC_BASE0;
3042

3143
#ifdef SH_DMAC_BASE1
32-
if (chan >= 6)
44+
if (chan >= SH_DMAC_NR_MD_CH)
3345
base = SH_DMAC_BASE1;
3446
#endif
3547

@@ -40,13 +52,13 @@ static unsigned long dma_base_addr(unsigned int chan)
4052
{
4153
unsigned long base = dma_find_base(chan);
4254

43-
/* Normalize offset calculation */
44-
if (chan >= 9)
45-
chan -= 6;
46-
if (chan >= 4)
47-
base += 0x10;
55+
chan = (chan % SH_DMAC_NR_MD_CH) * SH_DMAC_CH_SZ;
56+
57+
/* DMAOR is placed inside the channel register space. Step over it. */
58+
if (chan >= DMAOR)
59+
base += SH_DMAC_CH_SZ;
4860

49-
return base + (chan * 0x10);
61+
return base + chan;
5062
}
5163

5264
#ifdef CONFIG_SH_DMA_IRQ_MULTI
@@ -250,12 +262,11 @@ static int sh_dmac_get_dma_residue(struct dma_channel *chan)
250262
#define NR_DMAOR 1
251263
#endif
252264

253-
/*
254-
* DMAOR bases are broken out amongst channel groups. DMAOR0 manages
255-
* channels 0 - 5, DMAOR1 6 - 11 (optional).
256-
*/
257-
#define dmaor_read_reg(n) __raw_readw(dma_find_base((n)*6))
258-
#define dmaor_write_reg(n, data) __raw_writew(data, dma_find_base(n)*6)
265+
#define dmaor_read_reg(n) __raw_readw(dma_find_base((n) * \
266+
SH_DMAC_NR_MD_CH) + DMAOR)
267+
#define dmaor_write_reg(n, data) __raw_writew(data, \
268+
dma_find_base((n) * \
269+
SH_DMAC_NR_MD_CH) + DMAOR)
259270

260271
static inline int dmaor_reset(int no)
261272
{

arch/sh/include/asm/io.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ static inline void iounmap(volatile void __iomem *addr) { }
286286
* access
287287
*/
288288
#define xlate_dev_mem_ptr(p) __va(p)
289+
#define unxlate_dev_mem_ptr(p, v) do { } while (0)
289290

290291
#define ARCH_HAS_VALID_PHYS_ADDR_RANGE
291292
int valid_phys_addr_range(phys_addr_t addr, size_t size);

arch/sh/include/cpu-sh4/cpu/dma.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@
1313
#define DMAE0_IRQ evt2irq(0x6c0)
1414

1515
#define SH_DMAC_BASE0 0xffa00000
16-
#define SH_DMAC_BASE1 0xffa00070
1716

1817
#endif /* __ASM_CPU_SH4_DMA_H */

arch/sh/include/mach-common/mach/highlander.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
#define IVDR_CK_ON 4 /* iVDR Clock ON */
177177
#endif
178178

179-
#define HL_FPGA_IRQ_BASE 200
179+
#define HL_FPGA_IRQ_BASE (200 + 16)
180180
#define HL_NR_IRL 15
181181

182182
#define IRQ_AX88796 (HL_FPGA_IRQ_BASE + 0)

arch/sh/include/mach-common/mach/r2d.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
#define IRLCNTR1 (PA_BCR + 0) /* Interrupt Control Register1 */
4949

50-
#define R2D_FPGA_IRQ_BASE 100
50+
#define R2D_FPGA_IRQ_BASE (100 + 16)
5151

5252
#define IRQ_VOYAGER (R2D_FPGA_IRQ_BASE + 0)
5353
#define IRQ_EXT (R2D_FPGA_IRQ_BASE + 1)

arch/sh/include/mach-dreamcast/mach/sysasic.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
takes.
2323
*/
2424

25-
#define HW_EVENT_IRQ_BASE 48
25+
#define HW_EVENT_IRQ_BASE (48 + 16)
2626

2727
/* IRQ 13 */
2828
#define HW_EVENT_VSYNC (HW_EVENT_IRQ_BASE + 5) /* VSync */

0 commit comments

Comments
 (0)