Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1731585 > unrolled thread

Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks

Started byNicolas Ferre <nicolas.ferre@microchip.com>
First post2017-09-13 14:30 +0200
Last post2017-09-14 11:40 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable  clocks Nicolas Ferre <nicolas.ferre@microchip.com> - 2017-09-13 14:30 +0200
    Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable  clocks Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-09-13 19:10 +0200
      Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks romain izard <romain.izard@mobile-devices.fr> - 2017-09-14 09:50 +0200
        Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable  clocks Nicolas Ferre <nicolas.ferre@microchip.com> - 2017-09-14 11:40 +0200

#1731585 — Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks

FromNicolas Ferre <nicolas.ferre@microchip.com>
Date2017-09-13 14:30 +0200
SubjectRe: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks
Message-ID<upeXM-7iZ-5@gated-at.bofh.it>
On 08/09/2017 at 17:35, Romain Izard wrote:
> From: Romain Izard <romain.izard@mobile-devices.fr>
> 
> Save and restore the System Clock and Programmable Clock register for
> the backup use case.

"System Clock" seems to be handled in another patch.

> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
> ---
>  drivers/clk/at91/pmc.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> index 07dc2861ad3f..5421b03553ec 100644
> --- a/drivers/clk/at91/pmc.c
> +++ b/drivers/clk/at91/pmc.c
> @@ -66,6 +66,7 @@ static struct
>  	u32 pcr[PMC_MAX_IDS];
>  	u32 audio_pll0;
>  	u32 audio_pll1;
> +	u32 pckr[3];

Some products have different numbers of PCK (only 2 on at91sam9x5 for
instance)...

>  } pmc_cache;
>  
>  void pmc_register_id(u8 id)
> @@ -103,6 +104,8 @@ static int pmc_suspend(void)
>  		regmap_read(pmcreg, AT91_PMC_PCR,
>  			    &pmc_cache.pcr[registered_ids[i]]);
>  	}
> +	for (i = 0; i < 3; i++)

And it might be a good practice to have this constant value in a #define.
We have "#define PROG_ID_MAX  7" defined in
drivers/clk/at91/clk-programmable.c.

Regards,


> +		regmap_read(pmcreg, AT91_PMC_PCKR(i), &pmc_cache.pckr[i]);
>  
>  	return 0;
>  }
> @@ -143,6 +146,8 @@ static void pmc_resume(void)
>  			     pmc_cache.pcr[registered_ids[i]] |
>  			     AT91_PMC_PCR_CMD);
>  	}
> +	for (i = 0; i < 3; i++)
> +		regmap_write(pmcreg, AT91_PMC_PCKR(i), pmc_cache.pckr[i]);
>  
>  	if (pmc_cache.uckr & AT91_PMC_UPLLEN)
>  		mask |= AT91_PMC_LOCKU;
> 


-- 
Nicolas Ferre

[toc] | [next] | [standalone]


#1731723

FromAlexandre Belloni <alexandre.belloni@free-electrons.com>
Date2017-09-13 19:10 +0200
Message-ID<upjkK-1Jw-19@gated-at.bofh.it>
In reply to#1731585
On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote:
> On 08/09/2017 at 17:35, Romain Izard wrote:
> > From: Romain Izard <romain.izard@mobile-devices.fr>
> > 
> > Save and restore the System Clock and Programmable Clock register for
> > the backup use case.
> 
> "System Clock" seems to be handled in another patch.
> 
> > Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
> > ---
> >  drivers/clk/at91/pmc.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
> > index 07dc2861ad3f..5421b03553ec 100644
> > --- a/drivers/clk/at91/pmc.c
> > +++ b/drivers/clk/at91/pmc.c
> > @@ -66,6 +66,7 @@ static struct
> >  	u32 pcr[PMC_MAX_IDS];
> >  	u32 audio_pll0;
> >  	u32 audio_pll1;
> > +	u32 pckr[3];
> 
> Some products have different numbers of PCK (only 2 on at91sam9x5 for
> instance)...
> 

My opinion is that it will be time to change that when multiple SoCs
will need to save their registers.


-- 
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1732083 — Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks

Fromromain izard <romain.izard@mobile-devices.fr>
Date2017-09-14 09:50 +0200
SubjectRe: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks
Message-ID<upx4n-293-7@gated-at.bofh.it>
In reply to#1731723
2017-09-13 19:03 GMT+02:00 Alexandre Belloni
<alexandre.belloni@free-electrons.com>:
> On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote:
>> On 08/09/2017 at 17:35, Romain Izard wrote:
>> > From: Romain Izard <romain.izard@mobile-devices.fr>
>> >
>> > Save and restore the System Clock and Programmable Clock register for
>> > the backup use case.
>>
>> "System Clock" seems to be handled in another patch.
>>
>> > Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
>> > ---
>> >  drivers/clk/at91/pmc.c | 5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
>> > index 07dc2861ad3f..5421b03553ec 100644
>> > --- a/drivers/clk/at91/pmc.c
>> > +++ b/drivers/clk/at91/pmc.c
>> > @@ -66,6 +66,7 @@ static struct
>> >     u32 pcr[PMC_MAX_IDS];
>> >     u32 audio_pll0;
>> >     u32 audio_pll1;
>> > +   u32 pckr[3];
>>
>> Some products have different numbers of PCK (only 2 on at91sam9x5 for
>> instance)...
>>
>
> My opinion is that it will be time to change that when multiple SoCs will
> need to save their registers.
>
For the next version, I'll add a #define. But as this code requires a
device tree node with the compatible string "atmel,sama5d2-pmc", I believe
that we can ignore other chips for now.


-- 
Romain Izard

[toc] | [prev] | [next] | [standalone]


#1732142

FromNicolas Ferre <nicolas.ferre@microchip.com>
Date2017-09-14 11:40 +0200
Message-ID<upyMN-3f8-5@gated-at.bofh.it>
In reply to#1732083
On 14/09/2017 at 09:41, romain izard wrote:
> 2017-09-13 19:03 GMT+02:00 Alexandre Belloni
> <alexandre.belloni@free-electrons.com>:
>> On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote:
>>> On 08/09/2017 at 17:35, Romain Izard wrote:
>>>> From: Romain Izard <romain.izard@mobile-devices.fr>
>>>>
>>>> Save and restore the System Clock and Programmable Clock register for
>>>> the backup use case.
>>>
>>> "System Clock" seems to be handled in another patch.
>>>
>>>> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
>>>> ---
>>>>  drivers/clk/at91/pmc.c | 5 +++++
>>>>  1 file changed, 5 insertions(+)
>>>>
>>>> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
>>>> index 07dc2861ad3f..5421b03553ec 100644
>>>> --- a/drivers/clk/at91/pmc.c
>>>> +++ b/drivers/clk/at91/pmc.c
>>>> @@ -66,6 +66,7 @@ static struct
>>>>     u32 pcr[PMC_MAX_IDS];
>>>>     u32 audio_pll0;
>>>>     u32 audio_pll1;
>>>> +   u32 pckr[3];
>>>
>>> Some products have different numbers of PCK (only 2 on at91sam9x5 for
>>> instance)...
>>>
>>
>> My opinion is that it will be time to change that when multiple SoCs will
>> need to save their registers.
>>
> For the next version, I'll add a #define. But as this code requires a
> device tree node with the compatible string "atmel,sama5d2-pmc", I believe
> that we can ignore other chips for now.

Fair enough, let's go for this.

Bye,
-- 
Nicolas Ferre

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web