ARM: dts: imx: dh-imx6: Import DHCOM iMX6 PDK2 DTs from Linux
PATCH 1/8 ARM: dts: imx: dh-imx6: Import DHCOM iMX6 PDK2 DTs from Linux
Import DHCOM iMX6 PDK2 device tree from Linux 5.1.1 b724e9356404 . Enable DT control in full U-Boot .
--- arch/arm/dts/Makefile | 3 +- arch/arm/dts/imx6q-dhcom-pdk2.dts | 151 ++++++++++ arch/arm/dts/imx6q-dhcom-som.dtsi | 477 ++++++++++++++++++++++++++++++ configs/dh_imx6_defconfig | 3 +- 4 files changed, 632 insertions(+), 2 deletions(-) create mode 100644 arch/arm/dts/imx6q-dhcom-pdk2.dts create mode 100644 arch/arm/dts/imx6q-dhcom-som.dtsi
arch/arm/dts/Makefile +2 -1
@@ -585,7 +585,8 @@ dtb-$(CONFIG_MX6ULL) += \ imx6ull-dart-6ul.dtb dtb-$(CONFIG_ARCH_MX6) += \ - imx6-colibri.dtb + imx6-colibri.dtb \ + imx6q-dhcom-pdk2.dtb dtb-$(CONFIG_MX7) += imx7d-sdb.dtb \ imx7d-sdb-qspi.dtb \
arch/arm/dts/imx6q-dhcom-pdk2.dts new file +151 -0
151 lines not on this page · raw message
arch/arm/dts/imx6q-dhcom-som.dtsi new file +477 -0
477 lines not on this page · raw message
configs/dh_imx6_defconfig +2 -1
@@ -36,6 +36,8 @@ CONFIG_CMD_USB_MASS_STORAGE=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT4_WRITE=y +CONFIG_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="imx6q-dhcom-pdk2" CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_DWC_AHSATA=y CONFIG_BOOTCOUNT_LIMIT=y
@@ -63,4 +65,3 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0xa4a5 CONFIG_CI_UDC=y CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_IMX_WATCHDOG=y -CONFIG_OF_LIBFDT=y
Signature · 1 line
2.20.1
PATCH 2/8 ARM: dts: imx: dh-imx6: Fix SPI CS polarity on DHCOM iMX6 PDK2
The SPI nCS signal is active low, make it so.
--- arch/arm/dts/imx6q-dhcom-som.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/dts/imx6q-dhcom-som.dtsi +1 -1
@@ -61,7 +61,7 @@ }; &ecspi1 { - cs-gpios = <&gpio2 30 GPIO_ACTIVE_HIGH>, <&gpio4 11 GPIO_ACTIVE_HIGH>; + cs-gpios = <&gpio2 30 GPIO_ACTIVE_LOW>, <&gpio4 11 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_ecspi1>; status = "okay";
Signature · 1 line
2.20.1
PATCH 3/8 ARM: imx: dh-imx6: Enable DM pin control
In reply to Marek VasutEnable DM pin control support on DHCOM iMX6 PDK2.
--- configs/dh_imx6_defconfig | 3 +++ 1 file changed, 3 insertions(+)
configs/dh_imx6_defconfig +3 -0
@@ -12,6 +12,7 @@ CONFIG_SPL=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y CONFIG_DISTRO_DEFAULTS=y +# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" CONFIG_BOOTDELAY=3
@@ -55,6 +56,8 @@ CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y CONFIG_FEC_MXC=y CONFIG_MII=y +CONFIG_PINCTRL=y +CONFIG_PINCTRL_IMX6=y CONFIG_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y
Signature · 1 line
2.20.1
PATCH 4/8 ARM: imx: dh-imx6: Enable DM GPIO
In reply to Marek VasutEnable DM GPIO support on DHCOM iMX6 PDK2 and fix up board code where applicable.
--- board/dhelectronics/dh_imx6/dh_imx6.c | 10 ++++++++++ configs/dh_imx6_defconfig | 1 + 2 files changed, 11 insertions(+)
board/dhelectronics/dh_imx6/dh_imx6.c +10 -0
@@ -167,6 +167,9 @@ int board_eth_init(bd_t *bis)struct mii_dev *bus =NULL ;struct phy_device *phydev =NULL ; +gpio_request (IMX_GPIO_NR (5 ,0 ),"PHY-reset" ); +gpio_request (IMX_GPIO_NR (1 ,7 ),"VIO" ); +setup_fec_clock ();eth_phy_reset ();
@@ -224,6 +227,8 @@ int board_mmc_init(bd_t *bis)* mmc1 micro SD * mmc2 eMMC */ +gpio_request (USDHC2_CD_GPIO ,"SD2-CD" ); +gpio_request (USDHC3_CD_GPIO ,"SD3-CD" );gpio_direction_input (USDHC2_CD_GPIO );gpio_direction_input (USDHC3_CD_GPIO );
@@ -244,6 +249,7 @@ int board_mmc_init(bd_t *bis)#ifdef CONFIG_USB_EHCI_MX6 static void setup_usb (void ) { +gpio_request (IMX_GPIO_NR (3 ,31 ),"USB-VBUS" );/* * Set daisy chain for otg_pin_id on MX6Q. * For MX6DL, this bit is reserved.
@@ -379,6 +385,10 @@ static int board_get_hwcode(void) {int hw_code; +gpio_request (HW_CODE_BIT_0 ,"HW-code-bit-0" ); +gpio_request (HW_CODE_BIT_1 ,"HW-code-bit-1" ); +gpio_request (HW_CODE_BIT_2 ,"HW-code-bit-2" ); +gpio_direction_input (HW_CODE_BIT_0 );gpio_direction_input (HW_CODE_BIT_1 );gpio_direction_input (HW_CODE_BIT_2 );
configs/dh_imx6_defconfig +1 -0
@@ -43,6 +43,7 @@ CONFIG_ENV_IS_IN_SPI_FLASH=y CONFIG_DWC_AHSATA=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000 +CONFIG_DM_GPIO=y CONFIG_FSL_ESDHC=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0
Signature · 1 line
2.20.1
PATCH 5/8 ARM: imx: dh-imx6: Convert SD/MMC support to DM
In reply to Marek VasutEnable DM block and DM MMC support on DHCOM iMX6 PDK2. Convert board code to match the DM support.
--- board/dhelectronics/dh_imx6/dh_imx6.c | 59 +-------------------------- configs/dh_imx6_defconfig | 1 + 2 files changed, 3 insertions(+), 57 deletions(-)
board/dhelectronics/dh_imx6/dh_imx6.c +2 -57
@@ -6,6 +6,8 @@*/ #include <common.h> +#include <dm.h> +#include <dm/device-internal.h> #include <asm/arch/clock.h> #include <asm/arch/crm_regs.h> #include <asm/arch/imx-regs.h>
@@ -189,63 +191,6 @@ int board_eth_init(bd_t *bis) }#endif -#ifdef CONFIG_FSL_ESDHC - -#define USDHC2_CD_GPIO IMX_GPIO_NR(6, 16) -#define USDHC3_CD_GPIO IMX_GPIO_NR(7, 8) - -static struct fsl_esdhc_cfg usdhc_cfg[3 ] = { - {USDHC2_BASE_ADDR }, - {USDHC3_BASE_ADDR }, - {USDHC4_BASE_ADDR }, -}; - -int board_mmc_getcd (struct mmc *mmc) -{ -struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; - -switch (cfg->esdhc_base) { -case USDHC2_BASE_ADDR : -return gpio_get_value (USDHC2_CD_GPIO ); -case USDHC3_BASE_ADDR : -return !gpio_get_value (USDHC3_CD_GPIO ); -case USDHC4_BASE_ADDR : -return 1 ;/* eMMC/uSDHC4 is always present */ - } - -return 0 ; -} - -int board_mmc_init (bd_t *bis) -{ -int i, ret; - -/* -* According to the board_mmc_init() the following map is done: -* (U-Boot device node) (Physical Port) -* mmc0 SD interface -* mmc1 micro SD -* mmc2 eMMC -*/ -gpio_request (USDHC2_CD_GPIO ,"SD2-CD" ); -gpio_request (USDHC3_CD_GPIO ,"SD3-CD" ); -gpio_direction_input (USDHC2_CD_GPIO ); -gpio_direction_input (USDHC3_CD_GPIO ); - - usdhc_cfg[0 ].sdhc_clk =mxc_get_clock (MXC_ESDHC2_CLK ); - usdhc_cfg[1 ].sdhc_clk =mxc_get_clock (MXC_ESDHC3_CLK ); - usdhc_cfg[2 ].sdhc_clk =mxc_get_clock (MXC_ESDHC4_CLK ); - -for (i =0 ; i <CONFIG_SYS_FSL_USDHC_NUM ; i++) { - ret =fsl_esdhc_initialize (bis, &usdhc_cfg[i]); -if (ret) -return ret; - } - -return 0 ; -} -#endif -#ifdef CONFIG_USB_EHCI_MX6 static void setup_usb (void ) {
configs/dh_imx6_defconfig +1 -0
@@ -44,6 +44,7 @@ CONFIG_DWC_AHSATA=y CONFIG_BOOTCOUNT_LIMIT=y CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000 CONFIG_DM_GPIO=y +CONFIG_DM_MMC=y CONFIG_FSL_ESDHC=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0
Signature · 1 line
2.20.1
PATCH 6/8 ARM: imx: dh-imx6: Convert SATA support to DM
In reply to Marek VasutEnable DM SATA support on DHCOM iMX6 PDK2. Convert board code to match the DM support.
--- board/dhelectronics/dh_imx6/dh_imx6.c | 55 +++++++++++++++++++++++++-- configs/dh_imx6_defconfig | 2 + include/configs/dh_imx6.h | 5 --- 3 files changed, 53 insertions(+), 9 deletions(-)
board/dhelectronics/dh_imx6/dh_imx6.c +51 -4
@@ -20,6 +20,8 @@#include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/mach-imx/sata.h> +#include <ahci.h> +#include <dwc_ahsata.h> #include <environment.h> #include <errno.h> #include <fsl_esdhc.h>
@@ -302,10 +304,6 @@ int board_init(void) }#endif -#ifdef CONFIG_SATA -setup_sata (); -#endif -setup_dhcom_mac_from_fuse ();return 0 ;
@@ -384,3 +382,52 @@ int checkboard(void)puts ("Board: DHCOM i.MX6\n" );return 0 ; } + +#if CONFIG_IS_ENABLED (AHCI ) +static int sata_imx_probe (struct udevice *dev) +{ +int i, err; + +for (i =0 ; i <10 ; i++) { + err =setup_sata (); +if (err) { +printf ("SATA setup failed: %d\n" , err); +return err; + } + +udelay (100 ); + + err =dwc_ahsata_probe (dev); +if (!err) +break ; + +/* There is no device on the SATA port */ +if (sata_dm_port_status (0 ,0 ) ==0 ) +break ; + +/* There's a device, but link not established. Retry */ +device_remove (dev,DM_REMOVE_NORMAL ); + } + +return 0 ; +} + +struct ahci_ops sata_imx_ops = { + .port_status = dwc_ahsata_port_status, + .reset = dwc_ahsata_bus_reset, + .scan = dwc_ahsata_scan, +}; + +static const struct udevice_id sata_imx_ids[] = { + { .compatible ="fsl,imx6q-ahci" }, + { } +}; + +U_BOOT_DRIVER (sata_imx) = { + .name ="dwc_ahci" , + .id =UCLASS_AHCI , + .of_match = sata_imx_ids, + .ops = &sata_imx_ops, + .probe = sata_imx_probe, +}; +#endif /* AHCI */
configs/dh_imx6_defconfig +2 -0
@@ -11,6 +11,7 @@ CONFIG_NR_DRAM_BANKS=1 CONFIG_SPL=y CONFIG_SPL_SPI_FLASH_SUPPORT=y CONFIG_SPL_SPI_SUPPORT=y +CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y # CONFIG_SYS_MALLOC_F is not set CONFIG_FIT=y
@@ -60,6 +61,7 @@ CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y +CONFIG_DM_SCSI=y CONFIG_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y
include/configs/dh_imx6.h +0 -5
@@ -63,12 +63,7 @@#define CONFIG_SYS_MMC_ENV_DEV 2/* 1 = SDHC3, 2 = SDHC4 (eMMC) */ /* SATA Configs */ -#ifdef CONFIG_CMD_SATA -#define CONFIG_SYS_SATA_MAX_DEVICE 1 -#define CONFIG_DWC_AHSATA_PORT_ID 0 -#define CONFIG_DWC_AHSATA_BASE_ADDR SATA_ARB_BASE_ADDR#define CONFIG_LBA48 -#endif /* SPI Flash Configs */
Signature · 1 line
2.20.1
PATCH 6/8 ARM: imx: dh-imx6: Convert SATA support to DM
Quoted 80 lines · Marek Vasut
Enable DM SATA support on DHCOM iMX6 PDK2. Convert board code to match the DM support.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc Ludwig Zenz <[email protected]>Cc Stefano Babic <[email protected]>--- board/dhelectronics/dh_imx6/dh_imx6.c | 55 +++++++++++++++++++++++++-- configs/dh_imx6_defconfig | 2 + include/configs/dh_imx6.h | 5 --- 3 files changed, 53 insertions(+), 9 deletions(-)board/dhelectronics/dh_imx6/dh_imx6.c +41
-4@@ -20,6 +20,8 @@#include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/mach-imx/sata.h> +#include <ahci.h> +#include <dwc_ahsata.h> #include <environment.h> #include <errno.h> #include <fsl_esdhc.h> @@ -302,10 +304,6 @@ int board_init(void) }#endif -#ifdef CONFIG_SATA -setup_sata (); -#endif -setup_dhcom_mac_from_fuse ();return 0 ;@@ -384,3 +382,52 @@ int checkboard(void)puts ("Board: DHCOM i.MX6\n" );return 0 ; } + +#if CONFIG_IS_ENABLED (AHCI ) +static int sata_imx_probe (struct udevice *dev) +{ +int i, err; + +for (i =0 ; i <10 ; i++) { + err =setup_sata (); +if (err) { +printf ("SATA setup failed: %d\n" , err); +return err; + } + +udelay (100 ); + + err =dwc_ahsata_probe (dev); +if (!err) +break ; + +/* There is no device on the SATA port */ +if (sata_dm_port_status (0 ,0 ) ==0 ) +break ; + +/* There's a device, but link not established. Retry */ +device_remove (dev,DM_REMOVE_NORMAL ); + } + +return 0 ; +} + +struct ahci_ops sata_imx_ops = { + .port_status = dwc_ahsata_port_status, + .reset = dwc_ahsata_bus_reset, + .scan = dwc_ahsata_scan, +}; + +static const struct udevice_id sata_imx_ids[] = { + { .compatible ="fsl,imx6q-ahci" }, + { }
board/dhelectronics/dh_imx6/dh_imx6.c int checkboard(void) · line 433
Quoted 10 lines
board/dhelectronics/dh_imx6/dh_imx6.c +10
-0+}; + +U_BOOT_DRIVER (sata_imx) = { + .name ="dwc_ahci" , + .id =UCLASS_AHCI , + .of_match = sata_imx_ids, + .ops = &sata_imx_ops, + .probe = sata_imx_probe, +}; +#endif /* AHCI */
Is this code dh_imx6 specific in any way? If not, then it would be better placed in drivers/ata, so that other i.MX6 boards might use it as well. Or am I missing something?
Thanks,
Stefan
PATCH 6/8 ARM: imx: dh-imx6: Convert SATA support to DM
Quoted 86 lines · Stefan Roese
Quoted 85 lines · Marek Vasut
Enable DM SATA support on DHCOM iMX6 PDK2. Convert board code to match the DM support.
Signed-off-by Marek Vasut <[email protected]>Cc Fabio Estevam <[email protected]>Cc Ludwig Zenz <[email protected]>Cc Stefano Babic <[email protected]>---
board/dhelectronics/dh_imx6/dh_imx6.c| 55 +++++++++++++++++++++++++-- configs/dh_imx6_defconfig | 2 + include/configs/dh_imx6.h | 5 ---3 files changed, 53 insertions(+), 9 deletions(-)board/dhelectronics/dh_imx6/dh_imx6.c +2
-0@@ -20,6 +20,8 @@ #include <asm/mach-imx/iomux-v3.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/mach-imx/sata.h> +#include <ahci.h> +#include <dwc_ahsata.h> #include <environment.h> #include <errno.h> #include <fsl_esdhc.h>@@ -302,10 +304,6 @@ int board_init(void) } #endif-#ifdef
CONFIG_SATA
-setup_sata();board/dhelectronics/dh_imx6/dh_imx6.c +0
-2-#endif -
setup_dhcom_mac_from_fuse(); return 0;board/dhelectronics/dh_imx6/dh_imx6.c +45
-0@@ -384,3 +382,52 @@ int checkboard(void) puts("Board: DHCOM i.MX6\n"); return 0; } + +#if CONFIG_IS_ENABLED (AHCI ) +static int sata_imx_probe (struct udevice *dev) +{ + int i, err; + + for (i = 0; i < 10; i++) { + err = setup_sata(); + if (err) { + printf("SATA setup failed: %d\n", err); + return err; + } + + udelay(100); + + err = dwc_ahsata_probe(dev); + if (!err) + break; + + /* There is no device on the SATA port */ + if (sata_dm_port_status(0, 0) == 0) + break; + + /* There's a device, but link not established. Retry */ + device_remove(dev, DM_REMOVE_NORMAL); + } + + return 0; +} + +struct ahci_ops sata_imx_ops = { + .port_status = dwc_ahsata_port_status, + .reset = dwc_ahsata_bus_reset, + .scan = dwc_ahsata_scan, +}; + +static const struct udevice_id sata_imx_ids[] = { + { .compatible = "fsl,imx6q-ahci" }, + { } +}; + +U_BOOT_DRIVER (sata_imx) = { + .name = "dwc_ahci", + .id = UCLASS_AHCI, + .of_match = sata_imx_ids,
Quoted 8 lines
board/dhelectronics/dh_imx6/dh_imx6.c int checkboard(void) · line 433
Quoted 4 lines
board/dhelectronics/dh_imx6/dh_imx6.c +4
-0+ .ops = &sata_imx_ops, + .probe = sata_imx_probe, +}; +#endif /* AHCI */ Is this code
dh_imx6specific in any way? If not, then it would be better placed indrivers/ata, so that other i.MX6 boards might use it as well. Or am I missing something?
It's a copy-paste from apalis-imx6. In fact, it already is in drivers/ata (see CONFIG_DWC_AHSATA_AHCI), so I'll just fix up the apalis board and update this patch.
Signature · 2 lines
Best regards, Marek Vasut
PATCH 7/8 ARM: imx: dh-imx6: Convert USB support to DM
In reply to Marek VasutEnable DM USB host support on DHCOM iMX6 PDK2.
--- configs/dh_imx6_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/dh_imx6_defconfig +1 -0
@@ -65,6 +65,7 @@ CONFIG_DM_SCSI=y CONFIG_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y +CONFIG_DM_USB=y CONFIG_USB_GADGET=y CONFIG_USB_GADGET_MANUFACTURER="dh" CONFIG_USB_GADGET_VENDOR_NUM=0x0525
Signature · 1 line
2.20.1
PATCH 8/8 ARM: imx: dh-imx6: Convert SPI support to DM
In reply to Marek VasutEnable DM SPI and SF support on DHCOM iMX6 PDK2. Convert board code to match the DM support.
--- board/dhelectronics/dh_imx6/dh_imx6.c | 10 ---------- configs/dh_imx6_defconfig | 4 ++++ include/configs/dh_imx6.h | 5 +++++ 3 files changed, 9 insertions(+), 10 deletions(-)
board/dhelectronics/dh_imx6/dh_imx6.c +0 -10
@@ -272,16 +272,6 @@ int board_early_init_f(void)return 0 ; } -#ifdef CONFIG_MXC_SPI -int board_spi_cs_gpio (unsigned bus,unsigned cs) -{ -if (bus ==0 && cs ==0 ) -return IMX_GPIO_NR (2 ,30 ); -else -return -1 ; -} -#endif -int board_init (void ) {struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR ;
configs/dh_imx6_defconfig +4 -0
@@ -47,13 +47,16 @@ CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000 CONFIG_DM_GPIO=y CONFIG_DM_MMC=y CONFIG_FSL_ESDHC=y +CONFIG_DM_SPI_FLASH=y CONFIG_SPI_FLASH=y CONFIG_SF_DEFAULT_MODE=0 CONFIG_SF_DEFAULT_SPEED=25000000 +CONFIG_SPI_FLASH_SFDP_SUPPORT=y CONFIG_SPI_FLASH_GIGADEVICE=y CONFIG_SPI_FLASH_MACRONIX=y CONFIG_SPI_FLASH_SPANSION=y CONFIG_SPI_FLASH_WINBOND=y +CONFIG_SPI_FLASH_MTD=y CONFIG_PHYLIB=y CONFIG_PHY_MICREL=y CONFIG_PHY_MICREL_KSZ90X1=y
@@ -63,6 +66,7 @@ CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_DM_SCSI=y CONFIG_SPI=y +CONFIG_DM_SPI=y CONFIG_MXC_SPI=y CONFIG_USB=y CONFIG_DM_USB=y
include/configs/dh_imx6.h +5 -0
@@ -66,6 +66,11 @@#define CONFIG_LBA48 /* SPI Flash Configs */ +#if defined(CONFIG_SPL_BUILD ) +#undef CONFIG_DM_SPI +#undef CONFIG_DM_SPI_FLASH +#undef CONFIG_SPI_FLASH_MTD +#endif /* UART */ #define CONFIG_MXC_UART
Signature · 1 line
2.20.1