linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/8] Update Kona drivers to use clocks
@ 2013-11-14 19:10 Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 1/8] ARM: dts: Declare clocks as fixed on bcm11351 Tim Kryger
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

This series declares the clocks present on bcm11351 (aka bcm281xx) SoCs
to be fixed at the rates configured by development bootloaders and then
updates the Kona drivers to make use of clock calls where appropriate.

Changes in v3:
  - Updated the commit message for the UART DTS change
  - Added a patch to change the kona timer binding doc
  - Updated the commit message for the kona timer driver change
  - Updated the panic message in the kona timer driver
  - Added a patch to change the kona sdhci binding doc
  - Moved the SDHCI driver change earlier in the series
  - Removed unrelated change from SDHCI driver patch

Changes in v2:
  - Renamed bsc4_clk to pmu_bsc_clk

Tim Kryger (8):
  ARM: dts: Declare clocks as fixed on bcm11351
  ARM: dts: Specify clocks for UARTs on bcm11351
  Documentation: dt: kona-sdhci: Add clocks property
  ARM: dts: Specify clocks for SDHCIs on bcm11351
  mmc: sdhci-bcm-kona: Add basic use of clocks
  Documentation: dt: kona-timer: Add clocks property
  clocksource: kona: Add basic use of external clock
  ARM: dts: Specify clocks for timer on bcm11351

 .../devicetree/bindings/arm/bcm/kona-timer.txt     |   8 +-
 .../devicetree/bindings/mmc/kona-sdhci.txt         |   5 +
 arch/arm/boot/dts/bcm11351.dtsi                    | 111 ++++++++++++++++++++-
 drivers/clocksource/bcm_kona_timer.c               |  14 ++-
 drivers/mmc/host/sdhci-bcm-kona.c                  |  28 +++++-
 5 files changed, 156 insertions(+), 10 deletions(-)

-- 
1.8.0.1



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

* [PATCH v3 1/8] ARM: dts: Declare clocks as fixed on bcm11351
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 2/8] ARM: dts: Specify clocks for UARTs " Tim Kryger
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

Declare clocks that are enabled and configured by bootloaders as fixed
rate clocks in the DTS such that device drivers may use standard clock
function calls.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 arch/arm/boot/dts/bcm11351.dtsi | 97 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)

diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index b0c0610..eca6fbc 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -142,4 +142,101 @@
 		status = "disabled";
 	};
 
+	clocks {
+		bsc1_clk: bsc1 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		bsc2_clk: bsc2 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		bsc3_clk: bsc3 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		pmu_bsc_clk: pmu_bsc {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		hub_timer_clk: hub_timer {
+			compatible = "fixed-clock";
+			clock-frequency = <32768>;
+			#clock-cells = <0>;
+		};
+
+		pwm_clk: pwm {
+			compatible = "fixed-clock";
+			clock-frequency = <26000000>;
+			#clock-cells = <0>;
+		};
+
+		sdio1_clk: sdio1 {
+			compatible = "fixed-clock";
+			clock-frequency = <48000000>;
+			#clock-cells = <0>;
+		};
+
+		sdio2_clk: sdio2 {
+			compatible = "fixed-clock";
+			clock-frequency = <48000000>;
+			#clock-cells = <0>;
+		};
+
+		sdio3_clk: sdio3 {
+			compatible = "fixed-clock";
+			clock-frequency = <48000000>;
+			#clock-cells = <0>;
+		};
+
+		sdio4_clk: sdio4 {
+			compatible = "fixed-clock";
+			clock-frequency = <48000000>;
+			#clock-cells = <0>;
+		};
+
+		tmon_1m_clk: tmon_1m {
+			compatible = "fixed-clock";
+			clock-frequency = <1000000>;
+			#clock-cells = <0>;
+		};
+
+		uartb_clk: uartb {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		uartb2_clk: uartb2 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		uartb3_clk: uartb3 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		uartb4_clk: uartb4 {
+			compatible = "fixed-clock";
+			clock-frequency = <13000000>;
+			#clock-cells = <0>;
+		};
+
+		usb_otg_ahb_clk: usb_otg_ahb {
+			compatible = "fixed-clock";
+			clock-frequency = <52000000>;
+			#clock-cells = <0>;
+		};
+	};
 };
-- 
1.8.0.1



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

* [PATCH v3 2/8] ARM: dts: Specify clocks for UARTs on bcm11351
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 1/8] ARM: dts: Declare clocks as fixed on bcm11351 Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 3/8] Documentation: dt: kona-sdhci: Add clocks property Tim Kryger
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

The frequency property in "snps,dw-apb-uart" entries are no longer
required if the rate of the external clock can be determined using the
clk api (see e302cd9 serial: 8250_dw: add support for clk api).

This patch replaces the frequency property in the UART nodes of
bcm11351.dtsi with references to the relevant clocks following the
common clock binding.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 arch/arm/boot/dts/bcm11351.dtsi | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index eca6fbc..9b99c52 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -43,7 +43,7 @@
 		compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
 		status = "disabled";
 		reg = <0x3e000000 0x1000>;
-		clock-frequency = <13000000>;
+		clocks = <&uartb_clk>;
 		interrupts = <GIC_SPI 67 IRQ_TYPE_LEVEL_HIGH>;
 		reg-shift = <2>;
 		reg-io-width = <4>;
@@ -53,7 +53,7 @@
 		compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
 		status = "disabled";
 		reg = <0x3e001000 0x1000>;
-		clock-frequency = <13000000>;
+		clocks = <&uartb2_clk>;
 		interrupts = <GIC_SPI 66 IRQ_TYPE_LEVEL_HIGH>;
 		reg-shift = <2>;
 		reg-io-width = <4>;
@@ -63,7 +63,7 @@
 		compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
 		status = "disabled";
 		reg = <0x3e002000 0x1000>;
-		clock-frequency = <13000000>;
+		clocks = <&uartb3_clk>;
 		interrupts = <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>;
 		reg-shift = <2>;
 		reg-io-width = <4>;
@@ -73,7 +73,7 @@
 		compatible = "brcm,bcm11351-dw-apb-uart", "snps,dw-apb-uart";
 		status = "disabled";
 		reg = <0x3e003000 0x1000>;
-		clock-frequency = <13000000>;
+		clocks = <&uartb4_clk>;
 		interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>;
 		reg-shift = <2>;
 		reg-io-width = <4>;
-- 
1.8.0.1



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

* [PATCH v3 3/8] Documentation: dt: kona-sdhci: Add clocks property
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 1/8] ARM: dts: Declare clocks as fixed on bcm11351 Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 2/8] ARM: dts: Specify clocks for UARTs " Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 4/8] ARM: dts: Specify clocks for SDHCIs on bcm11351 Tim Kryger
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

The Kona SDHCI block requires a clock that must be specified in the
device tree.  Update the documentation to reflect this requirement.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 Documentation/devicetree/bindings/mmc/kona-sdhci.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/kona-sdhci.txt b/Documentation/devicetree/bindings/mmc/kona-sdhci.txt
index 789fb07..42a57c6 100644
--- a/Documentation/devicetree/bindings/mmc/kona-sdhci.txt
+++ b/Documentation/devicetree/bindings/mmc/kona-sdhci.txt
@@ -6,12 +6,17 @@ and the properties present in the bcm281xx SDHCI
 Required properties:
 - compatible : Should be "brcm,kona-sdhci"
 - DEPRECATED: compatible : Should be "bcm,kona-sdhci"
+- clocks: clock specifier for the kona i2c external clock
+
+Refer to clocks/clock-bindings.txt for generic clock consumer
+properties.
 
 Example:
 
 sdio2: sdio@0x3f1a0000 {
 	compatible = "brcm,kona-sdhci";
 	reg = <0x3f1a0000 0x10000>;
+	clocks = <&sdio3_clk>;
 	interrupts = <0x0 74 0x4>;
 };
 
-- 
1.8.0.1



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

* [PATCH v3 4/8] ARM: dts: Specify clocks for SDHCIs on bcm11351
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
                   ` (2 preceding siblings ...)
  2013-11-14 19:10 ` [PATCH v3 3/8] Documentation: dt: kona-sdhci: Add clocks property Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 5/8] mmc: sdhci-bcm-kona: Add basic use of clocks Tim Kryger
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

Specify the external clock label in each SDHCI node.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 arch/arm/boot/dts/bcm11351.dtsi | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index 9b99c52..cfa1158 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -117,6 +117,7 @@
 	sdio1: sdio@3f180000 {
 		compatible = "brcm,kona-sdhci";
 		reg = <0x3f180000 0x10000>;
+		clocks = <&sdio1_clk>;
 		interrupts = <GIC_SPI 77 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
@@ -124,6 +125,7 @@
 	sdio2: sdio@3f190000 {
 		compatible = "brcm,kona-sdhci";
 		reg = <0x3f190000 0x10000>;
+		clocks = <&sdio2_clk>;
 		interrupts = <GIC_SPI 76 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
@@ -131,6 +133,7 @@
 	sdio3: sdio@3f1a0000 {
 		compatible = "brcm,kona-sdhci";
 		reg = <0x3f1a0000 0x10000>;
+		clocks = <&sdio3_clk>;
 		interrupts = <GIC_SPI 74 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
@@ -138,6 +141,7 @@
 	sdio4: sdio@3f1b0000 {
 		compatible = "brcm,kona-sdhci";
 		reg = <0x3f1b0000 0x10000>;
+		clocks = <&sdio4_clk>;
 		interrupts = <GIC_SPI 73 IRQ_TYPE_LEVEL_HIGH>;
 		status = "disabled";
 	};
-- 
1.8.0.1



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

* [PATCH v3 5/8] mmc: sdhci-bcm-kona: Add basic use of clocks
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
                   ` (3 preceding siblings ...)
  2013-11-14 19:10 ` [PATCH v3 4/8] ARM: dts: Specify clocks for SDHCIs on bcm11351 Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 6/8] Documentation: dt: kona-timer: Add clocks property Tim Kryger
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

Enable the external clock needed by the host controller during the
probe and disable it during the remove.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 drivers/mmc/host/sdhci-bcm-kona.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-bcm-kona.c b/drivers/mmc/host/sdhci-bcm-kona.c
index 85472d3..bffbb40 100644
--- a/drivers/mmc/host/sdhci-bcm-kona.c
+++ b/drivers/mmc/host/sdhci-bcm-kona.c
@@ -54,6 +54,7 @@
 
 struct sdhci_bcm_kona_dev {
 	struct mutex	write_lock; /* protect back to back writes */
+	struct clk	*external_clk;
 };
 
 
@@ -257,6 +258,24 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)
 		goto err_pltfm_free;
 	}
 
+	/* Get and enable the external clock */
+	kona_dev->external_clk = devm_clk_get(dev, NULL);
+	if (IS_ERR(kona_dev->external_clk)) {
+		dev_err(dev, "Failed to get external clock\n");
+		ret = PTR_ERR(kona_dev->external_clk);
+		goto err_pltfm_free;
+	}
+
+	if (clk_set_rate(kona_dev->external_clk, host->mmc->f_max) != 0) {
+		dev_err(dev, "Failed to set rate external clock\n");
+		goto err_pltfm_free;
+	}
+
+	if (clk_prepare_enable(kona_dev->external_clk) != 0) {
+		dev_err(dev, "Failed to enable external clock\n");
+		goto err_pltfm_free;
+	}
+
 	dev_dbg(dev, "non-removable=%c\n",
 		(host->mmc->caps & MMC_CAP_NONREMOVABLE) ? 'Y' : 'N');
 	dev_dbg(dev, "cd_gpio %c, wp_gpio %c\n",
@@ -271,7 +290,7 @@ static int sdhci_bcm_kona_probe(struct platform_device *pdev)
 
 	ret = sdhci_bcm_kona_sd_reset(host);
 	if (ret)
-		goto err_pltfm_free;
+		goto err_clk_disable;
 
 	sdhci_bcm_kona_sd_init(host);
 
@@ -307,6 +326,9 @@ err_remove_host:
 err_reset:
 	sdhci_bcm_kona_sd_reset(host);
 
+err_clk_disable:
+	clk_disable_unprepare(kona_dev->external_clk);
+
 err_pltfm_free:
 	sdhci_pltfm_free(pdev);
 
@@ -317,6 +339,8 @@ err_pltfm_free:
 static int __exit sdhci_bcm_kona_remove(struct platform_device *pdev)
 {
 	struct sdhci_host *host = platform_get_drvdata(pdev);
+	struct sdhci_pltfm_host *pltfm_priv = sdhci_priv(host);
+	struct sdhci_bcm_kona_dev *kona_dev = sdhci_pltfm_priv(pltfm_priv);
 	int dead;
 	u32 scratch;
 
@@ -326,6 +350,8 @@ static int __exit sdhci_bcm_kona_remove(struct platform_device *pdev)
 		dead = 1;
 	sdhci_remove_host(host, dead);
 
+	clk_disable_unprepare(kona_dev->external_clk);
+
 	sdhci_free_host(host);
 
 	return 0;
-- 
1.8.0.1



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

* [PATCH v3 6/8] Documentation: dt: kona-timer: Add clocks property
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
                   ` (4 preceding siblings ...)
  2013-11-14 19:10 ` [PATCH v3 5/8] mmc: sdhci-bcm-kona: Add basic use of clocks Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 7/8] clocksource: kona: Add basic use of external clock Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 8/8] ARM: dts: Specify clocks for timer on bcm11351 Tim Kryger
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

The frequency for the Kona timer can either be specified through the
device tree or determined by checking the rate of the clock specified
in the device tree.  Update the documentation to reflect both ways.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 Documentation/devicetree/bindings/arm/bcm/kona-timer.txt | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt b/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt
index 17d88b2..b84e184 100644
--- a/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt
+++ b/Documentation/devicetree/bindings/arm/bcm/kona-timer.txt
@@ -8,13 +8,19 @@ Required properties:
 - DEPRECATED: compatible : "bcm,kona-timer"
 - reg : Register range for the timer
 - interrupts : interrupt for the timer
+- clocks: clock specifier for the kona i2c external clock
 - clock-frequency: frequency that the clock operates
 
+Only one of clocks or clock-frequency should be specified.
+
+Refer to clocks/clock-bindings.txt for generic clock consumer
+properties.
+
 Example:
 	timer@35006000 {
 		compatible = "brcm,kona-timer";
 		reg = <0x35006000 0x1000>;
 		interrupts = <0x0 7 0x4>;
-		clock-frequency = <32768>;
+		clocks = <&hub_timer_clk>;
 	};
 
-- 
1.8.0.1



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

