Skip to contentSkip to conversation

Device Tree support for SH7751 based board

RFC PATCH Superseded Yoshinori Sato 11 participants 91 messages Oct 14, 2023 – Nov 8, 2023

Subsystems (15)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Yoshinori Sato

author maintainer
#0 lore raw

v3 cover Device Tree support for SH7751 based board

This is an updated version of something I wrote about 7 years ago. Minimum support for R2D-plus and LANDISK.
I think R2D-1 will work if you add AX88796 to dts.
And board-specific functions and SCI's SPI functions are not supported.

v3 changes.
- Rewrite clk drivers.
- Added sh_tmu to OF support.
- Cleanup PCI stuff.
- Update sm501 and sm501fb OF support.
- Update devicetree and documents.

v2 changes.
- Rebasing v6,6-rc1
- re-write irqchip driver.
- Add binding documents.
- Cleanup review comment.

Yoshinori Sato (35):
arch/sh/boot/compressed/head_32.S: passing FDT address to initialize
function.
arch/sh/boards/Kconfig: unified OF supported targets. arch/sh: Disable SH specific modules in OF enabled. include/linux/sh_intc.h: Add stub function "intc_finalize". arch/sh/kernel/setup.c: Update DT support. arch/sh/boards/of-generic.c: some cleanup. arch/sh/kernel/time.c: support COMMON_CLK. arch/sh/include/asm: Disable SH specific PCI define in OF enabled. drivers/pci/controller: SH7751 PCI Host bridge driver. Documentation/devicetree/bindings/pci: renesas,pci-sh7751.yaml new
file.
include/dt-bindings/clock/sh7750.h: cpg-sh7750 binding header. drivers/clk/renesas: clk-sh7750.c SH7750/7751 CPG driver. Documentation/devicetree/bindings/clock: Add renesas,sh7750-cpg
binding document.
drivers/irqchip: Add SH7751 Internal INTC drivers. Documentation/devicetree/bindings/interrupt-controller: Add

    renesas,sh7751-intc.yaml
  drivers/irqchip: SH7751 IRL external encoder with enable gate.
  Documentation/devicetree/bindings/interrupt-controller: Add
    renesas,sh7751-irl-ext.yaml
  drivers/tty/serial: sh-sci.c fix SH4 OF support.
  Documentation/devicetree/bindings/serial: renesas,scif.yaml Add SH.
  drivers/mfd: sm501 add some properties.
  devicetree/binding/display/sm501fb.txt: sm501fb add properies.
  drivers/clocksource/sh_tmu: Add support CLOCKSOURCE.
  Documentation/devicetree/bindings/timer: renesas,tmu.yaml add SH.
  include/dt-binding/interrupt-controller/sh_intc.h:
    renesas,sh7751-intc.h helper
  Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.
  arch/sh/boot/dts: SH7751R SoC Internal peripheral definition dtsi.
  Documentation/devicetree/bindings: vendor-prefix add IO DATA DEVICE
    Inc.
  Documentation/devicetree/bindings/ata: ata-generic.yaml add usl-5p and
    rts7751r2d.

Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751
based target.
arch/sh/boot/dts: RTS7751R2D Plus DeviceTree. arch/sh/boot/dts: LANDISK DeviceTree. arch/sh/boot/dts: USL-5P DeviceTree.
arch/sh: Add dtbs target support.
arch/sh: RTS7751R2D Plus OF defconfig
arch/sh/configs: LANDISK OF defconfig

 .../devicetree/bindings/ata/ata-generic.yaml  |   2 +
 .../bindings/clock/renesas,sh7750-cpg.yaml    |  74 ++
 .../devicetree/bindings/display/sm501fb.txt   |  17 +
 .../renesas,sh7751-intc.yaml                  | 102 +++
 .../renesas,sh7751-irl-ext.yaml               |  89 ++
 .../bindings/pci/renesas,pci-sh7751.yaml      | 123 +++
 .../bindings/serial/renesas,scif.yaml         |   5 +
 .../devicetree/bindings/sh/cpus.yaml          |  45 +
 .../devicetree/bindings/soc/renesas/sh.yaml   |  32 +
 .../bindings/timer/renesas,tmu.yaml           |  11 +-
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 arch/sh/Kconfig                               |   7 +-
 arch/sh/boards/Kconfig                        |  25 +-
 arch/sh/boards/of-generic.c                   |  28 +-
 arch/sh/boot/compressed/head_32.S             |   5 +-
 arch/sh/boot/dts/Makefile                     |   5 +
 arch/sh/boot/dts/landisk.dts                  |  79 ++
 arch/sh/boot/dts/rts7751r2dplus.dts           | 157 ++++
 arch/sh/boot/dts/sh7751r.dtsi                 | 148 ++++
 arch/sh/boot/dts/usl-5p.dts                   |  88 ++
 arch/sh/configs/landisk-of_defconfig          | 111 +++
 arch/sh/configs/rts7751r2dplus-of_defconfig   |  92 ++
 arch/sh/drivers/Makefile                      |   2 +
 arch/sh/include/asm/io.h                      |  14 +-
 arch/sh/include/asm/pci.h                     |   4 +
 arch/sh/kernel/cpu/Makefile                   |   9 +-
 arch/sh/kernel/cpu/sh4/Makefile               |   2 +
 arch/sh/kernel/setup.c                        |  36 +-
 arch/sh/kernel/time.c                         |  12 +
 drivers/clk/renesas/Kconfig                   |  21 +-
 drivers/clk/renesas/Makefile                  |   1 +
 drivers/clk/renesas/clk-sh7750.c              | 787 ++++++++++++++++++
 drivers/clocksource/sh_tmu.c                  | 161 ++--
 drivers/irqchip/Kconfig                       |  16 +
 drivers/irqchip/Makefile                      |   3 +
 drivers/irqchip/irq-renesas-sh7751.c          | 255 ++++++
 drivers/irqchip/irq-renesas-sh7751irl.c       | 206 +++++
 drivers/mfd/sm501.c                           | 113 +++
 drivers/pci/controller/Kconfig                |   9 +
 drivers/pci/controller/Makefile               |   1 +
 drivers/pci/controller/pci-sh7751.c           | 285 +++++++
 drivers/pci/controller/pci-sh7751.h           | 267 ++++++
 drivers/tty/serial/sh-sci.c                   |   6 +-
 drivers/video/fbdev/sm501fb.c                 |  92 ++
 include/dt-bindings/clock/sh7750.h            |  26 +
 .../interrupt-controller/sh_intc.h            |  18 +
 include/linux/sh_intc.h                       |   7 +-
 47 files changed, 3484 insertions(+), 116 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml
 create mode 100644 Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml
 create mode 100644 Documentation/devicetree/bindings/sh/cpus.yaml
 create mode 100644 Documentation/devicetree/bindings/soc/renesas/sh.yaml
 create mode 100644 arch/sh/boot/dts/landisk.dts
 create mode 100644 arch/sh/boot/dts/rts7751r2dplus.dts
 create mode 100644 arch/sh/boot/dts/sh7751r.dtsi
 create mode 100644 arch/sh/boot/dts/usl-5p.dts
 create mode 100644 arch/sh/configs/landisk-of_defconfig
 create mode 100644 arch/sh/configs/rts7751r2dplus-of_defconfig
 create mode 100644 drivers/clk/renesas/clk-sh7750.c
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
 create mode 100644 drivers/irqchip/irq-renesas-sh7751irl.c
 create mode 100644 drivers/pci/controller/pci-sh7751.c
 create mode 100644 drivers/pci/controller/pci-sh7751.h
 create mode 100644 include/dt-bindings/clock/sh7750.h
 create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h
Signature · 1 line
2.39.2
author maintainer
#1 lore raw

RFC PATCH v3 1/35 arch/sh/boot/compressed/head_32.S: passing FDT address to initialize function.

R4 is caller saved in SH ABI.
Save it so it doesn't get corrupted until it's needed for initialization.

---
 arch/sh/boot/compressed/head_32.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/sh/boot/compressed/head_32.S +3 -2
index 7bb168133dbb..c5227ef636c3 100644
@@ -15,7 +15,8 @@ startup:
 	/* Load initial status register */
 	mov.l   init_sr, r1
 	ldc     r1, sr
-
+	/* Save FDT address */
+	mov	r4, r13
 	/* Move myself to proper location if necessary */
 	mova	1f, r0
 	mov.l	1f, r2
@@ -84,7 +85,7 @@ l1:
 	/* Jump to the start of the decompressed kernel */
 	mov.l	kernel_start_addr, r0
 	jmp	@r0
-	nop
+	  mov	r13,r4
 	
 	.align	2
 bss_start_addr:
Signature · 1 line
2.39.2
#2 lore raw

Re: [RFC PATCH v3 01/35] arch/sh/boot/compressed/head_32.S: passing FDT address to initialize function.

Quoted 23 lines · Yoshinori Sato

R4 is caller saved in SH ABI.
Save it so it doesn't get corrupted until it's needed for initialization.

---
 arch/sh/boot/compressed/head_32.S | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/sh/boot/compressed/head_32.S +2 -1
index 7bb168133dbb..c5227ef636c3 100644
@@ -15,7 +15,8 @@ startup:
 	/* Load initial status register */
 	mov.l   init_sr, r1
 	ldc     r1, sr
-
+	/* Save FDT address */
+	mov	r4, r13
 	/* Move myself to proper location if necessary */
 	mova	1f, r0
 	mov.l	1f, r2

arch/sh/boot/compressed/head_32.S l1: · line 88

Quoted 5 lines
arch/sh/boot/compressed/head_32.S +1 -1
@@ -84,7 +85,7 @@ l1:
 	/* Jump to the start of the decompressed kernel */
 	mov.l	kernel_start_addr, r0
 	jmp	@r0
-	nop
+	  mov	r13,r4

I thought the usual convention for the delay slots is to do extra indentation
with 1 space, no? And you need a space after comma too... :-)

[...]

MBR, Sergey

author maintainer
#3 lore raw

RFC PATCH v3 2/35 arch/sh/boards/Kconfig: unified OF supported targets.

In reply to Yoshinori Sato

Targets that support OF should be treated as one board.

---
 arch/sh/boards/Kconfig | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)
arch/sh/boards/Kconfig +15 -10
index fafe15d3ba1d..745543e4fece 100644
@@ -19,16 +19,10 @@ config SH_DEVICE_TREE
 	select TIMER_OF
 	select COMMON_CLK
 	select GENERIC_CALIBRATE_DELAY
-
-config SH_JCORE_SOC
-	bool "J-Core SoC"
-	select SH_DEVICE_TREE
-	select CLKSRC_JCORE_PIT
-	select JCORE_AIC
-	depends on CPU_J2
-	help
-	  Select this option to include drivers core components of the
-	  J-Core SoC, including interrupt controllers and timers.
+	select GENERIC_IOMAP
+	select GENERIC_IRQ_CHIP
+	select SYS_SUPPORTS_PCI
+	select GENERIC_PCI_IOMAP if PCI
 
 config SH_SOLUTION_ENGINE
 	bool "SolutionEngine"
@@ -300,6 +294,7 @@ config SH_LANDISK
 	bool "LANDISK"
 	depends on CPU_SUBTYPE_SH7751R
 	select HAVE_PCI
+	select SYS_SUPPORTS_PCI
 	help
 	  I-O DATA DEVICE, INC. "LANDISK Series" support.
 
@@ -376,6 +371,16 @@ config SH_APSH4AD0A
 	help
 	  Select AP-SH4AD-0A if configuring for an ALPHAPROJECT AP-SH4AD-0A.
 
+config SH_OF_BOARD
+	bool "General Open Firmware boards"
+	select SH_DEVICE_TREE
+	select CLKSRC_JCORE_PIT if CPU_J2
+	select JCORE_AIC if CPU_J2
+	select HAVE_PCI if CPU_SUBTYPE_SH7751R
+	help
+	  This board means general OF supported targets.
+
+
 source "arch/sh/boards/mach-r2d/Kconfig"
 source "arch/sh/boards/mach-highlander/Kconfig"
 source "arch/sh/boards/mach-sdk7780/Kconfig"
Signature · 1 line
2.39.2
author maintainer
#4 lore raw

RFC PATCH v3 3/35 arch/sh: Disable SH specific modules in OF enabled.

In reply to Yoshinori Sato

IRQ, CLK and PCI will be migrated to a common driver. So if OF, disable the SH specific driver.

---
 arch/sh/Kconfig                 | 7 ++++---
 arch/sh/drivers/Makefile        | 2 ++
 arch/sh/kernel/cpu/Makefile     | 9 +++++++--
 arch/sh/kernel/cpu/sh4/Makefile | 2 ++
 4 files changed, 15 insertions(+), 5 deletions(-)
arch/sh/Kconfig +4 -3
index 33530b044953..a03dbfc92aad 100644
@@ -65,10 +65,10 @@ config SUPERH
 	select MODULES_USE_ELF_RELA
 	select NEED_SG_DMA_LENGTH
 	select NO_DMA if !MMU && !DMA_COHERENT
-	select NO_GENERIC_PCI_IOPORT_MAP if PCI
+	select NO_GENERIC_PCI_IOPORT_MAP if !SH_DEVICE_TREE
 	select OLD_SIGACTION
 	select OLD_SIGSUSPEND
-	select PCI_DOMAINS if PCI
+	select PCI_DOMAINS if PCI && !SH_DEVICE_TREE
 	select PERF_EVENTS
 	select PERF_USE_VMALLOC
 	select RTC_LIB
@@ -179,7 +179,7 @@ config CPU_SH4
 	select CPU_HAS_INTEVT
 	select CPU_HAS_SR_RB
 	select CPU_HAS_FPU if !CPU_SH4AL_DSP
-	select SH_INTC
+	select SH_INTC if !SH_DEVICE_TREE
 	select SYS_SUPPORTS_SH_TMU
 
 config CPU_SH4A
@@ -527,6 +527,7 @@ config SH_PCLK_FREQ
 
 config SH_CLK_CPG
 	def_bool y
+	depends on !COMMON_CLK
 
 config SH_CLK_CPG_LEGACY
 	depends on SH_CLK_CPG
arch/sh/drivers/Makefile +2 -0
index 56b0acace6e7..eacbcefb26b2 100644
@@ -5,7 +5,9 @@
 
 obj-y		+= dma/ platform_early.o
 
+ifndef CONFIG_SH_DEVICE_TREE
 obj-$(CONFIG_PCI)		+= pci/
+endif
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 obj-$(CONFIG_PUSH_SWITCH)	+= push-switch.o
 obj-$(CONFIG_HEARTBEAT)		+= heartbeat.o
arch/sh/kernel/cpu/Makefile +7 -2
index 46118236bf04..e00ebf134985 100644
@@ -16,6 +16,11 @@ obj-$(CONFIG_ARCH_SHMOBILE)	+= shmobile/
 # Common interfaces.
 
 obj-$(CONFIG_SH_ADC)		+= adc.o
+ifndef CONFIG_COMMON_CLK
+obj-y += clock.o
 obj-$(CONFIG_SH_CLK_CPG_LEGACY)	+= clock-cpg.o
-
-obj-y	+= irq/ init.o clock.o fpu.o pfc.o proc.o
+endif
+ifndef CONFIG_GENERIC_IRQ_CHIP
+obj-y	+= irq/
+endif
+obj-y	+= init.o fpu.o pfc.o proc.o
arch/sh/kernel/cpu/sh4/Makefile +2 -0
index 00c16331e07e..d8c3242c4a9f 100644
@@ -15,6 +15,7 @@ perf-$(CONFIG_CPU_SUBTYPE_SH7750)	:= perf_event.o
 perf-$(CONFIG_CPU_SUBTYPE_SH7750S)	:= perf_event.o
 perf-$(CONFIG_CPU_SUBTYPE_SH7091)	:= perf_event.o
 
+ifndef CONFIG_SH_DEVICE_TREE
 # CPU subtype setup
 obj-$(CONFIG_CPU_SUBTYPE_SH7750)	+= setup-sh7750.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7750R)	+= setup-sh7750.o
@@ -32,6 +33,7 @@ endif
 
 # Additional clocks by subtype
 clock-$(CONFIG_CPU_SUBTYPE_SH4_202)	+= clock-sh4-202.o
+endif # CONFIG_SH_DEVICE_TREE
 
 obj-y					+= $(clock-y)
 obj-$(CONFIG_PERF_EVENTS)		+= $(perf-y)
Signature · 1 line
2.39.2
#5 lore raw

Re: [RFC PATCH v3 03/35] arch/sh: Disable SH specific modules in OF enabled.

kernel test robot noticed the following build errors:

Hi Yoshinori,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next pci/next pci/for-linus linus/master v6.6-rc6 next-20231018] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yoshinori-Sato/arch-sh-boot-compressed-head_32-S-passing-FDT-address-to-initialize-function/20231017-170254
base:   tip/irq/core
patch link:    https://lore.kernel.org/r/7205f371a7bee68ffb9c34a6750d368676b49606.1697199949.git.ysato%40users.sourceforge.jp
patch subject: [RFC PATCH v3 03/35] arch/sh: Disable SH specific modules in OF enabled.
config: sh-allmodconfig (https://download.01.org/0day-ci/archive/20231019/[email protected]/config)
compiler: sh4-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> arch/sh/kernel/cpu/sh2/clock-sh7619.c:29:10: error: 'struct sh_clk_ops' has no member named 'init'
      29 |         .init           = master_clk_init,
         |          ^~~~
>> arch/sh/kernel/cpu/sh2/clock-sh7619.c:29:27: error: initialization of 'int (*)(struct clk *)' from incompatible pointer type 'void (*)(struct clk *)' [-Werror=incompatible-pointer-types]

29 | .init = master_clk_init,
| ^~~~~~~~~~~~~~~
arch/sh/kernel/cpu/sh2/clock-sh7619.c:29:27: note: (near initialization for 'sh7619_master_clk_ops.enable')
cc1: some warnings being treated as errors

vim +29 arch/sh/kernel/cpu/sh2/clock-sh7619.c

9d4436a6fbc8c5 Yoshinori Sato 2006-11-05 27

71984236d6112d Magnus Damm    2012-02-29  28  static struct sh_clk_ops sh7619_master_clk_ops = {
9d4436a6fbc8c5 Yoshinori Sato 2006-11-05 @29  	.init		= master_clk_init,
9d4436a6fbc8c5 Yoshinori Sato 2006-11-05  30  };

9d4436a6fbc8c5 Yoshinori Sato 2006-11-05 31

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author maintainer
#6 lore raw

RFC PATCH v3 4/35 include/linux/sh_intc.h: Add stub function "intc_finalize".

In reply to Yoshinori Sato

This function is not used with OF.
Using a static inline function avoids an external call.

---
 include/linux/sh_intc.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/sh_intc.h +6 -1
index 27ae79191bdc..994b5b05a0d7 100644
@@ -139,8 +139,13 @@ struct intc_desc symbol __initdata = {					\
 int register_intc_controller(struct intc_desc *desc);
 int intc_set_priority(unsigned int irq, unsigned int prio);
 int intc_irq_lookup(const char *chipname, intc_enum enum_id);
+#ifndef CONFIG_SH_DEVICE_TREE
 void intc_finalize(void);
-
+#else
+static inline void intc_finalize(void)
+{
+}
+#endif
 #ifdef CONFIG_INTC_USERIMASK
 int register_intc_userimask(unsigned long addr);
 #else
Signature · 1 line
2.39.2
author maintainer
#7 lore raw

RFC PATCH v3 5/35 arch/sh/kernel/setup.c: Update DT support.

In reply to Yoshinori Sato

Fix fdt initialize.

---
 arch/sh/kernel/setup.c | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)
arch/sh/kernel/setup.c +25 -11
index b3da2757faaf..8fdbb9836134 100644
@@ -31,6 +31,7 @@
 #include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/libfdt.h>
 #include <linux/uaccess.h>
 #include <uapi/linux/mount.h>
 #include <asm/io.h>
@@ -79,7 +80,13 @@ extern int root_mountflags;
 #define RAMDISK_PROMPT_FLAG		0x8000
 #define RAMDISK_LOAD_FLAG		0x4000
 
+#if defined(CONFIG_OF) || !defined(USE_BUILTIN_DTB)
+#define CHOSEN_BOOTARGS
+#endif
+
+#ifndef CHOSEN_BOOTARGS
 static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
+#endif
 
 static struct resource code_resource = {
 	.name = "Kernel code",
@@ -104,6 +111,8 @@ unsigned long memory_limit = 0;
 
 static struct resource mem_resources[MAX_NUMNODES];
 
+static void *dt_virt;
+
 int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;
 
 static int __init early_parse_mem(char *p)
@@ -249,7 +258,6 @@ void __init __weak plat_early_device_setup(void)
 void __ref sh_fdt_init(phys_addr_t dt_phys)
 {
 	static int done = 0;
-	void *dt_virt;
 
 	/* Avoid calling an __init function on secondary cpus. */
 	if (done) return;
@@ -274,8 +282,17 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)
 
 void __init setup_arch(char **cmdline_p)
 {
+#ifdef CONFIG_OF
+#ifdef CONFIG_USE_BUILTIN_DTB
+	unflatten_and_copy_device_tree();
+#else
+	memblock_reserve(__pa(dt_virt), fdt_totalsize(dt_virt));
+	unflatten_device_tree();
+#endif
+#endif
 	enable_mmu();
 
+#ifndef CONFIG_OF
 	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
 
 	printk(KERN_NOTICE "Boot params:\n"
@@ -304,6 +321,9 @@ void __init setup_arch(char **cmdline_p)
 	bss_resource.start = virt_to_phys(__bss_start);
 	bss_resource.end = virt_to_phys(__bss_stop)-1;
 
+#endif
+
+#ifndef CHOSEN_BOOTARGS
 #ifdef CONFIG_CMDLINE_OVERWRITE
 	strscpy(command_line, CONFIG_CMDLINE, sizeof(command_line));
 #else
@@ -312,11 +332,13 @@ void __init setup_arch(char **cmdline_p)
 	strlcat(command_line, " ", sizeof(command_line));
 	strlcat(command_line, CONFIG_CMDLINE, sizeof(command_line));
 #endif
-#endif
-
+#endif  /* CONFIG_CMDLINE_OVERWRITE */
 	/* Save unparsed command line copy for /proc/cmdline */
 	memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 	*cmdline_p = command_line;
+#else
+	*cmdline_p = boot_command_line;
+#endif
 
 	parse_early_param();
 
@@ -327,14 +349,6 @@ void __init setup_arch(char **cmdline_p)
 	/* Let earlyprintk output early console messages */
 	sh_early_platform_driver_probe("earlyprintk", 1, 1);
 
-#ifdef CONFIG_OF_EARLY_FLATTREE
-#ifdef CONFIG_USE_BUILTIN_DTB
-	unflatten_and_copy_device_tree();
-#else
-	unflatten_device_tree();
-#endif
-#endif
-
 	paging_init();
 
 	/* Perform the machine specific initialisation */
Signature · 1 line
2.39.2
#8 lore raw

Re: [RFC PATCH v3 05/35] arch/sh/kernel/setup.c: Update DT support.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Fix fdt initialize.

Thanks for your patch!

Quoted 17 lines
---
 arch/sh/kernel/setup.c | 36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)
arch/sh/kernel/setup.c +1 -0
index b3da2757faaf..8fdbb9836134 100644
@@ -31,6 +31,7 @@
 #include <linux/memblock.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
+#include <linux/libfdt.h>
 #include <linux/uaccess.h>
 #include <uapi/linux/mount.h>
 #include <asm/io.h>

arch/sh/kernel/setup.c extern int root_mountflags; · line 83

Quoted 4 lines
arch/sh/kernel/setup.c +1 -0
@@ -79,7 +80,13 @@ extern int root_mountflags;
 #define RAMDISK_PROMPT_FLAG            0x8000
 #define RAMDISK_LOAD_FLAG              0x4000
 
+#if defined(CONFIG_OF) || !defined(USE_BUILTIN_DTB)

This breaks non-DT. I assume you meant "&&" instead?

Also, USE_BUILTIN_DTB lacks the CONFIG_-prefix.

However, I'm not sure this works as expected, as I have CONFIG_USE_BUILTIN_DTB=y on qemu/r2d, but the kernel command line passed to qemu is not used by Linux?

arch/sh/kernel/setup.c extern int root_mountflags; · line 92

Quoted 9 lines
arch/sh/kernel/setup.c +5 -0
+#define CHOSEN_BOOTARGS
+#endif
+
+#ifndef CHOSEN_BOOTARGS
 static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };
+#endif
 
 static struct resource code_resource = {
        .name = "Kernel code",

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#9 lore raw

RFC PATCH v3 6/35 arch/sh/boards/of-generic.c: some cleanup.

In reply to Yoshinori Sato
---
 arch/sh/boards/of-generic.c | 28 ++++------------------------
 1 file changed, 4 insertions(+), 24 deletions(-)
arch/sh/boards/of-generic.c +4 -24
index f7f3e618e85b..f1ca5a914c11 100644
@@ -8,6 +8,7 @@
 #include <linux/of.h>
 #include <linux/of_clk.h>
 #include <linux/of_fdt.h>
+#include <linux/of_platform.h>
 #include <linux/clocksource.h>
 #include <linux/irqchip.h>
 #include <asm/machvec.h>
@@ -98,16 +99,7 @@ static void sh_of_smp_probe(void)
 
 #endif
 
-static void noop(void)
-{
-}
-
-static int noopi(void)
-{
-	return 0;
-}
-
-static void __init sh_of_mem_reserve(void)
+static void __init sh_of_mem_init(void)
 {
 	early_init_fdt_reserve_self();
 	early_init_fdt_scan_reserved_mem();
@@ -140,25 +132,13 @@ static void __init sh_of_init_irq(void)
 	irqchip_init();
 }
 
-static int __init sh_of_clk_init(void)
-{
-#ifdef CONFIG_COMMON_CLK
-	/* Disabled pending move to COMMON_CLK framework. */
-	pr_info("SH generic board support: scanning for clk providers\n");
-	of_clk_init(NULL);
-#endif
-	return 0;
-}
-
 static struct sh_machine_vector __initmv sh_of_generic_mv = {
 	.mv_setup	= sh_of_setup,
 	.mv_name	= "devicetree", /* replaced by DT root's model */
 	.mv_irq_demux	= sh_of_irq_demux,
 	.mv_init_irq	= sh_of_init_irq,
-	.mv_clk_init	= sh_of_clk_init,
-	.mv_mode_pins	= noopi,
-	.mv_mem_init	= noop,
-	.mv_mem_reserve	= sh_of_mem_reserve,
+	.mv_mode_pins	= generic_mode_pins,
+	.mv_mem_init	= sh_of_mem_init,
 };
 
 struct sh_clk_ops;
Signature · 1 line
2.39.2
#10 lore raw

Re: [RFC PATCH v3 06/35] arch/sh/boards/of-generic.c: some cleanup.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Quoted 6 lines
arch/sh/boards/of-generic.c +0 -0
@@ -140,25 +132,13 @@ static void __init sh_of_init_irq(void)
        irqchip_init();
 }
 

arch/sh/boards/of-generic.c static void __init sh_of_init_irq(void) · line 152

Quoted 10 lines
arch/sh/boards/of-generic.c +0 -10
-static int __init sh_of_clk_init(void)
-{
-#ifdef CONFIG_COMMON_CLK
-       /* Disabled pending move to COMMON_CLK framework. */
-       pr_info("SH generic board support: scanning for clk providers\n");
-       of_clk_init(NULL);
-#endif
-       return 0;
-}
-

Removing this breaks J2 for sure? I guess this should be merged with "[RFC PATCH v3 07/35] arch/sh/kernel/time.c: support COMMON_CLK." to avoid a bisection regression?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#11 lore raw

Re: [RFC PATCH v3 06/35] arch/sh/boards/of-generic.c: some cleanup.

Quoted 15 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Quoted 6 lines
arch/sh/boards/of-generic.c +0 -0
@@ -140,25 +132,13 @@ static void __init sh_of_init_irq(void)
        irqchip_init();
 }
 
Quoted 15 lines

arch/sh/boards/of-generic.c static void __init sh_of_init_irq(void) · line 152

Quoted 10 lines
arch/sh/boards/of-generic.c +0 -10
-static int __init sh_of_clk_init(void)
-{
-#ifdef CONFIG_COMMON_CLK
-       /* Disabled pending move to COMMON_CLK framework. */
-       pr_info("SH generic board support: scanning for clk providers\n");
-       of_clk_init(NULL);
-#endif
-       return 0;
-}
-

Removing this breaks J2 for sure? I guess this should be merged with "[RFC PATCH v3 07/35] arch/sh/kernel/time.c: support COMMON_CLK." to avoid a bisection regression?

J2 timer (jcore-pit) used TIMER_OF_DECLARE
This is the correct OF implementation, so it is initialized with timer_probe. I would like to eliminate as many SH-specific methods as possible.

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Signature · 1 line
Yosinori Sato
#12 lore raw

Re: [RFC PATCH v3 06/35] arch/sh/boards/of-generic.c: some cleanup.

Hi Sato-san,

Quoted 29 lines · Yoshinori Sato
Quoted 12 lines · Geert Uytterhoeven
Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Quoted 6 lines
arch/sh/boards/of-generic.c +0 -0
@@ -140,25 +132,13 @@ static void __init sh_of_init_irq(void)
        irqchip_init();
 }
 
Quoted 14 lines

arch/sh/boards/of-generic.c static void __init sh_of_init_irq(void) · line 152

Quoted 10 lines
arch/sh/boards/of-generic.c +0 -10
-static int __init sh_of_clk_init(void)
-{
-#ifdef CONFIG_COMMON_CLK
-       /* Disabled pending move to COMMON_CLK framework. */
-       pr_info("SH generic board support: scanning for clk providers\n");
-       of_clk_init(NULL);
-#endif
-       return 0;
-}
-

Removing this breaks J2 for sure? I guess this should be merged with "[RFC PATCH v3 07/35] arch/sh/kernel/time.c: support COMMON_CLK." to avoid a bisection regression?

Quoted 3 lines

J2 timer (jcore-pit) used TIMER_OF_DECLARE
This is the correct OF implementation, so it is initialized with timer_probe. I would like to eliminate as many SH-specific methods as possible.

Oh right, I missed that (a) there still is a call to timer_init() in SH's time_init(), and (b) more importantly, J-core does not have any other clock drivers, so it does not need of_clk_init().

Still, I think it would make sense to merge the two patches. And the call to timer_init() should be removed from the non-DT variant of time_init(), as timer_init() handles only DT and ACPI.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#13 lore raw

RFC PATCH v3 7/35 arch/sh/kernel/time.c: support COMMON_CLK.

In reply to Yoshinori Sato

Initialize the clock and timer using the COMMON_CLK procedure.

---
 arch/sh/kernel/time.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/sh/kernel/time.c +12 -0
index 821a09cbd605..ce5b7c2f8628 100644
@@ -19,7 +19,9 @@
 #include <asm/clock.h>
 #include <asm/rtc.h>
 #include <asm/platform_early.h>
+#include <linux/of_clk.h>
 
+#ifndef CONFIG_SH_DEVICE_TREE
 static void __init sh_late_time_init(void)
 {
 	/*
@@ -43,3 +45,13 @@ void __init time_init(void)
 
 	late_time_init = sh_late_time_init;
 }
+#else
+/* CONFIG_SH_DEVICE_TREE */
+void __init time_init(void)
+{
+	pr_info("SH generic board support: scanning for clk providers\n");
+
+	of_clk_init(NULL);
+	timer_probe();
+}
+#endif
Signature · 1 line
2.39.2
author maintainer
#14 lore raw

RFC PATCH v3 8/35 arch/sh/include/asm: Disable SH specific PCI define in OF enabled.

In reply to Yoshinori Sato

For OF support, the PCI driver will be migrated to a common one. Switch PCI-related headers to the common version.

---
 arch/sh/include/asm/io.h  | 14 ++++++++++++--
 arch/sh/include/asm/pci.h |  4 ++++
 2 files changed, 16 insertions(+), 2 deletions(-)
arch/sh/include/asm/io.h +12 -2
index f2f38e9d489a..3519eb6a9715 100644
@@ -311,10 +311,20 @@ unsigned long long poke_real_address_q(unsigned long long addr,
 #define xlate_dev_mem_ptr(p)	__va(p)
 #define unxlate_dev_mem_ptr(p, v) do { } while (0)
 
-#include <asm-generic/io.h>
-
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
+
+#ifdef __KERNEL__
+#define PCI_IOBASE	0xfe240000UL
+
+#define HAVE_ARCH_PIO_SIZE
+#define PIO_OFFSET	PCI_IOBASE
+#define PIO_MASK	0x3ffffUL
+#define PIO_RESERVED	0x40000UL
+#endif /* __KERNEL__ */
+
+#include <asm-generic/io.h>
+
 #endif /* __ASM_SH_IO_H */
arch/sh/include/asm/pci.h +4 -0
index 54c30126ea17..92b3bd604319 100644
@@ -2,6 +2,7 @@
 #ifndef __ASM_SH_PCI_H
 #define __ASM_SH_PCI_H
 
+#ifndef CONFIG_SH_DEVICE_TREE
 /* Can be used to override the logic in pci_scan_bus for skipping
    already-configured bus numbers - to be used for buggy BIOSes
    or architectures with incomplete PCI setup by the loader */
@@ -88,4 +89,7 @@ static inline int pci_proc_domain(struct pci_bus *bus)
 	return hose->need_domain_info;
 }
 
+#else /* CONFIG_SH_DEVICE_TREE */
+#include <asm-generic/pci.h>
+#endif
 #endif /* __ASM_SH_PCI_H */
Signature · 1 line
2.39.2
author maintainer
#15 lore raw

RFC PATCH v3 9/35 drivers/pci/controller: SH7751 PCI Host bridge driver.

In reply to Yoshinori Sato

pci-sh7751.h move from "arch/sh/drivers/pci/pci-sh7751.h" pci-sh7751.c convert from "arch/sh/drivers/pci/pci-sh7751.c"

---
 drivers/pci/controller/Kconfig      |   9 +
 drivers/pci/controller/Makefile     |   1 +
 drivers/pci/controller/pci-sh7751.c | 285 ++++++++++++++++++++++++++++
 drivers/pci/controller/pci-sh7751.h | 267 ++++++++++++++++++++++++++
 4 files changed, 562 insertions(+)
 create mode 100644 drivers/pci/controller/pci-sh7751.c
 create mode 100644 drivers/pci/controller/pci-sh7751.h
drivers/pci/controller/Kconfig +9 -0
index c0c3f2824990..037ff44bd1e8 100644
@@ -342,6 +342,15 @@ config PCIE_XILINX_CPM
 	  Say 'Y' here if you want kernel support for the
 	  Xilinx Versal CPM host bridge.
 
+config PCI_SH7751
+	bool "Renesas SH7751 PCI controller"
+	depends on OF
+	depends on CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST
+	select PCI_HOST_COMMON
+	help
+	  Say 'Y' here if you want kernel to support the Renesas SH7751 PCI
+	  Host Bridge driver.
+
 source "drivers/pci/controller/cadence/Kconfig"
 source "drivers/pci/controller/dwc/Kconfig"
 source "drivers/pci/controller/mobiveil/Kconfig"
drivers/pci/controller/Makefile +1 -0
index 37c8663de7fe..ce96cfe9f1f2 100644
@@ -39,6 +39,7 @@ obj-$(CONFIG_PCI_LOONGSON) += pci-loongson.o
 obj-$(CONFIG_PCIE_HISI_ERR) += pcie-hisi-error.o
 obj-$(CONFIG_PCIE_APPLE) += pcie-apple.o
 obj-$(CONFIG_PCIE_MT7621) += pcie-mt7621.o
+obj-$(CONFIG_PCI_SH7751) += pci-sh7751.o
 
 # pcie-hisi.o quirks are needed even without CONFIG_PCIE_DW
 obj-y				+= dwc/
drivers/pci/controller/pci-sh7751.c new file +285 -0

285 lines not on this page · raw message

drivers/pci/controller/pci-sh7751.h new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
2.39.2
#16 lore raw

Re: [RFC PATCH v3 09/35] drivers/pci/controller: SH7751 PCI Host bridge driver.

"git am" complained about a couple whitespace errors elsewhere in this series:

Applying: arch/sh/boot/compressed/head_32.S: passing FDT address to initialize function. .git/rebase-apply/patch:25: trailing whitespace.
Applying: drivers/irqchip: SH7751 IRL external encoder with enable gate. .git/rebase-apply/patch:33: new blank line at EOF.

Quoted 2 lines · Yoshinori Sato

pci-sh7751.h move from "arch/sh/drivers/pci/pci-sh7751.h" pci-sh7751.c convert from "arch/sh/drivers/pci/pci-sh7751.c"

Note the subject line conventions in drivers/pci (use "git log --oneline" to see them): use something like this:

PCI: sh7751: Add SH7751 PCI host bridge driver

with no period at the end.

arch/sh/drivers/pci/pci-sh7751.h and arch/sh/drivers/pci/pci-sh7751.c still exist after applying this series. Better to have a single patch that moves the content from arch/sh/drivers/pci/ to drivers/pci/controller/.

Neither file looks like a simple move; there's a lot of reorganization going on at the same time. It's really difficult to review a patch like that because we can't compare the content from before and after.

If you make a patch that does the cleanup/reorganization, and a separate patch that is just a simple move, and you use "git mv" for the move, git should notice that this is just a rename, and that diff will be tiny.

One of the reorganization patches should be to incorporate the pci-sh7751.h content directly into pci-sh7751.c. Since it's only used in pci-sh7751.c, there's really no advantage to having it in a separate file.

Bjorn

Quoted 16 lines
---
 drivers/pci/controller/Kconfig      |   9 +
 drivers/pci/controller/Makefile     |   1 +
 drivers/pci/controller/pci-sh7751.c | 285 ++++++++++++++++++++++++++++
 drivers/pci/controller/pci-sh7751.h | 267 ++++++++++++++++++++++++++
 4 files changed, 562 insertions(+)
 create mode 100644 drivers/pci/controller/pci-sh7751.c
 create mode 100644 drivers/pci/controller/pci-sh7751.h
drivers/pci/controller/Kconfig +0 -0
index c0c3f2824990..037ff44bd1e8 100644
@@ -342,6 +342,15 @@ config PCIE_XILINX_CPM
 	  Say 'Y' here if you want kernel support for the

drivers/pci/controller/Kconfig config PCIE_XILINX_CPM · line 352

Quoted 10 lines
drivers/pci/controller/Kconfig +8 -0
 	  Xilinx Versal CPM host bridge.
 
+config PCI_SH7751
+	bool "Renesas SH7751 PCI controller"
+	depends on OF
+	depends on CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST
+	select PCI_HOST_COMMON
+	help
+	  Say 'Y' here if you want kernel to support the Renesas SH7751 PCI
+	  Host Bridge driver.

Move this so the menu entries stay sorted by vendor name.

Bjorn

#17 lore raw

Re: [RFC PATCH v3 09/35] drivers/pci/controller: SH7751 PCI Host bridge driver.

Quoted 7 lines · Bjorn Helgaas

"git am" complained about a couple whitespace errors elsewhere in this series:

Applying: arch/sh/boot/compressed/head_32.S: passing FDT address to initialize function. .git/rebase-apply/patch:25: trailing whitespace.
Applying: drivers/irqchip: SH7751 IRL external encoder with enable gate. .git/rebase-apply/patch:33: new blank line at EOF.

BTW, I mentioned all these things and more a month or so ago:

https://lore.kernel.org/r/20230918191602.GA201859@bhelgaas
https://lore.kernel.org/r/20230918193337.GA203483@bhelgaas
https://lore.kernel.org/r/20230918193036.GA203163@bhelgaas

I *thought* this seemed familiar ;)

Bjorn

Quoted 62 lines · Yoshinori Sato
Quoted 2 lines

pci-sh7751.h move from "arch/sh/drivers/pci/pci-sh7751.h" pci-sh7751.c convert from "arch/sh/drivers/pci/pci-sh7751.c"

Note the subject line conventions in drivers/pci (use "git log --oneline" to see them): use something like this:

PCI: sh7751: Add SH7751 PCI host bridge driver

with no period at the end.

arch/sh/drivers/pci/pci-sh7751.h and arch/sh/drivers/pci/pci-sh7751.c still exist after applying this series. Better to have a single patch that moves the content from arch/sh/drivers/pci/ to drivers/pci/controller/.

Neither file looks like a simple move; there's a lot of reorganization going on at the same time. It's really difficult to review a patch like that because we can't compare the content from before and after.

If you make a patch that does the cleanup/reorganization, and a separate patch that is just a simple move, and you use "git mv" for the move, git should notice that this is just a rename, and that diff will be tiny.

One of the reorganization patches should be to incorporate the pci-sh7751.h content directly into pci-sh7751.c. Since it's only used in pci-sh7751.c, there's really no advantage to having it in a separate file.

Bjorn

Quoted 16 lines
---
 drivers/pci/controller/Kconfig      |   9 +
 drivers/pci/controller/Makefile     |   1 +
 drivers/pci/controller/pci-sh7751.c | 285 ++++++++++++++++++++++++++++
 drivers/pci/controller/pci-sh7751.h | 267 ++++++++++++++++++++++++++
 4 files changed, 562 insertions(+)
 create mode 100644 drivers/pci/controller/pci-sh7751.c
 create mode 100644 drivers/pci/controller/pci-sh7751.h
drivers/pci/controller/Kconfig +0 -0
index c0c3f2824990..037ff44bd1e8 100644
@@ -342,6 +342,15 @@ config PCIE_XILINX_CPM
 	  Say 'Y' here if you want kernel support for the

drivers/pci/controller/Kconfig config PCIE_XILINX_CPM · line 352

Quoted 10 lines
drivers/pci/controller/Kconfig +8 -0
 	  Xilinx Versal CPM host bridge.
 
+config PCI_SH7751
+	bool "Renesas SH7751 PCI controller"
+	depends on OF
+	depends on CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST
+	select PCI_HOST_COMMON
+	help
+	  Say 'Y' here if you want kernel to support the Renesas SH7751 PCI
+	  Host Bridge driver.

Move this so the menu entries stay sorted by vendor name.

Bjorn

author maintainer
#18 lore raw

RFC PATCH v3 10/35 Documentation/devicetree/bindings/pci: renesas,pci-sh7751.yaml new file.

In reply to Yoshinori Sato

binding document for renesas,pci-sh7751.

---
 .../bindings/pci/renesas,pci-sh7751.yaml      | 123 ++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +123 -0
new file mode 100644
index 000000000000..a6081c3de51d
@@ -0,0 +1,123 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/renesas,pci-sh7751.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 PCI Host controller
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,pci-sh7751
+
+  reg:
+    minItems: 3
+
+  "#interrupt-cells":
+    const: 1
+
+  "#address-cells":
+    const: 3
+
+  "#size-cells":
+    const: 2
+
+  ranges:
+    description: |
+      The PCI bus memory area and I/O area.
+
+  interrupt-controller: true
+
+  renesas,bcr1:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIBCR1 value. This value makes add the value of BSC's BCR1.
+
+  renesas,mcrmask:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIMCR value. This value makes clear bit in the value of BSC's MCR.
+
+  renesas,intm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIINTM value.
+
+  renesas,aintm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIIANTM value.
+
+  renesas,lsr:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCILSR0 and PCILSR1 values.
+      First word is PCILSR0, Second word is PCILSR1.
+
+  renesas,lar:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCILSA0 and PCILAR1 values.
+      First word is PCILAR0, Second word is PCILAR1.
+
+  renesas,dmabt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIDMABT value.
+
+  renesas,pintm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      SH7751 PCIC PCIPINTM value.
+
+  renesas,config:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description: |
+      SH7751 PCIC PCICONFIG values array. Register Number and value pair list.
+
+required:
+  - compatible
+  - reg
+  - "#interrupt-cells"
+  - "#address-cells"
+  - "#size-cells"
+  - ranges
+  - interrupt-map
+  - interrupt-map-mask
+
+unevaluatedProperties: false
+
+examples:
+  - |
+        pci@fe200000 {
+                compatible = "renesas,pci-sh7751";
+                #address-cells = <3>;
+                #size-cells = <2>;
+                ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>,
+                         <0x01000000 0 0x00000000 0xfe240000 0 0x00040000>;
+                reg = <0xfe200000 0x0400>,
+                      <0x0c000000 0x04000000>,
+                      <0xff800000 0x0030>;
+                #interrupt-cells = <1>;
+                interrupt-map = <0x0000 0 0 1 &julianintc 5>,
+                                <0x0000 0 0 2 &julianintc 6>,
+                                <0x0000 0 0 3 &julianintc 7>,
+                                <0x0000 0 0 4 &julianintc 8>,
+                                <0x0800 0 0 1 &julianintc 6>,
+                                <0x0800 0 0 2 &julianintc 7>,
+                                <0x0800 0 0 3 &julianintc 8>,
+                                <0x0800 0 0 4 &julianintc 5>,
+                                <0x1000 0 0 1 &julianintc 7>,
+                                <0x1000 0 0 2 &julianintc 8>,
+                                <0x1000 0 0 3 &julianintc 5>,
+                                <0x1000 0 0 4 &julianintc 6>;
+                interrupt-map-mask = <0x1800 0 0 7>;
+        };
Signature · 1 line
2.39.2
#19 lore raw

Re: [RFC PATCH v3 10/35] Documentation/devicetree/bindings/pci: renesas,pci-sh7751.yaml new file.

Quoted 1 line · Yoshinori Sato

binding document for renesas,pci-sh7751.

It's still RFC, so I assume it is not ready for merging and it is not meant to be reviewed. In case it is not correct - some people actually expect RFC to be merged - trivial comments:

1. Please use subject prefixes matching the subsystem. You can get them for example with git log --oneline -- DIRECTORY_OR_FILE on the directory your patch is touching.

2. Drop final full stop from subject.

3. Missing commit msg

Quoted 6 lines
---
 .../bindings/pci/renesas,pci-sh7751.yaml      | 123 ++++++++++++++++++
 1 file changed, 123 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml

If sh7751 is the name of SoC or device:
renesas,sh7751-pci.yaml

Quoted 14 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +7 -0
new file mode 100644
index 000000000000..a6081c3de51d
@@ -0,0 +1,123 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pci/renesas,pci-sh7751.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 PCI Host controller

Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml line 17

Quoted 10 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +10 -0
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+allOf:
+  - $ref: /schemas/pci/pci-bus.yaml#
+
+properties:
+  compatible:
+    items:

You can drop items

Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml line 19

Quoted 2 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +2 -0
+      - enum:
+          - renesas,pci-sh7751

renesas,sh7751-pci

Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml line 22

Quoted 3 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +3 -0
+
+  reg:
+    minItems: 3

maxItems instead

Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml line 35

Quoted 13 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +13 -0
+
+  "#interrupt-cells":
+    const: 1
+
+  "#address-cells":
+    const: 3
+
+  "#size-cells":
+    const: 2
+
+  ranges:
+    description: |
+      The PCI bus memory area and I/O area.

Drop description, just ranges: true.

....

Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml line 100

