Skip to contentSkip to conversation

i.MX8MQ EVK miscellanea

PATCH Applied Andrey Smirnov 2 participants 10 messages Sep 21, 2018 – Sep 24, 2018

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

v3 cover i.MX8MQ EVK miscellanea

Everyone:

This is a number of i.MX8MQ or EVK related changes that are sitting in my repo that I am hoping to upstream:

- Pactches 1, 3, 4 are clock related fixes needed to get FEC, USDHC1 and USDHC2 to work.

- Patch 2 was made while working custom i.MX8MQ board (not upstreamed yet) that made use of that controller

- Patch 5 should be self-explanatory bug fix

- Patch 6 is PHY configuration code need to use FEC on EVK

- Patch 7 and 8 are both conveninece code to avoid having to specify memory size explicitly as well as a second part of a fix for a problem discussed in [1]

Changes since [v1]:

- Removed redundant DT code in patch 6

Changes since [v2]:

- Patch 7 re-written such that the code could also be re-used for i.MX7 (will be submitted in a separate series)

[1] http://lists.infradead.org/pipermail/barebox/2018-August/034402.html
[v1] http://lists.infradead.org/pipermail/barebox/2018-September/034742.html
[v2] http://lists.infradead.org/pipermail/barebox/2018-September/034772.html

Andrey Smirnov (8):
clk: i.MX8MQ: Bump refcounters of various important clocks
ARM: i.MX8MQ: Add missing node for ECSPI1
ARM: i.MX8MQ: Configure USDHC1,2 clocks
ARM: i.MX8MQ: Configure FEC1 clocks
ARM: nxp-imx8mq-evk: Add missing compatibility check
ARM: nxp-imx8mq-evk: Add FEC's PHY configuration code
ARM: i.MX: esdctl: Add memory size detection for i.MX8MQ
ARM: nxp-imx8mq-evk: Make use of memory size detection code

 arch/arm/boards/nxp-imx8mq-evk/board.c    |  27 ++-
 arch/arm/boards/nxp-imx8mq-evk/lowlevel.c |   4 +-
 arch/arm/dts/imx8mq-ddrc.dtsi             |  17 ++
 arch/arm/dts/imx8mq-evk.dts               |   7 +-
 arch/arm/dts/imx8mq.dtsi                  |  42 +++++
 arch/arm/mach-imx/esdctl.c                | 191 ++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/esdctl.h   |   1 +
 drivers/clk/imx/clk-imx8mq.c              |  12 ++
 8 files changed, 293 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/imx8mq-ddrc.dtsi
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v3 1/8 clk: i.MX8MQ: Bump refcounters of various important clocks

Bump refcounters of various important clocks in order to make sure their parents are not disabled during clock re-configuration added by commits that follow.

---
 drivers/clk/imx/clk-imx8mq.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/clk/imx/clk-imx8mq.c +12 -0
