Skip to contentSkip to conversation

ARM: OMAP2+: Allow clock alias provision from device tree

PATCH In review Roger Quadros 3 participants 5 messages Feb 11, 2013 – Feb 12, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ARM: OMAP2+: Allow clock alias provision from device tree

Currently on OMAP, it is not possible to specify a clock consumer to any of the OMAP generated clocks using the device tree. This can pose a problem for external devices that run off an OMAP clock as we can't reliably provide a reference to the clock in the device tree.

This patch allows device trees to provide a node that contains the clock identifier, clock alias and the device phandle. The board initialization code then creates a clock alias to this clock id, and associates it with the device whose phandle was supplied.

Discussion
http://www.spinics.net/lists/linux-omap/msg86241.html

CC Russell King <[email protected]>
CC Rajendra Nayak <[email protected]>
CC Santosh Shilimkar <[email protected]>
---
 .../devicetree/bindings/clock/ti-clock-alias.txt   |   26 ++++++++
 arch/arm/mach-omap2/board-generic.c                |   67 ++++++++++++++++++++
 2 files changed, 93 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/ti-clock-alias.txt
Documentation/devicetree/bindings/clock/ti-clock-alias.txt new file +26 -0
new file mode 100644
index 0000000..87ef4c3
@@ -0,0 +1,26 @@
+* Clock alias provision for TI OMAP2+ boards
+
+This binding allows the board's device tree file to specify a clock name,
+device phandle and clock alias so that that clock can be associated
+to the device with the alias.
+
+This is required in cases where an external device is clocked by an
+OMAP generated clock and needs to be assocated to it.
+
+NOTE: The node's name should be clock_alias
+
+Required properties
+- clock-name: The clock identifier string. Should be one of the
+  clock ids defined in OMAP common clock data.
+- clock-alias: A string specifying the alias that must be created to the clock.
+- device: A phandle to the device this clock should be associated to.
+
+e.g. On the OMAP4 Panda board, the USB PHY device is clocked by the
+FREF_CLK3 (auxclk3_ck) from the OMAP. The PHY driver expexts the clock to
+be named "main_clk". This binding can be provided like so
+
+clock_alias {
+	clock-name = "auxclk3_ck";
+	clock-alias = "main_clk";
+	device = <&hsusb1_phy>;
+};
arch/arm/mach-omap2/board-generic.c +67 -0

85 lines not on this page · raw message

Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 2/2 ARM: dts: omap4-panda: Add clock alias for USB PHY

On Panda, the USB Host PHY is clocked by FREF3_CLK (auxclk3_ck) pin of the OMAP. Provide this information in the device tree.

CC Russell King <[email protected]>
CC Rajendra Nayak <[email protected]>
CC Santosh Shilimkar <[email protected]>
---
 arch/arm/boot/dts/omap4-panda.dts |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
arch/arm/boot/dts/omap4-panda.dts +7 -0
index d6e59c7..a7d66cc 100644
@@ -86,6 +86,13 @@
 		reset-supply = <&hsusb1_reset>;
 		vcc-supply = <&hsusb1_power>;
 	};
+
+	/* hsusb1_phy is clocked by FREF_CLK3 i.e. auxclk3 */
+	clock_alias {
+		clock-name = "auxclk3_ck";
+		clock-alias = "main_clk";
+		device = <&hsusb1_phy>;
+	};
 };
 
 &omap4_pmx_core {
Signature · 1 line
1.7.4.1
#2 lore raw
In reply to Roger Quadros

Hi,

arch/arm/mach-omap2/board-generic.c static struct of_device_id omap_dt_match_table[] __initdata = { · line 42

Quoted 5 lines · Roger Quadros
arch/arm/mach-omap2/board-generic.c +1 -0
@@ -36,12 +39,76 @@ static struct of_device_id omap_dt_match_table[] __initdata = {
 	{ }
 };
 
+static int __init omap_create_clk_alias(struct device_node *np)

if the rest of the folks agree with the aproach, looks like most of this can be made a bit more generic ;-)

Signature · 8 lines
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130211/c3d895fc/attachment.sig>
#3 lore raw
In reply to Roger Quadros
Quoted 4 lines · Roger Quadros

Currently on OMAP, it is not possible to specify a clock consumer to any of the OMAP generated clocks using the device tree. This can pose a problem for external devices that run off an OMAP clock as we can't reliably provide a reference to the clock in the device tree.

There is an established way of providing clocks in the devicetree using the clocks/clock-names properties. Wouldn't it be better using this for OMAP aswell?

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
#4 lore raw
Quoted 10 lines · Sascha Hauer
Quoted 4 lines · Roger Quadros

Currently on OMAP, it is not possible to specify a clock consumer to any of the OMAP generated clocks using the device tree. This can pose a problem for external devices that run off an OMAP clock as we can't reliably provide a reference to the clock in the device tree.

There is an established way of providing clocks in the devicetree using the clocks/clock-names properties. Wouldn't it be better using this for OMAP aswell?

I agree with you, but I'm not sure when this migration will be done. Rajendra/Santosh might know better.

regards,
-roger