Device Tree support for SH7751 based board
Subsystems (12)
Yoshinori Sato
maintainerv2 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.
v2 changes.
- Rebasing v6,6-rc1
- re-write irqchip driver.
- Add binding documents.
- Cleanup review comment.
Yoshinori Sato (30):
arch/sh: head_32.S passing FDT address to initialize function. arch/sh: boards/Kconfig unified OF supported targets. arch/sh: Disable SH specific drivers in OF enabled.
include: sh_intc.h Add stub function "intc_finalize". arch/sh: setup.c update DeviceTree support.
drivers/pci: SH7751 PCI Host bridge header.
drivers/pci: SH7751 PCI Host bridge controller driver. drivers/pci: Add SH7751 Host bridge controller Documentation/devicetree: Add renesas,sh7751-pci binding document. drivers/clk: SH7750 / SH7751 CPG Driver
drivers/clk: SuperH generai clock divider helper drivers/clk: Add SH7750 CPG drivers entry. Documentation/devicetree: Add renesas,sh7751-cpg binding document. drivers/irqchip: Add SH7751 Internal INTC drivers. Documentation/devicetree: Add renesas,sh7751-intc binding document. drivers/irqchip: SH7751 IRL external encoder with enable gate. Documentation/devicetree: Add renesas,sh7751-irl-ext binding document. drivers/clocksource: sh_tmu clocks property support. drivers/tty: sh-sci fix SH4 OF support.
drivers/mfd: sm501 add some properties. Documentation/devicetree: sm501fb add properies.
arch/sh: Add dtbs target support.
arch/sh: Add SH7751 SoC Internal periphreal devicetree. include/dt-bindings: Add SH7750 CPG header. include/dt-bindings: Add sh_intc IRQ - EVT conversion helper arch/sh: RTS7751R2D Plus DeviceTree.
arch/sh: LANDISK DeviceTree.
arch/sh: USL-5P DeviceTree.
arch/sh: RTS7751R2D Plus OF defconfig
arch/sh: LANDISK OF defconfig
.../bindings/clock/renesas,sh7750-cpg.yaml | 58 +++ .../devicetree/bindings/display/sm501fb.txt | 11 + .../renesas,sh7751-intc.yaml | 45 +++ .../renesas,sh7751-irl-ext.yaml | 77 ++++ .../bindings/pci/renesas,sh7751-pci.yaml | 57 +++ arch/sh/Kconfig | 6 +- arch/sh/boards/Kconfig | 26 +- arch/sh/boards/of-generic.c | 23 +- arch/sh/boot/compressed/head_32.S | 5 +- arch/sh/boot/dts/Makefile | 5 + arch/sh/boot/dts/include/dt-bindings | 1 + arch/sh/boot/dts/landisk.dts | 103 ++++++ arch/sh/boot/dts/rts7751r2dplus.dts | 124 +++++++ arch/sh/boot/dts/sh7751.dtsi | 76 ++++ arch/sh/boot/dts/usl-5p.dts | 106 ++++++ arch/sh/configs/landisk-of_defconfig | 110 ++++++ arch/sh/configs/rts7751r2dplus-of_defconfig | 93 +++++ 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 | 34 +- arch/sh/kernel/time.c | 7 +- drivers/clk/renesas/Kconfig | 15 +- drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/clk-sh7750.c | 236 ++++++++++++ drivers/clk/renesas/clk-shdiv.c | 346 ++++++++++++++++++ drivers/clk/renesas/clk-shdiv.h | 18 + drivers/clocksource/sh_tmu.c | 3 + drivers/irqchip/Kconfig | 16 + drivers/irqchip/Makefile | 3 + drivers/irqchip/irq-renesas-sh7751.c | 232 ++++++++++++ drivers/irqchip/irq-renesas-sh7751irl.c | 183 +++++++++ drivers/mfd/sm501.c | 113 ++++++ drivers/pci/controller/Kconfig | 9 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pci-sh7751.c | 338 +++++++++++++++++ drivers/pci/controller/pci-sh7751.h | 270 ++++++++++++++ drivers/sh/Makefile | 2 + drivers/tty/serial/sh-sci.c | 8 +- include/dt-bindings/clock/sh7750.h | 13 + .../interrupt-controller/sh_intc.h | 7 + include/linux/sh_intc.h | 7 +- 44 files changed, 2772 insertions(+), 47 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,sh7751-pci.yaml create mode 120000 arch/sh/boot/dts/include/dt-bindings 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/sh7751.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/clk/renesas/clk-shdiv.c create mode 100644 drivers/clk/renesas/clk-shdiv.h 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
Yoshinori Sato
maintainerRFC PATCH v2 1/30 arch/sh: 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
@@ -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
Re: [RFC PATCH v2 01/30] arch/sh: head_32.S passing FDT address to initialize function.
Quoted 4 lines · Yoshinori Sato
R4 is caller saved in SH ABI.
Save it so it doesn't get corrupted until it's needed for initialization.Signed-off-by Yoshinori Sato <[email protected]>
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
Yoshinori Sato
maintainerRFC PATCH v2 2/30 arch/sh: boards/Kconfig unified OF supported targets.
In reply to Yoshinori SatoTargets that support OF should be treated as one board.
--- arch/sh/boards/Kconfig | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
arch/sh/boards/Kconfig +16 -10
@@ -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,17 @@ 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. + Currentry supported. + J-Core, RTS7751R2DPlus and LANDISK. + 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
Re: [RFC PATCH v2 02/30] arch/sh: boards/Kconfig unified OF supported targets.
Hi Sato-san,
Quoted 3 lines · Yoshinori Sato
Targets that support OF should be treated as one board.
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 5 lines
arch/sh/boards/Kconfig +0
-0@@ -376,6 +371,17 @@ config SH_APSH4AD0A help Select AP-SH4AD-0A if configuring for an ALPHAPROJECT AP-SH4AD-0A.
arch/sh/boards/Kconfig config SH_APSH4AD0A · line 382
Quoted 10 lines
arch/sh/boards/Kconfig +9
-0+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. + Currentry supported.
Currently supported:
arch/sh/boards/Kconfig config SH_APSH4AD0A · line 383
Quoted 1 line
arch/sh/boards/Kconfig +1
-0+ J-Core, RTS7751R2DPlus and LANDISK.
Although it's usually a bad idea to have such a list, as (hopefully) it becomes outdated soon ;-)
arch/sh/boards/Kconfig config SH_APSH4AD0A · line 387
Quoted 4 lines
arch/sh/boards/Kconfig +1
-0+ source "arch/sh/boards/mach-r2d/Kconfig" source "arch/sh/boards/mach-highlander/Kconfig" source "arch/sh/boards/mach-sdk7780/Kconfig"
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
Yoshinori Sato
maintainerRFC PATCH v2 3/30 arch/sh: Disable SH specific drivers in OF enabled.
In reply to Yoshinori SatoOF uses a common framework.
Avoid using clk, irq and PCI SH-specific drivers.
--- arch/sh/Kconfig | 6 ++++-- arch/sh/boards/of-generic.c | 23 +++++++++-------------- 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/time.c | 7 ++++++- drivers/sh/Makefile | 2 ++ 9 files changed, 48 insertions(+), 21 deletions(-)
arch/sh/Kconfig +4 -2
@@ -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
@@ -379,6 +379,7 @@ config CPU_SUBTYPE_SH7751 config CPU_SUBTYPE_SH7751R bool "Support SH7751R processor" select CPU_SH4 + select PCI_SH7751 if SH_DEVICE_TREE config CPU_SUBTYPE_SH7760 bool "Support SH7760 processor"
@@ -527,6 +528,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/boards/of-generic.c +9 -14
@@ -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>
@@ -107,7 +108,7 @@ 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 ();
@@ -116,6 +117,8 @@ static void __init sh_of_mem_reserve(void)static void __init sh_of_setup (char **cmdline_p) {struct device_node *root; +struct device_node *cpu; +int freq; sh_mv.mv_name ="Unknown SH model" ; root =of_find_node_by_path ("/" );
@@ -125,6 +128,9 @@ 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 /500 ; }static int sh_of_irq_demux (int irq)
@@ -140,25 +146,14 @@ 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_clk_init = noopi, .mv_mode_pins = noopi, - .mv_mem_init = noop, - .mv_mem_reserve = sh_of_mem_reserve, + .mv_mem_init = sh_of_mem_init, };struct sh_clk_ops ;
arch/sh/drivers/Makefile +2 -0
@@ -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/include/asm/io.h +12 -2
@@ -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
@@ -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 */
arch/sh/kernel/cpu/Makefile +7 -2
@@ -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
@@ -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)
arch/sh/kernel/time.c +6 -1
@@ -19,6 +19,7 @@#include <asm/clock.h> #include <asm/rtc.h> #include <asm/platform_early.h> +#include <linux/of_clk.h> static void __init sh_late_time_init (void ) {
@@ -39,7 +40,11 @@ void __init time_init(void) {timer_probe (); +#ifndef CONFIG_SH_DEVICE_TREE clk_init (); - +#else +pr_info ("SH generic board support: scanning for clk providers\n" ); +of_clk_init (NULL ); +#endif late_time_init = sh_late_time_init; }
drivers/sh/Makefile +2 -0
@@ -2,7 +2,9 @@ # # Makefile for the SuperH specific drivers. # +ifneq ($(CONFIG_SH_DEVICE_TREE),y) obj-$(CONFIG_SH_INTC) += intc/ +endif ifneq ($(CONFIG_COMMON_CLK),y) obj-$(CONFIG_HAVE_CLK) += clk/ endif
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 03/30] arch/sh: Disable SH specific drivers in OF enabled.
Hi Sato-san,
Quoted 4 lines · Yoshinori Sato
OF uses a common framework.
Avoid using clk, irq and PCI SH-specific drivers.Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
arch/sh/Kconfig config CPU_SUBTYPE_SH7751 · line 382
Quoted 8 lines
arch/sh/Kconfig +1
-0@@ -379,6 +379,7 @@ config CPU_SUBTYPE_SH7751 config CPU_SUBTYPE_SH7751R bool "Support SH7751R processor" select CPU_SH4 + select PCI_SH7751 if SH_DEVICE_TREE
Is PCI a hard requirement for using SH7751?
It not, it should not be auto-enabled by default.
arch/sh/boards/of-generic.c static void __init sh_of_mem_reserve(void) · line 121
Quoted 9 lines
arch/sh/boards/of-generic.c +2
-0@@ -116,6 +117,8 @@ static void __init sh_of_mem_reserve(void)static void __init sh_of_setup (char **cmdline_p) {struct device_node *root; +struct device_node *cpu; +int freq;
u32
Quoted 26 lines
arch/sh/boards/of-generic.c +3
-9sh_mv.mv_name ="Unknown SH model" ; root =of_find_node_by_path ("/" );@@ -125,6 +128,9 @@ 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 /500 ; }static int sh_of_irq_demux (int irq)@@ -140,25 +146,14 @@ 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 ; -}
arch/sh/boards/of-generic.c static void __init sh_of_init_irq(void) · line 160
Quoted 10 lines
arch/sh/boards/of-generic.c +1
-3- 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_clk_init = noopi, .mv_mode_pins = noopi, - .mv_mem_init = noop,
warning: ‘noop’ defined but not used [-Wunused-function]
Quoted 9 lines
arch/sh/boards/of-generic.c +1
-1- .mv_mem_reserve = sh_of_mem_reserve, + .mv_mem_init = sh_of_mem_init, };struct sh_clk_ops ;
drivers/sh/Makefile line 10
Quoted 9 lines
drivers/sh/Makefile +2
-0@@ -2,7 +2,9 @@ # # Makefile for the SuperH specific drivers. # +ifneq ($(CONFIG_SH_DEVICE_TREE),y) obj-$(CONFIG_SH_INTC) += intc/ +endif ifneq ($(CONFIG_COMMON_CLK),y) obj-$(CONFIG_HAVE_CLK) += clk/ endif
The above three lines can be simplified to
obj-$(CONFIG_HAVE_LEGACY_CLK) += 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
Yoshinori Sato
maintainerRFC PATCH v2 4/30 include: sh_intc.h Add stub function "intc_finalize".
In reply to Yoshinori SatoThis function not use in OF.
avoid unneeded call.
--- include/linux/sh_intc.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
include/linux/sh_intc.h +6 -1
@@ -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
Re: [RFC PATCH v2 04/30] include: sh_intc.h Add stub function "intc_finalize".
Quoted 1 line · Yoshinori Sato
This function not use in OF.
This function is not used with OF.
Quoted 1 line
avoid unneeded call.
Using a static inline function avoids an external call.
Quoted 2 lines
Signed-off-by Yoshinori Sato <[email protected]>
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
Yoshinori Sato
maintainerRFC PATCH v2 5/30 arch/sh: setup.c update DeviceTree support.
In reply to Yoshinori Sato- Get CPU clock frequency for DeviceTree.
- Clean up fdt initialization.
--- arch/sh/kernel/setup.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-)
arch/sh/kernel/setup.c +25 -9
@@ -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,9 @@ extern int root_mountflags;#define RAMDISK_PROMPT_FLAG 0x8000#define RAMDISK_LOAD_FLAG 0x4000 +#if !defined(CONFIG_OF ) || defined(USE_BUILTIN_DTB )static char __initdata command_line[COMMAND_LINE_SIZE ] = {0 , }; +#endif static struct resource code_resource = { .name ="Kernel code" ,
@@ -104,6 +107,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)
@@ -180,7 +185,12 @@ void __init check_for_initrd(void)#ifndef CONFIG_GENERIC_CALIBRATE_DELAY void calibrate_delay (void ) { +#ifndef CONFIG_OF struct clk *clk =clk_get (NULL ,"cpu_clk" ); +#else +struct device_node *cpu =of_find_node_by_name (NULL ,"cpu" ); +struct clk *clk =of_clk_get_by_name (cpu,NULL ); +#endif if (IS_ERR (clk))panic ("Need a sane CPU clock definition!" );
@@ -249,7 +259,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 +283,18 @@ 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"
@@ -313,10 +332,15 @@ void __init setup_arch(char **cmdline_p)strlcat (command_line,CONFIG_CMDLINE ,sizeof (command_line));#endif #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 ();
@@ -327,14 +351,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
Yoshinori Sato
maintainerRFC PATCH v2 6/30 drivers/pci: SH7751 PCI Host bridge header.
In reply to Yoshinori SatoThis file move from SH specific directory "arch/sh/drivers/pci/pci-sh7751.h"
--- drivers/pci/controller/pci-sh7751.h | 270 ++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 drivers/pci/controller/pci-sh7751.h
drivers/pci/controller/pci-sh7751.h new file +270 -0
@@ -0,0 +1,270 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Low-Level PCI Support for SH7751 targets +* +* Dustin McIntire ([email protected]) (c) 2001 +* Paul Mundt ([email protected]) (c) 2003 +* +* May be copied or modified under the terms of the GNU General Public +* License. See linux/COPYING for more information. +* +*/ + +#ifndef _PCI_SH7751_H_ +#define _PCI_SH7751_H_ + +#define SH4_PCICR 0x100/* PCI Control Register */ +#define SH4_PCICR_PREFIX 0xA5000000/* CR prefix for write */ +#define SH4_PCICR_FTO 0x00000400/* TRDY/IRDY Enable */ +#define SH4_PCICR_TRSB 0x00000200/* Target Read Single */ +#define SH4_PCICR_BSWP 0x00000100/* Target Byte Swap */ +#define SH4_PCICR_PLUP 0x00000080/* Enable PCI Pullup */ +#define SH4_PCICR_ARBM 0x00000040/* PCI Arbitration Mode */ +#define SH4_PCICR_MD 0x00000030/* MD9 and MD10 status */ +#define SH4_PCICR_SERR 0x00000008/* SERR output assert */ +#define SH4_PCICR_INTA 0x00000004/* INTA output assert */ +#define SH4_PCICR_PRST 0x00000002/* PCI Reset Assert */ +#define SH4_PCICR_CFIN 0x00000001/* Central Fun. Init Done */ +#define SH4_PCILSR0 0x104/* PCI Local Space Register0 */ +#define SH4_PCILSR1 0x108/* PCI Local Space Register1 */ +#define SH4_PCILAR0 0x10C/* PCI Local Addr Register1 */ +#define SH4_PCILAR1 0x110/* PCI Local Addr Register1 */ +#define SH4_PCIINT 0x114/* PCI Interrupt Register */ +#define SH4_PCIINT_MLCK 0x00008000/* Master Lock Error */ +#define SH4_PCIINT_TABT 0x00004000/* Target Abort Error */ +#define SH4_PCIINT_TRET 0x00000200/* Target Retry Error */ +#define SH4_PCIINT_MFDE 0x00000100/* Master Func. Disable Error */ +#define SH4_PCIINT_PRTY 0x00000080/* Address Parity Error */ +#define SH4_PCIINT_SERR 0x00000040/* SERR Detection Error */ +#define SH4_PCIINT_TWDP 0x00000020/* Tgt. Write Parity Error */ +#define SH4_PCIINT_TRDP 0x00000010/* Tgt. Read Parity Err Det. */ +#define SH4_PCIINT_MTABT 0x00000008/* Master-Tgt. Abort Error */ +#define SH4_PCIINT_MMABT 0x00000004/* Master-Master Abort Error */ +#define SH4_PCIINT_MWPD 0x00000002/* Master Write PERR Detect */ +#define SH4_PCIINT_MRPD 0x00000001/* Master Read PERR Detect */ +#define SH4_PCIINTM 0x118/* PCI Interrupt Mask */ +#define SH4_PCIINTM_TTADIM BIT(14)/* Target-target abort interrupt */ +#define SH4_PCIINTM_TMTOIM BIT(9)/* Target retry timeout */ +#define SH4_PCIINTM_MDEIM BIT(8)/* Master function disable error */ +#define SH4_PCIINTM_APEDIM BIT(7)/* Address parity error detection */ +#define SH4_PCIINTM_SDIM BIT(6)/* SERR detection */ +#define SH4_PCIINTM_DPEITWM BIT(5)/* Data parity error for target write */ +#define SH4_PCIINTM_PEDITRM BIT(4)/* PERR detection for target read */ +#define SH4_PCIINTM_TADIMM BIT(3)/* Target abort for master */ +#define SH4_PCIINTM_MADIMM BIT(2)/* Master abort for master */ +#define SH4_PCIINTM_MWPDIM BIT(1)/* Master write data parity error */ +#define SH4_PCIINTM_MRDPEIM BIT(0)/* Master read data parity error */ +#define SH4_PCIALR 0x11C/* Error Address Register */ +#define SH4_PCICLR 0x120/* Error Command/Data */ +#define SH4_PCICLR_MPIO 0x80000000 +#define SH4_PCICLR_MDMA0 0x40000000/* DMA0 Transfer Error */ +#define SH4_PCICLR_MDMA1 0x20000000/* DMA1 Transfer Error */ +#define SH4_PCICLR_MDMA2 0x10000000/* DMA2 Transfer Error */ +#define SH4_PCICLR_MDMA3 0x08000000/* DMA3 Transfer Error */ +#define SH4_PCICLR_TGT 0x04000000/* Target Transfer Error */ +#define SH4_PCICLR_CMDL 0x0000000F/* PCI Command at Error */ +#define SH4_PCIAINT 0x130/* Arbiter Interrupt Register */ +#define SH4_PCIAINT_MBKN 0x00002000/* Master Broken Interrupt */ +#define SH4_PCIAINT_TBTO 0x00001000/* Target Bus Time Out */ +#define SH4_PCIAINT_MBTO 0x00000800/* Master Bus Time Out */ +#define SH4_PCIAINT_TABT 0x00000008/* Target Abort */ +#define SH4_PCIAINT_MABT 0x00000004/* Master Abort */ +#define SH4_PCIAINT_RDPE 0x00000002/* Read Data Parity Error */ +#define SH4_PCIAINT_WDPE 0x00000001/* Write Data Parity Error */ +#define SH4_PCIAINTM 0x134/* Arbiter Int. Mask Register */ +#define SH4_PCIBMLR 0x138/* Error Bus Master Register */ +#define SH4_PCIBMLR_REQ4 0x00000010/* REQ4 bus master at error */ +#define SH4_PCIBMLR_REQ3 0x00000008/* REQ3 bus master at error */ +#define SH4_PCIBMLR_REQ2 0x00000004/* REQ2 bus master at error */ +#define SH4_PCIBMLR_REQ1 0x00000002/* REQ1 bus master at error */ +#define SH4_PCIBMLR_REQ0 0x00000001/* REQ0 bus master at error */ +#define SH4_PCIDMABT 0x140/* DMA Transfer Arb. Register */ +#define SH4_PCIDMABT_RRBN 0x00000001/* DMA Arbitor Round-Robin */ +#define SH4_PCIDPA0 0x180/* DMA0 Transfer Addr. */ +#define SH4_PCIDLA0 0x184/* DMA0 Local Addr. */ +#define SH4_PCIDTC0 0x188/* DMA0 Transfer Cnt. */ +#define SH4_PCIDCR0 0x18C/* DMA0 Control Register */ +#define SH4_PCIDCR_ALGN 0x00000600/* DMA Alignment Mode */ +#define SH4_PCIDCR_MAST 0x00000100/* DMA Termination Type */ +#define SH4_PCIDCR_INTM 0x00000080/* DMA Interrupt Done Mask*/ +#define SH4_PCIDCR_INTS 0x00000040/* DMA Interrupt Done Status */ +#define SH4_PCIDCR_LHLD 0x00000020/* Local Address Control */ +#define SH4_PCIDCR_PHLD 0x00000010/* PCI Address Control*/ +#define SH4_PCIDCR_IOSEL 0x00000008/* PCI Address Space Type */ +#define SH4_PCIDCR_DIR 0x00000004/* DMA Transfer Direction */ +#define SH4_PCIDCR_STOP 0x00000002/* Force DMA Stop */ +#define SH4_PCIDCR_STRT 0x00000001/* DMA Start */ +#define SH4_PCIDPA1 0x190/* DMA1 Transfer Addr. */ +#define SH4_PCIDLA1 0x194/* DMA1 Local Addr. */ +#define SH4_PCIDTC1 0x198/* DMA1 Transfer Cnt. */ +#define SH4_PCIDCR1 0x19C/* DMA1 Control Register */ +#define SH4_PCIDPA2 0x1A0/* DMA2 Transfer Addr. */ +#define SH4_PCIDLA2 0x1A4/* DMA2 Local Addr. */ +#define SH4_PCIDTC2 0x1A8/* DMA2 Transfer Cnt. */ +#define SH4_PCIDCR2 0x1AC/* DMA2 Control Register */ +#define SH4_PCIDPA3 0x1B0/* DMA3 Transfer Addr. */ +#define SH4_PCIDLA3 0x1B4/* DMA3 Local Addr. */ +#define SH4_PCIDTC3 0x1B8/* DMA3 Transfer Cnt. */ +#define SH4_PCIDCR3 0x1BC/* DMA3 Control Register */ +#define SH4_PCIPAR 0x1C0/* PIO Address Register */ +#define SH4_PCIPAR_CFGEN 0x80000000/* Configuration Enable */ +#define SH4_PCIPAR_BUSNO 0x00FF0000/* Config. Bus Number */ +#define SH4_PCIPAR_DEVNO 0x0000FF00/* Config. Device Number */ +#define SH4_PCIPAR_REGAD 0x000000FC/* Register Address Number */ +#define SH4_PCIMBR 0x1C4/* Memory Base Address */ +#define SH4_PCIMBR_MASK 0xFF000000/* Memory Space Mask */ +#define SH4_PCIMBR_LOCK 0x00000001/* Lock Memory Space */ +#define SH4_PCIIOBR 0x1C8/* I/O Base Address Register */ +#define SH4_PCIIOBR_MASK 0xFFFC0000/* IO Space Mask */ +#define SH4_PCIIOBR_LOCK 0x00000001/* Lock IO Space */ +#define SH4_PCIPINT 0x1CC/* Power Mgmnt Int. Register */ +#define SH4_PCIPINT_D3 0x00000002/* D3 Pwr Mgmt. Interrupt */ +#define SH4_PCIPINT_D0 0x00000001/* D0 Pwr Mgmt. Interrupt */ +#define SH4_PCIPINTM 0x1D0/* Power Mgmnt Mask Register */ +#define SH4_PCICLKR 0x1D4/* Clock Ctrl. Register */ +#define SH4_PCICLKR_PCSTP 0x00000002/* PCI Clock Stop */ +#define SH4_PCICLKR_BCSTP 0x00000001/* BCLK Clock Stop */ +/* For definitions of BCR, MCR see ... */ +#define SH4_PCIBCR1 0x1E0/* Memory BCR1 Register */ +#define SH4_PCIMBR0 SH4_PCIBCR1 +#define SH4_PCIBCR2 0x1E4/* Memory BCR2 Register */ +#define SH4_PCIMBMR0 SH4_PCIBCR2 +#define SH4_PCIWCR1 0x1E8/* Wait Control 1 Register */ +#define SH4_PCIWCR2 0x1EC/* Wait Control 2 Register */ +#define SH4_PCIWCR3 0x1F0/* Wait Control 3 Register */ +#define SH4_PCIMBR2 SH4_PCIWCR3 +#define SH4_PCIMCR 0x1F4/* Memory Control Register */ +#define SH4_PCIBCR3 0x1f8/* Memory BCR3 Register */ +#define SH4_PCIPCTR 0x200/* Port Control Register */ +#define SH4_PCIPCTR_P2EN 0x000400000/* Port 2 Enable */ +#define SH4_PCIPCTR_P1EN 0x000200000/* Port 1 Enable */ +#define SH4_PCIPCTR_P0EN 0x000100000/* Port 0 Enable */ +#define SH4_PCIPCTR_P2UP 0x000000020/* Port2 Pull Up Enable */ +#define SH4_PCIPCTR_P2IO 0x000000010/* Port2 Output Enable */ +#define SH4_PCIPCTR_P1UP 0x000000008/* Port1 Pull Up Enable */ +#define SH4_PCIPCTR_P1IO 0x000000004/* Port1 Output Enable */ +#define SH4_PCIPCTR_P0UP 0x000000002/* Port0 Pull Up Enable */ +#define SH4_PCIPCTR_P0IO 0x000000001/* Port0 Output Enable */ +#define SH4_PCIPDTR 0x204/* Port Data Register */ +#define SH4_PCIPDTR_PB5 0x000000020/* Port 5 Enable */ +#define SH4_PCIPDTR_PB4 0x000000010/* Port 4 Enable */ +#define SH4_PCIPDTR_PB3 0x000000008/* Port 3 Enable */ +#define SH4_PCIPDTR_PB2 0x000000004/* Port 2 Enable */ +#define SH4_PCIPDTR_PB1 0x000000002/* Port 1 Enable */ +#define SH4_PCIPDTR_PB0 0x000000001/* Port 0 Enable */ +#define SH4_PCIPDR 0x220/* Port IO Data Register */ + +/* Platform Specific Values */ +#define SH7751_VENDOR_ID 0x1054 +#define SH7751_DEVICE_ID 0x3505 +#define SH7751R_DEVICE_ID 0x350e + +/* SH7751 Specific Values */ +#define SH7751_PCI_CONFIG_BASE 0xFD000000/* Config space base addr */ +#define SH7751_PCI_CONFIG_SIZE 0x1000000/* Config space size */ +#define SH7751_PCI_MEMORY_BASE 0xFD000000/* Memory space base addr */ +#define SH7751_PCI_MEM_SIZE 0x01000000/* Size of Memory window */ +#define SH7751_PCI_IO_BASE 0xFE240000/* IO space base address */ +#define SH7751_PCI_IO_SIZE 0x40000/* Size of IO window */ + +#define SH7751_PCIREG_BASE 0xFE200000/* PCI regs base address */ + +#define SH7751_PCICONF0 0x0/* PCI Config Reg 0 */ +#define SH7751_PCICONF0_DEVID 0xFFFF0000/* Device ID */ +#define SH7751_PCICONF0_VNDID 0x0000FFFF/* Vendor ID */ +#define SH7751_PCICONF1 0x4/* PCI Config Reg 1 */ +#define SH7751_PCICONF1_DPE 0x80000000/* Data Parity Error */ +#define SH7751_PCICONF1_SSE 0x40000000/* System Error Status */ +#define SH7751_PCICONF1_RMA 0x20000000/* Master Abort */ +#define SH7751_PCICONF1_RTA 0x10000000/* Target Abort Rx Status */ +#define SH7751_PCICONF1_STA 0x08000000/* Target Abort Exec Status */ +#define SH7751_PCICONF1_DEV 0x06000000/* Timing Status */ +#define SH7751_PCICONF1_DPD 0x01000000/* Data Parity Status */ +#define SH7751_PCICONF1_FBBC 0x00800000/* Back 2 Back Status */ +#define SH7751_PCICONF1_UDF 0x00400000/* User Defined Status */ +#define SH7751_PCICONF1_66M 0x00200000/* 66Mhz Operation Status */ +#define SH7751_PCICONF1_PM 0x00100000/* Power Management Status */ +#define SH7751_PCICONF1_PBBE 0x00000200/* Back 2 Back Control */ +#define SH7751_PCICONF1_SER 0x00000100/* SERR Output Control */ +#define SH7751_PCICONF1_WCC 0x00000080/* Wait Cycle Control */ +#define SH7751_PCICONF1_PER 0x00000040/* Parity Error Response */ +#define SH7751_PCICONF1_VPS 0x00000020/* VGA Pallet Snoop */ +#define SH7751_PCICONF1_MWIE 0x00000010/* Memory Write+Invalidate */ +#define SH7751_PCICONF1_SPC 0x00000008/* Special Cycle Control */ +#define SH7751_PCICONF1_BUM 0x00000004/* Bus Master Control */ +#define SH7751_PCICONF1_MES 0x00000002/* Memory Space Control */ +#define SH7751_PCICONF1_IOS 0x00000001/* I/O Space Control */ +#define SH7751_PCICONF2 0x8/* PCI Config Reg 2 */ +#define SH7751_PCICONF2_BCC 0xFF000000/* Base Class Code */ +#define SH7751_PCICONF2_SCC 0x00FF0000/* Sub-Class Code */ +#define SH7751_PCICONF2_RLPI 0x0000FF00/* Programming Interface */ +#define SH7751_PCICONF2_REV 0x000000FF/* Revision ID */ +#define SH7751_PCICONF3 0xC/* PCI Config Reg 3 */ +#define SH7751_PCICONF3_BIST7 0x80000000/* Bist Supported */ +#define SH7751_PCICONF3_BIST6 0x40000000/* Bist Executing */ +#define SH7751_PCICONF3_BIST3_0 0x0F000000/* Bist Passed */ +#define SH7751_PCICONF3_HD7 0x00800000/* Single Function device */ +#define SH7751_PCICONF3_HD6_0 0x007F0000/* Configuration Layout */ +#define SH7751_PCICONF3_LAT 0x0000FF00/* Latency Timer */ +#define SH7751_PCICONF3_CLS 0x000000FF/* Cache Line Size */ +#define SH7751_PCICONF4 0x10/* PCI Config Reg 4 */ +#define SH7751_PCICONF4_BASE 0xFFFFFFFC/* I/O Space Base Addr */ +#define SH7751_PCICONF4_ASI 0x00000001/* Address Space Type */ +#define SH7751_PCICONF5 0x14/* PCI Config Reg 5 */ +#define SH7751_PCICONF5_BASE 0xFFFFFFF0/* Mem Space Base Addr */ +#define SH7751_PCICONF5_LAP 0x00000008/* Prefetch Enabled */ +#define SH7751_PCICONF5_LAT 0x00000006/* Local Memory type */ +#define SH7751_PCICONF5_ASI 0x00000001/* Address Space Type */ +#define SH7751_PCICONF6 0x18/* PCI Config Reg 6 */ +#define SH7751_PCICONF6_BASE 0xFFFFFFF0/* Mem Space Base Addr */ +#define SH7751_PCICONF6_LAP 0x00000008/* Prefetch Enabled */ +#define SH7751_PCICONF6_LAT 0x00000006/* Local Memory type */ +#define SH7751_PCICONF6_ASI 0x00000001/* Address Space Type */ +/* PCICONF7 - PCICONF10 are undefined */ +#define SH7751_PCICONF11 0x2C/* PCI Config Reg 11 */ +#define SH7751_PCICONF11_SSID 0xFFFF0000/* Subsystem ID */ +#define SH7751_PCICONF11_SVID 0x0000FFFF/* Subsystem Vendor ID */ +/* PCICONF12 is undefined */ +#define SH7751_PCICONF13 0x34/* PCI Config Reg 13 */ +#define SH7751_PCICONF13_CPTR 0x000000FF/* PM function pointer */ +/* PCICONF14 is undefined */ +#define SH7751_PCICONF15 0x3C/* PCI Config Reg 15 */ +#define SH7751_PCICONF15_IPIN 0x000000FF/* Interrupt Pin */ +#define SH7751_PCICONF16 0x40/* PCI Config Reg 16 */ +#define SH7751_PCICONF16_PMES 0xF8000000/* PME Support */ +#define SH7751_PCICONF16_D2S 0x04000000/* D2 Support */ +#define SH7751_PCICONF16_D1S 0x02000000/* D1 Support */ +#define SH7751_PCICONF16_DSI 0x00200000/* Bit Device Init. */ +#define SH7751_PCICONF16_PMCK 0x00080000/* Clock for PME req. */ +#define SH7751_PCICONF16_VER 0x00070000/* PM Version */ +#define SH7751_PCICONF16_NIP 0x0000FF00/* Next Item Pointer */ +#define SH7751_PCICONF16_CID 0x000000FF/* Capability Identifier */ +#define SH7751_PCICONF17 0x44/* PCI Config Reg 17 */ +#define SH7751_PCICONF17_DATA 0xFF000000/* Data field for PM */ +#define SH7751_PCICONF17_PMES 0x00800000/* PME Status */ +#define SH7751_PCICONF17_DSCL 0x00600000/* Data Scaling Value */ +#define SH7751_PCICONF17_DSEL 0x001E0000/* Data Select */ +#define SH7751_PCICONF17_PMEN 0x00010000/* PME Enable */ +#define SH7751_PCICONF17_PWST 0x00000003/* Power State */ +/* SH7751 Internal PCI Registers */ + +/* Memory Control Registers */ +#define SH7751_BCR1 0x0000/* Memory BCR1 Register */ +#define SH7751_BCR2 0x0004/* Memory BCR2 Register */ +#define SH7751_BCR3 0x0050/* Memory BCR3 Register */ +#define SH7751_WCR1 0x0008/* Wait Control 1 Register */ +#define SH7751_WCR2 0x000C/* Wait Control 2 Register */ +#define SH7751_WCR3 0x0010/* Wait Control 3 Register */ +#define SH7751_MCR 0x0014/* Memory Control Register */ + +/* General Memory Config Addresses */ +#define SH7751_CS0_BASE_ADDR 0x0 +#define SH7751_MEM_REGION_SIZE 0x04000000 +#define SH7751_CS1_BASE_ADDR (SH7751_CS0_BASE_ADDR + SH7751_MEM_REGION_SIZE) +#define SH7751_CS2_BASE_ADDR (SH7751_CS1_BASE_ADDR + SH7751_MEM_REGION_SIZE) +#define SH7751_CS3_BASE_ADDR (SH7751_CS2_BASE_ADDR + SH7751_MEM_REGION_SIZE) +#define SH7751_CS4_BASE_ADDR (SH7751_CS3_BASE_ADDR + SH7751_MEM_REGION_SIZE) +#define SH7751_CS5_BASE_ADDR (SH7751_CS4_BASE_ADDR + SH7751_MEM_REGION_SIZE) +#define SH7751_CS6_BASE_ADDR (SH7751_CS5_BASE_ADDR + SH7751_MEM_REGION_SIZE) + +#endif /* _PCI_SH7751_H_ */
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 06/30] drivers/pci: SH7751 PCI Host bridge header.
Quoted 7 lines · Yoshinori Sato
This file move from SH specific directory "
arch/sh/drivers/pci/pci-sh7751.h"Signed-off-by Yoshinori Sato <[email protected]>--- drivers/pci/controller/pci-sh7751.h | 270 ++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 drivers/pci/controller/pci-sh7751.h
If this is a move from arch/sh/drivers/pci/, shouldn't this diff show both the removal and the addition? Or even better, if you use "git mv", won't it show the move directly, without a diff at all?
This file is only used in one place, so please just incorporate it directly into pci-sh7751.c. I think the git history would be a little cleaner if you did this as a separate patch before moving it to drivers/pci/.
If you're moving things into drivers/pci/, follow the subject line conventions (see "git log --oneline drivers/pci/controller/"):
- No period at end of subject line
- Subject line begins with "PCI: <driver-tag>: <Verb> ...", e.g.,
PCI: sh7751: Add SH7751 driver
Quoted 6 lines
drivers/pci/controller/pci-sh7751.h new file +0
-0
drivers/pci/controller/pci-sh7751.h line 9
Quoted 9 lines
drivers/pci/controller/pci-sh7751.h new file +9
-0@@ -0,0 +1,270 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Low-Level PCI Support for SH7751 targets +* +* Dustin McIntire ([email protected]) (c) 2001 +* Paul Mundt ([email protected]) (c) 2003 +* +* May be copied or modified under the terms of the GNU General Public +* License. See linux/COPYING for more information.
Unnecessary text, given the SPDX header above.
drivers/pci/controller/pci-sh7751.h line 10
Quoted 1 line
drivers/pci/controller/pci-sh7751.h new file +1
-0+*
Spurious blank line.
drivers/pci/controller/pci-sh7751.h line 160
Quoted 4 lines
drivers/pci/controller/pci-sh7751.h new file +4
-0+/* Platform Specific Values */ +#define SH7751_VENDOR_ID 0x1054 +#define SH7751_DEVICE_ID 0x3505 +#define SH7751R_DEVICE_ID 0x350e
Most of this file uses upper-case hex, so use it consistently.
Bjorn
Yoshinori Sato
maintainerRFC PATCH v2 7/30 drivers/pci: SH7751 PCI Host bridge controller driver.
In reply to Yoshinori Sato--- drivers/pci/controller/pci-sh7751.c | 338 ++++++++++++++++++++++++++++ 1 file changed, 338 insertions(+) create mode 100644 drivers/pci/controller/pci-sh7751.c
drivers/pci/controller/pci-sh7751.c new file +338 -0
@@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SH7751 PCI driver +* Copyright (C) 2023 Yoshinori Sato +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_pci.h> +#include <linux/of_platform.h> +#include <linux/pci-ecam.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <asm-generic/pci.h> +#include "pci-sh7751.h" + +#define pcic_writel (val, reg) __raw_writel(val, pci_reg_base + (reg)) +#define pcic_readl (reg) __raw_readl(pci_reg_base + (reg)) + +DEFINE_RAW_SPINLOCK (pci_config_lock); + +/* +* PCIC fixups +*/ + +#define PCIMCR_MRSET 0x40000000 +#define PCIMCR_RFSH 0x00000004 + +/* board depend PCI bus fixups */ +static void __init julian_fixup (void __iomem *pci_reg_base,void __iomem *bcr) +{ +unsigned long bcr1, mcr; + + bcr1 =__raw_readl (bcr +SH7751_BCR1 ); + bcr1 |=0x00080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + + mcr =__raw_readl (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static void __init r2d_fixup (void __iomem *pci_reg_base,void __iomem *bcr) +{ +unsigned long bcr1, mcr; + + bcr1 =ioread32 (bcr +SH7751_BCR1 ); + bcr1 |=0x40080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + +/* Enable all interrupts, so we known what to fix */ +pcic_writel (0x0000c3ff ,SH4_PCIINTM ); +pcic_writel (0x0000380f ,SH4_PCIAINTM ); + +pcic_writel (0xfb900047 ,SH7751_PCICONF1 ); +pcic_writel (0xab000001 ,SH7751_PCICONF4 ); + + mcr =ioread32 (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static const __initconst struct fixups { +char *compatible; +void (*fixup)(void __iomem *pci_reg_base,void __iomem *bcr); +} fixup_list[] = { + { + .compatible ="iodata,julian-pci" , + .fixup = julian_fixup, + }, + { + .compatible ="renesas,r2d-pci" , + .fixup = r2d_fixup, + }, +}; + +static void pcic_fixups (struct device_node *np, +void __iomem *pcic,void __iomem *bcr) +{ +int i; +const struct fixups *f = fixup_list; + +for (i =0 ; i <ARRAY_SIZE (fixup_list); i++) { +if (of_device_is_compatible (np, f->compatible)) { + f->fixup (pcic, bcr); +break ; + } + } +} + +/* +* Direct access to PCI hardware... +*/ +#define CONFIG_CMD (bus, devfn, where) \ + (0x80000000 | (bus->number << 16) | (devfn << 8) | (where & ~3)) + +/* +* 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 pci_config_window *cfg = bus->sysdata; +void __iomem *pci_reg_base = (void __iomem *)cfg->res.start; +unsigned long flags; +u32 data; + +/* +* 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); + +switch (size) { +case 1 : + *val = (data >> ((where &3 ) <<3 )) &0xff ; +break ; +case 2 : + *val = (data >> ((where &2 ) <<3 )) &0xffff ; +break ; +case 4 : + *val = data; +break ; +default : +return PCIBIOS_FUNC_NOT_SUPPORTED ; + } + +return PCIBIOS_SUCCESSFUL ; +} + +/* +* Since SH4 only does 32bit access we'll have to do a read, +* mask,write operation. +* We'll allow an odd byte offset, though it should be illegal. +*/ +static int sh4_pci_write (struct pci_bus *bus,unsigned int devfn, +int where,int size,u32 val) +{ +struct pci_config_window *cfg = bus->sysdata; +void __iomem *pci_reg_base = (void __iomem *)cfg->res.start; +unsigned long flags; +int shift; +u32 data; + +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); + +switch (size) { +case 1 : + shift = (where &3 ) <<3 ; + data &= ~(0xff << shift); + data |= ((val &0xff ) << shift); +break ; +case 2 : + shift = (where &2 ) <<3 ; + data &= ~(0xffff << shift); + data |= ((val &0xffff ) << shift); +break ; +case 4 : + data = val; +break ; +default : +return PCIBIOS_FUNC_NOT_SUPPORTED ; + } + +pcic_writel (data,SH4_PCIPDR ); + +return PCIBIOS_SUCCESSFUL ; +} + +static int area_sdram_check (void __iomem *pci_reg_base, +void __iomem *bcr, +unsigned int area) +{ +unsigned long word; + + word =__raw_readl (bcr +SH7751_BCR1 ); +/* check BCR for SDRAM in area */ +if (((word >> area) &1 ) ==0 ) { +pr_info ("PCI: Area %d is not configured for SDRAM. BCR1=0x%lx\n" , + area, word); +return 0 ; + } +pcic_writel (word,SH4_PCIBCR1 ); + + word =__raw_readw (bcr +SH7751_BCR2 ); +/* check BCR2 for 32bit SDRAM interface*/ +if (((word >> (area <<1 )) &0x3 ) !=0x3 ) { +pr_info ("PCI: Area %d is not 32 bit SDRAM. BCR2=0x%lx\n" , + area, word); +return 0 ; + } +pcic_writel (word,SH4_PCIBCR2 ); + +return 1 ; +} + +static int sh7751_pci_probe (struct platform_device *pdev) +{ +struct resource *res, *wres; +u32 id; +u32 reg, word; +void __iomem *pci_reg_base; +void __iomem *bcr; + + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); + pci_reg_base = (void __iomem *)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 (pci_reg_base)) +return PTR_ERR (bcr); + +/* check for SH7751/SH7751R hardware */ + id =pcic_readl (SH7751_PCICONF0 ); +if (id != ((SH7751_DEVICE_ID <<16 ) |SH7751_VENDOR_ID ) && + id != ((SH7751R_DEVICE_ID <<16 ) |SH7751_VENDOR_ID )) { +pr_warn ("PCI: This is not an SH7751(R)\n" ); +return -ENODEV ; + } +dev_info (&pdev->dev,"PCI core found at %p\n" , + pci_reg_base); + +/* Set the BCR's to enable PCI access */ + reg =__raw_readl (bcr); + reg |=0x80000 ; +__raw_writel (reg, bcr); + +/* Turn the clocks back on (not done in reset)*/ +pcic_writel (0 ,SH4_PCICLKR ); +/* Clear Powerdown IRQ's (not done in reset) */ + word =SH4_PCIPINT_D3 |SH4_PCIPINT_D0 ; +pcic_writel (word,SH4_PCIPINT ); + +/* set the command/status bits to: +* Wait Cycle Control + Parity Enable + Bus Master + +* Mem space enable +*/ + word =SH7751_PCICONF1_WCC |SH7751_PCICONF1_PER | +SH7751_PCICONF1_BUM |SH7751_PCICONF1_MES ; +pcic_writel (word,SH7751_PCICONF1 ); + +/* define this host as the host bridge */ + word =PCI_BASE_CLASS_BRIDGE <<24 ; +pcic_writel (word,SH7751_PCICONF2 ); + +/* Set IO and Mem windows to local address +* Make PCI and local address the same for easy 1 to 1 mapping +*/ + word = wres->end - wres->start -1 ; +pcic_writel (word,SH4_PCILSR0 ); +/* Set the values on window 0 PCI config registers */ + word =P2SEGADDR (wres->start); +pcic_writel (word,SH4_PCILAR0 ); +pcic_writel (word,SH7751_PCICONF5 ); + +/* check BCR for SDRAM in specified area */ +area_sdram_check (pci_reg_base, bcr, (wres->start >>27 ) &0x07 ); + +/* configure the wait control registers */ + word =__raw_readl (bcr +SH7751_WCR1 ); +pcic_writel (word,SH4_PCIWCR1 ); + word =__raw_readl (bcr +SH7751_WCR2 ); +pcic_writel (word,SH4_PCIWCR2 ); + word =__raw_readl (bcr +SH7751_WCR3 ); +pcic_writel (word,SH4_PCIWCR3 ); + word =__raw_readl (bcr +SH7751_MCR ); +pcic_writel (word,SH4_PCIMCR ); + +pcic_fixups (pdev->dev.of_node, pci_reg_base, bcr); + +/* SH7751 init done, set central function init complete */ +/* use round robin mode to stop a device starving/overruning */ + word =SH4_PCICR_PREFIX |SH4_PCICR_CFIN |SH4_PCICR_ARBM ; +pcic_writel (word,SH4_PCICR ); + +return pci_host_common_probe (pdev); +} + +static void __iomem *sh4_pci_map_bus (struct pci_bus *bus, +unsigned int devfn,int where) +{ +struct pci_config_window *cfg = bus->sysdata; +void __iomem *pci_reg_base = (void __iomem *)cfg->res.start; + +pcic_writel (CONFIG_CMD (bus, devfn, where),SH4_PCIPAR ); +return pci_reg_base +SH4_PCIPDR ; +} + +static const struct pci_ecam_ops pci_sh7751_bus_ops = { + .pci_ops = { + .map_bus = sh4_pci_map_bus, + .read = sh4_pci_read, + .write = sh4_pci_write, + } +}; + +static const struct of_device_id sh7751_pci_of_match[] = { + { .compatible ="renesas,sh7751-pci" , + .data = &pci_sh7751_bus_ops }, + + { }, +}; +MODULE_DEVICE_TABLE (of, sh7751_pci_of_match); + +static struct platform_driver sh7751_pci_driver = { + .driver = { + .name ="sh7751-pci" , + .of_match_table = sh7751_pci_of_match, + }, + .probe = sh7751_pci_probe, +}; +module_platform_driver (sh7751_pci_driver); + +MODULE_DESCRIPTION ("SH7751 PCI driver" );
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 07/30] drivers/pci: SH7751 PCI Host bridge controller driver.
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 25 lines
drivers/pci/controller/pci-sh7751.c new file +22
-0@@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SH7751 PCI driver +* Copyright (C) 2023 Yoshinori Sato +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_pci.h> +#include <linux/of_platform.h> +#include <linux/pci-ecam.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <asm-generic/pci.h> +#include "pci-sh7751.h" + +#define pcic_writel (val, reg) __raw_writel(val, pci_reg_base + (reg)) +#define pcic_readl (reg) __raw_readl(pci_reg_base + (reg)) + +DEFINE_RAW_SPINLOCK (pci_config_lock);
drivers/pci/controller/pci-sh7751.c line 32
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+ +/* +* PCIC fixups +*/ + +#define PCIMCR_MRSET 0x40000000 +#define PCIMCR_RFSH 0x00000004 + +/* board depend PCI bus fixups */ +static void __init julian_fixup (void __iomem *pci_reg_base,void __iomem *bcr)
Please drop all the __init* annotations.
Although I no longer see invalid section warnings, all symbols tagged with __init* are still referenced from sh7751_pci_probe(), eventually.
Quoted 45 lines
drivers/pci/controller/pci-sh7751.c new file +45
-0+{ +unsigned long bcr1, mcr; + + bcr1 =__raw_readl (bcr +SH7751_BCR1 ); + bcr1 |=0x00080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + + mcr =__raw_readl (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static void __init r2d_fixup (void __iomem *pci_reg_base,void __iomem *bcr) +{ +unsigned long bcr1, mcr; + + bcr1 =ioread32 (bcr +SH7751_BCR1 ); + bcr1 |=0x40080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + +/* Enable all interrupts, so we known what to fix */ +pcic_writel (0x0000c3ff ,SH4_PCIINTM ); +pcic_writel (0x0000380f ,SH4_PCIAINTM ); + +pcic_writel (0xfb900047 ,SH7751_PCICONF1 ); +pcic_writel (0xab000001 ,SH7751_PCICONF4 ); + + mcr =ioread32 (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static const __initconst struct fixups { + char *compatible; + void (*fixup)(void __iomem *pci_reg_base, void __iomem *bcr);
drivers/pci/controller/pci-sh7751.c line 87
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+} fixup_list[] = { + { + .compatible = "iodata,julian-pci", + .fixup = julian_fixup, + }, + { + .compatible = "renesas,r2d-pci", + .fixup = r2d_fixup, + }, +};
These fixups seem to be board-specific instead of specific to the PCI block in the SoCs on these boards.
I see three options to handle this in a more appropriate way:
1. Handle this in the bootloader.
Not an attractive solution, as not everyone can/wants to update the bootloader,
2. Use of_machine_is_compatible() in a platform-specific quirk handler, outside the PCI driver,
3. Move the common parts into sh7751_pci_probe(), and the handle the differences through DT topology analysis and/or properties in DT.
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
Yoshinori Sato
maintainerRe: [RFC PATCH v2 07/30] drivers/pci: SH7751 PCI Host bridge controller driver.
Quoted 108 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
Quoted 25 lines
drivers/pci/controller/pci-sh7751.c new file +22
-0@@ -0,0 +1,338 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SH7751 PCI driver +* Copyright (C) 2023 Yoshinori Sato +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/of_address.h> +#include <linux/of_pci.h> +#include <linux/of_platform.h> +#include <linux/pci-ecam.h> +#include <linux/platform_device.h> +#include <linux/io.h> +#include <asm-generic/pci.h> +#include "pci-sh7751.h" + +#define pcic_writel (val, reg) __raw_writel(val, pci_reg_base + (reg)) +#define pcic_readl (reg) __raw_readl(pci_reg_base + (reg)) + +DEFINE_RAW_SPINLOCK (pci_config_lock);drivers/pci/controller/pci-sh7751.c line 32
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+ +/* +* PCIC fixups +*/ + +#define PCIMCR_MRSET 0x40000000 +#define PCIMCR_RFSH 0x00000004 + +/* board depend PCI bus fixups */ +static void __init julian_fixup (void __iomem *pci_reg_base,void __iomem *bcr)Please drop all the __init* annotations.
Although I no longer see invalid section warnings, all symbols tagged with __init* are still referenced fromsh7751_pci_probe(), eventually.Quoted 45 lines
drivers/pci/controller/pci-sh7751.c new file +45
-0+{ +unsigned long bcr1, mcr; + + bcr1 =__raw_readl (bcr +SH7751_BCR1 ); + bcr1 |=0x00080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + + mcr =__raw_readl (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static void __init r2d_fixup (void __iomem *pci_reg_base,void __iomem *bcr) +{ +unsigned long bcr1, mcr; + + bcr1 =ioread32 (bcr +SH7751_BCR1 ); + bcr1 |=0x40080000 ;/* Enable Bit 19 BREQEN, set PCIC to slave */ +pcic_writel (bcr1,SH4_PCIBCR1 ); + +/* Enable all interrupts, so we known what to fix */ +pcic_writel (0x0000c3ff ,SH4_PCIINTM ); +pcic_writel (0x0000380f ,SH4_PCIAINTM ); + +pcic_writel (0xfb900047 ,SH7751_PCICONF1 ); +pcic_writel (0xab000001 ,SH7751_PCICONF4 ); + + mcr =ioread32 (bcr +SH7751_MCR ); + mcr &= (~PCIMCR_MRSET ) & (~PCIMCR_RFSH ); +pcic_writel (mcr,SH4_PCIMCR ); + +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static const __initconst struct fixups { + char *compatible; + void (*fixup)(void __iomem *pci_reg_base, void __iomem *bcr);drivers/pci/controller/pci-sh7751.c line 87
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+} fixup_list[] = { + { + .compatible = "iodata,julian-pci", + .fixup = julian_fixup, + }, + { + .compatible = "renesas,r2d-pci", + .fixup = r2d_fixup, + }, +};These fixups seem to be board-specific instead of specific to the PCI block in the SoCs on these boards.
Quoted 9 lines
I see three options to handle this in a more appropriate way:
1. Handle this in the bootloader.
Not an attractive solution, as not everyone can/wants to update the bootloader,
2. Useof_machine_is_compatible()in a platform-specific quirk handler, outside the PCI driver,
3. Move the common parts intosh7751_pci_probe(), and the handle the differences through DT topology analysis and/or properties in DT.
I think the bootloader is not initialized on targets that do not use a PCI device for booting.
I think it's better to use option 2 or 3.
I looked at the current fixup, but the only difference is the PCIC setting, so I will try plan 3.
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
Re: [RFC PATCH v2 07/30] drivers/pci: SH7751 PCI Host bridge controller driver.
In reply to Yoshinori SatoOn Wed, Sep 13, 2023 at 06:23:32PM +0900, Yoshinori Sato wrote:
See subject line comments at
https://lore.kernel.org/r/20230918191602.GA201859@bhelgaas
Please add a commit log. Repeating the subject line is fine, but there's a little more detail that could be included here, e.g., a hint about what platforms this is useful for.
Quoted 3 lines
+ * SH7751 PCI driver
+ * Copyright (C) 2023 Yoshinori Sato
+ *
Spurious blank line.
drivers/pci/controller/pci-sh7751.c line 20
Quoted 2 lines
drivers/pci/controller/pci-sh7751.c new file +2
-0+#define pcic_writel (val, reg) __raw_writel(val, pci_reg_base + (reg)) +#define pcic_readl (reg) __raw_readl(pci_reg_base + (reg))
Best to include a pointer to a struct in the macro arguments so this doesn't depend on local variable names in the users. See advk_readl() and advk_writel(), for example.
Quoted 1 line
+DEFINE_RAW_SPINLOCK(pci_config_lock);
Should be static.
drivers/pci/controller/pci-sh7751.c line 47
Quoted 4 lines
drivers/pci/controller/pci-sh7751.c new file +4
-0+pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 );
The header file uses upper-case hex, but this file looks like mostly lower-case. Maybe make them consistent?
Quoted 2 lines
+ * Since SH4 only does 32bit access we'll have to do a read,
+ * mask,write operation.
This RMW corrupts some registers; see comments and warning in pci_generic_config_write32(). A comment here is probably enough.
Quoted 5 lines
+ * We'll allow an odd byte offset, though it should be illegal.
+ */drivers/pci/controller/pci-sh7751.c new file +2
-0+static int sh4_pci_write (struct pci_bus *bus,unsigned int devfn, +int where,int size,u32 val)
drivers/pci/controller/pci-sh7751.c line 197
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+static int area_sdram_check (void __iomem *pci_reg_base, +void __iomem *bcr, +unsigned int area) +{ +unsigned long word; + + word =__raw_readl (bcr +SH7751_BCR1 ); +/* check BCR for SDRAM in area */ +if (((word >> area) &1 ) ==0 ) { + pr_info("PCI: Area %d is not configured for SDRAM. BCR1=0x%lx\n",
Use dev_info(). Will require passing a controller struct around, which is common style in drivers/pci/controller/.
drivers/pci/controller/pci-sh7751.c line 245
Quoted 2 lines
drivers/pci/controller/pci-sh7751.c new file +2
-0+dev_info (&pdev->dev,"PCI core found at %p\n" , + pci_reg_base);
Use %pR.
drivers/pci/controller/pci-sh7751.c line 296
Quoted 1 line
drivers/pci/controller/pci-sh7751.c new file +1
-0+/* use round robin mode to stop a device starving/overruning */
overrunning
Bjorn
Yoshinori Sato
maintainerRFC PATCH v2 8/30 drivers/pci: Add SH7751 Host bridge controller
In reply to Yoshinori Sato--- drivers/pci/controller/Kconfig | 9 +++++++++ drivers/pci/controller/Makefile | 1 + 2 files changed, 10 insertions(+)
drivers/pci/controller/Kconfig +9 -0
@@ -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
@@ -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/
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 08/30] drivers/pci: Add SH7751 Host bridge controller
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 3 lines
--- drivers/pci/controller/Kconfig | 9 +++++++++ drivers/pci/controller/Makefile | 1 +
Please combine this with "[RFC PATCH v2 07/30] drivers/pci: SH7751 PCI Host bridge controller driver.".
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
Re: [RFC PATCH v2 08/30] drivers/pci: Add SH7751 Host bridge controller
In reply to Yoshinori SatoOn Wed, Sep 13, 2023 at 06:23:33PM +0900, Yoshinori Sato wrote:
Update subject line and include a commit log.
Quoted 12 lines
Signed-off-by Yoshinori Sato <[email protected]>--- drivers/pci/controller/Kconfig | 9 +++++++++ drivers/pci/controller/Makefile | 1 + 2 files changed, 10 insertions(+)drivers/pci/controller/Kconfig +0
-0@@ -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
-0Xilinx 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.
Sort this so it appears in alpha order by vendor, device in menuconfig, etc.
Since I didn't get the entire series, here are the whitespace errors from git-am:
Applying: arch/sh: head_32.S passing FDT address to initialize function. .git/rebase-apply/patch:25: trailing whitespace.
Applying: Documentation/devicetree: Add renesas,sh7751-cpg binding document. .git/rebase-apply/patch:66: space before tab in indent.
clocks = <&xtal>;
Applying: drivers/irqchip: SH7751 IRL external encoder with enable gate. .git/rebase-apply/patch:33: new blank line at EOF.
Re: [RFC PATCH v2 08/30] drivers/pci: Add SH7751 Host bridge controller
In reply to Yoshinori SatoHi Sato-san,
Quoted 7 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>drivers/pci/controller/Kconfig +0
-0@@ -342,6 +342,15 @@ config PCIE_XILINX_CPM Say 'Y' here if you want kernel support for the Xilinx Versal CPM host bridge.
drivers/pci/controller/Kconfig config PCIE_XILINX_CPM · line 353
Quoted 10 lines
drivers/pci/controller/Kconfig +9
-0+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. +
When compile-testing:
drivers/pci/controller/pci-sh7751.c: In function ‘sh7751_pci_probe’:
drivers/pci/controller/pci-sh7751.c:276:16: error: implicit
declaration of function ‘P2SEGADDR’ [-Werror=implicit-function-declaration]
276 | word = P2SEGADDR(wres->start);
| ^~~~~~~~~P2SEGADDR() depends on the SH-specific CONFIG_29BIT.
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
Yoshinori Sato
maintainerRFC PATCH v2 9/30 Documentation/devicetree: Add renesas,sh7751-pci binding document.
In reply to Yoshinori Sato--- .../bindings/pci/renesas,sh7751-pci.yaml | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +57 -0
@@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/renesas,sh7751-pci.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7751 PCI Host controller + +maintainers: + - Yoshinori Sato <[email protected]> + +properties: + compatible: + - items: + - enum: + - renesas,r2d-pci # Renesas RTS7751R2D board + - iodata,julian-pci # IO DATA DEVICE Julian board + - const: renesas,sh7751-pci + + reg: + minItems: 3 + + interrupt-cells: + const: 1 + + address-cells: + const: 3 + + size-cells: + const: 2; + + range: + description: | + The PCI bus memory area and I/O area. + + +required: + - compatible + - reg + - interrupt-cells + - address-cells + - size-cells + - range + +examples: + - | + pci@fe200000 { + compatible = "renesas,sh7751-pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>, + <0x01000000 0 0xfe240000 0xfe240000 0 0x00040000>; + reg = <0xfe200000 0x0400>, + <0x0c000000 0x04000000>, + <0xff800000 0x0030>; + #interrupt-cells = <1>; + };
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 09/30] Documentation/devicetree: Add renesas,sh7751-pci binding document.
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
You did not resolve several comments from previous version. I don't understand why, so I just assume this is not ready for review. Just quick look tells this wasn't tested and has multiple issues. Maybe that was the intention, but nothing is described in commit log confirming such intention.
Therefore to be clear: that's a NAK.
Also, standard template:
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
Re: [RFC PATCH v2 09/30] Documentation/devicetree: Add renesas,sh7751-pci binding document.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 7 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +4
-0@@ -0,0 +1,57 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/pci/renesas,sh7751-pci.yaml#
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 14
Quoted 10 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +10
-0+$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7751 PCI Host controller + +maintainers: + - Yoshinori Sato <[email protected]> + +properties: + compatible: + - items:
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml:
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml:14:7:
[warning] wrong indentation: expected 4 but found 6 (indentation)
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 16
Quoted 2 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +2
-0+ - enum: + - renesas,r2d-pci # Renesas RTS7751R2D board
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml:16:32:
[error] syntax error: found character '\t' that cannot start any token (syntax)
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 17
Quoted 1 line
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +1
-0+ - iodata,julian-pci # IO DATA DEVICE Julian board
Please drop the two board-specific compatible values, they do not represent different implementations of the PCI core in the SH7751 SoC.
Quoted 20 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +20
-0+ - const: renesas,sh7751-pci + + reg: + minItems: 3 + + interrupt-cells: + const: 1 + + address-cells: + const: 3 + + size-cells: + const: 2; + + range: + description: | + The PCI bus memory area and I/O area. + + +required:
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 47
Quoted 10 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +10
-0+ - compatible + - reg + - interrupt-cells + - address-cells + - size-cells + - range + +examples: + - | + pci@fe200000 {
Please align "pci" with the "|" above
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 48
Quoted 1 line
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +1
-0+ compatible = "renesas,sh7751-pci";
Please indent by 4 spaces
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 56
Quoted 8 lines
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +8
-0+ #address-cells = <3>; + #size-cells = <2>; + ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>, + <0x01000000 0 0xfe240000 0xfe240000 0 0x00040000>; + reg = <0xfe200000 0x0400>, + <0x0c000000 0x04000000>, + <0xff800000 0x0030>; + #interrupt-cells = <1>;
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.example.dtb:
pci@fe200000: 'device_type' is a required property
from schema $id: http://devicetree.org/schemas/pci/pci-bus.yaml#
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml line 57
Quoted 1 line
Documentation/devicetree/bindings/pci/renesas,sh7751-pci.yaml new file +1
-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
Yoshinori Sato
maintainerRFC PATCH v2 10/30 drivers/clk: SH7750 / SH7751 CPG Driver
In reply to Yoshinori Sato--- drivers/clk/renesas/clk-sh7750.c | 236 +++++++++++++++++++++++++++++++ 1 file changed, 236 insertions(+) create mode 100644 drivers/clk/renesas/clk-sh7750.c
drivers/clk/renesas/clk-sh7750.c new file +236 -0
@@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Renesas SH7750/51 CPG driver +* +* Copyright 2023 Yoshinori Sato <[email protected]> +*/ + +#include <linux/clkdev.h> +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/io.h> +#include "clk-shdiv.h" +#include <dt-bindings/clock/sh7750.h> + +static DEFINE_SPINLOCK (clklock); + +/* PCLK divide rate selector */ +static const struct clk_div_table pdiv_table[] = { + { .val =0 , .div =2 , }, + { .val =1 , .div =3 , }, + { .val =2 , .div =4 , }, + { .val =3 , .div =6 , }, + { .val =4 , .div =8 , }, + { } +}; + +/* ICLK and BCLK divide rate selector */ +static const struct clk_div_table div_table[] = { + { .val =0 , .div =1 , }, + { .val =1 , .div =2 , }, + { .val =2 , .div =3 , }, + { .val =3 , .div =4 , }, + { .val =4 , .div =6 , }, + { .val =5 , .div =8 , }, + { } +}; + +struct cpg_priv { +struct clk_hw hw; +void __iomem *frqcr; +void __iomem *wdt; +u32 mode; +bool have_div1; +}; + +#define to_priv (_hw) container_of(_hw, struct cpg_priv, hw) + +#define FRQCR_PLL1EN BIT(10) +static const int pll1mult[] = {12 ,12 ,6 ,12 ,6 ,12 ,1 }; + +static unsigned long pll_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct cpg_priv *cpg =to_priv (hw); +unsigned long rate = parent_rate; +uint16_t frqcr; + + frqcr =ioread16 (cpg->frqcr); +if (frqcr &FRQCR_PLL1EN ) { + rate *= pll1mult[cpg->mode]; +if (cpg->mode <6 && cpg->have_div1) + rate /=2 ; + } +return rate; +} + +static void get_round_rate (struct cpg_priv *cpg, +unsigned long *out,bool *pllen, +unsigned long rate,unsigned long prate) +{ +long pllout, res; +bool pll; + +if (cpg->mode <6 && cpg->have_div1) + prate /=2 ; + + pllout = prate * pll1mult[cpg->mode]; +if (abs (pllout - rate) >abs (prate - rate)) { + res = prate; + pll = false; + }else { + res = pllout; + pll = true; + } +if (out) + *out = res; +if (pllen) + *pllen = pll; +} + +static int pll_determine_rate (struct clk_hw *hw,struct clk_rate_request *req) +{ +struct cpg_priv *cpg =to_priv (hw); + +get_round_rate (cpg, &req->rate,NULL , req->rate, req->best_parent_rate); +return 0 ; +} + +static int pll_set_rate (struct clk_hw *hw, +unsigned long rate,unsigned long prate) +{ +struct cpg_priv *cpg =to_priv (hw); +bool oldpll, newpll; +uint16_t frqcr; + + frqcr =ioread16 (cpg->frqcr); +get_round_rate (cpg,NULL , &newpll, rate, prate); + oldpll = frqcr &FRQCR_PLL1EN ; + frqcr &= ~FRQCR_PLL1EN ; + +if (newpll) { + frqcr |=FRQCR_PLL1EN ; +if (!oldpll) { +/* set PLL wakeup delay time */ +iowrite16 (0xa500 , cpg->wdt +4 ); +iowrite16 (0xa507 , cpg->wdt +4 ); +iowrite16 (0xa507 , cpg->wdt +4 ); +iowrite16 (0x5a00 , cpg->wdt); + } + } +iowrite16 (frqcr, cpg->frqcr); + +/* Test for new PLL state */ + frqcr =ioread16 (cpg->frqcr); + oldpll = frqcr &FRQCR_PLL1EN ; +return !(oldpll == newpll); +} + +static const struct clk_ops pll_ops = { + .recalc_rate = pll_recalc_rate, + .determine_rate = pll_determine_rate, + .set_rate = pll_set_rate, +}; + +#define PLLOUT "pllout" + +static int __init register_pll (struct device_node *node,struct cpg_priv *cpg) +{ +struct clk *clk; +const char *clk_name = node->name; +const char *parent_name; +struct clk_init_data init; + + parent_name =of_clk_get_parent_name (node,0 ); + init.name =PLLOUT ; + init.ops = &pll_ops; + init.flags =0 ; + init.parent_names = &parent_name; + init.num_parents =1 ; + cpg->hw.init = &init; + +if (of_clk_hw_register (node, &cpg->hw) <0 ) { +pr_err ("%s: failed to register %s pll clock (%ld)\n" , + __func__, clk_name,PTR_ERR (clk)); +return 0 ; + } +of_clk_add_hw_provider (node, of_clk_hw_simple_get, &cpg->hw); + +return 1 ; +} + +static void __init register_div (struct device_node *node,struct cpg_priv *cpg) +{ +static const char *const divout[] = { + [SH7750_CPG_FCK ] ="fck" , + [SH7750_CPG_BCK ] ="bck" , + [SH7750_CPG_ICK ] ="ick" , + }; +struct clk *clk; +int i; + +for (i =0 ; i <ARRAY_SIZE (divout); i++) { +if (sh_div_clk_register (node, divout[i],PLLOUT , + cpg->frqcr, i *3 ,3 , + (i ==0 ) ? pdiv_table : div_table, + &clklock) <0 ) +pr_err ("%s: failed to register %s div clock (%ld)\n" , + __func__, divout[i],PTR_ERR (clk)); + } +} + + +static void __init sh7750_cpg_setup (struct device_node *node) +{ +unsigned int num_parents; +struct cpg_priv *cpg; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , node->name); +return ; + } + + cpg =kzalloc (sizeof (struct cpg_priv ),GFP_KERNEL ); +if (!cpg) { +pr_err ("%s: failed to alloc memory" , node->name); +return ; + } + +of_property_read_u32_index (node,"renesas,mode" ,0 , &cpg->mode); +if (cpg->mode >=7 ) { +pr_err ("%s: Invalid clock mode setting (%u)\n" , + node->name, cpg->mode); + goto cpg_free; + } + cpg->have_div1 = (of_device_is_compatible (node,"renesas,sh7750r-pll-clk" ) ==0 ); + + cpg->frqcr =of_iomap (node,0 ); +if (cpg->frqcr ==NULL ) { +pr_err ("%s: failed to map divide register" , node->name); + goto cpg_free; + } + + cpg->wdt =of_iomap (node,1 ); +if (cpg->wdt ==NULL ) { +pr_err ("%s: failed to map watchdog register" , node->name); + goto unmap_frqcr; + } + +if (!register_pll (node, cpg)) + goto unmap_wdt; + +register_div (node, cpg); + +unmap_wdt: +iounmap (cpg->wdt); +unmap_frqcr: +iounmap (cpg->frqcr); +cpg_free: +kfree (cpg); +} + +CLK_OF_DECLARE (sh7750_cpg,"renesas,sh7750-cpg" , + sh7750_cpg_setup);
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 10/30] drivers/clk: SH7750 / SH7751 CPG Driver
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
1. Commit msg did not improve.
2. 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. There is no "drivers" (except few subsystems, but not this one).
Best regards,
Krzysztof
Re: [RFC PATCH v2 10/30] drivers/clk: SH7750 / SH7751 CPG Driver
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 1 line
drivers/clk/renesas/clk-sh7750.c | 236 +++++++++++++++++++++++++++++++
Patch prefix should be "clk: renesas: ".
Quoted 6 lines
drivers/clk/renesas/clk-sh7750.c new file +3
-0@@ -0,0 +1,236 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Renesas SH7750/51 CPG driver
drivers/clk/renesas/clk-sh7750.c line 13
Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10
-0+* +* Copyright 2023 Yoshinori Sato <[email protected]> +*/ + +#include <linux/clkdev.h> +#include <linux/clk-provider.h> +#include <linux/err.h> +#include <linux/of.h> +#include <linux/of_address.h> +#include <linux/io.h>
Please add a blank line.
drivers/clk/renesas/clk-sh7750.c line 14
Quoted 1 line
drivers/clk/renesas/clk-sh7750.c new file +1
-0+#include "clk-shdiv.h"
This doesn't exist until "[RFC PATCH v2 11/30] drivers/clk: SuperH generai clock divider helper", so please move that patch up in the series.
drivers/clk/renesas/clk-sh7750.c line 15
Quoted 1 line
drivers/clk/renesas/clk-sh7750.c new file +1
-0+#include <dt-bindings/clock/sh7750.h>
This doesn't exist until "[RFC PATCH v2 24/30] include/dt-bindings:
Add SH7750 CPG header.", so please move that patch up in the series.
drivers/clk/renesas/clk-sh7750.c line 17
Quoted 2 lines
drivers/clk/renesas/clk-sh7750.c new file +2
-0+ +static DEFINE_SPINLOCK (clklock);
I think it would make sense to move this into struct cpg_priv.
drivers/clk/renesas/clk-sh7750.c line 51
Quoted 12 lines
drivers/clk/renesas/clk-sh7750.c new file +12
-0+struct cpg_priv { +struct clk_hw hw; +void __iomem *frqcr; +void __iomem *wdt; +u32 mode; +bool have_div1; +}; + +#define to_priv (_hw) container_of(_hw, struct cpg_priv, hw) + +#define FRQCR_PLL1EN BIT(10) +static const int pll1mult[] = {12 ,12 ,6 ,12 ,6 ,12 ,1 };
unsigned int
drivers/clk/renesas/clk-sh7750.c line 58
Quoted 7 lines
drivers/clk/renesas/clk-sh7750.c new file +7
-0+ +static unsigned long pll_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct cpg_priv *cpg =to_priv (hw); +unsigned long rate = parent_rate; +uint16_t frqcr;
u16
Please don't mix uint<n>_t and u<n> in the same driver.
Quoted 4 lines
drivers/clk/renesas/clk-sh7750.c new file +4
-0+static int pll_determine_rate (struct clk_hw *hw,struct clk_rate_request *req) +{ +struct cpg_priv *cpg =to_priv (hw); +
drivers/clk/renesas/clk-sh7750.c line 106
Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10
-0+get_round_rate (cpg, &req->rate,NULL , req->rate, req->best_parent_rate); +return 0 ; +} + +static int pll_set_rate (struct clk_hw *hw, +unsigned long rate,unsigned long prate) +{ +struct cpg_priv *cpg =to_priv (hw); +bool oldpll, newpll; +uint16_t frqcr;
u16
drivers/clk/renesas/clk-sh7750.c line 172
Quoted 9 lines
drivers/clk/renesas/clk-sh7750.c new file +9
-0+static void __init register_div (struct device_node *node,struct cpg_priv *cpg) +{ +static const char *const divout[] = { + [SH7750_CPG_FCK ] ="fck" , + [SH7750_CPG_BCK ] ="bck" , + [SH7750_CPG_ICK ] ="ick" , + }; +struct clk *clk; +int i;
unsigned int
Quoted 26 lines
drivers/clk/renesas/clk-sh7750.c new file +26
-0+ +for (i =0 ; i <ARRAY_SIZE (divout); i++) { +if (sh_div_clk_register (node, divout[i],PLLOUT , + cpg->frqcr, i *3 ,3 , + (i ==0 ) ? pdiv_table : div_table, + &clklock) <0 ) +pr_err ("%s: failed to register %s div clock (%ld)\n" , + __func__, divout[i],PTR_ERR (clk)); + } +} + + +static void __init sh7750_cpg_setup (struct device_node *node) +{ +unsigned int num_parents; +struct cpg_priv *cpg; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , node->name); +return ; + } + + cpg =kzalloc (sizeof (struct cpg_priv ),GFP_KERNEL ); +if (!cpg) { +pr_err ("%s: failed to alloc memory" , node->name);
drivers/clk/renesas/clk-sh7750.c line 208
Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10
-0+return ; + } + +of_property_read_u32_index (node,"renesas,mode" ,0 , &cpg->mode); +if (cpg->mode >=7 ) { +pr_err ("%s: Invalid clock mode setting (%u)\n" , + node->name, cpg->mode); + goto cpg_free; + } + cpg->have_div1 = (of_device_is_compatible (node,"renesas,sh7750r-pll-clk" ) ==0 );
What is this for? There are no users of "renesas,sh7750r-pll-clk".
Quoted 18 lines
drivers/clk/renesas/clk-sh7750.c new file +18
-0+ + cpg->frqcr =of_iomap (node,0 ); +if (cpg->frqcr ==NULL ) { +pr_err ("%s: failed to map divide register" , node->name); + goto cpg_free; + } + + cpg->wdt =of_iomap (node,1 ); +if (cpg->wdt ==NULL ) { +pr_err ("%s: failed to map watchdog register" , node->name); + goto unmap_frqcr; + } + +if (!register_pll (node, cpg)) + goto unmap_wdt; + +register_div (node, cpg); +
drivers/clk/renesas/clk-sh7750.c line 236
Quoted 10 lines
drivers/clk/renesas/clk-sh7750.c new file +10
-0+unmap_wdt: +iounmap (cpg->wdt); +unmap_frqcr: +iounmap (cpg->frqcr); +cpg_free: +kfree (cpg); +} + +CLK_OF_DECLARE (sh7750_cpg,"renesas,sh7750-cpg" , + sh7750_cpg_setup);
Probably you want a second entry for "renesas,sh7751-cpg"?
Is there a good reason to use CLK_OF_DECLARE()?
Perhaps because you need it early for the timer?
Most modern clock drivers use a platform_driver, registered from e.g. subsys_initcall(). When you need an early initialization phase, you can use CLK_OF_DECLARE_DRIVER() for the early part.
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
Yoshinori Sato
maintainerRFC PATCH v2 11/30 drivers/clk: SuperH generai clock divider helper
In reply to Yoshinori Sato--- drivers/clk/renesas/clk-shdiv.c | 346 ++++++++++++++++++++++++++++++++ drivers/clk/renesas/clk-shdiv.h | 18 ++ 2 files changed, 364 insertions(+) create mode 100644 drivers/clk/renesas/clk-shdiv.c create mode 100644 drivers/clk/renesas/clk-shdiv.h
drivers/clk/renesas/clk-shdiv.c new file +346 -0
@@ -0,0 +1,346 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SuperH divider clock driver +*/ + +#include <linux/clkdev.h> +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/io.h> +#include <linux/err.h> +#include <linux/string.h> +#include "clk-shdiv.h" + +#define div_mask (width) ((1 << (width)) - 1) + +static unsigned int _get_table_maxdiv (const struct clk_div_table *table, +u8 width) +{ +unsigned int maxdiv =0 , mask =div_mask (width); +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div > maxdiv && clkt->val <= mask) + maxdiv = clkt->div; +return maxdiv; +} + +static unsigned int _get_maxdiv (const struct clk_div_table *table,u8 width) +{ +if (table) +return _get_table_maxdiv (table, width); +return div_mask (width) +1 ; +} + +static unsigned int _get_table_div (const struct clk_div_table *table, +unsigned int val) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->val == val) +return clkt->div; +return 0 ; +} + +static unsigned int _get_div (const struct clk_div_table *table, +unsigned int val,u8 width) +{ +if (table) +return _get_table_div (table, val); +return val +1 ; +} + +static unsigned int _get_table_val (const struct clk_div_table *table, +unsigned int div) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div == div) +return clkt->val; +return 0 ; +} + +static unsigned int _get_val (const struct clk_div_table *table, +unsigned int div,u8 width) +{ +if (table) +return _get_table_val (table, div); +return div -1 ; +} + +static unsigned long sh_divider_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate, +unsigned int val, +const struct clk_div_table *table) +{ +struct clk_divider *divider =to_clk_divider (hw); +unsigned int div; + + div =_get_div (table, val, divider->width); + +return DIV_ROUND_UP_ULL ((u64 )parent_rate, div); +} + +static unsigned long sh_clk_divider_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct clk_divider *divider =to_clk_divider (hw); +unsigned int val; + + val =__raw_readw (divider->reg) >> divider->shift; + val &=div_mask (divider->width); + +return sh_divider_recalc_rate (hw, parent_rate, val, divider->table); +} + +static bool _is_valid_table_div (const struct clk_div_table *table, +unsigned int div) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div == div) +return true; +return false; +} + +static bool _is_valid_div (const struct clk_div_table *table,unsigned int div) +{ +if (table) +return _is_valid_table_div (table, div); +return true; +} + +static int _round_up_table (const struct clk_div_table *table,int div) +{ +const struct clk_div_table *clkt; +int up =INT_MAX ; + +for (clkt = table; clkt->div; clkt++) { +if (clkt->div == div) +return clkt->div; +else if (clkt->div < div) +continue ; + +if ((clkt->div - div) < (up - div)) + up = clkt->div; + } + +return up; +} + +static int _div_round_up (const struct clk_div_table *table, +unsigned long parent_rate,unsigned long rate) +{ +int div =DIV_ROUND_UP_ULL ((u64 )parent_rate, rate); + +if (table) + div =_round_up_table (table, div); + +return div; +} + +static int _div_round (const struct clk_div_table *table, +unsigned long parent_rate,unsigned long rate) +{ +return _div_round_up (table, parent_rate, rate); +} + +static bool _is_best_div (unsigned long rate,unsigned long now, +unsigned long best) +{ +return now <= rate && now > best; +} + +static int _next_div (const struct clk_div_table *table,int div) +{ + div++; + +if (table) +return _round_up_table (table, div); + +return div; +} + +static int clk_divider_bestdiv (struct clk_hw *hw,unsigned long rate, +unsigned long *best_parent_rate, +const struct clk_div_table *table,u8 width) +{ +int i, bestdiv =0 ; +unsigned long parent_rate, best =0 , now, maxdiv; +unsigned long parent_rate_saved = *best_parent_rate; + +if (!rate) + rate =1 ; + + maxdiv =_get_maxdiv (table, width); + +if (!(clk_hw_get_flags (hw) &CLK_SET_RATE_PARENT )) { + parent_rate = *best_parent_rate; + bestdiv =_div_round (table, parent_rate, rate); + bestdiv = bestdiv ==0 ?1 : bestdiv; + bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; +return bestdiv; + } + +/* +* The maximum divider we can use without overflowing +* unsigned long in rate * i below +*/ + maxdiv =min (ULONG_MAX / rate, maxdiv); + +for (i =_next_div (table,0 ); i <= maxdiv; + i =_next_div (table, i)) { +if (rate * i == parent_rate_saved) { +/* +* It's the most ideal case if the requested rate can be +* divided from parent clock without needing to change +* parent rate, so return the divider immediately. +*/ + *best_parent_rate = parent_rate_saved; +return i; + } + parent_rate =clk_hw_round_rate (clk_hw_get_parent (hw), + rate * i); + now =DIV_ROUND_UP_ULL ((u64 )parent_rate, i); +if (_is_best_div (rate, now, best)) { + bestdiv = i; + best = now; + *best_parent_rate = parent_rate; + } + } + +if (!bestdiv) { + bestdiv =_get_maxdiv (table, width); + *best_parent_rate =clk_hw_round_rate (clk_hw_get_parent (hw),1 ); + } + +return bestdiv; +} + +static long sh_divider_round_rate (struct clk_hw *hw,unsigned long rate, +unsigned long *prate,const struct clk_div_table *table, +u8 width) +{ +int div; + + div =clk_divider_bestdiv (hw, rate, prate, table, width); + +return DIV_ROUND_UP_ULL ((u64)*prate, div); +} + +static int sh_clk_divider_determine_rate (struct clk_hw *hw, +struct clk_rate_request *req) +{ +struct clk_divider *divider =to_clk_divider (hw); +long rate, prate; + + prate = req->best_parent_rate; + rate =sh_divider_round_rate (hw, req->rate, &prate, divider->table, + divider->width); +if (rate <0 ) +return rate; + req->rate = rate; + req->best_parent_rate = prate; +return 0 ; +} + +static int sh_divider_get_val (unsigned long rate,unsigned long parent_rate, +const struct clk_div_table *table,u8 width) +{ +unsigned int div, value; + + div =DIV_ROUND_UP_ULL ((u64 )parent_rate, rate); + +if (!_is_valid_div (table, div)) +return -EINVAL ; + + value =_get_val (table, div, width); + + return min_t(unsigned int, value, div_mask(width)); +} + +static int sh_clk_divider_set_rate (struct clk_hw *hw,unsigned long rate, +unsigned long parent_rate) +{ +struct clk_divider *divider =to_clk_divider (hw); +unsigned int value; +unsigned long flags =0 ; +u16 val; + + value =sh_divider_get_val (rate, parent_rate, divider->table, + divider->width); + +if (divider->lock) +spin_lock_irqsave (divider->lock, flags); +else +__acquire (divider->lock); + + val =__raw_readw (divider->reg); + val &= ~(div_mask (divider->width) << divider->shift); + val |= value << divider->shift; +__raw_writew (val, divider->reg); + +if (divider->lock) +spin_unlock_irqrestore (divider->lock, flags); +else +__release (divider->lock); + +return 0 ; +} + +static const struct clk_ops sh_clk_divider_ops = { + .recalc_rate = sh_clk_divider_recalc_rate, + .determine_rate = sh_clk_divider_determine_rate, + .set_rate = sh_clk_divider_set_rate, +}; + +static int _register_divider (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock) +{ +struct clk_divider *div; +struct clk_init_data init; + +/* allocate the divider */ + div =kzalloc (sizeof (*div),GFP_KERNEL ); +if (!div) +return -ENOMEM ; + + init.name = name; + init.ops = &sh_clk_divider_ops; + init.flags =0 ; + init.parent_names = (parent_name ? &parent_name :NULL ); + init.num_parents = (parent_name ?1 :0 ); + +/* struct clk_divider assignments */ + div->reg = reg; + div->shift = shift; + div->width = width; + div->lock = lock; + div->hw.init = &init; + div->table = table; + +/* register the clock */ +if (of_clk_hw_register (node, &div->hw) <0 ) +kfree (div); +of_clk_add_hw_provider (node, of_clk_hw_simple_get, &div->hw); + +return 0 ; +} + +int sh_div_clk_register (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock) +{ +return _register_divider (node, name, parent_name, reg, shift, + width, table, lock); +} +EXPORT_SYMBOL_GPL (sh_div_clk_register);
drivers/clk/renesas/clk-shdiv.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __CLK_SHDIV_H__ +#define __CLK_SHDIV_H__ +/* +* SuperH divider clock driver +*/ + +#include <linux/of.h> +#include <linux/clk-provider.h> + +int sh_div_clk_register (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock); + +#endif
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 11/30] drivers/clk: SuperH generai clock divider helper
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Patch prefix should be "clk: renesas: ".
s/generai/general/
Quoted 8 lines
drivers/clk/renesas/clk-shdiv.c new file +5
-0@@ -0,0 +1,346 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* SuperH divider clock driver +*/ +
drivers/clk/renesas/clk-shdiv.c line 15
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+#include <linux/clkdev.h> +#include <linux/clk-provider.h> +#include <linux/module.h> +#include <linux/slab.h> +#include <linux/io.h> +#include <linux/err.h> +#include <linux/string.h> +#include "clk-shdiv.h" + +#define div_mask (width) ((1 << (width)) - 1)
"1U << ...", so you can use min() below.
Quoted 47 lines
drivers/clk/renesas/clk-shdiv.c new file +47
-0+ +static unsigned int _get_table_maxdiv (const struct clk_div_table *table, +u8 width) +{ +unsigned int maxdiv =0 , mask =div_mask (width); +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div > maxdiv && clkt->val <= mask) + maxdiv = clkt->div; +return maxdiv; +} + +static unsigned int _get_maxdiv (const struct clk_div_table *table,u8 width) +{ +if (table) +return _get_table_maxdiv (table, width); +return div_mask (width) +1 ; +} + +static unsigned int _get_table_div (const struct clk_div_table *table, +unsigned int val) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->val == val) +return clkt->div; +return 0 ; +} + +static unsigned int _get_div (const struct clk_div_table *table, +unsigned int val,u8 width) +{ +if (table) +return _get_table_div (table, val); +return val +1 ; +} + +static unsigned int _get_table_val (const struct clk_div_table *table, +unsigned int div) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div == div) +return clkt->val;
drivers/clk/renesas/clk-shdiv.c line 72
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+return 0 ; +} + +static unsigned int _get_val (const struct clk_div_table *table, +unsigned int div,u8 width) +{ +if (table) +return _get_table_val (table, div); +return div -1 ; +}
Lots of functions named "_<foo>()" are called only once. Please inline them manually.
Quoted 56 lines
drivers/clk/renesas/clk-shdiv.c new file +56
-0+ +static unsigned long sh_divider_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate, +unsigned int val, +const struct clk_div_table *table) +{ +struct clk_divider *divider =to_clk_divider (hw); +unsigned int div; + + div =_get_div (table, val, divider->width); + +return DIV_ROUND_UP_ULL ((u64 )parent_rate, div); +} + +static unsigned long sh_clk_divider_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct clk_divider *divider =to_clk_divider (hw); +unsigned int val; + + val =__raw_readw (divider->reg) >> divider->shift; + val &=div_mask (divider->width); + +return sh_divider_recalc_rate (hw, parent_rate, val, divider->table); +} + +static bool _is_valid_table_div (const struct clk_div_table *table, +unsigned int div) +{ +const struct clk_div_table *clkt; + +for (clkt = table; clkt->div; clkt++) +if (clkt->div == div) +return true; +return false; +} + +static bool _is_valid_div (const struct clk_div_table *table,unsigned int div) +{ +if (table) +return _is_valid_table_div (table, div); +return true; +} + +static int _round_up_table (const struct clk_div_table *table,int div) +{ +const struct clk_div_table *clkt; +int up =INT_MAX ; + +for (clkt = table; clkt->div; clkt++) { +if (clkt->div == div) +return clkt->div; +else if (clkt->div < div) +continue ; + +if ((clkt->div - div) < (up - div))
drivers/clk/renesas/clk-shdiv.c line 138
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+ up = clkt->div; + } + +return up; +} + +static int _div_round_up (const struct clk_div_table *table, +unsigned long parent_rate,unsigned long rate) +{ +int div =DIV_ROUND_UP_ULL ((u64 )parent_rate, rate);
unsigned int (everywhere)
Quoted 24 lines
drivers/clk/renesas/clk-shdiv.c new file +24
-0+ +if (table) + div =_round_up_table (table, div); + +return div; +} + +static int _div_round (const struct clk_div_table *table, +unsigned long parent_rate,unsigned long rate) +{ +return _div_round_up (table, parent_rate, rate); +} + +static bool _is_best_div (unsigned long rate,unsigned long now, +unsigned long best) +{ +return now <= rate && now > best; +} + +static int _next_div (const struct clk_div_table *table,int div) +{ + div++; + +if (table)
drivers/clk/renesas/clk-shdiv.c line 172
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+return _round_up_table (table, div); + +return div; +} + +static int clk_divider_bestdiv (struct clk_hw *hw,unsigned long rate, +unsigned long *best_parent_rate, +const struct clk_div_table *table,u8 width) +{ +int i, bestdiv =0 ;
unsigned int;
Quoted 81 lines
drivers/clk/renesas/clk-shdiv.c new file +81
-0+unsigned long parent_rate, best =0 , now, maxdiv; +unsigned long parent_rate_saved = *best_parent_rate; + +if (!rate) + rate =1 ; + + maxdiv =_get_maxdiv (table, width); + +if (!(clk_hw_get_flags (hw) &CLK_SET_RATE_PARENT )) { + parent_rate = *best_parent_rate; + bestdiv =_div_round (table, parent_rate, rate); + bestdiv = bestdiv ==0 ?1 : bestdiv; + bestdiv = bestdiv > maxdiv ? maxdiv : bestdiv; +return bestdiv; + } + +/* +* The maximum divider we can use without overflowing +* unsigned long in rate * i below +*/ + maxdiv =min (ULONG_MAX / rate, maxdiv); + +for (i =_next_div (table,0 ); i <= maxdiv; + i =_next_div (table, i)) { +if (rate * i == parent_rate_saved) { +/* +* It's the most ideal case if the requested rate can be +* divided from parent clock without needing to change +* parent rate, so return the divider immediately. +*/ + *best_parent_rate = parent_rate_saved; +return i; + } + parent_rate =clk_hw_round_rate (clk_hw_get_parent (hw), + rate * i); + now =DIV_ROUND_UP_ULL ((u64 )parent_rate, i); +if (_is_best_div (rate, now, best)) { + bestdiv = i; + best = now; + *best_parent_rate = parent_rate; + } + } + +if (!bestdiv) { + bestdiv =_get_maxdiv (table, width); + *best_parent_rate =clk_hw_round_rate (clk_hw_get_parent (hw),1 ); + } + +return bestdiv; +} + +static long sh_divider_round_rate (struct clk_hw *hw,unsigned long rate, +unsigned long *prate,const struct clk_div_table *table, +u8 width) +{ +int div; + + div =clk_divider_bestdiv (hw, rate, prate, table, width); + +return DIV_ROUND_UP_ULL ((u64)*prate, div); +} + +static int sh_clk_divider_determine_rate (struct clk_hw *hw, +struct clk_rate_request *req) +{ +struct clk_divider *divider =to_clk_divider (hw); +long rate, prate; + + prate = req->best_parent_rate; + rate =sh_divider_round_rate (hw, req->rate, &prate, divider->table, + divider->width); +if (rate <0 ) +return rate; + req->rate = rate; + req->best_parent_rate = prate; +return 0 ; +} + +static int sh_divider_get_val (unsigned long rate,unsigned long parent_rate, +const struct clk_div_table *table,u8 width) +{
drivers/clk/renesas/clk-shdiv.c line 263
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+unsigned int div, value; + + div =DIV_ROUND_UP_ULL ((u64 )parent_rate, rate); + +if (!_is_valid_div (table, div)) +return -EINVAL ; + + value =_get_val (table, div, width); + + return min_t(unsigned int, value, div_mask(width));
min() (once div_mask() is unsigned)
Quoted 26 lines
drivers/clk/renesas/clk-shdiv.c new file +25
-0+} +static int _register_divider (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock) +{ +struct clk_divider *div; +struct clk_init_data init; + +/* allocate the divider */ + div =kzalloc (sizeof (*div),GFP_KERNEL ); +if (!div) +return -ENOMEM ; + + init.name = name; + init.ops = &sh_clk_divider_ops; + init.flags =0 ; + init.parent_names = (parent_name ? &parent_name :NULL ); + init.num_parents = (parent_name ?1 :0 ); + +/* struct clk_divider assignments */ + div->reg = reg; + div->shift = shift; + div->width = width;
drivers/clk/renesas/clk-shdiv.c line 334
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+ div->lock = lock; + div->hw.init = &init; + div->table = table; + +/* register the clock */ +if (of_clk_hw_register (node, &div->hw) <0 ) +kfree (div); +of_clk_add_hw_provider (node, of_clk_hw_simple_get, &div->hw); + +return 0 ;
Please propagate the error in case of failure.
drivers/clk/renesas/clk-shdiv.c line 344
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.c new file +10
-0+} + +int sh_div_clk_register (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock) +{ +return _register_divider (node, name, parent_name, reg, shift, + width, table, lock);
Is there a reason why you made _register_divider() a separate function?
Quoted 8 lines
drivers/clk/renesas/clk-shdiv.c new file +2
-0+} +EXPORT_SYMBOL_GPL (sh_div_clk_register);drivers/clk/renesas/clk-shdiv.h new file +0
-0
drivers/clk/renesas/clk-shdiv.h line 10
Quoted 10 lines
drivers/clk/renesas/clk-shdiv.h new file +10
-0@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __CLK_SHDIV_H__ +#define __CLK_SHDIV_H__ +/* +* SuperH divider clock driver +*/ + +#include <linux/of.h> +#include <linux/clk-provider.h>
There is no need to include these headers.
You do need to include <linux/compiler_types.h> for __iomem;
You can use forward declarations:
struct device_node;
struct clk_div_table;
struct spinlock;drivers/clk/renesas/clk-shdiv.h line 16
Quoted 6 lines
drivers/clk/renesas/clk-shdiv.h new file +6
-0+ +int sh_div_clk_register (struct device_node *node,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock);
struct spinlock *lock
drivers/clk/renesas/clk-shdiv.h line 18
Quoted 2 lines
drivers/clk/renesas/clk-shdiv.h new file +2
-0+ +#endif
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
Yoshinori Sato
maintainerRFC PATCH v2 12/30 drivers/clk: Add SH7750 CPG drivers entry.
In reply to Yoshinori Sato--- drivers/clk/renesas/Kconfig | 15 ++++++++++++++- drivers/clk/renesas/Makefile | 1 + 2 files changed, 15 insertions(+), 1 deletion(-)
drivers/clk/renesas/Kconfig +14 -1
@@ -2,7 +2,7 @@ config CLK_RENESAS bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS - default y if ARCH_RENESAS + 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
@@ -218,6 +223,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
@@ -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 clk-shdiv.o # Family obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 12/30] drivers/clk: Add SH7750 CPG drivers entry.
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Patch prefix should be "clk: renesas: ".
Quoted 2 lines
drivers/clk/renesas/Kconfig | 15 ++++++++++++++- drivers/clk/renesas/Makefile | 1 +
Please combine this patch with "[RFC PATCH v2 10/30] drivers/clk:
SH7750 / SH7751 CPG Driver".
drivers/clk/renesas/Kconfig line 4
Quoted 6 lines
drivers/clk/renesas/Kconfig +0
-0@@ -2,7 +2,7 @@ config CLK_RENESAS bool "Renesas SoC clock support" if COMPILE_TEST && !ARCH_RENESAS
... && !SUPERH
Quoted 18 lines
drivers/clk/renesas/Kconfig +6
-1- default y if ARCH_RENESAS + 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
drivers/clk/renesas/Kconfig config CLK_RZG2L · line 226
Quoted 4 lines
drivers/clk/renesas/Kconfig +1
-0@@ -218,6 +223,14 @@ config CLK_RZG2L bool "Renesas RZ/{G2L,G2UL,V2L} family clock support" if COMPILE_TEST select RESET_CONTROLLER +config CLK_SH7750
Probably you want to move this below CLK_SH73A0...
drivers/clk/renesas/Kconfig config CLK_RZG2L · line 227
Quoted 1 line
drivers/clk/renesas/Kconfig +1
-0+ bool "Renesas SH7750/7751 family clock support"
... and drop the "Renesas" part?
Please add "if COMPILE_TEST" like all other clock drivers in this file.
drivers/clk/renesas/Kconfig config CLK_RZG2L · line 230
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
There is no need for a dependency rule.
drivers/clk/renesas/Kconfig config CLK_RZG2L · line 236
Quoted 6 lines
drivers/clk/renesas/Kconfig +3
-0+ help + This is a driver for SH7750 / SH7751 CPG. + # Generic config CLK_RENESAS_CPG_MSSR bool "CPG/MSSR clock support" if COMPILE_TEST
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
Yoshinori Sato
maintainerRFC PATCH v2 13/30 Documentation/devicetree: Add renesas,sh7751-cpg binding document.
In reply to Yoshinori Sato--- .../bindings/clock/renesas,sh7750-cpg.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +58 -0
@@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/renesas,cpg-clocks.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas SH7750 / SH7751 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 fixed and variable ratio dividers. + + The CPG may also provide a Clock Domain for SoC devices, + +properties: + compatible: + - const: renesas,sh7750-cpg # SH7750 / 7750S / 7751 + - items: + - const: renesas,sh7750r-cpg # SH7750R / 7751R + + reg: + maxItems: 2 + items: + - description: FRQCR register + - description: WDT registers + + clocks: true + + '#clock-cells': + const: 1 + + renesas,mode: + description: Board-specific settings of the MD0 - MD2 bits + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 6 + +required: + - compatible + - reg + - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/r8a7740-clock.h> + cpg: cpg@ffc00000 { + #clock-cells = <1>; + compatible = "renesas,sh7750r-cpg","renesas,sh7750-cpg"; + clocks = <&xtal>; + reg = <0xffc00000 2>, <0xffc00008 4>; + renesas,mode = <0x05> + };
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 13/30] Documentation/devicetree: Add renesas,sh7751-cpg binding document.
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Same problems as before. Also:
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 redundant "binding document." Drop full-stop from subject. Subjects do not have full stops, unlike commit msg which here is missing.
3. 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
Re: [RFC PATCH v2 13/30] Documentation/devicetree: Add renesas,sh7751-cpg binding document.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Patch prefix should be "dt-bindings: clock: renesas:".
Quoted 9 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +6
-0@@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/renesas,cpg-clocks.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +10
-0+title: Renesas SH7750 / SH7751 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 fixed and variable ratio dividers. + + The CPG may also provide a Clock Domain for SoC devices,
That functionality would require '#power-domain-cells'.
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 20
Quoted 4 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +4
-0+ +properties: + compatible: + - const: renesas,sh7750-cpg # SH7750 / 7750S / 7751
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml:
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml:20:7:
[warning] wrong indentation: expected 4 but found 6 (indentation)
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml:20:34:
[error] syntax error: found character '\t' that cannot start any token (syntax)
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 22
Quoted 2 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +2
-0+ - items: + - const: renesas,sh7750r-cpg # SH7750R / 7751R
This is the wrong order for compatible values: they should be ordered from most-specific to least-specific.
However, given the small but significant differences between the different variants, I think you need to define all five:
compatible:
enum:
- renesas,sh7750-cpg
- renesas,sh7750r-cpg
- renesas,sh7750s-cpg
- renesas,sh7751-cpg
- renesas,sh7751r-cpg
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 28
Quoted 5 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +5
-0+ reg: + maxItems: 2 + items: + - description: FRQCR register + - description: WDT registers
I think the above should be combined into one larger block, containing the CPG, standby control, and watchdog registers.
A second block would contain the clock stop registers. Even although the driver doesn't support these yet, it would be good to have them in DT.
And probably you want to specify "reg-names", too.
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 29
Quoted 2 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +2
-0+ + clocks: true
maxItems: 1
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 43
Quoted 13 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +13
-0+ + '#clock-cells': + const: 1 + + renesas,mode: + description: Board-specific settings of the MD0 - MD2 bits + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 6 + +required: + - compatible + - reg
+ reg-names
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 52
Quoted 9 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +9
-0+ - clocks + - '#clock-cells' + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/r8a7740-clock.h> + cpg: cpg@ffc00000 {
Please align "cpg:" with "#include" above, using spaces as indentation.
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 58
Quoted 6 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +6
-0+ #clock-cells = <1>; + compatible = "renesas,sh7750r-cpg","renesas,sh7750-cpg"; + clocks = <&xtal>; + reg = <0xffc00000 2>, <0xffc00008 4>; + renesas,mode = <0x05> + };
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
Re: [RFC PATCH v2 13/30] Documentation/devicetree: Add renesas,sh7751-cpg binding document.
In reply to Yoshinori SatoQuoted 12 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>--- .../bindings/clock/renesas,sh7750-cpg.yaml | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yamlDocumentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +0
-0
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml line 4
Quoted 4 lines
Documentation/devicetree/bindings/clock/renesas,sh7750-cpg.yaml new file +4
-0@@ -0,0 +1,58 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/clock/renesas,cpg-clocks.yaml#
warning: ignoring duplicate '$id' value 'http://devicetree.org/schemas/clock/renesas,cpg-clocks.yaml#'
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
Yoshinori Sato
maintainerRFC PATCH v2 14/30 drivers/irqchip: Add SH7751 Internal INTC drivers.
In reply to Yoshinori Sato--- drivers/irqchip/Kconfig | 9 ++ drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-renesas-sh7751.c | 232 +++++++++++++++++++++++++++ 3 files changed, 242 insertions(+) create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
drivers/irqchip/Kconfig +9 -0
@@ -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 + 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
@@ -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 +232 -0
232 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers.
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 684
Quoted 9 lines
drivers/irqchip/Kconfig +3
-0@@ -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"?
drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 689
Quoted 5 lines
drivers/irqchip/Kconfig +5
-0+ select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + help + Support for the Renesas SH7751 On-chip interrupt controller. + And external interrupt encoder for some targets.
Inconsistent indentation
drivers/irqchip/irq-renesas-sh7751.c line 68
Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3
-0+/* INTEVT to IPR mapping */ +static const struct iprmap { + int intevt;
irq, as you're storing the irq number not the event number?
drivers/irqchip/irq-renesas-sh7751.c line 70
Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2
-0+int off; +int bit;
All unsigned int ...
Quoted 35 lines
drivers/irqchip/irq-renesas-sh7751.c new file +35
-0+} iprmaps[] = { +#define IPRDEF (e, o, b) { .intevt = evt2irq(e), .off = o, .bit = b } +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 */
drivers/irqchip/irq-renesas-sh7751.c line 115
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0+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 */
Probably the same or a very similar interrupt controller is present on other SoCs? Then the comments don't make much sense, as the actual interrupt mapping is specified in the DTS anyway.
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
Yoshinori Sato
maintainerRe: [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers.
Quoted 84 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 684
Quoted 9 lines
drivers/irqchip/Kconfig +3
-0@@ -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"?drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 689
Quoted 5 lines
drivers/irqchip/Kconfig +5
-0+ select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + help + Support for the Renesas SH7751 On-chip interrupt controller. + And external interrupt encoder for some targets.Inconsistent indentation
drivers/irqchip/irq-renesas-sh7751.c line 68
Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3
-0+/* INTEVT to IPR mapping */ +static const struct iprmap { + int intevt;irq, as you're storing the irq number not the event number?
drivers/irqchip/irq-renesas-sh7751.c line 70
Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2
-0+int off; +int bit;All unsigned int ...
Quoted 41 lines
drivers/irqchip/irq-renesas-sh7751.c new file +41
-0+} iprmaps[] = { +#define IPRDEF (e, o, b) { .intevt = evt2irq(e), .off = o, .bit = b } +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 */
Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751.c line 115
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+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 */Probably the same or a very similar interrupt controller is present on other SoCs? Then the comments don't make much sense, as the actual interrupt mapping is specified in the DTS anyway.
This interrupt controller design is quite old, so there doesn't seem to be any SoC with a similar design.
Since the SH interrupt controllers have almost the same design, I think this driver can be used for other devices besides the SH7751. I think a good way to write IPR mapping is to use dts.
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
Re: [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers.
Hi Sato-san,
Quoted 92 lines · Yoshinori Sato
Quoted 81 lines · Geert Uytterhoeven
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 684
Quoted 9 lines
drivers/irqchip/Kconfig +3
-0@@ -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"?drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 689
Quoted 5 lines
drivers/irqchip/Kconfig +5
-0+ select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + help + Support for the Renesas SH7751 On-chip interrupt controller. + And external interrupt encoder for some targets.Inconsistent indentation
drivers/irqchip/irq-renesas-sh7751.c line 68
Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3
-0+/* INTEVT to IPR mapping */ +static const struct iprmap { + int intevt;irq, as you're storing the irq number not the event number?
drivers/irqchip/irq-renesas-sh7751.c line 70
Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2
-0+int off; +int bit;All unsigned int ...
Quoted 41 lines
drivers/irqchip/irq-renesas-sh7751.c new file +41
-0+} iprmaps[] = { +#define IPRDEF (e, o, b) { .intevt = evt2irq(e), .off = o, .bit = b } +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 */Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751.c line 115
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+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 */Probably the same or a very similar interrupt controller is present on other SoCs? Then the comments don't make much sense, as the actual interrupt mapping is specified in the DTS anyway.
Quoted 2 lines
This interrupt controller design is quite old, so there doesn't seem to be any SoC with a similar design.
OK.
Quoted 2 lines
Since the SH interrupt controllers have almost the same design, I think this driver can be used for other devices besides the SH7751.
Wait, this contradicts your sentence above?
Quoted 1 line
I think a good way to write IPR mapping is to use dts.
If there is one thing we learned from putting full clock controller and PM Domain hierarchies in DT, it is that that turned out to be very fragile. It is hard not to make mistakes in the description, and easy to miss a critical aspect of the hardware that needs changes later.
So that's why it's better to differentiate through the compatible value, instead of through (lots of) properties: you can always fix the driver, while DT is a stable ABI.
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
Yoshinori Sato
maintainerRe: [RFC PATCH v2 14/30] drivers/irqchip: Add SH7751 Internal INTC drivers.
Quoted 100 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 92 lines · Yoshinori Sato
Quoted 81 lines · Geert Uytterhoeven
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 684
Quoted 9 lines
drivers/irqchip/Kconfig +3
-0@@ -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"?drivers/irqchip/Kconfig config SUNPLUS_SP7021_INTC · line 689
Quoted 5 lines
drivers/irqchip/Kconfig +5
-0+ select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY + help + Support for the Renesas SH7751 On-chip interrupt controller. + And external interrupt encoder for some targets.Inconsistent indentation
drivers/irqchip/irq-renesas-sh7751.c line 68
Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3
-0+/* INTEVT to IPR mapping */ +static const struct iprmap { + int intevt;irq, as you're storing the irq number not the event number?
drivers/irqchip/irq-renesas-sh7751.c line 70
Quoted 2 lines
drivers/irqchip/irq-renesas-sh7751.c new file +2
-0+int off; +int bit;All unsigned int ...
Quoted 41 lines
drivers/irqchip/irq-renesas-sh7751.c new file +41
-0+} iprmaps[] = { +#define IPRDEF (e, o, b) { .intevt = evt2irq(e), .off = o, .bit = b } +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 */Quoted 8 lines
drivers/irqchip/irq-renesas-sh7751.c line 115
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+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 */Probably the same or a very similar interrupt controller is present on other SoCs? Then the comments don't make much sense, as the actual interrupt mapping is specified in the DTS anyway.
Quoted 2 lines
This interrupt controller design is quite old, so there doesn't seem to be any SoC with a similar design.
Quoted 6 lines
OK.
Quoted 2 lines
Since the SH interrupt controllers have almost the same design, I think this driver can be used for other devices besides the SH7751.
Wait, this contradicts your sentence above?
I'm referring to other SH3/4 CPUs.
The only difference is the correspondence between registers and interrupt sources, so it can be used universally not only for the SH7751 but also for the other SH3 and 4.
I don't think it fits the philosophy of dt to embed information about each CPU in the code and switch it with compatible.
Quoted 9 lines
Quoted 1 line
I think a good way to write IPR mapping is to use dts.
If there is one thing we learned from putting full clock controller and PM Domain hierarchies in DT, it is that that turned out to be very fragile. It is hard not to make mistakes in the description, and easy to miss a critical aspect of the hardware that needs changes later.
So that's why it's better to differentiate through the compatible value, instead of through (lots of) properties: you can always fix the driver, while DT is a stable ABI.
I tried defining it like this.
I think this format is easy to maintain.
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
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
Yoshinori Sato
maintainerRFC PATCH v2 15/30 Documentation/devicetree: Add renesas,sh7751-intc binding document.
In reply to Yoshinori Sato--- .../renesas,sh7751-intc.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +45 -0
@@ -0,0 +1,45 @@ +# 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: + minItems: 2 + maxItems: 2 + + sh7751,irlm: + description: If this value true. ICR.IRLM is 1. + $ref: /schemas/types.yaml#/definitions/bool + +required: + - compatible + - '#interrupt-cells' + - interrupt-controller + - reg + +examples: + - | + shintc: interrupt-controller@ffd00000 { + compatible = "renesas,sh7751-intc"; + #interrupt-cells = <2>; + interrupt-controller; + reg = <0xffd00000 14>, <0xfe080000 128>; + };
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 15/30] Documentation/devicetree: Add renesas,sh7751-intc binding document.
Quoted 30 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>--- .../renesas,sh7751-intc.yaml | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yamlDocumentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +18
-0@@ -0,0 +1,45 @@ +# 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
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +10
-0+ # this directory + const: 2 + + interrupt-controller: true + + reg: + minItems: 2 + maxItems: 2 + + sh7751,irlm:
This was absolutely never tested. That's not a valid vendor prefix.
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
Re: [RFC PATCH v2 15/30] Documentation/devicetree: Add renesas,sh7751-intc binding document.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 19 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +16
-0@@ -0,0 +1,45 @@ +# 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 +
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 26
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +10
-0+ '#interrupt-cells': + # an interrupt index and flags, as defined in interrupts.txt in + # this directory + const: 2 + + interrupt-controller: true + + reg: + minItems: 2 + maxItems: 2
Please explain the meaning of each register bank, using "description".
Perhaps reg-names, as there are two register banks?
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 28
Quoted 2 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +2
-0+ + sh7751,irlm:
The vendor prefix should be "renesas".
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 29
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +1
-0+ description: If this value true. ICR.IRLM is 1.
This does not explain why you need this.
Is this hardware description, or software configuration?
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml line 30
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-intc.yaml new file +1
-0+ $ref: /schemas/types.yaml#/definitions/bool
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
Yoshinori Sato
maintainerRFC PATCH v2 16/30 drivers/irqchip: SH7751 IRL external encoder with enable gate.
In reply to Yoshinori SatoSH7751 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 | 183 ++++++++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 drivers/irqchip/irq-renesas-sh7751irl.c
drivers/irqchip/Kconfig +7 -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. +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
@@ -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 +183 -0
183 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 16/30] drivers/irqchip: SH7751 IRL external encoder with enable gate.
Hi Sato-san,
Quoted 6 lines · 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.Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 694
Quoted 10 lines
drivers/irqchip/Kconfig +4
-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. +config RENESAS_SH7751IRL_INTC + bool "Renesas SH7751 based target IRL encoder support." + depends on RENESAS_SH7751_INTC + help
Inconsistent indentation
drivers/irqchip/Kconfig config RENESAS_SH7751_INTC · line 698
Quoted 4 lines
drivers/irqchip/Kconfig +3
-0+ Support for External Interrupt encoder + on the some Renesas SH7751 based target. + endmenu
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
Yoshinori Sato
maintainerRFC PATCH v2 17/30 Documentation/devicetree: Add renesas,sh7751-irl-ext binding document.
In reply to Yoshinori Sato--- .../renesas,sh7751-irl-ext.yaml | 77 +++++++++++++++++++ 1 file changed, 77 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 +77 -0
@@ -0,0 +1,77 @@ +# 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 general used external interrupt encoder on SH7751 based boards. + +properties: + compatible: + items: + - const: renesas,sh7751-irl-ext + + '#interrupt-cells': + # an interrupt index and flags, as defined in interrupts.txt in + # this directory + const: 2 + + interrupt-controller: true + + reg: + minItems: 1 + + sh7751irl,width: + description: Enable register width + $ref: /schemas/types.yaml#/definitions/uint32 + + sh7751irl,polarity: + description: Enable register polarity + $ref: /schemas/types.yaml#/definitions/uint32 + + sh7751irl,irqbit: + description: IRQ to enable register bit mapping + $ref: /schemas/types.yaml#/definitions/uint32-array + + +required: + - compatible + - '#interrupt-cells' + - interrupt-controller + - reg + - sh7751irl,width + - sh7751irl,polarity + - sh7751,irqbit + +additionalProperties: false + +examples: + - | + r2dintc: sh7751irl_encoder@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <16>; + sh7751irl,polarity = <0>; + sh7751irl,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
Re: [RFC PATCH v2 17/30] Documentation/devicetree: Add renesas,sh7751-irl-ext binding document.
Quoted 2 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>---
Same comments as for other patches :(
Best regards,
Krzysztof
Re: [RFC PATCH v2 17/30] Documentation/devicetree: Add renesas,sh7751-irl-ext binding document.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 14 lines
--- .../renesas,sh7751-irl-ext.yaml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yamlDocumentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +3
-0@@ -0,0 +1,77 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +---
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 13
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +10
-0+$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 general used external interrupt encoder on SH7751 based boards.
generally
Quoted 7 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +7
-0+ +properties: + compatible: + items: + - const: renesas,sh7751-irl-ext + + '#interrupt-cells':
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 30
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +10
-0+ # an interrupt index and flags, as defined in interrupts.txt in + # this directory + const: 2 + + interrupt-controller: true + + reg: + minItems: 1 + + sh7751irl,width:
Vendor prefix should be "renesas" (everywhere).
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 31
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +1
-0+ description: Enable register width
Specify
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 32
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +1
-0+ $ref: /schemas/types.yaml#/definitions/uint32
Perhaps this should be specified implicitly, by using a different compatible value depending on the register width?
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 35
Quoted 3 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +3
-0+ + sh7751irl,polarity: + description: Enable register polarity
Specify
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 36
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +1
-0+ $ref: /schemas/types.yaml#/definitions/uint32
Is this the interrupt polarity? If yes, that should be specified by the consumer through the last cell of the interrupts property (IRQ_TYPE_*).
Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +4
-0+ + sh7751irl,irqbit: + description: IRQ to enable register bit mapping + $ref: /schemas/types.yaml#/definitions/uint32-array
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 50
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +10
-0+ + +required: + - compatible + - '#interrupt-cells' + - interrupt-controller + - reg + - sh7751irl,width + - sh7751irl,polarity + - sh7751,irqbit
Vendor prefix does not match above.
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 56
Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +6
-0+ +additionalProperties: false + +examples: + - | + r2dintc: sh7751irl_encoder@a4000000 {
Please align "r2dintc" with the "|" above.
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 60
Quoted 4 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +4
-0+ compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <1>;
make dt_binding_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml
sh7751irl_encoder@a4000000: '#address-cells' does not match any of
the regexes: 'pinctrl-[0-9]+'
Quoted 6 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +6
-0+ #interrupt-cells = <2>; + sh7751irl,width = <16>; + sh7751irl,polarity = <0>; + sh7751irl,irqbit =<11>, /* PCI INTD */ + <9>, /* CF IDE */ + <8>, /* CF CD */
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 76
Quoted 10 lines
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +10
-0+ <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 */
'sh7751irl,irqbit', 'sh7751irl,polarity', 'sh7751irl,width' do not
match any of the regexes ...
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml line 77
Quoted 1 line
Documentation/devicetree/bindings/interrupt-controller/renesas,sh7751-irl-ext.yaml new file +1
-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
Yoshinori Sato
maintainerRFC PATCH v2 18/30 drivers/clocksource: sh_tmu clocks property support.
In reply to Yoshinori Sato--- drivers/clocksource/sh_tmu.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/clocksource/sh_tmu.c +3 -0
@@ -537,6 +537,9 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)/* Get hold of clock. */ tmu->clk =clk_get (&tmu->pdev->dev,"fck" ); +if (IS_ERR (tmu->clk) &&IS_ENABLED (CONFIG_OF ) && pdev->dev.of_node) +/* use DeviceTree clocks property */ + tmu->clk =devm_clk_get (&tmu->pdev->dev,NULL );if (IS_ERR (tmu->clk)) {dev_err (&tmu->pdev->dev,"cannot get clock\n" );return PTR_ERR (tmu->clk);
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 18/30] drivers/clocksource: sh_tmu clocks property support.
Hi Sato-san,
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 542
Quoted 11 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>drivers/clocksource/sh_tmu.c +3
-0@@ -537,6 +537,9 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)/* Get hold of clock. */ tmu->clk =clk_get (&tmu->pdev->dev,"fck" ); +if (IS_ERR (tmu->clk) &&IS_ENABLED (CONFIG_OF ) && pdev->dev.of_node) +/* use DeviceTree clocks property */ + tmu->clk =devm_clk_get (&tmu->pdev->dev,NULL );
This should not be needed.
I guess this is a workaround for the missing
clock-names = "fck";
in arch/sh/boot/dts/sh7751.dtsi?
"make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/timer/renesas,tmu.yaml" would have told you ;-)
timer@ffd80008: 'clock-names' is a required property
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 545
Quoted 3 lines
drivers/clocksource/sh_tmu.c +0
-0if (IS_ERR (tmu->clk)) {dev_err (&tmu->pdev->dev,"cannot get clock\n" );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
Yoshinori Sato
maintainerRFC PATCH v2 19/30 drivers/tty: sh-sci fix SH4 OF support.
In reply to Yoshinori Sato- fix earlycon name.
- fix earlyprintk hung (NULL pointer reference).
- clocks property support.
--- drivers/tty/serial/sh-sci.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/tty/serial/sh-sci.c +5 -3
@@ -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);
@@ -2842,6 +2842,8 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)* global "peripheral_clk" clock. */ clk =devm_clk_get (dev,"peripheral_clk" ); +if (IS_ERR (clk)) + clk =devm_clk_get (dev,NULL );if (IS_ERR (clk)) return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s\n",
@@ -3555,8 +3557,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 (rzscif,"renesas,scif-r7s9210" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscif,"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
Re: [RFC PATCH v2 19/30] drivers/tty: sh-sci fix SH4 OF support.
Hi Sato-san,
Thanks for your patch!
Quoted 1 line · Yoshinori Sato
- fix earlycon name.
I guess you mean earlyprintk?
"Earlyprintk expects that all names used in OF_EARLYCON_DECLARE()
are unique".
Quoted 9 lines
- fix earlyprintk hung (NULL pointer reference).
- clocks property support.Signed-off-by Yoshinori Sato <[email protected]>
drivers/tty/serial/sh-sci.c static int sci_init_clocks(struct sci_port *sci_port, struct device *dev) · line 2846
Quoted 5 lines
drivers/tty/serial/sh-sci.c +2
-0@@ -2842,6 +2842,8 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)* global "peripheral_clk" clock. */ clk =devm_clk_get (dev,"peripheral_clk" ); +if (IS_ERR (clk)) + clk =devm_clk_get (dev,NULL );
This should not be needed.
I guess this is a workaround for the lack of
clock-names = "fck";
in arch/sh/boot/dts/sh7751.dtsi?
"make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/serial/renesas,scif.yaml" would have told you ;-)
serial@ffe80000: 'clock-names' is a required property
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3561
Quoted 11 lines
drivers/tty/serial/sh-sci.c +2
-2if (IS_ERR (clk)) return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s\n",@@ -3555,8 +3557,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 (rzscif,"renesas,scif-r7s9210" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscif,"renesas,scif-r9a07g044" , rzscifa_early_console_setup);
Perhaps "rzscifa", to match the setup function prefix?
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3564
Quoted 3 lines
drivers/tty/serial/sh-sci.c +0
-0OF_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);
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
Yoshinori Sato
maintainerRe: [RFC PATCH v2 19/30] drivers/tty: sh-sci fix SH4 OF support.
Quoted 47 lines · Geert Uytterhoeven
Hi Sato-san,
Thanks for your patch!
Quoted 1 line · Yoshinori Sato
- fix earlycon name.
I guess you mean earlyprintk?
"Earlyprintk expects that all names used in
OF_EARLYCON_DECLARE()
are unique".Quoted 9 lines
- fix earlyprintk hung (NULL pointer reference).
- clocks property support.Signed-off-by Yoshinori Sato <[email protected]>drivers/tty/serial/sh-sci.c static int sci_init_clocks(struct sci_port *sci_port, struct device *dev) · line 2846
Quoted 5 lines
drivers/tty/serial/sh-sci.c +2
-0@@ -2842,6 +2842,8 @@ static int sci_init_clocks(struct sci_port *sci_port, struct device *dev)* global "peripheral_clk" clock. */ clk =devm_clk_get (dev,"peripheral_clk" ); +if (IS_ERR (clk)) + clk =devm_clk_get (dev,NULL );This should not be needed.
I guess this is a workaround for the lack ofclock-names = "fck";in
arch/sh/boot/dts/sh7751.dtsi?"make
dtbs_checkDT_SCHEMA_FILES=Documentation/devicetree/bindings/serial/renesas,scif.yaml" would have told you ;-)serial@ffe80000: 'clock-names' is a required property
Quoted 5 lines
drivers/tty/serial/sh-sci.c +0
-0if (IS_ERR (clk)) return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s\n",@@ -3555,8 +3557,8 @@ static int __init hscif_early_console_setup(struct earlycon_device *device,
Quoted 8 lines
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3561
Quoted 6 lines
drivers/tty/serial/sh-sci.c +2
-2OF_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 (rzscif,"renesas,scif-r7s9210" , rzscifa_early_console_setup); +OF_EARLYCON_DECLARE (rzscif,"renesas,scif-r9a07g044" , rzscifa_early_console_setup);Perhaps "rzscifa", to match the setup function prefix?
With this change, specifying "earlycon=rzscif,0xe8007000" in the boot parameter will call rzscifa_early_console_setup.
But it would be confusing if the names were not unified, so use "rzscifa" I'll make it.
Quoted 14 lines
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3564
Quoted 3 lines
drivers/tty/serial/sh-sci.c +0
-0OF_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);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
Yoshinori Sato
maintainerRFC PATCH v2 20/30 drivers/mfd: sm501 add some properties.
In reply to Yoshinori SatoSM501's OF support is not enough parameter in platform device. This change adds the missing parameter.
--- drivers/mfd/sm501.c | 113 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)
drivers/mfd/sm501.c +113 -0
@@ -1370,6 +1370,113 @@ static int sm501_init_dev(struct sm501_devdata *sm)return 0 ; } +#if defined(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, "sm501,devices"); + for (i = 0; i < nstr; i++) { + if (of_property_read_string_index(np, "sm501,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(struct sm501_platdata), GFP_KERNEL); + if (plat == NULL) + return -ENOMEM; + + plat->init = devm_kzalloc(sm->dev, sizeof(struct sm501_initdata), GFP_KERNEL); + if (plat->init == NULL) + return -ENOMEM; + + plat->init->devices = sm501_parse_devices_str(np); + + if (!of_property_read_u32_index(np, "sm501,mclk", 0, &u32_val)) + plat->init->mclk = u32_val; + else + plat->init->mclk = 0; + + if (!of_property_read_u32_index(np, "sm501,m1xclk", 0, &u32_val)) + plat->init->m1xclk = u32_val; + else + plat->init->m1xclk = 0; + + sm501_of_read_reg_init(np, "sm501,misc-timing", &plat->init->misc_timing); + sm501_of_read_reg_init(np, "sm501,misc-control", &plat->init->misc_control); + sm501_of_read_reg_init(np, "sm501,gpio-low", &plat->init->gpio_low); + sm501_of_read_reg_init(np, "sm501,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, "sm501,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, "sm501,gpio-i2c", + plat->gpio_i2c, plat->gpio_i2c_nr * 5); + } +#endif + sm->platdata = plat; + return 0; +} +#endif + 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));
Signature · 1 line
2.39.2
Lee Jones
maintainerRe: [RFC PATCH v2 20/30] drivers/mfd: sm501 add some properties.
Subject line is wrong in many of your commits.
Use git log --online -- <subsystem> to help you.
Quoted 2 lines · Yoshinori Sato
SM501's OF support is not enough parameter in platform device. This change adds the missing parameter.
You need more information.
What currently doesn't work? How does this help?
How does it work? What will happen if it's not applied?
Quoted 4 lines
Signed-off-by Yoshinori Sato <[email protected]>--- drivers/mfd/sm501.c | 113 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+)
Please resubmit this set and Cc it to everyone.
I would like to see all of the changes please, since they are related.
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1373
Quoted 9 lines
drivers/mfd/sm501.c +1
-0@@ -1370,6 +1370,113 @@ static int sm501_init_dev(struct sm501_devdata *sm)return 0 ; } +#if defined(CONFIG_OF )
Avoid #ifery as much as possible.
Quoted 16 lines
drivers/mfd/sm501.c +16
-0+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 },
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1399
Quoted 10 lines
drivers/mfd/sm501.c +10
-0+ { "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,"sm501,devices" ); +for (i =0 ; i < nstr; i++) { +if (of_property_read_string_index (np,"sm501,devices" , i, &devstr))
Not a lot I can do without seeing the DT binding.
Quoted 22 lines
drivers/mfd/sm501.c +22
-0+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 ;
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1431
Quoted 10 lines
drivers/mfd/sm501.c +10
-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 (struct sm501_platdata ),GFP_KERNEL );
sizeof(*plat)
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1432
Quoted 1 line
drivers/mfd/sm501.c +1
-0+if (plat ==NULL )
if (!plat)
Quoted 66 lines
drivers/mfd/sm501.c +53
-0+return -ENOMEM ; + + plat->init =devm_kzalloc (sm->dev,sizeof (struct sm501_initdata ),GFP_KERNEL ); +if (plat->init ==NULL ) +return -ENOMEM ; + + plat->init->devices =sm501_parse_devices_str (np); + +if (!of_property_read_u32_index (np,"sm501,mclk" ,0 , &u32_val)) + plat->init->mclk = u32_val; +else + plat->init->mclk =0 ; + +if (!of_property_read_u32_index (np,"sm501,m1xclk" ,0 , &u32_val)) + plat->init->m1xclk = u32_val; +else + plat->init->m1xclk =0 ; + +sm501_of_read_reg_init (np,"sm501,misc-timing" , &plat->init->misc_timing); +sm501_of_read_reg_init (np,"sm501,misc-control" , &plat->init->misc_control); +sm501_of_read_reg_init (np,"sm501,gpio-low" , &plat->init->gpio_low); +sm501_of_read_reg_init (np,"sm501,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,"sm501,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,"sm501,gpio-i2c" , + plat->gpio_i2c, plat->gpio_i2c_nr *5 ); + } +#endif + sm->platdata = plat; + return 0; +} +#endif +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));Signature · 1 line
2.39.2
Signature · 1 line
Lee Jones [李琼斯]
Yoshinori Sato
maintainerRFC PATCH v2 21/30 Documentation/devicetree: sm501fb add properies.
In reply to Yoshinori SatoSM501's OF support is not enough parameter in platform device. This change adds the missing parameter.
--- Documentation/devicetree/bindings/display/sm501fb.txt | 11 +++++++++++ 1 file changed, 11 insertions(+)
Documentation/devicetree/bindings/display/sm501fb.txt +11 -0
@@ -20,6 +20,17 @@ Optional properties: set different foreign endian. - big-endian: available on little endian systems, to set different foreign endian. +- sm501,devices: select peripheral functions. + available usb-host, usb-gadget, ssp0, ssp,1 uart0, uart1, accel, + ac97, i2s, gpio and all. +- sm501,mclk: SM501 mclk frequency. +- sm501,m1xclk: SM501 m1xclk frequency. +- sm501,misc-timing: SM501 Miscellaneous Timing reg value. +- sm501,misc-control: SM501 Miscellaneous Control reg value. +- sm501,gpio-low: SM501 GPIO31-0 Control reg value. +- sm501,gpio-high: SM501 GPIO63-32 Control reg value. +- sm501,num-i2c: I2C channel number. +- sm501,gpio-i2c: I2C assigned GPIO. Example for MPC5200: display@1,0 {
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 21/30] Documentation/devicetree: sm501fb add properies.
Quoted 3 lines · Yoshinori Sato
SM501's OF support is not enough parameter in platform device. This change adds the missing parameter.
NAK, nothing improved here.
Best regards,
Krzysztof
Yoshinori Sato
maintainerRFC PATCH v2 22/30 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
@@ -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
Re: [RFC PATCH v2 22/30] arch/sh: Add dtbs target support.
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
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
Until here, everything is fine.
arch/sh/boot/dts/Makefile line 7
Quoted 3 lines
arch/sh/boot/dts/Makefile +3
-0+dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += landisk.dtb +dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += rts7751r2dplus.dtb +dtb-$(CONFIG_CPU_SUBTYPE_SH7751R) += usl-5p.dtb
These DTS files do not exist yet.
Please update the Makefile in each patch that adds a new DTS file.
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
Yoshinori Sato
maintainerRFC PATCH v2 23/30 arch/sh: Add SH7751 SoC Internal periphreal devicetree.
In reply to Yoshinori Sato--- arch/sh/boot/dts/sh7751.dtsi | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 arch/sh/boot/dts/sh7751.dtsi
arch/sh/boot/dts/sh7751.dtsi new file +76 -0
@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the SH7751 SoC + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> +#include <dt-bindings/clock/sh7750.h> + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + compatible = "renesas,sh7751r","renesas,sh4", "renesas,sh"; + }; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + cpg: cpg@ffc00000 { + #clock-cells = <1>; + compatible = "renesas,sh7750-cpg"; + clocks = <&xtal>; + reg = <0xffc00000 2>, <0xffc00008 4>; + }; + + }; + + shintc: interrupt-controller@ffd00000 { + compatible = "renesas,sh7751-intc"; + #interrupt-cells = <2>; + #address-cells = <0>; + interrupt-controller; + reg = <0xffd00000 14>, <0xfe080000 128>; + }; + + /* sci0 is rarely used, so it is not defined here. */ + scif1: serial@ffe80000 { + compatible = "renesas,scif"; + reg = <0xffe80000 0x100>; + interrupts = <evt2irq(0x700) 0>, + <evt2irq(0x720) 0>, + <evt2irq(0x760) 0>, + <evt2irq(0x740) 0>; + interrupt-names = "eri", "rxi", "bri", "txi"; + clocks = <&cpg SH7750_CPG_FCK>; + }; + + /* Normally ch0 and ch1 are used, so we will define ch0 to ch2 here. */ + tmu0: timer@ffd80008 { + compatible = "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_FCK>; + renesas,channels = <3>; + }; + + pci@fe200000 { + compatible = "renesas,sh7751-pci"; + #address-cells = <3>; + #size-cells = <2>; + ranges = <0x02000000 0 0xfd000000 0xfd000000 0 0x01000000>, + <0x01000000 0 0xfe240000 0xfe240000 0 0x00040000>; + reg = <0xfe200000 0x0400>, + <0x0c000000 0x04000000>, + <0xff800000 0x0030>; + #interrupt-cells = <1>; + }; +};
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 23/30] arch/sh: Add SH7751 SoC Internal periphreal devicetree.
Quoted 16 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>--- arch/sh/boot/dts/sh7751.dtsi | 76 ++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 arch/sh/boot/dts/sh7751.dtsiarch/sh/boot/dts/sh7751.dtsi new file +4
-0@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the SH7751 SoC + */
arch/sh/boot/dts/sh7751.dtsi line 14
Quoted 10 lines
arch/sh/boot/dts/sh7751.dtsi new file +10
-0+ +#include <dt-bindings/interrupt-controller/sh_intc.h> +#include <dt-bindings/clock/sh7750.h> + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + compatible = "renesas,sh7751r","renesas,sh4", "renesas,sh";
Except missing spaces and incorrect indentation, where is this documented? Anyway it looks really odd to use such compatibles for CPUs.
Best regards,
Krzysztof
Re: [RFC PATCH v2 23/30] arch/sh: Add SH7751 SoC Internal periphreal devicetree.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
arch/sh/boot/dts/sh7751.dtsi line 9
Quoted 12 lines
arch/sh/boot/dts/sh7751.dtsi new file +9
-0@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the SH7751 SoC + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> +#include <dt-bindings/clock/sh7750.h> + +/ {
Missing top-level compatible property:
compatible = "renesas,sh7751r";
And of course this compatible value should be documented in Documentation/devicetree/bindings/soc/renesas/renesas.yaml
arch/sh/boot/dts/sh7751.dtsi line 12
Quoted 3 lines
arch/sh/boot/dts/sh7751.dtsi new file +3
-0+ cpus { + #address-cells = <1>; + #size-cells = <0>;
Please add a blank line between properties and subnodes.
arch/sh/boot/dts/sh7751.dtsi line 18
Quoted 6 lines
arch/sh/boot/dts/sh7751.dtsi new file +6
-0+ cpu@0 { + compatible = "renesas,sh7751r","renesas,sh4", "renesas,sh"; + }; + }; + + clocks {
s/clocks/soc/, and move everything below inside the "soc" container.
arch/sh/boot/dts/sh7751.dtsi line 23
Quoted 5 lines
arch/sh/boot/dts/sh7751.dtsi new file +5
-0+ #address-cells = <1>; + #size-cells = <1>; + ranges; + + cpg: cpg@ffc00000 {
Please use generic node names: clock-controller@ffc00000;
Quoted 9 lines
arch/sh/boot/dts/sh7751.dtsi new file +9
-0+ #clock-cells = <1>; + compatible = "renesas,sh7750-cpg"; + clocks = <&xtal>; + reg = <0xffc00000 2>, <0xffc00008 4>; + }; + + }; + + shintc: interrupt-controller@ffd00000 {
arch/sh/boot/dts/sh7751.dtsi line 42
Quoted 10 lines
arch/sh/boot/dts/sh7751.dtsi new file +10
-0+ compatible = "renesas,sh7751-intc"; + #interrupt-cells = <2>; + #address-cells = <0>; + interrupt-controller; + reg = <0xffd00000 14>, <0xfe080000 128>; + }; + + /* sci0 is rarely used, so it is not defined here. */ + scif1: serial@ffe80000 { + compatible = "renesas,scif";
Please add (and document!) "renesas,scif-sh7751".
arch/sh/boot/dts/sh7751.dtsi line 48
Quoted 6 lines
arch/sh/boot/dts/sh7751.dtsi new file +6
-0+ reg = <0xffe80000 0x100>; + interrupts = <evt2irq(0x700) 0>, + <evt2irq(0x720) 0>, + <evt2irq(0x760) 0>, + <evt2irq(0x740) 0>; + interrupt-names = "eri", "rxi", "bri", "txi";
make dtbs_check DT_SCHEMA_FILES=Documentation/devicetree/bindings/serial/renesas,scif.yaml
serial@ffe80000: interrupt-names: 'oneOf' conditional failed, one
must be fixed:
['eri', 'rxi', 'bri', 'txi'] is too short
'txi' was expected
'bri' was expected
The "bri" and "txi" entries must be exchanged, both in the "interrupts" and "interrupt-names" properties.
arch/sh/boot/dts/sh7751.dtsi line 49
Quoted 1 line
arch/sh/boot/dts/sh7751.dtsi new file +1
-0+ clocks = <&cpg SH7750_CPG_FCK>;
clock-names = "fck";
arch/sh/boot/dts/sh7751.dtsi line 54
Quoted 5 lines
arch/sh/boot/dts/sh7751.dtsi new file +5
-0+ }; + + /* Normally ch0 and ch1 are used, so we will define ch0 to ch2 here. */ + tmu0: timer@ffd80008 { + compatible = "renesas,tmu";
Please add (and document!) "renesas,tmu-sh7751".
arch/sh/boot/dts/sh7751.dtsi line 60
Quoted 6 lines
arch/sh/boot/dts/sh7751.dtsi new file +6
-0+ reg = <0xffd80000 12>; + interrupts = <evt2irq(0x400) 0>, + <evt2irq(0x420) 0>, + <evt2irq(0x440) 0>, + <evt2irq(0x460) 0>; + interrupt-names = "tuni0", "tuni1", "tuni2", "ticpi2";
This will need an update to the bindings, and the driver, too.
arch/sh/boot/dts/sh7751.dtsi line 61
Quoted 1 line
arch/sh/boot/dts/sh7751.dtsi new file +1
-0+ clocks = <&cpg SH7750_CPG_FCK>;
clock-names = "fck";
arch/sh/boot/dts/sh7751.dtsi line 63
Quoted 2 lines
arch/sh/boot/dts/sh7751.dtsi new file +2
-0+ renesas,channels = <3>; + };
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
Re: [RFC PATCH v2 23/30] arch/sh: Add SH7751 SoC Internal periphreal devicetree.
In reply to Yoshinori SatoHi Sato-san,
Quoted 20 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>arch/sh/boot/dts/sh7751.dtsi new file +15
-0@@ -0,0 +1,76 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the SH7751 SoC + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> +#include <dt-bindings/clock/sh7750.h> + +/ { + cpus { + #address-cells = <1>; + #size-cells = <0>; + cpu@0 { + compatible = "renesas,sh7751r","renesas,sh4", "renesas,sh"; + };
arch/sh/boot/dts/sh7751.dtsi line 25
Quoted 10 lines
arch/sh/boot/dts/sh7751.dtsi new file +10
-0+ }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + cpg: cpg@ffc00000 { + #clock-cells = <1>; + compatible = "renesas,sh7750-cpg";
renesas,sh7751-cpg?
arch/sh/boot/dts/sh7751.dtsi line 26
Quoted 1 line
arch/sh/boot/dts/sh7751.dtsi new file +1
-0+ clocks = <&xtal>;
Please provide an xtal (or extal) fixed-clock placeholder, to be filled in by the board DTS.
(cfr. extal_clk in arch/arm64/boot/dts/renesas/r8a77951.dtsi)
arch/sh/boot/dts/sh7751.dtsi line 30
Quoted 4 lines
arch/sh/boot/dts/sh7751.dtsi new file +4
-0+ reg = <0xffc00000 2>, <0xffc00008 4>; + }; + + };
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
Yoshinori Sato
maintainerRFC PATCH v2 24/30 include/dt-bindings: Add SH7750 CPG header.
In reply to Yoshinori Sato--- include/dt-bindings/clock/sh7750.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 include/dt-bindings/clock/sh7750.h
include/dt-bindings/clock/sh7750.h new file +13 -0
@@ -0,0 +1,13 @@ +/* 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_FCK 0 +#define SH7750_CPG_BCK 1 +#define SH7750_CPG_ICK 2 + +#endif
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 24/30] include/dt-bindings: Add SH7750 CPG header.
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Empty commit msgs are not acceptable.
Quoted 1 line
---
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.
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.
Quoted 1 line
include/dt-bindings/clock/sh7750.h | 13 +++++++++++++
Missing vendor prefix.
Quoted 10 lines
1 file changed, 13 insertions(+) create mode 100644 include/dt-bindings/clock/sh7750.hinclude/dt-bindings/clock/sh7750.h new file +1
-0@@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
include/dt-bindings/clock/sh7750.h line 11
Quoted 10 lines
include/dt-bindings/clock/sh7750.h new file +10
-0+* +* Copyright 2023 Yoshinori Sato +*/ + +#ifndef __DT_BINDINGS_CLOCK_SH7750_H__ +#define __DT_BINDINGS_CLOCK_SH7750_H__ + +#define SH7750_CPG_FCK 0 +#define SH7750_CPG_BCK 1 +#define SH7750_CPG_ICK 2
This should be squashed with the patch bringing bindings for this device. It does not make sense on its own.
Best regards,
Krzysztof
Re: [RFC PATCH v2 24/30] include/dt-bindings: Add SH7750 CPG header.
Hi Krzysztof,
Quoted 6 lines · Krzysztof Kozlowski
Quoted 3 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>include/dt-bindings/clock/sh7750.h | 13 +++++++++++++Missing vendor prefix.
None of the clock binding definitions for Renesas SoCs use a vendor prefix. The same is true for various other vendors.
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
Re: [RFC PATCH v2 24/30] include/dt-bindings: Add SH7750 CPG header.
Quoted 4 lines · Geert Uytterhoeven
Hi Krzysztof,
Quoted 1 line · Krzysztof Kozlowski
On 13/09/2023 11:23, Yoshinori Sato wrote:
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Signed-off-by Yoshinori Sato <[email protected]>include/dt-bindings/clock/sh7750.h | 13 +++++++++++++Missing vendor prefix.
None of the clock binding definitions for Renesas SoCs use a vendor prefix. The same is true for various other vendors.
So how about start using them for new bindings. :)
Best regards,
Krzysztof
Re: [RFC PATCH v2 24/30] include/dt-bindings: Add SH7750 CPG header.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 1 line
include/dt-bindings/clock/sh7750.h | 13 +++++++++++++
This is a dependency for both the clock driver and the various DTS files, so it should be moved up in the series.
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
Yoshinori Sato
maintainerRFC PATCH v2 25/30 include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
In reply to Yoshinori Sato--- arch/sh/boot/dts/include/dt-bindings | 1 + include/dt-bindings/interrupt-controller/sh_intc.h | 7 +++++++ 2 files changed, 8 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
@@ -0,0 +1 @@ +../../../../../include/dt-bindings
include/dt-bindings/interrupt-controller/sh_intc.h new file +7 -0
@@ -0,0 +1,7 @@ +/* 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)
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Quoted 14 lines · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>--- arch/sh/boot/dts/include/dt-bindings | 1 + include/dt-bindings/interrupt-controller/sh_intc.h | 7 +++++++ 2 files changed, 8 insertions(+) create mode 120000 arch/sh/boot/dts/include/dt-bindings create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.harch/sh/boot/dts/include/dt-bindings new file +0
-0
arch/sh/boot/dts/include/dt-bindings line 1
Quoted 2 lines
arch/sh/boot/dts/include/dt-bindings new file +1
-0@@ -0,0 +1 @@ +../../../../../include/dt-bindings
Nothing improved here.
This is a friendly reminder during the review process.
It seems my previous comments were not fully addressed. Maybe my feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
include/dt-bindings/interrupt-controller/sh_intc.h line 7
Quoted 13 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +7
-0@@ -0,0 +1,7 @@ +/* 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)
No, that's not a binding. Drop entire file.
Best regards,
Krzysztof
Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Hi Krzysztof,
Quoted 13 lines · Krzysztof Kozlowski
include/dt-bindings/interrupt-controller/sh_intc.h line 7
Quoted 10 lines · Yoshinori Sato
include/dt-bindings/interrupt-controller/sh_intc.h new file +7
-0@@ -0,0 +1,7 @@ +/* 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)No, that's not a binding. Drop entire file.
The issue is that the hardware documentation does not list interrupt numbers, but event codes. The latter is a sparse address space. As the "interrupts" property needs interrupt numbers, we have two options:
1. Use hardcoded event codes and evt2irq() in DTS files.
This is the approach Sato-san took,
2. Use hardcoded interrupt numbers in DTS files.
This would avoids the need for the evt2irq() macro in the DT bindings, but would make life slightly harder for the DTS writer and for the casual reader, as the conversion needs to be done in one's head.
Note that the documentation for later SoCs that contain both a SuperH and an ARM CPU core, usually lists both the event code and the interrupt number, although the latter may be offset by 32 due to the SPI interrupt base.
I agree we do not need irq2evt() in DTS, though.
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
Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Quoted 29 lines · Geert Uytterhoeven
Hi Krzysztof,
Quoted 13 lines · Krzysztof Kozlowski
include/dt-bindings/interrupt-controller/sh_intc.h line 7
Quoted 10 lines · Yoshinori Sato
include/dt-bindings/interrupt-controller/sh_intc.h new file +7
-0@@ -0,0 +1,7 @@ +/* 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)No, that's not a binding. Drop entire file.
The issue is that the hardware documentation does not list interrupt numbers, but event codes. The latter is a sparse address space. As the "interrupts" property needs interrupt numbers, we have two options:
1. Use hardcoded event codes andevt2irq()in DTS files.
This is the approach Sato-san took,
2. Use hardcoded interrupt numbers in DTS files.
This would avoids the need for theevt2irq()macro in the DT bindings, but would make life slightly harder for the DTS writer and for the casual reader, as the conversion needs to be done in one's head.
Quoted 6 lines
Note that the documentation for later SoCs that contain both a SuperH and an ARM CPU core, usually lists both the event code and the interrupt number, although the latter may be offset by 32 due to the SPI interrupt base.
I agree we do not need
irq2evt()in DTS, though.
Is the macro used by the drivers? I have a feeling that not, so it would not be suitable for the bindings, but rather as a header included in the DTS.
Best regards,
Krzysztof
Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
Hi Krzysztof,
Quoted 33 lines · Krzysztof Kozlowski
Quoted 32 lines · Geert Uytterhoeven
Quoted 13 lines · Krzysztof Kozlowski
include/dt-bindings/interrupt-controller/sh_intc.h line 7
Quoted 10 lines · Yoshinori Sato
include/dt-bindings/interrupt-controller/sh_intc.h new file +7
-0@@ -0,0 +1,7 @@ +/* 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)No, that's not a binding. Drop entire file.
The issue is that the hardware documentation does not list interrupt numbers, but event codes. The latter is a sparse address space. As the "interrupts" property needs interrupt numbers, we have two options:
1. Use hardcoded event codes andevt2irq()in DTS files.
This is the approach Sato-san took,
2. Use hardcoded interrupt numbers in DTS files.
This would avoids the need for theevt2irq()macro in the DT bindings, but would make life slightly harder for the DTS writer and for the casual reader, as the conversion needs to be done in one's head.Note that the documentation for later SoCs that contain both a SuperH and an ARM CPU core, usually lists both the event code and the interrupt number, although the latter may be offset by 32 due to the SPI interrupt base.
Quoted 5 lines
Quoted 1 line
I agree we do not need
irq2evt()in DTS, though.Is the macro used by the drivers? I have a feeling that not, so it would not be suitable for the bindings, but rather as a header included in the DTS.
You mean irq2evt()? No, the new DT-aware drivers avoid the conversion from IRQ numbers to events codes by storing evt2irq() values in the interrupt table (see drivers/irqchip/irq-renesas-sh7751.c:iprmaps[]).
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
Re: [RFC PATCH v2 25/30] include/dt-bindings: Add sh_intc IRQ - EVT conversion helper
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
arch/sh/boot/dts/include/dt-bindings line 1
Quoted 13 lines
arch/sh/boot/dts/include/dt-bindings | 1 + include/dt-bindings/interrupt-controller/sh_intc.h | 7 +++++++ 2 files changed, 8 insertions(+) create mode 120000 arch/sh/boot/dts/include/dt-bindings create mode 100644 include/dt-bindings/interrupt-controller/sh_intc.harch/sh/boot/dts/include/dt-bindings new file +1
-0@@ -0,0 +1 @@ +../../../../../include/dt-bindings
Do you need this symlink? All other architectures do without.
include/dt-bindings/interrupt-controller/sh_intc.h
Quoted 2 lines
include/dt-bindings/interrupt-controller/sh_intc.h new file +0
-0
This is used by the DTS files, so this patch should be moved up in this series.
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
Yoshinori Sato
maintainerRFC PATCH v2 26/30 arch/sh: RTS7751R2D Plus DeviceTree.
In reply to Yoshinori Sato--- arch/sh/boot/dts/rts7751r2dplus.dts | 124 ++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 arch/sh/boot/dts/rts7751r2dplus.dts
arch/sh/boot/dts/rts7751r2dplus.dts new file +124 -0
@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi" + +/ { + model = "Renesas RTS7715R2D Plus"; + compatible = "renesas,r2dplus"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + }; + + chosen { + }; + + clocks { + xtal: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + }; + + cpg: cpg@ffc00000 { + compatible = "renesas,sh7750r-cpg", + "renesas,sh7750-cpg"; + renesas,mode = <5>; + }; + }; + + cpus { + cpu@0 { + clock-frequency = <266666666>; + }; + }; + + memory@c000000 { + device_type = "memory"; + reg = <0x0c000000 0x4000000>; + }; + + r2dintc: sh7751irl_encoder@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <16>; + sh7751irl,polarity = <0>; + sh7751irl,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 0>; + mode = "640x480-16@60"; + little-endian; + sm501,devices = "usb-host","uart0"; + }; + + compact-flash@b4001000 { + compatible = "ata-generic"; + reg = <0xb4001000 0x0e>, <0xb400080c 2>; + reg-shift = <1>; + interrupt-parent = <&r2dintc>; + interrupts = <1 0>; + }; + + 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>; + }; + }; + + pci@fe200000 { + compatible = "renesas,r2d-pci", "renesas,sh7751-pci"; + #interrupt-cells = <1>; + interrupt-parent = <&r2dintc>; + eth@2,0 { + reg = <0x1000 0 0 0 0>; + interrupts = <3 0>; + }; + }; +};
Signature · 1 line
2.39.2
Re: [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree.
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
No improvements in commit msg. No improvements in subject.
Quoted 13 lines
--- arch/sh/boot/dts/rts7751r2dplus.dts | 124 ++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 arch/sh/boot/dts/rts7751r2dplus.dtsarch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/*
arch/sh/boot/dts/rts7751r2dplus.dts line 12
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi" + +/ { + model = "Renesas RTS7715R2D Plus"; + compatible = "renesas,r2dplus";
Missing bindings documentation. Incomplete compatible - missing SoC.
Sorry, but this is nowhere ready for review. There are so many trivial issues to fix.
Best regards,
Krzysztof
Re: [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 14 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +11
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi" + +/ { + model = "Renesas RTS7715R2D Plus";
arch/sh/boot/dts/rts7751r2dplus.dts line 21
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ compatible = "renesas,r2dplus"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + }; + + chosen {
I had to add
stdout-path = "serial0:115200n8";
to get serial console output on qemu/r2d.
arch/sh/boot/dts/rts7751r2dplus.dts line 22
Quoted 1 line
arch/sh/boot/dts/rts7751r2dplus.dts new file +1
-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
Re: [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
arch/sh/boot/dts/rts7751r2dplus.dts line 8
Quoted 11 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi"
#include "sh7751r.dtsi"?
To make that work, you can create "sh7751.dtsi" that includes "sh7751.dtsi" and overrides the parts that are different.
arch/sh/boot/dts/rts7751r2dplus.dts line 12
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ +/ { + model = "Renesas RTS7715R2D Plus"; + compatible = "renesas,r2dplus";
compatible = "renesas,r2dplus", "renesas,sh7751r", "renesas,sh7751".
And all these compatible values must be documented in the DT binding documentation.
Quoted 7 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +7
-0+ #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + };
arch/sh/boot/dts/rts7751r2dplus.dts line 29
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ + chosen { + }; + + clocks { + xtal: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + };
Please
arch/sh/boot/dts/rts7751r2dplus.dts line 31
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ + cpg: cpg@ffc00000 {
"&cpg"?
arch/sh/boot/dts/rts7751r2dplus.dts line 33
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ compatible = "renesas,sh7750r-cpg", + "renesas,sh7750-cpg";
There should be no need to override the cpg's compatible value.
arch/sh/boot/dts/rts7751r2dplus.dts line 40
Quoted 7 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +7
-0+ renesas,mode = <5>; + }; + }; + + cpus { + cpu@0 { + clock-frequency = <266666666>;
As the CPU clock is programmable, the "clock-frequency" property should probably be replaced by a "clocks" property in the base sh7751.dtsi.
Quoted 34 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +34
-0+ }; + }; + + memory@c000000 { + device_type = "memory"; + reg = <0x0c000000 0x4000000>; + }; + + r2dintc: sh7751irl_encoder@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <16>; + sh7751irl,polarity = <0>; + sh7751irl,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
arch/sh/boot/dts/rts7751r2dplus.dts line 84
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ 0x13e00000 0x00200000>; + interrupt-parent = <&r2dintc>; + interrupts = <4 0>; + mode = "640x480-16@60"; + little-endian; + sm501,devices = "usb-host","uart0"; + }; + + compact-flash@b4001000 { + compatible = "ata-generic";
compact-flash@b4001000: compatible:0: 'ata-generic' is not one of ['arm,vexpress-cf', 'fsl,mpc8349emitx-pata']
from schema $id: http://devicetree.org/schemas/ata/ata-generic.yaml#
Quoted 8 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8
-0+ reg = <0xb4001000 0x0e>, <0xb400080c 2>; + reg-shift = <1>; + interrupt-parent = <&r2dintc>; + interrupts = <1 0>; + }; + + flash@0 { + compatible = "cfi-flash";
arch/sh/boot/dts/rts7751r2dplus.dts line 102
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ reg = <0x00000000 0x02000000>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "U-Boot"; + reg = <0x00000000 0x00040000>; + }; + partition@1 { + label = "Environemt";
Environment
arch/sh/boot/dts/rts7751r2dplus.dts line 104
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ reg = <0x00040000 0x00040000>; + };
Several of the above comments apply to "[RFC PATCH v2 27/30] arch/sh: LANDISK DeviceTree." and "[RFC PATCH v2 28/30] arch/sh:
USL-5P DeviceTree.", too.
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
Yoshinori Sato
maintainerRe: [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree.
Quoted 23 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
arch/sh/boot/dts/rts7751r2dplus.dts line 8
Quoted 11 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi"#include "
sh7751r.dtsi"?
Quoted 2 lines
To make that work, you can create "
sh7751.dtsi" that includes "sh7751.dtsi" and overrides the parts that are different.
The only difference between 7751 and 7751R is CPG, so I don't differentiate between them.
Shall we write the CPG differences in sh7751r.dtsi?
Quoted 138 lines
arch/sh/boot/dts/rts7751r2dplus.dts line 12
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ +/ { + model = "Renesas RTS7715R2D Plus"; + compatible = "renesas,r2dplus";compatible = "renesas,r2dplus", "renesas,sh7751r", "renesas,sh7751".
And all these compatible values must be documented in the DT binding documentation.
Quoted 7 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +7
-0+ #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + };arch/sh/boot/dts/rts7751r2dplus.dts line 29
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ + chosen { + }; + + clocks { + xtal: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + };Please
arch/sh/boot/dts/rts7751r2dplus.dts line 31
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ + cpg: cpg@ffc00000 {"&cpg"?
arch/sh/boot/dts/rts7751r2dplus.dts line 33
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ compatible = "renesas,sh7750r-cpg", + "renesas,sh7750-cpg";There should be no need to override the cpg's compatible value.
arch/sh/boot/dts/rts7751r2dplus.dts line 40
Quoted 7 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +7
-0+ renesas,mode = <5>; + }; + }; + + cpus { + cpu@0 { + clock-frequency = <266666666>;As the CPU clock is programmable, the "clock-frequency" property should probably be replaced by a "clocks" property in the base
sh7751.dtsi.Quoted 34 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +34
-0+ }; + }; + + memory@c000000 { + device_type = "memory"; + reg = <0x0c000000 0x4000000>; + }; + + r2dintc: sh7751irl_encoder@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xa4000000 0x02>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <16>; + sh7751irl,polarity = <0>; + sh7751irl,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 0x03e00000arch/sh/boot/dts/rts7751r2dplus.dts line 84
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ 0x13e00000 0x00200000>; + interrupt-parent = <&r2dintc>; + interrupts = <4 0>; + mode = "640x480-16@60"; + little-endian; + sm501,devices = "usb-host","uart0"; + }; + + compact-flash@b4001000 { + compatible = "ata-generic";compact-flash@b4001000: compatible:0: 'ata-generic' is not one of ['arm,vexpress-cf', 'fsl,mpc8349emitx-pata']
from schema $id: http://devicetree.org/schemas/ata/ata-generic.yaml#Quoted 8 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8
-0+ reg = <0xb4001000 0x0e>, <0xb400080c 2>; + reg-shift = <1>; + interrupt-parent = <&r2dintc>; + interrupts = <1 0>; + }; + + flash@0 { + compatible = "cfi-flash";arch/sh/boot/dts/rts7751r2dplus.dts line 102
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ reg = <0x00000000 0x02000000>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + partition@0 { + label = "U-Boot"; + reg = <0x00000000 0x00040000>; + }; + partition@1 { + label = "Environemt";Environment
arch/sh/boot/dts/rts7751r2dplus.dts line 104
Quoted 2 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +2
-0+ reg = <0x00040000 0x00040000>; + };Several of the above comments apply to "[RFC PATCH v2 27/30]
arch/sh: LANDISK DeviceTree." and "[RFC PATCH v2 28/30]arch/sh:
USL-5P DeviceTree.", too.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 · 1 line
Yosinori Sato
Re: [RFC PATCH v2 26/30] arch/sh: RTS7751R2D Plus DeviceTree.
Hi Sato-san,
Quoted 22 lines · Yoshinori Sato
Quoted 20 lines · Geert Uytterhoeven
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
arch/sh/boot/dts/rts7751r2dplus.dts line 8
Quoted 11 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +8
-0@@ -0,0 +1,124 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the Renesas RTS7751R2D Plus + */ + +/dts-v1/; + +#include "sh7751.dtsi"#include "
sh7751r.dtsi"?
Quoted 7 lines
Quoted 2 lines
To make that work, you can create "
sh7751.dtsi" that includes "sh7751.dtsi" and overrides the parts that are different.The only difference between 7751 and 7751R is CPG, so I don't differentiate between them.
Shall we write the CPG differences in
sh7751r.dtsi?
Yes please.
That way the .dts board file for a board with SH7751 can include sh7751.dtsi, and the .dts board file for a board with SH7751R can include sh7751r.dtsi. All common parts should be put in sh7751.dtsi, to avoid duplication.
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
Yoshinori Sato
maintainerRFC PATCH v2 27/30 arch/sh: LANDISK DeviceTree.
In reply to Yoshinori Sato--- arch/sh/boot/dts/landisk.dts | 103 +++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 arch/sh/boot/dts/landisk.dts
arch/sh/boot/dts/landisk.dts new file +103 -0
@@ -0,0 +1,103 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the IO DATA DEVICE LANDISK + */ + + +/dts-v1/; + +#include "sh7751.dtsi" + +/ { + model = "IO-DATA Device LANDISK"; + compatible = "iodata,landisk", "renesas,sh7751r"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + }; + + chosen { + stdout-path = "serial0:9600n8"; + }; + + clocks { + xtal: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + }; + + cpg: cpg@ffc00000 { + compatible = "renesas,sh7750r-cpg", + "renesas,sh7750-cpg"; + renesas,mode = <5>; + }; + }; + + cpus { + cpu@0 { + clock-frequency = <266666666>; + }; + }; + memory@c000000 { + device_type = "memory"; + reg = <0x0c000000 0x4000000>; + }; + + julianintc: sh7751irl_encoder@a4000000 { + compatible = "renesas,sh7751-irl-ext"; + reg = <0xb0000005 0x01>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <8>; + sh7751irl,polarity = <0>; + sh7751irl,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 */ + }; + + pci@fe200000 { + compatible = "iodata,julian-pci", "renesas,sh7751-pci"; + #interrupt-cells = <1>; + interrupt-parent = <&julianintc>; + eth@0,0 { + reg = <0x0000 0 0 0 0>; + interrupts = <5 0>; + interrupt-names = "eth"; + }; + ata@1,0 { + reg = <0x0800 0 0 0 0>; + interrupts = <6 0>; + interrupt-names = "ata"; + }; + usb@2,0 { + reg = <0x1000 0 0 0 0>; + interrupts = <7 0>; + interrupt-names = "ochi"; + }; + usb@2,1 { + reg = <0x1100 0 0 0 0>; + interrupts = <8 0>; + interrupt-names = "ohci"; + }; + usb@2,2 { + reg = <0x1200 0 0 0 0>; + interrupts = <5 0>; + interrupt-names = "ehci"; + }; + }; +};
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerRFC PATCH v2 28/30 arch/sh: USL-5P DeviceTree.
In reply to Yoshinori Sato--- arch/sh/boot/dts/usl-5p.dts | 106 ++++++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 arch/sh/boot/dts/usl-5p.dts
arch/sh/boot/dts/usl-5p.dts new file +106 -0
@@ -0,0 +1,106 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree Source for the IO DATA DEVICE USL-5P + */ + +/dts-v1/; + +#include "sh7751.dtsi" + +/ { + model = "IO-DATA Device USL-5P"; + compatible = "iodata,usl-5p"; + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>; + + aliases { + serial0 = &scif1; + }; + + chosen { + stdout-path = "serial0:9600n8"; + }; + + clocks { + xtal: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + }; + + cpg: cpg@ffc00000 { + compatible = "renesas,sh7750r-cpg", + "renesas,sh7750-cpg"; + renesas,mode = <5>; + }; + }; + + cpus { + cpu@0 { + clock-frequency = <266666666>; + }; + }; + + memory@c000000 { + device_type = "memory"; + reg = <0x0c000000 0x4000000>; + }; + + julianintc: sh7751irl_encoder@a4000000 { + compatible ="renesas,sh7751-irl-ext"; + reg = <0xb0000005 0x01>; + interrupt-controller; + #address-cells = <1>; + #interrupt-cells = <2>; + sh7751irl,width = <8>; + sh7751irl,polarity = <0>; + sh7751irl,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 */ + }; + + compact-flash@b4001000 { + compatible = "ata-generic"; + reg = <0xb4000040 0x0e>, <0xb400002c 2>; + reg-shift = <1>; + interrupt-parent = <&julianintc>; + interrupts = <10 0>; + }; + + pci@fe200000 { + compatible = "iodata,julian-pci", "renesas,sh7751-pci"; + #interrupt-cells = <1>; + interrupt-parent = <&julianintc>; + eth@0,0 { + reg = <0x0000 0 0 0 0>; + interrupts = <5 0>; + interrupt-names = "eth"; + }; + usb@2,0 { + reg = <0x1000 0 0 0 0>; + interrupts = <7 0>; + interrupt-names = "ochi"; + }; + usb@2,1 { + reg = <0x1100 0 0 0 0>; + interrupts = <8 0>; + interrupt-names = "ohci"; + }; + usb@2,2 { + reg = <0x1200 0 0 0 0>; + interrupts = <5 0>; + interrupt-names = "ehci"; + }; + }; +};
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerRFC PATCH v2 29/30 arch/sh: RTS7751R2D Plus OF defconfig
In reply to Yoshinori Sato--- arch/sh/configs/rts7751r2dplus-of_defconfig | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 arch/sh/configs/rts7751r2dplus-of_defconfig
arch/sh/configs/rts7751r2dplus-of_defconfig new file +93 -0
@@ -0,0 +1,93 @@ +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_CMDLINE_OVERWRITE=y +CONFIG_CMDLINE="console=tty0 console=ttySC1,115200 root=/dev/sda1" +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_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_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_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_INIT_STACK_NONE=y +CONFIG_CRC_T10DIF=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_FTRACE is not set
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerRFC PATCH v2 30/30 arch/sh: LANDISK OF defconfig
In reply to Yoshinori Sato--- arch/sh/configs/landisk-of_defconfig | 110 +++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 arch/sh/configs/landisk-of_defconfig
arch/sh/configs/landisk-of_defconfig new file +110 -0
@@ -0,0 +1,110 @@ +CONFIG_SYSVIPC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_NAMESPACES=y +CONFIG_EXPERT=y +CONFIG_CPU_SUBTYPE_SH7751R=y +CONFIG_MEMORY_START=0x0c000000 +CONFIG_SH_OF_BOARD=y +CONFIG_HEARTBEAT=y +CONFIG_KEXEC=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_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_ATP867X=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