public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] MIPS: mips-cm: CM regions are disabled at boot
@ 2014-11-20 12:29 Niklas Svensson
  2014-11-20 12:34 ` Paul Burton
  0 siblings, 1 reply; 4+ messages in thread
From: Niklas Svensson @ 2014-11-20 12:29 UTC (permalink / raw)
  To: ralf, paul.burton; +Cc: linux-mips, linux-kernel, Niklas Svensson

Each CM_REGION_TARGET is set to disabled at boot,
so there is no need to disable the matching
CM_GCR_REG explicitly.

Signed-off-by: Niklas Svensson <niklass@axis.com>
---
 arch/mips/kernel/mips-cm.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c
index f76f7a0..a4bbfd9 100644
--- a/arch/mips/kernel/mips-cm.c
+++ b/arch/mips/kernel/mips-cm.c
@@ -104,16 +104,6 @@ int mips_cm_probe(void)
 	base_reg |= CM_GCR_BASE_CMDEFTGT_MEM;
 	write_gcr_base(base_reg);
 
-	/* disable CM regions */
-	write_gcr_reg0_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
-	write_gcr_reg0_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
-	write_gcr_reg1_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
-	write_gcr_reg1_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
-	write_gcr_reg2_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
-	write_gcr_reg2_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
-	write_gcr_reg3_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
-	write_gcr_reg3_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
-
 	/* probe for an L2-only sync region */
 	mips_cm_probe_l2sync();
 
-- 
2.1.3


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

* Re: [PATCH] MIPS: mips-cm: CM regions are disabled at boot
  2014-11-20 12:29 [PATCH] MIPS: mips-cm: CM regions are disabled at boot Niklas Svensson
@ 2014-11-20 12:34 ` Paul Burton
  2014-11-20 13:57   ` Niklas Svensson
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Burton @ 2014-11-20 12:34 UTC (permalink / raw)
  To: Niklas Svensson; +Cc: ralf, linux-mips, linux-kernel, Niklas Svensson

On Thu, Nov 20, 2014 at 01:29:00PM +0100, Niklas Svensson wrote:
> Each CM_REGION_TARGET is set to disabled at boot,

That part is true...

> so there is no need to disable the matching
> CM_GCR_REG explicitly.

...however there is no guarantee that the bootloader, or another kernel,
or some other piece of code didn't program the registers differently
before Linux starts. So I believe this patch to be incorrect.

Thanks,
    Paul

> 
> Signed-off-by: Niklas Svensson <niklass@axis.com>
> ---
>  arch/mips/kernel/mips-cm.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c
> index f76f7a0..a4bbfd9 100644
> --- a/arch/mips/kernel/mips-cm.c
> +++ b/arch/mips/kernel/mips-cm.c
> @@ -104,16 +104,6 @@ int mips_cm_probe(void)
>  	base_reg |= CM_GCR_BASE_CMDEFTGT_MEM;
>  	write_gcr_base(base_reg);
>  
> -	/* disable CM regions */
> -	write_gcr_reg0_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
> -	write_gcr_reg0_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
> -	write_gcr_reg1_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
> -	write_gcr_reg1_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
> -	write_gcr_reg2_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
> -	write_gcr_reg2_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
> -	write_gcr_reg3_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
> -	write_gcr_reg3_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
> -
>  	/* probe for an L2-only sync region */
>  	mips_cm_probe_l2sync();
>  
> -- 
> 2.1.3
> 

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

* Re: [PATCH] MIPS: mips-cm: CM regions are disabled at boot
  2014-11-20 12:34 ` Paul Burton
@ 2014-11-20 13:57   ` Niklas Svensson
  2014-11-20 15:17     ` Ralf Baechle
  0 siblings, 1 reply; 4+ messages in thread
From: Niklas Svensson @ 2014-11-20 13:57 UTC (permalink / raw)
  To: Paul Burton
  Cc: ralf@linux-mips.org, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org

On 11/20/2014 01:34 PM, Paul Burton wrote:
> On Thu, Nov 20, 2014 at 01:29:00PM +0100, Niklas Svensson wrote:
>> Each CM_REGION_TARGET is set to disabled at boot,
> 
> That part is true...
> 
>> so there is no need to disable the matching
>> CM_GCR_REG explicitly.
> 
> ...however there is no guarantee that the bootloader, or another kernel,
> or some other piece of code didn't program the registers differently
> before Linux starts. So I believe this patch to be incorrect.


That is the reason for this patch. This will overwrite settings written by the bootloader.

Say if the bootloader sets up an iocu, then these writes will clear those settings.

> 
> Thanks,
>     Paul
> 
>>
>> Signed-off-by: Niklas Svensson <niklass@axis.com>
>> ---
>>  arch/mips/kernel/mips-cm.c | 10 ----------
>>  1 file changed, 10 deletions(-)
>>
>> diff --git a/arch/mips/kernel/mips-cm.c b/arch/mips/kernel/mips-cm.c
>> index f76f7a0..a4bbfd9 100644
>> --- a/arch/mips/kernel/mips-cm.c
>> +++ b/arch/mips/kernel/mips-cm.c
>> @@ -104,16 +104,6 @@ int mips_cm_probe(void)
>>  	base_reg |= CM_GCR_BASE_CMDEFTGT_MEM;
>>  	write_gcr_base(base_reg);
>>  
>> -	/* disable CM regions */
>> -	write_gcr_reg0_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
>> -	write_gcr_reg0_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
>> -	write_gcr_reg1_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
>> -	write_gcr_reg1_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
>> -	write_gcr_reg2_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
>> -	write_gcr_reg2_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
>> -	write_gcr_reg3_base(CM_GCR_REGn_BASE_BASEADDR_MSK);
>> -	write_gcr_reg3_mask(CM_GCR_REGn_MASK_ADDRMASK_MSK);
>> -
>>  	/* probe for an L2-only sync region */
>>  	mips_cm_probe_l2sync();
>>  
>> -- 
>> 2.1.3
>>


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

* Re: [PATCH] MIPS: mips-cm: CM regions are disabled at boot
  2014-11-20 13:57   ` Niklas Svensson
@ 2014-11-20 15:17     ` Ralf Baechle
  0 siblings, 0 replies; 4+ messages in thread
From: Ralf Baechle @ 2014-11-20 15:17 UTC (permalink / raw)
  To: Niklas Svensson
  Cc: Paul Burton, linux-mips@linux-mips.org,
	linux-kernel@vger.kernel.org

On Thu, Nov 20, 2014 at 02:57:40PM +0100, Niklas Svensson wrote:

> On 11/20/2014 01:34 PM, Paul Burton wrote:
> > On Thu, Nov 20, 2014 at 01:29:00PM +0100, Niklas Svensson wrote:
> >> Each CM_REGION_TARGET is set to disabled at boot,
> > 
> > That part is true...
> > 
> >> so there is no need to disable the matching
> >> CM_GCR_REG explicitly.
> > 
> > ...however there is no guarantee that the bootloader, or another kernel,
> > or some other piece of code didn't program the registers differently
> > before Linux starts. So I believe this patch to be incorrect.
> 
> 
> That is the reason for this patch. This will overwrite settings written by the bootloader.
> 
> Say if the bootloader sets up an iocu, then these writes will clear those settings.

The kernel has to be firmware agnostic, can't know how these registers have
been initialized as long as there is no proper boot protocol for the
handover to the kernel which includes this status.  At this point I think a
solution that hands over the required information as part of the DT is
probably the way to go.

  Ralf

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

end of thread, other threads:[~2014-11-20 15:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-20 12:29 [PATCH] MIPS: mips-cm: CM regions are disabled at boot Niklas Svensson
2014-11-20 12:34 ` Paul Burton
2014-11-20 13:57   ` Niklas Svensson
2014-11-20 15:17     ` Ralf Baechle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox