* [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
@ 2013-09-17 13:58 Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 2/3] usb:gadget:Remove redundant #includes for USB composite gadget and its functions Lukasz Majewski
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Lukasz Majewski @ 2013-09-17 13:58 UTC (permalink / raw)
To: u-boot
The mass storage composite function is now compiled in only when
CONFIG_USB_GADGET_MASS_STORAGE is defined.
Such change provides binary size reduction for boards which use USB
download gadget (like am335x_evm) with DFU, but don't use UMS.
For example at am335x_evm board reduction is more than 2KiB for
text and around 120B for data.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
drivers/usb/gadget/Makefile | 1 +
drivers/usb/gadget/g_dnl.c | 2 +-
include/usb_mass_storage.h | 9 +++++++++
3 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
index 4d51f59..1590c4a 100644
--- a/drivers/usb/gadget/Makefile
+++ b/drivers/usb/gadget/Makefile
@@ -23,6 +23,7 @@ COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) += s3c_udc_otg.o
COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
+COBJS-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
endif
ifdef CONFIG_USB_ETHER
COBJS-y += ether.o
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index a3e05a8..19011bf 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -15,11 +15,11 @@
#include <part.h>
#include <g_dnl.h>
+#include <usb_mass_storage.h>
#include "f_dfu.h"
#include "gadget_chips.h"
#include "composite.c"
-#include "f_mass_storage.c"
/*
* One needs to define the following:
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 35cdcc3..e08deb4 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -11,6 +11,7 @@
#define SECTOR_SIZE 0x200
#include <mmc.h>
+#include <linux/usb/composite.h>
struct ums_device {
struct mmc *mmc;
@@ -39,4 +40,12 @@ extern struct ums_board_info *board_ums_init(unsigned int,
extern int usb_gadget_handle_interrupts(void);
extern int fsg_main_thread(void *);
+#ifdef CONFIG_USB_GADGET_MASS_STORAGE
+int fsg_add(struct usb_configuration *c);
+#else
+int fsg_add(struct usb_configuration *c)
+{
+ return 0;
+}
+#endif
#endif /* __USB_MASS_STORAGE_H__ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 2/3] usb:gadget:Remove redundant #includes for USB composite gadget and its functions
2013-09-17 13:58 [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
@ 2013-09-17 13:58 ` Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 3/3] usb:g_dnl:dfu: Download gadget and DFU function code clean up Lukasz Majewski
2013-09-24 8:11 ` [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2 siblings, 0 replies; 7+ messages in thread
From: Lukasz Majewski @ 2013-09-17 13:58 UTC (permalink / raw)
To: u-boot
Only the <linux/usb/gadget.h> requires error.h include. Hence, several
includes of error.h at USB gadget functions are not needed.
Moreover unnecessary malloc.h includes were also removed.
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
common/cmd_dfu.c | 3 ---
common/cmd_usb_mass_storage.c | 1 -
drivers/usb/gadget/g_dnl.c | 1 -
include/linux/usb/gadget.h | 1 +
4 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index d3658cf..7ce92ce 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -9,10 +9,7 @@
*/
#include <common.h>
-#include <command.h>
-#include <malloc.h>
#include <dfu.h>
-#include <asm/errno.h>
#include <g_dnl.h>
static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 33a4715..ccf7195 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -5,7 +5,6 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <errno.h>
#include <common.h>
#include <command.h>
#include <g_dnl.h>
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 19011bf..29d08a3 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -7,7 +7,6 @@
* SPDX-License-Identifier: GPL-2.0+
*/
-#include <errno.h>
#include <common.h>
#include <malloc.h>
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 220d068..a8a5763 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -18,6 +18,7 @@
#ifndef __LINUX_USB_GADGET_H
#define __LINUX_USB_GADGET_H
+#include <errno.h>
#include <linux/list.h>
struct usb_ep;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 3/3] usb:g_dnl:dfu: Download gadget and DFU function code clean up
2013-09-17 13:58 [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 2/3] usb:gadget:Remove redundant #includes for USB composite gadget and its functions Lukasz Majewski
@ 2013-09-17 13:58 ` Lukasz Majewski
2013-09-24 8:11 ` [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2 siblings, 0 replies; 7+ messages in thread
From: Lukasz Majewski @ 2013-09-17 13:58 UTC (permalink / raw)
To: u-boot
The download gadget code and DFU function lacks of proper declarations
for the case when a target board wants to use only one of available usb
functions.
Moreover the relevant declarations have been moved to consistent
localization (like <dfu.h>).
Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
drivers/usb/gadget/f_dfu.h | 3 ---
drivers/usb/gadget/g_dnl.c | 2 +-
include/dfu.h | 9 +++++++++
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/f_dfu.h b/drivers/usb/gadget/f_dfu.h
index 34a4dde..cc2c455 100644
--- a/drivers/usb/gadget/f_dfu.h
+++ b/drivers/usb/gadget/f_dfu.h
@@ -82,7 +82,4 @@ struct dfu_function_descriptor {
__le16 wTransferSize;
__le16 bcdDFUVersion;
} __packed;
-
-/* configuration-specific linkup */
-int dfu_add(struct usb_configuration *c);
#endif /* __F_DFU_H_ */
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 29d08a3..40868c0 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -15,7 +15,7 @@
#include <g_dnl.h>
#include <usb_mass_storage.h>
-#include "f_dfu.h"
+#include <dfu.h>
#include "gadget_chips.h"
#include "composite.c"
diff --git a/include/dfu.h b/include/dfu.h
index 6f25341..f3f7f0b 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -14,6 +14,7 @@
#include <common.h>
#include <linux/list.h>
#include <mmc.h>
+#include <linux/usb/composite.h>
enum dfu_device_type {
DFU_DEV_MMC = 1,
@@ -139,4 +140,12 @@ static inline int dfu_fill_entity_nand(struct dfu_entity *dfu, char *s)
}
#endif
+#ifdef CONFIG_DFU_FUNCTION
+int dfu_add(struct usb_configuration *c);
+#else
+int dfu_add(struct usb_configuration *c)
+{
+ return 0;
+}
+#endif
#endif /* __DFU_ENTITY_H_ */
--
1.7.10.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
2013-09-17 13:58 [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 2/3] usb:gadget:Remove redundant #includes for USB composite gadget and its functions Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 3/3] usb:g_dnl:dfu: Download gadget and DFU function code clean up Lukasz Majewski
@ 2013-09-24 8:11 ` Lukasz Majewski
2013-09-24 8:47 ` Marek Vasut
2 siblings, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2013-09-24 8:11 UTC (permalink / raw)
To: u-boot
Hi Marek,
> The mass storage composite function is now compiled in only when
> CONFIG_USB_GADGET_MASS_STORAGE is defined.
> Such change provides binary size reduction for boards which use USB
> download gadget (like am335x_evm) with DFU, but don't use UMS.
>
> For example at am335x_evm board reduction is more than 2KiB for
> text and around 120B for data.
>
Any comments on those patches (from patch 1 to 3)?
> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
> drivers/usb/gadget/Makefile | 1 +
> drivers/usb/gadget/g_dnl.c | 2 +-
> include/usb_mass_storage.h | 9 +++++++++
> 3 files changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/gadget/Makefile b/drivers/usb/gadget/Makefile
> index 4d51f59..1590c4a 100644
> --- a/drivers/usb/gadget/Makefile
> +++ b/drivers/usb/gadget/Makefile
> @@ -23,6 +23,7 @@ COBJS-$(CONFIG_USB_GADGET_S3C_UDC_OTG) +=
> s3c_udc_otg.o COBJS-$(CONFIG_USB_GADGET_FOTG210) += fotg210.o
> COBJS-$(CONFIG_USBDOWNLOAD_GADGET) += g_dnl.o
> COBJS-$(CONFIG_DFU_FUNCTION) += f_dfu.o
> +COBJS-$(CONFIG_USB_GADGET_MASS_STORAGE) += f_mass_storage.o
> endif
> ifdef CONFIG_USB_ETHER
> COBJS-y += ether.o
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index a3e05a8..19011bf 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -15,11 +15,11 @@
> #include <part.h>
>
> #include <g_dnl.h>
> +#include <usb_mass_storage.h>
> #include "f_dfu.h"
>
> #include "gadget_chips.h"
> #include "composite.c"
> -#include "f_mass_storage.c"
>
> /*
> * One needs to define the following:
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 35cdcc3..e08deb4 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -11,6 +11,7 @@
> #define SECTOR_SIZE 0x200
>
> #include <mmc.h>
> +#include <linux/usb/composite.h>
>
> struct ums_device {
> struct mmc *mmc;
> @@ -39,4 +40,12 @@ extern struct ums_board_info
> *board_ums_init(unsigned int, extern int
> usb_gadget_handle_interrupts(void); extern int fsg_main_thread(void
> *);
> +#ifdef CONFIG_USB_GADGET_MASS_STORAGE
> +int fsg_add(struct usb_configuration *c);
> +#else
> +int fsg_add(struct usb_configuration *c)
> +{
> + return 0;
> +}
> +#endif
> #endif /* __USB_MASS_STORAGE_H__ */
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
^ permalink raw reply [flat|nested] 7+ messages in thread* [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
2013-09-24 8:11 ` [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
@ 2013-09-24 8:47 ` Marek Vasut
2013-09-27 11:34 ` Lukasz Majewski
0 siblings, 1 reply; 7+ messages in thread
From: Marek Vasut @ 2013-09-24 8:47 UTC (permalink / raw)
To: u-boot
Dear Lukasz Majewski,
> Hi Marek,
>
> > The mass storage composite function is now compiled in only when
> > CONFIG_USB_GADGET_MASS_STORAGE is defined.
> > Such change provides binary size reduction for boards which use USB
> > download gadget (like am335x_evm) with DFU, but don't use UMS.
> >
> > For example at am335x_evm board reduction is more than 2KiB for
> > text and around 120B for data.
>
> Any comments on those patches (from patch 1 to 3)?
Will push them up in a bit.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
2013-09-24 8:47 ` Marek Vasut
@ 2013-09-27 11:34 ` Lukasz Majewski
2013-09-27 14:29 ` Marek Vasut
0 siblings, 1 reply; 7+ messages in thread
From: Lukasz Majewski @ 2013-09-27 11:34 UTC (permalink / raw)
To: u-boot
Hi Marek,
> Dear Lukasz Majewski,
>
> > Hi Marek,
> >
> > > The mass storage composite function is now compiled in only when
> > > CONFIG_USB_GADGET_MASS_STORAGE is defined.
> > > Such change provides binary size reduction for boards which use
> > > USB download gadget (like am335x_evm) with DFU, but don't use UMS.
> > >
> > > For example at am335x_evm board reduction is more than 2KiB for
> > > text and around 120B for data.
> >
> > Any comments on those patches (from patch 1 to 3)?
>
> Will push them up in a bit.
Is there any problem with pulling those patches?
>
> Best regards,
> Marek Vasut
--
Best regards,
Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage)
2013-09-27 11:34 ` Lukasz Majewski
@ 2013-09-27 14:29 ` Marek Vasut
0 siblings, 0 replies; 7+ messages in thread
From: Marek Vasut @ 2013-09-27 14:29 UTC (permalink / raw)
To: u-boot
Dear Lukasz Majewski,
> Hi Marek,
>
> > Dear Lukasz Majewski,
> >
> > > Hi Marek,
> > >
> > > > The mass storage composite function is now compiled in only when
> > > > CONFIG_USB_GADGET_MASS_STORAGE is defined.
> > > > Such change provides binary size reduction for boards which use
> > > > USB download gadget (like am335x_evm) with DFU, but don't use UMS.
> > > >
> > > > For example at am335x_evm board reduction is more than 2KiB for
> > > > text and around 120B for data.
> > >
> > > Any comments on those patches (from patch 1 to 3)?
> >
> > Will push them up in a bit.
>
> Is there any problem with pulling those patches?
PR tonight.
Best regards,
Marek Vasut
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-09-27 14:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-17 13:58 [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 2/3] usb:gadget:Remove redundant #includes for USB composite gadget and its functions Lukasz Majewski
2013-09-17 13:58 ` [U-Boot] [PATCH 3/3] usb:g_dnl:dfu: Download gadget and DFU function code clean up Lukasz Majewski
2013-09-24 8:11 ` [U-Boot] [PATCH 1/3] usb:g_dnl:ums: Conditional compilation for mass storage function (f_mass_storage) Lukasz Majewski
2013-09-24 8:47 ` Marek Vasut
2013-09-27 11:34 ` Lukasz Majewski
2013-09-27 14:29 ` Marek Vasut
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox