Skip to contentSkip to conversation

imx8qxp: siemens board: updates / sync with mainline

PATCH Superseded Heiko Schocher 5 participants 27 messages Nov 18, 2024 – Nov 19, 2024

Subsystems (6)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover imx8qxp: siemens board: updates / sync with mainline

Updating the imx8qxp based siemens board. The current state of the siemens imx8qxp board is in an old not really working state.

This series brings mainline back working on the siemens deneb board, the guedi board is dropped as not longer used.

make all runs fine without having all the needed firmware images on board, and so CI @azure.

If you want to have a working image you need to copy the following images to your build directory $BDIR:

ATF : bl31-imx8dx.bin -> $BDIR/bl31.bin
AHAB: mx8qxc0-ahab-container.img -> $BDIR/mx8qxc0-ahab-container.img
SCFW: deneb-scfw-tcm.bin -> $BDIR/mx8qx-mek-scfw-tcm.bin

and call make flash.bin

There are also updates for ethernet and USB support, but not ready to push upstream currently, hopefully following soon.

Azure build:
https://dev.azure.com/hs0298/hs/_build/results?buildId=135&view=results

patchseries needs patch:
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

series is based on mainline commit:
56accc56b9a ("bios_emulator: fix first argument of pci_{read,write}_config_* function calls")

Ah yes, not to forget, we work at siemens also on a CI setup to have a mainline nightly build and test on hardware. We already have such a CI for internall U-Boot versions up and running, but we do not want again loose sync with mainline.

Changes in v2:
remove patch "siemens: capricorn: add missing ARCH_MISC_INIT" as we do not need this config option anymore.
remove patch "siemens: imx8-capricorn-u-boot.dtsi: add fec2" as fec2 is not used in SPL!
- work on comments from Stefan:
- rename driver file from scu_wdt.c to scu_pmic_wdt.c
- rename Kconfig symbol from CONFIG_WDT_IMX_SCU to CONFIG_WDT_SCU_PMIC
- reworked Kconfig help text
- add comment that TIMER_FUNC_CTRL_PMIC_WDOG is a siemens specific SCU API extension in their SCFW.
- reworked commit message
add Reviewed-by from Alexander
- add "bootph-all" in A35_0 node to u-boot.dtsi not
in dts for the board!
- add comment from Walter
fix typo: than -> then
- add Reviewed-by from Alexander
- add comments from Fabio
fix typo: silicium -> silicon
- add Reviewed-by from Alexander
- use renamed Kconfig symbol CONFIG_WDT_SCU_PMIC
- add comments rom Fabio and Enrico
do not remove DMA for console
remove u-boot specific property addition, instead
add it in arch/arm/dts/imx8qxp-u-boot.dtsi
- add comments from Fabio
rename subject line and rework commit message,
alse remove unneeded comment in checkboard()
- add comment from Fabio
add From line, as patch is from Alessandro
fix typo in commit description: drace -> draco
- remove CONFIG_XPL_BUILD in board_init as
board_init is not called from SPL.
add From tag
reworked the commit message a little bit
Add From tag
- add Reviewed-by from Alexander

Alessandro Zini (1):
siemens: capricorn: add HW version information to boot log

Enrico Leto (6):
siemens: capricorn: move to cxg3 reference project with deneb board
siemens: capricorn: get ram size from system controller
siemens: capricorn: get module name from eeprom
siemens: add ddr full memory test
siemens: add ddr signal integrity test
siemens: capricorn: update maintainers

Heiko Schocher (13):
wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU
net: fec_mxc: fix probing for imx8qxp
tools: imx8image: Improve error message
imx: imx_cntr_image.sh: prevent warning for missing spl
imx8qxp: Fix build when using SPL
siemens: imx8qxp-capricorn-u-boot.dtsi: fix boot
siemens: capricorn: use DCD_SKIP entry
siemens: imximage.cfg: correct comment
siemens: imximage.cfg: sync image names
siemens: configs/capricorn_cxg3_defconfig: updates
siemens: capricorn: sync spl code with 8qxp-mek
siemens: imx8-capricorn.dtsi: add wdt device
siemens: capricorn: small board updates

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/imx8-capricorn-cxg3.dts          | 129 +++++++
 ...u-boot.dtsi => imx8-capricorn-u-boot.dtsi} |  67 ++--
 ...qxp-capricorn.dtsi => imx8-capricorn.dtsi} | 109 +-----
 arch/arm/dts/imx8-deneb.dts                   |  10 -
 arch/arm/dts/imx8-giedi.dts                   |  10 -
 arch/arm/dts/imx8qxp-u-boot.dtsi              |   2 +
 arch/arm/mach-imx/imx8/Kconfig                |  11 +-
 board/boundary/nitrogen6x/nitrogen6x.c        |   2 +-
 board/siemens/capricorn/Kconfig               |  25 +-
 board/siemens/capricorn/MAINTAINERS           |  12 +-
 board/siemens/capricorn/Makefile              |   2 +
 board/siemens/capricorn/board.c               |  70 +++-
 board/siemens/capricorn/imximage.cfg          |  21 +-
 board/siemens/capricorn/spl.c                 |  43 +++
 board/siemens/capricorn/spl_memory_test.c     | 158 ++++++++
 board/siemens/capricorn/spl_memory_test.h     |   7 +
 board/siemens/common/Kconfig                  |   4 +
 board/siemens/common/board.h                  |  44 +++
 board/siemens/common/ddr_si_test.c            | 348 ++++++++++++++++++
 board/siemens/draco/board.h                   |  10 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c          |   2 +-
 ...neb_defconfig => capricorn_cxg3_defconfig} |  20 +-
 configs/giedi_defconfig                       | 133 -------
 drivers/misc/imx8/scu_api.c                   |  21 ++
 drivers/net/fec_mxc.c                         |  14 +-
 drivers/watchdog/Kconfig                      |   7 +
 drivers/watchdog/Makefile                     |   1 +
 drivers/watchdog/scu_pmic_wdt.c               |  59 +++
 include/configs/capricorn-common.h            |   4 +-
 include/configs/deneb.h                       |  16 -
 include/firmware/imx/sci/rpc.h                |   3 +
 include/firmware/imx/sci/sci.h                |   1 +
 include/netdev.h                              |   2 +-
 tools/imx8image.c                             |   2 +-
 tools/imx_cntr_image.sh                       |   4 +
 36 files changed, 1001 insertions(+), 375 deletions(-)
 create mode 100644 arch/arm/dts/imx8-capricorn-cxg3.dts
 rename arch/arm/dts/{imx8qxp-capricorn-u-boot.dtsi => imx8-capricorn-u-boot.dtsi} (54%)
 rename arch/arm/dts/{imx8qxp-capricorn.dtsi => imx8-capricorn.dtsi} (64%)
 delete mode 100644 arch/arm/dts/imx8-deneb.dts
 delete mode 100644 arch/arm/dts/imx8-giedi.dts
 create mode 100644 board/siemens/capricorn/spl_memory_test.c
 create mode 100644 board/siemens/capricorn/spl_memory_test.h
 create mode 100644 board/siemens/common/board.h
 create mode 100644 board/siemens/common/ddr_si_test.c
 rename configs/{deneb_defconfig => capricorn_cxg3_defconfig} (89%)
 delete mode 100644 configs/giedi_defconfig
 create mode 100644 drivers/watchdog/scu_pmic_wdt.c
 delete mode 100644 include/configs/deneb.h
Signature · 1 line
2.20.1
#1 lore raw

PATCH v2 1/20 wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

---

Changes in v2:
- work on comments from Stefan:
- rename driver file from scu_wdt.c to scu_pmic_wdt.c
- rename Kconfig symbol from CONFIG_WDT_IMX_SCU to CONFIG_WDT_SCU_PMIC
- reworked Kconfig help text
- add comment that TIMER_FUNC_CTRL_PMIC_WDOG is a siemens specific SCU API extension in their SCFW.
- reworked commit message

 drivers/misc/imx8/scu_api.c     | 21 ++++++++++++
 drivers/watchdog/Kconfig        |  7 ++++
 drivers/watchdog/Makefile       |  1 +
 drivers/watchdog/scu_pmic_wdt.c | 59 +++++++++++++++++++++++++++++++++
 include/firmware/imx/sci/rpc.h  |  3 ++
 include/firmware/imx/sci/sci.h  |  1 +
 6 files changed, 92 insertions(+)
 create mode 100644 drivers/watchdog/scu_pmic_wdt.c
drivers/misc/imx8/scu_api.c +21 -0
index 591d71b096a..edb6923151a 100644
@@ -951,6 +951,27 @@ int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window)
 	return ret;
 }
 
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd)
+{
+	struct udevice *dev = gd->arch.scu_dev;
+	struct sc_rpc_msg_s msg;
+	int size = sizeof(struct sc_rpc_msg_s);
+	int ret;
+
+	RPC_VER(&msg) = SC_RPC_VERSION;
+	RPC_SVC(&msg) = (u8)SC_RPC_SVC_TIMER;
+	RPC_FUNC(&msg) = (u8)TIMER_FUNC_CTRL_PMIC_WDOG;
+	RPC_U8(&msg, 0U) = (u8)cmd;
+	RPC_SIZE(&msg) = 2U;
+
+	ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+	if (ret)
+		printf("%s: res:%d\n",
+		       __func__, RPC_R8(&msg));
+
+	return ret;
+}
+
 int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
 			 sc_faddr_t addr)
 {
drivers/watchdog/Kconfig +7 -0
index 0e45f0a0922..f317d0922cb 100644
@@ -428,6 +428,13 @@ config WDT_ARM_SMC
 	  Select this to enable Arm SMC watchdog timer. This watchdog will manage
 	  a watchdog based on ARM SMCCC communication.
 
+config WDT_SCU_PMIC
+	bool "Enable PMIC Watchdog Timer support for siemens platforms"
+	depends on IMX8 && WDT
+	help
+	  Select this to enable the PMIC watchdog driver controlled via
+	  IMX8 SCU API found on Siemens platforms.
+
 config SPL_WDT
 	bool "Enable driver model for watchdog timer drivers in SPL"
 	depends on SPL_DM
drivers/watchdog/Makefile +1 -0
index 0b107c008f7..fed924f7e01 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o
 obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
 obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o
 obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o
+obj-$(CONFIG_WDT_SCU_PMIC) += scu_pmic_wdt.o
 obj-$(CONFIG_WDT_SL28CPLD) += sl28cpld-wdt.o
 obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
 obj-$(CONFIG_WDT_STARFIVE) += starfive_wdt.o
drivers/watchdog/scu_pmic_wdt.c new file +59 -0

59 lines not on this page · raw message

include/firmware/imx/sci/rpc.h +3 -0
index 28adec2a8e1..6f16cf4a8b6 100644
@@ -231,4 +231,7 @@ struct sc_rpc_msg_s {
 #define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for sc_timer_set_sysctr_periodic_alarm() RPC call */
 #define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for sc_timer_cancel_sysctr_alarm() RPC call */
 
+/* siemens specific API extension from Siemens */
+#define TIMER_FUNC_CTRL_PMIC_WDOG 20U  /*!< Index for sc_timer_ctrl_pmic_wdog() RPC call */
+
 #endif /* SC_RPC_H */
include/firmware/imx/sci/sci.h +1 -0
index 7d8499f070a..b971b62836d 100644
@@ -123,6 +123,7 @@ int sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid);
 
 /* Timer API */
 int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window);
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd);
 
 /* SECO API */
 int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
Signature · 1 line
2.20.1
Reviewed-by on v2 1/20
#2 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

Quoted 6 lines · Heiko Schocher

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

Quoted 19 lines

---

Changes in v2:
- work on comments from Stefan:
  - rename driver file from scu_wdt.c to scu_pmic_wdt.c
  - rename Kconfig symbol from CONFIG_WDT_IMX_SCU to CONFIG_WDT_SCU_PMIC
  - reworked Kconfig help text
  - add comment that TIMER_FUNC_CTRL_PMIC_WDOG is a siemens specific SCU API extension in their SCFW.
  - reworked commit message

 drivers/misc/imx8/scu_api.c     | 21 ++++++++++++ drivers/watchdog/Kconfig        |  7 ++++ drivers/watchdog/Makefile       |  1 + drivers/watchdog/scu_pmic_wdt.c | 59 +++++++++++++++++++++++++++++++++ include/firmware/imx/sci/rpc.h  |  3 ++ include/firmware/imx/sci/sci.h  |  1 +

 6 files changed, 92 insertions(+)

 create mode 100644 drivers/watchdog/scu_pmic_wdt.c

Signature · 3 lines
Alexander Sverdlin
Siemens AG
www.siemens.com
#3 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

In reply to Heiko Schocher

Hello Heiko,

some nitpicks below:

Quoted 64 lines · Heiko Schocher

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

---

Changes in v2:
- work on comments from Stefan:
- rename driver file from scu_wdt.c to scu_pmic_wdt.c
- rename Kconfig symbol from CONFIG_WDT_IMX_SCU to CONFIG_WDT_SCU_PMIC
- reworked Kconfig help text
- add comment that TIMER_FUNC_CTRL_PMIC_WDOG is a siemens specific SCU API extension in their SCFW.
- reworked commit message

 drivers/misc/imx8/scu_api.c     | 21 ++++++++++++
 drivers/watchdog/Kconfig        |  7 ++++
 drivers/watchdog/Makefile       |  1 +
 drivers/watchdog/scu_pmic_wdt.c | 59 +++++++++++++++++++++++++++++++++
 include/firmware/imx/sci/rpc.h  |  3 ++
 include/firmware/imx/sci/sci.h  |  1 +
 6 files changed, 92 insertions(+)
 create mode 100644 drivers/watchdog/scu_pmic_wdt.c
drivers/misc/imx8/scu_api.c +21 -0
index 591d71b096a..edb6923151a 100644
@@ -951,6 +951,27 @@ int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window)
        return ret;
 }
 
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SVC(&msg) = (u8)SC_RPC_SVC_TIMER;
+       RPC_FUNC(&msg) = (u8)TIMER_FUNC_CTRL_PMIC_WDOG;
+       RPC_U8(&msg, 0U) = (u8)cmd;
+       RPC_SIZE(&msg) = 2U;
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s: res:%d\n",
+                      __func__, RPC_R8(&msg));
+
+       return ret;
+}
+
 int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
                         sc_faddr_t addr)
 {
drivers/watchdog/Kconfig +0 -0
index 0e45f0a0922..f317d0922cb 100644

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 432

Quoted 5 lines
drivers/watchdog/Kconfig +2 -0
@@ -428,6 +428,13 @@ config WDT_ARM_SMC
          Select this to enable Arm SMC watchdog timer. This watchdog will manage
          a watchdog based on ARM SMCCC communication.
 
+config WDT_SCU_PMIC
+       bool "Enable PMIC Watchdog Timer support for siemens platforms"

s/siemens/Siemens/g

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 433

Quoted 1 line
drivers/watchdog/Kconfig +1 -0
+       depends on IMX8 && WDT

depends on ARCH_IMX8 && WDT ?
IMX8 Kconfig symbol implies additional dependency on CAAM module, which is not the case with this driver.

Quoted 89 lines
drivers/watchdog/Kconfig +4 -0
+       help
+         Select this to enable the PMIC watchdog driver controlled via
+         IMX8 SCU API found on Siemens platforms.
+
 config SPL_WDT
        bool "Enable driver model for watchdog timer drivers in SPL"
        depends on SPL_DM
drivers/watchdog/Makefile +1 -0
index 0b107c008f7..fed924f7e01 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o
 obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
 obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o
 obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o
+obj-$(CONFIG_WDT_SCU_PMIC) += scu_pmic_wdt.o
 obj-$(CONFIG_WDT_SL28CPLD) += sl28cpld-wdt.o
 obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
 obj-$(CONFIG_WDT_STARFIVE) += starfive_wdt.o
drivers/watchdog/scu_pmic_wdt.c new file +59 -0
new file mode 100644
index 00000000000..e7ca00de654
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Driver for a PMIC watchdog timer controlled via Siemens SCU firmware
+ * extensions. Only useful on some Siemens i.MX8-based platforms as
+ * special NXP SCFW is needed which provides the needed SCU API.
+ *
+ * Copyright (C) 2024 Siemens AG
+ */
+
+#include <dm.h>
+#include <wdt.h>
+#include <firmware/imx/sci/sci.h>
+
+/* watchdog commands */
+#define CMD_START_WDT 0x55
+#define CMD_STOP_WDT  0x45
+#define CMD_PING_WDT  0x35
+
+static int scu_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
+{
+       /* start external watchdog via Timer API */
+       return sc_timer_control_pmic_wdog(-1, CMD_START_WDT);
+}
+
+static int scu_wdt_stop(struct udevice *dev)
+{
+       /* stop external watchdog via Timer API */
+       return sc_timer_control_pmic_wdog(-1, CMD_STOP_WDT);
+}
+
+static int scu_wdt_reset(struct udevice *dev)
+{
+       return sc_timer_control_pmic_wdog(-1, CMD_PING_WDT);
+}
+
+static int scu_wdt_probe(struct udevice *dev)
+{
+       debug("%s(dev=%p)\n", __func__, dev);
+       return 0;
+}
+
+static const struct wdt_ops scu_wdt_ops = {
+       .reset          = scu_wdt_reset,
+       .start          = scu_wdt_start,
+       .stop           = scu_wdt_stop,
+};
+
+static const struct udevice_id scu_wdt_ids[] = {
+       { .compatible = "siemens,scu-wdt" },
+       { }
+};
+
+U_BOOT_DRIVER(scu_wdt) = {
+       .name           = "scu_wdt",
+       .id             = UCLASS_WDT,
+       .of_match       = scu_wdt_ids,
+       .probe          = scu_wdt_probe,
+       .ops            = &scu_wdt_ops,
+};
include/firmware/imx/sci/rpc.h +0 -0
index 28adec2a8e1..6f16cf4a8b6 100644

include/firmware/imx/sci/rpc.h struct sc_rpc_msg_s { · line 234

Quoted 4 lines
include/firmware/imx/sci/rpc.h +1 -0
@@ -231,4 +231,7 @@ struct sc_rpc_msg_s {
 #define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for sc_timer_set_sysctr_periodic_alarm() RPC call */
 #define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for sc_timer_cancel_sysctr_alarm() RPC call */
 
+/* siemens specific API extension from Siemens */

please drop one "siemens"

Quoted 18 lines
include/firmware/imx/sci/rpc.h +2 -0
+#define TIMER_FUNC_CTRL_PMIC_WDOG 20U  /*!< Index for sc_timer_ctrl_pmic_wdog() RPC call */
+
 #endif /* SC_RPC_H */
include/firmware/imx/sci/sci.h +1 -1
index 7d8499f070a..b971b62836d 100644
@@ -123,6 +123,7 @@ int sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid);
 
 /* Timer API */
 int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window);
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd);
 
 /* SECO API */
 int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
--

2.20.1

Signature · 6 lines
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk
Senior Software Engineer, Embedded & Security
E: [email protected]
W: www.foundries.io
#4 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

Hello Igor,

Quoted 3 lines · Igor Opaniuk

Hello Heiko,

some nitpicks below:

Thanks!

Quoted 68 lines · Heiko Schocher
Quoted 67 lines

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

---

Changes in v2:
- work on comments from Stefan:
- rename driver file from scu_wdt.c to scu_pmic_wdt.c
- rename Kconfig symbol from CONFIG_WDT_IMX_SCU to CONFIG_WDT_SCU_PMIC
- reworked Kconfig help text
- add comment that TIMER_FUNC_CTRL_PMIC_WDOG is a siemens specific SCU API extension in their SCFW.
- reworked commit message

  drivers/misc/imx8/scu_api.c     | 21 ++++++++++++
  drivers/watchdog/Kconfig        |  7 ++++
  drivers/watchdog/Makefile       |  1 +
  drivers/watchdog/scu_pmic_wdt.c | 59 +++++++++++++++++++++++++++++++++
  include/firmware/imx/sci/rpc.h  |  3 ++
  include/firmware/imx/sci/sci.h  |  1 +
  6 files changed, 92 insertions(+)

create mode 100644 drivers/watchdog/scu_pmic_wdt.c

drivers/misc/imx8/scu_api.c +21 -0
index 591d71b096a..edb6923151a 100644
@@ -951,6 +951,27 @@ int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window)
         return ret;
  }
 
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd)
+{
+       struct udevice *dev = gd->arch.scu_dev;
+       struct sc_rpc_msg_s msg;
+       int size = sizeof(struct sc_rpc_msg_s);
+       int ret;
+
+       RPC_VER(&msg) = SC_RPC_VERSION;
+       RPC_SVC(&msg) = (u8)SC_RPC_SVC_TIMER;
+       RPC_FUNC(&msg) = (u8)TIMER_FUNC_CTRL_PMIC_WDOG;
+       RPC_U8(&msg, 0U) = (u8)cmd;
+       RPC_SIZE(&msg) = 2U;
+
+       ret = misc_call(dev, SC_FALSE, &msg, size, &msg, size);
+       if (ret)
+               printf("%s: res:%d\n",
+                      __func__, RPC_R8(&msg));
+
+       return ret;
+}
+
  int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
                          sc_faddr_t addr)
  {
drivers/watchdog/Kconfig +0 -0
index 0e45f0a0922..f317d0922cb 100644
@@ -428,6 +428,13 @@ config WDT_ARM_SMC
           Select this to enable Arm SMC watchdog timer. This watchdog will manage
           a watchdog based on ARM SMCCC communication.
 
Quoted 4 lines

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 432

Quoted 2 lines
drivers/watchdog/Kconfig +2 -0
+config WDT_SCU_PMIC
+       bool "Enable PMIC Watchdog Timer support for siemens platforms"

s/siemens/Siemens/g

Fixed.

Quoted 4 lines

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 433

Quoted 1 line
drivers/watchdog/Kconfig +1 -0
+       depends on IMX8 && WDT

depends on ARCH_IMX8 && WDT ?
IMX8 Kconfig symbol implies additional dependency on CAAM module, which is not the case with this driver.

Ah, good point! Thanks!

Quoted 93 lines
Quoted 93 lines
drivers/watchdog/Kconfig +4 -0
+       help
+         Select this to enable the PMIC watchdog driver controlled via
+         IMX8 SCU API found on Siemens platforms.
+
  config SPL_WDT
         bool "Enable driver model for watchdog timer drivers in SPL"
         depends on SPL_DM
drivers/watchdog/Makefile +1 -0
index 0b107c008f7..fed924f7e01 100644
@@ -45,6 +45,7 @@ obj-$(CONFIG_WDT_OCTEONTX) += octeontx_wdt.o
  obj-$(CONFIG_WDT_OMAP3) += omap_wdt.o
  obj-$(CONFIG_WDT_SBSA) += sbsa_gwdt.o
  obj-$(CONFIG_WDT_K3_RTI) += rti_wdt.o
+obj-$(CONFIG_WDT_SCU_PMIC) += scu_pmic_wdt.o
  obj-$(CONFIG_WDT_SL28CPLD) += sl28cpld-wdt.o
  obj-$(CONFIG_WDT_SP805) += sp805_wdt.o
  obj-$(CONFIG_WDT_STARFIVE) += starfive_wdt.o
drivers/watchdog/scu_pmic_wdt.c new file +59 -0
new file mode 100644
index 00000000000..e7ca00de654
@@ -0,0 +1,59 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Driver for a PMIC watchdog timer controlled via Siemens SCU firmware
+ * extensions. Only useful on some Siemens i.MX8-based platforms as
+ * special NXP SCFW is needed which provides the needed SCU API.
+ *
+ * Copyright (C) 2024 Siemens AG
+ */
+
+#include <dm.h>
+#include <wdt.h>
+#include <firmware/imx/sci/sci.h>
+
+/* watchdog commands */
+#define CMD_START_WDT 0x55
+#define CMD_STOP_WDT  0x45
+#define CMD_PING_WDT  0x35
+
+static int scu_wdt_start(struct udevice *dev, u64 timeout_ms, ulong flags)
+{
+       /* start external watchdog via Timer API */
+       return sc_timer_control_pmic_wdog(-1, CMD_START_WDT);
+}
+
+static int scu_wdt_stop(struct udevice *dev)
+{
+       /* stop external watchdog via Timer API */
+       return sc_timer_control_pmic_wdog(-1, CMD_STOP_WDT);
+}
+
+static int scu_wdt_reset(struct udevice *dev)
+{
+       return sc_timer_control_pmic_wdog(-1, CMD_PING_WDT);
+}
+
+static int scu_wdt_probe(struct udevice *dev)
+{
+       debug("%s(dev=%p)\n", __func__, dev);
+       return 0;
+}
+
+static const struct wdt_ops scu_wdt_ops = {
+       .reset          = scu_wdt_reset,
+       .start          = scu_wdt_start,
+       .stop           = scu_wdt_stop,
+};
+
+static const struct udevice_id scu_wdt_ids[] = {
+       { .compatible = "siemens,scu-wdt" },
+       { }
+};
+
+U_BOOT_DRIVER(scu_wdt) = {
+       .name           = "scu_wdt",
+       .id             = UCLASS_WDT,
+       .of_match       = scu_wdt_ids,
+       .probe          = scu_wdt_probe,
+       .ops            = &scu_wdt_ops,
+};
include/firmware/imx/sci/rpc.h +0 -0
index 28adec2a8e1..6f16cf4a8b6 100644
@@ -231,4 +231,7 @@ struct sc_rpc_msg_s {
  #define TIMER_FUNC_SET_SYSCTR_PERIODIC_ALARM 17U /* Index for sc_timer_set_sysctr_periodic_alarm() RPC call */
  #define TIMER_FUNC_CANCEL_SYSCTR_ALARM 18U /* Index for sc_timer_cancel_sysctr_alarm() RPC call */
 
Quoted 2 lines

include/firmware/imx/sci/rpc.h struct sc_rpc_msg_s { · line 234

Quoted 1 line
include/firmware/imx/sci/rpc.h +1 -0
+/* siemens specific API extension from Siemens */

please drop one "siemens"

Fixed!

Thanks for your comments!

bye,
Heiko

Quoted 20 lines
Quoted 18 lines
include/firmware/imx/sci/rpc.h +2 -0
+#define TIMER_FUNC_CTRL_PMIC_WDOG 20U  /*!< Index for sc_timer_ctrl_pmic_wdog() RPC call */
+
  #endif /* SC_RPC_H */
include/firmware/imx/sci/sci.h +1 -1
index 7d8499f070a..b971b62836d 100644
@@ -123,6 +123,7 @@ int sc_rm_set_master_sid(sc_ipc_t ipc, sc_rsrc_t resource, sc_rm_sid_t sid);
 
  /* Timer API */
  int sc_timer_set_wdog_window(sc_ipc_t ipc, sc_timer_wdog_time_t window);
+int sc_timer_control_pmic_wdog(sc_ipc_t ipc, u8 cmd);
 
  /* SECO API */
  int sc_seco_authenticate(sc_ipc_t ipc, sc_seco_auth_cmd_t cmd,
--

2.20.1

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#5 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

In reply to Heiko Schocher
Quoted 6 lines · Heiko Schocher

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

...

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 431

Quoted 9 lines
drivers/watchdog/Kconfig +1 -0
index 0e45f0a0922..f317d0922cb 100644
@@ -428,6 +428,13 @@ config WDT_ARM_SMC
 	  Select this to enable Arm SMC watchdog timer. This watchdog will manage
 	  a watchdog based on ARM SMCCC communication.
 
+config WDT_SCU_PMIC

Isn't this a too generic name for something the is platform specific? Or this is not Siemens specific? One or the other, I would say.

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 432

Quoted 1 line
drivers/watchdog/Kconfig +1 -0
+	bool "Enable PMIC Watchdog Timer support for siemens platforms"

^ Siemens? You are using appropriate uppercase everywhere ...

Francesco

#6 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

Quoted 18 lines · Francesco Dolcini
Quoted 6 lines · Heiko Schocher

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

...

Quoted 8 lines
drivers/watchdog/Kconfig +0 -0
index 0e45f0a0922..f317d0922cb 100644
@@ -428,6 +428,13 @@ config WDT_ARM_SMC
  	  Select this to enable Arm SMC watchdog timer. This watchdog will manage
  	  a watchdog based on ARM SMCCC communication.
 
Quoted 3 lines

drivers/watchdog/Kconfig config WDT_ARM_SMC · line 431

Quoted 1 line
drivers/watchdog/Kconfig +1 -0
+config WDT_SCU_PMIC

Isn't this a too generic name for something the is platform specific? Or this is not Siemens specific? One or the other, I would say.

This is also my only concern right now. If this driver is specific for a Siemens SCU firmware, then IMHO the Kconfig option and the driver filename should reflect this.

Thanks,
Stefan

#7 lore raw

Re: [PATCH v2 01/20] wdt: imx8qxp: add option to control external PMIC wdt via IMX8 SCU

Hi Francesco, Stefan!

Quoted 22 lines · Stefan Roese
Quoted 10 lines · Francesco Dolcini
Quoted 6 lines · Heiko Schocher

Driver for a PMIC watchdog timer controlled via Siemens SCU firmware extensions. Only useful on some Siemens i.MX8-based platforms as special SCFW is needed which provides the needed SCU API.

...

Quoted 10 lines
Quoted 8 lines
drivers/watchdog/Kconfig +0 -0
index 0e45f0a0922..f317d0922cb 100644
@@ -428,6 +428,13 @@ config WDT_ARM_SMC

        Select this to enable Arm SMC watchdog timer. This watchdog will manage a watchdog based on ARM SMCCC communication.
+config WDT_SCU_PMIC

Isn't this a too generic name for something the is platform specific? Or this is not Siemens specific? One or the other, I would say.

Quoted 3 lines

This is also my only concern right now. If this driver is specific for a Siemens SCU firmware, then IMHO the Kconfig option and the driver filename should reflect this.

Yep, I change this in next version.

Thanks!

bye,
Heiko

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#8 lore raw

PATCH v2 2/20 net: fec_mxc: fix probing for imx8qxp

In reply to Heiko Schocher

probing on capricorn board (imx8qxp based) brings:

Can't find FEC0 clk rate: -19

Cause is that when probing fec_mxc driver, fec_mii_setspeed() is called which calls fec_get_clk_rate().

fec_mii_setspeed() calls fec_get_clk_rate with NULL pointer for udev and so as in IMX8QXP case CLK_CCF is enabled udev gets searched with:

uclass_get_device_by_seq(UCLASS_ETH, idx, &dev);

but we do not have yet a UCLASS_ETH ! as we just probing it!

Prevent this by passing udev to fec_get_clk_rate()

---

(no changes since v1)

 board/boundary/nitrogen6x/nitrogen6x.c |  2 +-
 board/solidrun/mx6cuboxi/mx6cuboxi.c   |  2 +-
 drivers/net/fec_mxc.c                  | 14 +++++++-------
 include/netdev.h                       |  2 +-
 4 files changed, 10 insertions(+), 10 deletions(-)
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
index b85fd806cba..1adee9a461f 100644
@@ -281,7 +281,7 @@ int board_eth_init(struct bd_info *bis)
 	setup_iomux_enet();
 
 #ifdef CONFIG_FEC_MXC
-	bus = fec_get_miibus(base, -1);
+	bus = fec_get_miibus(NULL, base, -1);
 	if (!bus)
 		return -EINVAL;
 	/* scan phy 4,5,6,7 */
board/solidrun/mx6cuboxi/mx6cuboxi.c +1 -1
index e9269ef5353..b543bf8c1fb 100644
@@ -385,7 +385,7 @@ static int find_ethernet_phy(void)
 	int phy_addr = -ENOENT;
 
 #ifdef CONFIG_FEC_MXC
-	bus = fec_get_miibus(ENET_BASE_ADDR, -1);
+	bus = fec_get_miibus(NULL, ENET_BASE_ADDR, -1);
 	if (!bus)
 		return -ENOENT;
 
drivers/net/fec_mxc.c +7 -7
index d6d5cb52fdd..eca681b16d1 100644
@@ -160,7 +160,7 @@ static int fec_get_clk_rate(void *udev, int idx)
 	}
 }
 
-static void fec_mii_setspeed(struct ethernet_regs *eth)
+static void fec_mii_setspeed(struct udevice *dev, struct ethernet_regs *eth)
 {
 	/*
 	 * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock
@@ -182,7 +182,7 @@ static void fec_mii_setspeed(struct ethernet_regs *eth)
 	u32 hold;
 	int ret;
 
-	ret = fec_get_clk_rate(NULL, 0);
+	ret = fec_get_clk_rate(dev, 0);
 	if (ret < 0) {
 		printf("Can't find FEC0 clk rate: %d\n", ret);
 		return;
@@ -581,7 +581,7 @@ static int fecmxc_init(struct udevice *dev)
 	fec_reg_setup(fec);
 
 	if (fec->xcv_type != SEVENWIRE)
-		fec_mii_setspeed(fec->bus->priv);
+		fec_mii_setspeed(dev, fec->bus->priv);
 
 	/* Set Opcode/Pause Duration Register */
 	writel(0x00010020, &fec->eth->op_pause);	/* FIXME 0xffff0020; */
@@ -996,7 +996,7 @@ static void fec_free_descs(struct fec_priv *fec)
 	free(fec->tbd_base);
 }
 
-struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
+struct mii_dev *fec_get_miibus(struct udevice *dev, ulong base_addr, int dev_id)
 {
 	struct ethernet_regs *eth = (struct ethernet_regs *)base_addr;
 	struct mii_dev *bus;
@@ -1018,7 +1018,7 @@ struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id)
 		free(bus);
 		return NULL;
 	}
-	fec_mii_setspeed(eth);
+	fec_mii_setspeed(dev, eth);
 	return bus;
 }
 
@@ -1354,10 +1354,10 @@ static int fecmxc_probe(struct udevice *dev)
 	if (!bus) {
 		dm_mii_bus = false;
 #ifdef CONFIG_FEC_MXC_MDIO_BASE
-		bus = fec_get_miibus((ulong)CONFIG_FEC_MXC_MDIO_BASE,
+		bus = fec_get_miibus(dev, (ulong)CONFIG_FEC_MXC_MDIO_BASE,
 				     dev_seq(dev));
 #else
-		bus = fec_get_miibus((ulong)priv->eth, dev_seq(dev));
+		bus = fec_get_miibus(dev, (ulong)priv->eth, dev_seq(dev));
 #endif
 	}
 	if (!bus) {
include/netdev.h +1 -1
index 2a06d9a261b..949245ecdec 100644
@@ -117,7 +117,7 @@ static inline int pci_eth_init(struct bd_info *bis)
 	return num;
 }
 
-struct mii_dev *fec_get_miibus(ulong base_addr, int dev_id);
+struct mii_dev *fec_get_miibus(struct udevice *dev, ulong base_addr, int dev_id);
 
 #ifdef CONFIG_PHYLIB
 struct phy_device;
Signature · 1 line
2.20.1
#9 lore raw

PATCH v2 3/20 tools: imx8image: Improve error message

In reply to Heiko Schocher

Improve error message "header tag mismatched"
Add filename to error message to see, which file
is wrong.

---

Changes in v2:
add Reviewed-by from Alexander

 tools/imx8image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/imx8image.c +1 -1
index 96ece28bd6c..b22e8b21c47 100644
@@ -733,7 +733,7 @@ static int get_container_image_start_pos(image_t *image_stack, uint32_t align)
 			fclose(fd);
 
 			if (header.tag != IVT_HEADER_TAG_B0) {
-				fprintf(stderr, "header tag mismatched \n");
+				fprintf(stderr, "header tag mismatched file %s\n", img_sp->filename);
 				exit(EXIT_FAILURE);
 			} else {
 				file_off +=
Signature · 1 line
2.20.1
#10 lore raw

PATCH v2 4/20 imx: imx_cntr_image.sh: prevent warning for missing spl

In reply to Heiko Schocher

when building U-Boot on imx8qxp and the board port uses SPL, U-boot build shows

WARNING '.../spl/u-boot-spl.bin' not found, resulting binary is not-functional

This is because U-Boot binary is build first and Makefile calls script imx_cntr_image.sh which checks if files exists... but of course as spl is not yet build the file spl/u-boot-spl.bin does not exist yet, so prevent this warning.

---

(no changes since v1)

 tools/imx_cntr_image.sh | 4 ++++
 1 file changed, 4 insertions(+)
tools/imx_cntr_image.sh +4 -0
index 972b95ccbee..07acd385631 100755
@@ -14,6 +14,10 @@ for f in $blobs; do
 		continue
 	fi
 
+	if [ $f = "spl/u-boot-spl.bin" ]; then
+		continue
+	fi
+
 	if [ -f $f ]; then
 		continue
 	fi
Signature · 1 line
2.20.1
#11 lore raw

PATCH v2 5/20 imx8qxp: Fix build when using SPL

In reply to Heiko Schocher

imx8qxp based boards which use SPL drop error when calling make all:
"""
Writing image to './flash.bin'
Node '/binman/imx-boot/spl': GetData: size 0x0

       Node '/binman/imx-boot': GetPaddedDataForEntry: size 0x0
       Node '/binman/imx-boot': GetData: 1 entries, total size 0x0
       Node '/binman/imx-boot': GetPaddedDataForEntry: size 0x0

Wrote 0x0 bytes
Image 'imx-boot' is missing external blobs and is non-functional: spl

/binman/imx-boot/spl (spl.bin):
Missing blob

Some images are invalid
"""

Guard creation of flash.bin with CONFIG_XPL_BUILD option.

Fixes c9713c155127 ("imx8-u-boot: Fix SPL guard option")

---

(no changes since v1)

 arch/arm/dts/imx8qxp-u-boot.dtsi | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/dts/imx8qxp-u-boot.dtsi +2 -0
index 62791c34c77..8058caae9ba 100644
@@ -120,6 +120,7 @@
 		};
 	};
 
