Re: [PATCH 05/13] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
Another update on this one to fix a build break that Tony spotted. - Paul From: Paul Walmsley Date: Mon, 29 Oct 2012 20:56:07 -0600 Subject: [PATCH] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific variants. These functions need to be able to save the reboot reason into the scratchpad RAM. This implies a dependency on both the PRM and SCM IP blocks, so they've been moved into their own file. This will eventually call functions in the PRM and SCM drivers, once those are created. Vaibhav Hiremath identified an unused prototype in the first version of this patch - now removed. Tony Lindgren noted a compile problem with some RMK Kconfigs; resolved in this patch. Signed-off-by: Paul Walmsley Cc: Vaibhav Hiremath Tested-by: Vaibhav Hiremath Cc: Tony Lindgren --- arch/arm/mach-omap2/Makefile|5 +++ arch/arm/mach-omap2/common.h| 24 + arch/arm/mach-omap2/omap2-restart.c | 65 +++ arch/arm/mach-omap2/omap3-restart.c | 36 +++ arch/arm/mach-omap2/omap4-common.c | 17 + 5 files changed, 147 insertions(+) create mode 100644 arch/arm/mach-omap2/omap2-restart.c create mode 100644 arch/arm/mach-omap2/omap3-restart.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ae87a3e..1988810 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -50,6 +50,11 @@ AFLAGS_sram242x.o:=-Wa,-march=armv6 AFLAGS_sram243x.o :=-Wa,-march=armv6 AFLAGS_sram34xx.o :=-Wa,-march=armv7-a +# Restart code (OMAP4/5 currently in omap4-common.c) +obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o +obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o +obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o + # Pin multiplexing obj-$(CONFIG_SOC_OMAP2420) += mux2420.o obj-$(CONFIG_SOC_OMAP2430) += mux2430.o diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index ed21815..349d015 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -113,6 +113,30 @@ void omap4430_init_late(void); int omap2_common_pm_late_init(void); void omap_prcm_restart(char, const char *); +#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) +void omap2xxx_restart(char mode, const char *cmd); +#else +static inline void omap2xxx_restart(char mode, const char *cmd) +{ +} +#endif + +#ifdef CONFIG_ARCH_OMAP3 +void omap3xxx_restart(char mode, const char *cmd); +#else +static inline void omap3xxx_restart(char mode, const char *cmd) +{ +} +#endif + +#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) +void omap44xx_restart(char mode, const char *cmd); +#else +static inline void omap44xx_restart(char mode, const char *cmd) +{ +} +#endif + /* This gets called from mach-omap2/io.c, do not call this */ void __init omap2_set_globals_tap(u32 class, void __iomem *tap); diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c new file mode 100644 index 000..be6bc89 --- /dev/null +++ b/arch/arm/mach-omap2/omap2-restart.c @@ -0,0 +1,65 @@ +/* + * omap2-restart.c - code common to all OMAP2xxx machines. + * + * Copyright (C) 2012 Texas Instruments + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include + +#include "common.h" +#include "prm2xxx.h" + +/* + * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set + * clock and the sys_ck. Used during the reset process + */ +static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; + +/* Reboot handling */ + +/** + * omap2xxx_restart - Set DPLL to bypass mode for reboot to work + * + * Set the DPLL to bypass so that reboot completes successfully. No + * return value. + */ +void omap2xxx_restart(char mode, const char *cmd) +{ + u32 rate; + + rate = clk_get_rate(reset_sys_ck); + clk_set_rate(reset_virt_prcm_set_ck, rate); + + /* XXX Should save the cmd argument for use after the reboot */ + + omap2xxx_prm_dpll_reset(); /* never returns */ + while (1); +} + +/** + * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart + * + * Some clocks need to be looked up in advance for the SoC restart + * operation to work - see omap2xxx_restart(). Returns -EINVAL upon + * error or 0 upon success. + */ +static int __init omap2xxx_common_look_up_clks_for_reset(void) +{ + reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); + if (IS_ERR(reset_virt_prcm_set_ck)) + return -EINVAL; + + reset_sys_ck = clk_get(NULL, "sys_ck"); + if (IS_ERR(reset_sys_ck)) + return -EINVAL; + + ret
Re: [PATCH 05/13] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
Here's an update of this one. - Paul From: Paul Walmsley Date: Mon, 29 Oct 2012 20:56:07 -0600 Subject: [PATCH] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific variants. These functions need to be able to save the reboot reason into the scratchpad RAM. This implies a dependency on both the PRM and SCM IP blocks, so they've been moved into their own file. This will eventually call functions in the PRM and SCM drivers, once those are created. Vaibhav Hiremath identified an unused prototype in the first version of this patch - now removed. Signed-off-by: Paul Walmsley Cc: Vaibhav Hiremath Tested-by: Vaibhav Hiremath --- arch/arm/mach-omap2/Makefile|5 +++ arch/arm/mach-omap2/common.h| 24 + arch/arm/mach-omap2/omap2-restart.c | 65 +++ arch/arm/mach-omap2/omap3-restart.c | 36 +++ arch/arm/mach-omap2/omap4-common.c | 16 + 5 files changed, 146 insertions(+) create mode 100644 arch/arm/mach-omap2/omap2-restart.c create mode 100644 arch/arm/mach-omap2/omap3-restart.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index ae87a3e..1988810 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -50,6 +50,11 @@ AFLAGS_sram242x.o:=-Wa,-march=armv6 AFLAGS_sram243x.o :=-Wa,-march=armv6 AFLAGS_sram34xx.o :=-Wa,-march=armv7-a +# Restart code (OMAP4/5 currently in omap4-common.c) +obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o +obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o +obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o + # Pin multiplexing obj-$(CONFIG_SOC_OMAP2420) += mux2420.o obj-$(CONFIG_SOC_OMAP2430) += mux2430.o diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index b8f7710..3f5aa9d 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -121,6 +121,30 @@ void omap4430_init_late(void); int omap2_common_pm_late_init(void); void omap_prcm_restart(char, const char *); +#if defined(CONFIG_SOC_OMAP2420) || defined(CONFIG_SOC_OMAP2430) +void omap2xxx_restart(char mode, const char *cmd); +#else +static inline void omap2xxx_restart(char mode, const char *cmd) +{ +} +#endif + +#ifdef CONFIG_ARCH_OMAP3 +void omap3xxx_restart(char mode, const char *cmd); +#else +static inline void omap3xxx_restart(char mode, const char *cmd) +{ +} +#endif + +#if defined(CONFIG_ARCH_OMAP4) || defined(CONFIG_SOC_OMAP5) +void omap44xx_restart(char mode, const char *cmd); +#else +static inline void omap44xx_restart(char mode, const char *cmd) +{ +} +#endif + /* This gets called from mach-omap2/io.c, do not call this */ void __init omap2_set_globals_tap(u32 class, void __iomem *tap); diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c new file mode 100644 index 000..be6bc89 --- /dev/null +++ b/arch/arm/mach-omap2/omap2-restart.c @@ -0,0 +1,65 @@ +/* + * omap2-restart.c - code common to all OMAP2xxx machines. + * + * Copyright (C) 2012 Texas Instruments + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include + +#include "common.h" +#include "prm2xxx.h" + +/* + * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set + * clock and the sys_ck. Used during the reset process + */ +static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; + +/* Reboot handling */ + +/** + * omap2xxx_restart - Set DPLL to bypass mode for reboot to work + * + * Set the DPLL to bypass so that reboot completes successfully. No + * return value. + */ +void omap2xxx_restart(char mode, const char *cmd) +{ + u32 rate; + + rate = clk_get_rate(reset_sys_ck); + clk_set_rate(reset_virt_prcm_set_ck, rate); + + /* XXX Should save the cmd argument for use after the reboot */ + + omap2xxx_prm_dpll_reset(); /* never returns */ + while (1); +} + +/** + * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart + * + * Some clocks need to be looked up in advance for the SoC restart + * operation to work - see omap2xxx_restart(). Returns -EINVAL upon + * error or 0 upon success. + */ +static int __init omap2xxx_common_look_up_clks_for_reset(void) +{ + reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); + if (IS_ERR(reset_virt_prcm_set_ck)) + return -EINVAL; + + reset_sys_ck = clk_get(NULL, "sys_ck"); + if (IS_ERR(reset_sys_ck)) + return -EINVAL; + + return 0; +} +core_initcall(omap2xxx_common_look_up_clks_for_reset); diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-re
Re: [PATCH 05/13] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
On Wed, 31 Oct 2012, Vaibhav Hiremath wrote: > omap5xxx_restart declaration needs to be removed from here. > There is no such function implemented in code. Thanks, prototype dropped. - Paul -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 05/13] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
On 10/26/2012 4:51 AM, Paul Walmsley wrote: > Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific > variants. These functions need to be able to save the reboot reason > into the scratchpad RAM. This implies a dependency on both the PRM > and SCM IP blocks, so they've been moved into their own file. This > will eventually call functions in the PRM and SCM drivers, once those > are created. > > Signed-off-by: Paul Walmsley > --- > arch/arm/mach-omap2/Makefile|5 +++ > arch/arm/mach-omap2/common.h|4 ++ > arch/arm/mach-omap2/omap2-restart.c | 65 > +++ > arch/arm/mach-omap2/omap3-restart.c | 36 +++ > arch/arm/mach-omap2/omap4-common.c | 16 + > 5 files changed, 126 insertions(+) > create mode 100644 arch/arm/mach-omap2/omap2-restart.c > create mode 100644 arch/arm/mach-omap2/omap3-restart.c > > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile > index 7a628e7..aa0f59c 100644 > --- a/arch/arm/mach-omap2/Makefile > +++ b/arch/arm/mach-omap2/Makefile > @@ -49,6 +49,11 @@ AFLAGS_sram242x.o :=-Wa,-march=armv6 > AFLAGS_sram243x.o:=-Wa,-march=armv6 > AFLAGS_sram34xx.o:=-Wa,-march=armv7-a > > +# Restart code (OMAP4/5 currently in omap4-common.c) > +obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o > +obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o > +obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o > + > # Pin multiplexing > obj-$(CONFIG_SOC_OMAP2420) += mux2420.o > obj-$(CONFIG_SOC_OMAP2430) += mux2430.o > diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h > index 320f0d7..06dff1a 100644 > --- a/arch/arm/mach-omap2/common.h > +++ b/arch/arm/mach-omap2/common.h > @@ -115,6 +115,10 @@ void ti81xx_init_late(void); > void omap4430_init_late(void); > int omap2_common_pm_late_init(void); > void omap_prcm_restart(char, const char *); > +void omap2xxx_restart(char, const char *); > +void omap3xxx_restart(char, const char *); > +void omap44xx_restart(char, const char *); > +void omap5xxx_restart(char, const char *); > Paul, omap5xxx_restart declaration needs to be removed from here. There is no such function implemented in code. Thanks, Vaibhav > /* This gets called from mach-omap2/io.c, do not call this */ > void __init omap2_set_globals_tap(u32 class, void __iomem *tap); > diff --git a/arch/arm/mach-omap2/omap2-restart.c > b/arch/arm/mach-omap2/omap2-restart.c > new file mode 100644 > index 000..be6bc89 > --- /dev/null > +++ b/arch/arm/mach-omap2/omap2-restart.c > @@ -0,0 +1,65 @@ > +/* > + * omap2-restart.c - code common to all OMAP2xxx machines. > + * > + * Copyright (C) 2012 Texas Instruments > + * Paul Walmsley > + * > + * This program is free software; you can redistribute it and/or modify > + * it under the terms of the GNU General Public License version 2 as > + * published by the Free Software Foundation. > + */ > +#include > +#include > +#include > +#include > + > +#include "common.h" > +#include "prm2xxx.h" > + > +/* > + * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set > + * clock and the sys_ck. Used during the reset process > + */ > +static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; > + > +/* Reboot handling */ > + > +/** > + * omap2xxx_restart - Set DPLL to bypass mode for reboot to work > + * > + * Set the DPLL to bypass so that reboot completes successfully. No > + * return value. > + */ > +void omap2xxx_restart(char mode, const char *cmd) > +{ > + u32 rate; > + > + rate = clk_get_rate(reset_sys_ck); > + clk_set_rate(reset_virt_prcm_set_ck, rate); > + > + /* XXX Should save the cmd argument for use after the reboot */ > + > + omap2xxx_prm_dpll_reset(); /* never returns */ > + while (1); > +} > + > +/** > + * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart > + * > + * Some clocks need to be looked up in advance for the SoC restart > + * operation to work - see omap2xxx_restart(). Returns -EINVAL upon > + * error or 0 upon success. > + */ > +static int __init omap2xxx_common_look_up_clks_for_reset(void) > +{ > + reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); > + if (IS_ERR(reset_virt_prcm_set_ck)) > + return -EINVAL; > + > + reset_sys_ck = clk_get(NULL, "sys_ck"); > + if (IS_ERR(reset_sys_ck)) > + return -EINVAL; > + > + return 0; > +} > +core_initcall(omap2xxx_common_look_up_clks_for_reset); > diff --git a/arch/arm/mach-omap2/omap3-restart.c > b/arch/arm/mach-omap2/omap3-restart.c > new file mode 100644 > index 000..923c582 > --- /dev/null > +++ b/arch/arm/mach-omap2/omap3-restart.c > @@ -0,0 +1,36 @@ > +/* > + * omap3-restart.c - Code common to all OMAP3xxx machines. > + * > + * Copyright (C) 2009, 2012 Texas Instruments > + * Copyright (C) 2010 Nokia Corporation > + * Tony Lindgren > + *
[PATCH 05/13] ARM: OMAP2+: PRCM: create SoC-specific chip restart functions
Split omap_prcm_restart() from mach-omap2/prcm.c into SoC-specific variants. These functions need to be able to save the reboot reason into the scratchpad RAM. This implies a dependency on both the PRM and SCM IP blocks, so they've been moved into their own file. This will eventually call functions in the PRM and SCM drivers, once those are created. Signed-off-by: Paul Walmsley --- arch/arm/mach-omap2/Makefile|5 +++ arch/arm/mach-omap2/common.h|4 ++ arch/arm/mach-omap2/omap2-restart.c | 65 +++ arch/arm/mach-omap2/omap3-restart.c | 36 +++ arch/arm/mach-omap2/omap4-common.c | 16 + 5 files changed, 126 insertions(+) create mode 100644 arch/arm/mach-omap2/omap2-restart.c create mode 100644 arch/arm/mach-omap2/omap3-restart.c diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 7a628e7..aa0f59c 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile @@ -49,6 +49,11 @@ AFLAGS_sram242x.o:=-Wa,-march=armv6 AFLAGS_sram243x.o :=-Wa,-march=armv6 AFLAGS_sram34xx.o :=-Wa,-march=armv7-a +# Restart code (OMAP4/5 currently in omap4-common.c) +obj-$(CONFIG_SOC_OMAP2420) += omap2-restart.o +obj-$(CONFIG_SOC_OMAP2430) += omap2-restart.o +obj-$(CONFIG_ARCH_OMAP3) += omap3-restart.o + # Pin multiplexing obj-$(CONFIG_SOC_OMAP2420) += mux2420.o obj-$(CONFIG_SOC_OMAP2430) += mux2430.o diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h index 320f0d7..06dff1a 100644 --- a/arch/arm/mach-omap2/common.h +++ b/arch/arm/mach-omap2/common.h @@ -115,6 +115,10 @@ void ti81xx_init_late(void); void omap4430_init_late(void); int omap2_common_pm_late_init(void); void omap_prcm_restart(char, const char *); +void omap2xxx_restart(char, const char *); +void omap3xxx_restart(char, const char *); +void omap44xx_restart(char, const char *); +void omap5xxx_restart(char, const char *); /* This gets called from mach-omap2/io.c, do not call this */ void __init omap2_set_globals_tap(u32 class, void __iomem *tap); diff --git a/arch/arm/mach-omap2/omap2-restart.c b/arch/arm/mach-omap2/omap2-restart.c new file mode 100644 index 000..be6bc89 --- /dev/null +++ b/arch/arm/mach-omap2/omap2-restart.c @@ -0,0 +1,65 @@ +/* + * omap2-restart.c - code common to all OMAP2xxx machines. + * + * Copyright (C) 2012 Texas Instruments + * Paul Walmsley + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include +#include +#include + +#include "common.h" +#include "prm2xxx.h" + +/* + * reset_virt_prcm_set_ck, reset_sys_ck: pointers to the virt_prcm_set + * clock and the sys_ck. Used during the reset process + */ +static struct clk *reset_virt_prcm_set_ck, *reset_sys_ck; + +/* Reboot handling */ + +/** + * omap2xxx_restart - Set DPLL to bypass mode for reboot to work + * + * Set the DPLL to bypass so that reboot completes successfully. No + * return value. + */ +void omap2xxx_restart(char mode, const char *cmd) +{ + u32 rate; + + rate = clk_get_rate(reset_sys_ck); + clk_set_rate(reset_virt_prcm_set_ck, rate); + + /* XXX Should save the cmd argument for use after the reboot */ + + omap2xxx_prm_dpll_reset(); /* never returns */ + while (1); +} + +/** + * omap2xxx_common_look_up_clks_for_reset - look up clocks needed for restart + * + * Some clocks need to be looked up in advance for the SoC restart + * operation to work - see omap2xxx_restart(). Returns -EINVAL upon + * error or 0 upon success. + */ +static int __init omap2xxx_common_look_up_clks_for_reset(void) +{ + reset_virt_prcm_set_ck = clk_get(NULL, "virt_prcm_set"); + if (IS_ERR(reset_virt_prcm_set_ck)) + return -EINVAL; + + reset_sys_ck = clk_get(NULL, "sys_ck"); + if (IS_ERR(reset_sys_ck)) + return -EINVAL; + + return 0; +} +core_initcall(omap2xxx_common_look_up_clks_for_reset); diff --git a/arch/arm/mach-omap2/omap3-restart.c b/arch/arm/mach-omap2/omap3-restart.c new file mode 100644 index 000..923c582 --- /dev/null +++ b/arch/arm/mach-omap2/omap3-restart.c @@ -0,0 +1,36 @@ +/* + * omap3-restart.c - Code common to all OMAP3xxx machines. + * + * Copyright (C) 2009, 2012 Texas Instruments + * Copyright (C) 2010 Nokia Corporation + * Tony Lindgren + * Santosh Shilimkar + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ +#include +#include + +#include "iomap.h" +#include "common.h" +#include "control.h" +#include "prm3xxx.h" + +/* Global address base setup code */ + +/** + * omap3xxx_restart - trigger a s