Re: [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM

2014-12-17 Thread Sascha Hauer
On Mon, Dec 15, 2014 at 12:35:16PM +0100, Lucas Stach wrote:
  Instead of the #ifdef can we do a:
  
  if (!IS_ENABLED(CONFIG_BOOTM)) {
  fastboot_tx_print(f_fb, FAILCommand not supported);
  return;
  }
  
  in cb_boot?
  
 Actually I like they way I did it in this patch better, as it is
 explicit about why something is not available. Chasing through the code
 just to find out why cb_boot returned early with an error seems like
 obfuscation to me. Also it spreads the same error path through 2
 functions which isn't nice if we ever have to change something there.

I still like the green better, but applied.

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

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


[PATCH 3/3] arm: do section garbage collection also with modules enabled

2014-12-17 Thread Lucas Stach
A lot of the arm build (especially PBL stuff) depends on section
garbage collection to be enabled. If it is disabled a lot of targets fail
to link properly. If module support is enabled garbage collection was
disabled on the premise that we throw away too many function which may be
needed in later modules.

The proper way to keep the functions around for use in modules, which
already works, is to annotate them with EXPORT_SYMBOL.

As module support is still marked as experimental I think it's reasonable
to expect users to make sure all symbols that are used by their modules
are properly annotated.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 arch/arm/Makefile | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index cf81c9c08332..193f731e9039 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -105,11 +105,9 @@ TEXT_BASE = $(CONFIG_TEXT_BASE)
 
 CPPFLAGS += -DTEXT_BASE=$(TEXT_BASE)
 
-ifndef CONFIG_MODULES
 # Add cleanup flags
 CPPFLAGS += -fdata-sections -ffunction-sections
 LDFLAGS_barebox += -static --gc-sections
-endif
 
 ifdef CONFIG_RELOCATABLE
 LDFLAGS_barebox += -pie
-- 
2.1.3


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


[PATCH 2/3] arm: edmqmx6: build entry in lwl target

2014-12-17 Thread Lucas Stach
Only build it at the correct obj or pbl stage where
the entry is needed.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 arch/arm/boards/datamodul-edm-qmx6/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boards/datamodul-edm-qmx6/Makefile 
b/arch/arm/boards/datamodul-edm-qmx6/Makefile
index bb6d9d848d4f..01c7a259e9a5 100644
--- a/arch/arm/boards/datamodul-edm-qmx6/Makefile
+++ b/arch/arm/boards/datamodul-edm-qmx6/Makefile
@@ -1,2 +1,2 @@
-obj-y += board.o lowlevel.o
-pbl-y += lowlevel.o
+obj-y += board.o
+lwl-y += lowlevel.o
-- 
2.1.3


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


[PATCH 1/3] arm: include relevant headers in barebox-arm

2014-12-17 Thread Lucas Stach
Provide the necessary types and defines used in this header.

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
 arch/arm/include/asm/barebox-arm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/include/asm/barebox-arm.h 
b/arch/arm/include/asm/barebox-arm.h
index 66f6fe5ef6b4..641c00f81848 100644
--- a/arch/arm/include/asm/barebox-arm.h
+++ b/arch/arm/include/asm/barebox-arm.h
@@ -27,6 +27,8 @@
 
 #include sizes.h
 #include asm-generic/memory_layout.h
+#include linux/kernel.h
+#include linux/types.h
 
 /* cpu/.../cpu.c */
 intcleanup_before_linux(void);
-- 
2.1.3


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


[PATCH v2] imd: provide dummy imd_command_setenv

2014-12-17 Thread Lucas Stach
If CONFIG_CMD_IMD is not set there is no imd_command_setenv in the
barebox binary that can be linked to. Although the whole imd infrastructure
will be removed by the linker later in the build process as soon as it
figures out that nothing inside barebox is using it, we still have to
provide a dummy function to keep the build going.

Fixes:
In function `imd_command': undefined reference to `imd_command_setenv'

Signed-off-by: Lucas Stach l.st...@pengutronix.de
---
v2: move dummy to correct location
---
 common/imd.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/common/imd.c b/common/imd.c
index 2c837d6f256e..f84e34473e69 100644
--- a/common/imd.c
+++ b/common/imd.c
@@ -22,6 +22,13 @@
 #include getopt.h
 #include malloc.h
 #include fs.h
+
+#ifndef CONFIG_CMD_IMD
+int imd_command_setenv(const char *variable_name, const char *value)
+{
+   return -ENOSYS;
+}
+#endif
 #endif
 
 /*
-- 
2.1.3


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


Re: [PATCH 1/3] arm: include relevant headers in barebox-arm

2014-12-17 Thread Sascha Hauer
On Wed, Dec 17, 2014 at 11:58:19AM +0100, Lucas Stach wrote:
 Provide the necessary types and defines used in this header.
 
 Signed-off-by: Lucas Stach l.st...@pengutronix.de
 ---
  arch/arm/include/asm/barebox-arm.h | 2 ++
  1 file changed, 2 insertions(+)

Applied all, 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- |

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


Re: [PATCH] i2c: omap: fix fclk_rate for ti,omap4-i2c

2014-12-17 Thread Jan Weitzel
On Thu, Dec 11, 2014 at 08:59:48AM +0100, Sascha Hauer wrote:
 On Wed, Dec 10, 2014 at 07:49:28AM +0100, Jan Weitzel wrote:
  ti,am33xx and ti,omap4 use ti,omap4-i2c with different fclk_rate.
  By now set it according to the used cpu compatible.
  
  Signed-off-by: Jan Weitzel j.weit...@phytec.de
  ---
   drivers/i2c/busses/i2c-omap.c | 7 +++
   1 file changed, 7 insertions(+)
  
  diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
  index 094f591..d2254d4 100644
  --- a/drivers/i2c/busses/i2c-omap.c
  +++ b/drivers/i2c/busses/i2c-omap.c
  @@ -1015,6 +1015,13 @@ i2c_omap_probe(struct device_d *pdev)
  i2c_omap-reg_shift = (i2c_data-flags 
  OMAP_I2C_FLAG_BUS_SHIFT__SHIFT)  3;
   
  +   if (!i2c_data-fclk_rate) {
  +   if (of_machine_is_compatible(ti,am33xx))
  +   i2c_data-fclk_rate = am33xx_data.fclk_rate;
  +   if (of_machine_is_compatible(ti,omap4))
  +   i2c_data-fclk_rate = omap4_data.fclk_rate;
  +   }
 
 Can't we just do a:
 
   if (of_machine_is_compatible(ti,am33xx))
   i2c_omap-data = am33xx_data;
   if (of_machine_is_compatible(ti,omap4))
   i2c_omap-data = omap4_data;
 
 Instead?
Sounds good, I reworked the patch.

Jan
 
 With that we could also remove the nonworking omap4_of_data.
 
 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- |

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


[PATCH 2/3] netconsole: activate in set_active callback

2014-12-17 Thread Sascha Hauer
Activate the netconsole in the set_active callback. Add proper
checks there for port and ip address, print an error when the network
hasn't been configured and finally print when the netconsole has
been enabled successfully. This makes using of the netconsole easier.

Signed-off-by: Sascha Hauer s.ha...@pengutronix.de
---
 net/netconsole.c | 55 ++-
 1 file changed, 34 insertions(+), 21 deletions(-)

diff --git a/net/netconsole.c b/net/netconsole.c
index c817107..99b9984 100644
--- a/net/netconsole.c
+++ b/net/netconsole.c
@@ -52,24 +52,6 @@ static void nc_handler(void *ctx, char *pkt, unsigned len)
kfifo_put(priv-fifo, packet, net_eth_to_udplen(pkt));
 }
 
-static int nc_init(void)
-{
-   struct nc_priv *priv = g_priv;
-
-   if (priv-con)
-   net_unregister(priv-con);
-
-   priv-con = net_udp_new(priv-ip, priv-port, nc_handler, NULL);
-   if (IS_ERR(priv-con)) {
-   int ret = PTR_ERR(priv-con);
-   priv-con = NULL;
-   return ret;
-   }
-
-   net_udp_bind(priv-con, priv-port);
-   return 0;
-}
-
 static int nc_getc(struct console_device *cdev)
 {
struct nc_priv *priv = container_of(cdev,
@@ -123,9 +105,39 @@ static void nc_putc(struct console_device *cdev, char c)
priv-busy = 0;
 }
 
-static int nc_port_set(struct param_d *p, void *_priv)
+static int nc_set_active(struct console_device *cdev, unsigned flags)
 {
-   nc_init();
+   struct nc_priv *priv = container_of(cdev,
+   struct nc_priv, cdev);
+
+   if (priv-con) {
+   net_unregister(priv-con);
+   priv-con = NULL;
+   }
+
+   if (!flags)
+   return 0;
+
+   if (!priv-port) {
+   pr_err(port not set\n);
+   return -EINVAL;
+   }
+
+   if (!priv-ip) {
+   pr_err(ip not set\n);
+   return -EINVAL;
+   }
+
+   priv-con = net_udp_new(priv-ip, priv-port, nc_handler, NULL);
+   if (IS_ERR(priv-con)) {
+   int ret = PTR_ERR(priv-con);
+   priv-con = NULL;
+   return ret;
+   }
+
+   net_udp_bind(priv-con, priv-port);
+
+   pr_info(netconsole initialized with %s:%d\n, ip_to_string(priv-ip), 
priv-port);
 
return 0;
 }
@@ -142,6 +154,7 @@ static int netconsole_init(void)
cdev-putc = nc_putc;
cdev-getc = nc_getc;
cdev-devname = netconsole;
+   cdev-set_active = nc_set_active;
 
g_priv = priv;
 
@@ -157,7 +170,7 @@ static int netconsole_init(void)
priv-port = ;
 
dev_add_param_ip(cdev-class_dev, ip, NULL, NULL, priv-ip, NULL);
-   dev_add_param_int(cdev-class_dev, port, nc_port_set, NULL, 
priv-port, %u, NULL);
+   dev_add_param_int(cdev-class_dev, port, NULL, NULL, priv-port, 
%u, NULL);
 
pr_info(registered as %s%d\n, cdev-class_dev.name, 
cdev-class_dev.id);
 
-- 
2.1.3


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


[PATCH 3/3] netconsole: fix Documentation

2014-12-17 Thread Sascha Hauer
From: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com

since
commit 8eacfa71abcba857ab9aa1dcad49e2ba7d83406b
Refs: v2014.07.0-156-g8eacfa7
Author: Sascha Hauer s.ha...@pengutronix.de

the netconsole device have a static device name 'netconsole'

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com
---
 Documentation/user/networking.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/user/networking.rst 
b/Documentation/user/networking.rst
index 6802138..6eeb93d 100644
--- a/Documentation/user/networking.rst
+++ b/Documentation/user/networking.rst
@@ -61,15 +61,15 @@ Network console
 barebox has a UDP-based network console. If enabled in the config, you will see
 something like this during startup::
 
-  registered netconsole as cs1
+  registered netconsole as netconsole
 
 By default the network console is disabled during runtime to prevent security
 risks. It can be enabled using:
 
 .. code-block:: sh
 
-  cs1.ip=192.168.23.2
-  cs1.active=ioe
+  netconsole.ip=192.168.23.2
+  netconsole.active=ioe
 
 This will send UDP packets to 192.168.23.2 on port . On 192.168.23.2 the
 scripts/netconsole script can be used to control barebox:
-- 
2.1.3


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


[PATCH] partitions: dos: Fix support of extended partition type 0x05

2014-12-17 Thread victorien
---
 common/partitions/dos.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/partitions/dos.c b/common/partitions/dos.c
index 37addfd..8a3c5c3 100644
--- a/common/partitions/dos.c
+++ b/common/partitions/dos.c
@@ -209,7 +209,7 @@ static void dos_partition(void *buf, struct block_device 
*blk,
 * here as this is the easiest to parse and common
 * enough.
 */
-   if (pentry.dos_partition_type == 0x0f) {
+   if ((pentry.dos_partition_type == 
0x0f)||(pentry.dos_partition_type == 0x05)) {
if (!extended_partition)
extended_partition = pd-parts[n];
else
-- 
1.9.1


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


imx6: Nand flash BB erase issue/question...

2014-12-17 Thread Michael D. Burkey
I have run into an issue that I wonder if anyone else has seen.

We have our kernel stored in NAND flash and have it partition and have
the nand0.kernel and nand0.kernel.bb entries.

As I understand it, the nand0.kernel.bb entry is the correct one to
use for day to day operations as it handles bad blocks.

The issue comes when I try erasing the kernel prior to updating it on
a SOM with a known bad block inside the kernel area.

Doing an erase of nand0.kernel works fine and skips the bad block.

Doing an erase of nand0.kernel.bb however generates an error message:

nand: nand_erase_nand: attempt to erase a bad block at page
0x0bc0

It then exits with an erase: I/O error.

Specifically, it looks like an attempt to erase a .bb device calls
nand_erase_nand() (in nand_base.c) which then uses
nand_block_checkbad() to determine if the block is bad and then just
generates an error exit rather than attempting to skip the bad block.

To me, this seems wrong.

Shouldn't an attempt to erase a .bb NAND device actually HANDLE the
bad blocks by skipping them rather than simply erroring out?

Thanks,
Michael Burkey

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