mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM
@ 2014-12-09 11:05 Lucas Stach
  2014-12-09 11:05 ` [PATCH 2/5] video: imx-hdmi: search for DDC node only when EDID support is enabled Lucas Stach
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Lucas Stach @ 2014-12-09 11:05 UTC (permalink / raw)
  To: barebox

This will disable the capability to boot an uploaded image directly,
but keeps other fastboot functionality. This seems like a valid config.

Fixes:
In function `do_bootm_on_complete': undefined reference to `bootm_boot'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/usb/gadget/f_fastboot.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index 92a1a218c643..76879db1f15d 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -653,7 +653,8 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
 		pr_err("Booting failed\n");
 }
 
-static void cb_boot(struct usb_ep *ep, struct usb_request *req, const char *opt)
+static void __maybe_unused cb_boot(struct usb_ep *ep, struct usb_request *req,
+				   const char *opt)
 {
 	struct f_fastboot *f_fb = req->context;
 
@@ -857,9 +858,11 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
 	}, {
 		.cmd = "download:",
 		.cb = cb_download,
+#if defined(CONFIG_BOOTM)
 	}, {
 		.cmd = "boot",
 		.cb = cb_boot,
+#endif
 	}, {
 		.cmd = "flash:",
 		.cb = cb_flash,
-- 
2.1.3


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 2/5] video: imx-hdmi: search for DDC node only when EDID support is enabled
  2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
@ 2014-12-09 11:05 ` Lucas Stach
  2014-12-09 11:05 ` [PATCH 3/5] imd: provide dummy imd_command_setenv Lucas Stach
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2014-12-09 11:05 UTC (permalink / raw)
  To: barebox

This uses i2c functions that may not be available in every configuration
and is only needed if EDID support is enabled, which in turn already
selects I2C.

Fixes:
drivers/video/imx-ipu-v3/imx-hdmi.c:
undefined reference to `of_find_i2c_adapter_by_node'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/video/imx-ipu-v3/imx-hdmi.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/video/imx-ipu-v3/imx-hdmi.c b/drivers/video/imx-ipu-v3/imx-hdmi.c
index 4f462889a873..2da76a4b7a74 100644
--- a/drivers/video/imx-ipu-v3/imx-hdmi.c
+++ b/drivers/video/imx-ipu-v3/imx-hdmi.c
@@ -1190,16 +1190,18 @@ static int imx_hdmi_probe(struct device_d *dev)
 	if (ret)
 		return ret;
 
-	ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
-	if (ddc_node) {
-		hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
-		if (!hdmi->ddc)
-			dev_dbg(hdmi->dev, "failed to read ddc node\n");
-	} else {
-		dev_dbg(hdmi->dev, "no ddc property found\n");
-	}
+	if (IS_ENABLED(CONFIG_DRIVER_VIDEO_EDID)) {
+		ddc_node = of_parse_phandle(np, "ddc-i2c-bus", 0);
+		if (ddc_node) {
+			hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
+			if (!hdmi->ddc)
+				dev_dbg(hdmi->dev, "failed to read ddc node\n");
+		} else {
+			dev_dbg(hdmi->dev, "no ddc property found\n");
+		}
 
-	ddc_node = NULL;
+		ddc_node = NULL;
+	}
 
 	hdmi->regs = dev_request_mem_region(dev, 0);
 	if (!hdmi->regs)
-- 
2.1.3


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 3/5] imd: provide dummy imd_command_setenv
  2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
  2014-12-09 11:05 ` [PATCH 2/5] video: imx-hdmi: search for DDC node only when EDID support is enabled Lucas Stach
@ 2014-12-09 11:05 ` Lucas Stach
  2014-12-10  9:05   ` Lucas Stach
  2014-12-09 11:05 ` [PATCH 4/5] fdt: don't strip const qualifier Lucas Stach
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2014-12-09 11:05 UTC (permalink / raw)
  To: barebox

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.stach@pengutronix.de>
---
 include/image-metadata.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/image-metadata.h b/include/image-metadata.h
index 34dae5ce3454..00aae6c98449 100644
--- a/include/image-metadata.h
+++ b/include/image-metadata.h
@@ -112,6 +112,13 @@ static inline void imd_used(const void *unused)
 #define IMD_USED(_name) \
 	imd_used(&__barebox_imd_##_name)
 
+#ifndef CONFIG_CMD_IMD
+int imd_command_setenv(const char *variable_name, const char *value)
+{
+	return -ENOSYS;
+}
+#endif
+
 #endif /* __BAREBOX__ */
 
 #endif /* __INCLUDE_IMAGE_METADTA_H */
-- 
2.1.3


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 4/5] fdt: don't strip const qualifier
  2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
  2014-12-09 11:05 ` [PATCH 2/5] video: imx-hdmi: search for DDC node only when EDID support is enabled Lucas Stach
  2014-12-09 11:05 ` [PATCH 3/5] imd: provide dummy imd_command_setenv Lucas Stach
@ 2014-12-09 11:05 ` Lucas Stach
  2014-12-11  7:37   ` Sascha Hauer
  2014-12-09 11:05 ` [PATCH 5/5] Revert "ARM: i.MX: Make NAND related Kconfig options depend on MTD" Lucas Stach
  2014-12-11  7:36 ` [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Sascha Hauer
  4 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2014-12-09 11:05 UTC (permalink / raw)
  To: barebox

Fixes:
warning: assignment discards 'const' qualifier from pointer target type

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/of/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 84c38fd5a13c..d84b2037cbcc 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -64,7 +64,7 @@ struct device_node *of_unflatten_dtb(const void *infdt)
 	struct device_node *root, *node = NULL;
 	struct property *p;
 	uint32_t dt_struct;
-	struct fdt_node_header *fnh;
+	const struct fdt_node_header *fnh;
 	void *dt_strings;
 	struct fdt_header f;
 	int ret;
-- 
2.1.3


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 5/5] Revert "ARM: i.MX: Make NAND related Kconfig options depend on MTD"
  2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
                   ` (2 preceding siblings ...)
  2014-12-09 11:05 ` [PATCH 4/5] fdt: don't strip const qualifier Lucas Stach
@ 2014-12-09 11:05 ` Lucas Stach
  2014-12-11  7:36 ` [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Sascha Hauer
  4 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2014-12-09 11:05 UTC (permalink / raw)
  To: barebox

This reverts commit 4b17d73c7da2, as it is incomplete and partially
broken. ARCH_IMX_EXTERNAL_BOOT_NAND does not depend on MTD, it just uses
some defines from the mtd/nand header, but does not actually depend on MTD
being compiled in.

For the other two cases there is a more complete fix merged with commit
57b584d748d4 that also enables the needed MTD write support.

Fixes:
(MACH_TX25 && MACH_PCA100 && MACH_PCM038) selects ARCH_IMX_EXTERNAL_BOOT_NAND
which has unmet direct dependencies (ARCH_IMX && MTD)

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 arch/arm/mach-imx/Kconfig | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index a931de921eef..9ac36e145349 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -102,13 +102,11 @@ endchoice
 
 config ARCH_IMX_EXTERNAL_BOOT_NAND
 	bool
-	depends on MTD
 	depends on ARCH_IMX25 || ARCH_IMX27 || ARCH_IMX31 || ARCH_IMX35
 	prompt "Support Starting barebox from NAND in external bootmode"
 
 config BAREBOX_UPDATE_IMX_EXTERNAL_NAND
 	bool
-	depends on MTD
 	depends on ARCH_IMX_EXTERNAL_BOOT_NAND
 	depends on BAREBOX_UPDATE
 	depends on MTD
@@ -117,7 +115,6 @@ config BAREBOX_UPDATE_IMX_EXTERNAL_NAND
 
 config BAREBOX_UPDATE_IMX6_NAND
 	bool
-	depends on MTD
 	depends on ARCH_IMX6
 	depends on BAREBOX_UPDATE
 	depends on MTD
-- 
2.1.3


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/5] imd: provide dummy imd_command_setenv
  2014-12-09 11:05 ` [PATCH 3/5] imd: provide dummy imd_command_setenv Lucas Stach