index 92d49d44e..782bbc256 100644
@@ -185,6 +185,15 @@ static const char *imx8mq_clko2_sels[] = {"osc_25m", "sys2_pll_200m", "sys1_pll_
 
 static struct clk_onecell_data clk_data;
 
+static int const clks_init_on[] = {
+       IMX8MQ_CLK_DRAM_CORE, IMX8MQ_CLK_AHB_CG,
+       IMX8MQ_CLK_NOC_DIV, IMX8MQ_CLK_NOC_APB_DIV,
+       IMX8MQ_CLK_NAND_USDHC_BUS_SRC,
+       IMX8MQ_CLK_MAIN_AXI_SRC, IMX8MQ_CLK_A53_CG,
+       IMX8MQ_CLK_AUDIO_AHB_DIV, IMX8MQ_CLK_TMU_ROOT,
+       IMX8MQ_CLK_DRAM_APB_SRC,
+};
+
 static void __init imx8mq_clocks_init(struct device_node *ccm_node)
 {
 	struct device_node *np;
@@ -572,6 +581,9 @@ static void __init imx8mq_clocks_init(struct device_node *ccm_node)
 			pr_err("i.MX8mq clk %u register failed with %ld\n",
 			       i, PTR_ERR(clks[i]));
 
+	for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
+		clk_enable(clks[clks_init_on[i]]);
+
 	clk_data.clks = clks;
 	clk_data.clk_num = ARRAY_SIZE(clks);
 	of_clk_add_provider(np, of_clk_src_onecell_get, &clk_data);
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

PATCH v3 4/8 ARM: i.MX8MQ: Configure FEC1 clocks

In reply to Andrey Smirnov

Select proper parents as well as rates for FEC1 related clocks.

---
 arch/arm/dts/imx8mq.dtsi | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
arch/arm/dts/imx8mq.dtsi +14 -2
index 8bdf4efb7..763005217 100644
@@ -639,16 +639,28 @@
 	assigned-clocks = <&clk IMX8MQ_CLK_USDHC1_SRC>,
 			  <&clk IMX8MQ_CLK_USDHC1_DIV>,
 			  <&clk IMX8MQ_CLK_USDHC2_SRC>,
-			  <&clk IMX8MQ_CLK_USDHC2_DIV>;
+			  <&clk IMX8MQ_CLK_USDHC2_DIV>,
+			  <&clk IMX8MQ_CLK_ENET_AXI_SRC>,
+			  <&clk IMX8MQ_CLK_ENET_TIMER_SRC>,
+			  <&clk IMX8MQ_CLK_ENET_REF_SRC>,
+			  <&clk IMX8MQ_CLK_ENET_TIMER_DIV>;
 
 	assigned-clock-parents =  <&clk IMX8MQ_SYS1_PLL_400M>,
 				  <0>,
 				  <&clk IMX8MQ_SYS1_PLL_400M>,
+				  <0>,
+				  <&clk IMX8MQ_SYS1_PLL_266M>,
+				  <&clk IMX8MQ_SYS2_PLL_100M>,
+				  <&clk IMX8MQ_SYS2_PLL_125M>,
 				  <0>;
 
 	assigned-clock-rates = <400000000>,
 			       <200000000>,
 			       <400000000>,
-			       <200000000>;
+			       <200000000>,
+			       <266000000>,
+			       <0>,
+			       <125000000>,
+			       <25000000>;
 };
 
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v3 2/8 ARM: i.MX8MQ: Add missing node for ECSPI1

In reply to Andrey Smirnov

Add node for ECSPI1 that is missing from imx8mq.dtsi

---
 arch/arm/dts/imx8mq.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/dts/imx8mq.dtsi +10 -0
index c67438a48..6f860c3d6 100644
@@ -288,6 +288,16 @@
 			#size-cells = <1>;
 			ranges = <0x30800000 0x30800000 0x400000>;
 
+			ecspi1: ecspi@30820000 {
+				compatible = "fsl,imx6ul-ecspi", "fsl,imx51-ecspi";
+				reg = <0x30820000 0x10000>;
+				interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
+				clocks = <&clk IMX8MQ_CLK_ECSPI1_ROOT>,
+				<&clk IMX8MQ_CLK_ECSPI1_ROOT>;
+				clock-names = "ipg", "per";
+				status = "disabled";
+			};
+
 			uart1: serial@30860000 {
 				compatible = "fsl,imx8mq-uart",
 				             "fsl,imx6q-uart";
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

PATCH v3 8/8 ARM: nxp-imx8mq-evk: Make use of memory size detection code

In reply to Andrey Smirnov
---
 arch/arm/boards/nxp-imx8mq-evk/board.c    | 2 --
 arch/arm/boards/nxp-imx8mq-evk/lowlevel.c | 4 ++--
 arch/arm/dts/imx8mq-evk.dts               | 6 +-----
 3 files changed, 3 insertions(+), 9 deletions(-)
arch/arm/boards/nxp-imx8mq-evk/board.c +0 -2
index aae6970d8..764eadb76 100644
@@ -50,8 +50,6 @@ static int imx8mq_evk_mem_init(void)
 	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
 		return 0;
 
-	arm_add_mem_device("ram0", 0x40000000, SZ_2G);
-
 	request_sdram_region("ATF", 0x40000000, SZ_128K);
 
 	return 0;
arch/arm/boards/nxp-imx8mq-evk/lowlevel.c +2 -2
index 438c70c87..1dff4b4d3 100644
@@ -24,6 +24,7 @@
 #include <asm/sections.h>
 #include <asm/mmu.h>
 #include <mach/atf.h>
+#include <mach/esdctl.h>
 
 #include "ddr.h"
 
@@ -121,7 +122,6 @@ ENTRY_FUNCTION(start_nxp_imx8mq_evk, r0, r1, r2)
 	/*
 	 * Standard entry we hit once we initialized both DDR and ATF
 	 */
-	barebox_arm_entry(MX8MQ_DDR_CSD1_BASE_ADDR,
-			  SZ_2G + SZ_1G, __dtb_imx8mq_evk_start);
+	imx8mq_barebox_entry(__dtb_imx8mq_evk_start);
 }
 
arch/arm/dts/imx8mq-evk.dts +1 -5
index d6d5d843c..a6e724e2e 100644
@@ -7,6 +7,7 @@
 /dts-v1/;
 
 #include "imx8mq.dtsi"
+#include "imx8mq-ddrc.dtsi"
 
 / {
 	model = "NXP i.MX8MQ EVK";
@@ -16,11 +17,6 @@
 		stdout-path = &uart1;
 	};
 
-	memory@40000000 {
-		device_type = "memory";
-		reg = <0x00000000 0x40000000 0 0xc0000000>;
-	};
-
 	reg_usdhc2_vmmc: regulator-vsd-3v3 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinctrl_reg_usdhc2>;
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#7 lore raw

PATCH v3 7/8 ARM: i.MX: esdctl: Add memory size detection for i.MX8MQ

In reply to Andrey Smirnov

Add memory size detection for i.MX8MQ. Only basic LPDDR4 configurations are supported for now. Support for other types of memory can be added later once we have any boards that use it.

---
 arch/arm/dts/imx8mq-ddrc.dtsi           |  17 +++
 arch/arm/mach-imx/esdctl.c              | 191 ++++++++++++++++++++++++
 arch/arm/mach-imx/include/mach/esdctl.h |   1 +
 3 files changed, 209 insertions(+)
 create mode 100644 arch/arm/dts/imx8mq-ddrc.dtsi
arch/arm/dts/imx8mq-ddrc.dtsi new file +17 -0
new file mode 100644
index 000000000..26d3da857
@@ -0,0 +1,17 @@
+/*
+ * Include file to switch board DTS form using hardcoded memory node
+ * to dynamic memory size detection based on DDR controller settings
+ */
+
+/ {
+
+	/delete-node/ memory@40000000;
+
+	peripherals@0 {
+		ddrc@3d400000 {
+			compatible = "fsl,imx8mq-ddrc";
+			reg = <0x3d400000 0x400000>;
+		};
+	};
+};
+
arch/arm/mach-imx/esdctl.c +191 -0

224 lines not on this page · raw message

arch/arm/mach-imx/include/mach/esdctl.h +1 -0
index 117e2bbad..ff109aa10 100644
@@ -139,6 +139,7 @@ void __noreturn imx53_barebox_entry(void *boarddata);
 void __noreturn imx6q_barebox_entry(void *boarddata);
 void __noreturn imx6ul_barebox_entry(void *boarddata);
 void __noreturn vf610_barebox_entry(void *boarddata);
+void __noreturn imx8mq_barebox_entry(void *boarddata);
 void imx_esdctl_disable(void);
 #endif
 
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

PATCH v3 3/8 ARM: i.MX8MQ: Configure USDHC1,2 clocks

In reply to Andrey Smirnov

Select appropriate parents as well as clock rates for USDHC1 and USDHC2 related clocks.

---
 arch/arm/dts/imx8mq.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/dts/imx8mq.dtsi +20 -0
index 6f860c3d6..8bdf4efb7 100644
@@ -632,3 +632,23 @@
 		};
 	};
 };
+
+
+
+&clk {
+	assigned-clocks = <&clk IMX8MQ_CLK_USDHC1_SRC>,
+			  <&clk IMX8MQ_CLK_USDHC1_DIV>,
+			  <&clk IMX8MQ_CLK_USDHC2_SRC>,
+			  <&clk IMX8MQ_CLK_USDHC2_DIV>;
+
+	assigned-clock-parents =  <&clk IMX8MQ_SYS1_PLL_400M>,
+				  <0>,
+				  <&clk IMX8MQ_SYS1_PLL_400M>,
+				  <0>;
+
+	assigned-clock-rates = <400000000>,
+			       <200000000>,
+			       <400000000>,
+			       <200000000>;
+};
+
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#5 lore raw

PATCH v3 5/8 ARM: nxp-imx8mq-evk: Add missing compatibility check

In reply to Andrey Smirnov

Add missing compatibility check to imx8mq_evk_mem_init() to prevent it from being executed for other i.MX8MQ boards.

---
 arch/arm/boards/nxp-imx8mq-evk/board.c | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/boards/nxp-imx8mq-evk/board.c +3 -0
index 868c25ebb..3645e5e71 100644
@@ -25,6 +25,9 @@
 
 static int imx8mq_evk_mem_init(void)
 {
+	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
+		return 0;
+
 	arm_add_mem_device("ram0", 0x40000000, SZ_2G);
 
 	request_sdram_region("ATF", 0x40000000, SZ_128K);
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

PATCH v3 6/8 ARM: nxp-imx8mq-evk: Add FEC's PHY configuration code

In reply to Andrey Smirnov

Add appropriate DT and PHY fixup code needed for i.MX8MQ EVK board.

---
 arch/arm/boards/nxp-imx8mq-evk/board.c | 24 ++++++++++++++++++++++++
 arch/arm/dts/imx8mq-evk.dts            |  1 +
 2 files changed, 25 insertions(+)
arch/arm/boards/nxp-imx8mq-evk/board.c +24 -0
index 3645e5e71..aae6970d8 100644
@@ -21,8 +21,30 @@
 #include <init.h>
 #include <asm/memory.h>
 #include <linux/sizes.h>
+#include <linux/phy.h>
 #include <mach/bbu.h>
 
+#include <envfs.h>
+
+#define PHY_ID_AR8031	0x004dd074
+#define AR_PHY_ID_MASK	0xffffffff
+
+static int ar8031_phy_fixup(struct phy_device *phydev)
+{
+	/*
+	 * Enable 1.8V(SEL_1P5_1P8_POS_REG) on
+	 * Phy control debug reg 0
+	 */
+	phy_write(phydev, 0x1d, 0x1f);
+	phy_write(phydev, 0x1e, 0x8);
+
+	/* rgmii tx clock delay enable */
+	phy_write(phydev, 0x1d, 0x05);
+	phy_write(phydev, 0x1e, 0x100);
+
+	return 0;
+}
+
 static int imx8mq_evk_mem_init(void)
 {
 	if (!of_machine_is_compatible("fsl,imx8mq-evk"))
@@ -45,6 +67,8 @@ static int nxp_imx8mq_evk_init(void)
 
 	imx8mq_bbu_internal_mmc_register_handler("eMMC", "/dev/mmc0", 0);
 
+	phy_register_fixup_for_uid(PHY_ID_AR8031, AR_PHY_ID_MASK,
+				   ar8031_phy_fixup);
 	return 0;
 }
 device_initcall(nxp_imx8mq_evk_init);
arch/arm/dts/imx8mq-evk.dts +1 -0
index 3ac13baa1..d6d5d843c 100644
@@ -43,6 +43,7 @@
 	            <&pinctrl_fec1_data_tx>, <&pinctrl_fec1_data_rx>,
 	            <&pinctrl_fec1_phy_reset>;
 	phy-mode = "rgmii-id";
+	phy-reset-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
 	status = "okay";
 };
 
