mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] i2c-mux-pca954x: Add code to control reset line
From: Andrey Smirnov @ 2016-11-15 14:46 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

Most recent device tree binding for that mux support specifying a GPIO
connected to a reset line of that chip. Add code to handle that binding
in order to be able to use the chip on boards that leverage
aforementioned functionality.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index baeae7b..0d5515b 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -45,6 +45,8 @@
 #include <i2c/i2c-algo-bit.h>
 #include <i2c/i2c-mux.h>
 #include <init.h>
+#include <gpio.h>
+#include <of_gpio.h>
 
 #define PCA954X_MAX_NCHANS 8
 
@@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev)
 	int num, force;
 	struct pca954x *data;
 	int ret = -ENODEV;
+	int gpio;
 
 	data = kzalloc(sizeof(struct pca954x), GFP_KERNEL);
 	if (!data) {
@@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev)
 
 	i2c_set_clientdata(client, data);
 
+	gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0);
+	if (gpio_is_valid(gpio))
+		gpio_direction_output(gpio, 1);
+
 	/* Read the mux register at addr to verify
 	 * that the mux is in fact present.
 	 */
-- 
2.5.5


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

^ permalink raw reply related

* [PATCH 1/2] fixup! pinctrl: Add provisions to control GPIO pin direction
From: Andrey Smirnov @ 2016-11-15 16:22 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov

---

Sascha:

These two are fixup for issues in my Vybrid patch series, patch #2 is
for the issue you experienced and this one is for another issue I
found when building cupid_defconfig.

If you'd rather I post v3 version of the patchset with all of this
incorporated, let me know.

Thanks,
Andrey

 include/pinctrl.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/pinctrl.h b/include/pinctrl.h
index 0fde3f9..7d87169 100644
--- a/include/pinctrl.h
+++ b/include/pinctrl.h
@@ -49,7 +49,7 @@ static inline int of_pinctrl_select_state_default(struct device_node *np)
 	return -ENODEV;
 }
 
-static inline int pinctrl_gpio_direction_input(unsigend pin)
+static inline int pinctrl_gpio_direction_input(unsigned pin)
 {
 	return -ENOTSUPP;
 }
-- 
2.5.5


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

^ permalink raw reply related

* [PATCH 2/2] fixup! clk: Port of_clk_set_defaults()
From: Andrey Smirnov @ 2016-11-15 16:22 UTC (permalink / raw)
  To: barebox; +Cc: Andrey Smirnov
In-Reply-To: <1479226976-12563-1-git-send-email-andrew.smirnov@gmail.com>

---
 drivers/clk/clk-conf.c       | 4 ++++
 include/linux/clk/clk-conf.h | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c
index 961fad8..93271b4 100644
--- a/drivers/clk/clk-conf.c
+++ b/drivers/clk/clk-conf.c
@@ -14,6 +14,8 @@
 #include <linux/err.h>
 #include <linux/clk/clk-conf.h>
 
+#if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER)
+
 static int __set_clk_parents(struct device_node *node, bool clk_supplier)
 {
 	struct of_phandle_args clkspec;
@@ -142,3 +144,5 @@ int of_clk_set_defaults(struct device_node *node, bool clk_supplier)
 	return __set_clk_rates(node, clk_supplier);
 }
 EXPORT_SYMBOL_GPL(of_clk_set_defaults);
+
+#endif
diff --git a/include/linux/clk/clk-conf.h b/include/linux/clk/clk-conf.h
index 0b8a973..8f4382e 100644
--- a/include/linux/clk/clk-conf.h
+++ b/include/linux/clk/clk-conf.h
@@ -7,8 +7,11 @@
  * published by the Free Software Foundation.
  */
 
+#if defined(CONFIG_OFTREE) && defined(CONFIG_COMMON_CLK_OF_PROVIDER)
+
 #include <linux/types.h>
 
 struct device_node;
 int of_clk_set_defaults(struct device_node *node, bool clk_supplier);
 
+#endif
-- 
2.5.5


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

^ permalink raw reply related

* [PATCH 2/3] scripts/kwbimage: use ALIGN_SUP instead of open-coding it
From: Uwe Kleine-König @ 2016-11-16  9:11 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116091139.15674-1-u.kleine-koenig@pengutronix.de>

---
 scripts/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 15726e066a01..57f563ece651 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -887,7 +887,7 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 		}
 
 		/* payload size must be multiple of 32b */
