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


Groups > linux.kernel > #1169400 > unrolled thread

[PATCH v3 0/6] add device tree support for mxc rtc

Started byPhilippe Reynes <tremyfr@gmail.com>
First post2015-06-20 19:20 +0200
Last post2015-06-20 19:20 +0200
Articles 4 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH v3 0/6] add device tree support for mxc rtc Philippe Reynes <tremyfr@gmail.com> - 2015-06-20 19:20 +0200
    [PATCH v3 2/6] imx35: define two clocks for rtc Philippe Reynes <tremyfr@gmail.com> - 2015-06-20 19:20 +0200
    [PATCH v3 5/6] dt-binding: document the binding for mxc rtc Philippe Reynes <tremyfr@gmail.com> - 2015-06-20 19:20 +0200
    [PATCH v3 3/6] rtc: mxc: use a second rtc clock Philippe Reynes <tremyfr@gmail.com> - 2015-06-20 19:20 +0200

#1169400 — [PATCH v3 0/6] add device tree support for mxc rtc

FromPhilippe Reynes <tremyfr@gmail.com>
Date2015-06-20 19:20 +0200
Subject[PATCH v3 0/6] add device tree support for mxc rtc
Message-ID<pDuAW-4Dl-15@gated-at.bofh.it>
This serie add the device tree support for the mxc rtc driver.
To do this, three steps are required :
- define two rtc clocks for imx31 and imx35
- enhance mxc rtc driver to use two clocks (rtc and ipg)
- add device tree support to mxc rtc driver

Changelog:
v3: (thanks Fabio Estevam)
- fix typo in imx35 clock comment
v2: (thanks Shawn Guo and Alexandre Belloni)
- add a second clock to imx35
- split the add of clock in a separate patches
- split the dt documentation in a separate patch

Philippe Reynes (6):
  imx31: add a second rtc clock
  imx35: define two clocks for rtc
  rtc: mxc: use a second rtc clock
  rtc: mxc: add support of device tree
  dt-binding: document the binding for mxc rtc
  apf27: dt: add support of internal rtc

 Documentation/devicetree/bindings/rtc/rtc-mxc.txt |   27 ++++++++++++
 arch/arm/boot/dts/imx27-apf27.dts                 |    4 ++
 arch/arm/boot/dts/imx27.dtsi                      |   10 +++++
 arch/arm/mach-imx/clk-imx31.c                     |    3 +-
 arch/arm/mach-imx/clk-imx35.c                     |    6 ++-
 drivers/rtc/rtc-mxc.c                             |   45 ++++++++++++++++-----
 6 files changed, 83 insertions(+), 12 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc.txt

-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1169402 — [PATCH v3 2/6] imx35: define two clocks for rtc

FromPhilippe Reynes <tremyfr@gmail.com>
Date2015-06-20 19:20 +0200
Subject[PATCH v3 2/6] imx35: define two clocks for rtc
Message-ID<pDuAW-4Dl-27@gated-at.bofh.it>
In reply to#1169400
The imx35 don't define clocks for rtc.
This patch add two clocks, as needed
by the mxc rtc driver.

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
 arch/arm/mach-imx/clk-imx35.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c
index a0d2b57..8c84eee 100644
--- a/arch/arm/mach-imx/clk-imx35.c
+++ b/arch/arm/mach-imx/clk-imx35.c
@@ -51,7 +51,7 @@ static const char *std_sel[] = {"ppll", "arm"};
 static const char *ipg_per_sel[] = {"ahb_per_div", "arm_per_div"};
 
 enum mx35_clks {
-	ckih, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg,
+	ckih, ckil, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg,
 	arm_per_div, ahb_per_div, ipg_per, uart_sel, uart_div, esdhc_sel,
 	esdhc1_div, esdhc2_div, esdhc3_div, spdif_sel, spdif_div_pre,
 	spdif_div_post, ssi_sel, ssi1_div_pre, ssi1_div_post, ssi2_div_pre,
@@ -89,6 +89,7 @@ int __init mx35_clocks_init(void)
 	}
 
 	clk[ckih] = imx_clk_fixed("ckih", 24000000);
+	clk[ckil] = imx_clk_fixed("ckih", 32768);
 	clk[mpll] = imx_clk_pllv1("mpll", "ckih", base + MX35_CCM_MPCTL);
 	clk[ppll] = imx_clk_pllv1("ppll", "ckih", base + MX35_CCM_PPCTL);
 
@@ -240,6 +241,9 @@ int __init mx35_clocks_init(void)
 	clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.1");
 	clk_register_clkdev(clk[uart3_gate], "per", "imx21-uart.2");
 	clk_register_clkdev(clk[ipg], "ipg", "imx21-uart.2");
+	/* i.mx35 has the i.mx21 type rtc */
+	clk_register_clkdev(clk[ckil], "rtc", "imx21-rtc");
+	clk_register_clkdev(clk[rtc_gate], "ipg", "imx21-rtc");
 	clk_register_clkdev(clk[usb_div], "per", "mxc-ehci.0");
 	clk_register_clkdev(clk[ipg], "ipg", "mxc-ehci.0");
 	clk_register_clkdev(clk[usbotg_gate], "ahb", "mxc-ehci.0");
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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


#1169406 — [PATCH v3 5/6] dt-binding: document the binding for mxc rtc

FromPhilippe Reynes <tremyfr@gmail.com>
Date2015-06-20 19:20 +0200
Subject[PATCH v3 5/6] dt-binding: document the binding for mxc rtc
Message-ID<pDuAX-4Dl-35@gated-at.bofh.it>
In reply to#1169400
This adds documentation of device tree bindings for the
mxc rtc.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Pawel Moll <pawel.moll@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Ian Campbell <ijc+devicetree@hellion.org.uk>
Cc: Kumar Gala <galak@codeaurora.org>
Cc: devicetree@vger.kernel.org
Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
 Documentation/devicetree/bindings/rtc/rtc-mxc.txt |   27 +++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc.txt

diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc.txt b/Documentation/devicetree/bindings/rtc/rtc-mxc.txt
new file mode 100644
index 0000000..5505493
--- /dev/null
+++ b/Documentation/devicetree/bindings/rtc/rtc-mxc.txt
@@ -0,0 +1,27 @@
+* Real Time Clock of the i.MX SoCs
+
+RTC controller for the i.MX SoCs
+
+Required properties:
+- compatible: Should be "fsl,imx1-rtc" or "fsl,imx21-rtc".
+- reg: physical base address of the controller and length of memory mapped
+  region.
+- interrupts: IRQ line for the RTC.
+- clocks: should contain two entries:
+  * one for the input reference
+  * one for the the SoC RTC
+- clock-names: should contain:
+  * "rtc" for the input reference clock
+  * "ipg" for the SoC RTC clock
+
+Example:
+
+rtc@10007000 {
+	compatible = "fsl,imx21-rtc";
+	reg = <0x10007000 0x1000>;
+	interrupts = <22>;
+	clocks = <&clks IMX27_CLK_CKIL>,
+	       	 <&clks IMX27_CLK_RTC_IPG_GATE>;
+	clock-names = "rtc, "ipg";
+	status = "disabled";
+};
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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


#1169407 — [PATCH v3 3/6] rtc: mxc: use a second rtc clock

FromPhilippe Reynes <tremyfr@gmail.com>
Date2015-06-20 19:20 +0200
Subject[PATCH v3 3/6] rtc: mxc: use a second rtc clock
Message-ID<pDuAX-4Dl-37@gated-at.bofh.it>
In reply to#1169400
The mxc RTC needs two clocks, one for the input
reference, and one for the IP. But this driver
was only using one clock (for the reference).
This patch add the second clock (for the IP).

Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
---
 drivers/rtc/rtc-mxc.c |   26 +++++++++++++++++---------
 1 files changed, 17 insertions(+), 9 deletions(-)

diff --git a/drivers/rtc/rtc-mxc.c b/drivers/rtc/rtc-mxc.c
index 09d422b..e916a91 100644
--- a/drivers/rtc/rtc-mxc.c
+++ b/drivers/rtc/rtc-mxc.c
@@ -79,7 +79,8 @@ struct rtc_plat_data {
 	struct rtc_device *rtc;
 	void __iomem *ioaddr;
 	int irq;
-	struct clk *clk;
+	struct clk *clk_rtc;
+	struct clk *clk_ipg;
 	struct rtc_time g_rtc_alarm;
 	enum imx_rtc_type devtype;
 };
@@ -373,17 +374,24 @@ static int mxc_rtc_probe(struct platform_device *pdev)
 	if (IS_ERR(pdata->ioaddr))
 		return PTR_ERR(pdata->ioaddr);
 
-	pdata->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(pdata->clk)) {
-		dev_err(&pdev->dev, "unable to get clock!\n");
-		return PTR_ERR(pdata->clk);
+	pdata->clk_ipg = devm_clk_get(&pdev->dev, "ipg");
+	if (IS_ERR(pdata->clk_ipg)) {
+		dev_err(&pdev->dev, "unable to get ipg clock!\n");
+		return PTR_ERR(pdata->clk_ipg);
 	}
 
-	ret = clk_prepare_enable(pdata->clk);
+	ret = clk_prepare_enable(pdata->clk_ipg);
 	if (ret)
 		return ret;
 
-	rate = clk_get_rate(pdata->clk);
+	pdata->clk_rtc = devm_clk_get(&pdev->dev, "rtc");
+	if (IS_ERR(pdata->clk_rtc)) {
+		dev_err(&pdev->dev, "unable to get rtc clock!\n");
+		ret = PTR_ERR(pdata->clk_rtc);
+		goto exit_put_clk;
+	}
+
+	rate = clk_get_rate(pdata->clk_rtc);
 
 	if (rate == 32768)
 		reg = RTC_INPUT_CLK_32768HZ;
@@ -432,7 +440,7 @@ static int mxc_rtc_probe(struct platform_device *pdev)
 	return 0;
 
 exit_put_clk:
-	clk_disable_unprepare(pdata->clk);
+	clk_disable_unprepare(pdata->clk_ipg);
 
 	return ret;
 }
@@ -441,7 +449,7 @@ static int mxc_rtc_remove(struct platform_device *pdev)
 {
 	struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
 
-	clk_disable_unprepare(pdata->clk);
+	clk_disable_unprepare(pdata->clk_ipg);
 
 	return 0;
 }
-- 
1.7.4.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web