Signature · 7 lines
2.17.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
maintainer Applied
#9 lore raw
In reply to Andrey Smirnov
Quoted 32 lines · Andrey Smirnov

Everyone:

This is a number of i.MX8MQ or EVK related changes that are sitting in my repo that I am hoping to upstream:

- Pactches 1, 3, 4 are clock related fixes needed to get FEC, USDHC1 and USDHC2 to work.

- Patch 2 was made while working custom i.MX8MQ board (not upstreamed yet) that made use of that controller

- Patch 5 should be self-explanatory bug fix

- Patch 6 is PHY configuration code need to use FEC on EVK

- Patch 7 and 8 are both conveninece code to avoid having to specify memory size explicitly as well as a second part of a fix for a problem discussed in [1]

Changes since [v1]:

- Removed redundant DT code in patch 6

Changes since [v2]:

- Patch 7 re-written such that the code could also be re-used for i.MX7 (will be submitted in a separate series)

[1] http://lists.infradead.org/pipermail/barebox/2018-August/034402.html
[v1] http://lists.infradead.org/pipermail/barebox/2018-September/034742.html
[v2] http://lists.infradead.org/pipermail/barebox/2018-September/034772.html

Quoted 9 lines

Andrey Smirnov (8):
clk: i.MX8MQ: Bump refcounters of various important clocks
ARM: i.MX8MQ: Add missing node for ECSPI1
ARM: i.MX8MQ: Configure USDHC1,2 clocks
ARM: i.MX8MQ: Configure FEC1 clocks
ARM: nxp-imx8mq-evk: Add missing compatibility check
ARM: nxp-imx8mq-evk: Add FEC's PHY configuration code
ARM: i.MX: esdctl: Add memory size detection for i.MX8MQ
ARM: nxp-imx8mq-evk: Make use of memory size detection code

Applied, thanks

Sascha

Signature · 9 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 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox