2018-01-04 07:29:03

by Anson Huang

[permalink] [raw]
Subject: [PATCH 1/2] clk: imx: imx7d: add the snvs clock

According to the i.MX7D Reference Manual,
SNVS block has a clock gate, accessing SNVS block
would need this clock gate to be enabled, add it
into clock tree so that SNVS module driver can
operate this clock gate.

Signed-off-by: Anson Huang <[email protected]>
---
drivers/clk/imx/clk-imx7d.c | 1 +
include/dt-bindings/clock/imx7d-clock.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/imx/clk-imx7d.c b/drivers/clk/imx/clk-imx7d.c
index 992938b..a284c6f 100644
--- a/drivers/clk/imx/clk-imx7d.c
+++ b/drivers/clk/imx/clk-imx7d.c
@@ -799,6 +799,7 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node)
clks[IMX7D_DRAM_PHYM_ALT_ROOT_CLK] = imx_clk_gate4("dram_phym_alt_root_clk", "dram_phym_alt_post_div", base + 0x4130, 0);
clks[IMX7D_DRAM_ALT_ROOT_CLK] = imx_clk_gate4("dram_alt_root_clk", "dram_alt_post_div", base + 0x4130, 0);
clks[IMX7D_OCOTP_CLK] = imx_clk_gate4("ocotp_clk", "ipg_root_clk", base + 0x4230, 0);
+ clks[IMX7D_SNVS_CLK] = imx_clk_gate4("snvs_clk", "ipg_root_clk", base + 0x4250, 0);
clks[IMX7D_USB_HSIC_ROOT_CLK] = imx_clk_gate4("usb_hsic_root_clk", "usb_hsic_post_div", base + 0x4420, 0);
clks[IMX7D_SDMA_CORE_CLK] = imx_clk_gate4("sdma_root_clk", "ahb_root_clk", base + 0x4480, 0);
clks[IMX7D_PCIE_CTRL_ROOT_CLK] = imx_clk_gate4("pcie_ctrl_root_clk", "pcie_ctrl_post_div", base + 0x4600, 0);
diff --git a/include/dt-bindings/clock/imx7d-clock.h b/include/dt-bindings/clock/imx7d-clock.h
index e2f99ae..dc51904 100644
--- a/include/dt-bindings/clock/imx7d-clock.h
+++ b/include/dt-bindings/clock/imx7d-clock.h
@@ -452,5 +452,6 @@
#define IMX7D_OCOTP_CLK 439
#define IMX7D_NAND_RAWNAND_CLK 440
#define IMX7D_NAND_USDHC_BUS_RAWNAND_CLK 441
-#define IMX7D_CLK_END 442
+#define IMX7D_SNVS_CLK 442
+#define IMX7D_CLK_END 443
#endif /* __DT_BINDINGS_CLOCK_IMX7D_H */
--
1.9.1


2018-01-04 07:29:08

by Anson Huang

[permalink] [raw]
Subject: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

Add i.MX7 SNVS RTC clock.

Signed-off-by: Anson Huang <[email protected]>
---
arch/arm/boot/dts/imx7s.dtsi | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
index e718fd2..f9b97f3 100644
--- a/arch/arm/boot/dts/imx7s.dtsi
+++ b/arch/arm/boot/dts/imx7s.dtsi
@@ -534,6 +534,8 @@
offset = <0x34>;
interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&clks IMX7D_SNVS_CLK>;
+ clock-names = "snvs-rtc";
};

snvs_poweroff: snvs-poweroff {
--
1.9.1

2018-01-04 13:01:02

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk: imx: imx7d: add the snvs clock

On Thu, Jan 4, 2018 at 1:06 PM, Anson Huang <[email protected]> wrote:
> According to the i.MX7D Reference Manual,
> SNVS block has a clock gate, accessing SNVS block
> would need this clock gate to be enabled, add it
> into clock tree so that SNVS module driver can
> operate this clock gate.
>
> Signed-off-by: Anson Huang <[email protected]>

Reviewed-by: Fabio Estevam <[email protected]>

2018-01-04 13:09:34

by Fabio Estevam

[permalink] [raw]
Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

On Thu, Jan 4, 2018 at 1:06 PM, Anson Huang <[email protected]> wrote:
> Add i.MX7 SNVS RTC clock.
>
> Signed-off-by: Anson Huang <[email protected]>

Reviewed-by: Fabio Estevam <[email protected]>

2018-01-08 10:33:55

by Dong Aisheng

[permalink] [raw]
Subject: Re: [PATCH 1/2] clk: imx: imx7d: add the snvs clock

On Thu, Jan 04, 2018 at 11:06:41PM +0800, Anson Huang wrote:
> According to the i.MX7D Reference Manual,
> SNVS block has a clock gate, accessing SNVS block
> would need this clock gate to be enabled, add it
> into clock tree so that SNVS module driver can
> operate this clock gate.
>
> Signed-off-by: Anson Huang <[email protected]>

Acked-by: Dong Aisheng <[email protected]>

Regards
Dong Aisheng

2018-01-08 10:39:28

by Dong Aisheng

[permalink] [raw]
Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

On Thu, Jan 04, 2018 at 11:06:42PM +0800, Anson Huang wrote:
> Add i.MX7 SNVS RTC clock.
>
> Signed-off-by: Anson Huang <[email protected]>

If this clock IMX7D_SNVS_CLK is used for all SNVS sub modules,
then snvs_poweroff and snvs_pwrkey should also rely on it, right?

How about add them all in one time?

BTW, syscon-poweroff seems still not introduce clock support and
fsl,sec-v4.0-pwrkey also does not handle clock, they may need to
be added later.

Regards
Dong Aisheng

> ---
> arch/arm/boot/dts/imx7s.dtsi | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/arch/arm/boot/dts/imx7s.dtsi b/arch/arm/boot/dts/imx7s.dtsi
> index e718fd2..f9b97f3 100644
> --- a/arch/arm/boot/dts/imx7s.dtsi
> +++ b/arch/arm/boot/dts/imx7s.dtsi
> @@ -534,6 +534,8 @@
> offset = <0x34>;
> interrupts = <GIC_SPI 19 IRQ_TYPE_LEVEL_HIGH>,
> <GIC_SPI 20 IRQ_TYPE_LEVEL_HIGH>;
> + clocks = <&clks IMX7D_SNVS_CLK>;
> + clock-names = "snvs-rtc";
> };
>
> snvs_poweroff: snvs-poweroff {
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-clk" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2018-01-09 01:43:40

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock



Best Regards!
Anson Huang


> -----Original Message-----
> From: Dong Aisheng [mailto:[email protected]]
> Sent: 2018-01-08 6:39 PM
> To: Anson Huang <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; [email protected]; dl-linux-imx <linux-
> [email protected]>; [email protected]; [email protected]; Fabio
> Estevam <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock
>
> On Thu, Jan 04, 2018 at 11:06:42PM +0800, Anson Huang wrote:
> > Add i.MX7 SNVS RTC clock.
> >
> > Signed-off-by: Anson Huang <[email protected]>
>
> If this clock IMX7D_SNVS_CLK is used for all SNVS sub modules, then
> snvs_poweroff and snvs_pwrkey should also rely on it, right?
>
> How about add them all in one time?
>
> BTW, syscon-poweroff seems still not introduce clock support and fsl,sec-v4.0-
> pwrkey also does not handle clock, they may need to be added later.
>
> Regards
> Dong Aisheng

Yes, I thought about it before sending patch, but currently the poweroff and pwrkey driver do NOT
handle clocks, so I plan to add them later, including handling clocks in driver and dtb.

Anson

>
> > ---
> > arch/arm/boot/dts/imx7s.dtsi | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/imx7s.dtsi
> > b/arch/arm/boot/dts/imx7s.dtsi index e718fd2..f9b97f3 100644
> > --- a/arch/arm/boot/dts/imx7s.dtsi
> > +++ b/arch/arm/boot/dts/imx7s.dtsi
> > @@ -534,6 +534,8 @@
> > offset = <0x34>;
> > interrupts = <GIC_SPI 19
> IRQ_TYPE_LEVEL_HIGH>,
> > <GIC_SPI 20
> IRQ_TYPE_LEVEL_HIGH>;
> > + clocks = <&clks IMX7D_SNVS_CLK>;
> > + clock-names = "snvs-rtc";
> > };
> >
> > snvs_poweroff: snvs-poweroff {
> > --
> > 1.9.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-clk"
> > in the body of a message to [email protected] More majordomo
> > info at
> > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger
> > .kernel.org%2Fmajordomo-
> info.html&data=02%7C01%7CAnson.Huang%40nxp.com
> > %7Cd10ff23b822b4cd16c2708d5568417c6%7C686ea1d3bc2b4c6fa92cd99c5c30
> 1635
> > %7C0%7C0%7C636510047707248763&sdata=FMx22hfKxs7YA%2F1zCVeYCnVX
> 9Ck4MmB9
> > GuolA51V2eg%3D&reserved=0

2018-01-09 02:17:17

by Dong Aisheng

[permalink] [raw]
Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock

On Tue, Jan 09, 2018 at 01:43:25AM +0000, Anson Huang wrote:
>
>
> Best Regards!
> Anson Huang
>
>
> > -----Original Message-----
> > From: Dong Aisheng [mailto:[email protected]]
> > Sent: 2018-01-08 6:39 PM
> > To: Anson Huang <[email protected]>
> > Cc: [email protected]; [email protected]; linux-
> > [email protected]; [email protected]; dl-linux-imx <linux-
> > [email protected]>; [email protected]; [email protected]; Fabio
> > Estevam <[email protected]>; [email protected];
> > [email protected]; [email protected]; [email protected];
> > [email protected]; [email protected]
> > Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock
> >
> > On Thu, Jan 04, 2018 at 11:06:42PM +0800, Anson Huang wrote:
> > > Add i.MX7 SNVS RTC clock.
> > >
> > > Signed-off-by: Anson Huang <[email protected]>
> >
> > If this clock IMX7D_SNVS_CLK is used for all SNVS sub modules, then
> > snvs_poweroff and snvs_pwrkey should also rely on it, right?
> >
> > How about add them all in one time?
> >
> > BTW, syscon-poweroff seems still not introduce clock support and fsl,sec-v4.0-
> > pwrkey also does not handle clock, they may need to be added later.
> >
> > Regards
> > Dong Aisheng
>
> Yes, I thought about it before sending patch, but currently the poweroff and pwrkey driver do NOT
> handle clocks, so I plan to add them later, including handling clocks in driver and dtb.
>

SNVS RTC binding doc does not claim a optional clock support, you probably may
need update the binding doc as well.

BTW, Should mx6 platforms need the same fixes?
If yes, we'd better fix them all.

Regards
Dong Aisheng

> Anson
>
> >
> > > ---
> > > arch/arm/boot/dts/imx7s.dtsi | 2 ++
> > > 1 file changed, 2 insertions(+)
> > >
> > > diff --git a/arch/arm/boot/dts/imx7s.dtsi
> > > b/arch/arm/boot/dts/imx7s.dtsi index e718fd2..f9b97f3 100644
> > > --- a/arch/arm/boot/dts/imx7s.dtsi
> > > +++ b/arch/arm/boot/dts/imx7s.dtsi
> > > @@ -534,6 +534,8 @@
> > > offset = <0x34>;
> > > interrupts = <GIC_SPI 19
> > IRQ_TYPE_LEVEL_HIGH>,
> > > <GIC_SPI 20
> > IRQ_TYPE_LEVEL_HIGH>;
> > > + clocks = <&clks IMX7D_SNVS_CLK>;
> > > + clock-names = "snvs-rtc";
> > > };
> > >
> > > snvs_poweroff: snvs-poweroff {
> > > --
> > > 1.9.1
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-clk"
> > > in the body of a message to [email protected] More majordomo
> > > info at
> > > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fvger
> > > .kernel.org%2Fmajordomo-
> > info.html&data=02%7C01%7CAnson.Huang%40nxp.com
> > > %7Cd10ff23b822b4cd16c2708d5568417c6%7C686ea1d3bc2b4c6fa92cd99c5c30
> > 1635
> > > %7C0%7C0%7C636510047707248763&sdata=FMx22hfKxs7YA%2F1zCVeYCnVX
> > 9Ck4MmB9
> > > GuolA51V2eg%3D&reserved=0

2018-01-09 02:21:04

by Anson Huang

[permalink] [raw]
Subject: RE: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock



Best Regards!
Anson Huang


> -----Original Message-----
> From: Dong Aisheng [mailto:[email protected]]
> Sent: 2018-01-09 10:17 AM
> To: Anson Huang <[email protected]>
> Cc: [email protected]; [email protected]; linux-
> [email protected]; [email protected]; dl-linux-imx <linux-
> [email protected]>; [email protected]; [email protected]; Fabio
> Estevam <[email protected]>; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]
> Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock
>
> On Tue, Jan 09, 2018 at 01:43:25AM +0000, Anson Huang wrote:
> >
> >
> > Best Regards!
> > Anson Huang
> >
> >
> > > -----Original Message-----
> > > From: Dong Aisheng [mailto:[email protected]]
> > > Sent: 2018-01-08 6:39 PM
> > > To: Anson Huang <[email protected]>
> > > Cc: [email protected]; [email protected];
> > > linux- [email protected]; [email protected];
> > > dl-linux-imx <linux- [email protected]>; [email protected];
> > > [email protected]; Fabio Estevam <[email protected]>;
> > > [email protected]; [email protected]; [email protected];
> > > [email protected]; [email protected]; [email protected]
> > > Subject: Re: [PATCH 2/2] ARM: dts: imx7s: add snvs rtc clock
> > >
> > > On Thu, Jan 04, 2018 at 11:06:42PM +0800, Anson Huang wrote:
> > > > Add i.MX7 SNVS RTC clock.
> > > >
> > > > Signed-off-by: Anson Huang <[email protected]>
> > >
> > > If this clock IMX7D_SNVS_CLK is used for all SNVS sub modules, then
> > > snvs_poweroff and snvs_pwrkey should also rely on it, right?
> > >
> > > How about add them all in one time?
> > >
> > > BTW, syscon-poweroff seems still not introduce clock support and
> > > fsl,sec-v4.0- pwrkey also does not handle clock, they may need to be added
> later.
> > >
> > > Regards
> > > Dong Aisheng
> >
> > Yes, I thought about it before sending patch, but currently the
> > poweroff and pwrkey driver do NOT handle clocks, so I plan to add them later,
> including handling clocks in driver and dtb.
> >
>
> SNVS RTC binding doc does not claim a optional clock support, you probably
> may need update the binding doc as well.
>
> BTW, Should mx6 platforms need the same fixes?
> If yes, we'd better fix them all.

