Skip to contentSkip to conversation

ARM: dts: Add very basic dt support for mx31pdk

PATCH New Fabio Estevam 3 participants 7 messages Nov 22, 2012 – Nov 27, 2012

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

PATCH 1/4 ARM: dts: Add very basic dt support for mx31pdk

Add very basic dt support for mx31pdk.

---
 Documentation/devicetree/bindings/arm/fsl.txt |    4 ++++
 arch/arm/boot/dts/Makefile                    |    3 ++-
 arch/arm/boot/dts/imx31-pdk.dts               |   30 +++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/imx31-pdk.dts
Documentation/devicetree/bindings/arm/fsl.txt +4 -0
index ac9e751..50b931a 100644
@@ -9,6 +9,10 @@ i.MX28 Evaluation Kit
 Required root node properties:
     - compatible = "fsl,imx28-evk", "fsl,imx28";
 
+i.MX31 Product Development Kit
+Required root node properties:
+    - compatible = "fsl,imx31-pdk", "fsl,imx31";
+
 i.MX51 Babbage Board
 Required root node properties:
     - compatible = "fsl,imx51-babbage", "fsl,imx51";
arch/arm/boot/dts/Makefile +2 -1
index 701388b..5b5590f 100644
@@ -59,7 +59,8 @@ dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
 	msm8960-cdp.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
 	armada-xp-db.dtb
-dtb-$(CONFIG_ARCH_MXC) += imx51-babbage.dtb \
+dtb-$(CONFIG_ARCH_MXC) += imx31-pdk.dtb \
+	imx51-babbage.dtb \
 	imx53-ard.dtb \
 	imx53-evk.dtb \
 	imx53-qsb.dtb \
arch/arm/boot/dts/imx31-pdk.dts new file +30 -0
new file mode 100644
index 0000000..1e46d80
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx31.dtsi"
+
+/ {
+	model = "mx31-pdk";
+	compatible = "freescale,imx31-pdk", "fsl,imx31";
+
+	memory {
+		reg = <0x80000000 0x8000000>;
+	};
+
+	soc {
+		aips at 43f00000 { /* AIPS1 */
+			uart1: serial at 43f90000 {
+				status = "okay";
+			};
+		};
+	};
+};
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 2/4 ARM: Let CONFIG_MACH_IMX31_DT be built by default

Let CONFIG_MACH_IMX31_DT be built by default.

---
 arch/arm/configs/imx_v6_v7_defconfig |    1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/imx_v6_v7_defconfig +1 -0
index 44f117a..02dba2c 100644
@@ -19,6 +19,7 @@ CONFIG_MODULE_SRCVERSION_ALL=y
 CONFIG_ARCH_MXC=y
 CONFIG_ARCH_MULTI_V6=y
 CONFIG_ARCH_MULTI_V7=y
+CONFIG_MACH_IMX31_DT=y
 CONFIG_MACH_MX31LILLY=y
 CONFIG_MACH_MX31LITE=y
 CONFIG_MACH_PCM037=y
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 3/4 ARM: clk-imx31: Add dummy clock

In reply to Fabio Estevam

Add dummy clock as it is required by some i.mx drivers.

---
 arch/arm/mach-imx/clk-imx31.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-imx/clk-imx31.c +3 -2
