Skip to contentSkip to conversation

ARM: i.MX: Kamstrup mx7 concentrator board support

PATCH In review Lars Pedersen 3 participants 14 messages Apr 13, 2021 – Apr 14, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: i.MX: Kamstrup mx7 concentrator board support

This adds support for Kamstrup mx7 concentrator board

---
Changes since v1:
- Removed all board.c specific stuff
- Board power reset via new GPIO board power-off driver
- TPM reset will now be handled entirely in hardware
- Set barebox_set_model removed.

 arch/arm/boards/Makefile                      |   1 +
 .../boards/kamstrup-mx7-concentrator/Makefile |   1 +
 .../flash-header-tqma7d.imxcfg                |  79 +++++++++++++
 .../kamstrup-mx7-concentrator/lowlevel.c      |  35 ++++++
 arch/arm/configs/imx_v7_defconfig             |   1 +
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/imx7d-flex-concentrator-mfg.dts  | 108 ++++++++++++++++++
 arch/arm/mach-imx/Kconfig                     |   5 +
 images/Makefile.imx                           |   5 +
 9 files changed, 236 insertions(+)
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/Makefile
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/lowlevel.c
 create mode 100644 arch/arm/dts/imx7d-flex-concentrator-mfg.dts
arch/arm/boards/Makefile +1 -0
index 9ccb75e27..0e59d6a77 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_MACH_HABA_KNX_LITE)		+= haba-knx/
 obj-$(CONFIG_MACH_IMX21ADS)			+= freescale-mx21-ads/
 obj-$(CONFIG_MACH_IMX233_OLINUXINO)		+= imx233-olinuxino/
 obj-$(CONFIG_MACH_IMX27ADS)			+= freescale-mx27-ads/
+obj-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR)	+= kamstrup-mx7-concentrator/
 obj-$(CONFIG_MACH_KINDLE3)			+= kindle3/
 obj-$(CONFIG_MACH_KONTRON_SAMX6I)		+= kontron-samx6i/
 obj-$(CONFIG_MACH_LENOVO_IX4_300D)		+= lenovo-ix4-300d/
arch/arm/boards/kamstrup-mx7-concentrator/Makefile new file +1 -0
new file mode 100644
index 000000000..7ab9f5274
@@ -0,0 +1 @@
+lwl-y += lowlevel.o
\ No newline at end of file
arch/arm/boards/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg new file +79 -0

79 lines not on this page · raw message

arch/arm/boards/kamstrup-mx7-concentrator/lowlevel.c new file +35 -0
new file mode 100644
index 000000000..8cd6d67f7
@@ -0,0 +1,35 @@
+#include <debug_ll.h>
+#include <io.h>
+#include <common.h>
+#include <linux/sizes.h>
+#include <mach/generic.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx7-ccm-regs.h>
+#include <mach/iomux-mx7.h>
+#include <mach/debug_ll.h>
+#include <asm/cache.h>
+#include <mach/esdctl.h>
+
+extern char __dtb_z_imx7d_flex_concentrator_mfg_start[];
+
+static inline void setup_uart(void)
+{
+	imx7_early_setup_uart_clock();
+
+	imx7_setup_pad(MX7D_PAD_SAI2_TX_BCLK__UART4_DCE_TX);
+
+	imx7_uart_setup_ll();
+
+	putc_ll('>');
+}
+
+ENTRY_FUNCTION(start_kamstrup_mx7_concentrator, r0, r1, r2)
+{
+	imx7_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL))
+		setup_uart();
+
+	imx7d_barebox_entry(__dtb_z_imx7d_flex_concentrator_mfg_start + get_runtime_offset());
+}
arch/arm/configs/imx_v7_defconfig +1 -0
index 16e109464..624698ae3 100644
@@ -13,6 +13,7 @@ CONFIG_MACH_FREESCALE_MX53_VMX53=y
 CONFIG_MACH_TX53=y
 CONFIG_MACH_PHYTEC_SOM_IMX6=y
 CONFIG_MACH_PROTONIC_IMX6=y
+CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR=y
 CONFIG_MACH_KONTRON_SAMX6I=y
 CONFIG_MACH_DFI_FS700_M60=y
 CONFIG_MACH_GUF_SANTARO=y
arch/arm/dts/Makefile +1 -0
index d5f61768a..d66b6db07 100644
@@ -30,6 +30,7 @@ lwl-$(CONFIG_MACH_GRINN_LITEBOARD) += imx6ul-liteboard.dtb.o
 lwl-$(CONFIG_MACH_GUF_SANTARO) += imx6q-guf-santaro.dtb.o
 lwl-$(CONFIG_MACH_GUF_VINCELL) += imx53-guf-vincell.dtb.o imx53-guf-vincell-lt.dtb.o
 lwl-$(CONFIG_MACH_GW_VENTANA) += imx6q-gw54xx.dtb.o
+lwl-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += imx7d-flex-concentrator-mfg.dtb.o
 lwl-$(CONFIG_MACH_KONTRON_SAMX6I) += imx6q-samx6i.dtb.o \
 					imx6dl-samx6i.dtb.o
 lwl-$(CONFIG_MACH_LENOVO_IX4_300D) += armada-xp-lenovo-ix4-300d-bb.dtb.o
arch/arm/dts/imx7d-flex-concentrator-mfg.dts new file +108 -0

108 lines not on this page · raw message

arch/arm/mach-imx/Kconfig +5 -0
index 3f8012c73..cc73d0a0d 100644
@@ -526,6 +526,11 @@ config MACH_FREESCALE_MX7_SABRESD
 
 	  https://goo.gl/6EKGdk
 
+config MACH_KAMSTRUP_MX7_CONCENTRATOR
+	bool "Kamstrup i.MX7 Concentrator"
+	select ARCH_IMX7
+	select ARM_USE_COMPRESSED_DTB
+
 config MACH_NXP_IMX6ULL_EVK
 	bool "NXP i.MX6ull EVK Board"
 	select ARCH_IMX6UL
images/Makefile.imx +5 -0
index b892ec019..bc5ad1c7c 100644
@@ -403,6 +403,11 @@ CFG_start_zii_imx7d_dev.pblb.imximg = $(board)/zii-imx7d-dev/flash-header-zii-im
 FILE_barebox-zii-imx7d-dev.img = start_zii_imx7d_dev.pblb.imximg
 image-$(CONFIG_MACH_ZII_IMX7D_DEV) += barebox-zii-imx7d-dev.img
 
+pblb-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += start_kamstrup_mx7_concentrator
+CFG_start_kamstrup_mx7_concentrator.pblb.imximg = $(board)/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg
+FILE_barebox-kamstrup-mx7-concentrator.img = start_kamstrup_mx7_concentrator.pblb.imximg
+image-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += barebox-kamstrup-mx7-concentrator.img
+
 # ----------------------- i.MX8mm based boards --------------------------
 pblb-$(CONFIG_MACH_NXP_IMX8MM_EVK) += start_nxp_imx8mm_evk
 CFG_start_nxp_imx8mm_evk.pblb.imximg = $(board)/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

Hi,

arch/arm/mach-imx/Kconfig config MACH_FREESCALE_MX7_SABRESD · line 532

Quoted 4 lines · Lars Pedersen
arch/arm/mach-imx/Kconfig +4 -0
+config MACH_KAMSTRUP_MX7_CONCENTRATOR
+	bool "Kamstrup i.MX7 Concentrator"
+	select ARCH_IMX7
+	select ARM_USE_COMPRESSED_DTB

You probably want to select CONFIG_POWER_RESET_GPIO_RESTART here eventually.

Cheers,
Ahmad

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH 1/1 ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

In reply to Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..4ee8ffe4b 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select CONFIG_POWER_RESET_GPIO_RESTART
 
 config MACH_NXP_IMX6ULL_EVK
 	bool "NXP i.MX6ull EVK Board"
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Hi,

Quoted 16 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/Kconfig +0 -0
index cc73d0a0d..4ee8ffe4b 100644

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 4 lines
arch/arm/mach-imx/Kconfig +1 -0
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select CONFIG_POWER_RESET_GPIO_RESTART

Sorry, no CONFIG_ in Kconfig files. ^^

Cheers,
Ahmad

Quoted 4 lines
arch/arm/mach-imx/Kconfig +0 -0
 config MACH_NXP_IMX6ULL_EVK
 	bool "NXP i.MX6ull EVK Board"
 
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#4 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Hello Ahmad.

Quoted 15 lines · Ahmad Fatoum

Hi,

Quoted 11 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 9 lines
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..4ee8ffe4b 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
      bool "Kamstrup i.MX7 Concentrator"
      select ARCH_IMX7
      select ARM_USE_COMPRESSED_DTB
+     select CONFIG_POWER_RESET_GPIO_RESTART

Sorry, no CONFIG_ in Kconfig files. ^^

Heh okay :) Then lets stay with the v2 patch and disregard the patch fix in Kconfig.

Quoted 9 lines

Cheers,
Ahmad

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR

Quoted 4 lines
arch/arm/mach-imx/Kconfig +0 -0
 config MACH_NXP_IMX6ULL_EVK
      bool "NXP i.MX6ull EVK Board"
 
Quoted 5 lines

--

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Quoted 30 lines · Lars Pedersen

Hello Ahmad.

Quoted 15 lines · Ahmad Fatoum

Hi,

Quoted 11 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 11 lines

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 9 lines
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..4ee8ffe4b 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
      bool "Kamstrup i.MX7 Concentrator"
      select ARCH_IMX7
      select ARM_USE_COMPRESSED_DTB
+     select CONFIG_POWER_RESET_GPIO_RESTART

Sorry, no CONFIG_ in Kconfig files. ^^

Quoted 2 lines

Heh okay :) Then lets stay with the v2 patch and disregard the patch fix in Kconfig.

Sure, ss you like. Just for clarification, what I meant was that in Kconfig files symbols don't have the CONFIG_ prefix. That's only used outside (e.g. from Makefile or C preprocessor).

Cheers,
Ahmad

Quoted 16 lines
Quoted 15 lines

Cheers,
Ahmad

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR

Quoted 4 lines
arch/arm/mach-imx/Kconfig +0 -0
 config MACH_NXP_IMX6ULL_EVK
      bool "NXP i.MX6ull EVK Board"
 

--

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#6 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Quoted 34 lines · Ahmad Fatoum
Quoted 30 lines · Lars Pedersen

Hello Ahmad.

Quoted 26 lines · Ahmad Fatoum

Hi,

Quoted 16 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/Kconfig +0 -0
index cc73d0a0d..4ee8ffe4b 100644

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 4 lines
arch/arm/mach-imx/Kconfig +1 -0
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
      bool "Kamstrup i.MX7 Concentrator"
      select ARCH_IMX7
      select ARM_USE_COMPRESSED_DTB
+     select CONFIG_POWER_RESET_GPIO_RESTART

Sorry, no CONFIG_ in Kconfig files. ^^

Quoted 6 lines
Quoted 2 lines

Heh okay :) Then lets stay with the v2 patch and disregard the patch fix in Kconfig.

Sure, ss you like. Just for clarification, what I meant was that in Kconfig files symbols don't have the CONFIG_ prefix. That's only used outside (e.g. from Makefile or C preprocessor).

I misread your answer and was a little to quick with a fix. I'll send a new one which also has been compile tested.

Quoted 21 lines

Cheers,
Ahmad

Quoted 10 lines
Quoted 10 lines

Cheers,
Ahmad

Quoted 4 lines
arch/arm/mach-imx/Kconfig +0 -0
 config MACH_NXP_IMX6ULL_EVK
      bool "NXP i.MX6ull EVK Board"
 
Quoted 6 lines
Quoted 5 lines

--

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Quoted 5 lines

--

Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#7 lore raw

PATCH v2 1/1 ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

In reply to Lars Pedersen

Select POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Changes since v1:
- Removed CONFIG_

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..8e156cda2 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select POWER_RESET_GPIO_RESTART
 
 config MACH_NXP_IMX6ULL_EVK
 	bool "NXP i.MX6ull EVK Board"
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#8 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

In reply to Lars Pedersen

Hi Lars,

Quoted 16 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-imx/Kconfig +0 -0
index cc73d0a0d..4ee8ffe4b 100644

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 4 lines
arch/arm/mach-imx/Kconfig +1 -0
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select CONFIG_POWER_RESET_GPIO_RESTART

I wouldn't select it. CONFIG_POWER_RESET_GPIO_RESTART depends on other options and Kconfig can't automatically select the dependencies.

Also if you don't want to make use of the gpio restart driver then you don't want to be forced to compile it in.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#9 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Hello Sascha,

Quoted 14 lines · Sascha Hauer

Hi Lars,

Quoted 11 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 9 lines
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..4ee8ffe4b 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select CONFIG_POWER_RESET_GPIO_RESTART

I wouldn't select it. CONFIG_POWER_RESET_GPIO_RESTART depends on other options and Kconfig can't automatically select the dependencies.

GPIOLIB is selected via ARCH_IMX. This leaves OFDEVICE=n, which wouldn't be a valid configuration anyway for this board and probably all of imx_v7_defconfig..? Should maybe IMX_MULTI_BOARDS select it?

Quoted 2 lines

Also if you don't want to make use of the gpio restart driver then you don't want to be forced to compile it in.

If a board deems reset important enough to force it when enabled, why not?

Cheers,
Ahmad

Quoted 4 lines

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#10 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Quoted 34 lines · Ahmad Fatoum

Hello Sascha,

Quoted 14 lines · Sascha Hauer

Hi Lars,

Quoted 11 lines · Lars Pedersen

Select CONFIG_POWER_RESET_GPIO_RESTART for Kamstrup mx7 concentrator board.

---
Requires patch ARM: i.MX: Kamstrup mx7 concentrator board support

 arch/arm/mach-imx/Kconfig | 1 +
 1 file changed, 1 insertion(+)
Quoted 12 lines

arch/arm/mach-imx/Kconfig config MACH_KAMSTRUP_MX7_CONCENTRATOR · line 533

Quoted 9 lines
arch/arm/mach-imx/Kconfig +1 -0
index cc73d0a0d..4ee8ffe4b 100644
@@ -530,6 +530,7 @@ config MACH_KAMSTRUP_MX7_CONCENTRATOR
 	bool "Kamstrup i.MX7 Concentrator"
 	select ARCH_IMX7
 	select ARM_USE_COMPRESSED_DTB
+	select CONFIG_POWER_RESET_GPIO_RESTART

I wouldn't select it. CONFIG_POWER_RESET_GPIO_RESTART depends on other options and Kconfig can't automatically select the dependencies.

GPIOLIB is selected via ARCH_IMX. This leaves OFDEVICE=n, which wouldn't be a valid configuration anyway for this board and probably all of imx_v7_defconfig..? Should maybe IMX_MULTI_BOARDS select it?

Quoted 5 lines
Quoted 2 lines

Also if you don't want to make use of the gpio restart driver then you don't want to be forced to compile it in.

If a board deems reset important enough to force it when enabled, why not?

With that reasoning you could enable each and everything from a board. I don't think that's a path we want to go.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#11 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Hi,

Quoted 5 lines · Sascha Hauer
Quoted 2 lines

If a board deems reset important enough to force it when enabled, why not?

