public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite
@ 2015-09-06  8:48 Nikita Kiryanov
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 1/4] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-06  8:48 UTC (permalink / raw)
  To: u-boot

This series provides a fix necessary for early models of Utilite, a miniature
desktop based on CM-FX6. It implements a dynamic modification to the device tree
that is necessary for mmc boot.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>

Changes in V2:
	- New patch: compulab: eeprom: propagate error value in read_mac_addr()
	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
	- rewrote cl_eeprom_get_product_name() to take a buffer parameter and
	  added documentation
	- #define USDHC3_PATH instead of const variable usdhc3_path
	- Do not update device tree on eeprom read failures in a more explicit
	  way

Nikita Kiryanov (4):
  compulab: eeprom: select i2c bus when querying for board rev
  compulab: eeprom: propagate error value in read_mac_addr()
  compulab: eeprom: add support for obtaining product name
  arm: mx6: cm-fx6: modify device tree for old revisions of utilite

 board/compulab/cm_fx6/cm_fx6.c | 22 +++++++++++++++++++++-
 board/compulab/cm_t35/cm_t35.c |  2 +-
 board/compulab/common/eeprom.c | 40 ++++++++++++++++++++++++++++++++++++----
 board/compulab/common/eeprom.h | 10 ++++++++--
 4 files changed, 66 insertions(+), 8 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 1/4] compulab: eeprom: select i2c bus when querying for board rev
  2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
@ 2015-09-06  8:48 ` Nikita Kiryanov
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr() Nikita Kiryanov
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-06  8:48 UTC (permalink / raw)
  To: u-boot

Add support for selecting which eeprom is queried for board revision by
extending cl_eeprom_get_board_rev() to accept an i2c bus number.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- No changes

 board/compulab/cm_fx6/cm_fx6.c | 2 +-
 board/compulab/cm_t35/cm_t35.c | 2 +-
 board/compulab/common/eeprom.c | 4 ++--
 board/compulab/common/eeprom.h | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 3ad1216..572111d 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -708,7 +708,7 @@ int dram_init(void)
 
 u32 get_board_rev(void)
 {
-	return cl_eeprom_get_board_rev();
+	return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
 }
 
 static struct mxc_serial_platdata cm_fx6_mxc_serial_plat = {
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index 398c573..26c6a81 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -105,7 +105,7 @@ int board_init(void)
  */
 u32 get_board_rev(void)
 {
-	return cl_eeprom_get_board_rev();
+	return cl_eeprom_get_board_rev(CONFIG_SYS_I2C_EEPROM_BUS);
 };
 
 int misc_init_r(void)
diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 77bcea4..aaacd2e 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -121,7 +121,7 @@ static u32 board_rev;
  * Routine: cl_eeprom_get_board_rev
  * Description: read system revision from eeprom
  */
-u32 cl_eeprom_get_board_rev(void)
+u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 {
 	char str[5]; /* Legacy representation can contain at most 4 digits */
 	uint offset = BOARD_REV_OFFSET_LEGACY;
@@ -129,7 +129,7 @@ u32 cl_eeprom_get_board_rev(void)
 	if (board_rev)
 		return board_rev;
 
-	if (cl_eeprom_setup(CONFIG_SYS_I2C_EEPROM_BUS))
+	if (cl_eeprom_setup(eeprom_bus))
 		return 0;
 
 	if (cl_eeprom_layout != LAYOUT_LEGACY)
diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
index 50c6b02..e74c379 100644
--- a/board/compulab/common/eeprom.h
+++ b/board/compulab/common/eeprom.h
@@ -12,13 +12,13 @@
 
 #ifdef CONFIG_SYS_I2C
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
-u32 cl_eeprom_get_board_rev(void);
+u32 cl_eeprom_get_board_rev(uint eeprom_bus);
 #else
 static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
 {
 	return 1;
 }
-static inline u32 cl_eeprom_get_board_rev(void)
+static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 {
 	return 0;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr()
  2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 1/4] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov
@ 2015-09-06  8:48 ` Nikita Kiryanov
  2015-09-06 12:58   ` Igor Grinberg
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name Nikita Kiryanov
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-06  8:48 UTC (permalink / raw)
  To: u-boot

cl_eeprom_read_mac_addr() doesn't differentiate between success case and
inability to access eeprom. Fix this by propagating the return value of
cl_eeprom_setup().

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- New patch

 board/compulab/common/eeprom.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index aaacd2e..9f18a3d 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -105,9 +105,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
 {
 	uint offset;
+	int err;
 
-	if (cl_eeprom_setup(eeprom_bus))
-		return 0;
+	err = cl_eeprom_setup(eeprom_bus);
+	if (err)
+		return err;
 
 	offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
 			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name
  2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 1/4] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr() Nikita Kiryanov
@ 2015-09-06  8:48 ` Nikita Kiryanov
  2015-09-06 13:30   ` Igor Grinberg
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov
  2015-09-13  8:36 ` [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Stefano Babic
  4 siblings, 1 reply; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-06  8:48 UTC (permalink / raw)
  To: u-boot

Introduce cl_eeprom_get_product_name() for obtaining product name
from the eeprom.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
	- Added documentation
	- rewrote cl_eeprom_get_product_name() to take a buffer parameter

 board/compulab/common/eeprom.c | 30 ++++++++++++++++++++++++++++++
 board/compulab/common/eeprom.h |  6 ++++++
 2 files changed, 36 insertions(+)

diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
index 9f18a3d..6304468 100644
--- a/board/compulab/common/eeprom.c
+++ b/board/compulab/common/eeprom.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include "eeprom.h"
 
 #ifndef CONFIG_SYS_I2C_EEPROM_ADDR
 # define CONFIG_SYS_I2C_EEPROM_ADDR	0x50
@@ -25,6 +26,8 @@
 #define BOARD_REV_OFFSET		0
 #define BOARD_REV_OFFSET_LEGACY		6
 #define BOARD_REV_SIZE			2
+#define PRODUCT_NAME_OFFSET		128
+#define PRODUCT_NAME_SIZE		16
 #define MAC_ADDR_OFFSET			4
 #define MAC_ADDR_OFFSET_LEGACY		0
 
@@ -151,3 +154,30 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 
 	return board_rev;
 };
+
+/*
+ * Routine: cl_eeprom_get_board_rev
+ * Description: read system revision from eeprom
+ *
+ * @buf: buffer to store the product name
+ * @eeprom_bus: i2c bus num of the eeprom
+ *
+ * @return: 0 on success, < 0 on failure
+ */
+int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
+{
+	int err;
+
+	if (buf == NULL)
+		return -EINVAL;
+
+	err = cl_eeprom_setup(eeprom_bus);
+	if (err)
+		return err;
+
+	err = cl_eeprom_read(PRODUCT_NAME_OFFSET, buf, PRODUCT_NAME_SIZE);
+	if (!err) /* Protect ourselves from invalid data (unterminated str) */
+		buf[PRODUCT_NAME_SIZE - 1] = '\0';
+
+	return err;
+}
diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
index e74c379..c0b4739 100644
--- a/board/compulab/common/eeprom.h
+++ b/board/compulab/common/eeprom.h
@@ -9,10 +9,12 @@
 
 #ifndef _EEPROM_
 #define _EEPROM_
+#include <errno.h>
 
 #ifdef CONFIG_SYS_I2C
 int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
 u32 cl_eeprom_get_board_rev(uint eeprom_bus);
+int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
 #else
 static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
 {
@@ -22,6 +24,10 @@ static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus)
 {
 	return 0;
 }