@ 2014-12-10  9:05   ` Lucas Stach
  0 siblings, 0 replies; 10+ messages in thread
From: Lucas Stach @ 2014-12-10  9:05 UTC (permalink / raw)
  To: barebox

Am Dienstag, den 09.12.2014, 12:05 +0100 schrieb 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.stach@pengutronix.de>

Please don't apply this patch, it seems to cause some breakage.

Regards,
Lucas
> ---
>  include/image-metadata.h | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/include/image-metadata.h b/include/image-metadata.h
> index 34dae5ce3454..00aae6c98449 100644
> --- a/include/image-metadata.h
> +++ b/include/image-metadata.h
> @@ -112,6 +112,13 @@ static inline void imd_used(const void *unused)
>  #define IMD_USED(_name) \
>  	imd_used(&__barebox_imd_##_name)
>  
> +#ifndef CONFIG_CMD_IMD
> +int imd_command_setenv(const char *variable_name, const char *value)
> +{
> +	return -ENOSYS;
> +}
> +#endif
> +
>  #endif /* __BAREBOX__ */
>  
>  #endif /* __INCLUDE_IMAGE_METADTA_H */

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM
  2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
                   ` (3 preceding siblings ...)
  2014-12-09 11:05 ` [PATCH 5/5] Revert "ARM: i.MX: Make NAND related Kconfig options depend on MTD" Lucas Stach
@ 2014-12-11  7:36 ` Sascha Hauer
  2014-12-15 11:35   ` Lucas Stach
  4 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2014-12-11  7:36 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Tue, Dec 09, 2014 at 12:05:42PM +0100, Lucas Stach wrote:
> This will disable the capability to boot an uploaded image directly,
> but keeps other fastboot functionality. This seems like a valid config.
> 
> Fixes:
> In function `do_bootm_on_complete': undefined reference to `bootm_boot'
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/usb/gadget/f_fastboot.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index 92a1a218c643..76879db1f15d 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -653,7 +653,8 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
>  		pr_err("Booting failed\n");
>  }
>  
> -static void cb_boot(struct usb_ep *ep, struct usb_request *req, const char *opt)
> +static void __maybe_unused cb_boot(struct usb_ep *ep, struct usb_request *req,
> +				   const char *opt)
>  {
>  	struct f_fastboot *f_fb = req->context;
>  
> @@ -857,9 +858,11 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
>  	}, {
>  		.cmd = "download:",
>  		.cb = cb_download,
> +#if defined(CONFIG_BOOTM)
>  	}, {
>  		.cmd = "boot",
>  		.cb = cb_boot,
> +#endif

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?

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	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/5] fdt: don't strip const qualifier
  2014-12-09 11:05 ` [PATCH 4/5] fdt: don't strip const qualifier Lucas Stach
@ 2014-12-11  7:37   ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2014-12-11  7:37 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

On Tue, Dec 09, 2014 at 12:05:45PM +0100, Lucas Stach wrote:
> Fixes:
> warning: assignment discards 'const' qualifier from pointer target type
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Applied this one to master for now.

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	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM
  2014-12-11  7:36 ` [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Sascha Hauer
@ 2014-12-15 11:35   ` Lucas Stach
  2014-12-17 10:03     ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Lucas Stach @ 2014-12-15 11:35 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Am Donnerstag, den 11.12.2014, 08:36 +0100 schrieb Sascha Hauer:
> On Tue, Dec 09, 2014 at 12:05:42PM +0100, Lucas Stach wrote:
> > This will disable the capability to boot an uploaded image directly,
> > but keeps other fastboot functionality. This seems like a valid config.
> > 
> > Fixes:
> > In function `do_bootm_on_complete': undefined reference to `bootm_boot'
> > 
> > Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> > ---
> >  drivers/usb/gadget/f_fastboot.c | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> > index 92a1a218c643..76879db1f15d 100644
> > --- a/drivers/usb/gadget/f_fastboot.c
> > +++ b/drivers/usb/gadget/f_fastboot.c
> > @@ -653,7 +653,8 @@ static void do_bootm_on_complete(struct usb_ep *ep, struct usb_request *req)
> >  		pr_err("Booting failed\n");
> >  }
> >  
> > -static void cb_boot(struct usb_ep *ep, struct usb_request *req, const char *opt)
> > +static void __maybe_unused cb_boot(struct usb_ep *ep, struct usb_request *req,
> > +				   const char *opt)
> >  {
> >  	struct f_fastboot *f_fb = req->context;
> >  
> > @@ -857,9 +858,11 @@ static const struct cmd_dispatch_info cmd_dispatch_info[] = {
> >  	}, {
> >  		.cmd = "download:",
> >  		.cb = cb_download,
> > +#if defined(CONFIG_BOOTM)
> >  	}, {
> >  		.cmd = "boot",
> >  		.cb = cb_boot,
> > +#endif
> 
> 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.

Regards,
Lucas

-- 
Pengutronix e.K.             | Lucas Stach                 |
Industrial Linux Solutions   | http://www.pengutronix.de/  |


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM
  2014-12-15 11:35   ` Lucas Stach
@ 2014-12-17 10:03     ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2014-12-17 10:03 UTC (permalink / raw)
  To: Lucas Stach; +Cc: barebox

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

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-12-17 10:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-09 11:05 [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Lucas Stach
2014-12-09 11:05 ` [PATCH 2/5] video: imx-hdmi: search for DDC node only when EDID support is enabled Lucas Stach
2014-12-09 11:05 ` [PATCH 3/5] imd: provide dummy imd_command_setenv Lucas Stach
2014-12-10  9:05   ` Lucas Stach
2014-12-09 11:05 ` [PATCH 4/5] fdt: don't strip const qualifier Lucas Stach
2014-12-11  7:37   ` Sascha Hauer
2014-12-09 11:05 ` [PATCH 5/5] Revert "ARM: i.MX: Make NAND related Kconfig options depend on MTD" Lucas Stach
2014-12-11  7:36 ` [PATCH 1/5] usb: gadget: fastboot: allow to build without BOOTM Sascha Hauer
2014-12-15 11:35   ` Lucas Stach
2014-12-17 10:03     ` Sascha Hauer

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