mmc: mmc header fix
Subsystems (3)
PATCH 1/9 mmc: mmc header fix
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.
--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)
include/mmc.h +1 -0
@@ -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)
Signature · 1 line
1.8.2.1
PATCH 2/9 part: header fix
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).
--- include/part.h | 1 + 1 file changed, 1 insertion(+)
include/part.h +1 -0
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH v3 3/9 arm:goni: Update configuration for goni target
In reply to Mateusz ZalegaConfiguration 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.
--- include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +30 -26
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH 4/9 arm:goni:dfu Add support for DFU to Goni target
In reply to Mateusz ZalegaProper 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.
--- board/samsung/goni/goni.c | 10 +++++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 11 deletions(-)
board/samsung/goni/goni.c +10 -0
@@ -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
include/configs/s5p_goni.h +43 -11
95 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH 4/9 arm:goni:dfu Add support for DFU to Goni target
Hi Mateusz.
Quoted 34 lines · Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made. The
s5p_goni.hfile 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 I7812f395a3ee3660cec31f4d8c954057c0149863Signed-off-by Arkadiusz Wlodarczyk <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>--- board/samsung/goni/goni.c | 10 +++++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 11 deletions(-)board/samsung/goni/goni.c +3
-0@@ -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;
board/samsung/goni/goni.c struct s3c_plat_otg_data s5pc110_otg_data = { · line 183
Quoted 9 lines
board/samsung/goni/goni.c +6
-0@@ -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);
Quoted 50 lines
board/samsung/goni/goni.c +1
-0+}#endif include/configs/s5p_goni.h +16
-7@@ -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"
include/configs/s5p_goni.h line 112
Quoted 10 lines
include/configs/s5p_goni.h +10
-0+#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
Quoted 47 lines
include/configs/s5p_goni.h +17
-4+ ""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
PATCH 4/9 arm:goni:dfu Add support for DFU to Goni target
Quoted 33 lines · Jaehoon Chung
Quoted 32 lines · Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made. The
s5p_goni.hfile 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 I7812f395a3ee3660cec31f4d8c954057c0149863Signed-off-by Arkadiusz Wlodarczyk <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>--- board/samsung/goni/goni.c | 10 +++++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 53 insertions(+), 11 deletions(-)board/samsung/goni/goni.c +3
-0@@ -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 ;
Quoted 12 lines
board/samsung/goni/goni.c struct s3c_plat_otg_data s5pc110_otg_data = { · line 183
Quoted 11 lines
board/samsung/goni/goni.c +6
-0static 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.
Quoted 53 lines
Quoted 53 lines
board/samsung/goni/goni.c +1
-0+}#endif include/configs/s5p_goni.h +19
-7@@ -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"
Quoted 8 lines
include/configs/s5p_goni.h line 112
Quoted 7 lines
include/configs/s5p_goni.h +7
-0+#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,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH 5/9 arm:goni: enable GPT command
In reply to Mateusz Zalega--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/s5p_goni.h +5 -0
@@ -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
Signature · 1 line
1.8.2.1
PATCH 6/9 arm:goni: enable USB Mass Storage
In reply to Mateusz ZalegaUMS-related defines were added to Samsung Goni config header.
--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH v3 7/9 dfu:mmc: raw data write fix
In reply to Mateusz ZalegaWhen 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
--- 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(-)
drivers/dfu/dfu_mmc.c +64 -42
@@ -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 ;
drivers/mmc/mmc.c +10 -3
@@ -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; }
include/configs/am335x_evm.h +4 -4
@@ -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;" \
include/configs/trats.h +1 -1
@@ -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"
include/configs/trats2.h +1 -1
@@ -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"
include/dfu.h +0 -5
@@ -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
Signature · 1 line
1.8.2.1
PATCH v3 7/9 dfu:mmc: raw data write fix
Hi, Mateusz,
This patch should be separated with dfu and mmc.
Quoted 180 lines · Mateusz Zalega
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
- minordfu_alt_infoformat changev3 changes:
- moved invalid block length check to mmc core
- removed redundant 'has_init' checkChange-Id Icb50bb9f805a9a78848acd19f682fad474cb9082Signed-off-by Mateusz Zalega <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>--- 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(-)drivers/dfu/dfu_mmc.c +64
-42@@ -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 ;drivers/mmc/mmc.c +1
-0@@ -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*/
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1272
Quoted 6 lines
drivers/mmc/mmc.c +3
-0@@ -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?
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1276
Quoted 8 lines
drivers/mmc/mmc.c +0
-3int 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.
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1280
Quoted 3 lines
drivers/mmc/mmc.c +1
-0if (!err || err ==IN_PROGRESS ) err =mmc_complete_init (mmc); +
Ditto.
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1286
Quoted 6 lines
drivers/mmc/mmc.c +5
-0debug ("%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?
Quoted 40 lines
drivers/mmc/mmc.c +0
-0return err; }include/configs/am335x_evm.h +4
-4@@ -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;" \include/configs/trats.h +1
-1@@ -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" include/configs/trats2.h +0
-0
include/configs/trats2.h line 172
Quoted 5 lines
include/configs/trats2.h +1
-1@@ -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
Quoted 20 lines
include/configs/trats2.h +0
-0"uImage ext4 0 2;" \"exynos4412-trats2.dtb ext4 0 2;" \"" PARTS_ROOT " part 0 5\0" include/dfu.h +0
-5@@ -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
NAKPATCH v3 7/9 dfu:mmc: raw data write fix
Quoted 1 line · Jaehoon Chung
This patch should be separated with dfu and mmc.
ACK, because we're going to remove the bl_len assertion, see below.
Quoted 34 lines · Mateusz Zalega
Quoted 33 lines
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
- minordfu_alt_infoformat changev3 changes:
- moved invalid block length check to mmc core
- removed redundant 'has_init' checkChange-Id Icb50bb9f805a9a78848acd19f682fad474cb9082Signed-off-by Mateusz Zalega <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>--- 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(-)drivers/dfu/dfu_mmc.c +0
-0
(...)
Quoted 14 lines
Quoted 14 lines
drivers/mmc/mmc.c +1
-0@@ -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)
Quoted 6 lines
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1272
Quoted 5 lines
drivers/mmc/mmc.c +3
-0int 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.
Quoted 10 lines
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1276
Quoted 8 lines
drivers/mmc/mmc.c +0
-3int 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.
Quoted 4 lines
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1280
Quoted 3 lines
drivers/mmc/mmc.c +1
-0if (!err || err ==IN_PROGRESS ) err =mmc_complete_init (mmc); +Ditto.
NAK, it improves code readability.
Quoted 8 lines
drivers/mmc/mmc.c static int mmc_complete_init(struct mmc *mmc) · line 1286
Quoted 6 lines
drivers/mmc/mmc.c +5
-0debug ("%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_lenandwrite_bl_lenis 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.
Quoted 42 lines
Quoted 42 lines
drivers/mmc/mmc.c +0
-0return err; }include/configs/am335x_evm.h +4
-4@@ -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;" \include/configs/trats.h +1
-1@@ -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" include/configs/trats2.h +0
-0@@ -169,7 +169,7 @@"name=" PARTS_UMS ",size=-,uuid=${uuid_gpt_" PARTS_UMS "}\0" \
Quoted 5 lines
include/configs/trats2.h line 172
Quoted 3 lines
include/configs/trats2.h +1
-1#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
Quoted 22 lines
Quoted 20 lines
include/configs/trats2.h +0
-0"uImage ext4 0 2;" \"exynos4412-trats2.dtb ext4 0 2;" \"" PARTS_ROOT " part 0 5\0" include/dfu.h +0
-5@@ -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
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaIn some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
--- board/samsung/common/ums.c | 3 +++ 1 file changed, 3 insertions(+)
board/samsung/common/ums.c +3 -0
@@ -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 ;
Signature · 1 line
1.8.2.1
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
Hi Mateusz,
Quoted 17 lines · Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Change-Id I4b86c2c59e430fb8b55272ea14f00316d8cb3dcaSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>Cc Kyungmin Park <[email protected]>--- board/samsung/common/ums.c | 3 +++ 1 file changed, 3 insertions(+)board/samsung/common/ums.c +0
-0
board/samsung/common/ums.c static struct ums ums_dev = { · line 44
Quoted 8 lines
board/samsung/common/ums.c +3
-0@@ -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
Quoted 2 lines
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
Quoted 14 lines · Jaehoon Chung
board/samsung/common/ums.c static struct ums ums_dev = { · line 44
Quoted 12 lines
index dc155ad..0d8f30d 100644
board/samsung/common/ums.c +3
-0@@ -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))
Quoted 3 lines
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,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
Hi
Quoted 17 lines · Mateusz Zalega
Quoted 16 lines · Jaehoon Chung
board/samsung/common/ums.c static struct ums ums_dev = { · line 44
Quoted 12 lines
index dc155ad..0d8f30d 100644
board/samsung/common/ums.c +3
-0@@ -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;
Quoted 4 lines
Quoted 1 line
Locate this point.
If you're asking to put this
if()block after variable declaration, NAK.
I don't understand your point
Quoted 5 lines
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
Quoted 8 lines
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
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
Quoted 28 lines · Michael Trimarchi
Quoted 17 lines · Mateusz Zalega
Quoted 16 lines · Jaehoon Chung
board/samsung/common/ums.c static struct ums ums_dev = { · line 44
Quoted 12 lines
index dc155ad..0d8f30d 100644
board/samsung/common/ums.c +3
-0@@ -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;Quoted 4 lines
Quoted 1 line
Locate this point.
If you're asking to put this
if()block after variable declaration, NAK.I don't understand your point
Quoted 3 lines
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.
Quoted 6 lines
Quoted 2 lines
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,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaHi Mateusz,
Quoted 17 lines
In some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Change-Id I4b86c2c59e430fb8b55272ea14f00316d8cb3dcaSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>Cc Kyungmin Park <[email protected]>--- board/samsung/common/ums.c | 3 +++ 1 file changed, 3 insertions(+)board/samsung/common/ums.c +0
-0
board/samsung/common/ums.c static struct ums ums_dev = { · line 45
Quoted 9 lines
board/samsung/common/ums.c +3
-0@@ -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 at: Exynos4210 - TRATS.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaQuoted 18 lines · Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Change-Id I4b86c2c59e430fb8b55272ea14f00316d8cb3dcaSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>Cc Kyungmin Park <[email protected]>--- board/samsung/common/ums.c | 3 +++ 1 file changed, 3 insertions(+)board/samsung/common/ums.c +0
-0
board/samsung/common/ums.c static struct ums ums_dev = { · line 45
Quoted 9 lines
board/samsung/common/ums.c +3
-0@@ -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?
board/samsung/common/ums.c +3 -0
@@ -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.
PATCH 8/9 ums: always initialize mmc before ums_disk_init()
Quoted 36 lines · Minkyu Kang
Quoted 18 lines · Mateusz Zalega
In some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Change-Id I4b86c2c59e430fb8b55272ea14f00316d8cb3dcaSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>Cc Kyungmin Park <[email protected]>--- board/samsung/common/ums.c | 3 +++ 1 file changed, 3 insertions(+)board/samsung/common/ums.c +0
-0board/samsung/common/ums.c static struct ums ums_dev = { · line 45
Quoted 9 lines
board/samsung/common/ums.c +3
-0@@ -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?
board/samsung/common/ums.c +0
-0
board/samsung/common/ums.c struct ums *ums_init(unsigned int dev_num) · line 79
Quoted 8 lines
board/samsung/common/ums.c +3
-0@@ -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.
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH 9/9 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaPreprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of {usb_function_name, bind_callback) pairs.
--- 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(-)
common/cmd_dfu.c +1 -2
@@ -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 ())/*
common/cmd_thordown.c +1 -2
@@ -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) {
common/cmd_usb_mass_storage.c +1 -1
@@ -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 ();
drivers/usb/gadget/f_dfu.c +8 -3
@@ -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 };
drivers/usb/gadget/f_mass_storage.c +6 -0
@@ -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 };
drivers/usb/gadget/f_thor.c +5 -0
@@ -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 };
drivers/usb/gadget/g_dnl.c +33 -41
118 lines not on this page · raw message
include/dfu.h +0 -7
@@ -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_ */
include/g_dnl.h +11 -0
@@ -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 );
include/thor.h +0 -8
@@ -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_ */
include/usb_mass_storage.h +0 -8
@@ -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__ */
Signature · 1 line
1.8.2.1
PATCH 9/9 USB: gadget: added a saner gadget downloader registration API
Hi Heiko,
Quoted 3 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore 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
Quoted 372 lines
Change-Id I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dcSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Kyungmin Park <[email protected]>--- 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, 66insertions(+), 72 deletions(-)
common/cmd_dfu.c +0
-1@@ -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[])intcontroller_index=simple_strtoul(usb_controller, NULL, 0);board_usb_init(controller_index, USB_INIT_DEVICE);common/cmd_dfu.c +1
-1-g_dnl_register (s); +g_dnl_register ("usb_dnl_dfu" );while (1 ) {if (dfu_reset ())/* common/cmd_thordown.c +1
-2@@ -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) {(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 99487f4..c8e152c 100644common/cmd_usb_mass_storage.c +1
-1@@ -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 ();drivers/usb/gadget/f_dfu.c +7
-3@@ -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",drivers/usb/gadget/f_dfu.c +1
-0+ .fptr = dfu_add };(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex b1fe8bd..b7d03f2 100644drivers/usb/gadget/f_mass_storage.c +5
-0@@ -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",drivers/usb/gadget/f_mass_storage.c +1
-0+ .fptr = fsg_add };drivers/usb/gadget/f_thor.c +4
-0@@ -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",drivers/usb/gadget/f_thor.c +1
-0+ .fptr = thor_add };drivers/usb/gadget/g_dnl.c +15
-14@@ -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();drivers/usb/gadget/g_dnl.c +7
-3+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);drivers/usb/gadget/g_dnl.c +3
-1return 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_dnlto support multiple USB functions.
+ */drivers/usb/gadget/g_dnl.c +2
-19+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);
drivers/usb/gadget/g_dnl.c +2
-4- 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 ; }include/dfu.h +0
-7@@ -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_ */ include/g_dnl.h +11
-0@@ -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 );include/thor.h +0
-8@@ -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_ */ include/usb_mass_storage.h +0
-8@@ -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__ */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 9/9 USB: gadget: added a saner gadget downloader registration API
Hello Lukasz,
Am 10.01.2014 09:23, schrieb Lukasz Majewski:
Quoted 9 lines
Hi Heiko,
Quoted 3 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of {usb_function_name,bind_callback) pairs.Could you test those
g_dnlrelated 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:
bye,
Heiko
Signature · 2 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
PATCH 9/9 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaHi Mateusz,
Quoted 3 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of {usb_function_name,bind_callback) pairs.
Tested at: Exynos4210 - TRATS.
Quoted 372 lines
Change-Id I4e0515e7fd61ff19793e9ac9a6c48b07c616c9dcSigned-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Kyungmin Park <[email protected]>--- 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, 66insertions(+), 72 deletions(-)
common/cmd_dfu.c +0
-1@@ -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[])intcontroller_index=simple_strtoul(usb_controller, NULL, 0);board_usb_init(controller_index, USB_INIT_DEVICE);common/cmd_dfu.c +1
-1-g_dnl_register (s); +g_dnl_register ("usb_dnl_dfu" );while (1 ) {if (dfu_reset ())/* common/cmd_thordown.c +1
-2@@ -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) {(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 99487f4..c8e152c 100644common/cmd_usb_mass_storage.c +1
-1@@ -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 ();drivers/usb/gadget/f_dfu.c +7
-3@@ -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",drivers/usb/gadget/f_dfu.c +1
-0+ .fptr = dfu_add };(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex b1fe8bd..b7d03f2 100644drivers/usb/gadget/f_mass_storage.c +5
-0@@ -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",drivers/usb/gadget/f_mass_storage.c +1
-0+ .fptr = fsg_add };drivers/usb/gadget/f_thor.c +4
-0@@ -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",drivers/usb/gadget/f_thor.c +1
-0+ .fptr = thor_add };drivers/usb/gadget/g_dnl.c +15
-14@@ -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();drivers/usb/gadget/g_dnl.c +7
-3+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);drivers/usb/gadget/g_dnl.c +3
-1return 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_dnlto support multiple USB functions.
+ */drivers/usb/gadget/g_dnl.c +2
-19+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);
drivers/usb/gadget/g_dnl.c +2
-4- 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 ; }include/dfu.h +0
-7@@ -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_ */ include/g_dnl.h +11
-0@@ -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 );include/thor.h +0
-8@@ -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_ */ include/usb_mass_storage.h +0
-8@@ -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__ */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH 1/9 mmc: mmc header fix
In reply to Mateusz ZalegaLooks good to me. CC'd mmc Custodian.
Quoted 25 lines · Mateusz Zalega
Structure definition used type
block_dev_desc_t, defined inpart.h, which wasn't included inmmc.h. It worked only in circumstances whencommon.h, or another header usingpart.hwas incuded in implementation files.Change-Id I3ccf56ce1e5334c32a7bc061e8bd9a5054ccb7f5Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>Cc Kyungmin Park <[email protected]>--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)include/mmc.h +1
-0@@ -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)
v2 cover Series v2.
In reply to Mateusz ZalegaThis 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(-)
Signature · 1 line
1.8.2.1
PATCH v2 1/12 mmc: mmc header fix
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.
--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)
include/mmc.h +1 -0
@@ -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)
Signature · 1 line
1.8.2.1
PATCH v2 2/12 part: header fix
In reply to Mateusz ZalegaImplementation 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).
--- include/part.h | 1 + 1 file changed, 1 insertion(+)
include/part.h +1 -0
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH v2 3/12 arm:goni: Update configuration for goni target
In reply to Mateusz ZalegaConfiguration file for GONI has been updated to support FAT file system, new mmc partitioning scheme and read linux kernel from eMMC instead of OneNAND.
--- include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +30 -26
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH v2 4/12 dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaFormer usb_cable_connected() patch broke compilation of boards which do not support this feature.
--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)
common/cmd_usb_mass_storage.c +2 -0
@@ -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 ();
Signature · 1 line
1.8.2.1
PATCH v2 4/12 dfu: fix boards wo USB cable detection
Quoted 14 lines · Mateusz Zalega
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)common/cmd_usb_mass_storage.c +0
-0
common/cmd_usb_mass_storage.c int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, · line 48
Quoted 4 lines
common/cmd_usb_mass_storage.c +1
-0@@ -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 ?
common/cmd_usb_mass_storage.c int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, · line 72
Quoted 11 lines
common/cmd_usb_mass_storage.c +1
-0if (!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
PATCH v2 5/12 am335x: dfu: disable DFU in am335x_evm SPL build
In reply to Mateusz ZalegaFuture patches will make DFU too large to fit in this board's SPL build.
--- include/configs/am335x_evm.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/am335x_evm.h +2 -0
@@ -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.
Signature · 1 line
1.8.2.1
PATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaPreprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs.
---
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(-)
common/cmd_dfu.c +1 -2
@@ -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 ())/*
common/cmd_thordown.c +1 -2
@@ -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) {
common/cmd_usb_mass_storage.c +1 -1
@@ -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 ;
drivers/usb/gadget/f_dfu.c +8 -3
@@ -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 };
drivers/usb/gadget/f_mass_storage.c +6 -0
@@ -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 };
drivers/usb/gadget/f_thor.c +5 -0
@@ -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 };
drivers/usb/gadget/g_dnl.c +33 -41
118 lines not on this page · raw message
include/dfu.h +0 -7
@@ -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_ */
include/g_dnl.h +11 -0
@@ -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 );
include/thor.h +0 -8
@@ -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_ */
include/usb_mass_storage.h +0 -8
@@ -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__ */
Signature · 1 line
1.8.2.1
PATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
Quoted 7 lines · Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>
[...]
drivers/usb/gadget/f_dfu.c int dfu_add(struct usb_configuration *c) · line 788
Quoted 5 lines
drivers/usb/gadget/f_dfu.c +5
-0+ +/* 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).
[...]
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 115
Quoted 12 lines
drivers/usb/gadget/g_dnl.c +12
-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); +} +
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.
Quoted 11 lines
static int
g_dnl_do_config(struct usb_configuration *c){drivers/usb/gadget/g_dnl.c +1
-4const 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" ))
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 125
Quoted 10 lines
drivers/usb/gadget/g_dnl.c +3
-7- 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.
Quoted 9 lines
drivers/usb/gadget/g_dnl.c +3
-0+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 {
drivers/usb/gadget/g_dnl.c static int g_dnl_bind(struct usb_composite_dev *cdev) · line 218
Quoted 10 lines
drivers/usb/gadget/g_dnl.c +3
-3debug ("%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.
[...]
PATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
Quoted 22 lines · Marek Vasut
Quoted 7 lines · Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>[...]
drivers/usb/gadget/f_dfu.c int dfu_add(struct usb_configuration *c) · line 788
Quoted 5 lines
drivers/usb/gadget/f_dfu.c +5
-0+ +/* 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.hquote:104 *
ll_entry_declare()- Declare linker-generated array entry [...]
Quoted 8 lines
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()inlinker-lists.h? It has four params in the example for some reason (it's a remnant from rework).
Yup
Quoted 11 lines
[...]
Quoted 9 lines
drivers/usb/gadget/g_dnl.c +9
-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,
Quoted 8 lines
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 109
Quoted 3 lines
drivers/usb/gadget/g_dnl.c +3
-0+ 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.
Quoted 15 lines
Quoted 15 lines
static int
g_dnl_do_config(struct usb_configuration *c){drivers/usb/gadget/g_dnl.c +1
-8const 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" ))
Quoted 8 lines
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 125
Quoted 6 lines
drivers/usb/gadget/g_dnl.c +3
-3- 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.
Quoted 1 line
want to use
ll_entry_count()andll_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.
Quoted 2 lines
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.
Quoted 15 lines
Quoted 15 lines
drivers/usb/gadget/g_dnl.c +4
-1+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 ); }
Quoted 6 lines
drivers/usb/gadget/g_dnl.c static int g_dnl_bind(struct usb_composite_dev *cdev) · line 218
Quoted 4 lines
drivers/usb/gadget/g_dnl.c +2
-2-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.
Quoted 2 lines
[...]
Regards,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
Marek Vasut
NAKPATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
[...]
Quoted 6 lines
Quoted 4 lines
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.
Quoted 3 lines
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?
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
static int
g_dnl_do_config(struct usb_configuration *c){drivers/usb/gadget/g_dnl.c +1
-3const 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);Quoted 14 lines
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 125
Quoted 11 lines
drivers/usb/gadget/g_dnl.c +3
-8-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
Quoted 2 lines
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.
Quoted 5 lines
Quoted 1 line
want to use
ll_entry_count()andll_entry_get()with an iterator variableI 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.
Quoted 5 lines
Quoted 2 lines
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 ?
[...]
PATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
Quoted 11 lines · Marek Vasut
On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
[...]
Quoted 6 lines
Quoted 4 lines
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
Quoted 7 lines
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.
Quoted 7 lines
Quoted 3 lines
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?
Quoted 5 lines
What I would like to do is for you to follow the advice in
linker_lists.hand 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.
Quoted 33 lines
Quoted 30 lines
Quoted 15 lines
Quoted 15 lines
static int
g_dnl_do_config(struct usb_configuration *c){drivers/usb/gadget/g_dnl.c +1
-3const 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);Quoted 14 lines
drivers/usb/gadget/g_dnl.c static int g_dnl_unbind(struct usb_composite_dev *cdev) · line 125
Quoted 11 lines
drivers/usb/gadget/g_dnl.c +3
-8-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
Quoted 2 lines
It doesn't matter anyway and can't be supported on Coding Style grounds, don't bug me.
Quoted 8 lines
Can be done on purely statistical grounds, try this:
$ git grep 'for.*(.* *++[:alnum:]\+ *)' | wc -l 13 $ git grep 'for.*(.* *[:alnum:]\+++ *)' | wc -l 183Please fix, thank you.
Okay, whatever.
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
want to use
ll_entry_count()andll_entry_get()with an iterator variableI 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.
Quoted 9 lines
Quoted 5 lines
Quoted 2 lines
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.
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH v2 6/12 USB: gadget: added a saner gadget downloader registration API
Quoted 14 lines · Mateusz Zalega
Quoted 13 lines · Marek Vasut
On Wednesday, February 05, 2014 at 01:40:27 PM, Mateusz Zalega wrote:
[...]
Quoted 6 lines
Quoted 4 lines
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!
Quoted 8 lines
Quoted 5 lines
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.
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
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.
Quoted 7 lines
Quoted 5 lines
What I would like to do is for you to follow the advice in
linker_lists.hand 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.
[...]
Quoted 11 lines
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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.
PATCH v2 7/12 arm:goni:dfu Add support for DFU to Goni target
In reply to Mateusz ZalegaProper 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.
--- board/samsung/goni/goni.c | 9 ++++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 11 deletions(-)
board/samsung/goni/goni.c +9 -0
@@ -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
include/configs/s5p_goni.h +43 -11
95 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH v2 8/12 arm:goni: enable GPT command
In reply to Mateusz Zalega--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/s5p_goni.h +5 -0
@@ -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
Signature · 1 line
1.8.2.1
PATCH v2 9/12 arm:goni: enable USB Mass Storage
In reply to Mateusz ZalegaUMS-related defines were added to Samsung Goni config header.
--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -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 */
Signature · 1 line
1.8.2.1
PATCH v2 10/12 dfu:mmc: raw data write fix
In reply to Mateusz ZalegaWhen 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.
---
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(-)
drivers/dfu/dfu_mmc.c +64 -42
@@ -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 ;
include/configs/am335x_evm.h +4 -4
@@ -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;" \
include/configs/trats.h +1 -1
@@ -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;" \
include/configs/trats2.h +1 -1
@@ -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;" \
include/dfu.h +0 -5
@@ -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
Signature · 1 line
1.8.2.1
PATCH v2 10/12 dfu:mmc: raw data write fix
Quoted 7 lines · Mateusz Zalega
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
PATCH v2 11/12 mmc: postponed needless timer initialization
In reply to Mateusz Zalegammc_init() doesn't call get_timer() anymore if MMC is already initialized.
--- drivers/mmc/mmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/mmc.c +5 -2
@@ -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; }
Signature · 1 line
1.8.2.1
PATCH v2 12/12 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaIn some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Tested on Samsung Goni.
---
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(-)
board/samsung/common/ums.c +5 -7
@@ -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); }
Signature · 1 line
1.8.2.1
PATCH v2 12/12 ums: always initialize mmc before ums_disk_init()
Quoted 2 lines · Mateusz Zalega
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
v3 cover DFU, MMC, Gadget, Goni, misc.
In reply to Mateusz ZalegaThis 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(-)
Signature · 1 line
1.9.0
PATCH v3 1/13 mmc: mmc header fix
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.
--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)
include/mmc.h +1 -0
@@ -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)
Signature · 1 line
1.9.0
PATCH v3 2/13 part: header fix
In reply to Mateusz ZalegaImplementation 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).
--- include/part.h | 1 + 1 file changed, 1 insertion(+)
include/part.h +1 -0
@@ -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 */
Signature · 1 line
1.9.0
PATCH v3 3/13 arm:goni: Update configuration for goni target
In reply to Mateusz ZalegaConfiguration file for GONI has been updated to support FAT file system, new mmc partitioning scheme and read linux kernel from eMMC instead of OneNAND.
--- include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +30 -26
@@ -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 */
Signature · 1 line
1.9.0
PATCH v3 4/13 dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaFormer usb_cable_connected() patch broke compilation of boards which do not support this feature.
--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)
common/cmd_usb_mass_storage.c +2 -0
@@ -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 ();
Signature · 1 line
1.9.0
PATCH v3 4/13 dfu: fix boards wo USB cable detection
Hi Mateusz,
Quoted 22 lines
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 5f557d5..5175bd5 100644common/cmd_usb_mass_storage.c +1
-0@@ -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" );
common/cmd_usb_mass_storage.c int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, · line 72
Quoted 7 lines
common/cmd_usb_mass_storage.c +1
-0@@ -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 ();
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v3 5/13 am335x: dfu: disable DFU in am335x_evm SPL build
In reply to Mateusz ZalegaFuture patches will make DFU too large to fit in this board's SPL build.
--- include/configs/am335x_evm.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/am335x_evm.h +2 -0
@@ -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.
Signature · 1 line
1.9.0
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaPreprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs.
--- 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(-)
common/cmd_dfu.c +1 -2
@@ -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 ())/*
common/cmd_thordown.c +1 -2
@@ -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) {
common/cmd_usb_mass_storage.c +1 -1
@@ -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 ;
drivers/usb/gadget/f_dfu.c +3 -0
@@ -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);
drivers/usb/gadget/f_mass_storage.c +3 -0
@@ -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);
drivers/usb/gadget/f_thor.c +2 -0
@@ -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);
drivers/usb/gadget/g_dnl.c +28 -36
112 lines not on this page · raw message
include/dfu.h +0 -7
@@ -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_ */
include/g_dnl.h +24 -0
@@ -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 );
include/thor.h +0 -8
@@ -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_ */
include/usb_mass_storage.h +0 -8
@@ -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__ */
Signature · 1 line
1.9.0
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 7 lines · Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>
Best regards,
Marek Vasut
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaHi Mateusz,
Quoted 325 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>--- 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, 63insertions(+), 64 deletions(-)
common/cmd_dfu.c +0
-1@@ -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[])intcontroller_index=simple_strtoul(usb_controller, NULL, 0);board_usb_init(controller_index, USB_INIT_DEVICE);common/cmd_dfu.c +1
-1-g_dnl_register (s); +g_dnl_register ("usb_dnl_dfu" );while (1 ) {if (dfu_reset ())/* common/cmd_thordown.c +1
-2@@ -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) {(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 5175bd5..4c2de48 100644common/cmd_usb_mass_storage.c +1
-1@@ -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 ;drivers/usb/gadget/f_dfu.c +3
-0@@ -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);(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex f896169..f88bb12 100644drivers/usb/gadget/f_mass_storage.c +3
-0@@ -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);drivers/usb/gadget/f_thor.c +2
-0@@ -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);drivers/usb/gadget/g_dnl.c +18
-14@@ -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);drivers/usb/gadget/g_dnl.c +3
-1return 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_dnlto support multiple USB functions.
+ */drivers/usb/gadget/g_dnl.c +3
-18+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);
drivers/usb/gadget/g_dnl.c +0
-3- ret =usb_composite_register (&g_dnl_driver); -if (ret) {printf ("%s: failed!, error: %d\n" , __func__, ret);return ret; } -return 0 ; }include/dfu.h +0
-7@@ -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_ */ include/g_dnl.h +24
-0@@ -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 );include/thor.h +0
-8@@ -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_ */ include/usb_mass_storage.h +0
-0@@ -40,13 +40,5 @@ int fsg_init(struct ums *);void fsg_cleanup (void );struct ums *ums_init (unsigned int );int fsg_main_thread (void *);
include/usb_mass_storage.h int fsg_init(struct ums *); · line 44
Quoted 10 lines
include/usb_mass_storage.h +0
-8- -#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__ */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 1 line · Lukasz Majewski
Hi Mateusz,
[...]
Quoted 1 line
Acked-by Lukasz Majewski <[email protected]>
I suggest this goes for -next. Do you agree?
Best regards,
Marek Vasut
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Hi Marek,
Quoted 8 lines · Lukasz Majewski
Quoted 1 line
Hi Mateusz,
[...]
Quoted 1 line
Acked-by Lukasz Majewski <[email protected]>I suggest this goes for -next. Do you agree?
I'm fine with this code going to -next. Thanks in advance.
Quoted 5 lines
Acked-by Marek Vasut <[email protected]>Best regards,
Marek Vasut
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 5 lines · Lukasz Majewski
Hi Marek,
Quoted 3 lines · Lukasz Majewski
Quoted 1 line
Hi Mateusz,
Quoted 7 lines
Quoted 5 lines
[...]
Quoted 1 line
Acked-by Lukasz Majewski <[email protected]>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
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 9 lines · Marek Vasut
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Acked-by Lukasz Majewski <[email protected]>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
__weakusb_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.
Quoted 4 lines
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.
Quoted 1 line
btw. please keep custodians on CC of the respective patches.
OK
Regards,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 7 lines · Mateusz Zalega
Quoted 6 lines · Marek Vasut
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Acked-by Lukasz Majewski <[email protected]>I suggest this goes for -next. Do you agree?
I'm fine with this code going to -next. Thanks in advance.
Quoted 8 lines
Quoted 3 lines
Hm, actually, I see we have open issues with the 04/13 V2 patch (why don't you have default
__weakusb_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 withUSBCNT_DONTKNOWas 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.
Quoted 7 lines
Quoted 4 lines
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
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 8 lines · Marek Vasut
Quoted 4 lines
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 withUSBCNT_DONTKNOWas 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.
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
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,
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH v3 6/13 USB: gadget: added a saner gadget downloader registration API
Quoted 6 lines · Mateusz Zalega
Quoted 5 lines · Marek Vasut
Quoted 4 lines
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 withUSBCNT_DONTKNOWas a return value, make a decision.
Quoted 8 lines
Quoted 4 lines
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.
Quoted 17 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
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.
Quoted 5 lines
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
PATCH v3 7/13 arm:goni:dfu Add support for DFU to Goni target
In reply to Mateusz ZalegaProper 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.
--- board/samsung/goni/goni.c | 8 +++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 11 deletions(-)
board/samsung/goni/goni.c +8 -0
@@ -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
include/configs/s5p_goni.h +43 -11
95 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v3 8/13 arm:goni: enable GPT command
In reply to Mateusz Zalega--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/s5p_goni.h +5 -0
@@ -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
Signature · 1 line
1.9.0
PATCH v3 9/13 arm:goni: enable USB Mass Storage
In reply to Mateusz ZalegaUMS-related defines were added to Samsung Goni config header.
--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -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 */
Signature · 1 line
1.9.0
PATCH v3 10/13 dfu:mmc: raw data write fix
In reply to Mateusz ZalegaWhen 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.
--- 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(-)
drivers/dfu/dfu_mmc.c +64 -42
@@ -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 ;
include/configs/am335x_evm.h +4 -4
@@ -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;" \
include/configs/trats.h +1 -1
@@ -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;" \
include/configs/trats2.h +1 -1
@@ -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;" \
include/dfu.h +0 -5
@@ -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
Signature · 1 line
1.9.0
PATCH v3 11/13 mmc: postponed needless timer initialization
In reply to Mateusz Zalegammc_init() doesn't call get_timer() anymore if MMC is already initialized.
--- drivers/mmc/mmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/mmc.c +5 -2
@@ -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; }
Signature · 1 line
1.9.0
PATCH v3 12/13 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaIn some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Tested on Samsung Goni.
--- board/samsung/common/ums.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
board/samsung/common/ums.c +5 -7
@@ -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); }
Signature · 1 line
1.9.0
PATCH v3 12/13 ums: always initialize mmc before ums_disk_init()
Hi Mateusz,
Quoted 36 lines
In some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Tested on Samsung Goni.
Change-Id I4b86c2c59e430fb8b55272ea14f00316d8cb3dcaSigned-off-by Mateusz Zalega <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>--- board/samsung/common/ums.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)board/samsung/common/ums.c +3
-3@@ -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) {
board/samsung/common/ums.c static struct ums *ums_disk_init(struct mmc *mmc) · line 74
Quoted 10 lines
board/samsung/common/ums.c +2
-4-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); }
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v3 13/13 common: fixed linker-list example
In reply to Mateusz Zalega--- include/linker_lists.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linker_lists.h +1 -1
@@ -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, * };
Signature · 1 line
1.9.0
PATCH v3 13/13 common: fixed linker-list example
Quoted 1 line · Mateusz Zalega
Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0
You samsung guys need to fix your mailers ... and you need to learn to write commit messages.
Quoted 3 lines
Signed-off-by Mateusz Zalega <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>
Other than that, please add this for V2:
Quoted 9 lines
--- include/linker_lists.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linker_lists.h +0
-0
include/linker_lists.h line 234
Quoted 8 lines
include/linker_lists.h +1
-1@@ -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
PATCH v3 13/13 common: fixed linker-list example
Hi Marek,
Quoted 2 lines · Mateusz Zalega
Quoted 1 line
Change-Id: Id1bab29ec026d83f7e811ba82802aad33f77bea0
Yes, definitely :-).
Those Change-Ids are a PITA.
Quoted 33 lines
You samsung guys need to fix your mailers ... and you need to learn to write commit messages.
Quoted 3 lines
Signed-off-by Mateusz Zalega <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>Other than that, please add this for V2:
Acked-by Marek Vasut <[email protected]>Quoted 17 lines
--- include/linker_lists.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)include/linker_lists.h +1
-1@@ -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, Quoted 1 line
* };
Best regards,
Marek Vasut
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
v4 cover DFU, MMC, Gadget, Goni, misc.
In reply to Mateusz ZalegaThis 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.
---
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(-)
Signature · 1 line
1.9.0
PATCH v4 1/13 mmc: mmc header fix
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.
--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)
include/mmc.h +1 -0
@@ -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)
Signature · 1 line
1.9.0
PATCH v4 2/13 part: header fix
In reply to Mateusz ZalegaImplementation 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).
--- include/part.h | 1 + 1 file changed, 1 insertion(+)
include/part.h +1 -0
@@ -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 */
Signature · 1 line
1.9.0
PATCH v4 3/13 common: fixed linker-list example
In reply to Mateusz Zalega--- include/linker_lists.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linker_lists.h +1 -1
@@ -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, * };
Signature · 1 line
1.9.0
PATCH v4 3/13 common: fixed linker-list example
Quoted 4 lines · Mateusz Zalega
Signed-off-by Mateusz Zalega <[email protected]>Cc Marek Vasut <[email protected]>Cc Tom Rini <[email protected]>Cc Minkyu Kang <[email protected]>
You are missing a commit message here. Please fix that and add:
Best regards,
Marek Vasut
PATCH v4 4/13 usb: dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaFormer usb_cable_connected() patch broke compilation of boards which do not support this feature.
--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)
common/cmd_usb_mass_storage.c +2 -0
@@ -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 ();
Signature · 1 line
1.9.0
PATCH v4 4/13 usb: dfu: fix boards wo USB cable detection
Quoted 7 lines · Mateusz Zalega
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Cc Minkyu Kang <[email protected]>
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
PATCH v4 4/13 usb: dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaHi Mateusz,
Quoted 24 lines
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Cc Minkyu Kang <[email protected]>--- common/cmd_usb_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 5f557d5..2f69a53 100644common/cmd_usb_mass_storage.c +1
-0@@ -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 ;
common/cmd_usb_mass_storage.c int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag, · line 72
Quoted 7 lines
common/cmd_usb_mass_storage.c +1
-0@@ -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 ();
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 5/13 mmc: postponed needless timer initialization
In reply to Mateusz Zalegammc_init() doesn't call get_timer() anymore if MMC is already initialized.
--- drivers/mmc/mmc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/mmc/mmc.c +5 -2
@@ -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; }
Signature · 1 line
1.9.0
PATCH v4 6/13 dfu: mmc: raw data write fix
In reply to Mateusz ZalegaWhen 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.
--- 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(-)
drivers/dfu/dfu_mmc.c +64 -42
@@ -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 ;
include/configs/am335x_evm.h +4 -4
@@ -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;" \
include/configs/trats.h +1 -1
@@ -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;" \
include/configs/trats2.h +1 -1
@@ -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;" \
include/dfu.h +0 -5
@@ -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
Signature · 1 line
1.9.0
PATCH v4 7/13 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaIn some cases MMC was still uninitialized while media capacity check, leading to broken ums command.
Tested on Samsung Goni.
--- board/samsung/common/ums.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
board/samsung/common/ums.c +4 -6
@@ -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); }
Signature · 1 line
1.9.0
PATCH v4 7/13 ums: always initialize mmc before ums_disk_init()
Hi Mateusz,
Quoted 32 lines
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 <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>--- board/samsung/common/ums.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)board/samsung/common/ums.c +2
-2@@ -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) {
board/samsung/common/ums.c static struct ums *ums_disk_init(struct mmc *mmc) · line 74
Quoted 10 lines
board/samsung/common/ums.c +2
-4-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); }
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 8/13 am335x: dfu: disable DFU in am335x_evm SPL build
In reply to Mateusz ZalegaFuture patches will make DFU too large to fit in this board's SPL build.
--- include/configs/am335x_evm.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/am335x_evm.h +2 -0
@@ -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.
Signature · 1 line
1.9.0
PATCH v4 8/13 am335x: dfu: disable DFU in am335x_evm SPL build
Hi Mateusz,
Quoted 24 lines
Future patches will make DFU too large to fit in this board's SPL build.
Signed-off-by Mateusz Zalega <[email protected]>Cc Tom Rini <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>--- include/configs/am335x_evm.h | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/include/configs/am335x_evm.hindex 4147f9f..670e3f1 100644include/configs/am335x_evm.h +1
-0@@ -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
include/configs/am335x_evm.h line 361
Quoted 7 lines
include/configs/am335x_evm.h +1
-0@@ -354,6 +355,7 @@ DFU_ALT_INFO_MMC \ DFU_ALT_INFO_RAM \ DFU_ALT_INFO_NAND +#endif /* * Default to using SPI for environment, etc.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 9/13 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaPreprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs.
--- 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(-)
common/cmd_dfu.c +1 -2
@@ -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 ())/*
common/cmd_thordown.c +1 -2
@@ -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) {
common/cmd_usb_mass_storage.c +1 -1
@@ -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 */
drivers/usb/gadget/f_dfu.c +3 -0
@@ -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);
drivers/usb/gadget/f_mass_storage.c +3 -0
@@ -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);
drivers/usb/gadget/f_thor.c +2 -0
@@ -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);
drivers/usb/gadget/g_dnl.c +28 -36
112 lines not on this page · raw message
include/dfu.h +0 -7
@@ -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_ */
include/g_dnl.h +24 -0
@@ -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 );
include/thor.h +0 -8
@@ -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_ */
include/usb_mass_storage.h +0 -8
@@ -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__ */
Signature · 1 line
1.9.0
PATCH v4 9/13 USB: gadget: added a saner gadget downloader registration API
Quoted 8 lines · Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Cc Minkyu Kang <[email protected]>
Changelog is missing on all patches in this series !
Best regards,
Marek Vasut
PATCH v4 9/13 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaHi Mateusz,
Quoted 326 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Cc Minkyu Kang <[email protected]>--- 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, 63insertions(+), 64 deletions(-)
common/cmd_dfu.c +0
-1@@ -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[])intcontroller_index=simple_strtoul(usb_controller, NULL, 0);board_usb_init(controller_index, USB_INIT_DEVICE);common/cmd_dfu.c +1
-1-g_dnl_register (s); +g_dnl_register ("usb_dnl_dfu" );while (1 ) {if (dfu_reset ())/* common/cmd_thordown.c +1
-2@@ -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) {(quoted diff) +0
-0
b/common/cmd_usb_mass_storage.cindex 2f69a53..ab10ea6 100644common/cmd_usb_mass_storage.c +1
-1@@ -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 */ drivers/usb/gadget/f_dfu.c +3
-0@@ -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);(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex f896169..f88bb12 100644drivers/usb/gadget/f_mass_storage.c +3
-0@@ -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);drivers/usb/gadget/f_thor.c +2
-0@@ -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);drivers/usb/gadget/g_dnl.c +18
-14@@ -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);drivers/usb/gadget/g_dnl.c +3
-1return 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_dnlto support multiple USB functions.
+ */drivers/usb/gadget/g_dnl.c +3
-18+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);
drivers/usb/gadget/g_dnl.c +0
-3- ret =usb_composite_register (&g_dnl_driver); -if (ret) {printf ("%s: failed!, error: %d\n" , __func__, ret);return ret; } -return 0 ; }include/dfu.h +0
-7@@ -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_ */ include/g_dnl.h +24
-0@@ -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 );include/thor.h +0
-8@@ -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_ */ include/usb_mass_storage.h +0
-0@@ -40,13 +40,5 @@ int fsg_init(struct ums *);void fsg_cleanup (void );struct ums *ums_init (unsigned int );int fsg_main_thread (void *);
include/usb_mass_storage.h int fsg_init(struct ums *); · line 44
Quoted 10 lines
include/usb_mass_storage.h +0
-8- -#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__ */
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v4 9/13 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaHi, 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
Quoted 332 lines · Mateusz Zalega
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>Cc Minkyu Kang <[email protected]>--- 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(-)common/cmd_dfu.c +1
-2@@ -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 ())/* common/cmd_thordown.c +1
-2@@ -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) {common/cmd_usb_mass_storage.c +1
-1@@ -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 */ drivers/usb/gadget/f_dfu.c +3
-0@@ -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);drivers/usb/gadget/f_mass_storage.c +3
-0@@ -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);drivers/usb/gadget/f_thor.c +2
-0@@ -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);drivers/usb/gadget/g_dnl.c +28
-36@@ -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 ; }include/dfu.h +0
-7@@ -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_ */ include/g_dnl.h +24
-0@@ -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 );include/thor.h +0
-8@@ -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_ */ include/usb_mass_storage.h +0
-8@@ -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__ */
PATCH v4 9/13 USB: gadget: added a saner gadget downloader registration API
Quoted 12 lines · Jaehoon Chung
Hi, Mateusz.
ERROR: "foo * bar" should be "foo *bar"
#701: FILE:drivers/usb/gadget/g_dnl.c:104:
+static inline structg_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 structg_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:
include/g_dnl.h line 32
Quoted 2 lines
include/g_dnl.h +2
-0+struct g_dnl_bind_callback +{
ack
Signature · 2 lines
Mateusz Zalega Samsung R&D Institute Poland
PATCH v4 10/13 arm: goni: Update configuration for Goni target
In reply to Mateusz ZalegaConfiguration file for GONI has been updated to support FAT file system, new mmc partitioning scheme and read linux kernel from eMMC instead of OneNAND.
--- include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +30 -26
@@ -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 */
Signature · 1 line
1.9.0
PATCH v4 11/13 arm: goni: dfu: Add support for DFU to Goni target
In reply to Mateusz ZalegaProper 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.
--- board/samsung/goni/goni.c | 8 +++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 11 deletions(-)
board/samsung/goni/goni.c +8 -0
@@ -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
include/configs/s5p_goni.h +43 -11
95 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v4 12/13 arm: goni: enable GPT command
In reply to Mateusz Zalega--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/s5p_goni.h +5 -0
@@ -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
Signature · 1 line
1.9.0
PATCH v4 13/13 arm: goni: enable USB Mass Storage
In reply to Mateusz ZalegaUMS-related defines were added to Samsung Goni config header.
--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -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 */
Signature · 1 line
1.9.0
v5 cover DFU, MMC, Gadget, Goni, misc.
In reply to Mateusz ZalegaPatchset 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...
---
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(-)
Signature · 1 line
1.9.0
PATCH v5 1/12 mmc: mmc header fix
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.
---
Changes since v1:
- none
--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)
include/mmc.h +1 -0
@@ -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)
Signature · 1 line
1.9.0
PATCH v5 1/12 mmc: mmc header fix
Hi Pantelis,
Quoted 20 lines
Structure definition used type
block_dev_desc_t, defined inpart.h, which wasn't included inmmc.h. It worked only in circumstances whencommon.h, or another header usingpart.hwas incuded in implementation files.Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>Cc Pantelis Antoniou <[email protected]>---
Changes since v1:
- none--- include/mmc.h | 1 + 1 file changed, 1 insertion(+)include/mmc.h +0
-0
include/mmc.h line 18
Quoted 7 lines
include/mmc.h +1
-0@@ -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.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 1/12 mmc: mmc header fix
Hi Lukasz,
Quoted 33 lines · Lukasz Majewski
Hi Pantelis,
Quoted 20 lines
Structure definition used type
block_dev_desc_t, defined inpart.h, which wasn't included inmmc.h. It worked only in circumstances whencommon.h, or another header usingpart.hwas incuded in implementation files.Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>Cc Pantelis Antoniou <[email protected]>---
Changes since v1:
- none
---include/mmc.h| 1 +1 file changed, 1 insertion(+)include/mmc.h +0
-0include/mmc.h line 18
Quoted 7 lines
include/mmc.h +1
-0@@ -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.
Quoted 4 lines
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.
Quoted 9 lines
Pantelis, could you ACK this patch? And then I will add it to u-boot-dfu.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 1/12 mmc: mmc header fix
In reply to Mateusz ZalegaHi Mateusz,
Quoted 8 lines
Structure definition used type
block_dev_desc_t, defined inpart.h, which wasn't included inmmc.h. It worked only in circumstances whencommon.h, or another header usingpart.hwas incuded in implementation files.Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>Cc Pantelis Antoniou <[email protected]>
Applied to u-boot-dfu branch.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 2/12 part: header fix
In reply to Mateusz ZalegaImplementation 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).
---
Changes since v1:
- none
--- include/part.h | 1 + 1 file changed, 1 insertion(+)
include/part.h +1 -0
@@ -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 */
Signature · 1 line
1.9.0
PATCH v5 2/12 part: header fix
Hi Tom,
Quoted 26 lines
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 <[email protected]>Cc Tom Rini <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes since v1:
- none--- include/part.h | 1 + 1 file changed, 1 insertion(+)include/part.h +1
-0@@ -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
Quoted 1 line
*/
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.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 2/12 part: header fix
In reply to Mateusz ZalegaHi Mateusz,
Quoted 7 lines
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 <[email protected]>Cc Tom Rini <[email protected]>Cc Minkyu Kang <[email protected]>
Applied to u-boot-dfu branch.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 3/12 usb: dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaFormer 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.
---
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(-)
README +0 -7
@@ -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
board/samsung/origen/origen.c +0 -7
@@ -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 ) {
board/samsung/trats/trats.c +1 -3
@@ -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 ) {
board/samsung/trats2/trats2.c +1 -3
@@ -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 ) {
board/samsung/universal_c210/universal.c +0 -7
@@ -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 ();
common/cmd_usb_mass_storage.c +6 -2
@@ -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;
drivers/usb/gadget/f_mass_storage.c +4 -4
@@ -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 ; }
drivers/usb/gadget/g_dnl.c +5 -0
@@ -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;
include/configs/exynos4-dt.h +0 -1
@@ -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
include/g_dnl.h +1 -0
@@ -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 *);
include/usb.h +0 -10
@@ -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
Signature · 1 line
1.9.0
PATCH v5 3/12 usb: dfu: fix boards wo USB cable detection
Quoted 12 lines · Mateusz Zalega
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.I've renamed
usb_cable_connected()tog_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 ing_dnl.h-usb.hseems to be intended for USB host implementation.
Quoted 8 lines
Existing code, confronted with default
-EOPNOTSUPPreturn value, continues as if the cable was connected.
CONFIG_USB_CABLE_CHECKwas removed.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>
Best regards,
Marek Vasut
PATCH v5 3/12 usb: dfu: fix boards wo USB cable detection
In reply to Mateusz ZalegaHi Mateusz,
Quoted 12 lines
Former
usb_cable_connected()patch broke compilation of boards which do not support this feature.I've renamed
usb_cable_connected()tog_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 ing_dnl.h-usb.hseems to be intended for USB host implementation.
Quoted 8 lines
Existing code, confronted with default
-EOPNOTSUPPreturn value, continues as if the cable was connected.
CONFIG_USB_CABLE_CHECKwas removed.Signed-off-by Mateusz Zalega <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Marek Vasut <[email protected]>
Applied to u-boot-dfu. Thanks
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 4/12 dfu: mmc: raw data write fix
In reply to Mateusz ZalegaWhen 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.
---
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(-)
drivers/dfu/dfu_mmc.c +65 -40
@@ -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 ;
include/dfu.h +0 -5
@@ -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
Signature · 1 line
1.9.0
PATCH v5 4/12 dfu: mmc: raw data write fix
Hi Mateusz,
Quoted 14 lines
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.
Quoted 7 lines
Tested on Samsung Goni.
Signed-off-by Mateusz Zalega <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Acked-by Lukasz Majewski <[email protected]>Acked-by Tom Rini <[email protected]>Cc Minkyu Kang <[email protected]>
Applied to u-boot-dfu. Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 5/12 dfu: mmc: change offset base handling
In reply to Mateusz ZalegaPreviously 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.
---
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(-)
drivers/dfu/dfu_mmc.c +6 -2
@@ -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 ) {
include/configs/am335x_evm.h +4 -4
@@ -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;" \
include/configs/trats.h +1 -1
@@ -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;" \
include/configs/trats2.h +1 -1
@@ -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;" \
Signature · 1 line
1.9.0
PATCH v5 5/12 dfu: mmc: change offset base handling
Hi Mateusz,
Quoted 9 lines
Previously offsets handled by
dfu_fill_entity_mmc(), defined in boards'CONFIG_DFU_ALTwere 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 <[email protected]>Cc Lukasz Majewski <[email protected]>Cc Tom Rini <[email protected]>Cc Minkyu Kang <[email protected]>
Applied to u-boot-dfu. Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 6/12 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaIn 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.
---
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(-)
board/samsung/common/ums.c +2 -4
@@ -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); }
Signature · 1 line
1.9.0
PATCH v5 6/12 ums: always initialize mmc before ums_disk_init()
Quoted 5 lines · Mateusz Zalega
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.
PATCH v5 6/12 ums: always initialize mmc before ums_disk_init()
In reply to Mateusz ZalegaHi Mateusz,
Quoted 4 lines
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.
Quoted 8 lines
UMS has to initialize resources it uses.
Tested on Samsung Goni.
Signed-off-by Mateusz Zalega <[email protected]>Tested-by Mateusz Zalega <[email protected]>Acked-by Lukasz Majewski <[email protected]>Cc Minkyu Kang <[email protected]>
Applied to u-boot-dfu. THanks,
Quoted 29 lines
---
Changes since v3:
- Added const attribute ofums_disk_initintroduced type warnings. It would take a lot of changes to MMC core code to fix it, so it was dropped, even thoughums_disk_initshouldn'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(-)board/samsung/common/ums.c +2
-4@@ -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); }
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 7/12 am335x: dfu: disable DFU in am335x_evm SPL build
In reply to Mateusz ZalegaFuture patches will make DFU too large to fit in this board's SPL build.
---
Changes since v2:
- none
--- include/configs/am335x_evm.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/am335x_evm.h +2 -0
@@ -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.
Signature · 1 line
1.9.0
PATCH v5 7/12 am335x: dfu: disable DFU in am335x_evm SPL build
Hi Mateusz,
Quoted 6 lines
Future patches will make DFU too large to fit in this board's SPL build.
Signed-off-by Mateusz Zalega <[email protected]>Acked-by Tom Rini <[email protected]>Reviewed-by Lukasz Majewski <[email protected]>
Applied to u-boot-dfu. THanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 8/12 USB: gadget: added a saner gadget downloader registration API
In reply to Mateusz ZalegaPreprocessor definitions and hardcoded implementation selection in g_dnl core were replaced by a linker list made of (usb_function_name, bind_callback) pairs.
---
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(-)
common/cmd_dfu.c +1 -2
@@ -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 ())/*
common/cmd_thordown.c +1 -2
@@ -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) {
common/cmd_usb_mass_storage.c +1 -1
@@ -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 ;
drivers/usb/gadget/f_dfu.c +3 -0
@@ -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);
drivers/usb/gadget/f_mass_storage.c +3 -0
@@ -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);
drivers/usb/gadget/f_thor.c +2 -0
@@ -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);
drivers/usb/gadget/g_dnl.c +28 -36
112 lines not on this page · raw message
include/dfu.h +0 -7
@@ -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_ */
include/g_dnl.h +23 -0
@@ -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);
include/thor.h +0 -8
@@ -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_ */
include/usb_mass_storage.h +0 -8
@@ -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__ */
Signature · 1 line
1.9.0
PATCH v5 8/12 USB: gadget: added a saner gadget downloader registration API
Hi Mateusz,
Quoted 7 lines
Preprocessor definitions and hardcoded implementation selection in
g_dnlcore were replaced by a linker list made of (usb_function_name,bind_callback) pairs.Signed-off-by Mateusz Zalega <[email protected]>Acked-by Lukasz Majewski <[email protected]>Acked-by Marek Vasut <[email protected]>
Applied to u-boot-dfu. Thanks.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 9/12 arm: goni: Update configuration for Goni target
In reply to Mateusz ZalegaConfiguration file for GONI has been updated to support FAT file system, new mmc partitioning scheme and read linux kernel from eMMC instead of OneNAND.
---
Changes since v1:
- reordered
--- include/configs/s5p_goni.h | 56 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +30 -26
@@ -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 */
Signature · 1 line
1.9.0
PATCH v5 9/12 arm: goni: Update configuration for Goni target
Hi Minkyu,
Quoted 154 lines
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes since v1:
- reordered--- include/configs/s5p_goni.h | 56+++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
include/configs/s5p_goni.h +0
-0@@ -17,6 +17,7 @@#define CONFIG_S5PC110 1/* which is in a S5PC110 */ #define
CONFIG_MACH_GONI1 /* working with
Goni */
+#include <linux/sizes.h>
#include <asm/arch/cpu.h> /* get chip and board defs
*/
#defineCONFIG_ARCH_CPU_INITinclude/configs/s5p_goni.h +0
-5@@ -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.*/
+#defineCONFIG_SYS_MALLOC_LEN(CONFIG_ENV_SIZE+SZ_1M) +
/*
* select serial console configuration
*/include/configs/s5p_goni.h +2
-4@@ -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 rwrootfstype=ext2" \ +#define
CONFIG_RAMDISK_BOOT"root=/dev/ram0 rw rootfstype=ext4" \ "
${console} ${meminfo}"
#defineCONFIG_COMMON_BOOT"${console} ${meminfo} ${mtdparts}"-#define
CONFIG_BOOTARGS"root=/dev/mtdblock8 ubi.mtd=8
ubi.mtd=3 ubi.mtd=6" \include/configs/s5p_goni.h +1
-1-" rootfstype=cramfs " CONFIG_COMMON_BOOT +#define CONFIG_BOOTARGS "root=/dev/mtdblock8 rootfstype=ext4" \
include/configs/s5p_goni.h +1
-1+ 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=3ubi.mtd=6" -
-#defineCONFIG_UBIFS_OPTION"rootflags=bulk_read,no_chk_data_crc" -
#defineCONFIG_MISC_COMMON
#defineCONFIG_MISC_INIT_Rinclude/configs/s5p_goni.h +10
-11@@ -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} 0x30007FC0uImage\0" \
include/configs/s5p_goni.h +10
-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
include/configs/s5p_goni.h line 234
Quoted 6 lines
include/configs/s5p_goni.h +1
-0@@ -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.
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v5 9/12 arm: goni: Update configuration for Goni target
Quoted 19 lines · Lukasz Majewski
Hi Minkyu,
Quoted 10 lines
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>Quoted 7 lines
---
Changes since v1:
- reordered--- include/configs/s5p_goni.h | 56+++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 26 deletions(-)
Quoted 5 lines
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.
PATCH v5 9/12 arm: goni: Update configuration for Goni target
In reply to Mateusz ZalegaQuoted 10 lines · Mateusz Zalega
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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>
Quoted 7 lines
---
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.
PATCH v5 10/12 arm: goni: dfu: Add support for DFU to Goni target
In reply to Mateusz ZalegaProper 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.
---
Changes since v1:
- reordered
--- board/samsung/goni/goni.c | 8 +++++++ include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 51 insertions(+), 11 deletions(-)
board/samsung/goni/goni.c +8 -0
@@ -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
include/configs/s5p_goni.h +43 -11
95 lines not on this page · raw message
Signature · 1 line
1.9.0
PATCH v5 10/12 arm: goni: dfu: Add support for DFU to Goni target
Quoted 13 lines · Mateusz Zalega
Proper adjustment for supporting DFU at GONI target has been made. The
s5p_goni.hfile 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 <[email protected]>Signed-off-by Kyungmin Park <[email protected]>Signed-off-by Mateusz Zalega <[email protected]>Tested-by Arkadiusz Wlodarczyk <[email protected]>Tested-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>
Quoted 8 lines
---
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.
PATCH v5 11/12 arm: goni: enable GPT command
In reply to Mateusz Zalega---
Changes since v1:
- reordered
--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/s5p_goni.h +5 -0
@@ -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
Signature · 1 line
1.9.0
PATCH v5 11/12 arm: goni: enable GPT command
Quoted 9 lines · Mateusz Zalega
Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes since v1:
- reordered--- include/configs/s5p_goni.h | 5 +++++ 1 file changed, 5 insertions(+)
applied to u-boot-samsung.
Thanks,
Minkyu Kang.
PATCH v5 12/12 arm: goni: enable USB Mass Storage
In reply to Mateusz ZalegaUMS-related defines were added to Samsung Goni config header.
---
Changes since v1:
- reordered
--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)
include/configs/s5p_goni.h +2 -0
@@ -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 */
Signature · 1 line
1.9.0
PATCH v5 12/12 arm: goni: enable USB Mass Storage
Quoted 17 lines · Mateusz Zalega
UMS-related defines were added to Samsung Goni config header.
Signed-off-by Mateusz Zalega <[email protected]>Cc Minkyu Kang <[email protected]>---
Changes since v1:
- reordered--- include/configs/s5p_goni.h | 2 ++ 1 file changed, 2 insertions(+)include/configs/s5p_goni.h +0
-0
include/configs/s5p_goni.h line 273
Quoted 7 lines
include/configs/s5p_goni.h +2
-0@@ -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.