diff mbox

[U-Boot,3/3] arm: mx6: cm-fx6: modify device tree for old revisions of utilite

Message ID 1441209920-10583-4-git-send-email-nikita@compulab.co.il
State Superseded
Delegated to: Stefano Babic
Headers show

Commit Message

Nikita Kiryanov Sept. 2, 2015, 4:05 p.m. UTC
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>
---
 board/compulab/cm_fx6/cm_fx6.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Igor Grinberg Sept. 3, 2015, 8:57 a.m. UTC | #1
On 09/02/15 19:05, 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>
> ---
>  board/compulab/cm_fx6/cm_fx6.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
> index 572111d..c8e980d 100644
> --- a/board/compulab/cm_fx6/cm_fx6.c
> +++ b/board/compulab/cm_fx6/cm_fx6.c
> @@ -582,6 +582,10 @@ int cm_fx6_setup_ecspi(void) { return 0; }
>  #ifdef CONFIG_OF_BOARD_SETUP
>  int ft_board_setup(void *blob, bd_t *bd)
>  {
> +	u32 baseboard_rev;
> +	int nodeoffset;
> +	const char *usdhc3_path = "/soc/aips-bus@02100000/usdhc@02198000/";

I would really like to see this path discovered dynamically...
Is it possible?
If not, then may be define?

> +	char *baseboard_name;
>  	uint8_t enetaddr[6];
>  
>  	/* MAC addr */
> @@ -596,6 +600,18 @@ int ft_board_setup(void *blob, bd_t *bd)
>  				     enetaddr, 6, 1);
>  	}
>  
> +	baseboard_name = cl_eeprom_get_product_name(0);

Once you will change the patch 2/3, this will also need to be changed.

> +	baseboard_rev = cl_eeprom_get_board_rev(0);
> +	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
>
diff mbox

Patch

diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 572111d..c8e980d 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -582,6 +582,10 @@  int cm_fx6_setup_ecspi(void) { return 0; }
 #ifdef CONFIG_OF_BOARD_SETUP
 int ft_board_setup(void *blob, bd_t *bd)
 {
+	u32 baseboard_rev;
+	int nodeoffset;
+	const char *usdhc3_path = "/soc/aips-bus@02100000/usdhc@02198000/";
+	char *baseboard_name;
 	uint8_t enetaddr[6];
 
 	/* MAC addr */
@@ -596,6 +600,18 @@  int ft_board_setup(void *blob, bd_t *bd)
 				     enetaddr, 6, 1);
 	}
 
+	baseboard_name = cl_eeprom_get_product_name(0);
+	baseboard_rev = cl_eeprom_get_board_rev(0);
+	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