Skip to content

Commit b98ad40

Browse files
committed
Merge tag 'omap-for-v6.9/soc-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into soc/arm
Few more SoC changes for omaps Two changes to implement REBOOT_COLD for am335x. * tag 'omap-for-v6.9/soc-part2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: ARM: AM33xx: PRM: Implement REBOOT_COLD ARM: AM33xx: PRM: Remove redundand defines Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents dd0907f + 6521f6a commit b98ad40

File tree

6 files changed

+30
-9
lines changed

6 files changed

+30
-9
lines changed

arch/arm/mach-omap2/am33xx-restart.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
*/
1919
void am33xx_restart(enum reboot_mode mode, const char *cmd)
2020
{
21-
/* TODO: Handle mode and cmd if necessary */
21+
/* TODO: Handle cmd if necessary */
22+
prm_reboot_mode = mode;
2223

2324
omap_prm_reset_system();
2425
}

arch/arm/mach-omap2/board-generic.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,12 @@ DT_MACHINE_START(AM33XX_DT, "Generic AM33XX (Flattened Device Tree)")
246246
.init_time = omap_init_time_of,
247247
.dt_compat = am33xx_boards_compat,
248248
.restart = am33xx_restart,
249+
/*
250+
* Historically am33xx supported only REBOOT_WARM even though default
251+
* reboot_mode was REBOOT_COLD. Reflect legacy de-facto behaviour in
252+
* SYSFS.
253+
*/
254+
.reboot_mode = REBOOT_WARM,
249255
MACHINE_END
250256
#endif
251257

arch/arm/mach-omap2/prm-regbits-33xx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#define AM33XX_GFX_MEM_STATEST_MASK (0x3 << 4)
1616
#define AM33XX_GLOBAL_WARM_SW_RST_MASK (1 << 1)
1717
#define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0)
18+
#define AM33XX_RST_GLOBAL_COLD_SW_MASK (1 << 1)
1819
#define AM33XX_PRUSS_MEM_ONSTATE_MASK (0x3 << 5)
1920
#define AM33XX_PRUSS_MEM_RETSTATE_MASK (1 << 7)
2021
#define AM33XX_PRUSS_MEM_STATEST_MASK (0x3 << 23)

arch/arm/mach-omap2/prm.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
# ifndef __ASSEMBLER__
1616
extern struct omap_domain_base prm_base;
1717
extern u16 prm_features;
18+
extern enum reboot_mode prm_reboot_mode;
1819
int omap_prcm_init(void);
1920
int omap2_prcm_base_init(void);
2021
# endif

arch/arm/mach-omap2/prm33xx.c

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,12 @@
1010
#include <linux/errno.h>
1111
#include <linux/err.h>
1212
#include <linux/io.h>
13+
#include <linux/reboot.h>
1314

1415
#include "powerdomain.h"
1516
#include "prm33xx.h"
1617
#include "prm-regbits-33xx.h"
1718

18-
#define AM33XX_PRM_RSTCTRL_OFFSET 0x0000
19-
20-
#define AM33XX_RST_GLOBAL_WARM_SW_MASK (1 << 0)
21-
2219
/* Read a register in a PRM instance */
2320
static u32 am33xx_prm_read_reg(s16 inst, u16 idx)
2421
{
@@ -322,10 +319,19 @@ static int am33xx_check_vcvp(void)
322319
*
323320
* Immediately reboots the device through warm reset.
324321
*/
325-
static void am33xx_prm_global_warm_sw_reset(void)
322+
static void am33xx_prm_global_sw_reset(void)
326323
{
327-
am33xx_prm_rmw_reg_bits(AM33XX_RST_GLOBAL_WARM_SW_MASK,
328-
AM33XX_RST_GLOBAL_WARM_SW_MASK,
324+
/*
325+
* Historically AM33xx performed warm reset for all requested reboot_mode.
326+
* Keep this behaviour unchanged for all except newly added REBOOT_COLD.
327+
*/
328+
u32 mask = AM33XX_RST_GLOBAL_WARM_SW_MASK;
329+
330+
if (prm_reboot_mode == REBOOT_COLD)
331+
mask = AM33XX_RST_GLOBAL_COLD_SW_MASK;
332+
333+
am33xx_prm_rmw_reg_bits(mask,
334+
mask,
329335
AM33XX_PRM_DEVICE_MOD,
330336
AM33XX_PRM_RSTCTRL_OFFSET);
331337

@@ -386,7 +392,7 @@ static struct prm_ll_data am33xx_prm_ll_data = {
386392
.assert_hardreset = am33xx_prm_assert_hardreset,
387393
.deassert_hardreset = am33xx_prm_deassert_hardreset,
388394
.is_hardreset_asserted = am33xx_prm_is_hardreset_asserted,
389-
.reset_system = am33xx_prm_global_warm_sw_reset,
395+
.reset_system = am33xx_prm_global_sw_reset,
390396
};
391397

392398
int __init am33xx_prm_init(const struct omap_prcm_init_data *data)

arch/arm/mach-omap2/prm_common.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ struct omap_domain_base prm_base;
6666

6767
u16 prm_features;
6868

69+
/*
70+
* Platforms that implement different reboot modes can store the requested
71+
* mode here.
72+
*/
73+
enum reboot_mode prm_reboot_mode;
74+
6975
/*
7076
* prm_ll_data: function pointers to SoC-specific implementations of
7177
* common PRM functions

0 commit comments

Comments
 (0)