+static inline int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
+{
+	return -ENOSYS;
+}
 #endif
 
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite
  2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
                   ` (2 preceding siblings ...)
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name Nikita Kiryanov
@ 2015-09-06  8:48 ` Nikita Kiryanov
  2015-09-06 13:38   ` Igor Grinberg
  2015-09-13  8:36 ` [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Stefano Babic
  4 siblings, 1 reply; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-06  8:48 UTC (permalink / raw)
  To: u-boot

Old revisions of Utilite (a miniature PC based on cm-fx6) do not have
a card detect for mmc, and thus the kernel needs to be told that
there's a persistent storage on usdhc3 to force it to probe the mmc
card.

Check the baseboard revision and modify the device tree accordingly
if needed.

Cc: Stefano Babic <sbabic@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
---
Changes in V2:
	- #define USDHC3_PATH instead of const variable usdhc3_path
	- Do not update device tree on eeprom read failures in a more explicit
	  way

 board/compulab/cm_fx6/cm_fx6.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 572111d..a21e7b0 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -580,9 +580,14 @@ int cm_fx6_setup_ecspi(void) { return 0; }
 #endif
 
 #ifdef CONFIG_OF_BOARD_SETUP
+#define USDHC3_PATH	"/soc/aips-bus at 02100000/usdhc at 02198000/"
 int ft_board_setup(void *blob, bd_t *bd)
 {
+	u32 baseboard_rev;
+	int nodeoffset;
 	uint8_t enetaddr[6];
+	char baseboard_name[16];
+	int err;
 
 	/* MAC addr */
 	if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
@@ -596,6 +601,21 @@ int ft_board_setup(void *blob, bd_t *bd)
 				     enetaddr, 6, 1);
 	}
 
+	baseboard_rev = cl_eeprom_get_board_rev(0);
+	err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);
+	if (err || baseboard_rev == 0)
+		return 0; /* Assume not an early revision SB-FX6m baseboard */
+
+	if (!strncmp("SB-FX6m", baseboard_name, 7) && baseboard_rev <= 120) {
+		fdt_shrink_to_minimum(blob); /* Make room for new properties */
+		nodeoffset = fdt_path_offset(blob, USDHC3_PATH);
+		fdt_delprop(blob, nodeoffset, "cd-gpios");
+		fdt_find_and_setprop(blob, USDHC3_PATH, "non-removable",
+				     NULL, 0, 1);
+		fdt_find_and_setprop(blob, USDHC3_PATH, "keep-power-in-suspend",
+				     NULL, 0, 1);
+	}
+
 	return 0;
 }
 #endif
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr()
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr() Nikita Kiryanov
@ 2015-09-06 12:58   ` Igor Grinberg
  0 siblings, 0 replies; 12+ messages in thread
From: Igor Grinberg @ 2015-09-06 12:58 UTC (permalink / raw)
  To: u-boot

On 09/06/15 11:48, Nikita Kiryanov wrote:
> cl_eeprom_read_mac_addr() doesn't differentiate between success case and
> inability to access eeprom. Fix this by propagating the return value of
> cl_eeprom_setup().
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>

Acked-by: Igor Grinberg <grinberg@compulab.co.il>

> ---
> Changes in V2:
> 	- New patch
> 
>  board/compulab/common/eeprom.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
> index aaacd2e..9f18a3d 100644
> --- a/board/compulab/common/eeprom.c
> +++ b/board/compulab/common/eeprom.c
> @@ -105,9 +105,11 @@ void get_board_serial(struct tag_serialnr *serialnr)
>  int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
>  {
>  	uint offset;
> +	int err;
>  
> -	if (cl_eeprom_setup(eeprom_bus))
> -		return 0;
> +	err = cl_eeprom_setup(eeprom_bus);
> +	if (err)
> +		return err;
>  
>  	offset = (cl_eeprom_layout != LAYOUT_LEGACY) ?
>  			MAC_ADDR_OFFSET : MAC_ADDR_OFFSET_LEGACY;
> 

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name Nikita Kiryanov
@ 2015-09-06 13:30   ` Igor Grinberg
  0 siblings, 0 replies; 12+ messages in thread
From: Igor Grinberg @ 2015-09-06 13:30 UTC (permalink / raw)
  To: u-boot

Hi Nikita,