With that reasoning you could enable each and everything from a board. I don't think that's a path we want to go.

Hmm, okay. It could go into the defconfig though, if Lars wants to.

Cheers,
Ahmad

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#12 lore raw

Re: [PATCH] ARM: i.MX: Fix Kamstrup mx7 concentrator default cfg

Quoted 10 lines · Ahmad Fatoum

Hi,

Quoted 5 lines · Sascha Hauer
Quoted 2 lines

If a board deems reset important enough to force it when enabled, why not?

With that reasoning you could enable each and everything from a board. I don't think that's a path we want to go.

Hmm, okay. It could go into the defconfig though, if Lars wants to.

Indeed, and I recommend doing so.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#13 lore raw
In reply to Lars Pedersen
Quoted 11 lines · Lars Pedersen

This adds support for Kamstrup mx7 concentrator board

---
Changes since v1:
- Removed all board.c specific stuff
- Board power reset via new GPIO board power-off driver
- TPM reset will now be handled entirely in hardware
- Set barebox_set_model removed.

Applied like it is here, without the fixup.

Sascha

Quoted 341 lines
 arch/arm/boards/Makefile                      |   1 +
 .../boards/kamstrup-mx7-concentrator/Makefile |   1 +
 .../flash-header-tqma7d.imxcfg                |  79 +++++++++++++
 .../kamstrup-mx7-concentrator/lowlevel.c      |  35 ++++++
 arch/arm/configs/imx_v7_defconfig             |   1 +
 arch/arm/dts/Makefile                         |   1 +
 arch/arm/dts/imx7d-flex-concentrator-mfg.dts  | 108 ++++++++++++++++++
 arch/arm/mach-imx/Kconfig                     |   5 +
 images/Makefile.imx                           |   5 +
 9 files changed, 236 insertions(+)
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/Makefile
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg
 create mode 100644 arch/arm/boards/kamstrup-mx7-concentrator/lowlevel.c
 create mode 100644 arch/arm/dts/imx7d-flex-concentrator-mfg.dts
arch/arm/boards/Makefile +1 -0
index 9ccb75e27..0e59d6a77 100644
@@ -63,6 +63,7 @@ obj-$(CONFIG_MACH_HABA_KNX_LITE)		+= haba-knx/
 obj-$(CONFIG_MACH_IMX21ADS)			+= freescale-mx21-ads/
 obj-$(CONFIG_MACH_IMX233_OLINUXINO)		+= imx233-olinuxino/
 obj-$(CONFIG_MACH_IMX27ADS)			+= freescale-mx27-ads/
+obj-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR)	+= kamstrup-mx7-concentrator/
 obj-$(CONFIG_MACH_KINDLE3)			+= kindle3/
 obj-$(CONFIG_MACH_KONTRON_SAMX6I)		+= kontron-samx6i/
 obj-$(CONFIG_MACH_LENOVO_IX4_300D)		+= lenovo-ix4-300d/
arch/arm/boards/kamstrup-mx7-concentrator/Makefile new file +1 -0
new file mode 100644
index 000000000..7ab9f5274
@@ -0,0 +1 @@
+lwl-y += lowlevel.o
\ No newline at end of file
arch/arm/boards/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg new file +79 -0
new file mode 100644
index 000000000..4b3632411
@@ -0,0 +1,79 @@
+soc imx7
+loadaddr 0xbfbff000
+ivtofs 0x400
+
+#include <mach/imx7-ddr-regs.h>
+
+wm 32 0x30340004 0x4F400005 /* IOMUXC_GPR_GPR1 */
+/* Clear then set bit30 to ensure exit from DDR retention */
+wm 32 0x30360388 0x40000000
+wm 32 0x30360384 0x40000000
+
+/* TQMa7x DRAM Timing REV0100 */
+/* DCD Code i.MX7D/S 528 MHz 1 GByte Samsung K4B4G1646D */
+wm 32 0x30360070 0x0070302C /* CCM_ANALOG_PLL_DDRx */
+wm 32  0x30360090 0x00000000 /* CCM_ANALOG_PLL_NUM */
+wm 32  0x30360070 0x0060302C /* CCM_ANALOG_PLL_DDRx */
+check 32 until_all_bits_set 0x30360070 0x80000000
+wm 32 0x30391000 0x00000002 /* SRC_DDRC_RCR */
+
+wm 32 MX7_DDRC_MSTR 0x01040001
+wm 32 MX7_DDRC_DFIUPD0 0x80400003
+wm 32 MX7_DDRC_DFIUPD1 0x00100020
+wm 32 MX7_DDRC_DFIUPD2 0x80100004
+wm 32 MX7_DDRC_RFSHTMG 0x00200045
+wm 32 MX7_DDRC_MP_PCTRL_0 0x00000001
+wm 32 MX7_DDRC_INIT0 0x00020081
+wm 32 MX7_DDRC_INIT1 0x00680000
+wm 32 MX7_DDRC_INIT3 0x09300004
+wm 32 MX7_DDRC_INIT4 0x00480000
+wm 32 MX7_DDRC_INIT5 0x00100004
+wm 32 MX7_DDRC_RANKCTL 0x0000033F
+wm 32 MX7_DDRC_DRAMTMG0 0x090E0809
+wm 32 MX7_DDRC_DRAMTMG1 0x0007020E
+wm 32 MX7_DDRC_DRAMTMG2 0x03040407
+wm 32 MX7_DDRC_DRAMTMG3 0x00002006
+wm 32 MX7_DDRC_DRAMTMG4 0x04020304
+wm 32 MX7_DDRC_DRAMTMG5 0x03030202
+wm 32 MX7_DDRC_DRAMTMG8 0x00000803
+wm 32 MX7_DDRC_ZQCTL0 0x00800020
+wm 32 MX7_DDRC_DFITMG0 0x02098204
+wm 32 MX7_DDRC_DFITMG1 0x00030303
+wm 32 MX7_DDRC_ADDRMAP0 0x00000016
+wm 32 MX7_DDRC_ADDRMAP1 0x00171717
+wm 32 MX7_DDRC_ADDRMAP4 0x00000F0F
+wm 32 MX7_DDRC_ADDRMAP5 0x04040404
+wm 32 MX7_DDRC_ADDRMAP6 0x0F040404
+wm 32 MX7_DDRC_ODTCFG 0x06000604
+wm 32 MX7_DDRC_ODTMAP 0x00000001
+wm 32 0x30391000 0x00000000 /* SRC_DDRC_RCR */
+wm 32 MX7_DDR_PHY_PHY_CON0 0x17420F40
+wm 32 MX7_DDR_PHY_PHY_CON1 0x10210100
+wm 32 MX7_DDR_PHY_PHY_CON4 0x00060807
+wm 32 MX7_DDR_PHY_MDLL_CON0 0x1010007E
+wm 32 MX7_DDR_PHY_DRVDS_CON0 0x00000924
+/* DDR_PHY_CMD_DESKEW_CON0 not set */
+/* DDR_PHY_CMD_DESKEW_CON1 not set */
+/* DDR_PHY_CMD_DESKEW_CON2 not set */
+/* DDR_PHY_CMD_DESKEW_CON3 not set */
+/* DDR_PHY_LVL_CON0 not set */
+wm 32 MX7_DDR_PHY_OFFSET_RD_CON0 0x0B0B0B0B
+wm 32 MX7_DDR_PHY_OFFSET_WR_CON0 0x06060606
+wm 32 MX7_DDR_PHY_CMD_SDLL_CON0 0x01000010
+wm 32 MX7_DDR_PHY_CMD_SDLL_CON0 0x00000010
+
+wm 32 MX7_DDR_PHY_ZQ_CON0 0x0C407304
+wm 32 MX7_DDR_PHY_ZQ_CON0 0x0C447304
+wm 32 MX7_DDR_PHY_ZQ_CON0 0x0C447306
+check 32 until_all_bits_set MX7_DDR_PHY_ZQ_CON1 0x1 /* ZQ Calibration is finished */
+wm 32 MX7_DDR_PHY_ZQ_CON0 0x0C447304
+wm 32 MX7_DDR_PHY_ZQ_CON0 0x0C407304
+
+wm 32 0x30384130 0x00000000 /* CCM_CCGRn */
+wm 32 0x30340020 0x00000178 /* IOMUXC_GPR_GPR8 */
+wm 32 0x30384130 0x00000002 /* CCM_CCGRn */
+wm 32 0x30790018 0x0000000f /* DDR_PHY_LP_CON0 */
+
+/* DDRC_STAT */
+check 32 until_all_bits_set 0x307a0004 0x1
+
arch/arm/boards/kamstrup-mx7-concentrator/lowlevel.c new file +35 -0
new file mode 100644
index 000000000..8cd6d67f7
@@ -0,0 +1,35 @@
+#include <debug_ll.h>
+#include <io.h>
+#include <common.h>
+#include <linux/sizes.h>
+#include <mach/generic.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/imx7-ccm-regs.h>
+#include <mach/iomux-mx7.h>
+#include <mach/debug_ll.h>
+#include <asm/cache.h>
+#include <mach/esdctl.h>
+
+extern char __dtb_z_imx7d_flex_concentrator_mfg_start[];
+
+static inline void setup_uart(void)
+{
+	imx7_early_setup_uart_clock();
+
+	imx7_setup_pad(MX7D_PAD_SAI2_TX_BCLK__UART4_DCE_TX);
+
+	imx7_uart_setup_ll();
+
+	putc_ll('>');
+}
+
+ENTRY_FUNCTION(start_kamstrup_mx7_concentrator, r0, r1, r2)
+{
+	imx7_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL))
+		setup_uart();
+
+	imx7d_barebox_entry(__dtb_z_imx7d_flex_concentrator_mfg_start + get_runtime_offset());
+}
arch/arm/configs/imx_v7_defconfig +1 -0
index 16e109464..624698ae3 100644
@@ -13,6 +13,7 @@ CONFIG_MACH_FREESCALE_MX53_VMX53=y
 CONFIG_MACH_TX53=y
 CONFIG_MACH_PHYTEC_SOM_IMX6=y
 CONFIG_MACH_PROTONIC_IMX6=y
+CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR=y
 CONFIG_MACH_KONTRON_SAMX6I=y
 CONFIG_MACH_DFI_FS700_M60=y
 CONFIG_MACH_GUF_SANTARO=y
arch/arm/dts/Makefile +1 -0
index d5f61768a..d66b6db07 100644
@@ -30,6 +30,7 @@ lwl-$(CONFIG_MACH_GRINN_LITEBOARD) += imx6ul-liteboard.dtb.o
 lwl-$(CONFIG_MACH_GUF_SANTARO) += imx6q-guf-santaro.dtb.o
 lwl-$(CONFIG_MACH_GUF_VINCELL) += imx53-guf-vincell.dtb.o imx53-guf-vincell-lt.dtb.o
 lwl-$(CONFIG_MACH_GW_VENTANA) += imx6q-gw54xx.dtb.o
+lwl-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += imx7d-flex-concentrator-mfg.dtb.o
 lwl-$(CONFIG_MACH_KONTRON_SAMX6I) += imx6q-samx6i.dtb.o \
 					imx6dl-samx6i.dtb.o
 lwl-$(CONFIG_MACH_LENOVO_IX4_300D) += armada-xp-lenovo-ix4-300d-bb.dtb.o
arch/arm/dts/imx7d-flex-concentrator-mfg.dts new file +108 -0
new file mode 100644
index 000000000..d174ef725
@@ -0,0 +1,108 @@
+/*
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <arm/imx7d-flex-concentrator-mfg.dts>
+
+/ {
+	chosen {
+		environment {
+			compatible = "barebox,environment";
+			device-path = &environment_emmc;
+		};
+	};
+
+	aliases {
+		state = &state_emmc;
+	};
+
+	state_emmc: state {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "barebox,state";
+		magic = <0x4b414d31>;
+		backend-type = "raw";
+		backend = <&backend_state_emmc>;
+		backend-stridesize = <0x200>;
+
+		bootstate {
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			system0 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				remaining_attempts@0 {
+					reg = <0x0 0x4>;
+					type = "uint32";
+					default = <10>;
+				};
+
+				priority@4 {
+					reg = <0x4 0x4>;
+					type = "uint32";
+					default = <21>;
+				};
+			};
+
+			system1 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+
+				remaining_attempts@8 {
+					reg = <0x8 0x4>;
+					type = "uint32";
+					default = <0>;
+				};
+
+				priority@c {
+					reg = <0xc 0x4>;
+					type = "uint32";
+					default = <20>;
+				};
+			};
+
+			last_chosen@10 {
+				reg = <0x10 0x4>;
+				type = "uint32";
+			};
+		};
+	};
+};
+
+/* eMMC */
+&usdhc3 {
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition@0 {
+			label = "barebox";
+			reg = <0x0 0x100000>;
+		};
+
+		environment_emmc: partition@100000 {
+			label = "barebox-environment";
+			reg = <0x100000 0x100000>;
+		};
+
+		backend_state_emmc: partition@200000 {
+			label = "barebox-state";
+			reg = <0x200000 0x100000>;
+		};
+	};
+};
+
+/* FIXME: barebox serial is broken when barebox applies requested reparenting */
+&uart4 {
+	/delete-property/ assigned-clocks;
+	/delete-property/ assigned-clock-parents;
+};
+
arch/arm/mach-imx/Kconfig +5 -0
index 3f8012c73..cc73d0a0d 100644
@@ -526,6 +526,11 @@ config MACH_FREESCALE_MX7_SABRESD
 
 	  https://goo.gl/6EKGdk
 
+config MACH_KAMSTRUP_MX7_CONCENTRATOR
+	bool "Kamstrup i.MX7 Concentrator"
+	select ARCH_IMX7
+	select ARM_USE_COMPRESSED_DTB
+
 config MACH_NXP_IMX6ULL_EVK
 	bool "NXP i.MX6ull EVK Board"
 	select ARCH_IMX6UL
images/Makefile.imx +5 -0
index b892ec019..bc5ad1c7c 100644
@@ -403,6 +403,11 @@ CFG_start_zii_imx7d_dev.pblb.imximg = $(board)/zii-imx7d-dev/flash-header-zii-im
 FILE_barebox-zii-imx7d-dev.img = start_zii_imx7d_dev.pblb.imximg
 image-$(CONFIG_MACH_ZII_IMX7D_DEV) += barebox-zii-imx7d-dev.img
 
+pblb-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += start_kamstrup_mx7_concentrator
+CFG_start_kamstrup_mx7_concentrator.pblb.imximg = $(board)/kamstrup-mx7-concentrator/flash-header-tqma7d.imxcfg
+FILE_barebox-kamstrup-mx7-concentrator.img = start_kamstrup_mx7_concentrator.pblb.imximg
+image-$(CONFIG_MACH_KAMSTRUP_MX7_CONCENTRATOR) += barebox-kamstrup-mx7-concentrator.img
+
 # ----------------------- i.MX8mm based boards --------------------------
 pblb-$(CONFIG_MACH_NXP_IMX8MM_EVK) += start_nxp_imx8mm_evk
 CFG_start_nxp_imx8mm_evk.pblb.imximg = $(board)/nxp-imx8mm-evk/flash-header-imx8mm-evk.imxcfg
Signature · 7 lines
2.30.2


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox