Skip to contentSkip to conversation

Add Gateworks Venice board support

PATCH Superseded Tim Harvey 4 participants 15 messages Jan 13, 2021 – Feb 5, 2021

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tim Harvey

author
#0 lore raw

cover Add Gateworks Venice board support

The Gateworks Venice product family consists of several boards based on the i.MX 8M Mini SoC.

A challenge I've had with this is that the board model information is stored in an I2C based EEPROM that must be read to know what PMIC is on the board in order to adjust certain power rails before DRAM init is called. I found this to be a challenge in the SPL as the SPL does not free memory thus the conceprt of calling dm_uninit() followed by dm_init_and_scan() to change dt's live in the SPL runs out of memory. Therefore I can't rely on DT/DM within the SPL for things that may differ board to board.

Best Regards,

Tim

Frieder Schrempf (1):
Respect that some compression algos can be enabled separately for SPL

Tim Harvey (3):
power: pmic: add driver for Monolithic Power mp5416
arm: dts: imx8mm: add Gateworks i.MX8 Mini Dev kits
board: gateworks: imx8mm: Add Gateworks Venice board support

 arch/arm/dts/Makefile                            |    4 +
 arch/arm/dts/imx8mm-venice-gw700x-u-boot.dtsi    |  105 +
 arch/arm/dts/imx8mm-venice-gw700x.dtsi           |  495 +++++
 arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-gw71xx-0x.dts         |   19 +
 arch/arm/dts/imx8mm-venice-gw71xx.dtsi           |  186 ++
 arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-gw72xx-0x.dts         |   20 +
 arch/arm/dts/imx8mm-venice-gw72xx.dtsi           |  311 +++
 arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-gw73xx-0x.dts         |   19 +
 arch/arm/dts/imx8mm-venice-gw73xx.dtsi           |  362 ++++
 arch/arm/dts/imx8mm-venice-u-boot.dtsi           |  103 +
 arch/arm/dts/imx8mm-venice.dts                   |  152 ++
 arch/arm/mach-imx/imx8m/Kconfig                  |    7 +
 board/gateworks/venice/Kconfig                   |   13 +
 board/gateworks/venice/MAINTAINERS               |    7 +
 board/gateworks/venice/Makefile                  |   12 +
 board/gateworks/venice/README                    |   34 +
 board/gateworks/venice/gsc.c                     |  687 ++++++
 board/gateworks/venice/gsc.h                     |   54 +
 board/gateworks/venice/imx8mm_venice.c           |  133 ++
 board/gateworks/venice/lpddr4_timing.c           | 2505 ++++++++++++++++++++++
 board/gateworks/venice/lpddr4_timing.h           |   12 +
 board/gateworks/venice/spl.c                     |  187 ++
 common/image.c                                   |   13 +-
 configs/imx8mm_venice_defconfig                  |  113 +
 drivers/power/pmic/Kconfig                       |   15 +
 drivers/power/pmic/Makefile                      |    1 +
 drivers/power/pmic/mp5416.c                      |   98 +
 include/configs/imx8mm_venice.h                  |  125 ++
 include/power/mp5416.h                           |   41 +
 32 files changed, 5842 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/dts/imx8mm-venice-gw700x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw700x.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice.dts
 create mode 100644 board/gateworks/venice/Kconfig
 create mode 100644 board/gateworks/venice/MAINTAINERS
 create mode 100644 board/gateworks/venice/Makefile
 create mode 100644 board/gateworks/venice/README
 create mode 100644 board/gateworks/venice/gsc.c
 create mode 100644 board/gateworks/venice/gsc.h
 create mode 100644 board/gateworks/venice/imx8mm_venice.c
 create mode 100644 board/gateworks/venice/lpddr4_timing.c
 create mode 100644 board/gateworks/venice/lpddr4_timing.h
 create mode 100644 board/gateworks/venice/spl.c
 create mode 100644 configs/imx8mm_venice_defconfig
 create mode 100644 drivers/power/pmic/mp5416.c
 create mode 100644 include/configs/imx8mm_venice.h
 create mode 100644 include/power/mp5416.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

From: Frieder Schrempf <[email protected]>

Some compression algorithms currently can be enabled for SPL and U-Boot proper separately. Therefore we need to use CONFIG_IS_ENABLED() in these cases and also prevent compiling these functions in case of a host tool build.

---
 common/image.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
common/image.c +7 -6
index 451fc68..bda19c0 100644
@@ -72,6 +72,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 #include <u-boot/crc.h>
 #include <imximage.h>
+#include <linux/kconfig.h>
 
 #ifndef CONFIG_SYS_BARGSIZE
 #define CONFIG_SYS_BARGSIZE 512
@@ -460,13 +461,13 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		else
 			ret = -ENOSPC;
 		break;
-#ifdef CONFIG_GZIP
+#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)
 	case IH_COMP_GZIP: {
 		ret = gunzip(load_buf, unc_len, image_buf, &image_len);
 		break;
 	}
 #endif /* CONFIG_GZIP */
-#ifdef CONFIG_BZIP2
+#if CONFIG_IS_ENABLED(BZIP2) && !defined(USE_HOSTCC)
 	case IH_COMP_BZIP2: {
 		uint size = unc_len;
 
@@ -482,7 +483,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_BZIP2 */
-#ifdef CONFIG_LZMA
+#if CONFIG_IS_ENABLED(LZMA) && !defined(USE_HOSTCC)
 	case IH_COMP_LZMA: {
 		SizeT lzma_len = unc_len;
 
@@ -492,7 +493,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZMA */
-#ifdef CONFIG_LZO
+#if CONFIG_IS_ENABLED(LZO) && !defined(USE_HOSTCC)
 	case IH_COMP_LZO: {
 		size_t size = unc_len;
 
@@ -501,7 +502,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZO */
-#ifdef CONFIG_LZ4
+#if CONFIG_IS_ENABLED(LZ4) && !defined(USE_HOSTCC)
 	case IH_COMP_LZ4: {
 		size_t size = unc_len;
 
@@ -510,7 +511,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZ4 */
-#ifdef CONFIG_ZSTD
+#if CONFIG_IS_ENABLED(ZSTD) && !defined(USE_HOSTCC)
 	case IH_COMP_ZSTD: {
 		size_t size = unc_len;
 		ZSTD_DStream *dstream;
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)
982 | if (t->sname && strcasecmp(t->sname + gd->reloc_off, name) == 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Can you take a look ? Thanks !

Best regards,
Stefano

Quoted 78 lines · Tim Harvey

From: Frieder Schrempf <[email protected]>

Some compression algorithms currently can be enabled for SPL and U-Boot proper separately. Therefore we need to use CONFIG_IS_ENABLED() in these cases and also prevent compiling these functions in case of a host tool build.

---
 common/image.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
common/image.c +7 -6
index 451fc68..bda19c0 100644
@@ -72,6 +72,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 #include <u-boot/crc.h>
 #include <imximage.h>
+#include <linux/kconfig.h>
 
 #ifndef CONFIG_SYS_BARGSIZE
 #define CONFIG_SYS_BARGSIZE 512
@@ -460,13 +461,13 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		else
 			ret = -ENOSPC;
 		break;
-#ifdef CONFIG_GZIP
+#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)
 	case IH_COMP_GZIP: {
 		ret = gunzip(load_buf, unc_len, image_buf, &image_len);
 		break;
 	}
 #endif /* CONFIG_GZIP */
-#ifdef CONFIG_BZIP2
+#if CONFIG_IS_ENABLED(BZIP2) && !defined(USE_HOSTCC)
 	case IH_COMP_BZIP2: {
 		uint size = unc_len;
 
@@ -482,7 +483,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_BZIP2 */
-#ifdef CONFIG_LZMA
+#if CONFIG_IS_ENABLED(LZMA) && !defined(USE_HOSTCC)
 	case IH_COMP_LZMA: {
 		SizeT lzma_len = unc_len;
 
@@ -492,7 +493,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZMA */
-#ifdef CONFIG_LZO
+#if CONFIG_IS_ENABLED(LZO) && !defined(USE_HOSTCC)
 	case IH_COMP_LZO: {
 		size_t size = unc_len;
 
@@ -501,7 +502,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZO */
-#ifdef CONFIG_LZ4
+#if CONFIG_IS_ENABLED(LZ4) && !defined(USE_HOSTCC)
 	case IH_COMP_LZ4: {
 		size_t size = unc_len;
 
@@ -510,7 +511,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
 		break;
 	}
 #endif /* CONFIG_LZ4 */
-#ifdef CONFIG_ZSTD
+#if CONFIG_IS_ENABLED(ZSTD) && !defined(USE_HOSTCC)
 	case IH_COMP_ZSTD: {
 		size_t size = unc_len;
 		ZSTD_DStream *dstream;
Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#3 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Quoted 16 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)
982 | if (t->sname && strcasecmp(t->sname + gd->reloc_off, name) == 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Quoted 2 lines

Can you take a look ? Thanks !

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

Tim

Quoted 90 lines

Best regards,
Stefano

Quoted 70 lines · Tim Harvey

From: Frieder Schrempf <[email protected]>

Some compression algorithms currently can be enabled for SPL and U-Boot proper separately. Therefore we need to use CONFIG_IS_ENABLED() in these cases and also prevent compiling these functions in case of a host tool build.

---
 common/image.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
common/image.c +6 -5
index 451fc68..bda19c0 100644
@@ -72,6 +72,7 @@ static const image_header_t *image_get_ramdisk(ulong rd_addr, uint8_t arch,
 
 #include <u-boot/crc.h>
 #include <imximage.h>
+#include <linux/kconfig.h>
 
 #ifndef CONFIG_SYS_BARGSIZE
 #define CONFIG_SYS_BARGSIZE 512
@@ -460,13 +461,13 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
              else
                      ret = -ENOSPC;
              break;
-#ifdef CONFIG_GZIP
+#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)
      case IH_COMP_GZIP: {
              ret = gunzip(load_buf, unc_len, image_buf, &image_len);
              break;
      }
 #endif /* CONFIG_GZIP */
-#ifdef CONFIG_BZIP2
+#if CONFIG_IS_ENABLED(BZIP2) && !defined(USE_HOSTCC)
      case IH_COMP_BZIP2: {
              uint size = unc_len;
 
@@ -482,7 +483,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
              break;
      }
 #endif /* CONFIG_BZIP2 */
-#ifdef CONFIG_LZMA
+#if CONFIG_IS_ENABLED(LZMA) && !defined(USE_HOSTCC)
      case IH_COMP_LZMA: {
              SizeT lzma_len = unc_len;
 
@@ -492,7 +493,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
              break;
      }
 #endif /* CONFIG_LZMA */
-#ifdef CONFIG_LZO
+#if CONFIG_IS_ENABLED(LZO) && !defined(USE_HOSTCC)
      case IH_COMP_LZO: {
              size_t size = unc_len;
 
@@ -501,7 +502,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
              break;
      }
 #endif /* CONFIG_LZO */
-#ifdef CONFIG_LZ4
+#if CONFIG_IS_ENABLED(LZ4) && !defined(USE_HOSTCC)
      case IH_COMP_LZ4: {
              size_t size = unc_len;
 

common/image.c int image_decomp(int comp, ulong load, ulong image_start, int type, · line 517

Quoted 8 lines
common/image.c +1 -1
@@ -510,7 +511,7 @@ int image_decomp(int comp, ulong load, ulong image_start, int type,
              break;
      }
 #endif /* CONFIG_LZ4 */
-#ifdef CONFIG_ZSTD
+#if CONFIG_IS_ENABLED(ZSTD) && !defined(USE_HOSTCC)
      case IH_COMP_ZSTD: {
              size_t size = unc_len;
              ZSTD_DStream *dstream;

--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

#4 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Quoted 20 lines · Tim Harvey
Quoted 16 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)
982 | if (t->sname && strcasecmp(t->sname + gd->reloc_off, name) == 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Quoted 2 lines

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

#5 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Quoted 34 lines · Frieder Schrempf
Quoted 21 lines · Tim Harvey
Quoted 17 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)
?? 982 |?? if (t->sname && strcasecmp(t->sname + gd->reloc_off, name) == 0)
?????? |???????????????????????????????????????? ^~ ./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Quoted 2 lines

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

Quoted 8 lines

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

True, but...we cannot even break other boards, too. I have also get a short look at the issue, but I could not find myself the reason, too. I plan to get a deeper look in the week end.

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#6 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Hi everybody,

Quoted 40 lines · Stefano Babic
Quoted 39 lines · Frieder Schrempf
Quoted 21 lines · Tim Harvey
Quoted 17 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)
?? 982 |?? if (t->sname && strcasecmp(t->sname + gd->reloc_off, name)
== 0)
?????? |???????????????????????????????????????? ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Quoted 2 lines

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

Quoted 7 lines
Quoted 3 lines

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

True, but...we cannot even break other boards, too. I have also get a short look at the issue, but I could not find myself the reason, too. I plan to get a deeper look in the week end.

It looks like that only for m68k the following statement does not work

#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)

But if I replace this with the equivalent one:

+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(GZIP)

This works - someone else should have discovered this before, because in common/image.c USE_HOSTCC is never anded with another CONFIG.

I have not found why this happens just for m68k, no issue with arm/aarch64 or PowerPC. I send a V2 with the changes like above.

@Tim: why do we need include/kconfig ?

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#7 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Quoted 61 lines · Stefano Babic

Hi everybody,

Quoted 40 lines · Stefano Babic
Quoted 39 lines · Frieder Schrempf
Quoted 21 lines · Tim Harvey
Quoted 11 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)

Quoted 8 lines
    982 |   if (t->sname && strcasecmp(t->sname + gd->reloc_off, name)

== 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

Quoted 7 lines
Quoted 3 lines

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

True, but...we cannot even break other boards, too. I have also get a short look at the issue, but I could not find myself the reason, too. I plan to get a deeper look in the week end.

It looks like that only for m68k the following statement does not work

#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)

But if I replace this with the equivalent one:

(quoted diff) +2 -0
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(GZIP)
Quoted 7 lines

This works - someone else should have discovered this before, because in common/image.c USE_HOSTCC is never anded with another CONFIG.

I have not found why this happens just for m68k, no issue with arm/aarch64 or PowerPC. I send a V2 with the changes like above.

@Tim: why do we need include/kconfig ?

Stefano,

If we switch to your method above we don't need it (it was needed for what I submitted).

Shall I resubmit with your suggested change around GZIP/BZIP2/LZMA/LZO/LZ4/ZSTD in image_decomp? And if so, with these changes would I replace Frieder's sign-off with a Cc as the patch has changed quite a bit from his original derived work?

Have you had any time to review the reset of the patch series yet?

Best regards,

Tim

#8 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Hallo Tim,

Quoted 68 lines · Tim Harvey
Quoted 67 lines · Stefano Babic

Hi everybody,

Quoted 40 lines · Stefano Babic
Quoted 39 lines · Frieder Schrempf
Quoted 21 lines · Tim Harvey
Quoted 11 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)

Quoted 8 lines
     982 |   if (t->sname && strcasecmp(t->sname + gd->reloc_off, name)

== 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

Quoted 7 lines
Quoted 3 lines

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

True, but...we cannot even break other boards, too. I have also get a short look at the issue, but I could not find myself the reason, too. I plan to get a deeper look in the week end.

It looks like that only for m68k the following statement does not work

#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)

But if I replace this with the equivalent one:

(quoted diff) +2 -0
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(GZIP)

This works - someone else should have discovered this before, because in common/image.c USE_HOSTCC is never anded with another CONFIG.

I have not found why this happens just for m68k, no issue with arm/aarch64 or PowerPC. I send a V2 with the changes like above.

Quoted 6 lines
Quoted 1 line

@Tim: why do we need include/kconfig ?

Stefano,

If we switch to your method above we don't need it (it was needed for what I submitted).

Ok

Quoted 3 lines

Shall I resubmit with your suggested change around GZIP/BZIP2/LZMA/LZO/LZ4/ZSTD in image_decomp?

Yes, please.

Quoted 3 lines

And if so, with these
changes would I replace Frieder's sign-off with a Cc as the patch has changed quite a bit from his original derived work?

No, I do not think so. Original work is from Frieder, and his work should be tracked. You add of course your Signed-off-by, but without removing Frieder's.

Quoted 2 lines

Have you had any time to review the reset of the patch series yet?

The rest, you mean :-)

It was ok for me and I was already merging the whole series until I got this weird error on m68k.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
author
#9 lore raw

PATCH 1/4 Respect that some compression algos can be enabled separately for SPL

Quoted 96 lines · Stefano Babic

Hallo Tim,

Quoted 68 lines · Tim Harvey
Quoted 67 lines · Stefano Babic

Hi everybody,

Quoted 40 lines · Stefano Babic
Quoted 39 lines · Frieder Schrempf
Quoted 21 lines · Tim Harvey
Quoted 11 lines · Stefano Babic

Hi Tim,

there is a weird side effect with this patch, breaking m68k architecture. For some reason, image.c is not compiled clean because gd is not declared anymore.

In file included from tools/common/image.c:1:
./tools/../common/image.c: In function ?get_table_entry_id?:
./tools/../common/image.c:982:41: error: ?gd? undeclared (first use in this function)

Quoted 8 lines
     982 |   if (t->sname && strcasecmp(t->sname + gd->reloc_off, name)

== 0)
| ^~
./tools/../common/image.c:982:41: note: each undeclared identifier is reported only once for each functi

Can you take a look ? Thanks !

Quoted 8 lines

Stefano,

I have no idea what could cause this... must be something to do with including kconfig.h?

What board/target would I build to reproduce this?

Frieder, do you have any ideas?

I can't remember if I did a full test on all platforms when I wrote this patch. Probably not.

And I have no idea what is causing this, nor do I currently have the time to have a closer look, sorry.

BTW, this is a very good example for what I said earlier:

Quoted 7 lines
Quoted 3 lines

"I failed to do upstreaming work for U-Boot for quite some time. Mainly because whenever I try to, I end up fixing/cleaning some weird U-Boot code/behavior and spending way more time than I actually have available."

True, but...we cannot even break other boards, too. I have also get a short look at the issue, but I could not find myself the reason, too. I plan to get a deeper look in the week end.

It looks like that only for m68k the following statement does not work

#if CONFIG_IS_ENABLED(GZIP) && !defined(USE_HOSTCC)

But if I replace this with the equivalent one:

(quoted diff) +2 -0
+#ifndef USE_HOSTCC
+#if CONFIG_IS_ENABLED(GZIP)

This works - someone else should have discovered this before, because in common/image.c USE_HOSTCC is never anded with another CONFIG.

I have not found why this happens just for m68k, no issue with arm/aarch64 or PowerPC. I send a V2 with the changes like above.

Quoted 6 lines
Quoted 1 line

@Tim: why do we need include/kconfig ?

Stefano,

If we switch to your method above we don't need it (it was needed for what I submitted).

Ok

Quoted 3 lines

Shall I resubmit with your suggested change around GZIP/BZIP2/LZMA/LZO/LZ4/ZSTD in image_decomp?

Yes, please.

Quoted 3 lines

And if so, with these
changes would I replace Frieder's sign-off with a Cc as the patch has changed quite a bit from his original derived work?

No, I do not think so. Original work is from Frieder, and his work should be tracked. You add of course your Signed-off-by, but without removing Frieder's.

Quoted 1 line
Quoted 7 lines
Quoted 1 line

Have you had any time to review the reset of the patch series yet?

The rest, you mean :-)

It was ok for me and I was already merging the whole series until I got this weird error on m68k.

Ok, I'll submit a v2 with the changes here. The pmic driver already got applied so the series will drop that patch.

Thanks,

Tim

author
#10 lore raw

PATCH 2/4 power: pmic: add driver for Monolithic Power mp5416

In reply to Tim Harvey

This adds basic register access and child regulator binding for the Monolithic MP5416 Power Management IC which integrates four DC/DC switching converters and five LDO regulators.

---
 drivers/power/pmic/Kconfig  | 15 +++++++
 drivers/power/pmic/Makefile |  1 +
 drivers/power/pmic/mp5416.c | 98 +++++++++++++++++++++++++++++++++++++++++++++
 include/power/mp5416.h      | 41 +++++++++++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 drivers/power/pmic/mp5416.c
 create mode 100644 include/power/mp5416.h
drivers/power/pmic/Kconfig +15 -0
index 7d51510..583fd3d 100644
@@ -91,6 +91,21 @@ config DM_PMIC_FAN53555
 	  The driver implements read/write operations for use with the FAN53555
 	  regulator driver and binds the regulator driver to its node.
 
+config DM_PMIC_MP5416
+	bool "Enable Driver Model for PMIC MP5416"
+	depends on DM_PMIC
+	help
+	  This config enables implementation of driver-model pmic uclass features
+	  for PMIC MP5416. The driver implements read/write operations.
+
+config SPL_DM_PMIC_MP5416
+	bool "Enable Driver Model for PMIC MP5416 in SPL stage"
+	depends on DM_PMIC
+	help
+	  This config enables implementation of driver-model pmic uclass
+	  features for PMIC MP5416. The driver implements read/write
+	  operations.
+
 config DM_PMIC_PCA9450
 	bool "Enable Driver Model for PMIC PCA9450"
 	depends on DM_PMIC
drivers/power/pmic/Makefile +1 -0
index 9cd6c37..2b2a6dd 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
 obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
 obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_BD71837) += bd71837.o
+obj-$(CONFIG_$(SPL_)DM_PMIC_MP5416) += mp5416.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PCA9450) += pca9450.o
 obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
drivers/power/pmic/mp5416.c new file +98 -0

98 lines not on this page · raw message

include/power/mp5416.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.7.4
#11 lore raw

PATCH 2/4 power: pmic: add driver for Monolithic Power mp5416

Quoted 191 lines · Tim Harvey

This adds basic register access and child regulator binding for the Monolithic MP5416 Power Management IC which integrates four DC/DC switching converters and five LDO regulators.

---
 drivers/power/pmic/Kconfig  | 15 +++++++
 drivers/power/pmic/Makefile |  1 +
 drivers/power/pmic/mp5416.c | 98 +++++++++++++++++++++++++++++++++++++++++++++
 include/power/mp5416.h      | 41 +++++++++++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 drivers/power/pmic/mp5416.c
 create mode 100644 include/power/mp5416.h
drivers/power/pmic/Kconfig +15 -0
index 7d51510..583fd3d 100644
@@ -91,6 +91,21 @@ config DM_PMIC_FAN53555
 	  The driver implements read/write operations for use with the FAN53555
 	  regulator driver and binds the regulator driver to its node.
 
+config DM_PMIC_MP5416
+	bool "Enable Driver Model for PMIC MP5416"
+	depends on DM_PMIC
+	help
+	  This config enables implementation of driver-model pmic uclass features
+	  for PMIC MP5416. The driver implements read/write operations.
+
+config SPL_DM_PMIC_MP5416
+	bool "Enable Driver Model for PMIC MP5416 in SPL stage"
+	depends on DM_PMIC
+	help
+	  This config enables implementation of driver-model pmic uclass
+	  features for PMIC MP5416. The driver implements read/write
+	  operations.
+
 config DM_PMIC_PCA9450
 	bool "Enable Driver Model for PMIC PCA9450"
 	depends on DM_PMIC
drivers/power/pmic/Makefile +1 -0
index 9cd6c37..2b2a6dd 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
 obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
 obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_BD71837) += bd71837.o
+obj-$(CONFIG_$(SPL_)DM_PMIC_MP5416) += mp5416.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PCA9450) += pca9450.o
 obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
drivers/power/pmic/mp5416.c new file +98 -0
new file mode 100644
index 0000000..458c4df
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier:      GPL-2.0+
+/*
+ * Copyright 2020 Gateworks Corporation
+ */
+#include <common.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <log.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/mp5416.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+	/* buck */
+	{ .prefix = "b", .driver = MP6416_REGULATOR_DRIVER },
+	/* ldo */
+	{ .prefix = "l", .driver = MP6416_REGULATOR_DRIVER },
+	{ },
+};
+
+static int mp5416_reg_count(struct udevice *dev)
+{
+	return MP5416_NUM_OF_REGS - 1;
+}
+
+static int mp5416_write(struct udevice *dev, uint reg, const uint8_t *buff,
+			int len)
+{
+	if (dm_i2c_write(dev, reg, buff, len)) {
+		pr_err("write error to device: %p register: %#x!", dev, reg);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int mp5416_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+	if (dm_i2c_read(dev, reg, buff, len)) {
+		pr_err("read error from device: %p register: %#x!", dev, reg);
+		return -EIO;
+	}
+
+	return 0;
+}
+
+static int mp5416_bind(struct udevice *dev)
+{
+	int children;
+	ofnode regulators_node;
+
+	debug("%s %s\n", __func__, dev->name);
+	regulators_node = dev_read_subnode(dev, "regulators");
+	if (!ofnode_valid(regulators_node)) {
+		debug("%s: %s regulators subnode not found!\n", __func__,
+		      dev->name);
+		return -ENXIO;
+	}
+
+	debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
+
+	children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+	if (!children)
+		debug("%s: %s - no child found\n", __func__, dev->name);
+
+	/* Always return success for this device */
+	return 0;
+}
+
+static int mp5416_probe(struct udevice *dev)
+{
+	debug("%s %s\n", __func__, dev->name);
+
+	return 0;
+}
+
+static struct dm_pmic_ops mp5416_ops = {
+	.reg_count = mp5416_reg_count,
+	.read = mp5416_read,
+	.write = mp5416_write,
+};
+
+static const struct udevice_id mp5416_ids[] = {
+	{ .compatible = "mps,mp5416", },
+	{ }
+};
+
+U_BOOT_DRIVER(pmic_mp5416) = {
+	.name = "mp5416 pmic",
+	.id = UCLASS_PMIC,
+	.of_match = mp5416_ids,
+	.bind = mp5416_bind,
+	.probe = mp5416_probe,
+	.ops = &mp5416_ops,
+};
include/power/mp5416.h new file +29 -0
new file mode 100644
index 0000000..dc096fe
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Copyright (C) 2020 Gateworks Corporation */
+
+#ifndef MP5416_H_
+#define MP5416_H_
+
+#define MP6416_REGULATOR_DRIVER "mp5416_regulator"
+
+enum {
+	MP5416_CTL0		= 0x00,
+	MP5416_CTL1		= 0x01,
+	MP5416_CTL2		= 0x02,
+	MP5416_ILIMIT		= 0x03,
+	MP5416_VSET_SW1		= 0x04,
+	MP5416_VSET_SW2		= 0x05,
+	MP5416_VSET_SW3		= 0x06,
+	MP5416_VSET_SW4		= 0x07,
+	MP5416_VSET_LDO2	= 0x08,
+	MP5416_VSET_LDO3	= 0x09,
+	MP5416_VSET_LDO4	= 0x0a,
+	MP5416_VSET_LDO5	= 0x0b,
+	MP5416_STATUS1		= 0x0d,
+	MP5416_STATUS2		= 0x0e,
+	MP5416_STATUS3		= 0x0f,
+	MP5416_ID2		= 0x11,
+	MP5416_NUM_OF_REGS	= 0x12,
+};
+
+#define MP5416_VSET_EN          BIT(7)

include/power/mp5416.h line 39

Quoted 10 lines
include/power/mp5416.h new file +10 -0
+#define MP5416_VSET_SW1_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
+#define MP5416_VSET_SW2_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_SW3_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
+#define MP5416_VSET_SW4_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_LDO_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_LDO_SVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_SW1_SVAL(x) (((x) - 600000) / 12500)
+#define MP5416_VSET_SW2_SVAL(x) (((x) - 800000) / 25000)
+#define MP5416_VSET_SW3_SVAL(x) (((x) - 600000) / 12500)
+#define MP5416_VSET_SW4_SVAL(x) (((x) - 800000) / 25000)

I didn't find where above macros are used, except MP5416_VSET_SW3_SVAL().

Best Regards,
Jaehoon Chung

Quoted 3 lines
include/power/mp5416.h new file +2 -0
+
+#endif
author
#12 lore raw

PATCH 2/4 power: pmic: add driver for Monolithic Power mp5416

Quoted 197 lines · Jaehoon Chung
Quoted 195 lines · Tim Harvey

This adds basic register access and child regulator binding for the Monolithic MP5416 Power Management IC which integrates four DC/DC switching converters and five LDO regulators.

---
 drivers/power/pmic/Kconfig  | 15 +++++++
 drivers/power/pmic/Makefile |  1 +
 drivers/power/pmic/mp5416.c | 98 +++++++++++++++++++++++++++++++++++++++++++++
 include/power/mp5416.h      | 41 +++++++++++++++++++
 4 files changed, 155 insertions(+)
 create mode 100644 drivers/power/pmic/mp5416.c
 create mode 100644 include/power/mp5416.h
drivers/power/pmic/Kconfig +15 -0
index 7d51510..583fd3d 100644
@@ -91,6 +91,21 @@ config DM_PMIC_FAN53555
        The driver implements read/write operations for use with the FAN53555
        regulator driver and binds the regulator driver to its node.
 
+config DM_PMIC_MP5416
+     bool "Enable Driver Model for PMIC MP5416"
+     depends on DM_PMIC
+     help
+       This config enables implementation of driver-model pmic uclass features
+       for PMIC MP5416. The driver implements read/write operations.
+
+config SPL_DM_PMIC_MP5416
+     bool "Enable Driver Model for PMIC MP5416 in SPL stage"
+     depends on DM_PMIC
+     help
+       This config enables implementation of driver-model pmic uclass
+       features for PMIC MP5416. The driver implements read/write
+       operations.
+
 config DM_PMIC_PCA9450
      bool "Enable Driver Model for PMIC PCA9450"
      depends on DM_PMIC
drivers/power/pmic/Makefile +1 -0
index 9cd6c37..2b2a6dd 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DM_PMIC_MAX77686) += max77686.o
 obj-$(CONFIG_DM_PMIC_MAX8998) += max8998.o
 obj-$(CONFIG_DM_PMIC_MC34708) += mc34708.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_BD71837) += bd71837.o
+obj-$(CONFIG_$(SPL_)DM_PMIC_MP5416) += mp5416.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PFUZE100) += pfuze100.o
 obj-$(CONFIG_$(SPL_)DM_PMIC_PCA9450) += pca9450.o
 obj-$(CONFIG_PMIC_S2MPS11) += s2mps11.o
drivers/power/pmic/mp5416.c new file +98 -0
new file mode 100644
index 0000000..458c4df
@@ -0,0 +1,98 @@
+// SPDX-License-Identifier:      GPL-2.0+
+/*
+ * Copyright 2020 Gateworks Corporation
+ */
+#include <common.h>
+#include <errno.h>
+#include <dm.h>
+#include <i2c.h>
+#include <log.h>
+#include <power/pmic.h>
+#include <power/regulator.h>
+#include <power/mp5416.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+static const struct pmic_child_info pmic_children_info[] = {
+     /* buck */
+     { .prefix = "b", .driver = MP6416_REGULATOR_DRIVER },
+     /* ldo */
+     { .prefix = "l", .driver = MP6416_REGULATOR_DRIVER },
+     { },
+};
+
+static int mp5416_reg_count(struct udevice *dev)
+{
+     return MP5416_NUM_OF_REGS - 1;
+}
+
+static int mp5416_write(struct udevice *dev, uint reg, const uint8_t *buff,
+                     int len)
+{
+     if (dm_i2c_write(dev, reg, buff, len)) {
+             pr_err("write error to device: %p register: %#x!", dev, reg);
+             return -EIO;
+     }
+
+     return 0;
+}
+
+static int mp5416_read(struct udevice *dev, uint reg, uint8_t *buff, int len)
+{
+     if (dm_i2c_read(dev, reg, buff, len)) {
+             pr_err("read error from device: %p register: %#x!", dev, reg);
+             return -EIO;
+     }
+
+     return 0;
+}
+
+static int mp5416_bind(struct udevice *dev)
+{
+     int children;
+     ofnode regulators_node;
+
+     debug("%s %s\n", __func__, dev->name);
+     regulators_node = dev_read_subnode(dev, "regulators");
+     if (!ofnode_valid(regulators_node)) {
+             debug("%s: %s regulators subnode not found!\n", __func__,
+                   dev->name);
+             return -ENXIO;
+     }
+
+     debug("%s: '%s' - found regulators subnode\n", __func__, dev->name);
+
+     children = pmic_bind_children(dev, regulators_node, pmic_children_info);
+     if (!children)
+             debug("%s: %s - no child found\n", __func__, dev->name);
+
+     /* Always return success for this device */
+     return 0;
+}
+
+static int mp5416_probe(struct udevice *dev)
+{
+     debug("%s %s\n", __func__, dev->name);
+
+     return 0;
+}
+
+static struct dm_pmic_ops mp5416_ops = {
+     .reg_count = mp5416_reg_count,
+     .read = mp5416_read,
+     .write = mp5416_write,
+};
+
+static const struct udevice_id mp5416_ids[] = {
+     { .compatible = "mps,mp5416", },
+     { }
+};
+
+U_BOOT_DRIVER(pmic_mp5416) = {
+     .name = "mp5416 pmic",
+     .id = UCLASS_PMIC,
+     .of_match = mp5416_ids,
+     .bind = mp5416_bind,
+     .probe = mp5416_probe,
+     .ops = &mp5416_ops,
+};
include/power/mp5416.h new file +33 -0
new file mode 100644
index 0000000..dc096fe
@@ -0,0 +1,41 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Copyright (C) 2020 Gateworks Corporation */
+
+#ifndef MP5416_H_
+#define MP5416_H_
+
+#define MP6416_REGULATOR_DRIVER "mp5416_regulator"
+
+enum {
+     MP5416_CTL0             = 0x00,
+     MP5416_CTL1             = 0x01,
+     MP5416_CTL2             = 0x02,
+     MP5416_ILIMIT           = 0x03,
+     MP5416_VSET_SW1         = 0x04,
+     MP5416_VSET_SW2         = 0x05,
+     MP5416_VSET_SW3         = 0x06,
+     MP5416_VSET_SW4         = 0x07,
+     MP5416_VSET_LDO2        = 0x08,
+     MP5416_VSET_LDO3        = 0x09,
+     MP5416_VSET_LDO4        = 0x0a,
+     MP5416_VSET_LDO5        = 0x0b,
+     MP5416_STATUS1          = 0x0d,
+     MP5416_STATUS2          = 0x0e,
+     MP5416_STATUS3          = 0x0f,
+     MP5416_ID2              = 0x11,
+     MP5416_NUM_OF_REGS      = 0x12,
+};
+
+#define MP5416_VSET_EN          BIT(7)
+#define MP5416_VSET_SW1_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
+#define MP5416_VSET_SW2_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_SW3_GVAL(x) ((((x) & 0x7f) * 12500) + 600000)
+#define MP5416_VSET_SW4_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
Quoted 9 lines

include/power/mp5416.h line 39

Quoted 6 lines
include/power/mp5416.h new file +6 -0
+#define MP5416_VSET_LDO_GVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_LDO_SVAL(x) ((((x) & 0x7f) * 25000) + 800000)
+#define MP5416_VSET_SW1_SVAL(x) (((x) - 600000) / 12500)
+#define MP5416_VSET_SW2_SVAL(x) (((x) - 800000) / 25000)
+#define MP5416_VSET_SW3_SVAL(x) (((x) - 600000) / 12500)
+#define MP5416_VSET_SW4_SVAL(x) (((x) - 800000) / 25000)

I didn't find where above macros are used, except MP5416_VSET_SW3_SVAL().

Jaehoon,

Thanks for the review!

Correct, the venice board support only requires MP5416_VSET_SW3_SVAL currently but I figured if I needed to go to the trouble of creating a pmic driver I would expose all the functionality for future users. Is this not the right thing to do?

Best regards,

Tim

author
#13 lore raw

PATCH 3/4 arm: dts: imx8mm: add Gateworks i.MX8 Mini Dev kits

In reply to Tim Harvey

Add Gateworks i.MX 8M Mini Development kits from Mainline Linux

---
 arch/arm/dts/Makefile                    |   4 +
 arch/arm/dts/imx8mm-venice-gw700x.dtsi   | 495 +++++++++++++++++++++++++++++++
 arch/arm/dts/imx8mm-venice-gw71xx-0x.dts |  19 ++
 arch/arm/dts/imx8mm-venice-gw71xx.dtsi   | 186 ++++++++++++
 arch/arm/dts/imx8mm-venice-gw72xx-0x.dts |  20 ++
 arch/arm/dts/imx8mm-venice-gw72xx.dtsi   | 311 +++++++++++++++++++
 arch/arm/dts/imx8mm-venice-gw73xx-0x.dts |  19 ++
 arch/arm/dts/imx8mm-venice-gw73xx.dtsi   | 362 ++++++++++++++++++++++
 8 files changed, 1416 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm-venice-gw700x.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx-0x.dts
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx.dtsi
arch/arm/dts/Makefile +4 -0
index fd47e40..a0acf24 100644
@@ -772,6 +772,10 @@ dtb-$(CONFIG_ARCH_IMX8) += \
 
 dtb-$(CONFIG_ARCH_IMX8M) += \
 	imx8mm-evk.dtb \
+	imx8mm-venice.dtb \
+	imx8mm-venice-gw71xx-0x.dtb \
+	imx8mm-venice-gw72xx-0x.dtb \
+	imx8mm-venice-gw73xx-0x.dtb \
 	imx8mm-verdin.dtb \
 	phycore-imx8mm.dtb \
 	imx8mn-ddr4-evk.dtb \
arch/arm/dts/imx8mm-venice-gw700x.dtsi new file +495 -0

495 lines not on this page · raw message

arch/arm/dts/imx8mm-venice-gw71xx-0x.dts new file +19 -0
new file mode 100644
index 0000000..3f88c4a
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2020 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx8mm.dtsi"
+#include "imx8mm-venice-gw700x.dtsi"
+#include "imx8mm-venice-gw71xx.dtsi"
+
+/ {
+	model = "Gateworks Venice GW71xx-0x i.MX8MM Development Kit";
+	compatible = "gw,imx8mm-gw71xx-0x", "fsl,imx8mm";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+};
arch/arm/dts/imx8mm-venice-gw71xx.dtsi new file +186 -0

186 lines not on this page · raw message

arch/arm/dts/imx8mm-venice-gw72xx-0x.dts new file +20 -0
new file mode 100644
index 0000000..b1e7540
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2020 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx8mm.dtsi"
+#include "imx8mm-venice-gw700x.dtsi"
+#include "imx8mm-venice-gw72xx.dtsi"
+
+/ {
+	model = "Gateworks Venice GW72xx-0x i.MX8MM Development Kit";
+	compatible = "gw,imx8mm-gw72xx-0x", "fsl,imx8mm";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+};
+
arch/arm/dts/imx8mm-venice-gw72xx.dtsi new file +311 -0

311 lines not on this page · raw message

arch/arm/dts/imx8mm-venice-gw73xx-0x.dts new file +19 -0
new file mode 100644
index 0000000..6905437
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright 2020 Gateworks Corporation
+ */
+
+/dts-v1/;
+
+#include "imx8mm.dtsi"
+#include "imx8mm-venice-gw700x.dtsi"
+#include "imx8mm-venice-gw73xx.dtsi"
+
+/ {
+	model = "Gateworks Venice GW73xx-0x i.MX8MM Development Kit";
+	compatible = "gw,imx8mm-gw73xx-0x", "fsl,imx8mm";
+
+	chosen {
+		stdout-path = &uart2;
+	};
+};
arch/arm/dts/imx8mm-venice-gw73xx.dtsi new file +362 -0

362 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#14 lore raw

PATCH 4/4 board: gateworks: imx8mm: Add Gateworks Venice board support

In reply to Tim Harvey

Add initial support for Gateworks Venice product family based on the i.MX 8M Mini SoC

---
 arch/arm/dts/imx8mm-venice-gw700x-u-boot.dtsi    |  105 +
 arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi |    5 +
 arch/arm/dts/imx8mm-venice-u-boot.dtsi           |  103 +
 arch/arm/dts/imx8mm-venice.dts                   |  152 ++
 arch/arm/mach-imx/imx8m/Kconfig                  |    7 +
 board/gateworks/venice/Kconfig                   |   13 +
 board/gateworks/venice/MAINTAINERS               |    7 +
 board/gateworks/venice/Makefile                  |   12 +
 board/gateworks/venice/README                    |   34 +
 board/gateworks/venice/gsc.c                     |  687 ++++++
 board/gateworks/venice/gsc.h                     |   54 +
 board/gateworks/venice/imx8mm_venice.c           |  133 ++
 board/gateworks/venice/lpddr4_timing.c           | 2505 ++++++++++++++++++++++
 board/gateworks/venice/lpddr4_timing.h           |   12 +
 board/gateworks/venice/spl.c                     |  187 ++
 configs/imx8mm_venice_defconfig                  |  113 +
 include/configs/imx8mm_venice.h                  |  125 ++
 19 files changed, 4264 insertions(+)
 create mode 100644 arch/arm/dts/imx8mm-venice-gw700x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice-u-boot.dtsi
 create mode 100644 arch/arm/dts/imx8mm-venice.dts
 create mode 100644 board/gateworks/venice/Kconfig
 create mode 100644 board/gateworks/venice/MAINTAINERS
 create mode 100644 board/gateworks/venice/Makefile
 create mode 100644 board/gateworks/venice/README
 create mode 100644 board/gateworks/venice/gsc.c
 create mode 100644 board/gateworks/venice/gsc.h
 create mode 100644 board/gateworks/venice/imx8mm_venice.c
 create mode 100644 board/gateworks/venice/lpddr4_timing.c
 create mode 100644 board/gateworks/venice/lpddr4_timing.h
 create mode 100644 board/gateworks/venice/spl.c
 create mode 100644 configs/imx8mm_venice_defconfig
 create mode 100644 include/configs/imx8mm_venice.h
arch/arm/dts/imx8mm-venice-gw700x-u-boot.dtsi new file +105 -0
new file mode 100644
index 0000000..a4487e2
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+
+&{/soc at 0} {
+	u-boot,dm-pre-reloc;
+	u-boot,dm-spl;
+};
+
+&clk {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+	/delete-property/ assigned-clocks;
+	/delete-property/ assigned-clock-parents;
+	/delete-property/ assigned-clock-rates;
+};
+
+&osc_24m {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+};
+
+&aips1 {
+	u-boot,dm-spl;
+	u-boot,dm-pre-reloc;
+};
+
+&aips2 {
+	u-boot,dm-spl;
+};
+
+&aips3 {
+	u-boot,dm-spl;
+};
+
+&iomuxc {
+	u-boot,dm-spl;
+};
+
+&gpio1 {
+	u-boot,dm-spl;
+};
+
+&gpio2 {
+	u-boot,dm-spl;
+};
+
+&gpio3 {
+	u-boot,dm-spl;
+};
+
+&gpio4 {
+	u-boot,dm-spl;
+};
+
+&gpio5 {
+	u-boot,dm-spl;
+};
+
+&uart2 {
+	u-boot,dm-spl;
+};
+
+&pinctrl_uart2 {
+	u-boot,dm-spl;
+};
+
+&usdhc3 {
+	u-boot,dm-spl;
+};
+
+&pinctrl_usdhc3 {
+	u-boot,dm-spl;
+};
+
+&i2c1 {
+	u-boot,dm-spl;
+};
+
+&pinctrl_i2c1 {
+	u-boot,dm-spl;
+};
+
+&i2c2 {
+	u-boot,dm-spl;
+};
+
+&pinctrl_i2c2 {
+	u-boot,dm-spl;
+};
+
+&fec1 {
+	phy-reset-gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
+	phy-reset-duration = <1>;
+	phy-reset-post-delay = <1>;
+};
+
+&{/soc at 0/bus at 30800000/i2c at 30a20000/pmic at 69} {
+	u-boot,dm-spl;
+};
+
+&{/soc at 0/bus at 30800000/i2c at 30a20000/pmic at 69/regulators} {
+	u-boot,dm-spl;
+};
arch/arm/dts/imx8mm-venice-gw71xx-0x-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000..f5d52c2
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+#include "imx8mm-venice-gw700x-u-boot.dtsi"
arch/arm/dts/imx8mm-venice-gw72xx-0x-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000..f5d52c2
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+#include "imx8mm-venice-gw700x-u-boot.dtsi"
arch/arm/dts/imx8mm-venice-gw73xx-0x-u-boot.dtsi new file +5 -0
new file mode 100644
index 0000000..f5d52c2
@@ -0,0 +1,5 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright 2021 Gateworks Corporation
+ */
+#include "imx8mm-venice-gw700x-u-boot.dtsi"
arch/arm/dts/imx8mm-venice-u-boot.dtsi new file +103 -0

103 lines not on this page · raw message

arch/arm/dts/imx8mm-venice.dts new file +152 -0

152 lines not on this page · raw message

arch/arm/mach-imx/imx8m/Kconfig +7 -0
index 8615dc3..b9c38cd 100644
@@ -43,6 +43,12 @@ config TARGET_IMX8MM_EVK
 	select SUPPORT_SPL
 	select IMX8M_LPDDR4
 
+config TARGET_IMX8MM_VENICE
+	bool "Support Gateworks Venice iMX8M Mini module"
+	select IMX8MM
+	select SUPPORT_SPL
+	select IMX8M_LPDDR4
+
 config TARGET_IMX8MN_EVK
 	bool "imx8mn DDR4 EVK board"
 	select IMX8MN
@@ -83,6 +89,7 @@ source "board/freescale/imx8mq_evk/Kconfig"
 source "board/freescale/imx8mm_evk/Kconfig"
 source "board/freescale/imx8mn_evk/Kconfig"
 source "board/freescale/imx8mp_evk/Kconfig"
+source "board/gateworks/venice/Kconfig"
 source "board/google/imx8mq_phanbell/Kconfig"
 source "board/technexion/pico-imx8mq/Kconfig"
 source "board/toradex/verdin-imx8mm/Kconfig"
board/gateworks/venice/Kconfig new file +13 -0
new file mode 100644
index 0000000..e11798f
@@ -0,0 +1,13 @@
+if TARGET_IMX8MM_VENICE
+
+config SYS_BOARD
+	default "venice"
+
+config SYS_VENDOR
+	default "gateworks"
+
+config SYS_CONFIG_NAME
+	default "imx8mm_venice"
+
+endif
+
board/gateworks/venice/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000..07b9e2a
@@ -0,0 +1,7 @@
+i.MX8MM Venice
+M:	Tim Harvey <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/imx8mm-venice*
+F:	board/gateworks/venice/
+F:	include/configs/venice.h
+F:	configs/imx8mm_venice_defconfig
board/gateworks/venice/Makefile new file +12 -0
new file mode 100644
index 0000000..08f5c62
@@ -0,0 +1,12 @@
+#
+# Copyright 2021 Gateworks Corporation
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y += imx8mm_venice.o gsc.o
+
+ifdef CONFIG_SPL_BUILD
+obj-y += spl.o
+obj-$(CONFIG_IMX8M_LPDDR4) += lpddr4_timing.o
+endif
board/gateworks/venice/README new file +34 -0
new file mode 100644
index 0000000..6a0ab1e
@@ -0,0 +1,34 @@
+U-Boot for the Gateworks i.MX8M Mini Venice Development Kit boards
+
+Quick Start
+===========
+- Build the ARM Trusted firmware binary
+- Get ddr firmware
+- Build U-Boot
+- Flash to eMMC
+- Boot
+
+Get and Build the ARM Trusted firmware
+======================================
+$ git clone https://source.codeaurora.org/external/imx/imx-atf
+$ git checkout imx_5.4.47_2.2.0
+$ make PLAT=imx8mm CROSS_COMPILE=aarch64-linux-gnu- bl31
+$ cp build/imx8mm/release/bl31.bin .
+
+Get the DDR Firmware
+====================
+$ wget https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.9.bin
+$ chmod +x firmware-imx-8.9.bin
+$ ./firmware-imx-8.9.bin
+$ cp firmware-imx-8.9/firmware/ddr/synopsys/lpddr4*.bin .
+
+Build U-Boot
+============
+$ make imx8mm_venice_defconfig
+$ make flash.bin CROSS_COMPILE=aarch64-linux-gnu- ATF_LOAD_ADDR=0x920000
+
+Update eMMC
+===========
+=> tftpboot $loadaddr flash.bin
+=> setexpr blkcnt $filesize + 0x1ff && setexpr blkcnt $blkcnt / 0x200
+=> mmc dev 2 && mmc write $loadaddr 0x42 $blkcnt
board/gateworks/venice/gsc.c new file +687 -0

687 lines not on this page · raw message

board/gateworks/venice/gsc.h new file +54 -0

54 lines not on this page · raw message

board/gateworks/venice/imx8mm_venice.c new file +133 -0

133 lines not on this page · raw message

board/gateworks/venice/lpddr4_timing.c new file +2505 -0

1,666 lines not on this page · raw message

board/gateworks/venice/lpddr4_timing.h new file +12 -0
new file mode 100644
index 0000000..94445f8

Lines of this file are not shown. View the raw message.

board/gateworks/venice/spl.c new file +187 -0

187 lines not on this page · raw message

configs/imx8mm_venice_defconfig new file +113 -0

113 lines not on this page · raw message

include/configs/imx8mm_venice.h new file +125 -0

125 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.7.4

Part of the diff is not shown here. View the raw message.