All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] power: reset: ocelot: switch the SI to boot mode
@ 2018-11-09 19:57 Alexandre Belloni
  2018-12-05 21:46 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Belloni @ 2018-11-09 19:57 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: UNGLinuxDriver, linux-pm, linux-kernel, Alexandre Belloni

Switch the SI to boot mode so on a warm reboot, the SI is able to access
the flash.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/power/reset/ocelot-reset.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/power/reset/ocelot-reset.c b/drivers/power/reset/ocelot-reset.c
index 5a13a5cc8188..419952c61fd0 100644
--- a/drivers/power/reset/ocelot-reset.c
+++ b/drivers/power/reset/ocelot-reset.c
@@ -26,6 +26,13 @@ struct ocelot_reset_context {
 
 #define SOFT_CHIP_RST BIT(0)
 
+#define ICPU_CFG_CPU_SYSTEM_CTRL_GENERAL_CTRL	0x24
+#define IF_SI_OWNER_MASK			GENMASK(1, 0)
+#define IF_SI_OWNER_SISL			0
+#define IF_SI_OWNER_SIBM			1
+#define IF_SI_OWNER_SIMC			2
+#define IF_SI_OWNER_OFFSET			4
+
 static int ocelot_restart_handle(struct notifier_block *this,
 				 unsigned long mode, void *cmd)
 {
@@ -37,6 +44,11 @@ static int ocelot_restart_handle(struct notifier_block *this,
 	regmap_update_bits(ctx->cpu_ctrl, ICPU_CFG_CPU_SYSTEM_CTRL_RESET,
 			   CORE_RST_PROTECT, 0);
 
+	/* Make the SI back to boot mode */
+	regmap_update_bits(ctx->cpu_ctrl, ICPU_CFG_CPU_SYSTEM_CTRL_GENERAL_CTRL,
+			   IF_SI_OWNER_MASK << IF_SI_OWNER_OFFSET,
+			   IF_SI_OWNER_SIBM << IF_SI_OWNER_OFFSET);
+
 	writel(SOFT_CHIP_RST, ctx->base);
 
 	pr_emerg("Unable to restart system\n");
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] power: reset: ocelot: switch the SI to boot mode
  2018-11-09 19:57 [PATCH] power: reset: ocelot: switch the SI to boot mode Alexandre Belloni
@ 2018-12-05 21:46 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2018-12-05 21:46 UTC (permalink / raw)
  To: Alexandre Belloni; +Cc: UNGLinuxDriver, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1571 bytes --]

Hi,

On Fri, Nov 09, 2018 at 08:57:00PM +0100, Alexandre Belloni wrote:
> Switch the SI to boot mode so on a warm reboot, the SI is able to access
> the flash.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/reset/ocelot-reset.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/drivers/power/reset/ocelot-reset.c b/drivers/power/reset/ocelot-reset.c
> index 5a13a5cc8188..419952c61fd0 100644
> --- a/drivers/power/reset/ocelot-reset.c
> +++ b/drivers/power/reset/ocelot-reset.c
> @@ -26,6 +26,13 @@ struct ocelot_reset_context {
>  
>  #define SOFT_CHIP_RST BIT(0)
>  
> +#define ICPU_CFG_CPU_SYSTEM_CTRL_GENERAL_CTRL	0x24
> +#define IF_SI_OWNER_MASK			GENMASK(1, 0)
> +#define IF_SI_OWNER_SISL			0
> +#define IF_SI_OWNER_SIBM			1
> +#define IF_SI_OWNER_SIMC			2
> +#define IF_SI_OWNER_OFFSET			4
> +
>  static int ocelot_restart_handle(struct notifier_block *this,
>  				 unsigned long mode, void *cmd)
>  {
> @@ -37,6 +44,11 @@ static int ocelot_restart_handle(struct notifier_block *this,
>  	regmap_update_bits(ctx->cpu_ctrl, ICPU_CFG_CPU_SYSTEM_CTRL_RESET,
>  			   CORE_RST_PROTECT, 0);
>  
> +	/* Make the SI back to boot mode */
> +	regmap_update_bits(ctx->cpu_ctrl, ICPU_CFG_CPU_SYSTEM_CTRL_GENERAL_CTRL,
> +			   IF_SI_OWNER_MASK << IF_SI_OWNER_OFFSET,
> +			   IF_SI_OWNER_SIBM << IF_SI_OWNER_OFFSET);
> +
>  	writel(SOFT_CHIP_RST, ctx->base);
>  
>  	pr_emerg("Unable to restart system\n");
> -- 
> 2.19.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-05 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09 19:57 [PATCH] power: reset: ocelot: switch the SI to boot mode Alexandre Belloni
2018-12-05 21:46 ` Sebastian Reichel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.