On 09/06/15 11:48, Nikita Kiryanov wrote:
> Introduce cl_eeprom_get_product_name() for obtaining product name
> from the eeprom.
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> ---
> Changes in V2:
> 	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
> 	- Added documentation
> 	- rewrote cl_eeprom_get_product_name() to take a buffer parameter
> 
>  board/compulab/common/eeprom.c | 30 ++++++++++++++++++++++++++++++
>  board/compulab/common/eeprom.h |  6 ++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/board/compulab/common/eeprom.c b/board/compulab/common/eeprom.c
> index 9f18a3d..6304468 100644
> --- a/board/compulab/common/eeprom.c
> +++ b/board/compulab/common/eeprom.c
> @@ -9,6 +9,7 @@
>  
>  #include <common.h>
>  #include <i2c.h>
> +#include "eeprom.h"
>  
>  #ifndef CONFIG_SYS_I2C_EEPROM_ADDR
>  # define CONFIG_SYS_I2C_EEPROM_ADDR	0x50
> @@ -25,6 +26,8 @@
>  #define BOARD_REV_OFFSET		0
>  #define BOARD_REV_OFFSET_LEGACY		6
>  #define BOARD_REV_SIZE			2
> +#define PRODUCT_NAME_OFFSET		128
> +#define PRODUCT_NAME_SIZE		16
>  #define MAC_ADDR_OFFSET			4
>  #define MAC_ADDR_OFFSET_LEGACY		0

It seems that the time has come to move the above constants out of this file
into the eeprom.h, so they can be used by users of this "lib".
Don't you think?

>  
> @@ -151,3 +154,30 @@ u32 cl_eeprom_get_board_rev(uint eeprom_bus)
>  
>  	return board_rev;
>  };
> +
> +/*
> + * Routine: cl_eeprom_get_board_rev
> + * Description: read system revision from eeprom

Seems like you have a successful copy/paste problem ;-)

> + *
> + * @buf: buffer to store the product name
> + * @eeprom_bus: i2c bus num of the eeprom
> + *
> + * @return: 0 on success, < 0 on failure
> + */
> +int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
> +{
> +	int err;
> +
> +	if (buf == NULL)
> +		return -EINVAL;

I think that this check is not really necessary.
If someone passes NULL instead of buf - let it crash, no?

> +
> +	err = cl_eeprom_setup(eeprom_bus);
> +	if (err)
> +		return err;
> +
> +	err = cl_eeprom_read(PRODUCT_NAME_OFFSET, buf, PRODUCT_NAME_SIZE);
> +	if (!err) /* Protect ourselves from invalid data (unterminated str) */

Why do you need the above check?
I think, you can just write '\0' anyway, no?

> +		buf[PRODUCT_NAME_SIZE - 1] = '\0';
> +
> +	return err;
> +}
> diff --git a/board/compulab/common/eeprom.h b/board/compulab/common/eeprom.h
> index e74c379..c0b4739 100644
> --- a/board/compulab/common/eeprom.h
> +++ b/board/compulab/common/eeprom.h
> @@ -9,10 +9,12 @@
>  
>  #ifndef _EEPROM_
>  #define _EEPROM_
> +#include <errno.h>
>  
>  #ifdef CONFIG_SYS_I2C
>  int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus);
>  u32 cl_eeprom_get_board_rev(uint eeprom_bus);
> +int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus);
>  #else
>  static inline int cl_eeprom_read_mac_addr(uchar *buf, uint eeprom_bus)
>  {
> @@ -22,6 +24,10 @@ static inline u32 cl_eeprom_get_board_rev(uint eeprom_bus)
>  {
>  	return 0;
>  }
> +static inline int cl_eeprom_get_product_name(uchar *buf, uint eeprom_bus)
> +{
> +	return -ENOSYS;
> +}
>  #endif
>  
>  #endif
> 

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov
@ 2015-09-06 13:38   ` Igor Grinberg
  0 siblings, 0 replies; 12+ messages in thread
From: Igor Grinberg @ 2015-09-06 13:38 UTC (permalink / raw)
  To: u-boot

On 09/06/15 11:48, Nikita Kiryanov wrote:
> Old revisions of Utilite (a miniature PC based on cm-fx6) do not have
> a card detect for mmc, and thus the kernel needs to be told that
> there's a persistent storage on usdhc3 to force it to probe the mmc
> card.
> 
> Check the baseboard revision and modify the device tree accordingly
> if needed.
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
> ---
> Changes in V2:
> 	- #define USDHC3_PATH instead of const variable usdhc3_path
> 	- Do not update device tree on eeprom read failures in a more explicit
> 	  way
> 
>  board/compulab/cm_fx6/cm_fx6.c | 20 ++++++++++++++++++++
>  1 file changed, 20 insertions(+)
> 
> diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
> index 572111d..a21e7b0 100644
> --- a/board/compulab/cm_fx6/cm_fx6.c
> +++ b/board/compulab/cm_fx6/cm_fx6.c
> @@ -580,9 +580,14 @@ int cm_fx6_setup_ecspi(void) { return 0; }
>  #endif
>  
>  #ifdef CONFIG_OF_BOARD_SETUP
> +#define USDHC3_PATH	"/soc/aips-bus at 02100000/usdhc at 02198000/"
>  int ft_board_setup(void *blob, bd_t *bd)
>  {
> +	u32 baseboard_rev;
> +	int nodeoffset;
>  	uint8_t enetaddr[6];
> +	char baseboard_name[16];

That would probably have the actual size (macro).

> +	int err;
>  
>  	/* MAC addr */
>  	if (eth_getenv_enetaddr("ethaddr", enetaddr)) {
> @@ -596,6 +601,21 @@ int ft_board_setup(void *blob, bd_t *bd)
>  				     enetaddr, 6, 1);
>  	}
>  
> +	baseboard_rev = cl_eeprom_get_board_rev(0);
> +	err = cl_eeprom_get_product_name((uchar *)baseboard_name, 0);

I would replace the 0 with a define explaining what that is.

> +	if (err || baseboard_rev == 0)
> +		return 0; /* Assume not an early revision SB-FX6m baseboard */
> +
> +	if (!strncmp("SB-FX6m", baseboard_name, 7) && baseboard_rev <= 120) {
> +		fdt_shrink_to_minimum(blob); /* Make room for new properties */
> +		nodeoffset = fdt_path_offset(blob, USDHC3_PATH);
> +		fdt_delprop(blob, nodeoffset, "cd-gpios");
> +		fdt_find_and_setprop(blob, USDHC3_PATH, "non-removable",
> +				     NULL, 0, 1);
> +		fdt_find_and_setprop(blob, USDHC3_PATH, "keep-power-in-suspend",
> +				     NULL, 0, 1);
> +	}
> +
>  	return 0;
>  }
>  #endif
> 

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite
  2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
                   ` (3 preceding siblings ...)
  2015-09-06  8:48 ` [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov
@ 2015-09-13  8:36 ` Stefano Babic
  2015-09-16 10:10   ` Igor Grinberg
  4 siblings, 1 reply; 12+ messages in thread
From: Stefano Babic @ 2015-09-13  8:36 UTC (permalink / raw)
  To: u-boot



On 06/09/2015 10:48, Nikita Kiryanov wrote:
> This series provides a fix necessary for early models of Utilite, a miniature
> desktop based on CM-FX6. It implements a dynamic modification to the device tree
> that is necessary for mmc boot.
> 
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Igor Grinberg <grinberg@compulab.co.il>
> 
> Changes in V2:
> 	- New patch: compulab: eeprom: propagate error value in read_mac_addr()
> 	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
> 	- rewrote cl_eeprom_get_product_name() to take a buffer parameter and
> 	  added documentation
> 	- #define USDHC3_PATH instead of const variable usdhc3_path
> 	- Do not update device tree on eeprom read failures in a more explicit
> 	  way
> 
> Nikita Kiryanov (4):
>   compulab: eeprom: select i2c bus when querying for board rev
>   compulab: eeprom: propagate error value in read_mac_addr()
>   compulab: eeprom: add support for obtaining product name
>   arm: mx6: cm-fx6: modify device tree for old revisions of utilite
> 
>  board/compulab/cm_fx6/cm_fx6.c | 22 +++++++++++++++++++++-
>  board/compulab/cm_t35/cm_t35.c |  2 +-
>  board/compulab/common/eeprom.c | 40 ++++++++++++++++++++++++++++++++++++----
>  board/compulab/common/eeprom.h | 10 ++++++++--
>  4 files changed, 66 insertions(+), 8 deletions(-)
> 


Applied to u-boot-imx, thanks !

Best regards,
Stefano Babic

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite
  2015-09-13  8:36 ` [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Stefano Babic
@ 2015-09-16 10:10   ` Igor Grinberg
  2015-09-16 16:50     ` Nikita Kiryanov
  0 siblings, 1 reply; 12+ messages in thread
From: Igor Grinberg @ 2015-09-16 10:10 UTC (permalink / raw)
  To: u-boot

Hi Stefano,

On 09/13/15 11:36, Stefano Babic wrote:
> 
> 
> On 06/09/2015 10:48, Nikita Kiryanov wrote:
>> This series provides a fix necessary for early models of Utilite, a miniature
>> desktop based on CM-FX6. It implements a dynamic modification to the device tree
>> that is necessary for mmc boot.
>>
>> Cc: Stefano Babic <sbabic@denx.de>
>> Cc: Igor Grinberg <grinberg@compulab.co.il>
>>
>> Changes in V2:
>> 	- New patch: compulab: eeprom: propagate error value in read_mac_addr()
>> 	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
>> 	- rewrote cl_eeprom_get_product_name() to take a buffer parameter and
>> 	  added documentation
>> 	- #define USDHC3_PATH instead of const variable usdhc3_path
>> 	- Do not update device tree on eeprom read failures in a more explicit
>> 	  way
>>
>> Nikita Kiryanov (4):
>>   compulab: eeprom: select i2c bus when querying for board rev
>>   compulab: eeprom: propagate error value in read_mac_addr()
>>   compulab: eeprom: add support for obtaining product name
>>   arm: mx6: cm-fx6: modify device tree for old revisions of utilite
>>
>>  board/compulab/cm_fx6/cm_fx6.c | 22 +++++++++++++++++++++-
>>  board/compulab/cm_t35/cm_t35.c |  2 +-
>>  board/compulab/common/eeprom.c | 40 ++++++++++++++++++++++++++++++++++++----
>>  board/compulab/common/eeprom.h | 10 ++++++++--
>>  4 files changed, 66 insertions(+), 8 deletions(-)
>>
> 
> 
> Applied to u-boot-imx, thanks !

IMO, this was a bit early...
We haven't received any answer from Nikita yet.
I tend to think that he is preparing a newer version.
Nikita?

-- 
Regards,
Igor.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite
  2015-09-16 10:10   ` Igor Grinberg
@ 2015-09-16 16:50     ` Nikita Kiryanov
  2015-09-22  7:52       ` Stefano Babic
  0 siblings, 1 reply; 12+ messages in thread
From: Nikita Kiryanov @ 2015-09-16 16:50 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 16, 2015 at 01:10:45PM +0300, Igor Grinberg wrote:
> Hi Stefano,
> 
> On 09/13/15 11:36, Stefano Babic wrote:
> > 
> > 
> > On 06/09/2015 10:48, Nikita Kiryanov wrote:
> >> This series provides a fix necessary for early models of Utilite, a miniature
> >> desktop based on CM-FX6. It implements a dynamic modification to the device tree
> >> that is necessary for mmc boot.
> >>
> >> Cc: Stefano Babic <sbabic@denx.de>
> >> Cc: Igor Grinberg <grinberg@compulab.co.il>
> >>
> >> Changes in V2:
> >> 	- New patch: compulab: eeprom: propagate error value in read_mac_addr()
> >> 	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
> >> 	- rewrote cl_eeprom_get_product_name() to take a buffer parameter and
> >> 	  added documentation
> >> 	- #define USDHC3_PATH instead of const variable usdhc3_path
> >> 	- Do not update device tree on eeprom read failures in a more explicit
> >> 	  way
> >>
> >> Nikita Kiryanov (4):
> >>   compulab: eeprom: select i2c bus when querying for board rev
> >>   compulab: eeprom: propagate error value in read_mac_addr()
> >>   compulab: eeprom: add support for obtaining product name
> >>   arm: mx6: cm-fx6: modify device tree for old revisions of utilite
> >>
> >>  board/compulab/cm_fx6/cm_fx6.c | 22 +++++++++++++++++++++-
> >>  board/compulab/cm_t35/cm_t35.c |  2 +-
> >>  board/compulab/common/eeprom.c | 40 ++++++++++++++++++++++++++++++++++++----
> >>  board/compulab/common/eeprom.h | 10 ++++++++--
> >>  4 files changed, 66 insertions(+), 8 deletions(-)
> >>
> > 
> > 
> > Applied to u-boot-imx, thanks !
> 
> IMO, this was a bit early...
> We haven't received any answer from Nikita yet.
> I tend to think that he is preparing a newer version.
> Nikita?

Yes, I was planning to submit a new version. Since V2 is already in
mainline though, I guess I'll submit a followup patch.

> 
> -- 
> Regards,
> Igor.
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite
  2015-09-16 16:50     ` Nikita Kiryanov
@ 2015-09-22  7:52       ` Stefano Babic
  0 siblings, 0 replies; 12+ messages in thread
From: Stefano Babic @ 2015-09-22  7:52 UTC (permalink / raw)
  To: u-boot

On 16/09/2015 18:50, Nikita Kiryanov wrote:
> On Wed, Sep 16, 2015 at 01:10:45PM +0300, Igor Grinberg wrote:
>> Hi Stefano,
>>
>> On 09/13/15 11:36, Stefano Babic wrote:
>>>
>>>
>>> On 06/09/2015 10:48, Nikita Kiryanov wrote:
>>>> This series provides a fix necessary for early models of Utilite, a miniature
>>>> desktop based on CM-FX6. It implements a dynamic modification to the device tree
>>>> that is necessary for mmc boot.
>>>>
>>>> Cc: Stefano Babic <sbabic@denx.de>
>>>> Cc: Igor Grinberg <grinberg@compulab.co.il>
>>>>
>>>> Changes in V2:
>>>> 	- New patch: compulab: eeprom: propagate error value in read_mac_addr()
>>>> 	- s/BOARD_PRODUCT_NAME_*/PRODUCT_NAME_*
>>>> 	- rewrote cl_eeprom_get_product_name() to take a buffer parameter and
>>>> 	  added documentation
>>>> 	- #define USDHC3_PATH instead of const variable usdhc3_path
>>>> 	- Do not update device tree on eeprom read failures in a more explicit
>>>> 	  way
>>>>
>>>> Nikita Kiryanov (4):
>>>>   compulab: eeprom: select i2c bus when querying for board rev
>>>>   compulab: eeprom: propagate error value in read_mac_addr()
>>>>   compulab: eeprom: add support for obtaining product name
>>>>   arm: mx6: cm-fx6: modify device tree for old revisions of utilite
>>>>
>>>>  board/compulab/cm_fx6/cm_fx6.c | 22 +++++++++++++++++++++-
>>>>  board/compulab/cm_t35/cm_t35.c |  2 +-
>>>>  board/compulab/common/eeprom.c | 40 ++++++++++++++++++++++++++++++++++++----
>>>>  board/compulab/common/eeprom.h | 10 ++++++++--
>>>>  4 files changed, 66 insertions(+), 8 deletions(-)
>>>>
>>>
>>>
>>> Applied to u-boot-imx, thanks !
>>
>> IMO, this was a bit early...
>> We haven't received any answer from Nikita yet.
>> I tend to think that he is preparing a newer version.
>> Nikita?
> 
> Yes, I was planning to submit a new version. Since V2 is already in
> mainline though, I guess I'll submit a followup patch.

Ok, thanks - I missed that a new version was in preparation, sorry for that.

Regards,
Stefano


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

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-09-22  7:52 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-06  8:48 [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Nikita Kiryanov
2015-09-06  8:48 ` [U-Boot] [PATCH V2 1/4] compulab: eeprom: select i2c bus when querying for board rev Nikita Kiryanov
2015-09-06  8:48 ` [U-Boot] [PATCH V2 2/4] compulab: eeprom: propagate error value in read_mac_addr() Nikita Kiryanov
2015-09-06 12:58   ` Igor Grinberg
2015-09-06  8:48 ` [U-Boot] [PATCH V2 3/4] compulab: eeprom: add support for obtaining product name Nikita Kiryanov
2015-09-06 13:30   ` Igor Grinberg
2015-09-06  8:48 ` [U-Boot] [PATCH V2 4/4] arm: mx6: cm-fx6: modify device tree for old revisions of utilite Nikita Kiryanov
2015-09-06 13:38   ` Igor Grinberg
2015-09-13  8:36 ` [U-Boot] [PATCH V2 0/4] cm-fx6 updates for Utilite Stefano Babic
2015-09-16 10:10   ` Igor Grinberg
2015-09-16 16:50     ` Nikita Kiryanov
2015-09-22  7:52       ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox