* [PATCH 2/3] nand: denali: use is_timeout in while loop
From: Steffen Trumtrar @ 2016-09-22 14:46 UTC (permalink / raw)
To: barebox; +Cc: Steffen Trumtrar
In-Reply-To: <20160922144639.28305-1-s.trumtrar@pengutronix.de>
Instead of using udelay and a countdown, use the is_timeout function.
Also, move the code closer to the kernel version, i.e. check for the
correct bank and clean the interrupt status.
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
drivers/mtd/nand/nand_denali.c | 39 +++++++++++++++++++++++----------------
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/drivers/mtd/nand/nand_denali.c b/drivers/mtd/nand/nand_denali.c
index ceb5a8b87e42..6a6c0e462514 100644
--- a/drivers/mtd/nand/nand_denali.c
+++ b/drivers/mtd/nand/nand_denali.c
@@ -25,6 +25,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <io.h>
+#include <clock.h>
#include <of_mtd.h>
#include <errno.h>
#include <asm/io.h>
@@ -633,26 +634,32 @@ static uint32_t read_interrupt_status(struct denali_nand_info *denali)
static uint32_t wait_for_irq(struct denali_nand_info *denali, uint32_t irq_mask)
{
- unsigned long comp_res = 1000;
uint32_t intr_status = 0;
+ uint64_t start;
- do {
+ if (!is_flash_bank_valid(denali->flash_bank)) {
+ dev_dbg(denali->dev, "No valid chip selected (%d)\n",
+ denali->flash_bank);
+ return 0;
+ }
+
+ start = get_time_ns();
+
+ while (!is_timeout(start, 1000 * MSECOND)) {
intr_status = read_interrupt_status(denali);
- if (intr_status & irq_mask) {
- /* our interrupt was detected */
- break;
- }
- udelay(1);
- comp_res--;
- } while (comp_res != 0);
-
- if (comp_res == 0) {
- /* timeout */
- intr_status = 0;
- dev_dbg(denali->dev, "timeout occurred, status = 0x%x, mask = 0x%x\n",
- intr_status, irq_mask);
+
+ if (intr_status != 0)
+ clear_interrupt(denali, intr_status);
+
+ if (intr_status & irq_mask)
+ return intr_status;
}
- return intr_status;
+
+ /* timeout */
+ dev_dbg(denali->dev, "timeout occurred, status = 0x%x, mask = 0x%x\n",
+ intr_status, irq_mask);
+
+ return 0;
}
/*
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH] Documentation: clarify that patches should target the master branch.
From: Robert Schwebel @ 2016-09-22 17:14 UTC (permalink / raw)
To: barebox
I asked Sascha if he still prefers patches against 'next', and it turned
out that this is not true any more and patches should be sent against
master.
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
Documentation/user/barebox.rst | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
index 32cec3d..1203c10 100644
--- a/Documentation/user/barebox.rst
+++ b/Documentation/user/barebox.rst
@@ -28,9 +28,11 @@ can be checked out as follows:
Checking connectivity... done.
Checking out files: 100% (5651/5651), done.
-After this, make sure to check out the appropriate branch. If you want to
-develop for barebox, it's best to check out the ``next`` branch rather than
-the ``master`` branch:
+By default, the master branch is checked out. If you want to develop for
+barebox, this is the right branch to send patches against.
+
+If you want to see which patches are already selected for the next release,
+you can look at the ``next`` branch:
.. code-block:: sh
--
2.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH v2] environment: "wrong magic" gives the impression of an error
From: Sam Ravnborg @ 2016-09-22 19:16 UTC (permalink / raw)
To: Sascha Hauer; +Cc: Barebox List
In-Reply-To: <20160922080839.ypjpltpcdsyjmle5@pengutronix.de>
From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <srn@skov.dk>
Date: Thu, 22 Sep 2016 06:54:42 +0200
Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
error
Introduce a more soft wording when the magic of
the superblock does not match.
Include a hint to the typical reason "(envfs never written?)"
This prevents a "what is wrong?" moment when looking at
the boot log.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
v2:
Dropped change in envfs_load_data(). envfs_load_data() is used
to traverse the inodes and if we reach this far we
have encountered a real error which should be reported.
Thanks to Sascha for spottign this mistake!
Sam
common/environment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/environment.c b/common/environment.c
index db127d7..c9cef63 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
static int envfs_check_super(struct envfs_super *super, size_t *size)
{
if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
- printf("envfs: wrong magic\n");
+ printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
return -EIO;
}
--
1.8.3.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH] Documentation: clarify "ioe" for netconsole
From: Robert Schwebel @ 2016-09-22 17:23 UTC (permalink / raw)
To: barebox
ioe means "input", "output", "error", which are bits that can be set
individually.
Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
---
Documentation/user/networking.rst | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/user/networking.rst b/Documentation/user/networking.rst
index 8afb433..772a7dc 100644
--- a/Documentation/user/networking.rst
+++ b/Documentation/user/networking.rst
@@ -74,6 +74,7 @@ risks. It can be enabled using:
netconsole.active=ioe
This will send UDP packets to a PC with IP address 192.168.23.2 and port 6666.
+"ioe" means "input", "output", "error", and those bits can be set individually.
The ``netconsole.active`` parameter consists of the fields "input" (i),
"output" (o) and "error" (e); if the fields are set, the respective channel is
--
2.8.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 1/2] mtd: ubi: add API call to rename volumes.
From: Giorgio Dal Molin @ 2016-09-23 9:07 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160922080408.rpqeithibjfga2rm@pengutronix.de>
Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
---
drivers/mtd/ubi/barebox.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/mtd/ubi/vmt.c | 3 +
include/linux/mtd/ubi.h | 1 +
3 files changed, 160 insertions(+)
diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c
index 23c4bfd..329cf45 100644
--- a/drivers/mtd/ubi/barebox.c
+++ b/drivers/mtd/ubi/barebox.c
@@ -280,6 +280,162 @@ int ubi_api_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
return ubi_remove_volume(desc, no_vtbl);
}
+int ubi_api_rename_volumes(int ubi_num, struct ubi_rnvol_req *req)
+{
+ int i, n, err;
+ struct list_head rename_list;
+ struct ubi_rename_entry *re, *re1;
+ struct ubi_device *ubi;
+
+ if (req->count < 0 || req->count > UBI_MAX_RNVOL)
+ return -EINVAL;
+
+ if (req->count == 0)
+ return 0;
+
+ ubi = ubi_get_device(ubi_num);
+ if (!ubi)
+ return -ENODEV;
+
+ /* Validate volume IDs and names in the request */
+ for (i = 0; i < req->count; i++) {
+ if (req->ents[i].vol_id < 0 ||
+ req->ents[i].vol_id >= ubi->vtbl_slots)
+ return -EINVAL;
+ if (req->ents[i].name_len < 0)
+ return -EINVAL;
+ if (req->ents[i].name_len > UBI_VOL_NAME_MAX)
+ return -ENAMETOOLONG;
+ req->ents[i].name[req->ents[i].name_len] = '\0';
+ n = strlen(req->ents[i].name);
+ if (n != req->ents[i].name_len)
+ return -EINVAL;
+ }
+
+ /* Make sure volume IDs and names are unique */
+ for (i = 0; i < req->count - 1; i++) {
+ for (n = i + 1; n < req->count; n++) {
+ if (req->ents[i].vol_id == req->ents[n].vol_id) {
+ ubi_err(ubi, "duplicated volume id %d",
+ req->ents[i].vol_id);
+ return -EINVAL;
+ }
+ if (!strcmp(req->ents[i].name, req->ents[n].name)) {
+ ubi_err(ubi, "duplicated volume name \"%s\"",
+ req->ents[i].name);
+ return -EINVAL;
+ }
+ }
+ }
+
+ /* Create the re-name list */
+ INIT_LIST_HEAD(&rename_list);
+ for (i = 0; i < req->count; i++) {
+ int vol_id = req->ents[i].vol_id;
+ int name_len = req->ents[i].name_len;
+ const char *name = req->ents[i].name;
+
+ re = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL);
+ if (!re) {
+ err = -ENOMEM;
+ goto out_free;
+ }
+
+ re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_READONLY);
+ if (IS_ERR(re->desc)) {
+ err = PTR_ERR(re->desc);
+ ubi_err(ubi, "cannot open volume %d, error %d",
+ vol_id, err);
+ kfree(re);
+ goto out_free;
+ }
+
+ /* Skip this re-naming if the name does not really change */
+ if (re->desc->vol->name_len == name_len &&
+ !memcmp(re->desc->vol->name, name, name_len)) {
+ ubi_close_volume(re->desc);
+ kfree(re);
+ continue;
+ }
+
+ re->new_name_len = name_len;
+ memcpy(re->new_name, name, name_len);
+ list_add_tail(&re->list, &rename_list);
+ dbg_gen("will rename volume %d from \"%s\" to \"%s\"",
+ vol_id, re->desc->vol->name, name);
+ }
+
+ if (list_empty(&rename_list))
+ return 0;
+
+ /* Find out the volumes which have to be removed */
+ list_for_each_entry(re, &rename_list, list) {
+ struct ubi_volume_desc *desc;
+ int no_remove_needed = 0;
+
+ /*
+ * Volume @re->vol_id is going to be re-named to
+ * @re->new_name, while its current name is @name. If a volume
+ * with name @re->new_name currently exists, it has to be
+ * removed, unless it is also re-named in the request (@req).
+ */
+ list_for_each_entry(re1, &rename_list, list) {
+ if (re->new_name_len == re1->desc->vol->name_len &&
+ !memcmp(re->new_name, re1->desc->vol->name,
+ re1->desc->vol->name_len)) {
+ no_remove_needed = 1;
+ break;
+ }
+ }
+
+ if (no_remove_needed)
+ continue;
+
+ /*
+ * It seems we need to remove volume with name @re->new_name,
+ * if it exists.
+ */
+ desc = ubi_open_volume_nm(ubi->ubi_num, re->new_name,
+ UBI_EXCLUSIVE);
+ if (IS_ERR(desc)) {
+ err = PTR_ERR(desc);
+ if (err == -ENODEV)
+ /* Re-naming into a non-existing volume name */
+ continue;
+
+ /* The volume exists but busy, or an error occurred */
+ ubi_err(ubi, "cannot open volume \"%s\", error %d",
+ re->new_name, err);
+ goto out_free;
+ }
+
+ re1 = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL);
+ if (!re1) {
+ err = -ENOMEM;
+ ubi_close_volume(desc);
+ goto out_free;
+ }
+
+ re1->remove = 1;
+ re1->desc = desc;
+ list_add(&re1->list, &rename_list);
+ dbg_gen("will remove volume %d, name \"%s\"",
+ re1->desc->vol->vol_id, re1->desc->vol->name);
+ }
+
+ mutex_lock(&ubi->device_mutex);
+ err = ubi_rename_volumes(ubi, &rename_list);
+ mutex_unlock(&ubi->device_mutex);
+
+out_free:
+ list_for_each_entry_safe(re, re1, &rename_list, list) {
+ ubi_close_volume(re->desc);
+ list_del(&re->list);
+ kfree(re);
+ }
+ return err;
+}
+
static int ubi_cdev_ioctl(struct cdev *cdev, int cmd, void *buf)
{
struct ubi_device *ubi = cdev->priv;
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 41b814c..ed04364 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -411,6 +411,9 @@ int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
vol->name_len = re->new_name_len;
memcpy(vol->name, re->new_name, re->new_name_len + 1);
+ free(vol->cdev.name);
+ vol->cdev.name = basprintf("%s.%s", ubi->cdev.name, vol->name);
+ vol->cdev.size = vol->used_bytes;
ubi_volume_notify(ubi, vol, UBI_VOLUME_RENAMED);
}
}
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index c72f95b..c215ff2 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -220,6 +220,7 @@ int ubi_flush(int ubi_num, int vol_id, int lnum);
int ubi_api_create_volume(int ubi_num, struct ubi_mkvol_req *req);
int ubi_api_remove_volume(struct ubi_volume_desc *desc, int no_vtbl);
+int ubi_api_rename_volumes(int ubi_num, struct ubi_rnvol_req *req);
/*
* This function is the same as the 'ubi_leb_read()' function, but it does not
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 0/2] mtd: ubi: implement the new command 'ubirename'
From: Giorgio Dal Molin @ 2016-09-23 9:07 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160922080408.rpqeithibjfga2rm@pengutronix.de>
Here a new set of patches implementing the command 'ubirename'.
They are based on a patch serie from Sascha that restructures a bit
the barebox UBI APIs. In particular it is now easier to find the ubi
volume ids from the command code. Moreover the command code uses now
api functions to do the rename.
Giorgio Dal Molin (2):
mtd: ubi: add API call to rename volumes.
mtd: ubi: commands: added the new command 'ubirename'.
commands/ubi.c | 71 +++++++++++++++++++++
drivers/mtd/ubi/barebox.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/mtd/ubi/vmt.c | 3 +
include/linux/mtd/ubi.h | 1 +
4 files changed, 231 insertions(+)
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* [PATCH 2/2] mtd: ubi: commands: added the new command 'ubirename'.
From: Giorgio Dal Molin @ 2016-09-23 9:07 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160922080408.rpqeithibjfga2rm@pengutronix.de>
Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
---
commands/ubi.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
diff --git a/commands/ubi.c b/commands/ubi.c
index 7c55195..3c5729e 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -328,3 +328,74 @@ BAREBOX_CMD_START(ubirmvol)
BAREBOX_CMD_GROUP(CMD_GRP_PART)
BAREBOX_CMD_HELP(cmd_ubirmvol_help)
BAREBOX_CMD_END
+
+static int get_vol_id(u32 ubi_num, const char *name)
+{
+ struct ubi_volume_desc *desc;
+ struct ubi_volume_info vi;
+
+ desc = ubi_open_volume_nm(ubi_num, name, UBI_READONLY);
+ if(IS_ERR(desc))
+ return PTR_ERR(desc);
+
+ ubi_get_volume_info(desc, &vi);
+
+ return vi.vol_id;
+};
+
+static int do_ubirename(int argc, char *argv[])
+{
+ struct ubi_rnvol_req req;
+ u32 ubi_num;
+ int i, j, fd, ret;
+
+ if ((argc < 4) || (argc % 2))
+ return COMMAND_ERROR_USAGE;
+
+ req.count = (argc / 2) - 1;
+ if (req.count > UBI_MAX_RNVOL) {
+ printf("too many volume renames. (max: %u)\n", UBI_MAX_RNVOL);
+ return COMMAND_ERROR_USAGE;
+ }
+
+ fd = open(argv[1], O_WRONLY);
+ if (fd < 0) {
+ perror("open ubi dev");
+ return 1;
+ }
+
+ ret = ioctl(fd, UBI_IOCGETUBINUM, &ubi_num);
+ if (ret) {
+ perror("failed to get the ubi num");
+ return COMMAND_ERROR_USAGE;
+ }
+ close(fd);
+
+ for(i=2, j=0; i<argc; ++j, i+=2) {
+ req.ents[j].vol_id = get_vol_id(ubi_num, argv[i]);
+ if(req.ents[j].vol_id < 0) {
+ printf("'%s' is not a volume name.\n", argv[i]);
+ return COMMAND_ERROR_USAGE;
+ }
+ strncpy(req.ents[j].name, argv[i+1], UBI_MAX_VOLUME_NAME);
+ req.ents[j].name_len = strlen(req.ents[j].name);
+ }
+
+ ret = ubi_api_rename_volumes(ubi_num, &req);
+ if (ret)
+ perror("failed to rename.");
+
+ return ret ? 1 : 0;
+};
+
+BAREBOX_CMD_HELP_START(ubirename)
+BAREBOX_CMD_HELP_TEXT("Rename UBI volume(s) from UBIDEV")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(ubirename)
+ .cmd = do_ubirename,
+ BAREBOX_CMD_DESC("rename UBI volume(s)")
+ BAREBOX_CMD_OPTS("UBIDEV OLD_NAME NEW_NAME [OLD_NAME NEW_NAME ...]")
+ BAREBOX_CMD_GROUP(CMD_GRP_PART)
+ BAREBOX_CMD_HELP(cmd_ubirename_help)
+BAREBOX_CMD_END
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* Aw: Re: [PATCH 2/2] commands: ubi: added the new command 'ubirename' to rename ubi volumes.
From: iw3gtf @ 2016-09-23 10:11 UTC (permalink / raw)
To: s.hauer; +Cc: barebox
In-Reply-To: <20160922080408.rpqeithibjfga2rm@pengutronix.de>
Hi,
----- Original Nachricht ----
Von: Sascha Hauer <s.hauer@pengutronix.de>
An: Giorgio Dal Molin <iw3gtf@arcor.de>
Datum: 22.09.2016 10:04
Betreff: Re: [PATCH 2/2] commands: ubi: added the new command 'ubirename' to
rename ubi volumes.
> On Wed, Sep 21, 2016 at 10:04:43AM +0200, Giorgio Dal Molin wrote:
> > From: Giorgio Dal Molin <giorgio.dal.molin@mobotix.com>
> >
> > The syntax was taken from the corresponding command of the 'mts-utils'
> > userland package:
> >
> > # ubirename UBIDEV OLD_NAME NEW_NAME [OLD_NAME NEW_NAME ...]
> >
> > Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
> > ---
> > commands/ubi.c | 87
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 87 insertions(+)
> >
> > diff --git a/commands/ubi.c b/commands/ubi.c
> > index 26b521f..3479340 100644
> > --- a/commands/ubi.c
> > +++ b/commands/ubi.c
> > @@ -6,6 +6,8 @@
> > #include <errno.h>
> > #include <getopt.h>
> > #include <linux/mtd/mtd.h>
> > +#include <linux/mtd/ubi.h>
> > +#include <libgen.h>
> > #include <linux/kernel.h>
> > #include <linux/stat.h>
> > #include <linux/mtd/mtd-abi.h>
> > @@ -306,3 +308,88 @@ BAREBOX_CMD_START(ubirmvol)
> > BAREBOX_CMD_GROUP(CMD_GRP_PART)
> > BAREBOX_CMD_HELP(cmd_ubirmvol_help)
> > BAREBOX_CMD_END
> > +
> > +
> > +static int get_vol_id(const char *vol_name)
> > +{
> > + struct ubi_volume_desc *desc;
> > + struct cdev *vol_cdev;
> > + struct ubi_volume_info vi;
> > +
> > + vol_cdev = cdev_by_name(vol_name);
> > + if(!vol_cdev) {
> > + perror("cdev_by_name");
> > + return -1;
> > + }
> > + desc = ubi_open_volume_cdev(vol_cdev, UBI_READONLY);
> > + if(IS_ERR(desc)) {
> > + perror("ubi_open_volume_cdev");
> > + return -1;
> > + }
> > + ubi_get_volume_info(desc, &vi);
> > + ubi_close_volume(desc);
> > +
> > + return vi.vol_id;
> > +};
>
> This get_vol_id() is not particularly nice. Also I do not like having
> the rename operation inside the ioctl parser as this means we cannot
> make the ubirename code optional for users that do not need renaming.
>
> I just sent out a series which should help you in this regard. Can you
> base your code ontop of this?
I've noticed a problem in the 3rd patch ([PATCH 3/4] mtd: ubi: commands: use function API to access ubi volumes)
of your last UBI serie: in the resulting code in 'commands/ubi.c', function 'do_ubirmvol()':
...
desc = ubi_open_volume_nm(ubinum, argv[2], UBI_EXCLUSIVE);
if (IS_ERR(desc)) {
ret = PTR_ERR(desc);
printf("failed to open volume %s: %s\n", argv[2], strerror(-ret));
goto err1;
}
ret = ubi_api_remove_volume(desc, 0);
if (ret)
printf("failed to remove volume %s: %s\n", argv[2], strerror(-ret));
err1:
ubi_close_volume(desc);
err:
close(fd);
return ret ? 1 : 0;
}
You have a wrong 'goto err1': in that case the 'desc' pointer is not a memory address, it
represent a negative error code and you cannot use it in ubi_close_volume(desc) (it segfaults).
>
> You should be able to get the vol_id with ubi_open_volume_nm() followed
> by ubi_get_volume_info().
>
> The rename_volumes() from patch #1 should become a
> ubi_api_rename_volumes() directly called from the command code.
>
> Sascha
>
giorgio
Giorgio, iw3gtf@arcor.de
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH] Documentation: clarify "ioe" for netconsole
From: Lucas Stach @ 2016-09-24 19:01 UTC (permalink / raw)
To: Robert Schwebel, barebox
In-Reply-To: <1474564997-8781-1-git-send-email-r.schwebel@pengutronix.de>
Am Donnerstag, den 22.09.2016, 19:23 +0200 schrieb Robert Schwebel:
> ioe means "input", "output", "error", which are bits that can be set
> individually.
>
> Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> ---
> Documentation/user/networking.rst | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/user/networking.rst
> b/Documentation/user/networking.rst
> index 8afb433..772a7dc 100644
> --- a/Documentation/user/networking.rst
> +++ b/Documentation/user/networking.rst
> @@ -74,6 +74,7 @@ risks. It can be enabled using:
> netconsole.active=ioe
>
> This will send UDP packets to a PC with IP address 192.168.23.2 and
> port 6666.
> +"ioe" means "input", "output", "error", and those bits can be set
> individually.
This isn't specific to netconsole, as it works for framebuffer consoles
in the same way. So should probably be moved to some common location.
Regards,
Lucas
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 1/3] reset: import socfpga-reset driver from linux
From: Sascha Hauer @ 2016-09-26 5:58 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: barebox
In-Reply-To: <1474547628-16751-1-git-send-email-s.trumtrar@pengutronix.de>
On Thu, Sep 22, 2016 at 02:33:46PM +0200, Steffen Trumtrar wrote:
> Port the linux v4.8-rc1 reset-socfpga driver to barebox.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> drivers/reset/Makefile | 1 +
> drivers/reset/reset-socfpga.c | 125 ++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 126 insertions(+)
> create mode 100644 drivers/reset/reset-socfpga.c
>
> diff --git a/drivers/reset/Makefile b/drivers/reset/Makefile
> index 1e2d83f2b995..52b10cd48055 100644
> --- a/drivers/reset/Makefile
> +++ b/drivers/reset/Makefile
> @@ -1 +1,2 @@
> obj-$(CONFIG_RESET_CONTROLLER) += core.o
> +obj-$(CONFIG_ARCH_SOCFPGA) += reset-socfpga.o
> diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
> new file mode 100644
> index 000000000000..e30db8134739
> --- /dev/null
> +++ b/drivers/reset/reset-socfpga.c
> @@ -0,0 +1,125 @@
> +/*
> + * Copyright 2014 Steffen Trumtrar <s.trumtrar@pengutronix.de>
> + *
> + * based on
> + * Allwinner SoCs Reset Controller driver
> + *
> + * Copyright 2013 Maxime Ripard
> + *
> + * Maxime Ripard <maxime.ripard@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.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +#include <io.h>
> +#include <linux/err.h>
> +#include <linux/reset-controller.h>
> +#include <linux/spinlock.h>
> +#include <linux/types.h>
> +
> +#define NR_BANKS 4
> +
> +struct socfpga_reset_data {
> + spinlock_t lock;
> + void __iomem *membase;
> + u32 modrst_offset;
> + struct reset_controller_dev rcdev;
> +};
> +
> +static int socfpga_reset_assert(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct socfpga_reset_data *data = container_of(rcdev,
> + struct socfpga_reset_data,
> + rcdev);
> + int bank = id / BITS_PER_LONG;
> + int offset = id % BITS_PER_LONG;
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
> + writel(reg | BIT(offset), data->membase + data->modrst_offset +
> + (bank * NR_BANKS));
> + spin_unlock_irqrestore(&data->lock, flags);
> +
> + return 0;
> +}
> +
> +static int socfpga_reset_deassert(struct reset_controller_dev *rcdev,
> + unsigned long id)
> +{
> + struct socfpga_reset_data *data = container_of(rcdev,
> + struct socfpga_reset_data,
> + rcdev);
> +
> + int bank = id / BITS_PER_LONG;
> + int offset = id % BITS_PER_LONG;
> + unsigned long flags;
> + u32 reg;
> +
> + spin_lock_irqsave(&data->lock, flags);
> +
> + reg = readl(data->membase + data->modrst_offset + (bank * NR_BANKS));
> + writel(reg & ~BIT(offset), data->membase + data->modrst_offset +
> + (bank * NR_BANKS));
> +
> + spin_unlock_irqrestore(&data->lock, flags);
> +
> + return 0;
> +}
> +
> +static struct reset_control_ops socfpga_reset_ops = {
> + .assert = socfpga_reset_assert,
> + .deassert = socfpga_reset_deassert,
> +};
> +
> +static int socfpga_reset_probe(struct device_d *dev)
> +{
> + struct socfpga_reset_data *data;
> + struct resource *res;
> + struct device_node *np = dev->device_node;
> +
> + data = xzalloc(sizeof(*data));
> +
> + res = dev_get_resource(dev, IORESOURCE_MEM, 0);
> + if (IS_ERR(res))
> + return PTR_ERR(res);
You should use dev_request_mem_resource() here.
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 2/3] watchdog: add designware driver
From: Sascha Hauer @ 2016-09-26 6:01 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: barebox
In-Reply-To: <1474547628-16751-2-git-send-email-s.trumtrar@pengutronix.de>
On Thu, Sep 22, 2016 at 02:33:47PM +0200, Steffen Trumtrar wrote:
> Port the linux v4.8-rc1 Synopsys DesignWare watchdog driver to barebox.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> drivers/watchdog/Kconfig | 6 ++
> drivers/watchdog/Makefile | 1 +
> drivers/watchdog/dw_wdt.c | 194 ++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 201 insertions(+)
> create mode 100644 drivers/watchdog/dw_wdt.c
>
> + struct dw_wdt *dw_wdt = to_dw_wdt(wdd);
> +
> + writel(WDOG_CONTROL_REG_WDT_EN_MASK,
> + dw_wdt->regs + WDOG_CONTROL_REG_OFFSET);
> +
> + return 0;
> +}
> +
> +static int dw_wdt_stop(struct watchdog *wdd)
> +{
> + struct dw_wdt *dw_wdt = to_dw_wdt(wdd);
> +
> + if (IS_ERR(dw_wdt->rst)) {
> + pr_warn("No reset line. Will not stop.\n");
dev_warn
> + return PTR_ERR(dw_wdt->rst);
> + }
> +
> + reset_control_assert(dw_wdt->rst);
> + reset_control_deassert(dw_wdt->rst);
> +
> + return 0;
> +}
...
> +
> + ret = restart_handler_register(&dw_wdt->restart);
> + if (ret)
> + pr_warn("cannot register restart handler\n");
ditto
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 1/3] nand: denali: use correct interrupts in read_page
From: Sascha Hauer @ 2016-09-26 6:03 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: barebox
In-Reply-To: <20160922144639.28305-1-s.trumtrar@pengutronix.de>
On Thu, Sep 22, 2016 at 04:46:37PM +0200, Steffen Trumtrar wrote:
> The interrupt mask is incorrect in case of HW error correction.
> The driver will time out waiting for the wrong interrupts.
>
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> drivers/mtd/nand/nand_denali.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/drivers/mtd/nand/nand_denali.c b/drivers/mtd/nand/nand_denali.c
> index bf9a05d85264..ceb5a8b87e42 100644
> --- a/drivers/mtd/nand/nand_denali.c
> +++ b/drivers/mtd/nand/nand_denali.c
> @@ -1102,8 +1102,9 @@ static int denali_read_page(struct mtd_info *mtd, struct nand_chip *chip,
> size_t size = denali->mtd.writesize + denali->mtd.oobsize;
>
> uint32_t irq_status;
> - uint32_t irq_mask = INTR_STATUS__ECC_TRANSACTION_DONE |
> - INTR_STATUS__ECC_ERR;
> + uint32_t irq_mask = denali->have_hw_ecc_fixup ?
> + (INTR_STATUS__DMA_CMD_COMP) :
> + (INTR_STATUS__ECC_TRANSACTION_DONE | INTR_STATUS__ECC_ERR);
> bool check_erased_page = false;
>
> if (page != denali->page) {
> --
> 2.9.3
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH v2] environment: "wrong magic" gives the impression of an error
From: Sascha Hauer @ 2016-09-26 6:05 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Barebox List
In-Reply-To: <20160922191634.GA23455@ravnborg.org>
On Thu, Sep 22, 2016 at 09:16:34PM +0200, Sam Ravnborg wrote:
> From 15e7ff689cfda27eab10aacda5c26a1ba47979ec Mon Sep 17 00:00:00 2001
> From: Sam Ravnborg <srn@skov.dk>
> Date: Thu, 22 Sep 2016 06:54:42 +0200
> Subject: [PATCH 1/1] environment: "wrong magic" give the impression of an
> error
>
> Introduce a more soft wording when the magic of
> the superblock does not match.
> Include a hint to the typical reason "(envfs never written?)"
>
> This prevents a "what is wrong?" moment when looking at
> the boot log.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> ---
Applied, thanks
Sascha
>
> v2:
> Dropped change in envfs_load_data(). envfs_load_data() is used
> to traverse the inodes and if we reach this far we
> have encountered a real error which should be reported.
> Thanks to Sascha for spottign this mistake!
>
> Sam
>
> common/environment.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/common/environment.c b/common/environment.c
> index db127d7..c9cef63 100644
> --- a/common/environment.c
> +++ b/common/environment.c
> @@ -382,7 +382,7 @@ EXPORT_SYMBOL(envfs_save);
> static int envfs_check_super(struct envfs_super *super, size_t *size)
> {
> if (ENVFS_32(super->magic) != ENVFS_MAGIC) {
> - printf("envfs: wrong magic\n");
> + printf("envfs: no envfs (magic mismatch) - envfs newer written?\n");
> return -EIO;
> }
>
> --
> 1.8.3.1
>
>
--
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] Documentation: clarify that patches should target the master branch.
From: Sascha Hauer @ 2016-09-26 6:06 UTC (permalink / raw)
To: Robert Schwebel; +Cc: barebox
In-Reply-To: <1474564462-8419-1-git-send-email-r.schwebel@pengutronix.de>
On Thu, Sep 22, 2016 at 07:14:22PM +0200, Robert Schwebel wrote:
> I asked Sascha if he still prefers patches against 'next', and it turned
> out that this is not true any more and patches should be sent against
> master.
>
> Signed-off-by: Robert Schwebel <r.schwebel@pengutronix.de>
> ---
> Documentation/user/barebox.rst | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
Applied, thanks
Sascha
>
> diff --git a/Documentation/user/barebox.rst b/Documentation/user/barebox.rst
> index 32cec3d..1203c10 100644
> --- a/Documentation/user/barebox.rst
> +++ b/Documentation/user/barebox.rst
> @@ -28,9 +28,11 @@ can be checked out as follows:
> Checking connectivity... done.
> Checking out files: 100% (5651/5651), done.
>
> -After this, make sure to check out the appropriate branch. If you want to
> -develop for barebox, it's best to check out the ``next`` branch rather than
> -the ``master`` branch:
> +By default, the master branch is checked out. If you want to develop for
> +barebox, this is the right branch to send patches against.
> +
> +If you want to see which patches are already selected for the next release,
> +you can look at the ``next`` branch:
>
> .. code-block:: sh
>
> --
> 2.8.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 2/2] mtd: ubi: commands: added the new command 'ubirename'.
From: Sascha Hauer @ 2016-09-26 6:19 UTC (permalink / raw)
To: Giorgio Dal Molin; +Cc: barebox
In-Reply-To: <20160923090739.25517-3-iw3gtf@arcor.de>
Hi Giorgio,
Looks good mostly. Patch 1/2 is fine, some small remarks for this one.
On Fri, Sep 23, 2016 at 11:07:39AM +0200, Giorgio Dal Molin wrote:
> Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
> ---
> commands/ubi.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 71 insertions(+)
>
> diff --git a/commands/ubi.c b/commands/ubi.c
> index 7c55195..3c5729e 100644
> --- a/commands/ubi.c
> +++ b/commands/ubi.c
> @@ -328,3 +328,74 @@ BAREBOX_CMD_START(ubirmvol)
> BAREBOX_CMD_GROUP(CMD_GRP_PART)
> BAREBOX_CMD_HELP(cmd_ubirmvol_help)
> BAREBOX_CMD_END
> +
> + ret = ioctl(fd, UBI_IOCGETUBINUM, &ubi_num);
> + if (ret) {
> + perror("failed to get the ubi num");
> + return COMMAND_ERROR_USAGE;
> + }
> + close(fd);
> +
> + for(i=2, j=0; i<argc; ++j, i+=2) {
Please add a space pn both sides of binary operators.
> + req.ents[j].vol_id = get_vol_id(ubi_num, argv[i]);
> + if(req.ents[j].vol_id < 0) {
> + printf("'%s' is not a volume name.\n", argv[i]);
It is a volume name, but not a valid one. Better something like
printf("Volume '%s' does not exist on %s\n", argv[i], argv[1]);
?
> + return COMMAND_ERROR_USAGE;
> + }
> + strncpy(req.ents[j].name, argv[i+1], UBI_MAX_VOLUME_NAME);
> + req.ents[j].name_len = strlen(req.ents[j].name);
> + }
> +
> + ret = ubi_api_rename_volumes(ubi_num, &req);
> + if (ret)
> + perror("failed to rename.");
perror("failed to rename: %s", strerror(-ret));
It's always nice to print the error reason if we can.
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
* [PATCH/RFT] scripts: kwboot: improve reliability on Armada XP
From: Uwe Kleine-König @ 2016-09-26 8:15 UTC (permalink / raw)
To: barebox; +Cc: Thomas Petazzoni, Kevin Smith, Stefan Roese
This introduces several changes that improve pushing a boot image via
UART to an Armada XP based machine (Netgear RN 2120 with BootROM 1.20).
They were found by inspecting the source, the actual communication and
disassembling the boot ROM.
The changes are:
- Don't use non-blocking open. This prevents trying to read the answer
from the SoC before the magic sequence was sent.
- Don't flush the input after each sending of the boot sequence as this
might discard the SoC's reply.
- A likely reason for a NAK is that sender and receiver are not synced
on xmodem packet boundary. This happens easily when the host sends to
many boot sequences. So on a NAK send 0xff to resync.
Unfortunately this doesn't make sending reliable yet. I can enter UART
boot mode, but it is aborted after several packets, which I failed to
debug up to now.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Hello,
I have an Armada 370 based machine here, but didn't manage to test a
resync and also didn't find the bootrom yet to verify it supports that
0xff resync.
So testing and bootrom images welcome :-)
Best regards
Uwe
scripts/kwboot.c | 72 ++++++++++++++++++++++++++++++++++------
1 file changed, 62 insertions(+), 10 deletions(-)
diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 9b0d1d0602a0..1db4ab0faba1 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -35,7 +35,7 @@ static unsigned char kwboot_msg_debug[] = {
};
#define KWBOOT_MSG_REQ_DELAY 1000 /* ms */
-#define KWBOOT_MSG_RSP_TIMEO 1000 /* ms */
+#define KWBOOT_MSG_RSP_TIMEO 1 /* ms */
/*
* Xmodem Transfers
@@ -233,7 +233,7 @@ kwboot_open_tty(const char *path, speed_t speed)
rc = -1;
- fd = open(path, O_RDWR|O_NOCTTY|O_NDELAY);
+ fd = open(path, O_RDWR | O_NOCTTY);
if (fd < 0)
goto out;
@@ -273,11 +273,11 @@ kwboot_bootmsg(int tty, void *msg)
else
kwboot_printv("Sending boot message. Please reboot the target...");
- do {
- rc = tcflush(tty, TCIOFLUSH);
- if (rc)
- break;
+ rc = tcflush(tty, TCIOFLUSH);
+ if (rc)
+ return rc;
+ do {
rc = kwboot_tty_send(tty, msg, 8);
if (rc) {
usleep(KWBOOT_MSG_REQ_DELAY * 1000);
@@ -285,12 +285,20 @@ kwboot_bootmsg(int tty, void *msg)
}
rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
-
- kwboot_spinner();
+ while (!rc && c != NAK) {
+ if (c == '\\')
+ kwboot_printv("\\\\", c);
+ else if (isprint(c))
+ kwboot_printv("%c", c);
+ else
+ kwboot_printv("\\x%02hhx", c);
+
+ rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
+ }
} while (rc || c != NAK);
- kwboot_printv("\n");
+ kwboot_printv("\nGot expected NAK\n");
return rc;
}
@@ -349,6 +357,48 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
return n;
}
+#define min(a, b) ((a) < (b) ? (a) : (b))
+
+static int
+kwboot_xm_resync(int fd)
+{
+ /*
+ * When the SoC has a different perception of where the package boundary
+ * is, just resending the packet doesn't help. To resync send 0xff until
+ * we get another NAK.
+ * The BootROM code (of the Armada XP at least) doesn't interpret 0xff
+ * as a start of a package and sends a NAK for each 0xff when waiting
+ * for SOH, so it's possible to send >1 byte without the SoC starting a
+ * new frame.
+ * When there is no response after sizeof(struct kwboot_block) bytes,
+ * there is another problem.
+ */
+ int rc;
+ char buf[sizeof(struct kwboot_block)];
+ unsigned interval = 1;
+ unsigned len;
+ char *p = buf;
+
+ memset(buf, 0xff, sizeof(buf));
+
+ while (interval <= sizeof(buf)) {
+ len = min(interval, buf + sizeof(buf) - p);
+ rc = kwboot_tty_send(fd, p, len);
+ if (rc)
+ return rc;
+
+ kwboot_tty_recv(fd, p, len, KWBOOT_BLK_RSP_TIMEO);
+ if (*p != 0xff)
+ /* got at least one char, if it's a NAK we're synced. */
+ return (*p == NAK);
+
+ p += len;
+ interval *= 2;
+ }
+
+ return 0;
+}
+
static int
kwboot_xm_sendblock(int fd, struct kwboot_block *block)
{
@@ -371,7 +421,9 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
} while (c != ACK && c != NAK && c != CAN);
- if (c != ACK)
+ if (c == NAK && kwboot_xm_resync(fd))
+ kwboot_progress(-1, 'S');
+ else if (c != ACK)
kwboot_progress(-1, '+');
} while (c == NAK && retries-- > 0);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 1/2] firmware: altera-serial: Make the driver match the dt binding documentation
From: Uwe Kleine-König @ 2016-09-26 9:11 UTC (permalink / raw)
To: barebox
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/firmware/altera_serial.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
index 4527d27c5c98..5486d9ec63e9 100644
--- a/drivers/firmware/altera_serial.c
+++ b/drivers/firmware/altera_serial.c
@@ -35,9 +35,9 @@
*
* fpga@0 {
* compatible = "altr,fpga-passive-serial";
- * nstat-gpio = <&gpio4 18 0>;
- * confd-gpio = <&gpio4 19 0>;
- * nconfig-gpio = <&gpio4 20 0>;
+ * nstat-gpios = <&gpio4 18 0>;
+ * confd-gpios = <&gpio4 19 0>;
+ * nconfig-gpios = <&gpio4 20 0>;
* spi-max-frequency = <10000000>;
* reg = <0>;
* };
@@ -220,7 +220,7 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
const char *name;
int ret;
- name = "nstat-gpio";
+ name = "nstat-gpios";
if (!of_get_property(n, name, NULL)) {
dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n");
this->nstat_gpio = -1;
@@ -232,14 +232,14 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
}
}
- name = "confd-gpio";
+ name = "confd-gpios";
this->confd_gpio = of_get_named_gpio(n, name, 0);
if (this->confd_gpio < 0) {
ret = this->confd_gpio;
goto out;
}
- name = "nconfig-gpio";
+ name = "nconfig-gpios";
this->nconfig_gpio = of_get_named_gpio(n, name, 0);
if (this->nconfig_gpio < 0) {
ret = this->nconfig_gpio;
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 2/2] firmware: altera-serial: simplify handling of optional gpio
From: Uwe Kleine-König @ 2016-09-26 9:11 UTC (permalink / raw)
To: barebox
In-Reply-To: <20160926091137.24719-1-u.kleine-koenig@pengutronix.de>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/firmware/altera_serial.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
index 5486d9ec63e9..ddee991ed073 100644
--- a/drivers/firmware/altera_serial.c
+++ b/drivers/firmware/altera_serial.c
@@ -221,15 +221,13 @@ static int altera_spi_of(struct device_d *dev, struct fpga_spi *this)
int ret;
name = "nstat-gpios";
- if (!of_get_property(n, name, NULL)) {
+ this->nstat_gpio = of_get_named_gpio(n, name, 0);
+ if (this->nstat_gpio == -ENOENT) {
dev_info(dev, "nstat-gpio is not specified, assuming it is not connected\n");
this->nstat_gpio = -1;
- } else {
- this->nstat_gpio = of_get_named_gpio(n, name, 0);
- if (this->nstat_gpio < 0) {
- ret = this->nstat_gpio;
- goto out;
- }
+ } else if (this->nstat_gpio < 0) {
+ ret = this->nstat_gpio;
+ goto out;
}
name = "confd-gpios";
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* Re: [PATCH 1/2] firmware: altera-serial: Make the driver match the dt binding documentation
From: Uwe Kleine-König @ 2016-09-26 9:37 UTC (permalink / raw)
To: barebox
In-Reply-To: <20160926091137.24719-1-u.kleine-koenig@pengutronix.de>
Hello Sascha
I just noticed there is an additional change needed:
diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
index ddee991ed073..b119778d720d 100644
--- a/drivers/firmware/altera_serial.c
+++ b/drivers/firmware/altera_serial.c
@@ -328,7 +328,7 @@ out:
static struct of_device_id altera_spi_id_table[] = {
{
- .compatible = "altr,passive-serial",
+ .compatible = "altr,fpga-passive-serial",
},
};
Should I resend, or can you fixup yourself?
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 0/2 (try 2)] mtd: ubi: implement the new command 'ubirename'
From: Giorgio Dal Molin @ 2016-09-26 10:52 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160926061912.elzmjbs4mdv5ztrb@pengutronix.de>
Here a new set of patches implementing the command 'ubirename'.
They are based on a patch serie from Sascha that restructures a bit
the barebox UBI APIs. In particular it is now easier to find the ubi
volume ids from the command code. Moreover the command code uses now
api functions to do the rename.
This new set also fixes some minor cosmetic details noted by Sascha and
a real problem found in the function 'get_vol_id()': it was missing
a call to 'ubi_close_volume(desc)' hence leaving ubi volumes busy.
A simple test that showed the problem was:
bb> ubimkvol /dev/nand0.ubi_volumes.ubi vol_A 10MiB
bb> ubirename /dev/nand0.ubi_volumes.ubi vol_A vol_B
bb> ubirmvol /dev/nand0.ubi_volumes.ubi vol_B
The last command, ubirmvol, failed because 'vol_B' appeared to be still
busy after the rename (vol->readers==1).
Giorgio Dal Molin (2):
mtd: ubi: add API call to rename volumes.
mtd: ubi: commands: added the new command 'ubirename'.
commands/ubi.c | 72 +++++++++++++++++++++
drivers/mtd/ubi/barebox.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/mtd/ubi/vmt.c | 3 +
include/linux/mtd/ubi.h | 1 +
4 files changed, 232 insertions(+)
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* [PATCH 2/2] mtd: ubi: commands: added the new command 'ubirename'.
From: Giorgio Dal Molin @ 2016-09-26 10:52 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160926061912.elzmjbs4mdv5ztrb@pengutronix.de>
Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
---
commands/ubi.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
diff --git a/commands/ubi.c b/commands/ubi.c
index 7c55195..34247d6 100644
--- a/commands/ubi.c
+++ b/commands/ubi.c
@@ -328,3 +328,75 @@ BAREBOX_CMD_START(ubirmvol)
BAREBOX_CMD_GROUP(CMD_GRP_PART)
BAREBOX_CMD_HELP(cmd_ubirmvol_help)
BAREBOX_CMD_END
+
+static int get_vol_id(u32 ubi_num, const char *name)
+{
+ struct ubi_volume_desc *desc;
+ struct ubi_volume_info vi;
+
+ desc = ubi_open_volume_nm(ubi_num, name, UBI_READONLY);
+ if(IS_ERR(desc))
+ return PTR_ERR(desc);
+
+ ubi_get_volume_info(desc, &vi);
+ ubi_close_volume(desc);
+
+ return vi.vol_id;
+};
+
+static int do_ubirename(int argc, char *argv[])
+{
+ struct ubi_rnvol_req req;
+ u32 ubi_num;
+ int i, j, fd, ret;
+
+ if ((argc < 4) || (argc % 2))
+ return COMMAND_ERROR_USAGE;
+
+ req.count = (argc / 2) - 1;
+ if (req.count > UBI_MAX_RNVOL) {
+ printf("too many volume renames. (max: %u)\n", UBI_MAX_RNVOL);
+ return COMMAND_ERROR_USAGE;
+ }
+
+ fd = open(argv[1], O_WRONLY);
+ if (fd < 0) {
+ perror("unable to open the UBI device");
+ return 1;
+ }
+
+ ret = ioctl(fd, UBI_IOCGETUBINUM, &ubi_num);
+ if (ret) {
+ perror("failed to get the ubi num");
+ return COMMAND_ERROR_USAGE;
+ }
+ close(fd);
+
+ for(i=2, j=0; i < argc; ++j, i += 2) {
+ req.ents[j].vol_id = get_vol_id(ubi_num, argv[i]);
+ if(req.ents[j].vol_id < 0) {
+ printf("Volume '%s' does not exist on %s\n", argv[i], argv[1]);
+ return COMMAND_ERROR_USAGE;
+ }
+ strncpy(req.ents[j].name, argv[i+1], UBI_MAX_VOLUME_NAME);
+ req.ents[j].name_len = strlen(req.ents[j].name);
+ }
+
+ ret = ubi_api_rename_volumes(ubi_num, &req);
+ if (ret)
+ perror("failed to rename.");
+
+ return ret ? 1 : 0;
+};
+
+BAREBOX_CMD_HELP_START(ubirename)
+BAREBOX_CMD_HELP_TEXT("Rename UBI volume(s) from UBIDEV")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(ubirename)
+ .cmd = do_ubirename,
+ BAREBOX_CMD_DESC("rename UBI volume(s)")
+ BAREBOX_CMD_OPTS("UBIDEV OLD_NAME NEW_NAME [OLD_NAME NEW_NAME ...]")
+ BAREBOX_CMD_GROUP(CMD_GRP_PART)
+ BAREBOX_CMD_HELP(cmd_ubirename_help)
+BAREBOX_CMD_END
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 1/2] mtd: ubi: add API call to rename volumes.
From: Giorgio Dal Molin @ 2016-09-26 10:52 UTC (permalink / raw)
To: barebox; +Cc: Giorgio Dal Molin
In-Reply-To: <20160926061912.elzmjbs4mdv5ztrb@pengutronix.de>
Signed-off-by: Giorgio Dal Molin <iw3gtf@arcor.de>
---
drivers/mtd/ubi/barebox.c | 156 ++++++++++++++++++++++++++++++++++++++++++++++
drivers/mtd/ubi/vmt.c | 3 +
include/linux/mtd/ubi.h | 1 +
3 files changed, 160 insertions(+)
diff --git a/drivers/mtd/ubi/barebox.c b/drivers/mtd/ubi/barebox.c
index 23c4bfd..329cf45 100644
--- a/drivers/mtd/ubi/barebox.c
+++ b/drivers/mtd/ubi/barebox.c
@@ -280,6 +280,162 @@ int ubi_api_remove_volume(struct ubi_volume_desc *desc, int no_vtbl)
return ubi_remove_volume(desc, no_vtbl);
}
+int ubi_api_rename_volumes(int ubi_num, struct ubi_rnvol_req *req)
+{
+ int i, n, err;
+ struct list_head rename_list;
+ struct ubi_rename_entry *re, *re1;
+ struct ubi_device *ubi;
+
+ if (req->count < 0 || req->count > UBI_MAX_RNVOL)
+ return -EINVAL;
+
+ if (req->count == 0)
+ return 0;
+
+ ubi = ubi_get_device(ubi_num);
+ if (!ubi)
+ return -ENODEV;
+
+ /* Validate volume IDs and names in the request */
+ for (i = 0; i < req->count; i++) {
+ if (req->ents[i].vol_id < 0 ||
+ req->ents[i].vol_id >= ubi->vtbl_slots)
+ return -EINVAL;
+ if (req->ents[i].name_len < 0)
+ return -EINVAL;
+ if (req->ents[i].name_len > UBI_VOL_NAME_MAX)
+ return -ENAMETOOLONG;
+ req->ents[i].name[req->ents[i].name_len] = '\0';
+ n = strlen(req->ents[i].name);
+ if (n != req->ents[i].name_len)
+ return -EINVAL;
+ }
+
+ /* Make sure volume IDs and names are unique */
+ for (i = 0; i < req->count - 1; i++) {
+ for (n = i + 1; n < req->count; n++) {
+ if (req->ents[i].vol_id == req->ents[n].vol_id) {
+ ubi_err(ubi, "duplicated volume id %d",
+ req->ents[i].vol_id);
+ return -EINVAL;
+ }
+ if (!strcmp(req->ents[i].name, req->ents[n].name)) {
+ ubi_err(ubi, "duplicated volume name \"%s\"",
+ req->ents[i].name);
+ return -EINVAL;
+ }
+ }
+ }
+
+ /* Create the re-name list */
+ INIT_LIST_HEAD(&rename_list);
+ for (i = 0; i < req->count; i++) {
+ int vol_id = req->ents[i].vol_id;
+ int name_len = req->ents[i].name_len;
+ const char *name = req->ents[i].name;
+
+ re = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL);
+ if (!re) {
+ err = -ENOMEM;
+ goto out_free;
+ }
+
+ re->desc = ubi_open_volume(ubi->ubi_num, vol_id, UBI_READONLY);
+ if (IS_ERR(re->desc)) {
+ err = PTR_ERR(re->desc);
+ ubi_err(ubi, "cannot open volume %d, error %d",
+ vol_id, err);
+ kfree(re);
+ goto out_free;
+ }
+
+ /* Skip this re-naming if the name does not really change */
+ if (re->desc->vol->name_len == name_len &&
+ !memcmp(re->desc->vol->name, name, name_len)) {
+ ubi_close_volume(re->desc);
+ kfree(re);
+ continue;
+ }
+
+ re->new_name_len = name_len;
+ memcpy(re->new_name, name, name_len);
+ list_add_tail(&re->list, &rename_list);
+ dbg_gen("will rename volume %d from \"%s\" to \"%s\"",
+ vol_id, re->desc->vol->name, name);
+ }
+
+ if (list_empty(&rename_list))
+ return 0;
+
+ /* Find out the volumes which have to be removed */
+ list_for_each_entry(re, &rename_list, list) {
+ struct ubi_volume_desc *desc;
+ int no_remove_needed = 0;
+
+ /*
+ * Volume @re->vol_id is going to be re-named to
+ * @re->new_name, while its current name is @name. If a volume
+ * with name @re->new_name currently exists, it has to be
+ * removed, unless it is also re-named in the request (@req).
+ */
+ list_for_each_entry(re1, &rename_list, list) {
+ if (re->new_name_len == re1->desc->vol->name_len &&
+ !memcmp(re->new_name, re1->desc->vol->name,
+ re1->desc->vol->name_len)) {
+ no_remove_needed = 1;
+ break;
+ }
+ }
+
+ if (no_remove_needed)
+ continue;
+
+ /*
+ * It seems we need to remove volume with name @re->new_name,
+ * if it exists.
+ */
+ desc = ubi_open_volume_nm(ubi->ubi_num, re->new_name,
+ UBI_EXCLUSIVE);
+ if (IS_ERR(desc)) {
+ err = PTR_ERR(desc);
+ if (err == -ENODEV)
+ /* Re-naming into a non-existing volume name */
+ continue;
+
+ /* The volume exists but busy, or an error occurred */
+ ubi_err(ubi, "cannot open volume \"%s\", error %d",
+ re->new_name, err);
+ goto out_free;
+ }
+
+ re1 = kzalloc(sizeof(struct ubi_rename_entry), GFP_KERNEL);
+ if (!re1) {
+ err = -ENOMEM;
+ ubi_close_volume(desc);
+ goto out_free;
+ }
+
+ re1->remove = 1;
+ re1->desc = desc;
+ list_add(&re1->list, &rename_list);
+ dbg_gen("will remove volume %d, name \"%s\"",
+ re1->desc->vol->vol_id, re1->desc->vol->name);
+ }
+
+ mutex_lock(&ubi->device_mutex);
+ err = ubi_rename_volumes(ubi, &rename_list);
+ mutex_unlock(&ubi->device_mutex);
+
+out_free:
+ list_for_each_entry_safe(re, re1, &rename_list, list) {
+ ubi_close_volume(re->desc);
+ list_del(&re->list);
+ kfree(re);
+ }
+ return err;
+}
+
static int ubi_cdev_ioctl(struct cdev *cdev, int cmd, void *buf)
{
struct ubi_device *ubi = cdev->priv;
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 41b814c..ed04364 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -411,6 +411,9 @@ int ubi_rename_volumes(struct ubi_device *ubi, struct list_head *rename_list)
vol->name_len = re->new_name_len;
memcpy(vol->name, re->new_name, re->new_name_len + 1);
+ free(vol->cdev.name);
+ vol->cdev.name = basprintf("%s.%s", ubi->cdev.name, vol->name);
+ vol->cdev.size = vol->used_bytes;
ubi_volume_notify(ubi, vol, UBI_VOLUME_RENAMED);
}
}
diff --git a/include/linux/mtd/ubi.h b/include/linux/mtd/ubi.h
index c72f95b..c215ff2 100644
--- a/include/linux/mtd/ubi.h
+++ b/include/linux/mtd/ubi.h
@@ -220,6 +220,7 @@ int ubi_flush(int ubi_num, int vol_id, int lnum);
int ubi_api_create_volume(int ubi_num, struct ubi_mkvol_req *req);
int ubi_api_remove_volume(struct ubi_volume_desc *desc, int no_vtbl);
+int ubi_api_rename_volumes(int ubi_num, struct ubi_rnvol_req *req);
/*
* This function is the same as the 'ubi_leb_read()' function, but it does not
--
2.10.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH v2] scripts: kwboot: improve reliability on Armada XP
From: Uwe Kleine-König @ 2016-09-26 11:12 UTC (permalink / raw)
To: barebox; +Cc: Thomas Petazzoni, Kevin Smith, Stefan Roese
In-Reply-To: <20160926081543.16088-1-u.kleine-koenig@pengutronix.de>
This introduces several changes that improve pushing a boot image via
UART to an Armada XP based machine (Netgear RN 2120 with BootROM 1.20).
They were found by inspecting the source, the actual communication and
disassembling the boot ROM.
The changes are:
- Don't use non-blocking open. This prevents trying to read the answer
from the SoC before the magic sequence was sent.
- Don't flush the input after each sending of the boot sequence as this
might discard the SoC's reply.
- A likely reason for a NAK is that sender and receiver are not synced
on xmodem packet boundary. This happens easily when the host sends to
many boot sequences. So on a NAK send 0xff to resync.
- Shorten the time between two tries to send the magic string.
This greatly improves the probabilty the string is sent while the SoC
listens for it. This only works because of the previous changes.
Unfortunately this doesn't make sending reliable yet. I can enter UART
boot mode, but it is aborted after several packets, which I failed to
debug up to now.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implict) v1 sent with
Message-Id: 20160926081543.16088-1-u.kleine-koenig@pengutronix.de
- mention that KWBOOT_MSG_RSP_TIMEO was made smaller
- fix build warning about isprint()
Testing is still welcome of course.
scripts/kwboot.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 63 insertions(+), 10 deletions(-)
diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index 9b0d1d0602a0..943e800fd928 100644
--- a/scripts/kwboot.c
+++ b/scripts/kwboot.c
@@ -9,6 +9,7 @@
* 2008. Chapter 24.2 "BootROM Firmware".
*/
+#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -35,7 +36,7 @@ static unsigned char kwboot_msg_debug[] = {
};
#define KWBOOT_MSG_REQ_DELAY 1000 /* ms */
-#define KWBOOT_MSG_RSP_TIMEO 1000 /* ms */
+#define KWBOOT_MSG_RSP_TIMEO 1 /* ms */
/*
* Xmodem Transfers
@@ -233,7 +234,7 @@ kwboot_open_tty(const char *path, speed_t speed)
rc = -1;
- fd = open(path, O_RDWR|O_NOCTTY|O_NDELAY);
+ fd = open(path, O_RDWR | O_NOCTTY);
if (fd < 0)
goto out;
@@ -273,11 +274,11 @@ kwboot_bootmsg(int tty, void *msg)
else
kwboot_printv("Sending boot message. Please reboot the target...");
- do {
- rc = tcflush(tty, TCIOFLUSH);
- if (rc)
- break;
+ rc = tcflush(tty, TCIOFLUSH);
+ if (rc)
+ return rc;
+ do {
rc = kwboot_tty_send(tty, msg, 8);
if (rc) {
usleep(KWBOOT_MSG_REQ_DELAY * 1000);
@@ -285,12 +286,20 @@ kwboot_bootmsg(int tty, void *msg)
}
rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
-
- kwboot_spinner();
+ while (!rc && c != NAK) {
+ if (c == '\\')
+ kwboot_printv("\\\\", c);
+ else if (isprint(c))
+ kwboot_printv("%c", c);
+ else
+ kwboot_printv("\\x%02hhx", c);
+
+ rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
+ }
} while (rc || c != NAK);
- kwboot_printv("\n");
+ kwboot_printv("\nGot expected NAK\n");
return rc;
}
@@ -349,6 +358,48 @@ kwboot_xm_makeblock(struct kwboot_block *block, const void *data,
return n;
}
+#define min(a, b) ((a) < (b) ? (a) : (b))
+
+static int
+kwboot_xm_resync(int fd)
+{
+ /*
+ * When the SoC has a different perception of where the package boundary
+ * is, just resending the packet doesn't help. To resync send 0xff until
+ * we get another NAK.
+ * The BootROM code (of the Armada XP at least) doesn't interpret 0xff
+ * as a start of a package and sends a NAK for each 0xff when waiting
+ * for SOH, so it's possible to send >1 byte without the SoC starting a
+ * new frame.
+ * When there is no response after sizeof(struct kwboot_block) bytes,
+ * there is another problem.
+ */
+ int rc;
+ char buf[sizeof(struct kwboot_block)];
+ unsigned interval = 1;
+ unsigned len;
+ char *p = buf;
+
+ memset(buf, 0xff, sizeof(buf));
+
+ while (interval <= sizeof(buf)) {
+ len = min(interval, buf + sizeof(buf) - p);
+ rc = kwboot_tty_send(fd, p, len);
+ if (rc)
+ return rc;
+
+ kwboot_tty_recv(fd, p, len, KWBOOT_BLK_RSP_TIMEO);
+ if (*p != 0xff)
+ /* got at least one char, if it's a NAK we're synced. */
+ return (*p == NAK);
+
+ p += len;
+ interval *= 2;
+ }
+
+ return 0;
+}
+
static int
kwboot_xm_sendblock(int fd, struct kwboot_block *block)
{
@@ -371,7 +422,9 @@ kwboot_xm_sendblock(int fd, struct kwboot_block *block)
} while (c != ACK && c != NAK && c != CAN);
- if (c != ACK)
+ if (c == NAK && kwboot_xm_resync(fd))
+ kwboot_progress(-1, 'S');
+ else if (c != ACK)
kwboot_progress(-1, '+');
} while (c == NAK && retries-- > 0);
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH] blspec: fix erroneus free in entry_is_of_compatible()
From: Ulrich Ölmann @ 2016-09-27 5:45 UTC (permalink / raw)
To: Barebox List
Whenever of_unflatten_dtb() encountered an error it already released the memory
before returning the error code. Make this apparent by setting the pointer to
NULL to avoid an erroneus free.
Signed-off-by: Ulrich Ölmann <u.oelmann@pengutronix.de>
---
common/blspec.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/common/blspec.c b/common/blspec.c
index 66decb161ebd..c205d481c911 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -399,6 +399,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
root = of_unflatten_dtb(fdt);
if (IS_ERR(root)) {
ret = PTR_ERR(root);
+ root = NULL;
goto out;
}
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* Re: [PATCH 1/2] firmware: altera-serial: Make the driver match the dt binding documentation
From: Sascha Hauer @ 2016-09-27 6:10 UTC (permalink / raw)
To: Uwe Kleine-König; +Cc: barebox
In-Reply-To: <20160926093729.txxe5hjd2i6a7fiv@pengutronix.de>
On Mon, Sep 26, 2016 at 11:37:29AM +0200, Uwe Kleine-König wrote:
> Hello Sascha
>
> I just noticed there is an additional change needed:
>
> diff --git a/drivers/firmware/altera_serial.c b/drivers/firmware/altera_serial.c
> index ddee991ed073..b119778d720d 100644
> --- a/drivers/firmware/altera_serial.c
> +++ b/drivers/firmware/altera_serial.c
> @@ -328,7 +328,7 @@ out:
>
> static struct of_device_id altera_spi_id_table[] = {
> {
> - .compatible = "altr,passive-serial",
> + .compatible = "altr,fpga-passive-serial",
> },
> };
>
> Should I resend, or can you fixup yourself?
Fixed while applying
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
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox