All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/9] mmc: mmc header fix
@ 2014-01-09 14:31 Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH 2/9] part: " Mateusz Zalega
                   ` (12 more replies)
  0 siblings, 13 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Change-Id: I3ccf56ce1e5334c32a7bc061e8bd9a5054ccb7f5
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index cb558da..e490a06 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/compiler.h>
+#include <part.h>
 
 #define SD_VERSION_SD	0x20000
 #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
-- 
1.8.2.1

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

* [U-Boot] [PATCH 2/9] part: header fix
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH v3 3/9] arm:goni: Update configuration for goni target Mateusz Zalega
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Change-Id: Iafdd4f1997767e9eb84d583fd32c79c8c4d43afd
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index ce840bd..329613a 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include <ide.h>
+#include <common.h>
 
 typedef struct block_dev_desc {
 	int		if_type;	/* type of the interface */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v3 3/9] arm:goni: Update configuration for goni target
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH 2/9] part: " Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

It's an updated version of an earlier patch which didn't make it to mainline
due to dependencies.

Change-Id: I00e55bc970512986f50b1f943021ba9de683795e
Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..1d2dcc0 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110		1	/* which is in a S5PC110 */
 #define CONFIG_MACH_GONI	1	/* working with Goni */
 
+#include <asm/sizes.h>
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -37,11 +38,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x100000, 0x100000 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -89,30 +88,25 @@
 				",7m(kernel)"\
 				",1m(log)"\
 				",12m(modem)"\
-				",60m(qboot)"\
-				",-(UBI)\0"
+				",60m(qboot)\0"
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND	"run ubifsboot"
+#define CONFIG_BOOTCOMMAND	"run mmcboot"
 
 #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
 
-#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext2" \
+#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \
 		" ${console} ${meminfo}"
 
 #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
 
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 ubi.mtd=6" \
-		" rootfstype=cramfs " CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4 " \
+			CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
 			" onenand write 0x32008000 0x0 0x100000\0"
 
-#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6"
-
-#define CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc"
-
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_EXTRA_ENV_SETTINGS					\
@@ -124,36 +118,38 @@
 		"onenand erase 0x01560000 0x1eaa0000;" \
 		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
 	"bootk=" \
-		"onenand read 0x30007FC0 0xc00000 0x600000;" \
+		"run loaduimage;" \
 		"bootm 0x30007FC0\0" \
 	"flashboot=" \
 		"set bootargs root=/dev/mtdblock${bootblock} " \
-		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts} " \
+		"rootfstype=${rootfstype} ${opts} " \
 		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
 	"ubifsboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"tftpboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
-		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
-		"bootm 0x30007FC0\0" \
+		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
 	"ramboot=" \
 		"set bootargs " CONFIG_RAMDISK_BOOT \
-		" initrd=0x33000000,8M ramdisk=8192\0" \
+		"initrd=0x33000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
-		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
 	"verify=n\0" \
-	"rootfstype=cramfs\0" \
+	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
 	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M@0x50000000\0" \
-	"mmcblk=/dev/mmcblk1p1\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"mmcdev=0\0" \
+	"mmcbootpart=2\0" \
+	"mmcrootpart=5\0" \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
@@ -196,6 +192,13 @@
 
 #define CONFIG_DOS_PARTITION		1
 
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+
+/* write support for filesystems */
+#define CONFIG_FAT_WRITE
+#define CONFIG_EXT4_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
@@ -220,5 +223,6 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
 
 #endif	/* __CONFIG_H */
-- 
1.8.2.1

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

* [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH 2/9] part: " Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH v3 3/9] arm:goni: Update configuration for goni target Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-10  4:55   ` Jaehoon Chung
  2014-01-09 14:31 ` [U-Boot] [PATCH 5/9] arm:goni: enable GPT command Mateusz Zalega
                   ` (9 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover, the code for low level
USB initialization has been added to Goni board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/goni/goni.c  | 10 +++++++++
 include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 53 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 366f648..5498daa 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -13,6 +13,9 @@
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct s5pc110_gpio *s5pc110_gpio;
@@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
 	.regs_otg = S5PC110_OTG_BASE,
 	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("USB_udc_probe\n");
+	s3c_udc_probe(&s5pc110_otg_data);
+	return 0;
+}
 #endif
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 1d2dcc0..24a0fcc 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -39,7 +39,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -70,14 +70,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY		1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
@@ -90,7 +94,34 @@
 				",12m(modem)"\
 				",60m(qboot)\0"
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY		1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA			"csa-mmc"
+#define PARTS_BOOTLOADER	"u-boot"
+#define PARTS_BOOT			"boot"
+#define PARTS_ROOT			"platform"
+#define PARTS_DATA			"data"
+#define PARTS_CSC			"csc"
+#define PARTS_UMS			"ums"
+
+#define CONFIG_DFU_ALT \
+	"u-boot raw 0x80 0x400;" \
+	"uImage ext4 0 2;" \
+	"exynos3-goni.dtb ext4 0 2;" \
+	""PARTS_ROOT" part 0 5\0"
+
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
+	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
+	"name="PARTS_BOOTLOADER",size=60MiB," \
+	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
+	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
+	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
+	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
+	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
+	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_BOOTCOMMAND	"run mmcboot"
 
@@ -144,18 +175,18 @@
 	"verify=n\0" \
 	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
-	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
 	"mmcrootpart=5\0" \
+	"partitions=" PARTS_DEFAULT \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
-	"opts=always_resume=1"
+	"opts=always_resume=1\0" \
+	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
 #define CONFIG_SYS_PROMPT	"Goni # "
@@ -194,6 +225,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE
-- 
1.8.2.1

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

* [U-Boot] [PATCH 5/9] arm:goni: enable GPT command
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (2 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH 6/9] arm:goni: enable USB Mass Storage Mateusz Zalega
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Change-Id: Ifa9acad620652ac731e00d00db511846b6606917
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 include/configs/s5p_goni.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 24a0fcc..d25c494 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -231,6 +232,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
-- 
1.8.2.1

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

* [U-Boot] [PATCH 6/9] arm:goni: enable USB Mass Storage
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (3 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH 5/9] arm:goni: enable GPT command Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-09 14:31 ` [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix Mateusz Zalega
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

UMS-related defines were added to Samsung Goni config header.

Change-Id: I6c960e6785742653831aae4e7fc717ee493332cc
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index d25c494..7314bff 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -261,5 +261,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif	/* __CONFIG_H */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (4 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH 6/9] arm:goni: enable USB Mass Storage Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-10  5:03   ` Jaehoon Chung
  2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

v2 changes:
- code cleanup
- minor dfu_alt_info format change

v3 changes:
- moved invalid block length check to mmc core
- removed redundant 'has_init' check

Change-Id: Icb50bb9f805a9a78848acd19f682fad474cb9082
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
 drivers/mmc/mmc.c            |  13 ++++--
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h      |   2 +-
 include/configs/trats2.h     |   2 +-
 include/dfu.h                |   5 --
 6 files changed, 80 insertions(+), 56 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index f942758..075e4cd 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -168,66 +168,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 	return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ *	1st:
+ *		raw	(raw read/write)
+ *		fat	(files)
+ *		ext4	(^)
+ *		part	(partition image)
+ *	2nd and 3rd:
+ *		lba_start and lba_size, for raw write
+ *		mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-	int dev, part;
-	struct mmc *mmc;
-	block_dev_desc_t *blk_dev;
-	disk_partition_t partinfo;
-	char *st;
-
-	dfu->dev_type = DFU_DEV_MMC;
-	st = strsep(&s, " ");
-	if (!strcmp(st, "mmc")) {
-		dfu->layout = DFU_RAW_ADDR;
-		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
-		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
-		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
-	} else if (!strcmp(st, "fat")) {
-		dfu->layout = DFU_FS_FAT;
-	} else if (!strcmp(st, "ext4")) {
-		dfu->layout = DFU_FS_EXT4;
-	} else if (!strcmp(st, "part")) {
+	const char *argv[3];
+	const char **parg = argv;
+	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
+		*parg = strsep(&s, " ");
+		if (*parg == NULL) {
+			error("Invalid number of arguments.\n");
+			return -ENODEV;
+		}
+	}
 
-		dfu->layout = DFU_RAW_ADDR;
+	const char *entity_type = argv[0];
+	/*
+	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+	 * with default 10.
+	 */
+	size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+	size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-		dev = simple_strtoul(s, &s, 10);
-		s++;
-		part = simple_strtoul(s, &s, 10);
+	struct mmc *mmc = find_mmc_device(dfu->dev_num);
+	if (mmc == NULL) {
+		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
+		return -ENODEV;
+	}
 
-		mmc = find_mmc_device(dev);
-		if (mmc == NULL || mmc_init(mmc)) {
-			printf("%s: could not find mmc device #%d!\n",
-			       __func__, dev);
-			return -ENODEV;
-		}
+	if (mmc_init(mmc)) {
+		error("Couldn't init MMC device.\n");
+		return -ENODEV;
+	}
 
-		blk_dev = &mmc->block_dev;
-		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
-			printf("%s: could not find partition #%d on mmc device #%d!\n",
-			       __func__, part, dev);
+	if (!strcmp(entity_type, "raw")) {
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= second_arg;
+		dfu->data.mmc.lba_size		= third_arg;
+		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
+	} else if (!strcmp(entity_type, "part")) {
+		disk_partition_t partinfo;
+		block_dev_desc_t *blk_dev = &mmc->block_dev;
+		int mmcdev = second_arg;
+		int mmcpart = third_arg;
+
+		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
+			error("Couldn't find part #%d on mmc device #%d\n",
+			      mmcpart, mmcdev);
 			return -ENODEV;
 		}
 
-		dfu->data.mmc.lba_start = partinfo.start;
-		dfu->data.mmc.lba_size = partinfo.size;
-		dfu->data.mmc.lba_blk_size = partinfo.blksz;
-
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= partinfo.start;
+		dfu->data.mmc.lba_size		= partinfo.size;
+		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
+	} else if (!strcmp(entity_type, "fat")) {
+		dfu->layout = DFU_FS_FAT;
+	} else if (!strcmp(entity_type, "ext4")) {
+		dfu->layout = DFU_FS_EXT4;
 	} else {
-		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		error("Memory layout (%s) not supported!\n", entity_type);
 		return -ENODEV;
 	}
 
-	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
-		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
-		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+	/* if it's NOT a raw write */
+	if (strcmp(entity_type, "raw")) {
+		dfu->data.mmc.dev = second_arg;
+		dfu->data.mmc.part = third_arg;
 	}
 
+	dfu->dev_type = DFU_DEV_MMC;
 	dfu->read_medium = dfu_read_medium_mmc;
 	dfu->write_medium = dfu_write_medium_mmc;
 	dfu->flush_medium = dfu_flush_medium_mmc;
-
-	/* initial state */
 	dfu->inited = 0;
 
 	return 0;
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index e1461a9..f2fa230 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -15,6 +15,7 @@
 #include <malloc.h>
 #include <linux/list.h>
 #include <div64.h>
+#include <errno.h>
 #include "mmc_private.h"
 
 /* Set block count limit because of 16 bit register limit on some hardware*/
@@ -1266,17 +1267,23 @@ static int mmc_complete_init(struct mmc *mmc)
 
 int mmc_init(struct mmc *mmc)
 {
+	if (mmc->has_init)
+		return 0;
+
 	int err = IN_PROGRESS;
 	unsigned start = get_timer(0);
 
-	if (mmc->has_init)
-		return 0;
 	if (!mmc->init_in_progress)
 		err = mmc_start_init(mmc);
-
 	if (!err || err == IN_PROGRESS)
 		err = mmc_complete_init(mmc);
+
 	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
+
+	if (!mmc->read_bl_len || !mmc->write_bl_len) {
+		error("invalid block length\n");
+		return -ENODEV;
+	}
 	return err;
 }
 
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 8af4d6a..d76962f 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -312,10 +312,10 @@
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 100 100;" \
-	"u-boot.img.raw mmc 300 400;" \
-	"spl-os-args.raw mmc 80 80;" \
-	"spl-os-image.raw mmc 900 2000;" \
+	"MLO.raw mmc 0x100 0x100;" \
+	"u-boot.img.raw mmc 0x300 0x400;" \
+	"spl-os-args.raw mmc 0x80 0x80;" \
+	"spl-os-image.raw mmc 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 6cd15c2..ed3b278 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -140,7 +140,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 400;" \
+	"u-boot raw 0x80 0x400;" \
 	"uImage ext4 0 2;" \
 	"exynos4210-trats.dtb ext4 0 2;" \
 	""PARTS_ROOT" part 0 5\0"
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 5d86a3d..a22be63 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -169,7 +169,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 800;" \
+	"u-boot mmc 0x80 0x800;" \
 	"uImage ext4 0 2;" \
 	"exynos4412-trats2.dtb ext4 0 2;" \
 	""PARTS_ROOT" part 0 5\0"
diff --git a/include/dfu.h b/include/dfu.h
index f973426..f2e83db 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -64,11 +64,6 @@ struct ram_internal_data {
 	unsigned int	size;
 };
 
-static inline unsigned int get_mmc_blk_size(int dev)
-{
-	return find_mmc_device(dev)->read_bl_len;
-}
-
 #define DFU_NAME_SIZE			32
 #define DFU_CMD_BUF_SIZE		128
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-- 
1.8.2.1

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (5 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-10  5:08   ` Jaehoon Chung
                     ` (2 more replies)
  2014-01-09 14:31 ` [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
                   ` (5 subsequent siblings)
  12 siblings, 3 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 board/samsung/common/ums.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..0d8f30d 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -37,6 +37,9 @@ static struct ums ums_dev = {
 
 static struct ums *ums_disk_init(struct mmc *mmc)
 {
+	if (mmc_init(mmc))
+		return NULL;
+
 	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
 	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
-- 
1.8.2.1

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

* [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (6 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-01-09 14:31 ` Mateusz Zalega
  2014-01-10  8:23   ` Lukasz Majewski
  2014-01-13 10:16   ` Lukasz Majewski
  2014-01-10  4:46 ` [U-Boot] [PATCH 1/9] mmc: mmc header fix Jaehoon Chung
                   ` (4 subsequent siblings)
  12 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-09 14:31 UTC (permalink / raw)
  To: u-boot

Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of {usb_function_name,
bind_callback) pairs.

Change-Id: I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dc
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
---
 common/cmd_dfu.c                    |  3 +-
 common/cmd_thordown.c               |  3 +-
 common/cmd_usb_mass_storage.c       |  2 +-
 drivers/usb/gadget/f_dfu.c          | 11 ++++--
 drivers/usb/gadget/f_mass_storage.c |  6 +++
 drivers/usb/gadget/f_thor.c         |  5 +++
 drivers/usb/gadget/g_dnl.c          | 74 +++++++++++++++++--------------------
 include/dfu.h                       |  7 ----
 include/g_dnl.h                     | 11 ++++++
 include/thor.h                      |  8 ----
 include/usb_mass_storage.h          |  8 ----
 11 files changed, 66 insertions(+), 72 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	char *s = "dfu";
 	int ret, i = 0;
 
 	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	board_usb_init(controller_index, USB_INIT_DEVICE);
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_dfu");
 	while (1) {
 		if (dfu_reset())
 			/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	const char *s = "thor";
 	int ret;
 
 	puts("TIZEN \"THOR\" Downloader\n");
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto exit;
 	}
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_thor");
 
 	ret = thor_init();
 	if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 99487f4..c8e152c 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	g_dnl_register("ums");
+	g_dnl_register("usb_dnl_ums");
 
 	while (1) {
 		usb_gadget_handle_interrupts();
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..cde1895 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -18,12 +18,14 @@
 #include <errno.h>
 #include <common.h>
 #include <malloc.h>
+#include <linker_lists.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 
 #include <dfu.h>
+#include <g_dnl.h>
 #include "f_dfu.h"
 
 struct f_dfu {
@@ -768,9 +770,7 @@ static int dfu_bind_config(struct usb_configuration *c)
 
 int dfu_add(struct usb_configuration *c)
 {
-	int id;
-
-	id = usb_string_id(c->cdev);
+	int id = usb_string_id(c->cdev);
 	if (id < 0)
 		return id;
 	strings_dfu_generic[0].id = id;
@@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
 
 	return dfu_bind_config(c);
 }
+
+/* export dfu_add to g_dnl.o */
+ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_dfu",
+					  .fptr = dfu_add };
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index b1fe8bd..b7d03f2 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -243,6 +243,7 @@
 #include <config.h>
 #include <malloc.h>
 #include <common.h>
+#include <linker_lists.h>
 #include <usb.h>
 
 #include <linux/err.h>
@@ -255,6 +256,7 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <usb/lin_gadget_compat.h>
+#include <g_dnl.h>
 
 /*------------------------------------------------------------------------*/
 
@@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
 
 	return 0;
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_ums",
+					  .fptr = fsg_add };
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index c4c9909..3f428c8 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -17,6 +17,7 @@
 
 #include <errno.h>
 #include <common.h>
+#include <linker_lists.h>
 #include <malloc.h>
 #include <version.h>
 #include <linux/usb/ch9.h>
@@ -1001,3 +1002,7 @@ int thor_add(struct usb_configuration *c)
 	debug("%s:\n", __func__);
 	return thor_func_init(c);
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, thor_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_thor",
+					  .fptr = thor_add };
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..00ace2c 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
-static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -95,30 +94,38 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
 
 	free(cdev->config);
 	cdev->config = NULL;
-	debug("%s: calling usb_gadget_disconnect for "
-			"controller '%s'\n", shortname, gadget->name);
+	debug("%s: calling usb_gadget_disconnect for controller '%s'\n",
+			__func__, gadget->name);
 	usb_gadget_disconnect(gadget);
 
 	return 0;
 }
 
+static inline struct g_dnl_bind_callback * g_dnl_first_bind_callback(void)
+{
+	return ll_entry_start(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
+static inline struct g_dnl_bind_callback * g_dnl_last_bind_callback(void)
+{
+	return ll_entry_end(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
 static int g_dnl_do_config(struct usb_configuration *c)
 {
 	const char *s = c->cdev->driver->name;
-	int ret = -1;
 
 	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
-	      __func__, c, c->cdev);
-
+			__func__, c, c->cdev);
 	printf("GADGET DRIVER: %s\n", s);
-	if (!strcmp(s, "usb_dnl_dfu"))
-		ret = dfu_add(c);
-	else if (!strcmp(s, "usb_dnl_ums"))
-		ret = fsg_add(c);
-	else if (!strcmp(s, "usb_dnl_thor"))
-		ret = thor_add(c);
-
-	return ret;
+
+	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
+	for (; callback != g_dnl_last_bind_callback(); ++callback)
+		if (!strcmp(s, callback->usb_function_name))
+			return callback->fptr(c);
+	return -ENODEV;
 }
 
 static int g_dnl_config_register(struct usb_composite_dev *cdev)
@@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
-			shortname, gadget->name);
+				__func__, gadget->name);
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
-	debug("%s: calling usb_gadget_connect for "
-			"controller '%s'\n", shortname, gadget->name);
+	debug("%s: calling usb_gadget_connect for controller '%s'\n",
+			__func__, gadget->name);
 	usb_gadget_connect(gadget);
 
 	return 0;
@@ -227,36 +234,21 @@ static struct usb_composite_driver g_dnl_driver = {
 	.unbind = g_dnl_unbind,
 };
 
-int g_dnl_register(const char *type)
+/*
+ * NOTICE:
+ * Registering via USB function name won't be necessary after rewriting
+ * g_dnl to support multiple USB functions.
+ */
+int g_dnl_register(const char *name)
 {
-	/* The largest function name is 4 */
-	static char name[sizeof(shortname) + 4];
-	int ret;
-
-	if (!strcmp(type, "dfu")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "ums")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "thor")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else {
-		printf("%s: unknown command: %s\n", __func__, type);
-		return -EINVAL;
-	}
-
+	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
-	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
-	ret = usb_composite_register(&g_dnl_driver);
-
+	int ret = usb_composite_register(&g_dnl_driver);
 	if (ret) {
-		printf("%s: failed!, error: %d\n", __func__, ret);
+		debug("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
 	}
-
 	return 0;
 }
 
diff --git a/include/dfu.h b/include/dfu.h
index f2e83db..6fd75d0 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -164,12 +164,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 8f813c2..4392f76 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,17 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback
+{
+	const char *usb_function_name;
+	g_dnl_bind_callback_f fptr;
+};
+
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
 
 int thor_handle(void);
 int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
 int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
-	return 0;
-}
-#endif
 #endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 9df3adc..6ee4f34 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -37,13 +37,5 @@ int fsg_init(struct ums *);
 void fsg_cleanup(void);
 struct ums *ums_init(unsigned int);
 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.8.2.1

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

* [U-Boot] [PATCH 1/9] mmc: mmc header fix
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (7 preceding siblings ...)
  2014-01-09 14:31 ` [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-01-10  4:46 ` Jaehoon Chung
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Jaehoon Chung @ 2014-01-10  4:46 UTC (permalink / raw)
  To: u-boot

Looks good to me. CC'd mmc Custodian.

Acked-by: Jaehoon Chung <jh80.chung@samsung.com>

On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
> Structure definition used type block_dev_desc_t, defined in part.h, which
> wasn't included in mmc.h. It worked only in circumstances when common.h,
> or another header using part.h was incuded in implementation files.
> 
> Change-Id: I3ccf56ce1e5334c32a7bc061e8bd9a5054ccb7f5
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  include/mmc.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/mmc.h b/include/mmc.h
> index cb558da..e490a06 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -12,6 +12,7 @@
>  
>  #include <linux/list.h>
>  #include <linux/compiler.h>
> +#include <part.h>
>  
>  #define SD_VERSION_SD	0x20000
>  #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
> 

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

* [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target
  2014-01-09 14:31 ` [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
@ 2014-01-10  4:55   ` Jaehoon Chung
  2014-01-13 14:45     ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Jaehoon Chung @ 2014-01-10  4:55 UTC (permalink / raw)
  To: u-boot

Hi Mateusz.

On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
> Proper adjustment for supporting DFU at GONI target has been made.
> The s5p_goni.h file has been updated. Moreover, the code for low level
> USB initialization has been added to Goni board code.
> 
> The malloc pool has been enlarged in order to support larger buffer
> sizes needed by DFU implementation.
> 
> Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  board/samsung/goni/goni.c  | 10 +++++++++
>  include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
>  2 files changed, 53 insertions(+), 11 deletions(-)
> 
> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
> index 366f648..5498daa 100644
> --- a/board/samsung/goni/goni.c
> +++ b/board/samsung/goni/goni.c
> @@ -13,6 +13,9 @@
>  #include <usb/s3c_udc.h>
>  #include <asm/arch/cpu.h>
>  #include <power/max8998_pmic.h>
> +#include <usb.h>
> +#include <usb_mass_storage.h>
> +
>  DECLARE_GLOBAL_DATA_PTR;
>  
>  static struct s5pc110_gpio *s5pc110_gpio;
> @@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
>  	.regs_otg = S5PC110_OTG_BASE,
>  	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
>  };
> +
> +int board_usb_init(int index, enum usb_init_type init)
> +{
> +	debug("USB_udc_probe\n");
> +	s3c_udc_probe(&s5pc110_otg_data);
> +	return 0;
Always return 0? return s3c_udc_probe(&s5pc110_otg_data);

> +}
>  #endif
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index 1d2dcc0..24a0fcc 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -39,7 +39,7 @@
>  #define CONFIG_CMDLINE_EDITING
>  
>  /* Size of malloc() pool.*/
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
>  
>  /*
>   * select serial console configuration
> @@ -70,14 +70,18 @@
>  #define CONFIG_CMD_CACHE
>  #define CONFIG_CMD_REGINFO
>  #define CONFIG_CMD_ONENAND
> -#define CONFIG_CMD_MTDPARTS
>  #define CONFIG_CMD_MMC
> +#define CONFIG_CMD_DFU
>  
> -#define CONFIG_BOOTDELAY		1
> -#define CONFIG_ZERO_BOOTDELAY_CHECK
> +/* USB Composite download gadget - g_dnl */
> +#define CONFIG_USBDOWNLOAD_GADGET
> +#define CONFIG_DFU_FUNCTION
> +#define CONFIG_DFU_MMC
>  
> -#define CONFIG_MTD_DEVICE
> -#define CONFIG_MTD_PARTITIONS
> +/* USB Samsung's IDs */
> +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
> +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
> +#define CONFIG_G_DNL_MANUFACTURER "Samsung"
>  
>  /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
>  #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
> @@ -90,7 +94,34 @@
>  				",12m(modem)"\
>  				",60m(qboot)\0"
>  
> -#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
> +#define CONFIG_BOOTDELAY		1
> +#define CONFIG_ZERO_BOOTDELAY_CHECK
> +
> +/* partitions definitions */
> +#define PARTS_CSA			"csa-mmc"
> +#define PARTS_BOOTLOADER	"u-boot"
> +#define PARTS_BOOT			"boot"
> +#define PARTS_ROOT			"platform"
> +#define PARTS_DATA			"data"
> +#define PARTS_CSC			"csc"
> +#define PARTS_UMS			"ums"
> +
> +#define CONFIG_DFU_ALT \
> +	"u-boot raw 0x80 0x400;" \
> +	"uImage ext4 0 2;" \
> +	"exynos3-goni.dtb ext4 0 2;" \
exynos3-goni.dtb?

Best Regards,
Jaehoon Chung

> +	""PARTS_ROOT" part 0 5\0"
> +
> +#define PARTS_DEFAULT \
> +	"uuid_disk=${uuid_gpt_disk};" \
> +	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
> +	"name="PARTS_BOOTLOADER",size=60MiB," \
> +	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
> +	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
> +	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
> +	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
> +	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
> +	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>  
>  #define CONFIG_BOOTCOMMAND	"run mmcboot"
>  
> @@ -144,18 +175,18 @@
>  	"verify=n\0" \
>  	"rootfstype=ext4\0" \
>  	"console=" CONFIG_DEFAULT_CONSOLE \
> -	"mtdparts=" MTDPARTS_DEFAULT \
>  	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
> -	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
> +	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
>  	"mmcdev=0\0" \
>  	"mmcbootpart=2\0" \
>  	"mmcrootpart=5\0" \
> +	"partitions=" PARTS_DEFAULT \
>  	"bootblock=9\0" \
>  	"ubiblock=8\0" \
>  	"ubi=enabled\0" \
> -	"opts=always_resume=1"
> +	"opts=always_resume=1\0" \
> +	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
>  
> -/* Miscellaneous configurable options */
>  #define CONFIG_SYS_LONGHELP		/* undef to save memory */
>  #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
>  #define CONFIG_SYS_PROMPT	"Goni # "
> @@ -194,6 +225,7 @@
>  
>  #define CONFIG_CMD_FAT
>  #define CONFIG_CMD_EXT4
> +#define CONFIG_CMD_EXT4_WRITE
>  
>  /* write support for filesystems */
>  #define CONFIG_FAT_WRITE
> 

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

* [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix
  2014-01-09 14:31 ` [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix Mateusz Zalega
@ 2014-01-10  5:03   ` Jaehoon Chung
  2014-01-13 13:34     ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Jaehoon Chung @ 2014-01-10  5:03 UTC (permalink / raw)
  To: u-boot

Hi, Mateusz,

This patch should be separated with dfu and mmc.

On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
> When user attempted to perform a raw write using DFU (vide
> dfu_fill_entity_mmc) with MMC interface not initialized before,
> get_mmc_blk_size() reported invalid (zero) block size - it wasn't
> possible to write ie. a new u-boot image.
> 
> This commit fixes that by initializing device in get_mmc_blk_size() when
> needed.
> 
> Tested on Samsung Goni.
> 
> v2 changes:
> - code cleanup
> - minor dfu_alt_info format change
> 
> v3 changes:
> - moved invalid block length check to mmc core
> - removed redundant 'has_init' check
> 
> Change-Id: Icb50bb9f805a9a78848acd19f682fad474cb9082
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
>  drivers/mmc/mmc.c            |  13 ++++--
>  include/configs/am335x_evm.h |   8 ++--
>  include/configs/trats.h      |   2 +-
>  include/configs/trats2.h     |   2 +-
>  include/dfu.h                |   5 --
>  6 files changed, 80 insertions(+), 56 deletions(-)
> 
> diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
> index f942758..075e4cd 100644
> --- a/drivers/dfu/dfu_mmc.c
> +++ b/drivers/dfu/dfu_mmc.c
> @@ -168,66 +168,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
>  	return ret;
>  }
>  
> +/*
> + * @param s Parameter string containing space-separated arguments:
> + *	1st:
> + *		raw	(raw read/write)
> + *		fat	(files)
> + *		ext4	(^)
> + *		part	(partition image)
> + *	2nd and 3rd:
> + *		lba_start and lba_size, for raw write
> + *		mmc_dev and mmc_part, for filesystems and part
> + */
>  int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
>  {
> -	int dev, part;
> -	struct mmc *mmc;
> -	block_dev_desc_t *blk_dev;
> -	disk_partition_t partinfo;
> -	char *st;
> -
> -	dfu->dev_type = DFU_DEV_MMC;
> -	st = strsep(&s, " ");
> -	if (!strcmp(st, "mmc")) {
> -		dfu->layout = DFU_RAW_ADDR;
> -		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
> -		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
> -		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
> -	} else if (!strcmp(st, "fat")) {
> -		dfu->layout = DFU_FS_FAT;
> -	} else if (!strcmp(st, "ext4")) {
> -		dfu->layout = DFU_FS_EXT4;
> -	} else if (!strcmp(st, "part")) {
> +	const char *argv[3];
> +	const char **parg = argv;
> +	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
> +		*parg = strsep(&s, " ");
> +		if (*parg == NULL) {
> +			error("Invalid number of arguments.\n");
> +			return -ENODEV;
> +		}
> +	}
>  
> -		dfu->layout = DFU_RAW_ADDR;
> +	const char *entity_type = argv[0];
> +	/*
> +	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
> +	 * with default 10.
> +	 */
> +	size_t second_arg = simple_strtoul(argv[1], NULL, 0);
> +	size_t third_arg = simple_strtoul(argv[2], NULL, 0);
>  
> -		dev = simple_strtoul(s, &s, 10);
> -		s++;
> -		part = simple_strtoul(s, &s, 10);
> +	struct mmc *mmc = find_mmc_device(dfu->dev_num);
> +	if (mmc == NULL) {
> +		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
> +		return -ENODEV;
> +	}
>  
> -		mmc = find_mmc_device(dev);
> -		if (mmc == NULL || mmc_init(mmc)) {
> -			printf("%s: could not find mmc device #%d!\n",
> -			       __func__, dev);
> -			return -ENODEV;
> -		}
> +	if (mmc_init(mmc)) {
> +		error("Couldn't init MMC device.\n");
> +		return -ENODEV;
> +	}
>  
> -		blk_dev = &mmc->block_dev;
> -		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
> -			printf("%s: could not find partition #%d on mmc device #%d!\n",
> -			       __func__, part, dev);
> +	if (!strcmp(entity_type, "raw")) {
> +		dfu->layout			= DFU_RAW_ADDR;
> +		dfu->data.mmc.lba_start		= second_arg;
> +		dfu->data.mmc.lba_size		= third_arg;
> +		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
> +	} else if (!strcmp(entity_type, "part")) {
> +		disk_partition_t partinfo;
> +		block_dev_desc_t *blk_dev = &mmc->block_dev;
> +		int mmcdev = second_arg;
> +		int mmcpart = third_arg;
> +
> +		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
> +			error("Couldn't find part #%d on mmc device #%d\n",
> +			      mmcpart, mmcdev);
>  			return -ENODEV;
>  		}
>  
> -		dfu->data.mmc.lba_start = partinfo.start;
> -		dfu->data.mmc.lba_size = partinfo.size;
> -		dfu->data.mmc.lba_blk_size = partinfo.blksz;
> -
> +		dfu->layout			= DFU_RAW_ADDR;
> +		dfu->data.mmc.lba_start		= partinfo.start;
> +		dfu->data.mmc.lba_size		= partinfo.size;
> +		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
> +	} else if (!strcmp(entity_type, "fat")) {
> +		dfu->layout = DFU_FS_FAT;
> +	} else if (!strcmp(entity_type, "ext4")) {
> +		dfu->layout = DFU_FS_EXT4;
>  	} else {
> -		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
> +		error("Memory layout (%s) not supported!\n", entity_type);
>  		return -ENODEV;
>  	}
>  
> -	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
> -		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
> -		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
> +	/* if it's NOT a raw write */
> +	if (strcmp(entity_type, "raw")) {
> +		dfu->data.mmc.dev = second_arg;
> +		dfu->data.mmc.part = third_arg;
>  	}
>  
> +	dfu->dev_type = DFU_DEV_MMC;
>  	dfu->read_medium = dfu_read_medium_mmc;
>  	dfu->write_medium = dfu_write_medium_mmc;
>  	dfu->flush_medium = dfu_flush_medium_mmc;
> -
> -	/* initial state */
>  	dfu->inited = 0;
>  
>  	return 0;
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index e1461a9..f2fa230 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -15,6 +15,7 @@
>  #include <malloc.h>
>  #include <linux/list.h>
>  #include <div64.h>
> +#include <errno.h>
>  #include "mmc_private.h"
>  
>  /* Set block count limit because of 16 bit register limit on some hardware*/
> @@ -1266,17 +1267,23 @@ static int mmc_complete_init(struct mmc *mmc)
>  
>  int mmc_init(struct mmc *mmc)
>  {
> +	if (mmc->has_init)
> +		return 0;
> +
What difference before?

>  	int err = IN_PROGRESS;
>  	unsigned start = get_timer(0);
>  
> -	if (mmc->has_init)
> -		return 0;
>  	if (!mmc->init_in_progress)
>  		err = mmc_start_init(mmc);
> -
Need not to change.

>  	if (!err || err == IN_PROGRESS)
>  		err = mmc_complete_init(mmc);
> +
Ditto.

>  	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
> +
> +	if (!mmc->read_bl_len || !mmc->write_bl_len) {
> +		error("invalid block length\n");
> +		return -ENODEV;
> +	}
I know mmc->read_bl_len and write_bl_len is set at init time.
Why this condition needs?

>  	return err;
>  }
>  
> diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
> index 8af4d6a..d76962f 100644
> --- a/include/configs/am335x_evm.h
> +++ b/include/configs/am335x_evm.h
> @@ -312,10 +312,10 @@
>  	"boot part 0 1;" \
>  	"rootfs part 0 2;" \
>  	"MLO fat 0 1;" \
> -	"MLO.raw mmc 100 100;" \
> -	"u-boot.img.raw mmc 300 400;" \
> -	"spl-os-args.raw mmc 80 80;" \
> -	"spl-os-image.raw mmc 900 2000;" \
> +	"MLO.raw mmc 0x100 0x100;" \
> +	"u-boot.img.raw mmc 0x300 0x400;" \
> +	"spl-os-args.raw mmc 0x80 0x80;" \
> +	"spl-os-image.raw mmc 0x900 0x2000;" \
>  	"spl-os-args fat 0 1;" \
>  	"spl-os-image fat 0 1;" \
>  	"u-boot.img fat 0 1;" \
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 6cd15c2..ed3b278 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -140,7 +140,7 @@
>  	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>  
>  #define CONFIG_DFU_ALT \
> -	"u-boot mmc 80 400;" \
> +	"u-boot raw 0x80 0x400;" \
>  	"uImage ext4 0 2;" \
>  	"exynos4210-trats.dtb ext4 0 2;" \
>  	""PARTS_ROOT" part 0 5\0"
> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
> index 5d86a3d..a22be63 100644
> --- a/include/configs/trats2.h
> +++ b/include/configs/trats2.h
> @@ -169,7 +169,7 @@
>  	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>  
>  #define CONFIG_DFU_ALT \
> -	"u-boot mmc 80 800;" \
> +	"u-boot mmc 0x80 0x800;" \

u-boot mmc? u-boot raw? what's correct?

Best Regards,
Jaehoon Chung
>  	"uImage ext4 0 2;" \
>  	"exynos4412-trats2.dtb ext4 0 2;" \
>  	""PARTS_ROOT" part 0 5\0"
> diff --git a/include/dfu.h b/include/dfu.h
> index f973426..f2e83db 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -64,11 +64,6 @@ struct ram_internal_data {
>  	unsigned int	size;
>  };
>  
> -static inline unsigned int get_mmc_blk_size(int dev)
> -{
> -	return find_mmc_device(dev)->read_bl_len;
> -}
> -
>  #define DFU_NAME_SIZE			32
>  #define DFU_CMD_BUF_SIZE		128
>  #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
> 

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-01-10  5:08   ` Jaehoon Chung
  2014-01-13 14:39     ` Mateusz Zalega
  2014-01-13 10:16   ` Lukasz Majewski
  2014-01-14  0:49   ` Minkyu Kang
  2 siblings, 1 reply; 127+ messages in thread
From: Jaehoon Chung @ 2014-01-10  5:08 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  board/samsung/common/ums.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..0d8f30d 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>  
>  static struct ums *ums_disk_init(struct mmc *mmc)
>  {
> +	if (mmc_init(mmc))
> +		return NULL;
> +
>  	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>  	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;

-->	if (mmc_init(mmc))
		return NULL;

Locate this point.

Best Regards,
Jaehoon Chung
>  
> 

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

* [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API
  2014-01-09 14:31 ` [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-01-10  8:23   ` Lukasz Majewski
  2014-01-13  7:07     ` Heiko Schocher
  2014-01-13 10:16   ` Lukasz Majewski
  1 sibling, 1 reply; 127+ messages in thread
From: Lukasz Majewski @ 2014-01-10  8:23 UTC (permalink / raw)
  To: u-boot

Hi Heiko,

> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of {usb_function_name,
> bind_callback) pairs.

Could you test those g_dnl related patches?

You would probably need to apply the whole series for testing.

Thanks in advance.

Regards,
Lukasz

> 
> Change-Id: I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dc
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  common/cmd_dfu.c                    |  3 +-
>  common/cmd_thordown.c               |  3 +-
>  common/cmd_usb_mass_storage.c       |  2 +-
>  drivers/usb/gadget/f_dfu.c          | 11 ++++--
>  drivers/usb/gadget/f_mass_storage.c |  6 +++
>  drivers/usb/gadget/f_thor.c         |  5 +++
>  drivers/usb/gadget/g_dnl.c          | 74
> +++++++++++++++++--------------------
> include/dfu.h                       |  7 ----
> include/g_dnl.h                     | 11 ++++++
> include/thor.h                      |  8 ----
> include/usb_mass_storage.h          |  8 ---- 11 files changed, 66
> insertions(+), 72 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 5547678..a03538d 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	char *s = "dfu";
>  	int ret, i = 0;
>  
>  	ret = dfu_init_env_entities(interface,
> simple_strtoul(devstring, @@ -38,7 +37,7 @@ static int
> do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int
> controller_index = simple_strtoul(usb_controller, NULL, 0);
> board_usb_init(controller_index, USB_INIT_DEVICE); 
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
>  		if (dfu_reset())
>  			/*
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index c4b3511..2dd7509 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	const char *s = "thor";
>  	int ret;
>  
>  	puts("TIZEN \"THOR\" Downloader\n");
> @@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) goto exit;
>  	}
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_thor");
>  
>  	ret = thor_init();
>  	if (ret) {
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 99487f4..c8e152c 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	g_dnl_register("ums");
> +	g_dnl_register("usb_dnl_ums");
>  
>  	while (1) {
>  		usb_gadget_handle_interrupts();
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index a045864..cde1895 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -18,12 +18,14 @@
>  #include <errno.h>
>  #include <common.h>
>  #include <malloc.h>
> +#include <linker_lists.h>
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  
>  #include <dfu.h>
> +#include <g_dnl.h>
>  #include "f_dfu.h"
>  
>  struct f_dfu {
> @@ -768,9 +770,7 @@ static int dfu_bind_config(struct
> usb_configuration *c) 
>  int dfu_add(struct usb_configuration *c)
>  {
> -	int id;
> -
> -	id = usb_string_id(c->cdev);
> +	int id = usb_string_id(c->cdev);
>  	if (id < 0)
>  		return id;
>  	strings_dfu_generic[0].id = id;
> @@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
>  
>  	return dfu_bind_config(c);
>  }
> +
> +/* export dfu_add to g_dnl.o */
> +ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_dfu",
> +					  .fptr = dfu_add };
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index b1fe8bd..b7d03f2 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -243,6 +243,7 @@
>  #include <config.h>
>  #include <malloc.h>
>  #include <common.h>
> +#include <linker_lists.h>
>  #include <usb.h>
>  
>  #include <linux/err.h>
> @@ -255,6 +256,7 @@
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  #include <usb/lin_gadget_compat.h>
> +#include <g_dnl.h>
>  
>  /*------------------------------------------------------------------------*/
>  
> @@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
>  
>  	return 0;
>  }
> +
> +ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_ums",
> +					  .fptr = fsg_add };
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index c4c9909..3f428c8 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -17,6 +17,7 @@
>  
>  #include <errno.h>
>  #include <common.h>
> +#include <linker_lists.h>
>  #include <malloc.h>
>  #include <version.h>
>  #include <linux/usb/ch9.h>
> @@ -1001,3 +1002,7 @@ int thor_add(struct usb_configuration *c)
>  	debug("%s:\n", __func__);
>  	return thor_func_init(c);
>  }
> +
> +ll_entry_declare(struct g_dnl_bind_callback, thor_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_thor",
> +					  .fptr = thor_add };
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index dd95afe..00ace2c 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -41,7 +41,6 @@
>  
>  #define DRIVER_VERSION		"usb_dnl 2.0"
>  
> -static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
>  static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
> @@ -95,30 +94,38 @@ static int g_dnl_unbind(struct usb_composite_dev
> *cdev) 
>  	free(cdev->config);
>  	cdev->config = NULL;
> -	debug("%s: calling usb_gadget_disconnect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +	debug("%s: calling usb_gadget_disconnect for controller
> '%s'\n",
> +			__func__, gadget->name);
>  	usb_gadget_disconnect(gadget);
>  
>  	return 0;
>  }
>  
> +static inline struct g_dnl_bind_callback *
> g_dnl_first_bind_callback(void) +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback *
> g_dnl_last_bind_callback(void) +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
>  
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
> -	      __func__, c, c->cdev);
> -
> +			__func__, c, c->cdev);
>  	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +
> +	struct g_dnl_bind_callback *callback =
> g_dnl_first_bind_callback();
> +	for (; callback != g_dnl_last_bind_callback(); ++callback)
> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
>  
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +				__func__, gadget->name);
>  		device_desc.bcdDevice =
> __constant_cpu_to_le16(0x9999); }
>  
> -	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +	debug("%s: calling usb_gadget_connect for controller '%s'\n",
> +			__func__, gadget->name);
>  	usb_gadget_connect(gadget);
>  
>  	return 0;
> @@ -227,36 +234,21 @@ static struct usb_composite_driver g_dnl_driver
> = { .unbind = g_dnl_unbind,
>  };
>  
> -int g_dnl_register(const char *type)
> +/*
> + * NOTICE:
> + * Registering via USB function name won't be necessary after
> rewriting
> + * g_dnl to support multiple USB functions.
> + */
> +int g_dnl_register(const char *name)
>  {
> -	/* The largest function name is 4 */
> -	static char name[sizeof(shortname) + 4];
> -	int ret;
> -
> -	if (!strcmp(type, "dfu")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "ums")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "thor")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else {
> -		printf("%s: unknown command: %s\n", __func__, type);
> -		return -EINVAL;
> -	}
> -
> +	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
>  	g_dnl_driver.name = name;
>  
> -	debug("%s: g_dnl_driver.name: %s\n", __func__,
> g_dnl_driver.name);
> -	ret = usb_composite_register(&g_dnl_driver);
> -
> +	int ret = usb_composite_register(&g_dnl_driver);
>  	if (ret) {
> -		printf("%s: failed!, error: %d\n", __func__, ret);
> +		debug("%s: failed!, error: %d\n", __func__, ret);
>  		return ret;
>  	}
> -
>  	return 0;
>  }
>  
> diff --git a/include/dfu.h b/include/dfu.h
> index f2e83db..6fd75d0 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -164,12 +164,5 @@ static inline int dfu_fill_entity_ram(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_ */
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 8f813c2..4392f76 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -10,6 +10,17 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> +#include <linux/usb/composite.h>
> +
> +typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
> +
> +/* used in Gadget downloader callback linker list */
> +struct g_dnl_bind_callback
> +{
> +	const char *usb_function_name;
> +	g_dnl_bind_callback_f fptr;
> +};
> +
>  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> diff --git a/include/thor.h b/include/thor.h
> index afeade4..5051be7 100644
> --- a/include/thor.h
> +++ b/include/thor.h
> @@ -15,13 +15,5 @@
>  
>  int thor_handle(void);
>  int thor_init(void);
> -
> -#ifdef CONFIG_THOR_FUNCTION
>  int thor_add(struct usb_configuration *c);
> -#else
> -int thor_add(struct usb_configuration *c)
> -{
> -	return 0;
> -}
> -#endif
>  #endif /* __THOR_H_ */
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 9df3adc..6ee4f34 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -37,13 +37,5 @@ int fsg_init(struct ums *);
>  void fsg_cleanup(void);
>  struct ums *ums_init(unsigned int);
>  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] 127+ messages in thread

* [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API
  2014-01-10  8:23   ` Lukasz Majewski
@ 2014-01-13  7:07     ` Heiko Schocher
  0 siblings, 0 replies; 127+ messages in thread
From: Heiko Schocher @ 2014-01-13  7:07 UTC (permalink / raw)
  To: u-boot

Hello Lukasz,

Am 10.01.2014 09:23, schrieb Lukasz Majewski:
> Hi Heiko,
>
>> Preprocessor definitions and hardcoded implementation selection in
>> g_dnl core were replaced by a linker list made of {usb_function_name,
>> bind_callback) pairs.
>
> Could you test those g_dnl related patches?
>
> You would probably need to apply the whole series for testing.

I applied the hole series on current top of tree and tried dfu
download for the rootfs nand mtd partition on the siemens dxr2
board. Test looks good, so:

Tested-by: Heiko Schocher<hs@denx.de>

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API
  2014-01-09 14:31 ` [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
  2014-01-10  8:23   ` Lukasz Majewski
@ 2014-01-13 10:16   ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-01-13 10:16 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of {usb_function_name,
> bind_callback) pairs.


Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Tested at: Exynos4210 - TRATS.

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

> 
> Change-Id: I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dc
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  common/cmd_dfu.c                    |  3 +-
>  common/cmd_thordown.c               |  3 +-
>  common/cmd_usb_mass_storage.c       |  2 +-
>  drivers/usb/gadget/f_dfu.c          | 11 ++++--
>  drivers/usb/gadget/f_mass_storage.c |  6 +++
>  drivers/usb/gadget/f_thor.c         |  5 +++
>  drivers/usb/gadget/g_dnl.c          | 74
> +++++++++++++++++--------------------
> include/dfu.h                       |  7 ----
> include/g_dnl.h                     | 11 ++++++
> include/thor.h                      |  8 ----
> include/usb_mass_storage.h          |  8 ---- 11 files changed, 66
> insertions(+), 72 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 5547678..a03538d 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	char *s = "dfu";
>  	int ret, i = 0;
>  
>  	ret = dfu_init_env_entities(interface,
> simple_strtoul(devstring, @@ -38,7 +37,7 @@ static int
> do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int
> controller_index = simple_strtoul(usb_controller, NULL, 0);
> board_usb_init(controller_index, USB_INIT_DEVICE); 
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
>  		if (dfu_reset())
>  			/*
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index c4b3511..2dd7509 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	const char *s = "thor";
>  	int ret;
>  
>  	puts("TIZEN \"THOR\" Downloader\n");
> @@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) goto exit;
>  	}
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_thor");
>  
>  	ret = thor_init();
>  	if (ret) {
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 99487f4..c8e152c 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	g_dnl_register("ums");
> +	g_dnl_register("usb_dnl_ums");
>  
>  	while (1) {
>  		usb_gadget_handle_interrupts();
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index a045864..cde1895 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -18,12 +18,14 @@
>  #include <errno.h>
>  #include <common.h>
>  #include <malloc.h>
> +#include <linker_lists.h>
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  
>  #include <dfu.h>
> +#include <g_dnl.h>
>  #include "f_dfu.h"
>  
>  struct f_dfu {
> @@ -768,9 +770,7 @@ static int dfu_bind_config(struct
> usb_configuration *c) 
>  int dfu_add(struct usb_configuration *c)
>  {
> -	int id;
> -
> -	id = usb_string_id(c->cdev);
> +	int id = usb_string_id(c->cdev);
>  	if (id < 0)
>  		return id;
>  	strings_dfu_generic[0].id = id;
> @@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
>  
>  	return dfu_bind_config(c);
>  }
> +
> +/* export dfu_add to g_dnl.o */
> +ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_dfu",
> +					  .fptr = dfu_add };
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index b1fe8bd..b7d03f2 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -243,6 +243,7 @@
>  #include <config.h>
>  #include <malloc.h>
>  #include <common.h>
> +#include <linker_lists.h>
>  #include <usb.h>
>  
>  #include <linux/err.h>
> @@ -255,6 +256,7 @@
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  #include <usb/lin_gadget_compat.h>
> +#include <g_dnl.h>
>  
>  /*------------------------------------------------------------------------*/
>  
> @@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
>  
>  	return 0;
>  }
> +
> +ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_ums",
> +					  .fptr = fsg_add };
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index c4c9909..3f428c8 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -17,6 +17,7 @@
>  
>  #include <errno.h>
>  #include <common.h>
> +#include <linker_lists.h>
>  #include <malloc.h>
>  #include <version.h>
>  #include <linux/usb/ch9.h>
> @@ -1001,3 +1002,7 @@ int thor_add(struct usb_configuration *c)
>  	debug("%s:\n", __func__);
>  	return thor_func_init(c);
>  }
> +
> +ll_entry_declare(struct g_dnl_bind_callback, thor_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name =
> "usb_dnl_thor",
> +					  .fptr = thor_add };
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index dd95afe..00ace2c 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -41,7 +41,6 @@
>  
>  #define DRIVER_VERSION		"usb_dnl 2.0"
>  
> -static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
>  static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
> @@ -95,30 +94,38 @@ static int g_dnl_unbind(struct usb_composite_dev
> *cdev) 
>  	free(cdev->config);
>  	cdev->config = NULL;
> -	debug("%s: calling usb_gadget_disconnect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +	debug("%s: calling usb_gadget_disconnect for controller
> '%s'\n",
> +			__func__, gadget->name);
>  	usb_gadget_disconnect(gadget);
>  
>  	return 0;
>  }
>  
> +static inline struct g_dnl_bind_callback *
> g_dnl_first_bind_callback(void) +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback *
> g_dnl_last_bind_callback(void) +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
>  
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
> -	      __func__, c, c->cdev);
> -
> +			__func__, c, c->cdev);
>  	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +
> +	struct g_dnl_bind_callback *callback =
> g_dnl_first_bind_callback();
> +	for (; callback != g_dnl_last_bind_callback(); ++callback)
> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
>  
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +				__func__, gadget->name);
>  		device_desc.bcdDevice =
> __constant_cpu_to_le16(0x9999); }
>  
> -	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +	debug("%s: calling usb_gadget_connect for controller '%s'\n",
> +			__func__, gadget->name);
>  	usb_gadget_connect(gadget);
>  
>  	return 0;
> @@ -227,36 +234,21 @@ static struct usb_composite_driver g_dnl_driver
> = { .unbind = g_dnl_unbind,
>  };
>  
> -int g_dnl_register(const char *type)
> +/*
> + * NOTICE:
> + * Registering via USB function name won't be necessary after
> rewriting
> + * g_dnl to support multiple USB functions.
> + */
> +int g_dnl_register(const char *name)
>  {
> -	/* The largest function name is 4 */
> -	static char name[sizeof(shortname) + 4];
> -	int ret;
> -
> -	if (!strcmp(type, "dfu")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "ums")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "thor")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else {
> -		printf("%s: unknown command: %s\n", __func__, type);
> -		return -EINVAL;
> -	}
> -
> +	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
>  	g_dnl_driver.name = name;
>  
> -	debug("%s: g_dnl_driver.name: %s\n", __func__,
> g_dnl_driver.name);
> -	ret = usb_composite_register(&g_dnl_driver);
> -
> +	int ret = usb_composite_register(&g_dnl_driver);
>  	if (ret) {
> -		printf("%s: failed!, error: %d\n", __func__, ret);
> +		debug("%s: failed!, error: %d\n", __func__, ret);
>  		return ret;
>  	}
> -
>  	return 0;
>  }
>  
> diff --git a/include/dfu.h b/include/dfu.h
> index f2e83db..6fd75d0 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -164,12 +164,5 @@ static inline int dfu_fill_entity_ram(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_ */
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 8f813c2..4392f76 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -10,6 +10,17 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> +#include <linux/usb/composite.h>
> +
> +typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
> +
> +/* used in Gadget downloader callback linker list */
> +struct g_dnl_bind_callback
> +{
> +	const char *usb_function_name;
> +	g_dnl_bind_callback_f fptr;
> +};
> +
>  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> diff --git a/include/thor.h b/include/thor.h
> index afeade4..5051be7 100644
> --- a/include/thor.h
> +++ b/include/thor.h
> @@ -15,13 +15,5 @@
>  
>  int thor_handle(void);
>  int thor_init(void);
> -
> -#ifdef CONFIG_THOR_FUNCTION
>  int thor_add(struct usb_configuration *c);
> -#else
> -int thor_add(struct usb_configuration *c)
> -{
> -	return 0;
> -}
> -#endif
>  #endif /* __THOR_H_ */
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 9df3adc..6ee4f34 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -37,13 +37,5 @@ int fsg_init(struct ums *);
>  void fsg_cleanup(void);
>  struct ums *ums_init(unsigned int);
>  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] 127+ messages in thread

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  2014-01-10  5:08   ` Jaehoon Chung
@ 2014-01-13 10:16   ` Lukasz Majewski
  2014-01-14  0:49   ` Minkyu Kang
  2 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-01-13 10:16 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  board/samsung/common/ums.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..0d8f30d 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>  
>  static struct ums *ums_disk_init(struct mmc *mmc)
>  {
> +	if (mmc_init(mmc))
> +		return NULL;
> +
>  	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>  	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
>  

Tested-by: Lukasz Majewski <l.majewski@samsung.com>

Tested at: Exynos4210 - TRATS.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix
  2014-01-10  5:03   ` Jaehoon Chung
@ 2014-01-13 13:34     ` Mateusz Zalega
  0 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-13 13:34 UTC (permalink / raw)
  To: u-boot

On 01/10/14 06:03, Jaehoon Chung wrote:
> This patch should be separated with dfu and mmc.

ACK, because we're going to remove the bl_len assertion, see below.

> On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
>> When user attempted to perform a raw write using DFU (vide
>> dfu_fill_entity_mmc) with MMC interface not initialized before,
>> get_mmc_blk_size() reported invalid (zero) block size - it wasn't
>> possible to write ie. a new u-boot image.
>>
>> This commit fixes that by initializing device in get_mmc_blk_size() when
>> needed.
>>
>> Tested on Samsung Goni.
>>
>> v2 changes:
>> - code cleanup
>> - minor dfu_alt_info format change
>>
>> v3 changes:
>> - moved invalid block length check to mmc core
>> - removed redundant 'has_init' check
>>
>> Change-Id: Icb50bb9f805a9a78848acd19f682fad474cb9082
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>>  drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
>>  drivers/mmc/mmc.c            |  13 ++++--
>>  include/configs/am335x_evm.h |   8 ++--
>>  include/configs/trats.h      |   2 +-
>>  include/configs/trats2.h     |   2 +-
>>  include/dfu.h                |   5 --
>>  6 files changed, 80 insertions(+), 56 deletions(-)
>>
>> diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
(...)
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index e1461a9..f2fa230 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -15,6 +15,7 @@
>>  #include <malloc.h>
>>  #include <linux/list.h>
>>  #include <div64.h>
>> +#include <errno.h>
>>  #include "mmc_private.h"
>>  
>>  /* Set block count limit because of 16 bit register limit on some hardware*/
>> @@ -1266,17 +1267,23 @@ static int mmc_complete_init(struct mmc *mmc)
>>  
>>  int mmc_init(struct mmc *mmc)
>>  {
>> +	if (mmc->has_init)
>> +		return 0;
>> +
> What difference before?

It doesn't have to go through get_timer(). The effect, although
negligible, saves some cycles.

>>  	int err = IN_PROGRESS;
>>  	unsigned start = get_timer(0);
>>  
>> -	if (mmc->has_init)
>> -		return 0;
>>  	if (!mmc->init_in_progress)
>>  		err = mmc_start_init(mmc);
>> -
> Need not to change.
> 
>>  	if (!err || err == IN_PROGRESS)
>>  		err = mmc_complete_init(mmc);
>> +
> Ditto.

NAK, it improves code readability.

>>  	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
>> +
>> +	if (!mmc->read_bl_len || !mmc->write_bl_len) {
>> +		error("invalid block length\n");
>> +		return -ENODEV;
>> +	}
> I know mmc->read_bl_len and write_bl_len is set at init time.
> Why this condition needs?

I added it as a countermeasure after fixing the bug and mistook its
purpose when writing a late update to this patch, my bad.

Given the circumstances it might be a sound assertion, but we shouldn't
clobber the codebase that we aim to optimize for size, should we.

ACK, will remove.

>>  	return err;
>>  }
>>  
>> diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
>> index 8af4d6a..d76962f 100644
>> --- a/include/configs/am335x_evm.h
>> +++ b/include/configs/am335x_evm.h
>> @@ -312,10 +312,10 @@
>>  	"boot part 0 1;" \
>>  	"rootfs part 0 2;" \
>>  	"MLO fat 0 1;" \
>> -	"MLO.raw mmc 100 100;" \
>> -	"u-boot.img.raw mmc 300 400;" \
>> -	"spl-os-args.raw mmc 80 80;" \
>> -	"spl-os-image.raw mmc 900 2000;" \
>> +	"MLO.raw mmc 0x100 0x100;" \
>> +	"u-boot.img.raw mmc 0x300 0x400;" \
>> +	"spl-os-args.raw mmc 0x80 0x80;" \
>> +	"spl-os-image.raw mmc 0x900 0x2000;" \
>>  	"spl-os-args fat 0 1;" \
>>  	"spl-os-image fat 0 1;" \
>>  	"u-boot.img fat 0 1;" \
>> diff --git a/include/configs/trats.h b/include/configs/trats.h
>> index 6cd15c2..ed3b278 100644
>> --- a/include/configs/trats.h
>> +++ b/include/configs/trats.h
>> @@ -140,7 +140,7 @@
>>  	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>>  
>>  #define CONFIG_DFU_ALT \
>> -	"u-boot mmc 80 400;" \
>> +	"u-boot raw 0x80 0x400;" \
>>  	"uImage ext4 0 2;" \
>>  	"exynos4210-trats.dtb ext4 0 2;" \
>>  	""PARTS_ROOT" part 0 5\0"
>> diff --git a/include/configs/trats2.h b/include/configs/trats2.h
>> index 5d86a3d..a22be63 100644
>> --- a/include/configs/trats2.h
>> +++ b/include/configs/trats2.h
>> @@ -169,7 +169,7 @@
>>  	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>>  
>>  #define CONFIG_DFU_ALT \
>> -	"u-boot mmc 80 800;" \
>> +	"u-boot mmc 0x80 0x800;" \
> 
> u-boot mmc? u-boot raw? what's correct?

raw - ACK

>>  	"uImage ext4 0 2;" \
>>  	"exynos4412-trats2.dtb ext4 0 2;" \
>>  	""PARTS_ROOT" part 0 5\0"
>> diff --git a/include/dfu.h b/include/dfu.h
>> index f973426..f2e83db 100644
>> --- a/include/dfu.h
>> +++ b/include/dfu.h
>> @@ -64,11 +64,6 @@ struct ram_internal_data {
>>  	unsigned int	size;
>>  };
>>  
>> -static inline unsigned int get_mmc_blk_size(int dev)
>> -{
>> -	return find_mmc_device(dev)->read_bl_len;
>> -}
>> -
>>  #define DFU_NAME_SIZE			32
>>  #define DFU_CMD_BUF_SIZE		128
>>  #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
>>
> 
> 


-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-10  5:08   ` Jaehoon Chung
@ 2014-01-13 14:39     ` Mateusz Zalega
  2014-01-13 14:43       ` Michael Trimarchi
  0 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-13 14:39 UTC (permalink / raw)
  To: u-boot

On 01/10/14 06:08, Jaehoon Chung wrote:
>> index dc155ad..0d8f30d 100644
>> --- a/board/samsung/common/ums.c
>> +++ b/board/samsung/common/ums.c
>> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>>  
>>  static struct ums *ums_disk_init(struct mmc *mmc)
>>  {
>> +	if (mmc_init(mmc))
>> +		return NULL;
>> +
>>  	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>>  	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
> 
> -->	if (mmc_init(mmc))
> 		return NULL;
> 
> Locate this point.

If you're asking to put this if() block after variable declaration, NAK.

It's perfectly fine C99 code. I'm not aware of any existing U-Boot style
guidelines that would forbid me to leave it this way.

These variables are only meaningful when mmc_init() returns a valid pointer.

Regards,
-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-13 14:39     ` Mateusz Zalega
@ 2014-01-13 14:43       ` Michael Trimarchi
  2014-01-13 15:00         ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Michael Trimarchi @ 2014-01-13 14:43 UTC (permalink / raw)
  To: u-boot

Hi

On Mon, Jan 13, 2014 at 3:39 PM, Mateusz Zalega <m.zalega@samsung.com> wrote:
> On 01/10/14 06:08, Jaehoon Chung wrote:
>>> index dc155ad..0d8f30d 100644
>>> --- a/board/samsung/common/ums.c
>>> +++ b/board/samsung/common/ums.c
>>> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>>>
>>>  static struct ums *ums_disk_init(struct mmc *mmc)
>>>  {
>>> +    if (mmc_init(mmc))
>>> +            return NULL;
>>> +
>>>      uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>>>      uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
>>
>> -->   if (mmc_init(mmc))
>>               return NULL;
>>
>> Locate this point.
>
> If you're asking to put this if() block after variable declaration, NAK.
>

I don't understand your point

> It's perfectly fine C99 code. I'm not aware of any existing U-Boot style
> guidelines that would forbid me to leave it this way.
>
> These variables are only meaningful when mmc_init() returns a valid pointer.
>

http://www.denx.de/wiki/U-Boot/CodingStyle

Michael

> Regards,
> --
> Mateusz Zalega
> Samsung R&D Institute Poland
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

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

* [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target
  2014-01-10  4:55   ` Jaehoon Chung
@ 2014-01-13 14:45     ` Mateusz Zalega
  0 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-13 14:45 UTC (permalink / raw)
  To: u-boot

On 01/10/14 05:55, Jaehoon Chung wrote:
> On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
>> Proper adjustment for supporting DFU at GONI target has been made.
>> The s5p_goni.h file has been updated. Moreover, the code for low level
>> USB initialization has been added to Goni board code.
>>
>> The malloc pool has been enlarged in order to support larger buffer
>> sizes needed by DFU implementation.
>>
>> Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
>> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>>  board/samsung/goni/goni.c  | 10 +++++++++
>>  include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
>>  2 files changed, 53 insertions(+), 11 deletions(-)
>>
>> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
>> index 366f648..5498daa 100644
>> --- a/board/samsung/goni/goni.c
>> +++ b/board/samsung/goni/goni.c
>> @@ -13,6 +13,9 @@
>>  #include <usb/s3c_udc.h>
>>  #include <asm/arch/cpu.h>
>>  #include <power/max8998_pmic.h>
>> +#include <usb.h>
>> +#include <usb_mass_storage.h>
>> +
>>  DECLARE_GLOBAL_DATA_PTR;
>>  
>>  static struct s5pc110_gpio *s5pc110_gpio;
>> @@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
>>  	.regs_otg = S5PC110_OTG_BASE,
>>  	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
>>  };
>> +
>> +int board_usb_init(int index, enum usb_init_type init)
>> +{
>> +	debug("USB_udc_probe\n");
>> +	s3c_udc_probe(&s5pc110_otg_data);
>> +	return 0;
> Always return 0? return s3c_udc_probe(&s5pc110_otg_data);

ACK, will fix.

>> +}
>>  #endif
>> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
>> index 1d2dcc0..24a0fcc 100644
>> --- a/include/configs/s5p_goni.h
>> +++ b/include/configs/s5p_goni.h
>> @@ -39,7 +39,7 @@
>>  #define CONFIG_CMDLINE_EDITING
>>  
>>  /* Size of malloc() pool.*/
>> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
>> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
>>  
>>  /*
>>   * select serial console configuration
>> @@ -70,14 +70,18 @@
>>  #define CONFIG_CMD_CACHE
>>  #define CONFIG_CMD_REGINFO
>>  #define CONFIG_CMD_ONENAND
>> -#define CONFIG_CMD_MTDPARTS
>>  #define CONFIG_CMD_MMC
>> +#define CONFIG_CMD_DFU
>>  
>> -#define CONFIG_BOOTDELAY		1
>> -#define CONFIG_ZERO_BOOTDELAY_CHECK
>> +/* USB Composite download gadget - g_dnl */
>> +#define CONFIG_USBDOWNLOAD_GADGET
>> +#define CONFIG_DFU_FUNCTION
>> +#define CONFIG_DFU_MMC
>>  
>> -#define CONFIG_MTD_DEVICE
>> -#define CONFIG_MTD_PARTITIONS
>> +/* USB Samsung's IDs */
>> +#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
>> +#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
>> +#define CONFIG_G_DNL_MANUFACTURER "Samsung"
>>  
>>  /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
>>  #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
>> @@ -90,7 +94,34 @@
>>  				",12m(modem)"\
>>  				",60m(qboot)\0"
>>  
>> -#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
>> +#define CONFIG_BOOTDELAY		1
>> +#define CONFIG_ZERO_BOOTDELAY_CHECK
>> +
>> +/* partitions definitions */
>> +#define PARTS_CSA			"csa-mmc"
>> +#define PARTS_BOOTLOADER	"u-boot"
>> +#define PARTS_BOOT			"boot"
>> +#define PARTS_ROOT			"platform"
>> +#define PARTS_DATA			"data"
>> +#define PARTS_CSC			"csc"
>> +#define PARTS_UMS			"ums"
>> +
>> +#define CONFIG_DFU_ALT \
>> +	"u-boot raw 0x80 0x400;" \
>> +	"uImage ext4 0 2;" \
>> +	"exynos3-goni.dtb ext4 0 2;" \
> exynos3-goni.dtb?

Correct. It's a DFU entry for the relevant devicetree blob.

(...)

Regards,
-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-13 14:43       ` Michael Trimarchi
@ 2014-01-13 15:00         ` Mateusz Zalega
  0 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-13 15:00 UTC (permalink / raw)
  To: u-boot

On 01/13/14 15:43, Michael Trimarchi wrote:
> On Mon, Jan 13, 2014 at 3:39 PM, Mateusz Zalega <m.zalega@samsung.com> wrote:
>> On 01/10/14 06:08, Jaehoon Chung wrote:
>>>> index dc155ad..0d8f30d 100644
>>>> --- a/board/samsung/common/ums.c
>>>> +++ b/board/samsung/common/ums.c
>>>> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>>>>
>>>>  static struct ums *ums_disk_init(struct mmc *mmc)
>>>>  {
>>>> +    if (mmc_init(mmc))
>>>> +            return NULL;
>>>> +
>>>>      uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>>>>      uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
>>>
>>> -->   if (mmc_init(mmc))
>>>               return NULL;
>>>
>>> Locate this point.
>>
>> If you're asking to put this if() block after variable declaration, NAK.
>>
> 
> I don't understand your point
> 
>> It's perfectly fine C99 code. I'm not aware of any existing U-Boot style
>> guidelines that would forbid me to leave it this way.
>>
>> These variables are only meaningful when mmc_init() returns a valid pointer.
>>
> 
> http://www.denx.de/wiki/U-Boot/CodingStyle
> 
> Michael

touch?

OK, I'll move declarations to the beginning of the closure, C89 style.

Thanks,
-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  2014-01-10  5:08   ` Jaehoon Chung
  2014-01-13 10:16   ` Lukasz Majewski
@ 2014-01-14  0:49   ` Minkyu Kang
  2014-01-14 10:55     ` Mateusz Zalega
  2 siblings, 1 reply; 127+ messages in thread
From: Minkyu Kang @ 2014-01-14  0:49 UTC (permalink / raw)
  To: u-boot

On 09/01/14 23:31, Mateusz Zalega wrote:
> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  board/samsung/common/ums.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..0d8f30d 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>  
>  static struct ums *ums_disk_init(struct mmc *mmc)
>  {
> +	if (mmc_init(mmc))
> +		return NULL;
> +
>  	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>  	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
>  
> 

Why don't you init the mmc before call this function?

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..7017c2a 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -72,5 +72,8 @@ struct ums *ums_init(unsigned int dev_num)
        if (!mmc)
                return NULL;
 
+       if (mmc_init(mmc))
+               return NULL;
+
        return ums_disk_init(mmc);
 }

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init()
  2014-01-14  0:49   ` Minkyu Kang
@ 2014-01-14 10:55     ` Mateusz Zalega
  0 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-01-14 10:55 UTC (permalink / raw)
  To: u-boot

On 01/14/14 01:49, Minkyu Kang wrote:
> On 09/01/14 23:31, Mateusz Zalega wrote:
>> In some cases MMC was still uninitialized while media capacity check,
>> leading to broken ums command.
>>
>> Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> Cc: Kyungmin Park <kyungmin.park@samsung.com>
>> ---
>>  board/samsung/common/ums.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
>> index dc155ad..0d8f30d 100644
>> --- a/board/samsung/common/ums.c
>> +++ b/board/samsung/common/ums.c
>> @@ -37,6 +37,9 @@ static struct ums ums_dev = {
>>  
>>  static struct ums *ums_disk_init(struct mmc *mmc)
>>  {
>> +	if (mmc_init(mmc))
>> +		return NULL;
>> +
>>  	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
>>  	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
>>  
>>
> 
> Why don't you init the mmc before call this function?
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..7017c2a 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -72,5 +72,8 @@ struct ums *ums_init(unsigned int dev_num)
>         if (!mmc)
>                 return NULL;
>  
> +       if (mmc_init(mmc))
> +               return NULL;
> +
>         return ums_disk_init(mmc);
>  }

I agree, ACK.

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v2 00/12] Series v2.
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (8 preceding siblings ...)
  2014-01-10  4:46 ` [U-Boot] [PATCH 1/9] mmc: mmc header fix Jaehoon Chung
@ 2014-02-04 17:02 ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 01/12] mmc: mmc header fix Mateusz Zalega
                     ` (11 more replies)
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                   ` (2 subsequent siblings)
  12 siblings, 12 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

This is an updated version of patch series regarding DFU, MMC, USB Gadget and
Samsung Goni board, originally sent on 10 January 2014.

---
Changes since v1:
- reordered
  "USB: gadget: added a saner gadget downloader registration API"
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
---

Mateusz Zalega (12):
  mmc: mmc header fix
  part: header fix
  arm:goni: Update configuration for goni target
  dfu: fix boards wo USB cable detection
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm:goni:dfu Add support for DFU to Goni target
  arm:goni: enable GPT command
  arm:goni: enable USB Mass Storage
  dfu:mmc: raw data write fix
  mmc: postponed needless timer initialization
  ums: always initialize mmc before ums_disk_init()

 board/samsung/common/ums.c          |  12 ++--
 board/samsung/goni/goni.c           |   9 +++
 common/cmd_dfu.c                    |   3 +-
 common/cmd_thordown.c               |   3 +-
 common/cmd_usb_mass_storage.c       |   4 +-
 drivers/dfu/dfu_mmc.c               | 106 +++++++++++++++++++--------------
 drivers/mmc/mmc.c                   |   7 ++-
 drivers/usb/gadget/f_dfu.c          |  11 +++-
 drivers/usb/gadget/f_mass_storage.c |   6 ++
 drivers/usb/gadget/f_thor.c         |   5 ++
 drivers/usb/gadget/g_dnl.c          |  74 +++++++++++------------
 include/configs/am335x_evm.h        |  10 ++--
 include/configs/s5p_goni.h          | 113 +++++++++++++++++++++++++-----------
 include/configs/trats.h             |   2 +-
 include/configs/trats2.h            |   2 +-
 include/dfu.h                       |  12 ----
 include/g_dnl.h                     |  11 ++++
 include/mmc.h                       |   1 +
 include/part.h                      |   1 +
 include/thor.h                      |   8 ---
 include/usb_mass_storage.h          |   8 ---
 21 files changed, 239 insertions(+), 169 deletions(-)

-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 01/12] mmc: mmc header fix
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 02/12] part: " Mateusz Zalega
                     ` (10 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Tom Rini <trini@ti.com>
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index e1060b9..64b9be9 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/compiler.h>
+#include <part.h>
 
 #define SD_VERSION_SD	0x20000
 #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 02/12] part: header fix
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 01/12] mmc: mmc header fix Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 03/12] arm:goni: Update configuration for goni target Mateusz Zalega
                     ` (9 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Change-Id: Iafdd4f1997767e9eb84d583fd32c79c8c4d43afd
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Tom Rini <trini@ti.com>
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include <ide.h>
+#include <common.h>
 
 typedef struct block_dev_desc {
 	int		if_type;	/* type of the interface */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 03/12] arm:goni: Update configuration for goni target
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 01/12] mmc: mmc header fix Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 02/12] part: " Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection Mateusz Zalega
                     ` (8 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Change-Id: I00e55bc970512986f50b1f943021ba9de683795e
Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 0590d20..1d2dcc0 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110		1	/* which is in a S5PC110 */
 #define CONFIG_MACH_GONI	1	/* working with Goni */
 
+#include <asm/sizes.h>
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -37,11 +38,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x100000, 0x100000 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -89,30 +88,25 @@
 				",7m(kernel)"\
 				",1m(log)"\
 				",12m(modem)"\
-				",60m(qboot)"\
-				",-(UBI)\0"
+				",60m(qboot)\0"
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND	"run ubifsboot"
+#define CONFIG_BOOTCOMMAND	"run mmcboot"
 
 #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
 
-#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext2" \
+#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \
 		" ${console} ${meminfo}"
 
 #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
 
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 ubi.mtd=6" \
-		" rootfstype=cramfs " CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4 " \
+			CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
 			" onenand write 0x32008000 0x0 0x100000\0"
 
-#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6"
-
-#define CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc"
-
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 #define CONFIG_EXTRA_ENV_SETTINGS					\
@@ -124,36 +118,38 @@
 		"onenand erase 0x01560000 0x1eaa0000;" \
 		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
 	"bootk=" \
-		"onenand read 0x30007FC0 0xc00000 0x600000;" \
+		"run loaduimage;" \
 		"bootm 0x30007FC0\0" \
 	"flashboot=" \
 		"set bootargs root=/dev/mtdblock${bootblock} " \
-		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts} " \
+		"rootfstype=${rootfstype} ${opts} " \
 		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
 	"ubifsboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"tftpboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
-		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
-		"bootm 0x30007FC0\0" \
+		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
 	"ramboot=" \
 		"set bootargs " CONFIG_RAMDISK_BOOT \
-		" initrd=0x33000000,8M ramdisk=8192\0" \
+		"initrd=0x33000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
-		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
 	"verify=n\0" \
-	"rootfstype=cramfs\0" \
+	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
 	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M@0x50000000\0" \
-	"mmcblk=/dev/mmcblk1p1\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"mmcdev=0\0" \
+	"mmcbootpart=2\0" \
+	"mmcrootpart=5\0" \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
@@ -196,6 +192,13 @@
 
 #define CONFIG_DOS_PARTITION		1
 
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+
+/* write support for filesystems */
+#define CONFIG_FAT_WRITE
+#define CONFIG_EXT4_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
@@ -220,5 +223,6 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
 
 #endif	/* __CONFIG_H */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (2 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 03/12] arm:goni: Update configuration for goni target Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-22  5:06     ` Marek Vasut
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 05/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..5175bd5 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
+#ifdef CONFIG_USB_CABLE_CHECK
 	if (!usb_cable_connected()) {
 		puts("Please connect USB cable.\n");
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		}
 		puts("\r\n");
 	}
+#endif
 
 	while (1) {
 		usb_gadget_handle_interrupts();
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 05/12] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (3 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
                     ` (6 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 73a9adb..4f89556 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -302,6 +302,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -344,6 +345,7 @@
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (4 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 05/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-05  7:13     ` Marek Vasut
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 07/12] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
                     ` (5 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes since v1:
- reordered
---
 common/cmd_dfu.c                    |  3 +-
 common/cmd_thordown.c               |  3 +-
 common/cmd_usb_mass_storage.c       |  2 +-
 drivers/usb/gadget/f_dfu.c          | 11 ++++--
 drivers/usb/gadget/f_mass_storage.c |  6 +++
 drivers/usb/gadget/f_thor.c         |  5 +++
 drivers/usb/gadget/g_dnl.c          | 74 +++++++++++++++++--------------------
 include/dfu.h                       |  7 ----
 include/g_dnl.h                     | 11 ++++++
 include/thor.h                      |  8 ----
 include/usb_mass_storage.h          |  8 ----
 11 files changed, 66 insertions(+), 72 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	char *s = "dfu";
 	int ret, i = 0;
 
 	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	board_usb_init(controller_index, USB_INIT_DEVICE);
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_dfu");
 	while (1) {
 		if (dfu_reset())
 			/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	const char *s = "thor";
 	int ret;
 
 	puts("TIZEN \"THOR\" Downloader\n");
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto exit;
 	}
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_thor");
 
 	ret = thor_init();
 	if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5175bd5..4c2de48 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	g_dnl_register("ums");
+	g_dnl_register("usb_dnl_ums");
 
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..cde1895 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -18,12 +18,14 @@
 #include <errno.h>
 #include <common.h>
 #include <malloc.h>
+#include <linker_lists.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 
 #include <dfu.h>
+#include <g_dnl.h>
 #include "f_dfu.h"
 
 struct f_dfu {
@@ -768,9 +770,7 @@ static int dfu_bind_config(struct usb_configuration *c)
 
 int dfu_add(struct usb_configuration *c)
 {
-	int id;
-
-	id = usb_string_id(c->cdev);
+	int id = usb_string_id(c->cdev);
 	if (id < 0)
 		return id;
 	strings_dfu_generic[0].id = id;
@@ -781,3 +781,8 @@ int dfu_add(struct usb_configuration *c)
 
 	return dfu_bind_config(c);
 }
+
+/* export dfu_add to g_dnl.o */
+ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_dfu",
+					  .fptr = dfu_add };
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index b1fe8bd..b7d03f2 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -243,6 +243,7 @@
 #include <config.h>
 #include <malloc.h>
 #include <common.h>
+#include <linker_lists.h>
 #include <usb.h>
 
 #include <linux/err.h>
@@ -255,6 +256,7 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <usb/lin_gadget_compat.h>
+#include <g_dnl.h>
 
 /*------------------------------------------------------------------------*/
 
@@ -2778,3 +2780,7 @@ int fsg_init(struct ums *ums_dev)
 
 	return 0;
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, fsg_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_ums",
+					  .fptr = fsg_add };
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index c4c9909..3f428c8 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -17,6 +17,7 @@
 
 #include <errno.h>
 #include <common.h>
+#include <linker_lists.h>
 #include <malloc.h>
 #include <version.h>
 #include <linux/usb/ch9.h>
@@ -1001,3 +1002,7 @@ int thor_add(struct usb_configuration *c)
 	debug("%s:\n", __func__);
 	return thor_func_init(c);
 }
+
+ll_entry_declare(struct g_dnl_bind_callback, thor_bind_callback,
+		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_thor",
+					  .fptr = thor_add };
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..00ace2c 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
-static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -95,30 +94,38 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
 
 	free(cdev->config);
 	cdev->config = NULL;
-	debug("%s: calling usb_gadget_disconnect for "
-			"controller '%s'\n", shortname, gadget->name);
+	debug("%s: calling usb_gadget_disconnect for controller '%s'\n",
+			__func__, gadget->name);
 	usb_gadget_disconnect(gadget);
 
 	return 0;
 }
 
+static inline struct g_dnl_bind_callback * g_dnl_first_bind_callback(void)
+{
+	return ll_entry_start(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
+static inline struct g_dnl_bind_callback * g_dnl_last_bind_callback(void)
+{
+	return ll_entry_end(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
 static int g_dnl_do_config(struct usb_configuration *c)
 {
 	const char *s = c->cdev->driver->name;
-	int ret = -1;
 
 	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
-	      __func__, c, c->cdev);
-
+			__func__, c, c->cdev);
 	printf("GADGET DRIVER: %s\n", s);
-	if (!strcmp(s, "usb_dnl_dfu"))
-		ret = dfu_add(c);
-	else if (!strcmp(s, "usb_dnl_ums"))
-		ret = fsg_add(c);
-	else if (!strcmp(s, "usb_dnl_thor"))
-		ret = thor_add(c);
-
-	return ret;
+
+	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
+	for (; callback != g_dnl_last_bind_callback(); ++callback)
+		if (!strcmp(s, callback->usb_function_name))
+			return callback->fptr(c);
+	return -ENODEV;
 }
 
 static int g_dnl_config_register(struct usb_composite_dev *cdev)
@@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
-			shortname, gadget->name);
+				__func__, gadget->name);
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
-	debug("%s: calling usb_gadget_connect for "
-			"controller '%s'\n", shortname, gadget->name);
+	debug("%s: calling usb_gadget_connect for controller '%s'\n",
+			__func__, gadget->name);
 	usb_gadget_connect(gadget);
 
 	return 0;
@@ -227,36 +234,21 @@ static struct usb_composite_driver g_dnl_driver = {
 	.unbind = g_dnl_unbind,
 };
 
-int g_dnl_register(const char *type)
+/*
+ * NOTICE:
+ * Registering via USB function name won't be necessary after rewriting
+ * g_dnl to support multiple USB functions.
+ */
+int g_dnl_register(const char *name)
 {
-	/* The largest function name is 4 */
-	static char name[sizeof(shortname) + 4];
-	int ret;
-
-	if (!strcmp(type, "dfu")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "ums")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "thor")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else {
-		printf("%s: unknown command: %s\n", __func__, type);
-		return -EINVAL;
-	}
-
+	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
-	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
-	ret = usb_composite_register(&g_dnl_driver);
-
+	int ret = usb_composite_register(&g_dnl_driver);
 	if (ret) {
-		printf("%s: failed!, error: %d\n", __func__, ret);
+		debug("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
 	}
-
 	return 0;
 }
 
diff --git a/include/dfu.h b/include/dfu.h
index f973426..9956636 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -169,12 +169,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 8f813c2..4392f76 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,17 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback
+{
+	const char *usb_function_name;
+	g_dnl_bind_callback_f fptr;
+};
+
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
 
 int thor_handle(void);
 int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
 int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
-	return 0;
-}
-#endif
 #endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 058dcf1..ed46064 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -40,13 +40,5 @@ int fsg_init(struct ums *);
 void fsg_cleanup(void);
 struct ums *ums_init(unsigned int);
 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.8.2.1

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

* [U-Boot] [PATCH v2 07/12] arm:goni:dfu Add support for DFU to Goni target
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (5 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 08/12] arm:goni: enable GPT command Mateusz Zalega
                     ` (4 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Proper adjustment for supporting DFU by Goni target has been made.
The s5p_goni.h file has been updated. Moreover, the code for low level
USB initialization has been added to Goni board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/goni/goni.c  |  9 ++++++++
 include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 52 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 366f648..6b1548c 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -13,6 +13,9 @@
 #include <usb/s3c_udc.h>
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
+
 DECLARE_GLOBAL_DATA_PTR;
 
 static struct s5pc110_gpio *s5pc110_gpio;
@@ -172,4 +175,10 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
 	.regs_otg = S5PC110_OTG_BASE,
 	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("USB_udc_probe\n");
+	return s3c_udc_probe(&s5pc110_otg_data);
+}
 #endif
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 1d2dcc0..24a0fcc 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -39,7 +39,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -70,14 +70,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY		1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
@@ -90,7 +94,34 @@
 				",12m(modem)"\
 				",60m(qboot)\0"
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY		1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA			"csa-mmc"
+#define PARTS_BOOTLOADER	"u-boot"
+#define PARTS_BOOT			"boot"
+#define PARTS_ROOT			"platform"
+#define PARTS_DATA			"data"
+#define PARTS_CSC			"csc"
+#define PARTS_UMS			"ums"
+
+#define CONFIG_DFU_ALT \
+	"u-boot raw 0x80 0x400;" \
+	"uImage ext4 0 2;" \
+	"exynos3-goni.dtb ext4 0 2;" \
+	""PARTS_ROOT" part 0 5\0"
+
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
+	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
+	"name="PARTS_BOOTLOADER",size=60MiB," \
+	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
+	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
+	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
+	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
+	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
+	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_BOOTCOMMAND	"run mmcboot"
 
@@ -144,18 +175,18 @@
 	"verify=n\0" \
 	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
-	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
 	"mmcrootpart=5\0" \
+	"partitions=" PARTS_DEFAULT \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
-	"opts=always_resume=1"
+	"opts=always_resume=1\0" \
+	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
 #define CONFIG_SYS_PROMPT	"Goni # "
@@ -194,6 +225,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 08/12] arm:goni: enable GPT command
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (6 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 07/12] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 09/12] arm:goni: enable USB Mass Storage Mateusz Zalega
                     ` (3 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 24a0fcc..d25c494 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -72,6 +72,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -231,6 +232,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 09/12] arm:goni: enable USB Mass Storage
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (7 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 08/12] arm:goni: enable GPT command Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix Mateusz Zalega
                     ` (2 subsequent siblings)
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index d25c494..7314bff 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -261,5 +261,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif	/* __CONFIG_H */
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (8 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 09/12] arm:goni: enable USB Mass Storage Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-22  5:09     ` Marek Vasut
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 11/12] mmc: postponed needless timer initialization Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- updated overlooked type in DFU_CONFIG_ALT, trats2.h
---
 drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h      |   2 +-
 include/configs/trats2.h     |   2 +-
 include/dfu.h                |   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index f942758..075e4cd 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -168,66 +168,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 	return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ *	1st:
+ *		raw	(raw read/write)
+ *		fat	(files)
+ *		ext4	(^)
+ *		part	(partition image)
+ *	2nd and 3rd:
+ *		lba_start and lba_size, for raw write
+ *		mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-	int dev, part;
-	struct mmc *mmc;
-	block_dev_desc_t *blk_dev;
-	disk_partition_t partinfo;
-	char *st;
-
-	dfu->dev_type = DFU_DEV_MMC;
-	st = strsep(&s, " ");
-	if (!strcmp(st, "mmc")) {
-		dfu->layout = DFU_RAW_ADDR;
-		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
-		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
-		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
-	} else if (!strcmp(st, "fat")) {
-		dfu->layout = DFU_FS_FAT;
-	} else if (!strcmp(st, "ext4")) {
-		dfu->layout = DFU_FS_EXT4;
-	} else if (!strcmp(st, "part")) {
+	const char *argv[3];
+	const char **parg = argv;
+	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
+		*parg = strsep(&s, " ");
+		if (*parg == NULL) {
+			error("Invalid number of arguments.\n");
+			return -ENODEV;
+		}
+	}
 
-		dfu->layout = DFU_RAW_ADDR;
+	const char *entity_type = argv[0];
+	/*
+	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+	 * with default 10.
+	 */
+	size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+	size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-		dev = simple_strtoul(s, &s, 10);
-		s++;
-		part = simple_strtoul(s, &s, 10);
+	struct mmc *mmc = find_mmc_device(dfu->dev_num);
+	if (mmc == NULL) {
+		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
+		return -ENODEV;
+	}
 
-		mmc = find_mmc_device(dev);
-		if (mmc == NULL || mmc_init(mmc)) {
-			printf("%s: could not find mmc device #%d!\n",
-			       __func__, dev);
-			return -ENODEV;
-		}
+	if (mmc_init(mmc)) {
+		error("Couldn't init MMC device.\n");
+		return -ENODEV;
+	}
 
-		blk_dev = &mmc->block_dev;
-		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
-			printf("%s: could not find partition #%d on mmc device #%d!\n",
-			       __func__, part, dev);
+	if (!strcmp(entity_type, "raw")) {
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= second_arg;
+		dfu->data.mmc.lba_size		= third_arg;
+		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
+	} else if (!strcmp(entity_type, "part")) {
+		disk_partition_t partinfo;
+		block_dev_desc_t *blk_dev = &mmc->block_dev;
+		int mmcdev = second_arg;
+		int mmcpart = third_arg;
+
+		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
+			error("Couldn't find part #%d on mmc device #%d\n",
+			      mmcpart, mmcdev);
 			return -ENODEV;
 		}
 
-		dfu->data.mmc.lba_start = partinfo.start;
-		dfu->data.mmc.lba_size = partinfo.size;
-		dfu->data.mmc.lba_blk_size = partinfo.blksz;
-
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= partinfo.start;
+		dfu->data.mmc.lba_size		= partinfo.size;
+		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
+	} else if (!strcmp(entity_type, "fat")) {
+		dfu->layout = DFU_FS_FAT;
+	} else if (!strcmp(entity_type, "ext4")) {
+		dfu->layout = DFU_FS_EXT4;
 	} else {
-		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		error("Memory layout (%s) not supported!\n", entity_type);
 		return -ENODEV;
 	}
 
-	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
-		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
-		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+	/* if it's NOT a raw write */
+	if (strcmp(entity_type, "raw")) {
+		dfu->data.mmc.dev = second_arg;
+		dfu->data.mmc.part = third_arg;
 	}
 
+	dfu->dev_type = DFU_DEV_MMC;
 	dfu->read_medium = dfu_read_medium_mmc;
 	dfu->write_medium = dfu_write_medium_mmc;
 	dfu->flush_medium = dfu_flush_medium_mmc;
-
-	/* initial state */
 	dfu->inited = 0;
 
 	return 0;
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4f89556..22a54c1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -311,10 +311,10 @@
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 100 100;" \
-	"u-boot.img.raw mmc 300 400;" \
-	"spl-os-args.raw mmc 80 80;" \
-	"spl-os-image.raw mmc 900 2000;" \
+	"MLO.raw mmc 0x100 0x100;" \
+	"u-boot.img.raw mmc 0x300 0x400;" \
+	"spl-os-args.raw mmc 0x80 0x80;" \
+	"spl-os-image.raw mmc 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index fdd8b46..f4c66c1 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -141,7 +141,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 400;" \
+	"u-boot raw 0x80 0x400;" \
 	"uImage ext4 0 2;" \
 	"exynos4210-trats.dtb ext4 0 2;" \
 	""PARTS_BOOT" part 0 2;" \
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 83633b0..0a35367 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -172,7 +172,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 800;" \
+	"u-boot raw 0x80 0x800;" \
 	"uImage ext4 0 2;" \
 	"exynos4412-trats2.dtb ext4 0 2;" \
 	""PARTS_BOOT" part 0 2;" \
diff --git a/include/dfu.h b/include/dfu.h
index 9956636..6fd75d0 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -64,11 +64,6 @@ struct ram_internal_data {
 	unsigned int	size;
 };
 
-static inline unsigned int get_mmc_blk_size(int dev)
-{
-	return find_mmc_device(dev)->read_bl_len;
-}
-
 #define DFU_NAME_SIZE			32
 #define DFU_CMD_BUF_SIZE		128
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 11/12] mmc: postponed needless timer initialization
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (9 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  11 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 drivers/mmc/mmc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index c6a1c23..730ae01 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1279,15 +1279,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = IN_PROGRESS;
-	unsigned start = get_timer(0);
+	unsigned start;
 
 	if (mmc->has_init)
 		return 0;
+
+	start = get_timer(0);
+
 	if (!mmc->init_in_progress)
 		err = mmc_start_init(mmc);
-
 	if (!err || err == IN_PROGRESS)
 		err = mmc_complete_init(mmc);
+
 	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
 	return err;
 }
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init()
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
                     ` (10 preceding siblings ...)
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 11/12] mmc: postponed needless timer initialization Mateusz Zalega
@ 2014-02-04 17:02   ` Mateusz Zalega
  2014-02-22  5:12     ` Marek Vasut
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-04 17:02 UTC (permalink / raw)
  To: u-boot

In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- patch conforms to kernel coding style
- moved mmc_init() check to ums_init()
---
 board/samsung/common/ums.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..1375138 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -35,10 +35,10 @@ static struct ums ums_dev = {
 	.name = "UMS disk",
 };
 
-static struct ums *ums_disk_init(struct mmc *mmc)
+static struct ums *ums_disk_init(const struct mmc *mmc)
 {
-	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
-	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
+	const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
 	if (!mmc_end_sector) {
 		error("MMC capacity is not valid");
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-	struct mmc *mmc = NULL;
+	struct mmc *mmc = find_mmc_device(dev_num);
 
-	mmc = find_mmc_device(dev_num);
-	if (!mmc)
+	if (!mmc || mmc_init(mmc))
 		return NULL;
-
 	return ums_disk_init(mmc);
 }
-- 
1.8.2.1

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-02-05  7:13     ` Marek Vasut
  2014-02-05 12:40       ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-02-05  7:13 UTC (permalink / raw)
  To: u-boot

On Tuesday, February 04, 2014 at 06:02:38 PM, Mateusz Zalega wrote:
> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>

[...]

> +
> +/* export dfu_add to g_dnl.o */
> +ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
> +		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_dfu",
> +					  .fptr = dfu_add };


from linker-lists.h quote:

104  * ll_entry_declare() - Declare linker-generated array entry
[...]
110  * This macro declares a variable that is placed into a linker-generated
111  * array. This is a basic building block for more advanced use of linker-
112  * generated arrays. The user is expected to build their own macro wrapper
113  * around this one.

Can you follow this advice and build a macro for declaring these USB devices ?

btw would you mind fixing the example for ll_entry_declare() in linker-lists.h ? 
It has four params in the example for some reason (it's a remnant from rework).

[...]

> +static inline struct g_dnl_bind_callback * g_dnl_first_bind_callback(void)
> +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback * g_dnl_last_bind_callback(void)
> +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +

Are these two new functions called from multiple places at all? If not, just 
inline these ll_foo() calls and be done with it. FYI you can also make macros 
for these to avoid having to type all these args all around and duplicating the 
code.

>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
> 
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
> -	      __func__, c, c->cdev);
> -
> +			__func__, c, c->cdev);
>  	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +
> +	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
> +	for (; callback != g_dnl_last_bind_callback(); ++callback)

callback++ , this is not C++ where the order might matter. Nonetheless, you do 
want to use ll_entry_count() and ll_entry_get() with an iterator variable 
instead to make sure you don't step onto a corrupted field and crash in some 
weird way.

> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
> 
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
>  		device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +				__func__, gadget->name);
>  		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
>  	}
> 
> -	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname, gadget->name);
> +	debug("%s: calling usb_gadget_connect for controller '%s'\n",
> +			__func__, gadget->name);

Please split all these cleanups into a separate patch.

[...]

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-05  7:13     ` Marek Vasut
@ 2014-02-05 12:40       ` Mateusz Zalega
  2014-02-05 18:00         ` Marek Vasut
  0 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-05 12:40 UTC (permalink / raw)
  To: u-boot

On 02/05/14 08:13, Marek Vasut wrote:
> On Tuesday, February 04, 2014 at 06:02:38 PM, Mateusz Zalega wrote:
>> Preprocessor definitions and hardcoded implementation selection in
>> g_dnl core were replaced by a linker list made of (usb_function_name,
>> bind_callback) pairs.
>>
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Lukasz Majewski <l.majewski@samsung.com>
>> Cc: Marek Vasut <marex@denx.de>
> 
> [...]
> 
>> +
>> +/* export dfu_add to g_dnl.o */
>> +ll_entry_declare(struct g_dnl_bind_callback, dfu_bind_callback,
>> +		g_dnl_bind_callbacks) = { .usb_function_name = "usb_dnl_dfu",
>> +					  .fptr = dfu_add };
> 
> 
> from linker-lists.h quote:
> 
> 104  * ll_entry_declare() - Declare linker-generated array entry
> [...]
> 110  * This macro declares a variable that is placed into a linker-generated
> 111  * array. This is a basic building block for more advanced use of linker-
> 112  * generated arrays. The user is expected to build their own macro wrapper
> 113  * around this one.
> 
> Can you follow this advice and build a macro for declaring these USB devices ?
> btw would you mind fixing the example for ll_entry_declare() in linker-lists.h ? 
> It has four params in the example for some reason (it's a remnant from rework).

Yup

> [...]
> 
>> +static inline struct g_dnl_bind_callback * g_dnl_first_bind_callback(void)
>> +{
>> +	return ll_entry_start(struct g_dnl_bind_callback,
>> +				g_dnl_bind_callbacks);
>> +}
>> +
>> +static inline struct g_dnl_bind_callback * g_dnl_last_bind_callback(void)
>> +{
>> +	return ll_entry_end(struct g_dnl_bind_callback,
>> +				g_dnl_bind_callbacks);
>> +}
>> +
> 
> Are these two new functions called from multiple places at all? If not, just 
> inline these ll_foo() calls and be done with it. FYI you can also make macros 
> for these to avoid having to type all these args all around and duplicating the 
> code.

Macros or static inlines, it's all the same, there's no point in
changing that. The symbols aren't visible outside this compilation unit
and function calls are, well, inlined.

>>  static int g_dnl_do_config(struct usb_configuration *c)
>>  {
>>  	const char *s = c->cdev->driver->name;
>> -	int ret = -1;
>>
>>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
>> -	      __func__, c, c->cdev);
>> -
>> +			__func__, c, c->cdev);
>>  	printf("GADGET DRIVER: %s\n", s);
>> -	if (!strcmp(s, "usb_dnl_dfu"))
>> -		ret = dfu_add(c);
>> -	else if (!strcmp(s, "usb_dnl_ums"))
>> -		ret = fsg_add(c);
>> -	else if (!strcmp(s, "usb_dnl_thor"))
>> -		ret = thor_add(c);
>> -
>> -	return ret;
>> +
>> +	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
>> +	for (; callback != g_dnl_last_bind_callback(); ++callback)
> 
> callback++ , this is not C++ where the order might matter. Nonetheless, you do 

It doesn't matter anyway and can't be supported on Coding Style grounds,
don't bug me.

> want to use ll_entry_count() and ll_entry_get() with an iterator variable 

I don't think using ll_entry_get() in this way is possible with current
implementation of linker lists. Moreover, there's plenty of code doing
just the same already accepted to U-Boot.

> instead to make sure you don't step onto a corrupted field and crash in some 
> weird way.

Linker would have to split sections to make this sort of thing possible.
Won't happen.

>> +		if (!strcmp(s, callback->usb_function_name))
>> +			return callback->fptr(c);
>> +	return -ENODEV;
>>  }
>>
>>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
>> @@ -203,12 +210,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
>>  		device_desc.bcdDevice = cpu_to_le16(gcnum);
>>  	else {
>>  		debug("%s: controller '%s' not recognized\n",
>> -			shortname, gadget->name);
>> +				__func__, gadget->name);
>>  		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
>>  	}
>>
>> -	debug("%s: calling usb_gadget_connect for "
>> -			"controller '%s'\n", shortname, gadget->name);
>> +	debug("%s: calling usb_gadget_connect for controller '%s'\n",
>> +			__func__, gadget->name);
> 
> Please split all these cleanups into a separate patch.

Right, I'll post v3.

> [...]
> 

Regards,

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-05 12:40       ` Mateusz Zalega
@ 2014-02-05 18:00         ` Marek Vasut
  2014-02-06 11:56           ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-02-05 18:00 UTC (permalink / raw)
  To: u-boot

On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:

[...]

> > Are these two new functions called from multiple places at all? If not,
> > just inline these ll_foo() calls and be done with it. FYI you can also
> > make macros for these to avoid having to type all these args all around
> > and duplicating the code.
> 
> Macros or static inlines, it's all the same

NAK, what you say is seriously wrong, you should know that by now!

Macros do not do any kind of typechecking, functions do typechecking.
Macros are expanded in place during preprocessing, functions are (usually) 
single-instance.

etc.

> there's no point in
> changing that. The symbols aren't visible outside this compilation unit
> and function calls are, well, inlined.

It's pointless to have them pulled out so explicitly. Or would you prefer to 
have each function encapsulated in another function ? This doesn't make does 
now, does it ?

What I would like to do is for you to follow the advice in linker_lists.h and 
produce a small shim over these crude linker lists prototypes there, so that the 
users here in the g_* world don't have to type the whole linker list macros with 
all the arguments, which do not ever change for this g_* . Does it make sense 
please?

> >>  static int g_dnl_do_config(struct usb_configuration *c)
> >>  {
> >>  
> >>  	const char *s = c->cdev->driver->name;
> >> 
> >> -	int ret = -1;
> >> 
> >>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
> >> 
> >> -	      __func__, c, c->cdev);
> >> -
> >> +			__func__, c, c->cdev);
> >> 
> >>  	printf("GADGET DRIVER: %s\n", s);
> >> 
> >> -	if (!strcmp(s, "usb_dnl_dfu"))
> >> -		ret = dfu_add(c);
> >> -	else if (!strcmp(s, "usb_dnl_ums"))
> >> -		ret = fsg_add(c);
> >> -	else if (!strcmp(s, "usb_dnl_thor"))
> >> -		ret = thor_add(c);
> >> -
> >> -	return ret;
> >> +
> >> +	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
> >> +	for (; callback != g_dnl_last_bind_callback(); ++callback)
> > 
> > callback++ , this is not C++ where the order might matter. Nonetheless,
> > you do
> 
> It doesn't matter anyway and can't be supported on Coding Style grounds,
> don't bug me.

Can be done on purely statistical grounds, try this:

$ git grep 'for.*(.* *++[:alnum:]\+ *)' | wc -l
13
$ git grep 'for.*(.* *[:alnum:]\+++ *)' | wc -l
183

Please fix, thank you.

> > want to use ll_entry_count() and ll_entry_get() with an iterator variable
> 
> I don't think using ll_entry_get() in this way is possible with current
> implementation of linker lists. Moreover, there's plenty of code doing
> just the same already accepted to U-Boot.

Ah meh, sorry. Seems like someone was messing with the linkerlists and 
misdesigned it. Dang.

> > instead to make sure you don't step onto a corrupted field and crash in
> > some weird way.
> 
> Linker would have to split sections to make this sort of thing possible.
> Won't happen.

Can you please elaborate ?
[...]

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-05 18:00         ` Marek Vasut
@ 2014-02-06 11:56           ` Mateusz Zalega
  2014-02-06 19:59             ` Marek Vasut
  0 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-02-06 11:56 UTC (permalink / raw)
  To: u-boot

On 02/05/14 19:00, Marek Vasut wrote:
> On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
> 
> [...]
> 
>>> Are these two new functions called from multiple places at all? If not,
>>> just inline these ll_foo() calls and be done with it. FYI you can also
>>> make macros for these to avoid having to type all these args all around
>>> and duplicating the code.
>>
>> Macros or static inlines, it's all the same
> 
> NAK, what you say is seriously wrong, you should know that by now!
> 
> Macros do not do any kind of typechecking, functions do typechecking.
> Macros are expanded in place during preprocessing, functions are (usually) 
> single-instance.
> 
> etc.

Yeah, and it's all the same if you don't care for typechecking and all
that, which I assumed from _you_ proposing usage of macros here.

>> there's no point in
>> changing that. The symbols aren't visible outside this compilation unit
>> and function calls are, well, inlined.
> 
> It's pointless to have them pulled out so explicitly. Or would you prefer to 
> have each function encapsulated in another function ? This doesn't make does 
> now, does it ?

Pardon?

> What I would like to do is for you to follow the advice in linker_lists.h and 
> produce a small shim over these crude linker lists prototypes there, so that the 
> users here in the g_* world don't have to type the whole linker list macros with 
> all the arguments, which do not ever change for this g_* . Does it make sense 
> please?

It's taken care of by static inlines.

>>>>  static int g_dnl_do_config(struct usb_configuration *c)
>>>>  {
>>>>  
>>>>  	const char *s = c->cdev->driver->name;
>>>>
>>>> -	int ret = -1;
>>>>
>>>>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
>>>>
>>>> -	      __func__, c, c->cdev);
>>>> -
>>>> +			__func__, c, c->cdev);
>>>>
>>>>  	printf("GADGET DRIVER: %s\n", s);
>>>>
>>>> -	if (!strcmp(s, "usb_dnl_dfu"))
>>>> -		ret = dfu_add(c);
>>>> -	else if (!strcmp(s, "usb_dnl_ums"))
>>>> -		ret = fsg_add(c);
>>>> -	else if (!strcmp(s, "usb_dnl_thor"))
>>>> -		ret = thor_add(c);
>>>> -
>>>> -	return ret;
>>>> +
>>>> +	struct g_dnl_bind_callback *callback = g_dnl_first_bind_callback();
>>>> +	for (; callback != g_dnl_last_bind_callback(); ++callback)
>>>
>>> callback++ , this is not C++ where the order might matter. Nonetheless,
>>> you do
>>
>> It doesn't matter anyway and can't be supported on Coding Style grounds,
>> don't bug me.
> 
> Can be done on purely statistical grounds, try this:
> 
> $ git grep 'for.*(.* *++[:alnum:]\+ *)' | wc -l
> 13
> $ git grep 'for.*(.* *[:alnum:]\+++ *)' | wc -l
> 183
> 
> Please fix, thank you.

Okay, whatever.

>>> want to use ll_entry_count() and ll_entry_get() with an iterator variable
>>
>> I don't think using ll_entry_get() in this way is possible with current
>> implementation of linker lists. Moreover, there's plenty of code doing
>> just the same already accepted to U-Boot.
> 
> Ah meh, sorry. Seems like someone was messing with the linkerlists and 
> misdesigned it. Dang.

$ git show 42eba

Yeah, it's a pity.

>>> instead to make sure you don't step onto a corrupted field and crash in
>>> some weird way.
>>
>> Linker would have to split sections to make this sort of thing possible.
>> Won't happen.
> 
> Can you please elaborate ?
> [...]
> 

You're guaranteed by the linker, and our setup, that all your
linker-list data will end up in a contiguous block.

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API
  2014-02-06 11:56           ` Mateusz Zalega
@ 2014-02-06 19:59             ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-02-06 19:59 UTC (permalink / raw)
  To: u-boot

On Thursday, February 06, 2014 at 12:56:58 PM, Mateusz Zalega wrote:
> On 02/05/14 19:00, Marek Vasut wrote:
> > On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
> > 
> > [...]
> > 
> >>> Are these two new functions called from multiple places at all? If not,
> >>> just inline these ll_foo() calls and be done with it. FYI you can also
> >>> make macros for these to avoid having to type all these args all around
> >>> and duplicating the code.
> >> 
> >> Macros or static inlines, it's all the same
> > 
> > NAK, what you say is seriously wrong, you should know that by now!
> > 
> > Macros do not do any kind of typechecking, functions do typechecking.
> > Macros are expanded in place during preprocessing, functions are
> > (usually) single-instance.
> > 
> > etc.
> 
> Yeah, and it's all the same if you don't care for typechecking and all
> that, which I assumed from _you_ proposing usage of macros here.

You will need macros wherever you do some kind of strange expansion. If you 
don't need to do strange expansion, use inline functions wherever possible. But 
I think in case of the linker generated lists, you really cannot avoid using 
macros.

> >> there's no point in
> >> changing that. The symbols aren't visible outside this compilation unit
> >> and function calls are, well, inlined.
> > 
> > It's pointless to have them pulled out so explicitly. Or would you prefer
> > to have each function encapsulated in another function ? This doesn't
> > make does now, does it ?
> 
> Pardon?

Sure ...

Actually, looking at this, you are right that wrapping the LL macro with a 
function is a good idea.

> > What I would like to do is for you to follow the advice in linker_lists.h
> > and produce a small shim over these crude linker lists prototypes there,
> > so that the users here in the g_* world don't have to type the whole
> > linker list macros with all the arguments, which do not ever change for
> > this g_* . Does it make sense please?
> 
> It's taken care of by static inlines.

Yes OK, you do have a point.

[...]

> >>> instead to make sure you don't step onto a corrupted field and crash in
> >>> some weird way.
> >> 
> >> Linker would have to split sections to make this sort of thing possible.
> >> Won't happen.
> > 
> > Can you please elaborate ?
> > [...]
> 
> You're guaranteed by the linker, and our setup, that all your
> linker-list data will end up in a contiguous block.

This doesn't mean someone won't corrupt it, but that's for an entirely different 
discussion I'd say.

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

* [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-02-22  5:06     ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-02-22  5:06 UTC (permalink / raw)
  To: u-boot

On Tuesday, February 04, 2014 at 06:02:36 PM, Mateusz Zalega wrote:
> Former usb_cable_connected() patch broke compilation of boards which do
> not support this feature.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  common/cmd_usb_mass_storage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
> index 5f557d5..5175bd5 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  	/* Timeout unit: seconds */
>  	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
> 
> +#ifdef CONFIG_USB_CABLE_CHECK

This new CONFIG_USB_CABLE_CHECK macro doesn't work. Why don't you introduce a 
__weak version of usb_cable_connected() instead and drop this macro altogether ?

>  	if (!usb_cable_connected()) {
>  		puts("Please connect USB cable.\n");
> 
> @@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		}
>  		puts("\r\n");
>  	}
> +#endif
> 
>  	while (1) {
>  		usb_gadget_handle_interrupts();

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix Mateusz Zalega
@ 2014-02-22  5:09     ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-02-22  5:09 UTC (permalink / raw)
  To: u-boot

On Tuesday, February 04, 2014 at 06:02:42 PM, Mateusz Zalega wrote:
> When user attempted to perform a raw write using DFU (vide
> dfu_fill_entity_mmc) with MMC interface not initialized before,
> get_mmc_blk_size() reported invalid (zero) block size - it wasn't
> possible to write ie. a new u-boot image.
> 
> This commit fixes that by initializing device in get_mmc_blk_size() when
> needed.

This patch certainly does more than that I think, no ?

Moreover, it's up to the user to init the MMC before using it, don't you agree?

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init()
  2014-02-04 17:02   ` [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-02-22  5:12     ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-02-22  5:12 UTC (permalink / raw)
  To: u-boot

On Tuesday, February 04, 2014 at 06:02:44 PM, Mateusz Zalega wrote:
> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.

Sorry, this really doesn't explain what was the bug, what caused the bug and why 
this actually solves the problem.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc.
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (9 preceding siblings ...)
  2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
@ 2014-03-31 15:48 ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 01/13] mmc: mmc header fix Mateusz Zalega
                     ` (12 more replies)
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  12 siblings, 13 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:48 UTC (permalink / raw)
  To: u-boot

This is an updated version of patch series regarding DFU, MMC, USB Gadget and
Samsung Goni board, originally sent on 10 January 2014.

---
Changes since v1:
- reordered
  "USB: gadget: added a saner gadget downloader registration API"
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
v2:
- fixed issues which came to [Marek Vasut]'s attention
- rebased
---

Mateusz Zalega (13):
  mmc: mmc header fix
  part: header fix
  arm:goni: Update configuration for goni target
  dfu: fix boards wo USB cable detection
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm:goni:dfu Add support for DFU to Goni target
  arm:goni: enable GPT command
  arm:goni: enable USB Mass Storage
  dfu:mmc: raw data write fix
  mmc: postponed needless timer initialization
  ums: always initialize mmc before ums_disk_init()
  common: fixed linker-list example

 board/samsung/common/ums.c          |  12 ++--
 board/samsung/goni/goni.c           |   8 +++
 common/cmd_dfu.c                    |   3 +-
 common/cmd_thordown.c               |   3 +-
 common/cmd_usb_mass_storage.c       |   4 +-
 drivers/dfu/dfu_mmc.c               | 106 +++++++++++++++++++--------------
 drivers/mmc/mmc.c                   |   7 ++-
 drivers/usb/gadget/f_dfu.c          |   3 +
 drivers/usb/gadget/f_mass_storage.c |   3 +
 drivers/usb/gadget/f_thor.c         |   2 +
 drivers/usb/gadget/g_dnl.c          |  64 +++++++++-----------
 include/configs/am335x_evm.h        |  10 ++--
 include/configs/s5p_goni.h          | 113 +++++++++++++++++++++++++-----------
 include/configs/trats.h             |   2 +-
 include/configs/trats2.h            |   2 +-
 include/dfu.h                       |  12 ----
 include/g_dnl.h                     |  24 ++++++++
 include/linker_lists.h              |   2 +-
 include/mmc.h                       |   1 +
 include/part.h                      |   1 +
 include/thor.h                      |   8 ---
 include/usb_mass_storage.h          |   8 ---
 22 files changed, 236 insertions(+), 162 deletions(-)

-- 
1.9.0

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

* [U-Boot] [PATCH v3 01/13] mmc: mmc header fix
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 02/13] part: " Mateusz Zalega
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index b65ad9e..afc226a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/compiler.h>
+#include <part.h>
 
 #define SD_VERSION_SD	0x20000
 #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
-- 
1.9.0

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

* [U-Boot] [PATCH v3 02/13] part: header fix
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 01/13] mmc: mmc header fix Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 03/13] arm:goni: Update configuration for goni target Mateusz Zalega
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include <ide.h>
+#include <common.h>
 
 typedef struct block_dev_desc {
 	int		if_type;	/* type of the interface */
-- 
1.9.0

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

* [U-Boot] [PATCH v3 03/13] arm:goni: Update configuration for goni target
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 01/13] mmc: mmc header fix Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 02/13] part: " Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection Mateusz Zalega
                     ` (9 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@gmail.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110		1	/* which is in a S5PC110 */
 #define CONFIG_MACH_GONI	1	/* working with Goni */
 
+#include <linux/sizes.h>
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x100000, 0x100000 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
 				",7m(kernel)"\
 				",1m(log)"\
 				",12m(modem)"\
-				",60m(qboot)"\
-				",-(UBI)\0"
+				",60m(qboot)\0"
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND	"run ubifsboot"
+#define CONFIG_BOOTCOMMAND	"run mmcboot"
 
 #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
 
-#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext2" \
+#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \
 		" ${console} ${meminfo}"
 
 #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
 
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 ubi.mtd=6" \
-		" rootfstype=cramfs " CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4 " \
+			CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
 			" onenand write 0x32008000 0x0 0x100000\0"
 
-#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6"
-
-#define CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc"
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
 		"onenand erase 0x01560000 0x1eaa0000;" \
 		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
 	"bootk=" \
-		"onenand read 0x30007FC0 0xc00000 0x600000;" \
+		"run loaduimage;" \
 		"bootm 0x30007FC0\0" \
 	"flashboot=" \
 		"set bootargs root=/dev/mtdblock${bootblock} " \
-		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts} " \
+		"rootfstype=${rootfstype} ${opts} " \
 		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
 	"ubifsboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"tftpboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
-		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
-		"bootm 0x30007FC0\0" \
+		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
 	"ramboot=" \
 		"set bootargs " CONFIG_RAMDISK_BOOT \
-		" initrd=0x33000000,8M ramdisk=8192\0" \
+		"initrd=0x33000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
-		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
 	"verify=n\0" \
-	"rootfstype=cramfs\0" \
+	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
 	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M@0x50000000\0" \
-	"mmcblk=/dev/mmcblk1p1\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"mmcdev=0\0" \
+	"mmcbootpart=2\0" \
+	"mmcrootpart=5\0" \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
@@ -202,6 +198,13 @@
 
 #define CONFIG_DOS_PARTITION		1
 
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+
+/* write support for filesystems */
+#define CONFIG_FAT_WRITE
+#define CONFIG_EXT4_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
@@ -226,5 +229,6 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (2 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 03/13] arm:goni: Update configuration for goni target Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-04-02  6:33     ` Lukasz Majewski
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 05/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
                     ` (8 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..5175bd5 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
+#ifdef CONFIG_USB_CABLE_CHECK
 	if (!usb_cable_connected()) {
 		puts("Please connect USB cable.\n");
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		}
 		puts("\r\n");
 	}
+#endif
 
 	while (1) {
 		usb_gadget_handle_interrupts();
-- 
1.9.0

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

* [U-Boot] [PATCH v3 05/13] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (3 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index fd6f52c..c1f2abf 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -315,6 +315,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -357,6 +358,7 @@
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (4 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 05/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 16:14     ` Marek Vasut
  2014-04-02  6:35     ` Lukasz Majewski
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 07/13] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
                     ` (6 subsequent siblings)
  12 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
 common/cmd_dfu.c                    |  3 +-
 common/cmd_thordown.c               |  3 +-
 common/cmd_usb_mass_storage.c       |  2 +-
 drivers/usb/gadget/f_dfu.c          |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c         |  2 ++
 drivers/usb/gadget/g_dnl.c          | 64 ++++++++++++++++---------------------
 include/dfu.h                       |  7 ----
 include/g_dnl.h                     | 24 ++++++++++++++
 include/thor.h                      |  8 -----
 include/usb_mass_storage.h          |  8 -----
 11 files changed, 63 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	char *s = "dfu";
 	int ret, i = 0;
 
 	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	board_usb_init(controller_index, USB_INIT_DEVICE);
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_dfu");
 	while (1) {
 		if (dfu_reset())
 			/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	const char *s = "thor";
 	int ret;
 
 	puts("TIZEN \"THOR\" Downloader\n");
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto exit;
 	}
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_thor");
 
 	ret = thor_init();
 	if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5175bd5..4c2de48 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	g_dnl_register("ums");
+	g_dnl_register("usb_dnl_ums");
 
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a045864..2f822c4 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include <linux/usb/composite.h>
 
 #include <dfu.h>
+#include <g_dnl.h>
 #include "f_dfu.h"
 
 struct f_dfu {
@@ -781,3 +782,5 @@ int dfu_add(struct usb_configuration *c)
 
 	return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index f896169..f88bb12 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <usb/lin_gadget_compat.h>
+#include <g_dnl.h>
 
 /*------------------------------------------------------------------------*/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
 	return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
 	debug("%s:\n", __func__);
 	return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..3575aca 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
-static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
 	free(cdev->config);
 	cdev->config = NULL;
 	debug("%s: calling usb_gadget_disconnect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_disconnect(gadget);
 
 	return 0;
 }
 
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)
+{
+	return ll_entry_start(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)
+{
+	return ll_entry_end(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
 static int g_dnl_do_config(struct usb_configuration *c)
 {
 	const char *s = c->cdev->driver->name;
-	int ret = -1;
+	struct g_dnl_bind_callback *callback = g_dnl_bind_callback_first();
 
 	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
 	      __func__, c, c->cdev);
 
-	printf("GADGET DRIVER: %s\n", s);
-	if (!strcmp(s, "usb_dnl_dfu"))
-		ret = dfu_add(c);
-	else if (!strcmp(s, "usb_dnl_ums"))
-		ret = fsg_add(c);
-	else if (!strcmp(s, "usb_dnl_thor"))
-		ret = thor_add(c);
-
-	return ret;
+	for (; callback != g_dnl_bind_callback_end(); callback++)
+		if (!strcmp(s, callback->usb_function_name))
+			return callback->fptr(c);
+	return -ENODEV;
 }
 
 static int g_dnl_config_register(struct usb_composite_dev *cdev)
@@ -203,12 +209,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
-			shortname, gadget->name);
+			__func__, gadget->name);
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
 	debug("%s: calling usb_gadget_connect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_connect(gadget);
 
 	return 0;
@@ -227,36 +233,22 @@ static struct usb_composite_driver g_dnl_driver = {
 	.unbind = g_dnl_unbind,
 };
 
-int g_dnl_register(const char *type)
+/*
+ * NOTICE:
+ * Registering via USB function name won't be necessary after rewriting
+ * g_dnl to support multiple USB functions.
+ */
+int g_dnl_register(const char *name)
 {
-	/* The largest function name is 4 */
-	static char name[sizeof(shortname) + 4];
-	int ret;
-
-	if (!strcmp(type, "dfu")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "ums")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "thor")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else {
-		printf("%s: unknown command: %s\n", __func__, type);
-		return -EINVAL;
-	}
+	int ret = usb_composite_register(&g_dnl_driver);
 
+	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
-	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
-	ret = usb_composite_register(&g_dnl_driver);
-
 	if (ret) {
 		printf("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
 	}
-
 	return 0;
 }
 
diff --git a/include/dfu.h b/include/dfu.h
index f973426..9956636 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -169,12 +169,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 8f813c2..fb20bf0 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,30 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+#include <linker_lists.h>
+
+/*
+ * @usb_fname: unescaped USB function name
+ * @callback_ptr: bind callback, one per function name
+ */
+#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
+	ll_entry_declare(struct g_dnl_bind_callback, \
+			__usb_function_name_##usb_fname, \
+			g_dnl_bind_callbacks) = { \
+				.usb_function_name = #usb_fname, \
+				.fptr = callback_ptr \
+			}
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback
+{
+	const char *usb_function_name;
+	g_dnl_bind_callback_f fptr;
+};
+
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
 
 int thor_handle(void);
 int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
 int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
-	return 0;
-}
-#endif
 #endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 058dcf1..ed46064 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -40,13 +40,5 @@ int fsg_init(struct ums *);
 void fsg_cleanup(void);
 struct ums *ums_init(unsigned int);
 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.9.0

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

* [U-Boot] [PATCH v3 07/13] arm:goni:dfu Add support for DFU to Goni target
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (5 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 08/13] arm:goni: enable GPT command Mateusz Zalega
                     ` (5 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/goni/goni.c  |  8 +++++++
 include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
 #include <samsung/misc.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
 	.regs_otg = S5PC110_OTG_BASE,
 	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("USB_udc_probe\n");
+	return s3c_udc_probe(&s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY		1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
@@ -91,7 +95,34 @@
 				",12m(modem)"\
 				",60m(qboot)\0"
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY		1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA			"csa-mmc"
+#define PARTS_BOOTLOADER	"u-boot"
+#define PARTS_BOOT			"boot"
+#define PARTS_ROOT			"platform"
+#define PARTS_DATA			"data"
+#define PARTS_CSC			"csc"
+#define PARTS_UMS			"ums"
+
+#define CONFIG_DFU_ALT \
+	"u-boot raw 0x80 0x400;" \
+	"uImage ext4 0 2;" \
+	"exynos3-goni.dtb ext4 0 2;" \
+	""PARTS_ROOT" part 0 5\0"
+
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
+	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
+	"name="PARTS_BOOTLOADER",size=60MiB," \
+	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
+	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
+	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
+	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
+	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
+	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_BOOTCOMMAND	"run mmcboot"
 
@@ -150,18 +181,18 @@
 	"verify=n\0" \
 	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
-	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
 	"mmcrootpart=5\0" \
+	"partitions=" PARTS_DEFAULT \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
-	"opts=always_resume=1"
+	"opts=always_resume=1\0" \
+	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
 #define CONFIG_SYS_PROMPT	"Goni # "
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE
-- 
1.9.0

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

* [U-Boot] [PATCH v3 08/13] arm:goni: enable GPT command
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (6 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 07/13] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 09/13] arm:goni: enable USB Mass Storage Mateusz Zalega
                     ` (4 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
-- 
1.9.0

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

* [U-Boot] [PATCH v3 09/13] arm:goni: enable USB Mass Storage
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (7 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 08/13] arm:goni: enable GPT command Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 10/13] dfu:mmc: raw data write fix Mateusz Zalega
                     ` (3 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v3 10/13] dfu:mmc: raw data write fix
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (8 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 09/13] arm:goni: enable USB Mass Storage Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 11/13] mmc: postponed needless timer initialization Mateusz Zalega
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h      |   2 +-
 include/configs/trats2.h     |   2 +-
 include/dfu.h                |   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 0816f46..75ff373 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -167,66 +167,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 	return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ *	1st:
+ *		raw	(raw read/write)
+ *		fat	(files)
+ *		ext4	(^)
+ *		part	(partition image)
+ *	2nd and 3rd:
+ *		lba_start and lba_size, for raw write
+ *		mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-	int dev, part;
-	struct mmc *mmc;
-	block_dev_desc_t *blk_dev;
-	disk_partition_t partinfo;
-	char *st;
-
-	dfu->dev_type = DFU_DEV_MMC;
-	st = strsep(&s, " ");
-	if (!strcmp(st, "mmc")) {
-		dfu->layout = DFU_RAW_ADDR;
-		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
-		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
-		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
-	} else if (!strcmp(st, "fat")) {
-		dfu->layout = DFU_FS_FAT;
-	} else if (!strcmp(st, "ext4")) {
-		dfu->layout = DFU_FS_EXT4;
-	} else if (!strcmp(st, "part")) {
+	const char *argv[3];
+	const char **parg = argv;
+	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
+		*parg = strsep(&s, " ");
+		if (*parg == NULL) {
+			error("Invalid number of arguments.\n");
+			return -ENODEV;
+		}
+	}
 
-		dfu->layout = DFU_RAW_ADDR;
+	const char *entity_type = argv[0];
+	/*
+	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+	 * with default 10.
+	 */
+	size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+	size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-		dev = simple_strtoul(s, &s, 10);
-		s++;
-		part = simple_strtoul(s, &s, 10);
+	struct mmc *mmc = find_mmc_device(dfu->dev_num);
+	if (mmc == NULL) {
+		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
+		return -ENODEV;
+	}
 
-		mmc = find_mmc_device(dev);
-		if (mmc == NULL || mmc_init(mmc)) {
-			printf("%s: could not find mmc device #%d!\n",
-			       __func__, dev);
-			return -ENODEV;
-		}
+	if (mmc_init(mmc)) {
+		error("Couldn't init MMC device.\n");
+		return -ENODEV;
+	}
 
-		blk_dev = &mmc->block_dev;
-		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
-			printf("%s: could not find partition #%d on mmc device #%d!\n",
-			       __func__, part, dev);
+	if (!strcmp(entity_type, "raw")) {
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= second_arg;
+		dfu->data.mmc.lba_size		= third_arg;
+		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
+	} else if (!strcmp(entity_type, "part")) {
+		disk_partition_t partinfo;
+		block_dev_desc_t *blk_dev = &mmc->block_dev;
+		int mmcdev = second_arg;
+		int mmcpart = third_arg;
+
+		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
+			error("Couldn't find part #%d on mmc device #%d\n",
+			      mmcpart, mmcdev);
 			return -ENODEV;
 		}
 
-		dfu->data.mmc.lba_start = partinfo.start;
-		dfu->data.mmc.lba_size = partinfo.size;
-		dfu->data.mmc.lba_blk_size = partinfo.blksz;
-
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= partinfo.start;
+		dfu->data.mmc.lba_size		= partinfo.size;
+		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
+	} else if (!strcmp(entity_type, "fat")) {
+		dfu->layout = DFU_FS_FAT;
+	} else if (!strcmp(entity_type, "ext4")) {
+		dfu->layout = DFU_FS_EXT4;
 	} else {
-		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		error("Memory layout (%s) not supported!\n", entity_type);
 		return -ENODEV;
 	}
 
-	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
-		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
-		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+	/* if it's NOT a raw write */
+	if (strcmp(entity_type, "raw")) {
+		dfu->data.mmc.dev = second_arg;
+		dfu->data.mmc.part = third_arg;
 	}
 
+	dfu->dev_type = DFU_DEV_MMC;
 	dfu->read_medium = dfu_read_medium_mmc;
 	dfu->write_medium = dfu_write_medium_mmc;
 	dfu->flush_medium = dfu_flush_medium_mmc;
-
-	/* initial state */
 	dfu->inited = 0;
 
 	return 0;
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c1f2abf..2aeb80c 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -324,10 +324,10 @@
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 100 100;" \
-	"u-boot.img.raw mmc 300 400;" \
-	"spl-os-args.raw mmc 80 80;" \
-	"spl-os-image.raw mmc 900 2000;" \
+	"MLO.raw mmc 0x100 0x100;" \
+	"u-boot.img.raw mmc 0x300 0x400;" \
+	"spl-os-args.raw mmc 0x80 0x80;" \
+	"spl-os-image.raw mmc 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 84c71ce..64cbe10 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -101,7 +101,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 400;" \
+	"u-boot raw 0x80 0x400;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4210-trats.dtb ext4 0 2;" \
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 823a8ae..5334e2d 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -91,7 +91,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 800;" \
+	"u-boot raw 0x80 0x800;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4412-trats2.dtb ext4 0 2;" \
diff --git a/include/dfu.h b/include/dfu.h
index 9956636..6fd75d0 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -64,11 +64,6 @@ struct ram_internal_data {
 	unsigned int	size;
 };
 
-static inline unsigned int get_mmc_blk_size(int dev)
-{
-	return find_mmc_device(dev)->read_bl_len;
-}
-
 #define DFU_NAME_SIZE			32
 #define DFU_CMD_BUF_SIZE		128
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-- 
1.9.0

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

* [U-Boot] [PATCH v3 11/13] mmc: postponed needless timer initialization
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (9 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 10/13] dfu:mmc: raw data write fix Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 13/13] common: fixed linker-list example Mateusz Zalega
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Change-Id: Ib4e0f5a04316c604e6a77a0679d42ff61d5641d2
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
---
 drivers/mmc/mmc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 8ab0bc9..9da31f5 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1279,15 +1279,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = IN_PROGRESS;
-	unsigned start = get_timer(0);
+	unsigned start;
 
 	if (mmc->has_init)
 		return 0;
+
+	start = get_timer(0);
+
 	if (!mmc->init_in_progress)
 		err = mmc_start_init(mmc);
-
 	if (!err || err == IN_PROGRESS)
 		err = mmc_complete_init(mmc);
+
 	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
 	return err;
 }
-- 
1.9.0

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

* [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init()
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (10 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 11/13] mmc: postponed needless timer initialization Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-04-02  6:36     ` Lukasz Majewski
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 13/13] common: fixed linker-list example Mateusz Zalega
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/common/ums.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..1375138 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -35,10 +35,10 @@ static struct ums ums_dev = {
 	.name = "UMS disk",
 };
 
-static struct ums *ums_disk_init(struct mmc *mmc)
+static struct ums *ums_disk_init(const struct mmc *mmc)
 {
-	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
-	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
+	const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
 	if (!mmc_end_sector) {
 		error("MMC capacity is not valid");
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-	struct mmc *mmc = NULL;
+	struct mmc *mmc = find_mmc_device(dev_num);
 
-	mmc = find_mmc_device(dev_num);
-	if (!mmc)
+	if (!mmc || mmc_init(mmc))
 		return NULL;
-
 	return ums_disk_init(mmc);
 }
-- 
1.9.0

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

* [U-Boot] [PATCH v3 13/13] common: fixed linker-list example
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (11 preceding siblings ...)
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-03-31 15:49   ` Mateusz Zalega
  2014-03-31 16:12     ` Marek Vasut
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-03-31 15:49 UTC (permalink / raw)
  To: u-boot

Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  *         .x = 3,
  *         .y = 4,
  * };
-- 
1.9.0

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

* [U-Boot] [PATCH v3 13/13] common: fixed linker-list example
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 13/13] common: fixed linker-list example Mateusz Zalega
@ 2014-03-31 16:12     ` Marek Vasut
  2014-04-01  7:42       ` Lukasz Majewski
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-03-31 16:12 UTC (permalink / raw)
  To: u-boot

On Monday, March 31, 2014 at 05:49:12 PM, Mateusz Zalega wrote:
> Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0

You samsung guys need to fix your mailers ... and you need to learn to write 
commit messages.

> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>

Other than that, please add this for V2:

Acked-by: Marek Vasut <marex@denx.de>

> ---
>  include/linker_lists.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linker_lists.h b/include/linker_lists.h
> index 997d149..557e627 100644
> --- a/include/linker_lists.h
> +++ b/include/linker_lists.h
> @@ -228,7 +228,7 @@
>   * and it's name.
>   *
>   * Example:
> - * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
> + * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
>   *         .x = 3,
>   *         .y = 4,
>   * };

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-03-31 16:14     ` Marek Vasut
  2014-04-02  6:35     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-03-31 16:14 UTC (permalink / raw)
  To: u-boot

On Monday, March 31, 2014 at 05:49:05 PM, Mateusz Zalega wrote:
> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 13/13] common: fixed linker-list example
  2014-03-31 16:12     ` Marek Vasut
@ 2014-04-01  7:42       ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-01  7:42 UTC (permalink / raw)
  To: u-boot

Hi Marek,

> On Monday, March 31, 2014 at 05:49:12 PM, Mateusz Zalega wrote:
> > Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0

Yes, definitely :-). 
Those Change-Ids are a PITA.

> 
> You samsung guys need to fix your mailers ... and you need to learn
> to write commit messages.
> 
> > Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> > Cc: Marek Vasut <marex@denx.de>
> > Cc: Tom Rini <trini@ti.com>
> 
> Other than that, please add this for V2:
> 
> Acked-by: Marek Vasut <marex@denx.de>
> 
> > ---
> >  include/linker_lists.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/linker_lists.h b/include/linker_lists.h
> > index 997d149..557e627 100644
> > --- a/include/linker_lists.h
> > +++ b/include/linker_lists.h
> > @@ -228,7 +228,7 @@
> >   * and it's name.
> >   *
> >   * Example:
> > - * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub,
> > cmd.sub) = {
> > + * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
> >   *         .x = 3,
> >   *         .y = 4,
> >   * };
> 
> Best regards,
> Marek Vasut


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-04-02  6:33     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-02  6:33 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Former usb_cable_connected() patch broke compilation of boards which
> do not support this feature.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> ---
>  common/cmd_usb_mass_storage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 5f557d5..5175bd5 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -45,6 +45,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  	/* Timeout unit: seconds */
>  	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
>  
> +#ifdef CONFIG_USB_CABLE_CHECK
>  	if (!usb_cable_connected()) {
>  		puts("Please connect USB cable.\n");
>  
> @@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		}
>  		puts("\r\n");
>  	}
> +#endif
>  
>  	while (1) {
>  		usb_gadget_handle_interrupts();

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
  2014-03-31 16:14     ` Marek Vasut
@ 2014-04-02  6:35     ` Lukasz Majewski
  2014-04-02 22:28       ` Marek Vasut
  1 sibling, 1 reply; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-02  6:35 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  common/cmd_dfu.c                    |  3 +-
>  common/cmd_thordown.c               |  3 +-
>  common/cmd_usb_mass_storage.c       |  2 +-
>  drivers/usb/gadget/f_dfu.c          |  3 ++
>  drivers/usb/gadget/f_mass_storage.c |  3 ++
>  drivers/usb/gadget/f_thor.c         |  2 ++
>  drivers/usb/gadget/g_dnl.c          | 64
> ++++++++++++++++---------------------
> include/dfu.h                       |  7 ----
> include/g_dnl.h                     | 24 ++++++++++++++
> include/thor.h                      |  8 -----
> include/usb_mass_storage.h          |  8 ----- 11 files changed, 63
> insertions(+), 64 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 5547678..a03538d 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	char *s = "dfu";
>  	int ret, i = 0;
>  
>  	ret = dfu_init_env_entities(interface,
> simple_strtoul(devstring, @@ -38,7 +37,7 @@ static int
> do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int
> controller_index = simple_strtoul(usb_controller, NULL, 0);
> board_usb_init(controller_index, USB_INIT_DEVICE); 
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
>  		if (dfu_reset())
>  			/*
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index c4b3511..2dd7509 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	const char *s = "thor";
>  	int ret;
>  
>  	puts("TIZEN \"THOR\" Downloader\n");
> @@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) goto exit;
>  	}
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_thor");
>  
>  	ret = thor_init();
>  	if (ret) {
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 5175bd5..4c2de48 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	g_dnl_register("ums");
> +	g_dnl_register("usb_dnl_ums");
>  
>  	/* Timeout unit: seconds */
>  	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index a045864..2f822c4 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -24,6 +24,7 @@
>  #include <linux/usb/composite.h>
>  
>  #include <dfu.h>
> +#include <g_dnl.h>
>  #include "f_dfu.h"
>  
>  struct f_dfu {
> @@ -781,3 +782,5 @@ int dfu_add(struct usb_configuration *c)
>  
>  	return dfu_bind_config(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index f896169..f88bb12 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -255,6 +255,7 @@
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  #include <usb/lin_gadget_compat.h>
> +#include <g_dnl.h>
>  
>  /*------------------------------------------------------------------------*/
>  
> @@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
>  
>  	return 0;
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index f5c0224..59d246d 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
>  	debug("%s:\n", __func__);
>  	return thor_func_init(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index dd95afe..3575aca 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -41,7 +41,6 @@
>  
>  #define DRIVER_VERSION		"usb_dnl 2.0"
>  
> -static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
>  static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
> @@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev
> *cdev) free(cdev->config);
>  	cdev->config = NULL;
>  	debug("%s: calling usb_gadget_disconnect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_disconnect(gadget);
>  
>  	return 0;
>  }
>  
> +static inline struct g_dnl_bind_callback *
> g_dnl_bind_callback_first(void) +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback *
> g_dnl_bind_callback_end(void) +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
> +	struct g_dnl_bind_callback *callback =
> g_dnl_bind_callback_first(); 
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
>  	      __func__, c, c->cdev);
>  
> -	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +	for (; callback != g_dnl_bind_callback_end(); callback++)
> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
>  
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +209,12 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +			__func__, gadget->name);
>  		device_desc.bcdDevice =
> __constant_cpu_to_le16(0x9999); }
>  
>  	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_connect(gadget);
>  
>  	return 0;
> @@ -227,36 +233,22 @@ static struct usb_composite_driver g_dnl_driver
> = { .unbind = g_dnl_unbind,
>  };
>  
> -int g_dnl_register(const char *type)
> +/*
> + * NOTICE:
> + * Registering via USB function name won't be necessary after
> rewriting
> + * g_dnl to support multiple USB functions.
> + */
> +int g_dnl_register(const char *name)
>  {
> -	/* The largest function name is 4 */
> -	static char name[sizeof(shortname) + 4];
> -	int ret;
> -
> -	if (!strcmp(type, "dfu")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "ums")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "thor")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else {
> -		printf("%s: unknown command: %s\n", __func__, type);
> -		return -EINVAL;
> -	}
> +	int ret = usb_composite_register(&g_dnl_driver);
>  
> +	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
>  	g_dnl_driver.name = name;
>  
> -	debug("%s: g_dnl_driver.name: %s\n", __func__,
> g_dnl_driver.name);
> -	ret = usb_composite_register(&g_dnl_driver);
> -
>  	if (ret) {
>  		printf("%s: failed!, error: %d\n", __func__, ret);
>  		return ret;
>  	}
> -
>  	return 0;
>  }
>  
> diff --git a/include/dfu.h b/include/dfu.h
> index f973426..9956636 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -169,12 +169,5 @@ static inline int dfu_fill_entity_ram(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_ */
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 8f813c2..fb20bf0 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -10,6 +10,30 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> +#include <linux/usb/composite.h>
> +#include <linker_lists.h>
> +
> +/*
> + * @usb_fname: unescaped USB function name
> + * @callback_ptr: bind callback, one per function name
> + */
> +#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
> +	ll_entry_declare(struct g_dnl_bind_callback, \
> +			__usb_function_name_##usb_fname, \
> +			g_dnl_bind_callbacks) = { \
> +				.usb_function_name = #usb_fname, \
> +				.fptr = callback_ptr \
> +			}
> +
> +typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
> +
> +/* used in Gadget downloader callback linker list */
> +struct g_dnl_bind_callback
> +{
> +	const char *usb_function_name;
> +	g_dnl_bind_callback_f fptr;
> +};
> +
>  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> diff --git a/include/thor.h b/include/thor.h
> index afeade4..5051be7 100644
> --- a/include/thor.h
> +++ b/include/thor.h
> @@ -15,13 +15,5 @@
>  
>  int thor_handle(void);
>  int thor_init(void);
> -
> -#ifdef CONFIG_THOR_FUNCTION
>  int thor_add(struct usb_configuration *c);
> -#else
> -int thor_add(struct usb_configuration *c)
> -{
> -	return 0;
> -}
> -#endif
>  #endif /* __THOR_H_ */
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 058dcf1..ed46064 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -40,13 +40,5 @@ int fsg_init(struct ums *);
>  void fsg_cleanup(void);
>  struct ums *ums_init(unsigned int);
>  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__ */

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init()
  2014-03-31 15:49   ` [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-04-02  6:36     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-02  6:36 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Tested on Samsung Goni.
> 
> Change-Id: I4b86c2c59e430fb8b55272ea14f00316d8cb3dca
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  board/samsung/common/ums.c | 12 +++++-------
>  1 file changed, 5 insertions(+), 7 deletions(-)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..1375138 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -35,10 +35,10 @@ static struct ums ums_dev = {
>  	.name = "UMS disk",
>  };
>  
> -static struct ums *ums_disk_init(struct mmc *mmc)
> +static struct ums *ums_disk_init(const struct mmc *mmc)
>  {
> -	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> -	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
> +	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> +	const uint64_t ums_end_sector = UMS_NUM_SECTORS +
> UMS_START_SECTOR; 
>  	if (!mmc_end_sector) {
>  		error("MMC capacity is not valid");
> @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
>  
>  struct ums *ums_init(unsigned int dev_num)
>  {
> -	struct mmc *mmc = NULL;
> +	struct mmc *mmc = find_mmc_device(dev_num);
>  
> -	mmc = find_mmc_device(dev_num);
> -	if (!mmc)
> +	if (!mmc || mmc_init(mmc))
>  		return NULL;
> -
>  	return ums_disk_init(mmc);
>  }

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-02  6:35     ` Lukasz Majewski
@ 2014-04-02 22:28       ` Marek Vasut
  2014-04-03  7:46         ` Lukasz Majewski
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-04-02 22:28 UTC (permalink / raw)
  To: u-boot

On Wednesday, April 02, 2014 at 08:35:33 AM, Lukasz Majewski wrote:
> Hi Mateusz,

[...]

> Acked-by: Lukasz Majewski <l.majewski@samsung.com>

I suggest this goes for -next. Do you agree?

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-02 22:28       ` Marek Vasut
@ 2014-04-03  7:46         ` Lukasz Majewski
  2014-04-03  8:52           ` Marek Vasut
  0 siblings, 1 reply; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-03  7:46 UTC (permalink / raw)
  To: u-boot

Hi Marek,

> On Wednesday, April 02, 2014 at 08:35:33 AM, Lukasz Majewski wrote:
> > Hi Mateusz,
> 
> [...]
> 
> > Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> 
> I suggest this goes for -next. Do you agree?

I'm fine with this code going to -next. Thanks in advance.

> 
> Acked-by: Marek Vasut <marex@denx.de>
> 
> Best regards,
> Marek Vasut


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-03  7:46         ` Lukasz Majewski
@ 2014-04-03  8:52           ` Marek Vasut
  2014-04-11 11:43             ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-04-03  8:52 UTC (permalink / raw)
  To: u-boot

On Thursday, April 03, 2014 at 09:46:22 AM, Lukasz Majewski wrote:
> Hi Marek,
> 
> > On Wednesday, April 02, 2014 at 08:35:33 AM, Lukasz Majewski wrote:
> > > Hi Mateusz,
> > 
> > [...]
> > 
> > > Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> > 
> > I suggest this goes for -next. Do you agree?
> 
> I'm fine with this code going to -next. Thanks in advance.

Hm, actually, I see we have open issues with the 04/13 V2 patch (why don't you 
have default __weak usb_cable_detection() implementation instead of another 
#ifdef ?).

The whole patchset is a mix of completely unrelated things which should go 
through different trees. Can the patchset be reordered/split in some reasonable 
chunks ? There are fixes which should go in immediatelly and then features which 
should go in for -next.

btw. please keep custodians on CC of the respective patches.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-03  8:52           ` Marek Vasut
@ 2014-04-11 11:43             ` Mateusz Zalega
  2014-04-11 12:02               ` Marek Vasut
  0 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-11 11:43 UTC (permalink / raw)
  To: u-boot

On 04/03/14 10:52, Marek Vasut wrote:
>>>> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
>>>
>>> I suggest this goes for -next. Do you agree?
>>
>> I'm fine with this code going to -next. Thanks in advance.
> 
> Hm, actually, I see we have open issues with the 04/13 V2 patch (why don't you 
> have default __weak usb_cable_detection() implementation instead of another 
> #ifdef ?).

Existing code relied on boolean value returned from
usb_cable_connected(), but there was no way to signal that it's
impossible to tell whether cable is connected or not. If you prefer an
enum with USBCNT_DONTKNOW as a return value, make a decision.

> The whole patchset is a mix of completely unrelated things which should go 
> through different trees. Can the patchset be reordered/split in some reasonable 
> chunks ? There are fixes which should go in immediatelly and then features which 
> should go in for -next.

Not exactly unrelated, most of it should be applied in this particular
order. It would be less chaotic had it been accepted in one piece.

> btw. please keep custodians on CC of the respective patches.

OK

Regards,

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-11 11:43             ` Mateusz Zalega
@ 2014-04-11 12:02               ` Marek Vasut
  2014-04-15 11:04                 ` Mateusz Zalega
  0 siblings, 1 reply; 127+ messages in thread
From: Marek Vasut @ 2014-04-11 12:02 UTC (permalink / raw)
  To: u-boot

On Friday, April 11, 2014 at 01:43:47 PM, Mateusz Zalega wrote:
> On 04/03/14 10:52, Marek Vasut wrote:
> >>>> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> >>> 
> >>> I suggest this goes for -next. Do you agree?
> >> 
> >> I'm fine with this code going to -next. Thanks in advance.
> > 
> > Hm, actually, I see we have open issues with the 04/13 V2 patch (why
> > don't you have default __weak usb_cable_detection() implementation
> > instead of another #ifdef ?).
> 
> Existing code relied on boolean value returned from
> usb_cable_connected(), but there was no way to signal that it's
> impossible to tell whether cable is connected or not. If you prefer an
> enum with USBCNT_DONTKNOW as a return value, make a decision.

Did I say anything about "USBCNT_DONTKNOW" above please?

Sorry, I also lost context of this thread as it was dead for more than a month.

> > The whole patchset is a mix of completely unrelated things which should
> > go through different trees. Can the patchset be reordered/split in some
> > reasonable chunks ? There are fixes which should go in immediatelly and
> > then features which should go in for -next.
> 
> Not exactly unrelated, most of it should be applied in this particular
> order. It would be less chaotic had it been accepted in one piece.

Please elaborate why can the fixes not go first and features second. Thank you.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-11 12:02               ` Marek Vasut
@ 2014-04-15 11:04                 ` Mateusz Zalega
  2014-04-15 13:26                   ` Marek Vasut
  0 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 11:04 UTC (permalink / raw)
  To: u-boot

On 04/11/14 14:02, Marek Vasut wrote:
>> Existing code relied on boolean value returned from
>> usb_cable_connected(), but there was no way to signal that it's
>> impossible to tell whether cable is connected or not. If you prefer an
>> enum with USBCNT_DONTKNOW as a return value, make a decision.
> 
> Did I say anything about "USBCNT_DONTKNOW" above please?
> 
> Sorry, I also lost context of this thread as it was dead for more than a month.

As I described on the IRC. We've got to have a way to signal U-Boot code
that our hardware isn't capable of knowing if cable is connected, thus
#ifdef all related code or introduce 3-valued enum.

>>> The whole patchset is a mix of completely unrelated things which should
>>> go through different trees. Can the patchset be reordered/split in some
>>> reasonable chunks ? There are fixes which should go in immediatelly and
>>> then features which should go in for -next.
>>
>> Not exactly unrelated, most of it should be applied in this particular
>> order. It would be less chaotic had it been accepted in one piece.
> 
> Please elaborate why can the fixes not go first and features second. Thank you.

It's because of silly relationships between some of these patches. ie.
am335x SPL build process just blew (too little ROM), leaving its
codebase in unbisectable state, after I added some more code to DFU
implementation. am335x's SPL had to be disabled first, and I consider it
a change on the feature list.

I've reordered the fixes I could, but I guess it doesn't matter anymore,
now that -next is out.

Please ack applicable USB patches on the next patchset version or
propose a different solution.

Regards,

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc.
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (10 preceding siblings ...)
  2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
@ 2014-04-15 13:06 ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 01/13] mmc: mmc header fix Mateusz Zalega
                     ` (12 more replies)
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  12 siblings, 13 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

This is, I hope, the final version of patchset.

Custodians: please ack appropriate patches.

Minkyu Kang: Could you pick it up after it gets reviewed by the community?

patches 1-7: fixes that can be applied before features
patches 8-13: features and fixes that depend on features

Patchset has been tested by running MAKEALL -a arm on every commit, so that it
wouldn't break bisect.

Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>

---
Changes since v1:
- reordered
  "USB: gadget: added a saner gadget downloader registration API"
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient SRAM capacity
v2:
- fixed issues which came to [Marek Vasut]'s attention
- rebased
v3:
- previous version of the ums patch introduced "unused variable" warnings
- const attribute of function argument broke existing interface in one of MMC patches
- grouped patches related to common topics
---

Mateusz Zalega (13):
  mmc: mmc header fix
  part: header fix
  common: fixed linker-list example
  usb: dfu: fix boards wo USB cable detection
  mmc: postponed needless timer initialization
  dfu: mmc: raw data write fix
  ums: always initialize mmc before ums_disk_init()
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm: goni: Update configuration for Goni target
  arm: goni: dfu: Add support for DFU to Goni target
  arm: goni: enable GPT command
  arm: goni: enable USB Mass Storage

 board/samsung/common/ums.c          |  10 ++--
 board/samsung/goni/goni.c           |   8 +++
 common/cmd_dfu.c                    |   3 +-
 common/cmd_thordown.c               |   3 +-
 common/cmd_usb_mass_storage.c       |   4 +-
 drivers/dfu/dfu_mmc.c               | 106 +++++++++++++++++++--------------
 drivers/mmc/mmc.c                   |   7 ++-
 drivers/usb/gadget/f_dfu.c          |   3 +
 drivers/usb/gadget/f_mass_storage.c |   3 +
 drivers/usb/gadget/f_thor.c         |   2 +
 drivers/usb/gadget/g_dnl.c          |  64 +++++++++-----------
 include/configs/am335x_evm.h        |  10 ++--
 include/configs/s5p_goni.h          | 113 +++++++++++++++++++++++++-----------
 include/configs/trats.h             |   2 +-
 include/configs/trats2.h            |   2 +-
 include/dfu.h                       |  12 ----
 include/g_dnl.h                     |  24 ++++++++
 include/linker_lists.h              |   2 +-
 include/mmc.h                       |   1 +
 include/part.h                      |   1 +
 include/thor.h                      |   8 ---
 include/usb_mass_storage.h          |   8 ---
 22 files changed, 235 insertions(+), 161 deletions(-)

-- 
1.9.0

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

* [U-Boot] [PATCH v4 01/13] mmc: mmc header fix
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 02/13] part: " Mateusz Zalega
                     ` (11 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index 42d0125..bc11f45 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/compiler.h>
+#include <part.h>
 
 #define SD_VERSION_SD	0x20000
 #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
-- 
1.9.0

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

* [U-Boot] [PATCH v4 02/13] part: header fix
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 01/13] mmc: mmc header fix Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 03/13] common: fixed linker-list example Mateusz Zalega
                     ` (10 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include <ide.h>
+#include <common.h>
 
 typedef struct block_dev_desc {
 	int		if_type;	/* type of the interface */
-- 
1.9.0

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

* [U-Boot] [PATCH v4 03/13] common: fixed linker-list example
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 01/13] mmc: mmc header fix Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 02/13] part: " Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:36     ` Marek Vasut
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
                     ` (9 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/linker_lists.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linker_lists.h b/include/linker_lists.h
index 997d149..557e627 100644
--- a/include/linker_lists.h
+++ b/include/linker_lists.h
@@ -228,7 +228,7 @@
  * and it's name.
  *
  * Example:
- * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub, cmd.sub) = {
+ * ll_entry_declare(struct my_sub_cmd, my_sub_cmd, cmd_sub) = {
  *         .x = 3,
  *         .y = 4,
  * };
-- 
1.9.0

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

* [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (2 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 03/13] common: fixed linker-list example Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:38     ` Marek Vasut
  2014-04-15 14:23     ` Lukasz Majewski
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 05/13] mmc: postponed needless timer initialization Mateusz Zalega
                     ` (8 subsequent siblings)
  12 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/cmd_usb_mass_storage.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..2f69a53 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -42,6 +42,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 
 	g_dnl_register("ums");
 
+#ifdef CONFIG_USB_CABLE_CHECK
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
@@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		}
 		puts("\r\n");
 	}
+#endif
 
 	while (1) {
 		usb_gadget_handle_interrupts();
-- 
1.9.0

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

* [U-Boot] [PATCH v4 05/13] mmc: postponed needless timer initialization
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (3 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 06/13] dfu: mmc: raw data write fix Mateusz Zalega
                     ` (7 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

mmc_init() doesn't call get_timer() anymore if MMC is already
initialized.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 drivers/mmc/mmc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 16051e5..c93dc24 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1310,15 +1310,18 @@ static int mmc_complete_init(struct mmc *mmc)
 int mmc_init(struct mmc *mmc)
 {
 	int err = IN_PROGRESS;
-	unsigned start = get_timer(0);
+	unsigned start;
 
 	if (mmc->has_init)
 		return 0;
+
+	start = get_timer(0);
+
 	if (!mmc->init_in_progress)
 		err = mmc_start_init(mmc);
-
 	if (!err || err == IN_PROGRESS)
 		err = mmc_complete_init(mmc);
+
 	debug("%s: %d, time %lu\n", __func__, err, get_timer(start));
 	return err;
 }
-- 
1.9.0

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

* [U-Boot] [PATCH v4 06/13] dfu: mmc: raw data write fix
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (4 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 05/13] mmc: postponed needless timer initialization Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
                     ` (6 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing device in get_mmc_blk_size() when
needed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 drivers/dfu/dfu_mmc.c        | 106 ++++++++++++++++++++++++++-----------------
 include/configs/am335x_evm.h |   8 ++--
 include/configs/trats.h      |   2 +-
 include/configs/trats2.h     |   2 +-
 include/dfu.h                |   5 --
 5 files changed, 70 insertions(+), 53 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 651cfff..2f7ae21 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -184,66 +184,88 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 	return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ *	1st:
+ *		raw	(raw read/write)
+ *		fat	(files)
+ *		ext4	(^)
+ *		part	(partition image)
+ *	2nd and 3rd:
+ *		lba_start and lba_size, for raw write
+ *		mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-	int dev, part;
-	struct mmc *mmc;
-	block_dev_desc_t *blk_dev;
-	disk_partition_t partinfo;
-	char *st;
-
-	dfu->dev_type = DFU_DEV_MMC;
-	st = strsep(&s, " ");
-	if (!strcmp(st, "mmc")) {
-		dfu->layout = DFU_RAW_ADDR;
-		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
-		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
-		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
-	} else if (!strcmp(st, "fat")) {
-		dfu->layout = DFU_FS_FAT;
-	} else if (!strcmp(st, "ext4")) {
-		dfu->layout = DFU_FS_EXT4;
-	} else if (!strcmp(st, "part")) {
+	const char *argv[3];
+	const char **parg = argv;
+	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
+		*parg = strsep(&s, " ");
+		if (*parg == NULL) {
+			error("Invalid number of arguments.\n");
+			return -ENODEV;
+		}
+	}
 
-		dfu->layout = DFU_RAW_ADDR;
+	const char *entity_type = argv[0];
+	/*
+	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+	 * with default 10.
+	 */
+	size_t second_arg = simple_strtoul(argv[1], NULL, 0);
+	size_t third_arg = simple_strtoul(argv[2], NULL, 0);
 
-		dev = simple_strtoul(s, &s, 10);
-		s++;
-		part = simple_strtoul(s, &s, 10);
+	struct mmc *mmc = find_mmc_device(dfu->dev_num);
+	if (mmc == NULL) {
+		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
+		return -ENODEV;
+	}
 
-		mmc = find_mmc_device(dev);
-		if (mmc == NULL || mmc_init(mmc)) {
-			printf("%s: could not find mmc device #%d!\n",
-			       __func__, dev);
-			return -ENODEV;
-		}
+	if (mmc_init(mmc)) {
+		error("Couldn't init MMC device.\n");
+		return -ENODEV;
+	}
 
-		blk_dev = &mmc->block_dev;
-		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
-			printf("%s: could not find partition #%d on mmc device #%d!\n",
-			       __func__, part, dev);
+	if (!strcmp(entity_type, "raw")) {
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= second_arg;
+		dfu->data.mmc.lba_size		= third_arg;
+		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
+	} else if (!strcmp(entity_type, "part")) {
+		disk_partition_t partinfo;
+		block_dev_desc_t *blk_dev = &mmc->block_dev;
+		int mmcdev = second_arg;
+		int mmcpart = third_arg;
+
+		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
+			error("Couldn't find part #%d on mmc device #%d\n",
+			      mmcpart, mmcdev);
 			return -ENODEV;
 		}
 
-		dfu->data.mmc.lba_start = partinfo.start;
-		dfu->data.mmc.lba_size = partinfo.size;
-		dfu->data.mmc.lba_blk_size = partinfo.blksz;
-
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= partinfo.start;
+		dfu->data.mmc.lba_size		= partinfo.size;
+		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
+	} else if (!strcmp(entity_type, "fat")) {
+		dfu->layout = DFU_FS_FAT;
+	} else if (!strcmp(entity_type, "ext4")) {
+		dfu->layout = DFU_FS_EXT4;
 	} else {
-		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		error("Memory layout (%s) not supported!\n", entity_type);
 		return -ENODEV;
 	}
 
-	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
-		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
-		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+	/* if it's NOT a raw write */
+	if (strcmp(entity_type, "raw")) {
+		dfu->data.mmc.dev = second_arg;
+		dfu->data.mmc.part = third_arg;
 	}
 
+	dfu->dev_type = DFU_DEV_MMC;
 	dfu->read_medium = dfu_read_medium_mmc;
 	dfu->write_medium = dfu_write_medium_mmc;
 	dfu->flush_medium = dfu_flush_medium_mmc;
-
-	/* initial state */
 	dfu->inited = 0;
 
 	return 0;
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ea9e758..4147f9f 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -320,10 +320,10 @@
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 100 100;" \
-	"u-boot.img.raw mmc 300 400;" \
-	"spl-os-args.raw mmc 80 80;" \
-	"spl-os-image.raw mmc 900 2000;" \
+	"MLO.raw mmc 0x100 0x100;" \
+	"u-boot.img.raw mmc 0x300 0x400;" \
+	"spl-os-args.raw mmc 0x80 0x80;" \
+	"spl-os-image.raw mmc 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 5d8bd60..8461343 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -101,7 +101,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 400;" \
+	"u-boot raw 0x80 0x400;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4210-trats.dtb ext4 0 2;" \
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 53d449c..03e88ee 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -91,7 +91,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 800;" \
+	"u-boot raw 0x80 0x800;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4412-trats2.dtb ext4 0 2;" \
diff --git a/include/dfu.h b/include/dfu.h
index 6c71ecb..dcd3215 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -64,11 +64,6 @@ struct ram_internal_data {
 	unsigned int	size;
 };
 
-static inline unsigned int get_mmc_blk_size(int dev)
-{
-	return find_mmc_device(dev)->read_bl_len;
-}
-
 #define DFU_NAME_SIZE			32
 #define DFU_CMD_BUF_SIZE		128
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-- 
1.9.0

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

* [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init()
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (5 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 06/13] dfu: mmc: raw data write fix Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 14:24     ` Lukasz Majewski
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
                     ` (5 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

In some cases MMC was still uninitialized while media capacity check,
leading to broken ums command.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/common/ums.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..dec2963 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -37,8 +37,8 @@ static struct ums ums_dev = {
 
 static struct ums *ums_disk_init(struct mmc *mmc)
 {
-	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
-	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
+	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
+	const uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
 
 	if (!mmc_end_sector) {
 		error("MMC capacity is not valid");
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-	struct mmc *mmc = NULL;
+	struct mmc *mmc = find_mmc_device(dev_num);
 
-	mmc = find_mmc_device(dev_num);
-	if (!mmc)
+	if (!mmc || mmc_init(mmc))
 		return NULL;
-
 	return ums_disk_init(mmc);
 }
-- 
1.9.0

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

* [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (6 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 14:25     ` Lukasz Majewski
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
                     ` (4 subsequent siblings)
  12 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4147f9f..670e3f1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -312,6 +312,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -354,6 +355,7 @@
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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

* [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (7 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:39     ` Marek Vasut
                       ` (2 more replies)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 10/13] arm: goni: Update configuration for Goni target Mateusz Zalega
                     ` (3 subsequent siblings)
  12 siblings, 3 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 common/cmd_dfu.c                    |  3 +-
 common/cmd_thordown.c               |  3 +-
 common/cmd_usb_mass_storage.c       |  2 +-
 drivers/usb/gadget/f_dfu.c          |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c         |  2 ++
 drivers/usb/gadget/g_dnl.c          | 64 ++++++++++++++++---------------------
 include/dfu.h                       |  7 ----
 include/g_dnl.h                     | 24 ++++++++++++++
 include/thor.h                      |  8 -----
 include/usb_mass_storage.h          |  8 -----
 11 files changed, 63 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	char *s = "dfu";
 	int ret, i = 0;
 
 	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	board_usb_init(controller_index, USB_INIT_DEVICE);
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_dfu");
 	while (1) {
 		if (dfu_reset())
 			/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	const char *s = "thor";
 	int ret;
 
 	puts("TIZEN \"THOR\" Downloader\n");
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto exit;
 	}
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_thor");
 
 	ret = thor_init();
 	if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 2f69a53..ab10ea6 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	g_dnl_register("ums");
+	g_dnl_register("usb_dnl_ums");
 
 #ifdef CONFIG_USB_CABLE_CHECK
 	/* Timeout unit: seconds */
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index de75ff1..1b1e179 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include <linux/usb/composite.h>
 
 #include <dfu.h>
+#include <g_dnl.h>
 #include "f_dfu.h"
 
 struct f_dfu {
@@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
 
 	return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index f896169..f88bb12 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <usb/lin_gadget_compat.h>
+#include <g_dnl.h>
 
 /*------------------------------------------------------------------------*/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
 	return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
 	debug("%s:\n", __func__);
 	return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..3575aca 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
-static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
 	free(cdev->config);
 	cdev->config = NULL;
 	debug("%s: calling usb_gadget_disconnect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_disconnect(gadget);
 
 	return 0;
 }
 
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)
+{
+	return ll_entry_start(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)
+{
+	return ll_entry_end(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
 static int g_dnl_do_config(struct usb_configuration *c)
 {
 	const char *s = c->cdev->driver->name;
-	int ret = -1;
+	struct g_dnl_bind_callback *callback = g_dnl_bind_callback_first();
 
 	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
 	      __func__, c, c->cdev);
 
-	printf("GADGET DRIVER: %s\n", s);
-	if (!strcmp(s, "usb_dnl_dfu"))
-		ret = dfu_add(c);
-	else if (!strcmp(s, "usb_dnl_ums"))
-		ret = fsg_add(c);
-	else if (!strcmp(s, "usb_dnl_thor"))
-		ret = thor_add(c);
-
-	return ret;
+	for (; callback != g_dnl_bind_callback_end(); callback++)
+		if (!strcmp(s, callback->usb_function_name))
+			return callback->fptr(c);
+	return -ENODEV;
 }
 
 static int g_dnl_config_register(struct usb_composite_dev *cdev)
@@ -203,12 +209,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
-			shortname, gadget->name);
+			__func__, gadget->name);
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
 	debug("%s: calling usb_gadget_connect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_connect(gadget);
 
 	return 0;
@@ -227,36 +233,22 @@ static struct usb_composite_driver g_dnl_driver = {
 	.unbind = g_dnl_unbind,
 };
 
-int g_dnl_register(const char *type)
+/*
+ * NOTICE:
+ * Registering via USB function name won't be necessary after rewriting
+ * g_dnl to support multiple USB functions.
+ */
+int g_dnl_register(const char *name)
 {
-	/* The largest function name is 4 */
-	static char name[sizeof(shortname) + 4];
-	int ret;
-
-	if (!strcmp(type, "dfu")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "ums")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "thor")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else {
-		printf("%s: unknown command: %s\n", __func__, type);
-		return -EINVAL;
-	}
+	int ret = usb_composite_register(&g_dnl_driver);
 
+	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
-	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
-	ret = usb_composite_register(&g_dnl_driver);
-
 	if (ret) {
 		printf("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
 	}
-
 	return 0;
 }
 
diff --git a/include/dfu.h b/include/dfu.h
index dcd3215..2409168 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -168,12 +168,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 8f813c2..fb20bf0 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,30 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+#include <linker_lists.h>
+
+/*
+ * @usb_fname: unescaped USB function name
+ * @callback_ptr: bind callback, one per function name
+ */
+#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
+	ll_entry_declare(struct g_dnl_bind_callback, \
+			__usb_function_name_##usb_fname, \
+			g_dnl_bind_callbacks) = { \
+				.usb_function_name = #usb_fname, \
+				.fptr = callback_ptr \
+			}
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback
+{
+	const char *usb_function_name;
+	g_dnl_bind_callback_f fptr;
+};
+
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
 
 int thor_handle(void);
 int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
 int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
-	return 0;
-}
-#endif
 #endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 058dcf1..ed46064 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -40,13 +40,5 @@ int fsg_init(struct ums *);
 void fsg_cleanup(void);
 struct ums *ums_init(unsigned int);
 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.9.0

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

* [U-Boot] [PATCH v4 10/13] arm: goni: Update configuration for Goni target
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (8 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 11/13] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
                     ` (2 subsequent siblings)
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110		1	/* which is in a S5PC110 */
 #define CONFIG_MACH_GONI	1	/* working with Goni */
 
+#include <linux/sizes.h>
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x100000, 0x100000 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
 				",7m(kernel)"\
 				",1m(log)"\
 				",12m(modem)"\
-				",60m(qboot)"\
-				",-(UBI)\0"
+				",60m(qboot)\0"
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND	"run ubifsboot"
+#define CONFIG_BOOTCOMMAND	"run mmcboot"
 
 #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
 
-#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext2" \
+#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \
 		" ${console} ${meminfo}"
 
 #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
 
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 ubi.mtd=6" \
-		" rootfstype=cramfs " CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4 " \
+			CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
 			" onenand write 0x32008000 0x0 0x100000\0"
 
-#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6"
-
-#define CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc"
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
 		"onenand erase 0x01560000 0x1eaa0000;" \
 		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
 	"bootk=" \
-		"onenand read 0x30007FC0 0xc00000 0x600000;" \
+		"run loaduimage;" \
 		"bootm 0x30007FC0\0" \
 	"flashboot=" \
 		"set bootargs root=/dev/mtdblock${bootblock} " \
-		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts} " \
+		"rootfstype=${rootfstype} ${opts} " \
 		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
 	"ubifsboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"tftpboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
-		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
-		"bootm 0x30007FC0\0" \
+		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
 	"ramboot=" \
 		"set bootargs " CONFIG_RAMDISK_BOOT \
-		" initrd=0x33000000,8M ramdisk=8192\0" \
+		"initrd=0x33000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
-		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
 	"verify=n\0" \
-	"rootfstype=cramfs\0" \
+	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
 	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M@0x50000000\0" \
-	"mmcblk=/dev/mmcblk1p1\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"mmcdev=0\0" \
+	"mmcbootpart=2\0" \
+	"mmcrootpart=5\0" \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
@@ -202,6 +198,13 @@
 
 #define CONFIG_DOS_PARTITION		1
 
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+
+/* write support for filesystems */
+#define CONFIG_FAT_WRITE
+#define CONFIG_EXT4_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
@@ -226,5 +229,6 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v4 11/13] arm: goni: dfu: Add support for DFU to Goni target
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (9 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 10/13] arm: goni: Update configuration for Goni target Mateusz Zalega
@ 2014-04-15 13:06   ` Mateusz Zalega
  2014-04-15 13:07   ` [U-Boot] [PATCH v4 12/13] arm: goni: enable GPT command Mateusz Zalega
  2014-04-15 13:07   ` [U-Boot] [PATCH v4 13/13] arm: goni: enable USB Mass Storage Mateusz Zalega
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:06 UTC (permalink / raw)
  To: u-boot

Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/goni/goni.c  |  8 +++++++
 include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
 #include <samsung/misc.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
 	.regs_otg = S5PC110_OTG_BASE,
 	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("USB_udc_probe\n");
+	return s3c_udc_probe(&s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY		1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
@@ -91,7 +95,34 @@
 				",12m(modem)"\
 				",60m(qboot)\0"
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY		1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA			"csa-mmc"
+#define PARTS_BOOTLOADER	"u-boot"
+#define PARTS_BOOT			"boot"
+#define PARTS_ROOT			"platform"
+#define PARTS_DATA			"data"
+#define PARTS_CSC			"csc"
+#define PARTS_UMS			"ums"
+
+#define CONFIG_DFU_ALT \
+	"u-boot raw 0x80 0x400;" \
+	"uImage ext4 0 2;" \
+	"exynos3-goni.dtb ext4 0 2;" \
+	""PARTS_ROOT" part 0 5\0"
+
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
+	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
+	"name="PARTS_BOOTLOADER",size=60MiB," \
+	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
+	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
+	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
+	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
+	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
+	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_BOOTCOMMAND	"run mmcboot"
 
@@ -150,18 +181,18 @@
 	"verify=n\0" \
 	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
-	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
 	"mmcrootpart=5\0" \
+	"partitions=" PARTS_DEFAULT \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
-	"opts=always_resume=1"
+	"opts=always_resume=1\0" \
+	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
 #define CONFIG_SYS_PROMPT	"Goni # "
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE
-- 
1.9.0

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

* [U-Boot] [PATCH v4 12/13] arm: goni: enable GPT command
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (10 preceding siblings ...)
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 11/13] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
@ 2014-04-15 13:07   ` Mateusz Zalega
  2014-04-15 13:07   ` [U-Boot] [PATCH v4 13/13] arm: goni: enable USB Mass Storage Mateusz Zalega
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:07 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
-- 
1.9.0

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

* [U-Boot] [PATCH v4 13/13] arm: goni: enable USB Mass Storage
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (11 preceding siblings ...)
  2014-04-15 13:07   ` [U-Boot] [PATCH v4 12/13] arm: goni: enable GPT command Mateusz Zalega
@ 2014-04-15 13:07   ` Mateusz Zalega
  12 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-15 13:07 UTC (permalink / raw)
  To: u-boot

UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-15 11:04                 ` Mateusz Zalega
@ 2014-04-15 13:26                   ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-04-15 13:26 UTC (permalink / raw)
  To: u-boot

On Tuesday, April 15, 2014 at 01:04:57 PM, Mateusz Zalega wrote:
> On 04/11/14 14:02, Marek Vasut wrote:
> >> Existing code relied on boolean value returned from
> >> usb_cable_connected(), but there was no way to signal that it's
> >> impossible to tell whether cable is connected or not. If you prefer an
> >> enum with USBCNT_DONTKNOW as a return value, make a decision.
> > 
> > Did I say anything about "USBCNT_DONTKNOW" above please?
> > 
> > Sorry, I also lost context of this thread as it was dead for more than a
> > month.
> 
> As I described on the IRC. We've got to have a way to signal U-Boot code
> that our hardware isn't capable of knowing if cable is connected, thus
> #ifdef all related code or introduce 3-valued enum.

OK, so I guess a weak default implementation returning -ENOTSUP would work.

> >>> The whole patchset is a mix of completely unrelated things which should
> >>> go through different trees. Can the patchset be reordered/split in some
> >>> reasonable chunks ? There are fixes which should go in immediatelly and
> >>> then features which should go in for -next.
> >> 
> >> Not exactly unrelated, most of it should be applied in this particular
> >> order. It would be less chaotic had it been accepted in one piece.
> > 
> > Please elaborate why can the fixes not go first and features second.
> > Thank you.
> 
> It's because of silly relationships between some of these patches. ie.
> am335x SPL build process just blew (too little ROM), leaving its
> codebase in unbisectable state, after I added some more code to DFU
> implementation. am335x's SPL had to be disabled first, and I consider it
> a change on the feature list.
> 
> I've reordered the fixes I could, but I guess it doesn't matter anymore,
> now that -next is out.
> 
> Please ack applicable USB patches on the next patchset version or
> propose a different solution.

Will check.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v4 03/13] common: fixed linker-list example
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 03/13] common: fixed linker-list example Mateusz Zalega
@ 2014-04-15 13:36     ` Marek Vasut
  0 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-04-15 13:36 UTC (permalink / raw)
  To: u-boot

On Tuesday, April 15, 2014 at 03:06:51 PM, Mateusz Zalega wrote:
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

You are missing a commit message here. Please fix that and add:

Acked-by: Marek Vasut <marex@denx.de>
[...]
Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-04-15 13:38     ` Marek Vasut
  2014-04-15 14:23     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-04-15 13:38 UTC (permalink / raw)
  To: u-boot

On Tuesday, April 15, 2014 at 03:06:52 PM, Mateusz Zalega wrote:
> Former usb_cable_connected() patch broke compilation of boards which do
> not support this feature.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

I suggest we go for the weak default implementation of usb_cable_connected() 
which would return -ENOTSUP in the default case. Override with board-specific 
stuff if needed.

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-04-15 13:39     ` Marek Vasut
  2014-04-15 14:28     ` Lukasz Majewski
  2014-04-16  4:23     ` Jaehoon Chung
  2 siblings, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-04-15 13:39 UTC (permalink / raw)
  To: u-boot

On Tuesday, April 15, 2014 at 03:06:57 PM, Mateusz Zalega wrote:
> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

Changelog is missing on all patches in this series !

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
  2014-04-15 13:38     ` Marek Vasut
@ 2014-04-15 14:23     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-15 14:23 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Former usb_cable_connected() patch broke compilation of boards which
> do not support this feature.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  common/cmd_usb_mass_storage.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 5f557d5..2f69a53 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -42,6 +42,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  
>  	g_dnl_register("ums");
>  
> +#ifdef CONFIG_USB_CABLE_CHECK
>  	/* Timeout unit: seconds */
>  	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
>  
> @@ -65,6 +66,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		}
>  		puts("\r\n");
>  	}
> +#endif
>  
>  	while (1) {
>  		usb_gadget_handle_interrupts();

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init()
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-04-15 14:24     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-15 14:24 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> In some cases MMC was still uninitialized while media capacity check,
> leading to broken ums command.
> 
> Tested on Samsung Goni.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  board/samsung/common/ums.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..dec2963 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -37,8 +37,8 @@ static struct ums ums_dev = {
>  
>  static struct ums *ums_disk_init(struct mmc *mmc)
>  {
> -	uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> -	uint64_t ums_end_sector = UMS_NUM_SECTORS + UMS_START_SECTOR;
> +	const uint64_t mmc_end_sector = mmc->capacity / SECTOR_SIZE;
> +	const uint64_t ums_end_sector = UMS_NUM_SECTORS +
> UMS_START_SECTOR; 
>  	if (!mmc_end_sector) {
>  		error("MMC capacity is not valid");
> @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
>  
>  struct ums *ums_init(unsigned int dev_num)
>  {
> -	struct mmc *mmc = NULL;
> +	struct mmc *mmc = find_mmc_device(dev_num);
>  
> -	mmc = find_mmc_device(dev_num);
> -	if (!mmc)
> +	if (!mmc || mmc_init(mmc))
>  		return NULL;
> -
>  	return ums_disk_init(mmc);
>  }

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-04-15 14:25     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-15 14:25 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Future patches will make DFU too large to fit in this board's SPL
> build.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  include/configs/am335x_evm.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/configs/am335x_evm.h
> b/include/configs/am335x_evm.h index 4147f9f..670e3f1 100644
> --- a/include/configs/am335x_evm.h
> +++ b/include/configs/am335x_evm.h
> @@ -312,6 +312,7 @@
>  #endif
>  
>  /* USB Device Firmware Update support */
> +#ifndef CONFIG_SPL_BUILD
>  #define CONFIG_DFU_FUNCTION
>  #define CONFIG_DFU_MMC
>  #define CONFIG_CMD_DFU
> @@ -354,6 +355,7 @@
>  	DFU_ALT_INFO_MMC \
>  	DFU_ALT_INFO_RAM \
>  	DFU_ALT_INFO_NAND
> +#endif
>  
>  /*
>   * Default to using SPI for environment, etc.

Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
  2014-04-15 13:39     ` Marek Vasut
@ 2014-04-15 14:28     ` Lukasz Majewski
  2014-04-16  4:23     ` Jaehoon Chung
  2 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-15 14:28 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  common/cmd_dfu.c                    |  3 +-
>  common/cmd_thordown.c               |  3 +-
>  common/cmd_usb_mass_storage.c       |  2 +-
>  drivers/usb/gadget/f_dfu.c          |  3 ++
>  drivers/usb/gadget/f_mass_storage.c |  3 ++
>  drivers/usb/gadget/f_thor.c         |  2 ++
>  drivers/usb/gadget/g_dnl.c          | 64
> ++++++++++++++++---------------------
> include/dfu.h                       |  7 ----
> include/g_dnl.h                     | 24 ++++++++++++++
> include/thor.h                      |  8 -----
> include/usb_mass_storage.h          |  8 ----- 11 files changed, 63
> insertions(+), 64 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 5547678..a03538d 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	char *s = "dfu";
>  	int ret, i = 0;
>  
>  	ret = dfu_init_env_entities(interface,
> simple_strtoul(devstring, @@ -38,7 +37,7 @@ static int
> do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int
> controller_index = simple_strtoul(usb_controller, NULL, 0);
> board_usb_init(controller_index, USB_INIT_DEVICE); 
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
>  		if (dfu_reset())
>  			/*
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index c4b3511..2dd7509 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	const char *s = "thor";
>  	int ret;
>  
>  	puts("TIZEN \"THOR\" Downloader\n");
> @@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int
> argc, char * const argv[]) goto exit;
>  	}
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_thor");
>  
>  	ret = thor_init();
>  	if (ret) {
> diff --git a/common/cmd_usb_mass_storage.c
> b/common/cmd_usb_mass_storage.c index 2f69a53..ab10ea6 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	g_dnl_register("ums");
> +	g_dnl_register("usb_dnl_ums");
>  
>  #ifdef CONFIG_USB_CABLE_CHECK
>  	/* Timeout unit: seconds */
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index de75ff1..1b1e179 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -24,6 +24,7 @@
>  #include <linux/usb/composite.h>
>  
>  #include <dfu.h>
> +#include <g_dnl.h>
>  #include "f_dfu.h"
>  
>  struct f_dfu {
> @@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
>  
>  	return dfu_bind_config(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
> diff --git a/drivers/usb/gadget/f_mass_storage.c
> b/drivers/usb/gadget/f_mass_storage.c index f896169..f88bb12 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -255,6 +255,7 @@
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  #include <usb/lin_gadget_compat.h>
> +#include <g_dnl.h>
>  
>  /*------------------------------------------------------------------------*/
>  
> @@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
>  
>  	return 0;
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index f5c0224..59d246d 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
>  	debug("%s:\n", __func__);
>  	return thor_func_init(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index dd95afe..3575aca 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -41,7 +41,6 @@
>  
>  #define DRIVER_VERSION		"usb_dnl 2.0"
>  
> -static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
>  static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
> @@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev
> *cdev) free(cdev->config);
>  	cdev->config = NULL;
>  	debug("%s: calling usb_gadget_disconnect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_disconnect(gadget);
>  
>  	return 0;
>  }
>  
> +static inline struct g_dnl_bind_callback *
> g_dnl_bind_callback_first(void) +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback *
> g_dnl_bind_callback_end(void) +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
> +	struct g_dnl_bind_callback *callback =
> g_dnl_bind_callback_first(); 
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
>  	      __func__, c, c->cdev);
>  
> -	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +	for (; callback != g_dnl_bind_callback_end(); callback++)
> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
>  
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +209,12 @@ static int g_dnl_bind(struct usb_composite_dev
> *cdev) device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +			__func__, gadget->name);
>  		device_desc.bcdDevice =
> __constant_cpu_to_le16(0x9999); }
>  
>  	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname,
> gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_connect(gadget);
>  
>  	return 0;
> @@ -227,36 +233,22 @@ static struct usb_composite_driver g_dnl_driver
> = { .unbind = g_dnl_unbind,
>  };
>  
> -int g_dnl_register(const char *type)
> +/*
> + * NOTICE:
> + * Registering via USB function name won't be necessary after
> rewriting
> + * g_dnl to support multiple USB functions.
> + */
> +int g_dnl_register(const char *name)
>  {
> -	/* The largest function name is 4 */
> -	static char name[sizeof(shortname) + 4];
> -	int ret;
> -
> -	if (!strcmp(type, "dfu")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "ums")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "thor")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else {
> -		printf("%s: unknown command: %s\n", __func__, type);
> -		return -EINVAL;
> -	}
> +	int ret = usb_composite_register(&g_dnl_driver);
>  
> +	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
>  	g_dnl_driver.name = name;
>  
> -	debug("%s: g_dnl_driver.name: %s\n", __func__,
> g_dnl_driver.name);
> -	ret = usb_composite_register(&g_dnl_driver);
> -
>  	if (ret) {
>  		printf("%s: failed!, error: %d\n", __func__, ret);
>  		return ret;
>  	}
> -
>  	return 0;
>  }
>  
> diff --git a/include/dfu.h b/include/dfu.h
> index dcd3215..2409168 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -168,12 +168,5 @@ static inline int dfu_fill_entity_ram(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_ */
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 8f813c2..fb20bf0 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -10,6 +10,30 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> +#include <linux/usb/composite.h>
> +#include <linker_lists.h>
> +
> +/*
> + * @usb_fname: unescaped USB function name
> + * @callback_ptr: bind callback, one per function name
> + */
> +#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
> +	ll_entry_declare(struct g_dnl_bind_callback, \
> +			__usb_function_name_##usb_fname, \
> +			g_dnl_bind_callbacks) = { \
> +				.usb_function_name = #usb_fname, \
> +				.fptr = callback_ptr \
> +			}
> +
> +typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
> +
> +/* used in Gadget downloader callback linker list */
> +struct g_dnl_bind_callback
> +{
> +	const char *usb_function_name;
> +	g_dnl_bind_callback_f fptr;
> +};
> +
>  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> diff --git a/include/thor.h b/include/thor.h
> index afeade4..5051be7 100644
> --- a/include/thor.h
> +++ b/include/thor.h
> @@ -15,13 +15,5 @@
>  
>  int thor_handle(void);
>  int thor_init(void);
> -
> -#ifdef CONFIG_THOR_FUNCTION
>  int thor_add(struct usb_configuration *c);
> -#else
> -int thor_add(struct usb_configuration *c)
> -{
> -	return 0;
> -}
> -#endif
>  #endif /* __THOR_H_ */
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 058dcf1..ed46064 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -40,13 +40,5 @@ int fsg_init(struct ums *);
>  void fsg_cleanup(void);
>  struct ums *ums_init(unsigned int);
>  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__ */

Acked-by: Lukasz Majewski <l.majewski@samsung.com>

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
  2014-04-15 13:39     ` Marek Vasut
  2014-04-15 14:28     ` Lukasz Majewski
@ 2014-04-16  4:23     ` Jaehoon Chung
  2014-04-16  9:25       ` Mateusz Zalega
  2 siblings, 1 reply; 127+ messages in thread
From: Jaehoon Chung @ 2014-04-16  4:23 UTC (permalink / raw)
  To: u-boot

Hi, Mateusz.

ERROR: "foo * bar" should be "foo *bar"
#701: FILE: drivers/usb/gadget/g_dnl.c:104:
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)

ERROR: "foo * bar" should be "foo *bar"
#707: FILE: drivers/usb/gadget/g_dnl.c:110:
+static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)

ERROR: open brace '{' following struct go on the same line
#842: FILE: include/g_dnl.h:32:
+struct g_dnl_bind_callback
+{

Best Regards,
Jaehoon Chung

On 04/15/2014 10:06 PM, Mateusz Zalega wrote:
> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  common/cmd_dfu.c                    |  3 +-
>  common/cmd_thordown.c               |  3 +-
>  common/cmd_usb_mass_storage.c       |  2 +-
>  drivers/usb/gadget/f_dfu.c          |  3 ++
>  drivers/usb/gadget/f_mass_storage.c |  3 ++
>  drivers/usb/gadget/f_thor.c         |  2 ++
>  drivers/usb/gadget/g_dnl.c          | 64 ++++++++++++++++---------------------
>  include/dfu.h                       |  7 ----
>  include/g_dnl.h                     | 24 ++++++++++++++
>  include/thor.h                      |  8 -----
>  include/usb_mass_storage.h          |  8 -----
>  11 files changed, 63 insertions(+), 64 deletions(-)
> 
> diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
> index 5547678..a03538d 100644
> --- a/common/cmd_dfu.c
> +++ b/common/cmd_dfu.c
> @@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	char *s = "dfu";
>  	int ret, i = 0;
>  
>  	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
> @@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	int controller_index = simple_strtoul(usb_controller, NULL, 0);
>  	board_usb_init(controller_index, USB_INIT_DEVICE);
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_dfu");
>  	while (1) {
>  		if (dfu_reset())
>  			/*
> diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
> index c4b3511..2dd7509 100644
> --- a/common/cmd_thordown.c
> +++ b/common/cmd_thordown.c
> @@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  	char *interface = argv[2];
>  	char *devstring = argv[3];
>  
> -	const char *s = "thor";
>  	int ret;
>  
>  	puts("TIZEN \"THOR\" Downloader\n");
> @@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>  		goto exit;
>  	}
>  
> -	g_dnl_register(s);
> +	g_dnl_register("usb_dnl_thor");
>  
>  	ret = thor_init();
>  	if (ret) {
> diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
> index 2f69a53..ab10ea6 100644
> --- a/common/cmd_usb_mass_storage.c
> +++ b/common/cmd_usb_mass_storage.c
> @@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
>  		return CMD_RET_FAILURE;
>  	}
>  
> -	g_dnl_register("ums");
> +	g_dnl_register("usb_dnl_ums");
>  
>  #ifdef CONFIG_USB_CABLE_CHECK
>  	/* Timeout unit: seconds */
> diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
> index de75ff1..1b1e179 100644
> --- a/drivers/usb/gadget/f_dfu.c
> +++ b/drivers/usb/gadget/f_dfu.c
> @@ -24,6 +24,7 @@
>  #include <linux/usb/composite.h>
>  
>  #include <dfu.h>
> +#include <g_dnl.h>
>  #include "f_dfu.h"
>  
>  struct f_dfu {
> @@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
>  
>  	return dfu_bind_config(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
> diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
> index f896169..f88bb12 100644
> --- a/drivers/usb/gadget/f_mass_storage.c
> +++ b/drivers/usb/gadget/f_mass_storage.c
> @@ -255,6 +255,7 @@
>  #include <linux/usb/gadget.h>
>  #include <linux/usb/composite.h>
>  #include <usb/lin_gadget_compat.h>
> +#include <g_dnl.h>
>  
>  /*------------------------------------------------------------------------*/
>  
> @@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
>  
>  	return 0;
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
> diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
> index f5c0224..59d246d 100644
> --- a/drivers/usb/gadget/f_thor.c
> +++ b/drivers/usb/gadget/f_thor.c
> @@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
>  	debug("%s:\n", __func__);
>  	return thor_func_init(c);
>  }
> +
> +DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
> diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
> index dd95afe..3575aca 100644
> --- a/drivers/usb/gadget/g_dnl.c
> +++ b/drivers/usb/gadget/g_dnl.c
> @@ -41,7 +41,6 @@
>  
>  #define DRIVER_VERSION		"usb_dnl 2.0"
>  
> -static const char shortname[] = "usb_dnl_";
>  static const char product[] = "USB download gadget";
>  static char g_dnl_serial[MAX_STRING_SERIAL];
>  static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
> @@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
>  	free(cdev->config);
>  	cdev->config = NULL;
>  	debug("%s: calling usb_gadget_disconnect for "
> -			"controller '%s'\n", shortname, gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_disconnect(gadget);
>  
>  	return 0;
>  }
>  
> +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)
> +{
> +	return ll_entry_start(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
> +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)
> +{
> +	return ll_entry_end(struct g_dnl_bind_callback,
> +				g_dnl_bind_callbacks);
> +}
> +
>  static int g_dnl_do_config(struct usb_configuration *c)
>  {
>  	const char *s = c->cdev->driver->name;
> -	int ret = -1;
> +	struct g_dnl_bind_callback *callback = g_dnl_bind_callback_first();
>  
>  	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
>  	      __func__, c, c->cdev);
>  
> -	printf("GADGET DRIVER: %s\n", s);
> -	if (!strcmp(s, "usb_dnl_dfu"))
> -		ret = dfu_add(c);
> -	else if (!strcmp(s, "usb_dnl_ums"))
> -		ret = fsg_add(c);
> -	else if (!strcmp(s, "usb_dnl_thor"))
> -		ret = thor_add(c);
> -
> -	return ret;
> +	for (; callback != g_dnl_bind_callback_end(); callback++)
> +		if (!strcmp(s, callback->usb_function_name))
> +			return callback->fptr(c);
> +	return -ENODEV;
>  }
>  
>  static int g_dnl_config_register(struct usb_composite_dev *cdev)
> @@ -203,12 +209,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
>  		device_desc.bcdDevice = cpu_to_le16(gcnum);
>  	else {
>  		debug("%s: controller '%s' not recognized\n",
> -			shortname, gadget->name);
> +			__func__, gadget->name);
>  		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
>  	}
>  
>  	debug("%s: calling usb_gadget_connect for "
> -			"controller '%s'\n", shortname, gadget->name);
> +			"controller '%s'\n", __func__, gadget->name);
>  	usb_gadget_connect(gadget);
>  
>  	return 0;
> @@ -227,36 +233,22 @@ static struct usb_composite_driver g_dnl_driver = {
>  	.unbind = g_dnl_unbind,
>  };
>  
> -int g_dnl_register(const char *type)
> +/*
> + * NOTICE:
> + * Registering via USB function name won't be necessary after rewriting
> + * g_dnl to support multiple USB functions.
> + */
> +int g_dnl_register(const char *name)
>  {
> -	/* The largest function name is 4 */
> -	static char name[sizeof(shortname) + 4];
> -	int ret;
> -
> -	if (!strcmp(type, "dfu")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "ums")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else if (!strcmp(type, "thor")) {
> -		strcpy(name, shortname);
> -		strcat(name, type);
> -	} else {
> -		printf("%s: unknown command: %s\n", __func__, type);
> -		return -EINVAL;
> -	}
> +	int ret = usb_composite_register(&g_dnl_driver);
>  
> +	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
>  	g_dnl_driver.name = name;
>  
> -	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
> -	ret = usb_composite_register(&g_dnl_driver);
> -
>  	if (ret) {
>  		printf("%s: failed!, error: %d\n", __func__, ret);
>  		return ret;
>  	}
> -
>  	return 0;
>  }
>  
> diff --git a/include/dfu.h b/include/dfu.h
> index dcd3215..2409168 100644
> --- a/include/dfu.h
> +++ b/include/dfu.h
> @@ -168,12 +168,5 @@ static inline int dfu_fill_entity_ram(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_ */
> diff --git a/include/g_dnl.h b/include/g_dnl.h
> index 8f813c2..fb20bf0 100644
> --- a/include/g_dnl.h
> +++ b/include/g_dnl.h
> @@ -10,6 +10,30 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> +#include <linux/usb/composite.h>
> +#include <linker_lists.h>
> +
> +/*
> + * @usb_fname: unescaped USB function name
> + * @callback_ptr: bind callback, one per function name
> + */
> +#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
> +	ll_entry_declare(struct g_dnl_bind_callback, \
> +			__usb_function_name_##usb_fname, \
> +			g_dnl_bind_callbacks) = { \
> +				.usb_function_name = #usb_fname, \
> +				.fptr = callback_ptr \
> +			}
> +
> +typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
> +
> +/* used in Gadget downloader callback linker list */
> +struct g_dnl_bind_callback
> +{
> +	const char *usb_function_name;
> +	g_dnl_bind_callback_f fptr;
> +};
> +
>  int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
>  int g_dnl_register(const char *s);
>  void g_dnl_unregister(void);
> diff --git a/include/thor.h b/include/thor.h
> index afeade4..5051be7 100644
> --- a/include/thor.h
> +++ b/include/thor.h
> @@ -15,13 +15,5 @@
>  
>  int thor_handle(void);
>  int thor_init(void);
> -
> -#ifdef CONFIG_THOR_FUNCTION
>  int thor_add(struct usb_configuration *c);
> -#else
> -int thor_add(struct usb_configuration *c)
> -{
> -	return 0;
> -}
> -#endif
>  #endif /* __THOR_H_ */
> diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
> index 058dcf1..ed46064 100644
> --- a/include/usb_mass_storage.h
> +++ b/include/usb_mass_storage.h
> @@ -40,13 +40,5 @@ int fsg_init(struct ums *);
>  void fsg_cleanup(void);
>  struct ums *ums_init(unsigned int);
>  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__ */
> 

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

* [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API
  2014-04-16  4:23     ` Jaehoon Chung
@ 2014-04-16  9:25       ` Mateusz Zalega
  0 siblings, 0 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-16  9:25 UTC (permalink / raw)
  To: u-boot

On 04/16/14 06:23, Jaehoon Chung wrote:
> Hi, Mateusz.
> 
> ERROR: "foo * bar" should be "foo *bar"
> #701: FILE: drivers/usb/gadget/g_dnl.c:104:
> +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_first(void)
> 
> ERROR: "foo * bar" should be "foo *bar"
> #707: FILE: drivers/usb/gadget/g_dnl.c:110:
> +static inline struct g_dnl_bind_callback * g_dnl_bind_callback_end(void)
> 
> ERROR: open brace '{' following struct go on the same line
> #842: FILE: include/g_dnl.h:32:
> +struct g_dnl_bind_callback
> +{

ack

-- 
Mateusz Zalega
Samsung R&D Institute Poland

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

* [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc.
  2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
                   ` (11 preceding siblings ...)
  2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
@ 2014-04-28 19:13 ` Mateusz Zalega
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
                     ` (11 more replies)
  12 siblings, 12 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Patchset contains fixes for:
* DFU write issues
* USB cable detection
* ums command
* U-Boot's base framework (headers)
* fixed base DFU offsets
and features:
* convenient USB Gadget registration
* Samsung Goni DFU, UMS, GPT bringup
also:
* am335x will no longer support DFU in SPL builds

There _are_ dependencies between these patches. ie. Goni stuff depends on the
new Gadget registration API, which in turn depends on disabling DFU in
am335x's SPL build so that some poor soul wouldn't trip over a board-breaking
commit while running git bisect, and I could have not written correct code
without fixing u-boot headers first...

Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Marek Vasut <marex@denx.de>

---
Changes since v1:
- reordered "USB: gadget: added a saner gadget downloader registration API"
- fixed a bug related to usb_cable_connected() which broke previous Goni
  configuration patches
- disabled DFU in TI's am335x SPL build due to insufficient ROM capacity
since v2:
in "USB: gadget: added a saner gadget downloader":
fixed issues which came to [Marek Vasut]'s attention:
- fixed coding style issues
- added convenient macro wrappers for used ll_entry_declare
since v3:
- grouped patches related to common topics
in "ums: always initialize mmc before ums_disk_init()"
- Added const attribute of ums_disk_init introduced type warnings. It would
  take a lot of changes to MMC core code to fix it, so it was dropped, even
  though ums_disk_init shouldn't and doesn't change struct mmc it is passed.
since v4:
- added detailed changelog to each patch
- removed patches which can go in separately:
  "common: fixed linker-list example"
  "mmc: postponed needless timer initialization"
in "dfu: mmc: raw data write fix":
- commit message was made more detailed
- the patch was split in two, introducing
  "dfu: mmc: change offset base handling" to the patchset
in "usb: dfu: fix boards wo USB cable detection":
- removed CONFIG_USB_CABLE_CHECK
- moved implementation from usb.h (reserved for USB host code)
  to USB gadget
- renamed usb_cable_connected to g_dnl_usb_cable_connected
- removed defunct board implementations (origen, universal)
- added __weak default implementation and removed ifdef'd blocks around
  dependent code
in "gadget: added a saner gadget downloader"
- fixed coding style issues reported by [Jaehoon Chung] 
---

Mateusz Zalega (12):
  mmc: mmc header fix
  part: header fix
  usb: dfu: fix boards wo USB cable detection
  dfu: mmc: raw data write fix
  dfu: mmc: change offset base handling
  ums: always initialize mmc before ums_disk_init()
  am335x: dfu: disable DFU in am335x_evm SPL build
  USB: gadget: added a saner gadget downloader registration API
  arm: goni: Update configuration for Goni target
  arm: goni: dfu: Add support for DFU to Goni target
  arm: goni: enable GPT command
  arm: goni: enable USB Mass Storage

 README                                   |   7 --
 board/samsung/common/ums.c               |   6 +-
 board/samsung/goni/goni.c                |   8 +++
 board/samsung/origen/origen.c            |   7 --
 board/samsung/trats/trats.c              |   4 +-
 board/samsung/trats2/trats2.c            |   4 +-
 board/samsung/universal_c210/universal.c |   7 --
 common/cmd_dfu.c                         |   3 +-
 common/cmd_thordown.c                    |   3 +-
 common/cmd_usb_mass_storage.c            |  10 ++-
 drivers/dfu/dfu_mmc.c                    | 109 ++++++++++++++++++-----------
 drivers/usb/gadget/f_dfu.c               |   3 +
 drivers/usb/gadget/f_mass_storage.c      |  11 +--
 drivers/usb/gadget/f_thor.c              |   2 +
 drivers/usb/gadget/g_dnl.c               |  69 +++++++++----------
 include/configs/am335x_evm.h             |  10 +--
 include/configs/exynos4-dt.h             |   1 -
 include/configs/s5p_goni.h               | 113 +++++++++++++++++++++----------
 include/configs/trats.h                  |   2 +-
 include/configs/trats2.h                 |   2 +-
 include/dfu.h                            |  12 ----
 include/g_dnl.h                          |  24 +++++++
 include/mmc.h                            |   1 +
 include/part.h                           |   1 +
 include/thor.h                           |   8 ---
 include/usb.h                            |  10 ---
 include/usb_mass_storage.h               |   8 ---
 27 files changed, 247 insertions(+), 198 deletions(-)

-- 
1.9.0

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

* [U-Boot] [PATCH v5 01/12] mmc: mmc header fix
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-04-30  8:35     ` Lukasz Majewski
  2014-05-05  7:45     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 02/12] part: " Mateusz Zalega
                     ` (10 subsequent siblings)
  11 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Structure definition used type block_dev_desc_t, defined in part.h, which
wasn't included in mmc.h. It worked only in circumstances when common.h,
or another header using part.h was incuded in implementation files.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
---
Changes since v1:
- none
---
 include/mmc.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/mmc.h b/include/mmc.h
index 42d0125..bc11f45 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -12,6 +12,7 @@
 
 #include <linux/list.h>
 #include <linux/compiler.h>
+#include <part.h>
 
 #define SD_VERSION_SD	0x20000
 #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
-- 
1.9.0

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

* [U-Boot] [PATCH v5 02/12] part: header fix
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-04-30  8:33     ` Lukasz Majewski
  2014-05-05  7:48     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
                     ` (9 subsequent siblings)
  11 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Implementation made use of types defined in common.h, even though it
wasn't #included. It worked in circumstances when .c files included
every needed header (all).

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- none
---
 include/part.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/part.h b/include/part.h
index 4beb6db..53532dc 100644
--- a/include/part.h
+++ b/include/part.h
@@ -8,6 +8,7 @@
 #define _PART_H
 
 #include <ide.h>
+#include <common.h>
 
 typedef struct block_dev_desc {
 	int		if_type;	/* type of the interface */
-- 
1.9.0

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

* [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 02/12] part: " Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-04-30  8:18     ` Marek Vasut
  2014-05-05  7:50     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix Mateusz Zalega
                     ` (8 subsequent siblings)
  11 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Former usb_cable_connected() patch broke compilation of boards which do
not support this feature.

I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and added
its default implementation to gadget downloader driver code. There's
only one driver of this kind and it's unlikely there'll be another, so
there's no point in keeping it in /common.

Previously this function was declared in usb.h. I've moved it, since
it's more appropriate to keep it in g_dnl.h - usb.h seems to be intended
for USB host implementation.

Existing code, confronted with default -EOPNOTSUPP return value,
continues as if the cable was connected.

CONFIG_USB_CABLE_CHECK was removed.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Marek Vasut <marex@denx.de>
---
Changes since v4:
- removed CONFIG_USB_CABLE_CHECK
- moved implementation from usb.h (reserved for USB host code)
  to USB gadget
- renamed usb_cable_connected to g_dnl_usb_cable_connected
- removed defunct board implementations (origen, universal)
- added __weak default implementation and removed ifdef'd blocks around
  dependent code
---
 README                                   |  7 -------
 board/samsung/origen/origen.c            |  7 -------
 board/samsung/trats/trats.c              |  4 +---
 board/samsung/trats2/trats2.c            |  4 +---
 board/samsung/universal_c210/universal.c |  7 -------
 common/cmd_usb_mass_storage.c            |  8 ++++++--
 drivers/usb/gadget/f_mass_storage.c      |  8 ++++----
 drivers/usb/gadget/g_dnl.c               |  5 +++++
 include/configs/exynos4-dt.h             |  1 -
 include/g_dnl.h                          |  1 +
 include/usb.h                            | 10 ----------
 11 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/README b/README
index 12758dc..b973344 100644
--- a/README
+++ b/README
@@ -1484,13 +1484,6 @@ The following options need to be configured:
 			for your device
 			- CONFIG_USBD_PRODUCTID 0xFFFF
 
-		Some USB device drivers may need to check USB cable attachment.
-		In this case you can enable following config in BoardName.h:
-			CONFIG_USB_CABLE_CHECK
-			This enables function definition:
-			- usb_cable_connected() in include/usb.h
-			Implementation of this function is board-specific.
-
 - ULPI Layer Support:
 		The ULPI (UTMI Low Pin (count) Interface) PHYs are supported via
 		the generic ULPI layer. The generic layer accesses the ULPI PHY
diff --git a/board/samsung/origen/origen.c b/board/samsung/origen/origen.c
index d502f02..a539267 100644
--- a/board/samsung/origen/origen.c
+++ b/board/samsung/origen/origen.c
@@ -30,13 +30,6 @@ int board_usb_init(int index, enum usb_init_type init)
 	return 0;
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
-{
-	return 0;
-}
-#endif
-
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int exynos_early_init_f(void)
 {
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index 7c79e7b..ab0ad1d 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -430,8 +430,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	return s3c_udc_probe(&s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
+int g_dnl_board_usb_cable_connected(void)
 {
 	struct pmic *muic = pmic_get("MAX8997_MUIC");
 	if (!muic)
@@ -440,7 +439,6 @@ int usb_cable_connected(void)
 	return !!muic->chrg->chrg_type(muic);
 }
 #endif
-#endif
 
 static void pmic_reset(void)
 {
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index f558ef9..4709525 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -312,8 +312,7 @@ int board_usb_init(int index, enum usb_init_type init)
 	return s3c_udc_probe(&s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
+int g_dnl_board_usb_cable_connected(void)
 {
 	struct pmic *muic = pmic_get("MAX77693_MUIC");
 	if (!muic)
@@ -322,7 +321,6 @@ int usb_cable_connected(void)
 	return !!muic->chrg->chrg_type(muic);
 }
 #endif
-#endif
 
 static int pmic_init_max77686(void)
 {
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index f9d71b6..8e49195 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -197,13 +197,6 @@ int board_usb_init(int index, enum usb_init_type init)
 	return s3c_udc_probe(&s5pc210_otg_data);
 }
 
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void)
-{
-	return 0;
-}
-#endif
-
 int exynos_early_init_f(void)
 {
 	wdt_stop();
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 5f557d5..14a5b6a 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -45,10 +45,14 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
 
-	if (!usb_cable_connected()) {
+	if (!g_dnl_board_usb_cable_connected()) {
+		/*
+		 * Won't execute if we don't know whether the cable is
+		 * connected.
+		 */
 		puts("Please connect USB cable.\n");
 
-		while (!usb_cable_connected()) {
+		while (!g_dnl_board_usb_cable_connected()) {
 			if (ctrlc()) {
 				puts("\rCTRL+C - Operation aborted.\n");
 				goto exit;
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index f896169..4fae5cd 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -243,7 +243,7 @@
 #include <config.h>
 #include <malloc.h>
 #include <common.h>
-#include <usb.h>
+#include <g_dnl.h>
 
 #include <linux/err.h>
 #include <linux/usb/ch9.h>
@@ -680,11 +680,11 @@ static int sleep_thread(struct fsg_common *common)
 			/* Handle CTRL+C */
 			if (ctrlc())
 				return -EPIPE;
-#ifdef CONFIG_USB_CABLE_CHECK
+
 			/* Check cable connection */
-			if (!usb_cable_connected())
+			if (!g_dnl_board_usb_cable_connected())
 				return -EIO;
-#endif
+
 			k = 0;
 		}
 
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index dd95afe..973d737 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -152,6 +152,11 @@ __weak int g_dnl_get_board_bcd_device_number(int gcnum)
 	return gcnum;
 }
 
+__weak int g_dnl_board_usb_cable_connected(void)
+{
+	return -EOPNOTSUPP;
+}
+
 static int g_dnl_get_bcd_device_number(struct usb_composite_dev *cdev)
 {
 	struct usb_gadget *gadget = cdev->gadget;
diff --git a/include/configs/exynos4-dt.h b/include/configs/exynos4-dt.h
index 2040bf7..cbd2d20 100644
--- a/include/configs/exynos4-dt.h
+++ b/include/configs/exynos4-dt.h
@@ -127,7 +127,6 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
-#define CONFIG_USB_CABLE_CHECK
 
 #define CONFIG_CMD_USB_MASS_STORAGE
 #define CONFIG_USB_GADGET_MASS_STORAGE
diff --git a/include/g_dnl.h b/include/g_dnl.h
index 8f813c2..f4e8d10 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -11,6 +11,7 @@
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
+int g_dnl_board_usb_cable_connected(void);
 int g_dnl_register(const char *s);
 void g_dnl_unregister(void);
 void g_dnl_set_serialnumber(char *);
diff --git a/include/usb.h b/include/usb.h
index 736730e..d9fedee 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -197,16 +197,6 @@ int board_usb_init(int index, enum usb_init_type init);
  */
 int board_usb_cleanup(int index, enum usb_init_type init);
 
-/*
- * If CONFIG_USB_CABLE_CHECK is set then this function
- * should be defined in board file.
- *
- * @return 1 if cable is connected and 0 otherwise.
- */
-#ifdef CONFIG_USB_CABLE_CHECK
-int usb_cable_connected(void);
-#endif
-
 #ifdef CONFIG_USB_STORAGE
 
 #define USB_MAX_STOR_DEV 5
-- 
1.9.0

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

* [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (2 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-05  8:00     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling Mateusz Zalega
                     ` (7 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

When user attempted to perform a raw write using DFU (vide
dfu_fill_entity_mmc) with MMC interface not initialized before,
get_mmc_blk_size() reported invalid (zero) block size - it wasn't
possible to write ie. a new u-boot image.

This commit fixes that by initializing MMC device before use in
dfu_fill_entity_mmc().

While fixing initialization sequence, I had to change about half of
dfu_fill_entity_mmc's body, so I refactored it on the way to make it,
IMHO, considerably more comprehensible.

Being left as dead code, get_mmc_blk_size() was removed.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v4:
- added more detailed commit message
- converted to C90-style
- split into two patches: write fix and offset interpretation change
---
 drivers/dfu/dfu_mmc.c | 105 +++++++++++++++++++++++++++++++-------------------
 include/dfu.h         |   5 ---
 2 files changed, 65 insertions(+), 45 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 651cfff..b41785d 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -184,66 +184,91 @@ int dfu_read_medium_mmc(struct dfu_entity *dfu, u64 offset, void *buf,
 	return ret;
 }
 
+/*
+ * @param s Parameter string containing space-separated arguments:
+ *	1st:
+ *		raw	(raw read/write)
+ *		fat	(files)
+ *		ext4	(^)
+ *		part	(partition image)
+ *	2nd and 3rd:
+ *		lba_start and lba_size, for raw write
+ *		mmc_dev and mmc_part, for filesystems and part
+ */
 int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 {
-	int dev, part;
-	struct mmc *mmc;
-	block_dev_desc_t *blk_dev;
-	disk_partition_t partinfo;
-	char *st;
+	const char *entity_type;
+	size_t second_arg;
+	size_t third_arg;
 
-	dfu->dev_type = DFU_DEV_MMC;
-	st = strsep(&s, " ");
-	if (!strcmp(st, "mmc")) {
-		dfu->layout = DFU_RAW_ADDR;
-		dfu->data.mmc.lba_start = simple_strtoul(s, &s, 16);
-		dfu->data.mmc.lba_size = simple_strtoul(++s, &s, 16);
-		dfu->data.mmc.lba_blk_size = get_mmc_blk_size(dfu->dev_num);
-	} else if (!strcmp(st, "fat")) {
-		dfu->layout = DFU_FS_FAT;
-	} else if (!strcmp(st, "ext4")) {
-		dfu->layout = DFU_FS_EXT4;
-	} else if (!strcmp(st, "part")) {
-
-		dfu->layout = DFU_RAW_ADDR;
+	struct mmc *mmc;
 
-		dev = simple_strtoul(s, &s, 10);
-		s++;
-		part = simple_strtoul(s, &s, 10);
+	const char *argv[3];
+	const char **parg = argv;
 
-		mmc = find_mmc_device(dev);
-		if (mmc == NULL || mmc_init(mmc)) {
-			printf("%s: could not find mmc device #%d!\n",
-			       __func__, dev);
+	for (; parg < argv + sizeof(argv) / sizeof(*argv); ++parg) {
+		*parg = strsep(&s, " ");
+		if (*parg == NULL) {
+			error("Invalid number of arguments.\n");
 			return -ENODEV;
 		}
+	}
 
-		blk_dev = &mmc->block_dev;
-		if (get_partition_info(blk_dev, part, &partinfo) != 0) {
-			printf("%s: could not find partition #%d on mmc device #%d!\n",
-			       __func__, part, dev);
+	entity_type = argv[0];
+	second_arg = simple_strtoul(argv[1], NULL, 16);
+	third_arg = simple_strtoul(argv[2], NULL, 16);
+
+	mmc = find_mmc_device(dfu->dev_num);
+	if (mmc == NULL) {
+		error("Couldn't find MMC device no. %d.\n", dfu->dev_num);
+		return -ENODEV;
+	}
+
+	if (mmc_init(mmc)) {
+		error("Couldn't init MMC device.\n");
+		return -ENODEV;
+	}
+
+	if (!strcmp(entity_type, "raw")) {
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= second_arg;
+		dfu->data.mmc.lba_size		= third_arg;
+		dfu->data.mmc.lba_blk_size	= mmc->read_bl_len;
+	} else if (!strcmp(entity_type, "part")) {
+		disk_partition_t partinfo;
+		block_dev_desc_t *blk_dev = &mmc->block_dev;
+		int mmcdev = second_arg;
+		int mmcpart = third_arg;
+
+		if (get_partition_info(blk_dev, mmcpart, &partinfo) != 0) {
+			error("Couldn't find part #%d on mmc device #%d\n",
+			      mmcpart, mmcdev);
 			return -ENODEV;
 		}
 
-		dfu->data.mmc.lba_start = partinfo.start;
-		dfu->data.mmc.lba_size = partinfo.size;
-		dfu->data.mmc.lba_blk_size = partinfo.blksz;
-
+		dfu->layout			= DFU_RAW_ADDR;
+		dfu->data.mmc.lba_start		= partinfo.start;
+		dfu->data.mmc.lba_size		= partinfo.size;
+		dfu->data.mmc.lba_blk_size	= partinfo.blksz;
+	} else if (!strcmp(entity_type, "fat")) {
+		dfu->layout = DFU_FS_FAT;
+	} else if (!strcmp(entity_type, "ext4")) {
+		dfu->layout = DFU_FS_EXT4;
 	} else {
-		printf("%s: Memory layout (%s) not supported!\n", __func__, st);
+		error("Memory layout (%s) not supported!\n", entity_type);
 		return -ENODEV;
 	}
 
-	if (dfu->layout == DFU_FS_EXT4 || dfu->layout == DFU_FS_FAT) {
-		dfu->data.mmc.dev = simple_strtoul(s, &s, 10);
-		dfu->data.mmc.part = simple_strtoul(++s, &s, 10);
+	/* if it's NOT a raw write */
+	if (strcmp(entity_type, "raw")) {
+		dfu->data.mmc.dev = second_arg;
+		dfu->data.mmc.part = third_arg;
 	}
 
+	dfu->dev_type = DFU_DEV_MMC;
 	dfu->read_medium = dfu_read_medium_mmc;
 	dfu->write_medium = dfu_write_medium_mmc;
 	dfu->flush_medium = dfu_flush_medium_mmc;
-
-	/* initial state */
 	dfu->inited = 0;
 
 	return 0;
diff --git a/include/dfu.h b/include/dfu.h
index 6c71ecb..dcd3215 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -64,11 +64,6 @@ struct ram_internal_data {
 	unsigned int	size;
 };
 
-static inline unsigned int get_mmc_blk_size(int dev)
-{
-	return find_mmc_device(dev)->read_bl_len;
-}
-
 #define DFU_NAME_SIZE			32
 #define DFU_CMD_BUF_SIZE		128
 #ifndef CONFIG_SYS_DFU_DATA_BUF_SIZE
-- 
1.9.0

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

* [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (3 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-05  8:03     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
                     ` (6 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Previously offsets handled by dfu_fill_entity_mmc(), defined in boards'
CONFIG_DFU_ALT were treated as hexadecimal regardless of their prefix,
which sometimes led to confusion. This patch forces usage of explicit
numerical base prefixes.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Tom Rini <trini@ti.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Introduced in v5.
---
 drivers/dfu/dfu_mmc.c        | 8 ++++++--
 include/configs/am335x_evm.h | 8 ++++----
 include/configs/trats.h      | 2 +-
 include/configs/trats2.h     | 2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index b41785d..5e10ea7 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -215,8 +215,12 @@ int dfu_fill_entity_mmc(struct dfu_entity *dfu, char *s)
 	}
 
 	entity_type = argv[0];
-	second_arg = simple_strtoul(argv[1], NULL, 16);
-	third_arg = simple_strtoul(argv[2], NULL, 16);
+	/*
+	 * Base 0 means we'll accept (prefixed with 0x or 0) base 16, 8,
+	 * with default 10.
+	 */
+	second_arg = simple_strtoul(argv[1], NULL, 0);
+	third_arg = simple_strtoul(argv[2], NULL, 0);
 
 	mmc = find_mmc_device(dfu->dev_num);
 	if (mmc == NULL) {
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index ea9e758..4147f9f 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -320,10 +320,10 @@
 	"boot part 0 1;" \
 	"rootfs part 0 2;" \
 	"MLO fat 0 1;" \
-	"MLO.raw mmc 100 100;" \
-	"u-boot.img.raw mmc 300 400;" \
-	"spl-os-args.raw mmc 80 80;" \
-	"spl-os-image.raw mmc 900 2000;" \
+	"MLO.raw mmc 0x100 0x100;" \
+	"u-boot.img.raw mmc 0x300 0x400;" \
+	"spl-os-args.raw mmc 0x80 0x80;" \
+	"spl-os-image.raw mmc 0x900 0x2000;" \
 	"spl-os-args fat 0 1;" \
 	"spl-os-image fat 0 1;" \
 	"u-boot.img fat 0 1;" \
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 5d8bd60..8461343 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -101,7 +101,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 400;" \
+	"u-boot raw 0x80 0x400;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4210-trats.dtb ext4 0 2;" \
diff --git a/include/configs/trats2.h b/include/configs/trats2.h
index 53d449c..03e88ee 100644
--- a/include/configs/trats2.h
+++ b/include/configs/trats2.h
@@ -91,7 +91,7 @@
 	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_DFU_ALT \
-	"u-boot mmc 80 800;" \
+	"u-boot raw 0x80 0x800;" \
 	"uImage ext4 0 2;" \
 	"modem.bin ext4 0 2;" \
 	"exynos4412-trats2.dtb ext4 0 2;" \
-- 
1.9.0

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

* [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init()
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (4 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-01 20:03     ` Stephen Warren
  2014-05-05  8:05     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
                     ` (5 subsequent siblings)
  11 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

In cases when MMC hadn't been initialized before, ie. by the user or other
subsystem, it was still uninitialized while UMS media capacity check,
leading to broken ums command.

UMS has to initialize resources it uses.

Tested on Samsung Goni.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v3:
- Added const attribute of ums_disk_init introduced type warnings. It would
  take a lot of changes to MMC core code to fix it, so it was dropped, even
  though ums_disk_init shouldn't and doesn't change struct mmc it is passed.
Changes since v4:
- added slightly more detailed commit message 
---
 board/samsung/common/ums.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
index dc155ad..cebabe9 100644
--- a/board/samsung/common/ums.c
+++ b/board/samsung/common/ums.c
@@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
 
 struct ums *ums_init(unsigned int dev_num)
 {
-	struct mmc *mmc = NULL;
+	struct mmc *mmc = find_mmc_device(dev_num);
 
-	mmc = find_mmc_device(dev_num);
-	if (!mmc)
+	if (!mmc || mmc_init(mmc))
 		return NULL;
-
 	return ums_disk_init(mmc);
 }
-- 
1.9.0

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

* [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (5 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-05  8:06     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
                     ` (4 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Future patches will make DFU too large to fit in this board's SPL build.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Acked-by: Tom Rini <trini@ti.com>
Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
---
Changes since v2:
- none
---
 include/configs/am335x_evm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 4147f9f..670e3f1 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -312,6 +312,7 @@
 #endif
 
 /* USB Device Firmware Update support */
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_DFU_FUNCTION
 #define CONFIG_DFU_MMC
 #define CONFIG_CMD_DFU
@@ -354,6 +355,7 @@
 	DFU_ALT_INFO_MMC \
 	DFU_ALT_INFO_RAM \
 	DFU_ALT_INFO_NAND
+#endif
 
 /*
  * Default to using SPI for environment, etc.
-- 
1.9.0

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

* [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (6 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-05  8:07     ` Lukasz Majewski
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target Mateusz Zalega
                     ` (3 subsequent siblings)
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Preprocessor definitions and hardcoded implementation selection in
g_dnl core were replaced by a linker list made of (usb_function_name,
bind_callback) pairs.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Acked-by: Lukasz Majewski <l.majewski@samsung.com>
Acked-by: Marek Vasut <marex@denx.de>
---
Changes since v1:
- reordered
since v2:
- fixed coding style issues reported by [Marek Vasut]
- added convenient macro wrappers for used ll_entry_declare
since v4:
- fixed coding style issues reported by [Jaehoon Chung]
---
 common/cmd_dfu.c                    |  3 +-
 common/cmd_thordown.c               |  3 +-
 common/cmd_usb_mass_storage.c       |  2 +-
 drivers/usb/gadget/f_dfu.c          |  3 ++
 drivers/usb/gadget/f_mass_storage.c |  3 ++
 drivers/usb/gadget/f_thor.c         |  2 ++
 drivers/usb/gadget/g_dnl.c          | 64 ++++++++++++++++---------------------
 include/dfu.h                       |  7 ----
 include/g_dnl.h                     | 23 +++++++++++++
 include/thor.h                      |  8 -----
 include/usb_mass_storage.h          |  8 -----
 11 files changed, 62 insertions(+), 64 deletions(-)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 5547678..a03538d 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -22,7 +22,6 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	char *s = "dfu";
 	int ret, i = 0;
 
 	ret = dfu_init_env_entities(interface, simple_strtoul(devstring,
@@ -38,7 +37,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	int controller_index = simple_strtoul(usb_controller, NULL, 0);
 	board_usb_init(controller_index, USB_INIT_DEVICE);
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_dfu");
 	while (1) {
 		if (dfu_reset())
 			/*
diff --git a/common/cmd_thordown.c b/common/cmd_thordown.c
index c4b3511..2dd7509 100644
--- a/common/cmd_thordown.c
+++ b/common/cmd_thordown.c
@@ -22,7 +22,6 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	char *interface = argv[2];
 	char *devstring = argv[3];
 
-	const char *s = "thor";
 	int ret;
 
 	puts("TIZEN \"THOR\" Downloader\n");
@@ -40,7 +39,7 @@ int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 		goto exit;
 	}
 
-	g_dnl_register(s);
+	g_dnl_register("usb_dnl_thor");
 
 	ret = thor_init();
 	if (ret) {
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 14a5b6a..d8d9efd 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -40,7 +40,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
 		return CMD_RET_FAILURE;
 	}
 
-	g_dnl_register("ums");
+	g_dnl_register("usb_dnl_ums");
 
 	/* Timeout unit: seconds */
 	int cable_ready_timeout = UMS_CABLE_READY_TIMEOUT;
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index de75ff1..1b1e179 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -24,6 +24,7 @@
 #include <linux/usb/composite.h>
 
 #include <dfu.h>
+#include <g_dnl.h>
 #include "f_dfu.h"
 
 struct f_dfu {
@@ -817,3 +818,5 @@ int dfu_add(struct usb_configuration *c)
 
 	return dfu_bind_config(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_dfu, dfu_add);
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 4fae5cd..6374bb9 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -255,6 +255,7 @@
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
 #include <usb/lin_gadget_compat.h>
+#include <g_dnl.h>
 
 /*------------------------------------------------------------------------*/
 
@@ -2778,3 +2779,5 @@ int fsg_init(struct ums *ums_dev)
 
 	return 0;
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_ums, fsg_add);
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index f5c0224..59d246d 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -999,3 +999,5 @@ int thor_add(struct usb_configuration *c)
 	debug("%s:\n", __func__);
 	return thor_func_init(c);
 }
+
+DECLARE_GADGET_BIND_CALLBACK(usb_dnl_thor, thor_add);
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 973d737..743bae5 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -41,7 +41,6 @@
 
 #define DRIVER_VERSION		"usb_dnl 2.0"
 
-static const char shortname[] = "usb_dnl_";
 static const char product[] = "USB download gadget";
 static char g_dnl_serial[MAX_STRING_SERIAL];
 static const char manufacturer[] = CONFIG_G_DNL_MANUFACTURER;
@@ -96,29 +95,36 @@ static int g_dnl_unbind(struct usb_composite_dev *cdev)
 	free(cdev->config);
 	cdev->config = NULL;
 	debug("%s: calling usb_gadget_disconnect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_disconnect(gadget);
 
 	return 0;
 }
 
+static inline struct g_dnl_bind_callback *g_dnl_bind_callback_first(void)
+{
+	return ll_entry_start(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
+static inline struct g_dnl_bind_callback *g_dnl_bind_callback_end(void)
+{
+	return ll_entry_end(struct g_dnl_bind_callback,
+				g_dnl_bind_callbacks);
+}
+
 static int g_dnl_do_config(struct usb_configuration *c)
 {
 	const char *s = c->cdev->driver->name;
-	int ret = -1;
+	struct g_dnl_bind_callback *callback = g_dnl_bind_callback_first();
 
 	debug("%s: configuration: 0x%p composite dev: 0x%p\n",
 	      __func__, c, c->cdev);
 
-	printf("GADGET DRIVER: %s\n", s);
-	if (!strcmp(s, "usb_dnl_dfu"))
-		ret = dfu_add(c);
-	else if (!strcmp(s, "usb_dnl_ums"))
-		ret = fsg_add(c);
-	else if (!strcmp(s, "usb_dnl_thor"))
-		ret = thor_add(c);
-
-	return ret;
+	for (; callback != g_dnl_bind_callback_end(); callback++)
+		if (!strcmp(s, callback->usb_function_name))
+			return callback->fptr(c);
+	return -ENODEV;
 }
 
 static int g_dnl_config_register(struct usb_composite_dev *cdev)
@@ -208,12 +214,12 @@ static int g_dnl_bind(struct usb_composite_dev *cdev)
 		device_desc.bcdDevice = cpu_to_le16(gcnum);
 	else {
 		debug("%s: controller '%s' not recognized\n",
-			shortname, gadget->name);
+			__func__, gadget->name);
 		device_desc.bcdDevice = __constant_cpu_to_le16(0x9999);
 	}
 
 	debug("%s: calling usb_gadget_connect for "
-			"controller '%s'\n", shortname, gadget->name);
+			"controller '%s'\n", __func__, gadget->name);
 	usb_gadget_connect(gadget);
 
 	return 0;
@@ -232,36 +238,22 @@ static struct usb_composite_driver g_dnl_driver = {
 	.unbind = g_dnl_unbind,
 };
 
-int g_dnl_register(const char *type)
+/*
+ * NOTICE:
+ * Registering via USB function name won't be necessary after rewriting
+ * g_dnl to support multiple USB functions.
+ */
+int g_dnl_register(const char *name)
 {
-	/* The largest function name is 4 */
-	static char name[sizeof(shortname) + 4];
-	int ret;
-
-	if (!strcmp(type, "dfu")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "ums")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else if (!strcmp(type, "thor")) {
-		strcpy(name, shortname);
-		strcat(name, type);
-	} else {
-		printf("%s: unknown command: %s\n", __func__, type);
-		return -EINVAL;
-	}
+	int ret = usb_composite_register(&g_dnl_driver);
 
+	debug("%s: g_dnl_driver.name = %s\n", __func__, name);
 	g_dnl_driver.name = name;
 
-	debug("%s: g_dnl_driver.name: %s\n", __func__, g_dnl_driver.name);
-	ret = usb_composite_register(&g_dnl_driver);
-
 	if (ret) {
 		printf("%s: failed!, error: %d\n", __func__, ret);
 		return ret;
 	}
-
 	return 0;
 }
 
diff --git a/include/dfu.h b/include/dfu.h
index dcd3215..2409168 100644
--- a/include/dfu.h
+++ b/include/dfu.h
@@ -168,12 +168,5 @@ static inline int dfu_fill_entity_ram(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_ */
diff --git a/include/g_dnl.h b/include/g_dnl.h
index f4e8d10..1b1b35e 100644
--- a/include/g_dnl.h
+++ b/include/g_dnl.h
@@ -10,6 +10,29 @@
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
+#include <linux/usb/composite.h>
+#include <linker_lists.h>
+
+/*
+ * @usb_fname: unescaped USB function name
+ * @callback_ptr: bind callback, one per function name
+ */
+#define DECLARE_GADGET_BIND_CALLBACK(usb_fname, callback_ptr) \
+	ll_entry_declare(struct g_dnl_bind_callback, \
+			__usb_function_name_##usb_fname, \
+			g_dnl_bind_callbacks) = { \
+				.usb_function_name = #usb_fname, \
+				.fptr = callback_ptr \
+			}
+
+typedef int (*g_dnl_bind_callback_f)(struct usb_configuration *);
+
+/* used in Gadget downloader callback linker list */
+struct g_dnl_bind_callback {
+	const char *usb_function_name;
+	g_dnl_bind_callback_f fptr;
+};
+
 int g_dnl_bind_fixup(struct usb_device_descriptor *, const char *);
 int g_dnl_board_usb_cable_connected(void);
 int g_dnl_register(const char *s);
diff --git a/include/thor.h b/include/thor.h
index afeade4..5051be7 100644
--- a/include/thor.h
+++ b/include/thor.h
@@ -15,13 +15,5 @@
 
 int thor_handle(void);
 int thor_init(void);
-
-#ifdef CONFIG_THOR_FUNCTION
 int thor_add(struct usb_configuration *c);
-#else
-int thor_add(struct usb_configuration *c)
-{
-	return 0;
-}
-#endif
 #endif /* __THOR_H_ */
diff --git a/include/usb_mass_storage.h b/include/usb_mass_storage.h
index 058dcf1..ed46064 100644
--- a/include/usb_mass_storage.h
+++ b/include/usb_mass_storage.h
@@ -40,13 +40,5 @@ int fsg_init(struct ums *);
 void fsg_cleanup(void);
 struct ums *ums_init(unsigned int);
 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.9.0

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

* [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (7 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-04-30 11:24     ` Lukasz Majewski
  2014-05-16  6:53     ` Minkyu Kang
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
                     ` (2 subsequent siblings)
  11 siblings, 2 replies; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Configuration file for GONI has been updated to support FAT file system,
new mmc partitioning scheme and read linux kernel from eMMC instead of
OneNAND.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index 991c43e..b9b66c7 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -17,6 +17,7 @@
 #define CONFIG_S5PC110		1	/* which is in a S5PC110 */
 #define CONFIG_MACH_GONI	1	/* working with Goni */
 
+#include <linux/sizes.h>
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 
 #define CONFIG_ARCH_CPU_INIT
@@ -38,11 +39,9 @@
 #define CONFIG_INITRD_TAG
 #define CONFIG_CMDLINE_EDITING
 
-/*
- * Size of malloc() pool
- * 1MB = 0x100000, 0x100000 = 1024 * 1024
- */
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1 << 20))
+/* Size of malloc() pool.*/
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+
 /*
  * select serial console configuration
  */
@@ -90,30 +89,25 @@
 				",7m(kernel)"\
 				",1m(log)"\
 				",12m(modem)"\
-				",60m(qboot)"\
-				",-(UBI)\0"
+				",60m(qboot)\0"
 
 #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
 
-#define CONFIG_BOOTCOMMAND	"run ubifsboot"
+#define CONFIG_BOOTCOMMAND	"run mmcboot"
 
 #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
 
-#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext2" \
+#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \
 		" ${console} ${meminfo}"
 
 #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
 
-#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8 ubi.mtd=3 ubi.mtd=6" \
-		" rootfstype=cramfs " CONFIG_COMMON_BOOT
+#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4 " \
+			CONFIG_COMMON_BOOT
 
 #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
 			" onenand write 0x32008000 0x0 0x100000\0"
 
-#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3 ubi.mtd=6"
-
-#define CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc"
-
 #define CONFIG_MISC_COMMON
 #define CONFIG_MISC_INIT_R
 
@@ -130,36 +124,38 @@
 		"onenand erase 0x01560000 0x1eaa0000;" \
 		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
 	"bootk=" \
-		"onenand read 0x30007FC0 0xc00000 0x600000;" \
+		"run loaduimage;" \
 		"bootm 0x30007FC0\0" \
 	"flashboot=" \
 		"set bootargs root=/dev/mtdblock${bootblock} " \
-		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts} " \
+		"rootfstype=${rootfstype} ${opts} " \
 		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
 	"ubifsboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"tftpboot=" \
 		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
-		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
-		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
-		"bootm 0x30007FC0\0" \
+		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
+		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
 	"ramboot=" \
 		"set bootargs " CONFIG_RAMDISK_BOOT \
-		" initrd=0x33000000,8M ramdisk=8192\0" \
+		"initrd=0x33000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=${mmcblk} rootfstype=${rootfstype}" \
-		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
+		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
 		CONFIG_COMMON_BOOT "; run bootk\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
 	"verify=n\0" \
-	"rootfstype=cramfs\0" \
+	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
 	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M@0x50000000\0" \
-	"mmcblk=/dev/mmcblk1p1\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"mmcdev=0\0" \
+	"mmcbootpart=2\0" \
+	"mmcrootpart=5\0" \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
@@ -202,6 +198,13 @@
 
 #define CONFIG_DOS_PARTITION		1
 
+#define CONFIG_CMD_FAT
+#define CONFIG_CMD_EXT4
+
+/* write support for filesystems */
+#define CONFIG_FAT_WRITE
+#define CONFIG_EXT4_WRITE
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
@@ -226,5 +229,6 @@
 #define CONFIG_USB_GADGET
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to Goni target
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (8 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-16  6:53     ` Minkyu Kang
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command Mateusz Zalega
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage Mateusz Zalega
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover the code for low level
USB initialization has been added to GONI board code.

The malloc pool has been enlarged in order to support larger buffer
sizes needed by DFU implementation.

Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
Tested-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- reordered
---
 board/samsung/goni/goni.c  |  8 +++++++
 include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
 2 files changed, 51 insertions(+), 11 deletions(-)

diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 61b9ece..273fa42 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -14,6 +14,8 @@
 #include <asm/arch/cpu.h>
 #include <power/max8998_pmic.h>
 #include <samsung/misc.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -179,6 +181,12 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
 	.regs_otg = S5PC110_OTG_BASE,
 	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
 };
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+	debug("USB_udc_probe\n");
+	return s3c_udc_probe(&s5pc110_otg_data);
+}
 #endif
 
 #ifdef CONFIG_MISC_INIT_R
diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index b9b66c7..f97b52d 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -40,7 +40,7 @@
 #define CONFIG_CMDLINE_EDITING
 
 /* Size of malloc() pool.*/
-#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + SZ_1M)
+#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + 80 * SZ_1M)
 
 /*
  * select serial console configuration
@@ -71,14 +71,18 @@
 #define CONFIG_CMD_CACHE
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_ONENAND
-#define CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
+#define CONFIG_CMD_DFU
 
-#define CONFIG_BOOTDELAY		1
-#define CONFIG_ZERO_BOOTDELAY_CHECK
+/* USB Composite download gadget - g_dnl */
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_MMC
 
-#define CONFIG_MTD_DEVICE
-#define CONFIG_MTD_PARTITIONS
+/* USB Samsung's IDs */
+#define CONFIG_G_DNL_VENDOR_NUM 0x04E8
+#define CONFIG_G_DNL_PRODUCT_NUM 0x6601
+#define CONFIG_G_DNL_MANUFACTURER "Samsung"
 
 /* Actual modem binary size is 16MiB. Add 2MiB for bad block handling */
 #define MTDIDS_DEFAULT		"onenand0=samsung-onenand"
@@ -91,7 +95,34 @@
 				",12m(modem)"\
 				",60m(qboot)\0"
 
-#define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
+#define CONFIG_BOOTDELAY		1
+#define CONFIG_ZERO_BOOTDELAY_CHECK
+
+/* partitions definitions */
+#define PARTS_CSA			"csa-mmc"
+#define PARTS_BOOTLOADER	"u-boot"
+#define PARTS_BOOT			"boot"
+#define PARTS_ROOT			"platform"
+#define PARTS_DATA			"data"
+#define PARTS_CSC			"csc"
+#define PARTS_UMS			"ums"
+
+#define CONFIG_DFU_ALT \
+	"u-boot raw 0x80 0x400;" \
+	"uImage ext4 0 2;" \
+	"exynos3-goni.dtb ext4 0 2;" \
+	""PARTS_ROOT" part 0 5\0"
+
+#define PARTS_DEFAULT \
+	"uuid_disk=${uuid_gpt_disk};" \
+	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
+	"name="PARTS_BOOTLOADER",size=60MiB," \
+	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
+	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
+	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
+	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
+	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
+	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
 
 #define CONFIG_BOOTCOMMAND	"run mmcboot"
 
@@ -150,18 +181,18 @@
 	"verify=n\0" \
 	"rootfstype=ext4\0" \
 	"console=" CONFIG_DEFAULT_CONSOLE \
-	"mtdparts=" MTDPARTS_DEFAULT \
 	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x30007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
 	"mmcrootpart=5\0" \
+	"partitions=" PARTS_DEFAULT \
 	"bootblock=9\0" \
 	"ubiblock=8\0" \
 	"ubi=enabled\0" \
-	"opts=always_resume=1"
+	"opts=always_resume=1\0" \
+	"dfu_alt_info=" CONFIG_DFU_ALT "\0"
 
-/* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
 #define CONFIG_SYS_HUSH_PARSER		/* use "hush" command parser	*/
 #define CONFIG_SYS_PROMPT	"Goni # "
@@ -200,6 +231,7 @@
 
 #define CONFIG_CMD_FAT
 #define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
 
 /* write support for filesystems */
 #define CONFIG_FAT_WRITE
-- 
1.9.0

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

* [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (9 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-16  6:53     ` Minkyu Kang
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage Mateusz Zalega
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index f97b52d..c52a00a 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -73,6 +73,7 @@
 #define CONFIG_CMD_ONENAND
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_GPT
 
 /* USB Composite download gadget - g_dnl */
 #define CONFIG_USBDOWNLOAD_GADGET
@@ -237,6 +238,10 @@
 #define CONFIG_FAT_WRITE
 #define CONFIG_EXT4_WRITE
 
+/* GPT */
+#define CONFIG_EFI_PARTITION
+#define CONFIG_PARTITION_UUIDS
+
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - 0x1000000)
 
 #define CONFIG_SYS_CACHELINE_SIZE       64
-- 
1.9.0

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

* [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage
  2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
                     ` (10 preceding siblings ...)
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command Mateusz Zalega
@ 2014-04-28 19:13   ` Mateusz Zalega
  2014-05-16  6:53     ` Minkyu Kang
  11 siblings, 1 reply; 127+ messages in thread
From: Mateusz Zalega @ 2014-04-28 19:13 UTC (permalink / raw)
  To: u-boot

UMS-related defines were added to Samsung Goni config header.

Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
Changes since v1:
- reordered
---
 include/configs/s5p_goni.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
index c52a00a..f551c22 100644
--- a/include/configs/s5p_goni.h
+++ b/include/configs/s5p_goni.h
@@ -267,5 +267,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_CMD_USB_MASS_STORAGE
+#define CONFIG_USB_GADGET_MASS_STORAGE
 
 #endif	/* __CONFIG_H */
-- 
1.9.0

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

* [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
@ 2014-04-30  8:18     ` Marek Vasut
  2014-05-05  7:50     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Marek Vasut @ 2014-04-30  8:18 UTC (permalink / raw)
  To: u-boot

On Monday, April 28, 2014 at 09:13:23 PM, Mateusz Zalega wrote:
> Former usb_cable_connected() patch broke compilation of boards which do
> not support this feature.
> 
> I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and added
> its default implementation to gadget downloader driver code. There's
> only one driver of this kind and it's unlikely there'll be another, so
> there's no point in keeping it in /common.
> 
> Previously this function was declared in usb.h. I've moved it, since
> it's more appropriate to keep it in g_dnl.h - usb.h seems to be intended
> for USB host implementation.
> 
> Existing code, confronted with default -EOPNOTSUPP return value,
> continues as if the cable was connected.
> 
> CONFIG_USB_CABLE_CHECK was removed.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

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

* [U-Boot] [PATCH v5 02/12] part: header fix
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 02/12] part: " Mateusz Zalega
@ 2014-04-30  8:33     ` Lukasz Majewski
  2014-05-05  7:48     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-30  8:33 UTC (permalink / raw)
  To: u-boot

Hi Tom,

> Implementation made use of types defined in common.h, even though it
> wasn't #included. It worked in circumstances when .c files included
> every needed header (all).
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - none
> ---
>  include/part.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/part.h b/include/part.h
> index 4beb6db..53532dc 100644
> --- a/include/part.h
> +++ b/include/part.h
> @@ -8,6 +8,7 @@
>  #define _PART_H
>  
>  #include <ide.h>
> +#include <common.h>
>  
>  typedef struct block_dev_desc {
>  	int		if_type;	/* type of the interface
> */

I've agreed with Marek Vasut about those patches. I will take them to
u-boot-dfu tree and send PR to Marek.

Since this is a cleanup patch (not connected to DFU/USB) I would like
to take it to the u-boot-dfu to prevent it from being vanished on the
ML.

Tom, could you ACK this patch? And then I will add it to u-boot-dfu.


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 01/12] mmc: mmc header fix
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
@ 2014-04-30  8:35     ` Lukasz Majewski
  2014-04-30 10:02       ` Pantelis Antoniou
  2014-05-05  7:45     ` Lukasz Majewski
  1 sibling, 1 reply; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-30  8:35 UTC (permalink / raw)
  To: u-boot

Hi Pantelis,

> Structure definition used type block_dev_desc_t, defined in part.h,
> which wasn't included in mmc.h. It worked only in circumstances when
> common.h, or another header using part.h was incuded in
> implementation files.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
> ---
> Changes since v1:
> - none
> ---
>  include/mmc.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/mmc.h b/include/mmc.h
> index 42d0125..bc11f45 100644
> --- a/include/mmc.h
> +++ b/include/mmc.h
> @@ -12,6 +12,7 @@
>  
>  #include <linux/list.h>
>  #include <linux/compiler.h>
> +#include <part.h>
>  
>  #define SD_VERSION_SD	0x20000
>  #define SD_VERSION_3	(SD_VERSION_SD | 0x300)

I've agreed with Marek Vasut about those patches. I will take them to
u-boot-dfu tree and send PR to Marek.

Since this is a cleanup patch (not connected to DFU/USB) I would like
to take it to the u-boot-dfu to prevent it from being vanished on the
ML.

Pantelis, could you ACK this patch? And then I will add it to
u-boot-dfu.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 01/12] mmc: mmc header fix
  2014-04-30  8:35     ` Lukasz Majewski
@ 2014-04-30 10:02       ` Pantelis Antoniou
  0 siblings, 0 replies; 127+ messages in thread
From: Pantelis Antoniou @ 2014-04-30 10:02 UTC (permalink / raw)
  To: u-boot

Hi Lukasz,

On Apr 30, 2014, at 11:35 AM, Lukasz Majewski wrote:

> Hi Pantelis,
> 
>> Structure definition used type block_dev_desc_t, defined in part.h,
>> which wasn't included in mmc.h. It worked only in circumstances when
>> common.h, or another header using part.h was incuded in
>> implementation files.
>> 
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
>> ---
>> Changes since v1:
>> - none
>> ---
>> include/mmc.h | 1 +
>> 1 file changed, 1 insertion(+)
>> 
>> diff --git a/include/mmc.h b/include/mmc.h
>> index 42d0125..bc11f45 100644
>> --- a/include/mmc.h
>> +++ b/include/mmc.h
>> @@ -12,6 +12,7 @@
>> 
>> #include <linux/list.h>
>> #include <linux/compiler.h>
>> +#include <part.h>
>> 
>> #define SD_VERSION_SD	0x20000
>> #define SD_VERSION_3	(SD_VERSION_SD | 0x300)
> 
> I've agreed with Marek Vasut about those patches. I will take them to
> u-boot-dfu tree and send PR to Marek.
> 
> Since this is a cleanup patch (not connected to DFU/USB) I would like
> to take it to the u-boot-dfu to prevent it from being vanished on the
> ML.
> 

OK, please go ahead.

> Pantelis, could you ACK this patch? And then I will add it to
> u-boot-dfu.
> 
> -- 
> Best regards,
> 
> Lukasz Majewski
> 
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

Acked-by: Pantelis Antoniou <panto@antoniou-consulting.com>

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

* [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target Mateusz Zalega
@ 2014-04-30 11:24     ` Lukasz Majewski
  2014-04-30 11:55       ` Minkyu Kang
  2014-05-16  6:53     ` Minkyu Kang
  1 sibling, 1 reply; 127+ messages in thread
From: Lukasz Majewski @ 2014-04-30 11:24 UTC (permalink / raw)
  To: u-boot

Hi Minkyu,

> Configuration file for GONI has been updated to support FAT file
> system, new mmc partitioning scheme and read linux kernel from eMMC
> instead of OneNAND.
> 
> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - reordered
> ---
>  include/configs/s5p_goni.h | 56
> +++++++++++++++++++++++++--------------------- 1 file changed, 30
> insertions(+), 26 deletions(-)
> 
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index 991c43e..b9b66c7 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -17,6 +17,7 @@
>  #define CONFIG_S5PC110		1	/* which is in a
> S5PC110 */ #define CONFIG_MACH_GONI	1	/* working with
> Goni */ 
> +#include <linux/sizes.h>
>  #include <asm/arch/cpu.h>		/* get chip and board defs
> */ 
>  #define CONFIG_ARCH_CPU_INIT
> @@ -38,11 +39,9 @@
>  #define CONFIG_INITRD_TAG
>  #define CONFIG_CMDLINE_EDITING
>  
> -/*
> - * Size of malloc() pool
> - * 1MB = 0x100000, 0x100000 = 1024 * 1024
> - */
> -#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (1
> << 20)) +/* Size of malloc() pool.*/
> +#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE +
> SZ_1M) +
>  /*
>   * select serial console configuration
>   */
> @@ -90,30 +89,25 @@
>  				",7m(kernel)"\
>  				",1m(log)"\
>  				",12m(modem)"\
> -				",60m(qboot)"\
> -				",-(UBI)\0"
> +				",60m(qboot)\0"
>  
>  #define NORMAL_MTDPARTS_DEFAULT MTDPARTS_DEFAULT
>  
> -#define CONFIG_BOOTCOMMAND	"run ubifsboot"
> +#define CONFIG_BOOTCOMMAND	"run mmcboot"
>  
>  #define CONFIG_DEFAULT_CONSOLE	"console=ttySAC2,115200n8\0"
>  
> -#define CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw
> rootfstype=ext2" \ +#define
> CONFIG_RAMDISK_BOOT	"root=/dev/ram0 rw rootfstype=ext4" \ "
> ${console} ${meminfo}" 
>  #define CONFIG_COMMON_BOOT	"${console} ${meminfo} ${mtdparts}"
>  
> -#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 ubi.mtd=8
> ubi.mtd=3 ubi.mtd=6" \
> -		" rootfstype=cramfs " CONFIG_COMMON_BOOT
> +#define CONFIG_BOOTARGS	"root=/dev/mtdblock8 rootfstype=ext4
> " \
> +			CONFIG_COMMON_BOOT
>  
>  #define CONFIG_UPDATEB	"updateb=onenand erase 0x0 0x100000;" \
>  			" onenand write 0x32008000 0x0 0x100000\0"
>  
> -#define CONFIG_UBI_MTD	" ubi.mtd=${ubiblock} ubi.mtd=3
> ubi.mtd=6" -
> -#define
> CONFIG_UBIFS_OPTION	"rootflags=bulk_read,no_chk_data_crc" -
>  #define CONFIG_MISC_COMMON
>  #define CONFIG_MISC_INIT_R
>  
> @@ -130,36 +124,38 @@
>  		"onenand erase 0x01560000 0x1eaa0000;" \
>  		"onenand write 0x32000000 0x1260000 0x8C0000\0" \
>  	"bootk=" \
> -		"onenand read 0x30007FC0 0xc00000 0x600000;" \
> +		"run loaduimage;" \
>  		"bootm 0x30007FC0\0" \
>  	"flashboot=" \
>  		"set bootargs root=/dev/mtdblock${bootblock} " \
> -		"rootfstype=${rootfstype}" CONFIG_UBI_MTD " ${opts}
> " \
> +		"rootfstype=${rootfstype} ${opts} " \
>  		"${lcdinfo} " CONFIG_COMMON_BOOT "; run bootk\0" \
>  	"ubifsboot=" \
>  		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
> -		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts}
> ${lcdinfo} " \
> +		"${opts} ${lcdinfo} " \
>  		CONFIG_COMMON_BOOT "; run bootk\0" \
>  	"tftpboot=" \
>  		"set bootargs root=ubi0!rootfs rootfstype=ubifs " \
> -		CONFIG_UBIFS_OPTION CONFIG_UBI_MTD " ${opts}
> ${lcdinfo} " \
> -		CONFIG_COMMON_BOOT "; tftp 0x30007FC0 uImage; " \
> -		"bootm 0x30007FC0\0" \
> +		"${opts} ${lcdinfo} " CONFIG_COMMON_BOOT \
> +		"; tftp 0x30007FC0 uImage; bootm 0x30007FC0\0" \
>  	"ramboot=" \
>  		"set bootargs " CONFIG_RAMDISK_BOOT \
> -		" initrd=0x33000000,8M ramdisk=8192\0" \
> +		"initrd=0x33000000,8M ramdisk=8192\0" \
>  	"mmcboot=" \
> -		"set bootargs root=${mmcblk}
> rootfstype=${rootfstype}" \
> -		CONFIG_UBI_MTD " ${opts} ${lcdinfo} " \
> +		"set bootargs
> root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
> +		"rootfstype=${rootfstype} ${opts} ${lcdinfo} " \
>  		CONFIG_COMMON_BOOT "; run bootk\0" \
>  	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
>  	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
>  	"verify=n\0" \
> -	"rootfstype=cramfs\0" \
> +	"rootfstype=ext4\0" \
>  	"console=" CONFIG_DEFAULT_CONSOLE \
>  	"mtdparts=" MTDPARTS_DEFAULT \
>  	"meminfo=mem=80M mem=256M at 0x40000000 mem=128M at 0x50000000\0" \
> -	"mmcblk=/dev/mmcblk1p1\0" \
> +	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x30007FC0
> uImage\0" \
> +	"mmcdev=0\0" \
> +	"mmcbootpart=2\0" \
> +	"mmcrootpart=5\0" \
>  	"bootblock=9\0" \
>  	"ubiblock=8\0" \
>  	"ubi=enabled\0" \
> @@ -202,6 +198,13 @@
>  
>  #define CONFIG_DOS_PARTITION		1
>  
> +#define CONFIG_CMD_FAT
> +#define CONFIG_CMD_EXT4
> +
> +/* write support for filesystems */
> +#define CONFIG_FAT_WRITE
> +#define CONFIG_EXT4_WRITE
> +
>  #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR -
> 0x1000000) 
>  #define CONFIG_SYS_CACHELINE_SIZE       64
> @@ -226,5 +229,6 @@
>  #define CONFIG_USB_GADGET
>  #define CONFIG_USB_GADGET_S3C_UDC_OTG
>  #define CONFIG_USB_GADGET_DUALSPEED
> +#define CONFIG_USB_GADGET_VBUS_DRAW 2
>  
>  #endif	/* __CONFIG_H */

I've agreed with Marek Vasut about patches 1 to 8. I will take them to
u-boot-dfu tree and send PR to Marek.

However, I would like to ask you to add patches from 9 to 12 (related to
GONI) to u-boot-samsung tree.

Below, please find links to patchwork:

http://patchwork.ozlabs.org/patch/343521/
http://patchwork.ozlabs.org/patch/343527/
http://patchwork.ozlabs.org/patch/343520/
http://patchwork.ozlabs.org/patch/343523/


Thanks in advance.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target
  2014-04-30 11:24     ` Lukasz Majewski
@ 2014-04-30 11:55       ` Minkyu Kang
  0 siblings, 0 replies; 127+ messages in thread
From: Minkyu Kang @ 2014-04-30 11:55 UTC (permalink / raw)
  To: u-boot

On 30/04/14 20:24, Lukasz Majewski wrote:
> Hi Minkyu,
> 
>> Configuration file for GONI has been updated to support FAT file
>> system, new mmc partitioning scheme and read linux kernel from eMMC
>> instead of OneNAND.
>>
>> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>> Changes since v1:
>> - reordered
>> ---
>>  include/configs/s5p_goni.h | 56
>> +++++++++++++++++++++++++--------------------- 1 file changed, 30
>> insertions(+), 26 deletions(-)
> I've agreed with Marek Vasut about patches 1 to 8. I will take them to
> u-boot-dfu tree and send PR to Marek.
> 
> However, I would like to ask you to add patches from 9 to 12 (related to
> GONI) to u-boot-samsung tree.

I will.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init()
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
@ 2014-05-01 20:03     ` Stephen Warren
  2014-05-05  8:05     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Stephen Warren @ 2014-05-01 20:03 UTC (permalink / raw)
  To: u-boot

On 04/28/2014 01:13 PM, Mateusz Zalega wrote:
> In cases when MMC hadn't been initialized before, ie. by the user or other
> subsystem, it was still uninitialized while UMS media capacity check,
> leading to broken ums command.
> 
> UMS has to initialize resources it uses.

It's probably better to just switch from find_mmc_device() to
get_device(), which does the initialization internally. patch "ums: use
get_device() not find_mmc_device()" does this.

http://patchwork.ozlabs.org/patch/344328/

That said, at this point, it's probably simplest to just apply this
series, and I'll rebase my series on top of this in a day or two.

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

* [U-Boot] [PATCH v5 01/12] mmc: mmc header fix
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
  2014-04-30  8:35     ` Lukasz Majewski
@ 2014-05-05  7:45     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  7:45 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Structure definition used type block_dev_desc_t, defined in part.h,
> which wasn't included in mmc.h. It worked only in circumstances when
> common.h, or another header using part.h was incuded in
> implementation files.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> Cc: Pantelis Antoniou <panto@antoniou-consulting.com>

Applied to u-boot-dfu branch.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 02/12] part: header fix
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 02/12] part: " Mateusz Zalega
  2014-04-30  8:33     ` Lukasz Majewski
@ 2014-05-05  7:48     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  7:48 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Implementation made use of types defined in common.h, even though it
> wasn't #included. It worked in circumstances when .c files included
> every needed header (all).
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

Applied to u-boot-dfu branch.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
  2014-04-30  8:18     ` Marek Vasut
@ 2014-05-05  7:50     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  7:50 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Former usb_cable_connected() patch broke compilation of boards which
> do not support this feature.
> 
> I've renamed usb_cable_connected() to g_dnl_usb_cable_connected() and
> added its default implementation to gadget downloader driver code.
> There's only one driver of this kind and it's unlikely there'll be
> another, so there's no point in keeping it in /common.
> 
> Previously this function was declared in usb.h. I've moved it, since
> it's more appropriate to keep it in g_dnl.h - usb.h seems to be
> intended for USB host implementation.
> 
> Existing code, confronted with default -EOPNOTSUPP return value,
> continues as if the cable was connected.
> 
> CONFIG_USB_CABLE_CHECK was removed.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Marek Vasut <marex@denx.de>

Applied to u-boot-dfu. Thanks


-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix Mateusz Zalega
@ 2014-05-05  8:00     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:00 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> When user attempted to perform a raw write using DFU (vide
> dfu_fill_entity_mmc) with MMC interface not initialized before,
> get_mmc_blk_size() reported invalid (zero) block size - it wasn't
> possible to write ie. a new u-boot image.
> 
> This commit fixes that by initializing MMC device before use in
> dfu_fill_entity_mmc().
> 
> While fixing initialization sequence, I had to change about half of
> dfu_fill_entity_mmc's body, so I refactored it on the way to make it,
> IMHO, considerably more comprehensible.
> 
> Being left as dead code, get_mmc_blk_size() was removed.
> 
> Tested on Samsung Goni.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> Acked-by: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

Applied to u-boot-dfu. Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling Mateusz Zalega
@ 2014-05-05  8:03     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:03 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Previously offsets handled by dfu_fill_entity_mmc(), defined in
> boards' CONFIG_DFU_ALT were treated as hexadecimal regardless of
> their prefix, which sometimes led to confusion. This patch forces
> usage of explicit numerical base prefixes.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Tom Rini <trini@ti.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

Applied to u-boot-dfu. Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init()
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
  2014-05-01 20:03     ` Stephen Warren
@ 2014-05-05  8:05     ` Lukasz Majewski
  1 sibling, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:05 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> In cases when MMC hadn't been initialized before, ie. by the user or
> other subsystem, it was still uninitialized while UMS media capacity
> check, leading to broken ums command.
> 
> UMS has to initialize resources it uses.
> 
> Tested on Samsung Goni.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>

Applied to u-boot-dfu. THanks,


> ---
> Changes since v3:
> - Added const attribute of ums_disk_init introduced type warnings. It
> would take a lot of changes to MMC core code to fix it, so it was
> dropped, even though ums_disk_init shouldn't and doesn't change
> struct mmc it is passed. Changes since v4:
> - added slightly more detailed commit message 
> ---
>  board/samsung/common/ums.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/board/samsung/common/ums.c b/board/samsung/common/ums.c
> index dc155ad..cebabe9 100644
> --- a/board/samsung/common/ums.c
> +++ b/board/samsung/common/ums.c
> @@ -66,11 +66,9 @@ static struct ums *ums_disk_init(struct mmc *mmc)
>  
>  struct ums *ums_init(unsigned int dev_num)
>  {
> -	struct mmc *mmc = NULL;
> +	struct mmc *mmc = find_mmc_device(dev_num);
>  
> -	mmc = find_mmc_device(dev_num);
> -	if (!mmc)
> +	if (!mmc || mmc_init(mmc))
>  		return NULL;
> -
>  	return ums_disk_init(mmc);
>  }



-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
@ 2014-05-05  8:06     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:06 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Future patches will make DFU too large to fit in this board's SPL
> build.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Acked-by: Tom Rini <trini@ti.com>
> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>

Applied to u-boot-dfu. THanks.
-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
@ 2014-05-05  8:07     ` Lukasz Majewski
  0 siblings, 0 replies; 127+ messages in thread
From: Lukasz Majewski @ 2014-05-05  8:07 UTC (permalink / raw)
  To: u-boot

Hi Mateusz,

> Preprocessor definitions and hardcoded implementation selection in
> g_dnl core were replaced by a linker list made of (usb_function_name,
> bind_callback) pairs.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Acked-by: Lukasz Majewski <l.majewski@samsung.com>
> Acked-by: Marek Vasut <marex@denx.de>

Applied to u-boot-dfu. Thanks.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group

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

* [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage Mateusz Zalega
@ 2014-05-16  6:53     ` Minkyu Kang
  0 siblings, 0 replies; 127+ messages in thread
From: Minkyu Kang @ 2014-05-16  6:53 UTC (permalink / raw)
  To: u-boot

On 29/04/14 04:13, Mateusz Zalega wrote:
> UMS-related defines were added to Samsung Goni config header.
> 
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - reordered
> ---
>  include/configs/s5p_goni.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/include/configs/s5p_goni.h b/include/configs/s5p_goni.h
> index c52a00a..f551c22 100644
> --- a/include/configs/s5p_goni.h
> +++ b/include/configs/s5p_goni.h
> @@ -267,5 +267,7 @@
>  #define CONFIG_USB_GADGET_S3C_UDC_OTG
>  #define CONFIG_USB_GADGET_DUALSPEED
>  #define CONFIG_USB_GADGET_VBUS_DRAW 2
> +#define CONFIG_CMD_USB_MASS_STORAGE
> +#define CONFIG_USB_GADGET_MASS_STORAGE
>  
>  #endif	/* __CONFIG_H */
> 


applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command Mateusz Zalega
@ 2014-05-16  6:53     ` Minkyu Kang
  0 siblings, 0 replies; 127+ messages in thread
From: Minkyu Kang @ 2014-05-16  6:53 UTC (permalink / raw)
  To: u-boot

On 29/04/14 04:13, Mateusz Zalega wrote:
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - reordered
> ---
>  include/configs/s5p_goni.h | 5 +++++
>  1 file changed, 5 insertions(+)
> 


applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to Goni target
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
@ 2014-05-16  6:53     ` Minkyu Kang
  0 siblings, 0 replies; 127+ messages in thread
From: Minkyu Kang @ 2014-05-16  6:53 UTC (permalink / raw)
  To: u-boot

On 29/04/14 04:13, Mateusz Zalega wrote:
> Proper adjustment for supporting DFU at GONI target has been made.
> The s5p_goni.h file has been updated. Moreover the code for low level
> USB initialization has been added to GONI board code.
> 
> The malloc pool has been enlarged in order to support larger buffer
> sizes needed by DFU implementation.
> 
> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - reordered
> ---
>  board/samsung/goni/goni.c  |  8 +++++++
>  include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
>  2 files changed, 51 insertions(+), 11 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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

* [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target
  2014-04-28 19:13   ` [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target Mateusz Zalega
  2014-04-30 11:24     ` Lukasz Majewski
@ 2014-05-16  6:53     ` Minkyu Kang
  1 sibling, 0 replies; 127+ messages in thread
From: Minkyu Kang @ 2014-05-16  6:53 UTC (permalink / raw)
  To: u-boot

On 29/04/14 04:13, Mateusz Zalega wrote:
> Configuration file for GONI has been updated to support FAT file system,
> new mmc partitioning scheme and read linux kernel from eMMC instead of
> OneNAND.
> 
> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
> Changes since v1:
> - reordered
> ---
>  include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++---------------------
>  1 file changed, 30 insertions(+), 26 deletions(-)
> 

applied to u-boot-samsung.

Thanks,
Minkyu Kang.

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

end of thread, other threads:[~2014-05-16  6:53 UTC | newest]

Thread overview: 127+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-09 14:31 [U-Boot] [PATCH 1/9] mmc: mmc header fix Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 2/9] part: " Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH v3 3/9] arm:goni: Update configuration for goni target Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 4/9] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
2014-01-10  4:55   ` Jaehoon Chung
2014-01-13 14:45     ` Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 5/9] arm:goni: enable GPT command Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 6/9] arm:goni: enable USB Mass Storage Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH v3 7/9] dfu:mmc: raw data write fix Mateusz Zalega
2014-01-10  5:03   ` Jaehoon Chung
2014-01-13 13:34     ` Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 8/9] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
2014-01-10  5:08   ` Jaehoon Chung
2014-01-13 14:39     ` Mateusz Zalega
2014-01-13 14:43       ` Michael Trimarchi
2014-01-13 15:00         ` Mateusz Zalega
2014-01-13 10:16   ` Lukasz Majewski
2014-01-14  0:49   ` Minkyu Kang
2014-01-14 10:55     ` Mateusz Zalega
2014-01-09 14:31 ` [U-Boot] [PATCH 9/9] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
2014-01-10  8:23   ` Lukasz Majewski
2014-01-13  7:07     ` Heiko Schocher
2014-01-13 10:16   ` Lukasz Majewski
2014-01-10  4:46 ` [U-Boot] [PATCH 1/9] mmc: mmc header fix Jaehoon Chung
2014-02-04 17:02 ` [U-Boot] [PATCH v2 00/12] Series v2 Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 01/12] mmc: mmc header fix Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 02/12] part: " Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 03/12] arm:goni: Update configuration for goni target Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 04/12] dfu: fix boards wo USB cable detection Mateusz Zalega
2014-02-22  5:06     ` Marek Vasut
2014-02-04 17:02   ` [U-Boot] [PATCH v2 05/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 06/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
2014-02-05  7:13     ` Marek Vasut
2014-02-05 12:40       ` Mateusz Zalega
2014-02-05 18:00         ` Marek Vasut
2014-02-06 11:56           ` Mateusz Zalega
2014-02-06 19:59             ` Marek Vasut
2014-02-04 17:02   ` [U-Boot] [PATCH v2 07/12] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 08/12] arm:goni: enable GPT command Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 09/12] arm:goni: enable USB Mass Storage Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 10/12] dfu:mmc: raw data write fix Mateusz Zalega
2014-02-22  5:09     ` Marek Vasut
2014-02-04 17:02   ` [U-Boot] [PATCH v2 11/12] mmc: postponed needless timer initialization Mateusz Zalega
2014-02-04 17:02   ` [U-Boot] [PATCH v2 12/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
2014-02-22  5:12     ` Marek Vasut
2014-03-31 15:48 ` [U-Boot] [PATCH v3 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 01/13] mmc: mmc header fix Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 02/13] part: " Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 03/13] arm:goni: Update configuration for goni target Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 04/13] dfu: fix boards wo USB cable detection Mateusz Zalega
2014-04-02  6:33     ` Lukasz Majewski
2014-03-31 15:49   ` [U-Boot] [PATCH v3 05/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 06/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
2014-03-31 16:14     ` Marek Vasut
2014-04-02  6:35     ` Lukasz Majewski
2014-04-02 22:28       ` Marek Vasut
2014-04-03  7:46         ` Lukasz Majewski
2014-04-03  8:52           ` Marek Vasut
2014-04-11 11:43             ` Mateusz Zalega
2014-04-11 12:02               ` Marek Vasut
2014-04-15 11:04                 ` Mateusz Zalega
2014-04-15 13:26                   ` Marek Vasut
2014-03-31 15:49   ` [U-Boot] [PATCH v3 07/13] arm:goni:dfu Add support for DFU to Goni target Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 08/13] arm:goni: enable GPT command Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 09/13] arm:goni: enable USB Mass Storage Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 10/13] dfu:mmc: raw data write fix Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 11/13] mmc: postponed needless timer initialization Mateusz Zalega
2014-03-31 15:49   ` [U-Boot] [PATCH v3 12/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
2014-04-02  6:36     ` Lukasz Majewski
2014-03-31 15:49   ` [U-Boot] [PATCH v3 13/13] common: fixed linker-list example Mateusz Zalega
2014-03-31 16:12     ` Marek Vasut
2014-04-01  7:42       ` Lukasz Majewski
2014-04-15 13:06 ` [U-Boot] [PATCH v4 00/13] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 01/13] mmc: mmc header fix Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 02/13] part: " Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 03/13] common: fixed linker-list example Mateusz Zalega
2014-04-15 13:36     ` Marek Vasut
2014-04-15 13:06   ` [U-Boot] [PATCH v4 04/13] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
2014-04-15 13:38     ` Marek Vasut
2014-04-15 14:23     ` Lukasz Majewski
2014-04-15 13:06   ` [U-Boot] [PATCH v4 05/13] mmc: postponed needless timer initialization Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 06/13] dfu: mmc: raw data write fix Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 07/13] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
2014-04-15 14:24     ` Lukasz Majewski
2014-04-15 13:06   ` [U-Boot] [PATCH v4 08/13] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
2014-04-15 14:25     ` Lukasz Majewski
2014-04-15 13:06   ` [U-Boot] [PATCH v4 09/13] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
2014-04-15 13:39     ` Marek Vasut
2014-04-15 14:28     ` Lukasz Majewski
2014-04-16  4:23     ` Jaehoon Chung
2014-04-16  9:25       ` Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 10/13] arm: goni: Update configuration for Goni target Mateusz Zalega
2014-04-15 13:06   ` [U-Boot] [PATCH v4 11/13] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
2014-04-15 13:07   ` [U-Boot] [PATCH v4 12/13] arm: goni: enable GPT command Mateusz Zalega
2014-04-15 13:07   ` [U-Boot] [PATCH v4 13/13] arm: goni: enable USB Mass Storage Mateusz Zalega
2014-04-28 19:13 ` [U-Boot] [PATCH v5 00/12] DFU, MMC, Gadget, Goni, misc Mateusz Zalega
2014-04-28 19:13   ` [U-Boot] [PATCH v5 01/12] mmc: mmc header fix Mateusz Zalega
2014-04-30  8:35     ` Lukasz Majewski
2014-04-30 10:02       ` Pantelis Antoniou
2014-05-05  7:45     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 02/12] part: " Mateusz Zalega
2014-04-30  8:33     ` Lukasz Majewski
2014-05-05  7:48     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 03/12] usb: dfu: fix boards wo USB cable detection Mateusz Zalega
2014-04-30  8:18     ` Marek Vasut
2014-05-05  7:50     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 04/12] dfu: mmc: raw data write fix Mateusz Zalega
2014-05-05  8:00     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 05/12] dfu: mmc: change offset base handling Mateusz Zalega
2014-05-05  8:03     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 06/12] ums: always initialize mmc before ums_disk_init() Mateusz Zalega
2014-05-01 20:03     ` Stephen Warren
2014-05-05  8:05     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 07/12] am335x: dfu: disable DFU in am335x_evm SPL build Mateusz Zalega
2014-05-05  8:06     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 08/12] USB: gadget: added a saner gadget downloader registration API Mateusz Zalega
2014-05-05  8:07     ` Lukasz Majewski
2014-04-28 19:13   ` [U-Boot] [PATCH v5 09/12] arm: goni: Update configuration for Goni target Mateusz Zalega
2014-04-30 11:24     ` Lukasz Majewski
2014-04-30 11:55       ` Minkyu Kang
2014-05-16  6:53     ` Minkyu Kang
2014-04-28 19:13   ` [U-Boot] [PATCH v5 10/12] arm: goni: dfu: Add support for DFU to " Mateusz Zalega
2014-05-16  6:53     ` Minkyu Kang
2014-04-28 19:13   ` [U-Boot] [PATCH v5 11/12] arm: goni: enable GPT command Mateusz Zalega
2014-05-16  6:53     ` Minkyu Kang
2014-04-28 19:13   ` [U-Boot] [PATCH v5 12/12] arm: goni: enable USB Mass Storage Mateusz Zalega
2014-05-16  6:53     ` Minkyu Kang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.