* [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper
@ 2019-10-10 14:11 Lukasz Majewski
2019-10-10 14:11 ` [U-Boot] [PATCH v3 1/9] imx: tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski
` (8 more replies)
0 siblings, 9 replies; 18+ messages in thread
From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw)
To: u-boot
This patch series converts imx6q based tpc70 board to use driver model and
device tree description in SPL and U-Boot proper.
All the non-DM parts of the code has been removed.
This patch series also uses the Common Clock Framework [CCF] as a base for
clock management on imx6q board.
Those patches are applied on top of i.MX -next branch:
SHA1: caa336588d8b9be3d1ac011ddb62af7d1d060cb5
URL: git at gitlab.denx.de:u-boot/custodians/u-boot-imx.git
Changes in v3:
- Squash
'imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description'
with
'imx: tpc70: DTS: Explicitly add imx6q-kp.dtb to Makefile for DTB compilation'
- Adjust the code to being applicable on top of v2019.10
- Move CONFIG_SUPPORT_EMMC_BOOT to Kconfig
Lukasz Majewski (9):
imx: tpc70: config: Add script commands to update u-boot and OE's wic
imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL
update
imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD
boot
imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock
imx: tpc70: led: Enable LED default state
imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description
imx: dts: Add u-boot specific set of device tree properties for tpc70
imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and
u-boot
imx: config: Update KP's TPC70 config to support SWUpdate
arch/arm/dts/Makefile | 1 +
arch/arm/dts/imx6q-kp-u-boot.dtsi | 59 ++++++
arch/arm/dts/imx6q-kp.dts | 219 ++++++++++++++++++++++
arch/arm/mach-imx/mx6/Kconfig | 10 +
board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 172 +----------------
board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 137 ++------------
configs/kp_imx6q_tpc_defconfig | 31 ++-
include/configs/kp_imx6q_tpc.h | 52 ++---
8 files changed, 373 insertions(+), 308 deletions(-)
create mode 100644 arch/arm/dts/imx6q-kp-u-boot.dtsi
create mode 100644 arch/arm/dts/imx6q-kp.dts
--
2.20.1
^ permalink raw reply [flat|nested] 18+ messages in thread* [U-Boot] [PATCH v3 1/9] imx: tpc70: config: Add script commands to update u-boot and OE's wic 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski ` (7 subsequent siblings) 8 siblings, 0 replies; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None include/configs/kp_imx6q_tpc.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/include/configs/kp_imx6q_tpc.h b/include/configs/kp_imx6q_tpc.h index 2435ebbc7f..fae45cbf3e 100644 --- a/include/configs/kp_imx6q_tpc.h +++ b/include/configs/kp_imx6q_tpc.h @@ -82,11 +82,32 @@ "rdinit=/sbin/init\0" \ "addinitrd=setenv bootargs ${bootargs} rdinit=${rdinit} ${debug} \0" \ "fit_config=mx6q_tpc70_conf\0" \ + "uboot_file=u-boot.img\0" \ + "SPL_file=SPL\0" \ + "wic_file=kp-image-kpimx6qtpc.wic\0" \ "upd_image=st.4k\0" \ "updargs=setenv bootargs console=${console} ${smp}"\ "rdinit=${rdinit} ${debug} ${displayargs}\0" \ "loadusb=usb start; " \ "fatload usb 0 ${loadaddr} ${upd_image}\0" \ + "upd_uboot_sd=" \ + "if tftp ${loadaddr} ${uboot_file}; then " \ + "setexpr blkc ${filesize} / 0x200;" \ + "setexpr blkc ${blkc} + 1;" \ + "mmc write ${loadaddr} 0x8A ${blkc};" \ + "fi;\0" \ + "upd_SPL_sd=" \ + "if tftp ${loadaddr} ${SPL_file}; then " \ + "setexpr blkc ${filesize} / 0x200;" \ + "setexpr blkc ${blkc} + 1;" \ + "mmc write ${loadaddr} 0x2 ${blkc};" \ + "fi;\0" \ + "upd_wic=" \ + "if tftp ${loadaddr} ${wic_file}; then " \ + "setexpr blkc ${filesize} / 0x200;" \ + "setexpr blkc ${blkc} + 1;" \ + "mmc write ${loadaddr} 0x0 ${blkc};" \ + "fi;\0" \ "usbupd=echo Booting update from usb ...; " \ "setenv bootargs; " \ "run updargs; " \ -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 1/9] imx: tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot Lukasz Majewski ` (6 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot The TPC70 can boot from eMMC's boot0. This patch allows it to update this HW partition's SPL. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None include/configs/kp_imx6q_tpc.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/configs/kp_imx6q_tpc.h b/include/configs/kp_imx6q_tpc.h index fae45cbf3e..df419a95f6 100644 --- a/include/configs/kp_imx6q_tpc.h +++ b/include/configs/kp_imx6q_tpc.h @@ -42,6 +42,7 @@ #define CONFIG_SYS_FSL_ESDHC_ADDR 0 #define CONFIG_SYS_FSL_USDHC_NUM 2 #define CONFIG_SYS_MMC_ENV_DEV 1 /* 0 = SDHC2, 1 = SDHC4 (eMMC) */ +#define CONFIG_SUPPORT_EMMC_BOOT /* UART */ #define CONFIG_MXC_UART @@ -102,6 +103,10 @@ "setexpr blkc ${blkc} + 1;" \ "mmc write ${loadaddr} 0x2 ${blkc};" \ "fi;\0" \ + "upd_SPL_mmc=mmc dev 1; mmc partconf 1 0 1 1; run upd_SPL_sd\0" \ + "upd_uboot_mmc=mmc dev 1; mmc partconf 1 0 1 1; run upd_uboot_sd\0" \ + "up_mmc=run upd_SPL_mmc; run upd_uboot_mmc\0" \ + "up_sd=run upd_SPL_sd; run upd_uboot_sd\0" \ "upd_wic=" \ "if tftp ${loadaddr} ${wic_file}; then " \ "setexpr blkc ${filesize} / 0x200;" \ -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update 2019-10-10 14:11 ` [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > The TPC70 can boot from eMMC's boot0. This patch allows it to update > this HW partition's SPL. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 1/9] imx: tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock Lukasz Majewski ` (5 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot The TPC70 can boot from SD card (debug/development) and eMMC (production). The board_boot_order() function provides a run time check for the device from which one wants to boot (it is selected by GPIO pins setup). Moreover, a fallback to SD card is provided if the detection is not possible or working properly. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c index e284d5ec57..e48a577f79 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c @@ -308,6 +308,26 @@ int board_mmc_init(bd_t *bd) return fsl_esdhc_initialize(bd, &usdhc_cfg[0]); } +void board_boot_order(u32 *spl_boot_list) +{ + u32 boot_device = spl_boot_device(); + u32 reg = imx6_src_get_boot_mode(); + + reg = (reg & IMX6_BMODE_MASK) >> IMX6_BMODE_SHIFT; + + debug("%s: boot device: 0x%x (0x4 SD, 0x6 eMMC)\n", __func__, reg); + if (boot_device == BOOT_DEVICE_MMC1) + if (reg == IMX6_BMODE_MMC || reg == IMX6_BMODE_EMMC) + boot_device = BOOT_DEVICE_MMC2; + + spl_boot_list[0] = boot_device; + /* + * Below boot device is a 'fallback' - it shall always be possible to + * boot from SD card + */ + spl_boot_list[1] = BOOT_DEVICE_MMC1; +} + void board_init_f(ulong dummy) { /* setup AIPS and disable watchdog */ -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot 2019-10-10 14:11 ` [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > The TPC70 can boot from SD card (debug/development) and eMMC (production). > The board_boot_order() function provides a run time check for the device > from which one wants to boot (it is selected by GPIO pins setup). > Moreover, a fallback to SD card is provided if the detection is not > possible or working properly. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (2 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state Lukasz Majewski ` (4 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This is a cosmetic change, just to use proper define instead of magic numbers. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c index 2c541ace02..144d2c58c4 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c @@ -119,7 +119,8 @@ static int setup_fec_clock(void) struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; /* set gpr1[21] to select anatop clock */ - clrsetbits_le32(&iomuxc_regs->gpr[1], 0x1 << 21, 0x1 << 21); + clrsetbits_le32(&iomuxc_regs->gpr[1], IOMUXC_GPR1_ENET_CLK_SEL_MASK, + IOMUXC_GPR1_ENET_CLK_SEL_MASK); return enable_fec_anatop_clock(0, ENET_50MHZ); } -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock 2019-10-10 14:11 ` [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This is a cosmetic change, just to use proper define instead > of magic numbers. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (3 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description Lukasz Majewski ` (3 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This change sets the default state of LEDs on TPC70. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c index 144d2c58c4..7876a63068 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c @@ -28,6 +28,7 @@ #include <netdev.h> #include <usb.h> #include <usb/ehci-ci.h> +#include <led.h> DECLARE_GLOBAL_DATA_PTR; @@ -291,6 +292,9 @@ int board_late_init(void) add_board_boot_modes(board_boot_modes); #endif + if (IS_ENABLED(CONFIG_LED)) + led_default_state(); + env_set("boardname", "kp-tpc"); env_set("boardsoc", "imx6q"); return 0; -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state 2019-10-10 14:11 ` [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This change sets the default state of LEDs on TPC70. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (4 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 Lukasz Majewski ` (2 subsequent siblings) 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This commit defines the TPC70 imx6q board with device tree description. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: - Squash 'imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description' with 'imx: tpc70: DTS: Explicitly add imx6q-kp.dtb to Makefile for DTB compilation' arch/arm/dts/Makefile | 1 + arch/arm/dts/imx6q-kp.dts | 219 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 220 insertions(+) create mode 100644 arch/arm/dts/imx6q-kp.dts diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 2c86b293a8..13a00200a7 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -576,6 +576,7 @@ dtb-y += \ imx6q-icore.dtb \ imx6q-icore-mipi.dtb \ imx6q-icore-rqs.dtb \ + imx6q-kp.dtb \ imx6q-logicpd.dtb \ imx6q-nitrogen6x.dtb \ imx6q-novena.dtb \ diff --git a/arch/arm/dts/imx6q-kp.dts b/arch/arm/dts/imx6q-kp.dts new file mode 100644 index 0000000000..12d6db6f80 --- /dev/null +++ b/arch/arm/dts/imx6q-kp.dts @@ -0,0 +1,219 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2018 + * Lukasz Majewski, DENX Software Engineering, lukma at denx.de + * + * SPDX-License-Identifier: GPL-2.0+ or X11 + */ + +/dts-v1/; +#include <dt-bindings/gpio/gpio.h> +#include "imx6q.dtsi" + +/ { + model = "K+P iMX6Q"; + compatible = "kp,imx6-kp", "fsl,imx6"; + + aliases { + mmc0 = &usdhc2; + mmc1 = &usdhc4; + usb1 = &usbh1; + }; + + chosen { + stdout-path = &uart1; + }; + + leds { + compatible = "gpio-leds"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_leds>; + + green { + label = "green"; + gpios = <&gpio3 23 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "gpio"; + default-state = "off"; + }; + + red { + label = "red"; + gpios = <&gpio3 16 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "gpio"; + default-state = "off"; + }; + }; + + memory at 10000000 { + reg = <0x10000000 0x40000000>; + }; + + reg_usb_h1_vbus: regulator-usb_h1_vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_h1_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&gpio3 31 GPIO_ACTIVE_HIGH>; + enable-active-high; + }; +}; + +&fec { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_enet>; + phy-reset-gpios = <&gpio1 25 GPIO_ACTIVE_LOW>; + phy-reset-duration = <10>; + phy-mode = "rgmii"; + fsl,magic-packet; + fsl,enet-loopback-clk; /* anatop reference clk via PAD loopback */ + fsl,enet-freq = <1>; /* ENET_25MHZ = 0, ENET_50MHZ = 1 */ + /* ENET_100MHZ = 2, ENET_125MHZ = 3 */ + status = "okay"; +}; + +&i2c1 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c1>; + status = "okay"; +}; + +&i2c2 { + clock-frequency = <400000>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c2>; + status = "okay"; +}; + +&iomuxc { + pinctrl_enet: enetgrp { + fsl,pins = < + MX6QDL_PAD_ENET_MDIO__ENET_MDIO 0x1b0b0 + MX6QDL_PAD_ENET_MDC__ENET_MDC 0x1b0b0 + MX6QDL_PAD_RGMII_TXC__RGMII_TXC 0x1b0b0 + MX6QDL_PAD_RGMII_TD0__RGMII_TD0 0x1b0b0 + MX6QDL_PAD_RGMII_TD1__RGMII_TD1 0x1b0b0 + MX6QDL_PAD_RGMII_TD2__RGMII_TD2 0x1b0b0 + MX6QDL_PAD_RGMII_TD3__RGMII_TD3 0x1b0b0 + MX6QDL_PAD_RGMII_TX_CTL__RGMII_TX_CTL 0x1b0b0 + MX6QDL_PAD_ENET_REF_CLK__ENET_TX_CLK 0x1b0b0 + MX6QDL_PAD_RGMII_RXC__RGMII_RXC 0x1b0b0 + MX6QDL_PAD_RGMII_RD0__RGMII_RD0 0x1b0b0 + MX6QDL_PAD_RGMII_RD1__RGMII_RD1 0x1b0b0 + MX6QDL_PAD_RGMII_RD2__RGMII_RD2 0x1b0b0 + MX6QDL_PAD_RGMII_RD3__RGMII_RD3 0x1b0b0 + MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b0b0 + MX6QDL_PAD_GPIO_16__ENET_REF_CLK 0x4001b0a8 + MX6QDL_PAD_ENET_CRS_DV__GPIO1_IO25 0x1b0b0 + >; + }; + + pinctrl_leds: gpioledsgrp { + fsl,pins = < + MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x4001b0b0 + MX6QDL_PAD_EIM_D16__GPIO3_IO16 0x4001b0b0 + >; + }; + + pinctrl_i2c1: i2c1grp { + fsl,pins = < + MX6QDL_PAD_CSI0_DAT8__I2C1_SDA 0x4001b8b1 + MX6QDL_PAD_CSI0_DAT9__I2C1_SCL 0x4001b8b1 + >; + }; + + pinctrl_i2c2: i2c2grp { + fsl,pins = < + MX6QDL_PAD_KEY_COL3__I2C2_SCL 0x4001b8b1 + MX6QDL_PAD_KEY_ROW3__I2C2_SDA 0x4001b8b1 + >; + }; + + pinctrl_uart1: uart1grp { + fsl,pins = < + MX6QDL_PAD_SD3_DAT7__UART1_TX_DATA 0x1b0b1 + MX6QDL_PAD_SD3_DAT6__UART1_RX_DATA 0x1b0b1 + >; + }; + + pinctrl_uart2: uart2grp { + fsl,pins = < + MX6QDL_PAD_EIM_D26__UART2_TX_DATA 0x1b0b1 + MX6QDL_PAD_EIM_D27__UART2_RX_DATA 0x1b0b1 + MX6QDL_PAD_EIM_D28__UART2_CTS_B 0x1b0b1 + MX6QDL_PAD_EIM_D29__UART2_RTS_B 0x1b0b1 + >; + }; + + pinctrl_usbh1: usbh1grp { + fsl,pins = < + MX6QDL_PAD_EIM_D31__GPIO3_IO31 0x1b0b1 + MX6QDL_PAD_ENET_RX_ER__USB_OTG_ID 0x17059 + >; + }; + + pinctrl_usdhc2: usdhc2grp { + fsl,pins = < + MX6QDL_PAD_SD2_CMD__SD2_CMD 0x17019 + MX6QDL_PAD_SD2_CLK__SD2_CLK 0x10019 + MX6QDL_PAD_SD2_DAT0__SD2_DATA0 0x17019 + MX6QDL_PAD_SD2_DAT1__SD2_DATA1 0x17019 + MX6QDL_PAD_SD2_DAT2__SD2_DATA2 0x17019 + MX6QDL_PAD_SD2_DAT3__SD2_DATA3 0x17019 + MX6QDL_PAD_NANDF_CS3__GPIO6_IO16 0x20000 + MX6QDL_PAD_GPIO_4__GPIO1_IO04 0x20000 + >; + }; + + pinctrl_usdhc4: usdhc4grp { + fsl,pins = < + MX6QDL_PAD_SD4_CMD__SD4_CMD 0x17019 + MX6QDL_PAD_SD4_CLK__SD4_CLK 0x10019 + MX6QDL_PAD_SD4_DAT0__SD4_DATA0 0x17019 + MX6QDL_PAD_SD4_DAT1__SD4_DATA1 0x17019 + MX6QDL_PAD_SD4_DAT2__SD4_DATA2 0x17019 + MX6QDL_PAD_SD4_DAT3__SD4_DATA3 0x17019 + MX6QDL_PAD_SD4_DAT4__SD4_DATA4 0x17019 + MX6QDL_PAD_SD4_DAT5__SD4_DATA5 0x17019 + MX6QDL_PAD_SD4_DAT6__SD4_DATA6 0x17019 + MX6QDL_PAD_SD4_DAT7__SD4_DATA7 0x17019 + >; + }; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart1>; + status = "okay"; +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2>; + uart-has-rtscts; +}; + +&usbh1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usbh1>; + vbus-supply = <®_usb_h1_vbus>; + status = "okay"; +}; + +&usdhc2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usdhc2>; + bus-width = <4>; + cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; + status = "okay"; +}; + +&usdhc4 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usdhc4>; + bus-width = <8>; + non-removable; + no-1-8-v; + keep-power-in-suspend; + status = "okay"; +}; -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description 2019-10-10 14:11 ` [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This commit defines the TPC70 imx6q board with device tree description. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (5 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate Lukasz Majewski 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This commit adds new file - imx6q-kp-u-boot.dtsi with a set of u-boot specific properties for imx6q KP device. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None arch/arm/dts/imx6q-kp-u-boot.dtsi | 59 +++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 arch/arm/dts/imx6q-kp-u-boot.dtsi diff --git a/arch/arm/dts/imx6q-kp-u-boot.dtsi b/arch/arm/dts/imx6q-kp-u-boot.dtsi new file mode 100644 index 0000000000..e6b71b22ae --- /dev/null +++ b/arch/arm/dts/imx6q-kp-u-boot.dtsi @@ -0,0 +1,59 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2019 + * Lukasz Majewski, DENX Software Engineering, lukma at denx.de + * + * SPDX-License-Identifier: GPL-2.0+ or X11 + */ + +#include "imx6qdl-u-boot.dtsi" + +/ { + clocks { + u-boot,dm-spl; + osc { + u-boot,dm-spl; + }; + }; + + wdt-reboot { + compatible = "wdt-reboot"; + wdt = <&wdog1>; + }; +}; + +&clks { + u-boot,dm-pre-reloc; +}; + +&gpio2 { + u-boot,dm-spl; +}; + +&pinctrl_uart1 { + u-boot,dm-spl; +}; + +&pinctrl_usdhc2 { + u-boot,dm-spl; +}; + +&pinctrl_usdhc4 { + u-boot,dm-spl; +}; + +&uart1 { + u-boot,dm-spl; +}; + +&usdhc2 { + u-boot,dm-spl; +}; + +&usdhc4 { + u-boot,dm-spl; +}; + +&wdog1 { + u-boot,dm-spl; +}; -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 2019-10-10 14:11 ` [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This commit adds new file - imx6q-kp-u-boot.dtsi with a set of u-boot > specific properties for imx6q KP device. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (6 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate Lukasz Majewski 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This patch converts the TPC70 to use driver model and device tree description in both SPL and u-boot proper. Notable changes (DM/DTS conversion): - PINCTRL{_IMX6} - DM_I2C - enable 'regulator' and 'pmic' commands - DM_MMC and BLK (USDHC) - DM_ETH - DM WDT (including SYSRESET) Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: - Adjust the code to being applicable on top of v2019.10 - Move CONFIG_SUPPORT_EMMC_BOOT to Kconfig arch/arm/mach-imx/mx6/Kconfig | 10 ++ board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c | 165 +--------------------- board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c | 133 +---------------- configs/kp_imx6q_tpc_defconfig | 31 +++- include/configs/kp_imx6q_tpc.h | 21 --- 5 files changed, 46 insertions(+), 314 deletions(-) diff --git a/arch/arm/mach-imx/mx6/Kconfig b/arch/arm/mach-imx/mx6/Kconfig index 7e5a667e81..00e3c486bc 100644 --- a/arch/arm/mach-imx/mx6/Kconfig +++ b/arch/arm/mach-imx/mx6/Kconfig @@ -510,9 +510,19 @@ config TARGET_KP_IMX6Q_TPC select BOARD_EARLY_INIT_F select BOARD_LATE_INIT select DM + select SPL_DM if SPL select DM_THERMAL + select DM_MMC + select DM_ETH + select DM_REGULATOR + select SPL_DM_REGULATOR if SPL + select DM_SERIAL + select DM_I2C + select DM_GPIO + select DM_USB select MX6QDL select SUPPORT_SPL + select SPL_SEPARATE_BSS if SPL imply CMD_DM imply CMD_SPL diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c index 7876a63068..22ae94e99f 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc.c @@ -9,65 +9,18 @@ #include <asm/arch/clock.h> #include <asm/arch/crm_regs.h> #include <asm/arch/imx-regs.h> -#include <asm/arch/iomux.h> #include <asm/arch/mx6-pins.h> #include <asm/arch/sys_proto.h> -#include <asm/gpio.h> -#include <asm/io.h> #include <asm/mach-imx/boot_mode.h> -#include <asm/mach-imx/iomux-v3.h> -#include <asm/mach-imx/mxc_i2c.h> #include <env.h> #include <errno.h> -#include <fsl_esdhc_imx.h> -#include <fuse.h> -#include <i2c.h> #include <miiphy.h> -#include <mmc.h> -#include <net.h> -#include <netdev.h> #include <usb.h> #include <usb/ehci-ci.h> #include <led.h> DECLARE_GLOBAL_DATA_PTR; -#define ENET_PAD_CTRL \ - (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ - PAD_CTL_HYS) - -#define I2C_PAD_CTRL \ - (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ - PAD_CTL_HYS | PAD_CTL_ODE | PAD_CTL_SRE_FAST) - -#define PC MUX_PAD_CTRL(I2C_PAD_CTRL) - -static struct i2c_pads_info kp_imx6q_tpc_i2c_pad_info0 = { - .scl = { - .i2c_mode = MX6Q_PAD_CSI0_DAT9__I2C1_SCL | PC, - .gpio_mode = MX6Q_PAD_CSI0_DAT9__GPIO5_IO27 | PC, - .gp = IMX_GPIO_NR(5, 27) - }, - .sda = { - .i2c_mode = MX6Q_PAD_CSI0_DAT8__I2C1_SDA | PC, - .gpio_mode = MX6Q_PAD_CSI0_DAT8__GPIO5_IO26 | PC, - .gp = IMX_GPIO_NR(5, 26) - } -}; - -static struct i2c_pads_info kp_imx6q_tpc_i2c_pad_info1 = { - .scl = { - .i2c_mode = MX6Q_PAD_KEY_COL3__I2C2_SCL | PC, - .gpio_mode = MX6Q_PAD_KEY_COL3__GPIO4_IO12 | PC, - .gp = IMX_GPIO_NR(4, 12) - }, - .sda = { - .i2c_mode = MX6Q_PAD_KEY_ROW3__I2C2_SDA | PC, - .gpio_mode = MX6Q_PAD_KEY_ROW3__GPIO4_IO13 | PC, - .gp = IMX_GPIO_NR(4, 13) - } -}; - int dram_init(void) { gd->ram_size = imx_ddr_size(); @@ -84,37 +37,6 @@ int overwrite_console(void) } #ifdef CONFIG_FEC_MXC -static iomux_v3_cfg_t const enet_pads[] = { - IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TXC__RGMII_TXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_TX_CTL__RGMII_TX_CTL | - MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL)), - IOMUX_PADS(PAD_RGMII_RX_CTL__RGMII_RX_CTL | - MUX_PAD_CTRL(ENET_PAD_CTRL)), - /* AR8031 PHY Reset */ - IOMUX_PADS(PAD_ENET_CRS_DV__GPIO1_IO25 | MUX_PAD_CTRL(NO_PAD_CTRL)), -}; - -static void eth_phy_reset(void) -{ - /* Reset AR8031 PHY */ - gpio_direction_output(IMX_GPIO_NR(1, 25), 0); - mdelay(10); - gpio_set_value(IMX_GPIO_NR(1, 25), 1); - udelay(100); -} - static int setup_fec_clock(void) { struct iomuxc *iomuxc_regs = (struct iomuxc *)IOMUXC_BASE_ADDR; @@ -126,15 +48,6 @@ static int setup_fec_clock(void) return enable_fec_anatop_clock(0, ENET_50MHZ); } -int board_eth_init(bd_t *bis) -{ - SETUP_IOMUX_PADS(enet_pads); - setup_fec_clock(); - eth_phy_reset(); - - return cpu_eth_init(bis); -} - static int ar8031_phy_fixup(struct phy_device *phydev) { unsigned short val; @@ -169,53 +82,6 @@ int board_phy_config(struct phy_device *phydev) } #endif -#ifdef CONFIG_FSL_ESDHC_IMX - -#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4) -static struct fsl_esdhc_cfg usdhc_cfg[] = { - { USDHC2_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 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 micro SD - * mmc2 eMMC - */ - gpio_direction_input(USDHC2_CD_GPIO); - - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - usdhc_cfg[1].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) { @@ -225,30 +91,6 @@ static void setup_usb(void) */ imx_iomux_set_gpr_register(1, 13, 1, 0); } - -int board_usb_phy_mode(int port) -{ - if (port == 1) - return USB_INIT_HOST; - else - return USB_INIT_DEVICE; -} - -int board_ehci_power(int port, int on) -{ - switch (port) { - case 0: - break; - case 1: - gpio_direction_output(IMX_GPIO_NR(3, 31), !!on); - break; - default: - printf("MXC USB port %d not yet supported\n", port); - return -EINVAL; - } - - return 0; -} #endif int board_early_init_f(void) @@ -257,6 +99,10 @@ int board_early_init_f(void) setup_usb(); #endif +#ifdef CONFIG_FEC_MXC + setup_fec_clock(); +#endif + return 0; } @@ -270,9 +116,6 @@ int board_init(void) /* Enable eim_slow clocks */ setbits_le32(&mxc_ccm->CCGR6, 0x1 << MXC_CCM_CCGR6_EMI_SLOW_OFFSET); - setup_i2c(0, CONFIG_SYS_I2C_SPEED, 0x7f, &kp_imx6q_tpc_i2c_pad_info0); - setup_i2c(1, CONFIG_SYS_I2C_SPEED, 0x7f, &kp_imx6q_tpc_i2c_pad_info1); - return 0; } diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c index e48a577f79..25a5e4b9ba 100644 --- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c +++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c @@ -9,30 +9,12 @@ #include <asm/arch/clock.h> #include <asm/arch/crm_regs.h> #include <asm/arch/imx-regs.h> -#include <asm/arch/iomux.h> #include <asm/arch/mx6-ddr.h> -#include <asm/arch/mx6-pins.h> #include <asm/arch/sys_proto.h> -#include <asm/gpio.h> -#include <asm/mach-imx/boot_mode.h> -#include <asm/mach-imx/iomux-v3.h> -#include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> #include <errno.h> -#include <fuse.h> -#include <fsl_esdhc_imx.h> -#include <i2c.h> -#include <mmc.h> #include <spl.h> -#define UART_PAD_CTRL \ - (PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \ - PAD_CTL_SRE_FAST | PAD_CTL_HYS) - -#define USDHC_PAD_CTRL \ - (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \ - PAD_CTL_SRE_FAST | PAD_CTL_HYS) - DECLARE_GLOBAL_DATA_PTR; static void ccgr_init(void) @@ -48,60 +30,6 @@ static void ccgr_init(void) writel(0x000003FF, &ccm->CCGR6); } -/* onboard microSD */ -static iomux_v3_cfg_t const usdhc2_pads[] = { - IOMUX_PADS(PAD_SD2_DAT0__SD2_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD2_DAT1__SD2_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD2_DAT2__SD2_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD2_DAT3__SD2_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD2_CLK__SD2_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD2_CMD__SD2_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_NANDF_CS3__GPIO6_IO16 | MUX_PAD_CTRL(NO_PAD_CTRL)), -}; - -/* eMMC */ -static iomux_v3_cfg_t const usdhc4_pads[] = { - IOMUX_PADS(PAD_SD4_DAT0__SD4_DATA0 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT1__SD4_DATA1 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT2__SD4_DATA2 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT3__SD4_DATA3 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT4__SD4_DATA4 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT5__SD4_DATA5 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT6__SD4_DATA6 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_DAT7__SD4_DATA7 | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_CLK__SD4_CLK | MUX_PAD_CTRL(USDHC_PAD_CTRL)), - IOMUX_PADS(PAD_SD4_CMD__SD4_CMD | MUX_PAD_CTRL(USDHC_PAD_CTRL)), -}; - -/* SD */ -static void setup_iomux_sd(void) -{ - SETUP_IOMUX_PADS(usdhc2_pads); - SETUP_IOMUX_PADS(usdhc4_pads); -} - -/* UART */ -static iomux_v3_cfg_t const uart1_pads[] = { - IOMUX_PADS(PAD_SD3_DAT7__UART1_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), - IOMUX_PADS(PAD_SD3_DAT6__UART1_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL)), -}; - -static void setup_iomux_uart(void) -{ - SETUP_IOMUX_PADS(uart1_pads); -} - -/* USB */ -static iomux_v3_cfg_t const usb_pads[] = { - IOMUX_PADS(PAD_GPIO_1__USB_OTG_ID | MUX_PAD_CTRL(NO_PAD_CTRL)), - IOMUX_PADS(PAD_EIM_D31__GPIO3_IO31 | MUX_PAD_CTRL(NO_PAD_CTRL)), -}; - -static void setup_iomux_usb(void) -{ - SETUP_IOMUX_PADS(usb_pads); -} - /* DDR3 */ static const struct mx6dq_iomux_ddr_regs mx6_ddr_ioregs = { .dram_sdclk_0 = 0x00000030, @@ -255,59 +183,6 @@ static void spl_dram_init(void) #endif } -struct fsl_esdhc_cfg usdhc_cfg[] = { - {USDHC2_BASE_ADDR}, - {USDHC4_BASE_ADDR}, -}; - -#define USDHC2_CD_GPIO IMX_GPIO_NR(1, 4) -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 USDHC2_BASE_ADDR: - ret = !gpio_get_value(USDHC2_CD_GPIO); - break; - case USDHC4_BASE_ADDR: - ret = 1; /* eMMC/uSDHC4 is always present */ - break; - } - - return ret; -} - -int board_mmc_init(bd_t *bd) -{ - struct src *psrc = (struct src *)SRC_BASE_ADDR; - unsigned int reg = readl(&psrc->sbmr1) >> 11; - /* - * Upon reading BOOT_CFG register the following map is done: - * Bit 11 and 12 of BOOT_CFG register can determine the current - * mmc port - * 0x1 SD1 - * 0x3 SD4 - */ - - switch (reg & 0x3) { - case 0x1: - SETUP_IOMUX_PADS(usdhc2_pads); - usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR; - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); - gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk; - break; - case 0x3: - SETUP_IOMUX_PADS(usdhc4_pads); - usdhc_cfg[0].esdhc_base = USDHC4_BASE_ADDR; - usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); - gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk; - break; - } - - return fsl_esdhc_initialize(bd, &usdhc_cfg[0]); -} - void board_boot_order(u32 *spl_boot_list) { u32 boot_device = spl_boot_device(); @@ -339,9 +214,8 @@ void board_init_f(ulong dummy) /* setup GP timer */ timer_init(); - setup_iomux_sd(); - setup_iomux_uart(); - setup_iomux_usb(); + /* Early - pre reloc - driver model setup */ + spl_early_init(); /* UART clocks enabled and gd valid - init serial console */ preloader_console_init(); @@ -351,7 +225,4 @@ void board_init_f(ulong dummy) /* Clear the BSS. */ memset(__bss_start, 0, __bss_end - __bss_start); - - /* load/boot image from boot device */ - board_init_r(NULL, 0); } diff --git a/configs/kp_imx6q_tpc_defconfig b/configs/kp_imx6q_tpc_defconfig index 75dd9d7c7a..686fa2b503 100644 --- a/configs/kp_imx6q_tpc_defconfig +++ b/configs/kp_imx6q_tpc_defconfig @@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x17800000 CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SPL_LIBCOMMON_SUPPORT=y CONFIG_SPL_LIBGENERIC_SUPPORT=y +CONFIG_SYS_MALLOC_F_LEN=0x2200 CONFIG_MX6_DDRCAL=y CONFIG_TARGET_KP_IMX6Q_TPC=y CONFIG_SPL_MMC_SUPPORT=y @@ -14,11 +15,14 @@ CONFIG_SPL_TEXT_BASE=0x00908000 CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_SYS_EXTRA_OPTIONS="IMX_CONFIG=arch/arm/mach-imx/spl_sd.cfg" +CONFIG_SD_BOOT=y CONFIG_BOOTDELAY=3 # CONFIG_USE_BOOTCOMMAND is not set CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y CONFIG_BOUNCE_BUFFER=y CONFIG_SPL_RAW_IMAGE_SUPPORT=y +CONFIG_SPL_PAYLOAD="u-boot.img" +CONFIG_SPL_POWER_SUPPORT=y CONFIG_SPL_WATCHDOG_SUPPORT=y CONFIG_AUTOBOOT_KEYED=y CONFIG_AUTOBOOT_STOP_STR="." @@ -27,19 +31,44 @@ CONFIG_AUTOBOOT_STOP_STR="." CONFIG_CMD_GPIO=y CONFIG_CMD_I2C=y CONFIG_CMD_MMC=y +# CONFIG_CMD_PINMUX is not set CONFIG_CMD_USB=y CONFIG_CMD_CACHE=y CONFIG_CMD_TIME=y CONFIG_CMD_EXT4_WRITE=y # CONFIG_ISO_PARTITION is not set # CONFIG_EFI_PARTITION is not set +CONFIG_OF_CONTROL=y +CONFIG_SPL_OF_CONTROL=y +CONFIG_DEFAULT_DEVICE_TREE="imx6q-kp" +CONFIG_OF_SPL_REMOVE_PROPS="interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents interrupts dmas dma-names" CONFIG_ENV_IS_IN_MMC=y +# CONFIG_BLOCK_CACHE is not set +CONFIG_SPL_CLK_IMX6Q=y +CONFIG_CLK_IMX6Q=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_SYS_I2C_MXC=y +CONFIG_SYS_I2C_MXC_I2C1=y +CONFIG_SYS_I2C_MXC_I2C2=y +CONFIG_LED=y +CONFIG_LED_GPIO=y +CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_FSL_USDHC=y CONFIG_PHYLIB=y CONFIG_PHY_ATHEROS=y CONFIG_FEC_MXC=y CONFIG_MII=y +CONFIG_PINCTRL=y +CONFIG_SPL_PINCTRL=y +CONFIG_PINCTRL_IMX6=y +CONFIG_DM_REGULATOR_FIXED=y +CONFIG_SPL_DM_REGULATOR_FIXED=y +# CONFIG_REQUIRE_SERIAL_CONSOLE is not set +CONFIG_MXC_UART=y +CONFIG_SYSRESET=y +CONFIG_SPL_SYSRESET=y +CONFIG_SYSRESET_WATCHDOG=y CONFIG_IMX_THERMAL=y CONFIG_USB=y +# CONFIG_SPL_DM_USB is not set CONFIG_IMX_WATCHDOG=y -CONFIG_OF_LIBFDT=y diff --git a/include/configs/kp_imx6q_tpc.h b/include/configs/kp_imx6q_tpc.h index df419a95f6..9377750e7a 100644 --- a/include/configs/kp_imx6q_tpc.h +++ b/include/configs/kp_imx6q_tpc.h @@ -25,30 +25,9 @@ #define CONFIG_SYS_MALLOC_LEN (4 * SZ_1M) /* FEC ethernet */ -#define IMX_FEC_BASE ENET_BASE_ADDR -#define CONFIG_FEC_XCV_TYPE RGMII -#define CONFIG_ETHPRIME "FEC" -#define CONFIG_FEC_MXC_PHYADDR 0 #define CONFIG_ARP_TIMEOUT 200UL -/* I2C Configs */ -#define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_MXC -#define CONFIG_SYS_I2C_MXC_I2C1 /* enable I2C bus 1 */ -#define CONFIG_SYS_I2C_MXC_I2C2 /* enable I2C bus 2 */ -#define CONFIG_SYS_I2C_SPEED 100000 - -/* MMC Configs */ -#define CONFIG_SYS_FSL_ESDHC_ADDR 0 -#define CONFIG_SYS_FSL_USDHC_NUM 2 #define CONFIG_SYS_MMC_ENV_DEV 1 /* 0 = SDHC2, 1 = SDHC4 (eMMC) */ -#define CONFIG_SUPPORT_EMMC_BOOT - -/* UART */ -#define CONFIG_MXC_UART -#define CONFIG_MXC_UART_BASE UART1_BASE -#define CONFIG_CONS_INDEX 1 -#define CONFIG_BAUDRATE 115200 /* USB Configs */ #ifdef CONFIG_CMD_USB -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot 2019-10-10 14:11 ` [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This patch converts the TPC70 to use driver model and device tree > description in both SPL and u-boot proper. > Notable changes (DM/DTS conversion): > - PINCTRL{_IMX6} > - DM_I2C > - enable 'regulator' and 'pmic' commands > - DM_MMC and BLK (USDHC) > - DM_ETH > - DM WDT (including SYSRESET) > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski ` (7 preceding siblings ...) 2019-10-10 14:11 ` [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot Lukasz Majewski @ 2019-10-10 14:11 ` Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 8 siblings, 1 reply; 18+ messages in thread From: Lukasz Majewski @ 2019-10-10 14:11 UTC (permalink / raw) To: u-boot This patch updates envs responsible for using USB pendrive as a SWUpdate based tool for recovery and update. Signed-off-by: Lukasz Majewski <lukma@denx.de> --- Changes in v3: None include/configs/kp_imx6q_tpc.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/configs/kp_imx6q_tpc.h b/include/configs/kp_imx6q_tpc.h index 9377750e7a..77a93d7265 100644 --- a/include/configs/kp_imx6q_tpc.h +++ b/include/configs/kp_imx6q_tpc.h @@ -66,8 +66,9 @@ "SPL_file=SPL\0" \ "wic_file=kp-image-kpimx6qtpc.wic\0" \ "upd_image=st.4k\0" \ - "updargs=setenv bootargs console=${console} ${smp}"\ - "rdinit=${rdinit} ${debug} ${displayargs}\0" \ + "updargs=setenv bootargs console=${console} ${smp} ${displayargs}\0" \ + "initrd_ram_dev=/dev/ram\0" \ + "addswupdate=setenv bootargs ${bootargs} root=${initrd_ram_dev} rw\0" \ "loadusb=usb start; " \ "fatload usb 0 ${loadaddr} ${upd_image}\0" \ "upd_uboot_sd=" \ @@ -95,6 +96,8 @@ "usbupd=echo Booting update from usb ...; " \ "setenv bootargs; " \ "run updargs; " \ + "run addinitrd; " \ + "run addswupdate; " \ "run loadusb; " \ "bootm ${loadaddr}#${fit_config}\0" \ BOOTENV -- 2.20.1 ^ permalink raw reply related [flat|nested] 18+ messages in thread
* [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate 2019-10-10 14:11 ` [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate Lukasz Majewski @ 2019-10-14 12:40 ` sbabic at denx.de 0 siblings, 0 replies; 18+ messages in thread From: sbabic at denx.de @ 2019-10-14 12:40 UTC (permalink / raw) To: u-boot > This patch updates envs responsible for using USB pendrive as a > SWUpdate based tool for recovery and update. > Signed-off-by: Lukasz Majewski <lukma@denx.de> Applied to u-boot-imx, master, thanks ! Best regards, Stefano Babic -- ===================================================================== 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 ===================================================================== ^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2019-10-14 12:40 UTC | newest] Thread overview: 18+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2019-10-10 14:11 [U-Boot] [PATCH v3 0/9] dm: Convert TPC70 to use DM and DTS in SPL and u-boot proper Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 1/9] imx: tpc70: config: Add script commands to update u-boot and OE's wic Lukasz Majewski 2019-10-10 14:11 ` [U-Boot] [PATCH v3 2/9] imx: tpc70: config: Update TPC70 config to support eMMC's boot0 SPL update Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 3/9] imx: tpc70: Add board_boot_order() to distinguish between eMMC and SD boot Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 4/9] imx: tpc70: cosmetic: Replace magic numbers when setting ENET clock Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 5/9] imx: tpc70: led: Enable LED default state Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 6/9] imx: tpc70: dts: Add TPC70 board (imx6q based) device tree description Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 7/9] imx: dts: Add u-boot specific set of device tree properties for tpc70 Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 8/9] imx: tpc70: Convert TPC70 (imx6q) board to use DM/DTS in SPL and u-boot Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de 2019-10-10 14:11 ` [U-Boot] [PATCH v3 9/9] imx: config: Update KP's TPC70 config to support SWUpdate Lukasz Majewski 2019-10-14 12:40 ` sbabic at denx.de
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox