ARM: imx: vining2000: Convert to SPL framework
Subsystems (3)
PATCH 1/6 ARM: imx: vining2000: Convert to SPL framework
In preparation for use of DDR DRAM fine-tuning upon boot, convert the board to SPL framework instead of using DCD tables to bring up DRAM and pinmux.
--- arch/arm/mach-imx/mx6/Kconfig | 1 + board/softing/vining_2000/vining_2000.c | 182 ++++++++++++++++++++++++ configs/vining_2000_defconfig | 12 +- include/configs/vining_2000.h | 4 + 4 files changed, 198 insertions(+), 1 deletion(-)
arch/arm/mach-imx/mx6/Kconfig +1 -0
@@ -558,6 +558,7 @@ config TARGET_SOFTING_VINING_2000 select DM select DM_THERMAL select MX6SX + select SUPPORT_SPL imply CMD_DM config TARGET_WANDBOARD
board/softing/vining_2000/vining_2000.c +182 -0
185 lines not on this page · raw message
configs/vining_2000_defconfig +11 -1
@@ -1,18 +1,29 @@ CONFIG_ARM=y CONFIG_ARCH_MX6=y CONFIG_SYS_TEXT_BASE=0x87800000 +CONFIG_SPL_GPIO_SUPPORT=y +CONFIG_SPL_LIBCOMMON_SUPPORT=y +CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x4000 CONFIG_TARGET_SOFTING_VINING_2000=y +CONFIG_SPL_MMC_SUPPORT=y +CONFIG_SPL_SERIAL_SUPPORT=y CONFIG_ENV_SIZE=0x2000 CONFIG_ENV_OFFSET=0x80000 CONFIG_NR_DRAM_BANKS=1 +CONFIG_SPL=y +CONFIG_SPL_LIBDISK_SUPPORT=y # CONFIG_CMD_BMODE is not set +CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/softing/vining_2000/imximage.cfg" CONFIG_BOOTDELAY=0 CONFIG_SYS_CONSOLE_IS_IN_ENV=y CONFIG_SUPPORT_RAW_INITRD=y CONFIG_BOUNCE_BUFFER=y CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_SPL_FS_EXT4=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_HUSH_PARSER=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_FLASH is not set
@@ -53,7 +64,6 @@ CONFIG_DM_PCI=y CONFIG_PINCTRL=y CONFIG_PINCTRL_IMX6=y CONFIG_PWM_IMX=y -CONFIG_SPECIFY_CONSOLE_INDEX=y CONFIG_DM_SERIAL=y CONFIG_MXC_UART=y CONFIG_USB=y
include/configs/vining_2000.h +4 -0
@@ -91,4 +91,8 @@#define CONFIG_SYS_MMC_ENV_PART 1/* boot0 */ #endif +#ifdef CONFIG_SPL_BUILD +#define CONFIG_MXC_UART_BASE UART1_BASE +#endif +#endif /* __CONFIG_H */
Signature · 1 line
2.24.0
PATCH 2/6 ARM: imx: vining2000: Enable DDR DRAM calibration
Enable DRAM calibration in SPL to improve behavior of the board in edge conditions of the thermal envelope of the board and make it even more stable.
--- board/softing/vining_2000/vining_2000.c | 5 +++++ configs/vining_2000_defconfig | 1 + 2 files changed, 6 insertions(+)
board/softing/vining_2000/vining_2000.c +5 -0
@@ -586,6 +586,11 @@ static void vining2000_spl_dram_init(void)mx6sx_dram_iocfg (mem_ddr.width, &mx6_ddr_ioregs, &mx6_grp_ioregs);mx6_dram_cfg (&sysinfo, &mx6_mmcd_calib, &mem_ddr); + +/* Perform DDR DRAM calibration */ +udelay (100 ); +mmdc_do_write_level_calibration (&sysinfo); +mmdc_do_dqs_calibration (&sysinfo); }void board_init_f (ulong dummy)
configs/vining_2000_defconfig +1 -0
@@ -5,6 +5,7 @@ CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y CONFIG_SYS_MALLOC_F_LEN=0x4000 +CONFIG_MX6_DDRCAL=y CONFIG_TARGET_SOFTING_VINING_2000=y CONFIG_SPL_MMC_SUPPORT=y CONFIG_SPL_SERIAL_SUPPORT=y
Signature · 1 line
2.24.0
PATCH 3/6 ARM: imx: vining2000: Convert to ethernet DM
In reply to Marek VasutConvert the board to ethernet DM support. Adjust board file accordingly, as the board_eth_init() contains custom clock configuration required for this board to work. Furthermore, enable FEC1 clock to make FEC1 work as well.
--- board/softing/vining_2000/vining_2000.c | 38 ++++--------------------- configs/vining_2000_defconfig | 3 ++ include/configs/vining_2000.h | 2 -- 3 files changed, 8 insertions(+), 35 deletions(-)
board/softing/vining_2000/vining_2000.c +5 -33
@@ -71,42 +71,23 @@ int dram_init(void)return 0 ; } -static iomux_v3_cfg_t const fec1_pads[] = { -MX6_PAD_ENET1_MDC__ENET1_MDC |MUX_PAD_CTRL (ENET_PAD_CTRL ), -MX6_PAD_ENET1_MDIO__ENET1_MDIO |MUX_PAD_CTRL (ENET_PAD_CTRL ), -MX6_PAD_RGMII1_RD0__ENET1_RX_DATA_0 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), -MX6_PAD_RGMII1_RD1__ENET1_RX_DATA_1 |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), -MX6_PAD_RGMII1_TD0__ENET1_TX_DATA_0 |MUX_PAD_CTRL (ENET_PAD_CTRL ), -MX6_PAD_RGMII1_TD1__ENET1_TX_DATA_1 |MUX_PAD_CTRL (ENET_PAD_CTRL ), -MX6_PAD_RGMII1_RX_CTL__ENET1_RX_EN |MUX_PAD_CTRL (ENET_RX_PAD_CTRL ), -MX6_PAD_RGMII1_TX_CTL__ENET1_TX_EN |MUX_PAD_CTRL (ENET_PAD_CTRL ), -MX6_PAD_ENET1_TX_CLK__ENET1_REF_CLK1 |MUX_PAD_CTRL (ENET_CLK_PAD_CTRL ) | -MUX_MODE_SION , -/* LAN8720 PHY Reset */ -MX6_PAD_RGMII1_TD3__GPIO5_IO_9 |MUX_PAD_CTRL (NO_PAD_CTRL ), -}; -static iomux_v3_cfg_t const pwm_led_pads[] = {MX6_PAD_RGMII2_RD2__PWM2_OUT |MUX_PAD_CTRL (NO_PAD_CTRL ),/* green */ MX6_PAD_RGMII2_TD2__PWM6_OUT |MUX_PAD_CTRL (NO_PAD_CTRL ),/* red */ MX6_PAD_RGMII2_RD3__PWM1_OUT |MUX_PAD_CTRL (NO_PAD_CTRL ),/* blue */ }; -#define PHY_RESET IMX_GPIO_NR(5, 9) - -int board_eth_init (bd_t *bis) +static int board_net_init (void ) {struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR ; -int ret;unsigned char eth1addr[6 ]; +int ret; -/* just to get secound mac address */ +/* just to get second mac address */ imx_get_mac_from_fuse (1 , eth1addr);if (!env_get ("eth1addr" ) &&is_valid_ethaddr (eth1addr))eth_env_set_enetaddr ("eth1addr" , eth1addr); -imx_iomux_v3_setup_multiple_pads (fec1_pads,ARRAY_SIZE (fec1_pads)); -/* * Generate phy reference clock via pin IOMUX ENET_REF_CLK1/2 by erasing * ENET1/2_TX_CLK_DIR gpr1[14:13], so that reference clock is driven by
@@ -122,15 +103,7 @@ int board_eth_init(bd_t *bis)if (ret) goto eth_fail; -/* reset phy */ -gpio_request (PHY_RESET ,"PHY-reset" ); -gpio_direction_output (PHY_RESET ,0 ); -mdelay (16 ); -gpio_set_value (PHY_RESET ,1 ); -mdelay (1 ); - - ret =fecmxc_initialize_multi (bis,0 ,CONFIG_FEC_MXC_PHYADDR , -IMX_FEC_BASE ); + ret =enable_fec_anatop_clock (1 ,ENET_50MHZ );if (ret) goto eth_fail;
@@ -138,7 +111,6 @@ int board_eth_init(bd_t *bis) eth_fail:printf ("FEC MXC: %s:failed (%i)\n" , __func__, ret); -gpio_set_value (PHY_RESET ,0 );return ret; }
@@ -423,7 +395,7 @@ int board_init(void)setup_i2c (0 ,CONFIG_SYS_I2C_SPEED ,0x7f , &i2c_pad_info1);#endif -return 0 ; +return board_net_init (); }int checkboard (void )
configs/vining_2000_defconfig +3 -0
@@ -59,6 +59,9 @@ CONFIG_SUPPORT_EMMC_RPMB=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y CONFIG_PHYLIB=y +CONFIG_PHY_SMSC=y +CONFIG_DM_ETH=y +CONFIG_FEC_MXC=y CONFIG_MII=y CONFIG_PCI=y CONFIG_DM_PCI=y
include/configs/vining_2000.h +0 -2
@@ -58,8 +58,6 @@#define CONFIG_POWER_PFUZE100_I2C_ADDR 0x08/* Network */ -#define CONFIG_FEC_MXC -#define IMX_FEC_BASE ENET_BASE_ADDR#define CONFIG_FEC_MXC_PHYADDR 0x0
Signature · 1 line
2.24.0
PATCH 4/6 ARM: imx: vining2000: Enable fitImage support
In reply to Marek VasutThe fitImage support was enabled in the downstream U-Boot port and the kernel images on the device are fitImage, yet this functionality is not enabled in mainline U-Boot. Enable it.
--- configs/vining_2000_defconfig | 2 ++ 1 file changed, 2 insertions(+)
configs/vining_2000_defconfig +2 -0
@@ -16,6 +16,8 @@ CONFIG_SPL=y CONFIG_SPL_LIBDISK_SUPPORT=y # CONFIG_CMD_BMODE is not set CONFIG_SPL_TEXT_BASE=0x00908000 +CONFIG_FIT=y +CONFIG_FIT_VERBOSE=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=board/softing/vining_2000/imximage.cfg" CONFIG_BOOTDELAY=0 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
Signature · 1 line
2.24.0
PATCH 5/6 ARM: imx: vining2000: Repair PCIe support
In reply to Marek VasutEver since the conversion to DM PCI, the board was missing the PCIe DT nodes, hence the PCI did not really work. Fill in the DT nodes and add missing PCIe device reset.
Moreover, bring the PCIe power domain up before booting Linux. This is mandatory to keep old broken vendor kernels working, as they do not do so and depend on the bootloader to bring the power domain up.
--- arch/arm/dts/imx6sx-softing-vining-2000.dts | 17 +++++++++++++ board/softing/vining_2000/vining_2000.c | 28 +++++++++++++++++++++ 2 files changed, 45 insertions(+)
arch/arm/dts/imx6sx-softing-vining-2000.dts +17 -0
@@ -270,6 +270,17 @@ status = "okay"; }; +®_pcie { + regulator-always-on; +}; + +&pcie { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_pcie>; + reset-gpio = <&gpio4 6 GPIO_ACTIVE_HIGH>; + status = "okay"; +}; + &iomuxc { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_gpios>;
@@ -360,6 +371,12 @@ >; }; + pinctrl_pcie: pciegrp { + fsl,pins = < + MX6SX_PAD_NAND_DATA02__GPIO4_IO_6 0x10b0 + >; + }; + pinctrl_pwm1: pwm1grp-1 { fsl,pins = < /* blue LED */
board/softing/vining_2000/vining_2000.c +28 -0
@@ -405,6 +405,19 @@ int checkboard(void)return 0 ; } +#define PCIE_PHY_PUP_REQ BIT(7) + +void board_preboot_os (void ) +{ +struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR ; +struct gpc *gpc_regs = (struct gpc *)GPC_BASE_ADDR ; + +/* Bring the PCI power domain up, so that old vendorkernel works. */ +setbits_le32 (&iomuxc_regs->gpr[12 ],IOMUXC_GPR12_TEST_POWERDOWN ); +setbits_le32 (&iomuxc_regs->gpr[5 ],IOMUXC_GPR5_PCIE_BTNRST ); +setbits_le32 (&gpc_regs->cntr,PCIE_PHY_PUP_REQ ); +} +#ifdef CONFIG_SPL_BUILD #include <linux/libfdt.h> #include <spl.h>
@@ -412,6 +425,10 @@ int checkboard(void)static struct fsl_esdhc_cfg usdhc_cfg = {USDHC4_BASE_ADDR }; +static iomux_v3_cfg_t const pcie_pads[] = { +MX6_PAD_NAND_DATA02__GPIO4_IO_6 |MUX_PAD_CTRL (GPIO_PAD_CTRL ), +}; +static iomux_v3_cfg_t const uart_pads[] = {MX6_PAD_GPIO1_IO04__UART1_TX |MUX_PAD_CTRL (UART_PAD_CTRL ),MX6_PAD_GPIO1_IO05__UART1_RX |MUX_PAD_CTRL (UART_PAD_CTRL ),
@@ -430,6 +447,11 @@ static iomux_v3_cfg_t const usdhc4_pads[] = { MX6_PAD_SD4_DATA7__USDHC4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL), }; +static void vining2000_spl_setup_iomux_pcie (void ) +{ +imx_iomux_v3_setup_multiple_pads (pcie_pads,ARRAY_SIZE (pcie_pads)); +} +static void vining2000_spl_setup_iomux_uart (void ) {imx_iomux_v3_setup_multiple_pads (uart_pads,ARRAY_SIZE (uart_pads));
@@ -573,11 +595,17 @@ void board_init_f(ulong dummy)ccgr_init ();/* iomux setup */ +vining2000_spl_setup_iomux_pcie ();vining2000_spl_setup_iomux_uart ();/* setup GP timer */ timer_init (); +/* reset the PCIe device */ +gpio_set_value (IMX_GPIO_NR (4 ,6 ),1 ); +udelay (50 ); +gpio_set_value (IMX_GPIO_NR (4 ,6 ),0 ); +/* UART clocks enabled and gd valid - init serial console */ preloader_console_init ();
Signature · 1 line
2.24.0
PATCH 6/6 ARM: imx: vining2000: Align SOC and ARM LDO voltages
In reply to Marek VasutThe board has both VDD_SOC_IN and VDD_ARM_IN rails connected to the same PMIC rail, align the LDO voltages to avoid leaking inside the MX6SX SoC.
--- board/softing/vining_2000/vining_2000.c | 3 +++ 1 file changed, 3 insertions(+)
board/softing/vining_2000/vining_2000.c +3 -0
@@ -225,6 +225,9 @@ int power_init_board(void)if (ret <0 )return ret; +set_ldo_voltage (LDO_ARM ,1175 );/* Set VDDARM to 1.175V */ +set_ldo_voltage (LDO_SOC ,1175 );/* Set VDDSOC to 1.175V */ +return 0 ; }
Signature · 1 line
2.24.0