Skip to contentSkip to conversation

sh: LANDISK convert to device tree

PATCH Superseded Yoshinori Sato 5 participants 33 messages Jun 12, 2016 – Jun 14, 2016

Subsystems (7)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Yoshinori Sato

author maintainer
#0 lore raw

v2 cover sh: LANDISK convert to device tree

SH get devicetree support. But it not working on existing H/W.

IO-DATA HDL-U (aka landisk) currentry supported.
This H/W like SH7751 evalution board. It's a best to use this as a change base H/W.

Changes V2
- split DeviceTree suppoty update.
- PCI driver update.
- Some cleanup.

Yoshinori Sato (17):
sh: Add sh-specific early_init_dt_reserve_memory_arch
sh: More early unflatten device tree
sh: set preset_lpj
sh: Use P1SEGADDR
sh: command line passing chosen/bootargs in devicetree
sh: FDT address save before bank change
sh: Passing FDT address on zImage
sh: Disable board specific code on device tree mode
sh: Use GENERIC_IOMAP on device tree mode
sh: convert generic drivers framework
sh: SH7750/51 clock driver
sh: Add PCI host bridge driver for SH7751
sh: Add PCI definetion
sh: SH3/4 Generic IRQCHIP driever
sh: SH-INTC helper files
sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree
sh: landisk CPLD interrupt controller driver

 .../bindings/clock/renesas,sh7750-div-clock.txt    |  27 ++
 .../bindings/clock/renesas,sh7750-pll-clock.txt    |  26 ++
 .../interrupt-controller/iodata-landisk.txt        |  28 ++
 .../interrupt-controller/renesas,sh7751-intc.txt   |  25 ++
 .../devicetree/bindings/pci/sh7751-pci.txt         |  51 +++
 arch/sh/Kconfig                                    |   6 +-
 arch/sh/Makefile                                   |   2 +
 arch/sh/boards/Kconfig                             |   4 +
 arch/sh/boards/of-generic.c                        |  24 +-
 arch/sh/boot/compressed/head_32.S                  |   5 +-
 arch/sh/boot/dts/include/dt-bindings               |   1 +
 arch/sh/boot/dts/landisk.dts                       | 150 +++++++
 arch/sh/drivers/Makefile                           |   2 +
 arch/sh/include/asm/io.h                           |   6 +
 arch/sh/kernel/cpu/Makefile                        |   8 +-
 arch/sh/kernel/cpu/clock.c                         |   6 +-
 arch/sh/kernel/cpu/sh4/Makefile                    |   2 +
 arch/sh/kernel/head_32.S                           |   7 +-
 arch/sh/kernel/setup.c                             |  16 +-
 drivers/clk/Kconfig                                |   1 +
 drivers/clk/Makefile                               |   3 +-
 drivers/clk/sh/Kconfig                             |   2 +
 drivers/clk/sh/Makefile                            |   2 +
 drivers/clk/sh/clk-sh7750.c                        | 240 +++++++++++
 drivers/clk/sh/clk-shdiv.c                         | 344 ++++++++++++++++
 drivers/clk/sh/clk-shdiv.h                         |  16 +
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-io-landisk.c                   |  72 ++++
 drivers/irqchip/irq-renesas-sh7751.c               | 141 +++++++
 drivers/pci/host/Kconfig                           |   7 +
 drivers/pci/host/Makefile                          |   1 +
 drivers/pci/host/pci-sh7751.c                      | 443 +++++++++++++++++++++
 include/dt-bindings/interrupt-controller/sh_intc.h |   2 +
 34 files changed, 1656 insertions(+), 20 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt
 create mode 100644 Documentation/devicetree/bindings/pci/sh7751-pci.txt
 create mode 120000 arch/sh/boot/dts/include/dt-bindings
 create mode 100644 arch/sh/boot/dts/landisk.dts
 create mode 100644 drivers/clk/sh/Kconfig
 create mode 100644 drivers/clk/sh/Makefile
 create mode 100644 drivers/clk/sh/clk-sh7750.c
 create mode 100644 drivers/clk/sh/clk-shdiv.c
 create mode 100644 drivers/clk/sh/clk-shdiv.h
 create mode 100644 drivers/irqchip/irq-io-landisk.c
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
 create mode 100644 drivers/pci/host/pci-sh7751.c
 create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h
Signature · 1 line
2.7.0
author maintainer
#1 lore raw

PATCH v2 1/17 sh: Add sh-specific early_init_dt_reserve_memory_arch

sh used P1 address space in early device tree.
So need convert P1 to physical address before reserve memory.

---
 arch/sh/boards/of-generic.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/sh/boards/of-generic.c +12 -0
index 57d45dc..fe2d917 100644
@@ -15,6 +15,7 @@
 #include <linux/clocksource.h>
 #include <linux/irqchip.h>
 #include <linux/clk-provider.h>
+#include <linux/memblock.h>
 #include <asm/machvec.h>
 #include <asm/rtc.h>
 
@@ -203,3 +204,14 @@ static int __init sh_of_device_init(void)
 	return 0;
 }
 arch_initcall_sync(sh_of_device_init);
+
+int __init early_init_dt_reserve_memory_arch(phys_addr_t base,
+					     phys_addr_t size, bool nomap)
+{
+	if (nomap)
+		return memblock_remove(base, size);
+
+	if (base >= P1SEG)
+		base = base & ~P1SEG;
+	return memblock_reserve(base, size);
+}
Signature · 1 line
2.7.0
#2 lore raw

Re: [PATCH v2 01/17] sh: Add sh-specific early_init_dt_reserve_memory_arch

Quoted 12 lines · Yoshinori Sato

sh used P1 address space in early device tree.
So need convert P1 to physical address before reserve memory.

---
 arch/sh/boards/of-generic.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/sh/boards/of-generic.c +0 -0
index 57d45dc..fe2d917 100644

[...]

arch/sh/boards/of-generic.c static int __init sh_of_device_init(void) · line 215

Quoted 13 lines
arch/sh/boards/of-generic.c +9 -0
@@ -203,3 +204,14 @@ static int __init sh_of_device_init(void)
 	return 0;
 }
 arch_initcall_sync(sh_of_device_init);
+
+int __init early_init_dt_reserve_memory_arch(phys_addr_t base,
+					     phys_addr_t size, bool nomap)
+{
+	if (nomap)
+		return memblock_remove(base, size);
+
+	if (base >= P1SEG)
+		base = base & ~P1SEG;
		base &= ~P1SEG;

arch/sh/boards/of-generic.c static int __init sh_of_device_init(void) · line 217

Quoted 2 lines
arch/sh/boards/of-generic.c +2 -0
+	return memblock_reserve(base, size);
+}

MBR, Sergei

author maintainer
#3 lore raw

PATCH v2 2/17 sh: More early unflatten device tree

In reply to Yoshinori Sato

unflatten required MMU disabled.

---
 arch/sh/boards/of-generic.c | 6 ------
 arch/sh/kernel/setup.c      | 7 +++++++
 2 files changed, 7 insertions(+), 6 deletions(-)
arch/sh/boards/of-generic.c +0 -6
index fe2d917..d24bc02 100644
@@ -129,12 +129,6 @@ static void __init sh_of_setup(char **cmdline_p)
 {
 	struct device_node *root;
 
-#ifdef CONFIG_USE_BUILTIN_DTB
-	unflatten_and_copy_device_tree();
-#else
-	unflatten_device_tree();
-#endif
-
 	board_time_init = sh_of_time_init;
 
 	sh_mv.mv_name = "Unknown SH model";
arch/sh/kernel/setup.c +7 -0
index 5b9eb70..86f2792 100644
@@ -271,6 +271,13 @@ 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
+	unflatten_device_tree();
+#endif
+#endif
 	enable_mmu();
 
 	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
Signature · 1 line
2.7.0
author maintainer
#4 lore raw

PATCH v2 3/17 sh: set preset_lpj

In reply to Yoshinori Sato

Generic callibrate delay required this value.

---
 arch/sh/boards/of-generic.c | 6 ++++++
 1 file changed, 6 insertions(+)
arch/sh/boards/of-generic.c +6 -0
index d24bc02..e2b4d98 100644
@@ -128,6 +128,8 @@ static void __init sh_of_time_init(void)
 static void __init sh_of_setup(char **cmdline_p)
 {
 	struct device_node *root;
+	struct device_node *cpu;
+	u32 freq;
 
 	board_time_init = sh_of_time_init;
 
@@ -139,6 +141,10 @@ static void __init sh_of_setup(char **cmdline_p)
 	}
 
 	sh_of_smp_probe();
+
+	cpu = of_find_node_by_name(NULL, "cpu");
+	if (!of_property_read_u32(cpu, "clock-frequency", &freq))
+		preset_lpj = freq / CONFIG_HZ / 2;
 }
 
 static int sh_of_irq_demux(int irq)