index 8be64e0..07af70d 100644
@@ -34,8 +34,8 @@ static const char *csi_sel[] = { "upll", "spll", };
 static const char *fir_sel[] = { "mcu_main", "upll", "spll" };
 
 enum mx31_clks {
-	ckih, ckil, mpll, spll, upll, mcu_main, hsp, ahb, nfc, ipg, per_div,
-	per, csi, fir, csi_div, usb_div_pre, usb_div_post, fir_div_pre,
+	dummy, ckih, ckil, mpll, spll, upll, mcu_main, hsp, ahb, nfc, ipg,
+	per_div, per, csi, fir, csi_div, usb_div_pre, usb_div_post, fir_div_pre,
 	fir_div_post, sdhc1_gate, sdhc2_gate, gpt_gate, epit1_gate, epit2_gate,
 	iim_gate, ata_gate, sdma_gate, cspi3_gate, rng_gate, uart1_gate,
 	uart2_gate, ssi1_gate, i2c1_gate, i2c2_gate, i2c3_gate, hantro_gate,
@@ -52,6 +52,7 @@ int __init mx31_clocks_init(unsigned long fref)
 	void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
 	int i;
 
+	clk[dummy] = imx_clk_fixed("dummy", 0);
 	clk[ckih] = imx_clk_fixed("ckih", fref);
 	clk[ckil] = imx_clk_fixed("ckil", 32768);
 	clk[mpll] = imx_clk_pllv1("mpll", "ckih", base + MXC_CCM_MPCTL);
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 4/4 ARM: mx31: Replace clk_register_clkdev with clock DT lookup

In reply to Fabio Estevam

Similarly as it was done for mx6q, use a DT lookup in order to make maintainance task for the clock devices easier.

---
 .../devicetree/bindings/clock/imx31-clock.txt      |   91 ++++++++++++++++++++
 arch/arm/boot/dts/imx31.dtsi                       |   17 ++++
 arch/arm/mach-imx/clk-imx31.c                      |   10 +++
 arch/arm/mach-imx/imx31-dt.c                       |   17 +---
 4 files changed, 119 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/imx31-clock.txt
Documentation/devicetree/bindings/clock/imx31-clock.txt new file +91 -0
new file mode 100644
index 0000000..19df842
@@ -0,0 +1,91 @@
+* Clock bindings for Freescale i.MX31
+
+Required properties:
+- compatible: Should be "fsl,imx31-ccm"
+- reg: Address and length of the register set
+- interrupts: Should contain CCM interrupt
+- #clock-cells: Should be <1>
+
+The clock consumer should specify the desired clock by having the clock
+ID in its "clocks" phandle cell.  The following is a full list of i.MX31
+clocks and IDs.
+
+	Clock		    ID
+	-----------------------
+	dummy	             0
+	ckih                 1
+	ckil                 2
+	mpll                 3
+	spll                 4
+	upll                 5
+	mcu_main             6
+	hsp                  7
+	ahb                  8
+	nfc                  9
+	ipg                  10
+	per_div              11
+	per                  12
+	csi_sel              13
+	fir_sel              14
+	csi_div              15
+	usb_div_pre          16
+	usb_div_post         17
+	fir_div_pre          18
+	fir_div_post         19
+	sdhc1_gate           20
+	sdhc2_gate           21
+	gpt_gate             22
+	epit1_gate           23
+	epit2_gate           24
+	iim_gate             25
+	ata_gate             26
+	sdma_gate            27
+	cspi3_gate           28
+	rng_gate             29
+	uart1_gate           30
+	uart2_gate           31
+	ssi1_gate            32
+	i2c1_gate            33
+	i2c2_gate            34
+	i2c3_gate            35
+	hantro_gate          36
+	mstick1_gate         37
+	mstick2_gate         38
+	csi_gate             39
+	rtc_gate             40
+	wdog_gate            41
+	pwm_gate             42
+	sim_gate             43
+	ect_gate             44
+	usb_gate             45
+	kpp_gate             46
+	ipu_gate             47
+	uart3_gate           48
+	uart4_gate           49
+	uart5_gate           50
+	owire_gate           51
+	ssi2_gate            52
+	cspi1_gate           53
+	cspi2_gate           54
+	gacc_gate            55
+	emi_gate             56
+	rtic_gate            57
+	firi_gate            58
+
+Examples:
+
+clks: ccm at 53f80000{
+	compatible = "fsl,imx31-ccm";
+	reg = <0x53f80000 0x4000>;
+	interrupts = <0 31 0x04 0 53 0x04>;
+	#clock-cells = <1>;
+};
+
+uart1: serial at 43f90000 {
+	compatible = "fsl,imx31-uart", "fsl,imx21-uart";
+	reg = <0x43f90000 0x4000>;
+	interrupts = <45>;
+	clocks = <&clks 10>, <&clks 30>;
+	clock-names = "ipg", "per";
+	status = "disabled";
+};
arch/arm/boot/dts/imx31.dtsi +17 -0
index eef7099..454c2d1 100644
@@ -45,6 +45,8 @@
 				compatible = "fsl,imx31-uart", "fsl,imx21-uart";
 				reg = <0x43f90000 0x4000>;
 				interrupts = <45>;
+				clocks = <&clks 10>, <&clks 30>;
+				clock-names = "ipg", "per";
 				status = "disabled";
 			};
 
@@ -52,12 +54,16 @@
 				compatible = "fsl,imx31-uart", "fsl,imx21-uart";
 				reg = <0x43f94000 0x4000>;
 				interrupts = <32>;
+				clocks = <&clks 10>, <&clks 31>;
+				clock-names = "ipg", "per";
 				status = "disabled";
 			};
 
 			uart4: serial at 43fb0000 {
 				compatible = "fsl,imx31-uart", "fsl,imx21-uart";
 				reg = <0x43fb0000 0x4000>;
+				clocks = <&clks 10>, <&clks 49>;
+				clock-names = "ipg", "per";
 				interrupts = <46>;
 				status = "disabled";
 			};
@@ -66,6 +72,8 @@
 				compatible = "fsl,imx31-uart", "fsl,imx21-uart";
 				reg = <0x43fb4000 0x4000>;
 				interrupts = <47>;
+				clocks = <&clks 10>, <&clks 50>;
+				clock-names = "ipg", "per";
 				status = "disabled";
 			};
 		};
@@ -81,8 +89,17 @@
 				compatible = "fsl,imx31-uart", "fsl,imx21-uart";
 				reg = <0x5000c000 0x4000>;
 				interrupts = <18>;
+				clocks = <&clks 10>, <&clks 48>;
+				clock-names = "ipg", "per";
 				status = "disabled";
 			};
+
+			clks: ccm at 53f80000{
+				compatible = "fsl,imx31-ccm";
+				reg = <0x53f80000 0x4000>;
+				interrupts = <0 31 0x04 0 53 0x04>;
+				#clock-cells = <1>;
+			};
 		};
 	};
 };
arch/arm/mach-imx/clk-imx31.c +10 -0
index 07af70d..c103c60 100644
@@ -46,11 +46,13 @@ enum mx31_clks {
 };
 
 static struct clk *clk[clk_max];
+static struct clk_onecell_data clk_data;
 
 int __init mx31_clocks_init(unsigned long fref)
 {
 	void __iomem *base = MX31_IO_ADDRESS(MX31_CCM_BASE_ADDR);
 	int i;
+	struct device_node *np;
 
 	clk[dummy] = imx_clk_fixed("dummy", 0);
 	clk[ckih] = imx_clk_fixed("ckih", fref);
@@ -117,6 +119,14 @@ int __init mx31_clocks_init(unsigned long fref)
 			pr_err("imx31 clk %d: register failed with %ld\n",
 				i, PTR_ERR(clk[i]));
 
+	np = of_find_compatible_node(NULL, NULL, "fsl,imx31-ccm");
+
+	if (np) {
+		clk_data.clks = clk;
+		clk_data.clk_num = ARRAY_SIZE(clk);
+		of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
+	}
+
 	clk_register_clkdev(clk[gpt_gate], "per", "imx-gpt.0");
 	clk_register_clkdev(clk[ipg], "ipg", "imx-gpt.0");
 	clk_register_clkdev(clk[cspi1_gate], NULL, "imx31-cspi.0");
arch/arm/mach-imx/imx31-dt.c +1 -16
index af476de..dc083d3 100644
@@ -18,24 +18,9 @@
 #include "common.h"
 #include "mx31.h"
 
-static const struct of_dev_auxdata imx31_auxdata_lookup[] __initconst = {
-	OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART1_BASE_ADDR,
-			"imx21-uart.0", NULL),
-	OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART2_BASE_ADDR,
-			"imx21-uart.1", NULL),
-	OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART3_BASE_ADDR,
-			"imx21-uart.2", NULL),
-	OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART4_BASE_ADDR,
-			"imx21-uart.3", NULL),
-	OF_DEV_AUXDATA("fsl,imx31-uart", MX31_UART5_BASE_ADDR,
-			"imx21-uart.4", NULL),
-	{ /* sentinel */ }
-};
-
 static void __init imx31_dt_init(void)
 {
-	of_platform_populate(NULL, of_default_bus_match_table,
-			     imx31_auxdata_lookup, NULL);
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static void __init imx31_timer_init(void)
Signature · 1 line
1.7.9.5
maintainer
#4 lore raw

PATCH 1/4 ARM: dts: Add very basic dt support for mx31pdk

In reply to Fabio Estevam
Quoted 3 lines · Fabio Estevam

Add very basic dt support for mx31pdk.

Could you provide a bit more complete patch? I think at least the low hanging fruits like nor flash and nand, some i2c devices is not much work but would save a lot of churn in patching the file.

Sascha

Quoted 77 lines
---
 Documentation/devicetree/bindings/arm/fsl.txt |    4 ++++
 arch/arm/boot/dts/Makefile                    |    3 ++-
 arch/arm/boot/dts/imx31-pdk.dts               |   30 +++++++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/imx31-pdk.dts
Documentation/devicetree/bindings/arm/fsl.txt +4 -0
index ac9e751..50b931a 100644
@@ -9,6 +9,10 @@ i.MX28 Evaluation Kit
 Required root node properties:
     - compatible = "fsl,imx28-evk", "fsl,imx28";
 
+i.MX31 Product Development Kit
+Required root node properties:
+    - compatible = "fsl,imx31-pdk", "fsl,imx31";
+
 i.MX51 Babbage Board
 Required root node properties:
     - compatible = "fsl,imx51-babbage", "fsl,imx51";
arch/arm/boot/dts/Makefile +2 -1
index 701388b..5b5590f 100644
@@ -59,7 +59,8 @@ dtb-$(CONFIG_ARCH_MSM) += msm8660-surf.dtb \
 	msm8960-cdp.dtb
 dtb-$(CONFIG_ARCH_MVEBU) += armada-370-db.dtb \
 	armada-xp-db.dtb
-dtb-$(CONFIG_ARCH_MXC) += imx51-babbage.dtb \
+dtb-$(CONFIG_ARCH_MXC) += imx31-pdk.dtb \
+	imx51-babbage.dtb \
 	imx53-ard.dtb \
 	imx53-evk.dtb \
 	imx53-qsb.dtb \
arch/arm/boot/dts/imx31-pdk.dts new file +30 -0
new file mode 100644
index 0000000..1e46d80
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+/dts-v1/;
+/include/ "imx31.dtsi"
+
+/ {
+	model = "mx31-pdk";
+	compatible = "freescale,imx31-pdk", "fsl,imx31";
+
+	memory {
+		reg = <0x80000000 0x8000000>;
+	};
+
+	soc {
+		aips at 43f00000 { /* AIPS1 */
+			uart1: serial at 43f90000 {
+				status = "okay";
+			};
+		};
+	};
+};
Signature · 1 line
1.7.9.5
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 |
reviewer
#5 lore raw

PATCH 1/4 ARM: dts: Add very basic dt support for mx31pdk

Quoted 8 lines · Sascha Hauer
Quoted 3 lines · Fabio Estevam

Add very basic dt support for mx31pdk.

Could you provide a bit more complete patch? I think at least the low hanging fruits like nor flash and nand, some i2c devices is not much work but would save a lot of churn in patching the file.

Ok, what about the other patches of the series? Are they good?

Regards,

Fabio Estevam

maintainer
#6 lore raw

PATCH 1/4 ARM: dts: Add very basic dt support for mx31pdk

Quoted 11 lines · Fabio Estevam
Quoted 8 lines · Sascha Hauer
Quoted 3 lines · Fabio Estevam

Add very basic dt support for mx31pdk.

Could you provide a bit more complete patch? I think at least the low hanging fruits like nor flash and nand, some i2c devices is not much work but would save a lot of churn in patching the file.

Ok, what about the other patches of the series? Are they good?

Yeah, the rest looks ok. Applied them.

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 |