arm64: renesas: Obtain MD pin values using syscon/regmap
Subsystems (8)
cover arm64: renesas: Obtain MD pin values using syscon/regmap
This is a resend of
http://www.spinics.net/lists/linux-sh/msg44757.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
PATCH 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 | 78 +++++++++++++++++++++++++++++++++++++ include/misc/boot-mode-reg.h | 24 ++++++++++++ 7 files changed, 122 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 +78 -0
78 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 01/10] boot-mode-reg: Add core
Quoted 13 lines · Dirk Behme
drivers/misc/boot-mode-reg/core.c new file +9
-0@@ -0,0 +1,78 @@ +/** +* boot_mode_reg_get() - retrieve boot mode register value +* @mode: implementation-dependent boot mode register value +* +* Retrieves the boot mode register value previously registered +* using boot_mode_reg_set(). +* +* return: 0 on success +*/
drivers/misc/boot-mode-reg/core.c line 45
Quoted 10 lines
drivers/misc/boot-mode-reg/core.c new file +10
-0+int boot_mode_reg_get (u32 *mode) +{ +int err = -ENOENT ; + +mutex_lock (&boot_mode_mutex); +if (!boot_mode_is_set) + goto err; + *mode = boot_mode; + err =0 ; +err:
The goto and label can easily be avoided by inverting the if condition:
if (boot_mode_is_set) {
*mode = boot_mode;
err = 0;
}Quoted 15 lines
drivers/misc/boot-mode-reg/core.c new file +15
-0+mutex_unlock (&boot_mode_mutex); +return err; +} +EXPORT_SYMBOL_GPL (boot_mode_reg_get); + +/** +* 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)
drivers/misc/boot-mode-reg/core.c line 70
Quoted 10 lines
drivers/misc/boot-mode-reg/core.c new file +10
-0+{ +int err = -EBUSY ; + +mutex_lock (&boot_mode_mutex); +if (boot_mode_is_set && boot_mode != mode) + goto err; + boot_mode = mode; + boot_mode_is_set = true; + err =0 ; +err:
Convert goto and label to inverted if.
drivers/misc/boot-mode-reg/core.c line 74
Quoted 4 lines
drivers/misc/boot-mode-reg/core.c new file +4
-0+mutex_unlock (&boot_mode_mutex); +return err; +} +EXPORT_SYMBOL_GPL (boot_mode_reg_set);
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 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 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 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 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
Re: [PATCH 04/10] arm: renesas: r8a7791: Obtain MD pin value using boot-mode-reg
Hello.
Quoted 14 lines · Dirk Behme
From: Simon Horman <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value when initialising SMP for r8a7791 SoC.
Signed-off-by Simon Horman <[email protected]>--- arch/arm/mach-shmobile/smp-r8a7791.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)arch/arm/mach-shmobile/smp-r8a7791.c +0
-0
[...]
arch/arm/mach-shmobile/smp-r8a7791.c static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus) · line 55
Quoted 10 lines
arch/arm/mach-shmobile/smp-r8a7791.c +6
-0@@ -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 retrieve boot mode register\n" );
Unable to retrieve?
[...]
MBR, Sergei
PATCH 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 initialising 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 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
Re: [PATCH 05/10] clk: renesas: rcar-gen2: Obtain MD pin value using boot-mode-reg
Hello.
Quoted 4 lines · Dirk Behme
From: Simon Horman <[email protected]>
Use new boot mode reg infrastructure to obtain the mode pin value for initialising clocks for for R-Car Gen2 SoCs.
My spell-checker trips over "initialising". Perhaps initializing?
Quoted 1 line
Signed-off-by Simon Horman <[email protected]>
[...]
drivers/clk/renesas/clk-rcar-gen2.c static void __init rcar_gen2_cpg_clocks_init(struct device_node *np) · line 432
Quoted 13 lines
drivers/clk/renesas/clk-rcar-gen2.c +6
-2@@ -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 obtain boot mode\n" , __func__);
Failed to obtain?
[...]
MBR, Sergei
PATCH 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 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 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 9/10 ARM: r8a779x: Add boot mode reg support
In reply to Dirk BehmeFrom: Dirk Behme <[email protected]>
The boot mode register is a 32bit unsigned entity, the meaning of its values are implementation dependent.
--- 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 +++++ 6 files changed, 31 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +5 -0
@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + /* 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>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + /* 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>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + /* 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>; }; + + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + /* 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>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + 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>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; + sysc: system-controller@e6180000 { compatible = "renesas,r8a7796-sysc"; reg = <0 0xe6180000 0 0x0400>;
Signature · 1 line
2.8.0
Re: [PATCH 09/10] ARM: r8a779x: Add boot mode reg support
arch/arm/boot/dts/r8a7790.dtsi line 1109
Quoted 11 lines · Dirk Behme
arch/arm/boot/dts/r8a7790.dtsi +5
-0@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; }; + modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; +
This should be a node for the complete RST module, not just for the RST module's MODEMR register.
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 09/10] ARM: r8a779x: Add boot mode reg support
Quoted 7 lines · Geert Uytterhoeven
Quoted 6 lines · Dirk Behme
arch/arm/boot/dts/r8a7790.dtsi +0
-0@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; };
Quoted 8 lines
arch/arm/boot/dts/r8a7790.dtsi line 1109
Quoted 5 lines
arch/arm/boot/dts/r8a7790.dtsi +5
-0+ modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; +This should be a node for the complete RST module, not just for the RST module's MODEMR register.
You mean
reset: reset@e6160000 {
compatible = "renesas,reset";
reg = <0 0xe6160000 0 0x200>;
};and then use anything like
#define MODEMR 0x60
in the code?
Best regards
Dirk
Re: [PATCH 09/10] ARM: r8a779x: Add boot mode reg support
Hi Dirk,
Quoted 31 lines · Dirk Behme
Quoted 10 lines · Geert Uytterhoeven
Quoted 7 lines · Dirk Behme
arch/arm/boot/dts/r8a7790.dtsi +0
-0@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; };Quoted 10 lines
arch/arm/boot/dts/r8a7790.dtsi line 1109
Quoted 5 lines
arch/arm/boot/dts/r8a7790.dtsi +5
-0+ modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; +This should be a node for the complete RST module, not just for the RST module's
MODEMR register.You mean
reset: reset@e6160000 { compatible = "renesas,reset"; reg = <0 0xe6160000 0 0x200>; };
Quoted 5 lines
and then use anything like
#define MODEMR
0x60in the code?
Yes, more or less:
reset-controller@e6160000 {
compatible = "renesas,r8a7795-rst";
reg = <0 0xe6160000 0 0x0200>;
};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 09/10] ARM: r8a779x: Add boot mode reg support
Hi Geert,
Quoted 36 lines · Geert Uytterhoeven
Hi Dirk,
Quoted 33 lines · Dirk Behme
Quoted 10 lines · Geert Uytterhoeven
Quoted 7 lines · Dirk Behme
arch/arm/boot/dts/r8a7790.dtsi +0
-0@@ -1102,6 +1102,11 @@ #power-domain-cells = <0>; };Quoted 10 lines
arch/arm/boot/dts/r8a7790.dtsi line 1109
Quoted 5 lines
arch/arm/boot/dts/r8a7790.dtsi +5
-0+ modemr: modemr@e6160060 { + compatible = "renesas,modemr"; + reg = <0 0xe6160060 0 0x4>; + }; +This should be a node for the complete RST module, not just for the RST module's
MODEMR register.You mean
reset: reset@e6160000 { compatible = "renesas,reset"; reg = <0 0xe6160000 0 0x200>; };and then use anything like
Quoted 8 lines
Quoted 3 lines
#define MODEMR
0x60in the code?
Yes, more or less:
reset-controller@e6160000 { compatible = "renesas,r8a7795-rst";
Hmm, do we really want the r8a7795 here? Then we would need
r8a7790-rst
r8a7791-rst
r8a7792-rst
r8a7793-rst
r8a7794-rst
r8a7795-rst
r8a7796-rst
...
?
Best regards
Dirk
Re: [PATCH 09/10] ARM: r8a779x: Add boot mode reg support
Quoted 5 lines · Dirk Behme
Quoted 2 lines
reset-controller@e6160000 { compatible = "renesas,r8a7795-rst";Hmm, do we really want the r8a7795 here? Then we would need
Quoted 7 lines
r8a7790-rst
r8a7791-rst
r8a7792-rst
r8a7793-rst
r8a7794-rst
r8a7795-rst
r8a7796-rst
We can add fallback values "renesas,rcar-gen2-rst" and "renesas,rcar-gen3-rst".
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 09/10] ARM: r8a779x: Add boot mode reg support
Quoted 14 lines · Geert Uytterhoeven
Quoted 5 lines · Dirk Behme
Quoted 2 lines
reset-controller@e6160000 { compatible = "renesas,r8a7795-rst";Hmm, do we really want the r8a7795 here? Then we would need
Quoted 7 lines
r8a7790-rst
r8a7791-rst
r8a7792-rst
r8a7793-rst
r8a7794-rst
r8a7795-rst
r8a7796-rst
Quoted 1 line
We can add fallback values "renesas,rcar-gen2-rst" and "renesas,rcar-gen3-rst".
+1
This is the scheme we have been using (more and more) consistently for Renesas hardware.
PATCH 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 | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/misc/boot-mode-reg/rcar.c +11 -3
@@ -16,24 +16,32 @@#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 -static int __init rcar_read_mode_pins (void ) {void __iomem *modemr; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); + np =of_find_compatible_node (NULL ,NULL ,"renesas,modemr" ); +if (!np) { +pr_err ("can't find renesas,modemr device node" ); + goto err; + } + + modemr =of_iomap (np,0 );if (!modemr) {pr_err ("failed to map boot mode register" ); +of_node_put (np); goto err; } mode =ioread32 (modemr);iounmap (modemr); +of_node_put (np); err =boot_mode_reg_set (mode); err:
Signature · 1 line
2.8.0
Re: [PATCH 10/10] boot-mode-reg: Convert to device tree
Quoted 14 lines · Dirk Behme
drivers/misc/boot-mode-reg/rcar.c +1
-2@@ -16,24 +16,32 @@#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 -static int __init rcar_read_mode_pins (void ) {
drivers/misc/boot-mode-reg/rcar.c line 33
Quoted 10 lines
drivers/misc/boot-mode-reg/rcar.c +5
-1void __iomem *modemr; +struct device_node *np;int err = -ENOMEM ;static u32 mode; - modemr =ioremap_nocache (MODEMR ,4 ); + np =of_find_compatible_node (NULL ,NULL ,"renesas,modemr" ); +if (!np) { +pr_err ("can't find renesas,modemr device node" ); + goto err;
At least for R-Car Gen2, we need to preserve compatibility with old DTBs that don't have the node in DT.
drivers/misc/boot-mode-reg/rcar.c line 36
Quoted 3 lines
drivers/misc/boot-mode-reg/rcar.c +3
-0+ } + + modemr =of_iomap (np,0 );
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Hi Dirk,
Thanks for your series!
Quoted 3 lines · Dirk Behme
This is a resend of
I guess you meant http://www.spinics.net/lists/linux-sh/msg45969.html?
You do want to keep (part of) the bindings from "[PATCH 1/6] reset: Add renesas,rst DT bindings." from the former series, though ;-)
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