mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCHv2 00/10] kwbimage improvements, Kirkwood support
@ 2013-05-15  7:36 Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 01/10] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

Hello,

This is a resend of yesterday patch set, rebased on top of the current
'next' branch. I have dropped the commits from Sebastian, since they
have been merged by Sascha, and I've added one commit that fixes the
SolidRun CuBox kwbimage.cfg to remove some lines that are no longer
necessary after the kwbimage improvements that are introduced by this
patch set.

Best regards,

Thomas

Thomas Petazzoni (10):
  scripts/kwbimage: add a new function image_count_options()
  scripts/kwbimage: add a few sanity checks
  scripts/kwbimage: make the v0 image creation more flexible
  scripts/kwbimage: simplify the v1 image creation
  scripts/kwbimage: make image_boot_mode_id() return -1 on failure
  scripts/kwbimage: add support for NAND ECC and page size header
    fields
  arm: mvebu: add Feroceon CPU type
  arm: mvebu: initial support for Marvell Kirkwood SoCs
  arm: mvebu: add basic support for Globalscale Guruplug board
  arm: mvebu: remove useless lines in kwbimage.cfg for CuBox

 arch/arm/Makefile                                  |    1 +
 arch/arm/boards/globalscale-guruplug/Makefile      |    2 +
 arch/arm/boards/globalscale-guruplug/config.h      |    4 +
 .../globalscale-guruplug/globalscale-guruplug.c    |   26 ++
 arch/arm/boards/globalscale-guruplug/kwbimage.cfg  |   27 ++
 arch/arm/boards/globalscale-guruplug/lowlevel.c    |   26 ++
 arch/arm/boards/solidrun-cubox/kwbimage.cfg        |    2 -
 arch/arm/configs/globalscale_guruplug_defconfig    |    6 +
 arch/arm/cpu/Kconfig                               |    8 +
 arch/arm/mach-mvebu/Kconfig                        |   19 ++
 arch/arm/mach-mvebu/Makefile                       |    1 +
 arch/arm/mach-mvebu/include/mach/kirkwood-regs.h   |   37 +++
 arch/arm/mach-mvebu/include/mach/kirkwood.h        |   22 ++
 arch/arm/mach-mvebu/kirkwood.c                     |  111 ++++++++
 scripts/kwbimage.c                                 |  279 ++++++++++++--------
 15 files changed, 453 insertions(+), 118 deletions(-)
 create mode 100644 arch/arm/boards/globalscale-guruplug/Makefile
 create mode 100644 arch/arm/boards/globalscale-guruplug/config.h
 create mode 100644 arch/arm/boards/globalscale-guruplug/globalscale-guruplug.c
 create mode 100644 arch/arm/boards/globalscale-guruplug/kwbimage.cfg
 create mode 100644 arch/arm/boards/globalscale-guruplug/lowlevel.c
 create mode 100644 arch/arm/configs/globalscale_guruplug_defconfig
 create mode 100644 arch/arm/mach-mvebu/include/mach/kirkwood-regs.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/kirkwood.h
 create mode 100644 arch/arm/mach-mvebu/kirkwood.c

-- 
1.7.9.5


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

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

* [PATCHv2 01/10] scripts/kwbimage: add a new function image_count_options()
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 02/10] scripts/kwbimage: add a few sanity checks Thomas Petazzoni
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

This function returns the number of configuration elements that match
a given type. Will be used to do some sanity checking of the number of
options.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 14b35e7..0d5dcac 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -259,6 +259,20 @@ image_find_option(struct image_cfg_element *image_cfg,
 	return NULL;
 }
 
+static unsigned int
+image_count_options(struct image_cfg_element *image_cfg,
+		    int cfgn, unsigned int optiontype)
+{
+	int i;
+	unsigned int count = 0;
+
+	for (i = 0; i < cfgn; i++)
+		if (image_cfg[i].type == optiontype)
+			count++;
+
+	return count;
+}
+
 /*
  * Compute a 8-bit checksum of a memory area. This algorithm follows
  * the requirements of the Marvell SoC BootROM specifications.
-- 
1.7.9.5


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

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

* [PATCHv2 02/10] scripts/kwbimage: add a few sanity checks
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 01/10] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 03/10] scripts/kwbimage: make the v0 image creation more flexible Thomas Petazzoni
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

This commit uses the newly introduced image_count_options() function
to:

 - See if there is any DATA option that require the creation of an
   extended header for v0 header.

 - Verify that no more than one payload has been provided when
   creating a v0 header.

 - Verify that no more than one binary payload has been provided when
   creating a v1 header. Technically speaking, it is possible to
   support several payloads, but in real life, only one gets used, so
   we will only support that to make the code simpler for now. It can
   always be extended later on if needed.

 - Verify that no more than one payload has been provided when
   creating a v1 header.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 0d5dcac..cca20ab 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -712,12 +712,16 @@ static void *image_create_v0(struct image_cfg_element *image_cfg,
 	headersz  = sizeof(struct main_hdr_v0);
 	payloadsz = 0;
 
-	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_DATA);
-	if (e) {
+	if (image_count_options(image_cfg, cfgn, IMAGE_CFG_DATA) > 0) {
 		has_ext = 1;
 		headersz += sizeof(struct ext_hdr_v0);
 	}
 
+	if (image_count_options(image_cfg, cfgn, IMAGE_CFG_PAYLOAD) > 1) {
+		fprintf(stderr, "More than one payload, not possible\n");
+		return NULL;
+	}
+
 	payloade = image_find_option(image_cfg, cfgn, IMAGE_CFG_PAYLOAD);
 	if (payloade) {
 		struct stat s;
@@ -818,6 +822,16 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 	headersz = sizeof(struct main_hdr_v1);
 	payloadsz = 0;
 
+	if (image_count_options(image_cfg, cfgn, IMAGE_CFG_BINARY) > 1) {
+		fprintf(stderr, "More than one binary blob, not supported\n");
+		return NULL;
+	}
+
+	if (image_count_options(image_cfg, cfgn, IMAGE_CFG_PAYLOAD) > 1) {
+		fprintf(stderr, "More than one payload, not possible\n");
+		return NULL;
+	}
+
 	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_BINARY);
 	if (e) {
 		struct stat s;
-- 
1.7.9.5


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

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

* [PATCHv2 03/10] scripts/kwbimage: make the v0 image creation more flexible
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 01/10] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 02/10] scripts/kwbimage: add a few sanity checks Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 04/10] scripts/kwbimage: simplify the v1 image creation Thomas Petazzoni
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

Until now, the v0 image creation function was expecting the
configuration parameters to be ordered with first the configuration
parameters affecting the main header, then the DATA configuration
parameters that affect the extended header, then the payload.

However, with the recently added ability to override the destination
address or execution address, the configuration options corresponding
to those values may now appear at the end of the configuration
options. This commit allows to handle that by making the image
creation more flexible:

 - The configuration options for the main header are just searched
   amongst all options, the first match is used.

 - When building the extension header with the DATA options, all DATA
   options from the configuration file are used, in the order in which
   they appear in the kwbimage.cfg file.

This will for example allow a kwbimage.cfg for a v0 image to not
specify any destination or execution address, and simply override it
from the command line.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |   48 ++++++++++++++++++++----------------------------
 1 file changed, 20 insertions(+), 28 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index cca20ab..d4f65a8 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -705,7 +705,7 @@ static void *image_create_v0(struct image_cfg_element *image_cfg,
 	struct ext_hdr_v0 *ext_hdr;
 	void *image;
 	int has_ext = 0;
-	int cfgi, ret;
+	int ret;
 
 	/* Calculate the size of the header and the size of the
 	 * payload */
@@ -754,42 +754,34 @@ static void *image_create_v0(struct image_cfg_element *image_cfg,
 	main_hdr->blocksize = payloadsz + sizeof(uint32_t);
 	main_hdr->srcaddr   = headersz;
 	main_hdr->ext       = has_ext;
-	for (cfgi = 0; cfgi < cfgn; cfgi++) {
-		struct image_cfg_element *el = &image_cfg[cfgi];
-		if (el->type == IMAGE_CFG_BOOT_FROM)
-			main_hdr->blockid = el->bootfrom;
-		else if (el->type == IMAGE_CFG_DEST_ADDR)
-			main_hdr->destaddr = el->dstaddr;
-		else if (el->type == IMAGE_CFG_EXEC_ADDR)
-			main_hdr->execaddr = el->execaddr;
-		else if (el->type != IMAGE_CFG_VERSION)
-			break;
-	}
-
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_BOOT_FROM);
+	if (e)
+		main_hdr->blockid = e->bootfrom;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_DEST_ADDR);
+	if (e)
+		main_hdr->destaddr = e->dstaddr;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_EXEC_ADDR);
+	if (e)
+		main_hdr->execaddr = e->execaddr;
 	main_hdr->checksum = image_checksum8(image,
 					     sizeof(struct main_hdr_v0));
 
 	/* Generate the ext header */
 	if (has_ext) {
-		int datai = 0;
+		int cfgi, datai;
 
 		ext_hdr = image + sizeof(struct main_hdr_v0);
 		ext_hdr->offset = 0x40;
 
-		for (; cfgi < cfgn; cfgi++) {
-			struct image_cfg_element *el = &image_cfg[cfgi];
-			if (el->type == IMAGE_CFG_DATA) {
-				ext_hdr->rcfg[datai].raddr = el->regdata.raddr;
-				ext_hdr->rcfg[datai].rdata = el->regdata.rdata;
-				datai++;
-			}
-			else if (el->type == IMAGE_CFG_PAYLOAD)
-				break;
-			else {
-				fprintf(stderr, "Invalid element of type %d\n",
-					el->type);
-				return NULL;
-			}
+		for (cfgi = 0, datai = 0; cfgi < cfgn; cfgi++) {
+			e = &image_cfg[cfgi];
+
+			if (e->type != IMAGE_CFG_DATA)
+				continue;
+
+			ext_hdr->rcfg[datai].raddr = e->regdata.raddr;
+			ext_hdr->rcfg[datai].rdata = e->regdata.rdata;
+			datai++;
 		}
 
 		ext_hdr->checksum = image_checksum8(ext_hdr,
-- 
1.7.9.5


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

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

* [PATCHv2 04/10] scripts/kwbimage: simplify the v1 image creation
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 03/10] scripts/kwbimage: make the v0 image creation more flexible Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 05/10] scripts/kwbimage: make image_boot_mode_id() return -1 on failure Thomas Petazzoni
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

We now assume that at most one binary header can be added, so we no
longer need to loop for all configuration options to find the binary
blobs. We simply find the binary blob configuration option in
'binarye' and use that when we need to generate the corresponding
header.

Also, just like we did for the v0 image creation, use
image_find_option() to find the value of the different options needed
to create the main header.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |  151 ++++++++++++++++++++++++----------------------------
 1 file changed, 70 insertions(+), 81 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index d4f65a8..631f131 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -802,12 +802,12 @@ static void *image_create_v0(struct image_cfg_element *image_cfg,
 static void *image_create_v1(struct image_cfg_element *image_cfg,
 			     int cfgn, const char *output, size_t *imagesz)
 {
-	struct image_cfg_element *e, *payloade;
+	struct image_cfg_element *e, *payloade, *binarye;
 	struct main_hdr_v1 *main_hdr;
 	size_t headersz, payloadsz, totalsz;
 	void *image, *cur;
 	int hasext = 0;
-	int cfgi, ret;
+	int ret;
 
 	/* Calculate the size of the header and the size of the
 	 * payload */
@@ -824,24 +824,24 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 		return NULL;
 	}
 
-	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_BINARY);
-	if (e) {
+	binarye = image_find_option(image_cfg, cfgn, IMAGE_CFG_BINARY);
+	if (binarye) {
 		struct stat s;
 
-		ret = stat(e->binary.file, &s);
+		ret = stat(binarye->binary.file, &s);
 		if (ret < 0) {
 			char *cwd = get_current_dir_name();
 			fprintf(stderr,
 				"Didn't find the file '%s' in '%s' which is mandatory to generate the image\n"
 				"This file generally contains the DDR3 training code, and should be extracted from an existing bootable\n"
 				"image for your board. See 'kwbimage -x' to extract it from an existing image.\n",
-				e->binary.file, cwd);
+				binarye->binary.file, cwd);
 			free(cwd);
 			return NULL;
 		}
 
 		headersz += s.st_size +
-			e->binary.nargs * sizeof(unsigned int);
+			binarye->binary.nargs * sizeof(unsigned int);
 		hasext = 1;
 	}
 
@@ -878,96 +878,85 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 	cur = main_hdr = image;
 	cur += sizeof(struct main_hdr_v1);
 
+	/* Fill the main header */
 	main_hdr->blocksize    = payloadsz + sizeof(uint32_t);
 	main_hdr->headersz_lsb = headersz & 0xFFFF;
 	main_hdr->headersz_msb = (headersz & 0xFFFF0000) >> 16;
 	main_hdr->srcaddr      = headersz;
 	main_hdr->ext          = hasext;
+	main_hdr->version      = 1;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_BOOT_FROM);
+	if (e)
+		main_hdr->blockid = e->bootfrom;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_DEST_ADDR);
+	if (e)
+		main_hdr->destaddr = e->dstaddr;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_EXEC_ADDR);
+	if (e)
+		main_hdr->execaddr = e->execaddr;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_NAND_BLKSZ);
+	if (e)
+		main_hdr->nandblocksize = e->nandblksz / (64 * 1024);
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_NAND_BADBLK_LOCATION);
+	if (e)
+		main_hdr->nandbadblklocation = e->nandbadblklocation;
 
-	/* First, take care of filling the main header */
-	for (cfgi = 0; cfgi < cfgn; cfgi++) {
-		struct image_cfg_element *el = &image_cfg[cfgi];
-		if (el->type == IMAGE_CFG_VERSION)
-			main_hdr->version = 1;
-		else if (el->type == IMAGE_CFG_BOOT_FROM)
-			main_hdr->blockid = el->bootfrom;
-		else if (el->type == IMAGE_CFG_DEST_ADDR)
-			main_hdr->destaddr = el->dstaddr;
-		else if (el->type == IMAGE_CFG_EXEC_ADDR)
-			main_hdr->execaddr = el->execaddr;
-		else if (el->type == IMAGE_CFG_NAND_BLKSZ)
-			main_hdr->nandblocksize = el->nandblksz / (64 * 1024);
-		else if (el->type == IMAGE_CFG_NAND_BADBLK_LOCATION)
-			main_hdr->nandbadblklocation = el->nandbadblklocation;
-		else
-			break;
-	}
-
-	/* Then, fill the extension headers */
-	for (; cfgi < cfgn; cfgi++) {
-		struct image_cfg_element *el = &image_cfg[cfgi];
-
-		if (el->type == IMAGE_CFG_BINARY) {
-			struct opt_hdr_v1 *hdr = cur;
-			unsigned int *args;
-			size_t binhdrsz;
-			struct stat s;
-			int argi;
-			FILE *bin;
-
-			hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
-
-			bin = fopen(el->binary.file, "r");
-			if (!bin) {
-				fprintf(stderr, "Cannot open binary file %s\n",
-					el->binary.file);
-				return NULL;
-			}
-
-			fstat(fileno(bin), &s);
+	if (binarye) {
+		struct opt_hdr_v1 *hdr = cur;
+		unsigned int *args;
+		size_t binhdrsz;
+		struct stat s;
+		int argi;
+		FILE *bin;
 
-			binhdrsz = sizeof(struct opt_hdr_v1) +
-				(el->binary.nargs + 1) * sizeof(unsigned int) +
-				s.st_size;
-			hdr->headersz_lsb = binhdrsz & 0xFFFF;
-			hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
+		hdr->headertype = OPT_HDR_V1_BINARY_TYPE;
 
-			cur += sizeof(struct opt_hdr_v1);
+		bin = fopen(binarye->binary.file, "r");
+		if (!bin) {
+			fprintf(stderr, "Cannot open binary file %s\n",
+				binarye->binary.file);
+			return NULL;
+		}
 
-			args = cur;
-			*args = el->binary.nargs;
-			args++;
-			for (argi = 0; argi < el->binary.nargs; argi++)
-				args[argi] = el->binary.args[argi];
+		fstat(fileno(bin), &s);
 
-			cur += (el->binary.nargs + 1) * sizeof(unsigned int);
+		binhdrsz = sizeof(struct opt_hdr_v1) +
+			(binarye->binary.nargs + 1) * sizeof(unsigned int) +
+			s.st_size;
+		hdr->headersz_lsb = binhdrsz & 0xFFFF;
+		hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
 
-			ret = fread(cur, s.st_size, 1, bin);
-			if (ret != 1) {
-				fprintf(stderr,
-					"Could not read binary image %s\n",
-					el->binary.file);
-				return NULL;
-			}
+		cur += sizeof(struct opt_hdr_v1);
 
-			fclose(bin);
+		args = cur;
+		*args = binarye->binary.nargs;
+		args++;
+		for (argi = 0; argi < binarye->binary.nargs; argi++)
+			args[argi] = binarye->binary.args[argi];
 
-			cur += s.st_size;
+		cur += (binarye->binary.nargs + 1) * sizeof(unsigned int);
 
-			/* See if we have a next header or not, and if
-			 * so, add the marker indicating that we are
-			 * not the last header */
-			if ((cfgi < (cfgn - 1)) &&
-			    (image_cfg[cfgi + 1].type != IMAGE_CFG_PAYLOAD))
-				*((unsigned char *) cur) = 1;
-			cur += sizeof(uint32_t);
-		} else if (el->type == IMAGE_CFG_PAYLOAD)
-			break;
-		else {
-			fprintf(stderr, "Invalid element type %d (cfgi=%d)\n",
-				el->type, cfgi);
+		ret = fread(cur, s.st_size, 1, bin);
+		if (ret != 1) {
+			fprintf(stderr,
+				"Could not read binary image %s\n",
+				binarye->binary.file);
 			return NULL;
 		}
+
+		fclose(bin);
+
+		cur += s.st_size;
+
+		/*
+		 * For now, we don't support more than one binary
+		 * header, and no other header types are
+		 * supported. So, the binary header is necessarily the
+		 * last one
+		 */
+		*((unsigned char *) cur) = 0;
+
+		cur += sizeof(uint32_t);
 	}
 
 	/* Calculate and set the header checksum */
-- 
1.7.9.5


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

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

* [PATCHv2 05/10] scripts/kwbimage: make image_boot_mode_id() return -1 on failure
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 04/10] scripts/kwbimage: simplify the v1 image creation Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 06/10] scripts/kwbimage: add support for NAND ECC and page size header fields Thomas Petazzoni
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

The function image_boot_mode_id() converts the name of a boot media
into the corresponding Marvell specific code. However, 0 that we
currently used to indicate that the boot media name wasn't found,
could potentially be a valid value. So instead we use -1 to indicate a
failure.

This is also done in preparation to the introduction of
image_nand_ecc_mode_id(), which will convert a NAND ECC mode name into
the corresponding identifier. And in this case 0 is a valid identifier
of a NAND ECC mode, so we cannot use it to indicate a failure. Since
we want image_boot_mode_id() and image_nand_ecc_mode_id() to have a
consistent behavior, we change the former in this commit. The latter
is introduced in the next commit.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 631f131..0127e2b 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -226,14 +226,14 @@ static const char *image_boot_mode_name(unsigned int id)
 	return NULL;
 }
 
-unsigned int image_boot_mode_id(const char *boot_mode_name)
+int image_boot_mode_id(const char *boot_mode_name)
 {
 	int i;
 	for (i = 0; boot_modes[i].name; i++)
 		if (!strcmp(boot_modes[i].name, boot_mode_name))
 			return boot_modes[i].id;
 
-	return 0;
+	return -1;
 }
 
 static const char *image_nand_ecc_mode_name(unsigned int id)
@@ -987,7 +987,7 @@ static int image_create_config_parse_oneline(char *line,
 		char *value = strtok_r(NULL, " ", &saveptr);
 		el->type = IMAGE_CFG_BOOT_FROM;
 		el->bootfrom = image_boot_mode_id(value);
-		if (!el->bootfrom) {
+		if (el->bootfrom < 0) {
 			fprintf(stderr,
 				"Invalid boot media '%s'\n", value);
 			return -1;
-- 
1.7.9.5


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

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

* [PATCHv2 06/10] scripts/kwbimage: add support for NAND ECC and page size header fields
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 05/10] scripts/kwbimage: make image_boot_mode_id() return -1 on failure Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 07/10] arm: mvebu: add Feroceon CPU type Thomas Petazzoni
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

The v0 header, used on Kirkwood, has some fields to indicate the type
of the NAND ECC, and the page size of the NAND. This commit adds
support for such fields, which are needed to support the Kirkwood
Guruplug platform.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 scripts/kwbimage.c |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 0127e2b..4ebb07f 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -177,6 +177,8 @@ struct image_cfg_element {
 		IMAGE_CFG_EXEC_ADDR,
 		IMAGE_CFG_NAND_BLKSZ,
 		IMAGE_CFG_NAND_BADBLK_LOCATION,
+		IMAGE_CFG_NAND_ECC_MODE,
+		IMAGE_CFG_NAND_PAGESZ,
 		IMAGE_CFG_BINARY,
 		IMAGE_CFG_PAYLOAD,
 		IMAGE_CFG_DATA,
@@ -194,6 +196,8 @@ struct image_cfg_element {
 		unsigned int execaddr;
 		unsigned int nandblksz;
 		unsigned int nandbadblklocation;
+		unsigned int nandeccmode;
+		unsigned int nandpagesz;
 		struct ext_hdr_v0_reg regdata;
 	};
 };
@@ -245,6 +249,15 @@ static const char *image_nand_ecc_mode_name(unsigned int id)
 	return NULL;
 }
 
+int image_nand_ecc_mode_id(const char *nand_ecc_mode_name)
+{
+	int i;
+	for (i = 0; nand_ecc_modes[i].name; i++)
+		if (!strcmp(nand_ecc_modes[i].name, nand_ecc_mode_name))
+			return nand_ecc_modes[i].id;
+	return -1;
+}
+
 static struct image_cfg_element *
 image_find_option(struct image_cfg_element *image_cfg,
 		  int cfgn, unsigned int optiontype)
