* [PATCH RESEND 1/2] sh: guard SH4 no-FPU compiler fallback
2026-10-02 4:07 [PATCH RESEND 0/2] sh: add initial SH7305 CPU support Artem Novak
@ 2026-10-02 4:07 ` Artem Novak
2026-10-02 4:08 ` [PATCH RESEND 2/2] sh: add SH7305 CPU subtype support Artem Novak
1 sibling, 0 replies; 3+ messages in thread
From: Artem Novak @ 2026-10-02 4:07 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-kernel, cacioandpepe
From: cacioandpepe <artem122novak@gmail.com>
The SH4 compiler flag selection falls back to -m4-nofpu when
-mno-implicit-fp is unavailable without checking whether the compiler
supports -m4-nofpu itself.
This breaks SH4A-only toolchains which support -m4a and -m4a-nofpu
but do not provide the plain SH4 -m4-nofpu option.
Use a nested cc-option so the fallback is emitted only when supported.
Signed-off-by: cacioandpepe <artem122novak@gmail.com>
---
arch/sh/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 7b420424b6d7..238c701ab14b 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -36,7 +36,7 @@ cflags-$(CONFIG_CPU_SH2A) += $(call cc-option,-m2a,) \
$(call cc-option,-m4-nofpu,)
cflags-$(CONFIG_CPU_SH3) := $(call cc-option,-m3,)
cflags-$(CONFIG_CPU_SH4) := $(call cc-option,-m4,) \
- $(call cc-option,-mno-implicit-fp,-m4-nofpu)
+ $(call cc-option,-mno-implicit-fp,$(call cc-option,-m4-nofpu,))
cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a,) \
$(call cc-option,-m4a-nofpu,)
cflags-$(CONFIG_CPU_SH4AL_DSP) += $(call cc-option,-m4al,)
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH RESEND 2/2] sh: add SH7305 CPU subtype support
2026-10-02 4:07 [PATCH RESEND 0/2] sh: add initial SH7305 CPU support Artem Novak
2026-10-02 4:07 ` [PATCH RESEND 1/2] sh: guard SH4 no-FPU compiler fallback Artem Novak
@ 2026-10-02 4:08 ` Artem Novak
1 sibling, 0 replies; 3+ messages in thread
From: Artem Novak @ 2026-10-02 4:08 UTC (permalink / raw)
To: John Paul Adrian Glaubitz; +Cc: linux-sh, linux-kernel, cacioandpepe
From: cacioandpepe <artem122novak@gmail.com>
Add the SH7305 as an SH4AL-DSP CPU subtype.
Recognize the SH7305 in the SH-4 CPU probe using the existing
0x300b PVR family with PRR value 0xc0, and expose the processor
name through the SH CPU information interface.
Signed-off-by: cacioandpepe <artem122novak@gmail.com>
---
arch/sh/Kconfig | 9 +++++++++
arch/sh/include/asm/processor.h | 2 +-
arch/sh/kernel/cpu/proc.c | 3 ++-
arch/sh/kernel/cpu/sh4/probe.c | 3 +++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index d60f1d5a94c0..e71b5476769e 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -467,6 +467,15 @@ config CPU_SUBTYPE_SHX3
# SH4AL-DSP Processor Support
+config CPU_SUBTYPE_SH7305
+ bool "Support SH7305 processor"
+ select CPU_SH4AL_DSP
+ help
+ Select this option to build the kernel for systems based on the
+ Renesas SH7305 processor. The SH7305 belongs to the SH4AL-DSP
+ processor family and is used in embedded systems such as Casio
+ graphing calculators.
+
config CPU_SUBTYPE_SH7343
bool "Support SH7343 processor"
select CPU_SH4AL_DSP
diff --git a/arch/sh/include/asm/processor.h b/arch/sh/include/asm/processor.h
index 2a0b5713ab80..96321c46ce85 100644
--- a/arch/sh/include/asm/processor.h
+++ b/arch/sh/include/asm/processor.h
@@ -36,7 +36,7 @@ enum cpu_type {
CPU_SH7723, CPU_SH7724, CPU_SH7757, CPU_SH7734, CPU_SHX3,
/* SH4AL-DSP types */
- CPU_SH7343, CPU_SH7722, CPU_SH7366, CPU_SH7372,
+ CPU_SH7343, CPU_SH7305, CPU_SH7722, CPU_SH7366, CPU_SH7372,
/* Unknown subtype */
CPU_SH_NONE
diff --git a/arch/sh/kernel/cpu/proc.c b/arch/sh/kernel/cpu/proc.c
index 5f6d0e827bae..b6fbe27742e0 100644
--- a/arch/sh/kernel/cpu/proc.c
+++ b/arch/sh/kernel/cpu/proc.c
@@ -25,7 +25,8 @@ static const char *cpu_name[] = {
[CPU_SH7786] = "SH7786", [CPU_SH7757] = "SH7757",
[CPU_SH7722] = "SH7722", [CPU_SHX3] = "SH-X3",
[CPU_MXG] = "MX-G", [CPU_SH7723] = "SH7723",
- [CPU_SH7366] = "SH7366", [CPU_SH7724] = "SH7724",
+ [CPU_SH7305] = "SH7305", [CPU_SH7366] = "SH7366",
+ [CPU_SH7724] = "SH7724",
[CPU_SH7372] = "SH7372", [CPU_SH7734] = "SH7734",
[CPU_J2] = "J2",
[CPU_SH_NONE] = "Unknown"
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index ef4dd6295263..7f77fc64258c 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -143,6 +143,9 @@ void cpu_probe(void)
break;
case 0x300b:
switch (prr) {
+ case 0xc0:
+ boot_cpu_data.type = CPU_SH7305;
+ break;
case 0x20:
boot_cpu_data.type = CPU_SH7724;
boot_cpu_data.flags |= CPU_HAS_L2_CACHE;
--
2.55.0
^ permalink raw reply [flat|nested] 3+ messages in thread