mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Re: [PATCH] Fix small typo in common/Kconfig
From: Sascha Hauer @ 2016-09-05  6:27 UTC (permalink / raw)
  To: Sam Van Den Berge; +Cc: barebox
In-Reply-To: <1472760003-5357-1-git-send-email-sam.van.den.berge@telenet.be>

On Thu, Sep 01, 2016 at 10:00:03PM +0200, Sam Van Den Berge wrote:
> Fix small typo frendly -> friendly
> 
> Signed-off-by: Sam Van Den Berge <sam.van.den.berge@telenet.be>
> ---
>  common/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/common/Kconfig b/common/Kconfig
> index 38225eb..636a55a 100644
> --- a/common/Kconfig
> +++ b/common/Kconfig
> @@ -471,7 +471,7 @@ config MENU
>  	select PROCESS_ESCAPE_SEQUENCE
>  	help
>  	  a menu framework that allow us to create list menu to simplify
> -	  barebox and make it more user-frendly
> +	  barebox and make it more user-friendly
>  
>  config PASSWORD
>  	bool
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH] video/edid: Fix edid_to_display_timings error path
From: Sascha Hauer @ 2016-09-05  6:27 UTC (permalink / raw)
  To: Philipp Zabel; +Cc: barebox
In-Reply-To: <1472722119-22874-1-git-send-email-p.zabel@pengutronix.de>

On Thu, Sep 01, 2016 at 11:28:39AM +0200, Philipp Zabel wrote:
> edid_to_display_timings is called in drivers/video/imx-ipu-v3/imx-hdmi.c,
> drivers/video/simple-panel.c, and drivers/video/edid.c with the struct
> display_timings *timings parameter pointing to an embedded struct
> display_timings inside a struct fb_info. The timings pointer is not to
> be freed in the error path.
> 
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/video/edid.c | 1 -
>  1 file changed, 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/video/edid.c b/drivers/video/edid.c
> index 92b59a5..2585264 100644
> --- a/drivers/video/edid.c
> +++ b/drivers/video/edid.c
> @@ -792,7 +792,6 @@ int edid_to_display_timings(struct display_timings *timings, unsigned char *edid
>  
>  	return 0;
>  out:
> -	free(timings);
>  	free(mode);
>  	return ret;
>  }
> -- 
> 2.8.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH] commands: saveenv: exit on invalid option
From: Sascha Hauer @ 2016-09-05  6:25 UTC (permalink / raw)
  To: Enrico Jorns; +Cc: barebox
In-Reply-To: <1472715224-2562-1-git-send-email-ejo@pengutronix.de>

On Thu, Sep 01, 2016 at 09:33:44AM +0200, Enrico Jorns wrote:
> Saveenv should not perform any actions if an invalid parameter was
> given.
> 
> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
> ---
>  commands/saveenv.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/commands/saveenv.c b/commands/saveenv.c
> index 6f210b7..bc1202f 100644
> --- a/commands/saveenv.c
> +++ b/commands/saveenv.c
> @@ -35,6 +35,8 @@ static int do_saveenv(int argc, char *argv[])
>  		case 'z':
>  			envfs_flags |= ENVFS_FLAGS_FORCE_BUILT_IN;
>  			break;
> +		default:
> +			return COMMAND_ERROR_USAGE;
>  		}
>  	}
>  
> -- 
> 2.8.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH v2] rework menu so that it can support multiline titles
From: Sascha Hauer @ 2016-09-05  6:24 UTC (permalink / raw)
  To: Aleksey Kuleshov; +Cc: barebox
In-Reply-To: <1471529103-842-1-git-send-email-rndfax@yandex.ru>

On Thu, Aug 18, 2016 at 05:05:03PM +0300, Aleksey Kuleshov wrote:
> Signed-off-by: Aleksey Kuleshov <rndfax@yandex.ru>
> ---
>  commands/menu.c   | 23 +++++++++++++---
>  common/boot.c     |  8 ++++--
>  common/menu.c     | 81 ++++++++++++++++++++++++++++++++++++++++++++++++-------
>  common/menutree.c |  9 +++++--
>  include/menu.h    |  6 ++++-
>  5 files changed, 108 insertions(+), 19 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/menu.c b/commands/menu.c
> index e1079fd..72db26e 100644
> --- a/commands/menu.c
> +++ b/commands/menu.c
> @@ -22,6 +22,7 @@
>  #include <menu.h>
>  #include <getopt.h>
>  #include <errno.h>
> +#include <libbb.h>
>  #include <linux/err.h>
>  
>  typedef enum {
> @@ -146,9 +147,7 @@ static int do_menu_add(struct cmd_menu *cm)
>  	if (!m->name)
>  		goto free;
>  
> -	m->display = strdup(cm->description);
> -	if (!m->display)
> -		goto free;
> +	menu_add_title(m, strdup(cm->description));
>  
>  	ret = menu_add(m);
>  
> @@ -271,7 +270,23 @@ static int do_menu_list(struct cmd_menu *cm)
>  	}
>  
>  	list_for_each_entry(m, &menus->list, list) {
> -		printf("%s: %s\n", m->name, m->display? m->display : m->name);
> +		printf("%s: ", m->name);
> +		if (m->display_lines) {
> +			static char outstr[256];
> +			int i;
> +
> +			printf("\n");
> +			for (i = 0; i < m->display_lines; i++)
> +				/* Conform to menu rendering logic */
> +				if (IS_ENABLED(CONFIG_SHELL_HUSH)) {
> +					process_escape_sequence(m->display[i], outstr, 256);
> +					printf("\t%s\n", outstr);
> +				} else {
> +					printf("\t%s\n", m->display[i]);
> +				}
> +		} else {
> +			printf("%s\n", m->name);
> +		}
>  		if (is_entry(cm))
>  			print_entries(m);
>  	}
> diff --git a/common/boot.c b/common/boot.c
> index 0e9f27f..bc90502 100644
> --- a/common/boot.c
> +++ b/common/boot.c
> @@ -43,7 +43,7 @@ struct bootentries *bootentries_alloc(void)
>  
>  	if (IS_ENABLED(CONFIG_MENU)) {
>  		bootentries->menu = menu_alloc();
> -		bootentries->menu->display = basprintf("boot");
> +		menu_add_title(bootentries->menu, basprintf("boot"));
>  	}
>  
>  	return bootentries;
> @@ -61,8 +61,12 @@ void bootentries_free(struct bootentries *bootentries)
>  		be->release(be);
>  	}
>  
> -	if (bootentries->menu)
> +	if (bootentries->menu) {
> +		int i;
> +		for (i = 0; i < bootentries->menu->display_lines; i++)
> +			free(bootentries->menu->display[i]);
>  		free(bootentries->menu->display);
> +	}
>  	free(bootentries->menu);
>  	free(bootentries);
>  }
> diff --git a/common/menu.c b/common/menu.c
> index 9819569..64df458 100644
> --- a/common/menu.c
> +++ b/common/menu.c
> @@ -43,10 +43,13 @@ EXPORT_SYMBOL(menu_get_menus);
>  void menu_free(struct menu *m)
>  {
>  	struct menu_entry *me, *tmp;
> +	int i;
>  
>  	if (!m)
>  		return;
>  	free(m->name);
> +	for (i = 0; i < m->display_lines; i++)
> +		free(m->display[i]);
>  	free(m->display);
>  	free(m->auto_display);
>  
> @@ -164,7 +167,7 @@ static void __print_entry(const char *str)
>  static void print_menu_entry(struct menu *m, struct menu_entry *me,
>  			     int selected)
>  {
> -	gotoXY(3, me->num + 1);
> +	gotoXY(3, me->num + m->display_lines);
>  
>  	if (me->type == MENU_ENTRY_BOX) {
>  		if (me->box_state)
> @@ -232,14 +235,12 @@ EXPORT_SYMBOL(menu_set_auto_select);
>  static void print_menu(struct menu *m)
>  {
>  	struct menu_entry *me;
> +	int i;
>  
>  	clear();
> -	gotoXY(2, 1);
> -	if(m->display) {
> -		__print_entry(m->display);
> -	} else {
> -		puts("Menu : ");
> -		puts(m->name);
> +	for (i = 0; i < m->display_lines; i++) {
> +		gotoXY(2, 1 + i);
> +		__print_entry(m->display[i]);
>  	}
>  
>  	list_for_each_entry(me, &m->entries, list) {
> @@ -269,7 +270,7 @@ int menu_show(struct menu *m)
>  
>  	countdown = m->auto_select;
>  	if (m->auto_select >= 0) {
> -		gotoXY(3, m->nb_entries + 2);
> +		gotoXY(3, m->nb_entries + m->display_lines + 1);
>  		if (!m->auto_display) {
>  			printf("Auto Select in");
>  		} else {
> @@ -293,10 +294,10 @@ int menu_show(struct menu *m)
>  		}
>  	}
>  
> -	gotoXY(3, m->nb_entries + 2);
> +	gotoXY(3, m->nb_entries + m->display_lines + 1);
>  	printf("%*c", auto_display_len + 4, ' ');
>  
> -	gotoXY(3, m->selected->num + 1);
> +	gotoXY(3, m->selected->num + m->display_lines);
>  
>  	do {
>  		struct menu_entry *old_selected = m->selected;
> @@ -517,3 +518,63 @@ err_free:
>  	return ERR_PTR(ret);
>  }
>  EXPORT_SYMBOL(menu_add_command_entry);
> +
> +/*
> + * Add title to menu.
> + * Lines are separated by explicit char '\n' or by string "\n".
> + *
> + * @display: NULL or pointer to the string which will be freed in this function.
> + *	If NULL or zero length string is provided, default title will be added.
> + */
> +void menu_add_title(struct menu *m, char *display)
> +{
> +	char *tmp, *src, *dst;
> +	int lines = 1;
> +	int i;
> +
> +	if (!display || !strlen(display)) {
> +		free(display);
> +		display = xasprintf("Menu : %s", m->name ? m->name : "");
> +	}
> +
> +	src = dst = tmp = xstrdup(display);
> +	/* Count lines and separate single string into multiple strings */
> +	while (*src) {
> +		if (*src == '\\') {
> +			if (*(src + 1) == '\\') {
> +				*dst++ = *src++;
> +				*dst++ = *src++;
> +				continue;
> +			}
> +			if (*(src + 1) == 'n') {
> +				*dst = 0;
> +				src += 2;
> +				dst++;
> +				lines++;
> +				continue;
> +			}
> +		}
> +		if (*src == '\n') {
> +			*dst = 0;
> +			src++;
> +			dst++;
> +			lines++;
> +			continue;
> +		}
> +		*dst++ = *src++;
> +	}
> +	*dst = 0;
> +
> +	m->display = xzalloc(sizeof(*m->display) * lines);
> +	m->display_lines = lines;
> +
> +	for (src = tmp, i = 0; i < lines; i++) {
> +		m->display[i] = xstrdup(src);
> +		/* Go to the next line */
> +		src += strlen(src) + 1;
> +	}
> +
> +	free(tmp);
> +	free(display);
> +}
> +EXPORT_SYMBOL(menu_add_title);
> diff --git a/common/menutree.c b/common/menutree.c
> index eb14da0..400d1a6 100644
> --- a/common/menutree.c
> +++ b/common/menutree.c
> @@ -19,6 +19,7 @@
>  #include <shell.h>
>  #include <libfile.h>
>  
> +#include <linux/ctype.h>
>  #include <linux/stat.h>
>  
>  struct menutree {
> @@ -95,6 +96,7 @@ int menutree(const char *path, int toplevel)
>  	glob_t g;
>  	int i;
>  	char *globpath, *display;
> +	size_t size;
>  
>  	menu = menu_alloc();
>  
> @@ -106,14 +108,17 @@ int menutree(const char *path, int toplevel)
>  		goto out;
>  	}
>  
> -	display = read_file_line("%s/title", path);
> +	globpath = basprintf("%s/title", path);
> +	display = read_file(globpath, &size);
> +	free(globpath);
>  	if (!display) {
>  		eprintf("no title found in %s/title\n", path);
>  		ret = -EINVAL;
>  		goto out;
>  	}
>  
> -	menu->display = shell_expand(display);
> +	strim(display);
> +	menu_add_title(menu, shell_expand(display));
>  	free(display);
>  
>  	for (i = 0; i < g.gl_pathc; i++) {
> diff --git a/include/menu.h b/include/menu.h
> index 8b0ffb1..3e704a8 100644
> --- a/include/menu.h
> +++ b/include/menu.h
> @@ -47,7 +47,10 @@ struct menu_entry {
>  
>  struct menu {
>  	char *name;
> -	char *display;
> +	/* Multiline title */
> +	char **display;
> +	/* Number of lines */
> +	int display_lines;
>  
>  	int auto_select;
>  	char *auto_display;
> @@ -88,6 +91,7 @@ int menu_set_selected_entry(struct menu *m, struct menu_entry* me);
>  int menu_set_selected(struct menu *m, int num);
>  int menu_set_auto_select(struct menu *m, int delay);
>  struct menu* menu_get_menus(void);
> +void menu_add_title(struct menu *m, char *display);
>  
>  /*
>   * menu entry functions
> -- 
> 2.8.0.rc3
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* [PATCH] usb: i.MX chipidea: Enable VBUS regulator when needed
From: Sascha Hauer @ 2016-09-05  6:24 UTC (permalink / raw)
  To: Barebox List

We should enable VBUS only in host mode, not unconditionally
during probe(). Fix that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index a799abe..9857fe5 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -150,13 +150,23 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
 
 static int ci_register_role(struct imx_chipidea *ci)
 {
+	int ret;
+
 	if (ci->role_registered)
 		return -EBUSY;
 
 	if (ci->mode == IMX_USB_MODE_HOST) {
 		if (IS_ENABLED(CONFIG_USB_EHCI)) {
 			ci->role_registered = 1;
-			return ehci_register(ci->dev, &ci->data);
+			ret = regulator_enable(ci->vbus);
+			if (ret)
+				return ret;
+
+			ret = ehci_register(ci->dev, &ci->data);
+			if (!ret)
+				return 0;
+
+			regulator_disable(ci->vbus);
 		} else {
 			dev_err(ci->dev, "Host support not available\n");
 			return -ENODEV;
@@ -242,9 +252,8 @@ static int imx_chipidea_probe(struct device_d *dev)
 	}
 
 	ci->vbus = regulator_get(dev, "vbus");
-
-	if (!IS_ERR(ci->vbus))
-		regulator_enable(ci->vbus);
+	if (IS_ERR(ci->vbus))
+		ci->vbus = NULL;
 
 	iores = dev_request_mem_resource(dev, 0);
 	if (IS_ERR(iores))
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] i.MX: scripts: Fix a bug in imx-image
From: Andrey Smirnov @ 2016-09-04 23:40 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

In order to clear a bitmask, "Set" bit has to be '0' and "Mask" bit
'1'. Since "Set" is bit 4 and "Mask" is bit 3 this leaves us with a
overal or-mask of 1 << 3. Orginal code was doing the inverse and setting
bit #4 to '1' bit #3 to '0'.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 scripts/imx/imx-image.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/imx/imx-image.c b/scripts/imx/imx-image.c
index 3f62228..10aa4c1 100644
--- a/scripts/imx/imx-image.c
+++ b/scripts/imx/imx-image.c
@@ -380,7 +380,7 @@ static int write_mem_v2(uint32_t addr, uint32_t val, int width, int set_bits, in
 	if (set_bits)
 		cmd |= 3 << 3;
 	if (clear_bits)
-		cmd |= 2 << 3;
+		cmd |= 1 << 3;
 
 	if (curdcd > MAX_DCD - 3) {
 		fprintf(stderr, "At maximum %d dcd entried are allowed\n", MAX_DCD);
-- 
2.5.5


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] scripts: imx-usb-loader: cleanup DCD v2 processing
From: Alexander Kurz @ 2016-09-02 20:47 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Kurz

Re-Implement the DCD v2 processing.
Processing for the DCD write command went into a separate function enabling
the over-all DCD processing to handle check, nop and unlock commands as well.
The trivial NOP command is supported right away.
Further changes: put in some data consistancy checks and error handling, do
structured member access and proper endianess handling and direct error
messages to stderr.

Signed-off-by: Alexander Kurz <akurz@blala.de>
---
 scripts/imx/imx-usb-loader.c | 125 +++++++++++++++++++++++++++----------------
 scripts/imx/imx.h            |  17 +++++-
 2 files changed, 95 insertions(+), 47 deletions(-)

diff --git a/scripts/imx/imx-usb-loader.c b/scripts/imx/imx-usb-loader.c
index 413def6..b5c1531 100644
--- a/scripts/imx/imx-usb-loader.c
+++ b/scripts/imx/imx-usb-loader.c
@@ -743,7 +743,45 @@ static int sdp_jump_address(unsigned addr)
 	return 0;
 }
 
-static int write_dcd_table_ivt(const struct imx_flash_header_v2 *hdr,
+static int do_dcd_v2_cmd_write(const unsigned char *dcd)
+{
+	int set_bits = 0, clear_bits = 0;
+	int idx, bytes;
+	struct imx_dcd_v2_write *recs = (struct imx_dcd_v2_write *) dcd;
+	int num_rec = (ntohs(recs->length) - 4) /
+		      sizeof(struct imx_dcd_v2_write_rec);
+	printf("DCD write: sub dcd length: 0x%04x, flags: 0x%02x\n",
+		ntohs(recs->length), recs->param);
+
+	if (recs->param & PARAMETER_FLAG_MASK) {
+		if (recs->param & PARAMETER_FLAG_SET)
+			set_bits = 1;
+		else
+			clear_bits = 1;
+	}
+	bytes = recs->param & 7;
+	switch (bytes) {
+	case 1:
+	case 2:
+	case 4:
+		break;
+	default:
+		fprintf(stderr, "ERROR: bad DCD write width %i\n", bytes);
+		return -1;
+	}
+
+	for (idx = 0; idx < num_rec; idx++) {
+		const struct imx_dcd_v2_write_rec *record = &recs->data[idx];
+		int ret = modify_memory(ntohl(record->addr),
+				 ntohl(record->val), bytes,
+				 set_bits, clear_bits);
+		if (ret < 0)
+			return ret;
+	}
+	return 0;
+}
+
+static int process_dcd_table_ivt(const struct imx_flash_header_v2 *hdr,
 			       const unsigned char *file_start, unsigned cnt)
 {
 	unsigned char *dcd_end;
@@ -751,7 +789,7 @@ static int write_dcd_table_ivt(const struct imx_flash_header_v2 *hdr,
 #define cvt_dest_to_src		(((unsigned char *)hdr) - hdr->self)
 	unsigned char* dcd;
 	const unsigned char *file_end = file_start + cnt;
-	int err = 0;
+	struct imx_ivt_header *dcd_hdr;
 
 	if (!hdr->dcd_ptr) {
 		printf("No dcd table in this ivt\n");
@@ -761,65 +799,60 @@ static int write_dcd_table_ivt(const struct imx_flash_header_v2 *hdr,
 	dcd = hdr->dcd_ptr + cvt_dest_to_src;
 
 	if ((dcd < file_start) || ((dcd + 4) > file_end)) {
-		printf("bad dcd_ptr %08x\n", hdr->dcd_ptr);
+		fprintf(stderr, "bad dcd_ptr %08x\n", hdr->dcd_ptr);
 		return -1;
 	}
 
-	m_length = (dcd[1] << 8) + dcd[2];
-
-	printf("main dcd length %x\n", m_length);
-
-	if ((dcd[0] != 0xd2) || (dcd[3] != 0x40)) {
-		printf("Unknown tag\n");
+	dcd_hdr = (struct imx_ivt_header *) dcd;
+	if ((dcd_hdr->tag != TAG_DCD_HEADER) ||
+	    (dcd_hdr->version != DCD_VERSION)) {
+		fprintf(stderr, "Error: Unknown DCD header tag\n");
 		return -1;
 	}
-
+	m_length = ntohs(dcd_hdr->length);
 	dcd_end = dcd + m_length;
-
 	if (dcd_end > file_end) {
-		printf("bad dcd length %08x\n", m_length);
+		fprintf(stderr, "Error: DCD length %08x exceeds EOF\n",
+			m_length);
 		return -1;
 	}
+	printf("main dcd length %x\n", m_length);
 	dcd += 4;
 
 	while (dcd < dcd_end) {
-		unsigned s_length = (dcd[1] << 8) + dcd[2];
-		unsigned char *s_end = dcd + s_length;
-		int set_bits = 0, clear_bits = 0;
-
-		printf("command: 0x%02x sub dcd length: 0x%04x, flags: 0x%02x\n", dcd[0], s_length, dcd[3]);
-
-		if ((dcd[0] != 0xcc)) {
-			printf("Skipping unknown sub tag 0x%02x with len %04x\n", dcd[0], s_length);
-			usleep(50000);
-			dcd += s_length;
-			continue;
-		}
-
-		if (dcd[3] & PARAMETER_FLAG_MASK) {
-			if (dcd[3] & PARAMETER_FLAG_SET)
-				set_bits = 1;
-			else
-				clear_bits = 1;
-		}
-
-		dcd += 4;
-
-		if (s_end > dcd_end) {
-			printf("error s_end(%p) > dcd_end(%p)\n", s_end, dcd_end);
+		int ret = 0;
+		struct imx_ivt_header *cmd_hdr = (struct imx_ivt_header *) dcd;
+		unsigned s_length = ntohs(cmd_hdr->length);
+		if (dcd +  s_length > file_end) {
+			fprintf(stderr, "Error: DCD length %08x exceeds EOF\n",
+				s_length);
 			return -1;
 		}
-
-		while (dcd < s_end) {
-			unsigned addr = (dcd[0] << 24) | (dcd[1] << 16) | (dcd[2] << 8) | dcd[3];
-			unsigned val = (dcd[4] << 24) | (dcd[5] << 16) | (dcd[6] << 8) | dcd[7];
-
-			dcd += 8;
-
-			modify_memory(addr, val, 4, set_bits, clear_bits);
+		switch (cmd_hdr->tag) {
+		case TAG_WRITE:
+			ret = do_dcd_v2_cmd_write(dcd);
+			break;
+		case TAG_CHECK:
+			fprintf(stderr, "DCD check not implemented yet\n");
+			usleep(50000);
+			break;
+		case TAG_UNLOCK:
+			fprintf(stderr, "DCD unlock not implemented yet\n");
+			usleep(50000);
+			break;
+		case TAG_NOP:
+			break;
+		default:
+			fprintf(stderr, "Skipping unknown DCD sub tag 0x%02x "
+				"with len %04x\n", cmd_hdr->tag, s_length);
+			usleep(50000);
+			break;
 		}
+		dcd += s_length;
+		if (ret < 0)
+			return ret;
 	}
-	return err;
+	return 0;
 }
 
 static int get_dcd_range_old(const struct imx_flash_header *hdr,
@@ -984,7 +1017,7 @@ static int perform_dcd(unsigned char *p, const unsigned char *file_start,
 
 		break;
 	case HDR_MX53:
-		ret = write_dcd_table_ivt(hdr, file_start, cnt);
+		ret = process_dcd_table_ivt(hdr, file_start, cnt);
 		hdr->dcd_ptr = 0;
 
 		break;
diff --git a/scripts/imx/imx.h b/scripts/imx/imx.h
index 64ebdce..ae3702c 100644
--- a/scripts/imx/imx.h
+++ b/scripts/imx/imx.h
@@ -36,10 +36,12 @@ struct imx_dcd_rec_v1 {
 #define IVT_VERSION	0x40
 #define TAG_DCD_HEADER	0xd2
 #define DCD_VERSION	0x40
+#define TAG_UNLOCK	0xb2
+#define TAG_NOP		0xc0
 #define TAG_WRITE	0xcc
+#define TAG_CHECK	0xcf
 #define PARAMETER_FLAG_MASK	(1 << 3)
 #define PARAMETER_FLAG_SET	(1 << 4)
-#define TAG_CHECK	0xcf
 
 struct imx_ivt_header {
 	uint8_t tag;
@@ -79,4 +81,17 @@ struct config_data {
 	char *csf;
 };
 
+#define MAX_RECORDS_DCD_V2 1024
+struct imx_dcd_v2_write_rec {
+	uint32_t addr;
+	uint32_t val;
+} __attribute__((packed));
+
+struct imx_dcd_v2_write {
+	uint8_t tag;
+	uint16_t length;
+	uint8_t param;
+	struct imx_dcd_v2_write_rec data[MAX_RECORDS_DCD_V2];
+} __attribute__((packed));
+
 int parse_config(struct config_data *data, const char *filename);
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] mci: mmci: Fix read FIFO handling
From: Michael Olbrich @ 2016-09-02  8:50 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

According to the Linux kernel and the qemu code, the MMCIFIFOCNT contains
the remaining number of words to read, excluding those that are already in
the FIFO. So the current number of bytes in the FIFO is
host_remain - (readl(base + MMCIFIFOCNT) << 2).

Also writing to MMCIDATACTRL will reset the read counter. As a result,
MCI_DATABLOCKEND is never set and read_bytes() waits forever.

With this change, SD-Card support on qemu vexpress works correctly.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
 drivers/mci/mmci.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/mci/mmci.c b/drivers/mci/mmci.c
index 9d1e858917de..7489ee03a13c 100644
--- a/drivers/mci/mmci.c
+++ b/drivers/mci/mmci.c
@@ -212,7 +212,7 @@ static u64 mmci_pio_read(struct mmci_host *host, char *buffer, unsigned int host
 	struct variant_data *variant = host->variant;
 
 	do {
-		int count = readl(base + MMCIFIFOCNT) << 2;
+		int count = host_remain - (readl(base + MMCIFIFOCNT) << 2);
 
 		if (count > host_remain)
 			count = host_remain;
@@ -264,7 +264,6 @@ static int read_bytes(struct mci_host *mci, char *dest, unsigned int blkcount, u
 	dev_dbg(host->hw_dev, "read_bytes: blkcount=%u blksize=%u\n", blkcount, blksize);
 
 	do {
-		mmci_writel(host, MMCIDATACTRL, mmci_readl(host, MMCIDATACTRL));
 		len = mmci_pio_read(host, dest, xfercount);
 		xfercount -= len;
 		dest += len;
-- 
2.9.3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] of_unflatten_dtb(): Check return value with IS_ERR
From: Andrey Smirnov @ 2016-09-01 20:39 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Of_unflatten_dtb returns a ERR_PTR value so checking it against NULL is
incorrect. Fix it in all of the places where this was happening.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/boards/highbank/init.c | 2 +-
 arch/arm/cpu/dtb.c              | 2 +-
 arch/arm/lib/bootm.c            | 2 +-
 arch/mips/boot/dtb.c            | 2 +-
 arch/openrisc/lib/dtb.c         | 2 +-
 common/bootm.c                  | 6 +++++-
 6 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/highbank/init.c b/arch/arm/boards/highbank/init.c
index 1cb02e6..295d475 100644
--- a/arch/arm/boards/highbank/init.c
+++ b/arch/arm/boards/highbank/init.c
@@ -77,7 +77,7 @@ static int highbank_mem_init(void)
 	fdt = IOMEM(FIRMWARE_DTB_BASE);

 	root = of_unflatten_dtb(fdt);
-	if (!root) {
+	if (IS_ERR(root)) {
 		pr_warn("no dtb found at 0x1000 use default configuration\n");
 		fdt = NULL;
 		goto not_found;
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index ae4ff2a..b9390b4 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -48,7 +48,7 @@ static int of_arm_init(void)
 	}

 	root = of_unflatten_dtb(fdt);
-	if (root) {
+	if (!IS_ERR(root)) {
 		of_set_root_node(root);
 		of_fix_tree(root);
 		if (IS_ENABLED(CONFIG_OFDEVICE))
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 0e81a66..7bddacd 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -225,7 +225,7 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)

 	if (IS_BUILTIN(CONFIG_OFTREE)) {
 		data->of_root_node = of_unflatten_dtb(oftree);
-		if (!data->of_root_node) {
+		if (IS_ERR(data->of_root_node)) {
 			pr_err("unable to unflatten devicetree\n");
 			ret = -EINVAL;
 			goto err_free;
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c
index 977c837..e7633a5 100644
--- a/arch/mips/boot/dtb.c
+++ b/arch/mips/boot/dtb.c
@@ -51,7 +51,7 @@ static int of_mips_init(void)
 		return 0;

 	root = of_unflatten_dtb(__dtb_start);
-	if (root) {
+	if (!IS_ERR(root)) {
 		pr_debug("using internal DTB\n");
 		of_set_root_node(root);
 		if (IS_ENABLED(CONFIG_OFDEVICE))
diff --git a/arch/openrisc/lib/dtb.c b/arch/openrisc/lib/dtb.c
index 4f63a77..04bb6d2 100644
--- a/arch/openrisc/lib/dtb.c
+++ b/arch/openrisc/lib/dtb.c
@@ -32,7 +32,7 @@ static int of_openrisc_init(void)
 		return 0;

 	root = of_unflatten_dtb(__dtb_start);
-	if (root) {
+	if (!IS_ERR(root)) {
 		pr_debug("using internal DTB\n");
 		of_set_root_node(root);
 		if (IS_ENABLED(CONFIG_OFDEVICE))
diff --git a/common/bootm.c b/common/bootm.c
index 78d04d5..5984319 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -336,6 +336,9 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address)

 	if (data->os_fit && data->os_fit->oftree) {
 		data->of_root_node = of_unflatten_dtb(data->os_fit->oftree);
+
+		if (IS_ERR(data->of_root_node))
+			data->of_root_node = NULL;
 	} else if (data->oftree_file) {
 		size_t size;

@@ -367,7 +370,8 @@ int bootm_load_devicetree(struct image_data *data, unsigned long load_address)

 		free(oftree);

-		if (!data->of_root_node) {
+		if (IS_ERR(data->of_root_node)) {
+			data->of_root_node = NULL;
 			pr_err("unable to unflatten devicetree\n");
 			return -EINVAL;
 		}
--
2.5.5

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] Fix small typo in common/Kconfig
From: Sam Van Den Berge @ 2016-09-01 20:00 UTC (permalink / raw)
  To: barebox; +Cc: Sam Van Den Berge

Fix small typo frendly -> friendly

Signed-off-by: Sam Van Den Berge <sam.van.den.berge@telenet.be>
---
 common/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/Kconfig b/common/Kconfig
index 38225eb..636a55a 100644
--- a/common/Kconfig
+++ b/common/Kconfig
@@ -471,7 +471,7 @@ config MENU
 	select PROCESS_ESCAPE_SEQUENCE
 	help
 	  a menu framework that allow us to create list menu to simplify
-	  barebox and make it more user-frendly
+	  barebox and make it more user-friendly
 
 config PASSWORD
 	bool
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] video/edid: Fix edid_to_display_timings error path
From: Philipp Zabel @ 2016-09-01  9:28 UTC (permalink / raw)
  To: barebox

edid_to_display_timings is called in drivers/video/imx-ipu-v3/imx-hdmi.c,
drivers/video/simple-panel.c, and drivers/video/edid.c with the struct
display_timings *timings parameter pointing to an embedded struct
display_timings inside a struct fb_info. The timings pointer is not to
be freed in the error path.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/video/edid.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/video/edid.c b/drivers/video/edid.c
index 92b59a5..2585264 100644
--- a/drivers/video/edid.c
+++ b/drivers/video/edid.c
@@ -792,7 +792,6 @@ int edid_to_display_timings(struct display_timings *timings, unsigned char *edid
 
 	return 0;
 out:
-	free(timings);
 	free(mode);
 	return ret;
 }
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] commands: saveenv: exit on invalid option
From: Enrico Jorns @ 2016-09-01  7:33 UTC (permalink / raw)
  To: barebox; +Cc: Enrico Jorns

Saveenv should not perform any actions if an invalid parameter was
given.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 commands/saveenv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/commands/saveenv.c b/commands/saveenv.c
index 6f210b7..bc1202f 100644
--- a/commands/saveenv.c
+++ b/commands/saveenv.c
@@ -35,6 +35,8 @@ static int do_saveenv(int argc, char *argv[])
 		case 'z':
 			envfs_flags |= ENVFS_FLAGS_FORCE_BUILT_IN;
 			break;
+		default:
+			return COMMAND_ERROR_USAGE;
 		}
 	}
 
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: [PATCH v3 6/8] ARM: Add phyCORE-RK3288 SOM support
From: Sascha Hauer @ 2016-09-01  7:31 UTC (permalink / raw)
  To: Wadim Egorov; +Cc: barebox
In-Reply-To: <1472559947-8248-1-git-send-email-w.egorov@phytec.de>

On Tue, Aug 30, 2016 at 02:25:47PM +0200, Wadim Egorov wrote:
> The phyCORE-RK3288 aka PCM-059 is a SoM (System on Module)
> containing a RK3288 SoC. The module can be connected to different
> carrier boards.
> 
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
> Changes since v2:
> - fixed sdmmc/emmc partition layouts
> - renamed automount to automount-mmc to not overwrite the generic automount file
> - removed bootsource file and added it's content to a nv variable
> ---

Applied, thanks

Sascha

>  arch/arm/boards/Makefile                           |   1 +
>  arch/arm/boards/phytec-som-rk3288/Makefile         |   3 +
>  arch/arm/boards/phytec-som-rk3288/board.c          |  31 +++++
>  .../defaultenv-physom-rk3288/boot/emmc             |   6 +
>  .../defaultenv-physom-rk3288/boot/mmc              |   6 +
>  .../defaultenv-physom-rk3288/init/automount-mmc    |   7 +
>  .../defaultenv-physom-rk3288/nv/boot.default       |   1 +
>  arch/arm/boards/phytec-som-rk3288/lowlevel.c       |  44 ++++++
>  arch/arm/dts/Makefile                              |   1 +
>  arch/arm/dts/rk3288-phycore-som.dts                | 148 +++++++++++++++++++++
>  arch/arm/mach-rockchip/Kconfig                     |   7 +
>  images/Makefile.rockchip                           |   4 +
>  12 files changed, 259 insertions(+)
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/Makefile
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/board.c
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/lowlevel.c
>  create mode 100644 arch/arm/dts/rk3288-phycore-som.dts
> 
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 35b636f..23a8dbd 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -96,6 +96,7 @@ obj-$(CONFIG_MACH_PM9G45)			+= pm9g45/
>  obj-$(CONFIG_MACH_QIL_A9260)			+= qil-a926x/
>  obj-$(CONFIG_MACH_QIL_A9G20)			+= qil-a926x/
>  obj-$(CONFIG_MACH_RADXA_ROCK)			+= radxa-rock/
> +obj-$(CONFIG_MACH_PHYTEC_SOM_RK3288)		+= phytec-som-rk3288/
>  obj-$(CONFIG_MACH_REALQ7)			+= datamodul-edm-qmx6/
>  obj-$(CONFIG_MACH_RPI_COMMON)			+= raspberry-pi/
>  obj-$(CONFIG_MACH_SABRELITE)			+= freescale-mx6-sabrelite/
> diff --git a/arch/arm/boards/phytec-som-rk3288/Makefile b/arch/arm/boards/phytec-som-rk3288/Makefile
> new file mode 100644
> index 0000000..6f34c9a
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/Makefile
> @@ -0,0 +1,3 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o
> +bbenv-y += defaultenv-physom-rk3288
> diff --git a/arch/arm/boards/phytec-som-rk3288/board.c b/arch/arm/boards/phytec-som-rk3288/board.c
> new file mode 100644
> index 0000000..8ea6c6c
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/board.c
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
> + * Author: Wadim Egorov <w.egorov@phytec.de>
> + *
> + * Device initialization for the phyCORE-RK3288 SoM
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <envfs.h>
> +
> +static int physom_devices_init(void)
> +{
> +	if (!of_machine_is_compatible("phytec,rk3288-phycore-som"))
> +		return 0;
> +
> +	barebox_set_hostname("pcm059");
> +	defaultenv_append_directory(defaultenv_physom_rk3288);
> +
> +	return 0;
> +}
> +device_initcall(physom_devices_init);
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
> new file mode 100644
> index 0000000..731b07f
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +global.bootm.image=/mnt/emmc/linuximage
> +global.bootm.oftree=/mnt/emmc/oftree
> +
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
> new file mode 100644
> index 0000000..5b19dba
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +global.bootm.image=/mnt/sdmmc/linuximage
> +global.bootm.oftree=/mnt/sdmmc/oftree
> +
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rw rootwait"
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
> new file mode 100644
> index 0000000..8b3f043
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
> @@ -0,0 +1,7 @@
> +#!/bin/sh
> +
> +mkdir -p /mnt/emmc
> +automount -d /mnt/emmc 'mshc0.probe=1 && [ -e /dev/mshc0.0 ] && mount /dev/mshc0.0 /mnt/emmc'
> +
> +mkdir -p /mnt/sdmmc
> +automount -d /mnt/sdmmc 'mshc1.probe=1 && [ -e /dev/mshc1.0 ] && mount /dev/mshc1.0 /mnt/sdmmc'
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
> new file mode 100644
> index 0000000..b4cedfc
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
> @@ -0,0 +1 @@
> +emmc mmc
> diff --git a/arch/arm/boards/phytec-som-rk3288/lowlevel.c b/arch/arm/boards/phytec-som-rk3288/lowlevel.c
> new file mode 100644
> index 0000000..7804a55
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/lowlevel.c
> @@ -0,0 +1,44 @@
> +/*
> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
> + * Author: Wadim Egorov <w.egorov@phytec.de>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <common.h>
> +#include <linux/sizes.h>
> +#include <asm/barebox-arm-head.h>
> +#include <asm/barebox-arm.h>
> +#include <mach/rk3288-regs.h>
> +#include <mach/grf_rk3288.h>
> +#include <mach/hardware.h>
> +#include <debug_ll.h>
> +
> +extern char __dtb_rk3288_phycore_som_start[];
> +
> +ENTRY_FUNCTION(start_rk3288_phycore_som, r0, r1, r2)
> +{
> +	void *fdt;
> +	arm_cpu_lowlevel_init();
> +
> +	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
> +		struct rk3288_grf * const grf = (void *)RK3288_GRF_BASE;
> +		rk_clrsetreg(&grf->gpio4c_iomux,
> +			GPIO4C1_MASK << GPIO4C1_SHIFT |
> +			GPIO4C0_MASK << GPIO4C0_SHIFT,
> +			GPIO4C1_UART0BT_SOUT << GPIO4C1_SHIFT |
> +			GPIO4C0_UART0BT_SIN << GPIO4C0_SHIFT);
> +		INIT_LL();
> +	}
> +
> +	fdt = __dtb_rk3288_phycore_som_start - get_runtime_offset();
> +
> +	barebox_arm_entry(0x0, SZ_1G, fdt);
> +}
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 09bf68e..d1a3fe8 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -54,6 +54,7 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \
>  pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o
>  pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
>  pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
> +pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o
>  pbl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
>  pbl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
>  pbl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
> diff --git a/arch/arm/dts/rk3288-phycore-som.dts b/arch/arm/dts/rk3288-phycore-som.dts
> new file mode 100644
> index 0000000..5410bd1
> --- /dev/null
> +++ b/arch/arm/dts/rk3288-phycore-som.dts
> @@ -0,0 +1,148 @@
> +/*
> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
> + * Author: Wadim Egorov <w.egorov@phytec.de>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +/dts-v1/;
> +
> +#include <arm/rk3288.dtsi>
> +
> +/ {
> +	model = "phycore-rk3288";
> +	compatible = "phytec,rk3288-phycore-som", "rockchip,rk3288";
> +
> +	memory {
> +		reg = <0 0x40000000>;
> +	};
> +
> +	vcc33: fixedregulator@0 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc33";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		startup-delay-us = <100000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
> +
> +	vcc18: fixedregulator@1 {
> +		compatible = "regulator-fixed";
> +		regulator-name = "vcc18";
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
> +
> +	chosen {
> +		stdout-path = &uart0;
> +
> +		environment-emmc {
> +			compatible = "barebox,environment";
> +			device-path = &emmc, "partname:barebox-environment";
> +			status = "disabled";
> +		};
> +
> +		environment-sdmmc {
> +			compatible = "barebox,environment";
> +			device-path = &sdmmc, "partname:barebox-environment";
> +			status = "disabled";
> +		};
> +	};
> +};
> +
> +&pinctrl {
> +	sdmmc {
> +		sdmmc_pwr: sdmmc-pwr {
> +			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
> +		};
> +	};
> +};
> +
> +&i2c0 {
> +	clock-frequency = <400000>;
> +	status = "okay";
> +};
> +
> +&emmc {
> +	broken-cd;
> +	bus-width = <8>;
> +	cap-mmc-highspeed;
> +	disable-wp;
> +	non-removable;
> +	num-slots = <1>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
> +	vmmc-supply = <&vcc33>;
> +	vqmmc-supply = <&vcc18>;
> +	status = "okay";
> +
> +	#size-cells = <1>;
> +	#address-cells = <1>;
> +
> +	partition@8000 {
> +		label = "spl";
> +		reg = <0x8000 0x8000>;
> +	};
> +
> +	partition@20000 {
> +		label = "barebox";
> +		reg = <0x20000 0x80000>;
> +	};
> +
> +	partition@a0000 {
> +		label = "barebox-environment";
> +		reg = <0xa0000 0x20000>;
> +	};
> +};
> +
> +&sdmmc {
> +	bus-width = <4>;
> +	cap-mmc-highspeed;
> +	cap-sd-highspeed;
> +	card-detect-delay = <200>;
> +	disable-wp;
> +	num-slots = <1>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
> +	vmmc-supply = <&vcc33>;
> +	status = "okay";
> +
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	partition@8000 {
> +		label = "spl";
> +		reg = <0x8000 0x8000>;
> +	};
> +
> +	partition@20000 {
> +		label = "barebox";
> +		reg = <0x20000 0x80000>;
> +	};
> +
> +	partition@a0000 {
> +		label = "barebox-environment";
> +		reg = <0xa0000 0x20000>;
> +	};
> +};
> +
> +&uart0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
> +	reg-shift = <2>;
> +	status = "okay";
> +};
> +
> +&uart2 {
> +	status = "okay";
> +};
> diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
> index 71fcbe7..f2fa3c6 100644
> --- a/arch/arm/mach-rockchip/Kconfig
> +++ b/arch/arm/mach-rockchip/Kconfig
> @@ -30,4 +30,11 @@ config MACH_RADXA_ROCK
>  	select MFD_ACT8846
>  	bool "Radxa rock board"
>  
> +config MACH_PHYTEC_SOM_RK3288
> +	depends on ARCH_RK3288
> +	select I2C
> +	bool "RK3288 phyCORE SOM"
> +	help
> +	  Say Y here if you are using a RK3288 based Phytecs SOM
> +
>  endmenu
> diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip
> index 9715b92..3f1ee57 100644
> --- a/images/Makefile.rockchip
> +++ b/images/Makefile.rockchip
> @@ -5,3 +5,7 @@
>  pblx-$(CONFIG_MACH_RADXA_ROCK) += start_radxa_rock
>  FILE_barebox-radxa-rock.img = start_radxa_rock.pblx
>  image-$(CONFIG_MACH_RADXA_ROCK) += barebox-radxa-rock.img
> +
> +pblx-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += start_rk3288_phycore_som
> +FILE_barebox-rk3288-phycore-som.img = start_rk3288_phycore_som.pblx
> +image-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += barebox-rk3288-phycore-som.img
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* [PATCH v3 6/8] ARM: Add phyCORE-RK3288 SOM support
From: Wadim Egorov @ 2016-08-30 12:25 UTC (permalink / raw)
  To: barebox

The phyCORE-RK3288 aka PCM-059 is a SoM (System on Module)
containing a RK3288 SoC. The module can be connected to different
carrier boards.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
---
Changes since v2:
- fixed sdmmc/emmc partition layouts
- renamed automount to automount-mmc to not overwrite the generic automount file
- removed bootsource file and added it's content to a nv variable
---
 arch/arm/boards/Makefile                           |   1 +
 arch/arm/boards/phytec-som-rk3288/Makefile         |   3 +
 arch/arm/boards/phytec-som-rk3288/board.c          |  31 +++++
 .../defaultenv-physom-rk3288/boot/emmc             |   6 +
 .../defaultenv-physom-rk3288/boot/mmc              |   6 +
 .../defaultenv-physom-rk3288/init/automount-mmc    |   7 +
 .../defaultenv-physom-rk3288/nv/boot.default       |   1 +
 arch/arm/boards/phytec-som-rk3288/lowlevel.c       |  44 ++++++
 arch/arm/dts/Makefile                              |   1 +
 arch/arm/dts/rk3288-phycore-som.dts                | 148 +++++++++++++++++++++
 arch/arm/mach-rockchip/Kconfig                     |   7 +
 images/Makefile.rockchip                           |   4 +
 12 files changed, 259 insertions(+)
 create mode 100644 arch/arm/boards/phytec-som-rk3288/Makefile
 create mode 100644 arch/arm/boards/phytec-som-rk3288/board.c
 create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
 create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
 create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
 create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
 create mode 100644 arch/arm/boards/phytec-som-rk3288/lowlevel.c
 create mode 100644 arch/arm/dts/rk3288-phycore-som.dts

diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 35b636f..23a8dbd 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -96,6 +96,7 @@ obj-$(CONFIG_MACH_PM9G45)			+= pm9g45/
 obj-$(CONFIG_MACH_QIL_A9260)			+= qil-a926x/
 obj-$(CONFIG_MACH_QIL_A9G20)			+= qil-a926x/
 obj-$(CONFIG_MACH_RADXA_ROCK)			+= radxa-rock/
+obj-$(CONFIG_MACH_PHYTEC_SOM_RK3288)		+= phytec-som-rk3288/
 obj-$(CONFIG_MACH_REALQ7)			+= datamodul-edm-qmx6/
 obj-$(CONFIG_MACH_RPI_COMMON)			+= raspberry-pi/
 obj-$(CONFIG_MACH_SABRELITE)			+= freescale-mx6-sabrelite/
diff --git a/arch/arm/boards/phytec-som-rk3288/Makefile b/arch/arm/boards/phytec-som-rk3288/Makefile
new file mode 100644
index 0000000..6f34c9a
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/Makefile
@@ -0,0 +1,3 @@
+obj-y += board.o
+lwl-y += lowlevel.o
+bbenv-y += defaultenv-physom-rk3288
diff --git a/arch/arm/boards/phytec-som-rk3288/board.c b/arch/arm/boards/phytec-som-rk3288/board.c
new file mode 100644
index 0000000..8ea6c6c
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/board.c
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
+ * Author: Wadim Egorov <w.egorov@phytec.de>
+ *
+ * Device initialization for the phyCORE-RK3288 SoM
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <envfs.h>
+
+static int physom_devices_init(void)
+{
+	if (!of_machine_is_compatible("phytec,rk3288-phycore-som"))
+		return 0;
+
+	barebox_set_hostname("pcm059");
+	defaultenv_append_directory(defaultenv_physom_rk3288);
+
+	return 0;
+}
+device_initcall(physom_devices_init);
diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
new file mode 100644
index 0000000..731b07f
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+global.bootm.image=/mnt/emmc/linuximage
+global.bootm.oftree=/mnt/emmc/oftree
+
+global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
new file mode 100644
index 0000000..5b19dba
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+global.bootm.image=/mnt/sdmmc/linuximage
+global.bootm.oftree=/mnt/sdmmc/oftree
+
+global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rw rootwait"
diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
new file mode 100644
index 0000000..8b3f043
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount-mmc
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+mkdir -p /mnt/emmc
+automount -d /mnt/emmc 'mshc0.probe=1 && [ -e /dev/mshc0.0 ] && mount /dev/mshc0.0 /mnt/emmc'
+
+mkdir -p /mnt/sdmmc
+automount -d /mnt/sdmmc 'mshc1.probe=1 && [ -e /dev/mshc1.0 ] && mount /dev/mshc1.0 /mnt/sdmmc'
diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
new file mode 100644
index 0000000..b4cedfc
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/nv/boot.default
@@ -0,0 +1 @@
+emmc mmc
diff --git a/arch/arm/boards/phytec-som-rk3288/lowlevel.c b/arch/arm/boards/phytec-som-rk3288/lowlevel.c
new file mode 100644
index 0000000..7804a55
--- /dev/null
+++ b/arch/arm/boards/phytec-som-rk3288/lowlevel.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
+ * Author: Wadim Egorov <w.egorov@phytec.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <common.h>
+#include <linux/sizes.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <mach/rk3288-regs.h>
+#include <mach/grf_rk3288.h>
+#include <mach/hardware.h>
+#include <debug_ll.h>
+
+extern char __dtb_rk3288_phycore_som_start[];
+
+ENTRY_FUNCTION(start_rk3288_phycore_som, r0, r1, r2)
+{
+	void *fdt;
+	arm_cpu_lowlevel_init();
+
+	if (IS_ENABLED(CONFIG_DEBUG_LL)) {
+		struct rk3288_grf * const grf = (void *)RK3288_GRF_BASE;
+		rk_clrsetreg(&grf->gpio4c_iomux,
+			GPIO4C1_MASK << GPIO4C1_SHIFT |
+			GPIO4C0_MASK << GPIO4C0_SHIFT,
+			GPIO4C1_UART0BT_SOUT << GPIO4C1_SHIFT |
+			GPIO4C0_UART0BT_SIN << GPIO4C0_SHIFT);
+		INIT_LL();
+	}
+
+	fdt = __dtb_rk3288_phycore_som_start - get_runtime_offset();
+
+	barebox_arm_entry(0x0, SZ_1G, fdt);
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 09bf68e..d1a3fe8 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -54,6 +54,7 @@ pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += imx6q-phytec-pbaa03.dtb.o \
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) += armada-xp-openblocks-ax3-4-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_A6) += kirkwood-openblocks_a6-bb.dtb.o
 pbl-dtb-$(CONFIG_MACH_RADXA_ROCK) += rk3188-radxarock.dtb.o
+pbl-dtb-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += rk3288-phycore-som.dtb.o
 pbl-dtb-$(CONFIG_MACH_REALQ7) += imx6q-dmo-edmqmx6.dtb.o
 pbl-dtb-$(CONFIG_MACH_SABRELITE) += imx6q-sabrelite.dtb.o imx6dl-sabrelite.dtb.o
 pbl-dtb-$(CONFIG_MACH_SABRESD) += imx6q-sabresd.dtb.o
diff --git a/arch/arm/dts/rk3288-phycore-som.dts b/arch/arm/dts/rk3288-phycore-som.dts
new file mode 100644
index 0000000..5410bd1
--- /dev/null
+++ b/arch/arm/dts/rk3288-phycore-som.dts
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
+ * Author: Wadim Egorov <w.egorov@phytec.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+/dts-v1/;
+
+#include <arm/rk3288.dtsi>
+
+/ {
+	model = "phycore-rk3288";
+	compatible = "phytec,rk3288-phycore-som", "rockchip,rk3288";
+
+	memory {
+		reg = <0 0x40000000>;
+	};
+
+	vcc33: fixedregulator@0 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc33";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		startup-delay-us = <100000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	vcc18: fixedregulator@1 {
+		compatible = "regulator-fixed";
+		regulator-name = "vcc18";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	chosen {
+		stdout-path = &uart0;
+
+		environment-emmc {
+			compatible = "barebox,environment";
+			device-path = &emmc, "partname:barebox-environment";
+			status = "disabled";
+		};
+
+		environment-sdmmc {
+			compatible = "barebox,environment";
+			device-path = &sdmmc, "partname:barebox-environment";
+			status = "disabled";
+		};
+	};
+};
+
+&pinctrl {
+	sdmmc {
+		sdmmc_pwr: sdmmc-pwr {
+			rockchip,pins = <7 11 RK_FUNC_GPIO &pcfg_pull_none>;
+		};
+	};
+};
+
+&i2c0 {
+	clock-frequency = <400000>;
+	status = "okay";
+};
+
+&emmc {
+	broken-cd;
+	bus-width = <8>;
+	cap-mmc-highspeed;
+	disable-wp;
+	non-removable;
+	num-slots = <1>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
+	vmmc-supply = <&vcc33>;
+	vqmmc-supply = <&vcc18>;
+	status = "okay";
+
+	#size-cells = <1>;
+	#address-cells = <1>;
+
+	partition@8000 {
+		label = "spl";
+		reg = <0x8000 0x8000>;
+	};
+
+	partition@20000 {
+		label = "barebox";
+		reg = <0x20000 0x80000>;
+	};
+
+	partition@a0000 {
+		label = "barebox-environment";
+		reg = <0xa0000 0x20000>;
+	};
+};
+
+&sdmmc {
+	bus-width = <4>;
+	cap-mmc-highspeed;
+	cap-sd-highspeed;
+	card-detect-delay = <200>;
+	disable-wp;
+	num-slots = <1>;
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
+	vmmc-supply = <&vcc33>;
+	status = "okay";
+
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition@8000 {
+		label = "spl";
+		reg = <0x8000 0x8000>;
+	};
+
+	partition@20000 {
+		label = "barebox";
+		reg = <0x20000 0x80000>;
+	};
+
+	partition@a0000 {
+		label = "barebox-environment";
+		reg = <0xa0000 0x20000>;
+	};
+};
+
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_xfer>, <&uart0_cts>, <&uart0_rts>;
+	reg-shift = <2>;
+	status = "okay";
+};
+
+&uart2 {
+	status = "okay";
+};
diff --git a/arch/arm/mach-rockchip/Kconfig b/arch/arm/mach-rockchip/Kconfig
index 71fcbe7..f2fa3c6 100644
--- a/arch/arm/mach-rockchip/Kconfig
+++ b/arch/arm/mach-rockchip/Kconfig
@@ -30,4 +30,11 @@ config MACH_RADXA_ROCK
 	select MFD_ACT8846
 	bool "Radxa rock board"
 
+config MACH_PHYTEC_SOM_RK3288
+	depends on ARCH_RK3288
+	select I2C
+	bool "RK3288 phyCORE SOM"
+	help
+	  Say Y here if you are using a RK3288 based Phytecs SOM
+
 endmenu
diff --git a/images/Makefile.rockchip b/images/Makefile.rockchip
index 9715b92..3f1ee57 100644
--- a/images/Makefile.rockchip
+++ b/images/Makefile.rockchip
@@ -5,3 +5,7 @@
 pblx-$(CONFIG_MACH_RADXA_ROCK) += start_radxa_rock
 FILE_barebox-radxa-rock.img = start_radxa_rock.pblx
 image-$(CONFIG_MACH_RADXA_ROCK) += barebox-radxa-rock.img
+
+pblx-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += start_rk3288_phycore_som
+FILE_barebox-rk3288-phycore-som.img = start_rk3288_phycore_som.pblx
+image-$(CONFIG_MACH_PHYTEC_SOM_RK3288) += barebox-rk3288-phycore-som.img
-- 
1.9.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 3/3] ARM: i.MX6 Santaro: Add PBL console support
From: Sascha Hauer @ 2016-08-29 15:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <1472485099-10551-1-git-send-email-s.hauer@pengutronix.de>

To be able to use PBL console do the usual
relocate_to_current_adr()/setup_c() dance and call pbl_set_putc() to
tell the PBL console where the UART is.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/boards/guf-santaro/lowlevel.c | 31 +++++++++++++++++++++----------
 1 file changed, 21 insertions(+), 10 deletions(-)

diff --git a/arch/arm/boards/guf-santaro/lowlevel.c b/arch/arm/boards/guf-santaro/lowlevel.c
index e2b6df5..1502bb3 100644
--- a/arch/arm/boards/guf-santaro/lowlevel.c
+++ b/arch/arm/boards/guf-santaro/lowlevel.c
@@ -3,36 +3,47 @@
 #include <io.h>
 #include <asm/barebox-arm-head.h>
 #include <asm/barebox-arm.h>
+#include <asm/cache.h>
 #include <mach/generic.h>
 #include <mach/imx6-regs.h>
 #include <debug_ll.h>
+#include <console.h>
+#include <mach/esdctl.h>
 
 static inline void setup_uart(void)
 {
-	void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR;
+	void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR);
 
 	writel(0x1, iomuxbase + 0x2b0);
 
 	imx6_ungate_all_peripherals();
-	imx6_uart_setup_ll();
-
-	putc_ll('>');
+	imx6_uart_setup(IOMEM(MX6_UART2_BASE_ADDR));
 }
 
 extern char __dtb_imx6q_guf_santaro_start[];
 
-ENTRY_FUNCTION(start_imx6q_guf_santaro, r0, r1, r2)
+static noinline void santaro_start(void)
 {
-	void *fdt;
+	pbl_set_putc(imx_uart_putc, IOMEM(MX6_UART2_BASE_ADDR));
+
+	pr_debug("Garz+Fricke Santaro\n");
+
+	imx6q_barebox_entry(__dtb_imx6q_guf_santaro_start);
+}
 
+ENTRY_FUNCTION(start_imx6q_guf_santaro, r0, r1, r2)
+{
 	imx6_cpu_lowlevel_init();
 
 	arm_setup_stack(0x00920000 - 8);
 
-	if (IS_ENABLED(CONFIG_DEBUG_LL))
-		setup_uart();
+	arm_early_mmu_cache_invalidate();
+
+	setup_uart();
 
-	fdt = __dtb_imx6q_guf_santaro_start - get_runtime_offset();
+	relocate_to_current_adr();
+	setup_c();
+	barrier();
 
-	barebox_arm_entry(0x10000000, SZ_1G, fdt);
+	santaro_start();
 }
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 2/3] ARM: i.MX6 Santaro: Add USB support
From: Sascha Hauer @ 2016-08-29 15:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <1472485099-10551-1-git-send-email-s.hauer@pengutronix.de>

Enable usbotg and usbh1 devices to gain USB support.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/dts/imx6q-guf-santaro.dts | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/dts/imx6q-guf-santaro.dts b/arch/arm/dts/imx6q-guf-santaro.dts
index e8a2b96..3217a5b 100644
--- a/arch/arm/dts/imx6q-guf-santaro.dts
+++ b/arch/arm/dts/imx6q-guf-santaro.dts
@@ -577,6 +577,16 @@
 	status = "okay";
 };
 
+&usbh1 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pinctrl_usbh1>;
+	status = "okay";
+};
+
+&usbotg {
+	status = "okay";
+};
+
 &usdhc2 {
 	/* SD card socket */
 	pinctrl-names = "default";
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH 1/3] ARM: i.MX6 Santaro: Add enable-delay for the display
From: Sascha Hauer @ 2016-08-29 15:38 UTC (permalink / raw)
  To: Barebox List

The display needs a time to settle, set an enable-delay
of 200ms to avoid flickering.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/dts/imx6q-guf-santaro.dts | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/dts/imx6q-guf-santaro.dts b/arch/arm/dts/imx6q-guf-santaro.dts
index 2bd1a26..e8a2b96 100644
--- a/arch/arm/dts/imx6q-guf-santaro.dts
+++ b/arch/arm/dts/imx6q-guf-santaro.dts
@@ -63,6 +63,7 @@
 		compatible = "simple-panel";
 		backlight = <&backlight>;
 		enable-gpios = <&gpio5 21 GPIO_ACTIVE_HIGH>;
+		enable-delay = <200>;
 
 		port {
 			panel_in: endpoint {
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] usb: chipidea i.MX: Do not return unnecessary error
From: Sascha Hauer @ 2016-08-29 15:37 UTC (permalink / raw)
  To: Barebox List

We only allow to setup the host/peripheral role once, when it's already
set then we return -EBUSY.
Return 0 instead when we set the same role again and only return -EBUSY
when we actually try to change the role.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/usb/imx/chipidea-imx.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/imx/chipidea-imx.c b/drivers/usb/imx/chipidea-imx.c
index a799abe..fb451f3 100644
--- a/drivers/usb/imx/chipidea-imx.c
+++ b/drivers/usb/imx/chipidea-imx.c
@@ -150,7 +150,7 @@ static int imx_chipidea_probe_dt(struct imx_chipidea *ci)
 
 static int ci_register_role(struct imx_chipidea *ci)
 {
-	if (ci->role_registered)
+	if (ci->role_registered != IMX_USB_MODE_OTG)
 		return -EBUSY;
 
 	if (ci->mode == IMX_USB_MODE_HOST) {
@@ -180,8 +180,12 @@ static int ci_set_mode(struct param_d *param, void *priv)
 {
 	struct imx_chipidea *ci = priv;
 
-	if (ci->role_registered)
-		return -EBUSY;
+	if (ci->role_registered != IMX_USB_MODE_OTG) {
+		if (ci->role_registered == ci->mode)
+			return 0;
+		else
+			return -EBUSY;
+	}
 
 	return ci_register_role(ci);
 }
@@ -225,6 +229,7 @@ static int imx_chipidea_probe(struct device_d *dev)
 
 	ci = xzalloc(sizeof(*ci));
 	ci->dev = dev;
+	ci->role_registered = IMX_USB_MODE_OTG;
 
 	if (IS_ENABLED(CONFIG_OFDEVICE) && dev->device_node) {
 		ret = imx_chipidea_probe_dt(ci);
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] blspec: Handle nfs:// pathes from boot
From: Sascha Hauer @ 2016-08-29 15:37 UTC (permalink / raw)
  To: Barebox List

Fixes: cb47dde boot: Call blspec_scan_directory() only on strings containing an absolute path

This commit introduced a check if the path contains a '/' at the
beginning. For booting a bootloader spec entry from NFS we have to
test the path for starting with "nfs://" aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/boot.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/common/boot.c b/common/boot.c
index e66bacb..df9cba5 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -250,6 +250,7 @@ static int bootscript_scan_path(struct bootentries *bootentries, const char *pat
  * - a cdev name
  * - a full path of a directory containing bootloader spec entries
  * - a full path of a directory containing bootscripts
+ * - a nfs:// path
  *
  * Returns the number of entries found or a negative error code.
  */
@@ -263,7 +264,7 @@ int bootentry_create_from_name(struct bootentries *bootentries,
 		if (ret > 0)
 			found += ret;
 
-		if (*name == '/') {
+		if (*name == '/' || !strncmp(name, "nfs://", 6)) {
 			ret = blspec_scan_directory(bootentries, name);
 			if (ret > 0)
 				found += ret;
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] commands: usbgadget: Fix -d option help text
From: Sascha Hauer @ 2016-08-29 15:37 UTC (permalink / raw)
  To: Barebox List

The -d option disables any currently active gadget, it does not
necessarily have to be a serial gadget.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 commands/usbgadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/commands/usbgadget.c b/commands/usbgadget.c
index fc2252a..a7e8d6c 100644
--- a/commands/usbgadget.c
+++ b/commands/usbgadget.c
@@ -96,7 +96,7 @@ BAREBOX_CMD_HELP_OPT ("-a",   "Create CDC ACM function")
 BAREBOX_CMD_HELP_OPT ("-s",   "Create Generic Serial function")
 BAREBOX_CMD_HELP_OPT ("-A <desc>",   "Create Android Fastboot function")
 BAREBOX_CMD_HELP_OPT ("-D <desc>",   "Create DFU function")
-BAREBOX_CMD_HELP_OPT ("-d",   "Disable the serial gadget")
+BAREBOX_CMD_HELP_OPT ("-d",   "Disable the currently running gadget")
 BAREBOX_CMD_HELP_END
 
 BAREBOX_CMD_START(usbgadget)
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* [PATCH] video: backlight: fix the value of 'brightness_max'
From: Sascha Hauer @ 2016-08-29 15:36 UTC (permalink / raw)
  To: Barebox List

Fixes: 87c6a88 video/backlight-pwm: fix the value of 'brightness_max'.

brightness_max should really contain the number of brightness steps, so
the number of elements in the brightness array.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/video/backlight-pwm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/backlight-pwm.c b/drivers/video/backlight-pwm.c
index 7f1715d..2915dba 100644
--- a/drivers/video/backlight-pwm.c
+++ b/drivers/video/backlight-pwm.c
@@ -156,6 +156,8 @@ static int pwm_backlight_parse_dt(struct device_d *dev,
 		if (ret < 0)
 			return ret;
 
+		pwm_backlight->backlight.brightness_max = length - 1;
+
 		for (i = 0; i < length; i++)
 			if (pwm_backlight->levels[i] > pwm_backlight->scale)
 				pwm_backlight->scale = pwm_backlight->levels[i];
@@ -165,8 +167,8 @@ static int pwm_backlight_parse_dt(struct device_d *dev,
 	} else {
 		/* We implicitly assume here a linear levels array { 0, 1, 2, ... 100 } */
 		pwm_backlight->scale = 100;
+		pwm_backlight->backlight.brightness_max = pwm_backlight->scale;
 	}
-	pwm_backlight->backlight.brightness_max = pwm_backlight->scale;
 
 	pwm_backlight->enable_gpio = of_get_named_gpio_flags(node, "enable-gpios", 0, &flags);
 
-- 
2.8.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply related

* Re: Fwd: Shouldn't boot_board be called from boot instead of init?
From: Sascha Hauer @ 2016-08-29  7:06 UTC (permalink / raw)
  To: Guillermo Rodriguez Garcia; +Cc: barebox
In-Reply-To: <CABDcavaN3ZV6bYVkBs_i4emasduzxVWX3b4k=MwMafeCYU8KaA@mail.gmail.com>

On Wed, Aug 24, 2016 at 04:42:42PM +0200, Guillermo Rodriguez Garcia wrote:
> Hi Sascha,
> 
> 2016-08-23 10:13 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>:
> > On Mon, Aug 22, 2016 at 11:12:55AM +0200, Guillermo Rodriguez Garcia wrote:
> >> >> > However, I would be glad to get rid of defaultenv-1 rather sooner than
> >> >> > later.
> >> >>
> >> >> Uhm. I actually like defaultenv-1 better than defaultenv-2. Why not
> >> >> keep both? Everyone can then make their choice :)
> >> >
> >> > That's interesting. What do you like better about defaultenv-1? This
> >> > information could help me to improve defaultenv-2.
> >>
> >> I guess it is just a matter of personal preference but I find
> >> defaultenv-1 easier to understand and easier to manage. With
> >> defaultenv-1 we basically have just one configuration file to edit
> >> (/env/config) and optionally init_board and/or boot_board (which are
> >> not needed in a majority of the cases). So everything you need to
> >> know/edit/tweak is in /env/config.
> >>
> >> With defaultenv-2 the "board configuration" is scattered through a
> >> number of tiny files, some of which contain just a single value (see
> >> for example nv/autoboot_timeout or nv/user). I find this more
> >> difficult to manage -- you need to edit a lot of tiny files instead of
> >> just one. Also I feel that the flow of control is less obvious for the
> >> same reason.
> >>
> >> I'd say defaultenv-1 feels more "imperative" and defaultenv-2 feels
> >> more "declarative", and I prefer the former. But I am fully aware that
> >> this is just a matter of personal preference :)
> >
> > I understand your concerns but do not share them all. Maybe we can find
> > a way to either make defaultenv-2 more acceptable for you or to make
> > defaultenv-1 more appealing to me?
> >
> > About the number of small files that only contain a single value:
> > defaultenv-1 was the opposite and that was a problem. Whenever a board
> > wanted to adjust a single value, say the autoboot timeout, it had to
> > duplicate a big file and very soon we had many nearly identical copies
> > of that file and nobody knew what the actual change was.
> 
> Not sure what you mean with duplicating a big file. With defaultenv-1 most
> of the time the only single file you need to edit is /env/config, which is quite
> small, and most of it should be board specific anyway. I find this (the fact
> that all I need to edit/tweak is in that single file) quite convenient.
> 
> > With NV
> > variables this has become better. I never felt the need though to dig
> > through the individual /env/nv files, here the 'nv' and 'global'
> > commands or the 'magicvar' command to much better jobs. Normally you
> > only have to hand edit /env/nv files when you want to change the default
> > of a variable for a given board.
> >
> > Another thing that made another approach than with defaultenv-1
> > necessary was the variables that contain "net", "disk", "nor", "nand".
> > This did not scale and was not extensible because you could not pass
> > some arbitrary file and use it as kernel.
> 
> I can understand that one. But on the other hand not every target needs
> that flexibility. That's why I said that I don't see the need to drop
> defaultenv-1.
> Isn't it better to leave both defaultenv-1 and defaultenv-2 alive and
> let everyone
> decide which one suits them best?
> 
> My impression when I look at defaultenv-2 is as described above: OK,
> more flexibility (which I currently don't need), but also more complexity,
> configuration scattered over more files, more management overhead.
> Plus, I'm happy with defaultenv-1, so why change?
> 
> >
> > I wonder if defaultenv-1 is not customizable enough and on the other
> > hand your board does only boot from very special locations, do you need
> > a generic default environment at all or are you better off using your
> > own special environment?
> 
> In my case, I am currently using barebox on 3 boards. All of them support
> multiple boot sources (NAND, NOR, MMC) plus NFS. For all of them I only
> needed to edit /env/config; the other files in the default environment
> (init, update, boot) all work fine. So (for me) defaultenv-1 was customizable
> enough, and I did indeed benefit from having a generic default environment
> instead of a custom one written from scratch.
> 
> >
> > Finally, could this be a documentation issue? Could you have another
> > look at defaultenv-2 and see what is not clear or what needs further
> > convenience to be better usable?
> 
> I think the documentation is fine as a reference. Perhaps a tutorial showing
> how to migrate from defaultenv-1 to defaultenv-2 could help "convert" people
> to defaultenv-2 by holding their hand and taking them from what they know
> (defaultenv-1) to the "new stuff".
> 
> But even then I still wonder -- why not let both approaches coexist?

It's my interest to keep the diversion between boards small. Normally
as a barebox user you shouldn't care about the particular type of the
board you have, instead it should always feel the same (Or, if you
decide to customize barebox via Kconfig or patches, it should be
applyable for all boards without having to repeat this step for every
board you use in the future). defaultenv-1 make this goal hard to
archieve. Most boards only copy and modify /env/config, but some also
duplicate /env/boot and other files. /env/boot is problematic because
it contains behaviour, not configuration. With each duplication we
introduce a new behaviour which means that this board beahves different
from the rest of the boards and also won't get updates from the generic
/env/boot file anymore.
This all is not problematic when you only care about one board or a few
boards that you use, but is a nightmare when you have > 100 boards
from which you only have access to a few of them. defaultenv-2 is better
in this regard since we can do adjustments without changing other things
and it generally needs less adjustments.

I think it's not really defaultenv-1 that disturbs me, but more the
in-tree users of it. Also it's not really nice that by choosing a board
you also choose between defaultenv-1 and defaultenv-2. It would be much
nicer if these choices were independent.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH v2] ARM: vector_table: Fix creation of second level page table
From: Peter Kardos @ 2016-08-27 19:09 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20160826054533.GP20657@pengutronix.de>

Thanks for the fix.

Peter

On 8/26/2016 7:45 AM, Sascha Hauer wrote:
> On Thu, Aug 25, 2016 at 11:32:43PM +0200, Peter Kardos wrote:
>> Tested this one as well  with my AT91RM9200 system, v2016.08 + patch; The
>> system starts/boots as expected.
>> If no one objects, we can consider this issue closed/fixed.
> I took this as a
> Tested-by: Peter Kardos <kardos.peter.sk@gmail.com>
>
> Thanks for testing.
>
> Sascha
>


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH v2] ARM: vector_table: Fix creation of second level page table
From: Sascha Hauer @ 2016-08-26  5:45 UTC (permalink / raw)
  To: Peter Kardos; +Cc: barebox
In-Reply-To: <d3c2af19-1d8f-a078-ef33-3cc43a14d990@gmail.com>

On Thu, Aug 25, 2016 at 11:32:43PM +0200, Peter Kardos wrote:
> Tested this one as well  with my AT91RM9200 system, v2016.08 + patch; The
> system starts/boots as expected.
> If no one objects, we can consider this issue closed/fixed.

I took this as a
Tested-by: Peter Kardos <kardos.peter.sk@gmail.com>

Thanks for testing.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply

* Re: [PATCH v2 6/8] ARM: Add phyCORE-RK3288 SOM support
From: Sascha Hauer @ 2016-08-26  5:43 UTC (permalink / raw)
  To: Wadim Egorov; +Cc: barebox
In-Reply-To: <1472042970-35151-6-git-send-email-w.egorov@phytec.de>

On Wed, Aug 24, 2016 at 02:49:28PM +0200, Wadim Egorov wrote:
> The phyCORE-RK3288 aka PCM-059 is a SoM (System on Module)
> containing a RK3288 SoC. The module can be connected to different
> carrier boards.
> 
> Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
> ---
>  arch/arm/boards/Makefile                           |   1 +
>  arch/arm/boards/phytec-som-rk3288/Makefile         |   3 +
>  arch/arm/boards/phytec-som-rk3288/board.c          |  31 +++++
>  .../defaultenv-physom-rk3288/boot/emmc             |   6 +
>  .../defaultenv-physom-rk3288/boot/mmc              |   6 +
>  .../defaultenv-physom-rk3288/init/automount        |  12 ++
>  .../defaultenv-physom-rk3288/init/bootsource       |   3 +
>  arch/arm/boards/phytec-som-rk3288/lowlevel.c       |  44 ++++++
>  arch/arm/dts/Makefile                              |   1 +
>  arch/arm/dts/rk3288-phycore-som.dts                | 148 +++++++++++++++++++++
>  arch/arm/mach-rockchip/Kconfig                     |   7 +
>  images/Makefile.rockchip                           |   4 +
>  12 files changed, 266 insertions(+)
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/Makefile
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/board.c
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/bootsource
>  create mode 100644 arch/arm/boards/phytec-som-rk3288/lowlevel.c
>  create mode 100644 arch/arm/dts/rk3288-phycore-som.dts
> 
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 9241b66..24ce130 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -95,6 +95,7 @@ obj-$(CONFIG_MACH_PM9G45)			+= pm9g45/
>  obj-$(CONFIG_MACH_QIL_A9260)			+= qil-a926x/
>  obj-$(CONFIG_MACH_QIL_A9G20)			+= qil-a926x/
>  obj-$(CONFIG_MACH_RADXA_ROCK)			+= radxa-rock/
> +obj-$(CONFIG_MACH_PHYTEC_SOM_RK3288)		+= phytec-som-rk3288/
>  obj-$(CONFIG_MACH_REALQ7)			+= datamodul-edm-qmx6/
>  obj-$(CONFIG_MACH_RPI_COMMON)			+= raspberry-pi/
>  obj-$(CONFIG_MACH_SABRELITE)			+= freescale-mx6-sabrelite/
> diff --git a/arch/arm/boards/phytec-som-rk3288/Makefile b/arch/arm/boards/phytec-som-rk3288/Makefile
> new file mode 100644
> index 0000000..6f34c9a
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/Makefile
> @@ -0,0 +1,3 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o
> +bbenv-y += defaultenv-physom-rk3288
> diff --git a/arch/arm/boards/phytec-som-rk3288/board.c b/arch/arm/boards/phytec-som-rk3288/board.c
> new file mode 100644
> index 0000000..8ea6c6c
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/board.c
> @@ -0,0 +1,31 @@
> +/*
> + * Copyright (C) 2016 PHYTEC Messtechnik GmbH,
> + * Author: Wadim Egorov <w.egorov@phytec.de>
> + *
> + * Device initialization for the phyCORE-RK3288 SoM
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * version 2 as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> + * GNU General Public License for more details.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <envfs.h>
> +
> +static int physom_devices_init(void)
> +{
> +	if (!of_machine_is_compatible("phytec,rk3288-phycore-som"))
> +		return 0;
> +
> +	barebox_set_hostname("pcm059");
> +	defaultenv_append_directory(defaultenv_physom_rk3288);
> +
> +	return 0;
> +}
> +device_initcall(physom_devices_init);
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
> new file mode 100644
> index 0000000..731b07f
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/emmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +global.bootm.image=/mnt/emmc/linuximage
> +global.bootm.oftree=/mnt/emmc/oftree
> +
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk0p2 rw rootwait"
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
> new file mode 100644
> index 0000000..5b19dba
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/boot/mmc
> @@ -0,0 +1,6 @@
> +#!/bin/sh
> +
> +global.bootm.image=/mnt/sdmmc/linuximage
> +global.bootm.oftree=/mnt/sdmmc/oftree
> +
> +global.linux.bootargs.dyn.root="root=/dev/mmcblk1p2 rw rootwait"
> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount
> new file mode 100644
> index 0000000..2f9d78a
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/automount
> @@ -0,0 +1,12 @@
> +#!/bin/sh
> +
> +if [ "$1" = menu ]; then
> +	init-menu-add-entry "$0" "Automountpoints"
> +	exit
> +fi

This is no longer needed.

> +
> +mkdir -p /mnt/emmc
> +automount -d /mnt/emmc 'mshc0.probe=1 && [ -e /dev/mshc0.0 ] && mount /dev/mshc0.0 /mnt/emmc'
> +
> +mkdir -p /mnt/sdmmc
> +automount -d /mnt/sdmmc 'mshc1.probe=1 && [ -e /dev/mshc1.0 ] && mount /dev/mshc1.0 /mnt/sdmmc'

Maybe rename this to automount-mmc or similar to not overwrite the
generic automount file? You'll probably want to have the generic
automountpoints once you get network support.

> diff --git a/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/bootsource b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/bootsource
> new file mode 100644
> index 0000000..36d34e3
> --- /dev/null
> +++ b/arch/arm/boards/phytec-som-rk3288/defaultenv-physom-rk3288/init/bootsource
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> +global.boot.default="emmc mmc"

This should go to defaultenv-physom-rk3288/nv/boot.default


> +&emmc {
> +	broken-cd;
> +	bus-width = <8>;
> +	cap-mmc-highspeed;
> +	disable-wp;
> +	non-removable;
> +	num-slots = <1>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&emmc_clk>, <&emmc_cmd>, <&emmc_pwr>, <&emmc_bus8>;
> +	vmmc-supply = <&vcc33>;
> +	vqmmc-supply = <&vcc18>;
> +	status = "okay";
> +
> +	#size-cells = <1>;
> +	#address-cells = <1>;
> +
> +	partition@8000 {
> +		label = "spl";
> +		reg = <0x8000 0x8000>;
> +	};
> +
> +	partition@20000 {
> +		label = "barebox";
> +		reg = <0x20000 0xe0000>;
> +	};
> +
> +	partition@e0000 {
> +		label = "barebox-environment";
> +		reg = <0xe0000 0x20000>;
> +	};
> +};

The reg property is <start size>, so it seems the barebox partition and
the barebox-environment partition overlap.

> +
> +&sdmmc {
> +	bus-width = <4>;
> +	cap-mmc-highspeed;
> +	cap-sd-highspeed;
> +	card-detect-delay = <200>;
> +	disable-wp;
> +	num-slots = <1>;
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&sdmmc_clk>, <&sdmmc_cmd>, <&sdmmc_cd>, <&sdmmc_bus4>;
> +	vmmc-supply = <&vcc33>;
> +	status = "okay";
> +
> +	#address-cells = <1>;
> +	#size-cells = <1>;
> +
> +	partition@8000 {
> +		label = "spl";
> +		reg = <0x8000 0x8000>;
> +	};
> +
> +	partition@20000 {
> +		label = "barebox";
> +		reg = <0x20000 0xe0000>;
> +	};
> +
> +	partition@e0000 {
> +		label = "barebox-environment";
> +		reg = <0xe0000 0x20000>;
> +	};
> +};

Same here.

The rest of the series looks fine to me, enough to resend this patch.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply


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