Quoted 4 lines
Documentation/devicetree/bindings/pci/renesas,pci-sh7751.yaml new file +4 -0
+
+examples:
+  - |
+        pci@fe200000 {

Use 4 spaces for example indentation.

Best regards,
Krzysztof

#20 lore raw

Re: [RFC PATCH v3 10/35] Documentation/devicetree/bindings/pci: renesas,pci-sh7751.yaml new file.

In reply to Yoshinori Sato
Quoted 3 lines · Yoshinori Sato

binding document for renesas,pci-sh7751.

One more comment - this was not tested so is not ready for review. Standard disclaimer:

Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.

You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time, thus I will skip this patch entirely till you follow the process allowing the patch to be tested.

Please kindly resend and include all necessary To/Cc entries.

Best regards,
Krzysztof

author maintainer
#21 lore raw

RFC PATCH v3 11/35 include/dt-bindings/clock/sh7750.h: cpg-sh7750 binding header.

In reply to Yoshinori Sato

SH7750 CPG driver binding definition.

---
 include/dt-bindings/clock/sh7750.h | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 include/dt-bindings/clock/sh7750.h
include/dt-bindings/clock/sh7750.h new file +26 -0
new file mode 100644
index 000000000000..10be4eb63bdb
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * Copyright 2023 Yoshinori Sato
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_SH7750_H__
+#define __DT_BINDINGS_CLOCK_SH7750_H__
+
+#define SH7750_CPG_PLLOUT	0
+
+#define SH7750_CPG_FCK		1
+#define SH7750_CPG_BCK		2
+#define SH7750_CPG_ICK		3
+
+#define SH7750_CPG_SCI_CLK	4
+#define SH7750_CPG_RTC_CLK	5
+#define SH7750_CPG_TMU012_CLK	6
+#define SH7750_CPG_SCIF_CLK	7
+#define SH7750_CPG_DMAC_CLK	8
+#define SH7750_CPG_UBC_CLK	9
+#define SH7750_CPG_SQ_CLK	10
+#define SH7750_CPG_INTC_CLK	11
+#define SH7750_CPG_TMU34_CLK	12
+#define SH7750_CPG_PCIC_CLK	13
+
+#endif
Signature · 1 line
2.39.2
#22 lore raw

Re: [RFC PATCH v3 11/35] include/dt-bindings/clock/sh7750.h: cpg-sh7750 binding header.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

SH7750 CPG driver binding definition.

Thanks for your patch!

Quoted 14 lines
include/dt-bindings/clock/sh7750.h new file +11 -0
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * Copyright 2023 Yoshinori Sato
+ */
+
+#ifndef __DT_BINDINGS_CLOCK_SH7750_H__
+#define __DT_BINDINGS_CLOCK_SH7750_H__
+
+#define SH7750_CPG_PLLOUT      0
+
+#define SH7750_CPG_FCK         1

include/dt-bindings/clock/sh7750.h line 21

Quoted 10 lines
include/dt-bindings/clock/sh7750.h new file +10 -0
+#define SH7750_CPG_BCK         2
+#define SH7750_CPG_ICK         3
+
+#define SH7750_CPG_SCI_CLK     4
+#define SH7750_CPG_RTC_CLK     5
+#define SH7750_CPG_TMU012_CLK  6
+#define SH7750_CPG_SCIF_CLK    7
+#define SH7750_CPG_DMAC_CLK    8
+#define SH7750_CPG_UBC_CLK     9
+#define SH7750_CPG_SQ_CLK      10

The above 7 clocks are not CPG core clocks, but part of the Power-Down Modes block. The documentation calls them MSTPx (Module Stop).

So I'd go for SH7750_MSTP_SCI_CLK etc.
And perhaps drop the "_CLK" suffix?

include/dt-bindings/clock/sh7750.h line 24

Quoted 3 lines
include/dt-bindings/clock/sh7750.h new file +3 -0
+#define SH7750_CPG_INTC_CLK    11
+#define SH7750_CPG_TMU34_CLK   12
+#define SH7750_CPG_PCIC_CLK    13

Similarly, but the documentation calls these CSTPx (Clock Stop). So I'd go for SH7750_CSTP_INTC_CLK etc.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#23 lore raw

RFC PATCH v3 12/35 drivers/clk/renesas: clk-sh7750.c SH7750/7751 CPG driver.

In reply to Yoshinori Sato

This driver supported SH7750/7751 PLL/Divider clock and module stop.

---
 drivers/clk/renesas/Kconfig      |  21 +-
 drivers/clk/renesas/Makefile     |   1 +
 drivers/clk/renesas/clk-sh7750.c | 787 +++++++++++++++++++++++++++++++
 3 files changed, 807 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/renesas/clk-sh7750.c
drivers/clk/renesas/Kconfig +19 -2
index 37632a0659d8..c52c038ce715 100644
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 config CLK_RENESAS
-	bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS
-	default y if ARCH_RENESAS
+	bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS && SUPERH
+	default y if ARCH_RENESAS || SUPERH
 	select CLK_EMEV2 if ARCH_EMEV2
 	select CLK_RZA1 if ARCH_R7S72100
 	select CLK_R7S9210 if ARCH_R7S9210
@@ -39,6 +39,11 @@ config CLK_RENESAS
 	select CLK_R9A07G054 if ARCH_R9A07G054
 	select CLK_R9A09G011 if ARCH_R9A09G011
 	select CLK_SH73A0 if ARCH_SH73A0
+	select CLK_SH7750 if CPU_SUBTYPE_SH7750
+	select CLK_SH7750 if CPU_SUBTYPE_SH7750S
+	select CLK_SH7750 if CPU_SUBTYPE_SH7750R
+	select CLK_SH7750 if CPU_SUBTYPE_SH7751
+	select CLK_SH7750 if CPU_SUBTYPE_SH7751R
 
 if CLK_RENESAS
 
@@ -188,6 +193,10 @@ config CLK_SH73A0
 	select CLK_RENESAS_CPG_MSTP
 	select CLK_RENESAS_DIV6
 
+config CLK_SH7750
+	bool "SH7750/7751 family clock support" if COMPILE_TEST
+	help
+	  This is a driver for SH7750 / SH7751 CPG.
 
 # Family
 config CLK_RCAR_CPG_LIB
@@ -218,6 +227,14 @@ config CLK_RZG2L
 	bool "Renesas RZ/{G2L,G2UL,V2L} family clock support" if COMPILE_TEST
 	select RESET_CONTROLLER
 
+config CLK_SH7750
+	bool "Renesas SH7750/7751 family clock support"
+	depends on CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
+	           CPU_SUBTYPE_SH7750R || \
+	           CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST
+	help
+	  This is a driver for SH7750 / SH7751 CPG.
+
 # Generic
 config CLK_RENESAS_CPG_MSSR
 	bool "CPG/MSSR clock support" if COMPILE_TEST
drivers/clk/renesas/Makefile +1 -0
index de907623fe3f..1be5f4caf1d2 100644
@@ -36,6 +36,7 @@ obj-$(CONFIG_CLK_R9A07G044)		+= r9a07g044-cpg.o
 obj-$(CONFIG_CLK_R9A07G054)		+= r9a07g044-cpg.o
 obj-$(CONFIG_CLK_R9A09G011)		+= r9a09g011-cpg.o
 obj-$(CONFIG_CLK_SH73A0)		+= clk-sh73a0.o
+obj-$(CONFIG_CLK_SH7750)		+= clk-sh7750.o
 
 # Family
 obj-$(CONFIG_CLK_RCAR_CPG_LIB)		+= rcar-cpg-lib.o
drivers/clk/renesas/clk-sh7750.c new file +787 -0

787 lines not on this page · raw message

Signature · 1 line
2.39.2
#24 lore raw

Re: [RFC PATCH v3 12/35] drivers/clk/renesas: clk-sh7750.c SH7750/7751 CPG driver.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

This driver supported SH7750/7751 PLL/Divider clock and module stop.

Thanks for your patch!

Quoted 12 lines
---
 drivers/clk/renesas/Kconfig      |  21 +-
 drivers/clk/renesas/Makefile     |   1 +
 drivers/clk/renesas/clk-sh7750.c | 787 +++++++++++++++++++++++++++++++
 3 files changed, 807 insertions(+), 2 deletions(-)
 create mode 100644 drivers/clk/renesas/clk-sh7750.c
drivers/clk/renesas/Kconfig +0 -0
index 37632a0659d8..c52c038ce715 100644

drivers/clk/renesas/Kconfig line 4

Quoted 6 lines
drivers/clk/renesas/Kconfig +1 -2
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 config CLK_RENESAS
-       bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS
-       default y if ARCH_RENESAS
+       bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS && SUPERH

"!SUPERH", so the symbol becomes invisible but enabled on SH.

drivers/clk/renesas/Kconfig config CLK_RENESAS · line 46

Quoted 13 lines
drivers/clk/renesas/Kconfig +6 -0
+       default y if ARCH_RENESAS || SUPERH
        select CLK_EMEV2 if ARCH_EMEV2
        select CLK_RZA1 if ARCH_R7S72100
        select CLK_R7S9210 if ARCH_R7S9210
@@ -39,6 +39,11 @@ config CLK_RENESAS
        select CLK_R9A07G054 if ARCH_R9A07G054
        select CLK_R9A09G011 if ARCH_R9A09G011
        select CLK_SH73A0 if ARCH_SH73A0
+       select CLK_SH7750 if CPU_SUBTYPE_SH7750
+       select CLK_SH7750 if CPU_SUBTYPE_SH7750S
+       select CLK_SH7750 if CPU_SUBTYPE_SH7750R
+       select CLK_SH7750 if CPU_SUBTYPE_SH7751
+       select CLK_SH7750 if CPU_SUBTYPE_SH7751R

Please combine all of the above into a single statement using "||", like is done for other shared drivers.

Quoted 15 lines
drivers/clk/renesas/Kconfig +4 -0
 if CLK_RENESAS
 
@@ -188,6 +193,10 @@ config CLK_SH73A0
        select CLK_RENESAS_CPG_MSTP
        select CLK_RENESAS_DIV6
 
+config CLK_SH7750
+       bool "SH7750/7751 family clock support" if COMPILE_TEST
+       help
+         This is a driver for SH7750 / SH7751 CPG.
 
 # Family
 config CLK_RCAR_CPG_LIB

drivers/clk/renesas/Kconfig config CLK_RZG2L · line 231

Quoted 5 lines
drivers/clk/renesas/Kconfig +2 -0
@@ -218,6 +227,14 @@ config CLK_RZG2L
        bool "Renesas RZ/{G2L,G2UL,V2L} family clock support" if COMPILE_TEST
        select RESET_CONTROLLER
 
+config CLK_SH7750
+       bool "Renesas SH7750/7751 family clock support"

"if COMPILE_TEST", so the symbol becomes invisible when auto-enabled.

drivers/clk/renesas/Kconfig config CLK_RZG2L · line 234

Quoted 3 lines
drivers/clk/renesas/Kconfig +3 -0
+       depends on CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \
+                  CPU_SUBTYPE_SH7750R || \
+                  CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R || COMPILE_TEST

Please drop this dependency, as it is not needed.

Quoted 5 lines
drivers/clk/renesas/clk-sh7750.c new file +2 -0
 
+static void sbcr_sw(struct clk_hw *hw, bool on)
+{

drivers/clk/renesas/clk-sh7750.c line 454

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+       struct clk_gate *gate = to_clk_gate(hw);
+       u8 msk = BIT(gate->bit_idx);
+       u8 val;
+
+       val = readb(gate->reg);
+       if (on)
+               val &= ~msk;
+       else
+               val |= msk;
+       writeb(val, gate->reg);

RMW (Read-Modify-Write) needs locking.

Quoted 18 lines
drivers/clk/renesas/clk-sh7750.c new file +18 -0
+}
+
+static int sbcr_enable(struct clk_hw *hw)
+{
+       sbcr_sw(hw, true);
+       return 0;
+}
+
+static void sbcr_disable(struct clk_hw *hw)
+{
+       sbcr_sw(hw, false);
+}
+
+static int sbcr_is_enabled(struct clk_hw *hw)
+{
+       u8 val;
+       struct clk_gate *gate = to_clk_gate(hw);
+

drivers/clk/renesas/clk-sh7750.c line 482

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+       val = readb(gate->reg);
+       val &= 1 << gate->bit_idx;
+       return val != 0;
+}
+
+static const struct clk_ops gate_stbcr_ops = {
+       .enable = sbcr_enable,
+       .disable = sbcr_disable,
+       .is_enabled = sbcr_is_enabled,
+};

These are almost identical to clk_gate_ops, except that they use 8-bit instead of 32-bit register accesses.
Perhaps you can extend the standard gate clock in drivers/clk/clk-gate.c instead, using a new CLK_GATE_* flag?

Quoted 20 lines
drivers/clk/renesas/clk-sh7750.c new file +20 -0
+
+static void clkstp00_sw(struct clk_hw *hw, bool on)
+{
+       u32 val;
+       struct clk_gate *gate = to_clk_gate(hw);
+
+       val = BIT(gate->bit_idx);
+       if (on)
+               writel(val, gate->reg + CLKSTPCLR00);
+       else
+               writel(val, gate->reg);
+}
+
+static int clkstp00_enable(struct clk_hw *hw)
+{
+       clkstp00_sw(hw, true);
+       return 0;
+}
+
+static void clkstp00_disable(struct clk_hw *hw)

drivers/clk/renesas/clk-sh7750.c line 512

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+{
+       clkstp00_sw(hw, false);
+}
+
+static int clkstp00_is_enabled(struct clk_hw *hw)
+{
+       u8 val;
+       struct clk_gate *gate = to_clk_gate(hw);
+
+       val = readb(gate->reg);

readl()?

drivers/clk/renesas/clk-sh7750.c line 521

Quoted 9 lines
drivers/clk/renesas/clk-sh7750.c new file +9 -0
+       val &= 1 << gate->bit_idx;
+       return val == 0;
+}
+
+static const struct clk_ops gate_clkstp00_ops = {
+       .enable = clkstp00_enable,
+       .disable = clkstp00_disable,
+       .is_enabled = clkstp00_is_enabled,
+};

These look identical to clk_gate_ops, so you can just use clk_register_gate() instead?

drivers/clk/renesas/clk-sh7750.c line 635

Quoted 9 lines
drivers/clk/renesas/clk-sh7750.c new file +9 -0
+static int register_div(struct device_node *node, struct cpg_priv *cpg)
+{
+       static const char * const divout[] = {
+               "fck", "bck", "ick",
+       };
+       static const char * const mstpout[] = {
+               "sci_clk", "rtc_clk", "tmu012_clk",     /* STBCR */
+               "scif_clk", "dmac_clk",                 /* STBCR */
+               "ubc_clk", "sq_clk",                    /* STBCR2 */

FTR, qemu does not support STBCR and STBCR2 yet, causing "qemu-system-sh4 -M r2d" to crash. I have posted a patch to fix that:
"[PATCH RFC] hw/sh4/sh7750: Add STBCR/STBCR2 register support"
https://lore.kernel.org/all/[email protected]

drivers/clk/renesas/clk-sh7750.c line 637

Quoted 2 lines
drivers/clk/renesas/clk-sh7750.c new file +2 -0
+               "intc_clk", "tmu34_clk", "pcic_clk",    /* CLKSTP00 */
+       };

The order of the entries in these two arrays is tied intimately to the values in include/dt-bindings/clock/sh7750.h. Hence I think it would be good to reflect that in the data and code below, by using the SH7750_CPG_* identifier.

Quoted 58 lines
drivers/clk/renesas/clk-sh7750.c new file +58 -0
+       struct sh_clk_reg_arg args[ARRAY_SIZE(divout) + ARRAY_SIZE(mstpout)];
+       unsigned int i, j;
+       int ret;
+
+       for (i = 0; i < ARRAY_SIZE(divout); i++) {
+               args[i].type = CLK_DIV;
+               args[i].name  = divout[i];
+               args[i].parent = PLLOUT;
+               args[i].reg = cpg->frqcr;
+               args[i].ops = &sh_clk_divider_ops;
+               args[i].div.shift = i * 3;
+               args[i].div.width = 3;
+               args[i].div.table = (i == 0) ? pdiv_table : div_table;
+       }
+       for (i = 0, j = ARRAY_SIZE(divout); j < ARRAY_SIZE(args); i++, j++) {
+               args[j].type = CLK_GATE;
+               args[j].name  = mstpout[i];
+               args[j].parent = divout[0];
+               switch (i) {
+               case 0 ... 4:
+                       args[j].reg = cpg->frqcr + STBCR;
+                       args[j].gate.bit_idx = i;
+                       args[j].ops = &gate_stbcr_ops;
+                       break;
+               case 5 ... 6:
+                       args[j].reg = cpg->frqcr + STBCR2;
+                       args[j].gate.bit_idx = i - 5;
+                       args[j].ops = &gate_stbcr_ops;
+                       break;
+               case 7 ... 9:
+                       args[j].reg = cpg->clkstp00;
+                       args[j].gate.bit_idx = i - 7;
+                       args[j].ops = &gate_clkstp00_ops;
+                       break;
+               }
+       }
+
+       ret = _clk_register(node, ARRAY_SIZE(args), args,
+                           &cpg->clklock, &cpg->hw);
+       if (ret < 0)
+               pr_err("%pOF: failed to register clock (%d)\n",
+                      node, ret);
+       return ret;
+}
+
+static struct cpg_priv *sh7750_cpg_setup(struct device_node *node)
+{
+       unsigned int num_parents;
+       u32 mode;
+       struct cpg_priv *cpg;
+       int ret = 0;
+
+       num_parents = of_clk_get_parent_count(node);
+       if (num_parents < 1) {
+               pr_err("%s: no parent found", node->name);
+               return ERR_PTR(-ENODEV);
+       }
+

drivers/clk/renesas/clk-sh7750.c line 705

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+       of_property_read_u32_index(node, "renesas,mode", 0, &mode);
+       if (mode >= 7) {
+               pr_err("%s: Invalid clock mode setting (%u)\n",
+                      node->name, mode);
+               return ERR_PTR(-EINVAL);
+       }
+
+       cpg = kzalloc(sizeof(struct cpg_priv), GFP_KERNEL);
+       if (!cpg) {
+               pr_err("%pOF: failed to alloc memory", node);

No need to print an error message on allocation failure, as the core memory allocation code already took care of that.

drivers/clk/renesas/clk-sh7750.c line 710

Quoted 5 lines
drivers/clk/renesas/clk-sh7750.c new file +5 -0
+               return ERR_PTR(-ENOMEM);
+       }
+
+       cpg->frqcr = of_iomap(node, 0);
+       if (cpg->frqcr == NULL) {

!cpg->frqcr

drivers/clk/renesas/clk-sh7750.c line 717

Quoted 7 lines
drivers/clk/renesas/clk-sh7750.c new file +7 -0
+               pr_err("%pOF: failed to map divide register", node);
+               ret = -ENODEV;
+               goto cpg_free;
+       }
+
+       cpg->clkstp00 = of_iomap(node, 1);
+       if (cpg->clkstp00 == NULL) {

!cpg->clkstp00

Quoted 22 lines
drivers/clk/renesas/clk-sh7750.c new file +22 -0
+               pr_err("%pOF: failed to map clkstp00 register", node);
+               ret = -ENODEV;
+               goto unmap_frqcr;
+       }
+       cpg->mode = mode;
+
+       ret = register_pll(node, cpg);
+       if (ret < 0)
+               goto unmap_clkstp00;
+
+       ret = register_div(node, cpg);
+       if (ret < 0)
+               goto unmap_clkstp00;
+
+       return cpg;
+
+unmap_clkstp00:
+       iounmap(cpg->clkstp00);
+unmap_frqcr:
+       iounmap(cpg->frqcr);
+cpg_free:
+       kfree(cpg);

drivers/clk/renesas/clk-sh7750.c line 749

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+       return ERR_PTR(ret);
+}
+
+static void __init sh7750_cpg_init(struct device_node *node)
+{
+       cpg_data = sh7750_cpg_setup(node);
+       if (IS_ERR(cpg_data))
+               cpg_data = NULL;
+       else
+               cpg_data->have_div1 = !of_device_is_compatible(node, "renesas,sh7750r");

Please no explicit of_device_is_compatible() checks in code that is called through a compatible-based match.

You can differentiate using multiple CLK_OF_DECLARE_DRIVER() stances,\
each with a different init function.

Quoted 28 lines
drivers/clk/renesas/clk-sh7750.c new file +28 -0
+}
+
+CLK_OF_DECLARE_DRIVER(sh7750_cpg, "renesas,sh7750-cpg",
+                     sh7750_cpg_init);
+
+static int sh7750_cpg_probe(struct platform_device *pdev)
+{
+       if (cpg_data)
+               return 0;
+       cpg_data = sh7750_cpg_setup(pdev->dev.of_node);
+       if (IS_ERR(cpg_data))
+               return PTR_ERR(cpg_data);
+       cpg_data->have_div1 = (of_device_get_match_data(&pdev->dev) != NULL);
+       return 0;
+}
+
+static const struct of_device_id sh7750_cpg_of_match[] = {
+       { .compatible = "renesas,sh7750-cpg",
+         .data = (void *)1 },
+       { .compatible = "renesas,sh7750s-cpg",
+         .data = (void *)1 },
+       { .compatible = "renesas,sh7750r-cpg",
+         .data = 0 },
+       { .compatible = "renesas,sh7751-cpg",
+         .data = (void *)1 },
+       { .compatible = "renesas,sh7751r-cpg",
+         .data = 0 },
+       { }

drivers/clk/renesas/clk-sh7750.c line 787

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+};
+
+static struct platform_driver sh7750_cpg_driver = {
+       .probe  = sh7750_cpg_probe,
+       .driver = {
+               .name = "sh7750-cpg",
+               .of_match_table = sh7750_cpg_of_match,
+       },
+};
+builtin_platform_driver(sh7750_cpg_driver);

As the clock driver is always probed early through CLK_OF_DECLARE_DRIVER, what is the use of the extra platform driver?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#25 lore raw

Re: [RFC PATCH v3 12/35] drivers/clk/renesas: clk-sh7750.c SH7750/7751 CPG driver.

In reply to Yoshinori Sato

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

This driver supported SH7750/7751 PLL/Divider clock and module stop.

Thanks for your patch!

Quoted 26 lines
drivers/clk/renesas/clk-sh7750.c new file +23 -0
 
+static void sbcr_sw(struct clk_hw *hw, bool on)
+{
+       struct clk_gate *gate = to_clk_gate(hw);
+       u8 msk = BIT(gate->bit_idx);
+       u8 val;
+
+       val = readb(gate->reg);
+       if (on)
+               val &= ~msk;
+       else
+               val |= msk;
+       writeb(val, gate->reg);
+}
+
+static int sbcr_enable(struct clk_hw *hw)
+{
+       sbcr_sw(hw, true);
+       return 0;
+}
+
+static void sbcr_disable(struct clk_hw *hw)
+{
+       sbcr_sw(hw, false);

drivers/clk/renesas/clk-sh7750.c line 475

Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10 -0
+}
+
+static int sbcr_is_enabled(struct clk_hw *hw)
+{
+       u8 val;
+       struct clk_gate *gate = to_clk_gate(hw);
+
+       val = readb(gate->reg);
+       val &= 1 << gate->bit_idx;
+       return val != 0;

This condition is inverted: 0 is enabled, 1 is stopped.

Quoted 1 line

+}

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#26 lore raw

RFC PATCH v3 13/35 Documentation/devicetree/bindings/clock: Add renesas,sh7750-cpg binding document.

In reply to Yoshinori Sato
---
 .../bindings/clock/renesas,sh7750-cpg.yaml    | 74 +++++++++++++++++++
 1 file changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +74 -0
new file mode 100644
index 000000000000..a640968ed005
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/renesas,sh7750-cpg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7750/7751 Clock Pulse Generator (CPG)
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description:
+  The Clock Pulse Generator (CPG) generates core clocks for the SoC.  It
+  includes PLLs, and variable ratio dividers.
+
+  The CPG may also provide a Clock Domain for SoC devices, in combination with
+  the CPG Module Stop (MSTP) Clocks.
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,sh7750-cpg             # SH7750
+          - renesas,sh7750s-cpg            # SH775S
+          - renesas,sh7750r-cpg            # SH7750R
+          - renesas,sh7751-cpg             # SH7751
+          - renesas,sh7751r-cpg            # SH7751R
+      - const: renesas,sh7750-cpg
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: FRQCR
+      - const: CLKSTP00
+
+  clocks: true
+
+  clock-names: true
+
+  '#clock-cells':
+    const: 1
+
+  renesas,mode:
+    description: Board-specific settings of the MD[0-2] pins on SoC
+    $ref: /schemas/types.yaml#/definitions/uint32
+    minimum: 0
+    maximum: 6
+
+  '#power-domain-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+  - '#clock-cells'
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/clock/sh7750.h>
+    cpg: clock-controller@ffc00000 {
+        #clock-cells = <1>;
+        #power-domain-cells = <0>;
+        compatible = "renesas,sh7751r-cpg";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        reg = <0xffc00000 20>, <0xfe0a0000 16>;
+    };
Signature · 1 line
2.39.2
#27 lore raw

Re: [RFC PATCH v3 13/35] Documentation/devicetree/bindings/clock: Add renesas,sh7750-cpg binding document.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Quoted 21 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +18 -0
@@ -0,0 +1,74 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/clock/renesas,sh7750-cpg.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7750/7751 Clock Pulse Generator (CPG)
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description:
+  The Clock Pulse Generator (CPG) generates core clocks for the SoC.  It
+  includes PLLs, and variable ratio dividers.
+
+  The CPG may also provide a Clock Domain for SoC devices, in combination with
+  the CPG Module Stop (MSTP) Clocks.
+

Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +10 -0
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,sh7750-cpg             # SH7750
+          - renesas,sh7750s-cpg            # SH775S
+          - renesas,sh7750r-cpg            # SH7750R
+          - renesas,sh7751-cpg             # SH7751
+          - renesas,sh7751r-cpg            # SH7751R
+      - const: renesas,sh7750-cpg

As there are important differences between the CPG variants, I think it makes sense to drop the "renesas,sh7750-cpg", fallback, like you BTW already did in the example below.
Then you can drop the "items", and just keep "enum".

Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 73

Quoted 10 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +10 -0
+examples:
+  - |
+    #include <dt-bindings/clock/sh7750.h>
+    cpg: clock-controller@ffc00000 {
+        #clock-cells = <1>;
+        #power-domain-cells = <0>;
+        compatible = "renesas,sh7751r-cpg";
+        clocks = <&xtal>;
+        clock-names = "xtal";
+        reg = <0xffc00000 20>, <0xfe0a0000 16>;
$ make dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.example.dtb:
clock-controller@ffc00000: compatible: ['renesas,sh7751r-cpg'] is too
short
        from schema $id:
http://devicetree.org/schemas/clock/renesas,sh7750-cpg.yaml#
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.example.dtb:
clock-controller@ffc00000: 'reg-names' is a required property
        from schema $id:
http://devicetree.org/schemas/clock/renesas,sh7750-cpg.yaml#
Quoted 4 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +1 -1
+    };
--

2.39.2

--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#28 lore raw

RFC PATCH v3 14/35 drivers/irqchip: Add SH7751 Internal INTC drivers.

In reply to Yoshinori Sato

SH7751 Internal interrupt controler driver.

---
 drivers/irqchip/Kconfig              |   9 +
 drivers/irqchip/Makefile             |   1 +
 drivers/irqchip/irq-renesas-sh7751.c | 255 +++++++++++++++++++++++++++
 3 files changed, 265 insertions(+)
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
drivers/irqchip/Kconfig +9 -0
index f7149d0f3d45..87bd490fec21 100644
@@ -679,4 +679,13 @@ config SUNPLUS_SP7021_INTC
 	  chained controller, routing all interrupt source in P-Chip to
 	  the primary controller on C-Chip.
 
+config RENESAS_SH7751_INTC
+	bool "Renesas SH7751 Interrupt Controller"
+	depends on SH_DEVICE_TREE || COMPILE_TEST
+	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY
+	help
+	  Support for the Renesas SH7751 On-chip interrupt controller.
+	  And external interrupt encoder for some targets.
+
 endmenu
drivers/irqchip/Makefile +1 -0
index ffd945fe71aa..26c91d075e25 100644
@@ -120,3 +120,4 @@ obj-$(CONFIG_IRQ_IDT3243X)		+= irq-idt3243x.o
 obj-$(CONFIG_APPLE_AIC)			+= irq-apple-aic.o
 obj-$(CONFIG_MCHP_EIC)			+= irq-mchp-eic.o
 obj-$(CONFIG_SUNPLUS_SP7021_INTC)	+= irq-sp7021-intc.o
+obj-$(CONFIG_RENESAS_SH7751_INTC)	+= irq-renesas-sh7751.o
drivers/irqchip/irq-renesas-sh7751.c new file +255 -0

255 lines not on this page · raw message

Signature · 1 line
2.39.2
#29 lore raw

Re: [RFC PATCH v3 14/35] drivers/irqchip: Add SH7751 Internal INTC drivers.

Hi Sato-san,

Thanks for your patch!

Quoted 1 line · Yoshinori Sato

SH7751 Internal interrupt controler driver.

controller

Quoted 11 lines
drivers/irqchip/irq-renesas-sh7751.c new file +5 -0
 
+static int __init load_ipr_map(struct device_node *intc,
+                              struct sh7751_intc_priv *priv)
+{
+       int num_ipr;
+       struct iprmap *p;

drivers/irqchip/irq-renesas-sh7751.c line 172

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+       u32 val[3];
+       unsigned int i, idx;
+
+       num_ipr = of_property_count_elems_of_size(intc, "renesas,ipr-map", sizeof(u32) * 3);
+       if (num_ipr < 0)
+               return num_ipr;
+
+       priv->iprmap = kcalloc(num_ipr, sizeof(struct iprmap), GFP_KERNEL);
+       if (priv->iprmap == NULL) {
+               pr_err("%s: Failed to alloc memory\n", intc->name);

No need to print anything, as the memory allocation core code already takes care of that.

drivers/irqchip/irq-renesas-sh7751.c line 180

Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751.c new file +8 -0
+               return -ENOMEM;
+       }
+       priv->num_ipr = num_ipr;
+
+       for (p = priv->iprmap, idx = 0; num_ipr > 0; p++, num_ipr--) {
+               for (i = 0; i < 3; idx++, i++) {
+                       if (of_property_read_u32_index(intc, "renesas,ipr-map",
+                                                      idx, &val[i])) {

You can use of_find_property() once to find the property, and iterate its values using of_prop_next_u32().

Quoted 21 lines
drivers/irqchip/irq-renesas-sh7751.c new file +21 -0
+                               pr_err("%s: Failed to load ipr-map\n", intc->name);
+                               kfree(priv->iprmap);
+                               return -EINVAL;
+                       }
+               }
+               p->irq = evt2irq(val[0]);
+               p->reg = val[1];
+               p->bits = val[2];
+       }
+       /* This table will be searched using bsearch, so sort it. */
+       sort(priv->iprmap, priv->num_ipr, sizeof(struct iprmap),
+            sort_ipr_cmp, sort_ipr_swap);
+
+       for (p = priv->iprmap, idx = 0; idx < priv->num_ipr; p++, idx++)
+               pr_debug("irq=%04x reg=%02x bits=%d\n", p->irq, p->reg, p->bits);
+       return 0;
+}
+
+static int __init sh7751_intc_of_init(struct device_node *intc,
+                                     struct device_node *parent)
+{

drivers/irqchip/irq-renesas-sh7751.c line 211

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+       u16 icr;
+       struct irq_domain *domain;
+       void *intc_baseaddr;
+       void *intc_baseaddr2;
+       struct sh7751_intc_priv *priv;
+       int ret;
+
+       intc_baseaddr = of_iomap(intc, 0);
+       intc_baseaddr2 = of_iomap(intc, 1);
+       if (IS_ERR(intc_baseaddr)) {

of_iomap() returns NULL on failure.
Missing check for intc_baseaddr2.

drivers/irqchip/irq-renesas-sh7751.c line 218

Quoted 7 lines
drivers/irqchip/irq-renesas-sh7751.c new file +7 -0
+               pr_err("%pOFP: Invalid register definition\n", intc);
+               return -EINVAL;
+       }
+
+       priv = kzalloc(sizeof(struct sh7751_intc_priv), GFP_KERNEL);
+       if (priv == NULL) {
+               pr_err("%pOFP: Failed to alloc memory\n", intc);

No need to print anything, as the memory allocation core code already takes care of that.

drivers/irqchip/irq-renesas-sh7751.c

Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2 -0
+               return -ENOMEM;
+       }

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#30 lore raw

Re: [RFC PATCH v3 14/35] drivers/irqchip: Add SH7751 Internal INTC drivers.

In reply to Yoshinori Sato

drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 686

Quoted 5 lines · Yoshinori Sato
drivers/irqchip/Kconfig +5 -0
+config RENESAS_SH7751_INTC
+	bool "Renesas SH7751 Interrupt Controller"
+	depends on SH_DEVICE_TREE || COMPILE_TEST
+	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY

IRQ_DOMAIN_HIERARCHY selects IRQ_DOMAIN already

drivers/irqchip/irq-renesas-sh7751.c line 34

Quoted 11 lines
drivers/irqchip/irq-renesas-sh7751.c new file +11 -0
+struct sh7751_intc_priv {
+	void *icr;
+	void *ipr;
+	void *intpri00;
+	void *intreq00;
+	void *intmsk00;
+	void *intmskclr00;
+	struct iprmap *iprmap;
+	unsigned int num_ipr;
+	bool irlm;
+};

See the other mail vs. formatting

Quoted 19 lines
drivers/irqchip/irq-renesas-sh7751.c new file +19 -0
+#define ICR_IRLM BIT(7)
+
+/* Bitmap of IRQ masked */
+#define IMASK_PRIORITY	15
+
+static DECLARE_BITMAP(imask_mask, IMASK_PRIORITY);
+static int interrupt_priority;
+
+static inline void set_interrupt_registers(int ip)
+{
+	unsigned long __dummy;
+
+	asm volatile(
+#ifdef CONFIG_CPU_HAS_SR_RB
+		     "ldc	%2, r6_bank\n\t"
+#endif
+		     "stc	sr, %0\n\t"
+		     "and	#0xf0, %0\n\t"
+		     "shlr2	%0\n\t"

drivers/irqchip/irq-renesas-sh7751.c line 64

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+		     "cmp/eq	#0x3c, %0\n\t"
+		     "bt/s	1f	! CLI-ed\n\t"
+		     " stc	sr, %0\n\t"
+		     "and	%1, %0\n\t"
+		     "or	%2, %0\n\t"
+		     "ldc	%0, sr\n"
+		     "1:"
+		     : "=&z" (__dummy)
+		     : "r" (~0xf0), "r" (ip << 4)
+		     : "t");

Why has this to be ASM and cannot be done in C with the existing accessors? Also this really lacks a comment what this is actually doing.

Quoted 1 line

+}

Missing newline after }.

drivers/irqchip/irq-renesas-sh7751.c line 68

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3 -0
+static int search_ipr_comp(const void *a, const void *b)
+{
+	return (int)a - ((struct iprmap *)b)->irq;

(long)a please. It does not matter on 32-bit, but casting a pointer to long is the correct way to do it.

drivers/irqchip/irq-renesas-sh7751.c line 75

Quoted 7 lines
drivers/irqchip/irq-renesas-sh7751.c new file +7 -0
+}
+
+static void update_ipr(struct sh7751_intc_priv *priv, int irq, int pval)
+{
+	void *prireg;
+	struct iprmap *p;
+	u16 pri;

See the othermail vs. variable declarations. Please fix all over the place.

drivers/irqchip/irq-renesas-sh7751.c line 78

Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2 -0
+	p = bsearch((void *)irq, priv->iprmap, priv->num_ipr,
+		       sizeof(struct iprmap), search_ipr_comp);

See Documentation vs. line breaks and argument alignment

drivers/irqchip/irq-renesas-sh7751.c line 82

Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4 -0
+	if (p) {
+		prireg = (p->reg < INTPRI00) ? priv->ipr : priv->intpri00;
+		prireg += p->reg & (INTPRI00 - 1);
+		pri = ~(0x000f << p->bits);

No magic numbers please. Use a define.

drivers/irqchip/irq-renesas-sh7751.c line 87

Quoted 5 lines
drivers/irqchip/irq-renesas-sh7751.c new file +5 -0
+		pri &= __raw_readw(prireg);
+		pri |= (pval & 0x0f) << p->bits;
+		__raw_writew(pri, prireg);
+	} else
+		pr_warn_once("%s: undefined IPR in irq %d\n", __FILE__, irq);

Lacks brackets on the else clause.

drivers/irqchip/irq-renesas-sh7751.c line 96

Quoted 9 lines
drivers/irqchip/irq-renesas-sh7751.c new file +9 -0
+}
+
+static void sh7751_disable_irq(struct irq_data *data)
+{
+	unsigned int irq = data->irq;
+	struct sh7751_intc_priv *priv = data->chip_data;
+
+	if (irq < 16 && !priv->irlm) {
+		/* IRL encoded externel interrupt */

external

drivers/irqchip/irq-renesas-sh7751.c line 103

Quoted 7 lines
drivers/irqchip/irq-renesas-sh7751.c new file +7 -0
+		/* disable for SR.IMASK */
+		clear_bit(irq, imask_mask);
+		if (interrupt_priority < IMASK_PRIORITY - irq)
+			interrupt_priority = IMASK_PRIORITY - irq;
+		set_interrupt_registers(interrupt_priority);
+	} else
+		/* Internal periphreal interrupt */

peripheral and missing brackets.

Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +6 -0
+		/* IPR priority is 0 */
+		update_ipr(priv, irq, 0);
+}
+
+static void sh7751_enable_irq(struct irq_data *data)
+{

drivers/irqchip/irq-renesas-sh7751.c line 119

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+	unsigned int irq = data->irq;
+	struct sh7751_intc_priv *priv = data->chip_data;
+
+	if (irq < 16 && !priv->irlm) {
+		set_bit(irq, imask_mask);
+		interrupt_priority = IMASK_PRIORITY -
+		  find_first_bit(imask_mask, IMASK_PRIORITY);
+		set_interrupt_registers(interrupt_priority);
+	} else
+		update_ipr(priv, irq, 1);

This does a bsearch on every mask/unmask operation. Why can't this be done once at setup time and cached per interrupt?

This code lacks any form of comment and explanation what all of this is about. You are not only leaving reviewers and casual readers puzzled, you yourself will have a hard time understanding this magic 6 month down the road.

drivers/irqchip/irq-renesas-sh7751.c line 129

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+}
+
+static const struct irq_chip sh7751_irq_chip = {
+	.name		= "SH7751-INTC",
+	.irq_unmask	= sh7751_enable_irq,
+	.irq_mask	= sh7751_disable_irq,
+};
+
+static int irq_sh7751_map(struct irq_domain *h, unsigned int virq,
+				  irq_hw_number_t hw_irq_num)

Argument alignment please.

drivers/irqchip/irq-renesas-sh7751.c line 135

Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +6 -0
+{
+	irq_set_chip_and_handler(virq, &sh7751_irq_chip, handle_level_irq);
+	irq_get_irq_data(virq)->chip_data = h->host_data;
+	irq_modify_status(virq, IRQ_NOREQUEST, IRQ_NOPROBE);
+	return 0;
+}

Newline.

drivers/irqchip/irq-renesas-sh7751.c line 138

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3 -0
+static const struct irq_domain_ops irq_ops = {
+	.map = irq_sh7751_map,
+	.xlate  = irq_domain_xlate_onecell,

Struct formatting

drivers/irqchip/irq-renesas-sh7751.c line 146

Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751.c new file +8 -0
+};
+
+static int sort_ipr_cmp(const void *a, const void *b)
+{
+	unsigned int irq_a = ((struct iprmap *)a)->irq;
+	unsigned int irq_b = ((struct iprmap *)b)->irq;
+
+	return irq_a - irq_b;

Why are irq_a/b unsigned int? The substraction clearly hints signed, no?

Quoted 34 lines
drivers/irqchip/irq-renesas-sh7751.c new file +34 -0
+}
+
+static void sort_ipr_swap(void *a, void *b, int sz)
+{
+	struct iprmap tmp;
+
+	memcpy(&tmp, a, sizeof(tmp));
+	memcpy(a, b, sizeof(tmp));
+	memcpy(b, &tmp, sizeof(tmp));
+}
+
+static int __init load_ipr_map(struct device_node *intc,
+			       struct sh7751_intc_priv *priv)
+{
+	int num_ipr;
+	struct iprmap *p;
+	u32 val[3];
+	unsigned int i, idx;
+
+	num_ipr = of_property_count_elems_of_size(intc, "renesas,ipr-map", sizeof(u32) * 3);
+	if (num_ipr < 0)
+		return num_ipr;
+
+	priv->iprmap = kcalloc(num_ipr, sizeof(struct iprmap), GFP_KERNEL);
+	if (priv->iprmap == NULL) {
+		pr_err("%s: Failed to alloc memory\n", intc->name);
+		return -ENOMEM;
+	}
+	priv->num_ipr = num_ipr;
+
+	for (p = priv->iprmap, idx = 0; num_ipr > 0; p++, num_ipr--) {
+		for (i = 0; i < 3; idx++, i++) {
+			if (of_property_read_u32_index(intc, "renesas,ipr-map",
+						       idx, &val[i])) {

drivers/irqchip/irq-renesas-sh7751.c line 190

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10 -0
+				pr_err("%s: Failed to load ipr-map\n", intc->name);
+				kfree(priv->iprmap);
+				return -EINVAL;
+			}
+		}
+		p->irq = evt2irq(val[0]);
+		p->reg = val[1];
+		p->bits = val[2];
+	}
+	/* This table will be searched using bsearch, so sort it. */

So this is one of the rare comments in this code. It comments the obvious as the other comments do too.

Thanks,

tglx

#31 lore raw

Re: [RFC PATCH v3 14/35] drivers/irqchip: Add SH7751 Internal INTC drivers.

Quoted 21 lines · Thomas Gleixner
Quoted 20 lines · Yoshinori Sato
drivers/irqchip/irq-renesas-sh7751.c new file +19 -0
+config RENESAS_SH7751_INTC
+     bool "Renesas SH7751 Interrupt Controller"
+     depends on SH_DEVICE_TREE || COMPILE_TEST
 
+static inline void set_interrupt_registers(int ip)
+{
+     unsigned long __dummy;
+
+     asm volatile(
+#ifdef CONFIG_CPU_HAS_SR_RB
+                  "ldc       %2, r6_bank\n\t"
+#endif
+                  "stc       sr, %0\n\t"
+                  "and       #0xf0, %0\n\t"
+                  "shlr2     %0\n\t"
+                  "cmp/eq    #0x3c, %0\n\t"
+                  "bt/s      1f      ! CLI-ed\n\t"
+                  " stc      sr, %0\n\t"
+                  "and       %1, %0\n\t"
+                  "or        %2, %0\n\t"
Quoted 8 lines

drivers/irqchip/irq-renesas-sh7751.c line 64

Quoted 5 lines
drivers/irqchip/irq-renesas-sh7751.c new file +5 -0
+                  "ldc       %0, sr\n"
+                  "1:"
+                  : "=&z" (__dummy)
+                  : "r" (~0xf0), "r" (ip << 4)
+                  : "t");

Why has this to be ASM and cannot be done in C with the existing accessors? Also this really lacks a comment what this is actually doing.

This will play not very well with the "|| COMPILE_TEST" ;-)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#32 lore raw

RFC PATCH v3 15/35 Documentation/devicetree/bindings/interrupt-controller: Add renesas,sh7751-intc.yaml

In reply to Yoshinori Sato

SH7751 interrupt controller binding definition.

---
 .../renesas,sh7751-intc.yaml                  | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +102 -0
new file mode 100644
index 000000000000..02cc8e73eaf9
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-intc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 Interrupt Controller
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: renesas,sh7751-intc
+
+  '#interrupt-cells':
+    # an interrupt index and flags, as defined in interrupts.txt in
+    # this directory
+    const: 2
+
+  interrupt-controller: true
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: ICR
+      - const: INTPRI00
+
+  renesas,icr-irlm:
+    type: boolean
+    description: Use ICR.IRLM=1
+
+  renesas,ipr-map:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description: |
+      IRQ to IPR mapping definition.
+
+required:
+  - compatible
+  - '#interrupt-cells'
+  - interrupt-controller
+  - reg
+  - reg-names
+  - renesas,ipr-map
+
+additionalProperties: false
+
+examples:
+  - |
+        shintc: interrupt-controller@ffd00000 {
+                compatible = "renesas,sh7751-intc";
+                #interrupt-cells = <2>;
+                interrupt-controller;
+                reg = <0xffd00000 14>, <0xfe080000 128>;
+                renesas,ipr-map = IPRDEF(0x240, IPRD, IPR_B12), /* IRL0 */
+                                  IPRDEF(0x2a0, IPRD, IPR_B8),  /* IRL1 */
+                                  IPRDEF(0x300, IPRD, IPR_B4),  /* IRL2 */
+                                  IPRDEF(0x360, IPRD, IPR_B0),  /* IRL3 */
+                                  IPRDEF(0x400, IPRA, IPR_B12), /* TMU0 */
+                                  IPRDEF(0x420, IPRA, IPR_B8),  /* TMU1 */
+                                  IPRDEF(0x440, IPRA, IPR_B4),  /* TMU2 TNUI */
+                                  IPRDEF(0x460, IPRA, IPR_B4),  /* TMU2 TICPI */
+                                  IPRDEF(0x480, IPRA, IPR_B0),  /* RTC ATI */
+                                  IPRDEF(0x4a0, IPRA, IPR_B0),  /* RTC PRI */
+                                  IPRDEF(0x4c0, IPRA, IPR_B0),  /* RTC CUI */
+                                  IPRDEF(0x4e0, IPRB, IPR_B4),  /* SCI ERI */
+                                  IPRDEF(0x500, IPRB, IPR_B4),  /* SCI RXI */
+                                  IPRDEF(0x520, IPRB, IPR_B4),  /* SCI TXI */
+                                  IPRDEF(0x540, IPRB, IPR_B4),  /* SCI TEI */
+                                  IPRDEF(0x560, IPRB, IPR_B12), /* WDT */
+                                  IPRDEF(0x580, IPRB, IPR_B8),  /* REF RCMI */
+                                  IPRDEF(0x5a0, IPRB, IPR_B4),  /* REF ROVI */
+                                  IPRDEF(0x600, IPRC, IPR_B0),  /* H-UDI */
+                                  IPRDEF(0x620, IPRC, IPR_B12), /* GPIO */
+                                  IPRDEF(0x640, IPRC, IPR_B8),  /* DMAC DMTE0 */
+                                  IPRDEF(0x660, IPRC, IPR_B8),  /* DMAC DMTE1 */
+                                  IPRDEF(0x680, IPRC, IPR_B8),  /* DMAC DMTE2 */
+                                  IPRDEF(0x6a0, IPRC, IPR_B8),  /* DMAC DMTE3 */
+                                  IPRDEF(0x6c0, IPRC, IPR_B8),  /* DMAC DMAE */
+                                  IPRDEF(0x700, IPRC, IPR_B4),  /* SCIF ERI */
+                                  IPRDEF(0x720, IPRC, IPR_B4),  /* SCIF RXI */
+                                  IPRDEF(0x740, IPRC, IPR_B4),  /* SCIF BRI */
+                                  IPRDEF(0x760, IPRC, IPR_B4),  /* SCIF TXI */
+                                  IPRDEF(0x780, IPRC, IPR_B8),  /* DMAC DMTE4 */
+                                  IPRDEF(0x7a0, IPRC, IPR_B8),  /* DMAC DMTE5 */
+                                  IPRDEF(0x7c0, IPRC, IPR_B8),  /* DMAC DMTE6 */
+                                  IPRDEF(0x7e0, IPRC, IPR_B8),  /* DMAC DMTE7 */
+                                  IPRDEF(0xa00, INTPRI00, IPR_B0),      /* PCIC PCISERR */
+                                  IPRDEF(0xa20, INTPRI00, IPR_B4),      /* PCIC CIDMA3 */
+                                  IPRDEF(0xa40, INTPRI00, IPR_B4),      /* PCIC CIDMA2 */
+                                  IPRDEF(0xa60, INTPRI00, IPR_B4),      /* PCIC PCIDMA1 */
+                                  IPRDEF(0xa80, INTPRI00, IPR_B4),      /* PCIC PCIDMA0 */
+                                  IPRDEF(0xaa0, INTPRI00, IPR_B4),      /* PCIC PCIPWON */
+                                  IPRDEF(0xac0, INTPRI00, IPR_B4),      /* PCIC PCIPWDWN */
+                                  IPRDEF(0xae0, INTPRI00, IPR_B4),      /* PCIC PCIERR */
+                                  IPRDEF(0xb00, INTPRI00, IPR_B8),      /* TMU3 */
+                                  IPRDEF(0xb80, INTPRI00, IPR_B12);     /* TMU4 */
+        };
+...
Signature · 1 line
2.39.2
#33 lore raw

Re: [RFC PATCH v3 15/35] Documentation/devicetree/bindings/interrupt-controller: Add renesas,sh7751-intc.yaml

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

SH7751 interrupt controller binding definition.

Thanks for your patch!

Quoted 12 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +9 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-intc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 Interrupt Controller
+
+maintainers:

Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 19

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +10 -0
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  compatible:
+    items:
+      - const: renesas,sh7751-intc
+
+  '#interrupt-cells':
+    # an interrupt index and flags, as defined in interrupts.txt in
+    # this directory

I think you can drop this comment.

Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 52

Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +3 -0
+    const: 2
 
+examples:
+  - |

Missing

    #include <dt-bindings/interrupt-controller/sh_intc.h>

Please run

make dt_binding_check
DT_SCHEMA_FILES=Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml

to catch such issues before posting.

Quoted 1 line

+ shintc: interrupt-controller@ffd00000 {

Please align this to the "|" above, and use 4 spaces for each additional indentation step.

Quoted 1 line

+ compatible = "renesas,sh7751-intc";

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#34 lore raw

Re: [RFC PATCH v3 15/35] Documentation/devicetree/bindings/interrupt-controller: Add renesas,sh7751-intc.yaml

Hi Sato-san,

Quoted 22 lines · Geert Uytterhoeven
Quoted 20 lines · Yoshinori Sato

SH7751 interrupt controller binding definition.

Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +13 -0
@@ -0,0 +1,102 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-intc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 Interrupt Controller
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  compatible:
Quoted 10 lines

Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 19

Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +6 -0
+    items:
+      - const: renesas,sh7751-intc
+
+  '#interrupt-cells':
+    # an interrupt index and flags, as defined in interrupts.txt in
+    # this directory

I think you can drop this comment.

Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +1 -0
+    const: 2

And given the second cell is always zero, and the driver uses irq_domain_xlate_onecell, I guess this should be one instead?

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#35 lore raw

RFC PATCH v3 16/35 drivers/irqchip: SH7751 IRL external encoder with enable gate.

In reply to Yoshinori Sato

SH7751 have 15 level external interrupt.
It is typically connected to the CPU through a priority encoder that can suppress requests.
This driver provides a way to control those hardware with irqchip.

---
 drivers/irqchip/Kconfig                 |   7 +
 drivers/irqchip/Makefile                |   2 +
 drivers/irqchip/irq-renesas-sh7751irl.c | 206 ++++++++++++++++++++++++
 3 files changed, 215 insertions(+)
 create mode 100644 drivers/irqchip/irq-renesas-sh7751irl.c
drivers/irqchip/Kconfig +7 -0
index 87bd490fec21..998c99c2c8ee 100644
@@ -688,4 +688,11 @@ config RENESAS_SH7751_INTC
 	  Support for the Renesas SH7751 On-chip interrupt controller.
 	  And external interrupt encoder for some targets.
 
+config RENESAS_SH7751IRL_INTC
+	bool "Renesas SH7751 based target IRL encoder support."
+	depends on RENESAS_SH7751_INTC
+	help
+	  Support for External Interrupt encoder
+	  on the some Renesas SH7751 based target.
+
 endmenu
drivers/irqchip/Makefile +2 -0
index 26c91d075e25..91df16726b1f 100644
@@ -121,3 +121,5 @@ obj-$(CONFIG_APPLE_AIC)			+= irq-apple-aic.o
 obj-$(CONFIG_MCHP_EIC)			+= irq-mchp-eic.o
 obj-$(CONFIG_SUNPLUS_SP7021_INTC)	+= irq-sp7021-intc.o
 obj-$(CONFIG_RENESAS_SH7751_INTC)	+= irq-renesas-sh7751.o
+obj-$(CONFIG_RENESAS_SH7751IRL_INTC)	+= irq-renesas-sh7751irl.o
+
drivers/irqchip/irq-renesas-sh7751irl.c new file +206 -0

206 lines not on this page · raw message

Signature · 1 line
2.39.2
#36 lore raw

Re: [RFC PATCH v3 16/35] drivers/irqchip: SH7751 IRL external encoder with enable gate.

Yoshinori!

On Sat, Oct 14 2023 at 23:53, Yoshinori Sato wrote:

Please Cc LKML on irqchip patches as that's the proper list according to MAINTAINERS. Due to that I don't have the cover letter and ...

drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 689

Quoted 5 lines
drivers/irqchip/Kconfig +0 -0
@@ -688,4 +688,11 @@ config RENESAS_SH7751_INTC
 	  Support for the Renesas SH7751 On-chip interrupt controller.
 	  And external interrupt encoder for some targets.

... I have no idea against which tree this is supposed to apply. None of the trees I usually use has the above. So I assume it's a patch in the same series, but what do I know.

Quoted 24 lines
drivers/irqchip/Kconfig +7 -0
+config RENESAS_SH7751IRL_INTC
+	bool "Renesas SH7751 based target IRL encoder support."
+	depends on RENESAS_SH7751_INTC
+	help
+	  Support for External Interrupt encoder
+	  on the some Renesas SH7751 based target.
+
 endmenu
drivers/irqchip/Makefile +2 -0
index 26c91d075e25..91df16726b1f 100644
@@ -121,3 +121,5 @@ obj-$(CONFIG_APPLE_AIC)			+= irq-apple-aic.o
 obj-$(CONFIG_MCHP_EIC)			+= irq-mchp-eic.o
 obj-$(CONFIG_SUNPLUS_SP7021_INTC)	+= irq-sp7021-intc.o
 obj-$(CONFIG_RENESAS_SH7751_INTC)	+= irq-renesas-sh7751.o
+obj-$(CONFIG_RENESAS_SH7751IRL_INTC)	+= irq-renesas-sh7751irl.o
+
drivers/irqchip/irq-renesas-sh7751irl.c new file +0 -0
new file mode 100644
index 000000000000..1520d0cfda1e

drivers/irqchip/irq-renesas-sh7751irl.c line 1

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0

GPL-2.0-only please

drivers/irqchip/irq-renesas-sh7751irl.c line 31

Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +8 -0
+struct sh7751irl_intc_priv {
+	void __iomem *base;
+	struct irq_domain *irq_domain;
+	int width;
+	int type;
+	int nr_irq;
+	u32 enable_map[NUM_IRQ];
+};

Please use proper tabular alignment for struct definitions. See:

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#struct-declarations-and-initializers

drivers/irqchip/irq-renesas-sh7751irl.c line 33

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
+enum {type_enable, type_mask};

What's this? A true/false replacement? If you want you own constants, then please make them upper case.

drivers/irqchip/irq-renesas-sh7751irl.c line 45

Quoted 11 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +11 -0
+static inline u32 get_reg(void *addr, int w)
+{
+	switch (w) {
+	case 8:
+		return __raw_readb(addr);
+	case 16:
+		return __raw_readw(addr);
+	case 32:
+		return __raw_readl(addr);
+	}
+	return 0;

Reaching this is a bug, no?

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +10 -0
+}
+
+static inline void set_reg(void *addr, int w, u32 val)
+{
+	switch (w) {
+	case 8:
+		__raw_writeb(val, addr);
+		break;
+	case 16:
+		__raw_writew(val, addr);

drivers/irqchip/irq-renesas-sh7751irl.c line 65

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +10 -0
+		break;
+	case 32:
+		__raw_writel(val, addr);
+		break;
+	}
+}
+
+static inline struct sh7751irl_intc_priv *irq_data_to_priv(struct irq_data *data)
+{
+	return data->domain->host_data;

So in sh7751irl_intc_map() you store host_data in chip_data and now you retrieve it from the domain...

drivers/irqchip/irq-renesas-sh7751irl.c line 74

Quoted 9 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +9 -0
+}
+
+static inline u32 set_reset_bit(int val, u32 in, int bit, int type)
+{
+	val &= 1;
+	if (type == type_mask)
+		val ^= 1;
+	in &= ~(1 << bit);
+	return in | (val << bit);

This is horrible to read, really.

First of all mixing int (val) and u32 (in) for the OR operation is plain wrong.

Here the 'type_mask' really threw me off as it's completely non-obvious that type_mask is an enum constant, which means 'type' should be type of the very same enum as well, but as you made the enum anonymous that does not work.

So let me go through this in detail:

drivers/irqchip/irq-renesas-sh7751irl.c line 70

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
+	val &= 1;

What's this for? Making sure that the caller does not provide anything else than 1 or 0? So any even number is equivalent to 0 and any odd number equivalent to 1, right? How is that supposed to work correctly?

drivers/irqchip/irq-renesas-sh7751irl.c line 72

Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +2 -0
+	if (type == type_mask)
+		val ^= 1;

So 'type_mask' if set inverts 'val', right? So why is it named mask? That's confusing at best.

drivers/irqchip/irq-renesas-sh7751irl.c line 73

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
+	in &= ~(1 << bit);

Again you are mixing signed and unsigned values. Also please use BIT(bit).

drivers/irqchip/irq-renesas-sh7751irl.c line 74

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
+	return in | (val << bit);

This whole thing boils down to:

static inline u32 set_reset_bit(u32 regval, int bit, bool set, bool invert)

{
        if (set ^ invert)
              	return regval | BIT(bit);
        return regval & ~BIT(bit);
}

No?

drivers/irqchip/irq-renesas-sh7751irl.c line 77

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +3 -0
+}
+
+static inline void mask_unmask(struct irq_data *data, int en)

s/en/bool enable/

drivers/irqchip/irq-renesas-sh7751irl.c line 80

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +3 -0
+{
+	struct sh7751irl_intc_priv *priv = irq_data_to_priv(data);
+	int irq = data->irq - EXTIRQ_BASE;

What guarantees that the Linux interrupt number is exactly EXTIRQ_BASE + offset? Linux interrupt numbers are not guaranteed to be linear or consecutive, unless the underlying interrupt domain is declared that way, which the tree domain is definitely not.

The proper way to map the interrupt to an hardware offset is the hardware interrupt number, i.e. irqd_to_hwirq(data). That number is set when the interrupt is mapped and this avoids the whole EXTIRQ_BASE magic completely.

drivers/irqchip/irq-renesas-sh7751irl.c line 83

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +3 -0
+	u32 val;
+
+	if (priv->nr_irq > irq && priv->enable_map[irq] < priv->width) {

How can you end up with an invalid interrupt number or with an invalid width here? I'm all for defensive programming, but this is just unexplainable. The whole point of interrupt domains and their associated interrupt chips is that irq_data contains the correct information which is required to handle these things efficiently.

drivers/irqchip/irq-renesas-sh7751irl.c line 85

Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +2 -0
+		val = get_reg(priv->base, priv->width);
+		val = set_reset_bit(en, val, priv->enable_map[irq], priv->type);

So as this is the only place which uses this magic set_reset_bit() inline, you can just inline it directly and make the code readable. All of this can be condensed into:

	struct sh7751irl_intc_priv *priv = irq_data_to_priv(data);
        u32 msk = BIT(priv->enable_map[irqd_to_hwirq(data)]);

	val = get_reg(priv->base, priv->width) & ~msk;
        if (enable ^ priv->invert)
              	val |= msk;
	set_reg(priv->base, priv->width, val);

Hmm?

drivers/irqchip/irq-renesas-sh7751irl.c line 107

Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +2 -0
+static int sh7751irl_intc_map(struct irq_domain *h, unsigned int virq,
+			       irq_hw_number_t hw_irq_num)

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#line-breaks

drivers/irqchip/irq-renesas-sh7751irl.c line 110

Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +3 -0
+{
+	irq_set_chip_and_handler(virq, &sh7751irl_intc_chip, handle_level_irq);
+	irq_get_irq_data(virq)->chip_data = h->host_data;

irq_set_chip_data(...) if at all

drivers/irqchip/irq-renesas-sh7751irl.c line 117

Quoted 7 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +7 -0
+	irq_modify_status(virq, IRQ_NOREQUEST, IRQ_NOPROBE);
+	return 0;
+}
+
+static int sh7751irl_intc_translate(struct irq_domain *domain,
+			       struct irq_fwspec *fwspec, unsigned long *hwirq,
+			       unsigned int *type)

Same comment vs. line breaks

drivers/irqchip/irq-renesas-sh7751irl.c line 127

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +10 -0
+{
+	if (fwspec->param[0] >= NUM_IRQ)
+		return -EINVAL;
+
+	switch (fwspec->param_count) {
+	case 2:
+		*type = fwspec->param[1];
+		fallthrough;
+	case 1:
+		*hwirq = fwspec->param[0] + EXTIRQ_BASE;

So if you store fwspec->param[0] in hwirq then the above code just works by reading hwirq, no?

drivers/irqchip/irq-renesas-sh7751irl.c line 137

Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +10 -0
+		break;
+	default:
+		return -EINVAL;
+	}
+	return 0;
+}
+
+static const struct irq_domain_ops sh7751irl_intc_domain_ops = {
+	.map = sh7751irl_intc_map,
+	.translate = sh7751irl_intc_translate,

See the struct initializer documentation...

drivers/irqchip/irq-renesas-sh7751irl.c line 148

Quoted 11 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +11 -0
+};
+
+static int sh7751irl_init(struct device_node *node, struct device_node *parent)
+{
+	struct sh7751irl_intc_priv *priv;
+	struct irq_domain *d;
+	int ret = 0;
+	int type = -1;
+	u32 *p;
+	unsigned int i, nr_input = 0;
+	const char *type_str;

https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#variable-declarations

drivers/irqchip/irq-renesas-sh7751irl.c line 158

Quoted 9 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +9 -0
+	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->base = of_iomap(node, 0);
+	if (IS_ERR(priv->base)) {
+		ret = PTR_ERR(priv->base);
+		goto error;
+	}

Missing newline. Same on lots of places below. Please use empty newlines to structure the code so that the individual functional blocks are easy to identify.

drivers/irqchip/irq-renesas-sh7751irl.c line 170

Quoted 12 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +12 -0
+	of_property_read_u32(node, "renesas,width", &priv->width);
+	if (priv->width != 8 && priv->width != 16 && priv->width != 32) {
+		pr_err("%s Invalid register width.\n", node->name);
+		ret = -EINVAL;
+		goto error;
+	}
+	if (!of_property_read_string(node, "renesas,regtype", &type_str)) {
+		if (strcasecmp("enable", type_str) == 0)
+			type = type_enable;
+		else if (strcasecmp("mask", type_str) == 0)
+			type = type_mask;
+	}

I'm not convinced about this "enable" "mask" wording here. As I said above this indicates whether the register bits are inverted or not.

drivers/irqchip/irq-renesas-sh7751irl.c line 176

Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +6 -0
+	if (type < 0) {
+		pr_err("%pOFP: renesas,regtype Invalid register type (%s).\n", node, type_str);
+		ret = -EINVAL;
+		goto error;
+	}
+	priv->type = type;

Please make this simply a boolean value and be done with it.

drivers/irqchip/irq-renesas-sh7751irl.c line 182

Quoted 5 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +5 -0
+	priv->nr_irq = of_property_count_u32_elems(node, "renesas,irqbit");
+	if (priv->nr_irq < NUM_IRQ) {
+		of_property_read_u32_array(node, "renesas,irqbit", priv->enable_map, priv->nr_irq);
+		for (p = priv->enable_map, i = 0; i < priv->nr_irq; p++, i++) {
+			if (*p != 0xffffffff)

Please use a proper define and not magic constants.

drivers/irqchip/irq-renesas-sh7751irl.c line 186

Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +4 -0
+				nr_input++;
+		}
+	}
+	if (priv->nr_irq <= 0 || priv->nr_irq >= NUM_IRQ || nr_input > priv->width) {

We usually assume that NUM_IRQ[S] is the number of interrupts which can be handled by a domain/interrupt chip. But you require that the number of irqbits defined in the device tree is less than NUM_IRQ which is confusing at best. I really had to read these conditions three times to understand the logic here.

Also nr_input > priv->width is wrong if there are enough entries with an enable map of 0xFFFFFFFF so that nr_input is <= priv->width.

Aside of that what checks that the bit number provided in enable_map is actually valid vs. priv->width? AFACIT, nothing. That's why you need magic checks in your mask/unmask function. Ensure correctness at setup time and not with magic checks at runtime.

drivers/irqchip/irq-renesas-sh7751irl.c line 191

Quoted 5 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +5 -0
+		pr_err("%pOFP: renesas,irqbit Invalid register definition.\n", node);
+		ret = -EINVAL;
+		goto error;
+	}
+	d = irq_domain_add_tree(node, &sh7751irl_intc_domain_ops, priv);

Why is this a tree when the number of hardware interrupts is fixed?

irq_domain_add_linear() is the right thing to use here.

drivers/irqchip/irq-renesas-sh7751irl.c line 192

Quoted 1 line
drivers/irqchip/irq-renesas-sh7751irl.c new file +1 -0
+	if (d == NULL) {
  if (!d) {

drivers/irqchip/irq-renesas-sh7751irl.c line 197

Quoted 5 lines
drivers/irqchip/irq-renesas-sh7751irl.c new file +5 -0
+		pr_err("%pOFP: cannot initialize irq domain\n", node);
+		ret = -ENOMEM;
+		goto error;
+	}
+	priv->irq_domain = d;

What's the purpose of storing the domain pointer here? Nothing, AFAICT.

Thanks,

tglx

#37 lore raw

Re: [RFC PATCH v3 16/35] drivers/irqchip: SH7751 IRL external encoder with enable gate.

Hi Thomas!

Thanks for the thorough review. Just a quick comment below.

Quoted 9 lines · Thomas Gleixner

drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 689

Quoted 5 lines
drivers/irqchip/Kconfig +0 -0
@@ -688,4 +688,11 @@ config RENESAS_SH7751_INTC
 	  Support for the Renesas SH7751 On-chip interrupt controller.
 	  And external interrupt encoder for some targets.

... I have no idea against which tree this is supposed to apply. None of the trees I usually use has the above. So I assume it's a patch in the same series, but what do I know.

This shall eventually go through my sh-linux tree [1].

Adrian

Quoted 1 line

[1] https://git.kernel.org/pub/scm/linux/kernel/git/glaubitz/sh-linux.git/

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
#38 lore raw

Re: [RFC PATCH v3 16/35] drivers/irqchip: SH7751 IRL external encoder with enable gate.

Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Thomas Gleixner

drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 689

Quoted 5 lines
drivers/irqchip/Kconfig +0 -0
@@ -688,4 +688,11 @@ config RENESAS_SH7751_INTC
 	  Support for the Renesas SH7751 On-chip interrupt controller.
 	  And external interrupt encoder for some targets.

... I have no idea against which tree this is supposed to apply. None of the trees I usually use has the above. So I assume it's a patch in the same series, but what do I know.

Quoted 1 line

This shall eventually go through my sh-linux tree [1].

That's an actual tree management problem, which is completely independent of the review process.

Reviewing patches which depend on "unknown" other changes is per definition impossible and in this case it's even worse because the dependency affects the same subsystem, no?

Thanks,

tglx

#39 lore raw

Re: [RFC PATCH v3 16/35] drivers/irqchip: SH7751 IRL external encoder with enable gate.

Quoted 12 lines · Thomas Gleixner
Quoted 11 lines · John Paul Adrian Glaubitz
Quoted 9 lines · Thomas Gleixner

drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 689

Quoted 5 lines
drivers/irqchip/Kconfig +0 -0
@@ -688,4 +688,11 @@ config RENESAS_SH7751_INTC
 	  Support for the Renesas SH7751 On-chip interrupt controller.
 	  And external interrupt encoder for some targets.

... I have no idea against which tree this is supposed to apply. None of the trees I usually use has the above. So I assume it's a patch in the same series, but what do I know.

Quoted 8 lines
Quoted 1 line

This shall eventually go through my sh-linux tree [1].

That's an actual tree management problem, which is completely independent of the review process.

Reviewing patches which depend on "unknown" other changes is per definition impossible and in this case it's even worse because the dependency affects the same subsystem, no?

Never mind. I found the other patch. For some reason that ended up with broken threading, but I definitely do not have the cover letter.

author maintainer
#40 lore raw

RFC PATCH v3 17/35 Documentation/devicetree/bindings/interrupt-controller: Add renesas,sh7751-irl-ext.yaml

In reply to Yoshinori Sato

SH7751 external interrupt encoder binding definition.

---
 .../renesas,sh7751-irl-ext.yaml               | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +89 -0
new file mode 100644
index 000000000000..323229ccc4c3
@@ -0,0 +1,89 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/interrupt-controller/renesas,sh7751-irl-ext.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SH7751 IRL external encoder with enable regs.
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |
+  This is the generally used external interrupt encoder on SH7751 based boards.
+
+properties:
+  compatible:
+    items:
+      - const: renesas,sh7751-irl-ext
+
+  reg:
+    minItems: 1
+
+  interrupt-controller: true
+
+  '#interrupt-cells':
+    const: 1
+
+  '#address-cells':
+    const: 0
+
+  '#size-cells':
+    const: 0
+
+  renesas,width:
+    description: Enable register width
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  renesas,regtype:
+    description: Enable register type
+    $ref: /schemas/types.yaml#/definitions/string
+    oneOf:
+      - description:
+          1 is interrupt enable / 0 is interrupt disable.
+        const: enable
+      - description:
+          1 is interrupt mask / 0 is interrupt unmask.
+        const: mask
+
+  renesas,irqbit:
+    description: IRQ to enable register bit mapping
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+
+
+required:
+  - compatible
+  - reg
+  - interrupt-controller
+  - '#interrupt-cells'
+  - renesas,width
+  - renesas,regtype
+  - renesas,irqbit
+
+additionalProperties: false
+
+examples:
+  - |
+    r2dintc: sh7751irl_encoder@a4000000 {
+        compatible = "renesas,sh7751-irl-ext";
+        reg = <0xa4000000 0x02>;
+        interrupt-controller;
+        #address-cells = <0>;
+        #size-cells = <0>;
+        #interrupt-cells = <1>;
+        renesas,width = <16>;
+        renesas,regtype = "enable";
+        renesas,irqbit =  <11>,         /* PCI INTD */
+                          <9>,          /* CF IDE */
+                          <8>,          /* CF CD */
+                          <12>,         /* PCI INTC */
+                          <10>,         /* SM501 */
+                          <6>,          /* KEY */
+                          <5>,          /* RTC ALARM */
+                          <4>,          /* RTC T */
+                          <7>,          /* SDCARD */
+                          <14>,         /* PCI INTA */
+                          <13>,         /* PCI INTB */
+                          <0>,          /* EXT */
+                          <15>;         /* TP */
+    };
Signature · 1 line
2.39.2
author maintainer
#41 lore raw

RFC PATCH v3 18/35 drivers/tty/serial: sh-sci.c fix SH4 OF support.

In reply to Yoshinori Sato

- fix earlycon name.
- fix earlyprintk hung (NULL pointer reference).

---
 drivers/tty/serial/sh-sci.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/serial/sh-sci.c +3 -3
index a560b729fa3b..faaf2bb32586 100644
@@ -2720,7 +2720,7 @@ static int sci_remap_port(struct uart_port *port)
 	if (port->membase)
 		return 0;
 
-	if (port->dev->of_node || (port->flags & UPF_IOREMAP)) {
+	if ((port->dev && port->dev->of_node) || (port->flags & UPF_IOREMAP)) {
 		port->membase = ioremap(port->mapbase, sport->reg_size);
 		if (unlikely(!port->membase)) {
 			dev_err(port->dev, "can't remap port#%d\n", port->line);
@@ -3555,8 +3555,8 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
 
 OF_EARLYCON_DECLARE(sci, "renesas,sci", sci_early_console_setup);
 OF_EARLYCON_DECLARE(scif, "renesas,scif", scif_early_console_setup);
-OF_EARLYCON_DECLARE(scif, "renesas,scif-r7s9210", rzscifa_early_console_setup);
-OF_EARLYCON_DECLARE(scif, "renesas,scif-r9a07g044", rzscifa_early_console_setup);
+OF_EARLYCON_DECLARE(rzscifa, "renesas,scif-r7s9210", rzscifa_early_console_setup);
+OF_EARLYCON_DECLARE(rzscifa, "renesas,scif-r9a07g044", rzscifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifa, "renesas,scifa", scifa_early_console_setup);
 OF_EARLYCON_DECLARE(scifb, "renesas,scifb", scifb_early_console_setup);
 OF_EARLYCON_DECLARE(hscif, "renesas,hscif", hscif_early_console_setup);
Signature · 1 line
2.39.2
#42 lore raw

Re: [RFC PATCH v3 18/35] drivers/tty/serial: sh-sci.c fix SH4 OF support.

Hi Sato-san,

Thanks for your patch!

Quoted 1 line · Yoshinori Sato

- fix earlycon name.

Note that to use earlycon, you currently need to enable EXPERT. So I propose to fix that using:

drivers/tty/serial/Kconfig +1 -1
@@ -658,7 +658,7 @@ config SERIAL_SH_SCI_EARLYCON
        depends on SERIAL_SH_SCI=y
        select SERIAL_CORE_CONSOLE
        select SERIAL_EARLYCON
-       default ARCH_RENESAS
+       default ARCH_RENESAS || SUPERH
 
 config SERIAL_SH_SCI_DMA
        bool "DMA support" if EXPERT
Quoted 1 line

- fix earlyprintk hung (NULL pointer reference).

How do you actually use earlyprintk, as SH lacks the EARLY_PRINTK config symbol?

Looks like tglx missed that when creating commit d0380e6c3c0f6edb ("early_printk: consolidate random copies of identical code").

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#43 lore raw

RFC PATCH v3 19/35 Documentation/devicetree/bindings/serial: renesas,scif.yaml Add SH.

In reply to Yoshinori Sato
---
 Documentation/devicetree/bindings/serial/renesas,scif.yaml | 5 +++++
 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/serial/renesas,scif.yaml +5 -0
index 99030fc18c45..0c938f1fb77b 100644
@@ -81,6 +81,11 @@ properties:
               - renesas,scif-r9a07g054      # RZ/V2L
           - const: renesas,scif-r9a07g044   # RZ/G2{L,LC} fallback
 
+      - items:
+          - enum:
+              - renesas,scif-sh7751   # SH7751
+          - const: renesas,scif       # generic SCIF compatible UART
+
   reg:
     maxItems: 1
 
Signature · 1 line
2.39.2
#44 lore raw

Re: [RFC PATCH v3 19/35] Documentation/devicetree/bindings/serial: renesas,scif.yaml Add SH.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Documentation/devicetree/bindings/serial/renesas,scif.yaml properties: · line 87

Quoted 10 lines
Documentation/devicetree/bindings/serial/renesas,scif.yaml +4 -0
@@ -81,6 +81,11 @@ properties:
               - renesas,scif-r9a07g054      # RZ/V2L
           - const: renesas,scif-r9a07g044   # RZ/G2{L,LC} fallback
 
+      - items:
+          - enum:
+              - renesas,scif-sh7751   # SH7751
+          - const: renesas,scif       # generic SCIF compatible UART

There is no need to add a new "items" section.
Just add "renesas,scif-sh7751" to the first "items" section at the top.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#45 lore raw

RFC PATCH v3 20/35 drivers/mfd: sm501 add some properties.

In reply to Yoshinori Sato

I am changing the target board of SuperH using SM501 to DeviceTree. This target uses platform_device to configure sm501 and sm501fb. In order to migrate to DeviceTree, it can now be set in properties.

---
 drivers/mfd/sm501.c           | 113 ++++++++++++++++++++++++++++++++++
 drivers/video/fbdev/sm501fb.c |  92 +++++++++++++++++++++++++++
 2 files changed, 205 insertions(+)
drivers/mfd/sm501.c +113 -0
index 28027982cf69..e0fdb5237d29 100644
@@ -1370,6 +1370,113 @@ static int sm501_init_dev(struct sm501_devdata *sm)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static unsigned int sm501_parse_devices_str(struct device_node *np)
+{
+	unsigned int device = 0;
+	unsigned int i, j;
+	unsigned int nstr;
+	const char *devstr;
+	static const struct {
+		char *devname;
+		unsigned int devid;
+	} devlist[] = {
+		{ "usb-host", SM501_USE_USB_HOST },
+		{ "usb-gadget", SM501_USE_USB_SLAVE },
+		{ "ssp0", SM501_USE_SSP0 },
+		{ "ssp1", SM501_USE_SSP1 },
+		{ "uart0", SM501_USE_UART0 },
+		{ "uart1", SM501_USE_UART1 },
+		{ "accel", SM501_USE_FBACCEL },
+		{ "ac97", SM501_USE_AC97 },
+		{ "i2s", SM501_USE_I2S },
+		{ "gpio", SM501_USE_GPIO },
+		{ "all", SM501_USE_ALL },
+	};
+
+	nstr = of_property_count_strings(np, "smi,devices");
+	for (i = 0; i < nstr; i++) {
+		if (of_property_read_string_index(np, "smi,devices", i, &devstr))
+			break;
+		for (j = 0; j < ARRAY_SIZE(devlist); j++) {
+			if (strcmp(devstr, devlist[j].devname) == 0) {
+				device |= devlist[j].devid;
+				goto next;
+			}
+		}
+next:
+	}
+	return device;
+}
+
+static void sm501_of_read_reg_init(struct device_node *np,
+				   const char *propname, struct sm501_reg_init *val)
+{
+	u32 u32_val[2];
+
+	if (!of_property_read_u32_array(np, propname, u32_val, sizeof(u32_val))) {
+		val->set = u32_val[0];
+		val->mask = u32_val[1];
+	} else {
+		val->set = 0;
+		val->mask = 0;
+	}
+}
+
+static int sm501_parse_dt(struct sm501_devdata *sm, struct device_node *np)
+{
+	struct sm501_platdata *plat;
+	u32 u32_val;
+
+	plat = devm_kzalloc(sm->dev, sizeof(*plat), GFP_KERNEL);
+	if (!plat)
+		return -ENOMEM;
+
+	plat->init = devm_kzalloc(sm->dev, sizeof(*plat->init), GFP_KERNEL);
+	if (!plat->init)
+		return -ENOMEM;
+
+	plat->init->devices = sm501_parse_devices_str(np);
+
+	if (!of_property_read_u32_index(np, "smi,mclk", 0, &u32_val))
+		plat->init->mclk = u32_val;
+	else
+		plat->init->mclk = 0;
+
+	if (!of_property_read_u32_index(np, "smi,m1xclk", 0, &u32_val))
+		plat->init->m1xclk = u32_val;
+	else
+		plat->init->m1xclk = 0;
+
+	sm501_of_read_reg_init(np, "smi,misc-timing", &plat->init->misc_timing);
+	sm501_of_read_reg_init(np, "smi,misc-control", &plat->init->misc_control);
+	sm501_of_read_reg_init(np, "smi,gpio-low", &plat->init->gpio_low);
+	sm501_of_read_reg_init(np, "smi,gpio-high", &plat->init->gpio_high);
+
+#ifdef CONFIG_MFD_SM501_GPIO
+	if (plat->init->devices & SM501_USE_GPIO) {
+		if (!of_property_read_u32_index(np, "smi,num-i2c", 0, &u32_val))
+			plat->gpio_i2c_nr = u32_val;
+		else
+			plat->gpio_i2c_nr = 0;
+	}
+	if (plat->gpio_i2c_nr > 0) {
+		int sz_gpio;
+
+		sz_gpio = sizeof(struct sm501_platdata_gpio_i2c) * plat->gpio_i2c_nr;
+		plat->gpio_i2c = devm_kzalloc(sm->dev, sz_gpio, GFP_KERNEL);
+		if (plat->gpio_i2c == NULL)
+			return -ENOMEM;
+
+		of_property_read_variable_u32(np, "smi,gpio-i2c",
+					      plat->gpio_i2c, plat->gpio_i2c_nr * 5);
+	}
+#endif	/* CONFIG_MFD_SM501_GPIO */
+	sm->platdata = plat;
+	return 0;
+}
+#endif	/* CONFIG_OF */
+
 static int sm501_plat_probe(struct platform_device *dev)
 {
 	struct sm501_devdata *sm;
@@ -1406,6 +1513,12 @@ static int sm501_plat_probe(struct platform_device *dev)
 		goto err_res;
 	}
 
+	if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {
+		ret = sm501_parse_dt(sm, dev->dev.of_node);
+		if (ret)
+			goto err_res;
+	}
+
 	platform_set_drvdata(dev, sm);
 
 	sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
drivers/video/fbdev/sm501fb.c +92 -0

110 lines not on this page · raw message

Signature · 1 line
2.39.2
#46 lore raw

Re: [RFC PATCH v3 20/35] drivers/mfd: sm501 add some properties.

kernel test robot noticed the following build errors:

Hi Yoshinori,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next pci/next pci/for-linus linus/master v6.6-rc6 next-20231018] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yoshinori-Sato/arch-sh-boot-compressed-head_32-S-passing-FDT-address-to-initialize-function/20231017-170254
base:   tip/irq/core
patch link:    https://lore.kernel.org/r/b1bedaea12693d256b2513f72bd39630a69d188a.1697199949.git.ysato%40users.sourceforge.jp
patch subject: [RFC PATCH v3 20/35] drivers/mfd: sm501 add some properties.
config: x86_64-rhel-8.3 (https://download.01.org/0day-ci/archive/20231018/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231018/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

drivers/mfd/sm501.c: In function 'sm501_plat_probe':

>> drivers/mfd/sm501.c:1517:23: error: implicit declaration of function 'sm501_parse_dt' [-Werror=implicit-function-declaration]
    1517 |                 ret = sm501_parse_dt(sm, dev->dev.of_node);
         |                       ^~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/sm501_parse_dt +1517 drivers/mfd/sm501.c

1479
1480 static int sm501_plat_probe(struct platform_device *dev)
1481 {
1482 struct sm501_devdata *sm;
1483 int ret;
1484
1485 sm = kzalloc(sizeof(*sm), GFP_KERNEL);
1486 if (!sm) {
1487 ret = -ENOMEM;
1488 goto err1;
1489 }
1490
1491 sm->dev = &dev->dev;
1492 sm->pdev_id = dev->id;
1493 sm->platdata = dev_get_platdata(&dev->dev);
1494
1495 ret = platform_get_irq(dev, 0);
1496 if (ret < 0)
1497 goto err_res;
1498 sm->irq = ret;
1499
1500 sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
1501 sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
1502 if (!sm->io_res || !sm->mem_res) {
1503 dev_err(&dev->dev, "failed to get IO resource\n");
1504 ret = -ENOENT;
1505 goto err_res;
1506 }
1507
1508 sm->regs_claim = request_mem_region(sm->io_res->start,
1509 0x100, "sm501");
1510 if (!sm->regs_claim) {
1511 dev_err(&dev->dev, "cannot claim registers\n");
1512 ret = -EBUSY;
1513 goto err_res;
1514 }
1515
1516 if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {

> 1517			ret = sm501_parse_dt(sm, dev->dev.of_node);

1518 if (ret)
1519 goto err_res;
1520 }
1521
1522 platform_set_drvdata(dev, sm);
1523
1524 sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
1525 if (!sm->regs) {
1526 dev_err(&dev->dev, "cannot remap registers\n");
1527 ret = -EIO;
1528 goto err_claim;
1529 }
1530
1531 ret = sm501_init_dev(sm);
1532 if (ret)
1533 goto err_unmap;
1534
1535 return 0;
1536
1537 err_unmap:
1538 iounmap(sm->regs);
1539 err_claim:
1540 release_mem_region(sm->io_res->start, 0x100);
1541 err_res:
1542 kfree(sm);
1543 err1:
1544 return ret;
1545

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#47 lore raw

Re: [RFC PATCH v3 20/35] drivers/mfd: sm501 add some properties.

In reply to Yoshinori Sato
kernel test robot noticed the following build errors:

Hi Yoshinori,

[This is a private test report for your RFC patch.] kernel test robot noticed the following build errors:

[auto build test ERROR on tip/irq/core]
[also build test ERROR on robh/for-next pci/next pci/for-linus linus/master v6.6-rc6 next-20231018] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Yoshinori-Sato/arch-sh-boot-compressed-head_32-S-passing-FDT-address-to-initialize-function/20231017-170254
base:   tip/irq/core
patch link:    https://lore.kernel.org/r/b1bedaea12693d256b2513f72bd39630a69d188a.1697199949.git.ysato%40users.sourceforge.jp
patch subject: [RFC PATCH v3 20/35] drivers/mfd: sm501 add some properties.
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20231019/[email protected]/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231019/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/mfd/sm501.c:1517:9: error: call to undeclared function 'sm501_parse_dt'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                   ret = sm501_parse_dt(sm, dev->dev.of_node);
                         ^

1 error generated.

vim +/sm501_parse_dt +1517 drivers/mfd/sm501.c

1479
1480 static int sm501_plat_probe(struct platform_device *dev)
1481 {
1482 struct sm501_devdata *sm;
1483 int ret;
1484
1485 sm = kzalloc(sizeof(*sm), GFP_KERNEL);
1486 if (!sm) {
1487 ret = -ENOMEM;
1488 goto err1;
1489 }
1490
1491 sm->dev = &dev->dev;
1492 sm->pdev_id = dev->id;
1493 sm->platdata = dev_get_platdata(&dev->dev);
1494
1495 ret = platform_get_irq(dev, 0);
1496 if (ret < 0)
1497 goto err_res;
1498 sm->irq = ret;
1499
1500 sm->io_res = platform_get_resource(dev, IORESOURCE_MEM, 1);
1501 sm->mem_res = platform_get_resource(dev, IORESOURCE_MEM, 0);
1502 if (!sm->io_res || !sm->mem_res) {
1503 dev_err(&dev->dev, "failed to get IO resource\n");
1504 ret = -ENOENT;
1505 goto err_res;
1506 }
1507
1508 sm->regs_claim = request_mem_region(sm->io_res->start,
1509 0x100, "sm501");
1510 if (!sm->regs_claim) {
1511 dev_err(&dev->dev, "cannot claim registers\n");
1512 ret = -EBUSY;
1513 goto err_res;
1514 }
1515
1516 if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) {

> 1517			ret = sm501_parse_dt(sm, dev->dev.of_node);

1518 if (ret)
1519 goto err_res;
1520 }
1521
1522 platform_set_drvdata(dev, sm);
1523
1524 sm->regs = ioremap(sm->io_res->start, resource_size(sm->io_res));
1525 if (!sm->regs) {
1526 dev_err(&dev->dev, "cannot remap registers\n");
1527 ret = -EIO;
1528 goto err_claim;
1529 }
1530
1531 ret = sm501_init_dev(sm);
1532 if (ret)
1533 goto err_unmap;
1534
1535 return 0;
1536
1537 err_unmap:
1538 iounmap(sm->regs);
1539 err_claim:
1540 release_mem_region(sm->io_res->start, 0x100);
1541 err_res:
1542 kfree(sm);
1543 err1:
1544 return ret;
1545

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
maintainer
#48 lore raw

Re: [RFC PATCH v3 20/35] drivers/mfd: sm501 add some properties.

In reply to Yoshinori Sato
Quoted 9 lines · Yoshinori Sato

I am changing the target board of SuperH using SM501 to DeviceTree. This target uses platform_device to configure sm501 and sm501fb. In order to migrate to DeviceTree, it can now be set in properties.

---
 drivers/mfd/sm501.c           | 113 ++++++++++++++++++++++++++++++++++
 drivers/video/fbdev/sm501fb.c |  92 +++++++++++++++++++++++++++
 2 files changed, 205 insertions(+)

Wow! This is a 20 year old driver. I'm surprised to see it in use.

FYI, the driver itself seems to be in a bit of state. It would not be accepted in its current guise if submitted in the present.

When you submit your next revision, would you please add me to the recipients list on the *whole set* please?

Not sure I can review this until the DT guys have rubber stamped the binding. Some of the proposed properties look like they'll need a re-work; specifically 'smi,devices' which looks like a bitmap of the devices to be enabled.

Signature · 1 line
Lee Jones [李琼斯]
author maintainer
#49 lore raw

RFC PATCH v3 21/35 devicetree/binding/display/sm501fb.txt: sm501fb add properies.

In reply to Yoshinori Sato

SM501's OF support is not enough parameter in platform device. This change adds the missing parameter.

---
 .../devicetree/bindings/display/sm501fb.txt     | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
Documentation/devicetree/bindings/display/sm501fb.txt +17 -0
index 1c79c267a57f..916b768cb340 100644
@@ -20,6 +20,23 @@ Optional properties:
   set different foreign endian.
 - big-endian: available on little endian systems, to
   set different foreign endian.
+- route: Framebuffer output route
+  "own": CRT=>CRT, Panel=>Panel
+  "crt-panel": Panel=>CRT, Panel=>Panel
+- swap-fb-endian: swap framebuffer byteorder
+- crt: CRT output control
+- panel: Panel output control
+- smi,devices: select peripheral functions.
+  available usb-host, usb-gadget, ssp0, ssp,1 uart0, uart1, accel,
+            ac97, i2s, gpio and all.
+- smi,mclk: SM501 mclk frequency.
+- smi,m1xclk: SM501 m1xclk frequency.
+- smi,misc-timing: SM501 Miscellaneous Timing reg value.
+- smi,misc-control: SM501 Miscellaneous Control reg value.
+- smi,gpio-low: SM501 GPIO31-0 Control reg value.
+- smi,gpio-high: SM501 GPIO63-32 Control reg value.
+- smi,num-i2c: I2C channel number.
+- smi,gpio-i2c: I2C assigned GPIO.
 
 Example for MPC5200:
 	display@1,0 {
Signature · 1 line
2.39.2
author maintainer
#50 lore raw

RFC PATCH v3 22/35 drivers/clocksource/sh_tmu: Add support CLOCKSOURCE.

In reply to Yoshinori Sato

Enables registration as a Clocksource in the case of OF.

---
 drivers/clocksource/sh_tmu.c | 161 +++++++++++++++++++++++------------
 1 file changed, 106 insertions(+), 55 deletions(-)
drivers/clocksource/sh_tmu.c +106 -55
index beffff81c00f..e4ae83c9f7d4 100644
@@ -17,6 +17,8 @@
 #include <linux/irq.h>
 #include <linux/module.h>
 #include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/pm_runtime.h>
@@ -65,6 +67,7 @@ struct sh_tmu_device {
 
 	bool has_clockevent;
 	bool has_clocksource;
+	const char *name;
 };
 
 #define TSTR -1 /* shared register */
@@ -148,8 +151,8 @@ static int __sh_tmu_enable(struct sh_tmu_channel *ch)
 	/* enable clock */
 	ret = clk_enable(ch->tmu->clk);
 	if (ret) {
-		dev_err(&ch->tmu->pdev->dev, "ch%u: cannot enable clock\n",
-			ch->index);
+		pr_err("%s ch%u: cannot enable clock\n",
+		       ch->tmu->name, ch->index);
 		return ret;
 	}
 
@@ -174,9 +177,10 @@ static int sh_tmu_enable(struct sh_tmu_channel *ch)
 	if (ch->enable_count++ > 0)
 		return 0;
 
-	pm_runtime_get_sync(&ch->tmu->pdev->dev);
-	dev_pm_syscore_device(&ch->tmu->pdev->dev, true);
-
+	if (ch->tmu->pdev) {
+		pm_runtime_get_sync(&ch->tmu->pdev->dev);
+		dev_pm_syscore_device(&ch->tmu->pdev->dev, true);
+	}
 	return __sh_tmu_enable(ch);
 }
 
@@ -202,8 +206,10 @@ static void sh_tmu_disable(struct sh_tmu_channel *ch)
 
 	__sh_tmu_disable(ch);
 
-	dev_pm_syscore_device(&ch->tmu->pdev->dev, false);
-	pm_runtime_put(&ch->tmu->pdev->dev);
+	if (ch->tmu->pdev) {
+		dev_pm_syscore_device(&ch->tmu->pdev->dev, false);
+		pm_runtime_put(&ch->tmu->pdev->dev);
+	}
 }
 
 static void sh_tmu_set_next(struct sh_tmu_channel *ch, unsigned long delta,
@@ -245,7 +251,7 @@ static irqreturn_t sh_tmu_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-static struct sh_tmu_channel *cs_to_sh_tmu(struct clocksource *cs)
+static inline struct sh_tmu_channel *cs_to_sh_tmu(struct clocksource *cs)
 {
 	return container_of(cs, struct sh_tmu_channel, cs);
 }
@@ -292,7 +298,8 @@ static void sh_tmu_clocksource_suspend(struct clocksource *cs)
 
 	if (--ch->enable_count == 0) {
 		__sh_tmu_disable(ch);
-		dev_pm_genpd_suspend(&ch->tmu->pdev->dev);
+		if (ch->tmu->pdev)
+			dev_pm_genpd_suspend(&ch->tmu->pdev->dev);
 	}
 }
 
@@ -304,7 +311,8 @@ static void sh_tmu_clocksource_resume(struct clocksource *cs)
 		return;
 
 	if (ch->enable_count++ == 0) {
-		dev_pm_genpd_resume(&ch->tmu->pdev->dev);
+		if (ch->tmu->pdev)
+			dev_pm_genpd_resume(&ch->tmu->pdev->dev);
 		__sh_tmu_enable(ch);
 	}
 }
@@ -324,14 +332,14 @@ static int sh_tmu_register_clocksource(struct sh_tmu_channel *ch,
 	cs->mask = CLOCKSOURCE_MASK(32);
 	cs->flags = CLOCK_SOURCE_IS_CONTINUOUS;
 
-	dev_info(&ch->tmu->pdev->dev, "ch%u: used as clock source\n",
-		 ch->index);
+	pr_info("%s ch%u: used as clock source\n",
+		ch->tmu->name, ch->index);
 
 	clocksource_register_hz(cs, ch->tmu->rate);
 	return 0;
 }
 
-static struct sh_tmu_channel *ced_to_sh_tmu(struct clock_event_device *ced)
+static inline struct sh_tmu_channel *ced_to_sh_tmu(struct clock_event_device *ced)
 {
 	return container_of(ced, struct sh_tmu_channel, ced);
 }
@@ -364,8 +372,8 @@ static int sh_tmu_clock_event_set_state(struct clock_event_device *ced,
 	if (clockevent_state_oneshot(ced) || clockevent_state_periodic(ced))
 		sh_tmu_disable(ch);
 
-	dev_info(&ch->tmu->pdev->dev, "ch%u: used for %s clock events\n",
-		 ch->index, periodic ? "periodic" : "oneshot");
+	pr_info("%s ch%u: used for %s clock events\n",
+		ch->tmu->name, ch->index, periodic ? "periodic" : "oneshot");
 	sh_tmu_clock_event_start(ch, periodic);
 	return 0;
 }
@@ -403,7 +411,8 @@ static void sh_tmu_clock_event_resume(struct clock_event_device *ced)
 }
 
 static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
-				       const char *name)
+				       const char *name,
+				       struct device_node *np)
 {
 	struct clock_event_device *ced = &ch->ced;
 	int ret;
@@ -417,30 +426,32 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
 	ced->set_state_shutdown = sh_tmu_clock_event_shutdown;
 	ced->set_state_periodic = sh_tmu_clock_event_set_periodic;
 	ced->set_state_oneshot = sh_tmu_clock_event_set_oneshot;
-	ced->suspend = sh_tmu_clock_event_suspend;
-	ced->resume = sh_tmu_clock_event_resume;
-
-	dev_info(&ch->tmu->pdev->dev, "ch%u: used for clock events\n",
-		 ch->index);
+	if (ch->tmu->pdev) {
+		ced->suspend = sh_tmu_clock_event_suspend;
+		ced->resume = sh_tmu_clock_event_resume;
+	}
+	pr_info("%s ch%u: used for clock events\n",
+		ch->tmu->name, ch->index);
 
 	clockevents_config_and_register(ced, ch->tmu->rate, 0x300, 0xffffffff);
 
 	ret = request_irq(ch->irq, sh_tmu_interrupt,
 			  IRQF_TIMER | IRQF_IRQPOLL | IRQF_NOBALANCING,
-			  dev_name(&ch->tmu->pdev->dev), ch);
+			  ch->tmu->name, ch);
 	if (ret) {
-		dev_err(&ch->tmu->pdev->dev, "ch%u: failed to request irq %d\n",
-			ch->index, ch->irq);
+		pr_err("%s ch%u: failed to request irq %d\n",
+		       ch->tmu->name, ch->index, ch->irq);
 		return;
 	}
 }
 
 static int sh_tmu_register(struct sh_tmu_channel *ch, const char *name,
+			   struct device_node *np,
 			   bool clockevent, bool clocksource)
 {
 	if (clockevent) {
 		ch->tmu->has_clockevent = true;
-		sh_tmu_register_clockevent(ch, name);
+		sh_tmu_register_clockevent(ch, name, np);
 	} else if (clocksource) {
 		ch->tmu->has_clocksource = true;
 		sh_tmu_register_clocksource(ch, name);
@@ -451,7 +462,8 @@ static int sh_tmu_register(struct sh_tmu_channel *ch, const char *name,
 
 static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
 				bool clockevent, bool clocksource,
-				struct sh_tmu_device *tmu)
+				struct sh_tmu_device *tmu,
+				struct device_node *np)
 {
 	/* Skip unused channels. */
 	if (!clockevent && !clocksource)
@@ -465,53 +477,59 @@ static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
 	else
 		ch->base = tmu->mapbase + 8 + ch->index * 12;
 
-	ch->irq = platform_get_irq(tmu->pdev, index);
+	if (tmu->pdev)
+		ch->irq = platform_get_irq(tmu->pdev, index);
+	else
+		ch->irq = of_irq_get(np, index);
 	if (ch->irq < 0)
 		return ch->irq;
 
 	ch->cs_enabled = false;
 	ch->enable_count = 0;
 
-	return sh_tmu_register(ch, dev_name(&tmu->pdev->dev),
+	return sh_tmu_register(ch, tmu->name, np,
 			       clockevent, clocksource);
 }
 
-static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
+static int sh_tmu_map_memory(struct sh_tmu_device *tmu, struct device_node *np)
 {
 	struct resource *res;
 
-	res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&tmu->pdev->dev, "failed to get I/O memory\n");
-		return -ENXIO;
-	}
+	if (tmu->pdev) {
+		res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
+		if (!res) {
+			pr_err("sh_tmu failed to get I/O memory\n");
+			return -ENXIO;
+		}
+
+		tmu->mapbase = ioremap(res->start, resource_size(res));
+	} else
+		tmu->mapbase = of_iomap(np, 0);
 
-	tmu->mapbase = ioremap(res->start, resource_size(res));
 	if (tmu->mapbase == NULL)
 		return -ENXIO;
 
 	return 0;
 }
 
-static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
+static int sh_tmu_parse_dt(struct sh_tmu_device *tmu, struct device_node *np)
 {
-	struct device_node *np = tmu->pdev->dev.of_node;
-
 	tmu->model = SH_TMU;
 	tmu->num_channels = 3;
 
 	of_property_read_u32(np, "#renesas,channels", &tmu->num_channels);
 
 	if (tmu->num_channels != 2 && tmu->num_channels != 3) {
-		dev_err(&tmu->pdev->dev, "invalid number of channels %u\n",
-			tmu->num_channels);
+		pr_err("%s: invalid number of channels %u\n",
+		       tmu->name, tmu->num_channels);
 		return -EINVAL;
 	}
 
 	return 0;
 }
 
-static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+static int sh_tmu_setup(struct sh_tmu_device *tmu,
+			struct platform_device *pdev, struct device_node *np)
 {
 	unsigned int i;
 	int ret;
@@ -520,8 +538,13 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 
 	raw_spin_lock_init(&tmu->lock);
 
-	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
-		ret = sh_tmu_parse_dt(tmu);
+	if (pdev)
+		tmu->name = dev_name(&pdev->dev);
+	else
+		tmu->name = of_node_full_name(np);
+
+	if (IS_ENABLED(CONFIG_OF) && np) {
+		ret = sh_tmu_parse_dt(tmu, np);
 		if (ret < 0)
 			return ret;
 	} else if (pdev->dev.platform_data) {
@@ -531,14 +554,17 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 		tmu->model = id->driver_data;
 		tmu->num_channels = hweight8(cfg->channels_mask);
 	} else {
-		dev_err(&tmu->pdev->dev, "missing platform data\n");
+		pr_err("%s missing platform data\n", tmu->name);
 		return -ENXIO;
 	}
 
 	/* Get hold of clock. */
-	tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+	if (pdev)
+		tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+	else
+		tmu->clk = of_clk_get(np, 0);
 	if (IS_ERR(tmu->clk)) {
-		dev_err(&tmu->pdev->dev, "cannot get clock\n");
+		pr_err("%s: cannot get clock\n", tmu->name);
 		return PTR_ERR(tmu->clk);
 	}
 
@@ -555,9 +581,9 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 	clk_disable(tmu->clk);
 
 	/* Map the memory resource. */
-	ret = sh_tmu_map_memory(tmu);
+	ret = sh_tmu_map_memory(tmu, np);
 	if (ret < 0) {
-		dev_err(&tmu->pdev->dev, "failed to remap I/O memory\n");
+		pr_err("%s: failed to remap I/O memory\n", tmu->name);
 		goto err_clk_unprepare;
 	}
 
@@ -575,12 +601,12 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 	 */
 	for (i = 0; i < tmu->num_channels; ++i) {
 		ret = sh_tmu_channel_setup(&tmu->channels[i], i,
-					   i == 0, i == 1, tmu);
+					   i == 0, i == 1, tmu, np);
 		if (ret < 0)
 			goto err_unmap;
 	}
-
-	platform_set_drvdata(pdev, tmu);
+	if (pdev)
+		platform_set_drvdata(pdev, tmu);
 
 	return 0;
 
@@ -594,6 +620,7 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
 	return ret;
 }
 
+#ifndef CONFIG_SH_DEVICE_TREE
 static int sh_tmu_probe(struct platform_device *pdev)
 {
 	struct sh_tmu_device *tmu = platform_get_drvdata(pdev);
@@ -613,7 +640,7 @@ static int sh_tmu_probe(struct platform_device *pdev)
 	if (tmu == NULL)
 		return -ENOMEM;
 
-	ret = sh_tmu_setup(tmu, pdev);
+	ret = sh_tmu_setup(tmu, pdev, pdev->dev.of_node);
 	if (ret) {
 		kfree(tmu);
 		pm_runtime_idle(&pdev->dev);
@@ -631,7 +658,26 @@ static int sh_tmu_probe(struct platform_device *pdev)
 
 	return 0;
 }
+#else
+static int __init sh_tmu_of_register(struct device_node *np)
+{
+	struct sh_tmu_device *tmu;
+	int ret;
+
+	tmu = kzalloc(sizeof(*tmu), GFP_KERNEL);
+	if (tmu == NULL)
+		return -ENOMEM;
+
+	ret = sh_tmu_setup(tmu, NULL, np);
+	if (ret) {
+		kfree(tmu);
+		pr_warn("%pOF: Timer register failed (%d)", np, ret);
+	}
+	return ret;
+}
+#endif
 
+#ifndef CONFIG_SH_DEVICE_TREE
 static const struct platform_device_id sh_tmu_id_table[] = {
 	{ "sh-tmu", SH_TMU },
 	{ "sh-tmu-sh3", SH_TMU_SH3 },
@@ -665,12 +711,17 @@ static void __exit sh_tmu_exit(void)
 	platform_driver_unregister(&sh_tmu_device_driver);
 }
 
+subsys_initcall(sh_tmu_init);
+module_exit(sh_tmu_exit);
+#endif
+
 #ifdef CONFIG_SUPERH
+#ifdef CONFIG_SH_DEVICE_TREE
+TIMER_OF_DECLARE(sh_tmu, "renesas,tmu", sh_tmu_of_register);
+#else
 sh_early_platform_init("earlytimer", &sh_tmu_device_driver);
 #endif
-
-subsys_initcall(sh_tmu_init);
-module_exit(sh_tmu_exit);
+#endif
 
 MODULE_AUTHOR("Magnus Damm");
 MODULE_DESCRIPTION("SuperH TMU Timer Driver");
Signature · 1 line
2.39.2
#51 lore raw

Re: [RFC PATCH v3 22/35] drivers/clocksource/sh_tmu: Add support CLOCKSOURCE.

Hi Sato-san,

Thanks for your patch!

Quoted 1 line · Yoshinori Sato

Enables registration as a Clocksource in the case of OF.

I think this is not a good description.
What this patch does, is to add support for early registration using TIMER_OF_DECLARE(), so the timer can be used as a clocksource on SoCs that do not have any other suitable timer.

Then I wondered: do you need this? On R-Mobile A1, the TMU is also used as a clocksource, how come it works there?
The trick is to set preset_lpj based on the CPU core clock frequency.

I see your v2 actually added that, but you dropped the code in v3.
https://lore.kernel.org/linux-sh/236185b4a47f303332aafeacadd9c9652e650062.1694596125.git.ysato@users.sourceforge.jp
Nevertheless, it doesn't work anymore, as you also removed the clock-frequency property from cpu@0 in DT...
Adding that makes it work without this TMU patch.

drivers/clocksource/sh_tmu.c static void sh_tmu_clock_event_resume(struct clock_event_device *ced) · line 415

Quoted 12 lines
drivers/clocksource/sh_tmu.c +2 -1
@@ -403,7 +411,8 @@ static void sh_tmu_clock_event_resume(struct clock_event_device *ced)
 }
 
 static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
-                                      const char *name)
+                                      const char *name,
+                                      struct device_node *np)

"np" is unused in this function, hence this change is unneeded.

Quoted 6 lines
drivers/clocksource/sh_tmu.c +0 -0
 {
        struct clock_event_device *ced = &ch->ced;
        int ret;

static int sh_tmu_register(struct sh_tmu_channel *ch, const char *name,
+ struct device_node *np,

This change is unneeded...

drivers/clocksource/sh_tmu.c static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, · line 454

Quoted 6 lines

bool clockevent, bool clocksource)

 {
        if (clockevent) {
                ch->tmu->has_clockevent = true;
drivers/clocksource/sh_tmu.c +1 -1
-               sh_tmu_register_clockevent(ch, name);
+               sh_tmu_register_clockevent(ch, name, np);

... as sh_tmu_register_clockevent() doesn't use "np".

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 483

Quoted 13 lines
        } else if (clocksource) {
                ch->tmu->has_clocksource = true;
                sh_tmu_register_clocksource(ch, name);
drivers/clocksource/sh_tmu.c +4 -1
@@ -465,53 +477,59 @@ static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
        else
                ch->base = tmu->mapbase + 8 + ch->index * 12;
 
-       ch->irq = platform_get_irq(tmu->pdev, index);
+       if (tmu->pdev)
+               ch->irq = platform_get_irq(tmu->pdev, index);
+       else
+               ch->irq = of_irq_get(np, index);

You can use of_irq_get() uncondtionally.

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 490

Quoted 8 lines
drivers/clocksource/sh_tmu.c +1 -1
        if (ch->irq < 0)
                return ch->irq;
 
        ch->cs_enabled = false;
        ch->enable_count = 0;
 
-       return sh_tmu_register(ch, dev_name(&tmu->pdev->dev),
+       return sh_tmu_register(ch, tmu->name, np,

No need to pass np.

Quoted 13 lines
drivers/clocksource/sh_tmu.c +1 -6
                               clockevent, clocksource);
 }
 
-static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
+static int sh_tmu_map_memory(struct sh_tmu_device *tmu, struct device_node *np)
 {
        struct resource *res;
 
-       res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&tmu->pdev->dev, "failed to get I/O memory\n");
-               return -ENXIO;
-       }

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 507

Quoted 10 lines
drivers/clocksource/sh_tmu.c +10 -0
+       if (tmu->pdev) {
+               res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
+               if (!res) {
+                       pr_err("sh_tmu failed to get I/O memory\n");
+                       return -ENXIO;
+               }
+
+               tmu->mapbase = ioremap(res->start, resource_size(res));
+       } else
+               tmu->mapbase = of_iomap(np, 0);

You can use of_iomap() unconditionally.

Quoted 41 lines
drivers/clocksource/sh_tmu.c +5 -8
-       tmu->mapbase = ioremap(res->start, resource_size(res));
        if (tmu->mapbase == NULL)
                return -ENXIO;
 
        return 0;
 }
 
-static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
+static int sh_tmu_parse_dt(struct sh_tmu_device *tmu, struct device_node *np)
 {
-       struct device_node *np = tmu->pdev->dev.of_node;
-
        tmu->model = SH_TMU;
        tmu->num_channels = 3;
 
        of_property_read_u32(np, "#renesas,channels", &tmu->num_channels);
 
        if (tmu->num_channels != 2 && tmu->num_channels != 3) {
-               dev_err(&tmu->pdev->dev, "invalid number of channels %u\n",
-                       tmu->num_channels);
+               pr_err("%s: invalid number of channels %u\n",
+                      tmu->name, tmu->num_channels);
                return -EINVAL;
        }
 
        return 0;
 }
 
-static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+static int sh_tmu_setup(struct sh_tmu_device *tmu,
+                       struct platform_device *pdev, struct device_node *np)
 {
        unsigned int i;
        int ret;
 
@@ -531,14 +554,17 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
                tmu->model = id->driver_data;
                tmu->num_channels = hweight8(cfg->channels_mask);
        } else {
-               dev_err(&tmu->pdev->dev, "missing platform data\n");

drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 565

Quoted 10 lines
drivers/clocksource/sh_tmu.c +5 -1
+               pr_err("%s missing platform data\n", tmu->name);
                return -ENXIO;
        }
 
        /* Get hold of clock. */
-       tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+       if (pdev)
+               tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+       else
+               tmu->clk = of_clk_get(np, 0);

You can use of_clk_get() unconditionally.

drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 570

Quoted 6 lines
drivers/clocksource/sh_tmu.c +1 -1
        if (IS_ERR(tmu->clk)) {
-               dev_err(&tmu->pdev->dev, "cannot get clock\n");
+               pr_err("%s: cannot get clock\n", tmu->name);
                return PTR_ERR(tmu->clk);
        }
 

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#52 lore raw

Re: [RFC PATCH v3 22/35] drivers/clocksource/sh_tmu: Add support CLOCKSOURCE.

Quoted 18 lines · Geert Uytterhoeven

Hi Sato-san,

Thanks for your patch!

Quoted 1 line · Yoshinori Sato

Enables registration as a Clocksource in the case of OF.

I think this is not a good description.
What this patch does, is to add support for early registration using TIMER_OF_DECLARE(), so the timer can be used as a clocksource on SoCs that do not have any other suitable timer.

Then I wondered: do you need this? On R-Mobile A1, the TMU is also used as a clocksource, how come it works there?
The trick is to set preset_lpj based on the CPU core clock frequency.

Quoted 5 lines

I see your v2 actually added that, but you dropped the code in v3.
https://lore.kernel.org/linux-sh/236185b4a47f303332aafeacadd9c9652e650062.1694596125.git.ysato@users.sourceforge.jp
Nevertheless, it doesn't work anymore, as you also removed the clock-frequency property from cpu@0 in DT...
Adding that makes it work without this TMU patch.

Currently sh initializes the timer with a parameter called "earlytimer", but this does not seem to work correctly with CONFIG_OF.
It will be initialized later when of_platform_depopulate is called, so it can be started, but I think this is incorrect initialization of the timer.
I think it's better to follow the OF procedure rather than the old SH-specific framework.

Quoted 157 lines

drivers/clocksource/sh_tmu.c static void sh_tmu_clock_event_resume(struct clock_event_device *ced) · line 415

Quoted 12 lines
drivers/clocksource/sh_tmu.c +2 -1
@@ -403,7 +411,8 @@ static void sh_tmu_clock_event_resume(struct clock_event_device *ced)
 }
 
 static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch,
-                                      const char *name)
+                                      const char *name,
+                                      struct device_node *np)

"np" is unused in this function, hence this change is unneeded.

Quoted 6 lines
drivers/clocksource/sh_tmu.c +0 -0
 {
        struct clock_event_device *ced = &ch->ced;
        int ret;

static int sh_tmu_register(struct sh_tmu_channel *ch, const char *name,
+ struct device_node *np,

This change is unneeded...

drivers/clocksource/sh_tmu.c static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, · line 454

Quoted 6 lines

bool clockevent, bool clocksource)

 {
        if (clockevent) {
                ch->tmu->has_clockevent = true;
drivers/clocksource/sh_tmu.c +1 -1
-               sh_tmu_register_clockevent(ch, name);
+               sh_tmu_register_clockevent(ch, name, np);

... as sh_tmu_register_clockevent() doesn't use "np".

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 483

Quoted 13 lines
        } else if (clocksource) {
                ch->tmu->has_clocksource = true;
                sh_tmu_register_clocksource(ch, name);
drivers/clocksource/sh_tmu.c +4 -1
@@ -465,53 +477,59 @@ static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index,
        else
                ch->base = tmu->mapbase + 8 + ch->index * 12;
 
-       ch->irq = platform_get_irq(tmu->pdev, index);
+       if (tmu->pdev)
+               ch->irq = platform_get_irq(tmu->pdev, index);
+       else
+               ch->irq = of_irq_get(np, index);

You can use of_irq_get() uncondtionally.

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 490

Quoted 8 lines
drivers/clocksource/sh_tmu.c +1 -1
        if (ch->irq < 0)
                return ch->irq;
 
        ch->cs_enabled = false;
        ch->enable_count = 0;
 
-       return sh_tmu_register(ch, dev_name(&tmu->pdev->dev),
+       return sh_tmu_register(ch, tmu->name, np,

No need to pass np.

Quoted 13 lines
drivers/clocksource/sh_tmu.c +1 -6
                               clockevent, clocksource);
 }
 
-static int sh_tmu_map_memory(struct sh_tmu_device *tmu)
+static int sh_tmu_map_memory(struct sh_tmu_device *tmu, struct device_node *np)
 {
        struct resource *res;
 
-       res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
-       if (!res) {
-               dev_err(&tmu->pdev->dev, "failed to get I/O memory\n");
-               return -ENXIO;
-       }

drivers/clocksource/sh_tmu.c static int sh_tmu_channel_setup(struct sh_tmu_channel *ch, unsigned int index, · line 507

Quoted 10 lines
drivers/clocksource/sh_tmu.c +10 -0
+       if (tmu->pdev) {
+               res = platform_get_resource(tmu->pdev, IORESOURCE_MEM, 0);
+               if (!res) {
+                       pr_err("sh_tmu failed to get I/O memory\n");
+                       return -ENXIO;
+               }
+
+               tmu->mapbase = ioremap(res->start, resource_size(res));
+       } else
+               tmu->mapbase = of_iomap(np, 0);

You can use of_iomap() unconditionally.

Quoted 41 lines
drivers/clocksource/sh_tmu.c +5 -8
-       tmu->mapbase = ioremap(res->start, resource_size(res));
        if (tmu->mapbase == NULL)
                return -ENXIO;
 
        return 0;
 }
 
-static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)
+static int sh_tmu_parse_dt(struct sh_tmu_device *tmu, struct device_node *np)
 {
-       struct device_node *np = tmu->pdev->dev.of_node;
-
        tmu->model = SH_TMU;
        tmu->num_channels = 3;
 
        of_property_read_u32(np, "#renesas,channels", &tmu->num_channels);
 
        if (tmu->num_channels != 2 && tmu->num_channels != 3) {
-               dev_err(&tmu->pdev->dev, "invalid number of channels %u\n",
-                       tmu->num_channels);
+               pr_err("%s: invalid number of channels %u\n",
+                      tmu->name, tmu->num_channels);
                return -EINVAL;
        }
 
        return 0;
 }
 
-static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
+static int sh_tmu_setup(struct sh_tmu_device *tmu,
+                       struct platform_device *pdev, struct device_node *np)
 {
        unsigned int i;
        int ret;
 
@@ -531,14 +554,17 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)
                tmu->model = id->driver_data;
                tmu->num_channels = hweight8(cfg->channels_mask);
        } else {
-               dev_err(&tmu->pdev->dev, "missing platform data\n");

drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 565

Quoted 10 lines
drivers/clocksource/sh_tmu.c +5 -1
+               pr_err("%s missing platform data\n", tmu->name);
                return -ENXIO;
        }
 
        /* Get hold of clock. */
-       tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+       if (pdev)
+               tmu->clk = clk_get(&tmu->pdev->dev, "fck");
+       else
+               tmu->clk = of_clk_get(np, 0);

You can use of_clk_get() unconditionally.

drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 570

Quoted 6 lines
drivers/clocksource/sh_tmu.c +1 -1
        if (IS_ERR(tmu->clk)) {
-               dev_err(&tmu->pdev->dev, "cannot get clock\n");
+               pr_err("%s: cannot get clock\n", tmu->name);
                return PTR_ERR(tmu->clk);
        }
 

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Signature · 1 line
Yosinori Sato
author maintainer
#53 lore raw

RFC PATCH v3 23/35 Documentation/devicetree/bindings/timer: renesas,tmu.yaml add SH.

In reply to Yoshinori Sato
---
 .../devicetree/bindings/timer/renesas,tmu.yaml        | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/timer/renesas,tmu.yaml +10 -1
index a67e427a9e7e..0c609d54ff10 100644
@@ -21,6 +21,7 @@ properties:
   compatible:
     items:
       - enum:
+          - renesas,tmu-sh       # SH
           - renesas,tmu-r8a7740  # R-Mobile A1
           - renesas,tmu-r8a774a1 # RZ/G2M
           - renesas,tmu-r8a774b1 # RZ/G2N
@@ -46,7 +47,14 @@ properties:
 
   interrupts:
     minItems: 2
-    maxItems: 3
+    maxItems: 4
+
+  interrupt-names:
+    items:
+      - const: tuni0
+      - const: tuni1
+      - const: tuni2
+      - const: ticpi2
 
   clocks:
     maxItems: 1
@@ -84,6 +92,7 @@ if:
             - renesas,tmu-r8a7740
             - renesas,tmu-r8a7778
             - renesas,tmu-r8a7779
+            - renesas,tmu-sh
 then:
   required:
     - resets
Signature · 1 line
2.39.2
#54 lore raw

Re: [RFC PATCH v3 23/35] Documentation/devicetree/bindings/timer: renesas,tmu.yaml add SH.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Documentation/devicetree/bindings/timer/renesas,tmu.yaml properties: · line 24

Quoted 7 lines
Documentation/devicetree/bindings/timer/renesas,tmu.yaml +1 -0
@@ -21,6 +21,7 @@ properties:
   compatible:
     items:
       - enum:
+          - renesas,tmu-sh       # SH

Please use an SoC-specific compatible value: renesas,tmu-sh7750

Quoted 6 lines
Documentation/devicetree/bindings/timer/renesas,tmu.yaml +0 -0
           - renesas,tmu-r8a7740  # R-Mobile A1
           - renesas,tmu-r8a774a1 # RZ/G2M
           - renesas,tmu-r8a774b1 # RZ/G2N
@@ -46,7 +47,14 @@ properties:
 
   interrupts:

Documentation/devicetree/bindings/timer/renesas,tmu.yaml properties: · line 57

Quoted 10 lines
Documentation/devicetree/bindings/timer/renesas,tmu.yaml +8 -1
     minItems: 2
-    maxItems: 3
+    maxItems: 4
+
+  interrupt-names:
+    items:
+      - const: tuni0
+      - const: tuni1
+      - const: tuni2
+      - const: ticpi2

I'm delighted to see support for the 4th interrupt, finally!

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#55 lore raw

RFC PATCH v3 24/35 include/dt-binding/interrupt-controller/sh_intc.h: renesas,sh7751-intc.h helper

In reply to Yoshinori Sato

SH7751 Interrupt controller binding helper.

---
 .../dt-bindings/interrupt-controller/sh_intc.h | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h
include/dt-bindings/interrupt-controller/sh_intc.h new file +18 -0
new file mode 100644
index 000000000000..956259e985ea
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * SH3/4 INTC EVT - IRQ conversion
+ */
+
+#define evt2irq(evt)		((evt) >> 5)
+#define irq2evt(irq)		((irq) << 5)
+
+#define IPRDEF(e, o, b)		< e o b >
+#define IPRA			0
+#define IPRB			4
+#define IPRC			8
+#define IPRD			12
+#define INTPRI00		256
+#define IPR_B12			12
+#define IPR_B8			8
+#define IPR_B4			4
+#define IPR_B0			0
Signature · 1 line
2.39.2
#56 lore raw

Re: [RFC PATCH v3 24/35] include/dt-binding/interrupt-controller/sh_intc.h: renesas,sh7751-intc.h helper

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

SH7751 Interrupt controller binding helper.

Thanks for your patch!

include/dt-bindings/interrupt-controller/sh_intc.h line 7

Quoted 10 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +7 -0
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * SH3/4 INTC EVT - IRQ conversion
+ */
+
+#define evt2irq(evt)           ((evt) >> 5)
+#define irq2evt(irq)           ((irq) << 5)

Please drop irq2evt() as it is not used, and not needed, in DTS files.

include/dt-bindings/interrupt-controller/sh_intc.h line 9

Quoted 2 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +2 -0
+
+#define IPRDEF(e, o, b)                < e o b >

Please drop this macro, it doesn't add any value.

include/dt-bindings/interrupt-controller/sh_intc.h line 18

Quoted 9 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +9 -0
+#define IPRA                   0
+#define IPRB                   4
+#define IPRC                   8
+#define IPRD                   12
+#define INTPRI00               256
+#define IPR_B12                        12
+#define IPR_B8                 8
+#define IPR_B4                 4
+#define IPR_B0                 0

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#57 lore raw

Re: [RFC PATCH v3 24/35] include/dt-binding/interrupt-controller/sh_intc.h: renesas,sh7751-intc.h helper

Quoted 10 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

SH7751 Interrupt controller binding helper.

Thanks for your patch!

Quoted 12 lines

include/dt-bindings/interrupt-controller/sh_intc.h line 7

Quoted 10 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +7 -0
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+ *
+ * SH3/4 INTC EVT - IRQ conversion
+ */
+
+#define evt2irq(evt)           ((evt) >> 5)
+#define irq2evt(irq)           ((irq) << 5)

Please drop irq2evt() as it is not used, and not needed, in DTS files.

And we talked about this already... just like about few other things which did not improve. This patchset is repeating the same issues over and over again.

Please call it not RFC, but "DO NOT MERGE" or something like this.

Best regards,
Krzysztof

author maintainer
#58 lore raw

RFC PATCH v3 25/35 Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

In reply to Yoshinori Sato

Renesas SuperH binding definition.

---
 .../devicetree/bindings/sh/cpus.yaml          | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sh/cpus.yaml
Documentation/devicetree/bindings/sh/cpus.yaml new file +45 -0
new file mode 100644
index 000000000000..273df4dfb74e
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - renesas,sh4
+      - const: renesas,sh
+
+  clock-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      CPU core clock freqency.
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+        cpus {
+                cpu: cpu@0 {
+                      compatible = "renesas,sh4", "renesas,sh";
+                };
+        };
+...
Signature · 1 line
2.39.2
#59 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH binding definition.

Thanks for your patch!

Quoted 17 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Documentation/devicetree/bindings/sh/cpus.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

Missing reg property.
Missing "device_type: true".

Documentation/devicetree/bindings/sh/cpus.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +5 -0
+
+  clock-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      CPU core clock freqency.

Perhaps a "clocks" property instead, or as an alternative?

On sh7750, you do have

    clocks = <&cpg SH7750_CPG_ICK>;

Documentation/devicetree/bindings/sh/cpus.yaml line 40

Quoted 9 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +9 -0
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+        cpus {

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sh/cpus.yaml:

Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#
Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 42

Quoted 2 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+                cpu: cpu@0 {
+                      compatible = "renesas,sh4", "renesas,sh";

Documentation/devicetree/bindings/sh/cpus.example.dts:19.28-21.19:
Warning (unit_address_vs_reg): /example-0/cpus/cpu@0: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus: cpu@0:
'cache-level' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 45

Quoted 3 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +3 -0
+                };
+        };
+...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#60 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Quoted 43 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH binding definition.

Thanks for your patch!

Quoted 17 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Quoted 8 lines

Documentation/devicetree/bindings/sh/cpus.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2", but the SH7619 (SH2 CPU) would look like the following.

cpus {
	cpu: cpu@0 {
        	compatible = "renesas,sh2", "renesas,sh2";
        };
};
Quoted 59 lines

Missing reg property.
Missing "device_type: true".

Documentation/devicetree/bindings/sh/cpus.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +5 -0
+
+  clock-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      CPU core clock freqency.

Perhaps a "clocks" property instead, or as an alternative?

On sh7750, you do have

    clocks = <&cpg SH7750_CPG_ICK>;

Documentation/devicetree/bindings/sh/cpus.yaml line 40

Quoted 9 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +9 -0
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+        cpus {

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sh/cpus.yaml:

Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#
Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 42

Quoted 2 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+                cpu: cpu@0 {
+                      compatible = "renesas,sh4", "renesas,sh";

Documentation/devicetree/bindings/sh/cpus.example.dts:19.28-21.19:
Warning (unit_address_vs_reg): /example-0/cpus/cpu@0: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus: cpu@0:
'cache-level' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 45

Quoted 3 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +3 -0
+                };
+        };
+...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Signature · 1 line
Yosinori Sato
#61 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Hi Sato-san,

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

J.

Quoted 128 lines · Yoshinori Sato
Quoted 43 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH binding definition.

Thanks for your patch!

Quoted 17 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Quoted 8 lines

Documentation/devicetree/bindings/sh/cpus.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2", but the SH7619 (SH2 CPU) would look like the following.

cpus {
	cpu: cpu@0 {
       	compatible = "renesas,sh2", "renesas,sh2";
       };
};
Quoted 59 lines

Missing reg property.
Missing "device_type: true".

Documentation/devicetree/bindings/sh/cpus.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +5 -0
+
+  clock-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      CPU core clock freqency.

Perhaps a "clocks" property instead, or as an alternative?

On sh7750, you do have

   clocks = <&cpg SH7750_CPG_ICK>;

Documentation/devicetree/bindings/sh/cpus.yaml line 40

Quoted 9 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +9 -0
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+        cpus {

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sh/cpus.yaml:

Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#
Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 42

Quoted 2 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+                cpu: cpu@0 {
+                      compatible = "renesas,sh4", "renesas,sh";

Documentation/devicetree/bindings/sh/cpus.example.dts:19.28-21.19:
Warning (unit_address_vs_reg): /example-0/cpus/cpu@0: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus: cpu@0:
'cache-level' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 45

Quoted 3 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +3 -0
+                };
+        };
+...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                               -- Linus Torvalds
Signature · 1 line
Yosinori Sato
#62 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Hi Jeff,

Quoted 39 lines · D. Jeff Dionne
Quoted 39 lines · Yoshinori Sato
Quoted 36 lines · Geert Uytterhoeven
Quoted 21 lines · Yoshinori Sato

Renesas SuperH binding definition.

Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

Quoted 3 lines
Quoted 1 line
Quoted 1 line

- jcore,j2

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

Compatible values do not declare any such endorsement.

Quoted 1 line

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

The question is: does J2 implement the same instruction set as SH2, i.e. can it run unmodified SH2 code?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2",

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#63 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Quoted 2 lines · Geert Uytterhoeven

Hi Jeff,

Hi Geert,

Quoted 43 lines · D. Jeff Dionne
Quoted 40 lines
Quoted 40 lines · Yoshinori Sato
Quoted 37 lines · Geert Uytterhoeven
Quoted 21 lines · Yoshinori Sato

Renesas SuperH binding definition.

Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Quoted 8 lines
Quoted 1 line

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

Compatible values do not declare any such endorsement.

Quoted 1 line

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

The question is: does J2 implement the same instruction set as SH2, i.e. can it run unmodified SH2 code?

It can run all SH2 code, but an SH2 cannot run all J2 code.

The GCC compilers we use for J2 generate J2 code, not strictly SH2 code.

The main difference is SH3 dynamic shift, and (S390 derived) Compare And Swap. The new FPU is in testing now, and AFAIK there is no FPU for SH2 but I’m not sure.

Cheers,
J.

Quoted 24 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2",

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                               -- Linus Torvalds
#64 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Hi Jeff,

Quoted 25 lines · D. Jeff Dionne
Quoted 24 lines · Geert Uytterhoeven
Quoted 22 lines · D. Jeff Dionne
Quoted 12 lines · Yoshinori Sato
Quoted 8 lines · Geert Uytterhoeven
Quoted 6 lines · Yoshinori Sato

Renesas SuperH binding definition.

Documentation/devicetree/bindings/sh/cpus.yaml new file +0 -0
Quoted 8 lines
Quoted 8 lines

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +4 -0
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

Quoted 8 lines
Quoted 6 lines

Compatible values do not declare any such endorsement.

Quoted 1 line

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

The question is: does J2 implement the same instruction set as SH2, i.e. can it run unmodified SH2 code?

It can run all SH2 code, but an SH2 cannot run all J2 code.

This is exactly what

    compatible = "jcore,j2", "renesas,sh2";

represents.
Cfr. Section 2.3.1 ("compatible") of the Devicetree Specification
https://www.devicetree.org/specifications

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#65 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

Quoted 36 lines · Geert Uytterhoeven

Hi Jeff,

Quoted 29 lines · D. Jeff Dionne
Quoted 28 lines · Geert Uytterhoeven
Quoted 17 lines · D. Jeff Dionne
Quoted 17 lines · Yoshinori Sato
Quoted 14 lines · Geert Uytterhoeven
Quoted 11 lines · Yoshinori Sato

Renesas SuperH binding definition.

Documentation/devicetree/bindings/sh/cpus.yaml new file +4 -0
 
+properties:
+  compatible:
+    items:
+      - enum:
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines

Missing

- jcore,j2

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

Compatible values do not declare any such endorsement.

Quoted 1 line

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

The question is: does J2 implement the same instruction set as SH2, i.e. can it run unmodified SH2 code?

It can run all SH2 code, but an SH2 cannot run all J2 code.

This is exactly what

   compatible = "jcore,j2", "renesas,sh2";

Oh, yes. I agree, this is correct. Once this is settled upon, we can change new J2 cores so they will export their ROM device tree with the sh2 fallback.

Down thread, Sato-san proposes “renesas,sh4”, “renesas,sh” I’m not sure I understand what a “renesas,sh” base fallback is.

J.

Quoted 14 lines

represents.
Cfr. Section 2.3.1 ("compatible") of the Devicetree Specification
https://www.devicetree.org/specifications

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                               -- Linus Torvalds
author maintainer
#66 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

In reply to D. Jeff Dionne
Quoted 7 lines · D. Jeff Dionne

Hi Sato-san,

We must not imply that Renesas is responsible for J2, or that it is a sanctioned SH core.

J-Core has the responsibility for maintenance of those SH ISA compatible cores.

Yes. I know.
I intended to write about ISA compatibility.

Quoted 131 lines

J.

Quoted 128 lines · Yoshinori Sato
Quoted 43 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH binding definition.

Thanks for your patch!

Quoted 17 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +14 -0
@@ -0,0 +1,45 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sh/cpus.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH CPUs
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+description: |+
+  The device tree allows to describe the layout of CPUs in a system through
+  the "cpus" node, which in turn contains a number of subnodes (ie "cpu")

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 10 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +10 -0
+  defining properties for every cpu.
+
+  Bindings for CPU nodes follow the Devicetree Specification, available from:
+
+  https://www.devicetree.org/specifications/
+
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Quoted 8 lines

Documentation/devicetree/bindings/sh/cpus.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2", but the SH7619 (SH2 CPU) would look like the following.

cpus {
	cpu: cpu@0 {
       	compatible = "renesas,sh2", "renesas,sh2";
       };
};
Quoted 59 lines

Missing reg property.
Missing "device_type: true".

Documentation/devicetree/bindings/sh/cpus.yaml line 31

Quoted 5 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +5 -0
+
+  clock-frequency:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      CPU core clock freqency.

Perhaps a "clocks" property instead, or as an alternative?

On sh7750, you do have

   clocks = <&cpg SH7750_CPG_ICK>;

Documentation/devicetree/bindings/sh/cpus.yaml line 40

Quoted 9 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +9 -0
+
+required:
+  - compatible
+
+additionalProperties: true
+
+examples:
+  - |
+        cpus {

make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/sh/cpus.yaml:

Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#address-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#
Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus:
'#size-cells' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 42

Quoted 2 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+                cpu: cpu@0 {
+                      compatible = "renesas,sh4", "renesas,sh";

Documentation/devicetree/bindings/sh/cpus.example.dts:19.28-21.19:
Warning (unit_address_vs_reg): /example-0/cpus/cpu@0: node has a unit name, but no reg or ranges property Documentation/devicetree/bindings/sh/cpus.example.dtb: cpus: cpu@0:
'cache-level' is a required property
from schema $id: http://devicetree.org/schemas/cpus.yaml#

Documentation/devicetree/bindings/sh/cpus.yaml line 45

Quoted 3 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +3 -0
+                };
+        };
+...

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                               -- Linus Torvalds
Signature · 1 line
Yosinori Sato
Signature · 1 line
Yosinori Sato
#67 lore raw

Re: [RFC PATCH v3 25/35] Documentation/devicetree/bindings/sh/cpus.yaml: Add SH CPU.

In reply to Yoshinori Sato

Hi Sato-san,

Quoted 33 lines · Yoshinori Sato
Quoted 18 lines · Geert Uytterhoeven

Documentation/devicetree/bindings/sh/cpus.yaml line 24

Quoted 11 lines · Yoshinori Sato

Renesas SuperH binding definition.

Documentation/devicetree/bindings/sh/cpus.yaml new file +4 -0
 
+properties:
+  compatible:
+    items:
+      - enum:

Missing

- jcore,j2

Quoted 8 lines

Documentation/devicetree/bindings/sh/cpus.yaml line 26

Quoted 4 lines
Documentation/devicetree/bindings/sh/cpus.yaml new file +2 -0
+          - renesas,sh4
 
 
+      - const: renesas,sh

I see arch/sh/boot/dts/j2_mimas_v2.dts lacks the fallback to "renesas,sh", though.
Is there a common base of instructions that are available on all SH cores?

The base instruction set is sh2.
Before that, there is sh1, but this is not compatible with Linux. I think it would be a good idea to change this to "renesas,sh2", but the SH7619 (SH2 CPU) would look like the following.

Quoted 5 lines
cpus {
        cpu: cpu@0 {
                compatible = "renesas,sh2", "renesas,sh2";
        };
};

SH7619 would just use a single compatible value:

compatible = "renesas,sh2".

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#68 lore raw

RFC PATCH v3 26/35 arch/sh/boot/dts: SH7751R SoC Internal peripheral definition dtsi.

In reply to Yoshinori Sato

Renesas SuperH SH7751R common definition.

---
 arch/sh/boot/dts/sh7751r.dtsi | 148 ++++++++++++++++++++++++++++++++++
 1 file changed, 148 insertions(+)
 create mode 100644 arch/sh/boot/dts/sh7751r.dtsi
arch/sh/boot/dts/sh7751r.dtsi new file +148 -0
new file mode 100644
index 000000000000..66f71372baad
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the SH7751R SoC
+ */
+
+#include <dt-bindings/interrupt-controller/sh_intc.h>
+#include <dt-bindings/clock/sh7750.h>
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+		      compatible = "renesas,sh4", "renesas,sh";
+		      device_type = "cpu";
+		      reg = <0>;
+		      clocks = <&cpg SH7750_CPG_ICK>;
+		      clock-names = "ick";
+		      icache-size = <16384>;
+		      icache-line-size = <32>;
+		      dcache-size = <32768>;
+		      dcache-line-size = <32>;
+		};
+	};
+
+	xtal: oscillator {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <0>;
+		clock-output-names = "xtal";
+	};
+
+	soc {
+		compatible = "simple-bus";
+		interrupt-parent = <&shintc>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		cpg: clock-controller@ffc00000 {
+			#clock-cells = <1>;
+			#power-domain-cells = <0>;
+			compatible = "renesas,sh7751r-cpg", "renesas,sh7750-cpg";
+			clocks = <&xtal>;
+			clock-names = "xtal";
+			reg = <0xffc00000 20>, <0xfe0a0000 16>;
+			reg-names = "FRQCR", "CLKSTP00";
+		};
+
+		shintc: interrupt-controller@ffd00000 {
+			compatible = "renesas,sh7751-intc";
+			#interrupt-cells = <2>;
+			interrupt-controller;
+			reg = <0xffd00000 20>, <0xfe080000 128>;
+			reg-names = "ICR", "INTPRI00";
+			renesas,ipr-map = IPRDEF(0x240, IPRD, IPR_B12),	/* IRL0 */
+					  IPRDEF(0x2a0, IPRD, IPR_B8),	/* IRL1 */
+					  IPRDEF(0x300, IPRD, IPR_B4),	/* IRL2 */
+					  IPRDEF(0x360, IPRD, IPR_B0),	/* IRL3 */
+					  IPRDEF(0x400, IPRA, IPR_B12),	/* TMU0 */
+					  IPRDEF(0x420, IPRA, IPR_B8),	/* TMU1 */
+					  IPRDEF(0x440, IPRA, IPR_B4),	/* TMU2 TNUI */
+					  IPRDEF(0x460, IPRA, IPR_B4),	/* TMU2 TICPI */
+					  IPRDEF(0x480, IPRA, IPR_B0),	/* RTC ATI */
+					  IPRDEF(0x4a0, IPRA, IPR_B0),	/* RTC PRI */
+					  IPRDEF(0x4c0, IPRA, IPR_B0),	/* RTC CUI */
+					  IPRDEF(0x4e0, IPRB, IPR_B4),	/* SCI ERI */
+					  IPRDEF(0x500, IPRB, IPR_B4),	/* SCI RXI */
+					  IPRDEF(0x520, IPRB, IPR_B4),	/* SCI TXI */
+					  IPRDEF(0x540, IPRB, IPR_B4),	/* SCI TEI */
+					  IPRDEF(0x560, IPRB, IPR_B12),	/* WDT */
+					  IPRDEF(0x580, IPRB, IPR_B8),	/* REF RCMI */
+					  IPRDEF(0x5a0, IPRB, IPR_B4),	/* REF ROVI */
+					  IPRDEF(0x600, IPRC, IPR_B0),	/* H-UDI */
+					  IPRDEF(0x620, IPRC, IPR_B12),	/* GPIO */
+					  IPRDEF(0x640, IPRC, IPR_B8),	/* DMAC DMTE0 */
+					  IPRDEF(0x660, IPRC, IPR_B8),	/* DMAC DMTE1 */
+					  IPRDEF(0x680, IPRC, IPR_B8),	/* DMAC DMTE2 */
+					  IPRDEF(0x6a0, IPRC, IPR_B8),	/* DMAC DMTE3 */
+					  IPRDEF(0x6c0, IPRC, IPR_B8),	/* DMAC DMAE */
+					  IPRDEF(0x700, IPRC, IPR_B4),	/* SCIF ERI */
+					  IPRDEF(0x720, IPRC, IPR_B4),	/* SCIF RXI */
+					  IPRDEF(0x740, IPRC, IPR_B4),	/* SCIF BRI */
+					  IPRDEF(0x760, IPRC, IPR_B4),	/* SCIF TXI */
+					  IPRDEF(0x780, IPRC, IPR_B8),	/* DMAC DMTE4 */
+					  IPRDEF(0x7a0, IPRC, IPR_B8),	/* DMAC DMTE5 */
+					  IPRDEF(0x7c0, IPRC, IPR_B8),	/* DMAC DMTE6 */
+					  IPRDEF(0x7e0, IPRC, IPR_B8),	/* DMAC DMTE7 */
+					  IPRDEF(0xa00, INTPRI00, IPR_B0),	/* PCIC PCISERR */
+					  IPRDEF(0xa20, INTPRI00, IPR_B4),	/* PCIC PCIDMA3 */
+					  IPRDEF(0xa40, INTPRI00, IPR_B4),	/* PCIC PCIDMA2 */
+					  IPRDEF(0xa60, INTPRI00, IPR_B4),	/* PCIC PCIDMA1 */
+					  IPRDEF(0xa80, INTPRI00, IPR_B4),	/* PCIC PCIDMA0 */
+					  IPRDEF(0xaa0, INTPRI00, IPR_B4),	/* PCIC PCIPWON */
+					  IPRDEF(0xac0, INTPRI00, IPR_B4),	/* PCIC PCIPWDWN */
+					  IPRDEF(0xae0, INTPRI00, IPR_B4),	/* PCIC PCIERR */
+					  IPRDEF(0xb00, INTPRI00, IPR_B8),	/* TMU3 */
+					  IPRDEF(0xb80, INTPRI00, IPR_B12);	/* TMU4 */
+		};
+
+		/* sci0 is rarely used, so it is not defined here. */
+		scif1: serial@ffe80000 {
+			compatible = "renesas,scif-sh7751", "renesas,scif";
+			reg = <0xffe80000 0x100>;
+			interrupts = <evt2irq(0x700) 0>,
+				     <evt2irq(0x720) 0>,
+				     <evt2irq(0x760) 0>,
+				     <evt2irq(0x740) 0>;
+			interrupt-names = "eri", "rxi", "txi", "bri";
+			clocks = <&cpg SH7750_CPG_SCIF_CLK>;
+			clock-names = "fck";
+			power-domains = <&cpg>;
+		};
+
+		/* Normally ch0 and ch1 are used, so we will define ch0 to ch2 here. */
+		tmu0: timer@ffd80000 {
+			compatible = "renesas,tmu-sh", "renesas,tmu";
+			reg = <0xffd80000 12>;
+			interrupts = <evt2irq(0x400) 0>,
+				     <evt2irq(0x420) 0>,
+				     <evt2irq(0x440) 0>,
+				     <evt2irq(0x460) 0>;
+			interrupt-names = "tuni0", "tuni1", "tuni2", "ticpi2";
+			clocks = <&cpg SH7750_CPG_TMU012_CLK>;
+			clock-names = "fck";
+			power-domains = <&cpg>;
+			#renesas,channels = <3>;
+		};
+
+		pcic: pci@fe200000 {
+			compatible = "renesas,pci-sh7751";
+			#address-cells = <3>;
+			#size-cells = <2>;
+			#interrupt-cells = <1>;
+			device_type = "pci";
+			bus-range = <0 0>;
+			ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>,
+				 <0x01000000 0 0x00000000 0xfe240000 0 0x00040000>;
+			reg = <0xfe200000 0x0400>,
+			      <0x0c000000 0x04000000>,
+			      <0xff800000 0x0030>;
+		};
+	};
+};
Signature · 1 line
2.39.2
#69 lore raw

Re: [RFC PATCH v3 26/35] arch/sh/boot/dts: SH7751R SoC Internal peripheral definition dtsi.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH SH7751R common definition.

Thanks for your patch!

Quoted 19 lines
arch/sh/boot/dts/sh7751r.dtsi new file +16 -0
@@ -0,0 +1,148 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the SH7751R SoC
+ */
+
+#include <dt-bindings/interrupt-controller/sh_intc.h>
+#include <dt-bindings/clock/sh7750.h>
+
+/ {
+       #address-cells = <1>;
+       #size-cells = <1>;
+
+       cpus {
+               #address-cells = <1>;
+               #size-cells = <0>;
+

arch/sh/boot/dts/sh7751r.dtsi line 26

Quoted 10 lines
arch/sh/boot/dts/sh7751r.dtsi new file +10 -0
+               cpu@0 {
+                     compatible = "renesas,sh4", "renesas,sh";
+                     device_type = "cpu";
+                     reg = <0>;
+                     clocks = <&cpg SH7750_CPG_ICK>;
+                     clock-names = "ick";
+                     icache-size = <16384>;
+                     icache-line-size = <32>;
+                     dcache-size = <32768>;
+                     dcache-line-size = <32>;

Wrong indentation (2 TABs and 6 spaces instead of 3 TABs).

Quoted 13 lines
arch/sh/boot/dts/sh7751r.dtsi new file +12 -0
+               };
+       };
+
+       xtal: oscillator {
+               #clock-cells = <0>;
+               compatible = "fixed-clock";
+               clock-frequency = <0>;
+               clock-output-names = "xtal";
+       };
+
+       soc {
 
+               scif1: serial@ffe80000 {

arch/sh/boot/dts/sh7751r.dtsi

Quoted 10 lines
arch/sh/boot/dts/sh7751r.dtsi new file +10 -0
+                       compatible = "renesas,scif-sh7751", "renesas,scif";
+                       reg = <0xffe80000 0x100>;
+                       interrupts = <evt2irq(0x700) 0>,
+                                    <evt2irq(0x720) 0>,
+                                    <evt2irq(0x760) 0>,
+                                    <evt2irq(0x740) 0>;
+                       interrupt-names = "eri", "rxi", "txi", "bri";
+                       clocks = <&cpg SH7750_CPG_SCIF_CLK>;
+                       clock-names = "fck";
+                       power-domains = <&cpg>;

status = "disabled";

and add

    &scif1 {
            status = "okay";
    };

to each board .dts file that uses scif1.

Quoted 4 lines
arch/sh/boot/dts/sh7751r.dtsi new file +3 -0
+               };
 
+               pcic: pci@fe200000 {
+                       compatible = "renesas,pci-sh7751";

arch/sh/boot/dts/sh7751r.dtsi line 145

Quoted 10 lines
arch/sh/boot/dts/sh7751r.dtsi new file +10 -0
+                       #address-cells = <3>;
+                       #size-cells = <2>;
+                       #interrupt-cells = <1>;
+                       device_type = "pci";
+                       bus-range = <0 0>;
+                       ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>,
+                                <0x01000000 0 0x00000000 0xfe240000 0 0x00040000>;
+                       reg = <0xfe200000 0x0400>,
+                             <0x0c000000 0x04000000>,
+                             <0xff800000 0x0030>;

status = "disabled";

and add

    &pcic {
            status = "okay";
    };

to each board .dts file that uses pcic.

arch/sh/boot/dts/sh7751r.dtsi line 35

Quoted 3 lines
arch/sh/boot/dts/sh7751r.dtsi new file +3 -0
+               };
+       };
+};

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#70 lore raw

RFC PATCH v3 27/35 Documentation/devicetree/bindings: vendor-prefix add IO DATA DEVICE Inc.

In reply to Yoshinori Sato
---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 573578db9509..2179a9d61e6a 100644
@@ -657,6 +657,8 @@ patternProperties:
     description: Inventec
   "^inversepath,.*":
     description: Inverse Path
+  "^iodata,.*":
+    description: IO DATA DEVICE Inc.
   "^iom,.*":
     description: Iomega Corporation
   "^irondevice,.*":
Signature · 1 line
2.39.2
Reviewed-by on v3 27/35
#71 lore raw

Re: [RFC PATCH v3 27/35] Documentation/devicetree/bindings: vendor-prefix add IO DATA DEVICE Inc.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

Please use a one-line prefix that matches the history of the file:

dt-bindings: vendor-prefixes: Add IO DATA DEVICE Inc.

Documentation/devicetree/bindings/vendor-prefixes.yaml patternProperties: · line 664

Quoted 11 lines
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
@@ -657,6 +657,8 @@ patternProperties:
     description: Inventec
   "^inversepath,.*":
     description: Inverse Path
+  "^iodata,.*":
+    description: IO DATA DEVICE Inc.
   "^iom,.*":
     description: Iomega Corporation
   "^irondevice,.*":

For the actual change:

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#72 lore raw

RFC PATCH v3 28/35 Documentation/devicetree/bindings/ata: ata-generic.yaml add usl-5p and rts7751r2d.

In reply to Yoshinori Sato

usl-5p and rts7751r2d using ata-generic driver.

---
 Documentation/devicetree/bindings/ata/ata-generic.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ata/ata-generic.yaml +2 -0
index 0697927f3d7e..1025b3b351d0 100644
@@ -18,6 +18,8 @@ properties:
       - enum:
           - arm,vexpress-cf
           - fsl,mpc8349emitx-pata
+          - iodata,usl-5p-ata
+          - renesas,rts7751r2d-ata
       - const: ata-generic
 
   reg:
Signature · 1 line
2.39.2
maintainer
#73 lore raw

Re: [RFC PATCH v3 28/35] Documentation/devicetree/bindings/ata: ata-generic.yaml add usl-5p and rts7751r2d.

The patch title should be something like:

dt-bindings: ata: ata-generic: add usl-5p and rts7751r2d

without a period at the end.

Quoted 1 line · Yoshinori Sato

usl-5p and rts7751r2d using ata-generic driver.

Please use a full sentence. There is no verb here.

Quoted 19 lines
---
 Documentation/devicetree/bindings/ata/ata-generic.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/ata/ata-generic.yaml +2 -0
index 0697927f3d7e..1025b3b351d0 100644
@@ -18,6 +18,8 @@ properties:
       - enum:
           - arm,vexpress-cf
           - fsl,mpc8349emitx-pata
+          - iodata,usl-5p-ata
+          - renesas,rts7751r2d-ata
       - const: ata-generic
 
   reg:
Signature · 2 lines
Damien Le Moal
Western Digital Research
author maintainer
#74 lore raw

RFC PATCH v3 29/35 Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

In reply to Yoshinori Sato

Renesas SuperH based target definition.

---
 .../devicetree/bindings/soc/renesas/sh.yaml   | 32 +++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/soc/renesas/sh.yaml
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +32 -0
new file mode 100644
index 000000000000..3fbff2532ad3
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/renesas/sh.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH Platform
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: RTS7751R2D Plus
+        items:
+          - enum:
+              - renesas,rts7751r2d # Renesas SH4 2D graphics board
+          - const: renesas,sh7751r
+
+      - description: Julian board
+        items:
+          - enum:
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P
+          - const: renesas,sh7751r
+
+additionalProperties: true
+
+...
Signature · 1 line
2.39.2
#75 lore raw

Re: [RFC PATCH v3 29/35] Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas SuperH based target definition.

Thanks for your patch!

Please use a one-line prefix that matches the history of the other files next to it:

dt-bindings: soc: renesas: Document SH7751 based targets

Quoted 20 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +17 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/renesas/sh.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH Platform
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: RTS7751R2D Plus

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 27

Quoted 10 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +10 -0
+        items:
+          - enum:
+              - renesas,rts7751r2d # Renesas SH4 2D graphics board
+          - const: renesas,sh7751r
+
+      - description: Julian board
+        items:
+          - enum:
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P

These depend on "[RFC PATCH v3 27/35] Documentation/devicetree/bindings:
vendor-prefix add IO DATA DEVICE Inc.", so that patch should be moved forward in the series.

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 28

Quoted 1 line
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +1 -0
+          - const: renesas,sh7751r

Please merge both sections, as they use the same number of compatible values and the same fallback.

Quoted 7 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +4 -1
+
+additionalProperties: true
+
+...
--

2.39.2

--
Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#76 lore raw

Re: [RFC PATCH v3 29/35] Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

Hi Sato-san,

Quoted 7 lines · Geert Uytterhoeven

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 27

Quoted 2 lines · Yoshinori Sato
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +2 -0
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P

These depend on "[RFC PATCH v3 27/35] Documentation/devicetree/bindings:
vendor-prefix add IO DATA DEVICE Inc.", so that patch should be moved

My apologies. Somehow the patches didn't end up in the right order in my mailbox, so please ignore this comment.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#77 lore raw

Re: [RFC PATCH v3 29/35] Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

In reply to Geert Uytterhoeven

Hi Sato-san,

Quoted 32 lines · Geert Uytterhoeven
Quoted 30 lines · Yoshinori Sato

Renesas SuperH based target definition.

Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +23 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/renesas/sh.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH Platform
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: RTS7751R2D Plus
+        items:
+          - enum:
+              - renesas,rts7751r2d # Renesas SH4 2D graphics board
+          - const: renesas,sh7751r
+
+      - description: Julian board
Quoted 8 lines

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 28

Quoted 5 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +5 -0
+        items:
+          - enum:
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P
+          - const: renesas,sh7751r

Please merge both sections, as they use the same number of compatible values and the same fallback.

Unless we want to add an "renesas,sh7380" intermediate, as that is the actual SoC in the landisk? I do not know what is the difference between SH7380 and SH7751R.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#78 lore raw

Re: [RFC PATCH v3 29/35] Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

Quoted 45 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 32 lines · Geert Uytterhoeven
Quoted 30 lines · Yoshinori Sato

Renesas SuperH based target definition.

Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +23 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/renesas/sh.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH Platform
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: RTS7751R2D Plus
+        items:
+          - enum:
+              - renesas,rts7751r2d # Renesas SH4 2D graphics board
+          - const: renesas,sh7751r
+
+      - description: Julian board
Quoted 8 lines

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 28

Quoted 5 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +5 -0
+        items:
+          - enum:
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P
+          - const: renesas,sh7751r

Please merge both sections, as they use the same number of compatible values and the same fallback.

Quoted 3 lines

Unless we want to add an "renesas,sh7380" intermediate, as that is the actual SoC in the landisk? I do not know what is the difference between SH7380 and SH7751R.

Everything here is SH7751R.
I didn't include J2, so I'll add it.
Other SoCs will be added after changing to DeviceTree.

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Signature · 1 line
Yosinori Sato
author maintainer
#79 lore raw

Re: [RFC PATCH v3 29/35] Documentation/devicetree/bindings/soc/renesas/sh.yaml: Add SH7751 based target.

In reply to Geert Uytterhoeven
Quoted 45 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 32 lines · Geert Uytterhoeven
Quoted 30 lines · Yoshinori Sato

Renesas SuperH based target definition.

Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +23 -0
@@ -0,0 +1,32 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/soc/renesas/sh.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Renesas SuperH Platform
+
+maintainers:
+  - Yoshinori Sato <[email protected]>
+
+properties:
+  $nodename:
+    const: '/'
+  compatible:
+    oneOf:
+      - description: RTS7751R2D Plus
+        items:
+          - enum:
+              - renesas,rts7751r2d # Renesas SH4 2D graphics board
+          - const: renesas,sh7751r
+
+      - description: Julian board
Quoted 8 lines

Documentation/devicetree/bindings/soc/renesas/sh.yaml line 28

Quoted 5 lines
Documentation/devicetree/bindings/soc/renesas/sh.yaml new file +5 -0
+        items:
+          - enum:
+              - iodata,landisk  # LANDISK HDL-U
+              - iodata,usl-5p   # USL-5P
+          - const: renesas,sh7751r

Please merge both sections, as they use the same number of compatible values and the same fallback.

Quoted 3 lines

Unless we want to add an "renesas,sh7380" intermediate, as that is the actual SoC in the landisk? I do not know what is the difference between SH7380 and SH7751R.

Details of the SH7380 have not been released,
but the hardware appears to be the same as the SH7751R. I checked the original firmware source, and it was treated as the same as the SH7751R.

Quoted 10 lines

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Signature · 1 line
Yosinori Sato
author maintainer
#80 lore raw

RFC PATCH v3 30/35 arch/sh/boot/dts: RTS7751R2D Plus DeviceTree.

In reply to Yoshinori Sato

Renesas RTS7751R2D Plus devicetree.

---
 arch/sh/boot/dts/rts7751r2dplus.dts | 157 ++++++++++++++++++++++++++++
 1 file changed, 157 insertions(+)
 create mode 100644 arch/sh/boot/dts/rts7751r2dplus.dts
arch/sh/boot/dts/rts7751r2dplus.dts new file +157 -0
new file mode 100644
index 000000000000..7fc9692da257
@@ -0,0 +1,157 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the Renesas RTS7751R2D Plus
+ */
+
+/dts-v1/;
+
+#include "sh7751r.dtsi"
+
+/ {
+	model = "Renesas RTS7715R2D Plus";
+	compatible = "renesas,rts7751r2d", "renesas,sh7751r";
+
+	aliases {
+		serial0 = &scif1;
+	};
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	memory@c000000 {
+		device_type = "memory";
+		reg = <0x0c000000 0x4000000>;
+	};
+
+	oscillator {
+		clock-frequency = <22222222>;
+	};
+
+	r2dintc: sh7751irl_encoder@a4000000 {
+		compatible = "renesas,sh7751-irl-ext";
+		reg = <0xa4000000 0x02>;
+		interrupt-controller;
+		#address-cells = <0>;
+		#size-cells = <0>;
+		#interrupt-cells = <1>;
+		renesas,width = <16>;
+		renesas,regtype = "enable";
+		renesas,irqbit =  <11>,		/* PCI INTD */
+				  <9>,		/* CF IDE */
+				  <8>,		/* CF CD */
+				  <12>,		/* PCI INTC */
+				  <10>,		/* SM501 */
+				  <6>,		/* KEY */
+				  <5>,		/* RTC ALARM */
+				  <4>,		/* RTC T */
+				  <7>,		/* SDCARD */
+				  <14>,		/* PCI INTA */
+				  <13>,		/* PCI INTB */
+				  <0>,		/* EXT */
+				  <15>;		/* TP */
+	};
+
+	display@1,0 {
+		compatible = "smi,sm501";
+		reg = <0x10000000 0x03e00000
+		       0x13e00000 0x00200000>;
+		interrupt-parent = <&r2dintc>;
+		interrupts = <4>;
+		mode = "640x480-16@60";
+		little-endian;
+		smi,devices = "usb-host","uart0";
+		interrupt-name = "sm501";
+		route = "own";
+		swap-fb-endian;
+
+		crt {
+			flags = "use_init_mode",
+				"use_hwcursor",
+				"use_hwaccel",
+				"disable_at_exit";
+		};
+
+		panel {
+			bpp = <16>;
+			edid = [00 ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00
+				00 00 01 04 00 00 00 00 00 00 00 00 00 00 00 00
+				00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+				00 00 00 00 00 00 f0 0a 80 fb 20 e0 25 10 32 60
+				02 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00
+				00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+				00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+				00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 bd];
+			flags = "use_init_mode",
+				"use_hwcursor",
+				"use_hwaccel",
+				"disable_at_exit";
+		};
+	};
+
+	compact-flash@b4001000 {
+		compatible = "renesas,rts7751r2d-ata", "ata-generic";
+		reg = <0xb4001000 0x0e>, <0xb400080c 2>;
+		reg-shift = <1>;
+		interrupt-parent = <&r2dintc>;
+		interrupts = <1>;
+	};
+
+	flash@0 {
+		compatible = "cfi-flash";
+		reg = <0x00000000 0x02000000>;
+		device-width = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "U-Boot";
+			reg = <0x00000000 0x00040000>;
+		};
+
+		partition@1 {
+			label = "Environemt";
+			reg = <0x00040000 0x00040000>;
+		};
+
+		partition@2 {
+			label = "Kernel";
+			reg = <0x00080000 0x001c0000>;
+		};
+
+		partition@3 {
+			label = "Flash_FS";
+			reg = <0x00240000 0x00dc0000>;
+		};
+	};
+
+	soc {
+		clock-controller@ffc00000 {
+			renesas,mode = <5>;
+		};
+
+		pci@fe200000 {
+			compatible = "renesas,pci-sh7751";
+			interrupt-parent = <&r2dintc>;
+			renesas,bcr1 = <0x40080000>;
+			renesas,intm = <0x0000c3ff>;
+			renesas,aintm = <0x0000380f>;
+			renesas,config = <1 0xfb900047>, <4 0xab000001>;
+			renesas,mcrmask = <0x40000004>;
+
+			interrupt-map = <0x0000 0 0 1 &r2dintc 9>,
+					<0x0000 0 0 2 &r2dintc 10>,
+					<0x0000 0 0 3 &r2dintc 3>,
+					<0x0000 0 0 4 &r2dintc 0>,
+					<0x0800 0 0 1 &r2dintc 10>,
+					<0x0800 0 0 2 &r2dintc 3>,
+					<0x0800 0 0 3 &r2dintc 0>,
+					<0x0800 0 0 4 &r2dintc 9>,
+					<0x1000 0 0 1 &r2dintc 3>,
+					<0x1000 0 0 2 &r2dintc 0>,
+					<0x1000 0 0 3 &r2dintc 9>,
+					<0x1000 0 0 4 &r2dintc 10>;
+			interrupt-map-mask = <0x1800 0 0 7>;
+		};
+	};
+};
Signature · 1 line
2.39.2
#81 lore raw

Re: [RFC PATCH v3 30/35] arch/sh/boot/dts: RTS7751R2D Plus DeviceTree.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

Renesas RTS7751R2D Plus devicetree.

Thanks for your patch!

arch/sh/boot/dts/rts7751r2dplus.dts line 29

Quoted 6 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +3 -0
 
+       oscillator {
+               clock-frequency = <22222222>;
+       };

When adding or overriding properties to/in existing device nodes, please refer to the nodes using symbolic labels. I.e. please add

    &xtal {
                clock-frequency = <22222222>;
     };

at the bottom of this file instead.

Quoted 8 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8 -0
+       display@1,0 {
+               compatible = "smi,sm501";
+               reg = <0x10000000 0x03e00000
+                      0x13e00000 0x00200000>;
+               interrupt-parent = <&r2dintc>;
+               interrupts = <4>;
+               mode = "640x480-16@60";
+               little-endian;

arch/sh/boot/dts/rts7751r2dplus.dts line 72

Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10 -0
+               smi,devices = "usb-host","uart0";
+               interrupt-name = "sm501";
+               route = "own";
+               swap-fb-endian;
+
+               crt {
+                       flags = "use_init_mode",
+                               "use_hwcursor",
+                               "use_hwaccel",
+                               "disable_at_exit";

"make dtbs_check" does not like flags being non-integer. Might be an artefact of having only plain text bindings in Documentation/devicetree/bindings/display/sm501fb.txt

Quoted 6 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +6 -0
+               };
+
+               panel {
+                       bpp = <16>;
+                       edid = [00 ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00
+                               00 00 01 04 00 00 00 00 00 00 00 00 00 00 00 00

arch/sh/boot/dts/rts7751r2dplus.dts line 88

Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10 -0
+                               00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+                               00 00 00 00 00 00 f0 0a 80 fb 20 e0 25 10 32 60
+                               02 00 00 00 00 00 00 06 00 00 00 00 00 00 00 00
+                               00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+                               00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+                               00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 bd];
+                       flags = "use_init_mode",
+                               "use_hwcursor",
+                               "use_hwaccel",
+                               "disable_at_exit";

Likewise.

Quoted 15 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +15 -0
+               };
+       };
+
+       compact-flash@b4001000 {
+               compatible = "renesas,rts7751r2d-ata", "ata-generic";
+               reg = <0xb4001000 0x0e>, <0xb400080c 2>;
+               reg-shift = <1>;
+               interrupt-parent = <&r2dintc>;
+               interrupts = <1>;
+       };
+
+       flash@0 {
+               compatible = "cfi-flash";
+               reg = <0x00000000 0x02000000>;
+               device-width = <2>;

arch/sh/boot/dts/rts7751r2dplus.dts line 113

Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10 -0
+               #address-cells = <1>;
+               #size-cells = <1>;
+
+               partition@0 {
+                       label = "U-Boot";
+                       reg = <0x00000000 0x00040000>;
+               };
+
+               partition@1 {
+                       label = "Environemt";

Environment

Quoted 8 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8 -0
+                       reg = <0x00040000 0x00040000>;
+               };
+
+               partition@2 {
+                       label = "Kernel";
+                       reg = <0x00080000 0x001c0000>;
+               };
+

arch/sh/boot/dts/rts7751r2dplus.dts line 131

Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10 -0
+               partition@3 {
+                       label = "Flash_FS";
+                       reg = <0x00240000 0x00dc0000>;
+               };
+       };
+
+       soc {
+               clock-controller@ffc00000 {
+                       renesas,mode = <5>;
+               };
    &cpg {
                renesas,mode = <5>;
    };

At the bottom of this file.

arch/sh/boot/dts/rts7751r2dplus.dts

Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2 -0
+
+               pci@fe200000 {

Likewise, "&pcic { ... };" at the bottom of this file.

Quoted 1 line

+ compatible = "renesas,pci-sh7751";

No need to override the compatible property, it is already set in sh7751.dtsi.

Quoted 13 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +13 -0
+                       interrupt-parent = <&r2dintc>;
+                       renesas,bcr1 = <0x40080000>;
+                       renesas,intm = <0x0000c3ff>;
+                       renesas,aintm = <0x0000380f>;
+                       renesas,config = <1 0xfb900047>, <4 0xab000001>;
+                       renesas,mcrmask = <0x40000004>;
+
+                       interrupt-map = <0x0000 0 0 1 &r2dintc 9>,
+                                       <0x0000 0 0 2 &r2dintc 10>,
+                                       <0x0000 0 0 3 &r2dintc 3>,
+                                       <0x0000 0 0 4 &r2dintc 0>,
+                                       <0x0800 0 0 1 &r2dintc 10>,
+                                       <0x0800 0 0 2 &r2dintc 3>,

arch/sh/boot/dts/rts7751r2dplus.dts line 157

Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10 -0
+                                       <0x0800 0 0 3 &r2dintc 0>,
+                                       <0x0800 0 0 4 &r2dintc 9>,
+                                       <0x1000 0 0 1 &r2dintc 3>,
+                                       <0x1000 0 0 2 &r2dintc 0>,
+                                       <0x1000 0 0 3 &r2dintc 9>,
+                                       <0x1000 0 0 4 &r2dintc 10>;
+                       interrupt-map-mask = <0x1800 0 0 7>;
+               };
+       };
+};

Some of my comments apply to landisk.dts and usl-5p.dts, too. And please run "make dtbs_check" ;-)

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#82 lore raw

RFC PATCH v3 31/35 arch/sh/boot/dts: LANDISK DeviceTree.

In reply to Yoshinori Sato

IO DATA Device LANDISK devicetree.

---
 arch/sh/boot/dts/landisk.dts | 79 ++++++++++++++++++++++++++++++++++++
 1 file changed, 79 insertions(+)
 create mode 100644 arch/sh/boot/dts/landisk.dts
arch/sh/boot/dts/landisk.dts new file +79 -0
new file mode 100644
index 000000000000..bcbaf5e4af13
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the IO DATA DEVICE LANDISK
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/clock/sh7750.h>
+#include "sh7751r.dtsi"
+
+/ {
+	model = "IO DATA Device LANDISK";
+	compatible = "iodata,landisk", "renesas,sh7751r";
+
+	aliases {
+		serial0 = &scif1;
+	};
+
+	chosen {
+		stdout-path = "serial0:9600n8";
+	};
+
+	memory@c000000 {
+		device_type = "memory";
+		reg = <0x0c000000 0x4000000>;
+	};
+
+	julianintc: sh7751irl_encoder@b0000005 {
+		compatible = "renesas,sh7751-irl-ext";
+		reg = <0xb0000005 0x01>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		renesas,width = <8>;
+		renesas,regtype = "enable";
+		renesas,irqbit = <0xffffffff>,	/* Not use */
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0>,		/* PCI INTA */
+				 <1>,		/* PCI INTB */
+				 <2>,		/* PCI INTC */
+				 <3>,		/* PCI INTD */
+				 <4>,		/* ATA */
+				 <5>,		/* CF */
+				 <6>,		/* Power Switch */
+				 <7>;		/* Button */
+	};
+
+	oscillator {
+		clock-frequency = <22222222>;
+	};
+
+	soc {
+		clock-controller@ffc00000 {
+			renesas,mode = <5>;
+		};
+
+		pci@fe200000 {
+			compatible = "renesas,pci-sh7751";
+			renesas,bcr1 = <0x00080000>;
+			renesas,config = <6 0xd0000000>;
+			renesas,mcrmask = <0x40000004>;
+			interrupt-map = <0x0000 0 0 1 &julianintc 5>,
+					<0x0000 0 0 2 &julianintc 6>,
+					<0x0000 0 0 3 &julianintc 7>,
+					<0x0000 0 0 4 &julianintc 8>,
+					<0x0800 0 0 1 &julianintc 6>,
+					<0x0800 0 0 2 &julianintc 7>,
+					<0x0800 0 0 3 &julianintc 8>,
+					<0x0800 0 0 4 &julianintc 5>,
+					<0x1000 0 0 1 &julianintc 7>,
+					<0x1000 0 0 2 &julianintc 8>,
+					<0x1000 0 0 3 &julianintc 5>,
+					<0x1000 0 0 4 &julianintc 6>;
+			interrupt-map-mask = <0x1800 0 0 7>;
+		};
+	};
+};
Signature · 1 line
2.39.2
#83 lore raw

Re: [RFC PATCH v3 31/35] arch/sh/boot/dts: LANDISK DeviceTree.

Hi Sato-san,

Quoted 3 lines · Yoshinori Sato

IO DATA Device LANDISK devicetree.

Thanks for your patch!

arch/sh/boot/dts/landisk.dts line 8

Quoted 11 lines
arch/sh/boot/dts/landisk.dts new file +8 -0
@@ -0,0 +1,79 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the IO DATA DEVICE LANDISK
+ */
+
+/dts-v1/;
+
+#include <dt-bindings/clock/sh7750.h>

This include can be dropped, as it is already included by sh7751r.dtsi.

arch/sh/boot/dts/landisk.dts line 9

Quoted 1 line
arch/sh/boot/dts/landisk.dts new file +1 -0
+#include "sh7751r.dtsi"

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author maintainer
#84 lore raw

RFC PATCH v3 32/35 arch/sh/boot/dts: USL-5P DeviceTree.

In reply to Yoshinori Sato

IO DATA Device USL-5P devicetree.

---
 arch/sh/boot/dts/usl-5p.dts | 88 +++++++++++++++++++++++++++++++++++++
 1 file changed, 88 insertions(+)
 create mode 100644 arch/sh/boot/dts/usl-5p.dts
arch/sh/boot/dts/usl-5p.dts new file +88 -0
new file mode 100644
index 000000000000..ce5320348140
@@ -0,0 +1,88 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the IO DATA DEVICE USL-5P
+ */
+
+/dts-v1/;
+
+#include "sh7751r.dtsi"
+
+/ {
+	model = "IO-DATA Device USL-5P";
+	compatible = "iodata,usl-5p", "renesas,sh7751r";
+
+	aliases {
+		serial0 = &scif1;
+	};
+
+	chosen {
+		stdout-path = "serial0:9600n8";
+	};
+
+	memory@c000000 {
+		device_type = "memory";
+		reg = <0x0c000000 0x4000000>;
+	};
+
+	julianintc: sh7751irl_encoder@b0000005 {
+		compatible = "renesas,sh7751-irl-ext";
+		reg = <0xb0000005 0x01>;
+		interrupt-controller;
+		#interrupt-cells = <1>;
+		#address-cells = <0>;
+		#size-cells = <0>;
+		renesas,width = <8>;
+		renesas,regtype = "enable";
+		renesas,irqbit = <0xffffffff>,	/* Not use */
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0xffffffff>,
+				 <0>,		/* PCI INTA */
+				 <1>,		/* PCI INTB */
+				 <2>,		/* PCI INTC */
+				 <3>,		/* PCI INTD */
+				 <4>,		/* ATA */
+				 <5>,		/* CF */
+				 <6>,		/* Power Switch */
+				 <7>;		/* Button */
+	};
+
+	oscillator {
+		clock-frequency = <22222222>;
+	};
+
+	compact-flash@b4001000 {
+		compatible = "iodata,usl-5p-ata", "ata-generic";
+		reg = <0xb4000040 0x0e>, <0xb400002c 2>;
+		reg-shift = <1>;
+		interrupt-parent = <&julianintc>;
+		interrupts = <10>;
+	};
+
+	soc {
+		clock-controller@ffc00000 {
+			renesas,mode = <5>;
+		};
+
+		pci@fe200000 {
+			compatible = "renesas,pci-sh7751";
+			renesas,bcr1 = <0x00080000>;
+			renesas,config = <6 0xd0000000>;
+			renesas,mcrmask = <0x40000004>;
+			interrupt-map = <0x0000 0 0 1 &julianintc 5>,
+					<0x0000 0 0 2 &julianintc 6>,
+					<0x0000 0 0 3 &julianintc 7>,
+					<0x0000 0 0 4 &julianintc 8>,
+					<0x0800 0 0 1 &julianintc 6>,
+					<0x0800 0 0 2 &julianintc 7>,
+					<0x0800 0 0 3 &julianintc 8>,
+					<0x0800 0 0 4 &julianintc 5>,
+					<0x1000 0 0 1 &julianintc 7>,
+					<0x1000 0 0 2 &julianintc 8>,
+					<0x1000 0 0 3 &julianintc 5>,
+					<0x1000 0 0 4 &julianintc 6>;
+			interrupt-map-mask = <0x1800 0 0 7>;
+		};
+	};
+};
Signature · 1 line
2.39.2
author maintainer
#85 lore raw

RFC PATCH v3 33/35 arch/sh: Add dtbs target support.

In reply to Yoshinori Sato
---
 arch/sh/boot/dts/Makefile | 5 +++++
 1 file changed, 5 insertions(+)
arch/sh/boot/dts/Makefile +5 -0
index 4a6dec9714a9..e6b93360c213 100644
@@ -1,2 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USE_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
+
+dtb-$(CONFIG_CPU_J2) += j2_mimas_v2.dtb
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += landisk.dtb
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += rts7751r2dplus.dtb
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += usl-5p.dtb
Signature · 1 line
2.39.2
#86 lore raw

Re: [RFC PATCH v3 33/35] arch/sh: Add dtbs target support.

Hi Sato-san,

Quoted 1 line · Yoshinori Sato

Thanks for your patch!

arch/sh/boot/dts/Makefile line 4

Quoted 7 lines
arch/sh/boot/dts/Makefile +2 -0
@@ -1,2 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_USE_BUILTIN_DTB) += $(addsuffix .dtb.o, $(CONFIG_BUILTIN_DTB_SOURCE))
+
+dtb-$(CONFIG_CPU_J2) += j2_mimas_v2.dtb

Please keep this a separate patch, and move it forward in the series (or submit it independently).

arch/sh/boot/dts/Makefile line 5

Quoted 1 line
arch/sh/boot/dts/Makefile +1 -0
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += landisk.dtb

This change should be moved into "[RFC PATCH v3 31/35] arch/sh/boot/dts:
LANDISK DeviceTree.".

arch/sh/boot/dts/Makefile line 6

Quoted 1 line
arch/sh/boot/dts/Makefile +1 -0
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += rts7751r2dplus.dtb

This change should be moved into "[RFC PATCH v3 30/35] arch/sh/boot/dts:
RTS7751R2D Plus DeviceTree.".

arch/sh/boot/dts/Makefile line 7

Quoted 1 line
arch/sh/boot/dts/Makefile +1 -0
+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += usl-5p.dtb

This change should be moved into "[RFC PATCH v3 32/35] arch/sh/boot/dts:
USL-5P DeviceTree.".

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
author maintainer
#87 lore raw

RFC PATCH v3 34/35 arch/sh: RTS7751R2D Plus OF defconfig

In reply to Yoshinori Sato
---
 arch/sh/configs/rts7751r2dplus-of_defconfig | 92 +++++++++++++++++++++
 1 file changed, 92 insertions(+)
 create mode 100644 arch/sh/configs/rts7751r2dplus-of_defconfig
arch/sh/configs/rts7751r2dplus-of_defconfig new file +92 -0
new file mode 100644
index 000000000000..d62eed4cccee
@@ -0,0 +1,92 @@
+CONFIG_SYSVIPC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_NAMESPACES=y
+CONFIG_EXPERT=y
+CONFIG_PROFILING=y
+CONFIG_CPU_SUBTYPE_SH7751R=y
+CONFIG_MEMORY_START=0x0c000000
+CONFIG_SH_OF_BOARD=y
+CONFIG_HEARTBEAT=y
+CONFIG_MODULES=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+# CONFIG_IPV6 is not set
+CONFIG_PCI=y
+CONFIG_HOTPLUG_PCI=y
+CONFIG_PCI_SH7751=y
+CONFIG_UEVENT_HELPER=y
+CONFIG_MTD=y
+CONFIG_MTD_CMDLINE_PARTS=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_SD=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_ATA=y
+CONFIG_PATA_OF_PLATFORM=y
+CONFIG_NETDEVICES=y
+CONFIG_8139CP=y
+CONFIG_8139TOO=y
+# CONFIG_8139TOO_PIO is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_EARLYCON=y
+CONFIG_HW_RANDOM=y
+CONFIG_SPI=y
+CONFIG_SPI_SH_SCI=y
+CONFIG_MFD_SM501=y
+CONFIG_FB=y
+CONFIG_FB_SH_MOBILE_LCDC=m
+CONFIG_FB_SM501=y
+CONFIG_FB_MODE_HELPERS=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+# CONFIG_LOGO_LINUX_CLUT224 is not set
+# CONFIG_LOGO_SUPERH_MONO is not set
+# CONFIG_LOGO_SUPERH_VGA16 is not set
+CONFIG_SOUND=y
+CONFIG_SND=m
+CONFIG_SND_YMFPCI=m
+CONFIG_HID_A4TECH=y
+CONFIG_HID_BELKIN=y
+CONFIG_HID_CHERRY=y
+CONFIG_HID_CHICONY=y
+CONFIG_HID_CYPRESS=y
+CONFIG_HID_EZKEY=y
+CONFIG_HID_GYRATION=y
+CONFIG_HID_ITE=y
+CONFIG_HID_KENSINGTON=y
+CONFIG_HID_REDRAGON=y
+CONFIG_HID_MICROSOFT=y
+CONFIG_HID_MONTEREY=y
+CONFIG_HID_PANTHERLORD=y
+CONFIG_HID_PETALYNX=y
+CONFIG_HID_SAMSUNG=y
+CONFIG_HID_SUNPLUS=y
+CONFIG_USB=y
+CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_STORAGE=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_R9701=y
+CONFIG_RENESAS_SH7751_INTC=y
+CONFIG_RENESAS_SH7751IRL_INTC=y
+CONFIG_EXT2_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_MINIX_FS=y
+CONFIG_NLS_CODEPAGE_932=y
+CONFIG_CRC_T10DIF=y
+CONFIG_DEBUG_FS=y
+# CONFIG_FTRACE is not set
Signature · 1 line
2.39.2
author maintainer
#88 lore raw

RFC PATCH v3 35/35 arch/sh/configs: LANDISK OF defconfig

In reply to Yoshinori Sato
---
 arch/sh/configs/landisk-of_defconfig | 111 +++++++++++++++++++++++++++
 1 file changed, 111 insertions(+)
 create mode 100644 arch/sh/configs/landisk-of_defconfig
arch/sh/configs/landisk-of_defconfig new file +111 -0
new file mode 100644
index 000000000000..406de7d7b8a2
@@ -0,0 +1,111 @@
+CONFIG_SYSVIPC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_NAMESPACES=y
+CONFIG_EXPERT=y
+CONFIG_KEXEC=y
+CONFIG_CPU_SUBTYPE_SH7751R=y
+CONFIG_MEMORY_START=0x0c000000
+CONFIG_SH_OF_BOARD=y
+CONFIG_HEARTBEAT=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+CONFIG_MODULE_FORCE_UNLOAD=y
+CONFIG_FLATMEM_MANUAL=y
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_INET=y
+CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_IP_PNP=y
+# CONFIG_IPV6 is not set
+CONFIG_NETFILTER=y
+CONFIG_ATALK=m
+CONFIG_PCI=y
+CONFIG_PCI_SH7751=y
+CONFIG_PCCARD=y
+CONFIG_YENTA=y
+CONFIG_UEVENT_HELPER=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_BLK_DEV_SR=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_ATA=y
+CONFIG_PATA_ARTOP=y
+CONFIG_PATA_OF_PLATFORM=y
+CONFIG_ATA_GENERIC=y
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=m
+CONFIG_MD_LINEAR=m
+CONFIG_MD_RAID0=m
+CONFIG_MD_RAID1=m
+CONFIG_NETDEVICES=y
+CONFIG_TUN=m
+CONFIG_8139CP=y
+CONFIG_USB_PEGASUS=m
+CONFIG_USB_RTL8150=m
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_EARLYCON=y
+CONFIG_HW_RANDOM=y
+CONFIG_SOUND=m
+CONFIG_HID_A4TECH=m
+CONFIG_HID_BELKIN=m
+CONFIG_HID_CHERRY=m
+CONFIG_HID_CHICONY=m
+CONFIG_HID_CYPRESS=m
+CONFIG_HID_EZKEY=m
+CONFIG_HID_GYRATION=m
+CONFIG_HID_ITE=y
+CONFIG_HID_KENSINGTON=y
+CONFIG_HID_REDRAGON=y
+CONFIG_HID_MICROSOFT=m
+CONFIG_HID_MONTEREY=m
+CONFIG_HID_PANTHERLORD=m
+CONFIG_HID_PETALYNX=m
+CONFIG_HID_SAMSUNG=m
+CONFIG_HID_SUNPLUS=m
+CONFIG_USB_HID=m
+CONFIG_USB=y
+CONFIG_USB_MON=y
+CONFIG_USB_EHCI_HCD=y
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+CONFIG_USB_OHCI_HCD=y
+CONFIG_USB_PRINTER=m
+CONFIG_USB_STORAGE=m
+CONFIG_USB_STORAGE_DATAFAB=m
+CONFIG_USB_STORAGE_FREECOM=m
+CONFIG_USB_STORAGE_ISD200=m
+CONFIG_USB_STORAGE_SDDR09=m
+CONFIG_USB_STORAGE_SDDR55=m
+CONFIG_USB_STORAGE_JUMPSHOT=m
+CONFIG_USB_SERIAL=m
+CONFIG_USB_SERIAL_FTDI_SIO=m
+CONFIG_USB_SERIAL_PL2303=m
+CONFIG_USB_EMI62=m
+CONFIG_USB_EMI26=m
+CONFIG_USB_SISUSBVGA=m
+CONFIG_RENESAS_SH7751_INTC=y
+CONFIG_RENESAS_SH7751IRL_INTC=y
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+CONFIG_REISERFS_FS=y
+CONFIG_ISO9660_FS=m
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_NTFS_FS=m
+CONFIG_NTFS_RW=y
+CONFIG_TMPFS=y
+CONFIG_ROMFS_FS=y
+CONFIG_UFS_FS=m
+CONFIG_NFS_FS=m
+CONFIG_NFSD=m
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_932=y
+CONFIG_INIT_STACK_NONE=y
+CONFIG_CRC_T10DIF=y
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_FTRACE is not set
+CONFIG_SH_STANDARD_BIOS=y
Signature · 1 line
2.39.2
#89 lore raw
In reply to Yoshinori Sato

Hi Yoshinori!

Quoted 4 lines · Yoshinori Sato

This is an updated version of something I wrote about 7 years ago. Minimum support for R2D-plus and LANDISK.
I think R2D-1 will work if you add AX88796 to dts.
And board-specific functions and SCI's SPI functions are not supported.

I tried to apply this series against both 6.5 and 6.6 and it unfortunately fails. git also claims that one of the patches is empty.

Could you rebase your series against 6.7-rc1 once it's out?

In the mean time, I will add comments to the v3 series of your patches.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
author maintainer
#90 lore raw
Quoted 9 lines · John Paul Adrian Glaubitz

Hi Yoshinori!

Quoted 4 lines · Yoshinori Sato

This is an updated version of something I wrote about 7 years ago. Minimum support for R2D-plus and LANDISK.
I think R2D-1 will work if you add AX88796 to dts.
And board-specific functions and SCI's SPI functions are not supported.

Quoted 4 lines

I tried to apply this series against both 6.5 and 6.6 and it unfortunately fails. git also claims that one of the patches is empty.

Could you rebase your series against 6.7-rc1 once it's out?

Yes. I know that some changes are conflicting.
I was able to fix the comments for v3, so I will send a patch for v4 after importing v6.7-rc1.

Quoted 9 lines

In the mean time, I will add comments to the v3 series of your patches.

Adrian

Signature · 4 lines
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer
`. `'   Physicist
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913
Signature · 1 line
Yosinori Sato