Skip to contentSkip to conversation

ARM: AM33xx: add support for reboot

PATCH New Daniel Mack 4 participants 7 messages Oct 28, 2012 – Oct 29, 2012

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

This patch adds the ability to reboot am33xx-based systems.

---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +6 -0
index 0f51e03..8a3068a 100644
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);
 	} else {
 		WARN_ON(1);
 	}
Signature · 1 line
1.7.11.7
#1 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

[Cc Tony]

Quoted 1 line · Daniel Mack

This patch adds the ability to reboot am33xx-based systems.

Sorry, I lacked to investigate on the attribution here. According to "git blame" of a BSP kernel I got these lines from, the original author is Afzal Mohammed.

Afzal, are you planning to resubmit this for mainline? My version can of course be disposed then.

Thanks,
Daniel

Quoted 43 lines
---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +6 -0
index 0f51e03..8a3068a 100644
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);
 	} else {
 		WARN_ON(1);
 	}
#2 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

Quoted 12 lines · Daniel Mack

[Cc Tony]

Quoted 1 line · Daniel Mack

This patch adds the ability to reboot am33xx-based systems.

Sorry, I lacked to investigate on the attribution here. According to "git blame" of a BSP kernel I got these lines from, the original author is Afzal Mohammed.

Afzal, are you planning to resubmit this for mainline? My version can of course be disposed then.

This should be on top of Paul's recent changes [1] to save him some rework headache.

Regards,
Vaibhav

[1] http://marc.info/?l=linux-omap&m=135120744528680&w=2

#3 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

In reply to Daniel Mack

Hi Daniel,

Quoted 2 lines · Daniel Mack

Afzal, are you planning to resubmit this for mainline? My version can of course be disposed then.

I am not planning to submit it as of now, and Vaibhav H has a better suggestion on this, you may co-ordinate with him.

Regards
Afzal

#4 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

In reply to Daniel Mack
Quoted 33 lines · Daniel Mack

This patch adds the ability to reboot am33xx-based systems.

---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +1 -0
index 0f51e03..8a3068a 100644
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"

arch/arm/mach-omap2/prcm.c void omap_prcm_restart(char mode, const char *cmd) · line 80

Quoted 8 lines
arch/arm/mach-omap2/prcm.c +5 -0
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);

This is not clean way of handling it, we should have something similar to omap4. Also we should use warm-reset here instead of cold.

I have quickly created patch, can you please review and test is? I have tested it on AM335x EVM and Bone platform.

arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap3_am33xx_timer,
        .dt_compat      = am33xx_boards_compat,
+       .restart        = omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +3 -0
index 0f51e03..490f8f6 100644
@@ -33,6 +33,7 @@
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prm33xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"
 #include "prm-regbits-24xx.h"
@@ -72,6 +73,8 @@ void omap_prcm_restart(char mode, const char *cmd)
                omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
        } else if (cpu_is_omap44xx()) {
                omap4_prminst_global_warm_sw_reset(); /* never returns */
+       } else if (soc_is_am33xx()) {
+               am33xx_prm_global_warm_sw_reset();      /* never returns */
        } else {
                WARN_ON(1);
        }
arch/arm/mach-omap2/prm33xx.c +15 -0
index e7dbb6c..505219d 100644
@@ -133,3 +133,18 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
 
        return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
 }
+
+void am33xx_prm_global_warm_sw_reset(void)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
+                                   AM33XX_PRM_RSTCTRL_OFFSET);
+       v |= AM33XX_GLOBAL_WARM_SW_RST_MASK;
+       am33xx_prm_write_reg(v, AM33XX_PRM_DEVICE_MOD,
+                                AM33XX_PRM_RSTCTRL_OFFSET);
+
+       /* OCP barrier */
+       v = am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
+                                   AM33XX_PRM_RSTCTRL_OFFSET);
+}
arch/arm/mach-omap2/prm33xx.h +1 -0
index 3f25c56..cdfc694 100644
@@ -126,4 +126,5 @@ extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
 extern int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs);
 extern int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
                u16 rstctrl_offs, u16 rstst_offs);
+extern void am33xx_prm_global_warm_sw_reset(void);
 

Thanks,
Vaibhav

#5 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

Quoted 46 lines · Vaibhav
Quoted 33 lines · Daniel Mack

This patch adds the ability to reboot am33xx-based systems.

---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +1 -0
index 0f51e03..8a3068a 100644
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"

arch/arm/mach-omap2/prcm.c void omap_prcm_restart(char mode, const char *cmd) · line 80

Quoted 8 lines
arch/arm/mach-omap2/prcm.c +5 -0
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);

This is not clean way of handling it, we should have something similar to omap4. Also we should use warm-reset here instead of cold.

Quoted 2 lines

I have quickly created patch, can you please review and test is? I have tested it on AM335x EVM and Bone platform.

Works for me as well, thanks!