I.MX6 platforms has no such SNVS CCGR clock gate, no need to change.
OK, I will update the SNVS RTC binding doc and send out a V2 patch set.

Anson.

>
> Regards
> Dong Aisheng
>
> > Anson
> >
> > >
> > > > ---
> > > > arch/arm/boot/dts/imx7s.dtsi | 2 ++
> > > > 1 file changed, 2 insertions(+)
> > > >
> > > > diff --git a/arch/arm/boot/dts/imx7s.dtsi
> > > > b/arch/arm/boot/dts/imx7s.dtsi index e718fd2..f9b97f3 100644
> > > > --- a/arch/arm/boot/dts/imx7s.dtsi
> > > > +++ b/arch/arm/boot/dts/imx7s.dtsi
> > > > @@ -534,6 +534,8 @@
> > > > offset = <0x34>;
> > > > interrupts = <GIC_SPI 19
> > > IRQ_TYPE_LEVEL_HIGH>,
> > > > <GIC_SPI 20
> > > IRQ_TYPE_LEVEL_HIGH>;
> > > > + clocks = <&clks IMX7D_SNVS_CLK>;
> > > > + clock-names = "snvs-rtc";
> > > > };
> > > >
> > > > snvs_poweroff: snvs-poweroff {
> > > > --
> > > > 1.9.1
> > > >
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe linux-clk"
> > > > in the body of a message to [email protected] More
> > > > majordomo info at
> > > > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2F
> > > > vger
> > > > .kernel.org%2Fmajordomo-
> > > info.html&data=02%7C01%7CAnson.Huang%40nxp.com
> > > > %7Cd10ff23b822b4cd16c2708d5568417c6%7C686ea1d3bc2b4c6fa92cd99c5
> c30
> > > 1635
> > > > %7C0%7C0%7C636510047707248763&sdata=FMx22hfKxs7YA%2F1zCVeYC
> nVX
> > > 9Ck4MmB9
> > > > GuolA51V2eg%3D&reserved=0