* [PATCH 01/12] scripts/kwbimage: add a new function image_count_options()
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 02/12] scripts/kwbimage: add a few sanity checks Thomas Petazzoni
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 02/12] scripts/kwbimage: add a few sanity checks
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 01/12] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 03/12] scripts/kwbimage: make the v0 image creation more flexible Thomas Petazzoni
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 03/12] scripts/kwbimage: make the v0 image creation more flexible
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 01/12] scripts/kwbimage: add a new function image_count_options() Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 02/12] scripts/kwbimage: add a few sanity checks Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 04/12] scripts/kwbimage: simplify the v1 image creation Thomas Petazzoni
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 04/12] scripts/kwbimage: simplify the v1 image creation
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (2 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 03/12] scripts/kwbimage: make the v0 image creation more flexible Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 05/12] scripts/kwbimage: make image_boot_mode_id() return -1 on failure Thomas Petazzoni
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 05/12] scripts/kwbimage: make image_boot_mode_id() return -1 on failure
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (3 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 04/12] scripts/kwbimage: simplify the v1 image creation Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 06/12] scripts/kwbimage: add support for NAND ECC and page size header fields Thomas Petazzoni
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 06/12] scripts/kwbimage: add support for NAND ECC and page size header fields
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (4 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 05/12] scripts/kwbimage: make image_boot_mode_id() return -1 on failure Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 07/12] arm: mach-mvebu: rename Armada 370/XP core code Thomas Petazzoni
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 07/12] arm: mach-mvebu: rename Armada 370/XP core code
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (5 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 06/12] scripts/kwbimage: add support for NAND ECC and page size header fields Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 08/12] arm: mvebu: initial support for Marvell Dove SoCs Thomas Petazzoni
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 UTC (permalink / raw)
To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
There are more than Armada 370/XP in Marvell MVEBU SoC familiy. To avoid
irritation with source file nameing, we rename setup source file for
Armada 370/XP from core.c to armada-370-xp.c.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/arm/mach-mvebu/Makefile | 3 ++-
arch/arm/mach-mvebu/{core.c => armada-370-xp.c} | 0
2 files changed, 2 insertions(+), 1 deletion(-)
rename arch/arm/mach-mvebu/{core.c => armada-370-xp.c} (100%)
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 820eb10..16d271d 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1 +1,2 @@
-obj-y += core.o
+obj-$(CONFIG_ARCH_ARMADA_370) += armada-370-xp.o
+obj-$(CONFIG_ARCH_ARMADA_XP) += armada-370-xp.o
diff --git a/arch/arm/mach-mvebu/core.c b/arch/arm/mach-mvebu/armada-370-xp.c
similarity index 100%
rename from arch/arm/mach-mvebu/core.c
rename to arch/arm/mach-mvebu/armada-370-xp.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
* [PATCH 08/12] arm: mvebu: initial support for Marvell Dove SoCs
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (6 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 07/12] arm: mach-mvebu: rename Armada 370/XP core code Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 09/12] arm: mvebu: add Feroceon CPU type Thomas Petazzoni
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 UTC (permalink / raw)
To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
This commit adds minimal support for the Marvell Dove SoC (88AP510) as
first SoC of the Marvell Orion family. Orion SoCs have a different timer,
therefore current mach-mvebu and Armada 370/XP Kconfig and Makefiles are
slightly modified and a new clocksource drivers is added.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/arm/Kconfig | 1 -
arch/arm/mach-mvebu/Kconfig | 16 +++
arch/arm/mach-mvebu/Makefile | 1 +
arch/arm/mach-mvebu/dove.c | 161 ++++++++++++++++++++++++++
arch/arm/mach-mvebu/include/mach/dove-regs.h | 59 ++++++++++
arch/arm/mach-mvebu/include/mach/dove.h | 23 ++++
drivers/clocksource/Kconfig | 4 +
drivers/clocksource/Makefile | 1 +
drivers/clocksource/orion.c | 76 ++++++++++++
9 files changed, 341 insertions(+), 1 deletion(-)
create mode 100644 arch/arm/mach-mvebu/dove.c
create mode 100644 arch/arm/mach-mvebu/include/mach/dove-regs.h
create mode 100644 arch/arm/mach-mvebu/include/mach/dove.h
create mode 100644 drivers/clocksource/orion.c
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a044ab3..cfb82b0 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -82,7 +82,6 @@ config ARCH_IMX
config ARCH_MVEBU
bool "Marvell EBU platforms"
select COMMON_CLK
- select CLOCKSOURCE_MVEBU
select CLKDEV_LOOKUP
select HAS_DEBUG_LL
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index e553e2d..c02eea1 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -17,10 +17,17 @@ choice
config ARCH_ARMADA_370
bool "Armada 370"
select CPU_V7
+ select CLOCKSOURCE_MVEBU
config ARCH_ARMADA_XP
bool "Armada XP"
select CPU_V7
+ select CLOCKSOURCE_MVEBU
+
+config ARCH_DOVE
+ bool "Dove 88AP510"
+ select CPU_V7
+ select CLOCKSOURCE_ORION
endchoice
@@ -51,4 +58,13 @@ endchoice
endif # ARCH_ARMADA_XP
+if ARCH_DOVE
+
+choice
+ prompt "Dove 88AP510 Board Type"
+
+endchoice
+
+endif # ARCH_DOVE
+
endif # ARCH_MVEBU
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 16d271d..043f08f 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -1,2 +1,3 @@
obj-$(CONFIG_ARCH_ARMADA_370) += armada-370-xp.o
obj-$(CONFIG_ARCH_ARMADA_XP) += armada-370-xp.o
+obj-$(CONFIG_ARCH_DOVE) += dove.o
diff --git a/arch/arm/mach-mvebu/dove.c b/arch/arm/mach-mvebu/dove.c
new file mode 100644
index 0000000..f073596
--- /dev/null
+++ b/arch/arm/mach-mvebu/dove.c
@@ -0,0 +1,161 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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/dove-regs.h>
+#include <asm/memory.h>
+#include <asm/barebox-arm.h>
+
+static struct clk *tclk;
+
+static inline void dove_remap_reg_base(uint32_t intbase,
+ uint32_t mcbase)
+{
+ uint32_t val;
+
+ /* remap ahb slave base */
+ val = readl(DOVE_CPU_CTRL) & 0xffff0000;
+ val |= (mcbase & 0xffff0000) >> 16;
+ writel(val, DOVE_CPU_CTRL);
+
+ /* remap axi bridge address */
+ val = readl(DOVE_AXI_CTRL) & 0x007fffff;
+ val |= mcbase & 0xff800000;
+ writel(val, DOVE_AXI_CTRL);
+
+ /* remap memory controller base address */
+ val = readl(DOVE_SDRAM_BASE + SDRAM_REGS_BASE_DECODE) & 0x0000ffff;
+ val |= mcbase & 0xffff0000;
+ writel(val, DOVE_SDRAM_BASE + SDRAM_REGS_BASE_DECODE);
+
+ /* remap internal register */
+ val = intbase & 0xfff00000;
+ writel(val, DOVE_BRIDGE_BASE + INT_REGS_BASE_MAP);
+}
+
+static inline void dove_memory_find(unsigned long *phys_base,
+ unsigned long *phys_size)
+{
+ int n;
+
+ *phys_base = ~0;
+ *phys_size = 0;
+
+ for (n = 0; n < 2; n++) {
+ uint32_t map = readl(DOVE_SDRAM_BASE + SDRAM_MAPn(n));
+ uint32_t base, size;
+
+ /* skip disabled areas */
+ if ((map & SDRAM_MAP_VALID) != SDRAM_MAP_VALID)
+ continue;
+
+ base = map & SDRAM_START_MASK;
+ if (base < *phys_base)
+ *phys_base = base;
+
+ /* real size is encoded as ld(2^(16+length)) */
+ size = (map & SDRAM_LENGTH_MASK) >> SDRAM_LENGTH_SHIFT;
+ *phys_size += 1 << (16 + size);
+ }
+}
+
+void __naked __noreturn dove_barebox_entry(void)
+{
+ unsigned long phys_base, phys_size;
+ dove_memory_find(&phys_base, &phys_size);
+ barebox_arm_entry(phys_base, phys_size, 0);
+}
+
+static struct NS16550_plat uart_plat[] = {
+ [0] = { .shift = 2, },
+ [1] = { .shift = 2, },
+ [2] = { .shift = 2, },
+ [3] = { .shift = 2, },
+};
+
+int dove_add_uart(int num)
+{
+ struct NS16550_plat *plat;
+
+ if (num < 0 || num > 4)
+ return -EINVAL;
+
+ plat = &uart_plat[num];
+ plat->clock = clk_get_rate(tclk);
+ if (!add_ns16550_device(DEVICE_ID_DYNAMIC,
+ (unsigned int)DOVE_UARTn_BASE(num),
+ 32, IORESOURCE_MEM_32BIT, plat))
+ return -ENODEV;
+ return 0;
+}
+
+/*
+ * Dove TCLK sample-at-reset configuation
+ *
+ * SAR0[24:23] : TCLK frequency
+ * 0 = 166 MHz
+ * 1 = 125 MHz
+ * others reserved.
+ */
+static int dove_init_clocks(void)
+{
+ uint32_t strap, sar = readl(DOVE_SAR_BASE + SAR0);
+ unsigned int rate;
+
+ strap = (sar & TCLK_FREQ_MASK) >> TCLK_FREQ_SHIFT;
+ switch (strap) {
+ case 0:
+ rate = 166666667;
+ break;
+ case 1:
+ rate = 125000000;
+ break;
+ default:
+ panic("Unknown TCLK strapping %d\n", strap);
+ }
+
+ tclk = clk_fixed("tclk", rate);
+ return clk_register_clkdev(tclk, NULL, "orion-timer");
+}
+
+static int dove_init_soc(void)
+{
+ unsigned long phys_base, phys_size;
+
+ dove_init_clocks();
+ add_generic_device("orion-timer", DEVICE_ID_SINGLE, NULL,
+ (unsigned int)DOVE_TIMER_BASE, 0x30,
+ IORESOURCE_MEM, NULL);
+ dove_memory_find(&phys_base, &phys_size);
+ arm_add_mem_device("ram0", phys_base, phys_size);
+ return 0;
+}
+postcore_initcall(dove_init_soc);
+
+void __noreturn reset_cpu(unsigned long addr)
+{
+ /* enable and assert RSTOUTn */
+ writel(SOFT_RESET_OUT_EN, DOVE_BRIDGE_BASE + BRIDGE_RSTOUT_MASK);
+ writel(SOFT_RESET_EN, DOVE_BRIDGE_BASE + BRIDGE_SYS_SOFT_RESET);
+ while (1)
+ ;
+}
+EXPORT_SYMBOL(reset_cpu);
diff --git a/arch/arm/mach-mvebu/include/mach/dove-regs.h b/arch/arm/mach-mvebu/include/mach/dove-regs.h
new file mode 100644
index 0000000..5e20368
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/dove-regs.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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_DOVE_REGS_H
+#define __MACH_MVEBU_DOVE_REGS_H
+
+/* At Boot-up register base is at 0xd000000 */
+#define DOVE_INT_REGS_BOOTUP 0xd0000000
+#define DOVE_MC_REGS_BOOTUP 0xd0800000
+/* Linux wants it remapped to 0xf1000000 */
+#define DOVE_INT_REGS_REMAP 0xf1000000
+#define DOVE_MC_REGS_REMAP 0xf1800000
+
+#define DOVE_INT_REGS_BASE IOMEM(DOVE_INT_REGS_BOOTUP)
+#define DOVE_MC_REGS_BASE IOMEM(DOVE_MC_REGS_BOOTUP)
+
+#define DOVE_UART_BASE (DOVE_INT_REGS_BASE + 0x12000)
+#define DOVE_UARTn_BASE(n) (DOVE_UART_BASE + ((n) * 0x100))
+
+#define DOVE_BRIDGE_BASE (DOVE_INT_REGS_BASE + 0x20000)
+#define INT_REGS_BASE_MAP 0x080
+#define BRIDGE_RSTOUT_MASK 0x108
+#define SOFT_RESET_OUT_EN BIT(2)
+#define BRIDGE_SYS_SOFT_RESET 0x10c
+#define SOFT_RESET_EN BIT(0)
+#define DOVE_TIMER_BASE (DOVE_INT_REGS_BASE + 0x20300)
+
+#define DOVE_SAR_BASE (DOVE_INT_REGS_BASE + 0xd0214)
+#define SAR0 0x000
+#define TCLK_FREQ_SHIFT 23
+#define TCLK_FREQ_MASK (0x3 << TCLK_FREQ_SHIFT)
+#define SAR1 0x004
+
+#define DOVE_AXI_CTRL (DOVE_INT_REGS_BASE + 0xd0224)
+#define DOVE_CPU_CTRL (DOVE_INT_REGS_BASE + 0xd025c)
+
+#define DOVE_SDRAM_BASE (DOVE_MC_REGS_BASE)
+#define SDRAM_REGS_BASE_DECODE 0x010
+#define SDRAM_MAPn(n) (0x100 + ((n) * 0x10))
+#define SDRAM_START_MASK (0x1ff << 23)
+#define SDRAM_LENGTH_SHIFT 16
+#define SDRAM_LENGTH_MASK (0x00f << SDRAM_LENGTH_SHIFT)
+#define SDRAM_ADDRESS_MASK (0x1ff << 7)
+#define SDRAM_MAP_VALID BIT(0)
+
+#endif /* __MACH_MVEBU_DOVE_REGS_H */
diff --git a/arch/arm/mach-mvebu/include/mach/dove.h b/arch/arm/mach-mvebu/include/mach/dove.h
new file mode 100644
index 0000000..1712fa7
--- /dev/null
+++ b/arch/arm/mach-mvebu/include/mach/dove.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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_DOVE_H
+#define __MACH_MVEBU_DOVE_H
+
+int dove_add_uart(int num);
+void __naked __noreturn dove_barebox_entry(void);
+
+#endif /* __MACH_MVEBU_DOVE_H */
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index dfc89dd..4ef25ec 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -21,3 +21,7 @@ config CLOCKSOURCE_MVEBU
config CLOCKSOURCE_NOMADIK
bool
depends on ARM
+
+config CLOCKSOURCE_ORION
+ bool
+ depends on ARCH_MVEBU
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 0b42ce4..25b7f46 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -4,3 +4,4 @@ obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o
obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o
obj-$(CONFIG_CLOCKSOURCE_MVEBU) += mvebu.o
obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
+obj-$(CONFIG_CLOCKSOURCE_ORION) += orion.o
diff --git a/drivers/clocksource/orion.c b/drivers/clocksource/orion.c
new file mode 100644
index 0000000..604b414
--- /dev/null
+++ b/drivers/clocksource/orion.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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 <clock.h>
+#include <linux/clk.h>
+#include <io.h>
+
+#define TIMER_CTRL 0x00
+#define TIMER0_EN BIT(0)
+#define TIMER0_RELOAD_EN BIT(1)
+#define TIMER1_EN BIT(2)
+#define TIMER1_RELOAD_EN BIT(3)
+#define TIMER0_RELOAD 0x10
+#define TIMER0_VAL 0x14
+#define TIMER1_RELOAD 0x18
+#define TIMER1_VAL 0x1c
+
+static __iomem void *timer_base;
+
+static uint64_t orion_clocksource_read(void)
+{
+ return __raw_readl(timer_base + TIMER0_VAL);
+}
+
+static struct clocksource clksrc = {
+ .read = orion_clocksource_read,
+ .mask = CLOCKSOURCE_MASK(32),
+ .shift = 10,
+};
+
+static int orion_timer_probe(struct device_d *dev)
+{
+ struct clk *tclk;
+ uint32_t val;
+
+ timer_base = dev_request_mem_region(dev, 0);
+ tclk = clk_get(dev, "tclk");
+
+ /* setup TIMER0 as free-running clock source */
+ __raw_writel(~0, timer_base + TIMER0_VAL);
+ __raw_writel(~0, timer_base + TIMER0_RELOAD);
+ val = __raw_readl(timer_base + TIMER_CTRL);
+ __raw_writel(val | TIMER0_EN | TIMER0_RELOAD_EN,
+ timer_base + TIMER_CTRL);
+
+ clksrc.mult = clocksource_hz2mult(clk_get_rate(tclk), clksrc.shift);
+ init_clock(&clksrc);
+
+ return 0;
+}
+
+static struct driver_d orion_timer_driver = {
+ .name = "orion-timer",
+ .probe = orion_timer_probe,
+};
+
+static int orion_timer_init(void)
+{
+ return platform_driver_register(&orion_timer_driver);
+}
+postcore_initcall(orion_timer_init);
--
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
* [PATCH 09/12] arm: mvebu: add Feroceon CPU type
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (7 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 08/12] arm: mvebu: initial support for Marvell Dove SoCs Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 10/12] arm: mvebu: initial support for Marvell Kirkwood SoCs Thomas Petazzoni
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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
* [PATCH 10/12] arm: mvebu: initial support for Marvell Kirkwood SoCs
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (8 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 09/12] arm: mvebu: add Feroceon CPU type Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 11/12] arm: mvebu: add basic support for SolidRun CuBox Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 12/12] arm: mvebu: add basic support for Globalscale Guruplug board Thomas Petazzoni
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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 c02eea1..d7d5c1f 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -29,6 +29,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
@@ -67,4 +72,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
* [PATCH 11/12] arm: mvebu: add basic support for SolidRun CuBox
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (9 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 10/12] arm: mvebu: initial support for Marvell Kirkwood SoCs Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
2013-05-14 22:32 ` [PATCH 12/12] arm: mvebu: add basic support for Globalscale Guruplug board Thomas Petazzoni
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 UTC (permalink / raw)
To: barebox; +Cc: Lior Amsalem, Ezequiel Garcia
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
The SolidRun CuBox is a small cubic platform based on the Marvell
Dove SoC. There is nothing more than a console, yet.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
arch/arm/Makefile | 1 +
arch/arm/boards/solidrun-cubox/Makefile | 2 ++
arch/arm/boards/solidrun-cubox/config.h | 4 +++
arch/arm/boards/solidrun-cubox/kwbimage.cfg | 37 +++++++++++++++++++++++
arch/arm/boards/solidrun-cubox/lowlevel.c | 26 ++++++++++++++++
arch/arm/boards/solidrun-cubox/solidrun-cubox.c | 28 +++++++++++++++++
arch/arm/configs/solidrun_cubox_defconfig | 9 ++++++
arch/arm/mach-mvebu/Kconfig | 5 +++
8 files changed, 112 insertions(+)
create mode 100644 arch/arm/boards/solidrun-cubox/Makefile
create mode 100644 arch/arm/boards/solidrun-cubox/config.h
create mode 100644 arch/arm/boards/solidrun-cubox/kwbimage.cfg
create mode 100644 arch/arm/boards/solidrun-cubox/lowlevel.c
create mode 100644 arch/arm/boards/solidrun-cubox/solidrun-cubox.c
create mode 100644 arch/arm/configs/solidrun_cubox_defconfig
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index af8294d..8f17e7e 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -147,6 +147,7 @@ board-$(CONFIG_MACH_MINI6410) := friendlyarm-mini6410
board-$(CONFIG_MACH_TINY6410) := friendlyarm-tiny6410
board-$(CONFIG_MACH_PLATHOME_OPENBLOCKS_AX3) := plathome-openblocks-ax3
board-$(CONFIG_MACH_QIL_A9260) := qil-a9260
+board-$(CONFIG_MACH_SOLIDRUN_CUBOX) := solidrun-cubox
board-$(CONFIG_MACH_TNY_A9260) := tny-a926x
board-$(CONFIG_MACH_TNY_A9263) := tny-a926x
board-$(CONFIG_MACH_TNY_A9G20) := tny-a926x
diff --git a/arch/arm/boards/solidrun-cubox/Makefile b/arch/arm/boards/solidrun-cubox/Makefile
new file mode 100644
index 0000000..6dfe2c8
--- /dev/null
+++ b/arch/arm/boards/solidrun-cubox/Makefile
@@ -0,0 +1,2 @@
+obj-y = solidrun-cubox.o
+lwl-y += lowlevel.o
diff --git a/arch/arm/boards/solidrun-cubox/config.h b/arch/arm/boards/solidrun-cubox/config.h
new file mode 100644
index 0000000..ca15136
--- /dev/null
+++ b/arch/arm/boards/solidrun-cubox/config.h
@@ -0,0 +1,4 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#endif /* __CONFIG_H */
diff --git a/arch/arm/boards/solidrun-cubox/kwbimage.cfg b/arch/arm/boards/solidrun-cubox/kwbimage.cfg
new file mode 100644
index 0000000..db35aca
--- /dev/null
+++ b/arch/arm/boards/solidrun-cubox/kwbimage.cfg
@@ -0,0 +1,37 @@
+VERSION 0
+BOOT_FROM spi
+DATA d0020104 00000000
+DATA d0800020 00022430
+DATA d0800030 00022430
+DATA d0800050 911500c3
+DATA d0800060 646602c4
+DATA d0800190 c2003053
+DATA d08001c0 34f4a187
+DATA d0800650 000f0121
+DATA d0800660 04040200
+DATA d0800080 00000000
+DATA d0800090 00080000
+DATA d08000f0 c0000000
+DATA d08001a0 20c0c009
+DATA d0800280 010e0202
+DATA d0800760 00000000
+DATA d0800770 0000000a
+DATA d0800140 20004044
+DATA d08001d0 133c2339
+DATA d08001e0 07700330
+DATA d08001f0 00000033
+DATA d0800200 0011311c
+DATA d0800210 00300000
+DATA d0800240 80000000
+DATA d0800510 010e0101
+DATA d0800230 2028006a
+DATA d0800e10 00280062
+DATA d0800e20 00280062
+DATA d0800e30 00280062
+DATA d0800100 000d0001
+DATA d0800110 200d0001
+DATA d0020104 00000000
+DATA d0020104 00000000
+DATA d0020104 00000000
+DATA d0020104 00000000
+DATA d0020104 00000000
diff --git a/arch/arm/boards/solidrun-cubox/lowlevel.c b/arch/arm/boards/solidrun-cubox/lowlevel.c
new file mode 100644
index 0000000..8a06cbc
--- /dev/null
+++ b/arch/arm/boards/solidrun-cubox/lowlevel.c
@@ -0,0 +1,26 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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 <mach/dove.h>
+#include <asm/barebox-arm.h>
+#include <asm/barebox-arm-head.h>
+
+void __naked barebox_arm_reset_vector(void)
+{
+ arm_cpu_lowlevel_init();
+ dove_barebox_entry();
+}
diff --git a/arch/arm/boards/solidrun-cubox/solidrun-cubox.c b/arch/arm/boards/solidrun-cubox/solidrun-cubox.c
new file mode 100644
index 0000000..60acc3b
--- /dev/null
+++ b/arch/arm/boards/solidrun-cubox/solidrun-cubox.c
@@ -0,0 +1,28 @@
+/*
+ * Copyright
+ * (C) 2013 Sebastian Hesselbarth <sebastian.hesselbarth@gmail.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 <mach/dove.h>
+
+#include <mach/debug_ll.h>
+
+static int solidrun_cubox_console_init(void)
+{
+ return dove_add_uart(0);
+}
+
+console_initcall(solidrun_cubox_console_init);
diff --git a/arch/arm/configs/solidrun_cubox_defconfig b/arch/arm/configs/solidrun_cubox_defconfig
new file mode 100644
index 0000000..1a27d81
--- /dev/null
+++ b/arch/arm/configs/solidrun_cubox_defconfig
@@ -0,0 +1,9 @@
+CONFIG_ARCH_MVEBU=y
+CONFIG_ARCH_DOVE=y
+CONFIG_AEABI=y
+CONFIG_DEBUG_LL=y
+CONFIG_CMD_LOADY=y
+CONFIG_CMD_LOADS=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_CLK=y
+CONFIG_DRIVER_SERIAL_NS16550=y
diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index d7d5c1f..92ba009 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -5,11 +5,13 @@ config ARCH_TEXT_BASE
default 0x2000000 if MACH_PLATHOME_OPENBLOCKS_AX3
default 0x2000000 if MACH_GLOBALSCALE_MIRABOX
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 "Marvell Armada XP GP" if MACH_MARVELL_ARMADA_XP_GP
+ default "SolidRun CuBox" if MACH_SOLIDRUN_CUBOX
choice
prompt "Marvell EBU Processor"
@@ -68,6 +70,9 @@ if ARCH_DOVE
choice
prompt "Dove 88AP510 Board Type"
+config MACH_SOLIDRUN_CUBOX
+ bool "SolidRun CuBox"
+
endchoice
endif # ARCH_DOVE
--
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
* [PATCH 12/12] arm: mvebu: add basic support for Globalscale Guruplug board
2013-05-14 22:32 [PATCH 00/12] Support for Marvell Kirkwood and Dove SoCs Thomas Petazzoni
` (10 preceding siblings ...)
2013-05-14 22:32 ` [PATCH 11/12] arm: mvebu: add basic support for SolidRun CuBox Thomas Petazzoni
@ 2013-05-14 22:32 ` Thomas Petazzoni
11 siblings, 0 replies; 13+ messages in thread
From: Thomas Petazzoni @ 2013-05-14 22:32 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