ARM: renesas RCar: Add boot-mode-reg core support
Subsystems (8)
v2 cover ARM: renesas RCar: Add boot-mode-reg core support
This is a resend of
http://www.spinics.net/lists/linux-sh/msg45969.html
Besides some minor clean up and fixes, it's rebased against
https://git.kernel.org/cgit/linux/kernel/git/geert/renesas-drivers.git/log/?h=topic/gen3-latest0ea1cc9f0c9537d3fb42722c188
[WIP] arm64: r8a7796: Integration
and adds support for RCar Gen3. Additionally, it moves the MODEMR register to device tree instead of hard coding its address.
These patches are available in
https://github.com/dirkbehme/linux-renesas-rcar-gen3/commits/geert/topic/gen3-latest-modereg
too.
It's boot tested on r8a7795 Salvator-X and checked that the same mode value is read without and with this patch series.
Dirk
Changes in v2:
* Correct link & subject in introduction patch 0000
* Fix some spelling errors
* Drop the goto in boot_mode_reg_get() and boot_mode_reg_get()
* Convert device tree node to renesas,rcar-rst and use whole reset device
* Add devcie tree node documentation
* Preserve compatibility with old DTBs that don't have the node in DT
PATCH v2 1/10 boot-mode-reg: Add core
From: Simon Horman <[email protected]>
The motivation for this new module is to add a small frame work to allow kernel subsystems to obtain boot mode information from a centralised source using a new, and hopefully soon well-known, API.
The new API consists of two function calls and nothing more:
boot_mode_reg_set: Should be called by platform-specific drivers
to register the boot mode register value which they obtain from hardware or otherwise.
boot_mode_reg_get: Should be called by consumers; subsystems that
wish to know he boot mode register.
The boot mode register is a 32bit unsigned entity, the meaning of its values are implementation dependent.
--- MAINTAINERS | 1 + drivers/misc/Kconfig | 1 + drivers/misc/Makefile | 1 + drivers/misc/boot-mode-reg/Kconfig | 11 ++++++ drivers/misc/boot-mode-reg/Makefile | 6 +++ drivers/misc/boot-mode-reg/core.c | 76 +++++++++++++++++++++++++++++++++++++ include/misc/boot-mode-reg.h | 24 ++++++++++++ 7 files changed, 120 insertions(+) create mode 100644 drivers/misc/boot-mode-reg/Kconfig create mode 100644 drivers/misc/boot-mode-reg/Makefile create mode 100644 drivers/misc/boot-mode-reg/core.c create mode 100644 include/misc/boot-mode-reg.h
MAINTAINERS +1 -0
@@ -10734,6 +10734,7 @@ S: Maintained F: Documentation/sh/ F: arch/sh/ F: drivers/sh/ +F: drivers/misc/boot-mode-reg/ SUSPEND TO RAM M: "Rafael J. Wysocki" <[email protected]>
drivers/misc/Kconfig +1 -0
@@ -816,4 +816,5 @@ source "drivers/misc/mic/Kconfig" source "drivers/misc/genwqe/Kconfig" source "drivers/misc/echo/Kconfig" source "drivers/misc/cxl/Kconfig" +source "drivers/misc/boot-mode-reg/Kconfig" endmenu
drivers/misc/Makefile +1 -0
@@ -57,3 +57,4 @@ obj-$(CONFIG_ECHO) += echo/ obj-$(CONFIG_VEXPRESS_SYSCFG) += vexpress-syscfg.o obj-$(CONFIG_CXL_BASE) += cxl/ obj-$(CONFIG_PANEL) += panel.o +obj-$(CONFIG_BOOT_MODE_REG_CORE) += boot-mode-reg/
drivers/misc/boot-mode-reg/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +# +# Boot Mode Register Drivers +# + +config BOOT_MODE_REG_CORE + tristate "Boot Mode Register Core Driver" + default n + depends on ARCH_SHMOBILE || ARCH_RENESAS || COMPILE_TEST + help + Say Y here to allow support for drivers to read boot mode + registers and make the value available to other subsystems.
drivers/misc/boot-mode-reg/Makefile new file +6 -0
@@ -0,0 +1,6 @@ + +# +# Makefile for misc devices that really don't fit anywhere else. +# + +obj-$(CONFIG_BOOT_MODE_REG_CORE) += core.o
drivers/misc/boot-mode-reg/core.c new file +76 -0
76 lines not on this page · raw message
include/misc/boot-mode-reg.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* Boot Mode Register +* +* Copyright (C) 2015 Simon Horman +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; version 2 of the License. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef _BOOT_MODE_REG_H +#define _BOOT_MODE_REG_H + +#include <linux/types.h> + +int boot_mode_reg_get (u32 *mode); +int boot_mode_reg_set (u32 mode); + +#endif
Signature · 1 line
2.8.0
Re: [PATCH v2 01/10] boot-mode-reg: Add core
Hi Dirk,
Quoted 8 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +5
-0+/** +* boot_mode_reg_set() - record boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Records the boot mode register value which may subsequently
drivers/misc/boot-mode-reg/core.c line 64
Quoted 10 lines
drivers/misc/boot-mode-reg/core.c new file +10
-0+* be retrieved using boot_mode_reg_get(). +* +* return: 0 on success +*/ +int boot_mode_reg_set (u32 mode) +{ +int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) {
You've dropped the check for calling this function a subsequent time with a different value of mode?
drivers/misc/boot-mode-reg/core.c line 71
Quoted 7 lines
drivers/misc/boot-mode-reg/core.c new file +7
-0+ boot_mode = mode; + boot_mode_is_set = true; + err =0 ; + } +mutex_unlock (&boot_mode_mutex); +return err; +}
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: [PATCH v2 01/10] boot-mode-reg: Add core
Hi Geert,
Quoted 16 lines · Geert Uytterhoeven
Hi Dirk,
Quoted 13 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +10
-0+/** +* boot_mode_reg_set() - record boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Records the boot mode register value which may subsequently +* be retrieved using boot_mode_reg_get(). +* +* return: 0 on success +*/ +int boot_mode_reg_set (u32 mode)
Quoted 8 lines
drivers/misc/boot-mode-reg/core.c line 64
Quoted 5 lines
drivers/misc/boot-mode-reg/core.c new file +5
-0+{ +int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) {You've dropped the check for calling this function a subsequent time with a different value of mode?
Sometimes inverting 'complex' if statements is not that easy ;)
You mean
if (!boot_mode_is_set || boot_mode != mode)
?
Best regards
Dirk
Re: [PATCH v2 01/10] boot-mode-reg: Add core
Hi Dirk,
Quoted 26 lines · Dirk Behme
Quoted 16 lines · Geert Uytterhoeven
Quoted 14 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +10
-0+/** +* boot_mode_reg_set() - record boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Records the boot mode register value which may subsequently +* be retrieved using boot_mode_reg_get(). +* +* return: 0 on success +*/ +int boot_mode_reg_set (u32 mode)Quoted 8 lines
drivers/misc/boot-mode-reg/core.c line 64
Quoted 5 lines
drivers/misc/boot-mode-reg/core.c new file +5
-0+{ +int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) {You've dropped the check for calling this function a subsequent time with a different value of mode?
Quoted 5 lines
Sometimes inverting 'complex' if statements is not that easy ;)
You mean
if (!boot_mode_is_set ||
boot_mode!= mode)
No, De Morgan says
if (!boot_mode_is_set || boot_mode == mode)
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: [PATCH v2 01/10] boot-mode-reg: Add core
Hi Geert,
Quoted 31 lines · Geert Uytterhoeven
Hi Dirk,
Quoted 28 lines · Dirk Behme
Quoted 16 lines · Geert Uytterhoeven
Quoted 14 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +10
-0+/** +* boot_mode_reg_set() - record boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Records the boot mode register value which may subsequently +* be retrieved using boot_mode_reg_get(). +* +* return: 0 on success +*/ +int boot_mode_reg_set (u32 mode)Quoted 8 lines
drivers/misc/boot-mode-reg/core.c line 64
Quoted 5 lines
drivers/misc/boot-mode-reg/core.c new file +5
-0+{ +int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) {You've dropped the check for calling this function a subsequent time with a different value of mode?
Sometimes inverting 'complex' if statements is not that easy ;)
Quoted 7 lines
Quoted 3 lines
You mean
if (!boot_mode_is_set ||
boot_mode!= mode)No, De Morgan says
if (!boot_mode_is_set || boot_mode == mode)
Hmm, sorry if I don't have enough coffee today ;)
But why should we do
if (... boot_mode == mode)
boot_mode = mode;
?
Or in other words:
We want to execute the if code if
boot_mode_is_set is false
or
boot_mode is not equal mode, i.e. mode has changed
?
Best regards
Dirk
Re: [PATCH v2 01/10] boot-mode-reg: Add core
Hi Dirk,
Quoted 52 lines · Dirk Behme
Quoted 29 lines · Geert Uytterhoeven
Quoted 27 lines · Dirk Behme
Quoted 15 lines · Geert Uytterhoeven
Quoted 13 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +11
-0+/** +* boot_mode_reg_set() - record boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Records the boot mode register value which may subsequently +* be retrieved using boot_mode_reg_get(). +* +* return: 0 on success +*/ +int boot_mode_reg_set (u32 mode) +{Quoted 8 lines
drivers/misc/boot-mode-reg/core.c line 64
Quoted 4 lines
drivers/misc/boot-mode-reg/core.c new file +4
-0+int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) {You've dropped the check for calling this function a subsequent time with
a different value of mode?Sometimes inverting 'complex' if statements is not that easy ;)
Quoted 8 lines
Quoted 3 lines
You mean
if (!boot_mode_is_set ||
boot_mode!= mode)No, De Morgan says
if (!boot_mode_is_set || boot_mode == mode)Hmm, sorry if I don't have enough coffee today ;)
But why should we do
if (...
boot_mode== mode)boot_mode = mode;?
Or in other words:
We want to execute the if code if
Quoted 7 lines
boot_mode_is_setis falseor
boot_modeis not equal mode, i.e. mode has changed?
We want to fail if the mode has changed.
Doing the assignment a second time doesn't hurt.
But as this seems to hurt readability, the better solution may be:
if (!boot_mode_is_set) {
boot_mode = mode;
boot_mode_is_set = true;
err = 0;
} else if (boot_mode == mode) {
err = 0;
} else {
err = -EBUSY;
}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
PATCH v2 2/10 boot-mode-reg: Add R-Car driver
In reply to Dirk BehmeFrom: Simon Horman <[email protected]>
Boot mode register driver for R-Car.
If running on a supported platform it reads the boot mode register and records it using the boot mode register infrastructure established by an earlier patch.
rcar_init_boot_mode() is exported allow it to be explicitly called in cases where the boot mode register is needed before init calls are made.
--- drivers/misc/boot-mode-reg/Kconfig | 8 +++++ drivers/misc/boot-mode-reg/Makefile | 1 + drivers/misc/boot-mode-reg/rcar.c | 60 +++++++++++++++++++++++++++++++++++++ include/misc/boot-mode-reg.h | 3 ++ 4 files changed, 72 insertions(+) create mode 100644 drivers/misc/boot-mode-reg/rcar.c
drivers/misc/boot-mode-reg/Kconfig +8 -0
@@ -9,3 +9,11 @@ config BOOT_MODE_REG_CORE help Say Y here to allow support for drivers to read boot mode registers and make the value available to other subsystems. + +config BOOT_MODE_REG_RCAR + tristate "Boot Mode Register Driver for Renesas R-Car SoCs" + default n + select BOOT_MODE_REG_CORE + help + Say Y here to allow support for reading the boot mode register + on Renesas R-Car SoCs.
drivers/misc/boot-mode-reg/Makefile +1 -0
@@ -4,3 +4,4 @@ # obj-$(CONFIG_BOOT_MODE_REG_CORE) += core.o +obj-$(CONFIG_BOOT_MODE_REG_RCAR) += rcar.o
drivers/misc/boot-mode-reg/rcar.c new file +60 -0
60 lines not on this page · raw message
include/misc/boot-mode-reg.h +3 -0
@@ -21,4 +21,7 @@int boot_mode_reg_get (u32 *mode);int boot_mode_reg_set (u32 mode); +/* Allow explicit initialisation before initcalls */ +int rcar_init_boot_mode (void ); +#endif
Signature · 1 line
2.8.0
PATCH v2 3/10 arm: renesas: rcar-gen2: Obtain MD pin value using boot-mode-reg
In reply to Dirk BehmeFrom: Simon Horman <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value for initialising arch timer for R-Car Gen2 SoCs.
Subsequent patches will remove other calls to rcar_gen2_read_mode_pins() and in turn that function.
rcar_init_boot_mode() is called to implicitly initialise the R-Car Gen2 boot mod register driver as rcar_gen2_timer_init() is run before initcalls.
--- arch/arm/mach-shmobile/Kconfig | 1 + arch/arm/mach-shmobile/setup-rcar-gen2.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-)
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -23,6 +23,7 @@ config ARCH_RCAR_GEN2 select RENESAS_IRQC select SYS_SUPPORTS_SH_CMT select PCI_DOMAINS if PCI + select BOOT_MODE_REG_RCAR config ARCH_RMOBILE bool
arch/arm/mach-shmobile/setup-rcar-gen2.c +21 -3
@@ -24,6 +24,7 @@#include <linux/memblock.h> #include <linux/of.h> #include <linux/of_fdt.h> +#include <misc/boot-mode-reg.h> #include <asm/mach/arch.h> #include "common.h" #include "rcar-gen2.h"
@@ -49,13 +50,19 @@ u32 rcar_gen2_read_mode_pins(void)#define CNTCR 0#define CNTFID0 0x20 -void __init rcar_gen2_timer_init (void ) +void __init rcar_gen2_timer_init_for_arch_timer (void ) { -u32 mode =rcar_gen2_read_mode_pins ();#ifdef CONFIG_ARM_ARCH_TIMER void __iomem *base;int extal_mhz =0 ; -u32 freq; +u32 freq, mode; +int err; + + err =boot_mode_reg_get (&mode); +if (err) { +pr_err ("%s: failed obtain boot mode\n" , __func__); +return ; + }if (of_machine_is_compatible ("renesas,r8a7794" )) { freq =260000000 /8 ;/* ZS / 8 */
@@ -126,7 +133,18 @@ void __init rcar_gen2_timer_init(void)iounmap (base);#endif /* CONFIG_ARM_ARCH_TIMER */ +} + +void __init rcar_gen2_timer_init (void ) +{ +int err; +u32 mode =rcar_gen2_read_mode_pins (); + + err =rcar_init_boot_mode (); +if (err) +pr_err ("Could not initialise boot mode register driver\n" ); +rcar_gen2_timer_init_for_arch_timer ();rcar_gen2_clocks_init (mode);clocksource_probe (); }
Signature · 1 line
2.8.0
PATCH v2 4/10 arm: renesas: r8a7791: Obtain MD pin value using boot-mode-reg
In reply to Dirk BehmeFrom: Simon Horman <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value when initialising SMP for r8a7791 SoC.
--- arch/arm/mach-shmobile/smp-r8a7791.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/smp-r8a7791.c +12 -1
@@ -20,6 +20,8 @@#include <asm/smp_plat.h> +#include <misc/boot-mode-reg.h> +#include "common.h" #include "platsmp-apmu.h" #include "r8a7791.h"
@@ -45,8 +47,17 @@ static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)static int r8a7791_smp_boot_secondary (unsigned int cpu,struct task_struct *idle) { +int err; +u32 mode; + + err =boot_mode_reg_get (&mode); +if (err) { +pr_warn ("Unable to retrieve boot mode register\n" ); +return err; + } +/* Error out when hardware debug mode is enabled */ -if (rcar_gen2_read_mode_pins () &BIT (21 )) { +if (mode &BIT (21 )) {pr_warn ("Unable to boot CPU%u when MD21 is set\n" , cpu);return -ENOTSUPP ; }
Signature · 1 line
2.8.0
PATCH v2 5/10 clk: renesas: rcar-gen2: Obtain MD pin value using boot-mode-reg
In reply to Dirk BehmeFrom: Simon Horman <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value for initializing clocks for for R-Car Gen2 SoCs.
--- arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 +-- drivers/clk/renesas/clk-rcar-gen2.c | 12 ++++++++++-- include/linux/clk/renesas.h | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-)
arch/arm/mach-shmobile/setup-rcar-gen2.c +1 -2
@@ -138,14 +138,13 @@ void __init rcar_gen2_timer_init_for_arch_timer(void)void __init rcar_gen2_timer_init (void ) {int err; -u32 mode =rcar_gen2_read_mode_pins (); err =rcar_init_boot_mode ();if (err)pr_err ("Could not initialise boot mode register driver\n" );rcar_gen2_timer_init_for_arch_timer (); -rcar_gen2_clocks_init (mode); +rcar_gen2_clocks_init ();clocksource_probe (); }
drivers/clk/renesas/clk-rcar-gen2.c +10 -2
@@ -20,6 +20,8 @@#include <linux/slab.h> #include <linux/spinlock.h> +#include <misc/boot-mode-reg.h> +struct rcar_gen2_cpg {struct clk_onecell_data data;spinlock_t lock;
@@ -421,9 +423,15 @@ static void __init rcar_gen2_cpg_clocks_init(struct device_node *np)CLK_OF_DECLARE (rcar_gen2_cpg_clks,"renesas,rcar-gen2-cpg-clocks" , rcar_gen2_cpg_clocks_init); -void __init rcar_gen2_clocks_init (u32 mode) +void __init rcar_gen2_clocks_init (void ) { - cpg_mode = mode; +int err; + + err =boot_mode_reg_get (&cpg_mode); +if (err) { +pr_err ("%s: failed to obtain boot mode\n" , __func__); +return ; + }of_clk_init (NULL ); }
include/linux/clk/renesas.h +1 -1
@@ -22,7 +22,7 @@ struct generic_pm_domain;void r8a7778_clocks_init (u32 mode);void r8a7779_clocks_init (u32 mode); -void rcar_gen2_clocks_init (u32 mode); +void rcar_gen2_clocks_init (void );void cpg_mstp_add_clk_domain (struct device_node *np);#ifdef CONFIG_CLK_RENESAS_CPG_MSTP
Signature · 1 line
2.8.0
PATCH v2 6/10 arm: renesas: rcar-gen2: Remove unused rcar_gen2_read_mode_pins()
In reply to Dirk BehmeFrom: Simon Horman <[email protected]>
The new boot mode reg infrastructure is now used in place of rcar_gen2_read_mode_pins so the latter may now be removed.
--- arch/arm/mach-shmobile/rcar-gen2.h | 1 - arch/arm/mach-shmobile/setup-rcar-gen2.c | 18 ------------------ 2 files changed, 19 deletions(-)
arch/arm/mach-shmobile/rcar-gen2.h +0 -1
@@ -3,7 +3,6 @@void rcar_gen2_timer_init (void );#define MD (nr) BIT(nr) -u32 rcar_gen2_read_mode_pins (void );void rcar_gen2_reserve (void );void rcar_gen2_pm_init (void );
arch/arm/mach-shmobile/setup-rcar-gen2.c +0 -18
@@ -29,24 +29,6 @@#include "common.h" #include "rcar-gen2.h" -#define MODEMR 0xe6160060 - -u32 rcar_gen2_read_mode_pins (void ) -{ -static u32 mode; -static bool mode_valid; - -if (!mode_valid) { -void __iomem *modemr =ioremap_nocache (MODEMR ,4 ); -BUG_ON (!modemr); - mode =ioread32 (modemr); -iounmap (modemr); - mode_valid = true; - } - -return mode; -} -#define CNTCR 0#define CNTFID0 0x20
Signature · 1 line
2.8.0
PATCH v2 7/10 arm: renesas: rcar-gen3: Make boot-mode-reg Gen3 compatible
In reply to Dirk BehmeFrom: Dirk Behme <[email protected]>
The boot mode register is available on Renesas Gen3, too. Use the same driver on Gen3 as on Gen2.
--- arch/arm64/Kconfig.platforms | 1 + drivers/misc/boot-mode-reg/rcar.c | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm64/Kconfig.platforms +1 -0
@@ -106,6 +106,7 @@ config ARCH_SHMOBILE config ARCH_RENESAS bool "Renesas SoC Platforms" select ARCH_SHMOBILE + select BOOT_MODE_REG_RCAR select PINCTRL select PM select PM_GENERIC_DOMAINS
drivers/misc/boot-mode-reg/rcar.c +3 -1
@@ -48,7 +48,9 @@ int __init rcar_init_boot_mode(void)of_machine_is_compatible ("renesas,r8a7791" ) ||of_machine_is_compatible ("renesas,r8a7792" ) ||of_machine_is_compatible ("renesas,r8a7793" ) || - of_machine_is_compatible("renesas,r8a7794")) +of_machine_is_compatible ("renesas,r8a7794" ) || +of_machine_is_compatible ("renesas,r8a7795" ) || + of_machine_is_compatible("renesas,r8a7796")) return rcar_read_mode_pins();return 0 ;
Signature · 1 line
2.8.0
PATCH v2 8/10 clk: renesas: rcar-gen3: Obtain MD pin value using boot-mode-reg
In reply to Dirk BehmeFrom: Dirk Behme <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value for initialising clocks for for R-Car Gen3 SoCs.
--- drivers/clk/renesas/r8a7795-cpg-mssr.c | 11 ++++++++++- drivers/clk/renesas/r8a7796-cpg-mssr.c | 11 ++++++++++- drivers/clk/renesas/rcar-gen3-cpg.c | 17 ----------------- drivers/clk/renesas/rcar-gen3-cpg.h | 1 - 4 files changed, 20 insertions(+), 20 deletions(-)
drivers/clk/renesas/r8a7795-cpg-mssr.c +10 -1
@@ -18,6 +18,8 @@#include <dt-bindings/clock/r8a7795-cpg-mssr.h> +#include <misc/boot-mode-reg.h> +#include "renesas-cpg-mssr.h" #include "rcar-gen3-cpg.h"
@@ -294,7 +296,14 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {static int __init r8a7795_cpg_mssr_init (struct device *dev) {const struct rcar_gen3_cpg_pll_config *cpg_pll_config; -u32 cpg_mode =rcar_gen3_read_mode_pins (); +u32 cpg_mode; +int err; + + err =boot_mode_reg_get (&cpg_mode); +if (err) { +dev_err (dev,"Failed obtain boot mode: %i\n" , err); +return err; + } cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX (cpg_mode)];if (!cpg_pll_config->extal_div) {
drivers/clk/renesas/r8a7796-cpg-mssr.c +10 -1
@@ -19,6 +19,8 @@#include <dt-bindings/clock/r8a7796-cpg-mssr.h> +#include <misc/boot-mode-reg.h> +#include "renesas-cpg-mssr.h" #include "rcar-gen3-cpg.h"
@@ -159,7 +161,14 @@ static const struct rcar_gen3_cpg_pll_config cpg_pll_configs[16] __initconst = {static int __init r8a7796_cpg_mssr_init (struct device *dev) {const struct rcar_gen3_cpg_pll_config *cpg_pll_config; -u32 cpg_mode =rcar_gen3_read_mode_pins (); +u32 cpg_mode; +int err; + + err =boot_mode_reg_get (&cpg_mode); +if (err) { +dev_err (dev,"Failed obtain boot mode: %i\n" , err); +return err; + } cpg_pll_config = &cpg_pll_configs[CPG_PLL_CONFIG_INDEX (cpg_mode)];if (!cpg_pll_config->extal_div) {
drivers/clk/renesas/rcar-gen3-cpg.c +0 -17
@@ -333,23 +333,6 @@ struct clk * __init rcar_gen3_cpg_clk_register(struct device *dev, __clk_get_name(parent), 0, mult, div); } -/* -* Reset register definitions. -*/ -#define MODEMR 0xe6160060 - -u32 __init rcar_gen3_read_mode_pins (void ) -{ -void __iomem *modemr =ioremap_nocache (MODEMR ,4 ); -u32 mode; - -BUG_ON (!modemr); - mode =ioread32 (modemr); -iounmap (modemr); - -return mode; -} -int __init rcar_gen3_cpg_init (const struct rcar_gen3_cpg_pll_config *config,unsigned int clk_extalr) {
drivers/clk/renesas/rcar-gen3-cpg.h +0 -1
@@ -33,7 +33,6 @@ struct rcar_gen3_cpg_pll_config {#define CPG_RCKCR 0x240 -u32 rcar_gen3_read_mode_pins (void );struct clk *rcar_gen3_cpg_clk_register (struct device *dev,const struct cpg_core_clk *core,const struct cpg_mssr_info *info,struct clk **clks,void __iomem *base);
Signature · 1 line
2.8.0
PATCH v2 9/10 ARM: dts: r8a779x: Add reset module support
In reply to Dirk BehmeFrom: Dirk Behme <[email protected]>
The reset module on RCar Gen2 and Gen3 SoCs contains various reset handling related registers. Their content is implementation dependent.
--- .../devicetree/bindings/misc/renesas,rcar-rst.txt | 15 +++++++++++++++ arch/arm/boot/dts/r8a7790.dtsi | 5 +++++ arch/arm/boot/dts/r8a7791.dtsi | 5 +++++ arch/arm/boot/dts/r8a7793.dtsi | 5 +++++ arch/arm/boot/dts/r8a7794.dtsi | 6 ++++++ arch/arm64/boot/dts/renesas/r8a7795.dtsi | 5 +++++ arch/arm64/boot/dts/renesas/r8a7796.dtsi | 5 +++++ 7 files changed, 46 insertions(+) create mode 100644 Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +15 -0
@@ -0,0 +1,15 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent. + +Required properties: +- compatible : "renesas,rcar-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + };
arch/arm/boot/dts/r8a7790.dtsi +5 -0
@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
arch/arm/boot/dts/r8a7791.dtsi +5 -0
@@ -1122,6 +1122,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
arch/arm/boot/dts/r8a7793.dtsi +5 -0
@@ -933,6 +933,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7793-div6-clock",
arch/arm/boot/dts/r8a7794.dtsi +6 -0
@@ -932,6 +932,12 @@ "rcan"; #power-domain-cells = <0>; }; + + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7794-div6-clock", "renesas,cpg-div6-clock";
arch/arm64/boot/dts/renesas/r8a7795.dtsi +5 -0
@@ -309,6 +309,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7795-sysc"; reg = <0 0xe6180000 0 0x0400>;
arch/arm64/boot/dts/renesas/r8a7796.dtsi +5 -0
@@ -109,6 +109,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7796-sysc"; reg = <0 0xe6180000 0 0x0400>;
Signature · 1 line
2.8.0
Re: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Hi Dirk,
Quoted 8 lines · Dirk Behme
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0@@ -0,0 +1,15 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +10
-0+ +Required properties: +- compatible : "renesas,rcar-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + };
While I understand you want to match on a single comptible value, the RST module itself highly depends on the actual SoC.
Furthermore, R-Car Gen1 doesn't have RST.
Hence I'd go for requiring 2 compatible values:
- An SoC-specific one, e.g. "renesas,r8a7795-rst",
- A family-specific one, e.g. "renesas,rcar-gen3-rst".
Your driver code can match against the two family-specific compatible values using of_find_matching_node().
Quoted 1 line
\ No newline at end of file
Oops.
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: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Hi Geert,
Quoted 26 lines · Geert Uytterhoeven
Hi Dirk,
Quoted 8 lines · Dirk Behme
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0@@ -0,0 +1,15 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +10
-0+ +Required properties: +- compatible : "renesas,rcar-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + };While I understand you want to match on a single comptible value, the RST module itself highly depends on the actual SoC.
Furthermore, R-Car Gen1 doesn't have RST.
Quoted 6 lines
Hence I'd go for requiring 2 compatible values:
- An SoC-specific one, e.g. "renesas,r8a7795-rst",
- A family-specific one, e.g. "renesas,rcar-gen3-rst".Your driver code can match against the two family-specific compatible values using
of_find_matching_node().
This way? See below [1].
Best regards
Dirk
[1]
drivers/misc/boot-mode-reg/rcar.c +26 -7
@@ -16,24 +16,43 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_address.h> #include <misc/boot-mode-reg.h> -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60 + +static struct of_device_id rcar_rst_ids[]__initdata = { + { .compatible ="renesas,rcar-gen2-rst" }, + { .compatible ="renesas,rcar-gen3-rst" }, + {} +};static int __init rcar_read_mode_pins (void ) { -void __iomem *modemr; +void __iomem *reset; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); -if (!modemr) { -pr_err ("failed to map boot mode register" ); + np =of_find_matching_node (NULL , rcar_rst_ids); +if (np) + reset =of_iomap (np,0 ); +else { +pr_warn ("can't find renesas rcar-rst device node" ); + reset =ioremap_nocache (RCAR_RST_BASE ,RCAR_RST_SIZE ); + } + +if (!reset) { +pr_err ("failed to map reset registers" ); +of_node_put (np); goto err; } - mode =ioread32 (modemr); -iounmap (modemr); + mode =ioread32 (reset +MODEMR ); +iounmap (reset); +of_node_put (np); err =boot_mode_reg_set (mode); err:
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +24 -0
@@ -0,0 +1,24 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent. + +Required properties: +- compatible : "renesas,rcar-gen2-rst" for RCar Gen2 or + "renesas,rcar-gen3-rst" for RCar Gen3 + and additionally a SoC specific property like + "renesas,r8a7790-rst" or + "renesas,r8a7791-rst" or + "renesas,r8a7792-rst" or + "renesas,r8a7793-rst" or + "renesas,r8a7794-rst" or + "renesas,r8a7795-rst" or + "renesas,r8a7796-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst"; + reg = <0 0xe6160000 0 0x200>; + };
arch/arm/boot/dts/r8a7790.dtsi +5 -0
@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7790-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
arch/arm/boot/dts/r8a7791.dtsi +5 -0
@@ -1122,6 +1122,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7791-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock";
arch/arm/boot/dts/r8a7793.dtsi +5 -0
@@ -933,6 +933,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7793-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7793-div6-clock",
arch/arm/boot/dts/r8a7794.dtsi +6 -0
@@ -932,6 +932,12 @@ "rcan"; #power-domain-cells = <0>; }; + + reset-controller@e6160000 { + compatible = "renesas,rcar-gen2-rst", "renesas,r8a7794-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + /* Variable factor clocks */ sd2_clk: sd2@e6150078 { compatible = "renesas,r8a7794-div6-clock", "renesas,cpg-div6-clock";
arch/arm64/boot/dts/renesas/r8a7795.dtsi +5 -0
@@ -309,6 +309,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7795-sysc"; reg = <0 0xe6180000 0 0x0400>;
arch/arm64/boot/dts/renesas/r8a7796.dtsi +5 -0
@@ -109,6 +109,11 @@ #power-domain-cells = <0>; }; + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7796-rst"; + reg = <0 0xe6160000 0 0x200>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7796-sysc"; reg = <0 0xe6180000 0 0x0400>;
Re: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Hi Dirk,
Quoted 49 lines · Dirk Behme
Quoted 26 lines · Geert Uytterhoeven
Quoted 8 lines · Dirk Behme
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0@@ -0,0 +1,15 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +10
-0+ +Required properties: +- compatible : "renesas,rcar-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + };While I understand you want to match on a single comptible value, the RST module itself highly depends on the actual SoC.
Furthermore, R-Car Gen1 doesn't have RST.Quoted 7 lines
Hence I'd go for requiring 2 compatible values:
- An SoC-specific one, e.g. "renesas,r8a7795-rst",
- A family-specific one, e.g. "renesas,rcar-gen3-rst".Your driver code can match against the two family-specific compatible values
usingof_find_matching_node().This way? See below [1].
Best regards
Dirk
[1]
drivers/misc/boot-mode-reg/rcar.c +0
-0@@ -16,24 +16,43 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h>
drivers/misc/boot-mode-reg/rcar.c line 27
Quoted 10 lines
drivers/misc/boot-mode-reg/rcar.c +6
-1+#include <linux/of_address.h> #include <misc/boot-mode-reg.h> -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60 + +static struct of_device_id rcar_rst_ids[]__initdata = {
const
Quoted 7 lines
drivers/misc/boot-mode-reg/rcar.c +4
-0+ { .compatible = "renesas,rcar-gen2-rst" }, + { .compatible = "renesas,rcar-gen3-rst" }, + {} +};static int __init rcar_read_mode_pins (void ) {
drivers/misc/boot-mode-reg/rcar.c line 40
Quoted 10 lines
drivers/misc/boot-mode-reg/rcar.c +3
-4-void __iomem *modemr; +void __iomem *reset; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); -if (!modemr) { -pr_err ("failed to map boot mode register" ); + np =of_find_matching_node (NULL , rcar_rst_ids);
Yep, like this.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 1
Quoted 4 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +1
-0@@ -0,0 +1,24 @@ +Renesas RCar r8a779x reset module
R-Car Gen2 and Gen3
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 3
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x
R-Car Gen2 and Gen3
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 5
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.
You may want to add more functionality from
http://www.spinics.net/lists/linux-sh/msg44754.html
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 8
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+Required properties: +- compatible : "renesas,rcar-gen2-rst" for RCar Gen2 or
R-Car
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 9
Quoted 1 line
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +1
-0+ "renesas,rcar-gen3-rst" for RCar Gen3
R-Car
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 17
Quoted 8 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +8
-0+ and additionally a SoC specific property like + "renesas,r8a7790-rst" or + "renesas,r8a7791-rst" or + "renesas,r8a7792-rst" or + "renesas,r8a7793-rst" or + "renesas,r8a7794-rst" or + "renesas,r8a7795-rst" or + "renesas,r8a7796-rst"
The SoC-specific compatible values should be listed first.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 22
Quoted 5 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0+- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst";
The SoC-specific compatible value should be listed first. The same is true for the actual dtsi files.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 23
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+ reg = <0 0xe6160000 0 0x200>; + };
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: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Hi Geert,
Quoted 95 lines · Geert Uytterhoeven
Hi Dirk,
Quoted 49 lines · Dirk Behme
Quoted 26 lines · Geert Uytterhoeven
Quoted 8 lines · Dirk Behme
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0@@ -0,0 +1,15 @@ +Renesas RCar r8a779x reset module +----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x +SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 15
Quoted 10 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +10
-0+ +Required properties: +- compatible : "renesas,rcar-rst" +- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-rst"; + reg = <0 0xe6160000 0 0x200>; + };While I understand you want to match on a single comptible value, the RST module itself highly depends on the actual SoC.
Furthermore, R-Car Gen1 doesn't have RST.Quoted 7 lines
Hence I'd go for requiring 2 compatible values:
- An SoC-specific one, e.g. "renesas,r8a7795-rst",
- A family-specific one, e.g. "renesas,rcar-gen3-rst".Your driver code can match against the two family-specific compatible values
usingof_find_matching_node().This way? See below [1].
Best regards
Dirk
[1]
drivers/misc/boot-mode-reg/rcar.c +0
-0@@ -16,24 +16,43 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h> drivers/misc/boot-mode-reg/rcar.c line 27
Quoted 10 lines
drivers/misc/boot-mode-reg/rcar.c +6
-1+#include <linux/of_address.h> #include <misc/boot-mode-reg.h> -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60 + +static struct of_device_id rcar_rst_ids[]__initdata = {const
Quoted 7 lines
drivers/misc/boot-mode-reg/rcar.c +4
-0+ { .compatible = "renesas,rcar-gen2-rst" }, + { .compatible = "renesas,rcar-gen3-rst" }, + {} +};static int __init rcar_read_mode_pins (void ) {drivers/misc/boot-mode-reg/rcar.c line 40
Quoted 10 lines
drivers/misc/boot-mode-reg/rcar.c +3
-4-void __iomem *modemr; +void __iomem *reset; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); -if (!modemr) { -pr_err ("failed to map boot mode register" ); + np =of_find_matching_node (NULL , rcar_rst_ids);Yep, like this.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 1
Quoted 4 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +1
-0@@ -0,0 +1,24 @@ +Renesas RCar r8a779x reset moduleR-Car Gen2 and Gen3
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 3
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+----------------------------------------------------- +This binding defines the reset module found on Renesas RCar r8a779x
Quoted 7 lines
R-Car Gen2 and Gen3
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 5
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+SoCs. The reset module contains several reset related registers, +the meaning of them is implementation dependent.You may want to add more functionality from
http://www.spinics.net/lists/linux-sh/msg44754.html
Just an understanding question:
Why do you prefer the solution with the drivers/misc/boot-mode-reg/ solution done in this patch series over the solution you proposed in
http://www.spinics.net/lists/linux-sh/msg44755.html
and the reset of that series?
Best regards
Dirk
Quoted 32 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 8
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+Required properties: +- compatible : "renesas,rcar-gen2-rst" for RCar Gen2 orR-Car
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 9
Quoted 1 line
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +1
-0+ "renesas,rcar-gen3-rst" for RCar Gen3R-Car
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 17
Quoted 8 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +8
-0+ and additionally a SoC specific property like + "renesas,r8a7790-rst" or + "renesas,r8a7791-rst" or + "renesas,r8a7792-rst" or + "renesas,r8a7793-rst" or + "renesas,r8a7794-rst" or + "renesas,r8a7795-rst" or + "renesas,r8a7796-rst"The SoC-specific compatible values should be listed first.
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt line 22
Quoted 5 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +5
-0+- reg : Location and size of the reset module + +Example: + reset-controller@e6160000 { + compatible = "renesas,rcar-gen3-rst", "renesas,r8a7795-rst";The SoC-specific compatible value should be listed first. The same is true for the actual dtsi files.
Quoted 2 lines
Documentation/devicetree/bindings/misc/renesas,rcar-rst.txt new file +2
-0+ reg = <0 0xe6160000 0 0x200>; + };
Re: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Hi Dirk,
CC Laurent
Quoted 8 lines · Dirk Behme
Just an understanding question:
Why do you prefer the solution with the
drivers/misc/boot-mode-reg/solution done in this patch series over the solution you proposed inhttp://www.spinics.net/lists/linux-sh/msg44755.html
and the reset of that series?
Do I? :-)
drivers/misc/boot-mode-reg/ will need agreement outside the linux-renesas-soc community. My renesas,modemr proposal won't.
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: [PATCH v2 09/10] ARM: dts: r8a779x: Add reset module support
Quoted 10 lines · Geert Uytterhoeven
Hi Dirk,
CC Laurent
Quoted 5 lines · Dirk Behme
Just an understanding question:
Why do you prefer the solution with the
drivers/misc/boot-mode-reg/solution done in this patch series over the solution you proposed in
Quoted 8 lines
Quoted 3 lines
http://www.spinics.net/lists/linux-sh/msg44755.html
and the reset of that series?
Do I? :-)
drivers/misc/boot-mode-reg/will need agreement outside the linux-renesas-soc community. My renesas,modemr proposal won't.
Then I'll have a look at
http://www.spinics.net/lists/linux-sh/msg44757.html
and drop the boot-mode-reg patches?
Ok?
Do you remember the status of
http://www.spinics.net/lists/linux-sh/msg44755.html
Anything I should know looking at it?
Best regards
Dirk
PATCH v2 10/10 boot-mode-reg: Convert to device tree
In reply to Dirk BehmeFrom: Dirk Behme <[email protected]>
Instead of using a hard coded address in the driver for the boot mode register, optain it from the device tree.
--- drivers/misc/boot-mode-reg/rcar.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/misc/boot-mode-reg/rcar.c +20 -7
@@ -16,24 +16,37 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_address.h> #include <misc/boot-mode-reg.h> -#define MODEMR 0xe6160060 +#define RCAR_RST_BASE 0xe6160000 +#define RCAR_RST_SIZE 0x200 +#define MODEMR 0x60static int __init rcar_read_mode_pins (void ) { -void __iomem *modemr; +void __iomem *reset; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); -if (!modemr) { -pr_err ("failed to map boot mode register" ); + np =of_find_compatible_node (NULL ,NULL ,"renesas,rcar-rst" ); +if (np) + reset =of_iomap (np,0 ); +else { +pr_warn ("can't find renesas rcar-rst device node" ); + reset =ioremap_nocache (RCAR_RST_BASE ,RCAR_RST_SIZE ); + } + +if (!reset) { +pr_err ("failed to map reset registers" ); +of_node_put (np); goto err; } - mode =ioread32 (modemr); -iounmap (modemr); + mode =ioread32 (reset +MODEMR ); +iounmap (reset); +of_node_put (np); err =boot_mode_reg_set (mode); err:
Signature · 1 line
2.8.0