Patchwork [U-Boot,4/9] arm:goni:dfu Add support for DFU to Goni target

login
register
mail settings
Submitter Mateusz Zalega
Date Jan. 9, 2014, 2:31 p.m.
Message ID <1389277919-15279-4-git-send-email-m.zalega@samsung.com>
Download mbox | patch
Permalink /patch/308829/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Mateusz Zalega - Jan. 9, 2014, 2:31 p.m.
Proper adjustment for supporting DFU at GONI target has been made.
The s5p_goni.h file has been updated. Moreover, the code for low level
USB initialization has been added to Goni board code.

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

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

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

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

Best Regards,
Jaehoon Chung

> +	""PARTS_ROOT" part 0 5\0"
> +
> +#define PARTS_DEFAULT \
> +	"uuid_disk=${uuid_gpt_disk};" \
> +	"name="PARTS_CSA",size=8MiB,uuid=${uuid_gpt_"PARTS_CSA"};" \
> +	"name="PARTS_BOOTLOADER",size=60MiB," \
> +	"uuid=${uuid_gpt_"PARTS_BOOTLOADER"};" \
> +	"name="PARTS_BOOT",size=100MiB,uuid=${uuid_gpt_"PARTS_BOOT"};" \
> +	"name="PARTS_ROOT",size=1GiB,uuid=${uuid_gpt_"PARTS_ROOT"};" \
> +	"name="PARTS_DATA",size=3GiB,uuid=${uuid_gpt_"PARTS_DATA"};" \
> +	"name="PARTS_CSC",size=150MiB,uuid=${uuid_gpt_"PARTS_CSC"};" \
> +	"name="PARTS_UMS",size=-,uuid=${uuid_gpt_"PARTS_UMS"}\0" \
>  
>  #define CONFIG_BOOTCOMMAND	"run mmcboot"
>  
> @@ -144,18 +175,18 @@
>  	"verify=n\0" \
>  	"rootfstype=ext4\0" \
>  	"console=" CONFIG_DEFAULT_CONSOLE \
> -	"mtdparts=" MTDPARTS_DEFAULT \
>  	"meminfo=mem=80M mem=256M@0x40000000 mem=128M@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
>
Mateusz Zalega - Jan. 13, 2014, 2:45 p.m.
On 01/10/14 05:55, Jaehoon Chung wrote:
> On 01/09/2014 11:31 PM, Mateusz Zalega wrote:
>> Proper adjustment for supporting DFU at GONI target has been made.
>> The s5p_goni.h file has been updated. Moreover, the code for low level
>> USB initialization has been added to Goni board code.
>>
>> The malloc pool has been enlarged in order to support larger buffer
>> sizes needed by DFU implementation.
>>
>> Change-Id: I7812f395a3ee3660cec31f4d8c954057c0149863
>> Signed-off-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Signed-off-by: Mateusz Zalega <m.zalega@samsung.com>
>> Tested-by: Arkadiusz Wlodarczyk <a.wlodarczyk@samsung.com>
>> Tested-by: Mateusz Zalega <m.zalega@samsung.com>
>> Cc: Minkyu Kang <mk7.kang@samsung.com>
>> ---
>>  board/samsung/goni/goni.c  | 10 +++++++++
>>  include/configs/s5p_goni.h | 54 ++++++++++++++++++++++++++++++++++++----------
>>  2 files changed, 53 insertions(+), 11 deletions(-)
>>
>> diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
>> index 366f648..5498daa 100644
>> --- a/board/samsung/goni/goni.c
>> +++ b/board/samsung/goni/goni.c
>> @@ -13,6 +13,9 @@
>>  #include <usb/s3c_udc.h>
>>  #include <asm/arch/cpu.h>
>>  #include <power/max8998_pmic.h>
>> +#include <usb.h>
>> +#include <usb_mass_storage.h>
>> +
>>  DECLARE_GLOBAL_DATA_PTR;
>>  
>>  static struct s5pc110_gpio *s5pc110_gpio;
>> @@ -172,4 +175,11 @@ struct s3c_plat_otg_data s5pc110_otg_data = {
>>  	.regs_otg = S5PC110_OTG_BASE,
>>  	.usb_phy_ctrl = S5PC110_USB_PHY_CONTROL,
>>  };
>> +
>> +int board_usb_init(int index, enum usb_init_type init)
>> +{
>> +	debug("USB_udc_probe\n");
>> +	s3c_udc_probe(&s5pc110_otg_data);
>> +	return 0;
> Always return 0? return s3c_udc_probe(&s5pc110_otg_data);

ACK, will fix.

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

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

(...)

Regards,

Patch

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