@@ -409,9 +422,9 @@ static int image_extract_v0(void *fdimap, const char *output, FILE *focfg)
 	if (!strcmp(boot_mode_name, "nand")) {
 		const char *nand_ecc_mode =
 			image_nand_ecc_mode_name(main_hdr->nandeccmode);
-		fprintf(focfg, "NAND_ECC_MODE %s\n",
+		fprintf(focfg, "NAND_ECCMODE %s\n",
 			nand_ecc_mode);
-		fprintf(focfg, "NAND_PAGE_SIZE %08x\n",
+		fprintf(focfg, "NAND_PAGESZ %08x\n",
 			main_hdr->nandpagesize);
 	}
 
@@ -763,6 +776,12 @@ static void *image_create_v0(struct image_cfg_element *image_cfg,
 	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_EXEC_ADDR);
 	if (e)
 		main_hdr->execaddr = e->execaddr;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_NAND_ECC_MODE);
+	if (e)
+		main_hdr->nandeccmode = e->nandeccmode;
+	e = image_find_option(image_cfg, cfgn, IMAGE_CFG_NAND_PAGESZ);
+	if (e)
+		main_hdr->nandpagesize = e->nandpagesz;
 	main_hdr->checksum = image_checksum8(image,
 					     sizeof(struct main_hdr_v0));
 
@@ -1009,6 +1028,19 @@ static int image_create_config_parse_oneline(char *line,
 		el->type = IMAGE_CFG_NAND_BADBLK_LOCATION;
 		el->nandbadblklocation =
 			strtol(value, NULL, 16);
+	} else if (!strcmp(keyword, "NAND_ECCMODE")) {
+		char *value = strtok_r(NULL, " ", &saveptr);
+		el->type = IMAGE_CFG_NAND_ECC_MODE;
+		el->nandeccmode = image_nand_ecc_mode_id(value);
+		if (el->nandeccmode < 0) {
+			fprintf(stderr,
+				"Invalid NAND ECC mode '%s'\n", value);
+			return -1;
+		}
+	} else if (!strcmp(keyword, "NAND_PAGESZ")) {
+		char *value = strtok_r(NULL, " ", &saveptr);
+		el->type = IMAGE_CFG_NAND_PAGESZ;
+		el->nandpagesz = strtol(value, NULL, 16);
 	} else if (!strcmp(keyword, "BINARY")) {
 		char *value = strtok_r(NULL, " ", &saveptr);
 		int argi = 0;
@@ -1241,6 +1273,12 @@ static void image_dump_config(struct image_cfg_element *image_cfg,
 		case IMAGE_CFG_NAND_BADBLK_LOCATION:
 			printf("NANDBADBLK 0x%x\n", e->nandbadblklocation);
 			break;
+		case IMAGE_CFG_NAND_ECC_MODE:
+			printf("NAND_ECCMODE 0x%x\n", e->nandeccmode);
+			break;
+		case IMAGE_CFG_NAND_PAGESZ:
+			printf("NAND_PAGESZ 0x%x\n", e->nandpagesz);
+			break;
 		case IMAGE_CFG_BINARY:
 			printf("BINARY %s (%d args)\n", e->binary.file,
 			       e->binary.nargs);
-- 
1.7.9.5


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

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

* [PATCHv2 07/10] arm: mvebu: add Feroceon CPU type
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 06/10] scripts/kwbimage: add support for NAND ECC and page size header fields Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 08/10] arm: mvebu: initial support for Marvell Kirkwood SoCs Thomas Petazzoni
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

The Kirkwood Marvell SoC uses a Marvell-specific implementation of an
ARMv5TE compatible ARM core, the Feroceon. This patch introduces a
Kconfig option that allows to select this CPU type.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/cpu/Kconfig |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/cpu/Kconfig b/arch/arm/cpu/Kconfig
index 86bc174..aed4cb7 100644
--- a/arch/arm/cpu/Kconfig
+++ b/arch/arm/cpu/Kconfig
@@ -39,6 +39,14 @@ config CPU_ARM926T
 	  Say Y if you want support for the ARM926T processor.
 	  Otherwise, say N.
 
+# Feroceon
+config CPU_FEROCEON
+	bool
+	select CPU_32v5
+	help
+	  This is a Marvell implementation of an ARMv5TE compatible
+	  ARM core, used in the Marvell Kirkwood SoC family.
+
 # ARMv6
 config CPU_V6
 	bool
-- 
1.7.9.5


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

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

* [PATCHv2 08/10] arm: mvebu: initial support for Marvell Kirkwood SoCs
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 07/10] arm: mvebu: add Feroceon CPU type Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 09/10] arm: mvebu: add basic support for Globalscale Guruplug board Thomas Petazzoni
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

Marvell Kirkwood SoCs are based on a ARMv5 compatible core designed by
Marvell, and a large number of peripherals with Marvell Dove, Marvell
Armada 370 and Marvell Armada XP SoCs. The Marvell Kirkwood are used
in a large number of consumer-grade NAS devices, for example.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/Kconfig                      |   14 +++
 arch/arm/mach-mvebu/Makefile                     |    1 +
 arch/arm/mach-mvebu/include/mach/kirkwood-regs.h |   37 ++++++++
 arch/arm/mach-mvebu/include/mach/kirkwood.h      |   22 +++++
 arch/arm/mach-mvebu/kirkwood.c                   |  111 ++++++++++++++++++++++
 5 files changed, 185 insertions(+)
 create mode 100644 arch/arm/mach-mvebu/include/mach/kirkwood-regs.h
 create mode 100644 arch/arm/mach-mvebu/include/mach/kirkwood.h
 create mode 100644 arch/arm/mach-mvebu/kirkwood.c

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 3d8c2c3..92ba009 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -31,6 +31,11 @@ config ARCH_DOVE
 	select CPU_V7
 	select CLOCKSOURCE_ORION
 
+config ARCH_KIRKWOOD
+	bool "Kirkwood"
+	select CPU_FEROCEON
+	select CLOCKSOURCE_ORION
+
 endchoice
 
 if ARCH_ARMADA_370
@@ -72,4 +77,13 @@ endchoice
 
 endif # ARCH_DOVE
 
+if ARCH_KIRKWOOD
+
+choice
+	prompt "Kirkwood Board Type"
+
+endchoice
+
+endif # ARCH_KIRKWOOD
+
 endif # ARCH_MVEBU
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 043f08f..8047725 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,3 +1,4 @@
 obj-$(CONFIG_ARCH_ARMADA_370)	+= armada-370-xp.o
 obj-$(CONFIG_ARCH_ARMADA_XP)	+= armada-370-xp.o
 obj-$(CONFIG_ARCH_DOVE)		+= dove.o
+obj-$(CONFIG_ARCH_KIRKWOOD)	+= kirkwood.o
diff --git a/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h b/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h
new file mode 100644
index 0000000..23e221b
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/kirkwood-regs.h
@@ -0,0 +1,37 @@
+/*
+ * Copyright
+ * (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __MACH_MVEBU_KIRKWOOD_REGS_H
+#define __MACH_MVEBU_KIRKWOOD_REGS_H
+
+#define KIRKWOOD_INT_REGS_BASE IOMEM(0xd0000000)
+
+#define KIRKWOOD_SDRAM_WIN_BASE (KIRKWOOD_INT_REGS_BASE + 0x1500)
+#define  DDR_BASE_CS_OFF(n)     (0x0000 + ((n) << 3))
+#define   DDR_BASE_CS_HIGH_MASK  0xf
+#define   DDR_BASE_CS_LOW_MASK   0xff000000
+#define  DDR_SIZE_CS_OFF(n)     (0x0004 + ((n) << 3))
+#define   DDR_SIZE_ENABLED       (1 << 0)
+#define   DDR_SIZE_CS_MASK       0x1c
+#define   DDR_SIZE_CS_SHIFT      2
+#define   DDR_SIZE_MASK          0xff000000
+#define KIRKWOOD_SAR_BASE       (KIRKWOOD_INT_REGS_BASE + 0x10030)
+#define  KIRKWOOD_TCLK_BIT      21
+#define KIRKWOOD_UART_BASE      (KIRKWOOD_INT_REGS_BASE + 0x12000)
+#define KIRKWOOD_CPUCTRL_BASE   (KIRKWOOD_INT_REGS_BASE + 0x20100)
+#define KIRKWOOD_TIMER_BASE     (KIRKWOOD_INT_REGS_BASE + 0x20300)
+
+#endif /* __MACH_MVEBU_KIRKWOOD_REGS_H */
diff --git a/arch/arm/mach-mvebu/include/mach/kirkwood.h b/arch/arm/mach-mvebu/include/mach/kirkwood.h
new file mode 100644
index 0000000..7fe002d
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/kirkwood.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ */
+
+#ifndef __MACH_KIRKWOOD_H
+#define __MACH_KIRKWOOD_H
+
+int kirkwood_add_uart0(void);
+void __naked __noreturn kirkwood_barebox_entry(void);
+
+#endif /* __MACH_KIRKWOOD_H */
diff --git a/arch/arm/mach-mvebu/kirkwood.c b/arch/arm/mach-mvebu/kirkwood.c
new file mode 100644
index 0000000..b5b6aaf
--- /dev/null
+++ b/arch/arm/mach-mvebu/kirkwood.c
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 <io.h>
+#include <linux/clk.h>
+#include <linux/clkdev.h>
+#include <ns16550.h>
+#include <mach/kirkwood-regs.h>
+#include <asm/memory.h>
+#include <asm/barebox-arm.h>
+
+static struct clk *tclk;
+
+static inline void kirkwood_memory_find(unsigned long *phys_base,
+				     unsigned long *phys_size)
+{
+	void __iomem *sdram_win = IOMEM(KIRKWOOD_SDRAM_WIN_BASE);
+	int cs;
+
+	*phys_base = ~0;
+	*phys_size = 0;
+
+	for (cs = 0; cs < 4; cs++) {
+		uint32_t base = readl(sdram_win + DDR_BASE_CS_OFF(cs));
+		uint32_t ctrl = readl(sdram_win + DDR_SIZE_CS_OFF(cs));
+
+		/* Skip non-enabled CS */
+		if (! (ctrl & DDR_SIZE_ENABLED))
+			continue;
+
+		base &= DDR_BASE_CS_LOW_MASK;
+		if (base < *phys_base)
+			*phys_base = base;
+		*phys_size += (ctrl | ~DDR_SIZE_MASK) + 1;
+	}
+}
+
+void __naked __noreturn kirkwood_barebox_entry(void)
+{
+	unsigned long phys_base, phys_size;
+	kirkwood_memory_find(&phys_base, &phys_size);
+	writel('E', 0xD0012000);
+	barebox_arm_entry(phys_base, phys_size, 0);
+}
+
+static struct NS16550_plat uart_plat = {
+	.shift = 2,
+};
+
+int kirkwood_add_uart0(void)
+{
+	uart_plat.clock = clk_get_rate(tclk);
+	if (!add_ns16550_device(DEVICE_ID_DYNAMIC,
+				(unsigned int)KIRKWOOD_UART_BASE,
+				32, IORESOURCE_MEM_32BIT, &uart_plat))
+		return -ENODEV;
+	return 0;
+}
+
+static int kirkwood_init_clocks(void)
+{
+	uint32_t sar = readl(KIRKWOOD_SAR_BASE);
+	unsigned int rate;
+
+	if (sar & (1 << KIRKWOOD_TCLK_BIT))
+		rate = 166666667;
+	else
+		rate = 200000000;
+
+	tclk = clk_fixed("tclk", rate);
+	return clk_register_clkdev(tclk, NULL, "orion-timer");
+}
+
+static int kirkwood_init_soc(void)
+{
+	unsigned long phys_base, phys_size;
+
+	kirkwood_init_clocks();
+	add_generic_device("orion-timer", DEVICE_ID_SINGLE, NULL,
+			   (unsigned int)KIRKWOOD_TIMER_BASE, 0x30,
+			   IORESOURCE_MEM, NULL);
+	kirkwood_memory_find(&phys_base, &phys_size);
+	arm_add_mem_device("ram0", phys_base, phys_size);
+
+	return 0;
+}
+
+postcore_initcall(kirkwood_init_soc);
+
+void __noreturn reset_cpu(unsigned long addr)
+{
+	writel(0x4, KIRKWOOD_CPUCTRL_BASE + 0x8);
+	writel(0x1, KIRKWOOD_CPUCTRL_BASE + 0xC);
+	for(;;)
+		;
+}
+EXPORT_SYMBOL(reset_cpu);
-- 
1.7.9.5


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

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

* [PATCHv2 09/10] arm: mvebu: add basic support for Globalscale Guruplug board
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 08/10] arm: mvebu: initial support for Marvell Kirkwood SoCs Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15  7:36 ` [PATCHv2 10/10] arm: mvebu: remove useless lines in kwbimage.cfg for CuBox Thomas Petazzoni
  2013-05-15 20:07 ` [PATCHv2 00/10] kwbimage improvements, Kirkwood support Sebastian Hesselbarth
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

The Globalscale Guruplug board is a small NAS-type plug platform that
uses a Marvell Kirkwood SoC.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/Makefile                                  |    1 +
 arch/arm/boards/globalscale-guruplug/Makefile      |    2 ++
 arch/arm/boards/globalscale-guruplug/config.h      |    4 +++
 .../globalscale-guruplug/globalscale-guruplug.c    |   26 +++++++++++++++++++
 arch/arm/boards/globalscale-guruplug/kwbimage.cfg  |   27 ++++++++++++++++++++
 arch/arm/boards/globalscale-guruplug/lowlevel.c    |   26 +++++++++++++++++++
 arch/arm/configs/globalscale_guruplug_defconfig    |    6 +++++
 arch/arm/mach-mvebu/Kconfig                        |    5 ++++
 8 files changed, 97 insertions(+)
 create mode 100644 arch/arm/boards/globalscale-guruplug/Makefile
 create mode 100644 arch/arm/boards/globalscale-guruplug/config.h
 create mode 100644 arch/arm/boards/globalscale-guruplug/globalscale-guruplug.c
 create mode 100644 arch/arm/boards/globalscale-guruplug/kwbimage.cfg
 create mode 100644 arch/arm/boards/globalscale-guruplug/lowlevel.c
 create mode 100644 arch/arm/configs/globalscale_guruplug_defconfig

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 8f17e7e..1e7ace4 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -103,6 +103,7 @@ board-$(CONFIG_MACH_FREESCALE_MX25_3STACK)	:= freescale-mx25-3-stack
 board-$(CONFIG_MACH_FREESCALE_MX35_3STACK)	:= freescale-mx35-3-stack
 board-$(CONFIG_MACH_GE863)			:= telit-evk-pro3
 board-$(CONFIG_MACH_GLOBALSCALE_MIRABOX)        := globalscale-mirabox
+board-$(CONFIG_MACH_GLOBALSCALE_GURUPLUG)       := globalscale-guruplug
 board-$(CONFIG_MACH_HIGHBANK)			:= highbank
 board-$(CONFIG_MACH_IMX21ADS)			:= imx21ads
 board-$(CONFIG_MACH_IMX27ADS)			:= imx27ads
diff --git a/arch/arm/boards/globalscale-guruplug/Makefile b/arch/arm/boards/globalscale-guruplug/Makefile
new file mode 100644
index 0000000..3b48b32
--- /dev/null
+++ b/arch/arm/boards/globalscale-guruplug/Makefile
@@ -0,0 +1,2 @@
+obj-y = globalscale-guruplug.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/globalscale-guruplug/config.h b/arch/arm/boards/globalscale-guruplug/config.h
new file mode 100644
index 0000000..ca15136
--- /dev/null
+++ b/arch/arm/boards/globalscale-guruplug/config.h
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif	/* __CONFIG_H */
diff --git a/arch/arm/boards/globalscale-guruplug/globalscale-guruplug.c b/arch/arm/boards/globalscale-guruplug/globalscale-guruplug.c
new file mode 100644
index 0000000..dfc1d1a
--- /dev/null
+++ b/arch/arm/boards/globalscale-guruplug/globalscale-guruplug.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 <sizes.h>
+#include <mach/kirkwood.h>
+
+static int globalscale_guruplug_console_init(void)
+{
+	return kirkwood_add_uart0();
+}
+
+console_initcall(globalscale_guruplug_console_init);
diff --git a/arch/arm/boards/globalscale-guruplug/kwbimage.cfg b/arch/arm/boards/globalscale-guruplug/kwbimage.cfg
new file mode 100644
index 0000000..d0f3bdb
--- /dev/null
+++ b/arch/arm/boards/globalscale-guruplug/kwbimage.cfg
@@ -0,0 +1,27 @@
+VERSION 0
+BOOT_FROM nand
+NAND_ECCMODE default
+NAND_PAGESZ 00000800
+DATA ffd100e0 1b1b9b9b
+DATA ffd01400 43000c30
+DATA ffd01404 37543000
+DATA ffd01408 22125451
+DATA ffd0140c 00000a33
+DATA ffd01410 000000cc
+DATA ffd01414 00000000
+DATA ffd01418 00000000
+DATA ffd0141c 00000c52
+DATA ffd01420 00000040
+DATA ffd01424 0000f17f
+DATA ffd01428 00085520
+DATA ffd0147c 00008552
+DATA ffd01500 00000000
+DATA ffd01504 0ffffff1
+DATA ffd01508 10000000
+DATA ffd0150c 0ffffff5
+DATA ffd01514 00000000
+DATA ffd0151c 00000000
+DATA ffd01494 00030000
+DATA ffd01498 00000000
+DATA ffd0149c 0000e803
+DATA ffd01480 00000001
diff --git a/arch/arm/boards/globalscale-guruplug/lowlevel.c b/arch/arm/boards/globalscale-guruplug/lowlevel.c
new file mode 100644
index 0000000..d270cda
--- /dev/null
+++ b/arch/arm/boards/globalscale-guruplug/lowlevel.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright (C) 2013 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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 <sizes.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+#include <mach/kirkwood.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+	arm_cpu_lowlevel_init();
+	kirkwood_barebox_entry();
+}
diff --git a/arch/arm/configs/globalscale_guruplug_defconfig b/arch/arm/configs/globalscale_guruplug_defconfig
new file mode 100644
index 0000000..d21de45
--- /dev/null
+++ b/arch/arm/configs/globalscale_guruplug_defconfig
@@ -0,0 +1,6 @@
+CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_KIRKWOOD=y
+CONFIG_TEXT_BASE=0x2000000
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_RESET=y
+CONFIG_DRIVER_SERIAL_NS16550=y
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 92ba009..1d46f87 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -4,12 +4,14 @@ config ARCH_TEXT_BASE
 	hex
 	default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3
 	default 0x2000000 if MACH_GLOBALSCALE_MIRABOX
+	default 0x2000000 if MACH_GLOBALSCALE_GURUPLUG
 	default 0x2000000 if MACH_MARVELL_ARMADA_XP_GP
 	default 0x2000000 if MACH_SOLIDRUN_CUBOX
 
 config BOARDINFO
 	default "PlatHome OpenBlocks AX3" if MACH_PLATHOME_OPENBLOCKS_AX3
 	default "Globalscale Mirabox" if MACH_GLOBALSCALE_MIRABOX
+	default "Globalscale Guruplug" if MACH_GLOBALSCALE_GURUPLUG
 	default "Marvell Armada XP GP" if MACH_MARVELL_ARMADA_XP_GP
 	default "SolidRun CuBox" if MACH_SOLIDRUN_CUBOX
 
@@ -82,6 +84,9 @@ if ARCH_KIRKWOOD
 choice
 	prompt "Kirkwood Board Type"
 
+config MACH_GLOBALSCALE_GURUPLUG
+	bool "Guruplug"
+
 endchoice
 
 endif # ARCH_KIRKWOOD
-- 
1.7.9.5


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

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

* [PATCHv2 10/10] arm: mvebu: remove useless lines in kwbimage.cfg for CuBox
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 09/10] arm: mvebu: add basic support for Globalscale Guruplug board Thomas Petazzoni
@ 2013-05-15  7:36 ` Thomas Petazzoni
  2013-05-15 20:07 ` [PATCHv2 00/10] kwbimage improvements, Kirkwood support Sebastian Hesselbarth
  10 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-15  7:36 UTC (permalink / raw)
  To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia

Thanks to the improvements brought into the kwbimage tool, it is no
longer necessary to have dummy DEST_ADDR and EXEC_ADDR lines in the
kwbimage.cfg file if those values are passed on the command line to
the kwbimage tool, which is what the Barebox build process does.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boards/solidrun-cubox/kwbimage.cfg |    2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/boards/solidrun-cubox/kwbimage.cfg b/arch/arm/boards/solidrun-cubox/kwbimage.cfg
index cb0c360..db35aca 100644
--- a/arch/arm/boards/solidrun-cubox/kwbimage.cfg
+++ b/arch/arm/boards/solidrun-cubox/kwbimage.cfg
@@ -1,7 +1,5 @@
 VERSION 0
 BOOT_FROM spi
-DESTADDR ffffffff # overwritten by kwbimage -c
-EXECADDR ffffffff # overwritten by kwbimage -c
 DATA d0020104 00000000
 DATA d0800020 00022430
 DATA d0800030 00022430
-- 
1.7.9.5


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

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

* Re: [PATCHv2 00/10] kwbimage improvements, Kirkwood support
  2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2013-05-15  7:36 ` [PATCHv2 10/10] arm: mvebu: remove useless lines in kwbimage.cfg for CuBox Thomas Petazzoni
@ 2013-05-15 20:07 ` Sebastian Hesselbarth
  2013-05-17  5:41   ` Sascha Hauer
  10 siblings, 1 reply; 13+ messages in thread
From: Sebastian Hesselbarth @ 2013-05-15 20:07 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: barebox, Lior Amsalem, Ezequiel Garcia

On 05/15/13 09:36, Thomas Petazzoni wrote:
> Hello,
>
> This is a resend of yesterday patch set, rebased on top of the current
> 'next' branch. I have dropped the commits from Sebastian, since they
> have been merged by Sascha, and I've added one commit that fixes the
> SolidRun CuBox kwbimage.cfg to remove some lines that are no longer
> necessary after the kwbimage improvements that are introduced by this
> patch set.
>
> Best regards,
>
> Thomas
>
> Thomas Petazzoni (10):
>    scripts/kwbimage: add a new function image_count_options()
>    scripts/kwbimage: add a few sanity checks
>    scripts/kwbimage: make the v0 image creation more flexible
>    scripts/kwbimage: simplify the v1 image creation
>    scripts/kwbimage: make image_boot_mode_id() return -1 on failure
>    scripts/kwbimage: add support for NAND ECC and page size header
>      fields
>    arm: mvebu: add Feroceon CPU type
>    arm: mvebu: initial support for Marvell Kirkwood SoCs
>    arm: mvebu: add basic support for Globalscale Guruplug board
>    arm: mvebu: remove useless lines in kwbimage.cfg for CuBox

Thomas,

I tested barebox-next with all patches applied on Dove and Armada 370.
So you get my

Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

for all patches not directly related to Kirkwood (patches 7-9).

Sebastian

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

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

* Re: [PATCHv2 00/10] kwbimage improvements, Kirkwood support
  2013-05-15 20:07 ` [PATCHv2 00/10] kwbimage improvements, Kirkwood support Sebastian Hesselbarth
@ 2013-05-17  5:41   ` Sascha Hauer
  0 siblings, 0 replies; 13+ messages in thread
From: Sascha Hauer @ 2013-05-17  5:41 UTC (permalink / raw)
  To: Sebastian Hesselbarth
  Cc: Thomas Petazzoni, barebox, Lior Amsalem, Ezequiel Garcia

On Wed, May 15, 2013 at 10:07:18PM +0200, Sebastian Hesselbarth wrote:
> On 05/15/13 09:36, Thomas Petazzoni wrote:
> >Hello,
> >
> >This is a resend of yesterday patch set, rebased on top of the current
> >'next' branch. I have dropped the commits from Sebastian, since they
> >have been merged by Sascha, and I've added one commit that fixes the
> >SolidRun CuBox kwbimage.cfg to remove some lines that are no longer
> >necessary after the kwbimage improvements that are introduced by this
> >patch set.
> >
> >Best regards,
> >
> >Thomas
> >
> >Thomas Petazzoni (10):
> >   scripts/kwbimage: add a new function image_count_options()
> >   scripts/kwbimage: add a few sanity checks
> >   scripts/kwbimage: make the v0 image creation more flexible
> >   scripts/kwbimage: simplify the v1 image creation
> >   scripts/kwbimage: make image_boot_mode_id() return -1 on failure
> >   scripts/kwbimage: add support for NAND ECC and page size header
> >     fields
> >   arm: mvebu: add Feroceon CPU type
> >   arm: mvebu: initial support for Marvell Kirkwood SoCs
> >   arm: mvebu: add basic support for Globalscale Guruplug board
> >   arm: mvebu: remove useless lines in kwbimage.cfg for CuBox
> 
> Thomas,
> 
> I tested barebox-next with all patches applied on Dove and Armada 370.
> So you get my
> 
> Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>

Thanks for testing

Applied this series.

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	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-05-17  5:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-15  7:36 [PATCHv2 00/10] kwbimage improvements, Kirkwood support Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 01/10] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 02/10] scripts/kwbimage: add a few sanity checks Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 03/10] scripts/kwbimage: make the v0 image creation more flexible Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 04/10] scripts/kwbimage: simplify the v1 image creation Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 05/10] scripts/kwbimage: make image_boot_mode_id() return -1 on failure Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 06/10] scripts/kwbimage: add support for NAND ECC and page size header fields Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 07/10] arm: mvebu: add Feroceon CPU type Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 08/10] arm: mvebu: initial support for Marvell Kirkwood SoCs Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 09/10] arm: mvebu: add basic support for Globalscale Guruplug board Thomas Petazzoni
2013-05-15  7:36 ` [PATCHv2 10/10] arm: mvebu: remove useless lines in kwbimage.cfg for CuBox Thomas Petazzoni
2013-05-15 20:07 ` [PATCHv2 00/10] kwbimage improvements, Kirkwood support Sebastian Hesselbarth
2013-05-17  5:41   ` Sascha Hauer

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