Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre
> -Original Message- > From: Trent Piepho > Sent: Tuesday, July 17, 2018 10:03 AM > To: Henry Beberman ; u- > b...@lists.denx.de > Cc: fabio.este...@nxp.com; adrian.alo...@nxp.com > Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot > support for iMX7 Sabre > > On Tue, 2018-07-17 at 01:41 +, Henry Beberman wrote: > > > -Original Message- > > > From: Trent Piepho > > > Sent: Monday, July 16, 2018 11:22 AM > > > To: Henry Beberman ; u- > > > b...@lists.denx.de > > > Cc: fabio.este...@nxp.com; adrian.alo...@nxp.com > > > Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot > > > support for iMX7 Sabre > > > > > > On Sat, 2018-07-14 at 00:11 +, Henry Beberman wrote: > > > > From: Henry Beberman > > > > > > > > This patch adds a new bootable configuration for Windows 10 IoT > > > > Core on the i.MX7 Dual Sabre board. > > > > > > > > It enables SPL on the i.MX7 Sabre in order to support the FIT load > > > > of OP-TEE and U-Boot proper. > > > > > > > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index > > > > f186120684..3fb9b72703 100644 > > > > --- a/drivers/gpio/Makefile > > > > +++ b/drivers/gpio/Makefile > > > > @@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD > > > > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > > > > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > > > > endif > > > > + > > > > +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) > > > > obj-$(CONFIG_DM_GPIO) += gpio-uclass.o > > > > > > > > obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o > > > > obj-$(CONFIG_DM_74X164)+= 74x164_gpio.o > > > > +endif > > > > > > It doesn't look like this patch is specific to mx7 or Windows. > > > Perhaps it should be in a different commit? > > > > I agree that this change probably belongs in its own patch. > > I've left it in this patch so far because it's required to build the new > mx7dsabresd_nt_defconfig. > > Easy enough to split out and put first. The person on different hardware > trying to figure out the u-boot build spaghetti it's helped much knowing the > person who added it was working on windows 10 support, but nothing about > the reason for this change. > > > > Also, the help text for SPL_DM says it turns on basic DM support in > > > SPL. But not any specific hardware drivers. Those all have > > > additional config options to turn them on. It doesn't seems right > > > to bundle a selection of GPIO drivers along with CONFIG_SPL_DM. > > > > This issue has cropped up because this patch adds SPL support to > mx7dsabresd, but intentionally does not enable SPL_DM. > > The defconfig contains CONFIG_DM_74X164 for use in U-Boot Proper, but > because drivers/gpio/Makefile also runs during the SPL portion of the build > that config still pulls in the 74X164 driver which fails to build due to > missing > dependencies. > > > > Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is > actually enabled for the current portion of the build when deciding to build > the DM drivers. > > But isn't it odd that not a single other driver is wrapped this way? > What's special here? > > I think the underlying flaw is the the kbuild system doesn't support the > concept of building multiple times in different modes, e.g. main, SPL, TPL. > And rather than design something, one gets layers of board specific hacks. There are a few other instances of omitting DM drivers from SPL due to size concerns, see drivers/power/regulator/Makefile (commit a35332f) and drivers/mmc/Makefile (commit c4d660d) However instead of wrapping the block in CONFIG_$(SPL_TPL_)DM, the intended way is to include $(SPL_) in line with the driver you need to disable for SPL. - obj-$(CONFIG_DM_74X164) += 74x164_gpio.o + obj-$(CONFIG_$(SPL_)DM_74X164) += 74x164_gpio.o I'll switch to this in-line method and split out this change into a separate patch so the commit message explains it in isolation. Thanks, Henry ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre
On Tue, 2018-07-17 at 01:41 +, Henry Beberman wrote: > > -Original Message- > > From: Trent Piepho > > Sent: Monday, July 16, 2018 11:22 AM > > To: Henry Beberman ; u- > > b...@lists.denx.de > > Cc: fabio.este...@nxp.com; adrian.alo...@nxp.com > > Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot > > support for iMX7 Sabre > > > > On Sat, 2018-07-14 at 00:11 +, Henry Beberman wrote: > > > From: Henry Beberman > > > > > > This patch adds a new bootable configuration for Windows 10 IoT Core > > > on the i.MX7 Dual Sabre board. > > > > > > It enables SPL on the i.MX7 Sabre in order to support the FIT load of > > > OP-TEE and U-Boot proper. > > > > > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index > > > f186120684..3fb9b72703 100644 > > > --- a/drivers/gpio/Makefile > > > +++ b/drivers/gpio/Makefile > > > @@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD > > > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > > > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > > > endif > > > + > > > +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) > > > obj-$(CONFIG_DM_GPIO)+= gpio-uclass.o > > > > > > obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o > > > obj-$(CONFIG_DM_74X164) += 74x164_gpio.o > > > +endif > > > > It doesn't look like this patch is specific to mx7 or Windows. Perhaps it > > should > > be in a different commit? > > I agree that this change probably belongs in its own patch. > I've left it in this patch so far because it's required to build the new > mx7dsabresd_nt_defconfig. Easy enough to split out and put first. The person on different hardware trying to figure out the u-boot build spaghetti it's helped much knowing the person who added it was working on windows 10 support, but nothing about the reason for this change. > > Also, the help text for SPL_DM says it turns on basic DM support in SPL. > > But > > not any specific hardware drivers. Those all have additional config > > options to > > turn them on. It doesn't seems right to bundle a selection of GPIO drivers > > along with CONFIG_SPL_DM. > > This issue has cropped up because this patch adds SPL support to mx7dsabresd, > but intentionally does not enable SPL_DM. > The defconfig contains CONFIG_DM_74X164 for use in U-Boot Proper, but because > drivers/gpio/Makefile also runs during the SPL portion of the build that > config still pulls in the 74X164 driver which fails to build due to missing > dependencies. > > Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is actually > enabled for the current portion of the build when deciding to build the DM > drivers. But isn't it odd that not a single other driver is wrapped this way? What's special here? I think the underlying flaw is the the kbuild system doesn't support the concept of building multiple times in different modes, e.g. main, SPL, TPL. And rather than design something, one gets layers of board specific hacks. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre
> -Original Message- > From: Trent Piepho > Sent: Monday, July 16, 2018 11:22 AM > To: Henry Beberman ; u- > b...@lists.denx.de > Cc: fabio.este...@nxp.com; adrian.alo...@nxp.com > Subject: Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot > support for iMX7 Sabre > > On Sat, 2018-07-14 at 00:11 +, Henry Beberman wrote: > > From: Henry Beberman > > > > This patch adds a new bootable configuration for Windows 10 IoT Core > > on the i.MX7 Dual Sabre board. > > > > It enables SPL on the i.MX7 Sabre in order to support the FIT load of > > OP-TEE and U-Boot proper. > > > > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index > > f186120684..3fb9b72703 100644 > > --- a/drivers/gpio/Makefile > > +++ b/drivers/gpio/Makefile > > @@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD > > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > > endif > > + > > +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) > > obj-$(CONFIG_DM_GPIO) += gpio-uclass.o > > > > obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o > > obj-$(CONFIG_DM_74X164)+= 74x164_gpio.o > > +endif > > It doesn't look like this patch is specific to mx7 or Windows. Perhaps it > should > be in a different commit? I agree that this change probably belongs in its own patch. I've left it in this patch so far because it's required to build the new mx7dsabresd_nt_defconfig. > Also, the help text for SPL_DM says it turns on basic DM support in SPL. But > not any specific hardware drivers. Those all have additional config options > to > turn them on. It doesn't seems right to bundle a selection of GPIO drivers > along with CONFIG_SPL_DM. This issue has cropped up because this patch adds SPL support to mx7dsabresd, but intentionally does not enable SPL_DM. The defconfig contains CONFIG_DM_74X164 for use in U-Boot Proper, but because drivers/gpio/Makefile also runs during the SPL portion of the build that config still pulls in the 74X164 driver which fails to build due to missing dependencies. Wrapping the DM objects in CONFIG_$(SPL_TPL_)DM ensures that DM is actually enabled for the current portion of the build when deciding to build the DM drivers. Thanks, Henry ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre
On Sat, 2018-07-14 at 00:11 +, Henry Beberman wrote: > From: Henry Beberman > > This patch adds a new bootable configuration for Windows 10 IoT Core on > the i.MX7 Dual Sabre board. > > It enables SPL on the i.MX7 Sabre in order to support the FIT load of > OP-TEE and U-Boot proper. > > diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile > index f186120684..3fb9b72703 100644 > --- a/drivers/gpio/Makefile > +++ b/drivers/gpio/Makefile > @@ -7,10 +7,13 @@ ifndef CONFIG_SPL_BUILD > obj-$(CONFIG_DWAPB_GPIO) += dwapb_gpio.o > obj-$(CONFIG_AXP_GPIO) += axp_gpio.o > endif > + > +ifeq ($(CONFIG_$(SPL_TPL_)DM),y) > obj-$(CONFIG_DM_GPIO)+= gpio-uclass.o > > obj-$(CONFIG_DM_PCA953X) += pca953x_gpio.o > obj-$(CONFIG_DM_74X164) += 74x164_gpio.o > +endif It doesn't look like this patch is specific to mx7 or Windows. Perhaps it should be in a different commit? Also, the help text for SPL_DM says it turns on basic DM support in SPL. But not any specific hardware drivers. Those all have additional config options to turn them on. It doesn't seems right to bundle a selection of GPIO drivers along with CONFIG_SPL_DM. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 06/11] mx7dsabresd: Add Windows boot support for iMX7 Sabre
From: Henry Beberman This patch adds a new bootable configuration for Windows 10 IoT Core on the i.MX7 Dual Sabre board. It enables SPL on the i.MX7 Sabre in order to support the FIT load of OP-TEE and U-Boot proper. Signed-off-by: Henry Beberman Cc: Stefano Babic Cc: Fabio Estevam Cc: Adrian Alonso --- arch/arm/mach-imx/mx7/Kconfig | 1 + board/freescale/mx7dsabresd/MAINTAINERS | 1 + board/freescale/mx7dsabresd/mx7dsabresd.c | 79 +++ configs/mx7dsabresd_nt_defconfig | 102 ++ drivers/gpio/Makefile | 3 + drivers/pinctrl/nxp/pinctrl-imx7.c| 4 +- include/configs/mx7dsabresd.h | 10 +++ 7 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 configs/mx7dsabresd_nt_defconfig diff --git a/arch/arm/mach-imx/mx7/Kconfig b/arch/arm/mach-imx/mx7/Kconfig index 2a3db860bb..0aaf246a79 100644 --- a/arch/arm/mach-imx/mx7/Kconfig +++ b/arch/arm/mach-imx/mx7/Kconfig @@ -33,6 +33,7 @@ config TARGET_MX7DSABRESD select MX7D select DM select DM_THERMAL + select SUPPORT_SPL config TARGET_PICO_IMX7D bool "pico-imx7d" diff --git a/board/freescale/mx7dsabresd/MAINTAINERS b/board/freescale/mx7dsabresd/MAINTAINERS index b96642a568..1fc9b2a491 100644 --- a/board/freescale/mx7dsabresd/MAINTAINERS +++ b/board/freescale/mx7dsabresd/MAINTAINERS @@ -4,3 +4,4 @@ S: Maintained F: board/freescale/mx7dsabresd F: include/configs/mx7dsabresd.h F: configs/mx7dsabresd_defconfig +F: configs/mx7dsabresd_nt_defconfig \ No newline at end of file diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c index 90e2d1a92a..db34609caf 100644 --- a/board/freescale/mx7dsabresd/mx7dsabresd.c +++ b/board/freescale/mx7dsabresd/mx7dsabresd.c @@ -46,6 +46,9 @@ DECLARE_GLOBAL_DATA_PTR; #define NAND_PAD_READY0_CTRL (PAD_CTL_DSE_3P3V_49OHM | PAD_CTL_PUS_PU5KOHM) +#define USDHC_PAD_CTRL (PAD_CTL_DSE_3P3V_32OHM | PAD_CTL_SRE_SLOW | \ + PAD_CTL_HYS | PAD_CTL_PUE | PAD_CTL_PUS_PU47KOHM) + #ifdef CONFIG_MXC_SPI static iomux_v3_cfg_t const ecspi3_pads[] = { MX7D_PAD_SAI2_RX_DATA__ECSPI3_SCLK | MUX_PAD_CTRL(SPI_PAD_CTRL), @@ -363,6 +366,75 @@ int power_init_board(void) } #endif +#ifdef CONFIG_SPL_BUILD +#include + +#if !CONFIG_IS_ENABLED(DM_MMC) +static iomux_v3_cfg_t const usdhc1_pads[] = { + MX7D_PAD_SD1_CLK__SD1_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_CMD__SD1_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_DATA0__SD1_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_DATA1__SD1_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_DATA2__SD1_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_DATA3__SD1_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + + MX7D_PAD_SD1_CD_B__GPIO5_IO0 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_WP__GPIO5_IO1 | MUX_PAD_CTRL(USDHC_PAD_CTRL), + MX7D_PAD_SD1_RESET_B__SD1_RESET_B | MUX_PAD_CTRL(USDHC_PAD_CTRL), +}; + +#define USDHC1_CD IMX_GPIO_NR(5, 0) +#define USDHC1_WP IMX_GPIO_NR(5, 1) + +int board_mmc_init(bd_t *bis) +{ + struct fsl_esdhc_cfg usdhc_cfg = {}; + + imx_iomux_v3_setup_multiple_pads(usdhc1_pads, ARRAY_SIZE(usdhc1_pads)); + gpio_direction_input(USDHC1_CD); + gpio_direction_input(USDHC1_WP); + + usdhc_cfg.esdhc_base = USDHC1_BASE_ADDR; + usdhc_cfg.sdhc_clk = mxc_get_clock(MXC_ESDHC_CLK); + usdhc_cfg.max_bus_width = 4; + + return fsl_esdhc_initialize(bis, _cfg); +} + +int board_mmc_getcd(struct mmc *mmc) +{ + struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; + int ret = 0; + + switch (cfg->esdhc_base) { + case USDHC1_BASE_ADDR: + ret = !gpio_get_value(USDHC1_CD); + break; + } + + return ret; +} +#endif + +void board_init_f(ulong dummy) +{ + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + + setup_iomux_uart(); + + /* setup AIPS and disable watchdog */ + arch_cpu_init(); + + /* setup GP timer */ + timer_init(); + + preloader_console_init(); + + /* No need to initialize DRAM; handled by DCD script */ +} +#endif + int board_late_init(void) { struct wdog_regs *wdog = (struct wdog_regs *)WDOG1_BASE_ADDR; @@ -393,3 +465,10 @@ int checkboard(void) return 0; } + +#if defined(CONFIG_MULTI_DTB_FIT) || defined(CONFIG_SPL_LOAD_FIT) +int board_fit_config_name_match(const char *name) +{ + return 0; +} +#endif diff --git a/configs/mx7dsabresd_nt_defconfig b/configs/mx7dsabresd_nt_defconfig new file mode 100644 index 00..9bb0fe1b54 --- /dev/null +++ b/configs/mx7dsabresd_nt_defconfig @@ -0,0 +1,102 @@ +CONFIG_ARM=y +CONFIG_ARCH_MX7=y +CONFIG_SYS_THUMB_BUILD=y +CONFIG_SYS_TEXT_BASE=0x8780 +CONFIG_TARGET_MX7DSABRESD=y