mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] ARM: imx6: split out IPU QoS setup
From: Lucas Stach @ 2016-09-15 11:10 UTC (permalink / raw)
  To: barebox

Split into separate function and only call it after the chip type
and revision is known.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/mach-imx/imx6.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index ba8fb8964ac8..07d3f57d8dcc 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -31,10 +31,8 @@ void imx6_init_lowlevel(void)
 {
 	void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
 	void __iomem *aips2 = (void *)MX6_AIPS2_ON_BASE_ADDR;
-	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
 	bool is_imx6q = __imx6_cpu_type() == IMX6_CPUTYPE_IMX6Q;
 	bool is_imx6d = __imx6_cpu_type() == IMX6_CPUTYPE_IMX6D;
-	uint32_t val;
 
 	/*
 	 * Set all MPROTx to be non-bufferable, trusted for R/W,
@@ -94,6 +92,13 @@ void imx6_init_lowlevel(void)
 		       MX6_ANATOP_BASE_ADDR + HW_ANADIG_PFD_528_CLR);
 	}
 
+}
+
+void imx6_setup_ipu_qos(void)
+{
+	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
+	uint32_t val;
+
 	val = readl(iomux + IOMUXC_GPR4);
 	val |= IMX6Q_GPR4_VPU_WR_CACHE_SEL | IMX6Q_GPR4_VPU_RD_CACHE_SEL |
 		IMX6Q_GPR4_VPU_P_WR_CACHE_VAL | IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK |
@@ -186,6 +191,8 @@ int imx6_init(void)
 
 	imx_set_silicon_revision(cputypestr, mx6_silicon_revision);
 
+	imx6_setup_ipu_qos();
+
 	return 0;
 }
 
-- 
2.8.1


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

^ permalink raw reply related

* [PATCH 2/3] ARM: imx6: don't execute IPU QoS setup on MX6 SX/SL
From: Lucas Stach @ 2016-09-15 11:10 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1473937823-30706-1-git-send-email-l.stach@pengutronix.de>

SX and SL variants only include the PXP and have no IPU, so
skip any IPU related QoS setup.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/mach-imx/imx6.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index 07d3f57d8dcc..567559033770 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -99,6 +99,10 @@ void imx6_setup_ipu_qos(void)
 	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
 	uint32_t val;
 
+	if (!cpu_mx6_is_mx6q() && !cpu_mx6_is_mx6d() &&
+	    !cpu_mx6_is_mx6dl() && cpu_mx6_is_mx6s())
+		return;
+
 	val = readl(iomux + IOMUXC_GPR4);
 	val |= IMX6Q_GPR4_VPU_WR_CACHE_SEL | IMX6Q_GPR4_VPU_RD_CACHE_SEL |
 		IMX6Q_GPR4_VPU_P_WR_CACHE_VAL | IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK |
-- 
2.8.1


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

^ permalink raw reply related

* [PATCH 3/3] ARM: imx6qp: set NoC regulator to bypass
From: Lucas Stach @ 2016-09-15 11:10 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1473937823-30706-1-git-send-email-l.stach@pengutronix.de>

The NoC regulator only passes the QoS signals through if it is
in bypass mode. This is a safe setting to give the IPU priority
over other requests. The kernel may change it to some other setting
once it knows the bandwidth requirements of the use-case.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/mach-imx/imx6.c                   | 11 +++++++++++
 arch/arm/mach-imx/include/mach/imx6-regs.h |  3 +++
 2 files changed, 14 insertions(+)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index 567559033770..f90eec8bd2c8 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -97,6 +97,7 @@ void imx6_init_lowlevel(void)
 void imx6_setup_ipu_qos(void)
 {
 	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
+	void __iomem *fast2 = (void *)MX6_FAST2_BASE_ADDR;
 	uint32_t val;
 
 	if (!cpu_mx6_is_mx6q() && !cpu_mx6_is_mx6d() &&
@@ -119,6 +120,16 @@ void imx6_setup_ipu_qos(void)
 	val &= ~(IMX6Q_GPR7_IPU2_ID00_RD_QOS_MASK | IMX6Q_GPR7_IPU2_ID01_RD_QOS_MASK);
 	val |= (0xf << 16) | (0x7 << 20);
 	writel(val, iomux + IOMUXC_GPR7);
+
+	/*
+	 * On i.MX6 QP/DP the NoC regulator for the IPU ports needs to be in
+	 * bypass mode for the above settings to take effect.
+	 */
+	if ((cpu_mx6_is_mx6q() || cpu_mx6_is_mx6d()) &&
+	    imx_silicon_revision() >= IMX_CHIP_REV_2_0) {
+		writel(0x2, fast2 + 0xb048c);
+		writel(0x2, fast2 + 0xb050c);
+	}
 }
 
 int imx6_init(void)
diff --git a/arch/arm/mach-imx/include/mach/imx6-regs.h b/arch/arm/mach-imx/include/mach/imx6-regs.h
index 68be43c9ab5b..e661c4ed120b 100644
--- a/arch/arm/mach-imx/include/mach/imx6-regs.h
+++ b/arch/arm/mach-imx/include/mach/imx6-regs.h
@@ -3,6 +3,9 @@
 
 #define MX6_GPMI_BASE_ADDR		0x00112000
 
+#define MX6_FAST1_BASE_ADDR		0x00c00000
+#define MX6_FAST2_BASE_ADDR		0x00b00000
+
 #define MX6_AIPS1_ARB_BASE_ADDR		0x02000000
 #define MX6_AIPS2_ARB_BASE_ADDR		0x02100000
 
-- 
2.8.1


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

^ permalink raw reply related

* Aw: Re: errors copying UBI volumes
From: iw3gtf @ 2016-09-15 11:13 UTC (permalink / raw)
  To: s.hauer, iw3gtf; +Cc: barebox

Hi Sascha,

thanks for the answer,

> Hi Giorgio,
> 
> On Wed, Sep 14, 2016 at 05:52:32PM +0200, iw3gtf@arcor.de wrote:
> > Hi,
> > 
> > I'm working on an embedded board with an iMX25 arm CPU and a nand flash.
> > 
> > The board runs a linux kernel/userland.
> > 
> > When the user updates the firmware, the running userland/kernel creates
> some
> > new ubi volumes on the nand, let's say 'kernel_next' and 'userland_next'.
> > On the next system reboot barebox looks if it finds, lets say, the
> 'kernel_next' volume
> > and, in this case, it removes the old one ('kernel'), creates a new, empty
> one ('kernel'),
> > copies 'kernel_next' to the just created 'kernel' and finally removes the
> 'kernel_next'
> > to complete the update.
> 
> While this should work, why so complicated? Since this commit:
> 
> | commit 892abde56c1c5a62d49d8b70c73e5d388e74345d
> | Author: Richard Weinberger <richard@nod.at>
> | Date:   Mon Nov 24 22:30:10 2014 +0100
> |
> |    UBI: rename_volumes: Use UBI_METAONLY
> |    
> |    By using UBI_METAONLY in rename_volumes() it is now possible to rename
> |    an UBI volume atomically while it is open for writing.
> |    This is useful for firmware upgrades.
> 
> It should be possible to just remove 'kernel' and rename 'kernel_next' to
> 'kernel'
> without bootloader intervention.

This is a very good news for me, I already wanted to ask for a UBI rename feature.
Could you please elaborate a bit on this point: I looked for a shell command like the
'ubirename', present in the 'mtd-utils' package, but could not find it. Maybe we just
need a new command implemented in '<barebox_root>/commands/ubi.c'.

