ARM: vf610: Suspend/resume support
Subsystems (7)
Stefan Agner
reviewercover ARM: vf610: Suspend/resume support
This patchset provides suspend/resume support for Freescale Vybrid SoC (vf610). The code is generally aligned to the implementation for i.MX6. The subsystems SRC and GPC need some changes to support the Vybrid specific implementation.
This patchset relies on GPIO driver to be present (in order to provide a wakeup source) as well as using the ARM Global Timer clock source (the Vybrid specifc PIT clock source, vf_pit_timer.c does not support shutdown).
The implemented sleep states (LP-RUN and STOP), are not the most power saving functions available on Vybrid. Especially for suspend-to-memory one of the LPSTOP modes looks more appropriate. However, the complexity is somewhat higher (we would need to move execution path to SRAM and store IOMUX and DDRMC configuration). Currently, I have not the resources to look into that so I hope that this initial code qualifies as power saving functions to be applied.
Suspend-to-memory as well as standby mode is tested on Colibri VF61.
Power measurement (Colibri VF61, whole module):
- Idle: 540mW
- LP-RUN: 220mW (standby)
- STOP: 200mW (mem)
Stefan Agner (9):
ARM: dts: vf610: Add system reset controller (SRC)
ARM: dts: vf610: add global power controller (GPC)
ARM: dts: vf610: add on-chip SRAM
ARM: dts: vf610-colibri: GPIO power key
gpio: vf610: Extend with wakeup support
ARM: imx: gpc: Support vf610 global power controller
ARM: imx: src: Support vf610 system reset controller
ARM: imx: clk-gate2: allow custom gate configuration
ARM: vf610: initial suspend/resume support
arch/arm/boot/dts/vf610-colibri-eval-v3.dts | 26 ++ arch/arm/boot/dts/vf610.dtsi | 33 +++ arch/arm/mach-imx/Kconfig | 2 + arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/clk-gate2.c | 7 +- arch/arm/mach-imx/clk-vf610.c | 6 + arch/arm/mach-imx/clk.h | 13 +- arch/arm/mach-imx/common.h | 14 +- arch/arm/mach-imx/gpc.c | 61 ++-- arch/arm/mach-imx/mach-imx6q.c | 2 +- arch/arm/mach-imx/mach-imx6sl.c | 2 +- arch/arm/mach-imx/mach-vf610.c | 9 + arch/arm/mach-imx/pm-vf610.c | 428 ++++++++++++++++++++++++++++ arch/arm/mach-imx/src.c | 11 + drivers/gpio/gpio-vf610.c | 16 ++ include/dt-bindings/clock/vf610-clock.h | 3 +- 16 files changed, 605 insertions(+), 29 deletions(-) create mode 100644 arch/arm/mach-imx/pm-vf610.c
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 1/9 ARM: dts: vf610: Add system reset controller (SRC)
Add device tree property for system reset controller.
--- arch/arm/boot/dts/vf610.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/vf610.dtsi +7 -0
@@ -366,6 +366,13 @@ reg = <0x40034800 0x200>; clocks = <&clks VF610_CLK_USBC0>; }; + + src: src at 4006e000 { + compatible = "fsl,vf610-src"; + reg = <0x4006e000 0x1000>; + interrupts = <0 96 IRQ_TYPE_LEVEL_HIGH>; + #reset-cells = <0>; + }; }; aips1: aips-bus at 40080000 {
Signature · 1 line
2.1.0
Re: [PATCH 1/9] ARM: dts: vf610: Add system reset controller (SRC)
Quoted 3 lines · Stefan Agner
Add device tree property for system reset controller.
Signed-off-by Stefan Agner <[email protected]>
Are there already device tree bindings for SRC and GRC?
Yours,
Linus Walleij
Stefan Agner
reviewerRe: [PATCH 1/9] ARM: dts: vf610: Add system reset controller (SRC)
Am 2014-09-24 11:16, schrieb Linus Walleij:
Quoted 7 lines · Stefan Agner
Quoted 4 lines
Add device tree property for system reset controller.
Signed-off-by Stefan Agner <[email protected]>Are there already device tree bindings for SRC and GRC?
Yes there are used in the i.MX6 world for instance, see imx6qdl.dtsi. The SRC also has quite generic documentation, however, the GPC module currently lacks documentation...
--
Stefan
Re: [PATCH 1/9] ARM: dts: vf610: Add system reset controller (SRC)
Hi Stefan,
Am Mittwoch, den 24.09.2014, 18:41 +0200 schrieb Stefan Agner:
Quoted 5 lines
Am 2014-09-24 11:16, schrieb Linus Walleij:
Quoted 4 lines · Stefan Agner
Quoted 3 lines
Add device tree property for system reset controller.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Stefan Agner <[email protected]>Are there already device tree bindings for SRC and GRC?
Yes there are used in the i.MX6 world for instance, see
imx6qdl.dtsi. The SRC also has quite generic documentation, however, the GPC module currently lacks documentation...
A patch that adds GPC binding documentation is part of this i.MX6 power domain series:
http://www.spinics.net/lists/devicetree/msg48454.html
regards
Philipp
Stefan Agner
reviewerPATCH 2/9 ARM: dts: vf610: add global power controller (GPC)
In reply to Stefan AgnerAdd global power controller module (GPC) to Vybrid device tree.
--- arch/arm/boot/dts/vf610.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm/boot/dts/vf610.dtsi +5 -0
@@ -367,6 +367,11 @@ clocks = <&clks VF610_CLK_USBC0>; }; + gpc: gpc at 4006c000 { + compatible = "fsl,vf610-gpc"; + reg = <0x4006c000 0x1000>; + }; + src: src at 4006e000 { compatible = "fsl,vf610-src"; reg = <0x4006e000 0x1000>;
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 3/9 ARM: dts: vf610: add on-chip SRAM
In reply to Stefan Agner--- arch/arm/boot/dts/vf610.dtsi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
arch/arm/boot/dts/vf610.dtsi +21 -0
@@ -69,6 +69,27 @@ interrupt-parent = <&intc>; ranges; + ocram0: sram at 3f000000 { + compatible = "mmio-sram"; + reg = <0x3f000000 0x40000>; + }; + + ocram1: sram at 3f040000 { + compatible = "mmio-sram"; + reg = <0x3f040000 0x40000>; + }; + + gfxram0: sram at 3f400000 { + compatible = "mmio-sram"; + reg = <0x3f400000 0x80000>; + }; + + /* used by L2 cache */ + gfxram1: sram at 3f480000 { + compatible = "mmio-sram"; + reg = <0x3f480000 0x80000>; + }; + aips0: aips-bus at 40000000 { compatible = "fsl,aips-bus", "simple-bus"; #address-cells = <1>;
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 4/9 ARM: dts: vf610-colibri: GPIO power key
In reply to Stefan AgnerEnable GPIO power key on pad 41 which is routed to our default wakeup pin SO-DIMM 45.
--- arch/arm/boot/dts/vf610-colibri-eval-v3.dts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
arch/arm/boot/dts/vf610-colibri-eval-v3.dts +26 -0
@@ -8,6 +8,7 @@ */ /dts-v1/; +#include <dt-bindings/input/input.h> #include "vf610-colibri.dtsi" / {
@@ -17,6 +18,20 @@ chosen { bootargs = "console=ttyLP0,115200"; }; + + gpio-keys { + compatible = "gpio-keys"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_gpiokeys>; + + power { + label = "Power"; + gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; + linux,code = <KEY_POWER>; + debounce-interval = <10>; + gpio-key,wakeup; + }; + }; }; &esdhc1 {
@@ -44,3 +59,14 @@ &uart2 { status = "okay"; }; + + +&iomuxc { + vf610-colibri { + pinctrl_gpiokeys: gpiokeys { + fsl,pins = < + VF610_PAD_PTB19__GPIO_41 0x219d + >; + }; + }; +};
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 5/9 gpio: vf610: Extend with wakeup support
In reply to Stefan AgnerSupport Vybrid GPIO's as wakeup source by requesting the parent IRQ as wakeup IRQ.
--- drivers/gpio/gpio-vf610.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/gpio/gpio-vf610.c +16 -0
@@ -196,12 +196,28 @@ static void vf610_gpio_irq_unmask(struct irq_data *d) pcr_base); } +static int vf610_gpio_irq_set_wake (struct irq_data *d,u32 enable) +{ +struct vf610_gpio_port *port =irq_data_get_irq_chip_data (d); + +if (enable) +enable_irq_wake (port->irq); +else +disable_irq_wake (port->irq); + +return 0 ; +} + +static struct irq_chip vf610_gpio_irq_chip = { .name ="gpio-vf610" , .irq_ack = vf610_gpio_irq_ack, .irq_mask = vf610_gpio_irq_mask, .irq_unmask = vf610_gpio_irq_unmask, .irq_set_type = vf610_gpio_irq_set_type, +#ifdef CONFIG_PM_SLEEP + .irq_set_wake = vf610_gpio_irq_set_wake, +#endif };static int vf610_gpio_probe (struct platform_device *pdev)
Signature · 1 line
2.1.0
Re: [PATCH 5/9] gpio: vf610: Extend with wakeup support
Quoted 6 lines · Stefan Agner
Support Vybrid GPIO's as wakeup source by requesting the parent IRQ as wakeup IRQ.
Signed-off-by Stefan Agner <[email protected]>--- drivers/gpio/gpio-vf610.c | 16 ++++++++++++++++
This driver is not yet upstream. Make wakeup support part of the initial driver submission instead, it doesn't hurt.
Yours,
Linus Walleij
Stefan Agner
reviewerRe: [PATCH 5/9] gpio: vf610: Extend with wakeup support
Am 2014-09-24 11:19, schrieb Linus Walleij:
Quoted 11 lines · Stefan Agner
Quoted 7 lines
Support Vybrid GPIO's as wakeup source by requesting the parent IRQ as wakeup IRQ.
Signed-off-by Stefan Agner <[email protected]>--- drivers/gpio/gpio-vf610.c | 16 ++++++++++++++++This driver is not yet upstream. Make wakeup support part of the initial driver submission instead, it doesn't hurt.
Ok, will do.
Just realized that this patch even leads to compile errors when applying on top of v2 of the GPIO driver; we need the irq in drivers struct here, and I removed that in v2... :-)
--
Stefan
Re: [PATCH 5/9] gpio: vf610: Extend with wakeup support
In reply to Stefan AgnerHi Stefan,
Am Montag, den 22.09.2014, 19:09 +0200 schrieb Stefan Agner:
Quoted 28 lines
Support Vybrid GPIO's as wakeup source by requesting the parent IRQ as wakeup IRQ.
Signed-off-by Stefan Agner <[email protected]>--- drivers/gpio/gpio-vf610.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/gpio/gpio-vf610.c +12
-0@@ -196,12 +196,28 @@ static void vf610_gpio_irq_unmask(struct irq_data *d) pcr_base); } +static int vf610_gpio_irq_set_wake (struct irq_data *d,u32 enable) +{ +struct vf610_gpio_port *port =irq_data_get_irq_chip_data (d); + +if (enable) +enable_irq_wake (port->irq); +else +disable_irq_wake (port->irq); + +return 0 ; +} +
drivers/gpio/gpio-vf610.c static void vf610_gpio_irq_unmask(struct irq_data *d) · line 220
Quoted 10 lines
drivers/gpio/gpio-vf610.c +4
-0+static struct irq_chip vf610_gpio_irq_chip = { .name ="gpio-vf610" , .irq_ack = vf610_gpio_irq_ack, .irq_mask = vf610_gpio_irq_mask, .irq_unmask = vf610_gpio_irq_unmask, .irq_set_type = vf610_gpio_irq_set_type, +#ifdef CONFIG_PM_SLEEP + .irq_set_wake = vf610_gpio_irq_set_wake, +#endif
Either you need to get rid of this #ifdef and always assign this function or you need to wrap the function itself into the same #ifdef. Otherwise you provoke a unused function warning with !CONFIG_PM_SLEEP.
Given that this function isn't really that big I would argue to just drop the #ifdef.
Regards,
Lucas
Signature · 2 lines
Pengutronix e.K. | Lucas Stach | Industrial Linux Solutions | http://www.pengutronix.de/ |
Stefan Agner
reviewerRe: [PATCH 5/9] gpio: vf610: Extend with wakeup support
Am 2014-09-24 12:06, schrieb Lucas Stach:
Quoted 46 lines
Hi Stefan,
Am Montag, den 22.09.2014, 19:09 +0200 schrieb Stefan Agner:
Quoted 28 lines
Support Vybrid GPIO's as wakeup source by requesting the parent IRQ as wakeup IRQ.
Signed-off-by Stefan Agner <[email protected]>--- drivers/gpio/gpio-vf610.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)drivers/gpio/gpio-vf610.c +12
-0@@ -196,12 +196,28 @@ static void vf610_gpio_irq_unmask(struct irq_data *d) pcr_base); } +static int vf610_gpio_irq_set_wake (struct irq_data *d,u32 enable) +{ +struct vf610_gpio_port *port =irq_data_get_irq_chip_data (d); + +if (enable) +enable_irq_wake (port->irq); +else +disable_irq_wake (port->irq); + +return 0 ; +} +drivers/gpio/gpio-vf610.c static void vf610_gpio_irq_unmask(struct irq_data *d) · line 220
Quoted 10 lines
drivers/gpio/gpio-vf610.c +4
-0+static struct irq_chip vf610_gpio_irq_chip = { .name ="gpio-vf610" , .irq_ack = vf610_gpio_irq_ack, .irq_mask = vf610_gpio_irq_mask, .irq_unmask = vf610_gpio_irq_unmask, .irq_set_type = vf610_gpio_irq_set_type, +#ifdef CONFIG_PM_SLEEP + .irq_set_wake = vf610_gpio_irq_set_wake, +#endifEither you need to get rid of this #ifdef and always assign this function or you need to wrap the function itself into the same #ifdef. Otherwise you provoke a unused function warning with !CONFIG_PM_SLEEP.
Quoted 3 lines
Given that this function isn't really that big I would argue to just drop the #ifdef.
Good point, thx! I will drop the #ifdef when including that patch to the GPIO driver (as Linus Walleij suggested).
--
Stefan
Stefan Agner
reviewerPATCH 6/9 ARM: imx: gpc: Support vf610 global power controller
In reply to Stefan AgnerSupport Vybrid SoC which has a similar global power controller found in i.MX6 SoC's. The extension for the GIC interrupt controller can be reused. However, Vybrid's GPC has no CPU powerdown flag, hence we write this conditional.
--- arch/arm/mach-imx/Kconfig | 1 + arch/arm/mach-imx/common.h | 3 +- arch/arm/mach-imx/gpc.c | 61 +++++++++++++++++++++++++++-------------- arch/arm/mach-imx/mach-imx6q.c | 2 +- arch/arm/mach-imx/mach-imx6sl.c | 2 +- arch/arm/mach-imx/mach-vf610.c | 7 +++++ 6 files changed, 53 insertions(+), 23 deletions(-)
arch/arm/mach-imx/Kconfig +1 -0
@@ -633,6 +633,7 @@ config SOC_VF610 bool "Vybrid Family VF610 support" select ARM_GIC select PINCTRL_VF610 + select HAVE_IMX_GPC select ARM_GLOBAL_TIMER select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK select PL310_ERRATA_769419 if CACHE_L2X0
arch/arm/mach-imx/common.h +2 -1
@@ -103,7 +103,8 @@ static inline void imx_scu_map_io(void) {}static inline void imx_smp_prepare (void ) {}#endif void imx_src_init (void ); -void imx_gpc_init (void ); +void imx6_gpc_init (void ); +void vf610_gpc_init (void );void imx_gpc_pre_suspend (bool arm_power_off);void imx_gpc_post_resume (void );void imx_gpc_mask_all (void );
arch/arm/mach-imx/gpc.c +41 -20
138 lines not on this page · raw message
arch/arm/mach-imx/mach-imx6q.c +1 -1
@@ -392,7 +392,7 @@ static void __init imx6q_init_irq(void)imx_init_revision_from_anatop ();imx_init_l2cache ();imx_src_init (); -imx_gpc_init (); +imx6_gpc_init ();irqchip_init (); }
arch/arm/mach-imx/mach-imx6sl.c +1 -1
@@ -66,7 +66,7 @@ static void __init imx6sl_init_irq(void)imx_init_revision_from_anatop ();imx_init_l2cache ();imx_src_init (); -imx_gpc_init (); +imx6_gpc_init ();irqchip_init (); }
arch/arm/mach-imx/mach-vf610.c +7 -0
@@ -14,6 +14,12 @@#include "common.h" +static void __init vf610_init_irq (void ) +{ +vf610_gpc_init (); +irqchip_init (); +} +static void __init vf610_init_machine (void ) {mxc_arch_reset_init_dt ();
@@ -29,6 +35,7 @@ DT_MACHINE_START(VYBRID_VF610, "Freescale Vybrid VF610 (Device Tree)") .l2c_aux_val = 0, .l2c_aux_mask = ~0, .init_machine = vf610_init_machine, + .init_irq = vf610_init_irq, .dt_compat = vf610_dt_compat, .restart = mxc_restart,MACHINE_END
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 7/9 ARM: imx: src: Support vf610 system reset controller
In reply to Stefan AgnerSupport Vybrid SoC's system reset controller (SRC). Currently we don't register a reset controller but only support the imx_cpu_jump and imx_cpu_arg functions.
--- arch/arm/mach-imx/Kconfig | 1 + arch/arm/mach-imx/common.h | 1 + arch/arm/mach-imx/mach-vf610.c | 1 + arch/arm/mach-imx/src.c | 11 +++++++++++ 4 files changed, 14 insertions(+)
arch/arm/mach-imx/Kconfig +1 -0
@@ -634,6 +634,7 @@ config SOC_VF610 select ARM_GIC select PINCTRL_VF610 select HAVE_IMX_GPC + select HAVE_IMX_SRC select ARM_GLOBAL_TIMER select CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK select PL310_ERRATA_769419 if CACHE_L2X0
arch/arm/mach-imx/common.h +1 -0
@@ -103,6 +103,7 @@ static inline void imx_scu_map_io(void) {}static inline void imx_smp_prepare (void ) {}#endif void imx_src_init (void ); +void vf610_src_init (void );void imx6_gpc_init (void );void vf610_gpc_init (void );void imx_gpc_pre_suspend (bool arm_power_off);
arch/arm/mach-imx/mach-vf610.c +1 -0
@@ -16,6 +16,7 @@static void __init vf610_init_irq (void ) { +vf610_src_init ();vf610_gpc_init ();irqchip_init (); }
arch/arm/mach-imx/src.c +11 -0
@@ -140,3 +140,14 @@ void __init imx_src_init(void)writel_relaxed (val, src_base +SRC_SCR );spin_unlock (&scr_lock); } + +void __init vf610_src_init (void ) +{ +struct device_node *np; + + np =of_find_compatible_node (NULL ,NULL ,"fsl,vf610-src" ); +if (!np) +return ; + src_base =of_iomap (np,0 ); +WARN_ON (!src_base); +}
Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 8/9 ARM: imx: clk-gate2: allow custom gate configuration
In reply to Stefan AgnerThe 2-bit gates found i.MX and Vybrid SoC support different clock configuration:
0b00: clk disabled
0b01: clk enabled in RUN mode but disabled in WAIT and STOP mode 0b10: clk enabled in RUN, WAIT and STOP mode (only Vybrid) 0b11: clk enabled in RUN and WAIT mode
For some clocks, we might want to configure different behaviour, e.g. a memory clock should be on even in STOP mode. Add a new function imx_clk_gate2_cgr which allow to configure specific gate values through the cgr_val parameter.
--- arch/arm/mach-imx/clk-gate2.c | 7 +++++-- arch/arm/mach-imx/clk-vf610.c | 3 +++ arch/arm/mach-imx/clk.h | 13 ++++++++++--- include/dt-bindings/clock/vf610-clock.h | 3 ++- 4 files changed, 20 insertions(+), 6 deletions(-)
arch/arm/mach-imx/clk-gate2.c +5 -2
@@ -31,6 +31,7 @@ struct clk_gate2 {struct clk_hw hw;void __iomem *reg;u8 bit_idx; +u8 cgr_val;u8 flags;spinlock_t *lock;unsigned int *share_count;
@@ -50,7 +51,8 @@ static int clk_gate2_enable(struct clk_hw *hw) goto out; reg =readl (gate->reg); - reg |=3 << gate->bit_idx; + reg &= ~(3 << gate->bit_idx); + reg |= gate->cgr_val << gate->bit_idx;writel (reg, gate->reg); out:
@@ -110,7 +112,7 @@ static struct clk_ops clk_gate2_ops = {struct clk *clk_register_gate2 (struct device *dev,const char *name,const char *parent_name,unsigned long flags, -void __iomem *reg,u8 bit_idx, +void __iomem *reg,u8 bit_idx,u8 cgr_val,u8 clk_gate2_flags,spinlock_t *lock,unsigned int *share_count) {
@@ -125,6 +127,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,/* struct clk_gate2 assignments */ gate->reg = reg; gate->bit_idx = bit_idx; + gate->cgr_val = cgr_val; gate->flags = clk_gate2_flags; gate->lock = lock;
arch/arm/mach-imx/clk-vf610.c +3 -0
@@ -103,6 +103,7 @@ static struct clk_onecell_data clk_data;static unsigned int const clks_init_on[]__initconst = {VF610_CLK_SYS_BUS ,VF610_CLK_DDR_SEL , +VF610_CLK_DDRMC , };static void __init vf610_clocks_init (struct device_node *ccm_node)
@@ -171,6 +172,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_PLL4_MAIN_DIV ] =clk_register_divider_table (NULL ,"pll4_main_div" ,"pll4_main" ,0 ,CCM_CACRR ,6 ,3 ,0 , pll4_main_div_table, &imx_ccm_lock); clk[VF610_CLK_PLL6_MAIN_DIV ] =imx_clk_divider ("pll6_main_div" ,"pll6_main" ,CCM_CACRR ,21 ,1 ); + clk[VF610_CLK_DDRMC ] =imx_clk_gate2_cgr ("ddrmc" ,"ddr_sel" ,CCM_CCGR6 ,CCM_CCGRx_CGn (14 ),0x2 ); + clk[VF610_CLK_USBPHY0 ] =imx_clk_gate ("usbphy0" ,"pll3_main" ,PLL3_CTRL ,6 ); clk[VF610_CLK_USBPHY1 ] =imx_clk_gate ("usbphy1" ,"pll7_main" ,PLL7_CTRL ,6 );
arch/arm/mach-imx/clk.h +10 -3
@@ -29,7 +29,7 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,struct clk *clk_register_gate2 (struct device *dev,const char *name,const char *parent_name,unsigned long flags, -void __iomem *reg,u8 bit_idx, +void __iomem *reg,u8 bit_idx,u8 cgr_val,u8 clk_gate_flags,spinlock_t *lock,unsigned int *share_count);
@@ -43,7 +43,7 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent, void __iomem *reg, u8 shift) {return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, - shift,0 , &imx_ccm_lock,NULL ); + shift,0x3 ,0 , &imx_ccm_lock,NULL ); } static inline struct clk *imx_clk_gate2_shared(const char *name,
@@ -51,7 +51,14 @@ static inline struct clk *imx_clk_gate2_shared(const char *name, unsigned int *share_count) {return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, - shift,0 , &imx_ccm_lock, share_count); + shift,0x3 ,0 , &imx_ccm_lock, share_count); +} + +static inline struct clk *imx_clk_gate2_cgr (const char *name, +const char *parent,void __iomem *reg,u8 shift,u8 cgr_val) +{ +return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, + shift, cgr_val,0 , &imx_ccm_lock,NULL ); } struct clk *imx_clk_pfd(const char *name, const char *parent_name,
include/dt-bindings/clock/vf610-clock.h +2 -1
@@ -169,6 +169,7 @@#define VF610_CLK_PLL7_MAIN 156#define VF610_CLK_USBPHY0 157#define VF610_CLK_USBPHY1 158 -#define VF610_CLK_END 159 +#define VF610_CLK_DDRMC 159 +#define VF610_CLK_END 160#endif /* __DT_BINDINGS_CLOCK_VF610_H */
Signature · 1 line
2.1.0
Re: [PATCH 8/9] ARM: imx: clk-gate2: allow custom gate configuration
Quoted 13 lines · Stefan Agner
The 2-bit gates found i.MX and Vybrid SoC support different clock configuration:
0b00: clk disabled
0b01: clk enabled in RUN mode but disabled in WAIT and STOP mode 0b10: clk enabled in RUN, WAIT and STOP mode (only Vybrid) 0b11: clk enabled in RUN and WAIT modeFor some clocks, we might want to configure different behaviour, e.g. a memory clock should be on even in STOP mode. Add a new function
imx_clk_gate2_cgrwhich allow to configure specific gate values through thecgr_valparameter.
Quoted 6 lines
Signed-off-by Stefan Agner <[email protected]>--- arch/arm/mach-imx/clk-gate2.c | 7 +++++-- arch/arm/mach-imx/clk-vf610.c | 3 +++ arch/arm/mach-imx/clk.h | 13 ++++++++++--- include/dt-bindings/clock/vf610-clock.h | 3 ++-
The patch should be split into two, one for clk-gate2 and the other for clk-vf610 driver change. Other than that, the patch looks good to me.
Shawn
Quoted 116 lines
4 files changed, 20 insertions(+), 6 deletions(-)arch/arm/mach-imx/clk-gate2.c +5
-2@@ -31,6 +31,7 @@ struct clk_gate2 {struct clk_hw hw;void __iomem *reg;u8 bit_idx; +u8 cgr_val;u8 flags;spinlock_t *lock;unsigned int *share_count;@@ -50,7 +51,8 @@ static int clk_gate2_enable(struct clk_hw *hw) goto out; reg =readl (gate->reg); - reg |=3 << gate->bit_idx; + reg &= ~(3 << gate->bit_idx); + reg |= gate->cgr_val << gate->bit_idx;writel (reg, gate->reg); out:@@ -110,7 +112,7 @@ static struct clk_ops clk_gate2_ops = {struct clk *clk_register_gate2 (struct device *dev,const char *name,const char *parent_name,unsigned long flags, -void __iomem *reg,u8 bit_idx, +void __iomem *reg,u8 bit_idx,u8 cgr_val,u8 clk_gate2_flags,spinlock_t *lock,unsigned int *share_count) {@@ -125,6 +127,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name,/* struct clk_gate2 assignments */ gate->reg = reg; gate->bit_idx = bit_idx; + gate->cgr_val = cgr_val; gate->flags = clk_gate2_flags; gate->lock = lock;arch/arm/mach-imx/clk-vf610.c +3
-0@@ -103,6 +103,7 @@ static struct clk_onecell_data clk_data;static unsigned int const clks_init_on[]__initconst = {VF610_CLK_SYS_BUS ,VF610_CLK_DDR_SEL , +VF610_CLK_DDRMC , };static void __init vf610_clocks_init (struct device_node *ccm_node)@@ -171,6 +172,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) clk[VF610_CLK_PLL4_MAIN_DIV ] =clk_register_divider_table (NULL ,"pll4_main_div" ,"pll4_main" ,0 ,CCM_CACRR ,6 ,3 ,0 , pll4_main_div_table, &imx_ccm_lock); clk[VF610_CLK_PLL6_MAIN_DIV ] =imx_clk_divider ("pll6_main_div" ,"pll6_main" ,CCM_CACRR ,21 ,1 ); + clk[VF610_CLK_DDRMC ] =imx_clk_gate2_cgr ("ddrmc" ,"ddr_sel" ,CCM_CCGR6 ,CCM_CCGRx_CGn (14 ),0x2 ); + clk[VF610_CLK_USBPHY0 ] =imx_clk_gate ("usbphy0" ,"pll3_main" ,PLL3_CTRL ,6 ); clk[VF610_CLK_USBPHY1 ] =imx_clk_gate ("usbphy1" ,"pll7_main" ,PLL7_CTRL ,6 );arch/arm/mach-imx/clk.h +10
-3@@ -29,7 +29,7 @@ struct clk *imx_clk_pllv3(enum imx_pllv3_type type, const char *name,struct clk *clk_register_gate2 (struct device *dev,const char *name,const char *parent_name,unsigned long flags, -void __iomem *reg,u8 bit_idx, +void __iomem *reg,u8 bit_idx,u8 cgr_val,u8 clk_gate_flags,spinlock_t *lock,unsigned int *share_count);@@ -43,7 +43,7 @@ static inline struct clk *imx_clk_gate2(const char *name, const char *parent, void __iomem *reg, u8 shift) {return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, - shift,0 , &imx_ccm_lock,NULL ); + shift,0x3 ,0 , &imx_ccm_lock,NULL ); } static inline struct clk *imx_clk_gate2_shared(const char *name,@@ -51,7 +51,14 @@ static inline struct clk *imx_clk_gate2_shared(const char *name, unsigned int *share_count) {return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, - shift,0 , &imx_ccm_lock, share_count); + shift,0x3 ,0 , &imx_ccm_lock, share_count); +} + +static inline struct clk *imx_clk_gate2_cgr (const char *name, +const char *parent,void __iomem *reg,u8 shift,u8 cgr_val) +{ +return clk_register_gate2 (NULL , name, parent,CLK_SET_RATE_PARENT , reg, + shift, cgr_val,0 , &imx_ccm_lock,NULL ); } struct clk *imx_clk_pfd(const char *name, const char *parent_name,include/dt-bindings/clock/vf610-clock.h +2
-1@@ -169,6 +169,7 @@#define VF610_CLK_PLL7_MAIN 156#define VF610_CLK_USBPHY0 157#define VF610_CLK_USBPHY1 158 -#define VF610_CLK_END 159 +#define VF610_CLK_DDRMC 159 +#define VF610_CLK_END 160#endif /* __DT_BINDINGS_CLOCK_VF610_H */ Signature · 1 line
2.1.0
Stefan Agner
reviewerPATCH 9/9 ARM: vf610: initial suspend/resume support
In reply to Stefan AgnerThis patch adds initial suspend/resume support for Vybrid SoC. The standby sleep state puts the module in LP-RUN mode which allows to the SoC to be woken by a regular interrupt. The mem sleep state (Suspend-to-RAM) uses the STOP mode which puts the memory in self-refresh mode but keeps the memory clock enabled. To wake the SoC a power management wakeup IRQ need to be enabled using irq_set_irq_wake (e.g. through a GPIO).
--- arch/arm/mach-imx/Makefile | 1 + arch/arm/mach-imx/clk-vf610.c | 3 + arch/arm/mach-imx/common.h | 10 + arch/arm/mach-imx/mach-vf610.c | 1 + arch/arm/mach-imx/pm-vf610.c | 428 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 443 insertions(+) create mode 100644 arch/arm/mach-imx/pm-vf610.c
arch/arm/mach-imx/Makefile +1 -0
@@ -103,6 +103,7 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o endif obj-$(CONFIG_SOC_IMX6) += pm-imx6.o +obj-$(CONFIG_SOC_VF610) += pm-vf610.o obj-$(CONFIG_SOC_IMX50) += mach-imx50.o obj-$(CONFIG_SOC_IMX51) += mach-imx51.o
arch/arm/mach-imx/clk-vf610.c +3 -0
@@ -13,6 +13,7 @@#include <dt-bindings/clock/vf610-clock.h> #include "clk.h" +#include "common.h" #define CCM_CCR (ccm_base + 0x00)#define CCM_CSR (ccm_base + 0x04)
@@ -131,6 +132,8 @@ static void __init vf610_clocks_init(struct device_node *ccm_node) ccm_base =of_iomap (np,0 );BUG_ON (!ccm_base); +vf610_pm_set_ccm_base (ccm_base); + clk[VF610_CLK_SLOW_CLK_SEL ] =imx_clk_mux ("slow_clk_sel" ,CCM_CCSR ,4 ,1 , slow_sels,ARRAY_SIZE (slow_sels)); clk[VF610_CLK_FASK_CLK_SEL ] =imx_clk_mux ("fast_clk_sel" ,CCM_CCSR ,5 ,1 , fast_sels,ARRAY_SIZE (fast_sels));
arch/arm/mach-imx/common.h +10 -0
@@ -80,6 +80,13 @@ enum mxc_cpu_pwr_mode { STOP_POWER_OFF, /* STOP + SRPG */ }; +enum vf610_cpu_pwr_mode { +VF610_RUN , +VF610_LP_RUN , +VF610_STOP , +VF610_LP_STOP , +}; +enum mx3_cpu_pwr_mode {MX3_RUN ,MX3_WAIT ,
@@ -125,6 +132,7 @@ int imx_cpu_kill(unsigned int cpu);#ifdef CONFIG_SUSPEND void v7_cpu_resume (void );void imx6_suspend (void __iomem *ocram_vbase); +void vf610_suspend (void );#else static inline void v7_cpu_resume (void ) {}static inline void imx6_suspend (void __iomem *ocram_vbase) {}
@@ -135,6 +143,8 @@ void imx6dl_pm_init(void);void imx6sl_pm_init (void );void imx6sx_pm_init (void );void imx6q_pm_set_ccm_base (void __iomem *base); +void vf610_pm_init (void ); +void vf610_pm_set_ccm_base (void __iomem *base);#ifdef CONFIG_PM void imx51_pm_init (void );
arch/arm/mach-imx/mach-vf610.c +1 -0
@@ -25,6 +25,7 @@ static void __init vf610_init_machine(void) {mxc_arch_reset_init_dt ();of_platform_populate (NULL , of_default_bus_match_table,NULL ,NULL ); +vf610_pm_init (); }static const char *const vf610_dt_compat[]__initconst = {
arch/arm/mach-imx/pm-vf610.c new file +428 -0
428 lines not on this page · raw message
Signature · 1 line
2.1.0
cover ARM: vf610: Suspend/resume support
In reply to Stefan AgnerQuoted 27 lines · stefan at agner.ch
This patchset provides suspend/resume support for Freescale Vybrid SoC (vf610). The code is generally aligned to the implementation for i.MX6. The subsystems SRC and GPC need some changes to support the Vybrid specific implementation.
This patchset relies on GPIO driver to be present (in order to provide a wakeup source) as well as using the ARM Global Timer clock source (the Vybrid specifc PIT clock source,
vf_pit_timer.cdoes not support shutdown).The implemented sleep states (LP-RUN and STOP), are not the most power saving functions available on Vybrid. Especially for suspend-to-memory one of the LPSTOP modes looks more appropriate. However, the complexity is somewhat higher (we would need to move execution path to SRAM and store IOMUX and DDRMC configuration). Currently, I have not the resources to look into that so I hope that this initial code qualifies as power saving functions to be applied.
Suspend-to-memory as well as standby mode is tested on Colibri VF61.
Power measurement (Colibri VF61, whole module):
- Idle: 540mW
- LP-RUN: 220mW (standby)
- STOP: 200mW (mem)
Quoted 4 lines
Stefan Agner (9):
ARM: dts: vf610: Add system reset controller (SRC)
ARM: dts: vf610: add global power controller (GPC)
ARM: dts: vf610: add on-chip SRAM
These above three change sets have some implications for dual-chip (Cortex-A5/Cortex-M4) configurations. Epecially those running MQX. There is not harm to define the register space (except DT size). However, if you activate drivers that manipulate the registers for all systems, then there is no choice to have MQX work on the 2nd core.
I think that Shawn Guo already did a patchset to remove stuff from the vf610.dtsi to the machine/configuration DT files.
Quoted 19 lines
ARM: dts: vf610-colibri: GPIO power key
gpio: vf610: Extend with wakeup support
ARM: imx: gpc: Support vf610 global power controller
ARM: imx: src: Support vf610 system reset controller
ARM: imx: clk-gate2: allow custom gate configuration
ARM: vf610: initial suspend/resume support
arch/arm/boot/dts/vf610-colibri-eval-v3.dts| 26 ++arch/arm/boot/dts/vf610.dtsi| 33 +++arch/arm/mach-imx/Kconfig| 2 +arch/arm/mach-imx/Makefile| 1 +arch/arm/mach-imx/clk-gate2.c| 7 +-arch/arm/mach-imx/clk-vf610.c| 6 +arch/arm/mach-imx/clk.h| 13 +-arch/arm/mach-imx/common.h| 14 +-arch/arm/mach-imx/gpc.c| 61 ++--arch/arm/mach-imx/mach-imx6q.c| 2 +-arch/arm/mach-imx/mach-imx6sl.c| 2 +- arch/arm/mach-imx/mach-vf610.c | 9 + arch/arm/mach-imx/pm-vf610.c | 428 ++++++++++++++++++++++++++++ arch/arm/mach-imx/src.c | 11 + drivers/gpio/gpio-vf610.c | 16 ++ include/dt-bindings/clock/vf610-clock.h | 3 +- 16 files changed, 605insertions(+), 29 deletions(-) create mode 100644
arch/arm/mach-imx/pm-vf610.c
Stefan Agner
reviewercover ARM: vf610: Suspend/resume support
Am 2014-09-23 17:36, schrieb Bill Pringlemeir:
Quoted 34 lines · stefan at agner.ch
Quoted 28 lines
This patchset provides suspend/resume support for Freescale Vybrid SoC (vf610). The code is generally aligned to the implementation for i.MX6. The subsystems SRC and GPC need some changes to support the Vybrid specific implementation.
This patchset relies on GPIO driver to be present (in order to provide a wakeup source) as well as using the ARM Global Timer clock source (the Vybrid specifc PIT clock source,
vf_pit_timer.cdoes not support shutdown).The implemented sleep states (LP-RUN and STOP), are not the most power saving functions available on Vybrid. Especially for suspend-to-memory one of the LPSTOP modes looks more appropriate. However, the complexity is somewhat higher (we would need to move execution path to SRAM and store IOMUX and DDRMC configuration). Currently, I have not the resources to look into that so I hope that this initial code qualifies as power saving functions to be applied.
Suspend-to-memory as well as standby mode is tested on Colibri VF61.
Power measurement (Colibri VF61, whole module):
- Idle: 540mW
- LP-RUN: 220mW (standby)
- STOP: 200mW (mem)Quoted 4 lines
Stefan Agner (9):
ARM: dts: vf610: Add system reset controller (SRC)
ARM: dts: vf610: add global power controller (GPC)
ARM: dts: vf610: add on-chip SRAM
Quoted 5 lines
These above three change sets have some implications for dual-chip (Cortex-A5/Cortex-M4) configurations. Epecially those running MQX. There is not harm to define the register space (except DT size). However, if you activate drivers that manipulate the registers for all systems, then there is no choice to have MQX work on the 2nd core.
On the Timesys BSP, the kernel is fiddling around with this registers too, and AFAIK MQX is working with that kernel. Is MQX really using the GPC and SRC modules? I thought MQX is just relying on Linux taking care of that.
Also, you have this problem with other registers as well, for instance the CCM module. In fact, to get into deeper sleep modes, you need to access the GPC (global power controller) as well as the CCM (clock controller module, for instance the CCM_CLPCR register). When you look at all the entry sequences, they all fiddling around with the GPC and the CCM. And I don't think that the kernel can work properly without having control over the clock module.
IMHO, the SRC and GPC are like the CCM, and need to be under control of Linux exclusively.
Another case is the SRAM. There are other peripherals which are much more important, e.g. both instances of the EDMA modules are currently unconditional part of the device tree.
Besides, afaik you can also use status = "disabled" in a device tree including the vf610.dtsi. The device tree is parsed sequential, the last settings wins.
Quoted 23 lines
I think that Shawn Guo already did a patchset to remove stuff from the
vf610.dtsito the machine/configuration DT files.Quoted 19 lines
ARM: dts: vf610-colibri: GPIO power key
gpio: vf610: Extend with wakeup support
ARM: imx: gpc: Support vf610 global power controller
ARM: imx: src: Support vf610 system reset controller
ARM: imx: clk-gate2: allow custom gate configuration
ARM: vf610: initial suspend/resume support
arch/arm/boot/dts/vf610-colibri-eval-v3.dts| 26 ++arch/arm/boot/dts/vf610.dtsi| 33 +++arch/arm/mach-imx/Kconfig| 2 +arch/arm/mach-imx/Makefile| 1 +arch/arm/mach-imx/clk-gate2.c| 7 +-arch/arm/mach-imx/clk-vf610.c| 6 +arch/arm/mach-imx/clk.h| 13 +-arch/arm/mach-imx/common.h| 14 +-arch/arm/mach-imx/gpc.c| 61 ++--arch/arm/mach-imx/mach-imx6q.c| 2 +-arch/arm/mach-imx/mach-imx6sl.c| 2 +- arch/arm/mach-imx/mach-vf610.c | 9 + arch/arm/mach-imx/pm-vf610.c | 428 ++++++++++++++++++++++++++++ arch/arm/mach-imx/src.c | 11 + drivers/gpio/gpio-vf610.c | 16 ++ include/dt-bindings/clock/vf610-clock.h | 3 +- 16 files changed, 605insertions(+), 29 deletions(-) create mode 100644
arch/arm/mach-imx/pm-vf610.c
cover ARM: vf610: Suspend/resume support
Quoted 2 lines · stefan at agner.ch
Am 2014-09-23 17:36, schrieb Bill Pringlemeir:
Quoted 1 line · stefan at agner.ch
[snip]
Quoted 30 lines
Quoted 10 lines
Quoted 9 lines
Power measurement (Colibri VF61, whole module):
- Idle: 540mW
- LP-RUN: 220mW (standby)
- STOP: 200mW (mem)Stefan Agner (9):
ARM: dts: vf610: Add system reset controller (SRC)
ARM: dts: vf610: add global power controller (GPC)
ARM: dts: vf610: add on-chip SRAMQuoted 6 lines
These above three change sets have some implications for dual-chip (Cortex-A5/Cortex-M4) configurations. Epecially those running MQX. There is not harm to define the register space (except DT size). However, if you activate drivers that manipulate the registers for all systems, then there is no choice to have MQX work on the 2nd core.
On the Timesys BSP, the kernel is fiddling around with this registers too, and AFAIK MQX is working with that kernel. Is MQX really using the GPC and SRC modules? I thought MQX is just relying on Linux taking care of that.
Also, you have this problem with other registers as well, for instance the CCM module. In fact, to get into deeper sleep modes, you need to access the GPC (global power controller) as well as the CCM (clock controller module, for instance the
CCM_CLPCRregister). When you look at all the entry sequences, they all fiddling around with the GPC and the CCM. And I don't think that the kernel can work properly without having control over the clock module.
Quoted 2 lines
IMHO, the SRC and GPC are like the CCM, and need to be under control of Linux exclusively.
Yes, it is difficult to see the existing Linux infrastructure working without these. The two cores both depend on the same clocks. You must use 'clk_ignore_unused' if you want to run both.
Quoted 3 lines
Another case is the SRAM. There are other peripherals which are much more important, e.g. both instances of the EDMA modules are currently unconditional part of the device tree.
The SRAM is even more of an issue. Often the MQX is running from the SRAM. I agree that the EDMA are actually a bit of an issue as well. You need to modify MQX to not use them. However, the MQX use of EDMA seems stupid, so I prefer Linux to have this feature. I didn't see the edma patches when they went in and/or I didn't think of this until I actually encounter the 'emda' conflict issue.
Quoted 3 lines
Besides, afaik you can also use status = "disabled" in a device tree including the
vf610.dtsi. The device tree is parsed sequential, the last settings wins.
This is true, but in some cases the code is depending on the device being enabled? Also, we have automatically compiled in the drivers if 'SOC_VF610' is active. Ie, there is no way to exclude the code. The device tree also becomes a little heavier instead of including them in the machine file.
Quoted 2 lines
Quoted 2 lines
I think that Shawn Guo already did a patchset to remove stuff from the
vf610.dtsito the machine/configuration DT files.
In this patchset, I suggested that we could include the notation in the headers which are included in the 'DT' files. So instead of 'dtsi', we could use,
#define VF610_GPC_SUPPORT \
gpc: gpc at 4006c000 { \
compatible = "fsl,vf610-gpc"; \
reg = <0x4006c000 0x1000>; \
};Or even,
#define VF610_SUSPEND_DT_SUPPORT \ ...
Anyways, the DT issue doesn't matter so much. People will have to make custom versions for their own boards. Although, I don't think it is not that hard to support it at the machine level.
I agree that so far there are some peripherals that make it difficult to run the mainline Linux with an MQX. However, I think this patch set seems to bring it closer to making it impossible. I am only suggesting that we make it a configuration option and not include it for all Vybrid devices.
Is it clear that the desired way is to use,
&gpc { status = "disabled"; };
&src { status = "disabled"; };We have,
arch/arm/mach-imx/gpc.c
void __init vf610_gpc_init(void)
{
struct device_node *np;
np = of_find_compatible_node(NULL, NULL, "fsl,vf610-gpc");
gpc_base = of_iomap(np, 0);
gpc_imr_base = gpc_base + VF610_GPC_IMR1;...
arch/arm/mach-imx/mach-vf610.c
static void __init vf610_init_irq(void)
{
vf610_gpc_init();
irqchip_init();
}...
+ .init_irq = vf610_init_irq,
I don't think this will work. Not to mention that 'mach-vf610.c' will not build if HAVE_IMX_GPC is not defined. Also, I don't really see a
use of the GPC module unless suspend/resume is active? Even some wall
powered designs may wish to exclude this functionality?
I think that the SRC maybe needed for secure parts. I think that some designs might wish to restrict Linux's access to these registers as well. I don't actually see why we need this module? I think the imx6 needs it due to multi-CPU bring-up, but in the Vybrid case, this does not exist. Can you check to see why we need the SRC? I don't see where we actually use it? In patch9/9, we record it but do we actually access the registers? Is it just for the vf610_src_init() code? Even that seems the whole 'src.c' file is only needed for the 'src_base' reference, which we don't use?
Thanks,
Bill Pringlemeir.
cover ARM: vf610: Suspend/resume support
Quoted 2 lines · Bill Pringlemeir
Quoted 2 lines
Quoted 2 lines
I think that Shawn Guo already did a patchset to remove stuff from the
vf610.dtsito the machine/configuration DT files.
Do you mean the pin configuration? That's really more board-specific. But IP block/device is not really the case.
Quoted 11 lines
In this patchset, I suggested that we could include the notation in the headers which are included in the 'DT' files. So instead of 'dtsi', we could use,
#define VF610_GPC_SUPPORT \ gpc: gpc at 4006c000 { \ compatible = "fsl,vf610-gpc"; \ reg = <0x4006c000 0x1000>; \ };
Quoted 3 lines
Or even,
#define VF610_SUSPEND_DT_SUPPORT \ ...
I don't think this will be accepted by DT maintainers. We have already got some objections when we define pin function ID as multiple integers. They expect the DT macro is used for single integer case.
Quoted 37 lines
Anyways, the DT issue doesn't matter so much. People will have to make custom versions for their own boards. Although, I don't think it is not that hard to support it at the machine level.
I agree that so far there are some peripherals that make it difficult to run the mainline Linux with an MQX. However, I think this patch set seems to bring it closer to making it impossible. I am only suggesting that we make it a configuration option and not include it for all Vybrid devices.
Is it clear that the desired way is to use,
&gpc { status = "disabled"; }; &src { status = "disabled"; };We have,
arch/arm/mach-imx/gpc.cvoid __init vf610_gpc_init(void) { struct device_node *np; np = of_find_compatible_node(NULL, NULL, "fsl,vf610-gpc"); gpc_base = of_iomap(np, 0); gpc_imr_base = gpc_base + VF610_GPC_IMR1;...
arch/arm/mach-imx/mach-vf610.cstatic void __init vf610_init_irq(void) { vf610_gpc_init(); irqchip_init(); }
Quoted 5 lines
... + .init_irq = vf610_init_irq,I don't think this will work.
Yes, you're right. But I guess this can be fixed by an additional of_device_is_available() check after of_find_compatible_node() call.
Quoted 2 lines
Not to mention that '
mach-vf610.c' will
not build ifHAVE_IMX_GPCis not defined.
HAVE_IMX_GPC cannot be configured out, because it's selected by SOC_VF610.
Quoted 4 lines
Also, I don't really see a
use of the GPC module unless suspend/resume is active? Even some wall
powered designs may wish to exclude this functionality?
Quoted 9 lines
I think that the SRC maybe needed for secure parts. I think that some designs might wish to restrict Linux's access to these registers as well. I don't actually see why we need this module? I think the imx6 needs it due to multi-CPU bring-up, but in the Vybrid case, this does not exist. Can you check to see why we need the SRC? I don't see where we actually use it? In patch9/9, we record it but do we actually access the registers? Is it just for the
vf610_src_init()code? Even that seems the whole 'src.c' file is only needed for the 'src_base' reference, which we don't use?
+1. I'm also wondering how SRC is used by suspend routine in this series.
Shawn
Stefan Agner
reviewercover ARM: vf610: Suspend/resume support
Hi Bill, Hi Shawn,
Am 2014-09-28 05:08, schrieb Shawn Guo:
Quoted 69 lines · Bill Pringlemeir
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
I think that Shawn Guo already did a patchset to remove stuff from the
vf610.dtsito the machine/configuration DT files.Do you mean the pin configuration? That's really more board-specific. But IP block/device is not really the case.
Quoted 11 lines
In this patchset, I suggested that we could include the notation in the headers which are included in the 'DT' files. So instead of 'dtsi', we could use,
#define VF610_GPC_SUPPORT \ gpc: gpc at 4006c000 { \ compatible = "fsl,vf610-gpc"; \ reg = <0x4006c000 0x1000>; \ };Quoted 3 lines
Or even,
#define VF610_SUSPEND_DT_SUPPORT \ ...I don't think this will be accepted by DT maintainers. We have already got some objections when we define pin function ID as multiple integers. They expect the DT macro is used for single integer case.
Quoted 37 lines
Anyways, the DT issue doesn't matter so much. People will have to make custom versions for their own boards. Although, I don't think it is not that hard to support it at the machine level.
I agree that so far there are some peripherals that make it difficult to run the mainline Linux with an MQX. However, I think this patch set seems to bring it closer to making it impossible. I am only suggesting that we make it a configuration option and not include it for all Vybrid devices.
Is it clear that the desired way is to use,
&gpc { status = "disabled"; }; &src { status = "disabled"; };We have,
arch/arm/mach-imx/gpc.cvoid __init vf610_gpc_init(void) { struct device_node *np; np = of_find_compatible_node(NULL, NULL, "fsl,vf610-gpc"); gpc_base = of_iomap(np, 0); gpc_imr_base = gpc_base + VF610_GPC_IMR1;...
arch/arm/mach-imx/mach-vf610.cstatic void __init vf610_init_irq(void) { vf610_gpc_init(); irqchip_init(); }Quoted 5 lines
... + .init_irq = vf610_init_irq,I don't think this will work.
Quoted 9 lines
Yes, you're right. But I guess this can be fixed by an additional
of_device_is_available()check afterof_find_compatible_node()call.Quoted 2 lines
Not to mention that '
mach-vf610.c' will
not build ifHAVE_IMX_GPCis not defined.
HAVE_IMX_GPCcannot be configured out, because it's selected bySOC_VF610.
Maybe we can make that optional when CONFIG_PM is on, e.g. select HAVE_IMX_GPC if PM
The GPC module is all about power management, hence in case we want the M4 taken care of that, we just have to configure a Linux kernel without CONFIG_PM support.
Quoted 14 lines
Quoted 4 lines
Also, I don't really see a
use of the GPC module unless suspend/resume is active? Even some wall
powered designs may wish to exclude this functionality?Quoted 9 lines
I think that the SRC maybe needed for secure parts. I think that some designs might wish to restrict Linux's access to these registers as well. I don't actually see why we need this module? I think the imx6 needs it due to multi-CPU bring-up, but in the Vybrid case, this does not exist. Can you check to see why we need the SRC? I don't see where we actually use it? In patch9/9, we record it but do we actually access the registers? Is it just for the
vf610_src_init()code? Even that seems the whole 'src.c' file is only needed for the 'src_base' reference, which we don't use?
Quoted 2 lines
+1. I'm also wondering how SRC is used by suspend routine in this series.
Well I tried to bring LPStop modes to work, which would need GPR0/GPR1 registers of SRC. If I have it working in the next series, I will need that, but if not, I will drop those changes.
--
Stefan
cover ARM: vf610: Suspend/resume support
Quoted 9 lines
Quoted 5 lines · Bill Pringlemeir
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I think that Shawn Guo already did a patchset to remove stuff from the
vf610.dtsito the machine/configuration DT files.Am 2014-09-28 05:08, schrieb Shawn Guo:
Quoted 2 lines
Do you mean the pin configuration? That's really more board-specific. But IP block/device is not really the case.
Ok. But if a DT does not use a IP block/device, then it is extra stuff in the DT. I see you only meant the pin configuration which can be quite large. So it makes sense to only apply this for the pins.
Quoted 11 lines
Quoted 11 lines · Bill Pringlemeir
Quoted 10 lines
In this patchset, I suggested that we could include the notation in the headers which are included in the 'DT' files. So instead of 'dtsi', we could use,
#define
VF610_GPC_SUPPORT\
gpc: gpc at4006c000{ \
compatible = "fsl,vf610-gpc"; \
reg = <0x4006c0000x1000>; \
};
Quoted 10 lines
Quoted 3 lines
Quoted 3 lines
Or even,
#define
VF610_SUSPEND_DT_SUPPORT\ ...Am 2014-09-28 05:08, schrieb Shawn Guo:
Quoted 4 lines
I don't think this will be accepted by DT maintainers. We have already got some objections when we define pin function ID as multiple integers. They expect the DT macro is used for single integer case.
Supporting status="disabled" and/or requiring enabled is also good. Is that the 'DT' approved mechanism?
[snip]
Quoted 38 lines
Quoted 16 lines · Bill Pringlemeir
Quoted 15 lines
We have,
arch/arm/mach-imx/gpc.cvoid
__initvf610_gpc_init(void)
{
structdevice_node*np;np =
of_find_compatible_node(NULL, NULL, "fsl,vf610-gpc");gpc_base=of_iomap(np, 0);gpc_imr_base=gpc_base+VF610_GPC_IMR1;
...
arch/arm/mach-imx/mach-vf610.cQuoted 7 lines
Quoted 7 lines
static void
__initvf610_init_irq(void)
{vf610_gpc_init();irqchip_init();
}I don't think this will work.
Am 2014-09-28 05:08, schrieb Shawn Guo:
Quoted 7 lines
Yes, you're right. But I guess this can be fixed by an additional
of_device_is_available()check afterof_find_compatible_node()call.Quoted 2 lines · Bill Pringlemeir
Not to mention that '
mach-vf610.c' will not build ifHAVE_IMX_GPCis not defined.Am 2014-09-28 05:08, schrieb Shawn Guo:
Quoted 2 lines
HAVE_IMX_GPCcannot be configured out, because it's selected bySOC_VF610.
Quoted 6 lines · stefan at agner.ch
Maybe we can make that optional when
CONFIG_PMis on, e.g. selectHAVE_IMX_GPCif PMThe GPC module is all about power management, hence in case we want the M4 taken care of that, we just have to configure a Linux kernel without
CONFIG_PMsupport.
Yes as per the paragraph below, I am concerned about adding too many modules (or making inter-modules dependencies) in the drivers. I guess in a Quad-core iMx6, a system might want one CPU dedicated to some feature (non-Linux). For the Vybrid, VF6xx, this is pretty much a sure thing. There is an M4, and it does have I/D TCM, but to do anything useful it has to have some AIPS modules.
Quoted 14 lines
Quoted 13 lines
Quoted 13 lines
Also, I don't really see a use of the GPC module unless suspend/resume is active? Even some wall powered designs may wish to exclude this functionality?
I think that the SRC maybe needed for secure parts. I think that some designs might wish to restrict Linux's access to these registers as well. I don't actually see why we need this module? I think the imx6 needs it due to multi-CPU bring-up, but in the Vybrid case, this does not exist. Can you check to see why we need the SRC? I don't see where we actually use it? In patch9/9, we record it but do we actually access the registers? Is it just for the
vf610_src_init()code? Even that seems the whole 'src.c' file is only needed for the 'src_base' reference, which we don't use?
Quoted 6 lines
Quoted 2 lines
+1. I'm also wondering how SRC is used by suspend routine in this series.
Well I tried to bring LPStop modes to work, which would need GPR0/GPR1 registers of SRC. If I have it working in the next series, I will need that, but if not, I will drop those changes.
Most people would want to use at least some IRAM for the M4 code space as the TCM is rather limited. Carving off the whole thing for Linux is not great either. The imx series had an iram allocator by Sacha Hauer? However, I don't see this in the mainline anymore. Is the IRAM statically allocated by 'DT'? For the 'memory' node, we keep this in the machine 'DT', so someone could carve off DDR3 for the M4. I don't think the initial series used the IRAM either? But it is more clear to me why you wanted that.
I think we might exclude the IRAM and SRC from the initial series? At least this patchset might hang around before the LPStop is accepted and merged? Or you could roll them together so at least we could see what was next? I guess you might not have polished the LPSTOP as well and aren't ready for review. But I think the changes to remove the SRC and IRAM aren't too big to get this applied and then later merge them?
Fwiw,
Bill Pringlemeir.
Quoted 10 lines · Stefan Agner
This patchset provides suspend/resume support for Freescale Vybrid SoC (vf610). The code is generally aligned to the implementation for i.MX6. The subsystems SRC and GPC need some changes to support the Vybrid specific implementation.
This patchset relies on GPIO driver to be present (in order to provide a wakeup source) as well as using the ARM Global Timer clock source (the Vybrid specifc PIT clock source,
vf_pit_timer.cdoes not support shutdown).
Quoted 8 lines
The implemented sleep states (LP-RUN and STOP), are not the most power saving functions available on Vybrid. Especially for suspend-to-memory one of the LPSTOP modes looks more appropriate. However, the complexity is somewhat higher (we would need to move execution path to SRAM and store IOMUX and DDRMC configuration). Currently, I have not the resources to look into that so I hope that this initial code qualifies as power saving functions to be applied.
So you have quite a lot of unnecessary code which is only needed by suspend from SRAM (store IOMUX and DDRMC configuration).
Not happy with that.
Shawn