DeviceTree support for SH7751 based boards.
Subsystems (12)
Yoshinori Sato
maintainercover DeviceTree support for SH7751 based boards.
I sent it yesterday but it wasn't delivered so I'm resending it.
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.
Yoshinori Sato (12):
sh: Add OF target boards.
sh: Update OF handling.
sh: SH4 OF support.
clk: SH7750 / 7751 clk driver.
drivers/irqchip: Add SH7751 and boards specific irqchip. drivers/pci: Add SH7751 PCI Host bridge driver.
clocksource: Update sh_tmu of handling. mfd/sm501: Add OF properties.
of: FDT vaddr support for SH.
serial/sh-sci: Fix earlyprintk / earlycon.
sh: target dts.
sh: OF defconfig.
.../devicetree/bindings/display/sm501fb.txt | 11 + arch/sh/Kconfig | 12 +- arch/sh/boards/Kconfig | 28 ++ arch/sh/boards/of-generic.c | 28 +- arch/sh/boot/compressed/head_32.S | 5 +- arch/sh/boot/dts/include/dt-bindings | 1 + arch/sh/boot/dts/landisk.dts | 142 +++++++ arch/sh/boot/dts/rts7751r2dplus.dts | 168 ++++++++ arch/sh/boot/dts/usl-5p.dts | 146 +++++++ arch/sh/configs/landisk-of_defconfig | 161 ++++++++ arch/sh/configs/rts7751r2dplus-of_defconfig | 159 ++++++++ arch/sh/drivers/Makefile | 2 + arch/sh/include/asm/io.h | 10 + arch/sh/include/asm/pci.h | 4 + arch/sh/kernel/cpu/Makefile | 8 +- arch/sh/kernel/cpu/clock.c | 3 +- arch/sh/kernel/cpu/sh4/Makefile | 2 + arch/sh/kernel/head_32.S | 2 +- arch/sh/kernel/setup.c | 26 +- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/sh/Kconfig | 7 + drivers/clk/sh/Makefile | 2 + drivers/clk/sh/clk-sh7750.c | 193 +++++++++ drivers/clk/sh/clk-shdiv.c | 341 ++++++++++++++++ drivers/clocksource/sh_tmu.c | 33 +- drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-iodata-julian.c | 163 ++++++++ drivers/irqchip/irq-renesas-r2d.c | 175 ++++++++ drivers/irqchip/irq-renesas-sh7751.c | 186 +++++++++ drivers/mfd/sm501.c | 113 +++++- drivers/of/fdt.c | 3 + drivers/pci/controller/Kconfig | 9 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pci-sh7751.c | 382 ++++++++++++++++++ drivers/pci/controller/pci-sh7751.h | 267 ++++++++++++ drivers/sh/Makefile | 2 + drivers/tty/serial/sh-sci.c | 10 +- 39 files changed, 2779 insertions(+), 33 deletions(-) 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/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/sh/Kconfig create mode 100644 drivers/clk/sh/Makefile create mode 100644 drivers/clk/sh/clk-sh7750.c create mode 100644 drivers/clk/sh/clk-shdiv.c create mode 100644 drivers/irqchip/irq-iodata-julian.c create mode 100644 drivers/irqchip/irq-renesas-r2d.c create mode 100644 drivers/irqchip/irq-renesas-sh7751.c create mode 100644 drivers/pci/controller/pci-sh7751.c create mode 100644 drivers/pci/controller/pci-sh7751.h
Signature · 1 line
2.39.2
Yoshinori Sato
maintainerRFC PATCH 1/12 sh: Add OF target boards.
--- arch/sh/Kconfig | 12 +++++++++--- arch/sh/boards/Kconfig | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-)
arch/sh/Kconfig +9 -3
@@ -64,10 +64,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
@@ -363,14 +363,17 @@ config CPU_SUBTYPE_SH7091 config CPU_SUBTYPE_SH7750R bool "Support SH7750R processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK config CPU_SUBTYPE_SH7750S bool "Support SH7750S processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK config CPU_SUBTYPE_SH7751 bool "Support SH7751 processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK help Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU, or if you have a HD6417751R CPU.
@@ -378,6 +381,8 @@ config CPU_SUBTYPE_SH7751 config CPU_SUBTYPE_SH7751R bool "Support SH7751R processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK + select PCI_SH7751 if SH_DEVICE_TREE config CPU_SUBTYPE_SH7760 bool "Support SH7760 processor"
@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OF default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"
@@ -744,6 +749,7 @@ config ROMIMAGE_MMCIF choice prompt "Kernel command line" optional + depends on !SH_DEVICE_TREE default CMDLINE_OVERWRITE help Setting this option allows the kernel command line arguments
arch/sh/boards/Kconfig +28 -0
@@ -16,9 +16,14 @@ config SH_DEVICE_TREE bool select OF select OF_EARLY_FLATTREE + select OF_ADDRESS select TIMER_OF select COMMON_CLK select GENERIC_CALIBRATE_DELAY + select GENERIC_IOMAP + select GENERIC_IRQ_CHIP + select SYS_SUPPORTS_PCI + select GENERIC_PCI_IOMAP if PCI config SH_JCORE_SOC bool "J-Core SoC"
@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \
@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree. config SH_TITAN bool "TITAN"
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 8 lines
arch/sh/Kconfig +1
-0@@ -363,14 +363,17 @@ config CPU_SUBTYPE_SH7091 config CPU_SUBTYPE_SH7750R bool "Support SH7750R processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK
arch/sh/Kconfig config CPU_SUBTYPE_SH7091 · line 376
Quoted 10 lines
arch/sh/Kconfig +2
-0config CPU_SUBTYPE_SH7750S bool "Support SH7750S processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK config CPU_SUBTYPE_SH7751 bool "Support SH7751 processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK
Might be easier to handle this in the clock Kconfig, cfr. the various conditional selects at the top of drivers/clk/renesas/Kconfig
Quoted 14 lines
arch/sh/Kconfig +2
-0help Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU, or if you have a HD6417751R CPU.@@ -378,6 +381,8 @@ config CPU_SUBTYPE_SH7751 config CPU_SUBTYPE_SH7751R bool "Support SH7751R processor" select CPU_SH4 + select COMMON_CLK_SH7750 if COMMMON_CLK + select PCI_SH7751 if SH_DEVICE_TREE config CPU_SUBTYPE_SH7760 bool "Support SH7760 processor"
arch/sh/Kconfig config ROMIMAGE_MMCIF · line 752
Quoted 4 lines
arch/sh/Kconfig +1
-0@@ -744,6 +749,7 @@ config ROMIMAGE_MMCIF choice prompt "Kernel command line" optional + depends on !SH_DEVICE_TREE
Why? On other architectures, overriding the kernel command line is supported. This is also useful in case of a builtin DTB.
arch/sh/boards/Kconfig config SH_DEVICE_TREE · line 19
Quoted 12 lines
arch/sh/Kconfig +0
-0default CMDLINE_OVERWRITE help Setting this option allows the kernel command line argumentsarch/sh/boards/Kconfig +1
-0@@ -16,9 +16,14 @@ config SH_DEVICE_TREE bool select OF select OF_EARLY_FLATTREE + select OF_ADDRESS
Not needed, as it is already enabled:
config OF_ADDRESS
def_bool y
depends on !SPARC && (HAS_IOMEM || UML)Quoted 11 lines
arch/sh/boards/Kconfig +4
-0select TIMER_OF select COMMON_CLK select GENERIC_CALIBRATE_DELAY + select GENERIC_IOMAP + select GENERIC_IRQ_CHIP + select SYS_SUPPORTS_PCI + select GENERIC_PCI_IOMAP if PCI config SH_JCORE_SOC bool "J-Core SoC"
arch/sh/boards/Kconfig config SH_RTS7751R2D · line 175
Quoted 10 lines
arch/sh/boards/Kconfig +7
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK
SH_DEVICE_TREE already selects COMMON_CLK.
(same for landisk)
arch/sh/boards/Kconfig config SH_RTS7751R2D · line 182
Quoted 7 lines
arch/sh/boards/Kconfig +4
-0+ help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \
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
Re: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
In reply to Yoshinori SatoHi Sato-san,
arch/sh/Kconfig config BUILTIN_DTB_SOURCE · line 710
Quoted 9 lines · Yoshinori Sato
arch/sh/Kconfig +1
-1@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OF
This is the only user of SH_RTS7751R2D_OF. Can we get rid of it?
Quoted 35 lines
arch/sh/Kconfig +0
-0default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"arch/sh/boards/Kconfig +18
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R
arch/sh/boards/Kconfig config SH_LANDISK · line 335
Quoted 10 lines
arch/sh/boards/Kconfig +5
-0+ select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree. config SH_TITAN bool "TITAN"
Apart from the above, there are no users of the "<machine>_OF" symbols. Do we need them?
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: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
Quoted 65 lines · Geert Uytterhoeven
Hi Sato-san,
arch/sh/Kconfig config BUILTIN_DTB_SOURCE · line 710
Quoted 9 lines · Yoshinori Sato
arch/sh/Kconfig +1
-1@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OFThis is the only user of
SH_RTS7751R2D_OF. Can we get rid of it?Quoted 35 lines
arch/sh/Kconfig +0
-0default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"arch/sh/boards/Kconfig +18
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751Rarch/sh/boards/Kconfig config SH_LANDISK · line 335
Quoted 10 lines
arch/sh/boards/Kconfig +5
-0+ select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree. config SH_TITAN bool "TITAN"Apart from the above, there are no users of the "<machine>_OF" symbols. Do we need them?
Signature · 1 line
Yosinori Sato
John Paul Adrian Glaubitz
maintainerRe: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
Hi Yoshinori!
Quoted 62 lines · Yoshinori Sato
Quoted 60 lines · Geert Uytterhoeven
Hi Sato-san,
arch/sh/Kconfig config BUILTIN_DTB_SOURCE · line 710
Quoted 9 lines · Yoshinori Sato
arch/sh/Kconfig +1
-1@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OFThis is the only user of
SH_RTS7751R2D_OF. Can we get rid of it?Quoted 43 lines
arch/sh/Kconfig +0
-0default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"arch/sh/boards/Kconfig +23
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree.
Quoted 5 lines
Quoted 5 lines
arch/sh/boards/Kconfig config SH_LANDISK · line 335
Quoted 2 lines
arch/sh/boards/Kconfig +0
-0config SH_TITAN bool "TITAN"Apart from the above, there are no users of the "<machine>_OF" symbols. Do we need them?
Did you accidentally sent this mail before commenting?
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Yoshinori Sato
maintainerRe: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
Quoted 66 lines · John Paul Adrian Glaubitz
Hi Yoshinori!
Quoted 62 lines · Yoshinori Sato
Quoted 60 lines · Geert Uytterhoeven
Hi Sato-san,
arch/sh/Kconfig config BUILTIN_DTB_SOURCE · line 710
Quoted 9 lines · Yoshinori Sato
arch/sh/Kconfig +1
-1@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OFThis is the only user of
SH_RTS7751R2D_OF. Can we get rid of it?Quoted 43 lines
arch/sh/Kconfig +0
-0default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"arch/sh/boards/Kconfig +23
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree.
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
arch/sh/boards/Kconfig config SH_LANDISK · line 335
Quoted 2 lines
arch/sh/boards/Kconfig +0
-0config SH_TITAN bool "TITAN"Apart from the above, there are no users of the "<machine>_OF" symbols. Do we need them?
Did you accidentally sent this mail before commenting?
Ouch Yes. I'll put it out again.
Quoted 7 lines
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Signature · 1 line
Yosinori Sato
Yoshinori Sato
maintainerRe: [RESEND RFC PATCH 01/12] sh: Add OF target boards.
In reply to Geert UytterhoevenQuoted 60 lines · Geert Uytterhoeven
Hi Sato-san,
arch/sh/Kconfig config BUILTIN_DTB_SOURCE · line 710
Quoted 9 lines · Yoshinori Sato
arch/sh/Kconfig +1
-1@@ -702,7 +707,7 @@ config BUILTIN_DTB_SOURCE config ZERO_PAGE_OFFSET hex default "0x00010000" if PAGE_SIZE_64KB || SH_RTS7751R2D || \ - SH_7751_SOLUTION_ENGINE + SH_7751_SOLUTION_ENGINE || SH_RTS7751R2D_OFThis is the only user of
SH_RTS7751R2D_OF. Can we get rid of it?Quoted 43 lines
arch/sh/Kconfig +0
-0default "0x00004000" if PAGE_SIZE_16KB || SH_SH03 default "0x00002000" if PAGE_SIZE_8KB default "0x00001000"arch/sh/boards/Kconfig +23
-0@@ -161,6 +166,17 @@ config SH_RTS7751R2D Select RTS7751R2D if configuring for a Renesas Technology Sales SH-Graphics board. +config SH_RTS7751R2D_OF + bool "RTS7751R2D (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select IO_TRAPPED if MMU + select SH_DEVICE_TREE + select COMMON_CLK + help + Select RTS7751R2D if configuring for a Renesas Technology + Sales SH-Graphics board. (Use DeviceTree) + config SH_RSK bool "Renesas Starter Kit" depends on CPU_SUBTYPE_SH7201 || CPU_SUBTYPE_SH7203 || \@@ -300,8 +316,20 @@ 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. + +config SH_LANDISK_OF + bool "LANDISK (DeviceTree)" + depends on CPU_SUBTYPE_SH7751R + select HAVE_PCI + select SYS_SUPPORTS_PCI + select SH_DEVICE_TREE + select COMMON_CLK help I-O DATA DEVICE, INC. "LANDISK Series" support. + Use Device Tree.
Quoted 5 lines
arch/sh/boards/Kconfig config SH_LANDISK · line 335
Quoted 2 lines
arch/sh/boards/Kconfig +0
-0config SH_TITAN bool "TITAN"Apart from the above, there are no users of the "<machine>_OF" symbols. Do we need them?
OK.
I added "OpenFirmware supported target boards" in Board Support. Once OF support is available, the old ones will be fine as departed.
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 2/12 sh: Update OF handling.
In reply to Yoshinori Sato- avoid build warning.
- reserve external dtb area.
- use generic interfaces on internal peripheral driver.
--- arch/sh/boards/of-generic.c | 28 +++++++++++++++++++++++++--- arch/sh/boot/compressed/head_32.S | 5 +++-- arch/sh/kernel/head_32.S | 2 +- arch/sh/kernel/setup.c | 26 +++++++++++++++++++++++++- 4 files changed, 54 insertions(+), 7 deletions(-)
arch/sh/boards/of-generic.c +25 -3
@@ -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)
@@ -157,8 +163,7 @@ static struct sh_machine_vector __initmv sh_of_generic_mv = { .mv_init_irq = sh_of_init_irq, .mv_clk_init = sh_of_clk_init, .mv_mode_pins = noopi, - .mv_mem_init = noop, - .mv_mem_reserve = sh_of_mem_reserve, + .mv_mem_init = sh_of_mem_init, };struct sh_clk_ops ;
@@ -170,3 +175,20 @@ void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx)void __init __weak plat_irq_setup (void ) { } + +static int __init sh_of_device_init (void ) +{ +pr_info ("SH generic board support: populating platform devices\n" ); +if (of_have_populated_dt ()) { +of_platform_populate (NULL , of_default_bus_match_table, +NULL ,NULL ); + }else { +pr_crit ("Device tree not populated\n" ); + } +return 0 ; +} +arch_initcall_sync (sh_of_device_init); + +void intc_finalize (void ) +{ +}
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:
arch/sh/kernel/head_32.S +1 -1
@@ -56,7 +56,7 @@ ENTRY(empty_zero_page) */ ENTRY(_stext) ! Initialize Status Register - mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF + mov.l 1f, r0 ! MD=1, RB=0, BL=1, IMASK=0xF ldc r0, sr ! Initialize global interrupt mask #ifdef CONFIG_CPU_HAS_SR_RB
arch/sh/kernel/setup.c +25 -1
@@ -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 +#ifndef CONFIG_OF static char __initdata command_line[COMMAND_LINE_SIZE ] = {0 , }; +#endif static struct resource code_resource = { .name ="Kernel code" ,
@@ -104,6 +107,10 @@ unsigned long memory_limit = 0;static struct resource mem_resources[MAX_NUMNODES ]; +#if defined(CONFIG_OF ) +static void *dt_virt; +#endif +int l1i_cache_shape, l1d_cache_shape, l2_cache_shape;static int __init early_parse_mem (char *p)
@@ -180,7 +187,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 +261,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 +285,16 @@ void __ref sh_fdt_init(phys_addr_t dt_phys)void __init setup_arch (char **cmdline_p) { +#ifdef CONFIG_OF +#ifndef CONFIG_USE_BUILTIN_DTB +memblock_reserve (__pa (dt_virt),fdt_totalsize (dt_virt)); +#endif +unflatten_device_tree (); +#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 ();
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 02/12] sh: Update OF handling.
Hi Sato-san,
Thanks for your patch!
Quoted 3 lines · Yoshinori Sato
- avoid build warning.
- reserve external dtb area.
- use generic interfaces on internal peripheral driver.
... and much more.
Please split in separate patches.
Quoted 9 lines
arch/sh/boards/of-generic.c +3
-0void __init __weak plat_irq_setup (void ) { } + +static int __init sh_of_device_init (void ) +{
arch/sh/boards/of-generic.c void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx) · line 190
Quoted 10 lines
arch/sh/boards/of-generic.c +10
-0+pr_info ("SH generic board support: populating platform devices\n" ); +if (of_have_populated_dt ()) { +of_platform_populate (NULL , of_default_bus_match_table, +NULL ,NULL ); + }else { +pr_crit ("Device tree not populated\n" ); + } +return 0 ; +} +arch_initcall_sync (sh_of_device_init);
Do you need this?of_platform_populate() is already called through drivers/of/platform.c:arch_initcall_sync(of_platform_default_populate_init);
arch/sh/boards/of-generic.c void __init __weak arch_init_clk_ops(struct sh_clk_ops **ops, int idx) · line 194
Quoted 4 lines
arch/sh/boards/of-generic.c +4
-0+ +void intc_finalize (void ) +{ +}
Do you need this? Oh, for arch/sh/kernel/irq.c:void __init init_IRQ(). Perhaps define an inline dummy in a header file?
arch/sh/kernel/head_32.S ENTRY(empty_zero_page) · line 59
Quoted 8 lines
arch/sh/kernel/head_32.S +1
-1@@ -56,7 +56,7 @@ ENTRY(empty_zero_page) */ ENTRY(_stext) ! Initialize Status Register - mov.l 1f, r0 ! MD=1, RB=0, BL=0, IMASK=0xF + mov.l 1f, r0 ! MD=1, RB=0, BL=1, IMASK=0xF
Why?
Quoted 8 lines
arch/sh/kernel/head_32.S +0
-0ldc r0, sr ! Initialize global interrupt mask #ifdef CONFIG_CPU_HAS_SR_RB
arch/sh/kernel/setup.c extern int root_mountflags; · line 85
Quoted 6 lines
arch/sh/kernel/setup.c +2
-0@@ -79,7 +80,9 @@ extern int root_mountflags;#define RAMDISK_PROMPT_FLAG 0x8000#define RAMDISK_LOAD_FLAG 0x4000 +#ifndef CONFIG_OF static char __initdata command_line[COMMAND_LINE_SIZE ] = {0 , }; +#endif
Having the ability to override the command line is still useful. And below, the use of command_line[] depends on !defined(CONFIG_OF) || defined(USE_BUILTIN_DTB).
Quoted 5 lines
arch/sh/kernel/setup.c +1
-0@@ -313,10 +332,15 @@ void __init setup_arch(char **cmdline_p)strlcat (command_line,CONFIG_CMDLINE ,sizeof (command_line));#endif #endif +#endif
arch/sh/kernel/setup.c void __init setup_arch(char **cmdline_p) · line 345
Quoted 10 lines
arch/sh/kernel/setup.c +4
-0+#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 ();
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 3/12 sh: SH4 OF support.
In reply to Yoshinori Sato- switch generic framework in clock / PCI.
--- arch/sh/drivers/Makefile | 2 ++ arch/sh/include/asm/io.h | 10 ++++++++++ arch/sh/include/asm/pci.h | 4 ++++ arch/sh/kernel/cpu/Makefile | 8 ++++++-- arch/sh/kernel/cpu/clock.c | 3 ++- arch/sh/kernel/cpu/sh4/Makefile | 2 ++ 6 files changed, 26 insertions(+), 3 deletions(-)
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 +10 -0
@@ -292,4 +292,14 @@ static inline void iounmap(volatile void __iomem *addr) { }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__ */ +#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 +6 -2
@@ -16,6 +16,10 @@ obj-$(CONFIG_ARCH_SHMOBILE) += shmobile/ # Common interfaces. obj-$(CONFIG_SH_ADC) += adc.o +ifndef CONFIG_COMMON_CLK obj-$(CONFIG_SH_CLK_CPG_LEGACY) += clock-cpg.o - -obj-y += irq/ init.o clock.o fpu.o pfc.o proc.o +endif +ifndef CONFIG_GENERIC_IRQ_CHIP +obj-y += irq/ +endif +obj-y += init.o clock.o fpu.o pfc.o proc.o
arch/sh/kernel/cpu/clock.c +2 -1
@@ -14,12 +14,13 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/clk.h> +#include <linux/of.h> #include <asm/clock.h> #include <asm/machvec.h> int __init clk_init (void ) { -int ret; +int ret =0 ;#ifndef CONFIG_COMMON_CLK ret =arch_clk_init ();
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_OF # 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 obj-y += $(clock-y) obj-$(CONFIG_PERF_EVENTS) += $(perf-y)
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 03/12] sh: SH4 OF support.
Hi Sato-san,
Thanks for your patch!
Quoted 1 line · Yoshinori Sato
- switch generic framework in clock / PCI.
... and much more.
Please split in separate patches.
Quoted 7 lines
arch/sh/kernel/cpu/clock.c +1
-0@@ -14,12 +14,13 @@#include <linux/kernel.h> #include <linux/init.h> #include <linux/clk.h> +#include <linux/of.h>
arch/sh/kernel/cpu/clock.c line 26
Quoted 10 lines
arch/sh/kernel/cpu/clock.c +1
-1#include <asm/clock.h> #include <asm/machvec.h> int __init clk_init (void ) { -int ret; +int ret =0 ;#ifndef CONFIG_COMMON_CLK ret =arch_clk_init ();
Perhaps make this whole function depend on CONFIG_COMMON_CLK, and call sh_of_clk_init() (or of_clk_init()) directly() from time_init()?
arch/sh/kernel/cpu/clock.c perf-$(CONFIG_CPU_SUBTYPE_SH7750) := perf_event.o · line 18
Quoted 5 lines
arch/sh/kernel/cpu/clock.c +1
-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_OF
CONFIG_SH_DEVICE_TREE
arch/sh/kernel/cpu/clock.c perf-$(CONFIG_CPU_SUBTYPE_SH7750) := perf_event.o · line 21
Quoted 3 lines
arch/sh/kernel/cpu/clock.c +0
-0# CPU subtype setup obj-$ (CONFIG_CPU_SUBTYPE_SH7750 ) += setup-sh7750.o obj-$(CONFIG_CPU_SUBTYPE_SH7750R) += setup-sh7750.o
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
Re: [RESEND RFC PATCH 03/12] sh: SH4 OF support.
In reply to Yoshinori SatoHi Sato-san,
Quoted 10 lines · Yoshinori Sato
- switch generic framework in clock / PCI.
Signed-off-by Yoshinori Sato <[email protected]>arch/sh/include/asm/io.h +0
-0@@ -292,4 +292,14 @@ static inline void iounmap(volatile void __iomem *addr) { }int valid_phys_addr_range (phys_addr_t addr,size_t size);int valid_mmap_phys_addr_range (unsigned long pfn,size_t size);
arch/sh/include/asm/io.h static inline void iounmap(volatile void __iomem *addr) { } · line 304
Quoted 10 lines
arch/sh/include/asm/io.h +10
-0+ +#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__ */ +
Since commit b94692e84dccf12d ("sh: add <asm-generic/io.h> including") in v6.6-rc1, the new definitions must be inserted higher up, before the inclusion of <asm-generic/io.h>, to avoid:
arch/sh/include/asm/io.h:322: warning: "PCI_IOBASE" redefined
322 | #define PCI_IOBASE 0xfe240000UL
|
include/asm-generic/io.h:527: note: this is the location of the
previous definition
arch/sh/include/asm/io.h static inline void iounmap(volatile void __iomem *addr) { } · line 305
Quoted 1 line
arch/sh/include/asm/io.h +0
-0#endif /* __ASM_SH_IO_H */
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: [RESEND RFC PATCH 03/12] sh: SH4 OF support.
Quoted 30 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 10 lines · Yoshinori Sato
- switch generic framework in clock / PCI.
Signed-off-by Yoshinori Sato <[email protected]>arch/sh/include/asm/io.h +0
-0@@ -292,4 +292,14 @@ static inline void iounmap(volatile void __iomem *addr) { }int valid_phys_addr_range (phys_addr_t addr,size_t size);int valid_mmap_phys_addr_range (unsigned long pfn,size_t size);arch/sh/include/asm/io.h static inline void iounmap(volatile void __iomem *addr) { } · line 304
Quoted 10 lines
arch/sh/include/asm/io.h +10
-0+ +#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__ */ +Since commit
b94692e84dccf12d("sh: add <asm-generic/io.h> including") in v6.6-rc1, the new definitions must be inserted higher up, before the inclusion of <asm-generic/io.h>, to avoid:
Quoted 7 lines
arch/sh/include/asm/io.h:322: warning: "PCI_IOBASE" redefined
322 | #definePCI_IOBASE0xfe240000UL
|
include/asm-generic/io.h:527: note: this is the location of the
previous definitionQuoted 1 line
arch/sh/include/asm/io.h +0
-0#endif /* __ASM_SH_IO_H */
OK.
This has been fixed in the v2 patch.
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 4/12 clk: SH7750 / 7751 clk driver.
In reply to Yoshinori SatoUse COMMON_CLK framework clock driver.
--- drivers/clk/Kconfig | 1 + drivers/clk/Makefile | 1 + drivers/clk/sh/Kconfig | 7 + drivers/clk/sh/Makefile | 2 + drivers/clk/sh/clk-sh7750.c | 193 ++++++++++++++++++++ drivers/clk/sh/clk-shdiv.c | 341 ++++++++++++++++++++++++++++++++++++ drivers/sh/Makefile | 2 + 7 files changed, 547 insertions(+) create mode 100644 drivers/clk/sh/Kconfig create mode 100644 drivers/clk/sh/Makefile create mode 100644 drivers/clk/sh/clk-sh7750.c create mode 100644 drivers/clk/sh/clk-shdiv.c
drivers/clk/Kconfig +1 -0
@@ -485,6 +485,7 @@ source "drivers/clk/ralink/Kconfig" source "drivers/clk/renesas/Kconfig" source "drivers/clk/rockchip/Kconfig" source "drivers/clk/samsung/Kconfig" +source "drivers/clk/sh/Kconfig" source "drivers/clk/sifive/Kconfig" source "drivers/clk/socfpga/Kconfig" source "drivers/clk/sprd/Kconfig"
drivers/clk/Makefile +1 -0
@@ -136,3 +136,4 @@ endif obj-y += xilinx/ obj-$(CONFIG_ARCH_ZYNQ) += zynq/ obj-$(CONFIG_COMMON_CLK_ZYNQMP) += zynqmp/ +obj-$(CONFIG_SUPERH) += sh/
drivers/clk/sh/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +config COMMON_CLK_SH7750 + bool "Clcok driver for SH7750/SH7751" + depends on CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \ + CPU_SUBTYPE_SH7750R || \ + CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R + help + This driver supports the Renesas SH7750 and SH7751 CPG.
drivers/clk/sh/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-shdiv.o
drivers/clk/sh/clk-sh7750.c new file +193 -0
193 lines not on this page · raw message
drivers/clk/sh/clk-shdiv.c new file +341 -0
341 lines not on this page · raw message
drivers/sh/Makefile +2 -0
@@ -2,7 +2,9 @@ # # Makefile for the SuperH specific drivers. # +ifneq ($(CONFIG_RENESAS_SH_INTC),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: [RESEND RFC PATCH 04/12] clk: SH7750 / 7751 clk driver.
Hi Sato-san,
Quoted 3 lines · Yoshinori Sato
Use
COMMON_CLKframework clock driver.Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/clk/sh/Kconfig line 2
Quoted 5 lines
drivers/clk/sh/Kconfig new file +2
-0@@ -0,0 +1,7 @@ +config COMMON_CLK_SH7750 + bool "Clcok driver for SH7750/SH7751"
Clock
drivers/clk/sh/Kconfig line 5
Quoted 3 lines
drivers/clk/sh/Kconfig new file +3
-0+ depends on CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \ + CPU_SUBTYPE_SH7750R || \ + CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
|| COMPILE_TEST?
Anyway, I would do
select COMMON_CLK_SH7750 if CPU_SUBTYPE_SH7750 || ...
at the top, and
bool "Clock driver for SH7750/SH7751" if COMPILE_TEST
cfr. drivers/clk/renesas/Kconfig.
BTW, do you plan to put all SuperH clock drivers under SH? For a simple CPG like in SH7750/7751 that could make sense. For the more complex ones like SH7724, you probably want to plug into the existing drivers/clk/renesas/renesas-cpg-mssr.c instead, as it is very similar to the CPG on later Renesas ARM SoCs.
But even SH7751 has Standby Control registers with Module Stop bits...
drivers/clk/sh/Makefile line 2
Quoted 10 lines
drivers/clk/sh/Kconfig new file +2
-0+ help + This driver supports the Renesas SH7750 and SH7751 CPG.drivers/clk/sh/Makefile new file +2
-0@@ -0,0 +1,2 @@ +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-shdiv.o
These can be one line.
Quoted 6 lines
drivers/clk/sh/clk-sh7750.c new file +0
-0
drivers/clk/sh/clk-sh7750.c line 8
Quoted 8 lines
drivers/clk/sh/clk-sh7750.c new file +8
-0@@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Renesas SH7750/51 clock driver +* +* Copyright 2023 Yoshinori Sato <[email protected]> +*/ + +#include <linux/clk.h>
Do you need the consumer API?
drivers/clk/sh/clk-sh7750.c line 20
Quoted 12 lines
drivers/clk/sh/clk-sh7750.c new file +12
-0+#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> + +struct clk *sh_div_clk_register (struct device *dev,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock);
Please move this to a (private) header file. Else builds with W=1 will complain about "warning: no previous prototype".
drivers/clk/sh/clk-sh7750.c line 24
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ +static DEFINE_SPINLOCK (clklock); + +static struct clk_div_table pdiv_table[] = {
const
drivers/clk/sh/clk-sh7750.c line 33
Quoted 9 lines
drivers/clk/sh/clk-sh7750.c new file +9
-0+ { .val = 0, .div = 2, }, + { .val = 1, .div = 3, }, + { .val = 2, .div = 4, }, + { .val = 3, .div = 6, }, + { .val = 4, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +static struct clk_div_table div_table[] = {
const
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ { .val = 0, .div = 1, }, + { .val = 1, .div = 2, }, + { .val = 2, .div = 3, }, + { .val = 3, .div = 4, },
drivers/clk/sh/clk-sh7750.c line 47
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+ { .val = 4, .div = 6, }, + { .val = 5, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +struct pll_clock { + struct clk_hw hw; + void __iomem *frqcr; + void __iomem *wdt; + int md;
u32
Quoted 5 lines
drivers/clk/sh/clk-sh7750.c new file +5
-0+bool div1; +}; + +#define to_pll_clock (_hw) container_of(_hw, struct pll_clock, hw) +
drivers/clk/sh/clk-sh7750.c line 62
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+static unsigned long pll_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct pll_clock *pll_clock =to_pll_clock (hw); +unsigned long rate = parent_rate; +uint16_t frqcr; +static const int pll1[] = {12 ,12 ,6 ,12 ,6 ,12 ,1 }; + + frqcr =ioread16 (pll_clock->frqcr); +if (frqcr & (1 <<10 )) {
Please add a define for "1 << 10" (or "BIT(10)").
#define FRQCR_PLL1EN BIT(10)
Quoted 23 lines
drivers/clk/sh/clk-sh7750.c new file +23
-0+ rate *= pll1[pll_clock->md]; +if (pll_clock->md <6 && pll_clock->div1) + rate /=2 ; + } +return rate; +} + +static const struct clk_ops pll_ops = { + .recalc_rate = pll_recalc_rate, +}; + +static void __init sh7750_pll_clk_setup (struct device_node *node) +{ +unsigned int num_parents; +struct clk *clk; +const char *clk_name = node->name; +const char *parent_name; +struct pll_clock *pll_clock; +struct clk_init_data init; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , clk_name);
drivers/clk/sh/clk-sh7750.c line 95
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+return ; + } + + pll_clock =kzalloc (sizeof (struct pll_clock ),GFP_KERNEL ); +if (!pll_clock) +return ; + + pll_clock->frqcr =of_iomap (node,0 ); +if (pll_clock->frqcr ==NULL ) { + pr_err("%s: failed to map frequenct control register",
frequency
drivers/clk/sh/clk-sh7750.c line 106
Quoted 11 lines
drivers/clk/sh/clk-sh7750.c new file +11
-0+ clk_name); + goto free_clock; + } + + pll_clock->wdt =of_iomap (node,1 ); +if (pll_clock->wdt ==NULL ) { +pr_err ("%s: failed to map watchdog register" , clk_name); + goto unmap_frqcr; + } + +of_property_read_u32_index (node,"sh7750,md" ,0 , &pll_clock->md);
R-Mobile A1 uses "renesas,mode" for this, cfr. Documentation/devicetree/bindings/clock/renesas,cpg-clocks.yaml
drivers/clk/sh/clk-sh7750.c line 108
Quoted 2 lines
drivers/clk/sh/clk-sh7750.c new file +2
-0+if (pll_clock->md >=7 ) { + pr_err("%s: failed to clock mode setting (%d)\n",
invalid clock mode setting?
%u
drivers/clk/sh/clk-sh7750.c line 112
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ clk_name, pll_clock->md); + goto unmap_wdt; + } + pll_clock->div1 = !of_property_read_bool (node,"sh7750,rtype" );
Shouldn't this be derived from the compatible value instead?
drivers/clk/sh/clk-sh7750.c line 146
Quoted 8 lines
drivers/clk/sh/clk-sh7750.c new file +8
-0+static void __init sh7750_div_clk_setup (struct device_node *node) +{ +unsigned int num_parents; +struct clk *clk; +const char *clk_name = node->name; +const char *parent_name; +void __iomem *freqcr =NULL ; +int i;
unsigned int
drivers/clk/sh/clk-sh7750.c line 156
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+int num_clks; +int offset; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , clk_name); +return ; + } + + num_clks =of_property_count_strings (node,"clock-output-names" );
Please no more clock-output-names.
drivers/clk/sh/clk-sh7750.c line 193
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+CLK_OF_DECLARE (sh7750_div_clk,"renesas,sh7750-div-clock" , + sh7750_div_clk_setup); +CLK_OF_DECLARE (sh7750_pll_clk,"renesas,sh7750-pll-clock" , + sh7750_pll_clk_setup);
I think this should be a unified clock driver generating all clocks. As there are no bindings yet, I will comment on the DTS files instead.
drivers/clk/sh/clk-shdiv.c line 290
Quoted 9 lines
drivers/clk/sh/clk-shdiv.c new file +3
-0+static const struct clk_ops sh_clk_divider_ops = { + .recalc_rate = sh_clk_divider_recalc_rate, + .round_rate = sh_clk_divider_round_rate,
Please implement .determine_rate() instead of the deprecated .round_rate().
drivers/sh/Makefile line 7
Quoted 12 lines
drivers/clk/sh/clk-shdiv.c new file +2
-0+ .set_rate = sh_clk_divider_set_rate, +};drivers/sh/Makefile +2
-0@@ -2,7 +2,9 @@ # # Makefile for the SuperH specific drivers. # +ifneq ($(CONFIG_RENESAS_SH_INTC),y) obj-$(CONFIG_SH_INTC) += intc/ +endif
This change does not belong in this patch.
drivers/sh/Makefile line 10
Quoted 3 lines
drivers/sh/Makefile +0
-0ifneq ($(CONFIG_COMMON_CLK),y) obj-$(CONFIG_HAVE_CLK) += clk/ 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
maintainerRe: [RESEND RFC PATCH 04/12] clk: SH7750 / 7751 clk driver.
Quoted 33 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 3 lines · Yoshinori Sato
Use
COMMON_CLKframework clock driver.Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
drivers/clk/sh/Kconfig line 2
Quoted 5 lines
drivers/clk/sh/Kconfig new file +2
-0@@ -0,0 +1,7 @@ +config COMMON_CLK_SH7750 + bool "Clcok driver for SH7750/SH7751"Clock
drivers/clk/sh/Kconfig line 5
Quoted 3 lines
drivers/clk/sh/Kconfig new file +3
-0+ depends on CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7750S || \ + CPU_SUBTYPE_SH7750R || \ + CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R||
COMPILE_TEST?Anyway, I would do
select COMMON_CLK_SH7750 if CPU_SUBTYPE_SH7750 || ...at the top, and
bool "Clock driver for SH7750/SH7751" if
COMPILE_TEST
Quoted 7 lines
cfr.
drivers/clk/renesas/Kconfig.BTW, do you plan to put all SuperH clock drivers under SH? For a simple CPG like in SH7750/7751 that could make sense. For the more complex ones like SH7724, you probably want to plug into the existing
drivers/clk/renesas/renesas-cpg-mssr.cinstead, as it is very similar to the CPG on later Renesas ARM SoCs.
OK.
move to under drivers/clk/renesas.
Quoted 2 lines
But even SH7751 has Standby Control registers with Module Stop bits...
It is possible to stop modules, but it seems that there are not many modules that can be stopped.
I haven't used it yet, so I would like to consider it as a next step.
Quoted 240 lines
drivers/clk/sh/Makefile line 2
Quoted 10 lines
drivers/clk/sh/Kconfig new file +2
-0+ help + This driver supports the Renesas SH7750 and SH7751 CPG.drivers/clk/sh/Makefile new file +2
-0@@ -0,0 +1,2 @@ +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-sh7750.o +obj-$(CONFIG_COMMON_CLK_SH7750) += clk-shdiv.oThese can be one line.
Quoted 6 lines
drivers/clk/sh/clk-sh7750.c new file +0
-0drivers/clk/sh/clk-sh7750.c line 8
Quoted 8 lines
drivers/clk/sh/clk-sh7750.c new file +8
-0@@ -0,0 +1,193 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Renesas SH7750/51 clock driver +* +* Copyright 2023 Yoshinori Sato <[email protected]> +*/ + +#include <linux/clk.h> Do you need the consumer API?
drivers/clk/sh/clk-sh7750.c line 20
Quoted 12 lines
drivers/clk/sh/clk-sh7750.c new file +12
-0+#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> + +struct clk *sh_div_clk_register (struct device *dev,const char *name, +const char *parent_name, +void __iomem *reg,u8 shift,u8 width, +const struct clk_div_table *table, +spinlock_t *lock);Please move this to a (private) header file. Else builds with W=1 will complain about "warning: no previous prototype".
drivers/clk/sh/clk-sh7750.c line 24
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ +static DEFINE_SPINLOCK (clklock); + +static struct clk_div_table pdiv_table[] = {const
drivers/clk/sh/clk-sh7750.c line 33
Quoted 9 lines
drivers/clk/sh/clk-sh7750.c new file +9
-0+ { .val = 0, .div = 2, }, + { .val = 1, .div = 3, }, + { .val = 2, .div = 4, }, + { .val = 3, .div = 6, }, + { .val = 4, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +static struct clk_div_table div_table[] = {const
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ { .val = 0, .div = 1, }, + { .val = 1, .div = 2, }, + { .val = 2, .div = 3, }, + { .val = 3, .div = 4, },drivers/clk/sh/clk-sh7750.c line 47
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+ { .val = 4, .div = 6, }, + { .val = 5, .div = 8, }, + { .val = 0, .div = 0, }, +}; + +struct pll_clock { + struct clk_hw hw; + void __iomem *frqcr; + void __iomem *wdt; + int md;u32
Quoted 5 lines
drivers/clk/sh/clk-sh7750.c new file +5
-0+bool div1; +}; + +#define to_pll_clock (_hw) container_of(_hw, struct pll_clock, hw) +drivers/clk/sh/clk-sh7750.c line 62
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+static unsigned long pll_recalc_rate (struct clk_hw *hw, +unsigned long parent_rate) +{ +struct pll_clock *pll_clock =to_pll_clock (hw); +unsigned long rate = parent_rate; +uint16_t frqcr; +static const int pll1[] = {12 ,12 ,6 ,12 ,6 ,12 ,1 }; + + frqcr =ioread16 (pll_clock->frqcr); +if (frqcr & (1 <<10 )) {Please add a define for "1 << 10" (or "BIT(10)").
#define
FRQCR_PLL1ENBIT(10)Quoted 23 lines
drivers/clk/sh/clk-sh7750.c new file +23
-0+ rate *= pll1[pll_clock->md]; +if (pll_clock->md <6 && pll_clock->div1) + rate /=2 ; + } +return rate; +} + +static const struct clk_ops pll_ops = { + .recalc_rate = pll_recalc_rate, +}; + +static void __init sh7750_pll_clk_setup (struct device_node *node) +{ +unsigned int num_parents; +struct clk *clk; +const char *clk_name = node->name; +const char *parent_name; +struct pll_clock *pll_clock; +struct clk_init_data init; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , clk_name);drivers/clk/sh/clk-sh7750.c line 95
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+return ; + } + + pll_clock =kzalloc (sizeof (struct pll_clock ),GFP_KERNEL ); +if (!pll_clock) +return ; + + pll_clock->frqcr =of_iomap (node,0 ); +if (pll_clock->frqcr ==NULL ) { + pr_err("%s: failed to map frequenct control register",frequency
drivers/clk/sh/clk-sh7750.c line 106
Quoted 11 lines
drivers/clk/sh/clk-sh7750.c new file +11
-0+ clk_name); + goto free_clock; + } + + pll_clock->wdt =of_iomap (node,1 ); +if (pll_clock->wdt ==NULL ) { +pr_err ("%s: failed to map watchdog register" , clk_name); + goto unmap_frqcr; + } + +of_property_read_u32_index (node,"sh7750,md" ,0 , &pll_clock->md);R-Mobile A1 uses "renesas,mode" for this, cfr.
Documentation/devicetree/bindings/clock/renesas,cpg-clocks.yamldrivers/clk/sh/clk-sh7750.c line 108
Quoted 2 lines
drivers/clk/sh/clk-sh7750.c new file +2
-0+if (pll_clock->md >=7 ) { + pr_err("%s: failed to clock mode setting (%d)\n",invalid clock mode setting?
%udrivers/clk/sh/clk-sh7750.c line 112
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+ clk_name, pll_clock->md); + goto unmap_wdt; + } + pll_clock->div1 = !of_property_read_bool (node,"sh7750,rtype" );Shouldn't this be derived from the compatible value instead?
drivers/clk/sh/clk-sh7750.c line 146
Quoted 8 lines
drivers/clk/sh/clk-sh7750.c new file +8
-0+static void __init sh7750_div_clk_setup (struct device_node *node) +{ +unsigned int num_parents; +struct clk *clk; +const char *clk_name = node->name; +const char *parent_name; +void __iomem *freqcr =NULL ; +int i;unsigned int
drivers/clk/sh/clk-sh7750.c line 156
Quoted 10 lines
drivers/clk/sh/clk-sh7750.c new file +10
-0+int num_clks; +int offset; + + num_parents =of_clk_get_parent_count (node); +if (num_parents <1 ) { +pr_err ("%s: no parent found" , clk_name); +return ; + } + + num_clks =of_property_count_strings (node,"clock-output-names" );Please no more clock-output-names.
drivers/clk/sh/clk-sh7750.c line 193
Quoted 4 lines
drivers/clk/sh/clk-sh7750.c new file +4
-0+CLK_OF_DECLARE (sh7750_div_clk,"renesas,sh7750-div-clock" , + sh7750_div_clk_setup); +CLK_OF_DECLARE (sh7750_pll_clk,"renesas,sh7750-pll-clock" , + sh7750_pll_clk_setup);I think this should be a unified clock driver generating all clocks. As there are no bindings yet, I will comment on the DTS files instead.
drivers/clk/sh/clk-shdiv.c line 290
Quoted 9 lines
drivers/clk/sh/clk-shdiv.c new file +3
-0+static const struct clk_ops sh_clk_divider_ops = { + .recalc_rate = sh_clk_divider_recalc_rate, + .round_rate = sh_clk_divider_round_rate,Please implement .determine_rate() instead of the deprecated .round_rate().
drivers/sh/Makefile line 7
Quoted 12 lines
drivers/clk/sh/clk-shdiv.c new file +2
-0+ .set_rate = sh_clk_divider_set_rate, +};drivers/sh/Makefile +2
-0@@ -2,7 +2,9 @@ # # Makefile for the SuperH specific drivers. # +ifneq ($(CONFIG_RENESAS_SH_INTC),y) obj-$(CONFIG_SH_INTC) += intc/ +endifThis change does not belong in this patch.
drivers/sh/Makefile line 10
Quoted 3 lines
drivers/sh/Makefile +0
-0ifneq ($(CONFIG_COMMON_CLK),y) obj-$(CONFIG_HAVE_CLK) += clk/ endifGr{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
Yoshinori Sato
maintainerRFC PATCH 5/12 drivers/irqchip: Add SH7751 and boards specific irqchip.
In reply to Yoshinori Sato- irq-renesas-sh7751: Renesas SH7751 internal INTC.
- irq-renesas-r2d: Renesas RTS7751R2D external interrupt encoder.
- irq-iodata-julian: IO DATA Device LANDISK external interrupt encoder.
--- drivers/irqchip/Kconfig | 4 + drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-iodata-julian.c | 163 +++++++++++++++++++++++ drivers/irqchip/irq-renesas-r2d.c | 175 +++++++++++++++++++++++++ drivers/irqchip/irq-renesas-sh7751.c | 186 +++++++++++++++++++++++++++ 5 files changed, 529 insertions(+) create mode 100644 drivers/irqchip/irq-iodata-julian.c create mode 100644 drivers/irqchip/irq-renesas-r2d.c create mode 100644 drivers/irqchip/irq-renesas-sh7751.c
drivers/irqchip/Kconfig +4 -0
@@ -660,6 +660,10 @@ config APPLE_AIC help Support for the Apple Interrupt Controller found on Apple Silicon SoCs, such as the M1. +config RENESAS_SH_INTC + def_bool y if SH_DEVICE_TREE + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY config MCHP_EIC bool "Microchip External Interrupt Controller"
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_SH_INTC) += irq-renesas-sh7751.o irq-iodata-julian.o irq-renesas-r2d.o
drivers/irqchip/irq-iodata-julian.c new file +163 -0
163 lines not on this page · raw message
drivers/irqchip/irq-renesas-r2d.c new file +175 -0
175 lines not on this page · raw message
drivers/irqchip/irq-renesas-sh7751.c new file +186 -0
186 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 05/12] drivers/irqchip: Add SH7751 and boards specific irqchip.
Hi Sato-san,
Thanks for your patch!
Quoted 3 lines · Yoshinori Sato
- irq-renesas-sh7751: Renesas SH7751 internal INTC.
- irq-renesas-r2d: Renesas RTS7751R2D external interrupt encoder.
- irq-iodata-julian: IO DATA Device LANDISK external interrupt encoder.
Again, please split.
drivers/irqchip/Kconfig config APPLE_AIC · line 662
Quoted 8 lines
Signed-off-by Yoshinori Sato <[email protected]>drivers/irqchip/Kconfig +0
-0@@ -660,6 +660,10 @@ config APPLE_AIC help Support for the Apple Interrupt Controller found on Apple Silicon SoCs, such as the M1.
Please add a blank line here.
Quoted 12 lines
drivers/irqchip/Kconfig +4
-0+config RENESAS_SH_INTC + def_bool y if SH_DEVICE_TREE + select IRQ_DOMAIN + select IRQ_DOMAIN_HIERARCHY config MCHP_EIC bool "Microchip External Interrupt Controller"drivers/irqchip/Makefile +0
-0
drivers/irqchip/Makefile obj-$(CONFIG_IRQ_IDT3243X) += irq-idt3243x.o · line 123
Quoted 4 lines
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_SH_INTC) += irq-renesas-sh7751.o irq-iodata-julian.o irq-renesas-r2d.o
I think it makes sense to split this in 3 different config symbols.
Quoted 8 lines
drivers/irqchip/irq-iodata-julian.c new file +2
-0@@ -0,0 +1,163 @@ +// SPDX-License-Identifier: GPL-2.0 +/*
drivers/irqchip/irq-iodata-julian.c line 12
Quoted 10 lines
drivers/irqchip/irq-iodata-julian.c new file +10
-0+* IO-DATA DEVICE LANDISK / USL-5P (a.k.a Julian) interrupt encoder +* +* Copyright (C) 2023 Yoshinori Sato +*/ + +#include <linux/init.h> +#include <linux/irq.h> +#include <linux/irqchip.h> +#include <linux/irqdomain.h> +#include <linux/of_address.h>
Do you need this?
drivers/irqchip/irq-iodata-julian.c line 13
Quoted 1 line
drivers/irqchip/irq-iodata-julian.c new file +1
-0+#include <linux/of_irq.h>
Do you need this?
Quoted 7 lines
drivers/irqchip/irq-iodata-julian.c new file +7
-0+#include <linux/err.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/slab.h>
drivers/irqchip/irq-iodata-julian.c line 30
Quoted 10 lines
drivers/irqchip/irq-iodata-julian.c new file +10
-0+ +#define NUM_IRQ 16 + +struct julian_intc_priv { +struct device *dev; +void __iomem *base; +struct irq_domain *irq_domain; +}; + +static struct julian_intc_priv *irq_data_to_priv (struct irq_data *data)
static inline
drivers/irqchip/irq-iodata-julian.c line 63
Quoted 5 lines
drivers/irqchip/irq-iodata-julian.c new file +4
-0+{ +return data->domain->host_data; +} +static __init int julian_intc_map(struct irq_domain *h, unsigned int virq,
I don't think this can be __init...
Quoted 21 lines
drivers/irqchip/irq-iodata-julian.c new file +20
-0+ irq_hw_number_t hw_irq_num) +{ +irq_set_chip_and_handler (virq, &julian_intc_chip, handle_level_irq); +irq_get_irq_data (virq)->chip_data = h->host_data; +irq_modify_status (virq,IRQ_NOREQUEST ,IRQ_NOPROBE ); +return 0 ; +} +static int julian_intc_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct julian_intc_priv *priv; +struct irq_domain *d; +int ret =0 ; + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->dev = dev;
drivers/irqchip/irq-iodata-julian.c line 119
Quoted 10 lines
drivers/irqchip/irq-iodata-julian.c new file +10
-0+ + priv->base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (priv->base)) +return PTR_ERR (priv->base); + + d =irq_domain_add_tree (np, &julian_intc_domain_ops, priv); +if (d ==NULL ) { +dev_err (dev,"cannot initialize irq domain\n" ); +kfree (priv); + ret = -ENOMEM ;
"return -ENOMEM;", so you can bail out early, remove the else below, and reduce indentation below.
drivers/irqchip/irq-iodata-julian.c line 129
Quoted 10 lines
drivers/irqchip/irq-iodata-julian.c new file +9
-0+ }else { + priv->irq_domain = d; +irq_domain_update_bus_token (d,DOMAIN_BUS_WIRED ); + } +return ret; +} +static int julian_intc_remove (struct platform_device *pdev) +{ +struct julian_intc_priv *priv =platform_get_drvdata (pdev);
This won't work, as platform_set_drvdata() is never called.
drivers/irqchip/irq-iodata-julian.c line 137
Quoted 8 lines
drivers/irqchip/irq-iodata-julian.c new file +8
-0+ +irq_domain_remove (priv->irq_domain); +return 0 ; +} + +static const struct of_device_id julian_intc_dt_ids[] = { + { .compatible ="iodata,julian-intc" }, + {},
Please no comma after a sentinel.
Quoted 11 lines
drivers/irqchip/irq-iodata-julian.c new file +2
-0+}; +MODULE_DEVICE_TABLE (of, julian_intc_dt_ids);drivers/irqchip/irq-renesas-r2d.c new file +5
-0@@ -0,0 +1,175 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Renesas RTS7751R2D interrupt encoder +* +* Copyright (C) 2023 Yoshinori Sato
drivers/irqchip/irq-renesas-r2d.c line 15
Quoted 10 lines
drivers/irqchip/irq-renesas-r2d.c new file +10
-0+*/ + +#include <linux/err.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/irqdomain.h> +#include <linux/irq.h> +#include <linux/module.h> +#include <linux/of_irq.h>
Do you need this?
drivers/irqchip/irq-renesas-r2d.c line 27
Quoted 12 lines
drivers/irqchip/irq-renesas-r2d.c new file +12
-0+#include <linux/platform_device.h> +#include <linux/slab.h> + +#define NUM_IRQ 15 + +struct r2d_intc_priv { +struct device *dev; +void __iomem *base; +struct irq_domain *irq_domain; +}; + +static const int imask[] = {
unsigned int
drivers/irqchip/irq-renesas-r2d.c line 40
Quoted 13 lines
drivers/irqchip/irq-renesas-r2d.c new file +13
-0+1 <<11 ,/* PCI INTD */ +1 <<9 ,/* CF IDE */ +1 <<8 ,/* CF CD */ +1 <<12 ,/* PCI INTC */ +1 <<10 ,/* SM501 */ +1 <<6 ,/* AX88796 / KEY */ +1 <<5 ,/* RTC ALARM */ +1 <<4 ,/* RTC T */ +1 <<7 ,/* SDCARD */ +1 <<14 ,/* PCI INTA */ +1 <<13 ,/* PCI INTB */ +1 <<0 ,/* EXT */ + 1 << 15, /* TP */
BIT(...)
drivers/irqchip/irq-renesas-r2d.c line 43
Quoted 3 lines
drivers/irqchip/irq-renesas-r2d.c new file +3
-0+}; + +static struct r2d_intc_priv *irq_data_to_priv (struct irq_data *data)
static inline
drivers/irqchip/irq-renesas-r2d.c line 75
Quoted 6 lines
drivers/irqchip/irq-renesas-r2d.c new file +5
-0+{ +return data->domain->host_data; +} +static __init int r2d_intc_map (struct irq_domain *h,unsigned int virq, +irq_hw_number_t hw_irq_num)
I don't think this can be __init.
drivers/irqchip/irq-renesas-r2d.c line 104
Quoted 9 lines
drivers/irqchip/irq-renesas-r2d.c new file +8
-0+{ +irq_set_chip_and_handler (virq, &r2d_intc_chip, handle_level_irq); +irq_get_irq_data (virq)->chip_data = h->host_data; +irq_modify_status (virq,IRQ_NOREQUEST ,IRQ_NOPROBE ); +return 0 ; +} +static const struct irq_domain_ops r2d_intc_domain_ops = { +// .alloc = r2d_intc_alloc,
Remove this line?
Quoted 17 lines
drivers/irqchip/irq-renesas-r2d.c new file +17
-0+ .map = r2d_intc_map, + .translate = r2d_intc_translate, +}; + +static int r2d_intc_probe (struct platform_device *pdev) +{ +struct device *dev = &pdev->dev; +struct device_node *np = dev->of_node; +struct r2d_intc_priv *priv; +struct irq_domain *d; +int ret =0 ; + + priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + + priv->dev = dev;
drivers/irqchip/irq-renesas-r2d.c line 131
Quoted 10 lines
drivers/irqchip/irq-renesas-r2d.c new file +10
-0+ + priv->base =devm_platform_ioremap_resource (pdev,0 ); +if (IS_ERR (priv->base)) +return PTR_ERR (priv->base); + + d =irq_domain_add_tree (np, &r2d_intc_domain_ops, priv); +if (d ==NULL ) { +dev_err (dev,"cannot initialize irq domain\n" ); +kfree (priv); + ret = -ENOMEM ;
"return -ENOMEM;", so you can bail out early, remove the else below, and reduce indentation below.
drivers/irqchip/irq-renesas-r2d.c line 141
Quoted 10 lines
drivers/irqchip/irq-renesas-r2d.c new file +10
-0+ }else { + priv->irq_domain = d; +irq_domain_update_bus_token (d,DOMAIN_BUS_WIRED ); + } +return ret; +} + +static int r2d_intc_remove (struct platform_device *pdev) +{ +struct r2d_intc_priv *priv =platform_get_drvdata (pdev);
This won't work, as platform_set_drvdata() is never called.
drivers/irqchip/irq-renesas-r2d.c line 149
Quoted 8 lines
drivers/irqchip/irq-renesas-r2d.c new file +8
-0+ +irq_domain_remove (priv->irq_domain); +return 0 ; +} + +static const struct of_device_id r2d_intc_dt_ids[] = { + { .compatible ="renesas,rts7751r2d-intc" }, + {},
Please no comma after a sentinel.
Quoted 6 lines
drivers/irqchip/irq-renesas-r2d.c new file +2
-0+}; +MODULE_DEVICE_TABLE (of, r2d_intc_dt_ids);
drivers/irqchip/irq-renesas-sh7751.c line 10
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0@@ -0,0 +1,186 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Renesas SH7751 interrupt controller driver +* +* Copyright 2023 Yoshinori Sato <[email protected]> +*/ + +#include <linux/irq.h> +#include <linux/irqchip.h> +#include <linux/of_address.h>
Do you need this?
drivers/irqchip/irq-renesas-sh7751.c line 11
Quoted 1 line
drivers/irqchip/irq-renesas-sh7751.c new file +1
-0+#include <linux/of_irq.h>
Do you need this?
drivers/irqchip/irq-renesas-sh7751.c line 74
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+static void update_ipr (struct sh7751_intc_regs *reg,int irq,int on) +{ +unsigned int addr; +int pos;
unsigned int
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+uint16_t pri; + +if (irq <64 ) { +if (ipr_table[irq] !=0xff ) {
drivers/irqchip/irq-renesas-sh7751.c line 88
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0+ addr = (ipr_table[irq] &0xf0 ) >>2 ; + pos = (ipr_table[irq] &0x0f ) *4 ; + pri = ~(0x000f << pos); + pri &=__raw_readw (reg->ipr + addr); +if (on) + pri |=1 << pos; +__raw_writew (pri, reg->ipr + addr); + } + }else { +if (pri_table[irq -64 ] <32 ) {
else if
Quoted 13 lines
drivers/irqchip/irq-renesas-sh7751.c new file +13
-0+ pos = pri_table[irq -64 ]; + pri = ~(0x000f << pos); + pri &=__raw_readw (reg->intpri00); +if (on) + pri |=1 << pos; +__raw_writew (pri, reg->intpri00); + } + } +} + +static void sh7751_disable_irq (struct irq_data *data) +{ +unsigned int irq = data->irq;
drivers/irqchip/irq-renesas-sh7751.c line 111
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0+struct sh7751_intc_regs *reg = data->chip_data; +uint16_t icr =__raw_readw (reg->icr); + +if (irq <16 && (icr &ICR_IRLM ) ==0 ) { +clear_bit (irq, imask_mask); +if (interrupt_priority <IMASK_PRIORITY - irq) + interrupt_priority =IMASK_PRIORITY - irq; +set_interrupt_registers (interrupt_priority); + }else +update_ipr (reg, irq,0 );
Missing curly braces for else case.
drivers/irqchip/irq-renesas-sh7751.c line 123
Quoted 12 lines
drivers/irqchip/irq-renesas-sh7751.c new file +12
-0+} + +static void sh7751_enable_irq (struct irq_data *data) +{ +unsigned int irq = data->irq; +struct sh7751_intc_regs *reg = data->chip_data; +uint16_t icr =__raw_readw (reg->icr); + +if (irq <16 && (icr &ICR_IRLM ) ==0 ) { +set_bit (irq, imask_mask); + interrupt_priority =IMASK_PRIORITY - +find_first_bit (imask_mask,IMASK_PRIORITY );
wrong indentation
drivers/irqchip/irq-renesas-sh7751.c line 126
Quoted 3 lines
drivers/irqchip/irq-renesas-sh7751.c new file +3
-0+set_interrupt_registers (interrupt_priority); + }else +update_ipr (reg, irq,1 );
Missing curly braces for else case.
drivers/irqchip/irq-renesas-sh7751.c line 151
Quoted 6 lines
drivers/irqchip/irq-renesas-sh7751.c new file +5
-0+} +static int __init sh7751_intc_of_init (struct device_node *intc, +struct device_node *parent) +{ +unsigned short icr;
u16
Quoted 11 lines
drivers/irqchip/irq-renesas-sh7751.c new file +11
-0+struct irq_domain *domain; +void *intc_baseaddr; +void *intc_baseaddr2; + + intc_baseaddr =of_iomap (intc,0 ); + intc_baseaddr2 =of_iomap (intc,1 ); +if (!intc_baseaddr) { +pr_err ("Invalid INTC address\n" ); +return -EINVAL ; + } +
drivers/irqchip/irq-renesas-sh7751.c line 172
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0+ sh7751_regs.icr = intc_baseaddr; + sh7751_regs.ipr = intc_baseaddr +4 ; + sh7751_regs.intpri00 = intc_baseaddr2; + sh7751_regs.intreq00 = intc_baseaddr2 +0x20 ; + sh7751_regs.intmsk00 = intc_baseaddr2 +0x40 ; + sh7751_regs.intmskclr00 = intc_baseaddr2 +0x60 ; + +if (of_property_read_bool (intc,"sh7751,irlm" )) { + icr =__raw_readw (sh7751_regs.icr); + icr |=0x80 ;// IRLM = 1
#define ICR_IRLM BIT(7)
Quoted 4 lines
drivers/irqchip/irq-renesas-sh7751.c new file +4
-0+__raw_writew (icr, sh7751_regs.icr); + } + + domain =irq_domain_add_linear (intc,NR_IRQS , &irq_ops, &sh7751_regs);
drivers/irqchip/irq-renesas-sh7751.c line 186
Quoted 10 lines
drivers/irqchip/irq-renesas-sh7751.c new file +10
-0+if (!domain) { +pr_err ("Unable to allocate domain handle\n" ); +return -ENOMEM ; + } +irq_set_default_host (domain); +return 0 ; +} + +IRQCHIP_DECLARE (sh_7751_intc, +"renesas,sh7751-intc" , sh7751_intc_of_init);
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 6/12 drivers/pci: Add SH7751 PCI Host bridge driver.
In reply to Yoshinori SatoUse Common framework host bridge driver.
--- drivers/pci/controller/Kconfig | 9 + drivers/pci/controller/Makefile | 1 + drivers/pci/controller/pci-sh7751.c | 382 ++++++++++++++++++++++++++++ drivers/pci/controller/pci-sh7751.h | 267 +++++++++++++++++++ 4 files changed, 659 insertions(+) create mode 100644 drivers/pci/controller/pci-sh7751.c create mode 100644 drivers/pci/controller/pci-sh7751.h
drivers/pci/controller/Kconfig +9 -0
@@ -343,6 +343,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 + 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/
drivers/pci/controller/pci-sh7751.c new file +382 -0
382 lines not on this page · raw message
drivers/pci/controller/pci-sh7751.h new file +267 -0
267 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 06/12] drivers/pci: Add SH7751 PCI Host bridge driver.
Hi Sato-san,
Quoted 3 lines · Yoshinori Sato
Use Common framework host bridge driver.
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/pci/controller/Kconfig config PCIE_XILINX_CPM · line 349
Quoted 10 lines
drivers/pci/controller/Kconfig +4
-0@@ -343,6 +343,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 ?
Quoted 33 lines
drivers/pci/controller/Kconfig +5
-0+ 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/pci-sh7751.c new file +21
-0@@ -0,0 +1,382 @@ +// SPDX-License-Identifier: GPL-2.0 +/* +* Renesas SH7751 PCI Host bridge 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)) +
drivers/pci/controller/pci-sh7751.c line 31
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+DEFINE_RAW_SPINLOCK (pci_config_lock); + +/* +* PCIC fixups +*/ + +#define PCIMCR_MRSET 0x40000000 +#define PCIMCR_RFSH 0x00000004 + +static void __init julian_fixup (void __iomem *pci_reg_base,void __iomem *bcr)
Please drop all the __init* annotations from this driver:
WARNING: modpost: vmlinux: section mismatch in reference:sh7751_pci_driver+0x0 (section: .data) -> set_reset_devices (section:
.init.text)
drivers/pci/controller/pci-sh7751.c line 33
Quoted 2 lines
drivers/pci/controller/pci-sh7751.c new file +2
-0+{ +unsigned long bcr1, mcr;
u32
Quoted 8 lines
drivers/pci/controller/pci-sh7751.c new file +8
-0+ + 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 );
drivers/pci/controller/pci-sh7751.c line 51
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+ +pcic_writel (0x0c000000 ,SH7751_PCICONF5 ); +pcic_writel (0xd0000000 ,SH7751_PCICONF6 ); +pcic_writel (0x0c000000 ,SH4_PCILAR0 ); +pcic_writel (0x00000000 ,SH4_PCILAR1 ); +} + +static void __init r2dplus_fixup (void __iomem *pci_reg_base,void __iomem *bcr) +{ +unsigned long bcr1, mcr;
u32
drivers/pci/controller/pci-sh7751.c line 91
Quoted 4 lines
drivers/pci/controller/pci-sh7751.c new file +4
-0+static __init void pcic_fixups (struct device_node *np, +void __iomem *pcic,void __iomem *bcr) +{ +int i;
unsigned int
Quoted 12 lines
drivers/pci/controller/pci-sh7751.c new file +11
-0+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 ; + } + } +} +/* +* We need to avoid collisions with `mirrored' VGA ports
drivers/pci/controller/pci-sh7751.c
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+* and other strange ISA hardware, so we always want the +* addresses to be allocated in the 0x000-0x0ff region +* modulo 0x400. +*/ +resource_size_t pcibios_align_resource (void *data,const struct resource *res, +resource_size_t size,resource_size_t align) +{ +resource_size_t start = res->start; + +return start;
return res->start
drivers/pci/controller/pci-sh7751.c line 234
Quoted 7 lines
drivers/pci/controller/pci-sh7751.c new file +6
-0+} +static int __init area_sdram_check (void __iomem *pci_reg_base, +void __iomem *bcr, +unsigned int area) +{ +unsigned long word;
u32
Quoted 23 lines
drivers/pci/controller/pci-sh7751.c new file +22
-0+ + word =__raw_readl (bcr +SH7751_BCR1 ); +static __init 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))
drivers/pci/controller/pci-sh7751.c line 286
Quoted 10 lines
drivers/pci/controller/pci-sh7751.c new file +10
-0+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",
%p prints an obfuscated pointer
If you would keep the original resource, you could print it with %pR.
drivers/pci/controller/pci-sh7751.c line 367
Quoted 7 lines
drivers/pci/controller/pci-sh7751.c new file +6
-0+ pci_reg_base); +static const struct of_device_id sh7751_pci_of_match[] = { + { .compatible ="renesas,sh7751-pci" , + .data = &pci_sh7751_bus_ops }, + + { },
Please no comma after a sentinel.
drivers/pci/controller/pci-sh7751.c
Quoted 2 lines
drivers/pci/controller/pci-sh7751.c new file +2
-0+}; +MODULE_DEVICE_TABLE (of, sh7751_pci_of_match);
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 7/12 clocksource: Update sh_tmu of handling.
In reply to Yoshinori Sato--- drivers/clocksource/sh_tmu.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-)
drivers/clocksource/sh_tmu.c +17 -16
@@ -420,9 +420,6 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, ced->suspend = sh_tmu_clock_event_suspend; ced->resume = sh_tmu_clock_event_resume; -dev_info (&ch->tmu->pdev->dev,"ch%u: used for clock events\n" , - ch->index); -clockevents_config_and_register (ced, ch->tmu->rate,0x300 ,0xffffffff ); ret = request_irq(ch->irq, sh_tmu_interrupt,
@@ -500,12 +497,12 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu) tmu->model =SH_TMU ; tmu->num_channels =3 ; -of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels); - -if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { -dev_err (&tmu->pdev->dev,"invalid number of channels %u\n" , - tmu->num_channels); -return -EINVAL ; +if (of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels)) { +if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { +dev_err (&tmu->pdev->dev, +"invalid number of channels %u\n" , tmu->num_channels); +return -EINVAL ; + } }return 0 ;
@@ -513,7 +510,6 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)static int sh_tmu_setup (struct sh_tmu_device *tmu,struct platform_device *pdev) { -unsigned int i;int ret; tmu->pdev = pdev;
@@ -535,6 +531,11 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)return -ENXIO ; } +if (tmu->num_channels <2 ) { +dev_err (&tmu->pdev->dev,"Invalid channels.\n" ); +return -ENXIO ; + } +/* Get hold of clock. */ tmu->clk =clk_get (&tmu->pdev->dev,"fck" );if (IS_ERR (tmu->clk)) {
@@ -573,12 +574,12 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)* Use the first channel as a clock event device and the second channel * as a clock source. */ -for (i =0 ; i < tmu->num_channels; ++i) { - ret =sh_tmu_channel_setup (&tmu->channels[i], i, - i ==0 , i ==1 , tmu); -if (ret <0 ) - goto err_unmap; - } + ret =sh_tmu_channel_setup (&tmu->channels[0 ],0 , false, true, tmu); +if (ret <0 ) + goto err_unmap; + ret =sh_tmu_channel_setup (&tmu->channels[1 ],1 , true, false, tmu); +if (ret <0 ) + goto err_unmap;platform_set_drvdata (pdev, tmu);
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling.
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Subject: Everything is an update... Drop also full stop.
You also miss commit msgs here and other places. No, please write proper messages explaining why you are doing it.
Best regards,
Krzysztof
Re: [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling.
In reply to Yoshinori SatoHi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/clocksource/sh_tmu.c static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, · line 425
Quoted 9 lines
drivers/clocksource/sh_tmu.c +0
-3@@ -420,9 +420,6 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, ced->suspend = sh_tmu_clock_event_suspend; ced->resume = sh_tmu_clock_event_resume; -dev_info (&ch->tmu->pdev->dev,"ch%u: used for clock events\n" , - ch->index); -
Why?
Quoted 9 lines
drivers/clocksource/sh_tmu.c +0
-2clockevents_config_and_register (ced, ch->tmu->rate,0x300 ,0xffffffff ); ret = request_irq(ch->irq, sh_tmu_interrupt,@@ -500,12 +497,12 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu) tmu->model =SH_TMU ; tmu->num_channels =3 ; -of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels); -
drivers/clocksource/sh_tmu.c static int sh_tmu_parse_dt(struct sh_tmu_device *tmu) · line 505
Quoted 10 lines
drivers/clocksource/sh_tmu.c +6
-4-if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { -dev_err (&tmu->pdev->dev,"invalid number of channels %u\n" , - tmu->num_channels); -return -EINVAL ; +if (of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels)) { +if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { +dev_err (&tmu->pdev->dev, +"invalid number of channels %u\n" , tmu->num_channels); +return -EINVAL ; + }
Why?
I understand TMU on SH7751 has 5 channels, so just extended the check?
Note that of_property_read_u32() returns zero on success.
Quoted 12 lines
drivers/clocksource/sh_tmu.c +0
-1}return 0 ;@@ -513,7 +510,6 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)static int sh_tmu_setup (struct sh_tmu_device *tmu,struct platform_device *pdev) { -unsigned int i;int ret; tmu->pdev = pdev;
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 538
Quoted 8 lines
drivers/clocksource/sh_tmu.c +5
-0@@ -535,6 +531,11 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)return -ENXIO ; } +if (tmu->num_channels <2 ) { +dev_err (&tmu->pdev->dev,"Invalid channels.\n" ); +return -ENXIO ; + } +
Why?
Quoted 9 lines
drivers/clocksource/sh_tmu.c +0
-2/* Get hold of clock. */ tmu->clk =clk_get (&tmu->pdev->dev,"fck" );if (IS_ERR (tmu->clk)) {@@ -573,12 +574,12 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)* Use the first channel as a clock event device and the second channel * as a clock source. */ -for (i =0 ; i < tmu->num_channels; ++i) { - ret = sh_tmu_channel_setup(&tmu->channels[i], i,
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 582
Quoted 10 lines
drivers/clocksource/sh_tmu.c +6
-4- i == 0, i == 1, tmu); -if (ret <0 ) - goto err_unmap; - } + ret =sh_tmu_channel_setup (&tmu->channels[0 ],0 , false, true, tmu); +if (ret <0 ) + goto err_unmap; + ret =sh_tmu_channel_setup (&tmu->channels[1 ],1 , true, false, tmu); +if (ret <0 ) + goto err_unmap;
Why, oh why?...
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 584
Quoted 2 lines
drivers/clocksource/sh_tmu.c +0
-0platform_set_drvdata (pdev, tmu);
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: [RESEND RFC PATCH 07/12] clocksource: Update sh_tmu of handling.
Quoted 82 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 1 line · Yoshinori Sato
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
drivers/clocksource/sh_tmu.c static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, · line 425
Quoted 9 lines
drivers/clocksource/sh_tmu.c +0
-3@@ -420,9 +420,6 @@ static void sh_tmu_register_clockevent(struct sh_tmu_channel *ch, ced->suspend = sh_tmu_clock_event_suspend; ced->resume = sh_tmu_clock_event_resume; -dev_info (&ch->tmu->pdev->dev,"ch%u: used for clock events\n" , - ch->index); -Why?
Quoted 9 lines
drivers/clocksource/sh_tmu.c +0
-2clockevents_config_and_register (ced, ch->tmu->rate,0x300 ,0xffffffff ); ret = request_irq(ch->irq, sh_tmu_interrupt,@@ -500,12 +497,12 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu) tmu->model =SH_TMU ; tmu->num_channels =3 ; -of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels); -drivers/clocksource/sh_tmu.c static int sh_tmu_parse_dt(struct sh_tmu_device *tmu) · line 505
Quoted 10 lines
drivers/clocksource/sh_tmu.c +6
-4-if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { -dev_err (&tmu->pdev->dev,"invalid number of channels %u\n" , - tmu->num_channels); -return -EINVAL ; +if (of_property_read_u32 (np,"#renesas,channels" , &tmu->num_channels)) { +if (tmu->num_channels !=2 && tmu->num_channels !=3 ) { +dev_err (&tmu->pdev->dev, +"invalid number of channels %u\n" , tmu->num_channels); +return -EINVAL ; + }Why?
I understand TMU on SH7751 has 5 channels, so just extended the check?Note that
of_property_read_u32()returns zero on success.Quoted 12 lines
drivers/clocksource/sh_tmu.c +0
-1}return 0 ;@@ -513,7 +510,6 @@ static int sh_tmu_parse_dt(struct sh_tmu_device *tmu)static int sh_tmu_setup (struct sh_tmu_device *tmu,struct platform_device *pdev) { -unsigned int i;int ret; tmu->pdev = pdev;drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 538
Quoted 8 lines
drivers/clocksource/sh_tmu.c +5
-0@@ -535,6 +531,11 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)return -ENXIO ; } +if (tmu->num_channels <2 ) { +dev_err (&tmu->pdev->dev,"Invalid channels.\n" ); +return -ENXIO ; + } +Why?
Quoted 13 lines
drivers/clocksource/sh_tmu.c +0
-6/* Get hold of clock. */ tmu->clk =clk_get (&tmu->pdev->dev,"fck" );if (IS_ERR (tmu->clk)) {@@ -573,12 +574,12 @@ static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev)* Use the first channel as a clock event device and the second channel * as a clock source. */ -for (i =0 ; i < tmu->num_channels; ++i) { - ret =sh_tmu_channel_setup (&tmu->channels[i], i, - i ==0 , i ==1 , tmu); -if (ret <0 ) - goto err_unmap; - }
Quoted 8 lines
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 582
Quoted 6 lines
drivers/clocksource/sh_tmu.c +6
-0+ ret =sh_tmu_channel_setup (&tmu->channels[0 ],0 , false, true, tmu); +if (ret <0 ) + goto err_unmap; + ret =sh_tmu_channel_setup (&tmu->channels[1 ],1 , true, false, tmu); +if (ret <0 ) + goto err_unmap;Why, oh why?...
Sorry.
This is the wrong version.
I will update this to the correct one as I will also fix other parts.
Quoted 13 lines
drivers/clocksource/sh_tmu.c static int sh_tmu_setup(struct sh_tmu_device *tmu, struct platform_device *pdev) · line 584
Quoted 2 lines
drivers/clocksource/sh_tmu.c +0
-0platform_set_drvdata (pdev, tmu);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 8/12 mfd/sm501: Add OF properties.
In reply to Yoshinori SatoSome parameters only platform_device.
Added same parameters in OF property.
--- .../devicetree/bindings/display/sm501fb.txt | 11 ++ drivers/mfd/sm501.c | 113 +++++++++++++++++- 2 files changed, 123 insertions(+), 1 deletion(-)
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 {
drivers/mfd/sm501.c +112 -1
137 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 08/12] mfd/sm501: Add OF properties.
Quoted 2 lines · Yoshinori Sato
Some parameters only
platform_device.
Added same parameters in OF property.
Subject: everything can be "add of properties". Is some next commit adding properties to this file going to have the same subject? Please write subjects matching changes.
Quoted 5 lines
Signed-off-by Yoshinori Sato <[email protected]>--- .../devicetree/bindings/display/sm501fb.txt | 11 ++ drivers/mfd/sm501.c | 113 +++++++++++++++++-
Nope, bindings are never mixed with drivers.
And you clearly did not run checkpatch, so:
Please run scripts/checkpatch.pl and fix reported warnings. Some warnings can be ignored, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.
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.
Quoted 11 lines
2 files changed, 123 insertions(+), 1 deletion(-)Documentation/devicetree/bindings/display/sm501fb.txt +1
-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.
Documentation/devicetree/bindings/display/sm501fb.txt Optional properties: · line 33
Quoted 10 lines
Documentation/devicetree/bindings/display/sm501fb.txt +10
-0+ 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.
Sorry, new properties are allowed only in DT schema format. Convert bindings to DT schema first.
Best regards,
Krzysztof
Re: [RESEND RFC PATCH 08/12] mfd/sm501: Add OF properties.
In reply to Yoshinori SatoHi Sato-san,
Quoted 4 lines · Yoshinori Sato
Some parameters only
platform_device.
Added same parameters in OF property.Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/mfd/sm501.c struct sm501_devdata { · line 85
Quoted 9 lines
drivers/mfd/sm501.c +3
-0@@ -80,6 +80,9 @@ struct sm501_devdata {unsigned int irq;void __iomem *regs;unsigned int rev; +#if defined(CONFIG_OF ) +struct device_node *np; +#endif
"np" is only used during probing, so you can just pass it as a parameter instead.
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1376
Quoted 8 lines
drivers/mfd/sm501.c +1
-0};@@ -1370,6 +1373,106 @@ static int sm501_init_dev(struct sm501_devdata *sm)return 0 ; } +static unsigned int sm501_parse_devices_str (const char *str)
This function is unused when COFNIG_OF=n, so please move inside the #idef below.
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1380
Quoted 4 lines
drivers/mfd/sm501.c +4
-0+{ +char *sep; +unsigned int device =0 ; +int i;
unsigned int
Quoted 32 lines
drivers/mfd/sm501.c +32
-0+int len; +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 }, + }; + +do { + sep =strchr (str,',' ); + len = sep ? sep - str :strlen (str); +for (i =0 ; i <ARRAY_SIZE (devlist); i++) { +if (strncasecmp (str, devlist[i].devname, len) ==0 ) { + device |= devlist[i].devid; +break ; + } + } + str = sep +1 ; + }while (sep); +return device; +} +
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1422
Quoted 10 lines
drivers/mfd/sm501.c +10
-0+#if defined(CONFIG_OF ) +static void sm501_of_read_reg_init (struct sm501_devdata *sm, +const char *propname,struct sm501_reg_init *val) +{ +u32 u32_val; + +if (!of_property_read_u32_index (sm->np, propname,0 , &u32_val)) + val->set = u32_val; +if (!of_property_read_u32_index (sm->np, propname,1 , &u32_val)) + val->mask = u32_val;
Error handling?
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1432
Quoted 10 lines
drivers/mfd/sm501.c +10
-0+} + +static int sm501_parse_dt (struct sm501_devdata *sm) +{ +struct sm501_platdata *plat; +const char *devstr; +u32 u32_val; + +if (sm->np ==NULL ) +return 0 ;
This cannot happen.
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1433
Quoted 1 line
drivers/mfd/sm501.c +1
-0+ plat =kzalloc (sizeof (struct sm501_platdata ),GFP_KERNEL );
devm_kzalloc(), to simplify error handling
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1436
Quoted 3 lines
drivers/mfd/sm501.c +3
-0+if (plat ==NULL ) +return -ENOMEM ; + plat->init =kzalloc (sizeof (struct sm501_initdata ),GFP_KERNEL );
devm_kzalloc()
drivers/mfd/sm501.c static int sm501_init_dev(struct sm501_devdata *sm) · line 1445
Quoted 9 lines
drivers/mfd/sm501.c +9
-0+if (plat->init ==NULL ) + goto err; + +if (!of_property_read_string (sm->np,"sm501,devices" , &devstr)) + plat->init->devices =sm501_parse_devices_str (devstr); +if (!of_property_read_u32_index (sm->np,"sm501,mclk" ,0 , &u32_val)) + plat->init->mclk = u32_val; +if (!of_property_read_u32_index (sm->np,"sm501,m1xclk" ,0 , &u32_val)) + plat->init->m1xclk = u32_val;
Do you need any error handling?
drivers/mfd/sm501.c static int sm501_plat_probe(struct platform_device *dev) · line 1387
Quoted 8 lines
drivers/mfd/sm501.c +0
-1static int sm501_plat_probe (struct platform_device *dev) {struct sm501_devdata *sm;@@ -1384,7 +1487,6 @@ static int sm501_plat_probe(struct platform_device *dev) sm->dev = &dev->dev; sm->pdev_id = dev->id; sm->platdata =dev_get_platdata (&dev->dev); -
Please keep this blank line.
drivers/mfd/sm501.c static int sm501_plat_probe(struct platform_device *dev) · line 1492
Quoted 3 lines
drivers/mfd/sm501.c +0
-0ret =platform_get_irq (dev,0 );if (ret <0 ) goto err_res;
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 9/12 of: FDT vaddr support for SH.
In reply to Yoshinori Satosh using virt address in FDT.
--- drivers/of/fdt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/of/fdt.c +3 -0
@@ -643,6 +643,9 @@ void __init early_init_fdt_scan_reserved_mem(void)fdt_get_mem_rsv (initial_boot_params, n, &base, &size);if (!size)break ; +#ifdef CONFIG_SUPERH + base =virt_to_phys (base); +#endif memblock_reserve (base, size); }
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 09/12] of: FDT vaddr support for SH.
Quoted 4 lines · Yoshinori Sato
sh using virt address in FDT.
Signed-off-by Yoshinori Sato <[email protected]>---
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC (and consider --no-git-fallback argument). 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.
Best regards,
Krzysztof
Re: [RESEND RFC PATCH 09/12] of: FDT vaddr support for SH.
In reply to Yoshinori SatoHi Sato-san,
Quoted 3 lines · Yoshinori Sato
sh using virt address in FDT.
Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/of/fdt.c void __init early_init_fdt_scan_reserved_mem(void) · line 648
Quoted 9 lines
drivers/of/fdt.c +3
-0@@ -643,6 +643,9 @@ void __init early_init_fdt_scan_reserved_mem(void)fdt_get_mem_rsv (initial_boot_params, n, &base, &size);if (!size)break ; +#ifdef CONFIG_SUPERH + base =virt_to_phys (base); +#endif
I guess this is a no-go.
Why can't you use physical address, like all other platforms?
drivers/of/fdt.c void __init early_init_fdt_scan_reserved_mem(void) · line 651
Quoted 3 lines
drivers/of/fdt.c +0
-0memblock_reserve (base, size); }
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: [RESEND RFC PATCH 09/12] of: FDT vaddr support for SH.
Quoted 11 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 3 lines · Yoshinori Sato
sh using virt address in FDT.
Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
Quoted 12 lines
drivers/of/fdt.c void __init early_init_fdt_scan_reserved_mem(void) · line 648
Quoted 9 lines
drivers/of/fdt.c +3
-0@@ -643,6 +643,9 @@ void __init early_init_fdt_scan_reserved_mem(void)fdt_get_mem_rsv (initial_boot_params, n, &base, &size);if (!size)break ; +#ifdef CONFIG_SUPERH + base =virt_to_phys (base); +#endif I guess this is a no-go.
Why can't you use physical address, like all other platforms?
I changed this before so I don't remember the exact details, but I feel like it was related to the built-in DTB.
I think the correct way is to handle it in the SH dependent part.
Quoted 14 lines
drivers/of/fdt.c void __init early_init_fdt_scan_reserved_mem(void) · line 651
Quoted 3 lines
drivers/of/fdt.c +0
-0memblock_reserve (base, size); }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 10/12 serial/sh-sci: Fix earlyprintk / earlycon.
In reply to Yoshinori Sato- earlyprintk having fault.
- fix shortname conflict.
- fix SCI regshift in SH4.
--- drivers/tty/serial/sh-sci.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/tty/serial/sh-sci.c +7 -3
@@ -2721,7 +2721,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);
@@ -3507,6 +3507,10 @@ static int __init early_console_setup(struct earlycon_device *device,if (!device->port.membase)return -ENODEV ; +if (type ==PORT_SCI && + (IS_ENABLED (CONFIG_CPU_SH3 ) ||IS_ENABLED (CONFIG_CPU_SH4 ))) { + device->port.regshift =2 ; + } device->port.serial_in = sci_serial_in; device->port.serial_out = sci_serial_out; device->port.type = type;
@@ -3556,8 +3560,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: [RESEND RFC PATCH 10/12] serial/sh-sci: Fix earlyprintk / earlycon.
Hi Sato-san,
Quoted 5 lines · Yoshinori Sato
- earlyprintk having fault.
- fix shortname conflict.
- fix SCI regshift in SH4.Signed-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
drivers/tty/serial/sh-sci.c static int sci_remap_port(struct uart_port *port) · line 2724
Quoted 8 lines
drivers/tty/serial/sh-sci.c +1
-1@@ -2721,7 +2721,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 )) {
Why is this needed? It works fine on arm32, arm64, and riscv.
drivers/tty/serial/sh-sci.c static int __init early_console_setup(struct earlycon_device *device, · line 3513
Quoted 11 lines
drivers/tty/serial/sh-sci.c +4
-0port->membase =ioremap (port->mapbase, sport->reg_size);if (unlikely (!port->membase)) {dev_err (port->dev,"can't remap port#%d\n" , port->line);@@ -3507,6 +3507,10 @@ static int __init early_console_setup(struct earlycon_device *device,if (!device->port.membase)return -ENODEV ; +if (type ==PORT_SCI && + (IS_ENABLED (CONFIG_CPU_SH3 ) ||IS_ENABLED (CONFIG_CPU_SH4 ))) { + device->port.regshift =2 ; + }
How do you run into this, given you don't have any SCI ports enabled in your DTS, only SCIF?
Anyway, I think this should be fixed in sci_init_single(), by extending the driver to support the more-or-less standard "reg-shift" DT property (as I said before in
https://lore.kernel.org/all/CAMuHMdW2gxDzYbP_0Z90o8mHdUm_BV6e+gMHpELJx_g=ezAbdw@mail.gmail.com).
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3564
Quoted 11 lines
drivers/tty/serial/sh-sci.c +2
-2device->port.serial_in = sci_serial_in; device->port.serial_out = sci_serial_out; device->port.type = type;@@ -3556,8 +3560,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);
Why?
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3567
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
--
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: [RESEND RFC PATCH 10/12] serial/sh-sci: Fix earlyprintk / earlycon.
Quoted 19 lines · Geert Uytterhoeven
Hi Sato-san,
Quoted 5 lines · Yoshinori Sato
- earlyprintk having fault.
- fix shortname conflict.
- fix SCI regshift in SH4.Signed-off-by Yoshinori Sato <[email protected]>Thanks for your patch!
Quoted 6 lines
drivers/tty/serial/sh-sci.c +0
-0@@ -2721,7 +2721,7 @@ static int sci_remap_port(struct uart_port *port)if (port->membase)return 0 ;
Quoted 4 lines
drivers/tty/serial/sh-sci.c static int sci_remap_port(struct uart_port *port) · line 2724
Quoted 2 lines
drivers/tty/serial/sh-sci.c +1
-1-if (port->dev->of_node || (port->flags &UPF_IOREMAP )) { +if ((port->dev && port->dev->of_node) || (port->flags &UPF_IOREMAP )) {Why is this needed? It works fine on arm32, arm64, and riscv.
earlycon works fine, but the old earlyprintk was stuck. I don't think it's used much, but it's a problem if it doesn't work when checking old sh targets.
Quoted 15 lines
drivers/tty/serial/sh-sci.c static int __init early_console_setup(struct earlycon_device *device, · line 3513
Quoted 11 lines
drivers/tty/serial/sh-sci.c +4
-0port->membase =ioremap (port->mapbase, sport->reg_size);if (unlikely (!port->membase)) {dev_err (port->dev,"can't remap port#%d\n" , port->line);@@ -3507,6 +3507,10 @@ static int __init early_console_setup(struct earlycon_device *device,if (!device->port.membase)return -ENODEV ; +if (type ==PORT_SCI && + (IS_ENABLED (CONFIG_CPU_SH3 ) ||IS_ENABLED (CONFIG_CPU_SH4 ))) { + device->port.regshift =2 ; + }How do you run into this, given you don't have any SCI ports enabled in your DTS, only SCIF?
Quoted 4 lines
Anyway, I think this should be fixed in
sci_init_single(), by extending the driver to support the more-or-less standard "reg-shift" DT property (as I said before in
https://lore.kernel.org/all/CAMuHMdW2gxDzYbP_0Z90o8mHdUm_BV6e+gMHpELJx_g=ezAbdw@mail.gmail.com).
earlycon cannot reference DeviceTree.
If you give the value of reg-shift dynamically, you need to use a kernel parameter.
I don't think this is necessary either, but it's a problem if it doesn't work.
Quoted 5 lines
Quoted 5 lines
drivers/tty/serial/sh-sci.c +0
-0device->port.serial_in = sci_serial_in; device->port.serial_out = sci_serial_out; device->port.type = type;@@ -3556,8 +3560,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 3564
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);Why?
The earlycon parameter uses the first name.
If sh4 and rz use the same name, one of them will not work properly.
Quoted 15 lines
drivers/tty/serial/sh-sci.c static int __init hscif_early_console_setup(struct earlycon_device *device, · line 3567
Quoted 4 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
--
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 11/12 sh: target dts.
In reply to Yoshinori Sato- rts7751r2dplus - Renesas RTS7751R2D-PLUS board.
- landisk - IO DATA DEVICE LANDISK
- usl-5p - IO DATA DECVICE USL-5P
--- arch/sh/boot/dts/include/dt-bindings | 1 + arch/sh/boot/dts/landisk.dts | 142 ++++++++++++++++++++++ arch/sh/boot/dts/rts7751r2dplus.dts | 168 +++++++++++++++++++++++++++ arch/sh/boot/dts/usl-5p.dts | 146 +++++++++++++++++++++++ 4 files changed, 457 insertions(+) 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/usl-5p.dts
arch/sh/boot/dts/include/dt-bindings new file +1 -0
@@ -0,0 +1 @@ +../../../../../include/dt-bindings
arch/sh/boot/dts/landisk.dts new file +142 -0
142 lines not on this page · raw message
arch/sh/boot/dts/rts7751r2dplus.dts new file +168 -0
168 lines not on this page · raw message
arch/sh/boot/dts/usl-5p.dts new file +146 -0
146 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [RESEND RFC PATCH 11/12] sh: target dts.
Hi Sato-san,
Quoted 5 lines · Yoshinori Sato
- rts7751r2dplus - Renesas RTS7751R2D-PLUS board.
- landisk - IO DATA DEVICE LANDISK
- usl-5p - IO DATA DECVICE USL-5PSigned-off-by Yoshinori Sato <[email protected]>
Thanks for your patch!
Quoted 4 lines
arch/sh/boot/dts/include/dt-bindings | 1 + arch/sh/boot/dts/landisk.dts | 142 ++++++++++++++++++++++ arch/sh/boot/dts/rts7751r2dplus.dts | 168 +++++++++++++++++++++++++++ arch/sh/boot/dts/usl-5p.dts | 146 +++++++++++++++++++++++
None of the DTBs are listed in arch/sh/boot/dts/Makefile, so how do you build them without CONFIG_USE_BUILTIN_DTB/CONFIG_BUILTIN_DTB_SOURCE?
To make "make dtbs" and "make dtbs_check" work, I added:
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.dtbQuoted 6 lines
arch/sh/boot/dts/landisk.dts new file +3
-0@@ -0,0 +1,142 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree source for IO DATA DEVICE LANDISK
arch/sh/boot/dts/landisk.dts line 13
Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10
-0+ * + * Copyright 2023 Yoshinori Sato + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> + +/dts-v1/; +/ { + model = "IO-DATA Device LANDISK"; + compatible = "iodata,landisk";
compatible = "iodata,landisk", "renesas,sh7380", "renesas,sh7751r".
arch/sh/boot/dts/landisk.dts line 16
Quoted 3 lines
arch/sh/boot/dts/landisk.dts new file +3
-0+ #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&shintc>;
Empty line between properties and subnodes (everywhere).
arch/sh/boot/dts/landisk.dts line 18
Quoted 2 lines
arch/sh/boot/dts/landisk.dts new file +2
-0+ chosen { + stdout-path = &sci1;
stdout-path = "serial0";
or
stdout-path = "serial0:9600n8";
arch/sh/boot/dts/landisk.dts line 19
Quoted 1 line
arch/sh/boot/dts/landisk.dts new file +1
-0+ };
Empty line between subnodes (everywhere).
Quoted 31 lines
arch/sh/boot/dts/landisk.dts new file +31
-0+ aliases { + serial1 = &sci1; + }; + + oclk: oscillator { + #clock-cells = <0>; + compatible = "fixed-clock"; + clock-frequency = <22222222>; + }; + pllclk: pllclk { + compatible = "renesas,sh7750-pll-clock"; + clocks = <&oclk>; + #clock-cells = <0>; + sh7750,md = <5>; + sh7750,rtype = <1>; + reg = <0xffc00000 2>, <0xffc00008 4>; + }; + iclk: iclk { + compatible = "renesas,sh7750-div-clock"; + clocks = <&pllclk>; + #clock-cells = <0>; + reg = <0xffc00000 2>; + renesas,offset = <6>; + clock-output-names = "ick"; + }; + bclk: bclk { + compatible = "renesas,sh7750-div-clock"; + clocks = <&pllclk>; + #clock-cells = <0>; + reg = <0xffc00000 2>; + renesas,offset = <3>;
arch/sh/boot/dts/landisk.dts line 60
Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10
-0+ clock-output-names = "bck"; + }; + fclk: fclk { + compatible = "renesas,sh7750-div-clock"; + clocks = <&pllclk>; + #clock-cells = <0>; + reg = <0xffc00000 2>; + renesas,offset = <0>; + clock-output-names = "fck"; + };
Having individual clock nodes (especially if they use the same register block) is deprecated. Please use a single node with compatible value e.g. "renesas,sh7751r-cpg" and "#clock-cells = <1>", and let the driver create all clocks itself.
arch/sh/boot/dts/landisk.dts line 61
Quoted 1 line
arch/sh/boot/dts/landisk.dts new file +1
-0+ sci1: serial@ffe80000 {
label "scif" (serial@ffe00000 is "sci").
arch/sh/boot/dts/landisk.dts line 62
Quoted 1 line
arch/sh/boot/dts/landisk.dts new file +1
-0+ compatible = "renesas,scif";
"renesas,scif-sh7751r", "renesas,scif" ?
arch/sh/boot/dts/landisk.dts line 93
Quoted 5 lines
arch/sh/boot/dts/landisk.dts new file +5
-0+ reg = <0xffe80000 0x100>; + interrupts = <evt2irq(0x700) 0 + evt2irq(0x720) 0 + evt2irq(0x760) 0 + evt2irq(0x740) 0>;
Please group using angular brackets:
interrupts = <evt2irq(0x700) 0>,
<evt2irq(0x720) 0>,
<evt2irq(0x760) 0>,
<evt2irq(0x740) 0>;Missing interrupt-names
arch/sh/boot/dts/landisk.dts line 102
Quoted 9 lines
arch/sh/boot/dts/landisk.dts new file +9
-0+ clocks = <&fclk>; + clock-names = "fck"; + }; + tmu: timer@ffd80008 { + compatible = "renesas,tmu"; + reg = <0xffd80000 12>; + interrupts = <evt2irq(0x400) 0 + evt2irq(0x420) 0 + evt2irq(0x440) 0>;
Please group using angular brackets
arch/sh/boot/dts/landisk.dts line 105
Quoted 3 lines
arch/sh/boot/dts/landisk.dts new file +3
-0+ clocks = <&fclk>; + clock-names = "fck"; + renesas,channels = <0x03>;
renesas,channels = <5>;
arch/sh/boot/dts/landisk.dts line 109
Quoted 4 lines
arch/sh/boot/dts/landisk.dts new file +4
-0+ }; + + pci@fe200000 { + compatible = "renesas,sh7751-pci", "iodata,julian";
Most-specific first, i.e.
compatible = "iodata,julian", "renesas,sh7751-pci";
(and we do need DT binding documentation!)
However, "iodata,julian" is a too-generic name.
Quoted 23 lines
arch/sh/boot/dts/landisk.dts new file +23
-0+ device_type = "pci"; + bus-range = <0 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>; + interrupt-parent = <&julianintc>; + eth@0,0 { + reg = <0x0000 0 0 0 0>; + interrupts = <5 0>; + }; + ata@1,0 { + reg = <0x0800 0 0 0 0>; + interrupts = <6 0>; + }; + usb@2,0 { + reg = <0x1000 0 0 0 0>; + interrupts = <7 0>; + };
arch/sh/boot/dts/landisk.dts line 142
Quoted 10 lines
arch/sh/boot/dts/landisk.dts new file +10
-0+ usb@2,1 { + reg = <0x1100 0 0 0 0>; + interrupts = <8 0>; + }; + usb@2,2 { + reg = <0x1200 0 0 0 0>; + interrupts = <5 0>; + }; + }; +};
All SoC-specific parts should be extracted into sh7751r.dtsi, so it can be shared by all board DTS files.
Quoted 9 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +3
-0@@ -0,0 +1,168 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree source for Renesas RTS7751R2D Plus
arch/sh/boot/dts/rts7751r2dplus.dts line 13
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +10
-0+ * + * Copyright 2023 Yoshinori Sato + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> + +/dts-v1/; +/ { + model = "Renesas RTS7715R2D Plus"; + compatible = "renesas,r2dplus";
compatible = "renesas,r2dplus", "renesas,sh7751r".
arch/sh/boot/dts/rts7751r2dplus.dts line 111
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ display@1,0 { + compatible = "smi,sm501"; + reg = <0x10000000 0x03e00000 + 0x13e00000 0x00200000>;
Please group using angular brackets.
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ interrupt-parent = <&r2dintc>; + interrupts = <4 0>; + mode = "640x480-16@60"; + little-endian;
arch/sh/boot/dts/rts7751r2dplus.dts line 132
Quoted 10 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +9
-0+ sm501,devices = "usb-host,uart0"; + }; + flash@0 { + compatible = "cfi-flash"; + reg = <0x00000000 0x02000000>; + device-width = <2>; + #address-cells = <1>; + #size-cells = <1>; + partition@0 {
Please wrap all partitions inside a "partitions" subnode.
arch/sh/boot/dts/rts7751r2dplus.dts line 136
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ label = "U-Boot"; + reg = <0x00000000 0x00040000>; + }; + partition@1 {
partition@40000
arch/sh/boot/dts/rts7751r2dplus.dts line 140
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ label = "Environemt"; + reg = <0x00040000 0x00040000>; + }; + partition@2 {
partition@80000
arch/sh/boot/dts/rts7751r2dplus.dts line 144
Quoted 4 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +4
-0+ label = "Kernel"; + reg = <0x00080000 0x001c0000>; + }; + partition@3 {
partition@240000
arch/sh/boot/dts/rts7751r2dplus.dts line 151
Quoted 7 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +7
-0+ label = "Flash_FS"; + reg = <0x00240000 0x00dc0000>; + }; + }; + + pci@fe200000 { + compatible = "renesas,sh7751-pci", "renesas,r2d";
compatible = "renesas,r2d", "renesas,sh7751-pci";
However, "renesas,r2d" is a too-generic name.
Quoted 24 lines
arch/sh/boot/dts/rts7751r2dplus.dts new file +17
-0+ device_type = "pci"; + bus-range = <0 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>; + interrupt-parent = <&r2dintc>; + eth@2,0 { + reg = <0x1000 0 0 0 0>; + interrupts = <3 0>; + }; + }; +};arch/sh/boot/dts/usl-5p.dts new file +3
-0@@ -0,0 +1,146 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Device Tree source for IO DATA DEVICE USL-5P
arch/sh/boot/dts/usl-5p.dts line 13
Quoted 10 lines
arch/sh/boot/dts/usl-5p.dts new file +10
-0+ * + * Copyright 2023 Yoshinori Sato + */ + +#include <dt-bindings/interrupt-controller/sh_intc.h> + +/dts-v1/; +/ { + model = "IO-DATA Device USL-5P"; + compatible = "iodata,usl-5p";
compatible = "iodata,usl-5p", "renesas,sh7380", "renesas,sh7751r".
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Yoshinori Sato
maintainerRFC PATCH 12/12 sh: OF defconfig.
In reply to Yoshinori Sato--- arch/sh/configs/landisk-of_defconfig | 161 ++++++++++++++++++++ arch/sh/configs/rts7751r2dplus-of_defconfig | 159 +++++++++++++++++++ 2 files changed, 320 insertions(+) create mode 100644 arch/sh/configs/landisk-of_defconfig create mode 100644 arch/sh/configs/rts7751r2dplus-of_defconfig
arch/sh/configs/landisk-of_defconfig new file +161 -0
@@ -0,0 +1,161 @@ +CONFIG_SYSVIPC=y +CONFIG_LOG_BUF_SHIFT=14 +CONFIG_NAMESPACES=y +CONFIG_EMBEDDED=y +CONFIG_PROFILING=y +CONFIG_CPU_SUBTYPE_SH7751R=y +CONFIG_MEMORY_START=0x0c000000 +CONFIG_SH_LANDISK_OF=y +CONFIG_MODULES=y +CONFIG_SLAB=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_ATP867X=y +CONFIG_PATA_OF_PLATFORM=y +CONFIG_NETDEVICES=y +# CONFIG_NET_VENDOR_3COM is not set +# CONFIG_NET_VENDOR_ADAPTEC is not set +# CONFIG_NET_VENDOR_AGERE is not set +# CONFIG_NET_VENDOR_ALACRITECH is not set +# CONFIG_NET_VENDOR_ALTEON is not set +# CONFIG_NET_VENDOR_AMAZON is not set +# CONFIG_NET_VENDOR_AMD is not set +# CONFIG_NET_VENDOR_AQUANTIA is not set +# CONFIG_NET_VENDOR_ARC is not set +# CONFIG_NET_VENDOR_ASIX is not set +# CONFIG_NET_VENDOR_ATHEROS is not set +# CONFIG_NET_VENDOR_BROADCOM is not set +# CONFIG_NET_VENDOR_CADENCE is not set +# CONFIG_NET_VENDOR_CAVIUM is not set +# CONFIG_NET_VENDOR_CHELSIO is not set +# CONFIG_NET_VENDOR_CISCO is not set +# CONFIG_NET_VENDOR_CORTINA is not set +# CONFIG_NET_VENDOR_DAVICOM is not set +# CONFIG_NET_VENDOR_DEC is not set +# CONFIG_NET_VENDOR_DLINK is not set +# CONFIG_NET_VENDOR_EMULEX is not set +# CONFIG_NET_VENDOR_ENGLEDER is not set +# CONFIG_NET_VENDOR_EZCHIP is not set +# CONFIG_NET_VENDOR_FUNGIBLE is not set +# CONFIG_NET_VENDOR_GOOGLE is not set +# CONFIG_NET_VENDOR_HUAWEI is not set +# CONFIG_NET_VENDOR_INTEL is not set +# CONFIG_NET_VENDOR_ADI is not set +# CONFIG_NET_VENDOR_LITEX is not set +# CONFIG_NET_VENDOR_MARVELL is not set +# CONFIG_NET_VENDOR_MELLANOX is not set +# CONFIG_NET_VENDOR_MICREL is not set +# CONFIG_NET_VENDOR_MICROCHIP is not set +# CONFIG_NET_VENDOR_MICROSEMI is not set +# CONFIG_NET_VENDOR_MICROSOFT is not set +# CONFIG_NET_VENDOR_MYRI is not set +# CONFIG_NET_VENDOR_NI is not set +# CONFIG_NET_VENDOR_NATSEMI is not set +# CONFIG_NET_VENDOR_NETERION is not set +# CONFIG_NET_VENDOR_NETRONOME is not set +# CONFIG_NET_VENDOR_NVIDIA is not set +# CONFIG_NET_VENDOR_OKI is not set +# CONFIG_NET_VENDOR_PACKET_ENGINES is not set +# CONFIG_NET_VENDOR_PENSANDO is not set +# CONFIG_NET_VENDOR_QLOGIC is not set +# CONFIG_NET_VENDOR_BROCADE is not set +# CONFIG_NET_VENDOR_QUALCOMM is not set +# CONFIG_NET_VENDOR_RDC is not set +CONFIG_8139CP=y +# CONFIG_NET_VENDOR_RENESAS is not set +# CONFIG_NET_VENDOR_ROCKER is not set +# CONFIG_NET_VENDOR_SAMSUNG is not set +# CONFIG_NET_VENDOR_SEEQ is not set +# CONFIG_NET_VENDOR_SILAN is not set +# CONFIG_NET_VENDOR_SIS is not set +# CONFIG_NET_VENDOR_SOLARFLARE is not set +# CONFIG_NET_VENDOR_SMSC is not set +# CONFIG_NET_VENDOR_SOCIONEXT is not set +# CONFIG_NET_VENDOR_STMICRO is not set +# CONFIG_NET_VENDOR_SUN is not set +# CONFIG_NET_VENDOR_SYNOPSYS is not set +# CONFIG_NET_VENDOR_TEHUTI is not set +# CONFIG_NET_VENDOR_TI is not set +# CONFIG_NET_VENDOR_VERTEXCOM is not set +# CONFIG_NET_VENDOR_VIA is not set +# CONFIG_NET_VENDOR_WANGXUN is not set +# CONFIG_NET_VENDOR_WIZNET is not set +# CONFIG_NET_VENDOR_XILINX 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_OF_PLATFORM=y +CONFIG_SERIAL_SH_SCI=y +# CONFIG_SERIAL_SH_SCI_CONSOLE is not set +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_EHCI_HCD=y +CONFIG_USB_OHCI_HCD=y +CONFIG_USB_STORAGE=y +CONFIG_RTC_CLASS=y +CONFIG_RTC_DRV_R9701=y +CONFIG_COMMON_CLK_SH7750=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_INFO_DWARF5=y +CONFIG_DEBUG_FS=y +CONFIG_DEBUG_MEMORY_INIT=y +# CONFIG_FTRACE is not set
arch/sh/configs/rts7751r2dplus-of_defconfig new file +159 -0
159 lines not on this page · raw message
Signature · 1 line
2.39.2