> 
> BTW you should consider using Bootloader Spec entries
> (http://www.barebox.org/doc/latest/user/booting-linux.html#bootloader-spec).
> 
> This makes the kernel volume unnecessary and the kernel will only be a file
> in UBIFS and thus updating is a matter of 'cp newkernel /boot/kernel'.
> Also booting in barebox becomes as simple as 'boot nand0.ubi.rootfs', no
> further configuration or scripting required.
> 

thank you for the suggestion, I'll have a look at the method.

> > 
> > Here the relevant part of the init script:
> > 
> > ...
> > 	if [ -e $kernel_next ]; then
> > 		echo "Update the kernel... "
> > 		ubirmvol $ubi_root kernel
> > 		ubimkvol $ubi_root kernel 8M
> > 		cp $kernel_next $kernel
> > 		if [ $? != 0 ]; then
> > 			echo "***Errors copying $kernel_next to $kernel"
> > 			sleep 2
> > 		else
> > 			echo "Update OK."
> > 			ubirmvol $ubi_root kernel_next
> > 		fi
> > 	fi
> > ...
> > 
> > Now, after updating the barebox version to the current one, v2016.09.0,
> the 'cp' command
> > produces an almost endless sequence of failed assertions and stask
> backtraces:
> > 
> > ...
> > UBI assert failed in ubi_eba_read_leb at 359
> > Function entered at [<87053010>] from [<87018ce0>]
> > Function entered at [<87018ce0>] from [<87017fb4>]
> > Function entered at [<87017fb4>] from [<8703f100>]
> > Function entered at [<8703f100>] from [<8703f2cc>]
> > Function entered at [<8703f2cc>] from [<8703faf8>]
> > Function entered at [<8703faf8>] from [<87039e78>]
> > Function entered at [<87039e78>] from [<87029178>]
> > Function entered at [<87029178>] from [<87003614>]
> > Function entered at [<87003614>] from [<87008e0c>]
> > Function entered at [<87008e0c>] from [<870083a0>]
> > Function entered at [<870083a0>] from [<8700908c>]
> > Function entered at [<8700908c>] from [<870011cc>]
> > Function entered at [<870011cc>] from [<870515d4>]
> > Function entered at [<870515d4>] from [<80052648>]
> > UBI assert failed in ubi_eba_read_leb at 359
> > Function entered at [<87053010>] from [<87018ce0>]
> > Function entered at [<87018ce0>] from [<87017fb4>]
> > Function entered at [<87017fb4>] from [<8703f100>]
> > Function entered at [<8703f100>] from [<8703f2cc>]
> > Function entered at [<8703f2cc>] from [<8703faf8>]
> > Function entered at [<8703faf8>] from [<87039e78>]
> > ...
> 
> Please enable KALLSYMS to make this readable.
> 
> > 
> > After trying different things I realized that 'cp' has problems
> > only with UBI volumes that were created by the kernel/userland
> > during the firmware update process; if I create a volume within
> > barebox it just work as expected.
> > 
> > Here is the source code snippet with the failing assertion:
> > (file <barebox_root>/drivers/mtd/ubi/eba.c)
> > 
> > int ubi_eba_read_leb(struct ubi_device *ubi, struct ubi_volume *vol, int
> lnum,
> > 		     void *buf, int offset, int len, int check)
> > {
> > ...
> > 	pnum = vol->eba_tbl[lnum];
> > 	if (pnum < 0) {
> > 		/*
> > 		 * The logical eraseblock is not mapped, fill the whole buffer
> > 		 * with 0xFF bytes. The exception is static volumes for which
> > 		 * it is an error to read unmapped logical eraseblocks.
> > 		 */
> > 		dbg_eba("read %d bytes from offset %d of LEB %d:%d (unmapped)",
> > 			len, offset, vol_id, lnum);
> > 		leb_read_unlock(ubi, vol_id, lnum);
> > 		ubi_assert(vol->vol_type != UBI_STATIC_VOLUME);
> > 		memset(buf, 0xFF, len);
> > 		return 0;
> > 	}
> 
> Have you created 'kernel_next' and/or 'userland_next' as static volume
> (-t=static)? The comment above states that in static volumes you cannot
> read unmapped logical eraseblocks. When wou do not completely fill
> 'kernel_next' with data then you can only read up to the point to which
> it is filled, the remaining LEBs are unmapped and thus unreadable.
> Note that when you hit the unmapped LEBs then you have already read all
> data; the errors only occur on the free space. This is the reason you
> can still boot the new system.
> 

yes, this is the right explanation for what happens on my system.
My userland creates static '*_next' volumes and their size is rounded up
to the next Mb so at the end it will almost always remain some empty/unmapped
LEBs.

The current barebox version just bark a bit louder about it and the 'cp' command
returns with an error making my whole update process fail.

If I had an 'ubirename' command all my problems would be solved.

> 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
> 

giorgio


Giorgio, iw3gtf@arcor.de

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

^ permalink raw reply

* Re: Re: errors copying UBI volumes
From: Sascha Hauer @ 2016-09-15 11:44 UTC (permalink / raw)
  To: iw3gtf; +Cc: barebox
In-Reply-To: <247915608.359799.1473937994666.JavaMail.ngmail@webmail18.arcor-online.net>

On Thu, Sep 15, 2016 at 01:13:14PM +0200, iw3gtf@arcor.de wrote:
> Hi Sascha,
> 
> thanks for the answer,
> 
> > Hi Giorgio,
> > 
> > On Wed, Sep 14, 2016 at 05:52:32PM +0200, iw3gtf@arcor.de wrote:
> > > Hi,
> > > 
> > > I'm working on an embedded board with an iMX25 arm CPU and a nand flash.
> > > 
> > > The board runs a linux kernel/userland.
> > > 
> > > When the user updates the firmware, the running userland/kernel creates
> > some
> > > new ubi volumes on the nand, let's say 'kernel_next' and 'userland_next'.
> > > On the next system reboot barebox looks if it finds, lets say, the
> > 'kernel_next' volume
> > > and, in this case, it removes the old one ('kernel'), creates a new, empty
> > one ('kernel'),
> > > copies 'kernel_next' to the just created 'kernel' and finally removes the
> > 'kernel_next'
> > > to complete the update.
> > 
> > While this should work, why so complicated? Since this commit:
> > 
> > | commit 892abde56c1c5a62d49d8b70c73e5d388e74345d
> > | Author: Richard Weinberger <richard@nod.at>
> > | Date:   Mon Nov 24 22:30:10 2014 +0100
> > |
> > |    UBI: rename_volumes: Use UBI_METAONLY
> > |    
> > |    By using UBI_METAONLY in rename_volumes() it is now possible to rename
> > |    an UBI volume atomically while it is open for writing.
> > |    This is useful for firmware upgrades.
> > 
> > It should be possible to just remove 'kernel' and rename 'kernel_next' to
> > 'kernel'
> > without bootloader intervention.
> 
> This is a very good news for me, I already wanted to ask for a UBI rename feature.
> Could you please elaborate a bit on this point: I looked for a shell command like the
> 'ubirename', present in the 'mtd-utils' package, but could not find it. Maybe we just
> need a new command implemented in '<barebox_root>/commands/ubi.c'.

You can add a ubirename command, patches welcome. Anyway, I suggested to
rename it under Linux since you write your new Kernel/rootfs under Linux
aswell.

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

* Aw: Re: Re: errors copying UBI volumes
From: iw3gtf @ 2016-09-15 11:57 UTC (permalink / raw)
  To: s.hauer; +Cc: barebox
In-Reply-To: <20160915114401.z5tdaxcb6eesv3qn@pengutronix.de>

Hi,

> On Thu, Sep 15, 2016 at 01:13:14PM +0200, iw3gtf@arcor.de wrote:
> > Hi Sascha,
> > 
> > thanks for the answer,
> > 
> > > Hi Giorgio,
> > > 
> > > On Wed, Sep 14, 2016 at 05:52:32PM +0200, iw3gtf@arcor.de wrote:
> > > > Hi,
> > > > 
> > > > I'm working on an embedded board with an iMX25 arm CPU and a nand
> flash.
> > > > 
> > > > The board runs a linux kernel/userland.
> > > > 
> > > > When the user updates the firmware, the running userland/kernel
> creates
> > > some
> > > > new ubi volumes on the nand, let's say 'kernel_next' and
> 'userland_next'.
> > > > On the next system reboot barebox looks if it finds, lets say, the
> > > 'kernel_next' volume
> > > > and, in this case, it removes the old one ('kernel'), creates a new,
> empty
> > > one ('kernel'),
> > > > copies 'kernel_next' to the just created 'kernel' and finally removes
> the
> > > 'kernel_next'
> > > > to complete the update.
> > > 
> > > While this should work, why so complicated? Since this commit:
> > > 
> > > | commit 892abde56c1c5a62d49d8b70c73e5d388e74345d
> > > | Author: Richard Weinberger <richard@nod.at>
> > > | Date:   Mon Nov 24 22:30:10 2014 +0100
> > > |
> > > |    UBI: rename_volumes: Use UBI_METAONLY
> > > |    
> > > |    By using UBI_METAONLY in rename_volumes() it is now possible to
> rename
> > > |    an UBI volume atomically while it is open for writing.
> > > |    This is useful for firmware upgrades.
> > > 
> > > It should be possible to just remove 'kernel' and rename 'kernel_next'
> to
> > > 'kernel'
> > > without bootloader intervention.
> > 
> > This is a very good news for me, I already wanted to ask for a UBI rename
> feature.
> > Could you please elaborate a bit on this point: I looked for a shell
> command like the
> > 'ubirename', present in the 'mtd-utils' package, but could not find it.
> Maybe we just
> > need a new command implemented in '<barebox_root>/commands/ubi.c'.
> 
> You can add a ubirename command, patches welcome. Anyway, I suggested to
> rename it under Linux since you write your new Kernel/rootfs under Linux
> aswell.
> 

OK, I think I'll try to write a new command in commands/ubi.c and if it
results in something usable I'll send a patch to be reviewed.

giorgio


Giorgio, iw3gtf@arcor.de

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

^ permalink raw reply

* [PATCH v2 1/3] state: copy backend of_path string
From: Michael Olbrich @ 2016-09-16  6:43 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich

Caching pointers to device tree nodes or names is not save. The barebox
internal device tree may be changed by loading a new device tree or through
fixup handlers. As a result, the string may be deleted.
Use local copies of the full path instead.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
Changes since v1:
- First patch split into two patches

 common/state/backend.c | 3 ++-
 common/state/state.h   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/common/state/backend.c b/common/state/backend.c
index 2f2e6dfd32d1..5235bb0283dd 100644
--- a/common/state/backend.c
+++ b/common/state/backend.c
@@ -164,7 +164,7 @@ int state_backend_init(struct state_backend *backend, struct device_d *dev,
 	if (ret)
 		goto out_free_format;
 
-	backend->of_path = of_path;
+	backend->of_path = xstrdup(of_path);
 
 	return 0;
 
@@ -185,4 +185,5 @@ void state_backend_free(struct state_backend *backend)
 	state_storage_free(&backend->storage);
 	if (backend->format)
 		state_format_free(backend->format);
+	free(backend->of_path);
 }
diff --git a/common/state/state.h b/common/state/state.h
index 32146ca1bbc7..f930d06195b2 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -87,7 +87,7 @@ struct state_backend_storage {
 struct state_backend {
 	struct state_backend_format *format;
 	struct state_backend_storage storage;
-	const char *of_path;
+	char *of_path;
 };
 
 struct state {
-- 
2.8.1


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

^ permalink raw reply related

* [PATCH v2 3/3] state: fix finding the correct parent node
From: Michael Olbrich @ 2016-09-16  6:43 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich
In-Reply-To: <1474008220-7601-1-git-send-email-m.olbrich@pengutronix.de>

Looking for the parent node during fixup is broken. The path of the parent
node is not correctly terminated ('0' vs '\0'). Also, the new state node
should be added to the supplied device tree not the barebox device tree
used by of_find_node_by_path().

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
 common/state/state.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index 0c329cd67548..075618e5bb8f 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -307,8 +307,8 @@ static int of_state_fixup(struct device_node *root, void *ctx)
 		c = strrchr(of_path, '/');
 		if (!c)
 			return -ENODEV;
-		*c = '0';
-		parent = of_find_node_by_path(of_path);
+		*c = '\0';
+		parent = of_find_node_by_path_from(root, of_path);
 		if (!parent)
 			parent = root;
 
-- 
2.8.1


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

^ permalink raw reply related

* [PATCH v2 2/3] state: don't keep pointers to device tree nodes
From: Michael Olbrich @ 2016-09-16  6:43 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich
In-Reply-To: <1474008220-7601-1-git-send-email-m.olbrich@pengutronix.de>

Caching pointers to device tree nodes or is not save. The barebox internal
device tree may be changed by loading a new device tree or through fixup
handlers. As a result, the node may be deleted and replaced with a new one.
Keep a copy of the full path instead and resolve the node as needed.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
Changes since v1:
- First patch split into two patches

 common/state/state.c | 19 ++++++++++++-------
 common/state/state.h |  2 +-
 2 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/common/state/state.c b/common/state/state.c
index 9b1d4edef132..0c329cd67548 100644
--- a/common/state/state.c
+++ b/common/state/state.c
@@ -202,15 +202,19 @@ struct device_node *state_to_node(struct state *state,
 				  enum state_convert conv)
 {
 	struct device_node *child;
-	struct device_node *root;
+	struct device_node *root, *state_root;
 	int ret;
 
-	root = of_new_node(parent, state->root->name);
+	state_root = of_find_node_by_path(state->of_path);
+	if (!state_root)
+		return ERR_PTR(-ENODEV);
+
+	root = of_new_node(parent, state_root->name);
 	ret = of_property_write_u32(root, "magic", state->magic);
 	if (ret)
 		goto out;
 
-	for_each_child_of_node(state->root, child) {
+	for_each_child_of_node(state_root, child) {
 		ret = state_convert_node_variable(state, child, root, "", conv);
 		if (ret)
 			goto out;
@@ -234,7 +238,7 @@ int state_from_node(struct state *state, struct device_node *node, bool create)
 
 	if (create) {
 		conv = STATE_CONVERT_FROM_NODE_CREATE;
-		state->root = node;
+		state->of_path = xstrdup(node->full_name);
 		state->magic = magic;
 	} else {
 		conv = STATE_CONVERT_FROM_NODE;
@@ -291,7 +295,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
 	int ret;
 	phandle phandle;
 
-	node = of_find_node_by_path_from(root, state->root->full_name);
+	node = of_find_node_by_path_from(root, state->of_path);
 	if (node) {
 		/* replace existing node - it will be deleted later */
 		parent = node->parent;
@@ -299,7 +303,7 @@ static int of_state_fixup(struct device_node *root, void *ctx)
 		char *of_path, *c;
 
 		/* look for parent, remove last '/' from path */
-		of_path = xstrdup(state->root->full_name);
+		of_path = xstrdup(state->of_path);
 		c = strrchr(of_path, '/');
 		if (!c)
 			return -ENODEV;
@@ -406,6 +410,7 @@ void state_release(struct state *state)
 	list_del(&state->list);
 	unregister_device(&state->dev);
 	state_backend_free(&state->backend);
+	free(state->of_path);
 	free(state);
 }
 
@@ -545,7 +550,7 @@ struct state *state_by_node(const struct device_node *node)
 	struct state *state;
 
 	list_for_each_entry(state, &state_list, list) {
-		if (state->root == node)
+		if (!strcmp(state->of_path, node->full_name))
 			return state;
 	}
 
diff --git a/common/state/state.h b/common/state/state.h
index f930d06195b2..7b3e49512e37 100644
--- a/common/state/state.h
+++ b/common/state/state.h
@@ -94,7 +94,7 @@ struct state {
 	struct list_head list; /* Entry to enqueue on list of states */
 
 	struct device_d dev;
-	struct device_node *root;
+	char *of_path;
 	const char *name;
 	uint32_t magic;
 
-- 
2.8.1


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

^ permalink raw reply related

* Re: [PATCH 0/4] Some updates for arm/mvebu
From: Sascha Hauer @ 2016-09-16  7:35 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: Thomas Petazzoni, barebox, Ezequiel Garcia
In-Reply-To: <1473935897-9252-1-git-send-email-u.kleine-koenig@pengutronix.de>

On Thu, Sep 15, 2016 at 12:38:13PM +0200, Uwe Kleine-König wrote:
> Hello,
> 
> these are the first few patches I did while creating a port for a Netgear
> RN2120.
> 
> Best regards
> Uwe
> 
> Uwe Kleine-König (4):
>   ARM: mvebu_defconfig: oldconfig
>   ARM: mvebu_defconfig: enable all machines, AEABI, nand and net driver
>   ARM: mvebu: select HAVE_DEFAULT_ENVIRONMENT_NEW
>   net: mvneta: clean txdesc before usage
> 
>  arch/arm/Kconfig                 |  1 +
>  arch/arm/configs/mvebu_defconfig | 18 ++++++++++++------
>  drivers/net/mvneta.c             |  1 +
>  3 files changed, 14 insertions(+), 6 deletions(-)

Applied, thanks

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] commands: exit on invalid option
From: Sascha Hauer @ 2016-09-16  7:37 UTC (permalink / raw)
  To: Enrico Jorns; +Cc: barebox
In-Reply-To: <1473675656-23309-1-git-send-email-ejo@pengutronix.de>

On Mon, Sep 12, 2016 at 12:20:56PM +0200, Enrico Jorns wrote:
> Barebox commands should not perform any action and return 0 if an
> invalid parameter was given. This might cause undetected unintended
> behvaior when calling commands with wrong options, either manually or
> from a script.
> 
> Signed-off-by: Enrico Jorns <ejo@pengutronix.de>

Applied, thanks

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] ARM: imx6: split out IPU QoS setup
From: Sascha Hauer @ 2016-09-16  7:47 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox
In-Reply-To: <1473937823-30706-1-git-send-email-l.stach@pengutronix.de>

On Thu, Sep 15, 2016 at 01:10:21PM +0200, Lucas Stach wrote:
> Split into separate function and only call it after the chip type
> and revision is known.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  arch/arm/mach-imx/imx6.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
> index ba8fb8964ac8..07d3f57d8dcc 100644
> --- a/arch/arm/mach-imx/imx6.c
> +++ b/arch/arm/mach-imx/imx6.c
> @@ -31,10 +31,8 @@ void imx6_init_lowlevel(void)
>  {
>  	void __iomem *aips1 = (void *)MX6_AIPS1_ON_BASE_ADDR;
>  	void __iomem *aips2 = (void *)MX6_AIPS2_ON_BASE_ADDR;
> -	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
>  	bool is_imx6q = __imx6_cpu_type() == IMX6_CPUTYPE_IMX6Q;
>  	bool is_imx6d = __imx6_cpu_type() == IMX6_CPUTYPE_IMX6D;
> -	uint32_t val;
>  
>  	/*
>  	 * Set all MPROTx to be non-bufferable, trusted for R/W,
> @@ -94,6 +92,13 @@ void imx6_init_lowlevel(void)
>  		       MX6_ANATOP_BASE_ADDR + HW_ANADIG_PFD_528_CLR);
>  	}
>  
> +}
> +
> +void imx6_setup_ipu_qos(void)
> +{
> +	void __iomem *iomux = (void *)MX6_IOMUXC_BASE_ADDR;
> +	uint32_t val;
> +
>  	val = readl(iomux + IOMUXC_GPR4);
>  	val |= IMX6Q_GPR4_VPU_WR_CACHE_SEL | IMX6Q_GPR4_VPU_RD_CACHE_SEL |
>  		IMX6Q_GPR4_VPU_P_WR_CACHE_VAL | IMX6Q_GPR4_VPU_P_RD_CACHE_VAL_MASK |
> @@ -186,6 +191,8 @@ int imx6_init(void)
>  
>  	imx_set_silicon_revision(cputypestr, mx6_silicon_revision);
>  
> +	imx6_setup_ipu_qos();
> +
>  	return 0;
>  }
>  
> -- 
> 2.8.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

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

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

^ permalink raw reply

* Re: [PATCH v2 1/3] state: copy backend of_path string
From: Sascha Hauer @ 2016-09-16  7:47 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox
In-Reply-To: <1474008220-7601-1-git-send-email-m.olbrich@pengutronix.de>

On Fri, Sep 16, 2016 at 08:43:38AM +0200, Michael Olbrich wrote:
> Caching pointers to device tree nodes or names is not save. The barebox
> internal device tree may be changed by loading a new device tree or through
> fixup handlers. As a result, the string may be deleted.
> Use local copies of the full path instead.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> Changes since v1:
> - First patch split into two patches

Applied, thanks

Sascha

> 
>  common/state/backend.c | 3 ++-
>  common/state/state.h   | 2 +-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/common/state/backend.c b/common/state/backend.c
> index 2f2e6dfd32d1..5235bb0283dd 100644
> --- a/common/state/backend.c
> +++ b/common/state/backend.c
> @@ -164,7 +164,7 @@ int state_backend_init(struct state_backend *backend, struct device_d *dev,
>  	if (ret)
>  		goto out_free_format;
>  
> -	backend->of_path = of_path;
> +	backend->of_path = xstrdup(of_path);
>  
>  	return 0;
>  
> @@ -185,4 +185,5 @@ void state_backend_free(struct state_backend *backend)
>  	state_storage_free(&backend->storage);
>  	if (backend->format)
>  		state_format_free(backend->format);
> +	free(backend->of_path);
>  }
> diff --git a/common/state/state.h b/common/state/state.h
> index 32146ca1bbc7..f930d06195b2 100644
> --- a/common/state/state.h
> +++ b/common/state/state.h
> @@ -87,7 +87,7 @@ struct state_backend_storage {
>  struct state_backend {
>  	struct state_backend_format *format;
>  	struct state_backend_storage storage;
> -	const char *of_path;
> +	char *of_path;
>  };
>  
>  struct state {
> -- 
> 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] mtd: make sure address-cells/size-cells are set when adding partition nodes
From: Sascha Hauer @ 2016-09-16  8:03 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox
In-Reply-To: <1473919406-19038-1-git-send-email-m.olbrich@pengutronix.de>

On Thu, Sep 15, 2016 at 08:03:26AM +0200, Michael Olbrich wrote:
> address-cells/size-cells can either be set to 1 or 2 for 32 or 63 bit
> addresses respectively. Barebox currently writes 32 bit addresses.
> This makes sure that address-cells/size-cells are both set and have the
> correct value.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
> ---
> 
> Hi,
> 
> this is just a minor fix. What is really needed it support for 64 bit
> addressing.

Looking at the code this is already implemented. It already creates the
reg property using of_write_number() and honouring of_n_addr_cells() /
of_n_size_cells(). This of course only works when the target device tree
already has the #address-cells and #size-cells properties with the
correct values. So instead of just setting them to hardcoded '1' you
should set them to the desired value, the loop below should do the rest
correctly.

> Also, the bindings documentation says that all partitions
> should be in a 'partitions' sub node. The main question here is probably
> which kernel version introduced these features and what should be supported
> by barebox.

The partitions subnode was introduced with 4.4, so we better do not rely
on the kernel being able to handle it.

What we can and probably should do is to look into the target device tree
if it already has a partitions subnode with compatible = "fixed-partitions"
and if does, use it.

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/3] state: copy backend of_path string
From: Antony Pavlov @ 2016-09-16  8:12 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox
In-Reply-To: <1474008220-7601-1-git-send-email-m.olbrich@pengutronix.de>

On Fri, 16 Sep 2016 08:43:38 +0200
Michael Olbrich <m.olbrich@pengutronix.de> wrote:

> Caching pointers to device tree nodes or names is not save. The barebox
                                                        ^^^^ safe?
> internal device tree may be changed by loading a new device tree or through
> fixup handlers. As a result, the string may be deleted.
> Use local copies of the full path instead.
> 
> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>

-- 
Best regards,
  Antony Pavlov

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

^ permalink raw reply

* [PATCH] strings: new command
From: Sam Ravnborg @ 2016-09-17 17:07 UTC (permalink / raw)
  To: Barebox List

From 724382cf9aa173b6ced9fd213bbb369d9a5e3739 Mon Sep 17 00:00:00 2001
From: Sam Ravnborg <sam@ravnborg.org>
Date: Sat, 17 Sep 2016 19:01:15 +0200
Subject: [PATCH 1/1] strings: new command

Implement a simple version of strings that will print
printable strings from one or more files.
Strings shall be at least 4 chars before thay are printed

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---

I was in a situation where I missed "strings".
So here it is....
I started out with cat.c - but ended up re-writing everything.

It has seen light testing on my x86 box.
Ran it through checkpatch for good measure - fixed a few things.

The location in Makefile seems random, so I just put it next to cat.

Before applying please consider if strings is really
general useful in barebox.


	Sam


 commands/Kconfig   |  10 +++++
 commands/Makefile  |   1 +
 commands/strings.c | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 132 insertions(+)
 create mode 100644 commands/strings.c

diff --git a/commands/Kconfig b/commands/Kconfig
index 30bf429..2f9b5d8 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -993,6 +993,16 @@ config CMD_SHA512SUM
 
 	  Calculate a SHA512 digest over a FILE or a memory area.
 
+config CMD_STRINGS
+	tristate
+	default y
+	prompt "strings"
+	help
+	  Display printable strings in file(s) to stdout
+
+	  Usage: strings FILE...
+
+
 config CMD_UNCOMPRESS
 	bool
 	select UNCOMPRESS
diff --git a/commands/Makefile b/commands/Makefile
index 601f15f..7b11d73 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -32,6 +32,7 @@ obj-$(CONFIG_CMD_RMDIR)		+= rmdir.o
 obj-$(CONFIG_CMD_CP)		+= cp.o
 obj-$(CONFIG_CMD_RM)		+= rm.o
 obj-$(CONFIG_CMD_CAT)		+= cat.o
+obj-$(CONFIG_CMD_STRINGS)	+= strings.o
 obj-$(CONFIG_CMD_MOUNT)		+= mount.o
 obj-$(CONFIG_CMD_UMOUNT)	+= umount.o
 obj-$(CONFIG_CMD_REGINFO)	+= reginfo.o
diff --git a/commands/strings.c b/commands/strings.c
new file mode 100644
index 0000000..e1e7287
--- /dev/null
+++ b/commands/strings.c
@@ -0,0 +1,121 @@
+/*
+ * strings.c - find strings in a file
+ *
+ * Copyright (c) 2016 Sam Ravnborg <sam@ravnborg.org>
+ *
+ * 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 <command.h>
+#include <fs.h>
+
+#include <linux/ctype.h>
+
+#define BUFSIZE    (1024)
+#define STRINGBUF  (1024 - 3)
+#define MIN_STRING 4
+
+/**
+ * @param[in] argc Argument count from command line
+ * @param[in] argv List of input arguments
+ */
+static int do_strings(int argc, char *argv[])
+{
+	char *string;
+	char *buf;
+	int args;
+	int err;
+	int ret;
+	int fd;
+	int i;
+	int s;
+
+	if (argc < 2) {
+		printf("strings: no file specified\n");
+		return 1;
+	}
+
+	buf = xmalloc(BUFSIZE);
+	/* Reserve room for newline + null */
+	string = xmalloc(STRINGBUF + 3);
+
+	args = 1;
+	err = 0;
+	s = 0;
+
+	while (args < argc) {
+		fd = open(argv[args], O_RDONLY);
+		if (fd < 0) {
+			err = 1;
+			printf("could not open %s: %s\n",
+				argv[args], errno_str());
+			goto out;
+		}
+
+		while ((ret = read(fd, buf, BUFSIZE)) > 0) {
+			for (i = 0; i < ret; i++) {
+				int nonprint = 0;
+
+				if (isascii(buf[i]) && isprint(buf[i]))
+					string[s++] = buf[i];
+				else
+					nonprint = 1;
+
+				if (nonprint) {
+					if (s >= MIN_STRING || s >= STRINGBUF) {
+						string[s++] = '\n';
+						string[s++] = '\0';
+						puts(string);
+					}
+
+					s = 0;
+				}
+			}
+
+			if (s >= MIN_STRING) {
+				string[s++] = '\n';
+				string[s++] = '\0';
+				puts(string);
+			}
+			s = 0;
+
+			if (ctrlc()) {
+				err = 1;
+				close(fd);
+				goto out;
+			}
+		}
+
+		close(fd);
+		args++;
+	}
+
+out:
+	free(string);
+	free(buf);
+
+	return err;
+}
+
+BAREBOX_CMD_HELP_START(strings)
+BAREBOX_CMD_HELP_TEXT("Display strings from a file")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(strings)
+	.cmd = do_strings,
+	BAREBOX_CMD_DESC("display strings")
+	BAREBOX_CMD_OPTS("FILE...")
+	BAREBOX_CMD_GROUP(CMD_GRP_FILE)
+	BAREBOX_CMD_HELP(cmd_strings_help)
+BAREBOX_CMD_END
-- 
1.8.3.1


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

^ permalink raw reply related

* Re: [PATCH] strings: new command
From: Sam Ravnborg @ 2016-09-19  8:38 UTC (permalink / raw)
  To: Barebox List
In-Reply-To: <20160917170731.GA30325@ravnborg.org>

> I was in a situation where I missed "strings".
> So here it is....
> I started out with cat.c - but ended up re-writing everything.
> 
> It has seen light testing on my x86 box.
> Ran it through checkpatch for good measure - fixed a few things.
> 
> The location in Makefile seems random, so I just put it next to cat.
> 
> Before applying please consider if strings is really
> general useful in barebox.

In the end I had no use for strings in barebox, so another reason
to consider if it is really needed.

	Sam

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

^ permalink raw reply

* Re: [PATCH] mtd: make sure address-cells/size-cells are set when adding partition nodes
From: Uwe Kleine-König @ 2016-09-19 10:55 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: barebox
In-Reply-To: <1473919406-19038-1-git-send-email-m.olbrich@pengutronix.de>

On Thu, Sep 15, 2016 at 08:03:26AM +0200, Michael Olbrich wrote:
> address-cells/size-cells can either be set to 1 or 2 for 32 or 63 bit
s/63/64/ ?

Uwe
> addresses respectively. Barebox currently writes 32 bit addresses.

-- 
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

* [PATCH 0/2] Auto-append ip= option for NFS boot with appendrot
From: Enrico Jorns @ 2016-09-19 16:03 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich, Gavin Schenk, Enrico Jorns, u.kleine-koenig

This patches allow booting from nfs without the need to additionally provide an
extra ip= option, such as ip=dhcp to the kernel commandline.

This is solved by adding a bootargs property to the network device of the
connection used for the NFS boot and appending this to the nfs bootarg string.

Note that these patches are based on the 'vsprintf: Add support for printing
ipv4 addresses with %pI4' series posted by Sascha.

Enrico Jorns (2):
  net: add linux.bootarg parameter from ifup call
  fs: nfs: pick up network interface bootargs parameter

 fs/nfs.c      |  8 ++++++++
 include/net.h |  1 +
 net/eth.c     |  1 +
 net/ifup.c    | 10 ++++++++++
 4 files changed, 20 insertions(+)

-- 
2.8.1


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

^ permalink raw reply

* [PATCH 1/2] net: add linux.bootarg parameter from ifup call
From: Enrico Jorns @ 2016-09-19 16:03 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich, Gavin Schenk, Enrico Jorns, u.kleine-koenig
In-Reply-To: <1474301029-22877-1-git-send-email-ejo@pengutronix.de>

This sets a `ip=dhcp` or
`ip=<clientip>:<serverip>:<gatewayip>:<netmaskip>::<iface>:` bootarg for
the network device upon execution of 'ifup'. This is the only point
where we can distinguish between a static ip and a dhcp-based network
setup and thus set a valid bootarg options as it will be required for
nfs boot, for example.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
---
 include/net.h |  1 +
 net/eth.c     |  1 +
 net/ifup.c    | 10 ++++++++++
 3 files changed, 12 insertions(+)

diff --git a/include/net.h b/include/net.h
index fd1c412..632b6d5 100644
--- a/include/net.h
+++ b/include/net.h
@@ -62,6 +62,7 @@ struct eth_device {
 	IPaddr_t netmask;
 	IPaddr_t gateway;
 	char ethaddr[6];
+	char *bootarg;
 };
 
 #define dev_to_edev(d) container_of(d, struct eth_device, dev)
diff --git a/net/eth.c b/net/eth.c
index 6f8e78d..e056826 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -384,6 +384,7 @@ int eth_register(struct eth_device *edev)
 	dev_add_param_ip(dev, "netmask", NULL, NULL, &edev->netmask, edev);
 	dev_add_param_mac(dev, "ethaddr", eth_param_set_ethaddr, NULL,
 			edev->ethaddr, edev);
+	dev_add_param_string(dev, "linux.bootargs", NULL, NULL, &edev->bootarg, NULL);
 
 	if (edev->init)
 		edev->init(edev);
diff --git a/net/ifup.c b/net/ifup.c
index 30ac3f5..618eb8a 100644
--- a/net/ifup.c
+++ b/net/ifup.c
@@ -106,12 +106,22 @@ int ifup(const char *name, unsigned flags)
 		ret = eth_set_param(dev, "serverip");
 		if (ret)
 			goto out;
+		dev_set_param(dev, "linux.bootargs", "ip=dhcp");
 	} else if (!strcmp(ip, "static")) {
+		char *bootarg;
 		for (i = 0; i < ARRAY_SIZE(vars); i++) {
 			ret = eth_set_param(dev, vars[i]);
 			if (ret)
 				goto out;
 		}
+		bootarg = basprintf("ip=%pI4:%pI4:%pI4:%pI4::%s:",
+				&edev->ipaddr,
+				&edev->serverip,
+				&edev->gateway,
+				&edev->netmask,
+				edev->devname);
+		dev_set_param(dev, "linux.bootargs", bootarg);
+		free(bootarg);
 	} else {
 		pr_err("unknown ip type: %s\n", ip);
 		ret = -EINVAL;
-- 
2.8.1


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

^ permalink raw reply related

* [PATCH 2/2] fs: nfs: pick up network interface bootargs parameter
From: Enrico Jorns @ 2016-09-19 16:03 UTC (permalink / raw)
  To: barebox; +Cc: Michael Olbrich, Gavin Schenk, Enrico Jorns, u.kleine-koenig
In-Reply-To: <1474301029-22877-1-git-send-email-ejo@pengutronix.de>

This adds the linux.bootarg device parameter from the network device of
the current nfs connection and adds it to the nfs bootargs line.

This allows booting from nfs without manually setting a ip=dhcp or
ip=<ipaddr> option.

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

diff --git a/fs/nfs.c b/fs/nfs.c
index a0a9dfc..97f01cf 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -1314,6 +1314,7 @@ static char *rootnfsopts;
 static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev)
 {
 	char *str, *tmp;
+	const char *bootargs;
 
 	str = basprintf("root=/dev/nfs nfsroot=%pI4:%s%s%s", &npriv->server, npriv->path,
 			  rootnfsopts[0] ? "," : "", rootnfsopts);
@@ -1331,6 +1332,13 @@ static void nfs_set_rootarg(struct nfs_priv *npriv, struct fs_device_d *fsdev)
 		str = tmp;
 	}
 
+	bootargs = dev_get_param(&npriv->con->edev->dev, "linux.bootargs");
+	if (bootargs) {
+		tmp = basprintf("%s %s", str, bootargs);
+		free(str);
+		str = tmp;
+	}
+
 	fsdev_set_linux_rootarg(fsdev, str);
 
 	free(str);
-- 
2.8.1


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

^ permalink raw reply related

* Re: [PATCH 2/2] fs: nfs: pick up network interface bootargs parameter
From: Uwe Kleine-König @ 2016-09-19 16:19 UTC (permalink / raw)
  To: Enrico Jorns; +Cc: barebox, Michael Olbrich, Gavin Schenk
In-Reply-To: <1474301029-22877-3-git-send-email-ejo@pengutronix.de>

On Mon, Sep 19, 2016 at 06:03:49PM +0200, Enrico Jorns wrote:
> This adds the linux.bootarg device parameter from the network device of
s/bootarg/bootargs/

> the current nfs connection and adds it to the nfs bootargs line.

s/and adds it//

> This allows booting from nfs without manually setting a ip=dhcp or
> ip=<ipaddr> option.

Otherwise: \o/
(i.e.: Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> for
both patches)

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

* [PATCH 3/3] ARM: i.MX6: gate PCIe when unused
From: Jan Luebbe @ 2016-09-20  8:17 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1474359462-32142-1-git-send-email-jlu@pengutronix.de>

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 arch/arm/mach-imx/clk-imx6.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/clk-imx6.c b/arch/arm/mach-imx/clk-imx6.c
index 26dfd1a7e16b..8ac43bebb075 100644
--- a/arch/arm/mach-imx/clk-imx6.c
+++ b/arch/arm/mach-imx/clk-imx6.c
@@ -498,7 +498,10 @@ static int imx6_ccm_probe(struct device_d *dev)
 		writel(0x3fffffff, ccm_base + CCGR3); /* gate OpenVG */
 	else
 		writel(0x3fff0000, ccm_base + CCGR3); /* gate OpenVG, LDB, IPU1, IPU2 */
-	writel(0xffffffff, ccm_base + CCGR4);
+	if (IS_ENABLED(CONFIG_PCI_IMX6))
+		writel(0xffffffff, ccm_base + CCGR4);
+	else
+		writel(0xfffffffc, ccm_base + CCGR4); /* gate PCIe */
 	writel(0xffffffff, ccm_base + CCGR5);
 	writel(0xffff3fff, ccm_base + CCGR6); /* gate VPU */
 	writel(0xffffffff, ccm_base + CCGR7);
-- 
2.1.4


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

^ permalink raw reply related

* [PATCH 1/3] ARM: i.MX6: remove duplicate clock initialization
From: Jan Luebbe @ 2016-09-20  8:17 UTC (permalink / raw)
  To: barebox

These registers are already set by imx6_ccm_probe (in clk-imx6.c) during
core_initcall, while imx6_init_lowlevel is only called during
postcore_initcall via imx_init in imx.c.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 arch/arm/mach-imx/imx6.c | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/arch/arm/mach-imx/imx6.c b/arch/arm/mach-imx/imx6.c
index ba8fb8964ac8..dfd9a70200ec 100644
--- a/arch/arm/mach-imx/imx6.c
+++ b/arch/arm/mach-imx/imx6.c
@@ -56,15 +56,6 @@ void imx6_init_lowlevel(void)
 	writel(0, aips2 + 0x4c);
 	writel(0, aips2 + 0x50);
 
-	/* enable all clocks */
-	writel(0xffffffff, 0x020c4068);
-	writel(0xffffffff, 0x020c406c);
-	writel(0xffffffff, 0x020c4070);
-	writel(0xffffffff, 0x020c4074);
-	writel(0xffffffff, 0x020c4078);
-	writel(0xffffffff, 0x020c407c);
-	writel(0xffffffff, 0x020c4080);
-
 	/* Due to hardware limitation, on MX6Q we need to gate/ungate all PFDs
 	 * to make sure PFD is working right, otherwise, PFDs may
 	 * not output clock after reset, MX6DL and MX6SL have added 396M pfd
-- 
2.1.4


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

^ permalink raw reply related

* [PATCH 2/3] ARM: i.MX6: fix clock gating
From: Jan Luebbe @ 2016-09-20  8:17 UTC (permalink / raw)
  To: barebox
In-Reply-To: <1474359462-32142-1-git-send-email-jlu@pengutronix.de>

Since ce6755ca1c41b8dd3b40cf3c9d6f3a1237a92720, both IPU and OpenVG are
enabled if CONFIG_DRIVER_VIDEO_IMX_IPUV3 is true, but in the other case,
only OpenVG was disabled.

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 arch/arm/mach-imx/clk-imx6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-imx/clk-imx6.c b/arch/arm/mach-imx/clk-imx6.c
index a634580c86d5..26dfd1a7e16b 100644
--- a/arch/arm/mach-imx/clk-imx6.c
+++ b/arch/arm/mach-imx/clk-imx6.c
@@ -495,9 +495,9 @@ static int imx6_ccm_probe(struct device_d *dev)
 	writel(0xf0ffffff, ccm_base + CCGR1); /* gate GPU3D, GPU2D */
 	writel(0xffffffff, ccm_base + CCGR2);
 	if (IS_ENABLED(CONFIG_DRIVER_VIDEO_IMX_IPUV3))
-		writel(0xffffffff, ccm_base + CCGR3); /* gate OpenVG */
+		writel(0x3fffffff, ccm_base + CCGR3); /* gate OpenVG */
 	else
-		writel(0x3fffffff, ccm_base + CCGR3); /* gate OpenVG, LDB, IPU1, IPU2 */
+		writel(0x3fff0000, ccm_base + CCGR3); /* gate OpenVG, LDB, IPU1, IPU2 */
 	writel(0xffffffff, ccm_base + CCGR4);
 	writel(0xffffffff, ccm_base + CCGR5);
 	writel(0xffff3fff, ccm_base + CCGR6); /* gate VPU */
-- 
2.1.4


_______________________________________________
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