+#ifdef CONFIG_XPL_BUILD
 	imx-boot {
 		filename = "flash.bin";
 		pad-byte = <0x00>;
@@ -130,4 +131,5 @@
 			type = "blob-ext";
 		};
 	};
+#endif
 };
Signature · 1 line
2.20.1
#12 lore raw

PATCH v2 6/20 siemens: capricorn: move to cxg3 reference project with deneb board

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

We have many HW with capricorn i.MX8X boards. The difference in u-boot is at all by the display of the LEDs.

* put upstream a reference project & board for DT and defconfig
* use the capricorn prefix outside the board/siemens/capricorn folder

---

(no changes since v1)

 arch/arm/dts/Makefile                         |   3 +-
 arch/arm/dts/imx8-capricorn-cxg3.dts          | 129 +++++++++++++++++
 ...u-boot.dtsi => imx8-capricorn-u-boot.dtsi} |   0
 ...qxp-capricorn.dtsi => imx8-capricorn.dtsi} | 106 +-------------
 arch/arm/dts/imx8-deneb.dts                   |  10 --
 arch/arm/dts/imx8-giedi.dts                   |  10 --
 arch/arm/mach-imx/imx8/Kconfig                |  11 +-
 board/siemens/capricorn/Kconfig               |  18 +--
 ...neb_defconfig => capricorn_cxg3_defconfig} |   4 +-
 configs/giedi_defconfig                       | 133 ------------------
 include/configs/deneb.h                       |  16 ---
 11 files changed, 137 insertions(+), 303 deletions(-)
 create mode 100644 arch/arm/dts/imx8-capricorn-cxg3.dts
 rename arch/arm/dts/{imx8qxp-capricorn-u-boot.dtsi => imx8-capricorn-u-boot.dtsi} (100%)
 rename arch/arm/dts/{imx8qxp-capricorn.dtsi => imx8-capricorn.dtsi} (64%)
 delete mode 100644 arch/arm/dts/imx8-deneb.dts
 delete mode 100644 arch/arm/dts/imx8-giedi.dts
 rename configs/{deneb_defconfig => capricorn_cxg3_defconfig} (97%)
 delete mode 100644 configs/giedi_defconfig
 delete mode 100644 include/configs/deneb.h
arch/arm/dts/Makefile +1 -2
index aeccfa93fc5..cccc6956727 100644
@@ -939,8 +939,7 @@ dtb-$(CONFIG_ARCH_IMX8) += \
 	fsl-imx8qxp-ai_ml.dtb \
 	fsl-imx8qxp-colibri.dtb \
 	fsl-imx8qxp-mek.dtb \
-	imx8-deneb.dtb \
-	imx8-giedi.dtb
+	imx8-capricorn-cxg3.dtb \
 
 dtb-$(CONFIG_ARCH_IMX8ULP) += \
 	imx8ulp-evk.dtb
arch/arm/dts/imx8-capricorn-cxg3.dts new file +129 -0

129 lines not on this page · raw message

arch/arm/dts/imx8-capricorn-u-boot.dtsi renamed from arch/arm/dts/imx8qxp-capricorn-u-boot.dtsi +0 -0
similarity index 100%
rename from arch/arm/dts/imx8qxp-capricorn-u-boot.dtsi
rename to arch/arm/dts/imx8-capricorn-u-boot.dtsi
arch/arm/dts/imx8-capricorn.dtsi renamed from arch/arm/dts/imx8qxp-capricorn.dtsi +1 -105

125 lines not on this page · raw message

arch/arm/dts/imx8-deneb.dts deleted +0 -10
deleted file mode 100644
index 04c764aa941..00000000000
@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2019 Siemens AG
- */
-
-#include "imx8qxp-capricorn.dtsi"
-
-/ {
-	model = "Siemens Deneb";
-};
arch/arm/dts/imx8-giedi.dts deleted +0 -10
deleted file mode 100644
index 0dbfef2ee97..00000000000
@@ -1,10 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * Copyright 2019 Siemens AG
- */
-
-#include "imx8qxp-capricorn.dtsi"
-
-/ {
-	model = "Siemens Giedi";
-};
arch/arm/mach-imx/imx8/Kconfig +2 -9
index 59d11b3179e..9a43beda6fa 100644
@@ -54,15 +54,8 @@ config TARGET_COLIBRI_IMX8X
 	select BOARD_LATE_INIT
 	select IMX8QXP
 
-config TARGET_DENEB
-	bool "Support i.MX8QXP Capricorn Deneb board"
-	select BINMAN
-	select BOARD_LATE_INIT
-	select FACTORYSET
-	select IMX8QXP
-
-config TARGET_GIEDI
-	bool "Support i.MX8QXP Capricorn Giedi board"
+config TARGET_CAPRICORN
+	bool "Support i.MX8QXP Capricorn board"
 	select BINMAN
 	select BOARD_LATE_INIT
 	select FACTORYSET
board/siemens/capricorn/Kconfig +2 -16
index c5a28ff0220..371eca346e0 100644
@@ -1,19 +1,5 @@
-if TARGET_GIEDI
+if TARGET_CAPRICORN
 
-config SYS_BOARD
-	default "capricorn"
-
-config SYS_VENDOR
-	default "siemens"
-
-config SYS_CONFIG_NAME
-	default "giedi"
-
-config IMX_CONFIG
-	default "board/siemens/capricorn/imximage.cfg"
-endif
-
-if TARGET_DENEB
 
 config SYS_BOARD
 	default "capricorn"
@@ -22,7 +8,7 @@ config SYS_VENDOR
 	default "siemens"
 
 config SYS_CONFIG_NAME
-	default "deneb"
+	default "capricorn-common"
 
 config IMX_CONFIG
 	default "board/siemens/capricorn/imximage.cfg"
configs/capricorn_cxg3_defconfig renamed from configs/deneb_defconfig +2 -2
similarity index 97%
rename from configs/deneb_defconfig
rename to configs/capricorn_cxg3_defconfig
index b220dc8590b..ce820e2c54f 100644
@@ -12,9 +12,9 @@ CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x0
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="imx8-deneb"
+CONFIG_DEFAULT_DEVICE_TREE="imx8-capricorn-cxg3"
 CONFIG_SPL_TEXT_BASE=0x100000
-CONFIG_TARGET_DENEB=y
+CONFIG_TARGET_CAPRICORN=y
 CONFIG_SPL_MMC=y
 CONFIG_SPL_SERIAL=y
 CONFIG_SPL_DRIVERS_MISC=y
configs/giedi_defconfig deleted +0 -133

133 lines not on this page · raw message

include/configs/deneb.h deleted +0 -16
deleted file mode 100644
index f155bb8bf50..00000000000
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0+ */
-/*
- * Copyright 2019 Siemens AG
- *
- */
-
-#ifndef __DENEB_H
-#define __DENEB_H
-
-#include "capricorn-common.h"
-
-/* DDR3 board total DDR is 2 GB */
-#undef PHYS_SDRAM_1_SIZE
-#define PHYS_SDRAM_1_SIZE		0x80000000	/* 2 GB */
-
-#endif /* __DENEB_H */
Signature · 1 line
2.20.1
#13 lore raw

PATCH v2 7/20 siemens: imx8qxp-capricorn-u-boot.dtsi: fix boot

In reply to Heiko Schocher

current generated flash.bin image does not longer
boot on cxg3 board.

Rename bootph-pre-ram to bootph-all so flash.bin
boots again!

Add u-boot specific change (add bootph-all property) in A35_0 node to imx8qxp-capricorn-u-boot.dtsi

---

Changes in v2:
- add "bootph-all" in A35_0 node to u-boot.dtsi not in dts for the board!

 arch/arm/dts/imx8-capricorn-u-boot.dtsi | 67 +++++++++++++------------
 1 file changed, 35 insertions(+), 32 deletions(-)
arch/arm/dts/imx8-capricorn-u-boot.dtsi +35 -32
index cba56188f86..ad5309bd969 100644
@@ -6,130 +6,133 @@
 #include "imx8qxp-u-boot.dtsi"
 
 &{/imx8qx-pm} {
+	bootph-all;
+};
 
-	bootph-pre-ram;
+&A35_0 {
+        bootph-all;
 };
 
 &mu {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &clk {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &iomuxc {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio0 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio1 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio2 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio3 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio4 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio5 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio6 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_lsio_gpio7 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_dma {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_dma_lpuart0 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_dma_lpuart2 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_conn {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_conn_sdch0 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_conn_sdch1 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &pd_conn_sdch2 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio0 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio1 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio2 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio3 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio4 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio5 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio6 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &gpio7 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &lpuart0 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &lpuart2 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &usdhc1 {
-	bootph-pre-ram;
+	bootph-all;
 };
 
 &usdhc2 {
-	bootph-pre-ram;
+	bootph-all;
 };
Signature · 1 line
2.20.1
#14 lore raw

PATCH v2 8/20 siemens: capricorn: use DCD_SKIP entry

In reply to Heiko Schocher

Boards which use DCD data in SCFW can drop SPL.

We tried in our mainline rework to use this approach too as other imx8qxp boards do in mainline. But we failed ... it was a hard way to understand the reason!

We cannot use DCD image in container as the SCFW from siemens, does the RAM init on boot itself!

Siemens SCFW reads the RAM config from i2c eeprom and dependent on this settings, initializes the RAM.

Adding DCD data to the bootcontainer will result in hang of the SCFW, also DCD data in container image is static which do not fit our needs.

So we must drop DCD data image, and this has the side effect that we need SPL, as the task which loads the images from the container only loads the images to addresses, and if executed bit is set, starts them.

As now RAM is not initialized from it, and there is no option to "wait until SCFW has setup RAM", we can only load SPL into internal RAM at this point, as than SPL and SCFW boot parallel.

The SPL itself then uses the SCU API to communicate with the SCFW and it seems that SCFW only responds to this API requests when RAM setup is already done by the SCFW, which has a side-effect of a "sync" for the RAM setup is done by SCFW!

We checked if SPL is always save in accessing RAM for loading images to it! For tests, we added in our RAM init part in the SCFW long delays (10 seconds and more) as we thought there is such a sync missing, and we can break the board through delaying RAM setup... but we did not managed to fail booting U-Boot from SPL!

---

Changes in v2:
- add comment from Walter
fix typo: than -> then

 board/siemens/capricorn/imximage.cfg | 4 ++++
 1 file changed, 4 insertions(+)
board/siemens/capricorn/imximage.cfg +4 -0
index 4350e2967cc..e45f2c9589e 100644
@@ -9,6 +9,10 @@
 
 /* Boot from SD, sector size 0x400 */
 BOOT_FROM	sd
+
+/* skip DCD data, as firmware initializes the RAM */
+DCD_SKIP true
+
 /* SoC type IMX8QX */
 SOC_TYPE IMX8QX
 /* Append seco container image */
Signature · 1 line
2.20.1
#15 lore raw

PATCH v2 9/20 siemens: imximage.cfg: correct comment

In reply to Heiko Schocher

fix wrong comment.

---

Changes in v2:
- add Reviewed-by from Alexander

 board/siemens/capricorn/imximage.cfg | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
board/siemens/capricorn/imximage.cfg +2 -1
index e45f2c9589e..f73c5a7a9b0 100644
@@ -21,5 +21,6 @@ APPEND ahab-container.img
 CONTAINER
 /* Add scfw image with exec attribute */
 IMAGE SCU capricorn-scfw-tcm.bin
-/* Add ATF image with exec attribute */
+
+/* Add SPL image with exec attribute */
 IMAGE A35 spl/u-boot-spl.bin 0x00100000
Signature · 1 line
2.20.1
#16 lore raw

PATCH v2 10/20 siemens: imximage.cfg: sync image names

In reply to Heiko Schocher

sync the image names in imximage.cfg with
the ones used in arch/arm/dts/imx8qxp-u-boot.dtsi

---

(no changes since v1)

 board/siemens/capricorn/imximage.cfg | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
board/siemens/capricorn/imximage.cfg +10 -4
index f73c5a7a9b0..7fd3fb8b72e 100644
@@ -15,12 +15,18 @@ DCD_SKIP true
 
 /* SoC type IMX8QX */
 SOC_TYPE IMX8QX
-/* Append seco container image */
-APPEND ahab-container.img
+/*
+ * Append seco container image,
+ * use same name as in arch/arm/dts/imx8qxp-u-boot.dtsi
+ */
+APPEND mx8qxc0-ahab-container.img
 /* Create the 2nd container */
 CONTAINER
-/* Add scfw image with exec attribute */
-IMAGE SCU capricorn-scfw-tcm.bin
+/*
+ * Add scfw image with exec attribute
+ * use same name as in arch/arm/dts/imx8qxp-u-boot.dtsi
+ */
+IMAGE SCU mx8qx-mek-scfw-tcm.bin
 
 /* Add SPL image with exec attribute */
 IMAGE A35 spl/u-boot-spl.bin 0x00100000
Signature · 1 line
2.20.1
#17 lore raw

PATCH v2 11/20 siemens: configs/capricorn_cxg3_defconfig: updates

In reply to Heiko Schocher

make savedefconfig and add SCU_WDT and fix environment offsets, as since silicon c0 the boot container takes place at offset 0 and so the u-boot-env must be moved outside of the boot container area.

---

Changes in v2:
- add comments from Fabio
fix typo: silicium -> silicon
- add Reviewed-by from Alexander
- use renamed Kconfig symbol CONFIG_WDT_SCU_PMIC

 configs/capricorn_cxg3_defconfig | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)
configs/capricorn_cxg3_defconfig +11 -5
index ce820e2c54f..628857c9fe5 100644
@@ -10,7 +10,7 @@ CONFIG_NR_DRAM_BANKS=3
 CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
 CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80200000
 CONFIG_ENV_SIZE=0x2000
-CONFIG_ENV_OFFSET=0x0
+CONFIG_ENV_OFFSET=0x200000
 CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="imx8-capricorn-cxg3"
 CONFIG_SPL_TEXT_BASE=0x100000
@@ -25,7 +25,7 @@ CONFIG_SPL_BSS_MAX_SIZE=0x1000
 CONFIG_SYS_BOOTM_LEN=0x800000
 CONFIG_SYS_LOAD_ADDR=0x80280000
 CONFIG_SPL=y
-CONFIG_ENV_OFFSET_REDUND=0x2000
+CONFIG_ENV_OFFSET_REDUND=0x202000
 CONFIG_IDENT_STRING=" ##v01.06"
 CONFIG_REMAKE_ELF=y
 # CONFIG_EFI_LOADER is not set
@@ -55,9 +55,10 @@ CONFIG_SPL_SYS_MALLOC_SIMPLE=y
 CONFIG_SPL_SYS_MALLOC=y
 CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
 CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0x120000
-CONFIG_SPL_SYS_MALLOC_SIZE=0x3000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x4000
 CONFIG_SPL_SYS_MMCSD_RAW_MODE=y
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x800
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR=y
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x1040
 CONFIG_SPL_POWER_DOMAIN=y
 CONFIG_SPL_WATCHDOG=y
 CONFIG_HUSH_PARSER=y
@@ -112,10 +113,13 @@ CONFIG_PHYLIB=y
 CONFIG_MV88E61XX_SWITCH=y
 CONFIG_MV88E61XX_CPU_PORT=5
 CONFIG_MV88E61XX_PHY_PORTS=0x7
+CONFIG_DM_ETH_PHY=y
 CONFIG_FEC_MXC_SHARE_MDIO=y
 CONFIG_FEC_MXC_MDIO_BASE=0x5B050000
 CONFIG_FEC_MXC=y
 CONFIG_MII=y
+CONFIG_PHY=y
+CONFIG_NOP_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_SPL_PINCTRL=y
 CONFIG_PINCTRL_IMX8=y
@@ -129,5 +133,7 @@ CONFIG_DM_SERIAL=y
 CONFIG_FSL_LPUART=y
 CONFIG_DM_THERMAL=y
 CONFIG_IMX_SCU_THERMAL=y
-# CONFIG_SPL_WDT is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_WDT=y
+CONFIG_WDT_SCU_PMIC=y
 CONFIG_SPL_TINY_MEMSET=y
Signature · 1 line
2.20.1
#18 lore raw

PATCH v2 12/20 siemens: capricorn: sync spl code with 8qxp-mek

In reply to Heiko Schocher

sync spl code with 8qxp-mek board.

---

(no changes since v1)

 board/siemens/capricorn/spl.c | 38 +++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
board/siemens/capricorn/spl.c +38 -0
index 696b5ebd340..7ee2895b6d4 100644
@@ -15,12 +15,30 @@
 #include <dm/uclass-internal.h>
 #include <dm/device-internal.h>
 
+#include <firmware/imx/sci/sci.h>
+#include <asm/arch/imx8-pins.h>
+#include <asm/arch/iomux.h>
+#include <asm/gpio.h>
+#include <asm/arch/sys_proto.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
+#define GPIO_PAD_CTRL	((SC_PAD_CONFIG_NORMAL << PADRING_CONFIG_SHIFT) | \
+			(SC_PAD_ISO_OFF << PADRING_LPCONFIG_SHIFT) | \
+			(SC_PAD_28FDSOI_DSE_DV_HIGH << PADRING_DSE_SHIFT) | \
+			(SC_PAD_28FDSOI_PS_PU << PADRING_PULL_SHIFT))
+
+#define USDHC2_SD_PWR IMX_GPIO_NR(4, 19)
+static iomux_cfg_t usdhc2_sd_pwr[] = {
+	SC_P_USDHC1_RESET_B | MUX_PAD_CTRL(GPIO_PAD_CTRL),
+};
+
 void spl_board_init(void)
 {
 	struct udevice *dev;
 
+	uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(imx8_scu), &dev);
+
 	uclass_find_first_device(UCLASS_MISC, &dev);
 
 	for (; dev; uclass_find_next_device(&dev)) {
@@ -34,8 +52,28 @@ void spl_board_init(void)
 
 	timer_init();
 
+	imx8_iomux_setup_multiple_pads(usdhc2_sd_pwr, ARRAY_SIZE(usdhc2_sd_pwr));
+	gpio_direction_output(USDHC2_SD_PWR, 0);
+
 	preloader_console_init();
+
+	puts("Normal Boot\n");
+}
+
+void spl_board_prepare_for_boot(void)
+{
+	imx8_power_off_pd_devices(NULL, 0);
+}
+
+#ifdef CONFIG_SPL_LOAD_FIT
+int board_fit_config_name_match(const char *name)
+{
+	/* Just empty function now - can't decide what to choose */
+	debug("%s: %s\n", __func__, name);
+
+	return 0;
 }
+#endif
 
 void board_init_f(ulong dummy)
 {
Signature · 1 line
2.20.1
#19 lore raw

PATCH v2 13/20 siemens: imx8-capricorn.dtsi: add wdt device

In reply to Heiko Schocher

add wdt device

---

Changes in v2:
- add comments rom Fabio and Enrico
do not remove DMA for console
remove u-boot specific property addition, instead add it in arch/arm/dts/imx8qxp-u-boot.dtsi

 arch/arm/dts/imx8-capricorn.dtsi | 5 +++++
 1 file changed, 5 insertions(+)
arch/arm/dts/imx8-capricorn.dtsi +5 -0
index 4918bf8f567..3734a9d21f1 100644
@@ -17,6 +17,11 @@
 		stdout-path = &lpuart2;
 	};
 
+	/* create device for u-boot wdt command */
+	scu-wdt {
+		compatible = "siemens,scu-wdt";
+	};
+
 };
 
 &iomuxc {
Signature · 1 line
2.20.1
#20 lore raw

PATCH v2 14/20 siemens: capricorn: small board updates

In reply to Heiko Schocher

with newest SCFW build_info() works now, so call it from checkboard() now.

As we only use uart2 as console, do not init uart0.

---

Changes in v2:
- add comments from Fabio
rename subject line and rework commit message,
alse remove unneeded comment in checkboard()

 board/siemens/capricorn/board.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
board/siemens/capricorn/board.c +2 -7
index ad474d9baa0..bf04f12c75b 100644
@@ -63,8 +63,7 @@ int board_early_init_f(void)
 	sc_pm_clock_rate_t rate = SC_80MHZ;
 	int ret;
 
-	ret = sc_pm_setup_uart(SC_R_UART_0, rate);
-	ret |= sc_pm_setup_uart(SC_R_UART_2, rate);
+	ret = sc_pm_setup_uart(SC_R_UART_2, rate);
 	if (ret)
 		return ret;
 
@@ -271,11 +270,7 @@ int checkboard(void)
 {
 	puts("Board: Capricorn\n");
 
-	/*
-	 * Running build_info() doesn't work with current SCFW blob.
-	 * Uncomment below call when new blob is available.
-	 */
-	/*build_info();*/
+	build_info();
 
 	print_bootinfo();
 	return 0;
Signature · 1 line
2.20.1
#21 lore raw

PATCH v2 15/20 siemens: capricorn: add HW version information to boot log

In reply to Heiko Schocher

From: Alessandro Zini <[email protected]>

Add the HW version read directly from EEPROM.

EEPROM chip data structure is now in a .h file common to draco and capricorn.

Therefore move out the definitions in draco board to siemens common place.

From: Alessandro Zini <[email protected]>

---

Changes in v2:
- add comment from Fabio
add From line, as patch is from Alessandro
fix typo in commit description: drace -> draco
- remove CONFIG_XPL_BUILD in board_init as
board_init is not called from SPL.

 board/siemens/capricorn/board.c | 21 ++++++++++++++++
 board/siemens/common/board.h    | 44 +++++++++++++++++++++++++++++++++
 board/siemens/draco/board.h     | 10 ++------
 3 files changed, 67 insertions(+), 8 deletions(-)
 create mode 100644 board/siemens/common/board.h
board/siemens/capricorn/board.c +21 -0
index bf04f12c75b..decac63db3b 100644
@@ -26,6 +26,7 @@
 #include <asm/arch-imx8/clock.h>
 #endif
 #include <linux/delay.h>
+#include "../common/board.h"
 #include "../common/eeprom.h"
 #include "../common/factoryset.h"
 
@@ -278,6 +279,26 @@ int checkboard(void)
 
 int board_init(void)
 {
+	struct chip_data eeprom_data = {};
+	int ret;
+
+	ret = siemens_ee_setup();
+	if (ret) {
+		printf("'siemens_ee_setup' failed, ret: %d\n", ret);
+		goto skip;
+	}
+
+	ret = siemens_ee_read_data(SIEMENS_EE_ADDR_CHIP,
+				   (uchar *)&eeprom_data,
+				   sizeof(eeprom_data));
+	if (ret) {
+		printf("'siemens_ee_read_data' failed, ret: %d\n", ret);
+		goto skip;
+	}
+
+	printf("HW Version: %s\n", eeprom_data.shwver);
+skip:
+
 	setup_fec();
 	return 0;
 }
board/siemens/common/board.h new file +44 -0

44 lines not on this page · raw message

board/siemens/draco/board.h +2 -8
index 935f340a8f2..77f35a6ab7b 100644
@@ -11,6 +11,8 @@
 #ifndef _BOARD_DRACO_H_
 #define _BOARD_DRACO_H_
 
+#include "../common/board.h"
+
 #define PARGS(x)	#x , /* Parameter Name */ \
 			settings.ddr3.x, /* EEPROM Value */ \
 			ddr3_default.x, /* Default Value */ \
@@ -18,8 +20,6 @@
 
 #define PRINTARGS(y)	printf("%-20s, %8x, %8x, %4d\n", PARGS(y))
 
-#define MAGIC_CHIP	0x50494843
-
 /* Automatic generated definition */
 /* Wed, 16 Apr 2014 16:50:41 +0200 */
 /* From file: draco/[email protected] */
@@ -43,12 +43,6 @@ struct ddr3_data {
 	char manu_marking[32];			/* "default \0" */
 };
 
-struct chip_data {
-	unsigned int  magic;
-	char sdevname[16];
-	char shwver[7];
-};
-
 struct draco_baseboard_id {
 	struct ddr3_data ddr3;
 	struct chip_data chip;
Signature · 1 line
2.20.1
#22 lore raw

PATCH v2 16/20 siemens: capricorn: get ram size from system controller

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

Get the memory region information from system controller to reduce the number of platform specific headers. We were aligned on NXP mek board implementation. This need at least 1 header per memory configuration.

---

(no changes since v1)

 board/siemens/capricorn/board.c    | 34 ++++++++++++++++++++++++++++++
 include/configs/capricorn-common.h |  4 +++-
 2 files changed, 37 insertions(+), 1 deletion(-)
board/siemens/capricorn/board.c +34 -0
index decac63db3b..484e2707183 100644
@@ -73,6 +73,40 @@ int board_early_init_f(void)
 	return 0;
 }
 
+#ifndef CONFIG_XPL_BUILD
+void board_mem_get_layout(u64 *phys_sdram_1_start,
+			  u64 *phys_sdram_1_size,
+			  u64 *phys_sdram_2_start,
+			  u64 *phys_sdram_2_size)
+{
+	sc_faddr_t addr_start, addr_end;
+	sc_faddr_t sdram_1_size, sdram_2_size;
+	sc_err_t sc_err;
+
+	sc_err = sc_rm_get_memreg_info(-1, 6, &addr_start, &addr_end);
+	if (sc_err == SC_ERR_NONE) {
+		if (addr_end < 0x100000000) {
+			/* only lower RAM available */
+			sdram_1_size = (addr_end + 1) - PHYS_SDRAM_1;
+			sdram_2_size = 0;
+		} else {
+			/* lower RAM (2 GB) und upper RAM available */
+			sdram_1_size = SZ_2G;
+			sdram_2_size = (addr_end + 1) - PHYS_SDRAM_2;
+		}
+	} else {
+		/* Get default in case it would fail */
+		sdram_1_size = PHYS_SDRAM_1_SIZE;
+		sdram_2_size = PHYS_SDRAM_2_SIZE;
+	}
+
+	*phys_sdram_1_start = PHYS_SDRAM_1;
+	*phys_sdram_1_size = sdram_1_size;
+	*phys_sdram_2_start = PHYS_SDRAM_2;
+	*phys_sdram_2_size = sdram_2_size;
+}
+#endif /* ! CONFIG_XPL_BUILD */
+
 #define ENET_PHY_RESET	IMX_GPIO_NR(0, 3)
 #define ENET_TEST_1	IMX_GPIO_NR(0, 8)
 #define ENET_TEST_2	IMX_GPIO_NR(0, 9)
include/configs/capricorn-common.h +3 -1
index 1f61b2b6af6..4d95f3fd79b 100644
@@ -95,7 +95,9 @@
 #define CFG_SYS_SDRAM_BASE		0x80000000
 #define PHYS_SDRAM_1			0x80000000
 #define PHYS_SDRAM_2			0x880000000
-/* DDR3 board total DDR is 1 GB */
+/* Set default values to the smallest DDR we have in capricorn modules
+ * Use it in case the system controller would return an error
+ */
 #define PHYS_SDRAM_1_SIZE		0x40000000	/* 1 GB */
 #define PHYS_SDRAM_2_SIZE		0x00000000	/* 0 GB */
 
Signature · 1 line
2.20.1
#23 lore raw

PATCH v2 17/20 siemens: capricorn: get module name from eeprom

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

The eeprom contains the information on which module we are running, so read it from the eeprom and print it on the console.

---

(no changes since v1)

 board/siemens/capricorn/board.c | 6 ++++++
 1 file changed, 6 insertions(+)
board/siemens/capricorn/board.c +6 -0
index 484e2707183..390a7b0d841 100644
@@ -314,6 +314,7 @@ int checkboard(void)
 int board_init(void)
 {
 	struct chip_data eeprom_data = {};
+	char module_name[16];
 	int ret;
 
 	ret = siemens_ee_setup();
@@ -322,6 +323,11 @@ int board_init(void)
 		goto skip;
 	}
 
+	/* Get module name from EEPROM */
+	siemens_ee_read_data(SIEMENS_EE_ADDR_DDR3, module_name,
+			     sizeof(module_name));
+	printf("CPU module: %s\n", module_name);
+
 	ret = siemens_ee_read_data(SIEMENS_EE_ADDR_CHIP,
 				   (uchar *)&eeprom_data,
 				   sizeof(eeprom_data));
Signature · 1 line
2.20.1
#24 lore raw

PATCH v2 18/20 siemens: add ddr full memory test

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

Add siemens specific memory test. Enable it through Kconfig option SPL_CMT. The test is required from our HW team. It runs over temperature during many days:
* must run indefinitively through the *whole* DDR area, so we cannot use linux memtest for example.
* must write/read/check all values

---

Changes in v2:
add From tag
reworked the commit message a little bit

 board/siemens/capricorn/Kconfig           |   7 +
 board/siemens/capricorn/Makefile          |   1 +
 board/siemens/capricorn/spl.c             |   5 +
 board/siemens/capricorn/spl_memory_test.c | 158 ++++++++++++++++++++++
 board/siemens/capricorn/spl_memory_test.h |   7 +
 5 files changed, 178 insertions(+)
 create mode 100644 board/siemens/capricorn/spl_memory_test.c
 create mode 100644 board/siemens/capricorn/spl_memory_test.h
board/siemens/capricorn/Kconfig +7 -0
index 371eca346e0..03a433df2aa 100644
@@ -14,3 +14,10 @@ config IMX_CONFIG
 	default "board/siemens/capricorn/imximage.cfg"
 
 endif
+
+
+config SPL_CMT
+	bool "Enable Siemens SPL RAM test"
+	depends on SPL
+	help
+	  Enable SIemens SPL RAM test.
board/siemens/capricorn/Makefile +1 -0
index e8a24c448b9..b8350d96d04 100644
@@ -8,6 +8,7 @@ obj-y += ../common/eeprom.o
 
 ifdef CONFIG_XPL_BUILD
 obj-y += spl.o
+obj-$(CONFIG_SPL_CMT) += spl_memory_test.o
 else
 obj-y += ../common/factoryset.o
 endif
board/siemens/capricorn/spl.c +5 -0
index 7ee2895b6d4..5865cde80b4 100644
@@ -20,6 +20,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
+#include "spl_memory_test.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -58,6 +59,10 @@ void spl_board_init(void)
 	preloader_console_init();
 
 	puts("Normal Boot\n");
+
+#if IS_ENABLED(CONFIG_SPL_CMT)
+	spl_siemens_memory_full_test();
+#endif
 }
 
 void spl_board_prepare_for_boot(void)
board/siemens/capricorn/spl_memory_test.c new file +158 -0

158 lines not on this page · raw message

board/siemens/capricorn/spl_memory_test.h new file +7 -0
new file mode 100644
index 00000000000..28df284b6d5
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright Siemens AG 2020
+ *
+ */
+
+void spl_siemens_memory_full_test(void);
Signature · 1 line
2.20.1
#25 lore raw

PATCH v2 19/20 siemens: add ddr signal integrity test

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

The signal integrity test generates pattern on DDR lines for certification. The signals must be as fast as possible and unidirectional.

The test is required from our HW team. The available u-boot memory test doesn't full fill the our requirements.

The test is planed to be used in all new siemens boards.

---

Changes in v2:
Add From tag

 board/siemens/capricorn/Kconfig    |   2 +
 board/siemens/capricorn/Makefile   |   1 +
 board/siemens/common/Kconfig       |   4 +
 board/siemens/common/ddr_si_test.c | 348 +++++++++++++++++++++++++++++
 4 files changed, 355 insertions(+)
 create mode 100644 board/siemens/common/ddr_si_test.c
board/siemens/capricorn/Kconfig +2 -0
index 03a433df2aa..fe230971e97 100644
@@ -21,3 +21,5 @@ config SPL_CMT
 	depends on SPL
 	help
 	  Enable SIemens SPL RAM test.
+
+source "board/siemens/common/Kconfig"
board/siemens/capricorn/Makefile +1 -0
index b8350d96d04..a03d54ef3b3 100644
@@ -11,4 +11,5 @@ obj-y += spl.o
 obj-$(CONFIG_SPL_CMT) += spl_memory_test.o
 else
 obj-y += ../common/factoryset.o
+obj-$(CONFIG_DDR_SI_TEST) += ../common/ddr_si_test.o
 endif
board/siemens/common/Kconfig +4 -0
index 131439fcfea..4ae12b1c973 100644
@@ -1,2 +1,6 @@
 config FACTORYSET
 	bool
+
+config DDR_SI_TEST
+	bool "DDR signal integrity test implementations"
+	default y
board/siemens/common/ddr_si_test.c new file +348 -0

348 lines not on this page · raw message

Signature · 1 line
2.20.1
#26 lore raw

PATCH v2 20/20 siemens: capricorn: update maintainers

In reply to Heiko Schocher

From: Enrico Leto <[email protected]>

update MAINTAINERS file, add some more board maintainers.

---

Changes in v2:
- add Reviewed-by from Alexander

 board/siemens/capricorn/MAINTAINERS | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
board/siemens/capricorn/MAINTAINERS +7 -5
index b4c52032cc9..5f467aa9b6e 100644
@@ -1,10 +1,12 @@
 CAPRICORN BOARD
+M:	Alexander Sverdlin <[email protected]>
 M:	Anatolij Gustschin <[email protected]>
+M:	Heiko Schocher <[email protected]>
+M:	Walter Schweizer <[email protected]>
 S:	Maintained
+F:	arch/arm/dts/imx8-capricorn-cxg3.dts
+F:	arch/arm/dts/imx8-capricorn-u-boot.dtsi
+F:	arch/arm/dts/imx8-capricorn.dtsi
 F:	board/siemens/capricorn/
+F:	configs/capricorn_cxg3_defconfig
 F:	include/configs/capricorn-common.h
-F:	include/configs/deneb.h
-F:	include/configs/giedi.h
-F:	include/configs/siemens-env-common.h
-F:	configs/deneb_defconfig
-F:	configs/giedi_defconfig
Signature · 1 line
2.20.1