You can take my

if you wish ...

Quoted 72 lines
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
        .init_machine   = omap_generic_init,
        .timer          = &omap3_am33xx_timer,
        .dt_compat      = am33xx_boards_compat,
+       .restart        = omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +3 -0
index 0f51e03..490f8f6 100644
@@ -33,6 +33,7 @@
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
 #include "prm44xx.h"
+#include "prm33xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"
 #include "prm-regbits-24xx.h"
@@ -72,6 +73,8 @@ void omap_prcm_restart(char mode, const char *cmd)
                omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
        } else if (cpu_is_omap44xx()) {
                omap4_prminst_global_warm_sw_reset(); /* never returns */
+       } else if (soc_is_am33xx()) {
+               am33xx_prm_global_warm_sw_reset();      /* never returns */
        } else {
                WARN_ON(1);
        }
arch/arm/mach-omap2/prm33xx.c +15 -0
index e7dbb6c..505219d 100644
@@ -133,3 +133,18 @@ int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
 
        return (c == MAX_MODULE_HARDRESET_WAIT) ? -EBUSY : 0;
 }
+
+void am33xx_prm_global_warm_sw_reset(void)
+{
+       u32 v;
+
+       v = am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
+                                   AM33XX_PRM_RSTCTRL_OFFSET);
+       v |= AM33XX_GLOBAL_WARM_SW_RST_MASK;
+       am33xx_prm_write_reg(v, AM33XX_PRM_DEVICE_MOD,
+                                AM33XX_PRM_RSTCTRL_OFFSET);
+
+       /* OCP barrier */
+       v = am33xx_prm_read_reg(AM33XX_PRM_DEVICE_MOD,
+                                   AM33XX_PRM_RSTCTRL_OFFSET);
+}
arch/arm/mach-omap2/prm33xx.h +1 -0
index 3f25c56..cdfc694 100644
@@ -126,4 +126,5 @@ extern int am33xx_prm_is_hardreset_asserted(u8 shift, s16 inst,
 extern int am33xx_prm_assert_hardreset(u8 shift, s16 inst, u16 rstctrl_offs);
 extern int am33xx_prm_deassert_hardreset(u8 shift, s16 inst,
                u16 rstctrl_offs, u16 rstst_offs);
+extern void am33xx_prm_global_warm_sw_reset(void);
 

Thanks,
Vaibhav

#6 lore raw

PATCH 1/1 ARM: AM33xx: add support for reboot

Quoted 47 lines · Daniel Mack
Quoted 46 lines · Vaibhav
Quoted 33 lines · Daniel Mack

This patch adds the ability to reboot am33xx-based systems.

---
 arch/arm/mach-omap2/board-generic.c | 1 +
 arch/arm/mach-omap2/prcm.c          | 6 ++++++
 2 files changed, 7 insertions(+)
arch/arm/mach-omap2/board-generic.c +1 -0
index 601ecdf..6a69ceb 100644
@@ -114,6 +114,7 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
 	.init_machine	= omap_generic_init,
 	.timer		= &omap3_am33xx_timer,
 	.dt_compat	= am33xx_boards_compat,
+	.restart	= omap_prcm_restart,
 MACHINE_END
 #endif
 
arch/arm/mach-omap2/prcm.c +1 -0
index 0f51e03..8a3068a 100644
@@ -32,6 +32,7 @@
 #include "clock2xxx.h"
 #include "cm2xxx_3xxx.h"
 #include "prm2xxx_3xxx.h"
+#include "prm33xx.h"
 #include "prm44xx.h"
 #include "prminst44xx.h"
 #include "cminst44xx.h"

arch/arm/mach-omap2/prcm.c void omap_prcm_restart(char mode, const char *cmd) · line 80

Quoted 8 lines
arch/arm/mach-omap2/prcm.c +5 -0
@@ -72,6 +73,11 @@ void omap_prcm_restart(char mode, const char *cmd)
 		omap3_ctrl_write_boot_mode((cmd ? (u8)*cmd : 0));
 	} else if (cpu_is_omap44xx()) {
 		omap4_prminst_global_warm_sw_reset(); /* never returns */
+	} else if (soc_is_am33xx()) {
+		prcm_offs = AM33XX_PRM_DEVICE_MOD;
+		omap2_prm_set_mod_reg_bits(OMAP4430_RST_GLOBAL_COLD_SW_MASK,
+					   prcm_offs,
+					   AM33XX_PRM_RSTCTRL_OFFSET);

This is not clean way of handling it, we should have something similar to omap4. Also we should use warm-reset here instead of cold.

Quoted 9 lines
Quoted 2 lines

I have quickly created patch, can you please review and test is? I have tested it on AM335x EVM and Bone platform.

Works for me as well, thanks!

You can take my

Thanks Daniel for confirming. I will send out this patch ASAP with your tested by.

Thanks,
Vaibhav