All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] MIPS: lantiq: implement support for FALCON soc
@ 2016-07-13 15:51 Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-07-13 15:51 UTC (permalink / raw)
  To: blogic; +Cc: linux-mips

Hello John Crispin,

The patch d41ced01f21d: "MIPS: lantiq: implement support for FALCON
soc" from Apr 19, 2012, leads to the following static checker warning:

	arch/mips/lantiq/falcon/sysctrl.c:152 falcon_gpe_enable()
	warn: mask and shift to zero

arch/mips/lantiq/falcon/sysctrl.c
   140  /* enable the ONU core */
   141  static void falcon_gpe_enable(void)
   142  {
   143          unsigned int freq;
   144          unsigned int status;
   145  
   146          /* if if the clock is already enabled */
   147          status = sysctl_r32(SYSCTL_SYS1, SYS1_INFRAC);
   148          if (status & (1 << (GPPC_OFFSET + 1)))
   149                  return;
   150  
   151          freq = (status_r32(STATUS_CONFIG) &
   152                  GPEFREQ_MASK) >>
   153                  GPEFREQ_OFFSET;

This is 0xC0 >> 10 which is always zero.

   154          if (freq == 0)
   155                  freq = 1; /* use 625MHz on unfused chip */
   156  
   157          /* apply new frequency */
   158          sysctl_w32_mask(SYSCTL_SYS1, 7 << (GPPC_OFFSET + 1),
   159                  freq << (GPPC_OFFSET + 2) , SYS1_INFRAC);
   160          udelay(1);
   161  
   162          /* enable new frequency */
   163          sysctl_w32_mask(SYSCTL_SYS1, 0, 1 << (GPPC_OFFSET + 1), SYS1_INFRAC);
   164          udelay(1);
   165  }

regards,
dan carpenter

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

* [bug report] MIPS: lantiq: implement support for FALCON soc
@ 2016-12-07 20:04 Dan Carpenter
  2016-12-07 20:35 ` John Crispin
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-12-07 20:04 UTC (permalink / raw)
  To: blogic; +Cc: linux-mips

Hello John Crispin,

The patch d41ced01f21d: "MIPS: lantiq: implement support for FALCON
soc" from Apr 19, 2012, leads to the following static checker warning:

	arch/mips/lantiq/falcon/sysctrl.c:152 falcon_gpe_enable()
	warn: mask and shift to zero

arch/mips/lantiq/falcon/sysctrl.c
   140  /* enable the ONU core */
   141  static void falcon_gpe_enable(void)
   142  {
   143          unsigned int freq;
   144          unsigned int status;
   145  
   146          /* if if the clock is already enabled */
   147          status = sysctl_r32(SYSCTL_SYS1, SYS1_INFRAC);
   148          if (status & (1 << (GPPC_OFFSET + 1)))
   149                  return;
   150  
   151          freq = (status_r32(STATUS_CONFIG) &
   152                  GPEFREQ_MASK) >>
   153                  GPEFREQ_OFFSET;

The mask is 0xC0 and we >> 10 which means that freq is always zero.

   154          if (freq == 0)
   155                  freq = 1; /* use 625MHz on unfused chip */

So we always use 625MHz.

   156  
   157          /* apply new frequency */
   158          sysctl_w32_mask(SYSCTL_SYS1, 7 << (GPPC_OFFSET + 1),
   159                  freq << (GPPC_OFFSET + 2) , SYS1_INFRAC);
   160          udelay(1);
   161  
   162          /* enable new frequency */
   163          sysctl_w32_mask(SYSCTL_SYS1, 0, 1 << (GPPC_OFFSET + 1), SYS1_INFRAC);
   164          udelay(1);
   165  }

regards,
dan carpenter

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

* Re: [bug report] MIPS: lantiq: implement support for FALCON soc
  2016-12-07 20:04 [bug report] MIPS: lantiq: implement support for FALCON soc Dan Carpenter
@ 2016-12-07 20:35 ` John Crispin
  0 siblings, 0 replies; 3+ messages in thread
From: John Crispin @ 2016-12-07 20:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linux-mips, Hauke Mehrtens



On 07/12/2016 21:04, Dan Carpenter wrote:
> Hello John Crispin,
> 
> The patch d41ced01f21d: "MIPS: lantiq: implement support for FALCON
> soc" from Apr 19, 2012, leads to the following static checker warning:
> 
> 	arch/mips/lantiq/falcon/sysctrl.c:152 falcon_gpe_enable()
> 	warn: mask and shift to zero
> 
> arch/mips/lantiq/falcon/sysctrl.c
>    140  /* enable the ONU core */
>    141  static void falcon_gpe_enable(void)
>    142  {
>    143          unsigned int freq;
>    144          unsigned int status;
>    145  
>    146          /* if if the clock is already enabled */
>    147          status = sysctl_r32(SYSCTL_SYS1, SYS1_INFRAC);
>    148          if (status & (1 << (GPPC_OFFSET + 1)))
>    149                  return;
>    150  
>    151          freq = (status_r32(STATUS_CONFIG) &
>    152                  GPEFREQ_MASK) >>
>    153                  GPEFREQ_OFFSET;
> 
> The mask is 0xC0 and we >> 10 which means that freq is always zero.
> 
>    154          if (freq == 0)
>    155                  freq = 1; /* use 625MHz on unfused chip */
> 
> So we always use 625MHz.
> 
>    156  
>    157          /* apply new frequency */
>    158          sysctl_w32_mask(SYSCTL_SYS1, 7 << (GPPC_OFFSET + 1),
>    159                  freq << (GPPC_OFFSET + 2) , SYS1_INFRAC);
>    160          udelay(1);
>    161  
>    162          /* enable new frequency */
>    163          sysctl_w32_mask(SYSCTL_SYS1, 0, 1 << (GPPC_OFFSET + 1), SYS1_INFRAC);
>    164          udelay(1);
>    165  }
> 
> regards,
> dan carpenter
> 


Hi Dan,

thanks, I've added Hauke in CC. he works for Lantiq and has been taking
care of the code recently.

	John

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

end of thread, other threads:[~2016-12-07 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-07 20:04 [bug report] MIPS: lantiq: implement support for FALCON soc Dan Carpenter
2016-12-07 20:35 ` John Crispin
  -- strict thread matches above, loose matches on Subject: below --
2016-07-13 15:51 Dan Carpenter

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.