Toradex config cleanup and Colibri iMX7 enhencements
cover Toradex config cleanup and Colibri iMX7 enhencements
From: Stefan Agner <[email protected]>
The first two patches are common to all our modules, the next is touching all our NXP based modules and the rest of the patches are Colibri iMX7 related. Since all patches touch defconfig splitting them would lead to merge issues, so I kept them in a single patch set. Can this still go through your tree Stefano, including the first two patches?
The patchset is build tested for all our modules and run tested on Colibri iMX7.
--
Stefan
Stefan Agner (7):
toradex apalis/colibri: use common USB product id fallback toradex apalis/colibri: add device tree overlay support colibri_imx7/colibri_imx6/apalis_imx6: limit bootm memory
colibri_imx7: implement board level USB PHY mode
colibri_imx7: setup PMIC sleep mode configuration
colibri_imx7: use device-tree for MTD partitions
colibri_imx7: split and resize firmware MTD partition
board/toradex/colibri_imx7/colibri_imx7.c | 57 +++++++++++++++++++++++++++++++ configs/apalis_imx6_defconfig | 3 +- configs/apalis_t30_defconfig | 7 ++-- configs/colibri_imx6_defconfig | 3 +- configs/colibri_imx6_nospl_defconfig | 2 +- configs/colibri_imx7_defconfig | 4 ++- configs/colibri_t20_defconfig | 7 ++-- configs/colibri_t30_defconfig | 7 ++-- configs/colibri_vf_defconfig | 3 +- include/configs/apalis_imx6.h | 1 + include/configs/colibri_imx6.h | 1 + include/configs/colibri_imx7.h | 9 +++-- 12 files changed, 87 insertions(+), 17 deletions(-)
Signature · 1 line
2.12.0
PATCH 1/7 toradex apalis/colibri: use common USB product id fallback
From: Stefan Agner <[email protected]>
All modules use the common g_dnl_bind_fixup implementaton which calculates the PID according to product id (read from the config block) plus offset of 0x4000. In case there is no config block support (e.g. SPL) or in case the config block is not readable, fall back to a generic product id (product id 0, which can be interpreted as "Unknown Module").
---
configs/apalis_imx6_defconfig | 2 +- configs/apalis_t30_defconfig | 6 +++--- configs/colibri_imx6_defconfig | 2 +- configs/colibri_imx6_nospl_defconfig | 2 +- configs/colibri_imx7_defconfig | 2 +- configs/colibri_t20_defconfig | 6 +++--- configs/colibri_t30_defconfig | 6 +++--- configs/colibri_vf_defconfig | 2 +- 8 files changed, 14 insertions(+), 14 deletions(-)
configs/apalis_imx6_defconfig +1 -1
@@ -46,6 +46,6 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 -CONFIG_G_DNL_PRODUCT_NUM=0x4020 +CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT=y # CONFIG_EFI_LOADER is not set
configs/apalis_t30_defconfig +3 -3
@@ -41,6 +41,6 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y -CONFIG_G_DNL_MANUFACTURER="NVIDIA" -CONFIG_G_DNL_VENDOR_NUM=0x0955 -CONFIG_G_DNL_PRODUCT_NUM=0x701a +CONFIG_G_DNL_MANUFACTURER="Toradex" +CONFIG_G_DNL_VENDOR_NUM=0x1b67 +CONFIG_G_DNL_PRODUCT_NUM=0x4000
configs/colibri_imx6_defconfig +1 -1
@@ -46,6 +46,6 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 -CONFIG_G_DNL_PRODUCT_NUM=0x4020 +CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT=y # CONFIG_EFI_LOADER is not set
configs/colibri_imx6_nospl_defconfig +1 -1
@@ -38,6 +38,6 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 -CONFIG_G_DNL_PRODUCT_NUM=0x4020 +CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT=y # CONFIG_EFI_LOADER is not set
configs/colibri_imx7_defconfig +1 -1
@@ -53,4 +53,4 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 -CONFIG_G_DNL_PRODUCT_NUM=0x4020 +CONFIG_G_DNL_PRODUCT_NUM=0x4000
configs/colibri_t20_defconfig +3 -3
@@ -46,9 +46,9 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y -CONFIG_G_DNL_MANUFACTURER="NVIDIA" -CONFIG_G_DNL_VENDOR_NUM=0x0955 -CONFIG_G_DNL_PRODUCT_NUM=0x701a +CONFIG_G_DNL_MANUFACTURER="Toradex" +CONFIG_G_DNL_VENDOR_NUM=0x1b67 +CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_DM_VIDEO=y CONFIG_VIDEO_TEGRA20=y CONFIG_CONSOLE_SCROLL_LINES=10
configs/colibri_t30_defconfig +3 -3
@@ -36,6 +36,6 @@ CONFIG_USB_STORAGE=y CONFIG_USB_GADGET=y CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y -CONFIG_G_DNL_MANUFACTURER="NVIDIA" -CONFIG_G_DNL_VENDOR_NUM=0x0955 -CONFIG_G_DNL_PRODUCT_NUM=0x701a +CONFIG_G_DNL_MANUFACTURER="Toradex" +CONFIG_G_DNL_VENDOR_NUM=0x1b67 +CONFIG_G_DNL_PRODUCT_NUM=0x4000
configs/colibri_vf_defconfig +1 -1
@@ -48,4 +48,4 @@ CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 -CONFIG_G_DNL_PRODUCT_NUM=0x0016 +CONFIG_G_DNL_PRODUCT_NUM=0x4000
Signature · 1 line
2.12.0
PATCH 2/7 toradex apalis/colibri: add device tree overlay support
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Device tree overlays might prove useful in the future, enable it by default on all Toradex modules.
---
configs/apalis_imx6_defconfig | 1 + configs/apalis_t30_defconfig | 1 + configs/colibri_imx6_defconfig | 1 + configs/colibri_imx7_defconfig | 1 + configs/colibri_t20_defconfig | 1 + configs/colibri_t30_defconfig | 1 + configs/colibri_vf_defconfig | 1 + 7 files changed, 7 insertions(+)
configs/apalis_imx6_defconfig +1 -0
@@ -48,4 +48,5 @@ CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT=y +CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER is not set
configs/apalis_t30_defconfig +1 -0
@@ -44,3 +44,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 +CONFIG_OF_LIBFDT_OVERLAY=y
configs/colibri_imx6_defconfig +1 -0
@@ -48,4 +48,5 @@ CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT=y +CONFIG_OF_LIBFDT_OVERLAY=y # CONFIG_EFI_LOADER is not set
configs/colibri_imx7_defconfig +1 -0
@@ -54,3 +54,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 +CONFIG_OF_LIBFDT_OVERLAY=y
configs/colibri_t20_defconfig +1 -0
@@ -52,3 +52,4 @@ CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_DM_VIDEO=y CONFIG_VIDEO_TEGRA20=y CONFIG_CONSOLE_SCROLL_LINES=10 +CONFIG_OF_LIBFDT_OVERLAY=y
configs/colibri_t30_defconfig +1 -0
@@ -39,3 +39,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 +CONFIG_OF_LIBFDT_OVERLAY=y
configs/colibri_vf_defconfig +1 -0
@@ -49,3 +49,4 @@ CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 +CONFIG_OF_LIBFDT_OVERLAY=y
Signature · 1 line
2.12.0
PATCH 3/7 colibri_imx7/colibri_imx6/apalis_imx6: limit bootm memory
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Limit memory used for relocation of FDT or initrd. This is required to make sure that relocated artifacts are within lowmem. If fdt_high or initrd_high are not set, U-Boot automatically relocates artifacts to the end of memory. But this area won't be part of lowmem and hence will not be accessible by the kernel during early boot.
With VM split set to 2G/2G (i.MX default), only the 2GB Apalis iMX6 is affected by that issue. With VM split set to 3G/1G (ARM default) also modules with 1GB of memory are affected. With the latter the amount of lowmem will be 760MiB.
The value must also not exceed available memory! Use a safe value of 512MiB for Apalis and 256MiB for Colibri.
---
include/configs/apalis_imx6.h | 1 + include/configs/colibri_imx6.h | 1 + include/configs/colibri_imx7.h | 1 + 3 files changed, 3 insertions(+)
include/configs/apalis_imx6.h +1 -0
@@ -197,6 +197,7 @@"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0" #define MEM_LAYOUT_ENV_SETTINGS \ +"bootm_size=0x20000000\0" \"fdt_addr_r=0x12000000\0" \"fdt_high=0xffffffff\0" \"initrd_high=0xffffffff\0" \
include/configs/colibri_imx6.h +1 -0
@@ -172,6 +172,7 @@"${fdt_file} && setenv dtbparam \" - ${fdt_addr_r}\" && true\0" #define MEM_LAYOUT_ENV_SETTINGS \ +"bootm_size=0x10000000\0" \"fdt_addr_r=0x12000000\0" \"fdt_high=0xffffffff\0" \"initrd_high=0xffffffff\0" \
include/configs/colibri_imx7.h +1 -0
@@ -61,6 +61,7 @@#define CONFIG_SERVERIP 192.168.10.1#define MEM_LAYOUT_ENV_SETTINGS \ + "bootm_size=0x10000000\0" \ "fdt_addr_r=0x82000000\0" \ "fdt_high=0xffffffff\0" \ "initrd_high=0xffffffff\0" \
Signature · 1 line
2.12.0
PATCH 4/7 colibri_imx7: implement board level USB PHY mode
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Implement board level USB PHY mode callback. On USB OTG Port 1 the Colibri standard foresees GPIO USBC_DET to decide whether the port should run in Host or Device mode.
---
board/toradex/colibri_imx7/colibri_imx7.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
board/toradex/colibri_imx7/colibri_imx7.c +28 -0
@@ -23,6 +23,7 @@#include <netdev.h> #include <power/pmic.h> #include <power/rn5t567_pmic.h> +#include <usb.h> #include <usb/ehci-ci.h> #include "../common/tdx-common.h"
@@ -46,6 +47,8 @@ DECLARE_GLOBAL_DATA_PTR;#define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM) +#define USB_CDET_GPIO IMX_GPIO_NR(7, 14) +int dram_init (void ) { gd->ram_size =get_ram_size ((void *)PHYS_SDRAM ,PHYS_SDRAM_SIZE );
@@ -71,6 +74,12 @@ static iomux_v3_cfg_t const usdhc1_pads[] = { MX7D_PAD_GPIO1_IO00__GPIO1_IO0 | MUX_PAD_CTRL(NO_PAD_CTRL), }; +#ifdef CONFIG_USB_EHCI_MX7 +static iomux_v3_cfg_t const usb_cdet_pads[] = { +MX7D_PAD_ENET1_CRS__GPIO7_IO14 |MUX_PAD_CTRL (NO_PAD_CTRL ), +}; +#endif +#ifdef CONFIG_NAND_MXS static iomux_v3_cfg_t const gpmi_pads[] = { MX7D_PAD_SD3_DATA0__NAND_DATA00 | MUX_PAD_CTRL(NAND_PAD_CTRL),
@@ -319,6 +328,11 @@ int board_init(void)setup_lcd ();#endif +#ifdef CONFIG_USB_EHCI_MX7 +imx_iomux_v3_setup_multiple_pads (usb_cdet_pads,ARRAY_SIZE (usb_cdet_pads)); +gpio_request (USB_CDET_GPIO ,"usb-cdet-gpio" ); +#endif +return 0 ; }
@@ -417,4 +431,18 @@ int board_ehci_hcd_init(int port) }return 0 ; } + +int board_usb_phy_mode (int port) +{ +switch (port) { +case 0 : +if (gpio_get_value (USB_CDET_GPIO )) +return USB_INIT_DEVICE ; +else +return USB_INIT_HOST ; +case 1 : +default : +return USB_INIT_HOST ; + } +}#endif
Signature · 1 line
2.12.0
PATCH 5/7 colibri_imx7: setup PMIC sleep mode configuration
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Disable 3.3V Ethernet and ARM rail when entering sleep mode.
---
board/toradex/colibri_imx7/colibri_imx7.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
board/toradex/colibri_imx7/colibri_imx7.c +16 -0
@@ -373,6 +373,22 @@ int power_init_board(void)/* set judge and press timer of N_OE to minimal values */ pmic_clrsetbits (dev,RN5T567_NOETIMSETCNT ,0x7 ,0 ); +/* configure sleep slot for 3.3V Ethernet */ + reg =pmic_reg_read (dev,RN5T567_LDO1_SLOT ); + reg = (reg &0xf0 ) | reg >>4 ; +pmic_reg_write (dev,RN5T567_LDO1_SLOT , reg); + +/* disable DCDC2 discharge to avoid backfeeding through VFB2 */ +pmic_clrsetbits (dev,RN5T567_DC2CTL ,0x2 ,0 ); + +/* configure sleep slot for ARM rail */ + reg =pmic_reg_read (dev,RN5T567_DC2_SLOT ); + reg = (reg &0xf0 ) | reg >>4 ; +pmic_reg_write (dev,RN5T567_DC2_SLOT , reg); + +/* disable LDO2 discharge to avoid backfeeding from +V3.3_SD */ +pmic_clrsetbits (dev,RN5T567_LDODIS1 ,0x2 ,0 ); +return 0 ; }
Signature · 1 line
2.12.0
PATCH 6/7 colibri_imx7: use device-tree for MTD partitions
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Use device-tree fixup to communicate the MTD partitions to the kernel. Remove mtdparts from the kernel command line.
---
board/toradex/colibri_imx7/colibri_imx7.c | 13 +++++++++++++ configs/colibri_imx7_defconfig | 1 + include/configs/colibri_imx7.h | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-)
board/toradex/colibri_imx7/colibri_imx7.c +13 -0
@@ -16,10 +16,13 @@#include <common.h> #include <dm.h> #include <dm/platform_data/serial_mxc.h> +#include <fdt_support.h> #include <fsl_esdhc.h> +#include <jffs2/load_kernel.h> #include <linux/sizes.h> #include <mmc.h> #include <miiphy.h> +#include <mtd_node.h> #include <netdev.h> #include <power/pmic.h> #include <power/rn5t567_pmic.h>
@@ -421,6 +424,16 @@ int checkboard(void)#if defined(CONFIG_OF_LIBFDT ) && defined(CONFIG_OF_BOARD_SETUP )int ft_board_setup (void *blob,bd_t *bd) { +#if defined(CONFIG_FDT_FIXUP_PARTITIONS ) +static struct node_info nodes[] = { + {"fsl,imx7d-gpmi-nand" ,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
configs/colibri_imx7_defconfig +1 -0
@@ -55,3 +55,4 @@ CONFIG_G_DNL_MANUFACTURER="Toradex" CONFIG_G_DNL_VENDOR_NUM=0x1b67 CONFIG_G_DNL_PRODUCT_NUM=0x4000 CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_FDT_FIXUP_PARTITIONS=y
include/configs/colibri_imx7.h +1 -1
@@ -120,7 +120,7 @@"${board}/flash_blk.img && source ${loadaddr}\0" \"setup=setenv setupargs " \"console=tty1 console=${console}" \ -",${baudrate}n8 ${memargs} consoleblank=0 ${mtdparts}\0" \ +",${baudrate}n8 ${memargs} consoleblank=0\0" \"setupdate=run setsdupdate || run setusbupdate || run setethupdate\0" \"setusbupdate=usb start && setenv interface usb && " \"fatload ${interface} 0:1 ${loadaddr} " \
Signature · 1 line
2.12.0
PATCH 7/7 colibri_imx7: split and resize firmware MTD partition
In reply to Stefan AgnerFrom: Stefan Agner <[email protected]>
Use two separate partitions for the two firmware instances. Also resize them to be of the same size which also makes the start of the UBI partition nicely aligned to 0x400000.
In order to detect the new MTD layout and whether we run a U-Boot with the new BCB format or not, introduce a variable called "updlevel" which we can use in update/upgrade scripts.
---
include/configs/colibri_imx7.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/configs/colibri_imx7.h +4 -2
@@ -127,6 +127,7 @@"${board}/flash_blk.img && source ${loadaddr}\0" \"splashpos=m,m\0" \"videomode=video=ctfb:x:640,y:480,depth:18,pclk:39722,le:48,ri:16,up:33,lo:10,hs:96,vs:2,sync:0,vmode:0\0" \ +"updlevel=2\0" /* Miscellaneous configurable options */ #define CONFIG_SYS_LONGHELP
@@ -161,8 +162,8 @@#define CONFIG_MMCROOT "/dev/mmcblk0p2"/* USDHC1 */ #define CONFIG_ENV_OFFSET (8 * SZ_64K)#elif defined(CONFIG_ENV_IS_IN_NAND ) -#define CONFIG_ENV_OFFSET (4 * 1024 * 1024)#define CONFIG_ENV_SECT_SIZE (128 * 1024) +#define CONFIG_ENV_OFFSET (28 * CONFIG_ENV_SECT_SIZE)#define CONFIG_ENV_SIZE CONFIG_ENV_SECT_SIZE#endif
@@ -189,7 +190,8 @@#define MTDIDS_DEFAULT "nand0=gpmi-nand"#define MTDPARTS_DEFAULT "mtdparts=gpmi-nand:" \ "512k(mx7-bcb)," \ - "3584k(u-boot)ro," \ + "1536k(u-boot1)ro," \ + "1536k(u-boot2)ro," \ "512k(u-boot-env)," \ "-(ubi)"
Signature · 1 line
2.12.0
cover Toradex config cleanup and Colibri iMX7 enhencements
In reply to Stefan AgnerQuoted 25 lines · Stefan Agner
From: Stefan Agner <[email protected]>
The first two patches are common to all our modules, the next is touching all our NXP based modules and the rest of the patches are Colibri iMX7 related. Since all patches touch defconfig splitting them would lead to merge issues, so I kept them in a single patch set. Can this still go through your tree Stefano, including the first two patches?
The patchset is build tested for all our modules and run tested on Colibri iMX7.
--
StefanStefan Agner (7):
toradex apalis/colibri: use common USB product id fallback toradex apalis/colibri: add device tree overlay support colibri_imx7/colibri_imx6/apalis_imx6: limit bootm memory
colibri_imx7: implement board level USB PHY mode
colibri_imx7: setup PMIC sleep mode configuration
colibri_imx7: use device-tree for MTD partitions
colibri_imx7: split and resize firmware MTD partition
Quoted 14 lines
board/toradex/colibri_imx7/colibri_imx7.c | 57 +++++++++++++++++++++++++++++++ configs/apalis_imx6_defconfig | 3 +- configs/apalis_t30_defconfig | 7 ++-- configs/colibri_imx6_defconfig | 3 +- configs/colibri_imx6_nospl_defconfig | 2 +- configs/colibri_imx7_defconfig | 4 ++- configs/colibri_t20_defconfig | 7 ++-- configs/colibri_t30_defconfig | 7 ++-- configs/colibri_vf_defconfig | 3 +- include/configs/apalis_imx6.h | 1 + include/configs/colibri_imx6.h | 1 + include/configs/colibri_imx7.h | 9 +++-- 12 files changed, 87 insertions(+), 17 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 =====================================================================