-		payloadsz = 4 * ((s.st_size + 3)/4);
+		payloadsz = ALIGN_SUP(s.st_size, 4);
 	}
 
 	/* The payload should be aligned on some reasonable
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH 3/3] scripts/kwbimage: fix handling of binary header
From: Uwe Kleine-König @ 2016-11-16  9:11 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116091139.15674-1-u.kleine-koenig@pengutronix.de>

A binary header is 12 bytes + (4 bytes * Number of Arguments) bigger
than the actual binary. Before this commit image extraction was wrong an
made binary.0 too big by four bytes at the end (which were 0 in all usual
cases). Image creation had the same problem which resulted in broken
images when the binary doesn't end in 4 bytes containing 0.

Further handle binaries with a length that is not aligned to 4 bytes.

Note this is an incompatible change in the sense that a binary.0 that is
extracted with the new code cannot be used by the old code. The other
way around works however unless the image does very strange things.

If you find this commit during bisection, try appending 4 zero bytes to
your binary.0.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 scripts/kwbimage.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 57f563ece651..5b84db3f7a23 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -491,7 +491,7 @@ static int image_extract_binary_hdr_v1(const void *binary, const char *output,
 	}
 
 	ret = fwrite(binary + (nargs + 1) * sizeof(unsigned int),
-		     binsz - (nargs + 1) * sizeof(unsigned int), 1,
+		     binsz - (nargs + 2) * sizeof(unsigned int), 1,
 		     binaryout);
 	if (ret != 1) {
 		fprintf(stderr, "Could not write to output file %s\n",
@@ -870,8 +870,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 			return NULL;
 		}
 
-		headersz += s.st_size +
-			binarye->binary.nargs * sizeof(unsigned int);
+		headersz += ALIGN_SUP(s.st_size, 4) +
+			12 + binarye->binary.nargs * sizeof(unsigned int);
 		hasext = 1;
 	}
 
@@ -952,8 +952,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 		fstat(fileno(bin), &s);
 
 		binhdrsz = sizeof(struct opt_hdr_v1) +
-			(binarye->binary.nargs + 1) * sizeof(unsigned int) +
-			s.st_size;
+			(binarye->binary.nargs + 2) * sizeof(unsigned int) +
+			ALIGN_SUP(s.st_size, 4);
 		hdr->headersz_lsb = binhdrsz & 0xFFFF;
 		hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
 
@@ -977,7 +977,7 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 
 		fclose(bin);
 
-		cur += s.st_size;
+		cur += ALIGN_SUP(s.st_size, 4);
 
 		/*
 		 * For now, we don't support more than one binary
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH 1/3] scripts/kwbimage: fix typo
From: Uwe Kleine-König @ 2016-11-16  9:11 UTC (permalink / raw)
  To: barebox

---
 scripts/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index eabd09f45d42..15726e066a01 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -524,7 +524,7 @@ static int image_extract_v1(void *fdimap, const char *output, FILE *focfg)
 	int opthdrid;
 
 	/*
-	 * Verify the checkum. We have to substract the checksum
+	 * Verify the checksum. We have to subtract the checksum
 	 * itself, because when the checksum is calculated, the
 	 * checksum field is 0.
 	 */
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH v2 3/4] scripts/kwbimage: use ALIGN_SUP instead of open-coding it
From: Uwe Kleine-König @ 2016-11-16  9:52 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116095244.14288-1-u.kleine-koenig@pengutronix.de>

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1:
 - add S-o-b

 scripts/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 79ca85b72d8e..2af96f055c7e 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -886,7 +886,7 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 		}
 
 		/* payload size must be multiple of 32b */
-		payloadsz = 4 * ((s.st_size + 3)/4);
+		payloadsz = ALIGN_SUP(s.st_size, 4);
 	}
 
 	/* The payload should be aligned on some reasonable
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH v2 1/4] scripts/kwbimage: fix handling of binary header
From: Uwe Kleine-König @ 2016-11-16  9:52 UTC (permalink / raw)
  To: barebox

A binary header is 12 bytes + (4 bytes * Number of Arguments) bigger
than the actual binary. Before this commit image extraction was wrong an
made binary.0 too big by four bytes at the end (which were 0 in all usual
cases). Image creation had the same problem which resulted in broken
images when the binary doesn't end in 4 bytes containing 0.

Further handle binaries with a length that is not aligned to 4 bytes.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1:
 - make it patch 1 as it is a fix

 scripts/kwbimage.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 448ac2a5d416..c560f581a727 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -490,7 +490,7 @@ static int image_extract_binary_hdr_v1(const void *binary, const char *output,
 	}
 
 	ret = fwrite(binary + (nargs + 1) * sizeof(unsigned int),
-		     binsz - (nargs + 1) * sizeof(unsigned int), 1,
+		     binsz - (nargs + 2) * sizeof(unsigned int), 1,
 		     binaryout);
 	if (ret != 1) {
 		fprintf(stderr, "Could not write to output file %s\n",
@@ -869,8 +869,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 			return NULL;
 		}
 
-		headersz += s.st_size +
-			binarye->binary.nargs * sizeof(unsigned int);
+		headersz += ALIGN_SUP(s.st_size, 4) +
+			12 + binarye->binary.nargs * sizeof(unsigned int);
 		hasext = 1;
 	}
 
@@ -951,8 +951,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 		fstat(fileno(bin), &s);
 
 		binhdrsz = sizeof(struct opt_hdr_v1) +
-			(binarye->binary.nargs + 1) * sizeof(unsigned int) +
-			s.st_size;
+			(binarye->binary.nargs + 2) * sizeof(unsigned int) +
+			ALIGN_SUP(s.st_size, 4);
 		hdr->headersz_lsb = binhdrsz & 0xFFFF;
 		hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
 
@@ -976,7 +976,7 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
 
 		fclose(bin);
 
-		cur += s.st_size;
+		cur += ALIGN_SUP(s.st_size, 4);
 
 		/*
 		 * For now, we don't support more than one binary
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH v2 4/4] scripts/kwbimage: allow to overwrite binary
From: Uwe Kleine-König @ 2016-11-16  9:52 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116095244.14288-1-u.kleine-koenig@pengutronix.de>

This is a preparation to let barebox provide the binary.0.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
This is new in this series and a left over from my efforts to let
barebox implement the functionality of binary.0. For now that failed,
but this patch should be fine anyhow.

Best regards
Uwe

 scripts/kwbimage.c | 40 +++++++++++++++++++++++++++++++++++-----
 1 file changed, 35 insertions(+), 5 deletions(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index 2af96f055c7e..5b84db3f7a23 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -347,6 +347,7 @@ static void usage(const char *prog)
 	printf("   -h: this help text\n");
 	printf(" Options specific to image creation:\n");
 	printf("   -p: path to payload image. Overrides the PAYLOAD line from kwbimage.cfg\n");
+	printf("   -b: path to binary image. Overrides the BINARY line from kwbimage.cfg\n");
 	printf("   -m: boot media. Overrides the BOOT_FROM line from kwbimage.cfg\n");
 	printf("   -d: load address. Overrides the DEST_ADDR line from kwbimage.cfg\n");
 	printf("   -e: exec address. Overrides the EXEC_ADDR line from kwbimage.cfg\n");
@@ -1186,6 +1187,30 @@ static int image_override_payload(struct image_cfg_element *image_cfg,
 	return 0;
 }
 
+static int image_override_binary(struct image_cfg_element *image_cfg,
+				 int *cfgn, char *binary)
+{
+	struct image_cfg_element *e;
+	int cfgi = *cfgn;
+
+	if (!binary)
+		return 0;
+
+	e = image_find_option(image_cfg, *cfgn, IMAGE_CFG_BINARY);
+	if (e) {
+		e->binary.file = binary;
+		return 0;
+	}
+
+	image_cfg[cfgi].type = IMAGE_CFG_BINARY;
+	image_cfg[cfgi].binary.file = binary;
+	image_cfg[cfgi].binary.nargs = 0;
+	cfgi++;
+
+	*cfgn = cfgi;
+	return 0;
+}
+
 static int image_override_bootmedia(struct image_cfg_element *image_cfg,
 				    int *cfgn, const char *bootmedia)
 {
@@ -1332,9 +1357,9 @@ static void image_dump_config(struct image_cfg_element *image_cfg,
 }
 
 static int image_create(const char *input, const char *output,
-			const char *payload, const char *bootmedia,
-			uint32_t dstaddr, uint32_t execaddr,
-			int verbose)
+			const char *payload, char *binary,
+			const char *bootmedia, uint32_t dstaddr,
+			uint32_t execaddr, int verbose)
 {
 	struct image_cfg_element *image_cfg;
 	FILE *outputimg;
@@ -1361,6 +1386,7 @@ static int image_create(const char *input, const char *output,
 	}
 
 	image_override_payload(image_cfg, &cfgn, payload);
+	image_override_binary(image_cfg, &cfgn, binary);
 	image_override_bootmedia(image_cfg, &cfgn, bootmedia);
 	image_override_dstaddr(image_cfg, &cfgn, dstaddr);
 	image_override_execaddr(image_cfg, &cfgn, execaddr);
@@ -1433,9 +1459,10 @@ int main(int argc, char *argv[])
 	int action = -1, opt, verbose = 0;
 	const char *input = NULL, *output = NULL,
 		*payload = NULL, *bootmedia = NULL;
+	char *binary = NULL;
 	uint32_t execaddr = ADDR_INVALID, dstaddr = ADDR_INVALID;
 
-	while ((opt = getopt(argc, argv, "hxci:o:p:m:e:d:v")) != -1) {
+	while ((opt = getopt(argc, argv, "hxci:o:p:b:m:e:d:v")) != -1) {
 		switch (opt) {
 		case 'x':
 			action = ACTION_EXTRACT;
@@ -1452,6 +1479,9 @@ int main(int argc, char *argv[])
 		case 'p':
 			payload = optarg;
 			break;
+		case 'b':
+			binary = optarg;
+			break;
 		case 'm':
 			bootmedia = optarg;
 			break;
@@ -1502,7 +1532,7 @@ int main(int argc, char *argv[])
 	case ACTION_EXTRACT:
 		return image_extract(input, output);
 	case ACTION_CREATE:
-		return image_create(input, output, payload,
+		return image_create(input, output, payload, binary,
 				    bootmedia, dstaddr, execaddr,
 				    verbose);
 	case ACTION_HELP:
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH v2 2/4] scripts/kwbimage: fix typo
From: Uwe Kleine-König @ 2016-11-16  9:52 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116095244.14288-1-u.kleine-koenig@pengutronix.de>

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1:
 - add S-o-b

 scripts/kwbimage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
index c560f581a727..79ca85b72d8e 100644
--- a/scripts/kwbimage.c
+++ b/scripts/kwbimage.c
@@ -523,7 +523,7 @@ static int image_extract_v1(void *fdimap, const char *output, FILE *focfg)
 	int opthdrid;
 
 	/*
-	 * Verify the checkum. We have to substract the checksum
+	 * Verify the checksum. We have to subtract the checksum
 	 * itself, because when the checksum is calculated, the
 	 * checksum field is 0.
 	 */
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH 1/3] i2c: gpio: fix handling of return code of of_get_gpio
From: Uwe Kleine-König @ 2016-11-16 12:18 UTC (permalink / raw)
  To: barebox

Instead of using gpio_is_valid just check the return code of of_get_gpio
for being < 0. This fixes -EPROBE_DEFER handling as now this error code
is handed to the caller instead of -ENODEV. If the gpio returned by
of_get_gpio is an invalid number this isn't noticed by
of_i2c_gpio_probe, but then gpio_request later fails which is good
enough.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/i2c/busses/i2c-gpio.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 9362ed181fe3..850db7b2f652 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -89,6 +89,7 @@ static int of_i2c_gpio_probe(struct device_node *np,
 			     struct i2c_gpio_platform_data *pdata)
 {
 	u32 reg;
+	int ret;
 
 	if (!IS_ENABLED(CONFIG_OFDEVICE))
 		return -ENODEV;
@@ -96,14 +97,15 @@ static int of_i2c_gpio_probe(struct device_node *np,
 	if (of_gpio_count(np) < 2)
 		return -ENODEV;
 
-	pdata->sda_pin = of_get_gpio(np, 0);
-	pdata->scl_pin = of_get_gpio(np, 1);
+	ret = of_get_gpio(np, 0);
+	if (ret < 0)
+		return ret;
+	pdata->sda_pin = ret;
 
-	if (!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->scl_pin)) {
-		pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n",
-		       np->full_name, pdata->sda_pin, pdata->scl_pin);
-		return -ENODEV;
-	}
+	ret = of_get_gpio(np, 1);
+	if (ret < 0)
+		return ret;
+	pdata->scl_pin = ret;
 
 	of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay);
 
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH 2/3] i2c: gpio: use dynamic bus number unconditionally
From: Uwe Kleine-König @ 2016-11-16 12:18 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116121851.12399-1-u.kleine-koenig@pengutronix.de>

While being a bit more random this helps dt setups where the id of a
platform device cannot easily be fixed anyhow.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/i2c/busses/i2c-gpio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index 850db7b2f652..708193344aec 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -198,7 +198,7 @@ static int i2c_gpio_probe(struct device_d *dev)
 	adap->bus_recovery_info->set_scl = i2c_set_scl_gpio_value;
 	adap->bus_recovery_info->recover_bus = i2c_generic_scl_recovery;
 
-	adap->nr = dev->id;
+	adap->nr = -1;
 	ret = i2c_bit_add_numbered_bus(adap);
 	if (ret)
 		goto err_add_bus;
-- 
2.10.2


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

^ permalink raw reply related

* [PATCH 3/3] i2c: algo-bit: remove prototype for non-existing function
From: Uwe Kleine-König @ 2016-11-16 12:18 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161116121851.12399-1-u.kleine-koenig@pengutronix.de>

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 include/i2c/i2c-algo-bit.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/include/i2c/i2c-algo-bit.h b/include/i2c/i2c-algo-bit.h
index 1b722196875c..91c84361882c 100644
--- a/include/i2c/i2c-algo-bit.h
+++ b/include/i2c/i2c-algo-bit.h
@@ -48,7 +48,6 @@ struct i2c_algo_bit_data {
 	int timeout_ms;		/* in ms */
 };
 
-int i2c_bit_add_bus(struct i2c_adapter *);
 int i2c_bit_add_numbered_bus(struct i2c_adapter *);
 extern const struct i2c_algorithm i2c_bit_algo;
 
-- 
2.10.2


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

^ permalink raw reply related

* Re: [PATCH 1/2] regmap: Add regmap_write_bits() function
From: Sascha Hauer @ 2016-11-17  6:41 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox
In-Reply-To: <1479190874-10392-1-git-send-email-andrew.smirnov@gmail.com>

On Mon, Nov 14, 2016 at 10:21:13PM -0800, Andrey Smirnov wrote:
> Add code implementing a simple version of regmap_write_bits().
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/base/regmap/regmap.c | 27 +++++++++++++++++++++++++++
>  include/regmap.h             |  6 +++++-
>  2 files changed, 32 insertions(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
> index a042a1a..52b7d88 100644
> --- a/drivers/base/regmap/regmap.c
> +++ b/drivers/base/regmap/regmap.c
> @@ -137,6 +137,33 @@ int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val)
>  }
>  
>  /**
> + * regmap_write_bits - write bits of a register in a map
> + *
> + * @map:	The map
> + * @reg:	The register offset of the register
> + * @mask:	Mask indicating bits to be modified
> + *		(1 - modified, 0 - untouched)
> + * @val:	Bit value to be set
> + *
> + * Returns 0 for success or negative error code on failure
> + */
> +int regmap_write_bits(struct regmap *map, unsigned int reg,
> +		      unsigned int mask, unsigned int val)
> +{
> +	int ret;
> +	unsigned int tmp, orig;
> +
> +	ret = regmap_read(map, reg, &orig);
> +	if (ret != 0)
> +		return ret;
> +
> +	tmp = orig & ~mask;
> +	tmp |= val & mask;
> +
> +	return regmap_write(map, reg, tmp);
> +}
> +
> +/**
>   * regmap_bulk_read(): Read data from the device
>   *
>   * @map: Register map to read from
> diff --git a/include/regmap.h b/include/regmap.h
> index bcbe6c1..9675a17 100644
> --- a/include/regmap.h
> +++ b/include/regmap.h
> @@ -60,4 +60,8 @@ int regmap_get_val_bytes(struct regmap *map);
>  int regmap_get_max_register(struct regmap *map);
>  int regmap_get_reg_stride(struct regmap *map);
>  
> -#endif /* __REGMAP_H */
> \ No newline at end of file
> +int regmap_write_bits(struct regmap *map, unsigned int reg,
> +		      unsigned int mask, unsigned int val);
> +
> +
> +#endif /* __REGMAP_H */
> -- 
> 2.5.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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

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

^ permalink raw reply

* Re: [PATCH] commands: i2c: Listen for CTRL-C when probing
From: Sascha Hauer @ 2016-11-17  6:42 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox
In-Reply-To: <1479221187-13482-1-git-send-email-andrew.smirnov@gmail.com>

On Tue, Nov 15, 2016 at 06:46:27AM -0800, Andrey Smirnov wrote:
> Allow I2C bus probing to be interrupted early by sending CTRL-C. This is
> usefull when calling the tool without any arguments and one of the busses
> is misconfigured (waiting for 100+ failures is pretty inconvenient).
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  commands/i2c.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

Sascha

> 
> diff --git a/commands/i2c.c b/commands/i2c.c
> index ae7f7fc..573032a 100644
> --- a/commands/i2c.c
> +++ b/commands/i2c.c
> @@ -32,7 +32,7 @@ static void i2c_probe_range(struct i2c_adapter *adapter, int startaddr, int stop
>  	client.adapter = adapter;
>  
>  	printf("probing i2c%d range 0x%02x-0x%02x: ", adapter->nr, startaddr, stopaddr);
> -	for (addr = startaddr; addr <= stopaddr; addr++) {
> +	for (addr = startaddr; addr <= stopaddr && !ctrlc(); addr++) {
>  		client.addr = addr;
>  		ret = i2c_write_reg(&client, 0x00, &reg, 0);
>  		if (ret == 0)
> -- 
> 2.5.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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

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

^ permalink raw reply

* Re: [PATCH] i2c-mux-pca954x: Add code to control reset line
From: Sascha Hauer @ 2016-11-17  6:43 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox
In-Reply-To: <1479221205-13573-1-git-send-email-andrew.smirnov@gmail.com>

On Tue, Nov 15, 2016 at 06:46:45AM -0800, Andrey Smirnov wrote:
> Most recent device tree binding for that mux support specifying a GPIO
> connected to a reset line of that chip. Add code to handle that binding
> in order to be able to use the chip on boards that leverage
> aforementioned functionality.
> 
> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> ---
>  drivers/i2c/muxes/i2c-mux-pca954x.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
> index baeae7b..0d5515b 100644
> --- a/drivers/i2c/muxes/i2c-mux-pca954x.c
> +++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
> @@ -45,6 +45,8 @@
>  #include <i2c/i2c-algo-bit.h>
>  #include <i2c/i2c-mux.h>
>  #include <init.h>
> +#include <gpio.h>
> +#include <of_gpio.h>
>  
>  #define PCA954X_MAX_NCHANS 8
>  
> @@ -179,6 +181,7 @@ static int pca954x_probe(struct device_d *dev)
>  	int num, force;
>  	struct pca954x *data;
>  	int ret = -ENODEV;
> +	int gpio;
>  
>  	data = kzalloc(sizeof(struct pca954x), GFP_KERNEL);
>  	if (!data) {
> @@ -188,6 +191,10 @@ static int pca954x_probe(struct device_d *dev)
>  
>  	i2c_set_clientdata(client, data);
>  
> +	gpio = of_get_named_gpio(dev->device_node, "reset-gpios", 0);
> +	if (gpio_is_valid(gpio))
> +		gpio_direction_output(gpio, 1);
> +
>  	/* Read the mux register at addr to verify
>  	 * that the mux is in fact present.
>  	 */
> -- 
> 2.5.5
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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

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

^ permalink raw reply

* Re: [PATCH 1/2] fixup! pinctrl: Add provisions to control GPIO pin direction
From: Sascha Hauer @ 2016-11-17  6:56 UTC (permalink / raw)
  To: Andrey Smirnov; +Cc: barebox
In-Reply-To: <1479226976-12563-1-git-send-email-andrew.smirnov@gmail.com>

On Tue, Nov 15, 2016 at 08:22:55AM -0800, Andrey Smirnov wrote:
> ---
> 
> Sascha:
> 
> These two are fixup for issues in my Vybrid patch series, patch #2 is
> for the issue you experienced and this one is for another issue I
> found when building cupid_defconfig.
> 
> If you'd rather I post v3 version of the patchset with all of this
> incorporated, let me know.

Not necessary, thanks. The updated series is just compile testing, let's
see what that gives us.

Sascha


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

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

^ permalink raw reply

* Re: [PATCH v2 1/4] scripts/kwbimage: fix handling of binary header
From: Sascha Hauer @ 2016-11-17  6:58 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox
In-Reply-To: <20161116095244.14288-1-u.kleine-koenig@pengutronix.de>

On Wed, Nov 16, 2016 at 10:52:41AM +0100, Uwe Kleine-König wrote:
> A binary header is 12 bytes + (4 bytes * Number of Arguments) bigger
> than the actual binary. Before this commit image extraction was wrong an
> made binary.0 too big by four bytes at the end (which were 0 in all usual
> cases). Image creation had the same problem which resulted in broken
> images when the binary doesn't end in 4 bytes containing 0.
> 
> Further handle binaries with a length that is not aligned to 4 bytes.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied, thanks

Sascha

> ---
> Changes since (implicit) v1:
>  - make it patch 1 as it is a fix
> 
>  scripts/kwbimage.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/scripts/kwbimage.c b/scripts/kwbimage.c
> index 448ac2a5d416..c560f581a727 100644
> --- a/scripts/kwbimage.c
> +++ b/scripts/kwbimage.c
> @@ -490,7 +490,7 @@ static int image_extract_binary_hdr_v1(const void *binary, const char *output,
>  	}
>  
>  	ret = fwrite(binary + (nargs + 1) * sizeof(unsigned int),
> -		     binsz - (nargs + 1) * sizeof(unsigned int), 1,
> +		     binsz - (nargs + 2) * sizeof(unsigned int), 1,
>  		     binaryout);
>  	if (ret != 1) {
>  		fprintf(stderr, "Could not write to output file %s\n",
> @@ -869,8 +869,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
>  			return NULL;
>  		}
>  
> -		headersz += s.st_size +
> -			binarye->binary.nargs * sizeof(unsigned int);
> +		headersz += ALIGN_SUP(s.st_size, 4) +
> +			12 + binarye->binary.nargs * sizeof(unsigned int);
>  		hasext = 1;
>  	}
>  
> @@ -951,8 +951,8 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
>  		fstat(fileno(bin), &s);
>  
>  		binhdrsz = sizeof(struct opt_hdr_v1) +
> -			(binarye->binary.nargs + 1) * sizeof(unsigned int) +
> -			s.st_size;
> +			(binarye->binary.nargs + 2) * sizeof(unsigned int) +
> +			ALIGN_SUP(s.st_size, 4);
>  		hdr->headersz_lsb = binhdrsz & 0xFFFF;
>  		hdr->headersz_msb = (binhdrsz & 0xFFFF0000) >> 16;
>  
> @@ -976,7 +976,7 @@ static void *image_create_v1(struct image_cfg_element *image_cfg,
>  
>  		fclose(bin);
>  
> -		cur += s.st_size;
> +		cur += ALIGN_SUP(s.st_size, 4);
>  
>  		/*
>  		 * For now, we don't support more than one binary
> -- 
> 2.10.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

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

^ permalink raw reply

* Re: [PATCH 1/3] i2c: gpio: fix handling of return code of of_get_gpio
From: Sascha Hauer @ 2016-11-17  6:59 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: barebox
In-Reply-To: <20161116121851.12399-1-u.kleine-koenig@pengutronix.de>

On Wed, Nov 16, 2016 at 01:18:49PM +0100, Uwe Kleine-König wrote:
> Instead of using gpio_is_valid just check the return code of of_get_gpio
> for being < 0. This fixes -EPROBE_DEFER handling as now this error code
> is handed to the caller instead of -ENODEV. If the gpio returned by
> of_get_gpio is an invalid number this isn't noticed by
> of_i2c_gpio_probe, but then gpio_request later fails which is good
> enough.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied, thanks

Sascha

> ---
>  drivers/i2c/busses/i2c-gpio.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index 9362ed181fe3..850db7b2f652 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -89,6 +89,7 @@ static int of_i2c_gpio_probe(struct device_node *np,
>  			     struct i2c_gpio_platform_data *pdata)
>  {
>  	u32 reg;
> +	int ret;
>  
>  	if (!IS_ENABLED(CONFIG_OFDEVICE))
>  		return -ENODEV;
> @@ -96,14 +97,15 @@ static int of_i2c_gpio_probe(struct device_node *np,
>  	if (of_gpio_count(np) < 2)
>  		return -ENODEV;
>  
> -	pdata->sda_pin = of_get_gpio(np, 0);
> -	pdata->scl_pin = of_get_gpio(np, 1);
> +	ret = of_get_gpio(np, 0);
> +	if (ret < 0)
> +		return ret;
> +	pdata->sda_pin = ret;
>  
> -	if (!gpio_is_valid(pdata->sda_pin) || !gpio_is_valid(pdata->scl_pin)) {
> -		pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n",
> -		       np->full_name, pdata->sda_pin, pdata->scl_pin);
> -		return -ENODEV;
> -	}
> +	ret = of_get_gpio(np, 1);
> +	if (ret < 0)
> +		return ret;
> +	pdata->scl_pin = ret;
>  
>  	of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay);
>  
> -- 
> 2.10.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

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

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

^ permalink raw reply

* Re: [PATCH] ARM: i.MX: Add src fixup
From: Sascha Hauer @ 2016-11-17  7:03 UTC (permalink / raw)
  To: Holger Schurig; +Cc: Barebox List
In-Reply-To: <CAOpc7mHgZNN4gz1VhbTqYW2atcVJCW4H1_RJdjhEQeJKSdF2wQ@mail.gmail.com>

On Wed, Nov 16, 2016 at 03:32:36PM +0100, Holger Schurig wrote:
>    > +config RESET_IMX_SRC
>    > +       bool "i.MX SRC support"
>    > +       default y if ARCH_IMX6 || ARCH_IMX50 || ARCH_IMX51 || ARCH_IMX53
>    > +
>    >  comment "Freescale i.MX System-on-Chip"
> 
>    I hate new visible config entries without a help text :-/

You're right. I took the easy way out and made this invisible. Also I
removed the duplicate Kconfig entry in drivers/reset/Kconfig.

Sascha

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

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

^ permalink raw reply

* Re: [RFCv2 1/2] serial: add driver for SiFive UART
From: Sascha Hauer @ 2016-11-17  7:07 UTC (permalink / raw)
  To: Antony Pavlov; +Cc: barebox
In-Reply-To: <20161113215015.9399-2-antonynpavlov@gmail.com>

On Mon, Nov 14, 2016 at 12:50:14AM +0300, Antony Pavlov wrote:
> Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> ---
> 
> TODO:
> 
>   * add speed setup support.
> 
>  drivers/serial/Kconfig         |   3 ++
>  drivers/serial/Makefile        |   1 +
>  drivers/serial/serial_sifive.c | 109 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 113 insertions(+)
> 
> diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> index b112d7e..70509b9 100644
> --- a/drivers/serial/Kconfig
> +++ b/drivers/serial/Kconfig
> @@ -117,6 +117,9 @@ config DRIVER_SERIAL_S3C_AUTOSYNC
>  	  Say Y here if you want to use the auto flow feature of this
>  	  UART. RTS and CTS will be handled by the hardware when enabled.
>  
> +config DRIVER_SERIAL_SIFIVE
> +	bool "SiFive serial driver"
> +
>  config DRIVER_SERIAL_PXA
>  	bool "PXA serial driver"
>  	depends on ARCH_PXA
> diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> index 189e777..368e992 100644
> --- a/drivers/serial/Makefile
> +++ b/drivers/serial/Makefile
> @@ -20,3 +20,4 @@ obj-$(CONFIG_DRIVER_SERIAL_AUART)		+= serial_auart.o
>  obj-$(CONFIG_DRIVER_SERIAL_CADENCE)		+= serial_cadence.o
>  obj-$(CONFIG_DRIVER_SERIAL_EFI_STDIO)		+= efi-stdio.o
>  obj-$(CONFIG_DRIVER_SERIAL_DIGIC)		+= serial_digic.o
> +obj-$(CONFIG_DRIVER_SERIAL_SIFIVE)		+= serial_sifive.o
> diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
> new file mode 100644
> index 0000000..06e3521
> --- /dev/null
> +++ b/drivers/serial/serial_sifive.c
> @@ -0,0 +1,109 @@
> +/*
> + * Copyright (C) 2016 Antony Pavlov <antonynpavlov@gmail.com>
> + *
> + * This file is part of barebox.
> + * See file CREDITS for list of people who contributed to this project.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2
> + * as published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <malloc.h>
> +#include <io.h>
> +
> +#define UART_RX_OFFSET 0
> +#define UART_TX_OFFSET 0
> +#define UART_TX_COUNT_OFFSET 0x4
> +#define UART_RX_COUNT_OFFSET 0x8
> +#define UART_DIVIDER_OFFSET  0xC
> +
> +static inline uint32_t sifive_serial_readl(struct console_device *cdev,
> +						uint32_t offset)
> +{
> +	void __iomem *base = cdev->dev->priv;
> +
> +	return readl(base + offset);
> +}
> +
> +static inline void sifive_serial_writel(struct console_device *cdev,
> +					uint32_t value, uint32_t offset)
> +{
> +	void __iomem *base = cdev->dev->priv;
> +
> +	writel(value, base + offset);
> +}
> +
> +static int sifive_serial_setbaudrate(struct console_device *cdev, int baudrate)
> +{
> +	/* FIXME: no baudrate setup at the momement :( */
> +
> +	return 0;
> +}
> +
> +static void sifive_serial_putc(struct console_device *cdev, char c)
> +{
> +	sifive_serial_writel(cdev, c, UART_TX_OFFSET);
> +}

This doesn't test if there is space in the FIFO. This is necessary, no?

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

* habv4 on imx6
From: Jan Remmet @ 2016-11-17 13:42 UTC (permalink / raw)
  To: barebox

Hello,
I'm trying to get hab signature working on a imx6.

So far I have added 
 #include <mach/habv4-imx6-gencsf.h
to the .imxcfg flash header.

and set
 ONFIG_HABV4, CONFIG_HABV4_TABLE_BIN, CONFIG_HABV4_CSF_CRT_PEM and CONFIG_HABV4_IMG_CRT_PEM

I also added this to images/Makefile.imx

CFG_start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058-1gib.imxcfg
FILE_barebox-phytec-phycore-imx6q-som-emmc-1gib-signed.img = start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg
image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-1gib-signed.img

I got this:
...
  IMX-IMG images/start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg
  Missing --i argument
  Failed to open
  images/start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg.csfbin: No such
  file or directory
  barebox/2016.09.0-phy1-r7.0/cst
  failed

Is my setup ok so far? Maybe this is an issue with my version of cst?

It wants
-i, --input <csf text file>:
Input CSF text filename

cst -v
Code Signing Tool release version BLN_CST_MAIN_02.03.00

Jan

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

^ permalink raw reply

* Re: habv4 on imx6
From: Jan Remmet @ 2016-11-17 15:29 UTC (permalink / raw)
  To: barebox
In-Reply-To: <20161117134221.GA3095@lws-weitzel2@phytec.de>

On Thu, Nov 17, 2016 at 02:42:21PM +0100, Jan Remmet wrote:
> Hello,
> I'm trying to get hab signature working on a imx6.
> 
> So far I have added 
>  #include <mach/habv4-imx6-gencsf.h
> to the .imxcfg flash header.
> 
> and set
>  ONFIG_HABV4, CONFIG_HABV4_TABLE_BIN, CONFIG_HABV4_CSF_CRT_PEM and CONFIG_HABV4_IMG_CRT_PEM
> 
> I also added this to images/Makefile.imx
> 
> CFG_start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg = $(board)/phytec-som-imx6/flash-header-phytec-pcm058-1gib.imxcfg
> FILE_barebox-phytec-phycore-imx6q-som-emmc-1gib-signed.img = start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg
> image-$(CONFIG_MACH_PHYTEC_SOM_IMX6) += barebox-phytec-phycore-imx6q-som-emmc-1gib-signed.img
> 
> I got this:
> ...
>   IMX-IMG images/start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg
>   Missing --i argument
>   Failed to open
>   images/start_phytec_phycore_imx6q_som_emmc_1gib.pblx.simximg.csfbin: No such
>   file or directory
>   barebox/2016.09.0-phy1-r7.0/cst
>   failed
> 
> Is my setup ok so far? Maybe this is an issue with my version of cst?
> 
> It wants
> -i, --input <csf text file>:
> Input CSF text filename
> 
> cst -v
> Code Signing Tool release version BLN_CST_MAIN_02.03.00

Ok according to the cst Release_Notes.txt it was added in CST 2.3.2. 
I changed imx-image.c to write the csf buffer to a file, but ran into

Error: Cannot open key file ../CSF1_1_sha256_4096_65537_v3_usr_key.pem
30345296:error:0907B068:PEM routines:PEM_READ_BIO_PRIVATEKEY:bad password
read:pem_pkey.c:109:
cst tool failed: No such file or directory

Jan

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

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

^ permalink raw reply

* Re: [RFCv2 1/2] serial: add driver for SiFive UART
From: Antony Pavlov @ 2016-11-18  8:41 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161117070706.2expz3uxnl6aoawt@pengutronix.de>

On Thu, 17 Nov 2016 08:07:06 +0100
Sascha Hauer <s.hauer@pengutronix.de> wrote:

> On Mon, Nov 14, 2016 at 12:50:14AM +0300, Antony Pavlov wrote:
> > Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
> > ---
> > 
> > TODO:
> > 
> >   * add speed setup support.
> > 
> >  drivers/serial/Kconfig         |   3 ++
> >  drivers/serial/Makefile        |   1 +
> >  drivers/serial/serial_sifive.c | 109 +++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 113 insertions(+)
> > 
> > diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig
> > index b112d7e..70509b9 100644
> > --- a/drivers/serial/Kconfig
> > +++ b/drivers/serial/Kconfig
> > @@ -117,6 +117,9 @@ config DRIVER_SERIAL_S3C_AUTOSYNC
> >  	  Say Y here if you want to use the auto flow feature of this
> >  	  UART. RTS and CTS will be handled by the hardware when enabled.
> >  
> > +config DRIVER_SERIAL_SIFIVE
> > +	bool "SiFive serial driver"
> > +
> >  config DRIVER_SERIAL_PXA
> >  	bool "PXA serial driver"
> >  	depends on ARCH_PXA
> > diff --git a/drivers/serial/Makefile b/drivers/serial/Makefile
> > index 189e777..368e992 100644
> > --- a/drivers/serial/Makefile
> > +++ b/drivers/serial/Makefile
> > @@ -20,3 +20,4 @@ obj-$(CONFIG_DRIVER_SERIAL_AUART)		+= serial_auart.o
> >  obj-$(CONFIG_DRIVER_SERIAL_CADENCE)		+= serial_cadence.o
> >  obj-$(CONFIG_DRIVER_SERIAL_EFI_STDIO)		+= efi-stdio.o
> >  obj-$(CONFIG_DRIVER_SERIAL_DIGIC)		+= serial_digic.o
> > +obj-$(CONFIG_DRIVER_SERIAL_SIFIVE)		+= serial_sifive.o
> > diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
> > new file mode 100644
> > index 0000000..06e3521
> > --- /dev/null
> > +++ b/drivers/serial/serial_sifive.c
> > @@ -0,0 +1,109 @@
> > +/*
> > + * Copyright (C) 2016 Antony Pavlov <antonynpavlov@gmail.com>
> > + *
> > + * This file is part of barebox.
> > + * See file CREDITS for list of people who contributed to this project.
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2
> > + * as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope that it will be useful,
> > + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> > + * GNU General Public License for more details.
> > + *
> > + */
> > +
> > +#include <common.h>
> > +#include <init.h>
> > +#include <malloc.h>
> > +#include <io.h>
> > +
> > +#define UART_RX_OFFSET 0
> > +#define UART_TX_OFFSET 0
> > +#define UART_TX_COUNT_OFFSET 0x4
> > +#define UART_RX_COUNT_OFFSET 0x8
> > +#define UART_DIVIDER_OFFSET  0xC
> > +
> > +static inline uint32_t sifive_serial_readl(struct console_device *cdev,
> > +						uint32_t offset)
> > +{
> > +	void __iomem *base = cdev->dev->priv;
> > +
> > +	return readl(base + offset);
> > +}
> > +
> > +static inline void sifive_serial_writel(struct console_device *cdev,
> > +					uint32_t value, uint32_t offset)
> > +{
> > +	void __iomem *base = cdev->dev->priv;
> > +
> > +	writel(value, base + offset);
> > +}
> > +
> > +static int sifive_serial_setbaudrate(struct console_device *cdev, int baudrate)
> > +{
> > +	/* FIXME: no baudrate setup at the momement :( */
> > +
> > +	return 0;
> > +}
> > +
> > +static void sifive_serial_putc(struct console_device *cdev, char c)
> > +{
> > +	sifive_serial_writel(cdev, c, UART_TX_OFFSET);
> > +}
> 
> This doesn't test if there is space in the FIFO. This is necessary, no?

Yes, you are right. I have to add 'check UART FIFO state' to the TODO list.
Current qemu-riscv SiFive UART model does not have transmit FIFO support
so I can't use it for tests.

I'm planning to run RISC-V barebox on real FPGA board in the nearest feature.
So baudrate setup code and FIFO state checking code will be added. 

-- 
Best regards,
  Antony Pavlov

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

^ permalink raw reply

* [PATCH] docs: fix typos in memcmp help text
From: Moritz Warning @ 2016-11-20  0:09 UTC (permalink / raw)
  To: barebox

Signed-off-by: Moritz Warning <moritzwarning@web.de>
---
 commands/memcmp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/commands/memcmp.c b/commands/memcmp.c
index ce044df..7be0033 100644
--- a/commands/memcmp.c
+++ b/commands/memcmp.c
@@ -130,8 +130,8 @@ out:
 }
 
 BAREBOX_CMD_HELP_START(memcmp)
-BAREBOX_CMD_HELP_TEXT("Compare memory regions specified with ADDR and ADDR2")
-BAREBOX_CMD_HELP_TEXT("of size COUNT bytes. If source is a file COUNT can")
+BAREBOX_CMD_HELP_TEXT("Compare memory regions specified with ADDR1 and ADDR2")
+BAREBOX_CMD_HELP_TEXT("of size COUNT bytes. If source is a file, COUNT can")
 BAREBOX_CMD_HELP_TEXT("be left unspecified, in which case the whole file is")
 BAREBOX_CMD_HELP_TEXT("compared.")
 BAREBOX_CMD_HELP_TEXT("")
-- 
2.10.2


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

^ permalink raw reply related


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