Signature · 1 line
2.7.0
author maintainer
#5 lore raw

PATCH v2 4/17 sh: Use P1SEGADDR

In reply to Yoshinori Sato

FDT address is P1SEG. So not virtual address.

---
 arch/sh/kernel/setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/kernel/setup.c +1 -1
index 86f2792..8e3b099 100644
@@ -254,7 +254,7 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)
 #ifdef CONFIG_USE_BUILTIN_DTB
 	dt_virt = __dtb_start;
 #else
-	dt_virt = phys_to_virt(dt_phys);
+	dt_virt = (void *)P1SEGADDR(dt_phys);
 #endif
 
 	if (!dt_virt || !early_init_dt_scan(dt_virt)) {
Signature · 1 line
2.7.0
author maintainer
#6 lore raw

PATCH v2 5/17 sh: command line passing chosen/bootargs in devicetree

In reply to Yoshinori Sato
---
 arch/sh/kernel/setup.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/sh/kernel/setup.c +7 -0
index 8e3b099..d97de16 100644
@@ -280,6 +280,8 @@ void __init setup_arch(char **cmdline_p)
 #endif
 	enable_mmu();
 
+
+#ifndef CONFIG_OF
 	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
 
 	printk(KERN_NOTICE "Boot params:\n"
@@ -301,6 +303,7 @@ void __init setup_arch(char **cmdline_p)
 
 	if (!MOUNT_ROOT_RDONLY)
 		root_mountflags &= ~MS_RDONLY;
+#endif
 	init_mm.start_code = (unsigned long) _text;
 	init_mm.end_code = (unsigned long) _etext;
 	init_mm.end_data = (unsigned long) _edata;
@@ -323,9 +326,13 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
 
+#if !defined(CONFIG_OF) || defined(USE_BUILTIN_DTB)
 	/* 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();
 
Signature · 1 line
2.7.0
#7 lore raw

Re: [PATCH v2 05/17] sh: command line passing chosen/bootargs in devicetree

Quoted 10 lines · Yoshinori Sato
---
 arch/sh/kernel/setup.c | 7 +++++++
 1 file changed, 7 insertions(+)
arch/sh/kernel/setup.c +0 -0
index 8e3b099..d97de16 100644

arch/sh/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 283

Quoted 4 lines
arch/sh/kernel/setup.c +1 -0
@@ -280,6 +280,8 @@ void __init setup_arch(char **cmdline_p)
 #endif
 	enable_mmu();
 
+

Another empty line hardly needed here.

arch/sh/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 287

Quoted 4 lines
arch/sh/kernel/setup.c +1 -0
+#ifndef CONFIG_OF
 	ROOT_DEV = old_decode_dev(ORIG_ROOT_DEV);
 
 	printk(KERN_NOTICE "Boot params:\n"

[...]

MBR, Sergei

author maintainer
#8 lore raw

PATCH v2 6/17 sh: FDT address save before bank change

In reply to Yoshinori Sato

SH3/4 have register bank of R0-R7.
Preset FDT address assigned bank depend on boot loader.
Before setting a bank because we don't depend on a boot loader, it's evacuated.

---
 arch/sh/kernel/head_32.S | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
arch/sh/kernel/head_32.S +3 -4
index 974bc15..fbf5f84 100644
@@ -58,6 +58,9 @@ ENTRY(empty_zero_page)
  *
  */
 ENTRY(_stext)
+#ifdef CONFIG_OF
+	mov	r4, r12		! Store device tree blob pointer in r12
+#endif
 	!			Initialize Status Register
 	mov.l	1f, r0		! MD=1, RB=0, BL=0, IMASK=0xF
 	ldc	r0, sr
@@ -67,10 +70,6 @@ ENTRY(_stext)
 	ldc	r0, r6_bank
 #endif
 
-#ifdef CONFIG_OF
-	mov	r4, r12		! Store device tree blob pointer in r12
-#endif
-	
 	/*
 	 * Prefetch if possible to reduce cache miss penalty.
 	 *
Signature · 1 line
2.7.0
author maintainer
#9 lore raw

PATCH v2 7/17 sh: Passing FDT address on zImage

In reply to Yoshinori Sato
---
 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 3e15032..ef70454 100644
@@ -11,10 +11,11 @@
 
 	.global	startup
 startup:
+	/* Save FDT address */
+	mov	r4, r13
 	/* Load initial status register */
 	mov.l   init_sr, r1
 	ldc     r1, sr
-
 	/* Move myself to proper location if necessary */
 	mova	1f, r0
 	mov.l	1f, r2
@@ -83,7 +84,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.7.0
#10 lore raw

Re: [PATCH v2 07/17] sh: Passing FDT address on zImage

Quoted 23 lines · Yoshinori Sato
---
 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 3e15032..ef70454 100644
@@ -11,10 +11,11 @@
 
 	.global	startup
 startup:
+	/* Save FDT address */
+	mov	r4, r13
 	/* Load initial status register */
 	mov.l   init_sr, r1
 	ldc     r1, sr
-
 	/* Move myself to proper location if necessary */
 	mova	1f, r0
 	mov.l	1f, r2

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

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

Forgot a space after comma?
Is it a delay slot BTW (judging by extra indentation)?

[...]

MBR, Sergei

author maintainer
#11 lore raw

PATCH v2 8/17 sh: Disable board specific code on device tree mode

In reply to Yoshinori Sato
---
 arch/sh/Makefile                | 2 ++
 arch/sh/kernel/cpu/sh4/Makefile | 2 ++
 2 files changed, 4 insertions(+)
arch/sh/Makefile +2 -0
index 3b2c8b4..8adffa8 100644
@@ -132,6 +132,7 @@ core-$(CONFIG_SH_FPU_EMU)	+= arch/sh/math-emu/
 
 core-$(CONFIG_USE_BUILTIN_DTB)	+= arch/sh/boot/dts/
 
+ifneq ($(CONFIG_SH_DEVICE_TREE),y)
 # Mach groups
 machdir-$(CONFIG_SOLUTION_ENGINE)		+= mach-se
 machdir-$(CONFIG_SH_HP6XX)			+= mach-hp6xx
@@ -152,6 +153,7 @@ machdir-$(CONFIG_SH_LANDISK)			+= mach-landisk
 machdir-$(CONFIG_SH_LBOX_RE2)			+= mach-lboxre2
 machdir-$(CONFIG_SH_CAYMAN)			+= mach-cayman
 machdir-$(CONFIG_SH_RSK)			+= mach-rsk
+endif
 
 ifneq ($(machdir-y),)
 core-y	+= $(addprefix arch/sh/boards/, \
arch/sh/kernel/cpu/sh4/Makefile +2 -0
index 3a1dbc7..b822c0c 100644
@@ -14,6 +14,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_OF
 # CPU subtype setup
 obj-$(CONFIG_CPU_SUBTYPE_SH7750)	+= setup-sh7750.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7750R)	+= setup-sh7750.o
@@ -31,6 +32,7 @@ endif
 
 # Additional clocks by subtype
 clock-$(CONFIG_CPU_SUBTYPE_SH4_202)	+= clock-sh4-202.o
+endif
 
 obj-y					+= $(clock-y)
 obj-$(CONFIG_PERF_EVENTS)		+= $(perf-y)
Signature · 1 line
2.7.0
author maintainer
#12 lore raw

PATCH v2 9/17 sh: Use GENERIC_IOMAP on device tree mode

In reply to Yoshinori Sato
---
 arch/sh/boards/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/sh/boards/Kconfig +1 -0
index 5e52d53..9e4ccd0 100644
@@ -12,6 +12,7 @@ config SH_DEVICE_TREE
 	select OF_EARLY_FLATTREE
 	select CLKSRC_OF
 	select GENERIC_CALIBRATE_DELAY
+	select GENERIC_IOMAP
 	help
 	  Select Board Described by Device Tree to build a kernel that
 	  does not hard-code any board-specific knowledge but instead uses
Signature · 1 line
2.7.0
author maintainer
#13 lore raw

PATCH v2 10/17 sh: convert generic drivers framework

In reply to Yoshinori Sato

Use common PCI host framework and Common Clock Freamework.

---
 arch/sh/boards/Kconfig      |   1 +
 arch/sh/drivers/Makefile    |   2 +
 arch/sh/kernel/cpu/Makefile |   8 +-
 arch/sh/kernel/cpu/clock.c  |   6 +-
 drivers/clk/Kconfig         |   1 +
 drivers/clk/Makefile        |   3 +-
 drivers/clk/sh/Kconfig      |   2 +
 drivers/clk/sh/Makefile     |   2 +
 drivers/clk/sh/clk-shdiv.c  | 344 ++++++++++++++++++++++++++++++++++++++++++++
 drivers/clk/sh/clk-shdiv.h  |  16 +++
 10 files changed, 381 insertions(+), 4 deletions(-)
 create mode 100644 drivers/clk/sh/Kconfig
 create mode 100644 drivers/clk/sh/Makefile
 create mode 100644 drivers/clk/sh/clk-shdiv.c
 create mode 100644 drivers/clk/sh/clk-shdiv.h
arch/sh/boards/Kconfig +1 -0
index 9e4ccd0..b6ff9df 100644
@@ -13,6 +13,7 @@ config SH_DEVICE_TREE
 	select CLKSRC_OF
 	select GENERIC_CALIBRATE_DELAY
 	select GENERIC_IOMAP
+	select COMMON_CLK
 	help
 	  Select Board Described by Device Tree to build a kernel that
 	  does not hard-code any board-specific knowledge but instead uses
arch/sh/drivers/Makefile +2 -0
index e13f06b..382e86f 100644
@@ -4,7 +4,9 @@
 
 obj-y		+= dma/
 
+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 +6 -2
index accc7ca..22ad0ee 100644
@@ -16,6 +16,10 @@ obj-$(CONFIG_ARCH_SHMOBILE)	+= shmobile/
 # Common interfaces.
 
 obj-$(CONFIG_SH_ADC)		+= adc.o
+ifndef CONFIG_COMMON_CLK
 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 clock.o fpu.o pfc.o proc.o
arch/sh/kernel/cpu/clock.c +5 -1
index 4187cf4..8e66e23 100644
@@ -22,13 +22,15 @@
 
 int __init clk_init(void)
 {
-	int ret;
+	int ret = 0;
 
+#ifndef CONFIG_COMMON_CLK
 	ret = arch_clk_init();
 	if (unlikely(ret)) {
 		pr_err("%s: CPU clock registration failed.\n", __func__);
 		return ret;
 	}
+#endif
 
 	if (sh_mv.mv_clk_init) {
 		ret = sh_mv.mv_clk_init();
@@ -39,11 +41,13 @@ int __init clk_init(void)
 		}
 	}
 
+#ifndef CONFIG_COMMON_CLK
 	/* Kick the child clocks.. */
 	recalculate_root_clocks();
 
 	/* Enable the necessary init clocks */
 	clk_enable_init_clocks();
+#endif
 
 	return ret;
 }
drivers/clk/Kconfig +1 -0
index 16f7d33..19b0cd3 100644
@@ -202,6 +202,7 @@ source "drivers/clk/hisilicon/Kconfig"
 source "drivers/clk/mvebu/Kconfig"
 source "drivers/clk/qcom/Kconfig"
 source "drivers/clk/samsung/Kconfig"
+source "drivers/clk/sh/Kconfig"
 source "drivers/clk/tegra/Kconfig"
 source "drivers/clk/ti/Kconfig"
 
drivers/clk/Makefile +2 -1
index 46869d6..c75d9c8 100644
@@ -83,4 +83,5 @@ obj-$(CONFIG_COMMON_CLK_VERSATILE)	+= versatile/
 obj-$(CONFIG_X86)			+= x86/
 obj-$(CONFIG_ARCH_ZX)			+= zte/
 obj-$(CONFIG_ARCH_ZYNQ)			+= zynq/
-obj-$(CONFIG_H8300)		+= h8300/
+obj-$(CONFIG_H8300)			+= h8300/
+obj-$(CONFIG_SUPERH)			+= sh/
drivers/clk/sh/Kconfig new file +2 -0
new file mode 100644
index 0000000..89e28d8
@@ -0,0 +1,2 @@
+config COMMON_CLK_SH7750
+	bool "Clcok driver for SH7750/SH7751"
drivers/clk/sh/Makefile new file +2 -0
new file mode 100644
index 0000000..468eb9d
@@ -0,0 +1,2 @@
+obj-y += clk-shdiv.o
+obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o
\ No newline at end of file
drivers/clk/sh/clk-shdiv.c new file +344 -0

344 lines not on this page · raw message

drivers/clk/sh/clk-shdiv.h new file +16 -0
new file mode 100644
index 0000000..ebd27df
@@ -0,0 +1,16 @@
+/* SuperH common clock divider */
+
+struct sh_clk_div {
+	struct clk_divider divider;
+	u16 (*read)(struct clk_divider *divider);
+	void (*write)(struct clk_divider *divider, u16 val);
+};
+
+struct clk *sh_div_clk_register(struct device *dev, const char *name,
+				const char *parent_name,
+				void __iomem *reg, u8 shift, u8 width,
+				const struct clk_div_table *table,
+				spinlock_t *lock,
+				u16 (*read)(struct clk_divider *hw),
+				void (*write)(struct clk_divider *hw, u16 val));
+
Signature · 1 line
2.7.0
#14 lore raw

Re: [PATCH v2 10/17] sh: convert generic drivers framework

drivers/clk/sh/Kconfig line 2

Quoted 6 lines · Yoshinori Sato

index 0000000..89e28d8

drivers/clk/sh/Kconfig new file +2 -0
@@ -0,0 +1,2 @@
+config COMMON_CLK_SH7750
+       bool "Clcok driver for SH7750/SH7751"

Clock

drivers/clk/sh/Makefile line 2

Quoted 9 lines
drivers/clk/sh/Makefile new file +2 -0
new file mode 100644
index 0000000..468eb9d
@@ -0,0 +1,2 @@
+obj-y += clk-shdiv.o
+obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o
\ No newline at end of file

Please add the newline.

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
#15 lore raw

PATCH v2 11/17 sh: SH7750/51 clock driver

In reply to Yoshinori Sato
---
 .../bindings/clock/renesas,sh7750-div-clock.txt    |  27 +++
 .../bindings/clock/renesas,sh7750-pll-clock.txt    |  26 +++
 drivers/clk/sh/clk-sh7750.c                        | 240 +++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt
 create mode 100644 drivers/clk/sh/clk-sh7750.c
Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt new file +27 -0
new file mode 100644
index 0000000..8c57ab5
@@ -0,0 +1,27 @@
+* Renesas SH7750/51 divider clock
+
+Required Properties:
+
+  - compatible: Must be "renesas,sh7750-div-clock"
+
+  - clocks: Reference to the parent clocks (mostly PLL)
+
+  - #clock-cells: Must be 0
+
+  - reg: Base address and length of the divide rate selector
+
+  - renesas,offset: bit offset of selector
+
+  - clock-output-names: The names of the clocks.
+
+Example
+-------
+
+        iclk: iclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+		renesas,offset = <6>;
+		clock-output-names = "ick";
+        };
Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt new file +26 -0
new file mode 100644
index 0000000..06a3d31
@@ -0,0 +1,26 @@
+Renesas SH7750/51 PLL clock
+
+This device is Clock multiplyer
+
+Required Properties:
+
+  - compatible: Must be "renesas,sh7750-pll-clock"
+
+  - clocks: Reference to the parent clocks
+
+  - #clock-cells: Must be 0
+
+  - renesas,mult: PLL1 multiply rate
+
+  - reg: Two rate selector (FRQCR / WDT) register address
+
+Example
+-------
+
+        pllclk: pllclk {
+                compatible = "renesas,sh7750-pll-clock";
+                clocks = <&oclk>;
+                #clock-cells = <0>;
+		renesas,mult = <12>;
+                reg = <0xffc00000 2>, <0xffc00008 4>;
+        };
drivers/clk/sh/clk-sh7750.c new file +240 -0

240 lines not on this page · raw message

Signature · 1 line
2.7.0
#16 lore raw

Re: [PATCH v2 11/17] sh: SH7750/51 clock driver

Hi Sato-san,

Quoted 48 lines · Yoshinori Sato
---
 .../bindings/clock/renesas,sh7750-div-clock.txt    |  27 +++
 .../bindings/clock/renesas,sh7750-pll-clock.txt    |  26 +++
 drivers/clk/sh/clk-sh7750.c                        | 240 +++++++++++++++++++++
 3 files changed, 293 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt
 create mode 100644 drivers/clk/sh/clk-sh7750.c
Documentation/devicetree/bindings/clock/renesas,sh7750-div-clock.txt new file +27 -0
new file mode 100644
index 0000000..8c57ab5
@@ -0,0 +1,27 @@
+* Renesas SH7750/51 divider clock
+
+Required Properties:
+
+  - compatible: Must be "renesas,sh7750-div-clock"
+
+  - clocks: Reference to the parent clocks (mostly PLL)
+
+  - #clock-cells: Must be 0
+
+  - reg: Base address and length of the divide rate selector
+
+  - renesas,offset: bit offset of selector
+
+  - clock-output-names: The names of the clocks.
+
+Example
+-------
+
+        iclk: iclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <6>;
+               clock-output-names = "ick";
+        };
Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt new file +0 -0
new file mode 100644
index 0000000..06a3d31

Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt

Quoted 6 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-pll-clock.txt new file +5 -0
 
+CLK_OF_DECLARE(sh7750_div_clk, "renesas,sh7750-div-clock",
+              sh7750_div_clk_setup);
+CLK_OF_DECLARE(sh7750_pll_clk, "renesas,sh7750-pll-clock",
+              sh7750_pll_clk_setup);
+

Cfr. my comment on the .dtsi, which didn't have linux-clk in CC:

I think it will be much easier for maintenance and code reuse to just have a single "cpg" node that's compatible with "renesas,sh7750-cpg", covering all CPG registers. Especially since the various clocks use the same registers.

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
#17 lore raw

PATCH v2 12/17 sh: Add PCI host bridge driver for SH7751

In reply to Yoshinori Sato

This is alternative SH7751 PCI driver.
Existing driver (arch/sh/drivers/pci/pci-sh7751) use SH specific interface. But this driver using common PCI interface. It more mordan and generic.

---
 .../devicetree/bindings/pci/sh7751-pci.txt         |  51 +++
 arch/sh/boards/Kconfig                             |   1 +
 drivers/pci/host/Kconfig                           |   7 +
 drivers/pci/host/Makefile                          |   1 +
 drivers/pci/host/pci-sh7751.c                      | 443 +++++++++++++++++++++
 5 files changed, 503 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/pci/sh7751-pci.txt
 create mode 100644 drivers/pci/host/pci-sh7751.c
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +51 -0
new file mode 100644
index 0000000..c3ec71a
@@ -0,0 +1,51 @@
+* Renesas SH7751 PCI host interfaces
+
+Required properties:
+  - compatible: "renesas,sh7751-pci" is required.
+    And board specific compatible if fixup required.
+
+  - reg: base address and length of the PCI controller registers.
+  - #address-cells: set to <2>
+  - #size-cells: set to <1>
+  - bus-range: PCI bus numbers covered
+  - device_type: set to "pci"
+  - ranges: ranges for the PCI memory and I/O regions.
+  - interrupt-map-mask and interrupt-map: standard PCI properties
+	to define the mapping of the PCI interface to interrupt
+	numbers.
+
+Example:
+	pci: pci-controller@fe200000 {
+		compatible = "renesas,sh7751-pci", "iodata,landisk";
+		device_type = "pci";
+		bus-range = <0 0>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+		ranges = <0x02000000 0x00000000 0xfd000000 0xfd000000 0x00000000 0x01000000>,
+		         <0x01000000 0x00000000 0xfe240000 0x00000000 0x00000000 0x00040000>;
+		reg = <0xfe200000 0x0400>,
+		      <0x0c000000 0x04000000>,
+		      <0xff800000 0x0030>;
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0x1800 0 7>;
+		interrupt-map = <0x0000 0 1 &cpldintc evt2irq(0x2a0) 0
+		                 0x0000 0 2 &cpldintc evt2irq(0x2c0) 0
+		                 0x0000 0 3 &cpldintc evt2irq(0x2e0) 0
+		                 0x0000 0 4 &cpldintc evt2irq(0x300) 0
+
+		                 0x0800 0 1 &cpldintc evt2irq(0x2c0) 0
+		                 0x0800 0 2 &cpldintc evt2irq(0x2e0) 0
+		                 0x0800 0 3 &cpldintc evt2irq(0x300) 0
+		                 0x0800 0 4 &cpldintc evt2irq(0x2a0) 0
+
+		                 0x1000 0 1 &cpldintc evt2irq(0x2e0) 0
+		                 0x1000 0 2 &cpldintc evt2irq(0x300) 0
+		                 0x1000 0 3 &cpldintc evt2irq(0x2a0) 0
+		                 0x1000 0 4 &cpldintc evt2irq(0x2c0) 0
+
+		                 0x1800 0 1 &cpldintc evt2irq(0x300) 0
+		                 0x1800 0 2 &cpldintc evt2irq(0x2a0) 0
+		                 0x1800 0 3 &cpldintc evt2irq(0x2c0) 0
+		                 0x1800 0 4 &cpldintc evt2irq(0x2e0) 0>;
+	};
+};
arch/sh/boards/Kconfig +1 -0
index b6ff9df..cfde921 100644
@@ -14,6 +14,7 @@ config SH_DEVICE_TREE
 	select GENERIC_CALIBRATE_DELAY
 	select GENERIC_IOMAP
 	select COMMON_CLK
+	select SYS_SUPPORTS_PCI
 	help
 	  Select Board Described by Device Tree to build a kernel that
 	  does not hard-code any board-specific knowledge but instead uses
drivers/pci/host/Kconfig +7 -0
index 7a0780d..a8596db 100644
@@ -231,4 +231,11 @@ config PCI_HOST_THUNDER_ECAM
 	help
 	  Say Y here if you want ECAM support for CN88XX-Pass-1.x Cavium Thunder SoCs.
 
+config PCI_SH7751
+	bool "Renesas SH7751 On-Chip PCI controller"
+	depends on OF && SUPERH
+	select PCI_HOST_COMMON
+	help
+	  Say Y here if you want PCI support on SH7751.
+
 endmenu
drivers/pci/host/Makefile +1 -0
index d85b5fa..91268cb 100644
@@ -28,3 +28,4 @@ obj-$(CONFIG_PCI_HISI) += pcie-hisi.o
 obj-$(CONFIG_PCIE_QCOM) += pcie-qcom.o
 obj-$(CONFIG_PCI_HOST_THUNDER_ECAM) += pci-thunder-ecam.o
 obj-$(CONFIG_PCI_HOST_THUNDER_PEM) += pci-thunder-pem.o
+obj-$(CONFIG_PCI_SH7751) += pci-sh7751.o
drivers/pci/host/pci-sh7751.c new file +443 -0

443 lines not on this page · raw message

Signature · 1 line
2.7.0
#18 lore raw

Re: [PATCH v2 12/17] sh: Add PCI host bridge driver for SH7751

Quoted 1 line · Yoshinori Sato

This is alternative SH7751 PCI driver.

an alternative

Quoted 1 line

Existing driver (arch/sh/drivers/pci/pci-sh7751) use SH specific interface.

uses

Quoted 1 line

But this driver using common PCI interface. It more mordan and generic.

uses ... it is more modern ...

Gr{oetje,eeting}s,

Geert

#19 lore raw

Re: [PATCH v2 12/17] sh: Add PCI host bridge driver for SH7751

In reply to Yoshinori Sato
Quoted 8 lines · CEST Yoshinori Sato
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +6 -0
+		ranges = <0x02000000 0x00000000 0xfd000000 0xfd000000 0x00000000 0x01000000>,
+		         <0x01000000 0x00000000 0xfe240000 0x00000000 0x00000000 0x00040000>;
+		reg = <0xfe200000 0x0400>,
+		      <0x0c000000 0x04000000>,
+		      <0xff800000 0x0030>;
+		#interrupt-cells = <1>;

Documentation/devicetree/bindings/pci/sh7751-pci.txt line 39

Quoted 10 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +10 -0
+		interrupt-map-mask = <0x1800 0 7>;
+		interrupt-map = <0x0000 0 1 &cpldintc evt2irq(0x2a0) 0
+		                 0x0000 0 2 &cpldintc evt2irq(0x2c0) 0
+		                 0x0000 0 3 &cpldintc evt2irq(0x2e0) 0
+		                 0x0000 0 4 &cpldintc evt2irq(0x300) 0
+
+		                 0x0800 0 1 &cpldintc evt2irq(0x2c0) 0
+		                 0x0800 0 2 &cpldintc evt2irq(0x2e0) 0
+		                 0x0800 0 3 &cpldintc evt2irq(0x300) 0
+		                 0x0800 0 4 &cpldintc evt2irq(0x2a0) 0

Is this not the default swizzling? I would guess that you can just list the interrupt once.

The formatting is slightly inconsistent here, my recommendation is to always enclose each entry in '< >' so you have a comma-separated list.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 3 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +3 -0
+
+#define pcic_writel(val, reg) __raw_writel(val, pci_reg_base + (reg))
+#define pcic_readl(reg) __raw_readl(pci_reg_base + (reg))

We generally try not to use __raw_*() accessors in drivers, because they are not portable, lack barriers and atomicity, and don't work when you change endianess.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 2 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +2 -0
+unsigned long PCIBIOS_MIN_IO;
+unsigned long PCIBIOS_MIN_MEM;

These should probably be in architecture code, otherwise you cannot build more than one such driver into the kernel.

Quoted 1 line

+DEFINE_RAW_SPINLOCK(pci_config_lock);

This seems unnecessary, the config operations are always called under a spinlock already.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 9 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +9 -0
+static __initconst const struct fixups {
+	char *compatible;
+	void (*fixup)(void __iomem *, void __iomem *);
+} fixup_list[] = {
+	{
+		.compatible = "iodata,landisk",
+		.fixup = landisk_fixup,
+	},
+};

Just move the fixup pointer into the existing of match table as the .data pointer, or add a structure to which .data points.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 13 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +13 -0
+/*
+ * Functions for accessing PCI configuration space with type 1 accesses
+ */
+static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn,
+			   int where, int size, u32 *val)
+{
+	struct gen_pci *pci = bus->sysdata;
+	void __iomem *pci_reg_base;
+	unsigned long flags;
+	u32 data;
+
+	pci_reg_base = ioremap(pci->cfg.res.start,
+			       pci->cfg.res.end - pci->cfg.res.start);

You cannot call normally ioremap from pci_read, because it gets called under a spinlock and ioremap can normally sleep (that might be architecture specific).

Better map it a probe time, or use fixmap.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 8 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +8 -0
+	/*
+	 * PCIPDR may only be accessed as 32 bit words,
+	 * so we must do byte alignment by hand
+	 */
+	raw_spin_lock_irqsave(&pci_config_lock, flags);
+	pcic_writel(CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
+	data = pcic_readl(SH4_PCIPDR);
+	raw_spin_unlock_irqrestore(&pci_config_lock, flags);

This is shorter to express this using a 'map' function in pci_ops combined with pci_generic_config_read32 and pci_generic_config_write32.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 7 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +7 -0
+/*
+ * Called after each bus is probed, but before its children
+ * are examined.
+ */
+void pcibios_fixup_bus(struct pci_bus *bus)
+{
+}

This doesn't really belong into the driver.

Quoted 5 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +5 -0
+/*
+ * We need to avoid collisions with `mirrored' VGA ports
+ * and other strange ISA hardware, so we always want the
+ * addresses to be allocated in the 0x000-0x0ff region
+ * modulo 0x400.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 10 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +10 -0
+ */
+resource_size_t pcibios_align_resource(void *data,
+				       const struct resource *res,
+				       resource_size_t size,
+				       resource_size_t align)
+{
+	resource_size_t start = res->start;
+
+	return start;
+}

The comment does not match what the function does, you should change one or the other. Also move it to the same file as pcibios_fixup_bus.

Quoted 11 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +11 -0
+int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+			enum pci_mmap_state mmap_state, int write_combine)
+{
+	/*
+	 * I/O space can be accessed via normal processor loads and stores on
+	 * this platform but for now we elect not to do this and portable
+	 * drivers should not do this anyway.
+	 */
+
+	if (mmap_state == pci_mmap_io)
+		return -EINVAL;

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 10 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +10 -0
+
+	/*
+	 * Ignore write-combine; for now only return uncached mappings.
+	 */
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+
+	return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+			       vma->vm_end - vma->vm_start,
+			       vma->vm_page_prot);
+}

Do you actually need HAVE_PCI_MMAP? Maybe you can just unset that and remove the function here.

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 12 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +12 -0
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	pci_reg_base = ioremap(res->start, res->end - res->start);
+	if (IS_ERR(pci_reg_base))
+		return PTR_ERR(pci_reg_base);
+
+	wres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (IS_ERR(wres))
+		return PTR_ERR(wres);
+
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+	bcr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(bcr))

You map three distinct memory resources here, but your binding just describes one as "reg: base address and length of the PCI controller registers".

If there are multiple register ranges, please list each one in the binding and document in which order they are expected, or use named resources and list the required names.

Arnd

author maintainer
#20 lore raw

Re: [PATCH v2 12/17] sh: Add PCI host bridge driver for SH7751

Quoted 24 lines · Arnd Bergmann
Quoted 8 lines · CEST Yoshinori Sato
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +6 -0
+		ranges = <0x02000000 0x00000000 0xfd000000 0xfd000000 0x00000000 0x01000000>,
+		         <0x01000000 0x00000000 0xfe240000 0x00000000 0x00000000 0x00040000>;
+		reg = <0xfe200000 0x0400>,
+		      <0x0c000000 0x04000000>,
+		      <0xff800000 0x0030>;
+		#interrupt-cells = <1>;

Documentation/devicetree/bindings/pci/sh7751-pci.txt line 39

Quoted 10 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +10 -0
+		interrupt-map-mask = <0x1800 0 7>;
+		interrupt-map = <0x0000 0 1 &cpldintc evt2irq(0x2a0) 0
+		                 0x0000 0 2 &cpldintc evt2irq(0x2c0) 0
+		                 0x0000 0 3 &cpldintc evt2irq(0x2e0) 0
+		                 0x0000 0 4 &cpldintc evt2irq(0x300) 0
+
+		                 0x0800 0 1 &cpldintc evt2irq(0x2c0) 0
+		                 0x0800 0 2 &cpldintc evt2irq(0x2e0) 0
+		                 0x0800 0 3 &cpldintc evt2irq(0x300) 0
+		                 0x0800 0 4 &cpldintc evt2irq(0x2a0) 0

Is this not the default swizzling? I would guess that you can just list the interrupt once.

Quoted 3 lines

The formatting is slightly inconsistent here, my recommendation is to always enclose each entry in '< >' so you have a comma-separated list.

OK.
I'll fix this.

Quoted 7 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 3 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +3 -0
+
+#define pcic_writel(val, reg) __raw_writel(val, pci_reg_base + (reg))
+#define pcic_readl(reg) __raw_readl(pci_reg_base + (reg))

We generally try not to use __raw_*() accessors in drivers, because they are not portable, lack barriers and atomicity, and don't work when you change endianess.

OK.
It cpied old style driver.
Update ioread/write.

Quoted 10 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 2 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +2 -0
+unsigned long PCIBIOS_MIN_IO;
+unsigned long PCIBIOS_MIN_MEM;

These should probably be in architecture code, otherwise you cannot build more than one such driver into the kernel.

Quoted 1 line

+DEFINE_RAW_SPINLOCK(pci_config_lock);

This seems unnecessary, the config operations are always called under a spinlock already.

OK.
remove it.

Quoted 5 lines
Quoted 5 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +5 -0
+static __initconst const struct fixups {
+	char *compatible;
+	void (*fixup)(void __iomem *, void __iomem *);
+} fixup_list[] = {
+	{
Quoted 8 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 4 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +4 -0
+		.compatible = "iodata,landisk",
+		.fixup = landisk_fixup,
+	},
+};

Just move the fixup pointer into the existing of match table as the .data pointer, or add a structure to which .data points.

OK.

Quoted 18 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 13 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +13 -0
+/*
+ * Functions for accessing PCI configuration space with type 1 accesses
+ */
+static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn,
+			   int where, int size, u32 *val)
+{
+	struct gen_pci *pci = bus->sysdata;
+	void __iomem *pci_reg_base;
+	unsigned long flags;
+	u32 data;
+
+	pci_reg_base = ioremap(pci->cfg.res.start,
+			       pci->cfg.res.end - pci->cfg.res.start);

You cannot call normally ioremap from pci_read, because it gets called under a spinlock and ioremap can normally sleep (that might be architecture specific).

Quoted 1 line

Better map it a probe time, or use fixmap.

OK.

Quoted 4 lines
Quoted 4 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +4 -0
+	/*
+	 * PCIPDR may only be accessed as 32 bit words,
+	 * so we must do byte alignment by hand
+	 */
Quoted 8 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 4 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +4 -0
+	raw_spin_lock_irqsave(&pci_config_lock, flags);
+	pcic_writel(CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
+	data = pcic_readl(SH4_PCIPDR);
+	raw_spin_unlock_irqrestore(&pci_config_lock, flags);

This is shorter to express this using a 'map' function in pci_ops combined with pci_generic_config_read32 and pci_generic_config_write32.

OK.

Quoted 9 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 7 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +7 -0
+/*
+ * Called after each bus is probed, but before its children
+ * are examined.
+ */
+void pcibios_fixup_bus(struct pci_bus *bus)
+{
+}

This doesn't really belong into the driver.

OK.

Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +11 -0
+/*
+ * We need to avoid collisions with `mirrored' VGA ports
+ * and other strange ISA hardware, so we always want the
+ * addresses to be allocated in the 0x000-0x0ff region
+ * modulo 0x400.
+ */
+resource_size_t pcibios_align_resource(void *data,
+				       const struct resource *res,
+				       resource_size_t size,
+				       resource_size_t align)
+{
Quoted 8 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 4 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +4 -0
+	resource_size_t start = res->start;
+
+	return start;
+}

The comment does not match what the function does, you should change one or the other. Also move it to the same file as pcibios_fixup_bus.

OK.
This part copied old driver.
I will cleanup.

Quoted 16 lines
Quoted 16 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +16 -0
+int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
+			enum pci_mmap_state mmap_state, int write_combine)
+{
+	/*
+	 * I/O space can be accessed via normal processor loads and stores on
+	 * this platform but for now we elect not to do this and portable
+	 * drivers should not do this anyway.
+	 */
+
+	if (mmap_state == pci_mmap_io)
+		return -EINVAL;
+
+	/*
+	 * Ignore write-combine; for now only return uncached mappings.
+	 */
+	vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
Quoted 8 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 5 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +5 -0
+
+	return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+			       vma->vm_end - vma->vm_start,
+			       vma->vm_page_prot);
+}

Do you actually need HAVE_PCI_MMAP? Maybe you can just unset that and remove the function here.

Not set this.
Remove function.

Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +9 -0
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	pci_reg_base = ioremap(res->start, res->end - res->start);
+	if (IS_ERR(pci_reg_base))
+		return PTR_ERR(pci_reg_base);
+
+	wres = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+	if (IS_ERR(wres))
+		return PTR_ERR(wres);
+
Quoted 8 lines

Documentation/devicetree/bindings/pci/sh7751-pci.txt

Quoted 3 lines
Documentation/devicetree/bindings/pci/sh7751-pci.txt new file +3 -0
+	res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+	bcr = devm_ioremap_resource(&pdev->dev, res);
+	if (IS_ERR(bcr))

You map three distinct memory resources here, but your binding just describes one as "reg: base address and length of the PCI controller registers".

OK.

Quoted 5 lines

If there are multiple register ranges, please list each one in the binding and document in which order they are expected, or use named resources and list the required names.

This controller have single register area.
I will fix dts.

Thanks.

Quoted 1 line

Arnd

Signature · 2 lines
Yoshinori Sato
<[email protected]>
author maintainer
#21 lore raw

PATCH v2 13/17 sh: Add PCI definetion

In reply to Yoshinori Sato
---
 arch/sh/include/asm/io.h | 6 ++++++
 1 file changed, 6 insertions(+)
arch/sh/include/asm/io.h +6 -0
index 3280a6b..df62a9f 100644
@@ -387,6 +387,12 @@ static inline int iounmap_fixed(void __iomem *addr) { return -EINVAL; }
 int valid_phys_addr_range(phys_addr_t addr, size_t size);
 int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
+#define PCI_IOBASE	0xfe240000UL
+
+#define HAVE_ARCH_PIO_SIZE
+#define PIO_OFFSET	PCI_IOBASE
+#define PIO_MASK	0x3ffffUL
+#define PIO_RESERVED	0x40000UL
 #endif /* __KERNEL__ */
 
 #endif /* __ASM_SH_IO_H */
Signature · 1 line
2.7.0
#22 lore raw

Re: [PATCH v2 13/17] sh: Add PCI definetion

s/definetion/definition/

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
#23 lore raw

PATCH v2 14/17 sh: SH3/4 Generic IRQCHIP driever

In reply to Yoshinori Sato

IPR based IRQ chip driver.

---
 .../interrupt-controller/renesas,sh7751-intc.txt   |  25 ++++
 arch/sh/Kconfig                                    |   6 +-
 arch/sh/boards/Kconfig                             |   1 +
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-renesas-sh7751.c               | 141 +++++++++++++++++++++
 6 files changed, 176 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt new file +25 -0
new file mode 100644
index 0000000..2bc6f22f
@@ -0,0 +1,25 @@
+DT bindings for the SH7751 interrupt controller
+
+Required properties:
+
+  - compatible: has to be "renesas,sh7751-intc".
+
+  - reg: Base address and length of interrupt controller register
+         and extend register.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+
+  - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined
+    in interrupts.txt in this directory.
+
+Example
+-------
+
+	shintc: interrupt-controller@ffd00000 {
+		compatible = "renesas,sh7751-intc";
+		#interrupt-cells = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-controller;
+		reg = <0xffd00000 14>, <0xfe080000 128>;
+	};
arch/sh/Kconfig +3 -3
index 4fa5894..f268277 100644
@@ -28,7 +28,7 @@ config SUPERH
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select MAY_HAVE_SPARSE_IRQ
+	select MAY_HAVE_SPARSE_IRQ if !SH_DEVICE_TREE
 	select IRQ_FORCED_THREADING
 	select RTC_LIB
 	select GENERIC_ATOMIC64
@@ -67,7 +67,7 @@ config SUPERH32
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
-	select SPARSE_IRQ
+	select SPARSE_IRQ if !SH_DEVICE_TREE
 	select HAVE_CC_STACKPROTECTOR
 
 config SUPERH64
@@ -860,7 +860,7 @@ config PCI
 	depends on SYS_SUPPORTS_PCI
 	select PCI_DOMAINS
 	select GENERIC_PCI_IOMAP
-	select NO_GENERIC_PCI_IOPORT_MAP
+	select NO_GENERIC_PCI_IOPORT_MAP if !SH_DEVICE_TREE
 	help
 	  Find out whether you have a PCI motherboard. PCI is the name of a
 	  bus system, i.e. the way the CPU talks to the other stuff inside
arch/sh/boards/Kconfig +1 -0
index cfde921..d33ae46 100644
@@ -15,6 +15,7 @@ config SH_DEVICE_TREE
 	select GENERIC_IOMAP
 	select COMMON_CLK
 	select SYS_SUPPORTS_PCI
+	select GENERIC_IRQ_CHIP
 	help
 	  Select Board Described by Device Tree to build a kernel that
 	  does not hard-code any board-specific knowledge but instead uses
drivers/irqchip/Kconfig +5 -0
index 3e12479..273f19d 100644
@@ -244,3 +244,8 @@ config IRQ_MXS
 config MVEBU_ODMI
 	bool
 	select GENERIC_MSI_IRQ_DOMAIN
+
+config RENESAS_SH_INTC
+	def_bool y if SH_DEVICE_TREE
+	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY
drivers/irqchip/Makefile +1 -0
index b03cfcb..dac7e90 100644
@@ -65,3 +65,4 @@ obj-$(CONFIG_INGENIC_IRQ)		+= irq-ingenic.o
 obj-$(CONFIG_IMX_GPCV2)			+= irq-imx-gpcv2.o
 obj-$(CONFIG_PIC32_EVIC)		+= irq-pic32-evic.o
 obj-$(CONFIG_MVEBU_ODMI)		+= irq-mvebu-odmi.o
+obj-$(CONFIG_RENESAS_SH_INTC)	+= irq-renesas-sh7751.o irq-io-landisk.o
drivers/irqchip/irq-renesas-sh7751.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.7.0
author maintainer
#24 lore raw

PATCH v2 14/17 sh: SH3/4 Generic IRQCHIP driever

Sorry. I send old patches.
Please ignore previous files.

IPR based IRQ chip driver.

---
 .../interrupt-controller/renesas,sh7751-intc.txt   |  25 ++++
 arch/sh/Kconfig                                    |   6 +-
 arch/sh/boards/Kconfig                             |   1 +
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-renesas-sh7751.c               | 141 +++++++++++++++++++++
 6 files changed, 176 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt new file +25 -0
new file mode 100644
index 0000000..2bc6f22f
@@ -0,0 +1,25 @@
+DT bindings for the SH7751 interrupt controller
+
+Required properties:
+
+  - compatible: has to be "renesas,sh7751-intc".
+
+  - reg: Base address and length of interrupt controller register
+         and extend register.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+
+  - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined
+    in interrupts.txt in this directory.
+
+Example
+-------
+
+	shintc: interrupt-controller@ffd00000 {
+		compatible = "renesas,sh7751-intc";
+		#interrupt-cells = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-controller;
+		reg = <0xffd00000 14>, <0xfe080000 128>;
+	};
arch/sh/Kconfig +3 -3
index 4fa5894..f268277 100644
@@ -28,7 +28,7 @@ config SUPERH
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_REGS_AND_STACK_ACCESS_API
-	select MAY_HAVE_SPARSE_IRQ
+	select MAY_HAVE_SPARSE_IRQ if !SH_DEVICE_TREE
 	select IRQ_FORCED_THREADING
 	select RTC_LIB
 	select GENERIC_ATOMIC64
@@ -67,7 +67,7 @@ config SUPERH32
 	select HAVE_MIXED_BREAKPOINTS_REGS
 	select PERF_EVENTS
 	select ARCH_HIBERNATION_POSSIBLE if MMU
-	select SPARSE_IRQ
+	select SPARSE_IRQ if !SH_DEVICE_TREE
 	select HAVE_CC_STACKPROTECTOR
 
 config SUPERH64
@@ -860,7 +860,7 @@ config PCI
 	depends on SYS_SUPPORTS_PCI
 	select PCI_DOMAINS
 	select GENERIC_PCI_IOMAP
-	select NO_GENERIC_PCI_IOPORT_MAP
+	select NO_GENERIC_PCI_IOPORT_MAP if !SH_DEVICE_TREE
 	help
 	  Find out whether you have a PCI motherboard. PCI is the name of a
 	  bus system, i.e. the way the CPU talks to the other stuff inside
arch/sh/boards/Kconfig +1 -0
index cfde921..d33ae46 100644
@@ -15,6 +15,7 @@ config SH_DEVICE_TREE
 	select GENERIC_IOMAP
 	select COMMON_CLK
 	select SYS_SUPPORTS_PCI
+	select GENERIC_IRQ_CHIP
 	help
 	  Select Board Described by Device Tree to build a kernel that
 	  does not hard-code any board-specific knowledge but instead uses
drivers/irqchip/Kconfig +5 -0
index 3e12479..273f19d 100644
@@ -244,3 +244,8 @@ config IRQ_MXS
 config MVEBU_ODMI
 	bool
 	select GENERIC_MSI_IRQ_DOMAIN
+
+config RENESAS_SH_INTC
+	def_bool y if SH_DEVICE_TREE
+	select IRQ_DOMAIN
+	select IRQ_DOMAIN_HIERARCHY
drivers/irqchip/Makefile +1 -0
index b03cfcb..dac7e90 100644
@@ -65,3 +65,4 @@ obj-$(CONFIG_INGENIC_IRQ)		+= irq-ingenic.o
 obj-$(CONFIG_IMX_GPCV2)			+= irq-imx-gpcv2.o
 obj-$(CONFIG_PIC32_EVIC)		+= irq-pic32-evic.o
 obj-$(CONFIG_MVEBU_ODMI)		+= irq-mvebu-odmi.o
+obj-$(CONFIG_RENESAS_SH_INTC)	+= irq-renesas-sh7751.o irq-io-landisk.o
drivers/irqchip/irq-renesas-sh7751.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.7.0
maintainer Acked-by on v2 14/17
#25 lore raw

Re: [PATCH v2 14/17] sh: SH3/4 Generic IRQCHIP driever

Quoted 2 lines · Yoshinori Sato

Sorry. I send old patches.
Please ignore previous files.

Something like this needs to go below the '---' line.

Quoted 6 lines

IPR based IRQ chip driver.

---
 .../interrupt-controller/renesas,sh7751-intc.txt   |  25 ++++

Otherwise,

Quoted 8 lines
 arch/sh/Kconfig                                    |   6 +-
 arch/sh/boards/Kconfig                             |   1 +
 drivers/irqchip/Kconfig                            |   5 +
 drivers/irqchip/Makefile                           |   1 +
 drivers/irqchip/irq-renesas-sh7751.c               | 141 +++++++++++++++++++++
 6 files changed, 176 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.txt
 create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
author maintainer
#26 lore raw

PATCH v2 15/17 sh: SH-INTC helper files

In reply to Yoshinori Sato
---
 arch/sh/boot/dts/include/dt-bindings               | 1 +
 include/dt-bindings/interrupt-controller/sh_intc.h | 2 ++
 2 files changed, 3 insertions(+)
 create mode 120000 arch/sh/boot/dts/include/dt-bindings
 create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.h
arch/sh/boot/dts/include/dt-bindings new file +1 -0
new file mode 120000
index 0000000..08c00e4
@@ -0,0 +1 @@
+../../../../../include/dt-bindings
\ No newline at end of file
include/dt-bindings/interrupt-controller/sh_intc.h new file +2 -0
new file mode 100644
index 0000000..8c9dcdc
@@ -0,0 +1,2 @@
+#define evt2irq(evt)		(((evt) >> 5) - 16)
+#define irq2evt(irq)		(((irq) + 16) << 5)
Signature · 1 line
2.7.0
author maintainer
#27 lore raw

PATCH v2 16/17 sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree

In reply to Yoshinori Sato
---
 arch/sh/boot/dts/landisk.dts | 150 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 150 insertions(+)
 create mode 100644 arch/sh/boot/dts/landisk.dts
arch/sh/boot/dts/landisk.dts new file +150 -0
new file mode 100644
index 0000000..23396a0
@@ -0,0 +1,150 @@
+#include <dt-bindings/interrupt-controller/sh_intc.h>
+
+/dts-v1/;
+/ {
+	model = "I/O DATA HDL-U";
+	compatible = "iodata,hdl-u";
+	#address-cells = <1>;
+	#size-cells = <1>;
+	interrupt-parent = <&shintc>;
+	chosen {
+		stdout-path = &sci1;
+		bootargs = "console=ttySC1,115200";
+	};
+	aliases {
+		serial0 = &sci0;
+		serial1 = &sci1;
+	};
+
+	oclk: oscillator {
+                #clock-cells = <0>;
+                compatible = "fixed-clock";
+                clock-frequency = <22222222>;
+        };
+        pllclk: pllclk {
+                compatible = "renesas,sh7750-pll-clock";
+                clocks = <&oclk>;
+                #clock-cells = <0>;
+		renesas,mult = <12>;
+                reg = <0xffc00000 2>, <0xffc00008 4>;
+        };
+        iclk: iclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+		renesas,offset = <6>;
+		clock-output-names = "ick";
+        };
+        bclk: bclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+		renesas,offset = <3>;
+		clock-output-names = "bck";
+        };
+        fclk: fclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+		renesas,offset = <0>;
+		clock-output-names = "fck";
+        };
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		cpu@0 {
+		      compatible = "renesas,sh4", "renesas,sh";
+		      clock-frequency = <266666666>;
+		};
+	};
+	memory@0c000000 {
+		device_type = "memory";
+		reg = <0x0c000000 0x4000000>;
+	};
+	shintc: interrupt-controller@ffd00000 {
+		compatible = "renesas,sh7751-intc";
+		#interrupt-cells = <2>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-controller;
+		reg = <0xffd00000 14>, <0xfe080000 128>;
+
+	};
+	cpldintc: cpld@b0000000 {
+		compatible = "iodata,landisk-intc";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xb0000000 8>;
+		interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>,
+		              <2 &shintc 2 0>, <3 &shintc 3 0>,
+		              <4 &shintc 4 0>, <5 &shintc 5 0>,
+		              <6 &shintc 6 0>, <7 &shintc 7 0>;
+	};
+	sci0: serial@ffe00000 {
+		compatible = "renesas,scif";
+		reg = <0xffe00000 0x20>;
+		interrupts = <evt2irq(0x4e0) 0
+		              evt2irq(0x500) 0
+		              evt2irq(0x540) 0
+		              evt2irq(0x520) 0>;
+		clocks = <&fclk>;
+		clock-names = "fck";
+	};
+	sci1: serial@ffe80000 {
+		compatible = "renesas,scif";
+		reg = <0xffe80000 0x100>;
+		interrupts = <evt2irq(0x700) 0
+			      evt2irq(0x720) 0
+			      evt2irq(0x760) 0
+			      evt2irq(0x740) 0>;
+		clocks = <&fclk>;
+		clock-names = "fck";
+	};
+	tmu: timer@ffd80000 {
+		compatible = "renesas,tmu";
+		reg = <0xffd80000 12>;
+		interrupts = <evt2irq(0x400) 0
+			      evt2irq(0x420) 0
+			      evt2irq(0x440) 0>;
+		clocks = <&fclk>;
+		clock-names = "fck";
+		renesas,channels-mask = <0x03>;
+	};
+
+	pci: pci-controller@fe200000 {
+		compatible = "renesas,sh7751-pci", "iodata,landisk";
+		device_type = "pci";
+		bus-range = <0 0>;
+		#address-cells = <2>;
+		#size-cells = <1>;
+		ranges = <0x02000000 0x00000000 0xfd000000 0xfd000000 0x00000000 0x01000000>,
+		         <0x01000000 0x00000000 0xfe240000 0x00000000 0x00000000 0x00040000>;
+		reg = <0xfe200000 0x0400>,
+		      <0x0c000000 0x04000000>,
+		      <0xff800000 0x0030>;
+		#interrupt-cells = <1>;
+		interrupt-map-mask = <0x1800 0 7>;
+		interrupt-map = <0x0000 0 1 &cpldintc evt2irq(0x2a0) 0
+		                 0x0000 0 2 &cpldintc evt2irq(0x2c0) 0
+		                 0x0000 0 3 &cpldintc evt2irq(0x2e0) 0
+		                 0x0000 0 4 &cpldintc evt2irq(0x300) 0
+
+		                 0x0800 0 1 &cpldintc evt2irq(0x2c0) 0
+		                 0x0800 0 2 &cpldintc evt2irq(0x2e0) 0
+		                 0x0800 0 3 &cpldintc evt2irq(0x300) 0
+		                 0x0800 0 4 &cpldintc evt2irq(0x2a0) 0
+
+		                 0x1000 0 1 &cpldintc evt2irq(0x2e0) 0
+		                 0x1000 0 2 &cpldintc evt2irq(0x300) 0
+		                 0x1000 0 3 &cpldintc evt2irq(0x2a0) 0
+		                 0x1000 0 4 &cpldintc evt2irq(0x2c0) 0
+
+		                 0x1800 0 1 &cpldintc evt2irq(0x300) 0
+		                 0x1800 0 2 &cpldintc evt2irq(0x2a0) 0
+		                 0x1800 0 3 &cpldintc evt2irq(0x2c0) 0
+		                 0x1800 0 4 &cpldintc evt2irq(0x2e0) 0>;
+	};
+};
Signature · 1 line
2.7.0
#28 lore raw

Re: [PATCH v2 16/17] sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree

Hi Sato-san,

Quoted 8 lines · Yoshinori Sato
arch/sh/boot/dts/landisk.dts new file +4 -0
@@ -0,0 +1,150 @@
 
+        pllclk: pllclk {
+                compatible = "renesas,sh7750-pll-clock";
+                clocks = <&oclk>;
+                #clock-cells = <0>;

arch/sh/boot/dts/landisk.dts line 37

Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10 -0
+               renesas,mult = <12>;
+                reg = <0xffc00000 2>, <0xffc00008 4>;
+        };
+        iclk: iclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <6>;
+               clock-output-names = "ick";

clock-output-names is deprecated for clocks providing a single output.

Quoted 7 lines
arch/sh/boot/dts/landisk.dts new file +7 -0
+        };
+        bclk: bclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <3>;

arch/sh/boot/dts/landisk.dts line 54

Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10 -0
+               clock-output-names = "bck";
+        };
+        fclk: fclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <0>;
+               clock-output-names = "fck";
+        };

I think it will be much easier for maintenance and code reuse to just have a single "cpg" node that's compatible with "renesas,sh7750-cpg", covering all CPG registers. Especially since the various clocks use the same registers.

Cfr. drivers/clk/renesas/cpg-mssr.c.

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
#29 lore raw

Re: [PATCH v2 16/17] sh: I/O DATA HDL-U (a.k.a. landisk) Device Tree

Quoted 44 lines · Geert Uytterhoeven

Hi Sato-san,

Quoted 8 lines · Yoshinori Sato
arch/sh/boot/dts/landisk.dts new file +4 -0
@@ -0,0 +1,150 @@
 
+        pllclk: pllclk {
+                compatible = "renesas,sh7750-pll-clock";
+                clocks = <&oclk>;
+                #clock-cells = <0>;

arch/sh/boot/dts/landisk.dts line 37

Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10 -0
+               renesas,mult = <12>;
+                reg = <0xffc00000 2>, <0xffc00008 4>;
+        };
+        iclk: iclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <6>;
+               clock-output-names = "ick";

clock-output-names is deprecated for clocks providing a single output.

Quoted 7 lines
arch/sh/boot/dts/landisk.dts new file +7 -0
+        };
+        bclk: bclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <3>;

arch/sh/boot/dts/landisk.dts line 54

Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10 -0
+               clock-output-names = "bck";
+        };
+        fclk: fclk {
+                compatible = "renesas,sh7750-div-clock";
+                clocks = <&pllclk>;
+                #clock-cells = <0>;
+                reg = <0xffc00000 2>;
+               renesas,offset = <0>;
+               clock-output-names = "fck";
+        };
Quoted 5 lines

I think it will be much easier for maintenance and code reuse to just have a single "cpg" node that's compatible with "renesas,sh7750-cpg", covering all CPG registers. Especially since the various clocks use the same registers.

Cfr. drivers/clk/renesas/cpg-mssr.c.

OK.
I'll try.

Quoted 10 lines

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

Signature · 2 lines
Yoshinori Sato
<[email protected]>
author maintainer
#30 lore raw

PATCH v2 17/17 sh: landisk CPLD interrupt controller driver

In reply to Yoshinori Sato
---
 .../interrupt-controller/iodata-landisk.txt        | 28 +++++++++
 drivers/irqchip/irq-io-landisk.c                   | 72 ++++++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt
 create mode 100644 drivers/irqchip/irq-io-landisk.c
Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt new file +28 -0
new file mode 100644
index 0000000..d398538
@@ -0,0 +1,28 @@
+DT bindings for the I/O DATA HDL-U interrupt controller
+
+Required properties:
+
+  - compatible: has to be "iodata,landisk-intc".
+
+  - reg: Base address and length of interrupt controller register.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+
+  - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined
+    in interrupts.txt in this directory.
+
+  - interrupt-map: Interrupt mapping on parent controller.
+
+Example
+-------
+
+	cpldintc: cpld@b0000000 {
+		compatible = "iodata,landisk-intc";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xb0000000 8>;
+		interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>,
+		              <2 &shintc 2 0>, <3 &shintc 3 0>,
+		              <4 &shintc 4 0>, <5 &shintc 5 0>,
+		              <6 &shintc 6 0>, <7 &shintc 7 0>;
+	};
drivers/irqchip/irq-io-landisk.c new file +72 -0

72 lines not on this page · raw message

Signature · 6 lines
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#31 lore raw

PATCH v2 17/17 sh: landisk CPLD interrupt controller driver

Sorry. I send old patches.
Please ignore previous files.

---
 .../interrupt-controller/iodata-landisk.txt        | 28 +++++++++
 drivers/irqchip/irq-io-landisk.c                   | 72 ++++++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt
 create mode 100644 drivers/irqchip/irq-io-landisk.c
Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt new file +28 -0
new file mode 100644
index 0000000..d398538
@@ -0,0 +1,28 @@
+DT bindings for the I/O DATA HDL-U interrupt controller
+
+Required properties:
+
+  - compatible: has to be "iodata,landisk-intc".
+
+  - reg: Base address and length of interrupt controller register.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+
+  - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined
+    in interrupts.txt in this directory.
+
+  - interrupt-map: Interrupt mapping on parent controller.
+
+Example
+-------
+
+	cpldintc: cpld@b0000000 {
+		compatible = "iodata,landisk-intc";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xb0000000 8>;
+		interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>,
+		              <2 &shintc 2 0>, <3 &shintc 3 0>,
+		              <4 &shintc 4 0>, <5 &shintc 5 0>,
+		              <6 &shintc 6 0>, <7 &shintc 7 0>;
+	};
drivers/irqchip/irq-io-landisk.c new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.7.0
maintainer
#32 lore raw

Re: [PATCH v2 17/17] sh: landisk CPLD interrupt controller driver

Quoted 2 lines · Yoshinori Sato

Sorry. I send old patches.
Please ignore previous files.

same comment here.

Quoted 32 lines
---
 .../interrupt-controller/iodata-landisk.txt        | 28 +++++++++
 drivers/irqchip/irq-io-landisk.c                   | 72 ++++++++++++++++++++++
 2 files changed, 100 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt
 create mode 100644 drivers/irqchip/irq-io-landisk.c
Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt new file +17 -0
new file mode 100644
index 0000000..d398538
@@ -0,0 +1,28 @@
+DT bindings for the I/O DATA HDL-U interrupt controller
+
+Required properties:
+
+  - compatible: has to be "iodata,landisk-intc".
+
+  - reg: Base address and length of interrupt controller register.
+
+  - interrupt-controller: Identifies the node as an interrupt controller.
+
+  - #interrupt-cells: has to be <2>: an interrupt index and flags, as defined
+    in interrupts.txt in this directory.
+
+  - interrupt-map: Interrupt mapping on parent controller.
+
+Example
+-------

Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt line 27

Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/iodata-landisk.txt new file +10 -0
+
+	cpldintc: cpld@b0000000 {
+		compatible = "iodata,landisk-intc";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xb0000000 8>;
+		interrupt-map=<0 &shintc 0 0>, <1 &shintc 1 0>,
+		              <2 &shintc 2 0>, <3 &shintc 3 0>,
+		              <4 &shintc 4 0>, <5 &shintc 5 0>,
+		              <6 &shintc 6 0>, <7 &shintc 7 0>;

This is not right. Since this node has 2 interrupt-cells, you need 2 entries for the child-interrupt specifier. You also need to set #address-cells to 0 and set the mask to mask out the 2nd cell.

Then again, there is not any real translation happening here, so perhaps you don't need this at all.

Rob