Skip to contentSkip to conversation

cleanup and enhancements for Colibri VFxx

PATCH Superseded Stefan Agner 2 participants 10 messages Nov 30, 2016 – Dec 16, 2016

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

v2 cover cleanup and enhancements for Colibri VFxx

From: Stefan Agner <[email protected]>

This patchset cleans up the board file, speeds up NAND slightly and enhances the board support with device tree MTD partition support.

It also fixes a bug in the new Toradex config block code.

Not sure through which tree that should go, especially since patch 1 and 2 touches common code... Tom?

--
Stefan

Changes in v2:
- Rebased ontop of master (after config block support merged)
- Add patch which uses proper config to guard g_dnl_bind_fixup
- Add patch to fix device tree warning

Stefan Agner (6):
toradex: fix USB Download gadget fixup callback
toradex: allow custom fdt board setup in board file
colibri_vf: use device-tree for MTD partitions
colibri_vf: cleanup USB clock initialization
colibri_vf: use same NAND clock as Linux uses
ARM: dts: vf: Fix warning about missing reg property

 arch/arm/dts/vf.dtsi                          |  2 ++
 board/toradex/apalis_t30/apalis_t30.c         |  8 ++++++
 board/toradex/colibri_imx7/colibri_imx7.c     |  8 ++++++
 board/toradex/colibri_pxa270/colibri_pxa270.c |  8 ++++++
 board/toradex/colibri_t20/colibri_t20.c       |  8 ++++++
 board/toradex/colibri_t30/colibri_t30.c       |  8 ++++++
 board/toradex/colibri_vf/colibri_vf.c         | 37 +++++++++++++++++++++++----
 board/toradex/common/tdx-common.c             | 12 ++++-----
 board/toradex/common/tdx-common.h             |  2 ++
 9 files changed, 81 insertions(+), 12 deletions(-)
Signature · 1 line
2.10.2
#1 lore raw

PATCH v2 1/6 toradex: fix USB Download gadget fixup callback

From: Stefan Agner <[email protected]>

Use the proper config option to guard the USB Download Function fixup callback.

---

Changes in v2: None

 board/toradex/common/tdx-common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
board/toradex/common/tdx-common.c +2 -2
index f1ab794..d418055 100644
@@ -108,7 +108,7 @@ int show_board_info(void)
 	return 0;
 }
 
-#ifdef CONFIG_USBDOWNLOAD_GADGET
+#ifdef CONFIG_USB_GADGET_DOWNLOAD
 int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 {
 	unsigned short usb_pid;
@@ -118,7 +118,7 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 
 	return 0;
 }
-#endif /* CONFIG_USBDOWNLOAD_GADGET */
+#endif
 
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, bd_t *bd)
Signature · 1 line
2.10.2
#2 lore raw

PATCH v2 2/6 toradex: allow custom fdt board setup in board file

In reply to Stefan Agner

From: Stefan Agner <[email protected]>

The config block support currently uses the ft_board_setup function to patch the device tree with config block information. However, this does not allow to patch the device tree with board specific information. Rename the common setup function to ft_common_board_setup and use the call it from the board files directly.

---

Changes in v2: None

 board/toradex/apalis_t30/apalis_t30.c         | 8 ++++++++
 board/toradex/colibri_imx7/colibri_imx7.c     | 8 ++++++++
 board/toradex/colibri_pxa270/colibri_pxa270.c | 8 ++++++++
 board/toradex/colibri_t20/colibri_t20.c       | 8 ++++++++
 board/toradex/colibri_t30/colibri_t30.c       | 8 ++++++++
 board/toradex/colibri_vf/colibri_vf.c         | 8 ++++++++
 board/toradex/common/tdx-common.c             | 8 +++-----
 board/toradex/common/tdx-common.h             | 2 ++
 8 files changed, 53 insertions(+), 5 deletions(-)
board/toradex/apalis_t30/apalis_t30.c +8 -0
index 3d83491..827eefd 100644
@@ -14,6 +14,7 @@
 #include <asm/io.h>
 #include <dm.h>
 #include <i2c.h>
+#include "../common/tdx-common.h"
 
 #include "pinmux-config-apalis_t30.h"
 
@@ -39,6 +40,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
board/toradex/colibri_imx7/colibri_imx7.c +8 -0
index c64e31e..e1340c3 100644
@@ -24,6 +24,7 @@
 #include <power/pmic.h>
 #include <power/rn5t567_pmic.h>
 #include <usb/ehci-ci.h>
+#include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -387,6 +388,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 #ifdef CONFIG_USB_EHCI_MX7
 static iomux_v3_cfg_t const usb_otg2_pads[] = {
 	MX7D_PAD_UART3_CTS_B__USB_OTG2_PWR | MUX_PAD_CTRL(NO_PAD_CTRL),
board/toradex/colibri_pxa270/colibri_pxa270.c +8 -0
index 932b900..8e94854 100644
@@ -18,6 +18,7 @@
 #include <netdev.h>
 #include <serial.h>
 #include <usb.h>
+#include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -43,6 +44,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 int dram_init(void)
 {
 	pxa2xx_dram_init();
board/toradex/colibri_t20/colibri_t20.c +8 -0
index 01b55be..4d298e6 100644
@@ -15,6 +15,7 @@
 #include <asm/io.h>
 #include <i2c.h>
 #include <nand.h>
+#include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -74,6 +75,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 #ifdef CONFIG_TEGRA_MMC
 /*
  * Routine: pin_mux_mmc
board/toradex/colibri_t30/colibri_t30.c +8 -0
index 707d07e..b68d3ca 100644
@@ -14,6 +14,7 @@
 #include <asm/io.h>
 #include <i2c.h>
 #include "pinmux-config-colibri_t30.h"
+#include "../common/tdx-common.h"
 
 int arch_misc_init(void)
 {
@@ -31,6 +32,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 /*
  * Routine: pinmux_init
  * Description: Do individual peripheral pinmux configs
board/toradex/colibri_vf/colibri_vf.c +8 -0
index e65d9c3..86f52c5 100644
@@ -22,6 +22,7 @@
 #include <g_dnl.h>
 #include <asm/gpio.h>
 #include <usb.h>
+#include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -528,6 +529,13 @@ int checkboard(void)
 	return 0;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+	return ft_common_board_setup(blob, bd);
+}
+#endif
+
 #ifdef CONFIG_USB_EHCI_VF
 int board_ehci_hcd_init(int port)
 {
board/toradex/common/tdx-common.c +3 -5
index d418055..2c6fc40 100644
@@ -120,8 +120,8 @@ int g_dnl_bind_fixup(struct usb_device_descriptor *dev, const char *name)
 }
 #endif
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, bd_t *bd)
+#if defined(CONFIG_OF_LIBFDT)
+int ft_common_board_setup(void *blob, bd_t *bd)
 {
 	if (tdx_serial) {
 		fdt_setprop(blob, 0, "serial-number", tdx_serial_str,
@@ -158,11 +158,9 @@ u32 get_board_serial(void)
 }
 #endif /* CONFIG_SERIAL_TAG */
 
-#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, bd_t *bd)
+int ft_common_board_setup(void *blob, bd_t *bd)
 {
 	return 0;
 }
-#endif
 
 #endif /* CONFIG_TDX_CFG_BLOCK */
board/toradex/common/tdx-common.h +2 -0
index f308ebd..f8d78f0 100644
@@ -10,4 +10,6 @@
 #define TORADEX_USB_PRODUCT_NUM_OFFSET	0x4000
 #define TDX_USB_VID			0x1B67
 
+int ft_common_board_setup(void *blob, bd_t *bd);
+
 #endif /* _TDX_COMMON_H */
Signature · 1 line
2.10.2
#3 lore raw

PATCH v2 3/6 colibri_vf: use device-tree for MTD partitions

In reply to Stefan Agner

From: Stefan Agner <[email protected]>

Use device-tree fixup to communicate the MTD partitions to the kernel. U-Boot's mtdparts environment variable will be used as partition source for the device-tree based partition table too.

---

Changes in v2: None

 board/toradex/colibri_vf/colibri_vf.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
board/toradex/colibri_vf/colibri_vf.c +13 -0
index 86f52c5..0f8b440 100644
@@ -15,8 +15,11 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
 #include <mmc.h>
+#include <fdt_support.h>
 #include <fsl_esdhc.h>
+#include <jffs2/load_kernel.h>
 #include <miiphy.h>
+#include <mtd_node.h>
 #include <netdev.h>
 #include <i2c.h>
 #include <g_dnl.h>
@@ -532,6 +535,16 @@ int checkboard(void)
 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
 int ft_board_setup(void *blob, bd_t *bd)
 {
+#ifdef CONFIG_FDT_FIXUP_PARTITIONS
+	static struct node_info nodes[] = {
+		{ "fsl,vf610-nfc", MTD_DEV_TYPE_NAND, }, /* NAND flash */
+	};
+
+	/* Update partition nodes using info from mtdparts env var */
+	puts("   Updating MTD partitions...\n");
+	fdt_fixup_mtdparts(blob, nodes, ARRAY_SIZE(nodes));
+#endif
+
 	return ft_common_board_setup(blob, bd);
 }
 #endif
Signature · 1 line
2.10.2
#4 lore raw

PATCH v2 4/6 colibri_vf: cleanup USB clock initialization

In reply to Stefan Agner

From: Stefan Agner <[email protected]>

Use the same preprocessor define to enable clocks as we use to enable the driver. Make sure that the necessary PLL's are on (they get enabled by boot ROM by default, so this is more for completness).

---

Changes in v2: None

 board/toradex/colibri_vf/colibri_vf.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
board/toradex/colibri_vf/colibri_vf.c +10 -4
index 0f8b440..15f263c 100644
@@ -368,12 +368,18 @@ static void clock_init(void)
 	clrsetbits_le32(&ccm->ccgr10, CCM_REG_CTRL_MASK,
 			CCM_CCGR10_NFC_CTRL_MASK);
 
-#ifdef CONFIG_CI_UDC
+#ifdef CONFIG_USB_EHCI_VF
 	setbits_le32(&ccm->ccgr1, CCM_CCGR1_USBC0_CTRL_MASK);
-#endif
-
-#ifdef CONFIG_USB_EHCI
 	setbits_le32(&ccm->ccgr7, CCM_CCGR7_USBC1_CTRL_MASK);
+
+	clrsetbits_le32(&anadig->pll3_ctrl, ANADIG_PLL3_CTRL_BYPASS |
+			ANADIG_PLL3_CTRL_POWERDOWN |
+			ANADIG_PLL3_CTRL_DIV_SELECT,
+			ANADIG_PLL3_CTRL_ENABLE);
+	clrsetbits_le32(&anadig->pll7_ctrl, ANADIG_PLL7_CTRL_BYPASS |
+			ANADIG_PLL7_CTRL_POWERDOWN |
+			ANADIG_PLL7_CTRL_DIV_SELECT,
+			ANADIG_PLL7_CTRL_ENABLE);
 #endif
 
 	clrsetbits_le32(&anadig->pll5_ctrl, ANADIG_PLL5_CTRL_BYPASS |
Signature · 1 line
2.10.2
#5 lore raw

PATCH v2 5/6 colibri_vf: use same NAND clock as Linux uses

In reply to Stefan Agner

From: Stefan Agner <[email protected]>

Currently a divider of 6 has been used, leading to following NAND Flash Controller (NFC) clocks:
VF61: 27.7 MHz (166.7MHz bus clock)
VF50: 22 MHz (132MHz bus clock)

The NAND Flash Memory used on VF50 allows to use clock speed of up to 33MHz, while the Flash Memory of VF61 allows 50MHz. We can use the same divider of 4 on both modules to configure the maximal possible clock speeds:
VF61: 41.7 MHz
VF50: 33 MHz

---

Changes in v2: None

 board/toradex/colibri_vf/colibri_vf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/toradex/colibri_vf/colibri_vf.c +1 -1
index 15f263c..7b74eb7 100644
@@ -428,7 +428,7 @@ static void clock_init(void)
 			CCM_CSCDR2_ESDHC1_EN | CCM_CSCDR2_ESDHC1_CLK_DIV(0) |
 			CCM_CSCDR2_NFC_EN);
 	clrsetbits_le32(&ccm->cscdr3, CCM_REG_CTRL_MASK,
-			CCM_CSCDR3_NFC_PRE_DIV(5));
+			CCM_CSCDR3_NFC_PRE_DIV(3));
 	clrsetbits_le32(&ccm->cscmr2, CCM_REG_CTRL_MASK,
 			CCM_CSCMR2_RMII_CLK_SEL(2));
 }
Signature · 1 line
2.10.2
#6 lore raw

PATCH v2 6/6 ARM: dts: vf: Fix warning about missing reg property

In reply to Stefan Agner

From: Stefan Agner <[email protected]>

Add proper reg values for the two AIPS bus nodes. This avoids this two warnings:
Node /soc/aips-bus at 40000000 has a unit name, but no reg property Node /soc/aips-bus at 40080000 has a unit name, but no reg property

---

Changes in v2:
- Rebased ontop of master (after config block support merged)
- Add patch which uses proper config to guard g_dnl_bind_fixup
- Add patch to fix device tree warning

 arch/arm/dts/vf.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/vf.dtsi +2 -0
index 000aff2..477d8de 100644
@@ -35,6 +35,7 @@
 			compatible = "fsl,aips-bus", "simple-bus";
 			#address-cells = <1>;
 			#size-cells = <1>;
+			reg = <0x40000000 0x00070000>;
 			ranges;
 
 			uart0: serial at 40027000 {
@@ -130,6 +131,7 @@
 			compatible = "fsl,aips-bus", "simple-bus";
 			#address-cells = <1>;
 			#size-cells = <1>;
+			reg = <0x40080000 0x0007f000>;
 			ranges;
 
 			uart4: serial at 400a9000 {
Signature · 1 line
2.10.2
#7 lore raw

v2 cover cleanup and enhancements for Colibri VFxx

In reply to Stefan Agner
Quoted 10 lines · Stefan Agner

From: Stefan Agner <[email protected]>

This patchset cleans up the board file, speeds up NAND slightly and enhances the board support with device tree MTD partition support.

It also fixes a bug in the new Toradex config block code.

Not sure through which tree that should go, especially since patch 1 and 2 touches common code... Tom?

Anything holding us back merging this?

--
Stefan

Quoted 27 lines

--
Stefan

Changes in v2:
- Rebased ontop of master (after config block support merged)
- Add patch which uses proper config to guard g_dnl_bind_fixup
- Add patch to fix device tree warning

Stefan Agner (6):
toradex: fix USB Download gadget fixup callback
toradex: allow custom fdt board setup in board file
colibri_vf: use device-tree for MTD partitions
colibri_vf: cleanup USB clock initialization
colibri_vf: use same NAND clock as Linux uses
ARM: dts: vf: Fix warning about missing reg property

 arch/arm/dts/vf.dtsi                          |  2 ++
 board/toradex/apalis_t30/apalis_t30.c         |  8 ++++++
 board/toradex/colibri_imx7/colibri_imx7.c     |  8 ++++++
 board/toradex/colibri_pxa270/colibri_pxa270.c |  8 ++++++
 board/toradex/colibri_t20/colibri_t20.c       |  8 ++++++
 board/toradex/colibri_t30/colibri_t30.c       |  8 ++++++
 board/toradex/colibri_vf/colibri_vf.c         | 37 +++++++++++++++++++++++----
 board/toradex/common/tdx-common.c             | 12 ++++-----
 board/toradex/common/tdx-common.h             |  2 ++
 9 files changed, 81 insertions(+), 12 deletions(-)
#8 lore raw

v2 cover cleanup and enhancements for Colibri VFxx

Hi Stefan,

Quoted 7 lines · Stefan Agner
Quoted 6 lines · Stefan Agner

From: Stefan Agner <[email protected]>

This patchset cleans up the board file, speeds up NAND slightly and enhances the board support with device tree MTD partition support.

Quoted 6 lines
Quoted 4 lines

It also fixes a bug in the new Toradex config block code.

Not sure through which tree that should go, especially since patch 1 and 2 touches common code... Tom?

Anything holding us back merging this?

I take care of this.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#9 lore raw

v2 cover cleanup and enhancements for Colibri VFxx

In reply to Stefan Agner
Quoted 27 lines · Stefan Agner

From: Stefan Agner <[email protected]>

This patchset cleans up the board file, speeds up NAND slightly and enhances the board support with device tree MTD partition support.

It also fixes a bug in the new Toradex config block code.

Not sure through which tree that should go, especially since patch 1 and 2 touches common code... Tom?

--
Stefan

Changes in v2:
- Rebased ontop of master (after config block support merged)
- Add patch which uses proper config to guard g_dnl_bind_fixup
- Add patch to fix device tree warning

Stefan Agner (6):
toradex: fix USB Download gadget fixup callback
toradex: allow custom fdt board setup in board file
colibri_vf: use device-tree for MTD partitions
colibri_vf: cleanup USB clock initialization
colibri_vf: use same NAND clock as Linux uses
ARM: dts: vf: Fix warning about missing reg property

Quoted 11 lines
 arch/arm/dts/vf.dtsi                          |  2 ++
 board/toradex/apalis_t30/apalis_t30.c         |  8 ++++++
 board/toradex/colibri_imx7/colibri_imx7.c     |  8 ++++++
 board/toradex/colibri_pxa270/colibri_pxa270.c |  8 ++++++
 board/toradex/colibri_t20/colibri_t20.c       |  8 ++++++
 board/toradex/colibri_t30/colibri_t30.c       |  8 ++++++
 board/toradex/colibri_vf/colibri_vf.c         | 37 +++++++++++++++++++++++----
 board/toradex/common/tdx-common.c             | 12 ++++-----
 board/toradex/common/tdx-common.h             |  2 ++
 9 files changed, 81 insertions(+), 12 deletions(-)

Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================