* [PATCH v3 7/8] clocksource: kona: Add basic use of external clock
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
                   ` (5 preceding siblings ...)
  2013-11-14 19:10 ` [PATCH v3 6/8] Documentation: dt: kona-timer: Add clocks property Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  2013-11-14 19:10 ` [PATCH v3 8/8] ARM: dts: Specify clocks for timer on bcm11351 Tim Kryger
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

When an clock is specified in the device tree, enable it and use it to
determine the external clock frequency.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 drivers/clocksource/bcm_kona_timer.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index 0d7d8c3..8a4ab36 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -17,6 +17,7 @@
 #include <linux/jiffies.h>
 #include <linux/clockchips.h>
 #include <linux/types.h>
+#include <linux/clk.h>
 
 #include <linux/io.h>
 #include <asm/mach/time.h>
@@ -107,11 +108,18 @@ static const struct of_device_id bcm_timer_ids[] __initconst = {
 static void __init kona_timers_init(struct device_node *node)
 {
 	u32 freq;
+	struct clk *external_clk;
 
-	if (!of_property_read_u32(node, "clock-frequency", &freq))
+	external_clk = of_clk_get_by_name(node, NULL);
+
+	if (!IS_ERR(external_clk)) {
+		arch_timer_rate = clk_get_rate(external_clk);
+		clk_prepare_enable(external_clk);
+	} else if (!of_property_read_u32(node, "clock-frequency", &freq)) {
 		arch_timer_rate = freq;
-	else
-		panic("clock-frequency not set in the .dts file");
+	} else {
+		panic("unable to determine clock-frequency");
+	}
 
 	/* Setup IRQ numbers */
 	timers.tmr_irq = irq_of_parse_and_map(node, 0);
-- 
1.8.0.1



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

* [PATCH v3 8/8] ARM: dts: Specify clocks for timer on bcm11351
  2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
                   ` (6 preceding siblings ...)
  2013-11-14 19:10 ` [PATCH v3 7/8] clocksource: kona: Add basic use of external clock Tim Kryger
@ 2013-11-14 19:10 ` Tim Kryger
  7 siblings, 0 replies; 9+ messages in thread
From: Tim Kryger @ 2013-11-14 19:10 UTC (permalink / raw)
  To: Christian Daudt, Rob Herring, Pawel Moll, Mark Rutland,
	Stephen Warren, Ian Campbell, Daniel Lezcano, Thomas Gleixner,
	Chris Ball
  Cc: Tim Kryger, Device Tree List, Linux ARM Kernel List,
	Linux Kernel Mailing List, Linux MMC List, Linaro Patches List

Specify the external clock label in the timer node.

Signed-off-by: Tim Kryger <tim.kryger@linaro.org>
Reviewed-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Matt Porter <matt.porter@linaro.org>
---
 arch/arm/boot/dts/bcm11351.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/bcm11351.dtsi b/arch/arm/boot/dts/bcm11351.dtsi
index cfa1158..fdd9086 100644
--- a/arch/arm/boot/dts/bcm11351.dtsi
+++ b/arch/arm/boot/dts/bcm11351.dtsi
@@ -95,7 +95,7 @@
 		compatible = "brcm,kona-timer";
 		reg = <0x35006000 0x1000>;
 		interrupts = <GIC_SPI 7 IRQ_TYPE_LEVEL_HIGH>;
-		clock-frequency = <32768>;
+		clocks = <&hub_timer_clk>;
 	};
 
 	gpio: gpio@35003000 {
-- 
1.8.0.1



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

end of thread, other threads:[~2013-11-14 19:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-14 19:10 [PATCH v3 0/8] Update Kona drivers to use clocks Tim Kryger
2013-11-14 19:10 ` [PATCH v3 1/8] ARM: dts: Declare clocks as fixed on bcm11351 Tim Kryger
2013-11-14 19:10 ` [PATCH v3 2/8] ARM: dts: Specify clocks for UARTs " Tim Kryger
2013-11-14 19:10 ` [PATCH v3 3/8] Documentation: dt: kona-sdhci: Add clocks property Tim Kryger
2013-11-14 19:10 ` [PATCH v3 4/8] ARM: dts: Specify clocks for SDHCIs on bcm11351 Tim Kryger
2013-11-14 19:10 ` [PATCH v3 5/8] mmc: sdhci-bcm-kona: Add basic use of clocks Tim Kryger
2013-11-14 19:10 ` [PATCH v3 6/8] Documentation: dt: kona-timer: Add clocks property Tim Kryger
2013-11-14 19:10 ` [PATCH v3 7/8] clocksource: kona: Add basic use of external clock Tim Kryger
2013-11-14 19:10 ` [PATCH v3 8/8] ARM: dts: Specify clocks for timer on bcm11351 Tim Kryger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).